@kronos-integration/endpoint 9.5.0 → 9.5.2
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 +9 -2
- package/package.json +7 -7
- package/src/dummy-receive-endpoint.mjs +1 -1
- package/src/endpoint.mjs +7 -3
- package/src/multi-send-endpoint.mjs +5 -4
- package/src/receive-endpoint-self-connected-default.mjs +1 -0
- package/src/send-receive-endpoint.mjs +3 -0
- package/types/dummy-receive-endpoint.d.mts +1 -1
- package/types/endpoint.d.mts +10 -5
- package/types/send-receive-endpoint.d.mts +3 -0
package/README.md
CHANGED
|
@@ -93,6 +93,7 @@ Named communication (end)-points inside of kronos
|
|
|
93
93
|
* [SendEndpoint](#sendendpoint)
|
|
94
94
|
* [Parameters](#parameters-19)
|
|
95
95
|
* [isOut](#isout-2)
|
|
96
|
+
* [isIn](#isin-4)
|
|
96
97
|
|
|
97
98
|
## DummyReceiveEndpoint
|
|
98
99
|
|
|
@@ -102,7 +103,7 @@ Dummy endpoints are used during construction of the endpoint mesh.
|
|
|
102
103
|
|
|
103
104
|
### receive
|
|
104
105
|
|
|
105
|
-
dummy does nothing by intention
|
|
106
|
+
dummy does nothing by intention.
|
|
106
107
|
|
|
107
108
|
### isIn
|
|
108
109
|
|
|
@@ -447,7 +448,7 @@ Send Endpoint acting as a default endpoints.
|
|
|
447
448
|
|
|
448
449
|
### isDefault
|
|
449
450
|
|
|
450
|
-
We are a default endpoint
|
|
451
|
+
We are a default endpoint.
|
|
451
452
|
|
|
452
453
|
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** always true
|
|
453
454
|
|
|
@@ -474,6 +475,12 @@ We are always *out*
|
|
|
474
475
|
|
|
475
476
|
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** always true
|
|
476
477
|
|
|
478
|
+
## isIn
|
|
479
|
+
|
|
480
|
+
Always receiving.
|
|
481
|
+
|
|
482
|
+
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true
|
|
483
|
+
|
|
477
484
|
# install
|
|
478
485
|
|
|
479
486
|
With [npm](http://npmjs.org) do:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kronos-integration/endpoint",
|
|
3
|
-
"version": "9.5.
|
|
3
|
+
"version": "9.5.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"types": "./types/module.d.mts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
-
"
|
|
12
|
-
"
|
|
11
|
+
"default": "./src/module.mjs",
|
|
12
|
+
"types": "./types/module.d.mts"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"description": "named communication (end)-points inside of kronos",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
],
|
|
29
29
|
"license": "BSD-2-Clause",
|
|
30
30
|
"scripts": {
|
|
31
|
-
"prepare": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs",
|
|
31
|
+
"prepare": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types -t esnext -m esnext --module nodenext --moduleResolution nodenext --rootDir src ./src**/*.mjs",
|
|
32
32
|
"test": "npm run test:ava",
|
|
33
33
|
"test:ava": "ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
|
|
34
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",
|
|
@@ -38,17 +38,17 @@
|
|
|
38
38
|
"lint:tsc": "tsc --allowJs --checkJs --noEmit -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@kronos-integration/interceptor": "^10.
|
|
41
|
+
"@kronos-integration/interceptor": "^10.3.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"ava": "^6.1.
|
|
44
|
+
"ava": "^6.1.2",
|
|
45
45
|
"c8": "^9.1.0",
|
|
46
46
|
"documentation": "^14.0.3",
|
|
47
47
|
"semantic-release": "^23.0.2",
|
|
48
48
|
"typescript": "^5.3.3"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
|
-
"node": ">=20.11.
|
|
51
|
+
"node": ">=20.11.1"
|
|
52
52
|
},
|
|
53
53
|
"repository": {
|
|
54
54
|
"type": "git",
|
package/src/endpoint.mjs
CHANGED
|
@@ -276,7 +276,7 @@ export class Endpoint {
|
|
|
276
276
|
/**
|
|
277
277
|
* Actually stop the communication.
|
|
278
278
|
* @param {Endpoint} other
|
|
279
|
-
* @param {boolean
|
|
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) {
|
|
@@ -315,7 +315,11 @@ export class Endpoint {
|
|
|
315
315
|
*/
|
|
316
316
|
*connections() {}
|
|
317
317
|
|
|
318
|
-
|
|
318
|
+
/**
|
|
319
|
+
*
|
|
320
|
+
* @param {any} connection
|
|
321
|
+
*/
|
|
322
|
+
addConnection(connection) {}
|
|
319
323
|
|
|
320
324
|
removeConnection() {}
|
|
321
325
|
|
|
@@ -351,7 +355,7 @@ export function isEndpoint(object) {
|
|
|
351
355
|
|
|
352
356
|
/**
|
|
353
357
|
* Instanciate interceptors from its definitions.
|
|
354
|
-
* @param {Interceptor[]|
|
|
358
|
+
* @param {Interceptor[]|string[]} interceptors
|
|
355
359
|
* @param {Object} owner
|
|
356
360
|
* @return {Interceptor[]}
|
|
357
361
|
*/
|
|
@@ -12,7 +12,6 @@ import { Endpoint } from "./endpoint.mjs";
|
|
|
12
12
|
* @param {Function} [options.didConnect] called after receiver is present
|
|
13
13
|
*/
|
|
14
14
|
export class MultiSendEndpoint extends MultiConnectionEndpoint {
|
|
15
|
-
|
|
16
15
|
/**
|
|
17
16
|
* We are always _out_
|
|
18
17
|
* @return {boolean} always true
|
|
@@ -30,7 +29,8 @@ export class MultiSendEndpoint extends MultiConnectionEndpoint {
|
|
|
30
29
|
|
|
31
30
|
const next = async (...args) =>
|
|
32
31
|
c >= interceptors.length
|
|
33
|
-
?
|
|
32
|
+
? // @ts-ignore
|
|
33
|
+
connection.receive(...args)
|
|
34
34
|
: interceptors[c++].receive(this, next, ...args);
|
|
35
35
|
|
|
36
36
|
next(...args);
|
|
@@ -38,7 +38,7 @@ export class MultiSendEndpoint extends MultiConnectionEndpoint {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
async *
|
|
41
|
+
async *sendAndReceive(...args) {
|
|
42
42
|
const interceptors = this.interceptors;
|
|
43
43
|
|
|
44
44
|
for (const connection of this.connections()) {
|
|
@@ -47,7 +47,8 @@ export class MultiSendEndpoint extends MultiConnectionEndpoint {
|
|
|
47
47
|
|
|
48
48
|
const next = async (...args) =>
|
|
49
49
|
c >= interceptors.length
|
|
50
|
-
?
|
|
50
|
+
? // @ts-ignore
|
|
51
|
+
connection.receive(...args)
|
|
51
52
|
: interceptors[c++].receive(this, next, ...args);
|
|
52
53
|
|
|
53
54
|
yield next(...args);
|
|
@@ -27,6 +27,7 @@ export class ReceiveEndpointSelfConnectedDefault extends ReceiveEndpointDefault
|
|
|
27
27
|
* @param {boolean?} backpointer true if this is the call form back call from the other side
|
|
28
28
|
*/
|
|
29
29
|
removeConnection(other, backpointer) {
|
|
30
|
+
// @ts-ignore
|
|
30
31
|
if (other === this) {
|
|
31
32
|
return;
|
|
32
33
|
}
|
package/types/endpoint.d.mts
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
export function isEndpoint(object: any): boolean;
|
|
7
7
|
/**
|
|
8
8
|
* Instanciate interceptors from its definitions.
|
|
9
|
-
* @param {Interceptor[]|
|
|
9
|
+
* @param {Interceptor[]|string[]} interceptors
|
|
10
10
|
* @param {Object} owner
|
|
11
11
|
* @return {Interceptor[]}
|
|
12
12
|
*/
|
|
13
|
-
export function instanciateInterceptors(interceptors: Interceptor[] |
|
|
13
|
+
export function instanciateInterceptors(interceptors: Interceptor[] | string[], owner: any): Interceptor[];
|
|
14
14
|
/**
|
|
15
15
|
* @typedef {Object} ConnectionState
|
|
16
16
|
*/
|
|
@@ -121,9 +121,9 @@ export class Endpoint {
|
|
|
121
121
|
/**
|
|
122
122
|
* Actually stop the communication.
|
|
123
123
|
* @param {Endpoint} other
|
|
124
|
-
* @param {boolean
|
|
124
|
+
* @param {boolean} [backpointer] true if this is the call from back call from the other side
|
|
125
125
|
*/
|
|
126
|
-
closeConnection(other: Endpoint, backpointer
|
|
126
|
+
closeConnection(other: Endpoint, backpointer?: boolean): void;
|
|
127
127
|
/**
|
|
128
128
|
* Opens all connections.
|
|
129
129
|
*/
|
|
@@ -136,7 +136,11 @@ export class Endpoint {
|
|
|
136
136
|
* @return {Iterable<any>}
|
|
137
137
|
*/
|
|
138
138
|
connections(): Iterable<any>;
|
|
139
|
-
|
|
139
|
+
/**
|
|
140
|
+
*
|
|
141
|
+
* @param {any} connection
|
|
142
|
+
*/
|
|
143
|
+
addConnection(connection: any): void;
|
|
140
144
|
removeConnection(): void;
|
|
141
145
|
/**
|
|
142
146
|
* Deliver state for a given connection.
|
|
@@ -153,3 +157,4 @@ export class Endpoint {
|
|
|
153
157
|
get receivingInterceptors(): any[];
|
|
154
158
|
}
|
|
155
159
|
export type ConnectionState = any;
|
|
160
|
+
import { Interceptor } from "@kronos-integration/interceptor";
|