@openfin/cloud-interop-core-api 0.0.1-alpha.384d88e → 0.0.1-alpha.3cbe14e
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/{src/api.d.ts → api.d.ts} +1 -26
- package/dist/index.cjs +101 -275
- package/dist/index.mjs +3856 -275
- package/dist/{src/interfaces.d.ts → interfaces.d.ts} +17 -0
- package/package.json +5 -5
- package/dist/tests/connect.test.d.ts +0 -1
- package/dist/tests/context.test.d.ts +0 -1
- package/dist/tests/mocks/fetch.mock.d.ts +0 -128
- /package/dist/{src/errors → errors}/api.error.d.ts +0 -0
- /package/dist/{src/index.d.ts → index.d.ts} +0 -0
|
@@ -100,6 +100,23 @@ export type Source = {
|
|
|
100
100
|
*/
|
|
101
101
|
sourceDisplayName: string;
|
|
102
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
|
+
};
|
|
103
120
|
/**
|
|
104
121
|
* Represents a context received from another cloud interop publisher
|
|
105
122
|
*
|
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.3cbe14e",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"files": [
|
|
@@ -8,9 +8,9 @@
|
|
|
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": "
|
|
13
|
+
"build": "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": "^
|
|
28
|
+
"@types/node": "^20.10.0",
|
|
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
|
-
"
|
|
45
|
+
"axios": "^1.6.2",
|
|
46
46
|
"mqtt": "^5.3.1"
|
|
47
47
|
},
|
|
48
48
|
"eslintConfig": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
export declare const DEFAULT_HEADERS: {
|
|
2
|
-
'Content-Type': string;
|
|
3
|
-
};
|
|
4
|
-
export declare const DEFAULT_AUTH_HEADER: {
|
|
5
|
-
Authorization: string;
|
|
6
|
-
};
|
|
7
|
-
type Method = 'GET' | 'OPTIONS' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
8
|
-
export declare enum Status {
|
|
9
|
-
OK = 200,
|
|
10
|
-
Created = 201,
|
|
11
|
-
Accepted = 202,
|
|
12
|
-
NonAuthoritativeInformation = 203,
|
|
13
|
-
NoContent = 204,
|
|
14
|
-
ResetContent = 205,
|
|
15
|
-
PartialContent = 206,
|
|
16
|
-
MultipleChoices = 300,
|
|
17
|
-
MovedPermanently = 301,
|
|
18
|
-
Found = 302,
|
|
19
|
-
SeeOther = 303,
|
|
20
|
-
NotModified = 304,
|
|
21
|
-
UseProxy = 305,
|
|
22
|
-
Unused = 306,
|
|
23
|
-
TemporaryRedirect = 307,
|
|
24
|
-
PermanentRedirect = 308,
|
|
25
|
-
BadRequest = 400,
|
|
26
|
-
Unauthorized = 401,
|
|
27
|
-
PaymentRequired = 402,
|
|
28
|
-
Forbidden = 403,
|
|
29
|
-
NotFound = 404,
|
|
30
|
-
MethodNotAllowed = 405,
|
|
31
|
-
NotAcceptable = 406,
|
|
32
|
-
ProxyAuthenticationRequired = 407,
|
|
33
|
-
RequestTimeout = 408,
|
|
34
|
-
Conflict = 409,
|
|
35
|
-
Gone = 410,
|
|
36
|
-
LengthRequired = 411,
|
|
37
|
-
PreconditionFailed = 412,
|
|
38
|
-
RequestEntityTooLarge = 413,
|
|
39
|
-
RequestURITooLong = 414,
|
|
40
|
-
UnsupportedMediaType = 415,
|
|
41
|
-
RequestedRangeNotSatisfiable = 416,
|
|
42
|
-
ExpectationFailed = 417,
|
|
43
|
-
Imateapot = 418,
|
|
44
|
-
MisdirectedRequest = 421,
|
|
45
|
-
UnprocessableEntity = 422,
|
|
46
|
-
Locked = 423,
|
|
47
|
-
TooEarly = 425,
|
|
48
|
-
UpgradeRequired = 426,
|
|
49
|
-
PreconditionRequired = 428,
|
|
50
|
-
TooManyRequests = 429,
|
|
51
|
-
RequestHeaderFieldsTooLarge = 431,
|
|
52
|
-
UnavailableForLegalReasons = 451,
|
|
53
|
-
InternalServerError = 500,
|
|
54
|
-
NotImplemented = 501,
|
|
55
|
-
BadGateway = 502,
|
|
56
|
-
ServiceUnavailable = 503,
|
|
57
|
-
GatewayTimeout = 504,
|
|
58
|
-
HTTPVersionNotSupported = 505,
|
|
59
|
-
VariantAlsoNegotiates = 506,
|
|
60
|
-
InsufficientStorage = 507,
|
|
61
|
-
NetworkAuthenticationRequired = 511,
|
|
62
|
-
Webserverisreturninganunknownerror = 520,
|
|
63
|
-
Connectiontimedout = 522,
|
|
64
|
-
Atimeoutoccurred = 524
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Stub API request, response in test cases.
|
|
68
|
-
* - should be initialized and destroyed within the context of a specific case.
|
|
69
|
-
* - highly customizable
|
|
70
|
-
*
|
|
71
|
-
* <pre>
|
|
72
|
-
* describe("Fetch API", () => {
|
|
73
|
-
* let fetchResolver!: FetchResolver;
|
|
74
|
-
* beforeEach(() => {
|
|
75
|
-
* fetchResolver = new FetchResolver();
|
|
76
|
-
* });
|
|
77
|
-
*
|
|
78
|
-
* it("should load api", async () => {
|
|
79
|
-
* // stub
|
|
80
|
-
* fetchResolver.stub( "http://localhost:8080/endpoint", "post", { id: 100 }, { created: true }, 200);
|
|
81
|
-
* // fetch
|
|
82
|
-
* fetch("http://localhost:8080/endpoint",
|
|
83
|
-
* { method: "post", body: JSON.stringify({ id: 100 })}
|
|
84
|
-
* ).then((response) => {
|
|
85
|
-
* if (response.ok) {
|
|
86
|
-
* response.text().then((text) => {
|
|
87
|
-
* console.log(text); // { created: true }
|
|
88
|
-
* expect(text).toBeEqual({ created: true });
|
|
89
|
-
* });
|
|
90
|
-
* }
|
|
91
|
-
* });
|
|
92
|
-
* });
|
|
93
|
-
*
|
|
94
|
-
* afterEach(() => {
|
|
95
|
-
* fetchResolver.clear();
|
|
96
|
-
* });
|
|
97
|
-
* });
|
|
98
|
-
* </pre>
|
|
99
|
-
*
|
|
100
|
-
* Even though jest executes tests in parallel jest instance,
|
|
101
|
-
* We can't go wrong if stubs are cleaned after its use
|
|
102
|
-
*/
|
|
103
|
-
export declare class FetchResolver {
|
|
104
|
-
readonly interopUrl: string;
|
|
105
|
-
readonly sourceId: string;
|
|
106
|
-
readonly platformId: string;
|
|
107
|
-
private mocks;
|
|
108
|
-
fetchSpy: jest.SpyInstance<Promise<Response>, [input: string | URL | Request, init?: RequestInit | undefined], any>;
|
|
109
|
-
constructor(interopUrl?: string, sourceId?: string, platformId?: string);
|
|
110
|
-
stubConnect(headers?: Record<string, string>): void;
|
|
111
|
-
stubDelete(status?: number): void;
|
|
112
|
-
stubFetchWithSourceAndPlatform(url: string, method: Method, headers: any, payload: any, response: any, status: number): void;
|
|
113
|
-
stubFetch(url: string, method: Method, headers: any, payload: any, response: any, status: number): void;
|
|
114
|
-
/**
|
|
115
|
-
*
|
|
116
|
-
* @param uri
|
|
117
|
-
* @param method
|
|
118
|
-
* @param headers pass null to delete headers from requestInit
|
|
119
|
-
* @param payload pass null to delete body from requestInit
|
|
120
|
-
* @param response
|
|
121
|
-
* @param status
|
|
122
|
-
*/
|
|
123
|
-
stub(uri: string, method: Method, headers: any, payload: any, response: any, status: Status): void;
|
|
124
|
-
private prettyPrint;
|
|
125
|
-
clear(): void;
|
|
126
|
-
private init;
|
|
127
|
-
}
|
|
128
|
-
export {};
|
|
File without changes
|
|
File without changes
|