@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
package/oclif.manifest.json
CHANGED
|
@@ -62,6 +62,8 @@
|
|
|
62
62
|
"isESM": false,
|
|
63
63
|
"relativePath": [
|
|
64
64
|
"lib",
|
|
65
|
+
"apps",
|
|
66
|
+
"cli",
|
|
65
67
|
"commands",
|
|
66
68
|
"bundle.js"
|
|
67
69
|
]
|
|
@@ -157,6 +159,8 @@
|
|
|
157
159
|
"isESM": false,
|
|
158
160
|
"relativePath": [
|
|
159
161
|
"lib",
|
|
162
|
+
"apps",
|
|
163
|
+
"cli",
|
|
160
164
|
"commands",
|
|
161
165
|
"convert.js"
|
|
162
166
|
]
|
|
@@ -303,6 +307,8 @@
|
|
|
303
307
|
"isESM": false,
|
|
304
308
|
"relativePath": [
|
|
305
309
|
"lib",
|
|
310
|
+
"apps",
|
|
311
|
+
"cli",
|
|
306
312
|
"commands",
|
|
307
313
|
"diff.js"
|
|
308
314
|
]
|
|
@@ -360,6 +366,8 @@
|
|
|
360
366
|
"isESM": false,
|
|
361
367
|
"relativePath": [
|
|
362
368
|
"lib",
|
|
369
|
+
"apps",
|
|
370
|
+
"cli",
|
|
363
371
|
"commands",
|
|
364
372
|
"format.js"
|
|
365
373
|
]
|
|
@@ -468,6 +476,8 @@
|
|
|
468
476
|
"isESM": false,
|
|
469
477
|
"relativePath": [
|
|
470
478
|
"lib",
|
|
479
|
+
"apps",
|
|
480
|
+
"cli",
|
|
471
481
|
"commands",
|
|
472
482
|
"optimize.js"
|
|
473
483
|
]
|
|
@@ -506,6 +516,8 @@
|
|
|
506
516
|
"isESM": false,
|
|
507
517
|
"relativePath": [
|
|
508
518
|
"lib",
|
|
519
|
+
"apps",
|
|
520
|
+
"cli",
|
|
509
521
|
"commands",
|
|
510
522
|
"pretty.js"
|
|
511
523
|
]
|
|
@@ -587,6 +599,21 @@
|
|
|
587
599
|
"allowNo": false,
|
|
588
600
|
"type": "boolean"
|
|
589
601
|
},
|
|
602
|
+
"suppressWarnings": {
|
|
603
|
+
"description": "List of warning codes to suppress from the validation output.",
|
|
604
|
+
"name": "suppressWarnings",
|
|
605
|
+
"required": false,
|
|
606
|
+
"hasDynamicHelp": false,
|
|
607
|
+
"multiple": true,
|
|
608
|
+
"type": "option"
|
|
609
|
+
},
|
|
610
|
+
"suppressAllWarnings": {
|
|
611
|
+
"description": "Suppress all warnings from the validation output.",
|
|
612
|
+
"name": "suppressAllWarnings",
|
|
613
|
+
"required": false,
|
|
614
|
+
"allowNo": false,
|
|
615
|
+
"type": "boolean"
|
|
616
|
+
},
|
|
590
617
|
"proxyHost": {
|
|
591
618
|
"description": "Name of the ProxyHost",
|
|
592
619
|
"name": "proxyHost",
|
|
@@ -614,6 +641,8 @@
|
|
|
614
641
|
"isESM": false,
|
|
615
642
|
"relativePath": [
|
|
616
643
|
"lib",
|
|
644
|
+
"apps",
|
|
645
|
+
"cli",
|
|
617
646
|
"commands",
|
|
618
647
|
"validate.js"
|
|
619
648
|
]
|
|
@@ -662,6 +691,8 @@
|
|
|
662
691
|
"isESM": false,
|
|
663
692
|
"relativePath": [
|
|
664
693
|
"lib",
|
|
694
|
+
"apps",
|
|
695
|
+
"cli",
|
|
665
696
|
"commands",
|
|
666
697
|
"config",
|
|
667
698
|
"analytics.js"
|
|
@@ -682,6 +713,8 @@
|
|
|
682
713
|
"isESM": false,
|
|
683
714
|
"relativePath": [
|
|
684
715
|
"lib",
|
|
716
|
+
"apps",
|
|
717
|
+
"cli",
|
|
685
718
|
"commands",
|
|
686
719
|
"config",
|
|
687
720
|
"index.js"
|
|
@@ -710,6 +743,8 @@
|
|
|
710
743
|
"isESM": false,
|
|
711
744
|
"relativePath": [
|
|
712
745
|
"lib",
|
|
746
|
+
"apps",
|
|
747
|
+
"cli",
|
|
713
748
|
"commands",
|
|
714
749
|
"config",
|
|
715
750
|
"versions.js"
|
|
@@ -868,6 +903,8 @@
|
|
|
868
903
|
"isESM": false,
|
|
869
904
|
"relativePath": [
|
|
870
905
|
"lib",
|
|
906
|
+
"apps",
|
|
907
|
+
"cli",
|
|
871
908
|
"commands",
|
|
872
909
|
"generate",
|
|
873
910
|
"fromTemplate.js"
|
|
@@ -888,6 +925,8 @@
|
|
|
888
925
|
"isESM": false,
|
|
889
926
|
"relativePath": [
|
|
890
927
|
"lib",
|
|
928
|
+
"apps",
|
|
929
|
+
"cli",
|
|
891
930
|
"commands",
|
|
892
931
|
"generate",
|
|
893
932
|
"index.js"
|
|
@@ -1215,6 +1254,8 @@
|
|
|
1215
1254
|
"isESM": false,
|
|
1216
1255
|
"relativePath": [
|
|
1217
1256
|
"lib",
|
|
1257
|
+
"apps",
|
|
1258
|
+
"cli",
|
|
1218
1259
|
"commands",
|
|
1219
1260
|
"generate",
|
|
1220
1261
|
"models.js"
|
|
@@ -1284,6 +1325,8 @@
|
|
|
1284
1325
|
"isESM": false,
|
|
1285
1326
|
"relativePath": [
|
|
1286
1327
|
"lib",
|
|
1328
|
+
"apps",
|
|
1329
|
+
"cli",
|
|
1287
1330
|
"commands",
|
|
1288
1331
|
"new",
|
|
1289
1332
|
"file.js"
|
|
@@ -1345,6 +1388,8 @@
|
|
|
1345
1388
|
"isESM": false,
|
|
1346
1389
|
"relativePath": [
|
|
1347
1390
|
"lib",
|
|
1391
|
+
"apps",
|
|
1392
|
+
"cli",
|
|
1348
1393
|
"commands",
|
|
1349
1394
|
"new",
|
|
1350
1395
|
"glee.js"
|
|
@@ -1365,6 +1410,8 @@
|
|
|
1365
1410
|
"isESM": false,
|
|
1366
1411
|
"relativePath": [
|
|
1367
1412
|
"lib",
|
|
1413
|
+
"apps",
|
|
1414
|
+
"cli",
|
|
1368
1415
|
"commands",
|
|
1369
1416
|
"new",
|
|
1370
1417
|
"index.js"
|
|
@@ -1426,11 +1473,65 @@
|
|
|
1426
1473
|
"isESM": false,
|
|
1427
1474
|
"relativePath": [
|
|
1428
1475
|
"lib",
|
|
1476
|
+
"apps",
|
|
1477
|
+
"cli",
|
|
1429
1478
|
"commands",
|
|
1430
1479
|
"new",
|
|
1431
1480
|
"template.js"
|
|
1432
1481
|
]
|
|
1433
1482
|
},
|
|
1483
|
+
"start:api": {
|
|
1484
|
+
"aliases": [],
|
|
1485
|
+
"args": {},
|
|
1486
|
+
"description": "starts the AsyncAPI server API.",
|
|
1487
|
+
"flags": {
|
|
1488
|
+
"help": {
|
|
1489
|
+
"char": "h",
|
|
1490
|
+
"description": "Show CLI help.",
|
|
1491
|
+
"name": "help",
|
|
1492
|
+
"allowNo": false,
|
|
1493
|
+
"type": "boolean"
|
|
1494
|
+
},
|
|
1495
|
+
"mode": {
|
|
1496
|
+
"char": "m",
|
|
1497
|
+
"description": "mode in which to start the API",
|
|
1498
|
+
"name": "mode",
|
|
1499
|
+
"default": "production",
|
|
1500
|
+
"hasDynamicHelp": false,
|
|
1501
|
+
"multiple": false,
|
|
1502
|
+
"options": [
|
|
1503
|
+
"development",
|
|
1504
|
+
"production",
|
|
1505
|
+
"test"
|
|
1506
|
+
],
|
|
1507
|
+
"type": "option"
|
|
1508
|
+
},
|
|
1509
|
+
"port": {
|
|
1510
|
+
"char": "p",
|
|
1511
|
+
"description": "port in which to start the API",
|
|
1512
|
+
"name": "port",
|
|
1513
|
+
"hasDynamicHelp": false,
|
|
1514
|
+
"multiple": false,
|
|
1515
|
+
"type": "option"
|
|
1516
|
+
}
|
|
1517
|
+
},
|
|
1518
|
+
"hasDynamicHelp": false,
|
|
1519
|
+
"hiddenAliases": [],
|
|
1520
|
+
"id": "start:api",
|
|
1521
|
+
"pluginAlias": "@asyncapi/cli",
|
|
1522
|
+
"pluginName": "@asyncapi/cli",
|
|
1523
|
+
"pluginType": "core",
|
|
1524
|
+
"strict": true,
|
|
1525
|
+
"isESM": false,
|
|
1526
|
+
"relativePath": [
|
|
1527
|
+
"lib",
|
|
1528
|
+
"apps",
|
|
1529
|
+
"cli",
|
|
1530
|
+
"commands",
|
|
1531
|
+
"start",
|
|
1532
|
+
"api.js"
|
|
1533
|
+
]
|
|
1534
|
+
},
|
|
1434
1535
|
"start": {
|
|
1435
1536
|
"aliases": [],
|
|
1436
1537
|
"args": {},
|
|
@@ -1446,6 +1547,8 @@
|
|
|
1446
1547
|
"isESM": false,
|
|
1447
1548
|
"relativePath": [
|
|
1448
1549
|
"lib",
|
|
1550
|
+
"apps",
|
|
1551
|
+
"cli",
|
|
1449
1552
|
"commands",
|
|
1450
1553
|
"start",
|
|
1451
1554
|
"index.js"
|
|
@@ -1518,6 +1621,8 @@
|
|
|
1518
1621
|
"isESM": false,
|
|
1519
1622
|
"relativePath": [
|
|
1520
1623
|
"lib",
|
|
1624
|
+
"apps",
|
|
1625
|
+
"cli",
|
|
1521
1626
|
"commands",
|
|
1522
1627
|
"start",
|
|
1523
1628
|
"preview.js"
|
|
@@ -1576,6 +1681,8 @@
|
|
|
1576
1681
|
"isESM": false,
|
|
1577
1682
|
"relativePath": [
|
|
1578
1683
|
"lib",
|
|
1684
|
+
"apps",
|
|
1685
|
+
"cli",
|
|
1579
1686
|
"commands",
|
|
1580
1687
|
"start",
|
|
1581
1688
|
"studio.js"
|
|
@@ -1623,6 +1730,8 @@
|
|
|
1623
1730
|
"isESM": false,
|
|
1624
1731
|
"relativePath": [
|
|
1625
1732
|
"lib",
|
|
1733
|
+
"apps",
|
|
1734
|
+
"cli",
|
|
1626
1735
|
"commands",
|
|
1627
1736
|
"config",
|
|
1628
1737
|
"context",
|
|
@@ -1652,6 +1761,8 @@
|
|
|
1652
1761
|
"isESM": false,
|
|
1653
1762
|
"relativePath": [
|
|
1654
1763
|
"lib",
|
|
1764
|
+
"apps",
|
|
1765
|
+
"cli",
|
|
1655
1766
|
"commands",
|
|
1656
1767
|
"config",
|
|
1657
1768
|
"context",
|
|
@@ -1692,6 +1803,8 @@
|
|
|
1692
1803
|
"isESM": false,
|
|
1693
1804
|
"relativePath": [
|
|
1694
1805
|
"lib",
|
|
1806
|
+
"apps",
|
|
1807
|
+
"cli",
|
|
1695
1808
|
"commands",
|
|
1696
1809
|
"config",
|
|
1697
1810
|
"context",
|
|
@@ -1713,6 +1826,8 @@
|
|
|
1713
1826
|
"isESM": false,
|
|
1714
1827
|
"relativePath": [
|
|
1715
1828
|
"lib",
|
|
1829
|
+
"apps",
|
|
1830
|
+
"cli",
|
|
1716
1831
|
"commands",
|
|
1717
1832
|
"config",
|
|
1718
1833
|
"context",
|
|
@@ -1749,6 +1864,8 @@
|
|
|
1749
1864
|
"isESM": false,
|
|
1750
1865
|
"relativePath": [
|
|
1751
1866
|
"lib",
|
|
1867
|
+
"apps",
|
|
1868
|
+
"cli",
|
|
1752
1869
|
"commands",
|
|
1753
1870
|
"config",
|
|
1754
1871
|
"context",
|
|
@@ -1778,6 +1895,8 @@
|
|
|
1778
1895
|
"isESM": false,
|
|
1779
1896
|
"relativePath": [
|
|
1780
1897
|
"lib",
|
|
1898
|
+
"apps",
|
|
1899
|
+
"cli",
|
|
1781
1900
|
"commands",
|
|
1782
1901
|
"config",
|
|
1783
1902
|
"context",
|
|
@@ -1813,6 +1932,8 @@
|
|
|
1813
1932
|
"isESM": false,
|
|
1814
1933
|
"relativePath": [
|
|
1815
1934
|
"lib",
|
|
1935
|
+
"apps",
|
|
1936
|
+
"cli",
|
|
1816
1937
|
"commands",
|
|
1817
1938
|
"config",
|
|
1818
1939
|
"context",
|
|
@@ -1848,6 +1969,8 @@
|
|
|
1848
1969
|
"isESM": false,
|
|
1849
1970
|
"relativePath": [
|
|
1850
1971
|
"lib",
|
|
1972
|
+
"apps",
|
|
1973
|
+
"cli",
|
|
1851
1974
|
"commands",
|
|
1852
1975
|
"config",
|
|
1853
1976
|
"context",
|
|
@@ -1855,5 +1978,5 @@
|
|
|
1855
1978
|
]
|
|
1856
1979
|
}
|
|
1857
1980
|
},
|
|
1858
|
-
"version": "3.
|
|
1981
|
+
"version": "3.3.0"
|
|
1859
1982
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asyncapi/cli",
|
|
3
3
|
"description": "All in one CLI for all AsyncAPI tools",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.3.0",
|
|
5
5
|
"author": "@asyncapi",
|
|
6
6
|
"bin": {
|
|
7
7
|
"asyncapi": "./bin/run_bin"
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"@asyncapi/openapi-schema-parser": "^3.0.24",
|
|
18
18
|
"@asyncapi/optimizer": "^1.0.4",
|
|
19
19
|
"@asyncapi/parser": "^3.3.0",
|
|
20
|
+
"@asyncapi/problem": "^1.0.0",
|
|
20
21
|
"@asyncapi/protobuf-schema-parser": "^3.5.1",
|
|
21
22
|
"@asyncapi/raml-dt-schema-parser": "^4.0.24",
|
|
22
23
|
"@asyncapi/studio": "^0.24.2",
|
|
@@ -26,49 +27,57 @@
|
|
|
26
27
|
"@oclif/plugin-autocomplete": "^3.2.26",
|
|
27
28
|
"@smoya/asyncapi-adoption-metrics": "^2.4.9",
|
|
28
29
|
"@stoplight/spectral-cli": "6.9.0",
|
|
30
|
+
"archiver": "^7.0.1",
|
|
31
|
+
"body-parser": "^2.2.0",
|
|
29
32
|
"chalk": "^4.1.0",
|
|
30
33
|
"chokidar": "^3.5.2",
|
|
34
|
+
"compression": "^1.8.0",
|
|
35
|
+
"config": "^4.0.0",
|
|
36
|
+
"cors": "^2.8.5",
|
|
37
|
+
"express": "^4.17.1",
|
|
31
38
|
"fast-levenshtein": "^3.0.0",
|
|
32
39
|
"fs-extra": "^11.1.0",
|
|
33
|
-
"generator-v2": "npm:@asyncapi/generator
|
|
40
|
+
"generator-v2": "npm:@asyncapi/generator@2.4.1",
|
|
41
|
+
"helmet": "^8.1.0",
|
|
34
42
|
"https-proxy-agent": "^7.0.6",
|
|
35
43
|
"inquirer": "^8.2.0",
|
|
36
44
|
"js-yaml": "^4.1.0",
|
|
37
|
-
"next": "^
|
|
38
|
-
"node-fetch": "^2.0.0",
|
|
45
|
+
"next": "^15.2.4",
|
|
39
46
|
"oclif": "^4.17.34",
|
|
40
47
|
"open": "^8.4.0",
|
|
41
|
-
"picocolors": "^1.
|
|
42
|
-
"
|
|
43
|
-
"serve-handler": "^6.1.3",
|
|
44
|
-
"strip-ansi": "^6.0.0",
|
|
48
|
+
"picocolors": "^1.1.0",
|
|
49
|
+
"redoc-express": "^2.1.0",
|
|
45
50
|
"unzipper": "^0.10.11",
|
|
46
51
|
"uuid": "^11.1.0",
|
|
52
|
+
"winston": "^3.17.0",
|
|
47
53
|
"ws": "^8.2.3",
|
|
48
54
|
"yaml": "^2.6.1"
|
|
49
55
|
},
|
|
50
56
|
"devDependencies": {
|
|
51
57
|
"@asyncapi/minimaltemplate": "./test/fixtures/minimaltemplate",
|
|
52
58
|
"@asyncapi/newtemplate": "./test/fixtures/newtemplate",
|
|
53
|
-
"@
|
|
59
|
+
"@commitlint/cli": "^19.8.1",
|
|
60
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
54
61
|
"@oclif/test": "^2",
|
|
55
62
|
"@swc/core": "^1.3.2",
|
|
63
|
+
"@types/archiver": "^6.0.3",
|
|
64
|
+
"@types/body-parser": "^1.19.6",
|
|
56
65
|
"@types/chai": "^4.3.6",
|
|
66
|
+
"@types/compression": "^1.8.1",
|
|
67
|
+
"@types/config": "^3.3.5",
|
|
68
|
+
"@types/cors": "^2.8.19",
|
|
69
|
+
"@types/express": "^5.0.3",
|
|
57
70
|
"@types/fast-levenshtein": "^0.0.2",
|
|
58
71
|
"@types/fs-extra": "^11.0.1",
|
|
59
72
|
"@types/inquirer": "^8.1.3",
|
|
60
73
|
"@types/js-yaml": "^4.0.5",
|
|
61
74
|
"@types/mocha": "^10.0.2",
|
|
62
75
|
"@types/node": "^22.13.10",
|
|
63
|
-
"@types/node-fetch": "^2.5.12",
|
|
64
76
|
"@types/rimraf": "^3.0.2",
|
|
65
|
-
"@types/serve-handler": "^6.1.1",
|
|
66
77
|
"@types/uuid": "^10.0.0",
|
|
67
|
-
"@types/wrap-ansi": "^8.0.1",
|
|
68
78
|
"@types/ws": "^8.2.0",
|
|
69
79
|
"@typescript-eslint/eslint-plugin": "^5.38.1",
|
|
70
80
|
"@typescript-eslint/parser": "^5.38.1",
|
|
71
|
-
"acorn": "^8.5.0",
|
|
72
81
|
"chai": "^4.3.6",
|
|
73
82
|
"cross-env": "^7.0.3",
|
|
74
83
|
"eslint": "^8.24.0",
|
|
@@ -77,14 +86,16 @@
|
|
|
77
86
|
"eslint-plugin-github": "^4.3.7",
|
|
78
87
|
"eslint-plugin-security": "^1.4.0",
|
|
79
88
|
"eslint-plugin-sonarjs": "^0.15.0",
|
|
80
|
-
"
|
|
89
|
+
"lefthook": "^1.12.2",
|
|
81
90
|
"markdown-toc": "^1.2.0",
|
|
82
91
|
"mocha": "^10.2.0",
|
|
92
|
+
"nodemon": "^3.1.10",
|
|
83
93
|
"nyc": "^15.1.0",
|
|
84
94
|
"rimraf": "^3.0.2",
|
|
85
95
|
"simple-git": "^3.16.0",
|
|
86
96
|
"ts-node": "^10.9.1",
|
|
87
|
-
"
|
|
97
|
+
"tsc-alias": "^1.8.16",
|
|
98
|
+
"tsconfig-paths": "^4.2.0",
|
|
88
99
|
"typescript": "^5.8.2"
|
|
89
100
|
},
|
|
90
101
|
"engines": {
|
|
@@ -105,14 +116,14 @@
|
|
|
105
116
|
"license": "Apache-2.0",
|
|
106
117
|
"main": "lib/index.js",
|
|
107
118
|
"oclif": {
|
|
108
|
-
"commands": "./lib/commands",
|
|
119
|
+
"commands": "./lib/apps/cli/commands",
|
|
109
120
|
"bin": "asyncapi",
|
|
110
121
|
"additionalVersionFlags": [
|
|
111
122
|
"--v"
|
|
112
123
|
],
|
|
113
124
|
"hooks": {
|
|
114
125
|
"command_not_found": [
|
|
115
|
-
"./lib/
|
|
126
|
+
"./lib/apps/cli/internal/hooks/command_not_found/myhook"
|
|
116
127
|
]
|
|
117
128
|
},
|
|
118
129
|
"macos": {
|
|
@@ -146,7 +157,7 @@
|
|
|
146
157
|
},
|
|
147
158
|
"repository": "asyncapi/cli",
|
|
148
159
|
"scripts": {
|
|
149
|
-
"build": "rimraf lib && node scripts/fetch-asyncapi-example.js && tsc && oclif manifest && echo \"Build Completed\"",
|
|
160
|
+
"build": "rimraf lib && node scripts/fetch-asyncapi-example.js && tsc && tsc-alias --project tsconfig.json && oclif manifest && echo \"Build Completed\"",
|
|
150
161
|
"bump:github-action": "cd github-action/lib/ && node bump-action-version.js",
|
|
151
162
|
"bump:version": "npx -p @changesets/cli@2.27.7 changeset version && npm run bump:github-action",
|
|
152
163
|
"dev": "tsc --watch",
|
|
@@ -156,6 +167,7 @@
|
|
|
156
167
|
"generate:assets": "npm run generate:readme:toc && npm run generate:commands",
|
|
157
168
|
"generate:commands": "npm run generate:readme:create && npm run generate:readme:commands && node ./scripts/updateUsageDocs.js && rimraf ./scripts/README.md",
|
|
158
169
|
"generate:readme:toc": "markdown-toc -i README.md",
|
|
170
|
+
"prepare": "lefthook install",
|
|
159
171
|
"lint": "eslint --max-warnings 5 --config .eslintrc .",
|
|
160
172
|
"lint:fix": "eslint --max-warnings 5 --config .eslintrc . --fix",
|
|
161
173
|
"pack:macos": "oclif pack macos && npm run pack:rename",
|
|
@@ -168,14 +180,17 @@
|
|
|
168
180
|
"pretest:coverage": "npm run build",
|
|
169
181
|
"posttest": "rimraf ./test.asyncapi-cli",
|
|
170
182
|
"postinstall": "node ./scripts/enableAutoComplete.js",
|
|
171
|
-
"test": "npm run test
|
|
172
|
-
"test
|
|
173
|
-
"test:one": "cross-env NODE_ENV=development TEST=1 CUSTOM_CONTEXT_FILENAME=\"test.asyncapi-cli\" CUSTOM_CONTEXT_FILE_LOCATION=\"\" nyc --extension .ts mocha --require ts-node/register --require test/helpers/init.js --reporter spec --timeout 100000",
|
|
183
|
+
"test": "npm run cli:test && npm run action:test",
|
|
184
|
+
"cli:test": "cross-env NODE_ENV=development TEST=1 CUSTOM_CONTEXT_FILENAME=\"test.asyncapi-cli\" CUSTOM_CONTEXT_FILE_LOCATION=\"\" nyc --extension .ts mocha --require ts-node/register --require tsconfig-paths/register --require test/helpers/init.js --reporter spec --timeout 100000 \"test/**/*.test.ts\"",
|
|
185
|
+
"test:one": "cross-env NODE_ENV=development TEST=1 CUSTOM_CONTEXT_FILENAME=\"test.asyncapi-cli\" CUSTOM_CONTEXT_FILE_LOCATION=\"\" nyc --extension .ts mocha --require ts-node/register --require tsconfig-paths/register --require test/helpers/init.js --reporter spec --timeout 100000",
|
|
174
186
|
"get-version": "echo $npm_package_version",
|
|
175
187
|
"createhook": "oclif generate hook myhook --event=command_not_found",
|
|
176
188
|
"createhookinit": "oclif generate hook inithook --event=init",
|
|
177
189
|
"action:docker:build": "docker build -f github-action/Dockerfile -t asyncapi/github-action-for-cli:latest .",
|
|
178
|
-
"action:test": "npm run build && cd github-action && make test"
|
|
190
|
+
"action:test": "npm run build && cd github-action && make test",
|
|
191
|
+
"api:dev": "cross-env NODE_ENV=development PORT=3000 nodemon",
|
|
192
|
+
"api:build": "",
|
|
193
|
+
"api:test": ""
|
|
179
194
|
},
|
|
180
195
|
"types": "lib/index.d.ts"
|
|
181
196
|
}
|
package/lib/commands/convert.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
|
-
const core_1 = require("@oclif/core");
|
|
7
|
-
const base_1 = tslib_1.__importDefault(require("../core/base"));
|
|
8
|
-
const validation_error_1 = require("../core/errors/validation-error");
|
|
9
|
-
const SpecificationFile_1 = require("../core/models/SpecificationFile");
|
|
10
|
-
const specification_file_1 = require("../core/errors/specification-file");
|
|
11
|
-
const converter_1 = require("@asyncapi/converter");
|
|
12
|
-
const picocolors_1 = require("picocolors");
|
|
13
|
-
const proxy_flags_1 = require("../core/flags/proxy.flags");
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
const specs_1 = tslib_1.__importDefault(require("@asyncapi/specs"));
|
|
16
|
-
const convert_flags_1 = require("../core/flags/convert.flags");
|
|
17
|
-
const latestVersion = Object.keys(specs_1.default.schemas).pop();
|
|
18
|
-
class Convert extends base_1.default {
|
|
19
|
-
run() {
|
|
20
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
const { args, flags } = yield this.parse(Convert);
|
|
22
|
-
let filePath = args['spec-file'];
|
|
23
|
-
const proxyHost = flags['proxyHost'];
|
|
24
|
-
const proxyPort = flags['proxyPort'];
|
|
25
|
-
if (proxyHost && proxyPort) {
|
|
26
|
-
const proxyUrl = `http://${proxyHost}:${proxyPort}`;
|
|
27
|
-
filePath = `${filePath}+${proxyUrl}`; // Update filePath with proxyUrl
|
|
28
|
-
}
|
|
29
|
-
let convertedFile;
|
|
30
|
-
let convertedFileFormatted;
|
|
31
|
-
try {
|
|
32
|
-
// LOAD FILE
|
|
33
|
-
this.specFile = yield (0, SpecificationFile_1.load)(filePath);
|
|
34
|
-
// eslint-disable-next-line sonarjs/no-duplicate-string
|
|
35
|
-
this.metricsMetadata.to_version = flags['target-version'];
|
|
36
|
-
// Determine if the input is OpenAPI or AsyncAPI
|
|
37
|
-
const isOpenAPI = flags['format'] === 'openapi';
|
|
38
|
-
const isAsyncAPI = flags['format'] === 'asyncapi';
|
|
39
|
-
// CONVERSION
|
|
40
|
-
convertedFile = this.handleConversion(isOpenAPI, isAsyncAPI, flags);
|
|
41
|
-
// Handle file output or log the result
|
|
42
|
-
convertedFileFormatted = this.formatConvertedFile(convertedFile);
|
|
43
|
-
yield this.handleOutput(flags.output, convertedFileFormatted);
|
|
44
|
-
}
|
|
45
|
-
catch (err) {
|
|
46
|
-
this.handleError(err, filePath !== null && filePath !== void 0 ? filePath : 'unknown', flags);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
// Helper function to handle conversion logic
|
|
51
|
-
handleConversion(isOpenAPI, isAsyncAPI, flags) {
|
|
52
|
-
var _a;
|
|
53
|
-
const specJson = (_a = this.specFile) === null || _a === void 0 ? void 0 : _a.toJson();
|
|
54
|
-
if (isOpenAPI) {
|
|
55
|
-
return this.convertOpenAPI(specJson, flags);
|
|
56
|
-
}
|
|
57
|
-
else if (isAsyncAPI) {
|
|
58
|
-
return this.convertAsyncAPI(flags);
|
|
59
|
-
}
|
|
60
|
-
return this.convertPostman(flags);
|
|
61
|
-
}
|
|
62
|
-
convertOpenAPI(specJson, flags) {
|
|
63
|
-
var _a, _b;
|
|
64
|
-
const convertedFile = (0, converter_1.convertOpenAPI)((_b = (_a = this.specFile) === null || _a === void 0 ? void 0 : _a.text()) !== null && _b !== void 0 ? _b : '', specJson.openapi, {
|
|
65
|
-
perspective: flags['perspective']
|
|
66
|
-
});
|
|
67
|
-
this.log(`🎉 The OpenAPI document has been successfully converted to AsyncAPI version ${(0, picocolors_1.green)(flags['target-version'])}!`);
|
|
68
|
-
return convertedFile;
|
|
69
|
-
}
|
|
70
|
-
convertAsyncAPI(flags) {
|
|
71
|
-
var _a, _b, _c, _d, _e, _f;
|
|
72
|
-
const convertedFile = (0, converter_1.convert)((_b = (_a = this.specFile) === null || _a === void 0 ? void 0 : _a.text()) !== null && _b !== void 0 ? _b : '', flags['target-version']);
|
|
73
|
-
if ((_c = this.specFile) === null || _c === void 0 ? void 0 : _c.getFilePath()) {
|
|
74
|
-
this.log(`🎉 The ${(0, picocolors_1.cyan)((_d = this.specFile) === null || _d === void 0 ? void 0 : _d.getFilePath())} file has been successfully converted to version ${(0, picocolors_1.green)(flags['target-version'])}!!`);
|
|
75
|
-
}
|
|
76
|
-
else if ((_e = this.specFile) === null || _e === void 0 ? void 0 : _e.getFileURL()) {
|
|
77
|
-
this.log(`🎉 The URL ${(0, picocolors_1.cyan)((_f = this.specFile) === null || _f === void 0 ? void 0 : _f.getFileURL())} has been successfully converted to version ${(0, picocolors_1.green)(flags['target-version'])}!!`);
|
|
78
|
-
}
|
|
79
|
-
return convertedFile;
|
|
80
|
-
}
|
|
81
|
-
convertPostman(flags) {
|
|
82
|
-
var _a, _b, _c, _d, _e, _f;
|
|
83
|
-
const convertedFile = (0, converter_1.convertPostman)((_b = (_a = this.specFile) === null || _a === void 0 ? void 0 : _a.text()) !== null && _b !== void 0 ? _b : '', '3.0.0', {
|
|
84
|
-
perspective: flags['perspective']
|
|
85
|
-
});
|
|
86
|
-
if ((_c = this.specFile) === null || _c === void 0 ? void 0 : _c.getFilePath()) {
|
|
87
|
-
this.log(`🎉 The ${(0, picocolors_1.cyan)((_d = this.specFile) === null || _d === void 0 ? void 0 : _d.getFilePath())} file has been successfully converted to asyncapi of version ${(0, picocolors_1.green)(flags['target-version'])}!!`);
|
|
88
|
-
}
|
|
89
|
-
else if ((_e = this.specFile) === null || _e === void 0 ? void 0 : _e.getFileURL()) {
|
|
90
|
-
this.log(`🎉 The URL ${(0, picocolors_1.cyan)((_f = this.specFile) === null || _f === void 0 ? void 0 : _f.getFileURL())} has been successfully converted to asyncapi of version ${(0, picocolors_1.green)(flags['target-version'])}!!`);
|
|
91
|
-
}
|
|
92
|
-
return convertedFile;
|
|
93
|
-
}
|
|
94
|
-
// Helper function to format the converted file
|
|
95
|
-
formatConvertedFile(convertedFile) {
|
|
96
|
-
return typeof convertedFile === 'object' ? JSON.stringify(convertedFile, null, 4) : convertedFile;
|
|
97
|
-
}
|
|
98
|
-
// Helper function to handle output
|
|
99
|
-
handleOutput(outputPath, convertedFileFormatted) {
|
|
100
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
101
|
-
if (outputPath) {
|
|
102
|
-
yield fs_1.promises.writeFile(`${outputPath}`, convertedFileFormatted, { encoding: 'utf8' });
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
this.log(convertedFileFormatted);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
// Helper function to handle errors
|
|
110
|
-
handleError(err, filePath, flags) {
|
|
111
|
-
var _a;
|
|
112
|
-
if (err instanceof specification_file_1.SpecificationFileNotFound) {
|
|
113
|
-
this.error(new validation_error_1.ValidationError({
|
|
114
|
-
type: 'invalid-file',
|
|
115
|
-
filepath: filePath
|
|
116
|
-
}));
|
|
117
|
-
}
|
|
118
|
-
else if (((_a = this.specFile) === null || _a === void 0 ? void 0 : _a.toJson().asyncapi) > flags['target-version']) {
|
|
119
|
-
this.error(`The ${(0, picocolors_1.cyan)(filePath)} file cannot be converted to an older version. Downgrading is not supported.`);
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
this.error(err);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
Convert.metricsMetadata = {};
|
|
127
|
-
Convert.description = 'Convert asyncapi documents older to newer versions or OpenAPI/postman-collection documents to AsyncAPI';
|
|
128
|
-
Convert.flags = Object.assign(Object.assign({}, (0, convert_flags_1.convertFlags)(latestVersion)), (0, proxy_flags_1.proxyFlags)());
|
|
129
|
-
Convert.args = {
|
|
130
|
-
'spec-file': core_1.Args.string({ description: 'spec path, url, or context-name', required: false }),
|
|
131
|
-
};
|
|
132
|
-
exports.default = Convert;
|
package/lib/commands/validate.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const core_1 = require("@oclif/core");
|
|
5
|
-
const base_1 = tslib_1.__importDefault(require("../core/base"));
|
|
6
|
-
const parser_1 = require("../core/parser");
|
|
7
|
-
const SpecificationFile_1 = require("../core/models/SpecificationFile");
|
|
8
|
-
const globals_1 = require("../core/globals");
|
|
9
|
-
const validate_flags_1 = require("../core/flags/validate.flags");
|
|
10
|
-
const proxy_flags_1 = require("../core/flags/proxy.flags");
|
|
11
|
-
const scoreCalculator_1 = require("../core/utils/scoreCalculator");
|
|
12
|
-
class Validate extends base_1.default {
|
|
13
|
-
run() {
|
|
14
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
|
-
const { args, flags } = yield this.parse(Validate); //NOSONAR
|
|
16
|
-
let filePath = args['spec-file'];
|
|
17
|
-
const proxyHost = flags['proxyHost'];
|
|
18
|
-
const proxyPort = flags['proxyPort'];
|
|
19
|
-
if (proxyHost && proxyPort) {
|
|
20
|
-
const proxyUrl = `http://${proxyHost}:${proxyPort}`;
|
|
21
|
-
filePath = `${filePath}+${proxyUrl}`; // Update filePath with proxyUrl
|
|
22
|
-
}
|
|
23
|
-
this.specFile = yield (0, SpecificationFile_1.load)(filePath);
|
|
24
|
-
const watchMode = flags.watch;
|
|
25
|
-
if (flags['score']) {
|
|
26
|
-
const { document } = yield (0, parser_1.parse)(this, this.specFile);
|
|
27
|
-
this.log(`The score of the asyncapi document is ${yield (0, scoreCalculator_1.calculateScore)(document)}`);
|
|
28
|
-
}
|
|
29
|
-
if (watchMode) {
|
|
30
|
-
(0, globals_1.specWatcher)({ spec: this.specFile, handler: this, handlerName: 'validate' });
|
|
31
|
-
}
|
|
32
|
-
const result = yield (0, parser_1.validate)(this, this.specFile, flags);
|
|
33
|
-
this.metricsMetadata.validation_result = result;
|
|
34
|
-
if (result === parser_1.ValidationStatus.INVALID) {
|
|
35
|
-
process.exitCode = 1;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
Validate.description = 'validate asyncapi file';
|
|
41
|
-
Validate.flags = Object.assign(Object.assign({}, (0, validate_flags_1.validateFlags)()), (0, proxy_flags_1.proxyFlags)());
|
|
42
|
-
Validate.args = {
|
|
43
|
-
'spec-file': core_1.Args.string({ description: 'spec path, url, or context-name', required: false }),
|
|
44
|
-
};
|
|
45
|
-
exports.default = Validate;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.bundleFlags = void 0;
|
|
4
|
-
const core_1 = require("@oclif/core");
|
|
5
|
-
const bundleFlags = () => {
|
|
6
|
-
return {
|
|
7
|
-
help: core_1.Flags.help({ char: 'h' }),
|
|
8
|
-
output: core_1.Flags.string({ char: 'o', description: 'The output file name. Omitting this flag the result will be printed in the console.' }),
|
|
9
|
-
base: core_1.Flags.string({ char: 'b', description: 'Path to the file which will act as a base. This is required when some properties need to be overwritten.' }),
|
|
10
|
-
baseDir: core_1.Flags.string({ char: 'd', description: 'One relative/absolute path to directory relative to which paths to AsyncAPI Documents that should be bundled will be resolved.' }),
|
|
11
|
-
xOrigin: core_1.Flags.boolean({ char: 'x', description: 'Pass this switch to generate properties "x-origin" that will contain historical values of dereferenced "$ref"s.' }),
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
exports.bundleFlags = bundleFlags;
|