@zintrust/workers 3.0.1 → 3.3.1

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.
@@ -246,7 +246,7 @@ export const DeadLetterQueue = Object.freeze({
246
246
  }
247
247
  try {
248
248
  const key = getDLQKey(queueName);
249
- const entries = await redisClient.zrange(key, 0, -1);
249
+ const entries = await redisClient.zrange(key, 0, '-1');
250
250
  const entry = entries
251
251
  .map((e) => JSON.parse(e))
252
252
  .find((e) => e.id === jobId);
@@ -455,7 +455,7 @@ export const DeadLetterQueue = Object.freeze({
455
455
  const keys = await client.keys(pattern);
456
456
  const entriesByQueue = await Promise.all(keys.map(async (key) => {
457
457
  const queueName = key.replace(getDLQPrefix(), '');
458
- const entries = await client.zrange(key, 0, -1);
458
+ const entries = await client.zrange(key, 0, '-1');
459
459
  return {
460
460
  queueName,
461
461
  count: entries.length,
@@ -36,7 +36,7 @@ const verifyWorkerHealth = async (worker) => {
36
36
  const isRunning = await worker.isRunning();
37
37
  if (!isRunning)
38
38
  return false;
39
- const client = (await worker.client);
39
+ const client = (await worker.getBackend().client);
40
40
  const ping = client.ping;
41
41
  if (typeof ping !== 'function') {
42
42
  throw ErrorFactory.createWorkerError('Redis ping command is not available');
@@ -280,7 +280,7 @@ const getSummary = async () => {
280
280
  details: [],
281
281
  };
282
282
  for (const [name, state] of registry) {
283
- const lastResult = state.history[state.history.length - 1];
283
+ const lastResult = state.history.at(-1);
284
284
  const status = lastResult?.status || 'unknown';
285
285
  if (status === 'healthy')
286
286
  summary.healthy++;
@@ -61,7 +61,7 @@ export declare const PriorityQueue: Readonly<{
61
61
  /**
62
62
  * Get job by ID
63
63
  */
64
- getJob(queueName: string, jobId: string): Promise<import("bullmq").Job<any, any, string> | undefined>;
64
+ getJob(queueName: string, jobId: string): Promise<import("bullmq").Job<any, any, string, import("bullmq").JobProgress> | undefined>;
65
65
  /**
66
66
  * Remove a job
67
67
  */
@@ -849,7 +849,7 @@ const waitForWorkerConnection = async (worker, name, _queueName, timeoutMs) => {
849
849
  throw ErrorFactory.createWorkerError('Worker not running');
850
850
  }
851
851
  // Check Redis connection
852
- const client = (await worker.client);
852
+ const client = (await worker.getBackend().client);
853
853
  const ping = client.ping;
854
854
  if (typeof ping !== 'function') {
855
855
  throw ErrorFactory.createWorkerError('Redis ping command is not available');
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@zintrust/workers",
3
- "version": "2.8.1",
4
- "buildDate": "2026-06-27T08:39:32.101Z",
3
+ "version": "3.3.1",
4
+ "buildDate": "2026-11-04T05:48:01.266Z",
5
5
  "buildEnvironment": {
6
- "node": "v22.22.1",
7
- "platform": "darwin",
8
- "arch": "arm64"
6
+ "node": "v22.23.4",
7
+ "platform": "linux",
8
+ "arch": "x64"
9
9
  },
10
10
  "git": {
11
- "commit": "731f5512",
12
- "branch": "release"
11
+ "commit": "0eac7f3d",
12
+ "branch": "master"
13
13
  },
14
14
  "package": {
15
15
  "engines": {
@@ -107,16 +107,16 @@
107
107
  "sha256": "c63f44497fbb6312cfbbe28c92c6976dc265e736d76579cbb26bd29e09e93959"
108
108
  },
109
109
  "DeadLetterQueue.js": {
110
- "size": 20221,
111
- "sha256": "8fa4ad2d83af2c3b3f651a2ea42b6792d27c4b6daa0b3a8035de4de585248bc3"
110
+ "size": 20225,
111
+ "sha256": "13fea4b4e5bbf37ccef6365511edb66db292f5e8077bfe6c0534a630b86699d2"
112
112
  },
113
113
  "HealthMonitor.d.ts": {
114
114
  "size": 1485,
115
115
  "sha256": "5767e2d2dba4f734baf34770e6128ee75ee2816eb114f5d2c398cc1be844d2ab"
116
116
  },
117
117
  "HealthMonitor.js": {
118
- "size": 9703,
119
- "sha256": "1ba2e3e99c48c563977e3ae36ecebff0e1deaa2381296a1ebc8e4e836b71b507"
118
+ "size": 9697,
119
+ "sha256": "0a08f65fbe5f6d97671746c147b0129243211a71e4fb92595ab4f6bb6c13c0f6"
120
120
  },
121
121
  "MultiQueueWorker.d.ts": {
122
122
  "size": 2311,
@@ -151,8 +151,8 @@
151
151
  "sha256": "6c2a197be571b81cae8016df7c681f53029f125260fb50a10c208a80c9694326"
152
152
  },
153
153
  "PriorityQueue.d.ts": {
154
- "size": 3210,
155
- "sha256": "4a3ef407f832a0cfbea19039a3aad3dbdbcf28cbd883fbbe4a429a0bd9bc8fb8"
154
+ "size": 3240,
155
+ "sha256": "3f45bcd02ed688ef29159497d61e74f9902036ff9d65c34287dae573f7e6995b"
156
156
  },
157
157
  "PriorityQueue.js": {
158
158
  "size": 8958,
@@ -179,8 +179,8 @@
179
179
  "sha256": "2985770dc3f7315f621a9a067fc9d079bb9bf9a6b5bad4b40a34fa2eb620a0e5"
180
180
  },
181
181
  "WorkerFactory.js": {
182
- "size": 112636,
183
- "sha256": "918514db55f7e985baaa82033ef364c01154c5860a190fdabe4393142076e893"
182
+ "size": 112649,
183
+ "sha256": "df73adcafc4c2c6efe484b4e524c11b1e390aa7e0d285b9479d28bed3bf9f352"
184
184
  },
185
185
  "WorkerInit.d.ts": {
186
186
  "size": 3284,
@@ -222,10 +222,6 @@
222
222
  "size": 11000,
223
223
  "sha256": "9aedd369e9a3e409845929da17e14975bbc53a3ed1f6eebf62b464dda170a5bb"
224
224
  },
225
- "build-manifest.json": {
226
- "size": 19617,
227
- "sha256": "6821a78856f304d56a6291e04ec500936a9a823b1a32bad48810e8d6ce0e1801"
228
- },
229
225
  "config/workerConfig.d.ts": {
230
226
  "size": 282,
231
227
  "sha256": "4671566a0cba372852c049ba66f7671ec19f5db38b0eaed1815eb532e7d58109"
@@ -251,8 +247,8 @@
251
247
  "sha256": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"
252
248
  },
253
249
  "dashboard/types.d.ts": {
254
- "size": 3402,
255
- "sha256": "5a9ff277a9711393368b968e6cd7b2550a1354139be6b1d4cc951015cf500b09"
250
+ "size": 3459,
251
+ "sha256": "f31bb9acf84075ebf1a87ad259348a1631b3f9cfdf256d357c1c3f50319b30d8"
256
252
  },
257
253
  "dashboard/types.js": {
258
254
  "size": 11,
@@ -271,8 +267,8 @@
271
267
  "sha256": "8e0e04329e1119d8ae835dd4458efead084293bcc2c263c09dd5a19d467e5ca4"
272
268
  },
273
269
  "dashboard/workers-api.js": {
274
- "size": 39416,
275
- "sha256": "9999f193bfa65826d069c40c2fad4001a334cb63fd818789b60da7e5d689e2e5"
270
+ "size": 40408,
271
+ "sha256": "4267385816fc887b59ee5f5127379c21dff766bf7ee874f4574d26d4c4d86b90"
276
272
  },
277
273
  "helper/index.d.ts": {
278
274
  "size": 475,
@@ -416,7 +412,7 @@
416
412
  },
417
413
  "index.js": {
418
414
  "size": 2428,
419
- "sha256": "11666375858d8052eb83fc7dd0604519a5ef50f13a9a7fd4410254e1176f8646"
415
+ "sha256": "fe49f9634dc79355f74c7e45cebbce6d86aff648fabda86151a42729eb441283"
420
416
  },
421
417
  "queueMonitorHistory.d.ts": {
422
418
  "size": 433,
@@ -63,13 +63,14 @@ const manifestWorkers = () => transformToWorkerData(getWorkerManifestEntries()
63
63
  })
64
64
  .filter((entry) => entry !== null), 'redis');
65
65
  const mergeManifestWorkers = (backendWorkers, manifest = manifestWorkers()) => {
66
- const manifestQueues = new Set(manifest.map((worker) => worker.queueName));
67
66
  const byName = new Map();
68
67
  for (const worker of manifest) {
69
68
  byName.set(worker.name, worker);
70
69
  }
71
70
  for (const worker of backendWorkers) {
72
- const isPlaceholder = worker.name === `${worker.queueName}:redis-rpc` && manifestQueues.has(worker.queueName);
71
+ // Redis RPC queue-discovery placeholders use `<queueName>:redis-rpc` names.
72
+ // They are not valid lifecycle identities (colon fails worker-name validation).
73
+ const isPlaceholder = worker.name === `${worker.queueName}:redis-rpc`;
73
74
  if (isPlaceholder)
74
75
  continue;
75
76
  byName.set(worker.name, { ...byName.get(worker.name), ...worker });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zintrust/workers",
3
- "version": "3.0.1",
3
+ "version": "3.3.1",
4
4
  "description": "Worker orchestration and background job management for ZinTrust.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -75,10 +75,10 @@
75
75
  "prepublishOnly": "npm run build"
76
76
  },
77
77
  "dependencies": {
78
- "@opentelemetry/api": "^1.9.1",
79
- "hot-shots": "^14.3.1",
80
- "ioredis": "^5.11.0",
78
+ "@opentelemetry/api": "~1.9.1",
79
+ "hot-shots": "^17.1.0",
80
+ "ioredis": "^6.0.0",
81
81
  "prom-client": "^15.1.3",
82
- "simple-statistics": "^7.8.9"
82
+ "simple-statistics": "^7.12.0"
83
83
  }
84
- }
84
+ }
@@ -363,7 +363,7 @@ export const DeadLetterQueue = Object.freeze({
363
363
 
364
364
  try {
365
365
  const key = getDLQKey(queueName);
366
- const entries = await redisClient.zrange(key, 0, -1);
366
+ const entries = await redisClient.zrange(key, 0, '-1');
367
367
 
368
368
  const entry = entries
369
369
  .map((e: string) => JSON.parse(e) as FailedJobEntry)
@@ -622,7 +622,7 @@ export const DeadLetterQueue = Object.freeze({
622
622
  const entriesByQueue = await Promise.all(
623
623
  keys.map(async (key: string) => {
624
624
  const queueName = key.replace(getDLQPrefix(), '');
625
- const entries = await client.zrange(key, 0, -1);
625
+ const entries = await client.zrange(key, 0, '-1');
626
626
  return {
627
627
  queueName,
628
628
  count: entries.length,
@@ -86,7 +86,7 @@ const verifyWorkerHealth = async (worker: Worker): Promise<boolean> => {
86
86
  const isRunning = await worker.isRunning();
87
87
  if (!isRunning) return false;
88
88
 
89
- const client = (await worker.client) as unknown as {
89
+ const client = (await worker.getBackend().client) as unknown as {
90
90
  ping?: () => Promise<string> | Promise<unknown>;
91
91
  };
92
92
  const ping = client.ping;
@@ -380,7 +380,7 @@ const getSummary = async (): Promise<unknown> => {
380
380
  };
381
381
 
382
382
  for (const [name, state] of registry) {
383
- const lastResult = state.history[state.history.length - 1];
383
+ const lastResult = state.history.at(-1);
384
384
  const status = lastResult?.status || 'unknown';
385
385
  if (status === 'healthy') summary.healthy++;
386
386
  else if (status === 'degraded') summary.degraded++;
@@ -1236,7 +1236,7 @@ const waitForWorkerConnection = async (
1236
1236
  }
1237
1237
 
1238
1238
  // Check Redis connection
1239
- const client = (await worker.client) as unknown as {
1239
+ const client = (await worker.getBackend().client) as unknown as {
1240
1240
  ping?: () => Promise<string> | Promise<unknown>;
1241
1241
  };
1242
1242
  const ping = client.ping;
@@ -134,14 +134,14 @@ const mergeManifestWorkers = (
134
134
  backendWorkers: WorkerData[],
135
135
  manifest: WorkerData[] = manifestWorkers()
136
136
  ): WorkerData[] => {
137
- const manifestQueues = new Set(manifest.map((worker) => worker.queueName));
138
137
  const byName = new Map<string, WorkerData>();
139
138
  for (const worker of manifest) {
140
139
  byName.set(worker.name, worker);
141
140
  }
142
141
  for (const worker of backendWorkers) {
143
- const isPlaceholder =
144
- worker.name === `${worker.queueName}:redis-rpc` && manifestQueues.has(worker.queueName);
142
+ // Redis RPC queue-discovery placeholders use `<queueName>:redis-rpc` names.
143
+ // They are not valid lifecycle identities (colon fails worker-name validation).
144
+ const isPlaceholder = worker.name === `${worker.queueName}:redis-rpc`;
145
145
  if (isPlaceholder) continue;
146
146
  byName.set(worker.name, { ...byName.get(worker.name), ...worker });
147
147
  }