@salesforce/lds-adapters-industries-epc 1.127.0 → 1.128.1

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.
@@ -41,25 +41,32 @@ function untrustedIsObject(untrusted) {
41
41
  function areRequiredParametersPresent(config, configPropertyNames) {
42
42
  return configPropertyNames.parameters.required.every(req => req in config);
43
43
  }
44
+ const snapshotRefreshOptions = {
45
+ overrides: {
46
+ headers: {
47
+ 'Cache-Control': 'no-cache',
48
+ },
49
+ }
50
+ };
44
51
  const keyPrefix = 'epc';
45
52
 
46
53
  const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
47
54
  const { isArray: ArrayIsArray } = Array;
48
55
  const { stringify: JSONStringify } = JSON;
49
- function deepFreeze$4(value) {
56
+ function deepFreeze$7(value) {
50
57
  // No need to freeze primitives
51
58
  if (typeof value !== 'object' || value === null) {
52
59
  return;
53
60
  }
54
61
  if (ArrayIsArray(value)) {
55
62
  for (let i = 0, len = value.length; i < len; i += 1) {
56
- deepFreeze$4(value[i]);
63
+ deepFreeze$7(value[i]);
57
64
  }
58
65
  }
59
66
  else {
60
67
  const keys = ObjectKeys(value);
61
68
  for (let i = 0, len = keys.length; i < len; i += 1) {
62
- deepFreeze$4(value[keys[i]]);
69
+ deepFreeze$7(value[keys[i]]);
63
70
  }
64
71
  }
65
72
  ObjectFreeze(value);
@@ -70,7 +77,7 @@ function createLink(ref) {
70
77
  };
71
78
  }
72
79
 
73
- function validate$5(obj, path = 'DeactivateInputRepresentation') {
80
+ function validate$8(obj, path = 'DeactivateInputRepresentation') {
74
81
  const v_error = (() => {
75
82
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
76
83
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -103,7 +110,7 @@ function validate$5(obj, path = 'DeactivateInputRepresentation') {
103
110
  return v_error === undefined ? null : v_error;
104
111
  }
105
112
 
106
- function validate$4(obj, path = 'ErrorOutputRepresentation') {
113
+ function validate$7(obj, path = 'ErrorOutputRepresentation') {
107
114
  const v_error = (() => {
108
115
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
109
116
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -133,15 +140,15 @@ function validate$4(obj, path = 'ErrorOutputRepresentation') {
133
140
  })();
134
141
  return v_error === undefined ? null : v_error;
135
142
  }
136
- function deepFreeze$3(input) {
143
+ function deepFreeze$6(input) {
137
144
  const input_details = input.details;
138
145
  ObjectFreeze(input_details);
139
146
  ObjectFreeze(input);
140
147
  }
141
148
 
142
- const TTL$1 = 6000;
143
- const VERSION$1 = "67abdeaa299bae24f468fd2e78cd1e1e";
144
- function validate$3(obj, path = 'RecordIdMapOutputRepresentation') {
149
+ const TTL$2 = 6000;
150
+ const VERSION$2 = "67abdeaa299bae24f468fd2e78cd1e1e";
151
+ function validate$6(obj, path = 'RecordIdMapOutputRepresentation') {
145
152
  const v_error = (() => {
146
153
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
147
154
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -154,7 +161,7 @@ function validate$3(obj, path = 'RecordIdMapOutputRepresentation') {
154
161
  for (let i = 0; i < obj_errors.length; i++) {
155
162
  const obj_errors_item = obj_errors[i];
156
163
  const path_errors_item = path_errors + '[' + i + ']';
157
- const referencepath_errors_itemValidationError = validate$4(obj_errors_item, path_errors_item);
164
+ const referencepath_errors_itemValidationError = validate$7(obj_errors_item, path_errors_item);
158
165
  if (referencepath_errors_itemValidationError !== null) {
159
166
  let message = 'Object doesn\'t match ErrorOutputRepresentation (at "' + path_errors_item + '")\n';
160
167
  message += referencepath_errors_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -169,98 +176,98 @@ function validate$3(obj, path = 'RecordIdMapOutputRepresentation') {
169
176
  })();
170
177
  return v_error === undefined ? null : v_error;
171
178
  }
172
- const RepresentationType$1 = 'RecordIdMapOutputRepresentation';
173
- function keyBuilder$1(luvio, config) {
174
- return keyPrefix + '::' + RepresentationType$1 + ':' + config.message;
179
+ const RepresentationType$2 = 'RecordIdMapOutputRepresentation';
180
+ function keyBuilder$3(luvio, config) {
181
+ return keyPrefix + '::' + RepresentationType$2 + ':' + config.message;
175
182
  }
176
183
  function keyBuilderFromType$1(luvio, object) {
177
184
  const keyParams = {
178
185
  message: object.status
179
186
  };
180
- return keyBuilder$1(luvio, keyParams);
187
+ return keyBuilder$3(luvio, keyParams);
181
188
  }
182
- function normalize$1(input, existing, path, luvio, store, timestamp) {
189
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
183
190
  return input;
184
191
  }
185
- const select$3 = function RecordIdMapOutputRepresentationSelect() {
192
+ const select$5 = function RecordIdMapOutputRepresentationSelect() {
186
193
  return {
187
194
  kind: 'Fragment',
188
- version: VERSION$1,
195
+ version: VERSION$2,
189
196
  private: [],
190
197
  opaque: true
191
198
  };
192
199
  };
193
- function equals$1(existing, incoming) {
200
+ function equals$2(existing, incoming) {
194
201
  if (JSONStringify(incoming) !== JSONStringify(existing)) {
195
202
  return false;
196
203
  }
197
204
  return true;
198
205
  }
199
- function deepFreeze$2(input) {
206
+ function deepFreeze$5(input) {
200
207
  const input_errors = input.errors;
201
208
  for (let i = 0; i < input_errors.length; i++) {
202
209
  const input_errors_item = input_errors[i];
203
- deepFreeze$3(input_errors_item);
210
+ deepFreeze$6(input_errors_item);
204
211
  }
205
212
  ObjectFreeze(input_errors);
206
213
  ObjectFreeze(input);
207
214
  }
208
- const ingest$1 = function RecordIdMapOutputRepresentationIngest(input, path, luvio, store, timestamp) {
215
+ const ingest$2 = function RecordIdMapOutputRepresentationIngest(input, path, luvio, store, timestamp) {
209
216
  if (process.env.NODE_ENV !== 'production') {
210
- const validateError = validate$3(input);
217
+ const validateError = validate$6(input);
211
218
  if (validateError !== null) {
212
219
  throw validateError;
213
220
  }
214
221
  }
215
222
  const key = keyBuilderFromType$1(luvio, input);
216
223
  const existingRecord = store.readEntry(key);
217
- const ttlToUse = TTL$1;
218
- let incomingRecord = normalize$1(input, store.readEntry(key), {
224
+ const ttlToUse = TTL$2;
225
+ let incomingRecord = normalize$2(input, store.readEntry(key), {
219
226
  fullPath: key,
220
227
  parent: path.parent,
221
228
  propertyName: path.propertyName,
222
229
  ttl: ttlToUse
223
230
  });
224
- deepFreeze$2(input);
225
- if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
231
+ deepFreeze$5(input);
232
+ if (existingRecord === undefined || equals$2(existingRecord, incomingRecord) === false) {
226
233
  luvio.storePublish(key, incomingRecord);
227
234
  }
228
235
  {
229
236
  const storeMetadataParams = {
230
237
  ttl: ttlToUse,
231
238
  namespace: "epc",
232
- version: VERSION$1,
233
- representationName: RepresentationType$1,
239
+ version: VERSION$2,
240
+ representationName: RepresentationType$2,
234
241
  };
235
242
  luvio.publishStoreMetadata(key, storeMetadataParams);
236
243
  }
237
244
  return createLink(key);
238
245
  };
239
- function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
246
+ function getTypeCacheKeys$2(luvio, input, fullPathFactory) {
240
247
  const rootKeySet = new StoreKeyMap();
241
248
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
242
249
  const rootKey = keyBuilderFromType$1(luvio, input);
243
250
  rootKeySet.set(rootKey, {
244
251
  namespace: keyPrefix,
245
- representationName: RepresentationType$1,
252
+ representationName: RepresentationType$2,
246
253
  mergeable: false
247
254
  });
248
255
  return rootKeySet;
249
256
  }
250
257
 
251
- function select$2(luvio, params) {
252
- return select$3();
258
+ function select$4(luvio, params) {
259
+ return select$5();
253
260
  }
254
- function getResponseCacheKeys$1(luvio, resourceParams, response) {
255
- return getTypeCacheKeys$1(luvio, response);
261
+ function getResponseCacheKeys$2(luvio, resourceParams, response) {
262
+ return getTypeCacheKeys$2(luvio, response);
256
263
  }
257
- function ingestSuccess$1(luvio, resourceParams, response) {
264
+ function ingestSuccess$2(luvio, resourceParams, response) {
258
265
  const { body } = response;
259
266
  const key = keyBuilderFromType$1(luvio, body);
260
- luvio.storeIngest(key, ingest$1, body);
267
+ luvio.storeIngest(key, ingest$2, body);
261
268
  const snapshot = luvio.storeLookup({
262
269
  recordId: key,
263
- node: select$2(),
270
+ node: select$4(),
264
271
  variables: {},
265
272
  });
266
273
  if (process.env.NODE_ENV !== 'production') {
@@ -270,7 +277,7 @@ function ingestSuccess$1(luvio, resourceParams, response) {
270
277
  }
271
278
  return snapshot;
272
279
  }
273
- function createResourceRequest$1(config) {
280
+ function createResourceRequest$2(config) {
274
281
  const headers = {};
275
282
  return {
276
283
  baseUri: '/services/data/v58.0',
@@ -291,7 +298,7 @@ const deactivate_ConfigPropertyNames = {
291
298
  optional: []
292
299
  }
293
300
  };
294
- function createResourceParams$1(config) {
301
+ function createResourceParams$2(config) {
295
302
  const resourceParams = {
296
303
  body: {
297
304
  deactivateInputPayload: config.deactivateInputPayload
@@ -299,54 +306,54 @@ function createResourceParams$1(config) {
299
306
  };
300
307
  return resourceParams;
301
308
  }
302
- function typeCheckConfig$1(untrustedConfig) {
309
+ function typeCheckConfig$2(untrustedConfig) {
303
310
  const config = {};
304
311
  const untrustedConfig_deactivateInputPayload = untrustedConfig.deactivateInputPayload;
305
- const referenceDeactivateInputRepresentationValidationError = validate$5(untrustedConfig_deactivateInputPayload);
312
+ const referenceDeactivateInputRepresentationValidationError = validate$8(untrustedConfig_deactivateInputPayload);
306
313
  if (referenceDeactivateInputRepresentationValidationError === null) {
307
314
  config.deactivateInputPayload = untrustedConfig_deactivateInputPayload;
308
315
  }
309
316
  return config;
310
317
  }
311
- function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
318
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
312
319
  if (!untrustedIsObject(untrustedConfig)) {
313
320
  return null;
314
321
  }
315
322
  if (process.env.NODE_ENV !== 'production') {
316
323
  validateConfig(untrustedConfig, configPropertyNames);
317
324
  }
318
- const config = typeCheckConfig$1(untrustedConfig);
325
+ const config = typeCheckConfig$2(untrustedConfig);
319
326
  if (!areRequiredParametersPresent(config, configPropertyNames)) {
320
327
  return null;
321
328
  }
322
329
  return config;
323
330
  }
324
- function buildNetworkSnapshot$1(luvio, config, options) {
325
- const resourceParams = createResourceParams$1(config);
326
- const request = createResourceRequest$1(resourceParams);
331
+ function buildNetworkSnapshot$2(luvio, config, options) {
332
+ const resourceParams = createResourceParams$2(config);
333
+ const request = createResourceRequest$2(resourceParams);
327
334
  return luvio.dispatchResourceRequest(request, options)
328
335
  .then((response) => {
329
336
  return luvio.handleSuccessResponse(() => {
330
- const snapshot = ingestSuccess$1(luvio, resourceParams, response);
337
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response);
331
338
  return luvio.storeBroadcast().then(() => snapshot);
332
- }, () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
339
+ }, () => getResponseCacheKeys$2(luvio, resourceParams, response.body));
333
340
  }, (response) => {
334
- deepFreeze$4(response);
341
+ deepFreeze$7(response);
335
342
  throw response;
336
343
  });
337
344
  }
338
345
  const deactivateAdapterFactory = (luvio) => {
339
346
  return function deactivate(untrustedConfig) {
340
- const config = validateAdapterConfig$1(untrustedConfig, deactivate_ConfigPropertyNames);
347
+ const config = validateAdapterConfig$2(untrustedConfig, deactivate_ConfigPropertyNames);
341
348
  // Invalid or incomplete config
342
349
  if (config === null) {
343
350
  throw new Error('Invalid config for "deactivate"');
344
351
  }
345
- return buildNetworkSnapshot$1(luvio, config);
352
+ return buildNetworkSnapshot$2(luvio, config);
346
353
  };
347
354
  };
348
355
 
349
- function validate$2(obj, path = 'ProductAttributeDefinitionListInputRepresentation') {
356
+ function validate$5(obj, path = 'ProductAttributeDefinitionListInputRepresentation') {
350
357
  const v_error = (() => {
351
358
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
352
359
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -367,7 +374,7 @@ function validate$2(obj, path = 'ProductAttributeDefinitionListInputRepresentati
367
374
  return v_error === undefined ? null : v_error;
368
375
  }
369
376
 
370
- function validate$1(obj, path = 'ProductAttributeDefinitionRepresentation') {
377
+ function validate$4(obj, path = 'ProductAttributeDefinitionRepresentation') {
371
378
  const v_error = (() => {
372
379
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
373
380
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -389,13 +396,13 @@ function validate$1(obj, path = 'ProductAttributeDefinitionRepresentation') {
389
396
  })();
390
397
  return v_error === undefined ? null : v_error;
391
398
  }
392
- function deepFreeze$1(input) {
399
+ function deepFreeze$4(input) {
393
400
  ObjectFreeze(input);
394
401
  }
395
402
 
396
- const TTL = 6000;
397
- const VERSION = "e67d3c8569b9667eac98cc1a9840041c";
398
- function validate(obj, path = 'ProductAttributeDefinitionListRepresentation') {
403
+ const TTL$1 = 6000;
404
+ const VERSION$1 = "e67d3c8569b9667eac98cc1a9840041c";
405
+ function validate$3(obj, path = 'ProductAttributeDefinitionListRepresentation') {
399
406
  const v_error = (() => {
400
407
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
401
408
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -408,7 +415,7 @@ function validate(obj, path = 'ProductAttributeDefinitionListRepresentation') {
408
415
  for (let i = 0; i < obj_data.length; i++) {
409
416
  const obj_data_item = obj_data[i];
410
417
  const path_data_item = path_data + '[' + i + ']';
411
- const referencepath_data_itemValidationError = validate$1(obj_data_item, path_data_item);
418
+ const referencepath_data_itemValidationError = validate$4(obj_data_item, path_data_item);
412
419
  if (referencepath_data_itemValidationError !== null) {
413
420
  let message = 'Object doesn\'t match ProductAttributeDefinitionRepresentation (at "' + path_data_item + '")\n';
414
421
  message += referencepath_data_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -423,98 +430,98 @@ function validate(obj, path = 'ProductAttributeDefinitionListRepresentation') {
423
430
  })();
424
431
  return v_error === undefined ? null : v_error;
425
432
  }
426
- const RepresentationType = 'ProductAttributeDefinitionListRepresentation';
427
- function keyBuilder(luvio, config) {
428
- return keyPrefix + '::' + RepresentationType + ':' + config.message;
433
+ const RepresentationType$1 = 'ProductAttributeDefinitionListRepresentation';
434
+ function keyBuilder$2(luvio, config) {
435
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.message;
429
436
  }
430
437
  function keyBuilderFromType(luvio, object) {
431
438
  const keyParams = {
432
439
  message: object.message
433
440
  };
434
- return keyBuilder(luvio, keyParams);
441
+ return keyBuilder$2(luvio, keyParams);
435
442
  }
436
- function normalize(input, existing, path, luvio, store, timestamp) {
443
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
437
444
  return input;
438
445
  }
439
- const select$1 = function ProductAttributeDefinitionListRepresentationSelect() {
446
+ const select$3 = function ProductAttributeDefinitionListRepresentationSelect() {
440
447
  return {
441
448
  kind: 'Fragment',
442
- version: VERSION,
449
+ version: VERSION$1,
443
450
  private: [],
444
451
  opaque: true
445
452
  };
446
453
  };
447
- function equals(existing, incoming) {
454
+ function equals$1(existing, incoming) {
448
455
  if (JSONStringify(incoming) !== JSONStringify(existing)) {
449
456
  return false;
450
457
  }
451
458
  return true;
452
459
  }
453
- function deepFreeze(input) {
460
+ function deepFreeze$3(input) {
454
461
  const input_data = input.data;
455
462
  for (let i = 0; i < input_data.length; i++) {
456
463
  const input_data_item = input_data[i];
457
- deepFreeze$1(input_data_item);
464
+ deepFreeze$4(input_data_item);
458
465
  }
459
466
  ObjectFreeze(input_data);
460
467
  ObjectFreeze(input);
461
468
  }
462
- const ingest = function ProductAttributeDefinitionListRepresentationIngest(input, path, luvio, store, timestamp) {
469
+ const ingest$1 = function ProductAttributeDefinitionListRepresentationIngest(input, path, luvio, store, timestamp) {
463
470
  if (process.env.NODE_ENV !== 'production') {
464
- const validateError = validate(input);
471
+ const validateError = validate$3(input);
465
472
  if (validateError !== null) {
466
473
  throw validateError;
467
474
  }
468
475
  }
469
476
  const key = keyBuilderFromType(luvio, input);
470
477
  const existingRecord = store.readEntry(key);
471
- const ttlToUse = TTL;
472
- let incomingRecord = normalize(input, store.readEntry(key), {
478
+ const ttlToUse = TTL$1;
479
+ let incomingRecord = normalize$1(input, store.readEntry(key), {
473
480
  fullPath: key,
474
481
  parent: path.parent,
475
482
  propertyName: path.propertyName,
476
483
  ttl: ttlToUse
477
484
  });
478
- deepFreeze(input);
479
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
485
+ deepFreeze$3(input);
486
+ if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
480
487
  luvio.storePublish(key, incomingRecord);
481
488
  }
482
489
  {
483
490
  const storeMetadataParams = {
484
491
  ttl: ttlToUse,
485
492
  namespace: "epc",
486
- version: VERSION,
487
- representationName: RepresentationType,
493
+ version: VERSION$1,
494
+ representationName: RepresentationType$1,
488
495
  };
489
496
  luvio.publishStoreMetadata(key, storeMetadataParams);
490
497
  }
491
498
  return createLink(key);
492
499
  };
493
- function getTypeCacheKeys(luvio, input, fullPathFactory) {
500
+ function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
494
501
  const rootKeySet = new StoreKeyMap();
495
502
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
496
503
  const rootKey = keyBuilderFromType(luvio, input);
497
504
  rootKeySet.set(rootKey, {
498
505
  namespace: keyPrefix,
499
- representationName: RepresentationType,
506
+ representationName: RepresentationType$1,
500
507
  mergeable: false
501
508
  });
502
509
  return rootKeySet;
503
510
  }
504
511
 
505
- function select(luvio, params) {
506
- return select$1();
512
+ function select$2(luvio, params) {
513
+ return select$3();
507
514
  }
508
- function getResponseCacheKeys(luvio, resourceParams, response) {
509
- return getTypeCacheKeys(luvio, response);
515
+ function getResponseCacheKeys$1(luvio, resourceParams, response) {
516
+ return getTypeCacheKeys$1(luvio, response);
510
517
  }
511
- function ingestSuccess(luvio, resourceParams, response) {
518
+ function ingestSuccess$1(luvio, resourceParams, response) {
512
519
  const { body } = response;
513
520
  const key = keyBuilderFromType(luvio, body);
514
- luvio.storeIngest(key, ingest, body);
521
+ luvio.storeIngest(key, ingest$1, body);
515
522
  const snapshot = luvio.storeLookup({
516
523
  recordId: key,
517
- node: select(),
524
+ node: select$2(),
518
525
  variables: {},
519
526
  });
520
527
  if (process.env.NODE_ENV !== 'production') {
@@ -524,7 +531,7 @@ function ingestSuccess(luvio, resourceParams, response) {
524
531
  }
525
532
  return snapshot;
526
533
  }
527
- function createResourceRequest(config) {
534
+ function createResourceRequest$1(config) {
528
535
  const headers = {};
529
536
  return {
530
537
  baseUri: '/services/data/v58.0',
@@ -545,7 +552,7 @@ const createProductAttributeDefinition_ConfigPropertyNames = {
545
552
  optional: []
546
553
  }
547
554
  };
548
- function createResourceParams(config) {
555
+ function createResourceParams$1(config) {
549
556
  const resourceParams = {
550
557
  body: {
551
558
  productAttributeDefinitionListInputPayload: config.productAttributeDefinitionListInputPayload
@@ -553,51 +560,367 @@ function createResourceParams(config) {
553
560
  };
554
561
  return resourceParams;
555
562
  }
556
- function typeCheckConfig(untrustedConfig) {
563
+ function typeCheckConfig$1(untrustedConfig) {
557
564
  const config = {};
558
565
  const untrustedConfig_productAttributeDefinitionListInputPayload = untrustedConfig.productAttributeDefinitionListInputPayload;
559
- const referenceProductAttributeDefinitionListInputRepresentationValidationError = validate$2(untrustedConfig_productAttributeDefinitionListInputPayload);
566
+ const referenceProductAttributeDefinitionListInputRepresentationValidationError = validate$5(untrustedConfig_productAttributeDefinitionListInputPayload);
560
567
  if (referenceProductAttributeDefinitionListInputRepresentationValidationError === null) {
561
568
  config.productAttributeDefinitionListInputPayload = untrustedConfig_productAttributeDefinitionListInputPayload;
562
569
  }
563
570
  return config;
564
571
  }
565
- function validateAdapterConfig(untrustedConfig, configPropertyNames) {
572
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
566
573
  if (!untrustedIsObject(untrustedConfig)) {
567
574
  return null;
568
575
  }
569
576
  if (process.env.NODE_ENV !== 'production') {
570
577
  validateConfig(untrustedConfig, configPropertyNames);
571
578
  }
572
- const config = typeCheckConfig(untrustedConfig);
579
+ const config = typeCheckConfig$1(untrustedConfig);
573
580
  if (!areRequiredParametersPresent(config, configPropertyNames)) {
574
581
  return null;
575
582
  }
576
583
  return config;
577
584
  }
578
- function buildNetworkSnapshot(luvio, config, options) {
579
- const resourceParams = createResourceParams(config);
580
- const request = createResourceRequest(resourceParams);
585
+ function buildNetworkSnapshot$1(luvio, config, options) {
586
+ const resourceParams = createResourceParams$1(config);
587
+ const request = createResourceRequest$1(resourceParams);
581
588
  return luvio.dispatchResourceRequest(request, options)
582
589
  .then((response) => {
583
590
  return luvio.handleSuccessResponse(() => {
584
- const snapshot = ingestSuccess(luvio, resourceParams, response);
591
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response);
585
592
  return luvio.storeBroadcast().then(() => snapshot);
586
- }, () => getResponseCacheKeys(luvio, resourceParams, response.body));
593
+ }, () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
587
594
  }, (response) => {
588
- deepFreeze$4(response);
595
+ deepFreeze$7(response);
589
596
  throw response;
590
597
  });
591
598
  }
592
599
  const createProductAttributeDefinitionAdapterFactory = (luvio) => {
593
600
  return function createProductAttributeDefinition(untrustedConfig) {
594
- const config = validateAdapterConfig(untrustedConfig, createProductAttributeDefinition_ConfigPropertyNames);
601
+ const config = validateAdapterConfig$1(untrustedConfig, createProductAttributeDefinition_ConfigPropertyNames);
595
602
  // Invalid or incomplete config
596
603
  if (config === null) {
597
604
  throw new Error('Invalid config for "createProductAttributeDefinition"');
598
605
  }
599
- return buildNetworkSnapshot(luvio, config);
606
+ return buildNetworkSnapshot$1(luvio, config);
600
607
  };
601
608
  };
602
609
 
603
- export { createProductAttributeDefinitionAdapterFactory, deactivateAdapterFactory };
610
+ function validate$2(obj, path = 'ProductFlowConnectRepresentation') {
611
+ const v_error = (() => {
612
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
613
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
614
+ }
615
+ if (obj.flowApiName !== undefined) {
616
+ const obj_flowApiName = obj.flowApiName;
617
+ const path_flowApiName = path + '.flowApiName';
618
+ if (typeof obj_flowApiName !== 'string') {
619
+ return new TypeError('Expected "string" but received "' + typeof obj_flowApiName + '" (at "' + path_flowApiName + '")');
620
+ }
621
+ }
622
+ })();
623
+ return v_error === undefined ? null : v_error;
624
+ }
625
+ function deepFreeze$2(input) {
626
+ ObjectFreeze(input);
627
+ }
628
+
629
+ function validate$1(obj, path = 'Status') {
630
+ const v_error = (() => {
631
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
632
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
633
+ }
634
+ const obj_code = obj.code;
635
+ const path_code = path + '.code';
636
+ if (typeof obj_code !== 'string') {
637
+ return new TypeError('Expected "string" but received "' + typeof obj_code + '" (at "' + path_code + '")');
638
+ }
639
+ const obj_message = obj.message;
640
+ const path_message = path + '.message';
641
+ if (typeof obj_message !== 'string') {
642
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
643
+ }
644
+ })();
645
+ return v_error === undefined ? null : v_error;
646
+ }
647
+ function deepFreeze$1(input) {
648
+ ObjectFreeze(input);
649
+ }
650
+
651
+ const TTL = 6000;
652
+ const VERSION = "a75aed3c640fb969c24561ef4f8cb169";
653
+ function validate(obj, path = 'ProductFlowOutputRepresentation') {
654
+ const v_error = (() => {
655
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
656
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
657
+ }
658
+ if (obj.correlationId !== undefined) {
659
+ const obj_correlationId = obj.correlationId;
660
+ const path_correlationId = path + '.correlationId';
661
+ if (typeof obj_correlationId !== 'string') {
662
+ return new TypeError('Expected "string" but received "' + typeof obj_correlationId + '" (at "' + path_correlationId + '")');
663
+ }
664
+ }
665
+ if (obj.productFlow !== undefined) {
666
+ const obj_productFlow = obj.productFlow;
667
+ const path_productFlow = path + '.productFlow';
668
+ const referencepath_productFlowValidationError = validate$2(obj_productFlow, path_productFlow);
669
+ if (referencepath_productFlowValidationError !== null) {
670
+ let message = 'Object doesn\'t match ProductFlowConnectRepresentation (at "' + path_productFlow + '")\n';
671
+ message += referencepath_productFlowValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
672
+ return new TypeError(message);
673
+ }
674
+ }
675
+ if (obj.status !== undefined) {
676
+ const obj_status = obj.status;
677
+ const path_status = path + '.status';
678
+ const referencepath_statusValidationError = validate$1(obj_status, path_status);
679
+ if (referencepath_statusValidationError !== null) {
680
+ let message = 'Object doesn\'t match Status (at "' + path_status + '")\n';
681
+ message += referencepath_statusValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
682
+ return new TypeError(message);
683
+ }
684
+ }
685
+ })();
686
+ return v_error === undefined ? null : v_error;
687
+ }
688
+ const RepresentationType = 'ProductFlowOutputRepresentation';
689
+ function normalize(input, existing, path, luvio, store, timestamp) {
690
+ return input;
691
+ }
692
+ const select$1 = function ProductFlowOutputRepresentationSelect() {
693
+ return {
694
+ kind: 'Fragment',
695
+ version: VERSION,
696
+ private: [],
697
+ opaque: true
698
+ };
699
+ };
700
+ function equals(existing, incoming) {
701
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
702
+ return false;
703
+ }
704
+ return true;
705
+ }
706
+ function deepFreeze(input) {
707
+ const input_productFlow = input.productFlow;
708
+ if (input_productFlow !== undefined) {
709
+ deepFreeze$2(input_productFlow);
710
+ }
711
+ const input_status = input.status;
712
+ if (input_status !== undefined) {
713
+ deepFreeze$1(input_status);
714
+ }
715
+ ObjectFreeze(input);
716
+ }
717
+ const ingest = function ProductFlowOutputRepresentationIngest(input, path, luvio, store, timestamp) {
718
+ if (process.env.NODE_ENV !== 'production') {
719
+ const validateError = validate(input);
720
+ if (validateError !== null) {
721
+ throw validateError;
722
+ }
723
+ }
724
+ const key = path.fullPath;
725
+ const existingRecord = store.readEntry(key);
726
+ const ttlToUse = TTL;
727
+ let incomingRecord = normalize(input, store.readEntry(key), {
728
+ fullPath: key,
729
+ parent: path.parent,
730
+ propertyName: path.propertyName,
731
+ ttl: ttlToUse
732
+ });
733
+ deepFreeze(input);
734
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
735
+ luvio.storePublish(key, incomingRecord);
736
+ }
737
+ {
738
+ const storeMetadataParams = {
739
+ ttl: ttlToUse,
740
+ namespace: "epc",
741
+ version: VERSION,
742
+ representationName: RepresentationType,
743
+ };
744
+ luvio.publishStoreMetadata(key, storeMetadataParams);
745
+ }
746
+ return createLink(key);
747
+ };
748
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
749
+ const rootKeySet = new StoreKeyMap();
750
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
751
+ const rootKey = fullPathFactory();
752
+ rootKeySet.set(rootKey, {
753
+ namespace: keyPrefix,
754
+ representationName: RepresentationType,
755
+ mergeable: false
756
+ });
757
+ return rootKeySet;
758
+ }
759
+
760
+ function select(luvio, params) {
761
+ return select$1();
762
+ }
763
+ function keyBuilder$1(luvio, params) {
764
+ return keyPrefix + '::ProductFlowOutputRepresentation:(' + 'correlationId:' + params.queryParams.correlationId + ',' + 'productId:' + params.urlParams.productId + ')';
765
+ }
766
+ function getResponseCacheKeys(luvio, resourceParams, response) {
767
+ return getTypeCacheKeys(luvio, response, () => keyBuilder$1(luvio, resourceParams));
768
+ }
769
+ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
770
+ const { body } = response;
771
+ const key = keyBuilder$1(luvio, resourceParams);
772
+ luvio.storeIngest(key, ingest, body);
773
+ const snapshot = luvio.storeLookup({
774
+ recordId: key,
775
+ node: select(),
776
+ variables: {},
777
+ }, snapshotRefresh);
778
+ if (process.env.NODE_ENV !== 'production') {
779
+ if (snapshot.state !== 'Fulfilled') {
780
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
781
+ }
782
+ }
783
+ return snapshot;
784
+ }
785
+ function ingestError(luvio, params, error, snapshotRefresh) {
786
+ const key = keyBuilder$1(luvio, params);
787
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
788
+ const storeMetadataParams = {
789
+ ttl: TTL,
790
+ namespace: keyPrefix,
791
+ version: VERSION,
792
+ representationName: RepresentationType
793
+ };
794
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
795
+ return errorSnapshot;
796
+ }
797
+ function createResourceRequest(config) {
798
+ const headers = {};
799
+ return {
800
+ baseUri: '/services/data/v58.0',
801
+ basePath: '/connect/epc/products/' + config.urlParams.productId + '/flow',
802
+ method: 'get',
803
+ body: null,
804
+ urlParams: config.urlParams,
805
+ queryParams: config.queryParams,
806
+ headers,
807
+ priority: 'normal',
808
+ };
809
+ }
810
+
811
+ const getProductFlowByProductId_ConfigPropertyNames = {
812
+ displayName: 'getProductFlowByProductId',
813
+ parameters: {
814
+ required: ['productId'],
815
+ optional: ['correlationId']
816
+ }
817
+ };
818
+ function createResourceParams(config) {
819
+ const resourceParams = {
820
+ urlParams: {
821
+ productId: config.productId
822
+ },
823
+ queryParams: {
824
+ correlationId: config.correlationId
825
+ }
826
+ };
827
+ return resourceParams;
828
+ }
829
+ function keyBuilder(luvio, config) {
830
+ const resourceParams = createResourceParams(config);
831
+ return keyBuilder$1(luvio, resourceParams);
832
+ }
833
+ function typeCheckConfig(untrustedConfig) {
834
+ const config = {};
835
+ const untrustedConfig_productId = untrustedConfig.productId;
836
+ if (typeof untrustedConfig_productId === 'string') {
837
+ config.productId = untrustedConfig_productId;
838
+ }
839
+ const untrustedConfig_correlationId = untrustedConfig.correlationId;
840
+ if (typeof untrustedConfig_correlationId === 'string') {
841
+ config.correlationId = untrustedConfig_correlationId;
842
+ }
843
+ return config;
844
+ }
845
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
846
+ if (!untrustedIsObject(untrustedConfig)) {
847
+ return null;
848
+ }
849
+ if (process.env.NODE_ENV !== 'production') {
850
+ validateConfig(untrustedConfig, configPropertyNames);
851
+ }
852
+ const config = typeCheckConfig(untrustedConfig);
853
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
854
+ return null;
855
+ }
856
+ return config;
857
+ }
858
+ function adapterFragment(luvio, config) {
859
+ createResourceParams(config);
860
+ return select();
861
+ }
862
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
863
+ const snapshot = ingestSuccess(luvio, resourceParams, response, {
864
+ config,
865
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
866
+ });
867
+ return luvio.storeBroadcast().then(() => snapshot);
868
+ }
869
+ function onFetchResponseError(luvio, config, resourceParams, response) {
870
+ const snapshot = ingestError(luvio, resourceParams, response, {
871
+ config,
872
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
873
+ });
874
+ return luvio.storeBroadcast().then(() => snapshot);
875
+ }
876
+ function buildNetworkSnapshot(luvio, config, options) {
877
+ const resourceParams = createResourceParams(config);
878
+ const request = createResourceRequest(resourceParams);
879
+ return luvio.dispatchResourceRequest(request, options)
880
+ .then((response) => {
881
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
882
+ }, (response) => {
883
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
884
+ });
885
+ }
886
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
887
+ const { luvio, config } = context;
888
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
889
+ const dispatchOptions = {
890
+ resourceRequestContext: {
891
+ requestCorrelator,
892
+ luvioRequestMethod: undefined,
893
+ },
894
+ eventObservers
895
+ };
896
+ if (networkPriority !== 'normal') {
897
+ dispatchOptions.overrides = {
898
+ priority: networkPriority
899
+ };
900
+ }
901
+ return buildNetworkSnapshot(luvio, config, dispatchOptions);
902
+ }
903
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
904
+ const { luvio, config } = context;
905
+ const selector = {
906
+ recordId: keyBuilder(luvio, config),
907
+ node: adapterFragment(luvio, config),
908
+ variables: {},
909
+ };
910
+ const cacheSnapshot = storeLookup(selector, {
911
+ config,
912
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
913
+ });
914
+ return cacheSnapshot;
915
+ }
916
+ const getProductFlowByProductIdAdapterFactory = (luvio) => function epc__getProductFlowByProductId(untrustedConfig, requestContext) {
917
+ const config = validateAdapterConfig(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, buildNetworkSnapshotCachePolicy);
924
+ };
925
+
926
+ export { createProductAttributeDefinitionAdapterFactory, deactivateAdapterFactory, getProductFlowByProductIdAdapterFactory };