@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.
Files changed (23) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +112 -22
  3. package/dist/commercetools-history-sdk.browser.cjs.js +127 -198
  4. package/dist/commercetools-history-sdk.browser.esm.js +127 -198
  5. package/dist/commercetools-history-sdk.cjs.dev.js +127 -198
  6. package/dist/commercetools-history-sdk.cjs.prod.js +127 -198
  7. package/dist/commercetools-history-sdk.esm.js +127 -198
  8. package/dist/declarations/src/ctp/ctp-client.d.ts +2 -2
  9. package/dist/declarations/src/generated/client/api-root.d.ts +18 -25
  10. package/dist/declarations/src/generated/client/by-project-key-by-resource-type-by-id-request-builder.d.ts +48 -54
  11. package/dist/declarations/src/generated/client/by-project-key-by-resource-type-request-builder.d.ts +51 -57
  12. package/dist/declarations/src/generated/client/by-project-key-request-builder.d.ts +50 -56
  13. package/dist/declarations/src/generated/index.d.ts +12 -19
  14. package/dist/declarations/src/generated/models/change-value.d.ts +332 -339
  15. package/dist/declarations/src/generated/models/change.d.ts +4492 -4499
  16. package/dist/declarations/src/generated/models/common.d.ts +1115 -1121
  17. package/dist/declarations/src/generated/models/label.d.ts +83 -90
  18. package/dist/declarations/src/generated/shared/utils/common-types.d.ts +26 -33
  19. package/dist/declarations/src/generated/shared/utils/middleware.d.ts +8 -15
  20. package/dist/declarations/src/generated/shared/utils/requests-utils.d.ts +13 -20
  21. package/dist/declarations/src/generated/shared/utils/uri-utils.d.ts +7 -14
  22. package/dist/declarations/src/index.d.ts +2 -2
  23. package/package.json +9 -7
@@ -15,86 +15,36 @@ function _defineProperty(obj, key, value) {
15
15
  return obj;
16
16
  }
17
17
 
18
- function ownKeys(object, enumerableOnly) {
19
- var keys = Object.keys(object);
20
-
21
- if (Object.getOwnPropertySymbols) {
22
- var symbols = Object.getOwnPropertySymbols(object);
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(function (result, key) {
84
- var value = obj[key];
29
+ return Object.keys(obj).reduce((result, key) => {
30
+ const value = obj[key];
85
31
 
86
32
  if (Array.isArray(value)) {
87
- var values = value.filter(isDefined);
33
+ const values = value.filter(isDefined);
88
34
 
89
35
  if (!values.length) {
90
36
  return result;
91
37
  }
92
38
 
93
- return _objectSpread2(_objectSpread2({}, result), {}, _defineProperty({}, key, values));
39
+ return { ...result,
40
+ [key]: values
41
+ };
94
42
  }
95
43
 
96
44
  if (isDefined(value)) {
97
- return _objectSpread2(_objectSpread2({}, result), {}, _defineProperty({}, key, value));
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
- var map = cleanObject(variableMap);
106
- var result = stringify(map);
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 "?".concat(result);
62
+ return `?${result}`;
113
63
  }
114
64
 
115
65
  function buildRelativeUri(commonRequest) {
116
- var pathMap = commonRequest.pathVariables;
66
+ const pathMap = commonRequest.pathVariables;
117
67
  var uri = commonRequest.uriTemplate;
118
68
 
119
- for (var param in pathMap) {
120
- uri = uri.replace("{".concat(param, "}"), "".concat(pathMap[param]));
69
+ for (const param in pathMap) {
70
+ uri = uri.replace(`{${param}}`, `${pathMap[param]}`);
121
71
  }
122
72
 
123
- var resQuery = formatQueryString(commonRequest.queryParams || {});
124
- return "".concat(uri).concat(resQuery);
73
+ const resQuery = formatQueryString(commonRequest.queryParams || {});
74
+ return `${uri}${resQuery}`;
125
75
  }
126
76
 
127
- var ApiRequest = /*#__PURE__*/function () {
128
- function ApiRequest(request, requestExecutor) {
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 = _objectSpread2(_objectSpread2({}, request), {}, {
83
+ this.request = { ...request,
136
84
  uri: buildRelativeUri(request)
137
- });
85
+ };
138
86
  }
139
87
 
140
- _createClass(ApiRequest, [{
141
- key: "clientRequest",
142
- value: function clientRequest() {
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
- return ApiRequest;
153
- }();
92
+ execute() {
93
+ return this.requestExecutor(this.request);
94
+ }
154
95
 
155
- var ByProjectKeyByResourceTypeByIDRequestBuilder = /*#__PURE__*/function () {
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
- _createClass(ByProjectKeyByResourceTypeByIDRequestBuilder, [{
163
- key: "get",
164
- value: function get(methodArgs) {
165
- return new ApiRequest({
166
- baseUri: this.args.baseUri,
167
- method: 'GET',
168
- uriTemplate: '/{projectKey}/{resourceType}/{ID}',
169
- pathVariables: this.args.pathArgs,
170
- headers: _objectSpread2({}, methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.headers),
171
- queryParams: methodArgs === null || methodArgs === void 0 ? void 0 : methodArgs.queryArgs
172
- }, this.args.executeRequest);
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
- var ByProjectKeyByResourceTypeRequestBuilder = /*#__PURE__*/function () {
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
- _createClass(ByProjectKeyByResourceTypeRequestBuilder, [{
187
- key: "withIDValue",
188
- value: function withIDValue(childPathArgs) {
189
- return new ByProjectKeyByResourceTypeByIDRequestBuilder({
190
- pathArgs: _objectSpread2(_objectSpread2({}, this.args.pathArgs), childPathArgs),
191
- executeRequest: this.args.executeRequest,
192
- baseUri: this.args.baseUri
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
- return ByProjectKeyByResourceTypeRequestBuilder;
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
- var ByProjectKeyRequestBuilder = /*#__PURE__*/function () {
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
- _createClass(ByProjectKeyRequestBuilder, [{
220
- key: "withResourceTypeValue",
221
- value: function withResourceTypeValue(childPathArgs) {
222
- return new ByProjectKeyByResourceTypeRequestBuilder({
223
- pathArgs: _objectSpread2(_objectSpread2({}, this.args.pathArgs), childPathArgs),
224
- executeRequest: this.args.executeRequest,
225
- baseUri: this.args.baseUri
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
+ }
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
- return ByProjectKeyRequestBuilder;
243
- }();
188
+ }
244
189
 
245
- var ApiRoot = /*#__PURE__*/function () {
246
- function ApiRoot(args) {
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
- _createClass(ApiRoot, [{
260
- key: "withProjectKeyValue",
261
- value: function withProjectKeyValue(childPathArgs) {
262
- return new ByProjectKeyRequestBuilder({
263
- pathArgs: _objectSpread2({}, childPathArgs),
264
- executeRequest: this.executeRequest,
265
- baseUri: this.baseUri
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
- return ApiRoot;
271
- }();
211
+ }
272
212
 
273
213
  /**
274
- *
275
- * Generated file, please do not change!!!
276
- * From http://www.commercetools.com/ with love
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
- var createExecutorFromMiddlewares = function createExecutorFromMiddlewares(executor, midds) {
218
+ const createExecutorFromMiddlewares = (executor, midds) => {
286
219
  if (!midds || midds.length == 0) {
287
220
  return executor;
288
221
  }
289
222
 
290
- var reduced = midds.reduce(reduceMiddleware);
223
+ const reduced = midds.reduce(reduceMiddleware);
291
224
  return middlewareToExecutor(reduced, executor);
292
225
  };
293
226
 
294
227
  function reduceMiddleware(middleware1, middleware2) {
295
- return function (request, executor) {
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 function (request) {
302
- return middleware(request, executor);
303
- };
232
+ return request => middleware(request, executor);
304
233
  }
305
234
 
306
235
  function createApiBuilderFromCtpClient(ctpClient, baseUri) {