From 497f64ae2e7248d996f4c5bb7d5aac68af7dd824 Mon Sep 17 00:00:00 2001 From: Jonas Lagoni Date: Tue, 25 Jun 2024 16:16:10 +0200 Subject: [PATCH] wip --- examples/simple-react/src/SimpleAsyncapi.tsx | 9 +- .../simple-react/src/gamingapi/System.tsx | 4 +- examples/simple-react/types/asyncapi.d.ts | 1 - library/package-lock.json | 634 +++++++++++++++++- library/package.json | 3 +- library/src/helpers/AsyncAPIParserHelper.ts | 32 +- library/src/types.ts | 4 +- .../src/visualiser/helpers/collect-nodes.ts | 209 +----- .../ApplicationFocusView.tsx | 30 +- .../react-flow-renderer/ApplicationView.tsx | 28 +- .../react-flow-renderer/SystemView.tsx | 15 +- 11 files changed, 743 insertions(+), 226 deletions(-) delete mode 100644 examples/simple-react/types/asyncapi.d.ts diff --git a/examples/simple-react/src/SimpleAsyncapi.tsx b/examples/simple-react/src/SimpleAsyncapi.tsx index 83e01a9..16679ed 100644 --- a/examples/simple-react/src/SimpleAsyncapi.tsx +++ b/examples/simple-react/src/SimpleAsyncapi.tsx @@ -1,7 +1,8 @@ import React, { useState, useEffect } from 'react'; import { ApplicationView } from '@asyncapi/edavisualiser'; import '@asyncapi/edavisualiser/styles/default.css'; -const AsyncapiParser = require('@asyncapi/parser/browser'); +import Parser from '@asyncapi/parser/browser'; + const asyncAPIDocument = ` asyncapi: '2.4.0' @@ -219,10 +220,10 @@ components: `; function Asyncapi() { - const [document, setDocument] = useState(undefined); + const [document, setDocument] = useState(undefined); useEffect(() => { - const parser = new AsyncapiParser.Parser(); + const parser = new Parser(); const fetchData = async () => { const {document} = await parser.parse(asyncAPIDocument) setDocument(document); @@ -233,7 +234,7 @@ function Asyncapi() { let node; if (document !== undefined) { node = ( - + ); } else { node =

Wait...

; diff --git a/examples/simple-react/src/gamingapi/System.tsx b/examples/simple-react/src/gamingapi/System.tsx index 34892ed..cadd29c 100644 --- a/examples/simple-react/src/gamingapi/System.tsx +++ b/examples/simple-react/src/gamingapi/System.tsx @@ -2,14 +2,14 @@ import { useState, useEffect } from 'react'; import { SystemView, fromURL } from '@asyncapi/edavisualiser'; import { apps } from './apps'; import '@asyncapi/edavisualiser/styles/default.css'; -const AsyncapiParser = require('@asyncapi/parser/browser'); +import Parser from '@asyncapi/parser/browser'; function Asyncapi() { const [asyncapiDocuments, setAsyncapiDocuments] = useState>([]); useEffect(() => { const fetchData = async () => { - const parser = new AsyncapiParser.Parser(); + const parser = new Parser(); const data = []; for (const [name, asyncapiUrl] of Object.entries(apps)) { const result = fromURL(parser, asyncapiUrl); diff --git a/examples/simple-react/types/asyncapi.d.ts b/examples/simple-react/types/asyncapi.d.ts deleted file mode 100644 index c3d830f..0000000 --- a/examples/simple-react/types/asyncapi.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module '@asyncapi/parser/browser/index'; \ No newline at end of file diff --git a/library/package-lock.json b/library/package-lock.json index ca3d5ef..2754310 100644 --- a/library/package-lock.json +++ b/library/package-lock.json @@ -10,6 +10,7 @@ "license": "Apache-2.0", "dependencies": { "@asyncapi/parser": "^3.0.2", + "@smoya/multi-parser": "^5.0.1", "canvas": "^2.9.1", "dompurify": "^2.3.8", "highlight.js": "^11.5.1", @@ -65,12 +66,62 @@ "node": ">=6.0.0" } }, + "node_modules/@asyncapi/avro-schema-parser": { + "version": "3.0.15", + "resolved": "https://registry.npmjs.org/@asyncapi/avro-schema-parser/-/avro-schema-parser-3.0.15.tgz", + "integrity": "sha512-7dwoxX5lvlbQGIDsvuKPK3VdVDlVnwze4IUxNO/wiHl6CddciP7oF/E7+77+YoeLhiL22XNGsfciuTFgzwSxMA==", + "dependencies": { + "@asyncapi/parser": "^3.0.7", + "@types/json-schema": "^7.0.11", + "avsc": "^5.7.6" + } + }, + "node_modules/@asyncapi/openapi-schema-parser": { + "version": "3.0.15", + "resolved": "https://registry.npmjs.org/@asyncapi/openapi-schema-parser/-/openapi-schema-parser-3.0.15.tgz", + "integrity": "sha512-/+flP6IJ4SIHoegm+Jt+pxpc/D/jh4fJ7dq8Wa6pUp7m2PQESv3CSHVHQj0oa7/H5iwSWmnzgdneMMT1axIEmA==", + "dependencies": { + "@asyncapi/parser": "^3.0.7", + "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", + "ajv": "^8.11.0", + "ajv-errors": "^3.0.0", + "ajv-formats": "^2.1.1" + } + }, + "node_modules/@asyncapi/openapi-schema-parser/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/@asyncapi/openapi-schema-parser/node_modules/ajv-errors": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-3.0.0.tgz", + "integrity": "sha512-V3wD15YHfHz6y0KdhYFjyy9vWtEVALT9UrxfN3zqlI6dMioHnJrqOYfyPKol3oqrnCM9uwkcdCwkJ0WUcbLMTQ==", + "peerDependencies": { + "ajv": "^8.0.1" + } + }, + "node_modules/@asyncapi/openapi-schema-parser/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, "node_modules/@asyncapi/parser": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.0.2.tgz", - "integrity": "sha512-AtDFndWwnaqGoXZQY2DRtORT2Ls4BI7MSR+Rg7TRwxf5jxIz/WVvQwc5HElkHuDEkIZslYu+ukFzNq3awdj0aw==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.0.7.tgz", + "integrity": "sha512-CKdkZbhs+2Mw7M2UZPypKEhKuaF+o5qZB2TQc0pDf+Wr09uEnm6WTdyqzmMGVb5fkQYApu8psQeDyVMbhfoWXQ==", "dependencies": { - "@asyncapi/specs": "^6.2.0", + "@asyncapi/specs": "^6.5.0", "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", "@stoplight/json": "^3.20.2", "@stoplight/json-ref-readers": "^1.2.2", @@ -173,10 +224,47 @@ "webidl-conversions": "^3.0.0" } }, + "node_modules/@asyncapi/protobuf-schema-parser": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@asyncapi/protobuf-schema-parser/-/protobuf-schema-parser-3.2.4.tgz", + "integrity": "sha512-tQWci5hSrABb5obp6IfV4M6rMPQS4mV4qSXSyTggp10ha0pmvmbOEwP+ScCavvx6QXkb13eORGId6lF1KSht/g==", + "dependencies": { + "@asyncapi/parser": "^3.0.7", + "@types/protocol-buffers-schema": "^3.4.1", + "protobufjs": "^7.2.6" + } + }, + "node_modules/@asyncapi/raml-dt-schema-parser": { + "version": "4.0.15", + "resolved": "https://registry.npmjs.org/@asyncapi/raml-dt-schema-parser/-/raml-dt-schema-parser-4.0.15.tgz", + "integrity": "sha512-Ogb/DH6D3o8Irrm5tkMMA9m+rpNyir+Y2moQcWdlsrcZUmhAHyymx97k2D2racgrDZvItYSvhSIYN54f7x9Egg==", + "dependencies": { + "@asyncapi/parser": "^3.0.7", + "js-yaml": "^4.1.0", + "ramldt2jsonschema": "^1.2.3", + "webapi-parser": "^0.5.0" + } + }, + "node_modules/@asyncapi/raml-dt-schema-parser/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "node_modules/@asyncapi/raml-dt-schema-parser/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/@asyncapi/specs": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-6.2.0.tgz", - "integrity": "sha512-5uf/Rg6pavZHx7rVIkP0TP/icIahJCuHgmY1rdtkrWxHZMXbASDDV3DlTUaonbsUeemwchoqljmrTd1O1xqvxg==", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-6.5.0.tgz", + "integrity": "sha512-84QUcfMT05+vvHO5EnSI0I5OZKzMgF/i3vgw92ghk1l52VM/lb3qNnuARzyo+uHJ9kmIb5+naK9wTuliVOdzmg==", "dependencies": { "@types/json-schema": "^7.0.11" } @@ -2823,6 +2911,60 @@ "integrity": "sha512-C16M+IYz0rgRhWZdCmK+h58JMv8vijAA61gmz2rspCSwKwzBebpdcsiUmwrtJRdphuY30i6BSLEOP8ppbNLyLg==", "dev": true }, + "node_modules/@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==" + }, + "node_modules/@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" + }, + "node_modules/@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" + }, + "node_modules/@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==" + }, + "node_modules/@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "dependencies": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "node_modules/@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==" + }, + "node_modules/@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==" + }, + "node_modules/@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==" + }, + "node_modules/@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==" + }, + "node_modules/@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" + }, "node_modules/@sinonjs/commons": { "version": "1.8.6", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.6.tgz", @@ -2841,6 +2983,20 @@ "@sinonjs/commons": "^1.7.0" } }, + "node_modules/@smoya/multi-parser": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@smoya/multi-parser/-/multi-parser-5.0.3.tgz", + "integrity": "sha512-XrSIsLdBeWOo7f61qpaoSPFyE5ctuspSAJZ7pZ08OqY3M7zLiTQi8w37AV4rxOg35+2VRGorzYBycx2bvwe4uw==", + "dependencies": { + "@asyncapi/avro-schema-parser": "^3.0.3", + "@asyncapi/openapi-schema-parser": "^3.0.4", + "@asyncapi/protobuf-schema-parser": "^3.0.0", + "@asyncapi/raml-dt-schema-parser": "^4.0.4", + "parserapiv1": "npm:@asyncapi/parser@^2.1.0", + "parserapiv2": "npm:@asyncapi/parser@3.0.0-next-major-spec.8", + "parserapiv3": "npm:@asyncapi/parser@^3.0.7" + } + }, "node_modules/@stoplight/json": { "version": "3.21.0", "resolved": "https://registry.npmjs.org/@stoplight/json/-/json-3.21.0.tgz", @@ -3695,6 +3851,14 @@ "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.11.tgz", "integrity": "sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==" }, + "node_modules/@types/protocol-buffers-schema": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/@types/protocol-buffers-schema/-/protocol-buffers-schema-3.4.3.tgz", + "integrity": "sha512-8cCg6BiIj4jS0LXUFq3sndmd46yyPLYqMzvXLcTM1MRubh3sfZlQiehoCjGDxSHTqGSjjx8EtVNryIAl0njQWg==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/q": { "version": "1.5.8", "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.8.tgz", @@ -4327,7 +4491,6 @@ "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, "dependencies": { "sprintf-js": "~1.0.2" } @@ -5526,7 +5689,6 @@ "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", - "dev": true, "engines": { "iojs": ">= 1.0.0", "node": ">= 0.12.0" @@ -5627,7 +5789,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", - "dev": true, "engines": { "node": ">= 6" } @@ -7086,7 +7247,6 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" @@ -7450,8 +7610,7 @@ "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, "node_modules/fast-memoize": { "version": "2.5.2", @@ -10709,7 +10868,6 @@ "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -10827,11 +10985,39 @@ "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", "dev": true }, + "node_modules/json-schema-migrate": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/json-schema-migrate/-/json-schema-migrate-0.2.0.tgz", + "integrity": "sha512-dq4/oHWmtw/+0ytnXsDqVn+VsVweTEmzm5jLgguPn9BjSzn6/q58ZiZx3BHiQyJs612f0T5Z+MrUEUUY5DHsRg==", + "dependencies": { + "ajv": "^5.0.0" + } + }, + "node_modules/json-schema-migrate/node_modules/ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha512-Ajr4IcMXq/2QmMkEmSvxqfLN5zGmJ92gHXAeOXq1OekoH2rfDNsgdDoL2f7QaRCy7G/E6TpxBVdRuNraMztGHw==", + "dependencies": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "node_modules/json-schema-migrate/node_modules/fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha512-fueX787WZKCV0Is4/T2cyAdM4+x1S3MXXOAhavE1ys/W42SHAPacLTQhucja22QBYrfGw50M2sRiXPtTGv9Ymw==" + }, + "node_modules/json-schema-migrate/node_modules/json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha512-4JD/Ivzg7PoW8NzdrBSr3UFwC9mHgvI7Z6z3QGBsSHgKaRTUDmyZAAKJo2UbG1kUVfS9WS8bi36N49U1xw43DA==" + }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" }, "node_modules/json-stringify-safe": { "version": "5.0.1", @@ -11247,6 +11433,11 @@ "node": ">=8" } }, + "node_modules/long": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" + }, "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -12261,6 +12452,339 @@ "url": "https://github.com/inikulin/parse5?sponsor=1" } }, + "node_modules/parserapiv1": { + "name": "@asyncapi/parser", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-2.1.2.tgz", + "integrity": "sha512-2pHKnr2P8EujcrvZo4x4zNwsEIAg5vb1ZEhl2+OH0YBg8EYH/Xx73XZ+bbwLaYIg1gvFjm29jNB9UL3CMeDU5w==", + "dependencies": { + "@asyncapi/specs": "^5.1.0", + "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", + "@stoplight/json": "^3.20.2", + "@stoplight/json-ref-readers": "^1.2.2", + "@stoplight/json-ref-resolver": "^3.1.5", + "@stoplight/spectral-core": "^1.16.1", + "@stoplight/spectral-functions": "^1.7.2", + "@stoplight/spectral-parsers": "^1.0.2", + "@stoplight/spectral-ref-resolver": "^1.0.3", + "@stoplight/types": "^13.12.0", + "@types/json-schema": "^7.0.11", + "@types/urijs": "^1.19.19", + "ajv": "^8.11.0", + "ajv-errors": "^3.0.0", + "ajv-formats": "^2.1.1", + "avsc": "^5.7.5", + "js-yaml": "^4.1.0", + "jsonpath-plus": "^7.2.0", + "node-fetch": "2.6.7" + } + }, + "node_modules/parserapiv1/node_modules/@asyncapi/specs": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-5.1.0.tgz", + "integrity": "sha512-yffhETqehkim43luMnPKOwzY0D0YtU4bKpORIXIaid6p5Y5kDLrMGJaEPkNieQp03HMjhjFrnUPtT8kvqe0+aQ==", + "dependencies": { + "@types/json-schema": "^7.0.11" + } + }, + "node_modules/parserapiv1/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/parserapiv1/node_modules/ajv-errors": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-3.0.0.tgz", + "integrity": "sha512-V3wD15YHfHz6y0KdhYFjyy9vWtEVALT9UrxfN3zqlI6dMioHnJrqOYfyPKol3oqrnCM9uwkcdCwkJ0WUcbLMTQ==", + "peerDependencies": { + "ajv": "^8.0.1" + } + }, + "node_modules/parserapiv1/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "node_modules/parserapiv1/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/parserapiv1/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "node_modules/parserapiv1/node_modules/node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/parserapiv1/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/parserapiv1/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/parserapiv1/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/parserapiv2": { + "name": "@asyncapi/parser", + "version": "3.0.0-next-major-spec.8", + "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.0.0-next-major-spec.8.tgz", + "integrity": "sha512-d8ebYM08BCsx3Q4AeLke6naU/NrcAXFEVpS6b3EWcKRdUDce+v0X5k9aDH+YXWCaQApEF28UzcxhlSOJvhIFgQ==", + "dependencies": { + "@asyncapi/specs": "^6.0.0-next-major-spec.9", + "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", + "@stoplight/json-ref-resolver": "^3.1.5", + "@stoplight/spectral-core": "^1.16.1", + "@stoplight/spectral-functions": "^1.7.2", + "@stoplight/spectral-parsers": "^1.0.2", + "@types/json-schema": "^7.0.11", + "@types/urijs": "^1.19.19", + "ajv": "^8.11.0", + "ajv-errors": "^3.0.0", + "ajv-formats": "^2.1.1", + "avsc": "^5.7.5", + "js-yaml": "^4.1.0", + "jsonpath-plus": "^7.2.0", + "node-fetch": "2.6.7", + "ramldt2jsonschema": "^1.2.3", + "webapi-parser": "^0.5.0" + } + }, + "node_modules/parserapiv2/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/parserapiv2/node_modules/ajv-errors": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-3.0.0.tgz", + "integrity": "sha512-V3wD15YHfHz6y0KdhYFjyy9vWtEVALT9UrxfN3zqlI6dMioHnJrqOYfyPKol3oqrnCM9uwkcdCwkJ0WUcbLMTQ==", + "peerDependencies": { + "ajv": "^8.0.1" + } + }, + "node_modules/parserapiv2/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "node_modules/parserapiv2/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/parserapiv2/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "node_modules/parserapiv2/node_modules/node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/parserapiv2/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/parserapiv2/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/parserapiv2/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/parserapiv3": { + "name": "@asyncapi/parser", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.0.7.tgz", + "integrity": "sha512-CKdkZbhs+2Mw7M2UZPypKEhKuaF+o5qZB2TQc0pDf+Wr09uEnm6WTdyqzmMGVb5fkQYApu8psQeDyVMbhfoWXQ==", + "dependencies": { + "@asyncapi/specs": "^6.5.0", + "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", + "@stoplight/json": "^3.20.2", + "@stoplight/json-ref-readers": "^1.2.2", + "@stoplight/json-ref-resolver": "^3.1.5", + "@stoplight/spectral-core": "^1.16.1", + "@stoplight/spectral-functions": "^1.7.2", + "@stoplight/spectral-parsers": "^1.0.2", + "@stoplight/spectral-ref-resolver": "^1.0.3", + "@stoplight/types": "^13.12.0", + "@types/json-schema": "^7.0.11", + "@types/urijs": "^1.19.19", + "ajv": "^8.11.0", + "ajv-errors": "^3.0.0", + "ajv-formats": "^2.1.1", + "avsc": "^5.7.5", + "js-yaml": "^4.1.0", + "jsonpath-plus": "^7.2.0", + "node-fetch": "2.6.7" + } + }, + "node_modules/parserapiv3/node_modules/ajv": { + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/parserapiv3/node_modules/ajv-errors": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-3.0.0.tgz", + "integrity": "sha512-V3wD15YHfHz6y0KdhYFjyy9vWtEVALT9UrxfN3zqlI6dMioHnJrqOYfyPKol3oqrnCM9uwkcdCwkJ0WUcbLMTQ==", + "peerDependencies": { + "ajv": "^8.0.1" + } + }, + "node_modules/parserapiv3/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "node_modules/parserapiv3/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/parserapiv3/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "node_modules/parserapiv3/node_modules/node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/parserapiv3/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/parserapiv3/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/parserapiv3/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/pascalcase": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", @@ -14096,6 +14620,37 @@ "reflect.ownkeys": "^0.2.0" } }, + "node_modules/protobufjs": { + "version": "7.2.6", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.6.tgz", + "integrity": "sha512-dgJaEDDL6x8ASUZ1YqWciTRrdOuYNzoOf27oHNfdyvKqHr5i0FV7FSLU+aIeFjyFgVxrpTOtQUi0BLLBymZaBw==", + "hasInstallScript": true, + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/node": ">=13.7.0", + "long": "^5.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/protobufjs/node_modules/@types/node": { + "version": "20.11.25", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.25.tgz", + "integrity": "sha512-TBHyJxk2b7HceLVGFcpAUjsa5zIdsPWlR6XHfyGzd0SFu+/NFgQgMAl96MSDZgQDvJAvV6BKsFOrt6zIL09JDw==", + "dependencies": { + "undici-types": "~5.26.4" + } + }, "node_modules/prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", @@ -14230,6 +14785,21 @@ "integrity": "sha512-SbiLPU40JuJniHexQSAgad32hfwd+DRUdwF2PlVuI5RZD0/vahUco7R8vD86J/tcEKKF9vZrUVwgtmGCqlCKyA==", "dev": true }, + "node_modules/ramldt2jsonschema": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/ramldt2jsonschema/-/ramldt2jsonschema-1.2.3.tgz", + "integrity": "sha512-+wLDAV2NNv9NkfEUOYStaDu/6RYgYXeC1zLtXE+dMU/jDfjpN4iJnBGycDwFTFaIQGosOQhxph7fEX6Mpwxdug==", + "dependencies": { + "commander": "^5.0.0", + "js-yaml": "^3.14.0", + "json-schema-migrate": "^0.2.0", + "webapi-parser": "^0.5.0" + }, + "bin": { + "dt2js": "bin/dt2js.js", + "js2dt": "bin/js2dt.js" + } + }, "node_modules/randexp": { "version": "0.4.6", "resolved": "https://registry.npmjs.org/randexp/-/randexp-0.4.6.tgz", @@ -15803,8 +16373,7 @@ "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "dev": true + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" }, "node_modules/sshpk": { "version": "1.18.0", @@ -17102,6 +17671,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", @@ -17502,6 +18076,30 @@ "node": ">=10.13.0" } }, + "node_modules/webapi-parser": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/webapi-parser/-/webapi-parser-0.5.0.tgz", + "integrity": "sha512-fPt6XuMqLSvBz8exwX4QE1UT+pROLHa00EMDCdO0ybICduwQ1V4f7AWX4pNOpCp+x+0FjczEsOxtQU0d8L3QKw==", + "dependencies": { + "ajv": "6.5.2" + } + }, + "node_modules/webapi-parser/node_modules/ajv": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.2.tgz", + "integrity": "sha512-hOs7GfvI6tUI1LfZddH82ky6mOMyTuY0mk7kE2pWpmhhUSkumzaTO5vbVwij39MdwPQWCV4Zv57Eo06NtL/GVA==", + "dependencies": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.1" + } + }, + "node_modules/webapi-parser/node_modules/fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha512-bCK/2Z4zLidyB4ReuIsvALH6w31YfAQDmXMqMx6FyfHqvBxtjC0eRumeSu4Bs3XtXwpyIywtSTrVT99BxY1f9w==" + }, "node_modules/webidl-conversions": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", diff --git a/library/package.json b/library/package.json index 8a40da1..f75a3fb 100644 --- a/library/package.json +++ b/library/package.json @@ -55,7 +55,8 @@ "highlight.js": "^11.5.1", "marked": "^4.0.16", "react-flow-renderer": "9.6.9", - "tailwindcss": "^2.1.1" + "tailwindcss": "^2.1.1", + "@smoya/multi-parser": "^5.0.1" }, "devDependencies": { "@cypress/webpack-preprocessor": "^5.9.0", diff --git a/library/src/helpers/AsyncAPIParserHelper.ts b/library/src/helpers/AsyncAPIParserHelper.ts index eb3ba82..b79177a 100644 --- a/library/src/helpers/AsyncAPIParserHelper.ts +++ b/library/src/helpers/AsyncAPIParserHelper.ts @@ -1,11 +1,13 @@ import { - Parser, ParseOptions, ParseOutput, ValidateOptions, Input, Diagnostic, + AsyncAPIDocumentInterface, } from '@asyncapi/parser'; +import AsyncAPIParser from '@asyncapi/parser/browser'; +import { AsyncapiApplicationData } from '../types'; /** * Functionality taken from the AsyncAPI parser @@ -17,7 +19,7 @@ export interface FromResult { } export function fromURL( - parser: Parser, + parser: any, source: string, options?: RequestInit, ): FromResult { @@ -25,7 +27,6 @@ export function fromURL( const fetchFn = await getFetch(); return (await fetchFn(source, options as any)).text(); } - return { async parse(options: ParseOptions = {}) { const schema = await fetchUrl(); @@ -37,6 +38,31 @@ export function fromURL( }, }; } +export async function getDocument({ + document, + documentUrl, + rawDocument, +}: AsyncapiApplicationData): Promise { + if (document) { + return Promise.resolve(document); + } + let output: ParseOutput | undefined; + const parserOptions = { ruleset: {} }; + const parser = new (AsyncAPIParser as any).Parser(parserOptions); + if (documentUrl) { + output = await fromURL(parser, documentUrl).parse(); + } + if (rawDocument) { + output = await parser.parse(rawDocument); + } + if (!output) { + return Promise.reject('Could not resolve document'); + } + if (output.document === undefined) { + return Promise.reject(output.diagnostics); + } + return Promise.resolve(output.document); +} let __fetchFn: typeof fetch | undefined; async function getFetch(): Promise { diff --git a/library/src/types.ts b/library/src/types.ts index 4dffdc8..1f37d24 100644 --- a/library/src/types.ts +++ b/library/src/types.ts @@ -43,7 +43,9 @@ export interface ApplicationServerData { } export interface AsyncapiApplicationData { - document: AsyncAPIDocumentInterface; + document?: AsyncAPIDocumentInterface; + rawDocument?: string; + documentUrl?: string; topExtended?: JSX.Element; } diff --git a/library/src/visualiser/helpers/collect-nodes.ts b/library/src/visualiser/helpers/collect-nodes.ts index 408669a..be3a9e6 100644 --- a/library/src/visualiser/helpers/collect-nodes.ts +++ b/library/src/visualiser/helpers/collect-nodes.ts @@ -1,19 +1,28 @@ import { getUniqueConnectionId } from './relation-finder'; -import { Node, Edge, FlowElement, ArrowHeadType } from 'react-flow-renderer'; +import { FlowElement, ArrowHeadType } from 'react-flow-renderer'; import { ApplicationViewData, ApplicationFocusViewData, ApplicationNodeData, - AsyncapiApplicationData, IncomingNodeData, OutgoingNodeData, - ApplicationServerData, MessageData, SystemViewData, EdgeType, } from '../../types'; +import { getDocument } from '../../helpers/AsyncAPIParserHelper'; +import { AsyncAPIDocumentInterface } from '@asyncapi/parser'; +import { + createApplicationNode, + createAsyncAPIApplication, + createExternalApplicationNode, + createExternalIncomingNode, + createExternalOutgoingNode, + createIncomingNode, + createOutgoingNode, +} from './node-factory'; -export function collectApplicationNodes( +export async function collectApplicationNodes( { asyncapi, application, @@ -21,11 +30,12 @@ export function collectApplicationNodes( outgoingOperations, }: ApplicationViewData, edgeType: EdgeType = 'smoothstep', -): Array { +): Promise> { const nodes: Array = []; if (asyncapi) { - nodes.push(...collectAsyncAPINodes(asyncapi, { edgeType })); + const document = await getDocument(asyncapi); + nodes.push(...collectAsyncAPINodes(document, { edgeType })); } else if (application) { nodes.push(...createApplicationNode(application)); } @@ -44,7 +54,7 @@ export function collectApplicationNodes( return nodes; } -export function collectApplicationFocusNodes( +export async function collectApplicationFocusNodes( { asyncapi, application, @@ -53,12 +63,13 @@ export function collectApplicationFocusNodes( outgoingOperations, }: ApplicationFocusViewData, edgeType: EdgeType = 'smoothstep', -): Array { +): Promise> { const nodes: Array = []; const leadApplicationIncomingChannels: string[] = []; const leadApplicationOutgoingChannels: string[] = []; if (asyncapi) { + const document = await getDocument(asyncapi); const createIncomingNodeFn = (data: IncomingNodeData) => { leadApplicationIncomingChannels.push(data.id); return createIncomingNode(data, edgeType); @@ -69,7 +80,7 @@ export function collectApplicationFocusNodes( }; nodes.push( - ...collectAsyncAPINodes(asyncapi, { + ...collectAsyncAPINodes(document, { createApplicationNodeFn: createApplicationNode, createIncomingNodeFn, createOutgoingNodeFn, @@ -110,10 +121,11 @@ export function collectApplicationFocusNodes( return []; }; - external.forEach(externalApp => { + external.forEach(async externalApp => { if (externalApp.asyncapi) { + const document = await getDocument(externalApp.asyncapi); nodes.push( - ...collectAsyncAPINodes(externalApp.asyncapi, { + ...collectAsyncAPINodes(document, { createApplicationNodeFn: createExternalApplicationNode, createIncomingNodeFn, createOutgoingNodeFn, @@ -136,10 +148,10 @@ export function collectApplicationFocusNodes( return nodes; } -export function collectSystemNodes( +export async function collectSystemNodes( { applications = [] }: SystemViewData, edgeType: EdgeType = 'floating', -): Array { +): Promise> { const nodes: Array = []; const outgoingConnections: { [key: string]: string[] } = {}; const incomingConnections: { [key: string]: string[] } = {}; @@ -164,9 +176,10 @@ export function collectSystemNodes( return []; }; - applications.forEach(app => { + for (const app of applications) { if (app.asyncapi) { - collectAsyncAPINodes(app.asyncapi, { + const document = await getDocument(app.asyncapi); + collectAsyncAPINodes(document, { createApplicationNodeFn, createOutgoingNodeFn, createIncomingNodeFn, @@ -182,7 +195,7 @@ export function collectSystemNodes( if (app.outgoingOperations) { app.outgoingOperations.forEach(createIncomingNodeFn); } - }); + } for (const [appId, uniqueChannels] of Object.entries(outgoingConnections)) { for (const uniqueChannel of uniqueChannels) { @@ -207,17 +220,19 @@ export function collectSystemNodes( } function collectAsyncAPINodes( - { document, topExtended }: AsyncapiApplicationData, + document: AsyncAPIDocumentInterface, { createApplicationNodeFn = createApplicationNode, createIncomingNodeFn = createIncomingNode, createOutgoingNodeFn = createOutgoingNode, edgeType = 'floating', + topExtended, }: { createApplicationNodeFn?: typeof createApplicationNode; createIncomingNodeFn?: typeof createIncomingNode; createOutgoingNodeFn?: typeof createOutgoingNode; edgeType?: EdgeType; + topExtended?: JSX.Element; }, ): Array { const nodes: Array = []; @@ -275,163 +290,11 @@ function collectAsyncAPINodes( } nodes.unshift( - ...createAsyncAPIApplication( - { document, topExtended }, + ...createAsyncAPIApplication({ + document, + topExtended, createApplicationNodeFn, - ), + }), ); return nodes; } - -export function createAsyncAPIApplication( - { document, topExtended }: AsyncapiApplicationData, - createApplicationNodeFn: typeof createApplicationNode = createApplicationNode, -): Array { - const documentLicense = document.info().license(); - let license; - if (documentLicense) { - license = { - name: documentLicense.name() ?? 'Not defined', - url: documentLicense.url() ?? 'Not defined', - }; - } - - const servers: ApplicationServerData[] = document - .servers() - .all() - .map(server => { - return { - description: server.description() ?? 'No description', - name: server.id(), - protocol: server.protocol() ?? 'No protocol', - protocolVersion: server.protocolVersion() ?? undefined, - url: server.url(), - }; - }); - - const applicationNodeData: ApplicationNodeData = { - id: document.info().title(), - title: document.info().title(), - version: document.info().version(), - description: document.info().description() ?? 'No description', - externalDocs: - document - .info() - .externalDocs() - ?.url() ?? undefined, - defaultContentType: document.defaultContentType() ?? undefined, - license, - servers, - topExtended, - }; - return createApplicationNodeFn(applicationNodeData); -} - -export function createApplicationNode( - data: ApplicationNodeData, -): Array { - return [ - { - id: data.id, - type: 'applicationNode', - data: { ...data, nodeWidth: 700, nodeHeight: 300 }, - position: { x: 0, y: 0 }, - }, - ] as Node[]; -} - -export function createExternalApplicationNode( - data: ApplicationNodeData, -): Array { - const externalOutgoing = { - id: `outgoing_external_${data.id}`, - type: 'externalApplicationNode', - data: { ...data, nodeWidth: 700, nodeHeight: 300, side: 'outgoing' }, - position: { x: 0, y: 0 }, - }; - const externalIncoming = { - id: `incoming_external_${data.id}`, - type: 'externalApplicationNode', - data: { ...data, nodeWidth: 700, nodeHeight: 300, side: 'incoming' }, - position: { x: 0, y: 0 }, - }; - return [externalOutgoing, externalIncoming]; -} - -export function createIncomingNode( - data: IncomingNodeData, - edgeType: EdgeType, -): Array { - const appId = data.forApplication ?? ''; - const incomingNode: Node = { - id: data.id, - type: 'incomingNode', - data: { ...data, nodeWidth: 650, nodeHeight: 380 }, - position: { x: 0, y: 0 }, - }; - const connectionEdge: Edge = { - id: `incoming-${appId}-${data.id}`, - ...(edgeType !== 'animated' - ? { type: edgeType, animated: false } - : { animated: true }), - style: { stroke: '#7ee3be', strokeWidth: 4 }, - target: appId, - source: data.id, - }; - return [incomingNode, connectionEdge]; -} - -export function createExternalIncomingNode( - data: IncomingNodeData, - source: string, -): Array { - const appId = data.forApplication ?? ''; - return [ - { - id: `incoming-${appId}-${data.id}`, - type: 'default', - style: { stroke: '#7ee3be', strokeWidth: 4 }, - target: `incoming_external_${appId}`, - source, - }, - ] as Edge[]; -} - -export function createOutgoingNode( - data: OutgoingNodeData, - edgeType: EdgeType, -): Array { - const appId = data.forApplication ?? ''; - const outgoingNode: Node = { - id: data.id, - type: 'outgoingNode', - data: { ...data, nodeWidth: 650, nodeHeight: 380 }, - position: { x: 0, y: 0 }, - }; - const connectionEdge: Edge = { - id: `outgoing-${appId}-${data.id}`, - ...(edgeType !== 'animated' - ? { type: edgeType, animated: false } - : { animated: true }), - style: { stroke: 'orange', strokeWidth: 4 }, - source: appId, - target: data.id, - }; - return [outgoingNode, connectionEdge]; -} - -export function createExternalOutgoingNode( - data: OutgoingNodeData, - target: string, -): Array { - const appId = data.forApplication ?? ''; - return [ - { - id: `outgoing-${appId}-${data.id}`, - type: 'default', - style: { stroke: 'orange', strokeWidth: 4 }, - source: `outgoing_external_${appId}`, - target, - }, - ] as Edge[]; -} diff --git a/library/src/visualiser/react-flow-renderer/ApplicationFocusView.tsx b/library/src/visualiser/react-flow-renderer/ApplicationFocusView.tsx index a82eba1..d57ecac 100644 --- a/library/src/visualiser/react-flow-renderer/ApplicationFocusView.tsx +++ b/library/src/visualiser/react-flow-renderer/ApplicationFocusView.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import ReactFlow, { Background, BackgroundVariant, @@ -48,16 +48,24 @@ export const ApplicationFocusView: React.FunctionComponent { const [loaded, setLoaded] = useState(false); - const elements = collectApplicationFocusNodes( - { - asyncapi, - application, - external, - incomingOperations, - outgoingOperations, - }, - edgeType, - ); + const [elements, setElements] = useState([]); + useEffect(() => { + async function collectNodes() { + const collectedElements = await collectApplicationFocusNodes( + { + asyncapi, + application, + external, + incomingOperations, + outgoingOperations, + }, + edgeType, + ); + setElements(collectedElements); + } + + collectNodes(); + }, []); const handleLoaded = (reactFlowInstance: any) => { setLoaded(true); diff --git a/library/src/visualiser/react-flow-renderer/ApplicationView.tsx b/library/src/visualiser/react-flow-renderer/ApplicationView.tsx index 461c6d5..00e07eb 100644 --- a/library/src/visualiser/react-flow-renderer/ApplicationView.tsx +++ b/library/src/visualiser/react-flow-renderer/ApplicationView.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import ReactFlow, { Background, BackgroundVariant, @@ -46,15 +46,23 @@ export const ApplicationView: React.FunctionComponent = ({ edgeType = 'smoothstep', }) => { const [loaded, setLoaded] = useState(false); - const elements = collectApplicationNodes( - { - asyncapi, - application, - incomingOperations, - outgoingOperations, - }, - edgeType, - ); + const [elements, setElements] = useState([]); + useEffect(() => { + async function collectNodes() { + const collectedElements = await collectApplicationNodes( + { + asyncapi, + application, + incomingOperations, + outgoingOperations, + }, + edgeType, + ); + setElements(collectedElements); + } + + collectNodes(); + }, []); const handleLoaded = (reactFlowInstance: any) => { setLoaded(true); diff --git a/library/src/visualiser/react-flow-renderer/SystemView.tsx b/library/src/visualiser/react-flow-renderer/SystemView.tsx index 3577a29..58030b7 100644 --- a/library/src/visualiser/react-flow-renderer/SystemView.tsx +++ b/library/src/visualiser/react-flow-renderer/SystemView.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import ReactFlow, { Background, BackgroundVariant, @@ -44,7 +44,18 @@ export const SystemView: React.FunctionComponent = ({ edgeType = 'floating', }) => { const [loaded, setLoaded] = useState(false); - const elements = collectSystemNodes({ applications }, edgeType); + const [elements, setElements] = useState([]); + useEffect(() => { + async function collectNodes() { + const collectedElements = await collectSystemNodes( + { applications }, + edgeType, + ); + setElements(collectedElements); + } + + collectNodes(); + }, []); const handleLoaded = (reactFlowInstance: any) => { setLoaded(true);