@kronos-integration/service 15.0.2 → 15.1.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 +13 -1
- package/package.json +4 -4
- package/src/service.mjs +20 -2
- package/types/service.d.mts +5 -0
package/README.md
CHANGED
|
@@ -91,8 +91,10 @@ The transitions are:
|
|
|
91
91
|
* [Parameters](#parameters-13)
|
|
92
92
|
* [getCredential](#getcredential)
|
|
93
93
|
* [Parameters](#parameters-14)
|
|
94
|
-
* [
|
|
94
|
+
* [getCredentials](#getcredentials)
|
|
95
95
|
* [Parameters](#parameters-15)
|
|
96
|
+
* [log](#log)
|
|
97
|
+
* [Parameters](#parameters-16)
|
|
96
98
|
* [attributes](#attributes)
|
|
97
99
|
* [endpoints](#endpoints-2)
|
|
98
100
|
* [StandaloneServiceProvider](#standaloneserviceprovider)
|
|
@@ -400,6 +402,16 @@ Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
|
400
402
|
|
|
401
403
|
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array))>** 
|
|
402
404
|
|
|
405
|
+
### getCredentials
|
|
406
|
+
|
|
407
|
+
Retrieve all credential attribute values.
|
|
408
|
+
|
|
409
|
+
#### Parameters
|
|
410
|
+
|
|
411
|
+
* `filter` (optional, default `(name,attribute)=>attribute.credential`)
|
|
412
|
+
|
|
413
|
+
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)>** 
|
|
414
|
+
|
|
403
415
|
### log
|
|
404
416
|
|
|
405
417
|
Adds service name to the log event.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kronos-integration/service",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.1.1",
|
|
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": "^11.0.
|
|
40
|
-
"@kronos-integration/interceptor": "^13.0.
|
|
39
|
+
"@kronos-integration/endpoint": "^11.0.5",
|
|
40
|
+
"@kronos-integration/interceptor": "^13.0.6",
|
|
41
41
|
"loglevel-mixin": "^7.2.6",
|
|
42
|
-
"pacc": "^5.
|
|
42
|
+
"pacc": "^5.1.0",
|
|
43
43
|
"statetransition-mixin": "^8.1.4"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
package/src/service.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defaultLogLevels, LogLevelMixin, makeLogEvent } from "loglevel-mixin";
|
|
2
2
|
import { prepareActions, StateTransitionMixin } from "statetransition-mixin";
|
|
3
3
|
import {
|
|
4
|
+
attributeIterator,
|
|
4
5
|
prepareAttributesDefinitions,
|
|
5
6
|
getAttributes,
|
|
6
7
|
setAttributes,
|
|
@@ -430,14 +431,31 @@ export class Service extends EndpointsMixin(
|
|
|
430
431
|
}
|
|
431
432
|
|
|
432
433
|
/**
|
|
433
|
-
*
|
|
434
|
-
* @param {string} key
|
|
434
|
+
*
|
|
435
|
+
* @param {string} key
|
|
435
436
|
* @returns {Promise<string|Uint8Array>}
|
|
436
437
|
*/
|
|
437
438
|
async getCredential(key) {
|
|
438
439
|
return this.owner.getCredential(this.name + "." + key, "utf8");
|
|
439
440
|
}
|
|
440
441
|
|
|
442
|
+
/**
|
|
443
|
+
* Retrieve all credential attribute values.
|
|
444
|
+
* @returns {Promise<Object>}
|
|
445
|
+
*/
|
|
446
|
+
async getCredentials(filter = (name, attribute) => attribute.credential) {
|
|
447
|
+
const credentials = {};
|
|
448
|
+
for (const [path, attribute] of attributeIterator(
|
|
449
|
+
this.attributes,
|
|
450
|
+
filter
|
|
451
|
+
)) {
|
|
452
|
+
const name = path.join(".");
|
|
453
|
+
credentials[name] = await this.getCredential(name);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
return credentials;
|
|
457
|
+
}
|
|
458
|
+
|
|
441
459
|
/**
|
|
442
460
|
* Adds service name to the log event.
|
|
443
461
|
* @param {string} level the log level
|
package/types/service.d.mts
CHANGED
|
@@ -146,6 +146,11 @@ export class Service extends Service_base {
|
|
|
146
146
|
* @returns {Promise<string|Uint8Array>}
|
|
147
147
|
*/
|
|
148
148
|
getCredential(key: string): Promise<string | Uint8Array>;
|
|
149
|
+
/**
|
|
150
|
+
* Retrieve all credential attribute values.
|
|
151
|
+
* @returns {Promise<Object>}
|
|
152
|
+
*/
|
|
153
|
+
getCredentials(filter?: (name: any, attribute: any) => any): Promise<any>;
|
|
149
154
|
/**
|
|
150
155
|
* Adds service name to the log event.
|
|
151
156
|
* @param {string} level the log level
|