@kronos-integration/endpoint 9.5.3 → 9.5.4

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,54 @@ 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
+ * [removeConnection](#removeconnection-3)
105
+ * [Parameters](#parameters-24)
98
106
  * [SendReceiveEndpoint](#sendreceiveendpoint)
99
107
  * [isIn](#isin-4)
100
108
 
@@ -137,9 +145,6 @@ Connection endpoint.
137
145
  * `owner` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** of the endpoint (service)
138
146
  * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
139
147
 
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
148
  ### displayName
144
149
 
145
150
  Name as presented for humans.
@@ -247,13 +252,22 @@ Closes all connections.
247
252
 
248
253
  ### connections
249
254
 
250
- Returns **Iterable\<any>**&#x20;
255
+ Returns **Iterable<[Endpoint](#endpoint)>**&#x20;
251
256
 
252
257
  ### addConnection
253
258
 
254
259
  #### Parameters
255
260
 
256
- * `connection` **any**&#x20;
261
+ * `connection` **[Endpoint](#endpoint)**&#x20;
262
+
263
+ ### removeConnection
264
+
265
+ Actually stop the communication.
266
+
267
+ #### Parameters
268
+
269
+ * `other` **[Endpoint](#endpoint)**&#x20;
270
+ * `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
271
 
258
272
  ### getConnectionState
259
273
 
@@ -274,6 +288,13 @@ Set state for a given connection.
274
288
  * `other` **[Endpoint](#endpoint)**&#x20;
275
289
  * `state` **[ConnectionState](#connectionstate)**&#x20;
276
290
 
291
+ ### didConnect
292
+
293
+ #### Parameters
294
+
295
+ * `endpoint` **[Endpoint](#endpoint)**&#x20;
296
+ * `other` **[Endpoint](#endpoint)**&#x20;
297
+
277
298
  ## isEndpoint
278
299
 
279
300
  Check for Endpoint.
@@ -290,7 +311,7 @@ Instanciate interceptors from its definitions.
290
311
 
291
312
  ### Parameters
292
313
 
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;
314
+ * `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
315
  * `owner` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
295
316
 
296
317
  Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<Interceptor>**&#x20;
@@ -327,6 +348,15 @@ Set connection state.
327
348
  * `other` **[Endpoint](#endpoint)**&#x20;
328
349
  * `state` **any** for the connection to other
329
350
 
351
+ ### removeConnection
352
+
353
+ Actually stop the communication.
354
+
355
+ #### Parameters
356
+
357
+ * `other` **[Endpoint](#endpoint)**&#x20;
358
+ * `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
359
+
330
360
  ### isConnected
331
361
 
332
362
  Check connectivity.
@@ -484,6 +514,15 @@ We are always *out*
484
514
 
485
515
  Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** always true
486
516
 
517
+ ### removeConnection
518
+
519
+ Actually stop the communication.
520
+
521
+ #### Parameters
522
+
523
+ * `other` **[Endpoint](#endpoint)**&#x20;
524
+ * `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
525
+
487
526
  ## SendReceiveEndpoint
488
527
 
489
528
  **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.4",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -28,14 +28,15 @@
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"
@@ -44,11 +45,11 @@
44
45
  "ava": "^6.1.2",
45
46
  "c8": "^9.1.0",
46
47
  "documentation": "^14.0.3",
47
- "semantic-release": "^23.0.2",
48
- "typescript": "^5.3.3"
48
+ "semantic-release": "^23.0.8",
49
+ "typescript": "^5.4.5"
49
50
  },
50
51
  "engines": {
51
- "node": ">=20.11.1"
52
+ "node": ">=20.12.2"
52
53
  },
53
54
  "repository": {
54
55
  "type": "git",
package/src/endpoint.mjs CHANGED
@@ -254,7 +254,7 @@ export class Endpoint {
254
254
  /**
255
255
  * Actually start with the communication.
256
256
  * @param {Endpoint} other
257
- * @param {boolean?} backpointer true if this is the call from back call from the other side
257
+ * @param {boolean} [backpointer] true if this is the call from back call from the other side
258
258
  */
259
259
  openConnection(other, backpointer) {
260
260
  if (other !== undefined) {
@@ -321,13 +321,14 @@ export class Endpoint {
321
321
  /**
322
322
  *
323
323
  * @param {Endpoint} connection
324
+ * @param {boolean} [backpointer] true if this is the call form back call from the other side
324
325
  */
325
- addConnection(connection) {}
326
+ addConnection(connection, backpointer) {}
326
327
 
327
328
  /**
328
329
  * Actually stop the communication.
329
330
  * @param {Endpoint} other
330
- * @param {boolean?} backpointer true if this is the call form back call from the other side
331
+ * @param {boolean} [backpointer] true if this is the call form back call from the other side
331
332
  */
332
333
  removeConnection(other, backpointer) {}
333
334
 
@@ -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;