@kronos-integration/endpoint 9.5.3 → 9.5.5

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 CHANGED
@@ -55,46 +55,56 @@ Named communication (end)-points inside of kronos
55
55
  * [connections](#connections)
56
56
  * [addConnection](#addconnection)
57
57
  * [Parameters](#parameters-6)
58
- * [getConnectionState](#getconnectionstate)
58
+ * [removeConnection](#removeconnection)
59
59
  * [Parameters](#parameters-7)
60
- * [setConnectionState](#setconnectionstate)
60
+ * [getConnectionState](#getconnectionstate)
61
61
  * [Parameters](#parameters-8)
62
+ * [setConnectionState](#setconnectionstate)
63
+ * [Parameters](#parameters-9)
64
+ * [didConnect](#didconnect)
65
+ * [Parameters](#parameters-10)
62
66
  * [isEndpoint](#isendpoint)
63
- * [Parameters](#parameters-9)
67
+ * [Parameters](#parameters-11)
64
68
  * [instanciateInterceptors](#instanciateinterceptors)
65
- * [Parameters](#parameters-10)
69
+ * [Parameters](#parameters-12)
66
70
  * [MultiConnectionEndpoint](#multiconnectionendpoint)
67
- * [Parameters](#parameters-11)
71
+ * [Parameters](#parameters-13)
68
72
  * [getConnectionState](#getconnectionstate-1)
69
- * [Parameters](#parameters-12)
73
+ * [Parameters](#parameters-14)
70
74
  * [setConnectionState](#setconnectionstate-1)
71
- * [Parameters](#parameters-13)
75
+ * [Parameters](#parameters-15)
76
+ * [removeConnection](#removeconnection-1)
77
+ * [Parameters](#parameters-16)
72
78
  * [isConnected](#isconnected-1)
73
- * [Parameters](#parameters-14)
79
+ * [Parameters](#parameters-17)
74
80
  * [connections](#connections-1)
75
81
  * [connections](#connections-2)
76
82
  * [MultiSendEndpoint](#multisendendpoint)
77
- * [Parameters](#parameters-15)
83
+ * [Parameters](#parameters-18)
78
84
  * [isOut](#isout-1)
79
85
  * [ReceivableEndpoint](#receivableendpoint)
80
- * [Parameters](#parameters-16)
86
+ * [Parameters](#parameters-19)
81
87
  * [isIn](#isin-2)
82
88
  * [receive](#receive-1)
83
89
  * [receive](#receive-2)
84
- * [Parameters](#parameters-17)
90
+ * [Parameters](#parameters-20)
85
91
  * [ReceiveEndpointDefault](#receiveendpointdefault)
86
92
  * [isDefault](#isdefault-1)
87
93
  * [ReceiveEndpointSelfConnectedDefault](#receiveendpointselfconnecteddefault)
88
- * [removeConnection](#removeconnection)
89
- * [Parameters](#parameters-18)
94
+ * [removeConnection](#removeconnection-2)
95
+ * [Parameters](#parameters-21)
90
96
  * [ReceiveEndpoint](#receiveendpoint)
91
- * [Parameters](#parameters-19)
97
+ * [Parameters](#parameters-22)
92
98
  * [isIn](#isin-3)
93
99
  * [SendEndpointDefault](#sendendpointdefault)
94
100
  * [isDefault](#isdefault-2)
95
101
  * [SendEndpoint](#sendendpoint)
96
- * [Parameters](#parameters-20)
102
+ * [Parameters](#parameters-23)
97
103
  * [isOut](#isout-2)
104
+ * [addConnection](#addconnection-1)
105
+ * [Parameters](#parameters-24)
106
+ * [removeConnection](#removeconnection-3)
107
+ * [Parameters](#parameters-25)
98
108
  * [SendReceiveEndpoint](#sendreceiveendpoint)
99
109
  * [isIn](#isin-4)
100
110
 
@@ -137,9 +147,6 @@ Connection endpoint.
137
147
  * `owner` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** of the endpoint (service)
138
148
  * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
139
149
 
140
- * `options.didConnect` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** called after receiver is present
141
- * `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
142
-
143
150
  ### displayName
144
151
 
145
152
  Name as presented for humans.
@@ -247,13 +254,23 @@ Closes all connections.
247
254
 
248
255
  ### connections
249
256
 
250
- Returns **Iterable\<any>**&#x20;
257
+ Returns **Iterable<[Endpoint](#endpoint)>**&#x20;
251
258
 
252
259
  ### addConnection
253
260
 
254
261
  #### Parameters
255
262
 
256
- * `connection` **any**&#x20;
263
+ * `connection` **[Endpoint](#endpoint)**&#x20;
264
+ * `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
265
+
266
+ ### removeConnection
267
+
268
+ Actually stop the communication.
269
+
270
+ #### Parameters
271
+
272
+ * `other` **[Endpoint](#endpoint)**&#x20;
273
+ * `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
257
274
 
258
275
  ### getConnectionState
259
276
 
@@ -274,6 +291,13 @@ Set state for a given connection.
274
291
  * `other` **[Endpoint](#endpoint)**&#x20;
275
292
  * `state` **[ConnectionState](#connectionstate)**&#x20;
276
293
 
294
+ ### didConnect
295
+
296
+ #### Parameters
297
+
298
+ * `endpoint` **[Endpoint](#endpoint)**&#x20;
299
+ * `other` **[Endpoint](#endpoint)**&#x20;
300
+
277
301
  ## isEndpoint
278
302
 
279
303
  Check for Endpoint.
@@ -290,7 +314,7 @@ Instanciate interceptors from its definitions.
290
314
 
291
315
  ### Parameters
292
316
 
293
- * `interceptors` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<Interceptor> | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>)**&#x20;
317
+ * `interceptors` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<Interceptor> | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)> | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))**&#x20;
294
318
  * `owner` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
295
319
 
296
320
  Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<Interceptor>**&#x20;
@@ -327,6 +351,15 @@ Set connection state.
327
351
  * `other` **[Endpoint](#endpoint)**&#x20;
328
352
  * `state` **any** for the connection to other
329
353
 
354
+ ### removeConnection
355
+
356
+ Actually stop the communication.
357
+
358
+ #### Parameters
359
+
360
+ * `other` **[Endpoint](#endpoint)**&#x20;
361
+ * `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
362
+
330
363
  ### isConnected
331
364
 
332
365
  Check connectivity.
@@ -484,6 +517,24 @@ We are always *out*
484
517
 
485
518
  Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** always true
486
519
 
520
+ ### addConnection
521
+
522
+ Add a connection.
523
+
524
+ #### Parameters
525
+
526
+ * `other` **[Endpoint](#endpoint)**&#x20;
527
+ * `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
528
+
529
+ ### removeConnection
530
+
531
+ Actually stop the communication.
532
+
533
+ #### Parameters
534
+
535
+ * `other` **[Endpoint](#endpoint)**&#x20;
536
+ * `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
537
+
487
538
  ## SendReceiveEndpoint
488
539
 
489
540
  **Extends SendEndpoint**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kronos-integration/endpoint",
3
- "version": "9.5.3",
3
+ "version": "9.5.5",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -28,27 +28,28 @@
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 --rootDir src ./src**/*.mjs",
31
+ "prepare": "npm run prepare:typescript",
32
+ "prepare:typescript": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types --resolveJsonModule -t esnext -m esnext --module nodenext --moduleResolution nodenext --rootDir src ./src**/*.mjs",
32
33
  "test": "npm run test:ava",
33
34
  "test:ava": "ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
34
35
  "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",
35
36
  "docs": "documentation readme --section=API ./src/**/*.mjs",
36
- "lint": "npm run lint:docs && npm run lint:tsc",
37
+ "lint": "npm run lint:docs && npm run lint:typescript",
37
38
  "lint:docs": "documentation lint ./src/**/*.mjs",
38
- "lint:tsc": "tsc --allowJs --checkJs --noEmit -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
39
+ "lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
39
40
  },
40
41
  "dependencies": {
41
42
  "@kronos-integration/interceptor": "^10.3.0"
42
43
  },
43
44
  "devDependencies": {
44
- "ava": "^6.1.2",
45
- "c8": "^9.1.0",
45
+ "ava": "^6.1.3",
46
+ "c8": "^10.1.2",
46
47
  "documentation": "^14.0.3",
47
- "semantic-release": "^23.0.2",
48
- "typescript": "^5.3.3"
48
+ "semantic-release": "^24.1.0",
49
+ "typescript": "^5.5.4"
49
50
  },
50
51
  "engines": {
51
- "node": ">=20.11.1"
52
+ "node": ">=22.7.0"
52
53
  },
53
54
  "repository": {
54
55
  "type": "git",
package/src/endpoint.mjs CHANGED
@@ -7,7 +7,6 @@ import { Interceptor } from "@kronos-integration/interceptor";
7
7
  /**
8
8
  * Connection endpoint.
9
9
  */
10
-
11
10
  export class Endpoint {
12
11
  /**
13
12
  * @param {string} name endpoint name
@@ -254,7 +253,7 @@ export class Endpoint {
254
253
  /**
255
254
  * Actually start with the communication.
256
255
  * @param {Endpoint} other
257
- * @param {boolean?} backpointer true if this is the call from back call from the other side
256
+ * @param {boolean} [backpointer] true if this is the call from back call from the other side
258
257
  */
259
258
  openConnection(other, backpointer) {
260
259
  if (other !== undefined) {
@@ -321,13 +320,14 @@ export class Endpoint {
321
320
  /**
322
321
  *
323
322
  * @param {Endpoint} connection
323
+ * @param {boolean} [backpointer] true if this is the call form back call from the other side
324
324
  */
325
- addConnection(connection) {}
325
+ addConnection(connection, backpointer) {}
326
326
 
327
327
  /**
328
328
  * Actually stop the communication.
329
329
  * @param {Endpoint} other
330
- * @param {boolean?} backpointer true if this is the call form back call from the other side
330
+ * @param {boolean} [backpointer] true if this is the call form back call from the other side
331
331
  */
332
332
  removeConnection(other, backpointer) {}
333
333
 
@@ -54,7 +54,7 @@ export class MultiConnectionEndpoint extends ReceivableEndpoint {
54
54
  /**
55
55
  * Actually stop the communication.
56
56
  * @param {Endpoint} other
57
- * @param {boolean?} backpointer true if this is the call form back call from the other side
57
+ * @param {boolean?} [backpointer] true if this is the call form back call from the other side
58
58
  */
59
59
  removeConnection(other, backpointer) {
60
60
  this.closeConnection(other);
@@ -1,4 +1,4 @@
1
- import { isEndpoint, Endpoint} from "./endpoint.mjs";
1
+ import { isEndpoint, Endpoint } from "./endpoint.mjs";
2
2
  import { ReceivableEndpoint } from "./receivable-endpoint.mjs";
3
3
 
4
4
  /**
@@ -12,10 +12,9 @@ import { ReceivableEndpoint } from "./receivable-endpoint.mjs";
12
12
  * @param {Function} [options.didConnect] called after receiver is present
13
13
  */
14
14
  export class SendEndpoint extends ReceivableEndpoint {
15
-
16
15
  #connection;
17
16
  #state;
18
-
17
+
19
18
  constructor(name, owner, options) {
20
19
  super(name, owner, options);
21
20
  if (isEndpoint(options?.connected)) {
@@ -45,6 +44,11 @@ export class SendEndpoint extends ReceivableEndpoint {
45
44
  }
46
45
  }
47
46
 
47
+ /**
48
+ * Add a connection.
49
+ * @param {Endpoint} other
50
+ * @param {boolean} [backpointer] true if this is the call form back call from the other side
51
+ */
48
52
  addConnection(other, backpointer) {
49
53
  if (this.#connection === other) {
50
54
  return;
@@ -77,7 +81,7 @@ export class SendEndpoint extends ReceivableEndpoint {
77
81
  /**
78
82
  * Actually stop the communication.
79
83
  * @param {Endpoint} other
80
- * @param {boolean?} backpointer true if this is the call form back call from the other side
84
+ * @param {boolean} [backpointer] true if this is the call form back call from the other side
81
85
  */
82
86
  removeConnection(other, backpointer) {
83
87
  this.closeConnection(other);
@@ -125,9 +125,9 @@ export class Endpoint {
125
125
  /**
126
126
  * Actually start with the communication.
127
127
  * @param {Endpoint} other
128
- * @param {boolean?} backpointer true if this is the call from back call from the other side
128
+ * @param {boolean} [backpointer] true if this is the call from back call from the other side
129
129
  */
130
- openConnection(other: Endpoint, backpointer: boolean | null): void;
130
+ openConnection(other: Endpoint, backpointer?: boolean): void;
131
131
  /**
132
132
  * Actually stop the communication.
133
133
  * @param {Endpoint} other
@@ -149,14 +149,15 @@ export class Endpoint {
149
149
  /**
150
150
  *
151
151
  * @param {Endpoint} connection
152
+ * @param {boolean} [backpointer] true if this is the call form back call from the other side
152
153
  */
153
- addConnection(connection: Endpoint): void;
154
+ addConnection(connection: Endpoint, backpointer?: boolean): void;
154
155
  /**
155
156
  * Actually stop the communication.
156
157
  * @param {Endpoint} other
157
- * @param {boolean?} backpointer true if this is the call form back call from the other side
158
+ * @param {boolean} [backpointer] true if this is the call form back call from the other side
158
159
  */
159
- removeConnection(other: Endpoint, backpointer: boolean | null): void;
160
+ removeConnection(other: Endpoint, backpointer?: boolean): void;
160
161
  /**
161
162
  * Deliver state for a given connection.
162
163
  * @param {Endpoint} other
@@ -3,7 +3,14 @@
3
3
  */
4
4
  export class ReceiveEndpointSelfConnectedDefault extends ReceiveEndpointDefault {
5
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;
6
12
  isConnected(other: any): boolean;
7
13
  send(...args: any[]): Promise<any>;
8
14
  }
9
15
  import { ReceiveEndpointDefault } from "./receive-endpoint-default.mjs";
16
+ import { Endpoint } from "./endpoint.mjs";
@@ -11,7 +11,6 @@
11
11
  export class SendEndpoint extends ReceivableEndpoint {
12
12
  getConnectionState(other: any): any;
13
13
  setConnectionState(other: any, state: any): void;
14
- addConnection(other: any, backpointer: any): void;
15
14
  connections(): Generator<any, void, unknown>;
16
15
  send(...args: any[]): Promise<any>;
17
16
  #private;