@commercelayer/cli-plugin-provisioning 2.0.0-oclif3.7 → 2.0.0-oclif3.9
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 +63 -12
- package/lib/base.d.ts +11 -1
- package/lib/base.js +49 -28
- package/lib/commands/provisioning/create.d.ts +7 -0
- package/lib/commands/provisioning/create.js +11 -7
- package/lib/commands/provisioning/delete.d.ts +4 -0
- package/lib/commands/provisioning/delete.js +8 -7
- package/lib/commands/provisioning/fetch.d.ts +4 -0
- package/lib/commands/provisioning/get.d.ts +4 -0
- package/lib/commands/provisioning/get.js +1 -0
- package/lib/commands/provisioning/list.d.ts +4 -0
- package/lib/commands/provisioning/list.js +8 -7
- package/lib/commands/provisioning/relationship.d.ts +4 -0
- package/lib/commands/provisioning/relationship.js +10 -7
- package/lib/commands/provisioning/retrieve.d.ts +4 -0
- package/lib/commands/provisioning/retrieve.js +8 -7
- package/lib/commands/provisioning/update.d.ts +4 -0
- package/lib/commands/provisioning/update.js +8 -6
- package/lib/lang/curl.d.ts +4 -0
- package/lib/lang/curl.js +17 -0
- package/lib/lang/index.d.ts +19 -0
- package/lib/lang/index.js +51 -0
- package/lib/lang/node.d.ts +4 -0
- package/lib/lang/node.js +26 -0
- package/lib/lang/request.d.ts +32 -0
- package/lib/lang/request.js +108 -0
- package/lib/lang/ruby.d.ts +4 -0
- package/lib/lang/ruby.js +7 -0
- package/oclif.manifest.json +492 -12
- package/package.json +10 -8
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] [-
|
|
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] [-
|
|
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,8 +171,8 @@ 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] [-
|
|
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 | -R]]
|
|
175
|
+
[--curl ] [--node ] [-H ] [-Y ] [-e <value> | ] [-w <value>] [-p <value>] [-n <value>] [-s <value>]
|
|
161
176
|
|
|
162
177
|
ARGUMENTS
|
|
163
178
|
RESOURCE the resource type
|
|
@@ -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,8 +227,8 @@ 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] [-
|
|
209
|
-
<value>] [-
|
|
230
|
+
$ commercelayer provisioning:get RESOURCE [ID] [-i <value>] [-f <value>] [-u -j] [-l curl|node [--doc | -R]] [--curl
|
|
231
|
+
] [--node ] [-H ] [-Y ] [-e <value> | ] [-w <value>] [-p <value>] [-n <value>] [-s <value>]
|
|
210
232
|
|
|
211
233
|
ARGUMENTS
|
|
212
234
|
RESOURCE the resource type
|
|
@@ -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] [-
|
|
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] [-
|
|
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] [-
|
|
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/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
|
-
|
|
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
|
-
|
|
191
|
-
|
|
192
|
-
|
|
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
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
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
|
}),
|
|
@@ -234,7 +234,10 @@ class BaseFilterCommand extends BaseCommand {
|
|
|
234
234
|
description: 'show only response headers',
|
|
235
235
|
dependsOn: ['raw'],
|
|
236
236
|
exclusive: ['headers', 'fields', 'include'],
|
|
237
|
-
})
|
|
237
|
+
})
|
|
238
|
+
};
|
|
239
|
+
static args = {
|
|
240
|
+
...BaseCommand.args
|
|
238
241
|
};
|
|
239
242
|
// INIT (override)
|
|
240
243
|
async init() {
|
|
@@ -487,6 +490,24 @@ class BaseFilterCommand extends BaseCommand {
|
|
|
487
490
|
this.log();
|
|
488
491
|
}
|
|
489
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
|
+
}
|
|
490
511
|
}
|
|
491
512
|
exports.BaseFilterCommand = BaseFilterCommand;
|
|
492
513
|
class default_1 extends BaseFilterCommand {
|
|
@@ -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
|
-
|
|
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 });
|
|
@@ -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
|
-
|
|
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
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
};
|