@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
2
2
|
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
3
3
|
/**
|
|
4
4
|
* Middleware to strip unknown properties from the request body.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
2
2
|
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
3
3
|
export declare const withProcessorPathValidation: (handler: RouteHandler) => RouteHandler;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Logger
|
|
1
|
+
import { Logger } from '@zintrust/core/logger';
|
|
2
|
+
import { NodeSingletons, workersConfig } from '@zintrust/core/workers';
|
|
2
3
|
const PROCESSOR_PATH_PATTERN = /^[a-zA-Z0-9/_.-]+\.(ts|js|mjs|cjs)$/;
|
|
3
4
|
const isUrlSpec = (value) => {
|
|
4
5
|
if (value.startsWith('url:'))
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
2
2
|
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
3
3
|
export declare const withQueueNameValidation: (handler: RouteHandler) => RouteHandler;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Validate Driver Middleware
|
|
3
3
|
* Ensures the 'driver' query parameter is valid if present.
|
|
4
4
|
*/
|
|
5
|
-
import type { IRequest, IResponse } from '@zintrust/core';
|
|
5
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
6
6
|
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
7
7
|
export declare const withDriverValidation: (handler: RouteHandler) => RouteHandler;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
2
2
|
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
3
3
|
export declare const withVersionValidation: (handler: RouteHandler) => RouteHandler;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
2
2
|
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
3
3
|
export declare const withWorkerNameValidation: (handler: RouteHandler) => RouteHandler;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IRequest, IResponse } from '@zintrust/core/http';
|
|
2
2
|
export type RouteHandler = (req: IRequest, res: IResponse) => Promise<void> | void;
|
|
3
3
|
/**
|
|
4
4
|
* Composite middleware for worker creation validation
|
|
@@ -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
|
let queueMonitorMetricsPromise = null;
|
|
3
5
|
const toFiniteInteger = (value, fallback) => {
|
|
4
6
|
if (typeof value === 'number' && Number.isFinite(value)) {
|
package/dist/routes/workers.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Worker Management Routes
|
|
3
3
|
* HTTP API for managing workers with dashboard functionality
|
|
4
4
|
*/
|
|
5
|
-
import type { IRouter } from '@zintrust/core';
|
|
5
|
+
import type { IRouter } from '@zintrust/core/http';
|
|
6
6
|
import { type WorkersDashboardUiOptions } from '../dashboard';
|
|
7
7
|
type WorkerUiOptions = WorkersDashboardUiOptions;
|
|
8
8
|
type RouteOptions = {
|
package/dist/routes/workers.js
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* Worker Management Routes
|
|
3
3
|
* HTTP API for managing workers with dashboard functionality
|
|
4
4
|
*/
|
|
5
|
-
import { Cloudflare
|
|
5
|
+
import { Cloudflare } from '@zintrust/core/cloudflare';
|
|
6
|
+
import { Env } from '@zintrust/core/config';
|
|
7
|
+
import { Router } from '@zintrust/core/http';
|
|
8
|
+
import { Logger } from '@zintrust/core/logger';
|
|
6
9
|
import { HealthMonitor } from '../HealthMonitor.js';
|
|
7
10
|
import { ValidationSchemas, withCustomValidation } from '../http/middleware/CustomValidation.js';
|
|
8
11
|
import { withEditWorkerValidation } from '../http/middleware/EditWorkerValidation.js';
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Worker Store
|
|
3
3
|
* Persistence layer for workers (memory, redis, db)
|
|
4
4
|
*/
|
|
5
|
-
import type
|
|
6
|
-
import { type
|
|
5
|
+
import { type IDatabase } from '@zintrust/core/database';
|
|
6
|
+
import { type createRedisConnection } from '@zintrust/core/redis';
|
|
7
7
|
type RedisConnection = ReturnType<typeof createRedisConnection>;
|
|
8
8
|
export type WorkerRecord = {
|
|
9
9
|
name: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Logger } from '@zintrust/core';
|
|
1
|
+
import { Logger } from '@zintrust/core/logger';
|
|
2
2
|
import { getWorkers } from '../../dashboard/workers-api.js';
|
|
3
3
|
import { HealthMonitor } from '../../HealthMonitor.js';
|
|
4
4
|
import { ResourceMonitor } from '../../ResourceMonitor.js';
|
package/dist/telemetry/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Env
|
|
1
|
+
import { Env } from '@zintrust/core/config';
|
|
2
|
+
import { Router } from '@zintrust/core/http';
|
|
2
3
|
import { createSnapshotBuilder } from './api/TelemetryAPI.js';
|
|
3
4
|
import { teleStream } from './api/TelemetryMonitoringService.js';
|
|
4
5
|
import { getDashboardHtml } from './routes/dashboard.js';
|
package/dist/ui/router/ui.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { IRouter } from '@zintrust/core';
|
|
1
|
+
import type { IRouter } from '@zintrust/core/http';
|
|
2
2
|
export declare const uiResolver: (uiBasePath: string) => Promise<string>;
|
|
3
3
|
export declare const registerStaticAssets: (router: IRouter, middleware: ReadonlyArray<string>) => void;
|
package/dist/ui/router/ui.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import { Cloudflare
|
|
1
|
+
import { Cloudflare } from '@zintrust/core/cloudflare';
|
|
2
|
+
import { Env } from '@zintrust/core/config';
|
|
3
|
+
import { ErrorFactory } from '@zintrust/core/errors';
|
|
4
|
+
import { MIME_TYPES, Router } from '@zintrust/core/http';
|
|
5
|
+
import { Logger } from '@zintrust/core/logger';
|
|
6
|
+
import { NodeSingletons } from '@zintrust/core/workers';
|
|
2
7
|
import { BrandFavicon } from '../BrandFavicon.js';
|
|
3
8
|
import { INDEX_HTML, MAIN_JS, STYLES_CSS, ZINTRUST_SVG } from './EmbeddedAssets.js';
|
|
4
9
|
const isCloudflare = (() => {
|
package/package.json
CHANGED
package/src/AnomalyDetection.ts
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* Sealed namespace for immutability
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { ErrorFactory
|
|
7
|
+
import { ErrorFactory } from '@zintrust/core/errors';
|
|
8
|
+
import { Logger } from '@zintrust/core/logger';
|
|
9
|
+
import { generateUuid } from '@zintrust/core/utils';
|
|
8
10
|
import { ResourceMonitor } from './ResourceMonitor';
|
|
9
11
|
import { WorkerMetrics, type MetricPoint, type MetricType } from './WorkerMetrics';
|
|
10
12
|
|
|
@@ -293,7 +295,7 @@ export const AnomalyDetection = Object.freeze({
|
|
|
293
295
|
severity: selectSeverity(zScore),
|
|
294
296
|
possibleCauses: buildPossibleCauses(metric),
|
|
295
297
|
recommendations: buildRecommendations(metric),
|
|
296
|
-
}
|
|
298
|
+
};
|
|
297
299
|
})
|
|
298
300
|
);
|
|
299
301
|
|
package/src/AutoScaler.ts
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* Sealed namespace for immutability
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
7
|
+
import { ErrorFactory } from '@zintrust/core/errors';
|
|
8
|
+
import { Logger } from '@zintrust/core/logger';
|
|
9
|
+
import { type WorkerConfig, workersConfig } from '@zintrust/core/workers';
|
|
9
10
|
|
|
10
11
|
export type ScalingDecision = {
|
|
11
12
|
workerName: string;
|
package/src/BroadcastWorker.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* Use with Queue.dequeue() in a background process or cron job.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Logger } from '@zintrust/core/logger';
|
|
9
|
+
import { Broadcast, isArray, isNonEmptyString } from '@zintrust/core/utils';
|
|
9
10
|
import { createQueueWorker } from './createQueueWorker';
|
|
10
11
|
|
|
11
12
|
type BroadcastJob = {
|
package/src/CanaryController.ts
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Sealed namespace for immutability
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { ErrorFactory
|
|
7
|
+
import { ErrorFactory } from '@zintrust/core/errors';
|
|
8
|
+
import { Logger } from '@zintrust/core/logger';
|
|
8
9
|
import { CircuitBreaker } from './CircuitBreaker';
|
|
9
10
|
|
|
10
11
|
export type CanaryStage =
|
package/src/ChaosEngineering.ts
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* Sealed namespace for immutability
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { ErrorFactory
|
|
7
|
+
import { ErrorFactory } from '@zintrust/core/errors';
|
|
8
|
+
import { Logger } from '@zintrust/core/logger';
|
|
9
|
+
import { generateUuid } from '@zintrust/core/utils';
|
|
8
10
|
import { CircuitBreaker } from './CircuitBreaker';
|
|
9
11
|
import { Observability } from './Observability';
|
|
10
12
|
import { ResourceMonitor } from './ResourceMonitor';
|
package/src/CircuitBreaker.ts
CHANGED
package/src/ClusterLock.ts
CHANGED
|
@@ -4,14 +4,11 @@
|
|
|
4
4
|
* Sealed namespace for immutability
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
generateUuid,
|
|
13
|
-
type RedisConfig,
|
|
14
|
-
} from '@zintrust/core';
|
|
7
|
+
import { Cloudflare } from '@zintrust/core/cloudflare';
|
|
8
|
+
import { ErrorFactory } from '@zintrust/core/errors';
|
|
9
|
+
import { Logger } from '@zintrust/core/logger';
|
|
10
|
+
import { createRedisConnection, type RedisConfig } from '@zintrust/core/redis';
|
|
11
|
+
import { generateUuid } from '@zintrust/core/utils';
|
|
15
12
|
|
|
16
13
|
type RedisConnection = ReturnType<typeof createRedisConnection>;
|
|
17
14
|
|
package/src/ComplianceManager.ts
CHANGED
|
@@ -4,13 +4,10 @@
|
|
|
4
4
|
* Sealed namespace for immutability
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
createRedisConnection,
|
|
12
|
-
type RedisConfig,
|
|
13
|
-
} from '@zintrust/core';
|
|
7
|
+
import { ErrorFactory } from '@zintrust/core/errors';
|
|
8
|
+
import { Logger } from '@zintrust/core/logger';
|
|
9
|
+
import { createRedisConnection, type RedisConfig } from '@zintrust/core/redis';
|
|
10
|
+
import { NodeSingletons } from '@zintrust/core/workers';
|
|
14
11
|
|
|
15
12
|
type RedisConnection = ReturnType<typeof createRedisConnection>;
|
|
16
13
|
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Sealed namespace for immutability
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { ErrorFactory
|
|
7
|
+
import { ErrorFactory } from '@zintrust/core/errors';
|
|
8
|
+
import { Logger } from '@zintrust/core/logger';
|
|
8
9
|
import { ClusterLock } from './ClusterLock';
|
|
9
10
|
|
|
10
11
|
export type DatacenterRegion = {
|
package/src/DeadLetterQueue.ts
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* Sealed namespace for immutability
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { ErrorFactory
|
|
7
|
+
import { ErrorFactory } from '@zintrust/core/errors';
|
|
8
|
+
import { Logger } from '@zintrust/core/logger';
|
|
9
|
+
import { createRedisConnection, type RedisConfig } from '@zintrust/core/redis';
|
|
8
10
|
import { keyPrefixFor } from './config/workerConfig';
|
|
9
11
|
|
|
10
12
|
type RedisConnection = ReturnType<typeof createRedisConnection>;
|
package/src/HealthMonitor.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ErrorFactory
|
|
1
|
+
import { ErrorFactory } from '@zintrust/core/errors';
|
|
2
|
+
import { Logger } from '@zintrust/core/logger';
|
|
2
3
|
import type { Worker } from 'bullmq';
|
|
3
4
|
import { WorkerCreationStatus, WorkerFactory } from './WorkerFactory';
|
|
4
5
|
|
package/src/MultiQueueWorker.ts
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* Sealed namespace for immutability
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { ErrorFactory
|
|
7
|
+
import { ErrorFactory } from '@zintrust/core/errors';
|
|
8
|
+
import { Logger } from '@zintrust/core/logger';
|
|
9
|
+
import { ShutdownTrace } from '@zintrust/core/workers';
|
|
8
10
|
import { Worker, type Job, type WorkerOptions } from 'bullmq';
|
|
9
11
|
import { PriorityQueue } from './PriorityQueue';
|
|
10
12
|
|
package/src/Observability.ts
CHANGED
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import type { Span, SpanOptions, Tracer } from '@opentelemetry/api';
|
|
8
|
-
import { ErrorFactory
|
|
8
|
+
import { ErrorFactory } from '@zintrust/core/errors';
|
|
9
|
+
import { Logger } from '@zintrust/core/logger';
|
|
10
|
+
import { generateUuid } from '@zintrust/core/utils';
|
|
9
11
|
import type { Counter, Gauge, Histogram, Registry, Summary } from 'prom-client';
|
|
10
12
|
|
|
11
13
|
export type ObservabilityConfig = {
|
package/src/PluginManager.ts
CHANGED
package/src/PriorityQueue.ts
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* Sealed namespace for immutability
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { ErrorFactory
|
|
7
|
+
import { ErrorFactory } from '@zintrust/core/errors';
|
|
8
|
+
import { Logger } from '@zintrust/core/logger';
|
|
9
|
+
import type { RedisConfig } from '@zintrust/core/redis';
|
|
8
10
|
import type { Queue } from 'bullmq';
|
|
9
11
|
|
|
10
12
|
export type PriorityLevel = 'critical' | 'high' | 'normal' | 'low';
|
package/src/ResourceMonitor.ts
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* Sealed namespace for immutability
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { Env
|
|
7
|
+
import { Env } from '@zintrust/core/config';
|
|
8
|
+
import { Logger } from '@zintrust/core/logger';
|
|
9
|
+
import { NodeSingletons } from '@zintrust/core/workers';
|
|
8
10
|
|
|
9
11
|
const getOsModule = (): typeof NodeSingletons.os => NodeSingletons?.os ?? null;
|
|
10
12
|
|
package/src/SLAMonitor.ts
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* Sealed namespace for immutability
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { ErrorFactory
|
|
7
|
+
import { ErrorFactory } from '@zintrust/core/errors';
|
|
8
|
+
import { Logger } from '@zintrust/core/logger';
|
|
9
|
+
import { generateUuid } from '@zintrust/core/utils';
|
|
8
10
|
import { HealthMonitor, type HealthCheckResult } from './HealthMonitor';
|
|
9
11
|
import { WorkerMetrics, type MetricPoint, type MetricType } from './WorkerMetrics';
|
|
10
12
|
|
package/src/WorkerFactory.ts
CHANGED
|
@@ -5,31 +5,25 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as ZintrustCoreModule from '@zintrust/core';
|
|
8
|
+
import { Cloudflare, databaseConfig, Env, queueConfig, workersConfig } from '@zintrust/core/config';
|
|
9
|
+
import { useEnsureDbConnected, type IDatabase } from '@zintrust/core/database';
|
|
10
|
+
import { ErrorFactory } from '@zintrust/core/errors';
|
|
11
|
+
import { Logger } from '@zintrust/core/logger';
|
|
12
|
+
import { DatabaseConnectionRegistry, registerDatabasesFromRuntimeConfig } from '@zintrust/core/orm';
|
|
13
|
+
import { JobStateTracker } from '@zintrust/core/queue';
|
|
8
14
|
import {
|
|
9
|
-
|
|
10
|
-
ErrorFactory,
|
|
11
|
-
generateUuid,
|
|
15
|
+
createRedisConnection,
|
|
12
16
|
getBullMQSafeQueueName,
|
|
17
|
+
type RedisConfig,
|
|
18
|
+
} from '@zintrust/core/redis';
|
|
19
|
+
import {
|
|
20
|
+
generateUuid,
|
|
13
21
|
isFunction,
|
|
14
22
|
isNonEmptyString,
|
|
15
23
|
isObject,
|
|
16
|
-
JobStateTracker,
|
|
17
|
-
Logger,
|
|
18
|
-
NodeSingletons,
|
|
19
|
-
useEnsureDbConnected,
|
|
20
24
|
ZintrustLang,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} from '@zintrust/core';
|
|
24
|
-
import {
|
|
25
|
-
Cloudflare,
|
|
26
|
-
createRedisConnection,
|
|
27
|
-
databaseConfig,
|
|
28
|
-
queueConfig,
|
|
29
|
-
workersConfig,
|
|
30
|
-
type RedisConfig,
|
|
31
|
-
} from '@zintrust/core/config';
|
|
32
|
-
import { DatabaseConnectionRegistry, registerDatabasesFromRuntimeConfig } from '@zintrust/core/orm';
|
|
25
|
+
} from '@zintrust/core/utils';
|
|
26
|
+
import { NodeSingletons, type WorkerStatus } from '@zintrust/core/workers';
|
|
33
27
|
import { Worker, type Job, type WorkerOptions } from 'bullmq';
|
|
34
28
|
import { AutoScaler, type AutoScalerConfig } from './AutoScaler';
|
|
35
29
|
import { CanaryController } from './CanaryController';
|
package/src/WorkerInit.ts
CHANGED
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
* - Ensures graceful startup and shutdown
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { Env
|
|
11
|
+
import { Env } from '@zintrust/core/config';
|
|
12
|
+
import { Logger } from '@zintrust/core/logger';
|
|
13
|
+
import { isObject } from '@zintrust/core/utils';
|
|
12
14
|
import { ResourceMonitor } from './ResourceMonitor';
|
|
13
15
|
import type { WorkerPersistenceConfig } from './WorkerFactory';
|
|
14
16
|
import { WorkerFactory } from './WorkerFactory';
|
package/src/WorkerMetrics.ts
CHANGED
|
@@ -4,13 +4,9 @@
|
|
|
4
4
|
* Sealed namespace for immutability
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
RedisKeys,
|
|
11
|
-
createRedisConnection,
|
|
12
|
-
type RedisConfig,
|
|
13
|
-
} from '@zintrust/core';
|
|
7
|
+
import { ErrorFactory } from '@zintrust/core/errors';
|
|
8
|
+
import { Logger } from '@zintrust/core/logger';
|
|
9
|
+
import { RedisKeys, createRedisConnection, type RedisConfig } from '@zintrust/core/redis';
|
|
14
10
|
|
|
15
11
|
type RedisConnection = ReturnType<typeof createRedisConnection>;
|
|
16
12
|
type RedisPipeline = ReturnType<RedisConnection['pipeline']>;
|
package/src/WorkerRegistry.ts
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* Sealed namespace for immutability
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { ErrorFactory
|
|
7
|
+
import { ErrorFactory } from '@zintrust/core/errors';
|
|
8
|
+
import { Logger } from '@zintrust/core/logger';
|
|
9
|
+
import { type WorkerConfig, type WorkerStatus } from '@zintrust/core/workers';
|
|
8
10
|
import { AnomalyDetection } from './AnomalyDetection';
|
|
9
11
|
|
|
10
12
|
export type WorkerMetadata = {
|
package/src/WorkerShutdown.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Coordinates orderly shutdown of all worker modules and the WorkerFactory.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { Logger } from '@zintrust/core';
|
|
8
|
+
import { Logger } from '@zintrust/core/logger';
|
|
9
9
|
import { WorkerFactory } from './WorkerFactory';
|
|
10
10
|
|
|
11
11
|
// ============================================================================
|
package/src/WorkerVersioning.ts
CHANGED