@salesforce/lds-adapters-service-einstein-copilot-bot 1.266.0-dev16 → 1.266.0-dev17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/es2018/service-einstein-copilot-bot.js +160 -553
- package/dist/es/es2018/types/src/generated/adapters/sendMessage.d.ts +0 -4
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +0 -1
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +1 -3
- package/dist/es/es2018/types/src/generated/resources/postConnectConversationRuntimeProxy.d.ts +0 -4
- package/dist/es/es2018/types/src/generated/types/ConversationRuntimeProxyInputRepresentation.d.ts +1 -13
- package/dist/es/es2018/types/src/generated/types/VariableRepresentation.d.ts +3 -3
- package/package.json +3 -3
- package/sfdc/index.js +38 -447
- package/src/raml/api.raml +0 -76
- package/src/raml/luvio.raml +0 -8
- package/dist/es/es2018/types/src/generated/adapters/getRecommendedPlanTemplates.d.ts +0 -28
- package/dist/es/es2018/types/src/generated/resources/getConnectRecommendedPlanTemplatesByPageTypeAndObjectType.d.ts +0 -16
- package/dist/es/es2018/types/src/generated/types/PlanTemplateRepresentation.d.ts +0 -45
- package/dist/es/es2018/types/src/generated/types/RecommendedPlanTemplatesRepresentation.d.ts +0 -36
package/sfdc/index.js
CHANGED
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
/* proxy-compat-disable */
|
|
15
15
|
import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
|
|
16
16
|
import { withDefaultLuvio } from 'force/ldsEngine';
|
|
17
|
-
import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$
|
|
17
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, StoreKeyMap, createResourceParams as createResourceParams$2, typeCheckConfig as typeCheckConfig$2 } from 'force/luvioEngine';
|
|
18
18
|
|
|
19
19
|
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
20
|
-
const { keys: ObjectKeys
|
|
20
|
+
const { keys: ObjectKeys, create: ObjectCreate } = Object;
|
|
21
21
|
const { isArray: ArrayIsArray$1 } = Array;
|
|
22
22
|
/**
|
|
23
23
|
* Validates an adapter config is well-formed.
|
|
@@ -41,7 +41,7 @@ function validateConfig(config, adapter, oneOf) {
|
|
|
41
41
|
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
42
42
|
}
|
|
43
43
|
const supported = required.concat(optional);
|
|
44
|
-
if (ObjectKeys
|
|
44
|
+
if (ObjectKeys(config).some(key => !supported.includes(key))) {
|
|
45
45
|
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -81,7 +81,6 @@ function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
|
81
81
|
}
|
|
82
82
|
const keyPrefix = 'einstein-copilot-bot';
|
|
83
83
|
|
|
84
|
-
const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
85
84
|
const { isArray: ArrayIsArray } = Array;
|
|
86
85
|
const { stringify: JSONStringify } = JSON;
|
|
87
86
|
function equalsArray(a, b, equalsItem) {
|
|
@@ -97,34 +96,15 @@ function equalsArray(a, b, equalsItem) {
|
|
|
97
96
|
}
|
|
98
97
|
return true;
|
|
99
98
|
}
|
|
100
|
-
function equalsObject(a, b, equalsProp) {
|
|
101
|
-
const aKeys = ObjectKeys(a).sort();
|
|
102
|
-
const bKeys = ObjectKeys(b).sort();
|
|
103
|
-
const aKeysLength = aKeys.length;
|
|
104
|
-
const bKeysLength = bKeys.length;
|
|
105
|
-
if (aKeysLength !== bKeysLength) {
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
for (let i = 0; i < aKeys.length; i++) {
|
|
109
|
-
const key = aKeys[i];
|
|
110
|
-
if (key !== bKeys[i]) {
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
if (equalsProp(a[key], b[key]) === false) {
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return true;
|
|
118
|
-
}
|
|
119
99
|
function createLink(ref) {
|
|
120
100
|
return {
|
|
121
101
|
__ref: serializeStructuredKey(ref),
|
|
122
102
|
};
|
|
123
103
|
}
|
|
124
104
|
|
|
125
|
-
const TTL$
|
|
126
|
-
const VERSION$
|
|
127
|
-
function validate$
|
|
105
|
+
const TTL$2 = 30000;
|
|
106
|
+
const VERSION$5 = "ab85410a28124cfed3d8eae7b8236853";
|
|
107
|
+
function validate$6(obj, path = 'CopilotBotInfoRepresentation') {
|
|
128
108
|
const v_error = (() => {
|
|
129
109
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
130
110
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -151,14 +131,14 @@ function validate$8(obj, path = 'CopilotBotInfoRepresentation') {
|
|
|
151
131
|
})();
|
|
152
132
|
return v_error === undefined ? null : v_error;
|
|
153
133
|
}
|
|
154
|
-
const RepresentationType$
|
|
155
|
-
function normalize$
|
|
134
|
+
const RepresentationType$2 = 'CopilotBotInfoRepresentation';
|
|
135
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
156
136
|
return input;
|
|
157
137
|
}
|
|
158
|
-
const select$
|
|
138
|
+
const select$7 = function CopilotBotInfoRepresentationSelect() {
|
|
159
139
|
return {
|
|
160
140
|
kind: 'Fragment',
|
|
161
|
-
version: VERSION$
|
|
141
|
+
version: VERSION$5,
|
|
162
142
|
private: [],
|
|
163
143
|
selections: [
|
|
164
144
|
{
|
|
@@ -178,7 +158,7 @@ const select$a = function CopilotBotInfoRepresentationSelect() {
|
|
|
178
158
|
]
|
|
179
159
|
};
|
|
180
160
|
};
|
|
181
|
-
function equals$
|
|
161
|
+
function equals$5(existing, incoming) {
|
|
182
162
|
const existing_isSuccess = existing.isSuccess;
|
|
183
163
|
const incoming_isSuccess = incoming.isSuccess;
|
|
184
164
|
if (!(existing_isSuccess === incoming_isSuccess)) {
|
|
@@ -212,368 +192,7 @@ function equals$7(existing, incoming) {
|
|
|
212
192
|
}
|
|
213
193
|
return true;
|
|
214
194
|
}
|
|
215
|
-
const ingest$
|
|
216
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
217
|
-
const validateError = validate$8(input);
|
|
218
|
-
if (validateError !== null) {
|
|
219
|
-
throw validateError;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
const key = path.fullPath;
|
|
223
|
-
const ttlToUse = TTL$3;
|
|
224
|
-
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "einstein-copilot-bot", VERSION$7, RepresentationType$3, equals$7);
|
|
225
|
-
return createLink(key);
|
|
226
|
-
};
|
|
227
|
-
function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
|
|
228
|
-
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
229
|
-
const rootKey = fullPathFactory();
|
|
230
|
-
rootKeySet.set(rootKey, {
|
|
231
|
-
namespace: keyPrefix,
|
|
232
|
-
representationName: RepresentationType$3,
|
|
233
|
-
mergeable: false
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
function select$9(luvio, params) {
|
|
238
|
-
return select$a();
|
|
239
|
-
}
|
|
240
|
-
function keyBuilder$5(luvio, params) {
|
|
241
|
-
return keyPrefix + '::CopilotBotInfoRepresentation:(' + ')';
|
|
242
|
-
}
|
|
243
|
-
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
244
|
-
getTypeCacheKeys$3(storeKeyMap, luvio, response, () => keyBuilder$5());
|
|
245
|
-
}
|
|
246
|
-
function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
|
|
247
|
-
const { body } = response;
|
|
248
|
-
const key = keyBuilder$5();
|
|
249
|
-
luvio.storeIngest(key, ingest$3, body);
|
|
250
|
-
const snapshot = luvio.storeLookup({
|
|
251
|
-
recordId: key,
|
|
252
|
-
node: select$9(),
|
|
253
|
-
variables: {},
|
|
254
|
-
}, snapshotRefresh);
|
|
255
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
256
|
-
if (snapshot.state !== 'Fulfilled') {
|
|
257
|
-
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
deepFreeze(snapshot.data);
|
|
261
|
-
return snapshot;
|
|
262
|
-
}
|
|
263
|
-
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
264
|
-
const key = keyBuilder$5();
|
|
265
|
-
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
266
|
-
const storeMetadataParams = {
|
|
267
|
-
ttl: TTL$3,
|
|
268
|
-
namespace: keyPrefix,
|
|
269
|
-
version: VERSION$7,
|
|
270
|
-
representationName: RepresentationType$3
|
|
271
|
-
};
|
|
272
|
-
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
273
|
-
return errorSnapshot;
|
|
274
|
-
}
|
|
275
|
-
function createResourceRequest$2(config) {
|
|
276
|
-
const headers = {};
|
|
277
|
-
return {
|
|
278
|
-
baseUri: '/services/data/v60.0',
|
|
279
|
-
basePath: '/connect/conversation-runtime-proxy',
|
|
280
|
-
method: 'get',
|
|
281
|
-
body: null,
|
|
282
|
-
urlParams: {},
|
|
283
|
-
queryParams: {},
|
|
284
|
-
headers,
|
|
285
|
-
priority: 'normal',
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
const adapterName$2 = 'getBotId';
|
|
290
|
-
const getBotId_ConfigPropertyMetadata = [];
|
|
291
|
-
const getBotId_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getBotId_ConfigPropertyMetadata);
|
|
292
|
-
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(getBotId_ConfigPropertyMetadata);
|
|
293
|
-
function keyBuilder$4(luvio, config) {
|
|
294
|
-
createResourceParams$2(config);
|
|
295
|
-
return keyBuilder$5();
|
|
296
|
-
}
|
|
297
|
-
function typeCheckConfig$2(untrustedConfig) {
|
|
298
|
-
const config = {};
|
|
299
|
-
return config;
|
|
300
|
-
}
|
|
301
|
-
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
302
|
-
if (!untrustedIsObject(untrustedConfig)) {
|
|
303
|
-
return null;
|
|
304
|
-
}
|
|
305
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
306
|
-
validateConfig(untrustedConfig, configPropertyNames);
|
|
307
|
-
}
|
|
308
|
-
const config = typeCheckConfig$2();
|
|
309
|
-
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
310
|
-
return null;
|
|
311
|
-
}
|
|
312
|
-
return config;
|
|
313
|
-
}
|
|
314
|
-
function adapterFragment$1(luvio, config) {
|
|
315
|
-
createResourceParams$2(config);
|
|
316
|
-
return select$9();
|
|
317
|
-
}
|
|
318
|
-
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
319
|
-
const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
|
|
320
|
-
config,
|
|
321
|
-
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
322
|
-
});
|
|
323
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
324
|
-
}
|
|
325
|
-
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
326
|
-
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
327
|
-
config,
|
|
328
|
-
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
329
|
-
});
|
|
330
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
331
|
-
}
|
|
332
|
-
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
333
|
-
const resourceParams = createResourceParams$2(config);
|
|
334
|
-
const request = createResourceRequest$2();
|
|
335
|
-
return luvio.dispatchResourceRequest(request, options)
|
|
336
|
-
.then((response) => {
|
|
337
|
-
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
|
|
338
|
-
const cache = new StoreKeyMap();
|
|
339
|
-
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
340
|
-
return cache;
|
|
341
|
-
});
|
|
342
|
-
}, (response) => {
|
|
343
|
-
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
347
|
-
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
|
|
348
|
-
}
|
|
349
|
-
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
350
|
-
const { luvio, config } = context;
|
|
351
|
-
const selector = {
|
|
352
|
-
recordId: keyBuilder$4(luvio, config),
|
|
353
|
-
node: adapterFragment$1(luvio, config),
|
|
354
|
-
variables: {},
|
|
355
|
-
};
|
|
356
|
-
const cacheSnapshot = storeLookup(selector, {
|
|
357
|
-
config,
|
|
358
|
-
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
359
|
-
});
|
|
360
|
-
return cacheSnapshot;
|
|
361
|
-
}
|
|
362
|
-
const getBotIdAdapterFactory = (luvio) => function einsteinCopilotBot__getBotId(untrustedConfig, requestContext) {
|
|
363
|
-
const config = validateAdapterConfig$2(untrustedConfig, getBotId_ConfigPropertyNames);
|
|
364
|
-
// Invalid or incomplete config
|
|
365
|
-
if (config === null) {
|
|
366
|
-
return null;
|
|
367
|
-
}
|
|
368
|
-
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
369
|
-
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
const VERSION$6 = "504437088c2317480c651ac05a7565b5";
|
|
373
|
-
function validate$7(obj, path = 'PlanTemplateRepresentation') {
|
|
374
|
-
const v_error = (() => {
|
|
375
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
376
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
377
|
-
}
|
|
378
|
-
const obj_intent = obj.intent;
|
|
379
|
-
const path_intent = path + '.intent';
|
|
380
|
-
if (typeof obj_intent !== 'string') {
|
|
381
|
-
return new TypeError('Expected "string" but received "' + typeof obj_intent + '" (at "' + path_intent + '")');
|
|
382
|
-
}
|
|
383
|
-
const obj_label = obj.label;
|
|
384
|
-
const path_label = path + '.label';
|
|
385
|
-
if (typeof obj_label !== 'string') {
|
|
386
|
-
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
387
|
-
}
|
|
388
|
-
const obj_planTemplateId = obj.planTemplateId;
|
|
389
|
-
const path_planTemplateId = path + '.planTemplateId';
|
|
390
|
-
if (typeof obj_planTemplateId !== 'string') {
|
|
391
|
-
return new TypeError('Expected "string" but received "' + typeof obj_planTemplateId + '" (at "' + path_planTemplateId + '")');
|
|
392
|
-
}
|
|
393
|
-
const obj_userUtterance = obj.userUtterance;
|
|
394
|
-
const path_userUtterance = path + '.userUtterance';
|
|
395
|
-
if (typeof obj_userUtterance !== 'string') {
|
|
396
|
-
return new TypeError('Expected "string" but received "' + typeof obj_userUtterance + '" (at "' + path_userUtterance + '")');
|
|
397
|
-
}
|
|
398
|
-
const obj_variables = obj.variables;
|
|
399
|
-
const path_variables = path + '.variables';
|
|
400
|
-
if (typeof obj_variables !== 'object' || ArrayIsArray(obj_variables) || obj_variables === null) {
|
|
401
|
-
return new TypeError('Expected "object" but received "' + typeof obj_variables + '" (at "' + path_variables + '")');
|
|
402
|
-
}
|
|
403
|
-
const obj_variables_keys = ObjectKeys(obj_variables);
|
|
404
|
-
for (let i = 0; i < obj_variables_keys.length; i++) {
|
|
405
|
-
const key = obj_variables_keys[i];
|
|
406
|
-
const obj_variables_prop = obj_variables[key];
|
|
407
|
-
const path_variables_prop = path_variables + '["' + key + '"]';
|
|
408
|
-
if (typeof obj_variables_prop !== 'string') {
|
|
409
|
-
return new TypeError('Expected "string" but received "' + typeof obj_variables_prop + '" (at "' + path_variables_prop + '")');
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
})();
|
|
413
|
-
return v_error === undefined ? null : v_error;
|
|
414
|
-
}
|
|
415
|
-
const select$8 = function PlanTemplateRepresentationSelect() {
|
|
416
|
-
return {
|
|
417
|
-
kind: 'Fragment',
|
|
418
|
-
version: VERSION$6,
|
|
419
|
-
private: [],
|
|
420
|
-
selections: [
|
|
421
|
-
{
|
|
422
|
-
name: 'intent',
|
|
423
|
-
kind: 'Scalar'
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
name: 'label',
|
|
427
|
-
kind: 'Scalar'
|
|
428
|
-
},
|
|
429
|
-
{
|
|
430
|
-
name: 'planTemplateId',
|
|
431
|
-
kind: 'Scalar'
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
name: 'userUtterance',
|
|
435
|
-
kind: 'Scalar'
|
|
436
|
-
},
|
|
437
|
-
{
|
|
438
|
-
name: 'variables',
|
|
439
|
-
kind: 'Scalar',
|
|
440
|
-
map: true
|
|
441
|
-
}
|
|
442
|
-
]
|
|
443
|
-
};
|
|
444
|
-
};
|
|
445
|
-
function equals$6(existing, incoming) {
|
|
446
|
-
const existing_intent = existing.intent;
|
|
447
|
-
const incoming_intent = incoming.intent;
|
|
448
|
-
if (!(existing_intent === incoming_intent)) {
|
|
449
|
-
return false;
|
|
450
|
-
}
|
|
451
|
-
const existing_label = existing.label;
|
|
452
|
-
const incoming_label = incoming.label;
|
|
453
|
-
if (!(existing_label === incoming_label)) {
|
|
454
|
-
return false;
|
|
455
|
-
}
|
|
456
|
-
const existing_planTemplateId = existing.planTemplateId;
|
|
457
|
-
const incoming_planTemplateId = incoming.planTemplateId;
|
|
458
|
-
if (!(existing_planTemplateId === incoming_planTemplateId)) {
|
|
459
|
-
return false;
|
|
460
|
-
}
|
|
461
|
-
const existing_userUtterance = existing.userUtterance;
|
|
462
|
-
const incoming_userUtterance = incoming.userUtterance;
|
|
463
|
-
if (!(existing_userUtterance === incoming_userUtterance)) {
|
|
464
|
-
return false;
|
|
465
|
-
}
|
|
466
|
-
const existing_variables = existing.variables;
|
|
467
|
-
const incoming_variables = incoming.variables;
|
|
468
|
-
const equals_variables_props = equalsObject(existing_variables, incoming_variables, (existing_variables_prop, incoming_variables_prop) => {
|
|
469
|
-
if (!(existing_variables_prop === incoming_variables_prop)) {
|
|
470
|
-
return false;
|
|
471
|
-
}
|
|
472
|
-
});
|
|
473
|
-
if (equals_variables_props === false) {
|
|
474
|
-
return false;
|
|
475
|
-
}
|
|
476
|
-
return true;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
const TTL$2 = 900000;
|
|
480
|
-
const VERSION$5 = "0503b0c5ce250e7f5fbf16f2d3f2fec4";
|
|
481
|
-
function validate$6(obj, path = 'RecommendedPlanTemplatesRepresentation') {
|
|
482
|
-
const v_error = (() => {
|
|
483
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
484
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
485
|
-
}
|
|
486
|
-
if (obj.errorMessage !== undefined) {
|
|
487
|
-
const obj_errorMessage = obj.errorMessage;
|
|
488
|
-
const path_errorMessage = path + '.errorMessage';
|
|
489
|
-
if (typeof obj_errorMessage !== 'string') {
|
|
490
|
-
return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
const obj_isSuccess = obj.isSuccess;
|
|
494
|
-
const path_isSuccess = path + '.isSuccess';
|
|
495
|
-
if (typeof obj_isSuccess !== 'boolean') {
|
|
496
|
-
return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
|
|
497
|
-
}
|
|
498
|
-
const obj_planTemplates = obj.planTemplates;
|
|
499
|
-
const path_planTemplates = path + '.planTemplates';
|
|
500
|
-
if (!ArrayIsArray(obj_planTemplates)) {
|
|
501
|
-
return new TypeError('Expected "array" but received "' + typeof obj_planTemplates + '" (at "' + path_planTemplates + '")');
|
|
502
|
-
}
|
|
503
|
-
for (let i = 0; i < obj_planTemplates.length; i++) {
|
|
504
|
-
const obj_planTemplates_item = obj_planTemplates[i];
|
|
505
|
-
const path_planTemplates_item = path_planTemplates + '[' + i + ']';
|
|
506
|
-
const referencepath_planTemplates_itemValidationError = validate$7(obj_planTemplates_item, path_planTemplates_item);
|
|
507
|
-
if (referencepath_planTemplates_itemValidationError !== null) {
|
|
508
|
-
let message = 'Object doesn\'t match PlanTemplateRepresentation (at "' + path_planTemplates_item + '")\n';
|
|
509
|
-
message += referencepath_planTemplates_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
510
|
-
return new TypeError(message);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
})();
|
|
514
|
-
return v_error === undefined ? null : v_error;
|
|
515
|
-
}
|
|
516
|
-
const RepresentationType$2 = 'RecommendedPlanTemplatesRepresentation';
|
|
517
|
-
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
518
|
-
return input;
|
|
519
|
-
}
|
|
520
|
-
const select$7 = function RecommendedPlanTemplatesRepresentationSelect() {
|
|
521
|
-
const { selections: PlanTemplateRepresentation__selections, opaque: PlanTemplateRepresentation__opaque, } = select$8();
|
|
522
|
-
return {
|
|
523
|
-
kind: 'Fragment',
|
|
524
|
-
version: VERSION$5,
|
|
525
|
-
private: [],
|
|
526
|
-
selections: [
|
|
527
|
-
{
|
|
528
|
-
name: 'errorMessage',
|
|
529
|
-
kind: 'Scalar',
|
|
530
|
-
required: false
|
|
531
|
-
},
|
|
532
|
-
{
|
|
533
|
-
name: 'isSuccess',
|
|
534
|
-
kind: 'Scalar'
|
|
535
|
-
},
|
|
536
|
-
{
|
|
537
|
-
name: 'planTemplates',
|
|
538
|
-
kind: 'Object',
|
|
539
|
-
plural: true,
|
|
540
|
-
selections: PlanTemplateRepresentation__selections
|
|
541
|
-
}
|
|
542
|
-
]
|
|
543
|
-
};
|
|
544
|
-
};
|
|
545
|
-
function equals$5(existing, incoming) {
|
|
546
|
-
const existing_isSuccess = existing.isSuccess;
|
|
547
|
-
const incoming_isSuccess = incoming.isSuccess;
|
|
548
|
-
if (!(existing_isSuccess === incoming_isSuccess)) {
|
|
549
|
-
return false;
|
|
550
|
-
}
|
|
551
|
-
const existing_errorMessage = existing.errorMessage;
|
|
552
|
-
const incoming_errorMessage = incoming.errorMessage;
|
|
553
|
-
// if at least one of these optionals is defined
|
|
554
|
-
if (existing_errorMessage !== undefined || incoming_errorMessage !== undefined) {
|
|
555
|
-
// if one of these is not defined we know the other is defined and therefore
|
|
556
|
-
// not equal
|
|
557
|
-
if (existing_errorMessage === undefined || incoming_errorMessage === undefined) {
|
|
558
|
-
return false;
|
|
559
|
-
}
|
|
560
|
-
if (!(existing_errorMessage === incoming_errorMessage)) {
|
|
561
|
-
return false;
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
const existing_planTemplates = existing.planTemplates;
|
|
565
|
-
const incoming_planTemplates = incoming.planTemplates;
|
|
566
|
-
const equals_planTemplates_items = equalsArray(existing_planTemplates, incoming_planTemplates, (existing_planTemplates_item, incoming_planTemplates_item) => {
|
|
567
|
-
if (!(equals$6(existing_planTemplates_item, incoming_planTemplates_item))) {
|
|
568
|
-
return false;
|
|
569
|
-
}
|
|
570
|
-
});
|
|
571
|
-
if (equals_planTemplates_items === false) {
|
|
572
|
-
return false;
|
|
573
|
-
}
|
|
574
|
-
return true;
|
|
575
|
-
}
|
|
576
|
-
const ingest$2 = function RecommendedPlanTemplatesRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
195
|
+
const ingest$2 = function CopilotBotInfoRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
577
196
|
if (process.env.NODE_ENV !== 'production') {
|
|
578
197
|
const validateError = validate$6(input);
|
|
579
198
|
if (validateError !== null) {
|
|
@@ -599,14 +218,14 @@ function select$6(luvio, params) {
|
|
|
599
218
|
return select$7();
|
|
600
219
|
}
|
|
601
220
|
function keyBuilder$3(luvio, params) {
|
|
602
|
-
return keyPrefix + '::
|
|
221
|
+
return keyPrefix + '::CopilotBotInfoRepresentation:(' + ')';
|
|
603
222
|
}
|
|
604
223
|
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
605
|
-
getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$3(
|
|
224
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$3());
|
|
606
225
|
}
|
|
607
226
|
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
608
227
|
const { body } = response;
|
|
609
|
-
const key = keyBuilder$3(
|
|
228
|
+
const key = keyBuilder$3();
|
|
610
229
|
luvio.storeIngest(key, ingest$2, body);
|
|
611
230
|
const snapshot = luvio.storeLookup({
|
|
612
231
|
recordId: key,
|
|
@@ -622,7 +241,7 @@ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
|
622
241
|
return snapshot;
|
|
623
242
|
}
|
|
624
243
|
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
625
|
-
const key = keyBuilder$3(
|
|
244
|
+
const key = keyBuilder$3();
|
|
626
245
|
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
627
246
|
const storeMetadataParams = {
|
|
628
247
|
ttl: TTL$2,
|
|
@@ -637,30 +256,26 @@ function createResourceRequest$1(config) {
|
|
|
637
256
|
const headers = {};
|
|
638
257
|
return {
|
|
639
258
|
baseUri: '/services/data/v60.0',
|
|
640
|
-
basePath: '/connect/
|
|
259
|
+
basePath: '/connect/conversation-runtime-proxy',
|
|
641
260
|
method: 'get',
|
|
642
261
|
body: null,
|
|
643
|
-
urlParams:
|
|
262
|
+
urlParams: {},
|
|
644
263
|
queryParams: {},
|
|
645
264
|
headers,
|
|
646
265
|
priority: 'normal',
|
|
647
266
|
};
|
|
648
267
|
}
|
|
649
268
|
|
|
650
|
-
const adapterName$1 = '
|
|
651
|
-
const
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
];
|
|
655
|
-
const getRecommendedPlanTemplates_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getRecommendedPlanTemplates_ConfigPropertyMetadata);
|
|
656
|
-
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(getRecommendedPlanTemplates_ConfigPropertyMetadata);
|
|
269
|
+
const adapterName$1 = 'getBotId';
|
|
270
|
+
const getBotId_ConfigPropertyMetadata = [];
|
|
271
|
+
const getBotId_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getBotId_ConfigPropertyMetadata);
|
|
272
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$2(getBotId_ConfigPropertyMetadata);
|
|
657
273
|
function keyBuilder$2(luvio, config) {
|
|
658
|
-
|
|
659
|
-
return keyBuilder$3(
|
|
274
|
+
createResourceParams$1(config);
|
|
275
|
+
return keyBuilder$3();
|
|
660
276
|
}
|
|
661
277
|
function typeCheckConfig$1(untrustedConfig) {
|
|
662
278
|
const config = {};
|
|
663
|
-
typeCheckConfig$3(untrustedConfig, config, getRecommendedPlanTemplates_ConfigPropertyMetadata);
|
|
664
279
|
return config;
|
|
665
280
|
}
|
|
666
281
|
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
@@ -670,7 +285,7 @@ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
|
670
285
|
if (process.env.NODE_ENV !== 'production') {
|
|
671
286
|
validateConfig(untrustedConfig, configPropertyNames);
|
|
672
287
|
}
|
|
673
|
-
const config = typeCheckConfig$1(
|
|
288
|
+
const config = typeCheckConfig$1();
|
|
674
289
|
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
675
290
|
return null;
|
|
676
291
|
}
|
|
@@ -696,7 +311,7 @@ function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
|
696
311
|
}
|
|
697
312
|
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
698
313
|
const resourceParams = createResourceParams$1(config);
|
|
699
|
-
const request = createResourceRequest$1(
|
|
314
|
+
const request = createResourceRequest$1();
|
|
700
315
|
return luvio.dispatchResourceRequest(request, options)
|
|
701
316
|
.then((response) => {
|
|
702
317
|
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
@@ -709,7 +324,7 @@ function buildNetworkSnapshot$1(luvio, config, options) {
|
|
|
709
324
|
});
|
|
710
325
|
}
|
|
711
326
|
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
712
|
-
return buildNetworkSnapshotCachePolicy$
|
|
327
|
+
return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
|
|
713
328
|
}
|
|
714
329
|
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
715
330
|
const { luvio, config } = context;
|
|
@@ -724,8 +339,8 @@ function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
|
724
339
|
});
|
|
725
340
|
return cacheSnapshot;
|
|
726
341
|
}
|
|
727
|
-
const
|
|
728
|
-
const config = validateAdapterConfig$1(untrustedConfig,
|
|
342
|
+
const getBotIdAdapterFactory = (luvio) => function einsteinCopilotBot__getBotId(untrustedConfig, requestContext) {
|
|
343
|
+
const config = validateAdapterConfig$1(untrustedConfig, getBotId_ConfigPropertyNames);
|
|
729
344
|
// Invalid or incomplete config
|
|
730
345
|
if (config === null) {
|
|
731
346
|
return null;
|
|
@@ -830,12 +445,10 @@ function validate$4(obj, path = 'VariableRepresentation') {
|
|
|
830
445
|
if (typeof obj_name !== 'string') {
|
|
831
446
|
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
832
447
|
}
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
return new TypeError('Expected "string" but received "' + typeof obj_value + '" (at "' + path_value + '")');
|
|
838
|
-
}
|
|
448
|
+
const obj_value = obj.value;
|
|
449
|
+
const path_value = path + '.value';
|
|
450
|
+
if (typeof obj_value !== 'string') {
|
|
451
|
+
return new TypeError('Expected "string" but received "' + typeof obj_value + '" (at "' + path_value + '")');
|
|
839
452
|
}
|
|
840
453
|
})();
|
|
841
454
|
return v_error === undefined ? null : v_error;
|
|
@@ -1818,23 +1431,17 @@ const sendMessage_ConfigPropertyMetadata = [
|
|
|
1818
1431
|
generateParamConfigMetadata('message', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1819
1432
|
generateParamConfigMetadata('sessionId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1820
1433
|
generateParamConfigMetadata('inReplyToMessageId', false, 2 /* Body */, 0 /* String */),
|
|
1821
|
-
generateParamConfigMetadata('intent', false, 2 /* Body */, 0 /* String */),
|
|
1822
1434
|
generateParamConfigMetadata('messageType', false, 2 /* Body */, 0 /* String */),
|
|
1823
|
-
generateParamConfigMetadata('planId', false, 2 /* Body */, 0 /* String */),
|
|
1824
|
-
generateParamConfigMetadata('planTemplateVariables', false, 2 /* Body */, 4 /* Unsupported */),
|
|
1825
1435
|
generateParamConfigMetadata('reply', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
1826
1436
|
generateParamConfigMetadata('text', false, 2 /* Body */, 0 /* String */),
|
|
1827
1437
|
generateParamConfigMetadata('type', false, 2 /* Body */, 0 /* String */),
|
|
1828
|
-
generateParamConfigMetadata('userUtterance', false, 2 /* Body */, 0 /* String */),
|
|
1829
1438
|
generateParamConfigMetadata('variables', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
1830
1439
|
];
|
|
1831
1440
|
const sendMessage_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, sendMessage_ConfigPropertyMetadata);
|
|
1832
|
-
const createResourceParams = /*#__PURE__*/ createResourceParams$
|
|
1441
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$2(sendMessage_ConfigPropertyMetadata);
|
|
1833
1442
|
function typeCheckConfig(untrustedConfig) {
|
|
1834
1443
|
const config = {};
|
|
1835
|
-
typeCheckConfig$
|
|
1836
|
-
const untrustedConfig_planTemplateVariables = untrustedConfig.planTemplateVariables;
|
|
1837
|
-
config.planTemplateVariables = untrustedConfig_planTemplateVariables;
|
|
1444
|
+
typeCheckConfig$2(untrustedConfig, config, sendMessage_ConfigPropertyMetadata);
|
|
1838
1445
|
const untrustedConfig_reply = untrustedConfig.reply;
|
|
1839
1446
|
if (ArrayIsArray$1(untrustedConfig_reply)) {
|
|
1840
1447
|
const untrustedConfig_reply_array = [];
|
|
@@ -1904,46 +1511,30 @@ const sendMessageAdapterFactory = (luvio) => {
|
|
|
1904
1511
|
};
|
|
1905
1512
|
|
|
1906
1513
|
let getBotId;
|
|
1907
|
-
let getRecommendedPlanTemplates;
|
|
1908
1514
|
let sendMessage;
|
|
1909
1515
|
// Imperative GET Adapters
|
|
1910
1516
|
let getBotId_imperative;
|
|
1911
|
-
let getRecommendedPlanTemplates_imperative;
|
|
1912
1517
|
// Adapter Metadata
|
|
1913
1518
|
const getBotIdMetadata = { apiFamily: 'einsteincopilot-bot', name: 'getBotId', ttl: 30000 };
|
|
1914
|
-
const getRecommendedPlanTemplatesMetadata = {
|
|
1915
|
-
apiFamily: 'einsteincopilot-bot',
|
|
1916
|
-
name: 'getRecommendedPlanTemplates',
|
|
1917
|
-
ttl: 900000,
|
|
1918
|
-
};
|
|
1919
1519
|
// Notify Update Available
|
|
1920
1520
|
function bindExportsTo(luvio) {
|
|
1921
1521
|
// LDS Adapters
|
|
1922
1522
|
const getBotId_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getBotId', getBotIdAdapterFactory), getBotIdMetadata);
|
|
1923
|
-
const getRecommendedPlanTemplates_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getRecommendedPlanTemplates', getRecommendedPlanTemplatesAdapterFactory), getRecommendedPlanTemplatesMetadata);
|
|
1924
1523
|
function unwrapSnapshotData(factory) {
|
|
1925
1524
|
const adapter = factory(luvio);
|
|
1926
1525
|
return (config) => adapter(config).then((snapshot) => snapshot.data);
|
|
1927
1526
|
}
|
|
1928
1527
|
return {
|
|
1929
1528
|
getBotId: createWireAdapterConstructor(luvio, getBotId_ldsAdapter, getBotIdMetadata),
|
|
1930
|
-
getRecommendedPlanTemplates: createWireAdapterConstructor(luvio, getRecommendedPlanTemplates_ldsAdapter, getRecommendedPlanTemplatesMetadata),
|
|
1931
1529
|
sendMessage: unwrapSnapshotData(sendMessageAdapterFactory),
|
|
1932
1530
|
// Imperative GET Adapters
|
|
1933
1531
|
getBotId_imperative: createImperativeAdapter(luvio, getBotId_ldsAdapter, getBotIdMetadata),
|
|
1934
|
-
getRecommendedPlanTemplates_imperative: createImperativeAdapter(luvio, getRecommendedPlanTemplates_ldsAdapter, getRecommendedPlanTemplatesMetadata),
|
|
1935
1532
|
// Notify Update Availables
|
|
1936
1533
|
};
|
|
1937
1534
|
}
|
|
1938
1535
|
withDefaultLuvio((luvio) => {
|
|
1939
|
-
({
|
|
1940
|
-
getBotId,
|
|
1941
|
-
getRecommendedPlanTemplates,
|
|
1942
|
-
sendMessage,
|
|
1943
|
-
getBotId_imperative,
|
|
1944
|
-
getRecommendedPlanTemplates_imperative,
|
|
1945
|
-
} = bindExportsTo(luvio));
|
|
1536
|
+
({ getBotId, sendMessage, getBotId_imperative } = bindExportsTo(luvio));
|
|
1946
1537
|
});
|
|
1947
1538
|
|
|
1948
|
-
export { getBotId, getBotId_imperative,
|
|
1949
|
-
// version: 1.266.0-
|
|
1539
|
+
export { getBotId, getBotId_imperative, sendMessage };
|
|
1540
|
+
// version: 1.266.0-dev17-8af99d255
|