@kronos-integration/endpoint 9.4.46 → 9.5.0
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/README.md +30 -8
- package/package.json +15 -7
- package/src/endpoint.mjs +7 -4
- package/src/multi-connection-endpoint.mjs +4 -4
- package/src/multi-send-endpoint.mjs +1 -0
- package/src/receive-endpoint-self-connected-default.mjs +6 -0
- package/src/receive-endpoint.mjs +1 -0
- package/src/send-endpoint-default.mjs +1 -1
- package/src/send-endpoint.mjs +1 -1
- package/src/send-receive-endpoint.mjs +5 -0
- package/types/dummy-receive-endpoint.d.mts +11 -0
- package/types/endpoint.d.mts +155 -0
- package/types/module.d.mts +11 -0
- package/types/multi-connection-endpoint.d.mts +15 -0
- package/types/multi-send-endpoint.d.mts +15 -0
- package/types/receivable-endpoint.d.mts +21 -0
- package/types/receive-endpoint-default.d.mts +6 -0
- package/types/receive-endpoint-self-connected-default.d.mts +16 -0
- package/types/receive-endpoint.d.mts +13 -0
- package/types/send-endpoint-default.d.mts +6 -0
- package/types/send-endpoint.d.mts +20 -0
- package/types/send-receive-endpoint.d.mts +3 -0
package/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
[](https://www.npmjs.com/package/@kronos-integration/endpoint)
|
|
2
2
|
[](https://opensource.org/licenses/BSD-3-Clause)
|
|
3
|
+
[](https://typescriptlang.org)
|
|
3
4
|
[](https://bundlejs.com/?q=@kronos-integration/endpoint)
|
|
4
5
|
[](https://npmjs.org/package/@kronos-integration/endpoint)
|
|
5
6
|
[](https://github.com/Kronos-Integration/endpoint/issues)
|
|
@@ -51,6 +52,7 @@ Named communication (end)-points inside of kronos
|
|
|
51
52
|
* [Parameters](#parameters-5)
|
|
52
53
|
* [openConnections](#openconnections)
|
|
53
54
|
* [closeConnections](#closeconnections)
|
|
55
|
+
* [connections](#connections)
|
|
54
56
|
* [getConnectionState](#getconnectionstate)
|
|
55
57
|
* [Parameters](#parameters-6)
|
|
56
58
|
* [setConnectionState](#setconnectionstate)
|
|
@@ -67,7 +69,8 @@ Named communication (end)-points inside of kronos
|
|
|
67
69
|
* [Parameters](#parameters-12)
|
|
68
70
|
* [isConnected](#isconnected-1)
|
|
69
71
|
* [Parameters](#parameters-13)
|
|
70
|
-
* [connections](#connections)
|
|
72
|
+
* [connections](#connections-1)
|
|
73
|
+
* [connections](#connections-2)
|
|
71
74
|
* [MultiSendEndpoint](#multisendendpoint)
|
|
72
75
|
* [Parameters](#parameters-14)
|
|
73
76
|
* [isOut](#isout-1)
|
|
@@ -80,13 +83,15 @@ Named communication (end)-points inside of kronos
|
|
|
80
83
|
* [ReceiveEndpointDefault](#receiveendpointdefault)
|
|
81
84
|
* [isDefault](#isdefault-1)
|
|
82
85
|
* [ReceiveEndpointSelfConnectedDefault](#receiveendpointselfconnecteddefault)
|
|
86
|
+
* [removeConnection](#removeconnection)
|
|
87
|
+
* [Parameters](#parameters-17)
|
|
83
88
|
* [ReceiveEndpoint](#receiveendpoint)
|
|
84
|
-
* [Parameters](#parameters-
|
|
89
|
+
* [Parameters](#parameters-18)
|
|
85
90
|
* [isIn](#isin-3)
|
|
86
91
|
* [SendEndpointDefault](#sendendpointdefault)
|
|
87
92
|
* [isDefault](#isdefault-2)
|
|
88
93
|
* [SendEndpoint](#sendendpoint)
|
|
89
|
-
* [Parameters](#parameters-
|
|
94
|
+
* [Parameters](#parameters-19)
|
|
90
95
|
* [isOut](#isout-2)
|
|
91
96
|
|
|
92
97
|
## DummyReceiveEndpoint
|
|
@@ -175,7 +180,7 @@ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
|
175
180
|
|
|
176
181
|
Deliver data flow direction.
|
|
177
182
|
|
|
178
|
-
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** delivers data flow direction 'in', 'out', 'inout' or undefined
|
|
183
|
+
Returns **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** delivers data flow direction 'in', 'out', 'inout' or undefined
|
|
179
184
|
|
|
180
185
|
### jsonAttributes
|
|
181
186
|
|
|
@@ -217,7 +222,7 @@ Actually start with the communication.
|
|
|
217
222
|
#### Parameters
|
|
218
223
|
|
|
219
224
|
* `other` **[Endpoint](#endpoint)** 
|
|
220
|
-
* `backpointer` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)
|
|
225
|
+
* `backpointer` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** true if this is the call from back call from the other side
|
|
221
226
|
|
|
222
227
|
### closeConnection
|
|
223
228
|
|
|
@@ -226,7 +231,7 @@ Actually stop the communication.
|
|
|
226
231
|
#### Parameters
|
|
227
232
|
|
|
228
233
|
* `other` **[Endpoint](#endpoint)** 
|
|
229
|
-
* `backpointer` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)
|
|
234
|
+
* `backpointer` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** true if this is the call from back call from the other side
|
|
230
235
|
|
|
231
236
|
### openConnections
|
|
232
237
|
|
|
@@ -236,6 +241,10 @@ Opens all connections.
|
|
|
236
241
|
|
|
237
242
|
Closes all connections.
|
|
238
243
|
|
|
244
|
+
### connections
|
|
245
|
+
|
|
246
|
+
Returns **Iterable\<any>** 
|
|
247
|
+
|
|
239
248
|
### getConnectionState
|
|
240
249
|
|
|
241
250
|
Deliver state for a given connection.
|
|
@@ -295,7 +304,7 @@ Deliver connection state.
|
|
|
295
304
|
|
|
296
305
|
#### Parameters
|
|
297
306
|
|
|
298
|
-
* `other` **
|
|
307
|
+
* `other` **[Endpoint](#endpoint)** 
|
|
299
308
|
|
|
300
309
|
Returns **any** our state for the connection to other
|
|
301
310
|
|
|
@@ -305,7 +314,7 @@ Set connection state.
|
|
|
305
314
|
|
|
306
315
|
#### Parameters
|
|
307
316
|
|
|
308
|
-
* `other` **
|
|
317
|
+
* `other` **[Endpoint](#endpoint)** 
|
|
309
318
|
* `state` **any** for the connection to other
|
|
310
319
|
|
|
311
320
|
### isConnected
|
|
@@ -322,6 +331,10 @@ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
|
322
331
|
|
|
323
332
|
All connections
|
|
324
333
|
|
|
334
|
+
## connections
|
|
335
|
+
|
|
336
|
+
Type: [Map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map)<[Endpoint](#endpoint), any>
|
|
337
|
+
|
|
325
338
|
## MultiSendEndpoint
|
|
326
339
|
|
|
327
340
|
**Extends MultiConnectionEndpoint**
|
|
@@ -394,6 +407,15 @@ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
|
394
407
|
|
|
395
408
|
Receiving endpoint wich can also send to itself.
|
|
396
409
|
|
|
410
|
+
### removeConnection
|
|
411
|
+
|
|
412
|
+
Actually stop the communication.
|
|
413
|
+
|
|
414
|
+
#### Parameters
|
|
415
|
+
|
|
416
|
+
* `other` **[Endpoint](#endpoint)** 
|
|
417
|
+
* `backpointer` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** true if this is the call form back call from the other side
|
|
418
|
+
|
|
397
419
|
## ReceiveEndpoint
|
|
398
420
|
|
|
399
421
|
**Extends MultiConnectionEndpoint**
|
package/package.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kronos-integration/endpoint",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.5.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
7
7
|
},
|
|
8
|
+
"types": "./types/module.d.mts",
|
|
8
9
|
"exports": {
|
|
9
|
-
".":
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./types/module.d.mts",
|
|
12
|
+
"default": "./src/module.mjs"
|
|
13
|
+
}
|
|
10
14
|
},
|
|
11
15
|
"description": "named communication (end)-points inside of kronos",
|
|
12
16
|
"keywords": [
|
|
@@ -24,21 +28,24 @@
|
|
|
24
28
|
],
|
|
25
29
|
"license": "BSD-2-Clause",
|
|
26
30
|
"scripts": {
|
|
31
|
+
"prepare": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs",
|
|
27
32
|
"test": "npm run test:ava",
|
|
28
33
|
"test:ava": "ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
|
|
29
34
|
"cover": "c8 -x 'tests/**/*' --temp-directory build/tmp ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs && c8 report -r lcov -o build/coverage --temp-directory build/tmp",
|
|
30
35
|
"docs": "documentation readme --section=API ./src/**/*.mjs",
|
|
31
|
-
"lint": "npm run lint:docs",
|
|
32
|
-
"lint:docs": "documentation lint ./src/**/*.mjs"
|
|
36
|
+
"lint": "npm run lint:docs && npm run lint:tsc",
|
|
37
|
+
"lint:docs": "documentation lint ./src/**/*.mjs",
|
|
38
|
+
"lint:tsc": "tsc --allowJs --checkJs --noEmit -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
|
|
33
39
|
},
|
|
34
40
|
"dependencies": {
|
|
35
|
-
"@kronos-integration/interceptor": "^10.2.
|
|
41
|
+
"@kronos-integration/interceptor": "^10.2.38"
|
|
36
42
|
},
|
|
37
43
|
"devDependencies": {
|
|
38
44
|
"ava": "^6.1.1",
|
|
39
45
|
"c8": "^9.1.0",
|
|
40
46
|
"documentation": "^14.0.3",
|
|
41
|
-
"semantic-release": "^23.0.2"
|
|
47
|
+
"semantic-release": "^23.0.2",
|
|
48
|
+
"typescript": "^5.3.3"
|
|
42
49
|
},
|
|
43
50
|
"engines": {
|
|
44
51
|
"node": ">=20.11.0"
|
|
@@ -54,7 +61,8 @@
|
|
|
54
61
|
"template": {
|
|
55
62
|
"inheritFrom": [
|
|
56
63
|
"arlac77/template-arlac77-github",
|
|
57
|
-
"arlac77/template-kronos-component"
|
|
64
|
+
"arlac77/template-kronos-component",
|
|
65
|
+
"arlac77/template-typescript"
|
|
58
66
|
]
|
|
59
67
|
}
|
|
60
68
|
}
|
package/src/endpoint.mjs
CHANGED
|
@@ -129,7 +129,7 @@ export class Endpoint {
|
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
131
|
* Deliver data flow direction.
|
|
132
|
-
* @return {string} delivers data flow direction 'in', 'out', 'inout' or undefined
|
|
132
|
+
* @return {string|undefined} delivers data flow direction 'in', 'out', 'inout' or undefined
|
|
133
133
|
*/
|
|
134
134
|
get direction() {
|
|
135
135
|
if (this.isIn) {
|
|
@@ -251,7 +251,7 @@ export class Endpoint {
|
|
|
251
251
|
/**
|
|
252
252
|
* Actually start with the communication.
|
|
253
253
|
* @param {Endpoint} other
|
|
254
|
-
* @param {boolean} backpointer true if this is the call
|
|
254
|
+
* @param {boolean?} backpointer true if this is the call from back call from the other side
|
|
255
255
|
*/
|
|
256
256
|
openConnection(other, backpointer) {
|
|
257
257
|
if (other !== undefined) {
|
|
@@ -276,7 +276,7 @@ export class Endpoint {
|
|
|
276
276
|
/**
|
|
277
277
|
* Actually stop the communication.
|
|
278
278
|
* @param {Endpoint} other
|
|
279
|
-
* @param {boolean} backpointer true if this is the call
|
|
279
|
+
* @param {boolean?} backpointer true if this is the call from back call from the other side
|
|
280
280
|
*/
|
|
281
281
|
closeConnection(other, backpointer) {
|
|
282
282
|
if (other !== undefined) {
|
|
@@ -310,6 +310,9 @@ export class Endpoint {
|
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
+
/**
|
|
314
|
+
* @return {Iterable<any>}
|
|
315
|
+
*/
|
|
313
316
|
*connections() {}
|
|
314
317
|
|
|
315
318
|
addConnection() {}
|
|
@@ -330,7 +333,7 @@ export class Endpoint {
|
|
|
330
333
|
*/
|
|
331
334
|
setConnectionState(other, state) {}
|
|
332
335
|
|
|
333
|
-
didConnect() {}
|
|
336
|
+
didConnect(a,b) {}
|
|
334
337
|
|
|
335
338
|
get receivingInterceptors() {
|
|
336
339
|
return [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isEndpoint } from "./endpoint.mjs";
|
|
1
|
+
import { isEndpoint, Endpoint } from "./endpoint.mjs";
|
|
2
2
|
import { ReceivableEndpoint } from "./receivable-endpoint.mjs";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -7,7 +7,7 @@ import { ReceivableEndpoint } from "./receivable-endpoint.mjs";
|
|
|
7
7
|
*/
|
|
8
8
|
export class MultiConnectionEndpoint extends ReceivableEndpoint {
|
|
9
9
|
|
|
10
|
-
#connections = new Map();
|
|
10
|
+
/** @type {Map<Endpoint,any>} */ #connections = new Map();
|
|
11
11
|
|
|
12
12
|
constructor(name, owner, options) {
|
|
13
13
|
super(name, owner, options);
|
|
@@ -19,7 +19,7 @@ export class MultiConnectionEndpoint extends ReceivableEndpoint {
|
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Deliver connection state.
|
|
22
|
-
* @param {
|
|
22
|
+
* @param {Endpoint} other
|
|
23
23
|
* @return {any} our state for the connection to other
|
|
24
24
|
*/
|
|
25
25
|
getConnectionState(other) {
|
|
@@ -28,7 +28,7 @@ export class MultiConnectionEndpoint extends ReceivableEndpoint {
|
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Set connection state.
|
|
31
|
-
* @param {
|
|
31
|
+
* @param {Endpoint} other
|
|
32
32
|
* @param {any} state for the connection to other
|
|
33
33
|
*/
|
|
34
34
|
setConnectionState(other, state) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReceiveEndpointDefault } from "./receive-endpoint-default.mjs";
|
|
2
|
+
import { Endpoint } from "./endpoint.mjs";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Receiving endpoint wich can also send to itself.
|
|
@@ -20,6 +21,11 @@ export class ReceiveEndpointSelfConnectedDefault extends ReceiveEndpointDefault
|
|
|
20
21
|
return super.addConnection(other, backpointer);
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Actually stop the communication.
|
|
26
|
+
* @param {Endpoint} other
|
|
27
|
+
* @param {boolean?} backpointer true if this is the call form back call from the other side
|
|
28
|
+
*/
|
|
23
29
|
removeConnection(other, backpointer) {
|
|
24
30
|
if (other === this) {
|
|
25
31
|
return;
|
package/src/receive-endpoint.mjs
CHANGED
package/src/send-endpoint.mjs
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dummy endpoints are used during construction of the endpoint mesh.
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
export class DummyReceiveEndpoint extends Endpoint {
|
|
6
|
+
/**
|
|
7
|
+
* dummy does nothing by intention
|
|
8
|
+
*/
|
|
9
|
+
receive(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
import { Endpoint } from "./endpoint.mjs";
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check for Endpoint.
|
|
3
|
+
* @param {any} object to be checked
|
|
4
|
+
* @return {boolean} true if object is an Endpoint
|
|
5
|
+
*/
|
|
6
|
+
export function isEndpoint(object: any): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Instanciate interceptors from its definitions.
|
|
9
|
+
* @param {Interceptor[]|Class[]|String[]} interceptors
|
|
10
|
+
* @param {Object} owner
|
|
11
|
+
* @return {Interceptor[]}
|
|
12
|
+
*/
|
|
13
|
+
export function instanciateInterceptors(interceptors: Interceptor[] | Class[] | string[], owner: any): Interceptor[];
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {Object} ConnectionState
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Connection endpoint.
|
|
19
|
+
* @param {string} name endpoint name
|
|
20
|
+
* @param {Object} owner of the endpoint (service)
|
|
21
|
+
* @param {Object} options
|
|
22
|
+
* @param {Function} [options.didConnect] called after receiver is present
|
|
23
|
+
* @param {Interceptor|Object[]} [options.interceptors] interceptors
|
|
24
|
+
*/
|
|
25
|
+
export class Endpoint {
|
|
26
|
+
constructor(name: any, owner: any, options: any);
|
|
27
|
+
name: any;
|
|
28
|
+
owner: any;
|
|
29
|
+
didConnect(a: any, b: any): void;
|
|
30
|
+
interceptors: Interceptor[];
|
|
31
|
+
/**
|
|
32
|
+
* Name as presented for humans.
|
|
33
|
+
* @return {string}
|
|
34
|
+
*/
|
|
35
|
+
get displayName(): string;
|
|
36
|
+
/**
|
|
37
|
+
* Indicate whatever we are a default endpoint.
|
|
38
|
+
* Default means buildin.
|
|
39
|
+
* @return {boolean} false
|
|
40
|
+
*/
|
|
41
|
+
get isDefault(): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Indicate whatever we are a dummy endpoint.
|
|
44
|
+
* Dummy endpoints are used duiring construction of the endpoint mesh.
|
|
45
|
+
* @return {boolean} false
|
|
46
|
+
*/
|
|
47
|
+
get isDummy(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Mapping of properties used in toString.
|
|
50
|
+
* @return {Object}
|
|
51
|
+
*/
|
|
52
|
+
get toStringAttributes(): any;
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* @param {Object} options
|
|
56
|
+
*/
|
|
57
|
+
connectionNamesWithStates(options?: any): any[];
|
|
58
|
+
toString(): any;
|
|
59
|
+
get identifier(): any;
|
|
60
|
+
/**
|
|
61
|
+
* @return {boolean} false
|
|
62
|
+
*/
|
|
63
|
+
get isIn(): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* @return {boolean} false
|
|
66
|
+
*/
|
|
67
|
+
get isOut(): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Deliver data flow direction.
|
|
70
|
+
* @return {string|undefined} delivers data flow direction 'in', 'out', 'inout' or undefined
|
|
71
|
+
*/
|
|
72
|
+
get direction(): string;
|
|
73
|
+
toJSON(): {
|
|
74
|
+
in: boolean;
|
|
75
|
+
out: boolean;
|
|
76
|
+
open: boolean;
|
|
77
|
+
dummy: boolean;
|
|
78
|
+
connected: any;
|
|
79
|
+
interceptors: any[];
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Additional attributes to present in json output.
|
|
83
|
+
*/
|
|
84
|
+
get jsonAttributes(): any[];
|
|
85
|
+
toJSONWithOptions(options: any): {
|
|
86
|
+
in: boolean;
|
|
87
|
+
out: boolean;
|
|
88
|
+
open: boolean;
|
|
89
|
+
dummy: boolean;
|
|
90
|
+
connected: any;
|
|
91
|
+
interceptors: any[];
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* @return {boolean} true if there is at least one interceptor assigned
|
|
95
|
+
*/
|
|
96
|
+
get hasInterceptors(): boolean;
|
|
97
|
+
get isOpen(): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Can we form a connection to the other side.
|
|
100
|
+
* in to out and out to in.
|
|
101
|
+
* @param {Endpoint} other
|
|
102
|
+
* @return {boolean} true if we can be connected to the other endpoint
|
|
103
|
+
*/
|
|
104
|
+
connectable(other: Endpoint): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* @return {boolean} true if there is at least one connection
|
|
107
|
+
*/
|
|
108
|
+
get hasConnections(): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Are we connected to a endpoint.
|
|
111
|
+
* @param {Endpoint} other to check for the connection
|
|
112
|
+
* @return {boolean} true if there is a connection to the other endpoint
|
|
113
|
+
*/
|
|
114
|
+
isConnected(other: Endpoint): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Actually start with the communication.
|
|
117
|
+
* @param {Endpoint} other
|
|
118
|
+
* @param {boolean?} backpointer true if this is the call from back call from the other side
|
|
119
|
+
*/
|
|
120
|
+
openConnection(other: Endpoint, backpointer: boolean | null): void;
|
|
121
|
+
/**
|
|
122
|
+
* Actually stop the communication.
|
|
123
|
+
* @param {Endpoint} other
|
|
124
|
+
* @param {boolean?} backpointer true if this is the call from back call from the other side
|
|
125
|
+
*/
|
|
126
|
+
closeConnection(other: Endpoint, backpointer: boolean | null): void;
|
|
127
|
+
/**
|
|
128
|
+
* Opens all connections.
|
|
129
|
+
*/
|
|
130
|
+
openConnections(): void;
|
|
131
|
+
/**
|
|
132
|
+
* Closes all connections.
|
|
133
|
+
*/
|
|
134
|
+
closeConnections(): void;
|
|
135
|
+
/**
|
|
136
|
+
* @return {Iterable<any>}
|
|
137
|
+
*/
|
|
138
|
+
connections(): Iterable<any>;
|
|
139
|
+
addConnection(): void;
|
|
140
|
+
removeConnection(): void;
|
|
141
|
+
/**
|
|
142
|
+
* Deliver state for a given connection.
|
|
143
|
+
* @param {Endpoint} other
|
|
144
|
+
* @return {ConnectionState}
|
|
145
|
+
*/
|
|
146
|
+
getConnectionState(other: Endpoint): ConnectionState;
|
|
147
|
+
/**
|
|
148
|
+
* Set state for a given connection.
|
|
149
|
+
* @param {Endpoint} other
|
|
150
|
+
* @param {ConnectionState} state
|
|
151
|
+
*/
|
|
152
|
+
setConnectionState(other: Endpoint, state: ConnectionState): void;
|
|
153
|
+
get receivingInterceptors(): any[];
|
|
154
|
+
}
|
|
155
|
+
export type ConnectionState = any;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./endpoint.mjs";
|
|
2
|
+
export * from "./receivable-endpoint.mjs";
|
|
3
|
+
export * from "./multi-connection-endpoint.mjs";
|
|
4
|
+
export * from "./send-endpoint.mjs";
|
|
5
|
+
export * from "./receive-endpoint.mjs";
|
|
6
|
+
export * from "./send-receive-endpoint.mjs";
|
|
7
|
+
export * from "./dummy-receive-endpoint.mjs";
|
|
8
|
+
export * from "./send-endpoint-default.mjs";
|
|
9
|
+
export * from "./multi-send-endpoint.mjs";
|
|
10
|
+
export * from "./receive-endpoint-default.mjs";
|
|
11
|
+
export * from "./receive-endpoint-self-connected-default.mjs";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multiple connection endpoint.
|
|
3
|
+
* Can hold several connections.
|
|
4
|
+
*/
|
|
5
|
+
export class MultiConnectionEndpoint extends ReceivableEndpoint {
|
|
6
|
+
addConnection(other: any, backpointer: any): void;
|
|
7
|
+
removeConnection(other: any, backpointer: any): void;
|
|
8
|
+
/**
|
|
9
|
+
* All connections
|
|
10
|
+
*/
|
|
11
|
+
connections(): Generator<Endpoint, void, undefined>;
|
|
12
|
+
#private;
|
|
13
|
+
}
|
|
14
|
+
import { ReceivableEndpoint } from "./receivable-endpoint.mjs";
|
|
15
|
+
import { Endpoint } from "./endpoint.mjs";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multiple Sending Endpoint.
|
|
3
|
+
* Can hold several connections.
|
|
4
|
+
* Back connections to any further endpoints will not be established
|
|
5
|
+
* @param {string} name endpoint name
|
|
6
|
+
* @param {Object} owner of the endpoint (service)
|
|
7
|
+
* @param {Object} options
|
|
8
|
+
* @param {Endpoint} [options.connected] where te requests are delivered to
|
|
9
|
+
* @param {Function} [options.didConnect] called after receiver is present
|
|
10
|
+
*/
|
|
11
|
+
export class MultiSendEndpoint extends MultiConnectionEndpoint {
|
|
12
|
+
send(...args: any[]): void;
|
|
13
|
+
sendAndReceive(...args: any[]): AsyncGenerator<any, void, unknown>;
|
|
14
|
+
}
|
|
15
|
+
import { MultiConnectionEndpoint } from "./multi-connection-endpoint.mjs";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} name endpoint name
|
|
3
|
+
* @param {Object} owner of the endpoint (service)
|
|
4
|
+
* @param {Object} options
|
|
5
|
+
* @param {Function} [options.receive] reciever function
|
|
6
|
+
* @param {Function} [options.receivingInterceptors]
|
|
7
|
+
*/
|
|
8
|
+
export class ReceivableEndpoint extends Endpoint {
|
|
9
|
+
/**
|
|
10
|
+
* Set the receive function.
|
|
11
|
+
* @param {Function} receive
|
|
12
|
+
*/
|
|
13
|
+
set receive(receive: Function);
|
|
14
|
+
/**
|
|
15
|
+
* Get the receive function.
|
|
16
|
+
* @return {Function}
|
|
17
|
+
*/
|
|
18
|
+
get receive(): Function;
|
|
19
|
+
#private;
|
|
20
|
+
}
|
|
21
|
+
import { Endpoint } from "./endpoint.mjs";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Receiving endpoint wich can also send to itself.
|
|
3
|
+
*/
|
|
4
|
+
export class ReceiveEndpointSelfConnectedDefault extends ReceiveEndpointDefault {
|
|
5
|
+
connections(): any;
|
|
6
|
+
/**
|
|
7
|
+
* Actually stop the communication.
|
|
8
|
+
* @param {Endpoint} other
|
|
9
|
+
* @param {boolean?} backpointer true if this is the call form back call from the other side
|
|
10
|
+
*/
|
|
11
|
+
removeConnection(other: Endpoint, backpointer: boolean | null): void;
|
|
12
|
+
isConnected(other: any): boolean;
|
|
13
|
+
send(...args: any[]): Promise<any>;
|
|
14
|
+
}
|
|
15
|
+
import { ReceiveEndpointDefault } from "./receive-endpoint-default.mjs";
|
|
16
|
+
import { Endpoint } from "./endpoint.mjs";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Receiving Endpoint.
|
|
3
|
+
* Can receive from several endpoints.
|
|
4
|
+
* By default a dummy rejecting receiver is assigned
|
|
5
|
+
* @param {string} name endpoint name
|
|
6
|
+
* @param {Object} owner of the endpoint (service)
|
|
7
|
+
* @param {Object} options
|
|
8
|
+
* @param {Function} [options.receive] reciever function
|
|
9
|
+
* @param {Endpoint} [options.connected] sending side
|
|
10
|
+
*/
|
|
11
|
+
export class ReceiveEndpoint extends MultiConnectionEndpoint {
|
|
12
|
+
}
|
|
13
|
+
import { MultiConnectionEndpoint } from "./multi-connection-endpoint.mjs";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sending Endpoint.
|
|
3
|
+
* Can only hold one connection.
|
|
4
|
+
* Back connections to any further endpoints will not be established
|
|
5
|
+
* @param {string} name endpoint name
|
|
6
|
+
* @param {Object} owner of the endpoint (service)
|
|
7
|
+
* @param {Object} options
|
|
8
|
+
* @param {Endpoint} [options.connected] where te requests are delivered to
|
|
9
|
+
* @param {Function} [options.didConnect] called after receiver is present
|
|
10
|
+
*/
|
|
11
|
+
export class SendEndpoint extends ReceivableEndpoint {
|
|
12
|
+
getConnectionState(other: any): any;
|
|
13
|
+
setConnectionState(other: any, state: any): void;
|
|
14
|
+
addConnection(other: any, backpointer: any): void;
|
|
15
|
+
removeConnection(other: any, backpointer: any): void;
|
|
16
|
+
connections(): Generator<any, void, unknown>;
|
|
17
|
+
send(...args: any[]): Promise<any>;
|
|
18
|
+
#private;
|
|
19
|
+
}
|
|
20
|
+
import { ReceivableEndpoint } from "./receivable-endpoint.mjs";
|