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

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,23 +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
- reconnected: () => void;
15
- disconnected: () => void;
16
- context: (event: ContextEvent) => void;
17
- reconnecting: (attemptNo: number) => void;
18
- error: (error: Error) => void;
19
- 'session-expired': () => void;
20
- };
3
+ import { CloudInteropSettings, ConnectParameters, CreateSessionResponse } from './interfaces/connect.interface';
4
+ import { EventMap, RaiseIntentAPIOptions, StartIntentDiscoveryOptions } from './interfaces';
21
5
  /**
22
6
  * Represents a single connection to a Cloud Interop service
23
7
  *
@@ -57,7 +41,19 @@ export declare class CloudInteropAPI {
57
41
  * @memberof CloudInteropAPI
58
42
  */
59
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;
60
56
  addEventListener<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
61
57
  removeEventListener<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
58
+ once<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
62
59
  }
63
- 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
+ }