@openfin/cloud-interop-core-api 0.0.1-alpha.6b2fbd5 → 0.0.1-alpha.6d7b62b
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/LICENSE.md +4 -0
- package/dist/README.md +14 -0
- package/dist/bundle.d.ts +796 -0
- package/dist/index.cjs +520 -145
- package/dist/index.mjs +513 -3904
- package/dist/package.json +18 -0
- package/package.json +20 -10
- package/dist/api.d.ts +0 -70
- package/dist/errors/api.error.d.ts +0 -7
- package/dist/index.d.ts +0 -3
- package/dist/interfaces.d.ts +0 -133
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openfin/cloud-interop-core-api",
|
|
3
|
+
"version": "0.0.1-alpha",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "",
|
|
6
|
+
"main": "./index.cjs",
|
|
7
|
+
"browser": "./index.mjs",
|
|
8
|
+
"types": "./bundle.d.ts",
|
|
9
|
+
"author": "",
|
|
10
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
11
|
+
"optionalDependencies": {
|
|
12
|
+
"@rollup/rollup-linux-x64-gnu": "*"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"mqtt": "^5.3.1",
|
|
16
|
+
"zod": "^3.24.1"
|
|
17
|
+
}
|
|
18
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfin/cloud-interop-core-api",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.6d7b62b",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"files": [
|
|
@@ -8,26 +8,29 @@
|
|
|
8
8
|
],
|
|
9
9
|
"main": "./dist/index.cjs",
|
|
10
10
|
"browser": "./dist/index.mjs",
|
|
11
|
-
"types": "./dist/
|
|
11
|
+
"types": "./dist/bundle.d.ts",
|
|
12
12
|
"scripts": {
|
|
13
|
-
"build": "
|
|
14
|
-
"build:watch": "
|
|
13
|
+
"build": "rimraf dist && tsx scripts/build.ts",
|
|
14
|
+
"build:watch": "NODE_ENV=development npx nodemon --watch ./src -e .ts -x \"npm run build || exit 1\"",
|
|
15
15
|
"typecheck": "tsc --noEmit",
|
|
16
16
|
"test": "jest --coverage",
|
|
17
17
|
"lint": "eslint . --max-warnings 0",
|
|
18
|
-
"lint:fix": "eslint . --fix --max-warnings 0"
|
|
18
|
+
"lint:fix": "eslint . --fix --max-warnings 0",
|
|
19
|
+
"pack": "pushd dist && npm pack && popd"
|
|
19
20
|
},
|
|
20
21
|
"author": "",
|
|
21
22
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
22
23
|
"devDependencies": {
|
|
24
|
+
"@microsoft/api-extractor": "^7.49.1",
|
|
23
25
|
"@rollup/plugin-commonjs": "^28.0.1",
|
|
24
26
|
"@rollup/plugin-inject": "^5.0.5",
|
|
25
27
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
26
28
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
27
29
|
"@types/jest": "^29.5.14",
|
|
28
|
-
"@types/node": "^
|
|
30
|
+
"@types/node": "^22.7.7",
|
|
29
31
|
"@typescript-eslint/eslint-plugin": "^7.5.0",
|
|
30
32
|
"@typescript-eslint/parser": "^7.15.0",
|
|
33
|
+
"dotenv-defaults": "^5.0.2",
|
|
31
34
|
"eslint": "^8.57.0",
|
|
32
35
|
"eslint-config-prettier": "^9.1.0",
|
|
33
36
|
"eslint-plugin-check-file": "^2.8.0",
|
|
@@ -36,14 +39,20 @@
|
|
|
36
39
|
"eslint-plugin-unicorn": "^55.0.0",
|
|
37
40
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
38
41
|
"jest": "^29.7.0",
|
|
42
|
+
"nodemon": "^3.1.9",
|
|
39
43
|
"prettier": "^3.3.3",
|
|
40
|
-
"rollup": "^4.
|
|
44
|
+
"rollup": "^4.30.1",
|
|
41
45
|
"ts-jest": "^29.2.5",
|
|
42
|
-
"
|
|
46
|
+
"tsx": "^4.19.2",
|
|
47
|
+
"typescript": "^5.7.3"
|
|
48
|
+
},
|
|
49
|
+
"optionalDependencies": {
|
|
50
|
+
"@rollup/rollup-linux-x64-gnu": "*"
|
|
43
51
|
},
|
|
44
52
|
"dependencies": {
|
|
45
|
-
"
|
|
46
|
-
"mqtt": "^5.3.1"
|
|
53
|
+
"@openfin/shared-utils": "file:../shared-utils",
|
|
54
|
+
"mqtt": "^5.3.1",
|
|
55
|
+
"zod": "^3.24.1"
|
|
47
56
|
},
|
|
48
57
|
"eslintConfig": {
|
|
49
58
|
"env": {
|
|
@@ -197,6 +206,7 @@
|
|
|
197
206
|
"node_modules",
|
|
198
207
|
"out",
|
|
199
208
|
"build",
|
|
209
|
+
"scripts",
|
|
200
210
|
"dist",
|
|
201
211
|
"coverage",
|
|
202
212
|
"tests",
|
package/dist/api.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
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
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Represents a single connection to a Cloud Interop service
|
|
22
|
-
*
|
|
23
|
-
* @export
|
|
24
|
-
* @class CloudInteropAPI
|
|
25
|
-
* @implements {Client}
|
|
26
|
-
*/
|
|
27
|
-
export declare class CloudInteropAPI {
|
|
28
|
-
#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
|
-
constructor(cloudInteropSettings: CloudInteropSettings);
|
|
38
|
-
get sessionDetails(): CreateSessionResponse | undefined;
|
|
39
|
-
get mqttClient(): mqtt.MqttClient | undefined;
|
|
40
|
-
/**
|
|
41
|
-
* Connects and creates a session on the Cloud Interop service
|
|
42
|
-
*
|
|
43
|
-
* @param {ConnectParameters} parameters - The parameters to use to connect
|
|
44
|
-
* @return {*} {Promise<void>}
|
|
45
|
-
* @memberof CloudInteropAPI
|
|
46
|
-
* @throws {CloudInteropAPIError} - If an error occurs during connection
|
|
47
|
-
* @throws {AuthorizationError} - If the connection is unauthorized
|
|
48
|
-
*/
|
|
49
|
-
connect(parameters: ConnectParameters): Promise<void>;
|
|
50
|
-
/**
|
|
51
|
-
* Disconnects from the Cloud Interop service
|
|
52
|
-
*
|
|
53
|
-
* @return {*} {Promise<void>}
|
|
54
|
-
* @memberof CloudInteropAPI
|
|
55
|
-
* @throws {CloudInteropAPIError} - If an error occurs during disconnection
|
|
56
|
-
*/
|
|
57
|
-
disconnect(): Promise<void>;
|
|
58
|
-
/**
|
|
59
|
-
* Publishes a new context for the given context group to the other connected sessions
|
|
60
|
-
*
|
|
61
|
-
* @param {string} contextGroup - The context group to publish to
|
|
62
|
-
* @param {object} context - The context to publish
|
|
63
|
-
* @return {*} {Promise<void>}
|
|
64
|
-
* @memberof CloudInteropAPI
|
|
65
|
-
*/
|
|
66
|
-
setContext(contextGroup: string, context: object): Promise<void>;
|
|
67
|
-
addEventListener<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
|
|
68
|
-
removeEventListener<K extends keyof EventMap>(type: K, callback: EventMap[K]): void;
|
|
69
|
-
}
|
|
70
|
-
export {};
|
package/dist/index.d.ts
DELETED
package/dist/interfaces.d.ts
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
export type LogLevel = 'log' | 'debug' | 'info' | 'warn' | 'error';
|
|
2
|
-
/**
|
|
3
|
-
* Represents a logging function to be used by the cloud interop client
|
|
4
|
-
*/
|
|
5
|
-
export type CloudInteropLogger = (level: LogLevel, message: string) => void;
|
|
6
|
-
/**
|
|
7
|
-
* Represents the parameters to use to connect to an interop server
|
|
8
|
-
*/
|
|
9
|
-
export type ConnectParameters = {
|
|
10
|
-
/**
|
|
11
|
-
* ID for a group of shared applications.
|
|
12
|
-
*/
|
|
13
|
-
platformId: string;
|
|
14
|
-
/**
|
|
15
|
-
* An identifier for the source environment e.g. a hostname, a browser name etc.
|
|
16
|
-
*/
|
|
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;
|
|
28
|
-
/**
|
|
29
|
-
* The maximum number of times to retry connecting to the cloud interop service when the connection is dropped
|
|
30
|
-
* defaults to 30
|
|
31
|
-
*/
|
|
32
|
-
reconnectRetryLimit?: number;
|
|
33
|
-
/**
|
|
34
|
-
* Optional function to call with any logging messages to allow integration with the host application's logging
|
|
35
|
-
*
|
|
36
|
-
* defaults to console.log
|
|
37
|
-
*/
|
|
38
|
-
logger?: CloudInteropLogger;
|
|
39
|
-
/**
|
|
40
|
-
* Determines the type of authentication to use with the service gateway
|
|
41
|
-
* defaults to 'none'
|
|
42
|
-
*
|
|
43
|
-
* 'jwt' - Use JWT authentication, in this case jwtAuthenticationParameters must also be provided
|
|
44
|
-
* 'basic' - Use basic authentication, in this case basicAuthenticationParameters must also be provided
|
|
45
|
-
* 'default' - Authentication will be inherited from the current session
|
|
46
|
-
*/
|
|
47
|
-
authenticationType?: 'jwt' | 'basic' | 'default';
|
|
48
|
-
/**
|
|
49
|
-
* Optional parameters for basic authentication
|
|
50
|
-
*/
|
|
51
|
-
basicAuthenticationParameters?: {
|
|
52
|
-
/**
|
|
53
|
-
* The username to use for basic authentication
|
|
54
|
-
*/
|
|
55
|
-
username: string;
|
|
56
|
-
/**
|
|
57
|
-
* The password to use for basic authentication
|
|
58
|
-
*/
|
|
59
|
-
password: string;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Optional parameters for JWT authentication
|
|
63
|
-
*/
|
|
64
|
-
jwtAuthenticationParameters?: {
|
|
65
|
-
/**
|
|
66
|
-
* When JWT authentication is being used, this will be invoked just whenever a JWT token is required for a request
|
|
67
|
-
*/
|
|
68
|
-
jwtRequestCallback: () => string | object;
|
|
69
|
-
/**
|
|
70
|
-
* The id of the service gateway JWT authentication definition to use
|
|
71
|
-
*
|
|
72
|
-
* Note: Contact Here support to to get your organization's authentication id
|
|
73
|
-
*/
|
|
74
|
-
authenticationId: string;
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
export type CloudInteropSettings = {
|
|
78
|
-
url: string;
|
|
79
|
-
};
|
|
80
|
-
/**
|
|
81
|
-
* Represents a session
|
|
82
|
-
*/
|
|
83
|
-
export type InteropSession = {
|
|
84
|
-
sessionId: string;
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* Represents a source session
|
|
88
|
-
*/
|
|
89
|
-
export type Source = {
|
|
90
|
-
/**
|
|
91
|
-
* Source session id
|
|
92
|
-
*/
|
|
93
|
-
sessionId: string;
|
|
94
|
-
/**
|
|
95
|
-
* source environment id
|
|
96
|
-
*/
|
|
97
|
-
sourceId: string;
|
|
98
|
-
/**
|
|
99
|
-
* source environment display name
|
|
100
|
-
*/
|
|
101
|
-
sourceDisplayName: string;
|
|
102
|
-
};
|
|
103
|
-
/**
|
|
104
|
-
* Represents the details of an intent found during discovery
|
|
105
|
-
*/
|
|
106
|
-
export type IntentDetail = {
|
|
107
|
-
/**
|
|
108
|
-
* The location of the intent implementation
|
|
109
|
-
*/
|
|
110
|
-
source: Source;
|
|
111
|
-
/**
|
|
112
|
-
* The instance id of the intent
|
|
113
|
-
*/
|
|
114
|
-
intentInstanceId: string;
|
|
115
|
-
/**
|
|
116
|
-
* The name of the intent
|
|
117
|
-
*/
|
|
118
|
-
intentName: string;
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Represents a context received from another cloud interop publisher
|
|
122
|
-
*
|
|
123
|
-
* @export
|
|
124
|
-
* @type ContextEvent
|
|
125
|
-
* @property {string} contextGroup - The context group
|
|
126
|
-
* @property {object} context - The context
|
|
127
|
-
* @property {Source} source - The source of the context
|
|
128
|
-
*/
|
|
129
|
-
export type ContextEvent = {
|
|
130
|
-
contextGroup: string;
|
|
131
|
-
context: object;
|
|
132
|
-
source: Source;
|
|
133
|
-
};
|