@hkdigital/lib-core 0.3.4 → 0.3.6
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/components/index.d.ts +11 -0
- package/dist/components/index.js +23 -2
- package/dist/{features → components}/presenter/Presenter.svelte +1 -1
- package/dist/logging/index.d.ts +4 -5
- package/dist/logging/index.js +5 -6
- package/dist/logging/{adapters → internal/adapters}/console.js +1 -1
- package/dist/logging/internal/adapters/index.d.ts +2 -0
- package/dist/logging/internal/adapters/index.js +2 -0
- package/dist/logging/{adapters → internal/adapters}/pino.js +33 -8
- package/dist/logging/{factories → internal/factories}/client.d.ts +1 -1
- package/dist/logging/{factories → internal/factories}/client.js +2 -2
- package/dist/logging/{factories → internal/factories}/server.d.ts +1 -1
- package/dist/logging/{factories → internal/factories}/server.js +2 -2
- package/dist/logging/{factories → internal/factories}/universal.d.ts +2 -2
- package/dist/logging/{factories → internal/factories}/universal.js +1 -2
- package/dist/{classes/logging → logging/internal/unified-logger}/Logger.d.ts +3 -3
- package/dist/{classes/logging → logging/internal/unified-logger}/Logger.js +19 -12
- package/dist/{classes/logging → logging/internal/unified-logger}/constants.d.ts +1 -0
- package/dist/{classes/logging → logging/internal/unified-logger}/constants.js +8 -2
- package/dist/{classes/logging → logging/internal/unified-logger}/index.d.ts +1 -0
- package/dist/{classes/logging → logging/internal/unified-logger}/index.js +2 -0
- package/dist/{components → primitives}/buttons/button/Button.svelte.d.ts +1 -1
- package/dist/{components → primitives}/drag-drop/DropZoneArea.svelte.d.ts +1 -1
- package/dist/primitives/index.d.ts +0 -0
- package/dist/primitives/index.js +2 -0
- package/dist/{components → primitives}/layout/grid-layers/util.js +1 -1
- package/dist/{components → primitives}/rows/panel-grid-row/PanelGridRow.svelte.d.ts +1 -1
- package/dist/{components → primitives}/rows/panel-row-2/PanelRow2.svelte.d.ts +1 -1
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +1 -0
- package/dist/services/internal/index.d.ts +6 -0
- package/dist/services/internal/index.js +8 -0
- package/dist/{classes/services → services/internal/service-base}/ServiceBase.d.ts +2 -2
- package/dist/{classes/services → services/internal/service-base}/ServiceBase.js +3 -3
- package/dist/{classes/services/service-states.d.ts → services/internal/service-base/constants.d.ts} +0 -61
- package/dist/{classes/services/service-states.js → services/internal/service-base/constants.js} +0 -95
- package/dist/services/internal/service-base/index.d.ts +3 -0
- package/dist/services/internal/service-base/index.js +3 -0
- package/dist/{classes/services → services/internal/service-base}/typedef.d.ts +34 -138
- package/dist/{classes/services → services/internal/service-base}/typedef.js +31 -98
- package/dist/{classes/services → services/internal/service-manager}/ServiceManager.d.ts +6 -5
- package/dist/{classes/services → services/internal/service-manager}/ServiceManager.js +6 -5
- package/dist/services/internal/service-manager/constants.d.ts +4 -0
- package/dist/services/internal/service-manager/constants.js +6 -0
- package/dist/services/internal/service-manager/typedef.d.ts +104 -0
- package/dist/services/internal/service-manager/typedef.js +90 -0
- package/package.json +1 -1
- package/dist/classes/services/index.d.ts +0 -4
- package/dist/classes/services/index.js +0 -5
- package/dist/features/index.d.ts +0 -11
- package/dist/features/index.js +0 -23
- package/dist/logging/constants.d.ts +0 -1
- package/dist/logging/constants.js +0 -1
- package/dist/server/index.d.ts +0 -1
- package/dist/server/index.js +0 -1
- package/dist/server/logger.d.ts +0 -25
- package/dist/server/logger.js +0 -94
- /package/dist/classes/{events → event-emitter}/EventEmitter.d.ts +0 -0
- /package/dist/classes/{events → event-emitter}/EventEmitter.js +0 -0
- /package/dist/classes/{events → event-emitter}/index.d.ts +0 -0
- /package/dist/classes/{events → event-emitter}/index.js +0 -0
- /package/dist/{features → components}/button-group/ButtonGroup.svelte +0 -0
- /package/dist/{features → components}/button-group/ButtonGroup.svelte.d.ts +0 -0
- /package/dist/{features → components}/button-group/typedef.d.ts +0 -0
- /package/dist/{features → components}/button-group/typedef.js +0 -0
- /package/dist/{features → components}/compare-left-right/CompareLeftRight.svelte +0 -0
- /package/dist/{features → components}/compare-left-right/CompareLeftRight.svelte.d.ts +0 -0
- /package/dist/{features → components}/compare-left-right/index.d.ts +0 -0
- /package/dist/{features → components}/compare-left-right/index.js +0 -0
- /package/dist/{features → components}/game-box/GameBox.svelte +0 -0
- /package/dist/{features → components}/game-box/GameBox.svelte.d.ts +0 -0
- /package/dist/{features → components}/game-box/gamebox.util.d.ts +0 -0
- /package/dist/{features → components}/game-box/gamebox.util.js +0 -0
- /package/dist/{features → components}/hk-app-layout/HkAppLayout.state.svelte.d.ts +0 -0
- /package/dist/{features → components}/hk-app-layout/HkAppLayout.state.svelte.js +0 -0
- /package/dist/{features → components}/hk-app-layout/HkAppLayout.svelte +0 -0
- /package/dist/{features → components}/hk-app-layout/HkAppLayout.svelte.d.ts +0 -0
- /package/dist/{features → components}/image-box/ImageBox.svelte +0 -0
- /package/dist/{features → components}/image-box/ImageBox.svelte.d.ts +0 -0
- /package/dist/{features → components}/image-box/index.d.ts +0 -0
- /package/dist/{features → components}/image-box/index.js +0 -0
- /package/dist/{features → components}/image-box/typedef.d.ts +0 -0
- /package/dist/{features → components}/image-box/typedef.js +0 -0
- /package/dist/{features → components}/presenter/ImageSlide.svelte +0 -0
- /package/dist/{features → components}/presenter/ImageSlide.svelte.d.ts +0 -0
- /package/dist/{features → components}/presenter/Presenter.state.svelte.d.ts +0 -0
- /package/dist/{features → components}/presenter/Presenter.state.svelte.js +0 -0
- /package/dist/{features → components}/presenter/Presenter.svelte.d.ts +0 -0
- /package/dist/{features → components}/presenter/constants.d.ts +0 -0
- /package/dist/{features → components}/presenter/constants.js +0 -0
- /package/dist/{features → components}/presenter/index.d.ts +0 -0
- /package/dist/{features → components}/presenter/index.js +0 -0
- /package/dist/{features → components}/presenter/typedef.d.ts +0 -0
- /package/dist/{features → components}/presenter/typedef.js +0 -0
- /package/dist/{features → components}/presenter/util.d.ts +0 -0
- /package/dist/{features → components}/presenter/util.js +0 -0
- /package/dist/{features → components}/virtual-viewport/VirtualViewport.svelte +0 -0
- /package/dist/{features → components}/virtual-viewport/VirtualViewport.svelte.d.ts +0 -0
- /package/dist/logging/{adapters → internal/adapters}/console.d.ts +0 -0
- /package/dist/logging/{adapters → internal/adapters}/pino.d.ts +0 -0
- /package/dist/{classes/logging → logging/internal/unified-logger}/typedef.d.ts +0 -0
- /package/dist/{classes/logging → logging/internal/unified-logger}/typedef.js +0 -0
- /package/dist/{components → primitives}/area/HkArea.svelte +0 -0
- /package/dist/{components → primitives}/area/HkArea.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/area/HkGridArea.svelte +0 -0
- /package/dist/{components → primitives}/area/HkGridArea.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/area/index.d.ts +0 -0
- /package/dist/{components → primitives}/area/index.js +0 -0
- /package/dist/{components → primitives}/buttons/button/Button.svelte +0 -0
- /package/dist/{components → primitives}/buttons/button-icon-steeze/SteezeIconButton.svelte +0 -0
- /package/dist/{components → primitives}/buttons/button-icon-steeze/SteezeIconButton.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/buttons/button-text/TextButton.svelte +0 -0
- /package/dist/{components → primitives}/buttons/button-text/TextButton.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/buttons/index.d.ts +0 -0
- /package/dist/{components → primitives}/buttons/index.js +0 -0
- /package/dist/{components → primitives}/debug/debug-panel-design-scaling/DebugPanelDesignScaling.svelte +0 -0
- /package/dist/{components → primitives}/debug/debug-panel-design-scaling/DebugPanelDesignScaling.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/debug/index.d.ts +0 -0
- /package/dist/{components → primitives}/debug/index.js +0 -0
- /package/dist/{components → primitives}/drag-drop/DragController.d.ts +0 -0
- /package/dist/{components → primitives}/drag-drop/DragController.js +0 -0
- /package/dist/{components → primitives}/drag-drop/DragDropContext.svelte +0 -0
- /package/dist/{components → primitives}/drag-drop/DragDropContext.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/drag-drop/Draggable.svelte +0 -0
- /package/dist/{components → primitives}/drag-drop/Draggable.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/drag-drop/DropZone.svelte +0 -0
- /package/dist/{components → primitives}/drag-drop/DropZone.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/drag-drop/DropZoneArea.svelte +0 -0
- /package/dist/{components → primitives}/drag-drop/DropZoneList.svelte +0 -0
- /package/dist/{components → primitives}/drag-drop/DropZoneList.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/drag-drop/actions.d.ts +0 -0
- /package/dist/{components → primitives}/drag-drop/actions.js +0 -0
- /package/dist/{components → primitives}/drag-drop/drag-state.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/drag-drop/drag-state.svelte.js +0 -0
- /package/dist/{components → primitives}/drag-drop/index.d.ts +0 -0
- /package/dist/{components → primitives}/drag-drop/index.js +0 -0
- /package/dist/{components → primitives}/drag-drop/util.d.ts +0 -0
- /package/dist/{components → primitives}/drag-drop/util.js +0 -0
- /package/dist/{components → primitives}/hkdev/blocks/TextBlock.svelte +0 -0
- /package/dist/{components → primitives}/hkdev/blocks/TextBlock.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/hkdev/buttons/CheckButton.svelte +0 -0
- /package/dist/{components → primitives}/hkdev/buttons/CheckButton.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/icons/HkIcon.svelte +0 -0
- /package/dist/{components → primitives}/icons/HkIcon.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/icons/HkTabIcon.svelte +0 -0
- /package/dist/{components → primitives}/icons/HkTabIcon.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/icons/SteezeIcon.svelte +0 -0
- /package/dist/{components → primitives}/icons/SteezeIcon.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/icons/index.d.ts +0 -0
- /package/dist/{components → primitives}/icons/index.js +0 -0
- /package/dist/{components → primitives}/icons/typedef.d.ts +0 -0
- /package/dist/{components → primitives}/icons/typedef.js +0 -0
- /package/dist/{components → primitives}/inputs/index.d.ts +0 -0
- /package/dist/{components → primitives}/inputs/index.js +0 -0
- /package/dist/{components → primitives}/inputs/text-input/TestTextInput.svelte__ +0 -0
- /package/dist/{components → primitives}/inputs/text-input/TextInput.svelte +0 -0
- /package/dist/{components → primitives}/inputs/text-input/TextInput.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/inputs/text-input/TextInput.svelte___ +0 -0
- /package/dist/{components → primitives}/inputs/text-input/assets/IconInvalid.svelte +0 -0
- /package/dist/{components → primitives}/inputs/text-input/assets/IconInvalid.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/inputs/text-input/assets/IconValid.svelte +0 -0
- /package/dist/{components → primitives}/inputs/text-input/assets/IconValid.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/layout/grid-layers/GridLayers.svelte +0 -0
- /package/dist/{components → primitives}/layout/grid-layers/GridLayers.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/layout/grid-layers/GridLayers.svelte__heightFrom__ +0 -0
- /package/dist/{components → primitives}/layout/grid-layers/util.d.ts +0 -0
- /package/dist/{components → primitives}/layout/index.d.ts +0 -0
- /package/dist/{components → primitives}/layout/index.js +0 -0
- /package/dist/{components → primitives}/panels/index.d.ts +0 -0
- /package/dist/{components → primitives}/panels/index.js +0 -0
- /package/dist/{components → primitives}/panels/panel/Panel.svelte +0 -0
- /package/dist/{components → primitives}/panels/panel/Panel.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/rows/index.d.ts +0 -0
- /package/dist/{components → primitives}/rows/index.js +0 -0
- /package/dist/{components → primitives}/rows/panel-grid-row/PanelGridRow.svelte +0 -0
- /package/dist/{components → primitives}/rows/panel-row-2/PanelRow2.svelte +0 -0
- /package/dist/{components → primitives}/tab-bar/HkTabBar.state.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/tab-bar/HkTabBar.state.svelte.js +0 -0
- /package/dist/{components → primitives}/tab-bar/HkTabBar.svelte +0 -0
- /package/dist/{components → primitives}/tab-bar/HkTabBar.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/tab-bar/HkTabBarSelector.state.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/tab-bar/HkTabBarSelector.state.svelte.js +0 -0
- /package/dist/{components → primitives}/tab-bar/HkTabBarSelector.svelte +0 -0
- /package/dist/{components → primitives}/tab-bar/HkTabBarSelector.svelte.d.ts +0 -0
- /package/dist/{components → primitives}/tab-bar/index.d.ts +0 -0
- /package/dist/{components → primitives}/tab-bar/index.js +0 -0
- /package/dist/{components → primitives}/tab-bar/typedef.d.ts +0 -0
- /package/dist/{components → primitives}/tab-bar/typedef.js +0 -0
|
@@ -53,6 +53,40 @@ export type HealthStatus = {
|
|
|
53
53
|
*/
|
|
54
54
|
key?: any;
|
|
55
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* Base class interface that services must implement
|
|
58
|
+
*/
|
|
59
|
+
export type ServiceInstance = {
|
|
60
|
+
/**
|
|
61
|
+
* - Service name
|
|
62
|
+
*/
|
|
63
|
+
name: string;
|
|
64
|
+
/**
|
|
65
|
+
* - Current state
|
|
66
|
+
*/
|
|
67
|
+
state: string;
|
|
68
|
+
/**
|
|
69
|
+
* - Health status
|
|
70
|
+
*/
|
|
71
|
+
healthy: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* - Last error
|
|
74
|
+
*/
|
|
75
|
+
error: Error | null;
|
|
76
|
+
/**
|
|
77
|
+
* - Service logger
|
|
78
|
+
*/
|
|
79
|
+
logger: import("../../../logging/internal/unified-logger").Logger;
|
|
80
|
+
initialize: (config?: any) => Promise<boolean>;
|
|
81
|
+
start: () => Promise<boolean>;
|
|
82
|
+
stop: (options?: StopOptions) => Promise<boolean>;
|
|
83
|
+
recover: () => Promise<boolean>;
|
|
84
|
+
destroy: () => Promise<boolean>;
|
|
85
|
+
getHealth: () => Promise<HealthStatus>;
|
|
86
|
+
setLogLevel: (level: string) => boolean;
|
|
87
|
+
on: (event: string, handler: Function) => Function;
|
|
88
|
+
emit: (event: string, data: any) => boolean;
|
|
89
|
+
};
|
|
56
90
|
export type StateChangeEvent = {
|
|
57
91
|
/**
|
|
58
92
|
* - Service name (added by ServiceManager)
|
|
@@ -98,141 +132,3 @@ export type ServiceErrorEvent = {
|
|
|
98
132
|
*/
|
|
99
133
|
error: Error;
|
|
100
134
|
};
|
|
101
|
-
/**
|
|
102
|
-
* Service class constructor type
|
|
103
|
-
*/
|
|
104
|
-
export type ServiceConstructor = new (name: string, options?: ServiceOptions) => ServiceInstance;
|
|
105
|
-
/**
|
|
106
|
-
* Options for registering a service
|
|
107
|
-
*/
|
|
108
|
-
export type ServiceRegistrationOptions = {
|
|
109
|
-
/**
|
|
110
|
-
* - Services this service depends on
|
|
111
|
-
*/
|
|
112
|
-
dependencies?: string[];
|
|
113
|
-
/**
|
|
114
|
-
* - Tags for grouping services
|
|
115
|
-
*/
|
|
116
|
-
tags?: string[];
|
|
117
|
-
/**
|
|
118
|
-
* - Startup priority (higher starts first)
|
|
119
|
-
*/
|
|
120
|
-
priority?: number;
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* Configuration for ServiceManager
|
|
124
|
-
*/
|
|
125
|
-
export type ServiceManagerConfig = {
|
|
126
|
-
/**
|
|
127
|
-
* - Debug mode switch
|
|
128
|
-
*/
|
|
129
|
-
debug?: boolean;
|
|
130
|
-
/**
|
|
131
|
-
* - Auto-start services on registration
|
|
132
|
-
*/
|
|
133
|
-
autoStart?: boolean;
|
|
134
|
-
/**
|
|
135
|
-
* - Default timeout for stopping services
|
|
136
|
-
*/
|
|
137
|
-
stopTimeout?: number;
|
|
138
|
-
/**
|
|
139
|
-
* - Initial log level for ServiceManager
|
|
140
|
-
*/
|
|
141
|
-
logLevel?: string;
|
|
142
|
-
/**
|
|
143
|
-
* - Logging configuration
|
|
144
|
-
*/
|
|
145
|
-
logConfig?: LogConfig;
|
|
146
|
-
};
|
|
147
|
-
/**
|
|
148
|
-
* Logging configuration
|
|
149
|
-
*/
|
|
150
|
-
export type LogConfig = {
|
|
151
|
-
/**
|
|
152
|
-
* - Default log level for services
|
|
153
|
-
*/
|
|
154
|
-
defaultLevel?: string;
|
|
155
|
-
/**
|
|
156
|
-
* - Override level for all services
|
|
157
|
-
*/
|
|
158
|
-
globalLevel?: string;
|
|
159
|
-
/**
|
|
160
|
-
* - Per-service log levels
|
|
161
|
-
*/
|
|
162
|
-
serviceLevels?: {
|
|
163
|
-
[x: string]: string;
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
/**
|
|
167
|
-
* Internal service registry entry
|
|
168
|
-
*/
|
|
169
|
-
export type ServiceEntry = {
|
|
170
|
-
/**
|
|
171
|
-
* - Service class constructor
|
|
172
|
-
*/
|
|
173
|
-
ServiceClass: ServiceConstructor;
|
|
174
|
-
/**
|
|
175
|
-
* - Service instance (lazy-created)
|
|
176
|
-
*/
|
|
177
|
-
instance: ServiceInstance | null;
|
|
178
|
-
/**
|
|
179
|
-
* - Service configuration
|
|
180
|
-
*/
|
|
181
|
-
config: any;
|
|
182
|
-
/**
|
|
183
|
-
* - Service dependencies
|
|
184
|
-
*/
|
|
185
|
-
dependencies: string[];
|
|
186
|
-
/**
|
|
187
|
-
* - Services that depend on this one
|
|
188
|
-
*/
|
|
189
|
-
dependents: Set<string>;
|
|
190
|
-
/**
|
|
191
|
-
* - Service tags
|
|
192
|
-
*/
|
|
193
|
-
tags: string[];
|
|
194
|
-
/**
|
|
195
|
-
* - Startup priority
|
|
196
|
-
*/
|
|
197
|
-
priority: number;
|
|
198
|
-
};
|
|
199
|
-
/**
|
|
200
|
-
* Result of health check for all services
|
|
201
|
-
*/
|
|
202
|
-
export type HealthCheckResult = {
|
|
203
|
-
[x: string]: HealthStatus;
|
|
204
|
-
};
|
|
205
|
-
/**
|
|
206
|
-
* Base class interface that services must implement
|
|
207
|
-
*/
|
|
208
|
-
export type ServiceInstance = {
|
|
209
|
-
/**
|
|
210
|
-
* - Service name
|
|
211
|
-
*/
|
|
212
|
-
name: string;
|
|
213
|
-
/**
|
|
214
|
-
* - Current state
|
|
215
|
-
*/
|
|
216
|
-
state: string;
|
|
217
|
-
/**
|
|
218
|
-
* - Health status
|
|
219
|
-
*/
|
|
220
|
-
healthy: boolean;
|
|
221
|
-
/**
|
|
222
|
-
* - Last error
|
|
223
|
-
*/
|
|
224
|
-
error: Error | null;
|
|
225
|
-
/**
|
|
226
|
-
* - Service logger
|
|
227
|
-
*/
|
|
228
|
-
logger: import("../logging").Logger;
|
|
229
|
-
initialize: (config?: any) => Promise<boolean>;
|
|
230
|
-
start: () => Promise<boolean>;
|
|
231
|
-
stop: (options?: StopOptions) => Promise<boolean>;
|
|
232
|
-
recover: () => Promise<boolean>;
|
|
233
|
-
destroy: () => Promise<boolean>;
|
|
234
|
-
getHealth: () => Promise<HealthStatus>;
|
|
235
|
-
setLogLevel: (level: string) => boolean;
|
|
236
|
-
on: (event: string, handler: Function) => Function;
|
|
237
|
-
emit: (event: string, data: any) => boolean;
|
|
238
|
-
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fileoverview Type definitions for
|
|
2
|
+
* @fileoverview Type definitions for ServiceBase class.
|
|
3
3
|
*
|
|
4
|
-
* This file contains all TypeScript/JSDoc type definitions used
|
|
5
|
-
* the
|
|
6
|
-
* implementations and when using the ServiceManager.
|
|
4
|
+
* This file contains all TypeScript/JSDoc type definitions used by
|
|
5
|
+
* the ServiceBase class and service implementations.
|
|
7
6
|
*
|
|
8
7
|
* @example
|
|
9
8
|
* // In your service implementation
|
|
@@ -18,29 +17,12 @@
|
|
|
18
17
|
* return { latency: 10 };
|
|
19
18
|
* }
|
|
20
19
|
* }
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* // When using ServiceManager
|
|
24
|
-
* import { ServiceManager } from './ServiceManager.js';
|
|
25
|
-
*
|
|
26
|
-
* // @ typedef {import('./typedef.js').ServiceManagerConfig} ServiceManagerConfig
|
|
27
|
-
* // @ typedef {import('./typedef.js').ServiceRegistrationOptions} ServiceRegistrationOptions
|
|
28
|
-
*
|
|
29
|
-
* const config = {
|
|
30
|
-
* environment: 'development',
|
|
31
|
-
* stopTimeout: 5000
|
|
32
|
-
* };
|
|
33
|
-
*
|
|
34
|
-
* const manager = new ServiceManager(config);
|
|
35
|
-
*
|
|
36
|
-
* const options = {
|
|
37
|
-
* dependencies: ['database'],
|
|
38
|
-
* tags: ['critical']
|
|
39
|
-
* };
|
|
40
|
-
*
|
|
41
|
-
* manager.register('auth', AuthService, {}, options);
|
|
42
20
|
*/
|
|
43
21
|
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// PUBLIC TYPES
|
|
24
|
+
// ============================================================================
|
|
25
|
+
|
|
44
26
|
/**
|
|
45
27
|
* Options for creating a service instance
|
|
46
28
|
*
|
|
@@ -69,6 +51,30 @@
|
|
|
69
51
|
* @property {*} [key] - Additional health check properties
|
|
70
52
|
*/
|
|
71
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Base class interface that services must implement
|
|
56
|
+
*
|
|
57
|
+
* @typedef {Object} ServiceInstance
|
|
58
|
+
* @property {string} name - Service name
|
|
59
|
+
* @property {string} state - Current state
|
|
60
|
+
* @property {boolean} healthy - Health status
|
|
61
|
+
* @property {Error|null} error - Last error
|
|
62
|
+
* @property {import('../../../logging/internal/unified-logger').Logger} logger - Service logger
|
|
63
|
+
* @property {(config?: *) => Promise<boolean>} initialize
|
|
64
|
+
* @property {() => Promise<boolean>} start
|
|
65
|
+
* @property {(options?: StopOptions) => Promise<boolean>} stop
|
|
66
|
+
* @property {() => Promise<boolean>} recover
|
|
67
|
+
* @property {() => Promise<boolean>} destroy
|
|
68
|
+
* @property {() => Promise<HealthStatus>} getHealth
|
|
69
|
+
* @property {(level: string) => boolean} setLogLevel
|
|
70
|
+
* @property {(event: string, handler: Function) => Function} on
|
|
71
|
+
* @property {(event: string, data: any) => boolean} emit
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
// ============================================================================
|
|
75
|
+
// INTERNAL TYPES
|
|
76
|
+
// ============================================================================
|
|
77
|
+
|
|
72
78
|
/**
|
|
73
79
|
* @typedef {Object} StateChangeEvent
|
|
74
80
|
* @property {string} service - Service name (added by ServiceManager)
|
|
@@ -92,77 +98,4 @@
|
|
|
92
98
|
* @property {Error} error - Error that occurred
|
|
93
99
|
*/
|
|
94
100
|
|
|
95
|
-
/**
|
|
96
|
-
* Service class constructor type
|
|
97
|
-
*
|
|
98
|
-
* @typedef {new (name: string, options?: ServiceOptions) => ServiceInstance} ServiceConstructor
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Options for registering a service
|
|
103
|
-
*
|
|
104
|
-
* @typedef {Object} ServiceRegistrationOptions
|
|
105
|
-
* @property {string[]} [dependencies=[]] - Services this service depends on
|
|
106
|
-
* @property {string[]} [tags=[]] - Tags for grouping services
|
|
107
|
-
* @property {number} [priority=0] - Startup priority (higher starts first)
|
|
108
|
-
*/
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Configuration for ServiceManager
|
|
112
|
-
*
|
|
113
|
-
* @typedef {Object} ServiceManagerConfig
|
|
114
|
-
* @property {boolean} [debug=false] - Debug mode switch
|
|
115
|
-
* @property {boolean} [autoStart=false] - Auto-start services on registration
|
|
116
|
-
* @property {number} [stopTimeout=10000] - Default timeout for stopping services
|
|
117
|
-
* @property {string} [logLevel] - Initial log level for ServiceManager
|
|
118
|
-
* @property {LogConfig} [logConfig={}] - Logging configuration
|
|
119
|
-
*/
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Logging configuration
|
|
123
|
-
*
|
|
124
|
-
* @typedef {Object} LogConfig
|
|
125
|
-
* @property {string} [defaultLevel] - Default log level for services
|
|
126
|
-
* @property {string} [globalLevel] - Override level for all services
|
|
127
|
-
* @property {Object<string, string>} [serviceLevels] - Per-service log levels
|
|
128
|
-
*/
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Internal service registry entry
|
|
132
|
-
*
|
|
133
|
-
* @typedef {Object} ServiceEntry
|
|
134
|
-
* @property {ServiceConstructor} ServiceClass - Service class constructor
|
|
135
|
-
* @property {ServiceInstance|null} instance - Service instance (lazy-created)
|
|
136
|
-
* @property {*} config - Service configuration
|
|
137
|
-
* @property {string[]} dependencies - Service dependencies
|
|
138
|
-
* @property {Set<string>} dependents - Services that depend on this one
|
|
139
|
-
* @property {string[]} tags - Service tags
|
|
140
|
-
* @property {number} priority - Startup priority
|
|
141
|
-
*/
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Result of health check for all services
|
|
145
|
-
* @typedef {Object<string, HealthStatus>} HealthCheckResult
|
|
146
|
-
*/
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Base class interface that services must implement
|
|
150
|
-
*
|
|
151
|
-
* @typedef {Object} ServiceInstance
|
|
152
|
-
* @property {string} name - Service name
|
|
153
|
-
* @property {string} state - Current state
|
|
154
|
-
* @property {boolean} healthy - Health status
|
|
155
|
-
* @property {Error|null} error - Last error
|
|
156
|
-
* @property {import('../logging').Logger} logger - Service logger
|
|
157
|
-
* @property {(config?: *) => Promise<boolean>} initialize
|
|
158
|
-
* @property {() => Promise<boolean>} start
|
|
159
|
-
* @property {(options?: StopOptions) => Promise<boolean>} stop
|
|
160
|
-
* @property {() => Promise<boolean>} recover
|
|
161
|
-
* @property {() => Promise<boolean>} destroy
|
|
162
|
-
* @property {() => Promise<HealthStatus>} getHealth
|
|
163
|
-
* @property {(level: string) => boolean} setLogLevel
|
|
164
|
-
* @property {(event: string, handler: Function) => Function} on
|
|
165
|
-
* @property {(event: string, data: any) => boolean} emit
|
|
166
|
-
*/
|
|
167
|
-
|
|
168
101
|
export {};
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* @typedef {import('./typedef.js').ServiceConstructor} ServiceConstructor
|
|
3
3
|
* @typedef {import('./typedef.js').ServiceRegistrationOptions} ServiceRegistrationOptions
|
|
4
4
|
* @typedef {import('./typedef.js').ServiceManagerConfig} ServiceManagerConfig
|
|
5
|
-
* @typedef {import('./typedef.js').StopOptions} StopOptions
|
|
6
5
|
* @typedef {import('./typedef.js').ServiceEntry} ServiceEntry
|
|
7
6
|
* @typedef {import('./typedef.js').HealthCheckResult} HealthCheckResult
|
|
7
|
+
*
|
|
8
|
+
* @typedef {import('../service-base/typedef.js').StopOptions} StopOptions
|
|
8
9
|
*/
|
|
9
10
|
/**
|
|
10
11
|
* Service Manager for lifecycle and dependency management
|
|
@@ -152,7 +153,7 @@ export class ServiceManager extends EventEmitter {
|
|
|
152
153
|
*
|
|
153
154
|
* @private
|
|
154
155
|
* @param {string} name - Service name
|
|
155
|
-
* @param {import('
|
|
156
|
+
* @param {import('../service-base/typedef.js').ServiceInstance} instance
|
|
156
157
|
* Service instance
|
|
157
158
|
*/
|
|
158
159
|
private _attachServiceEvents;
|
|
@@ -170,8 +171,8 @@ export default ServiceManager;
|
|
|
170
171
|
export type ServiceConstructor = import("./typedef.js").ServiceConstructor;
|
|
171
172
|
export type ServiceRegistrationOptions = import("./typedef.js").ServiceRegistrationOptions;
|
|
172
173
|
export type ServiceManagerConfig = import("./typedef.js").ServiceManagerConfig;
|
|
173
|
-
export type StopOptions = import("./typedef.js").StopOptions;
|
|
174
174
|
export type ServiceEntry = import("./typedef.js").ServiceEntry;
|
|
175
175
|
export type HealthCheckResult = import("./typedef.js").HealthCheckResult;
|
|
176
|
-
|
|
177
|
-
import {
|
|
176
|
+
export type StopOptions = import("../service-base/typedef.js").StopOptions;
|
|
177
|
+
import { EventEmitter } from '../../../classes/event-emitter';
|
|
178
|
+
import { Logger } from '../../../logging/index.js';
|
|
@@ -63,23 +63,24 @@
|
|
|
63
63
|
* });
|
|
64
64
|
*/
|
|
65
65
|
|
|
66
|
-
import { EventEmitter } from '
|
|
67
|
-
import { Logger, DEBUG, INFO, WARN } from '
|
|
66
|
+
import { EventEmitter } from '../../../classes/event-emitter';
|
|
67
|
+
import { Logger, DEBUG, INFO, WARN } from '../../../logging/index.js';
|
|
68
68
|
|
|
69
69
|
import {
|
|
70
70
|
NOT_CREATED,
|
|
71
71
|
CREATED,
|
|
72
72
|
RUNNING,
|
|
73
73
|
DESTROYED
|
|
74
|
-
} from '
|
|
74
|
+
} from '../service-base/constants.js';
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* @typedef {import('./typedef.js').ServiceConstructor} ServiceConstructor
|
|
78
78
|
* @typedef {import('./typedef.js').ServiceRegistrationOptions} ServiceRegistrationOptions
|
|
79
79
|
* @typedef {import('./typedef.js').ServiceManagerConfig} ServiceManagerConfig
|
|
80
|
-
* @typedef {import('./typedef.js').StopOptions} StopOptions
|
|
81
80
|
* @typedef {import('./typedef.js').ServiceEntry} ServiceEntry
|
|
82
81
|
* @typedef {import('./typedef.js').HealthCheckResult} HealthCheckResult
|
|
82
|
+
*
|
|
83
|
+
* @typedef {import('../service-base/typedef.js').StopOptions} StopOptions
|
|
83
84
|
*/
|
|
84
85
|
|
|
85
86
|
/**
|
|
@@ -544,7 +545,7 @@ export class ServiceManager extends EventEmitter {
|
|
|
544
545
|
*
|
|
545
546
|
* @private
|
|
546
547
|
* @param {string} name - Service name
|
|
547
|
-
* @param {import('
|
|
548
|
+
* @param {import('../service-base/typedef.js').ServiceInstance} instance
|
|
548
549
|
* Service instance
|
|
549
550
|
*/
|
|
550
551
|
_attachServiceEvents(name, instance) {
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for registering a service
|
|
3
|
+
*/
|
|
4
|
+
export type ServiceRegistrationOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* - Services this service depends on
|
|
7
|
+
*/
|
|
8
|
+
dependencies?: string[];
|
|
9
|
+
/**
|
|
10
|
+
* - Tags for grouping services
|
|
11
|
+
*/
|
|
12
|
+
tags?: string[];
|
|
13
|
+
/**
|
|
14
|
+
* - Startup priority (higher starts first)
|
|
15
|
+
*/
|
|
16
|
+
priority?: number;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Configuration for ServiceManager
|
|
20
|
+
*/
|
|
21
|
+
export type ServiceManagerConfig = {
|
|
22
|
+
/**
|
|
23
|
+
* - Debug mode switch
|
|
24
|
+
*/
|
|
25
|
+
debug?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* - Auto-start services on registration
|
|
28
|
+
*/
|
|
29
|
+
autoStart?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* - Default timeout for stopping services
|
|
32
|
+
*/
|
|
33
|
+
stopTimeout?: number;
|
|
34
|
+
/**
|
|
35
|
+
* - Initial log level for ServiceManager
|
|
36
|
+
*/
|
|
37
|
+
logLevel?: string;
|
|
38
|
+
/**
|
|
39
|
+
* - Logging configuration
|
|
40
|
+
*/
|
|
41
|
+
logConfig?: LogConfig;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Logging configuration
|
|
45
|
+
*/
|
|
46
|
+
export type LogConfig = {
|
|
47
|
+
/**
|
|
48
|
+
* - Default log level for services
|
|
49
|
+
*/
|
|
50
|
+
defaultLevel?: string;
|
|
51
|
+
/**
|
|
52
|
+
* - Override level for all services
|
|
53
|
+
*/
|
|
54
|
+
globalLevel?: string;
|
|
55
|
+
/**
|
|
56
|
+
* - Per-service log levels
|
|
57
|
+
*/
|
|
58
|
+
serviceLevels?: {
|
|
59
|
+
[x: string]: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Result of health check for all services
|
|
64
|
+
*/
|
|
65
|
+
export type HealthCheckResult = {
|
|
66
|
+
[x: string]: HealthStatus;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Service class constructor type
|
|
70
|
+
*/
|
|
71
|
+
export type ServiceConstructor = new (name: string, options?: ServiceOptions) => ServiceInstance;
|
|
72
|
+
/**
|
|
73
|
+
* Internal service registry entry
|
|
74
|
+
*/
|
|
75
|
+
export type ServiceEntry = {
|
|
76
|
+
/**
|
|
77
|
+
* - Service class constructor
|
|
78
|
+
*/
|
|
79
|
+
ServiceClass: ServiceConstructor;
|
|
80
|
+
/**
|
|
81
|
+
* - Service instance (lazy-created)
|
|
82
|
+
*/
|
|
83
|
+
instance: ServiceInstance | null;
|
|
84
|
+
/**
|
|
85
|
+
* - Service configuration
|
|
86
|
+
*/
|
|
87
|
+
config: any;
|
|
88
|
+
/**
|
|
89
|
+
* - Service dependencies
|
|
90
|
+
*/
|
|
91
|
+
dependencies: string[];
|
|
92
|
+
/**
|
|
93
|
+
* - Services that depend on this one
|
|
94
|
+
*/
|
|
95
|
+
dependents: Set<string>;
|
|
96
|
+
/**
|
|
97
|
+
* - Service tags
|
|
98
|
+
*/
|
|
99
|
+
tags: string[];
|
|
100
|
+
/**
|
|
101
|
+
* - Startup priority
|
|
102
|
+
*/
|
|
103
|
+
priority: number;
|
|
104
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Type definitions for ServiceManager class.
|
|
3
|
+
*
|
|
4
|
+
* This file contains all TypeScript/JSDoc type definitions used by
|
|
5
|
+
* the ServiceManager class and service registration.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* // When using ServiceManager
|
|
9
|
+
* import { ServiceManager } from './ServiceManager.js';
|
|
10
|
+
*
|
|
11
|
+
* // @ typedef {import('./typedef-service-manager.js').ServiceManagerConfig} ServiceManagerConfig
|
|
12
|
+
* // @ typedef {import('./typedef-service-manager.js').ServiceRegistrationOptions} ServiceRegistrationOptions
|
|
13
|
+
*
|
|
14
|
+
* const config = {
|
|
15
|
+
* environment: 'development',
|
|
16
|
+
* stopTimeout: 5000
|
|
17
|
+
* };
|
|
18
|
+
*
|
|
19
|
+
* const manager = new ServiceManager(config);
|
|
20
|
+
*
|
|
21
|
+
* const options = {
|
|
22
|
+
* dependencies: ['database'],
|
|
23
|
+
* tags: ['critical']
|
|
24
|
+
* };
|
|
25
|
+
*
|
|
26
|
+
* manager.register('auth', AuthService, {}, options);
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
// ============================================================================
|
|
30
|
+
// PUBLIC TYPES
|
|
31
|
+
// ============================================================================
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Options for registering a service
|
|
35
|
+
*
|
|
36
|
+
* @typedef {Object} ServiceRegistrationOptions
|
|
37
|
+
* @property {string[]} [dependencies=[]] - Services this service depends on
|
|
38
|
+
* @property {string[]} [tags=[]] - Tags for grouping services
|
|
39
|
+
* @property {number} [priority=0] - Startup priority (higher starts first)
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Configuration for ServiceManager
|
|
44
|
+
*
|
|
45
|
+
* @typedef {Object} ServiceManagerConfig
|
|
46
|
+
* @property {boolean} [debug=false] - Debug mode switch
|
|
47
|
+
* @property {boolean} [autoStart=false] - Auto-start services on registration
|
|
48
|
+
* @property {number} [stopTimeout=10000] - Default timeout for stopping services
|
|
49
|
+
* @property {string} [logLevel] - Initial log level for ServiceManager
|
|
50
|
+
* @property {LogConfig} [logConfig={}] - Logging configuration
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Logging configuration
|
|
55
|
+
*
|
|
56
|
+
* @typedef {Object} LogConfig
|
|
57
|
+
* @property {string} [defaultLevel] - Default log level for services
|
|
58
|
+
* @property {string} [globalLevel] - Override level for all services
|
|
59
|
+
* @property {Object<string, string>} [serviceLevels] - Per-service log levels
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Result of health check for all services
|
|
64
|
+
* @typedef {Object<string, HealthStatus>} HealthCheckResult
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Service class constructor type
|
|
69
|
+
*
|
|
70
|
+
* @typedef {new (name: string, options?: ServiceOptions) => ServiceInstance} ServiceConstructor
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
// ============================================================================
|
|
74
|
+
// INTERNAL TYPES
|
|
75
|
+
// ============================================================================
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Internal service registry entry
|
|
79
|
+
*
|
|
80
|
+
* @typedef {Object} ServiceEntry
|
|
81
|
+
* @property {ServiceConstructor} ServiceClass - Service class constructor
|
|
82
|
+
* @property {ServiceInstance|null} instance - Service instance (lazy-created)
|
|
83
|
+
* @property {*} config - Service configuration
|
|
84
|
+
* @property {string[]} dependencies - Service dependencies
|
|
85
|
+
* @property {Set<string>} dependents - Services that depend on this one
|
|
86
|
+
* @property {string[]} tags - Service tags
|
|
87
|
+
* @property {number} priority - Startup priority
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
export {};
|
package/package.json
CHANGED
package/dist/features/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { default as ButtonGroup } from "./button-group/ButtonGroup.svelte";
|
|
2
|
-
export { default as CompareLeftRight } from "./compare-left-right/CompareLeftRight.svelte";
|
|
3
|
-
export { default as GameBox } from "./game-box/GameBox.svelte";
|
|
4
|
-
export { default as HkAppLayout } from "./hk-app-layout/HkAppLayout.svelte";
|
|
5
|
-
export { default as ImageBox } from "./image-box/ImageBox.svelte";
|
|
6
|
-
export { default as Presenter } from "./presenter/Presenter.svelte";
|
|
7
|
-
export { default as ImageSlide } from "./presenter/ImageSlide.svelte";
|
|
8
|
-
export { default as VirtualViewport } from "./virtual-viewport/VirtualViewport.svelte";
|
|
9
|
-
export * from "./button-group/typedef.js";
|
|
10
|
-
export * from "./presenter/typedef.js";
|
|
11
|
-
export { createOrGetState as createOrGetAppLayoutState, createState as createAppLayoutState, getState as getAppLayoutState } from "./hk-app-layout/HkAppLayout.state.svelte.js";
|
package/dist/features/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export { default as ButtonGroup } from './button-group/ButtonGroup.svelte';
|
|
2
|
-
export { default as CompareLeftRight } from './compare-left-right/CompareLeftRight.svelte';
|
|
3
|
-
export { default as GameBox } from './game-box/GameBox.svelte';
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
createOrGetState as createOrGetAppLayoutState,
|
|
7
|
-
createState as createAppLayoutState,
|
|
8
|
-
getState as getAppLayoutState
|
|
9
|
-
} from './hk-app-layout/HkAppLayout.state.svelte.js';
|
|
10
|
-
|
|
11
|
-
export { default as HkAppLayout } from './hk-app-layout/HkAppLayout.svelte';
|
|
12
|
-
|
|
13
|
-
export { default as ImageBox } from './image-box/ImageBox.svelte';
|
|
14
|
-
|
|
15
|
-
export { default as Presenter } from './presenter/Presenter.svelte';
|
|
16
|
-
export { default as ImageSlide } from './presenter/ImageSlide.svelte';
|
|
17
|
-
|
|
18
|
-
export { default as VirtualViewport } from './virtual-viewport/VirtualViewport.svelte';
|
|
19
|
-
|
|
20
|
-
// > Types
|
|
21
|
-
|
|
22
|
-
export * from './button-group/typedef.js';
|
|
23
|
-
export * from './presenter/typedef.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../classes/logging/constants.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../classes/logging/constants.js';
|
package/dist/server/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./logger.js";
|
package/dist/server/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './logger.js';
|