@zintrust/core 0.4.75 → 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.
- package/package.json +1 -1
- package/src/boot/registry/runtime.d.ts.map +1 -1
- package/src/boot/registry/runtime.js +26 -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} +80 -80
- 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/events/EventDispatcher.js +3 -3
- package/src/index.d.ts +1 -1
- package/src/index.d.ts.map +1 -1
- package/src/index.js +4 -4
- package/src/runtime/plugins/trace-runtime.d.ts +19 -0
- package/src/runtime/plugins/trace-runtime.d.ts.map +1 -0
- package/src/runtime/plugins/trace-runtime.js +19 -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/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.js +2 -2
- 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
|
@@ -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 @@
|
|
|
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/
|
|
10
|
+
const importedPackagePlugin = await tryImport('@zintrust/trace/plugin');
|
|
11
11
|
if (!importedPackagePlugin) {
|
|
12
|
-
await import('../../../packages/
|
|
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 {
|
|
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
|
-
|
|
47
|
+
SystemTraceBridge.emitAuth('logout', subject);
|
|
48
48
|
};
|
|
49
49
|
const logoutAll = async (sub) => {
|
|
50
50
|
await JwtSessions.logoutAll(sub);
|
|
51
|
-
|
|
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
|
-
|
|
78
|
+
SystemTraceBridge.emitAuth('login', typeof payload.sub === 'string' ? payload.sub : undefined);
|
|
79
79
|
return token;
|
|
80
80
|
};
|
|
81
81
|
/**
|
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:
|
package/src/tools/queue/Queue.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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('
|
|
5
|
+
return (await import('../../packages/trace/src/index.js'));
|
|
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_trace_plugin_requested__ = true;
|
|
11
|
+
globalThis.__zintrust_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_trace_plugin_requested__ = true;
|
|
8
|
+
globalThis.__zintrust_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"}
|