@salesforce/lds-adapters-service-einstein-copilot-bot 1.266.0-dev16 → 1.266.0-dev17

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, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2, StoreKeyMap, createResourceParams as createResourceParams$3, typeCheckConfig as typeCheckConfig$3 } from '@luvio/engine';
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, StoreKeyMap, createResourceParams as createResourceParams$2, typeCheckConfig as typeCheckConfig$2 } from '@luvio/engine';
8
8
 
9
9
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
- const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
10
+ const { keys: ObjectKeys, create: ObjectCreate } = 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$1(config).some(key => !supported.includes(key))) {
34
+ if (ObjectKeys(config).some(key => !supported.includes(key))) {
35
35
  throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
36
36
  }
37
37
  }
@@ -71,7 +71,6 @@ function buildAdapterValidationConfig(displayName, paramsMeta) {
71
71
  }
72
72
  const keyPrefix = 'einstein-copilot-bot';
73
73
 
74
- const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
75
74
  const { isArray: ArrayIsArray } = Array;
76
75
  const { stringify: JSONStringify } = JSON;
77
76
  function equalsArray(a, b, equalsItem) {
@@ -87,34 +86,15 @@ function equalsArray(a, b, equalsItem) {
87
86
  }
88
87
  return true;
89
88
  }
90
- function equalsObject(a, b, equalsProp) {
91
- const aKeys = ObjectKeys(a).sort();
92
- const bKeys = ObjectKeys(b).sort();
93
- const aKeysLength = aKeys.length;
94
- const bKeysLength = bKeys.length;
95
- if (aKeysLength !== bKeysLength) {
96
- return false;
97
- }
98
- for (let i = 0; i < aKeys.length; i++) {
99
- const key = aKeys[i];
100
- if (key !== bKeys[i]) {
101
- return false;
102
- }
103
- if (equalsProp(a[key], b[key]) === false) {
104
- return false;
105
- }
106
- }
107
- return true;
108
- }
109
89
  function createLink(ref) {
110
90
  return {
111
91
  __ref: serializeStructuredKey(ref),
112
92
  };
113
93
  }
114
94
 
115
- const TTL$3 = 30000;
116
- const VERSION$7 = "ab85410a28124cfed3d8eae7b8236853";
117
- function validate$8(obj, path = 'CopilotBotInfoRepresentation') {
95
+ const TTL$2 = 30000;
96
+ const VERSION$5 = "ab85410a28124cfed3d8eae7b8236853";
97
+ function validate$6(obj, path = 'CopilotBotInfoRepresentation') {
118
98
  const v_error = (() => {
119
99
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
120
100
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -141,14 +121,14 @@ function validate$8(obj, path = 'CopilotBotInfoRepresentation') {
141
121
  })();
142
122
  return v_error === undefined ? null : v_error;
143
123
  }
144
- const RepresentationType$3 = 'CopilotBotInfoRepresentation';
145
- function normalize$3(input, existing, path, luvio, store, timestamp) {
124
+ const RepresentationType$2 = 'CopilotBotInfoRepresentation';
125
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
146
126
  return input;
147
127
  }
148
- const select$a = function CopilotBotInfoRepresentationSelect() {
128
+ const select$7 = function CopilotBotInfoRepresentationSelect() {
149
129
  return {
150
130
  kind: 'Fragment',
151
- version: VERSION$7,
131
+ version: VERSION$5,
152
132
  private: [],
153
133
  selections: [
154
134
  {
@@ -168,7 +148,7 @@ const select$a = function CopilotBotInfoRepresentationSelect() {
168
148
  ]
169
149
  };
170
150
  };
171
- function equals$7(existing, incoming) {
151
+ function equals$5(existing, incoming) {
172
152
  const existing_isSuccess = existing.isSuccess;
173
153
  const incoming_isSuccess = incoming.isSuccess;
174
154
  if (!(existing_isSuccess === incoming_isSuccess)) {
@@ -202,44 +182,44 @@ function equals$7(existing, incoming) {
202
182
  }
203
183
  return true;
204
184
  }
205
- const ingest$3 = function CopilotBotInfoRepresentationIngest(input, path, luvio, store, timestamp) {
185
+ const ingest$2 = function CopilotBotInfoRepresentationIngest(input, path, luvio, store, timestamp) {
206
186
  if (process.env.NODE_ENV !== 'production') {
207
- const validateError = validate$8(input);
187
+ const validateError = validate$6(input);
208
188
  if (validateError !== null) {
209
189
  throw validateError;
210
190
  }
211
191
  }
212
192
  const key = path.fullPath;
213
- const ttlToUse = TTL$3;
214
- ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "einstein-copilot-bot", VERSION$7, RepresentationType$3, equals$7);
193
+ const ttlToUse = TTL$2;
194
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "einstein-copilot-bot", VERSION$5, RepresentationType$2, equals$5);
215
195
  return createLink(key);
216
196
  };
217
- function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
197
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
218
198
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
219
199
  const rootKey = fullPathFactory();
220
200
  rootKeySet.set(rootKey, {
221
201
  namespace: keyPrefix,
222
- representationName: RepresentationType$3,
202
+ representationName: RepresentationType$2,
223
203
  mergeable: false
224
204
  });
225
205
  }
226
206
 
227
- function select$9(luvio, params) {
228
- return select$a();
207
+ function select$6(luvio, params) {
208
+ return select$7();
229
209
  }
230
- function keyBuilder$5(luvio, params) {
210
+ function keyBuilder$3(luvio, params) {
231
211
  return keyPrefix + '::CopilotBotInfoRepresentation:(' + ')';
232
212
  }
233
- function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
234
- getTypeCacheKeys$3(storeKeyMap, luvio, response, () => keyBuilder$5());
213
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
214
+ getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$3());
235
215
  }
236
- function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
216
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
237
217
  const { body } = response;
238
- const key = keyBuilder$5();
239
- luvio.storeIngest(key, ingest$3, body);
218
+ const key = keyBuilder$3();
219
+ luvio.storeIngest(key, ingest$2, body);
240
220
  const snapshot = luvio.storeLookup({
241
221
  recordId: key,
242
- node: select$9(),
222
+ node: select$6(),
243
223
  variables: {},
244
224
  }, snapshotRefresh);
245
225
  if (process.env.NODE_ENV !== 'production') {
@@ -250,19 +230,19 @@ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
250
230
  deepFreeze(snapshot.data);
251
231
  return snapshot;
252
232
  }
253
- function ingestError$1(luvio, params, error, snapshotRefresh) {
254
- const key = keyBuilder$5();
233
+ function ingestError(luvio, params, error, snapshotRefresh) {
234
+ const key = keyBuilder$3();
255
235
  const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
256
236
  const storeMetadataParams = {
257
- ttl: TTL$3,
237
+ ttl: TTL$2,
258
238
  namespace: keyPrefix,
259
- version: VERSION$7,
260
- representationName: RepresentationType$3
239
+ version: VERSION$5,
240
+ representationName: RepresentationType$2
261
241
  };
262
242
  luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
263
243
  return errorSnapshot;
264
244
  }
265
- function createResourceRequest$2(config) {
245
+ function createResourceRequest$1(config) {
266
246
  const headers = {};
267
247
  return {
268
248
  baseUri: '/services/data/v60.0',
@@ -276,91 +256,91 @@ function createResourceRequest$2(config) {
276
256
  };
277
257
  }
278
258
 
279
- const adapterName$2 = 'getBotId';
259
+ const adapterName$1 = 'getBotId';
280
260
  const getBotId_ConfigPropertyMetadata = [];
281
- const getBotId_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getBotId_ConfigPropertyMetadata);
282
- const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(getBotId_ConfigPropertyMetadata);
283
- function keyBuilder$4(luvio, config) {
284
- createResourceParams$2(config);
285
- return keyBuilder$5();
261
+ const getBotId_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getBotId_ConfigPropertyMetadata);
262
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$2(getBotId_ConfigPropertyMetadata);
263
+ function keyBuilder$2(luvio, config) {
264
+ createResourceParams$1(config);
265
+ return keyBuilder$3();
286
266
  }
287
- function typeCheckConfig$2(untrustedConfig) {
267
+ function typeCheckConfig$1(untrustedConfig) {
288
268
  const config = {};
289
269
  return config;
290
270
  }
291
- function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
271
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
292
272
  if (!untrustedIsObject(untrustedConfig)) {
293
273
  return null;
294
274
  }
295
275
  if (process.env.NODE_ENV !== 'production') {
296
276
  validateConfig(untrustedConfig, configPropertyNames);
297
277
  }
298
- const config = typeCheckConfig$2();
278
+ const config = typeCheckConfig$1();
299
279
  if (!areRequiredParametersPresent(config, configPropertyNames)) {
300
280
  return null;
301
281
  }
302
282
  return config;
303
283
  }
304
- function adapterFragment$1(luvio, config) {
305
- createResourceParams$2(config);
306
- return select$9();
284
+ function adapterFragment(luvio, config) {
285
+ createResourceParams$1(config);
286
+ return select$6();
307
287
  }
308
- function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
309
- const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
288
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
289
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
310
290
  config,
311
- resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
291
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
312
292
  });
313
293
  return luvio.storeBroadcast().then(() => snapshot);
314
294
  }
315
- function onFetchResponseError$1(luvio, config, resourceParams, response) {
316
- const snapshot = ingestError$1(luvio, resourceParams, response, {
295
+ function onFetchResponseError(luvio, config, resourceParams, response) {
296
+ const snapshot = ingestError(luvio, resourceParams, response, {
317
297
  config,
318
- resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
298
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
319
299
  });
320
300
  return luvio.storeBroadcast().then(() => snapshot);
321
301
  }
322
- function buildNetworkSnapshot$2(luvio, config, options) {
323
- const resourceParams = createResourceParams$2(config);
324
- const request = createResourceRequest$2();
302
+ function buildNetworkSnapshot$1(luvio, config, options) {
303
+ const resourceParams = createResourceParams$1(config);
304
+ const request = createResourceRequest$1();
325
305
  return luvio.dispatchResourceRequest(request, options)
326
306
  .then((response) => {
327
- return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
307
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
328
308
  const cache = new StoreKeyMap();
329
- getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
309
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
330
310
  return cache;
331
311
  });
332
312
  }, (response) => {
333
- return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
313
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
334
314
  });
335
315
  }
336
- function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
337
- return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
316
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
317
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
338
318
  }
339
- function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
319
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
340
320
  const { luvio, config } = context;
341
321
  const selector = {
342
- recordId: keyBuilder$4(luvio, config),
343
- node: adapterFragment$1(luvio, config),
322
+ recordId: keyBuilder$2(luvio, config),
323
+ node: adapterFragment(luvio, config),
344
324
  variables: {},
345
325
  };
346
326
  const cacheSnapshot = storeLookup(selector, {
347
327
  config,
348
- resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
328
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
349
329
  });
350
330
  return cacheSnapshot;
351
331
  }
352
332
  const getBotIdAdapterFactory = (luvio) => function einsteinCopilotBot__getBotId(untrustedConfig, requestContext) {
353
- const config = validateAdapterConfig$2(untrustedConfig, getBotId_ConfigPropertyNames);
333
+ const config = validateAdapterConfig$1(untrustedConfig, getBotId_ConfigPropertyNames);
354
334
  // Invalid or incomplete config
355
335
  if (config === null) {
356
336
  return null;
357
337
  }
358
338
  return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
359
- buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
339
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
360
340
  };
361
341
 
362
- const VERSION$6 = "62bc08357d634ed38883e4b936473a49";
363
- function validate$7(obj, path = 'EsTypeMessageRepresentation') {
342
+ const VERSION$4 = "62bc08357d634ed38883e4b936473a49";
343
+ function validate$5(obj, path = 'EsTypeMessageRepresentation') {
364
344
  const v_error = (() => {
365
345
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
366
346
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -404,10 +384,10 @@ function validate$7(obj, path = 'EsTypeMessageRepresentation') {
404
384
  })();
405
385
  return v_error === undefined ? null : v_error;
406
386
  }
407
- const select$8 = function EsTypeMessageRepresentationSelect() {
387
+ const select$5 = function EsTypeMessageRepresentationSelect() {
408
388
  return {
409
389
  kind: 'Fragment',
410
- version: VERSION$6,
390
+ version: VERSION$4,
411
391
  private: [],
412
392
  selections: [
413
393
  {
@@ -426,7 +406,7 @@ const select$8 = function EsTypeMessageRepresentationSelect() {
426
406
  ]
427
407
  };
428
408
  };
429
- function equals$6(existing, incoming) {
409
+ function equals$4(existing, incoming) {
430
410
  const existing_type = existing.type;
431
411
  const incoming_type = incoming.type;
432
412
  if (!(existing_type === incoming_type)) {
@@ -445,7 +425,7 @@ function equals$6(existing, incoming) {
445
425
  return true;
446
426
  }
447
427
 
448
- function validate$6(obj, path = 'VariableRepresentation') {
428
+ function validate$4(obj, path = 'VariableRepresentation') {
449
429
  const v_error = (() => {
450
430
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
451
431
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -455,19 +435,17 @@ function validate$6(obj, path = 'VariableRepresentation') {
455
435
  if (typeof obj_name !== 'string') {
456
436
  return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
457
437
  }
458
- if (obj.value !== undefined) {
459
- const obj_value = obj.value;
460
- const path_value = path + '.value';
461
- if (typeof obj_value !== 'string') {
462
- return new TypeError('Expected "string" but received "' + typeof obj_value + '" (at "' + path_value + '")');
463
- }
438
+ const obj_value = obj.value;
439
+ const path_value = path + '.value';
440
+ if (typeof obj_value !== 'string') {
441
+ return new TypeError('Expected "string" but received "' + typeof obj_value + '" (at "' + path_value + '")');
464
442
  }
465
443
  })();
466
444
  return v_error === undefined ? null : v_error;
467
445
  }
468
446
 
469
- const VERSION$5 = "4e28b61c3ea362f1c68b28897784111e";
470
- function validate$5(obj, path = 'ConversationRuntimeProxyChoiceRepresentation') {
447
+ const VERSION$3 = "4e28b61c3ea362f1c68b28897784111e";
448
+ function validate$3(obj, path = 'ConversationRuntimeProxyChoiceRepresentation') {
471
449
  const v_error = (() => {
472
450
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
473
451
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -485,10 +463,10 @@ function validate$5(obj, path = 'ConversationRuntimeProxyChoiceRepresentation')
485
463
  })();
486
464
  return v_error === undefined ? null : v_error;
487
465
  }
488
- const select$7 = function ConversationRuntimeProxyChoiceRepresentationSelect() {
466
+ const select$4 = function ConversationRuntimeProxyChoiceRepresentationSelect() {
489
467
  return {
490
468
  kind: 'Fragment',
491
- version: VERSION$5,
469
+ version: VERSION$3,
492
470
  private: [],
493
471
  selections: [
494
472
  {
@@ -502,7 +480,7 @@ const select$7 = function ConversationRuntimeProxyChoiceRepresentationSelect() {
502
480
  ]
503
481
  };
504
482
  };
505
- function equals$5(existing, incoming) {
483
+ function equals$3(existing, incoming) {
506
484
  const existing_alias = existing.alias;
507
485
  const incoming_alias = incoming.alias;
508
486
  if (!(existing_alias === incoming_alias)) {
@@ -516,15 +494,15 @@ function equals$5(existing, incoming) {
516
494
  return true;
517
495
  }
518
496
 
519
- const VERSION$4 = "301ceee5b86e4e56526252efbbf70520";
520
- function validate$4(obj, path = 'CollectMessageRepresentation') {
497
+ const VERSION$2 = "301ceee5b86e4e56526252efbbf70520";
498
+ function validate$2(obj, path = 'CollectMessageRepresentation') {
521
499
  const v_error = (() => {
522
500
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
523
501
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
524
502
  }
525
503
  const obj_data = obj.data;
526
504
  const path_data = path + '.data';
527
- const referencepath_dataValidationError = validate$7(obj_data, path_data);
505
+ const referencepath_dataValidationError = validate$5(obj_data, path_data);
528
506
  if (referencepath_dataValidationError !== null) {
529
507
  let message = 'Object doesn\'t match EsTypeMessageRepresentation (at "' + path_data + '")\n';
530
508
  message += referencepath_dataValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -564,11 +542,11 @@ function validate$4(obj, path = 'CollectMessageRepresentation') {
564
542
  })();
565
543
  return v_error === undefined ? null : v_error;
566
544
  }
567
- const select$6 = function CollectMessageRepresentationSelect() {
568
- const { selections: EsTypeMessageRepresentation__selections, opaque: EsTypeMessageRepresentation__opaque, } = select$8();
545
+ const select$3 = function CollectMessageRepresentationSelect() {
546
+ const { selections: EsTypeMessageRepresentation__selections, opaque: EsTypeMessageRepresentation__opaque, } = select$5();
569
547
  return {
570
548
  kind: 'Fragment',
571
- version: VERSION$4,
549
+ version: VERSION$2,
572
550
  private: [],
573
551
  selections: [
574
552
  {
@@ -587,7 +565,7 @@ const select$6 = function CollectMessageRepresentationSelect() {
587
565
  ]
588
566
  };
589
567
  };
590
- function equals$4(existing, incoming) {
568
+ function equals$2(existing, incoming) {
591
569
  const existing_targetType = existing.targetType;
592
570
  const incoming_targetType = incoming.targetType;
593
571
  if (!(existing_targetType === incoming_targetType)) {
@@ -595,7 +573,7 @@ function equals$4(existing, incoming) {
595
573
  }
596
574
  const existing_data = existing.data;
597
575
  const incoming_data = incoming.data;
598
- if (!(equals$6(existing_data, incoming_data))) {
576
+ if (!(equals$4(existing_data, incoming_data))) {
599
577
  return false;
600
578
  }
601
579
  const existing_targetProperty = existing.targetProperty;
@@ -606,9 +584,9 @@ function equals$4(existing, incoming) {
606
584
  return true;
607
585
  }
608
586
 
609
- const TTL$2 = 30000;
610
- const VERSION$3 = "d3d34b56efe68a37c173d0cb91c57ba1";
611
- function validate$3(obj, path = 'ConversationRuntimeProxyMessageRepresentation') {
587
+ const TTL$1 = 30000;
588
+ const VERSION$1 = "d3d34b56efe68a37c173d0cb91c57ba1";
589
+ function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation') {
612
590
  const v_error = (() => {
613
591
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
614
592
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -622,7 +600,7 @@ function validate$3(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
622
600
  for (let i = 0; i < obj_choices.length; i++) {
623
601
  const obj_choices_item = obj_choices[i];
624
602
  const path_choices_item = path_choices + '[' + i + ']';
625
- const referencepath_choices_itemValidationError = validate$5(obj_choices_item, path_choices_item);
603
+ const referencepath_choices_itemValidationError = validate$3(obj_choices_item, path_choices_item);
626
604
  if (referencepath_choices_itemValidationError !== null) {
627
605
  let message = 'Object doesn\'t match ConversationRuntimeProxyChoiceRepresentation (at "' + path_choices_item + '")\n';
628
606
  message += referencepath_choices_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -639,7 +617,7 @@ function validate$3(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
639
617
  for (let i = 0; i < obj_collect.length; i++) {
640
618
  const obj_collect_item = obj_collect[i];
641
619
  const path_collect_item = path_collect + '[' + i + ']';
642
- const referencepath_collect_itemValidationError = validate$4(obj_collect_item, path_collect_item);
620
+ const referencepath_collect_itemValidationError = validate$2(obj_collect_item, path_collect_item);
643
621
  if (referencepath_collect_itemValidationError !== null) {
644
622
  let message = 'Object doesn\'t match CollectMessageRepresentation (at "' + path_collect_item + '")\n';
645
623
  message += referencepath_collect_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -656,7 +634,7 @@ function validate$3(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
656
634
  for (let i = 0; i < obj_confirm.length; i++) {
657
635
  const obj_confirm_item = obj_confirm[i];
658
636
  const path_confirm_item = path_confirm + '[' + i + ']';
659
- const referencepath_confirm_itemValidationError = validate$7(obj_confirm_item, path_confirm_item);
637
+ const referencepath_confirm_itemValidationError = validate$5(obj_confirm_item, path_confirm_item);
660
638
  if (referencepath_confirm_itemValidationError !== null) {
661
639
  let message = 'Object doesn\'t match EsTypeMessageRepresentation (at "' + path_confirm_item + '")\n';
662
640
  message += referencepath_confirm_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -828,7 +806,7 @@ function validate$3(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
828
806
  for (let i = 0; i < obj_result.length; i++) {
829
807
  const obj_result_item = obj_result[i];
830
808
  const path_result_item = path_result + '[' + i + ']';
831
- const referencepath_result_itemValidationError = validate$7(obj_result_item, path_result_item);
809
+ const referencepath_result_itemValidationError = validate$5(obj_result_item, path_result_item);
832
810
  if (referencepath_result_itemValidationError !== null) {
833
811
  let message = 'Object doesn\'t match EsTypeMessageRepresentation (at "' + path_result_item + '")\n';
834
812
  message += referencepath_result_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -902,26 +880,26 @@ function validate$3(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
902
880
  })();
903
881
  return v_error === undefined ? null : v_error;
904
882
  }
905
- const RepresentationType$2 = 'ConversationRuntimeProxyMessageRepresentation';
906
- function keyBuilder$3(luvio, config) {
907
- return keyPrefix + '::' + RepresentationType$2 + ':' + config.id;
883
+ const RepresentationType$1 = 'ConversationRuntimeProxyMessageRepresentation';
884
+ function keyBuilder$1(luvio, config) {
885
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.id;
908
886
  }
909
887
  function keyBuilderFromType$1(luvio, object) {
910
888
  const keyParams = {
911
889
  id: object.id
912
890
  };
913
- return keyBuilder$3(luvio, keyParams);
891
+ return keyBuilder$1(luvio, keyParams);
914
892
  }
915
- function normalize$2(input, existing, path, luvio, store, timestamp) {
893
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
916
894
  return input;
917
895
  }
918
- const select$5 = function ConversationRuntimeProxyMessageRepresentationSelect() {
919
- const { selections: ConversationRuntimeProxyChoiceRepresentation__selections, opaque: ConversationRuntimeProxyChoiceRepresentation__opaque, } = select$7();
920
- const { selections: CollectMessageRepresentation__selections, opaque: CollectMessageRepresentation__opaque, } = select$6();
921
- const { selections: EsTypeMessageRepresentation__selections, opaque: EsTypeMessageRepresentation__opaque, } = select$8();
896
+ const select$2 = function ConversationRuntimeProxyMessageRepresentationSelect() {
897
+ const { selections: ConversationRuntimeProxyChoiceRepresentation__selections, opaque: ConversationRuntimeProxyChoiceRepresentation__opaque, } = select$4();
898
+ const { selections: CollectMessageRepresentation__selections, opaque: CollectMessageRepresentation__opaque, } = select$3();
899
+ const { selections: EsTypeMessageRepresentation__selections, opaque: EsTypeMessageRepresentation__opaque, } = select$5();
922
900
  return {
923
901
  kind: 'Fragment',
924
- version: VERSION$3,
902
+ version: VERSION$1,
925
903
  private: [],
926
904
  selections: [
927
905
  {
@@ -1003,7 +981,7 @@ const select$5 = function ConversationRuntimeProxyMessageRepresentationSelect()
1003
981
  ]
1004
982
  };
1005
983
  };
1006
- function equals$3(existing, incoming) {
984
+ function equals$1(existing, incoming) {
1007
985
  const existing_id = existing.id;
1008
986
  const incoming_id = incoming.id;
1009
987
  if (!(existing_id === incoming_id)) {
@@ -1032,7 +1010,7 @@ function equals$3(existing, incoming) {
1032
1010
  return false;
1033
1011
  }
1034
1012
  const equals_choices_items = equalsArray(existing_choices, incoming_choices, (existing_choices_item, incoming_choices_item) => {
1035
- if (!(equals$5(existing_choices_item, incoming_choices_item))) {
1013
+ if (!(equals$3(existing_choices_item, incoming_choices_item))) {
1036
1014
  return false;
1037
1015
  }
1038
1016
  });
@@ -1050,7 +1028,7 @@ function equals$3(existing, incoming) {
1050
1028
  return false;
1051
1029
  }
1052
1030
  const equals_collect_items = equalsArray(existing_collect, incoming_collect, (existing_collect_item, incoming_collect_item) => {
1053
- if (!(equals$4(existing_collect_item, incoming_collect_item))) {
1031
+ if (!(equals$2(existing_collect_item, incoming_collect_item))) {
1054
1032
  return false;
1055
1033
  }
1056
1034
  });
@@ -1068,7 +1046,7 @@ function equals$3(existing, incoming) {
1068
1046
  return false;
1069
1047
  }
1070
1048
  const equals_confirm_items = equalsArray(existing_confirm, incoming_confirm, (existing_confirm_item, incoming_confirm_item) => {
1071
- if (!(equals$6(existing_confirm_item, incoming_confirm_item))) {
1049
+ if (!(equals$4(existing_confirm_item, incoming_confirm_item))) {
1072
1050
  return false;
1073
1051
  }
1074
1052
  });
@@ -1153,7 +1131,7 @@ function equals$3(existing, incoming) {
1153
1131
  return false;
1154
1132
  }
1155
1133
  const equals_result_items = equalsArray(existing_result, incoming_result, (existing_result_item, incoming_result_item) => {
1156
- if (!(equals$6(existing_result_item, incoming_result_item))) {
1134
+ if (!(equals$4(existing_result_item, incoming_result_item))) {
1157
1135
  return false;
1158
1136
  }
1159
1137
  });
@@ -1189,31 +1167,31 @@ function equals$3(existing, incoming) {
1189
1167
  }
1190
1168
  return true;
1191
1169
  }
1192
- const ingest$2 = function ConversationRuntimeProxyMessageRepresentationIngest(input, path, luvio, store, timestamp) {
1170
+ const ingest$1 = function ConversationRuntimeProxyMessageRepresentationIngest(input, path, luvio, store, timestamp) {
1193
1171
  if (process.env.NODE_ENV !== 'production') {
1194
- const validateError = validate$3(input);
1172
+ const validateError = validate$1(input);
1195
1173
  if (validateError !== null) {
1196
1174
  throw validateError;
1197
1175
  }
1198
1176
  }
1199
1177
  const key = keyBuilderFromType$1(luvio, input);
1200
- const ttlToUse = TTL$2;
1201
- ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "einstein-copilot-bot", VERSION$3, RepresentationType$2, equals$3);
1178
+ const ttlToUse = TTL$1;
1179
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "einstein-copilot-bot", VERSION$1, RepresentationType$1, equals$1);
1202
1180
  return createLink(key);
1203
1181
  };
1204
- function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
1182
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
1205
1183
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1206
1184
  const rootKey = keyBuilderFromType$1(luvio, input);
1207
1185
  rootKeySet.set(rootKey, {
1208
1186
  namespace: keyPrefix,
1209
- representationName: RepresentationType$2,
1187
+ representationName: RepresentationType$1,
1210
1188
  mergeable: false
1211
1189
  });
1212
1190
  }
1213
1191
 
1214
- const TTL$1 = 30000;
1215
- const VERSION$2 = "fe7024fb1132250f97d9616482f09f99";
1216
- function validate$2(obj, path = 'ConversationRuntimeProxyRepresentation') {
1192
+ const TTL = 30000;
1193
+ const VERSION = "fe7024fb1132250f97d9616482f09f99";
1194
+ function validate(obj, path = 'ConversationRuntimeProxyRepresentation') {
1217
1195
  const v_error = (() => {
1218
1196
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1219
1197
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -1265,23 +1243,23 @@ function validate$2(obj, path = 'ConversationRuntimeProxyRepresentation') {
1265
1243
  })();
1266
1244
  return v_error === undefined ? null : v_error;
1267
1245
  }
1268
- const RepresentationType$1 = 'ConversationRuntimeProxyRepresentation';
1269
- function keyBuilder$2(luvio, config) {
1270
- return keyPrefix + '::' + RepresentationType$1 + ':' + config.id;
1246
+ const RepresentationType = 'ConversationRuntimeProxyRepresentation';
1247
+ function keyBuilder(luvio, config) {
1248
+ return keyPrefix + '::' + RepresentationType + ':' + config.id;
1271
1249
  }
1272
1250
  function keyBuilderFromType(luvio, object) {
1273
1251
  const keyParams = {
1274
1252
  id: object.requestId
1275
1253
  };
1276
- return keyBuilder$2(luvio, keyParams);
1254
+ return keyBuilder(luvio, keyParams);
1277
1255
  }
1278
- function normalize$1(input, existing, path, luvio, store, timestamp) {
1256
+ function normalize(input, existing, path, luvio, store, timestamp) {
1279
1257
  const input_messages = input.messages;
1280
1258
  const input_messages_id = path.fullPath + '__messages';
1281
1259
  for (let i = 0; i < input_messages.length; i++) {
1282
1260
  const input_messages_item = input_messages[i];
1283
1261
  let input_messages_item_id = input_messages_id + '__' + i;
1284
- input_messages[i] = ingest$2(input_messages_item, {
1262
+ input_messages[i] = ingest$1(input_messages_item, {
1285
1263
  fullPath: input_messages_item_id,
1286
1264
  propertyName: i,
1287
1265
  parent: {
@@ -1294,10 +1272,10 @@ function normalize$1(input, existing, path, luvio, store, timestamp) {
1294
1272
  }
1295
1273
  return input;
1296
1274
  }
1297
- const select$4 = function ConversationRuntimeProxyRepresentationSelect() {
1275
+ const select$1 = function ConversationRuntimeProxyRepresentationSelect() {
1298
1276
  return {
1299
1277
  kind: 'Fragment',
1300
- version: VERSION$2,
1278
+ version: VERSION,
1301
1279
  private: [],
1302
1280
  selections: [
1303
1281
  {
@@ -1312,7 +1290,7 @@ const select$4 = function ConversationRuntimeProxyRepresentationSelect() {
1312
1290
  name: 'messages',
1313
1291
  kind: 'Link',
1314
1292
  plural: true,
1315
- fragment: select$5()
1293
+ fragment: select$2()
1316
1294
  },
1317
1295
  {
1318
1296
  name: 'processedSequenceIds',
@@ -1330,7 +1308,7 @@ const select$4 = function ConversationRuntimeProxyRepresentationSelect() {
1330
1308
  ]
1331
1309
  };
1332
1310
  };
1333
- function equals$2(existing, incoming) {
1311
+ function equals(existing, incoming) {
1334
1312
  const existing_botId = existing.botId;
1335
1313
  const incoming_botId = incoming.botId;
1336
1314
  if (!(existing_botId === incoming_botId)) {
@@ -1373,45 +1351,45 @@ function equals$2(existing, incoming) {
1373
1351
  }
1374
1352
  return true;
1375
1353
  }
1376
- const ingest$1 = function ConversationRuntimeProxyRepresentationIngest(input, path, luvio, store, timestamp) {
1354
+ const ingest = function ConversationRuntimeProxyRepresentationIngest(input, path, luvio, store, timestamp) {
1377
1355
  if (process.env.NODE_ENV !== 'production') {
1378
- const validateError = validate$2(input);
1356
+ const validateError = validate(input);
1379
1357
  if (validateError !== null) {
1380
1358
  throw validateError;
1381
1359
  }
1382
1360
  }
1383
1361
  const key = keyBuilderFromType(luvio, input);
1384
- const ttlToUse = TTL$1;
1385
- ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "einstein-copilot-bot", VERSION$2, RepresentationType$1, equals$2);
1362
+ const ttlToUse = TTL;
1363
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "einstein-copilot-bot", VERSION, RepresentationType, equals);
1386
1364
  return createLink(key);
1387
1365
  };
1388
- function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
1366
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
1389
1367
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1390
1368
  const rootKey = keyBuilderFromType(luvio, input);
1391
1369
  rootKeySet.set(rootKey, {
1392
1370
  namespace: keyPrefix,
1393
- representationName: RepresentationType$1,
1371
+ representationName: RepresentationType,
1394
1372
  mergeable: false
1395
1373
  });
1396
1374
  const input_messages_length = input.messages.length;
1397
1375
  for (let i = 0; i < input_messages_length; i++) {
1398
- getTypeCacheKeys$2(rootKeySet, luvio, input.messages[i]);
1376
+ getTypeCacheKeys$1(rootKeySet, luvio, input.messages[i]);
1399
1377
  }
1400
1378
  }
1401
1379
 
1402
- function select$3(luvio, params) {
1403
- return select$4();
1380
+ function select(luvio, params) {
1381
+ return select$1();
1404
1382
  }
1405
- function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
1406
- getTypeCacheKeys$1(storeKeyMap, luvio, response);
1383
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
1384
+ getTypeCacheKeys(storeKeyMap, luvio, response);
1407
1385
  }
1408
- function ingestSuccess$1(luvio, resourceParams, response) {
1386
+ function ingestSuccess(luvio, resourceParams, response) {
1409
1387
  const { body } = response;
1410
1388
  const key = keyBuilderFromType(luvio, body);
1411
- luvio.storeIngest(key, ingest$1, body);
1389
+ luvio.storeIngest(key, ingest, body);
1412
1390
  const snapshot = luvio.storeLookup({
1413
1391
  recordId: key,
1414
- node: select$3(),
1392
+ node: select(),
1415
1393
  variables: {},
1416
1394
  });
1417
1395
  if (process.env.NODE_ENV !== 'production') {
@@ -1422,7 +1400,7 @@ function ingestSuccess$1(luvio, resourceParams, response) {
1422
1400
  deepFreeze(snapshot.data);
1423
1401
  return snapshot;
1424
1402
  }
1425
- function createResourceRequest$1(config) {
1403
+ function createResourceRequest(config) {
1426
1404
  const headers = {};
1427
1405
  return {
1428
1406
  baseUri: '/services/data/v60.0',
@@ -1436,36 +1414,30 @@ function createResourceRequest$1(config) {
1436
1414
  };
1437
1415
  }
1438
1416
 
1439
- const adapterName$1 = 'sendMessage';
1417
+ const adapterName = 'sendMessage';
1440
1418
  const sendMessage_ConfigPropertyMetadata = [
1441
1419
  generateParamConfigMetadata('botId', false, 1 /* QueryParameter */, 0 /* String */),
1442
1420
  generateParamConfigMetadata('botVersionId', false, 1 /* QueryParameter */, 0 /* String */),
1443
1421
  generateParamConfigMetadata('message', false, 1 /* QueryParameter */, 0 /* String */),
1444
1422
  generateParamConfigMetadata('sessionId', false, 1 /* QueryParameter */, 0 /* String */),
1445
1423
  generateParamConfigMetadata('inReplyToMessageId', false, 2 /* Body */, 0 /* String */),
1446
- generateParamConfigMetadata('intent', false, 2 /* Body */, 0 /* String */),
1447
1424
  generateParamConfigMetadata('messageType', false, 2 /* Body */, 0 /* String */),
1448
- generateParamConfigMetadata('planId', false, 2 /* Body */, 0 /* String */),
1449
- generateParamConfigMetadata('planTemplateVariables', false, 2 /* Body */, 4 /* Unsupported */),
1450
1425
  generateParamConfigMetadata('reply', false, 2 /* Body */, 4 /* Unsupported */, true),
1451
1426
  generateParamConfigMetadata('text', false, 2 /* Body */, 0 /* String */),
1452
1427
  generateParamConfigMetadata('type', false, 2 /* Body */, 0 /* String */),
1453
- generateParamConfigMetadata('userUtterance', false, 2 /* Body */, 0 /* String */),
1454
1428
  generateParamConfigMetadata('variables', false, 2 /* Body */, 4 /* Unsupported */, true),
1455
1429
  ];
1456
- const sendMessage_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, sendMessage_ConfigPropertyMetadata);
1457
- const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(sendMessage_ConfigPropertyMetadata);
1458
- function typeCheckConfig$1(untrustedConfig) {
1430
+ const sendMessage_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, sendMessage_ConfigPropertyMetadata);
1431
+ const createResourceParams = /*#__PURE__*/ createResourceParams$2(sendMessage_ConfigPropertyMetadata);
1432
+ function typeCheckConfig(untrustedConfig) {
1459
1433
  const config = {};
1460
- typeCheckConfig$3(untrustedConfig, config, sendMessage_ConfigPropertyMetadata);
1461
- const untrustedConfig_planTemplateVariables = untrustedConfig.planTemplateVariables;
1462
- config.planTemplateVariables = untrustedConfig_planTemplateVariables;
1434
+ typeCheckConfig$2(untrustedConfig, config, sendMessage_ConfigPropertyMetadata);
1463
1435
  const untrustedConfig_reply = untrustedConfig.reply;
1464
1436
  if (ArrayIsArray$1(untrustedConfig_reply)) {
1465
1437
  const untrustedConfig_reply_array = [];
1466
1438
  for (let i = 0, arrayLength = untrustedConfig_reply.length; i < arrayLength; i++) {
1467
1439
  const untrustedConfig_reply_item = untrustedConfig_reply[i];
1468
- const referenceEsTypeMessageRepresentationValidationError = validate$7(untrustedConfig_reply_item);
1440
+ const referenceEsTypeMessageRepresentationValidationError = validate$5(untrustedConfig_reply_item);
1469
1441
  if (referenceEsTypeMessageRepresentationValidationError === null) {
1470
1442
  untrustedConfig_reply_array.push(untrustedConfig_reply_item);
1471
1443
  }
@@ -1477,7 +1449,7 @@ function typeCheckConfig$1(untrustedConfig) {
1477
1449
  const untrustedConfig_variables_array = [];
1478
1450
  for (let i = 0, arrayLength = untrustedConfig_variables.length; i < arrayLength; i++) {
1479
1451
  const untrustedConfig_variables_item = untrustedConfig_variables[i];
1480
- const referenceVariableRepresentationValidationError = validate$6(untrustedConfig_variables_item);
1452
+ const referenceVariableRepresentationValidationError = validate$4(untrustedConfig_variables_item);
1481
1453
  if (referenceVariableRepresentationValidationError === null) {
1482
1454
  untrustedConfig_variables_array.push(untrustedConfig_variables_item);
1483
1455
  }
@@ -1486,30 +1458,30 @@ function typeCheckConfig$1(untrustedConfig) {
1486
1458
  }
1487
1459
  return config;
1488
1460
  }
1489
- function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
1461
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
1490
1462
  if (!untrustedIsObject(untrustedConfig)) {
1491
1463
  return null;
1492
1464
  }
1493
1465
  if (process.env.NODE_ENV !== 'production') {
1494
1466
  validateConfig(untrustedConfig, configPropertyNames);
1495
1467
  }
1496
- const config = typeCheckConfig$1(untrustedConfig);
1468
+ const config = typeCheckConfig(untrustedConfig);
1497
1469
  if (!areRequiredParametersPresent(config, configPropertyNames)) {
1498
1470
  return null;
1499
1471
  }
1500
1472
  return config;
1501
1473
  }
1502
- function buildNetworkSnapshot$1(luvio, config, options) {
1503
- const resourceParams = createResourceParams$1(config);
1504
- const request = createResourceRequest$1(resourceParams);
1474
+ function buildNetworkSnapshot(luvio, config, options) {
1475
+ const resourceParams = createResourceParams(config);
1476
+ const request = createResourceRequest(resourceParams);
1505
1477
  return luvio.dispatchResourceRequest(request, options)
1506
1478
  .then((response) => {
1507
1479
  return luvio.handleSuccessResponse(() => {
1508
- const snapshot = ingestSuccess$1(luvio, resourceParams, response);
1480
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
1509
1481
  return luvio.storeBroadcast().then(() => snapshot);
1510
1482
  }, () => {
1511
1483
  const cache = new StoreKeyMap();
1512
- getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
1484
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
1513
1485
  return cache;
1514
1486
  });
1515
1487
  }, (response) => {
@@ -1519,378 +1491,13 @@ function buildNetworkSnapshot$1(luvio, config, options) {
1519
1491
  }
1520
1492
  const sendMessageAdapterFactory = (luvio) => {
1521
1493
  return function sendMessage(untrustedConfig) {
1522
- const config = validateAdapterConfig$1(untrustedConfig, sendMessage_ConfigPropertyNames);
1494
+ const config = validateAdapterConfig(untrustedConfig, sendMessage_ConfigPropertyNames);
1523
1495
  // Invalid or incomplete config
1524
1496
  if (config === null) {
1525
1497
  throw new Error('Invalid config for "sendMessage"');
1526
1498
  }
1527
- return buildNetworkSnapshot$1(luvio, config);
1499
+ return buildNetworkSnapshot(luvio, config);
1528
1500
  };
1529
1501
  };
1530
1502
 
1531
- const VERSION$1 = "504437088c2317480c651ac05a7565b5";
1532
- function validate$1(obj, path = 'PlanTemplateRepresentation') {
1533
- const v_error = (() => {
1534
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1535
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1536
- }
1537
- const obj_intent = obj.intent;
1538
- const path_intent = path + '.intent';
1539
- if (typeof obj_intent !== 'string') {
1540
- return new TypeError('Expected "string" but received "' + typeof obj_intent + '" (at "' + path_intent + '")');
1541
- }
1542
- const obj_label = obj.label;
1543
- const path_label = path + '.label';
1544
- if (typeof obj_label !== 'string') {
1545
- return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
1546
- }
1547
- const obj_planTemplateId = obj.planTemplateId;
1548
- const path_planTemplateId = path + '.planTemplateId';
1549
- if (typeof obj_planTemplateId !== 'string') {
1550
- return new TypeError('Expected "string" but received "' + typeof obj_planTemplateId + '" (at "' + path_planTemplateId + '")');
1551
- }
1552
- const obj_userUtterance = obj.userUtterance;
1553
- const path_userUtterance = path + '.userUtterance';
1554
- if (typeof obj_userUtterance !== 'string') {
1555
- return new TypeError('Expected "string" but received "' + typeof obj_userUtterance + '" (at "' + path_userUtterance + '")');
1556
- }
1557
- const obj_variables = obj.variables;
1558
- const path_variables = path + '.variables';
1559
- if (typeof obj_variables !== 'object' || ArrayIsArray(obj_variables) || obj_variables === null) {
1560
- return new TypeError('Expected "object" but received "' + typeof obj_variables + '" (at "' + path_variables + '")');
1561
- }
1562
- const obj_variables_keys = ObjectKeys(obj_variables);
1563
- for (let i = 0; i < obj_variables_keys.length; i++) {
1564
- const key = obj_variables_keys[i];
1565
- const obj_variables_prop = obj_variables[key];
1566
- const path_variables_prop = path_variables + '["' + key + '"]';
1567
- if (typeof obj_variables_prop !== 'string') {
1568
- return new TypeError('Expected "string" but received "' + typeof obj_variables_prop + '" (at "' + path_variables_prop + '")');
1569
- }
1570
- }
1571
- })();
1572
- return v_error === undefined ? null : v_error;
1573
- }
1574
- const select$2 = function PlanTemplateRepresentationSelect() {
1575
- return {
1576
- kind: 'Fragment',
1577
- version: VERSION$1,
1578
- private: [],
1579
- selections: [
1580
- {
1581
- name: 'intent',
1582
- kind: 'Scalar'
1583
- },
1584
- {
1585
- name: 'label',
1586
- kind: 'Scalar'
1587
- },
1588
- {
1589
- name: 'planTemplateId',
1590
- kind: 'Scalar'
1591
- },
1592
- {
1593
- name: 'userUtterance',
1594
- kind: 'Scalar'
1595
- },
1596
- {
1597
- name: 'variables',
1598
- kind: 'Scalar',
1599
- map: true
1600
- }
1601
- ]
1602
- };
1603
- };
1604
- function equals$1(existing, incoming) {
1605
- const existing_intent = existing.intent;
1606
- const incoming_intent = incoming.intent;
1607
- if (!(existing_intent === incoming_intent)) {
1608
- return false;
1609
- }
1610
- const existing_label = existing.label;
1611
- const incoming_label = incoming.label;
1612
- if (!(existing_label === incoming_label)) {
1613
- return false;
1614
- }
1615
- const existing_planTemplateId = existing.planTemplateId;
1616
- const incoming_planTemplateId = incoming.planTemplateId;
1617
- if (!(existing_planTemplateId === incoming_planTemplateId)) {
1618
- return false;
1619
- }
1620
- const existing_userUtterance = existing.userUtterance;
1621
- const incoming_userUtterance = incoming.userUtterance;
1622
- if (!(existing_userUtterance === incoming_userUtterance)) {
1623
- return false;
1624
- }
1625
- const existing_variables = existing.variables;
1626
- const incoming_variables = incoming.variables;
1627
- const equals_variables_props = equalsObject(existing_variables, incoming_variables, (existing_variables_prop, incoming_variables_prop) => {
1628
- if (!(existing_variables_prop === incoming_variables_prop)) {
1629
- return false;
1630
- }
1631
- });
1632
- if (equals_variables_props === false) {
1633
- return false;
1634
- }
1635
- return true;
1636
- }
1637
-
1638
- const TTL = 900000;
1639
- const VERSION = "0503b0c5ce250e7f5fbf16f2d3f2fec4";
1640
- function validate(obj, path = 'RecommendedPlanTemplatesRepresentation') {
1641
- const v_error = (() => {
1642
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1643
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1644
- }
1645
- if (obj.errorMessage !== undefined) {
1646
- const obj_errorMessage = obj.errorMessage;
1647
- const path_errorMessage = path + '.errorMessage';
1648
- if (typeof obj_errorMessage !== 'string') {
1649
- return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
1650
- }
1651
- }
1652
- const obj_isSuccess = obj.isSuccess;
1653
- const path_isSuccess = path + '.isSuccess';
1654
- if (typeof obj_isSuccess !== 'boolean') {
1655
- return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
1656
- }
1657
- const obj_planTemplates = obj.planTemplates;
1658
- const path_planTemplates = path + '.planTemplates';
1659
- if (!ArrayIsArray(obj_planTemplates)) {
1660
- return new TypeError('Expected "array" but received "' + typeof obj_planTemplates + '" (at "' + path_planTemplates + '")');
1661
- }
1662
- for (let i = 0; i < obj_planTemplates.length; i++) {
1663
- const obj_planTemplates_item = obj_planTemplates[i];
1664
- const path_planTemplates_item = path_planTemplates + '[' + i + ']';
1665
- const referencepath_planTemplates_itemValidationError = validate$1(obj_planTemplates_item, path_planTemplates_item);
1666
- if (referencepath_planTemplates_itemValidationError !== null) {
1667
- let message = 'Object doesn\'t match PlanTemplateRepresentation (at "' + path_planTemplates_item + '")\n';
1668
- message += referencepath_planTemplates_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1669
- return new TypeError(message);
1670
- }
1671
- }
1672
- })();
1673
- return v_error === undefined ? null : v_error;
1674
- }
1675
- const RepresentationType = 'RecommendedPlanTemplatesRepresentation';
1676
- function normalize(input, existing, path, luvio, store, timestamp) {
1677
- return input;
1678
- }
1679
- const select$1 = function RecommendedPlanTemplatesRepresentationSelect() {
1680
- const { selections: PlanTemplateRepresentation__selections, opaque: PlanTemplateRepresentation__opaque, } = select$2();
1681
- return {
1682
- kind: 'Fragment',
1683
- version: VERSION,
1684
- private: [],
1685
- selections: [
1686
- {
1687
- name: 'errorMessage',
1688
- kind: 'Scalar',
1689
- required: false
1690
- },
1691
- {
1692
- name: 'isSuccess',
1693
- kind: 'Scalar'
1694
- },
1695
- {
1696
- name: 'planTemplates',
1697
- kind: 'Object',
1698
- plural: true,
1699
- selections: PlanTemplateRepresentation__selections
1700
- }
1701
- ]
1702
- };
1703
- };
1704
- function equals(existing, incoming) {
1705
- const existing_isSuccess = existing.isSuccess;
1706
- const incoming_isSuccess = incoming.isSuccess;
1707
- if (!(existing_isSuccess === incoming_isSuccess)) {
1708
- return false;
1709
- }
1710
- const existing_errorMessage = existing.errorMessage;
1711
- const incoming_errorMessage = incoming.errorMessage;
1712
- // if at least one of these optionals is defined
1713
- if (existing_errorMessage !== undefined || incoming_errorMessage !== undefined) {
1714
- // if one of these is not defined we know the other is defined and therefore
1715
- // not equal
1716
- if (existing_errorMessage === undefined || incoming_errorMessage === undefined) {
1717
- return false;
1718
- }
1719
- if (!(existing_errorMessage === incoming_errorMessage)) {
1720
- return false;
1721
- }
1722
- }
1723
- const existing_planTemplates = existing.planTemplates;
1724
- const incoming_planTemplates = incoming.planTemplates;
1725
- const equals_planTemplates_items = equalsArray(existing_planTemplates, incoming_planTemplates, (existing_planTemplates_item, incoming_planTemplates_item) => {
1726
- if (!(equals$1(existing_planTemplates_item, incoming_planTemplates_item))) {
1727
- return false;
1728
- }
1729
- });
1730
- if (equals_planTemplates_items === false) {
1731
- return false;
1732
- }
1733
- return true;
1734
- }
1735
- const ingest = function RecommendedPlanTemplatesRepresentationIngest(input, path, luvio, store, timestamp) {
1736
- if (process.env.NODE_ENV !== 'production') {
1737
- const validateError = validate(input);
1738
- if (validateError !== null) {
1739
- throw validateError;
1740
- }
1741
- }
1742
- const key = path.fullPath;
1743
- const ttlToUse = TTL;
1744
- ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "einstein-copilot-bot", VERSION, RepresentationType, equals);
1745
- return createLink(key);
1746
- };
1747
- function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
1748
- // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1749
- const rootKey = fullPathFactory();
1750
- rootKeySet.set(rootKey, {
1751
- namespace: keyPrefix,
1752
- representationName: RepresentationType,
1753
- mergeable: false
1754
- });
1755
- }
1756
-
1757
- function select(luvio, params) {
1758
- return select$1();
1759
- }
1760
- function keyBuilder$1(luvio, params) {
1761
- return keyPrefix + '::RecommendedPlanTemplatesRepresentation:(' + 'pageType:' + params.urlParams.pageType + ',' + 'objectType:' + params.urlParams.objectType + ')';
1762
- }
1763
- function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
1764
- getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
1765
- }
1766
- function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
1767
- const { body } = response;
1768
- const key = keyBuilder$1(luvio, resourceParams);
1769
- luvio.storeIngest(key, ingest, body);
1770
- const snapshot = luvio.storeLookup({
1771
- recordId: key,
1772
- node: select(),
1773
- variables: {},
1774
- }, snapshotRefresh);
1775
- if (process.env.NODE_ENV !== 'production') {
1776
- if (snapshot.state !== 'Fulfilled') {
1777
- throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1778
- }
1779
- }
1780
- deepFreeze(snapshot.data);
1781
- return snapshot;
1782
- }
1783
- function ingestError(luvio, params, error, snapshotRefresh) {
1784
- const key = keyBuilder$1(luvio, params);
1785
- const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1786
- const storeMetadataParams = {
1787
- ttl: TTL,
1788
- namespace: keyPrefix,
1789
- version: VERSION,
1790
- representationName: RepresentationType
1791
- };
1792
- luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
1793
- return errorSnapshot;
1794
- }
1795
- function createResourceRequest(config) {
1796
- const headers = {};
1797
- return {
1798
- baseUri: '/services/data/v60.0',
1799
- basePath: '/connect/recommended-plan-templates/' + config.urlParams.pageType + '/' + config.urlParams.objectType + '',
1800
- method: 'get',
1801
- body: null,
1802
- urlParams: config.urlParams,
1803
- queryParams: {},
1804
- headers,
1805
- priority: 'normal',
1806
- };
1807
- }
1808
-
1809
- const adapterName = 'getRecommendedPlanTemplates';
1810
- const getRecommendedPlanTemplates_ConfigPropertyMetadata = [
1811
- generateParamConfigMetadata('pageType', true, 0 /* UrlParameter */, 0 /* String */),
1812
- generateParamConfigMetadata('objectType', true, 0 /* UrlParameter */, 0 /* String */),
1813
- ];
1814
- const getRecommendedPlanTemplates_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getRecommendedPlanTemplates_ConfigPropertyMetadata);
1815
- const createResourceParams = /*#__PURE__*/ createResourceParams$3(getRecommendedPlanTemplates_ConfigPropertyMetadata);
1816
- function keyBuilder(luvio, config) {
1817
- const resourceParams = createResourceParams(config);
1818
- return keyBuilder$1(luvio, resourceParams);
1819
- }
1820
- function typeCheckConfig(untrustedConfig) {
1821
- const config = {};
1822
- typeCheckConfig$3(untrustedConfig, config, getRecommendedPlanTemplates_ConfigPropertyMetadata);
1823
- return config;
1824
- }
1825
- function validateAdapterConfig(untrustedConfig, configPropertyNames) {
1826
- if (!untrustedIsObject(untrustedConfig)) {
1827
- return null;
1828
- }
1829
- if (process.env.NODE_ENV !== 'production') {
1830
- validateConfig(untrustedConfig, configPropertyNames);
1831
- }
1832
- const config = typeCheckConfig(untrustedConfig);
1833
- if (!areRequiredParametersPresent(config, configPropertyNames)) {
1834
- return null;
1835
- }
1836
- return config;
1837
- }
1838
- function adapterFragment(luvio, config) {
1839
- createResourceParams(config);
1840
- return select();
1841
- }
1842
- function onFetchResponseSuccess(luvio, config, resourceParams, response) {
1843
- const snapshot = ingestSuccess(luvio, resourceParams, response, {
1844
- config,
1845
- resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1846
- });
1847
- return luvio.storeBroadcast().then(() => snapshot);
1848
- }
1849
- function onFetchResponseError(luvio, config, resourceParams, response) {
1850
- const snapshot = ingestError(luvio, resourceParams, response, {
1851
- config,
1852
- resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1853
- });
1854
- return luvio.storeBroadcast().then(() => snapshot);
1855
- }
1856
- function buildNetworkSnapshot(luvio, config, options) {
1857
- const resourceParams = createResourceParams(config);
1858
- const request = createResourceRequest(resourceParams);
1859
- return luvio.dispatchResourceRequest(request, options)
1860
- .then((response) => {
1861
- return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
1862
- const cache = new StoreKeyMap();
1863
- getResponseCacheKeys(cache, luvio, resourceParams, response.body);
1864
- return cache;
1865
- });
1866
- }, (response) => {
1867
- return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
1868
- });
1869
- }
1870
- function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
1871
- return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
1872
- }
1873
- function buildCachedSnapshotCachePolicy(context, storeLookup) {
1874
- const { luvio, config } = context;
1875
- const selector = {
1876
- recordId: keyBuilder(luvio, config),
1877
- node: adapterFragment(luvio, config),
1878
- variables: {},
1879
- };
1880
- const cacheSnapshot = storeLookup(selector, {
1881
- config,
1882
- resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1883
- });
1884
- return cacheSnapshot;
1885
- }
1886
- const getRecommendedPlanTemplatesAdapterFactory = (luvio) => function einsteinCopilotBot__getRecommendedPlanTemplates(untrustedConfig, requestContext) {
1887
- const config = validateAdapterConfig(untrustedConfig, getRecommendedPlanTemplates_ConfigPropertyNames);
1888
- // Invalid or incomplete config
1889
- if (config === null) {
1890
- return null;
1891
- }
1892
- return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1893
- buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
1894
- };
1895
-
1896
- export { getBotIdAdapterFactory, getRecommendedPlanTemplatesAdapterFactory, sendMessageAdapterFactory };
1503
+ export { getBotIdAdapterFactory, sendMessageAdapterFactory };