@kronos-integration/endpoint 9.4.44 → 9.4.46
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/LICENSE +1 -1
- package/README.md +44 -16
- package/package.json +9 -8
- package/src/endpoint.mjs +21 -13
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -26,6 +26,7 @@ Named communication (end)-points inside of kronos
|
|
|
26
26
|
* [isIn](#isin)
|
|
27
27
|
* [isOpen](#isopen)
|
|
28
28
|
* [isDummy](#isdummy)
|
|
29
|
+
* [ConnectionState](#connectionstate)
|
|
29
30
|
* [Endpoint](#endpoint)
|
|
30
31
|
* [Parameters](#parameters)
|
|
31
32
|
* [displayName](#displayname)
|
|
@@ -50,38 +51,42 @@ Named communication (end)-points inside of kronos
|
|
|
50
51
|
* [Parameters](#parameters-5)
|
|
51
52
|
* [openConnections](#openconnections)
|
|
52
53
|
* [closeConnections](#closeconnections)
|
|
54
|
+
* [getConnectionState](#getconnectionstate)
|
|
55
|
+
* [Parameters](#parameters-6)
|
|
56
|
+
* [setConnectionState](#setconnectionstate)
|
|
57
|
+
* [Parameters](#parameters-7)
|
|
53
58
|
* [isEndpoint](#isendpoint)
|
|
54
|
-
* [Parameters](#parameters-
|
|
59
|
+
* [Parameters](#parameters-8)
|
|
55
60
|
* [instanciateInterceptors](#instanciateinterceptors)
|
|
56
|
-
* [Parameters](#parameters-
|
|
61
|
+
* [Parameters](#parameters-9)
|
|
57
62
|
* [MultiConnectionEndpoint](#multiconnectionendpoint)
|
|
58
|
-
* [Parameters](#parameters-
|
|
59
|
-
* [getConnectionState](#getconnectionstate)
|
|
60
|
-
* [Parameters](#parameters-9)
|
|
61
|
-
* [setConnectionState](#setconnectionstate)
|
|
62
|
-
* [Parameters](#parameters-10)
|
|
63
|
-
* [isConnected](#isconnected-1)
|
|
63
|
+
* [Parameters](#parameters-10)
|
|
64
|
+
* [getConnectionState](#getconnectionstate-1)
|
|
64
65
|
* [Parameters](#parameters-11)
|
|
66
|
+
* [setConnectionState](#setconnectionstate-1)
|
|
67
|
+
* [Parameters](#parameters-12)
|
|
68
|
+
* [isConnected](#isconnected-1)
|
|
69
|
+
* [Parameters](#parameters-13)
|
|
65
70
|
* [connections](#connections)
|
|
66
71
|
* [MultiSendEndpoint](#multisendendpoint)
|
|
67
|
-
* [Parameters](#parameters-
|
|
72
|
+
* [Parameters](#parameters-14)
|
|
68
73
|
* [isOut](#isout-1)
|
|
69
74
|
* [ReceivableEndpoint](#receivableendpoint)
|
|
70
|
-
* [Parameters](#parameters-
|
|
75
|
+
* [Parameters](#parameters-15)
|
|
71
76
|
* [isIn](#isin-2)
|
|
72
77
|
* [receive](#receive-1)
|
|
73
78
|
* [receive](#receive-2)
|
|
74
|
-
* [Parameters](#parameters-
|
|
79
|
+
* [Parameters](#parameters-16)
|
|
75
80
|
* [ReceiveEndpointDefault](#receiveendpointdefault)
|
|
76
81
|
* [isDefault](#isdefault-1)
|
|
77
82
|
* [ReceiveEndpointSelfConnectedDefault](#receiveendpointselfconnecteddefault)
|
|
78
83
|
* [ReceiveEndpoint](#receiveendpoint)
|
|
79
|
-
* [Parameters](#parameters-
|
|
84
|
+
* [Parameters](#parameters-17)
|
|
80
85
|
* [isIn](#isin-3)
|
|
81
86
|
* [SendEndpointDefault](#sendendpointdefault)
|
|
82
87
|
* [isDefault](#isdefault-2)
|
|
83
88
|
* [SendEndpoint](#sendendpoint)
|
|
84
|
-
* [Parameters](#parameters-
|
|
89
|
+
* [Parameters](#parameters-18)
|
|
85
90
|
* [isOut](#isout-2)
|
|
86
91
|
|
|
87
92
|
## DummyReceiveEndpoint
|
|
@@ -109,6 +114,10 @@ Dummy endpoints are used duiring construction of the endpoint mesh.
|
|
|
109
114
|
|
|
110
115
|
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true
|
|
111
116
|
|
|
117
|
+
## ConnectionState
|
|
118
|
+
|
|
119
|
+
Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
120
|
+
|
|
112
121
|
## Endpoint
|
|
113
122
|
|
|
114
123
|
Connection endpoint.
|
|
@@ -117,7 +126,7 @@ Connection endpoint.
|
|
|
117
126
|
|
|
118
127
|
* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** endpoint name
|
|
119
128
|
* `owner` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** of the endpoint (service)
|
|
120
|
-
* `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
129
|
+
* `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
|
121
130
|
|
|
122
131
|
* `options.didConnect` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** called after receiver is present
|
|
123
132
|
* `options.interceptors` **(Interceptor | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>)?** interceptors
|
|
@@ -227,6 +236,25 @@ Opens all connections.
|
|
|
227
236
|
|
|
228
237
|
Closes all connections.
|
|
229
238
|
|
|
239
|
+
### getConnectionState
|
|
240
|
+
|
|
241
|
+
Deliver state for a given connection.
|
|
242
|
+
|
|
243
|
+
#### Parameters
|
|
244
|
+
|
|
245
|
+
* `other` **[Endpoint](#endpoint)** 
|
|
246
|
+
|
|
247
|
+
Returns **[ConnectionState](#connectionstate)** 
|
|
248
|
+
|
|
249
|
+
### setConnectionState
|
|
250
|
+
|
|
251
|
+
Set state for a given connection.
|
|
252
|
+
|
|
253
|
+
#### Parameters
|
|
254
|
+
|
|
255
|
+
* `other` **[Endpoint](#endpoint)** 
|
|
256
|
+
* `state` **[ConnectionState](#connectionstate)** 
|
|
257
|
+
|
|
230
258
|
## isEndpoint
|
|
231
259
|
|
|
232
260
|
Check for Endpoint.
|
|
@@ -259,7 +287,7 @@ Can hold several connections.
|
|
|
259
287
|
|
|
260
288
|
* `name`  
|
|
261
289
|
* `owner`  
|
|
262
|
-
* `options`
|
|
290
|
+
* `options`  
|
|
263
291
|
|
|
264
292
|
### getConnectionState
|
|
265
293
|
|
|
@@ -413,7 +441,7 @@ Back connections to any further endpoints will not be established
|
|
|
413
441
|
|
|
414
442
|
* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** endpoint name
|
|
415
443
|
* `owner` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** of the endpoint (service)
|
|
416
|
-
* `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
444
|
+
* `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
|
417
445
|
|
|
418
446
|
* `options.connected` **[Endpoint](#endpoint)?** where te requests are delivered to
|
|
419
447
|
* `options.didConnect` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** called after receiver is present
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kronos-integration/endpoint",
|
|
3
|
-
"version": "9.4.
|
|
3
|
+
"version": "9.4.46",
|
|
4
4
|
"publishConfig": {
|
|
5
|
-
"access": "public"
|
|
5
|
+
"access": "public",
|
|
6
|
+
"provenance": true
|
|
6
7
|
},
|
|
7
8
|
"exports": {
|
|
8
9
|
".": "./src/module.mjs"
|
|
@@ -34,17 +35,17 @@
|
|
|
34
35
|
"@kronos-integration/interceptor": "^10.2.37"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
|
-
"ava": "^
|
|
38
|
-
"c8": "^
|
|
39
|
-
"documentation": "^14.0.
|
|
40
|
-
"semantic-release": "^
|
|
38
|
+
"ava": "^6.1.1",
|
|
39
|
+
"c8": "^9.1.0",
|
|
40
|
+
"documentation": "^14.0.3",
|
|
41
|
+
"semantic-release": "^23.0.2"
|
|
41
42
|
},
|
|
42
43
|
"engines": {
|
|
43
|
-
"node": ">=20.
|
|
44
|
+
"node": ">=20.11.0"
|
|
44
45
|
},
|
|
45
46
|
"repository": {
|
|
46
47
|
"type": "git",
|
|
47
|
-
"url": "https://github.com/Kronos-Integration/endpoint"
|
|
48
|
+
"url": "git+https://github.com/Kronos-Integration/endpoint.git"
|
|
48
49
|
},
|
|
49
50
|
"bugs": {
|
|
50
51
|
"url": "https://github.com/Kronos-Integration/endpoint/issues"
|
package/src/endpoint.mjs
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Interceptor } from "@kronos-integration/interceptor";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {Object} ConnectionState
|
|
5
|
+
*/
|
|
6
|
+
|
|
3
7
|
/**
|
|
4
8
|
* Connection endpoint.
|
|
5
9
|
* @param {string} name endpoint name
|
|
@@ -10,19 +14,13 @@ import { Interceptor } from "@kronos-integration/interceptor";
|
|
|
10
14
|
*/
|
|
11
15
|
export class Endpoint {
|
|
12
16
|
constructor(name, owner, options) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
owner: { value: owner }
|
|
16
|
-
};
|
|
17
|
+
this.name = name;
|
|
18
|
+
this.owner = owner;
|
|
17
19
|
|
|
18
20
|
if (options?.didConnect !== undefined) {
|
|
19
|
-
|
|
20
|
-
value: options.didConnect
|
|
21
|
-
};
|
|
21
|
+
this.didConnect = options.didConnect;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
Object.defineProperties(this, properties);
|
|
25
|
-
|
|
26
24
|
this.interceptors = instanciateInterceptors(
|
|
27
25
|
options?.interceptors,
|
|
28
26
|
this.owner
|
|
@@ -299,7 +297,7 @@ export class Endpoint {
|
|
|
299
297
|
*/
|
|
300
298
|
openConnections() {
|
|
301
299
|
for (const c of this.connections()) {
|
|
302
|
-
this.openConnection(c);
|
|
300
|
+
this.openConnection(c, false);
|
|
303
301
|
}
|
|
304
302
|
}
|
|
305
303
|
|
|
@@ -308,7 +306,7 @@ export class Endpoint {
|
|
|
308
306
|
*/
|
|
309
307
|
closeConnections() {
|
|
310
308
|
for (const c of this.connections()) {
|
|
311
|
-
this.closeConnection(c);
|
|
309
|
+
this.closeConnection(c, false);
|
|
312
310
|
}
|
|
313
311
|
}
|
|
314
312
|
|
|
@@ -318,9 +316,19 @@ export class Endpoint {
|
|
|
318
316
|
|
|
319
317
|
removeConnection() {}
|
|
320
318
|
|
|
321
|
-
|
|
319
|
+
/**
|
|
320
|
+
* Deliver state for a given connection.
|
|
321
|
+
* @param {Endpoint} other
|
|
322
|
+
* @return {ConnectionState}
|
|
323
|
+
*/
|
|
324
|
+
getConnectionState(other) {}
|
|
322
325
|
|
|
323
|
-
|
|
326
|
+
/**
|
|
327
|
+
* Set state for a given connection.
|
|
328
|
+
* @param {Endpoint} other
|
|
329
|
+
* @param {ConnectionState} state
|
|
330
|
+
*/
|
|
331
|
+
setConnectionState(other, state) {}
|
|
324
332
|
|
|
325
333
|
didConnect() {}
|
|
326
334
|
|