@commercetools/history-sdk 1.19.0 → 2.1.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 +33 -0
- package/README.md +110 -20
- package/dist/commercetools-history-sdk.browser.cjs.js +124 -188
- package/dist/commercetools-history-sdk.browser.esm.js +124 -188
- package/dist/commercetools-history-sdk.cjs.dev.js +124 -188
- package/dist/commercetools-history-sdk.cjs.prod.js +124 -188
- package/dist/commercetools-history-sdk.esm.js +124 -188
- package/dist/declarations/src/ctp/ctp-client.d.ts +2 -2
- package/dist/declarations/src/generated/client/api-root.d.ts +18 -18
- package/dist/declarations/src/generated/client/by-project-key-by-resource-type-by-id-request-builder.d.ts +48 -48
- package/dist/declarations/src/generated/client/by-project-key-by-resource-type-request-builder.d.ts +51 -51
- package/dist/declarations/src/generated/client/by-project-key-request-builder.d.ts +50 -50
- package/dist/declarations/src/generated/index.d.ts +12 -12
- package/dist/declarations/src/generated/models/change-value.d.ts +332 -332
- package/dist/declarations/src/generated/models/change.d.ts +4571 -4492
- package/dist/declarations/src/generated/models/common.d.ts +1120 -1115
- package/dist/declarations/src/generated/models/label.d.ts +94 -83
- package/dist/declarations/src/generated/shared/utils/common-types.d.ts +26 -26
- package/dist/declarations/src/generated/shared/utils/middleware.d.ts +8 -8
- package/dist/declarations/src/generated/shared/utils/requests-utils.d.ts +13 -13
- package/dist/declarations/src/generated/shared/utils/uri-utils.d.ts +7 -7
- package/dist/declarations/src/index.d.ts +2 -2
- package/package.json +6 -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,151 +52,144 @@ 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
|
-
key: "get",
|
|
230
|
-
value: function get(methodArgs) {
|
|
231
|
-
return new ApiRequest({
|
|
232
|
-
baseUri: this.args.baseUri,
|
|
233
|
-
method: 'GET',
|
|
234
|
-
uriTemplate: '/{projectKey}',
|
|
235
|
-
pathVariables: this.args.pathArgs,
|
|
236
|
-
headers: _objectSpread2({}, methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.headers),
|
|
237
|
-
queryParams: methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.queryArgs
|
|
238
|
-
}, this.args.executeRequest);
|
|
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
|
+
}
|
|
241
175
|
|
|
242
|
-
|
|
243
|
-
|
|
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
|
+
}
|
|
244
187
|
|
|
245
|
-
|
|
246
|
-
function ApiRoot(args) {
|
|
247
|
-
var _args$baseUri;
|
|
188
|
+
}
|
|
248
189
|
|
|
249
|
-
|
|
190
|
+
class ApiRoot {
|
|
191
|
+
constructor(args) {
|
|
192
|
+
var _args$baseUri;
|
|
250
193
|
|
|
251
194
|
_defineProperty(this, "executeRequest", void 0);
|
|
252
195
|
|
|
@@ -256,44 +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
214
|
* Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
|
|
275
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.
|
|
276
216
|
* For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
|
|
277
217
|
*/
|
|
278
|
-
|
|
218
|
+
const createExecutorFromMiddlewares = (executor, midds) => {
|
|
279
219
|
if (!midds || midds.length == 0) {
|
|
280
220
|
return executor;
|
|
281
221
|
}
|
|
282
222
|
|
|
283
|
-
|
|
223
|
+
const reduced = midds.reduce(reduceMiddleware);
|
|
284
224
|
return middlewareToExecutor(reduced, executor);
|
|
285
225
|
};
|
|
286
226
|
|
|
287
227
|
function reduceMiddleware(middleware1, middleware2) {
|
|
288
|
-
return
|
|
289
|
-
return middleware1(request, middlewareToExecutor(middleware2, executor));
|
|
290
|
-
};
|
|
228
|
+
return (request, executor) => middleware1(request, middlewareToExecutor(middleware2, executor));
|
|
291
229
|
}
|
|
292
230
|
|
|
293
231
|
function middlewareToExecutor(middleware, executor) {
|
|
294
|
-
return
|
|
295
|
-
return middleware(request, executor);
|
|
296
|
-
};
|
|
232
|
+
return request => middleware(request, executor);
|
|
297
233
|
}
|
|
298
234
|
|
|
299
235
|
function createApiBuilderFromCtpClient(ctpClient, baseUri) {
|