@kronos-integration/service 11.2.0 → 11.2.2

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,24 +1,12 @@
1
- Copyright (c) 2015-2024 darlenya & arlac77
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without
5
- modification, are permitted provided that the following conditions are met:
6
-
7
- * Redistributions of source code must retain the above copyright notice, this
8
- list of conditions and the following disclaimer.
9
-
10
- * Redistributions in binary form must reproduce the above copyright notice,
11
- this list of conditions and the following disclaimer in the documentation
12
- and/or other materials provided with the distribution.
13
-
14
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
18
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
-
1
+ Copyright (C) 2015-2025 by darlenya & arlac77
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any
4
+ purpose with or without fee is hereby granted.
5
+
6
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
7
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
8
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
9
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
10
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
11
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
12
+ PERFORMANCE OF THIS SOFTWARE.
package/README.md CHANGED
@@ -1,8 +1,5 @@
1
- [![npm](https://img.shields.io/npm/v/@kronos-integration/service.svg)](https://www.npmjs.com/package/@kronos-integration/service)
2
- [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
1
+ [![License](https://img.shields.io/badge/License-0BSD-blue.svg)](https://spdx.org/licenses/0BSD.html)
3
2
  [![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript\&label\&labelColor=blue\&color=555555)](https://typescriptlang.org)
4
- [![bundlejs](https://deno.bundlejs.com/?q=@kronos-integration/service\&badge=detailed)](https://bundlejs.com/?q=@kronos-integration/service)
5
- [![downloads](http://img.shields.io/npm/dm/@kronos-integration/service.svg?style=flat-square)](https://npmjs.org/package/@kronos-integration/service)
6
3
  [![GitHub Issues](https://img.shields.io/github/issues/Kronos-Integration/service.svg?style=flat-square)](https://github.com/Kronos-Integration/service/issues)
7
4
  [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FKronos-Integration%2Fservice%2Fbadge\&style=flat)](https://actions-badge.atrox.dev/Kronos-Integration/service/goto)
8
5
  [![Styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
@@ -67,18 +64,16 @@ The transitions are:
67
64
  * [autostart](#autostart-1)
68
65
  * [name](#name-1)
69
66
  * [endpoints](#endpoints-1)
70
- * [ServiceProviderMixin](#serviceprovidermixin)
71
- * [Parameters](#parameters-7)
72
67
  * [Service](#service)
73
- * [Parameters](#parameters-8)
68
+ * [Parameters](#parameters-7)
74
69
  * [Properties](#properties-1)
75
70
  * [extendetName](#extendetname)
76
71
  * [stateChanged](#statechanged)
77
- * [Parameters](#parameters-9)
72
+ * [Parameters](#parameters-8)
78
73
  * [rejectWrongState](#rejectwrongstate)
79
- * [Parameters](#parameters-10)
74
+ * [Parameters](#parameters-9)
80
75
  * [timeoutForTransition](#timeoutfortransition)
81
- * [Parameters](#parameters-11)
76
+ * [Parameters](#parameters-10)
82
77
  * [\_start](#_start)
83
78
  * [\_stop](#_stop)
84
79
  * [\_restart](#_restart)
@@ -87,15 +82,15 @@ The transitions are:
87
82
  * [isServiceProvider](#isserviceprovider)
88
83
  * [toString](#tostring)
89
84
  * [toJSONWithOptions](#tojsonwithoptions)
90
- * [Parameters](#parameters-12)
85
+ * [Parameters](#parameters-11)
91
86
  * [name](#name-2)
92
87
  * [autostart](#autostart-2)
93
88
  * [\_configure](#_configure)
94
- * [Parameters](#parameters-13)
89
+ * [Parameters](#parameters-12)
95
90
  * [configure](#configure-1)
96
- * [Parameters](#parameters-14)
91
+ * [Parameters](#parameters-13)
97
92
  * [log](#log)
98
- * [Parameters](#parameters-15)
93
+ * [Parameters](#parameters-14)
99
94
  * [configurationAttributes](#configurationattributes)
100
95
  * [endpoints](#endpoints-2)
101
96
  * [StandaloneServiceProvider](#standaloneserviceprovider)
@@ -215,18 +210,6 @@ Adds a log input endpoint to the set of Service endpoints.
215
210
 
216
211
  Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** predefined endpoints
217
212
 
218
- ## ServiceProviderMixin
219
-
220
- Provide services and hold service configuration.
221
- By default a service provider has two build in services
222
- 'logger' and 'config'.
223
-
224
- ### Parameters
225
-
226
- * `superclass`  
227
- * `serviceLoggerClass` (optional, default `ServiceLogger`)
228
- * `serviceConfigClass` (optional, default `ServiceConfig`)
229
-
230
213
  ## Service
231
214
 
232
215
  **Extends EndpointsMixin(StateTransitionMixin(LogLevelMixin(class {}), prepareActions({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kronos-integration/service",
3
- "version": "11.2.0",
3
+ "version": "11.2.2",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -25,19 +25,19 @@
25
25
  ],
26
26
  "license": "BSD-2-Clause",
27
27
  "scripts": {
28
- "prepare": "npm run prepare:typescript",
29
- "prepare:typescript": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types --resolveJsonModule -t esnext -m esnext --module nodenext --moduleResolution nodenext --rootDir src ./src**/*.mjs",
30
- "test": "npm run test:ava",
28
+ "prepare": "node --run prepare:typescript",
29
+ "prepare:typescript": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types --resolveJsonModule --target es2024 --lib es2024 -m esnext --module nodenext --moduleResolution nodenext --rootDir src ./src**/*.mjs",
30
+ "test": "node --run test:ava",
31
31
  "test:ava": "ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
32
32
  "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
33
  "docs": "documentation readme --section=API ./src/**/*.mjs",
34
- "lint": "npm run lint:docs && npm run lint:typescript",
34
+ "lint": "node --run lint:docs && node --run lint:typescript",
35
35
  "lint:docs": "documentation lint ./src/**/*.mjs",
36
- "lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
36
+ "lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target es2024 --lib es2024 -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
37
37
  },
38
38
  "dependencies": {
39
- "@kronos-integration/endpoint": "^9.5.5",
40
- "@kronos-integration/interceptor": "^10.3.0",
39
+ "@kronos-integration/endpoint": "^9.5.6",
40
+ "@kronos-integration/interceptor": "^10.3.2",
41
41
  "loglevel-mixin": "^7.2.2",
42
42
  "model-attributes": "^4.2.2",
43
43
  "remove-sensible-values": "^1.3.1",
@@ -47,11 +47,11 @@
47
47
  "ava": "^6.1.3",
48
48
  "c8": "^10.1.2",
49
49
  "documentation": "^14.0.3",
50
- "semantic-release": "^24.1.1",
51
- "typescript": "^5.6.2"
50
+ "semantic-release": "^24.1.2",
51
+ "typescript": "^5.7.0-beta"
52
52
  },
53
53
  "engines": {
54
- "node": ">=22.9.0"
54
+ "node": ">=22.11.0"
55
55
  },
56
56
  "repository": {
57
57
  "type": "git",
@@ -54,15 +54,17 @@ export function EndpointsMixin(superclass) {
54
54
  const receive = definition.receive;
55
55
 
56
56
  if (typeof receive === "string") {
57
- if (typeof this[receive] === "function") {
58
- definition.receive = (...args) => this[receive](...args);
59
- } else {
60
- if (this[receive] === undefined) {
61
- throw new Error(
62
- `No sucht method or property ${this.name}.${receive}`
63
- );
64
- }
65
- definition.receive = () => this[receive];
57
+ switch(typeof this[receive]) {
58
+ case "function":
59
+ definition.receive = (...args) => this[receive](...args);
60
+ break;
61
+ default:
62
+ definition.receive = () => this[receive];
63
+ break;
64
+ case "undefined":
65
+ throw new Error(
66
+ `No sucht method or property ${this.name}.${receive}`
67
+ );
66
68
  }
67
69
  }
68
70
  }
@@ -193,9 +195,7 @@ export function EndpointsMixin(superclass) {
193
195
  const serviceProvider = this.owner;
194
196
  const service = serviceName.length === 0 ? serviceProvider : serviceProvider.getService(serviceName);
195
197
 
196
- return service
197
- ? service.endpointForExpression(suffixExpression)
198
- : undefined;
198
+ return service?.endpointForExpression(suffixExpression);
199
199
  }
200
200
 
201
201
  if (from !== undefined) {
@@ -4,4 +4,4 @@
4
4
  * @param {new() => superclass} superclass class to be extended
5
5
  * @return {new() => superclass} extended class
6
6
  */
7
- export function EndpointsMixin(superclass: new () => new () => any): new () => new () => any;
7
+ export function EndpointsMixin(superclass: new () => new () => /*elided*/ any): new () => new () => /*elided*/ any;
@@ -6,7 +6,7 @@
6
6
  * @param {new(Object,InitializationContext) => serviceLoggerClass} serviceLoggerClass where the logging houtd go
7
7
  * @param {new(Object,InitializationContext) => serviceConfigClass} serviceConfigClass where the config comes from
8
8
  */
9
- export function ServiceProviderMixin(superclass: any, serviceLoggerClass?: new (Object: any, InitializationContext: any) => new (Object: any, InitializationContext: any) => any, serviceConfigClass?: new (Object: any, InitializationContext: any) => new (Object: any, InitializationContext: any) => any): {
9
+ export function ServiceProviderMixin(superclass: any, serviceLoggerClass?: new (Object: any, InitializationContext: any) => new (Object: any, InitializationContext: any) => /*elided*/ any, serviceConfigClass?: new (Object: any, InitializationContext: any) => new (Object: any, InitializationContext: any) => /*elided*/ any): {
10
10
  new (config: any, ic?: any): {
11
11
  [x: string]: any;
12
12
  listeners: {};
@@ -21,7 +21,7 @@ export function ServiceProviderMixin(superclass: any, serviceLoggerClass?: new (
21
21
  * By default be our own owner.
22
22
  * @return this
23
23
  */
24
- readonly owner: any;
24
+ readonly owner: /*elided*/ any;
25
25
  /**
26
26
  * We are the service provider.
27
27
  * @return {boolean} true
@@ -40,7 +40,7 @@ export function ServiceProviderMixin(superclass: any, serviceLoggerClass?: new (
40
40
  * @param {new() => factory} factory
41
41
  * @returns {new() => factory} factory
42
42
  */
43
- registerInterceptorFactory(factory: new () => new () => any): new () => new () => any;
43
+ registerInterceptorFactory(factory: new () => new () => /*elided*/ any): new () => new () => /*elided*/ any;
44
44
  unregisterInterceptorFactory(factory: any): void;
45
45
  /**
46
46
  * Instanciates an interceptor from its definition data.
@@ -1,4 +1,4 @@
1
- declare const Service_base: new () => new () => any;
1
+ declare const Service_base: new () => new () => /*elided*/ any;
2
2
  /**
3
3
  * Service
4
4
  * The initial state is 'stopped'.
@@ -9,10 +9,10 @@ declare const StandaloneServiceProvider_base: {
9
9
  emit(name: any, ...args: any[]): void;
10
10
  addListener(name: any, listener: any): void;
11
11
  removeListener(name: any, listener: any): void;
12
- readonly owner: any;
12
+ readonly owner: /*elided*/ any;
13
13
  readonly isServiceProvider: boolean;
14
14
  registerFactories(factories: [Function | string]): Promise<void>;
15
- registerInterceptorFactory(factory: new () => new () => any): new () => new () => any;
15
+ registerInterceptorFactory(factory: new () => new () => /*elided*/ any): new () => new () => /*elided*/ any;
16
16
  unregisterInterceptorFactory(factory: any): void;
17
17
  instantiateInterceptor(definition: any): import("@kronos-integration/interceptor").Interceptor;
18
18
  serviceStateChanged(service: any, oldState: any, newState: any): void;