@kronos-integration/service 13.0.0 → 13.0.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 +3 -3
- package/package.json +3 -3
- package/src/service.mjs +50 -59
- package/types/service.d.mts +1 -1
package/README.md
CHANGED
|
@@ -91,7 +91,7 @@ The transitions are:
|
|
|
91
91
|
* [Parameters](#parameters-13)
|
|
92
92
|
* [log](#log)
|
|
93
93
|
* [Parameters](#parameters-14)
|
|
94
|
-
* [
|
|
94
|
+
* [attributes](#attributes)
|
|
95
95
|
* [endpoints](#endpoints-2)
|
|
96
96
|
* [StandaloneServiceProvider](#standaloneserviceprovider)
|
|
97
97
|
* [name](#name-3)
|
|
@@ -366,7 +366,7 @@ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
|
366
366
|
|
|
367
367
|
Takes attribute values from config parameters
|
|
368
368
|
and copies them over to the object.
|
|
369
|
-
Copying is done according to
|
|
369
|
+
Copying is done according to attributes.
|
|
370
370
|
Which means we loop over all configuration attributes.
|
|
371
371
|
and then for each attribute decide if we use the default, call a setter function
|
|
372
372
|
or simply assign the attribute value.
|
|
@@ -399,7 +399,7 @@ Adds service name to the log event.
|
|
|
399
399
|
* `level` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the log level
|
|
400
400
|
* `arg` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** log content
|
|
401
401
|
|
|
402
|
-
###
|
|
402
|
+
### attributes
|
|
403
403
|
|
|
404
404
|
Meta information for the config attributes.
|
|
405
405
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kronos-integration/service",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@kronos-integration/endpoint": "^10.0.5",
|
|
40
|
-
"@kronos-integration/interceptor": "^12.0.
|
|
40
|
+
"@kronos-integration/interceptor": "^12.0.1",
|
|
41
41
|
"loglevel-mixin": "^7.2.5",
|
|
42
|
-
"pacc": "^3.
|
|
42
|
+
"pacc": "^3.9.0",
|
|
43
43
|
"remove-sensible-values": "^1.3.1",
|
|
44
44
|
"statetransition-mixin": "^8.1.3"
|
|
45
45
|
},
|
package/src/service.mjs
CHANGED
|
@@ -9,44 +9,6 @@ import {
|
|
|
9
9
|
import { EndpointsMixin } from "./endpoints-mixin.mjs";
|
|
10
10
|
import { InitializationContext } from "./initialization-context.mjs";
|
|
11
11
|
|
|
12
|
-
const ATTRIBUTES = prepareAttributesDefinitions({
|
|
13
|
-
description: description_attribute,
|
|
14
|
-
logLevel: {
|
|
15
|
-
description: `logging level one of: ${Object.keys(defaultLogLevels)}`,
|
|
16
|
-
default: defaultLogLevels.info,
|
|
17
|
-
type: "string",
|
|
18
|
-
set(newValue) {
|
|
19
|
-
if (newValue !== undefined) {
|
|
20
|
-
this.logLevel = newValue;
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
return false;
|
|
24
|
-
},
|
|
25
|
-
get() {
|
|
26
|
-
return this.logLevel.name;
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
timeout: {
|
|
30
|
-
attributes: {
|
|
31
|
-
start: {
|
|
32
|
-
description: "service start timeout",
|
|
33
|
-
type: "duration",
|
|
34
|
-
default: 20
|
|
35
|
-
},
|
|
36
|
-
stop: {
|
|
37
|
-
description: "service stop timeout",
|
|
38
|
-
type: "duration",
|
|
39
|
-
default: 20
|
|
40
|
-
},
|
|
41
|
-
restart: {
|
|
42
|
-
description: "service restart timeout",
|
|
43
|
-
type: "duration",
|
|
44
|
-
default: 20
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
12
|
const timeout = 30000;
|
|
51
13
|
|
|
52
14
|
const rsfDefault = {
|
|
@@ -120,9 +82,43 @@ export class Service extends EndpointsMixin(
|
|
|
120
82
|
* The Service class only defines the logLevel, and start/stop/restart timeout attribute
|
|
121
83
|
* @return {Object}
|
|
122
84
|
*/
|
|
123
|
-
static
|
|
124
|
-
|
|
125
|
-
|
|
85
|
+
static attributes = prepareAttributesDefinitions({
|
|
86
|
+
description: description_attribute,
|
|
87
|
+
logLevel: {
|
|
88
|
+
description: `logging level one of: ${Object.keys(defaultLogLevels)}`,
|
|
89
|
+
default: defaultLogLevels.info,
|
|
90
|
+
type: "string",
|
|
91
|
+
set(newValue) {
|
|
92
|
+
if (newValue !== undefined) {
|
|
93
|
+
this.logLevel = newValue;
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
return false;
|
|
97
|
+
},
|
|
98
|
+
get() {
|
|
99
|
+
return this.logLevel.name;
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
timeout: {
|
|
103
|
+
attributes: {
|
|
104
|
+
start: {
|
|
105
|
+
description: "service start timeout",
|
|
106
|
+
type: "duration",
|
|
107
|
+
default: 20
|
|
108
|
+
},
|
|
109
|
+
stop: {
|
|
110
|
+
description: "service stop timeout",
|
|
111
|
+
type: "duration",
|
|
112
|
+
default: 20
|
|
113
|
+
},
|
|
114
|
+
restart: {
|
|
115
|
+
description: "service restart timeout",
|
|
116
|
+
type: "duration",
|
|
117
|
+
default: 20
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
126
122
|
|
|
127
123
|
/**
|
|
128
124
|
* Definition of the predefined endpoints.
|
|
@@ -413,24 +409,19 @@ export class Service extends EndpointsMixin(
|
|
|
413
409
|
*/
|
|
414
410
|
_configure(config) {
|
|
415
411
|
const modified = new Set();
|
|
416
|
-
setAttributes(
|
|
417
|
-
this
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
};
|
|
430
|
-
});
|
|
431
|
-
modified.add(ca);
|
|
432
|
-
}
|
|
433
|
-
);
|
|
412
|
+
setAttributes(this, config, this.attributes, (ca, path, value) => {
|
|
413
|
+
this.trace(level => {
|
|
414
|
+
if (ca.private) {
|
|
415
|
+
value = "***";
|
|
416
|
+
}
|
|
417
|
+
return {
|
|
418
|
+
message: `config ${this.name}.${path}: ${JSON.stringify(value)}`,
|
|
419
|
+
attribute: path,
|
|
420
|
+
value: value
|
|
421
|
+
};
|
|
422
|
+
});
|
|
423
|
+
modified.add(ca);
|
|
424
|
+
});
|
|
434
425
|
return modified;
|
|
435
426
|
}
|
|
436
427
|
|
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
|
|
29
|
+
static attributes: any;
|
|
30
30
|
/**
|
|
31
31
|
* Definition of the predefined endpoints.
|
|
32
32
|
* - log _out_
|