@kronos-integration/endpoint 9.4.47 → 9.5.1

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
@@ -52,6 +52,7 @@ Named communication (end)-points inside of kronos
52
52
  * [Parameters](#parameters-5)
53
53
  * [openConnections](#openconnections)
54
54
  * [closeConnections](#closeconnections)
55
+ * [connections](#connections)
55
56
  * [getConnectionState](#getconnectionstate)
56
57
  * [Parameters](#parameters-6)
57
58
  * [setConnectionState](#setconnectionstate)
@@ -68,8 +69,8 @@ Named communication (end)-points inside of kronos
68
69
  * [Parameters](#parameters-12)
69
70
  * [isConnected](#isconnected-1)
70
71
  * [Parameters](#parameters-13)
71
- * [connections](#connections)
72
- * [connections](#connections-1)
72
+ * [connections](#connections-1)
73
+ * [connections](#connections-2)
73
74
  * [MultiSendEndpoint](#multisendendpoint)
74
75
  * [Parameters](#parameters-14)
75
76
  * [isOut](#isout-1)
@@ -82,14 +83,17 @@ Named communication (end)-points inside of kronos
82
83
  * [ReceiveEndpointDefault](#receiveendpointdefault)
83
84
  * [isDefault](#isdefault-1)
84
85
  * [ReceiveEndpointSelfConnectedDefault](#receiveendpointselfconnecteddefault)
86
+ * [removeConnection](#removeconnection)
87
+ * [Parameters](#parameters-17)
85
88
  * [ReceiveEndpoint](#receiveendpoint)
86
- * [Parameters](#parameters-17)
89
+ * [Parameters](#parameters-18)
87
90
  * [isIn](#isin-3)
88
91
  * [SendEndpointDefault](#sendendpointdefault)
89
92
  * [isDefault](#isdefault-2)
90
93
  * [SendEndpoint](#sendendpoint)
91
- * [Parameters](#parameters-18)
94
+ * [Parameters](#parameters-19)
92
95
  * [isOut](#isout-2)
96
+ * [isIn](#isin-4)
93
97
 
94
98
  ## DummyReceiveEndpoint
95
99
 
@@ -99,7 +103,7 @@ Dummy endpoints are used during construction of the endpoint mesh.
99
103
 
100
104
  ### receive
101
105
 
102
- dummy does nothing by intention
106
+ dummy does nothing by intention.
103
107
 
104
108
  ### isIn
105
109
 
@@ -177,7 +181,7 @@ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
177
181
 
178
182
  Deliver data flow direction.
179
183
 
180
- Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** delivers data flow direction 'in', 'out', 'inout' or undefined
184
+ Returns **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** delivers data flow direction 'in', 'out', 'inout' or undefined
181
185
 
182
186
  ### jsonAttributes
183
187
 
@@ -219,7 +223,7 @@ Actually start with the communication.
219
223
  #### Parameters
220
224
 
221
225
  * `other` **[Endpoint](#endpoint)** 
222
- * `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
226
+ * `backpointer` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** true if this is the call from back call from the other side
223
227
 
224
228
  ### closeConnection
225
229
 
@@ -228,7 +232,7 @@ Actually stop the communication.
228
232
  #### Parameters
229
233
 
230
234
  * `other` **[Endpoint](#endpoint)** 
231
- * `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
235
+ * `backpointer` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** true if this is the call from back call from the other side
232
236
 
233
237
  ### openConnections
234
238
 
@@ -238,6 +242,10 @@ Opens all connections.
238
242
 
239
243
  Closes all connections.
240
244
 
245
+ ### connections
246
+
247
+ Returns **Iterable\<any>**&#x20;
248
+
241
249
  ### getConnectionState
242
250
 
243
251
  Deliver state for a given connection.
@@ -400,6 +408,15 @@ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
400
408
 
401
409
  Receiving endpoint wich can also send to itself.
402
410
 
411
+ ### removeConnection
412
+
413
+ Actually stop the communication.
414
+
415
+ #### Parameters
416
+
417
+ * `other` **[Endpoint](#endpoint)**&#x20;
418
+ * `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
419
+
403
420
  ## ReceiveEndpoint
404
421
 
405
422
  **Extends MultiConnectionEndpoint**
@@ -431,7 +448,7 @@ Send Endpoint acting as a default endpoints.
431
448
 
432
449
  ### isDefault
433
450
 
434
- We are a default endpoint
451
+ We are a default endpoint.
435
452
 
436
453
  Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** always true
437
454
 
@@ -458,6 +475,12 @@ We are always *out*
458
475
 
459
476
  Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** always true
460
477
 
478
+ ## isIn
479
+
480
+ Always receiving.
481
+
482
+ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true
483
+
461
484
  # install
462
485
 
463
486
  With [npm](http://npmjs.org) do:
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@kronos-integration/endpoint",
3
- "version": "9.4.47",
3
+ "version": "9.5.1",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
7
7
  },
8
+ "types": "./types/module.d.mts",
8
9
  "exports": {
9
- ".": "./src/module.mjs"
10
+ ".": {
11
+ "types": "./types/module.d.mts",
12
+ "default": "./src/module.mjs"
13
+ }
10
14
  },
11
15
  "description": "named communication (end)-points inside of kronos",
12
16
  "keywords": [
@@ -24,6 +28,7 @@
24
28
  ],
25
29
  "license": "BSD-2-Clause",
26
30
  "scripts": {
31
+ "prepare": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs",
27
32
  "test": "npm run test:ava",
28
33
  "test:ava": "ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
29
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",
@@ -33,7 +38,7 @@
33
38
  "lint:tsc": "tsc --allowJs --checkJs --noEmit -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
34
39
  },
35
40
  "dependencies": {
36
- "@kronos-integration/interceptor": "^10.2.38"
41
+ "@kronos-integration/interceptor": "^10.3.0"
37
42
  },
38
43
  "devDependencies": {
39
44
  "ava": "^6.1.1",
@@ -6,7 +6,7 @@ import { Endpoint } from "./endpoint.mjs";
6
6
  */
7
7
  export class DummyReceiveEndpoint extends Endpoint {
8
8
  /**
9
- * dummy does nothing by intention
9
+ * dummy does nothing by intention.
10
10
  */
11
11
  async receive() {}
12
12
 
@@ -5,7 +5,7 @@ import { SendEndpoint } from "./send-endpoint.mjs";
5
5
  */
6
6
  export class SendEndpointDefault extends SendEndpoint {
7
7
  /**
8
- * We are a default endpoint
8
+ * We are a default endpoint.
9
9
  * @return {boolean} always true
10
10
  */
11
11
  get isDefault() {
@@ -1,6 +1,11 @@
1
1
  import { SendEndpoint } from "./send-endpoint.mjs";
2
2
 
3
3
  export class SendReceiveEndpoint extends SendEndpoint {
4
+
5
+ /**
6
+ * Always receiving.
7
+ * @return {boolean} true
8
+ */
4
9
  get isIn() {
5
10
  return true;
6
11
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Dummy endpoints are used during construction of the endpoint mesh.
3
+ *
4
+ */
5
+ export class DummyReceiveEndpoint extends Endpoint {
6
+ /**
7
+ * dummy does nothing by intention.
8
+ */
9
+ receive(): Promise<void>;
10
+ }
11
+ import { Endpoint } from "./endpoint.mjs";
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Check for Endpoint.
3
+ * @param {any} object to be checked
4
+ * @return {boolean} true if object is an Endpoint
5
+ */
6
+ export function isEndpoint(object: any): boolean;
7
+ /**
8
+ * Instanciate interceptors from its definitions.
9
+ * @param {Interceptor[]|Class[]|String[]} interceptors
10
+ * @param {Object} owner
11
+ * @return {Interceptor[]}
12
+ */
13
+ export function instanciateInterceptors(interceptors: Interceptor[] | Class[] | string[], owner: any): Interceptor[];
14
+ /**
15
+ * @typedef {Object} ConnectionState
16
+ */
17
+ /**
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
+ */
25
+ export class Endpoint {
26
+ constructor(name: any, owner: any, options: any);
27
+ name: any;
28
+ owner: any;
29
+ didConnect(a: any, b: any): void;
30
+ interceptors: Interceptor[];
31
+ /**
32
+ * Name as presented for humans.
33
+ * @return {string}
34
+ */
35
+ get displayName(): string;
36
+ /**
37
+ * Indicate whatever we are a default endpoint.
38
+ * Default means buildin.
39
+ * @return {boolean} false
40
+ */
41
+ get isDefault(): boolean;
42
+ /**
43
+ * Indicate whatever we are a dummy endpoint.
44
+ * Dummy endpoints are used duiring construction of the endpoint mesh.
45
+ * @return {boolean} false
46
+ */
47
+ get isDummy(): boolean;
48
+ /**
49
+ * Mapping of properties used in toString.
50
+ * @return {Object}
51
+ */
52
+ get toStringAttributes(): any;
53
+ /**
54
+ *
55
+ * @param {Object} options
56
+ */
57
+ connectionNamesWithStates(options?: any): any[];
58
+ toString(): any;
59
+ get identifier(): any;
60
+ /**
61
+ * @return {boolean} false
62
+ */
63
+ get isIn(): boolean;
64
+ /**
65
+ * @return {boolean} false
66
+ */
67
+ get isOut(): boolean;
68
+ /**
69
+ * Deliver data flow direction.
70
+ * @return {string|undefined} delivers data flow direction 'in', 'out', 'inout' or undefined
71
+ */
72
+ get direction(): string;
73
+ toJSON(): {
74
+ in: boolean;
75
+ out: boolean;
76
+ open: boolean;
77
+ dummy: boolean;
78
+ connected: any;
79
+ interceptors: any[];
80
+ };
81
+ /**
82
+ * Additional attributes to present in json output.
83
+ */
84
+ get jsonAttributes(): any[];
85
+ toJSONWithOptions(options: any): {
86
+ in: boolean;
87
+ out: boolean;
88
+ open: boolean;
89
+ dummy: boolean;
90
+ connected: any;
91
+ interceptors: any[];
92
+ };
93
+ /**
94
+ * @return {boolean} true if there is at least one interceptor assigned
95
+ */
96
+ get hasInterceptors(): boolean;
97
+ get isOpen(): boolean;
98
+ /**
99
+ * Can we form a connection to the other side.
100
+ * in to out and out to in.
101
+ * @param {Endpoint} other
102
+ * @return {boolean} true if we can be connected to the other endpoint
103
+ */
104
+ connectable(other: Endpoint): boolean;
105
+ /**
106
+ * @return {boolean} true if there is at least one connection
107
+ */
108
+ get hasConnections(): boolean;
109
+ /**
110
+ * Are we connected to a endpoint.
111
+ * @param {Endpoint} other to check for the connection
112
+ * @return {boolean} true if there is a connection to the other endpoint
113
+ */
114
+ isConnected(other: Endpoint): boolean;
115
+ /**
116
+ * Actually start with the communication.
117
+ * @param {Endpoint} other
118
+ * @param {boolean?} backpointer true if this is the call from back call from the other side
119
+ */
120
+ openConnection(other: Endpoint, backpointer: boolean | null): void;
121
+ /**
122
+ * Actually stop the communication.
123
+ * @param {Endpoint} other
124
+ * @param {boolean?} backpointer true if this is the call from back call from the other side
125
+ */
126
+ closeConnection(other: Endpoint, backpointer: boolean | null): void;
127
+ /**
128
+ * Opens all connections.
129
+ */
130
+ openConnections(): void;
131
+ /**
132
+ * Closes all connections.
133
+ */
134
+ closeConnections(): void;
135
+ /**
136
+ * @return {Iterable<any>}
137
+ */
138
+ connections(): Iterable<any>;
139
+ addConnection(): void;
140
+ removeConnection(): void;
141
+ /**
142
+ * Deliver state for a given connection.
143
+ * @param {Endpoint} other
144
+ * @return {ConnectionState}
145
+ */
146
+ getConnectionState(other: Endpoint): ConnectionState;
147
+ /**
148
+ * Set state for a given connection.
149
+ * @param {Endpoint} other
150
+ * @param {ConnectionState} state
151
+ */
152
+ setConnectionState(other: Endpoint, state: ConnectionState): void;
153
+ get receivingInterceptors(): any[];
154
+ }
155
+ export type ConnectionState = any;
156
+ import { Interceptor } from "@kronos-integration/interceptor";
@@ -0,0 +1,11 @@
1
+ export * from "./endpoint.mjs";
2
+ export * from "./receivable-endpoint.mjs";
3
+ export * from "./multi-connection-endpoint.mjs";
4
+ export * from "./send-endpoint.mjs";
5
+ export * from "./receive-endpoint.mjs";
6
+ export * from "./send-receive-endpoint.mjs";
7
+ export * from "./dummy-receive-endpoint.mjs";
8
+ export * from "./send-endpoint-default.mjs";
9
+ export * from "./multi-send-endpoint.mjs";
10
+ export * from "./receive-endpoint-default.mjs";
11
+ export * from "./receive-endpoint-self-connected-default.mjs";
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Multiple connection endpoint.
3
+ * Can hold several connections.
4
+ */
5
+ export class MultiConnectionEndpoint extends ReceivableEndpoint {
6
+ addConnection(other: any, backpointer: any): void;
7
+ removeConnection(other: any, backpointer: any): void;
8
+ /**
9
+ * All connections
10
+ */
11
+ connections(): Generator<Endpoint, void, undefined>;
12
+ #private;
13
+ }
14
+ import { ReceivableEndpoint } from "./receivable-endpoint.mjs";
15
+ import { Endpoint } from "./endpoint.mjs";
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Multiple Sending Endpoint.
3
+ * Can hold several connections.
4
+ * Back connections to any further endpoints will not be established
5
+ * @param {string} name endpoint name
6
+ * @param {Object} owner of the endpoint (service)
7
+ * @param {Object} options
8
+ * @param {Endpoint} [options.connected] where te requests are delivered to
9
+ * @param {Function} [options.didConnect] called after receiver is present
10
+ */
11
+ export class MultiSendEndpoint extends MultiConnectionEndpoint {
12
+ send(...args: any[]): void;
13
+ sendAndReceive(...args: any[]): AsyncGenerator<any, void, unknown>;
14
+ }
15
+ import { MultiConnectionEndpoint } from "./multi-connection-endpoint.mjs";
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @param {string} name endpoint name
3
+ * @param {Object} owner of the endpoint (service)
4
+ * @param {Object} options
5
+ * @param {Function} [options.receive] reciever function
6
+ * @param {Function} [options.receivingInterceptors]
7
+ */
8
+ export class ReceivableEndpoint extends Endpoint {
9
+ /**
10
+ * Set the receive function.
11
+ * @param {Function} receive
12
+ */
13
+ set receive(receive: Function);
14
+ /**
15
+ * Get the receive function.
16
+ * @return {Function}
17
+ */
18
+ get receive(): Function;
19
+ #private;
20
+ }
21
+ import { Endpoint } from "./endpoint.mjs";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Receive Endpoint acting as a default endpoints.
3
+ */
4
+ export class ReceiveEndpointDefault extends ReceiveEndpoint {
5
+ }
6
+ import { ReceiveEndpoint } from "./receive-endpoint.mjs";
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Receiving endpoint wich can also send to itself.
3
+ */
4
+ export class ReceiveEndpointSelfConnectedDefault extends ReceiveEndpointDefault {
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
+ isConnected(other: any): boolean;
13
+ send(...args: any[]): Promise<any>;
14
+ }
15
+ import { ReceiveEndpointDefault } from "./receive-endpoint-default.mjs";
16
+ import { Endpoint } from "./endpoint.mjs";
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Receiving Endpoint.
3
+ * Can receive from several endpoints.
4
+ * By default a dummy rejecting receiver is assigned
5
+ * @param {string} name endpoint name
6
+ * @param {Object} owner of the endpoint (service)
7
+ * @param {Object} options
8
+ * @param {Function} [options.receive] reciever function
9
+ * @param {Endpoint} [options.connected] sending side
10
+ */
11
+ export class ReceiveEndpoint extends MultiConnectionEndpoint {
12
+ }
13
+ import { MultiConnectionEndpoint } from "./multi-connection-endpoint.mjs";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Send Endpoint acting as a default endpoints.
3
+ */
4
+ export class SendEndpointDefault extends SendEndpoint {
5
+ }
6
+ import { SendEndpoint } from "./send-endpoint.mjs";
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Sending Endpoint.
3
+ * Can only hold one connection.
4
+ * Back connections to any further endpoints will not be established
5
+ * @param {string} name endpoint name
6
+ * @param {Object} owner of the endpoint (service)
7
+ * @param {Object} options
8
+ * @param {Endpoint} [options.connected] where te requests are delivered to
9
+ * @param {Function} [options.didConnect] called after receiver is present
10
+ */
11
+ export class SendEndpoint extends ReceivableEndpoint {
12
+ getConnectionState(other: any): any;
13
+ setConnectionState(other: any, state: any): void;
14
+ addConnection(other: any, backpointer: any): void;
15
+ removeConnection(other: any, backpointer: any): void;
16
+ connections(): Generator<any, void, unknown>;
17
+ send(...args: any[]): Promise<any>;
18
+ #private;
19
+ }
20
+ import { ReceivableEndpoint } from "./receivable-endpoint.mjs";
@@ -0,0 +1,3 @@
1
+ export class SendReceiveEndpoint extends SendEndpoint {
2
+ }
3
+ import { SendEndpoint } from "./send-endpoint.mjs";