@zintrust/workers 0.4.41 → 0.4.43

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.
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@zintrust/workers",
3
- "version": "0.4.41",
4
- "buildDate": "2026-03-31T14:37:25.381Z",
3
+ "version": "0.4.43",
4
+ "buildDate": "2026-04-01T18:18:47.850Z",
5
5
  "buildEnvironment": {
6
6
  "node": "v22.22.1",
7
7
  "platform": "darwin",
8
8
  "arch": "arm64"
9
9
  },
10
10
  "git": {
11
- "commit": "4c539a14",
11
+ "commit": "57e4d1b5",
12
12
  "branch": "release"
13
13
  },
14
14
  "package": {
@@ -230,8 +230,8 @@
230
230
  "sha256": "8af20d462270e7044c6ea983821f5b6e6ce8a5caf39b6e8fefff07c9a0bf071e"
231
231
  },
232
232
  "build-manifest.json": {
233
- "size": 19595,
234
- "sha256": "4001b2714ed94060884116aca4cc53ac46334aa4dbf9e718aaebdad65ffd6b96"
233
+ "size": 19594,
234
+ "sha256": "ddb01f1c22cddfc1201631a2774726d0134407e811359eed517bf36b508d829c"
235
235
  },
236
236
  "config/workerConfig.d.ts": {
237
237
  "size": 132,
@@ -246,8 +246,8 @@
246
246
  "sha256": "dacd49f6c112eba439bdd9bb457eea90daedbf32efc381cd3189ce562fa5b0a8"
247
247
  },
248
248
  "createQueueWorker.js": {
249
- "size": 14103,
250
- "sha256": "8e619da00200c0c1270674a6a2941ae050c8ade3e38925b5446916cddc2a8b65"
249
+ "size": 14702,
250
+ "sha256": "69bf07658c185ad5b4bafd064bfc64ea257c769809b6d4811a274020b4a5a8e7"
251
251
  },
252
252
  "dashboard/index.d.ts": {
253
253
  "size": 109,
@@ -415,7 +415,7 @@
415
415
  },
416
416
  "index.js": {
417
417
  "size": 2337,
418
- "sha256": "bfe511dc4d6219d056d3e49e717a0cfabc1310b3bcb4fbae25a5a6ebb522bdf2"
418
+ "sha256": "698bb78d6613e898a60f390ca1766071324e3ec3a726184c35f174ea64cadb99"
419
419
  },
420
420
  "register.d.ts": {
421
421
  "size": 256,
@@ -27,6 +27,14 @@ const getTimeoutManager = () => {
27
27
  return undefined;
28
28
  }
29
29
  };
30
+ const getSystemDebuggerBridge = () => {
31
+ try {
32
+ return Core['SystemDebuggerBridge'];
33
+ }
34
+ catch {
35
+ return undefined;
36
+ }
37
+ };
30
38
  const getEnvInt = (key, fallback) => {
31
39
  const getter = Env.getInt;
32
40
  if (typeof getter === 'function') {
@@ -110,6 +118,14 @@ const getTrackerApi = () => {
110
118
  const getHeartbeatStoreApi = () => {
111
119
  return (getJobHeartbeatStore() ?? {}) ?? {};
112
120
  };
121
+ const emitJobProcessed = (name) => {
122
+ const bridge = (getSystemDebuggerBridge() ?? {});
123
+ bridge.emitJobProcessed?.(name);
124
+ };
125
+ const emitJobFailed = (name, error) => {
126
+ const bridge = (getSystemDebuggerBridge() ?? {});
127
+ bridge.emitJobFailed?.(name, error);
128
+ };
113
129
  const removeHeartbeatIfSupported = async (queueName, jobId) => {
114
130
  const heartbeatStore = getHeartbeatStoreApi();
115
131
  if (typeof heartbeatStore.remove === 'function') {
@@ -161,6 +177,7 @@ const onProcessSuccess = async (input) => {
161
177
  }
162
178
  await removeHeartbeatIfSupported(input.queueName, input.message.id);
163
179
  Logger.info(`${input.options.kindLabel} processed successfully`, input.baseLogFields);
180
+ emitJobProcessed(input.queueName);
164
181
  return true;
165
182
  };
166
183
  const onProcessFailure = async (input) => {
@@ -173,6 +190,8 @@ const onProcessFailure = async (input) => {
173
190
  error: input.error,
174
191
  attempts: nextAttempts,
175
192
  });
193
+ const failure = input.error instanceof Error ? input.error : new Error(String(input.error));
194
+ emitJobFailed(input.queueName, failure);
176
195
  if (isTimeoutError(input.error) && typeof input.trackerApi.timedOut === 'function') {
177
196
  await input.trackerApi.timedOut({
178
197
  queueName: input.queueName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zintrust/workers",
3
- "version": "0.4.41",
3
+ "version": "0.4.43",
4
4
  "description": "Worker orchestration and background job management for ZinTrust.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -40,7 +40,7 @@
40
40
  "node": ">=20.0.0"
41
41
  },
42
42
  "peerDependencies": {
43
- "@zintrust/core": "^0.4.41",
43
+ "@zintrust/core": "^0.4.43",
44
44
  "@zintrust/queue-monitor": "*",
45
45
  "@zintrust/queue-redis": "*"
46
46
  },
@@ -40,6 +40,14 @@ const getTimeoutManager = (): unknown => {
40
40
  }
41
41
  };
42
42
 
43
+ const getSystemDebuggerBridge = (): unknown => {
44
+ try {
45
+ return (Core as Record<string, unknown>)['SystemDebuggerBridge'];
46
+ } catch {
47
+ return undefined;
48
+ }
49
+ };
50
+
43
51
  const getEnvInt = (key: string, fallback: number): number => {
44
52
  const getter = (Env as { getInt?: (name: string, defaultValue: number) => number }).getInt;
45
53
  if (typeof getter === 'function') {
@@ -228,6 +236,22 @@ const getHeartbeatStoreApi = (): HeartbeatStoreApi => {
228
236
  return ((getJobHeartbeatStore() ?? {}) as HeartbeatStoreApi) ?? {};
229
237
  };
230
238
 
239
+ const emitJobProcessed = (name: string): void => {
240
+ const bridge = (getSystemDebuggerBridge() ?? {}) as {
241
+ emitJobProcessed?: (jobName: string) => void;
242
+ };
243
+
244
+ bridge.emitJobProcessed?.(name);
245
+ };
246
+
247
+ const emitJobFailed = (name: string, error: Error): void => {
248
+ const bridge = (getSystemDebuggerBridge() ?? {}) as {
249
+ emitJobFailed?: (jobName: string, failure: Error) => void;
250
+ };
251
+
252
+ bridge.emitJobFailed?.(name, error);
253
+ };
254
+
231
255
  const removeHeartbeatIfSupported = async (queueName: string, jobId: string): Promise<void> => {
232
256
  const heartbeatStore = getHeartbeatStoreApi();
233
257
  if (typeof heartbeatStore.remove === 'function') {
@@ -306,6 +330,7 @@ const onProcessSuccess = async <TPayload>(input: {
306
330
 
307
331
  await removeHeartbeatIfSupported(input.queueName, input.message.id);
308
332
  Logger.info(`${input.options.kindLabel} processed successfully`, input.baseLogFields);
333
+ emitJobProcessed(input.queueName);
309
334
  return true;
310
335
  };
311
336
 
@@ -329,6 +354,9 @@ const onProcessFailure = async <TPayload>(input: {
329
354
  attempts: nextAttempts,
330
355
  });
331
356
 
357
+ const failure = input.error instanceof Error ? input.error : new Error(String(input.error));
358
+ emitJobFailed(input.queueName, failure);
359
+
332
360
  if (isTimeoutError(input.error) && typeof input.trackerApi.timedOut === 'function') {
333
361
  await input.trackerApi.timedOut({
334
362
  queueName: input.queueName,