@commercelayer/cli-plugin-provisioning 1.0.1 → 2.0.0-oclif3.10
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 +68 -16
- package/bin/run.js +7 -0
- package/lib/base.d.ts +16 -6
- package/lib/base.js +115 -92
- package/lib/commands/provisioning/create.d.ts +14 -7
- package/lib/commands/provisioning/create.js +48 -44
- package/lib/commands/provisioning/delete.d.ts +8 -4
- package/lib/commands/provisioning/delete.js +21 -20
- package/lib/commands/provisioning/exec.d.ts +4 -4
- package/lib/commands/provisioning/exec.js +18 -18
- package/lib/commands/provisioning/fetch.d.ts +14 -9
- package/lib/commands/provisioning/fetch.js +19 -18
- package/lib/commands/provisioning/get.d.ts +13 -9
- package/lib/commands/provisioning/get.js +16 -15
- package/lib/commands/provisioning/list.d.ts +14 -7
- package/lib/commands/provisioning/list.js +65 -61
- package/lib/commands/provisioning/noc.js +2 -2
- package/lib/commands/provisioning/relationship.d.ts +14 -10
- package/lib/commands/provisioning/relationship.js +26 -23
- package/lib/commands/provisioning/resources.js +9 -9
- package/lib/commands/provisioning/retrieve.d.ts +9 -5
- package/lib/commands/provisioning/retrieve.js +43 -42
- package/lib/commands/provisioning/update.d.ts +14 -10
- package/lib/commands/provisioning/update.js +57 -55
- 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 +508 -12
- package/package.json +21 -19
- package/bin/dev +0 -18
- package/bin/dev.cmd +0 -3
- package/bin/run +0 -5
|
@@ -4,17 +4,21 @@ export default class ProvisioningDelete extends Command {
|
|
|
4
4
|
static aliases: string[];
|
|
5
5
|
static examples: string[];
|
|
6
6
|
static flags: {
|
|
7
|
-
include: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
8
|
-
fields: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
7
|
+
include: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
fields: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
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
|
};
|
|
15
19
|
static args: {
|
|
16
|
-
id: import("@oclif/core/lib/interfaces
|
|
17
|
-
resource: import("@oclif/core/lib/interfaces
|
|
20
|
+
id: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
21
|
+
resource: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
18
22
|
};
|
|
19
23
|
run(): Promise<any>;
|
|
20
24
|
}
|
|
@@ -2,10 +2,23 @@
|
|
|
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 {
|
|
9
|
+
static description = 'delete an existing resource';
|
|
10
|
+
static aliases = ['prov:delete', 'pd', 'pdelete', 'pdel'];
|
|
11
|
+
static examples = [
|
|
12
|
+
'$ commercelayer provisioning:delete api_credentials/<id>',
|
|
13
|
+
'$ cl prov:delete api_credentials <id>',
|
|
14
|
+
];
|
|
15
|
+
static flags = {
|
|
16
|
+
...(cli_core_1.clCommand.commandFlags(base_1.default.flags, ['save-params', 'load-params']))
|
|
17
|
+
};
|
|
18
|
+
static args = {
|
|
19
|
+
...base_1.default.args,
|
|
20
|
+
id: base_1.Args.string({ name: 'id', description: 'id of the resource to delete', required: false })
|
|
21
|
+
};
|
|
9
22
|
async run() {
|
|
10
23
|
const { args, flags } = await this.parse(ProvisioningDelete);
|
|
11
24
|
const invalidFlags = ['fields', 'include'];
|
|
@@ -18,7 +31,7 @@ class ProvisioningDelete extends base_1.default {
|
|
|
18
31
|
const showHeaders = flags.headers || flags['headers-only'];
|
|
19
32
|
const cl = this.initCommerceLayer(flags);
|
|
20
33
|
const rawReader = (flags.raw && showHeaders) ? cl.addRawResponseReader({ headers: showHeaders }) : undefined;
|
|
21
|
-
|
|
34
|
+
const reqReader = flags.doc ? (0, lang_1.addRequestReader)(cl) : undefined;
|
|
22
35
|
try {
|
|
23
36
|
const resSdk = cl[resource.api];
|
|
24
37
|
this.checkOperation(resSdk, OPERATION);
|
|
@@ -28,25 +41,13 @@ class ProvisioningDelete extends base_1.default {
|
|
|
28
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`);
|
|
29
42
|
}
|
|
30
43
|
catch (error) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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);
|
|
36
50
|
}
|
|
37
51
|
}
|
|
38
52
|
}
|
|
39
|
-
ProvisioningDelete.description = 'delete an existing resource';
|
|
40
|
-
ProvisioningDelete.aliases = ['prov:delete', 'pd', 'pdelete', 'pdel'];
|
|
41
|
-
ProvisioningDelete.examples = [
|
|
42
|
-
'$ commercelayer provisioning:delete api_credentials/<id>',
|
|
43
|
-
'$ cl prov:delete api_credentials <id>',
|
|
44
|
-
];
|
|
45
|
-
ProvisioningDelete.flags = {
|
|
46
|
-
...(cli_core_1.clCommand.commandFlags(base_1.default.flags, ['save-params', 'load-params']))
|
|
47
|
-
};
|
|
48
|
-
ProvisioningDelete.args = {
|
|
49
|
-
...base_1.default.args,
|
|
50
|
-
id: base_1.Args.string({ name: 'id', description: 'id of the resource to delete', required: false })
|
|
51
|
-
};
|
|
52
53
|
exports.default = ProvisioningDelete;
|
|
@@ -4,12 +4,12 @@ export default class ProvisioningExec extends BaseCommand {
|
|
|
4
4
|
static aliases: string[];
|
|
5
5
|
static examples: string[];
|
|
6
6
|
static flags: {
|
|
7
|
-
attribute: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
7
|
+
attribute: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
8
|
};
|
|
9
9
|
static args: {
|
|
10
|
-
id: import("@oclif/core/lib/interfaces
|
|
11
|
-
action: import("@oclif/core/lib/interfaces
|
|
12
|
-
resource: import("@oclif/core/lib/interfaces
|
|
10
|
+
id: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
11
|
+
action: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
12
|
+
resource: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
13
13
|
};
|
|
14
14
|
run(): Promise<void>;
|
|
15
15
|
}
|
|
@@ -4,6 +4,24 @@ 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
|
class ProvisioningExec extends base_1.BaseCommand {
|
|
7
|
+
static description = 'execute an action on a resource';
|
|
8
|
+
static aliases = ['prov:exec', 'pe', 'pexec'];
|
|
9
|
+
static examples = [
|
|
10
|
+
'$ commercelayer provisioning:exec organizations <organizationId> transfer_ownership',
|
|
11
|
+
'$ cl prov:exec memberships <membershipId> resend'
|
|
12
|
+
];
|
|
13
|
+
static flags = {
|
|
14
|
+
attribute: base_1.Flags.string({
|
|
15
|
+
char: 'a',
|
|
16
|
+
description: 'define a resource attribute',
|
|
17
|
+
multiple: true,
|
|
18
|
+
})
|
|
19
|
+
};
|
|
20
|
+
static args = {
|
|
21
|
+
...base_1.default.args,
|
|
22
|
+
id: base_1.Args.string({ name: 'id', description: 'id of the resource on which to execute the action', required: false }),
|
|
23
|
+
action: base_1.Args.string({ name: 'action', description: 'action to execute on resource', required: false })
|
|
24
|
+
};
|
|
7
25
|
async run() {
|
|
8
26
|
const { args, flags } = await this.parse(ProvisioningExec);
|
|
9
27
|
const action = args.action;
|
|
@@ -34,22 +52,4 @@ class ProvisioningExec extends base_1.BaseCommand {
|
|
|
34
52
|
}
|
|
35
53
|
}
|
|
36
54
|
}
|
|
37
|
-
ProvisioningExec.description = 'execute an action on a resource';
|
|
38
|
-
ProvisioningExec.aliases = ['prov:exec', 'pe', 'pexec'];
|
|
39
|
-
ProvisioningExec.examples = [
|
|
40
|
-
'$ commercelayer provisioning:exec organizations <organizationId> transfer_ownership',
|
|
41
|
-
'$ cl prov:exec memberships <membershipId> resend'
|
|
42
|
-
];
|
|
43
|
-
ProvisioningExec.flags = {
|
|
44
|
-
attribute: base_1.Flags.string({
|
|
45
|
-
char: 'a',
|
|
46
|
-
description: 'define a resource attribute',
|
|
47
|
-
multiple: true,
|
|
48
|
-
})
|
|
49
|
-
};
|
|
50
|
-
ProvisioningExec.args = {
|
|
51
|
-
...base_1.default.args,
|
|
52
|
-
id: base_1.Args.string({ name: 'id', description: 'id of the resource on which to execute the action', required: false }),
|
|
53
|
-
action: base_1.Args.string({ name: 'action', description: 'action to execute on resource', required: false })
|
|
54
|
-
};
|
|
55
55
|
exports.default = ProvisioningExec;
|
|
@@ -5,23 +5,28 @@ export default class ResourcesFetch extends BaseFilterCommand {
|
|
|
5
5
|
static examples: string[];
|
|
6
6
|
static strict: boolean;
|
|
7
7
|
static flags: {
|
|
8
|
-
where: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
9
|
-
page: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces
|
|
10
|
-
pageSize: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces
|
|
11
|
-
sort: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
12
|
-
extract: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
8
|
+
where: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
page: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
pageSize: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
sort: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
extract: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
13
|
'force-include': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
-
include: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
15
|
-
fields: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
14
|
+
include: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
+
fields: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
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
|
-
path: import("@oclif/core/lib/interfaces
|
|
24
|
-
id: import("@oclif/core/lib/interfaces
|
|
27
|
+
path: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
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;
|
|
@@ -7,6 +7,25 @@ const list_1 = tslib_1.__importDefault(require("./list"));
|
|
|
7
7
|
const relationship_1 = tslib_1.__importDefault(require("./relationship"));
|
|
8
8
|
const get_1 = tslib_1.__importDefault(require("./get"));
|
|
9
9
|
class ResourcesFetch extends base_1.BaseFilterCommand {
|
|
10
|
+
static description = 'retrieve a resource or list a set of resources';
|
|
11
|
+
static aliases = ['prov:fetch', 'pf'];
|
|
12
|
+
static examples = [
|
|
13
|
+
'$ commercelayer provisioning:fetch roles',
|
|
14
|
+
'$ commercelayer prov:fetch roles',
|
|
15
|
+
'$ clayer prov:fetch roles/<roleId>',
|
|
16
|
+
'$ cl prov:fetch roles/<roleId>/<roleRelationship>',
|
|
17
|
+
'$ cl pf roles/{roleId}/permissions aBcdEkYWx',
|
|
18
|
+
];
|
|
19
|
+
static strict = false;
|
|
20
|
+
static flags = {
|
|
21
|
+
...retrieve_1.default.flags,
|
|
22
|
+
...list_1.default.flags,
|
|
23
|
+
};
|
|
24
|
+
static args = {
|
|
25
|
+
...list_1.default.args,
|
|
26
|
+
path: base_1.Args.string({ name: 'path', description: 'path (or URL) of the resource(s) to fetch', required: true }),
|
|
27
|
+
id: base_1.Args.string({ name: 'id', description: 'resource id', required: false }),
|
|
28
|
+
};
|
|
10
29
|
async run() {
|
|
11
30
|
const { args } = await this.parse(ResourcesFetch);
|
|
12
31
|
const path = this.fixPath(args.path, args);
|
|
@@ -36,22 +55,4 @@ class ResourcesFetch extends base_1.BaseFilterCommand {
|
|
|
36
55
|
return path;
|
|
37
56
|
}
|
|
38
57
|
}
|
|
39
|
-
ResourcesFetch.description = 'retrieve a resource or list a set of resources';
|
|
40
|
-
ResourcesFetch.aliases = ['prov:fetch', 'pf'];
|
|
41
|
-
ResourcesFetch.examples = [
|
|
42
|
-
'$ commercelayer provisioning:fetch roles',
|
|
43
|
-
'$ commercelayer prov:fetch roles',
|
|
44
|
-
'$ clayer prov:fetch roles/<roleId>',
|
|
45
|
-
'$ cl prov:fetch roles/<roleId>/<roleRelationship>',
|
|
46
|
-
'$ cl pf roles/{roleId}/permissions aBcdEkYWx',
|
|
47
|
-
];
|
|
48
|
-
ResourcesFetch.strict = false;
|
|
49
|
-
ResourcesFetch.flags = {
|
|
50
|
-
...retrieve_1.default.flags,
|
|
51
|
-
...list_1.default.flags,
|
|
52
|
-
};
|
|
53
|
-
ResourcesFetch.args = {
|
|
54
|
-
path: base_1.Args.string({ name: 'path', description: 'path (or URL) of the resource(s) to fetch', required: true }),
|
|
55
|
-
id: base_1.Args.string({ name: 'id', description: 'resource id', required: false }),
|
|
56
|
-
};
|
|
57
58
|
exports.default = ResourcesFetch;
|
|
@@ -5,23 +5,27 @@ export default class ProvisioningGet extends Command {
|
|
|
5
5
|
static examples: string[];
|
|
6
6
|
static strict: boolean;
|
|
7
7
|
static flags: {
|
|
8
|
-
where: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
9
|
-
page: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces
|
|
10
|
-
pageSize: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces
|
|
11
|
-
sort: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
12
|
-
extract: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
8
|
+
where: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
page: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
pageSize: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
sort: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
extract: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
13
|
'force-include': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
-
include: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
15
|
-
fields: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
14
|
+
include: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
+
fields: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
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
|
-
id: import("@oclif/core/lib/interfaces
|
|
24
|
-
resource: import("@oclif/core/lib/interfaces
|
|
27
|
+
id: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
28
|
+
resource: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
25
29
|
};
|
|
26
30
|
run(): Promise<any>;
|
|
27
31
|
}
|
|
@@ -5,6 +5,22 @@ const base_1 = tslib_1.__importDefault(require("../../base"));
|
|
|
5
5
|
const retrieve_1 = tslib_1.__importDefault(require("./retrieve"));
|
|
6
6
|
const list_1 = tslib_1.__importDefault(require("./list"));
|
|
7
7
|
class ProvisioningGet extends base_1.default {
|
|
8
|
+
static description = 'retrieve a resource or list a set of resources';
|
|
9
|
+
static aliases = ['prov:get', 'pg', 'pget'];
|
|
10
|
+
static examples = [
|
|
11
|
+
'$ commercelayer provisioning:get roles',
|
|
12
|
+
'$ commercelayer prov:get roles',
|
|
13
|
+
'$ clayer prov:get roles/<roleId>',
|
|
14
|
+
'$ cl prov:get roles <roleId>',
|
|
15
|
+
];
|
|
16
|
+
static strict = false;
|
|
17
|
+
static flags = {
|
|
18
|
+
...retrieve_1.default.flags,
|
|
19
|
+
...list_1.default.flags,
|
|
20
|
+
};
|
|
21
|
+
static args = {
|
|
22
|
+
...retrieve_1.default.args,
|
|
23
|
+
};
|
|
8
24
|
async run() {
|
|
9
25
|
const { args } = await this.parse(ProvisioningGet);
|
|
10
26
|
const { id, singleton } = this.checkResourceId(args.resource, args.id, false);
|
|
@@ -13,19 +29,4 @@ class ProvisioningGet extends base_1.default {
|
|
|
13
29
|
return result;
|
|
14
30
|
}
|
|
15
31
|
}
|
|
16
|
-
ProvisioningGet.description = 'retrieve a resource or list a set of resources';
|
|
17
|
-
ProvisioningGet.aliases = ['prov:get', 'pg', 'pget'];
|
|
18
|
-
ProvisioningGet.examples = [
|
|
19
|
-
'$ commercelayer provisioning:get roles',
|
|
20
|
-
'$ commercelayer prov:get roles',
|
|
21
|
-
'$ clayer prov:get roles/<roleId>',
|
|
22
|
-
'$ cl prov:get roles <roleId>',
|
|
23
|
-
];
|
|
24
|
-
ProvisioningGet.strict = false;
|
|
25
|
-
ProvisioningGet.flags = {
|
|
26
|
-
...list_1.default.flags,
|
|
27
|
-
};
|
|
28
|
-
ProvisioningGet.args = {
|
|
29
|
-
...retrieve_1.default.args,
|
|
30
|
-
};
|
|
31
32
|
exports.default = ProvisioningGet;
|
|
@@ -4,19 +4,26 @@ export default class ProvisioningList extends Command {
|
|
|
4
4
|
static aliases: string[];
|
|
5
5
|
static examples: string[];
|
|
6
6
|
static flags: {
|
|
7
|
-
where: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
8
|
-
page: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces
|
|
9
|
-
pageSize: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces
|
|
10
|
-
sort: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
11
|
-
extract: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
7
|
+
where: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
page: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
pageSize: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
sort: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
extract: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
12
|
'force-include': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
-
include: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
14
|
-
fields: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
13
|
+
include: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
+
fields: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
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,11 +2,68 @@
|
|
|
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';
|
|
9
9
|
class ProvisioningList extends base_1.default {
|
|
10
|
+
static description = 'fetch a collection of resources';
|
|
11
|
+
static aliases = ['pl', 'prov:list', 'plist', 'pls'];
|
|
12
|
+
static examples = [
|
|
13
|
+
'$ commercelayer provisioning:list roles -f id,name -i organization -s updated_at',
|
|
14
|
+
'$ cl prov:list roles -i organization -f name -f organizations/name -w organization_name_eq="ORG NAME"',
|
|
15
|
+
'$ cl prov:list roles -p 5 -n 10 -s -created_at --raw',
|
|
16
|
+
];
|
|
17
|
+
static flags = {
|
|
18
|
+
...base_1.default.flags,
|
|
19
|
+
where: base_1.Flags.string({
|
|
20
|
+
char: 'w',
|
|
21
|
+
multiple: true,
|
|
22
|
+
description: 'comma separated list of query filters',
|
|
23
|
+
}),
|
|
24
|
+
page: base_1.Flags.integer({
|
|
25
|
+
char: 'p',
|
|
26
|
+
description: 'page number',
|
|
27
|
+
}),
|
|
28
|
+
pageSize: base_1.Flags.integer({
|
|
29
|
+
char: 'n',
|
|
30
|
+
description: 'number of elements per page',
|
|
31
|
+
}),
|
|
32
|
+
sort: base_1.Flags.string({
|
|
33
|
+
char: 's',
|
|
34
|
+
description: 'defines results ordering',
|
|
35
|
+
multiple: true,
|
|
36
|
+
}),
|
|
37
|
+
/*
|
|
38
|
+
save: Flags.string({
|
|
39
|
+
char: 'x',
|
|
40
|
+
description: 'save command output to file',
|
|
41
|
+
multiple: false,
|
|
42
|
+
exclusive: ['save-path'],
|
|
43
|
+
}),
|
|
44
|
+
'save-path': Flags.string({
|
|
45
|
+
char: 'X',
|
|
46
|
+
description: 'save command output to file and create missing path directories',
|
|
47
|
+
multiple: false,
|
|
48
|
+
exclusive: ['save'],
|
|
49
|
+
}),
|
|
50
|
+
*/
|
|
51
|
+
extract: base_1.Flags.string({
|
|
52
|
+
char: 'e',
|
|
53
|
+
description: 'extract subfields from object attributes',
|
|
54
|
+
multiple: true,
|
|
55
|
+
exclusive: ['raw'],
|
|
56
|
+
}),
|
|
57
|
+
'force-include': base_1.Flags.boolean({
|
|
58
|
+
char: 'I',
|
|
59
|
+
description: 'force resources inclusion beyound the 3rd level',
|
|
60
|
+
dependsOn: ['include'],
|
|
61
|
+
hidden: true,
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
|
+
static args = {
|
|
65
|
+
...base_1.default.args
|
|
66
|
+
};
|
|
10
67
|
async run() {
|
|
11
68
|
const { args, flags } = await this.parse(ProvisioningList);
|
|
12
69
|
const resource = this.checkResource(args.resource);
|
|
@@ -26,7 +83,7 @@ class ProvisioningList extends base_1.default {
|
|
|
26
83
|
const perPage = flags.pageSize;
|
|
27
84
|
const cl = this.initCommerceLayer(flags);
|
|
28
85
|
const rawReader = flags.raw ? cl.addRawResponseReader({ headers: showHeaders }) : undefined;
|
|
29
|
-
|
|
86
|
+
const reqReader = flags.doc ? (0, lang_1.addRequestReader)(cl) : undefined;
|
|
30
87
|
const params = {};
|
|
31
88
|
try {
|
|
32
89
|
const resSdk = cl[resource.api];
|
|
@@ -72,66 +129,13 @@ class ProvisioningList extends base_1.default {
|
|
|
72
129
|
return out;
|
|
73
130
|
}
|
|
74
131
|
catch (error) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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);
|
|
80
138
|
}
|
|
81
139
|
}
|
|
82
140
|
}
|
|
83
|
-
ProvisioningList.description = 'fetch a collection of resources';
|
|
84
|
-
ProvisioningList.aliases = ['pl', 'prov:list', 'plist', 'pls'];
|
|
85
|
-
ProvisioningList.examples = [
|
|
86
|
-
'$ commercelayer provisioning:list roles -f id,name -i organization -s updated_at',
|
|
87
|
-
'$ cl prov:list roles -i organization -f name -f organizations/name -w organization_name_eq="ORG NAME"',
|
|
88
|
-
'$ cl prov:list roles -p 5 -n 10 -s -created_at --raw',
|
|
89
|
-
];
|
|
90
|
-
ProvisioningList.flags = {
|
|
91
|
-
...base_1.default.flags,
|
|
92
|
-
where: base_1.Flags.string({
|
|
93
|
-
char: 'w',
|
|
94
|
-
multiple: true,
|
|
95
|
-
description: 'comma separated list of query filters',
|
|
96
|
-
}),
|
|
97
|
-
page: base_1.Flags.integer({
|
|
98
|
-
char: 'p',
|
|
99
|
-
description: 'page number',
|
|
100
|
-
}),
|
|
101
|
-
pageSize: base_1.Flags.integer({
|
|
102
|
-
char: 'n',
|
|
103
|
-
description: 'number of elements per page',
|
|
104
|
-
}),
|
|
105
|
-
sort: base_1.Flags.string({
|
|
106
|
-
char: 's',
|
|
107
|
-
description: 'defines results ordering',
|
|
108
|
-
multiple: true,
|
|
109
|
-
}),
|
|
110
|
-
/*
|
|
111
|
-
save: Flags.string({
|
|
112
|
-
char: 'x',
|
|
113
|
-
description: 'save command output to file',
|
|
114
|
-
multiple: false,
|
|
115
|
-
exclusive: ['save-path'],
|
|
116
|
-
}),
|
|
117
|
-
'save-path': Flags.string({
|
|
118
|
-
char: 'X',
|
|
119
|
-
description: 'save command output to file and create missing path directories',
|
|
120
|
-
multiple: false,
|
|
121
|
-
exclusive: ['save'],
|
|
122
|
-
}),
|
|
123
|
-
*/
|
|
124
|
-
extract: base_1.Flags.string({
|
|
125
|
-
char: 'e',
|
|
126
|
-
description: 'extract subfields from object attributes',
|
|
127
|
-
multiple: true,
|
|
128
|
-
exclusive: ['raw'],
|
|
129
|
-
}),
|
|
130
|
-
'force-include': base_1.Flags.boolean({
|
|
131
|
-
char: 'I',
|
|
132
|
-
description: 'force resources inclusion beyound the 3rd level',
|
|
133
|
-
dependsOn: ['include'],
|
|
134
|
-
hidden: true,
|
|
135
|
-
}),
|
|
136
|
-
};
|
|
137
141
|
exports.default = ProvisioningList;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
4
|
class Noc extends core_1.Command {
|
|
5
|
+
static hidden = true;
|
|
6
|
+
static flags = {};
|
|
5
7
|
async run() {
|
|
6
8
|
const output = '-= NoC =-';
|
|
7
9
|
this.log(output);
|
|
8
10
|
return output;
|
|
9
11
|
}
|
|
10
12
|
}
|
|
11
|
-
Noc.hidden = true;
|
|
12
|
-
Noc.flags = {};
|
|
13
13
|
exports.default = Noc;
|
|
@@ -5,24 +5,28 @@ export default class ResourcesRelationship extends Command {
|
|
|
5
5
|
static hidden: boolean;
|
|
6
6
|
static examples: string[];
|
|
7
7
|
static flags: {
|
|
8
|
-
where: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
9
|
-
page: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces
|
|
10
|
-
pageSize: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces
|
|
11
|
-
sort: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
12
|
-
extract: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
8
|
+
where: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
page: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
pageSize: import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
sort: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
extract: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
13
|
'force-include': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
-
include: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
15
|
-
fields: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces
|
|
14
|
+
include: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
+
fields: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
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
|
-
id: import("@oclif/core/lib/interfaces
|
|
24
|
-
relationship: import("@oclif/core/lib/interfaces
|
|
25
|
-
resource: import("@oclif/core/lib/interfaces
|
|
27
|
+
id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
28
|
+
relationship: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
29
|
+
resource: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
26
30
|
};
|
|
27
31
|
run(): Promise<any>;
|
|
28
32
|
private checkRelationship;
|