@salesforce/lds-adapters-industries-field-service 1.294.0 → 1.296.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.
@@ -4,7 +4,7 @@
4
4
  * For full license text, see the LICENSE.txt file
5
5
  */
6
6
 
7
- import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckConfig as typeCheckConfig$4, StoreKeyMap, createResourceParams as createResourceParams$4 } from '@luvio/engine';
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckConfig as typeCheckConfig$5, StoreKeyMap, createResourceParams as createResourceParams$5 } from '@luvio/engine';
8
8
 
9
9
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
10
  const { keys: ObjectKeys, create: ObjectCreate } = Object;
@@ -91,8 +91,8 @@ function createLink(ref) {
91
91
  };
92
92
  }
93
93
 
94
- const VERSION$3 = "2f0233a95128b9599e2fdc4792332572";
95
- function validate$4(obj, path = 'AppointmentSlotRepresentation') {
94
+ const VERSION$4 = "2f0233a95128b9599e2fdc4792332572";
95
+ function validate$5(obj, path = 'AppointmentSlotRepresentation') {
96
96
  const v_error = (() => {
97
97
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
98
98
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -111,10 +111,10 @@ function validate$4(obj, path = 'AppointmentSlotRepresentation') {
111
111
  })();
112
112
  return v_error === undefined ? null : v_error;
113
113
  }
114
- const select$7 = function AppointmentSlotRepresentationSelect() {
114
+ const select$9 = function AppointmentSlotRepresentationSelect() {
115
115
  return {
116
116
  kind: 'Fragment',
117
- version: VERSION$3,
117
+ version: VERSION$4,
118
118
  private: [],
119
119
  selections: [
120
120
  {
@@ -132,7 +132,7 @@ const select$7 = function AppointmentSlotRepresentationSelect() {
132
132
  ]
133
133
  };
134
134
  };
135
- function equals$3(existing, incoming) {
135
+ function equals$4(existing, incoming) {
136
136
  const existing_finishInterval = existing.finishInterval;
137
137
  const incoming_finishInterval = incoming.finishInterval;
138
138
  if (!(existing_finishInterval === incoming_finishInterval)) {
@@ -151,9 +151,9 @@ function equals$3(existing, incoming) {
151
151
  return true;
152
152
  }
153
153
 
154
- const TTL$2 = 1000;
155
- const VERSION$2 = "adf3d4fd725138657e26bece6c0bc136";
156
- function validate$3(obj, path = 'AppointmentSchedulingRepresentation') {
154
+ const TTL$3 = 1000;
155
+ const VERSION$3 = "adf3d4fd725138657e26bece6c0bc136";
156
+ function validate$4(obj, path = 'AppointmentSchedulingRepresentation') {
157
157
  const v_error = (() => {
158
158
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
159
159
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -166,7 +166,7 @@ function validate$3(obj, path = 'AppointmentSchedulingRepresentation') {
166
166
  for (let i = 0; i < obj_appointmentSlots.length; i++) {
167
167
  const obj_appointmentSlots_item = obj_appointmentSlots[i];
168
168
  const path_appointmentSlots_item = path_appointmentSlots + '[' + i + ']';
169
- const referencepath_appointmentSlots_itemValidationError = validate$4(obj_appointmentSlots_item, path_appointmentSlots_item);
169
+ const referencepath_appointmentSlots_itemValidationError = validate$5(obj_appointmentSlots_item, path_appointmentSlots_item);
170
170
  if (referencepath_appointmentSlots_itemValidationError !== null) {
171
171
  let message = 'Object doesn\'t match AppointmentSlotRepresentation (at "' + path_appointmentSlots_item + '")\n';
172
172
  message += referencepath_appointmentSlots_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -201,24 +201,24 @@ function validate$3(obj, path = 'AppointmentSchedulingRepresentation') {
201
201
  })();
202
202
  return v_error === undefined ? null : v_error;
203
203
  }
204
- const RepresentationType$2 = 'AppointmentSchedulingRepresentation';
205
- function keyBuilder$4(luvio, config) {
206
- return keyPrefix + '::' + RepresentationType$2 + ':' + config.id;
204
+ const RepresentationType$3 = 'AppointmentSchedulingRepresentation';
205
+ function keyBuilder$5(luvio, config) {
206
+ return keyPrefix + '::' + RepresentationType$3 + ':' + config.id;
207
207
  }
208
- function keyBuilderFromType$2(luvio, object) {
208
+ function keyBuilderFromType$3(luvio, object) {
209
209
  const keyParams = {
210
210
  id: object.serviceAppointmentId
211
211
  };
212
- return keyBuilder$4(luvio, keyParams);
212
+ return keyBuilder$5(luvio, keyParams);
213
213
  }
214
- function normalize$2(input, existing, path, luvio, store, timestamp) {
214
+ function normalize$3(input, existing, path, luvio, store, timestamp) {
215
215
  return input;
216
216
  }
217
- const select$6 = function AppointmentSchedulingRepresentationSelect() {
218
- const { selections: AppointmentSlotRepresentation__selections, opaque: AppointmentSlotRepresentation__opaque, } = select$7();
217
+ const select$8 = function AppointmentSchedulingRepresentationSelect() {
218
+ const { selections: AppointmentSlotRepresentation__selections, opaque: AppointmentSlotRepresentation__opaque, } = select$9();
219
219
  return {
220
220
  kind: 'Fragment',
221
- version: VERSION$2,
221
+ version: VERSION$3,
222
222
  private: [],
223
223
  selections: [
224
224
  {
@@ -250,7 +250,7 @@ const select$6 = function AppointmentSchedulingRepresentationSelect() {
250
250
  ]
251
251
  };
252
252
  };
253
- function equals$2(existing, incoming) {
253
+ function equals$3(existing, incoming) {
254
254
  const existing_isSuccess = existing.isSuccess;
255
255
  const incoming_isSuccess = incoming.isSuccess;
256
256
  if (!(existing_isSuccess === incoming_isSuccess)) {
@@ -279,7 +279,7 @@ function equals$2(existing, incoming) {
279
279
  const existing_appointmentSlots = existing.appointmentSlots;
280
280
  const incoming_appointmentSlots = incoming.appointmentSlots;
281
281
  const equals_appointmentSlots_items = equalsArray(existing_appointmentSlots, incoming_appointmentSlots, (existing_appointmentSlots_item, incoming_appointmentSlots_item) => {
282
- if (!(equals$3(existing_appointmentSlots_item, incoming_appointmentSlots_item))) {
282
+ if (!(equals$4(existing_appointmentSlots_item, incoming_appointmentSlots_item))) {
283
283
  return false;
284
284
  }
285
285
  });
@@ -288,46 +288,46 @@ function equals$2(existing, incoming) {
288
288
  }
289
289
  return true;
290
290
  }
291
- const ingest$2 = function AppointmentSchedulingRepresentationIngest(input, path, luvio, store, timestamp) {
291
+ const ingest$3 = function AppointmentSchedulingRepresentationIngest(input, path, luvio, store, timestamp) {
292
292
  if (process.env.NODE_ENV !== 'production') {
293
- const validateError = validate$3(input);
293
+ const validateError = validate$4(input);
294
294
  if (validateError !== null) {
295
295
  throw validateError;
296
296
  }
297
297
  }
298
- const key = keyBuilderFromType$2(luvio, input);
299
- const ttlToUse = TTL$2;
300
- ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "field-service", VERSION$2, RepresentationType$2, equals$2);
298
+ const key = keyBuilderFromType$3(luvio, input);
299
+ const ttlToUse = TTL$3;
300
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "field-service", VERSION$3, RepresentationType$3, equals$3);
301
301
  return createLink(key);
302
302
  };
303
- function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
303
+ function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
304
304
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
305
- const rootKey = keyBuilderFromType$2(luvio, input);
305
+ const rootKey = keyBuilderFromType$3(luvio, input);
306
306
  rootKeySet.set(rootKey, {
307
307
  namespace: keyPrefix,
308
- representationName: RepresentationType$2,
308
+ representationName: RepresentationType$3,
309
309
  mergeable: false
310
310
  });
311
311
  }
312
312
 
313
- function select$5(luvio, params) {
314
- return select$6();
313
+ function select$7(luvio, params) {
314
+ return select$8();
315
315
  }
316
- function keyBuilder$3(luvio, params) {
317
- return keyBuilder$4(luvio, {
316
+ function keyBuilder$4(luvio, params) {
317
+ return keyBuilder$5(luvio, {
318
318
  id: params.urlParams.serviceAppointmentId
319
319
  });
320
320
  }
321
- function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
322
- getTypeCacheKeys$2(storeKeyMap, luvio, response);
321
+ function getResponseCacheKeys$4(storeKeyMap, luvio, resourceParams, response) {
322
+ getTypeCacheKeys$3(storeKeyMap, luvio, response);
323
323
  }
324
- function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
324
+ function ingestSuccess$4(luvio, resourceParams, response, snapshotRefresh) {
325
325
  const { body } = response;
326
- const key = keyBuilder$3(luvio, resourceParams);
327
- luvio.storeIngest(key, ingest$2, body);
326
+ const key = keyBuilder$4(luvio, resourceParams);
327
+ luvio.storeIngest(key, ingest$3, body);
328
328
  const snapshot = luvio.storeLookup({
329
329
  recordId: key,
330
- node: select$5(),
330
+ node: select$7(),
331
331
  variables: {},
332
332
  }, snapshotRefresh);
333
333
  if (process.env.NODE_ENV !== 'production') {
@@ -339,18 +339,18 @@ function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
339
339
  return snapshot;
340
340
  }
341
341
  function ingestError(luvio, params, error, snapshotRefresh) {
342
- const key = keyBuilder$3(luvio, params);
342
+ const key = keyBuilder$4(luvio, params);
343
343
  const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
344
344
  const storeMetadataParams = {
345
- ttl: TTL$2,
345
+ ttl: TTL$3,
346
346
  namespace: keyPrefix,
347
- version: VERSION$2,
348
- representationName: RepresentationType$2
347
+ version: VERSION$3,
348
+ representationName: RepresentationType$3
349
349
  };
350
350
  luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
351
351
  return errorSnapshot;
352
352
  }
353
- function createResourceRequest$3(config) {
353
+ function createResourceRequest$4(config) {
354
354
  const headers = {};
355
355
  return {
356
356
  baseUri: '/services/data/v62.0',
@@ -364,61 +364,61 @@ function createResourceRequest$3(config) {
364
364
  };
365
365
  }
366
366
 
367
- const adapterName$3 = 'getAppointmentSlots';
367
+ const adapterName$4 = 'getAppointmentSlots';
368
368
  const getAppointmentSlots_ConfigPropertyMetadata = [
369
369
  generateParamConfigMetadata('serviceAppointmentId', true, 0 /* UrlParameter */, 0 /* String */),
370
370
  generateParamConfigMetadata('schedulingPolicyId', true, 0 /* UrlParameter */, 0 /* String */),
371
371
  ];
372
- const getAppointmentSlots_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, getAppointmentSlots_ConfigPropertyMetadata);
373
- const createResourceParams$3 = /*#__PURE__*/ createResourceParams$4(getAppointmentSlots_ConfigPropertyMetadata);
374
- function keyBuilder$2(luvio, config) {
375
- const resourceParams = createResourceParams$3(config);
376
- return keyBuilder$3(luvio, resourceParams);
372
+ const getAppointmentSlots_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$4, getAppointmentSlots_ConfigPropertyMetadata);
373
+ const createResourceParams$4 = /*#__PURE__*/ createResourceParams$5(getAppointmentSlots_ConfigPropertyMetadata);
374
+ function keyBuilder$3(luvio, config) {
375
+ const resourceParams = createResourceParams$4(config);
376
+ return keyBuilder$4(luvio, resourceParams);
377
377
  }
378
- function typeCheckConfig$3(untrustedConfig) {
378
+ function typeCheckConfig$4(untrustedConfig) {
379
379
  const config = {};
380
- typeCheckConfig$4(untrustedConfig, config, getAppointmentSlots_ConfigPropertyMetadata);
380
+ typeCheckConfig$5(untrustedConfig, config, getAppointmentSlots_ConfigPropertyMetadata);
381
381
  return config;
382
382
  }
383
- function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
383
+ function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
384
384
  if (!untrustedIsObject(untrustedConfig)) {
385
385
  return null;
386
386
  }
387
387
  if (process.env.NODE_ENV !== 'production') {
388
388
  validateConfig(untrustedConfig, configPropertyNames);
389
389
  }
390
- const config = typeCheckConfig$3(untrustedConfig);
390
+ const config = typeCheckConfig$4(untrustedConfig);
391
391
  if (!areRequiredParametersPresent(config, configPropertyNames)) {
392
392
  return null;
393
393
  }
394
394
  return config;
395
395
  }
396
396
  function adapterFragment(luvio, config) {
397
- createResourceParams$3(config);
398
- return select$5();
397
+ createResourceParams$4(config);
398
+ return select$7();
399
399
  }
400
400
  function onFetchResponseSuccess(luvio, config, resourceParams, response) {
401
- const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
401
+ const snapshot = ingestSuccess$4(luvio, resourceParams, response, {
402
402
  config,
403
- resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
403
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
404
404
  });
405
405
  return luvio.storeBroadcast().then(() => snapshot);
406
406
  }
407
407
  function onFetchResponseError(luvio, config, resourceParams, response) {
408
408
  const snapshot = ingestError(luvio, resourceParams, response, {
409
409
  config,
410
- resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
410
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
411
411
  });
412
412
  return luvio.storeBroadcast().then(() => snapshot);
413
413
  }
414
- function buildNetworkSnapshot$3(luvio, config, options) {
415
- const resourceParams = createResourceParams$3(config);
416
- const request = createResourceRequest$3(resourceParams);
414
+ function buildNetworkSnapshot$4(luvio, config, options) {
415
+ const resourceParams = createResourceParams$4(config);
416
+ const request = createResourceRequest$4(resourceParams);
417
417
  return luvio.dispatchResourceRequest(request, options)
418
418
  .then((response) => {
419
419
  return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
420
420
  const cache = new StoreKeyMap();
421
- getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
421
+ getResponseCacheKeys$4(cache, luvio, resourceParams, response.body);
422
422
  return cache;
423
423
  });
424
424
  }, (response) => {
@@ -426,23 +426,23 @@ function buildNetworkSnapshot$3(luvio, config, options) {
426
426
  });
427
427
  }
428
428
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
429
- return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$3, undefined, false);
429
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$4, undefined, false);
430
430
  }
431
431
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
432
432
  const { luvio, config } = context;
433
433
  const selector = {
434
- recordId: keyBuilder$2(luvio, config),
434
+ recordId: keyBuilder$3(luvio, config),
435
435
  node: adapterFragment(luvio, config),
436
436
  variables: {},
437
437
  };
438
438
  const cacheSnapshot = storeLookup(selector, {
439
439
  config,
440
- resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
440
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
441
441
  });
442
442
  return cacheSnapshot;
443
443
  }
444
444
  const getAppointmentSlotsAdapterFactory = (luvio) => function fieldService__getAppointmentSlots(untrustedConfig, requestContext) {
445
- const config = validateAdapterConfig$3(untrustedConfig, getAppointmentSlots_ConfigPropertyNames);
445
+ const config = validateAdapterConfig$4(untrustedConfig, getAppointmentSlots_ConfigPropertyNames);
446
446
  // Invalid or incomplete config
447
447
  if (config === null) {
448
448
  return null;
@@ -451,19 +451,19 @@ const getAppointmentSlotsAdapterFactory = (luvio) => function fieldService__getA
451
451
  buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
452
452
  };
453
453
 
454
- function select$4(luvio, params) {
455
- return select$6();
454
+ function select$6(luvio, params) {
455
+ return select$8();
456
456
  }
457
- function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
458
- getTypeCacheKeys$2(storeKeyMap, luvio, response);
457
+ function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
458
+ getTypeCacheKeys$3(storeKeyMap, luvio, response);
459
459
  }
460
- function ingestSuccess$2(luvio, resourceParams, response) {
460
+ function ingestSuccess$3(luvio, resourceParams, response) {
461
461
  const { body } = response;
462
- const key = keyBuilderFromType$2(luvio, body);
463
- luvio.storeIngest(key, ingest$2, body);
462
+ const key = keyBuilderFromType$3(luvio, body);
463
+ luvio.storeIngest(key, ingest$3, body);
464
464
  const snapshot = luvio.storeLookup({
465
465
  recordId: key,
466
- node: select$4(),
466
+ node: select$6(),
467
467
  variables: {},
468
468
  });
469
469
  if (process.env.NODE_ENV !== 'production') {
@@ -474,7 +474,7 @@ function ingestSuccess$2(luvio, resourceParams, response) {
474
474
  deepFreeze(snapshot.data);
475
475
  return snapshot;
476
476
  }
477
- function createResourceRequest$2(config) {
477
+ function createResourceRequest$3(config) {
478
478
  const headers = {};
479
479
  return {
480
480
  baseUri: '/services/data/v62.0',
@@ -488,42 +488,42 @@ function createResourceRequest$2(config) {
488
488
  };
489
489
  }
490
490
 
491
- const adapterName$2 = 'bookAppointmentSlot';
491
+ const adapterName$3 = 'bookAppointmentSlot';
492
492
  const bookAppointmentSlot_ConfigPropertyMetadata = [
493
493
  generateParamConfigMetadata('serviceAppointmentId', true, 0 /* UrlParameter */, 0 /* String */),
494
494
  generateParamConfigMetadata('schedulingPolicyId', true, 0 /* UrlParameter */, 0 /* String */),
495
495
  ];
496
- const bookAppointmentSlot_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, bookAppointmentSlot_ConfigPropertyMetadata);
497
- const createResourceParams$2 = /*#__PURE__*/ createResourceParams$4(bookAppointmentSlot_ConfigPropertyMetadata);
498
- function typeCheckConfig$2(untrustedConfig) {
496
+ const bookAppointmentSlot_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, bookAppointmentSlot_ConfigPropertyMetadata);
497
+ const createResourceParams$3 = /*#__PURE__*/ createResourceParams$5(bookAppointmentSlot_ConfigPropertyMetadata);
498
+ function typeCheckConfig$3(untrustedConfig) {
499
499
  const config = {};
500
- typeCheckConfig$4(untrustedConfig, config, bookAppointmentSlot_ConfigPropertyMetadata);
500
+ typeCheckConfig$5(untrustedConfig, config, bookAppointmentSlot_ConfigPropertyMetadata);
501
501
  return config;
502
502
  }
503
- function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
503
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
504
504
  if (!untrustedIsObject(untrustedConfig)) {
505
505
  return null;
506
506
  }
507
507
  if (process.env.NODE_ENV !== 'production') {
508
508
  validateConfig(untrustedConfig, configPropertyNames);
509
509
  }
510
- const config = typeCheckConfig$2(untrustedConfig);
510
+ const config = typeCheckConfig$3(untrustedConfig);
511
511
  if (!areRequiredParametersPresent(config, configPropertyNames)) {
512
512
  return null;
513
513
  }
514
514
  return config;
515
515
  }
516
- function buildNetworkSnapshot$2(luvio, config, options) {
517
- const resourceParams = createResourceParams$2(config);
518
- const request = createResourceRequest$2(resourceParams);
516
+ function buildNetworkSnapshot$3(luvio, config, options) {
517
+ const resourceParams = createResourceParams$3(config);
518
+ const request = createResourceRequest$3(resourceParams);
519
519
  return luvio.dispatchResourceRequest(request, options)
520
520
  .then((response) => {
521
521
  return luvio.handleSuccessResponse(() => {
522
- const snapshot = ingestSuccess$2(luvio, resourceParams, response);
522
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response);
523
523
  return luvio.storeBroadcast().then(() => snapshot);
524
524
  }, () => {
525
525
  const cache = new StoreKeyMap();
526
- getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
526
+ getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
527
527
  return cache;
528
528
  });
529
529
  }, (response) => {
@@ -533,18 +533,18 @@ function buildNetworkSnapshot$2(luvio, config, options) {
533
533
  }
534
534
  const bookAppointmentSlotAdapterFactory = (luvio) => {
535
535
  return function bookAppointmentSlot(untrustedConfig) {
536
- const config = validateAdapterConfig$2(untrustedConfig, bookAppointmentSlot_ConfigPropertyNames);
536
+ const config = validateAdapterConfig$3(untrustedConfig, bookAppointmentSlot_ConfigPropertyNames);
537
537
  // Invalid or incomplete config
538
538
  if (config === null) {
539
539
  throw new Error('Invalid config for "bookAppointmentSlot"');
540
540
  }
541
- return buildNetworkSnapshot$2(luvio, config);
541
+ return buildNetworkSnapshot$3(luvio, config);
542
542
  };
543
543
  };
544
544
 
545
- const TTL$1 = 300;
546
- const VERSION$1 = "5c4aa8faf25b64f7b7f98f8739c11b45";
547
- function validate$2(obj, path = 'ProductServiceCampaignItemsFromListRepresentation') {
545
+ const TTL$2 = 300;
546
+ const VERSION$2 = "5c4aa8faf25b64f7b7f98f8739c11b45";
547
+ function validate$3(obj, path = 'ProductServiceCampaignItemsFromListRepresentation') {
548
548
  const v_error = (() => {
549
549
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
550
550
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -609,23 +609,23 @@ function validate$2(obj, path = 'ProductServiceCampaignItemsFromListRepresentati
609
609
  })();
610
610
  return v_error === undefined ? null : v_error;
611
611
  }
612
- const RepresentationType$1 = 'ProductServiceCampaignItemsFromListRepresentation';
613
- function keyBuilder$1(luvio, config) {
614
- return keyPrefix + '::' + RepresentationType$1 + ':' + config.isSuccess;
612
+ const RepresentationType$2 = 'ProductServiceCampaignItemsFromListRepresentation';
613
+ function keyBuilder$2(luvio, config) {
614
+ return keyPrefix + '::' + RepresentationType$2 + ':' + config.isSuccess;
615
615
  }
616
- function keyBuilderFromType$1(luvio, object) {
616
+ function keyBuilderFromType$2(luvio, object) {
617
617
  const keyParams = {
618
618
  isSuccess: object.isSuccess
619
619
  };
620
- return keyBuilder$1(luvio, keyParams);
620
+ return keyBuilder$2(luvio, keyParams);
621
621
  }
622
- function normalize$1(input, existing, path, luvio, store, timestamp) {
622
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
623
623
  return input;
624
624
  }
625
- const select$3 = function ProductServiceCampaignItemsFromListRepresentationSelect() {
625
+ const select$5 = function ProductServiceCampaignItemsFromListRepresentationSelect() {
626
626
  return {
627
627
  kind: 'Fragment',
628
- version: VERSION$1,
628
+ version: VERSION$2,
629
629
  private: [],
630
630
  selections: [
631
631
  {
@@ -643,7 +643,7 @@ const select$3 = function ProductServiceCampaignItemsFromListRepresentationSelec
643
643
  ]
644
644
  };
645
645
  };
646
- function equals$1(existing, incoming) {
646
+ function equals$2(existing, incoming) {
647
647
  const existing_isSuccess = existing.isSuccess;
648
648
  const incoming_isSuccess = incoming.isSuccess;
649
649
  if (!(existing_isSuccess === incoming_isSuccess)) {
@@ -661,7 +661,243 @@ function equals$1(existing, incoming) {
661
661
  }
662
662
  return true;
663
663
  }
664
- const ingest$1 = function ProductServiceCampaignItemsFromListRepresentationIngest(input, path, luvio, store, timestamp) {
664
+ const ingest$2 = function ProductServiceCampaignItemsFromListRepresentationIngest(input, path, luvio, store, timestamp) {
665
+ if (process.env.NODE_ENV !== 'production') {
666
+ const validateError = validate$3(input);
667
+ if (validateError !== null) {
668
+ throw validateError;
669
+ }
670
+ }
671
+ const key = keyBuilderFromType$2(luvio, input);
672
+ const ttlToUse = TTL$2;
673
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "field-service", VERSION$2, RepresentationType$2, equals$2);
674
+ return createLink(key);
675
+ };
676
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
677
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
678
+ const rootKey = keyBuilderFromType$2(luvio, input);
679
+ rootKeySet.set(rootKey, {
680
+ namespace: keyPrefix,
681
+ representationName: RepresentationType$2,
682
+ mergeable: false
683
+ });
684
+ }
685
+
686
+ function select$4(luvio, params) {
687
+ return select$5();
688
+ }
689
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
690
+ getTypeCacheKeys$2(storeKeyMap, luvio, response);
691
+ }
692
+ function ingestSuccess$2(luvio, resourceParams, response) {
693
+ const { body } = response;
694
+ const key = keyBuilderFromType$2(luvio, body);
695
+ luvio.storeIngest(key, ingest$2, body);
696
+ const snapshot = luvio.storeLookup({
697
+ recordId: key,
698
+ node: select$4(),
699
+ variables: {},
700
+ });
701
+ if (process.env.NODE_ENV !== 'production') {
702
+ if (snapshot.state !== 'Fulfilled') {
703
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
704
+ }
705
+ }
706
+ deepFreeze(snapshot.data);
707
+ return snapshot;
708
+ }
709
+ function createResourceRequest$2(config) {
710
+ const headers = {};
711
+ return {
712
+ baseUri: '/services/data/v62.0',
713
+ basePath: '/connect/industries-field-service/product-service-campaign/items-from-list',
714
+ method: 'post',
715
+ body: config.body,
716
+ urlParams: {},
717
+ queryParams: {},
718
+ headers,
719
+ priority: 'normal',
720
+ };
721
+ }
722
+
723
+ const adapterName$2 = 'createProductServiceCampaign';
724
+ const createProductServiceCampaign_ConfigPropertyMetadata = [
725
+ generateParamConfigMetadata('actionableListId', true, 2 /* Body */, 0 /* String */),
726
+ ];
727
+ const createProductServiceCampaign_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, createProductServiceCampaign_ConfigPropertyMetadata);
728
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$5(createProductServiceCampaign_ConfigPropertyMetadata);
729
+ function typeCheckConfig$2(untrustedConfig) {
730
+ const config = {};
731
+ typeCheckConfig$5(untrustedConfig, config, createProductServiceCampaign_ConfigPropertyMetadata);
732
+ return config;
733
+ }
734
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
735
+ if (!untrustedIsObject(untrustedConfig)) {
736
+ return null;
737
+ }
738
+ if (process.env.NODE_ENV !== 'production') {
739
+ validateConfig(untrustedConfig, configPropertyNames);
740
+ }
741
+ const config = typeCheckConfig$2(untrustedConfig);
742
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
743
+ return null;
744
+ }
745
+ return config;
746
+ }
747
+ function buildNetworkSnapshot$2(luvio, config, options) {
748
+ const resourceParams = createResourceParams$2(config);
749
+ const request = createResourceRequest$2(resourceParams);
750
+ return luvio.dispatchResourceRequest(request, options)
751
+ .then((response) => {
752
+ return luvio.handleSuccessResponse(() => {
753
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response);
754
+ return luvio.storeBroadcast().then(() => snapshot);
755
+ }, () => {
756
+ const cache = new StoreKeyMap();
757
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
758
+ return cache;
759
+ });
760
+ }, (response) => {
761
+ deepFreeze(response);
762
+ throw response;
763
+ });
764
+ }
765
+ const createProductServiceCampaignAdapterFactory = (luvio) => {
766
+ return function createProductServiceCampaign(untrustedConfig) {
767
+ const config = validateAdapterConfig$2(untrustedConfig, createProductServiceCampaign_ConfigPropertyNames);
768
+ // Invalid or incomplete config
769
+ if (config === null) {
770
+ throw new Error('Invalid config for "createProductServiceCampaign"');
771
+ }
772
+ return buildNetworkSnapshot$2(luvio, config);
773
+ };
774
+ };
775
+
776
+ const TTL$1 = 300;
777
+ const VERSION$1 = "52d266d6b375747affaaa8af9def274e";
778
+ function validate$2(obj, path = 'WorkOrderForProductServiceCampaignItemRepresentation') {
779
+ const v_error = (() => {
780
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
781
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
782
+ }
783
+ if (obj.errorCode !== undefined) {
784
+ const obj_errorCode = obj.errorCode;
785
+ const path_errorCode = path + '.errorCode';
786
+ if (typeof obj_errorCode !== 'string') {
787
+ return new TypeError('Expected "string" but received "' + typeof obj_errorCode + '" (at "' + path_errorCode + '")');
788
+ }
789
+ }
790
+ if (obj.errorMessage !== undefined) {
791
+ const obj_errorMessage = obj.errorMessage;
792
+ const path_errorMessage = path + '.errorMessage';
793
+ if (typeof obj_errorMessage !== 'string') {
794
+ return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
795
+ }
796
+ }
797
+ const obj_isSuccess = obj.isSuccess;
798
+ const path_isSuccess = path + '.isSuccess';
799
+ if (typeof obj_isSuccess !== 'boolean') {
800
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
801
+ }
802
+ if (obj.workOrderCount !== undefined) {
803
+ const obj_workOrderCount = obj.workOrderCount;
804
+ const path_workOrderCount = path + '.workOrderCount';
805
+ if (typeof obj_workOrderCount !== 'number' || (typeof obj_workOrderCount === 'number' && Math.floor(obj_workOrderCount) !== obj_workOrderCount)) {
806
+ return new TypeError('Expected "integer" but received "' + typeof obj_workOrderCount + '" (at "' + path_workOrderCount + '")');
807
+ }
808
+ }
809
+ })();
810
+ return v_error === undefined ? null : v_error;
811
+ }
812
+ const RepresentationType$1 = 'WorkOrderForProductServiceCampaignItemRepresentation';
813
+ function keyBuilder$1(luvio, config) {
814
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.id;
815
+ }
816
+ function keyBuilderFromType$1(luvio, object) {
817
+ const keyParams = {
818
+ id: object.isSuccess
819
+ };
820
+ return keyBuilder$1(luvio, keyParams);
821
+ }
822
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
823
+ return input;
824
+ }
825
+ const select$3 = function WorkOrderForProductServiceCampaignItemRepresentationSelect() {
826
+ return {
827
+ kind: 'Fragment',
828
+ version: VERSION$1,
829
+ private: [],
830
+ selections: [
831
+ {
832
+ name: 'errorCode',
833
+ kind: 'Scalar',
834
+ required: false
835
+ },
836
+ {
837
+ name: 'errorMessage',
838
+ kind: 'Scalar',
839
+ required: false
840
+ },
841
+ {
842
+ name: 'isSuccess',
843
+ kind: 'Scalar'
844
+ },
845
+ {
846
+ name: 'workOrderCount',
847
+ kind: 'Scalar',
848
+ required: false
849
+ }
850
+ ]
851
+ };
852
+ };
853
+ function equals$1(existing, incoming) {
854
+ const existing_isSuccess = existing.isSuccess;
855
+ const incoming_isSuccess = incoming.isSuccess;
856
+ if (!(existing_isSuccess === incoming_isSuccess)) {
857
+ return false;
858
+ }
859
+ const existing_workOrderCount = existing.workOrderCount;
860
+ const incoming_workOrderCount = incoming.workOrderCount;
861
+ // if at least one of these optionals is defined
862
+ if (existing_workOrderCount !== undefined || incoming_workOrderCount !== undefined) {
863
+ // if one of these is not defined we know the other is defined and therefore
864
+ // not equal
865
+ if (existing_workOrderCount === undefined || incoming_workOrderCount === undefined) {
866
+ return false;
867
+ }
868
+ if (!(existing_workOrderCount === incoming_workOrderCount)) {
869
+ return false;
870
+ }
871
+ }
872
+ const existing_errorCode = existing.errorCode;
873
+ const incoming_errorCode = incoming.errorCode;
874
+ // if at least one of these optionals is defined
875
+ if (existing_errorCode !== undefined || incoming_errorCode !== undefined) {
876
+ // if one of these is not defined we know the other is defined and therefore
877
+ // not equal
878
+ if (existing_errorCode === undefined || incoming_errorCode === undefined) {
879
+ return false;
880
+ }
881
+ if (!(existing_errorCode === incoming_errorCode)) {
882
+ return false;
883
+ }
884
+ }
885
+ const existing_errorMessage = existing.errorMessage;
886
+ const incoming_errorMessage = incoming.errorMessage;
887
+ // if at least one of these optionals is defined
888
+ if (existing_errorMessage !== undefined || incoming_errorMessage !== undefined) {
889
+ // if one of these is not defined we know the other is defined and therefore
890
+ // not equal
891
+ if (existing_errorMessage === undefined || incoming_errorMessage === undefined) {
892
+ return false;
893
+ }
894
+ if (!(existing_errorMessage === incoming_errorMessage)) {
895
+ return false;
896
+ }
897
+ }
898
+ return true;
899
+ }
900
+ const ingest$1 = function WorkOrderForProductServiceCampaignItemRepresentationIngest(input, path, luvio, store, timestamp) {
665
901
  if (process.env.NODE_ENV !== 'production') {
666
902
  const validateError = validate$2(input);
667
903
  if (validateError !== null) {
@@ -710,7 +946,7 @@ function createResourceRequest$1(config) {
710
946
  const headers = {};
711
947
  return {
712
948
  baseUri: '/services/data/v62.0',
713
- basePath: '/connect/industries-field-service/product-service-campaign/items-from-list',
949
+ basePath: '/connect/industries-field-service/product-service-campaign/work-order',
714
950
  method: 'post',
715
951
  body: config.body,
716
952
  urlParams: {},
@@ -720,15 +956,30 @@ function createResourceRequest$1(config) {
720
956
  };
721
957
  }
722
958
 
723
- const adapterName$1 = 'createProductServiceCampaign';
724
- const createProductServiceCampaign_ConfigPropertyMetadata = [
725
- generateParamConfigMetadata('actionableListId', true, 2 /* Body */, 0 /* String */),
959
+ const adapterName$1 = 'createWorkOrders';
960
+ const createWorkOrders_ConfigPropertyMetadata = [
961
+ generateParamConfigMetadata('productServiceCampaignId', false, 2 /* Body */, 0 /* String */),
962
+ generateParamConfigMetadata('productServiceCampaignItemIds', false, 2 /* Body */, 4 /* Unsupported */, true),
726
963
  ];
727
- const createProductServiceCampaign_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, createProductServiceCampaign_ConfigPropertyMetadata);
728
- const createResourceParams$1 = /*#__PURE__*/ createResourceParams$4(createProductServiceCampaign_ConfigPropertyMetadata);
964
+ const createWorkOrders_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, createWorkOrders_ConfigPropertyMetadata);
965
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$5(createWorkOrders_ConfigPropertyMetadata);
729
966
  function typeCheckConfig$1(untrustedConfig) {
730
967
  const config = {};
731
- typeCheckConfig$4(untrustedConfig, config, createProductServiceCampaign_ConfigPropertyMetadata);
968
+ typeCheckConfig$5(untrustedConfig, config, createWorkOrders_ConfigPropertyMetadata);
969
+ const untrustedConfig_productServiceCampaignItemIds = untrustedConfig.productServiceCampaignItemIds;
970
+ if (ArrayIsArray$1(untrustedConfig_productServiceCampaignItemIds)) {
971
+ const untrustedConfig_productServiceCampaignItemIds_array = [];
972
+ for (let i = 0, arrayLength = untrustedConfig_productServiceCampaignItemIds.length; i < arrayLength; i++) {
973
+ const untrustedConfig_productServiceCampaignItemIds_item = untrustedConfig_productServiceCampaignItemIds[i];
974
+ if (typeof untrustedConfig_productServiceCampaignItemIds_item === 'string') {
975
+ untrustedConfig_productServiceCampaignItemIds_array.push(untrustedConfig_productServiceCampaignItemIds_item);
976
+ }
977
+ if (untrustedConfig_productServiceCampaignItemIds_item === null) {
978
+ untrustedConfig_productServiceCampaignItemIds_array.push(untrustedConfig_productServiceCampaignItemIds_item);
979
+ }
980
+ }
981
+ config.productServiceCampaignItemIds = untrustedConfig_productServiceCampaignItemIds_array;
982
+ }
732
983
  return config;
733
984
  }
734
985
  function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
@@ -762,12 +1013,12 @@ function buildNetworkSnapshot$1(luvio, config, options) {
762
1013
  throw response;
763
1014
  });
764
1015
  }
765
- const createProductServiceCampaignAdapterFactory = (luvio) => {
766
- return function createProductServiceCampaign(untrustedConfig) {
767
- const config = validateAdapterConfig$1(untrustedConfig, createProductServiceCampaign_ConfigPropertyNames);
1016
+ const createWorkOrdersAdapterFactory = (luvio) => {
1017
+ return function createWorkOrders(untrustedConfig) {
1018
+ const config = validateAdapterConfig$1(untrustedConfig, createWorkOrders_ConfigPropertyNames);
768
1019
  // Invalid or incomplete config
769
1020
  if (config === null) {
770
- throw new Error('Invalid config for "createProductServiceCampaign"');
1021
+ throw new Error('Invalid config for "createWorkOrders"');
771
1022
  }
772
1023
  return buildNetworkSnapshot$1(luvio, config);
773
1024
  };
@@ -976,10 +1227,10 @@ const priceItemWithCoverage_ConfigPropertyMetadata = [
976
1227
  generateParamConfigMetadata('pricingProcedure', true, 2 /* Body */, 0 /* String */),
977
1228
  ];
978
1229
  const priceItemWithCoverage_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, priceItemWithCoverage_ConfigPropertyMetadata);
979
- const createResourceParams = /*#__PURE__*/ createResourceParams$4(priceItemWithCoverage_ConfigPropertyMetadata);
1230
+ const createResourceParams = /*#__PURE__*/ createResourceParams$5(priceItemWithCoverage_ConfigPropertyMetadata);
980
1231
  function typeCheckConfig(untrustedConfig) {
981
1232
  const config = {};
982
- typeCheckConfig$4(untrustedConfig, config, priceItemWithCoverage_ConfigPropertyMetadata);
1233
+ typeCheckConfig$5(untrustedConfig, config, priceItemWithCoverage_ConfigPropertyMetadata);
983
1234
  const untrustedConfig_assetCoverageMap = untrustedConfig.assetCoverageMap;
984
1235
  if (untrustedIsObject(untrustedConfig_assetCoverageMap)) {
985
1236
  const untrustedConfig_assetCoverageMap_object = {};
@@ -1042,4 +1293,4 @@ const priceItemWithCoverageAdapterFactory = (luvio) => {
1042
1293
  };
1043
1294
  };
1044
1295
 
1045
- export { bookAppointmentSlotAdapterFactory, createProductServiceCampaignAdapterFactory, getAppointmentSlotsAdapterFactory, priceItemWithCoverageAdapterFactory };
1296
+ export { bookAppointmentSlotAdapterFactory, createProductServiceCampaignAdapterFactory, createWorkOrdersAdapterFactory, getAppointmentSlotsAdapterFactory, priceItemWithCoverageAdapterFactory };