@kronos-integration/endpoint 9.4.47 → 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 +23 -7
- package/package.json +7 -2
- package/src/send-endpoint-default.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
|
@@ -52,6 +52,7 @@ Named communication (end)-points inside of kronos
|
|
|
52
52
|
* [Parameters](#parameters-5)
|
|
53
53
|
* [openConnections](#openconnections)
|
|
54
54
|
* [closeConnections](#closeconnections)
|
|
55
|
+
* [connections](#connections)
|
|
55
56
|
* [getConnectionState](#getconnectionstate)
|
|
56
57
|
* [Parameters](#parameters-6)
|
|
57
58
|
* [setConnectionState](#setconnectionstate)
|
|
@@ -68,8 +69,8 @@ Named communication (end)-points inside of kronos
|
|
|
68
69
|
* [Parameters](#parameters-12)
|
|
69
70
|
* [isConnected](#isconnected-1)
|
|
70
71
|
* [Parameters](#parameters-13)
|
|
71
|
-
* [connections](#connections)
|
|
72
|
-
* [connections](#connections-
|
|
72
|
+
* [connections](#connections-1)
|
|
73
|
+
* [connections](#connections-2)
|
|
73
74
|
* [MultiSendEndpoint](#multisendendpoint)
|
|
74
75
|
* [Parameters](#parameters-14)
|
|
75
76
|
* [isOut](#isout-1)
|
|
@@ -82,13 +83,15 @@ Named communication (end)-points inside of kronos
|
|
|
82
83
|
* [ReceiveEndpointDefault](#receiveendpointdefault)
|
|
83
84
|
* [isDefault](#isdefault-1)
|
|
84
85
|
* [ReceiveEndpointSelfConnectedDefault](#receiveendpointselfconnecteddefault)
|
|
86
|
+
* [removeConnection](#removeconnection)
|
|
87
|
+
* [Parameters](#parameters-17)
|
|
85
88
|
* [ReceiveEndpoint](#receiveendpoint)
|
|
86
|
-
* [Parameters](#parameters-
|
|
89
|
+
* [Parameters](#parameters-18)
|
|
87
90
|
* [isIn](#isin-3)
|
|
88
91
|
* [SendEndpointDefault](#sendendpointdefault)
|
|
89
92
|
* [isDefault](#isdefault-2)
|
|
90
93
|
* [SendEndpoint](#sendendpoint)
|
|
91
|
-
* [Parameters](#parameters-
|
|
94
|
+
* [Parameters](#parameters-19)
|
|
92
95
|
* [isOut](#isout-2)
|
|
93
96
|
|
|
94
97
|
## DummyReceiveEndpoint
|
|
@@ -177,7 +180,7 @@ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
|
177
180
|
|
|
178
181
|
Deliver data flow direction.
|
|
179
182
|
|
|
180
|
-
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
|
|
181
184
|
|
|
182
185
|
### jsonAttributes
|
|
183
186
|
|
|
@@ -219,7 +222,7 @@ Actually start with the communication.
|
|
|
219
222
|
#### Parameters
|
|
220
223
|
|
|
221
224
|
* `other` **[Endpoint](#endpoint)** 
|
|
222
|
-
* `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
|
|
223
226
|
|
|
224
227
|
### closeConnection
|
|
225
228
|
|
|
@@ -228,7 +231,7 @@ Actually stop the communication.
|
|
|
228
231
|
#### Parameters
|
|
229
232
|
|
|
230
233
|
* `other` **[Endpoint](#endpoint)** 
|
|
231
|
-
* `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
|
|
232
235
|
|
|
233
236
|
### openConnections
|
|
234
237
|
|
|
@@ -238,6 +241,10 @@ Opens all connections.
|
|
|
238
241
|
|
|
239
242
|
Closes all connections.
|
|
240
243
|
|
|
244
|
+
### connections
|
|
245
|
+
|
|
246
|
+
Returns **Iterable\<any>** 
|
|
247
|
+
|
|
241
248
|
### getConnectionState
|
|
242
249
|
|
|
243
250
|
Deliver state for a given connection.
|
|
@@ -400,6 +407,15 @@ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
|
400
407
|
|
|
401
408
|
Receiving endpoint wich can also send to itself.
|
|
402
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
|
+
|
|
403
419
|
## ReceiveEndpoint
|
|
404
420
|
|
|
405
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,6 +28,7 @@
|
|
|
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",
|
|
@@ -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";
|