@kronos-integration/service 12.0.5 → 13.0.0
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/package.json +4 -4
- package/src/service.mjs +11 -13
- package/types/service.d.mts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kronos-integration/service",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -36,10 +36,10 @@
|
|
|
36
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": "^10.0.
|
|
40
|
-
"@kronos-integration/interceptor": "^
|
|
39
|
+
"@kronos-integration/endpoint": "^10.0.5",
|
|
40
|
+
"@kronos-integration/interceptor": "^12.0.0",
|
|
41
41
|
"loglevel-mixin": "^7.2.5",
|
|
42
|
-
"pacc": "^3.
|
|
42
|
+
"pacc": "^3.8.0",
|
|
43
43
|
"remove-sensible-values": "^1.3.1",
|
|
44
44
|
"statetransition-mixin": "^8.1.3"
|
|
45
45
|
},
|
package/src/service.mjs
CHANGED
|
@@ -3,16 +3,14 @@ import { prepareActions, StateTransitionMixin } from "statetransition-mixin";
|
|
|
3
3
|
import {
|
|
4
4
|
prepareAttributesDefinitions,
|
|
5
5
|
getAttributes,
|
|
6
|
-
setAttributes
|
|
6
|
+
setAttributes,
|
|
7
|
+
description_attribute
|
|
7
8
|
} from "pacc";
|
|
8
9
|
import { EndpointsMixin } from "./endpoints-mixin.mjs";
|
|
9
10
|
import { InitializationContext } from "./initialization-context.mjs";
|
|
10
11
|
|
|
11
|
-
const
|
|
12
|
-
description:
|
|
13
|
-
type: "string",
|
|
14
|
-
description: "human readable description of the service"
|
|
15
|
-
},
|
|
12
|
+
const ATTRIBUTES = prepareAttributesDefinitions({
|
|
13
|
+
description: description_attribute,
|
|
16
14
|
logLevel: {
|
|
17
15
|
description: `logging level one of: ${Object.keys(defaultLogLevels)}`,
|
|
18
16
|
default: defaultLogLevels.info,
|
|
@@ -122,8 +120,8 @@ export class Service extends EndpointsMixin(
|
|
|
122
120
|
* The Service class only defines the logLevel, and start/stop/restart timeout attribute
|
|
123
121
|
* @return {Object}
|
|
124
122
|
*/
|
|
125
|
-
static get
|
|
126
|
-
return
|
|
123
|
+
static get attributes() {
|
|
124
|
+
return ATTRIBUTES;
|
|
127
125
|
}
|
|
128
126
|
|
|
129
127
|
/**
|
|
@@ -181,8 +179,8 @@ export class Service extends EndpointsMixin(
|
|
|
181
179
|
return this.owner.instantiateInterceptor(options);
|
|
182
180
|
}
|
|
183
181
|
|
|
184
|
-
get
|
|
185
|
-
return this.constructor.
|
|
182
|
+
get attributes() {
|
|
183
|
+
return this.constructor.attributes;
|
|
186
184
|
}
|
|
187
185
|
|
|
188
186
|
get type() {
|
|
@@ -357,7 +355,7 @@ export class Service extends EndpointsMixin(
|
|
|
357
355
|
}
|
|
358
356
|
|
|
359
357
|
if (options.includeConfig) {
|
|
360
|
-
let atts = getAttributes(this, this.
|
|
358
|
+
let atts = getAttributes(this, this.attributes);
|
|
361
359
|
|
|
362
360
|
if (!options.includePrivate) {
|
|
363
361
|
atts = Object.fromEntries(
|
|
@@ -406,7 +404,7 @@ export class Service extends EndpointsMixin(
|
|
|
406
404
|
/**
|
|
407
405
|
* Takes attribute values from config parameters
|
|
408
406
|
* and copies them over to the object.
|
|
409
|
-
* Copying is done according to
|
|
407
|
+
* Copying is done according to attributes.
|
|
410
408
|
* Which means we loop over all configuration attributes.
|
|
411
409
|
* and then for each attribute decide if we use the default, call a setter function
|
|
412
410
|
* or simply assign the attribute value.
|
|
@@ -418,7 +416,7 @@ export class Service extends EndpointsMixin(
|
|
|
418
416
|
setAttributes(
|
|
419
417
|
this,
|
|
420
418
|
config,
|
|
421
|
-
this.
|
|
419
|
+
this.attributes,
|
|
422
420
|
(ca, path, value) => {
|
|
423
421
|
this.trace(level => {
|
|
424
422
|
if (ca.private) {
|
package/types/service.d.mts
CHANGED
|
@@ -26,7 +26,7 @@ export class Service extends Service_base {
|
|
|
26
26
|
* The Service class only defines the logLevel, and start/stop/restart timeout attribute
|
|
27
27
|
* @return {Object}
|
|
28
28
|
*/
|
|
29
|
-
static get
|
|
29
|
+
static get attributes(): any;
|
|
30
30
|
/**
|
|
31
31
|
* Definition of the predefined endpoints.
|
|
32
32
|
* - log _out_
|
|
@@ -38,7 +38,7 @@ export class Service extends Service_base {
|
|
|
38
38
|
owner: any;
|
|
39
39
|
logLevel: any;
|
|
40
40
|
instantiateInterceptor(options: any): any;
|
|
41
|
-
get
|
|
41
|
+
get attributes(): any;
|
|
42
42
|
get type(): string;
|
|
43
43
|
set description(desc: any);
|
|
44
44
|
get description(): any;
|
|
@@ -124,7 +124,7 @@ export class Service extends Service_base {
|
|
|
124
124
|
/**
|
|
125
125
|
* Takes attribute values from config parameters
|
|
126
126
|
* and copies them over to the object.
|
|
127
|
-
* Copying is done according to
|
|
127
|
+
* Copying is done according to attributes.
|
|
128
128
|
* Which means we loop over all configuration attributes.
|
|
129
129
|
* and then for each attribute decide if we use the default, call a setter function
|
|
130
130
|
* or simply assign the attribute value.
|