@kronos-integration/service 10.4.56 → 10.4.57
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 +7 -2
- package/package.json +15 -11
- package/types/endpoints-mixin.d.mts +7 -0
- package/types/initialization-context.d.mts +4 -0
- package/types/module.d.mts +8 -0
- package/types/service-config.d.mts +40 -0
- package/types/service-consumer-mixin.d.mts +8 -0
- package/types/service-logger.d.mts +7 -0
- package/types/service-provider-mixin.d.mts +83 -0
- package/types/service.d.mts +152 -0
- package/types/standalone-service-provider.d.mts +38 -0
- package/types/util.d.mts +1 -0
package/README.md
CHANGED
|
@@ -47,6 +47,7 @@ Base service implementation
|
|
|
47
47
|
* [Parameters](#parameters-7)
|
|
48
48
|
* [Service](#service)
|
|
49
49
|
* [Parameters](#parameters-8)
|
|
50
|
+
* [Properties](#properties-1)
|
|
50
51
|
* [extendetName](#extendetname)
|
|
51
52
|
* [stateChanged](#statechanged)
|
|
52
53
|
* [Parameters](#parameters-9)
|
|
@@ -199,8 +200,8 @@ By default a service provider has two build in services
|
|
|
199
200
|
### Parameters
|
|
200
201
|
|
|
201
202
|
* `superclass`  
|
|
202
|
-
* `serviceLoggerClass`
|
|
203
|
-
* `serviceConfigClass`
|
|
203
|
+
* `serviceLoggerClass` (optional, default `ServiceLogger`)
|
|
204
|
+
* `serviceConfigClass` (optional, default `ServiceConfig`)
|
|
204
205
|
|
|
205
206
|
## Service
|
|
206
207
|
|
|
@@ -242,6 +243,10 @@ All services have at least three endpoints:
|
|
|
242
243
|
* `config.endpoints` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** will be merged with the build in ones
|
|
243
244
|
* `ic` **InitializationContext** 
|
|
244
245
|
|
|
246
|
+
### Properties
|
|
247
|
+
|
|
248
|
+
* `endpoints` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
|
249
|
+
|
|
245
250
|
### extendetName
|
|
246
251
|
|
|
247
252
|
Used in human readable state messages.
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kronos-integration/service",
|
|
3
|
-
"version": "10.4.
|
|
3
|
+
"version": "10.4.57",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
7
7
|
},
|
|
8
8
|
"exports": {
|
|
9
|
-
".":
|
|
9
|
+
".": {
|
|
10
|
+
"default": "./src/module.mjs"
|
|
11
|
+
}
|
|
10
12
|
},
|
|
11
13
|
"description": "Base service implementation",
|
|
12
14
|
"contributors": [
|
|
@@ -21,31 +23,33 @@
|
|
|
21
23
|
],
|
|
22
24
|
"license": "BSD-2-Clause",
|
|
23
25
|
"scripts": {
|
|
26
|
+
"prepare": "npm run prepare:typescript",
|
|
27
|
+
"prepare:typescript": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types --resolveJsonModule -t esnext -m esnext --module nodenext --moduleResolution nodenext --rootDir src ./src**/*.mjs",
|
|
24
28
|
"test": "npm run test:ava",
|
|
25
29
|
"test:ava": "ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
|
|
26
30
|
"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",
|
|
27
31
|
"docs": "documentation readme --section=API ./src/**/*.mjs",
|
|
28
|
-
"lint": "npm run lint:docs && npm run lint:
|
|
32
|
+
"lint": "npm run lint:docs && npm run lint:typescript",
|
|
29
33
|
"lint:docs": "documentation lint ./src/**/*.mjs",
|
|
30
|
-
"lint:
|
|
34
|
+
"lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
|
|
31
35
|
},
|
|
32
36
|
"dependencies": {
|
|
33
|
-
"@kronos-integration/endpoint": "^9.5.
|
|
34
|
-
"@kronos-integration/interceptor": "^10.
|
|
35
|
-
"loglevel-mixin": "^7.2.
|
|
37
|
+
"@kronos-integration/endpoint": "^9.5.4",
|
|
38
|
+
"@kronos-integration/interceptor": "^10.3.0",
|
|
39
|
+
"loglevel-mixin": "^7.2.2",
|
|
36
40
|
"model-attributes": "^4.2.2",
|
|
37
41
|
"remove-sensible-values": "^1.3.1",
|
|
38
42
|
"statetransition-mixin": "^8.1.0"
|
|
39
43
|
},
|
|
40
44
|
"devDependencies": {
|
|
41
|
-
"ava": "^6.1.
|
|
45
|
+
"ava": "^6.1.2",
|
|
42
46
|
"c8": "^9.1.0",
|
|
43
47
|
"documentation": "^14.0.3",
|
|
44
|
-
"semantic-release": "^23.0.
|
|
45
|
-
"typescript": "^5.
|
|
48
|
+
"semantic-release": "^23.0.8",
|
|
49
|
+
"typescript": "^5.4.5"
|
|
46
50
|
},
|
|
47
51
|
"engines": {
|
|
48
|
-
"node": ">=20.
|
|
52
|
+
"node": ">=20.12.2"
|
|
49
53
|
},
|
|
50
54
|
"repository": {
|
|
51
55
|
"type": "git",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Endpoint accessor mixin.
|
|
3
|
+
* Manages endpoints in a container.
|
|
4
|
+
* @param {new() => superclass} superclass class to be extended
|
|
5
|
+
* @return {new() => superclass} extended class
|
|
6
|
+
*/
|
|
7
|
+
export function EndpointsMixin(superclass: new () => new () => any): new () => new () => any;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./service.mjs";
|
|
2
|
+
export * from "./service-logger.mjs";
|
|
3
|
+
export * from "./service-config.mjs";
|
|
4
|
+
export * from "./service-provider-mixin.mjs";
|
|
5
|
+
export * from "./endpoints-mixin.mjs";
|
|
6
|
+
export * from "./standalone-service-provider.mjs";
|
|
7
|
+
export * from "./service-consumer-mixin.mjs";
|
|
8
|
+
export * from "./initialization-context.mjs";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merge from b into a.
|
|
3
|
+
* When *a* and *b* are arrays of values only the none duplicates are appendend to *a*.
|
|
4
|
+
* @param {any} a
|
|
5
|
+
* @param {any} b
|
|
6
|
+
* @return {any} merged b into a
|
|
7
|
+
*/
|
|
8
|
+
export function merge(a: any, b: any): any;
|
|
9
|
+
/**
|
|
10
|
+
* Config providing service.
|
|
11
|
+
* Dispatches config requests to services.
|
|
12
|
+
* Also preserves them until a maching service becomes avaliable.
|
|
13
|
+
* @property {Map<string,Object>} preservedConfigs values for services not already established
|
|
14
|
+
*/
|
|
15
|
+
export class ServiceConfig extends Service {
|
|
16
|
+
preservedConfigs: Map<any, any>;
|
|
17
|
+
/**
|
|
18
|
+
* Deliver configuration for a given service.
|
|
19
|
+
* @param {string} name service name
|
|
20
|
+
* @param {Object} config
|
|
21
|
+
*/
|
|
22
|
+
configFor(name: string, config: any): Promise<any>;
|
|
23
|
+
/**
|
|
24
|
+
* Forget about preserved config of a service.
|
|
25
|
+
* @param {string} name service name
|
|
26
|
+
*/
|
|
27
|
+
clearPreserved(name: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* Set config entry.
|
|
30
|
+
* @param {string} key path to the value
|
|
31
|
+
* @param {any} value
|
|
32
|
+
*/
|
|
33
|
+
configureValue(key: string, value: any): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @param {Array|Object} config
|
|
37
|
+
*/
|
|
38
|
+
configure(config: any[] | any): Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
import { Service } from "./service.mjs";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assign services based on a configuration.
|
|
3
|
+
* @param {Object} target object
|
|
4
|
+
* @param {Object} config service defintion
|
|
5
|
+
* @param {Object} provider service provider
|
|
6
|
+
* @param {boolean} waitUntilFactoryPresent
|
|
7
|
+
*/
|
|
8
|
+
export function defineServiceConsumerProperties(target: any, config: any, provider: any, waitUntilFactoryPresent: boolean): Promise<any[]>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provide services and hold service configuration.
|
|
3
|
+
* By default a service provider has two build in services
|
|
4
|
+
* 'logger' and 'config'.
|
|
5
|
+
*
|
|
6
|
+
* @param {new(Object,InitializationContext) => serviceLoggerClass} serviceLoggerClass where the logging houtd go
|
|
7
|
+
* @param {new(Object,InitializationContext) => serviceConfigClass} serviceConfigClass where the config comes from
|
|
8
|
+
*/
|
|
9
|
+
export function ServiceProviderMixin(superclass: any, serviceLoggerClass?: new (Object, InitializationContext) => new (Object: any, InitializationContext: any) => any, serviceConfigClass?: new (Object, InitializationContext) => new (Object: any, InitializationContext: any) => any): {
|
|
10
|
+
new (config: any, ic?: any): {
|
|
11
|
+
[x: string]: any;
|
|
12
|
+
listeners: {};
|
|
13
|
+
interceptorFactories: {};
|
|
14
|
+
serviceFactories: {};
|
|
15
|
+
services: {};
|
|
16
|
+
ic: any;
|
|
17
|
+
emit(name: any, ...args: any[]): void;
|
|
18
|
+
addListener(name: any, listener: any): void;
|
|
19
|
+
removeListener(name: any, listener: any): void;
|
|
20
|
+
/**
|
|
21
|
+
* By default be our own owner.
|
|
22
|
+
* @return this
|
|
23
|
+
*/
|
|
24
|
+
readonly owner: any;
|
|
25
|
+
/**
|
|
26
|
+
* We are the service provider.
|
|
27
|
+
* @return {boolean} true
|
|
28
|
+
*/
|
|
29
|
+
readonly isServiceProvider: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Register service or interceptor factories.
|
|
32
|
+
*
|
|
33
|
+
* @param {Function[]} factories
|
|
34
|
+
*/
|
|
35
|
+
registerFactories(factories: Function[]): void;
|
|
36
|
+
/**
|
|
37
|
+
* Registers a interceptor factory for later use by
|
|
38
|
+
* @see {instantiateInterceptor}.
|
|
39
|
+
*
|
|
40
|
+
* @param {new() => factory} factory
|
|
41
|
+
* @returns {new() => factory} factory
|
|
42
|
+
*/
|
|
43
|
+
registerInterceptorFactory(factory: new () => new () => any): new () => new () => any;
|
|
44
|
+
unregisterInterceptorFactory(factory: any): void;
|
|
45
|
+
/**
|
|
46
|
+
* Instanciates an interceptor from its definition data.
|
|
47
|
+
* @see {interceptorFactories}
|
|
48
|
+
* @param {Object} definition data
|
|
49
|
+
* @returns {Interceptor}
|
|
50
|
+
*/
|
|
51
|
+
instantiateInterceptor(definition: any): Interceptor;
|
|
52
|
+
serviceStateChanged(service: any, oldState: any, newState: any): void;
|
|
53
|
+
registerServiceFactory(factory: any): Promise<any>;
|
|
54
|
+
unregisterServiceFactory(factory: any): Promise<void>;
|
|
55
|
+
registerService(service: any): Promise<any>;
|
|
56
|
+
unregisterService(serviceName: any): Promise<void>;
|
|
57
|
+
readonly serviceNames: string[];
|
|
58
|
+
getService(name: any): any;
|
|
59
|
+
declareService(config: any): Promise<any>;
|
|
60
|
+
/**
|
|
61
|
+
* Add a new service based on its configuration.
|
|
62
|
+
* If a service for the name is already present and it has a matching type
|
|
63
|
+
* then its configure() is called and returned.
|
|
64
|
+
* Otherwise a new service will be created eventually replacing an already existing service with the same name.
|
|
65
|
+
* @param {object} configs with
|
|
66
|
+
* name - the service name
|
|
67
|
+
* type - the service factory name - defaults to config.name
|
|
68
|
+
* @return {Promise<Object>} resolving to the declared services
|
|
69
|
+
*/
|
|
70
|
+
declareServices(configs: object): Promise<any>;
|
|
71
|
+
/**
|
|
72
|
+
* Start all registered services which hanving autostart set.
|
|
73
|
+
*/
|
|
74
|
+
_start(): Promise<any[]>;
|
|
75
|
+
/**
|
|
76
|
+
* Stop all services.
|
|
77
|
+
* @return {Promise} that resolves when all services are stopped
|
|
78
|
+
*/
|
|
79
|
+
_stop(): Promise<any>;
|
|
80
|
+
};
|
|
81
|
+
[x: string]: any;
|
|
82
|
+
};
|
|
83
|
+
import { Interceptor } from "@kronos-integration/interceptor";
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
declare const Service_base: new () => new () => any;
|
|
2
|
+
/**
|
|
3
|
+
* Service
|
|
4
|
+
* The initial state is 'stopped'.
|
|
5
|
+
* All services have at least three endpoints:
|
|
6
|
+
* - log _out_: log events
|
|
7
|
+
* - config _in_: configuration request
|
|
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
|
+
*
|
|
17
|
+
* @property {Object} endpoints
|
|
18
|
+
*/
|
|
19
|
+
export class Service extends Service_base {
|
|
20
|
+
static get description(): string;
|
|
21
|
+
/**
|
|
22
|
+
* Meta information for the config attributes.
|
|
23
|
+
* - default optional default value of the attribute
|
|
24
|
+
* - needsRestart optional modification requires a service restart
|
|
25
|
+
* - setter(newValue,attribute) optional function to be used if simple value assignment is not enough
|
|
26
|
+
* The Service class only defines the logLevel, and start/stop/restart timeout attribute
|
|
27
|
+
* @return {Object}
|
|
28
|
+
*/
|
|
29
|
+
static get configurationAttributes(): any;
|
|
30
|
+
/**
|
|
31
|
+
* Definition of the predefined endpoints.
|
|
32
|
+
* - log _out_
|
|
33
|
+
* - config _in_
|
|
34
|
+
* @return {Object} predefined endpoints
|
|
35
|
+
*/
|
|
36
|
+
static get endpoints(): any;
|
|
37
|
+
constructor(config: any, ic: any);
|
|
38
|
+
owner: any;
|
|
39
|
+
logLevel: any;
|
|
40
|
+
instantiateInterceptor(options: any): any;
|
|
41
|
+
get configurationAttributes(): any;
|
|
42
|
+
get type(): string;
|
|
43
|
+
set description(desc: any);
|
|
44
|
+
get description(): any;
|
|
45
|
+
/**
|
|
46
|
+
* Used in human readable state messages.
|
|
47
|
+
* Besides the actual service name it may contain additional short hints.
|
|
48
|
+
* @return {string}
|
|
49
|
+
*/
|
|
50
|
+
get extendetName(): string;
|
|
51
|
+
/**
|
|
52
|
+
* Called when the service state changes.
|
|
53
|
+
* Emits a serviceStateChanged event to the owner.
|
|
54
|
+
* @param {string} oldState
|
|
55
|
+
* @param {string} newState
|
|
56
|
+
*/
|
|
57
|
+
stateChanged(origin: any, oldState: string, newState: string): void;
|
|
58
|
+
stateTransitionRejection(rejected: any, newState: any): any;
|
|
59
|
+
/**
|
|
60
|
+
* Called when state transition is not allowed.
|
|
61
|
+
* @param {string} action originating action name
|
|
62
|
+
* @throws always
|
|
63
|
+
*/
|
|
64
|
+
rejectWrongState(action: string): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Deliver transition timeout.
|
|
67
|
+
* @param {Object} transition
|
|
68
|
+
* @return {number} milliseconds before throwing for a long running transition
|
|
69
|
+
*/
|
|
70
|
+
timeoutForTransition(transition: any): number;
|
|
71
|
+
/**
|
|
72
|
+
* Opens all endpoint connections.
|
|
73
|
+
*/
|
|
74
|
+
_start(): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Closes all endpoint connections.
|
|
77
|
+
*/
|
|
78
|
+
_stop(): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Restart action.
|
|
81
|
+
* default implementation does a _stop() and a _start()
|
|
82
|
+
* @return {Promise} fulfills after start
|
|
83
|
+
*/
|
|
84
|
+
_restart(): Promise<any>;
|
|
85
|
+
/**
|
|
86
|
+
* Restarts if in running mode.
|
|
87
|
+
* Otherwise does nothing.
|
|
88
|
+
* @returns {Promise} resolves when restart is done (or immediate if no restart triggered)
|
|
89
|
+
*/
|
|
90
|
+
restartIfRunning(): Promise<any>;
|
|
91
|
+
/**
|
|
92
|
+
* Mapping of properties used in toString.
|
|
93
|
+
* @return {Object}
|
|
94
|
+
*/
|
|
95
|
+
get toStringAttributes(): any;
|
|
96
|
+
/**
|
|
97
|
+
* Base service is not a provider.
|
|
98
|
+
* @return {boolean} false
|
|
99
|
+
*/
|
|
100
|
+
get isServiceProvider(): boolean;
|
|
101
|
+
toJSON(): any;
|
|
102
|
+
/**
|
|
103
|
+
* Deliver json representation.
|
|
104
|
+
* @param {Object} options
|
|
105
|
+
* @param {boolean} options.includeRuntimeInfo include runtime informtion like state
|
|
106
|
+
* @param {boolean} options.includeDefaults include default endpoints
|
|
107
|
+
* @param {boolean} options.includeName include name of the service
|
|
108
|
+
* @param {boolean} options.includeConfig include config attributes
|
|
109
|
+
* @param {boolean} options.includePrivate include private config attributes
|
|
110
|
+
* @return {Object} json representation
|
|
111
|
+
*/
|
|
112
|
+
toJSONWithOptions(options: {
|
|
113
|
+
includeRuntimeInfo: boolean;
|
|
114
|
+
includeDefaults: boolean;
|
|
115
|
+
includeName: boolean;
|
|
116
|
+
includeConfig: boolean;
|
|
117
|
+
includePrivate: boolean;
|
|
118
|
+
}): any;
|
|
119
|
+
/**
|
|
120
|
+
* Should we start when beeing registered.
|
|
121
|
+
* @return {boolean} false
|
|
122
|
+
*/
|
|
123
|
+
get autostart(): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Takes attribute values from config parameters
|
|
126
|
+
* and copies them over to the object.
|
|
127
|
+
* Copying is done according to configurationAttributes.
|
|
128
|
+
* Which means we loop over all configuration attributes.
|
|
129
|
+
* and then for each attribute decide if we use the default, call a setter function
|
|
130
|
+
* or simply assign the attribute value.
|
|
131
|
+
* @param {Object} config
|
|
132
|
+
* @return {Set} of modified attributes
|
|
133
|
+
*/
|
|
134
|
+
_configure(config: any): Set<any>;
|
|
135
|
+
/**
|
|
136
|
+
* Use new configuration.
|
|
137
|
+
* Internally calls _configure(config) as the constructor does.
|
|
138
|
+
* If attribute with needsRestart are touched the restartIfRunning method
|
|
139
|
+
* will be called.
|
|
140
|
+
* @param {Object} config
|
|
141
|
+
* @return {Promise} fillfills when config is applied
|
|
142
|
+
*/
|
|
143
|
+
configure(config: any): Promise<any>;
|
|
144
|
+
/**
|
|
145
|
+
* Adds service name to the log event.
|
|
146
|
+
* @param {string} level the log level
|
|
147
|
+
* @param {Object} arg log content
|
|
148
|
+
*/
|
|
149
|
+
log(level: string, arg: any): void;
|
|
150
|
+
#private;
|
|
151
|
+
}
|
|
152
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
declare const StandaloneServiceProvider_base: {
|
|
2
|
+
new (config: any, ic?: any): {
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
listeners: {};
|
|
5
|
+
interceptorFactories: {};
|
|
6
|
+
serviceFactories: {};
|
|
7
|
+
services: {};
|
|
8
|
+
ic: any;
|
|
9
|
+
emit(name: any, ...args: any[]): void;
|
|
10
|
+
addListener(name: any, listener: any): void;
|
|
11
|
+
removeListener(name: any, listener: any): void;
|
|
12
|
+
readonly owner: any;
|
|
13
|
+
readonly isServiceProvider: boolean;
|
|
14
|
+
registerFactories(factories: Function[]): void;
|
|
15
|
+
registerInterceptorFactory(factory: new () => any): new () => new () => any;
|
|
16
|
+
unregisterInterceptorFactory(factory: any): void;
|
|
17
|
+
instantiateInterceptor(definition: any): import("@kronos-integration/interceptor").Interceptor;
|
|
18
|
+
serviceStateChanged(service: any, oldState: any, newState: any): void;
|
|
19
|
+
registerServiceFactory(factory: any): Promise<any>;
|
|
20
|
+
unregisterServiceFactory(factory: any): Promise<void>;
|
|
21
|
+
registerService(service: any): Promise<any>;
|
|
22
|
+
unregisterService(serviceName: any): Promise<void>;
|
|
23
|
+
readonly serviceNames: string[];
|
|
24
|
+
getService(name: any): any;
|
|
25
|
+
declareService(config: any): Promise<any>;
|
|
26
|
+
declareServices(configs: any): Promise<any>;
|
|
27
|
+
_start(): Promise<any[]>;
|
|
28
|
+
_stop(): Promise<any>;
|
|
29
|
+
};
|
|
30
|
+
[x: string]: any;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Simple service manager (for examples and testing only).
|
|
34
|
+
*/
|
|
35
|
+
export class StandaloneServiceProvider extends StandaloneServiceProvider_base {
|
|
36
|
+
static get description(): string;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
package/types/util.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function keyValue2Object(key: any, value: any): {};
|