@asyncapi/cli 1.16.1 → 1.18.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.
Files changed (100) hide show
  1. package/lib/commands/bundle.d.ts +1 -1
  2. package/lib/commands/bundle.js +4 -10
  3. package/lib/commands/config/analytics.d.ts +1 -1
  4. package/lib/commands/config/analytics.js +6 -8
  5. package/lib/commands/config/context/add.d.ts +1 -1
  6. package/lib/commands/config/context/add.js +5 -12
  7. package/lib/commands/config/context/current.d.ts +1 -1
  8. package/lib/commands/config/context/current.js +5 -7
  9. package/lib/commands/config/context/edit.d.ts +1 -1
  10. package/lib/commands/config/context/edit.js +5 -6
  11. package/lib/commands/config/context/index.d.ts +1 -1
  12. package/lib/commands/config/context/index.js +1 -1
  13. package/lib/commands/config/context/init.d.ts +1 -1
  14. package/lib/commands/config/context/init.js +4 -5
  15. package/lib/commands/config/context/list.d.ts +1 -1
  16. package/lib/commands/config/context/list.js +5 -7
  17. package/lib/commands/config/context/remove.d.ts +1 -1
  18. package/lib/commands/config/context/remove.js +5 -6
  19. package/lib/commands/config/context/use.d.ts +1 -1
  20. package/lib/commands/config/context/use.js +5 -6
  21. package/lib/commands/config/index.d.ts +1 -1
  22. package/lib/commands/config/index.js +1 -1
  23. package/lib/commands/config/versions.d.ts +1 -1
  24. package/lib/commands/config/versions.js +3 -5
  25. package/lib/commands/convert.d.ts +1 -1
  26. package/lib/commands/convert.js +6 -9
  27. package/lib/commands/diff.d.ts +1 -1
  28. package/lib/commands/diff.js +14 -28
  29. package/lib/commands/generate/fromTemplate.d.ts +1 -1
  30. package/lib/commands/generate/fromTemplate.js +7 -59
  31. package/lib/commands/generate/index.d.ts +1 -1
  32. package/lib/commands/generate/index.js +1 -1
  33. package/lib/commands/generate/models.d.ts +1 -16
  34. package/lib/commands/generate/models.js +5 -120
  35. package/lib/commands/new/file.d.ts +1 -1
  36. package/lib/commands/new/file.js +5 -12
  37. package/lib/commands/new/glee.d.ts +2 -2
  38. package/lib/commands/new/glee.js +10 -26
  39. package/lib/commands/optimize.d.ts +1 -1
  40. package/lib/commands/optimize.js +5 -9
  41. package/lib/commands/start/index.d.ts +1 -1
  42. package/lib/commands/start/index.js +2 -2
  43. package/lib/commands/start/studio.d.ts +1 -1
  44. package/lib/commands/start/studio.js +7 -9
  45. package/lib/commands/validate.d.ts +1 -1
  46. package/lib/commands/validate.js +6 -6
  47. package/lib/{base.d.ts → core/base.d.ts} +1 -1
  48. package/lib/core/flags/bundle.flags.d.ts +7 -0
  49. package/lib/core/flags/bundle.flags.js +14 -0
  50. package/lib/core/flags/config/analytics.flags.d.ts +6 -0
  51. package/lib/core/flags/config/analytics.flags.js +13 -0
  52. package/lib/core/flags/config/context.flags.d.ts +4 -0
  53. package/lib/core/flags/config/context.flags.js +16 -0
  54. package/lib/core/flags/convert.flags.d.ts +5 -0
  55. package/lib/core/flags/convert.flags.js +12 -0
  56. package/lib/core/flags/diff.flags.d.ts +12 -0
  57. package/lib/core/flags/diff.flags.js +29 -0
  58. package/lib/core/flags/generate/fromTemplate.flags.d.ts +16 -0
  59. package/lib/core/flags/generate/fromTemplate.flags.js +61 -0
  60. package/lib/core/flags/generate/models.flags.d.ts +43 -0
  61. package/lib/core/flags/generate/models.flags.js +125 -0
  62. package/lib/{flags.d.ts → core/flags/global.flags.d.ts} +3 -0
  63. package/lib/{flags.js → core/flags/global.flags.js} +7 -1
  64. package/lib/core/flags/new/file.flags.d.ts +8 -0
  65. package/lib/core/flags/new/file.flags.js +15 -0
  66. package/lib/core/flags/new/glee.flags.d.ts +7 -0
  67. package/lib/core/flags/new/glee.flags.js +28 -0
  68. package/lib/core/flags/optimize.flags.d.ts +17 -0
  69. package/lib/core/flags/optimize.flags.js +26 -0
  70. package/lib/core/flags/start/studio.flags.d.ts +5 -0
  71. package/lib/core/flags/start/studio.flags.js +12 -0
  72. package/lib/core/flags/validate.flags.d.ts +7 -0
  73. package/lib/core/flags/validate.flags.js +10 -0
  74. package/oclif.manifest.json +2 -2
  75. package/package.json +1 -1
  76. /package/lib/{base.js → core/base.js} +0 -0
  77. /package/lib/{errors → core/errors}/context-error.d.ts +0 -0
  78. /package/lib/{errors → core/errors}/context-error.js +0 -0
  79. /package/lib/{errors → core/errors}/diff-error.d.ts +0 -0
  80. /package/lib/{errors → core/errors}/diff-error.js +0 -0
  81. /package/lib/{errors → core/errors}/generator-error.d.ts +0 -0
  82. /package/lib/{errors → core/errors}/generator-error.js +0 -0
  83. /package/lib/{errors → core/errors}/specification-file.d.ts +0 -0
  84. /package/lib/{errors → core/errors}/specification-file.js +0 -0
  85. /package/lib/{errors → core/errors}/validation-error.d.ts +0 -0
  86. /package/lib/{errors → core/errors}/validation-error.js +0 -0
  87. /package/lib/{globals.d.ts → core/globals.d.ts} +0 -0
  88. /package/lib/{globals.js → core/globals.js} +0 -0
  89. /package/lib/{hooks → core/hooks}/command_not_found/myhook.d.ts +0 -0
  90. /package/lib/{hooks → core/hooks}/command_not_found/myhook.js +0 -0
  91. /package/lib/{models → core/models}/Context.d.ts +0 -0
  92. /package/lib/{models → core/models}/Context.js +0 -0
  93. /package/lib/{models → core/models}/SpecificationFile.d.ts +0 -0
  94. /package/lib/{models → core/models}/SpecificationFile.js +0 -0
  95. /package/lib/{models → core/models}/Studio.d.ts +0 -0
  96. /package/lib/{models → core/models}/Studio.js +0 -0
  97. /package/lib/{parser.d.ts → core/parser.d.ts} +0 -0
  98. /package/lib/{parser.js → core/parser.js} +0 -0
  99. /package/lib/{utils → core/utils}/generator.d.ts +0 -0
  100. /package/lib/{utils → core/utils}/generator.js +0 -0
@@ -1,4 +1,4 @@
1
- import Command from '../../base';
1
+ import Command from '../../core/base';
2
2
  export default class Models extends Command {
3
3
  static description: string;
4
4
  static args: {
@@ -12,9 +12,6 @@ export default class Models extends Command {
12
12
  help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
13
13
  'no-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
14
14
  output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
15
- /**
16
- * TypeScript specific options
17
- */
18
15
  tsModelType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
19
16
  tsEnumType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
20
17
  tsModuleSystem: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
@@ -24,23 +21,11 @@ export default class Models extends Command {
24
21
  tsMarshalling: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
25
22
  tsExampleInstance: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
26
23
  tsRawPropertyNames: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
27
- /**
28
- * Go and Java specific package name to use for the generated models
29
- */
30
24
  packageName: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
31
- /**
32
- * Java specific options
33
- */
34
25
  javaIncludeComments: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
35
26
  javaJackson: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
36
27
  javaConstraints: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
37
- /**
38
- * C++ and C# and PHP specific namespace to use for the generated models
39
- */
40
28
  namespace: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
41
- /**
42
- * C# specific options
43
- */
44
29
  csharpAutoImplement: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
45
30
  csharpNewtonsoft: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
46
31
  csharpArrayType: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
@@ -4,11 +4,12 @@ const tslib_1 = require("tslib");
4
4
  const modelina_1 = require("@asyncapi/modelina");
5
5
  const core_1 = require("@oclif/core");
6
6
  const multi_parser_1 = require("@smoya/multi-parser");
7
- const base_1 = tslib_1.__importDefault(require("../../base"));
8
- const SpecificationFile_1 = require("../../models/SpecificationFile");
9
- const parser_1 = require("../../parser");
7
+ const base_1 = tslib_1.__importDefault(require("../../core/base"));
8
+ const SpecificationFile_1 = require("../../core/models/SpecificationFile");
9
+ const parser_1 = require("../../core/parser");
10
10
  const prompts_1 = require("@clack/prompts");
11
11
  const picocolors_1 = require("picocolors");
12
+ const models_flags_1 = require("../../core/flags/generate/models.flags");
12
13
  var Languages;
13
14
  (function (Languages) {
14
15
  Languages["typescript"] = "typescript";
@@ -281,120 +282,4 @@ Models.args = {
281
282
  language: core_1.Args.string({ description: 'The language you want the typed models generated for.', options: Object.keys(Languages), required: true }),
282
283
  file: core_1.Args.string({ description: 'Path or URL to the AsyncAPI document, or context-name', required: true }),
283
284
  };
284
- Models.flags = Object.assign({ help: core_1.Flags.help({ char: 'h' }), 'no-interactive': core_1.Flags.boolean({
285
- description: 'Disable interactive mode and run with the provided flags.',
286
- required: false,
287
- default: false,
288
- }), output: core_1.Flags.string({
289
- char: 'o',
290
- description: 'The output directory where the models should be written to. Omitting this flag will write the models to `stdout`.',
291
- required: false
292
- }),
293
- /**
294
- * TypeScript specific options
295
- */
296
- tsModelType: core_1.Flags.string({
297
- type: 'option',
298
- options: ['class', 'interface'],
299
- description: 'TypeScript specific, define which type of model needs to be generated.',
300
- required: false,
301
- default: 'class',
302
- }), tsEnumType: core_1.Flags.string({
303
- type: 'option',
304
- options: ['enum', 'union'],
305
- description: 'TypeScript specific, define which type of enums needs to be generated.',
306
- required: false,
307
- default: 'enum',
308
- }), tsModuleSystem: core_1.Flags.string({
309
- type: 'option',
310
- options: ['ESM', 'CJS'],
311
- description: 'TypeScript specific, define the module system to be used.',
312
- required: false,
313
- default: 'ESM',
314
- }), tsIncludeComments: core_1.Flags.boolean({
315
- description: 'TypeScript specific, if enabled add comments while generating models.',
316
- required: false,
317
- default: false,
318
- }), tsExportType: core_1.Flags.string({
319
- type: 'option',
320
- options: ['default', 'named'],
321
- description: 'TypeScript specific, define which type of export needs to be generated.',
322
- required: false,
323
- default: 'default',
324
- }), tsJsonBinPack: core_1.Flags.boolean({
325
- description: 'TypeScript specific, define basic support for serializing to and from binary with jsonbinpack.',
326
- required: false,
327
- default: false,
328
- }), tsMarshalling: core_1.Flags.boolean({
329
- description: 'TypeScript specific, generate the models with marshalling functions.',
330
- required: false,
331
- default: false,
332
- }), tsExampleInstance: core_1.Flags.boolean({
333
- description: 'Typescript specific, generate example of the model',
334
- required: false,
335
- default: false,
336
- }), tsRawPropertyNames: core_1.Flags.boolean({
337
- description: 'Typescript specific, generate the models using raw property names.',
338
- required: false,
339
- default: false,
340
- }),
341
- /**
342
- * Go and Java specific package name to use for the generated models
343
- */
344
- packageName: core_1.Flags.string({
345
- description: 'Go, Java and Kotlin specific, define the package to use for the generated models. This is required when language is `go`, `java` or `kotlin`.',
346
- required: false
347
- }),
348
- /**
349
- * Java specific options
350
- */
351
- javaIncludeComments: core_1.Flags.boolean({
352
- description: 'Java specific, if enabled add comments while generating models.',
353
- required: false,
354
- default: false
355
- }), javaJackson: core_1.Flags.boolean({
356
- description: 'Java specific, generate the models with Jackson serialization support',
357
- required: false,
358
- default: false
359
- }), javaConstraints: core_1.Flags.boolean({
360
- description: 'Java specific, generate the models with constraints',
361
- required: false,
362
- default: false
363
- }),
364
- /**
365
- * C++ and C# and PHP specific namespace to use for the generated models
366
- */
367
- namespace: core_1.Flags.string({
368
- description: 'C#, C++ and PHP specific, define the namespace to use for the generated models. This is required when language is `csharp`,`c++` or `php`.',
369
- required: false
370
- }),
371
- /**
372
- * C# specific options
373
- */
374
- csharpAutoImplement: core_1.Flags.boolean({
375
- description: 'C# specific, define whether to generate auto-implemented properties or not.',
376
- required: false,
377
- default: false
378
- }), csharpNewtonsoft: core_1.Flags.boolean({
379
- description: 'C# specific, generate the models with newtonsoft serialization support',
380
- required: false,
381
- default: false
382
- }), csharpArrayType: core_1.Flags.string({
383
- type: 'option',
384
- description: 'C# specific, define which type of array needs to be generated.',
385
- options: ['Array', 'List'],
386
- required: false,
387
- default: 'Array'
388
- }), csharpHashcode: core_1.Flags.boolean({
389
- description: 'C# specific, generate the models with the GetHashCode method overwritten',
390
- required: false,
391
- default: false
392
- }), csharpEqual: core_1.Flags.boolean({
393
- description: 'C# specific, generate the models with the Equal method overwritten',
394
- required: false,
395
- default: false
396
- }), csharpSystemJson: core_1.Flags.boolean({
397
- description: 'C# specific, generate the models with System.Text.Json serialization support',
398
- required: false,
399
- default: false
400
- }) }, (0, parser_1.validationFlags)({ logDiagnostics: false }));
285
+ Models.flags = (0, models_flags_1.modelsFlags)();
@@ -1,4 +1,4 @@
1
- import Command from '../../base';
1
+ import Command from '../../core/base';
2
2
  export default class NewFile extends Command {
3
3
  static description: string;
4
4
  static flags: {
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const core_1 = require("@oclif/core");
5
4
  const fs_1 = require("fs");
6
- const base_1 = tslib_1.__importDefault(require("../../base"));
5
+ const base_1 = tslib_1.__importDefault(require("../../core/base"));
7
6
  const inquirer = tslib_1.__importStar(require("inquirer"));
8
- const Studio_1 = require("../../models/Studio");
7
+ const Studio_1 = require("../../core/models/Studio");
9
8
  const path_1 = require("path");
10
- const SpecificationFile_1 = require("../../models/SpecificationFile");
9
+ const SpecificationFile_1 = require("../../core/models/SpecificationFile");
11
10
  const picocolors_1 = require("picocolors");
11
+ const file_flags_1 = require("../../core/flags/new/file.flags");
12
12
  const { writeFile, readFile } = fs_1.promises;
13
13
  const DEFAULT_ASYNCAPI_FILE_NAME = 'asyncapi.yaml';
14
14
  const DEFAULT_ASYNCAPI_TEMPLATE = 'default-example.yaml';
@@ -152,14 +152,7 @@ class NewFile extends base_1.default {
152
152
  }
153
153
  exports.default = NewFile;
154
154
  NewFile.description = 'Creates a new asyncapi file';
155
- NewFile.flags = {
156
- help: core_1.Flags.help({ char: 'h' }),
157
- 'file-name': core_1.Flags.string({ char: 'n', description: 'name of the file' }),
158
- example: core_1.Flags.string({ char: 'e', description: getExamplesFlagDescription() }),
159
- studio: core_1.Flags.boolean({ char: 's', description: 'open in Studio' }),
160
- port: core_1.Flags.integer({ char: 'p', description: 'port in which to start Studio' }),
161
- 'no-tty': core_1.Flags.boolean({ description: 'do not use an interactive terminal' }),
162
- };
155
+ NewFile.flags = (0, file_flags_1.fileFlags)(getExamplesFlagDescription());
163
156
  NewFile.examples = [
164
157
  'asyncapi new\t - start creation of a file in interactive mode',
165
158
  'asyncapi new --file-name=my-asyncapi.yml --example=default-example.yml --no-tty\t - create a new file with a specific name, using one of the examples and without interactive mode'
@@ -1,5 +1,5 @@
1
- import Command from '../../base';
2
- import { Specification } from '../../models/SpecificationFile';
1
+ import Command from '../../core/base';
2
+ import { Specification } from '../../core/models/SpecificationFile';
3
3
  export declare const successMessage: (projectName: string) => string;
4
4
  export default class NewGlee extends Command {
5
5
  static description: string;
@@ -2,30 +2,30 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.successMessage = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const core_1 = require("@oclif/core");
6
5
  const fs_1 = require("fs");
7
- const base_1 = tslib_1.__importDefault(require("../../base"));
6
+ const base_1 = tslib_1.__importDefault(require("../../core/base"));
8
7
  const path_1 = tslib_1.__importStar(require("path"));
9
8
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
10
- const SpecificationFile_1 = require("../../models/SpecificationFile");
9
+ const SpecificationFile_1 = require("../../core/models/SpecificationFile");
11
10
  const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
12
11
  const inquirer_1 = require("inquirer");
13
12
  // eslint-disable-next-line
14
13
  // @ts-ignore
15
14
  const generator_1 = tslib_1.__importDefault(require("@asyncapi/generator"));
16
15
  const picocolors_1 = require("picocolors");
16
+ const glee_flags_1 = require("../../core/flags/new/glee.flags");
17
17
  const successMessage = (projectName) => `🎉 Your Glee project has been successfully created!
18
18
  ⏩ Next steps: follow the instructions ${(0, picocolors_1.cyan)('below')} to manage your project:
19
19
 
20
20
  cd ${projectName}\t\t ${(0, picocolors_1.gray)('# Navigate to the project directory')}
21
21
  npm install\t\t ${(0, picocolors_1.gray)('# Install the project dependencies')}
22
- npm run dev\t\t ${(0, picocolors_1.gray)('# Start the project in development mode')}
22
+ npm run dev\t\t ${(0, picocolors_1.gray)('# Start the project in development mode')}
23
23
 
24
24
  You can also open the project in your favourite editor and start tweaking it.
25
25
  `;
26
26
  exports.successMessage = successMessage;
27
27
  const errorMessages = {
28
- alreadyExists: (projectName) => `Unable to create the project because the directory "${(0, picocolors_1.cyan)(projectName)}" already exists at "${process.cwd()}/${projectName}".
28
+ alreadyExists: (projectName) => `Unable to create the project because the directory "${(0, picocolors_1.cyan)(projectName)}" already exists at "${process.cwd()}/${projectName}".
29
29
  To specify a different name for the new project, please run the command below with a unique project name:
30
30
 
31
31
  ${(0, picocolors_1.gray)('asyncapi new glee --name ') + (0, picocolors_1.gray)(projectName) + (0, picocolors_1.gray)('-1')}`,
@@ -132,6 +132,8 @@ class NewGlee extends base_1.default {
132
132
  if (file) {
133
133
  console.log('file running');
134
134
  yield this.handleGenerateProjectWithFile(file, CURRENT_GLEE_TEMPLATE, projectName, forceWrite);
135
+ this.specFile = yield (0, SpecificationFile_1.load)(flags.file);
136
+ this.metricsMetadata.template = flags.template;
135
137
  }
136
138
  else {
137
139
  try {
@@ -162,6 +164,8 @@ class NewGlee extends base_1.default {
162
164
  catch (err) {
163
165
  this.error(`Unable to create the project. Please check the following message for further info about the error:\n\n${err}`);
164
166
  }
167
+ this.specFile = yield (0, SpecificationFile_1.load)(`${GLEE_TEMPLATES_DIRECTORY}/asyncapi.yaml`);
168
+ this.metricsMetadata.template = flags.template;
165
169
  }
166
170
  });
167
171
  }
@@ -170,24 +174,4 @@ exports.default = NewGlee;
170
174
  NewGlee.description = 'Creates a new Glee project';
171
175
  NewGlee.successMessage = exports.successMessage;
172
176
  NewGlee.errorMessages = errorMessages;
173
- NewGlee.flags = {
174
- help: core_1.Flags.help({ char: 'h' }),
175
- name: core_1.Flags.string({
176
- char: 'n',
177
- description: 'Name of the Project',
178
- default: 'project',
179
- }),
180
- template: core_1.Flags.string({
181
- char: 't',
182
- description: 'Name of the Template',
183
- default: 'default',
184
- }),
185
- file: core_1.Flags.string({
186
- char: 'f',
187
- description: 'The path to the AsyncAPI file for generating a Glee project.',
188
- }),
189
- 'force-write': core_1.Flags.boolean({
190
- default: false,
191
- description: 'Force writing of the generated files to given directory even if it is a git repo with unstaged files or not empty dir (defaults to false)',
192
- }),
193
- };
177
+ NewGlee.flags = (0, glee_flags_1.gleeFlags)();
@@ -1,4 +1,4 @@
1
- import Command from '../base';
1
+ import Command from '../core/base';
2
2
  import { Parser } from '@asyncapi/parser';
3
3
  export declare enum Optimizations {
4
4
  REMOVE_COMPONENTS = "remove-components",
@@ -4,13 +4,14 @@ exports.Outputs = exports.Optimizations = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const core_1 = require("@oclif/core");
6
6
  const optimizer_1 = require("@asyncapi/optimizer");
7
- const base_1 = tslib_1.__importDefault(require("../base"));
8
- const validation_error_1 = require("../errors/validation-error");
9
- const SpecificationFile_1 = require("../models/SpecificationFile");
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
10
  const inquirer = tslib_1.__importStar(require("inquirer"));
11
11
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
12
12
  const fs_1 = require("fs");
13
13
  const parser_1 = require("@asyncapi/parser");
14
+ const optimize_flags_1 = require("../core/flags/optimize.flags");
14
15
  const { writeFile } = fs_1.promises;
15
16
  var Optimizations;
16
17
  (function (Optimizations) {
@@ -195,12 +196,7 @@ Optimize.examples = [
195
196
  'asyncapi optimize ./asyncapi.yaml --optimization=remove-components --optimization=reuse-components --optimization=move-all-to-components --no-tty',
196
197
  'asyncapi optimize ./asyncapi.yaml --optimization=remove-components --output=terminal --no-tty',
197
198
  ];
198
- Optimize.flags = {
199
- help: core_1.Flags.help({ char: 'h' }),
200
- optimization: core_1.Flags.string({ char: 'p', default: Object.values(Optimizations), options: Object.values(Optimizations), multiple: true, description: 'select the type of optimizations that you want to apply.' }),
201
- output: core_1.Flags.string({ char: 'o', default: Outputs.TERMINAL, options: Object.values(Outputs), description: 'select where you want the output.' }),
202
- 'no-tty': core_1.Flags.boolean({ description: 'do not use an interactive terminal', default: false }),
203
- };
199
+ Optimize.flags = (0, optimize_flags_1.optimizeFlags)();
204
200
  Optimize.args = {
205
201
  'spec-file': core_1.Args.string({ description: 'spec path, url, or context-name', required: false }),
206
202
  };
@@ -1,4 +1,4 @@
1
- import Command from '../../base';
1
+ import Command from '../../core/base';
2
2
  export default class Start extends Command {
3
3
  static description: string;
4
4
  run(): Promise<void>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const base_1 = tslib_1.__importDefault(require("../../base"));
4
+ const base_1 = tslib_1.__importDefault(require("../../core/base"));
5
5
  const core_1 = require("@oclif/core");
6
6
  class Start extends base_1.default {
7
7
  run() {
@@ -12,4 +12,4 @@ class Start extends base_1.default {
12
12
  }
13
13
  }
14
14
  exports.default = Start;
15
- Start.description = 'Start asyncapi studio';
15
+ Start.description = '';
@@ -1,4 +1,4 @@
1
- import Command from '../../base';
1
+ import Command from '../../core/base';
2
2
  export default class StartStudio extends Command {
3
3
  static description: string;
4
4
  static flags: {
@@ -1,24 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const core_1 = require("@oclif/core");
5
- const base_1 = tslib_1.__importDefault(require("../../base"));
6
- const Studio_1 = require("../../models/Studio");
7
- const SpecificationFile_1 = require("../../models/SpecificationFile");
4
+ const base_1 = tslib_1.__importDefault(require("../../core/base"));
5
+ const Studio_1 = require("../../core/models/Studio");
6
+ const SpecificationFile_1 = require("../../core/models/SpecificationFile");
7
+ const studio_flags_1 = require("../../core/flags/start/studio.flags");
8
8
  class StartStudio extends base_1.default {
9
9
  run() {
10
10
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
11
  const { flags } = yield this.parse(StartStudio);
12
12
  const filePath = flags.file || (yield (0, SpecificationFile_1.load)()).getFilePath();
13
13
  const port = flags.port;
14
+ this.specFile = yield (0, SpecificationFile_1.load)(filePath);
15
+ this.metricsMetadata.port = port;
14
16
  (0, Studio_1.start)(filePath, port);
15
17
  });
16
18
  }
17
19
  }
18
20
  exports.default = StartStudio;
19
21
  StartStudio.description = 'starts a new local instance of Studio';
20
- StartStudio.flags = {
21
- help: core_1.Flags.help({ char: 'h' }),
22
- file: core_1.Flags.string({ char: 'f', description: 'path to the AsyncAPI file to link with Studio' }),
23
- port: core_1.Flags.integer({ char: 'p', description: 'port in which to start Studio' }),
24
- };
22
+ StartStudio.flags = (0, studio_flags_1.studioFlags)();
@@ -1,4 +1,4 @@
1
- import Command from '../base';
1
+ import Command from '../core/base';
2
2
  export default class Validate extends Command {
3
3
  static description: string;
4
4
  static flags: {
@@ -2,11 +2,11 @@
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 base_1 = tslib_1.__importDefault(require("../base"));
6
- const parser_1 = require("../parser");
7
- const SpecificationFile_1 = require("../models/SpecificationFile");
8
- const globals_1 = require("../globals");
9
- const flags_1 = require("../flags");
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
10
  class Validate extends base_1.default {
11
11
  run() {
12
12
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
@@ -27,7 +27,7 @@ class Validate extends base_1.default {
27
27
  }
28
28
  exports.default = Validate;
29
29
  Validate.description = 'validate asyncapi file';
30
- Validate.flags = Object.assign({ help: core_1.Flags.help({ char: 'h' }), watch: (0, flags_1.watchFlag)() }, (0, parser_1.validationFlags)());
30
+ Validate.flags = (0, validate_flags_1.validateFlags)();
31
31
  Validate.args = {
32
32
  'spec-file': core_1.Args.string({ description: 'spec path, url, or context-name', required: false }),
33
33
  };
@@ -1,7 +1,7 @@
1
1
  import { Command } from '@oclif/core';
2
2
  import { MetricMetadata, Recorder } from '@smoya/asyncapi-adoption-metrics';
3
3
  import { Parser } from '@asyncapi/parser';
4
- import { Specification } from 'models/SpecificationFile';
4
+ import { Specification } from './models/SpecificationFile';
5
5
  export default abstract class extends Command {
6
6
  recorder: Promise<Recorder>;
7
7
  parser: Parser;
@@ -0,0 +1,7 @@
1
+ export declare const bundleFlags: () => {
2
+ help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
3
+ output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
4
+ base: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
5
+ baseDir: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
6
+ xOrigin: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
+ };
@@ -0,0 +1,14 @@
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;
@@ -0,0 +1,6 @@
1
+ export declare const analyticsFlags: () => {
2
+ help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
3
+ disable: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
4
+ enable: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
5
+ status: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.analyticsFlags = void 0;
4
+ const core_1 = require("@oclif/core");
5
+ const analyticsFlags = () => {
6
+ return {
7
+ help: core_1.Flags.help({ char: 'h' }),
8
+ disable: core_1.Flags.boolean({ char: 'd', description: 'disable analytics', default: false }),
9
+ enable: core_1.Flags.boolean({ char: 'e', description: 'enable analytics', default: false }),
10
+ status: core_1.Flags.boolean({ char: 's', description: 'show current status of analytics' }),
11
+ };
12
+ };
13
+ exports.analyticsFlags = analyticsFlags;
@@ -0,0 +1,4 @@
1
+ export declare const addFlags: () => {
2
+ help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
3
+ 'set-current': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
4
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addFlags = void 0;
4
+ const core_1 = require("@oclif/core");
5
+ const addFlags = () => {
6
+ return {
7
+ help: core_1.Flags.help({ char: 'h' }),
8
+ 'set-current': core_1.Flags.boolean({
9
+ char: 's',
10
+ description: 'Set context being added as the current context',
11
+ default: false,
12
+ required: false,
13
+ })
14
+ };
15
+ };
16
+ exports.addFlags = addFlags;
@@ -0,0 +1,5 @@
1
+ export declare const convertFlags: (latestVersion: string) => {
2
+ help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
3
+ output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
4
+ 'target-version': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
5
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertFlags = void 0;
4
+ const core_1 = require("@oclif/core");
5
+ const convertFlags = (latestVersion) => {
6
+ return {
7
+ help: core_1.Flags.help({ char: 'h' }),
8
+ output: core_1.Flags.string({ char: 'o', description: 'path to the file where the result is saved' }),
9
+ 'target-version': core_1.Flags.string({ char: 't', description: 'asyncapi version to convert to', default: latestVersion })
10
+ };
11
+ };
12
+ exports.convertFlags = convertFlags;
@@ -0,0 +1,12 @@
1
+ export declare const diffFlags: () => {
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<"error" | "warn" | "info" | "hint", import("@oclif/core/lib/interfaces").CustomOptions>;
5
+ help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
6
+ format: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
7
+ type: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
8
+ markdownSubtype: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
9
+ overrides: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
10
+ 'no-error': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
+ watch: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
+ };
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.diffFlags = void 0;
4
+ const core_1 = require("@oclif/core");
5
+ const parser_1 = require("../parser");
6
+ const global_flags_1 = require("./global.flags");
7
+ const diffFlags = () => {
8
+ return Object.assign({ help: core_1.Flags.help({ char: 'h' }), format: core_1.Flags.string({
9
+ char: 'f',
10
+ description: 'format of the output',
11
+ default: 'yaml',
12
+ options: ['json', 'yaml', 'yml', 'md'],
13
+ }), type: core_1.Flags.string({
14
+ char: 't',
15
+ description: 'type of the output',
16
+ default: 'all',
17
+ options: ['breaking', 'non-breaking', 'unclassified', 'all'],
18
+ }), markdownSubtype: core_1.Flags.string({
19
+ description: 'the format of changes made to AsyncAPI document. It works only when diff is generated using md type. For example, when you specify subtype as json, then diff information in markdown is dumped as json structure.',
20
+ default: undefined,
21
+ options: ['json', 'yaml', 'yml']
22
+ }), overrides: core_1.Flags.string({
23
+ char: 'o',
24
+ description: 'path to JSON file containing the override properties',
25
+ }), 'no-error': core_1.Flags.boolean({
26
+ description: 'don\'t show error on breaking changes',
27
+ }), watch: (0, global_flags_1.watchFlag)() }, (0, parser_1.validationFlags)({ logDiagnostics: false }));
28
+ };
29
+ exports.diffFlags = diffFlags;
@@ -0,0 +1,16 @@
1
+ export declare const fromTemplateFlags: () => {
2
+ help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
3
+ 'disable-hook': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
4
+ 'no-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
5
+ install: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
+ debug: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
+ 'no-overwrite': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
8
+ output: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
+ 'force-write': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
+ watch: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
+ param: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
12
+ 'map-base-url': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
13
+ 'registry-url': import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
14
+ 'registry-auth': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
15
+ 'registry-token': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
16
+ };