@zintrust/core 0.1.5 → 0.1.6
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/z.d.ts +2 -2
- package/bin/z.d.ts.map +1 -1
- package/bin/z.js +3 -2
- package/bin/zin.d.ts +2 -2
- package/bin/zin.d.ts.map +1 -1
- package/bin/zin.js +3 -2
- package/bin/zintrust-main.d.ts +9 -0
- package/bin/zintrust-main.d.ts.map +1 -0
- package/bin/zintrust-main.js +101 -0
- package/bin/zintrust-microservices.js +7 -7
- package/bin/zintrust.d.ts +5 -4
- package/bin/zintrust.d.ts.map +1 -1
- package/bin/zintrust.js +7 -87
- package/bin/zt.d.ts +2 -2
- package/bin/zt.d.ts.map +1 -1
- package/bin/zt.js +3 -2
- package/package.json +13 -3
- package/public/index.html +4 -0
- package/src/boot/Application.js +13 -13
- package/src/boot/Server.d.ts.map +1 -1
- package/src/boot/Server.js +47 -39
- package/src/boot/bootstrap.js +71 -36
- package/src/builder/BundleOptimizer.js +3 -3
- package/src/cache/Cache.js +6 -6
- package/src/cache/drivers/KVDriver.js +2 -2
- package/src/cache/drivers/MongoDriver.js +3 -3
- package/src/cache/drivers/RedisDriver.js +3 -3
- package/src/cli/BaseCommand.d.ts +2 -0
- package/src/cli/BaseCommand.d.ts.map +1 -1
- package/src/cli/BaseCommand.js +12 -2
- package/src/cli/CLI.js +23 -23
- package/src/cli/ErrorHandler.d.ts.map +1 -1
- package/src/cli/ErrorHandler.js +14 -8
- package/src/cli/commands/AddCommand.js +15 -15
- package/src/cli/commands/ConfigCommand.js +6 -6
- package/src/cli/commands/D1MigrateCommand.js +6 -6
- package/src/cli/commands/DebugCommand.js +3 -3
- package/src/cli/commands/FixCommand.js +5 -5
- package/src/cli/commands/KeyGenerateCommand.js +5 -5
- package/src/cli/commands/LogsCleanupCommand.js +2 -2
- package/src/cli/commands/LogsCommand.js +6 -6
- package/src/cli/commands/MakeMailTemplateCommand.d.ts.map +1 -1
- package/src/cli/commands/MakeMailTemplateCommand.js +8 -7
- package/src/cli/commands/MakeNotificationTemplateCommand.d.ts.map +1 -1
- package/src/cli/commands/MakeNotificationTemplateCommand.js +8 -7
- package/src/cli/commands/MigrateCommand.js +2 -2
- package/src/cli/commands/NewCommand.js +11 -11
- package/src/cli/commands/PluginCommand.js +3 -3
- package/src/cli/commands/PrepareCommand.js +6 -6
- package/src/cli/commands/QACommand.js +8 -8
- package/src/cli/commands/SecretsCommand.js +3 -3
- package/src/cli/commands/SimulateCommand.js +6 -6
- package/src/cli/commands/StartCommand.js +7 -7
- package/src/cli/commands/TemplatesCommand.js +5 -5
- package/src/cli/commands/index.js +12 -12
- package/src/cli/config/ConfigManager.js +5 -5
- package/src/cli/config/ConfigValidator.js +1 -1
- package/src/cli/config/index.js +3 -3
- package/src/cli/debug/Dashboard.js +3 -3
- package/src/cli/index.js +10 -10
- package/src/cli/logger/Logger.js +2 -2
- package/src/cli/scaffolding/ControllerGenerator.d.ts.map +1 -1
- package/src/cli/scaffolding/ControllerGenerator.js +48 -64
- package/src/cli/scaffolding/FactoryGenerator.js +6 -6
- package/src/cli/scaffolding/FeatureScaffolder.js +8 -8
- package/src/cli/scaffolding/FileGenerator.js +4 -4
- package/src/cli/scaffolding/MigrationGenerator.js +4 -4
- package/src/cli/scaffolding/ModelGenerator.js +5 -5
- package/src/cli/scaffolding/ProjectScaffolder.d.ts.map +1 -1
- package/src/cli/scaffolding/ProjectScaffolder.js +78 -15
- package/src/cli/scaffolding/RequestFactoryGenerator.js +5 -5
- package/src/cli/scaffolding/ResponseFactoryGenerator.js +5 -5
- package/src/cli/scaffolding/RouteGenerator.js +4 -4
- package/src/cli/scaffolding/SeederGenerator.js +7 -7
- package/src/cli/scaffolding/ServiceIntegrationTestGenerator.js +5 -5
- package/src/cli/scaffolding/ServiceRequestFactoryGenerator.js +4 -4
- package/src/cli/scaffolding/ServiceScaffolder.d.ts.map +1 -1
- package/src/cli/scaffolding/ServiceScaffolder.js +24 -23
- package/src/cli/scaffolding/TemplateEngine.d.ts.map +1 -1
- package/src/cli/scaffolding/TemplateEngine.js +0 -2
- package/src/cli/scaffolding/TemplateGenerator.js +4 -4
- package/src/cli/scaffolding/WorkflowGenerator.js +4 -4
- package/src/cli/scaffolding/index.js +16 -16
- package/src/cli/utils/DistPackager.js +4 -4
- package/src/cli/utils/EnvFileLoader.js +2 -2
- package/src/cli/utils/spawn.d.ts.map +1 -1
- package/src/cli/utils/spawn.js +18 -7
- package/src/common/AwsSigV4.js +1 -1
- package/src/common/index.js +5 -5
- package/src/common/uuid.js +2 -2
- package/src/config/FileLogWriter.js +4 -4
- package/src/config/SecretsManager.d.ts +1 -42
- package/src/config/SecretsManager.d.ts.map +1 -1
- package/src/config/SecretsManager.js +2 -2
- package/src/config/StartupConfigValidator.d.ts +1 -9
- package/src/config/StartupConfigValidator.d.ts.map +1 -1
- package/src/config/StartupConfigValidator.js +115 -22
- package/src/config/app.d.ts +1 -1
- package/src/config/app.d.ts.map +1 -1
- package/src/config/app.js +1 -1
- package/src/config/broadcast.d.ts +1 -26
- package/src/config/broadcast.d.ts.map +1 -1
- package/src/config/broadcast.js +1 -1
- package/src/config/cache.d.ts +1 -22
- package/src/config/cache.d.ts.map +1 -1
- package/src/config/cache.js +1 -1
- package/src/config/cloudflare.d.ts +1 -13
- package/src/config/cloudflare.d.ts.map +1 -1
- package/src/config/database.d.ts +2 -47
- package/src/config/database.d.ts.map +1 -1
- package/src/config/database.js +1 -1
- package/src/config/env.d.ts.map +1 -1
- package/src/config/env.js +6 -2
- package/src/config/features.js +2 -2
- package/src/config/index.d.ts +10 -287
- package/src/config/index.d.ts.map +1 -1
- package/src/config/index.js +16 -16
- package/src/config/logger.d.ts.map +1 -1
- package/src/config/logger.js +10 -8
- package/src/config/logging/HttpLogger.js +4 -4
- package/src/config/logging/KvLogger.js +2 -2
- package/src/config/logging/SlackLogger.js +3 -3
- package/src/config/mail.d.ts +1 -27
- package/src/config/mail.d.ts.map +1 -1
- package/src/config/mail.js +1 -1
- package/src/config/microservices.js +1 -1
- package/src/config/middleware.d.ts +2 -6
- package/src/config/middleware.d.ts.map +1 -1
- package/src/config/middleware.js +5 -5
- package/src/config/notification.d.ts +0 -21
- package/src/config/notification.d.ts.map +1 -1
- package/src/config/notification.js +1 -1
- package/src/config/queue.d.ts +1 -39
- package/src/config/queue.d.ts.map +1 -1
- package/src/config/queue.js +1 -1
- package/src/config/security.d.ts +12 -0
- package/src/config/security.d.ts.map +1 -1
- package/src/config/security.js +17 -5
- package/src/config/startup.d.ts +2 -0
- package/src/config/startup.d.ts.map +1 -1
- package/src/config/startup.js +2 -1
- package/src/config/storage.d.ts +1 -48
- package/src/config/storage.d.ts.map +1 -1
- package/src/config/storage.js +1 -1
- package/src/config/type.d.ts +335 -0
- package/src/config/type.d.ts.map +1 -0
- package/src/config/type.js +1 -0
- package/src/container/ServiceContainer.js +1 -1
- package/src/exceptions/ZintrustError.js +1 -1
- package/src/features/Queue.js +2 -2
- package/src/functions/cloudflare.js +4 -4
- package/src/functions/deno.js +4 -4
- package/src/functions/lambda.js +4 -4
- package/src/health/RuntimeHealthProbes.js +3 -3
- package/src/health/StartupHealthChecks.js +9 -9
- package/src/http/Kernel.js +10 -10
- package/src/http/RequestContext.js +2 -2
- package/src/http/Response.js +1 -1
- package/src/index.d.ts +36 -1
- package/src/index.d.ts.map +1 -1
- package/src/index.js +69 -36
- package/src/microservices/MicroserviceBootstrap.js +5 -5
- package/src/microservices/MicroserviceGenerator.js +10 -10
- package/src/microservices/MicroserviceManager.js +4 -4
- package/src/microservices/PostgresAdapter.js +3 -3
- package/src/microservices/RequestTracingMiddleware.js +3 -3
- package/src/microservices/ServiceAuthMiddleware.js +3 -3
- package/src/microservices/ServiceBundler.js +3 -3
- package/src/microservices/ServiceHealthMonitor.js +2 -2
- package/src/middleware/CsrfMiddleware.js +3 -3
- package/src/middleware/ErrorHandlerMiddleware.js +4 -4
- package/src/middleware/LoggingMiddleware.js +3 -3
- package/src/middleware/RateLimiter.js +1 -1
- package/src/middleware/index.js +6 -6
- package/src/node-singletons/http.d.ts +2 -2
- package/src/node-singletons/http.d.ts.map +1 -1
- package/src/node-singletons/http.js +1 -1
- package/src/node-singletons/index.js +14 -14
- package/src/node-singletons/path.d.ts +1 -1
- package/src/node.d.ts +5 -0
- package/src/node.d.ts.map +1 -0
- package/src/node.js +4 -0
- package/src/orm/ConnectionManager.js +3 -3
- package/src/orm/Database.js +8 -8
- package/src/orm/Model.js +5 -5
- package/src/orm/QueryBuilder.js +1 -1
- package/src/orm/Relationships.js +1 -1
- package/src/orm/adapters/D1Adapter.js +5 -5
- package/src/orm/adapters/MySQLAdapter.d.ts.map +1 -1
- package/src/orm/adapters/MySQLAdapter.js +4 -6
- package/src/orm/adapters/PostgreSQLAdapter.d.ts.map +1 -1
- package/src/orm/adapters/PostgreSQLAdapter.js +4 -6
- package/src/orm/adapters/SQLServerAdapter.d.ts.map +1 -1
- package/src/orm/adapters/SQLServerAdapter.js +4 -6
- package/src/orm/adapters/SQLiteAdapter.d.ts.map +1 -1
- package/src/orm/adapters/SQLiteAdapter.js +5 -7
- package/src/performance/CodeGenerationBenchmark.js +5 -5
- package/src/performance/Optimizer.js +3 -3
- package/src/performance/establish-baseline.js +4 -4
- package/src/profiling/RequestProfiler.js +4 -4
- package/src/runtime/PluginManager.js +8 -8
- package/src/runtime/RuntimeDetector.d.ts.map +1 -1
- package/src/runtime/RuntimeDetector.js +22 -12
- package/src/runtime/adapters/CloudflareAdapter.js +3 -3
- package/src/runtime/adapters/DenoAdapter.js +2 -2
- package/src/runtime/adapters/FargateAdapter.js +4 -4
- package/src/runtime/adapters/LambdaAdapter.js +4 -4
- package/src/runtime/adapters/NodeServerAdapter.js +4 -4
- package/src/scheduler/ScheduleRunner.js +2 -2
- package/src/scheduler/index.js +1 -1
- package/src/schedules/index.js +1 -1
- package/src/schedules/log-cleanup.js +2 -2
- package/src/scripts/GenerateEnvArtifacts.js +4 -4
- package/src/scripts/TemplateSync.js +8 -6
- package/src/security/CsrfTokenManager.js +2 -2
- package/src/security/Encryptor.js +3 -3
- package/src/security/Hash.js +2 -2
- package/src/security/JwtManager.js +2 -2
- package/src/security/StartupSecretValidation.js +4 -4
- package/src/security/UrlValidator.js +1 -1
- package/src/security/Xss.js +1 -1
- package/src/security/XssProtection.d.ts.map +1 -1
- package/src/security/XssProtection.js +8 -3
- package/src/templates/adapters/MySQLAdapter.ts.tpl +0 -2
- package/src/templates/adapters/PostgreSQLAdapter.ts.tpl +0 -3
- package/src/templates/adapters/SQLServerAdapter.ts.tpl +0 -2
- package/src/templates/adapters/SQLiteAdapter.ts.tpl +0 -2
- package/src/templates/project/basic/.env.tpl +8 -1
- package/src/templates/project/basic/app/Controllers/UserController.ts.tpl +3 -2
- package/src/templates/project/basic/app/Middleware/ProfilerMiddleware.ts.tpl +3 -2
- package/src/templates/project/basic/app/Middleware/index.ts.tpl +8 -14
- package/src/templates/project/basic/app/Models/Post.ts.tpl +2 -1
- package/src/templates/project/basic/app/Models/User.ts.tpl +1 -1
- package/src/templates/project/basic/app/Toolkit/Broadcast/sendBroadcast.ts.tpl +1 -1
- package/src/templates/project/basic/app/Toolkit/Mail/sendWelcomeEmail.ts.tpl +1 -1
- package/src/templates/project/basic/app/Toolkit/Notification/sendSlackNotification.ts.tpl +1 -1
- package/src/templates/project/basic/app/Toolkit/Notification/sendSms.ts.tpl +1 -1
- package/src/templates/project/basic/config/FileLogWriter.ts.tpl +2 -4
- package/src/templates/project/basic/config/SecretsManager.ts.tpl +6 -39
- package/src/templates/project/basic/config/StartupConfigValidator.ts.tpl +154 -37
- package/src/templates/project/basic/config/app.ts.tpl +1 -5
- package/src/templates/project/basic/config/broadcast.ts.tpl +6 -36
- package/src/templates/project/basic/config/cache.ts.tpl +1 -42
- package/src/templates/project/basic/config/cloudflare.ts.tpl +1 -15
- package/src/templates/project/basic/config/database.ts.tpl +5 -51
- package/src/templates/project/basic/config/env.ts.tpl +6 -7
- package/src/templates/project/basic/config/features.ts.tpl +1 -1
- package/src/templates/project/basic/config/index.ts.tpl +1 -1
- package/src/templates/project/basic/config/logger.ts.tpl +3 -1
- package/src/templates/project/basic/config/logging/HttpLogger.ts.tpl +1 -1
- package/src/templates/project/basic/config/logging/KvLogger.ts.tpl +1 -1
- package/src/templates/project/basic/config/logging/SlackLogger.ts.tpl +1 -1
- package/src/templates/project/basic/config/mail.ts.tpl +1 -57
- package/src/templates/project/basic/config/microservices.ts.tpl +1 -1
- package/src/templates/project/basic/config/middleware.ts.tpl +2 -6
- package/src/templates/project/basic/config/notification.ts.tpl +1 -36
- package/src/templates/project/basic/config/queue.ts.tpl +1 -49
- package/src/templates/project/basic/config/security.ts.tpl +13 -1
- package/src/templates/project/basic/config/startup.ts.tpl +2 -0
- package/src/templates/project/basic/config/storage.ts.tpl +6 -54
- package/src/templates/project/basic/config/type.ts.tpl +414 -0
- package/src/templates/project/basic/package.json.tpl +1 -0
- package/src/templates/project/basic/routes/api.ts.tpl +1 -1
- package/src/templates/project/basic/routes/broadcast.ts.tpl +1 -1
- package/src/templates/project/basic/routes/health.ts.tpl +1 -1
- package/src/templates/project/basic/routes/storage.ts.tpl +1 -1
- package/src/templates/project/basic/src/index.ts.tpl +49 -41
- package/src/templates/project/basic/template.json +1 -1
- package/src/templates/project/basic/tsconfig.json.tpl +3 -1
- package/src/toolkit/Secrets/EnvFile.js +3 -3
- package/src/toolkit/Secrets/Manifest.js +3 -3
- package/src/toolkit/Secrets/index.js +5 -5
- package/src/toolkit/Secrets/providers/AwsSecretsManager.js +2 -2
- package/src/toolkit/Secrets/providers/CloudflareKv.js +1 -1
- package/src/tools/broadcast/Broadcast.js +6 -6
- package/src/tools/broadcast/drivers/BaseDriver.js +1 -1
- package/src/tools/broadcast/drivers/Pusher.d.ts +1 -1
- package/src/tools/broadcast/drivers/Pusher.d.ts.map +1 -1
- package/src/tools/broadcast/drivers/Pusher.js +2 -2
- package/src/tools/broadcast/drivers/Redis.js +1 -1
- package/src/tools/broadcast/drivers/RedisHttps.js +3 -3
- package/src/tools/broadcast/index.js +6 -6
- package/src/tools/http/Http.js +4 -4
- package/src/tools/http/HttpResponse.js +1 -1
- package/src/tools/http/index.js +2 -2
- package/src/tools/mail/Mail.js +8 -8
- package/src/tools/mail/attachments.js +1 -1
- package/src/tools/mail/drivers/BaseDriver.js +1 -1
- package/src/tools/mail/drivers/Mailgun.js +1 -1
- package/src/tools/mail/drivers/SendGrid.js +1 -1
- package/src/tools/mail/drivers/Ses.js +2 -2
- package/src/tools/mail/drivers/Smtp.js +4 -4
- package/src/tools/mail/templates/markdown/index.js +3 -3
- package/src/tools/mail/templates/markdown/registry.js +5 -5
- package/src/tools/mail/templates/markdown/validator.js +1 -1
- package/src/tools/mail/testing.js +1 -1
- package/src/tools/notification/Notification.js +1 -1
- package/src/tools/notification/Registry.js +3 -3
- package/src/tools/notification/Service.js +3 -3
- package/src/tools/notification/config.js +1 -1
- package/src/tools/notification/drivers/BaseDriver.js +1 -1
- package/src/tools/notification/drivers/Slack.js +1 -1
- package/src/tools/notification/drivers/Termii.js +1 -1
- package/src/tools/notification/drivers/Twilio.js +1 -1
- package/src/tools/notification/templates/markdown/index.js +3 -3
- package/src/tools/notification/templates/markdown/registry.js +5 -5
- package/src/tools/notification/testing.js +1 -1
- package/src/tools/notification/testingHelpers.js +2 -2
- package/src/tools/queue/Queue.js +1 -1
- package/src/tools/queue/drivers/InMemory.js +1 -1
- package/src/tools/queue/drivers/Redis.js +2 -2
- package/src/tools/storage/LocalSignedUrl.js +2 -2
- package/src/tools/storage/drivers/Gcs.js +1 -1
- package/src/tools/storage/drivers/Local.js +5 -5
- package/src/tools/storage/drivers/R2.js +2 -2
- package/src/tools/storage/drivers/S3.js +3 -3
- package/src/tools/storage/index.js +6 -6
- package/src/tools/storage/testing.js +1 -1
- package/src/tools/templates/MarkdownRenderer.js +2 -2
- package/src/tools/templates/index.js +1 -1
- package/src/validation/Validator.js +3 -3
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import { Env } from '@config/env';
|
|
2
|
+
import type { Middleware as MiddlewareFn } from '@middleware/MiddlewareStack';
|
|
3
|
+
|
|
4
|
+
export type Environment =
|
|
5
|
+
| 'development'
|
|
6
|
+
| 'dev'
|
|
7
|
+
| 'production'
|
|
8
|
+
| 'prod'
|
|
9
|
+
| 'pro'
|
|
10
|
+
| 'testing'
|
|
11
|
+
| 'test';
|
|
12
|
+
export type StartMode = 'development' | 'production' | 'testing';
|
|
13
|
+
|
|
14
|
+
export type EnvGetValue = ReturnType<typeof Env.get>;
|
|
15
|
+
export type EnvGetBoolValue = ReturnType<typeof Env.getBool>;
|
|
16
|
+
|
|
17
|
+
export type LocalStorageDriverConfig = {
|
|
18
|
+
driver: 'local';
|
|
19
|
+
root: EnvGetValue;
|
|
20
|
+
url: EnvGetValue;
|
|
21
|
+
visibility: EnvGetValue;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type S3StorageDriverConfig = {
|
|
25
|
+
driver: 's3';
|
|
26
|
+
accessKeyId: EnvGetValue;
|
|
27
|
+
secretAccessKey: EnvGetValue;
|
|
28
|
+
region: typeof Env.AWS_REGION;
|
|
29
|
+
bucket: EnvGetValue;
|
|
30
|
+
url: EnvGetValue;
|
|
31
|
+
endpoint: EnvGetValue;
|
|
32
|
+
usePathStyleUrl: EnvGetBoolValue;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type R2StorageDriverConfig = {
|
|
36
|
+
driver: 'r2';
|
|
37
|
+
accessKeyId: EnvGetValue;
|
|
38
|
+
secretAccessKey: EnvGetValue;
|
|
39
|
+
region: EnvGetValue;
|
|
40
|
+
bucket: EnvGetValue;
|
|
41
|
+
endpoint: EnvGetValue;
|
|
42
|
+
url: EnvGetValue;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type GcsStorageDriverConfig = {
|
|
46
|
+
driver: 'gcs';
|
|
47
|
+
projectId: EnvGetValue;
|
|
48
|
+
keyFile: EnvGetValue;
|
|
49
|
+
bucket: EnvGetValue;
|
|
50
|
+
url: EnvGetValue;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type StorageDrivers = {
|
|
54
|
+
local: LocalStorageDriverConfig;
|
|
55
|
+
s3: S3StorageDriverConfig;
|
|
56
|
+
r2: R2StorageDriverConfig;
|
|
57
|
+
gcs: GcsStorageDriverConfig;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type StorageDriverName = keyof StorageDrivers;
|
|
61
|
+
export type StorageDriverConfig = StorageDrivers[StorageDriverName];
|
|
62
|
+
|
|
63
|
+
export type StorageConfigRuntime = {
|
|
64
|
+
readonly default: string;
|
|
65
|
+
readonly drivers: StorageDrivers;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export type StartupConfigValidationError = {
|
|
69
|
+
key: string;
|
|
70
|
+
value: unknown;
|
|
71
|
+
message: string;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export type StartupConfigValidationResult = {
|
|
75
|
+
valid: boolean;
|
|
76
|
+
errors: StartupConfigValidationError[];
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export interface CloudflareKV {
|
|
80
|
+
get(key: string): Promise<string | null>;
|
|
81
|
+
put(key: string, value: string, options?: { expirationTtl?: number }): Promise<void>;
|
|
82
|
+
delete(key: string): Promise<void>;
|
|
83
|
+
list(options?: { prefix?: string }): Promise<{ keys: { name: string }[] }>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface SecretConfig {
|
|
87
|
+
platform: 'aws' | 'cloudflare' | 'deno' | 'local';
|
|
88
|
+
region?: string;
|
|
89
|
+
kv?: CloudflareKV; // Cloudflare KV namespace
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface SecretValue {
|
|
93
|
+
key: string;
|
|
94
|
+
value: string;
|
|
95
|
+
expiresAt?: number;
|
|
96
|
+
rotationEnabled?: boolean;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface GetSecretOptions {
|
|
100
|
+
cacheTtl?: number; // Cache time-to-live in milliseconds
|
|
101
|
+
throwIfMissing?: boolean;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface SetSecretOptions {
|
|
105
|
+
expirationTtl?: number; // Expiration time-to-live in seconds
|
|
106
|
+
metadata?: Record<string, unknown>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface SecretsManagerInstance {
|
|
110
|
+
getSecret(key: string, options?: GetSecretOptions): Promise<string>;
|
|
111
|
+
setSecret(key: string, value: string, options?: SetSecretOptions): Promise<void>;
|
|
112
|
+
deleteSecret(key: string): Promise<void>;
|
|
113
|
+
rotateSecret(key: string): Promise<void>;
|
|
114
|
+
listSecrets(pattern?: string): Promise<string[]>;
|
|
115
|
+
clearCache(key?: string): void;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export type QueueDriverName = 'sync' | 'database' | 'redis' | 'rabbitmq' | 'sqs';
|
|
119
|
+
|
|
120
|
+
export type SyncQueueDriverConfig = {
|
|
121
|
+
driver: 'sync';
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export type DatabaseQueueDriverConfig = {
|
|
125
|
+
driver: 'database';
|
|
126
|
+
table: string;
|
|
127
|
+
connection: string;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export type RedisQueueDriverConfig = {
|
|
131
|
+
driver: 'redis';
|
|
132
|
+
host: string;
|
|
133
|
+
port: number;
|
|
134
|
+
password?: string;
|
|
135
|
+
database: number;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export type RabbitMqQueueDriverConfig = {
|
|
139
|
+
driver: 'rabbitmq';
|
|
140
|
+
host: string;
|
|
141
|
+
port: number;
|
|
142
|
+
username: string;
|
|
143
|
+
password: string;
|
|
144
|
+
vhost: string;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export type SqsQueueDriverConfig = {
|
|
148
|
+
driver: 'sqs';
|
|
149
|
+
key?: string;
|
|
150
|
+
secret?: string;
|
|
151
|
+
region: string;
|
|
152
|
+
queueUrl?: string;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export type QueueDriversConfig = {
|
|
156
|
+
sync: SyncQueueDriverConfig;
|
|
157
|
+
database: DatabaseQueueDriverConfig;
|
|
158
|
+
redis: RedisQueueDriverConfig;
|
|
159
|
+
rabbitmq: RabbitMqQueueDriverConfig;
|
|
160
|
+
sqs: SqsQueueDriverConfig;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export type QueueConfigWithDrivers = {
|
|
164
|
+
default: QueueDriverName;
|
|
165
|
+
drivers: QueueDriversConfig;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export type KnownNotificationDriverName = 'console' | 'termii' | 'twilio' | 'slack';
|
|
169
|
+
|
|
170
|
+
export type ConsoleNotificationDriverConfig = { driver: 'console' };
|
|
171
|
+
|
|
172
|
+
export type TermiiNotificationDriverConfig = {
|
|
173
|
+
driver: 'termii';
|
|
174
|
+
apiKey: string;
|
|
175
|
+
sender: string;
|
|
176
|
+
endpoint: string;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export type TwilioNotificationDriverConfig = {
|
|
180
|
+
driver: 'twilio';
|
|
181
|
+
accountSid: string;
|
|
182
|
+
authToken: string;
|
|
183
|
+
fromNumber: string;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export type SlackNotificationDriverConfig = {
|
|
187
|
+
driver: 'slack';
|
|
188
|
+
webhookUrl: string;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
export type KnownNotificationDriverConfig =
|
|
192
|
+
| ConsoleNotificationDriverConfig
|
|
193
|
+
| TermiiNotificationDriverConfig
|
|
194
|
+
| TwilioNotificationDriverConfig
|
|
195
|
+
| SlackNotificationDriverConfig;
|
|
196
|
+
|
|
197
|
+
export type NotificationProviders = {
|
|
198
|
+
console: ConsoleNotificationDriverConfig;
|
|
199
|
+
termii: TermiiNotificationDriverConfig;
|
|
200
|
+
twilio: TwilioNotificationDriverConfig;
|
|
201
|
+
slack: SlackNotificationDriverConfig;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export type MiddlewareConfigType = {
|
|
205
|
+
global: MiddlewareFn[];
|
|
206
|
+
route: Record<string, MiddlewareFn>;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export type MailDriverName = 'disabled' | 'sendgrid' | 'smtp' | 'ses' | 'mailgun';
|
|
210
|
+
|
|
211
|
+
export type DisabledMailDriverConfig = {
|
|
212
|
+
driver: 'disabled';
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export type SendGridMailDriverConfig = {
|
|
216
|
+
driver: 'sendgrid';
|
|
217
|
+
apiKey: string;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
export type MailgunMailDriverConfig = {
|
|
221
|
+
driver: 'mailgun';
|
|
222
|
+
apiKey: string;
|
|
223
|
+
domain: string;
|
|
224
|
+
baseUrl: string;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
// Placeholders for future drivers (kept config-first)
|
|
228
|
+
export type SmtpMailDriverConfig = {
|
|
229
|
+
driver: 'smtp';
|
|
230
|
+
host: string;
|
|
231
|
+
port: number;
|
|
232
|
+
username: string;
|
|
233
|
+
password: string;
|
|
234
|
+
secure: boolean | 'starttls';
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
export type SesMailDriverConfig = {
|
|
238
|
+
driver: 'ses';
|
|
239
|
+
region: string;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
export type MailDriverConfig =
|
|
243
|
+
| DisabledMailDriverConfig
|
|
244
|
+
| SendGridMailDriverConfig
|
|
245
|
+
| MailgunMailDriverConfig
|
|
246
|
+
| SmtpMailDriverConfig
|
|
247
|
+
| SesMailDriverConfig;
|
|
248
|
+
|
|
249
|
+
export type MailDrivers = {
|
|
250
|
+
disabled: DisabledMailDriverConfig;
|
|
251
|
+
sendgrid: SendGridMailDriverConfig;
|
|
252
|
+
mailgun: MailgunMailDriverConfig;
|
|
253
|
+
smtp: SmtpMailDriverConfig;
|
|
254
|
+
ses: SesMailDriverConfig;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
export type MailConfigInput = {
|
|
258
|
+
default: MailDriverName;
|
|
259
|
+
from: {
|
|
260
|
+
address: string;
|
|
261
|
+
name: string;
|
|
262
|
+
};
|
|
263
|
+
drivers: MailDrivers;
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
export type ProcessLike = {
|
|
267
|
+
env?: Record<string, string | undefined>;
|
|
268
|
+
execPath?: string;
|
|
269
|
+
platform?: string;
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
export type SqliteConnectionConfig = {
|
|
273
|
+
driver: 'sqlite';
|
|
274
|
+
database: string;
|
|
275
|
+
migrations: string;
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
export type PostgresqlConnectionConfig = {
|
|
279
|
+
driver: 'postgresql';
|
|
280
|
+
host: string;
|
|
281
|
+
port: number;
|
|
282
|
+
database: string;
|
|
283
|
+
username: string;
|
|
284
|
+
password: string;
|
|
285
|
+
ssl: boolean;
|
|
286
|
+
pooling: {
|
|
287
|
+
enabled: boolean;
|
|
288
|
+
min: number;
|
|
289
|
+
max: number;
|
|
290
|
+
idleTimeout: number;
|
|
291
|
+
connectionTimeout: number;
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
export type MysqlConnectionConfig = {
|
|
296
|
+
driver: 'mysql';
|
|
297
|
+
host: string;
|
|
298
|
+
port: number;
|
|
299
|
+
database: string;
|
|
300
|
+
username: string;
|
|
301
|
+
password: string;
|
|
302
|
+
pooling: {
|
|
303
|
+
enabled: boolean;
|
|
304
|
+
min: number;
|
|
305
|
+
max: number;
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
export type DatabaseConnections = {
|
|
310
|
+
sqlite: SqliteConnectionConfig;
|
|
311
|
+
postgresql: PostgresqlConnectionConfig;
|
|
312
|
+
mysql: MysqlConnectionConfig;
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
export type DatabaseConnectionName = keyof DatabaseConnections;
|
|
316
|
+
export type DatabaseConnectionConfig = DatabaseConnections[DatabaseConnectionName];
|
|
317
|
+
|
|
318
|
+
export type DatabaseConfigShape = {
|
|
319
|
+
default: DatabaseConnectionName;
|
|
320
|
+
connections: DatabaseConnections;
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
export type WorkersEnv = Record<string, unknown>;
|
|
324
|
+
|
|
325
|
+
export type KVNamespace = {
|
|
326
|
+
get(
|
|
327
|
+
key: string,
|
|
328
|
+
options?: { type: 'text' | 'json' | 'arrayBuffer' | 'stream' }
|
|
329
|
+
): Promise<unknown>;
|
|
330
|
+
put(
|
|
331
|
+
key: string,
|
|
332
|
+
value: string | ReadableStream | ArrayBuffer | FormData,
|
|
333
|
+
options?: { expiration?: number; expirationTtl?: number; metadata?: unknown }
|
|
334
|
+
): Promise<void>;
|
|
335
|
+
delete(key: string): Promise<void>;
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
export type MemoryCacheDriverConfig = {
|
|
339
|
+
driver: 'memory';
|
|
340
|
+
ttl: number;
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
export type RedisCacheDriverConfig = {
|
|
344
|
+
driver: 'redis';
|
|
345
|
+
host: string;
|
|
346
|
+
port: number;
|
|
347
|
+
ttl: number;
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
export type MongoCacheDriverConfig = {
|
|
351
|
+
driver: 'mongodb';
|
|
352
|
+
uri: string;
|
|
353
|
+
db: string;
|
|
354
|
+
ttl: number;
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
export type KvCacheDriverConfig = {
|
|
358
|
+
driver: 'kv';
|
|
359
|
+
ttl: number;
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
export type CacheDriverConfig =
|
|
363
|
+
| MemoryCacheDriverConfig
|
|
364
|
+
| RedisCacheDriverConfig
|
|
365
|
+
| MongoCacheDriverConfig
|
|
366
|
+
| KvCacheDriverConfig;
|
|
367
|
+
|
|
368
|
+
export type CacheDrivers = {
|
|
369
|
+
memory: MemoryCacheDriverConfig;
|
|
370
|
+
redis: RedisCacheDriverConfig;
|
|
371
|
+
mongodb: MongoCacheDriverConfig;
|
|
372
|
+
kv: KvCacheDriverConfig;
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
export type CacheConfigInput = {
|
|
376
|
+
default: string;
|
|
377
|
+
drivers: CacheDrivers;
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
export type KnownBroadcastDriverName = 'inmemory' | 'pusher' | 'redis' | 'redishttps';
|
|
381
|
+
|
|
382
|
+
export type InMemoryBroadcastDriverConfig = {
|
|
383
|
+
driver: 'inmemory';
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
export type PusherBroadcastDriverConfig = {
|
|
387
|
+
driver: 'pusher';
|
|
388
|
+
appId: string;
|
|
389
|
+
key: string;
|
|
390
|
+
secret: string;
|
|
391
|
+
cluster: string;
|
|
392
|
+
useTLS: boolean;
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
export type RedisBroadcastDriverConfig = {
|
|
396
|
+
driver: 'redis';
|
|
397
|
+
host: string;
|
|
398
|
+
port: number;
|
|
399
|
+
password: string;
|
|
400
|
+
channelPrefix: string;
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
export type RedisHttpsBroadcastDriverConfig = {
|
|
404
|
+
driver: 'redishttps';
|
|
405
|
+
endpoint: string;
|
|
406
|
+
token: string;
|
|
407
|
+
channelPrefix: string;
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
export type KnownBroadcastDriverConfig =
|
|
411
|
+
| InMemoryBroadcastDriverConfig
|
|
412
|
+
| PusherBroadcastDriverConfig
|
|
413
|
+
| RedisBroadcastDriverConfig
|
|
414
|
+
| RedisHttpsBroadcastDriverConfig;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { UserController } from '@app/Controllers/UserController';
|
|
7
|
-
import { Env } from '@
|
|
7
|
+
import { Env } from '@zintrust/core';
|
|
8
8
|
import { registerBroadcastRoutes } from '@routes/broadcast';
|
|
9
9
|
import { registerHealthRoutes } from '@routes/health';
|
|
10
10
|
import { registerStorageRoutes } from '@routes/storage';
|
|
@@ -25,7 +25,7 @@ export function registerBroadcastRoutes(router: IRouter): void {
|
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
const { Broadcast } = await import('@
|
|
28
|
+
const { Broadcast } = await import('@zintrust/core');
|
|
29
29
|
const result = await Broadcast.send(channel, event, data);
|
|
30
30
|
res.json({ ok: true, result });
|
|
31
31
|
});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { appConfig } from '@/config';
|
|
7
7
|
import { RuntimeHealthProbes } from '@/health/RuntimeHealthProbes';
|
|
8
|
-
import { Env } from '@
|
|
8
|
+
import { Env } from '@zintrust/core';
|
|
9
9
|
import { Logger } from '@config/logger';
|
|
10
10
|
import { useDatabase } from '@zintrust/core';
|
|
11
11
|
import { QueryBuilder } from '@zintrust/core';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTTP_HEADERS } from '@config/constants';
|
|
2
|
-
import { Env } from '@
|
|
2
|
+
import { Env } from '@zintrust/core';
|
|
3
3
|
import { type IRouter, Router } from '@zintrust/core';
|
|
4
4
|
import { LocalSignedUrl } from '@storage/LocalSignedUrl';
|
|
5
5
|
import { Storage } from '@storage/index';
|
|
@@ -1,10 +1,53 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* test-app - Zintrust Application Entry Point
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { Application, Server } from '@zintrust/core';
|
|
6
|
-
import
|
|
7
|
-
|
|
5
|
+
import { Application, Env, Logger, Server } from '@zintrust/core';
|
|
6
|
+
import process from '@zintrust/core/node';
|
|
7
|
+
|
|
8
|
+
type AppInstance = ReturnType<typeof Application.create>;
|
|
9
|
+
type ServerInstance = ReturnType<typeof Server.create>;
|
|
10
|
+
|
|
11
|
+
function withTimeout<T>(promise: Promise<T>, ms: number, timeoutMessage = 'Shutdown timed out'): Promise<T> {
|
|
12
|
+
if (!Number.isFinite(ms) || ms <= 0) return promise;
|
|
13
|
+
|
|
14
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
15
|
+
|
|
16
|
+
const timeout = new Promise<never>((_, reject) => {
|
|
17
|
+
timer = setTimeout(() => reject(new globalThis.Error(timeoutMessage)), ms);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
return Promise.race([promise, timeout]).finally(() => {
|
|
21
|
+
if (timer) clearTimeout(timer);
|
|
22
|
+
}) as Promise<T>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function stopServices(server: ServerInstance, app: AppInstance): Promise<void> {
|
|
26
|
+
await server.close();
|
|
27
|
+
await app.shutdown();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function shutdownGracefully(signal: string, server: ServerInstance, app: AppInstance): Promise<void> {
|
|
31
|
+
Logger.info(`${signal} received, shutting down gracefully...`);
|
|
32
|
+
|
|
33
|
+
const timeoutMs = Env.getInt('SHUTDOWN_TIMEOUT', 1500);
|
|
34
|
+
const forceExitMs = Env.getInt('SHUTDOWN_FORCE_EXIT_MS', 2500);
|
|
35
|
+
|
|
36
|
+
const forceExitTimer = globalThis.setTimeout(() => {
|
|
37
|
+
process.exit(0);
|
|
38
|
+
}, forceExitMs);
|
|
39
|
+
|
|
40
|
+
(forceExitTimer as unknown as { unref?: () => void }).unref?.();
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
await withTimeout(stopServices(server, app), timeoutMs);
|
|
44
|
+
globalThis.clearTimeout(forceExitTimer);
|
|
45
|
+
process.exit(0);
|
|
46
|
+
} catch (error) {
|
|
47
|
+
Logger.error('Graceful shutdown failed:', error);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
8
51
|
|
|
9
52
|
/**
|
|
10
53
|
* Start the application
|
|
@@ -29,43 +72,8 @@ async function start() {
|
|
|
29
72
|
|
|
30
73
|
Logger.info(`Server running at http://${host}:${port}`);
|
|
31
74
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const timeoutMs = Env.getInt('SHUTDOWN_TIMEOUT', 10000);
|
|
36
|
-
const withTimeout = async <T>(promise: Promise<T>, ms: number): Promise<T> => {
|
|
37
|
-
if (ms <= 0) return promise;
|
|
38
|
-
return new Promise<T>((resolve, reject) => {
|
|
39
|
-
const timer = setTimeout(() => reject(new globalThis.Error('Shutdown timed out')), ms);
|
|
40
|
-
promise
|
|
41
|
-
.then((value) => {
|
|
42
|
-
clearTimeout(timer);
|
|
43
|
-
resolve(value);
|
|
44
|
-
})
|
|
45
|
-
.catch((err) => {
|
|
46
|
-
clearTimeout(timer);
|
|
47
|
-
reject(err);
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
try {
|
|
53
|
-
await withTimeout(
|
|
54
|
-
(async () => {
|
|
55
|
-
await server.close();
|
|
56
|
-
await app.shutdown();
|
|
57
|
-
})(),
|
|
58
|
-
timeoutMs
|
|
59
|
-
);
|
|
60
|
-
process.exit(0);
|
|
61
|
-
} catch (error) {
|
|
62
|
-
Logger.error('Graceful shutdown failed:', error);
|
|
63
|
-
process.exit(1);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
process.on('SIGTERM', () => void shutdown('SIGTERM'));
|
|
68
|
-
process.on('SIGINT', () => void shutdown('SIGINT'));
|
|
75
|
+
process.on('SIGTERM', () => void shutdownGracefully('SIGTERM', server, app));
|
|
76
|
+
process.on('SIGINT', () => void shutdownGracefully('SIGINT', server, app));
|
|
69
77
|
} catch (error) {
|
|
70
78
|
Logger.error('Failed to start application:', error);
|
|
71
79
|
process.exit(1);
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
"@app/*": ["./app/*"],
|
|
14
14
|
"@toolkit/*": ["./app/Toolkit/*"],
|
|
15
15
|
"@config/*": ["./config/*"],
|
|
16
|
+
"@app/*": ["./app/*"],
|
|
17
|
+
"@toolkit/*": ["./app/Toolkit/*"],
|
|
16
18
|
"@routes/*": ["./routes/*"],
|
|
17
19
|
"@database/*": ["./database/*"],
|
|
18
20
|
|
|
@@ -29,6 +31,6 @@
|
|
|
29
31
|
"@queue/*": ["./src/tools/queue/*"]
|
|
30
32
|
}
|
|
31
33
|
},
|
|
32
|
-
"include": ["src/**/*", "app/**/*", "routes/**/*", "database/**/*"
|
|
34
|
+
"include": ["src/**/*", "app/**/*", "routes/**/*", "database/**/*"],
|
|
33
35
|
"exclude": ["node_modules", "dist"]
|
|
34
36
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
2
|
-
import { fsPromises as fs } from '../../node-singletons/fs';
|
|
3
|
-
import * as path from '../../node-singletons/path';
|
|
1
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
2
|
+
import { fsPromises as fs } from '../../node-singletons/fs.js';
|
|
3
|
+
import * as path from '../../node-singletons/path.js';
|
|
4
4
|
const isValidKey = (key) => /^[A-Z0-9_]+$/.test(key);
|
|
5
5
|
const parseEnvLine = (line) => {
|
|
6
6
|
const trimmed = line.trim();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
2
|
-
import { fsPromises as fs } from '../../node-singletons/fs';
|
|
3
|
-
import * as path from '../../node-singletons/path';
|
|
1
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
2
|
+
import { fsPromises as fs } from '../../node-singletons/fs.js';
|
|
3
|
+
import * as path from '../../node-singletons/path.js';
|
|
4
4
|
const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
5
5
|
const assertString = (value, name) => {
|
|
6
6
|
if (typeof value !== 'string' || value.trim() === '') {
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* Internal framework module intended for CLI usage.
|
|
5
5
|
* It may use Node APIs (via node-singletons) and should not be used by runtime apps.
|
|
6
6
|
*/
|
|
7
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
8
|
-
import { EnvFile } from '../Secrets/EnvFile';
|
|
9
|
-
import { Manifest } from '../Secrets/Manifest';
|
|
10
|
-
import { AwsSecretsManager } from '../Secrets/providers/AwsSecretsManager';
|
|
11
|
-
import { CloudflareKv } from '../Secrets/providers/CloudflareKv';
|
|
7
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
8
|
+
import { EnvFile } from '../Secrets/EnvFile.js';
|
|
9
|
+
import { Manifest } from '../Secrets/Manifest.js';
|
|
10
|
+
import { AwsSecretsManager } from '../Secrets/providers/AwsSecretsManager.js';
|
|
11
|
+
import { CloudflareKv } from '../Secrets/providers/CloudflareKv.js';
|
|
12
12
|
const resolveProvider = (provider) => {
|
|
13
13
|
if (provider === 'aws' || provider === 'cloudflare')
|
|
14
14
|
return provider;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AwsSigV4 } from '../../../common/index';
|
|
2
|
-
import { ErrorFactory } from '../../../exceptions/ZintrustError';
|
|
1
|
+
import { AwsSigV4 } from '../../../common/index.js';
|
|
2
|
+
import { ErrorFactory } from '../../../exceptions/ZintrustError.js';
|
|
3
3
|
const sha256Hex = (data) => AwsSigV4.sha256Hex(data);
|
|
4
4
|
const buildAuthorization = (params) => {
|
|
5
5
|
const canonicalUri = '/';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { InMemoryDriver } from './drivers/InMemory';
|
|
2
|
-
import { PusherDriver } from './drivers/Pusher';
|
|
3
|
-
import { RedisDriver } from './drivers/Redis';
|
|
4
|
-
import { RedisHttpsDriver } from './drivers/RedisHttps';
|
|
5
|
-
import broadcastConfig from '../../config/broadcast';
|
|
6
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
1
|
+
import { InMemoryDriver } from './drivers/InMemory.js';
|
|
2
|
+
import { PusherDriver } from './drivers/Pusher.js';
|
|
3
|
+
import { RedisDriver } from './drivers/Redis.js';
|
|
4
|
+
import { RedisHttpsDriver } from './drivers/RedisHttps.js';
|
|
5
|
+
import broadcastConfig from '../../config/broadcast.js';
|
|
6
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
7
7
|
export const Broadcast = Object.freeze({
|
|
8
8
|
async send(channel, event, data) {
|
|
9
9
|
const driver = broadcastConfig.getDriverName();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PusherBroadcastDriverConfig } from '../../../config/
|
|
1
|
+
import type { PusherBroadcastDriverConfig } from '../../../config/type';
|
|
2
2
|
export declare const PusherDriver: Readonly<{
|
|
3
3
|
send(config: PusherBroadcastDriverConfig, channel: string, event: string, data: unknown): Promise<{
|
|
4
4
|
ok: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pusher.d.ts","sourceRoot":"","sources":["../../../../../src/tools/broadcast/drivers/Pusher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Pusher.d.ts","sourceRoot":"","sources":["../../../../../src/tools/broadcast/drivers/Pusher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAqDhE,eAAO,MAAM,YAAY;iBACJ,2BAA2B,WAAW,MAAM,SAAS,MAAM,QAAQ,OAAO;;;EAkD7F,CAAC;AAEH,eAAe,YAAY,CAAC"}
|