@commercetools/history-sdk 3.0.0 → 3.2.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/CHANGELOG.md +110 -0
- package/dist/commercetools-history-sdk.browser.cjs.js +19 -46
- package/dist/commercetools-history-sdk.browser.esm.js +19 -46
- package/dist/commercetools-history-sdk.cjs.dev.js +19 -46
- package/dist/commercetools-history-sdk.cjs.prod.js +19 -46
- package/dist/commercetools-history-sdk.esm.js +19 -46
- package/dist/declarations/src/generated/models/change-history.d.ts +5 -5
- package/dist/declarations/src/generated/models/change-value.d.ts +2 -2
- package/dist/declarations/src/generated/models/change.d.ts +1 -1
- package/dist/declarations/src/generated/models/common.d.ts +28 -28
- package/dist/declarations/src/generated/models/label.d.ts +1 -1
- package/dist/declarations/src/generated/shared/utils/common-types.d.ts +5 -5
- package/dist/declarations/src/generated/shared/utils/middleware.d.ts +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,115 @@
|
|
|
1
1
|
# @commercetools/history-sdk
|
|
2
2
|
|
|
3
|
+
## 3.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#371](https://github.com/commercetools/commercetools-sdk-typescript/pull/371) [`f6bd1fe`](https://github.com/commercetools/commercetools-sdk-typescript/commit/f6bd1fe02773974d1e95a50a986e846698a95322) Thanks [@github-actions](https://github.com/apps/github-actions)! - Update generated SDKs
|
|
8
|
+
|
|
9
|
+
#### Summary
|
|
10
|
+
|
|
11
|
+
- The get method of `ByProjectKeyInStoreKeyByStoreKeyProductProjectionsByIDRequestBuilder` class now supports an optional `stage` property
|
|
12
|
+
- [Diff link](packages/platform-sdk/src/generated/client/product-projections/by-project-key-in-store-key-by-store-key-product-projections-by-id-request-builder.ts)
|
|
13
|
+
- The get method of `ByProjectKeyInStoreKeyByStoreKeyProductProjectionsKeyByKeyRequestBuilder` class now supports an optional `stage` property
|
|
14
|
+
- [Diff link](packages/platform-sdk/src/generated/client/product-projections/by-project-key-in-store-key-by-store-key-product-projections-key-by-key-request-builder.ts)
|
|
15
|
+
|
|
16
|
+
#### Snippet
|
|
17
|
+
|
|
18
|
+
```diff
|
|
19
|
+
...
|
|
20
|
+
queryArgs?: {
|
|
21
|
+
+ staged?: boolean
|
|
22
|
+
priceCurrency?: string
|
|
23
|
+
priceCountry?: string
|
|
24
|
+
priceCustomerGroup?: string,
|
|
25
|
+
...
|
|
26
|
+
}
|
|
27
|
+
...
|
|
28
|
+
}) {}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- The `get`, `post` and `delete` method query args. of `ByProjectKeyProductsByIDRequestBuilder` class now supports optional `localeProjection` property
|
|
32
|
+
- [Diff link](packages/platform-sdk/src/generated/client/products/by-project-key-products-by-id-request-builder.ts)
|
|
33
|
+
- The `get` and `post` method query args. of the `ByProjectKeyProductsRequestBuilder` class now supports an optional `localeProjection` property.
|
|
34
|
+
- [Diff link](packages/platform-sdk/src/generated/client/products/by-project-key-products-request-builder.ts)
|
|
35
|
+
|
|
36
|
+
```diff
|
|
37
|
+
...
|
|
38
|
+
queryArgs?: {
|
|
39
|
+
where?: string | string[]
|
|
40
|
+
priceCurrency?: string
|
|
41
|
+
priceCountry?: string
|
|
42
|
+
priceCustomerGroup?: string
|
|
43
|
+
priceChannel?: string
|
|
44
|
+
+ localeProjection?: string | string[]
|
|
45
|
+
expand?: string | string[]
|
|
46
|
+
sort?: string | string[]
|
|
47
|
+
limit?: number
|
|
48
|
+
offset?: number
|
|
49
|
+
withTotal?: boolean
|
|
50
|
+
[key: string]: QueryParam
|
|
51
|
+
}
|
|
52
|
+
...
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The complete changes can be found [here](changes.md)
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- Updated dependencies [[`98d2d7c`](https://github.com/commercetools/commercetools-sdk-typescript/commit/98d2d7ce2abad1d8eb3466f4f3df1b877f144920)]:
|
|
60
|
+
- @commercetools/sdk-client-v2@2.1.1
|
|
61
|
+
|
|
62
|
+
## 3.1.0
|
|
63
|
+
|
|
64
|
+
### Minor Changes
|
|
65
|
+
|
|
66
|
+
- [#351](https://github.com/commercetools/commercetools-sdk-typescript/pull/351) [`9c93a8e`](https://github.com/commercetools/commercetools-sdk-typescript/commit/9c93a8e92b4d523d6661567f7571f115a527b039) Thanks [@ajimae](https://github.com/ajimae)! - Update packages
|
|
67
|
+
|
|
68
|
+
Update the `history-sdk` `DateStringFilter`, `ChangeHistoryResourceType`, `Source` and `PlatformInitiatedChange` etc. models to include a `string` type
|
|
69
|
+
|
|
70
|
+
[Diff](https://github.com/commercetools/commercetools-sdk-typescript/pull/346/files#diff-cc2fe178ca6b6be224a1703faedb4addb5aeaba6e8fed5c5fb8aa83e6b89c15c)
|
|
71
|
+
[Diff](https://github.com/commercetools/commercetools-sdk-typescript/pull/346/files#diff-d209024497a25bf47b1328575261874e3b3838708b200c576e9136881d7c2fc5)
|
|
72
|
+
|
|
73
|
+
Add builder class and method for [`standalone-prices`](https://github.com/commercetools/commercetools-sdk-typescript/pull/346/files#diff-6c227c775a135e83a3177890fb075a57a36aca5e54585ddd12800e2fc8c868d0) for `importapi-sdk`
|
|
74
|
+
|
|
75
|
+
[Diff](https://github.com/commercetools/commercetools-sdk-typescript/pull/346/files#diff-4194831274c991aa860b804aa0e4ef37607f3648ce4b5bd1fa485fb368563414)
|
|
76
|
+
[Diff](https://github.com/commercetools/commercetools-sdk-typescript/pull/346/files#diff-cf4d4d593249abe6c99086f76491a0bd251573cde0f78291d38c12db533955e9)
|
|
77
|
+
[Diff](https://github.com/commercetools/commercetools-sdk-typescript/pull/346/files#diff-9b983bcf9b8f15645d6c0c5395b43046a37915b6269f8f1f0d113c625661b61e)
|
|
78
|
+
[Diff](https://github.com/commercetools/commercetools-sdk-typescript/pull/346/files#diff-cab14530d8df4ee940fea751e4e5afa1b36a94b92ee1360e641f46696fc3f21b)
|
|
79
|
+
|
|
80
|
+
Update the `importapi-sdk` `MoneyType`, `ReferenceType`, `ProcessingState`, `ImportOperationState` `ProductPriceModeEnum` etc models to include a `string` type
|
|
81
|
+
|
|
82
|
+
[Diff](https://github.com/commercetools/commercetools-sdk-typescript/pull/346/files#diff-4a12dd49a3bd4416087368cf7d2adad860849ada79c1744ae27ddae67c299c43)
|
|
83
|
+
[Diff](https://github.com/commercetools/commercetools-sdk-typescript/pull/346/files#diff-098b1027a5d008b85d503e4fbfd1a7ae1c47a138e1d8fb82c7ac9ee1ea94de3f)
|
|
84
|
+
[Diff](https://github.com/commercetools/commercetools-sdk-typescript/pull/346/files#diff-66168b247234ab499100b349ea788dfc0bad6c5275d5cf7541088083cd4ad47f)
|
|
85
|
+
[Diff](https://github.com/commercetools/commercetools-sdk-typescript/pull/346/files#diff-ac6b2ee896a8ab4c39857df35774f59713a50c547a6e7cecfe6924547381cd96)
|
|
86
|
+
|
|
87
|
+
Add class and builder methods for
|
|
88
|
+
`ByProjectKeyBusinessUnitsByIDRequestBuilder`,
|
|
89
|
+
`ByProjectKeyBusinessUnitsRequestBuilder`,
|
|
90
|
+
`ByProjectKeyMeBusinessUnitsKeyByKeyRequestBuilder`,
|
|
91
|
+
`ByProjectKeyMeBusinessUnitsRequestBuilder`,
|
|
92
|
+
`ByProjectKeyBusinessUnitsKeyByKeyRequestBuilder`
|
|
93
|
+
`ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeCustomersRequestBuilder`,
|
|
94
|
+
`ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyMeRequestBuilder`,
|
|
95
|
+
`ByProjectKeyInBusinessUnitKeyByBusinessUnitKeyRequestBuilder`
|
|
96
|
+
in the `platform-sdk`
|
|
97
|
+
|
|
98
|
+
[Diff](https://github.com/commercetools/commercetools-sdk-typescript/pull/346/files#diff-cb753c87b292658be2da42c7548c3ffcad89550d99d5a433bae77b06b1e8dde8)
|
|
99
|
+
[Diff](https://github.com/commercetools/commercetools-sdk-typescript/pull/346/files#diff-61da76483d06d79e65e755f43ce8f1c8b06b62af3dd310cdeac4cac8583c9457)
|
|
100
|
+
[Diff](https://github.com/commercetools/commercetools-sdk-typescript/pull/346/files#diff-427e08314427fc8efa3e4466403eb7ad961482b0ebbfd71a65ad513b1e62d93c)
|
|
101
|
+
[Diff](https://github.com/commercetools/commercetools-sdk-typescript/pull/346/files#diff-f7e56705a0ede866385bed01616ec49604dc9921092e9c8ad8c3dc435c7f7706)
|
|
102
|
+
[Diff](https://github.com/commercetools/commercetools-sdk-typescript/pull/346/files#diff-8104137d8ff7613e73e02d11a26f3086884e2b135467f8c2d56b25e9719781c3)
|
|
103
|
+
[Diff](https://github.com/commercetools/commercetools-sdk-typescript/pull/346/files#diff-d2d796eb7f7a440dba06bc3f71f12fb9ffbfbd0ba86161a7b77eab7a62d89fb4)
|
|
104
|
+
[Diff](https://github.com/commercetools/commercetools-sdk-typescript/pull/346/files#diff-c008d9ee3cd715df487ab0ebb7ce332cf31804ac533a2598e6808bf73f057b9e)
|
|
105
|
+
|
|
106
|
+
Complete changes can be found [here](https://github.com/commercetools/commercetools-sdk-typescript/pull/346/files)
|
|
107
|
+
|
|
108
|
+
### Patch Changes
|
|
109
|
+
|
|
110
|
+
- Updated dependencies [[`f0e84dd`](https://github.com/commercetools/commercetools-sdk-typescript/commit/f0e84ddb2e34b908385a380175c6da596db6817a)]:
|
|
111
|
+
- @commercetools/sdk-client-v2@2.0.1
|
|
112
|
+
|
|
3
113
|
## 3.0.0
|
|
4
114
|
|
|
5
115
|
### Major Changes
|
|
@@ -15,7 +15,6 @@ function _defineProperty(obj, key, value) {
|
|
|
15
15
|
} else {
|
|
16
16
|
obj[key] = value;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
18
|
return obj;
|
|
20
19
|
}
|
|
21
20
|
|
|
@@ -24,56 +23,45 @@ function _defineProperty(obj, key, value) {
|
|
|
24
23
|
* Please don't change this file manually but run `rmf-codegen generate <raml_file_path> -o <output_path> -t typescript_client` to update it.
|
|
25
24
|
* For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
|
|
26
25
|
*/
|
|
27
|
-
|
|
28
26
|
function isDefined(value) {
|
|
29
27
|
return typeof value !== 'undefined' && value !== null;
|
|
30
28
|
}
|
|
31
|
-
|
|
32
29
|
function cleanObject(obj) {
|
|
33
30
|
return Object.keys(obj).reduce((result, key) => {
|
|
34
31
|
const value = obj[key];
|
|
35
|
-
|
|
36
32
|
if (Array.isArray(value)) {
|
|
37
33
|
const values = value.filter(isDefined);
|
|
38
|
-
|
|
39
34
|
if (!values.length) {
|
|
40
35
|
return result;
|
|
41
36
|
}
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
return {
|
|
38
|
+
...result,
|
|
44
39
|
[key]: values
|
|
45
40
|
};
|
|
46
41
|
}
|
|
47
|
-
|
|
48
42
|
if (isDefined(value)) {
|
|
49
|
-
return {
|
|
43
|
+
return {
|
|
44
|
+
...result,
|
|
50
45
|
[key]: value
|
|
51
46
|
};
|
|
52
47
|
}
|
|
53
|
-
|
|
54
48
|
return result;
|
|
55
49
|
}, {});
|
|
56
50
|
}
|
|
57
|
-
|
|
58
51
|
function formatQueryString(variableMap) {
|
|
59
52
|
const map = cleanObject(variableMap);
|
|
60
53
|
const result = querystring.stringify(map);
|
|
61
|
-
|
|
62
54
|
if (result === '') {
|
|
63
55
|
return '';
|
|
64
56
|
}
|
|
65
|
-
|
|
66
57
|
return `?${result}`;
|
|
67
58
|
}
|
|
68
|
-
|
|
69
59
|
function buildRelativeUri(commonRequest) {
|
|
70
60
|
const pathMap = commonRequest.pathVariables;
|
|
71
61
|
var uri = commonRequest.uriTemplate;
|
|
72
|
-
|
|
73
62
|
for (const param in pathMap) {
|
|
74
63
|
uri = uri.replace(`{${param}}`, `${pathMap[param]}`);
|
|
75
64
|
}
|
|
76
|
-
|
|
77
65
|
const resQuery = formatQueryString(commonRequest.queryParams || {});
|
|
78
66
|
return `${uri}${resQuery}`;
|
|
79
67
|
}
|
|
@@ -81,22 +69,18 @@ function buildRelativeUri(commonRequest) {
|
|
|
81
69
|
class ApiRequest {
|
|
82
70
|
constructor(request, requestExecutor) {
|
|
83
71
|
this.requestExecutor = requestExecutor;
|
|
84
|
-
|
|
85
72
|
_defineProperty(this, "request", void 0);
|
|
86
|
-
|
|
87
|
-
|
|
73
|
+
this.request = {
|
|
74
|
+
...request,
|
|
88
75
|
uri: buildRelativeUri(request)
|
|
89
76
|
};
|
|
90
77
|
}
|
|
91
|
-
|
|
92
78
|
clientRequest() {
|
|
93
79
|
return this.request;
|
|
94
80
|
}
|
|
95
|
-
|
|
96
81
|
execute() {
|
|
97
82
|
return this.requestExecutor(this.request);
|
|
98
83
|
}
|
|
99
|
-
|
|
100
84
|
}
|
|
101
85
|
|
|
102
86
|
/**
|
|
@@ -106,24 +90,22 @@ class ApiRequest {
|
|
|
106
90
|
*/
|
|
107
91
|
/**
|
|
108
92
|
**/
|
|
109
|
-
|
|
110
93
|
class ByProjectKeyByResourceTypeByIDRequestBuilder {
|
|
111
94
|
constructor(args) {
|
|
112
95
|
this.args = args;
|
|
113
96
|
}
|
|
114
|
-
|
|
115
97
|
get(methodArgs) {
|
|
116
98
|
return new ApiRequest({
|
|
117
99
|
baseUri: this.args.baseUri,
|
|
118
100
|
method: 'GET',
|
|
119
101
|
uriTemplate: '/{projectKey}/{resourceType}/{ID}',
|
|
120
102
|
pathVariables: this.args.pathArgs,
|
|
121
|
-
headers: {
|
|
103
|
+
headers: {
|
|
104
|
+
...(methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.headers)
|
|
122
105
|
},
|
|
123
106
|
queryParams: methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.queryArgs
|
|
124
107
|
}, this.args.executeRequest);
|
|
125
108
|
}
|
|
126
|
-
|
|
127
109
|
}
|
|
128
110
|
|
|
129
111
|
/**
|
|
@@ -133,34 +115,32 @@ class ByProjectKeyByResourceTypeByIDRequestBuilder {
|
|
|
133
115
|
*/
|
|
134
116
|
/**
|
|
135
117
|
**/
|
|
136
|
-
|
|
137
118
|
class ByProjectKeyByResourceTypeRequestBuilder {
|
|
138
119
|
constructor(args) {
|
|
139
120
|
this.args = args;
|
|
140
121
|
}
|
|
141
|
-
|
|
142
122
|
withIDValue(childPathArgs) {
|
|
143
123
|
return new ByProjectKeyByResourceTypeByIDRequestBuilder({
|
|
144
|
-
pathArgs: {
|
|
124
|
+
pathArgs: {
|
|
125
|
+
...this.args.pathArgs,
|
|
145
126
|
...childPathArgs
|
|
146
127
|
},
|
|
147
128
|
executeRequest: this.args.executeRequest,
|
|
148
129
|
baseUri: this.args.baseUri
|
|
149
130
|
});
|
|
150
131
|
}
|
|
151
|
-
|
|
152
132
|
get(methodArgs) {
|
|
153
133
|
return new ApiRequest({
|
|
154
134
|
baseUri: this.args.baseUri,
|
|
155
135
|
method: 'GET',
|
|
156
136
|
uriTemplate: '/{projectKey}/{resourceType}',
|
|
157
137
|
pathVariables: this.args.pathArgs,
|
|
158
|
-
headers: {
|
|
138
|
+
headers: {
|
|
139
|
+
...(methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.headers)
|
|
159
140
|
},
|
|
160
141
|
queryParams: methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.queryArgs
|
|
161
142
|
}, this.args.executeRequest);
|
|
162
143
|
}
|
|
163
|
-
|
|
164
144
|
}
|
|
165
145
|
|
|
166
146
|
/**
|
|
@@ -170,55 +150,50 @@ class ByProjectKeyByResourceTypeRequestBuilder {
|
|
|
170
150
|
*/
|
|
171
151
|
/**
|
|
172
152
|
**/
|
|
173
|
-
|
|
174
153
|
class ByProjectKeyRequestBuilder {
|
|
175
154
|
constructor(args) {
|
|
176
155
|
this.args = args;
|
|
177
156
|
}
|
|
178
|
-
|
|
179
157
|
withResourceTypeValue(childPathArgs) {
|
|
180
158
|
return new ByProjectKeyByResourceTypeRequestBuilder({
|
|
181
|
-
pathArgs: {
|
|
159
|
+
pathArgs: {
|
|
160
|
+
...this.args.pathArgs,
|
|
182
161
|
...childPathArgs
|
|
183
162
|
},
|
|
184
163
|
executeRequest: this.args.executeRequest,
|
|
185
164
|
baseUri: this.args.baseUri
|
|
186
165
|
});
|
|
187
166
|
}
|
|
188
|
-
|
|
189
167
|
get(methodArgs) {
|
|
190
168
|
return new ApiRequest({
|
|
191
169
|
baseUri: this.args.baseUri,
|
|
192
170
|
method: 'GET',
|
|
193
171
|
uriTemplate: '/{projectKey}',
|
|
194
172
|
pathVariables: this.args.pathArgs,
|
|
195
|
-
headers: {
|
|
173
|
+
headers: {
|
|
174
|
+
...(methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.headers)
|
|
196
175
|
},
|
|
197
176
|
queryParams: methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.queryArgs
|
|
198
177
|
}, this.args.executeRequest);
|
|
199
178
|
}
|
|
200
|
-
|
|
201
179
|
}
|
|
202
180
|
|
|
203
181
|
class ApiRoot {
|
|
204
182
|
constructor(args) {
|
|
205
183
|
_defineProperty(this, "executeRequest", void 0);
|
|
206
|
-
|
|
207
184
|
_defineProperty(this, "baseUri", void 0);
|
|
208
|
-
|
|
209
185
|
this.executeRequest = args.executeRequest;
|
|
210
186
|
this.baseUri = args.baseUri || 'https://history.europe-west1.gcp.commercetools.com';
|
|
211
187
|
}
|
|
212
|
-
|
|
213
188
|
withProjectKeyValue(childPathArgs) {
|
|
214
189
|
return new ByProjectKeyRequestBuilder({
|
|
215
|
-
pathArgs: {
|
|
190
|
+
pathArgs: {
|
|
191
|
+
...childPathArgs
|
|
216
192
|
},
|
|
217
193
|
executeRequest: this.executeRequest,
|
|
218
194
|
baseUri: this.baseUri
|
|
219
195
|
});
|
|
220
196
|
}
|
|
221
|
-
|
|
222
197
|
}
|
|
223
198
|
|
|
224
199
|
/**
|
|
@@ -226,19 +201,17 @@ class ApiRoot {
|
|
|
226
201
|
* Please don't change this file manually but run `rmf-codegen generate <raml_file_path> -o <output_path> -t typescript_client` to update it.
|
|
227
202
|
* For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
|
|
228
203
|
*/
|
|
204
|
+
|
|
229
205
|
const createExecutorFromMiddlewares = (executor, midds) => {
|
|
230
206
|
if (!midds || midds.length == 0) {
|
|
231
207
|
return executor;
|
|
232
208
|
}
|
|
233
|
-
|
|
234
209
|
const reduced = midds.reduce(reduceMiddleware);
|
|
235
210
|
return middlewareToExecutor(reduced, executor);
|
|
236
211
|
};
|
|
237
|
-
|
|
238
212
|
function reduceMiddleware(middleware1, middleware2) {
|
|
239
213
|
return (request, executor) => middleware1(request, middlewareToExecutor(middleware2, executor));
|
|
240
214
|
}
|
|
241
|
-
|
|
242
215
|
function middlewareToExecutor(middleware, executor) {
|
|
243
216
|
return request => middleware(request, executor);
|
|
244
217
|
}
|
|
@@ -11,7 +11,6 @@ function _defineProperty(obj, key, value) {
|
|
|
11
11
|
} else {
|
|
12
12
|
obj[key] = value;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
14
|
return obj;
|
|
16
15
|
}
|
|
17
16
|
|
|
@@ -20,56 +19,45 @@ function _defineProperty(obj, key, value) {
|
|
|
20
19
|
* Please don't change this file manually but run `rmf-codegen generate <raml_file_path> -o <output_path> -t typescript_client` to update it.
|
|
21
20
|
* For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
|
|
22
21
|
*/
|
|
23
|
-
|
|
24
22
|
function isDefined(value) {
|
|
25
23
|
return typeof value !== 'undefined' && value !== null;
|
|
26
24
|
}
|
|
27
|
-
|
|
28
25
|
function cleanObject(obj) {
|
|
29
26
|
return Object.keys(obj).reduce((result, key) => {
|
|
30
27
|
const value = obj[key];
|
|
31
|
-
|
|
32
28
|
if (Array.isArray(value)) {
|
|
33
29
|
const values = value.filter(isDefined);
|
|
34
|
-
|
|
35
30
|
if (!values.length) {
|
|
36
31
|
return result;
|
|
37
32
|
}
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
return {
|
|
34
|
+
...result,
|
|
40
35
|
[key]: values
|
|
41
36
|
};
|
|
42
37
|
}
|
|
43
|
-
|
|
44
38
|
if (isDefined(value)) {
|
|
45
|
-
return {
|
|
39
|
+
return {
|
|
40
|
+
...result,
|
|
46
41
|
[key]: value
|
|
47
42
|
};
|
|
48
43
|
}
|
|
49
|
-
|
|
50
44
|
return result;
|
|
51
45
|
}, {});
|
|
52
46
|
}
|
|
53
|
-
|
|
54
47
|
function formatQueryString(variableMap) {
|
|
55
48
|
const map = cleanObject(variableMap);
|
|
56
49
|
const result = stringify(map);
|
|
57
|
-
|
|
58
50
|
if (result === '') {
|
|
59
51
|
return '';
|
|
60
52
|
}
|
|
61
|
-
|
|
62
53
|
return `?${result}`;
|
|
63
54
|
}
|
|
64
|
-
|
|
65
55
|
function buildRelativeUri(commonRequest) {
|
|
66
56
|
const pathMap = commonRequest.pathVariables;
|
|
67
57
|
var uri = commonRequest.uriTemplate;
|
|
68
|
-
|
|
69
58
|
for (const param in pathMap) {
|
|
70
59
|
uri = uri.replace(`{${param}}`, `${pathMap[param]}`);
|
|
71
60
|
}
|
|
72
|
-
|
|
73
61
|
const resQuery = formatQueryString(commonRequest.queryParams || {});
|
|
74
62
|
return `${uri}${resQuery}`;
|
|
75
63
|
}
|
|
@@ -77,22 +65,18 @@ function buildRelativeUri(commonRequest) {
|
|
|
77
65
|
class ApiRequest {
|
|
78
66
|
constructor(request, requestExecutor) {
|
|
79
67
|
this.requestExecutor = requestExecutor;
|
|
80
|
-
|
|
81
68
|
_defineProperty(this, "request", void 0);
|
|
82
|
-
|
|
83
|
-
|
|
69
|
+
this.request = {
|
|
70
|
+
...request,
|
|
84
71
|
uri: buildRelativeUri(request)
|
|
85
72
|
};
|
|
86
73
|
}
|
|
87
|
-
|
|
88
74
|
clientRequest() {
|
|
89
75
|
return this.request;
|
|
90
76
|
}
|
|
91
|
-
|
|
92
77
|
execute() {
|
|
93
78
|
return this.requestExecutor(this.request);
|
|
94
79
|
}
|
|
95
|
-
|
|
96
80
|
}
|
|
97
81
|
|
|
98
82
|
/**
|
|
@@ -102,24 +86,22 @@ class ApiRequest {
|
|
|
102
86
|
*/
|
|
103
87
|
/**
|
|
104
88
|
**/
|
|
105
|
-
|
|
106
89
|
class ByProjectKeyByResourceTypeByIDRequestBuilder {
|
|
107
90
|
constructor(args) {
|
|
108
91
|
this.args = args;
|
|
109
92
|
}
|
|
110
|
-
|
|
111
93
|
get(methodArgs) {
|
|
112
94
|
return new ApiRequest({
|
|
113
95
|
baseUri: this.args.baseUri,
|
|
114
96
|
method: 'GET',
|
|
115
97
|
uriTemplate: '/{projectKey}/{resourceType}/{ID}',
|
|
116
98
|
pathVariables: this.args.pathArgs,
|
|
117
|
-
headers: {
|
|
99
|
+
headers: {
|
|
100
|
+
...(methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.headers)
|
|
118
101
|
},
|
|
119
102
|
queryParams: methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.queryArgs
|
|
120
103
|
}, this.args.executeRequest);
|
|
121
104
|
}
|
|
122
|
-
|
|
123
105
|
}
|
|
124
106
|
|
|
125
107
|
/**
|
|
@@ -129,34 +111,32 @@ class ByProjectKeyByResourceTypeByIDRequestBuilder {
|
|
|
129
111
|
*/
|
|
130
112
|
/**
|
|
131
113
|
**/
|
|
132
|
-
|
|
133
114
|
class ByProjectKeyByResourceTypeRequestBuilder {
|
|
134
115
|
constructor(args) {
|
|
135
116
|
this.args = args;
|
|
136
117
|
}
|
|
137
|
-
|
|
138
118
|
withIDValue(childPathArgs) {
|
|
139
119
|
return new ByProjectKeyByResourceTypeByIDRequestBuilder({
|
|
140
|
-
pathArgs: {
|
|
120
|
+
pathArgs: {
|
|
121
|
+
...this.args.pathArgs,
|
|
141
122
|
...childPathArgs
|
|
142
123
|
},
|
|
143
124
|
executeRequest: this.args.executeRequest,
|
|
144
125
|
baseUri: this.args.baseUri
|
|
145
126
|
});
|
|
146
127
|
}
|
|
147
|
-
|
|
148
128
|
get(methodArgs) {
|
|
149
129
|
return new ApiRequest({
|
|
150
130
|
baseUri: this.args.baseUri,
|
|
151
131
|
method: 'GET',
|
|
152
132
|
uriTemplate: '/{projectKey}/{resourceType}',
|
|
153
133
|
pathVariables: this.args.pathArgs,
|
|
154
|
-
headers: {
|
|
134
|
+
headers: {
|
|
135
|
+
...(methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.headers)
|
|
155
136
|
},
|
|
156
137
|
queryParams: methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.queryArgs
|
|
157
138
|
}, this.args.executeRequest);
|
|
158
139
|
}
|
|
159
|
-
|
|
160
140
|
}
|
|
161
141
|
|
|
162
142
|
/**
|
|
@@ -166,55 +146,50 @@ class ByProjectKeyByResourceTypeRequestBuilder {
|
|
|
166
146
|
*/
|
|
167
147
|
/**
|
|
168
148
|
**/
|
|
169
|
-
|
|
170
149
|
class ByProjectKeyRequestBuilder {
|
|
171
150
|
constructor(args) {
|
|
172
151
|
this.args = args;
|
|
173
152
|
}
|
|
174
|
-
|
|
175
153
|
withResourceTypeValue(childPathArgs) {
|
|
176
154
|
return new ByProjectKeyByResourceTypeRequestBuilder({
|
|
177
|
-
pathArgs: {
|
|
155
|
+
pathArgs: {
|
|
156
|
+
...this.args.pathArgs,
|
|
178
157
|
...childPathArgs
|
|
179
158
|
},
|
|
180
159
|
executeRequest: this.args.executeRequest,
|
|
181
160
|
baseUri: this.args.baseUri
|
|
182
161
|
});
|
|
183
162
|
}
|
|
184
|
-
|
|
185
163
|
get(methodArgs) {
|
|
186
164
|
return new ApiRequest({
|
|
187
165
|
baseUri: this.args.baseUri,
|
|
188
166
|
method: 'GET',
|
|
189
167
|
uriTemplate: '/{projectKey}',
|
|
190
168
|
pathVariables: this.args.pathArgs,
|
|
191
|
-
headers: {
|
|
169
|
+
headers: {
|
|
170
|
+
...(methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.headers)
|
|
192
171
|
},
|
|
193
172
|
queryParams: methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.queryArgs
|
|
194
173
|
}, this.args.executeRequest);
|
|
195
174
|
}
|
|
196
|
-
|
|
197
175
|
}
|
|
198
176
|
|
|
199
177
|
class ApiRoot {
|
|
200
178
|
constructor(args) {
|
|
201
179
|
_defineProperty(this, "executeRequest", void 0);
|
|
202
|
-
|
|
203
180
|
_defineProperty(this, "baseUri", void 0);
|
|
204
|
-
|
|
205
181
|
this.executeRequest = args.executeRequest;
|
|
206
182
|
this.baseUri = args.baseUri || 'https://history.europe-west1.gcp.commercetools.com';
|
|
207
183
|
}
|
|
208
|
-
|
|
209
184
|
withProjectKeyValue(childPathArgs) {
|
|
210
185
|
return new ByProjectKeyRequestBuilder({
|
|
211
|
-
pathArgs: {
|
|
186
|
+
pathArgs: {
|
|
187
|
+
...childPathArgs
|
|
212
188
|
},
|
|
213
189
|
executeRequest: this.executeRequest,
|
|
214
190
|
baseUri: this.baseUri
|
|
215
191
|
});
|
|
216
192
|
}
|
|
217
|
-
|
|
218
193
|
}
|
|
219
194
|
|
|
220
195
|
/**
|
|
@@ -222,19 +197,17 @@ class ApiRoot {
|
|
|
222
197
|
* Please don't change this file manually but run `rmf-codegen generate <raml_file_path> -o <output_path> -t typescript_client` to update it.
|
|
223
198
|
* For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
|
|
224
199
|
*/
|
|
200
|
+
|
|
225
201
|
const createExecutorFromMiddlewares = (executor, midds) => {
|
|
226
202
|
if (!midds || midds.length == 0) {
|
|
227
203
|
return executor;
|
|
228
204
|
}
|
|
229
|
-
|
|
230
205
|
const reduced = midds.reduce(reduceMiddleware);
|
|
231
206
|
return middlewareToExecutor(reduced, executor);
|
|
232
207
|
};
|
|
233
|
-
|
|
234
208
|
function reduceMiddleware(middleware1, middleware2) {
|
|
235
209
|
return (request, executor) => middleware1(request, middlewareToExecutor(middleware2, executor));
|
|
236
210
|
}
|
|
237
|
-
|
|
238
211
|
function middlewareToExecutor(middleware, executor) {
|
|
239
212
|
return request => middleware(request, executor);
|
|
240
213
|
}
|