@zintrust/core 0.1.18 → 0.1.19
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/README.md +6 -0
- package/package.json +10 -1
- package/public/index.html +1 -1
- package/routes/api.d.ts +7 -0
- package/routes/api.d.ts.map +1 -0
- package/routes/api.js +91 -0
- package/routes/broadcast.d.ts +9 -0
- package/routes/broadcast.d.ts.map +1 -0
- package/routes/broadcast.js +27 -0
- package/routes/health.d.ts +7 -0
- package/routes/health.d.ts.map +1 -0
- package/routes/health.js +127 -0
- package/routes/storage.d.ts +4 -0
- package/routes/storage.d.ts.map +1 -0
- package/routes/storage.js +35 -0
- package/src/boot/Application.js +1 -1
- package/src/boot/bootstrap.js +1 -1
- package/src/cli/CLI.d.ts.map +1 -1
- package/src/cli/CLI.js +2 -0
- package/src/cli/PromptHelper.d.ts.map +1 -1
- package/src/cli/PromptHelper.js +4 -3
- package/src/cli/commands/NewCommand.d.ts +1 -1
- package/src/cli/commands/NewCommand.d.ts.map +1 -1
- package/src/cli/commands/NewCommand.js +26 -9
- package/src/cli/commands/SimulateCommand.js +1 -1
- package/src/cli/commands/StartCommand.d.ts.map +1 -1
- package/src/cli/commands/StartCommand.js +90 -3
- package/src/cli/commands/UpgradeCommand.d.ts +16 -0
- package/src/cli/commands/UpgradeCommand.d.ts.map +1 -0
- package/src/cli/commands/UpgradeCommand.js +107 -0
- package/src/cli/commands/runner/index.d.ts +3 -0
- package/src/cli/commands/runner/index.d.ts.map +1 -0
- package/src/cli/commands/runner/index.js +139 -0
- package/src/cli/env/EnvFileBackfill.d.ts +10 -0
- package/src/cli/env/EnvFileBackfill.d.ts.map +1 -0
- package/src/cli/env/EnvFileBackfill.js +64 -0
- package/src/cli/scaffolding/ProjectScaffolder.d.ts.map +1 -1
- package/src/cli/scaffolding/ProjectScaffolder.js +22 -59
- package/src/cli/utils/DistPackager.d.ts.map +1 -1
- package/src/cli/utils/DistPackager.js +8 -0
- package/src/config/broadcast.js +1 -1
- package/src/config/database.d.ts +6 -0
- package/src/config/database.d.ts.map +1 -1
- package/src/config/database.js +7 -1
- package/src/config/index.d.ts +7 -1
- package/src/config/index.d.ts.map +1 -1
- package/src/config/middleware.d.ts +2 -1
- package/src/config/middleware.d.ts.map +1 -1
- package/src/config/middleware.js +47 -11
- package/src/config/notification.js +1 -1
- package/src/config/storage.js +1 -1
- package/src/config/type.d.ts +7 -1
- package/src/config/type.d.ts.map +1 -1
- package/src/index.d.ts +1 -0
- package/src/index.d.ts.map +1 -1
- package/src/middleware/RateLimiter.d.ts.map +1 -1
- package/src/middleware/RateLimiter.js +26 -1
- package/src/node.d.ts +1 -1
- package/src/node.d.ts.map +1 -1
- package/src/node.js +4 -1
- package/src/orm/DatabaseRuntimeRegistration.d.ts.map +1 -1
- package/src/orm/DatabaseRuntimeRegistration.js +4 -0
- package/src/orm/QueryBuilder.d.ts.map +1 -1
- package/src/orm/QueryBuilder.js +7 -3
- package/src/orm/adapters/SQLiteAdapter.d.ts.map +1 -1
- package/src/orm/adapters/SQLiteAdapter.js +5 -1
- package/src/routes/api.d.ts +2 -0
- package/src/routes/api.d.ts.map +1 -0
- package/src/routes/api.js +1 -0
- package/src/routes/broadcast.d.ts +2 -0
- package/src/routes/broadcast.d.ts.map +1 -0
- package/src/routes/broadcast.js +1 -0
- package/src/routes/health.d.ts +2 -0
- package/src/routes/health.d.ts.map +1 -0
- package/src/routes/health.js +1 -0
- package/src/routes/storage.d.ts +2 -0
- package/src/routes/storage.d.ts.map +1 -0
- package/src/routes/storage.js +1 -0
- package/src/runtime/RuntimeAdapter.d.ts.map +1 -1
- package/src/runtime/RuntimeAdapter.js +20 -1
- package/src/runtime/adapters/DenoAdapter.js +2 -2
- package/src/scripts/TemplateImportsCheck.js +7 -7
- package/src/scripts/TemplateSync.js +6 -0
- package/src/start.d.ts +21 -0
- package/src/start.d.ts.map +1 -0
- package/src/start.js +60 -0
- package/src/templates/features/Queue.ts.tpl +2 -3
- package/src/templates/project/basic/.env.example.tpl +1 -1
- package/src/templates/project/basic/app/Controllers/UserController.ts.tpl +2 -4
- package/src/templates/project/basic/app/Middleware/ProfilerMiddleware.ts.tpl +1 -3
- package/src/templates/project/basic/app/Middleware/index.ts.tpl +3 -8
- package/src/templates/project/basic/app/Models/Post.ts.tpl +2 -3
- package/src/templates/project/basic/app/Models/User.ts.tpl +1 -1
- package/src/templates/project/basic/config/FileLogWriter.ts.tpl +1 -1
- package/src/templates/project/basic/config/SecretsManager.ts.tpl +2 -2
- package/src/templates/project/basic/config/StartupConfigValidator.ts.tpl +2 -2
- package/src/templates/project/basic/config/app.ts.tpl +3 -3
- package/src/templates/project/basic/config/broadcast.ts.tpl +4 -5
- package/src/templates/project/basic/config/cache.ts.tpl +2 -3
- package/src/templates/project/basic/config/cloudflare.ts.tpl +1 -1
- package/src/templates/project/basic/config/database.ts.tpl +9 -3
- package/src/templates/project/basic/config/env.ts.tpl +1 -1
- package/src/templates/project/basic/config/features.ts.tpl +2 -2
- package/src/templates/project/basic/config/index.ts.tpl +38 -20
- package/src/templates/project/basic/config/logger.ts.tpl +5 -381
- package/src/templates/project/basic/config/logging/HttpLogger.ts.tpl +1 -1
- package/src/templates/project/basic/config/logging/KvLogger.ts.tpl +2 -2
- package/src/templates/project/basic/config/logging/SlackLogger.ts.tpl +1 -1
- package/src/templates/project/basic/config/mail.ts.tpl +2 -3
- package/src/templates/project/basic/config/microservices.ts.tpl +1 -1
- package/src/templates/project/basic/config/middleware.ts.tpl +40 -13
- package/src/templates/project/basic/config/notification.ts.tpl +3 -4
- package/src/templates/project/basic/config/queue.ts.tpl +2 -2
- package/src/templates/project/basic/config/security.ts.tpl +3 -3
- package/src/templates/project/basic/config/startup.ts.tpl +1 -1
- package/src/templates/project/basic/config/storage.ts.tpl +3 -4
- package/src/templates/project/basic/config/type.ts.tpl +12 -2
- package/src/templates/project/basic/package.json.tpl +1 -1
- package/src/templates/project/basic/routes/api.ts.tpl +4 -4
- package/src/templates/project/basic/routes/health.ts.tpl +1 -6
- package/src/templates/project/basic/src/index.ts.tpl +7 -80
- package/src/templates/project/basic/tsconfig.json.tpl +0 -2
|
@@ -126,6 +126,12 @@ const rewriteStarterTemplateImports = (relPath, content) => {
|
|
|
126
126
|
// Starter templates should import framework APIs from the public package surface,
|
|
127
127
|
// not from internal path-alias modules that only exist in the framework repo.
|
|
128
128
|
return (content
|
|
129
|
+
// Starter templates should not rely on local config/env wrappers.
|
|
130
|
+
// Normalize Env imports to come from the public package surface.
|
|
131
|
+
.replaceAll("from '../env';", "from '@zintrust/core';")
|
|
132
|
+
.replaceAll('from "../env";', 'from "@zintrust/core";')
|
|
133
|
+
.replaceAll("from './env';", "from '@zintrust/core';")
|
|
134
|
+
.replaceAll('from "./env";', 'from "@zintrust/core";')
|
|
129
135
|
// Node-singletons are internal to this repo; starter templates should use Node built-ins.
|
|
130
136
|
.replaceAll("'@node-singletons/fs'", "'node:fs'")
|
|
131
137
|
.replaceAll('"@node-singletons/fs"', '"node:fs"')
|
package/src/start.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const isNodeMain: (importMetaUrl: string) => boolean;
|
|
2
|
+
/**
|
|
3
|
+
* Start the Node server (dev/prod) by delegating to the framework bootstrap.
|
|
4
|
+
*
|
|
5
|
+
* This uses a non-literal dynamic import so Worker bundlers don't pull Node-only modules.
|
|
6
|
+
*/
|
|
7
|
+
export declare const start: () => Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Cloudflare Workers entry (module worker style).
|
|
10
|
+
*/
|
|
11
|
+
export { default } from './functions/cloudflare';
|
|
12
|
+
export { default as cloudflareWorker } from './functions/cloudflare';
|
|
13
|
+
/**
|
|
14
|
+
* Deno fetch handler.
|
|
15
|
+
*/
|
|
16
|
+
export { default as deno } from './functions/deno';
|
|
17
|
+
/**
|
|
18
|
+
* AWS Lambda handler.
|
|
19
|
+
*/
|
|
20
|
+
export { handler } from './functions/lambda';
|
|
21
|
+
//# sourceMappingURL=start.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/start.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,UAAU,GAAI,eAAe,MAAM,KAAG,OAYlD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,KAAK,QAAa,OAAO,CAAC,IAAI,CAS1C,CAAC;AAEF;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEpE;;GAEG;AACH,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAElD;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
|
package/src/start.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const isNodeRuntime = () => {
|
|
2
|
+
// Avoid importing any `node:*` modules so this file remains Worker-safe.
|
|
3
|
+
// In Workers/Deno, `process` is typically undefined.
|
|
4
|
+
return (typeof process !== 'undefined' &&
|
|
5
|
+
typeof process === 'object' &&
|
|
6
|
+
process !== null &&
|
|
7
|
+
typeof process.versions === 'object');
|
|
8
|
+
};
|
|
9
|
+
const fileUrlToPathLike = (value) => {
|
|
10
|
+
if (!value.startsWith('file://'))
|
|
11
|
+
return value;
|
|
12
|
+
// Basic file URL decoding (sufficient for macOS/Linux paths).
|
|
13
|
+
try {
|
|
14
|
+
return decodeURIComponent(value.slice('file://'.length));
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return value.slice('file://'.length);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export const isNodeMain = (importMetaUrl) => {
|
|
21
|
+
if (!isNodeRuntime())
|
|
22
|
+
return false;
|
|
23
|
+
const argv1 = process.argv;
|
|
24
|
+
const scriptPath = Array.isArray(argv1) ? String(argv1[1] ?? '') : '';
|
|
25
|
+
if (scriptPath === '')
|
|
26
|
+
return false;
|
|
27
|
+
const here = fileUrlToPathLike(importMetaUrl);
|
|
28
|
+
if (scriptPath === here)
|
|
29
|
+
return true;
|
|
30
|
+
// Best-effort: handle relative argv paths and runner wrappers.
|
|
31
|
+
return scriptPath.endsWith(here);
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Start the Node server (dev/prod) by delegating to the framework bootstrap.
|
|
35
|
+
*
|
|
36
|
+
* This uses a non-literal dynamic import so Worker bundlers don't pull Node-only modules.
|
|
37
|
+
*/
|
|
38
|
+
export const start = async () => {
|
|
39
|
+
/* c8 ignore start */
|
|
40
|
+
if (!isNodeRuntime())
|
|
41
|
+
return;
|
|
42
|
+
// Compiled output places bootstrap at `dist/src/boot/bootstrap.js`.
|
|
43
|
+
// This file compiles to `dist/src/start.js`, so relative import is stable.
|
|
44
|
+
// In unit tests, importing bootstrap has heavy side effects (starts server + exits).
|
|
45
|
+
await import('./boot/' + 'bootstrap.js');
|
|
46
|
+
/* c8 ignore stop */
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Cloudflare Workers entry (module worker style).
|
|
50
|
+
*/
|
|
51
|
+
export { default } from './functions/cloudflare.js';
|
|
52
|
+
export { default as cloudflareWorker } from './functions/cloudflare.js';
|
|
53
|
+
/**
|
|
54
|
+
* Deno fetch handler.
|
|
55
|
+
*/
|
|
56
|
+
export { default as deno } from './functions/deno.js';
|
|
57
|
+
/**
|
|
58
|
+
* AWS Lambda handler.
|
|
59
|
+
*/
|
|
60
|
+
export { handler } from './functions/lambda.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// TEMPLATE_START
|
|
2
2
|
|
|
3
|
-
import { generateSecureJobId } from '@
|
|
4
|
-
import { Logger } from '@config/logger';
|
|
3
|
+
import { generateSecureJobId, Logger } from '@zintrust/core';
|
|
5
4
|
|
|
6
5
|
export interface QueueJob {
|
|
7
6
|
id: string;
|
|
@@ -44,4 +43,4 @@ export const Queue = Object.freeze({
|
|
|
44
43
|
},
|
|
45
44
|
});
|
|
46
45
|
|
|
47
|
-
// TEMPLATE_END
|
|
46
|
+
// TEMPLATE_END
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
* Example controller demonstrating request handling
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { User } from '
|
|
7
|
-
import { Logger } from '@zintrust/core';
|
|
8
|
-
import { IRequest } from '@zintrust/core';
|
|
9
|
-
import { IResponse } from '@zintrust/core';
|
|
6
|
+
import { User } from '@app/Models/User';
|
|
7
|
+
import { IRequest, Logger, IResponse } from '@zintrust/core';
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
10
|
* User Controller Interface
|
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
* Enables request profiling when ENABLE_PROFILER environment variable is set
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { Logger } from '@zintrust/core';
|
|
8
|
-
import { Middleware } from '@zintrust/core';
|
|
9
|
-
import { RequestProfiler } from '@zintrust/core';
|
|
7
|
+
import { Middleware, Logger , RequestProfiler} from '@zintrust/core';
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
10
|
* ProfilerMiddleware wraps request execution with performance profiling
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import type { CsrfTokenManagerType, ICsrfTokenManager } from '@zintrust/core';
|
|
2
|
-
import type { IJwtManager, JwtAlgorithm, JwtManagerType } from '@zintrust/core';
|
|
3
1
|
/**
|
|
4
2
|
* Example Middleware
|
|
5
3
|
* Common middleware patterns for Zintrust
|
|
6
4
|
*/
|
|
7
5
|
|
|
8
|
-
import {
|
|
9
|
-
import { IRequest } from '@zintrust/core';
|
|
10
|
-
|
|
11
|
-
import { XssProtection } from '@zintrust/core';
|
|
12
|
-
import type { ISchema, SchemaType } from '@zintrust/core';
|
|
13
|
-
import { Validator } from '@zintrust/core';
|
|
6
|
+
import type { IJwtManager, JwtAlgorithm, JwtManagerType, ISchema, SchemaType, CsrfTokenManagerType, ICsrfTokenManager } from '@zintrust/core';
|
|
7
|
+
import { Logger , Validator, IRequest, IResponse, XssProtection} from '@zintrust/core';
|
|
8
|
+
|
|
14
9
|
|
|
15
10
|
type JwtManagerInput = IJwtManager | JwtManagerType;
|
|
16
11
|
type CsrfManagerInput = ICsrfTokenManager | CsrfTokenManagerType;
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* Example Post Model
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { IModel, Model, ModelConfig } from '@zintrust/core';
|
|
5
|
+
import { User } from '@app/Models/User';
|
|
6
|
+
import { IModel, Model, ModelConfig, IRelationship } from '@zintrust/core';
|
|
8
7
|
|
|
9
8
|
export const PostConfig: ModelConfig = {
|
|
10
9
|
table: 'posts',
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* Supports: AWS Secrets Manager, Parameter Store, Cloudflare KV, Deno env
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { Logger } from '
|
|
7
|
+
import { Logger } from '@zintrust/core';
|
|
8
8
|
import type {
|
|
9
9
|
GetSecretOptions,
|
|
10
10
|
SecretConfig,
|
|
11
11
|
SecretsManagerInstance,
|
|
12
12
|
SetSecretOptions,
|
|
13
|
-
} from '
|
|
13
|
+
} from '@zintrust/core';
|
|
14
14
|
import { ErrorFactory } from '@zintrust/core';
|
|
15
15
|
|
|
16
16
|
let instance: SecretsManagerInstance | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { appConfig } from '
|
|
2
|
-
import type { StartupConfigValidationError, StartupConfigValidationResult } from '
|
|
1
|
+
import { appConfig } from '@zintrust/core';
|
|
2
|
+
import type { StartupConfigValidationError, StartupConfigValidationResult } from '@zintrust/core';
|
|
3
3
|
import { ErrorFactory } from '@zintrust/core';
|
|
4
4
|
|
|
5
5
|
const isSensitiveKey = (key: string): boolean => {
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Sealed namespace for immutability
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { Env } from '
|
|
8
|
-
import type { Environment, ProcessLike, StartMode } from '
|
|
7
|
+
import { Env } from '@zintrust/core';
|
|
8
|
+
import type { Environment, ProcessLike, StartMode } from '@zintrust/core';
|
|
9
9
|
|
|
10
10
|
const getProcessLike = (): ProcessLike | undefined => {
|
|
11
11
|
return typeof process === 'undefined' ? undefined : (process as unknown as ProcessLike);
|
|
@@ -99,7 +99,7 @@ const appConfigObj = {
|
|
|
99
99
|
port:
|
|
100
100
|
typeof (Env as unknown as { PORT?: unknown }).PORT === 'number'
|
|
101
101
|
? (Env as unknown as { PORT: number }).PORT
|
|
102
|
-
: readEnvInt('APP_PORT', 3000),
|
|
102
|
+
: readEnvInt('PORT', readEnvInt('APP_PORT', 3000)),
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
105
|
* Application host
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
* Driver selection must be dynamic (tests may mutate process.env).
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
8
|
+
import type{
|
|
10
9
|
BroadcastConfigInput,
|
|
11
10
|
BroadcastDrivers,
|
|
12
11
|
InMemoryBroadcastDriverConfig,
|
|
@@ -14,13 +13,13 @@ import {
|
|
|
14
13
|
PusherBroadcastDriverConfig,
|
|
15
14
|
RedisBroadcastDriverConfig,
|
|
16
15
|
RedisHttpsBroadcastDriverConfig,
|
|
17
|
-
} from '
|
|
18
|
-
import { ErrorFactory } from '@zintrust/core';
|
|
16
|
+
} from '@zintrust/core';
|
|
17
|
+
import { ErrorFactory,Env } from '@zintrust/core';
|
|
19
18
|
|
|
20
19
|
const normalizeDriverName = (value: string): string => value.trim().toLowerCase();
|
|
21
20
|
|
|
22
21
|
const hasOwn = (obj: Record<string, unknown>, key: string): boolean => {
|
|
23
|
-
return Object.
|
|
22
|
+
return Object.hasOwn(obj, key);
|
|
24
23
|
};
|
|
25
24
|
|
|
26
25
|
const getDefaultBroadcaster = (drivers: BroadcastDrivers): string => {
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
* Sealed namespace for immutability
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { ErrorFactory } from '@zintrust/core';
|
|
7
|
+
import type { CacheConfigInput, CacheDriverConfig } from '@zintrust/core';
|
|
8
|
+
import { ErrorFactory , Env} from '@zintrust/core';
|
|
10
9
|
|
|
11
10
|
const getCacheDriver = (config: CacheConfigInput, name?: string): CacheDriverConfig => {
|
|
12
11
|
const selected = String(name ?? config.default).trim();
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* This keeps runtime-specific globals out of adapters/drivers.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { KVNamespace, WorkersEnv } from '
|
|
8
|
+
import type { KVNamespace, WorkersEnv } from '@zintrust/core';
|
|
9
9
|
import type { DatabaseConfig, ID1Database } from '@zintrust/core';
|
|
10
10
|
|
|
11
11
|
const getWorkersEnv = (): WorkersEnv | null => {
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* Sealed namespace for immutability
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { Env } from '
|
|
8
|
-
import { DatabaseConfigShape, DatabaseConnectionConfig, DatabaseConnections } from '
|
|
7
|
+
import { Env } from '@zintrust/core';
|
|
8
|
+
import type { DatabaseConfigShape, DatabaseConnectionConfig, DatabaseConnections } from '@zintrust/core';
|
|
9
9
|
import { ErrorFactory } from '@zintrust/core';
|
|
10
10
|
|
|
11
11
|
const hasOwn = (obj: Record<string, unknown>, key: string): boolean => {
|
|
12
|
-
return Object.
|
|
12
|
+
return Object.hasOwn(obj, key);
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
const getDefaultConnection = (connections: DatabaseConnections): string => {
|
|
@@ -48,6 +48,12 @@ const connections = {
|
|
|
48
48
|
database: Env.DB_DATABASE,
|
|
49
49
|
migrations: 'database/migrations',
|
|
50
50
|
},
|
|
51
|
+
d1: {
|
|
52
|
+
driver: 'd1' as const,
|
|
53
|
+
},
|
|
54
|
+
'd1-remote': {
|
|
55
|
+
driver: 'd1-remote' as const,
|
|
56
|
+
},
|
|
51
57
|
postgresql: {
|
|
52
58
|
driver: 'postgresql' as const,
|
|
53
59
|
host: Env.DB_HOST,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Safe for both Node.js and serverless runtimes (Cloudflare Workers, Deno, Lambda)
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { ProcessLike } from '
|
|
9
|
+
import type { ProcessLike } from '@zintrust/core';
|
|
10
10
|
|
|
11
11
|
const getProcessLike = (): ProcessLike | undefined => {
|
|
12
12
|
return typeof process === 'undefined' ? undefined : (process as unknown as ProcessLike);
|
|
@@ -3,27 +3,45 @@
|
|
|
3
3
|
* Central export point for all configuration
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
import {
|
|
7
|
+
appConfig,
|
|
8
|
+
broadcastConfig,
|
|
9
|
+
cacheConfig,
|
|
10
|
+
databaseConfig,
|
|
11
|
+
microservicesConfig,
|
|
12
|
+
middlewareConfig,
|
|
13
|
+
notificationConfig,
|
|
14
|
+
queueConfig,
|
|
15
|
+
securityConfig,
|
|
16
|
+
storageConfig,
|
|
17
|
+
} from '@zintrust/core';
|
|
16
18
|
|
|
17
|
-
export {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
export {
|
|
20
|
+
appConfig,
|
|
21
|
+
broadcastConfig,
|
|
22
|
+
cacheConfig,
|
|
23
|
+
databaseConfig,
|
|
24
|
+
microservicesConfig,
|
|
25
|
+
middlewareConfig,
|
|
26
|
+
notificationConfig,
|
|
27
|
+
queueConfig,
|
|
28
|
+
securityConfig,
|
|
29
|
+
storageConfig,
|
|
30
|
+
} from '@zintrust/core';
|
|
31
|
+
|
|
32
|
+
export type {
|
|
33
|
+
AppConfig,
|
|
34
|
+
CacheConfig,
|
|
35
|
+
MicroservicesConfig,
|
|
36
|
+
QueueConfig,
|
|
37
|
+
StorageConfig,
|
|
38
|
+
} from '@zintrust/core';
|
|
39
|
+
|
|
40
|
+
// Core exports this as `DatabaseRuntimeConfig`; keep template API stable.
|
|
41
|
+
export type { DatabaseRuntimeConfig as DatabaseConfig } from '@zintrust/core';
|
|
42
|
+
|
|
43
|
+
export type BroadcastConfig = typeof broadcastConfig;
|
|
44
|
+
export type NotificationConfig = typeof notificationConfig;
|
|
27
45
|
|
|
28
46
|
/**
|
|
29
47
|
* Combined configuration object
|