@kronos-integration/endpoint 9.5.2 → 9.5.3

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
@@ -53,47 +53,50 @@ Named communication (end)-points inside of kronos
53
53
  * [openConnections](#openconnections)
54
54
  * [closeConnections](#closeconnections)
55
55
  * [connections](#connections)
56
- * [getConnectionState](#getconnectionstate)
56
+ * [addConnection](#addconnection)
57
57
  * [Parameters](#parameters-6)
58
- * [setConnectionState](#setconnectionstate)
58
+ * [getConnectionState](#getconnectionstate)
59
59
  * [Parameters](#parameters-7)
60
+ * [setConnectionState](#setconnectionstate)
61
+ * [Parameters](#parameters-8)
60
62
  * [isEndpoint](#isendpoint)
61
- * [Parameters](#parameters-8)
62
- * [instanciateInterceptors](#instanciateinterceptors)
63
63
  * [Parameters](#parameters-9)
64
- * [MultiConnectionEndpoint](#multiconnectionendpoint)
64
+ * [instanciateInterceptors](#instanciateinterceptors)
65
65
  * [Parameters](#parameters-10)
66
+ * [MultiConnectionEndpoint](#multiconnectionendpoint)
67
+ * [Parameters](#parameters-11)
66
68
  * [getConnectionState](#getconnectionstate-1)
67
- * [Parameters](#parameters-11)
68
- * [setConnectionState](#setconnectionstate-1)
69
69
  * [Parameters](#parameters-12)
70
- * [isConnected](#isconnected-1)
70
+ * [setConnectionState](#setconnectionstate-1)
71
71
  * [Parameters](#parameters-13)
72
+ * [isConnected](#isconnected-1)
73
+ * [Parameters](#parameters-14)
72
74
  * [connections](#connections-1)
73
75
  * [connections](#connections-2)
74
76
  * [MultiSendEndpoint](#multisendendpoint)
75
- * [Parameters](#parameters-14)
77
+ * [Parameters](#parameters-15)
76
78
  * [isOut](#isout-1)
77
79
  * [ReceivableEndpoint](#receivableendpoint)
78
- * [Parameters](#parameters-15)
80
+ * [Parameters](#parameters-16)
79
81
  * [isIn](#isin-2)
80
82
  * [receive](#receive-1)
81
83
  * [receive](#receive-2)
82
- * [Parameters](#parameters-16)
84
+ * [Parameters](#parameters-17)
83
85
  * [ReceiveEndpointDefault](#receiveendpointdefault)
84
86
  * [isDefault](#isdefault-1)
85
87
  * [ReceiveEndpointSelfConnectedDefault](#receiveendpointselfconnecteddefault)
86
88
  * [removeConnection](#removeconnection)
87
- * [Parameters](#parameters-17)
89
+ * [Parameters](#parameters-18)
88
90
  * [ReceiveEndpoint](#receiveendpoint)
89
- * [Parameters](#parameters-18)
91
+ * [Parameters](#parameters-19)
90
92
  * [isIn](#isin-3)
91
93
  * [SendEndpointDefault](#sendendpointdefault)
92
94
  * [isDefault](#isdefault-2)
93
95
  * [SendEndpoint](#sendendpoint)
94
- * [Parameters](#parameters-19)
96
+ * [Parameters](#parameters-20)
95
97
  * [isOut](#isout-2)
96
- * [isIn](#isin-4)
98
+ * [SendReceiveEndpoint](#sendreceiveendpoint)
99
+ * [isIn](#isin-4)
97
100
 
98
101
  ## DummyReceiveEndpoint
99
102
 
@@ -246,6 +249,12 @@ Closes all connections.
246
249
 
247
250
  Returns **Iterable\<any>**&#x20;
248
251
 
252
+ ### addConnection
253
+
254
+ #### Parameters
255
+
256
+ * `connection` **any**&#x20;
257
+
249
258
  ### getConnectionState
250
259
 
251
260
  Deliver state for a given connection.
@@ -281,7 +290,7 @@ Instanciate interceptors from its definitions.
281
290
 
282
291
  ### Parameters
283
292
 
284
- * `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)\<Class> | [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;
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;
285
294
  * `owner` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
286
295
 
287
296
  Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<Interceptor>**&#x20;
@@ -475,7 +484,13 @@ We are always *out*
475
484
 
476
485
  Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** always true
477
486
 
478
- ## isIn
487
+ ## SendReceiveEndpoint
488
+
489
+ **Extends SendEndpoint**
490
+
491
+ bi directional endpint
492
+
493
+ ### isIn
479
494
 
480
495
  Always receiving.
481
496
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kronos-integration/endpoint",
3
- "version": "9.5.2",
3
+ "version": "9.5.3",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
package/src/endpoint.mjs CHANGED
@@ -6,13 +6,16 @@ import { Interceptor } from "@kronos-integration/interceptor";
6
6
 
7
7
  /**
8
8
  * Connection endpoint.
9
- * @param {string} name endpoint name
10
- * @param {Object} owner of the endpoint (service)
11
- * @param {Object} options
12
- * @param {Function} [options.didConnect] called after receiver is present
13
- * @param {Interceptor|Object[]} [options.interceptors] interceptors
14
9
  */
10
+
15
11
  export class Endpoint {
12
+ /**
13
+ * @param {string} name endpoint name
14
+ * @param {Object} owner of the endpoint (service)
15
+ * @param {Object} options
16
+ * @param {function(Endpoint,Endpoint):void} [options.didConnect] called after receiver is present
17
+ * @param {Interceptor[]|string[]} [options.interceptors] interceptors
18
+ */
16
19
  constructor(name, owner, options) {
17
20
  this.name = name;
18
21
  this.owner = owner;
@@ -62,7 +65,7 @@ export class Endpoint {
62
65
  }
63
66
 
64
67
  /**
65
- *
68
+ *
66
69
  * @param {Object} options
67
70
  */
68
71
  connectionNamesWithStates(options = { includeRuntimeInfo: true }) {
@@ -311,22 +314,27 @@ export class Endpoint {
311
314
  }
312
315
 
313
316
  /**
314
- * @return {Iterable<any>}
317
+ * @return {Iterable<Endpoint>}
315
318
  */
316
319
  *connections() {}
317
320
 
318
321
  /**
319
- *
320
- * @param {any} connection
322
+ *
323
+ * @param {Endpoint} connection
321
324
  */
322
325
  addConnection(connection) {}
323
326
 
324
- removeConnection() {}
327
+ /**
328
+ * Actually stop the communication.
329
+ * @param {Endpoint} other
330
+ * @param {boolean?} backpointer true if this is the call form back call from the other side
331
+ */
332
+ removeConnection(other, backpointer) {}
325
333
 
326
334
  /**
327
335
  * Deliver state for a given connection.
328
336
  * @param {Endpoint} other
329
- * @return {ConnectionState}
337
+ * @return {ConnectionState}
330
338
  */
331
339
  getConnectionState(other) {}
332
340
 
@@ -337,7 +345,12 @@ export class Endpoint {
337
345
  */
338
346
  setConnectionState(other, state) {}
339
347
 
340
- didConnect(a,b) {}
348
+ /**
349
+ *
350
+ * @param {Endpoint} endpoint
351
+ * @param {Endpoint} other
352
+ */
353
+ didConnect(endpoint, other) {}
341
354
 
342
355
  get receivingInterceptors() {
343
356
  return [];
@@ -355,7 +368,7 @@ export function isEndpoint(object) {
355
368
 
356
369
  /**
357
370
  * Instanciate interceptors from its definitions.
358
- * @param {Interceptor[]|string[]} interceptors
371
+ * @param {Interceptor[]|string[]|undefined} interceptors
359
372
  * @param {Object} owner
360
373
  * @return {Interceptor[]}
361
374
  */
@@ -51,6 +51,11 @@ export class MultiConnectionEndpoint extends ReceivableEndpoint {
51
51
  }
52
52
  }
53
53
 
54
+ /**
55
+ * Actually stop the communication.
56
+ * @param {Endpoint} other
57
+ * @param {boolean?} backpointer true if this is the call form back call from the other side
58
+ */
54
59
  removeConnection(other, backpointer) {
55
60
  this.closeConnection(other);
56
61
  this.#connections.delete(other);
@@ -74,6 +74,11 @@ export class SendEndpoint extends ReceivableEndpoint {
74
74
  }
75
75
  }
76
76
 
77
+ /**
78
+ * Actually stop the communication.
79
+ * @param {Endpoint} other
80
+ * @param {boolean?} backpointer true if this is the call form back call from the other side
81
+ */
77
82
  removeConnection(other, backpointer) {
78
83
  this.closeConnection(other);
79
84
 
@@ -6,27 +6,37 @@
6
6
  export function isEndpoint(object: any): boolean;
7
7
  /**
8
8
  * Instanciate interceptors from its definitions.
9
- * @param {Interceptor[]|string[]} interceptors
9
+ * @param {Interceptor[]|string[]|undefined} interceptors
10
10
  * @param {Object} owner
11
11
  * @return {Interceptor[]}
12
12
  */
13
- export function instanciateInterceptors(interceptors: Interceptor[] | string[], owner: any): Interceptor[];
13
+ export function instanciateInterceptors(interceptors: Interceptor[] | string[] | undefined, owner: any): Interceptor[];
14
14
  /**
15
15
  * @typedef {Object} ConnectionState
16
16
  */
17
17
  /**
18
18
  * Connection endpoint.
19
- * @param {string} name endpoint name
20
- * @param {Object} owner of the endpoint (service)
21
- * @param {Object} options
22
- * @param {Function} [options.didConnect] called after receiver is present
23
- * @param {Interceptor|Object[]} [options.interceptors] interceptors
24
19
  */
25
20
  export class Endpoint {
26
- constructor(name: any, owner: any, options: any);
27
- name: any;
21
+ /**
22
+ * @param {string} name endpoint name
23
+ * @param {Object} owner of the endpoint (service)
24
+ * @param {Object} options
25
+ * @param {function(Endpoint,Endpoint):void} [options.didConnect] called after receiver is present
26
+ * @param {Interceptor[]|string[]} [options.interceptors] interceptors
27
+ */
28
+ constructor(name: string, owner: any, options: {
29
+ didConnect?: (arg0: Endpoint, arg1: Endpoint) => void;
30
+ interceptors?: Interceptor[] | string[];
31
+ });
32
+ name: string;
28
33
  owner: any;
29
- didConnect(a: any, b: any): void;
34
+ /**
35
+ *
36
+ * @param {Endpoint} endpoint
37
+ * @param {Endpoint} other
38
+ */
39
+ didConnect(endpoint: Endpoint, other: Endpoint): void;
30
40
  interceptors: Interceptor[];
31
41
  /**
32
42
  * Name as presented for humans.
@@ -54,9 +64,9 @@ export class Endpoint {
54
64
  *
55
65
  * @param {Object} options
56
66
  */
57
- connectionNamesWithStates(options?: any): any[];
58
- toString(): any;
59
- get identifier(): any;
67
+ connectionNamesWithStates(options?: any): string[];
68
+ toString(): string;
69
+ get identifier(): string;
60
70
  /**
61
71
  * @return {boolean} false
62
72
  */
@@ -75,7 +85,7 @@ export class Endpoint {
75
85
  out: boolean;
76
86
  open: boolean;
77
87
  dummy: boolean;
78
- connected: any;
88
+ connected: string | string[];
79
89
  interceptors: any[];
80
90
  };
81
91
  /**
@@ -87,7 +97,7 @@ export class Endpoint {
87
97
  out: boolean;
88
98
  open: boolean;
89
99
  dummy: boolean;
90
- connected: any;
100
+ connected: string | string[];
91
101
  interceptors: any[];
92
102
  };
93
103
  /**
@@ -133,15 +143,20 @@ export class Endpoint {
133
143
  */
134
144
  closeConnections(): void;
135
145
  /**
136
- * @return {Iterable<any>}
146
+ * @return {Iterable<Endpoint>}
137
147
  */
138
- connections(): Iterable<any>;
148
+ connections(): Iterable<Endpoint>;
139
149
  /**
140
150
  *
141
- * @param {any} connection
151
+ * @param {Endpoint} connection
152
+ */
153
+ addConnection(connection: Endpoint): void;
154
+ /**
155
+ * Actually stop the communication.
156
+ * @param {Endpoint} other
157
+ * @param {boolean?} backpointer true if this is the call form back call from the other side
142
158
  */
143
- addConnection(connection: any): void;
144
- removeConnection(): void;
159
+ removeConnection(other: Endpoint, backpointer: boolean | null): void;
145
160
  /**
146
161
  * Deliver state for a given connection.
147
162
  * @param {Endpoint} other
@@ -4,7 +4,6 @@
4
4
  */
5
5
  export class MultiConnectionEndpoint extends ReceivableEndpoint {
6
6
  addConnection(other: any, backpointer: any): void;
7
- removeConnection(other: any, backpointer: any): void;
8
7
  /**
9
8
  * All connections
10
9
  */
@@ -6,6 +6,7 @@
6
6
  * @param {Function} [options.receivingInterceptors]
7
7
  */
8
8
  export class ReceivableEndpoint extends Endpoint {
9
+ constructor(name: any, owner: any, options: any);
9
10
  /**
10
11
  * Set the receive function.
11
12
  * @param {Function} receive
@@ -3,14 +3,7 @@
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;
12
6
  isConnected(other: any): boolean;
13
7
  send(...args: any[]): Promise<any>;
14
8
  }
15
9
  import { ReceiveEndpointDefault } from "./receive-endpoint-default.mjs";
16
- import { Endpoint } from "./endpoint.mjs";
@@ -12,7 +12,6 @@ export class SendEndpoint extends ReceivableEndpoint {
12
12
  getConnectionState(other: any): any;
13
13
  setConnectionState(other: any, state: any): void;
14
14
  addConnection(other: any, backpointer: any): void;
15
- removeConnection(other: any, backpointer: any): void;
16
15
  connections(): Generator<any, void, unknown>;
17
16
  send(...args: any[]): Promise<any>;
18
17
  #private;