@zintrust/core 0.4.64 → 0.4.65
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/cli/commands/MigrateCommand.js +1 -1
- package/src/index.js +3 -3
- package/src/tools/broadcast/Broadcast.d.ts.map +1 -1
- package/src/tools/broadcast/Broadcast.js +36 -4
- package/src/zintrust.plugins.d.ts +3 -7
- package/src/zintrust.plugins.d.ts.map +1 -1
- package/src/zintrust.plugins.js +3 -9
- package/src/zintrust.plugins.wg.d.ts +0 -1
- package/src/zintrust.plugins.wg.d.ts.map +1 -1
- package/src/zintrust.plugins.wg.js +0 -3
- package/src/zintrust.comon.d.ts +0 -11
- package/src/zintrust.comon.d.ts.map +0 -1
- package/src/zintrust.comon.js +0 -17
package/package.json
CHANGED
|
@@ -215,7 +215,7 @@ const warnIfAdapterMissing = (cmd, conn) => {
|
|
|
215
215
|
if (conn.driver === 'mysql' && DatabaseAdapterRegistry.get('mysql') === undefined) {
|
|
216
216
|
cmd.warn('MySQL adapter is not installed/registered; migrations may not hit a real MySQL DB.');
|
|
217
217
|
cmd.warn('Install via `zin plugin install adapter:mysql` (or `zin add db:mysql`).');
|
|
218
|
-
cmd.debug('[debug] Expected a side-effect import in src/zintrust.plugins.ts like: import "
|
|
218
|
+
cmd.debug('[debug] Expected a side-effect import in src/zintrust.plugins.ts like: import "@zintrust/db-mysql/register";');
|
|
219
219
|
}
|
|
220
220
|
if (conn.driver === 'postgresql' && DatabaseAdapterRegistry.get('postgresql') === undefined) {
|
|
221
221
|
cmd.warn('PostgreSQL adapter is not installed/registered; migrations may not hit a real PostgreSQL DB.');
|
package/src/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @zintrust/core v0.4.
|
|
2
|
+
* @zintrust/core v0.4.65
|
|
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-
|
|
8
|
+
* Built: 2026-04-05T16:19:42.578Z
|
|
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-
|
|
24
|
+
export const ZINTRUST_BUILD_DATE = '2026-04-05T16:19:42.544Z'; // 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';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Broadcast.d.ts","sourceRoot":"","sources":["../../../../src/tools/broadcast/Broadcast.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,KAAK,WAAW,GAAG,QAAQ,CAAC;IAC1B,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1E,OAAO,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAC;CAC5E,CAAC,CAAC;AAEH,KAAK,qBAAqB,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,CAAC;AAC9E,KAAK,qBAAqB,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAC1D,KAAK,kBAAkB,GAAG,eAAe,GAAG,QAAQ,GAAG,QAAQ,CAAC;
|
|
1
|
+
{"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CAAC;IAC5C,EAAE,EAAE,IAAI,CAAC;IACT,SAAS,EAAE,kBAAkB,CAAC;IAC9B,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,0BAA0B,CAAC,QAAQ,CAAC,CAAC;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACpD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CAC9B,CAAC,CAAC;AA8jBH,eAAO,MAAM,SAAS;mBACC,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;kBAIxD,MAAM,SAAS,MAAM,QAAQ,OAAO;0BAU5B,MAAM,SAAS,MAAM,QAAQ,OAAO;wBAKvD,qBAAqB,YACnB;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;4BAO1C,MAAM,SACR,MAAM,QACP,OAAO,YACJ;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;qBAKpC,MAAM;8BAES,qBAAqB;kCAEjB,MAAM,SAAS,MAAM,QAAQ,OAAO;;uBAKrD,MAAM,GAAG,WAAW;EAmBvC,CAAC;AAEH,eAAe,SAAS,CAAC"}
|
|
@@ -7,6 +7,12 @@ import broadcastConfig from '../../config/broadcast.js';
|
|
|
7
7
|
import { Env } from '../../config/env.js';
|
|
8
8
|
import { Logger } from '../../config/logger.js';
|
|
9
9
|
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
10
|
+
const BROADCAST_CHANNEL_SCOPES = new Set([
|
|
11
|
+
'public',
|
|
12
|
+
'private',
|
|
13
|
+
'presence',
|
|
14
|
+
'persistent',
|
|
15
|
+
]);
|
|
10
16
|
const INTERNAL_SOCKET_SECRET_HEADER = 'x-zintrust-socket-secret';
|
|
11
17
|
const pickFirstNonEmpty = (...values) => {
|
|
12
18
|
for (const value of values) {
|
|
@@ -21,10 +27,7 @@ const normalizeChannelScope = (value) => {
|
|
|
21
27
|
return undefined;
|
|
22
28
|
}
|
|
23
29
|
const normalized = value.trim().toLowerCase();
|
|
24
|
-
if (normalized
|
|
25
|
-
normalized === 'private' ||
|
|
26
|
-
normalized === 'presence' ||
|
|
27
|
-
normalized === 'persistent') {
|
|
30
|
+
if (BROADCAST_CHANNEL_SCOPES.has(normalized)) {
|
|
28
31
|
return normalized;
|
|
29
32
|
}
|
|
30
33
|
return undefined;
|
|
@@ -292,6 +295,29 @@ const normalizePublishInput = (input) => {
|
|
|
292
295
|
...(input.user === undefined ? {} : { user: input.user }),
|
|
293
296
|
};
|
|
294
297
|
};
|
|
298
|
+
/**
|
|
299
|
+
* Error codes from publishSocketEventFromServer that represent policy/auth failures.
|
|
300
|
+
* These must not be swallowed in auto delivery mode — the socket publish policy must
|
|
301
|
+
* be respected even when a driver fallback is available.
|
|
302
|
+
*/
|
|
303
|
+
const NON_TRANSIENT_SOCKET_ERROR_CODES = new Set([
|
|
304
|
+
'FORBIDDEN',
|
|
305
|
+
'UNAUTHORIZED',
|
|
306
|
+
'VALIDATION_ERROR',
|
|
307
|
+
'SECURITY_ERROR',
|
|
308
|
+
'SANITIZER_ERROR',
|
|
309
|
+
]);
|
|
310
|
+
/**
|
|
311
|
+
* Returns true for authorization/validation/policy errors from the socket module.
|
|
312
|
+
* Returns false for "socket unavailable" errors (module missing, disabled, connection
|
|
313
|
+
* failure, config) which are safe to fall back from.
|
|
314
|
+
*/
|
|
315
|
+
const isNonTransientSocketError = (error) => {
|
|
316
|
+
if (!(error instanceof Error))
|
|
317
|
+
return false;
|
|
318
|
+
const code = error.code;
|
|
319
|
+
return typeof code === 'string' && NON_TRANSIENT_SOCKET_ERROR_CODES.has(code);
|
|
320
|
+
};
|
|
295
321
|
const tryPublishViaSocket = async (input) => {
|
|
296
322
|
try {
|
|
297
323
|
const socketModule = (await import('@zintrust/socket'));
|
|
@@ -315,6 +341,12 @@ const tryPublishViaSocket = async (input) => {
|
|
|
315
341
|
};
|
|
316
342
|
}
|
|
317
343
|
catch (error) {
|
|
344
|
+
// For authorization/validation/policy errors, rethrow even in auto delivery mode
|
|
345
|
+
// to prevent bypassing socket publish policy via driver fallback.
|
|
346
|
+
// Only allow fallback for "socket unavailable" cases (module missing, disabled, connection issues).
|
|
347
|
+
if (isNonTransientSocketError(error)) {
|
|
348
|
+
throw error;
|
|
349
|
+
}
|
|
318
350
|
return { result: null, error };
|
|
319
351
|
}
|
|
320
352
|
};
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* side-effect imports (e.g. `@zintrust/db-sqlite/register`) that register
|
|
6
|
-
* optional adapters/drivers into core registries.
|
|
7
|
-
*
|
|
2
|
+
* Auto-generated fallback module.
|
|
3
|
+
* This file is created by scripts/ensure-worker-plugins.mjs when missing.
|
|
4
|
+
* It allows optional runtime plugin imports to resolve in CI/scaffolded setups.
|
|
8
5
|
*/
|
|
9
|
-
export type {};
|
|
10
6
|
export declare const __zintrustGeneratedPluginStub = "zintrust.plugins.ts";
|
|
11
7
|
declare const _default: {};
|
|
12
8
|
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;;;;GAIG;AAEH,eAAO,MAAM,6BAA6B,wBAAwB,CAAC;;AACnE,wBAAkB"}
|
package/src/zintrust.plugins.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* side-effect imports (e.g. `@zintrust/db-sqlite/register`) that register
|
|
6
|
-
* optional adapters/drivers into core registries.
|
|
7
|
-
*
|
|
2
|
+
* Auto-generated fallback module.
|
|
3
|
+
* This file is created by scripts/ensure-worker-plugins.mjs when missing.
|
|
4
|
+
* It allows optional runtime plugin imports to resolve in CI/scaffolded setups.
|
|
8
5
|
*/
|
|
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;
|
|
12
6
|
export const __zintrustGeneratedPluginStub = 'zintrust.plugins.ts';
|
|
13
7
|
export default {};
|
|
@@ -3,7 +3,6 @@
|
|
|
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 {};
|
|
7
6
|
export declare const __zintrustGeneratedPluginStub = "zintrust.plugins.wg.ts";
|
|
8
7
|
declare const _default: {};
|
|
9
8
|
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;AAEH,eAAO,MAAM,6BAA6B,2BAA2B,CAAC;;AACtE,wBAAkB"}
|
|
@@ -3,8 +3,5 @@
|
|
|
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;
|
|
9
6
|
export const __zintrustGeneratedPluginStub = 'zintrust.plugins.wg.ts';
|
|
10
7
|
export default {};
|
package/src/zintrust.comon.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/src/zintrust.comon.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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';
|