@salesforce/lds-adapters-industries-epc 1.131.5 → 1.132.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/dist/es/es2018/industries-epc.js +1070 -170
- package/dist/es/es2018/types/src/generated/adapters/getProductAttributesByProductId.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +1 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +3 -1
- package/dist/es/es2018/types/src/generated/resources/getConnectEpcProductAttributesByProductId.d.ts +19 -0
- package/dist/es/es2018/types/src/generated/types/AttributeCategoryOutputRepresentation.d.ts +39 -0
- package/dist/es/es2018/types/src/generated/types/AttributeDefinitionOutputRepresentation.d.ts +80 -0
- package/dist/es/es2018/types/src/generated/types/AttributePicklistOutputRepresentation.d.ts +45 -0
- package/dist/es/es2018/types/src/generated/types/AttributePicklistValueOutputRepresentation.d.ts +56 -0
- package/dist/es/es2018/types/src/generated/types/PriceOutputRepresentation.d.ts +44 -0
- package/dist/es/es2018/types/src/generated/types/PricingModelOutputRepresentation.d.ts +44 -0
- package/dist/es/es2018/types/src/generated/types/ProductOutputRepresentation.d.ts +66 -0
- package/dist/es/es2018/types/src/generated/types/QuantityInfo.d.ts +35 -0
- package/package.json +1 -1
- package/sfdc/index.js +1009 -101
- package/src/raml/api.raml +328 -0
- package/src/raml/luvio.raml +7 -0
|
@@ -53,20 +53,20 @@ const keyPrefix = 'epc';
|
|
|
53
53
|
const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
54
54
|
const { isArray: ArrayIsArray } = Array;
|
|
55
55
|
const { stringify: JSONStringify } = JSON;
|
|
56
|
-
function deepFreeze$
|
|
56
|
+
function deepFreeze$f(value) {
|
|
57
57
|
// No need to freeze primitives
|
|
58
58
|
if (typeof value !== 'object' || value === null) {
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
if (ArrayIsArray(value)) {
|
|
62
62
|
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
63
|
-
deepFreeze$
|
|
63
|
+
deepFreeze$f(value[i]);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
else {
|
|
67
67
|
const keys = ObjectKeys(value);
|
|
68
68
|
for (let i = 0, len = keys.length; i < len; i += 1) {
|
|
69
|
-
deepFreeze$
|
|
69
|
+
deepFreeze$f(value[keys[i]]);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
ObjectFreeze(value);
|
|
@@ -77,7 +77,7 @@ function createLink(ref) {
|
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
function validate$
|
|
80
|
+
function validate$g(obj, path = 'DeactivateInputRepresentation') {
|
|
81
81
|
const v_error = (() => {
|
|
82
82
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
83
83
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -110,7 +110,7 @@ function validate$8(obj, path = 'DeactivateInputRepresentation') {
|
|
|
110
110
|
return v_error === undefined ? null : v_error;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
function validate$
|
|
113
|
+
function validate$f(obj, path = 'ErrorOutputRepresentation') {
|
|
114
114
|
const v_error = (() => {
|
|
115
115
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
116
116
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -140,15 +140,15 @@ function validate$7(obj, path = 'ErrorOutputRepresentation') {
|
|
|
140
140
|
})();
|
|
141
141
|
return v_error === undefined ? null : v_error;
|
|
142
142
|
}
|
|
143
|
-
function deepFreeze$
|
|
143
|
+
function deepFreeze$e(input) {
|
|
144
144
|
const input_details = input.details;
|
|
145
145
|
ObjectFreeze(input_details);
|
|
146
146
|
ObjectFreeze(input);
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
const TTL$
|
|
150
|
-
const VERSION$
|
|
151
|
-
function validate$
|
|
149
|
+
const TTL$3 = 6000;
|
|
150
|
+
const VERSION$3 = "67abdeaa299bae24f468fd2e78cd1e1e";
|
|
151
|
+
function validate$e(obj, path = 'RecordIdMapOutputRepresentation') {
|
|
152
152
|
const v_error = (() => {
|
|
153
153
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
154
154
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -161,7 +161,7 @@ function validate$6(obj, path = 'RecordIdMapOutputRepresentation') {
|
|
|
161
161
|
for (let i = 0; i < obj_errors.length; i++) {
|
|
162
162
|
const obj_errors_item = obj_errors[i];
|
|
163
163
|
const path_errors_item = path_errors + '[' + i + ']';
|
|
164
|
-
const referencepath_errors_itemValidationError = validate$
|
|
164
|
+
const referencepath_errors_itemValidationError = validate$f(obj_errors_item, path_errors_item);
|
|
165
165
|
if (referencepath_errors_itemValidationError !== null) {
|
|
166
166
|
let message = 'Object doesn\'t match ErrorOutputRepresentation (at "' + path_errors_item + '")\n';
|
|
167
167
|
message += referencepath_errors_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
@@ -176,98 +176,98 @@ function validate$6(obj, path = 'RecordIdMapOutputRepresentation') {
|
|
|
176
176
|
})();
|
|
177
177
|
return v_error === undefined ? null : v_error;
|
|
178
178
|
}
|
|
179
|
-
const RepresentationType$
|
|
180
|
-
function keyBuilder$
|
|
181
|
-
return keyPrefix + '::' + RepresentationType$
|
|
179
|
+
const RepresentationType$3 = 'RecordIdMapOutputRepresentation';
|
|
180
|
+
function keyBuilder$5(luvio, config) {
|
|
181
|
+
return keyPrefix + '::' + RepresentationType$3 + ':' + config.message;
|
|
182
182
|
}
|
|
183
183
|
function keyBuilderFromType$1(luvio, object) {
|
|
184
184
|
const keyParams = {
|
|
185
185
|
message: object.status
|
|
186
186
|
};
|
|
187
|
-
return keyBuilder$
|
|
187
|
+
return keyBuilder$5(luvio, keyParams);
|
|
188
188
|
}
|
|
189
|
-
function normalize$
|
|
189
|
+
function normalize$3(input, existing, path, luvio, store, timestamp) {
|
|
190
190
|
return input;
|
|
191
191
|
}
|
|
192
|
-
const select$
|
|
192
|
+
const select$7 = function RecordIdMapOutputRepresentationSelect() {
|
|
193
193
|
return {
|
|
194
194
|
kind: 'Fragment',
|
|
195
|
-
version: VERSION$
|
|
195
|
+
version: VERSION$3,
|
|
196
196
|
private: [],
|
|
197
197
|
opaque: true
|
|
198
198
|
};
|
|
199
199
|
};
|
|
200
|
-
function equals$
|
|
200
|
+
function equals$3(existing, incoming) {
|
|
201
201
|
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
202
202
|
return false;
|
|
203
203
|
}
|
|
204
204
|
return true;
|
|
205
205
|
}
|
|
206
|
-
function deepFreeze$
|
|
206
|
+
function deepFreeze$d(input) {
|
|
207
207
|
const input_errors = input.errors;
|
|
208
208
|
for (let i = 0; i < input_errors.length; i++) {
|
|
209
209
|
const input_errors_item = input_errors[i];
|
|
210
|
-
deepFreeze$
|
|
210
|
+
deepFreeze$e(input_errors_item);
|
|
211
211
|
}
|
|
212
212
|
ObjectFreeze(input_errors);
|
|
213
213
|
ObjectFreeze(input);
|
|
214
214
|
}
|
|
215
|
-
const ingest$
|
|
215
|
+
const ingest$3 = function RecordIdMapOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
216
216
|
if (process.env.NODE_ENV !== 'production') {
|
|
217
|
-
const validateError = validate$
|
|
217
|
+
const validateError = validate$e(input);
|
|
218
218
|
if (validateError !== null) {
|
|
219
219
|
throw validateError;
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
const key = keyBuilderFromType$1(luvio, input);
|
|
223
223
|
const existingRecord = store.readEntry(key);
|
|
224
|
-
const ttlToUse = TTL$
|
|
225
|
-
let incomingRecord = normalize$
|
|
224
|
+
const ttlToUse = TTL$3;
|
|
225
|
+
let incomingRecord = normalize$3(input, store.readEntry(key), {
|
|
226
226
|
fullPath: key,
|
|
227
227
|
parent: path.parent,
|
|
228
228
|
propertyName: path.propertyName,
|
|
229
229
|
ttl: ttlToUse
|
|
230
230
|
});
|
|
231
|
-
deepFreeze$
|
|
232
|
-
if (existingRecord === undefined || equals$
|
|
231
|
+
deepFreeze$d(input);
|
|
232
|
+
if (existingRecord === undefined || equals$3(existingRecord, incomingRecord) === false) {
|
|
233
233
|
luvio.storePublish(key, incomingRecord);
|
|
234
234
|
}
|
|
235
235
|
{
|
|
236
236
|
const storeMetadataParams = {
|
|
237
237
|
ttl: ttlToUse,
|
|
238
238
|
namespace: "epc",
|
|
239
|
-
version: VERSION$
|
|
240
|
-
representationName: RepresentationType$
|
|
239
|
+
version: VERSION$3,
|
|
240
|
+
representationName: RepresentationType$3,
|
|
241
241
|
};
|
|
242
242
|
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
243
243
|
}
|
|
244
244
|
return createLink(key);
|
|
245
245
|
};
|
|
246
|
-
function getTypeCacheKeys$
|
|
246
|
+
function getTypeCacheKeys$3(luvio, input, fullPathFactory) {
|
|
247
247
|
const rootKeySet = new StoreKeyMap();
|
|
248
248
|
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
249
249
|
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
250
250
|
rootKeySet.set(rootKey, {
|
|
251
251
|
namespace: keyPrefix,
|
|
252
|
-
representationName: RepresentationType$
|
|
252
|
+
representationName: RepresentationType$3,
|
|
253
253
|
mergeable: false
|
|
254
254
|
});
|
|
255
255
|
return rootKeySet;
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
-
function select$
|
|
259
|
-
return select$
|
|
258
|
+
function select$6(luvio, params) {
|
|
259
|
+
return select$7();
|
|
260
260
|
}
|
|
261
|
-
function getResponseCacheKeys$
|
|
262
|
-
return getTypeCacheKeys$
|
|
261
|
+
function getResponseCacheKeys$3(luvio, resourceParams, response) {
|
|
262
|
+
return getTypeCacheKeys$3(luvio, response);
|
|
263
263
|
}
|
|
264
|
-
function ingestSuccess$
|
|
264
|
+
function ingestSuccess$3(luvio, resourceParams, response) {
|
|
265
265
|
const { body } = response;
|
|
266
266
|
const key = keyBuilderFromType$1(luvio, body);
|
|
267
|
-
luvio.storeIngest(key, ingest$
|
|
267
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
268
268
|
const snapshot = luvio.storeLookup({
|
|
269
269
|
recordId: key,
|
|
270
|
-
node: select$
|
|
270
|
+
node: select$6(),
|
|
271
271
|
variables: {},
|
|
272
272
|
});
|
|
273
273
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -277,7 +277,7 @@ function ingestSuccess$2(luvio, resourceParams, response) {
|
|
|
277
277
|
}
|
|
278
278
|
return snapshot;
|
|
279
279
|
}
|
|
280
|
-
function createResourceRequest$
|
|
280
|
+
function createResourceRequest$3(config) {
|
|
281
281
|
const headers = {};
|
|
282
282
|
return {
|
|
283
283
|
baseUri: '/services/data/v58.0',
|
|
@@ -298,7 +298,7 @@ const deactivate_ConfigPropertyNames = {
|
|
|
298
298
|
optional: []
|
|
299
299
|
}
|
|
300
300
|
};
|
|
301
|
-
function createResourceParams$
|
|
301
|
+
function createResourceParams$3(config) {
|
|
302
302
|
const resourceParams = {
|
|
303
303
|
body: {
|
|
304
304
|
deactivateInputPayload: config.deactivateInputPayload
|
|
@@ -306,54 +306,54 @@ function createResourceParams$2(config) {
|
|
|
306
306
|
};
|
|
307
307
|
return resourceParams;
|
|
308
308
|
}
|
|
309
|
-
function typeCheckConfig$
|
|
309
|
+
function typeCheckConfig$3(untrustedConfig) {
|
|
310
310
|
const config = {};
|
|
311
311
|
const untrustedConfig_deactivateInputPayload = untrustedConfig.deactivateInputPayload;
|
|
312
|
-
const referenceDeactivateInputRepresentationValidationError = validate$
|
|
312
|
+
const referenceDeactivateInputRepresentationValidationError = validate$g(untrustedConfig_deactivateInputPayload);
|
|
313
313
|
if (referenceDeactivateInputRepresentationValidationError === null) {
|
|
314
314
|
config.deactivateInputPayload = untrustedConfig_deactivateInputPayload;
|
|
315
315
|
}
|
|
316
316
|
return config;
|
|
317
317
|
}
|
|
318
|
-
function validateAdapterConfig$
|
|
318
|
+
function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
|
|
319
319
|
if (!untrustedIsObject(untrustedConfig)) {
|
|
320
320
|
return null;
|
|
321
321
|
}
|
|
322
322
|
if (process.env.NODE_ENV !== 'production') {
|
|
323
323
|
validateConfig(untrustedConfig, configPropertyNames);
|
|
324
324
|
}
|
|
325
|
-
const config = typeCheckConfig$
|
|
325
|
+
const config = typeCheckConfig$3(untrustedConfig);
|
|
326
326
|
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
327
327
|
return null;
|
|
328
328
|
}
|
|
329
329
|
return config;
|
|
330
330
|
}
|
|
331
|
-
function buildNetworkSnapshot$
|
|
332
|
-
const resourceParams = createResourceParams$
|
|
333
|
-
const request = createResourceRequest$
|
|
331
|
+
function buildNetworkSnapshot$3(luvio, config, options) {
|
|
332
|
+
const resourceParams = createResourceParams$3(config);
|
|
333
|
+
const request = createResourceRequest$3(resourceParams);
|
|
334
334
|
return luvio.dispatchResourceRequest(request, options)
|
|
335
335
|
.then((response) => {
|
|
336
336
|
return luvio.handleSuccessResponse(() => {
|
|
337
|
-
const snapshot = ingestSuccess$
|
|
337
|
+
const snapshot = ingestSuccess$3(luvio, resourceParams, response);
|
|
338
338
|
return luvio.storeBroadcast().then(() => snapshot);
|
|
339
|
-
}, () => getResponseCacheKeys$
|
|
339
|
+
}, () => getResponseCacheKeys$3(luvio, resourceParams, response.body));
|
|
340
340
|
}, (response) => {
|
|
341
|
-
deepFreeze$
|
|
341
|
+
deepFreeze$f(response);
|
|
342
342
|
throw response;
|
|
343
343
|
});
|
|
344
344
|
}
|
|
345
345
|
const deactivateAdapterFactory = (luvio) => {
|
|
346
346
|
return function deactivate(untrustedConfig) {
|
|
347
|
-
const config = validateAdapterConfig$
|
|
347
|
+
const config = validateAdapterConfig$3(untrustedConfig, deactivate_ConfigPropertyNames);
|
|
348
348
|
// Invalid or incomplete config
|
|
349
349
|
if (config === null) {
|
|
350
350
|
throw new Error('Invalid config for "deactivate"');
|
|
351
351
|
}
|
|
352
|
-
return buildNetworkSnapshot$
|
|
352
|
+
return buildNetworkSnapshot$3(luvio, config);
|
|
353
353
|
};
|
|
354
354
|
};
|
|
355
355
|
|
|
356
|
-
function validate$
|
|
356
|
+
function validate$d(obj, path = 'ProductAttributeDefinitionListInputRepresentation') {
|
|
357
357
|
const v_error = (() => {
|
|
358
358
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
359
359
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -374,7 +374,7 @@ function validate$5(obj, path = 'ProductAttributeDefinitionListInputRepresentati
|
|
|
374
374
|
return v_error === undefined ? null : v_error;
|
|
375
375
|
}
|
|
376
376
|
|
|
377
|
-
function validate$
|
|
377
|
+
function validate$c(obj, path = 'ProductAttributeDefinitionRepresentation') {
|
|
378
378
|
const v_error = (() => {
|
|
379
379
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
380
380
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -396,13 +396,13 @@ function validate$4(obj, path = 'ProductAttributeDefinitionRepresentation') {
|
|
|
396
396
|
})();
|
|
397
397
|
return v_error === undefined ? null : v_error;
|
|
398
398
|
}
|
|
399
|
-
function deepFreeze$
|
|
399
|
+
function deepFreeze$c(input) {
|
|
400
400
|
ObjectFreeze(input);
|
|
401
401
|
}
|
|
402
402
|
|
|
403
|
-
const TTL$
|
|
404
|
-
const VERSION$
|
|
405
|
-
function validate$
|
|
403
|
+
const TTL$2 = 6000;
|
|
404
|
+
const VERSION$2 = "e67d3c8569b9667eac98cc1a9840041c";
|
|
405
|
+
function validate$b(obj, path = 'ProductAttributeDefinitionListRepresentation') {
|
|
406
406
|
const v_error = (() => {
|
|
407
407
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
408
408
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -415,7 +415,7 @@ function validate$3(obj, path = 'ProductAttributeDefinitionListRepresentation')
|
|
|
415
415
|
for (let i = 0; i < obj_data.length; i++) {
|
|
416
416
|
const obj_data_item = obj_data[i];
|
|
417
417
|
const path_data_item = path_data + '[' + i + ']';
|
|
418
|
-
const referencepath_data_itemValidationError = validate$
|
|
418
|
+
const referencepath_data_itemValidationError = validate$c(obj_data_item, path_data_item);
|
|
419
419
|
if (referencepath_data_itemValidationError !== null) {
|
|
420
420
|
let message = 'Object doesn\'t match ProductAttributeDefinitionRepresentation (at "' + path_data_item + '")\n';
|
|
421
421
|
message += referencepath_data_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
@@ -430,98 +430,98 @@ function validate$3(obj, path = 'ProductAttributeDefinitionListRepresentation')
|
|
|
430
430
|
})();
|
|
431
431
|
return v_error === undefined ? null : v_error;
|
|
432
432
|
}
|
|
433
|
-
const RepresentationType$
|
|
434
|
-
function keyBuilder$
|
|
435
|
-
return keyPrefix + '::' + RepresentationType$
|
|
433
|
+
const RepresentationType$2 = 'ProductAttributeDefinitionListRepresentation';
|
|
434
|
+
function keyBuilder$4(luvio, config) {
|
|
435
|
+
return keyPrefix + '::' + RepresentationType$2 + ':' + config.message;
|
|
436
436
|
}
|
|
437
437
|
function keyBuilderFromType(luvio, object) {
|
|
438
438
|
const keyParams = {
|
|
439
439
|
message: object.message
|
|
440
440
|
};
|
|
441
|
-
return keyBuilder$
|
|
441
|
+
return keyBuilder$4(luvio, keyParams);
|
|
442
442
|
}
|
|
443
|
-
function normalize$
|
|
443
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
444
444
|
return input;
|
|
445
445
|
}
|
|
446
|
-
const select$
|
|
446
|
+
const select$5 = function ProductAttributeDefinitionListRepresentationSelect() {
|
|
447
447
|
return {
|
|
448
448
|
kind: 'Fragment',
|
|
449
|
-
version: VERSION$
|
|
449
|
+
version: VERSION$2,
|
|
450
450
|
private: [],
|
|
451
451
|
opaque: true
|
|
452
452
|
};
|
|
453
453
|
};
|
|
454
|
-
function equals$
|
|
454
|
+
function equals$2(existing, incoming) {
|
|
455
455
|
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
456
456
|
return false;
|
|
457
457
|
}
|
|
458
458
|
return true;
|
|
459
459
|
}
|
|
460
|
-
function deepFreeze$
|
|
460
|
+
function deepFreeze$b(input) {
|
|
461
461
|
const input_data = input.data;
|
|
462
462
|
for (let i = 0; i < input_data.length; i++) {
|
|
463
463
|
const input_data_item = input_data[i];
|
|
464
|
-
deepFreeze$
|
|
464
|
+
deepFreeze$c(input_data_item);
|
|
465
465
|
}
|
|
466
466
|
ObjectFreeze(input_data);
|
|
467
467
|
ObjectFreeze(input);
|
|
468
468
|
}
|
|
469
|
-
const ingest$
|
|
469
|
+
const ingest$2 = function ProductAttributeDefinitionListRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
470
470
|
if (process.env.NODE_ENV !== 'production') {
|
|
471
|
-
const validateError = validate$
|
|
471
|
+
const validateError = validate$b(input);
|
|
472
472
|
if (validateError !== null) {
|
|
473
473
|
throw validateError;
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
476
|
const key = keyBuilderFromType(luvio, input);
|
|
477
477
|
const existingRecord = store.readEntry(key);
|
|
478
|
-
const ttlToUse = TTL$
|
|
479
|
-
let incomingRecord = normalize$
|
|
478
|
+
const ttlToUse = TTL$2;
|
|
479
|
+
let incomingRecord = normalize$2(input, store.readEntry(key), {
|
|
480
480
|
fullPath: key,
|
|
481
481
|
parent: path.parent,
|
|
482
482
|
propertyName: path.propertyName,
|
|
483
483
|
ttl: ttlToUse
|
|
484
484
|
});
|
|
485
|
-
deepFreeze$
|
|
486
|
-
if (existingRecord === undefined || equals$
|
|
485
|
+
deepFreeze$b(input);
|
|
486
|
+
if (existingRecord === undefined || equals$2(existingRecord, incomingRecord) === false) {
|
|
487
487
|
luvio.storePublish(key, incomingRecord);
|
|
488
488
|
}
|
|
489
489
|
{
|
|
490
490
|
const storeMetadataParams = {
|
|
491
491
|
ttl: ttlToUse,
|
|
492
492
|
namespace: "epc",
|
|
493
|
-
version: VERSION$
|
|
494
|
-
representationName: RepresentationType$
|
|
493
|
+
version: VERSION$2,
|
|
494
|
+
representationName: RepresentationType$2,
|
|
495
495
|
};
|
|
496
496
|
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
497
497
|
}
|
|
498
498
|
return createLink(key);
|
|
499
499
|
};
|
|
500
|
-
function getTypeCacheKeys$
|
|
500
|
+
function getTypeCacheKeys$2(luvio, input, fullPathFactory) {
|
|
501
501
|
const rootKeySet = new StoreKeyMap();
|
|
502
502
|
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
503
503
|
const rootKey = keyBuilderFromType(luvio, input);
|
|
504
504
|
rootKeySet.set(rootKey, {
|
|
505
505
|
namespace: keyPrefix,
|
|
506
|
-
representationName: RepresentationType$
|
|
506
|
+
representationName: RepresentationType$2,
|
|
507
507
|
mergeable: false
|
|
508
508
|
});
|
|
509
509
|
return rootKeySet;
|
|
510
510
|
}
|
|
511
511
|
|
|
512
|
-
function select$
|
|
513
|
-
return select$
|
|
512
|
+
function select$4(luvio, params) {
|
|
513
|
+
return select$5();
|
|
514
514
|
}
|
|
515
|
-
function getResponseCacheKeys$
|
|
516
|
-
return getTypeCacheKeys$
|
|
515
|
+
function getResponseCacheKeys$2(luvio, resourceParams, response) {
|
|
516
|
+
return getTypeCacheKeys$2(luvio, response);
|
|
517
517
|
}
|
|
518
|
-
function ingestSuccess$
|
|
518
|
+
function ingestSuccess$2(luvio, resourceParams, response) {
|
|
519
519
|
const { body } = response;
|
|
520
520
|
const key = keyBuilderFromType(luvio, body);
|
|
521
|
-
luvio.storeIngest(key, ingest$
|
|
521
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
522
522
|
const snapshot = luvio.storeLookup({
|
|
523
523
|
recordId: key,
|
|
524
|
-
node: select$
|
|
524
|
+
node: select$4(),
|
|
525
525
|
variables: {},
|
|
526
526
|
});
|
|
527
527
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -531,7 +531,7 @@ function ingestSuccess$1(luvio, resourceParams, response) {
|
|
|
531
531
|
}
|
|
532
532
|
return snapshot;
|
|
533
533
|
}
|
|
534
|
-
function createResourceRequest$
|
|
534
|
+
function createResourceRequest$2(config) {
|
|
535
535
|
const headers = {};
|
|
536
536
|
return {
|
|
537
537
|
baseUri: '/services/data/v58.0',
|
|
@@ -552,7 +552,7 @@ const createProductAttributeDefinition_ConfigPropertyNames = {
|
|
|
552
552
|
optional: []
|
|
553
553
|
}
|
|
554
554
|
};
|
|
555
|
-
function createResourceParams$
|
|
555
|
+
function createResourceParams$2(config) {
|
|
556
556
|
const resourceParams = {
|
|
557
557
|
body: {
|
|
558
558
|
productAttributeDefinitionListInputPayload: config.productAttributeDefinitionListInputPayload
|
|
@@ -560,54 +560,54 @@ function createResourceParams$1(config) {
|
|
|
560
560
|
};
|
|
561
561
|
return resourceParams;
|
|
562
562
|
}
|
|
563
|
-
function typeCheckConfig$
|
|
563
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
564
564
|
const config = {};
|
|
565
565
|
const untrustedConfig_productAttributeDefinitionListInputPayload = untrustedConfig.productAttributeDefinitionListInputPayload;
|
|
566
|
-
const referenceProductAttributeDefinitionListInputRepresentationValidationError = validate$
|
|
566
|
+
const referenceProductAttributeDefinitionListInputRepresentationValidationError = validate$d(untrustedConfig_productAttributeDefinitionListInputPayload);
|
|
567
567
|
if (referenceProductAttributeDefinitionListInputRepresentationValidationError === null) {
|
|
568
568
|
config.productAttributeDefinitionListInputPayload = untrustedConfig_productAttributeDefinitionListInputPayload;
|
|
569
569
|
}
|
|
570
570
|
return config;
|
|
571
571
|
}
|
|
572
|
-
function validateAdapterConfig$
|
|
572
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
573
573
|
if (!untrustedIsObject(untrustedConfig)) {
|
|
574
574
|
return null;
|
|
575
575
|
}
|
|
576
576
|
if (process.env.NODE_ENV !== 'production') {
|
|
577
577
|
validateConfig(untrustedConfig, configPropertyNames);
|
|
578
578
|
}
|
|
579
|
-
const config = typeCheckConfig$
|
|
579
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
580
580
|
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
581
581
|
return null;
|
|
582
582
|
}
|
|
583
583
|
return config;
|
|
584
584
|
}
|
|
585
|
-
function buildNetworkSnapshot$
|
|
586
|
-
const resourceParams = createResourceParams$
|
|
587
|
-
const request = createResourceRequest$
|
|
585
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
586
|
+
const resourceParams = createResourceParams$2(config);
|
|
587
|
+
const request = createResourceRequest$2(resourceParams);
|
|
588
588
|
return luvio.dispatchResourceRequest(request, options)
|
|
589
589
|
.then((response) => {
|
|
590
590
|
return luvio.handleSuccessResponse(() => {
|
|
591
|
-
const snapshot = ingestSuccess$
|
|
591
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response);
|
|
592
592
|
return luvio.storeBroadcast().then(() => snapshot);
|
|
593
|
-
}, () => getResponseCacheKeys$
|
|
593
|
+
}, () => getResponseCacheKeys$2(luvio, resourceParams, response.body));
|
|
594
594
|
}, (response) => {
|
|
595
|
-
deepFreeze$
|
|
595
|
+
deepFreeze$f(response);
|
|
596
596
|
throw response;
|
|
597
597
|
});
|
|
598
598
|
}
|
|
599
599
|
const createProductAttributeDefinitionAdapterFactory = (luvio) => {
|
|
600
600
|
return function createProductAttributeDefinition(untrustedConfig) {
|
|
601
|
-
const config = validateAdapterConfig$
|
|
601
|
+
const config = validateAdapterConfig$2(untrustedConfig, createProductAttributeDefinition_ConfigPropertyNames);
|
|
602
602
|
// Invalid or incomplete config
|
|
603
603
|
if (config === null) {
|
|
604
604
|
throw new Error('Invalid config for "createProductAttributeDefinition"');
|
|
605
605
|
}
|
|
606
|
-
return buildNetworkSnapshot$
|
|
606
|
+
return buildNetworkSnapshot$2(luvio, config);
|
|
607
607
|
};
|
|
608
608
|
};
|
|
609
609
|
|
|
610
|
-
function validate$
|
|
610
|
+
function validate$a(obj, path = 'ProductFlowConnectRepresentation') {
|
|
611
611
|
const v_error = (() => {
|
|
612
612
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
613
613
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -622,11 +622,11 @@ function validate$2(obj, path = 'ProductFlowConnectRepresentation') {
|
|
|
622
622
|
})();
|
|
623
623
|
return v_error === undefined ? null : v_error;
|
|
624
624
|
}
|
|
625
|
-
function deepFreeze$
|
|
625
|
+
function deepFreeze$a(input) {
|
|
626
626
|
ObjectFreeze(input);
|
|
627
627
|
}
|
|
628
628
|
|
|
629
|
-
function validate$
|
|
629
|
+
function validate$9(obj, path = 'Status') {
|
|
630
630
|
const v_error = (() => {
|
|
631
631
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
632
632
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -644,13 +644,13 @@ function validate$1(obj, path = 'Status') {
|
|
|
644
644
|
})();
|
|
645
645
|
return v_error === undefined ? null : v_error;
|
|
646
646
|
}
|
|
647
|
-
function deepFreeze$
|
|
647
|
+
function deepFreeze$9(input) {
|
|
648
648
|
ObjectFreeze(input);
|
|
649
649
|
}
|
|
650
650
|
|
|
651
|
-
const TTL = 6000;
|
|
652
|
-
const VERSION = "a75aed3c640fb969c24561ef4f8cb169";
|
|
653
|
-
function validate(obj, path = 'ProductFlowOutputRepresentation') {
|
|
651
|
+
const TTL$1 = 6000;
|
|
652
|
+
const VERSION$1 = "a75aed3c640fb969c24561ef4f8cb169";
|
|
653
|
+
function validate$8(obj, path = 'ProductFlowOutputRepresentation') {
|
|
654
654
|
const v_error = (() => {
|
|
655
655
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
656
656
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -665,7 +665,7 @@ function validate(obj, path = 'ProductFlowOutputRepresentation') {
|
|
|
665
665
|
if (obj.productFlow !== undefined) {
|
|
666
666
|
const obj_productFlow = obj.productFlow;
|
|
667
667
|
const path_productFlow = path + '.productFlow';
|
|
668
|
-
const referencepath_productFlowValidationError = validate$
|
|
668
|
+
const referencepath_productFlowValidationError = validate$a(obj_productFlow, path_productFlow);
|
|
669
669
|
if (referencepath_productFlowValidationError !== null) {
|
|
670
670
|
let message = 'Object doesn\'t match ProductFlowConnectRepresentation (at "' + path_productFlow + '")\n';
|
|
671
671
|
message += referencepath_productFlowValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
@@ -675,7 +675,7 @@ function validate(obj, path = 'ProductFlowOutputRepresentation') {
|
|
|
675
675
|
if (obj.status !== undefined) {
|
|
676
676
|
const obj_status = obj.status;
|
|
677
677
|
const path_status = path + '.status';
|
|
678
|
-
const referencepath_statusValidationError = validate$
|
|
678
|
+
const referencepath_statusValidationError = validate$9(obj_status, path_status);
|
|
679
679
|
if (referencepath_statusValidationError !== null) {
|
|
680
680
|
let message = 'Object doesn\'t match Status (at "' + path_status + '")\n';
|
|
681
681
|
message += referencepath_statusValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
@@ -685,94 +685,94 @@ function validate(obj, path = 'ProductFlowOutputRepresentation') {
|
|
|
685
685
|
})();
|
|
686
686
|
return v_error === undefined ? null : v_error;
|
|
687
687
|
}
|
|
688
|
-
const RepresentationType = 'ProductFlowOutputRepresentation';
|
|
689
|
-
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
688
|
+
const RepresentationType$1 = 'ProductFlowOutputRepresentation';
|
|
689
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
690
690
|
return input;
|
|
691
691
|
}
|
|
692
|
-
const select$
|
|
692
|
+
const select$3 = function ProductFlowOutputRepresentationSelect() {
|
|
693
693
|
return {
|
|
694
694
|
kind: 'Fragment',
|
|
695
|
-
version: VERSION,
|
|
695
|
+
version: VERSION$1,
|
|
696
696
|
private: [],
|
|
697
697
|
opaque: true
|
|
698
698
|
};
|
|
699
699
|
};
|
|
700
|
-
function equals(existing, incoming) {
|
|
700
|
+
function equals$1(existing, incoming) {
|
|
701
701
|
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
702
702
|
return false;
|
|
703
703
|
}
|
|
704
704
|
return true;
|
|
705
705
|
}
|
|
706
|
-
function deepFreeze(input) {
|
|
706
|
+
function deepFreeze$8(input) {
|
|
707
707
|
const input_productFlow = input.productFlow;
|
|
708
708
|
if (input_productFlow !== undefined) {
|
|
709
|
-
deepFreeze$
|
|
709
|
+
deepFreeze$a(input_productFlow);
|
|
710
710
|
}
|
|
711
711
|
const input_status = input.status;
|
|
712
712
|
if (input_status !== undefined) {
|
|
713
|
-
deepFreeze$
|
|
713
|
+
deepFreeze$9(input_status);
|
|
714
714
|
}
|
|
715
715
|
ObjectFreeze(input);
|
|
716
716
|
}
|
|
717
|
-
const ingest = function ProductFlowOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
717
|
+
const ingest$1 = function ProductFlowOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
718
718
|
if (process.env.NODE_ENV !== 'production') {
|
|
719
|
-
const validateError = validate(input);
|
|
719
|
+
const validateError = validate$8(input);
|
|
720
720
|
if (validateError !== null) {
|
|
721
721
|
throw validateError;
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
724
|
const key = path.fullPath;
|
|
725
725
|
const existingRecord = store.readEntry(key);
|
|
726
|
-
const ttlToUse = TTL;
|
|
727
|
-
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
726
|
+
const ttlToUse = TTL$1;
|
|
727
|
+
let incomingRecord = normalize$1(input, store.readEntry(key), {
|
|
728
728
|
fullPath: key,
|
|
729
729
|
parent: path.parent,
|
|
730
730
|
propertyName: path.propertyName,
|
|
731
731
|
ttl: ttlToUse
|
|
732
732
|
});
|
|
733
|
-
deepFreeze(input);
|
|
734
|
-
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
733
|
+
deepFreeze$8(input);
|
|
734
|
+
if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
|
|
735
735
|
luvio.storePublish(key, incomingRecord);
|
|
736
736
|
}
|
|
737
737
|
{
|
|
738
738
|
const storeMetadataParams = {
|
|
739
739
|
ttl: ttlToUse,
|
|
740
740
|
namespace: "epc",
|
|
741
|
-
version: VERSION,
|
|
742
|
-
representationName: RepresentationType,
|
|
741
|
+
version: VERSION$1,
|
|
742
|
+
representationName: RepresentationType$1,
|
|
743
743
|
};
|
|
744
744
|
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
745
745
|
}
|
|
746
746
|
return createLink(key);
|
|
747
747
|
};
|
|
748
|
-
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
748
|
+
function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
|
|
749
749
|
const rootKeySet = new StoreKeyMap();
|
|
750
750
|
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
751
751
|
const rootKey = fullPathFactory();
|
|
752
752
|
rootKeySet.set(rootKey, {
|
|
753
753
|
namespace: keyPrefix,
|
|
754
|
-
representationName: RepresentationType,
|
|
754
|
+
representationName: RepresentationType$1,
|
|
755
755
|
mergeable: false
|
|
756
756
|
});
|
|
757
757
|
return rootKeySet;
|
|
758
758
|
}
|
|
759
759
|
|
|
760
|
-
function select(luvio, params) {
|
|
761
|
-
return select$
|
|
760
|
+
function select$2(luvio, params) {
|
|
761
|
+
return select$3();
|
|
762
762
|
}
|
|
763
|
-
function keyBuilder$
|
|
763
|
+
function keyBuilder$3(luvio, params) {
|
|
764
764
|
return keyPrefix + '::ProductFlowOutputRepresentation:(' + 'correlationId:' + params.queryParams.correlationId + ',' + 'productId:' + params.urlParams.productId + ')';
|
|
765
765
|
}
|
|
766
|
-
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
767
|
-
return getTypeCacheKeys(luvio, response, () => keyBuilder$
|
|
766
|
+
function getResponseCacheKeys$1(luvio, resourceParams, response) {
|
|
767
|
+
return getTypeCacheKeys$1(luvio, response, () => keyBuilder$3(luvio, resourceParams));
|
|
768
768
|
}
|
|
769
|
-
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
769
|
+
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
770
770
|
const { body } = response;
|
|
771
|
-
const key = keyBuilder$
|
|
772
|
-
luvio.storeIngest(key, ingest, body);
|
|
771
|
+
const key = keyBuilder$3(luvio, resourceParams);
|
|
772
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
773
773
|
const snapshot = luvio.storeLookup({
|
|
774
774
|
recordId: key,
|
|
775
|
-
node: select(),
|
|
775
|
+
node: select$2(),
|
|
776
776
|
variables: {},
|
|
777
777
|
}, snapshotRefresh);
|
|
778
778
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -782,19 +782,19 @@ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
|
782
782
|
}
|
|
783
783
|
return snapshot;
|
|
784
784
|
}
|
|
785
|
-
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
786
|
-
const key = keyBuilder$
|
|
785
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
786
|
+
const key = keyBuilder$3(luvio, params);
|
|
787
787
|
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
788
788
|
const storeMetadataParams = {
|
|
789
|
-
ttl: TTL,
|
|
789
|
+
ttl: TTL$1,
|
|
790
790
|
namespace: keyPrefix,
|
|
791
|
-
version: VERSION,
|
|
792
|
-
representationName: RepresentationType
|
|
791
|
+
version: VERSION$1,
|
|
792
|
+
representationName: RepresentationType$1
|
|
793
793
|
};
|
|
794
794
|
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
795
795
|
return errorSnapshot;
|
|
796
796
|
}
|
|
797
|
-
function createResourceRequest(config) {
|
|
797
|
+
function createResourceRequest$1(config) {
|
|
798
798
|
const headers = {};
|
|
799
799
|
return {
|
|
800
800
|
baseUri: '/services/data/v58.0',
|
|
@@ -815,7 +815,7 @@ const getProductFlowByProductId_ConfigPropertyNames = {
|
|
|
815
815
|
optional: ['correlationId']
|
|
816
816
|
}
|
|
817
817
|
};
|
|
818
|
-
function createResourceParams(config) {
|
|
818
|
+
function createResourceParams$1(config) {
|
|
819
819
|
const resourceParams = {
|
|
820
820
|
urlParams: {
|
|
821
821
|
productId: config.productId
|
|
@@ -826,11 +826,11 @@ function createResourceParams(config) {
|
|
|
826
826
|
};
|
|
827
827
|
return resourceParams;
|
|
828
828
|
}
|
|
829
|
-
function keyBuilder(luvio, config) {
|
|
830
|
-
const resourceParams = createResourceParams(config);
|
|
831
|
-
return keyBuilder$
|
|
829
|
+
function keyBuilder$2(luvio, config) {
|
|
830
|
+
const resourceParams = createResourceParams$1(config);
|
|
831
|
+
return keyBuilder$3(luvio, resourceParams);
|
|
832
832
|
}
|
|
833
|
-
function typeCheckConfig(untrustedConfig) {
|
|
833
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
834
834
|
const config = {};
|
|
835
835
|
const untrustedConfig_productId = untrustedConfig.productId;
|
|
836
836
|
if (typeof untrustedConfig_productId === 'string') {
|
|
@@ -842,48 +842,48 @@ function typeCheckConfig(untrustedConfig) {
|
|
|
842
842
|
}
|
|
843
843
|
return config;
|
|
844
844
|
}
|
|
845
|
-
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
845
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
846
846
|
if (!untrustedIsObject(untrustedConfig)) {
|
|
847
847
|
return null;
|
|
848
848
|
}
|
|
849
849
|
if (process.env.NODE_ENV !== 'production') {
|
|
850
850
|
validateConfig(untrustedConfig, configPropertyNames);
|
|
851
851
|
}
|
|
852
|
-
const config = typeCheckConfig(untrustedConfig);
|
|
852
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
853
853
|
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
854
854
|
return null;
|
|
855
855
|
}
|
|
856
856
|
return config;
|
|
857
857
|
}
|
|
858
|
-
function adapterFragment(luvio, config) {
|
|
859
|
-
createResourceParams(config);
|
|
860
|
-
return select();
|
|
858
|
+
function adapterFragment$1(luvio, config) {
|
|
859
|
+
createResourceParams$1(config);
|
|
860
|
+
return select$2();
|
|
861
861
|
}
|
|
862
|
-
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
863
|
-
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
862
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
863
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
864
864
|
config,
|
|
865
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
865
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
866
866
|
});
|
|
867
867
|
return luvio.storeBroadcast().then(() => snapshot);
|
|
868
868
|
}
|
|
869
|
-
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
870
|
-
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
869
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
870
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
871
871
|
config,
|
|
872
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
872
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
873
873
|
});
|
|
874
874
|
return luvio.storeBroadcast().then(() => snapshot);
|
|
875
875
|
}
|
|
876
|
-
function buildNetworkSnapshot(luvio, config, options) {
|
|
877
|
-
const resourceParams = createResourceParams(config);
|
|
878
|
-
const request = createResourceRequest(resourceParams);
|
|
876
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
877
|
+
const resourceParams = createResourceParams$1(config);
|
|
878
|
+
const request = createResourceRequest$1(resourceParams);
|
|
879
879
|
return luvio.dispatchResourceRequest(request, options)
|
|
880
880
|
.then((response) => {
|
|
881
|
-
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
881
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
|
|
882
882
|
}, (response) => {
|
|
883
|
-
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
883
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
884
884
|
});
|
|
885
885
|
}
|
|
886
|
-
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
886
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
887
887
|
const { luvio, config } = context;
|
|
888
888
|
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
889
889
|
const dispatchOptions = {
|
|
@@ -898,23 +898,923 @@ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext)
|
|
|
898
898
|
priority: networkPriority
|
|
899
899
|
};
|
|
900
900
|
}
|
|
901
|
-
return buildNetworkSnapshot(luvio, config, dispatchOptions);
|
|
901
|
+
return buildNetworkSnapshot$1(luvio, config, dispatchOptions);
|
|
902
902
|
}
|
|
903
|
-
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
903
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
904
904
|
const { luvio, config } = context;
|
|
905
905
|
const selector = {
|
|
906
|
-
recordId: keyBuilder(luvio, config),
|
|
907
|
-
node: adapterFragment(luvio, config),
|
|
906
|
+
recordId: keyBuilder$2(luvio, config),
|
|
907
|
+
node: adapterFragment$1(luvio, config),
|
|
908
908
|
variables: {},
|
|
909
909
|
};
|
|
910
910
|
const cacheSnapshot = storeLookup(selector, {
|
|
911
911
|
config,
|
|
912
|
-
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
912
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
913
913
|
});
|
|
914
914
|
return cacheSnapshot;
|
|
915
915
|
}
|
|
916
916
|
const getProductFlowByProductIdAdapterFactory = (luvio) => function epc__getProductFlowByProductId(untrustedConfig, requestContext) {
|
|
917
|
-
const config = validateAdapterConfig(untrustedConfig, getProductFlowByProductId_ConfigPropertyNames);
|
|
917
|
+
const config = validateAdapterConfig$1(untrustedConfig, getProductFlowByProductId_ConfigPropertyNames);
|
|
918
|
+
// Invalid or incomplete config
|
|
919
|
+
if (config === null) {
|
|
920
|
+
return null;
|
|
921
|
+
}
|
|
922
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
923
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
924
|
+
};
|
|
925
|
+
|
|
926
|
+
function validate$7(obj, path = 'AttributePicklistValueOutputRepresentation') {
|
|
927
|
+
const v_error = (() => {
|
|
928
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
929
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
930
|
+
}
|
|
931
|
+
if (obj.abbreviation !== undefined) {
|
|
932
|
+
const obj_abbreviation = obj.abbreviation;
|
|
933
|
+
const path_abbreviation = path + '.abbreviation';
|
|
934
|
+
if (typeof obj_abbreviation !== 'string') {
|
|
935
|
+
return new TypeError('Expected "string" but received "' + typeof obj_abbreviation + '" (at "' + path_abbreviation + '")');
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
if (obj.code !== undefined) {
|
|
939
|
+
const obj_code = obj.code;
|
|
940
|
+
const path_code = path + '.code';
|
|
941
|
+
if (typeof obj_code !== 'string') {
|
|
942
|
+
return new TypeError('Expected "string" but received "' + typeof obj_code + '" (at "' + path_code + '")');
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
if (obj.displayValue !== undefined) {
|
|
946
|
+
const obj_displayValue = obj.displayValue;
|
|
947
|
+
const path_displayValue = path + '.displayValue';
|
|
948
|
+
if (typeof obj_displayValue !== 'string') {
|
|
949
|
+
return new TypeError('Expected "string" but received "' + typeof obj_displayValue + '" (at "' + path_displayValue + '")');
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
if (obj.id !== undefined) {
|
|
953
|
+
const obj_id = obj.id;
|
|
954
|
+
const path_id = path + '.id';
|
|
955
|
+
if (typeof obj_id !== 'string') {
|
|
956
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
if (obj.isBooleanValue !== undefined) {
|
|
960
|
+
const obj_isBooleanValue = obj.isBooleanValue;
|
|
961
|
+
const path_isBooleanValue = path + '.isBooleanValue';
|
|
962
|
+
if (typeof obj_isBooleanValue !== 'boolean') {
|
|
963
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isBooleanValue + '" (at "' + path_isBooleanValue + '")');
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
if (obj.isDefault !== undefined) {
|
|
967
|
+
const obj_isDefault = obj.isDefault;
|
|
968
|
+
const path_isDefault = path + '.isDefault';
|
|
969
|
+
if (typeof obj_isDefault !== 'boolean') {
|
|
970
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isDefault + '" (at "' + path_isDefault + '")');
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
if (obj.label !== undefined) {
|
|
974
|
+
const obj_label = obj.label;
|
|
975
|
+
const path_label = path + '.label';
|
|
976
|
+
if (typeof obj_label !== 'string') {
|
|
977
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
if (obj.name !== undefined) {
|
|
981
|
+
const obj_name = obj.name;
|
|
982
|
+
const path_name = path + '.name';
|
|
983
|
+
if (typeof obj_name !== 'string') {
|
|
984
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
if (obj.sequence !== undefined) {
|
|
988
|
+
const obj_sequence = obj.sequence;
|
|
989
|
+
const path_sequence = path + '.sequence';
|
|
990
|
+
if (typeof obj_sequence !== 'string') {
|
|
991
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sequence + '" (at "' + path_sequence + '")');
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
if (obj.textValue !== undefined) {
|
|
995
|
+
const obj_textValue = obj.textValue;
|
|
996
|
+
const path_textValue = path + '.textValue';
|
|
997
|
+
if (typeof obj_textValue !== 'string') {
|
|
998
|
+
return new TypeError('Expected "string" but received "' + typeof obj_textValue + '" (at "' + path_textValue + '")');
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
})();
|
|
1002
|
+
return v_error === undefined ? null : v_error;
|
|
1003
|
+
}
|
|
1004
|
+
function deepFreeze$7(input) {
|
|
1005
|
+
ObjectFreeze(input);
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
function validate$6(obj, path = 'AttributePicklistOutputRepresentation') {
|
|
1009
|
+
const v_error = (() => {
|
|
1010
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1011
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1012
|
+
}
|
|
1013
|
+
if (obj.code !== undefined) {
|
|
1014
|
+
const obj_code = obj.code;
|
|
1015
|
+
const path_code = path + '.code';
|
|
1016
|
+
if (typeof obj_code !== 'string') {
|
|
1017
|
+
return new TypeError('Expected "string" but received "' + typeof obj_code + '" (at "' + path_code + '")');
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
if (obj.dataType !== undefined) {
|
|
1021
|
+
const obj_dataType = obj.dataType;
|
|
1022
|
+
const path_dataType = path + '.dataType';
|
|
1023
|
+
if (typeof obj_dataType !== 'string') {
|
|
1024
|
+
return new TypeError('Expected "string" but received "' + typeof obj_dataType + '" (at "' + path_dataType + '")');
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
if (obj.description !== undefined) {
|
|
1028
|
+
const obj_description = obj.description;
|
|
1029
|
+
const path_description = path + '.description';
|
|
1030
|
+
if (typeof obj_description !== 'string') {
|
|
1031
|
+
return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
if (obj.id !== undefined) {
|
|
1035
|
+
const obj_id = obj.id;
|
|
1036
|
+
const path_id = path + '.id';
|
|
1037
|
+
if (typeof obj_id !== 'string') {
|
|
1038
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
if (obj.name !== undefined) {
|
|
1042
|
+
const obj_name = obj.name;
|
|
1043
|
+
const path_name = path + '.name';
|
|
1044
|
+
if (typeof obj_name !== 'string') {
|
|
1045
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
if (obj.values !== undefined) {
|
|
1049
|
+
const obj_values = obj.values;
|
|
1050
|
+
const path_values = path + '.values';
|
|
1051
|
+
if (!ArrayIsArray(obj_values)) {
|
|
1052
|
+
return new TypeError('Expected "array" but received "' + typeof obj_values + '" (at "' + path_values + '")');
|
|
1053
|
+
}
|
|
1054
|
+
for (let i = 0; i < obj_values.length; i++) {
|
|
1055
|
+
const obj_values_item = obj_values[i];
|
|
1056
|
+
const path_values_item = path_values + '[' + i + ']';
|
|
1057
|
+
const referencepath_values_itemValidationError = validate$7(obj_values_item, path_values_item);
|
|
1058
|
+
if (referencepath_values_itemValidationError !== null) {
|
|
1059
|
+
let message = 'Object doesn\'t match AttributePicklistValueOutputRepresentation (at "' + path_values_item + '")\n';
|
|
1060
|
+
message += referencepath_values_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1061
|
+
return new TypeError(message);
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
})();
|
|
1066
|
+
return v_error === undefined ? null : v_error;
|
|
1067
|
+
}
|
|
1068
|
+
function deepFreeze$6(input) {
|
|
1069
|
+
const input_values = input.values;
|
|
1070
|
+
if (input_values !== undefined) {
|
|
1071
|
+
for (let i = 0; i < input_values.length; i++) {
|
|
1072
|
+
const input_values_item = input_values[i];
|
|
1073
|
+
deepFreeze$7(input_values_item);
|
|
1074
|
+
}
|
|
1075
|
+
ObjectFreeze(input_values);
|
|
1076
|
+
}
|
|
1077
|
+
ObjectFreeze(input);
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
function validate$5(obj, path = 'AttributeDefinitionOutputRepresentation') {
|
|
1081
|
+
const v_error = (() => {
|
|
1082
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1083
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1084
|
+
}
|
|
1085
|
+
if (obj.code !== undefined) {
|
|
1086
|
+
const obj_code = obj.code;
|
|
1087
|
+
const path_code = path + '.code';
|
|
1088
|
+
if (typeof obj_code !== 'string') {
|
|
1089
|
+
return new TypeError('Expected "string" but received "' + typeof obj_code + '" (at "' + path_code + '")');
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
if (obj.dataType !== undefined) {
|
|
1093
|
+
const obj_dataType = obj.dataType;
|
|
1094
|
+
const path_dataType = path + '.dataType';
|
|
1095
|
+
if (typeof obj_dataType !== 'string') {
|
|
1096
|
+
return new TypeError('Expected "string" but received "' + typeof obj_dataType + '" (at "' + path_dataType + '")');
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
if (obj.defaultHelpText !== undefined) {
|
|
1100
|
+
const obj_defaultHelpText = obj.defaultHelpText;
|
|
1101
|
+
const path_defaultHelpText = path + '.defaultHelpText';
|
|
1102
|
+
if (typeof obj_defaultHelpText !== 'string') {
|
|
1103
|
+
return new TypeError('Expected "string" but received "' + typeof obj_defaultHelpText + '" (at "' + path_defaultHelpText + '")');
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
if (obj.defaultValue !== undefined) {
|
|
1107
|
+
const obj_defaultValue = obj.defaultValue;
|
|
1108
|
+
const path_defaultValue = path + '.defaultValue';
|
|
1109
|
+
if (typeof obj_defaultValue !== 'string') {
|
|
1110
|
+
return new TypeError('Expected "string" but received "' + typeof obj_defaultValue + '" (at "' + path_defaultValue + '")');
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
if (obj.description !== undefined) {
|
|
1114
|
+
const obj_description = obj.description;
|
|
1115
|
+
const path_description = path + '.description';
|
|
1116
|
+
if (typeof obj_description !== 'string') {
|
|
1117
|
+
return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
if (obj.id !== undefined) {
|
|
1121
|
+
const obj_id = obj.id;
|
|
1122
|
+
const path_id = path + '.id';
|
|
1123
|
+
if (typeof obj_id !== 'string') {
|
|
1124
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
if (obj.isActive !== undefined) {
|
|
1128
|
+
const obj_isActive = obj.isActive;
|
|
1129
|
+
const path_isActive = path + '.isActive';
|
|
1130
|
+
if (typeof obj_isActive !== 'boolean') {
|
|
1131
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isActive + '" (at "' + path_isActive + '")');
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
if (obj.isCloneable !== undefined) {
|
|
1135
|
+
const obj_isCloneable = obj.isCloneable;
|
|
1136
|
+
const path_isCloneable = path + '.isCloneable';
|
|
1137
|
+
if (typeof obj_isCloneable !== 'boolean') {
|
|
1138
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isCloneable + '" (at "' + path_isCloneable + '")');
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
if (obj.isConfigurable !== undefined) {
|
|
1142
|
+
const obj_isConfigurable = obj.isConfigurable;
|
|
1143
|
+
const path_isConfigurable = path + '.isConfigurable';
|
|
1144
|
+
if (typeof obj_isConfigurable !== 'boolean') {
|
|
1145
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isConfigurable + '" (at "' + path_isConfigurable + '")');
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
if (obj.isEncrypted !== undefined) {
|
|
1149
|
+
const obj_isEncrypted = obj.isEncrypted;
|
|
1150
|
+
const path_isEncrypted = path + '.isEncrypted';
|
|
1151
|
+
if (typeof obj_isEncrypted !== 'boolean') {
|
|
1152
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isEncrypted + '" (at "' + path_isEncrypted + '")');
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
if (obj.isHidden !== undefined) {
|
|
1156
|
+
const obj_isHidden = obj.isHidden;
|
|
1157
|
+
const path_isHidden = path + '.isHidden';
|
|
1158
|
+
if (typeof obj_isHidden !== 'boolean') {
|
|
1159
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isHidden + '" (at "' + path_isHidden + '")');
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
if (obj.isPriceImpacting !== undefined) {
|
|
1163
|
+
const obj_isPriceImpacting = obj.isPriceImpacting;
|
|
1164
|
+
const path_isPriceImpacting = path + '.isPriceImpacting';
|
|
1165
|
+
if (typeof obj_isPriceImpacting !== 'boolean') {
|
|
1166
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isPriceImpacting + '" (at "' + path_isPriceImpacting + '")');
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
if (obj.isReadOnly !== undefined) {
|
|
1170
|
+
const obj_isReadOnly = obj.isReadOnly;
|
|
1171
|
+
const path_isReadOnly = path + '.isReadOnly';
|
|
1172
|
+
if (typeof obj_isReadOnly !== 'boolean') {
|
|
1173
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isReadOnly + '" (at "' + path_isReadOnly + '")');
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
if (obj.isRequired !== undefined) {
|
|
1177
|
+
const obj_isRequired = obj.isRequired;
|
|
1178
|
+
const path_isRequired = path + '.isRequired';
|
|
1179
|
+
if (typeof obj_isRequired !== 'boolean') {
|
|
1180
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isRequired + '" (at "' + path_isRequired + '")');
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
if (obj.label !== undefined) {
|
|
1184
|
+
const obj_label = obj.label;
|
|
1185
|
+
const path_label = path + '.label';
|
|
1186
|
+
if (typeof obj_label !== 'string') {
|
|
1187
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
if (obj.name !== undefined) {
|
|
1191
|
+
const obj_name = obj.name;
|
|
1192
|
+
const path_name = path + '.name';
|
|
1193
|
+
if (typeof obj_name !== 'string') {
|
|
1194
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
if (obj.picklist !== undefined) {
|
|
1198
|
+
const obj_picklist = obj.picklist;
|
|
1199
|
+
const path_picklist = path + '.picklist';
|
|
1200
|
+
const referencepath_picklistValidationError = validate$6(obj_picklist, path_picklist);
|
|
1201
|
+
if (referencepath_picklistValidationError !== null) {
|
|
1202
|
+
let message = 'Object doesn\'t match AttributePicklistOutputRepresentation (at "' + path_picklist + '")\n';
|
|
1203
|
+
message += referencepath_picklistValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1204
|
+
return new TypeError(message);
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
if (obj.valueDescription !== undefined) {
|
|
1208
|
+
const obj_valueDescription = obj.valueDescription;
|
|
1209
|
+
const path_valueDescription = path + '.valueDescription';
|
|
1210
|
+
if (typeof obj_valueDescription !== 'string') {
|
|
1211
|
+
return new TypeError('Expected "string" but received "' + typeof obj_valueDescription + '" (at "' + path_valueDescription + '")');
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
})();
|
|
1215
|
+
return v_error === undefined ? null : v_error;
|
|
1216
|
+
}
|
|
1217
|
+
function deepFreeze$5(input) {
|
|
1218
|
+
const input_picklist = input.picklist;
|
|
1219
|
+
if (input_picklist !== undefined) {
|
|
1220
|
+
deepFreeze$6(input_picklist);
|
|
1221
|
+
}
|
|
1222
|
+
ObjectFreeze(input);
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
function validate$4(obj, path = 'AttributeCategoryOutputRepresentation') {
|
|
1226
|
+
const v_error = (() => {
|
|
1227
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1228
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1229
|
+
}
|
|
1230
|
+
if (obj.attributes !== undefined) {
|
|
1231
|
+
const obj_attributes = obj.attributes;
|
|
1232
|
+
const path_attributes = path + '.attributes';
|
|
1233
|
+
if (!ArrayIsArray(obj_attributes)) {
|
|
1234
|
+
return new TypeError('Expected "array" but received "' + typeof obj_attributes + '" (at "' + path_attributes + '")');
|
|
1235
|
+
}
|
|
1236
|
+
for (let i = 0; i < obj_attributes.length; i++) {
|
|
1237
|
+
const obj_attributes_item = obj_attributes[i];
|
|
1238
|
+
const path_attributes_item = path_attributes + '[' + i + ']';
|
|
1239
|
+
const referencepath_attributes_itemValidationError = validate$5(obj_attributes_item, path_attributes_item);
|
|
1240
|
+
if (referencepath_attributes_itemValidationError !== null) {
|
|
1241
|
+
let message = 'Object doesn\'t match AttributeDefinitionOutputRepresentation (at "' + path_attributes_item + '")\n';
|
|
1242
|
+
message += referencepath_attributes_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1243
|
+
return new TypeError(message);
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
if (obj.code !== undefined) {
|
|
1248
|
+
const obj_code = obj.code;
|
|
1249
|
+
const path_code = path + '.code';
|
|
1250
|
+
if (typeof obj_code !== 'string') {
|
|
1251
|
+
return new TypeError('Expected "string" but received "' + typeof obj_code + '" (at "' + path_code + '")');
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
if (obj.id !== undefined) {
|
|
1255
|
+
const obj_id = obj.id;
|
|
1256
|
+
const path_id = path + '.id';
|
|
1257
|
+
if (typeof obj_id !== 'string') {
|
|
1258
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
if (obj.name !== undefined) {
|
|
1262
|
+
const obj_name = obj.name;
|
|
1263
|
+
const path_name = path + '.name';
|
|
1264
|
+
if (typeof obj_name !== 'string') {
|
|
1265
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
})();
|
|
1269
|
+
return v_error === undefined ? null : v_error;
|
|
1270
|
+
}
|
|
1271
|
+
function deepFreeze$4(input) {
|
|
1272
|
+
const input_attributes = input.attributes;
|
|
1273
|
+
if (input_attributes !== undefined) {
|
|
1274
|
+
for (let i = 0; i < input_attributes.length; i++) {
|
|
1275
|
+
const input_attributes_item = input_attributes[i];
|
|
1276
|
+
deepFreeze$5(input_attributes_item);
|
|
1277
|
+
}
|
|
1278
|
+
ObjectFreeze(input_attributes);
|
|
1279
|
+
}
|
|
1280
|
+
ObjectFreeze(input);
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
function validate$3(obj, path = 'PricingModelOutputRepresentation') {
|
|
1284
|
+
const v_error = (() => {
|
|
1285
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1286
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1287
|
+
}
|
|
1288
|
+
if (obj.frequency !== undefined) {
|
|
1289
|
+
const obj_frequency = obj.frequency;
|
|
1290
|
+
const path_frequency = path + '.frequency';
|
|
1291
|
+
if (typeof obj_frequency !== 'string') {
|
|
1292
|
+
return new TypeError('Expected "string" but received "' + typeof obj_frequency + '" (at "' + path_frequency + '")');
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
if (obj.id !== undefined) {
|
|
1296
|
+
const obj_id = obj.id;
|
|
1297
|
+
const path_id = path + '.id';
|
|
1298
|
+
if (typeof obj_id !== 'string') {
|
|
1299
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
if (obj.name !== undefined) {
|
|
1303
|
+
const obj_name = obj.name;
|
|
1304
|
+
const path_name = path + '.name';
|
|
1305
|
+
if (typeof obj_name !== 'string') {
|
|
1306
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
if (obj.occurrence !== undefined) {
|
|
1310
|
+
const obj_occurrence = obj.occurrence;
|
|
1311
|
+
const path_occurrence = path + '.occurrence';
|
|
1312
|
+
if (typeof obj_occurrence !== 'number' || (typeof obj_occurrence === 'number' && Math.floor(obj_occurrence) !== obj_occurrence)) {
|
|
1313
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_occurrence + '" (at "' + path_occurrence + '")');
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
if (obj.pricingModelType !== undefined) {
|
|
1317
|
+
const obj_pricingModelType = obj.pricingModelType;
|
|
1318
|
+
const path_pricingModelType = path + '.pricingModelType';
|
|
1319
|
+
if (typeof obj_pricingModelType !== 'string') {
|
|
1320
|
+
return new TypeError('Expected "string" but received "' + typeof obj_pricingModelType + '" (at "' + path_pricingModelType + '")');
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
if (obj.unitOfMeasure !== undefined) {
|
|
1324
|
+
const obj_unitOfMeasure = obj.unitOfMeasure;
|
|
1325
|
+
const path_unitOfMeasure = path + '.unitOfMeasure';
|
|
1326
|
+
if (typeof obj_unitOfMeasure !== 'string') {
|
|
1327
|
+
return new TypeError('Expected "string" but received "' + typeof obj_unitOfMeasure + '" (at "' + path_unitOfMeasure + '")');
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
})();
|
|
1331
|
+
return v_error === undefined ? null : v_error;
|
|
1332
|
+
}
|
|
1333
|
+
function deepFreeze$3(input) {
|
|
1334
|
+
ObjectFreeze(input);
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
function validate$2(obj, path = 'PriceOutputRepresentation') {
|
|
1338
|
+
const v_error = (() => {
|
|
1339
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1340
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1341
|
+
}
|
|
1342
|
+
if (obj.effectiveFrom !== undefined) {
|
|
1343
|
+
const obj_effectiveFrom = obj.effectiveFrom;
|
|
1344
|
+
const path_effectiveFrom = path + '.effectiveFrom';
|
|
1345
|
+
if (typeof obj_effectiveFrom !== 'string') {
|
|
1346
|
+
return new TypeError('Expected "string" but received "' + typeof obj_effectiveFrom + '" (at "' + path_effectiveFrom + '")');
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
if (obj.effectiveTo !== undefined) {
|
|
1350
|
+
const obj_effectiveTo = obj.effectiveTo;
|
|
1351
|
+
const path_effectiveTo = path + '.effectiveTo';
|
|
1352
|
+
if (typeof obj_effectiveTo !== 'string') {
|
|
1353
|
+
return new TypeError('Expected "string" but received "' + typeof obj_effectiveTo + '" (at "' + path_effectiveTo + '")');
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
if (obj.priceListEntryId !== undefined) {
|
|
1357
|
+
const obj_priceListEntryId = obj.priceListEntryId;
|
|
1358
|
+
const path_priceListEntryId = path + '.priceListEntryId';
|
|
1359
|
+
if (typeof obj_priceListEntryId !== 'string') {
|
|
1360
|
+
return new TypeError('Expected "string" but received "' + typeof obj_priceListEntryId + '" (at "' + path_priceListEntryId + '")');
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
if (obj.pricebookId !== undefined) {
|
|
1364
|
+
const obj_pricebookId = obj.pricebookId;
|
|
1365
|
+
const path_pricebookId = path + '.pricebookId';
|
|
1366
|
+
if (typeof obj_pricebookId !== 'string') {
|
|
1367
|
+
return new TypeError('Expected "string" but received "' + typeof obj_pricebookId + '" (at "' + path_pricebookId + '")');
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
if (obj.pricingModel !== undefined) {
|
|
1371
|
+
const obj_pricingModel = obj.pricingModel;
|
|
1372
|
+
const path_pricingModel = path + '.pricingModel';
|
|
1373
|
+
const referencepath_pricingModelValidationError = validate$3(obj_pricingModel, path_pricingModel);
|
|
1374
|
+
if (referencepath_pricingModelValidationError !== null) {
|
|
1375
|
+
let message = 'Object doesn\'t match PricingModelOutputRepresentation (at "' + path_pricingModel + '")\n';
|
|
1376
|
+
message += referencepath_pricingModelValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1377
|
+
return new TypeError(message);
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
if (obj.unitPrice !== undefined) {
|
|
1381
|
+
const obj_unitPrice = obj.unitPrice;
|
|
1382
|
+
const path_unitPrice = path + '.unitPrice';
|
|
1383
|
+
if (typeof obj_unitPrice !== 'string') {
|
|
1384
|
+
return new TypeError('Expected "string" but received "' + typeof obj_unitPrice + '" (at "' + path_unitPrice + '")');
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
})();
|
|
1388
|
+
return v_error === undefined ? null : v_error;
|
|
1389
|
+
}
|
|
1390
|
+
function deepFreeze$2(input) {
|
|
1391
|
+
const input_pricingModel = input.pricingModel;
|
|
1392
|
+
if (input_pricingModel !== undefined) {
|
|
1393
|
+
deepFreeze$3(input_pricingModel);
|
|
1394
|
+
}
|
|
1395
|
+
ObjectFreeze(input);
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
function validate$1(obj, path = 'QuantityInfo') {
|
|
1399
|
+
const v_error = (() => {
|
|
1400
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1401
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1402
|
+
}
|
|
1403
|
+
if (obj.maxQuantity !== undefined) {
|
|
1404
|
+
obj.maxQuantity;
|
|
1405
|
+
}
|
|
1406
|
+
if (obj.minQuantity !== undefined) {
|
|
1407
|
+
obj.minQuantity;
|
|
1408
|
+
}
|
|
1409
|
+
if (obj.quantity !== undefined) {
|
|
1410
|
+
obj.quantity;
|
|
1411
|
+
}
|
|
1412
|
+
})();
|
|
1413
|
+
return v_error === undefined ? null : v_error;
|
|
1414
|
+
}
|
|
1415
|
+
function deepFreeze$1(input) {
|
|
1416
|
+
ObjectFreeze(input);
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
const TTL = 6000;
|
|
1420
|
+
const VERSION = "59486918cad0cc20f8b6c12d84d03600";
|
|
1421
|
+
function validate(obj, path = 'ProductOutputRepresentation') {
|
|
1422
|
+
const v_error = (() => {
|
|
1423
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1424
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1425
|
+
}
|
|
1426
|
+
if (obj.attributeCategory !== undefined) {
|
|
1427
|
+
const obj_attributeCategory = obj.attributeCategory;
|
|
1428
|
+
const path_attributeCategory = path + '.attributeCategory';
|
|
1429
|
+
if (!ArrayIsArray(obj_attributeCategory)) {
|
|
1430
|
+
return new TypeError('Expected "array" but received "' + typeof obj_attributeCategory + '" (at "' + path_attributeCategory + '")');
|
|
1431
|
+
}
|
|
1432
|
+
for (let i = 0; i < obj_attributeCategory.length; i++) {
|
|
1433
|
+
const obj_attributeCategory_item = obj_attributeCategory[i];
|
|
1434
|
+
const path_attributeCategory_item = path_attributeCategory + '[' + i + ']';
|
|
1435
|
+
const referencepath_attributeCategory_itemValidationError = validate$4(obj_attributeCategory_item, path_attributeCategory_item);
|
|
1436
|
+
if (referencepath_attributeCategory_itemValidationError !== null) {
|
|
1437
|
+
let message = 'Object doesn\'t match AttributeCategoryOutputRepresentation (at "' + path_attributeCategory_item + '")\n';
|
|
1438
|
+
message += referencepath_attributeCategory_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1439
|
+
return new TypeError(message);
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
if (obj.attributes !== undefined) {
|
|
1444
|
+
const obj_attributes = obj.attributes;
|
|
1445
|
+
const path_attributes = path + '.attributes';
|
|
1446
|
+
if (!ArrayIsArray(obj_attributes)) {
|
|
1447
|
+
return new TypeError('Expected "array" but received "' + typeof obj_attributes + '" (at "' + path_attributes + '")');
|
|
1448
|
+
}
|
|
1449
|
+
for (let i = 0; i < obj_attributes.length; i++) {
|
|
1450
|
+
const obj_attributes_item = obj_attributes[i];
|
|
1451
|
+
const path_attributes_item = path_attributes + '[' + i + ']';
|
|
1452
|
+
const referencepath_attributes_itemValidationError = validate$5(obj_attributes_item, path_attributes_item);
|
|
1453
|
+
if (referencepath_attributes_itemValidationError !== null) {
|
|
1454
|
+
let message = 'Object doesn\'t match AttributeDefinitionOutputRepresentation (at "' + path_attributes_item + '")\n';
|
|
1455
|
+
message += referencepath_attributes_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1456
|
+
return new TypeError(message);
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
if (obj.categoryId !== undefined) {
|
|
1461
|
+
const obj_categoryId = obj.categoryId;
|
|
1462
|
+
const path_categoryId = path + '.categoryId';
|
|
1463
|
+
if (typeof obj_categoryId !== 'string') {
|
|
1464
|
+
return new TypeError('Expected "string" but received "' + typeof obj_categoryId + '" (at "' + path_categoryId + '")');
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
if (obj.childProducts !== undefined) {
|
|
1468
|
+
const obj_childProducts = obj.childProducts;
|
|
1469
|
+
const path_childProducts = path + '.childProducts';
|
|
1470
|
+
if (!ArrayIsArray(obj_childProducts)) {
|
|
1471
|
+
return new TypeError('Expected "array" but received "' + typeof obj_childProducts + '" (at "' + path_childProducts + '")');
|
|
1472
|
+
}
|
|
1473
|
+
for (let i = 0; i < obj_childProducts.length; i++) {
|
|
1474
|
+
const obj_childProducts_item = obj_childProducts[i];
|
|
1475
|
+
const path_childProducts_item = path_childProducts + '[' + i + ']';
|
|
1476
|
+
const referencepath_childProducts_itemValidationError = validate(obj_childProducts_item, path_childProducts_item);
|
|
1477
|
+
if (referencepath_childProducts_itemValidationError !== null) {
|
|
1478
|
+
let message = 'Object doesn\'t match ProductOutputRepresentation (at "' + path_childProducts_item + '")\n';
|
|
1479
|
+
message += referencepath_childProducts_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1480
|
+
return new TypeError(message);
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
if (obj.description !== undefined) {
|
|
1485
|
+
const obj_description = obj.description;
|
|
1486
|
+
const path_description = path + '.description';
|
|
1487
|
+
if (typeof obj_description !== 'string') {
|
|
1488
|
+
return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
if (obj.id !== undefined) {
|
|
1492
|
+
const obj_id = obj.id;
|
|
1493
|
+
const path_id = path + '.id';
|
|
1494
|
+
if (typeof obj_id !== 'string') {
|
|
1495
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
if (obj.isComponentRequired !== undefined) {
|
|
1499
|
+
const obj_isComponentRequired = obj.isComponentRequired;
|
|
1500
|
+
const path_isComponentRequired = path + '.isComponentRequired';
|
|
1501
|
+
if (typeof obj_isComponentRequired !== 'boolean') {
|
|
1502
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isComponentRequired + '" (at "' + path_isComponentRequired + '")');
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
if (obj.isDefaultComponent !== undefined) {
|
|
1506
|
+
const obj_isDefaultComponent = obj.isDefaultComponent;
|
|
1507
|
+
const path_isDefaultComponent = path + '.isDefaultComponent';
|
|
1508
|
+
if (typeof obj_isDefaultComponent !== 'boolean') {
|
|
1509
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isDefaultComponent + '" (at "' + path_isDefaultComponent + '")');
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
if (obj.isQuantityEditable !== undefined) {
|
|
1513
|
+
const obj_isQuantityEditable = obj.isQuantityEditable;
|
|
1514
|
+
const path_isQuantityEditable = path + '.isQuantityEditable';
|
|
1515
|
+
if (typeof obj_isQuantityEditable !== 'boolean') {
|
|
1516
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isQuantityEditable + '" (at "' + path_isQuantityEditable + '")');
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
if (obj.name !== undefined) {
|
|
1520
|
+
const obj_name = obj.name;
|
|
1521
|
+
const path_name = path + '.name';
|
|
1522
|
+
if (typeof obj_name !== 'string') {
|
|
1523
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
if (obj.prices !== undefined) {
|
|
1527
|
+
const obj_prices = obj.prices;
|
|
1528
|
+
const path_prices = path + '.prices';
|
|
1529
|
+
if (!ArrayIsArray(obj_prices)) {
|
|
1530
|
+
return new TypeError('Expected "array" but received "' + typeof obj_prices + '" (at "' + path_prices + '")');
|
|
1531
|
+
}
|
|
1532
|
+
for (let i = 0; i < obj_prices.length; i++) {
|
|
1533
|
+
const obj_prices_item = obj_prices[i];
|
|
1534
|
+
const path_prices_item = path_prices + '[' + i + ']';
|
|
1535
|
+
const referencepath_prices_itemValidationError = validate$2(obj_prices_item, path_prices_item);
|
|
1536
|
+
if (referencepath_prices_itemValidationError !== null) {
|
|
1537
|
+
let message = 'Object doesn\'t match PriceOutputRepresentation (at "' + path_prices_item + '")\n';
|
|
1538
|
+
message += referencepath_prices_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1539
|
+
return new TypeError(message);
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
if (obj.quantityInfo !== undefined) {
|
|
1544
|
+
const obj_quantityInfo = obj.quantityInfo;
|
|
1545
|
+
const path_quantityInfo = path + '.quantityInfo';
|
|
1546
|
+
const referencepath_quantityInfoValidationError = validate$1(obj_quantityInfo, path_quantityInfo);
|
|
1547
|
+
if (referencepath_quantityInfoValidationError !== null) {
|
|
1548
|
+
let message = 'Object doesn\'t match QuantityInfo (at "' + path_quantityInfo + '")\n';
|
|
1549
|
+
message += referencepath_quantityInfoValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1550
|
+
return new TypeError(message);
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
})();
|
|
1554
|
+
return v_error === undefined ? null : v_error;
|
|
1555
|
+
}
|
|
1556
|
+
const RepresentationType = 'ProductOutputRepresentation';
|
|
1557
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
1558
|
+
return input;
|
|
1559
|
+
}
|
|
1560
|
+
const select$1 = function ProductOutputRepresentationSelect() {
|
|
1561
|
+
return {
|
|
1562
|
+
kind: 'Fragment',
|
|
1563
|
+
version: VERSION,
|
|
1564
|
+
private: [],
|
|
1565
|
+
opaque: true
|
|
1566
|
+
};
|
|
1567
|
+
};
|
|
1568
|
+
function equals(existing, incoming) {
|
|
1569
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
1570
|
+
return false;
|
|
1571
|
+
}
|
|
1572
|
+
return true;
|
|
1573
|
+
}
|
|
1574
|
+
function deepFreeze(input) {
|
|
1575
|
+
const input_attributeCategory = input.attributeCategory;
|
|
1576
|
+
if (input_attributeCategory !== undefined) {
|
|
1577
|
+
for (let i = 0; i < input_attributeCategory.length; i++) {
|
|
1578
|
+
const input_attributeCategory_item = input_attributeCategory[i];
|
|
1579
|
+
deepFreeze$4(input_attributeCategory_item);
|
|
1580
|
+
}
|
|
1581
|
+
ObjectFreeze(input_attributeCategory);
|
|
1582
|
+
}
|
|
1583
|
+
const input_attributes = input.attributes;
|
|
1584
|
+
if (input_attributes !== undefined) {
|
|
1585
|
+
for (let i = 0; i < input_attributes.length; i++) {
|
|
1586
|
+
const input_attributes_item = input_attributes[i];
|
|
1587
|
+
deepFreeze$5(input_attributes_item);
|
|
1588
|
+
}
|
|
1589
|
+
ObjectFreeze(input_attributes);
|
|
1590
|
+
}
|
|
1591
|
+
const input_childProducts = input.childProducts;
|
|
1592
|
+
if (input_childProducts !== undefined) {
|
|
1593
|
+
for (let i = 0; i < input_childProducts.length; i++) {
|
|
1594
|
+
const input_childProducts_item = input_childProducts[i];
|
|
1595
|
+
deepFreeze(input_childProducts_item);
|
|
1596
|
+
}
|
|
1597
|
+
ObjectFreeze(input_childProducts);
|
|
1598
|
+
}
|
|
1599
|
+
const input_prices = input.prices;
|
|
1600
|
+
if (input_prices !== undefined) {
|
|
1601
|
+
for (let i = 0; i < input_prices.length; i++) {
|
|
1602
|
+
const input_prices_item = input_prices[i];
|
|
1603
|
+
deepFreeze$2(input_prices_item);
|
|
1604
|
+
}
|
|
1605
|
+
ObjectFreeze(input_prices);
|
|
1606
|
+
}
|
|
1607
|
+
const input_quantityInfo = input.quantityInfo;
|
|
1608
|
+
if (input_quantityInfo !== undefined) {
|
|
1609
|
+
deepFreeze$1(input_quantityInfo);
|
|
1610
|
+
}
|
|
1611
|
+
ObjectFreeze(input);
|
|
1612
|
+
}
|
|
1613
|
+
const ingest = function ProductOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1614
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1615
|
+
const validateError = validate(input);
|
|
1616
|
+
if (validateError !== null) {
|
|
1617
|
+
throw validateError;
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
const key = path.fullPath;
|
|
1621
|
+
const existingRecord = store.readEntry(key);
|
|
1622
|
+
const ttlToUse = TTL;
|
|
1623
|
+
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
1624
|
+
fullPath: key,
|
|
1625
|
+
parent: path.parent,
|
|
1626
|
+
propertyName: path.propertyName,
|
|
1627
|
+
ttl: ttlToUse
|
|
1628
|
+
});
|
|
1629
|
+
deepFreeze(input);
|
|
1630
|
+
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
1631
|
+
luvio.storePublish(key, incomingRecord);
|
|
1632
|
+
}
|
|
1633
|
+
{
|
|
1634
|
+
const storeMetadataParams = {
|
|
1635
|
+
ttl: ttlToUse,
|
|
1636
|
+
namespace: "epc",
|
|
1637
|
+
version: VERSION,
|
|
1638
|
+
representationName: RepresentationType,
|
|
1639
|
+
};
|
|
1640
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
1641
|
+
}
|
|
1642
|
+
return createLink(key);
|
|
1643
|
+
};
|
|
1644
|
+
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
1645
|
+
const rootKeySet = new StoreKeyMap();
|
|
1646
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1647
|
+
const rootKey = fullPathFactory();
|
|
1648
|
+
rootKeySet.set(rootKey, {
|
|
1649
|
+
namespace: keyPrefix,
|
|
1650
|
+
representationName: RepresentationType,
|
|
1651
|
+
mergeable: false
|
|
1652
|
+
});
|
|
1653
|
+
return rootKeySet;
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
function select(luvio, params) {
|
|
1657
|
+
return select$1();
|
|
1658
|
+
}
|
|
1659
|
+
function keyBuilder$1(luvio, params) {
|
|
1660
|
+
return keyPrefix + '::ProductOutputRepresentation:(' + 'correlationId:' + params.queryParams.correlationId + ',' + 'isPriceImpacting:' + params.queryParams.isPriceImpacting + ',' + 'productId:' + params.urlParams.productId + ')';
|
|
1661
|
+
}
|
|
1662
|
+
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
1663
|
+
return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
1664
|
+
}
|
|
1665
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
1666
|
+
const { body } = response;
|
|
1667
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
1668
|
+
luvio.storeIngest(key, ingest, body);
|
|
1669
|
+
const snapshot = luvio.storeLookup({
|
|
1670
|
+
recordId: key,
|
|
1671
|
+
node: select(),
|
|
1672
|
+
variables: {},
|
|
1673
|
+
}, snapshotRefresh);
|
|
1674
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1675
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1676
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
return snapshot;
|
|
1680
|
+
}
|
|
1681
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
1682
|
+
const key = keyBuilder$1(luvio, params);
|
|
1683
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1684
|
+
const storeMetadataParams = {
|
|
1685
|
+
ttl: TTL,
|
|
1686
|
+
namespace: keyPrefix,
|
|
1687
|
+
version: VERSION,
|
|
1688
|
+
representationName: RepresentationType
|
|
1689
|
+
};
|
|
1690
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1691
|
+
return errorSnapshot;
|
|
1692
|
+
}
|
|
1693
|
+
function createResourceRequest(config) {
|
|
1694
|
+
const headers = {};
|
|
1695
|
+
return {
|
|
1696
|
+
baseUri: '/services/data/v58.0',
|
|
1697
|
+
basePath: '/connect/epc/product/' + config.urlParams.productId + '/attributes',
|
|
1698
|
+
method: 'get',
|
|
1699
|
+
body: null,
|
|
1700
|
+
urlParams: config.urlParams,
|
|
1701
|
+
queryParams: config.queryParams,
|
|
1702
|
+
headers,
|
|
1703
|
+
priority: 'normal',
|
|
1704
|
+
};
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
const getProductAttributesByProductId_ConfigPropertyNames = {
|
|
1708
|
+
displayName: 'getProductAttributesByProductId',
|
|
1709
|
+
parameters: {
|
|
1710
|
+
required: ['productId'],
|
|
1711
|
+
optional: ['correlationId', 'isPriceImpacting']
|
|
1712
|
+
}
|
|
1713
|
+
};
|
|
1714
|
+
function createResourceParams(config) {
|
|
1715
|
+
const resourceParams = {
|
|
1716
|
+
urlParams: {
|
|
1717
|
+
productId: config.productId
|
|
1718
|
+
},
|
|
1719
|
+
queryParams: {
|
|
1720
|
+
correlationId: config.correlationId, isPriceImpacting: config.isPriceImpacting
|
|
1721
|
+
}
|
|
1722
|
+
};
|
|
1723
|
+
return resourceParams;
|
|
1724
|
+
}
|
|
1725
|
+
function keyBuilder(luvio, config) {
|
|
1726
|
+
const resourceParams = createResourceParams(config);
|
|
1727
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
1728
|
+
}
|
|
1729
|
+
function typeCheckConfig(untrustedConfig) {
|
|
1730
|
+
const config = {};
|
|
1731
|
+
const untrustedConfig_productId = untrustedConfig.productId;
|
|
1732
|
+
if (typeof untrustedConfig_productId === 'string') {
|
|
1733
|
+
config.productId = untrustedConfig_productId;
|
|
1734
|
+
}
|
|
1735
|
+
const untrustedConfig_correlationId = untrustedConfig.correlationId;
|
|
1736
|
+
if (typeof untrustedConfig_correlationId === 'string') {
|
|
1737
|
+
config.correlationId = untrustedConfig_correlationId;
|
|
1738
|
+
}
|
|
1739
|
+
const untrustedConfig_isPriceImpacting = untrustedConfig.isPriceImpacting;
|
|
1740
|
+
if (typeof untrustedConfig_isPriceImpacting === 'boolean') {
|
|
1741
|
+
config.isPriceImpacting = untrustedConfig_isPriceImpacting;
|
|
1742
|
+
}
|
|
1743
|
+
return config;
|
|
1744
|
+
}
|
|
1745
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
1746
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1747
|
+
return null;
|
|
1748
|
+
}
|
|
1749
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1750
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1751
|
+
}
|
|
1752
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
1753
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1754
|
+
return null;
|
|
1755
|
+
}
|
|
1756
|
+
return config;
|
|
1757
|
+
}
|
|
1758
|
+
function adapterFragment(luvio, config) {
|
|
1759
|
+
createResourceParams(config);
|
|
1760
|
+
return select();
|
|
1761
|
+
}
|
|
1762
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
1763
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
1764
|
+
config,
|
|
1765
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1766
|
+
});
|
|
1767
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1768
|
+
}
|
|
1769
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
1770
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
1771
|
+
config,
|
|
1772
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1773
|
+
});
|
|
1774
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1775
|
+
}
|
|
1776
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
1777
|
+
const resourceParams = createResourceParams(config);
|
|
1778
|
+
const request = createResourceRequest(resourceParams);
|
|
1779
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1780
|
+
.then((response) => {
|
|
1781
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
1782
|
+
}, (response) => {
|
|
1783
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
1784
|
+
});
|
|
1785
|
+
}
|
|
1786
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
1787
|
+
const { luvio, config } = context;
|
|
1788
|
+
const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
|
|
1789
|
+
const dispatchOptions = {
|
|
1790
|
+
resourceRequestContext: {
|
|
1791
|
+
requestCorrelator,
|
|
1792
|
+
luvioRequestMethod: undefined,
|
|
1793
|
+
},
|
|
1794
|
+
eventObservers
|
|
1795
|
+
};
|
|
1796
|
+
if (networkPriority !== 'normal') {
|
|
1797
|
+
dispatchOptions.overrides = {
|
|
1798
|
+
priority: networkPriority
|
|
1799
|
+
};
|
|
1800
|
+
}
|
|
1801
|
+
return buildNetworkSnapshot(luvio, config, dispatchOptions);
|
|
1802
|
+
}
|
|
1803
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
1804
|
+
const { luvio, config } = context;
|
|
1805
|
+
const selector = {
|
|
1806
|
+
recordId: keyBuilder(luvio, config),
|
|
1807
|
+
node: adapterFragment(luvio, config),
|
|
1808
|
+
variables: {},
|
|
1809
|
+
};
|
|
1810
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1811
|
+
config,
|
|
1812
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1813
|
+
});
|
|
1814
|
+
return cacheSnapshot;
|
|
1815
|
+
}
|
|
1816
|
+
const getProductAttributesByProductIdAdapterFactory = (luvio) => function epc__getProductAttributesByProductId(untrustedConfig, requestContext) {
|
|
1817
|
+
const config = validateAdapterConfig(untrustedConfig, getProductAttributesByProductId_ConfigPropertyNames);
|
|
918
1818
|
// Invalid or incomplete config
|
|
919
1819
|
if (config === null) {
|
|
920
1820
|
return null;
|
|
@@ -923,4 +1823,4 @@ const getProductFlowByProductIdAdapterFactory = (luvio) => function epc__getProd
|
|
|
923
1823
|
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
924
1824
|
};
|
|
925
1825
|
|
|
926
|
-
export { createProductAttributeDefinitionAdapterFactory, deactivateAdapterFactory, getProductFlowByProductIdAdapterFactory };
|
|
1826
|
+
export { createProductAttributeDefinitionAdapterFactory, deactivateAdapterFactory, getProductAttributesByProductIdAdapterFactory, getProductFlowByProductIdAdapterFactory };
|