@commercelayer/cli-plugin-provisioning 2.0.0-oclif3.8 → 2.0.0-rc.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.
package/README.md CHANGED
@@ -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
 
@@ -156,13 +171,13 @@ Retrieve a resource or list a set of resources.
156
171
 
157
172
  ```sh-session
158
173
  USAGE
159
- $ commercelayer provisioning:fetch RESOURCE PATH [ID] [-i <value>] [-f <value>] [-u -j] [-H -R] [-Y ] [-e <value> | ]
160
- [-w <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
- RESOURCE the resource type
164
- PATH path (or URL) of the resource(s) to fetch
165
- ID resource id
178
+ RESOURCE... the resource type
179
+ PATH... path (or URL) of the resource(s) to fetch
180
+ ID... resource id
166
181
 
167
182
  FLAGS
168
183
  -H, --headers show response headers
@@ -178,6 +193,13 @@ FLAGS
178
193
  -u, --unformatted print unformatted JSON output
179
194
  -w, --where=<value>... comma separated list of query filters
180
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
+
181
203
  DESCRIPTION
182
204
  retrieve a resource or list a set of resources
183
205
 
@@ -205,12 +227,12 @@ Retrieve a resource or list a set of resources.
205
227
 
206
228
  ```sh-session
207
229
  USAGE
208
- $ commercelayer provisioning:get RESOURCE [ID] [-i <value>] [-f <value>] [-u -j] [-H -R] [-Y ] [-e <value> | ] [-w
209
- <value>] [-p <value>] [-n <value>] [-s <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>]
210
232
 
211
233
  ARGUMENTS
212
- RESOURCE the resource type
213
- ID id of the resource to retrieve
234
+ RESOURCE... the resource type
235
+ ID... id of the resource to retrieve
214
236
 
215
237
  FLAGS
216
238
  -H, --headers show response headers
@@ -226,6 +248,13 @@ FLAGS
226
248
  -u, --unformatted print unformatted JSON output
227
249
  -w, --where=<value>... comma separated list of query filters
228
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
+
229
258
  DESCRIPTION
230
259
  retrieve a resource or list a set of resources
231
260
 
@@ -252,8 +281,8 @@ Fetch a collection of resources.
252
281
 
253
282
  ```sh-session
254
283
  USAGE
255
- $ commercelayer provisioning:list RESOURCE [-i <value>] [-f <value>] [-u -j] [-H -R] [-Y ] [-w <value>] [-p <value>]
256
- [-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> | ]
257
286
 
258
287
  ARGUMENTS
259
288
  RESOURCE the resource type
@@ -272,6 +301,13 @@ FLAGS
272
301
  -u, --unformatted print unformatted JSON output
273
302
  -w, --where=<value>... comma separated list of query filters
274
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
+
275
311
  DESCRIPTION
276
312
  fetch a collection of resources
277
313
 
@@ -323,7 +359,8 @@ Fetch a single resource.
323
359
 
324
360
  ```sh-session
325
361
  USAGE
326
- $ 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> | ]
327
364
 
328
365
  ARGUMENTS
329
366
  RESOURCE the resource type
@@ -339,6 +376,13 @@ FLAGS
339
376
  -j, --json convert output in standard JSON format
340
377
  -u, --unformatted print unformatted JSON output
341
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
+
342
386
  DESCRIPTION
343
387
  fetch a single resource
344
388
 
@@ -365,8 +409,8 @@ Update an existing resource.
365
409
 
366
410
  ```sh-session
367
411
  USAGE
368
- $ commercelayer provisioning:update RESOURCE [ID] [-i <value>] [-f <value>] [-u -j] [-H -R] [-Y ] [-O <value>] [-D
369
- <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>] | | ]
370
414
 
371
415
  ARGUMENTS
372
416
  RESOURCE the resource type
@@ -389,6 +433,13 @@ FLAGS
389
433
  -r, --relationship=<value>... define a relationship with another resource
390
434
  -u, --unformatted print unformatted JSON output
391
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
+
392
443
  DESCRIPTION
393
444
  update an existing resource
394
445
 
package/bin/run.js CHANGED
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // eslint-disable-next-line unicorn/prefer-top-level-await
4
3
  (async () => {
5
4
  const oclif = await import('@oclif/core')
6
5
  await oclif.execute({development: false, dir: __dirname})
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,6 +34,10 @@ 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
  };
@@ -53,6 +58,8 @@ export declare abstract class BaseFilterCommand extends BaseCommand {
53
58
  extractFlag(flag: string[]): KeyValArray;
54
59
  extractObjectFields(fields: KeyValArray, obj: any): void;
55
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;
56
63
  }
57
64
  export default abstract class extends BaseFilterCommand {
58
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'
@@ -186,36 +186,36 @@ class BaseFilterCommand extends BaseCommand {
186
186
  description: 'print out the raw API response',
187
187
  hidden: false,
188
188
  }),
189
- /*
190
- doc: Flags.boolean({
191
- description: 'show the CLI command in a specific language',
192
- exclusive: ['raw'],
193
- helpGroup: 'documentation',
189
+ doc: core_1.Flags.boolean({
190
+ description: 'show the CLI command in a specific language',
191
+ exclusive: ['raw'],
192
+ helpGroup: 'documentation',
194
193
  }),
195
- lang: Flags.string({
196
- char: 'l',
197
- description: 'show the CLI command in the specified language syntax',
198
- exclusive: availableLanguages,
199
- options: availableLanguages,
200
- dependsOn: ['doc'],
201
- 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',
202
201
  }),
203
- curl: Flags.boolean({
204
- description: `show the equivalent ${languageInfo.curl.label} of the CLI command`,
205
- exclusive: ['lang', ...availableLanguages.filter(l => l !== 'curl')],
206
- parse: async (): Promise<string> => await Promise.resolve('curl'),
207
- hidden: !availableLanguages.includes('curl'),
208
- dependsOn: ['doc'],
209
- 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',
210
209
  }),
211
- node: Flags.boolean({
212
- description: `show the equivalent ${languageInfo.node.label} of the CLI command`,
213
- exclusive: ['lang', ...availableLanguages.filter(l => l !== 'node')],
214
- parse: async (): Promise<string> => await Promise.resolve('node'),
215
- hidden: !availableLanguages.includes('node'),
216
- dependsOn: ['doc'],
217
- 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',
218
217
  }),
218
+ /*
219
219
  [FLAG_SAVE_PARAMS]: Flags.string({
220
220
  description: 'save command data to file for future use',
221
221
  }),
@@ -490,6 +490,24 @@ class BaseFilterCommand extends BaseCommand {
490
490
  this.log();
491
491
  }
492
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
+ }
493
511
  }
494
512
  exports.BaseFilterCommand = BaseFilterCommand;
495
513
  class default_1 extends BaseFilterCommand {
@@ -14,6 +14,10 @@ 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
  };
@@ -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 {
@@ -57,7 +57,7 @@ class ProvisioningCreate extends base_1.default {
57
57
  // Raw request
58
58
  if (flags.data) {
59
59
  try {
60
- const baseUrl = cli_core_1.clApi.baseURL(undefined, flags.domain, true);
60
+ const baseUrl = cli_core_1.clApi.baseURL('provisioning', undefined, flags.domain);
61
61
  const accessToken = flags.accessToken;
62
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));
63
63
  const out = flags.raw ? rawRes : cli_core_1.clApi.response.denormalize(rawRes);
@@ -105,7 +105,7 @@ class ProvisioningCreate extends base_1.default {
105
105
  // Fields flags
106
106
  const fields = this.fieldsFlag(flags.fields, resource.api);
107
107
  const rawReader = flags.raw ? cl.addRawResponseReader({ headers: showHeaders }) : undefined;
108
- // const reqReader = flags.doc ? addRequestReader(cl) : undefined
108
+ const reqReader = flags.doc ? (0, lang_1.addRequestReader)(cl) : undefined;
109
109
  const params = {};
110
110
  try {
111
111
  const resSdk = cl[resource.api];
@@ -129,11 +129,12 @@ class ProvisioningCreate extends base_1.default {
129
129
  return out;
130
130
  }
131
131
  catch (error) {
132
- /*
133
- if (isRequestInterrupted(error) && reqReader) {
134
- await this.showLiveDocumentation(reqReader.request, params, flags)
135
- cl.removeInterceptor('request', reqReader.id)
136
- } 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);
137
138
  }
138
139
  }
139
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,6 +16,10 @@ 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
  };
@@ -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,10 @@ 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
  };
@@ -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';
@@ -83,7 +83,7 @@ class ProvisioningList extends base_1.default {
83
83
  const perPage = flags.pageSize;
84
84
  const cl = this.initCommerceLayer(flags);
85
85
  const rawReader = flags.raw ? cl.addRawResponseReader({ headers: showHeaders }) : undefined;
86
- // const reqReader = flags.doc ? addRequestReader(cl) : undefined
86
+ const reqReader = flags.doc ? (0, lang_1.addRequestReader)(cl) : undefined;
87
87
  const params = {};
88
88
  try {
89
89
  const resSdk = cl[resource.api];
@@ -129,11 +129,12 @@ class ProvisioningList extends base_1.default {
129
129
  return out;
130
130
  }
131
131
  catch (error) {
132
- /*
133
- if (isRequestInterrupted(error) && reqReader) {
134
- await this.showLiveDocumentation(reqReader.request, params, flags)
135
- cl.removeInterceptor('request', reqReader.id)
136
- } 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);
137
138
  }
138
139
  }
139
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
  };
@@ -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 list_1 = tslib_1.__importDefault(require("./list"));
8
8
  const cli_core_1 = require("@commercelayer/cli-core");
@@ -49,7 +49,7 @@ class ResourcesRelationship extends base_1.default {
49
49
  const page = flags.page;
50
50
  const perPage = flags.pageSize;
51
51
  const rawReader = flags.raw ? cl.addRawResponseReader({ headers: showHeaders }) : undefined;
52
- // const reqReader = flags.doc ? addRequestReader(cl) : undefined
52
+ const reqReader = flags.doc ? (0, lang_1.addRequestReader)(cl) : undefined;
53
53
  const params = {};
54
54
  try {
55
55
  if (include && (include.length > 0))
@@ -69,7 +69,8 @@ class ResourcesRelationship extends base_1.default {
69
69
  // const savedParams = this.loadParams(loadParams, resource.api, OPERATION)
70
70
  // if (savedParams) mergeCommandParams(params, savedParams)
71
71
  // }
72
- // if (!flags.doc && multiRel) cliux.action.start(`Fetching ${resource.api.replace(/_/g, ' ')}.${relationship} for id ${id}`)
72
+ if (!flags.doc && multiRel)
73
+ base_1.cliux.action.start(`Fetching ${resource.api.replace(/_/g, ' ')}.${relationship} for id ${id}`);
73
74
  const res = await resSdk[relationship](id, params);
74
75
  if (multiRel)
75
76
  base_1.cliux.action.stop();
@@ -96,10 +97,12 @@ class ResourcesRelationship extends base_1.default {
96
97
  return out;
97
98
  }
98
99
  catch (error) {
99
- /* if (isRequestInterrupted(error) && reqReader) {
100
- await this.showLiveDocumentation(reqReader.request, params, flags)
101
- cl.removeInterceptor('request', reqReader.id)
102
- } else */ this.printError(error, flags, args);
100
+ if ((0, lang_1.isRequestInterrupted)(error) && reqReader) {
101
+ await this.showLiveDocumentation(reqReader.request, params, flags);
102
+ cl.removeInterceptor('request', reqReader.id);
103
+ }
104
+ else
105
+ this.printError(error, flags, args);
103
106
  }
104
107
  }
105
108
  checkRelationship(sdk, name) {
@@ -10,6 +10,10 @@ export default class ProvisioningRetrieve extends Command {
10
10
  json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
11
  unformatted: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
12
  raw: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
+ doc: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
14
+ lang: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
15
+ curl: import("@oclif/core/lib/interfaces").BooleanFlag<string>;
16
+ node: import("@oclif/core/lib/interfaces").BooleanFlag<string>;
13
17
  headers: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
14
18
  'headers-only': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
15
19
  };
@@ -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 OPERATION = 'retrieve';
8
8
  class ProvisioningRetrieve extends base_1.default {
@@ -55,7 +55,7 @@ class ProvisioningRetrieve extends base_1.default {
55
55
  const fields = this.fieldsFlag(flags.fields, resource.api);
56
56
  const cl = this.initCommerceLayer(flags);
57
57
  const rawReader = flags.raw ? cl.addRawResponseReader({ headers: showHeaders }) : undefined;
58
- // const reqReader = flags.doc ? addRequestReader(cl) : undefined
58
+ const reqReader = flags.doc ? (0, lang_1.addRequestReader)(cl) : undefined;
59
59
  const params = {};
60
60
  try {
61
61
  const resSdk = cl[resource.api];
@@ -84,11 +84,12 @@ class ProvisioningRetrieve extends base_1.default {
84
84
  return out;
85
85
  }
86
86
  catch (error) {
87
- /*
88
- if (isRequestInterrupted(error) && reqReader) {
89
- await this.showLiveDocumentation(reqReader.request, params, flags)
90
- cl.removeInterceptor('request', reqReader.id)
91
- } else */ this.printError(error, flags, args);
87
+ if ((0, lang_1.isRequestInterrupted)(error) && reqReader) {
88
+ await this.showLiveDocumentation(reqReader.request, params, flags);
89
+ cl.removeInterceptor('request', reqReader.id);
90
+ }
91
+ else
92
+ this.printError(error, flags, args);
92
93
  }
93
94
  }
94
95
  }
@@ -15,6 +15,10 @@ export default class ProvisioningUpdate 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
  };