@openfin/cloud-interop-core-api 0.0.1-alpha.6b2fbd5 → 0.0.1-alpha.6d7b62b

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