@openfin/cloud-interop-core-api 0.0.1-alpha.fffeb9a → 0.0.1

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 ADDED
@@ -0,0 +1,924 @@
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 parameters - The parameters to use to connect
249
+ * @returns Promise that resolves when connection is established
250
+ * @memberof CloudInteropAPI
251
+ * @throws CloudInteropAPIError - If an error occurs during connection
252
+ * @throws AuthorizationError - If the connection is unauthorized
253
+ * @throws OAuthAuthenticationError - If OAuth parameters are invalid, the client credentials are rejected, or an access token cannot be obtained
254
+ */
255
+ connect(parameters: ConnectParameters): Promise<void>;
256
+ /**
257
+ * Disconnects from the Cloud Interop service
258
+ *
259
+ * @returns Promise that resolves when disconnected
260
+ * @memberof CloudInteropAPI
261
+ * @throws CloudInteropAPIError - If an error occurs during disconnection
262
+ */
263
+ disconnect(): Promise<void>;
264
+ /**
265
+ * Publishes a new context for the given context group to the other connected sessions
266
+ *
267
+ * @param contextGroup - The context group to publish to
268
+ * @param context - The context to publish
269
+ * @returns Promise that resolves when context is published
270
+ * @memberof CloudInteropAPI
271
+ */
272
+ setContext(contextGroup: string, context: InferredContext): Promise<void>;
273
+ /**
274
+ * Starts an intent discovery operation
275
+ *
276
+ * @returns Promise that resolves when intent discovery is started
277
+ * @memberof CloudInteropAPI
278
+ * @throws CloudInteropAPIError - If an error occurs during intent discovery
279
+ */
280
+ startIntentDiscovery(options: StartIntentDiscoveryOptions): Promise<void>;
281
+ raiseIntent(options: RaiseIntentAPIOptions): Promise<void>;
282
+ reportAppIntents(discoveryId: string, intents: AppIntent[]): Promise<boolean>;
283
+ sendIntentResult(initiatingSessionId: string, result: IntentResult): Promise<void>;
284
+ parseSessionId(appId: AppIdentifier | string): string;
285
+ parseAppId(appId: AppIdentifier | string): string;
286
+ addEventListener<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
287
+ removeEventListener<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
288
+ once<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
289
+ }
290
+
291
+ export declare class CloudInteropAPIError extends Error {
292
+ code: string;
293
+ constructor(message?: string, code?: string, cause?: unknown);
294
+ }
295
+
296
+ /**
297
+ * Represents a logging function to be used by the cloud interop client
298
+ */
299
+ export declare type CloudInteropLogger = (level: LogLevel, message: string) => void;
300
+
301
+ export declare type CloudInteropSettings = {
302
+ url: string;
303
+ };
304
+
305
+ /**
306
+ * @internal
307
+ */
308
+ export declare type CommandMessage = ReportIntentsCommand | IntentDetailsCommand | RaiseIntentCommand | IntentResultCommand;
309
+
310
+ /**
311
+ * Represents the parameters to use to connect to an interop server
312
+ */
313
+ export declare type ConnectParameters = {
314
+ /**
315
+ * ID for a group of shared applications.
316
+ * This acts as a namespace for the interop messages that allows separation of messages between different groups of applications for the same user
317
+ */
318
+ platformId: string;
319
+ /**
320
+ * An user-friendly identifier for the source session e.g. Windows Desktop, Android Phone, etc.
321
+ */
322
+ sourceId: string;
323
+ /**
324
+ * The maximum number of times to retry connecting to the cloud interop service when the connection is dropped
325
+ * defaults to 30
326
+ */
327
+ reconnectRetryLimit?: number;
328
+ /**
329
+ * Specifies how often keep alive messages should be sent to the cloud interop service in seconds
330
+ * defaults to 30
331
+ */
332
+ keepAliveIntervalSeconds?: number;
333
+ /**
334
+ * Optional function to call with any logging messages to allow integration with the host application's logging
335
+ *
336
+ * defaults to console.log
337
+ */
338
+ logger?: CloudInteropLogger;
339
+ /**
340
+ * Determines the type of authentication to use with the service gateway
341
+ * defaults to 'none'
342
+ *
343
+ * 'jwt' - Use JWT authentication, in this case jwtAuthenticationParameters must also be provided
344
+ * 'basic' - Use basic authentication, in this case basicAuthenticationParameters must also be provided
345
+ * 'oauth' - Use OAuth client credentials, in this case oauthAuthenticationParameters must also be provided
346
+ * 'default' - Authentication will be inherited from the current session
347
+ */
348
+ authenticationType?: 'jwt' | 'basic' | 'oauth' | 'default';
349
+ /**
350
+ * Optional parameters for basic authentication
351
+ */
352
+ basicAuthenticationParameters?: {
353
+ /**
354
+ * The username to use for basic authentication
355
+ */
356
+ username: string;
357
+ /**
358
+ * The password to use for basic authentication
359
+ */
360
+ password: string;
361
+ };
362
+ /**
363
+ * Optional parameters for JWT authentication
364
+ */
365
+ jwtAuthenticationParameters?: {
366
+ /**
367
+ * When JWT authentication is being used, this will be invoked just whenever a JWT token is required for a request
368
+ */
369
+ jwtRequestCallback: () => string | object | Promise<string | object>;
370
+ /**
371
+ * The id of the service gateway JWT authentication definition to use
372
+ *
373
+ * Note: Contact Here support to to get your organization's authentication id
374
+ */
375
+ authenticationId: string;
376
+ };
377
+ /**
378
+ * Optional parameters for OAuth client-credentials authentication.
379
+ * Server-side only. A client secret is rejected in the browser.
380
+ */
381
+ oauthAuthenticationParameters?: OAuthAuthenticationParameters;
382
+ };
383
+
384
+ /**
385
+ * Represents a context received from another cloud interop publisher
386
+ * @public
387
+ * @property {string} contextGroup - The context group
388
+ * @property {object} context - The context
389
+ */
390
+ export declare type ContextEvent = BaseCloudInteropAPIEvent & {
391
+ /**
392
+ * The context group
393
+ */
394
+ contextGroup: string;
395
+ /**
396
+ * The context object
397
+ */
398
+ context?: InferredContext;
399
+ };
400
+
401
+ /**
402
+ * Schema for context object
403
+ * @public
404
+ */
405
+ declare const contextSchema: z.ZodIntersection<z.ZodObject<{
406
+ type: z.ZodString;
407
+ name: z.ZodOptional<z.ZodString>;
408
+ id: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
409
+ }, "strip", z.ZodTypeAny, {
410
+ type: string;
411
+ name?: string | undefined;
412
+ id?: Record<string, any> | undefined;
413
+ }, {
414
+ type: string;
415
+ name?: string | undefined;
416
+ id?: Record<string, any> | undefined;
417
+ }>, z.ZodRecord<z.ZodString, z.ZodAny>>;
418
+
419
+ export declare type CreateSessionResponse = {
420
+ sessionId: string;
421
+ sessionRootTopic: string;
422
+ url: string;
423
+ token: string;
424
+ orgId: string;
425
+ sub: string;
426
+ platformId: string;
427
+ sourceId: string;
428
+ localSessionExpiryHandling?: boolean;
429
+ };
430
+
431
+ declare const errorSchema: z.ZodObject<{
432
+ error: z.ZodString;
433
+ }, "strip", z.ZodTypeAny, {
434
+ error: string;
435
+ }, {
436
+ error: string;
437
+ }>;
438
+
439
+ export declare type EventListenersMap = Map<keyof EventMap, Array<(...args: Parameters<EventMap[keyof EventMap]>) => void>>;
440
+
441
+ export declare type EventMap = {
442
+ reconnected: () => void;
443
+ disconnected: () => void;
444
+ context: (event: ContextEvent) => void;
445
+ reconnecting: (attemptNo: number) => void;
446
+ error: (error: Error) => void;
447
+ 'session-expired': () => void;
448
+ 'report-intents': (event: ReportIntentsEvent) => void;
449
+ 'intent-details': (event: IntentDetailsEvent) => void;
450
+ 'aggregate-intent-details': (event: AggregateIntentDetailsEvent) => void;
451
+ 'raise-intent': (event: RaiseIntentEvent) => void;
452
+ 'intent-result': (event: IntentResultEvent) => void;
453
+ };
454
+
455
+ /**
456
+ * Options for finding intents by intent name or context
457
+ * @public
458
+ */
459
+ export declare type FindIntentOptions = z.infer<typeof findIntentOptionsSchema>;
460
+
461
+ /**
462
+ * Schema for findOptions for the StartDiscovery operation
463
+ * @public
464
+ */
465
+ declare const findIntentOptionsSchema: z.ZodUnion<[z.ZodObject<{
466
+ type: z.ZodLiteral<"find-intent">;
467
+ intent: z.ZodString;
468
+ context: z.ZodOptional<z.ZodIntersection<z.ZodObject<{
469
+ type: z.ZodString;
470
+ name: z.ZodOptional<z.ZodString>;
471
+ id: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
472
+ }, "strip", z.ZodTypeAny, {
473
+ type: string;
474
+ name?: string | undefined;
475
+ id?: Record<string, any> | undefined;
476
+ }, {
477
+ type: string;
478
+ name?: string | undefined;
479
+ id?: Record<string, any> | undefined;
480
+ }>, z.ZodRecord<z.ZodString, z.ZodAny>>>;
481
+ resultType: z.ZodOptional<z.ZodString>;
482
+ }, "strip", z.ZodTypeAny, {
483
+ type: "find-intent";
484
+ intent: string;
485
+ resultType?: string | undefined;
486
+ context?: ({
487
+ type: string;
488
+ name?: string | undefined;
489
+ id?: Record<string, any> | undefined;
490
+ } & Record<string, any>) | undefined;
491
+ }, {
492
+ type: "find-intent";
493
+ intent: string;
494
+ resultType?: string | undefined;
495
+ context?: ({
496
+ type: string;
497
+ name?: string | undefined;
498
+ id?: Record<string, any> | undefined;
499
+ } & Record<string, any>) | undefined;
500
+ }>, z.ZodObject<{
501
+ type: z.ZodLiteral<"find-intents-by-context">;
502
+ context: z.ZodIntersection<z.ZodObject<{
503
+ type: z.ZodString;
504
+ name: z.ZodOptional<z.ZodString>;
505
+ id: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
506
+ }, "strip", z.ZodTypeAny, {
507
+ type: string;
508
+ name?: string | undefined;
509
+ id?: Record<string, any> | undefined;
510
+ }, {
511
+ type: string;
512
+ name?: string | undefined;
513
+ id?: Record<string, any> | undefined;
514
+ }>, z.ZodRecord<z.ZodString, z.ZodAny>>;
515
+ resultType: z.ZodOptional<z.ZodString>;
516
+ }, "strip", z.ZodTypeAny, {
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
+ type: "find-intents-by-context";
526
+ context: {
527
+ type: string;
528
+ name?: string | undefined;
529
+ id?: Record<string, any> | undefined;
530
+ } & Record<string, any>;
531
+ resultType?: string | undefined;
532
+ }>]>;
533
+
534
+ /**
535
+ * A trace record for performance monitoring
536
+ * @internal
537
+ */
538
+ declare type HistoryRecord = {
539
+ /**
540
+ * The time the context was sent by the client to the service
541
+ * Note: This is reliant on the time being accurate on the client
542
+ */
543
+ client?: number;
544
+ /**
545
+ * The time the context was received by the service
546
+ */
547
+ received?: number;
548
+ /**
549
+ * The time the context was received and forward to the messaging backbone
550
+ */
551
+ forwarded?: number;
552
+ /**
553
+ * The time the context was received by client api
554
+ */
555
+ clientReceived?: number;
556
+ };
557
+
558
+ /**
559
+ * Represents a context object
560
+ * @public
561
+ */
562
+ export declare type InferredContext = z.infer<typeof contextSchema>;
563
+
564
+ export declare type InferredError = z.infer<typeof errorSchema>;
565
+
566
+ /**
567
+ * @internal
568
+ */
569
+ export declare type IntentDetailsCommand = IntentDetailsEvent & {
570
+ command: 'intent-details';
571
+ };
572
+
573
+ /**
574
+ * Raised when an interop client receives intents from other connected sessions
575
+ * @public
576
+ */
577
+ export declare type IntentDetailsEvent = BaseIntentDiscoveryEvent & {
578
+ intents: AppIntent[];
579
+ };
580
+
581
+ /**
582
+ * Represents an intent resolution
583
+ * @public
584
+ */
585
+ export declare type IntentResolution = z.infer<typeof intentResolutionSchema>;
586
+
587
+ declare const intentResolutionSchema: z.ZodObject<{
588
+ source: z.ZodUnion<[z.ZodString, z.ZodObject<{
589
+ appId: z.ZodString;
590
+ instanceId: z.ZodOptional<z.ZodString>;
591
+ }, "strip", z.ZodTypeAny, {
592
+ appId: string;
593
+ instanceId?: string | undefined;
594
+ }, {
595
+ appId: string;
596
+ instanceId?: string | undefined;
597
+ }>]>;
598
+ version: z.ZodOptional<z.ZodString>;
599
+ intent: z.ZodString;
600
+ getResult: z.ZodOptional<z.ZodUnion<[z.ZodIntersection<z.ZodObject<{
601
+ type: z.ZodString;
602
+ name: z.ZodOptional<z.ZodString>;
603
+ id: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
604
+ }, "strip", z.ZodTypeAny, {
605
+ type: string;
606
+ name?: string | undefined;
607
+ id?: Record<string, any> | undefined;
608
+ }, {
609
+ type: string;
610
+ name?: string | undefined;
611
+ id?: Record<string, any> | undefined;
612
+ }>, z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodUndefined]>>;
613
+ }, "strip", z.ZodTypeAny, {
614
+ source: string | {
615
+ appId: string;
616
+ instanceId?: string | undefined;
617
+ };
618
+ intent: string;
619
+ version?: string | undefined;
620
+ getResult?: ({
621
+ type: string;
622
+ name?: string | undefined;
623
+ id?: Record<string, any> | undefined;
624
+ } & Record<string, any>) | undefined;
625
+ }, {
626
+ source: string | {
627
+ appId: string;
628
+ instanceId?: string | undefined;
629
+ };
630
+ intent: string;
631
+ version?: string | undefined;
632
+ getResult?: ({
633
+ type: string;
634
+ name?: string | undefined;
635
+ id?: Record<string, any> | undefined;
636
+ } & Record<string, any>) | undefined;
637
+ }>;
638
+
639
+ /**
640
+ * Represents an intent result
641
+ * @public
642
+ */
643
+ export declare type IntentResult = z.infer<typeof intentResultSchema>;
644
+
645
+ /**
646
+ * @internal
647
+ */
648
+ export declare type IntentResultCommand = IntentResultEvent & {
649
+ command: 'intent-result';
650
+ };
651
+
652
+ /**
653
+ * Raised when an interop client receives an intent result after raising an intent on a target session
654
+ * @public
655
+ */
656
+ export declare type IntentResultEvent = BaseIntentEvent & {
657
+ result: IntentResult;
658
+ };
659
+
660
+ /**
661
+ * Schema for the result of an intent
662
+ * @public
663
+ */
664
+ declare const intentResultSchema: z.ZodUnion<[z.ZodObject<{
665
+ error: z.ZodString;
666
+ }, "strip", z.ZodTypeAny, {
667
+ error: string;
668
+ }, {
669
+ error: string;
670
+ }>, z.ZodObject<{
671
+ source: z.ZodUnion<[z.ZodString, z.ZodObject<{
672
+ appId: z.ZodString;
673
+ instanceId: z.ZodOptional<z.ZodString>;
674
+ }, "strip", z.ZodTypeAny, {
675
+ appId: string;
676
+ instanceId?: string | undefined;
677
+ }, {
678
+ appId: string;
679
+ instanceId?: string | undefined;
680
+ }>]>;
681
+ version: z.ZodOptional<z.ZodString>;
682
+ intent: z.ZodString;
683
+ getResult: z.ZodOptional<z.ZodUnion<[z.ZodIntersection<z.ZodObject<{
684
+ type: z.ZodString;
685
+ name: z.ZodOptional<z.ZodString>;
686
+ id: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
687
+ }, "strip", z.ZodTypeAny, {
688
+ type: string;
689
+ name?: string | undefined;
690
+ id?: Record<string, any> | undefined;
691
+ }, {
692
+ type: string;
693
+ name?: string | undefined;
694
+ id?: Record<string, any> | undefined;
695
+ }>, z.ZodRecord<z.ZodString, z.ZodAny>>, z.ZodUndefined]>>;
696
+ }, "strip", z.ZodTypeAny, {
697
+ source: string | {
698
+ appId: string;
699
+ instanceId?: string | undefined;
700
+ };
701
+ intent: string;
702
+ version?: string | undefined;
703
+ getResult?: ({
704
+ type: string;
705
+ name?: string | undefined;
706
+ id?: Record<string, any> | undefined;
707
+ } & Record<string, any>) | undefined;
708
+ }, {
709
+ source: string | {
710
+ appId: string;
711
+ instanceId?: string | undefined;
712
+ };
713
+ intent: string;
714
+ version?: string | undefined;
715
+ getResult?: ({
716
+ type: string;
717
+ name?: string | undefined;
718
+ id?: Record<string, any> | undefined;
719
+ } & Record<string, any>) | undefined;
720
+ }>]>;
721
+
722
+ export declare type LogLevel = 'log' | 'debug' | 'info' | 'warn' | 'error';
723
+
724
+ export declare class OAuthAuthenticationError extends CloudInteropAPIError {
725
+ constructor(message: string, cause?: unknown);
726
+ }
727
+
728
+ /**
729
+ * Parameters for OAuth client-credentials authentication.
730
+ *
731
+ * Use these from a server-side application only. A client secret is rejected when the library runs in a browser.
732
+ * Load the secret from the environment or a secret store rather than hard-coding it.
733
+ *
734
+ * @example
735
+ * ```typescript
736
+ * const oauthAuthenticationParameters: OAuthAuthenticationParameters = {
737
+ * grantType: 'client_credentials',
738
+ * clientId: 'your-client-id',
739
+ * clientSecret,
740
+ * };
741
+ * ```
742
+ */
743
+ export declare type OAuthAuthenticationParameters = {
744
+ /**
745
+ * Only `client_credentials` is supported.
746
+ */
747
+ grantType: 'client_credentials';
748
+ /**
749
+ * The client id of an OAuth application an admin already registered.
750
+ */
751
+ clientId: string;
752
+ /**
753
+ * The client secret for that application. Not accepted from a browser page.
754
+ */
755
+ clientSecret: string;
756
+ };
757
+
758
+ /**
759
+ * Options used to raise an Intent
760
+ * @public
761
+ */
762
+ export declare type RaiseIntentAPIOptions = {
763
+ raiseOptions: RaiseIntentOptions;
764
+ appId: AppIdentifier | string;
765
+ };
766
+
767
+ /**
768
+ * @internal
769
+ */
770
+ export declare type RaiseIntentCommand = RaiseIntentEvent & {
771
+ command: 'raise-intent';
772
+ };
773
+
774
+ /**
775
+ * Raised when an interop client invokes an intent
776
+ * @public
777
+ */
778
+ export declare type RaiseIntentEvent = BaseIntentEvent & {
779
+ targetSessionId: string;
780
+ raiseOptions: RaiseIntentOptions;
781
+ };
782
+
783
+ /**
784
+ * Options for raising an intent by intent name or context
785
+ * @public
786
+ */
787
+ export declare type RaiseIntentOptions = z.infer<typeof raiseIntentOptionsSchema>;
788
+
789
+ /**
790
+ * Schema for raiseOptions for the RaiseIntent operation
791
+ * @public
792
+ */
793
+ declare const raiseIntentOptionsSchema: z.ZodUnion<[z.ZodObject<{
794
+ type: z.ZodLiteral<"raise-intent">;
795
+ intent: z.ZodString;
796
+ context: z.ZodIntersection<z.ZodObject<{
797
+ type: z.ZodString;
798
+ name: z.ZodOptional<z.ZodString>;
799
+ id: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
800
+ }, "strip", z.ZodTypeAny, {
801
+ type: string;
802
+ name?: string | undefined;
803
+ id?: Record<string, any> | undefined;
804
+ }, {
805
+ type: string;
806
+ name?: string | undefined;
807
+ id?: Record<string, any> | undefined;
808
+ }>, z.ZodRecord<z.ZodString, z.ZodAny>>;
809
+ }, "strip", z.ZodTypeAny, {
810
+ type: "raise-intent";
811
+ intent: string;
812
+ context: {
813
+ type: string;
814
+ name?: string | undefined;
815
+ id?: Record<string, any> | undefined;
816
+ } & Record<string, any>;
817
+ }, {
818
+ type: "raise-intent";
819
+ intent: string;
820
+ context: {
821
+ type: string;
822
+ name?: string | undefined;
823
+ id?: Record<string, any> | undefined;
824
+ } & Record<string, any>;
825
+ }>, z.ZodObject<{
826
+ type: z.ZodLiteral<"raise-intent-for-context">;
827
+ context: z.ZodIntersection<z.ZodObject<{
828
+ type: z.ZodString;
829
+ name: z.ZodOptional<z.ZodString>;
830
+ id: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
831
+ }, "strip", z.ZodTypeAny, {
832
+ type: string;
833
+ name?: string | undefined;
834
+ id?: Record<string, any> | undefined;
835
+ }, {
836
+ type: string;
837
+ name?: string | undefined;
838
+ id?: Record<string, any> | undefined;
839
+ }>, z.ZodRecord<z.ZodString, z.ZodAny>>;
840
+ }, "strip", z.ZodTypeAny, {
841
+ type: "raise-intent-for-context";
842
+ context: {
843
+ type: string;
844
+ name?: string | undefined;
845
+ id?: Record<string, any> | undefined;
846
+ } & Record<string, any>;
847
+ }, {
848
+ type: "raise-intent-for-context";
849
+ context: {
850
+ type: string;
851
+ name?: string | undefined;
852
+ id?: Record<string, any> | undefined;
853
+ } & Record<string, any>;
854
+ }>]>;
855
+
856
+ /**
857
+ * @internal
858
+ */
859
+ export declare type ReportIntentsCommand = ReportIntentsEvent & {
860
+ command: 'report-intents';
861
+ };
862
+
863
+ /**
864
+ * Raised when an interop client requests intents from other connected sessions.
865
+ * @public
866
+ */
867
+ export declare type ReportIntentsEvent = BaseIntentDiscoveryEvent & {
868
+ /**
869
+ * Options qualifying how the session should respond to the request
870
+ * - intent: when provided, filter the response to only include intents that match the specified intent name
871
+ * - context: when provided, filter the response to only include intents that match the specified context
872
+ * - resultType: when provided, filter the response to only include apps that match the specified result type
873
+ */
874
+ findOptions: FindIntentOptions;
875
+ /**
876
+ * The number of connected sessions including the current session
877
+ */
878
+ sessionCount: number;
879
+ };
880
+
881
+ /**
882
+ * Represents a source session
883
+ * @public
884
+ */
885
+ export declare type Source = {
886
+ /**
887
+ * Source session id
888
+ */
889
+ sessionId: string;
890
+ /**
891
+ * Source environment id
892
+ */
893
+ sourceId: string;
894
+ /**
895
+ * Source user id
896
+ */
897
+ userId: string;
898
+ /**
899
+ * Source org id
900
+ */
901
+ orgId: string;
902
+ /**
903
+ * Source platform id
904
+ */
905
+ platformId: string;
906
+ };
907
+
908
+ /**
909
+ * Options used to start an Intent Discovery Operation, with possible constraints for the responses
910
+ * @public
911
+ */
912
+ export declare type StartIntentDiscoveryOptions = {
913
+ findOptions: FindIntentOptions;
914
+ /**
915
+ * The timeout in ms.
916
+ *
917
+ * Discovery will wait for all connected sessions to respond or until the timeout is reached.
918
+ *
919
+ * Defaults to 3000ms if not provided, minimum value 500ms
920
+ */
921
+ timeout?: number;
922
+ };
923
+
924
+ export { }