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

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$1, StoreKeyMap, createResourceParams as createResourceParams$2, typeCheckConfig as typeCheckConfig$2 } from '@luvio/engine';
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2, StoreKeyMap, createResourceParams as createResourceParams$3, typeCheckConfig as typeCheckConfig$3 } from '@luvio/engine';
8
8
 
9
9
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
- const { keys: ObjectKeys, create: ObjectCreate } = Object;
10
+ const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
11
11
  const { isArray: ArrayIsArray$1 } = Array;
12
12
  /**
13
13
  * Validates an adapter config is well-formed.
@@ -31,7 +31,7 @@ function validateConfig(config, adapter, oneOf) {
31
31
  throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
32
32
  }
33
33
  const supported = required.concat(optional);
34
- if (ObjectKeys(config).some(key => !supported.includes(key))) {
34
+ if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
35
35
  throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
36
36
  }
37
37
  }
@@ -71,6 +71,7 @@ function buildAdapterValidationConfig(displayName, paramsMeta) {
71
71
  }
72
72
  const keyPrefix = 'einstein-copilot-bot';
73
73
 
74
+ const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
74
75
  const { isArray: ArrayIsArray } = Array;
75
76
  const { stringify: JSONStringify } = JSON;
76
77
  function equalsArray(a, b, equalsItem) {
@@ -86,15 +87,34 @@ function equalsArray(a, b, equalsItem) {
86
87
  }
87
88
  return true;
88
89
  }
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
+ }
89
109
  function createLink(ref) {
90
110
  return {
91
111
  __ref: serializeStructuredKey(ref),
92
112
  };
93
113
  }
94
114
 
95
- const TTL$2 = 30000;
96
- const VERSION$5 = "ab85410a28124cfed3d8eae7b8236853";
97
- function validate$6(obj, path = 'CopilotBotInfoRepresentation') {
115
+ const TTL$3 = 30000;
116
+ const VERSION$7 = "ab85410a28124cfed3d8eae7b8236853";
117
+ function validate$8(obj, path = 'CopilotBotInfoRepresentation') {
98
118
  const v_error = (() => {
99
119
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
100
120
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -121,14 +141,14 @@ function validate$6(obj, path = 'CopilotBotInfoRepresentation') {
121
141
  })();
122
142
  return v_error === undefined ? null : v_error;
123
143
  }
124
- const RepresentationType$2 = 'CopilotBotInfoRepresentation';
125
- function normalize$2(input, existing, path, luvio, store, timestamp) {
144
+ const RepresentationType$3 = 'CopilotBotInfoRepresentation';
145
+ function normalize$3(input, existing, path, luvio, store, timestamp) {
126
146
  return input;
127
147
  }
128
- const select$7 = function CopilotBotInfoRepresentationSelect() {
148
+ const select$a = function CopilotBotInfoRepresentationSelect() {
129
149
  return {
130
150
  kind: 'Fragment',
131
- version: VERSION$5,
151
+ version: VERSION$7,
132
152
  private: [],
133
153
  selections: [
134
154
  {
@@ -148,7 +168,7 @@ const select$7 = function CopilotBotInfoRepresentationSelect() {
148
168
  ]
149
169
  };
150
170
  };
151
- function equals$5(existing, incoming) {
171
+ function equals$7(existing, incoming) {
152
172
  const existing_isSuccess = existing.isSuccess;
153
173
  const incoming_isSuccess = incoming.isSuccess;
154
174
  if (!(existing_isSuccess === incoming_isSuccess)) {
@@ -182,44 +202,44 @@ function equals$5(existing, incoming) {
182
202
  }
183
203
  return true;
184
204
  }
185
- const ingest$2 = function CopilotBotInfoRepresentationIngest(input, path, luvio, store, timestamp) {
205
+ const ingest$3 = function CopilotBotInfoRepresentationIngest(input, path, luvio, store, timestamp) {
186
206
  if (process.env.NODE_ENV !== 'production') {
187
- const validateError = validate$6(input);
207
+ const validateError = validate$8(input);
188
208
  if (validateError !== null) {
189
209
  throw validateError;
190
210
  }
191
211
  }
192
212
  const key = path.fullPath;
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);
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);
195
215
  return createLink(key);
196
216
  };
197
- function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
217
+ function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
198
218
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
199
219
  const rootKey = fullPathFactory();
200
220
  rootKeySet.set(rootKey, {
201
221
  namespace: keyPrefix,
202
- representationName: RepresentationType$2,
222
+ representationName: RepresentationType$3,
203
223
  mergeable: false
204
224
  });
205
225
  }
206
226
 
207
- function select$6(luvio, params) {
208
- return select$7();
227
+ function select$9(luvio, params) {
228
+ return select$a();
209
229
  }
210
- function keyBuilder$3(luvio, params) {
230
+ function keyBuilder$5(luvio, params) {
211
231
  return keyPrefix + '::CopilotBotInfoRepresentation:(' + ')';
212
232
  }
213
- function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
214
- getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$3());
233
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
234
+ getTypeCacheKeys$3(storeKeyMap, luvio, response, () => keyBuilder$5());
215
235
  }
216
- function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
236
+ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
217
237
  const { body } = response;
218
- const key = keyBuilder$3();
219
- luvio.storeIngest(key, ingest$2, body);
238
+ const key = keyBuilder$5();
239
+ luvio.storeIngest(key, ingest$3, body);
220
240
  const snapshot = luvio.storeLookup({
221
241
  recordId: key,
222
- node: select$6(),
242
+ node: select$9(),
223
243
  variables: {},
224
244
  }, snapshotRefresh);
225
245
  if (process.env.NODE_ENV !== 'production') {
@@ -230,19 +250,19 @@ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
230
250
  deepFreeze(snapshot.data);
231
251
  return snapshot;
232
252
  }
233
- function ingestError(luvio, params, error, snapshotRefresh) {
234
- const key = keyBuilder$3();
253
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
254
+ const key = keyBuilder$5();
235
255
  const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
236
256
  const storeMetadataParams = {
237
- ttl: TTL$2,
257
+ ttl: TTL$3,
238
258
  namespace: keyPrefix,
239
- version: VERSION$5,
240
- representationName: RepresentationType$2
259
+ version: VERSION$7,
260
+ representationName: RepresentationType$3
241
261
  };
242
262
  luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
243
263
  return errorSnapshot;
244
264
  }
245
- function createResourceRequest$1(config) {
265
+ function createResourceRequest$2(config) {
246
266
  const headers = {};
247
267
  return {
248
268
  baseUri: '/services/data/v60.0',
@@ -256,120 +276,122 @@ function createResourceRequest$1(config) {
256
276
  };
257
277
  }
258
278
 
259
- const adapterName$1 = 'getBotId';
279
+ const adapterName$2 = 'getBotId';
260
280
  const getBotId_ConfigPropertyMetadata = [];
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();
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();
266
286
  }
267
- function typeCheckConfig$1(untrustedConfig) {
287
+ function typeCheckConfig$2(untrustedConfig) {
268
288
  const config = {};
269
289
  return config;
270
290
  }
271
- function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
291
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
272
292
  if (!untrustedIsObject(untrustedConfig)) {
273
293
  return null;
274
294
  }
275
295
  if (process.env.NODE_ENV !== 'production') {
276
296
  validateConfig(untrustedConfig, configPropertyNames);
277
297
  }
278
- const config = typeCheckConfig$1();
298
+ const config = typeCheckConfig$2();
279
299
  if (!areRequiredParametersPresent(config, configPropertyNames)) {
280
300
  return null;
281
301
  }
282
302
  return config;
283
303
  }
284
- function adapterFragment(luvio, config) {
285
- createResourceParams$1(config);
286
- return select$6();
304
+ function adapterFragment$1(luvio, config) {
305
+ createResourceParams$2(config);
306
+ return select$9();
287
307
  }
288
- function onFetchResponseSuccess(luvio, config, resourceParams, response) {
289
- const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
308
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
309
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
290
310
  config,
291
- resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
311
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
292
312
  });
293
313
  return luvio.storeBroadcast().then(() => snapshot);
294
314
  }
295
- function onFetchResponseError(luvio, config, resourceParams, response) {
296
- const snapshot = ingestError(luvio, resourceParams, response, {
315
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
316
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
297
317
  config,
298
- resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
318
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
299
319
  });
300
320
  return luvio.storeBroadcast().then(() => snapshot);
301
321
  }
302
- function buildNetworkSnapshot$1(luvio, config, options) {
303
- const resourceParams = createResourceParams$1(config);
304
- const request = createResourceRequest$1();
322
+ function buildNetworkSnapshot$2(luvio, config, options) {
323
+ const resourceParams = createResourceParams$2(config);
324
+ const request = createResourceRequest$2();
305
325
  return luvio.dispatchResourceRequest(request, options)
306
326
  .then((response) => {
307
- return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
327
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
308
328
  const cache = new StoreKeyMap();
309
- getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
329
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
310
330
  return cache;
311
331
  });
312
332
  }, (response) => {
313
- return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
333
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
314
334
  });
315
335
  }
316
- function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
317
- return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
336
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
337
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
318
338
  }
319
- function buildCachedSnapshotCachePolicy(context, storeLookup) {
339
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
320
340
  const { luvio, config } = context;
321
341
  const selector = {
322
- recordId: keyBuilder$2(luvio, config),
323
- node: adapterFragment(luvio, config),
342
+ recordId: keyBuilder$4(luvio, config),
343
+ node: adapterFragment$1(luvio, config),
324
344
  variables: {},
325
345
  };
326
346
  const cacheSnapshot = storeLookup(selector, {
327
347
  config,
328
- resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
348
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
329
349
  });
330
350
  return cacheSnapshot;
331
351
  }
332
352
  const getBotIdAdapterFactory = (luvio) => function einsteinCopilotBot__getBotId(untrustedConfig, requestContext) {
333
- const config = validateAdapterConfig$1(untrustedConfig, getBotId_ConfigPropertyNames);
353
+ const config = validateAdapterConfig$2(untrustedConfig, getBotId_ConfigPropertyNames);
334
354
  // Invalid or incomplete config
335
355
  if (config === null) {
336
356
  return null;
337
357
  }
338
358
  return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
339
- buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
359
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
340
360
  };
341
361
 
342
- const VERSION$4 = "62bc08357d634ed38883e4b936473a49";
343
- function validate$5(obj, path = 'EsTypeMessageRepresentation') {
362
+ const VERSION$6 = "e8cb7e20392935088ea2f98edb927e8a";
363
+ function validate$7(obj, path = 'EsTypeMessageRepresentation') {
344
364
  const v_error = (() => {
345
365
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
346
366
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
347
367
  }
348
- const obj_property = obj.property;
349
- const path_property = path + '.property';
350
- let obj_property_union0 = null;
351
- const obj_property_union0_error = (() => {
352
- if (typeof obj_property !== 'string') {
353
- return new TypeError('Expected "string" but received "' + typeof obj_property + '" (at "' + path_property + '")');
368
+ if (obj.property !== undefined) {
369
+ const obj_property = obj.property;
370
+ const path_property = path + '.property';
371
+ let obj_property_union0 = null;
372
+ const obj_property_union0_error = (() => {
373
+ if (typeof obj_property !== 'string') {
374
+ return new TypeError('Expected "string" but received "' + typeof obj_property + '" (at "' + path_property + '")');
375
+ }
376
+ })();
377
+ if (obj_property_union0_error != null) {
378
+ obj_property_union0 = obj_property_union0_error.message;
354
379
  }
355
- })();
356
- if (obj_property_union0_error != null) {
357
- obj_property_union0 = obj_property_union0_error.message;
358
- }
359
- let obj_property_union1 = null;
360
- const obj_property_union1_error = (() => {
361
- if (obj_property !== null) {
362
- return new TypeError('Expected "null" but received "' + typeof obj_property + '" (at "' + path_property + '")');
380
+ let obj_property_union1 = null;
381
+ const obj_property_union1_error = (() => {
382
+ if (obj_property !== null) {
383
+ return new TypeError('Expected "null" but received "' + typeof obj_property + '" (at "' + path_property + '")');
384
+ }
385
+ })();
386
+ if (obj_property_union1_error != null) {
387
+ obj_property_union1 = obj_property_union1_error.message;
388
+ }
389
+ if (obj_property_union0 && obj_property_union1) {
390
+ let message = 'Object doesn\'t match union (at "' + path_property + '")';
391
+ message += '\n' + obj_property_union0.split('\n').map((line) => '\t' + line).join('\n');
392
+ message += '\n' + obj_property_union1.split('\n').map((line) => '\t' + line).join('\n');
393
+ return new TypeError(message);
363
394
  }
364
- })();
365
- if (obj_property_union1_error != null) {
366
- obj_property_union1 = obj_property_union1_error.message;
367
- }
368
- if (obj_property_union0 && obj_property_union1) {
369
- let message = 'Object doesn\'t match union (at "' + path_property + '")';
370
- message += '\n' + obj_property_union0.split('\n').map((line) => '\t' + line).join('\n');
371
- message += '\n' + obj_property_union1.split('\n').map((line) => '\t' + line).join('\n');
372
- return new TypeError(message);
373
395
  }
374
396
  const obj_type = obj.type;
375
397
  const path_type = path + '.type';
@@ -384,15 +406,16 @@ function validate$5(obj, path = 'EsTypeMessageRepresentation') {
384
406
  })();
385
407
  return v_error === undefined ? null : v_error;
386
408
  }
387
- const select$5 = function EsTypeMessageRepresentationSelect() {
409
+ const select$8 = function EsTypeMessageRepresentationSelect() {
388
410
  return {
389
411
  kind: 'Fragment',
390
- version: VERSION$4,
412
+ version: VERSION$6,
391
413
  private: [],
392
414
  selections: [
393
415
  {
394
416
  name: 'property',
395
- kind: 'Scalar'
417
+ kind: 'Scalar',
418
+ required: false
396
419
  },
397
420
  {
398
421
  name: 'type',
@@ -406,7 +429,7 @@ const select$5 = function EsTypeMessageRepresentationSelect() {
406
429
  ]
407
430
  };
408
431
  };
409
- function equals$4(existing, incoming) {
432
+ function equals$6(existing, incoming) {
410
433
  const existing_type = existing.type;
411
434
  const incoming_type = incoming.type;
412
435
  if (!(existing_type === incoming_type)) {
@@ -414,8 +437,16 @@ function equals$4(existing, incoming) {
414
437
  }
415
438
  const existing_property = existing.property;
416
439
  const incoming_property = incoming.property;
417
- if (!(existing_property === incoming_property)) {
418
- return false;
440
+ // if at least one of these optionals is defined
441
+ if (existing_property !== undefined || incoming_property !== undefined) {
442
+ // if one of these is not defined we know the other is defined and therefore
443
+ // not equal
444
+ if (existing_property === undefined || incoming_property === undefined) {
445
+ return false;
446
+ }
447
+ if (!(existing_property === incoming_property)) {
448
+ return false;
449
+ }
419
450
  }
420
451
  const existing_value = existing.value;
421
452
  const incoming_value = incoming.value;
@@ -425,7 +456,7 @@ function equals$4(existing, incoming) {
425
456
  return true;
426
457
  }
427
458
 
428
- function validate$4(obj, path = 'VariableRepresentation') {
459
+ function validate$6(obj, path = 'VariableRepresentation') {
429
460
  const v_error = (() => {
430
461
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
431
462
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -435,17 +466,19 @@ function validate$4(obj, path = 'VariableRepresentation') {
435
466
  if (typeof obj_name !== 'string') {
436
467
  return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
437
468
  }
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 + '")');
469
+ if (obj.value !== undefined) {
470
+ const obj_value = obj.value;
471
+ const path_value = path + '.value';
472
+ if (typeof obj_value !== 'string') {
473
+ return new TypeError('Expected "string" but received "' + typeof obj_value + '" (at "' + path_value + '")');
474
+ }
442
475
  }
443
476
  })();
444
477
  return v_error === undefined ? null : v_error;
445
478
  }
446
479
 
447
- const VERSION$3 = "4e28b61c3ea362f1c68b28897784111e";
448
- function validate$3(obj, path = 'ConversationRuntimeProxyChoiceRepresentation') {
480
+ const VERSION$5 = "4e28b61c3ea362f1c68b28897784111e";
481
+ function validate$5(obj, path = 'ConversationRuntimeProxyChoiceRepresentation') {
449
482
  const v_error = (() => {
450
483
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
451
484
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -463,10 +496,10 @@ function validate$3(obj, path = 'ConversationRuntimeProxyChoiceRepresentation')
463
496
  })();
464
497
  return v_error === undefined ? null : v_error;
465
498
  }
466
- const select$4 = function ConversationRuntimeProxyChoiceRepresentationSelect() {
499
+ const select$7 = function ConversationRuntimeProxyChoiceRepresentationSelect() {
467
500
  return {
468
501
  kind: 'Fragment',
469
- version: VERSION$3,
502
+ version: VERSION$5,
470
503
  private: [],
471
504
  selections: [
472
505
  {
@@ -480,7 +513,7 @@ const select$4 = function ConversationRuntimeProxyChoiceRepresentationSelect() {
480
513
  ]
481
514
  };
482
515
  };
483
- function equals$3(existing, incoming) {
516
+ function equals$5(existing, incoming) {
484
517
  const existing_alias = existing.alias;
485
518
  const incoming_alias = incoming.alias;
486
519
  if (!(existing_alias === incoming_alias)) {
@@ -494,45 +527,49 @@ function equals$3(existing, incoming) {
494
527
  return true;
495
528
  }
496
529
 
497
- const VERSION$2 = "301ceee5b86e4e56526252efbbf70520";
498
- function validate$2(obj, path = 'CollectMessageRepresentation') {
530
+ const VERSION$4 = "477724425d0742c030025796c88ebf5d";
531
+ function validate$4(obj, path = 'CollectMessageRepresentation') {
499
532
  const v_error = (() => {
500
533
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
501
534
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
502
535
  }
503
- const obj_data = obj.data;
504
- const path_data = path + '.data';
505
- const referencepath_dataValidationError = validate$5(obj_data, path_data);
506
- if (referencepath_dataValidationError !== null) {
507
- let message = 'Object doesn\'t match EsTypeMessageRepresentation (at "' + path_data + '")\n';
508
- message += referencepath_dataValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
509
- return new TypeError(message);
510
- }
511
- const obj_targetProperty = obj.targetProperty;
512
- const path_targetProperty = path + '.targetProperty';
513
- let obj_targetProperty_union0 = null;
514
- const obj_targetProperty_union0_error = (() => {
515
- if (typeof obj_targetProperty !== 'string') {
516
- return new TypeError('Expected "string" but received "' + typeof obj_targetProperty + '" (at "' + path_targetProperty + '")');
517
- }
518
- })();
519
- if (obj_targetProperty_union0_error != null) {
520
- obj_targetProperty_union0 = obj_targetProperty_union0_error.message;
521
- }
522
- let obj_targetProperty_union1 = null;
523
- const obj_targetProperty_union1_error = (() => {
524
- if (obj_targetProperty !== null) {
525
- return new TypeError('Expected "null" but received "' + typeof obj_targetProperty + '" (at "' + path_targetProperty + '")');
536
+ if (obj.data !== undefined) {
537
+ const obj_data = obj.data;
538
+ const path_data = path + '.data';
539
+ const referencepath_dataValidationError = validate$7(obj_data, path_data);
540
+ if (referencepath_dataValidationError !== null) {
541
+ let message = 'Object doesn\'t match EsTypeMessageRepresentation (at "' + path_data + '")\n';
542
+ message += referencepath_dataValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
543
+ return new TypeError(message);
526
544
  }
527
- })();
528
- if (obj_targetProperty_union1_error != null) {
529
- obj_targetProperty_union1 = obj_targetProperty_union1_error.message;
530
545
  }
531
- if (obj_targetProperty_union0 && obj_targetProperty_union1) {
532
- let message = 'Object doesn\'t match union (at "' + path_targetProperty + '")';
533
- message += '\n' + obj_targetProperty_union0.split('\n').map((line) => '\t' + line).join('\n');
534
- message += '\n' + obj_targetProperty_union1.split('\n').map((line) => '\t' + line).join('\n');
535
- return new TypeError(message);
546
+ if (obj.targetProperty !== undefined) {
547
+ const obj_targetProperty = obj.targetProperty;
548
+ const path_targetProperty = path + '.targetProperty';
549
+ let obj_targetProperty_union0 = null;
550
+ const obj_targetProperty_union0_error = (() => {
551
+ if (typeof obj_targetProperty !== 'string') {
552
+ return new TypeError('Expected "string" but received "' + typeof obj_targetProperty + '" (at "' + path_targetProperty + '")');
553
+ }
554
+ })();
555
+ if (obj_targetProperty_union0_error != null) {
556
+ obj_targetProperty_union0 = obj_targetProperty_union0_error.message;
557
+ }
558
+ let obj_targetProperty_union1 = null;
559
+ const obj_targetProperty_union1_error = (() => {
560
+ if (obj_targetProperty !== null) {
561
+ return new TypeError('Expected "null" but received "' + typeof obj_targetProperty + '" (at "' + path_targetProperty + '")');
562
+ }
563
+ })();
564
+ if (obj_targetProperty_union1_error != null) {
565
+ obj_targetProperty_union1 = obj_targetProperty_union1_error.message;
566
+ }
567
+ if (obj_targetProperty_union0 && obj_targetProperty_union1) {
568
+ let message = 'Object doesn\'t match union (at "' + path_targetProperty + '")';
569
+ message += '\n' + obj_targetProperty_union0.split('\n').map((line) => '\t' + line).join('\n');
570
+ message += '\n' + obj_targetProperty_union1.split('\n').map((line) => '\t' + line).join('\n');
571
+ return new TypeError(message);
572
+ }
536
573
  }
537
574
  const obj_targetType = obj.targetType;
538
575
  const path_targetType = path + '.targetType';
@@ -542,21 +579,23 @@ function validate$2(obj, path = 'CollectMessageRepresentation') {
542
579
  })();
543
580
  return v_error === undefined ? null : v_error;
544
581
  }
545
- const select$3 = function CollectMessageRepresentationSelect() {
546
- const { selections: EsTypeMessageRepresentation__selections, opaque: EsTypeMessageRepresentation__opaque, } = select$5();
582
+ const select$6 = function CollectMessageRepresentationSelect() {
583
+ const { selections: EsTypeMessageRepresentation__selections, opaque: EsTypeMessageRepresentation__opaque, } = select$8();
547
584
  return {
548
585
  kind: 'Fragment',
549
- version: VERSION$2,
586
+ version: VERSION$4,
550
587
  private: [],
551
588
  selections: [
552
589
  {
553
590
  name: 'data',
554
591
  kind: 'Object',
555
- selections: EsTypeMessageRepresentation__selections
592
+ selections: EsTypeMessageRepresentation__selections,
593
+ required: false
556
594
  },
557
595
  {
558
596
  name: 'targetProperty',
559
- kind: 'Scalar'
597
+ kind: 'Scalar',
598
+ required: false
560
599
  },
561
600
  {
562
601
  name: 'targetType',
@@ -565,7 +604,7 @@ const select$3 = function CollectMessageRepresentationSelect() {
565
604
  ]
566
605
  };
567
606
  };
568
- function equals$2(existing, incoming) {
607
+ function equals$4(existing, incoming) {
569
608
  const existing_targetType = existing.targetType;
570
609
  const incoming_targetType = incoming.targetType;
571
610
  if (!(existing_targetType === incoming_targetType)) {
@@ -573,20 +612,36 @@ function equals$2(existing, incoming) {
573
612
  }
574
613
  const existing_data = existing.data;
575
614
  const incoming_data = incoming.data;
576
- if (!(equals$4(existing_data, incoming_data))) {
577
- return false;
615
+ // if at least one of these optionals is defined
616
+ if (existing_data !== undefined || incoming_data !== undefined) {
617
+ // if one of these is not defined we know the other is defined and therefore
618
+ // not equal
619
+ if (existing_data === undefined || incoming_data === undefined) {
620
+ return false;
621
+ }
622
+ if (!(equals$6(existing_data, incoming_data))) {
623
+ return false;
624
+ }
578
625
  }
579
626
  const existing_targetProperty = existing.targetProperty;
580
627
  const incoming_targetProperty = incoming.targetProperty;
581
- if (!(existing_targetProperty === incoming_targetProperty)) {
582
- return false;
628
+ // if at least one of these optionals is defined
629
+ if (existing_targetProperty !== undefined || incoming_targetProperty !== undefined) {
630
+ // if one of these is not defined we know the other is defined and therefore
631
+ // not equal
632
+ if (existing_targetProperty === undefined || incoming_targetProperty === undefined) {
633
+ return false;
634
+ }
635
+ if (!(existing_targetProperty === incoming_targetProperty)) {
636
+ return false;
637
+ }
583
638
  }
584
639
  return true;
585
640
  }
586
641
 
587
- const TTL$1 = 30000;
588
- const VERSION$1 = "d3d34b56efe68a37c173d0cb91c57ba1";
589
- function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation') {
642
+ const TTL$2 = 30000;
643
+ const VERSION$3 = "55ac02bd055f57a2a12aa0fa4844d1a2";
644
+ function validate$3(obj, path = 'ConversationRuntimeProxyMessageRepresentation') {
590
645
  const v_error = (() => {
591
646
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
592
647
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -600,7 +655,7 @@ function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
600
655
  for (let i = 0; i < obj_choices.length; i++) {
601
656
  const obj_choices_item = obj_choices[i];
602
657
  const path_choices_item = path_choices + '[' + i + ']';
603
- const referencepath_choices_itemValidationError = validate$3(obj_choices_item, path_choices_item);
658
+ const referencepath_choices_itemValidationError = validate$5(obj_choices_item, path_choices_item);
604
659
  if (referencepath_choices_itemValidationError !== null) {
605
660
  let message = 'Object doesn\'t match ConversationRuntimeProxyChoiceRepresentation (at "' + path_choices_item + '")\n';
606
661
  message += referencepath_choices_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -617,7 +672,7 @@ function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
617
672
  for (let i = 0; i < obj_collect.length; i++) {
618
673
  const obj_collect_item = obj_collect[i];
619
674
  const path_collect_item = path_collect + '[' + i + ']';
620
- const referencepath_collect_itemValidationError = validate$2(obj_collect_item, path_collect_item);
675
+ const referencepath_collect_itemValidationError = validate$4(obj_collect_item, path_collect_item);
621
676
  if (referencepath_collect_itemValidationError !== null) {
622
677
  let message = 'Object doesn\'t match CollectMessageRepresentation (at "' + path_collect_item + '")\n';
623
678
  message += referencepath_collect_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -634,7 +689,7 @@ function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
634
689
  for (let i = 0; i < obj_confirm.length; i++) {
635
690
  const obj_confirm_item = obj_confirm[i];
636
691
  const path_confirm_item = path_confirm + '[' + i + ']';
637
- const referencepath_confirm_itemValidationError = validate$5(obj_confirm_item, path_confirm_item);
692
+ const referencepath_confirm_itemValidationError = validate$7(obj_confirm_item, path_confirm_item);
638
693
  if (referencepath_confirm_itemValidationError !== null) {
639
694
  let message = 'Object doesn\'t match EsTypeMessageRepresentation (at "' + path_confirm_item + '")\n';
640
695
  message += referencepath_confirm_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -684,31 +739,33 @@ function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
684
739
  return new TypeError(message);
685
740
  }
686
741
  }
687
- const obj_feedbackId = obj.feedbackId;
688
- const path_feedbackId = path + '.feedbackId';
689
- let obj_feedbackId_union0 = null;
690
- const obj_feedbackId_union0_error = (() => {
691
- if (typeof obj_feedbackId !== 'string') {
692
- return new TypeError('Expected "string" but received "' + typeof obj_feedbackId + '" (at "' + path_feedbackId + '")');
742
+ if (obj.feedbackId !== undefined) {
743
+ const obj_feedbackId = obj.feedbackId;
744
+ const path_feedbackId = path + '.feedbackId';
745
+ let obj_feedbackId_union0 = null;
746
+ const obj_feedbackId_union0_error = (() => {
747
+ if (typeof obj_feedbackId !== 'string') {
748
+ return new TypeError('Expected "string" but received "' + typeof obj_feedbackId + '" (at "' + path_feedbackId + '")');
749
+ }
750
+ })();
751
+ if (obj_feedbackId_union0_error != null) {
752
+ obj_feedbackId_union0 = obj_feedbackId_union0_error.message;
693
753
  }
694
- })();
695
- if (obj_feedbackId_union0_error != null) {
696
- obj_feedbackId_union0 = obj_feedbackId_union0_error.message;
697
- }
698
- let obj_feedbackId_union1 = null;
699
- const obj_feedbackId_union1_error = (() => {
700
- if (obj_feedbackId !== null) {
701
- return new TypeError('Expected "null" but received "' + typeof obj_feedbackId + '" (at "' + path_feedbackId + '")');
754
+ let obj_feedbackId_union1 = null;
755
+ const obj_feedbackId_union1_error = (() => {
756
+ if (obj_feedbackId !== null) {
757
+ return new TypeError('Expected "null" but received "' + typeof obj_feedbackId + '" (at "' + path_feedbackId + '")');
758
+ }
759
+ })();
760
+ if (obj_feedbackId_union1_error != null) {
761
+ obj_feedbackId_union1 = obj_feedbackId_union1_error.message;
762
+ }
763
+ if (obj_feedbackId_union0 && obj_feedbackId_union1) {
764
+ let message = 'Object doesn\'t match union (at "' + path_feedbackId + '")';
765
+ message += '\n' + obj_feedbackId_union0.split('\n').map((line) => '\t' + line).join('\n');
766
+ message += '\n' + obj_feedbackId_union1.split('\n').map((line) => '\t' + line).join('\n');
767
+ return new TypeError(message);
702
768
  }
703
- })();
704
- if (obj_feedbackId_union1_error != null) {
705
- obj_feedbackId_union1 = obj_feedbackId_union1_error.message;
706
- }
707
- if (obj_feedbackId_union0 && obj_feedbackId_union1) {
708
- let message = 'Object doesn\'t match union (at "' + path_feedbackId + '")';
709
- message += '\n' + obj_feedbackId_union0.split('\n').map((line) => '\t' + line).join('\n');
710
- message += '\n' + obj_feedbackId_union1.split('\n').map((line) => '\t' + line).join('\n');
711
- return new TypeError(message);
712
769
  }
713
770
  const obj_id = obj.id;
714
771
  const path_id = path + '.id';
@@ -771,31 +828,33 @@ function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
771
828
  return new TypeError(message);
772
829
  }
773
830
  }
774
- const obj_planId = obj.planId;
775
- const path_planId = path + '.planId';
776
- let obj_planId_union0 = null;
777
- const obj_planId_union0_error = (() => {
778
- if (typeof obj_planId !== 'string') {
779
- return new TypeError('Expected "string" but received "' + typeof obj_planId + '" (at "' + path_planId + '")');
831
+ if (obj.planId !== undefined) {
832
+ const obj_planId = obj.planId;
833
+ const path_planId = path + '.planId';
834
+ let obj_planId_union0 = null;
835
+ const obj_planId_union0_error = (() => {
836
+ if (typeof obj_planId !== 'string') {
837
+ return new TypeError('Expected "string" but received "' + typeof obj_planId + '" (at "' + path_planId + '")');
838
+ }
839
+ })();
840
+ if (obj_planId_union0_error != null) {
841
+ obj_planId_union0 = obj_planId_union0_error.message;
780
842
  }
781
- })();
782
- if (obj_planId_union0_error != null) {
783
- obj_planId_union0 = obj_planId_union0_error.message;
784
- }
785
- let obj_planId_union1 = null;
786
- const obj_planId_union1_error = (() => {
787
- if (obj_planId !== null) {
788
- return new TypeError('Expected "null" but received "' + typeof obj_planId + '" (at "' + path_planId + '")');
843
+ let obj_planId_union1 = null;
844
+ const obj_planId_union1_error = (() => {
845
+ if (obj_planId !== null) {
846
+ return new TypeError('Expected "null" but received "' + typeof obj_planId + '" (at "' + path_planId + '")');
847
+ }
848
+ })();
849
+ if (obj_planId_union1_error != null) {
850
+ obj_planId_union1 = obj_planId_union1_error.message;
851
+ }
852
+ if (obj_planId_union0 && obj_planId_union1) {
853
+ let message = 'Object doesn\'t match union (at "' + path_planId + '")';
854
+ message += '\n' + obj_planId_union0.split('\n').map((line) => '\t' + line).join('\n');
855
+ message += '\n' + obj_planId_union1.split('\n').map((line) => '\t' + line).join('\n');
856
+ return new TypeError(message);
789
857
  }
790
- })();
791
- if (obj_planId_union1_error != null) {
792
- obj_planId_union1 = obj_planId_union1_error.message;
793
- }
794
- if (obj_planId_union0 && obj_planId_union1) {
795
- let message = 'Object doesn\'t match union (at "' + path_planId + '")';
796
- message += '\n' + obj_planId_union0.split('\n').map((line) => '\t' + line).join('\n');
797
- message += '\n' + obj_planId_union1.split('\n').map((line) => '\t' + line).join('\n');
798
- return new TypeError(message);
799
858
  }
800
859
  if (obj.result !== undefined) {
801
860
  const obj_result = obj.result;
@@ -806,7 +865,7 @@ function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
806
865
  for (let i = 0; i < obj_result.length; i++) {
807
866
  const obj_result_item = obj_result[i];
808
867
  const path_result_item = path_result + '[' + i + ']';
809
- const referencepath_result_itemValidationError = validate$5(obj_result_item, path_result_item);
868
+ const referencepath_result_itemValidationError = validate$7(obj_result_item, path_result_item);
810
869
  if (referencepath_result_itemValidationError !== null) {
811
870
  let message = 'Object doesn\'t match EsTypeMessageRepresentation (at "' + path_result_item + '")\n';
812
871
  message += referencepath_result_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
@@ -880,26 +939,26 @@ function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
880
939
  })();
881
940
  return v_error === undefined ? null : v_error;
882
941
  }
883
- const RepresentationType$1 = 'ConversationRuntimeProxyMessageRepresentation';
884
- function keyBuilder$1(luvio, config) {
885
- return keyPrefix + '::' + RepresentationType$1 + ':' + config.id;
942
+ const RepresentationType$2 = 'ConversationRuntimeProxyMessageRepresentation';
943
+ function keyBuilder$3(luvio, config) {
944
+ return keyPrefix + '::' + RepresentationType$2 + ':' + config.id;
886
945
  }
887
946
  function keyBuilderFromType$1(luvio, object) {
888
947
  const keyParams = {
889
948
  id: object.id
890
949
  };
891
- return keyBuilder$1(luvio, keyParams);
950
+ return keyBuilder$3(luvio, keyParams);
892
951
  }
893
- function normalize$1(input, existing, path, luvio, store, timestamp) {
952
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
894
953
  return input;
895
954
  }
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();
955
+ const select$5 = function ConversationRuntimeProxyMessageRepresentationSelect() {
956
+ const { selections: ConversationRuntimeProxyChoiceRepresentation__selections, opaque: ConversationRuntimeProxyChoiceRepresentation__opaque, } = select$7();
957
+ const { selections: CollectMessageRepresentation__selections, opaque: CollectMessageRepresentation__opaque, } = select$6();
958
+ const { selections: EsTypeMessageRepresentation__selections, opaque: EsTypeMessageRepresentation__opaque, } = select$8();
900
959
  return {
901
960
  kind: 'Fragment',
902
- version: VERSION$1,
961
+ version: VERSION$3,
903
962
  private: [],
904
963
  selections: [
905
964
  {
@@ -936,7 +995,8 @@ const select$2 = function ConversationRuntimeProxyMessageRepresentationSelect()
936
995
  },
937
996
  {
938
997
  name: 'feedbackId',
939
- kind: 'Scalar'
998
+ kind: 'Scalar',
999
+ required: false
940
1000
  },
941
1001
  {
942
1002
  name: 'id',
@@ -954,7 +1014,8 @@ const select$2 = function ConversationRuntimeProxyMessageRepresentationSelect()
954
1014
  },
955
1015
  {
956
1016
  name: 'planId',
957
- kind: 'Scalar'
1017
+ kind: 'Scalar',
1018
+ required: false
958
1019
  },
959
1020
  {
960
1021
  name: 'result',
@@ -981,7 +1042,7 @@ const select$2 = function ConversationRuntimeProxyMessageRepresentationSelect()
981
1042
  ]
982
1043
  };
983
1044
  };
984
- function equals$1(existing, incoming) {
1045
+ function equals$3(existing, incoming) {
985
1046
  const existing_id = existing.id;
986
1047
  const incoming_id = incoming.id;
987
1048
  if (!(existing_id === incoming_id)) {
@@ -1010,7 +1071,7 @@ function equals$1(existing, incoming) {
1010
1071
  return false;
1011
1072
  }
1012
1073
  const equals_choices_items = equalsArray(existing_choices, incoming_choices, (existing_choices_item, incoming_choices_item) => {
1013
- if (!(equals$3(existing_choices_item, incoming_choices_item))) {
1074
+ if (!(equals$5(existing_choices_item, incoming_choices_item))) {
1014
1075
  return false;
1015
1076
  }
1016
1077
  });
@@ -1028,7 +1089,7 @@ function equals$1(existing, incoming) {
1028
1089
  return false;
1029
1090
  }
1030
1091
  const equals_collect_items = equalsArray(existing_collect, incoming_collect, (existing_collect_item, incoming_collect_item) => {
1031
- if (!(equals$2(existing_collect_item, incoming_collect_item))) {
1092
+ if (!(equals$4(existing_collect_item, incoming_collect_item))) {
1032
1093
  return false;
1033
1094
  }
1034
1095
  });
@@ -1046,7 +1107,7 @@ function equals$1(existing, incoming) {
1046
1107
  return false;
1047
1108
  }
1048
1109
  const equals_confirm_items = equalsArray(existing_confirm, incoming_confirm, (existing_confirm_item, incoming_confirm_item) => {
1049
- if (!(equals$4(existing_confirm_item, incoming_confirm_item))) {
1110
+ if (!(equals$6(existing_confirm_item, incoming_confirm_item))) {
1050
1111
  return false;
1051
1112
  }
1052
1113
  });
@@ -1087,8 +1148,16 @@ function equals$1(existing, incoming) {
1087
1148
  }
1088
1149
  const existing_feedbackId = existing.feedbackId;
1089
1150
  const incoming_feedbackId = incoming.feedbackId;
1090
- if (!(existing_feedbackId === incoming_feedbackId)) {
1091
- return false;
1151
+ // if at least one of these optionals is defined
1152
+ if (existing_feedbackId !== undefined || incoming_feedbackId !== undefined) {
1153
+ // if one of these is not defined we know the other is defined and therefore
1154
+ // not equal
1155
+ if (existing_feedbackId === undefined || incoming_feedbackId === undefined) {
1156
+ return false;
1157
+ }
1158
+ if (!(existing_feedbackId === incoming_feedbackId)) {
1159
+ return false;
1160
+ }
1092
1161
  }
1093
1162
  const existing_message = existing.message;
1094
1163
  const incoming_message = incoming.message;
@@ -1118,8 +1187,16 @@ function equals$1(existing, incoming) {
1118
1187
  }
1119
1188
  const existing_planId = existing.planId;
1120
1189
  const incoming_planId = incoming.planId;
1121
- if (!(existing_planId === incoming_planId)) {
1122
- return false;
1190
+ // if at least one of these optionals is defined
1191
+ if (existing_planId !== undefined || incoming_planId !== undefined) {
1192
+ // if one of these is not defined we know the other is defined and therefore
1193
+ // not equal
1194
+ if (existing_planId === undefined || incoming_planId === undefined) {
1195
+ return false;
1196
+ }
1197
+ if (!(existing_planId === incoming_planId)) {
1198
+ return false;
1199
+ }
1123
1200
  }
1124
1201
  const existing_result = existing.result;
1125
1202
  const incoming_result = incoming.result;
@@ -1131,7 +1208,7 @@ function equals$1(existing, incoming) {
1131
1208
  return false;
1132
1209
  }
1133
1210
  const equals_result_items = equalsArray(existing_result, incoming_result, (existing_result_item, incoming_result_item) => {
1134
- if (!(equals$4(existing_result_item, incoming_result_item))) {
1211
+ if (!(equals$6(existing_result_item, incoming_result_item))) {
1135
1212
  return false;
1136
1213
  }
1137
1214
  });
@@ -1167,31 +1244,31 @@ function equals$1(existing, incoming) {
1167
1244
  }
1168
1245
  return true;
1169
1246
  }
1170
- const ingest$1 = function ConversationRuntimeProxyMessageRepresentationIngest(input, path, luvio, store, timestamp) {
1247
+ const ingest$2 = function ConversationRuntimeProxyMessageRepresentationIngest(input, path, luvio, store, timestamp) {
1171
1248
  if (process.env.NODE_ENV !== 'production') {
1172
- const validateError = validate$1(input);
1249
+ const validateError = validate$3(input);
1173
1250
  if (validateError !== null) {
1174
1251
  throw validateError;
1175
1252
  }
1176
1253
  }
1177
1254
  const key = keyBuilderFromType$1(luvio, input);
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);
1255
+ const ttlToUse = TTL$2;
1256
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "einstein-copilot-bot", VERSION$3, RepresentationType$2, equals$3);
1180
1257
  return createLink(key);
1181
1258
  };
1182
- function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
1259
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
1183
1260
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1184
1261
  const rootKey = keyBuilderFromType$1(luvio, input);
1185
1262
  rootKeySet.set(rootKey, {
1186
1263
  namespace: keyPrefix,
1187
- representationName: RepresentationType$1,
1264
+ representationName: RepresentationType$2,
1188
1265
  mergeable: false
1189
1266
  });
1190
1267
  }
1191
1268
 
1192
- const TTL = 30000;
1193
- const VERSION = "fe7024fb1132250f97d9616482f09f99";
1194
- function validate(obj, path = 'ConversationRuntimeProxyRepresentation') {
1269
+ const TTL$1 = 30000;
1270
+ const VERSION$2 = "fe7024fb1132250f97d9616482f09f99";
1271
+ function validate$2(obj, path = 'ConversationRuntimeProxyRepresentation') {
1195
1272
  const v_error = (() => {
1196
1273
  if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1197
1274
  return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
@@ -1243,23 +1320,23 @@ function validate(obj, path = 'ConversationRuntimeProxyRepresentation') {
1243
1320
  })();
1244
1321
  return v_error === undefined ? null : v_error;
1245
1322
  }
1246
- const RepresentationType = 'ConversationRuntimeProxyRepresentation';
1247
- function keyBuilder(luvio, config) {
1248
- return keyPrefix + '::' + RepresentationType + ':' + config.id;
1323
+ const RepresentationType$1 = 'ConversationRuntimeProxyRepresentation';
1324
+ function keyBuilder$2(luvio, config) {
1325
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.id;
1249
1326
  }
1250
1327
  function keyBuilderFromType(luvio, object) {
1251
1328
  const keyParams = {
1252
1329
  id: object.requestId
1253
1330
  };
1254
- return keyBuilder(luvio, keyParams);
1331
+ return keyBuilder$2(luvio, keyParams);
1255
1332
  }
1256
- function normalize(input, existing, path, luvio, store, timestamp) {
1333
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
1257
1334
  const input_messages = input.messages;
1258
1335
  const input_messages_id = path.fullPath + '__messages';
1259
1336
  for (let i = 0; i < input_messages.length; i++) {
1260
1337
  const input_messages_item = input_messages[i];
1261
1338
  let input_messages_item_id = input_messages_id + '__' + i;
1262
- input_messages[i] = ingest$1(input_messages_item, {
1339
+ input_messages[i] = ingest$2(input_messages_item, {
1263
1340
  fullPath: input_messages_item_id,
1264
1341
  propertyName: i,
1265
1342
  parent: {
@@ -1272,10 +1349,10 @@ function normalize(input, existing, path, luvio, store, timestamp) {
1272
1349
  }
1273
1350
  return input;
1274
1351
  }
1275
- const select$1 = function ConversationRuntimeProxyRepresentationSelect() {
1352
+ const select$4 = function ConversationRuntimeProxyRepresentationSelect() {
1276
1353
  return {
1277
1354
  kind: 'Fragment',
1278
- version: VERSION,
1355
+ version: VERSION$2,
1279
1356
  private: [],
1280
1357
  selections: [
1281
1358
  {
@@ -1290,7 +1367,7 @@ const select$1 = function ConversationRuntimeProxyRepresentationSelect() {
1290
1367
  name: 'messages',
1291
1368
  kind: 'Link',
1292
1369
  plural: true,
1293
- fragment: select$2()
1370
+ fragment: select$5()
1294
1371
  },
1295
1372
  {
1296
1373
  name: 'processedSequenceIds',
@@ -1308,7 +1385,7 @@ const select$1 = function ConversationRuntimeProxyRepresentationSelect() {
1308
1385
  ]
1309
1386
  };
1310
1387
  };
1311
- function equals(existing, incoming) {
1388
+ function equals$2(existing, incoming) {
1312
1389
  const existing_botId = existing.botId;
1313
1390
  const incoming_botId = incoming.botId;
1314
1391
  if (!(existing_botId === incoming_botId)) {
@@ -1351,45 +1428,45 @@ function equals(existing, incoming) {
1351
1428
  }
1352
1429
  return true;
1353
1430
  }
1354
- const ingest = function ConversationRuntimeProxyRepresentationIngest(input, path, luvio, store, timestamp) {
1431
+ const ingest$1 = function ConversationRuntimeProxyRepresentationIngest(input, path, luvio, store, timestamp) {
1355
1432
  if (process.env.NODE_ENV !== 'production') {
1356
- const validateError = validate(input);
1433
+ const validateError = validate$2(input);
1357
1434
  if (validateError !== null) {
1358
1435
  throw validateError;
1359
1436
  }
1360
1437
  }
1361
1438
  const key = keyBuilderFromType(luvio, input);
1362
- const ttlToUse = TTL;
1363
- ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "einstein-copilot-bot", VERSION, RepresentationType, equals);
1439
+ const ttlToUse = TTL$1;
1440
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "einstein-copilot-bot", VERSION$2, RepresentationType$1, equals$2);
1364
1441
  return createLink(key);
1365
1442
  };
1366
- function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
1443
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
1367
1444
  // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1368
1445
  const rootKey = keyBuilderFromType(luvio, input);
1369
1446
  rootKeySet.set(rootKey, {
1370
1447
  namespace: keyPrefix,
1371
- representationName: RepresentationType,
1448
+ representationName: RepresentationType$1,
1372
1449
  mergeable: false
1373
1450
  });
1374
1451
  const input_messages_length = input.messages.length;
1375
1452
  for (let i = 0; i < input_messages_length; i++) {
1376
- getTypeCacheKeys$1(rootKeySet, luvio, input.messages[i]);
1453
+ getTypeCacheKeys$2(rootKeySet, luvio, input.messages[i]);
1377
1454
  }
1378
1455
  }
1379
1456
 
1380
- function select(luvio, params) {
1381
- return select$1();
1457
+ function select$3(luvio, params) {
1458
+ return select$4();
1382
1459
  }
1383
- function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
1384
- getTypeCacheKeys(storeKeyMap, luvio, response);
1460
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
1461
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
1385
1462
  }
1386
- function ingestSuccess(luvio, resourceParams, response) {
1463
+ function ingestSuccess$1(luvio, resourceParams, response) {
1387
1464
  const { body } = response;
1388
1465
  const key = keyBuilderFromType(luvio, body);
1389
- luvio.storeIngest(key, ingest, body);
1466
+ luvio.storeIngest(key, ingest$1, body);
1390
1467
  const snapshot = luvio.storeLookup({
1391
1468
  recordId: key,
1392
- node: select(),
1469
+ node: select$3(),
1393
1470
  variables: {},
1394
1471
  });
1395
1472
  if (process.env.NODE_ENV !== 'production') {
@@ -1400,7 +1477,7 @@ function ingestSuccess(luvio, resourceParams, response) {
1400
1477
  deepFreeze(snapshot.data);
1401
1478
  return snapshot;
1402
1479
  }
1403
- function createResourceRequest(config) {
1480
+ function createResourceRequest$1(config) {
1404
1481
  const headers = {};
1405
1482
  return {
1406
1483
  baseUri: '/services/data/v60.0',
@@ -1414,30 +1491,36 @@ function createResourceRequest(config) {
1414
1491
  };
1415
1492
  }
1416
1493
 
1417
- const adapterName = 'sendMessage';
1494
+ const adapterName$1 = 'sendMessage';
1418
1495
  const sendMessage_ConfigPropertyMetadata = [
1419
1496
  generateParamConfigMetadata('botId', false, 1 /* QueryParameter */, 0 /* String */),
1420
1497
  generateParamConfigMetadata('botVersionId', false, 1 /* QueryParameter */, 0 /* String */),
1421
1498
  generateParamConfigMetadata('message', false, 1 /* QueryParameter */, 0 /* String */),
1422
1499
  generateParamConfigMetadata('sessionId', false, 1 /* QueryParameter */, 0 /* String */),
1423
1500
  generateParamConfigMetadata('inReplyToMessageId', false, 2 /* Body */, 0 /* String */),
1501
+ generateParamConfigMetadata('intent', false, 2 /* Body */, 0 /* String */),
1424
1502
  generateParamConfigMetadata('messageType', false, 2 /* Body */, 0 /* String */),
1503
+ generateParamConfigMetadata('planId', false, 2 /* Body */, 0 /* String */),
1504
+ generateParamConfigMetadata('planTemplateVariables', false, 2 /* Body */, 4 /* Unsupported */),
1425
1505
  generateParamConfigMetadata('reply', false, 2 /* Body */, 4 /* Unsupported */, true),
1426
1506
  generateParamConfigMetadata('text', false, 2 /* Body */, 0 /* String */),
1427
1507
  generateParamConfigMetadata('type', false, 2 /* Body */, 0 /* String */),
1508
+ generateParamConfigMetadata('userUtterance', false, 2 /* Body */, 0 /* String */),
1428
1509
  generateParamConfigMetadata('variables', false, 2 /* Body */, 4 /* Unsupported */, true),
1429
1510
  ];
1430
- const sendMessage_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, sendMessage_ConfigPropertyMetadata);
1431
- const createResourceParams = /*#__PURE__*/ createResourceParams$2(sendMessage_ConfigPropertyMetadata);
1432
- function typeCheckConfig(untrustedConfig) {
1511
+ const sendMessage_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, sendMessage_ConfigPropertyMetadata);
1512
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(sendMessage_ConfigPropertyMetadata);
1513
+ function typeCheckConfig$1(untrustedConfig) {
1433
1514
  const config = {};
1434
- typeCheckConfig$2(untrustedConfig, config, sendMessage_ConfigPropertyMetadata);
1515
+ typeCheckConfig$3(untrustedConfig, config, sendMessage_ConfigPropertyMetadata);
1516
+ const untrustedConfig_planTemplateVariables = untrustedConfig.planTemplateVariables;
1517
+ config.planTemplateVariables = untrustedConfig_planTemplateVariables;
1435
1518
  const untrustedConfig_reply = untrustedConfig.reply;
1436
1519
  if (ArrayIsArray$1(untrustedConfig_reply)) {
1437
1520
  const untrustedConfig_reply_array = [];
1438
1521
  for (let i = 0, arrayLength = untrustedConfig_reply.length; i < arrayLength; i++) {
1439
1522
  const untrustedConfig_reply_item = untrustedConfig_reply[i];
1440
- const referenceEsTypeMessageRepresentationValidationError = validate$5(untrustedConfig_reply_item);
1523
+ const referenceEsTypeMessageRepresentationValidationError = validate$7(untrustedConfig_reply_item);
1441
1524
  if (referenceEsTypeMessageRepresentationValidationError === null) {
1442
1525
  untrustedConfig_reply_array.push(untrustedConfig_reply_item);
1443
1526
  }
@@ -1449,7 +1532,7 @@ function typeCheckConfig(untrustedConfig) {
1449
1532
  const untrustedConfig_variables_array = [];
1450
1533
  for (let i = 0, arrayLength = untrustedConfig_variables.length; i < arrayLength; i++) {
1451
1534
  const untrustedConfig_variables_item = untrustedConfig_variables[i];
1452
- const referenceVariableRepresentationValidationError = validate$4(untrustedConfig_variables_item);
1535
+ const referenceVariableRepresentationValidationError = validate$6(untrustedConfig_variables_item);
1453
1536
  if (referenceVariableRepresentationValidationError === null) {
1454
1537
  untrustedConfig_variables_array.push(untrustedConfig_variables_item);
1455
1538
  }
@@ -1458,30 +1541,30 @@ function typeCheckConfig(untrustedConfig) {
1458
1541
  }
1459
1542
  return config;
1460
1543
  }
1461
- function validateAdapterConfig(untrustedConfig, configPropertyNames) {
1544
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
1462
1545
  if (!untrustedIsObject(untrustedConfig)) {
1463
1546
  return null;
1464
1547
  }
1465
1548
  if (process.env.NODE_ENV !== 'production') {
1466
1549
  validateConfig(untrustedConfig, configPropertyNames);
1467
1550
  }
1468
- const config = typeCheckConfig(untrustedConfig);
1551
+ const config = typeCheckConfig$1(untrustedConfig);
1469
1552
  if (!areRequiredParametersPresent(config, configPropertyNames)) {
1470
1553
  return null;
1471
1554
  }
1472
1555
  return config;
1473
1556
  }
1474
- function buildNetworkSnapshot(luvio, config, options) {
1475
- const resourceParams = createResourceParams(config);
1476
- const request = createResourceRequest(resourceParams);
1557
+ function buildNetworkSnapshot$1(luvio, config, options) {
1558
+ const resourceParams = createResourceParams$1(config);
1559
+ const request = createResourceRequest$1(resourceParams);
1477
1560
  return luvio.dispatchResourceRequest(request, options)
1478
1561
  .then((response) => {
1479
1562
  return luvio.handleSuccessResponse(() => {
1480
- const snapshot = ingestSuccess(luvio, resourceParams, response);
1563
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response);
1481
1564
  return luvio.storeBroadcast().then(() => snapshot);
1482
1565
  }, () => {
1483
1566
  const cache = new StoreKeyMap();
1484
- getResponseCacheKeys(cache, luvio, resourceParams, response.body);
1567
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
1485
1568
  return cache;
1486
1569
  });
1487
1570
  }, (response) => {
@@ -1491,13 +1574,378 @@ function buildNetworkSnapshot(luvio, config, options) {
1491
1574
  }
1492
1575
  const sendMessageAdapterFactory = (luvio) => {
1493
1576
  return function sendMessage(untrustedConfig) {
1494
- const config = validateAdapterConfig(untrustedConfig, sendMessage_ConfigPropertyNames);
1577
+ const config = validateAdapterConfig$1(untrustedConfig, sendMessage_ConfigPropertyNames);
1495
1578
  // Invalid or incomplete config
1496
1579
  if (config === null) {
1497
1580
  throw new Error('Invalid config for "sendMessage"');
1498
1581
  }
1499
- return buildNetworkSnapshot(luvio, config);
1582
+ return buildNetworkSnapshot$1(luvio, config);
1583
+ };
1584
+ };
1585
+
1586
+ const VERSION$1 = "504437088c2317480c651ac05a7565b5";
1587
+ function validate$1(obj, path = 'PlanTemplateRepresentation') {
1588
+ const v_error = (() => {
1589
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1590
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1591
+ }
1592
+ const obj_intent = obj.intent;
1593
+ const path_intent = path + '.intent';
1594
+ if (typeof obj_intent !== 'string') {
1595
+ return new TypeError('Expected "string" but received "' + typeof obj_intent + '" (at "' + path_intent + '")');
1596
+ }
1597
+ const obj_label = obj.label;
1598
+ const path_label = path + '.label';
1599
+ if (typeof obj_label !== 'string') {
1600
+ return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
1601
+ }
1602
+ const obj_planTemplateId = obj.planTemplateId;
1603
+ const path_planTemplateId = path + '.planTemplateId';
1604
+ if (typeof obj_planTemplateId !== 'string') {
1605
+ return new TypeError('Expected "string" but received "' + typeof obj_planTemplateId + '" (at "' + path_planTemplateId + '")');
1606
+ }
1607
+ const obj_userUtterance = obj.userUtterance;
1608
+ const path_userUtterance = path + '.userUtterance';
1609
+ if (typeof obj_userUtterance !== 'string') {
1610
+ return new TypeError('Expected "string" but received "' + typeof obj_userUtterance + '" (at "' + path_userUtterance + '")');
1611
+ }
1612
+ const obj_variables = obj.variables;
1613
+ const path_variables = path + '.variables';
1614
+ if (typeof obj_variables !== 'object' || ArrayIsArray(obj_variables) || obj_variables === null) {
1615
+ return new TypeError('Expected "object" but received "' + typeof obj_variables + '" (at "' + path_variables + '")');
1616
+ }
1617
+ const obj_variables_keys = ObjectKeys(obj_variables);
1618
+ for (let i = 0; i < obj_variables_keys.length; i++) {
1619
+ const key = obj_variables_keys[i];
1620
+ const obj_variables_prop = obj_variables[key];
1621
+ const path_variables_prop = path_variables + '["' + key + '"]';
1622
+ if (typeof obj_variables_prop !== 'string') {
1623
+ return new TypeError('Expected "string" but received "' + typeof obj_variables_prop + '" (at "' + path_variables_prop + '")');
1624
+ }
1625
+ }
1626
+ })();
1627
+ return v_error === undefined ? null : v_error;
1628
+ }
1629
+ const select$2 = function PlanTemplateRepresentationSelect() {
1630
+ return {
1631
+ kind: 'Fragment',
1632
+ version: VERSION$1,
1633
+ private: [],
1634
+ selections: [
1635
+ {
1636
+ name: 'intent',
1637
+ kind: 'Scalar'
1638
+ },
1639
+ {
1640
+ name: 'label',
1641
+ kind: 'Scalar'
1642
+ },
1643
+ {
1644
+ name: 'planTemplateId',
1645
+ kind: 'Scalar'
1646
+ },
1647
+ {
1648
+ name: 'userUtterance',
1649
+ kind: 'Scalar'
1650
+ },
1651
+ {
1652
+ name: 'variables',
1653
+ kind: 'Scalar',
1654
+ map: true
1655
+ }
1656
+ ]
1657
+ };
1658
+ };
1659
+ function equals$1(existing, incoming) {
1660
+ const existing_intent = existing.intent;
1661
+ const incoming_intent = incoming.intent;
1662
+ if (!(existing_intent === incoming_intent)) {
1663
+ return false;
1664
+ }
1665
+ const existing_label = existing.label;
1666
+ const incoming_label = incoming.label;
1667
+ if (!(existing_label === incoming_label)) {
1668
+ return false;
1669
+ }
1670
+ const existing_planTemplateId = existing.planTemplateId;
1671
+ const incoming_planTemplateId = incoming.planTemplateId;
1672
+ if (!(existing_planTemplateId === incoming_planTemplateId)) {
1673
+ return false;
1674
+ }
1675
+ const existing_userUtterance = existing.userUtterance;
1676
+ const incoming_userUtterance = incoming.userUtterance;
1677
+ if (!(existing_userUtterance === incoming_userUtterance)) {
1678
+ return false;
1679
+ }
1680
+ const existing_variables = existing.variables;
1681
+ const incoming_variables = incoming.variables;
1682
+ const equals_variables_props = equalsObject(existing_variables, incoming_variables, (existing_variables_prop, incoming_variables_prop) => {
1683
+ if (!(existing_variables_prop === incoming_variables_prop)) {
1684
+ return false;
1685
+ }
1686
+ });
1687
+ if (equals_variables_props === false) {
1688
+ return false;
1689
+ }
1690
+ return true;
1691
+ }
1692
+
1693
+ const TTL = 900000;
1694
+ const VERSION = "0503b0c5ce250e7f5fbf16f2d3f2fec4";
1695
+ function validate(obj, path = 'RecommendedPlanTemplatesRepresentation') {
1696
+ const v_error = (() => {
1697
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1698
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1699
+ }
1700
+ if (obj.errorMessage !== undefined) {
1701
+ const obj_errorMessage = obj.errorMessage;
1702
+ const path_errorMessage = path + '.errorMessage';
1703
+ if (typeof obj_errorMessage !== 'string') {
1704
+ return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
1705
+ }
1706
+ }
1707
+ const obj_isSuccess = obj.isSuccess;
1708
+ const path_isSuccess = path + '.isSuccess';
1709
+ if (typeof obj_isSuccess !== 'boolean') {
1710
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
1711
+ }
1712
+ const obj_planTemplates = obj.planTemplates;
1713
+ const path_planTemplates = path + '.planTemplates';
1714
+ if (!ArrayIsArray(obj_planTemplates)) {
1715
+ return new TypeError('Expected "array" but received "' + typeof obj_planTemplates + '" (at "' + path_planTemplates + '")');
1716
+ }
1717
+ for (let i = 0; i < obj_planTemplates.length; i++) {
1718
+ const obj_planTemplates_item = obj_planTemplates[i];
1719
+ const path_planTemplates_item = path_planTemplates + '[' + i + ']';
1720
+ const referencepath_planTemplates_itemValidationError = validate$1(obj_planTemplates_item, path_planTemplates_item);
1721
+ if (referencepath_planTemplates_itemValidationError !== null) {
1722
+ let message = 'Object doesn\'t match PlanTemplateRepresentation (at "' + path_planTemplates_item + '")\n';
1723
+ message += referencepath_planTemplates_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1724
+ return new TypeError(message);
1725
+ }
1726
+ }
1727
+ })();
1728
+ return v_error === undefined ? null : v_error;
1729
+ }
1730
+ const RepresentationType = 'RecommendedPlanTemplatesRepresentation';
1731
+ function normalize(input, existing, path, luvio, store, timestamp) {
1732
+ return input;
1733
+ }
1734
+ const select$1 = function RecommendedPlanTemplatesRepresentationSelect() {
1735
+ const { selections: PlanTemplateRepresentation__selections, opaque: PlanTemplateRepresentation__opaque, } = select$2();
1736
+ return {
1737
+ kind: 'Fragment',
1738
+ version: VERSION,
1739
+ private: [],
1740
+ selections: [
1741
+ {
1742
+ name: 'errorMessage',
1743
+ kind: 'Scalar',
1744
+ required: false
1745
+ },
1746
+ {
1747
+ name: 'isSuccess',
1748
+ kind: 'Scalar'
1749
+ },
1750
+ {
1751
+ name: 'planTemplates',
1752
+ kind: 'Object',
1753
+ plural: true,
1754
+ selections: PlanTemplateRepresentation__selections
1755
+ }
1756
+ ]
1500
1757
  };
1501
1758
  };
1759
+ function equals(existing, incoming) {
1760
+ const existing_isSuccess = existing.isSuccess;
1761
+ const incoming_isSuccess = incoming.isSuccess;
1762
+ if (!(existing_isSuccess === incoming_isSuccess)) {
1763
+ return false;
1764
+ }
1765
+ const existing_errorMessage = existing.errorMessage;
1766
+ const incoming_errorMessage = incoming.errorMessage;
1767
+ // if at least one of these optionals is defined
1768
+ if (existing_errorMessage !== undefined || incoming_errorMessage !== undefined) {
1769
+ // if one of these is not defined we know the other is defined and therefore
1770
+ // not equal
1771
+ if (existing_errorMessage === undefined || incoming_errorMessage === undefined) {
1772
+ return false;
1773
+ }
1774
+ if (!(existing_errorMessage === incoming_errorMessage)) {
1775
+ return false;
1776
+ }
1777
+ }
1778
+ const existing_planTemplates = existing.planTemplates;
1779
+ const incoming_planTemplates = incoming.planTemplates;
1780
+ const equals_planTemplates_items = equalsArray(existing_planTemplates, incoming_planTemplates, (existing_planTemplates_item, incoming_planTemplates_item) => {
1781
+ if (!(equals$1(existing_planTemplates_item, incoming_planTemplates_item))) {
1782
+ return false;
1783
+ }
1784
+ });
1785
+ if (equals_planTemplates_items === false) {
1786
+ return false;
1787
+ }
1788
+ return true;
1789
+ }
1790
+ const ingest = function RecommendedPlanTemplatesRepresentationIngest(input, path, luvio, store, timestamp) {
1791
+ if (process.env.NODE_ENV !== 'production') {
1792
+ const validateError = validate(input);
1793
+ if (validateError !== null) {
1794
+ throw validateError;
1795
+ }
1796
+ }
1797
+ const key = path.fullPath;
1798
+ const ttlToUse = TTL;
1799
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "einstein-copilot-bot", VERSION, RepresentationType, equals);
1800
+ return createLink(key);
1801
+ };
1802
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
1803
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1804
+ const rootKey = fullPathFactory();
1805
+ rootKeySet.set(rootKey, {
1806
+ namespace: keyPrefix,
1807
+ representationName: RepresentationType,
1808
+ mergeable: false
1809
+ });
1810
+ }
1811
+
1812
+ function select(luvio, params) {
1813
+ return select$1();
1814
+ }
1815
+ function keyBuilder$1(luvio, params) {
1816
+ return keyPrefix + '::RecommendedPlanTemplatesRepresentation:(' + 'pageType:' + params.urlParams.pageType + ',' + 'objectType:' + params.urlParams.objectType + ')';
1817
+ }
1818
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
1819
+ getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
1820
+ }
1821
+ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
1822
+ const { body } = response;
1823
+ const key = keyBuilder$1(luvio, resourceParams);
1824
+ luvio.storeIngest(key, ingest, body);
1825
+ const snapshot = luvio.storeLookup({
1826
+ recordId: key,
1827
+ node: select(),
1828
+ variables: {},
1829
+ }, snapshotRefresh);
1830
+ if (process.env.NODE_ENV !== 'production') {
1831
+ if (snapshot.state !== 'Fulfilled') {
1832
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1833
+ }
1834
+ }
1835
+ deepFreeze(snapshot.data);
1836
+ return snapshot;
1837
+ }
1838
+ function ingestError(luvio, params, error, snapshotRefresh) {
1839
+ const key = keyBuilder$1(luvio, params);
1840
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1841
+ const storeMetadataParams = {
1842
+ ttl: TTL,
1843
+ namespace: keyPrefix,
1844
+ version: VERSION,
1845
+ representationName: RepresentationType
1846
+ };
1847
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
1848
+ return errorSnapshot;
1849
+ }
1850
+ function createResourceRequest(config) {
1851
+ const headers = {};
1852
+ return {
1853
+ baseUri: '/services/data/v60.0',
1854
+ basePath: '/connect/recommended-plan-templates/' + config.urlParams.pageType + '/' + config.urlParams.objectType + '',
1855
+ method: 'get',
1856
+ body: null,
1857
+ urlParams: config.urlParams,
1858
+ queryParams: {},
1859
+ headers,
1860
+ priority: 'normal',
1861
+ };
1862
+ }
1863
+
1864
+ const adapterName = 'getRecommendedPlanTemplates';
1865
+ const getRecommendedPlanTemplates_ConfigPropertyMetadata = [
1866
+ generateParamConfigMetadata('pageType', true, 0 /* UrlParameter */, 0 /* String */),
1867
+ generateParamConfigMetadata('objectType', true, 0 /* UrlParameter */, 0 /* String */),
1868
+ ];
1869
+ const getRecommendedPlanTemplates_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getRecommendedPlanTemplates_ConfigPropertyMetadata);
1870
+ const createResourceParams = /*#__PURE__*/ createResourceParams$3(getRecommendedPlanTemplates_ConfigPropertyMetadata);
1871
+ function keyBuilder(luvio, config) {
1872
+ const resourceParams = createResourceParams(config);
1873
+ return keyBuilder$1(luvio, resourceParams);
1874
+ }
1875
+ function typeCheckConfig(untrustedConfig) {
1876
+ const config = {};
1877
+ typeCheckConfig$3(untrustedConfig, config, getRecommendedPlanTemplates_ConfigPropertyMetadata);
1878
+ return config;
1879
+ }
1880
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
1881
+ if (!untrustedIsObject(untrustedConfig)) {
1882
+ return null;
1883
+ }
1884
+ if (process.env.NODE_ENV !== 'production') {
1885
+ validateConfig(untrustedConfig, configPropertyNames);
1886
+ }
1887
+ const config = typeCheckConfig(untrustedConfig);
1888
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1889
+ return null;
1890
+ }
1891
+ return config;
1892
+ }
1893
+ function adapterFragment(luvio, config) {
1894
+ createResourceParams(config);
1895
+ return select();
1896
+ }
1897
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
1898
+ const snapshot = ingestSuccess(luvio, resourceParams, response, {
1899
+ config,
1900
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1901
+ });
1902
+ return luvio.storeBroadcast().then(() => snapshot);
1903
+ }
1904
+ function onFetchResponseError(luvio, config, resourceParams, response) {
1905
+ const snapshot = ingestError(luvio, resourceParams, response, {
1906
+ config,
1907
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1908
+ });
1909
+ return luvio.storeBroadcast().then(() => snapshot);
1910
+ }
1911
+ function buildNetworkSnapshot(luvio, config, options) {
1912
+ const resourceParams = createResourceParams(config);
1913
+ const request = createResourceRequest(resourceParams);
1914
+ return luvio.dispatchResourceRequest(request, options)
1915
+ .then((response) => {
1916
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
1917
+ const cache = new StoreKeyMap();
1918
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
1919
+ return cache;
1920
+ });
1921
+ }, (response) => {
1922
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
1923
+ });
1924
+ }
1925
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
1926
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
1927
+ }
1928
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
1929
+ const { luvio, config } = context;
1930
+ const selector = {
1931
+ recordId: keyBuilder(luvio, config),
1932
+ node: adapterFragment(luvio, config),
1933
+ variables: {},
1934
+ };
1935
+ const cacheSnapshot = storeLookup(selector, {
1936
+ config,
1937
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1938
+ });
1939
+ return cacheSnapshot;
1940
+ }
1941
+ const getRecommendedPlanTemplatesAdapterFactory = (luvio) => function einsteinCopilotBot__getRecommendedPlanTemplates(untrustedConfig, requestContext) {
1942
+ const config = validateAdapterConfig(untrustedConfig, getRecommendedPlanTemplates_ConfigPropertyNames);
1943
+ // Invalid or incomplete config
1944
+ if (config === null) {
1945
+ return null;
1946
+ }
1947
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1948
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
1949
+ };
1502
1950
 
1503
- export { getBotIdAdapterFactory, sendMessageAdapterFactory };
1951
+ export { getBotIdAdapterFactory, getRecommendedPlanTemplatesAdapterFactory, sendMessageAdapterFactory };