@openfin/cloud-interop-core-api 0.0.1-alpha.fffeb9a → 10.0.0-beta.1d
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/bundle.d.ts +882 -0
- package/index.cjs +665 -0
- package/index.mjs +661 -0
- package/package.json +17 -230
- package/dist/api.d.ts +0 -63
- package/dist/errors/api.error.d.ts +0 -7
- package/dist/index.cjs +0 -290
- package/dist/index.d.ts +0 -3
- package/dist/index.mjs +0 -4052
- package/dist/interfaces.d.ts +0 -142
package/bundle.d.ts
ADDED
|
@@ -0,0 +1,882 @@
|
|
|
1
|
+
import mqtt from 'mqtt';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Raised when an interop client receives an aggregate of intents from other connected sessions
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare type AggregateIntentDetailsEvent = {
|
|
9
|
+
responses: IntentDetailsEvent[];
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Represents an app intent
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export declare type AppIdentifier = z.infer<typeof appIdentifierSchema>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Schema for an AppIdentifier
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
declare const appIdentifierSchema: z.ZodObject<{
|
|
23
|
+
appId: z.ZodString;
|
|
24
|
+
instanceId: z.ZodOptional<z.ZodString>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
appId: string;
|
|
27
|
+
instanceId?: string | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
appId: string;
|
|
30
|
+
instanceId?: string | undefined;
|
|
31
|
+
}>;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents an app intent
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
export declare type AppIntent = z.infer<typeof appIntentSchema>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Schema for an app intent
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
declare const appIntentSchema: z.ZodObject<{
|
|
44
|
+
intent: z.ZodObject<{
|
|
45
|
+
displayName: z.ZodString;
|
|
46
|
+
name: z.ZodString;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
name: string;
|
|
49
|
+
displayName: string;
|
|
50
|
+
}, {
|
|
51
|
+
name: string;
|
|
52
|
+
displayName: string;
|
|
53
|
+
}>;
|
|
54
|
+
apps: z.ZodArray<z.ZodObject<{
|
|
55
|
+
description: z.ZodOptional<z.ZodString>;
|
|
56
|
+
icons: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
57
|
+
size: z.ZodOptional<z.ZodString>;
|
|
58
|
+
src: z.ZodString;
|
|
59
|
+
type: z.ZodOptional<z.ZodString>;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
src: string;
|
|
62
|
+
type?: string | undefined;
|
|
63
|
+
size?: string | undefined;
|
|
64
|
+
}, {
|
|
65
|
+
src: string;
|
|
66
|
+
type?: string | undefined;
|
|
67
|
+
size?: string | undefined;
|
|
68
|
+
}>, "many">>;
|
|
69
|
+
instanceMetadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
70
|
+
name: z.ZodOptional<z.ZodString>;
|
|
71
|
+
resultType: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
72
|
+
screenshots: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
73
|
+
label: z.ZodOptional<z.ZodString>;
|
|
74
|
+
size: z.ZodOptional<z.ZodString>;
|
|
75
|
+
src: z.ZodString;
|
|
76
|
+
type: z.ZodOptional<z.ZodString>;
|
|
77
|
+
}, "strip", z.ZodTypeAny, {
|
|
78
|
+
src: string;
|
|
79
|
+
type?: string | undefined;
|
|
80
|
+
size?: string | undefined;
|
|
81
|
+
label?: string | undefined;
|
|
82
|
+
}, {
|
|
83
|
+
src: string;
|
|
84
|
+
type?: string | undefined;
|
|
85
|
+
size?: string | undefined;
|
|
86
|
+
label?: string | undefined;
|
|
87
|
+
}>, "many">>;
|
|
88
|
+
title: z.ZodOptional<z.ZodString>;
|
|
89
|
+
tooltip: z.ZodOptional<z.ZodString>;
|
|
90
|
+
version: z.ZodOptional<z.ZodString>;
|
|
91
|
+
} & {
|
|
92
|
+
appId: z.ZodString;
|
|
93
|
+
instanceId: z.ZodOptional<z.ZodString>;
|
|
94
|
+
}, "strip", z.ZodTypeAny, {
|
|
95
|
+
appId: string;
|
|
96
|
+
instanceId?: string | undefined;
|
|
97
|
+
description?: string | undefined;
|
|
98
|
+
icons?: {
|
|
99
|
+
src: string;
|
|
100
|
+
type?: string | undefined;
|
|
101
|
+
size?: string | undefined;
|
|
102
|
+
}[] | undefined;
|
|
103
|
+
instanceMetadata?: Record<string, unknown> | undefined;
|
|
104
|
+
name?: string | undefined;
|
|
105
|
+
resultType?: string | null | undefined;
|
|
106
|
+
screenshots?: {
|
|
107
|
+
src: string;
|
|
108
|
+
type?: string | undefined;
|
|
109
|
+
size?: string | undefined;
|
|
110
|
+
label?: string | undefined;
|
|
111
|
+
}[] | undefined;
|
|
112
|
+
title?: string | undefined;
|
|
113
|
+
tooltip?: string | undefined;
|
|
114
|
+
version?: string | undefined;
|
|
115
|
+
}, {
|
|
116
|
+
appId: string;
|
|
117
|
+
instanceId?: string | undefined;
|
|
118
|
+
description?: string | undefined;
|
|
119
|
+
icons?: {
|
|
120
|
+
src: string;
|
|
121
|
+
type?: string | undefined;
|
|
122
|
+
size?: string | undefined;
|
|
123
|
+
}[] | undefined;
|
|
124
|
+
instanceMetadata?: Record<string, unknown> | undefined;
|
|
125
|
+
name?: string | undefined;
|
|
126
|
+
resultType?: string | null | undefined;
|
|
127
|
+
screenshots?: {
|
|
128
|
+
src: string;
|
|
129
|
+
type?: string | undefined;
|
|
130
|
+
size?: string | undefined;
|
|
131
|
+
label?: string | undefined;
|
|
132
|
+
}[] | undefined;
|
|
133
|
+
title?: string | undefined;
|
|
134
|
+
tooltip?: string | undefined;
|
|
135
|
+
version?: string | undefined;
|
|
136
|
+
}>, "many">;
|
|
137
|
+
}, "strip", z.ZodTypeAny, {
|
|
138
|
+
intent: {
|
|
139
|
+
name: string;
|
|
140
|
+
displayName: string;
|
|
141
|
+
};
|
|
142
|
+
apps: {
|
|
143
|
+
appId: string;
|
|
144
|
+
instanceId?: string | undefined;
|
|
145
|
+
description?: string | undefined;
|
|
146
|
+
icons?: {
|
|
147
|
+
src: string;
|
|
148
|
+
type?: string | undefined;
|
|
149
|
+
size?: string | undefined;
|
|
150
|
+
}[] | undefined;
|
|
151
|
+
instanceMetadata?: Record<string, unknown> | undefined;
|
|
152
|
+
name?: string | undefined;
|
|
153
|
+
resultType?: string | null | undefined;
|
|
154
|
+
screenshots?: {
|
|
155
|
+
src: string;
|
|
156
|
+
type?: string | undefined;
|
|
157
|
+
size?: string | undefined;
|
|
158
|
+
label?: string | undefined;
|
|
159
|
+
}[] | undefined;
|
|
160
|
+
title?: string | undefined;
|
|
161
|
+
tooltip?: string | undefined;
|
|
162
|
+
version?: string | undefined;
|
|
163
|
+
}[];
|
|
164
|
+
}, {
|
|
165
|
+
intent: {
|
|
166
|
+
name: string;
|
|
167
|
+
displayName: string;
|
|
168
|
+
};
|
|
169
|
+
apps: {
|
|
170
|
+
appId: string;
|
|
171
|
+
instanceId?: string | undefined;
|
|
172
|
+
description?: string | undefined;
|
|
173
|
+
icons?: {
|
|
174
|
+
src: string;
|
|
175
|
+
type?: string | undefined;
|
|
176
|
+
size?: string | undefined;
|
|
177
|
+
}[] | undefined;
|
|
178
|
+
instanceMetadata?: Record<string, unknown> | undefined;
|
|
179
|
+
name?: string | undefined;
|
|
180
|
+
resultType?: string | null | undefined;
|
|
181
|
+
screenshots?: {
|
|
182
|
+
src: string;
|
|
183
|
+
type?: string | undefined;
|
|
184
|
+
size?: string | undefined;
|
|
185
|
+
label?: string | undefined;
|
|
186
|
+
}[] | undefined;
|
|
187
|
+
title?: string | undefined;
|
|
188
|
+
tooltip?: string | undefined;
|
|
189
|
+
version?: string | undefined;
|
|
190
|
+
}[];
|
|
191
|
+
}>;
|
|
192
|
+
|
|
193
|
+
export declare class AuthorizationError extends CloudInteropAPIError {
|
|
194
|
+
constructor(message?: string, code?: string);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Represents a base event for the cloud interop api
|
|
199
|
+
* @public
|
|
200
|
+
* @property {Source} source - The source of the event
|
|
201
|
+
* @property {HistoryRecord} history - A trail of timestamps of when the context hit various points in the system
|
|
202
|
+
*/
|
|
203
|
+
export declare type BaseCloudInteropAPIEvent = {
|
|
204
|
+
/**
|
|
205
|
+
* The source of the event
|
|
206
|
+
*/
|
|
207
|
+
source: Source;
|
|
208
|
+
/**
|
|
209
|
+
* A trail of timestamps of when the event hit various points in the system
|
|
210
|
+
* @internal
|
|
211
|
+
*/
|
|
212
|
+
history?: HistoryRecord;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Represents an Intent Discovery Event
|
|
217
|
+
* @public
|
|
218
|
+
*/
|
|
219
|
+
export declare type BaseIntentDiscoveryEvent = BaseIntentEvent & {
|
|
220
|
+
discoveryId: string;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Represents a base intent event
|
|
225
|
+
* @public
|
|
226
|
+
*/
|
|
227
|
+
export declare type BaseIntentEvent = BaseCloudInteropAPIEvent & {
|
|
228
|
+
/**
|
|
229
|
+
* The session id of the interop client that initiated an intent action
|
|
230
|
+
*/
|
|
231
|
+
initiatingSessionId: string;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Represents a single connection to a Cloud Interop service
|
|
236
|
+
*
|
|
237
|
+
* @public
|
|
238
|
+
* @class
|
|
239
|
+
*/
|
|
240
|
+
export declare class CloudInteropAPI {
|
|
241
|
+
#private;
|
|
242
|
+
constructor(cloudInteropSettings: CloudInteropSettings);
|
|
243
|
+
get sessionDetails(): CreateSessionResponse | undefined;
|
|
244
|
+
get mqttClient(): mqtt.MqttClient | undefined;
|
|
245
|
+
/**
|
|
246
|
+
* Connects and creates a session on the Cloud Interop service
|
|
247
|
+
*
|
|
248
|
+
* @param {ConnectParameters} parameters - The parameters to use to connect
|
|
249
|
+
* @returns {*} {Promise<void>}
|
|
250
|
+
* @memberof CloudInteropAPI
|
|
251
|
+
* @throws {CloudInteropAPIError} - If an error occurs during connection
|
|
252
|
+
* @throws {AuthorizationError} - If the connection is unauthorized
|
|
253
|
+
*/
|
|
254
|
+
connect(parameters: ConnectParameters): Promise<void>;
|
|
255
|
+
/**
|
|
256
|
+
* Disconnects from the Cloud Interop service
|
|
257
|
+
*
|
|
258
|
+
* @returns {*} {Promise<void>}
|
|
259
|
+
* @memberof CloudInteropAPI
|
|
260
|
+
* @throws {CloudInteropAPIError} - If an error occurs during disconnection
|
|
261
|
+
*/
|
|
262
|
+
disconnect(): Promise<void>;
|
|
263
|
+
/**
|
|
264
|
+
* Publishes a new context for the given context group to the other connected sessions
|
|
265
|
+
*
|
|
266
|
+
* @param {string} contextGroup - The context group to publish to
|
|
267
|
+
* @param {object} context - The context to publish
|
|
268
|
+
* @returns {*} {Promise<void>}
|
|
269
|
+
* @memberof CloudInteropAPI
|
|
270
|
+
*/
|
|
271
|
+
setContext(contextGroup: string, context: InferredContext): Promise<void>;
|
|
272
|
+
/**
|
|
273
|
+
* Starts an intent discovery operation
|
|
274
|
+
*
|
|
275
|
+
* @returns {*} {Promise<void>}
|
|
276
|
+
* @memberof CloudInteropAPI
|
|
277
|
+
* @throws {CloudInteropAPIError} - If an error occurs during intent discovery
|
|
278
|
+
*/
|
|
279
|
+
startIntentDiscovery(options: StartIntentDiscoveryOptions): Promise<void>;
|
|
280
|
+
raiseIntent(options: RaiseIntentAPIOptions): Promise<void>;
|
|
281
|
+
reportAppIntents(discoveryId: string, intents: AppIntent[]): Promise<boolean>;
|
|
282
|
+
sendIntentResult(initiatingSessionId: string, result: IntentResult): Promise<void>;
|
|
283
|
+
parseSessionId(appId: AppIdentifier | string): string;
|
|
284
|
+
parseAppId(appId: AppIdentifier | string): string;
|
|
285
|
+
addEventListener<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
|
|
286
|
+
removeEventListener<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
|
|
287
|
+
once<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export declare class CloudInteropAPIError extends Error {
|
|
291
|
+
code: string;
|
|
292
|
+
constructor(message?: string, code?: string, cause?: unknown);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Represents a logging function to be used by the cloud interop client
|
|
297
|
+
*/
|
|
298
|
+
export declare type CloudInteropLogger = (level: LogLevel, message: string) => void;
|
|
299
|
+
|
|
300
|
+
export declare type CloudInteropSettings = {
|
|
301
|
+
url: string;
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* @internal
|
|
306
|
+
*/
|
|
307
|
+
export declare type CommandMessage = ReportIntentsCommand | IntentDetailsCommand | RaiseIntentCommand | IntentResultCommand;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Represents the parameters to use to connect to an interop server
|
|
311
|
+
*/
|
|
312
|
+
export declare type ConnectParameters = {
|
|
313
|
+
/**
|
|
314
|
+
* ID for a group of shared applications.
|
|
315
|
+
* This acts as a namespace for the interop messages that allows separation of messages between different groups of applications for the same user
|
|
316
|
+
*/
|
|
317
|
+
platformId: string;
|
|
318
|
+
/**
|
|
319
|
+
* An user-friendly identifier for the source session e.g. Windows Desktop, Android Phone, etc.
|
|
320
|
+
*/
|
|
321
|
+
sourceId: string;
|
|
322
|
+
/**
|
|
323
|
+
* The maximum number of times to retry connecting to the cloud interop service when the connection is dropped
|
|
324
|
+
* defaults to 30
|
|
325
|
+
*/
|
|
326
|
+
reconnectRetryLimit?: number;
|
|
327
|
+
/**
|
|
328
|
+
* Specifies how often keep alive messages should be sent to the cloud interop service in seconds
|
|
329
|
+
* defaults to 30
|
|
330
|
+
*/
|
|
331
|
+
keepAliveIntervalSeconds?: number;
|
|
332
|
+
/**
|
|
333
|
+
* Optional function to call with any logging messages to allow integration with the host application's logging
|
|
334
|
+
*
|
|
335
|
+
* defaults to console.log
|
|
336
|
+
*/
|
|
337
|
+
logger?: CloudInteropLogger;
|
|
338
|
+
/**
|
|
339
|
+
* Determines the type of authentication to use with the service gateway
|
|
340
|
+
* defaults to 'none'
|
|
341
|
+
*
|
|
342
|
+
* 'jwt' - Use JWT authentication, in this case jwtAuthenticationParameters must also be provided
|
|
343
|
+
* 'basic' - Use basic authentication, in this case basicAuthenticationParameters must also be provided
|
|
344
|
+
* 'default' - Authentication will be inherited from the current session
|
|
345
|
+
*/
|
|
346
|
+
authenticationType?: 'jwt' | 'basic' | 'default';
|
|
347
|
+
/**
|
|
348
|
+
* Optional parameters for basic authentication
|
|
349
|
+
*/
|
|
350
|
+
basicAuthenticationParameters?: {
|
|
351
|
+
/**
|
|
352
|
+
* The username to use for basic authentication
|
|
353
|
+
*/
|
|
354
|
+
username: string;
|
|
355
|
+
/**
|
|
356
|
+
* The password to use for basic authentication
|
|
357
|
+
*/
|
|
358
|
+
password: string;
|
|
359
|
+
};
|
|
360
|
+
/**
|
|
361
|
+
* Optional parameters for JWT authentication
|
|
362
|
+
*/
|
|
363
|
+
jwtAuthenticationParameters?: {
|
|
364
|
+
/**
|
|
365
|
+
* When JWT authentication is being used, this will be invoked just whenever a JWT token is required for a request
|
|
366
|
+
*/
|
|
367
|
+
jwtRequestCallback: () => string | object;
|
|
368
|
+
/**
|
|
369
|
+
* The id of the service gateway JWT authentication definition to use
|
|
370
|
+
*
|
|
371
|
+
* Note: Contact Here support to to get your organization's authentication id
|
|
372
|
+
*/
|
|
373
|
+
authenticationId: string;
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Represents a context received from another cloud interop publisher
|
|
379
|
+
* @public
|
|
380
|
+
* @property {string} contextGroup - The context group
|
|
381
|
+
* @property {object} context - The context
|
|
382
|
+
*/
|
|
383
|
+
export declare type ContextEvent = BaseCloudInteropAPIEvent & {
|
|
384
|
+
/**
|
|
385
|
+
* The context group
|
|
386
|
+
*/
|
|
387
|
+
contextGroup: string;
|
|
388
|
+
/**
|
|
389
|
+
* The context object
|
|
390
|
+
*/
|
|
391
|
+
context?: InferredContext;
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Schema for context object
|
|
396
|
+
* @public
|
|
397
|
+
*/
|
|
398
|
+
declare const contextSchema: z.ZodIntersection<z.ZodObject<{
|
|
399
|
+
type: z.ZodString;
|
|
400
|
+
name: z.ZodOptional<z.ZodString>;
|
|
401
|
+
id: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
402
|
+
}, "strip", z.ZodTypeAny, {
|
|
403
|
+
type: string;
|
|
404
|
+
name?: string | undefined;
|
|
405
|
+
id?: Record<string, any> | undefined;
|
|
406
|
+
}, {
|
|
407
|
+
type: string;
|
|
408
|
+
name?: string | undefined;
|
|
409
|
+
id?: Record<string, any> | undefined;
|
|
410
|
+
}>, z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
411
|
+
|
|
412
|
+
export declare type CreateSessionResponse = {
|
|
413
|
+
sessionId: string;
|
|
414
|
+
sessionRootTopic: string;
|
|
415
|
+
url: string;
|
|
416
|
+
token: string;
|
|
417
|
+
orgId: string;
|
|
418
|
+
sub: string;
|
|
419
|
+
platformId: string;
|
|
420
|
+
sourceId: string;
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
declare const errorSchema: z.ZodObject<{
|
|
424
|
+
error: z.ZodString;
|
|
425
|
+
}, "strip", z.ZodTypeAny, {
|
|
426
|
+
error: string;
|
|
427
|
+
}, {
|
|
428
|
+
error: string;
|
|
429
|
+
}>;
|
|
430
|
+
|
|
431
|
+
export declare type EventListenersMap = Map<keyof EventMap, Array<(...args: Parameters<EventMap[keyof EventMap]>) => void>>;
|
|
432
|
+
|
|
433
|
+
export declare type EventMap = {
|
|
434
|
+
reconnected: () => void;
|
|
435
|
+
disconnected: () => void;
|
|
436
|
+
context: (event: ContextEvent) => void;
|
|
437
|
+
reconnecting: (attemptNo: number) => void;
|
|
438
|
+
error: (error: Error) => void;
|
|
439
|
+
'session-expired': () => void;
|
|
440
|
+
'report-intents': (event: ReportIntentsEvent) => void;
|
|
441
|
+
'intent-details': (event: IntentDetailsEvent) => void;
|
|
442
|
+
'aggregate-intent-details': (event: AggregateIntentDetailsEvent) => void;
|
|
443
|
+
'raise-intent': (event: RaiseIntentEvent) => void;
|
|
444
|
+
'intent-result': (event: IntentResultEvent) => void;
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Options for finding intents by intent name or context
|
|
449
|
+
* @public
|
|
450
|
+
*/
|
|
451
|
+
export declare type FindIntentOptions = z.infer<typeof findIntentOptionsSchema>;
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Schema for findOptions for the StartDiscovery operation
|
|
455
|
+
* @public
|
|
456
|
+
*/
|
|
457
|
+
declare const findIntentOptionsSchema: z.ZodUnion<[z.ZodObject<{
|
|
458
|
+
type: z.ZodLiteral<"find-intent">;
|
|
459
|
+
intent: z.ZodString;
|
|
460
|
+
context: z.ZodOptional<z.ZodIntersection<z.ZodObject<{
|
|
461
|
+
type: z.ZodString;
|
|
462
|
+
name: z.ZodOptional<z.ZodString>;
|
|
463
|
+
id: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
464
|
+
}, "strip", z.ZodTypeAny, {
|
|
465
|
+
type: string;
|
|
466
|
+
name?: string | undefined;
|
|
467
|
+
id?: Record<string, any> | undefined;
|
|
468
|
+
}, {
|
|
469
|
+
type: string;
|
|
470
|
+
name?: string | undefined;
|
|
471
|
+
id?: Record<string, any> | undefined;
|
|
472
|
+
}>, z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
473
|
+
resultType: z.ZodOptional<z.ZodString>;
|
|
474
|
+
}, "strip", z.ZodTypeAny, {
|
|
475
|
+
type: "find-intent";
|
|
476
|
+
intent: string;
|
|
477
|
+
resultType?: string | undefined;
|
|
478
|
+
context?: ({
|
|
479
|
+
type: string;
|
|
480
|
+
name?: string | undefined;
|
|
481
|
+
id?: Record<string, any> | undefined;
|
|
482
|
+
} & Record<string, any>) | undefined;
|
|
483
|
+
}, {
|
|
484
|
+
type: "find-intent";
|
|
485
|
+
intent: string;
|
|
486
|
+
resultType?: string | undefined;
|
|
487
|
+
context?: ({
|
|
488
|
+
type: string;
|
|
489
|
+
name?: string | undefined;
|
|
490
|
+
id?: Record<string, any> | undefined;
|
|
491
|
+
} & Record<string, any>) | undefined;
|
|
492
|
+
}>, z.ZodObject<{
|
|
493
|
+
type: z.ZodLiteral<"find-intents-by-context">;
|
|
494
|
+
context: z.ZodIntersection<z.ZodObject<{
|
|
495
|
+
type: z.ZodString;
|
|
496
|
+
name: z.ZodOptional<z.ZodString>;
|
|
497
|
+
id: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
498
|
+
}, "strip", z.ZodTypeAny, {
|
|
499
|
+
type: string;
|
|
500
|
+
name?: string | undefined;
|
|
501
|
+
id?: Record<string, any> | undefined;
|
|
502
|
+
}, {
|
|
503
|
+
type: string;
|
|
504
|
+
name?: string | undefined;
|
|
505
|
+
id?: Record<string, any> | undefined;
|
|
506
|
+
}>, z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
507
|
+
resultType: z.ZodOptional<z.ZodString>;
|
|
508
|
+
}, "strip", z.ZodTypeAny, {
|
|
509
|
+
type: "find-intents-by-context";
|
|
510
|
+
context: {
|
|
511
|
+
type: string;
|
|
512
|
+
name?: string | undefined;
|
|
513
|
+
id?: Record<string, any> | undefined;
|
|
514
|
+
} & Record<string, any>;
|
|
515
|
+
resultType?: string | undefined;
|
|
516
|
+
}, {
|
|
517
|
+
type: "find-intents-by-context";
|
|
518
|
+
context: {
|
|
519
|
+
type: string;
|
|
520
|
+
name?: string | undefined;
|
|
521
|
+
id?: Record<string, any> | undefined;
|
|
522
|
+
} & Record<string, any>;
|
|
523
|
+
resultType?: string | undefined;
|
|
524
|
+
}>]>;
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* A trace record for performance monitoring
|
|
528
|
+
* @internal
|
|
529
|
+
*/
|
|
530
|
+
declare type HistoryRecord = {
|
|
531
|
+
/**
|
|
532
|
+
* The time the context was sent by the client to the service
|
|
533
|
+
* Note: This is reliant on the time being accurate on the client
|
|
534
|
+
*/
|
|
535
|
+
client?: number;
|
|
536
|
+
/**
|
|
537
|
+
* The time the context was received by the service
|
|
538
|
+
*/
|
|
539
|
+
received?: number;
|
|
540
|
+
/**
|
|
541
|
+
* The time the context was received and forward to the messaging backbone
|
|
542
|
+
*/
|
|
543
|
+
forwarded?: number;
|
|
544
|
+
/**
|
|
545
|
+
* The time the context was received by client api
|
|
546
|
+
*/
|
|
547
|
+
clientReceived?: number;
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Represents a context object
|
|
552
|
+
* @public
|
|
553
|
+
*/
|
|
554
|
+
export declare type InferredContext = z.infer<typeof contextSchema>;
|
|
555
|
+
|
|
556
|
+
export declare type InferredError = z.infer<typeof errorSchema>;
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* @internal
|
|
560
|
+
*/
|
|
561
|
+
export declare type IntentDetailsCommand = IntentDetailsEvent & {
|
|
562
|
+
command: 'intent-details';
|
|
563
|
+
};
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* Raised when an interop client receives intents from other connected sessions
|
|
567
|
+
* @public
|
|
568
|
+
*/
|
|
569
|
+
export declare type IntentDetailsEvent = BaseIntentDiscoveryEvent & {
|
|
570
|
+
intents: AppIntent[];
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Represents an intent resolution
|
|
575
|
+
* @public
|
|
576
|
+
*/
|
|
577
|
+
export declare type IntentResolution = z.infer<typeof intentResolutionSchema>;
|
|
578
|
+
|
|
579
|
+
declare const intentResolutionSchema: z.ZodObject<{
|
|
580
|
+
source: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
581
|
+
appId: z.ZodString;
|
|
582
|
+
instanceId: z.ZodOptional<z.ZodString>;
|
|
583
|
+
}, "strip", z.ZodTypeAny, {
|
|
584
|
+
appId: string;
|
|
585
|
+
instanceId?: string | undefined;
|
|
586
|
+
}, {
|
|
587
|
+
appId: string;
|
|
588
|
+
instanceId?: string | undefined;
|
|
589
|
+
}>]>;
|
|
590
|
+
version: z.ZodOptional<z.ZodString>;
|
|
591
|
+
intent: z.ZodString;
|
|
592
|
+
getResult: z.ZodOptional<z.ZodUnion<[z.ZodIntersection<z.ZodObject<{
|
|
593
|
+
type: z.ZodString;
|
|
594
|
+
name: z.ZodOptional<z.ZodString>;
|
|
595
|
+
id: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
596
|
+
}, "strip", z.ZodTypeAny, {
|
|
597
|
+
type: string;
|
|
598
|
+
name?: string | undefined;
|
|
599
|
+
id?: Record<string, any> | undefined;
|
|
600
|
+
}, {
|
|
601
|
+
type: string;
|
|
602
|
+
name?: string | undefined;
|
|
603
|
+
id?: Record<string, any> | undefined;
|
|
604
|
+
}>, z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodUndefined]>>;
|
|
605
|
+
}, "strip", z.ZodTypeAny, {
|
|
606
|
+
source: string | {
|
|
607
|
+
appId: string;
|
|
608
|
+
instanceId?: string | undefined;
|
|
609
|
+
};
|
|
610
|
+
intent: string;
|
|
611
|
+
version?: string | undefined;
|
|
612
|
+
getResult?: ({
|
|
613
|
+
type: string;
|
|
614
|
+
name?: string | undefined;
|
|
615
|
+
id?: Record<string, any> | undefined;
|
|
616
|
+
} & Record<string, any>) | undefined;
|
|
617
|
+
}, {
|
|
618
|
+
source: string | {
|
|
619
|
+
appId: string;
|
|
620
|
+
instanceId?: string | undefined;
|
|
621
|
+
};
|
|
622
|
+
intent: string;
|
|
623
|
+
version?: string | undefined;
|
|
624
|
+
getResult?: ({
|
|
625
|
+
type: string;
|
|
626
|
+
name?: string | undefined;
|
|
627
|
+
id?: Record<string, any> | undefined;
|
|
628
|
+
} & Record<string, any>) | undefined;
|
|
629
|
+
}>;
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Represents an intent result
|
|
633
|
+
* @public
|
|
634
|
+
*/
|
|
635
|
+
export declare type IntentResult = z.infer<typeof intentResultSchema>;
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* @internal
|
|
639
|
+
*/
|
|
640
|
+
export declare type IntentResultCommand = IntentResultEvent & {
|
|
641
|
+
command: 'intent-result';
|
|
642
|
+
};
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* Raised when an interop client receives an intent result after raising an intent on a target session
|
|
646
|
+
* @public
|
|
647
|
+
*/
|
|
648
|
+
export declare type IntentResultEvent = BaseIntentEvent & {
|
|
649
|
+
result: IntentResult;
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* Schema for the result of an intent
|
|
654
|
+
* @public
|
|
655
|
+
*/
|
|
656
|
+
declare const intentResultSchema: z.ZodUnion<[z.ZodObject<{
|
|
657
|
+
error: z.ZodString;
|
|
658
|
+
}, "strip", z.ZodTypeAny, {
|
|
659
|
+
error: string;
|
|
660
|
+
}, {
|
|
661
|
+
error: string;
|
|
662
|
+
}>, z.ZodObject<{
|
|
663
|
+
source: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
664
|
+
appId: z.ZodString;
|
|
665
|
+
instanceId: z.ZodOptional<z.ZodString>;
|
|
666
|
+
}, "strip", z.ZodTypeAny, {
|
|
667
|
+
appId: string;
|
|
668
|
+
instanceId?: string | undefined;
|
|
669
|
+
}, {
|
|
670
|
+
appId: string;
|
|
671
|
+
instanceId?: string | undefined;
|
|
672
|
+
}>]>;
|
|
673
|
+
version: z.ZodOptional<z.ZodString>;
|
|
674
|
+
intent: z.ZodString;
|
|
675
|
+
getResult: z.ZodOptional<z.ZodUnion<[z.ZodIntersection<z.ZodObject<{
|
|
676
|
+
type: z.ZodString;
|
|
677
|
+
name: z.ZodOptional<z.ZodString>;
|
|
678
|
+
id: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
679
|
+
}, "strip", z.ZodTypeAny, {
|
|
680
|
+
type: string;
|
|
681
|
+
name?: string | undefined;
|
|
682
|
+
id?: Record<string, any> | undefined;
|
|
683
|
+
}, {
|
|
684
|
+
type: string;
|
|
685
|
+
name?: string | undefined;
|
|
686
|
+
id?: Record<string, any> | undefined;
|
|
687
|
+
}>, z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodUndefined]>>;
|
|
688
|
+
}, "strip", z.ZodTypeAny, {
|
|
689
|
+
source: string | {
|
|
690
|
+
appId: string;
|
|
691
|
+
instanceId?: string | undefined;
|
|
692
|
+
};
|
|
693
|
+
intent: string;
|
|
694
|
+
version?: string | undefined;
|
|
695
|
+
getResult?: ({
|
|
696
|
+
type: string;
|
|
697
|
+
name?: string | undefined;
|
|
698
|
+
id?: Record<string, any> | undefined;
|
|
699
|
+
} & Record<string, any>) | undefined;
|
|
700
|
+
}, {
|
|
701
|
+
source: string | {
|
|
702
|
+
appId: string;
|
|
703
|
+
instanceId?: string | undefined;
|
|
704
|
+
};
|
|
705
|
+
intent: string;
|
|
706
|
+
version?: string | undefined;
|
|
707
|
+
getResult?: ({
|
|
708
|
+
type: string;
|
|
709
|
+
name?: string | undefined;
|
|
710
|
+
id?: Record<string, any> | undefined;
|
|
711
|
+
} & Record<string, any>) | undefined;
|
|
712
|
+
}>]>;
|
|
713
|
+
|
|
714
|
+
export declare type LogLevel = 'log' | 'debug' | 'info' | 'warn' | 'error';
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Options used to raise an Intent
|
|
718
|
+
* @public
|
|
719
|
+
*/
|
|
720
|
+
export declare type RaiseIntentAPIOptions = {
|
|
721
|
+
raiseOptions: RaiseIntentOptions;
|
|
722
|
+
appId: AppIdentifier | string;
|
|
723
|
+
};
|
|
724
|
+
|
|
725
|
+
/**
|
|
726
|
+
* @internal
|
|
727
|
+
*/
|
|
728
|
+
export declare type RaiseIntentCommand = RaiseIntentEvent & {
|
|
729
|
+
command: 'raise-intent';
|
|
730
|
+
};
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Raised when an interop client invokes an intent
|
|
734
|
+
* @public
|
|
735
|
+
*/
|
|
736
|
+
export declare type RaiseIntentEvent = BaseIntentEvent & {
|
|
737
|
+
targetSessionId: string;
|
|
738
|
+
raiseOptions: RaiseIntentOptions;
|
|
739
|
+
};
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Options for raising an intent by intent name or context
|
|
743
|
+
* @public
|
|
744
|
+
*/
|
|
745
|
+
export declare type RaiseIntentOptions = z.infer<typeof raiseIntentOptionsSchema>;
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Schema for raiseOptions for the RaiseIntent operation
|
|
749
|
+
* @public
|
|
750
|
+
*/
|
|
751
|
+
declare const raiseIntentOptionsSchema: z.ZodUnion<[z.ZodObject<{
|
|
752
|
+
type: z.ZodLiteral<"raise-intent">;
|
|
753
|
+
intent: z.ZodString;
|
|
754
|
+
context: z.ZodIntersection<z.ZodObject<{
|
|
755
|
+
type: z.ZodString;
|
|
756
|
+
name: z.ZodOptional<z.ZodString>;
|
|
757
|
+
id: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
758
|
+
}, "strip", z.ZodTypeAny, {
|
|
759
|
+
type: string;
|
|
760
|
+
name?: string | undefined;
|
|
761
|
+
id?: Record<string, any> | undefined;
|
|
762
|
+
}, {
|
|
763
|
+
type: string;
|
|
764
|
+
name?: string | undefined;
|
|
765
|
+
id?: Record<string, any> | undefined;
|
|
766
|
+
}>, z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
767
|
+
}, "strip", z.ZodTypeAny, {
|
|
768
|
+
type: "raise-intent";
|
|
769
|
+
intent: string;
|
|
770
|
+
context: {
|
|
771
|
+
type: string;
|
|
772
|
+
name?: string | undefined;
|
|
773
|
+
id?: Record<string, any> | undefined;
|
|
774
|
+
} & Record<string, any>;
|
|
775
|
+
}, {
|
|
776
|
+
type: "raise-intent";
|
|
777
|
+
intent: string;
|
|
778
|
+
context: {
|
|
779
|
+
type: string;
|
|
780
|
+
name?: string | undefined;
|
|
781
|
+
id?: Record<string, any> | undefined;
|
|
782
|
+
} & Record<string, any>;
|
|
783
|
+
}>, z.ZodObject<{
|
|
784
|
+
type: z.ZodLiteral<"raise-intent-for-context">;
|
|
785
|
+
context: z.ZodIntersection<z.ZodObject<{
|
|
786
|
+
type: z.ZodString;
|
|
787
|
+
name: z.ZodOptional<z.ZodString>;
|
|
788
|
+
id: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
789
|
+
}, "strip", z.ZodTypeAny, {
|
|
790
|
+
type: string;
|
|
791
|
+
name?: string | undefined;
|
|
792
|
+
id?: Record<string, any> | undefined;
|
|
793
|
+
}, {
|
|
794
|
+
type: string;
|
|
795
|
+
name?: string | undefined;
|
|
796
|
+
id?: Record<string, any> | undefined;
|
|
797
|
+
}>, z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
798
|
+
}, "strip", z.ZodTypeAny, {
|
|
799
|
+
type: "raise-intent-for-context";
|
|
800
|
+
context: {
|
|
801
|
+
type: string;
|
|
802
|
+
name?: string | undefined;
|
|
803
|
+
id?: Record<string, any> | undefined;
|
|
804
|
+
} & Record<string, any>;
|
|
805
|
+
}, {
|
|
806
|
+
type: "raise-intent-for-context";
|
|
807
|
+
context: {
|
|
808
|
+
type: string;
|
|
809
|
+
name?: string | undefined;
|
|
810
|
+
id?: Record<string, any> | undefined;
|
|
811
|
+
} & Record<string, any>;
|
|
812
|
+
}>]>;
|
|
813
|
+
|
|
814
|
+
/**
|
|
815
|
+
* @internal
|
|
816
|
+
*/
|
|
817
|
+
export declare type ReportIntentsCommand = ReportIntentsEvent & {
|
|
818
|
+
command: 'report-intents';
|
|
819
|
+
};
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* Raised when an interop client requests intents from other connected sessions.
|
|
823
|
+
* @public
|
|
824
|
+
*/
|
|
825
|
+
export declare type ReportIntentsEvent = BaseIntentDiscoveryEvent & {
|
|
826
|
+
/**
|
|
827
|
+
* Options qualifying how the session should respond to the request
|
|
828
|
+
* - intent: when provided, filter the response to only include intents that match the specified intent name
|
|
829
|
+
* - context: when provided, filter the response to only include intents that match the specified context
|
|
830
|
+
* - resultType: when provided, filter the response to only include apps that match the specified result type
|
|
831
|
+
*/
|
|
832
|
+
findOptions: FindIntentOptions;
|
|
833
|
+
/**
|
|
834
|
+
* The number of connected sessions including the current session
|
|
835
|
+
*/
|
|
836
|
+
sessionCount: number;
|
|
837
|
+
};
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Represents a source session
|
|
841
|
+
* @public
|
|
842
|
+
*/
|
|
843
|
+
export declare type Source = {
|
|
844
|
+
/**
|
|
845
|
+
* Source session id
|
|
846
|
+
*/
|
|
847
|
+
sessionId: string;
|
|
848
|
+
/**
|
|
849
|
+
* Source environment id
|
|
850
|
+
*/
|
|
851
|
+
sourceId: string;
|
|
852
|
+
/**
|
|
853
|
+
* Source user id
|
|
854
|
+
*/
|
|
855
|
+
userId: string;
|
|
856
|
+
/**
|
|
857
|
+
* Source org id
|
|
858
|
+
*/
|
|
859
|
+
orgId: string;
|
|
860
|
+
/**
|
|
861
|
+
* Source platform id
|
|
862
|
+
*/
|
|
863
|
+
platformId: string;
|
|
864
|
+
};
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* Options used to start an Intent Discovery Operation, with possible constraints for the responses
|
|
868
|
+
* @public
|
|
869
|
+
*/
|
|
870
|
+
export declare type StartIntentDiscoveryOptions = {
|
|
871
|
+
findOptions: FindIntentOptions;
|
|
872
|
+
/**
|
|
873
|
+
* The timeout in ms.
|
|
874
|
+
*
|
|
875
|
+
* Discovery will wait for all connected sessions to respond or until the timeout is reached.
|
|
876
|
+
*
|
|
877
|
+
* Defaults to 3000ms if not provided, minimum value 500ms
|
|
878
|
+
*/
|
|
879
|
+
timeout?: number;
|
|
880
|
+
};
|
|
881
|
+
|
|
882
|
+
export { }
|