@asyncapi/cli 2.5.0 → 2.7.1

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.
@@ -11518,9 +11518,9 @@
11518
11518
  }
11519
11519
  },
11520
11520
  "node_modules/rollup": {
11521
- "version": "2.79.1",
11522
- "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz",
11523
- "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==",
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.1",
11519
- "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz",
11520
- "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==",
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,6 +6,7 @@ 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;
9
10
  const dependencies = [];
10
11
  let dependency = '';
11
12
  // Preparation of the array with all dependencies '@asyncapi/*' along with
@@ -19,7 +20,7 @@ class Versions extends base_1.default {
19
20
  try {
20
21
  // Goofy name `importedPJSON` is chosen to distinguish from name `pjson`
21
22
  // used in `@oclif` source code.
22
- const importedPJSON = yield Promise.resolve().then(() => tslib_1.__importStar(require(`${key}/package.json`)));
23
+ const importedPJSON = yield (_a = `${key}/package.json`, Promise.resolve().then(() => tslib_1.__importStar(require(_a))));
23
24
  dependencies.push(`${key}/${importedPJSON.default.version}`);
24
25
  }
25
26
  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
  }
@@ -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
- if (isOpenAPI) {
36
- convertedFile = (0, converter_1.convertOpenAPI)(this.specFile.text(), specJson.openapi, {
37
- perspective: flags['perspective']
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
- if (err instanceof specification_file_1.SpecificationFileNotFound) {
65
- this.error(new validation_error_1.ValidationError({
66
- type: 'invalid-file',
67
- filepath: filePath
68
- }));
69
- }
70
- else if (((_a = this.specFile) === null || _a === void 0 ? void 0 : _a.toJson().asyncapi) > flags['target-version']) {
71
- this.error(`The ${(0, picocolors_1.cyan)(filePath)} file cannot be converted to an older version. Downgrading is not supported.`);
72
- }
73
- else {
74
- this.error(err);
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.description = 'Convert asyncapi documents older to newer versions or OpenAPI documents to AsyncAPI';
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 }),
@@ -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<"info" | "error" | "warn" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
8
+ 'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"error" | "warn" | "info" | "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>;
@@ -2,36 +2,7 @@ import Command from '../../core/base';
2
2
  export default class Models extends Command {
3
3
  static description: string;
4
4
  static readonly args: any;
5
- static flags: {
6
- 'log-diagnostics': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
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<"info" | "error" | "warn" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
9
- 'no-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
- pyDantic: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
- javaIncludeComments: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
- javaJackson: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
- javaConstraints: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
14
- javaArrayType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
15
- csharpAutoImplement: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
16
- csharpNewtonsoft: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
17
- csharpArrayType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
18
- csharpHashcode: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
19
- csharpEqual: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
20
- csharpSystemJson: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
21
- tsModelType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
22
- tsEnumType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
23
- tsModuleSystem: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
24
- tsIncludeComments: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
25
- tsExportType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
26
- tsJsonBinPack: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
27
- tsMarshalling: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
28
- tsExampleInstance: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
29
- tsRawPropertyNames: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
30
- help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
31
- output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
32
- packageName: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
33
- namespace: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
34
- };
5
+ static flags: Record<string, any>;
35
6
  run(): Promise<void>;
36
7
  private parseArgs;
37
8
  }
@@ -12,4 +12,4 @@ class Start extends base_1.default {
12
12
  }
13
13
  }
14
14
  exports.default = Start;
15
- Start.description = '';
15
+ Start.description = 'Starts AsyncAPI-related services. Currently, it supports launching the AsyncAPI Studio';
@@ -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<"info" | "error" | "warn" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
8
+ 'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"error" | "warn" | "info" | "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
  };
@@ -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
- declare type From = 'file' | 'url' | 'context' | 'invalid file';
10
+ 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);
@@ -1,4 +1,4 @@
1
- declare type ErrorType = 'parser-error' | 'invalid-file' | 'no-spec-found';
1
+ type ErrorType = 'parser-error' | 'invalid-file' | 'no-spec-found';
2
2
  interface IValidationErrorInput {
3
3
  type: ErrorType;
4
4
  err?: any;
@@ -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<"info" | "error" | "warn" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
4
+ 'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"error" | "warn" | "info" | "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>;
@@ -1,30 +1 @@
1
- export declare const modelsFlags: () => {
2
- 'log-diagnostics': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
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<"info" | "error" | "warn" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
5
- 'no-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
- pyDantic: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
- javaIncludeComments: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
- javaJackson: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
- javaConstraints: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
- javaArrayType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
11
- csharpAutoImplement: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
- csharpNewtonsoft: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
- csharpArrayType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
14
- csharpHashcode: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
15
- csharpEqual: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
16
- csharpSystemJson: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
17
- tsModelType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
18
- tsEnumType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
19
- tsModuleSystem: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
20
- tsIncludeComments: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
21
- tsExportType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
22
- tsJsonBinPack: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
23
- tsMarshalling: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
24
- tsExampleInstance: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
25
- tsRawPropertyNames: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
26
- help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
27
- output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
28
- packageName: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
29
- namespace: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
30
- };
1
+ export declare const modelsFlags: () => Record<string, any>;
@@ -1,4 +1,4 @@
1
- export declare const watchFlag: (description?: string | undefined) => import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
1
+ export declare const watchFlag: (description?: string) => 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<"info" | "error" | "warn" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
5
+ 'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"error" | "warn" | "info" | "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
  };
@@ -1,6 +1,6 @@
1
1
  import Command from './base';
2
2
  import { Specification } from './models/SpecificationFile';
3
- export declare type SpecWatcherParams = {
3
+ export type SpecWatcherParams = {
4
4
  spec: Specification;
5
5
  handler: Command;
6
6
  handlerName: string;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.closest = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const core_1 = require("@oclif/core");
6
+ const prompts_1 = require("@clack/prompts");
6
7
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
8
  const fast_levenshtein_1 = tslib_1.__importDefault(require("fast-levenshtein"));
8
9
  const closest = (target, possibilities) => {
@@ -41,18 +42,18 @@ const hook = function (opts) {
41
42
  let readableSuggestion = (0, core_1.toConfiguredId)(suggestion, this.config);
42
43
  const originalCmd = (0, core_1.toConfiguredId)(opts.id, this.config);
43
44
  this.warn(`${chalk_1.default.yellow(originalCmd)} is not a ${opts.config.bin} command.`);
44
- let response = '';
45
+ let response;
45
46
  try {
46
47
  if (opts.id === 'help') {
47
48
  readableSuggestion = '--help';
48
49
  }
49
- response = yield core_1.ux.prompt(`Did you mean ${chalk_1.default.blueBright(readableSuggestion)}? [y/n]`, { timeout: 10000 });
50
+ response = yield (0, prompts_1.confirm)({ message: `Did you mean ${chalk_1.default.blueBright(readableSuggestion)}? [y/n]` });
50
51
  }
51
52
  catch (error) {
52
53
  this.log('');
53
54
  this.debug(error);
54
55
  }
55
- if (response === 'y') {
56
+ if (response === true) {
56
57
  // this will split the original command from the suggested replacement, and gather the remaining args as varargs to help with situations like:
57
58
  // confit set foo-bar -> confit:set:foo-bar -> config:set:foo-bar -> config:set foo-bar
58
59
  let argv = ((_a = opts.argv) === null || _a === void 0 ? void 0 : _a.length) ? opts.argv : opts.id.split(':').slice(suggestion.split(':').length);
@@ -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 declare type SeverityKind = 'error' | 'warn' | 'info' | 'hint';
6
+ export 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<"info" | "error" | "warn" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
18
+ 'fail-severity': import("@oclif/core/lib/interfaces").OptionFlag<"error" | "warn" | "info" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
19
19
  };
20
20
  export interface ValidateOptions {
21
21
  'log-diagnostics'?: boolean;
@@ -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",
@@ -1285,7 +1287,7 @@
1285
1287
  "start": {
1286
1288
  "aliases": [],
1287
1289
  "args": {},
1288
- "description": "",
1290
+ "description": "Starts AsyncAPI-related services. Currently, it supports launching the AsyncAPI Studio",
1289
1291
  "flags": {},
1290
1292
  "hasDynamicHelp": false,
1291
1293
  "hiddenAliases": [],
@@ -1620,5 +1622,5 @@
1620
1622
  ]
1621
1623
  }
1622
1624
  },
1623
- "version": "2.5.0"
1625
+ "version": "2.7.1"
1624
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.5.0",
4
+ "version": "2.7.1",
5
5
  "author": "@asyncapi",
6
6
  "bin": {
7
7
  "asyncapi": "./bin/run_bin"
@@ -13,7 +13,6 @@
13
13
  "@asyncapi/converter": "^1.6.2",
14
14
  "@asyncapi/diff": "^0.4.1",
15
15
  "@asyncapi/generator": "^1.17.25",
16
- "@asyncapi/modelina": "^3.7.0",
17
16
  "@asyncapi/modelina-cli": "^4.0.0-next.48",
18
17
  "@asyncapi/openapi-schema-parser": "^3.0.24",
19
18
  "@asyncapi/optimizer": "^1.0.3",
@@ -22,19 +21,14 @@
22
21
  "@asyncapi/raml-dt-schema-parser": "^4.0.24",
23
22
  "@asyncapi/studio": "^0.20.0",
24
23
  "@clack/prompts": "^0.7.0",
25
- "@oclif/core": "^3",
26
- "@oclif/errors": "^1.3.6",
27
- "@oclif/plugin-not-found": "^2.3.22",
24
+ "@oclif/core": "^4.0.28",
28
25
  "@smoya/asyncapi-adoption-metrics": "^2.4.9",
29
- "@smoya/multi-parser": "^5.0.9",
30
26
  "@stoplight/spectral-cli": "6.9.0",
31
- "ajv": "^8.12.0",
32
27
  "chalk": "^4.1.0",
33
28
  "chokidar": "^3.5.2",
34
29
  "fast-levenshtein": "^3.0.0",
35
30
  "fs-extra": "^11.1.0",
36
31
  "generator-v2": "npm:@asyncapi/generator@^2.4.1",
37
- "indent-string": "^4.0.0",
38
32
  "inquirer": "^8.2.0",
39
33
  "js-yaml": "^4.1.0",
40
34
  "lodash.template": "^4.4.0",
@@ -43,12 +37,10 @@
43
37
  "open": "^8.4.0",
44
38
  "picocolors": "^1.0.0",
45
39
  "reflect-metadata": "^0.1.13",
46
- "request": "^2.88.2",
47
40
  "serve-handler": "^6.1.3",
48
41
  "strip-ansi": "^6.0.0",
49
42
  "unzipper": "^0.10.11",
50
43
  "uuid": "^9.0.1",
51
- "wrap-ansi": "^9.0.0",
52
44
  "ws": "^8.2.3"
53
45
  },
54
46
  "devDependencies": {
@@ -170,12 +162,15 @@
170
162
  "pretest:coverage": "npm run build",
171
163
  "posttest": "rimraf ./test.asyncapi-cli",
172
164
  "release": "semantic-release",
173
- "test": "npm run test:unit",
165
+ "test": "npm run test:unit && npm run action:test",
174
166
  "test:unit": "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 \"test/**/*.test.ts\"",
175
167
  "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",
176
168
  "get-version": "echo $npm_package_version",
177
169
  "createhook": "oclif generate hook myhook --event=command_not_found",
178
- "createhookinit": "oclif generate hook inithook --event=init"
170
+ "createhookinit": "oclif generate hook inithook --event=init",
171
+ "action:docker:build": "docker build -f github-action/Dockerfile -t asyncapi/github-action-for-cli:latest .",
172
+ "action:bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION",
173
+ "action:test": "cd github-action && make test"
179
174
  },
180
175
  "types": "lib/index.d.ts"
181
176
  }