@openfin/cloud-interop-core-api 0.0.1-alpha.ffc0fe6 → 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.
@@ -9,22 +9,13 @@ export type CloudInteropLogger = (level: LogLevel, message: string) => void;
9
9
  export type ConnectParameters = {
10
10
  /**
11
11
  * ID for a group of shared applications.
12
+ * This acts as a namespace for the interop messages that allows separation of messages between different groups of applications for the same user
12
13
  */
13
14
  platformId: string;
14
15
  /**
15
- * An identifier for the source environment e.g. a hostname, a browser name etc.
16
+ * An user-friendly identifier for the source session e.g. Windows Desktop, Android Phone, etc.
16
17
  */
17
- sourceId?: string;
18
- /**
19
- * A display name for the source environment e.g. Andys Mobile
20
- */
21
- sourceDisplayName?: string;
22
- /**
23
- * Specifies an optional extra divider to use that allows separation of interop messages for the
24
- * same user
25
- * defaults to "default"
26
- */
27
- realm?: string;
18
+ sourceId: string;
28
19
  /**
29
20
  * The maximum number of times to retry connecting to the cloud interop service when the connection is dropped
30
21
  * defaults to 30
@@ -82,66 +73,13 @@ export type ConnectParameters = {
82
73
  export type CloudInteropSettings = {
83
74
  url: string;
84
75
  };
85
- /**
86
- * Represents a session
87
- */
88
- export type InteropSession = {
76
+ export type CreateSessionResponse = {
89
77
  sessionId: string;
90
- };
91
- /**
92
- * Represents a source session
93
- */
94
- export type Source = {
95
- /**
96
- * Source session id
97
- */
98
- sessionId: string;
99
- /**
100
- * source environment id
101
- */
78
+ sessionRootTopic: string;
79
+ url: string;
80
+ token: string;
81
+ orgId: string;
82
+ sub: string;
83
+ platformId: string;
102
84
  sourceId: string;
103
- /**
104
- * source environment display name
105
- */
106
- sourceDisplayName: string;
107
- };
108
- /**
109
- * Represents the details of an intent found during discovery
110
- */
111
- export type IntentDetail = {
112
- /**
113
- * The location of the intent implementation
114
- */
115
- source: Source;
116
- /**
117
- * The instance id of the intent
118
- */
119
- intentInstanceId: string;
120
- /**
121
- * The name of the intent
122
- */
123
- intentName: string;
124
- };
125
- /**
126
- * Represents a context received from another cloud interop publisher
127
- *
128
- * @export
129
- * @type ContextEvent
130
- * @property {string} contextGroup - The context group
131
- * @property {object} context - The context
132
- * @property {Source} source - The source of the context
133
- */
134
- export type ContextEvent = {
135
- /**
136
- * The context group
137
- */
138
- contextGroup: string;
139
- /**
140
- * The context object
141
- */
142
- context: object;
143
- /**
144
- * The source of the context
145
- */
146
- source: Source;
147
85
  };
@@ -0,0 +1,15 @@
1
+ import { AggregateIntentDetailsEvent, ContextEvent, IntentDetailsEvent, IntentResultEvent, RaiseIntentEvent, ReportIntentsEvent } from '@openfin/shared-utils';
2
+ export type EventMap = {
3
+ reconnected: () => void;
4
+ disconnected: () => void;
5
+ context: (event: ContextEvent) => void;
6
+ reconnecting: (attemptNo: number) => void;
7
+ error: (error: Error) => void;
8
+ 'session-expired': () => void;
9
+ 'report-intents': (event: ReportIntentsEvent) => void;
10
+ 'intent-details': (event: IntentDetailsEvent) => void;
11
+ 'aggregate-intent-details': (event: AggregateIntentDetailsEvent) => void;
12
+ 'raise-intent': (event: RaiseIntentEvent) => void;
13
+ 'intent-result': (event: IntentResultEvent) => void;
14
+ };
15
+ export type EventListenersMap = Map<keyof EventMap, Array<(...args: Parameters<EventMap[keyof EventMap]>) => void>>;
@@ -0,0 +1,3 @@
1
+ export * from './connect.interface';
2
+ export * from './event.interface';
3
+ export * from './intents.interface';
@@ -0,0 +1,22 @@
1
+ import { AppIdentifier, FindIntentOptions, RaiseIntentOptions } from '@openfin/shared-utils';
2
+ /**
3
+ * Options used to start an Intent Discovery Operation, with possible constraints for the responses
4
+ */
5
+ export type StartIntentDiscoveryOptions = {
6
+ findOptions: FindIntentOptions;
7
+ /**
8
+ * The timeout in ms.
9
+ *
10
+ * Discovery will wait for all connected sessions to respond or until the timeout is reached.
11
+ *
12
+ * Defaults to 3000ms if not provided, minimum value 500ms
13
+ */
14
+ timeout?: number;
15
+ };
16
+ /**
17
+ * Options used to raise an Intent
18
+ */
19
+ export type RaiseIntentAPIOptions = {
20
+ raiseOptions: RaiseIntentOptions;
21
+ appId: AppIdentifier | string;
22
+ };
@@ -0,0 +1,25 @@
1
+ import { AppIdentifier, AppIntent, Source } from '@openfin/shared-utils';
2
+ import { ConnectParameters, CreateSessionResponse } from './interfaces';
3
+ export declare const APP_ID_DELIM = "::";
4
+ export declare const getRequestHeaders: (connectionParameters: ConnectParameters) => HeadersInit;
5
+ /**
6
+ * Encodes all app intents in the format: `appId::sourceId::sessionId`,
7
+ * where sourceId and sessionId are URI encoded
8
+ * @param appIntents
9
+ * @param source
10
+ * @returns
11
+ */
12
+ export declare const encodeAppIntents: (appIntents: AppIntent[], { sessionId, sourceId }: Source) => AppIntent[];
13
+ /**
14
+ * Decodes all app intents by URI decoding the parts previously encoded by `encodeAppIntents`
15
+ * @param appIntents
16
+ * @returns
17
+ */
18
+ export declare const decodeAppIntents: (appIntents: AppIntent[]) => AppIntent[];
19
+ /**
20
+ * Decodes the app id to extract the sessionId, returns '' if not able to parse
21
+ * @param app
22
+ * @returns
23
+ */
24
+ export declare const parseSessionId: (appId: AppIdentifier | string) => any;
25
+ export declare const getSourceFromSession: (sessionDetails: CreateSessionResponse) => Source;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/cloud-interop-core-api",
3
- "version": "0.0.1-alpha.ffc0fe6",
3
+ "version": "0.0.1-alpha.ffeba61",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "files": [
@@ -10,7 +10,7 @@
10
10
  "browser": "./dist/index.mjs",
11
11
  "types": "./dist/index.d.ts",
12
12
  "scripts": {
13
- "build": "rollup -c",
13
+ "build": "rimraf dist && rollup -c",
14
14
  "build:watch": "rollup -c --watch",
15
15
  "typecheck": "tsc --noEmit",
16
16
  "test": "jest --coverage",
@@ -25,7 +25,7 @@
25
25
  "@rollup/plugin-node-resolve": "^15.2.3",
26
26
  "@rollup/plugin-typescript": "^11.1.6",
27
27
  "@types/jest": "^29.5.14",
28
- "@types/node": "^20.10.0",
28
+ "@types/node": "^22.7.7",
29
29
  "@typescript-eslint/eslint-plugin": "^7.5.0",
30
30
  "@typescript-eslint/parser": "^7.15.0",
31
31
  "eslint": "^8.57.0",
@@ -42,7 +42,7 @@
42
42
  "typescript": "^5.6.3"
43
43
  },
44
44
  "dependencies": {
45
- "axios": "^1.6.2",
45
+ "@openfin/shared-utils": "file:../shared-utils",
46
46
  "mqtt": "^5.3.1"
47
47
  },
48
48
  "eslintConfig": {