@asyncapi/cli 2.16.2 → 2.16.4

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.
@@ -14,8 +14,6 @@ export default class Convert extends Command {
14
14
  };
15
15
  static args: {
16
16
  'spec-file': import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
17
- proxyHost: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
18
- proxyPort: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
19
17
  };
20
18
  run(): Promise<void>;
21
19
  private handleConversion;
@@ -129,6 +129,4 @@ Convert.description = 'Convert asyncapi documents older to newer versions or Ope
129
129
  Convert.flags = Object.assign(Object.assign({}, (0, convert_flags_1.convertFlags)(latestVersion)), (0, proxy_flags_1.proxyFlags)());
130
130
  Convert.args = {
131
131
  'spec-file': core_1.Args.string({ description: 'spec path, url, or context-name', required: false }),
132
- proxyHost: core_1.Args.string({ description: 'Name of the Proxy Host', required: false }),
133
- proxyPort: core_1.Args.string({ description: 'Name of the Port of the ProxyHost', required: false }),
134
132
  };
@@ -3,7 +3,9 @@ import { Parser } from '@asyncapi/parser';
3
3
  export default class Template extends Command {
4
4
  static description: string;
5
5
  static examples: string[];
6
- static flags: {
6
+ static readonly flags: {
7
+ proxyHost: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
8
+ proxyPort: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
7
9
  help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
8
10
  'disable-hook': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
9
11
  'no-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
@@ -19,6 +19,7 @@ const prompts_1 = require("@clack/prompts");
19
19
  const picocolors_1 = require("picocolors");
20
20
  const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
21
21
  const fromTemplate_flags_1 = require("../../core/flags/generate/fromTemplate.flags");
22
+ const proxy_flags_1 = require("../../core/flags/proxy.flags");
22
23
  const templatesNotSupportingV3 = {
23
24
  '@asyncapi/minimaltemplate': 'some link',
24
25
  '@asyncapi/dotnet-nats-template': 'https://github.com/asyncapi/dotnet-nats-template/issues/384',
@@ -79,6 +80,7 @@ class Template extends base_1.default {
79
80
  const interactive = !flags['no-interactive'];
80
81
  let { asyncapi, template } = args;
81
82
  let output = flags.output;
83
+ const { proxyPort, proxyHost } = flags;
82
84
  if (interactive) {
83
85
  (0, prompts_1.intro)((0, picocolors_1.inverse)('AsyncAPI Generator'));
84
86
  const parsedArgs = yield this.parseArgs(args, output);
@@ -101,6 +103,10 @@ class Template extends base_1.default {
101
103
  token: flags['registry-token']
102
104
  }
103
105
  };
106
+ if (proxyHost && proxyPort) {
107
+ const proxyUrl = `http://${proxyHost}:${proxyPort}`;
108
+ asyncapi = `${asyncapi}+${proxyUrl}`;
109
+ }
104
110
  const asyncapiInput = (yield (0, SpecificationFile_1.load)(asyncapi)) || (yield (0, SpecificationFile_1.load)());
105
111
  this.specFile = asyncapiInput;
106
112
  this.metricsMetadata.template = template;
@@ -384,7 +390,7 @@ Template.description = 'Generates whatever you want using templates compatible w
384
390
  Template.examples = [
385
391
  'asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template --param version=1.0.0 singleFile=true --output ./docs --force-write'
386
392
  ];
387
- Template.flags = (0, fromTemplate_flags_1.fromTemplateFlags)();
393
+ Template.flags = Object.assign(Object.assign({}, (0, fromTemplate_flags_1.fromTemplateFlags)()), (0, proxy_flags_1.proxyFlags)());
388
394
  Template.args = {
389
395
  asyncapi: core_1.Args.string({ description: '- Local path, url or context-name pointing to AsyncAPI file', required: true }),
390
396
  template: core_1.Args.string({ description: '- Name of the generator template like for example @asyncapi/html-template or https://github.com/asyncapi/html-template', required: true }),
@@ -2,7 +2,10 @@ 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: Record<string, any>;
5
+ static readonly flags: {
6
+ proxyHost: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
7
+ proxyPort: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
8
+ };
6
9
  run(): Promise<void>;
7
10
  private parseArgs;
8
11
  }
@@ -8,12 +8,14 @@ const prompts_1 = require("@clack/prompts");
8
8
  const picocolors_1 = require("picocolors");
9
9
  const modelina_cli_1 = require("@asyncapi/modelina-cli");
10
10
  const models_flags_1 = require("../../core/flags/generate/models.flags");
11
+ const proxy_flags_1 = require("../../core/flags/proxy.flags");
11
12
  class Models extends base_1.default {
12
13
  run() {
13
14
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
14
15
  const { args, flags } = yield this.parse(Models);
15
16
  let { language, file } = args;
16
17
  let { output } = flags;
18
+ const { proxyPort, proxyHost } = flags;
17
19
  const interactive = !flags['no-interactive'];
18
20
  if (!interactive) {
19
21
  (0, prompts_1.intro)((0, picocolors_1.inverse)('AsyncAPI Generate Models'));
@@ -22,6 +24,10 @@ class Models extends base_1.default {
22
24
  file = parsedArgs.file;
23
25
  output = parsedArgs.output;
24
26
  }
27
+ if (proxyHost && proxyPort) {
28
+ const proxyUrl = `http://${proxyHost}:${proxyPort}`;
29
+ file = `${file}+${proxyUrl}`;
30
+ }
25
31
  const inputFile = (yield (0, SpecificationFile_1.load)(file)) || (yield (0, SpecificationFile_1.load)());
26
32
  const { document, diagnostics, status } = yield (0, parser_1.parse)(this, inputFile, flags);
27
33
  if (!document || status === 'invalid') {
@@ -117,4 +123,4 @@ class Models extends base_1.default {
117
123
  exports.default = Models;
118
124
  Models.description = 'Generates typed models';
119
125
  Models.args = modelina_cli_1.ModelinaArgs;
120
- Models.flags = (0, models_flags_1.modelsFlags)();
126
+ Models.flags = Object.assign(Object.assign({}, (0, models_flags_1.modelsFlags)()), (0, proxy_flags_1.proxyFlags)());
@@ -32,8 +32,6 @@ export default class Optimize extends Command {
32
32
  };
33
33
  static args: {
34
34
  'spec-file': import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
35
- proxyHost: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
36
- proxyPort: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
37
35
  };
38
36
  parser: Parser;
39
37
  run(): Promise<void>;
@@ -236,6 +236,4 @@ Optimize.examples = [
236
236
  Optimize.flags = Object.assign(Object.assign({}, (0, optimize_flags_1.optimizeFlags)()), (0, proxy_flags_1.proxyFlags)());
237
237
  Optimize.args = {
238
238
  'spec-file': core_1.Args.string({ description: 'spec path, url, or context-name', required: false }),
239
- proxyHost: core_1.Args.string({ description: 'Name of the Proxy Host', required: false }),
240
- proxyPort: core_1.Args.string({ description: 'Name of the Port of the ProxyHost', required: false }),
241
239
  };
@@ -14,8 +14,6 @@ export default class Validate extends Command {
14
14
  };
15
15
  static args: {
16
16
  'spec-file': import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
17
- proxyHost: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
18
- proxyPort: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
19
17
  };
20
18
  run(): Promise<void>;
21
19
  }
@@ -42,6 +42,4 @@ Validate.description = 'validate asyncapi file';
42
42
  Validate.flags = Object.assign(Object.assign({}, (0, validate_flags_1.validateFlags)()), (0, proxy_flags_1.proxyFlags)());
43
43
  Validate.args = {
44
44
  'spec-file': core_1.Args.string({ description: 'spec path, url, or context-name', required: false }),
45
- proxyHost: core_1.Args.string({ description: 'Name of the Proxy Host', required: false }),
46
- proxyPort: core_1.Args.string({ description: 'Name of the Port of the ProxyHost', required: false }),
47
45
  };
@@ -73,16 +73,6 @@
73
73
  "description": "spec path, url, or context-name",
74
74
  "name": "spec-file",
75
75
  "required": false
76
- },
77
- "proxyHost": {
78
- "description": "Name of the Proxy Host",
79
- "name": "proxyHost",
80
- "required": false
81
- },
82
- "proxyPort": {
83
- "description": "Name of the Port of the ProxyHost",
84
- "name": "proxyPort",
85
- "required": false
86
76
  }
87
77
  },
88
78
  "description": "Convert asyncapi documents older to newer versions or OpenAPI/postman-collection documents to AsyncAPI",
@@ -381,16 +371,6 @@
381
371
  "description": "spec path, url, or context-name",
382
372
  "name": "spec-file",
383
373
  "required": false
384
- },
385
- "proxyHost": {
386
- "description": "Name of the Proxy Host",
387
- "name": "proxyHost",
388
- "required": false
389
- },
390
- "proxyPort": {
391
- "description": "Name of the Port of the ProxyHost",
392
- "name": "proxyPort",
393
- "required": false
394
374
  }
395
375
  },
396
376
  "description": "optimize asyncapi specification file",
@@ -537,16 +517,6 @@
537
517
  "description": "spec path, url, or context-name",
538
518
  "name": "spec-file",
539
519
  "required": false
540
- },
541
- "proxyHost": {
542
- "description": "Name of the Proxy Host",
543
- "name": "proxyHost",
544
- "required": false
545
- },
546
- "proxyPort": {
547
- "description": "Name of the Port of the ProxyHost",
548
- "name": "proxyPort",
549
- "required": false
550
520
  }
551
521
  },
552
522
  "description": "validate asyncapi file",
@@ -870,6 +840,22 @@
870
840
  "name": "use-new-generator",
871
841
  "allowNo": false,
872
842
  "type": "boolean"
843
+ },
844
+ "proxyHost": {
845
+ "description": "Name of the ProxyHost",
846
+ "name": "proxyHost",
847
+ "required": false,
848
+ "hasDynamicHelp": false,
849
+ "multiple": false,
850
+ "type": "option"
851
+ },
852
+ "proxyPort": {
853
+ "description": "Port number number for the proxyHost.",
854
+ "name": "proxyPort",
855
+ "required": false,
856
+ "hasDynamicHelp": false,
857
+ "multiple": false,
858
+ "type": "option"
873
859
  }
874
860
  },
875
861
  "hasDynamicHelp": false,
@@ -1187,6 +1173,22 @@
1187
1173
  "hint"
1188
1174
  ],
1189
1175
  "type": "option"
1176
+ },
1177
+ "proxyHost": {
1178
+ "description": "Name of the ProxyHost",
1179
+ "name": "proxyHost",
1180
+ "required": false,
1181
+ "hasDynamicHelp": false,
1182
+ "multiple": false,
1183
+ "type": "option"
1184
+ },
1185
+ "proxyPort": {
1186
+ "description": "Port number number for the proxyHost.",
1187
+ "name": "proxyPort",
1188
+ "required": false,
1189
+ "hasDynamicHelp": false,
1190
+ "multiple": false,
1191
+ "type": "option"
1190
1192
  }
1191
1193
  },
1192
1194
  "hasDynamicHelp": false,
@@ -1769,5 +1771,5 @@
1769
1771
  ]
1770
1772
  }
1771
1773
  },
1772
- "version": "2.16.2"
1774
+ "version": "2.16.4"
1773
1775
  }
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.16.2",
4
+ "version": "2.16.4",
5
5
  "author": "@asyncapi",
6
6
  "bin": {
7
7
  "asyncapi": "./bin/run_bin"