@asyncapi/cli 3.1.1 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/assets/create-glee-app/templates/default/package-lock.json +1185 -676
- package/assets/create-glee-app/templates/tutorial/package-lock.json +1148 -554
- package/assets/create-template/templates/default/package-lock.json +55 -132
- package/lib/apps/api/app.d.ts +15 -0
- package/lib/apps/api/app.js +89 -0
- package/lib/apps/api/configs/development.json +16 -0
- package/lib/apps/api/configs/production.json +16 -0
- package/lib/apps/api/configs/test.json +16 -0
- package/lib/apps/api/constants.d.ts +1 -0
- package/lib/apps/api/constants.js +4 -0
- package/lib/apps/api/controllers/bundle.controller.d.ts +7 -0
- package/lib/apps/api/controllers/bundle.controller.js +44 -0
- package/lib/apps/api/controllers/convert.controller.d.ts +11 -0
- package/lib/apps/api/controllers/convert.controller.js +69 -0
- package/lib/apps/api/controllers/diff.controller.d.ts +7 -0
- package/lib/apps/api/controllers/diff.controller.js +42 -0
- package/lib/apps/api/controllers/docs.controller.d.ts +6 -0
- package/lib/apps/api/controllers/docs.controller.js +24 -0
- package/lib/apps/api/controllers/generate.controller.d.ts +22 -0
- package/lib/apps/api/controllers/generate.controller.js +176 -0
- package/lib/apps/api/controllers/help.controller.d.ts +6 -0
- package/lib/apps/api/controllers/help.controller.js +101 -0
- package/lib/apps/api/controllers/parse.controller.d.ts +10 -0
- package/lib/apps/api/controllers/parse.controller.js +35 -0
- package/lib/apps/api/controllers/validate.controller.d.ts +10 -0
- package/lib/apps/api/controllers/validate.controller.js +50 -0
- package/lib/apps/api/exceptions/problem.exception.d.ts +14 -0
- package/lib/apps/api/exceptions/problem.exception.js +10 -0
- package/lib/apps/api/index.d.ts +9 -0
- package/lib/apps/api/index.js +21 -0
- package/lib/apps/api/middlewares/problem.middleware.d.ts +6 -0
- package/lib/apps/api/middlewares/problem.middleware.js +27 -0
- package/lib/apps/api/middlewares/validation.middleware.d.ts +12 -0
- package/lib/apps/api/middlewares/validation.middleware.js +236 -0
- package/lib/apps/api/server.d.ts +3 -0
- package/lib/apps/api/server.js +19 -0
- package/lib/{commands → apps/cli/commands}/bundle.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/bundle.js +3 -3
- package/lib/{commands → apps/cli/commands}/config/analytics.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/analytics.js +4 -3
- package/lib/{commands → apps/cli/commands}/config/context/add.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/context/add.js +12 -6
- package/lib/{commands → apps/cli/commands}/config/context/current.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/context/current.js +4 -4
- package/lib/{commands → apps/cli/commands}/config/context/edit.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/context/edit.js +12 -6
- package/lib/{commands → apps/cli/commands}/config/context/index.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/context/index.js +1 -1
- package/lib/{commands → apps/cli/commands}/config/context/init.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/context/init.js +7 -4
- package/lib/{commands → apps/cli/commands}/config/context/list.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/context/list.js +4 -4
- package/lib/{commands → apps/cli/commands}/config/context/remove.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/context/remove.js +8 -5
- package/lib/{commands → apps/cli/commands}/config/context/use.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/context/use.js +8 -5
- package/lib/{commands → apps/cli/commands}/config/index.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/index.js +1 -1
- package/lib/{commands → apps/cli/commands}/config/versions.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/config/versions.js +2 -2
- package/lib/{commands → apps/cli/commands}/convert.d.ts +2 -7
- package/lib/apps/cli/commands/convert.js +85 -0
- package/lib/{commands → apps/cli/commands}/diff.d.ts +11 -2
- package/lib/{commands → apps/cli/commands}/diff.js +85 -31
- package/lib/{commands → apps/cli/commands}/format.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/format.js +4 -4
- package/lib/{commands → apps/cli/commands}/generate/fromTemplate.d.ts +4 -5
- package/lib/{commands → apps/cli/commands}/generate/fromTemplate.js +89 -122
- package/lib/{commands → apps/cli/commands}/generate/index.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/generate/index.js +1 -1
- package/lib/{commands → apps/cli/commands}/generate/models.d.ts +6 -1
- package/lib/{commands → apps/cli/commands}/generate/models.js +48 -9
- package/lib/{commands → apps/cli/commands}/new/file.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/new/file.js +11 -8
- package/lib/{commands → apps/cli/commands}/new/glee.d.ts +2 -2
- package/lib/{commands → apps/cli/commands}/new/glee.js +4 -4
- package/lib/{commands → apps/cli/commands}/new/index.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/new/index.js +1 -1
- package/lib/{commands → apps/cli/commands}/new/template.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/new/template.js +10 -8
- package/lib/{commands → apps/cli/commands}/optimize.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/optimize.js +71 -30
- package/lib/{commands → apps/cli/commands}/pretty.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/pretty.js +8 -5
- package/lib/apps/cli/commands/start/api.d.ts +11 -0
- package/lib/apps/cli/commands/start/api.js +23 -0
- package/lib/{commands → apps/cli/commands}/start/index.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/start/index.js +1 -1
- package/lib/{commands → apps/cli/commands}/start/preview.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/start/preview.js +9 -6
- package/lib/{commands → apps/cli/commands}/start/studio.d.ts +1 -1
- package/lib/{commands → apps/cli/commands}/start/studio.js +10 -7
- package/lib/{commands → apps/cli/commands}/validate.d.ts +6 -2
- package/lib/apps/cli/commands/validate.js +94 -0
- package/lib/{core → apps/cli/internal}/base.d.ts +1 -1
- package/lib/{core → apps/cli/internal}/base.js +12 -4
- package/lib/apps/cli/internal/flags/bundle.flags.js +26 -0
- package/lib/apps/cli/internal/flags/config/analytics.flags.js +24 -0
- package/lib/{core → apps/cli/internal}/flags/config/context.flags.js +1 -1
- package/lib/{core → apps/cli/internal}/flags/convert.flags.js +9 -2
- package/lib/{core → apps/cli/internal}/flags/diff.flags.d.ts +1 -1
- package/lib/{core → apps/cli/internal}/flags/diff.flags.js +3 -3
- package/lib/{core → apps/cli/internal}/flags/generate/fromTemplate.flags.js +12 -12
- package/lib/{core → apps/cli/internal}/flags/generate/models.flags.js +2 -2
- package/lib/{core → apps/cli/internal}/flags/global.flags.js +1 -1
- package/lib/{core → apps/cli/internal}/flags/new/file.flags.js +7 -2
- package/lib/{core → apps/cli/internal}/flags/optimize.flags.js +24 -4
- package/lib/apps/cli/internal/flags/parser.flags.d.ts +10 -0
- package/lib/apps/cli/internal/flags/parser.flags.js +28 -0
- package/lib/{core → apps/cli/internal}/flags/proxy.flags.js +3 -3
- package/lib/apps/cli/internal/flags/start/api.flags.d.ts +5 -0
- package/lib/apps/cli/internal/flags/start/api.flags.js +20 -0
- package/lib/apps/cli/internal/flags/start/preview.flags.js +31 -0
- package/lib/{core → apps/cli/internal}/flags/start/studio.flags.js +9 -2
- package/lib/{core → apps/cli/internal}/flags/validate.flags.d.ts +3 -1
- package/lib/{core → apps/cli/internal}/flags/validate.flags.js +11 -3
- package/lib/{core → apps/cli/internal}/globals.d.ts +1 -1
- package/lib/{core → apps/cli/internal}/globals.js +2 -4
- package/lib/{core → apps/cli/internal}/hooks/command_not_found/myhook.js +14 -4
- package/lib/{core → domains}/models/Context.js +1 -1
- package/lib/{core → domains}/models/Preview.js +35 -19
- package/lib/{core → domains}/models/SpecificationFile.d.ts +2 -2
- package/lib/{core → domains}/models/SpecificationFile.js +8 -5
- package/lib/{core → domains}/models/Studio.js +4 -4
- package/lib/domains/services/archiver.service.d.ts +17 -0
- package/lib/domains/services/archiver.service.js +53 -0
- package/lib/domains/services/base.service.d.ts +6 -0
- package/lib/domains/services/base.service.js +26 -0
- package/lib/domains/services/convert.service.d.ts +12 -0
- package/lib/domains/services/convert.service.js +65 -0
- package/lib/domains/services/generator.service.d.ts +15 -0
- package/lib/domains/services/generator.service.js +95 -0
- package/lib/domains/services/validation.service.d.ts +54 -0
- package/lib/domains/services/validation.service.js +288 -0
- package/lib/{core/errors → errors}/specification-file.js +1 -1
- package/lib/{core/errors → errors}/validation-error.js +6 -5
- package/lib/interfaces/index.d.ts +87 -0
- package/lib/interfaces/index.js +7 -0
- package/lib/utils/ajv.d.ts +2 -0
- package/lib/utils/ajv.js +18 -0
- package/lib/utils/app-openapi.d.ts +4 -0
- package/lib/utils/app-openapi.js +28 -0
- package/lib/{core/utils/generator.js → utils/fileWatcher.js} +8 -2
- package/lib/utils/logger.d.ts +6 -0
- package/lib/utils/logger.js +33 -0
- package/lib/utils/retrieve-language.d.ts +1 -0
- package/lib/utils/retrieve-language.js +9 -0
- package/lib/utils/temp-dir.d.ts +2 -0
- package/lib/utils/temp-dir.js +25 -0
- package/oclif.manifest.json +124 -1
- package/package.json +37 -22
- package/lib/commands/convert.js +0 -132
- package/lib/commands/validate.js +0 -45
- package/lib/core/flags/bundle.flags.js +0 -14
- package/lib/core/flags/config/analytics.flags.js +0 -13
- package/lib/core/flags/start/preview.flags.js +0 -15
- package/lib/core/parser.d.ts +0 -33
- package/lib/core/parser.js +0 -176
- /package/lib/{core → apps/cli/internal}/flags/bundle.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/config/analytics.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/config/context.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/convert.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/format.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/format.flags.js +0 -0
- /package/lib/{core → apps/cli/internal}/flags/generate/fromTemplate.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/generate/models.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/global.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/new/file.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/new/glee.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/new/glee.flags.js +0 -0
- /package/lib/{core → apps/cli/internal}/flags/new/template.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/new/template.flags.js +0 -0
- /package/lib/{core → apps/cli/internal}/flags/optimize.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/pretty.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/pretty.flags.js +0 -0
- /package/lib/{core → apps/cli/internal}/flags/proxy.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/start/preview.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/flags/start/studio.flags.d.ts +0 -0
- /package/lib/{core → apps/cli/internal}/hooks/command_not_found/myhook.d.ts +0 -0
- /package/lib/{core → domains}/models/Context.d.ts +0 -0
- /package/lib/{core → domains}/models/Preview.d.ts +0 -0
- /package/lib/{core → domains}/models/Studio.d.ts +0 -0
- /package/lib/{core/errors → errors}/context-error.d.ts +0 -0
- /package/lib/{core/errors → errors}/context-error.js +0 -0
- /package/lib/{core/errors → errors}/diff-error.d.ts +0 -0
- /package/lib/{core/errors → errors}/diff-error.js +0 -0
- /package/lib/{core/errors → errors}/generator-error.d.ts +0 -0
- /package/lib/{core/errors → errors}/generator-error.js +0 -0
- /package/lib/{core/errors → errors}/specification-file.d.ts +0 -0
- /package/lib/{core/errors → errors}/validation-error.d.ts +0 -0
- /package/lib/{core/utils/generator.d.ts → utils/fileWatcher.d.ts} +0 -0
- /package/lib/{core/utils → utils}/scoreCalculator.d.ts +0 -0
- /package/lib/{core/utils → utils}/scoreCalculator.js +0 -0
|
@@ -125,12 +125,14 @@
|
|
|
125
125
|
}
|
|
126
126
|
},
|
|
127
127
|
"node_modules/@babel/code-frame": {
|
|
128
|
-
"version": "7.
|
|
129
|
-
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.
|
|
130
|
-
"integrity": "sha512-
|
|
128
|
+
"version": "7.27.1",
|
|
129
|
+
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz",
|
|
130
|
+
"integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==",
|
|
131
|
+
"license": "MIT",
|
|
131
132
|
"dependencies": {
|
|
132
|
-
"@babel/
|
|
133
|
-
"
|
|
133
|
+
"@babel/helper-validator-identifier": "^7.27.1",
|
|
134
|
+
"js-tokens": "^4.0.0",
|
|
135
|
+
"picocolors": "^1.1.1"
|
|
134
136
|
},
|
|
135
137
|
"engines": {
|
|
136
138
|
"node": ">=6.9.0"
|
|
@@ -394,17 +396,19 @@
|
|
|
394
396
|
}
|
|
395
397
|
},
|
|
396
398
|
"node_modules/@babel/helper-string-parser": {
|
|
397
|
-
"version": "7.
|
|
398
|
-
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.
|
|
399
|
-
"integrity": "sha512-
|
|
399
|
+
"version": "7.27.1",
|
|
400
|
+
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz",
|
|
401
|
+
"integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==",
|
|
402
|
+
"license": "MIT",
|
|
400
403
|
"engines": {
|
|
401
404
|
"node": ">=6.9.0"
|
|
402
405
|
}
|
|
403
406
|
},
|
|
404
407
|
"node_modules/@babel/helper-validator-identifier": {
|
|
405
|
-
"version": "7.
|
|
406
|
-
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.
|
|
407
|
-
"integrity": "sha512-
|
|
408
|
+
"version": "7.27.1",
|
|
409
|
+
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz",
|
|
410
|
+
"integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==",
|
|
411
|
+
"license": "MIT",
|
|
408
412
|
"engines": {
|
|
409
413
|
"node": ">=6.9.0"
|
|
410
414
|
}
|
|
@@ -431,37 +435,25 @@
|
|
|
431
435
|
}
|
|
432
436
|
},
|
|
433
437
|
"node_modules/@babel/helpers": {
|
|
434
|
-
"version": "7.
|
|
435
|
-
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.
|
|
436
|
-
"integrity": "sha512-
|
|
437
|
-
"
|
|
438
|
-
"@babel/template": "^7.25.0",
|
|
439
|
-
"@babel/types": "^7.25.0"
|
|
440
|
-
},
|
|
441
|
-
"engines": {
|
|
442
|
-
"node": ">=6.9.0"
|
|
443
|
-
}
|
|
444
|
-
},
|
|
445
|
-
"node_modules/@babel/highlight": {
|
|
446
|
-
"version": "7.24.7",
|
|
447
|
-
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz",
|
|
448
|
-
"integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==",
|
|
438
|
+
"version": "7.27.4",
|
|
439
|
+
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.27.4.tgz",
|
|
440
|
+
"integrity": "sha512-Y+bO6U+I7ZKaM5G5rDUZiYfUvQPUibYmAFe7EnKdnKBbVXDZxvp+MWOH5gYciY0EPk4EScsuFMQBbEfpdRKSCQ==",
|
|
441
|
+
"license": "MIT",
|
|
449
442
|
"dependencies": {
|
|
450
|
-
"@babel/
|
|
451
|
-
"
|
|
452
|
-
"js-tokens": "^4.0.0",
|
|
453
|
-
"picocolors": "^1.0.0"
|
|
443
|
+
"@babel/template": "^7.27.2",
|
|
444
|
+
"@babel/types": "^7.27.3"
|
|
454
445
|
},
|
|
455
446
|
"engines": {
|
|
456
447
|
"node": ">=6.9.0"
|
|
457
448
|
}
|
|
458
449
|
},
|
|
459
450
|
"node_modules/@babel/parser": {
|
|
460
|
-
"version": "7.
|
|
461
|
-
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.
|
|
462
|
-
"integrity": "sha512-
|
|
451
|
+
"version": "7.27.4",
|
|
452
|
+
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.4.tgz",
|
|
453
|
+
"integrity": "sha512-BRmLHGwpUqLFR2jzx9orBuX/ABDkj2jLKOXrHDTN2aOKL+jFDDKaRNo9nyYsIl9h/UE/7lMKdDjKQQyxKKDZ7g==",
|
|
454
|
+
"license": "MIT",
|
|
463
455
|
"dependencies": {
|
|
464
|
-
"@babel/types": "^7.
|
|
456
|
+
"@babel/types": "^7.27.3"
|
|
465
457
|
},
|
|
466
458
|
"bin": {
|
|
467
459
|
"parser": "bin/babel-parser.js"
|
|
@@ -1729,13 +1721,14 @@
|
|
|
1729
1721
|
}
|
|
1730
1722
|
},
|
|
1731
1723
|
"node_modules/@babel/template": {
|
|
1732
|
-
"version": "7.
|
|
1733
|
-
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.
|
|
1734
|
-
"integrity": "sha512-
|
|
1724
|
+
"version": "7.27.2",
|
|
1725
|
+
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz",
|
|
1726
|
+
"integrity": "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==",
|
|
1727
|
+
"license": "MIT",
|
|
1735
1728
|
"dependencies": {
|
|
1736
|
-
"@babel/code-frame": "^7.
|
|
1737
|
-
"@babel/parser": "^7.
|
|
1738
|
-
"@babel/types": "^7.
|
|
1729
|
+
"@babel/code-frame": "^7.27.1",
|
|
1730
|
+
"@babel/parser": "^7.27.2",
|
|
1731
|
+
"@babel/types": "^7.27.1"
|
|
1739
1732
|
},
|
|
1740
1733
|
"engines": {
|
|
1741
1734
|
"node": ">=6.9.0"
|
|
@@ -1759,13 +1752,13 @@
|
|
|
1759
1752
|
}
|
|
1760
1753
|
},
|
|
1761
1754
|
"node_modules/@babel/types": {
|
|
1762
|
-
"version": "7.
|
|
1763
|
-
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.
|
|
1764
|
-
"integrity": "sha512-
|
|
1755
|
+
"version": "7.27.3",
|
|
1756
|
+
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.3.tgz",
|
|
1757
|
+
"integrity": "sha512-Y1GkI4ktrtvmawoSq+4FCVHNryea6uR+qUQy0AGxLSsjCX0nVmkYQMBLHDkXZuo5hGx7eYdnIaslsdBFm7zbUw==",
|
|
1758
|
+
"license": "MIT",
|
|
1765
1759
|
"dependencies": {
|
|
1766
|
-
"@babel/helper-string-parser": "^7.
|
|
1767
|
-
"@babel/helper-validator-identifier": "^7.
|
|
1768
|
-
"to-fast-properties": "^2.0.0"
|
|
1760
|
+
"@babel/helper-string-parser": "^7.27.1",
|
|
1761
|
+
"@babel/helper-validator-identifier": "^7.27.1"
|
|
1769
1762
|
},
|
|
1770
1763
|
"engines": {
|
|
1771
1764
|
"node": ">=6.9.0"
|
|
@@ -1980,9 +1973,9 @@
|
|
|
1980
1973
|
}
|
|
1981
1974
|
},
|
|
1982
1975
|
"node_modules/@stoplight/spectral-core": {
|
|
1983
|
-
"version": "1.
|
|
1984
|
-
"resolved": "https://registry.npmjs.org/@stoplight/spectral-core/-/spectral-core-1.
|
|
1985
|
-
"integrity": "sha512-
|
|
1976
|
+
"version": "1.20.0",
|
|
1977
|
+
"resolved": "https://registry.npmjs.org/@stoplight/spectral-core/-/spectral-core-1.20.0.tgz",
|
|
1978
|
+
"integrity": "sha512-5hBP81nCC1zn1hJXL/uxPNRKNcB+/pEIHgCjPRpl/w/qy9yC9ver04tw1W0l/PMiv0UeB5dYgozXVQ4j5a6QQQ==",
|
|
1986
1979
|
"license": "Apache-2.0",
|
|
1987
1980
|
"dependencies": {
|
|
1988
1981
|
"@stoplight/better-ajv-errors": "1.0.3",
|
|
@@ -1996,9 +1989,9 @@
|
|
|
1996
1989
|
"@types/json-schema": "^7.0.11",
|
|
1997
1990
|
"ajv": "^8.17.1",
|
|
1998
1991
|
"ajv-errors": "~3.0.0",
|
|
1999
|
-
"ajv-formats": "~2.1.
|
|
1992
|
+
"ajv-formats": "~2.1.1",
|
|
2000
1993
|
"es-aggregate-error": "^1.0.7",
|
|
2001
|
-
"jsonpath-plus": "10.
|
|
1994
|
+
"jsonpath-plus": "^10.3.0",
|
|
2002
1995
|
"lodash": "~4.17.21",
|
|
2003
1996
|
"lodash.topath": "^4.5.2",
|
|
2004
1997
|
"minimatch": "3.1.2",
|
|
@@ -2301,17 +2294,6 @@
|
|
|
2301
2294
|
}
|
|
2302
2295
|
}
|
|
2303
2296
|
},
|
|
2304
|
-
"node_modules/ansi-styles": {
|
|
2305
|
-
"version": "3.2.1",
|
|
2306
|
-
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
|
2307
|
-
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
|
2308
|
-
"dependencies": {
|
|
2309
|
-
"color-convert": "^1.9.0"
|
|
2310
|
-
},
|
|
2311
|
-
"engines": {
|
|
2312
|
-
"node": ">=4"
|
|
2313
|
-
}
|
|
2314
|
-
},
|
|
2315
2297
|
"node_modules/argparse": {
|
|
2316
2298
|
"version": "2.0.1",
|
|
2317
2299
|
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
|
@@ -2434,9 +2416,10 @@
|
|
|
2434
2416
|
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
|
2435
2417
|
},
|
|
2436
2418
|
"node_modules/brace-expansion": {
|
|
2437
|
-
"version": "1.1.
|
|
2438
|
-
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.
|
|
2439
|
-
"integrity": "sha512-
|
|
2419
|
+
"version": "1.1.12",
|
|
2420
|
+
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
|
|
2421
|
+
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
|
|
2422
|
+
"license": "MIT",
|
|
2440
2423
|
"dependencies": {
|
|
2441
2424
|
"balanced-match": "^1.0.0",
|
|
2442
2425
|
"concat-map": "0.0.1"
|
|
@@ -2515,32 +2498,6 @@
|
|
|
2515
2498
|
}
|
|
2516
2499
|
]
|
|
2517
2500
|
},
|
|
2518
|
-
"node_modules/chalk": {
|
|
2519
|
-
"version": "2.4.2",
|
|
2520
|
-
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
|
2521
|
-
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
|
2522
|
-
"dependencies": {
|
|
2523
|
-
"ansi-styles": "^3.2.1",
|
|
2524
|
-
"escape-string-regexp": "^1.0.5",
|
|
2525
|
-
"supports-color": "^5.3.0"
|
|
2526
|
-
},
|
|
2527
|
-
"engines": {
|
|
2528
|
-
"node": ">=4"
|
|
2529
|
-
}
|
|
2530
|
-
},
|
|
2531
|
-
"node_modules/color-convert": {
|
|
2532
|
-
"version": "1.9.3",
|
|
2533
|
-
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
|
2534
|
-
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
|
2535
|
-
"dependencies": {
|
|
2536
|
-
"color-name": "1.1.3"
|
|
2537
|
-
}
|
|
2538
|
-
},
|
|
2539
|
-
"node_modules/color-name": {
|
|
2540
|
-
"version": "1.1.3",
|
|
2541
|
-
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
|
2542
|
-
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw=="
|
|
2543
|
-
},
|
|
2544
2501
|
"node_modules/concat-map": {
|
|
2545
2502
|
"version": "0.0.1",
|
|
2546
2503
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
|
@@ -2820,14 +2777,6 @@
|
|
|
2820
2777
|
"node": ">=6"
|
|
2821
2778
|
}
|
|
2822
2779
|
},
|
|
2823
|
-
"node_modules/escape-string-regexp": {
|
|
2824
|
-
"version": "1.0.5",
|
|
2825
|
-
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
|
2826
|
-
"integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
|
|
2827
|
-
"engines": {
|
|
2828
|
-
"node": ">=0.8.0"
|
|
2829
|
-
}
|
|
2830
|
-
},
|
|
2831
2780
|
"node_modules/estree-walker": {
|
|
2832
2781
|
"version": "1.0.1",
|
|
2833
2782
|
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz",
|
|
@@ -3002,14 +2951,6 @@
|
|
|
3002
2951
|
"url": "https://github.com/sponsors/ljharb"
|
|
3003
2952
|
}
|
|
3004
2953
|
},
|
|
3005
|
-
"node_modules/has-flag": {
|
|
3006
|
-
"version": "3.0.0",
|
|
3007
|
-
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
|
3008
|
-
"integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
|
|
3009
|
-
"engines": {
|
|
3010
|
-
"node": ">=4"
|
|
3011
|
-
}
|
|
3012
|
-
},
|
|
3013
2954
|
"node_modules/has-property-descriptors": {
|
|
3014
2955
|
"version": "1.0.2",
|
|
3015
2956
|
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
|
|
@@ -3354,9 +3295,9 @@
|
|
|
3354
3295
|
"integrity": "sha512-o6/yDBYccGvTz1+QFevz6l6OBZ2+fMVu2JZ9CIhzsYRX4mjaK5IyX9eldUdCmga16zlgQxyrj5pt9kzuj2C02w=="
|
|
3355
3296
|
},
|
|
3356
3297
|
"node_modules/jsonpath-plus": {
|
|
3357
|
-
"version": "10.
|
|
3358
|
-
"resolved": "https://registry.npmjs.org/jsonpath-plus/-/jsonpath-plus-10.
|
|
3359
|
-
"integrity": "sha512-
|
|
3298
|
+
"version": "10.3.0",
|
|
3299
|
+
"resolved": "https://registry.npmjs.org/jsonpath-plus/-/jsonpath-plus-10.3.0.tgz",
|
|
3300
|
+
"integrity": "sha512-8TNmfeTCk2Le33A3vRRwtuworG/L5RrgMvdjhKZxvyShO+mBu2fP50OWUjRLNtvw344DdDarFh9buFAZs5ujeA==",
|
|
3360
3301
|
"license": "MIT",
|
|
3361
3302
|
"dependencies": {
|
|
3362
3303
|
"@jsep-plugin/assignment": "^1.3.0",
|
|
@@ -3531,9 +3472,10 @@
|
|
|
3531
3472
|
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="
|
|
3532
3473
|
},
|
|
3533
3474
|
"node_modules/picocolors": {
|
|
3534
|
-
"version": "1.
|
|
3535
|
-
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.
|
|
3536
|
-
"integrity": "sha512-
|
|
3475
|
+
"version": "1.1.1",
|
|
3476
|
+
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
|
3477
|
+
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
|
3478
|
+
"license": "ISC"
|
|
3537
3479
|
},
|
|
3538
3480
|
"node_modules/picomatch": {
|
|
3539
3481
|
"version": "2.3.1",
|
|
@@ -3876,17 +3818,6 @@
|
|
|
3876
3818
|
"url": "https://github.com/sponsors/ljharb"
|
|
3877
3819
|
}
|
|
3878
3820
|
},
|
|
3879
|
-
"node_modules/supports-color": {
|
|
3880
|
-
"version": "5.5.0",
|
|
3881
|
-
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
|
3882
|
-
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
|
3883
|
-
"dependencies": {
|
|
3884
|
-
"has-flag": "^3.0.0"
|
|
3885
|
-
},
|
|
3886
|
-
"engines": {
|
|
3887
|
-
"node": ">=4"
|
|
3888
|
-
}
|
|
3889
|
-
},
|
|
3890
3821
|
"node_modules/supports-preserve-symlinks-flag": {
|
|
3891
3822
|
"version": "1.0.0",
|
|
3892
3823
|
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
|
|
@@ -3898,14 +3829,6 @@
|
|
|
3898
3829
|
"url": "https://github.com/sponsors/ljharb"
|
|
3899
3830
|
}
|
|
3900
3831
|
},
|
|
3901
|
-
"node_modules/to-fast-properties": {
|
|
3902
|
-
"version": "2.0.0",
|
|
3903
|
-
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
|
|
3904
|
-
"integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==",
|
|
3905
|
-
"engines": {
|
|
3906
|
-
"node": ">=4"
|
|
3907
|
-
}
|
|
3908
|
-
},
|
|
3909
3832
|
"node_modules/tr46": {
|
|
3910
3833
|
"version": "0.0.3",
|
|
3911
3834
|
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { Controller } from '../../interfaces';
|
|
3
|
+
export declare class App {
|
|
4
|
+
private readonly controllers;
|
|
5
|
+
private readonly port;
|
|
6
|
+
private readonly env;
|
|
7
|
+
private app;
|
|
8
|
+
constructor(controllers: Controller[], port?: number | string, env?: string);
|
|
9
|
+
init(): Promise<void>;
|
|
10
|
+
listen(): void;
|
|
11
|
+
getServer(): express.Application;
|
|
12
|
+
private initializeMiddlewares;
|
|
13
|
+
private initializeControllers;
|
|
14
|
+
private initializeErrorHandling;
|
|
15
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.App = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const body_parser_1 = tslib_1.__importDefault(require("body-parser"));
|
|
6
|
+
const compression_1 = tslib_1.__importDefault(require("compression"));
|
|
7
|
+
const config_1 = tslib_1.__importDefault(require("config"));
|
|
8
|
+
const cors_1 = tslib_1.__importDefault(require("cors"));
|
|
9
|
+
const express_1 = tslib_1.__importDefault(require("express"));
|
|
10
|
+
const helmet_1 = tslib_1.__importDefault(require("helmet"));
|
|
11
|
+
// import { problemMiddleware } from './middlewares/problem.middleware';
|
|
12
|
+
const logger_1 = require("../../utils/logger");
|
|
13
|
+
const constants_1 = require("./constants");
|
|
14
|
+
const problem_middleware_1 = require("./middlewares/problem.middleware");
|
|
15
|
+
class App {
|
|
16
|
+
constructor(controllers, port = process.env.PORT || 80, env = process.env.NODE_ENV || 'development') {
|
|
17
|
+
this.controllers = controllers;
|
|
18
|
+
this.port = port;
|
|
19
|
+
this.env = env;
|
|
20
|
+
this.app = (0, express_1.default)();
|
|
21
|
+
}
|
|
22
|
+
init() {
|
|
23
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
// initialize core middlewares
|
|
25
|
+
yield this.initializeMiddlewares();
|
|
26
|
+
// initialize controllers
|
|
27
|
+
yield this.initializeControllers();
|
|
28
|
+
// initialize error handling
|
|
29
|
+
yield this.initializeErrorHandling();
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
listen() {
|
|
33
|
+
this.app.listen(this.port, () => {
|
|
34
|
+
logger_1.logger.info('=================================');
|
|
35
|
+
logger_1.logger.info(`= ENV: ${this.env}`);
|
|
36
|
+
logger_1.logger.info(`= 🚀 AsyncAPI Server API listening on the port ${this.port}`);
|
|
37
|
+
logger_1.logger.info('=================================');
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
getServer() {
|
|
41
|
+
return this.app;
|
|
42
|
+
}
|
|
43
|
+
initializeMiddlewares() {
|
|
44
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const requestBodyLimit = config_1.default.get('request.body.limit');
|
|
46
|
+
this.app.use((0, cors_1.default)({
|
|
47
|
+
origin: config_1.default.get('cors.origin'),
|
|
48
|
+
credentials: config_1.default.get('cors.credentials'),
|
|
49
|
+
}));
|
|
50
|
+
this.app.use((0, compression_1.default)());
|
|
51
|
+
this.app.use(body_parser_1.default.text({ type: ['text/*'], limit: requestBodyLimit }));
|
|
52
|
+
this.app.use(body_parser_1.default.urlencoded({ extended: true, limit: requestBodyLimit }));
|
|
53
|
+
this.app.use(body_parser_1.default.json({
|
|
54
|
+
type: ['json', '*/json', '+json'],
|
|
55
|
+
limit: requestBodyLimit,
|
|
56
|
+
}));
|
|
57
|
+
this.app.use((0, helmet_1.default)({
|
|
58
|
+
contentSecurityPolicy: {
|
|
59
|
+
directives: {
|
|
60
|
+
// for `/docs` path - we need to fetch redoc component from unpkg.com domain and hash for inline script
|
|
61
|
+
'script-src': [
|
|
62
|
+
'\'self\'',
|
|
63
|
+
'unpkg.com',
|
|
64
|
+
'\'sha256-HoDNcNPq7PEOgc6zsff39t5lZ/S65RY7Zl4hI67unp0=\'',
|
|
65
|
+
],
|
|
66
|
+
// for schemas
|
|
67
|
+
'connect-src': ['\'self\'', 'http:'],
|
|
68
|
+
'worker-src': ['\'self\' blob:'],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
// for `/docs` path
|
|
72
|
+
crossOriginEmbedderPolicy: false,
|
|
73
|
+
}));
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
initializeControllers() {
|
|
77
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
for (const controller of this.controllers) {
|
|
79
|
+
this.app.use(`/${constants_1.API_VERSION}/`, yield controller.boot());
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
initializeErrorHandling() {
|
|
84
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
this.app.use(problem_middleware_1.problemMiddleware);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.App = App;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const API_VERSION = "v1";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BundleController = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const express_1 = require("express");
|
|
6
|
+
const bundler_1 = tslib_1.__importDefault(require("@asyncapi/bundler"));
|
|
7
|
+
const validation_middleware_1 = require("../middlewares/validation.middleware");
|
|
8
|
+
const problem_exception_1 = require("../exceptions/problem.exception");
|
|
9
|
+
class BundleController {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.basepath = '/bundle';
|
|
12
|
+
}
|
|
13
|
+
bundle(req, res, next) {
|
|
14
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
const asyncapis = req.body.asyncapis;
|
|
16
|
+
const base = req.body.base;
|
|
17
|
+
try {
|
|
18
|
+
const document = yield (0, bundler_1.default)(asyncapis, { base });
|
|
19
|
+
const bundled = document.json();
|
|
20
|
+
res.status(200).json({ bundled });
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
return next(new problem_exception_1.ProblemException({
|
|
24
|
+
type: 'internal-bundler-error',
|
|
25
|
+
title: 'Internal Bundler error',
|
|
26
|
+
status: 500,
|
|
27
|
+
detail: err.message,
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
boot() {
|
|
33
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const router = (0, express_1.Router)();
|
|
35
|
+
router.post(this.basepath, yield (0, validation_middleware_1.validationMiddleware)({
|
|
36
|
+
path: this.basepath,
|
|
37
|
+
method: 'post',
|
|
38
|
+
documents: ['asyncapis', 'base'],
|
|
39
|
+
}), this.bundle.bind(this));
|
|
40
|
+
return router;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.BundleController = BundleController;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import { Controller } from '../../../interfaces';
|
|
3
|
+
/**
|
|
4
|
+
* Controller which exposes the Convert functionality
|
|
5
|
+
*/
|
|
6
|
+
export declare class ConvertController implements Controller {
|
|
7
|
+
basepath: string;
|
|
8
|
+
private conversionService;
|
|
9
|
+
private convert;
|
|
10
|
+
boot(): Promise<Router>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConvertController = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const express_1 = require("express");
|
|
6
|
+
const validation_middleware_1 = require("../middlewares/validation.middleware");
|
|
7
|
+
const convert_service_1 = require("../../../domains/services/convert.service");
|
|
8
|
+
const problem_exception_1 = require("../exceptions/problem.exception");
|
|
9
|
+
const SpecificationFile_1 = require("../../../domains/models/SpecificationFile");
|
|
10
|
+
/**
|
|
11
|
+
* Controller which exposes the Convert functionality
|
|
12
|
+
*/
|
|
13
|
+
class ConvertController {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.basepath = '/convert';
|
|
16
|
+
this.conversionService = new convert_service_1.ConversionService();
|
|
17
|
+
}
|
|
18
|
+
convert(req, res, next) {
|
|
19
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
try {
|
|
22
|
+
const options = req.body;
|
|
23
|
+
const specFile = new SpecificationFile_1.Specification(typeof options.source === 'string'
|
|
24
|
+
? options.source
|
|
25
|
+
: JSON.stringify(options.source));
|
|
26
|
+
const result = yield this.conversionService.convertDocument(specFile, options);
|
|
27
|
+
if (!result.success) {
|
|
28
|
+
return next(new problem_exception_1.ProblemException({
|
|
29
|
+
type: 'conversion-error',
|
|
30
|
+
title: 'Conversion failed',
|
|
31
|
+
status: 400,
|
|
32
|
+
detail: result.error,
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
res.status(200).json({
|
|
36
|
+
converted: (_a = result.data) === null || _a === void 0 ? void 0 : _a.convertedDocument,
|
|
37
|
+
sourceFormat: (_b = result.data) === null || _b === void 0 ? void 0 : _b.originalFormat,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
if (err instanceof problem_exception_1.ProblemException) {
|
|
42
|
+
return next(err);
|
|
43
|
+
}
|
|
44
|
+
return next(new problem_exception_1.ProblemException({
|
|
45
|
+
type: 'internal-server-error',
|
|
46
|
+
title: 'Internal server error',
|
|
47
|
+
status: 500,
|
|
48
|
+
detail: err.message,
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
boot() {
|
|
54
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const router = (0, express_1.Router)();
|
|
56
|
+
router.post(this.basepath, yield (0, validation_middleware_1.validationMiddleware)({
|
|
57
|
+
path: this.basepath,
|
|
58
|
+
method: 'post',
|
|
59
|
+
documents: ['source'],
|
|
60
|
+
condition: (req) => {
|
|
61
|
+
const body = req.body;
|
|
62
|
+
return body.format === 'asyncapi';
|
|
63
|
+
},
|
|
64
|
+
}), this.convert.bind(this));
|
|
65
|
+
return router;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.ConvertController = ConvertController;
|