@kronos-integration/endpoint 9.4.43 → 9.4.45
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 +3 -3
- package/package.json +6 -6
- package/src/endpoint.mjs +25 -17
- package/src/multi-connection-endpoint.mjs +2 -2
- package/src/receivable-endpoint.mjs +2 -2
- package/src/send-endpoint.mjs +2 -2
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -117,7 +117,7 @@ Connection endpoint.
|
|
|
117
117
|
|
|
118
118
|
* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** endpoint name
|
|
119
119
|
* `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)
|
|
120
|
+
* `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
|
121
121
|
|
|
122
122
|
* `options.didConnect` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** called after receiver is present
|
|
123
123
|
* `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
|
|
@@ -259,7 +259,7 @@ Can hold several connections.
|
|
|
259
259
|
|
|
260
260
|
* `name`  
|
|
261
261
|
* `owner`  
|
|
262
|
-
* `options`
|
|
262
|
+
* `options`  
|
|
263
263
|
|
|
264
264
|
### getConnectionState
|
|
265
265
|
|
|
@@ -413,7 +413,7 @@ Back connections to any further endpoints will not be established
|
|
|
413
413
|
|
|
414
414
|
* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** endpoint name
|
|
415
415
|
* `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)
|
|
416
|
+
* `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
|
417
417
|
|
|
418
418
|
* `options.connected` **[Endpoint](#endpoint)?** where te requests are delivered to
|
|
419
419
|
* `options.didConnect` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** called after receiver is present
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kronos-integration/endpoint",
|
|
3
|
-
"version": "9.4.
|
|
3
|
+
"version": "9.4.45",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"license": "BSD-2-Clause",
|
|
25
25
|
"scripts": {
|
|
26
26
|
"test": "npm run test:ava",
|
|
27
|
-
"test:ava": "ava --timeout
|
|
27
|
+
"test:ava": "ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
|
|
28
28
|
"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",
|
|
29
29
|
"docs": "documentation readme --section=API ./src/**/*.mjs",
|
|
30
30
|
"lint": "npm run lint:docs",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"@kronos-integration/interceptor": "^10.2.37"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"ava": "^
|
|
38
|
-
"c8": "^
|
|
37
|
+
"ava": "^6.0.1",
|
|
38
|
+
"c8": "^9.0.0",
|
|
39
39
|
"documentation": "^14.0.2",
|
|
40
|
-
"semantic-release": "^22.0.
|
|
40
|
+
"semantic-release": "^22.0.12"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
|
-
"node": ">=20.
|
|
43
|
+
"node": ">=20.10.0"
|
|
44
44
|
},
|
|
45
45
|
"repository": {
|
|
46
46
|
"type": "git",
|
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
|
|
@@ -9,22 +13,16 @@ import { Interceptor } from "@kronos-integration/interceptor";
|
|
|
9
13
|
* @param {Interceptor|Object[]} [options.interceptors] interceptors
|
|
10
14
|
*/
|
|
11
15
|
export class Endpoint {
|
|
12
|
-
constructor(name, owner, options
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
owner: { value: owner }
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
if (options.didConnect !== undefined) {
|
|
19
|
-
properties.didConnect = {
|
|
20
|
-
value: options.didConnect
|
|
21
|
-
};
|
|
22
|
-
}
|
|
16
|
+
constructor(name, owner, options) {
|
|
17
|
+
this.name = name;
|
|
18
|
+
this.owner = owner;
|
|
23
19
|
|
|
24
|
-
|
|
20
|
+
if (options?.didConnect !== undefined) {
|
|
21
|
+
this.didConnect = options.didConnect;
|
|
22
|
+
}
|
|
25
23
|
|
|
26
24
|
this.interceptors = instanciateInterceptors(
|
|
27
|
-
options
|
|
25
|
+
options?.interceptors,
|
|
28
26
|
this.owner
|
|
29
27
|
);
|
|
30
28
|
}
|
|
@@ -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
|
|
|
@@ -9,10 +9,10 @@ export class MultiConnectionEndpoint extends ReceivableEndpoint {
|
|
|
9
9
|
|
|
10
10
|
#connections = new Map();
|
|
11
11
|
|
|
12
|
-
constructor(name, owner, options
|
|
12
|
+
constructor(name, owner, options) {
|
|
13
13
|
super(name, owner, options);
|
|
14
14
|
|
|
15
|
-
if (isEndpoint(options
|
|
15
|
+
if (isEndpoint(options?.connected)) {
|
|
16
16
|
this.addConnection(options.connected);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -13,11 +13,11 @@ export class ReceivableEndpoint extends Endpoint {
|
|
|
13
13
|
|
|
14
14
|
constructor(name, owner, options) {
|
|
15
15
|
super(name, owner, options);
|
|
16
|
-
if (options
|
|
16
|
+
if (options?.receive) {
|
|
17
17
|
this.receive = options.receive;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
if (options
|
|
20
|
+
if (options?.receivingInterceptors) {
|
|
21
21
|
Object.defineProperties(this, {
|
|
22
22
|
receivingInterceptors: {
|
|
23
23
|
value: instanciateInterceptors(
|
package/src/send-endpoint.mjs
CHANGED
|
@@ -16,9 +16,9 @@ export class SendEndpoint extends ReceivableEndpoint {
|
|
|
16
16
|
#connection;
|
|
17
17
|
#state;
|
|
18
18
|
|
|
19
|
-
constructor(name, owner, options
|
|
19
|
+
constructor(name, owner, options) {
|
|
20
20
|
super(name, owner, options);
|
|
21
|
-
if (isEndpoint(options
|
|
21
|
+
if (isEndpoint(options?.connected)) {
|
|
22
22
|
this.addConnection(options.connected);
|
|
23
23
|
}
|
|
24
24
|
}
|