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

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/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # @openfin/cloud-interop-core-api
2
2
 
3
- This package contains the core interop library that handles all interactions with the Here™ Cloud Interop Service.
3
+ This package contains the core interop library that handles all interactions with the HERE Cloud Interop Service.
4
4
 
5
5
  It is callable via browser or node applications.
6
6
 
7
7
 
8
8
  ## Authentication
9
9
 
10
- The library supports authentication with the Here™ Cloud Interop Service using the following methods:
10
+ The library supports authentication with the HERE Cloud Interop Service using the following methods:
11
11
  - Basic Authentication
12
12
  - JWT Token Authentication
13
13
  - Default Authentication i.e. Interactive session based authentication using cookies
@@ -1,12 +1,24 @@
1
1
  import mqtt from 'mqtt';
2
2
  import { z } from 'zod';
3
3
 
4
+ /**
5
+ * Raised when an interop client receives an aggregate of intents from other connected sessions
6
+ * @public
7
+ */
4
8
  export declare type AggregateIntentDetailsEvent = {
5
9
  responses: IntentDetailsEvent[];
6
10
  };
7
11
 
12
+ /**
13
+ * Represents an app intent
14
+ * @public
15
+ */
8
16
  export declare type AppIdentifier = z.infer<typeof appIdentifierSchema>;
9
17
 
18
+ /**
19
+ * Schema for an AppIdentifier
20
+ * @public
21
+ */
10
22
  declare const appIdentifierSchema: z.ZodObject<{
11
23
  appId: z.ZodString;
12
24
  instanceId: z.ZodOptional<z.ZodString>;
@@ -18,8 +30,16 @@ declare const appIdentifierSchema: z.ZodObject<{
18
30
  instanceId?: string | undefined;
19
31
  }>;
20
32
 
33
+ /**
34
+ * Represents an app intent
35
+ * @public
36
+ */
21
37
  export declare type AppIntent = z.infer<typeof appIntentSchema>;
22
38
 
39
+ /**
40
+ * Schema for an app intent
41
+ * @public
42
+ */
23
43
  declare const appIntentSchema: z.ZodObject<{
24
44
  intent: z.ZodObject<{
25
45
  displayName: z.ZodString;
@@ -31,7 +51,7 @@ declare const appIntentSchema: z.ZodObject<{
31
51
  name: string;
32
52
  displayName: string;
33
53
  }>;
34
- apps: z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
54
+ apps: z.ZodArray<z.ZodObject<{
35
55
  description: z.ZodOptional<z.ZodString>;
36
56
  icons: z.ZodOptional<z.ZodArray<z.ZodObject<{
37
57
  size: z.ZodOptional<z.ZodString>;
@@ -68,10 +88,10 @@ declare const appIntentSchema: z.ZodObject<{
68
88
  title: z.ZodOptional<z.ZodString>;
69
89
  tooltip: z.ZodOptional<z.ZodString>;
70
90
  version: z.ZodOptional<z.ZodString>;
71
- }, {
91
+ } & {
72
92
  appId: z.ZodString;
73
93
  instanceId: z.ZodOptional<z.ZodString>;
74
- }>, "strip", z.ZodTypeAny, {
94
+ }, "strip", z.ZodTypeAny, {
75
95
  appId: string;
76
96
  instanceId?: string | undefined;
77
97
  description?: string | undefined;
@@ -175,30 +195,36 @@ export declare class AuthorizationError extends CloudInteropAPIError {
175
195
  }
176
196
 
177
197
  /**
178
- * @internal
179
198
  * Represents a base event for the cloud interop api
199
+ * @public
180
200
  * @property {Source} source - The source of the event
181
201
  * @property {HistoryRecord} history - A trail of timestamps of when the context hit various points in the system
182
202
  */
183
- declare type BaseCloudInteropAPIEvent = {
203
+ export declare type BaseCloudInteropAPIEvent = {
184
204
  /**
185
205
  * The source of the event
186
206
  */
187
207
  source: Source;
188
208
  /**
189
209
  * A trail of timestamps of when the event hit various points in the system
210
+ * @internal
190
211
  */
191
212
  history?: HistoryRecord;
192
213
  };
193
214
 
194
215
  /**
195
216
  * Represents an Intent Discovery Event
217
+ * @public
196
218
  */
197
- declare type BaseIntentDiscoveryEvent = BaseIntentEvent & {
219
+ export declare type BaseIntentDiscoveryEvent = BaseIntentEvent & {
198
220
  discoveryId: string;
199
221
  };
200
222
 
201
- declare type BaseIntentEvent = BaseCloudInteropAPIEvent & {
223
+ /**
224
+ * Represents a base intent event
225
+ * @public
226
+ */
227
+ export declare type BaseIntentEvent = BaseCloudInteropAPIEvent & {
202
228
  /**
203
229
  * The session id of the interop client that initiated an intent action
204
230
  */
@@ -208,9 +234,8 @@ declare type BaseIntentEvent = BaseCloudInteropAPIEvent & {
208
234
  /**
209
235
  * Represents a single connection to a Cloud Interop service
210
236
  *
211
- * @export
212
- * @class CloudInteropAPI
213
- * @implements {Client}
237
+ * @public
238
+ * @class
214
239
  */
215
240
  export declare class CloudInteropAPI {
216
241
  #private;
@@ -220,42 +245,43 @@ export declare class CloudInteropAPI {
220
245
  /**
221
246
  * Connects and creates a session on the Cloud Interop service
222
247
  *
223
- * @param {ConnectParameters} parameters - The parameters to use to connect
224
- * @return {*} {Promise<void>}
248
+ * @param parameters - The parameters to use to connect
249
+ * @returns Promise that resolves when connection is established
225
250
  * @memberof CloudInteropAPI
226
- * @throws {CloudInteropAPIError} - If an error occurs during connection
227
- * @throws {AuthorizationError} - If the connection is unauthorized
251
+ * @throws CloudInteropAPIError - If an error occurs during connection
252
+ * @throws AuthorizationError - If the connection is unauthorized
228
253
  */
229
254
  connect(parameters: ConnectParameters): Promise<void>;
230
255
  /**
231
256
  * Disconnects from the Cloud Interop service
232
257
  *
233
- * @return {*} {Promise<void>}
258
+ * @returns Promise that resolves when disconnected
234
259
  * @memberof CloudInteropAPI
235
- * @throws {CloudInteropAPIError} - If an error occurs during disconnection
260
+ * @throws CloudInteropAPIError - If an error occurs during disconnection
236
261
  */
237
262
  disconnect(): Promise<void>;
238
263
  /**
239
264
  * Publishes a new context for the given context group to the other connected sessions
240
265
  *
241
- * @param {string} contextGroup - The context group to publish to
242
- * @param {object} context - The context to publish
243
- * @return {*} {Promise<void>}
266
+ * @param contextGroup - The context group to publish to
267
+ * @param context - The context to publish
268
+ * @returns Promise that resolves when context is published
244
269
  * @memberof CloudInteropAPI
245
270
  */
246
- setContext(contextGroup: string, context: object): Promise<void>;
271
+ setContext(contextGroup: string, context: InferredContext): Promise<void>;
247
272
  /**
248
273
  * Starts an intent discovery operation
249
274
  *
250
- * @return {*} {Promise<void>}
275
+ * @returns Promise that resolves when intent discovery is started
251
276
  * @memberof CloudInteropAPI
252
- * @throws {CloudInteropAPIError} - If an error occurs during intent discovery
277
+ * @throws CloudInteropAPIError - If an error occurs during intent discovery
253
278
  */
254
279
  startIntentDiscovery(options: StartIntentDiscoveryOptions): Promise<void>;
255
280
  raiseIntent(options: RaiseIntentAPIOptions): Promise<void>;
256
281
  reportAppIntents(discoveryId: string, intents: AppIntent[]): Promise<boolean>;
257
282
  sendIntentResult(initiatingSessionId: string, result: IntentResult): Promise<void>;
258
283
  parseSessionId(appId: AppIdentifier | string): string;
284
+ parseAppId(appId: AppIdentifier | string): string;
259
285
  addEventListener<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
260
286
  removeEventListener<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
261
287
  once<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
@@ -275,6 +301,9 @@ export declare type CloudInteropSettings = {
275
301
  url: string;
276
302
  };
277
303
 
304
+ /**
305
+ * @internal
306
+ */
278
307
  export declare type CommandMessage = ReportIntentsCommand | IntentDetailsCommand | RaiseIntentCommand | IntentResultCommand;
279
308
 
280
309
  /**
@@ -347,9 +376,7 @@ export declare type ConnectParameters = {
347
376
 
348
377
  /**
349
378
  * Represents a context received from another cloud interop publisher
350
- *
351
- * @export
352
- * @type ContextEvent
379
+ * @public
353
380
  * @property {string} contextGroup - The context group
354
381
  * @property {object} context - The context
355
382
  */
@@ -364,6 +391,10 @@ export declare type ContextEvent = BaseCloudInteropAPIEvent & {
364
391
  context?: InferredContext;
365
392
  };
366
393
 
394
+ /**
395
+ * Schema for context object
396
+ * @public
397
+ */
367
398
  declare const contextSchema: z.ZodIntersection<z.ZodObject<{
368
399
  type: z.ZodString;
369
400
  name: z.ZodOptional<z.ZodString>;
@@ -387,8 +418,17 @@ export declare type CreateSessionResponse = {
387
418
  sub: string;
388
419
  platformId: string;
389
420
  sourceId: string;
421
+ localSessionExpiryHandling?: boolean;
390
422
  };
391
423
 
424
+ declare const errorSchema: z.ZodObject<{
425
+ error: z.ZodString;
426
+ }, "strip", z.ZodTypeAny, {
427
+ error: string;
428
+ }, {
429
+ error: string;
430
+ }>;
431
+
392
432
  export declare type EventListenersMap = Map<keyof EventMap, Array<(...args: Parameters<EventMap[keyof EventMap]>) => void>>;
393
433
 
394
434
  export declare type EventMap = {
@@ -407,9 +447,14 @@ export declare type EventMap = {
407
447
 
408
448
  /**
409
449
  * Options for finding intents by intent name or context
450
+ * @public
410
451
  */
411
452
  export declare type FindIntentOptions = z.infer<typeof findIntentOptionsSchema>;
412
453
 
454
+ /**
455
+ * Schema for findOptions for the StartDiscovery operation
456
+ * @public
457
+ */
413
458
  declare const findIntentOptionsSchema: z.ZodUnion<[z.ZodObject<{
414
459
  type: z.ZodLiteral<"find-intent">;
415
460
  intent: z.ZodString;
@@ -480,8 +525,8 @@ declare const findIntentOptionsSchema: z.ZodUnion<[z.ZodObject<{
480
525
  }>]>;
481
526
 
482
527
  /**
483
- * @internal
484
528
  * A trace record for performance monitoring
529
+ * @internal
485
530
  */
486
531
  declare type HistoryRecord = {
487
532
  /**
@@ -503,19 +548,33 @@ declare type HistoryRecord = {
503
548
  clientReceived?: number;
504
549
  };
505
550
 
551
+ /**
552
+ * Represents a context object
553
+ * @public
554
+ */
506
555
  export declare type InferredContext = z.infer<typeof contextSchema>;
507
556
 
557
+ export declare type InferredError = z.infer<typeof errorSchema>;
558
+
559
+ /**
560
+ * @internal
561
+ */
508
562
  export declare type IntentDetailsCommand = IntentDetailsEvent & {
509
563
  command: 'intent-details';
510
564
  };
511
565
 
512
566
  /**
513
567
  * Raised when an interop client receives intents from other connected sessions
568
+ * @public
514
569
  */
515
570
  export declare type IntentDetailsEvent = BaseIntentDiscoveryEvent & {
516
571
  intents: AppIntent[];
517
572
  };
518
573
 
574
+ /**
575
+ * Represents an intent resolution
576
+ * @public
577
+ */
519
578
  export declare type IntentResolution = z.infer<typeof intentResolutionSchema>;
520
579
 
521
580
  declare const intentResolutionSchema: z.ZodObject<{
@@ -570,19 +629,31 @@ declare const intentResolutionSchema: z.ZodObject<{
570
629
  } & Record<string, any>) | undefined;
571
630
  }>;
572
631
 
632
+ /**
633
+ * Represents an intent result
634
+ * @public
635
+ */
573
636
  export declare type IntentResult = z.infer<typeof intentResultSchema>;
574
637
 
638
+ /**
639
+ * @internal
640
+ */
575
641
  export declare type IntentResultCommand = IntentResultEvent & {
576
642
  command: 'intent-result';
577
643
  };
578
644
 
579
645
  /**
580
646
  * Raised when an interop client receives an intent result after raising an intent on a target session
647
+ * @public
581
648
  */
582
649
  export declare type IntentResultEvent = BaseIntentEvent & {
583
650
  result: IntentResult;
584
651
  };
585
652
 
653
+ /**
654
+ * Schema for the result of an intent
655
+ * @public
656
+ */
586
657
  declare const intentResultSchema: z.ZodUnion<[z.ZodObject<{
587
658
  error: z.ZodString;
588
659
  }, "strip", z.ZodTypeAny, {
@@ -645,18 +716,23 @@ export declare type LogLevel = 'log' | 'debug' | 'info' | 'warn' | 'error';
645
716
 
646
717
  /**
647
718
  * Options used to raise an Intent
719
+ * @public
648
720
  */
649
721
  export declare type RaiseIntentAPIOptions = {
650
722
  raiseOptions: RaiseIntentOptions;
651
723
  appId: AppIdentifier | string;
652
724
  };
653
725
 
726
+ /**
727
+ * @internal
728
+ */
654
729
  export declare type RaiseIntentCommand = RaiseIntentEvent & {
655
730
  command: 'raise-intent';
656
731
  };
657
732
 
658
733
  /**
659
734
  * Raised when an interop client invokes an intent
735
+ * @public
660
736
  */
661
737
  export declare type RaiseIntentEvent = BaseIntentEvent & {
662
738
  targetSessionId: string;
@@ -665,9 +741,14 @@ export declare type RaiseIntentEvent = BaseIntentEvent & {
665
741
 
666
742
  /**
667
743
  * Options for raising an intent by intent name or context
744
+ * @public
668
745
  */
669
746
  export declare type RaiseIntentOptions = z.infer<typeof raiseIntentOptionsSchema>;
670
747
 
748
+ /**
749
+ * Schema for raiseOptions for the RaiseIntent operation
750
+ * @public
751
+ */
671
752
  declare const raiseIntentOptionsSchema: z.ZodUnion<[z.ZodObject<{
672
753
  type: z.ZodLiteral<"raise-intent">;
673
754
  intent: z.ZodString;
@@ -731,12 +812,16 @@ declare const raiseIntentOptionsSchema: z.ZodUnion<[z.ZodObject<{
731
812
  } & Record<string, any>;
732
813
  }>]>;
733
814
 
815
+ /**
816
+ * @internal
817
+ */
734
818
  export declare type ReportIntentsCommand = ReportIntentsEvent & {
735
819
  command: 'report-intents';
736
820
  };
737
821
 
738
822
  /**
739
823
  * Raised when an interop client requests intents from other connected sessions.
824
+ * @public
740
825
  */
741
826
  export declare type ReportIntentsEvent = BaseIntentDiscoveryEvent & {
742
827
  /**
@@ -754,6 +839,7 @@ export declare type ReportIntentsEvent = BaseIntentDiscoveryEvent & {
754
839
 
755
840
  /**
756
841
  * Represents a source session
842
+ * @public
757
843
  */
758
844
  export declare type Source = {
759
845
  /**
@@ -780,6 +866,7 @@ export declare type Source = {
780
866
 
781
867
  /**
782
868
  * Options used to start an Intent Discovery Operation, with possible constraints for the responses
869
+ * @public
783
870
  */
784
871
  export declare type StartIntentDiscoveryOptions = {
785
872
  findOptions: FindIntentOptions;