@salesforce/lds-adapters-service-einstein-copilot-bot 1.262.3 → 1.263.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@
4
4
  * For full license text, see the LICENSE.txt file
5
5
  */
6
6
 
7
- import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$1, typeCheckConfig as typeCheckConfig$1 } from '@luvio/engine';
7
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, StoreKeyMap, createResourceParams as createResourceParams$2, typeCheckConfig as typeCheckConfig$2 } from '@luvio/engine';
8
8
 
9
9
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
10
  const { keys: ObjectKeys, create: ObjectCreate } = Object;
@@ -41,6 +41,13 @@ function untrustedIsObject(untrusted) {
41
41
  function areRequiredParametersPresent(config, configPropertyNames) {
42
42
  return configPropertyNames.parameters.required.every(req => req in config);
43
43
  }
44
+ const snapshotRefreshOptions = {
45
+ overrides: {
46
+ headers: {
47
+ 'Cache-Control': 'no-cache',
48
+ },
49
+ }
50
+ };
44
51
  function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
45
52
  return {
46
53
  name,
@@ -84,6 +91,253 @@ function createLink(ref) {
84
91
  };
85
92
  }
86
93
 
94
+ const TTL$2 = 30000;
95
+ const VERSION$5 = "ab85410a28124cfed3d8eae7b8236853";
96
+ function validate$5(obj, path = 'CopilotBotInfoRepresentation') {
97
+ const v_error = (() => {
98
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
99
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
100
+ }
101
+ if (obj.botId !== undefined) {
102
+ const obj_botId = obj.botId;
103
+ const path_botId = path + '.botId';
104
+ if (typeof obj_botId !== 'string') {
105
+ return new TypeError('Expected "string" but received "' + typeof obj_botId + '" (at "' + path_botId + '")');
106
+ }
107
+ }
108
+ if (obj.errorMessage !== undefined) {
109
+ const obj_errorMessage = obj.errorMessage;
110
+ const path_errorMessage = path + '.errorMessage';
111
+ if (typeof obj_errorMessage !== 'string') {
112
+ return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
113
+ }
114
+ }
115
+ const obj_isSuccess = obj.isSuccess;
116
+ const path_isSuccess = path + '.isSuccess';
117
+ if (typeof obj_isSuccess !== 'boolean') {
118
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
119
+ }
120
+ })();
121
+ return v_error === undefined ? null : v_error;
122
+ }
123
+ const RepresentationType$2 = 'CopilotBotInfoRepresentation';
124
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
125
+ return input;
126
+ }
127
+ const select$7 = function CopilotBotInfoRepresentationSelect() {
128
+ return {
129
+ kind: 'Fragment',
130
+ version: VERSION$5,
131
+ private: [],
132
+ selections: [
133
+ {
134
+ name: 'botId',
135
+ kind: 'Scalar',
136
+ required: false
137
+ },
138
+ {
139
+ name: 'errorMessage',
140
+ kind: 'Scalar',
141
+ required: false
142
+ },
143
+ {
144
+ name: 'isSuccess',
145
+ kind: 'Scalar'
146
+ }
147
+ ]
148
+ };
149
+ };
150
+ function equals$5(existing, incoming) {
151
+ const existing_isSuccess = existing.isSuccess;
152
+ const incoming_isSuccess = incoming.isSuccess;
153
+ if (!(existing_isSuccess === incoming_isSuccess)) {
154
+ return false;
155
+ }
156
+ const existing_botId = existing.botId;
157
+ const incoming_botId = incoming.botId;
158
+ // if at least one of these optionals is defined
159
+ if (existing_botId !== undefined || incoming_botId !== undefined) {
160
+ // if one of these is not defined we know the other is defined and therefore
161
+ // not equal
162
+ if (existing_botId === undefined || incoming_botId === undefined) {
163
+ return false;
164
+ }
165
+ if (!(existing_botId === incoming_botId)) {
166
+ return false;
167
+ }
168
+ }
169
+ const existing_errorMessage = existing.errorMessage;
170
+ const incoming_errorMessage = incoming.errorMessage;
171
+ // if at least one of these optionals is defined
172
+ if (existing_errorMessage !== undefined || incoming_errorMessage !== undefined) {
173
+ // if one of these is not defined we know the other is defined and therefore
174
+ // not equal
175
+ if (existing_errorMessage === undefined || incoming_errorMessage === undefined) {
176
+ return false;
177
+ }
178
+ if (!(existing_errorMessage === incoming_errorMessage)) {
179
+ return false;
180
+ }
181
+ }
182
+ return true;
183
+ }
184
+ const ingest$2 = function CopilotBotInfoRepresentationIngest(input, path, luvio, store, timestamp) {
185
+ if (process.env.NODE_ENV !== 'production') {
186
+ const validateError = validate$5(input);
187
+ if (validateError !== null) {
188
+ throw validateError;
189
+ }
190
+ }
191
+ const key = path.fullPath;
192
+ const ttlToUse = TTL$2;
193
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "einstein-copilot-bot", VERSION$5, RepresentationType$2, equals$5);
194
+ return createLink(key);
195
+ };
196
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
197
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
198
+ const rootKey = fullPathFactory();
199
+ rootKeySet.set(rootKey, {
200
+ namespace: keyPrefix,
201
+ representationName: RepresentationType$2,
202
+ mergeable: false
203
+ });
204
+ }
205
+
206
+ function select$6(luvio, params) {
207
+ return select$7();
208
+ }
209
+ function keyBuilder$3(luvio, params) {
210
+ return keyPrefix + '::CopilotBotInfoRepresentation:(' + ')';
211
+ }
212
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
213
+ getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$3());
214
+ }
215
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
216
+ const { body } = response;
217
+ const key = keyBuilder$3();
218
+ luvio.storeIngest(key, ingest$2, body);
219
+ const snapshot = luvio.storeLookup({
220
+ recordId: key,
221
+ node: select$6(),
222
+ variables: {},
223
+ }, snapshotRefresh);
224
+ if (process.env.NODE_ENV !== 'production') {
225
+ if (snapshot.state !== 'Fulfilled') {
226
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
227
+ }
228
+ }
229
+ deepFreeze(snapshot.data);
230
+ return snapshot;
231
+ }
232
+ function ingestError(luvio, params, error, snapshotRefresh) {
233
+ const key = keyBuilder$3();
234
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
235
+ const storeMetadataParams = {
236
+ ttl: TTL$2,
237
+ namespace: keyPrefix,
238
+ version: VERSION$5,
239
+ representationName: RepresentationType$2
240
+ };
241
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
242
+ return errorSnapshot;
243
+ }
244
+ function createResourceRequest$1(config) {
245
+ const headers = {};
246
+ return {
247
+ baseUri: '/services/data/v60.0',
248
+ basePath: '/connect/conversation-runtime-proxy',
249
+ method: 'get',
250
+ body: null,
251
+ urlParams: {},
252
+ queryParams: {},
253
+ headers,
254
+ priority: 'normal',
255
+ };
256
+ }
257
+
258
+ const adapterName$1 = 'getBotId';
259
+ const getBotId_ConfigPropertyMetadata = [];
260
+ const getBotId_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getBotId_ConfigPropertyMetadata);
261
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$2(getBotId_ConfigPropertyMetadata);
262
+ function keyBuilder$2(luvio, config) {
263
+ createResourceParams$1(config);
264
+ return keyBuilder$3();
265
+ }
266
+ function typeCheckConfig$1(untrustedConfig) {
267
+ const config = {};
268
+ return config;
269
+ }
270
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
271
+ if (!untrustedIsObject(untrustedConfig)) {
272
+ return null;
273
+ }
274
+ if (process.env.NODE_ENV !== 'production') {
275
+ validateConfig(untrustedConfig, configPropertyNames);
276
+ }
277
+ const config = typeCheckConfig$1();
278
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
279
+ return null;
280
+ }
281
+ return config;
282
+ }
283
+ function adapterFragment(luvio, config) {
284
+ createResourceParams$1(config);
285
+ return select$6();
286
+ }
287
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
288
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
289
+ config,
290
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
291
+ });
292
+ return luvio.storeBroadcast().then(() => snapshot);
293
+ }
294
+ function onFetchResponseError(luvio, config, resourceParams, response) {
295
+ const snapshot = ingestError(luvio, resourceParams, response, {
296
+ config,
297
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
298
+ });
299
+ return luvio.storeBroadcast().then(() => snapshot);
300
+ }
301
+ function buildNetworkSnapshot$1(luvio, config, options) {
302
+ const resourceParams = createResourceParams$1(config);
303
+ const request = createResourceRequest$1();
304
+ return luvio.dispatchResourceRequest(request, options)
305
+ .then((response) => {
306
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
307
+ const cache = new StoreKeyMap();
308
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
309
+ return cache;
310
+ });
311
+ }, (response) => {
312
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
313
+ });
314
+ }
315
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
316
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
317
+ }
318
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
319
+ const { luvio, config } = context;
320
+ const selector = {
321
+ recordId: keyBuilder$2(luvio, config),
322
+ node: adapterFragment(luvio, config),
323
+ variables: {},
324
+ };
325
+ const cacheSnapshot = storeLookup(selector, {
326
+ config,
327
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
328
+ });
329
+ return cacheSnapshot;
330
+ }
331
+ const getBotIdAdapterFactory = (luvio) => function einsteinCopilotBot__getBotId(untrustedConfig, requestContext) {
332
+ const config = validateAdapterConfig$1(untrustedConfig, getBotId_ConfigPropertyNames);
333
+ // Invalid or incomplete config
334
+ if (config === null) {
335
+ return null;
336
+ }
337
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
338
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
339
+ };
340
+
87
341
  const VERSION$4 = "414b0e089081e78bc86ab595f115e269";
88
342
  function validate$4(obj, path = 'EsTypeMessageRepresentation') {
89
343
  const v_error = (() => {
@@ -1004,10 +1258,10 @@ const sendMessage_ConfigPropertyMetadata = [
1004
1258
  generateParamConfigMetadata('type', false, 2 /* Body */, 0 /* String */),
1005
1259
  ];
1006
1260
  const sendMessage_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, sendMessage_ConfigPropertyMetadata);
1007
- const createResourceParams = /*#__PURE__*/ createResourceParams$1(sendMessage_ConfigPropertyMetadata);
1261
+ const createResourceParams = /*#__PURE__*/ createResourceParams$2(sendMessage_ConfigPropertyMetadata);
1008
1262
  function typeCheckConfig(untrustedConfig) {
1009
1263
  const config = {};
1010
- typeCheckConfig$1(untrustedConfig, config, sendMessage_ConfigPropertyMetadata);
1264
+ typeCheckConfig$2(untrustedConfig, config, sendMessage_ConfigPropertyMetadata);
1011
1265
  const untrustedConfig_reply = untrustedConfig.reply;
1012
1266
  if (ArrayIsArray$1(untrustedConfig_reply)) {
1013
1267
  const untrustedConfig_reply_array = [];
@@ -1064,4 +1318,4 @@ const sendMessageAdapterFactory = (luvio) => {
1064
1318
  };
1065
1319
  };
1066
1320
 
1067
- export { sendMessageAdapterFactory };
1321
+ export { getBotIdAdapterFactory, sendMessageAdapterFactory };
@@ -0,0 +1,26 @@
1
+ import { AdapterConfigMetadata as $64$luvio_engine_AdapterConfigMetadata, Luvio as $64$luvio_engine_Luvio, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, Fragment as $64$luvio_engine_Fragment, Snapshot as $64$luvio_engine_Snapshot, FetchResponse as $64$luvio_engine_FetchResponse, ErrorResponse as $64$luvio_engine_ErrorResponse, DispatchResourceRequestContext as $64$luvio_engine_DispatchResourceRequestContext, CoercedAdapterRequestContext as $64$luvio_engine_CoercedAdapterRequestContext, StoreLookup as $64$luvio_engine_StoreLookup, AdapterFactory as $64$luvio_engine_AdapterFactory } from '@luvio/engine';
2
+ import { Untrusted as adapter$45$utils_Untrusted, AdapterValidationConfig as adapter$45$utils_AdapterValidationConfig } from './adapter-utils';
3
+ import { ResourceRequestConfig as resources_getConnectConversationRuntimeProxy_ResourceRequestConfig } from '../resources/getConnectConversationRuntimeProxy';
4
+ import { CopilotBotInfoRepresentation as types_CopilotBotInfoRepresentation_CopilotBotInfoRepresentation } from '../types/CopilotBotInfoRepresentation';
5
+ export declare const adapterName = "getBotId";
6
+ export declare const getBotId_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
7
+ export declare const getBotId_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
8
+ export interface GetBotIdConfig {
9
+ }
10
+ export declare const createResourceParams: (config: GetBotIdConfig) => resources_getConnectConversationRuntimeProxy_ResourceRequestConfig;
11
+ export declare function keyBuilder(luvio: $64$luvio_engine_Luvio, config: GetBotIdConfig): string;
12
+ export declare function keyBuilder_StructuredKey(luvio: $64$luvio_engine_Luvio, config: GetBotIdConfig): $64$luvio_engine_NormalizedKeyMetadata;
13
+ export declare function typeCheckConfig(untrustedConfig: adapter$45$utils_Untrusted<GetBotIdConfig>): adapter$45$utils_Untrusted<GetBotIdConfig>;
14
+ export declare function validateAdapterConfig(untrustedConfig: unknown, configPropertyNames: adapter$45$utils_AdapterValidationConfig): GetBotIdConfig | null;
15
+ export declare function adapterFragment(luvio: $64$luvio_engine_Luvio, config: GetBotIdConfig): $64$luvio_engine_Fragment;
16
+ export declare function buildCachedSnapshot(luvio: $64$luvio_engine_Luvio, config: GetBotIdConfig): $64$luvio_engine_Snapshot<types_CopilotBotInfoRepresentation_CopilotBotInfoRepresentation, any>;
17
+ export declare function onFetchResponseSuccess(luvio: $64$luvio_engine_Luvio, config: GetBotIdConfig, resourceParams: resources_getConnectConversationRuntimeProxy_ResourceRequestConfig, response: $64$luvio_engine_FetchResponse<types_CopilotBotInfoRepresentation_CopilotBotInfoRepresentation>): Promise<import("@luvio/engine").FulfilledSnapshot<types_CopilotBotInfoRepresentation_CopilotBotInfoRepresentation, {}> | import("@luvio/engine").StaleSnapshot<types_CopilotBotInfoRepresentation_CopilotBotInfoRepresentation, {}> | import("@luvio/engine").PendingSnapshot<types_CopilotBotInfoRepresentation_CopilotBotInfoRepresentation, any>>;
18
+ export declare function onFetchResponseError(luvio: $64$luvio_engine_Luvio, config: GetBotIdConfig, resourceParams: resources_getConnectConversationRuntimeProxy_ResourceRequestConfig, response: $64$luvio_engine_ErrorResponse): Promise<import("@luvio/engine").ErrorSnapshot>;
19
+ export declare function buildNetworkSnapshot(luvio: $64$luvio_engine_Luvio, config: GetBotIdConfig, options?: $64$luvio_engine_DispatchResourceRequestContext): Promise<$64$luvio_engine_Snapshot<types_CopilotBotInfoRepresentation_CopilotBotInfoRepresentation, any>>;
20
+ export type BuildSnapshotContext = {
21
+ luvio: $64$luvio_engine_Luvio;
22
+ config: GetBotIdConfig;
23
+ };
24
+ export declare function buildNetworkSnapshotCachePolicy(context: BuildSnapshotContext, coercedAdapterRequestContext: $64$luvio_engine_CoercedAdapterRequestContext): Promise<$64$luvio_engine_Snapshot<types_CopilotBotInfoRepresentation_CopilotBotInfoRepresentation, any>>;
25
+ export declare function buildCachedSnapshotCachePolicy(context: BuildSnapshotContext, storeLookup: $64$luvio_engine_StoreLookup<types_CopilotBotInfoRepresentation_CopilotBotInfoRepresentation>): $64$luvio_engine_Snapshot<types_CopilotBotInfoRepresentation_CopilotBotInfoRepresentation, any>;
26
+ export declare const getBotIdAdapterFactory: $64$luvio_engine_AdapterFactory<GetBotIdConfig, types_CopilotBotInfoRepresentation_CopilotBotInfoRepresentation>;
@@ -1 +1,2 @@
1
+ export { getBotIdAdapterFactory } from '../adapters/getBotId';
1
2
  export { sendMessageAdapterFactory } from '../adapters/sendMessage';
@@ -1,2 +1,4 @@
1
+ declare let getBotId: any;
1
2
  declare let sendMessage: any;
2
- export { sendMessage };
3
+ declare let getBotId_imperative: any;
4
+ export { getBotId, sendMessage, getBotId_imperative };
@@ -0,0 +1,12 @@
1
+ import { Luvio as $64$luvio_engine_Luvio, Fragment as $64$luvio_engine_Fragment, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, FetchResponse as $64$luvio_engine_FetchResponse, SnapshotRefresh as $64$luvio_engine_SnapshotRefresh, FulfilledSnapshot as $64$luvio_engine_FulfilledSnapshot, StaleSnapshot as $64$luvio_engine_StaleSnapshot, PendingSnapshot as $64$luvio_engine_PendingSnapshot, ErrorResponse as $64$luvio_engine_ErrorResponse, ErrorSnapshot as $64$luvio_engine_ErrorSnapshot, ResourceRequest as $64$luvio_engine_ResourceRequest } from '@luvio/engine';
2
+ import { CopilotBotInfoRepresentation as types_CopilotBotInfoRepresentation_CopilotBotInfoRepresentation } from '../types/CopilotBotInfoRepresentation';
3
+ export interface ResourceRequestConfig {
4
+ }
5
+ export declare function select(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig): $64$luvio_engine_Fragment;
6
+ export declare function keyBuilder(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig): string;
7
+ export declare function keyBuilder_StructuredKey(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig): $64$luvio_engine_NormalizedKeyMetadata;
8
+ export declare function getResponseCacheKeys(storeKeyMap: any, luvio: $64$luvio_engine_Luvio, resourceParams: ResourceRequestConfig, response: types_CopilotBotInfoRepresentation_CopilotBotInfoRepresentation): void;
9
+ export declare function ingestSuccess(luvio: $64$luvio_engine_Luvio, resourceParams: ResourceRequestConfig, response: $64$luvio_engine_FetchResponse<types_CopilotBotInfoRepresentation_CopilotBotInfoRepresentation>, snapshotRefresh?: $64$luvio_engine_SnapshotRefresh<types_CopilotBotInfoRepresentation_CopilotBotInfoRepresentation>): $64$luvio_engine_FulfilledSnapshot<types_CopilotBotInfoRepresentation_CopilotBotInfoRepresentation, {}> | $64$luvio_engine_StaleSnapshot<types_CopilotBotInfoRepresentation_CopilotBotInfoRepresentation, {}> | $64$luvio_engine_PendingSnapshot<types_CopilotBotInfoRepresentation_CopilotBotInfoRepresentation, any>;
10
+ export declare function ingestError(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig, error: $64$luvio_engine_ErrorResponse, snapshotRefresh?: $64$luvio_engine_SnapshotRefresh<types_CopilotBotInfoRepresentation_CopilotBotInfoRepresentation>): $64$luvio_engine_ErrorSnapshot;
11
+ export declare function createResourceRequest(config: ResourceRequestConfig): $64$luvio_engine_ResourceRequest;
12
+ export default createResourceRequest;
@@ -0,0 +1,35 @@
1
+ import { IngestPath as $64$luvio_engine_IngestPath, Luvio as $64$luvio_engine_Luvio, Store as $64$luvio_engine_Store, FragmentSelection as $64$luvio_engine_FragmentSelection, ResourceIngest as $64$luvio_engine_ResourceIngest, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata } from '@luvio/engine';
2
+ export declare const TTL = 30000;
3
+ export declare const VERSION = "ab85410a28124cfed3d8eae7b8236853";
4
+ export declare function validate(obj: any, path?: string): TypeError | null;
5
+ export declare const RepresentationType: string;
6
+ export declare function normalize(input: CopilotBotInfoRepresentation, existing: CopilotBotInfoRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): CopilotBotInfoRepresentationNormalized;
7
+ export declare const select: () => $64$luvio_engine_FragmentSelection;
8
+ export declare function equals(existing: CopilotBotInfoRepresentationNormalized, incoming: CopilotBotInfoRepresentationNormalized): boolean;
9
+ export declare const ingest: $64$luvio_engine_ResourceIngest;
10
+ export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableStoreKeyMetadataMap, luvio: $64$luvio_engine_Luvio, input: CopilotBotInfoRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
11
+ /**
12
+ * Represents the results of a get internal copilot bot id request
13
+ *
14
+ * Keys:
15
+ * (none)
16
+ */
17
+ export interface CopilotBotInfoRepresentationNormalized {
18
+ /** ID of the internal Copilot Bot. */
19
+ botId?: string;
20
+ /** Error message for the failed get operation. */
21
+ errorMessage?: string;
22
+ /** Success indicator of the get operation. */
23
+ isSuccess: boolean;
24
+ }
25
+ /**
26
+ * Represents the results of a get internal copilot bot id request
27
+ *
28
+ * Keys:
29
+ * (none)
30
+ */
31
+ export interface CopilotBotInfoRepresentation {
32
+ botId?: string;
33
+ errorMessage?: string;
34
+ isSuccess: boolean;
35
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-adapters-service-einstein-copilot-bot",
3
- "version": "1.262.3",
3
+ "version": "1.263.0",
4
4
  "description": "Einstein Copilot Bot API Family",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "dist/es/es2018/service-einstein-copilot-bot.js",
@@ -40,10 +40,10 @@
40
40
  "test:unit": "jest"
41
41
  },
42
42
  "dependencies": {
43
- "@salesforce/lds-bindings": "^1.262.3"
43
+ "@salesforce/lds-bindings": "^1.263.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@salesforce/lds-compiler-plugins": "^1.262.3"
46
+ "@salesforce/lds-compiler-plugins": "^1.263.0"
47
47
  },
48
48
  "nx": {
49
49
  "targets": {
package/sfdc/index.js CHANGED
@@ -12,8 +12,9 @@
12
12
  * *******************************************************************************************
13
13
  */
14
14
  /* proxy-compat-disable */
15
+ import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
15
16
  import { withDefaultLuvio } from 'force/ldsEngine';
16
- import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$1, typeCheckConfig as typeCheckConfig$1 } from 'force/luvioEngine';
17
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, StoreKeyMap, createResourceParams as createResourceParams$2, typeCheckConfig as typeCheckConfig$2 } from 'force/luvioEngine';
17
18
 
18
19
  const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
19
20
  const { keys: ObjectKeys, create: ObjectCreate } = Object;
@@ -50,6 +51,13 @@ function untrustedIsObject(untrusted) {
50
51
  function areRequiredParametersPresent(config, configPropertyNames) {
51
52
  return configPropertyNames.parameters.required.every(req => req in config);
52
53
  }
54
+ const snapshotRefreshOptions = {
55
+ overrides: {
56
+ headers: {
57
+ 'Cache-Control': 'no-cache',
58
+ },
59
+ }
60
+ };
53
61
  function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
54
62
  return {
55
63
  name,
@@ -93,6 +101,253 @@ function createLink(ref) {
93
101
  };
94
102
  }
95
103
 
104
+ const TTL$2 = 30000;
105
+ const VERSION$5 = "ab85410a28124cfed3d8eae7b8236853";
106
+ function validate$5(obj, path = 'CopilotBotInfoRepresentation') {
107
+ const v_error = (() => {
108
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
109
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
110
+ }
111
+ if (obj.botId !== undefined) {
112
+ const obj_botId = obj.botId;
113
+ const path_botId = path + '.botId';
114
+ if (typeof obj_botId !== 'string') {
115
+ return new TypeError('Expected "string" but received "' + typeof obj_botId + '" (at "' + path_botId + '")');
116
+ }
117
+ }
118
+ if (obj.errorMessage !== undefined) {
119
+ const obj_errorMessage = obj.errorMessage;
120
+ const path_errorMessage = path + '.errorMessage';
121
+ if (typeof obj_errorMessage !== 'string') {
122
+ return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
123
+ }
124
+ }
125
+ const obj_isSuccess = obj.isSuccess;
126
+ const path_isSuccess = path + '.isSuccess';
127
+ if (typeof obj_isSuccess !== 'boolean') {
128
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
129
+ }
130
+ })();
131
+ return v_error === undefined ? null : v_error;
132
+ }
133
+ const RepresentationType$2 = 'CopilotBotInfoRepresentation';
134
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
135
+ return input;
136
+ }
137
+ const select$7 = function CopilotBotInfoRepresentationSelect() {
138
+ return {
139
+ kind: 'Fragment',
140
+ version: VERSION$5,
141
+ private: [],
142
+ selections: [
143
+ {
144
+ name: 'botId',
145
+ kind: 'Scalar',
146
+ required: false
147
+ },
148
+ {
149
+ name: 'errorMessage',
150
+ kind: 'Scalar',
151
+ required: false
152
+ },
153
+ {
154
+ name: 'isSuccess',
155
+ kind: 'Scalar'
156
+ }
157
+ ]
158
+ };
159
+ };
160
+ function equals$5(existing, incoming) {
161
+ const existing_isSuccess = existing.isSuccess;
162
+ const incoming_isSuccess = incoming.isSuccess;
163
+ if (!(existing_isSuccess === incoming_isSuccess)) {
164
+ return false;
165
+ }
166
+ const existing_botId = existing.botId;
167
+ const incoming_botId = incoming.botId;
168
+ // if at least one of these optionals is defined
169
+ if (existing_botId !== undefined || incoming_botId !== undefined) {
170
+ // if one of these is not defined we know the other is defined and therefore
171
+ // not equal
172
+ if (existing_botId === undefined || incoming_botId === undefined) {
173
+ return false;
174
+ }
175
+ if (!(existing_botId === incoming_botId)) {
176
+ return false;
177
+ }
178
+ }
179
+ const existing_errorMessage = existing.errorMessage;
180
+ const incoming_errorMessage = incoming.errorMessage;
181
+ // if at least one of these optionals is defined
182
+ if (existing_errorMessage !== undefined || incoming_errorMessage !== undefined) {
183
+ // if one of these is not defined we know the other is defined and therefore
184
+ // not equal
185
+ if (existing_errorMessage === undefined || incoming_errorMessage === undefined) {
186
+ return false;
187
+ }
188
+ if (!(existing_errorMessage === incoming_errorMessage)) {
189
+ return false;
190
+ }
191
+ }
192
+ return true;
193
+ }
194
+ const ingest$2 = function CopilotBotInfoRepresentationIngest(input, path, luvio, store, timestamp) {
195
+ if (process.env.NODE_ENV !== 'production') {
196
+ const validateError = validate$5(input);
197
+ if (validateError !== null) {
198
+ throw validateError;
199
+ }
200
+ }
201
+ const key = path.fullPath;
202
+ const ttlToUse = TTL$2;
203
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "einstein-copilot-bot", VERSION$5, RepresentationType$2, equals$5);
204
+ return createLink(key);
205
+ };
206
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
207
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
208
+ const rootKey = fullPathFactory();
209
+ rootKeySet.set(rootKey, {
210
+ namespace: keyPrefix,
211
+ representationName: RepresentationType$2,
212
+ mergeable: false
213
+ });
214
+ }
215
+
216
+ function select$6(luvio, params) {
217
+ return select$7();
218
+ }
219
+ function keyBuilder$3(luvio, params) {
220
+ return keyPrefix + '::CopilotBotInfoRepresentation:(' + ')';
221
+ }
222
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
223
+ getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$3());
224
+ }
225
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
226
+ const { body } = response;
227
+ const key = keyBuilder$3();
228
+ luvio.storeIngest(key, ingest$2, body);
229
+ const snapshot = luvio.storeLookup({
230
+ recordId: key,
231
+ node: select$6(),
232
+ variables: {},
233
+ }, snapshotRefresh);
234
+ if (process.env.NODE_ENV !== 'production') {
235
+ if (snapshot.state !== 'Fulfilled') {
236
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
237
+ }
238
+ }
239
+ deepFreeze(snapshot.data);
240
+ return snapshot;
241
+ }
242
+ function ingestError(luvio, params, error, snapshotRefresh) {
243
+ const key = keyBuilder$3();
244
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
245
+ const storeMetadataParams = {
246
+ ttl: TTL$2,
247
+ namespace: keyPrefix,
248
+ version: VERSION$5,
249
+ representationName: RepresentationType$2
250
+ };
251
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
252
+ return errorSnapshot;
253
+ }
254
+ function createResourceRequest$1(config) {
255
+ const headers = {};
256
+ return {
257
+ baseUri: '/services/data/v60.0',
258
+ basePath: '/connect/conversation-runtime-proxy',
259
+ method: 'get',
260
+ body: null,
261
+ urlParams: {},
262
+ queryParams: {},
263
+ headers,
264
+ priority: 'normal',
265
+ };
266
+ }
267
+
268
+ const adapterName$1 = 'getBotId';
269
+ const getBotId_ConfigPropertyMetadata = [];
270
+ const getBotId_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getBotId_ConfigPropertyMetadata);
271
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$2(getBotId_ConfigPropertyMetadata);
272
+ function keyBuilder$2(luvio, config) {
273
+ createResourceParams$1(config);
274
+ return keyBuilder$3();
275
+ }
276
+ function typeCheckConfig$1(untrustedConfig) {
277
+ const config = {};
278
+ return config;
279
+ }
280
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
281
+ if (!untrustedIsObject(untrustedConfig)) {
282
+ return null;
283
+ }
284
+ if (process.env.NODE_ENV !== 'production') {
285
+ validateConfig(untrustedConfig, configPropertyNames);
286
+ }
287
+ const config = typeCheckConfig$1();
288
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
289
+ return null;
290
+ }
291
+ return config;
292
+ }
293
+ function adapterFragment(luvio, config) {
294
+ createResourceParams$1(config);
295
+ return select$6();
296
+ }
297
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
298
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
299
+ config,
300
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
301
+ });
302
+ return luvio.storeBroadcast().then(() => snapshot);
303
+ }
304
+ function onFetchResponseError(luvio, config, resourceParams, response) {
305
+ const snapshot = ingestError(luvio, resourceParams, response, {
306
+ config,
307
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
308
+ });
309
+ return luvio.storeBroadcast().then(() => snapshot);
310
+ }
311
+ function buildNetworkSnapshot$1(luvio, config, options) {
312
+ const resourceParams = createResourceParams$1(config);
313
+ const request = createResourceRequest$1();
314
+ return luvio.dispatchResourceRequest(request, options)
315
+ .then((response) => {
316
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
317
+ const cache = new StoreKeyMap();
318
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
319
+ return cache;
320
+ });
321
+ }, (response) => {
322
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
323
+ });
324
+ }
325
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
326
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
327
+ }
328
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
329
+ const { luvio, config } = context;
330
+ const selector = {
331
+ recordId: keyBuilder$2(luvio, config),
332
+ node: adapterFragment(luvio, config),
333
+ variables: {},
334
+ };
335
+ const cacheSnapshot = storeLookup(selector, {
336
+ config,
337
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
338
+ });
339
+ return cacheSnapshot;
340
+ }
341
+ const getBotIdAdapterFactory = (luvio) => function einsteinCopilotBot__getBotId(untrustedConfig, requestContext) {
342
+ const config = validateAdapterConfig$1(untrustedConfig, getBotId_ConfigPropertyNames);
343
+ // Invalid or incomplete config
344
+ if (config === null) {
345
+ return null;
346
+ }
347
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
348
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
349
+ };
350
+
96
351
  const VERSION$4 = "414b0e089081e78bc86ab595f115e269";
97
352
  function validate$4(obj, path = 'EsTypeMessageRepresentation') {
98
353
  const v_error = (() => {
@@ -1013,10 +1268,10 @@ const sendMessage_ConfigPropertyMetadata = [
1013
1268
  generateParamConfigMetadata('type', false, 2 /* Body */, 0 /* String */),
1014
1269
  ];
1015
1270
  const sendMessage_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, sendMessage_ConfigPropertyMetadata);
1016
- const createResourceParams = /*#__PURE__*/ createResourceParams$1(sendMessage_ConfigPropertyMetadata);
1271
+ const createResourceParams = /*#__PURE__*/ createResourceParams$2(sendMessage_ConfigPropertyMetadata);
1017
1272
  function typeCheckConfig(untrustedConfig) {
1018
1273
  const config = {};
1019
- typeCheckConfig$1(untrustedConfig, config, sendMessage_ConfigPropertyMetadata);
1274
+ typeCheckConfig$2(untrustedConfig, config, sendMessage_ConfigPropertyMetadata);
1020
1275
  const untrustedConfig_reply = untrustedConfig.reply;
1021
1276
  if (ArrayIsArray$1(untrustedConfig_reply)) {
1022
1277
  const untrustedConfig_reply_array = [];
@@ -1073,23 +1328,31 @@ const sendMessageAdapterFactory = (luvio) => {
1073
1328
  };
1074
1329
  };
1075
1330
 
1331
+ let getBotId;
1076
1332
  let sendMessage;
1333
+ // Imperative GET Adapters
1334
+ let getBotId_imperative;
1335
+ // Adapter Metadata
1336
+ const getBotIdMetadata = { apiFamily: 'einsteincopilot-bot', name: 'getBotId', ttl: 30000 };
1077
1337
  // Notify Update Available
1078
1338
  function bindExportsTo(luvio) {
1079
1339
  // LDS Adapters
1340
+ const getBotId_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getBotId', getBotIdAdapterFactory), getBotIdMetadata);
1080
1341
  function unwrapSnapshotData(factory) {
1081
1342
  const adapter = factory(luvio);
1082
1343
  return (config) => adapter(config).then((snapshot) => snapshot.data);
1083
1344
  }
1084
1345
  return {
1346
+ getBotId: createWireAdapterConstructor(luvio, getBotId_ldsAdapter, getBotIdMetadata),
1085
1347
  sendMessage: unwrapSnapshotData(sendMessageAdapterFactory),
1086
1348
  // Imperative GET Adapters
1349
+ getBotId_imperative: createImperativeAdapter(luvio, getBotId_ldsAdapter, getBotIdMetadata),
1087
1350
  // Notify Update Availables
1088
1351
  };
1089
1352
  }
1090
1353
  withDefaultLuvio((luvio) => {
1091
- ({ sendMessage } = bindExportsTo(luvio));
1354
+ ({ getBotId, sendMessage, getBotId_imperative } = bindExportsTo(luvio));
1092
1355
  });
1093
1356
 
1094
- export { sendMessage };
1095
- // version: 1.262.3-6d014447a
1357
+ export { getBotId, getBotId_imperative, sendMessage };
1358
+ // version: 1.263.0-378177d88
package/src/raml/api.raml CHANGED
@@ -172,6 +172,21 @@ types:
172
172
  description: SessionId to be used in future messages sent to the runtime engine.
173
173
  Allows continuing a conversation.
174
174
  type: string
175
+ CopilotBotInfoRepresentation:
176
+ description: Represents the results of a get internal copilot bot id request
177
+ type: object
178
+ properties:
179
+ botId:
180
+ description: ID of the internal Copilot Bot.
181
+ type: string
182
+ required: false
183
+ errorMessage:
184
+ description: Error message for the failed get operation.
185
+ type: string
186
+ required: false
187
+ isSuccess:
188
+ description: Success indicator of the get operation.
189
+ type: boolean
175
190
  EsTypeMessageRepresentation:
176
191
  description: Represents a ES type message
177
192
  type: object
@@ -184,6 +199,15 @@ types:
184
199
  type: object
185
200
  /connect:
186
201
  /conversation-runtime-proxy:
202
+ get:
203
+ displayName: getBotId
204
+ description: Get internal Copilot bot ID.
205
+ responses:
206
+ '200':
207
+ description: Success
208
+ body:
209
+ application/json:
210
+ type: CopilotBotInfoRepresentation
187
211
  post:
188
212
  displayName: sendMessage
189
213
  description: Send messages to the chatbot runtime.
@@ -19,11 +19,16 @@ types:
19
19
  (luvio.ttl): 30000
20
20
  CollectMessageRepresentation:
21
21
  (luvio.ttl): 30000
22
+ CopilotBotInfoRepresentation:
23
+ (luvio.ttl): 30000
22
24
  EsTypeMessageRepresentation:
23
25
  (luvio.ttl): 30000
24
26
 
25
27
  /connect:
26
28
  /conversation-runtime-proxy:
29
+ get:
30
+ (luvio.adapter):
31
+ name: getBotId
27
32
  post:
28
33
  (luvio.adapter):
29
34
  name: sendMessage