@zintrust/workers 2.0.2 → 2.0.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/AnomalyDetection.js +3 -1
- package/dist/AutoScaler.js +3 -1
- package/dist/BroadcastWorker.js +2 -1
- package/dist/CanaryController.js +2 -1
- package/dist/ChaosEngineering.js +3 -1
- package/dist/CircuitBreaker.js +1 -1
- package/dist/ClusterLock.d.ts +1 -1
- package/dist/ClusterLock.js +5 -1
- package/dist/ComplianceManager.d.ts +1 -1
- package/dist/ComplianceManager.js +4 -1
- package/dist/DatacenterOrchestrator.js +2 -1
- package/dist/DeadLetterQueue.d.ts +1 -1
- package/dist/DeadLetterQueue.js +3 -1
- package/dist/HealthMonitor.js +2 -1
- package/dist/MultiQueueWorker.js +3 -1
- package/dist/NotificationWorker.js +1 -1
- package/dist/Observability.js +3 -1
- package/dist/PluginManager.js +2 -1
- package/dist/PriorityQueue.d.ts +1 -1
- package/dist/PriorityQueue.js +2 -1
- package/dist/ResourceMonitor.js +3 -1
- package/dist/SLAMonitor.js +3 -1
- package/dist/WorkerFactory.d.ts +2 -2
- package/dist/WorkerFactory.js +8 -2
- package/dist/WorkerInit.js +3 -1
- package/dist/WorkerMetrics.d.ts +1 -1
- package/dist/WorkerMetrics.js +3 -1
- package/dist/WorkerRegistry.d.ts +1 -1
- package/dist/WorkerRegistry.js +2 -1
- package/dist/WorkerShutdown.js +1 -1
- package/dist/WorkerVersioning.js +2 -1
- package/dist/config/workerConfig.js +1 -1
- package/dist/createQueueWorker.js +11 -44
- package/dist/dashboard/workers-api.js +6 -3
- package/dist/helper/index.d.ts +1 -1
- package/dist/http/WorkerApiController.d.ts +1 -1
- package/dist/http/WorkerApiController.js +1 -1
- package/dist/http/WorkerController.d.ts +1 -1
- package/dist/http/WorkerController.js +4 -1
- package/dist/http/WorkerMonitoringService.js +2 -1
- package/dist/http/middleware/CustomValidation.d.ts +1 -1
- package/dist/http/middleware/CustomValidation.js +1 -1
- package/dist/http/middleware/DatacenterValidator.d.ts +1 -1
- package/dist/http/middleware/DatacenterValidator.js +1 -1
- package/dist/http/middleware/EditWorkerValidation.d.ts +1 -1
- package/dist/http/middleware/EditWorkerValidation.js +1 -1
- package/dist/http/middleware/FeaturesValidator.d.ts +1 -1
- package/dist/http/middleware/FeaturesValidator.js +1 -1
- package/dist/http/middleware/InfrastructureValidator.d.ts +1 -1
- package/dist/http/middleware/InfrastructureValidator.js +1 -1
- package/dist/http/middleware/OptionsValidator.d.ts +1 -1
- package/dist/http/middleware/OptionsValidator.js +1 -1
- package/dist/http/middleware/PayloadSanitizer.d.ts +1 -1
- package/dist/http/middleware/PayloadSanitizer.js +1 -1
- package/dist/http/middleware/ProcessorPathSanitizer.d.ts +1 -1
- package/dist/http/middleware/ProcessorPathSanitizer.js +2 -1
- package/dist/http/middleware/QueueNameSanitizer.d.ts +1 -1
- package/dist/http/middleware/QueueNameSanitizer.js +1 -1
- package/dist/http/middleware/ValidateDriver.d.ts +1 -1
- package/dist/http/middleware/VersionSanitizer.d.ts +1 -1
- package/dist/http/middleware/VersionSanitizer.js +1 -1
- package/dist/http/middleware/WorkerNameSanitizer.d.ts +1 -1
- package/dist/http/middleware/WorkerNameSanitizer.js +1 -1
- package/dist/http/middleware/WorkerValidationChain.d.ts +1 -1
- package/dist/http/middleware/WorkerValidationChain.js +1 -1
- package/dist/queueMonitorHistory.js +3 -1
- package/dist/routes/workers.d.ts +1 -1
- package/dist/routes/workers.js +4 -1
- package/dist/storage/WorkerStore.d.ts +2 -2
- package/dist/telemetry/api/TelemetryAPI.js +1 -1
- package/dist/telemetry/api/TelemetryMonitoringService.d.ts +1 -1
- package/dist/telemetry/api/TelemetryMonitoringService.js +2 -1
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/telemetry/index.js +2 -1
- package/dist/ui/router/ui.d.ts +1 -1
- package/dist/ui/router/ui.js +6 -1
- package/package.json +1 -1
- package/src/AnomalyDetection.ts +4 -2
- package/src/AutoScaler.ts +3 -2
- package/src/BroadcastWorker.ts +2 -1
- package/src/CanaryController.ts +2 -1
- package/src/ChaosEngineering.ts +3 -1
- package/src/CircuitBreaker.ts +1 -1
- package/src/ClusterLock.ts +5 -8
- package/src/ComplianceManager.ts +4 -7
- package/src/DatacenterOrchestrator.ts +2 -1
- package/src/DeadLetterQueue.ts +3 -1
- package/src/HealthMonitor.ts +2 -1
- package/src/MultiQueueWorker.ts +3 -1
- package/src/NotificationWorker.ts +1 -1
- package/src/Observability.ts +3 -1
- package/src/PluginManager.ts +2 -1
- package/src/PriorityQueue.ts +3 -1
- package/src/ResourceMonitor.ts +3 -1
- package/src/SLAMonitor.ts +3 -1
- package/src/WorkerFactory.ts +13 -19
- package/src/WorkerInit.ts +3 -1
- package/src/WorkerMetrics.ts +3 -7
- package/src/WorkerRegistry.ts +3 -1
- package/src/WorkerShutdown.ts +1 -1
- package/src/WorkerVersioning.ts +2 -1
- package/src/config/workerConfig.ts +1 -1
- package/src/createQueueWorker.ts +12 -45
- package/src/dashboard/workers-api.ts +8 -4
- package/src/helper/index.ts +1 -1
- package/src/http/WorkerApiController.ts +2 -2
- package/src/http/WorkerController.ts +5 -8
- package/src/http/WorkerMonitoringService.ts +2 -1
- package/src/http/middleware/CustomValidation.ts +2 -1
- package/src/http/middleware/DatacenterValidator.ts +2 -1
- package/src/http/middleware/EditWorkerValidation.ts +2 -1
- package/src/http/middleware/FeaturesValidator.ts +2 -1
- package/src/http/middleware/InfrastructureValidator.ts +2 -1
- package/src/http/middleware/OptionsValidator.ts +2 -1
- package/src/http/middleware/PayloadSanitizer.ts +2 -1
- package/src/http/middleware/ProcessorPathSanitizer.ts +3 -7
- package/src/http/middleware/QueueNameSanitizer.ts +2 -1
- package/src/http/middleware/ValidateDriver.ts +1 -1
- package/src/http/middleware/VersionSanitizer.ts +2 -1
- package/src/http/middleware/WorkerNameSanitizer.ts +2 -1
- package/src/http/middleware/WorkerValidationChain.ts +2 -1
- package/src/queueMonitorHistory.ts +3 -1
- package/src/routes/workers.ts +5 -2
- package/src/storage/WorkerStore.ts +2 -2
- package/src/telemetry/api/TelemetryAPI.ts +1 -1
- package/src/telemetry/api/TelemetryMonitoringService.ts +3 -2
- package/src/telemetry/index.ts +3 -2
- package/src/ui/router/ui.ts +9 -11
package/src/createQueueWorker.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { Env } from '@zintrust/core/config';
|
|
2
|
+
import { Logger } from '@zintrust/core/logger';
|
|
3
|
+
import type { BullMQPayload, QueueMessage } from '@zintrust/core/queue';
|
|
4
|
+
import { JobHeartbeatStore, JobStateTracker, Queue, TimeoutManager } from '@zintrust/core/queue';
|
|
5
|
+
import { SystemTraceBridge } from '@zintrust/core/trace';
|
|
4
6
|
import { recordQueueMonitorJob } from './queueMonitorHistory';
|
|
5
7
|
|
|
6
8
|
type QueueApi = Readonly<{
|
|
@@ -17,38 +19,6 @@ const TypedQueue = Queue as QueueApi;
|
|
|
17
19
|
const RETRY_BASE_DELAY_MS = 1000;
|
|
18
20
|
const RETRY_MAX_DELAY_MS = 30000;
|
|
19
21
|
|
|
20
|
-
const getJobStateTracker = (): unknown => {
|
|
21
|
-
try {
|
|
22
|
-
return (Core as Record<string, unknown>)['JobStateTracker'];
|
|
23
|
-
} catch {
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const getJobHeartbeatStore = (): unknown => {
|
|
29
|
-
try {
|
|
30
|
-
return (Core as Record<string, unknown>)['JobHeartbeatStore'];
|
|
31
|
-
} catch {
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const getTimeoutManager = (): unknown => {
|
|
37
|
-
try {
|
|
38
|
-
return (Core as Record<string, unknown>)['TimeoutManager'];
|
|
39
|
-
} catch {
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const getSystemTraceBridge = (): unknown => {
|
|
45
|
-
try {
|
|
46
|
-
return (Core as Record<string, unknown>)['SystemTraceBridge'];
|
|
47
|
-
} catch {
|
|
48
|
-
return undefined;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
22
|
const getEnvInt = (key: string, fallback: number): number => {
|
|
53
23
|
const getter = (Env as { getInt?: (name: string, defaultValue: number) => number }).getInt;
|
|
54
24
|
if (typeof getter === 'function') {
|
|
@@ -65,8 +35,7 @@ const getEnvInt = (key: string, fallback: number): number => {
|
|
|
65
35
|
};
|
|
66
36
|
|
|
67
37
|
const resolveQueueJobTimeoutMs = (): number => {
|
|
68
|
-
const
|
|
69
|
-
const tm = (timeoutManager ?? {}) as { getQueueJobTimeoutMs?: () => number };
|
|
38
|
+
const tm = (TimeoutManager ?? {}) as { getQueueJobTimeoutMs?: () => number };
|
|
70
39
|
if (typeof tm.getQueueJobTimeoutMs === 'function') {
|
|
71
40
|
return tm.getQueueJobTimeoutMs();
|
|
72
41
|
}
|
|
@@ -78,8 +47,7 @@ const runWithTimeout = async <T>(
|
|
|
78
47
|
timeoutMs: number,
|
|
79
48
|
operationName: string
|
|
80
49
|
): Promise<T> => {
|
|
81
|
-
const
|
|
82
|
-
const tm = (timeoutManager ?? {}) as {
|
|
50
|
+
const tm = (TimeoutManager ?? {}) as {
|
|
83
51
|
withTimeout?: <R>(
|
|
84
52
|
op: () => Promise<R>,
|
|
85
53
|
t: number,
|
|
@@ -94,8 +62,7 @@ const runWithTimeout = async <T>(
|
|
|
94
62
|
};
|
|
95
63
|
|
|
96
64
|
const isTimeoutError = (error: unknown): boolean => {
|
|
97
|
-
const
|
|
98
|
-
const tm = (timeoutManager ?? {}) as { isTimeoutError?: (value: unknown) => boolean };
|
|
65
|
+
const tm = (TimeoutManager ?? {}) as { isTimeoutError?: (value: unknown) => boolean };
|
|
99
66
|
if (typeof tm.isTimeoutError === 'function') {
|
|
100
67
|
return tm.isTimeoutError(error);
|
|
101
68
|
}
|
|
@@ -230,15 +197,15 @@ const getWorkerInstanceId = (): string | undefined => {
|
|
|
230
197
|
};
|
|
231
198
|
|
|
232
199
|
const getTrackerApi = (): TrackerApi => {
|
|
233
|
-
return (
|
|
200
|
+
return (JobStateTracker ?? {}) as TrackerApi;
|
|
234
201
|
};
|
|
235
202
|
|
|
236
203
|
const getHeartbeatStoreApi = (): HeartbeatStoreApi => {
|
|
237
|
-
return (
|
|
204
|
+
return (JobHeartbeatStore ?? {}) as HeartbeatStoreApi;
|
|
238
205
|
};
|
|
239
206
|
|
|
240
207
|
const emitJobProcessed = (name: string): void => {
|
|
241
|
-
const bridge = (
|
|
208
|
+
const bridge = (SystemTraceBridge ?? {}) as {
|
|
242
209
|
emitJobProcessed?: (jobName: string) => void;
|
|
243
210
|
};
|
|
244
211
|
|
|
@@ -246,7 +213,7 @@ const emitJobProcessed = (name: string): void => {
|
|
|
246
213
|
};
|
|
247
214
|
|
|
248
215
|
const emitJobFailed = (name: string, error: Error): void => {
|
|
249
|
-
const bridge = (
|
|
216
|
+
const bridge = (SystemTraceBridge ?? {}) as {
|
|
250
217
|
emitJobFailed?: (jobName: string, failure: Error) => void;
|
|
251
218
|
};
|
|
252
219
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { Env,
|
|
1
|
+
import { Env, queueConfig } from '@zintrust/core/config';
|
|
2
|
+
import { ErrorFactory } from '@zintrust/core/errors';
|
|
3
|
+
import { Logger } from '@zintrust/core/logger';
|
|
2
4
|
import { WorkerFactory } from '../WorkerFactory';
|
|
3
5
|
import { WorkerMetrics as WorkerMetricsManager } from '../WorkerMetrics';
|
|
4
6
|
import { WorkerRegistry } from '../WorkerRegistry';
|
|
@@ -99,7 +101,9 @@ async function fetchQueueDataSafe(): Promise<QueueData> {
|
|
|
99
101
|
const defaultData = buildEmptyQueueData(resolveConfiguredQueueDriver());
|
|
100
102
|
|
|
101
103
|
try {
|
|
102
|
-
|
|
104
|
+
const timeoutMs =
|
|
105
|
+
queueConfig.monitor?.queueDataTimeoutMs ?? Env.getInt('QUEUE_DATA_TIMEOUT_MS', 10000);
|
|
106
|
+
return await withTimeout(getQueueData(), timeoutMs, 'Queue data timeout');
|
|
103
107
|
} catch (err) {
|
|
104
108
|
Logger.warn('[getWorkers] Queue data fetch failed or timed out', err);
|
|
105
109
|
return defaultData;
|
|
@@ -463,7 +467,7 @@ const buildWorkerFromRaw = (workerData: RawWorkerData, driver: WorkerDriver): Wo
|
|
|
463
467
|
autoStart: workerData.autoStart || false,
|
|
464
468
|
activeStatus: workerData.activeStatus ?? true,
|
|
465
469
|
details: workerData.details || {
|
|
466
|
-
configuration: {}
|
|
470
|
+
configuration: {},
|
|
467
471
|
health: {} as WorkerHealth,
|
|
468
472
|
metrics: {} as WorkerMetrics,
|
|
469
473
|
recentLogs: [],
|
|
@@ -611,7 +615,7 @@ async function getRedisQueueData(): Promise<QueueData> {
|
|
|
611
615
|
try {
|
|
612
616
|
// Use existing queue monitor infrastructure
|
|
613
617
|
const { QueueMonitor } = await import('@zintrust/queue-monitor');
|
|
614
|
-
const { queueConfig } = await import('@zintrust/core');
|
|
618
|
+
const { queueConfig } = await import('@zintrust/core/config');
|
|
615
619
|
|
|
616
620
|
const redisConfig = queueConfig.drivers.redis;
|
|
617
621
|
if (redisConfig?.driver !== 'redis') {
|
package/src/helper/index.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* HTTP handlers for worker management API
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { IRequest, IResponse } from '@zintrust/core';
|
|
7
|
-
import { Logger } from '@zintrust/core';
|
|
6
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
7
|
+
import { Logger } from '@zintrust/core/logger';
|
|
8
8
|
import type {
|
|
9
9
|
GetWorkersQuery,
|
|
10
10
|
WorkerDriver,
|
|
@@ -4,14 +4,11 @@
|
|
|
4
4
|
* HTTP handlers for worker management API
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
type IRequest,
|
|
13
|
-
type IResponse,
|
|
14
|
-
} from '@zintrust/core';
|
|
7
|
+
import { Cloudflare } from '@zintrust/core/cloudflare';
|
|
8
|
+
import { Env } from '@zintrust/core/config';
|
|
9
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
10
|
+
import { getValidatedBody } from '@zintrust/core/http';
|
|
11
|
+
import { Logger } from '@zintrust/core/logger';
|
|
15
12
|
import type { Job } from 'bullmq';
|
|
16
13
|
import { CanaryController } from '../CanaryController';
|
|
17
14
|
import { HealthMonitor } from '../HealthMonitor';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Logger
|
|
1
|
+
import { Logger } from '@zintrust/core/logger';
|
|
2
|
+
import { NodeSingletons, workersConfig } from '@zintrust/core/workers';
|
|
2
3
|
import { HealthMonitor } from '../HealthMonitor';
|
|
3
4
|
import { getWorkers } from '../dashboard/workers-api';
|
|
4
5
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
2
|
+
import { Logger } from '@zintrust/core/logger';
|
|
2
3
|
|
|
3
4
|
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
4
5
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
2
|
+
import { Logger } from '@zintrust/core/logger';
|
|
2
3
|
|
|
3
4
|
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
4
5
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
2
|
+
import { Logger } from '@zintrust/core/logger';
|
|
2
3
|
|
|
3
4
|
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
4
5
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
2
|
+
import { Logger } from '@zintrust/core/logger';
|
|
2
3
|
|
|
3
4
|
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
4
5
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
2
|
+
import { Logger } from '@zintrust/core/logger';
|
|
2
3
|
|
|
3
4
|
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
4
5
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
2
|
+
import { Logger } from '@zintrust/core/logger';
|
|
2
3
|
|
|
3
4
|
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
4
5
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
2
|
+
import { Logger } from '@zintrust/core/logger';
|
|
2
3
|
|
|
3
4
|
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
4
5
|
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
workersConfig,
|
|
5
|
-
type IRequest,
|
|
6
|
-
type IResponse,
|
|
7
|
-
} from '@zintrust/core';
|
|
1
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
2
|
+
import { Logger } from '@zintrust/core/logger';
|
|
3
|
+
import { NodeSingletons, workersConfig } from '@zintrust/core/workers';
|
|
8
4
|
|
|
9
5
|
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
10
6
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
2
|
+
import { Logger } from '@zintrust/core/logger';
|
|
2
3
|
|
|
3
4
|
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
4
5
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Ensures the 'driver' query parameter is valid if present.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { IRequest, IResponse } from '@zintrust/core';
|
|
6
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
7
7
|
|
|
8
8
|
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
9
9
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
2
|
+
import { Logger } from '@zintrust/core/logger';
|
|
2
3
|
|
|
3
4
|
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
4
5
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
2
|
+
import { Logger } from '@zintrust/core/logger';
|
|
2
3
|
|
|
3
4
|
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
4
5
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
2
|
+
import { Logger } from '@zintrust/core/logger';
|
|
2
3
|
|
|
3
4
|
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
4
5
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { queueConfig } from '@zintrust/core/config';
|
|
2
|
+
import { Logger } from '@zintrust/core/logger';
|
|
3
|
+
import { isNonEmptyString, isObject } from '@zintrust/core/utils';
|
|
2
4
|
|
|
3
5
|
type QueueMonitorStatus = 'completed' | 'failed';
|
|
4
6
|
|
package/src/routes/workers.ts
CHANGED
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
* HTTP API for managing workers with dashboard functionality
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
6
|
+
import { Cloudflare } from '@zintrust/core/cloudflare';
|
|
7
|
+
import { Env } from '@zintrust/core/config';
|
|
8
|
+
import type { IRequest, IResponse, IRouter } from '@zintrust/core/http';
|
|
9
|
+
import { Router } from '@zintrust/core/http';
|
|
10
|
+
import { Logger } from '@zintrust/core/logger';
|
|
8
11
|
import { type WorkersDashboardUiOptions } from '../dashboard';
|
|
9
12
|
import { HealthMonitor } from '../HealthMonitor';
|
|
10
13
|
import { ValidationSchemas, withCustomValidation } from '../http/middleware/CustomValidation';
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Persistence layer for workers (memory, redis, db)
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type
|
|
7
|
-
import { type
|
|
6
|
+
import { type IDatabase } from '@zintrust/core/database';
|
|
7
|
+
import { type createRedisConnection } from '@zintrust/core/redis';
|
|
8
8
|
|
|
9
9
|
type RedisConnection = ReturnType<typeof createRedisConnection>;
|
|
10
10
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { IResponse } from '@zintrust/core';
|
|
2
|
-
import { Logger
|
|
1
|
+
import type { IResponse } from '@zintrust/core/http';
|
|
2
|
+
import { Logger } from '@zintrust/core/logger';
|
|
3
|
+
import { NodeSingletons } from '@zintrust/core/workers';
|
|
3
4
|
import type { createSnapshotBuilder, TelemetrySettings } from './TelemetryAPI';
|
|
4
5
|
|
|
5
6
|
export type TelemetrySnapshotData = {
|
package/src/telemetry/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { Env } from '@zintrust/core/config';
|
|
2
|
+
import type { IRequest, IResponse, IRouter, RouteOptions } from '@zintrust/core/http';
|
|
3
|
+
import { Router } from '@zintrust/core/http';
|
|
3
4
|
import type { TelemetrySettings } from './api/TelemetryAPI';
|
|
4
5
|
import { createSnapshotBuilder } from './api/TelemetryAPI';
|
|
5
6
|
import { teleStream } from './api/TelemetryMonitoringService';
|
package/src/ui/router/ui.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
NodeSingletons,
|
|
9
|
-
Router,
|
|
10
|
-
} from '@zintrust/core';
|
|
1
|
+
import { Cloudflare } from '@zintrust/core/cloudflare';
|
|
2
|
+
import { Env } from '@zintrust/core/config';
|
|
3
|
+
import { ErrorFactory } from '@zintrust/core/errors';
|
|
4
|
+
import type { AssetsBinding, IRouter } from '@zintrust/core/http';
|
|
5
|
+
import { MIME_TYPES, Router } from '@zintrust/core/http';
|
|
6
|
+
import { Logger } from '@zintrust/core/logger';
|
|
7
|
+
import { NodeSingletons } from '@zintrust/core/workers';
|
|
11
8
|
import { BrandFavicon } from '../BrandFavicon';
|
|
12
9
|
import { INDEX_HTML, MAIN_JS, STYLES_CSS, ZINTRUST_SVG } from './EmbeddedAssets';
|
|
13
10
|
|
|
@@ -68,7 +65,8 @@ const escapeHtml = (value: string): string => {
|
|
|
68
65
|
.replaceAll("'", ''');
|
|
69
66
|
};
|
|
70
67
|
|
|
71
|
-
const getWorkersLogoMarkup =
|
|
68
|
+
const getWorkersLogoMarkup =
|
|
69
|
+
(): string => `<svg width="34" height="34" viewBox="0 0 256 256" fill="none" class="logo-img" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
|
|
72
70
|
<rect width="256" height="256" rx="56" fill="#0f172a"/>
|
|
73
71
|
<path d="M128 56 L200 96 L128 136 L56 96 Z" fill="#0ea5e9" opacity="0.2" stroke="#0ea5e9" stroke-width="4" stroke-linejoin="round"/>
|
|
74
72
|
<path d="M128 104 L200 144 L128 184 L56 144 Z" fill="#0ea5e9" opacity="0.4" stroke="#0ea5e9" stroke-width="4" stroke-linejoin="round"/>
|