@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.
Files changed (44) hide show
  1. package/dist/classes/services/ServiceBase.d.ts +4 -6
  2. package/dist/classes/services/ServiceBase.js +2 -3
  3. package/dist/classes/services/ServiceManager.d.ts +2 -4
  4. package/dist/classes/services/ServiceManager.js +1 -2
  5. package/dist/classes/services/typedef.d.ts +2 -11
  6. package/dist/classes/services/typedef.js +2 -13
  7. package/dist/components/drag-drop/Draggable.svelte +1 -1
  8. package/dist/components/drag-drop/DropZone.svelte +1 -1
  9. package/dist/components/inputs/text-input/TextInput.svelte +2 -2
  10. package/dist/constants/index.d.ts +5 -1
  11. package/dist/constants/index.js +5 -2
  12. package/dist/constants/states/index.d.ts +4 -0
  13. package/dist/constants/states/index.js +4 -0
  14. package/dist/util/exceptions/index.js +1 -1
  15. package/dist/util/http/http-request.js +1 -1
  16. package/dist/util/http/index.js +1 -1
  17. package/dist/util/http/json-request.js +1 -1
  18. package/dist/util/http/response.js +1 -1
  19. package/dist/util/http/url.js +1 -1
  20. package/dist/util/time/index.js +1 -1
  21. package/dist/util/unique/index.js +1 -1
  22. package/package.json +1 -1
  23. /package/dist/constants/{bases.d.ts → bases/index.d.ts} +0 -0
  24. /package/dist/constants/{bases.js → bases/index.js} +0 -0
  25. /package/dist/constants/{state-labels/drag-states.d.ts → states/drag.d.ts} +0 -0
  26. /package/dist/constants/{state-labels/drag-states.js → states/drag.js} +0 -0
  27. /package/dist/constants/{state-labels/drop-states.d.ts → states/drop.d.ts} +0 -0
  28. /package/dist/constants/{state-labels/drop-states.js → states/drop.js} +0 -0
  29. /package/dist/constants/{state-labels/input-states.d.ts → states/input.d.ts} +0 -0
  30. /package/dist/constants/{state-labels/input-states.js → states/input.js} +0 -0
  31. /package/dist/constants/{state-labels/submit-states.d.ts → states/submit.d.ts} +0 -0
  32. /package/dist/constants/{state-labels/submit-states.js → states/submit.js} +0 -0
  33. /package/dist/constants/{time.d.ts → time/index.d.ts} +0 -0
  34. /package/dist/constants/{time.js → time/index.js} +0 -0
  35. /package/dist/{constants/errors → errors}/api.d.ts +0 -0
  36. /package/dist/{constants/errors → errors}/api.js +0 -0
  37. /package/dist/{constants/errors → errors}/generic.d.ts +0 -0
  38. /package/dist/{constants/errors → errors}/generic.js +0 -0
  39. /package/dist/{constants/errors → errors}/http.d.ts +0 -0
  40. /package/dist/{constants/errors → errors}/http.js +0 -0
  41. /package/dist/{constants/errors → errors}/index.d.ts +0 -0
  42. /package/dist/{constants/errors → errors}/index.js +0 -0
  43. /package/dist/{constants/errors → errors}/jwt.d.ts +0 -0
  44. /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 {ServiceConfig} [config={}] - Service-specific configuration
36
+ * @param {*} [config={}] - Service-specific configuration
38
37
  *
39
38
  * @returns {Promise<boolean>} True if initialization succeeded
40
39
  */
41
- initialize(config?: ServiceConfig): Promise<boolean>;
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 {ServiceConfig} config - Service configuration
85
+ * @param {*} config - Service configuration
87
86
  *
88
87
  * @returns {Promise<void>}
89
88
  */
90
- protected _init(config: ServiceConfig): Promise<void>;
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 {ServiceConfig} [config={}] - Service-specific configuration
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 {ServiceConfig} config - Service configuration
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 {ServiceConfig} [config={}] - Service configuration
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?: ServiceConfig, options?: ServiceRegistrationOptions): void;
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 {ServiceConfig} [config={}] - Service configuration
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: ServiceConfig;
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?: ServiceConfig) => Promise<boolean>;
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 {ServiceConfig} config - Service configuration
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?: ServiceConfig) => Promise<boolean>} initialize
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
@@ -10,7 +10,7 @@
10
10
  DRAGGING,
11
11
  DRAG_PREVIEW,
12
12
  DROPPING
13
- } from '../../constants/state-labels/drag-states.js';
13
+ } from '../../constants/states/drag.js';
14
14
 
15
15
  /** @typedef {import('../../typedef').SimulatedDragEvent} SimulatedDragEvent */
16
16
 
@@ -8,7 +8,7 @@
8
8
  DRAG_OVER,
9
9
  CAN_DROP,
10
10
  CANNOT_DROP
11
- } from '../../constants/state-labels/drop-states.js';
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/state-labels/input-states.js';
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/state-labels
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 time from "./time.js";
5
+ export * as states from "./states/index.js";
6
+ export * as time from "./time/index.js";
@@ -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 time from './time.js';
3
- //export * as stateLabels from './state-labels/index.js';
5
+ export * as states from './states/index.js';
6
+ export * as time from './time/index.js';
@@ -0,0 +1,4 @@
1
+ export * as drag from "./drag.js";
2
+ export * as drop from "./drop.js";
3
+ export * as input from "./input.js";
4
+ export * as submit from "./submit.js";
@@ -0,0 +1,4 @@
1
+ export * as drag from './drag.js';
2
+ export * as drop from './drop.js';
3
+ export * as input from './input.js';
4
+ export * as submit from './submit.js';
@@ -1,5 +1,5 @@
1
1
 
2
- import { DetailedError } from "../../constants/errors/generic.js";
2
+ import { DetailedError } from "../../errors/generic.js";
3
3
 
4
4
  /**
5
5
  * Creates a new Error from the error message and throws it with a reference
@@ -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 '../../constants/errors/api.js';
14
+ import { AbortError, TimeoutError } from '../../errors/api.js';
15
15
 
16
16
  import * as expect from '../expect/index.js';
17
17
 
@@ -5,7 +5,7 @@
5
5
  // AbortError,
6
6
  // TimeoutError,
7
7
  // TypeOrValueError
8
- // } from '$lib/constants/errors/index.js';
8
+ // } from '$lib/errors/index.js';
9
9
 
10
10
  // import { setRequestHeaders } from './headers.js';
11
11
  // import { getErrorFromResponse } from './errors.js';
@@ -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 '../../constants/errors/index.js';
5
+ import { ResponseError } from '../../errors/index.js';
6
6
 
7
7
  import * as expect from '../expect/index.js';
8
8
 
@@ -1,4 +1,4 @@
1
- import { ResponseError } from '../../constants/errors/index.js';
1
+ import { ResponseError } from '../../errors/index.js';
2
2
  import * as expect from '../expect/index.js';
3
3
  import { toURL } from './url.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { TypeOrValueError } from '../../constants/errors/index.js';
1
+ import { TypeOrValueError } from '../../errors/index.js';
2
2
 
3
3
  /**
4
4
  * Returns an URL instance
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hkdigital/lib-core",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "author": {
5
5
  "name": "HKdigital",
6
6
  "url": "https://hkdigital.nl"
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