@kronos-integration/service 15.1.1 → 15.1.3

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
@@ -1,11 +1,13 @@
1
+ [![npm](https://img.shields.io/npm/v/@kronos-integration/service.svg)](https://www.npmjs.com/package/@kronos-integration/service)
1
2
  [![License](https://img.shields.io/badge/License-0BSD-blue.svg)](https://spdx.org/licenses/0BSD.html)
2
3
  [![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)
3
6
  [![GitHub Issues](https://img.shields.io/github/issues/Kronos-Integration/service.svg?style=flat-square)](https://github.com/Kronos-Integration/service/issues)
4
7
  [![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)
5
8
  [![Styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
6
9
  [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
7
10
  [![Known Vulnerabilities](https://snyk.io/test/github/Kronos-Integration/service/badge.svg)](https://snyk.io/test/github/Kronos-Integration/service)
8
- [![Coverage Status](https://coveralls.io/repos/Kronos-Integration/service/badge.svg)](https://coveralls.io/github/Kronos-Integration/service)
9
11
 
10
12
  # @kronos-integration/service
11
13
 
@@ -136,6 +138,8 @@ Deliver configuration for a given service.
136
138
  * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** service name
137
139
  * `config` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
138
140
 
141
+ Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)>**&#x20;
142
+
139
143
  ### clearPreserved
140
144
 
141
145
  Forget about preserved config of a service.
@@ -246,12 +250,6 @@ All services have at least three endpoints:
246
250
  ### Parameters
247
251
 
248
252
  * `config` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**&#x20;
249
-
250
- * `config.name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
251
- * `config.logLevel` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
252
- * `config.autostart` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** defaults to false
253
- * `config.description` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** human readable description
254
- * `config.endpoints` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** will be merged with the build in ones
255
253
  * `ic` **InitializationContext**&#x20;
256
254
 
257
255
  ### Properties
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@kronos-integration/service",
3
- "version": "15.1.1",
3
+ "version": "15.1.3",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
7
7
  },
8
+ "packageManager": "npm@11.6.4+sha512.1118cab46a05a50aee6bff5b1b4fa1df18afff89d57465620a3518035026955db87c5bdf9d207b07b7487d99f2490d450cb774655ad63ec2cba7bf1d0ad25d45",
8
9
  "types": "./types/module.d.mts",
9
10
  "exports": {
10
11
  ".": {
11
- "default": "./src/module.mjs",
12
- "types": "./types/module.d.mts"
12
+ "types": "./types/module.d.mts",
13
+ "default": "./src/module.mjs"
13
14
  }
14
15
  },
15
16
  "description": "Base service implementation",
@@ -23,23 +24,23 @@
23
24
  "email": "markus.felten@gmx.de"
24
25
  }
25
26
  ],
26
- "license": "BSD-2-Clause",
27
+ "license": "0BSD",
27
28
  "scripts": {
28
29
  "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
+ "prepare:typescript": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types --resolveJsonModule --target esnext -m esnext --module nodenext --moduleResolution nodenext --rootDir src ./src**/*.mjs",
30
31
  "test": "node --run test:ava",
31
32
  "test:ava": "ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
32
33
  "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
- "docs": "documentation readme --section=API ./src/**/*.mjs",
34
+ "docs": "documentation readme --section=API ./src**/*.mjs",
34
35
  "lint": "node --run lint:docs && node --run lint:typescript",
35
- "lint:docs": "documentation lint ./src/**/*.mjs",
36
- "lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target es2024 --lib es2024 -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
36
+ "lint:docs": "documentation lint ./src**/*.mjs",
37
+ "lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
37
38
  },
38
39
  "dependencies": {
39
40
  "@kronos-integration/endpoint": "^11.0.5",
40
- "@kronos-integration/interceptor": "^13.0.6",
41
+ "@kronos-integration/interceptor": "^13.1.0",
41
42
  "loglevel-mixin": "^7.2.6",
42
- "pacc": "^5.1.0",
43
+ "pacc": "^6.1.0",
43
44
  "statetransition-mixin": "^8.1.4"
44
45
  },
45
46
  "devDependencies": {
@@ -66,6 +67,5 @@
66
67
  "arlac77/template-kronos-component",
67
68
  "arlac77/template-typescript"
68
69
  ]
69
- },
70
- "packageManager": "npm@11.6.4+sha512.1118cab46a05a50aee6bff5b1b4fa1df18afff89d57465620a3518035026955db87c5bdf9d207b07b7487d99f2490d450cb774655ad63ec2cba7bf1d0ad25d45"
70
+ }
71
71
  }
@@ -25,16 +25,14 @@ export class ServiceConfig extends Service {
25
25
  * Deliver configuration for a given service.
26
26
  * @param {string} name service name
27
27
  * @param {Object} config
28
+ * @returns {Promise<Object>}
28
29
  */
29
30
  async configFor(name, config) {
30
- this.trace(`configFor ${name}`);
31
-
32
31
  await this.start();
33
32
 
34
33
  const pc = this.preservedConfigs.get(name);
35
34
  if (pc !== undefined) {
36
35
  config = config === undefined ? pc : merge(config, pc);
37
- this.trace(`using preserved config ${name}`);
38
36
  }
39
37
 
40
38
  this.preservedConfigs.set(name, config);
package/src/service.mjs CHANGED
@@ -7,7 +7,8 @@ import {
7
7
  setAttributes,
8
8
  description_attribute,
9
9
  default_attribute,
10
- timeout_attribute
10
+ timeout_attribute,
11
+ object_attribute
11
12
  } from "pacc";
12
13
  import { EndpointsMixin } from "./endpoints-mixin.mjs";
13
14
  import { InitializationContext } from "./initialization-context.mjs";
@@ -35,13 +36,6 @@ const ssfDefault = {
35
36
  * - log _out_: log events
36
37
  * - config _in_: configuration request
37
38
  * - command _in_: administrative actions to be executed by the step
38
- * @param {Object} config
39
- * @param {string} config.name
40
- * @param {string} config.logLevel
41
- * @param {boolean} config.autostart defaults to false
42
- * @param {string} config.description human readable description
43
- * @param {Object} config.endpoints will be merged with the build in ones
44
- * @param {InitializationContext} ic
45
39
  *
46
40
  * @property {Object} endpoints
47
41
  */
@@ -95,6 +89,7 @@ export class Service extends EndpointsMixin(
95
89
  get: () => this.logLevel.name
96
90
  },
97
91
  timeout: {
92
+ ...object_attribute,
98
93
  attributes: {
99
94
  start: {
100
95
  ...timeout_attribute,
@@ -135,6 +130,15 @@ export class Service extends EndpointsMixin(
135
130
 
136
131
  #description;
137
132
 
133
+ /**
134
+ * @param {Object} config
135
+ * @param {string} config.name
136
+ * @param {string} config.logLevel
137
+ * @param {boolean} config.autostart defaults to false
138
+ * @param {string} config.description human readable description
139
+ * @param {Object} config.endpoints will be merged with the build in ones
140
+ * @param {InitializationContext} ic
141
+ */
138
142
  constructor(config, ic) {
139
143
  super();
140
144
 
@@ -18,6 +18,7 @@ export class ServiceConfig extends Service {
18
18
  * Deliver configuration for a given service.
19
19
  * @param {string} name service name
20
20
  * @param {Object} config
21
+ * @returns {Promise<Object>}
21
22
  */
22
23
  configFor(name: string, config: any): Promise<any>;
23
24
  /**
@@ -6,13 +6,6 @@ declare const Service_base: new () => new () => /*elided*/ any;
6
6
  * - log _out_: log events
7
7
  * - config _in_: configuration request
8
8
  * - command _in_: administrative actions to be executed by the step
9
- * @param {Object} config
10
- * @param {string} config.name
11
- * @param {string} config.logLevel
12
- * @param {boolean} config.autostart defaults to false
13
- * @param {string} config.description human readable description
14
- * @param {Object} config.endpoints will be merged with the build in ones
15
- * @param {InitializationContext} ic
16
9
  *
17
10
  * @property {Object} endpoints
18
11
  */
@@ -34,7 +27,22 @@ export class Service extends Service_base {
34
27
  * @return {Object} predefined endpoints
35
28
  */
36
29
  static get endpoints(): any;
37
- constructor(config: any, ic: any);
30
+ /**
31
+ * @param {Object} config
32
+ * @param {string} config.name
33
+ * @param {string} config.logLevel
34
+ * @param {boolean} config.autostart defaults to false
35
+ * @param {string} config.description human readable description
36
+ * @param {Object} config.endpoints will be merged with the build in ones
37
+ * @param {InitializationContext} ic
38
+ */
39
+ constructor(config: {
40
+ name: string;
41
+ logLevel: string;
42
+ autostart: boolean;
43
+ description: string;
44
+ endpoints: any;
45
+ }, ic: any);
38
46
  owner: any;
39
47
  instantiateInterceptor(options: any): any;
40
48
  get attributes(): any;