@asyncapi/cli 2.4.1 → 2.6.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/assets/create-glee-app/templates/default/package-lock.json +3 -3
- package/assets/create-glee-app/templates/tutorial/package-lock.json +3 -3
- package/lib/commands/config/versions.js +1 -2
- package/lib/commands/convert.d.ts +9 -0
- package/lib/commands/convert.js +82 -42
- package/lib/commands/diff.d.ts +1 -1
- package/lib/commands/generate/fromTemplate.d.ts +2 -0
- package/lib/commands/generate/fromTemplate.js +32 -1
- package/lib/commands/generate/models.d.ts +1 -1
- package/lib/commands/validate.d.ts +1 -1
- package/lib/core/base.js +1 -0
- package/lib/core/errors/specification-file.d.ts +1 -1
- package/lib/core/errors/validation-error.d.ts +1 -1
- package/lib/core/flags/convert.flags.js +1 -1
- package/lib/core/flags/diff.flags.d.ts +1 -1
- package/lib/core/flags/generate/fromTemplate.flags.d.ts +1 -0
- package/lib/core/flags/generate/fromTemplate.flags.js +4 -0
- package/lib/core/flags/generate/models.flags.d.ts +1 -1
- package/lib/core/flags/global.flags.d.ts +1 -1
- package/lib/core/flags/validate.flags.d.ts +1 -1
- package/lib/core/globals.d.ts +1 -1
- package/lib/core/parser.d.ts +2 -2
- package/oclif.manifest.json +11 -3
- package/package.json +5 -3
|
@@ -11518,9 +11518,9 @@
|
|
|
11518
11518
|
}
|
|
11519
11519
|
},
|
|
11520
11520
|
"node_modules/rollup": {
|
|
11521
|
-
"version": "2.79.
|
|
11522
|
-
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.
|
|
11523
|
-
"integrity": "sha512-
|
|
11521
|
+
"version": "2.79.2",
|
|
11522
|
+
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.2.tgz",
|
|
11523
|
+
"integrity": "sha512-fS6iqSPZDs3dr/y7Od6y5nha8dW1YnbgtsyotCVvoFGKbERG++CVRFv1meyGDE1SNItQA8BrnCw7ScdAhRJ3XQ==",
|
|
11524
11524
|
"bin": {
|
|
11525
11525
|
"rollup": "dist/bin/rollup"
|
|
11526
11526
|
},
|
|
@@ -11515,9 +11515,9 @@
|
|
|
11515
11515
|
}
|
|
11516
11516
|
},
|
|
11517
11517
|
"node_modules/rollup": {
|
|
11518
|
-
"version": "2.79.
|
|
11519
|
-
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.
|
|
11520
|
-
"integrity": "sha512-
|
|
11518
|
+
"version": "2.79.2",
|
|
11519
|
+
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.2.tgz",
|
|
11520
|
+
"integrity": "sha512-fS6iqSPZDs3dr/y7Od6y5nha8dW1YnbgtsyotCVvoFGKbERG++CVRFv1meyGDE1SNItQA8BrnCw7ScdAhRJ3XQ==",
|
|
11521
11521
|
"bin": {
|
|
11522
11522
|
"rollup": "dist/bin/rollup"
|
|
11523
11523
|
},
|
|
@@ -6,7 +6,6 @@ const global_flags_1 = require("../../core/flags/global.flags");
|
|
|
6
6
|
class Versions extends base_1.default {
|
|
7
7
|
run() {
|
|
8
8
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
-
var _a;
|
|
10
9
|
const dependencies = [];
|
|
11
10
|
let dependency = '';
|
|
12
11
|
// Preparation of the array with all dependencies '@asyncapi/*' along with
|
|
@@ -20,7 +19,7 @@ class Versions extends base_1.default {
|
|
|
20
19
|
try {
|
|
21
20
|
// Goofy name `importedPJSON` is chosen to distinguish from name `pjson`
|
|
22
21
|
// used in `@oclif` source code.
|
|
23
|
-
const importedPJSON = yield
|
|
22
|
+
const importedPJSON = yield Promise.resolve().then(() => tslib_1.__importStar(require(`${key}/package.json`)));
|
|
24
23
|
dependencies.push(`${key}/${importedPJSON.default.version}`);
|
|
25
24
|
}
|
|
26
25
|
catch (e) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import Command from '../core/base';
|
|
2
2
|
export default class Convert extends Command {
|
|
3
|
+
static specFile: any;
|
|
4
|
+
static metricsMetadata: any;
|
|
3
5
|
static description: string;
|
|
4
6
|
static flags: {
|
|
5
7
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
@@ -12,4 +14,11 @@ export default class Convert extends Command {
|
|
|
12
14
|
'spec-file': import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
13
15
|
};
|
|
14
16
|
run(): Promise<void>;
|
|
17
|
+
private handleConversion;
|
|
18
|
+
private convertOpenAPI;
|
|
19
|
+
private convertAsyncAPI;
|
|
20
|
+
private convertPostman;
|
|
21
|
+
private formatConvertedFile;
|
|
22
|
+
private handleOutput;
|
|
23
|
+
private handleError;
|
|
15
24
|
}
|
package/lib/commands/convert.js
CHANGED
|
@@ -16,7 +16,6 @@ const convert_flags_1 = require("../core/flags/convert.flags");
|
|
|
16
16
|
const latestVersion = Object.keys(specs_1.default.schemas).pop();
|
|
17
17
|
class Convert extends base_1.default {
|
|
18
18
|
run() {
|
|
19
|
-
var _a;
|
|
20
19
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
20
|
const { args, flags } = yield this.parse(Convert);
|
|
22
21
|
const filePath = args['spec-file'];
|
|
@@ -28,57 +27,98 @@ class Convert extends base_1.default {
|
|
|
28
27
|
// eslint-disable-next-line sonarjs/no-duplicate-string
|
|
29
28
|
this.metricsMetadata.to_version = flags['target-version'];
|
|
30
29
|
// Determine if the input is OpenAPI or AsyncAPI
|
|
31
|
-
const specJson = this.specFile.toJson();
|
|
32
30
|
const isOpenAPI = flags['format'] === 'openapi';
|
|
33
31
|
const isAsyncAPI = flags['format'] === 'asyncapi';
|
|
34
32
|
// CONVERSION
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this.log(`🎉 The OpenAPI document has been successfully converted to AsyncAPI version ${(0, picocolors_1.green)(flags['target-version'])}!`);
|
|
40
|
-
}
|
|
41
|
-
else if (isAsyncAPI) {
|
|
42
|
-
convertedFile = (0, converter_1.convert)(this.specFile.text(), flags['target-version']);
|
|
43
|
-
if (this.specFile.getFilePath()) {
|
|
44
|
-
this.log(`🎉 The ${(0, picocolors_1.cyan)(this.specFile.getFilePath())} file has been successfully converted to version ${(0, picocolors_1.green)(flags['target-version'])}!!`);
|
|
45
|
-
}
|
|
46
|
-
else if (this.specFile.getFileURL()) {
|
|
47
|
-
this.log(`🎉 The URL ${(0, picocolors_1.cyan)(this.specFile.getFileURL())} has been successfully converted to version ${(0, picocolors_1.green)(flags['target-version'])}!!`);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (typeof convertedFile === 'object') {
|
|
51
|
-
convertedFileFormatted = JSON.stringify(convertedFile, null, 4);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
convertedFileFormatted = convertedFile;
|
|
55
|
-
}
|
|
56
|
-
if (flags.output) {
|
|
57
|
-
yield fs_1.promises.writeFile(`${flags.output}`, convertedFileFormatted, { encoding: 'utf8' });
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
this.log(convertedFileFormatted);
|
|
61
|
-
}
|
|
33
|
+
convertedFile = this.handleConversion(isOpenAPI, isAsyncAPI, flags);
|
|
34
|
+
// Handle file output or log the result
|
|
35
|
+
convertedFileFormatted = this.formatConvertedFile(convertedFile);
|
|
36
|
+
yield this.handleOutput(flags.output, convertedFileFormatted);
|
|
62
37
|
}
|
|
63
38
|
catch (err) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
39
|
+
this.handleError(err, filePath !== null && filePath !== void 0 ? filePath : 'unknown', flags);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
// Helper function to handle conversion logic
|
|
44
|
+
handleConversion(isOpenAPI, isAsyncAPI, flags) {
|
|
45
|
+
var _a;
|
|
46
|
+
const specJson = (_a = this.specFile) === null || _a === void 0 ? void 0 : _a.toJson();
|
|
47
|
+
if (isOpenAPI) {
|
|
48
|
+
return this.convertOpenAPI(specJson, flags);
|
|
49
|
+
}
|
|
50
|
+
else if (isAsyncAPI) {
|
|
51
|
+
return this.convertAsyncAPI(flags);
|
|
52
|
+
}
|
|
53
|
+
return this.convertPostman(flags);
|
|
54
|
+
}
|
|
55
|
+
convertOpenAPI(specJson, flags) {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
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, {
|
|
58
|
+
perspective: flags['perspective']
|
|
59
|
+
});
|
|
60
|
+
this.log(`🎉 The OpenAPI document has been successfully converted to AsyncAPI version ${(0, picocolors_1.green)(flags['target-version'])}!`);
|
|
61
|
+
return convertedFile;
|
|
62
|
+
}
|
|
63
|
+
convertAsyncAPI(flags) {
|
|
64
|
+
var _a, _b, _c, _d, _e, _f;
|
|
65
|
+
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']);
|
|
66
|
+
if ((_c = this.specFile) === null || _c === void 0 ? void 0 : _c.getFilePath()) {
|
|
67
|
+
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'])}!!`);
|
|
68
|
+
}
|
|
69
|
+
else if ((_e = this.specFile) === null || _e === void 0 ? void 0 : _e.getFileURL()) {
|
|
70
|
+
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'])}!!`);
|
|
71
|
+
}
|
|
72
|
+
return convertedFile;
|
|
73
|
+
}
|
|
74
|
+
convertPostman(flags) {
|
|
75
|
+
var _a, _b, _c, _d, _e, _f;
|
|
76
|
+
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', {
|
|
77
|
+
perspective: flags['perspective']
|
|
78
|
+
});
|
|
79
|
+
if ((_c = this.specFile) === null || _c === void 0 ? void 0 : _c.getFilePath()) {
|
|
80
|
+
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'])}!!`);
|
|
81
|
+
}
|
|
82
|
+
else if ((_e = this.specFile) === null || _e === void 0 ? void 0 : _e.getFileURL()) {
|
|
83
|
+
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'])}!!`);
|
|
84
|
+
}
|
|
85
|
+
return convertedFile;
|
|
86
|
+
}
|
|
87
|
+
// Helper function to format the converted file
|
|
88
|
+
formatConvertedFile(convertedFile) {
|
|
89
|
+
return typeof convertedFile === 'object' ? JSON.stringify(convertedFile, null, 4) : convertedFile;
|
|
90
|
+
}
|
|
91
|
+
// Helper function to handle output
|
|
92
|
+
handleOutput(outputPath, convertedFileFormatted) {
|
|
93
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
if (outputPath) {
|
|
95
|
+
yield fs_1.promises.writeFile(`${outputPath}`, convertedFileFormatted, { encoding: 'utf8' });
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
this.log(convertedFileFormatted);
|
|
76
99
|
}
|
|
77
100
|
});
|
|
78
101
|
}
|
|
102
|
+
// Helper function to handle errors
|
|
103
|
+
handleError(err, filePath, flags) {
|
|
104
|
+
var _a;
|
|
105
|
+
if (err instanceof specification_file_1.SpecificationFileNotFound) {
|
|
106
|
+
this.error(new validation_error_1.ValidationError({
|
|
107
|
+
type: 'invalid-file',
|
|
108
|
+
filepath: filePath
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
else if (((_a = this.specFile) === null || _a === void 0 ? void 0 : _a.toJson().asyncapi) > flags['target-version']) {
|
|
112
|
+
this.error(`The ${(0, picocolors_1.cyan)(filePath)} file cannot be converted to an older version. Downgrading is not supported.`);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
this.error(err);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
79
118
|
}
|
|
80
119
|
exports.default = Convert;
|
|
81
|
-
Convert.
|
|
120
|
+
Convert.metricsMetadata = {};
|
|
121
|
+
Convert.description = 'Convert asyncapi documents older to newer versions or OpenAPI/postman-collection documents to AsyncAPI';
|
|
82
122
|
Convert.flags = (0, convert_flags_1.convertFlags)(latestVersion);
|
|
83
123
|
Convert.args = {
|
|
84
124
|
'spec-file': core_1.Args.string({ description: 'spec path, url, or context-name', required: false }),
|
package/lib/commands/diff.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export default class Diff extends Command {
|
|
|
5
5
|
static flags: {
|
|
6
6
|
'log-diagnostics': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
7
|
'diagnostics-format': import("@oclif/core/lib/interfaces").OptionFlag<import("@stoplight/spectral-cli/dist/services/config").OutputFormat, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
-
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"
|
|
8
|
+
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"info" | "error" | "warn" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
9
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
10
10
|
format: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
11
|
type: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
@@ -18,6 +18,7 @@ export default class Template extends Command {
|
|
|
18
18
|
'registry-url': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
19
|
'registry-auth': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
20
20
|
'registry-token': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
21
|
+
'use-new-generator': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
21
22
|
};
|
|
22
23
|
static args: {
|
|
23
24
|
asyncapi: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
@@ -33,6 +34,7 @@ export default class Template extends Command {
|
|
|
33
34
|
private disableHooksParser;
|
|
34
35
|
private mapBaseURLParser;
|
|
35
36
|
private generate;
|
|
37
|
+
private generateUsingNewGenerator;
|
|
36
38
|
private runWatchMode;
|
|
37
39
|
private watcherHandler;
|
|
38
40
|
private getMapBaseUrlToFolderResolver;
|
|
@@ -6,6 +6,7 @@ const base_1 = tslib_1.__importDefault(require("../../core/base"));
|
|
|
6
6
|
// eslint-disable-next-line
|
|
7
7
|
// @ts-ignore
|
|
8
8
|
const generator_1 = tslib_1.__importDefault(require("@asyncapi/generator"));
|
|
9
|
+
const generator_v2_1 = tslib_1.__importDefault(require("generator-v2"));
|
|
9
10
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
10
11
|
const os_1 = tslib_1.__importDefault(require("os"));
|
|
11
12
|
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
@@ -114,7 +115,12 @@ class Template extends base_1.default {
|
|
|
114
115
|
this.error(`${template} template does not support AsyncAPI v3 documents, please checkout ${v3IssueLink}`);
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
|
-
|
|
118
|
+
if (flags['use-new-generator']) {
|
|
119
|
+
yield this.generateUsingNewGenerator(asyncapi, template, output, options, genOption, interactive);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
yield this.generate(asyncapi, template, output, options, genOption, interactive);
|
|
123
|
+
}
|
|
118
124
|
if (watchTemplate) {
|
|
119
125
|
const watcherHandler = this.watcherHandler(asyncapi, template, output, options, genOption, interactive);
|
|
120
126
|
yield this.runWatchMode(asyncapi, template, output, watcherHandler);
|
|
@@ -281,6 +287,31 @@ class Template extends base_1.default {
|
|
|
281
287
|
s.stop(`${(0, picocolors_1.yellow)('Check out your shiny new generated files at ') + (0, picocolors_1.magenta)(output) + (0, picocolors_1.yellow)('.')}\n`);
|
|
282
288
|
});
|
|
283
289
|
}
|
|
290
|
+
generateUsingNewGenerator(asyncapi, template, output, options, genOption, interactive = true) {
|
|
291
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
292
|
+
let specification;
|
|
293
|
+
try {
|
|
294
|
+
specification = yield (0, SpecificationFile_1.load)(asyncapi);
|
|
295
|
+
}
|
|
296
|
+
catch (err) {
|
|
297
|
+
return this.error(new validation_error_1.ValidationError({
|
|
298
|
+
type: 'invalid-file',
|
|
299
|
+
filepath: asyncapi,
|
|
300
|
+
}), { exit: 1 });
|
|
301
|
+
}
|
|
302
|
+
const generator = new generator_v2_1.default(template, output || path_1.default.resolve(os_1.default.tmpdir(), 'asyncapi-generator'), options);
|
|
303
|
+
const s = interactive ? (0, prompts_1.spinner)() : { start: () => null, stop: (string) => console.log(string) };
|
|
304
|
+
s.start('Generation in progress. Keep calm and wait a bit');
|
|
305
|
+
try {
|
|
306
|
+
yield generator.generateFromString(specification.text(), Object.assign(Object.assign({}, genOption), { path: asyncapi }));
|
|
307
|
+
}
|
|
308
|
+
catch (err) {
|
|
309
|
+
s.stop('Generation failed');
|
|
310
|
+
throw new generator_error_1.GeneratorError(err);
|
|
311
|
+
}
|
|
312
|
+
s.stop(`${(0, picocolors_1.yellow)('Check out your shiny new generated files at ') + (0, picocolors_1.magenta)(output) + (0, picocolors_1.yellow)('.')}\n`);
|
|
313
|
+
});
|
|
314
|
+
}
|
|
284
315
|
runWatchMode(asyncapi, template, output, watchHandler) {
|
|
285
316
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
286
317
|
const specification = yield (0, SpecificationFile_1.load)(asyncapi);
|
|
@@ -5,7 +5,7 @@ export default class Models extends Command {
|
|
|
5
5
|
static flags: {
|
|
6
6
|
'log-diagnostics': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
7
|
'diagnostics-format': import("@oclif/core/lib/interfaces").OptionFlag<import("@stoplight/spectral-cli/dist/services/config").OutputFormat, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
-
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"
|
|
8
|
+
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"info" | "error" | "warn" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
9
|
'no-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
10
|
pyDantic: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
11
|
javaIncludeComments: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
@@ -5,7 +5,7 @@ export default class Validate extends Command {
|
|
|
5
5
|
score: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
6
6
|
'log-diagnostics': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
7
|
'diagnostics-format': import("@oclif/core/lib/interfaces").OptionFlag<import("@stoplight/spectral-cli/dist/services/config").OutputFormat, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
-
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"
|
|
8
|
+
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"info" | "error" | "warn" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
9
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
10
10
|
watch: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
11
|
};
|
package/lib/core/base.js
CHANGED
|
@@ -7,7 +7,7 @@ export declare class SpecificationFileNotFound extends SpecificationFileError {
|
|
|
7
7
|
export declare class SpecificationURLNotFound extends SpecificationFileError {
|
|
8
8
|
constructor(URL: string);
|
|
9
9
|
}
|
|
10
|
-
type From = 'file' | 'url' | 'context' | 'invalid file';
|
|
10
|
+
declare type From = 'file' | 'url' | 'context' | 'invalid file';
|
|
11
11
|
export declare class ErrorLoadingSpec extends Error {
|
|
12
12
|
private readonly errorMessages;
|
|
13
13
|
constructor(from?: From, param?: string);
|
|
@@ -9,7 +9,7 @@ const convertFlags = (latestVersion) => {
|
|
|
9
9
|
format: core_1.Flags.string({
|
|
10
10
|
char: 'f',
|
|
11
11
|
description: 'Specify the format to convert from (openapi or asyncapi)',
|
|
12
|
-
options: ['openapi', 'asyncapi'],
|
|
12
|
+
options: ['openapi', 'asyncapi', 'postman-collection'],
|
|
13
13
|
required: true,
|
|
14
14
|
default: 'asyncapi',
|
|
15
15
|
}),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const diffFlags: () => {
|
|
2
2
|
'log-diagnostics': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
3
3
|
'diagnostics-format': import("@oclif/core/lib/interfaces").OptionFlag<import("@stoplight/spectral-cli/dist/services/config").OutputFormat, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
4
|
-
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"
|
|
4
|
+
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"info" | "error" | "warn" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
5
5
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
6
6
|
format: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
7
|
type: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
@@ -13,4 +13,5 @@ export declare const fromTemplateFlags: () => {
|
|
|
13
13
|
'registry-url': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
14
|
'registry-auth': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
15
|
'registry-token': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
16
|
+
'use-new-generator': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
16
17
|
};
|
|
@@ -55,6 +55,10 @@ const fromTemplateFlags = () => {
|
|
|
55
55
|
}),
|
|
56
56
|
'registry-token': core_1.Flags.string({
|
|
57
57
|
description: 'The npm registry authentication token, that can be passed instead of base64 encoded username and password'
|
|
58
|
+
}),
|
|
59
|
+
'use-new-generator': core_1.Flags.boolean({
|
|
60
|
+
default: false,
|
|
61
|
+
description: 'Use v2 generator, for generating from newer templates'
|
|
58
62
|
})
|
|
59
63
|
};
|
|
60
64
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const modelsFlags: () => {
|
|
2
2
|
'log-diagnostics': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
3
3
|
'diagnostics-format': import("@oclif/core/lib/interfaces").OptionFlag<import("@stoplight/spectral-cli/dist/services/config").OutputFormat, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
4
|
-
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"
|
|
4
|
+
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"info" | "error" | "warn" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
5
5
|
'no-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
6
6
|
pyDantic: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
7
7
|
javaIncludeComments: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const watchFlag: (description?: string) => import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
1
|
+
export declare const watchFlag: (description?: string | undefined) => import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
2
2
|
export declare const helpFlag: () => {
|
|
3
3
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
4
4
|
};
|
|
@@ -2,7 +2,7 @@ export declare const validateFlags: () => {
|
|
|
2
2
|
score: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
3
3
|
'log-diagnostics': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
4
4
|
'diagnostics-format': import("@oclif/core/lib/interfaces").OptionFlag<import("@stoplight/spectral-cli/dist/services/config").OutputFormat, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
5
|
-
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"
|
|
5
|
+
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"info" | "error" | "warn" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
6
6
|
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
7
7
|
watch: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
8
8
|
};
|
package/lib/core/globals.d.ts
CHANGED
package/lib/core/parser.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { OutputFormat } from '@stoplight/spectral-cli/dist/services/config';
|
|
|
3
3
|
import type { Diagnostic } from '@asyncapi/parser/cjs';
|
|
4
4
|
import type Command from './base';
|
|
5
5
|
import type { Specification } from './models/SpecificationFile';
|
|
6
|
-
export type SeverityKind = 'error' | 'warn' | 'info' | 'hint';
|
|
6
|
+
export declare type SeverityKind = 'error' | 'warn' | 'info' | 'hint';
|
|
7
7
|
export { convertToOldAPI };
|
|
8
8
|
export interface ValidationFlagsOptions {
|
|
9
9
|
logDiagnostics?: boolean;
|
|
@@ -15,7 +15,7 @@ export declare enum ValidationStatus {
|
|
|
15
15
|
export declare function validationFlags({ logDiagnostics }?: ValidationFlagsOptions): {
|
|
16
16
|
'log-diagnostics': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
17
|
'diagnostics-format': import("@oclif/core/lib/interfaces").OptionFlag<OutputFormat, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
18
|
-
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"
|
|
18
|
+
'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"info" | "error" | "warn" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
19
19
|
};
|
|
20
20
|
export interface ValidateOptions {
|
|
21
21
|
'log-diagnostics'?: boolean;
|
package/oclif.manifest.json
CHANGED
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"required": false
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
|
-
"description": "Convert asyncapi documents older to newer versions or OpenAPI documents to AsyncAPI",
|
|
78
|
+
"description": "Convert asyncapi documents older to newer versions or OpenAPI/postman-collection documents to AsyncAPI",
|
|
79
79
|
"flags": {
|
|
80
80
|
"help": {
|
|
81
81
|
"char": "h",
|
|
@@ -102,7 +102,8 @@
|
|
|
102
102
|
"multiple": false,
|
|
103
103
|
"options": [
|
|
104
104
|
"openapi",
|
|
105
|
-
"asyncapi"
|
|
105
|
+
"asyncapi",
|
|
106
|
+
"postman-collection"
|
|
106
107
|
],
|
|
107
108
|
"type": "option"
|
|
108
109
|
},
|
|
@@ -136,6 +137,7 @@
|
|
|
136
137
|
"pluginName": "@asyncapi/cli",
|
|
137
138
|
"pluginType": "core",
|
|
138
139
|
"strict": true,
|
|
140
|
+
"metricsMetadata": {},
|
|
139
141
|
"isESM": false,
|
|
140
142
|
"relativePath": [
|
|
141
143
|
"lib",
|
|
@@ -673,6 +675,12 @@
|
|
|
673
675
|
"hasDynamicHelp": false,
|
|
674
676
|
"multiple": false,
|
|
675
677
|
"type": "option"
|
|
678
|
+
},
|
|
679
|
+
"use-new-generator": {
|
|
680
|
+
"description": "Use v2 generator, for generating from newer templates",
|
|
681
|
+
"name": "use-new-generator",
|
|
682
|
+
"allowNo": false,
|
|
683
|
+
"type": "boolean"
|
|
676
684
|
}
|
|
677
685
|
},
|
|
678
686
|
"hasDynamicHelp": false,
|
|
@@ -1614,5 +1622,5 @@
|
|
|
1614
1622
|
]
|
|
1615
1623
|
}
|
|
1616
1624
|
},
|
|
1617
|
-
"version": "2.
|
|
1625
|
+
"version": "2.6.0"
|
|
1618
1626
|
}
|
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": "2.
|
|
4
|
+
"version": "2.6.0",
|
|
5
5
|
"author": "@asyncapi",
|
|
6
6
|
"bin": {
|
|
7
7
|
"asyncapi": "./bin/run_bin"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@asyncapi/modelina-cli": "^4.0.0-next.48",
|
|
18
18
|
"@asyncapi/openapi-schema-parser": "^3.0.24",
|
|
19
19
|
"@asyncapi/optimizer": "^1.0.3",
|
|
20
|
-
"@asyncapi/parser": "^3.
|
|
20
|
+
"@asyncapi/parser": "^3.3.0",
|
|
21
21
|
"@asyncapi/protobuf-schema-parser": "^3.2.13",
|
|
22
22
|
"@asyncapi/raml-dt-schema-parser": "^4.0.24",
|
|
23
23
|
"@asyncapi/studio": "^0.20.0",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"chokidar": "^3.5.2",
|
|
34
34
|
"fast-levenshtein": "^3.0.0",
|
|
35
35
|
"fs-extra": "^11.1.0",
|
|
36
|
+
"generator-v2": "npm:@asyncapi/generator@^2.4.1",
|
|
36
37
|
"indent-string": "^4.0.0",
|
|
37
38
|
"inquirer": "^8.2.0",
|
|
38
39
|
"js-yaml": "^4.1.0",
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"@asyncapi/minimaltemplate": "./test/fixtures/minimaltemplate",
|
|
56
|
+
"@asyncapi/newtemplate": "./test/fixtures/newtemplate",
|
|
55
57
|
"@babel/core": "^7.19.3",
|
|
56
58
|
"@oclif/test": "^2",
|
|
57
59
|
"@swc/core": "^1.3.2",
|
|
@@ -156,7 +158,7 @@
|
|
|
156
158
|
"generate:assets": "npm run generate:readme:toc && npm run generate:commands",
|
|
157
159
|
"generate:commands": "npm run generate:readme:create && npm run generate:readme:commands && node ./scripts/updateUsageDocs.js && rimraf ./scripts/README.md",
|
|
158
160
|
"generate:readme:toc": "markdown-toc -i README.md",
|
|
159
|
-
"lint": "eslint --max-warnings
|
|
161
|
+
"lint": "eslint --max-warnings 5 --config .eslintrc .",
|
|
160
162
|
"lint:fix": "eslint --max-warnings 5 --config .eslintrc . --fix",
|
|
161
163
|
"pack:macos": "oclif pack macos && npm run pack:rename",
|
|
162
164
|
"pack:linux": "oclif pack deb && npm run pack:rename",
|