@commercetools/history-sdk 1.18.0 → 2.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/CHANGELOG.md +28 -0
- package/README.md +112 -22
- package/dist/commercetools-history-sdk.browser.cjs.js +127 -198
- package/dist/commercetools-history-sdk.browser.esm.js +127 -198
- package/dist/commercetools-history-sdk.cjs.dev.js +127 -198
- package/dist/commercetools-history-sdk.cjs.prod.js +127 -198
- package/dist/commercetools-history-sdk.esm.js +127 -198
- package/dist/declarations/src/ctp/ctp-client.d.ts +2 -2
- package/dist/declarations/src/generated/client/api-root.d.ts +18 -25
- package/dist/declarations/src/generated/client/by-project-key-by-resource-type-by-id-request-builder.d.ts +48 -54
- package/dist/declarations/src/generated/client/by-project-key-by-resource-type-request-builder.d.ts +51 -57
- package/dist/declarations/src/generated/client/by-project-key-request-builder.d.ts +50 -56
- package/dist/declarations/src/generated/index.d.ts +12 -19
- package/dist/declarations/src/generated/models/change-value.d.ts +332 -339
- package/dist/declarations/src/generated/models/change.d.ts +4492 -4499
- package/dist/declarations/src/generated/models/common.d.ts +1115 -1121
- package/dist/declarations/src/generated/models/label.d.ts +83 -90
- package/dist/declarations/src/generated/shared/utils/common-types.d.ts +26 -33
- package/dist/declarations/src/generated/shared/utils/middleware.d.ts +8 -15
- package/dist/declarations/src/generated/shared/utils/requests-utils.d.ts +13 -20
- package/dist/declarations/src/generated/shared/utils/uri-utils.d.ts +7 -14
- package/dist/declarations/src/index.d.ts +2 -2
- package/package.json +9 -7
|
@@ -15,86 +15,36 @@ function _defineProperty(obj, key, value) {
|
|
|
15
15
|
return obj;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (enumerableOnly) {
|
|
25
|
-
symbols = symbols.filter(function (sym) {
|
|
26
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
keys.push.apply(keys, symbols);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return keys;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function _objectSpread2(target) {
|
|
37
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
38
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
39
|
-
|
|
40
|
-
if (i % 2) {
|
|
41
|
-
ownKeys(Object(source), true).forEach(function (key) {
|
|
42
|
-
_defineProperty(target, key, source[key]);
|
|
43
|
-
});
|
|
44
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
45
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
46
|
-
} else {
|
|
47
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
48
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return target;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function _classCallCheck(instance, Constructor) {
|
|
57
|
-
if (!(instance instanceof Constructor)) {
|
|
58
|
-
throw new TypeError("Cannot call a class as a function");
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function _defineProperties(target, props) {
|
|
63
|
-
for (var i = 0; i < props.length; i++) {
|
|
64
|
-
var descriptor = props[i];
|
|
65
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
66
|
-
descriptor.configurable = true;
|
|
67
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
68
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
73
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
74
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
75
|
-
return Constructor;
|
|
76
|
-
}
|
|
18
|
+
/**
|
|
19
|
+
* Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
|
|
20
|
+
* 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
|
+
* For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
|
|
22
|
+
*/
|
|
77
23
|
|
|
78
24
|
function isDefined(value) {
|
|
79
25
|
return typeof value !== 'undefined' && value !== null;
|
|
80
26
|
}
|
|
81
27
|
|
|
82
28
|
function cleanObject(obj) {
|
|
83
|
-
return Object.keys(obj).reduce(
|
|
84
|
-
|
|
29
|
+
return Object.keys(obj).reduce((result, key) => {
|
|
30
|
+
const value = obj[key];
|
|
85
31
|
|
|
86
32
|
if (Array.isArray(value)) {
|
|
87
|
-
|
|
33
|
+
const values = value.filter(isDefined);
|
|
88
34
|
|
|
89
35
|
if (!values.length) {
|
|
90
36
|
return result;
|
|
91
37
|
}
|
|
92
38
|
|
|
93
|
-
return
|
|
39
|
+
return { ...result,
|
|
40
|
+
[key]: values
|
|
41
|
+
};
|
|
94
42
|
}
|
|
95
43
|
|
|
96
44
|
if (isDefined(value)) {
|
|
97
|
-
return
|
|
45
|
+
return { ...result,
|
|
46
|
+
[key]: value
|
|
47
|
+
};
|
|
98
48
|
}
|
|
99
49
|
|
|
100
50
|
return result;
|
|
@@ -102,152 +52,145 @@ function cleanObject(obj) {
|
|
|
102
52
|
}
|
|
103
53
|
|
|
104
54
|
function formatQueryString(variableMap) {
|
|
105
|
-
|
|
106
|
-
|
|
55
|
+
const map = cleanObject(variableMap);
|
|
56
|
+
const result = stringify(map);
|
|
107
57
|
|
|
108
58
|
if (result === '') {
|
|
109
59
|
return '';
|
|
110
60
|
}
|
|
111
61
|
|
|
112
|
-
return
|
|
62
|
+
return `?${result}`;
|
|
113
63
|
}
|
|
114
64
|
|
|
115
65
|
function buildRelativeUri(commonRequest) {
|
|
116
|
-
|
|
66
|
+
const pathMap = commonRequest.pathVariables;
|
|
117
67
|
var uri = commonRequest.uriTemplate;
|
|
118
68
|
|
|
119
|
-
for (
|
|
120
|
-
uri = uri.replace(
|
|
69
|
+
for (const param in pathMap) {
|
|
70
|
+
uri = uri.replace(`{${param}}`, `${pathMap[param]}`);
|
|
121
71
|
}
|
|
122
72
|
|
|
123
|
-
|
|
124
|
-
return
|
|
73
|
+
const resQuery = formatQueryString(commonRequest.queryParams || {});
|
|
74
|
+
return `${uri}${resQuery}`;
|
|
125
75
|
}
|
|
126
76
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
_classCallCheck(this, ApiRequest);
|
|
130
|
-
|
|
77
|
+
class ApiRequest {
|
|
78
|
+
constructor(request, requestExecutor) {
|
|
131
79
|
this.requestExecutor = requestExecutor;
|
|
132
80
|
|
|
133
81
|
_defineProperty(this, "request", void 0);
|
|
134
82
|
|
|
135
|
-
this.request =
|
|
83
|
+
this.request = { ...request,
|
|
136
84
|
uri: buildRelativeUri(request)
|
|
137
|
-
}
|
|
85
|
+
};
|
|
138
86
|
}
|
|
139
87
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
return this.request;
|
|
144
|
-
}
|
|
145
|
-
}, {
|
|
146
|
-
key: "execute",
|
|
147
|
-
value: function execute() {
|
|
148
|
-
return this.requestExecutor(this.request);
|
|
149
|
-
}
|
|
150
|
-
}]);
|
|
88
|
+
clientRequest() {
|
|
89
|
+
return this.request;
|
|
90
|
+
}
|
|
151
91
|
|
|
152
|
-
|
|
153
|
-
|
|
92
|
+
execute() {
|
|
93
|
+
return this.requestExecutor(this.request);
|
|
94
|
+
}
|
|
154
95
|
|
|
155
|
-
|
|
156
|
-
function ByProjectKeyByResourceTypeByIDRequestBuilder(args) {
|
|
157
|
-
_classCallCheck(this, ByProjectKeyByResourceTypeByIDRequestBuilder);
|
|
96
|
+
}
|
|
158
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
|
|
100
|
+
* Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
|
|
101
|
+
* For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
|
|
102
|
+
*/
|
|
103
|
+
class ByProjectKeyByResourceTypeByIDRequestBuilder {
|
|
104
|
+
constructor(args) {
|
|
159
105
|
this.args = args;
|
|
160
106
|
}
|
|
161
107
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
}]);
|
|
175
|
-
|
|
176
|
-
return ByProjectKeyByResourceTypeByIDRequestBuilder;
|
|
177
|
-
}();
|
|
108
|
+
get(methodArgs) {
|
|
109
|
+
return new ApiRequest({
|
|
110
|
+
baseUri: this.args.baseUri,
|
|
111
|
+
method: 'GET',
|
|
112
|
+
uriTemplate: '/{projectKey}/{resourceType}/{ID}',
|
|
113
|
+
pathVariables: this.args.pathArgs,
|
|
114
|
+
headers: { ...(methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.headers)
|
|
115
|
+
},
|
|
116
|
+
queryParams: methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.queryArgs
|
|
117
|
+
}, this.args.executeRequest);
|
|
118
|
+
}
|
|
178
119
|
|
|
179
|
-
|
|
180
|
-
function ByProjectKeyByResourceTypeRequestBuilder(args) {
|
|
181
|
-
_classCallCheck(this, ByProjectKeyByResourceTypeRequestBuilder);
|
|
120
|
+
}
|
|
182
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
|
|
124
|
+
* Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
|
|
125
|
+
* For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
|
|
126
|
+
*/
|
|
127
|
+
class ByProjectKeyByResourceTypeRequestBuilder {
|
|
128
|
+
constructor(args) {
|
|
183
129
|
this.args = args;
|
|
184
130
|
}
|
|
185
131
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}, {
|
|
196
|
-
key: "get",
|
|
197
|
-
value: function get(methodArgs) {
|
|
198
|
-
return new ApiRequest({
|
|
199
|
-
baseUri: this.args.baseUri,
|
|
200
|
-
method: 'GET',
|
|
201
|
-
uriTemplate: '/{projectKey}/{resourceType}',
|
|
202
|
-
pathVariables: this.args.pathArgs,
|
|
203
|
-
headers: _objectSpread2({}, methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.headers),
|
|
204
|
-
queryParams: methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.queryArgs
|
|
205
|
-
}, this.args.executeRequest);
|
|
206
|
-
}
|
|
207
|
-
}]);
|
|
132
|
+
withIDValue(childPathArgs) {
|
|
133
|
+
return new ByProjectKeyByResourceTypeByIDRequestBuilder({
|
|
134
|
+
pathArgs: { ...this.args.pathArgs,
|
|
135
|
+
...childPathArgs
|
|
136
|
+
},
|
|
137
|
+
executeRequest: this.args.executeRequest,
|
|
138
|
+
baseUri: this.args.baseUri
|
|
139
|
+
});
|
|
140
|
+
}
|
|
208
141
|
|
|
209
|
-
|
|
210
|
-
|
|
142
|
+
get(methodArgs) {
|
|
143
|
+
return new ApiRequest({
|
|
144
|
+
baseUri: this.args.baseUri,
|
|
145
|
+
method: 'GET',
|
|
146
|
+
uriTemplate: '/{projectKey}/{resourceType}',
|
|
147
|
+
pathVariables: this.args.pathArgs,
|
|
148
|
+
headers: { ...(methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.headers)
|
|
149
|
+
},
|
|
150
|
+
queryParams: methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.queryArgs
|
|
151
|
+
}, this.args.executeRequest);
|
|
152
|
+
}
|
|
211
153
|
|
|
212
|
-
|
|
213
|
-
function ByProjectKeyRequestBuilder(args) {
|
|
214
|
-
_classCallCheck(this, ByProjectKeyRequestBuilder);
|
|
154
|
+
}
|
|
215
155
|
|
|
156
|
+
/**
|
|
157
|
+
* Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
|
|
158
|
+
* Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
|
|
159
|
+
* For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
|
|
160
|
+
*/
|
|
161
|
+
class ByProjectKeyRequestBuilder {
|
|
162
|
+
constructor(args) {
|
|
216
163
|
this.args = args;
|
|
217
164
|
}
|
|
218
165
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}]);
|
|
166
|
+
withResourceTypeValue(childPathArgs) {
|
|
167
|
+
return new ByProjectKeyByResourceTypeRequestBuilder({
|
|
168
|
+
pathArgs: { ...this.args.pathArgs,
|
|
169
|
+
...childPathArgs
|
|
170
|
+
},
|
|
171
|
+
executeRequest: this.args.executeRequest,
|
|
172
|
+
baseUri: this.args.baseUri
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
get(methodArgs) {
|
|
177
|
+
return new ApiRequest({
|
|
178
|
+
baseUri: this.args.baseUri,
|
|
179
|
+
method: 'GET',
|
|
180
|
+
uriTemplate: '/{projectKey}',
|
|
181
|
+
pathVariables: this.args.pathArgs,
|
|
182
|
+
headers: { ...(methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.headers)
|
|
183
|
+
},
|
|
184
|
+
queryParams: methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.queryArgs
|
|
185
|
+
}, this.args.executeRequest);
|
|
186
|
+
}
|
|
241
187
|
|
|
242
|
-
|
|
243
|
-
}();
|
|
188
|
+
}
|
|
244
189
|
|
|
245
|
-
|
|
246
|
-
|
|
190
|
+
class ApiRoot {
|
|
191
|
+
constructor(args) {
|
|
247
192
|
var _args$baseUri;
|
|
248
193
|
|
|
249
|
-
_classCallCheck(this, ApiRoot);
|
|
250
|
-
|
|
251
194
|
_defineProperty(this, "executeRequest", void 0);
|
|
252
195
|
|
|
253
196
|
_defineProperty(this, "baseUri", void 0);
|
|
@@ -256,51 +199,37 @@ var ApiRoot = /*#__PURE__*/function () {
|
|
|
256
199
|
this.baseUri = (_args$baseUri = args.baseUri) !== null && _args$baseUri !== void 0 ? _args$baseUri : 'https://history.europe-west1.gcp.commercetools.com';
|
|
257
200
|
}
|
|
258
201
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
}]);
|
|
202
|
+
withProjectKeyValue(childPathArgs) {
|
|
203
|
+
return new ByProjectKeyRequestBuilder({
|
|
204
|
+
pathArgs: { ...childPathArgs
|
|
205
|
+
},
|
|
206
|
+
executeRequest: this.executeRequest,
|
|
207
|
+
baseUri: this.baseUri
|
|
208
|
+
});
|
|
209
|
+
}
|
|
269
210
|
|
|
270
|
-
|
|
271
|
-
}();
|
|
211
|
+
}
|
|
272
212
|
|
|
273
213
|
/**
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
* ,d88b.d88b,
|
|
279
|
-
* 88888888888
|
|
280
|
-
* `Y8888888Y'
|
|
281
|
-
* `Y888Y'
|
|
282
|
-
* `Y'
|
|
283
|
-
*
|
|
214
|
+
* Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
|
|
215
|
+
* Please don't change this file manually but run `rmf-codegen generate <raml_file_path> -o <output_path> -t typescript_client` to update it.
|
|
216
|
+
* For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
|
|
284
217
|
*/
|
|
285
|
-
|
|
218
|
+
const createExecutorFromMiddlewares = (executor, midds) => {
|
|
286
219
|
if (!midds || midds.length == 0) {
|
|
287
220
|
return executor;
|
|
288
221
|
}
|
|
289
222
|
|
|
290
|
-
|
|
223
|
+
const reduced = midds.reduce(reduceMiddleware);
|
|
291
224
|
return middlewareToExecutor(reduced, executor);
|
|
292
225
|
};
|
|
293
226
|
|
|
294
227
|
function reduceMiddleware(middleware1, middleware2) {
|
|
295
|
-
return
|
|
296
|
-
return middleware1(request, middlewareToExecutor(middleware2, executor));
|
|
297
|
-
};
|
|
228
|
+
return (request, executor) => middleware1(request, middlewareToExecutor(middleware2, executor));
|
|
298
229
|
}
|
|
299
230
|
|
|
300
231
|
function middlewareToExecutor(middleware, executor) {
|
|
301
|
-
return
|
|
302
|
-
return middleware(request, executor);
|
|
303
|
-
};
|
|
232
|
+
return request => middleware(request, executor);
|
|
304
233
|
}
|
|
305
234
|
|
|
306
235
|
function createApiBuilderFromCtpClient(ctpClient, baseUri) {
|