@salesforce/lds-adapters-service-einstein-copilot-bot 1.266.0-dev17 → 1.266.0-dev18
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.
- package/dist/es/es2018/service-einstein-copilot-bot.js +553 -160
- package/dist/es/es2018/types/src/generated/adapters/getRecommendedPlanTemplates.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/adapters/sendMessage.d.ts +4 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +1 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +3 -1
- package/dist/es/es2018/types/src/generated/resources/getConnectRecommendedPlanTemplatesByPageTypeAndObjectType.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/resources/postConnectConversationRuntimeProxy.d.ts +4 -0
- package/dist/es/es2018/types/src/generated/types/ConversationRuntimeProxyInputRepresentation.d.ts +13 -1
- package/dist/es/es2018/types/src/generated/types/PlanTemplateRepresentation.d.ts +45 -0
- package/dist/es/es2018/types/src/generated/types/RecommendedPlanTemplatesRepresentation.d.ts +36 -0
- package/dist/es/es2018/types/src/generated/types/VariableRepresentation.d.ts +3 -3
- package/package.json +3 -3
- package/sfdc/index.js +447 -38
- package/src/raml/api.raml +76 -0
- package/src/raml/luvio.raml +8 -0
|
@@ -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$
|
|
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$
|
|
96
|
-
const VERSION$
|
|
97
|
-
function validate$
|
|
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$
|
|
125
|
-
function normalize$
|
|
144
|
+
const RepresentationType$3 = 'CopilotBotInfoRepresentation';
|
|
145
|
+
function normalize$3(input, existing, path, luvio, store, timestamp) {
|
|
126
146
|
return input;
|
|
127
147
|
}
|
|
128
|
-
const select$
|
|
148
|
+
const select$a = function CopilotBotInfoRepresentationSelect() {
|
|
129
149
|
return {
|
|
130
150
|
kind: 'Fragment',
|
|
131
|
-
version: VERSION$
|
|
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$
|
|
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$
|
|
205
|
+
const ingest$3 = function CopilotBotInfoRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
186
206
|
if (process.env.NODE_ENV !== 'production') {
|
|
187
|
-
const validateError = validate$
|
|
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$
|
|
194
|
-
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$
|
|
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$
|
|
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$
|
|
222
|
+
representationName: RepresentationType$3,
|
|
203
223
|
mergeable: false
|
|
204
224
|
});
|
|
205
225
|
}
|
|
206
226
|
|
|
207
|
-
function select$
|
|
208
|
-
return select$
|
|
227
|
+
function select$9(luvio, params) {
|
|
228
|
+
return select$a();
|
|
209
229
|
}
|
|
210
|
-
function keyBuilder$
|
|
230
|
+
function keyBuilder$5(luvio, params) {
|
|
211
231
|
return keyPrefix + '::CopilotBotInfoRepresentation:(' + ')';
|
|
212
232
|
}
|
|
213
|
-
function getResponseCacheKeys$
|
|
214
|
-
getTypeCacheKeys$
|
|
233
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
234
|
+
getTypeCacheKeys$3(storeKeyMap, luvio, response, () => keyBuilder$5());
|
|
215
235
|
}
|
|
216
|
-
function ingestSuccess$
|
|
236
|
+
function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
|
|
217
237
|
const { body } = response;
|
|
218
|
-
const key = keyBuilder$
|
|
219
|
-
luvio.storeIngest(key, ingest$
|
|
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$
|
|
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$
|
|
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$
|
|
257
|
+
ttl: TTL$3,
|
|
238
258
|
namespace: keyPrefix,
|
|
239
|
-
version: VERSION$
|
|
240
|
-
representationName: RepresentationType$
|
|
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$
|
|
265
|
+
function createResourceRequest$2(config) {
|
|
246
266
|
const headers = {};
|
|
247
267
|
return {
|
|
248
268
|
baseUri: '/services/data/v60.0',
|
|
@@ -256,91 +276,91 @@ function createResourceRequest$1(config) {
|
|
|
256
276
|
};
|
|
257
277
|
}
|
|
258
278
|
|
|
259
|
-
const adapterName$
|
|
279
|
+
const adapterName$2 = 'getBotId';
|
|
260
280
|
const getBotId_ConfigPropertyMetadata = [];
|
|
261
|
-
const getBotId_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$
|
|
262
|
-
const createResourceParams$
|
|
263
|
-
function keyBuilder$
|
|
264
|
-
createResourceParams$
|
|
265
|
-
return keyBuilder$
|
|
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$
|
|
287
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
268
288
|
const config = {};
|
|
269
289
|
return config;
|
|
270
290
|
}
|
|
271
|
-
function validateAdapterConfig$
|
|
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$
|
|
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$
|
|
286
|
-
return select$
|
|
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$
|
|
308
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
309
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
|
|
290
310
|
config,
|
|
291
|
-
resolve: () => buildNetworkSnapshot$
|
|
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$
|
|
318
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
299
319
|
});
|
|
300
320
|
return luvio.storeBroadcast().then(() => snapshot);
|
|
301
321
|
}
|
|
302
|
-
function buildNetworkSnapshot$
|
|
303
|
-
const resourceParams = createResourceParams$
|
|
304
|
-
const request = createResourceRequest$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
343
|
-
function validate$
|
|
362
|
+
const VERSION$6 = "62bc08357d634ed38883e4b936473a49";
|
|
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 + '")');
|
|
@@ -384,10 +404,10 @@ function validate$5(obj, path = 'EsTypeMessageRepresentation') {
|
|
|
384
404
|
})();
|
|
385
405
|
return v_error === undefined ? null : v_error;
|
|
386
406
|
}
|
|
387
|
-
const select$
|
|
407
|
+
const select$8 = function EsTypeMessageRepresentationSelect() {
|
|
388
408
|
return {
|
|
389
409
|
kind: 'Fragment',
|
|
390
|
-
version: VERSION$
|
|
410
|
+
version: VERSION$6,
|
|
391
411
|
private: [],
|
|
392
412
|
selections: [
|
|
393
413
|
{
|
|
@@ -406,7 +426,7 @@ const select$5 = function EsTypeMessageRepresentationSelect() {
|
|
|
406
426
|
]
|
|
407
427
|
};
|
|
408
428
|
};
|
|
409
|
-
function equals$
|
|
429
|
+
function equals$6(existing, incoming) {
|
|
410
430
|
const existing_type = existing.type;
|
|
411
431
|
const incoming_type = incoming.type;
|
|
412
432
|
if (!(existing_type === incoming_type)) {
|
|
@@ -425,7 +445,7 @@ function equals$4(existing, incoming) {
|
|
|
425
445
|
return true;
|
|
426
446
|
}
|
|
427
447
|
|
|
428
|
-
function validate$
|
|
448
|
+
function validate$6(obj, path = 'VariableRepresentation') {
|
|
429
449
|
const v_error = (() => {
|
|
430
450
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
431
451
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -435,17 +455,19 @@ function validate$4(obj, path = 'VariableRepresentation') {
|
|
|
435
455
|
if (typeof obj_name !== 'string') {
|
|
436
456
|
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
437
457
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
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
|
+
}
|
|
442
464
|
}
|
|
443
465
|
})();
|
|
444
466
|
return v_error === undefined ? null : v_error;
|
|
445
467
|
}
|
|
446
468
|
|
|
447
|
-
const VERSION$
|
|
448
|
-
function validate$
|
|
469
|
+
const VERSION$5 = "4e28b61c3ea362f1c68b28897784111e";
|
|
470
|
+
function validate$5(obj, path = 'ConversationRuntimeProxyChoiceRepresentation') {
|
|
449
471
|
const v_error = (() => {
|
|
450
472
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
451
473
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -463,10 +485,10 @@ function validate$3(obj, path = 'ConversationRuntimeProxyChoiceRepresentation')
|
|
|
463
485
|
})();
|
|
464
486
|
return v_error === undefined ? null : v_error;
|
|
465
487
|
}
|
|
466
|
-
const select$
|
|
488
|
+
const select$7 = function ConversationRuntimeProxyChoiceRepresentationSelect() {
|
|
467
489
|
return {
|
|
468
490
|
kind: 'Fragment',
|
|
469
|
-
version: VERSION$
|
|
491
|
+
version: VERSION$5,
|
|
470
492
|
private: [],
|
|
471
493
|
selections: [
|
|
472
494
|
{
|
|
@@ -480,7 +502,7 @@ const select$4 = function ConversationRuntimeProxyChoiceRepresentationSelect() {
|
|
|
480
502
|
]
|
|
481
503
|
};
|
|
482
504
|
};
|
|
483
|
-
function equals$
|
|
505
|
+
function equals$5(existing, incoming) {
|
|
484
506
|
const existing_alias = existing.alias;
|
|
485
507
|
const incoming_alias = incoming.alias;
|
|
486
508
|
if (!(existing_alias === incoming_alias)) {
|
|
@@ -494,15 +516,15 @@ function equals$3(existing, incoming) {
|
|
|
494
516
|
return true;
|
|
495
517
|
}
|
|
496
518
|
|
|
497
|
-
const VERSION$
|
|
498
|
-
function validate$
|
|
519
|
+
const VERSION$4 = "301ceee5b86e4e56526252efbbf70520";
|
|
520
|
+
function validate$4(obj, path = 'CollectMessageRepresentation') {
|
|
499
521
|
const v_error = (() => {
|
|
500
522
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
501
523
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
502
524
|
}
|
|
503
525
|
const obj_data = obj.data;
|
|
504
526
|
const path_data = path + '.data';
|
|
505
|
-
const referencepath_dataValidationError = validate$
|
|
527
|
+
const referencepath_dataValidationError = validate$7(obj_data, path_data);
|
|
506
528
|
if (referencepath_dataValidationError !== null) {
|
|
507
529
|
let message = 'Object doesn\'t match EsTypeMessageRepresentation (at "' + path_data + '")\n';
|
|
508
530
|
message += referencepath_dataValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
@@ -542,11 +564,11 @@ function validate$2(obj, path = 'CollectMessageRepresentation') {
|
|
|
542
564
|
})();
|
|
543
565
|
return v_error === undefined ? null : v_error;
|
|
544
566
|
}
|
|
545
|
-
const select$
|
|
546
|
-
const { selections: EsTypeMessageRepresentation__selections, opaque: EsTypeMessageRepresentation__opaque, } = select$
|
|
567
|
+
const select$6 = function CollectMessageRepresentationSelect() {
|
|
568
|
+
const { selections: EsTypeMessageRepresentation__selections, opaque: EsTypeMessageRepresentation__opaque, } = select$8();
|
|
547
569
|
return {
|
|
548
570
|
kind: 'Fragment',
|
|
549
|
-
version: VERSION$
|
|
571
|
+
version: VERSION$4,
|
|
550
572
|
private: [],
|
|
551
573
|
selections: [
|
|
552
574
|
{
|
|
@@ -565,7 +587,7 @@ const select$3 = function CollectMessageRepresentationSelect() {
|
|
|
565
587
|
]
|
|
566
588
|
};
|
|
567
589
|
};
|
|
568
|
-
function equals$
|
|
590
|
+
function equals$4(existing, incoming) {
|
|
569
591
|
const existing_targetType = existing.targetType;
|
|
570
592
|
const incoming_targetType = incoming.targetType;
|
|
571
593
|
if (!(existing_targetType === incoming_targetType)) {
|
|
@@ -573,7 +595,7 @@ function equals$2(existing, incoming) {
|
|
|
573
595
|
}
|
|
574
596
|
const existing_data = existing.data;
|
|
575
597
|
const incoming_data = incoming.data;
|
|
576
|
-
if (!(equals$
|
|
598
|
+
if (!(equals$6(existing_data, incoming_data))) {
|
|
577
599
|
return false;
|
|
578
600
|
}
|
|
579
601
|
const existing_targetProperty = existing.targetProperty;
|
|
@@ -584,9 +606,9 @@ function equals$2(existing, incoming) {
|
|
|
584
606
|
return true;
|
|
585
607
|
}
|
|
586
608
|
|
|
587
|
-
const TTL$
|
|
588
|
-
const VERSION$
|
|
589
|
-
function validate$
|
|
609
|
+
const TTL$2 = 30000;
|
|
610
|
+
const VERSION$3 = "d3d34b56efe68a37c173d0cb91c57ba1";
|
|
611
|
+
function validate$3(obj, path = 'ConversationRuntimeProxyMessageRepresentation') {
|
|
590
612
|
const v_error = (() => {
|
|
591
613
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
592
614
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -600,7 +622,7 @@ function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
|
|
|
600
622
|
for (let i = 0; i < obj_choices.length; i++) {
|
|
601
623
|
const obj_choices_item = obj_choices[i];
|
|
602
624
|
const path_choices_item = path_choices + '[' + i + ']';
|
|
603
|
-
const referencepath_choices_itemValidationError = validate$
|
|
625
|
+
const referencepath_choices_itemValidationError = validate$5(obj_choices_item, path_choices_item);
|
|
604
626
|
if (referencepath_choices_itemValidationError !== null) {
|
|
605
627
|
let message = 'Object doesn\'t match ConversationRuntimeProxyChoiceRepresentation (at "' + path_choices_item + '")\n';
|
|
606
628
|
message += referencepath_choices_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
@@ -617,7 +639,7 @@ function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
|
|
|
617
639
|
for (let i = 0; i < obj_collect.length; i++) {
|
|
618
640
|
const obj_collect_item = obj_collect[i];
|
|
619
641
|
const path_collect_item = path_collect + '[' + i + ']';
|
|
620
|
-
const referencepath_collect_itemValidationError = validate$
|
|
642
|
+
const referencepath_collect_itemValidationError = validate$4(obj_collect_item, path_collect_item);
|
|
621
643
|
if (referencepath_collect_itemValidationError !== null) {
|
|
622
644
|
let message = 'Object doesn\'t match CollectMessageRepresentation (at "' + path_collect_item + '")\n';
|
|
623
645
|
message += referencepath_collect_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
@@ -634,7 +656,7 @@ function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
|
|
|
634
656
|
for (let i = 0; i < obj_confirm.length; i++) {
|
|
635
657
|
const obj_confirm_item = obj_confirm[i];
|
|
636
658
|
const path_confirm_item = path_confirm + '[' + i + ']';
|
|
637
|
-
const referencepath_confirm_itemValidationError = validate$
|
|
659
|
+
const referencepath_confirm_itemValidationError = validate$7(obj_confirm_item, path_confirm_item);
|
|
638
660
|
if (referencepath_confirm_itemValidationError !== null) {
|
|
639
661
|
let message = 'Object doesn\'t match EsTypeMessageRepresentation (at "' + path_confirm_item + '")\n';
|
|
640
662
|
message += referencepath_confirm_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
@@ -806,7 +828,7 @@ function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
|
|
|
806
828
|
for (let i = 0; i < obj_result.length; i++) {
|
|
807
829
|
const obj_result_item = obj_result[i];
|
|
808
830
|
const path_result_item = path_result + '[' + i + ']';
|
|
809
|
-
const referencepath_result_itemValidationError = validate$
|
|
831
|
+
const referencepath_result_itemValidationError = validate$7(obj_result_item, path_result_item);
|
|
810
832
|
if (referencepath_result_itemValidationError !== null) {
|
|
811
833
|
let message = 'Object doesn\'t match EsTypeMessageRepresentation (at "' + path_result_item + '")\n';
|
|
812
834
|
message += referencepath_result_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
@@ -880,26 +902,26 @@ function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
|
|
|
880
902
|
})();
|
|
881
903
|
return v_error === undefined ? null : v_error;
|
|
882
904
|
}
|
|
883
|
-
const RepresentationType$
|
|
884
|
-
function keyBuilder$
|
|
885
|
-
return keyPrefix + '::' + RepresentationType$
|
|
905
|
+
const RepresentationType$2 = 'ConversationRuntimeProxyMessageRepresentation';
|
|
906
|
+
function keyBuilder$3(luvio, config) {
|
|
907
|
+
return keyPrefix + '::' + RepresentationType$2 + ':' + config.id;
|
|
886
908
|
}
|
|
887
909
|
function keyBuilderFromType$1(luvio, object) {
|
|
888
910
|
const keyParams = {
|
|
889
911
|
id: object.id
|
|
890
912
|
};
|
|
891
|
-
return keyBuilder$
|
|
913
|
+
return keyBuilder$3(luvio, keyParams);
|
|
892
914
|
}
|
|
893
|
-
function normalize$
|
|
915
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
894
916
|
return input;
|
|
895
917
|
}
|
|
896
|
-
const select$
|
|
897
|
-
const { selections: ConversationRuntimeProxyChoiceRepresentation__selections, opaque: ConversationRuntimeProxyChoiceRepresentation__opaque, } = select$
|
|
898
|
-
const { selections: CollectMessageRepresentation__selections, opaque: CollectMessageRepresentation__opaque, } = select$
|
|
899
|
-
const { selections: EsTypeMessageRepresentation__selections, opaque: EsTypeMessageRepresentation__opaque, } = select$
|
|
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();
|
|
900
922
|
return {
|
|
901
923
|
kind: 'Fragment',
|
|
902
|
-
version: VERSION$
|
|
924
|
+
version: VERSION$3,
|
|
903
925
|
private: [],
|
|
904
926
|
selections: [
|
|
905
927
|
{
|
|
@@ -981,7 +1003,7 @@ const select$2 = function ConversationRuntimeProxyMessageRepresentationSelect()
|
|
|
981
1003
|
]
|
|
982
1004
|
};
|
|
983
1005
|
};
|
|
984
|
-
function equals$
|
|
1006
|
+
function equals$3(existing, incoming) {
|
|
985
1007
|
const existing_id = existing.id;
|
|
986
1008
|
const incoming_id = incoming.id;
|
|
987
1009
|
if (!(existing_id === incoming_id)) {
|
|
@@ -1010,7 +1032,7 @@ function equals$1(existing, incoming) {
|
|
|
1010
1032
|
return false;
|
|
1011
1033
|
}
|
|
1012
1034
|
const equals_choices_items = equalsArray(existing_choices, incoming_choices, (existing_choices_item, incoming_choices_item) => {
|
|
1013
|
-
if (!(equals$
|
|
1035
|
+
if (!(equals$5(existing_choices_item, incoming_choices_item))) {
|
|
1014
1036
|
return false;
|
|
1015
1037
|
}
|
|
1016
1038
|
});
|
|
@@ -1028,7 +1050,7 @@ function equals$1(existing, incoming) {
|
|
|
1028
1050
|
return false;
|
|
1029
1051
|
}
|
|
1030
1052
|
const equals_collect_items = equalsArray(existing_collect, incoming_collect, (existing_collect_item, incoming_collect_item) => {
|
|
1031
|
-
if (!(equals$
|
|
1053
|
+
if (!(equals$4(existing_collect_item, incoming_collect_item))) {
|
|
1032
1054
|
return false;
|
|
1033
1055
|
}
|
|
1034
1056
|
});
|
|
@@ -1046,7 +1068,7 @@ function equals$1(existing, incoming) {
|
|
|
1046
1068
|
return false;
|
|
1047
1069
|
}
|
|
1048
1070
|
const equals_confirm_items = equalsArray(existing_confirm, incoming_confirm, (existing_confirm_item, incoming_confirm_item) => {
|
|
1049
|
-
if (!(equals$
|
|
1071
|
+
if (!(equals$6(existing_confirm_item, incoming_confirm_item))) {
|
|
1050
1072
|
return false;
|
|
1051
1073
|
}
|
|
1052
1074
|
});
|
|
@@ -1131,7 +1153,7 @@ function equals$1(existing, incoming) {
|
|
|
1131
1153
|
return false;
|
|
1132
1154
|
}
|
|
1133
1155
|
const equals_result_items = equalsArray(existing_result, incoming_result, (existing_result_item, incoming_result_item) => {
|
|
1134
|
-
if (!(equals$
|
|
1156
|
+
if (!(equals$6(existing_result_item, incoming_result_item))) {
|
|
1135
1157
|
return false;
|
|
1136
1158
|
}
|
|
1137
1159
|
});
|
|
@@ -1167,31 +1189,31 @@ function equals$1(existing, incoming) {
|
|
|
1167
1189
|
}
|
|
1168
1190
|
return true;
|
|
1169
1191
|
}
|
|
1170
|
-
const ingest$
|
|
1192
|
+
const ingest$2 = function ConversationRuntimeProxyMessageRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1171
1193
|
if (process.env.NODE_ENV !== 'production') {
|
|
1172
|
-
const validateError = validate$
|
|
1194
|
+
const validateError = validate$3(input);
|
|
1173
1195
|
if (validateError !== null) {
|
|
1174
1196
|
throw validateError;
|
|
1175
1197
|
}
|
|
1176
1198
|
}
|
|
1177
1199
|
const key = keyBuilderFromType$1(luvio, input);
|
|
1178
|
-
const ttlToUse = TTL$
|
|
1179
|
-
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$
|
|
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);
|
|
1180
1202
|
return createLink(key);
|
|
1181
1203
|
};
|
|
1182
|
-
function getTypeCacheKeys$
|
|
1204
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
1183
1205
|
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1184
1206
|
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
1185
1207
|
rootKeySet.set(rootKey, {
|
|
1186
1208
|
namespace: keyPrefix,
|
|
1187
|
-
representationName: RepresentationType$
|
|
1209
|
+
representationName: RepresentationType$2,
|
|
1188
1210
|
mergeable: false
|
|
1189
1211
|
});
|
|
1190
1212
|
}
|
|
1191
1213
|
|
|
1192
|
-
const TTL = 30000;
|
|
1193
|
-
const VERSION = "fe7024fb1132250f97d9616482f09f99";
|
|
1194
|
-
function validate(obj, path = 'ConversationRuntimeProxyRepresentation') {
|
|
1214
|
+
const TTL$1 = 30000;
|
|
1215
|
+
const VERSION$2 = "fe7024fb1132250f97d9616482f09f99";
|
|
1216
|
+
function validate$2(obj, path = 'ConversationRuntimeProxyRepresentation') {
|
|
1195
1217
|
const v_error = (() => {
|
|
1196
1218
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1197
1219
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -1243,23 +1265,23 @@ function validate(obj, path = 'ConversationRuntimeProxyRepresentation') {
|
|
|
1243
1265
|
})();
|
|
1244
1266
|
return v_error === undefined ? null : v_error;
|
|
1245
1267
|
}
|
|
1246
|
-
const RepresentationType = 'ConversationRuntimeProxyRepresentation';
|
|
1247
|
-
function keyBuilder(luvio, config) {
|
|
1248
|
-
return keyPrefix + '::' + RepresentationType + ':' + config.id;
|
|
1268
|
+
const RepresentationType$1 = 'ConversationRuntimeProxyRepresentation';
|
|
1269
|
+
function keyBuilder$2(luvio, config) {
|
|
1270
|
+
return keyPrefix + '::' + RepresentationType$1 + ':' + config.id;
|
|
1249
1271
|
}
|
|
1250
1272
|
function keyBuilderFromType(luvio, object) {
|
|
1251
1273
|
const keyParams = {
|
|
1252
1274
|
id: object.requestId
|
|
1253
1275
|
};
|
|
1254
|
-
return keyBuilder(luvio, keyParams);
|
|
1276
|
+
return keyBuilder$2(luvio, keyParams);
|
|
1255
1277
|
}
|
|
1256
|
-
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
1278
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
1257
1279
|
const input_messages = input.messages;
|
|
1258
1280
|
const input_messages_id = path.fullPath + '__messages';
|
|
1259
1281
|
for (let i = 0; i < input_messages.length; i++) {
|
|
1260
1282
|
const input_messages_item = input_messages[i];
|
|
1261
1283
|
let input_messages_item_id = input_messages_id + '__' + i;
|
|
1262
|
-
input_messages[i] = ingest$
|
|
1284
|
+
input_messages[i] = ingest$2(input_messages_item, {
|
|
1263
1285
|
fullPath: input_messages_item_id,
|
|
1264
1286
|
propertyName: i,
|
|
1265
1287
|
parent: {
|
|
@@ -1272,10 +1294,10 @@ function normalize(input, existing, path, luvio, store, timestamp) {
|
|
|
1272
1294
|
}
|
|
1273
1295
|
return input;
|
|
1274
1296
|
}
|
|
1275
|
-
const select$
|
|
1297
|
+
const select$4 = function ConversationRuntimeProxyRepresentationSelect() {
|
|
1276
1298
|
return {
|
|
1277
1299
|
kind: 'Fragment',
|
|
1278
|
-
version: VERSION,
|
|
1300
|
+
version: VERSION$2,
|
|
1279
1301
|
private: [],
|
|
1280
1302
|
selections: [
|
|
1281
1303
|
{
|
|
@@ -1290,7 +1312,7 @@ const select$1 = function ConversationRuntimeProxyRepresentationSelect() {
|
|
|
1290
1312
|
name: 'messages',
|
|
1291
1313
|
kind: 'Link',
|
|
1292
1314
|
plural: true,
|
|
1293
|
-
fragment: select$
|
|
1315
|
+
fragment: select$5()
|
|
1294
1316
|
},
|
|
1295
1317
|
{
|
|
1296
1318
|
name: 'processedSequenceIds',
|
|
@@ -1308,7 +1330,7 @@ const select$1 = function ConversationRuntimeProxyRepresentationSelect() {
|
|
|
1308
1330
|
]
|
|
1309
1331
|
};
|
|
1310
1332
|
};
|
|
1311
|
-
function equals(existing, incoming) {
|
|
1333
|
+
function equals$2(existing, incoming) {
|
|
1312
1334
|
const existing_botId = existing.botId;
|
|
1313
1335
|
const incoming_botId = incoming.botId;
|
|
1314
1336
|
if (!(existing_botId === incoming_botId)) {
|
|
@@ -1351,45 +1373,45 @@ function equals(existing, incoming) {
|
|
|
1351
1373
|
}
|
|
1352
1374
|
return true;
|
|
1353
1375
|
}
|
|
1354
|
-
const ingest = function ConversationRuntimeProxyRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1376
|
+
const ingest$1 = function ConversationRuntimeProxyRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1355
1377
|
if (process.env.NODE_ENV !== 'production') {
|
|
1356
|
-
const validateError = validate(input);
|
|
1378
|
+
const validateError = validate$2(input);
|
|
1357
1379
|
if (validateError !== null) {
|
|
1358
1380
|
throw validateError;
|
|
1359
1381
|
}
|
|
1360
1382
|
}
|
|
1361
1383
|
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);
|
|
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);
|
|
1364
1386
|
return createLink(key);
|
|
1365
1387
|
};
|
|
1366
|
-
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
1388
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
1367
1389
|
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1368
1390
|
const rootKey = keyBuilderFromType(luvio, input);
|
|
1369
1391
|
rootKeySet.set(rootKey, {
|
|
1370
1392
|
namespace: keyPrefix,
|
|
1371
|
-
representationName: RepresentationType,
|
|
1393
|
+
representationName: RepresentationType$1,
|
|
1372
1394
|
mergeable: false
|
|
1373
1395
|
});
|
|
1374
1396
|
const input_messages_length = input.messages.length;
|
|
1375
1397
|
for (let i = 0; i < input_messages_length; i++) {
|
|
1376
|
-
getTypeCacheKeys$
|
|
1398
|
+
getTypeCacheKeys$2(rootKeySet, luvio, input.messages[i]);
|
|
1377
1399
|
}
|
|
1378
1400
|
}
|
|
1379
1401
|
|
|
1380
|
-
function select(luvio, params) {
|
|
1381
|
-
return select$
|
|
1402
|
+
function select$3(luvio, params) {
|
|
1403
|
+
return select$4();
|
|
1382
1404
|
}
|
|
1383
|
-
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
1384
|
-
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
1405
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
1406
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response);
|
|
1385
1407
|
}
|
|
1386
|
-
function ingestSuccess(luvio, resourceParams, response) {
|
|
1408
|
+
function ingestSuccess$1(luvio, resourceParams, response) {
|
|
1387
1409
|
const { body } = response;
|
|
1388
1410
|
const key = keyBuilderFromType(luvio, body);
|
|
1389
|
-
luvio.storeIngest(key, ingest, body);
|
|
1411
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
1390
1412
|
const snapshot = luvio.storeLookup({
|
|
1391
1413
|
recordId: key,
|
|
1392
|
-
node: select(),
|
|
1414
|
+
node: select$3(),
|
|
1393
1415
|
variables: {},
|
|
1394
1416
|
});
|
|
1395
1417
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -1400,7 +1422,7 @@ function ingestSuccess(luvio, resourceParams, response) {
|
|
|
1400
1422
|
deepFreeze(snapshot.data);
|
|
1401
1423
|
return snapshot;
|
|
1402
1424
|
}
|
|
1403
|
-
function createResourceRequest(config) {
|
|
1425
|
+
function createResourceRequest$1(config) {
|
|
1404
1426
|
const headers = {};
|
|
1405
1427
|
return {
|
|
1406
1428
|
baseUri: '/services/data/v60.0',
|
|
@@ -1414,30 +1436,36 @@ function createResourceRequest(config) {
|
|
|
1414
1436
|
};
|
|
1415
1437
|
}
|
|
1416
1438
|
|
|
1417
|
-
const adapterName = 'sendMessage';
|
|
1439
|
+
const adapterName$1 = 'sendMessage';
|
|
1418
1440
|
const sendMessage_ConfigPropertyMetadata = [
|
|
1419
1441
|
generateParamConfigMetadata('botId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1420
1442
|
generateParamConfigMetadata('botVersionId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1421
1443
|
generateParamConfigMetadata('message', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1422
1444
|
generateParamConfigMetadata('sessionId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1423
1445
|
generateParamConfigMetadata('inReplyToMessageId', false, 2 /* Body */, 0 /* String */),
|
|
1446
|
+
generateParamConfigMetadata('intent', false, 2 /* Body */, 0 /* String */),
|
|
1424
1447
|
generateParamConfigMetadata('messageType', false, 2 /* Body */, 0 /* String */),
|
|
1448
|
+
generateParamConfigMetadata('planId', false, 2 /* Body */, 0 /* String */),
|
|
1449
|
+
generateParamConfigMetadata('planTemplateVariables', false, 2 /* Body */, 4 /* Unsupported */),
|
|
1425
1450
|
generateParamConfigMetadata('reply', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
1426
1451
|
generateParamConfigMetadata('text', false, 2 /* Body */, 0 /* String */),
|
|
1427
1452
|
generateParamConfigMetadata('type', false, 2 /* Body */, 0 /* String */),
|
|
1453
|
+
generateParamConfigMetadata('userUtterance', false, 2 /* Body */, 0 /* String */),
|
|
1428
1454
|
generateParamConfigMetadata('variables', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
1429
1455
|
];
|
|
1430
|
-
const sendMessage_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, sendMessage_ConfigPropertyMetadata);
|
|
1431
|
-
const createResourceParams = /*#__PURE__*/ createResourceParams$
|
|
1432
|
-
function typeCheckConfig(untrustedConfig) {
|
|
1456
|
+
const sendMessage_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, sendMessage_ConfigPropertyMetadata);
|
|
1457
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(sendMessage_ConfigPropertyMetadata);
|
|
1458
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
1433
1459
|
const config = {};
|
|
1434
|
-
typeCheckConfig$
|
|
1460
|
+
typeCheckConfig$3(untrustedConfig, config, sendMessage_ConfigPropertyMetadata);
|
|
1461
|
+
const untrustedConfig_planTemplateVariables = untrustedConfig.planTemplateVariables;
|
|
1462
|
+
config.planTemplateVariables = untrustedConfig_planTemplateVariables;
|
|
1435
1463
|
const untrustedConfig_reply = untrustedConfig.reply;
|
|
1436
1464
|
if (ArrayIsArray$1(untrustedConfig_reply)) {
|
|
1437
1465
|
const untrustedConfig_reply_array = [];
|
|
1438
1466
|
for (let i = 0, arrayLength = untrustedConfig_reply.length; i < arrayLength; i++) {
|
|
1439
1467
|
const untrustedConfig_reply_item = untrustedConfig_reply[i];
|
|
1440
|
-
const referenceEsTypeMessageRepresentationValidationError = validate$
|
|
1468
|
+
const referenceEsTypeMessageRepresentationValidationError = validate$7(untrustedConfig_reply_item);
|
|
1441
1469
|
if (referenceEsTypeMessageRepresentationValidationError === null) {
|
|
1442
1470
|
untrustedConfig_reply_array.push(untrustedConfig_reply_item);
|
|
1443
1471
|
}
|
|
@@ -1449,7 +1477,7 @@ function typeCheckConfig(untrustedConfig) {
|
|
|
1449
1477
|
const untrustedConfig_variables_array = [];
|
|
1450
1478
|
for (let i = 0, arrayLength = untrustedConfig_variables.length; i < arrayLength; i++) {
|
|
1451
1479
|
const untrustedConfig_variables_item = untrustedConfig_variables[i];
|
|
1452
|
-
const referenceVariableRepresentationValidationError = validate$
|
|
1480
|
+
const referenceVariableRepresentationValidationError = validate$6(untrustedConfig_variables_item);
|
|
1453
1481
|
if (referenceVariableRepresentationValidationError === null) {
|
|
1454
1482
|
untrustedConfig_variables_array.push(untrustedConfig_variables_item);
|
|
1455
1483
|
}
|
|
@@ -1458,30 +1486,30 @@ function typeCheckConfig(untrustedConfig) {
|
|
|
1458
1486
|
}
|
|
1459
1487
|
return config;
|
|
1460
1488
|
}
|
|
1461
|
-
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
1489
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
1462
1490
|
if (!untrustedIsObject(untrustedConfig)) {
|
|
1463
1491
|
return null;
|
|
1464
1492
|
}
|
|
1465
1493
|
if (process.env.NODE_ENV !== 'production') {
|
|
1466
1494
|
validateConfig(untrustedConfig, configPropertyNames);
|
|
1467
1495
|
}
|
|
1468
|
-
const config = typeCheckConfig(untrustedConfig);
|
|
1496
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
1469
1497
|
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1470
1498
|
return null;
|
|
1471
1499
|
}
|
|
1472
1500
|
return config;
|
|
1473
1501
|
}
|
|
1474
|
-
function buildNetworkSnapshot(luvio, config, options) {
|
|
1475
|
-
const resourceParams = createResourceParams(config);
|
|
1476
|
-
const request = createResourceRequest(resourceParams);
|
|
1502
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
1503
|
+
const resourceParams = createResourceParams$1(config);
|
|
1504
|
+
const request = createResourceRequest$1(resourceParams);
|
|
1477
1505
|
return luvio.dispatchResourceRequest(request, options)
|
|
1478
1506
|
.then((response) => {
|
|
1479
1507
|
return luvio.handleSuccessResponse(() => {
|
|
1480
|
-
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
1508
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response);
|
|
1481
1509
|
return luvio.storeBroadcast().then(() => snapshot);
|
|
1482
1510
|
}, () => {
|
|
1483
1511
|
const cache = new StoreKeyMap();
|
|
1484
|
-
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
1512
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
1485
1513
|
return cache;
|
|
1486
1514
|
});
|
|
1487
1515
|
}, (response) => {
|
|
@@ -1491,13 +1519,378 @@ function buildNetworkSnapshot(luvio, config, options) {
|
|
|
1491
1519
|
}
|
|
1492
1520
|
const sendMessageAdapterFactory = (luvio) => {
|
|
1493
1521
|
return function sendMessage(untrustedConfig) {
|
|
1494
|
-
const config = validateAdapterConfig(untrustedConfig, sendMessage_ConfigPropertyNames);
|
|
1522
|
+
const config = validateAdapterConfig$1(untrustedConfig, sendMessage_ConfigPropertyNames);
|
|
1495
1523
|
// Invalid or incomplete config
|
|
1496
1524
|
if (config === null) {
|
|
1497
1525
|
throw new Error('Invalid config for "sendMessage"');
|
|
1498
1526
|
}
|
|
1499
|
-
return buildNetworkSnapshot(luvio, config);
|
|
1527
|
+
return buildNetworkSnapshot$1(luvio, config);
|
|
1500
1528
|
};
|
|
1501
1529
|
};
|
|
1502
1530
|
|
|
1503
|
-
|
|
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 };
|