@commercelayer/cli-plugin-provisioning 2.0.0-oclif3.9 → 2.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -171,13 +171,13 @@ Retrieve a resource or list a set of resources.
|
|
|
171
171
|
|
|
172
172
|
```sh-session
|
|
173
173
|
USAGE
|
|
174
|
-
$ commercelayer provisioning:fetch RESOURCE PATH [ID] [-i <value>] [-f <value>] [-u -j] [-l curl|node [--doc
|
|
175
|
-
[--curl ] [--node ] [-H ] [-Y ] [-e <value> | ] [-w <value>] [-p <value>] [-n <value>] [-s <value>]
|
|
174
|
+
$ commercelayer provisioning:fetch RESOURCE... PATH... [ID...] [-i <value>] [-f <value>] [-u -j] [-l curl|node [--doc
|
|
175
|
+
| -R]] [--curl ] [--node ] [-H ] [-Y ] [-e <value> | ] [-w <value>] [-p <value>] [-n <value>] [-s <value>]
|
|
176
176
|
|
|
177
177
|
ARGUMENTS
|
|
178
|
-
RESOURCE the resource type
|
|
179
|
-
PATH path (or URL) of the resource(s) to fetch
|
|
180
|
-
ID resource id
|
|
178
|
+
RESOURCE... the resource type
|
|
179
|
+
PATH... path (or URL) of the resource(s) to fetch
|
|
180
|
+
ID... resource id
|
|
181
181
|
|
|
182
182
|
FLAGS
|
|
183
183
|
-H, --headers show response headers
|
|
@@ -227,12 +227,12 @@ Retrieve a resource or list a set of resources.
|
|
|
227
227
|
|
|
228
228
|
```sh-session
|
|
229
229
|
USAGE
|
|
230
|
-
$ commercelayer provisioning:get RESOURCE [ID] [-i <value>] [-f <value>] [-u -j] [-l curl|node [--doc | -R]]
|
|
231
|
-
] [--node ] [-H ] [-Y ] [-e <value> | ] [-w <value>] [-p <value>] [-n <value>] [-s <value>]
|
|
230
|
+
$ commercelayer provisioning:get RESOURCE... [ID...] [-i <value>] [-f <value>] [-u -j] [-l curl|node [--doc | -R]]
|
|
231
|
+
[--curl ] [--node ] [-H ] [-Y ] [-e <value> | ] [-w <value>] [-p <value>] [-n <value>] [-s <value>]
|
|
232
232
|
|
|
233
233
|
ARGUMENTS
|
|
234
|
-
RESOURCE the resource type
|
|
235
|
-
ID id of the resource to retrieve
|
|
234
|
+
RESOURCE... the resource type
|
|
235
|
+
ID... id of the resource to retrieve
|
|
236
236
|
|
|
237
237
|
FLAGS
|
|
238
238
|
-H, --headers show response headers
|
package/bin/run.js
CHANGED
|
@@ -57,7 +57,7 @@ class ProvisioningCreate extends base_1.default {
|
|
|
57
57
|
// Raw request
|
|
58
58
|
if (flags.data) {
|
|
59
59
|
try {
|
|
60
|
-
const baseUrl = cli_core_1.clApi.baseURL(undefined, flags.domain
|
|
60
|
+
const baseUrl = cli_core_1.clApi.baseURL('provisioning', undefined, flags.domain);
|
|
61
61
|
const accessToken = flags.accessToken;
|
|
62
62
|
const rawRes = await cli_core_1.clApi.request.raw({ operation: cli_core_1.clApi.Operation.Create, baseUrl, accessToken, resource: resource.api }, cli_core_1.clApi.request.readDataFile(flags.data));
|
|
63
63
|
const out = flags.raw ? rawRes : cli_core_1.clApi.response.denormalize(rawRes);
|
|
@@ -66,7 +66,7 @@ class ProvisioningUpdate extends base_1.default {
|
|
|
66
66
|
// Raw request
|
|
67
67
|
if (flags.data) {
|
|
68
68
|
try {
|
|
69
|
-
const baseUrl = cli_core_1.clApi.baseURL(undefined, flags.domain
|
|
69
|
+
const baseUrl = cli_core_1.clApi.baseURL('provisioning', undefined, flags.domain);
|
|
70
70
|
const accessToken = flags.accessToken;
|
|
71
71
|
const rawRes = await cli_core_1.clApi.request.raw({ operation: cli_core_1.clApi.Operation.Update, baseUrl, accessToken, resource: resource.api }, cli_core_1.clApi.request.readDataFile(flags.data), id);
|
|
72
72
|
const out = flags.raw ? rawRes : cli_core_1.clApi.response.denormalize(rawRes);
|
package/lib/lang/request.js
CHANGED
|
@@ -17,18 +17,18 @@ const addRequestReader = (cl, interrupt = true) => {
|
|
|
17
17
|
function requestInterceptor(request) {
|
|
18
18
|
const c = request;
|
|
19
19
|
const x = reader.request;
|
|
20
|
-
x.path = c.url
|
|
21
|
-
x.method = c.method || '
|
|
22
|
-
x.headers = c.headers;
|
|
23
|
-
x.params = c.
|
|
24
|
-
x.baseUrl = c.
|
|
25
|
-
x.data = c.
|
|
20
|
+
x.path = c.url.pathname;
|
|
21
|
+
x.method = c.options.method || 'GET';
|
|
22
|
+
x.headers = c.options.headers;
|
|
23
|
+
x.params = c.url.searchParams;
|
|
24
|
+
x.baseUrl = `${c.url.protocol}//${c.url.hostname}`;
|
|
25
|
+
x.data = c.options.body;
|
|
26
26
|
if (interrupt)
|
|
27
27
|
throw new RequestInterrupted();
|
|
28
28
|
return request;
|
|
29
29
|
}
|
|
30
|
-
const interceptor = cl.addRequestInterceptor(requestInterceptor);
|
|
31
|
-
reader.id = interceptor
|
|
30
|
+
/* const interceptor = */ cl.addRequestInterceptor(requestInterceptor);
|
|
31
|
+
reader.id = 1; // interceptor
|
|
32
32
|
return reader;
|
|
33
33
|
};
|
|
34
34
|
exports.addRequestReader = addRequestReader;
|
|
@@ -41,7 +41,7 @@ const getMethod = (request) => {
|
|
|
41
41
|
};
|
|
42
42
|
exports.getMethod = getMethod;
|
|
43
43
|
const getFullUrl = (request) => {
|
|
44
|
-
let fullUrl = `${request.baseUrl}
|
|
44
|
+
let fullUrl = `${request.baseUrl}${request.path}`;
|
|
45
45
|
if (request.params && (Object.keys(request.params).length > 0)) {
|
|
46
46
|
const qs = Object.entries(request.params).map(([k, v]) => `${k}=${v}`).join('&');
|
|
47
47
|
fullUrl += `?${qs}`;
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercelayer/cli-plugin-provisioning",
|
|
3
3
|
"description": "Commerce Layer CLI Provisioning plugin",
|
|
4
|
-
"version": "2.0.0-
|
|
4
|
+
"version": "2.0.0-rc.1",
|
|
5
5
|
"author": "Pierluigi Viti <pierluigi@commercelayer.io>",
|
|
6
6
|
"homepage": "https://github.com/commercelayer/commercelayer-cli-plugin-provisioning",
|
|
7
7
|
"repository": "commercelayer/commercelayer-cli-plugin-provisioning",
|
|
8
8
|
"bugs": "https://github.com/commercelayer/commercelayer-cli-plugin-provisioning/issues",
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": ">=20
|
|
10
|
+
"node": ">=20"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"/bin/run.*",
|
|
@@ -49,37 +49,37 @@
|
|
|
49
49
|
"test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
|
|
50
50
|
"posttest": "eslint . --ext .ts --config .eslintrc",
|
|
51
51
|
"readme": "cl-cli-dev readme --plugin --bin=commercelayer && git add README.md",
|
|
52
|
-
"resources": "pnpm update @commercelayer/provisioning-sdk &&
|
|
52
|
+
"resources": "pnpm update @commercelayer/provisioning-sdk && tsx src/util/resources/build.ts",
|
|
53
53
|
"lint": "eslint src --ext .ts --config .eslintrc",
|
|
54
54
|
"lint:fix": "eslint src --fix"
|
|
55
55
|
},
|
|
56
56
|
"types": "lib/index.d.ts",
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@commercelayer/cli-dev": "beta",
|
|
59
|
-
"@commercelayer/eslint-config-ts": "^1.
|
|
60
|
-
"@oclif/plugin-help": "^6.0.
|
|
61
|
-
"@oclif/test": "^3.2.
|
|
59
|
+
"@commercelayer/eslint-config-ts": "^1.4.5",
|
|
60
|
+
"@oclif/plugin-help": "^6.0.20",
|
|
61
|
+
"@oclif/test": "^3.2.9",
|
|
62
62
|
"@semantic-release/changelog": "^6.0.3",
|
|
63
63
|
"@semantic-release/git": "^10.0.1",
|
|
64
|
-
"@types/chai": "^4.3.
|
|
64
|
+
"@types/chai": "^4.3.14",
|
|
65
65
|
"@types/inquirer": "^8.2.10",
|
|
66
66
|
"@types/mocha": "^10.0.6",
|
|
67
|
-
"@types/node": "^20.
|
|
67
|
+
"@types/node": "^20.12.7",
|
|
68
68
|
"chai": "^4.4.1",
|
|
69
69
|
"eslint": "^8.57.0",
|
|
70
|
-
"mocha": "^10.
|
|
70
|
+
"mocha": "^10.4.0",
|
|
71
71
|
"nyc": "^15.1.0",
|
|
72
|
-
"oclif": "^4.
|
|
73
|
-
"semantic-release": "^23.0.
|
|
74
|
-
"
|
|
75
|
-
"typescript": "^5.4.
|
|
72
|
+
"oclif": "^4.8.0",
|
|
73
|
+
"semantic-release": "^23.0.8",
|
|
74
|
+
"tsx": "^4.7.2",
|
|
75
|
+
"typescript": "^5.4.5"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@commercelayer/cli-core": "beta",
|
|
79
|
-
"@commercelayer/provisioning-sdk": "
|
|
80
|
-
"@oclif/core": "^3.
|
|
79
|
+
"@commercelayer/provisioning-sdk": "2.0.0-beta.16",
|
|
80
|
+
"@oclif/core": "^3.26.2",
|
|
81
81
|
"inquirer": "^8.2.6",
|
|
82
|
-
"json-2-csv": "^5.5.
|
|
82
|
+
"json-2-csv": "^5.5.1",
|
|
83
83
|
"tslib": "^2.6.2"
|
|
84
84
|
},
|
|
85
85
|
"publishConfig": {
|