@salesforce/lds-adapters-service-einstein-copilot-bot 1.266.0-dev2 → 1.266.0-dev20
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 +757 -168
- package/dist/es/es2018/types/src/generated/adapters/getRecommendedPlanTemplates.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/adapters/sendMessage.d.ts +5 -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 +5 -0
- package/dist/es/es2018/types/src/generated/types/CollectMessageRepresentation.d.ts +6 -3
- package/dist/es/es2018/types/src/generated/types/ConversationRuntimeProxyInputRepresentation.d.ts +16 -1
- package/dist/es/es2018/types/src/generated/types/ConversationRuntimeProxyMessageRepresentation.d.ts +7 -1
- package/dist/es/es2018/types/src/generated/types/EsTypeMessageRepresentation.d.ts +4 -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 +656 -51
- package/src/raml/api.raml +97 -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,95 +276,123 @@ 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 = "e8cb7e20392935088ea2f98edb927e8a";
|
|
363
|
+
function validate$7(obj, path = 'EsTypeMessageRepresentation') {
|
|
344
364
|
const v_error = (() => {
|
|
345
365
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
346
366
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
347
367
|
}
|
|
368
|
+
if (obj.property !== undefined) {
|
|
369
|
+
const obj_property = obj.property;
|
|
370
|
+
const path_property = path + '.property';
|
|
371
|
+
let obj_property_union0 = null;
|
|
372
|
+
const obj_property_union0_error = (() => {
|
|
373
|
+
if (typeof obj_property !== 'string') {
|
|
374
|
+
return new TypeError('Expected "string" but received "' + typeof obj_property + '" (at "' + path_property + '")');
|
|
375
|
+
}
|
|
376
|
+
})();
|
|
377
|
+
if (obj_property_union0_error != null) {
|
|
378
|
+
obj_property_union0 = obj_property_union0_error.message;
|
|
379
|
+
}
|
|
380
|
+
let obj_property_union1 = null;
|
|
381
|
+
const obj_property_union1_error = (() => {
|
|
382
|
+
if (obj_property !== null) {
|
|
383
|
+
return new TypeError('Expected "null" but received "' + typeof obj_property + '" (at "' + path_property + '")');
|
|
384
|
+
}
|
|
385
|
+
})();
|
|
386
|
+
if (obj_property_union1_error != null) {
|
|
387
|
+
obj_property_union1 = obj_property_union1_error.message;
|
|
388
|
+
}
|
|
389
|
+
if (obj_property_union0 && obj_property_union1) {
|
|
390
|
+
let message = 'Object doesn\'t match union (at "' + path_property + '")';
|
|
391
|
+
message += '\n' + obj_property_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
392
|
+
message += '\n' + obj_property_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
393
|
+
return new TypeError(message);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
348
396
|
const obj_type = obj.type;
|
|
349
397
|
const path_type = path + '.type';
|
|
350
398
|
if (typeof obj_type !== 'string') {
|
|
@@ -358,12 +406,17 @@ function validate$5(obj, path = 'EsTypeMessageRepresentation') {
|
|
|
358
406
|
})();
|
|
359
407
|
return v_error === undefined ? null : v_error;
|
|
360
408
|
}
|
|
361
|
-
const select$
|
|
409
|
+
const select$8 = function EsTypeMessageRepresentationSelect() {
|
|
362
410
|
return {
|
|
363
411
|
kind: 'Fragment',
|
|
364
|
-
version: VERSION$
|
|
412
|
+
version: VERSION$6,
|
|
365
413
|
private: [],
|
|
366
414
|
selections: [
|
|
415
|
+
{
|
|
416
|
+
name: 'property',
|
|
417
|
+
kind: 'Scalar',
|
|
418
|
+
required: false
|
|
419
|
+
},
|
|
367
420
|
{
|
|
368
421
|
name: 'type',
|
|
369
422
|
kind: 'Scalar'
|
|
@@ -376,12 +429,25 @@ const select$5 = function EsTypeMessageRepresentationSelect() {
|
|
|
376
429
|
]
|
|
377
430
|
};
|
|
378
431
|
};
|
|
379
|
-
function equals$
|
|
432
|
+
function equals$6(existing, incoming) {
|
|
380
433
|
const existing_type = existing.type;
|
|
381
434
|
const incoming_type = incoming.type;
|
|
382
435
|
if (!(existing_type === incoming_type)) {
|
|
383
436
|
return false;
|
|
384
437
|
}
|
|
438
|
+
const existing_property = existing.property;
|
|
439
|
+
const incoming_property = incoming.property;
|
|
440
|
+
// if at least one of these optionals is defined
|
|
441
|
+
if (existing_property !== undefined || incoming_property !== undefined) {
|
|
442
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
443
|
+
// not equal
|
|
444
|
+
if (existing_property === undefined || incoming_property === undefined) {
|
|
445
|
+
return false;
|
|
446
|
+
}
|
|
447
|
+
if (!(existing_property === incoming_property)) {
|
|
448
|
+
return false;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
385
451
|
const existing_value = existing.value;
|
|
386
452
|
const incoming_value = incoming.value;
|
|
387
453
|
if (JSONStringify(incoming_value) !== JSONStringify(existing_value)) {
|
|
@@ -390,7 +456,7 @@ function equals$4(existing, incoming) {
|
|
|
390
456
|
return true;
|
|
391
457
|
}
|
|
392
458
|
|
|
393
|
-
function validate$
|
|
459
|
+
function validate$6(obj, path = 'VariableRepresentation') {
|
|
394
460
|
const v_error = (() => {
|
|
395
461
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
396
462
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -400,17 +466,19 @@ function validate$4(obj, path = 'VariableRepresentation') {
|
|
|
400
466
|
if (typeof obj_name !== 'string') {
|
|
401
467
|
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
402
468
|
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
469
|
+
if (obj.value !== undefined) {
|
|
470
|
+
const obj_value = obj.value;
|
|
471
|
+
const path_value = path + '.value';
|
|
472
|
+
if (typeof obj_value !== 'string') {
|
|
473
|
+
return new TypeError('Expected "string" but received "' + typeof obj_value + '" (at "' + path_value + '")');
|
|
474
|
+
}
|
|
407
475
|
}
|
|
408
476
|
})();
|
|
409
477
|
return v_error === undefined ? null : v_error;
|
|
410
478
|
}
|
|
411
479
|
|
|
412
|
-
const VERSION$
|
|
413
|
-
function validate$
|
|
480
|
+
const VERSION$5 = "4e28b61c3ea362f1c68b28897784111e";
|
|
481
|
+
function validate$5(obj, path = 'ConversationRuntimeProxyChoiceRepresentation') {
|
|
414
482
|
const v_error = (() => {
|
|
415
483
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
416
484
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -428,10 +496,10 @@ function validate$3(obj, path = 'ConversationRuntimeProxyChoiceRepresentation')
|
|
|
428
496
|
})();
|
|
429
497
|
return v_error === undefined ? null : v_error;
|
|
430
498
|
}
|
|
431
|
-
const select$
|
|
499
|
+
const select$7 = function ConversationRuntimeProxyChoiceRepresentationSelect() {
|
|
432
500
|
return {
|
|
433
501
|
kind: 'Fragment',
|
|
434
|
-
version: VERSION$
|
|
502
|
+
version: VERSION$5,
|
|
435
503
|
private: [],
|
|
436
504
|
selections: [
|
|
437
505
|
{
|
|
@@ -445,7 +513,7 @@ const select$4 = function ConversationRuntimeProxyChoiceRepresentationSelect() {
|
|
|
445
513
|
]
|
|
446
514
|
};
|
|
447
515
|
};
|
|
448
|
-
function equals$
|
|
516
|
+
function equals$5(existing, incoming) {
|
|
449
517
|
const existing_alias = existing.alias;
|
|
450
518
|
const incoming_alias = incoming.alias;
|
|
451
519
|
if (!(existing_alias === incoming_alias)) {
|
|
@@ -459,19 +527,49 @@ function equals$3(existing, incoming) {
|
|
|
459
527
|
return true;
|
|
460
528
|
}
|
|
461
529
|
|
|
462
|
-
const VERSION$
|
|
463
|
-
function validate$
|
|
530
|
+
const VERSION$4 = "477724425d0742c030025796c88ebf5d";
|
|
531
|
+
function validate$4(obj, path = 'CollectMessageRepresentation') {
|
|
464
532
|
const v_error = (() => {
|
|
465
533
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
466
534
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
467
535
|
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
536
|
+
if (obj.data !== undefined) {
|
|
537
|
+
const obj_data = obj.data;
|
|
538
|
+
const path_data = path + '.data';
|
|
539
|
+
const referencepath_dataValidationError = validate$7(obj_data, path_data);
|
|
540
|
+
if (referencepath_dataValidationError !== null) {
|
|
541
|
+
let message = 'Object doesn\'t match EsTypeMessageRepresentation (at "' + path_data + '")\n';
|
|
542
|
+
message += referencepath_dataValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
543
|
+
return new TypeError(message);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
if (obj.targetProperty !== undefined) {
|
|
547
|
+
const obj_targetProperty = obj.targetProperty;
|
|
548
|
+
const path_targetProperty = path + '.targetProperty';
|
|
549
|
+
let obj_targetProperty_union0 = null;
|
|
550
|
+
const obj_targetProperty_union0_error = (() => {
|
|
551
|
+
if (typeof obj_targetProperty !== 'string') {
|
|
552
|
+
return new TypeError('Expected "string" but received "' + typeof obj_targetProperty + '" (at "' + path_targetProperty + '")');
|
|
553
|
+
}
|
|
554
|
+
})();
|
|
555
|
+
if (obj_targetProperty_union0_error != null) {
|
|
556
|
+
obj_targetProperty_union0 = obj_targetProperty_union0_error.message;
|
|
557
|
+
}
|
|
558
|
+
let obj_targetProperty_union1 = null;
|
|
559
|
+
const obj_targetProperty_union1_error = (() => {
|
|
560
|
+
if (obj_targetProperty !== null) {
|
|
561
|
+
return new TypeError('Expected "null" but received "' + typeof obj_targetProperty + '" (at "' + path_targetProperty + '")');
|
|
562
|
+
}
|
|
563
|
+
})();
|
|
564
|
+
if (obj_targetProperty_union1_error != null) {
|
|
565
|
+
obj_targetProperty_union1 = obj_targetProperty_union1_error.message;
|
|
566
|
+
}
|
|
567
|
+
if (obj_targetProperty_union0 && obj_targetProperty_union1) {
|
|
568
|
+
let message = 'Object doesn\'t match union (at "' + path_targetProperty + '")';
|
|
569
|
+
message += '\n' + obj_targetProperty_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
570
|
+
message += '\n' + obj_targetProperty_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
571
|
+
return new TypeError(message);
|
|
572
|
+
}
|
|
475
573
|
}
|
|
476
574
|
const obj_targetType = obj.targetType;
|
|
477
575
|
const path_targetType = path + '.targetType';
|
|
@@ -481,17 +579,23 @@ function validate$2(obj, path = 'CollectMessageRepresentation') {
|
|
|
481
579
|
})();
|
|
482
580
|
return v_error === undefined ? null : v_error;
|
|
483
581
|
}
|
|
484
|
-
const select$
|
|
485
|
-
const { selections: EsTypeMessageRepresentation__selections, opaque: EsTypeMessageRepresentation__opaque, } = select$
|
|
582
|
+
const select$6 = function CollectMessageRepresentationSelect() {
|
|
583
|
+
const { selections: EsTypeMessageRepresentation__selections, opaque: EsTypeMessageRepresentation__opaque, } = select$8();
|
|
486
584
|
return {
|
|
487
585
|
kind: 'Fragment',
|
|
488
|
-
version: VERSION$
|
|
586
|
+
version: VERSION$4,
|
|
489
587
|
private: [],
|
|
490
588
|
selections: [
|
|
491
589
|
{
|
|
492
590
|
name: 'data',
|
|
493
591
|
kind: 'Object',
|
|
494
|
-
selections: EsTypeMessageRepresentation__selections
|
|
592
|
+
selections: EsTypeMessageRepresentation__selections,
|
|
593
|
+
required: false
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
name: 'targetProperty',
|
|
597
|
+
kind: 'Scalar',
|
|
598
|
+
required: false
|
|
495
599
|
},
|
|
496
600
|
{
|
|
497
601
|
name: 'targetType',
|
|
@@ -500,7 +604,7 @@ const select$3 = function CollectMessageRepresentationSelect() {
|
|
|
500
604
|
]
|
|
501
605
|
};
|
|
502
606
|
};
|
|
503
|
-
function equals$
|
|
607
|
+
function equals$4(existing, incoming) {
|
|
504
608
|
const existing_targetType = existing.targetType;
|
|
505
609
|
const incoming_targetType = incoming.targetType;
|
|
506
610
|
if (!(existing_targetType === incoming_targetType)) {
|
|
@@ -508,15 +612,36 @@ function equals$2(existing, incoming) {
|
|
|
508
612
|
}
|
|
509
613
|
const existing_data = existing.data;
|
|
510
614
|
const incoming_data = incoming.data;
|
|
511
|
-
if
|
|
512
|
-
|
|
615
|
+
// if at least one of these optionals is defined
|
|
616
|
+
if (existing_data !== undefined || incoming_data !== undefined) {
|
|
617
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
618
|
+
// not equal
|
|
619
|
+
if (existing_data === undefined || incoming_data === undefined) {
|
|
620
|
+
return false;
|
|
621
|
+
}
|
|
622
|
+
if (!(equals$6(existing_data, incoming_data))) {
|
|
623
|
+
return false;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
const existing_targetProperty = existing.targetProperty;
|
|
627
|
+
const incoming_targetProperty = incoming.targetProperty;
|
|
628
|
+
// if at least one of these optionals is defined
|
|
629
|
+
if (existing_targetProperty !== undefined || incoming_targetProperty !== undefined) {
|
|
630
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
631
|
+
// not equal
|
|
632
|
+
if (existing_targetProperty === undefined || incoming_targetProperty === undefined) {
|
|
633
|
+
return false;
|
|
634
|
+
}
|
|
635
|
+
if (!(existing_targetProperty === incoming_targetProperty)) {
|
|
636
|
+
return false;
|
|
637
|
+
}
|
|
513
638
|
}
|
|
514
639
|
return true;
|
|
515
640
|
}
|
|
516
641
|
|
|
517
|
-
const TTL$
|
|
518
|
-
const VERSION$
|
|
519
|
-
function validate$
|
|
642
|
+
const TTL$2 = 30000;
|
|
643
|
+
const VERSION$3 = "55ac02bd055f57a2a12aa0fa4844d1a2";
|
|
644
|
+
function validate$3(obj, path = 'ConversationRuntimeProxyMessageRepresentation') {
|
|
520
645
|
const v_error = (() => {
|
|
521
646
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
522
647
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -530,7 +655,7 @@ function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
|
|
|
530
655
|
for (let i = 0; i < obj_choices.length; i++) {
|
|
531
656
|
const obj_choices_item = obj_choices[i];
|
|
532
657
|
const path_choices_item = path_choices + '[' + i + ']';
|
|
533
|
-
const referencepath_choices_itemValidationError = validate$
|
|
658
|
+
const referencepath_choices_itemValidationError = validate$5(obj_choices_item, path_choices_item);
|
|
534
659
|
if (referencepath_choices_itemValidationError !== null) {
|
|
535
660
|
let message = 'Object doesn\'t match ConversationRuntimeProxyChoiceRepresentation (at "' + path_choices_item + '")\n';
|
|
536
661
|
message += referencepath_choices_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
@@ -547,7 +672,7 @@ function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
|
|
|
547
672
|
for (let i = 0; i < obj_collect.length; i++) {
|
|
548
673
|
const obj_collect_item = obj_collect[i];
|
|
549
674
|
const path_collect_item = path_collect + '[' + i + ']';
|
|
550
|
-
const referencepath_collect_itemValidationError = validate$
|
|
675
|
+
const referencepath_collect_itemValidationError = validate$4(obj_collect_item, path_collect_item);
|
|
551
676
|
if (referencepath_collect_itemValidationError !== null) {
|
|
552
677
|
let message = 'Object doesn\'t match CollectMessageRepresentation (at "' + path_collect_item + '")\n';
|
|
553
678
|
message += referencepath_collect_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
@@ -564,7 +689,7 @@ function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
|
|
|
564
689
|
for (let i = 0; i < obj_confirm.length; i++) {
|
|
565
690
|
const obj_confirm_item = obj_confirm[i];
|
|
566
691
|
const path_confirm_item = path_confirm + '[' + i + ']';
|
|
567
|
-
const referencepath_confirm_itemValidationError = validate$
|
|
692
|
+
const referencepath_confirm_itemValidationError = validate$7(obj_confirm_item, path_confirm_item);
|
|
568
693
|
if (referencepath_confirm_itemValidationError !== null) {
|
|
569
694
|
let message = 'Object doesn\'t match EsTypeMessageRepresentation (at "' + path_confirm_item + '")\n';
|
|
570
695
|
message += referencepath_confirm_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
@@ -614,6 +739,34 @@ function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
|
|
|
614
739
|
return new TypeError(message);
|
|
615
740
|
}
|
|
616
741
|
}
|
|
742
|
+
if (obj.feedbackId !== undefined) {
|
|
743
|
+
const obj_feedbackId = obj.feedbackId;
|
|
744
|
+
const path_feedbackId = path + '.feedbackId';
|
|
745
|
+
let obj_feedbackId_union0 = null;
|
|
746
|
+
const obj_feedbackId_union0_error = (() => {
|
|
747
|
+
if (typeof obj_feedbackId !== 'string') {
|
|
748
|
+
return new TypeError('Expected "string" but received "' + typeof obj_feedbackId + '" (at "' + path_feedbackId + '")');
|
|
749
|
+
}
|
|
750
|
+
})();
|
|
751
|
+
if (obj_feedbackId_union0_error != null) {
|
|
752
|
+
obj_feedbackId_union0 = obj_feedbackId_union0_error.message;
|
|
753
|
+
}
|
|
754
|
+
let obj_feedbackId_union1 = null;
|
|
755
|
+
const obj_feedbackId_union1_error = (() => {
|
|
756
|
+
if (obj_feedbackId !== null) {
|
|
757
|
+
return new TypeError('Expected "null" but received "' + typeof obj_feedbackId + '" (at "' + path_feedbackId + '")');
|
|
758
|
+
}
|
|
759
|
+
})();
|
|
760
|
+
if (obj_feedbackId_union1_error != null) {
|
|
761
|
+
obj_feedbackId_union1 = obj_feedbackId_union1_error.message;
|
|
762
|
+
}
|
|
763
|
+
if (obj_feedbackId_union0 && obj_feedbackId_union1) {
|
|
764
|
+
let message = 'Object doesn\'t match union (at "' + path_feedbackId + '")';
|
|
765
|
+
message += '\n' + obj_feedbackId_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
766
|
+
message += '\n' + obj_feedbackId_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
767
|
+
return new TypeError(message);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
617
770
|
const obj_id = obj.id;
|
|
618
771
|
const path_id = path + '.id';
|
|
619
772
|
if (typeof obj_id !== 'string') {
|
|
@@ -675,6 +828,34 @@ function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
|
|
|
675
828
|
return new TypeError(message);
|
|
676
829
|
}
|
|
677
830
|
}
|
|
831
|
+
if (obj.planId !== undefined) {
|
|
832
|
+
const obj_planId = obj.planId;
|
|
833
|
+
const path_planId = path + '.planId';
|
|
834
|
+
let obj_planId_union0 = null;
|
|
835
|
+
const obj_planId_union0_error = (() => {
|
|
836
|
+
if (typeof obj_planId !== 'string') {
|
|
837
|
+
return new TypeError('Expected "string" but received "' + typeof obj_planId + '" (at "' + path_planId + '")');
|
|
838
|
+
}
|
|
839
|
+
})();
|
|
840
|
+
if (obj_planId_union0_error != null) {
|
|
841
|
+
obj_planId_union0 = obj_planId_union0_error.message;
|
|
842
|
+
}
|
|
843
|
+
let obj_planId_union1 = null;
|
|
844
|
+
const obj_planId_union1_error = (() => {
|
|
845
|
+
if (obj_planId !== null) {
|
|
846
|
+
return new TypeError('Expected "null" but received "' + typeof obj_planId + '" (at "' + path_planId + '")');
|
|
847
|
+
}
|
|
848
|
+
})();
|
|
849
|
+
if (obj_planId_union1_error != null) {
|
|
850
|
+
obj_planId_union1 = obj_planId_union1_error.message;
|
|
851
|
+
}
|
|
852
|
+
if (obj_planId_union0 && obj_planId_union1) {
|
|
853
|
+
let message = 'Object doesn\'t match union (at "' + path_planId + '")';
|
|
854
|
+
message += '\n' + obj_planId_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
855
|
+
message += '\n' + obj_planId_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
856
|
+
return new TypeError(message);
|
|
857
|
+
}
|
|
858
|
+
}
|
|
678
859
|
if (obj.result !== undefined) {
|
|
679
860
|
const obj_result = obj.result;
|
|
680
861
|
const path_result = path + '.result';
|
|
@@ -684,7 +865,7 @@ function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
|
|
|
684
865
|
for (let i = 0; i < obj_result.length; i++) {
|
|
685
866
|
const obj_result_item = obj_result[i];
|
|
686
867
|
const path_result_item = path_result + '[' + i + ']';
|
|
687
|
-
const referencepath_result_itemValidationError = validate$
|
|
868
|
+
const referencepath_result_itemValidationError = validate$7(obj_result_item, path_result_item);
|
|
688
869
|
if (referencepath_result_itemValidationError !== null) {
|
|
689
870
|
let message = 'Object doesn\'t match EsTypeMessageRepresentation (at "' + path_result_item + '")\n';
|
|
690
871
|
message += referencepath_result_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
@@ -758,26 +939,26 @@ function validate$1(obj, path = 'ConversationRuntimeProxyMessageRepresentation')
|
|
|
758
939
|
})();
|
|
759
940
|
return v_error === undefined ? null : v_error;
|
|
760
941
|
}
|
|
761
|
-
const RepresentationType$
|
|
762
|
-
function keyBuilder$
|
|
763
|
-
return keyPrefix + '::' + RepresentationType$
|
|
942
|
+
const RepresentationType$2 = 'ConversationRuntimeProxyMessageRepresentation';
|
|
943
|
+
function keyBuilder$3(luvio, config) {
|
|
944
|
+
return keyPrefix + '::' + RepresentationType$2 + ':' + config.id;
|
|
764
945
|
}
|
|
765
946
|
function keyBuilderFromType$1(luvio, object) {
|
|
766
947
|
const keyParams = {
|
|
767
948
|
id: object.id
|
|
768
949
|
};
|
|
769
|
-
return keyBuilder$
|
|
950
|
+
return keyBuilder$3(luvio, keyParams);
|
|
770
951
|
}
|
|
771
|
-
function normalize$
|
|
952
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
772
953
|
return input;
|
|
773
954
|
}
|
|
774
|
-
const select$
|
|
775
|
-
const { selections: ConversationRuntimeProxyChoiceRepresentation__selections, opaque: ConversationRuntimeProxyChoiceRepresentation__opaque, } = select$
|
|
776
|
-
const { selections: CollectMessageRepresentation__selections, opaque: CollectMessageRepresentation__opaque, } = select$
|
|
777
|
-
const { selections: EsTypeMessageRepresentation__selections, opaque: EsTypeMessageRepresentation__opaque, } = select$
|
|
955
|
+
const select$5 = function ConversationRuntimeProxyMessageRepresentationSelect() {
|
|
956
|
+
const { selections: ConversationRuntimeProxyChoiceRepresentation__selections, opaque: ConversationRuntimeProxyChoiceRepresentation__opaque, } = select$7();
|
|
957
|
+
const { selections: CollectMessageRepresentation__selections, opaque: CollectMessageRepresentation__opaque, } = select$6();
|
|
958
|
+
const { selections: EsTypeMessageRepresentation__selections, opaque: EsTypeMessageRepresentation__opaque, } = select$8();
|
|
778
959
|
return {
|
|
779
960
|
kind: 'Fragment',
|
|
780
|
-
version: VERSION$
|
|
961
|
+
version: VERSION$3,
|
|
781
962
|
private: [],
|
|
782
963
|
selections: [
|
|
783
964
|
{
|
|
@@ -812,6 +993,11 @@ const select$2 = function ConversationRuntimeProxyMessageRepresentationSelect()
|
|
|
812
993
|
kind: 'Scalar',
|
|
813
994
|
required: false
|
|
814
995
|
},
|
|
996
|
+
{
|
|
997
|
+
name: 'feedbackId',
|
|
998
|
+
kind: 'Scalar',
|
|
999
|
+
required: false
|
|
1000
|
+
},
|
|
815
1001
|
{
|
|
816
1002
|
name: 'id',
|
|
817
1003
|
kind: 'Scalar'
|
|
@@ -826,6 +1012,11 @@ const select$2 = function ConversationRuntimeProxyMessageRepresentationSelect()
|
|
|
826
1012
|
kind: 'Scalar',
|
|
827
1013
|
required: false
|
|
828
1014
|
},
|
|
1015
|
+
{
|
|
1016
|
+
name: 'planId',
|
|
1017
|
+
kind: 'Scalar',
|
|
1018
|
+
required: false
|
|
1019
|
+
},
|
|
829
1020
|
{
|
|
830
1021
|
name: 'result',
|
|
831
1022
|
kind: 'Object',
|
|
@@ -851,7 +1042,7 @@ const select$2 = function ConversationRuntimeProxyMessageRepresentationSelect()
|
|
|
851
1042
|
]
|
|
852
1043
|
};
|
|
853
1044
|
};
|
|
854
|
-
function equals$
|
|
1045
|
+
function equals$3(existing, incoming) {
|
|
855
1046
|
const existing_id = existing.id;
|
|
856
1047
|
const incoming_id = incoming.id;
|
|
857
1048
|
if (!(existing_id === incoming_id)) {
|
|
@@ -880,7 +1071,7 @@ function equals$1(existing, incoming) {
|
|
|
880
1071
|
return false;
|
|
881
1072
|
}
|
|
882
1073
|
const equals_choices_items = equalsArray(existing_choices, incoming_choices, (existing_choices_item, incoming_choices_item) => {
|
|
883
|
-
if (!(equals$
|
|
1074
|
+
if (!(equals$5(existing_choices_item, incoming_choices_item))) {
|
|
884
1075
|
return false;
|
|
885
1076
|
}
|
|
886
1077
|
});
|
|
@@ -898,7 +1089,7 @@ function equals$1(existing, incoming) {
|
|
|
898
1089
|
return false;
|
|
899
1090
|
}
|
|
900
1091
|
const equals_collect_items = equalsArray(existing_collect, incoming_collect, (existing_collect_item, incoming_collect_item) => {
|
|
901
|
-
if (!(equals$
|
|
1092
|
+
if (!(equals$4(existing_collect_item, incoming_collect_item))) {
|
|
902
1093
|
return false;
|
|
903
1094
|
}
|
|
904
1095
|
});
|
|
@@ -916,7 +1107,7 @@ function equals$1(existing, incoming) {
|
|
|
916
1107
|
return false;
|
|
917
1108
|
}
|
|
918
1109
|
const equals_confirm_items = equalsArray(existing_confirm, incoming_confirm, (existing_confirm_item, incoming_confirm_item) => {
|
|
919
|
-
if (!(equals$
|
|
1110
|
+
if (!(equals$6(existing_confirm_item, incoming_confirm_item))) {
|
|
920
1111
|
return false;
|
|
921
1112
|
}
|
|
922
1113
|
});
|
|
@@ -955,6 +1146,19 @@ function equals$1(existing, incoming) {
|
|
|
955
1146
|
return false;
|
|
956
1147
|
}
|
|
957
1148
|
}
|
|
1149
|
+
const existing_feedbackId = existing.feedbackId;
|
|
1150
|
+
const incoming_feedbackId = incoming.feedbackId;
|
|
1151
|
+
// if at least one of these optionals is defined
|
|
1152
|
+
if (existing_feedbackId !== undefined || incoming_feedbackId !== undefined) {
|
|
1153
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
1154
|
+
// not equal
|
|
1155
|
+
if (existing_feedbackId === undefined || incoming_feedbackId === undefined) {
|
|
1156
|
+
return false;
|
|
1157
|
+
}
|
|
1158
|
+
if (!(existing_feedbackId === incoming_feedbackId)) {
|
|
1159
|
+
return false;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
958
1162
|
const existing_message = existing.message;
|
|
959
1163
|
const incoming_message = incoming.message;
|
|
960
1164
|
// if at least one of these optionals is defined
|
|
@@ -981,6 +1185,19 @@ function equals$1(existing, incoming) {
|
|
|
981
1185
|
return false;
|
|
982
1186
|
}
|
|
983
1187
|
}
|
|
1188
|
+
const existing_planId = existing.planId;
|
|
1189
|
+
const incoming_planId = incoming.planId;
|
|
1190
|
+
// if at least one of these optionals is defined
|
|
1191
|
+
if (existing_planId !== undefined || incoming_planId !== undefined) {
|
|
1192
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
1193
|
+
// not equal
|
|
1194
|
+
if (existing_planId === undefined || incoming_planId === undefined) {
|
|
1195
|
+
return false;
|
|
1196
|
+
}
|
|
1197
|
+
if (!(existing_planId === incoming_planId)) {
|
|
1198
|
+
return false;
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
984
1201
|
const existing_result = existing.result;
|
|
985
1202
|
const incoming_result = incoming.result;
|
|
986
1203
|
// if at least one of these optionals is defined
|
|
@@ -991,7 +1208,7 @@ function equals$1(existing, incoming) {
|
|
|
991
1208
|
return false;
|
|
992
1209
|
}
|
|
993
1210
|
const equals_result_items = equalsArray(existing_result, incoming_result, (existing_result_item, incoming_result_item) => {
|
|
994
|
-
if (!(equals$
|
|
1211
|
+
if (!(equals$6(existing_result_item, incoming_result_item))) {
|
|
995
1212
|
return false;
|
|
996
1213
|
}
|
|
997
1214
|
});
|
|
@@ -1027,31 +1244,31 @@ function equals$1(existing, incoming) {
|
|
|
1027
1244
|
}
|
|
1028
1245
|
return true;
|
|
1029
1246
|
}
|
|
1030
|
-
const ingest$
|
|
1247
|
+
const ingest$2 = function ConversationRuntimeProxyMessageRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1031
1248
|
if (process.env.NODE_ENV !== 'production') {
|
|
1032
|
-
const validateError = validate$
|
|
1249
|
+
const validateError = validate$3(input);
|
|
1033
1250
|
if (validateError !== null) {
|
|
1034
1251
|
throw validateError;
|
|
1035
1252
|
}
|
|
1036
1253
|
}
|
|
1037
1254
|
const key = keyBuilderFromType$1(luvio, input);
|
|
1038
|
-
const ttlToUse = TTL$
|
|
1039
|
-
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$
|
|
1255
|
+
const ttlToUse = TTL$2;
|
|
1256
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "einstein-copilot-bot", VERSION$3, RepresentationType$2, equals$3);
|
|
1040
1257
|
return createLink(key);
|
|
1041
1258
|
};
|
|
1042
|
-
function getTypeCacheKeys$
|
|
1259
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
1043
1260
|
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1044
1261
|
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
1045
1262
|
rootKeySet.set(rootKey, {
|
|
1046
1263
|
namespace: keyPrefix,
|
|
1047
|
-
representationName: RepresentationType$
|
|
1264
|
+
representationName: RepresentationType$2,
|
|
1048
1265
|
mergeable: false
|
|
1049
1266
|
});
|
|
1050
1267
|
}
|
|
1051
1268
|
|
|
1052
|
-
const TTL = 30000;
|
|
1053
|
-
const VERSION = "fe7024fb1132250f97d9616482f09f99";
|
|
1054
|
-
function validate(obj, path = 'ConversationRuntimeProxyRepresentation') {
|
|
1269
|
+
const TTL$1 = 30000;
|
|
1270
|
+
const VERSION$2 = "fe7024fb1132250f97d9616482f09f99";
|
|
1271
|
+
function validate$2(obj, path = 'ConversationRuntimeProxyRepresentation') {
|
|
1055
1272
|
const v_error = (() => {
|
|
1056
1273
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1057
1274
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -1103,23 +1320,23 @@ function validate(obj, path = 'ConversationRuntimeProxyRepresentation') {
|
|
|
1103
1320
|
})();
|
|
1104
1321
|
return v_error === undefined ? null : v_error;
|
|
1105
1322
|
}
|
|
1106
|
-
const RepresentationType = 'ConversationRuntimeProxyRepresentation';
|
|
1107
|
-
function keyBuilder(luvio, config) {
|
|
1108
|
-
return keyPrefix + '::' + RepresentationType + ':' + config.id;
|
|
1323
|
+
const RepresentationType$1 = 'ConversationRuntimeProxyRepresentation';
|
|
1324
|
+
function keyBuilder$2(luvio, config) {
|
|
1325
|
+
return keyPrefix + '::' + RepresentationType$1 + ':' + config.id;
|
|
1109
1326
|
}
|
|
1110
1327
|
function keyBuilderFromType(luvio, object) {
|
|
1111
1328
|
const keyParams = {
|
|
1112
1329
|
id: object.requestId
|
|
1113
1330
|
};
|
|
1114
|
-
return keyBuilder(luvio, keyParams);
|
|
1331
|
+
return keyBuilder$2(luvio, keyParams);
|
|
1115
1332
|
}
|
|
1116
|
-
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
1333
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
1117
1334
|
const input_messages = input.messages;
|
|
1118
1335
|
const input_messages_id = path.fullPath + '__messages';
|
|
1119
1336
|
for (let i = 0; i < input_messages.length; i++) {
|
|
1120
1337
|
const input_messages_item = input_messages[i];
|
|
1121
1338
|
let input_messages_item_id = input_messages_id + '__' + i;
|
|
1122
|
-
input_messages[i] = ingest$
|
|
1339
|
+
input_messages[i] = ingest$2(input_messages_item, {
|
|
1123
1340
|
fullPath: input_messages_item_id,
|
|
1124
1341
|
propertyName: i,
|
|
1125
1342
|
parent: {
|
|
@@ -1132,10 +1349,10 @@ function normalize(input, existing, path, luvio, store, timestamp) {
|
|
|
1132
1349
|
}
|
|
1133
1350
|
return input;
|
|
1134
1351
|
}
|
|
1135
|
-
const select$
|
|
1352
|
+
const select$4 = function ConversationRuntimeProxyRepresentationSelect() {
|
|
1136
1353
|
return {
|
|
1137
1354
|
kind: 'Fragment',
|
|
1138
|
-
version: VERSION,
|
|
1355
|
+
version: VERSION$2,
|
|
1139
1356
|
private: [],
|
|
1140
1357
|
selections: [
|
|
1141
1358
|
{
|
|
@@ -1150,7 +1367,7 @@ const select$1 = function ConversationRuntimeProxyRepresentationSelect() {
|
|
|
1150
1367
|
name: 'messages',
|
|
1151
1368
|
kind: 'Link',
|
|
1152
1369
|
plural: true,
|
|
1153
|
-
fragment: select$
|
|
1370
|
+
fragment: select$5()
|
|
1154
1371
|
},
|
|
1155
1372
|
{
|
|
1156
1373
|
name: 'processedSequenceIds',
|
|
@@ -1168,7 +1385,7 @@ const select$1 = function ConversationRuntimeProxyRepresentationSelect() {
|
|
|
1168
1385
|
]
|
|
1169
1386
|
};
|
|
1170
1387
|
};
|
|
1171
|
-
function equals(existing, incoming) {
|
|
1388
|
+
function equals$2(existing, incoming) {
|
|
1172
1389
|
const existing_botId = existing.botId;
|
|
1173
1390
|
const incoming_botId = incoming.botId;
|
|
1174
1391
|
if (!(existing_botId === incoming_botId)) {
|
|
@@ -1211,45 +1428,45 @@ function equals(existing, incoming) {
|
|
|
1211
1428
|
}
|
|
1212
1429
|
return true;
|
|
1213
1430
|
}
|
|
1214
|
-
const ingest = function ConversationRuntimeProxyRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1431
|
+
const ingest$1 = function ConversationRuntimeProxyRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1215
1432
|
if (process.env.NODE_ENV !== 'production') {
|
|
1216
|
-
const validateError = validate(input);
|
|
1433
|
+
const validateError = validate$2(input);
|
|
1217
1434
|
if (validateError !== null) {
|
|
1218
1435
|
throw validateError;
|
|
1219
1436
|
}
|
|
1220
1437
|
}
|
|
1221
1438
|
const key = keyBuilderFromType(luvio, input);
|
|
1222
|
-
const ttlToUse = TTL;
|
|
1223
|
-
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "einstein-copilot-bot", VERSION, RepresentationType, equals);
|
|
1439
|
+
const ttlToUse = TTL$1;
|
|
1440
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "einstein-copilot-bot", VERSION$2, RepresentationType$1, equals$2);
|
|
1224
1441
|
return createLink(key);
|
|
1225
1442
|
};
|
|
1226
|
-
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
1443
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
1227
1444
|
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1228
1445
|
const rootKey = keyBuilderFromType(luvio, input);
|
|
1229
1446
|
rootKeySet.set(rootKey, {
|
|
1230
1447
|
namespace: keyPrefix,
|
|
1231
|
-
representationName: RepresentationType,
|
|
1448
|
+
representationName: RepresentationType$1,
|
|
1232
1449
|
mergeable: false
|
|
1233
1450
|
});
|
|
1234
1451
|
const input_messages_length = input.messages.length;
|
|
1235
1452
|
for (let i = 0; i < input_messages_length; i++) {
|
|
1236
|
-
getTypeCacheKeys$
|
|
1453
|
+
getTypeCacheKeys$2(rootKeySet, luvio, input.messages[i]);
|
|
1237
1454
|
}
|
|
1238
1455
|
}
|
|
1239
1456
|
|
|
1240
|
-
function select(luvio, params) {
|
|
1241
|
-
return select$
|
|
1457
|
+
function select$3(luvio, params) {
|
|
1458
|
+
return select$4();
|
|
1242
1459
|
}
|
|
1243
|
-
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
1244
|
-
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
1460
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
1461
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response);
|
|
1245
1462
|
}
|
|
1246
|
-
function ingestSuccess(luvio, resourceParams, response) {
|
|
1463
|
+
function ingestSuccess$1(luvio, resourceParams, response) {
|
|
1247
1464
|
const { body } = response;
|
|
1248
1465
|
const key = keyBuilderFromType(luvio, body);
|
|
1249
|
-
luvio.storeIngest(key, ingest, body);
|
|
1466
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
1250
1467
|
const snapshot = luvio.storeLookup({
|
|
1251
1468
|
recordId: key,
|
|
1252
|
-
node: select(),
|
|
1469
|
+
node: select$3(),
|
|
1253
1470
|
variables: {},
|
|
1254
1471
|
});
|
|
1255
1472
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -1260,7 +1477,7 @@ function ingestSuccess(luvio, resourceParams, response) {
|
|
|
1260
1477
|
deepFreeze(snapshot.data);
|
|
1261
1478
|
return snapshot;
|
|
1262
1479
|
}
|
|
1263
|
-
function createResourceRequest(config) {
|
|
1480
|
+
function createResourceRequest$1(config) {
|
|
1264
1481
|
const headers = {};
|
|
1265
1482
|
return {
|
|
1266
1483
|
baseUri: '/services/data/v60.0',
|
|
@@ -1274,29 +1491,36 @@ function createResourceRequest(config) {
|
|
|
1274
1491
|
};
|
|
1275
1492
|
}
|
|
1276
1493
|
|
|
1277
|
-
const adapterName = 'sendMessage';
|
|
1494
|
+
const adapterName$1 = 'sendMessage';
|
|
1278
1495
|
const sendMessage_ConfigPropertyMetadata = [
|
|
1279
1496
|
generateParamConfigMetadata('botId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1280
1497
|
generateParamConfigMetadata('botVersionId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1281
1498
|
generateParamConfigMetadata('message', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1282
1499
|
generateParamConfigMetadata('sessionId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1500
|
+
generateParamConfigMetadata('inReplyToMessageId', false, 2 /* Body */, 0 /* String */),
|
|
1501
|
+
generateParamConfigMetadata('intent', false, 2 /* Body */, 0 /* String */),
|
|
1283
1502
|
generateParamConfigMetadata('messageType', false, 2 /* Body */, 0 /* String */),
|
|
1503
|
+
generateParamConfigMetadata('planId', false, 2 /* Body */, 0 /* String */),
|
|
1504
|
+
generateParamConfigMetadata('planTemplateVariables', false, 2 /* Body */, 4 /* Unsupported */),
|
|
1284
1505
|
generateParamConfigMetadata('reply', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
1285
1506
|
generateParamConfigMetadata('text', false, 2 /* Body */, 0 /* String */),
|
|
1286
1507
|
generateParamConfigMetadata('type', false, 2 /* Body */, 0 /* String */),
|
|
1508
|
+
generateParamConfigMetadata('userUtterance', false, 2 /* Body */, 0 /* String */),
|
|
1287
1509
|
generateParamConfigMetadata('variables', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
1288
1510
|
];
|
|
1289
|
-
const sendMessage_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, sendMessage_ConfigPropertyMetadata);
|
|
1290
|
-
const createResourceParams = /*#__PURE__*/ createResourceParams$
|
|
1291
|
-
function typeCheckConfig(untrustedConfig) {
|
|
1511
|
+
const sendMessage_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, sendMessage_ConfigPropertyMetadata);
|
|
1512
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(sendMessage_ConfigPropertyMetadata);
|
|
1513
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
1292
1514
|
const config = {};
|
|
1293
|
-
typeCheckConfig$
|
|
1515
|
+
typeCheckConfig$3(untrustedConfig, config, sendMessage_ConfigPropertyMetadata);
|
|
1516
|
+
const untrustedConfig_planTemplateVariables = untrustedConfig.planTemplateVariables;
|
|
1517
|
+
config.planTemplateVariables = untrustedConfig_planTemplateVariables;
|
|
1294
1518
|
const untrustedConfig_reply = untrustedConfig.reply;
|
|
1295
1519
|
if (ArrayIsArray$1(untrustedConfig_reply)) {
|
|
1296
1520
|
const untrustedConfig_reply_array = [];
|
|
1297
1521
|
for (let i = 0, arrayLength = untrustedConfig_reply.length; i < arrayLength; i++) {
|
|
1298
1522
|
const untrustedConfig_reply_item = untrustedConfig_reply[i];
|
|
1299
|
-
const referenceEsTypeMessageRepresentationValidationError = validate$
|
|
1523
|
+
const referenceEsTypeMessageRepresentationValidationError = validate$7(untrustedConfig_reply_item);
|
|
1300
1524
|
if (referenceEsTypeMessageRepresentationValidationError === null) {
|
|
1301
1525
|
untrustedConfig_reply_array.push(untrustedConfig_reply_item);
|
|
1302
1526
|
}
|
|
@@ -1308,7 +1532,7 @@ function typeCheckConfig(untrustedConfig) {
|
|
|
1308
1532
|
const untrustedConfig_variables_array = [];
|
|
1309
1533
|
for (let i = 0, arrayLength = untrustedConfig_variables.length; i < arrayLength; i++) {
|
|
1310
1534
|
const untrustedConfig_variables_item = untrustedConfig_variables[i];
|
|
1311
|
-
const referenceVariableRepresentationValidationError = validate$
|
|
1535
|
+
const referenceVariableRepresentationValidationError = validate$6(untrustedConfig_variables_item);
|
|
1312
1536
|
if (referenceVariableRepresentationValidationError === null) {
|
|
1313
1537
|
untrustedConfig_variables_array.push(untrustedConfig_variables_item);
|
|
1314
1538
|
}
|
|
@@ -1317,30 +1541,30 @@ function typeCheckConfig(untrustedConfig) {
|
|
|
1317
1541
|
}
|
|
1318
1542
|
return config;
|
|
1319
1543
|
}
|
|
1320
|
-
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
1544
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
1321
1545
|
if (!untrustedIsObject(untrustedConfig)) {
|
|
1322
1546
|
return null;
|
|
1323
1547
|
}
|
|
1324
1548
|
if (process.env.NODE_ENV !== 'production') {
|
|
1325
1549
|
validateConfig(untrustedConfig, configPropertyNames);
|
|
1326
1550
|
}
|
|
1327
|
-
const config = typeCheckConfig(untrustedConfig);
|
|
1551
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
1328
1552
|
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1329
1553
|
return null;
|
|
1330
1554
|
}
|
|
1331
1555
|
return config;
|
|
1332
1556
|
}
|
|
1333
|
-
function buildNetworkSnapshot(luvio, config, options) {
|
|
1334
|
-
const resourceParams = createResourceParams(config);
|
|
1335
|
-
const request = createResourceRequest(resourceParams);
|
|
1557
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
1558
|
+
const resourceParams = createResourceParams$1(config);
|
|
1559
|
+
const request = createResourceRequest$1(resourceParams);
|
|
1336
1560
|
return luvio.dispatchResourceRequest(request, options)
|
|
1337
1561
|
.then((response) => {
|
|
1338
1562
|
return luvio.handleSuccessResponse(() => {
|
|
1339
|
-
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
1563
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response);
|
|
1340
1564
|
return luvio.storeBroadcast().then(() => snapshot);
|
|
1341
1565
|
}, () => {
|
|
1342
1566
|
const cache = new StoreKeyMap();
|
|
1343
|
-
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
1567
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
1344
1568
|
return cache;
|
|
1345
1569
|
});
|
|
1346
1570
|
}, (response) => {
|
|
@@ -1350,13 +1574,378 @@ function buildNetworkSnapshot(luvio, config, options) {
|
|
|
1350
1574
|
}
|
|
1351
1575
|
const sendMessageAdapterFactory = (luvio) => {
|
|
1352
1576
|
return function sendMessage(untrustedConfig) {
|
|
1353
|
-
const config = validateAdapterConfig(untrustedConfig, sendMessage_ConfigPropertyNames);
|
|
1577
|
+
const config = validateAdapterConfig$1(untrustedConfig, sendMessage_ConfigPropertyNames);
|
|
1354
1578
|
// Invalid or incomplete config
|
|
1355
1579
|
if (config === null) {
|
|
1356
1580
|
throw new Error('Invalid config for "sendMessage"');
|
|
1357
1581
|
}
|
|
1358
|
-
return buildNetworkSnapshot(luvio, config);
|
|
1582
|
+
return buildNetworkSnapshot$1(luvio, config);
|
|
1359
1583
|
};
|
|
1360
1584
|
};
|
|
1361
1585
|
|
|
1362
|
-
|
|
1586
|
+
const VERSION$1 = "504437088c2317480c651ac05a7565b5";
|
|
1587
|
+
function validate$1(obj, path = 'PlanTemplateRepresentation') {
|
|
1588
|
+
const v_error = (() => {
|
|
1589
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1590
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1591
|
+
}
|
|
1592
|
+
const obj_intent = obj.intent;
|
|
1593
|
+
const path_intent = path + '.intent';
|
|
1594
|
+
if (typeof obj_intent !== 'string') {
|
|
1595
|
+
return new TypeError('Expected "string" but received "' + typeof obj_intent + '" (at "' + path_intent + '")');
|
|
1596
|
+
}
|
|
1597
|
+
const obj_label = obj.label;
|
|
1598
|
+
const path_label = path + '.label';
|
|
1599
|
+
if (typeof obj_label !== 'string') {
|
|
1600
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
1601
|
+
}
|
|
1602
|
+
const obj_planTemplateId = obj.planTemplateId;
|
|
1603
|
+
const path_planTemplateId = path + '.planTemplateId';
|
|
1604
|
+
if (typeof obj_planTemplateId !== 'string') {
|
|
1605
|
+
return new TypeError('Expected "string" but received "' + typeof obj_planTemplateId + '" (at "' + path_planTemplateId + '")');
|
|
1606
|
+
}
|
|
1607
|
+
const obj_userUtterance = obj.userUtterance;
|
|
1608
|
+
const path_userUtterance = path + '.userUtterance';
|
|
1609
|
+
if (typeof obj_userUtterance !== 'string') {
|
|
1610
|
+
return new TypeError('Expected "string" but received "' + typeof obj_userUtterance + '" (at "' + path_userUtterance + '")');
|
|
1611
|
+
}
|
|
1612
|
+
const obj_variables = obj.variables;
|
|
1613
|
+
const path_variables = path + '.variables';
|
|
1614
|
+
if (typeof obj_variables !== 'object' || ArrayIsArray(obj_variables) || obj_variables === null) {
|
|
1615
|
+
return new TypeError('Expected "object" but received "' + typeof obj_variables + '" (at "' + path_variables + '")');
|
|
1616
|
+
}
|
|
1617
|
+
const obj_variables_keys = ObjectKeys(obj_variables);
|
|
1618
|
+
for (let i = 0; i < obj_variables_keys.length; i++) {
|
|
1619
|
+
const key = obj_variables_keys[i];
|
|
1620
|
+
const obj_variables_prop = obj_variables[key];
|
|
1621
|
+
const path_variables_prop = path_variables + '["' + key + '"]';
|
|
1622
|
+
if (typeof obj_variables_prop !== 'string') {
|
|
1623
|
+
return new TypeError('Expected "string" but received "' + typeof obj_variables_prop + '" (at "' + path_variables_prop + '")');
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
})();
|
|
1627
|
+
return v_error === undefined ? null : v_error;
|
|
1628
|
+
}
|
|
1629
|
+
const select$2 = function PlanTemplateRepresentationSelect() {
|
|
1630
|
+
return {
|
|
1631
|
+
kind: 'Fragment',
|
|
1632
|
+
version: VERSION$1,
|
|
1633
|
+
private: [],
|
|
1634
|
+
selections: [
|
|
1635
|
+
{
|
|
1636
|
+
name: 'intent',
|
|
1637
|
+
kind: 'Scalar'
|
|
1638
|
+
},
|
|
1639
|
+
{
|
|
1640
|
+
name: 'label',
|
|
1641
|
+
kind: 'Scalar'
|
|
1642
|
+
},
|
|
1643
|
+
{
|
|
1644
|
+
name: 'planTemplateId',
|
|
1645
|
+
kind: 'Scalar'
|
|
1646
|
+
},
|
|
1647
|
+
{
|
|
1648
|
+
name: 'userUtterance',
|
|
1649
|
+
kind: 'Scalar'
|
|
1650
|
+
},
|
|
1651
|
+
{
|
|
1652
|
+
name: 'variables',
|
|
1653
|
+
kind: 'Scalar',
|
|
1654
|
+
map: true
|
|
1655
|
+
}
|
|
1656
|
+
]
|
|
1657
|
+
};
|
|
1658
|
+
};
|
|
1659
|
+
function equals$1(existing, incoming) {
|
|
1660
|
+
const existing_intent = existing.intent;
|
|
1661
|
+
const incoming_intent = incoming.intent;
|
|
1662
|
+
if (!(existing_intent === incoming_intent)) {
|
|
1663
|
+
return false;
|
|
1664
|
+
}
|
|
1665
|
+
const existing_label = existing.label;
|
|
1666
|
+
const incoming_label = incoming.label;
|
|
1667
|
+
if (!(existing_label === incoming_label)) {
|
|
1668
|
+
return false;
|
|
1669
|
+
}
|
|
1670
|
+
const existing_planTemplateId = existing.planTemplateId;
|
|
1671
|
+
const incoming_planTemplateId = incoming.planTemplateId;
|
|
1672
|
+
if (!(existing_planTemplateId === incoming_planTemplateId)) {
|
|
1673
|
+
return false;
|
|
1674
|
+
}
|
|
1675
|
+
const existing_userUtterance = existing.userUtterance;
|
|
1676
|
+
const incoming_userUtterance = incoming.userUtterance;
|
|
1677
|
+
if (!(existing_userUtterance === incoming_userUtterance)) {
|
|
1678
|
+
return false;
|
|
1679
|
+
}
|
|
1680
|
+
const existing_variables = existing.variables;
|
|
1681
|
+
const incoming_variables = incoming.variables;
|
|
1682
|
+
const equals_variables_props = equalsObject(existing_variables, incoming_variables, (existing_variables_prop, incoming_variables_prop) => {
|
|
1683
|
+
if (!(existing_variables_prop === incoming_variables_prop)) {
|
|
1684
|
+
return false;
|
|
1685
|
+
}
|
|
1686
|
+
});
|
|
1687
|
+
if (equals_variables_props === false) {
|
|
1688
|
+
return false;
|
|
1689
|
+
}
|
|
1690
|
+
return true;
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
const TTL = 900000;
|
|
1694
|
+
const VERSION = "0503b0c5ce250e7f5fbf16f2d3f2fec4";
|
|
1695
|
+
function validate(obj, path = 'RecommendedPlanTemplatesRepresentation') {
|
|
1696
|
+
const v_error = (() => {
|
|
1697
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1698
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1699
|
+
}
|
|
1700
|
+
if (obj.errorMessage !== undefined) {
|
|
1701
|
+
const obj_errorMessage = obj.errorMessage;
|
|
1702
|
+
const path_errorMessage = path + '.errorMessage';
|
|
1703
|
+
if (typeof obj_errorMessage !== 'string') {
|
|
1704
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
const obj_isSuccess = obj.isSuccess;
|
|
1708
|
+
const path_isSuccess = path + '.isSuccess';
|
|
1709
|
+
if (typeof obj_isSuccess !== 'boolean') {
|
|
1710
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
|
|
1711
|
+
}
|
|
1712
|
+
const obj_planTemplates = obj.planTemplates;
|
|
1713
|
+
const path_planTemplates = path + '.planTemplates';
|
|
1714
|
+
if (!ArrayIsArray(obj_planTemplates)) {
|
|
1715
|
+
return new TypeError('Expected "array" but received "' + typeof obj_planTemplates + '" (at "' + path_planTemplates + '")');
|
|
1716
|
+
}
|
|
1717
|
+
for (let i = 0; i < obj_planTemplates.length; i++) {
|
|
1718
|
+
const obj_planTemplates_item = obj_planTemplates[i];
|
|
1719
|
+
const path_planTemplates_item = path_planTemplates + '[' + i + ']';
|
|
1720
|
+
const referencepath_planTemplates_itemValidationError = validate$1(obj_planTemplates_item, path_planTemplates_item);
|
|
1721
|
+
if (referencepath_planTemplates_itemValidationError !== null) {
|
|
1722
|
+
let message = 'Object doesn\'t match PlanTemplateRepresentation (at "' + path_planTemplates_item + '")\n';
|
|
1723
|
+
message += referencepath_planTemplates_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1724
|
+
return new TypeError(message);
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
})();
|
|
1728
|
+
return v_error === undefined ? null : v_error;
|
|
1729
|
+
}
|
|
1730
|
+
const RepresentationType = 'RecommendedPlanTemplatesRepresentation';
|
|
1731
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
1732
|
+
return input;
|
|
1733
|
+
}
|
|
1734
|
+
const select$1 = function RecommendedPlanTemplatesRepresentationSelect() {
|
|
1735
|
+
const { selections: PlanTemplateRepresentation__selections, opaque: PlanTemplateRepresentation__opaque, } = select$2();
|
|
1736
|
+
return {
|
|
1737
|
+
kind: 'Fragment',
|
|
1738
|
+
version: VERSION,
|
|
1739
|
+
private: [],
|
|
1740
|
+
selections: [
|
|
1741
|
+
{
|
|
1742
|
+
name: 'errorMessage',
|
|
1743
|
+
kind: 'Scalar',
|
|
1744
|
+
required: false
|
|
1745
|
+
},
|
|
1746
|
+
{
|
|
1747
|
+
name: 'isSuccess',
|
|
1748
|
+
kind: 'Scalar'
|
|
1749
|
+
},
|
|
1750
|
+
{
|
|
1751
|
+
name: 'planTemplates',
|
|
1752
|
+
kind: 'Object',
|
|
1753
|
+
plural: true,
|
|
1754
|
+
selections: PlanTemplateRepresentation__selections
|
|
1755
|
+
}
|
|
1756
|
+
]
|
|
1757
|
+
};
|
|
1758
|
+
};
|
|
1759
|
+
function equals(existing, incoming) {
|
|
1760
|
+
const existing_isSuccess = existing.isSuccess;
|
|
1761
|
+
const incoming_isSuccess = incoming.isSuccess;
|
|
1762
|
+
if (!(existing_isSuccess === incoming_isSuccess)) {
|
|
1763
|
+
return false;
|
|
1764
|
+
}
|
|
1765
|
+
const existing_errorMessage = existing.errorMessage;
|
|
1766
|
+
const incoming_errorMessage = incoming.errorMessage;
|
|
1767
|
+
// if at least one of these optionals is defined
|
|
1768
|
+
if (existing_errorMessage !== undefined || incoming_errorMessage !== undefined) {
|
|
1769
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
1770
|
+
// not equal
|
|
1771
|
+
if (existing_errorMessage === undefined || incoming_errorMessage === undefined) {
|
|
1772
|
+
return false;
|
|
1773
|
+
}
|
|
1774
|
+
if (!(existing_errorMessage === incoming_errorMessage)) {
|
|
1775
|
+
return false;
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
const existing_planTemplates = existing.planTemplates;
|
|
1779
|
+
const incoming_planTemplates = incoming.planTemplates;
|
|
1780
|
+
const equals_planTemplates_items = equalsArray(existing_planTemplates, incoming_planTemplates, (existing_planTemplates_item, incoming_planTemplates_item) => {
|
|
1781
|
+
if (!(equals$1(existing_planTemplates_item, incoming_planTemplates_item))) {
|
|
1782
|
+
return false;
|
|
1783
|
+
}
|
|
1784
|
+
});
|
|
1785
|
+
if (equals_planTemplates_items === false) {
|
|
1786
|
+
return false;
|
|
1787
|
+
}
|
|
1788
|
+
return true;
|
|
1789
|
+
}
|
|
1790
|
+
const ingest = function RecommendedPlanTemplatesRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1791
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1792
|
+
const validateError = validate(input);
|
|
1793
|
+
if (validateError !== null) {
|
|
1794
|
+
throw validateError;
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
const key = path.fullPath;
|
|
1798
|
+
const ttlToUse = TTL;
|
|
1799
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "einstein-copilot-bot", VERSION, RepresentationType, equals);
|
|
1800
|
+
return createLink(key);
|
|
1801
|
+
};
|
|
1802
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
1803
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1804
|
+
const rootKey = fullPathFactory();
|
|
1805
|
+
rootKeySet.set(rootKey, {
|
|
1806
|
+
namespace: keyPrefix,
|
|
1807
|
+
representationName: RepresentationType,
|
|
1808
|
+
mergeable: false
|
|
1809
|
+
});
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
function select(luvio, params) {
|
|
1813
|
+
return select$1();
|
|
1814
|
+
}
|
|
1815
|
+
function keyBuilder$1(luvio, params) {
|
|
1816
|
+
return keyPrefix + '::RecommendedPlanTemplatesRepresentation:(' + 'pageType:' + params.urlParams.pageType + ',' + 'objectType:' + params.urlParams.objectType + ')';
|
|
1817
|
+
}
|
|
1818
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
1819
|
+
getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1(luvio, resourceParams));
|
|
1820
|
+
}
|
|
1821
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
1822
|
+
const { body } = response;
|
|
1823
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
1824
|
+
luvio.storeIngest(key, ingest, body);
|
|
1825
|
+
const snapshot = luvio.storeLookup({
|
|
1826
|
+
recordId: key,
|
|
1827
|
+
node: select(),
|
|
1828
|
+
variables: {},
|
|
1829
|
+
}, snapshotRefresh);
|
|
1830
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1831
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1832
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
deepFreeze(snapshot.data);
|
|
1836
|
+
return snapshot;
|
|
1837
|
+
}
|
|
1838
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
1839
|
+
const key = keyBuilder$1(luvio, params);
|
|
1840
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1841
|
+
const storeMetadataParams = {
|
|
1842
|
+
ttl: TTL,
|
|
1843
|
+
namespace: keyPrefix,
|
|
1844
|
+
version: VERSION,
|
|
1845
|
+
representationName: RepresentationType
|
|
1846
|
+
};
|
|
1847
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1848
|
+
return errorSnapshot;
|
|
1849
|
+
}
|
|
1850
|
+
function createResourceRequest(config) {
|
|
1851
|
+
const headers = {};
|
|
1852
|
+
return {
|
|
1853
|
+
baseUri: '/services/data/v60.0',
|
|
1854
|
+
basePath: '/connect/recommended-plan-templates/' + config.urlParams.pageType + '/' + config.urlParams.objectType + '',
|
|
1855
|
+
method: 'get',
|
|
1856
|
+
body: null,
|
|
1857
|
+
urlParams: config.urlParams,
|
|
1858
|
+
queryParams: {},
|
|
1859
|
+
headers,
|
|
1860
|
+
priority: 'normal',
|
|
1861
|
+
};
|
|
1862
|
+
}
|
|
1863
|
+
|
|
1864
|
+
const adapterName = 'getRecommendedPlanTemplates';
|
|
1865
|
+
const getRecommendedPlanTemplates_ConfigPropertyMetadata = [
|
|
1866
|
+
generateParamConfigMetadata('pageType', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1867
|
+
generateParamConfigMetadata('objectType', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1868
|
+
];
|
|
1869
|
+
const getRecommendedPlanTemplates_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getRecommendedPlanTemplates_ConfigPropertyMetadata);
|
|
1870
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$3(getRecommendedPlanTemplates_ConfigPropertyMetadata);
|
|
1871
|
+
function keyBuilder(luvio, config) {
|
|
1872
|
+
const resourceParams = createResourceParams(config);
|
|
1873
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
1874
|
+
}
|
|
1875
|
+
function typeCheckConfig(untrustedConfig) {
|
|
1876
|
+
const config = {};
|
|
1877
|
+
typeCheckConfig$3(untrustedConfig, config, getRecommendedPlanTemplates_ConfigPropertyMetadata);
|
|
1878
|
+
return config;
|
|
1879
|
+
}
|
|
1880
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
1881
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1882
|
+
return null;
|
|
1883
|
+
}
|
|
1884
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1885
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1886
|
+
}
|
|
1887
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
1888
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1889
|
+
return null;
|
|
1890
|
+
}
|
|
1891
|
+
return config;
|
|
1892
|
+
}
|
|
1893
|
+
function adapterFragment(luvio, config) {
|
|
1894
|
+
createResourceParams(config);
|
|
1895
|
+
return select();
|
|
1896
|
+
}
|
|
1897
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
1898
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
1899
|
+
config,
|
|
1900
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1901
|
+
});
|
|
1902
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1903
|
+
}
|
|
1904
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
1905
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
1906
|
+
config,
|
|
1907
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1908
|
+
});
|
|
1909
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1910
|
+
}
|
|
1911
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
1912
|
+
const resourceParams = createResourceParams(config);
|
|
1913
|
+
const request = createResourceRequest(resourceParams);
|
|
1914
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1915
|
+
.then((response) => {
|
|
1916
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
1917
|
+
const cache = new StoreKeyMap();
|
|
1918
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
1919
|
+
return cache;
|
|
1920
|
+
});
|
|
1921
|
+
}, (response) => {
|
|
1922
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
1923
|
+
});
|
|
1924
|
+
}
|
|
1925
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
1926
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
|
|
1927
|
+
}
|
|
1928
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
1929
|
+
const { luvio, config } = context;
|
|
1930
|
+
const selector = {
|
|
1931
|
+
recordId: keyBuilder(luvio, config),
|
|
1932
|
+
node: adapterFragment(luvio, config),
|
|
1933
|
+
variables: {},
|
|
1934
|
+
};
|
|
1935
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1936
|
+
config,
|
|
1937
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
1938
|
+
});
|
|
1939
|
+
return cacheSnapshot;
|
|
1940
|
+
}
|
|
1941
|
+
const getRecommendedPlanTemplatesAdapterFactory = (luvio) => function einsteinCopilotBot__getRecommendedPlanTemplates(untrustedConfig, requestContext) {
|
|
1942
|
+
const config = validateAdapterConfig(untrustedConfig, getRecommendedPlanTemplates_ConfigPropertyNames);
|
|
1943
|
+
// Invalid or incomplete config
|
|
1944
|
+
if (config === null) {
|
|
1945
|
+
return null;
|
|
1946
|
+
}
|
|
1947
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1948
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
1949
|
+
};
|
|
1950
|
+
|
|
1951
|
+
export { getBotIdAdapterFactory, getRecommendedPlanTemplatesAdapterFactory, sendMessageAdapterFactory };
|