@commercelayer/cli-plugin-provisioning 1.0.0
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/LICENSE +21 -0
- package/README.md +413 -0
- package/bin/dev +18 -0
- package/bin/dev.cmd +3 -0
- package/bin/run +5 -0
- package/bin/run.cmd +3 -0
- package/lib/base.d.ts +59 -0
- package/lib/base.js +496 -0
- package/lib/commands/provisioning/create.d.ts +21 -0
- package/lib/commands/provisioning/create.js +137 -0
- package/lib/commands/provisioning/delete.d.ts +20 -0
- package/lib/commands/provisioning/delete.js +52 -0
- package/lib/commands/provisioning/exec.d.ts +15 -0
- package/lib/commands/provisioning/exec.js +55 -0
- package/lib/commands/provisioning/fetch.d.ts +28 -0
- package/lib/commands/provisioning/fetch.js +57 -0
- package/lib/commands/provisioning/get.d.ts +27 -0
- package/lib/commands/provisioning/get.js +31 -0
- package/lib/commands/provisioning/list.d.ts +22 -0
- package/lib/commands/provisioning/list.js +137 -0
- package/lib/commands/provisioning/noc.d.ts +6 -0
- package/lib/commands/provisioning/noc.js +13 -0
- package/lib/commands/provisioning/relationship.d.ts +30 -0
- package/lib/commands/provisioning/relationship.js +114 -0
- package/lib/commands/provisioning/resources.d.ts +11 -0
- package/lib/commands/provisioning/resources.js +36 -0
- package/lib/commands/provisioning/retrieve.d.ts +21 -0
- package/lib/commands/provisioning/retrieve.js +95 -0
- package/lib/commands/provisioning/update.d.ts +26 -0
- package/lib/commands/provisioning/update.js +157 -0
- package/lib/csv.d.ts +3 -0
- package/lib/csv.js +98 -0
- package/lib/output.d.ts +5 -0
- package/lib/output.js +15 -0
- package/lib/util/resources/available.d.ts +35 -0
- package/lib/util/resources/available.js +13 -0
- package/lib/util/resources/build.d.ts +1 -0
- package/lib/util/resources/build.js +47 -0
- package/lib/util/resources/index.d.ts +12 -0
- package/lib/util/resources/index.js +19 -0
- package/oclif.manifest.json +1502 -0
- package/package.json +86 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [2022] [Commerce Layer]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
# @commercelayer/cli-plugin-provisioning
|
|
2
|
+
|
|
3
|
+
Commerce Layer CLI Provisioning plugin
|
|
4
|
+
|
|
5
|
+
[](https://oclif.io)
|
|
6
|
+
[](https://npmjs.org/package/@commercelayer/cli-plugin-provisioning)
|
|
7
|
+
[](https://npmjs.org/package/@commercelayer/cli-plugin-provisioning)
|
|
8
|
+
[](https://github.com/@commercelayer/cli-plugin-provisioning/blob/master/package.json)
|
|
9
|
+
|
|
10
|
+
<!-- toc -->
|
|
11
|
+
|
|
12
|
+
* [Usage](#usage)
|
|
13
|
+
* [Commands](#commands)
|
|
14
|
+
<!-- tocstop -->
|
|
15
|
+
## Usage
|
|
16
|
+
<!-- usage -->
|
|
17
|
+
|
|
18
|
+
```sh-session
|
|
19
|
+
commercelayer COMMAND
|
|
20
|
+
|
|
21
|
+
commercelayer [COMMAND] (--help | -h) for detailed information about plugin commands.
|
|
22
|
+
```
|
|
23
|
+
<!-- usagestop -->
|
|
24
|
+
## Commands
|
|
25
|
+
<!-- commands -->
|
|
26
|
+
|
|
27
|
+
* [`commercelayer provisioning:create RESOURCE`](#commercelayer-provisioningcreate-resource)
|
|
28
|
+
* [`commercelayer provisioning:delete RESOURCE [ID]`](#commercelayer-provisioningdelete-resource-id)
|
|
29
|
+
* [`commercelayer provisioning:exec RESOURCE [ID] [ACTION]`](#commercelayer-provisioningexec-resource-id-action)
|
|
30
|
+
* [`commercelayer provisioning:fetch PATH [ID]`](#commercelayer-provisioningfetch-path-id)
|
|
31
|
+
* [`commercelayer provisioning:get RESOURCE [ID]`](#commercelayer-provisioningget-resource-id)
|
|
32
|
+
* [`commercelayer provisioning:list RESOURCE`](#commercelayer-provisioninglist-resource)
|
|
33
|
+
* [`commercelayer provisioning:resources`](#commercelayer-provisioningresources)
|
|
34
|
+
* [`commercelayer provisioning:retrieve RESOURCE [ID]`](#commercelayer-provisioningretrieve-resource-id)
|
|
35
|
+
* [`commercelayer provisioning:update RESOURCE [ID]`](#commercelayer-provisioningupdate-resource-id)
|
|
36
|
+
|
|
37
|
+
### `commercelayer provisioning:create RESOURCE`
|
|
38
|
+
|
|
39
|
+
Create a new resource.
|
|
40
|
+
|
|
41
|
+
```sh-session
|
|
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> | ]
|
|
45
|
+
|
|
46
|
+
ARGUMENTS
|
|
47
|
+
RESOURCE the resource type
|
|
48
|
+
|
|
49
|
+
FLAGS
|
|
50
|
+
-D, --data=<value> the data file to use as request body
|
|
51
|
+
-H, --headers show response headers
|
|
52
|
+
-O, --object=<value>... define a resource object attribute
|
|
53
|
+
-R, --raw print out the raw API response
|
|
54
|
+
-Y, --headers-only show only response headers
|
|
55
|
+
-a, --attribute=<value>... define a resource attribute
|
|
56
|
+
-f, --fields=<value>... comma separeted list of fields in the format [resourceType/]field1,field2...
|
|
57
|
+
-i, --include=<value>... comma separated resources to include
|
|
58
|
+
-j, --json convert output in standard JSON format
|
|
59
|
+
-m, --metadata=<value>... define a metadata attribute or a set of metadata attributes
|
|
60
|
+
-r, --relationship=<value>... define a relationship with another resource
|
|
61
|
+
-u, --unformatted print unformatted JSON output
|
|
62
|
+
|
|
63
|
+
DESCRIPTION
|
|
64
|
+
create a new resource
|
|
65
|
+
|
|
66
|
+
ALIASES
|
|
67
|
+
$ commercelayer prov:create
|
|
68
|
+
$ commercelayer pc
|
|
69
|
+
$ commercelayer pcreate
|
|
70
|
+
|
|
71
|
+
EXAMPLES
|
|
72
|
+
$ commercelayer provisioning:create organizations -a name=MyOrg
|
|
73
|
+
|
|
74
|
+
$ clayer prov:create subscriptions -r plan=plans/<planId>
|
|
75
|
+
|
|
76
|
+
$ cl prov:create organization -a name=MyOrg -m meta_key="meta value"
|
|
77
|
+
|
|
78
|
+
$ cl pc roles -D /path/to/data/file/data.json
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
_See code: [src/commands/provisioning/create.ts](https://github.com/commercelayer/commercelayer-cli-plugin-provisioning/blob/main/src/commands/provisioning/create.ts)_
|
|
82
|
+
|
|
83
|
+
### `commercelayer provisioning:delete RESOURCE [ID]`
|
|
84
|
+
|
|
85
|
+
Delete an existing resource.
|
|
86
|
+
|
|
87
|
+
```sh-session
|
|
88
|
+
USAGE
|
|
89
|
+
$ commercelayer provisioning:delete RESOURCE [ID] [-i <value>] [-f <value>] [-u -j] [-H -R] [-Y ]
|
|
90
|
+
|
|
91
|
+
ARGUMENTS
|
|
92
|
+
RESOURCE the resource type
|
|
93
|
+
ID id of the resource to delete
|
|
94
|
+
|
|
95
|
+
FLAGS
|
|
96
|
+
-H, --headers show response headers
|
|
97
|
+
-R, --raw print out the raw API response
|
|
98
|
+
-Y, --headers-only show only response headers
|
|
99
|
+
-f, --fields=<value>... comma separeted list of fields in the format [resourceType/]field1,field2...
|
|
100
|
+
-i, --include=<value>... comma separated resources to include
|
|
101
|
+
-j, --json convert output in standard JSON format
|
|
102
|
+
-u, --unformatted print unformatted JSON output
|
|
103
|
+
|
|
104
|
+
DESCRIPTION
|
|
105
|
+
delete an existing resource
|
|
106
|
+
|
|
107
|
+
ALIASES
|
|
108
|
+
$ commercelayer prov:delete
|
|
109
|
+
$ commercelayer pd
|
|
110
|
+
$ commercelayer pdelete
|
|
111
|
+
$ commercelayer pdel
|
|
112
|
+
|
|
113
|
+
EXAMPLES
|
|
114
|
+
$ commercelayer provisioning:delete api_credentials/<id>
|
|
115
|
+
|
|
116
|
+
$ cl prov:delete api_credentials <id>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
_See code: [src/commands/provisioning/delete.ts](https://github.com/commercelayer/commercelayer-cli-plugin-provisioning/blob/main/src/commands/provisioning/delete.ts)_
|
|
120
|
+
|
|
121
|
+
### `commercelayer provisioning:exec RESOURCE [ID] [ACTION]`
|
|
122
|
+
|
|
123
|
+
Execute an action on a resource.
|
|
124
|
+
|
|
125
|
+
```sh-session
|
|
126
|
+
USAGE
|
|
127
|
+
$ commercelayer provisioning:exec RESOURCE [ID] [ACTION] [-a <value>]
|
|
128
|
+
|
|
129
|
+
ARGUMENTS
|
|
130
|
+
RESOURCE the resource type
|
|
131
|
+
ID id of the resource on which to execute the action
|
|
132
|
+
ACTION action to execute on resource
|
|
133
|
+
|
|
134
|
+
FLAGS
|
|
135
|
+
-a, --attribute=<value>... define a resource attribute
|
|
136
|
+
|
|
137
|
+
DESCRIPTION
|
|
138
|
+
execute an action on a resource
|
|
139
|
+
|
|
140
|
+
ALIASES
|
|
141
|
+
$ commercelayer prov:exec
|
|
142
|
+
$ commercelayer pe
|
|
143
|
+
$ commercelayer pexec
|
|
144
|
+
|
|
145
|
+
EXAMPLES
|
|
146
|
+
$ commercelayer provisioning:exec organizations <organizationId> transfer_ownership
|
|
147
|
+
|
|
148
|
+
$ cl prov:exec memberships <membershipId> resend
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
_See code: [src/commands/provisioning/exec.ts](https://github.com/commercelayer/commercelayer-cli-plugin-provisioning/blob/main/src/commands/provisioning/exec.ts)_
|
|
152
|
+
|
|
153
|
+
### `commercelayer provisioning:fetch PATH [ID]`
|
|
154
|
+
|
|
155
|
+
Retrieve a resource or list a set of resources.
|
|
156
|
+
|
|
157
|
+
```sh-session
|
|
158
|
+
USAGE
|
|
159
|
+
$ commercelayer provisioning:fetch PATH [ID] [-i <value>] [-f <value>] [-u -j] [-H -R] [-Y ] [-e <value> | ] [-w
|
|
160
|
+
<value>] [-p <value>] [-n <value>] [-s <value>]
|
|
161
|
+
|
|
162
|
+
ARGUMENTS
|
|
163
|
+
PATH path (or URL) of the resource(s) to fetch
|
|
164
|
+
ID resource id
|
|
165
|
+
|
|
166
|
+
FLAGS
|
|
167
|
+
-H, --headers show response headers
|
|
168
|
+
-R, --raw print out the raw API response
|
|
169
|
+
-Y, --headers-only show only response headers
|
|
170
|
+
-e, --extract=<value>... extract subfields from object attributes
|
|
171
|
+
-f, --fields=<value>... comma separeted list of fields in the format [resourceType/]field1,field2...
|
|
172
|
+
-i, --include=<value>... comma separated resources to include
|
|
173
|
+
-j, --json convert output in standard JSON format
|
|
174
|
+
-n, --pageSize=<value> number of elements per page
|
|
175
|
+
-p, --page=<value> page number
|
|
176
|
+
-s, --sort=<value>... defines results ordering
|
|
177
|
+
-u, --unformatted print unformatted JSON output
|
|
178
|
+
-w, --where=<value>... comma separated list of query filters
|
|
179
|
+
|
|
180
|
+
DESCRIPTION
|
|
181
|
+
retrieve a resource or list a set of resources
|
|
182
|
+
|
|
183
|
+
ALIASES
|
|
184
|
+
$ commercelayer prov:fetch
|
|
185
|
+
$ commercelayer pf
|
|
186
|
+
|
|
187
|
+
EXAMPLES
|
|
188
|
+
$ commercelayer provisioning:fetch roles
|
|
189
|
+
|
|
190
|
+
$ commercelayer prov:fetch roles
|
|
191
|
+
|
|
192
|
+
$ clayer prov:fetch roles/<roleId>
|
|
193
|
+
|
|
194
|
+
$ cl prov:fetch roles/<roleId>/<roleRelationship>
|
|
195
|
+
|
|
196
|
+
$ cl pf roles/{roleId}/permissions aBcdEkYWx
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
_See code: [src/commands/provisioning/fetch.ts](https://github.com/commercelayer/commercelayer-cli-plugin-provisioning/blob/main/src/commands/provisioning/fetch.ts)_
|
|
200
|
+
|
|
201
|
+
### `commercelayer provisioning:get RESOURCE [ID]`
|
|
202
|
+
|
|
203
|
+
Retrieve a resource or list a set of resources.
|
|
204
|
+
|
|
205
|
+
```sh-session
|
|
206
|
+
USAGE
|
|
207
|
+
$ commercelayer provisioning:get RESOURCE [ID] [-i <value>] [-f <value>] [-u -j] [-H -R] [-Y ] [-w <value>] [-p
|
|
208
|
+
<value>] [-n <value>] [-s <value>] [-e <value> | ]
|
|
209
|
+
|
|
210
|
+
ARGUMENTS
|
|
211
|
+
RESOURCE the resource type
|
|
212
|
+
ID id of the resource to retrieve
|
|
213
|
+
|
|
214
|
+
FLAGS
|
|
215
|
+
-H, --headers show response headers
|
|
216
|
+
-R, --raw print out the raw API response
|
|
217
|
+
-Y, --headers-only show only response headers
|
|
218
|
+
-e, --extract=<value>... extract subfields from object attributes
|
|
219
|
+
-f, --fields=<value>... comma separeted list of fields in the format [resourceType/]field1,field2...
|
|
220
|
+
-i, --include=<value>... comma separated resources to include
|
|
221
|
+
-j, --json convert output in standard JSON format
|
|
222
|
+
-n, --pageSize=<value> number of elements per page
|
|
223
|
+
-p, --page=<value> page number
|
|
224
|
+
-s, --sort=<value>... defines results ordering
|
|
225
|
+
-u, --unformatted print unformatted JSON output
|
|
226
|
+
-w, --where=<value>... comma separated list of query filters
|
|
227
|
+
|
|
228
|
+
DESCRIPTION
|
|
229
|
+
retrieve a resource or list a set of resources
|
|
230
|
+
|
|
231
|
+
ALIASES
|
|
232
|
+
$ commercelayer prov:get
|
|
233
|
+
$ commercelayer pg
|
|
234
|
+
$ commercelayer pget
|
|
235
|
+
|
|
236
|
+
EXAMPLES
|
|
237
|
+
$ commercelayer provisioning:get roles
|
|
238
|
+
|
|
239
|
+
$ commercelayer prov:get roles
|
|
240
|
+
|
|
241
|
+
$ clayer prov:get roles/<roleId>
|
|
242
|
+
|
|
243
|
+
$ cl prov:get roles <roleId>
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
_See code: [src/commands/provisioning/get.ts](https://github.com/commercelayer/commercelayer-cli-plugin-provisioning/blob/main/src/commands/provisioning/get.ts)_
|
|
247
|
+
|
|
248
|
+
### `commercelayer provisioning:list RESOURCE`
|
|
249
|
+
|
|
250
|
+
Fetch a collection of resources.
|
|
251
|
+
|
|
252
|
+
```sh-session
|
|
253
|
+
USAGE
|
|
254
|
+
$ commercelayer provisioning:list RESOURCE [-i <value>] [-f <value>] [-u -j] [-H -R] [-Y ] [-w <value>] [-p <value>]
|
|
255
|
+
[-n <value>] [-s <value>] [-e <value> | ]
|
|
256
|
+
|
|
257
|
+
ARGUMENTS
|
|
258
|
+
RESOURCE the resource type
|
|
259
|
+
|
|
260
|
+
FLAGS
|
|
261
|
+
-H, --headers show response headers
|
|
262
|
+
-R, --raw print out the raw API response
|
|
263
|
+
-Y, --headers-only show only response headers
|
|
264
|
+
-e, --extract=<value>... extract subfields from object attributes
|
|
265
|
+
-f, --fields=<value>... comma separeted list of fields in the format [resourceType/]field1,field2...
|
|
266
|
+
-i, --include=<value>... comma separated resources to include
|
|
267
|
+
-j, --json convert output in standard JSON format
|
|
268
|
+
-n, --pageSize=<value> number of elements per page
|
|
269
|
+
-p, --page=<value> page number
|
|
270
|
+
-s, --sort=<value>... defines results ordering
|
|
271
|
+
-u, --unformatted print unformatted JSON output
|
|
272
|
+
-w, --where=<value>... comma separated list of query filters
|
|
273
|
+
|
|
274
|
+
DESCRIPTION
|
|
275
|
+
fetch a collection of resources
|
|
276
|
+
|
|
277
|
+
ALIASES
|
|
278
|
+
$ commercelayer pl
|
|
279
|
+
$ commercelayer prov:list
|
|
280
|
+
$ commercelayer plist
|
|
281
|
+
$ commercelayer pls
|
|
282
|
+
|
|
283
|
+
EXAMPLES
|
|
284
|
+
$ commercelayer provisioning:list roles -f id,name -i organization -s updated_at
|
|
285
|
+
|
|
286
|
+
$ cl prov:list roles -i organization -f name -f organizations/name -w organization_name_eq="ORG NAME"
|
|
287
|
+
|
|
288
|
+
$ cl prov:list roles -p 5 -n 10 -s -created_at --raw
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
_See code: [src/commands/provisioning/list.ts](https://github.com/commercelayer/commercelayer-cli-plugin-provisioning/blob/main/src/commands/provisioning/list.ts)_
|
|
292
|
+
|
|
293
|
+
### `commercelayer provisioning:resources`
|
|
294
|
+
|
|
295
|
+
List all the available Provisioning API resources.
|
|
296
|
+
|
|
297
|
+
```sh-session
|
|
298
|
+
USAGE
|
|
299
|
+
$ commercelayer provisioning:resources [-h]
|
|
300
|
+
|
|
301
|
+
FLAGS
|
|
302
|
+
-h, --help Show CLI help.
|
|
303
|
+
|
|
304
|
+
DESCRIPTION
|
|
305
|
+
list all the available Provisioning API resources
|
|
306
|
+
|
|
307
|
+
ALIASES
|
|
308
|
+
$ commercelayer prov:resources
|
|
309
|
+
$ commercelayer pres
|
|
310
|
+
|
|
311
|
+
EXAMPLES
|
|
312
|
+
$ commercelayer provisioning:resources
|
|
313
|
+
|
|
314
|
+
$ cl prov:resources
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
_See code: [src/commands/provisioning/resources.ts](https://github.com/commercelayer/commercelayer-cli-plugin-provisioning/blob/main/src/commands/provisioning/resources.ts)_
|
|
318
|
+
|
|
319
|
+
### `commercelayer provisioning:retrieve RESOURCE [ID]`
|
|
320
|
+
|
|
321
|
+
Fetch a single resource.
|
|
322
|
+
|
|
323
|
+
```sh-session
|
|
324
|
+
USAGE
|
|
325
|
+
$ commercelayer provisioning:retrieve RESOURCE [ID] [-i <value>] [-f <value>] [-u -j] [-H -R] [-Y ] [-e <value> | ]
|
|
326
|
+
|
|
327
|
+
ARGUMENTS
|
|
328
|
+
RESOURCE the resource type
|
|
329
|
+
ID id of the resource to retrieve
|
|
330
|
+
|
|
331
|
+
FLAGS
|
|
332
|
+
-H, --headers show response headers
|
|
333
|
+
-R, --raw print out the raw API response
|
|
334
|
+
-Y, --headers-only show only response headers
|
|
335
|
+
-e, --extract=<value>... extract subfields from object attributes
|
|
336
|
+
-f, --fields=<value>... comma separeted list of fields in the format [resourceType/]field1,field2...
|
|
337
|
+
-i, --include=<value>... comma separated resources to include
|
|
338
|
+
-j, --json convert output in standard JSON format
|
|
339
|
+
-u, --unformatted print unformatted JSON output
|
|
340
|
+
|
|
341
|
+
DESCRIPTION
|
|
342
|
+
fetch a single resource
|
|
343
|
+
|
|
344
|
+
ALIASES
|
|
345
|
+
$ commercelayer prov:retrieve
|
|
346
|
+
$ commercelayer pr
|
|
347
|
+
$ commercelayer pretrieve
|
|
348
|
+
|
|
349
|
+
EXAMPLES
|
|
350
|
+
$ commercelayer provisioning:retrieve roles/<roleId>
|
|
351
|
+
|
|
352
|
+
$ commercelayer prov:retrieve roles <roleId>
|
|
353
|
+
|
|
354
|
+
$ cl prov:retrieve roles <roleId>
|
|
355
|
+
|
|
356
|
+
$ clayer pr roles/<roleId>
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
_See code: [src/commands/provisioning/retrieve.ts](https://github.com/commercelayer/commercelayer-cli-plugin-provisioning/blob/main/src/commands/provisioning/retrieve.ts)_
|
|
360
|
+
|
|
361
|
+
### `commercelayer provisioning:update RESOURCE [ID]`
|
|
362
|
+
|
|
363
|
+
Update an existing resource.
|
|
364
|
+
|
|
365
|
+
```sh-session
|
|
366
|
+
USAGE
|
|
367
|
+
$ commercelayer provisioning:update RESOURCE [ID] [-i <value>] [-f <value>] [-u -j] [-H -R] [-Y ] [-O <value>] [-D
|
|
368
|
+
<value> | -a <value> | -r <value> | [-m <value> | -M <value>] | | ]
|
|
369
|
+
|
|
370
|
+
ARGUMENTS
|
|
371
|
+
RESOURCE the resource type
|
|
372
|
+
ID id of the resource to update
|
|
373
|
+
|
|
374
|
+
FLAGS
|
|
375
|
+
-D, --data=<value> the data file to use as request body
|
|
376
|
+
-H, --headers show response headers
|
|
377
|
+
-M, --metadata-replace=<value>... define a metadata attribute and replace every item already present in the remote
|
|
378
|
+
resource
|
|
379
|
+
-O, --object=<value>... define a resource object attribute
|
|
380
|
+
-R, --raw print out the raw API response
|
|
381
|
+
-Y, --headers-only show only response headers
|
|
382
|
+
-a, --attribute=<value>... define a resource attribute
|
|
383
|
+
-f, --fields=<value>... comma separeted list of fields in the format [resourceType/]field1,field2...
|
|
384
|
+
-i, --include=<value>... comma separated resources to include
|
|
385
|
+
-j, --json convert output in standard JSON format
|
|
386
|
+
-m, --metadata=<value>... define a metadata attribute and merge it with the metadata already present in the
|
|
387
|
+
remote resource
|
|
388
|
+
-r, --relationship=<value>... define a relationship with another resource
|
|
389
|
+
-u, --unformatted print unformatted JSON output
|
|
390
|
+
|
|
391
|
+
DESCRIPTION
|
|
392
|
+
update an existing resource
|
|
393
|
+
|
|
394
|
+
ALIASES
|
|
395
|
+
$ commercelayer prov:update
|
|
396
|
+
$ commercelayer pu
|
|
397
|
+
$ commercelayer pupdate
|
|
398
|
+
$ commercelayer pupd
|
|
399
|
+
|
|
400
|
+
EXAMPLES
|
|
401
|
+
$ commercelayer provisioning:update roles/<roleId> -a reference=referenceId
|
|
402
|
+
|
|
403
|
+
$ commercelayer prov:update roles <roleId> -a reference_origin="Ref Origin"
|
|
404
|
+
|
|
405
|
+
$ cl prov:update roles/<roleId> -m meta_key="meta value"
|
|
406
|
+
|
|
407
|
+
$ cl pu roles <roleId> -M meta_key="metadata overwrite
|
|
408
|
+
|
|
409
|
+
$ clayer prov:update roles <roleId> -D /path/to/data/file/data.json
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
_See code: [src/commands/provisioning/update.ts](https://github.com/commercelayer/commercelayer-cli-plugin-provisioning/blob/main/src/commands/provisioning/update.ts)_
|
|
413
|
+
<!-- commandsstop -->
|
package/bin/dev
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const oclif = require('@oclif/core')
|
|
4
|
+
|
|
5
|
+
const path = require('path')
|
|
6
|
+
const project = path.join(__dirname, '..', 'tsconfig.json')
|
|
7
|
+
|
|
8
|
+
// In dev mode -> use ts-node and dev plugins
|
|
9
|
+
process.env.NODE_ENV = 'development'
|
|
10
|
+
|
|
11
|
+
// eslint-disable-next-line node/no-unpublished-require
|
|
12
|
+
require('ts-node').register({project})
|
|
13
|
+
|
|
14
|
+
// In dev mode, always show stack traces
|
|
15
|
+
oclif.settings.debug = true
|
|
16
|
+
|
|
17
|
+
// Start the CLI
|
|
18
|
+
oclif.run().then(oclif.flush).catch(oclif.Errors.handle)
|
package/bin/dev.cmd
ADDED
package/bin/run
ADDED
package/bin/run.cmd
ADDED
package/lib/base.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Command, Flags, Args, ux as cliux } from '@oclif/core';
|
|
2
|
+
import { type Resource } from './util/resources';
|
|
3
|
+
import { type CommerceLayerProvisioningClient } from '@commercelayer/provisioning-sdk';
|
|
4
|
+
import type { KeyValRel, KeyValObj, KeyValArray, KeyValString, KeyValSort, ResAttributes, KeyVal } from '@commercelayer/cli-core';
|
|
5
|
+
import type { CommandError } from '@oclif/core/lib/interfaces';
|
|
6
|
+
export declare abstract class BaseCommand extends Command {
|
|
7
|
+
static baseFlags: {
|
|
8
|
+
domain: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
9
|
+
accessToken: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
protected checkApplication(accessToken: string, kinds: string[]): boolean;
|
|
12
|
+
checkResourceId(resource: string, resourceId?: string, required?: boolean): {
|
|
13
|
+
res: string;
|
|
14
|
+
id?: string;
|
|
15
|
+
singleton: boolean;
|
|
16
|
+
};
|
|
17
|
+
checkResource(res: string, { required, singular }?: {
|
|
18
|
+
required?: boolean | undefined;
|
|
19
|
+
singular?: boolean | undefined;
|
|
20
|
+
}): Resource;
|
|
21
|
+
protected initCommerceLayer(flags: any, ...options: any[]): CommerceLayerProvisioningClient;
|
|
22
|
+
protected checkOperation(sdk: any, name: string, attributes?: ResAttributes): boolean;
|
|
23
|
+
printOutput(output: any, flags: any | undefined): void;
|
|
24
|
+
printHeaders(headers: any, flags: any): void;
|
|
25
|
+
printError(error: any, flags?: any, args?: any): void;
|
|
26
|
+
_keyvalFlag(flag: string[] | undefined, type?: string): KeyValString;
|
|
27
|
+
attributeFlag(flag: string[] | undefined): ResAttributes;
|
|
28
|
+
}
|
|
29
|
+
export declare abstract class BaseFilterCommand extends BaseCommand {
|
|
30
|
+
static flags: {
|
|
31
|
+
include: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
32
|
+
fields: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
33
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
34
|
+
unformatted: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
35
|
+
raw: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
36
|
+
headers: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
37
|
+
'headers-only': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
38
|
+
};
|
|
39
|
+
init(): Promise<any>;
|
|
40
|
+
catch(error: CommandError): Promise<any>;
|
|
41
|
+
includeFlag(flag: string[] | undefined, relationships?: KeyValRel, force?: boolean): string[];
|
|
42
|
+
objectFlag(flag: string[] | undefined): KeyValObj;
|
|
43
|
+
fieldsFlag(flag: string[] | undefined, type: string): KeyValArray;
|
|
44
|
+
whereFlag(flag: string[] | undefined): KeyValString;
|
|
45
|
+
sortFlag(flag: string[] | undefined): KeyValSort;
|
|
46
|
+
metadataFlag(flag: string[] | undefined, { fixTypes }?: {
|
|
47
|
+
fixTypes?: boolean | undefined;
|
|
48
|
+
}): KeyVal;
|
|
49
|
+
relationshipFlag(flag: string[] | undefined): KeyValRel;
|
|
50
|
+
extractFlag(flag: string[]): KeyValArray;
|
|
51
|
+
extractObjectFields(fields: KeyValArray, obj: any): void;
|
|
52
|
+
saveOutput(output: any, flags: any): void;
|
|
53
|
+
}
|
|
54
|
+
export default abstract class extends BaseFilterCommand {
|
|
55
|
+
static args: {
|
|
56
|
+
resource: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export { Flags, Args, cliux };
|