@hkdigital/lib-sveltekit 0.2.17 → 0.2.19
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.js +2 -4
- package/dist/classes/services/ServiceManager.js +6 -9
- package/dist/classes/services/typedef.d.ts +7 -9
- package/dist/classes/services/typedef.js +4 -7
- package/dist/logging/index.d.ts +1 -0
- package/dist/logging/index.js +1 -1
- package/package.json +1 -1
@@ -413,7 +413,6 @@ export class ServiceBase extends EventEmitter {
|
|
413
413
|
this.state = newState;
|
414
414
|
|
415
415
|
this.emit('stateChanged', {
|
416
|
-
source: this.name,
|
417
416
|
oldState,
|
418
417
|
newState
|
419
418
|
});
|
@@ -431,8 +430,8 @@ export class ServiceBase extends EventEmitter {
|
|
431
430
|
|
432
431
|
if (wasHealthy !== healthy) {
|
433
432
|
this.emit('healthChanged', {
|
434
|
-
|
435
|
-
|
433
|
+
healthy,
|
434
|
+
wasHealthy
|
436
435
|
});
|
437
436
|
}
|
438
437
|
}
|
@@ -455,7 +454,6 @@ export class ServiceBase extends EventEmitter {
|
|
455
454
|
});
|
456
455
|
|
457
456
|
this.emit('error', {
|
458
|
-
source: this.name,
|
459
457
|
operation,
|
460
458
|
error
|
461
459
|
});
|
@@ -551,24 +551,21 @@ export class ServiceManager extends EventEmitter {
|
|
551
551
|
_attachServiceEvents(name, instance) {
|
552
552
|
// Forward service events
|
553
553
|
instance.on('stateChanged', (data) => {
|
554
|
-
|
555
|
-
this.emit(eventName, { ...data, eventName, source: name });
|
554
|
+
this.emit('service:stateChanged', { service: name, data });
|
556
555
|
});
|
557
556
|
|
558
557
|
instance.on('healthChanged', (data) => {
|
559
|
-
|
560
|
-
this.emit(eventName, { ...data, eventName, source: name });
|
558
|
+
this.emit('service:healthChanged', { service: name, data });
|
561
559
|
});
|
562
560
|
|
563
561
|
instance.on('error', (data) => {
|
564
|
-
|
565
|
-
this.emit(eventName, { ...data, eventName, source: name });
|
562
|
+
this.emit('service:error', { service: name, data });
|
566
563
|
});
|
567
564
|
|
568
565
|
// Forward log events
|
569
|
-
|
570
|
-
|
571
|
-
this.emit(
|
566
|
+
|
567
|
+
instance.logger.on('log', (logEvent) => {
|
568
|
+
this.emit('service:log', logEvent);
|
572
569
|
});
|
573
570
|
}
|
574
571
|
|
@@ -62,12 +62,9 @@ export type HealthStatus = {
|
|
62
62
|
*/
|
63
63
|
key?: any;
|
64
64
|
};
|
65
|
-
/**
|
66
|
-
* Event emitted when service state changes
|
67
|
-
*/
|
68
65
|
export type StateChangeEvent = {
|
69
66
|
/**
|
70
|
-
* - Service name
|
67
|
+
* - Service name (added by ServiceManager)
|
71
68
|
*/
|
72
69
|
service: string;
|
73
70
|
/**
|
@@ -79,18 +76,19 @@ export type StateChangeEvent = {
|
|
79
76
|
*/
|
80
77
|
newState: string;
|
81
78
|
};
|
82
|
-
/**
|
83
|
-
* Event emitted when service health changes
|
84
|
-
*/
|
85
79
|
export type HealthChangeEvent = {
|
86
80
|
/**
|
87
|
-
* - Service name
|
81
|
+
* - Service name (added by ServiceManager)
|
88
82
|
*/
|
89
83
|
service: string;
|
90
84
|
/**
|
91
|
-
* -
|
85
|
+
* - Current health status
|
92
86
|
*/
|
93
87
|
healthy: boolean;
|
88
|
+
/**
|
89
|
+
* - Previous health status
|
90
|
+
*/
|
91
|
+
wasHealthy?: boolean;
|
94
92
|
};
|
95
93
|
/**
|
96
94
|
* Event emitted when service encounters an error
|
@@ -81,20 +81,17 @@
|
|
81
81
|
*/
|
82
82
|
|
83
83
|
/**
|
84
|
-
* Event emitted when service state changes
|
85
|
-
*
|
86
84
|
* @typedef {Object} StateChangeEvent
|
87
|
-
* @property {string} service - Service name
|
85
|
+
* @property {string} service - Service name (added by ServiceManager)
|
88
86
|
* @property {string} oldState - Previous state
|
89
87
|
* @property {string} newState - New state
|
90
88
|
*/
|
91
89
|
|
92
90
|
/**
|
93
|
-
* Event emitted when service health changes
|
94
|
-
*
|
95
91
|
* @typedef {Object} HealthChangeEvent
|
96
|
-
* @property {string} service - Service name
|
97
|
-
* @property {boolean} healthy -
|
92
|
+
* @property {string} service - Service name (added by ServiceManager)
|
93
|
+
* @property {boolean} healthy - Current health status
|
94
|
+
* @property {boolean} [wasHealthy] - Previous health status
|
98
95
|
*/
|
99
96
|
|
100
97
|
/**
|
package/dist/logging/index.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
export { createServerLogger } from "./factories/server.js";
|
2
2
|
export { createClientLogger } from "./factories/client.js";
|
3
3
|
export { createLogger } from "./factories/universal.js";
|
4
|
+
export * from "../classes/logging/typedef.js";
|
4
5
|
export { DEBUG, INFO, WARN, ERROR, NONE, LEVELS } from "./constants.js";
|
package/dist/logging/index.js
CHANGED
@@ -5,4 +5,4 @@ export { createServerLogger } from './factories/server.js';
|
|
5
5
|
export { createClientLogger } from './factories/client.js';
|
6
6
|
export { createLogger } from './factories/universal.js';
|
7
7
|
|
8
|
-
export * from '../classes/
|
8
|
+
export * from '../classes/logging/typedef.js';
|