@salesforce/lds-adapters-sales-eci 1.227.1 → 1.228.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,10 +4,10 @@
4
4
  * For full license text, see the LICENSE.txt file
5
5
  */
6
6
 
7
- import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$2, typeCheckConfig as typeCheckConfig$2, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1 } from '@luvio/engine';
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$3, typeCheckConfig as typeCheckConfig$3, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2 } from '@luvio/engine';
8
8
 
9
9
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
- const { keys: ObjectKeys, create: ObjectCreate } = Object;
10
+ const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
11
11
  const { isArray: ArrayIsArray$1 } = Array;
12
12
  /**
13
13
  * Validates an adapter config is well-formed.
@@ -31,7 +31,7 @@ function validateConfig(config, adapter, oneOf) {
31
31
  throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
32
32
  }
33
33
  const supported = required.concat(optional);
34
- if (ObjectKeys(config).some(key => !supported.includes(key))) {
34
+ if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
35
35
  throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
36
36
  }
37
37
  }
@@ -71,6 +71,7 @@ function buildAdapterValidationConfig(displayName, paramsMeta) {
71
71
  }
72
72
  const keyPrefix = 'eci';
73
73
 
74
+ const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
74
75
  const { isArray: ArrayIsArray } = Array;
75
76
  function equalsArray(a, b, equalsItem) {
76
77
  const aLength = a.length;
@@ -85,15 +86,34 @@ function equalsArray(a, b, equalsItem) {
85
86
  }
86
87
  return true;
87
88
  }
89
+ function equalsObject(a, b, equalsProp) {
90
+ const aKeys = ObjectKeys(a).sort();
91
+ const bKeys = ObjectKeys(b).sort();
92
+ const aKeysLength = aKeys.length;
93
+ const bKeysLength = bKeys.length;
94
+ if (aKeysLength !== bKeysLength) {
95
+ return false;
96
+ }
97
+ for (let i = 0; i < aKeys.length; i++) {
98
+ const key = aKeys[i];
99
+ if (key !== bKeys[i]) {
100
+ return false;
101
+ }
102
+ if (equalsProp(a[key], b[key]) === false) {
103
+ return false;
104
+ }
105
+ }
106
+ return true;
107
+ }
88
108
  function createLink(ref) {
89
109
  return {
90
110
  __ref: serializeStructuredKey(ref),
91
111
  };
92
112
  }
93
113
 
94
- const TTL$1 = 60000;
95
- const VERSION$1 = "10bf968dbd562928dfa701c7f6a854b2";
96
- function validate$1(obj, path = 'ConversationSummaryRepresentation') {
114
+ const TTL$2 = 60000;
115
+ const VERSION$2 = "10bf968dbd562928dfa701c7f6a854b2";
116
+ function validate$2(obj, path = 'ConversationSummaryRepresentation') {
97
117
  const v_error = (() => {
98
118
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
99
119
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -194,23 +214,23 @@ function validate$1(obj, path = 'ConversationSummaryRepresentation') {
194
214
  })();
195
215
  return v_error === undefined ? null : v_error;
196
216
  }
197
- const RepresentationType$1 = 'ConversationSummaryRepresentation';
198
- function keyBuilder$3(luvio, config) {
199
- return keyPrefix + '::' + RepresentationType$1 + ':' + config.conversation_sumamry_id;
217
+ const RepresentationType$2 = 'ConversationSummaryRepresentation';
218
+ function keyBuilder$5(luvio, config) {
219
+ return keyPrefix + '::' + RepresentationType$2 + ':' + config.conversation_sumamry_id;
200
220
  }
201
221
  function keyBuilderFromType$1(luvio, object) {
202
222
  const keyParams = {
203
223
  conversation_sumamry_id: object.id
204
224
  };
205
- return keyBuilder$3(luvio, keyParams);
225
+ return keyBuilder$5(luvio, keyParams);
206
226
  }
207
- function normalize$1(input, existing, path, luvio, store, timestamp) {
227
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
208
228
  return input;
209
229
  }
210
- const select$3 = function ConversationSummaryRepresentationSelect() {
230
+ const select$5 = function ConversationSummaryRepresentationSelect() {
211
231
  return {
212
232
  kind: 'Fragment',
213
- version: VERSION$1,
233
+ version: VERSION$2,
214
234
  private: [],
215
235
  selections: [
216
236
  {
@@ -240,7 +260,7 @@ const select$3 = function ConversationSummaryRepresentationSelect() {
240
260
  ]
241
261
  };
242
262
  };
243
- function equals$1(existing, incoming) {
263
+ function equals$2(existing, incoming) {
244
264
  const existing_conversationRecordId = existing.conversationRecordId;
245
265
  const incoming_conversationRecordId = incoming.conversationRecordId;
246
266
  if (!(existing_conversationRecordId === incoming_conversationRecordId)) {
@@ -273,41 +293,41 @@ function equals$1(existing, incoming) {
273
293
  }
274
294
  return true;
275
295
  }
276
- const ingest$1 = function ConversationSummaryRepresentationIngest(input, path, luvio, store, timestamp) {
296
+ const ingest$2 = function ConversationSummaryRepresentationIngest(input, path, luvio, store, timestamp) {
277
297
  if (process.env.NODE_ENV !== 'production') {
278
- const validateError = validate$1(input);
298
+ const validateError = validate$2(input);
279
299
  if (validateError !== null) {
280
300
  throw validateError;
281
301
  }
282
302
  }
283
303
  const key = keyBuilderFromType$1(luvio, input);
284
- const ttlToUse = TTL$1;
285
- ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "eci", VERSION$1, RepresentationType$1, equals$1);
304
+ const ttlToUse = TTL$2;
305
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "eci", VERSION$2, RepresentationType$2, equals$2);
286
306
  return createLink(key);
287
307
  };
288
- function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
308
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
289
309
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
290
310
  const rootKey = keyBuilderFromType$1(luvio, input);
291
311
  rootKeySet.set(rootKey, {
292
312
  namespace: keyPrefix,
293
- representationName: RepresentationType$1,
313
+ representationName: RepresentationType$2,
294
314
  mergeable: false
295
315
  });
296
316
  }
297
317
 
298
- function select$2(luvio, params) {
299
- return select$3();
318
+ function select$4(luvio, params) {
319
+ return select$5();
300
320
  }
301
- function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
302
- getTypeCacheKeys$1(storeKeyMap, luvio, response);
321
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
322
+ getTypeCacheKeys$2(storeKeyMap, luvio, response);
303
323
  }
304
- function ingestSuccess$1(luvio, resourceParams, response) {
324
+ function ingestSuccess$2(luvio, resourceParams, response) {
305
325
  const { body } = response;
306
326
  const key = keyBuilderFromType$1(luvio, body);
307
- luvio.storeIngest(key, ingest$1, body);
327
+ luvio.storeIngest(key, ingest$2, body);
308
328
  const snapshot = luvio.storeLookup({
309
329
  recordId: key,
310
- node: select$2(),
330
+ node: select$4(),
311
331
  variables: {},
312
332
  });
313
333
  if (process.env.NODE_ENV !== 'production') {
@@ -318,7 +338,7 @@ function ingestSuccess$1(luvio, resourceParams, response) {
318
338
  deepFreeze(snapshot.data);
319
339
  return snapshot;
320
340
  }
321
- function createResourceRequest$1(config) {
341
+ function createResourceRequest$2(config) {
322
342
  const headers = {};
323
343
  return {
324
344
  baseUri: '/services/data/v59.0',
@@ -332,41 +352,41 @@ function createResourceRequest$1(config) {
332
352
  };
333
353
  }
334
354
 
335
- const adapterName$1 = 'generateConversationSummary';
355
+ const adapterName$2 = 'generateConversationSummary';
336
356
  const generateConversationSummary_ConfigPropertyMetadata = [
337
357
  generateParamConfigMetadata('conversationId', true, 0 /* UrlParameter */, 0 /* String */),
338
358
  ];
339
- const generateConversationSummary_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, generateConversationSummary_ConfigPropertyMetadata);
340
- const createResourceParams$1 = /*#__PURE__*/ createResourceParams$2(generateConversationSummary_ConfigPropertyMetadata);
341
- function typeCheckConfig$1(untrustedConfig) {
359
+ const generateConversationSummary_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, generateConversationSummary_ConfigPropertyMetadata);
360
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(generateConversationSummary_ConfigPropertyMetadata);
361
+ function typeCheckConfig$2(untrustedConfig) {
342
362
  const config = {};
343
- typeCheckConfig$2(untrustedConfig, config, generateConversationSummary_ConfigPropertyMetadata);
363
+ typeCheckConfig$3(untrustedConfig, config, generateConversationSummary_ConfigPropertyMetadata);
344
364
  return config;
345
365
  }
346
- function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
366
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
347
367
  if (!untrustedIsObject(untrustedConfig)) {
348
368
  return null;
349
369
  }
350
370
  if (process.env.NODE_ENV !== 'production') {
351
371
  validateConfig(untrustedConfig, configPropertyNames);
352
372
  }
353
- const config = typeCheckConfig$1(untrustedConfig);
373
+ const config = typeCheckConfig$2(untrustedConfig);
354
374
  if (!areRequiredParametersPresent(config, configPropertyNames)) {
355
375
  return null;
356
376
  }
357
377
  return config;
358
378
  }
359
- function buildNetworkSnapshot$1(luvio, config, options) {
360
- const resourceParams = createResourceParams$1(config);
361
- const request = createResourceRequest$1(resourceParams);
379
+ function buildNetworkSnapshot$2(luvio, config, options) {
380
+ const resourceParams = createResourceParams$2(config);
381
+ const request = createResourceRequest$2(resourceParams);
362
382
  return luvio.dispatchResourceRequest(request, options)
363
383
  .then((response) => {
364
384
  return luvio.handleSuccessResponse(() => {
365
- const snapshot = ingestSuccess$1(luvio, resourceParams, response);
385
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response);
366
386
  return luvio.storeBroadcast().then(() => snapshot);
367
387
  }, () => {
368
388
  const cache = new StoreKeyMap();
369
- getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
389
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
370
390
  return cache;
371
391
  });
372
392
  }, (response) => {
@@ -376,22 +396,34 @@ function buildNetworkSnapshot$1(luvio, config, options) {
376
396
  }
377
397
  const generateConversationSummaryAdapterFactory = (luvio) => {
378
398
  return function generateConversationSummary(untrustedConfig) {
379
- const config = validateAdapterConfig$1(untrustedConfig, generateConversationSummary_ConfigPropertyNames);
399
+ const config = validateAdapterConfig$2(untrustedConfig, generateConversationSummary_ConfigPropertyNames);
380
400
  // Invalid or incomplete config
381
401
  if (config === null) {
382
402
  throw new Error('Invalid config for "generateConversationSummary"');
383
403
  }
384
- return buildNetworkSnapshot$1(luvio, config);
404
+ return buildNetworkSnapshot$2(luvio, config);
385
405
  };
386
406
  };
387
407
 
388
- const TTL = 60000;
389
- const VERSION = "a9e3d8764d06757767b6c4311caa4e5c";
390
- function validate(obj, path = 'ConversationSummaryListRepresentation') {
408
+ const TTL$1 = 60000;
409
+ const VERSION$1 = "233fbc0cf53c7a50800a3e8b63d661be";
410
+ function validate$1(obj, path = 'ConversationSummaryListRepresentation') {
391
411
  const v_error = (() => {
392
412
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
393
413
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
394
414
  }
415
+ const obj_conversationIds = obj.conversationIds;
416
+ const path_conversationIds = path + '.conversationIds';
417
+ if (!ArrayIsArray(obj_conversationIds)) {
418
+ return new TypeError('Expected "array" but received "' + typeof obj_conversationIds + '" (at "' + path_conversationIds + '")');
419
+ }
420
+ for (let i = 0; i < obj_conversationIds.length; i++) {
421
+ const obj_conversationIds_item = obj_conversationIds[i];
422
+ const path_conversationIds_item = path_conversationIds + '[' + i + ']';
423
+ if (typeof obj_conversationIds_item !== 'string') {
424
+ return new TypeError('Expected "string" but received "' + typeof obj_conversationIds_item + '" (at "' + path_conversationIds_item + '")');
425
+ }
426
+ }
395
427
  const obj_conversationSummaryList = obj.conversationSummaryList;
396
428
  const path_conversationSummaryList = path + '.conversationSummaryList';
397
429
  if (!ArrayIsArray(obj_conversationSummaryList)) {
@@ -412,23 +444,23 @@ function validate(obj, path = 'ConversationSummaryListRepresentation') {
412
444
  })();
413
445
  return v_error === undefined ? null : v_error;
414
446
  }
415
- const RepresentationType = 'ConversationSummaryListRepresentation';
416
- function keyBuilder$2(luvio, config) {
417
- return keyPrefix + '::' + RepresentationType + ':' + config.id;
447
+ const RepresentationType$1 = 'ConversationSummaryListRepresentation';
448
+ function keyBuilder$4(luvio, config) {
449
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.id;
418
450
  }
419
451
  function keyBuilderFromType(luvio, object) {
420
452
  const keyParams = {
421
453
  id: object.id
422
454
  };
423
- return keyBuilder$2(luvio, keyParams);
455
+ return keyBuilder$4(luvio, keyParams);
424
456
  }
425
- function normalize(input, existing, path, luvio, store, timestamp) {
457
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
426
458
  const input_conversationSummaryList = input.conversationSummaryList;
427
459
  const input_conversationSummaryList_id = path.fullPath + '__conversationSummaryList';
428
460
  for (let i = 0; i < input_conversationSummaryList.length; i++) {
429
461
  const input_conversationSummaryList_item = input_conversationSummaryList[i];
430
462
  let input_conversationSummaryList_item_id = input_conversationSummaryList_id + '__' + i;
431
- input_conversationSummaryList[i] = ingest$1(input_conversationSummaryList_item, {
463
+ input_conversationSummaryList[i] = ingest$2(input_conversationSummaryList_item, {
432
464
  fullPath: input_conversationSummaryList_item_id,
433
465
  propertyName: i,
434
466
  parent: {
@@ -441,17 +473,22 @@ function normalize(input, existing, path, luvio, store, timestamp) {
441
473
  }
442
474
  return input;
443
475
  }
444
- const select$1 = function ConversationSummaryListRepresentationSelect() {
476
+ const select$3 = function ConversationSummaryListRepresentationSelect() {
445
477
  return {
446
478
  kind: 'Fragment',
447
- version: VERSION,
479
+ version: VERSION$1,
448
480
  private: [],
449
481
  selections: [
482
+ {
483
+ name: 'conversationIds',
484
+ kind: 'Scalar',
485
+ plural: true
486
+ },
450
487
  {
451
488
  name: 'conversationSummaryList',
452
489
  kind: 'Link',
453
490
  plural: true,
454
- fragment: select$3()
491
+ fragment: select$5()
455
492
  },
456
493
  {
457
494
  name: 'id',
@@ -460,12 +497,22 @@ const select$1 = function ConversationSummaryListRepresentationSelect() {
460
497
  ]
461
498
  };
462
499
  };
463
- function equals(existing, incoming) {
500
+ function equals$1(existing, incoming) {
464
501
  const existing_id = existing.id;
465
502
  const incoming_id = incoming.id;
466
503
  if (!(existing_id === incoming_id)) {
467
504
  return false;
468
505
  }
506
+ const existing_conversationIds = existing.conversationIds;
507
+ const incoming_conversationIds = incoming.conversationIds;
508
+ const equals_conversationIds_items = equalsArray(existing_conversationIds, incoming_conversationIds, (existing_conversationIds_item, incoming_conversationIds_item) => {
509
+ if (!(existing_conversationIds_item === incoming_conversationIds_item)) {
510
+ return false;
511
+ }
512
+ });
513
+ if (equals_conversationIds_items === false) {
514
+ return false;
515
+ }
469
516
  const existing_conversationSummaryList = existing.conversationSummaryList;
470
517
  const incoming_conversationSummaryList = incoming.conversationSummaryList;
471
518
  const equals_conversationSummaryList_items = equalsArray(existing_conversationSummaryList, incoming_conversationSummaryList, (existing_conversationSummaryList_item, incoming_conversationSummaryList_item) => {
@@ -478,42 +525,292 @@ function equals(existing, incoming) {
478
525
  }
479
526
  return true;
480
527
  }
481
- const ingest = function ConversationSummaryListRepresentationIngest(input, path, luvio, store, timestamp) {
528
+ const ingest$1 = function ConversationSummaryListRepresentationIngest(input, path, luvio, store, timestamp) {
482
529
  if (process.env.NODE_ENV !== 'production') {
483
- const validateError = validate(input);
530
+ const validateError = validate$1(input);
484
531
  if (validateError !== null) {
485
532
  throw validateError;
486
533
  }
487
534
  }
488
535
  const key = keyBuilderFromType(luvio, input);
489
- const ttlToUse = TTL;
490
- ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "eci", VERSION, RepresentationType, equals);
536
+ const ttlToUse = TTL$1;
537
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "eci", VERSION$1, RepresentationType$1, equals$1);
491
538
  return createLink(key);
492
539
  };
493
- function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
540
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
494
541
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
495
542
  const rootKey = keyBuilderFromType(luvio, input);
496
543
  rootKeySet.set(rootKey, {
497
544
  namespace: keyPrefix,
498
- representationName: RepresentationType,
545
+ representationName: RepresentationType$1,
499
546
  mergeable: false
500
547
  });
501
548
  const input_conversationSummaryList_length = input.conversationSummaryList.length;
502
549
  for (let i = 0; i < input_conversationSummaryList_length; i++) {
503
- getTypeCacheKeys$1(rootKeySet, luvio, input.conversationSummaryList[i]);
550
+ getTypeCacheKeys$2(rootKeySet, luvio, input.conversationSummaryList[i]);
551
+ }
552
+ }
553
+
554
+ function select$2(luvio, params) {
555
+ return select$3();
556
+ }
557
+ function keyBuilder$3(luvio, params) {
558
+ return keyBuilder$4(luvio, {
559
+ id: params.urlParams.id
560
+ });
561
+ }
562
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
563
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
564
+ }
565
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
566
+ const { body } = response;
567
+ const key = keyBuilder$3(luvio, resourceParams);
568
+ luvio.storeIngest(key, ingest$1, body);
569
+ const snapshot = luvio.storeLookup({
570
+ recordId: key,
571
+ node: select$2(),
572
+ variables: {},
573
+ }, snapshotRefresh);
574
+ if (process.env.NODE_ENV !== 'production') {
575
+ if (snapshot.state !== 'Fulfilled') {
576
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
577
+ }
578
+ }
579
+ deepFreeze(snapshot.data);
580
+ return snapshot;
581
+ }
582
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
583
+ const key = keyBuilder$3(luvio, params);
584
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
585
+ const storeMetadataParams = {
586
+ ttl: TTL$1,
587
+ namespace: keyPrefix,
588
+ version: VERSION$1,
589
+ representationName: RepresentationType$1
590
+ };
591
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
592
+ return errorSnapshot;
593
+ }
594
+ function createResourceRequest$1(config) {
595
+ const headers = {};
596
+ return {
597
+ baseUri: '/services/data/v59.0',
598
+ basePath: '/conversation/summary/related/' + config.urlParams.id + '',
599
+ method: 'get',
600
+ body: null,
601
+ urlParams: config.urlParams,
602
+ queryParams: {},
603
+ headers,
604
+ priority: 'normal',
605
+ };
606
+ }
607
+
608
+ const adapterName$1 = 'getConversationSummaryRelatedList';
609
+ const getConversationSummaryRelatedList_ConfigPropertyMetadata = [
610
+ generateParamConfigMetadata('id', true, 0 /* UrlParameter */, 0 /* String */),
611
+ ];
612
+ const getConversationSummaryRelatedList_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getConversationSummaryRelatedList_ConfigPropertyMetadata);
613
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(getConversationSummaryRelatedList_ConfigPropertyMetadata);
614
+ function keyBuilder$2(luvio, config) {
615
+ const resourceParams = createResourceParams$1(config);
616
+ return keyBuilder$3(luvio, resourceParams);
617
+ }
618
+ function typeCheckConfig$1(untrustedConfig) {
619
+ const config = {};
620
+ typeCheckConfig$3(untrustedConfig, config, getConversationSummaryRelatedList_ConfigPropertyMetadata);
621
+ return config;
622
+ }
623
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
624
+ if (!untrustedIsObject(untrustedConfig)) {
625
+ return null;
626
+ }
627
+ if (process.env.NODE_ENV !== 'production') {
628
+ validateConfig(untrustedConfig, configPropertyNames);
504
629
  }
630
+ const config = typeCheckConfig$1(untrustedConfig);
631
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
632
+ return null;
633
+ }
634
+ return config;
635
+ }
636
+ function adapterFragment$1(luvio, config) {
637
+ createResourceParams$1(config);
638
+ return select$2();
639
+ }
640
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
641
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
642
+ config,
643
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
644
+ });
645
+ return luvio.storeBroadcast().then(() => snapshot);
646
+ }
647
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
648
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
649
+ config,
650
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
651
+ });
652
+ return luvio.storeBroadcast().then(() => snapshot);
653
+ }
654
+ function buildNetworkSnapshot$1(luvio, config, options) {
655
+ const resourceParams = createResourceParams$1(config);
656
+ const request = createResourceRequest$1(resourceParams);
657
+ return luvio.dispatchResourceRequest(request, options)
658
+ .then((response) => {
659
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
660
+ const cache = new StoreKeyMap();
661
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
662
+ return cache;
663
+ });
664
+ }, (response) => {
665
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
666
+ });
667
+ }
668
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
669
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
670
+ }
671
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
672
+ const { luvio, config } = context;
673
+ const selector = {
674
+ recordId: keyBuilder$2(luvio, config),
675
+ node: adapterFragment$1(luvio, config),
676
+ variables: {},
677
+ };
678
+ const cacheSnapshot = storeLookup(selector, {
679
+ config,
680
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
681
+ });
682
+ return cacheSnapshot;
683
+ }
684
+ const getConversationSummaryRelatedListAdapterFactory = (luvio) => function eci__getConversationSummaryRelatedList(untrustedConfig, requestContext) {
685
+ const config = validateAdapterConfig$1(untrustedConfig, getConversationSummaryRelatedList_ConfigPropertyNames);
686
+ // Invalid or incomplete config
687
+ if (config === null) {
688
+ return null;
689
+ }
690
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
691
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
692
+ };
693
+
694
+ const TTL = 2592000000;
695
+ const VERSION = "b6caaeb6ce6369783e9b10315a598d75";
696
+ function validate(obj, path = 'ConversationTranscriptRepresentation') {
697
+ const v_error = (() => {
698
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
699
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
700
+ }
701
+ const obj_error = obj.error;
702
+ const path_error = path + '.error';
703
+ if (typeof obj_error !== 'object' || ArrayIsArray(obj_error) || obj_error === null) {
704
+ return new TypeError('Expected "object" but received "' + typeof obj_error + '" (at "' + path_error + '")');
705
+ }
706
+ const obj_error_keys = ObjectKeys(obj_error);
707
+ for (let i = 0; i < obj_error_keys.length; i++) {
708
+ const key = obj_error_keys[i];
709
+ const obj_error_prop = obj_error[key];
710
+ const path_error_prop = path_error + '["' + key + '"]';
711
+ if (typeof obj_error_prop !== 'string') {
712
+ return new TypeError('Expected "string" but received "' + typeof obj_error_prop + '" (at "' + path_error_prop + '")');
713
+ }
714
+ }
715
+ const obj_transcriptData = obj.transcriptData;
716
+ const path_transcriptData = path + '.transcriptData';
717
+ let obj_transcriptData_union0 = null;
718
+ const obj_transcriptData_union0_error = (() => {
719
+ if (typeof obj_transcriptData !== 'string') {
720
+ return new TypeError('Expected "string" but received "' + typeof obj_transcriptData + '" (at "' + path_transcriptData + '")');
721
+ }
722
+ })();
723
+ if (obj_transcriptData_union0_error != null) {
724
+ obj_transcriptData_union0 = obj_transcriptData_union0_error.message;
725
+ }
726
+ let obj_transcriptData_union1 = null;
727
+ const obj_transcriptData_union1_error = (() => {
728
+ if (obj_transcriptData !== null) {
729
+ return new TypeError('Expected "null" but received "' + typeof obj_transcriptData + '" (at "' + path_transcriptData + '")');
730
+ }
731
+ })();
732
+ if (obj_transcriptData_union1_error != null) {
733
+ obj_transcriptData_union1 = obj_transcriptData_union1_error.message;
734
+ }
735
+ if (obj_transcriptData_union0 && obj_transcriptData_union1) {
736
+ let message = 'Object doesn\'t match union (at "' + path_transcriptData + '")';
737
+ message += '\n' + obj_transcriptData_union0.split('\n').map((line) => '\t' + line).join('\n');
738
+ message += '\n' + obj_transcriptData_union1.split('\n').map((line) => '\t' + line).join('\n');
739
+ return new TypeError(message);
740
+ }
741
+ })();
742
+ return v_error === undefined ? null : v_error;
743
+ }
744
+ const RepresentationType = 'ConversationTranscriptRepresentation';
745
+ function normalize(input, existing, path, luvio, store, timestamp) {
746
+ return input;
747
+ }
748
+ const select$1 = function ConversationTranscriptRepresentationSelect() {
749
+ return {
750
+ kind: 'Fragment',
751
+ version: VERSION,
752
+ private: [],
753
+ selections: [
754
+ {
755
+ name: 'error',
756
+ kind: 'Scalar',
757
+ map: true
758
+ },
759
+ {
760
+ name: 'transcriptData',
761
+ kind: 'Scalar'
762
+ }
763
+ ]
764
+ };
765
+ };
766
+ function equals(existing, incoming) {
767
+ const existing_error = existing.error;
768
+ const incoming_error = incoming.error;
769
+ const equals_error_props = equalsObject(existing_error, incoming_error, (existing_error_prop, incoming_error_prop) => {
770
+ if (!(existing_error_prop === incoming_error_prop)) {
771
+ return false;
772
+ }
773
+ });
774
+ if (equals_error_props === false) {
775
+ return false;
776
+ }
777
+ const existing_transcriptData = existing.transcriptData;
778
+ const incoming_transcriptData = incoming.transcriptData;
779
+ if (!(existing_transcriptData === incoming_transcriptData)) {
780
+ return false;
781
+ }
782
+ return true;
783
+ }
784
+ const ingest = function ConversationTranscriptRepresentationIngest(input, path, luvio, store, timestamp) {
785
+ if (process.env.NODE_ENV !== 'production') {
786
+ const validateError = validate(input);
787
+ if (validateError !== null) {
788
+ throw validateError;
789
+ }
790
+ }
791
+ const key = path.fullPath;
792
+ const ttlToUse = TTL;
793
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "eci", VERSION, RepresentationType, equals);
794
+ return createLink(key);
795
+ };
796
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
797
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
798
+ const rootKey = fullPathFactory();
799
+ rootKeySet.set(rootKey, {
800
+ namespace: keyPrefix,
801
+ representationName: RepresentationType,
802
+ mergeable: false
803
+ });
505
804
  }
506
805
 
507
806
  function select(luvio, params) {
508
807
  return select$1();
509
808
  }
510
809
  function keyBuilder$1(luvio, params) {
511
- return keyBuilder$2(luvio, {
512
- id: params.urlParams.id
513
- });
810
+ return keyPrefix + '::ConversationTranscriptRepresentation:(' + 'includeData:' + params.queryParams.includeData + ',' + 'sfdcCallIdOrRecordingId:' + params.urlParams.sfdcCallIdOrRecordingId + ')';
514
811
  }
515
812
  function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
516
- getTypeCacheKeys(storeKeyMap, luvio, response);
813
+ getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
517
814
  }
518
815
  function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
519
816
  const { body } = response;
@@ -548,29 +845,30 @@ function createResourceRequest(config) {
548
845
  const headers = {};
549
846
  return {
550
847
  baseUri: '/services/data/v59.0',
551
- basePath: '/conversation/summary/related/' + config.urlParams.id + '',
848
+ basePath: '/conversation/transcript/' + config.urlParams.sfdcCallIdOrRecordingId + '',
552
849
  method: 'get',
553
850
  body: null,
554
851
  urlParams: config.urlParams,
555
- queryParams: {},
852
+ queryParams: config.queryParams,
556
853
  headers,
557
854
  priority: 'normal',
558
855
  };
559
856
  }
560
857
 
561
- const adapterName = 'getConversationSummaryRelatedList';
562
- const getConversationSummaryRelatedList_ConfigPropertyMetadata = [
563
- generateParamConfigMetadata('id', true, 0 /* UrlParameter */, 0 /* String */),
858
+ const adapterName = 'getTranscript';
859
+ const getTranscript_ConfigPropertyMetadata = [
860
+ generateParamConfigMetadata('sfdcCallIdOrRecordingId', true, 0 /* UrlParameter */, 0 /* String */),
861
+ generateParamConfigMetadata('includeData', false, 1 /* QueryParameter */, 1 /* Boolean */),
564
862
  ];
565
- const getConversationSummaryRelatedList_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getConversationSummaryRelatedList_ConfigPropertyMetadata);
566
- const createResourceParams = /*#__PURE__*/ createResourceParams$2(getConversationSummaryRelatedList_ConfigPropertyMetadata);
863
+ const getTranscript_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getTranscript_ConfigPropertyMetadata);
864
+ const createResourceParams = /*#__PURE__*/ createResourceParams$3(getTranscript_ConfigPropertyMetadata);
567
865
  function keyBuilder(luvio, config) {
568
866
  const resourceParams = createResourceParams(config);
569
867
  return keyBuilder$1(luvio, resourceParams);
570
868
  }
571
869
  function typeCheckConfig(untrustedConfig) {
572
870
  const config = {};
573
- typeCheckConfig$2(untrustedConfig, config, getConversationSummaryRelatedList_ConfigPropertyMetadata);
871
+ typeCheckConfig$3(untrustedConfig, config, getTranscript_ConfigPropertyMetadata);
574
872
  return config;
575
873
  }
576
874
  function validateAdapterConfig(untrustedConfig, configPropertyNames) {
@@ -619,7 +917,7 @@ function buildNetworkSnapshot(luvio, config, options) {
619
917
  });
620
918
  }
621
919
  function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
622
- return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
920
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
623
921
  }
624
922
  function buildCachedSnapshotCachePolicy(context, storeLookup) {
625
923
  const { luvio, config } = context;
@@ -634,8 +932,8 @@ function buildCachedSnapshotCachePolicy(context, storeLookup) {
634
932
  });
635
933
  return cacheSnapshot;
636
934
  }
637
- const getConversationSummaryRelatedListAdapterFactory = (luvio) => function eci__getConversationSummaryRelatedList(untrustedConfig, requestContext) {
638
- const config = validateAdapterConfig(untrustedConfig, getConversationSummaryRelatedList_ConfigPropertyNames);
935
+ const getTranscriptAdapterFactory = (luvio) => function eci__getTranscript(untrustedConfig, requestContext) {
936
+ const config = validateAdapterConfig(untrustedConfig, getTranscript_ConfigPropertyNames);
639
937
  // Invalid or incomplete config
640
938
  if (config === null) {
641
939
  return null;
@@ -644,4 +942,4 @@ const getConversationSummaryRelatedListAdapterFactory = (luvio) => function eci_
644
942
  buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
645
943
  };
646
944
 
647
- export { generateConversationSummaryAdapterFactory, getConversationSummaryRelatedListAdapterFactory };
945
+ export { generateConversationSummaryAdapterFactory, getConversationSummaryRelatedListAdapterFactory, getTranscriptAdapterFactory };