@kronos-integration/endpoint 9.4.44 → 9.4.45

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2016-2023 by darlenya & arlac77
1
+ Copyright (c) 2016-2024 by darlenya & arlac77
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
package/README.md CHANGED
@@ -117,7 +117,7 @@ Connection endpoint.
117
117
 
118
118
  * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** endpoint name
119
119
  * `owner` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** of the endpoint (service)
120
- * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `{}`)
120
+ * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
121
121
 
122
122
  * `options.didConnect` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** called after receiver is present
123
123
  * `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
@@ -259,7 +259,7 @@ Can hold several connections.
259
259
 
260
260
  * `name` &#x20;
261
261
  * `owner` &#x20;
262
- * `options` (optional, default `{}`)
262
+ * `options` &#x20;
263
263
 
264
264
  ### getConnectionState
265
265
 
@@ -413,7 +413,7 @@ Back connections to any further endpoints will not be established
413
413
 
414
414
  * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** endpoint name
415
415
  * `owner` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** of the endpoint (service)
416
- * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `{}`)
416
+ * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
417
417
 
418
418
  * `options.connected` **[Endpoint](#endpoint)?** where te requests are delivered to
419
419
  * `options.didConnect` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** called after receiver is present
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kronos-integration/endpoint",
3
- "version": "9.4.44",
3
+ "version": "9.4.45",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,13 +34,13 @@
34
34
  "@kronos-integration/interceptor": "^10.2.37"
35
35
  },
36
36
  "devDependencies": {
37
- "ava": "^5.3.1",
38
- "c8": "^8.0.1",
37
+ "ava": "^6.0.1",
38
+ "c8": "^9.0.0",
39
39
  "documentation": "^14.0.2",
40
- "semantic-release": "^22.0.7"
40
+ "semantic-release": "^22.0.12"
41
41
  },
42
42
  "engines": {
43
- "node": ">=20.9.0"
43
+ "node": ">=20.10.0"
44
44
  },
45
45
  "repository": {
46
46
  "type": "git",
package/src/endpoint.mjs CHANGED
@@ -1,5 +1,9 @@
1
1
  import { Interceptor } from "@kronos-integration/interceptor";
2
2
 
3
+ /**
4
+ * @typedef {Object} ConnectionState
5
+ */
6
+
3
7
  /**
4
8
  * Connection endpoint.
5
9
  * @param {string} name endpoint name
@@ -10,19 +14,13 @@ import { Interceptor } from "@kronos-integration/interceptor";
10
14
  */
11
15
  export class Endpoint {
12
16
  constructor(name, owner, options) {
13
- const properties = {
14
- name: { value: name },
15
- owner: { value: owner }
16
- };
17
+ this.name = name;
18
+ this.owner = owner;
17
19
 
18
20
  if (options?.didConnect !== undefined) {
19
- properties.didConnect = {
20
- value: options.didConnect
21
- };
21
+ this.didConnect = options.didConnect;
22
22
  }
23
23
 
24
- Object.defineProperties(this, properties);
25
-
26
24
  this.interceptors = instanciateInterceptors(
27
25
  options?.interceptors,
28
26
  this.owner
@@ -299,7 +297,7 @@ export class Endpoint {
299
297
  */
300
298
  openConnections() {
301
299
  for (const c of this.connections()) {
302
- this.openConnection(c);
300
+ this.openConnection(c, false);
303
301
  }
304
302
  }
305
303
 
@@ -308,7 +306,7 @@ export class Endpoint {
308
306
  */
309
307
  closeConnections() {
310
308
  for (const c of this.connections()) {
311
- this.closeConnection(c);
309
+ this.closeConnection(c, false);
312
310
  }
313
311
  }
314
312
 
@@ -318,9 +316,19 @@ export class Endpoint {
318
316
 
319
317
  removeConnection() {}
320
318
 
321
- getConnectionState() {}
319
+ /**
320
+ * Deliver state for a given connection.
321
+ * @param {Endpoint} other
322
+ * @return {ConnectionState}
323
+ */
324
+ getConnectionState(other) {}
322
325
 
323
- setConnectionState() {}
326
+ /**
327
+ * Set state for a given connection.
328
+ * @param {Endpoint} other
329
+ * @param {ConnectionState} state
330
+ */
331
+ setConnectionState(other, state) {}
324
332
 
325
333
  didConnect() {}
326
334