@flowscripter/dynamic-cli-framework-api 1.4.1 → 1.5.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/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/src/Value.d.ts +6 -1
- package/dist/src/Value.d.ts.map +1 -1
- package/dist/src/service/core/KeyValueService.d.ts +48 -14
- package/dist/src/service/core/KeyValueService.d.ts.map +1 -1
- package/dist/src/service/core/KeyValueService.js +12 -1
- package/index.ts +6 -1
- package/package.json +1 -1
- package/src/Value.ts +7 -1
- package/src/service/core/KeyValueService.ts +52 -14
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { default as Argument } from "./src/argument/Argument.ts";
|
|
2
|
-
export type { SingleValueType, Values, ValueType, PopulatedSingleValueType, PopulatedValues, PopulatedValueType, } from "./src/Value.ts";
|
|
2
|
+
export type { SingleValueType, Values, ValueType, ValueNode, PopulatedSingleValueType, PopulatedValues, PopulatedValueType, } from "./src/Value.ts";
|
|
3
3
|
export { ValueTypeName, ComplexValueTypeName } from "./src/Value.ts";
|
|
4
4
|
export type { default as ComplexOption } from "./src/argument/ComplexOption.ts";
|
|
5
5
|
export { MAXIMUM_COMPLEX_OPTION_NESTING_DEPTH } from "./src/argument/ComplexOption.ts";
|
|
@@ -22,7 +22,8 @@ export type { default as AsciiBannerGeneratorService } from "./src/service/core/
|
|
|
22
22
|
export type { BannerColorEffects, BannerGenerateOptions, ColorEffect, ColorEffectDirection, FixedColorEffect, GradientColorEffect, RainbowColorEffect, } from "./src/service/core/AsciiBannerGeneratorService.ts";
|
|
23
23
|
export { KEY_VALUE_SERVICE_ID } from "./src/service/core/KeyValueService.ts";
|
|
24
24
|
export { SECRET_SENTINEL_PREFIX } from "./src/service/core/KeyValueService.ts";
|
|
25
|
-
export
|
|
25
|
+
export { Secret } from "./src/service/core/KeyValueService.ts";
|
|
26
|
+
export type { default as KeyValueService, SettableValueNode, } from "./src/service/core/KeyValueService.ts";
|
|
26
27
|
export type { default as SecretService } from "./src/service/core/SecretService.ts";
|
|
27
28
|
export { FETCH_SERVICE_ID } from "./src/service/core/FetchService.ts";
|
|
28
29
|
export type { default as FetchService } from "./src/service/core/FetchService.ts";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtE,YAAY,EACV,eAAe,EACf,MAAM,EACN,SAAS,EACT,wBAAwB,EACxB,eAAe,EACf,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACrE,YAAY,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,oCAAoC,EAAE,MAAM,iCAAiC,CAAC;AACvF,YAAY,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,YAAY,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChG,YAAY,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAG1E,YAAY,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnE,YAAY,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/E,YAAY,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/F,YAAY,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,+BAA+B,CA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.js
CHANGED
|
@@ -5,6 +5,7 @@ export { MAXIMUM_ARGUMENT_ARRAY_SIZE } from "./src/argument/SubCommandArgument.j
|
|
|
5
5
|
export { ASCII_BANNER_GENERATOR_SERVICE_ID } from "./src/service/core/AsciiBannerGeneratorService.js";
|
|
6
6
|
export { KEY_VALUE_SERVICE_ID } from "./src/service/core/KeyValueService.js";
|
|
7
7
|
export { SECRET_SENTINEL_PREFIX } from "./src/service/core/KeyValueService.js";
|
|
8
|
+
export { Secret } from "./src/service/core/KeyValueService.js";
|
|
8
9
|
export { FETCH_SERVICE_ID } from "./src/service/core/FetchService.js";
|
|
9
10
|
export { PRINTER_SERVICE_ID } from "./src/service/core/PrinterService.js";
|
|
10
11
|
export { Icon, Level, ProgressStyle, SpinnerStyle } from "./src/service/core/PrinterService.js";
|
package/dist/src/Value.d.ts
CHANGED
|
@@ -29,6 +29,11 @@ export type SingleValueType = number | string | boolean;
|
|
|
29
29
|
* The type of a value can be: `boolean`, `number` or `string` or an array of these.
|
|
30
30
|
*/
|
|
31
31
|
export type ValueType = SingleValueType | Array<SingleValueType>;
|
|
32
|
+
/**
|
|
33
|
+
* Any node that can appear within a {@link Values} tree: a primitive/array-of-primitives
|
|
34
|
+
* ({@link ValueType}), a nested keyed object ({@link Values}), or an array of such objects.
|
|
35
|
+
*/
|
|
36
|
+
export type ValueNode = ValueType | Values | Array<Values>;
|
|
32
37
|
/**
|
|
33
38
|
* A container object for populated values.
|
|
34
39
|
*
|
|
@@ -50,7 +55,7 @@ export type ValueType = SingleValueType | Array<SingleValueType>;
|
|
|
50
55
|
* * `{ foo: [ [ 1, 2 ], [3, 4 ] ] }`
|
|
51
56
|
*/
|
|
52
57
|
export type Values = {
|
|
53
|
-
[name: string]:
|
|
58
|
+
[name: string]: ValueNode;
|
|
54
59
|
};
|
|
55
60
|
/**
|
|
56
61
|
* Populated single value type is very similar to {@link SingleValueType} but allows for an illegal
|
package/dist/src/Value.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Value.d.ts","sourceRoot":"","sources":["../../src/Value.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,oBAAY,aAAa;IACvB,MAAM,IAAI;IACV,MAAM,IAAI;IACV,OAAO,IAAI;IACX,OAAO,IAAI;IACX,MAAM,IAAI;CACX;AAED;;GAEG;AACH,oBAAY,oBAAoB;IAC9B,OAAO,IAAI;CACZ;AAED;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"Value.d.ts","sourceRoot":"","sources":["../../src/Value.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,oBAAY,aAAa;IACvB,MAAM,IAAI;IACV,MAAM,IAAI;IACV,OAAO,IAAI;IACX,OAAO,IAAI;IACX,MAAM,IAAI;CACX;AAED;;GAEG;AACH,oBAAY,oBAAoB;IAC9B,OAAO,IAAI;CACZ;AAED;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC;AAEjE;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,eAAe,GAAG,SAAS,CAAC;AAEnE;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,wBAAwB,GAAG,KAAK,CAAC,wBAAwB,CAAC,CAAC;AAE5F;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,CAAC,IAAI,EAAE,MAAM,GACT,kBAAkB,GAClB,eAAe,GACf,KAAK,CAAC,eAAe,GAAG,SAAS,CAAC,GAClC,SAAS,CAAC;CACf"}
|
|
@@ -1,40 +1,74 @@
|
|
|
1
|
+
import type { ValueNode } from "../../Value.ts";
|
|
1
2
|
export declare const KEY_VALUE_SERVICE_ID = "@flowscripter/dynamic-cli-framework/key-value-service";
|
|
2
3
|
/**
|
|
3
4
|
* The sentinel prefix used to indicate a value is stored as an OS-native secret.
|
|
4
|
-
*
|
|
5
|
+
* String leaves starting with this prefix are resolved via the {@link SecretService}.
|
|
5
6
|
* This prefix is reserved and must not be used for regular key-value data.
|
|
6
7
|
*/
|
|
7
8
|
export declare const SECRET_SENTINEL_PREFIX = "__SECRET__:";
|
|
9
|
+
/**
|
|
10
|
+
* Wraps a value to mark it for storage as an OS-native secret via {@link SecretService}, when passed to
|
|
11
|
+
* {@link KeyValueService.set}. Can wrap the entire value passed to `set`, or be nested at any depth
|
|
12
|
+
* within a larger object/array passed to `set`.
|
|
13
|
+
*/
|
|
14
|
+
export declare class Secret<T extends ValueNode = ValueNode> {
|
|
15
|
+
readonly value: T;
|
|
16
|
+
constructor(value: T);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The shape of a value passed to {@link KeyValueService.set}.
|
|
20
|
+
*
|
|
21
|
+
* Like {@link ValueNode} (primitives, arrays of primitives, nested keyed objects, or arrays of
|
|
22
|
+
* nested objects) but additionally allows a {@link Secret}-wrapped value at any depth - as a top
|
|
23
|
+
* level value, a property of a nested object, or an entry of a nested array. A {@link Secret}
|
|
24
|
+
* itself wraps a plain {@link ValueNode}, so secrets do not nest within secrets.
|
|
25
|
+
*/
|
|
26
|
+
export type SettableValueNode = ValueNode | Secret | {
|
|
27
|
+
[name: string]: SettableValueNode;
|
|
28
|
+
} | Array<SettableValueNode>;
|
|
8
29
|
/**
|
|
9
30
|
* Service providing keystore functionality for the CLI. The keystore data is scoped to the
|
|
10
31
|
* service or {@link Command} instances accessing this service via {@link Context.getServiceById}.
|
|
11
32
|
*
|
|
12
|
-
* Values
|
|
13
|
-
*
|
|
14
|
-
*
|
|
33
|
+
* Values are arbitrary JSON-serializable data (see {@link ValueNode}) - not limited to
|
|
34
|
+
* strings - and may be deep objects or arrays.
|
|
35
|
+
*
|
|
36
|
+
* Any node within a value passed to {@link set} can be wrapped in {@link Secret} to have that
|
|
37
|
+
* node - and only that node - stored as an OS-native secret via {@link SecretService}, with a
|
|
38
|
+
* sentinel reference (prefixed with `__SECRET__:`) kept in its place in the stored structure.
|
|
39
|
+
* Everything else in the value is stored as plain (unencrypted) config data. This is symmetric
|
|
40
|
+
* with {@link get}, which resolves sentinel references found at any depth.
|
|
15
41
|
*/
|
|
16
42
|
export default interface KeyValueService {
|
|
17
43
|
/**
|
|
18
|
-
* Get
|
|
19
|
-
*
|
|
44
|
+
* Get the value for a specified key in the keystore.
|
|
45
|
+
*
|
|
46
|
+
* Recursively resolves any string leaf - at any depth within the stored value - which is a
|
|
47
|
+
* secret sentinel, retrieving its actual value via {@link SecretService}. This covers both
|
|
48
|
+
* values written via {@link set} using a nested {@link Secret}, and secret references a user
|
|
49
|
+
* hand-embeds directly (nested arbitrarily deep) in the CLI's JSON config file.
|
|
20
50
|
*/
|
|
21
|
-
|
|
51
|
+
get<T extends ValueNode = ValueNode>(key: string): Promise<T>;
|
|
22
52
|
/**
|
|
23
53
|
* Set a value for a specified key in the keystore.
|
|
24
54
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
55
|
+
* Any node within `value` wrapped in {@link Secret} - at any depth - is serialized as JSON and
|
|
56
|
+
* stored as an OS-native secret via {@link SecretService}, with a sentinel reference kept in
|
|
57
|
+
* its place in the stored structure. All other data is stored as plain (unencrypted) config
|
|
58
|
+
* data. Storing a secret requires that the service was constructed with secret support
|
|
59
|
+
* enabled.
|
|
28
60
|
*/
|
|
29
|
-
|
|
61
|
+
set(key: string, value: SettableValueNode): Promise<void>;
|
|
30
62
|
/**
|
|
31
63
|
* Check if a value for a specified key exists in the keystore.
|
|
32
64
|
*/
|
|
33
|
-
|
|
65
|
+
has(key: string): Promise<boolean>;
|
|
34
66
|
/**
|
|
35
67
|
* Delete the value for a specified key in the keystore.
|
|
36
|
-
*
|
|
68
|
+
*
|
|
69
|
+
* Recursively walks the stored (unresolved) structure for `key` and deletes every OS-native
|
|
70
|
+
* secret referenced - at any depth - via {@link SecretService}, before removing the key itself.
|
|
37
71
|
*/
|
|
38
|
-
|
|
72
|
+
delete(key: string): Promise<void>;
|
|
39
73
|
}
|
|
40
74
|
//# sourceMappingURL=KeyValueService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyValueService.d.ts","sourceRoot":"","sources":["../../../../src/service/core/KeyValueService.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,0DAA0D,CAAC;AAE5F;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,gBAAgB,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,WAAW,eAAe;IACtC
|
|
1
|
+
{"version":3,"file":"KeyValueService.d.ts","sourceRoot":"","sources":["../../../../src/service/core/KeyValueService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,eAAO,MAAM,oBAAoB,0DAA0D,CAAC;AAE5F;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,gBAAgB,CAAC;AAEpD;;;;GAIG;AACH,qBAAa,MAAM,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS;aACrB,KAAK,EAAE,CAAC;IAApC,YAA4B,KAAK,EAAE,CAAC,EAAI;CACzC;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GACzB,SAAS,GACT,MAAM,GACN;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAA;CAAE,GACrC,KAAK,CAAC,iBAAiB,CAAC,CAAC;AAE7B;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,WAAW,eAAe;IACtC;;;;;;;OAOG;IACH,GAAG,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAE9D;;;;;;;;OAQG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1D;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnC;;;;;OAKG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC"}
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
export const KEY_VALUE_SERVICE_ID = "@flowscripter/dynamic-cli-framework/key-value-service";
|
|
2
2
|
/**
|
|
3
3
|
* The sentinel prefix used to indicate a value is stored as an OS-native secret.
|
|
4
|
-
*
|
|
4
|
+
* String leaves starting with this prefix are resolved via the {@link SecretService}.
|
|
5
5
|
* This prefix is reserved and must not be used for regular key-value data.
|
|
6
6
|
*/
|
|
7
7
|
export const SECRET_SENTINEL_PREFIX = "__SECRET__:";
|
|
8
|
+
/**
|
|
9
|
+
* Wraps a value to mark it for storage as an OS-native secret via {@link SecretService}, when passed to
|
|
10
|
+
* {@link KeyValueService.set}. Can wrap the entire value passed to `set`, or be nested at any depth
|
|
11
|
+
* within a larger object/array passed to `set`.
|
|
12
|
+
*/
|
|
13
|
+
export class Secret {
|
|
14
|
+
value;
|
|
15
|
+
constructor(value) {
|
|
16
|
+
this.value = value;
|
|
17
|
+
}
|
|
18
|
+
}
|
package/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type {
|
|
|
4
4
|
SingleValueType,
|
|
5
5
|
Values,
|
|
6
6
|
ValueType,
|
|
7
|
+
ValueNode,
|
|
7
8
|
PopulatedSingleValueType,
|
|
8
9
|
PopulatedValues,
|
|
9
10
|
PopulatedValueType,
|
|
@@ -47,7 +48,11 @@ export type {
|
|
|
47
48
|
|
|
48
49
|
export { KEY_VALUE_SERVICE_ID } from "./src/service/core/KeyValueService.ts";
|
|
49
50
|
export { SECRET_SENTINEL_PREFIX } from "./src/service/core/KeyValueService.ts";
|
|
50
|
-
export
|
|
51
|
+
export { Secret } from "./src/service/core/KeyValueService.ts";
|
|
52
|
+
export type {
|
|
53
|
+
default as KeyValueService,
|
|
54
|
+
SettableValueNode,
|
|
55
|
+
} from "./src/service/core/KeyValueService.ts";
|
|
51
56
|
export type { default as SecretService } from "./src/service/core/SecretService.ts";
|
|
52
57
|
|
|
53
58
|
export { FETCH_SERVICE_ID } from "./src/service/core/FetchService.ts";
|
package/package.json
CHANGED
package/src/Value.ts
CHANGED
|
@@ -34,6 +34,12 @@ export type SingleValueType = number | string | boolean;
|
|
|
34
34
|
*/
|
|
35
35
|
export type ValueType = SingleValueType | Array<SingleValueType>;
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Any node that can appear within a {@link Values} tree: a primitive/array-of-primitives
|
|
39
|
+
* ({@link ValueType}), a nested keyed object ({@link Values}), or an array of such objects.
|
|
40
|
+
*/
|
|
41
|
+
export type ValueNode = ValueType | Values | Array<Values>;
|
|
42
|
+
|
|
37
43
|
/**
|
|
38
44
|
* A container object for populated values.
|
|
39
45
|
*
|
|
@@ -55,7 +61,7 @@ export type ValueType = SingleValueType | Array<SingleValueType>;
|
|
|
55
61
|
* * `{ foo: [ [ 1, 2 ], [3, 4 ] ] }`
|
|
56
62
|
*/
|
|
57
63
|
export type Values = {
|
|
58
|
-
[name: string]:
|
|
64
|
+
[name: string]: ValueNode;
|
|
59
65
|
};
|
|
60
66
|
|
|
61
67
|
/**
|
|
@@ -1,44 +1,82 @@
|
|
|
1
|
+
import type { ValueNode } from "../../Value.ts";
|
|
2
|
+
|
|
1
3
|
export const KEY_VALUE_SERVICE_ID = "@flowscripter/dynamic-cli-framework/key-value-service";
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* The sentinel prefix used to indicate a value is stored as an OS-native secret.
|
|
5
|
-
*
|
|
7
|
+
* String leaves starting with this prefix are resolved via the {@link SecretService}.
|
|
6
8
|
* This prefix is reserved and must not be used for regular key-value data.
|
|
7
9
|
*/
|
|
8
10
|
export const SECRET_SENTINEL_PREFIX = "__SECRET__:";
|
|
9
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Wraps a value to mark it for storage as an OS-native secret via {@link SecretService}, when passed to
|
|
14
|
+
* {@link KeyValueService.set}. Can wrap the entire value passed to `set`, or be nested at any depth
|
|
15
|
+
* within a larger object/array passed to `set`.
|
|
16
|
+
*/
|
|
17
|
+
export class Secret<T extends ValueNode = ValueNode> {
|
|
18
|
+
constructor(public readonly value: T) {}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The shape of a value passed to {@link KeyValueService.set}.
|
|
23
|
+
*
|
|
24
|
+
* Like {@link ValueNode} (primitives, arrays of primitives, nested keyed objects, or arrays of
|
|
25
|
+
* nested objects) but additionally allows a {@link Secret}-wrapped value at any depth - as a top
|
|
26
|
+
* level value, a property of a nested object, or an entry of a nested array. A {@link Secret}
|
|
27
|
+
* itself wraps a plain {@link ValueNode}, so secrets do not nest within secrets.
|
|
28
|
+
*/
|
|
29
|
+
export type SettableValueNode =
|
|
30
|
+
| ValueNode
|
|
31
|
+
| Secret
|
|
32
|
+
| { [name: string]: SettableValueNode }
|
|
33
|
+
| Array<SettableValueNode>;
|
|
34
|
+
|
|
10
35
|
/**
|
|
11
36
|
* Service providing keystore functionality for the CLI. The keystore data is scoped to the
|
|
12
37
|
* service or {@link Command} instances accessing this service via {@link Context.getServiceById}.
|
|
13
38
|
*
|
|
14
|
-
* Values
|
|
15
|
-
*
|
|
16
|
-
*
|
|
39
|
+
* Values are arbitrary JSON-serializable data (see {@link ValueNode}) - not limited to
|
|
40
|
+
* strings - and may be deep objects or arrays.
|
|
41
|
+
*
|
|
42
|
+
* Any node within a value passed to {@link set} can be wrapped in {@link Secret} to have that
|
|
43
|
+
* node - and only that node - stored as an OS-native secret via {@link SecretService}, with a
|
|
44
|
+
* sentinel reference (prefixed with `__SECRET__:`) kept in its place in the stored structure.
|
|
45
|
+
* Everything else in the value is stored as plain (unencrypted) config data. This is symmetric
|
|
46
|
+
* with {@link get}, which resolves sentinel references found at any depth.
|
|
17
47
|
*/
|
|
18
48
|
export default interface KeyValueService {
|
|
19
49
|
/**
|
|
20
|
-
* Get
|
|
21
|
-
*
|
|
50
|
+
* Get the value for a specified key in the keystore.
|
|
51
|
+
*
|
|
52
|
+
* Recursively resolves any string leaf - at any depth within the stored value - which is a
|
|
53
|
+
* secret sentinel, retrieving its actual value via {@link SecretService}. This covers both
|
|
54
|
+
* values written via {@link set} using a nested {@link Secret}, and secret references a user
|
|
55
|
+
* hand-embeds directly (nested arbitrarily deep) in the CLI's JSON config file.
|
|
22
56
|
*/
|
|
23
|
-
|
|
57
|
+
get<T extends ValueNode = ValueNode>(key: string): Promise<T>;
|
|
24
58
|
|
|
25
59
|
/**
|
|
26
60
|
* Set a value for a specified key in the keystore.
|
|
27
61
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
62
|
+
* Any node within `value` wrapped in {@link Secret} - at any depth - is serialized as JSON and
|
|
63
|
+
* stored as an OS-native secret via {@link SecretService}, with a sentinel reference kept in
|
|
64
|
+
* its place in the stored structure. All other data is stored as plain (unencrypted) config
|
|
65
|
+
* data. Storing a secret requires that the service was constructed with secret support
|
|
66
|
+
* enabled.
|
|
31
67
|
*/
|
|
32
|
-
|
|
68
|
+
set(key: string, value: SettableValueNode): Promise<void>;
|
|
33
69
|
|
|
34
70
|
/**
|
|
35
71
|
* Check if a value for a specified key exists in the keystore.
|
|
36
72
|
*/
|
|
37
|
-
|
|
73
|
+
has(key: string): Promise<boolean>;
|
|
38
74
|
|
|
39
75
|
/**
|
|
40
76
|
* Delete the value for a specified key in the keystore.
|
|
41
|
-
*
|
|
77
|
+
*
|
|
78
|
+
* Recursively walks the stored (unresolved) structure for `key` and deletes every OS-native
|
|
79
|
+
* secret referenced - at any depth - via {@link SecretService}, before removing the key itself.
|
|
42
80
|
*/
|
|
43
|
-
|
|
81
|
+
delete(key: string): Promise<void>;
|
|
44
82
|
}
|