@zintrust/core 0.4.75 → 0.4.77
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/bin/zintrust-main.d.ts +12 -0
- package/bin/zintrust-main.d.ts.map +1 -1
- package/bin/zintrust-main.js +149 -54
- package/package.json +1 -1
- package/src/boot/registry/runtime.d.ts.map +1 -1
- package/src/boot/registry/runtime.js +60 -25
- package/src/cache/Cache.d.ts.map +1 -1
- package/src/cache/Cache.js +11 -11
- package/src/cli/BaseCommand.js +3 -3
- package/src/cli/OptionalCliExtensions.js +8 -8
- package/src/cli/commands/MigrateCommand.js +1 -1
- package/src/cli/commands/TraceCommand.d.ts +18 -0
- package/src/cli/commands/TraceCommand.d.ts.map +1 -0
- package/src/cli/commands/TraceCommand.js +6 -0
- package/src/cli/commands/TraceCommands.d.ts +25 -0
- package/src/cli/commands/TraceCommands.d.ts.map +1 -0
- package/src/cli/commands/{DebuggerCommands.js → TraceCommands.js} +112 -120
- package/src/cli/commands/index.d.ts +1 -1
- package/src/cli/commands/index.d.ts.map +1 -1
- package/src/cli/commands/index.js +1 -1
- package/src/cli/index.d.ts +2 -2
- package/src/cli/index.d.ts.map +1 -1
- package/src/cli/index.js +2 -2
- package/src/cli.d.ts +1 -1
- package/src/cli.d.ts.map +1 -1
- package/src/cli.js +1 -1
- package/src/config/logging/KvLogger.d.ts.map +1 -1
- package/src/config/logging/KvLogger.js +18 -6
- package/src/events/EventDispatcher.js +3 -3
- package/src/functions/cloudflare.d.ts.map +1 -1
- package/src/functions/cloudflare.js +8 -0
- package/src/http/RequestContext.d.ts.map +1 -1
- package/src/http/RequestContext.js +5 -6
- package/src/index.d.ts +2 -1
- package/src/index.d.ts.map +1 -1
- package/src/index.js +5 -4
- package/src/middleware/ErrorHandlerMiddleware.d.ts.map +1 -1
- package/src/middleware/ErrorHandlerMiddleware.js +2 -0
- package/src/orm/adapters/SQLiteAdapter.d.ts.map +1 -1
- package/src/orm/adapters/SQLiteAdapter.js +2 -1
- package/src/orm/migrations/MigrationStore.d.ts.map +1 -1
- package/src/orm/migrations/MigrationStore.js +352 -16
- package/src/runtime/StartupConfigFileRegistry.d.ts +2 -1
- package/src/runtime/StartupConfigFileRegistry.d.ts.map +1 -1
- package/src/runtime/StartupConfigFileRegistry.js +1 -0
- package/src/runtime/plugins/trace-runtime.d.ts +24 -0
- package/src/runtime/plugins/trace-runtime.d.ts.map +1 -0
- package/src/runtime/plugins/trace-runtime.js +63 -0
- package/src/runtime/plugins/trace.d.ts +2 -0
- package/src/runtime/plugins/trace.d.ts.map +1 -0
- package/src/runtime/plugins/{system-debugger.js → trace.js} +2 -2
- package/src/security/JwtManager.js +4 -4
- package/src/templates/project/basic/tsconfig.json.tpl +11 -12
- package/src/tools/http/Http.js +2 -2
- package/src/tools/mail/index.js +2 -2
- package/src/tools/notification/Service.js +6 -6
- package/src/tools/queue/Queue.d.ts +1 -2
- package/src/tools/queue/Queue.d.ts.map +1 -1
- package/src/tools/queue/Queue.js +3 -4
- package/src/{debugger/SystemDebuggerBridge.d.ts → trace/SystemTraceBridge.d.ts} +3 -3
- package/src/trace/SystemTraceBridge.d.ts.map +1 -0
- package/src/{debugger/SystemDebuggerBridge.js → trace/SystemTraceBridge.js} +20 -20
- package/src/zintrust.comon.d.ts +11 -0
- package/src/zintrust.comon.d.ts.map +1 -0
- package/src/zintrust.comon.js +17 -0
- package/src/zintrust.plugins.d.ts +7 -3
- package/src/zintrust.plugins.d.ts.map +1 -1
- package/src/zintrust.plugins.js +9 -3
- package/src/zintrust.plugins.wg.d.ts +1 -0
- package/src/zintrust.plugins.wg.d.ts.map +1 -1
- package/src/zintrust.plugins.wg.js +3 -0
- package/src/cli/commands/DebuggerCommand.d.ts +0 -18
- package/src/cli/commands/DebuggerCommand.d.ts.map +0 -1
- package/src/cli/commands/DebuggerCommand.js +0 -6
- package/src/cli/commands/DebuggerCommands.d.ts +0 -25
- package/src/cli/commands/DebuggerCommands.d.ts.map +0 -1
- package/src/debugger/SystemDebuggerBridge.d.ts.map +0 -1
- package/src/runtime/plugins/system-debugger-runtime.d.ts +0 -19
- package/src/runtime/plugins/system-debugger-runtime.d.ts.map +0 -1
- package/src/runtime/plugins/system-debugger-runtime.js +0 -19
- package/src/runtime/plugins/system-debugger.d.ts +0 -2
- package/src/runtime/plugins/system-debugger.d.ts.map +0 -1
package/src/tools/http/Http.js
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
59
|
+
SystemTraceBridge.emitHttpClient(state.method, state.url, { ...state.headers }, response.status, duration);
|
|
60
60
|
return { response, durationMs: duration };
|
|
61
61
|
}
|
|
62
62
|
catch (error) {
|
package/src/tools/mail/index.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
92
|
+
SystemTraceBridge.emitNotification(channelName, ['termii'], recipient);
|
|
93
93
|
return result;
|
|
94
94
|
}
|
|
95
95
|
default:
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { resolveDeduplicationLockKey } from './DeduplicationKey';
|
|
2
1
|
export type QueueMessage<T = unknown> = {
|
|
3
2
|
id: string;
|
|
4
3
|
payload: T;
|
|
@@ -53,7 +52,6 @@ export interface BullMQPayload {
|
|
|
53
52
|
* Uses singleton RedisKeys for consistent key management
|
|
54
53
|
*/
|
|
55
54
|
export declare const resolveLockPrefix: () => string;
|
|
56
|
-
export { resolveDeduplicationLockKey };
|
|
57
55
|
export declare const Queue: Readonly<{
|
|
58
56
|
register(name: string, driver: IQueueDriver): void;
|
|
59
57
|
reset(): void;
|
|
@@ -65,4 +63,5 @@ export declare const Queue: Readonly<{
|
|
|
65
63
|
drain(queue: string, driverName?: string): Promise<void>;
|
|
66
64
|
}>;
|
|
67
65
|
export default Queue;
|
|
66
|
+
export { resolveDeduplicationLockKey } from './DeduplicationKey';
|
|
68
67
|
//# sourceMappingURL=Queue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Queue.d.ts","sourceRoot":"","sources":["../../../../src/tools/queue/Queue.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Queue.d.ts","sourceRoot":"","sources":["../../../../src/tools/queue/Queue.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,OAAO,IAAI;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,CAAC,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAErF,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACjE,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAC1E,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAE5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE;QACR,IAAI,EAAE,OAAO,GAAG,aAAa,CAAC;QAC9B,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,IAAI,CAAC,EAAE,OAAO,CAAC;IAGf,aAAa,CAAC,EAAE;QACd,EAAE,EAAE,MAAM,CAAC;QACX,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC;KACvE,CAAC;IAGF,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAID;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,MAOpC,CAAC;AAwFF,eAAO,MAAM,KAAK;mBACD,MAAM,UAAU,YAAY;aAIlC,IAAI;eAIF,MAAM,GAAG,YAAY;mBASX,MAAM,WAAW,aAAa,eAAe,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YA0E5E,CAAC,mBACN,MAAM,eACA,MAAM,GAClB,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;eActB,MAAM,MAAM,MAAM,eAAe,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;kBAcpD,MAAM,eAAe,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;iBAc9C,MAAM,eAAe,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;EAa9D,CAAC;AAEH,eAAe,KAAK,CAAC;AAErB,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC"}
|
package/src/tools/queue/Queue.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
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';
|
|
7
|
-
import { resolveDeduplicationLockKey } from './DeduplicationKey.js';
|
|
8
7
|
import { JobStateTracker } from './JobStateTracker.js';
|
|
9
8
|
import { QueueTracing } from './QueueTracing.js';
|
|
10
9
|
import { RedisKeys } from '../redis/RedisKeyManager.js';
|
|
@@ -43,7 +42,6 @@ const resolveRequestedJobId = (payload) => {
|
|
|
43
42
|
const resolveRequestedUniqueId = (payload) => {
|
|
44
43
|
return normalizeRequestedId(payload?.uniqueId);
|
|
45
44
|
};
|
|
46
|
-
export { resolveDeduplicationLockKey };
|
|
47
45
|
const resolveMaxAttempts = (payload) => {
|
|
48
46
|
if (typeof payload?.attempts !== 'number' || !Number.isFinite(payload.attempts))
|
|
49
47
|
return undefined;
|
|
@@ -139,7 +137,7 @@ export const Queue = Object.freeze({
|
|
|
139
137
|
payload,
|
|
140
138
|
requestedUniqueId,
|
|
141
139
|
});
|
|
142
|
-
|
|
140
|
+
SystemTraceBridge.emitJobDispatch(queue, queue, resolvedDriver, payload);
|
|
143
141
|
return jobId;
|
|
144
142
|
}
|
|
145
143
|
catch (error) {
|
|
@@ -215,3 +213,4 @@ export const Queue = Object.freeze({
|
|
|
215
213
|
},
|
|
216
214
|
});
|
|
217
215
|
export default Queue;
|
|
216
|
+
export { resolveDeduplicationLockKey } from './DeduplicationKey.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
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
|
|
15
|
-
//# sourceMappingURL=
|
|
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
|
|
3
|
+
const importSystemTrace = async () => {
|
|
4
4
|
try {
|
|
5
|
-
return (await import('@zintrust/
|
|
5
|
+
return (await import('@zintrust/trace'));
|
|
6
6
|
}
|
|
7
7
|
catch {
|
|
8
8
|
return null;
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
-
const
|
|
11
|
+
const loadSystemTrace = async () => {
|
|
12
12
|
if (cachedModule !== undefined)
|
|
13
13
|
return cachedModule;
|
|
14
14
|
if (loadPromise !== null)
|
|
15
15
|
return loadPromise;
|
|
16
|
-
loadPromise =
|
|
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
|
|
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
|
|
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
|
|
38
|
+
void loadSystemTrace()
|
|
39
39
|
.then(invoke)
|
|
40
40
|
.catch(() => undefined);
|
|
41
41
|
};
|
|
42
42
|
const emitCache = (operation, key, duration, hit) => {
|
|
43
|
-
|
|
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
|
-
|
|
48
|
+
withSystemTrace((module) => {
|
|
49
49
|
module.JobWatcher?.onDispatch(name, queue, connection, data);
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
52
|
const emitJobProcessed = (name) => {
|
|
53
|
-
|
|
53
|
+
withSystemTrace((module) => {
|
|
54
54
|
module.JobWatcher?.onProcessed(name);
|
|
55
55
|
});
|
|
56
56
|
};
|
|
57
57
|
const emitJobFailed = (name, error) => {
|
|
58
|
-
|
|
58
|
+
withSystemTrace((module) => {
|
|
59
59
|
module.JobWatcher?.onFailed(name, error);
|
|
60
60
|
});
|
|
61
61
|
};
|
|
62
62
|
const emitNotification = (notification, channels, notifiable) => {
|
|
63
|
-
|
|
63
|
+
withSystemTrace((module) => {
|
|
64
64
|
module.NotificationWatcher?.emit(notification, channels, notifiable);
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
67
|
const emitMail = (to, subject, template) => {
|
|
68
|
-
|
|
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
|
-
|
|
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
|
-
|
|
78
|
+
withSystemTrace((module) => {
|
|
79
79
|
module.EventWatcher?.emit(name, listenerCount, payload);
|
|
80
80
|
});
|
|
81
81
|
};
|
|
82
82
|
const emitAuth = (event, userId) => {
|
|
83
|
-
|
|
83
|
+
withSystemTrace((module) => {
|
|
84
84
|
module.AuthWatcher?.emit(event, userId);
|
|
85
85
|
});
|
|
86
86
|
};
|
|
87
87
|
const emitCommand = (name, args, exitCode, duration, output) => {
|
|
88
|
-
|
|
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
|
|
93
|
+
const loaded = await loadSystemTrace();
|
|
94
94
|
return loaded !== null;
|
|
95
95
|
};
|
|
96
|
-
export const
|
|
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
|
|
109
|
+
export default SystemTraceBridge;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import '../packages/db-d1/src/register.js';
|
|
2
|
+
import '../packages/db-mysql/src/register.js';
|
|
3
|
+
import '../packages/db-postgres/src/register.js';
|
|
4
|
+
import '../packages/db-sqlite/src/register.js';
|
|
5
|
+
import '../packages/db-sqlserver/src/register.js';
|
|
6
|
+
import '../packages/mail-sendgrid/src/register.js';
|
|
7
|
+
import '../packages/mail-smtp/src/register.js';
|
|
8
|
+
import '@zintrust/queue-monitor';
|
|
9
|
+
import '../packages/queue-redis/src/register.js';
|
|
10
|
+
import '../packages/workers/src/register.js';
|
|
11
|
+
//# sourceMappingURL=zintrust.comon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zintrust.comon.d.ts","sourceRoot":"","sources":["../../src/zintrust.comon.ts"],"names":[],"mappings":"AAQA,OAAO,mCAAmC,CAAC;AAC3C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,yCAAyC,CAAC;AACjD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,0CAA0C,CAAC;AAClD,OAAO,2CAA2C,CAAC;AACnD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,wCAAwC,CAAC;AAChD,OAAO,yCAAyC,CAAC;AACjD,OAAO,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* eslint-disable no-restricted-imports */
|
|
2
|
+
// /**
|
|
3
|
+
// * ZinTrust comon plugin auto-imports
|
|
4
|
+
// *
|
|
5
|
+
// * This file is managed by `zin plugin install` and contains side-effect
|
|
6
|
+
// * imports that register optional adapters/drivers into core registries.
|
|
7
|
+
// */
|
|
8
|
+
import '../packages/db-d1/src/register.js';
|
|
9
|
+
import '../packages/db-mysql/src/register.js';
|
|
10
|
+
import '../packages/db-postgres/src/register.js';
|
|
11
|
+
import '../packages/db-sqlite/src/register.js';
|
|
12
|
+
import '../packages/db-sqlserver/src/register.js';
|
|
13
|
+
import '../packages/mail-sendgrid/src/register.js';
|
|
14
|
+
import '../packages/mail-smtp/src/register.js';
|
|
15
|
+
import '@zintrust/queue-monitor';
|
|
16
|
+
import '../packages/queue-redis/src/register.js';
|
|
17
|
+
import '../packages/workers/src/register.js';
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* ZinTrust plugin auto-imports
|
|
3
|
+
*
|
|
4
|
+
* In real projects, this file is managed by `zin plugin install` and contains
|
|
5
|
+
* side-effect imports (e.g. `@zintrust/db-sqlite/register`) that register
|
|
6
|
+
* optional adapters/drivers into core registries.
|
|
7
|
+
*
|
|
5
8
|
*/
|
|
9
|
+
export type {};
|
|
6
10
|
export declare const __zintrustGeneratedPluginStub = "zintrust.plugins.ts";
|
|
7
11
|
declare const _default: {};
|
|
8
12
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zintrust.plugins.d.ts","sourceRoot":"","sources":["../../src/zintrust.plugins.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"zintrust.plugins.d.ts","sourceRoot":"","sources":["../../src/zintrust.plugins.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,YAAY,EAAE,CAAC;AAgBf,eAAO,MAAM,6BAA6B,wBAAwB,CAAC;;AACnE,wBAAkB"}
|
package/src/zintrust.plugins.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* ZinTrust plugin auto-imports
|
|
3
|
+
*
|
|
4
|
+
* In real projects, this file is managed by `zin plugin install` and contains
|
|
5
|
+
* side-effect imports (e.g. `@zintrust/db-sqlite/register`) that register
|
|
6
|
+
* optional adapters/drivers into core registries.
|
|
7
|
+
*
|
|
5
8
|
*/
|
|
9
|
+
import * as TraceRuntime from './runtime/plugins/trace-runtime.js';
|
|
10
|
+
globalThis.__zintrust_system_trace_plugin_requested__ = true;
|
|
11
|
+
globalThis.__zintrust_system_trace_runtime__ = TraceRuntime;
|
|
6
12
|
export const __zintrustGeneratedPluginStub = 'zintrust.plugins.ts';
|
|
7
13
|
export default {};
|
|
@@ -3,6 +3,7 @@
|
|
|
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
|
+
export type {};
|
|
6
7
|
export declare const __zintrustGeneratedPluginStub = "zintrust.plugins.wg.ts";
|
|
7
8
|
declare const _default: {};
|
|
8
9
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zintrust.plugins.wg.d.ts","sourceRoot":"","sources":["../../src/zintrust.plugins.wg.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"zintrust.plugins.wg.d.ts","sourceRoot":"","sources":["../../src/zintrust.plugins.wg.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,YAAY,EAAE,CAAC;AAgBf,eAAO,MAAM,6BAA6B,2BAA2B,CAAC;;AACtE,wBAAkB"}
|
|
@@ -3,5 +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 TraceRuntime from './runtime/plugins/trace-runtime.js';
|
|
7
|
+
globalThis.__zintrust_system_trace_plugin_requested__ = true;
|
|
8
|
+
globalThis.__zintrust_system_trace_runtime__ = TraceRuntime;
|
|
6
9
|
export const __zintrustGeneratedPluginStub = 'zintrust.plugins.wg.ts';
|
|
7
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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"system-debugger.d.ts","sourceRoot":"","sources":["../../../../src/runtime/plugins/system-debugger.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,CAAC"}
|