@asyncapi/cli 2.16.2 → 2.16.3

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.
@@ -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)());
@@ -870,6 +870,22 @@
870
870
  "name": "use-new-generator",
871
871
  "allowNo": false,
872
872
  "type": "boolean"
873
+ },
874
+ "proxyHost": {
875
+ "description": "Name of the ProxyHost",
876
+ "name": "proxyHost",
877
+ "required": false,
878
+ "hasDynamicHelp": false,
879
+ "multiple": false,
880
+ "type": "option"
881
+ },
882
+ "proxyPort": {
883
+ "description": "Port number number for the proxyHost.",
884
+ "name": "proxyPort",
885
+ "required": false,
886
+ "hasDynamicHelp": false,
887
+ "multiple": false,
888
+ "type": "option"
873
889
  }
874
890
  },
875
891
  "hasDynamicHelp": false,
@@ -1187,6 +1203,22 @@
1187
1203
  "hint"
1188
1204
  ],
1189
1205
  "type": "option"
1206
+ },
1207
+ "proxyHost": {
1208
+ "description": "Name of the ProxyHost",
1209
+ "name": "proxyHost",
1210
+ "required": false,
1211
+ "hasDynamicHelp": false,
1212
+ "multiple": false,
1213
+ "type": "option"
1214
+ },
1215
+ "proxyPort": {
1216
+ "description": "Port number number for the proxyHost.",
1217
+ "name": "proxyPort",
1218
+ "required": false,
1219
+ "hasDynamicHelp": false,
1220
+ "multiple": false,
1221
+ "type": "option"
1190
1222
  }
1191
1223
  },
1192
1224
  "hasDynamicHelp": false,
@@ -1769,5 +1801,5 @@
1769
1801
  ]
1770
1802
  }
1771
1803
  },
1772
- "version": "2.16.2"
1804
+ "version": "2.16.3"
1773
1805
  }
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.3",
5
5
  "author": "@asyncapi",
6
6
  "bin": {
7
7
  "asyncapi": "./bin/run_bin"