@hkdigital/lib-core 0.3.2 → 0.3.4
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/classes/services/ServiceBase.d.ts +4 -6
- package/dist/classes/services/ServiceBase.js +2 -3
- package/dist/classes/services/ServiceManager.d.ts +2 -4
- package/dist/classes/services/ServiceManager.js +1 -2
- package/dist/classes/services/typedef.d.ts +2 -11
- package/dist/classes/services/typedef.js +2 -13
- package/dist/components/drag-drop/Draggable.svelte +1 -1
- package/dist/components/drag-drop/DropZone.svelte +1 -1
- package/dist/components/inputs/text-input/TextInput.svelte +2 -2
- package/dist/constants/index.d.ts +5 -1
- package/dist/constants/index.js +5 -2
- package/dist/constants/states/index.d.ts +4 -0
- package/dist/constants/states/index.js +4 -0
- package/dist/util/exceptions/index.js +1 -1
- package/dist/util/http/http-request.js +1 -1
- package/dist/util/http/index.js +1 -1
- package/dist/util/http/json-request.js +1 -1
- package/dist/util/http/response.js +1 -1
- package/dist/util/http/url.js +1 -1
- package/dist/util/time/index.js +1 -1
- package/dist/util/unique/index.js +1 -1
- package/package.json +1 -1
- /package/dist/constants/{bases.d.ts → bases/index.d.ts} +0 -0
- /package/dist/constants/{bases.js → bases/index.js} +0 -0
- /package/dist/constants/{state-labels/drag-states.d.ts → states/drag.d.ts} +0 -0
- /package/dist/constants/{state-labels/drag-states.js → states/drag.js} +0 -0
- /package/dist/constants/{state-labels/drop-states.d.ts → states/drop.d.ts} +0 -0
- /package/dist/constants/{state-labels/drop-states.js → states/drop.js} +0 -0
- /package/dist/constants/{state-labels/input-states.d.ts → states/input.d.ts} +0 -0
- /package/dist/constants/{state-labels/input-states.js → states/input.js} +0 -0
- /package/dist/constants/{state-labels/submit-states.d.ts → states/submit.d.ts} +0 -0
- /package/dist/constants/{state-labels/submit-states.js → states/submit.js} +0 -0
- /package/dist/constants/{time.d.ts → time/index.d.ts} +0 -0
- /package/dist/constants/{time.js → time/index.js} +0 -0
- /package/dist/{constants/errors → errors}/api.d.ts +0 -0
- /package/dist/{constants/errors → errors}/api.js +0 -0
- /package/dist/{constants/errors → errors}/generic.d.ts +0 -0
- /package/dist/{constants/errors → errors}/generic.js +0 -0
- /package/dist/{constants/errors → errors}/http.d.ts +0 -0
- /package/dist/{constants/errors → errors}/http.js +0 -0
- /package/dist/{constants/errors → errors}/index.d.ts +0 -0
- /package/dist/{constants/errors → errors}/index.js +0 -0
- /package/dist/{constants/errors → errors}/jwt.d.ts +0 -0
- /package/dist/{constants/errors → errors}/jwt.js +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef {import('./typedef.js').ServiceConfig} ServiceConfig
|
|
3
2
|
* @typedef {import('./typedef.js').ServiceOptions} ServiceOptions
|
|
4
3
|
* @typedef {import('./typedef.js').StopOptions} StopOptions
|
|
5
4
|
* @typedef {import('./typedef.js').HealthStatus} HealthStatus
|
|
@@ -34,11 +33,11 @@ export class ServiceBase extends EventEmitter {
|
|
|
34
33
|
/**
|
|
35
34
|
* Initialize the service with configuration
|
|
36
35
|
*
|
|
37
|
-
* @param {
|
|
36
|
+
* @param {*} [config={}] - Service-specific configuration
|
|
38
37
|
*
|
|
39
38
|
* @returns {Promise<boolean>} True if initialization succeeded
|
|
40
39
|
*/
|
|
41
|
-
initialize(config?:
|
|
40
|
+
initialize(config?: any): Promise<boolean>;
|
|
42
41
|
/**
|
|
43
42
|
* Start the service
|
|
44
43
|
*
|
|
@@ -83,11 +82,11 @@ export class ServiceBase extends EventEmitter {
|
|
|
83
82
|
* Initialize the service (override in subclass)
|
|
84
83
|
*
|
|
85
84
|
* @protected
|
|
86
|
-
* @param {
|
|
85
|
+
* @param {*} config - Service configuration
|
|
87
86
|
*
|
|
88
87
|
* @returns {Promise<void>}
|
|
89
88
|
*/
|
|
90
|
-
protected _init(config:
|
|
89
|
+
protected _init(config: any): Promise<void>;
|
|
91
90
|
/**
|
|
92
91
|
* Start the service (override in subclass)
|
|
93
92
|
*
|
|
@@ -152,7 +151,6 @@ export class ServiceBase extends EventEmitter {
|
|
|
152
151
|
private _setError;
|
|
153
152
|
}
|
|
154
153
|
export default ServiceBase;
|
|
155
|
-
export type ServiceConfig = import("./typedef.js").ServiceConfig;
|
|
156
154
|
export type ServiceOptions = import("./typedef.js").ServiceOptions;
|
|
157
155
|
export type StopOptions = import("./typedef.js").StopOptions;
|
|
158
156
|
export type HealthStatus = import("./typedef.js").HealthStatus;
|
|
@@ -68,7 +68,6 @@ import {
|
|
|
68
68
|
} from './service-states.js';
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
|
-
* @typedef {import('./typedef.js').ServiceConfig} ServiceConfig
|
|
72
71
|
* @typedef {import('./typedef.js').ServiceOptions} ServiceOptions
|
|
73
72
|
* @typedef {import('./typedef.js').StopOptions} StopOptions
|
|
74
73
|
* @typedef {import('./typedef.js').HealthStatus} HealthStatus
|
|
@@ -113,7 +112,7 @@ export class ServiceBase extends EventEmitter {
|
|
|
113
112
|
/**
|
|
114
113
|
* Initialize the service with configuration
|
|
115
114
|
*
|
|
116
|
-
* @param {
|
|
115
|
+
* @param {*} [config={}] - Service-specific configuration
|
|
117
116
|
*
|
|
118
117
|
* @returns {Promise<boolean>} True if initialization succeeded
|
|
119
118
|
*/
|
|
@@ -335,7 +334,7 @@ export class ServiceBase extends EventEmitter {
|
|
|
335
334
|
* Initialize the service (override in subclass)
|
|
336
335
|
*
|
|
337
336
|
* @protected
|
|
338
|
-
* @param {
|
|
337
|
+
* @param {*} config - Service configuration
|
|
339
338
|
*
|
|
340
339
|
* @returns {Promise<void>}
|
|
341
340
|
*/
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef {import('./typedef.js').ServiceConstructor} ServiceConstructor
|
|
3
|
-
* @typedef {import('./typedef.js').ServiceConfig} ServiceConfig
|
|
4
3
|
* @typedef {import('./typedef.js').ServiceRegistrationOptions} ServiceRegistrationOptions
|
|
5
4
|
* @typedef {import('./typedef.js').ServiceManagerConfig} ServiceManagerConfig
|
|
6
5
|
* @typedef {import('./typedef.js').StopOptions} StopOptions
|
|
@@ -29,12 +28,12 @@ export class ServiceManager extends EventEmitter {
|
|
|
29
28
|
*
|
|
30
29
|
* @param {string} name - Unique service identifier
|
|
31
30
|
* @param {ServiceConstructor} ServiceClass - Service class constructor
|
|
32
|
-
* @param {
|
|
31
|
+
* @param {*} [config={}] - Service configuration
|
|
33
32
|
* @param {ServiceRegistrationOptions} [options={}] - Registration options
|
|
34
33
|
*
|
|
35
34
|
* @throws {Error} If service name is already registered
|
|
36
35
|
*/
|
|
37
|
-
register(name: string, ServiceClass: ServiceConstructor, config?:
|
|
36
|
+
register(name: string, ServiceClass: ServiceConstructor, config?: any, options?: ServiceRegistrationOptions): void;
|
|
38
37
|
/**
|
|
39
38
|
* Get or create a service instance
|
|
40
39
|
*
|
|
@@ -169,7 +168,6 @@ export class ServiceManager extends EventEmitter {
|
|
|
169
168
|
}
|
|
170
169
|
export default ServiceManager;
|
|
171
170
|
export type ServiceConstructor = import("./typedef.js").ServiceConstructor;
|
|
172
|
-
export type ServiceConfig = import("./typedef.js").ServiceConfig;
|
|
173
171
|
export type ServiceRegistrationOptions = import("./typedef.js").ServiceRegistrationOptions;
|
|
174
172
|
export type ServiceManagerConfig = import("./typedef.js").ServiceManagerConfig;
|
|
175
173
|
export type StopOptions = import("./typedef.js").StopOptions;
|
|
@@ -75,7 +75,6 @@ import {
|
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* @typedef {import('./typedef.js').ServiceConstructor} ServiceConstructor
|
|
78
|
-
* @typedef {import('./typedef.js').ServiceConfig} ServiceConfig
|
|
79
78
|
* @typedef {import('./typedef.js').ServiceRegistrationOptions} ServiceRegistrationOptions
|
|
80
79
|
* @typedef {import('./typedef.js').ServiceManagerConfig} ServiceManagerConfig
|
|
81
80
|
* @typedef {import('./typedef.js').StopOptions} StopOptions
|
|
@@ -118,7 +117,7 @@ export class ServiceManager extends EventEmitter {
|
|
|
118
117
|
*
|
|
119
118
|
* @param {string} name - Unique service identifier
|
|
120
119
|
* @param {ServiceConstructor} ServiceClass - Service class constructor
|
|
121
|
-
* @param {
|
|
120
|
+
* @param {*} [config={}] - Service configuration
|
|
122
121
|
* @param {ServiceRegistrationOptions} [options={}] - Registration options
|
|
123
122
|
*
|
|
124
123
|
* @throws {Error} If service name is already registered
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Service configuration object passed to service initialization
|
|
3
|
-
*/
|
|
4
|
-
export type ServiceConfig = {
|
|
5
|
-
/**
|
|
6
|
-
* - Service-specific configuration properties
|
|
7
|
-
*/
|
|
8
|
-
key?: any;
|
|
9
|
-
};
|
|
10
1
|
/**
|
|
11
2
|
* Options for creating a service instance
|
|
12
3
|
*/
|
|
@@ -187,7 +178,7 @@ export type ServiceEntry = {
|
|
|
187
178
|
/**
|
|
188
179
|
* - Service configuration
|
|
189
180
|
*/
|
|
190
|
-
config:
|
|
181
|
+
config: any;
|
|
191
182
|
/**
|
|
192
183
|
* - Service dependencies
|
|
193
184
|
*/
|
|
@@ -235,7 +226,7 @@ export type ServiceInstance = {
|
|
|
235
226
|
* - Service logger
|
|
236
227
|
*/
|
|
237
228
|
logger: import("../logging").Logger;
|
|
238
|
-
initialize: (config?:
|
|
229
|
+
initialize: (config?: any) => Promise<boolean>;
|
|
239
230
|
start: () => Promise<boolean>;
|
|
240
231
|
stop: (options?: StopOptions) => Promise<boolean>;
|
|
241
232
|
recover: () => Promise<boolean>;
|
|
@@ -9,12 +9,8 @@
|
|
|
9
9
|
* // In your service implementation
|
|
10
10
|
* import { ServiceBase } from './ServiceBase.js';
|
|
11
11
|
*
|
|
12
|
-
* // @ typedef {import('./typedef.js').ServiceConfig} ServiceConfig
|
|
13
|
-
* // @ typedef {import('./typedef.js').HealthStatus} HealthStatus
|
|
14
|
-
*
|
|
15
12
|
* class MyService extends ServiceBase {
|
|
16
13
|
* async _init(config) {
|
|
17
|
-
* // config is typed as ServiceConfig
|
|
18
14
|
* }
|
|
19
15
|
*
|
|
20
16
|
* async _healthCheck() {
|
|
@@ -45,13 +41,6 @@
|
|
|
45
41
|
* manager.register('auth', AuthService, {}, options);
|
|
46
42
|
*/
|
|
47
43
|
|
|
48
|
-
/**
|
|
49
|
-
* Service configuration object passed to service initialization
|
|
50
|
-
*
|
|
51
|
-
* @typedef {Object} ServiceConfig
|
|
52
|
-
* @property {*} [key] - Service-specific configuration properties
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
44
|
/**
|
|
56
45
|
* Options for creating a service instance
|
|
57
46
|
*
|
|
@@ -144,7 +133,7 @@
|
|
|
144
133
|
* @typedef {Object} ServiceEntry
|
|
145
134
|
* @property {ServiceConstructor} ServiceClass - Service class constructor
|
|
146
135
|
* @property {ServiceInstance|null} instance - Service instance (lazy-created)
|
|
147
|
-
* @property {
|
|
136
|
+
* @property {*} config - Service configuration
|
|
148
137
|
* @property {string[]} dependencies - Service dependencies
|
|
149
138
|
* @property {Set<string>} dependents - Services that depend on this one
|
|
150
139
|
* @property {string[]} tags - Service tags
|
|
@@ -165,7 +154,7 @@
|
|
|
165
154
|
* @property {boolean} healthy - Health status
|
|
166
155
|
* @property {Error|null} error - Last error
|
|
167
156
|
* @property {import('../logging').Logger} logger - Service logger
|
|
168
|
-
* @property {(config?:
|
|
157
|
+
* @property {(config?: *) => Promise<boolean>} initialize
|
|
169
158
|
* @property {() => Promise<boolean>} start
|
|
170
159
|
* @property {(options?: StopOptions) => Promise<boolean>} stop
|
|
171
160
|
* @property {() => Promise<boolean>} recover
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
DRAG_OVER,
|
|
9
9
|
CAN_DROP,
|
|
10
10
|
CANNOT_DROP
|
|
11
|
-
} from '../../constants/
|
|
11
|
+
} from '../../constants/states/drop.js';
|
|
12
12
|
|
|
13
13
|
/** @typedef {import('../../typedef').DragData} DragData */
|
|
14
14
|
/** @typedef {import('../../typedef').DropData} DropData */
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
INVALID,
|
|
16
16
|
REQUIRED,
|
|
17
17
|
DISABLED
|
|
18
|
-
} from '../../../constants/
|
|
18
|
+
} from '../../../constants/states/input.js';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* @type {{
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
//
|
|
134
134
|
// Return CSS classes that indicate the component's state
|
|
135
135
|
//
|
|
136
|
-
// @see $lib/constants/
|
|
136
|
+
// @see $lib/constants/states
|
|
137
137
|
//
|
|
138
138
|
const outArr = [];
|
|
139
139
|
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
export * as bases from "./bases/index.js";
|
|
2
|
+
export * as http from "./http/index.js";
|
|
3
|
+
export * as mime from "./mime/index.js";
|
|
1
4
|
export * as regexp from "./regexp/index.js";
|
|
2
|
-
export * as
|
|
5
|
+
export * as states from "./states/index.js";
|
|
6
|
+
export * as time from "./time/index.js";
|
package/dist/constants/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export * as bases from './bases/index.js';
|
|
2
|
+
export * as http from './http/index.js';
|
|
3
|
+
export * as mime from './mime/index.js';
|
|
1
4
|
export * as regexp from './regexp/index.js';
|
|
2
|
-
export * as
|
|
3
|
-
|
|
5
|
+
export * as states from './states/index.js';
|
|
6
|
+
export * as time from './time/index.js';
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { APPLICATION_JSON } from '../../constants/mime/application.js';
|
|
12
12
|
import { CONTENT_TYPE } from '../../constants/http/headers.js';
|
|
13
13
|
|
|
14
|
-
import { AbortError, TimeoutError } from '../../
|
|
14
|
+
import { AbortError, TimeoutError } from '../../errors/api.js';
|
|
15
15
|
|
|
16
16
|
import * as expect from '../expect/index.js';
|
|
17
17
|
|
package/dist/util/http/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { METHOD_GET, METHOD_POST } from '../../constants/http/methods.js';
|
|
|
2
2
|
|
|
3
3
|
import { APPLICATION_JSON } from '../../constants/mime/application.js';
|
|
4
4
|
import { CONTENT_TYPE } from '../../constants/http/headers.js';
|
|
5
|
-
import { ResponseError } from '../../
|
|
5
|
+
import { ResponseError } from '../../errors/index.js';
|
|
6
6
|
|
|
7
7
|
import * as expect from '../expect/index.js';
|
|
8
8
|
|
package/dist/util/http/url.js
CHANGED
package/dist/util/time/index.js
CHANGED
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
MINUTE_MS,
|
|
34
34
|
HOUR_MS,
|
|
35
35
|
DAY_MS,
|
|
36
|
-
TIME_2025_01_01 } from '../../constants/time.js';
|
|
36
|
+
TIME_2025_01_01 } from '../../constants/time/index.js';
|
|
37
37
|
|
|
38
38
|
import * as expect from '../expect';
|
|
39
39
|
import { HkPromise } from '../../classes/promise/index.js';
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
/* ------------------------------------------------------------------ Imports */
|
|
19
19
|
|
|
20
|
-
import { ALPHABET_BASE_HUMAN, ALPHABET_BASE_58 } from '../../constants/bases.js';
|
|
20
|
+
import { ALPHABET_BASE_HUMAN, ALPHABET_BASE_58 } from '../../constants/bases/index.js';
|
|
21
21
|
|
|
22
22
|
import { base58fromNumber } from '../bases';
|
|
23
23
|
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|