@salesforce/lds-adapters-sales-eci 0.1.0-dev1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/sales-eci.js +1744 -0
  3. package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
  4. package/dist/es/es2018/types/src/generated/adapters/generateConversationSummary.d.ts +15 -0
  5. package/dist/es/es2018/types/src/generated/adapters/getConversationGenerativeInsight.d.ts +28 -0
  6. package/dist/es/es2018/types/src/generated/adapters/getConversationSummaryRelatedList.d.ts +28 -0
  7. package/dist/es/es2018/types/src/generated/adapters/getTranscript.d.ts +28 -0
  8. package/dist/es/es2018/types/src/generated/adapters/initiateMeeting.d.ts +20 -0
  9. package/dist/es/es2018/types/src/generated/adapters/terminateMeeting.d.ts +15 -0
  10. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +6 -0
  11. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +12 -0
  12. package/dist/es/es2018/types/src/generated/resources/getConversationGenerativeInsightById.d.ts +16 -0
  13. package/dist/es/es2018/types/src/generated/resources/getConversationSummaryRelatedById.d.ts +16 -0
  14. package/dist/es/es2018/types/src/generated/resources/getConversationTranscriptBySfdcCallIdOrRecordingId.d.ts +18 -0
  15. package/dist/es/es2018/types/src/generated/resources/postConversationRealtimeInsightMeetingInitiate.d.ts +17 -0
  16. package/dist/es/es2018/types/src/generated/resources/postConversationRealtimeInsightMeetingTerminate.d.ts +12 -0
  17. package/dist/es/es2018/types/src/generated/resources/postConversationSummaryAiGenerateByConversationId.d.ts +12 -0
  18. package/dist/es/es2018/types/src/generated/types/ConversationGenInsightListRepresentation.d.ts +49 -0
  19. package/dist/es/es2018/types/src/generated/types/ConversationGenerativeInsightRepresentation.d.ts +38 -0
  20. package/dist/es/es2018/types/src/generated/types/ConversationRealtimeEndMeetingPayloadInputRepresentation.d.ts +28 -0
  21. package/dist/es/es2018/types/src/generated/types/ConversationRealtimeEndMeetingResponseRepresentation.d.ts +37 -0
  22. package/dist/es/es2018/types/src/generated/types/ConversationRealtimeMeetingInitiationResponseRepresentation.d.ts +51 -0
  23. package/dist/es/es2018/types/src/generated/types/ConversationRealtimeMeetingParticipantRepresentation.d.ts +31 -0
  24. package/dist/es/es2018/types/src/generated/types/ConversationRealtimeStartMeetingPayloadRepresentation.d.ts +36 -0
  25. package/dist/es/es2018/types/src/generated/types/ConversationSummaryListRepresentation.d.ts +54 -0
  26. package/dist/es/es2018/types/src/generated/types/ConversationSummaryRepresentation.d.ts +53 -0
  27. package/dist/es/es2018/types/src/generated/types/ConversationTranscriptRepresentation.d.ts +36 -0
  28. package/dist/es/es2018/types/src/generated/types/conversationRealtimeEndMeetingPayloadRepresentation.d.ts +27 -0
  29. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  30. package/package.json +77 -0
  31. package/sfdc/index.d.ts +1 -0
  32. package/sfdc/index.js +1902 -0
  33. package/src/raml/api.raml +278 -0
  34. package/src/raml/luvio.raml +67 -0
@@ -0,0 +1,1744 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$3, typeCheckConfig as typeCheckConfig$6, StoreKeyMap, createResourceParams as createResourceParams$6 } from '@luvio/engine';
8
+
9
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
+ const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
11
+ const { isArray: ArrayIsArray$1 } = Array;
12
+ /**
13
+ * Validates an adapter config is well-formed.
14
+ * @param config The config to validate.
15
+ * @param adapter The adapter validation configuration.
16
+ * @param oneOf The keys the config must contain at least one of.
17
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
18
+ */
19
+ function validateConfig(config, adapter, oneOf) {
20
+ const { displayName } = adapter;
21
+ const { required, optional, unsupported } = adapter.parameters;
22
+ if (config === undefined ||
23
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
24
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
25
+ }
26
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
27
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
28
+ }
29
+ if (unsupported !== undefined &&
30
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
31
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
32
+ }
33
+ const supported = required.concat(optional);
34
+ if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
35
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
36
+ }
37
+ }
38
+ function untrustedIsObject(untrusted) {
39
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
40
+ }
41
+ function areRequiredParametersPresent(config, configPropertyNames) {
42
+ return configPropertyNames.parameters.required.every(req => req in config);
43
+ }
44
+ const snapshotRefreshOptions = {
45
+ overrides: {
46
+ headers: {
47
+ 'Cache-Control': 'no-cache',
48
+ },
49
+ }
50
+ };
51
+ function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
52
+ return {
53
+ name,
54
+ required,
55
+ resourceType,
56
+ typeCheckShape,
57
+ isArrayShape,
58
+ coerceFn,
59
+ };
60
+ }
61
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
62
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
63
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
64
+ return {
65
+ displayName,
66
+ parameters: {
67
+ required,
68
+ optional,
69
+ }
70
+ };
71
+ }
72
+ const keyPrefix = 'eci';
73
+
74
+ const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
75
+ const { isArray: ArrayIsArray } = Array;
76
+ function equalsArray(a, b, equalsItem) {
77
+ const aLength = a.length;
78
+ const bLength = b.length;
79
+ if (aLength !== bLength) {
80
+ return false;
81
+ }
82
+ for (let i = 0; i < aLength; i++) {
83
+ if (equalsItem(a[i], b[i]) === false) {
84
+ return false;
85
+ }
86
+ }
87
+ return true;
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
+ }
108
+ function createLink(ref) {
109
+ return {
110
+ __ref: serializeStructuredKey(ref),
111
+ };
112
+ }
113
+
114
+ const VERSION$6 = "c614c7bd04cb26f6e931c85a63d52c55";
115
+ function validate$7(obj, path = 'ConversationGenerativeInsightRepresentation') {
116
+ const v_error = (() => {
117
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
118
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
119
+ }
120
+ const obj_generatedText = obj.generatedText;
121
+ const path_generatedText = path + '.generatedText';
122
+ if (typeof obj_generatedText !== 'string') {
123
+ return new TypeError('Expected "string" but received "' + typeof obj_generatedText + '" (at "' + path_generatedText + '")');
124
+ }
125
+ const obj_insightName = obj.insightName;
126
+ const path_insightName = path + '.insightName';
127
+ if (typeof obj_insightName !== 'string') {
128
+ return new TypeError('Expected "string" but received "' + typeof obj_insightName + '" (at "' + path_insightName + '")');
129
+ }
130
+ const obj_insightTypeId = obj.insightTypeId;
131
+ const path_insightTypeId = path + '.insightTypeId';
132
+ if (typeof obj_insightTypeId !== 'string') {
133
+ return new TypeError('Expected "string" but received "' + typeof obj_insightTypeId + '" (at "' + path_insightTypeId + '")');
134
+ }
135
+ const obj_modifiedBy = obj.modifiedBy;
136
+ const path_modifiedBy = path + '.modifiedBy';
137
+ if (typeof obj_modifiedBy !== 'string') {
138
+ return new TypeError('Expected "string" but received "' + typeof obj_modifiedBy + '" (at "' + path_modifiedBy + '")');
139
+ }
140
+ })();
141
+ return v_error === undefined ? null : v_error;
142
+ }
143
+ const select$c = function ConversationGenerativeInsightRepresentationSelect() {
144
+ return {
145
+ kind: 'Fragment',
146
+ version: VERSION$6,
147
+ private: [],
148
+ selections: [
149
+ {
150
+ name: 'generatedText',
151
+ kind: 'Scalar'
152
+ },
153
+ {
154
+ name: 'insightName',
155
+ kind: 'Scalar'
156
+ },
157
+ {
158
+ name: 'insightTypeId',
159
+ kind: 'Scalar'
160
+ },
161
+ {
162
+ name: 'modifiedBy',
163
+ kind: 'Scalar'
164
+ }
165
+ ]
166
+ };
167
+ };
168
+ function equals$6(existing, incoming) {
169
+ const existing_generatedText = existing.generatedText;
170
+ const incoming_generatedText = incoming.generatedText;
171
+ if (!(existing_generatedText === incoming_generatedText)) {
172
+ return false;
173
+ }
174
+ const existing_insightName = existing.insightName;
175
+ const incoming_insightName = incoming.insightName;
176
+ if (!(existing_insightName === incoming_insightName)) {
177
+ return false;
178
+ }
179
+ const existing_insightTypeId = existing.insightTypeId;
180
+ const incoming_insightTypeId = incoming.insightTypeId;
181
+ if (!(existing_insightTypeId === incoming_insightTypeId)) {
182
+ return false;
183
+ }
184
+ const existing_modifiedBy = existing.modifiedBy;
185
+ const incoming_modifiedBy = incoming.modifiedBy;
186
+ if (!(existing_modifiedBy === incoming_modifiedBy)) {
187
+ return false;
188
+ }
189
+ return true;
190
+ }
191
+
192
+ const TTL$5 = 60000;
193
+ const VERSION$5 = "1ddcdcaada7f739acdff16f101b69288";
194
+ function validate$6(obj, path = 'ConversationGenInsightListRepresentation') {
195
+ const v_error = (() => {
196
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
197
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
198
+ }
199
+ const obj_error = obj.error;
200
+ const path_error = path + '.error';
201
+ if (typeof obj_error !== 'object' || ArrayIsArray(obj_error) || obj_error === null) {
202
+ return new TypeError('Expected "object" but received "' + typeof obj_error + '" (at "' + path_error + '")');
203
+ }
204
+ const obj_error_keys = ObjectKeys(obj_error);
205
+ for (let i = 0; i < obj_error_keys.length; i++) {
206
+ const key = obj_error_keys[i];
207
+ const obj_error_prop = obj_error[key];
208
+ const path_error_prop = path_error + '["' + key + '"]';
209
+ if (typeof obj_error_prop !== 'string') {
210
+ return new TypeError('Expected "string" but received "' + typeof obj_error_prop + '" (at "' + path_error_prop + '")');
211
+ }
212
+ }
213
+ const obj_generativeInsights = obj.generativeInsights;
214
+ const path_generativeInsights = path + '.generativeInsights';
215
+ if (!ArrayIsArray(obj_generativeInsights)) {
216
+ return new TypeError('Expected "array" but received "' + typeof obj_generativeInsights + '" (at "' + path_generativeInsights + '")');
217
+ }
218
+ for (let i = 0; i < obj_generativeInsights.length; i++) {
219
+ const obj_generativeInsights_item = obj_generativeInsights[i];
220
+ const path_generativeInsights_item = path_generativeInsights + '[' + i + ']';
221
+ const referencepath_generativeInsights_itemValidationError = validate$7(obj_generativeInsights_item, path_generativeInsights_item);
222
+ if (referencepath_generativeInsights_itemValidationError !== null) {
223
+ let message = 'Object doesn\'t match ConversationGenerativeInsightRepresentation (at "' + path_generativeInsights_item + '")\n';
224
+ message += referencepath_generativeInsights_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
225
+ return new TypeError(message);
226
+ }
227
+ }
228
+ const obj_recordId = obj.recordId;
229
+ const path_recordId = path + '.recordId';
230
+ if (typeof obj_recordId !== 'string') {
231
+ return new TypeError('Expected "string" but received "' + typeof obj_recordId + '" (at "' + path_recordId + '")');
232
+ }
233
+ })();
234
+ return v_error === undefined ? null : v_error;
235
+ }
236
+ const RepresentationType$5 = 'ConversationGenInsightListRepresentation';
237
+ function keyBuilder$a(luvio, config) {
238
+ return keyPrefix + '::' + RepresentationType$5 + ':' + config.id;
239
+ }
240
+ function keyBuilderFromType$4(luvio, object) {
241
+ const keyParams = {
242
+ id: object.recordId
243
+ };
244
+ return keyBuilder$a(luvio, keyParams);
245
+ }
246
+ function normalize$5(input, existing, path, luvio, store, timestamp) {
247
+ return input;
248
+ }
249
+ const select$b = function ConversationGenInsightListRepresentationSelect() {
250
+ const { selections: ConversationGenerativeInsightRepresentation__selections, opaque: ConversationGenerativeInsightRepresentation__opaque, } = select$c();
251
+ return {
252
+ kind: 'Fragment',
253
+ version: VERSION$5,
254
+ private: [],
255
+ selections: [
256
+ {
257
+ name: 'error',
258
+ kind: 'Scalar',
259
+ map: true
260
+ },
261
+ {
262
+ name: 'generativeInsights',
263
+ kind: 'Object',
264
+ plural: true,
265
+ selections: ConversationGenerativeInsightRepresentation__selections
266
+ },
267
+ {
268
+ name: 'recordId',
269
+ kind: 'Scalar'
270
+ }
271
+ ]
272
+ };
273
+ };
274
+ function equals$5(existing, incoming) {
275
+ const existing_recordId = existing.recordId;
276
+ const incoming_recordId = incoming.recordId;
277
+ if (!(existing_recordId === incoming_recordId)) {
278
+ return false;
279
+ }
280
+ const existing_error = existing.error;
281
+ const incoming_error = incoming.error;
282
+ const equals_error_props = equalsObject(existing_error, incoming_error, (existing_error_prop, incoming_error_prop) => {
283
+ if (!(existing_error_prop === incoming_error_prop)) {
284
+ return false;
285
+ }
286
+ });
287
+ if (equals_error_props === false) {
288
+ return false;
289
+ }
290
+ const existing_generativeInsights = existing.generativeInsights;
291
+ const incoming_generativeInsights = incoming.generativeInsights;
292
+ const equals_generativeInsights_items = equalsArray(existing_generativeInsights, incoming_generativeInsights, (existing_generativeInsights_item, incoming_generativeInsights_item) => {
293
+ if (!(equals$6(existing_generativeInsights_item, incoming_generativeInsights_item))) {
294
+ return false;
295
+ }
296
+ });
297
+ if (equals_generativeInsights_items === false) {
298
+ return false;
299
+ }
300
+ return true;
301
+ }
302
+ const ingest$5 = function ConversationGenInsightListRepresentationIngest(input, path, luvio, store, timestamp) {
303
+ if (process.env.NODE_ENV !== 'production') {
304
+ const validateError = validate$6(input);
305
+ if (validateError !== null) {
306
+ throw validateError;
307
+ }
308
+ }
309
+ const key = keyBuilderFromType$4(luvio, input);
310
+ const ttlToUse = TTL$5;
311
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$5, "eci", VERSION$5, RepresentationType$5, equals$5);
312
+ return createLink(key);
313
+ };
314
+ function getTypeCacheKeys$5(rootKeySet, luvio, input, fullPathFactory) {
315
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
316
+ const rootKey = keyBuilderFromType$4(luvio, input);
317
+ rootKeySet.set(rootKey, {
318
+ namespace: keyPrefix,
319
+ representationName: RepresentationType$5,
320
+ mergeable: false
321
+ });
322
+ }
323
+
324
+ function select$a(luvio, params) {
325
+ return select$b();
326
+ }
327
+ function keyBuilder$9(luvio, params) {
328
+ return keyBuilder$a(luvio, {
329
+ id: params.urlParams.id
330
+ });
331
+ }
332
+ function getResponseCacheKeys$5(storeKeyMap, luvio, resourceParams, response) {
333
+ getTypeCacheKeys$5(storeKeyMap, luvio, response);
334
+ }
335
+ function ingestSuccess$5(luvio, resourceParams, response, snapshotRefresh) {
336
+ const { body } = response;
337
+ const key = keyBuilder$9(luvio, resourceParams);
338
+ luvio.storeIngest(key, ingest$5, body);
339
+ const snapshot = luvio.storeLookup({
340
+ recordId: key,
341
+ node: select$a(),
342
+ variables: {},
343
+ }, snapshotRefresh);
344
+ if (process.env.NODE_ENV !== 'production') {
345
+ if (snapshot.state !== 'Fulfilled') {
346
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
347
+ }
348
+ }
349
+ deepFreeze(snapshot.data);
350
+ return snapshot;
351
+ }
352
+ function ingestError$2(luvio, params, error, snapshotRefresh) {
353
+ const key = keyBuilder$9(luvio, params);
354
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
355
+ const storeMetadataParams = {
356
+ ttl: TTL$5,
357
+ namespace: keyPrefix,
358
+ version: VERSION$5,
359
+ representationName: RepresentationType$5
360
+ };
361
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
362
+ return errorSnapshot;
363
+ }
364
+ function createResourceRequest$5(config) {
365
+ const headers = {};
366
+ return {
367
+ baseUri: '/services/data/v66.0',
368
+ basePath: '/conversation/generative/insight/' + config.urlParams.id + '',
369
+ method: 'get',
370
+ body: null,
371
+ urlParams: config.urlParams,
372
+ queryParams: {},
373
+ headers,
374
+ priority: 'normal',
375
+ };
376
+ }
377
+
378
+ const adapterName$5 = 'getConversationGenerativeInsight';
379
+ const getConversationGenerativeInsight_ConfigPropertyMetadata = [
380
+ generateParamConfigMetadata('id', true, 0 /* UrlParameter */, 0 /* String */),
381
+ ];
382
+ const getConversationGenerativeInsight_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$5, getConversationGenerativeInsight_ConfigPropertyMetadata);
383
+ const createResourceParams$5 = /*#__PURE__*/ createResourceParams$6(getConversationGenerativeInsight_ConfigPropertyMetadata);
384
+ function keyBuilder$8(luvio, config) {
385
+ const resourceParams = createResourceParams$5(config);
386
+ return keyBuilder$9(luvio, resourceParams);
387
+ }
388
+ function typeCheckConfig$5(untrustedConfig) {
389
+ const config = {};
390
+ typeCheckConfig$6(untrustedConfig, config, getConversationGenerativeInsight_ConfigPropertyMetadata);
391
+ return config;
392
+ }
393
+ function validateAdapterConfig$5(untrustedConfig, configPropertyNames) {
394
+ if (!untrustedIsObject(untrustedConfig)) {
395
+ return null;
396
+ }
397
+ if (process.env.NODE_ENV !== 'production') {
398
+ validateConfig(untrustedConfig, configPropertyNames);
399
+ }
400
+ const config = typeCheckConfig$5(untrustedConfig);
401
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
402
+ return null;
403
+ }
404
+ return config;
405
+ }
406
+ function adapterFragment$2(luvio, config) {
407
+ createResourceParams$5(config);
408
+ return select$a();
409
+ }
410
+ function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
411
+ const snapshot = ingestSuccess$5(luvio, resourceParams, response, {
412
+ config,
413
+ resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
414
+ });
415
+ return luvio.storeBroadcast().then(() => snapshot);
416
+ }
417
+ function onFetchResponseError$2(luvio, config, resourceParams, response) {
418
+ const snapshot = ingestError$2(luvio, resourceParams, response, {
419
+ config,
420
+ resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
421
+ });
422
+ return luvio.storeBroadcast().then(() => snapshot);
423
+ }
424
+ function buildNetworkSnapshot$5(luvio, config, options) {
425
+ const resourceParams = createResourceParams$5(config);
426
+ const request = createResourceRequest$5(resourceParams);
427
+ return luvio.dispatchResourceRequest(request, options)
428
+ .then((response) => {
429
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => {
430
+ const cache = new StoreKeyMap();
431
+ getResponseCacheKeys$5(cache, luvio, resourceParams, response.body);
432
+ return cache;
433
+ });
434
+ }, (response) => {
435
+ return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
436
+ });
437
+ }
438
+ function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
439
+ return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot$5, undefined, false);
440
+ }
441
+ function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
442
+ const { luvio, config } = context;
443
+ const selector = {
444
+ recordId: keyBuilder$8(luvio, config),
445
+ node: adapterFragment$2(luvio, config),
446
+ variables: {},
447
+ };
448
+ const cacheSnapshot = storeLookup(selector, {
449
+ config,
450
+ resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
451
+ });
452
+ return cacheSnapshot;
453
+ }
454
+ const getConversationGenerativeInsightAdapterFactory = (luvio) => function eci__getConversationGenerativeInsight(untrustedConfig, requestContext) {
455
+ const config = validateAdapterConfig$5(untrustedConfig, getConversationGenerativeInsight_ConfigPropertyNames);
456
+ // Invalid or incomplete config
457
+ if (config === null) {
458
+ return null;
459
+ }
460
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
461
+ buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
462
+ };
463
+
464
+ function validate$5(obj, path = 'ConversationRealtimeMeetingParticipantRepresentation') {
465
+ const v_error = (() => {
466
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
467
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
468
+ }
469
+ const obj_participantUUID = obj.participantUUID;
470
+ const path_participantUUID = path + '.participantUUID';
471
+ let obj_participantUUID_union0 = null;
472
+ const obj_participantUUID_union0_error = (() => {
473
+ if (typeof obj_participantUUID !== 'string') {
474
+ return new TypeError('Expected "string" but received "' + typeof obj_participantUUID + '" (at "' + path_participantUUID + '")');
475
+ }
476
+ })();
477
+ if (obj_participantUUID_union0_error != null) {
478
+ obj_participantUUID_union0 = obj_participantUUID_union0_error.message;
479
+ }
480
+ let obj_participantUUID_union1 = null;
481
+ const obj_participantUUID_union1_error = (() => {
482
+ if (obj_participantUUID !== null) {
483
+ return new TypeError('Expected "null" but received "' + typeof obj_participantUUID + '" (at "' + path_participantUUID + '")');
484
+ }
485
+ })();
486
+ if (obj_participantUUID_union1_error != null) {
487
+ obj_participantUUID_union1 = obj_participantUUID_union1_error.message;
488
+ }
489
+ if (obj_participantUUID_union0 && obj_participantUUID_union1) {
490
+ let message = 'Object doesn\'t match union (at "' + path_participantUUID + '")';
491
+ message += '\n' + obj_participantUUID_union0.split('\n').map((line) => '\t' + line).join('\n');
492
+ message += '\n' + obj_participantUUID_union1.split('\n').map((line) => '\t' + line).join('\n');
493
+ return new TypeError(message);
494
+ }
495
+ const obj_screenName = obj.screenName;
496
+ const path_screenName = path + '.screenName';
497
+ if (typeof obj_screenName !== 'string') {
498
+ return new TypeError('Expected "string" but received "' + typeof obj_screenName + '" (at "' + path_screenName + '")');
499
+ }
500
+ })();
501
+ return v_error === undefined ? null : v_error;
502
+ }
503
+
504
+ const TTL$4 = 60000;
505
+ const VERSION$4 = "92b95a3b99090d0e464e4259ecac6bb4";
506
+ function validate$4(obj, path = 'ConversationRealtimeMeetingInitiationResponseRepresentation') {
507
+ const v_error = (() => {
508
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
509
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
510
+ }
511
+ const obj_botId = obj.botId;
512
+ const path_botId = path + '.botId';
513
+ if (typeof obj_botId !== 'string') {
514
+ return new TypeError('Expected "string" but received "' + typeof obj_botId + '" (at "' + path_botId + '")');
515
+ }
516
+ const obj_error = obj.error;
517
+ const path_error = path + '.error';
518
+ if (typeof obj_error !== 'object' || ArrayIsArray(obj_error) || obj_error === null) {
519
+ return new TypeError('Expected "object" but received "' + typeof obj_error + '" (at "' + path_error + '")');
520
+ }
521
+ const obj_error_keys = ObjectKeys(obj_error);
522
+ for (let i = 0; i < obj_error_keys.length; i++) {
523
+ const key = obj_error_keys[i];
524
+ const obj_error_prop = obj_error[key];
525
+ const path_error_prop = path_error + '["' + key + '"]';
526
+ if (typeof obj_error_prop !== 'string') {
527
+ return new TypeError('Expected "string" but received "' + typeof obj_error_prop + '" (at "' + path_error_prop + '")');
528
+ }
529
+ }
530
+ const obj_jwtToken = obj.jwtToken;
531
+ const path_jwtToken = path + '.jwtToken';
532
+ if (typeof obj_jwtToken !== 'string') {
533
+ return new TypeError('Expected "string" but received "' + typeof obj_jwtToken + '" (at "' + path_jwtToken + '")');
534
+ }
535
+ const obj_webSocketUrl = obj.webSocketUrl;
536
+ const path_webSocketUrl = path + '.webSocketUrl';
537
+ if (typeof obj_webSocketUrl !== 'string') {
538
+ return new TypeError('Expected "string" but received "' + typeof obj_webSocketUrl + '" (at "' + path_webSocketUrl + '")');
539
+ }
540
+ })();
541
+ return v_error === undefined ? null : v_error;
542
+ }
543
+ const RepresentationType$4 = 'ConversationRealtimeMeetingInitiationResponseRepresentation';
544
+ function keyBuilder$7(luvio, config) {
545
+ return keyPrefix + '::' + RepresentationType$4 + ':' + config.id;
546
+ }
547
+ function keyBuilderFromType$3(luvio, object) {
548
+ const keyParams = {
549
+ id: object.botId
550
+ };
551
+ return keyBuilder$7(luvio, keyParams);
552
+ }
553
+ function normalize$4(input, existing, path, luvio, store, timestamp) {
554
+ return input;
555
+ }
556
+ const select$9 = function ConversationRealtimeMeetingInitiationResponseRepresentationSelect() {
557
+ return {
558
+ kind: 'Fragment',
559
+ version: VERSION$4,
560
+ private: [],
561
+ selections: [
562
+ {
563
+ name: 'botId',
564
+ kind: 'Scalar'
565
+ },
566
+ {
567
+ name: 'error',
568
+ kind: 'Scalar',
569
+ map: true
570
+ },
571
+ {
572
+ name: 'jwtToken',
573
+ kind: 'Scalar'
574
+ },
575
+ {
576
+ name: 'webSocketUrl',
577
+ kind: 'Scalar'
578
+ }
579
+ ]
580
+ };
581
+ };
582
+ function equals$4(existing, incoming) {
583
+ const existing_botId = existing.botId;
584
+ const incoming_botId = incoming.botId;
585
+ if (!(existing_botId === incoming_botId)) {
586
+ return false;
587
+ }
588
+ const existing_jwtToken = existing.jwtToken;
589
+ const incoming_jwtToken = incoming.jwtToken;
590
+ if (!(existing_jwtToken === incoming_jwtToken)) {
591
+ return false;
592
+ }
593
+ const existing_webSocketUrl = existing.webSocketUrl;
594
+ const incoming_webSocketUrl = incoming.webSocketUrl;
595
+ if (!(existing_webSocketUrl === incoming_webSocketUrl)) {
596
+ return false;
597
+ }
598
+ const existing_error = existing.error;
599
+ const incoming_error = incoming.error;
600
+ const equals_error_props = equalsObject(existing_error, incoming_error, (existing_error_prop, incoming_error_prop) => {
601
+ if (!(existing_error_prop === incoming_error_prop)) {
602
+ return false;
603
+ }
604
+ });
605
+ if (equals_error_props === false) {
606
+ return false;
607
+ }
608
+ return true;
609
+ }
610
+ const ingest$4 = function ConversationRealtimeMeetingInitiationResponseRepresentationIngest(input, path, luvio, store, timestamp) {
611
+ if (process.env.NODE_ENV !== 'production') {
612
+ const validateError = validate$4(input);
613
+ if (validateError !== null) {
614
+ throw validateError;
615
+ }
616
+ }
617
+ const key = keyBuilderFromType$3(luvio, input);
618
+ const ttlToUse = TTL$4;
619
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$4, "eci", VERSION$4, RepresentationType$4, equals$4);
620
+ return createLink(key);
621
+ };
622
+ function getTypeCacheKeys$4(rootKeySet, luvio, input, fullPathFactory) {
623
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
624
+ const rootKey = keyBuilderFromType$3(luvio, input);
625
+ rootKeySet.set(rootKey, {
626
+ namespace: keyPrefix,
627
+ representationName: RepresentationType$4,
628
+ mergeable: false
629
+ });
630
+ }
631
+
632
+ function select$8(luvio, params) {
633
+ return select$9();
634
+ }
635
+ function getResponseCacheKeys$4(storeKeyMap, luvio, resourceParams, response) {
636
+ getTypeCacheKeys$4(storeKeyMap, luvio, response);
637
+ }
638
+ function ingestSuccess$4(luvio, resourceParams, response) {
639
+ const { body } = response;
640
+ const key = keyBuilderFromType$3(luvio, body);
641
+ luvio.storeIngest(key, ingest$4, body);
642
+ const snapshot = luvio.storeLookup({
643
+ recordId: key,
644
+ node: select$8(),
645
+ variables: {},
646
+ });
647
+ if (process.env.NODE_ENV !== 'production') {
648
+ if (snapshot.state !== 'Fulfilled') {
649
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
650
+ }
651
+ }
652
+ deepFreeze(snapshot.data);
653
+ return snapshot;
654
+ }
655
+ function createResourceRequest$4(config) {
656
+ const headers = {};
657
+ return {
658
+ baseUri: '/services/data/v66.0',
659
+ basePath: '/conversation/realtime/insight/meeting/initiate',
660
+ method: 'post',
661
+ body: config.body,
662
+ urlParams: {},
663
+ queryParams: {},
664
+ headers,
665
+ priority: 'normal',
666
+ };
667
+ }
668
+
669
+ const adapterName$4 = 'initiateMeeting';
670
+ const initiateMeeting_ConfigPropertyMetadata = [
671
+ generateParamConfigMetadata('meetingUrl', true, 2 /* Body */, 0 /* String */),
672
+ generateParamConfigMetadata('vendorName', true, 2 /* Body */, 0 /* String */),
673
+ generateParamConfigMetadata('meetingSubject', true, 2 /* Body */, 4 /* Unsupported */),
674
+ generateParamConfigMetadata('meetingId', true, 2 /* Body */, 4 /* Unsupported */),
675
+ generateParamConfigMetadata('participants', true, 2 /* Body */, 4 /* Unsupported */, true),
676
+ ];
677
+ const initiateMeeting_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$4, initiateMeeting_ConfigPropertyMetadata);
678
+ const createResourceParams$4 = /*#__PURE__*/ createResourceParams$6(initiateMeeting_ConfigPropertyMetadata);
679
+ function typeCheckConfig$4(untrustedConfig) {
680
+ const config = {};
681
+ typeCheckConfig$6(untrustedConfig, config, initiateMeeting_ConfigPropertyMetadata);
682
+ const untrustedConfig_meetingSubject = untrustedConfig.meetingSubject;
683
+ if (typeof untrustedConfig_meetingSubject === 'string') {
684
+ config.meetingSubject = untrustedConfig_meetingSubject;
685
+ }
686
+ if (untrustedConfig_meetingSubject === null) {
687
+ config.meetingSubject = untrustedConfig_meetingSubject;
688
+ }
689
+ const untrustedConfig_meetingId = untrustedConfig.meetingId;
690
+ if (typeof untrustedConfig_meetingId === 'string') {
691
+ config.meetingId = untrustedConfig_meetingId;
692
+ }
693
+ if (untrustedConfig_meetingId === null) {
694
+ config.meetingId = untrustedConfig_meetingId;
695
+ }
696
+ const untrustedConfig_participants = untrustedConfig.participants;
697
+ if (ArrayIsArray$1(untrustedConfig_participants)) {
698
+ const untrustedConfig_participants_array = [];
699
+ for (let i = 0, arrayLength = untrustedConfig_participants.length; i < arrayLength; i++) {
700
+ const untrustedConfig_participants_item = untrustedConfig_participants[i];
701
+ const referenceConversationRealtimeMeetingParticipantRepresentationValidationError = validate$5(untrustedConfig_participants_item);
702
+ if (referenceConversationRealtimeMeetingParticipantRepresentationValidationError === null) {
703
+ untrustedConfig_participants_array.push(untrustedConfig_participants_item);
704
+ }
705
+ }
706
+ config.participants = untrustedConfig_participants_array;
707
+ }
708
+ return config;
709
+ }
710
+ function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
711
+ if (!untrustedIsObject(untrustedConfig)) {
712
+ return null;
713
+ }
714
+ if (process.env.NODE_ENV !== 'production') {
715
+ validateConfig(untrustedConfig, configPropertyNames);
716
+ }
717
+ const config = typeCheckConfig$4(untrustedConfig);
718
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
719
+ return null;
720
+ }
721
+ return config;
722
+ }
723
+ function buildNetworkSnapshot$4(luvio, config, options) {
724
+ const resourceParams = createResourceParams$4(config);
725
+ const request = createResourceRequest$4(resourceParams);
726
+ return luvio.dispatchResourceRequest(request, options)
727
+ .then((response) => {
728
+ return luvio.handleSuccessResponse(() => {
729
+ const snapshot = ingestSuccess$4(luvio, resourceParams, response);
730
+ return luvio.storeBroadcast().then(() => snapshot);
731
+ }, () => {
732
+ const cache = new StoreKeyMap();
733
+ getResponseCacheKeys$4(cache, luvio, resourceParams, response.body);
734
+ return cache;
735
+ });
736
+ }, (response) => {
737
+ deepFreeze(response);
738
+ throw response;
739
+ });
740
+ }
741
+ const initiateMeetingAdapterFactory = (luvio) => {
742
+ return function initiateMeeting(untrustedConfig) {
743
+ const config = validateAdapterConfig$4(untrustedConfig, initiateMeeting_ConfigPropertyNames);
744
+ // Invalid or incomplete config
745
+ if (config === null) {
746
+ throw new Error('Invalid config for "initiateMeeting"');
747
+ }
748
+ return buildNetworkSnapshot$4(luvio, config);
749
+ };
750
+ };
751
+
752
+ const TTL$3 = 60000;
753
+ const VERSION$3 = "5b78cffe02ee49666328e048929ba644";
754
+ function validate$3(obj, path = 'ConversationRealtimeEndMeetingResponseRepresentation') {
755
+ const v_error = (() => {
756
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
757
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
758
+ }
759
+ const obj_fakeKey = obj.fakeKey;
760
+ const path_fakeKey = path + '.fakeKey';
761
+ if (typeof obj_fakeKey !== 'string') {
762
+ return new TypeError('Expected "string" but received "' + typeof obj_fakeKey + '" (at "' + path_fakeKey + '")');
763
+ }
764
+ })();
765
+ return v_error === undefined ? null : v_error;
766
+ }
767
+ const RepresentationType$3 = 'ConversationRealtimeEndMeetingResponseRepresentation';
768
+ function keyBuilder$6(luvio, config) {
769
+ return keyPrefix + '::' + RepresentationType$3 + ':' + config.fakeKey;
770
+ }
771
+ function keyBuilderFromType$2(luvio, object) {
772
+ const keyParams = {
773
+ fakeKey: object.fakeKey
774
+ };
775
+ return keyBuilder$6(luvio, keyParams);
776
+ }
777
+ function normalize$3(input, existing, path, luvio, store, timestamp) {
778
+ return input;
779
+ }
780
+ const select$7 = function ConversationRealtimeEndMeetingResponseRepresentationSelect() {
781
+ return {
782
+ kind: 'Fragment',
783
+ version: VERSION$3,
784
+ private: [],
785
+ selections: [
786
+ {
787
+ name: 'fakeKey',
788
+ kind: 'Scalar'
789
+ }
790
+ ]
791
+ };
792
+ };
793
+ function equals$3(existing, incoming) {
794
+ const existing_fakeKey = existing.fakeKey;
795
+ const incoming_fakeKey = incoming.fakeKey;
796
+ if (!(existing_fakeKey === incoming_fakeKey)) {
797
+ return false;
798
+ }
799
+ return true;
800
+ }
801
+ const ingest$3 = function ConversationRealtimeEndMeetingResponseRepresentationIngest(input, path, luvio, store, timestamp) {
802
+ if (process.env.NODE_ENV !== 'production') {
803
+ const validateError = validate$3(input);
804
+ if (validateError !== null) {
805
+ throw validateError;
806
+ }
807
+ }
808
+ const key = keyBuilderFromType$2(luvio, input);
809
+ const ttlToUse = TTL$3;
810
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "eci", VERSION$3, RepresentationType$3, equals$3);
811
+ return createLink(key);
812
+ };
813
+ function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
814
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
815
+ const rootKey = keyBuilderFromType$2(luvio, input);
816
+ rootKeySet.set(rootKey, {
817
+ namespace: keyPrefix,
818
+ representationName: RepresentationType$3,
819
+ mergeable: false
820
+ });
821
+ }
822
+
823
+ function select$6(luvio, params) {
824
+ return select$7();
825
+ }
826
+ function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
827
+ getTypeCacheKeys$3(storeKeyMap, luvio, response);
828
+ }
829
+ function ingestSuccess$3(luvio, resourceParams, response) {
830
+ const { body } = response;
831
+ const key = keyBuilderFromType$2(luvio, body);
832
+ luvio.storeIngest(key, ingest$3, body);
833
+ const snapshot = luvio.storeLookup({
834
+ recordId: key,
835
+ node: select$6(),
836
+ variables: {},
837
+ });
838
+ if (process.env.NODE_ENV !== 'production') {
839
+ if (snapshot.state !== 'Fulfilled') {
840
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
841
+ }
842
+ }
843
+ deepFreeze(snapshot.data);
844
+ return snapshot;
845
+ }
846
+ function createResourceRequest$3(config) {
847
+ const headers = {};
848
+ return {
849
+ baseUri: '/services/data/v66.0',
850
+ basePath: '/conversation/realtime/insight/meeting/terminate',
851
+ method: 'post',
852
+ body: config.body,
853
+ urlParams: {},
854
+ queryParams: {},
855
+ headers,
856
+ priority: 'normal',
857
+ };
858
+ }
859
+
860
+ const adapterName$3 = 'terminateMeeting';
861
+ const terminateMeeting_ConfigPropertyMetadata = [
862
+ generateParamConfigMetadata('botId', true, 2 /* Body */, 0 /* String */),
863
+ ];
864
+ const terminateMeeting_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, terminateMeeting_ConfigPropertyMetadata);
865
+ const createResourceParams$3 = /*#__PURE__*/ createResourceParams$6(terminateMeeting_ConfigPropertyMetadata);
866
+ function typeCheckConfig$3(untrustedConfig) {
867
+ const config = {};
868
+ typeCheckConfig$6(untrustedConfig, config, terminateMeeting_ConfigPropertyMetadata);
869
+ return config;
870
+ }
871
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
872
+ if (!untrustedIsObject(untrustedConfig)) {
873
+ return null;
874
+ }
875
+ if (process.env.NODE_ENV !== 'production') {
876
+ validateConfig(untrustedConfig, configPropertyNames);
877
+ }
878
+ const config = typeCheckConfig$3(untrustedConfig);
879
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
880
+ return null;
881
+ }
882
+ return config;
883
+ }
884
+ function buildNetworkSnapshot$3(luvio, config, options) {
885
+ const resourceParams = createResourceParams$3(config);
886
+ const request = createResourceRequest$3(resourceParams);
887
+ return luvio.dispatchResourceRequest(request, options)
888
+ .then((response) => {
889
+ return luvio.handleSuccessResponse(() => {
890
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response);
891
+ return luvio.storeBroadcast().then(() => snapshot);
892
+ }, () => {
893
+ const cache = new StoreKeyMap();
894
+ getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
895
+ return cache;
896
+ });
897
+ }, (response) => {
898
+ deepFreeze(response);
899
+ throw response;
900
+ });
901
+ }
902
+ const terminateMeetingAdapterFactory = (luvio) => {
903
+ return function terminateMeeting(untrustedConfig) {
904
+ const config = validateAdapterConfig$3(untrustedConfig, terminateMeeting_ConfigPropertyNames);
905
+ // Invalid or incomplete config
906
+ if (config === null) {
907
+ throw new Error('Invalid config for "terminateMeeting"');
908
+ }
909
+ return buildNetworkSnapshot$3(luvio, config);
910
+ };
911
+ };
912
+
913
+ const TTL$2 = 60000;
914
+ const VERSION$2 = "10bf968dbd562928dfa701c7f6a854b2";
915
+ function validate$2(obj, path = 'ConversationSummaryRepresentation') {
916
+ const v_error = (() => {
917
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
918
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
919
+ }
920
+ const obj_conversationRecordId = obj.conversationRecordId;
921
+ const path_conversationRecordId = path + '.conversationRecordId';
922
+ if (typeof obj_conversationRecordId !== 'string') {
923
+ return new TypeError('Expected "string" but received "' + typeof obj_conversationRecordId + '" (at "' + path_conversationRecordId + '")');
924
+ }
925
+ const obj_errorMessage = obj.errorMessage;
926
+ const path_errorMessage = path + '.errorMessage';
927
+ let obj_errorMessage_union0 = null;
928
+ const obj_errorMessage_union0_error = (() => {
929
+ if (typeof obj_errorMessage !== 'string') {
930
+ return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
931
+ }
932
+ })();
933
+ if (obj_errorMessage_union0_error != null) {
934
+ obj_errorMessage_union0 = obj_errorMessage_union0_error.message;
935
+ }
936
+ let obj_errorMessage_union1 = null;
937
+ const obj_errorMessage_union1_error = (() => {
938
+ if (obj_errorMessage !== null) {
939
+ return new TypeError('Expected "null" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
940
+ }
941
+ })();
942
+ if (obj_errorMessage_union1_error != null) {
943
+ obj_errorMessage_union1 = obj_errorMessage_union1_error.message;
944
+ }
945
+ if (obj_errorMessage_union0 && obj_errorMessage_union1) {
946
+ let message = 'Object doesn\'t match union (at "' + path_errorMessage + '")';
947
+ message += '\n' + obj_errorMessage_union0.split('\n').map((line) => '\t' + line).join('\n');
948
+ message += '\n' + obj_errorMessage_union1.split('\n').map((line) => '\t' + line).join('\n');
949
+ return new TypeError(message);
950
+ }
951
+ const obj_id = obj.id;
952
+ const path_id = path + '.id';
953
+ if (typeof obj_id !== 'string') {
954
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
955
+ }
956
+ const obj_source = obj.source;
957
+ const path_source = path + '.source';
958
+ let obj_source_union0 = null;
959
+ const obj_source_union0_error = (() => {
960
+ if (typeof obj_source !== 'string') {
961
+ return new TypeError('Expected "string" but received "' + typeof obj_source + '" (at "' + path_source + '")');
962
+ }
963
+ })();
964
+ if (obj_source_union0_error != null) {
965
+ obj_source_union0 = obj_source_union0_error.message;
966
+ }
967
+ let obj_source_union1 = null;
968
+ const obj_source_union1_error = (() => {
969
+ if (obj_source !== null) {
970
+ return new TypeError('Expected "null" but received "' + typeof obj_source + '" (at "' + path_source + '")');
971
+ }
972
+ })();
973
+ if (obj_source_union1_error != null) {
974
+ obj_source_union1 = obj_source_union1_error.message;
975
+ }
976
+ if (obj_source_union0 && obj_source_union1) {
977
+ let message = 'Object doesn\'t match union (at "' + path_source + '")';
978
+ message += '\n' + obj_source_union0.split('\n').map((line) => '\t' + line).join('\n');
979
+ message += '\n' + obj_source_union1.split('\n').map((line) => '\t' + line).join('\n');
980
+ return new TypeError(message);
981
+ }
982
+ const obj_status = obj.status;
983
+ const path_status = path + '.status';
984
+ if (typeof obj_status !== 'string') {
985
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
986
+ }
987
+ const obj_summary = obj.summary;
988
+ const path_summary = path + '.summary';
989
+ let obj_summary_union0 = null;
990
+ const obj_summary_union0_error = (() => {
991
+ if (typeof obj_summary !== 'string') {
992
+ return new TypeError('Expected "string" but received "' + typeof obj_summary + '" (at "' + path_summary + '")');
993
+ }
994
+ })();
995
+ if (obj_summary_union0_error != null) {
996
+ obj_summary_union0 = obj_summary_union0_error.message;
997
+ }
998
+ let obj_summary_union1 = null;
999
+ const obj_summary_union1_error = (() => {
1000
+ if (obj_summary !== null) {
1001
+ return new TypeError('Expected "null" but received "' + typeof obj_summary + '" (at "' + path_summary + '")');
1002
+ }
1003
+ })();
1004
+ if (obj_summary_union1_error != null) {
1005
+ obj_summary_union1 = obj_summary_union1_error.message;
1006
+ }
1007
+ if (obj_summary_union0 && obj_summary_union1) {
1008
+ let message = 'Object doesn\'t match union (at "' + path_summary + '")';
1009
+ message += '\n' + obj_summary_union0.split('\n').map((line) => '\t' + line).join('\n');
1010
+ message += '\n' + obj_summary_union1.split('\n').map((line) => '\t' + line).join('\n');
1011
+ return new TypeError(message);
1012
+ }
1013
+ })();
1014
+ return v_error === undefined ? null : v_error;
1015
+ }
1016
+ const RepresentationType$2 = 'ConversationSummaryRepresentation';
1017
+ function keyBuilder$5(luvio, config) {
1018
+ return keyPrefix + '::' + RepresentationType$2 + ':' + config.conversation_sumamry_id;
1019
+ }
1020
+ function keyBuilderFromType$1(luvio, object) {
1021
+ const keyParams = {
1022
+ conversation_sumamry_id: object.id
1023
+ };
1024
+ return keyBuilder$5(luvio, keyParams);
1025
+ }
1026
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
1027
+ return input;
1028
+ }
1029
+ const select$5 = function ConversationSummaryRepresentationSelect() {
1030
+ return {
1031
+ kind: 'Fragment',
1032
+ version: VERSION$2,
1033
+ private: [],
1034
+ selections: [
1035
+ {
1036
+ name: 'conversationRecordId',
1037
+ kind: 'Scalar'
1038
+ },
1039
+ {
1040
+ name: 'errorMessage',
1041
+ kind: 'Scalar'
1042
+ },
1043
+ {
1044
+ name: 'id',
1045
+ kind: 'Scalar'
1046
+ },
1047
+ {
1048
+ name: 'source',
1049
+ kind: 'Scalar'
1050
+ },
1051
+ {
1052
+ name: 'status',
1053
+ kind: 'Scalar'
1054
+ },
1055
+ {
1056
+ name: 'summary',
1057
+ kind: 'Scalar'
1058
+ }
1059
+ ]
1060
+ };
1061
+ };
1062
+ function equals$2(existing, incoming) {
1063
+ const existing_conversationRecordId = existing.conversationRecordId;
1064
+ const incoming_conversationRecordId = incoming.conversationRecordId;
1065
+ if (!(existing_conversationRecordId === incoming_conversationRecordId)) {
1066
+ return false;
1067
+ }
1068
+ const existing_id = existing.id;
1069
+ const incoming_id = incoming.id;
1070
+ if (!(existing_id === incoming_id)) {
1071
+ return false;
1072
+ }
1073
+ const existing_status = existing.status;
1074
+ const incoming_status = incoming.status;
1075
+ if (!(existing_status === incoming_status)) {
1076
+ return false;
1077
+ }
1078
+ const existing_errorMessage = existing.errorMessage;
1079
+ const incoming_errorMessage = incoming.errorMessage;
1080
+ if (!(existing_errorMessage === incoming_errorMessage)) {
1081
+ return false;
1082
+ }
1083
+ const existing_source = existing.source;
1084
+ const incoming_source = incoming.source;
1085
+ if (!(existing_source === incoming_source)) {
1086
+ return false;
1087
+ }
1088
+ const existing_summary = existing.summary;
1089
+ const incoming_summary = incoming.summary;
1090
+ if (!(existing_summary === incoming_summary)) {
1091
+ return false;
1092
+ }
1093
+ return true;
1094
+ }
1095
+ const ingest$2 = function ConversationSummaryRepresentationIngest(input, path, luvio, store, timestamp) {
1096
+ if (process.env.NODE_ENV !== 'production') {
1097
+ const validateError = validate$2(input);
1098
+ if (validateError !== null) {
1099
+ throw validateError;
1100
+ }
1101
+ }
1102
+ const key = keyBuilderFromType$1(luvio, input);
1103
+ const ttlToUse = TTL$2;
1104
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "eci", VERSION$2, RepresentationType$2, equals$2);
1105
+ return createLink(key);
1106
+ };
1107
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
1108
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1109
+ const rootKey = keyBuilderFromType$1(luvio, input);
1110
+ rootKeySet.set(rootKey, {
1111
+ namespace: keyPrefix,
1112
+ representationName: RepresentationType$2,
1113
+ mergeable: false
1114
+ });
1115
+ }
1116
+
1117
+ function select$4(luvio, params) {
1118
+ return select$5();
1119
+ }
1120
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
1121
+ getTypeCacheKeys$2(storeKeyMap, luvio, response);
1122
+ }
1123
+ function ingestSuccess$2(luvio, resourceParams, response) {
1124
+ const { body } = response;
1125
+ const key = keyBuilderFromType$1(luvio, body);
1126
+ luvio.storeIngest(key, ingest$2, body);
1127
+ const snapshot = luvio.storeLookup({
1128
+ recordId: key,
1129
+ node: select$4(),
1130
+ variables: {},
1131
+ });
1132
+ if (process.env.NODE_ENV !== 'production') {
1133
+ if (snapshot.state !== 'Fulfilled') {
1134
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1135
+ }
1136
+ }
1137
+ deepFreeze(snapshot.data);
1138
+ return snapshot;
1139
+ }
1140
+ function createResourceRequest$2(config) {
1141
+ const headers = {};
1142
+ return {
1143
+ baseUri: '/services/data/v66.0',
1144
+ basePath: '/conversation/summary/ai/generate/' + config.urlParams.conversationId + '',
1145
+ method: 'post',
1146
+ body: null,
1147
+ urlParams: config.urlParams,
1148
+ queryParams: {},
1149
+ headers,
1150
+ priority: 'normal',
1151
+ };
1152
+ }
1153
+
1154
+ const adapterName$2 = 'generateConversationSummary';
1155
+ const generateConversationSummary_ConfigPropertyMetadata = [
1156
+ generateParamConfigMetadata('conversationId', true, 0 /* UrlParameter */, 0 /* String */),
1157
+ ];
1158
+ const generateConversationSummary_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, generateConversationSummary_ConfigPropertyMetadata);
1159
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$6(generateConversationSummary_ConfigPropertyMetadata);
1160
+ function typeCheckConfig$2(untrustedConfig) {
1161
+ const config = {};
1162
+ typeCheckConfig$6(untrustedConfig, config, generateConversationSummary_ConfigPropertyMetadata);
1163
+ return config;
1164
+ }
1165
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
1166
+ if (!untrustedIsObject(untrustedConfig)) {
1167
+ return null;
1168
+ }
1169
+ if (process.env.NODE_ENV !== 'production') {
1170
+ validateConfig(untrustedConfig, configPropertyNames);
1171
+ }
1172
+ const config = typeCheckConfig$2(untrustedConfig);
1173
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1174
+ return null;
1175
+ }
1176
+ return config;
1177
+ }
1178
+ function buildNetworkSnapshot$2(luvio, config, options) {
1179
+ const resourceParams = createResourceParams$2(config);
1180
+ const request = createResourceRequest$2(resourceParams);
1181
+ return luvio.dispatchResourceRequest(request, options)
1182
+ .then((response) => {
1183
+ return luvio.handleSuccessResponse(() => {
1184
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response);
1185
+ return luvio.storeBroadcast().then(() => snapshot);
1186
+ }, () => {
1187
+ const cache = new StoreKeyMap();
1188
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
1189
+ return cache;
1190
+ });
1191
+ }, (response) => {
1192
+ deepFreeze(response);
1193
+ throw response;
1194
+ });
1195
+ }
1196
+ const generateConversationSummaryAdapterFactory = (luvio) => {
1197
+ return function generateConversationSummary(untrustedConfig) {
1198
+ const config = validateAdapterConfig$2(untrustedConfig, generateConversationSummary_ConfigPropertyNames);
1199
+ // Invalid or incomplete config
1200
+ if (config === null) {
1201
+ throw new Error('Invalid config for "generateConversationSummary"');
1202
+ }
1203
+ return buildNetworkSnapshot$2(luvio, config);
1204
+ };
1205
+ };
1206
+
1207
+ const TTL$1 = 60000;
1208
+ const VERSION$1 = "233fbc0cf53c7a50800a3e8b63d661be";
1209
+ function validate$1(obj, path = 'ConversationSummaryListRepresentation') {
1210
+ const v_error = (() => {
1211
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1212
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1213
+ }
1214
+ const obj_conversationIds = obj.conversationIds;
1215
+ const path_conversationIds = path + '.conversationIds';
1216
+ if (!ArrayIsArray(obj_conversationIds)) {
1217
+ return new TypeError('Expected "array" but received "' + typeof obj_conversationIds + '" (at "' + path_conversationIds + '")');
1218
+ }
1219
+ for (let i = 0; i < obj_conversationIds.length; i++) {
1220
+ const obj_conversationIds_item = obj_conversationIds[i];
1221
+ const path_conversationIds_item = path_conversationIds + '[' + i + ']';
1222
+ if (typeof obj_conversationIds_item !== 'string') {
1223
+ return new TypeError('Expected "string" but received "' + typeof obj_conversationIds_item + '" (at "' + path_conversationIds_item + '")');
1224
+ }
1225
+ }
1226
+ const obj_conversationSummaryList = obj.conversationSummaryList;
1227
+ const path_conversationSummaryList = path + '.conversationSummaryList';
1228
+ if (!ArrayIsArray(obj_conversationSummaryList)) {
1229
+ return new TypeError('Expected "array" but received "' + typeof obj_conversationSummaryList + '" (at "' + path_conversationSummaryList + '")');
1230
+ }
1231
+ for (let i = 0; i < obj_conversationSummaryList.length; i++) {
1232
+ const obj_conversationSummaryList_item = obj_conversationSummaryList[i];
1233
+ const path_conversationSummaryList_item = path_conversationSummaryList + '[' + i + ']';
1234
+ if (typeof obj_conversationSummaryList_item !== 'object' || Array.isArray(obj_conversationSummaryList_item)) {
1235
+ return new TypeError('Expected "object" but received "' + typeof obj_conversationSummaryList_item + '" (at "' + path_conversationSummaryList_item + '")');
1236
+ }
1237
+ }
1238
+ const obj_id = obj.id;
1239
+ const path_id = path + '.id';
1240
+ if (typeof obj_id !== 'string') {
1241
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
1242
+ }
1243
+ })();
1244
+ return v_error === undefined ? null : v_error;
1245
+ }
1246
+ const RepresentationType$1 = 'ConversationSummaryListRepresentation';
1247
+ function keyBuilder$4(luvio, config) {
1248
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.id;
1249
+ }
1250
+ function keyBuilderFromType(luvio, object) {
1251
+ const keyParams = {
1252
+ id: object.id
1253
+ };
1254
+ return keyBuilder$4(luvio, keyParams);
1255
+ }
1256
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
1257
+ const input_conversationSummaryList = input.conversationSummaryList;
1258
+ const input_conversationSummaryList_id = path.fullPath + '__conversationSummaryList';
1259
+ for (let i = 0; i < input_conversationSummaryList.length; i++) {
1260
+ const input_conversationSummaryList_item = input_conversationSummaryList[i];
1261
+ let input_conversationSummaryList_item_id = input_conversationSummaryList_id + '__' + i;
1262
+ input_conversationSummaryList[i] = ingest$2(input_conversationSummaryList_item, {
1263
+ fullPath: input_conversationSummaryList_item_id,
1264
+ propertyName: i,
1265
+ parent: {
1266
+ data: input,
1267
+ key: path.fullPath,
1268
+ existing: existing,
1269
+ },
1270
+ ttl: path.ttl
1271
+ }, luvio, store, timestamp);
1272
+ }
1273
+ return input;
1274
+ }
1275
+ const select$3 = function ConversationSummaryListRepresentationSelect() {
1276
+ return {
1277
+ kind: 'Fragment',
1278
+ version: VERSION$1,
1279
+ private: [],
1280
+ selections: [
1281
+ {
1282
+ name: 'conversationIds',
1283
+ kind: 'Scalar',
1284
+ plural: true
1285
+ },
1286
+ {
1287
+ name: 'conversationSummaryList',
1288
+ kind: 'Link',
1289
+ plural: true,
1290
+ fragment: select$5()
1291
+ },
1292
+ {
1293
+ name: 'id',
1294
+ kind: 'Scalar'
1295
+ }
1296
+ ]
1297
+ };
1298
+ };
1299
+ function equals$1(existing, incoming) {
1300
+ const existing_id = existing.id;
1301
+ const incoming_id = incoming.id;
1302
+ if (!(existing_id === incoming_id)) {
1303
+ return false;
1304
+ }
1305
+ const existing_conversationIds = existing.conversationIds;
1306
+ const incoming_conversationIds = incoming.conversationIds;
1307
+ const equals_conversationIds_items = equalsArray(existing_conversationIds, incoming_conversationIds, (existing_conversationIds_item, incoming_conversationIds_item) => {
1308
+ if (!(existing_conversationIds_item === incoming_conversationIds_item)) {
1309
+ return false;
1310
+ }
1311
+ });
1312
+ if (equals_conversationIds_items === false) {
1313
+ return false;
1314
+ }
1315
+ const existing_conversationSummaryList = existing.conversationSummaryList;
1316
+ const incoming_conversationSummaryList = incoming.conversationSummaryList;
1317
+ const equals_conversationSummaryList_items = equalsArray(existing_conversationSummaryList, incoming_conversationSummaryList, (existing_conversationSummaryList_item, incoming_conversationSummaryList_item) => {
1318
+ if (!(existing_conversationSummaryList_item.__ref === incoming_conversationSummaryList_item.__ref)) {
1319
+ return false;
1320
+ }
1321
+ });
1322
+ if (equals_conversationSummaryList_items === false) {
1323
+ return false;
1324
+ }
1325
+ return true;
1326
+ }
1327
+ const ingest$1 = function ConversationSummaryListRepresentationIngest(input, path, luvio, store, timestamp) {
1328
+ if (process.env.NODE_ENV !== 'production') {
1329
+ const validateError = validate$1(input);
1330
+ if (validateError !== null) {
1331
+ throw validateError;
1332
+ }
1333
+ }
1334
+ const key = keyBuilderFromType(luvio, input);
1335
+ const ttlToUse = TTL$1;
1336
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "eci", VERSION$1, RepresentationType$1, equals$1);
1337
+ return createLink(key);
1338
+ };
1339
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
1340
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1341
+ const rootKey = keyBuilderFromType(luvio, input);
1342
+ rootKeySet.set(rootKey, {
1343
+ namespace: keyPrefix,
1344
+ representationName: RepresentationType$1,
1345
+ mergeable: false
1346
+ });
1347
+ const input_conversationSummaryList_length = input.conversationSummaryList.length;
1348
+ for (let i = 0; i < input_conversationSummaryList_length; i++) {
1349
+ getTypeCacheKeys$2(rootKeySet, luvio, input.conversationSummaryList[i]);
1350
+ }
1351
+ }
1352
+
1353
+ function select$2(luvio, params) {
1354
+ return select$3();
1355
+ }
1356
+ function keyBuilder$3(luvio, params) {
1357
+ return keyBuilder$4(luvio, {
1358
+ id: params.urlParams.id
1359
+ });
1360
+ }
1361
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
1362
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
1363
+ }
1364
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
1365
+ const { body } = response;
1366
+ const key = keyBuilder$3(luvio, resourceParams);
1367
+ luvio.storeIngest(key, ingest$1, body);
1368
+ const snapshot = luvio.storeLookup({
1369
+ recordId: key,
1370
+ node: select$2(),
1371
+ variables: {},
1372
+ }, snapshotRefresh);
1373
+ if (process.env.NODE_ENV !== 'production') {
1374
+ if (snapshot.state !== 'Fulfilled') {
1375
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1376
+ }
1377
+ }
1378
+ deepFreeze(snapshot.data);
1379
+ return snapshot;
1380
+ }
1381
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
1382
+ const key = keyBuilder$3(luvio, params);
1383
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1384
+ const storeMetadataParams = {
1385
+ ttl: TTL$1,
1386
+ namespace: keyPrefix,
1387
+ version: VERSION$1,
1388
+ representationName: RepresentationType$1
1389
+ };
1390
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
1391
+ return errorSnapshot;
1392
+ }
1393
+ function createResourceRequest$1(config) {
1394
+ const headers = {};
1395
+ return {
1396
+ baseUri: '/services/data/v66.0',
1397
+ basePath: '/conversation/summary/related/' + config.urlParams.id + '',
1398
+ method: 'get',
1399
+ body: null,
1400
+ urlParams: config.urlParams,
1401
+ queryParams: {},
1402
+ headers,
1403
+ priority: 'normal',
1404
+ };
1405
+ }
1406
+
1407
+ const adapterName$1 = 'getConversationSummaryRelatedList';
1408
+ const getConversationSummaryRelatedList_ConfigPropertyMetadata = [
1409
+ generateParamConfigMetadata('id', true, 0 /* UrlParameter */, 0 /* String */),
1410
+ ];
1411
+ const getConversationSummaryRelatedList_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getConversationSummaryRelatedList_ConfigPropertyMetadata);
1412
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$6(getConversationSummaryRelatedList_ConfigPropertyMetadata);
1413
+ function keyBuilder$2(luvio, config) {
1414
+ const resourceParams = createResourceParams$1(config);
1415
+ return keyBuilder$3(luvio, resourceParams);
1416
+ }
1417
+ function typeCheckConfig$1(untrustedConfig) {
1418
+ const config = {};
1419
+ typeCheckConfig$6(untrustedConfig, config, getConversationSummaryRelatedList_ConfigPropertyMetadata);
1420
+ return config;
1421
+ }
1422
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
1423
+ if (!untrustedIsObject(untrustedConfig)) {
1424
+ return null;
1425
+ }
1426
+ if (process.env.NODE_ENV !== 'production') {
1427
+ validateConfig(untrustedConfig, configPropertyNames);
1428
+ }
1429
+ const config = typeCheckConfig$1(untrustedConfig);
1430
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1431
+ return null;
1432
+ }
1433
+ return config;
1434
+ }
1435
+ function adapterFragment$1(luvio, config) {
1436
+ createResourceParams$1(config);
1437
+ return select$2();
1438
+ }
1439
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
1440
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
1441
+ config,
1442
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1443
+ });
1444
+ return luvio.storeBroadcast().then(() => snapshot);
1445
+ }
1446
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
1447
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
1448
+ config,
1449
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1450
+ });
1451
+ return luvio.storeBroadcast().then(() => snapshot);
1452
+ }
1453
+ function buildNetworkSnapshot$1(luvio, config, options) {
1454
+ const resourceParams = createResourceParams$1(config);
1455
+ const request = createResourceRequest$1(resourceParams);
1456
+ return luvio.dispatchResourceRequest(request, options)
1457
+ .then((response) => {
1458
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
1459
+ const cache = new StoreKeyMap();
1460
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
1461
+ return cache;
1462
+ });
1463
+ }, (response) => {
1464
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
1465
+ });
1466
+ }
1467
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
1468
+ return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
1469
+ }
1470
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
1471
+ const { luvio, config } = context;
1472
+ const selector = {
1473
+ recordId: keyBuilder$2(luvio, config),
1474
+ node: adapterFragment$1(luvio, config),
1475
+ variables: {},
1476
+ };
1477
+ const cacheSnapshot = storeLookup(selector, {
1478
+ config,
1479
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1480
+ });
1481
+ return cacheSnapshot;
1482
+ }
1483
+ const getConversationSummaryRelatedListAdapterFactory = (luvio) => function eci__getConversationSummaryRelatedList(untrustedConfig, requestContext) {
1484
+ const config = validateAdapterConfig$1(untrustedConfig, getConversationSummaryRelatedList_ConfigPropertyNames);
1485
+ // Invalid or incomplete config
1486
+ if (config === null) {
1487
+ return null;
1488
+ }
1489
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1490
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
1491
+ };
1492
+
1493
+ const TTL = 2592000000;
1494
+ const VERSION = "b6caaeb6ce6369783e9b10315a598d75";
1495
+ function validate(obj, path = 'ConversationTranscriptRepresentation') {
1496
+ const v_error = (() => {
1497
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1498
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1499
+ }
1500
+ const obj_error = obj.error;
1501
+ const path_error = path + '.error';
1502
+ if (typeof obj_error !== 'object' || ArrayIsArray(obj_error) || obj_error === null) {
1503
+ return new TypeError('Expected "object" but received "' + typeof obj_error + '" (at "' + path_error + '")');
1504
+ }
1505
+ const obj_error_keys = ObjectKeys(obj_error);
1506
+ for (let i = 0; i < obj_error_keys.length; i++) {
1507
+ const key = obj_error_keys[i];
1508
+ const obj_error_prop = obj_error[key];
1509
+ const path_error_prop = path_error + '["' + key + '"]';
1510
+ if (typeof obj_error_prop !== 'string') {
1511
+ return new TypeError('Expected "string" but received "' + typeof obj_error_prop + '" (at "' + path_error_prop + '")');
1512
+ }
1513
+ }
1514
+ const obj_transcriptData = obj.transcriptData;
1515
+ const path_transcriptData = path + '.transcriptData';
1516
+ let obj_transcriptData_union0 = null;
1517
+ const obj_transcriptData_union0_error = (() => {
1518
+ if (typeof obj_transcriptData !== 'string') {
1519
+ return new TypeError('Expected "string" but received "' + typeof obj_transcriptData + '" (at "' + path_transcriptData + '")');
1520
+ }
1521
+ })();
1522
+ if (obj_transcriptData_union0_error != null) {
1523
+ obj_transcriptData_union0 = obj_transcriptData_union0_error.message;
1524
+ }
1525
+ let obj_transcriptData_union1 = null;
1526
+ const obj_transcriptData_union1_error = (() => {
1527
+ if (obj_transcriptData !== null) {
1528
+ return new TypeError('Expected "null" but received "' + typeof obj_transcriptData + '" (at "' + path_transcriptData + '")');
1529
+ }
1530
+ })();
1531
+ if (obj_transcriptData_union1_error != null) {
1532
+ obj_transcriptData_union1 = obj_transcriptData_union1_error.message;
1533
+ }
1534
+ if (obj_transcriptData_union0 && obj_transcriptData_union1) {
1535
+ let message = 'Object doesn\'t match union (at "' + path_transcriptData + '")';
1536
+ message += '\n' + obj_transcriptData_union0.split('\n').map((line) => '\t' + line).join('\n');
1537
+ message += '\n' + obj_transcriptData_union1.split('\n').map((line) => '\t' + line).join('\n');
1538
+ return new TypeError(message);
1539
+ }
1540
+ })();
1541
+ return v_error === undefined ? null : v_error;
1542
+ }
1543
+ const RepresentationType = 'ConversationTranscriptRepresentation';
1544
+ function normalize(input, existing, path, luvio, store, timestamp) {
1545
+ return input;
1546
+ }
1547
+ const select$1 = function ConversationTranscriptRepresentationSelect() {
1548
+ return {
1549
+ kind: 'Fragment',
1550
+ version: VERSION,
1551
+ private: [],
1552
+ selections: [
1553
+ {
1554
+ name: 'error',
1555
+ kind: 'Scalar',
1556
+ map: true
1557
+ },
1558
+ {
1559
+ name: 'transcriptData',
1560
+ kind: 'Scalar'
1561
+ }
1562
+ ]
1563
+ };
1564
+ };
1565
+ function equals(existing, incoming) {
1566
+ const existing_error = existing.error;
1567
+ const incoming_error = incoming.error;
1568
+ const equals_error_props = equalsObject(existing_error, incoming_error, (existing_error_prop, incoming_error_prop) => {
1569
+ if (!(existing_error_prop === incoming_error_prop)) {
1570
+ return false;
1571
+ }
1572
+ });
1573
+ if (equals_error_props === false) {
1574
+ return false;
1575
+ }
1576
+ const existing_transcriptData = existing.transcriptData;
1577
+ const incoming_transcriptData = incoming.transcriptData;
1578
+ if (!(existing_transcriptData === incoming_transcriptData)) {
1579
+ return false;
1580
+ }
1581
+ return true;
1582
+ }
1583
+ const ingest = function ConversationTranscriptRepresentationIngest(input, path, luvio, store, timestamp) {
1584
+ if (process.env.NODE_ENV !== 'production') {
1585
+ const validateError = validate(input);
1586
+ if (validateError !== null) {
1587
+ throw validateError;
1588
+ }
1589
+ }
1590
+ const key = path.fullPath;
1591
+ const ttlToUse = TTL;
1592
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "eci", VERSION, RepresentationType, equals);
1593
+ return createLink(key);
1594
+ };
1595
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
1596
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1597
+ const rootKey = fullPathFactory();
1598
+ rootKeySet.set(rootKey, {
1599
+ namespace: keyPrefix,
1600
+ representationName: RepresentationType,
1601
+ mergeable: false
1602
+ });
1603
+ }
1604
+
1605
+ function select(luvio, params) {
1606
+ return select$1();
1607
+ }
1608
+ function keyBuilder$1(luvio, params) {
1609
+ return keyPrefix + '::ConversationTranscriptRepresentation:(' + 'includeData:' + params.queryParams.includeData + ',' + 'sfdcCallIdOrRecordingId:' + params.urlParams.sfdcCallIdOrRecordingId + ')';
1610
+ }
1611
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
1612
+ getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
1613
+ }
1614
+ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
1615
+ const { body } = response;
1616
+ const key = keyBuilder$1(luvio, resourceParams);
1617
+ luvio.storeIngest(key, ingest, body);
1618
+ const snapshot = luvio.storeLookup({
1619
+ recordId: key,
1620
+ node: select(),
1621
+ variables: {},
1622
+ }, snapshotRefresh);
1623
+ if (process.env.NODE_ENV !== 'production') {
1624
+ if (snapshot.state !== 'Fulfilled') {
1625
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1626
+ }
1627
+ }
1628
+ deepFreeze(snapshot.data);
1629
+ return snapshot;
1630
+ }
1631
+ function ingestError(luvio, params, error, snapshotRefresh) {
1632
+ const key = keyBuilder$1(luvio, params);
1633
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1634
+ const storeMetadataParams = {
1635
+ ttl: TTL,
1636
+ namespace: keyPrefix,
1637
+ version: VERSION,
1638
+ representationName: RepresentationType
1639
+ };
1640
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
1641
+ return errorSnapshot;
1642
+ }
1643
+ function createResourceRequest(config) {
1644
+ const headers = {};
1645
+ return {
1646
+ baseUri: '/services/data/v66.0',
1647
+ basePath: '/conversation/transcript/' + config.urlParams.sfdcCallIdOrRecordingId + '',
1648
+ method: 'get',
1649
+ body: null,
1650
+ urlParams: config.urlParams,
1651
+ queryParams: config.queryParams,
1652
+ headers,
1653
+ priority: 'normal',
1654
+ };
1655
+ }
1656
+
1657
+ const adapterName = 'getTranscript';
1658
+ const getTranscript_ConfigPropertyMetadata = [
1659
+ generateParamConfigMetadata('sfdcCallIdOrRecordingId', true, 0 /* UrlParameter */, 0 /* String */),
1660
+ generateParamConfigMetadata('includeData', false, 1 /* QueryParameter */, 1 /* Boolean */),
1661
+ ];
1662
+ const getTranscript_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getTranscript_ConfigPropertyMetadata);
1663
+ const createResourceParams = /*#__PURE__*/ createResourceParams$6(getTranscript_ConfigPropertyMetadata);
1664
+ function keyBuilder(luvio, config) {
1665
+ const resourceParams = createResourceParams(config);
1666
+ return keyBuilder$1(luvio, resourceParams);
1667
+ }
1668
+ function typeCheckConfig(untrustedConfig) {
1669
+ const config = {};
1670
+ typeCheckConfig$6(untrustedConfig, config, getTranscript_ConfigPropertyMetadata);
1671
+ return config;
1672
+ }
1673
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
1674
+ if (!untrustedIsObject(untrustedConfig)) {
1675
+ return null;
1676
+ }
1677
+ if (process.env.NODE_ENV !== 'production') {
1678
+ validateConfig(untrustedConfig, configPropertyNames);
1679
+ }
1680
+ const config = typeCheckConfig(untrustedConfig);
1681
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1682
+ return null;
1683
+ }
1684
+ return config;
1685
+ }
1686
+ function adapterFragment(luvio, config) {
1687
+ createResourceParams(config);
1688
+ return select();
1689
+ }
1690
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
1691
+ const snapshot = ingestSuccess(luvio, resourceParams, response, {
1692
+ config,
1693
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1694
+ });
1695
+ return luvio.storeBroadcast().then(() => snapshot);
1696
+ }
1697
+ function onFetchResponseError(luvio, config, resourceParams, response) {
1698
+ const snapshot = ingestError(luvio, resourceParams, response, {
1699
+ config,
1700
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1701
+ });
1702
+ return luvio.storeBroadcast().then(() => snapshot);
1703
+ }
1704
+ function buildNetworkSnapshot(luvio, config, options) {
1705
+ const resourceParams = createResourceParams(config);
1706
+ const request = createResourceRequest(resourceParams);
1707
+ return luvio.dispatchResourceRequest(request, options)
1708
+ .then((response) => {
1709
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
1710
+ const cache = new StoreKeyMap();
1711
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
1712
+ return cache;
1713
+ });
1714
+ }, (response) => {
1715
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
1716
+ });
1717
+ }
1718
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
1719
+ return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
1720
+ }
1721
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
1722
+ const { luvio, config } = context;
1723
+ const selector = {
1724
+ recordId: keyBuilder(luvio, config),
1725
+ node: adapterFragment(luvio, config),
1726
+ variables: {},
1727
+ };
1728
+ const cacheSnapshot = storeLookup(selector, {
1729
+ config,
1730
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1731
+ });
1732
+ return cacheSnapshot;
1733
+ }
1734
+ const getTranscriptAdapterFactory = (luvio) => function eci__getTranscript(untrustedConfig, requestContext) {
1735
+ const config = validateAdapterConfig(untrustedConfig, getTranscript_ConfigPropertyNames);
1736
+ // Invalid or incomplete config
1737
+ if (config === null) {
1738
+ return null;
1739
+ }
1740
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1741
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
1742
+ };
1743
+
1744
+ export { generateConversationSummaryAdapterFactory, getConversationGenerativeInsightAdapterFactory, getConversationSummaryRelatedListAdapterFactory, getTranscriptAdapterFactory, initiateMeetingAdapterFactory, terminateMeetingAdapterFactory };