@commercelayer/cli-plugin-provisioning 2.0.0-oclif3.1 → 2.0.0-oclif3.11

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/README.md CHANGED
@@ -27,7 +27,7 @@ commercelayer [COMMAND] (--help | -h) for detailed information about plugin comm
27
27
  * [`commercelayer provisioning:create RESOURCE`](#commercelayer-provisioningcreate-resource)
28
28
  * [`commercelayer provisioning:delete RESOURCE [ID]`](#commercelayer-provisioningdelete-resource-id)
29
29
  * [`commercelayer provisioning:exec RESOURCE [ID] [ACTION]`](#commercelayer-provisioningexec-resource-id-action)
30
- * [`commercelayer provisioning:fetch PATH [ID]`](#commercelayer-provisioningfetch-path-id)
30
+ * [`commercelayer provisioning:fetch RESOURCE PATH [ID]`](#commercelayer-provisioningfetch-resource-path-id)
31
31
  * [`commercelayer provisioning:get RESOURCE [ID]`](#commercelayer-provisioningget-resource-id)
32
32
  * [`commercelayer provisioning:list RESOURCE`](#commercelayer-provisioninglist-resource)
33
33
  * [`commercelayer provisioning:resources`](#commercelayer-provisioningresources)
@@ -40,8 +40,8 @@ Create a new resource.
40
40
 
41
41
  ```sh-session
42
42
  USAGE
43
- $ commercelayer provisioning:create RESOURCE [-i <value>] [-f <value>] [-u -j] [-H -R] [-Y ] [-O <value>] [-D <value> |
44
- -a <value> | -r <value> | -m <value> | ]
43
+ $ commercelayer provisioning:create RESOURCE [-i <value>] [-f <value>] [-u -j] [-l curl|node [--doc | -R]] [--curl ]
44
+ [--node ] [-H ] [-Y ] [-O <value>] [-D <value> | -a <value> | -r <value> | -m <value> | ]
45
45
 
46
46
  ARGUMENTS
47
47
  RESOURCE the resource type
@@ -60,6 +60,13 @@ FLAGS
60
60
  -r, --relationship=<value>... define a relationship with another resource
61
61
  -u, --unformatted print unformatted JSON output
62
62
 
63
+ DOCUMENTATION FLAGS
64
+ -l, --lang=<option> show the CLI command in the specified language syntax
65
+ <options: curl|node>
66
+ --curl show the equivalent cURL command of the CLI command
67
+ --doc show the CLI command in a specific language
68
+ --node show the equivalent Node SDK source code of the CLI command
69
+
63
70
  DESCRIPTION
64
71
  create a new resource
65
72
 
@@ -86,7 +93,8 @@ Delete an existing resource.
86
93
 
87
94
  ```sh-session
88
95
  USAGE
89
- $ commercelayer provisioning:delete RESOURCE [ID] [-i <value>] [-f <value>] [-u -j] [-H -R] [-Y ]
96
+ $ commercelayer provisioning:delete RESOURCE [ID] [-i <value>] [-f <value>] [-u -j] [-l curl|node [--doc | -R]] [--curl
97
+ ] [--node ] [-H ] [-Y ]
90
98
 
91
99
  ARGUMENTS
92
100
  RESOURCE the resource type
@@ -101,6 +109,13 @@ FLAGS
101
109
  -j, --json convert output in standard JSON format
102
110
  -u, --unformatted print unformatted JSON output
103
111
 
112
+ DOCUMENTATION FLAGS
113
+ -l, --lang=<option> show the CLI command in the specified language syntax
114
+ <options: curl|node>
115
+ --curl show the equivalent cURL command of the CLI command
116
+ --doc show the CLI command in a specific language
117
+ --node show the equivalent Node SDK source code of the CLI command
118
+
104
119
  DESCRIPTION
105
120
  delete an existing resource
106
121
 
@@ -150,18 +165,19 @@ EXAMPLES
150
165
 
151
166
  _See code: [src/commands/provisioning/exec.ts](https://github.com/commercelayer/commercelayer-cli-plugin-provisioning/blob/main/src/commands/provisioning/exec.ts)_
152
167
 
153
- ### `commercelayer provisioning:fetch PATH [ID]`
168
+ ### `commercelayer provisioning:fetch RESOURCE PATH [ID]`
154
169
 
155
170
  Retrieve a resource or list a set of resources.
156
171
 
157
172
  ```sh-session
158
173
  USAGE
159
- $ commercelayer provisioning:fetch PATH [ID] [-i <value>] [-f <value>] [-u -j] [-H -R] [-Y ] [-e <value> | ] [-w
160
- <value>] [-p <value>] [-n <value>] [-s <value>]
174
+ $ commercelayer provisioning:fetch RESOURCE... PATH... [ID...] [-i <value>] [-f <value>] [-u -j] [-l curl|node [--doc
175
+ | -R]] [--curl ] [--node ] [-H ] [-Y ] [-e <value> | ] [-w <value>] [-p <value>] [-n <value>] [-s <value>]
161
176
 
162
177
  ARGUMENTS
163
- PATH path (or URL) of the resource(s) to fetch
164
- ID resource id
178
+ RESOURCE... the resource type
179
+ PATH... path (or URL) of the resource(s) to fetch
180
+ ID... resource id
165
181
 
166
182
  FLAGS
167
183
  -H, --headers show response headers
@@ -177,6 +193,13 @@ FLAGS
177
193
  -u, --unformatted print unformatted JSON output
178
194
  -w, --where=<value>... comma separated list of query filters
179
195
 
196
+ DOCUMENTATION FLAGS
197
+ -l, --lang=<option> show the CLI command in the specified language syntax
198
+ <options: curl|node>
199
+ --curl show the equivalent cURL command of the CLI command
200
+ --doc show the CLI command in a specific language
201
+ --node show the equivalent Node SDK source code of the CLI command
202
+
180
203
  DESCRIPTION
181
204
  retrieve a resource or list a set of resources
182
205
 
@@ -204,12 +227,12 @@ Retrieve a resource or list a set of resources.
204
227
 
205
228
  ```sh-session
206
229
  USAGE
207
- $ commercelayer provisioning:get RESOURCE [ID] [-i <value>] [-f <value>] [-u -j] [-H -R] [-Y ] [-w <value>] [-p
208
- <value>] [-n <value>] [-s <value>] [-e <value> | ]
230
+ $ commercelayer provisioning:get RESOURCE... [ID...] [-i <value>] [-f <value>] [-u -j] [-l curl|node [--doc | -R]]
231
+ [--curl ] [--node ] [-H ] [-Y ] [-e <value> | ] [-w <value>] [-p <value>] [-n <value>] [-s <value>]
209
232
 
210
233
  ARGUMENTS
211
- RESOURCE the resource type
212
- ID id of the resource to retrieve
234
+ RESOURCE... the resource type
235
+ ID... id of the resource to retrieve
213
236
 
214
237
  FLAGS
215
238
  -H, --headers show response headers
@@ -225,6 +248,13 @@ FLAGS
225
248
  -u, --unformatted print unformatted JSON output
226
249
  -w, --where=<value>... comma separated list of query filters
227
250
 
251
+ DOCUMENTATION FLAGS
252
+ -l, --lang=<option> show the CLI command in the specified language syntax
253
+ <options: curl|node>
254
+ --curl show the equivalent cURL command of the CLI command
255
+ --doc show the CLI command in a specific language
256
+ --node show the equivalent Node SDK source code of the CLI command
257
+
228
258
  DESCRIPTION
229
259
  retrieve a resource or list a set of resources
230
260
 
@@ -251,8 +281,8 @@ Fetch a collection of resources.
251
281
 
252
282
  ```sh-session
253
283
  USAGE
254
- $ commercelayer provisioning:list RESOURCE [-i <value>] [-f <value>] [-u -j] [-H -R] [-Y ] [-w <value>] [-p <value>]
255
- [-n <value>] [-s <value>] [-e <value> | ]
284
+ $ commercelayer provisioning:list RESOURCE [-i <value>] [-f <value>] [-u -j] [-l curl|node [--doc | -R]] [--curl ]
285
+ [--node ] [-H ] [-Y ] [-w <value>] [-p <value>] [-n <value>] [-s <value>] [-e <value> | ]
256
286
 
257
287
  ARGUMENTS
258
288
  RESOURCE the resource type
@@ -271,6 +301,13 @@ FLAGS
271
301
  -u, --unformatted print unformatted JSON output
272
302
  -w, --where=<value>... comma separated list of query filters
273
303
 
304
+ DOCUMENTATION FLAGS
305
+ -l, --lang=<option> show the CLI command in the specified language syntax
306
+ <options: curl|node>
307
+ --curl show the equivalent cURL command of the CLI command
308
+ --doc show the CLI command in a specific language
309
+ --node show the equivalent Node SDK source code of the CLI command
310
+
274
311
  DESCRIPTION
275
312
  fetch a collection of resources
276
313
 
@@ -322,7 +359,8 @@ Fetch a single resource.
322
359
 
323
360
  ```sh-session
324
361
  USAGE
325
- $ commercelayer provisioning:retrieve RESOURCE [ID] [-i <value>] [-f <value>] [-u -j] [-H -R] [-Y ] [-e <value> | ]
362
+ $ commercelayer provisioning:retrieve RESOURCE [ID] [-i <value>] [-f <value>] [-u -j] [-l curl|node [--doc | -R]] [--curl
363
+ ] [--node ] [-H ] [-Y ] [-e <value> | ]
326
364
 
327
365
  ARGUMENTS
328
366
  RESOURCE the resource type
@@ -338,6 +376,13 @@ FLAGS
338
376
  -j, --json convert output in standard JSON format
339
377
  -u, --unformatted print unformatted JSON output
340
378
 
379
+ DOCUMENTATION FLAGS
380
+ -l, --lang=<option> show the CLI command in the specified language syntax
381
+ <options: curl|node>
382
+ --curl show the equivalent cURL command of the CLI command
383
+ --doc show the CLI command in a specific language
384
+ --node show the equivalent Node SDK source code of the CLI command
385
+
341
386
  DESCRIPTION
342
387
  fetch a single resource
343
388
 
@@ -364,8 +409,8 @@ Update an existing resource.
364
409
 
365
410
  ```sh-session
366
411
  USAGE
367
- $ commercelayer provisioning:update RESOURCE [ID] [-i <value>] [-f <value>] [-u -j] [-H -R] [-Y ] [-O <value>] [-D
368
- <value> | -a <value> | -r <value> | [-m <value> | -M <value>] | | ]
412
+ $ commercelayer provisioning:update RESOURCE [ID] [-i <value>] [-f <value>] [-u -j] [-l curl|node [--doc | -R]] [--curl
413
+ ] [--node ] [-H ] [-Y ] [-O <value>] [-D <value> | -a <value> | -r <value> | [-m <value> | -M <value>] | | ]
369
414
 
370
415
  ARGUMENTS
371
416
  RESOURCE the resource type
@@ -388,6 +433,13 @@ FLAGS
388
433
  -r, --relationship=<value>... define a relationship with another resource
389
434
  -u, --unformatted print unformatted JSON output
390
435
 
436
+ DOCUMENTATION FLAGS
437
+ -l, --lang=<option> show the CLI command in the specified language syntax
438
+ <options: curl|node>
439
+ --curl show the equivalent cURL command of the CLI command
440
+ --doc show the CLI command in a specific language
441
+ --node show the equivalent Node SDK source code of the CLI command
442
+
391
443
  DESCRIPTION
392
444
  update an existing resource
393
445
 
package/bin/run.js ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+
3
+ // eslint-disable-next-line unicorn/prefer-top-level-await
4
+ (async () => {
5
+ const oclif = await import('@oclif/core')
6
+ await oclif.execute({development: false, dir: __dirname})
7
+ })()
package/lib/base.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Command, Flags, Args, ux as cliux } from '@oclif/core';
2
2
  import { type Resource } from './util/resources';
3
- import { type CommerceLayerProvisioningClient } from '@commercelayer/provisioning-sdk';
3
+ import { type CommerceLayerProvisioningClient, type QueryParams } from '@commercelayer/provisioning-sdk';
4
+ import { type RequestData } from './lang';
4
5
  import type { KeyValRel, KeyValObj, KeyValArray, KeyValString, KeyValSort, ResAttributes, KeyVal } from '@commercelayer/cli-core';
5
6
  import type { CommandError } from '@oclif/core/lib/interfaces';
6
7
  export declare abstract class BaseCommand extends Command {
@@ -33,9 +34,16 @@ export declare abstract class BaseFilterCommand extends BaseCommand {
33
34
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
34
35
  unformatted: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
35
36
  raw: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
37
+ doc: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
38
+ lang: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
39
+ curl: import("@oclif/core/lib/interfaces").BooleanFlag<string>;
40
+ node: import("@oclif/core/lib/interfaces").BooleanFlag<string>;
36
41
  headers: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
37
42
  'headers-only': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
38
43
  };
44
+ static args: {
45
+ [x: string]: import("@oclif/core/lib/interfaces").Arg<any, import("@oclif/core/lib/interfaces").CustomOptions>;
46
+ };
39
47
  init(): Promise<any>;
40
48
  catch(error: CommandError): Promise<any>;
41
49
  includeFlag(flag: string[] | undefined, relationships?: KeyValRel, force?: boolean): string[];
@@ -50,6 +58,8 @@ export declare abstract class BaseFilterCommand extends BaseCommand {
50
58
  extractFlag(flag: string[]): KeyValArray;
51
59
  extractObjectFields(fields: KeyValArray, obj: any): void;
52
60
  saveOutput(output: any, flags: any): void;
61
+ protected showLiveDocumentation(request: RequestData, params?: QueryParams, flags?: any): Promise<string>;
62
+ protected printCommand(lang: string, command: string): void;
53
63
  }
54
64
  export default abstract class extends BaseFilterCommand {
55
65
  static args: {
package/lib/base.js CHANGED
@@ -11,7 +11,7 @@ const output_1 = require("./output");
11
11
  const csv_1 = require("./csv");
12
12
  const fs_1 = require("fs");
13
13
  const provisioning_sdk_1 = tslib_1.__importStar(require("@commercelayer/provisioning-sdk"));
14
- // import { availableLanguages, buildCommand, getLanguageArg, languageInfo, promptLanguage, type RequestData } from './lang'
14
+ const lang_1 = require("./lang");
15
15
  const cli_core_1 = require("@commercelayer/cli-core");
16
16
  // import { aliasExists, checkAlias, type CommandParams, loadCommandData, type ResourceOperation, saveCommandData } from './commands'
17
17
  // import type { ResourceId, ResourceType } from '@commercelayer/provisioning-sdk/lib/cjs/resource'
@@ -161,6 +161,7 @@ class BaseCommand extends core_1.Command {
161
161
  exports.BaseCommand = BaseCommand;
162
162
  class BaseFilterCommand extends BaseCommand {
163
163
  static flags = {
164
+ ...BaseCommand.flags,
164
165
  include: core_1.Flags.string({
165
166
  char: 'i',
166
167
  multiple: true,
@@ -185,36 +186,36 @@ class BaseFilterCommand extends BaseCommand {
185
186
  description: 'print out the raw API response',
186
187
  hidden: false,
187
188
  }),
188
- /*
189
- doc: Flags.boolean({
190
- description: 'show the CLI command in a specific language',
191
- exclusive: ['raw'],
192
- helpGroup: 'documentation',
189
+ doc: core_1.Flags.boolean({
190
+ description: 'show the CLI command in a specific language',
191
+ exclusive: ['raw'],
192
+ helpGroup: 'documentation',
193
193
  }),
194
- lang: Flags.string({
195
- char: 'l',
196
- description: 'show the CLI command in the specified language syntax',
197
- exclusive: availableLanguages,
198
- options: availableLanguages,
199
- dependsOn: ['doc'],
200
- helpGroup: 'documentation',
194
+ lang: core_1.Flags.string({
195
+ char: 'l',
196
+ description: 'show the CLI command in the specified language syntax',
197
+ exclusive: lang_1.availableLanguages,
198
+ options: lang_1.availableLanguages,
199
+ dependsOn: ['doc'],
200
+ helpGroup: 'documentation',
201
201
  }),
202
- curl: Flags.boolean({
203
- description: `show the equivalent ${languageInfo.curl.label} of the CLI command`,
204
- exclusive: ['lang', ...availableLanguages.filter(l => l !== 'curl')],
205
- parse: async (): Promise<string> => await Promise.resolve('curl'),
206
- hidden: !availableLanguages.includes('curl'),
207
- dependsOn: ['doc'],
208
- helpGroup: 'documentation',
202
+ curl: core_1.Flags.boolean({
203
+ description: `show the equivalent ${lang_1.languageInfo.curl.label} of the CLI command`,
204
+ exclusive: ['lang', ...lang_1.availableLanguages.filter(l => l !== 'curl')],
205
+ parse: async () => await Promise.resolve('curl'),
206
+ hidden: !lang_1.availableLanguages.includes('curl'),
207
+ dependsOn: ['doc'],
208
+ helpGroup: 'documentation',
209
209
  }),
210
- node: Flags.boolean({
211
- description: `show the equivalent ${languageInfo.node.label} of the CLI command`,
212
- exclusive: ['lang', ...availableLanguages.filter(l => l !== 'node')],
213
- parse: async (): Promise<string> => await Promise.resolve('node'),
214
- hidden: !availableLanguages.includes('node'),
215
- dependsOn: ['doc'],
216
- helpGroup: 'documentation',
210
+ node: core_1.Flags.boolean({
211
+ description: `show the equivalent ${lang_1.languageInfo.node.label} of the CLI command`,
212
+ exclusive: ['lang', ...lang_1.availableLanguages.filter(l => l !== 'node')],
213
+ parse: async () => await Promise.resolve('node'),
214
+ hidden: !lang_1.availableLanguages.includes('node'),
215
+ dependsOn: ['doc'],
216
+ helpGroup: 'documentation',
217
217
  }),
218
+ /*
218
219
  [FLAG_SAVE_PARAMS]: Flags.string({
219
220
  description: 'save command data to file for future use',
220
221
  }),
@@ -233,7 +234,10 @@ class BaseFilterCommand extends BaseCommand {
233
234
  description: 'show only response headers',
234
235
  dependsOn: ['raw'],
235
236
  exclusive: ['headers', 'fields', 'include'],
236
- }),
237
+ })
238
+ };
239
+ static args = {
240
+ ...BaseCommand.args
237
241
  };
238
242
  // INIT (override)
239
243
  async init() {
@@ -486,10 +490,29 @@ class BaseFilterCommand extends BaseCommand {
486
490
  this.log();
487
491
  }
488
492
  }
493
+ async showLiveDocumentation(request, params, flags) {
494
+ const lang = (0, lang_1.getLanguageArg)(flags) || await (0, lang_1.promptLanguage)();
495
+ const cmd = (0, lang_1.buildCommand)(lang, request, params, flags);
496
+ this.printCommand(lang, cmd);
497
+ return cmd;
498
+ }
499
+ printCommand(lang, command) {
500
+ const header = lang_1.languageInfo[lang].label;
501
+ // const footer = header.replace(/./g, '-')
502
+ this.log();
503
+ this.log(`${cli_core_1.clColor.underline.cyan(header)}`);
504
+ // this.log(chalk.cyan(`------------------------------{ ${header} }------------------------------`))
505
+ this.log();
506
+ this.log(command);
507
+ // this.log()
508
+ // this.log(chalk.cyan(`---------------------------------${footer}---------------------------------`))
509
+ this.log();
510
+ }
489
511
  }
490
512
  exports.BaseFilterCommand = BaseFilterCommand;
491
513
  class default_1 extends BaseFilterCommand {
492
514
  static args = {
515
+ ...BaseFilterCommand.args,
493
516
  resource: core_1.Args.string({ name: 'resource', description: 'the resource type', required: true }),
494
517
  };
495
518
  }
@@ -14,8 +14,15 @@ export default class ProvisioningCreate extends Command {
14
14
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
15
15
  unformatted: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
16
16
  raw: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
17
+ doc: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
18
+ lang: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
19
+ curl: import("@oclif/core/lib/interfaces").BooleanFlag<string>;
20
+ node: import("@oclif/core/lib/interfaces").BooleanFlag<string>;
17
21
  headers: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
18
22
  'headers-only': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
19
23
  };
24
+ static args: {
25
+ resource: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
26
+ };
20
27
  run(): Promise<any>;
21
28
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const base_1 = tslib_1.__importStar(require("../../base"));
5
5
  const cli_core_1 = require("@commercelayer/cli-core");
6
- // import { addRequestReader, isRequestInterrupted } from '../../lang'
6
+ const lang_1 = require("../../lang");
7
7
  // import { mergeCommandParams } from '../../commands'
8
8
  const OPERATION = 'create';
9
9
  class ProvisioningCreate extends base_1.default {
@@ -44,6 +44,9 @@ class ProvisioningCreate extends base_1.default {
44
44
  exclusive: ['attribute', 'relationship', 'metadata', 'doc' /* , FLAG_LOAD_PARAMS, FLAG_SAVE_PARAMS */],
45
45
  })
46
46
  };
47
+ static args = {
48
+ ...base_1.default.args
49
+ };
47
50
  async run() {
48
51
  const { args, flags } = await this.parse(ProvisioningCreate);
49
52
  const resource = this.checkResource(args.resource, { singular: true });
@@ -54,7 +57,7 @@ class ProvisioningCreate extends base_1.default {
54
57
  // Raw request
55
58
  if (flags.data) {
56
59
  try {
57
- const baseUrl = cli_core_1.clApi.baseURL(undefined, flags.domain, true);
60
+ const baseUrl = cli_core_1.clApi.baseURL('provisioning', undefined, flags.domain);
58
61
  const accessToken = flags.accessToken;
59
62
  const rawRes = await cli_core_1.clApi.request.raw({ operation: cli_core_1.clApi.Operation.Create, baseUrl, accessToken, resource: resource.api }, cli_core_1.clApi.request.readDataFile(flags.data));
60
63
  const out = flags.raw ? rawRes : cli_core_1.clApi.response.denormalize(rawRes);
@@ -102,7 +105,7 @@ class ProvisioningCreate extends base_1.default {
102
105
  // Fields flags
103
106
  const fields = this.fieldsFlag(flags.fields, resource.api);
104
107
  const rawReader = flags.raw ? cl.addRawResponseReader({ headers: showHeaders }) : undefined;
105
- // const reqReader = flags.doc ? addRequestReader(cl) : undefined
108
+ const reqReader = flags.doc ? (0, lang_1.addRequestReader)(cl) : undefined;
106
109
  const params = {};
107
110
  try {
108
111
  const resSdk = cl[resource.api];
@@ -126,11 +129,12 @@ class ProvisioningCreate extends base_1.default {
126
129
  return out;
127
130
  }
128
131
  catch (error) {
129
- /*
130
- if (isRequestInterrupted(error) && reqReader) {
131
- await this.showLiveDocumentation(reqReader.request, params, flags)
132
- cl.removeInterceptor('request', reqReader.id)
133
- } else */ this.printError(error);
132
+ if ((0, lang_1.isRequestInterrupted)(error) && reqReader) {
133
+ await this.showLiveDocumentation(reqReader.request, params, flags);
134
+ cl.removeInterceptor('request', reqReader.id);
135
+ }
136
+ else
137
+ this.printError(error);
134
138
  }
135
139
  }
136
140
  }
@@ -9,6 +9,10 @@ export default class ProvisioningDelete extends Command {
9
9
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
10
  unformatted: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
11
  raw: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
+ doc: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
+ lang: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
14
+ curl: import("@oclif/core/lib/interfaces").BooleanFlag<string>;
15
+ node: import("@oclif/core/lib/interfaces").BooleanFlag<string>;
12
16
  headers: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
17
  'headers-only': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
14
18
  };
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const base_1 = tslib_1.__importStar(require("../../base"));
5
- // import { addRequestReader, isRequestInterrupted } from '../../lang'
5
+ const lang_1 = require("../../lang");
6
6
  const cli_core_1 = require("@commercelayer/cli-core");
7
7
  const OPERATION = 'delete';
8
8
  class ProvisioningDelete extends base_1.default {
@@ -31,7 +31,7 @@ class ProvisioningDelete extends base_1.default {
31
31
  const showHeaders = flags.headers || flags['headers-only'];
32
32
  const cl = this.initCommerceLayer(flags);
33
33
  const rawReader = (flags.raw && showHeaders) ? cl.addRawResponseReader({ headers: showHeaders }) : undefined;
34
- // const reqReader = flags.doc ? addRequestReader(cl) : undefined
34
+ const reqReader = flags.doc ? (0, lang_1.addRequestReader)(cl) : undefined;
35
35
  try {
36
36
  const resSdk = cl[resource.api];
37
37
  this.checkOperation(resSdk, OPERATION);
@@ -41,11 +41,12 @@ class ProvisioningDelete extends base_1.default {
41
41
  this.log(`\n${cli_core_1.clColor.style.success('Successfully')} deleted resource of type ${cli_core_1.clColor.style.resource(resource.api)} with id ${cli_core_1.clColor.style.id(id)}\n`);
42
42
  }
43
43
  catch (error) {
44
- /*
45
- if (isRequestInterrupted(error) && reqReader) {
46
- await this.showLiveDocumentation(reqReader.request, undefined, flags)
47
- cl.removeInterceptor('request', reqReader.id)
48
- } else */ this.printError(error, flags, args);
44
+ if ((0, lang_1.isRequestInterrupted)(error) && reqReader) {
45
+ await this.showLiveDocumentation(reqReader.request, undefined, flags);
46
+ cl.removeInterceptor('request', reqReader.id);
47
+ }
48
+ else
49
+ this.printError(error, flags, args);
49
50
  }
50
51
  }
51
52
  }
@@ -16,12 +16,17 @@ export default class ResourcesFetch extends BaseFilterCommand {
16
16
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
17
17
  unformatted: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
18
18
  raw: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
19
+ doc: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
20
+ lang: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
21
+ curl: import("@oclif/core/lib/interfaces").BooleanFlag<string>;
22
+ node: import("@oclif/core/lib/interfaces").BooleanFlag<string>;
19
23
  headers: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
20
24
  'headers-only': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
21
25
  };
22
26
  static args: {
23
27
  path: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
24
28
  id: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
29
+ resource: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
25
30
  };
26
31
  run(): Promise<any>;
27
32
  private fixPath;
@@ -22,6 +22,7 @@ class ResourcesFetch extends base_1.BaseFilterCommand {
22
22
  ...list_1.default.flags,
23
23
  };
24
24
  static args = {
25
+ ...list_1.default.args,
25
26
  path: base_1.Args.string({ name: 'path', description: 'path (or URL) of the resource(s) to fetch', required: true }),
26
27
  id: base_1.Args.string({ name: 'id', description: 'resource id', required: false }),
27
28
  };
@@ -16,6 +16,10 @@ export default class ProvisioningGet extends Command {
16
16
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
17
17
  unformatted: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
18
18
  raw: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
19
+ doc: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
20
+ lang: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
21
+ curl: import("@oclif/core/lib/interfaces").BooleanFlag<string>;
22
+ node: import("@oclif/core/lib/interfaces").BooleanFlag<string>;
19
23
  headers: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
20
24
  'headers-only': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
21
25
  };
@@ -15,6 +15,7 @@ class ProvisioningGet extends base_1.default {
15
15
  ];
16
16
  static strict = false;
17
17
  static flags = {
18
+ ...retrieve_1.default.flags,
18
19
  ...list_1.default.flags,
19
20
  };
20
21
  static args = {
@@ -15,8 +15,15 @@ export default class ProvisioningList extends Command {
15
15
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
16
16
  unformatted: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
17
17
  raw: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
18
+ doc: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
19
+ lang: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
20
+ curl: import("@oclif/core/lib/interfaces").BooleanFlag<string>;
21
+ node: import("@oclif/core/lib/interfaces").BooleanFlag<string>;
18
22
  headers: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
19
23
  'headers-only': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
20
24
  };
25
+ static args: {
26
+ resource: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
27
+ };
21
28
  run(): Promise<any>;
22
29
  }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const base_1 = tslib_1.__importStar(require("../../base"));
5
- // import { addRequestReader, isRequestInterrupted } from '../../lang'
5
+ const lang_1 = require("../../lang");
6
6
  // import { mergeCommandParams } from '../../commands'
7
7
  const cli_core_1 = require("@commercelayer/cli-core");
8
8
  const OPERATION = 'list';
@@ -61,6 +61,9 @@ class ProvisioningList extends base_1.default {
61
61
  hidden: true,
62
62
  }),
63
63
  };
64
+ static args = {
65
+ ...base_1.default.args
66
+ };
64
67
  async run() {
65
68
  const { args, flags } = await this.parse(ProvisioningList);
66
69
  const resource = this.checkResource(args.resource);
@@ -80,7 +83,7 @@ class ProvisioningList extends base_1.default {
80
83
  const perPage = flags.pageSize;
81
84
  const cl = this.initCommerceLayer(flags);
82
85
  const rawReader = flags.raw ? cl.addRawResponseReader({ headers: showHeaders }) : undefined;
83
- // const reqReader = flags.doc ? addRequestReader(cl) : undefined
86
+ const reqReader = flags.doc ? (0, lang_1.addRequestReader)(cl) : undefined;
84
87
  const params = {};
85
88
  try {
86
89
  const resSdk = cl[resource.api];
@@ -126,11 +129,12 @@ class ProvisioningList extends base_1.default {
126
129
  return out;
127
130
  }
128
131
  catch (error) {
129
- /*
130
- if (isRequestInterrupted(error) && reqReader) {
131
- await this.showLiveDocumentation(reqReader.request, params, flags)
132
- cl.removeInterceptor('request', reqReader.id)
133
- } else */ this.printError(error, flags, args);
132
+ if ((0, lang_1.isRequestInterrupted)(error) && reqReader) {
133
+ await this.showLiveDocumentation(reqReader.request, params, flags);
134
+ cl.removeInterceptor('request', reqReader.id);
135
+ }
136
+ else
137
+ this.printError(error, flags, args);
134
138
  }
135
139
  }
136
140
  }
@@ -16,6 +16,10 @@ export default class ResourcesRelationship extends Command {
16
16
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
17
17
  unformatted: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
18
18
  raw: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
19
+ doc: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
20
+ lang: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
21
+ curl: import("@oclif/core/lib/interfaces").BooleanFlag<string>;
22
+ node: import("@oclif/core/lib/interfaces").BooleanFlag<string>;
19
23
  headers: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
20
24
  'headers-only': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
21
25
  };