@openfin/cloud-interop-core-api 0.0.1-alpha.6d7b62b → 0.0.1-alpha.72529c1
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 +59 -0
- package/dist/controllers/event.controller.d.ts +8 -0
- package/dist/controllers/index.d.ts +2 -0
- package/dist/controllers/intent.controller.d.ts +13 -0
- package/dist/errors/api.error.d.ts +7 -0
- package/dist/index.cjs +10 -4
- package/dist/index.d.ts +6 -0
- package/dist/index.mjs +14 -2
- package/dist/interfaces/connect.interface.d.ts +85 -0
- package/dist/interfaces/event.interface.d.ts +15 -0
- package/dist/interfaces/index.d.ts +3 -0
- package/dist/interfaces/intents.interface.d.ts +22 -0
- package/dist/utils.d.ts +25 -0
- package/package.json +8 -18
- package/dist/LICENSE.md +0 -4
- package/dist/README.md +0 -14
- package/dist/bundle.d.ts +0 -796
- package/dist/package.json +0 -18
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
* This acts as a namespace for the interop messages that allows separation of messages between different groups of applications for the same user
|
|
13
|
+
*/
|
|
14
|
+
platformId: string;
|
|
15
|
+
/**
|
|
16
|
+
* An user-friendly identifier for the source session e.g. Windows Desktop, Android Phone, etc.
|
|
17
|
+
*/
|
|
18
|
+
sourceId: string;
|
|
19
|
+
/**
|
|
20
|
+
* The maximum number of times to retry connecting to the cloud interop service when the connection is dropped
|
|
21
|
+
* defaults to 30
|
|
22
|
+
*/
|
|
23
|
+
reconnectRetryLimit?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Specifies how often keep alive messages should be sent to the cloud interop service in seconds
|
|
26
|
+
* defaults to 30
|
|
27
|
+
*/
|
|
28
|
+
keepAliveIntervalSeconds?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Optional function to call with any logging messages to allow integration with the host application's logging
|
|
31
|
+
*
|
|
32
|
+
* defaults to console.log
|
|
33
|
+
*/
|
|
34
|
+
logger?: CloudInteropLogger;
|
|
35
|
+
/**
|
|
36
|
+
* Determines the type of authentication to use with the service gateway
|
|
37
|
+
* defaults to 'none'
|
|
38
|
+
*
|
|
39
|
+
* 'jwt' - Use JWT authentication, in this case jwtAuthenticationParameters must also be provided
|
|
40
|
+
* 'basic' - Use basic authentication, in this case basicAuthenticationParameters must also be provided
|
|
41
|
+
* 'default' - Authentication will be inherited from the current session
|
|
42
|
+
*/
|
|
43
|
+
authenticationType?: 'jwt' | 'basic' | 'default';
|
|
44
|
+
/**
|
|
45
|
+
* Optional parameters for basic authentication
|
|
46
|
+
*/
|
|
47
|
+
basicAuthenticationParameters?: {
|
|
48
|
+
/**
|
|
49
|
+
* The username to use for basic authentication
|
|
50
|
+
*/
|
|
51
|
+
username: string;
|
|
52
|
+
/**
|
|
53
|
+
* The password to use for basic authentication
|
|
54
|
+
*/
|
|
55
|
+
password: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Optional parameters for JWT authentication
|
|
59
|
+
*/
|
|
60
|
+
jwtAuthenticationParameters?: {
|
|
61
|
+
/**
|
|
62
|
+
* When JWT authentication is being used, this will be invoked just whenever a JWT token is required for a request
|
|
63
|
+
*/
|
|
64
|
+
jwtRequestCallback: () => string | object;
|
|
65
|
+
/**
|
|
66
|
+
* The id of the service gateway JWT authentication definition to use
|
|
67
|
+
*
|
|
68
|
+
* Note: Contact Here support to to get your organization's authentication id
|
|
69
|
+
*/
|
|
70
|
+
authenticationId: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
export type CloudInteropSettings = {
|
|
74
|
+
url: string;
|
|
75
|
+
};
|
|
76
|
+
export type CreateSessionResponse = {
|
|
77
|
+
sessionId: string;
|
|
78
|
+
sessionRootTopic: string;
|
|
79
|
+
url: string;
|
|
80
|
+
token: string;
|
|
81
|
+
orgId: string;
|
|
82
|
+
sub: string;
|
|
83
|
+
platformId: string;
|
|
84
|
+
sourceId: string;
|
|
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,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
|
+
};
|
package/dist/utils.d.ts
ADDED
|
@@ -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.
|
|
3
|
+
"version": "0.0.1-alpha.72529c1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"files": [
|
|
@@ -8,20 +8,18 @@
|
|
|
8
8
|
],
|
|
9
9
|
"main": "./dist/index.cjs",
|
|
10
10
|
"browser": "./dist/index.mjs",
|
|
11
|
-
"types": "./dist/
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
12
|
"scripts": {
|
|
13
|
-
"build": "rimraf dist &&
|
|
14
|
-
"build:watch": "
|
|
13
|
+
"build": "rimraf dist && rollup -c",
|
|
14
|
+
"build:watch": "rollup -c --watch",
|
|
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"
|
|
19
|
-
"pack": "pushd dist && npm pack && popd"
|
|
18
|
+
"lint:fix": "eslint . --fix --max-warnings 0"
|
|
20
19
|
},
|
|
21
20
|
"author": "",
|
|
22
21
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
23
22
|
"devDependencies": {
|
|
24
|
-
"@microsoft/api-extractor": "^7.49.1",
|
|
25
23
|
"@rollup/plugin-commonjs": "^28.0.1",
|
|
26
24
|
"@rollup/plugin-inject": "^5.0.5",
|
|
27
25
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
@@ -30,7 +28,6 @@
|
|
|
30
28
|
"@types/node": "^22.7.7",
|
|
31
29
|
"@typescript-eslint/eslint-plugin": "^7.5.0",
|
|
32
30
|
"@typescript-eslint/parser": "^7.15.0",
|
|
33
|
-
"dotenv-defaults": "^5.0.2",
|
|
34
31
|
"eslint": "^8.57.0",
|
|
35
32
|
"eslint-config-prettier": "^9.1.0",
|
|
36
33
|
"eslint-plugin-check-file": "^2.8.0",
|
|
@@ -39,20 +36,14 @@
|
|
|
39
36
|
"eslint-plugin-unicorn": "^55.0.0",
|
|
40
37
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
41
38
|
"jest": "^29.7.0",
|
|
42
|
-
"nodemon": "^3.1.9",
|
|
43
39
|
"prettier": "^3.3.3",
|
|
44
|
-
"rollup": "^4.
|
|
40
|
+
"rollup": "^4.9.6",
|
|
45
41
|
"ts-jest": "^29.2.5",
|
|
46
|
-
"
|
|
47
|
-
"typescript": "^5.7.3"
|
|
48
|
-
},
|
|
49
|
-
"optionalDependencies": {
|
|
50
|
-
"@rollup/rollup-linux-x64-gnu": "*"
|
|
42
|
+
"typescript": "^5.6.3"
|
|
51
43
|
},
|
|
52
44
|
"dependencies": {
|
|
53
45
|
"@openfin/shared-utils": "file:../shared-utils",
|
|
54
|
-
"mqtt": "^5.3.1"
|
|
55
|
-
"zod": "^3.24.1"
|
|
46
|
+
"mqtt": "^5.3.1"
|
|
56
47
|
},
|
|
57
48
|
"eslintConfig": {
|
|
58
49
|
"env": {
|
|
@@ -206,7 +197,6 @@
|
|
|
206
197
|
"node_modules",
|
|
207
198
|
"out",
|
|
208
199
|
"build",
|
|
209
|
-
"scripts",
|
|
210
200
|
"dist",
|
|
211
201
|
"coverage",
|
|
212
202
|
"tests",
|
package/dist/LICENSE.md
DELETED
package/dist/README.md
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# @openfin/cloud-interop-core-api
|
|
2
|
-
|
|
3
|
-
This package contains the core interop library that handles all interactions with the Here™ Cloud Interop Service.
|
|
4
|
-
|
|
5
|
-
It is callable via browser or node applications.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Authentication
|
|
9
|
-
|
|
10
|
-
The library supports authentication with the Here™ Cloud Interop Service using the following methods:
|
|
11
|
-
- Basic Authentication
|
|
12
|
-
- JWT Token Authentication
|
|
13
|
-
- Default Authentication i.e. Interactive session based authentication using cookies
|
|
14
|
-
|