@zintrust/core 0.4.74 → 0.4.76

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.
Files changed (57) hide show
  1. package/package.json +1 -1
  2. package/src/boot/registry/runtime.d.ts.map +1 -1
  3. package/src/boot/registry/runtime.js +26 -25
  4. package/src/cache/Cache.d.ts.map +1 -1
  5. package/src/cache/Cache.js +11 -11
  6. package/src/cli/BaseCommand.js +3 -3
  7. package/src/cli/OptionalCliExtensions.js +8 -8
  8. package/src/cli/commands/TraceCommand.d.ts +18 -0
  9. package/src/cli/commands/TraceCommand.d.ts.map +1 -0
  10. package/src/cli/commands/TraceCommand.js +6 -0
  11. package/src/cli/commands/TraceCommands.d.ts +25 -0
  12. package/src/cli/commands/TraceCommands.d.ts.map +1 -0
  13. package/src/cli/commands/{DebuggerCommands.js → TraceCommands.js} +80 -80
  14. package/src/cli/commands/index.d.ts +1 -1
  15. package/src/cli/commands/index.d.ts.map +1 -1
  16. package/src/cli/commands/index.js +1 -1
  17. package/src/cli/index.d.ts +2 -2
  18. package/src/cli/index.d.ts.map +1 -1
  19. package/src/cli/index.js +2 -2
  20. package/src/cli.d.ts +1 -1
  21. package/src/cli.d.ts.map +1 -1
  22. package/src/cli.js +1 -1
  23. package/src/events/EventDispatcher.js +3 -3
  24. package/src/index.d.ts +2 -2
  25. package/src/index.d.ts.map +1 -1
  26. package/src/index.js +5 -5
  27. package/src/runtime/adapters/CloudflareAdapter.js +3 -3
  28. package/src/runtime/plugins/trace-runtime.d.ts +19 -0
  29. package/src/runtime/plugins/trace-runtime.d.ts.map +1 -0
  30. package/src/runtime/plugins/trace-runtime.js +19 -0
  31. package/src/runtime/plugins/trace.d.ts +2 -0
  32. package/src/runtime/plugins/trace.d.ts.map +1 -0
  33. package/src/runtime/plugins/{system-debugger.js → trace.js} +2 -2
  34. package/src/security/JwtManager.js +4 -4
  35. package/src/tools/http/Http.js +2 -2
  36. package/src/tools/mail/index.js +2 -2
  37. package/src/tools/notification/Service.js +6 -6
  38. package/src/tools/queue/AdvancedQueue.d.ts.map +1 -1
  39. package/src/tools/queue/AdvancedQueue.js +11 -4
  40. package/src/tools/queue/DeduplicationKey.d.ts.map +1 -1
  41. package/src/tools/queue/Queue.js +2 -2
  42. package/src/{debugger/SystemDebuggerBridge.d.ts → trace/SystemTraceBridge.d.ts} +3 -3
  43. package/src/trace/SystemTraceBridge.d.ts.map +1 -0
  44. package/src/{debugger/SystemDebuggerBridge.js → trace/SystemTraceBridge.js} +20 -20
  45. package/src/zintrust.plugins.js +3 -3
  46. package/src/zintrust.plugins.wg.js +3 -3
  47. package/src/cli/commands/DebuggerCommand.d.ts +0 -18
  48. package/src/cli/commands/DebuggerCommand.d.ts.map +0 -1
  49. package/src/cli/commands/DebuggerCommand.js +0 -6
  50. package/src/cli/commands/DebuggerCommands.d.ts +0 -25
  51. package/src/cli/commands/DebuggerCommands.d.ts.map +0 -1
  52. package/src/debugger/SystemDebuggerBridge.d.ts.map +0 -1
  53. package/src/runtime/plugins/system-debugger-runtime.d.ts +0 -19
  54. package/src/runtime/plugins/system-debugger-runtime.d.ts.map +0 -1
  55. package/src/runtime/plugins/system-debugger-runtime.js +0 -19
  56. package/src/runtime/plugins/system-debugger.d.ts +0 -2
  57. package/src/runtime/plugins/system-debugger.d.ts.map +0 -1
package/src/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @zintrust/core v0.4.74
2
+ * @zintrust/core v0.4.76
3
3
  *
4
4
  * ZinTrust Framework - Production-Grade TypeScript Backend
5
5
  * Built for performance, type safety, and exceptional developer experience
6
6
  *
7
7
  * Build Information:
8
- * Built: 2026-04-07T10:53:15.441Z
8
+ * Built: 2026-04-07T17:37:11.008Z
9
9
  * Node: >=20.0.0
10
10
  * License: MIT
11
11
  *
@@ -21,7 +21,7 @@
21
21
  * Available at runtime for debugging and health checks
22
22
  */
23
23
  export const ZINTRUST_VERSION = '0.1.41';
24
- export const ZINTRUST_BUILD_DATE = '2026-04-07T10:53:15.407Z'; // Replaced during build
24
+ export const ZINTRUST_BUILD_DATE = '2026-04-07T17:37:10.972Z'; // Replaced during build
25
25
  export { Application } from './boot/Application.js';
26
26
  export { AwsSigV4 } from './common/index.js';
27
27
  export { SignedRequest } from './security/SignedRequest.js';
@@ -104,7 +104,7 @@ export { ErrorFactory } from './exceptions/ZintrustError.js';
104
104
  // Runtime services
105
105
  export { detectCloudflareWorkers, detectRuntimePlatform, RUNTIME_PLATFORM, RuntimeServices, } from './runtime/RuntimeServices.js';
106
106
  // Events
107
- export { SystemDebuggerBridge } from './debugger/SystemDebuggerBridge.js';
107
+ export { SystemTraceBridge } from './trace/SystemTraceBridge.js';
108
108
  export { EventDispatcher } from './events/EventDispatcher.js';
109
109
  // Sessions
110
110
  export { SessionManager } from './session/SessionManager.js';
@@ -183,6 +183,7 @@ export { S3Driver } from './tools/storage/drivers/S3.js';
183
183
  export { R2Driver } from './tools/storage/drivers/R2.js';
184
184
  export { GcsDriver } from './tools/storage/drivers/Gcs.js';
185
185
  // Queue drivers (for external registration packages)
186
+ export { resolveDeduplicationLockKey } from './tools/queue/DeduplicationKey.js';
186
187
  export { RedisQueue } from './tools/queue/drivers/Redis.js';
187
188
  export { IdempotencyManager } from './tools/queue/IdempotencyManager.js';
188
189
  export { JobHeartbeatStore } from './tools/queue/JobHeartbeatStore.js';
@@ -190,7 +191,6 @@ export { JobReconciliationRunner } from './tools/queue/JobReconciliationRunner.j
190
191
  export { JobRecoveryDaemon } from './tools/queue/JobRecoveryDaemon.js';
191
192
  export { JobStateTracker } from './tools/queue/JobStateTracker.js';
192
193
  export { autoRegisterJobStateTrackerPersistenceFromEnv, createJobStateTrackerDbPersistence, } from './tools/queue/JobStateTrackerDbPersistence.js';
193
- export { resolveDeduplicationLockKey } from './tools/queue/DeduplicationKey.js';
194
194
  export { createLockProvider, getLockProvider, registerLockProvider } from './tools/queue/LockProvider.js';
195
195
  export { Queue, resolveLockPrefix } from './tools/queue/Queue.js';
196
196
  export { QueueDataRedactor } from './tools/queue/QueueDataRedactor.js';
@@ -118,9 +118,9 @@ async function handleCloudflareRequest(adapter, config, logger, event) {
118
118
  const err = error;
119
119
  Logger.error('Cloudflare handler error', err);
120
120
  StartupErrorLogging.logDetails(err, {
121
- errors: 'Cloudflare startup configuration errors',
122
- warnings: 'Cloudflare startup configuration warnings',
123
- report: 'Cloudflare startup health report',
121
+ errors: 'Cloudflare startup configuration errors:',
122
+ warnings: 'Cloudflare startup configuration warnings:',
123
+ report: 'Cloudflare startup health report:',
124
124
  });
125
125
  if (typeof err?.stack === 'string' && err.stack.trim() !== '') {
126
126
  Logger.error('Cloudflare handler stack', err.stack);
@@ -0,0 +1,19 @@
1
+ type TraceConfigApi = {
2
+ merge(overrides?: unknown): {
3
+ enabled?: boolean;
4
+ connection?: string;
5
+ };
6
+ };
7
+ type TraceStorageApi = {
8
+ resolveStorage(db: unknown): unknown;
9
+ };
10
+ export declare const isAvailable: () => boolean;
11
+ export declare const TraceConfig: TraceConfigApi;
12
+ export declare const TraceStorage: TraceStorageApi;
13
+ export declare const registerTraceRoutes: (router: unknown, storage: unknown, options?: {
14
+ basePath?: string;
15
+ middleware?: ReadonlyArray<string>;
16
+ }) => void;
17
+ export declare const ensureSystemTraceRegistered: () => Promise<void>;
18
+ export {};
19
+ //# sourceMappingURL=trace-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace-runtime.d.ts","sourceRoot":"","sources":["../../../../src/runtime/plugins/trace-runtime.ts"],"names":[],"mappings":"AAAA,KAAK,cAAc,GAAG;IACpB,KAAK,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACxE,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,cAAc,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAAC;CACtC,CAAC;AA8BF,eAAO,MAAM,WAAW,QAAO,OAA0C,CAAC;AAE1E,eAAO,MAAM,WAAW,EAAE,cAAsE,CAAC;AAEjG,eAAO,MAAM,YAAY,EAAE,eAC8B,CAAC;AAE1D,eAAO,MAAM,mBAAmB,WA/BpB,OAAO,WACN,OAAO,YACN;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CAAE,KAChE,IA6BgE,CAAC;AAExE,eAAO,MAAM,2BAA2B,QAAa,OAAO,CAAC,IAAI,CAGhE,CAAC"}
@@ -0,0 +1,19 @@
1
+ const fallbackTraceConfig = Object.freeze({
2
+ merge: () => ({ enabled: false }),
3
+ });
4
+ const fallbackTraceStorage = Object.freeze({
5
+ resolveStorage: (_db) => undefined,
6
+ });
7
+ const fallbackRegisterTraceRoutes = (_router, _storage, _options) => undefined;
8
+ const systemTraceModule = await import('../../../packages/trace/src/index.js')
9
+ .then((module) => module)
10
+ .catch(() => undefined);
11
+ export const isAvailable = () => systemTraceModule !== undefined;
12
+ export const TraceConfig = systemTraceModule?.TraceConfig ?? fallbackTraceConfig;
13
+ export const TraceStorage = systemTraceModule?.TraceStorage ?? fallbackTraceStorage;
14
+ export const registerTraceRoutes = systemTraceModule?.registerTraceRoutes ?? fallbackRegisterTraceRoutes;
15
+ export const ensureSystemTraceRegistered = async () => {
16
+ if (!isAvailable())
17
+ return;
18
+ await import('../../../packages/trace/src/register.js').catch(() => undefined);
19
+ };
@@ -0,0 +1,2 @@
1
+ export type {};
2
+ //# sourceMappingURL=trace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../../../src/runtime/plugins/trace.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,CAAC"}
@@ -7,8 +7,8 @@ const tryImport = async (specifier) => {
7
7
  return false;
8
8
  }
9
9
  };
10
- const importedPackagePlugin = await tryImport('@zintrust/system-debugger/plugin');
10
+ const importedPackagePlugin = await tryImport('@zintrust/trace/plugin');
11
11
  if (!importedPackagePlugin) {
12
- await import('../../../packages/system-debugger/src/plugin.js').catch(() => undefined);
12
+ await import('../../../packages/trace/src/plugin.js').catch(() => undefined);
13
13
  }
14
14
  export {};
@@ -3,7 +3,7 @@
3
3
  * JSON Web Token generation, verification, and claims management
4
4
  * Uses native Node.js crypto module (zero external dependencies)
5
5
  */
6
- import { SystemDebuggerBridge } from '../debugger/SystemDebuggerBridge.js';
6
+ import { SystemTraceBridge } from '../trace/SystemTraceBridge.js';
7
7
  import { securityConfig } from '../config/security.js';
8
8
  import { ErrorFactory } from '../exceptions/ZintrustError.js';
9
9
  import { createHmac, createSign, createVerify, randomBytes } from '../node-singletons/crypto.js';
@@ -44,11 +44,11 @@ const getLogoutSubject = (authHeader) => {
44
44
  const logout = async (authHeader) => {
45
45
  const subject = getLogoutSubject(authHeader);
46
46
  await JwtSessions.logout(authHeader);
47
- SystemDebuggerBridge.emitAuth('logout', subject);
47
+ SystemTraceBridge.emitAuth('logout', subject);
48
48
  };
49
49
  const logoutAll = async (sub) => {
50
50
  await JwtSessions.logoutAll(sub);
51
- SystemDebuggerBridge.emitAuth('logout', sub);
51
+ SystemTraceBridge.emitAuth('logout', sub);
52
52
  };
53
53
  const signAccessToken = async (payload, expiresIn) => {
54
54
  const algorithm = securityConfig.jwt.algorithm;
@@ -75,7 +75,7 @@ const signAccessToken = async (payload, expiresIn) => {
75
75
  });
76
76
  }
77
77
  await JwtSessions.register(token);
78
- SystemDebuggerBridge.emitAuth('login', typeof payload.sub === 'string' ? payload.sub : undefined);
78
+ SystemTraceBridge.emitAuth('login', typeof payload.sub === 'string' ? payload.sub : undefined);
79
79
  return token;
80
80
  };
81
81
  /**
@@ -6,7 +6,7 @@
6
6
  * await HttpClient.post('https://api.example.com/users', data).withTimeout(5000).send();
7
7
  */
8
8
  import { OpenTelemetry } from '../../observability/OpenTelemetry.js';
9
- import { SystemDebuggerBridge } from '../../debugger/SystemDebuggerBridge.js';
9
+ import { SystemTraceBridge } from '../../trace/SystemTraceBridge.js';
10
10
  import { Env } from '../../config/env.js';
11
11
  import { Logger } from '../../config/logger.js';
12
12
  import { ErrorFactory } from '../../exceptions/ZintrustError.js';
@@ -56,7 +56,7 @@ async function performFetch(state) {
56
56
  const startTime = Date.now();
57
57
  const response = await globalThis.fetch(state.url, init);
58
58
  const duration = Date.now() - startTime;
59
- SystemDebuggerBridge.emitHttpClient(state.method, state.url, { ...state.headers }, response.status, duration);
59
+ SystemTraceBridge.emitHttpClient(state.method, state.url, { ...state.headers }, response.status, duration);
60
60
  return { response, durationMs: duration };
61
61
  }
62
62
  catch (error) {
@@ -1,5 +1,5 @@
1
+ import { SystemTraceBridge } from '../../trace/SystemTraceBridge.js';
1
2
  import { mailConfig } from '../../config/mail.js';
2
- import { SystemDebuggerBridge } from '../../debugger/SystemDebuggerBridge.js';
3
3
  import { ErrorFactory } from '../../exceptions/ZintrustError.js';
4
4
  import { SesDriver } from './drivers/Ses.js';
5
5
  import { resolveAttachments } from './attachments.js';
@@ -94,7 +94,7 @@ const createMailer = (name) => Object.freeze({
94
94
  html: input.html,
95
95
  attachments,
96
96
  });
97
- SystemDebuggerBridge.emitMail(normalizeMailRecipients(input.to), input.subject);
97
+ SystemTraceBridge.emitMail(normalizeMailRecipients(input.to), input.subject);
98
98
  return result;
99
99
  },
100
100
  });
@@ -1,5 +1,5 @@
1
+ import { SystemTraceBridge } from '../../trace/SystemTraceBridge.js';
1
2
  import notificationConfig from '../../config/notification.js';
2
- import { SystemDebuggerBridge } from '../../debugger/SystemDebuggerBridge.js';
3
3
  import { ErrorFactory } from '../../exceptions/ZintrustError.js';
4
4
  import { NotificationConfig } from './config.js';
5
5
  import { ConsoleDriver } from './drivers/Console.js';
@@ -58,7 +58,7 @@ export const NotificationService = Object.freeze({
58
58
  const driverName = NotificationConfig.getDriver();
59
59
  const driver = NotificationRegistry.get(driverName);
60
60
  const result = await driver.send(recipient, message, options);
61
- SystemDebuggerBridge.emitNotification(driverName, [driverName], recipient);
61
+ SystemTraceBridge.emitNotification(driverName, [driverName], recipient);
62
62
  return result;
63
63
  },
64
64
  async sendVia(channelName, recipient, message, options = {}) {
@@ -67,14 +67,14 @@ export const NotificationService = Object.freeze({
67
67
  switch (cfg.driver) {
68
68
  case 'console': {
69
69
  const result = await ConsoleDriver.send(recipient, message, options);
70
- SystemDebuggerBridge.emitNotification(channelName, ['console'], recipient);
70
+ SystemTraceBridge.emitNotification(channelName, ['console'], recipient);
71
71
  return result;
72
72
  }
73
73
  case 'slack': {
74
74
  const slackCfg = cfg;
75
75
  const payload = { text: message, ...options };
76
76
  const result = await SlackDriver.send({ webhookUrl: slackCfg.webhookUrl }, payload);
77
- SystemDebuggerBridge.emitNotification(channelName, ['slack'], recipient);
77
+ SystemTraceBridge.emitNotification(channelName, ['slack'], recipient);
78
78
  return result;
79
79
  }
80
80
  case 'twilio': {
@@ -84,12 +84,12 @@ export const NotificationService = Object.freeze({
84
84
  authToken: twilioCfg.authToken,
85
85
  from: twilioCfg.fromNumber,
86
86
  }, { to: recipient, body: message });
87
- SystemDebuggerBridge.emitNotification(channelName, ['twilio'], recipient);
87
+ SystemTraceBridge.emitNotification(channelName, ['twilio'], recipient);
88
88
  return result;
89
89
  }
90
90
  case 'termii': {
91
91
  const result = await sendTermii(cfg, recipient, message, options);
92
- SystemDebuggerBridge.emitNotification(channelName, ['termii'], recipient);
92
+ SystemTraceBridge.emitNotification(channelName, ['termii'], recipient);
93
93
  return result;
94
94
  }
95
95
  default:
@@ -1 +1 @@
1
- {"version":3,"file":"AdvancedQueue.d.ts","sourceRoot":"","sources":["../../../../src/tools/queue/AdvancedQueue.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACV,kBAAkB,EAElB,SAAS,EAGT,WAAW,EACZ,MAAM,eAAe,CAAC;AAQvB,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAExE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5F,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3E,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACxD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,GAAG,aAAa,CAiBtE"}
1
+ {"version":3,"file":"AdvancedQueue.d.ts","sourceRoot":"","sources":["../../../../src/tools/queue/AdvancedQueue.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACV,kBAAkB,EAElB,SAAS,EAGT,WAAW,EACZ,MAAM,eAAe,CAAC;AAOvB,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAExE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5F,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3E,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACxD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,GAAG,aAAa,CAiBtE"}
@@ -8,7 +8,6 @@ import { Logger } from '../../config/logger.js';
8
8
  import { queueConfig } from '../../config/queue.js';
9
9
  import { createValidationError } from '../../exceptions/ZintrustError.js';
10
10
  import { ZintrustLang } from '../../lang/lang.js';
11
- import { resolveDeduplicationLockKey } from './DeduplicationKey.js';
12
11
  import { createLockProvider, getLockProvider, registerLockProvider } from './LockProvider.js';
13
12
  import { Queue, resolveLockPrefix } from './Queue.js';
14
13
  /**
@@ -101,6 +100,14 @@ function normalizeOptionId(value) {
101
100
  const normalized = value.trim();
102
101
  return normalized.length > 0 ? normalized : undefined;
103
102
  }
103
+ function resolveScopedDeduplicationLockKey(queueName, deduplicationId) {
104
+ const normalizedQueueName = String(queueName).trim();
105
+ const normalizedDeduplicationId = String(deduplicationId).trim();
106
+ if (normalizedQueueName.length === 0) {
107
+ return normalizedDeduplicationId;
108
+ }
109
+ return `queue:${normalizedQueueName}:${normalizedDeduplicationId}`;
110
+ }
104
111
  function attachAdvancedIdentifiers(payload, options) {
105
112
  const requestedJobId = normalizeOptionId(options.jobId);
106
113
  const requestedUniqueId = normalizeOptionId(options.uniqueId);
@@ -137,7 +144,7 @@ function attachQueueMeta(payload, options, queueName) {
137
144
  deduplicationId,
138
145
  deduplicationLockKey: deduplicationId === undefined
139
146
  ? undefined
140
- : resolveDeduplicationLockKey(queueName, deduplicationId),
147
+ : resolveScopedDeduplicationLockKey(queueName, deduplicationId),
141
148
  releaseAfter: options.deduplication?.releaseAfter,
142
149
  uniqueId: options.uniqueId,
143
150
  };
@@ -184,7 +191,7 @@ async function handleDeduplicationLogic(options, lockProvider, name, startTime)
184
191
  // So releaseLock expects 'id' (without prefix).
185
192
  // deduplicationResult.lockId is lock.key (WITH prefix).
186
193
  // deduplicationResult.id is the original ID.
187
- const lockId = resolveDeduplicationLockKey(name, deduplicationId);
194
+ const lockId = resolveScopedDeduplicationLockKey(name, deduplicationId);
188
195
  // Create timeout with proper cleanup tracking
189
196
  // Using unref() to prevent blocking process exit
190
197
  // eslint-disable-next-line no-restricted-syntax
@@ -351,7 +358,7 @@ function validateUniqueId(uniqueId) {
351
358
  async function handleDeduplication(deduplicationOptions, // DeduplicationOptions - using any to avoid circular import
352
359
  lockProvider, queueName) {
353
360
  const { id, ttl, replace } = deduplicationOptions;
354
- const scopedLockKey = resolveDeduplicationLockKey(queueName, id);
361
+ const scopedLockKey = resolveScopedDeduplicationLockKey(queueName, id);
355
362
  try {
356
363
  // Check if lock already exists
357
364
  const lockStatus = await lockProvider.status(scopedLockKey);
@@ -1 +1 @@
1
- {"version":3,"file":"DeduplicationKey.d.ts","sourceRoot":"","sources":["../../../../src/tools/queue/DeduplicationKey.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,GACtC,WAAW,MAAM,EACjB,iBAAiB,MAAM,KACtB,MASF,CAAC"}
1
+ {"version":3,"file":"DeduplicationKey.d.ts","sourceRoot":"","sources":["../../../../src/tools/queue/DeduplicationKey.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,GAAI,WAAW,MAAM,EAAE,iBAAiB,MAAM,KAAG,MASxF,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { generateUuid } from '../../common/utility.js';
2
- import { SystemDebuggerBridge } from '../../debugger/SystemDebuggerBridge.js';
3
2
  import { ZintrustLang } from '../../lang/lang.js';
3
+ import { SystemTraceBridge } from '../../trace/SystemTraceBridge.js';
4
4
  import { Env } from '../../config/env.js';
5
5
  import { Logger } from '../../config/logger.js';
6
6
  import { ErrorFactory } from '../../exceptions/ZintrustError.js';
@@ -139,7 +139,7 @@ export const Queue = Object.freeze({
139
139
  payload,
140
140
  requestedUniqueId,
141
141
  });
142
- SystemDebuggerBridge.emitJobDispatch(queue, queue, resolvedDriver, payload);
142
+ SystemTraceBridge.emitJobDispatch(queue, queue, resolvedDriver, payload);
143
143
  return jobId;
144
144
  }
145
145
  catch (error) {
@@ -1,4 +1,4 @@
1
- export declare const SystemDebuggerBridge: Readonly<{
1
+ export declare const SystemTraceBridge: Readonly<{
2
2
  preload: () => Promise<boolean>;
3
3
  emitAuth: (event: "login" | "logout" | "failed", userId?: string) => void;
4
4
  emitCache: (operation: "get" | "set" | "delete" | "clear" | "has", key: string, duration: number, hit?: boolean) => void;
@@ -11,5 +11,5 @@ export declare const SystemDebuggerBridge: Readonly<{
11
11
  emitMail: (to: string, subject: string, template?: string) => void;
12
12
  emitNotification: (notification: string, channels: string[], notifiable?: string) => void;
13
13
  }>;
14
- export default SystemDebuggerBridge;
15
- //# sourceMappingURL=SystemDebuggerBridge.d.ts.map
14
+ export default SystemTraceBridge;
15
+ //# sourceMappingURL=SystemTraceBridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SystemTraceBridge.d.ts","sourceRoot":"","sources":["../../../src/trace/SystemTraceBridge.ts"],"names":[],"mappings":"AA6KA,eAAO,MAAM,iBAAiB;mBALJ,OAAO,CAAC,OAAO,CAAC;sBAlBjB,OAAO,GAAG,QAAQ,GAAG,QAAQ,WAAW,MAAM,KAAG,IAAI;2BA1DjE,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,OAChD,MAAM,YACD,MAAM,QACV,OAAO,KACZ,IAAI;wBA6DC,MAAM,QACN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YACnB,MAAM,YACN,MAAM,WACP,MAAM,KACd,IAAI;sBAlBkB,MAAM,iBAAiB,MAAM,YAAY,OAAO,KAAG,IAAI;6BAXtE,MAAM,OACT,MAAM,kBACK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,kBACtB,MAAM,YACZ,MAAM,KACf,IAAI;4BApCwB,MAAM,SAAS,MAAM,cAAc,MAAM,SAAS,OAAO,KAAG,IAAI;0BAYlE,MAAM,SAAS,KAAK,KAAG,IAAI;6BANxB,MAAM,KAAG,IAAI;mBAkBvB,MAAM,WAAW,MAAM,aAAa,MAAM,KAAG,IAAI;qCAN/B,MAAM,YAAY,MAAM,EAAE,eAAe,MAAM,KAAG,IAAI;EAiE5F,CAAC;AAEH,eAAe,iBAAiB,CAAC"}
@@ -1,26 +1,26 @@
1
1
  let cachedModule;
2
2
  let loadPromise = null;
3
- const importSystemDebugger = async () => {
3
+ const importSystemTrace = async () => {
4
4
  try {
5
- return (await import('@zintrust/system-debugger'));
5
+ return (await import('../../packages/trace/src/index.js'));
6
6
  }
7
7
  catch {
8
8
  return null;
9
9
  }
10
10
  };
11
- const loadSystemDebugger = async () => {
11
+ const loadSystemTrace = async () => {
12
12
  if (cachedModule !== undefined)
13
13
  return cachedModule;
14
14
  if (loadPromise !== null)
15
15
  return loadPromise;
16
- loadPromise = importSystemDebugger().then((loaded) => {
16
+ loadPromise = importSystemTrace().then((loaded) => {
17
17
  cachedModule = loaded;
18
18
  loadPromise = null;
19
19
  return loaded;
20
20
  });
21
21
  return loadPromise;
22
22
  };
23
- const withSystemDebugger = (run) => {
23
+ const withSystemTrace = (run) => {
24
24
  const invoke = (module) => {
25
25
  if (module === null || module === undefined)
26
26
  return;
@@ -28,72 +28,72 @@ const withSystemDebugger = (run) => {
28
28
  run(module);
29
29
  }
30
30
  catch {
31
- // Ignore optional debugger failures so core runtime behavior is unaffected.
31
+ // Ignore optional trace failures so core runtime behavior is unaffected.
32
32
  }
33
33
  };
34
34
  if (cachedModule !== undefined) {
35
35
  invoke(cachedModule);
36
36
  return;
37
37
  }
38
- void loadSystemDebugger()
38
+ void loadSystemTrace()
39
39
  .then(invoke)
40
40
  .catch(() => undefined);
41
41
  };
42
42
  const emitCache = (operation, key, duration, hit) => {
43
- withSystemDebugger((module) => {
43
+ withSystemTrace((module) => {
44
44
  module.CacheWatcher?.emit(operation, key, duration, hit);
45
45
  });
46
46
  };
47
47
  const emitJobDispatch = (name, queue, connection, data) => {
48
- withSystemDebugger((module) => {
48
+ withSystemTrace((module) => {
49
49
  module.JobWatcher?.onDispatch(name, queue, connection, data);
50
50
  });
51
51
  };
52
52
  const emitJobProcessed = (name) => {
53
- withSystemDebugger((module) => {
53
+ withSystemTrace((module) => {
54
54
  module.JobWatcher?.onProcessed(name);
55
55
  });
56
56
  };
57
57
  const emitJobFailed = (name, error) => {
58
- withSystemDebugger((module) => {
58
+ withSystemTrace((module) => {
59
59
  module.JobWatcher?.onFailed(name, error);
60
60
  });
61
61
  };
62
62
  const emitNotification = (notification, channels, notifiable) => {
63
- withSystemDebugger((module) => {
63
+ withSystemTrace((module) => {
64
64
  module.NotificationWatcher?.emit(notification, channels, notifiable);
65
65
  });
66
66
  };
67
67
  const emitMail = (to, subject, template) => {
68
- withSystemDebugger((module) => {
68
+ withSystemTrace((module) => {
69
69
  module.MailWatcher?.emit(to, subject, template);
70
70
  });
71
71
  };
72
72
  const emitHttpClient = (method, url, requestHeaders, responseStatus, duration) => {
73
- withSystemDebugger((module) => {
73
+ withSystemTrace((module) => {
74
74
  module.HttpClientWatcher?.emit(method, url, requestHeaders, responseStatus, duration);
75
75
  });
76
76
  };
77
77
  const emitEvent = (name, listenerCount, payload) => {
78
- withSystemDebugger((module) => {
78
+ withSystemTrace((module) => {
79
79
  module.EventWatcher?.emit(name, listenerCount, payload);
80
80
  });
81
81
  };
82
82
  const emitAuth = (event, userId) => {
83
- withSystemDebugger((module) => {
83
+ withSystemTrace((module) => {
84
84
  module.AuthWatcher?.emit(event, userId);
85
85
  });
86
86
  };
87
87
  const emitCommand = (name, args, exitCode, duration, output) => {
88
- withSystemDebugger((module) => {
88
+ withSystemTrace((module) => {
89
89
  module.CommandWatcher?.emit(name, args, exitCode, duration, output);
90
90
  });
91
91
  };
92
92
  const preload = async () => {
93
- const loaded = await loadSystemDebugger();
93
+ const loaded = await loadSystemTrace();
94
94
  return loaded !== null;
95
95
  };
96
- export const SystemDebuggerBridge = Object.freeze({
96
+ export const SystemTraceBridge = Object.freeze({
97
97
  preload,
98
98
  emitAuth,
99
99
  emitCache,
@@ -106,4 +106,4 @@ export const SystemDebuggerBridge = Object.freeze({
106
106
  emitMail,
107
107
  emitNotification,
108
108
  });
109
- export default SystemDebuggerBridge;
109
+ export default SystemTraceBridge;
@@ -6,8 +6,8 @@
6
6
  * optional adapters/drivers into core registries.
7
7
  *
8
8
  */
9
- import * as SystemDebuggerRuntime from './runtime/plugins/system-debugger-runtime.js';
10
- globalThis.__zintrust_system_debugger_plugin_requested__ = true;
11
- globalThis.__zintrust_system_debugger_runtime__ = SystemDebuggerRuntime;
9
+ import * as TraceRuntime from './runtime/plugins/trace-runtime.js';
10
+ globalThis.__zintrust_trace_plugin_requested__ = true;
11
+ globalThis.__zintrust_trace_runtime__ = TraceRuntime;
12
12
  export const __zintrustGeneratedPluginStub = 'zintrust.plugins.ts';
13
13
  export default {};
@@ -3,8 +3,8 @@
3
3
  * This file is created by scripts/ensure-worker-plugins.mjs when missing.
4
4
  * It allows optional runtime plugin imports to resolve in CI/scaffolded setups.
5
5
  */
6
- import * as SystemDebuggerRuntime from './runtime/plugins/system-debugger-runtime.js';
7
- globalThis.__zintrust_system_debugger_plugin_requested__ = true;
8
- globalThis.__zintrust_system_debugger_runtime__ = SystemDebuggerRuntime;
6
+ import * as TraceRuntime from './runtime/plugins/trace-runtime.js';
7
+ globalThis.__zintrust_trace_plugin_requested__ = true;
8
+ globalThis.__zintrust_trace_runtime__ = TraceRuntime;
9
9
  export const __zintrustGeneratedPluginStub = 'zintrust.plugins.wg.ts';
10
10
  export default {};
@@ -1,18 +0,0 @@
1
- export { DebuggerCommands } from '../commands/DebuggerCommands';
2
- export declare const DebuggerPruneCommand: Readonly<{
3
- name: string;
4
- getCommand: () => import("commander").Command;
5
- }>;
6
- export declare const DebuggerClearCommand: Readonly<{
7
- name: string;
8
- getCommand: () => import("commander").Command;
9
- }>;
10
- export declare const DebuggerStatusCommand: Readonly<{
11
- name: string;
12
- getCommand: () => import("commander").Command;
13
- }>;
14
- export declare const DebuggerMigrateCommand: Readonly<{
15
- name: string;
16
- getCommand: () => import("commander").Command;
17
- }>;
18
- //# sourceMappingURL=DebuggerCommand.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DebuggerCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/DebuggerCommand.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,eAAO,MAAM,oBAAoB;;;EAAiD,CAAC;AAEnF,eAAO,MAAM,oBAAoB;;;EAAiD,CAAC;AAEnF,eAAO,MAAM,qBAAqB;;;EAAkD,CAAC;AAErF,eAAO,MAAM,sBAAsB;;;EAAmD,CAAC"}
@@ -1,6 +0,0 @@
1
- import { DebuggerCommands } from '../commands/DebuggerCommands.js';
2
- export { DebuggerCommands } from '../commands/DebuggerCommands.js';
3
- export const DebuggerPruneCommand = DebuggerCommands.createDebuggerPruneProvider();
4
- export const DebuggerClearCommand = DebuggerCommands.createDebuggerClearProvider();
5
- export const DebuggerStatusCommand = DebuggerCommands.createDebuggerStatusProvider();
6
- export const DebuggerMigrateCommand = DebuggerCommands.createDebuggerMigrateProvider();
@@ -1,25 +0,0 @@
1
- import type { IBaseCommand } from '../BaseCommand';
2
- import type { Command } from 'commander';
3
- export declare const DebuggerCommands: Readonly<{
4
- createDebuggerPruneCommand: () => IBaseCommand;
5
- createDebuggerClearCommand: () => IBaseCommand;
6
- createDebuggerStatusCommand: () => IBaseCommand;
7
- createDebuggerMigrateCommand: () => IBaseCommand;
8
- createDebuggerPruneProvider: () => Readonly<{
9
- name: string;
10
- getCommand: () => Command;
11
- }>;
12
- createDebuggerClearProvider: () => Readonly<{
13
- name: string;
14
- getCommand: () => Command;
15
- }>;
16
- createDebuggerStatusProvider: () => Readonly<{
17
- name: string;
18
- getCommand: () => Command;
19
- }>;
20
- createDebuggerMigrateProvider: () => Readonly<{
21
- name: string;
22
- getCommand: () => Command;
23
- }>;
24
- }>;
25
- //# sourceMappingURL=DebuggerCommands.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DebuggerCommands.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/DebuggerCommands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAsBrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0oBzC,eAAO,MAAM,gBAAgB;sCACK,YAAY;sCAQZ,YAAY;uCAaX,YAAY;wCAgBX,YAAY;;cA7C5B,MAAM;oBAAc,MAAM,OAAO;;;cAAjC,MAAM;oBAAc,MAAM,OAAO;;;cAAjC,MAAM;oBAAc,MAAM,OAAO;;;cAAjC,MAAM;oBAAc,MAAM,OAAO;;EAoEnD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SystemDebuggerBridge.d.ts","sourceRoot":"","sources":["../../../src/debugger/SystemDebuggerBridge.ts"],"names":[],"mappings":"AA6KA,eAAO,MAAM,oBAAoB;mBALP,OAAO,CAAC,OAAO,CAAC;sBAlBjB,OAAO,GAAG,QAAQ,GAAG,QAAQ,WAAW,MAAM,KAAG,IAAI;2BA1DjE,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,OAChD,MAAM,YACD,MAAM,QACV,OAAO,KACZ,IAAI;wBA6DC,MAAM,QACN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YACnB,MAAM,YACN,MAAM,WACP,MAAM,KACd,IAAI;sBAlBkB,MAAM,iBAAiB,MAAM,YAAY,OAAO,KAAG,IAAI;6BAXtE,MAAM,OACT,MAAM,kBACK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,kBACtB,MAAM,YACZ,MAAM,KACf,IAAI;4BApCwB,MAAM,SAAS,MAAM,cAAc,MAAM,SAAS,OAAO,KAAG,IAAI;0BAYlE,MAAM,SAAS,KAAK,KAAG,IAAI;6BANxB,MAAM,KAAG,IAAI;mBAkBvB,MAAM,WAAW,MAAM,aAAa,MAAM,KAAG,IAAI;qCAN/B,MAAM,YAAY,MAAM,EAAE,eAAe,MAAM,KAAG,IAAI;EAiE5F,CAAC;AAEH,eAAe,oBAAoB,CAAC"}
@@ -1,19 +0,0 @@
1
- type DebuggerConfigApi = {
2
- merge(overrides?: unknown): {
3
- enabled?: boolean;
4
- connection?: string;
5
- };
6
- };
7
- type DebuggerStorageApi = {
8
- resolveStorage(db: unknown): unknown;
9
- };
10
- export declare const isAvailable: () => boolean;
11
- export declare const DebuggerConfig: DebuggerConfigApi;
12
- export declare const DebuggerStorage: DebuggerStorageApi;
13
- export declare const registerDebuggerRoutes: (router: unknown, storage: unknown, options?: {
14
- basePath?: string;
15
- middleware?: ReadonlyArray<string>;
16
- }) => void;
17
- export declare const ensureSystemDebuggerRegistered: () => Promise<void>;
18
- export {};
19
- //# sourceMappingURL=system-debugger-runtime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"system-debugger-runtime.d.ts","sourceRoot":"","sources":["../../../../src/runtime/plugins/system-debugger-runtime.ts"],"names":[],"mappings":"AAAA,KAAK,iBAAiB,GAAG;IACvB,KAAK,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACxE,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,cAAc,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAAC;CACtC,CAAC;AA+BF,eAAO,MAAM,WAAW,QAAO,OAA6C,CAAC;AAE7E,eAAO,MAAM,cAAc,EAAE,iBACmC,CAAC;AAEjE,eAAO,MAAM,eAAe,EAAE,kBACoC,CAAC;AAEnE,eAAO,MAAM,sBAAsB,WAjCvB,OAAO,WACN,OAAO,YACN;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CAAE,KAChE,IA+ByE,CAAC;AAEjF,eAAO,MAAM,8BAA8B,QAAa,OAAO,CAAC,IAAI,CAGnE,CAAC"}
@@ -1,19 +0,0 @@
1
- const fallbackDebuggerConfig = Object.freeze({
2
- merge: () => ({ enabled: false }),
3
- });
4
- const fallbackDebuggerStorage = Object.freeze({
5
- resolveStorage: (_db) => undefined,
6
- });
7
- const fallbackRegisterDebuggerRoutes = (_router, _storage, _options) => undefined;
8
- const systemDebuggerModule = await import('@zintrust/system-debugger')
9
- .then((module) => module)
10
- .catch(() => undefined);
11
- export const isAvailable = () => systemDebuggerModule !== undefined;
12
- export const DebuggerConfig = systemDebuggerModule?.DebuggerConfig ?? fallbackDebuggerConfig;
13
- export const DebuggerStorage = systemDebuggerModule?.DebuggerStorage ?? fallbackDebuggerStorage;
14
- export const registerDebuggerRoutes = systemDebuggerModule?.registerDebuggerRoutes ?? fallbackRegisterDebuggerRoutes;
15
- export const ensureSystemDebuggerRegistered = async () => {
16
- if (!isAvailable())
17
- return;
18
- await import('../../../packages/system-debugger/src/register.js').catch(() => undefined);
19
- };
@@ -1,2 +0,0 @@
1
- export type {};
2
- //# sourceMappingURL=system-debugger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"system-debugger.d.ts","sourceRoot":"","sources":["../../../../src/runtime/plugins/system-debugger.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,CAAC"}