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

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/dist/api.d.ts CHANGED
@@ -1,22 +1,7 @@
1
+ import { AppIdentifier, AppIntent, IntentResult } from '@openfin/shared-utils';
1
2
  import mqtt from 'mqtt';
2
- import { CloudInteropSettings, ConnectParameters as ConnectParameters, ContextEvent } from './interfaces';
3
- type CreateSessionResponse = {
4
- sessionId: string;
5
- sessionRootTopic: string;
6
- url: string;
7
- token: string;
8
- orgId: string;
9
- sub: string;
10
- platformId: string;
11
- sourceId: string;
12
- };
13
- type EventMap = {
14
- connected: () => void;
15
- disconnected: () => void;
16
- context: (event: ContextEvent) => void;
17
- reconnecting: (attemptNo: number) => void;
18
- error: (error: Error) => void;
19
- };
3
+ import { CloudInteropSettings, ConnectParameters, CreateSessionResponse } from './interfaces/connect.interface';
4
+ import { EventMap, RaiseIntentAPIOptions, StartIntentDiscoveryOptions } from './interfaces';
20
5
  /**
21
6
  * Represents a single connection to a Cloud Interop service
22
7
  *
@@ -26,14 +11,6 @@ type EventMap = {
26
11
  */
27
12
  export declare class CloudInteropAPI {
28
13
  #private;
29
- private cloudInteropSettings;
30
- private _sessionDetails?;
31
- private _mqttClient?;
32
- private reconnectRetryLimit;
33
- private logger;
34
- private reconnectRetries;
35
- private connectionParams?;
36
- private eventListeners;
37
14
  constructor(cloudInteropSettings: CloudInteropSettings);
38
15
  get sessionDetails(): CreateSessionResponse | undefined;
39
16
  get mqttClient(): mqtt.MqttClient | undefined;
@@ -64,7 +41,19 @@ export declare class CloudInteropAPI {
64
41
  * @memberof CloudInteropAPI
65
42
  */
66
43
  setContext(contextGroup: string, context: object): Promise<void>;
44
+ /**
45
+ * Starts an intent discovery operation
46
+ *
47
+ * @return {*} {Promise<void>}
48
+ * @memberof CloudInteropAPI
49
+ * @throws {CloudInteropAPIError} - If an error occurs during intent discovery
50
+ */
51
+ startIntentDiscovery(options: StartIntentDiscoveryOptions): Promise<void>;
52
+ raiseIntent(options: RaiseIntentAPIOptions): Promise<void>;
53
+ reportAppIntents(discoveryId: string, intents: AppIntent[]): Promise<boolean>;
54
+ sendIntentResult(initiatingSessionId: string, result: IntentResult): Promise<void>;
55
+ parseSessionId(appId: AppIdentifier | string): string;
67
56
  addEventListener<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
68
57
  removeEventListener<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
58
+ once<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
69
59
  }
70
- export {};
@@ -0,0 +1,8 @@
1
+ import { EventMap } from '../interfaces';
2
+ export declare class EventController {
3
+ #private;
4
+ addEventListener<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
5
+ removeEventListener<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
6
+ once<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
7
+ emitEvent<K extends keyof EventMap>(type: K, ...args: Parameters<EventMap[K]>): void;
8
+ }
@@ -0,0 +1,2 @@
1
+ export * from './event.controller';
2
+ export * from './intent.controller';
@@ -0,0 +1,13 @@
1
+ import { AppIntent, CommandMessage, IntentResult } from '@openfin/shared-utils';
2
+ import mqtt from 'mqtt';
3
+ import { CloudInteropLogger, ConnectParameters, CreateSessionResponse, RaiseIntentAPIOptions, StartIntentDiscoveryOptions } from '../interfaces';
4
+ import { EventController } from './event.controller';
5
+ export declare class IntentController {
6
+ #private;
7
+ constructor(url: string, mqttClient: mqtt.MqttClient, sessionDetails: CreateSessionResponse, connectionParameters: ConnectParameters, events: EventController, logger: CloudInteropLogger);
8
+ startIntentDiscovery(options: StartIntentDiscoveryOptions): Promise<void>;
9
+ raiseIntent({ raiseOptions, appId }: RaiseIntentAPIOptions): Promise<void>;
10
+ reportAppIntents(discoveryId: string, intents: AppIntent[]): Promise<boolean>;
11
+ sendIntentResult(initiatingSessionId: string, result: IntentResult): Promise<void>;
12
+ handleCommandMessage(message: CommandMessage): void;
13
+ }