@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
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$2, StoreKeyMap, createResourceParams as createResourceParams$3, typeCheckConfig as typeCheckConfig$3 } from 'force/luvioEngine';
|
|
18
18
|
|
|
19
19
|
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
20
|
-
const { keys: ObjectKeys, create: ObjectCreate } = Object;
|
|
20
|
+
const { keys: ObjectKeys$1, create: ObjectCreate$1 } = 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(config).some(key => !supported.includes(key))) {
|
|
44
|
+
if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
|
|
45
45
|
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -81,6 +81,7 @@ function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
|
81
81
|
}
|
|
82
82
|
const keyPrefix = 'einstein-copilot-bot';
|
|
83
83
|
|
|
84
|
+
const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
84
85
|
const { isArray: ArrayIsArray } = Array;
|
|
85
86
|
const { stringify: JSONStringify } = JSON;
|
|
86
87
|
function equalsArray(a, b, equalsItem) {
|
|
@@ -96,15 +97,34 @@ function equalsArray(a, b, equalsItem) {
|
|
|
96
97
|
}
|
|
97
98
|
return true;
|
|
98
99
|
}
|
|
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
|
+
}
|
|
99
119
|
function createLink(ref) {
|
|
100
120
|
return {
|
|
101
121
|
__ref: serializeStructuredKey(ref),
|
|
102
122
|
};
|
|
103
123
|
}
|
|
104
124
|
|
|
105
|
-
const TTL$
|
|
106
|
-
const VERSION$
|
|
107
|
-
function validate$
|
|
125
|
+
const TTL$3 = 30000;
|
|
126
|
+
const VERSION$7 = "ab85410a28124cfed3d8eae7b8236853";
|
|
127
|
+
function validate$8(obj, path = 'CopilotBotInfoRepresentation') {
|
|
108
128
|
const v_error = (() => {
|
|
109
129
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
110
130
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -131,14 +151,14 @@ function validate$6(obj, path = 'CopilotBotInfoRepresentation') {
|
|
|
131
151
|
})();
|
|
132
152
|
return v_error === undefined ? null : v_error;
|
|
133
153
|
}
|
|
134
|
-
const RepresentationType$
|
|
135
|
-
function normalize$
|
|
154
|
+
const RepresentationType$3 = 'CopilotBotInfoRepresentation';
|
|
155
|
+
function normalize$3(input, existing, path, luvio, store, timestamp) {
|
|
136
156
|
return input;
|
|
137
157
|
}
|
|
138
|
-
const select$
|
|
158
|
+
const select$a = function CopilotBotInfoRepresentationSelect() {
|
|
139
159
|
return {
|
|
140
160
|
kind: 'Fragment',
|
|
141
|
-
version: VERSION$
|
|
161
|
+
version: VERSION$7,
|
|
142
162
|
private: [],
|
|
143
163
|
selections: [
|
|
144
164
|
{
|
|
@@ -158,7 +178,7 @@ const select$7 = function CopilotBotInfoRepresentationSelect() {
|
|
|
158
178
|
]
|
|
159
179
|
};
|
|
160
180
|
};
|
|
161
|
-
function equals$
|
|
181
|
+
function equals$7(existing, incoming) {
|
|
162
182
|
const existing_isSuccess = existing.isSuccess;
|
|
163
183
|
const incoming_isSuccess = incoming.isSuccess;
|
|
164
184
|
if (!(existing_isSuccess === incoming_isSuccess)) {
|
|
@@ -192,7 +212,368 @@ function equals$5(existing, incoming) {
|
|
|
192
212
|
}
|
|
193
213
|
return true;
|
|
194
214
|
}
|
|
195
|
-
const ingest$
|
|
215
|
+
const ingest$3 = function CopilotBotInfoRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
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) {
|
|
196
577
|
if (process.env.NODE_ENV !== 'production') {
|
|
197
578
|
const validateError = validate$6(input);
|
|
198
579
|
if (validateError !== null) {
|
|
@@ -218,14 +599,14 @@ function select$6(luvio, params) {
|
|
|
218
599
|
return select$7();
|
|
219
600
|
}
|
|
220
601
|
function keyBuilder$3(luvio, params) {
|
|
221
|
-
return keyPrefix + '::
|
|
602
|
+
return keyPrefix + '::RecommendedPlanTemplatesRepresentation:(' + 'pageType:' + params.urlParams.pageType + ',' + 'objectType:' + params.urlParams.objectType + ')';
|
|
222
603
|
}
|
|
223
604
|
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
224
|
-
getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$3());
|
|
605
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$3(luvio, resourceParams));
|
|
225
606
|
}
|
|
226
607
|
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
227
608
|
const { body } = response;
|
|
228
|
-
const key = keyBuilder$3();
|
|
609
|
+
const key = keyBuilder$3(luvio, resourceParams);
|
|
229
610
|
luvio.storeIngest(key, ingest$2, body);
|
|
230
611
|
const snapshot = luvio.storeLookup({
|
|
231
612
|
recordId: key,
|
|
@@ -241,7 +622,7 @@ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
|
241
622
|
return snapshot;
|
|
242
623
|
}
|
|
243
624
|
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
244
|
-
const key = keyBuilder$3();
|
|
625
|
+
const key = keyBuilder$3(luvio, params);
|
|
245
626
|
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
246
627
|
const storeMetadataParams = {
|
|
247
628
|
ttl: TTL$2,
|
|
@@ -256,26 +637,30 @@ function createResourceRequest$1(config) {
|
|
|
256
637
|
const headers = {};
|
|
257
638
|
return {
|
|
258
639
|
baseUri: '/services/data/v60.0',
|
|
259
|
-
basePath: '/connect/
|
|
640
|
+
basePath: '/connect/recommended-plan-templates/' + config.urlParams.pageType + '/' + config.urlParams.objectType + '',
|
|
260
641
|
method: 'get',
|
|
261
642
|
body: null,
|
|
262
|
-
urlParams:
|
|
643
|
+
urlParams: config.urlParams,
|
|
263
644
|
queryParams: {},
|
|
264
645
|
headers,
|
|
265
646
|
priority: 'normal',
|
|
266
647
|
};
|
|
267
648
|
}
|
|
268
649
|
|
|
269
|
-
const adapterName$1 = '
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
650
|
+
const adapterName$1 = 'getRecommendedPlanTemplates';
|
|
651
|
+
const getRecommendedPlanTemplates_ConfigPropertyMetadata = [
|
|
652
|
+
generateParamConfigMetadata('pageType', true, 0 /* UrlParameter */, 0 /* String */),
|
|
653
|
+
generateParamConfigMetadata('objectType', true, 0 /* UrlParameter */, 0 /* String */),
|
|
654
|
+
];
|
|
655
|
+
const getRecommendedPlanTemplates_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getRecommendedPlanTemplates_ConfigPropertyMetadata);
|
|
656
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(getRecommendedPlanTemplates_ConfigPropertyMetadata);
|
|
273
657
|
function keyBuilder$2(luvio, config) {
|
|
274
|
-
createResourceParams$1(config);
|
|
275
|
-
return keyBuilder$3();
|
|
658
|
+
const resourceParams = createResourceParams$1(config);
|
|
659
|
+
return keyBuilder$3(luvio, resourceParams);
|
|
276
660
|
}
|
|
277
661
|
function typeCheckConfig$1(untrustedConfig) {
|
|
278
662
|
const config = {};
|
|
663
|
+
typeCheckConfig$3(untrustedConfig, config, getRecommendedPlanTemplates_ConfigPropertyMetadata);
|
|
279
664
|
return config;
|
|
280
665
|
}
|
|
281
666
|
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
@@ -285,7 +670,7 @@ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
|
285
670
|
if (process.env.NODE_ENV !== 'production') {
|
|
286
671
|
validateConfig(untrustedConfig, configPropertyNames);
|
|
287
672
|
}
|
|
288
|
-
const config = typeCheckConfig$1();
|
|
673
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
289
674
|
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
290
675
|
return null;
|
|
291
676
|
}
|
|
@@ -311,7 +696,7 @@ function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
|
311
696
|
}
|
|
312
697
|
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
313
698
|
const resourceParams = createResourceParams$1(config);
|
|
314
|
-
const request = createResourceRequest$1();
|
|
699
|
+
const request = createResourceRequest$1(resourceParams);
|
|
315
700
|
return luvio.dispatchResourceRequest(request, options)
|
|
316
701
|
.then((response) => {
|
|
317
702
|
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
@@ -324,7 +709,7 @@ function buildNetworkSnapshot$1(luvio, config, options) {
|
|
|
324
709
|
});
|
|
325
710
|
}
|
|
326
711
|
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
327
|
-
return buildNetworkSnapshotCachePolicy$
|
|
712
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
|
|
328
713
|
}
|
|
329
714
|
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
330
715
|
const { luvio, config } = context;
|
|
@@ -339,8 +724,8 @@ function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
|
339
724
|
});
|
|
340
725
|
return cacheSnapshot;
|
|
341
726
|
}
|
|
342
|
-
const
|
|
343
|
-
const config = validateAdapterConfig$1(untrustedConfig,
|
|
727
|
+
const getRecommendedPlanTemplatesAdapterFactory = (luvio) => function einsteinCopilotBot__getRecommendedPlanTemplates(untrustedConfig, requestContext) {
|
|
728
|
+
const config = validateAdapterConfig$1(untrustedConfig, getRecommendedPlanTemplates_ConfigPropertyNames);
|
|
344
729
|
// Invalid or incomplete config
|
|
345
730
|
if (config === null) {
|
|
346
731
|
return null;
|
|
@@ -445,10 +830,12 @@ function validate$4(obj, path = 'VariableRepresentation') {
|
|
|
445
830
|
if (typeof obj_name !== 'string') {
|
|
446
831
|
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
447
832
|
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
833
|
+
if (obj.value !== undefined) {
|
|
834
|
+
const obj_value = obj.value;
|
|
835
|
+
const path_value = path + '.value';
|
|
836
|
+
if (typeof obj_value !== 'string') {
|
|
837
|
+
return new TypeError('Expected "string" but received "' + typeof obj_value + '" (at "' + path_value + '")');
|
|
838
|
+
}
|
|
452
839
|
}
|
|
453
840
|
})();
|
|
454
841
|
return v_error === undefined ? null : v_error;
|
|
@@ -1431,17 +1818,23 @@ const sendMessage_ConfigPropertyMetadata = [
|
|
|
1431
1818
|
generateParamConfigMetadata('message', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1432
1819
|
generateParamConfigMetadata('sessionId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1433
1820
|
generateParamConfigMetadata('inReplyToMessageId', false, 2 /* Body */, 0 /* String */),
|
|
1821
|
+
generateParamConfigMetadata('intent', false, 2 /* Body */, 0 /* String */),
|
|
1434
1822
|
generateParamConfigMetadata('messageType', false, 2 /* Body */, 0 /* String */),
|
|
1823
|
+
generateParamConfigMetadata('planId', false, 2 /* Body */, 0 /* String */),
|
|
1824
|
+
generateParamConfigMetadata('planTemplateVariables', false, 2 /* Body */, 4 /* Unsupported */),
|
|
1435
1825
|
generateParamConfigMetadata('reply', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
1436
1826
|
generateParamConfigMetadata('text', false, 2 /* Body */, 0 /* String */),
|
|
1437
1827
|
generateParamConfigMetadata('type', false, 2 /* Body */, 0 /* String */),
|
|
1828
|
+
generateParamConfigMetadata('userUtterance', false, 2 /* Body */, 0 /* String */),
|
|
1438
1829
|
generateParamConfigMetadata('variables', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
1439
1830
|
];
|
|
1440
1831
|
const sendMessage_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, sendMessage_ConfigPropertyMetadata);
|
|
1441
|
-
const createResourceParams = /*#__PURE__*/ createResourceParams$
|
|
1832
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$3(sendMessage_ConfigPropertyMetadata);
|
|
1442
1833
|
function typeCheckConfig(untrustedConfig) {
|
|
1443
1834
|
const config = {};
|
|
1444
|
-
typeCheckConfig$
|
|
1835
|
+
typeCheckConfig$3(untrustedConfig, config, sendMessage_ConfigPropertyMetadata);
|
|
1836
|
+
const untrustedConfig_planTemplateVariables = untrustedConfig.planTemplateVariables;
|
|
1837
|
+
config.planTemplateVariables = untrustedConfig_planTemplateVariables;
|
|
1445
1838
|
const untrustedConfig_reply = untrustedConfig.reply;
|
|
1446
1839
|
if (ArrayIsArray$1(untrustedConfig_reply)) {
|
|
1447
1840
|
const untrustedConfig_reply_array = [];
|
|
@@ -1511,30 +1904,46 @@ const sendMessageAdapterFactory = (luvio) => {
|
|
|
1511
1904
|
};
|
|
1512
1905
|
|
|
1513
1906
|
let getBotId;
|
|
1907
|
+
let getRecommendedPlanTemplates;
|
|
1514
1908
|
let sendMessage;
|
|
1515
1909
|
// Imperative GET Adapters
|
|
1516
1910
|
let getBotId_imperative;
|
|
1911
|
+
let getRecommendedPlanTemplates_imperative;
|
|
1517
1912
|
// Adapter Metadata
|
|
1518
1913
|
const getBotIdMetadata = { apiFamily: 'einsteincopilot-bot', name: 'getBotId', ttl: 30000 };
|
|
1914
|
+
const getRecommendedPlanTemplatesMetadata = {
|
|
1915
|
+
apiFamily: 'einsteincopilot-bot',
|
|
1916
|
+
name: 'getRecommendedPlanTemplates',
|
|
1917
|
+
ttl: 900000,
|
|
1918
|
+
};
|
|
1519
1919
|
// Notify Update Available
|
|
1520
1920
|
function bindExportsTo(luvio) {
|
|
1521
1921
|
// LDS Adapters
|
|
1522
1922
|
const getBotId_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getBotId', getBotIdAdapterFactory), getBotIdMetadata);
|
|
1923
|
+
const getRecommendedPlanTemplates_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getRecommendedPlanTemplates', getRecommendedPlanTemplatesAdapterFactory), getRecommendedPlanTemplatesMetadata);
|
|
1523
1924
|
function unwrapSnapshotData(factory) {
|
|
1524
1925
|
const adapter = factory(luvio);
|
|
1525
1926
|
return (config) => adapter(config).then((snapshot) => snapshot.data);
|
|
1526
1927
|
}
|
|
1527
1928
|
return {
|
|
1528
1929
|
getBotId: createWireAdapterConstructor(luvio, getBotId_ldsAdapter, getBotIdMetadata),
|
|
1930
|
+
getRecommendedPlanTemplates: createWireAdapterConstructor(luvio, getRecommendedPlanTemplates_ldsAdapter, getRecommendedPlanTemplatesMetadata),
|
|
1529
1931
|
sendMessage: unwrapSnapshotData(sendMessageAdapterFactory),
|
|
1530
1932
|
// Imperative GET Adapters
|
|
1531
1933
|
getBotId_imperative: createImperativeAdapter(luvio, getBotId_ldsAdapter, getBotIdMetadata),
|
|
1934
|
+
getRecommendedPlanTemplates_imperative: createImperativeAdapter(luvio, getRecommendedPlanTemplates_ldsAdapter, getRecommendedPlanTemplatesMetadata),
|
|
1532
1935
|
// Notify Update Availables
|
|
1533
1936
|
};
|
|
1534
1937
|
}
|
|
1535
1938
|
withDefaultLuvio((luvio) => {
|
|
1536
|
-
({
|
|
1939
|
+
({
|
|
1940
|
+
getBotId,
|
|
1941
|
+
getRecommendedPlanTemplates,
|
|
1942
|
+
sendMessage,
|
|
1943
|
+
getBotId_imperative,
|
|
1944
|
+
getRecommendedPlanTemplates_imperative,
|
|
1945
|
+
} = bindExportsTo(luvio));
|
|
1537
1946
|
});
|
|
1538
1947
|
|
|
1539
|
-
export { getBotId, getBotId_imperative, sendMessage };
|
|
1540
|
-
// version: 1.266.0-
|
|
1948
|
+
export { getBotId, getBotId_imperative, getRecommendedPlanTemplates, getRecommendedPlanTemplates_imperative, sendMessage };
|
|
1949
|
+
// version: 1.266.0-dev18-e47733375
|