@asyncapi/cli 1.7.3 → 1.8.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 +6 -5
- package/assets/create-glee-app/templates/default/package-lock.json +140 -137
- package/assets/create-glee-app/templates/default/package.json +1 -1
- package/assets/create-glee-app/templates/tutorial/package-lock.json +72 -69
- package/assets/create-glee-app/templates/tutorial/package.json +1 -1
- package/bin/run +2 -0
- package/bin/run_bin +14 -0
- package/bin/run_bin.cmd +3 -0
- package/lib/base.d.ts +13 -0
- package/lib/base.js +119 -0
- package/lib/commands/bundle.d.ts +3 -0
- package/lib/commands/bundle.js +20 -0
- package/lib/commands/config/analytics.d.ts +10 -0
- package/lib/commands/config/analytics.js +51 -0
- package/lib/commands/convert.js +7 -7
- package/lib/commands/generate/fromTemplate.d.ts +2 -0
- package/lib/commands/generate/fromTemplate.js +4 -0
- package/lib/commands/new/file.js +3 -0
- package/lib/commands/optimize.d.ts +5 -2
- package/lib/commands/optimize.js +40 -25
- package/lib/commands/validate.js +5 -4
- package/oclif.manifest.json +45 -3
- package/package.json +9 -6
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"version": "0.1.0",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@asyncapi/glee": "^0.36.
|
|
12
|
+
"@asyncapi/glee": "^0.36.8"
|
|
13
13
|
},
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=14.15.1"
|
|
@@ -38,22 +38,22 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"node_modules/@asyncapi/avro-schema-parser": {
|
|
41
|
-
"version": "3.0.
|
|
42
|
-
"resolved": "https://registry.npmjs.org/@asyncapi/avro-schema-parser/-/avro-schema-parser-3.0.
|
|
43
|
-
"integrity": "sha512-
|
|
41
|
+
"version": "3.0.19",
|
|
42
|
+
"resolved": "https://registry.npmjs.org/@asyncapi/avro-schema-parser/-/avro-schema-parser-3.0.19.tgz",
|
|
43
|
+
"integrity": "sha512-1+qwxeAbSpp2OQw1TkjWemS7v646lSVM2RMJzDAh5qP5w33hM2xLXcuYC2O72l2AbCl4bkRfXTjTWLLq8qiPAA==",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@asyncapi/parser": "^3.0.
|
|
45
|
+
"@asyncapi/parser": "^3.0.11",
|
|
46
46
|
"@types/json-schema": "^7.0.11",
|
|
47
47
|
"avsc": "^5.7.6"
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"node_modules/@asyncapi/generator": {
|
|
51
|
-
"version": "1.17.
|
|
52
|
-
"resolved": "https://registry.npmjs.org/@asyncapi/generator/-/generator-1.17.
|
|
53
|
-
"integrity": "sha512-
|
|
51
|
+
"version": "1.17.16",
|
|
52
|
+
"resolved": "https://registry.npmjs.org/@asyncapi/generator/-/generator-1.17.16.tgz",
|
|
53
|
+
"integrity": "sha512-Vkee1klVE6rH4KDs16lVAvJ8LZmBcSuKDGI4O7VfDPS3VoRZN5F0utpsaS3JLZlr0ccflPjMm/b2Iyl9tc0WyQ==",
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@asyncapi/generator-react-sdk": "^1.0.
|
|
56
|
-
"@asyncapi/parser": "^3.0.
|
|
55
|
+
"@asyncapi/generator-react-sdk": "^1.0.15",
|
|
56
|
+
"@asyncapi/parser": "^3.0.11",
|
|
57
57
|
"@npmcli/arborist": "5.6.3",
|
|
58
58
|
"@smoya/multi-parser": "^5.0.0",
|
|
59
59
|
"ajv": "^8.12.0",
|
|
@@ -87,11 +87,11 @@
|
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
89
|
"node_modules/@asyncapi/generator-react-sdk": {
|
|
90
|
-
"version": "1.0.
|
|
91
|
-
"resolved": "https://registry.npmjs.org/@asyncapi/generator-react-sdk/-/generator-react-sdk-1.0.
|
|
92
|
-
"integrity": "sha512-
|
|
90
|
+
"version": "1.0.15",
|
|
91
|
+
"resolved": "https://registry.npmjs.org/@asyncapi/generator-react-sdk/-/generator-react-sdk-1.0.15.tgz",
|
|
92
|
+
"integrity": "sha512-2ewO8pWSw39NkL3fvG3YMgou6VXMaIuxYE7Uw5MEE/o4Iy8v8uHfR1UM6Ppy3t4PCzpSdN8VkePAaNeuAZz/YA==",
|
|
93
93
|
"dependencies": {
|
|
94
|
-
"@asyncapi/parser": "^3.0.
|
|
94
|
+
"@asyncapi/parser": "^3.0.11",
|
|
95
95
|
"@babel/core": "7.12.9",
|
|
96
96
|
"@babel/preset-env": "^7.12.7",
|
|
97
97
|
"@babel/preset-react": "^7.12.7",
|
|
@@ -155,14 +155,14 @@
|
|
|
155
155
|
}
|
|
156
156
|
},
|
|
157
157
|
"node_modules/@asyncapi/glee": {
|
|
158
|
-
"version": "0.36.
|
|
159
|
-
"resolved": "https://registry.npmjs.org/@asyncapi/glee/-/glee-0.36.
|
|
160
|
-
"integrity": "sha512-
|
|
158
|
+
"version": "0.36.8",
|
|
159
|
+
"resolved": "https://registry.npmjs.org/@asyncapi/glee/-/glee-0.36.8.tgz",
|
|
160
|
+
"integrity": "sha512-hFCdiao+FNY9/qgHWw7LnAvDhO+c+tiBc+j5Abei7kxDDu/ezQ95HGWRWycs6wjSBwDC78yBn7bgNu8BGzmbnw==",
|
|
161
161
|
"dependencies": {
|
|
162
|
-
"@asyncapi/generator": "^1.17.
|
|
163
|
-
"@asyncapi/html-template": "^2.
|
|
162
|
+
"@asyncapi/generator": "^1.17.16",
|
|
163
|
+
"@asyncapi/html-template": "^2.3.0",
|
|
164
164
|
"@asyncapi/markdown-template": "^1.5.0",
|
|
165
|
-
"@asyncapi/parser": "^3.0.
|
|
165
|
+
"@asyncapi/parser": "^3.0.11",
|
|
166
166
|
"@next/env": "^14.0.4",
|
|
167
167
|
"@types/jest": "^29.5.11",
|
|
168
168
|
"@types/qs": "^6.9.7",
|
|
@@ -260,12 +260,12 @@
|
|
|
260
260
|
}
|
|
261
261
|
},
|
|
262
262
|
"node_modules/@asyncapi/html-template": {
|
|
263
|
-
"version": "2.
|
|
264
|
-
"resolved": "https://registry.npmjs.org/@asyncapi/html-template/-/html-template-2.
|
|
265
|
-
"integrity": "sha512-
|
|
263
|
+
"version": "2.3.0",
|
|
264
|
+
"resolved": "https://registry.npmjs.org/@asyncapi/html-template/-/html-template-2.3.0.tgz",
|
|
265
|
+
"integrity": "sha512-2OSvxLHWCDkyDP6I40gijmYG190mG0DLMJvnlrsNGE83nHOFdoZg2EIR0brrwM7OjNL+EuCifcHdh6r6uli1bA==",
|
|
266
266
|
"dependencies": {
|
|
267
|
-
"@asyncapi/generator-react-sdk": "^1.0.
|
|
268
|
-
"@asyncapi/parser": "^3.0.
|
|
267
|
+
"@asyncapi/generator-react-sdk": "^1.0.15",
|
|
268
|
+
"@asyncapi/parser": "^3.0.11",
|
|
269
269
|
"@asyncapi/react-component": "^1.2.13",
|
|
270
270
|
"highlight.js": "10.7.3",
|
|
271
271
|
"puppeteer": "^14.1.0",
|
|
@@ -285,11 +285,11 @@
|
|
|
285
285
|
}
|
|
286
286
|
},
|
|
287
287
|
"node_modules/@asyncapi/openapi-schema-parser": {
|
|
288
|
-
"version": "3.0.
|
|
289
|
-
"resolved": "https://registry.npmjs.org/@asyncapi/openapi-schema-parser/-/openapi-schema-parser-3.0.
|
|
290
|
-
"integrity": "sha512-
|
|
288
|
+
"version": "3.0.19",
|
|
289
|
+
"resolved": "https://registry.npmjs.org/@asyncapi/openapi-schema-parser/-/openapi-schema-parser-3.0.19.tgz",
|
|
290
|
+
"integrity": "sha512-mSq/Tq8l/dsqhDWIHFLezINNkF74Wj6Ej5hbyHgoCg8NqEhHVCN8BqJJfSUML4cSJKUTduhqku3hyjEZ/a/6/A==",
|
|
291
291
|
"dependencies": {
|
|
292
|
-
"@asyncapi/parser": "^3.0.
|
|
292
|
+
"@asyncapi/parser": "^3.0.11",
|
|
293
293
|
"@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0",
|
|
294
294
|
"ajv": "^8.11.0",
|
|
295
295
|
"ajv-errors": "^3.0.0",
|
|
@@ -297,11 +297,11 @@
|
|
|
297
297
|
}
|
|
298
298
|
},
|
|
299
299
|
"node_modules/@asyncapi/parser": {
|
|
300
|
-
"version": "3.0.
|
|
301
|
-
"resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.0.
|
|
302
|
-
"integrity": "sha512-
|
|
300
|
+
"version": "3.0.11",
|
|
301
|
+
"resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.0.11.tgz",
|
|
302
|
+
"integrity": "sha512-YrmPY6Me7Eh6yH7xISKrDuiybaNVDUxVjbChUAoJZ4dnVGAmMVTxQTlwoqEwQ9bfTHzAb3RixdJ3TC6I4RoHNw==",
|
|
303
303
|
"dependencies": {
|
|
304
|
-
"@asyncapi/specs": "^6.5.
|
|
304
|
+
"@asyncapi/specs": "^6.5.4",
|
|
305
305
|
"@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0",
|
|
306
306
|
"@stoplight/json": "^3.20.2",
|
|
307
307
|
"@stoplight/json-ref-readers": "^1.2.2",
|
|
@@ -372,21 +372,21 @@
|
|
|
372
372
|
}
|
|
373
373
|
},
|
|
374
374
|
"node_modules/@asyncapi/protobuf-schema-parser": {
|
|
375
|
-
"version": "3.2.
|
|
376
|
-
"resolved": "https://registry.npmjs.org/@asyncapi/protobuf-schema-parser/-/protobuf-schema-parser-3.2.
|
|
377
|
-
"integrity": "sha512-
|
|
375
|
+
"version": "3.2.9",
|
|
376
|
+
"resolved": "https://registry.npmjs.org/@asyncapi/protobuf-schema-parser/-/protobuf-schema-parser-3.2.9.tgz",
|
|
377
|
+
"integrity": "sha512-s41ya3iLVWE2lfJPfFuVsrLuPcLW4aO4MMmfa22R77rge6kVXuAS4PeeKjtIgFTOUhjIZs7pf8gyd/SVA+x7SA==",
|
|
378
378
|
"dependencies": {
|
|
379
|
-
"@asyncapi/parser": "^3.0.
|
|
379
|
+
"@asyncapi/parser": "^3.0.11",
|
|
380
380
|
"@types/protocol-buffers-schema": "^3.4.1",
|
|
381
381
|
"protobufjs": "^7.2.6"
|
|
382
382
|
}
|
|
383
383
|
},
|
|
384
384
|
"node_modules/@asyncapi/raml-dt-schema-parser": {
|
|
385
|
-
"version": "4.0.
|
|
386
|
-
"resolved": "https://registry.npmjs.org/@asyncapi/raml-dt-schema-parser/-/raml-dt-schema-parser-4.0.
|
|
387
|
-
"integrity": "sha512-
|
|
385
|
+
"version": "4.0.19",
|
|
386
|
+
"resolved": "https://registry.npmjs.org/@asyncapi/raml-dt-schema-parser/-/raml-dt-schema-parser-4.0.19.tgz",
|
|
387
|
+
"integrity": "sha512-2W7hDN//ybFz4HbjuGVy8qN1pinBAQG268saw+Q6JdduYw7q49vLu6XUkftvJvyXhSEzCnNmZUaipFilLrE43w==",
|
|
388
388
|
"dependencies": {
|
|
389
|
-
"@asyncapi/parser": "^3.0.
|
|
389
|
+
"@asyncapi/parser": "^3.0.11",
|
|
390
390
|
"js-yaml": "^4.1.0",
|
|
391
391
|
"ramldt2jsonschema": "^1.2.3",
|
|
392
392
|
"webapi-parser": "^0.5.0"
|
|
@@ -404,13 +404,13 @@
|
|
|
404
404
|
}
|
|
405
405
|
},
|
|
406
406
|
"node_modules/@asyncapi/react-component": {
|
|
407
|
-
"version": "1.4.
|
|
408
|
-
"resolved": "https://registry.npmjs.org/@asyncapi/react-component/-/react-component-1.4.
|
|
409
|
-
"integrity": "sha512-
|
|
407
|
+
"version": "1.4.4",
|
|
408
|
+
"resolved": "https://registry.npmjs.org/@asyncapi/react-component/-/react-component-1.4.4.tgz",
|
|
409
|
+
"integrity": "sha512-wVJxU8Hanv3bqi8YH+qg7IacTYYWKe2IAuDUewGadCtYa559juV7cAuFi+fxv6fNmDeZR0J6BKB0/5S/zRHuyw==",
|
|
410
410
|
"dependencies": {
|
|
411
|
-
"@asyncapi/avro-schema-parser": "^3.0.
|
|
411
|
+
"@asyncapi/avro-schema-parser": "^3.0.19",
|
|
412
412
|
"@asyncapi/openapi-schema-parser": "^3.0.18",
|
|
413
|
-
"@asyncapi/parser": "^3.0.
|
|
413
|
+
"@asyncapi/parser": "^3.0.11",
|
|
414
414
|
"@asyncapi/protobuf-schema-parser": "^3.2.8",
|
|
415
415
|
"highlight.js": "^10.7.2",
|
|
416
416
|
"isomorphic-dompurify": "^0.13.0",
|
|
@@ -424,9 +424,9 @@
|
|
|
424
424
|
}
|
|
425
425
|
},
|
|
426
426
|
"node_modules/@asyncapi/specs": {
|
|
427
|
-
"version": "6.5.
|
|
428
|
-
"resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-6.5.
|
|
429
|
-
"integrity": "sha512-
|
|
427
|
+
"version": "6.5.4",
|
|
428
|
+
"resolved": "https://registry.npmjs.org/@asyncapi/specs/-/specs-6.5.4.tgz",
|
|
429
|
+
"integrity": "sha512-olC+iuboGIGjFRKuqfwaXxm5I6Wae3JohmySwMfExl21nYUd88IbfwywunOPLWyLV05aXeoTJ5tDXiM9e4gWcQ==",
|
|
430
430
|
"dependencies": {
|
|
431
431
|
"@types/json-schema": "^7.0.11"
|
|
432
432
|
}
|
|
@@ -3327,9 +3327,9 @@
|
|
|
3327
3327
|
}
|
|
3328
3328
|
},
|
|
3329
3329
|
"node_modules/@smoya/multi-parser": {
|
|
3330
|
-
"version": "5.0.
|
|
3331
|
-
"resolved": "https://registry.npmjs.org/@smoya/multi-parser/-/multi-parser-5.0.
|
|
3332
|
-
"integrity": "sha512-
|
|
3330
|
+
"version": "5.0.4",
|
|
3331
|
+
"resolved": "https://registry.npmjs.org/@smoya/multi-parser/-/multi-parser-5.0.4.tgz",
|
|
3332
|
+
"integrity": "sha512-qJKqAWWNg+PO4MphUpwnxPE4Y3ekBOtLvupH5M2YK5NJ00HVB7zClLL+02PXKDKOb7ogXyxG9b3lArvFDDOR2Q==",
|
|
3333
3333
|
"dependencies": {
|
|
3334
3334
|
"@asyncapi/avro-schema-parser": "^3.0.3",
|
|
3335
3335
|
"@asyncapi/openapi-schema-parser": "^3.0.4",
|
|
@@ -3337,7 +3337,7 @@
|
|
|
3337
3337
|
"@asyncapi/raml-dt-schema-parser": "^4.0.4",
|
|
3338
3338
|
"parserapiv1": "npm:@asyncapi/parser@^2.1.0",
|
|
3339
3339
|
"parserapiv2": "npm:@asyncapi/parser@3.0.0-next-major-spec.8",
|
|
3340
|
-
"parserapiv3": "npm:@asyncapi/parser@^3.0.
|
|
3340
|
+
"parserapiv3": "npm:@asyncapi/parser@^3.0.9"
|
|
3341
3341
|
}
|
|
3342
3342
|
},
|
|
3343
3343
|
"node_modules/@socket.io/component-emitter": {
|
|
@@ -3661,9 +3661,9 @@
|
|
|
3661
3661
|
}
|
|
3662
3662
|
},
|
|
3663
3663
|
"node_modules/@tsconfig/node10": {
|
|
3664
|
-
"version": "1.0.
|
|
3665
|
-
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.
|
|
3666
|
-
"integrity": "sha512-
|
|
3664
|
+
"version": "1.0.11",
|
|
3665
|
+
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz",
|
|
3666
|
+
"integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw=="
|
|
3667
3667
|
},
|
|
3668
3668
|
"node_modules/@tsconfig/node12": {
|
|
3669
3669
|
"version": "1.0.11",
|
|
@@ -4617,11 +4617,14 @@
|
|
|
4617
4617
|
}
|
|
4618
4618
|
},
|
|
4619
4619
|
"node_modules/binary-extensions": {
|
|
4620
|
-
"version": "2.
|
|
4621
|
-
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.
|
|
4622
|
-
"integrity": "sha512-
|
|
4620
|
+
"version": "2.3.0",
|
|
4621
|
+
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
|
|
4622
|
+
"integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",
|
|
4623
4623
|
"engines": {
|
|
4624
4624
|
"node": ">=8"
|
|
4625
|
+
},
|
|
4626
|
+
"funding": {
|
|
4627
|
+
"url": "https://github.com/sponsors/sindresorhus"
|
|
4625
4628
|
}
|
|
4626
4629
|
},
|
|
4627
4630
|
"node_modules/bl": {
|
|
@@ -9564,11 +9567,11 @@
|
|
|
9564
9567
|
},
|
|
9565
9568
|
"node_modules/parserapiv3": {
|
|
9566
9569
|
"name": "@asyncapi/parser",
|
|
9567
|
-
"version": "3.0.
|
|
9568
|
-
"resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.0.
|
|
9569
|
-
"integrity": "sha512-
|
|
9570
|
+
"version": "3.0.11",
|
|
9571
|
+
"resolved": "https://registry.npmjs.org/@asyncapi/parser/-/parser-3.0.11.tgz",
|
|
9572
|
+
"integrity": "sha512-YrmPY6Me7Eh6yH7xISKrDuiybaNVDUxVjbChUAoJZ4dnVGAmMVTxQTlwoqEwQ9bfTHzAb3RixdJ3TC6I4RoHNw==",
|
|
9570
9573
|
"dependencies": {
|
|
9571
|
-
"@asyncapi/specs": "^6.5.
|
|
9574
|
+
"@asyncapi/specs": "^6.5.4",
|
|
9572
9575
|
"@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0",
|
|
9573
9576
|
"@stoplight/json": "^3.20.2",
|
|
9574
9577
|
"@stoplight/json-ref-readers": "^1.2.2",
|
|
@@ -11146,9 +11149,9 @@
|
|
|
11146
11149
|
}
|
|
11147
11150
|
},
|
|
11148
11151
|
"node_modules/simple-git": {
|
|
11149
|
-
"version": "3.
|
|
11150
|
-
"resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.
|
|
11151
|
-
"integrity": "sha512-
|
|
11152
|
+
"version": "3.24.0",
|
|
11153
|
+
"resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.24.0.tgz",
|
|
11154
|
+
"integrity": "sha512-QqAKee9Twv+3k8IFOFfPB2hnk6as6Y6ACUpwCtQvRYBAes23Wv3SZlHVobAzqcE8gfsisCvPw3HGW3HYM+VYYw==",
|
|
11152
11155
|
"dependencies": {
|
|
11153
11156
|
"@kwsites/file-exists": "^1.1.1",
|
|
11154
11157
|
"@kwsites/promise-deferred": "^1.1.1",
|
|
@@ -11577,9 +11580,9 @@
|
|
|
11577
11580
|
"license": "0BSD"
|
|
11578
11581
|
},
|
|
11579
11582
|
"node_modules/tar": {
|
|
11580
|
-
"version": "6.2.
|
|
11581
|
-
"resolved": "https://registry.npmjs.org/tar/-/tar-6.2.
|
|
11582
|
-
"integrity": "sha512
|
|
11583
|
+
"version": "6.2.1",
|
|
11584
|
+
"resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz",
|
|
11585
|
+
"integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==",
|
|
11583
11586
|
"dependencies": {
|
|
11584
11587
|
"chownr": "^2.0.0",
|
|
11585
11588
|
"fs-minipass": "^2.0.0",
|
package/bin/run
CHANGED
package/bin/run_bin
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Only the binary installed through NPM is considered production environment. See "bin" in package.json.
|
|
4
|
+
process.env.NODE_ENV = 'production';
|
|
5
|
+
|
|
6
|
+
const oclif = require('@oclif/core');
|
|
7
|
+
|
|
8
|
+
oclif.run()
|
|
9
|
+
.then(require('@oclif/core/flush'))
|
|
10
|
+
.catch((err) => {
|
|
11
|
+
const oclifHandler = require('@oclif/core/handle');
|
|
12
|
+
return oclifHandler(err.message);
|
|
13
|
+
});
|
|
14
|
+
|
package/bin/run_bin.cmd
ADDED
package/lib/base.d.ts
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
|
+
import { MetricMetadata, Recorder } from '@smoya/asyncapi-adoption-metrics';
|
|
3
|
+
import { Parser } from '@asyncapi/parser';
|
|
4
|
+
import { Specification } from 'models/SpecificationFile';
|
|
2
5
|
export default abstract class extends Command {
|
|
6
|
+
recorder: Promise<Recorder>;
|
|
7
|
+
parser: Parser;
|
|
8
|
+
metricsMetadata: MetricMetadata;
|
|
9
|
+
specFile: Specification | undefined;
|
|
10
|
+
init(): Promise<void>;
|
|
3
11
|
catch(err: Error & {
|
|
4
12
|
exitCode?: number;
|
|
5
13
|
}): Promise<any>;
|
|
14
|
+
recordActionFinished(action: string, metadata?: MetricMetadata, rawDocument?: string): Promise<void>;
|
|
15
|
+
recordActionInvoked(action: string, metadata?: MetricMetadata): Promise<void>;
|
|
16
|
+
recordActionMetric(recordFunc: (recorder: Recorder) => Promise<void>): Promise<void>;
|
|
17
|
+
finally(error: Error | undefined): Promise<any>;
|
|
18
|
+
recorderFromEnv(prefix: string): Promise<Recorder>;
|
|
6
19
|
}
|
package/lib/base.js
CHANGED
|
@@ -2,7 +2,37 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
|
+
const asyncapi_adoption_metrics_1 = require("@smoya/asyncapi-adoption-metrics");
|
|
6
|
+
const parser_1 = require("@asyncapi/parser");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const fs_extra_1 = require("fs-extra");
|
|
9
|
+
const fs_1 = require("fs");
|
|
10
|
+
const uuid_1 = require("uuid");
|
|
11
|
+
const { readFile, writeFile } = fs_1.promises;
|
|
12
|
+
class DiscardSink {
|
|
13
|
+
send() {
|
|
14
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
// noop
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
5
19
|
class default_1 extends core_1.Command {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.recorder = this.recorderFromEnv('asyncapi_adoption');
|
|
23
|
+
this.parser = new parser_1.Parser();
|
|
24
|
+
this.metricsMetadata = {};
|
|
25
|
+
}
|
|
26
|
+
init() {
|
|
27
|
+
const _super = Object.create(null, {
|
|
28
|
+
init: { get: () => super.init }
|
|
29
|
+
});
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
yield _super.init.call(this);
|
|
32
|
+
const commandName = this.id || '';
|
|
33
|
+
yield this.recordActionInvoked(commandName, this.metricsMetadata);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
6
36
|
catch(err) {
|
|
7
37
|
const _super = Object.create(null, {
|
|
8
38
|
catch: { get: () => super.catch }
|
|
@@ -19,5 +49,94 @@ class default_1 extends core_1.Command {
|
|
|
19
49
|
}
|
|
20
50
|
});
|
|
21
51
|
}
|
|
52
|
+
recordActionFinished(action, metadata = {}, rawDocument) {
|
|
53
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
if (rawDocument !== undefined) {
|
|
55
|
+
try {
|
|
56
|
+
const { document } = yield this.parser.parse(rawDocument);
|
|
57
|
+
if (document !== undefined) {
|
|
58
|
+
metadata = (0, asyncapi_adoption_metrics_1.MetadataFromDocument)(document, metadata);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
if (e instanceof Error) {
|
|
63
|
+
this.log(`Skipping submitting anonymous metrics due to the following error: ${e.name}: ${e.message}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const callable = function (recorder) {
|
|
68
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
yield recorder.recordActionFinished(action, metadata);
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
yield this.recordActionMetric(callable);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
recordActionInvoked(action, metadata) {
|
|
76
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const callable = function (recorder) {
|
|
78
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
yield recorder.recordActionInvoked(action, metadata);
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
yield this.recordActionMetric(callable);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
recordActionMetric(recordFunc) {
|
|
86
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
try {
|
|
88
|
+
yield recordFunc(yield this.recorder);
|
|
89
|
+
yield (yield this.recorder).flush();
|
|
90
|
+
}
|
|
91
|
+
catch (e) {
|
|
92
|
+
if (e instanceof Error) {
|
|
93
|
+
this.log(`Skipping submitting anonymous metrics due to the following error: ${e.name}: ${e.message}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
finally(error) {
|
|
99
|
+
const _super = Object.create(null, {
|
|
100
|
+
finally: { get: () => super.finally }
|
|
101
|
+
});
|
|
102
|
+
var _a;
|
|
103
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
yield _super.finally.call(this, error);
|
|
105
|
+
this.metricsMetadata['success'] = error === undefined;
|
|
106
|
+
yield this.recordActionFinished(this.id, this.metricsMetadata, (_a = this.specFile) === null || _a === void 0 ? void 0 : _a.text());
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
recorderFromEnv(prefix) {
|
|
110
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
let sink = new DiscardSink();
|
|
112
|
+
const analyticsConfigFile = (0, path_1.join)(process.cwd(), '.asyncapi-analytics');
|
|
113
|
+
if (!(0, fs_extra_1.existsSync)(analyticsConfigFile)) {
|
|
114
|
+
yield writeFile(analyticsConfigFile, JSON.stringify({ analyticsEnabled: 'true', infoMessageShown: 'false', userID: (0, uuid_1.v4)() }), { encoding: 'utf8' });
|
|
115
|
+
}
|
|
116
|
+
const analyticsConfigFileContent = JSON.parse(yield readFile((0, path_1.resolve)(analyticsConfigFile), { encoding: 'utf8' }));
|
|
117
|
+
this.metricsMetadata['user'] = analyticsConfigFileContent.userID;
|
|
118
|
+
if (analyticsConfigFileContent.analyticsEnabled !== 'false' && process.env.CI !== 'true') {
|
|
119
|
+
switch (process.env.NODE_ENV) {
|
|
120
|
+
case 'development':
|
|
121
|
+
// NODE_ENV set to `development` in bin/run
|
|
122
|
+
if (!process.env.TEST) {
|
|
123
|
+
// Do not pollute stdout when running tests
|
|
124
|
+
sink = new asyncapi_adoption_metrics_1.StdOutSink();
|
|
125
|
+
}
|
|
126
|
+
break;
|
|
127
|
+
case 'production':
|
|
128
|
+
// NODE_ENV set to `production` in bin/run_bin, which is specified in 'bin' package.json section
|
|
129
|
+
sink = new asyncapi_adoption_metrics_1.NewRelicSink(process.env.ASYNCAPI_METRICS_NEWRELIC_KEY || 'eu01xx73a8521047150dd9414f6aedd2FFFFNRAL');
|
|
130
|
+
if (analyticsConfigFileContent.infoMessageShown === 'false') {
|
|
131
|
+
this.log('\nAsyncAPI anonymously tracks command executions to improve the specification and tools, ensuring no sensitive data reaches our servers. It aids in comprehending how AsyncAPI tools are used and adopted, facilitating ongoing improvements to our specifications and tools.\n\nTo disable tracking, please run the following command:\n asyncapi config analytics --disable\n\nOnce disabled, if you want to enable tracking back again then run:\n asyncapi config analytics --enable');
|
|
132
|
+
analyticsConfigFileContent.infoMessageShown = 'true';
|
|
133
|
+
yield writeFile(analyticsConfigFile, JSON.stringify(analyticsConfigFileContent), { encoding: 'utf8' });
|
|
134
|
+
}
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return new asyncapi_adoption_metrics_1.Recorder(prefix, sink);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
22
141
|
}
|
|
23
142
|
exports.default = default_1;
|
package/lib/commands/bundle.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Example } from '@oclif/core/lib/interfaces';
|
|
2
2
|
import Command from '../base';
|
|
3
3
|
import { Specification } from '../models/SpecificationFile';
|
|
4
|
+
import { Parser } from '@asyncapi/parser';
|
|
4
5
|
export default class Bundle extends Command {
|
|
5
6
|
static description: string;
|
|
6
7
|
static strict: boolean;
|
|
@@ -11,6 +12,8 @@ export default class Bundle extends Command {
|
|
|
11
12
|
'reference-into-components': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
13
|
base: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
13
14
|
};
|
|
15
|
+
parser: Parser;
|
|
14
16
|
run(): Promise<void>;
|
|
17
|
+
private collectMetricsData;
|
|
15
18
|
loadFiles(filepaths: string[]): Promise<Specification[]>;
|
|
16
19
|
}
|
package/lib/commands/bundle.js
CHANGED
|
@@ -7,8 +7,13 @@ const bundler_1 = tslib_1.__importDefault(require("@asyncapi/bundler"));
|
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
9
9
|
const SpecificationFile_1 = require("../models/SpecificationFile");
|
|
10
|
+
const parser_1 = require("@asyncapi/parser");
|
|
10
11
|
const { writeFile } = fs_1.promises;
|
|
11
12
|
class Bundle extends base_1.default {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.parser = new parser_1.Parser();
|
|
16
|
+
}
|
|
12
17
|
run() {
|
|
13
18
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
14
19
|
const { argv, flags } = yield this.parse(Bundle);
|
|
@@ -16,6 +21,7 @@ class Bundle extends base_1.default {
|
|
|
16
21
|
let baseFile;
|
|
17
22
|
const outputFormat = path_1.default.extname(argv[0]);
|
|
18
23
|
const AsyncAPIFiles = yield this.loadFiles(argv);
|
|
24
|
+
this.metricsMetadata.files = AsyncAPIFiles.length;
|
|
19
25
|
if (flags.base) {
|
|
20
26
|
baseFile = (yield (0, SpecificationFile_1.load)(flags.base)).text();
|
|
21
27
|
}
|
|
@@ -24,6 +30,7 @@ class Bundle extends base_1.default {
|
|
|
24
30
|
referenceIntoComponents: flags['reference-into-components'],
|
|
25
31
|
base: baseFile
|
|
26
32
|
});
|
|
33
|
+
yield this.collectMetricsData(document);
|
|
27
34
|
if (!output) {
|
|
28
35
|
if (outputFormat === '.yaml' || outputFormat === '.yml') {
|
|
29
36
|
this.log(document.yml());
|
|
@@ -48,6 +55,19 @@ class Bundle extends base_1.default {
|
|
|
48
55
|
}
|
|
49
56
|
});
|
|
50
57
|
}
|
|
58
|
+
collectMetricsData(document) {
|
|
59
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
try {
|
|
61
|
+
// We collect the metadata from the final output so it contains all the files
|
|
62
|
+
this.specFile = new SpecificationFile_1.Specification(document.string());
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
if (e instanceof Error) {
|
|
66
|
+
this.log(`Skipping submitting anonymous metrics due to the following error: ${e.name}: ${e.message}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
51
71
|
loadFiles(filepaths) {
|
|
52
72
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
53
73
|
const files = [];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Command from '../../base';
|
|
2
|
+
export default class Analytics extends Command {
|
|
3
|
+
static readonly description = "Enable or disable analytics for metrics collection";
|
|
4
|
+
static readonly flags: {
|
|
5
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
6
|
+
disable: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
enable: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
};
|
|
9
|
+
run(): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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 path_1 = require("path");
|
|
6
|
+
const base_1 = tslib_1.__importDefault(require("../../base"));
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const { readFile, writeFile } = fs_1.promises;
|
|
9
|
+
class Analytics extends base_1.default {
|
|
10
|
+
run() {
|
|
11
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
|
+
const { flags } = yield this.parse(Analytics);
|
|
13
|
+
const analyticsConfigFile = (0, path_1.join)(process.cwd(), '.asyncapi-analytics');
|
|
14
|
+
try {
|
|
15
|
+
const analyticsConfigFileContent = JSON.parse(yield readFile((0, path_1.resolve)(analyticsConfigFile), { encoding: 'utf8' }));
|
|
16
|
+
if (flags.disable) {
|
|
17
|
+
analyticsConfigFileContent.analyticsEnabled = 'false';
|
|
18
|
+
this.log('Analytics disabled.');
|
|
19
|
+
}
|
|
20
|
+
else if (flags.enable) {
|
|
21
|
+
analyticsConfigFileContent.analyticsEnabled = 'true';
|
|
22
|
+
this.log('Analytics enabled.');
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
this.log('\nPlease append the "--disable" flag to the command in case you prefer to disable analytics, or use the "--enable" flag if you want to enable analytics back again.\n');
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
yield writeFile(analyticsConfigFile, JSON.stringify(analyticsConfigFileContent), { encoding: 'utf8' });
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
switch (e.code) {
|
|
32
|
+
case 'ENOENT':
|
|
33
|
+
this.error(`Unable to access the analytics configuration file. We tried to access the ".asyncapi-analytics" file in your current working directory ("${process.cwd()}") but the file could not be found.`);
|
|
34
|
+
break;
|
|
35
|
+
case 'EEXIST':
|
|
36
|
+
this.error(`Unable to update the analytics configuration file. We tried to update your ".asyncapi-analytics" file in the path "${analyticsConfigFile}" but the file does not exist.`);
|
|
37
|
+
break;
|
|
38
|
+
default:
|
|
39
|
+
this.error(`Unable to change your analytics configuration. Please check the following message for further info about the error:\n\n${e}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.default = Analytics;
|
|
46
|
+
Analytics.description = 'Enable or disable analytics for metrics collection';
|
|
47
|
+
Analytics.flags = {
|
|
48
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
49
|
+
disable: core_1.Flags.boolean({ char: 'd', description: 'disable analytics', default: false }),
|
|
50
|
+
enable: core_1.Flags.boolean({ char: 'e', description: 'enable analytics', default: false }),
|
|
51
|
+
};
|
package/lib/commands/convert.js
CHANGED
|
@@ -17,20 +17,20 @@ class Convert extends base_1.default {
|
|
|
17
17
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
18
|
const { args, flags } = yield this.parse(Convert);
|
|
19
19
|
const filePath = args['spec-file'];
|
|
20
|
-
let specFile;
|
|
21
20
|
let convertedFile;
|
|
22
21
|
let convertedFileFormatted;
|
|
23
22
|
try {
|
|
24
23
|
// LOAD FILE
|
|
25
|
-
specFile = yield (0, SpecificationFile_1.load)(filePath);
|
|
24
|
+
this.specFile = yield (0, SpecificationFile_1.load)(filePath);
|
|
25
|
+
this.metricsMetadata.to_version = flags['target-version'];
|
|
26
26
|
// CONVERSION
|
|
27
|
-
convertedFile = (0, converter_1.convert)(specFile.text(), flags['target-version']);
|
|
27
|
+
convertedFile = (0, converter_1.convert)(this.specFile.text(), flags['target-version']);
|
|
28
28
|
if (convertedFile) {
|
|
29
|
-
if (specFile.getFilePath()) {
|
|
30
|
-
this.log(`File ${specFile.getFilePath()} successfully converted!`);
|
|
29
|
+
if (this.specFile.getFilePath()) {
|
|
30
|
+
this.log(`File ${this.specFile.getFilePath()} successfully converted!`);
|
|
31
31
|
}
|
|
32
|
-
else if (specFile.getFileURL()) {
|
|
33
|
-
this.log(`URL ${specFile.getFileURL()} successfully converted!`);
|
|
32
|
+
else if (this.specFile.getFileURL()) {
|
|
33
|
+
this.log(`URL ${this.specFile.getFileURL()} successfully converted!`);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
if (typeof convertedFile === 'object') {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Command from '../../base';
|
|
2
|
+
import { Parser } from '@asyncapi/parser';
|
|
2
3
|
import type { Example } from '@oclif/core/lib/interfaces';
|
|
3
4
|
export default class Template extends Command {
|
|
4
5
|
static description: string;
|
|
@@ -20,6 +21,7 @@ export default class Template extends Command {
|
|
|
20
21
|
description: string;
|
|
21
22
|
required: boolean;
|
|
22
23
|
}[];
|
|
24
|
+
parser: Parser;
|
|
23
25
|
run(): Promise<void>;
|
|
24
26
|
private parseFlags;
|
|
25
27
|
private paramParser;
|