@zintrust/core 0.1.1 → 0.1.3
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 +3 -3
- package/bin/zintrust.d.ts.map +1 -1
- package/bin/zintrust.js +18 -1
- package/package.json +15 -1
- package/src/boot/Application.d.ts.map +1 -1
- package/src/boot/Application.js +46 -3
- package/src/boot/Server.d.ts.map +1 -1
- package/src/boot/Server.js +3 -4
- package/src/boot/bootstrap.js +77 -6
- package/src/builder/BundleOptimizer.d.ts.map +1 -1
- package/src/builder/BundleOptimizer.js +6 -4
- package/src/cache/drivers/KVDriver.d.ts.map +1 -1
- package/src/cache/drivers/KVDriver.js +6 -6
- package/src/cache/drivers/RedisDriver.js +1 -1
- package/src/cli/BaseCommand.d.ts +2 -2
- package/src/cli/BaseCommand.d.ts.map +1 -1
- package/src/cli/BaseCommand.js +2 -1
- package/src/cli/CLI.d.ts.map +1 -1
- package/src/cli/CLI.js +11 -4
- package/src/cli/commands/AddCommand.js +1 -1
- package/src/cli/commands/ConfigCommand.d.ts.map +1 -1
- package/src/cli/commands/ConfigCommand.js +34 -4
- package/src/cli/commands/D1MigrateCommand.d.ts +4 -0
- package/src/cli/commands/D1MigrateCommand.d.ts.map +1 -1
- package/src/cli/commands/D1MigrateCommand.js +4 -3
- package/src/cli/commands/FixCommand.d.ts.map +1 -1
- package/src/cli/commands/FixCommand.js +3 -16
- package/src/cli/commands/LogsCleanupCommand.d.ts +6 -0
- package/src/cli/commands/LogsCleanupCommand.d.ts.map +1 -0
- package/src/cli/commands/LogsCleanupCommand.js +20 -0
- package/src/cli/commands/LogsCommand.d.ts.map +1 -1
- package/src/cli/commands/LogsCommand.js +1 -1
- package/src/cli/commands/MakeMailTemplateCommand.d.ts +10 -0
- package/src/cli/commands/MakeMailTemplateCommand.d.ts.map +1 -0
- package/src/cli/commands/MakeMailTemplateCommand.js +74 -0
- package/src/cli/commands/MakeNotificationTemplateCommand.d.ts +10 -0
- package/src/cli/commands/MakeNotificationTemplateCommand.d.ts.map +1 -0
- package/src/cli/commands/MakeNotificationTemplateCommand.js +113 -0
- package/src/cli/commands/NewCommand.d.ts +4 -0
- package/src/cli/commands/NewCommand.d.ts.map +1 -1
- package/src/cli/commands/NewCommand.js +33 -20
- package/src/cli/commands/PluginCommand.d.ts.map +1 -1
- package/src/cli/commands/PluginCommand.js +8 -4
- package/src/cli/commands/PrepareCommand.d.ts.map +1 -1
- package/src/cli/commands/PrepareCommand.js +1 -1
- package/src/cli/commands/QACommand.d.ts.map +1 -1
- package/src/cli/commands/QACommand.js +11 -20
- package/src/cli/commands/SecretsCommand.d.ts +16 -0
- package/src/cli/commands/SecretsCommand.d.ts.map +1 -0
- package/src/cli/commands/SecretsCommand.js +91 -0
- package/src/cli/commands/StartCommand.d.ts.map +1 -1
- package/src/cli/commands/StartCommand.js +2 -2
- package/src/cli/commands/TemplatesCommand.d.ts +3 -0
- package/src/cli/commands/TemplatesCommand.d.ts.map +1 -0
- package/src/cli/commands/TemplatesCommand.js +65 -0
- package/src/cli/commands/index.d.ts +5 -0
- package/src/cli/commands/index.d.ts.map +1 -1
- package/src/cli/commands/index.js +5 -0
- package/src/cli/config/ConfigManager.js +1 -1
- package/src/cli/index.d.ts +2 -1
- package/src/cli/index.d.ts.map +1 -1
- package/src/cli/index.js +2 -1
- package/src/cli/scaffolding/ControllerGenerator.js +1 -1
- package/src/cli/scaffolding/FeatureScaffolder.js +4 -4
- package/src/cli/scaffolding/FileGenerator.js +1 -1
- package/src/cli/scaffolding/ModelGenerator.js +1 -1
- package/src/cli/scaffolding/ProjectScaffolder.d.ts.map +1 -1
- package/src/cli/scaffolding/ProjectScaffolder.js +61 -11
- package/src/cli/scaffolding/ResponseFactoryGenerator.d.ts.map +1 -1
- package/src/cli/scaffolding/ResponseFactoryGenerator.js +3 -2
- package/src/cli/scaffolding/RouteGenerator.js +1 -1
- package/src/cli/scaffolding/ServiceIntegrationTestGenerator.js +1 -1
- package/src/cli/scaffolding/ServiceScaffolder.js +2 -2
- package/src/cli/scaffolding/TemplateGenerator.d.ts +40 -0
- package/src/cli/scaffolding/TemplateGenerator.d.ts.map +1 -0
- package/src/cli/scaffolding/TemplateGenerator.js +172 -0
- package/src/cli/scaffolding/index.d.ts +1 -0
- package/src/cli/scaffolding/index.d.ts.map +1 -1
- package/src/cli/scaffolding/index.js +1 -0
- package/src/cli/utils/spawn.js +1 -1
- package/src/common/AwsSigV4.d.ts +41 -0
- package/src/common/AwsSigV4.d.ts.map +1 -0
- package/src/common/AwsSigV4.js +69 -0
- package/src/common/index.d.ts +39 -0
- package/src/common/index.d.ts.map +1 -1
- package/src/common/index.js +101 -8
- package/src/common/uuid.d.ts +3 -0
- package/src/common/uuid.d.ts.map +1 -0
- package/src/common/uuid.js +30 -0
- package/src/config/FileLogWriter.d.ts +22 -0
- package/src/config/FileLogWriter.d.ts.map +1 -0
- package/src/config/FileLogWriter.js +192 -0
- package/src/config/SecretsManager.d.ts.map +1 -1
- package/src/config/SecretsManager.js +37 -11
- package/src/config/StartupConfigValidator.d.ts +15 -0
- package/src/config/StartupConfigValidator.d.ts.map +1 -0
- package/src/config/StartupConfigValidator.js +86 -0
- package/src/config/app.d.ts +2 -1
- package/src/config/app.d.ts.map +1 -1
- package/src/config/app.js +65 -15
- package/src/config/broadcast.d.ts +47 -0
- package/src/config/broadcast.d.ts.map +1 -0
- package/src/config/broadcast.js +54 -0
- package/src/config/cache.d.ts +13 -17
- package/src/config/cache.d.ts.map +1 -1
- package/src/config/cache.js +9 -11
- package/src/config/cloudflare.d.ts +26 -0
- package/src/config/cloudflare.d.ts.map +1 -0
- package/src/config/cloudflare.js +38 -0
- package/src/config/env.d.ts +6 -0
- package/src/config/env.d.ts.map +1 -1
- package/src/config/env.js +6 -0
- package/src/config/index.d.ts +52 -28
- package/src/config/index.d.ts.map +1 -1
- package/src/config/index.js +3 -0
- package/src/config/logger.d.ts +2 -0
- package/src/config/logger.d.ts.map +1 -1
- package/src/config/logger.js +270 -11
- package/src/config/logging/HttpLogger.d.ts +23 -0
- package/src/config/logging/HttpLogger.d.ts.map +1 -0
- package/src/config/logging/HttpLogger.js +93 -0
- package/src/config/logging/KvLogger.d.ts +22 -0
- package/src/config/logging/KvLogger.d.ts.map +1 -0
- package/src/config/logging/KvLogger.js +143 -0
- package/src/config/logging/SlackLogger.d.ts +23 -0
- package/src/config/logging/SlackLogger.d.ts.map +1 -0
- package/src/config/logging/SlackLogger.js +119 -0
- package/src/config/mail.d.ts +81 -0
- package/src/config/mail.d.ts.map +1 -0
- package/src/config/mail.js +73 -0
- package/src/config/middleware.d.ts +8 -0
- package/src/config/middleware.d.ts.map +1 -0
- package/src/config/middleware.js +18 -0
- package/src/config/notification.d.ts +62 -0
- package/src/config/notification.d.ts.map +1 -0
- package/src/config/notification.js +43 -0
- package/src/config/security.d.ts.map +1 -1
- package/src/config/security.js +2 -2
- package/src/config/startup.d.ts +23 -0
- package/src/config/startup.d.ts.map +1 -0
- package/src/config/startup.js +15 -0
- package/src/config/storage.d.ts +21 -35
- package/src/config/storage.d.ts.map +1 -1
- package/src/config/storage.js +57 -37
- package/src/database/migrations/index.d.ts +1 -1
- package/src/database/migrations/index.d.ts.map +1 -1
- package/src/database/migrations/index.js +2 -1
- package/src/features/Queue.js +1 -25
- package/src/health/RuntimeHealthProbes.d.ts +13 -0
- package/src/health/RuntimeHealthProbes.d.ts.map +1 -0
- package/src/health/RuntimeHealthProbes.js +62 -0
- package/src/health/StartupHealthChecks.d.ts +26 -0
- package/src/health/StartupHealthChecks.d.ts.map +1 -0
- package/src/health/StartupHealthChecks.js +124 -0
- package/src/http/ErrorResponse.d.ts +28 -0
- package/src/http/ErrorResponse.d.ts.map +1 -0
- package/src/http/ErrorResponse.js +42 -0
- package/src/http/Kernel.d.ts +5 -0
- package/src/http/Kernel.d.ts.map +1 -1
- package/src/http/Kernel.js +96 -30
- package/src/http/RequestContext.d.ts +20 -0
- package/src/http/RequestContext.d.ts.map +1 -0
- package/src/http/RequestContext.js +77 -0
- package/src/index.d.ts +9 -1
- package/src/index.d.ts.map +1 -1
- package/src/index.js +8 -2
- package/src/microservices/MicroserviceManager.d.ts.map +1 -1
- package/src/microservices/MicroserviceManager.js +9 -6
- package/src/microservices/PostgresAdapter.d.ts.map +1 -1
- package/src/microservices/PostgresAdapter.js +3 -1
- package/src/microservices/ServiceBundler.d.ts.map +1 -1
- package/src/microservices/ServiceBundler.js +6 -4
- package/src/microservices/ServiceHealthMonitor.js +2 -2
- package/src/middleware/CsrfMiddleware.d.ts.map +1 -1
- package/src/middleware/CsrfMiddleware.js +2 -19
- package/src/middleware/ErrorHandlerMiddleware.d.ts +6 -0
- package/src/middleware/ErrorHandlerMiddleware.d.ts.map +1 -0
- package/src/middleware/ErrorHandlerMiddleware.js +33 -0
- package/src/middleware/LoggingMiddleware.d.ts +9 -0
- package/src/middleware/LoggingMiddleware.d.ts.map +1 -0
- package/src/middleware/LoggingMiddleware.js +36 -0
- package/src/middleware/index.d.ts +2 -0
- package/src/middleware/index.d.ts.map +1 -1
- package/src/middleware/index.js +2 -0
- package/src/node-singletons/async_hooks.d.ts +9 -0
- package/src/node-singletons/async_hooks.d.ts.map +1 -0
- package/src/node-singletons/async_hooks.js +8 -0
- package/src/node-singletons/fs.d.ts +2 -2
- package/src/node-singletons/fs.d.ts.map +1 -1
- package/src/node-singletons/fs.js +2 -2
- package/src/node-singletons/http.d.ts +1 -1
- package/src/node-singletons/http.d.ts.map +1 -1
- package/src/node-singletons/http.js +1 -1
- package/src/node-singletons/index.d.ts +4 -0
- package/src/node-singletons/index.d.ts.map +1 -1
- package/src/node-singletons/index.js +4 -0
- package/src/node-singletons/net.d.ts +9 -0
- package/src/node-singletons/net.d.ts.map +1 -0
- package/src/node-singletons/net.js +8 -0
- package/src/node-singletons/os.d.ts +3 -3
- package/src/node-singletons/os.d.ts.map +1 -1
- package/src/node-singletons/os.js +3 -4
- package/src/node-singletons/path.d.ts +3 -1
- package/src/node-singletons/path.d.ts.map +1 -1
- package/src/node-singletons/path.js +3 -1
- package/src/node-singletons/perf-hooks.d.ts +3 -1
- package/src/node-singletons/perf-hooks.d.ts.map +1 -1
- package/src/node-singletons/perf-hooks.js +3 -1
- package/src/node-singletons/process.d.ts +23 -0
- package/src/node-singletons/process.d.ts.map +1 -0
- package/src/node-singletons/process.js +8 -0
- package/src/node-singletons/readline.d.ts +3 -3
- package/src/node-singletons/readline.d.ts.map +1 -1
- package/src/node-singletons/readline.js +3 -4
- package/src/node-singletons/tls.d.ts +9 -0
- package/src/node-singletons/tls.d.ts.map +1 -0
- package/src/node-singletons/tls.js +8 -0
- package/src/node-singletons/url.d.ts +3 -1
- package/src/node-singletons/url.d.ts.map +1 -1
- package/src/node-singletons/url.js +3 -1
- package/src/orm/ConnectionManager.d.ts +6 -1
- package/src/orm/ConnectionManager.d.ts.map +1 -1
- package/src/orm/ConnectionManager.js +14 -0
- package/src/orm/DatabaseAdapter.d.ts +6 -0
- package/src/orm/DatabaseAdapter.d.ts.map +1 -1
- package/src/orm/QueryBuilder.d.ts +8 -1
- package/src/orm/QueryBuilder.d.ts.map +1 -1
- package/src/orm/QueryBuilder.js +188 -28
- package/src/orm/adapters/D1Adapter.d.ts.map +1 -1
- package/src/orm/adapters/D1Adapter.js +18 -12
- package/src/orm/adapters/MySQLAdapter.d.ts.map +1 -1
- package/src/orm/adapters/MySQLAdapter.js +4 -0
- package/src/orm/adapters/PostgreSQLAdapter.d.ts.map +1 -1
- package/src/orm/adapters/PostgreSQLAdapter.js +4 -0
- package/src/orm/adapters/SQLServerAdapter.d.ts.map +1 -1
- package/src/orm/adapters/SQLServerAdapter.js +4 -0
- package/src/orm/adapters/SQLiteAdapter.d.ts.map +1 -1
- package/src/orm/adapters/SQLiteAdapter.js +4 -0
- package/src/performance/CodeGenerationBenchmark.js +3 -3
- package/src/performance/Optimizer.d.ts +1 -1
- package/src/performance/Optimizer.d.ts.map +1 -1
- package/src/performance/Optimizer.js +150 -75
- package/src/performance/establish-baseline.js +3 -3
- package/src/runtime/PluginManager.d.ts +3 -1
- package/src/runtime/PluginManager.d.ts.map +1 -1
- package/src/runtime/PluginManager.js +124 -28
- package/src/runtime/RuntimeDetector.d.ts.map +1 -1
- package/src/runtime/RuntimeDetector.js +47 -6
- package/src/runtime/adapters/CloudflareAdapter.js +2 -2
- package/src/runtime/adapters/FargateAdapter.d.ts.map +1 -1
- package/src/runtime/adapters/FargateAdapter.js +2 -1
- package/src/runtime/adapters/LambdaAdapter.d.ts.map +1 -1
- package/src/runtime/adapters/LambdaAdapter.js +4 -2
- package/src/runtime/adapters/NodeServerAdapter.d.ts.map +1 -1
- package/src/runtime/adapters/NodeServerAdapter.js +2 -1
- package/src/scheduler/ScheduleRunner.d.ts +18 -0
- package/src/scheduler/ScheduleRunner.d.ts.map +1 -0
- package/src/scheduler/ScheduleRunner.js +155 -0
- package/src/scheduler/index.d.ts +3 -0
- package/src/scheduler/index.d.ts.map +1 -0
- package/src/scheduler/index.js +1 -0
- package/src/scheduler/types.d.ts +16 -0
- package/src/scheduler/types.d.ts.map +1 -0
- package/src/scheduler/types.js +4 -0
- package/src/schedules/index.d.ts +2 -0
- package/src/schedules/index.d.ts.map +1 -0
- package/src/schedules/index.js +1 -0
- package/src/schedules/log-cleanup.d.ts +4 -0
- package/src/schedules/log-cleanup.d.ts.map +1 -0
- package/src/schedules/log-cleanup.js +18 -0
- package/src/scripts/GenerateEnvArtifacts.d.ts +13 -0
- package/src/scripts/GenerateEnvArtifacts.d.ts.map +1 -0
- package/src/scripts/GenerateEnvArtifacts.js +171 -0
- package/src/scripts/TemplateSync.js +109 -70
- package/src/security/CsrfTokenManager.js +1 -1
- package/src/security/Encryptor.js +1 -1
- package/src/security/Hash.d.ts +14 -0
- package/src/security/Hash.d.ts.map +1 -0
- package/src/security/Hash.js +81 -0
- package/src/security/StartupSecretValidation.d.ts +20 -0
- package/src/security/StartupSecretValidation.d.ts.map +1 -0
- package/src/security/StartupSecretValidation.js +61 -0
- package/src/security/UrlValidator.d.ts +0 -1
- package/src/security/UrlValidator.d.ts.map +1 -1
- package/src/security/UrlValidator.js +1 -2
- package/src/security/Xss.d.ts +14 -0
- package/src/security/Xss.d.ts.map +1 -0
- package/src/security/Xss.js +57 -0
- package/src/security/XssProtection.d.ts.map +1 -1
- package/src/security/XssProtection.js +155 -17
- package/src/templates/adapters/MySQLAdapter.ts.tpl +5 -0
- package/src/templates/adapters/PostgreSQLAdapter.ts.tpl +5 -0
- package/src/templates/adapters/SQLServerAdapter.ts.tpl +5 -0
- package/src/templates/adapters/SQLiteAdapter.ts.tpl +5 -0
- package/src/templates/features/Queue.ts.tpl +1 -29
- package/src/templates/project/basic/.env.example.tpl +48 -0
- package/src/templates/project/basic/.env.tpl +89 -94
- package/src/templates/project/basic/app/Toolkit/Broadcast/sendBroadcast.ts.tpl +7 -0
- package/src/templates/project/basic/app/Toolkit/Mail/sendWelcomeEmail.ts.tpl +30 -0
- package/src/templates/project/basic/app/Toolkit/Notification/sendSlackNotification.ts.tpl +10 -0
- package/src/templates/project/basic/app/Toolkit/Notification/sendSms.ts.tpl +13 -0
- package/src/templates/project/basic/config/FileLogWriter.ts.tpl +240 -0
- package/src/templates/project/basic/config/SecretsManager.ts.tpl +44 -21
- package/src/templates/project/basic/config/StartupConfigValidator.ts.tpl +151 -0
- package/src/templates/project/basic/config/app.ts.tpl +84 -15
- package/src/templates/project/basic/config/broadcast.ts.tpl +97 -0
- package/src/templates/project/basic/config/cache.ts.tpl +19 -23
- package/src/templates/project/basic/config/cloudflare.ts.tpl +57 -0
- package/src/templates/project/basic/config/env.ts.tpl +7 -1
- package/src/templates/project/basic/config/index.ts.tpl +3 -0
- package/src/templates/project/basic/config/logger.ts.tpl +301 -11
- package/src/templates/project/basic/config/logging/HttpLogger.ts.tpl +121 -0
- package/src/templates/project/basic/config/logging/KvLogger.ts.tpl +181 -0
- package/src/templates/project/basic/config/logging/SlackLogger.ts.tpl +156 -0
- package/src/templates/project/basic/config/mail.ts.tpl +141 -0
- package/src/templates/project/basic/config/middleware.ts.tpl +27 -0
- package/src/templates/project/basic/config/notification.ts.tpl +86 -0
- package/src/templates/project/basic/config/security.ts.tpl +4 -5
- package/src/templates/project/basic/config/startup.ts.tpl +27 -0
- package/src/templates/project/basic/config/storage.ts.tpl +77 -42
- package/src/templates/project/basic/database/migrations/index.ts.tpl +1 -1
- package/src/templates/project/basic/package.json.tpl +1 -1
- package/src/templates/project/basic/routes/api.ts.tpl +11 -37
- package/src/templates/project/basic/routes/broadcast.ts.tpl +32 -0
- package/src/templates/project/basic/routes/health.ts.tpl +134 -0
- package/src/templates/project/basic/routes/storage.ts.tpl +42 -0
- package/src/templates/project/basic/src/index.ts.tpl +38 -11
- package/src/templates/project/basic/template.json +3 -0
- package/src/toolkit/Secrets/EnvFile.d.ts +15 -0
- package/src/toolkit/Secrets/EnvFile.d.ts.map +1 -0
- package/src/toolkit/Secrets/EnvFile.js +63 -0
- package/src/toolkit/Secrets/Manifest.d.ts +24 -0
- package/src/toolkit/Secrets/Manifest.d.ts.map +1 -0
- package/src/toolkit/Secrets/Manifest.js +71 -0
- package/src/toolkit/Secrets/index.d.ts +42 -0
- package/src/toolkit/Secrets/index.d.ts.map +1 -0
- package/src/toolkit/Secrets/index.js +119 -0
- package/src/toolkit/Secrets/providers/AwsSecretsManager.d.ts +14 -0
- package/src/toolkit/Secrets/providers/AwsSecretsManager.d.ts.map +1 -0
- package/src/toolkit/Secrets/providers/AwsSecretsManager.js +131 -0
- package/src/toolkit/Secrets/providers/CloudflareKv.d.ts +9 -0
- package/src/toolkit/Secrets/providers/CloudflareKv.d.ts.map +1 -0
- package/src/toolkit/Secrets/providers/CloudflareKv.js +73 -0
- package/src/tools/broadcast/Broadcast.d.ts +7 -0
- package/src/tools/broadcast/Broadcast.d.ts.map +1 -0
- package/src/tools/broadcast/Broadcast.js +37 -0
- package/src/tools/broadcast/drivers/BaseDriver.d.ts +5 -0
- package/src/tools/broadcast/drivers/BaseDriver.d.ts.map +1 -0
- package/src/tools/broadcast/drivers/BaseDriver.js +8 -0
- package/src/tools/broadcast/drivers/InMemory.d.ts +18 -0
- package/src/tools/broadcast/drivers/InMemory.d.ts.map +1 -0
- package/src/tools/broadcast/drivers/InMemory.js +16 -0
- package/src/tools/broadcast/drivers/Pusher.d.ts +8 -0
- package/src/tools/broadcast/drivers/Pusher.d.ts.map +1 -0
- package/src/tools/broadcast/drivers/Pusher.js +75 -0
- package/src/tools/broadcast/drivers/Redis.d.ts +19 -0
- package/src/tools/broadcast/drivers/Redis.d.ts.map +1 -0
- package/src/tools/broadcast/drivers/Redis.js +73 -0
- package/src/tools/broadcast/drivers/RedisHttps.d.ts +14 -0
- package/src/tools/broadcast/drivers/RedisHttps.d.ts.map +1 -0
- package/src/tools/broadcast/drivers/RedisHttps.js +50 -0
- package/src/tools/broadcast/index.d.ts +7 -0
- package/src/tools/broadcast/index.d.ts.map +1 -0
- package/src/tools/broadcast/index.js +6 -0
- package/src/tools/http/Http.d.ts +49 -0
- package/src/tools/http/Http.d.ts.map +1 -0
- package/src/tools/http/Http.js +169 -0
- package/src/tools/http/HttpResponse.d.ts +32 -0
- package/src/tools/http/HttpResponse.d.ts.map +1 -0
- package/src/tools/http/HttpResponse.js +80 -0
- package/src/tools/http/index.d.ts +15 -0
- package/src/tools/http/index.d.ts.map +1 -0
- package/src/tools/http/index.js +9 -0
- package/src/tools/mail/Mail.d.ts +22 -0
- package/src/tools/mail/Mail.d.ts.map +1 -0
- package/src/tools/mail/Mail.js +105 -0
- package/src/tools/mail/attachments.d.ts +23 -0
- package/src/tools/mail/attachments.d.ts.map +1 -0
- package/src/tools/mail/attachments.js +26 -0
- package/src/tools/mail/drivers/BaseDriver.d.ts +5 -0
- package/src/tools/mail/drivers/BaseDriver.d.ts.map +1 -0
- package/src/tools/mail/drivers/BaseDriver.js +8 -0
- package/src/tools/mail/drivers/Mailgun.d.ts +31 -0
- package/src/tools/mail/drivers/Mailgun.d.ts.map +1 -0
- package/src/tools/mail/drivers/Mailgun.js +81 -0
- package/src/tools/mail/drivers/SendGrid.d.ts +29 -0
- package/src/tools/mail/drivers/SendGrid.d.ts.map +1 -0
- package/src/tools/mail/drivers/SendGrid.js +57 -0
- package/src/tools/mail/drivers/Ses.d.ts +24 -0
- package/src/tools/mail/drivers/Ses.d.ts.map +1 -0
- package/src/tools/mail/drivers/Ses.js +116 -0
- package/src/tools/mail/drivers/Smtp.d.ts +38 -0
- package/src/tools/mail/drivers/Smtp.d.ts.map +1 -0
- package/src/tools/mail/drivers/Smtp.js +327 -0
- package/src/tools/mail/templates/index.d.ts +27 -0
- package/src/tools/mail/templates/index.d.ts.map +1 -0
- package/src/tools/mail/templates/index.js +35 -0
- package/src/tools/mail/templates/markdown/index.d.ts +17 -0
- package/src/tools/mail/templates/markdown/index.d.ts.map +1 -0
- package/src/tools/mail/templates/markdown/index.js +49 -0
- package/src/tools/mail/templates/markdown/registry.d.ts +15 -0
- package/src/tools/mail/templates/markdown/registry.d.ts.map +1 -0
- package/src/tools/mail/templates/markdown/registry.js +34 -0
- package/src/tools/mail/templates/markdown/validator.d.ts +16 -0
- package/src/tools/mail/templates/markdown/validator.d.ts.map +1 -0
- package/src/tools/mail/templates/markdown/validator.js +24 -0
- package/src/tools/mail/testing.d.ts +41 -0
- package/src/tools/mail/testing.d.ts.map +1 -0
- package/src/tools/mail/testing.js +34 -0
- package/src/tools/notification/Driver.d.ts +11 -0
- package/src/tools/notification/Driver.d.ts.map +1 -0
- package/src/tools/notification/Driver.js +1 -0
- package/src/tools/notification/Notification.d.ts +11 -0
- package/src/tools/notification/Notification.d.ts.map +1 -0
- package/src/tools/notification/Notification.js +11 -0
- package/src/tools/notification/Registry.d.ts +10 -0
- package/src/tools/notification/Registry.d.ts.map +1 -0
- package/src/tools/notification/Registry.js +22 -0
- package/src/tools/notification/Service.d.ts +6 -0
- package/src/tools/notification/Service.d.ts.map +1 -0
- package/src/tools/notification/Service.js +18 -0
- package/src/tools/notification/config.d.ts +5 -0
- package/src/tools/notification/config.d.ts.map +1 -0
- package/src/tools/notification/config.js +5 -0
- package/src/tools/notification/drivers/BaseDriver.d.ts +5 -0
- package/src/tools/notification/drivers/BaseDriver.d.ts.map +1 -0
- package/src/tools/notification/drivers/BaseDriver.js +8 -0
- package/src/tools/notification/drivers/Console.d.ts +7 -0
- package/src/tools/notification/drivers/Console.d.ts.map +1 -0
- package/src/tools/notification/drivers/Console.js +13 -0
- package/src/tools/notification/drivers/Slack.d.ts +16 -0
- package/src/tools/notification/drivers/Slack.d.ts.map +1 -0
- package/src/tools/notification/drivers/Slack.js +24 -0
- package/src/tools/notification/drivers/Termii.d.ts +10 -0
- package/src/tools/notification/drivers/Termii.d.ts.map +1 -0
- package/src/tools/notification/drivers/Termii.js +47 -0
- package/src/tools/notification/drivers/Twilio.d.ts +21 -0
- package/src/tools/notification/drivers/Twilio.d.ts.map +1 -0
- package/src/tools/notification/drivers/Twilio.js +48 -0
- package/src/tools/notification/templates/markdown/index.d.ts +15 -0
- package/src/tools/notification/templates/markdown/index.d.ts.map +1 -0
- package/src/tools/notification/templates/markdown/index.js +38 -0
- package/src/tools/notification/templates/markdown/registry.d.ts +15 -0
- package/src/tools/notification/templates/markdown/registry.d.ts.map +1 -0
- package/src/tools/notification/templates/markdown/registry.js +36 -0
- package/src/tools/notification/testing.d.ts +19 -0
- package/src/tools/notification/testing.d.ts.map +1 -0
- package/src/tools/notification/testing.js +35 -0
- package/src/tools/notification/testingHelpers.d.ts +12 -0
- package/src/tools/notification/testingHelpers.d.ts.map +1 -0
- package/src/tools/notification/testingHelpers.js +32 -0
- package/src/tools/queue/Queue.d.ts +23 -0
- package/src/tools/queue/Queue.d.ts.map +1 -0
- package/src/tools/queue/Queue.js +38 -0
- package/src/tools/queue/drivers/InMemory.d.ts +10 -0
- package/src/tools/queue/drivers/InMemory.d.ts.map +1 -0
- package/src/tools/queue/drivers/InMemory.js +55 -0
- package/src/tools/queue/drivers/Redis.d.ts +10 -0
- package/src/tools/queue/drivers/Redis.d.ts.map +1 -0
- package/src/tools/queue/drivers/Redis.js +91 -0
- package/src/tools/storage/LocalSignedUrl.d.ts +12 -0
- package/src/tools/storage/LocalSignedUrl.d.ts.map +1 -0
- package/src/tools/storage/LocalSignedUrl.js +108 -0
- package/src/tools/storage/drivers/Gcs.d.ts +20 -0
- package/src/tools/storage/drivers/Gcs.d.ts.map +1 -0
- package/src/tools/storage/drivers/Gcs.js +152 -0
- package/src/tools/storage/drivers/Local.d.ts +18 -0
- package/src/tools/storage/drivers/Local.d.ts.map +1 -0
- package/src/tools/storage/drivers/Local.js +89 -0
- package/src/tools/storage/drivers/R2.d.ts +20 -0
- package/src/tools/storage/drivers/R2.d.ts.map +1 -0
- package/src/tools/storage/drivers/R2.js +73 -0
- package/src/tools/storage/drivers/S3.d.ts +26 -0
- package/src/tools/storage/drivers/S3.d.ts.map +1 -0
- package/src/tools/storage/drivers/S3.js +258 -0
- package/src/tools/storage/index.d.ts +24 -0
- package/src/tools/storage/index.d.ts.map +1 -0
- package/src/tools/storage/index.js +111 -0
- package/src/tools/storage/testing.d.ts +23 -0
- package/src/tools/storage/testing.d.ts.map +1 -0
- package/src/tools/storage/testing.js +52 -0
- package/src/tools/templates/MarkdownRenderer.d.ts +14 -0
- package/src/tools/templates/MarkdownRenderer.d.ts.map +1 -0
- package/src/tools/templates/MarkdownRenderer.js +300 -0
- package/src/tools/templates/index.d.ts +5 -0
- package/src/tools/templates/index.d.ts.map +1 -0
- package/src/tools/templates/index.js +4 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type RedisHttpsBroadcastDriverConfig = {
|
|
2
|
+
driver: 'redishttps';
|
|
3
|
+
endpoint: string;
|
|
4
|
+
token: string;
|
|
5
|
+
channelPrefix: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const RedisHttpsDriver: Readonly<{
|
|
8
|
+
send(config: RedisHttpsBroadcastDriverConfig, channel: string, event: string, data: unknown): Promise<{
|
|
9
|
+
ok: boolean;
|
|
10
|
+
published: number | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
}>;
|
|
13
|
+
export default RedisHttpsDriver;
|
|
14
|
+
//# sourceMappingURL=RedisHttps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedisHttps.d.ts","sourceRoot":"","sources":["../../../../../src/tools/broadcast/drivers/RedisHttps.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAsBF,eAAO,MAAM,gBAAgB;iBAEjB,+BAA+B,WAC9B,MAAM,SACR,MAAM,QACP,OAAO;;;;EAmCf,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Env } from '../../../config/env';
|
|
2
|
+
import { ErrorFactory } from '../../../exceptions/ZintrustError';
|
|
3
|
+
import { HttpClient } from '../../http/Http';
|
|
4
|
+
const normalizePrefix = (value) => {
|
|
5
|
+
const prefix = (value ?? '').trim();
|
|
6
|
+
return prefix || 'broadcast:';
|
|
7
|
+
};
|
|
8
|
+
const validateConfig = (config) => {
|
|
9
|
+
const endpoint = (config.endpoint ?? '').trim();
|
|
10
|
+
const token = (config.token ?? '').trim();
|
|
11
|
+
if (!endpoint) {
|
|
12
|
+
throw ErrorFactory.createConfigError('Redis HTTPS broadcast driver requires REDIS_HTTPS_ENDPOINT');
|
|
13
|
+
}
|
|
14
|
+
if (!token) {
|
|
15
|
+
throw ErrorFactory.createConfigError('Redis HTTPS broadcast driver requires REDIS_HTTPS_TOKEN');
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export const RedisHttpsDriver = Object.freeze({
|
|
19
|
+
async send(config, channel, event, data) {
|
|
20
|
+
validateConfig(config);
|
|
21
|
+
let message;
|
|
22
|
+
try {
|
|
23
|
+
message = JSON.stringify({ event, data });
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
throw ErrorFactory.createTryCatchError('Failed to serialize broadcast payload', err);
|
|
27
|
+
}
|
|
28
|
+
const fullChannel = `${normalizePrefix(config.channelPrefix)}${channel}`;
|
|
29
|
+
const timeout = Env.getInt('REDIS_HTTPS_TIMEOUT', 5000);
|
|
30
|
+
const response = await HttpClient.post(config.endpoint, {
|
|
31
|
+
command: 'PUBLISH',
|
|
32
|
+
channel: fullChannel,
|
|
33
|
+
message,
|
|
34
|
+
})
|
|
35
|
+
.withAuth(config.token)
|
|
36
|
+
.withTimeout(timeout)
|
|
37
|
+
.send();
|
|
38
|
+
response.throwIfServerError();
|
|
39
|
+
response.throwIfClientError();
|
|
40
|
+
const published = (() => {
|
|
41
|
+
const trimmed = response.body.trim();
|
|
42
|
+
const asNum = Number(trimmed);
|
|
43
|
+
if (!Number.isFinite(asNum))
|
|
44
|
+
return undefined;
|
|
45
|
+
return asNum;
|
|
46
|
+
})();
|
|
47
|
+
return { ok: true, published };
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
export default RedisHttpsDriver;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Broadcast } from './Broadcast';
|
|
2
|
+
export { BaseDriver } from './drivers/BaseDriver';
|
|
3
|
+
export { InMemoryDriver } from './drivers/InMemory';
|
|
4
|
+
export { PusherDriver } from './drivers/Pusher';
|
|
5
|
+
export { RedisDriver } from './drivers/Redis';
|
|
6
|
+
export { RedisHttpsDriver } from './drivers/RedisHttps';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tools/broadcast/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Broadcast } from './Broadcast';
|
|
2
|
+
export { BaseDriver } from './drivers/BaseDriver';
|
|
3
|
+
export { InMemoryDriver } from './drivers/InMemory';
|
|
4
|
+
export { PusherDriver } from './drivers/Pusher';
|
|
5
|
+
export { RedisDriver } from './drivers/Redis';
|
|
6
|
+
export { RedisHttpsDriver } from './drivers/RedisHttps';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Http Client - Fluent HTTP request builder
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* await HttpClient.get('https://api.example.com/users').withAuth(token).send();
|
|
6
|
+
* await HttpClient.post('https://api.example.com/users', data).withTimeout(5000).send();
|
|
7
|
+
*/
|
|
8
|
+
import { type IHttpResponse } from './HttpResponse';
|
|
9
|
+
export type { IHttpResponse } from './HttpResponse';
|
|
10
|
+
/**
|
|
11
|
+
* HTTP Request builder interface
|
|
12
|
+
*/
|
|
13
|
+
export interface IHttpRequest {
|
|
14
|
+
withHeader(name: string, value: string): IHttpRequest;
|
|
15
|
+
withHeaders(headers: Record<string, string>): IHttpRequest;
|
|
16
|
+
withAuth(token: string, scheme?: 'Bearer' | 'Basic'): IHttpRequest;
|
|
17
|
+
withBasicAuth(username: string, password: string): IHttpRequest;
|
|
18
|
+
withTimeout(ms: number): IHttpRequest;
|
|
19
|
+
asJson(): IHttpRequest;
|
|
20
|
+
asForm(): IHttpRequest;
|
|
21
|
+
send(): Promise<IHttpResponse>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* HTTP Client - Sealed namespace for making HTTP requests
|
|
25
|
+
*/
|
|
26
|
+
export declare const HttpClient: Readonly<{
|
|
27
|
+
/**
|
|
28
|
+
* Make GET request
|
|
29
|
+
*/
|
|
30
|
+
get(url: string): IHttpRequest;
|
|
31
|
+
/**
|
|
32
|
+
* Make POST request
|
|
33
|
+
*/
|
|
34
|
+
post(url: string, data?: Record<string, unknown>): IHttpRequest;
|
|
35
|
+
/**
|
|
36
|
+
* Make PUT request
|
|
37
|
+
*/
|
|
38
|
+
put(url: string, data?: Record<string, unknown>): IHttpRequest;
|
|
39
|
+
/**
|
|
40
|
+
* Make PATCH request
|
|
41
|
+
*/
|
|
42
|
+
patch(url: string, data?: Record<string, unknown>): IHttpRequest;
|
|
43
|
+
/**
|
|
44
|
+
* Make DELETE request
|
|
45
|
+
*/
|
|
46
|
+
delete(url: string, data?: Record<string, unknown>): IHttpRequest;
|
|
47
|
+
}>;
|
|
48
|
+
export default HttpClient;
|
|
49
|
+
//# sourceMappingURL=Http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Http.d.ts","sourceRoot":"","sources":["../../../../src/tools/http/Http.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAElF,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,CAAC;IACtD,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,YAAY,CAAC;IAC3D,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,YAAY,CAAC;IACnE,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,YAAY,CAAC;IAChE,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,YAAY,CAAC;IACtC,MAAM,IAAI,YAAY,CAAC;IACvB,MAAM,IAAI,YAAY,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CAChC;AAiJD;;GAEG;AACH,eAAO,MAAM,UAAU;IACrB;;OAEG;aACM,MAAM,GAAG,YAAY;IAI9B;;OAEG;cACO,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY;IAQ/D;;OAEG;aACM,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY;IAQ9D;;OAEG;eACQ,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY;IAQhE;;OAEG;gBACS,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY;EAOjE,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Http Client - Fluent HTTP request builder
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* await HttpClient.get('https://api.example.com/users').withAuth(token).send();
|
|
6
|
+
* await HttpClient.post('https://api.example.com/users', data).withTimeout(5000).send();
|
|
7
|
+
*/
|
|
8
|
+
import { Env } from '../../config/env';
|
|
9
|
+
import { Logger } from '../../config/logger';
|
|
10
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
11
|
+
import { createHttpResponse } from './HttpResponse';
|
|
12
|
+
/**
|
|
13
|
+
* Perform the actual request for a given state. Separated to keep the builder small
|
|
14
|
+
*/
|
|
15
|
+
async function performRequest(state) {
|
|
16
|
+
const timeout = state.timeout ?? Env.getInt('HTTP_TIMEOUT', 30000);
|
|
17
|
+
const controller = new AbortController();
|
|
18
|
+
let timeoutId;
|
|
19
|
+
if (timeout > 0) {
|
|
20
|
+
timeoutId = globalThis.setTimeout(() => controller.abort(), timeout);
|
|
21
|
+
}
|
|
22
|
+
const buildInit = () => {
|
|
23
|
+
const init = {
|
|
24
|
+
method: state.method,
|
|
25
|
+
headers: state.headers,
|
|
26
|
+
signal: controller.signal,
|
|
27
|
+
};
|
|
28
|
+
if (state.body !== undefined &&
|
|
29
|
+
state.body !== null &&
|
|
30
|
+
['POST', 'PUT', 'PATCH'].includes(state.method)) {
|
|
31
|
+
init.body = state.body;
|
|
32
|
+
}
|
|
33
|
+
return init;
|
|
34
|
+
};
|
|
35
|
+
try {
|
|
36
|
+
const init = buildInit();
|
|
37
|
+
const startTime = Date.now();
|
|
38
|
+
const response = await globalThis.fetch(state.url, init);
|
|
39
|
+
const responseBody = await response.text();
|
|
40
|
+
const duration = Date.now() - startTime;
|
|
41
|
+
Logger.debug(`HTTP ${state.method} ${state.url}`, {
|
|
42
|
+
status: response.status,
|
|
43
|
+
duration: `${duration}ms`,
|
|
44
|
+
size: responseBody.length,
|
|
45
|
+
});
|
|
46
|
+
return createHttpResponse(response, responseBody);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
50
|
+
throw ErrorFactory.createConnectionError(`HTTP request timeout after ${timeout}ms`, {
|
|
51
|
+
url: state.url,
|
|
52
|
+
method: state.method,
|
|
53
|
+
timeout,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
throw ErrorFactory.createTryCatchError(`HTTP request failed: ${error.message}`, {
|
|
57
|
+
url: state.url,
|
|
58
|
+
method: state.method,
|
|
59
|
+
error: error instanceof Error ? error.message : String(error),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
if (timeoutId !== undefined) {
|
|
64
|
+
globalThis.clearTimeout(timeoutId);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Create request builder with fluent API
|
|
70
|
+
*/
|
|
71
|
+
const createRequestBuilder = (method, url, initialBody) => {
|
|
72
|
+
const state = {
|
|
73
|
+
method,
|
|
74
|
+
url,
|
|
75
|
+
headers: {
|
|
76
|
+
'User-Agent': 'Zintrust/1.0',
|
|
77
|
+
},
|
|
78
|
+
body: initialBody ? JSON.stringify(initialBody) : undefined,
|
|
79
|
+
};
|
|
80
|
+
const self = {
|
|
81
|
+
withHeader(name, value) {
|
|
82
|
+
state.headers[name] = value;
|
|
83
|
+
return self;
|
|
84
|
+
},
|
|
85
|
+
withHeaders(headers) {
|
|
86
|
+
Object.assign(state.headers, headers);
|
|
87
|
+
return self;
|
|
88
|
+
},
|
|
89
|
+
withAuth(token, scheme = 'Bearer') {
|
|
90
|
+
state.headers['Authorization'] = `${scheme} ${token}`;
|
|
91
|
+
return self;
|
|
92
|
+
},
|
|
93
|
+
withBasicAuth(username, password) {
|
|
94
|
+
const credentials = Buffer.from(`${username}:${password}`).toString('base64');
|
|
95
|
+
state.headers['Authorization'] = `Basic ${credentials}`;
|
|
96
|
+
return self;
|
|
97
|
+
},
|
|
98
|
+
withTimeout(ms) {
|
|
99
|
+
state.timeout = ms;
|
|
100
|
+
return self;
|
|
101
|
+
},
|
|
102
|
+
asJson() {
|
|
103
|
+
state.contentType = 'json';
|
|
104
|
+
state.headers['Content-Type'] = 'application/json';
|
|
105
|
+
return self;
|
|
106
|
+
},
|
|
107
|
+
asForm() {
|
|
108
|
+
state.contentType = 'form';
|
|
109
|
+
state.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
110
|
+
return self;
|
|
111
|
+
},
|
|
112
|
+
async send() {
|
|
113
|
+
return performRequest(state);
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
return self;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* HTTP Client - Sealed namespace for making HTTP requests
|
|
120
|
+
*/
|
|
121
|
+
export const HttpClient = Object.freeze({
|
|
122
|
+
/**
|
|
123
|
+
* Make GET request
|
|
124
|
+
*/
|
|
125
|
+
get(url) {
|
|
126
|
+
return createRequestBuilder('GET', url);
|
|
127
|
+
},
|
|
128
|
+
/**
|
|
129
|
+
* Make POST request
|
|
130
|
+
*/
|
|
131
|
+
post(url, data) {
|
|
132
|
+
const builder = createRequestBuilder('POST', url, data);
|
|
133
|
+
if (data) {
|
|
134
|
+
builder.asJson();
|
|
135
|
+
}
|
|
136
|
+
return builder;
|
|
137
|
+
},
|
|
138
|
+
/**
|
|
139
|
+
* Make PUT request
|
|
140
|
+
*/
|
|
141
|
+
put(url, data) {
|
|
142
|
+
const builder = createRequestBuilder('PUT', url, data);
|
|
143
|
+
if (data) {
|
|
144
|
+
builder.asJson();
|
|
145
|
+
}
|
|
146
|
+
return builder;
|
|
147
|
+
},
|
|
148
|
+
/**
|
|
149
|
+
* Make PATCH request
|
|
150
|
+
*/
|
|
151
|
+
patch(url, data) {
|
|
152
|
+
const builder = createRequestBuilder('PATCH', url, data);
|
|
153
|
+
if (data) {
|
|
154
|
+
builder.asJson();
|
|
155
|
+
}
|
|
156
|
+
return builder;
|
|
157
|
+
},
|
|
158
|
+
/**
|
|
159
|
+
* Make DELETE request
|
|
160
|
+
*/
|
|
161
|
+
delete(url, data) {
|
|
162
|
+
const builder = createRequestBuilder('DELETE', url, data);
|
|
163
|
+
if (data) {
|
|
164
|
+
builder.asJson();
|
|
165
|
+
}
|
|
166
|
+
return builder;
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
export default HttpClient;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HttpResponse - Response wrapper with utility methods
|
|
3
|
+
* Provides convenient access to response status, headers, body, and parsed JSON
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* HTTP Response interface for convenience methods
|
|
7
|
+
*/
|
|
8
|
+
export interface IHttpResponse {
|
|
9
|
+
status: number;
|
|
10
|
+
headers: Record<string, string>;
|
|
11
|
+
body: string;
|
|
12
|
+
json<T = unknown>(): T;
|
|
13
|
+
text(): string;
|
|
14
|
+
ok: boolean;
|
|
15
|
+
successful: boolean;
|
|
16
|
+
failed: boolean;
|
|
17
|
+
serverError: boolean;
|
|
18
|
+
clientError: boolean;
|
|
19
|
+
header(name: string): string | undefined;
|
|
20
|
+
hasHeader(name: string): boolean;
|
|
21
|
+
throwIfServerError(): IHttpResponse;
|
|
22
|
+
throwIfClientError(): IHttpResponse;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create HTTP response from fetch Response
|
|
26
|
+
*/
|
|
27
|
+
export declare const createHttpResponse: (response: Response, body: string) => IHttpResponse;
|
|
28
|
+
declare const _default: {
|
|
29
|
+
createHttpResponse: (response: Response, body: string) => IHttpResponse;
|
|
30
|
+
};
|
|
31
|
+
export default _default;
|
|
32
|
+
//# sourceMappingURL=HttpResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpResponse.d.ts","sourceRoot":"","sources":["../../../../src/tools/http/HttpResponse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,CAAC,GAAG,OAAO,KAAK,CAAC,CAAC;IACvB,IAAI,IAAI,MAAM,CAAC;IACf,EAAE,EAAE,OAAO,CAAC;IACZ,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACzC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACjC,kBAAkB,IAAI,aAAa,CAAC;IACpC,kBAAkB,IAAI,aAAa,CAAC;CACrC;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,QAAQ,EAAE,MAAM,MAAM,KAAG,aAmFrE,CAAC;;mCAnF2C,QAAQ,QAAQ,MAAM,KAAG,aAAa;;AAqFnF,wBAEE"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HttpResponse - Response wrapper with utility methods
|
|
3
|
+
* Provides convenient access to response status, headers, body, and parsed JSON
|
|
4
|
+
*/
|
|
5
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
6
|
+
/**
|
|
7
|
+
* Create HTTP response from fetch Response
|
|
8
|
+
*/
|
|
9
|
+
export const createHttpResponse = (response, body) => {
|
|
10
|
+
const statusCode = response.status;
|
|
11
|
+
const headers = Object.fromEntries(response.headers.entries());
|
|
12
|
+
const lowerHeaders = Object.fromEntries(Object.entries(headers).map(([key, value]) => [key.toLowerCase(), value]));
|
|
13
|
+
return {
|
|
14
|
+
get status() {
|
|
15
|
+
return statusCode;
|
|
16
|
+
},
|
|
17
|
+
get headers() {
|
|
18
|
+
return headers;
|
|
19
|
+
},
|
|
20
|
+
get body() {
|
|
21
|
+
return body;
|
|
22
|
+
},
|
|
23
|
+
json() {
|
|
24
|
+
try {
|
|
25
|
+
return JSON.parse(body);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
throw ErrorFactory.createValidationError('Failed to parse JSON response', {
|
|
29
|
+
body: body.substring(0, 200), // Truncate for logging
|
|
30
|
+
error: error instanceof Error ? error.message : String(error),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
text() {
|
|
35
|
+
return body;
|
|
36
|
+
},
|
|
37
|
+
get ok() {
|
|
38
|
+
return response.ok;
|
|
39
|
+
},
|
|
40
|
+
get successful() {
|
|
41
|
+
return statusCode >= 200 && statusCode < 300;
|
|
42
|
+
},
|
|
43
|
+
get failed() {
|
|
44
|
+
return !this.successful;
|
|
45
|
+
},
|
|
46
|
+
get serverError() {
|
|
47
|
+
return statusCode >= 500;
|
|
48
|
+
},
|
|
49
|
+
get clientError() {
|
|
50
|
+
return statusCode >= 400 && statusCode < 500;
|
|
51
|
+
},
|
|
52
|
+
header(name) {
|
|
53
|
+
return lowerHeaders[name.toLowerCase()];
|
|
54
|
+
},
|
|
55
|
+
hasHeader(name) {
|
|
56
|
+
return name.toLowerCase() in lowerHeaders;
|
|
57
|
+
},
|
|
58
|
+
throwIfServerError() {
|
|
59
|
+
if (this.serverError) {
|
|
60
|
+
throw ErrorFactory.createTryCatchError(`HTTP server error: ${this.status}`, {
|
|
61
|
+
status: this.status,
|
|
62
|
+
body: this.body.substring(0, 200),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return this;
|
|
66
|
+
},
|
|
67
|
+
throwIfClientError() {
|
|
68
|
+
if (this.clientError) {
|
|
69
|
+
throw ErrorFactory.createTryCatchError(`HTTP client error: ${this.status}`, {
|
|
70
|
+
status: this.status,
|
|
71
|
+
body: this.body.substring(0, 200),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return this;
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
export default {
|
|
79
|
+
createHttpResponse,
|
|
80
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP Client Tools - Export all HTTP utilities
|
|
3
|
+
*/
|
|
4
|
+
declare const _default: Readonly<{
|
|
5
|
+
HttpClient: Readonly<{
|
|
6
|
+
get(url: string): import("./Http").IHttpRequest;
|
|
7
|
+
post(url: string, data?: Record<string, unknown>): import("./Http").IHttpRequest;
|
|
8
|
+
put(url: string, data?: Record<string, unknown>): import("./Http").IHttpRequest;
|
|
9
|
+
patch(url: string, data?: Record<string, unknown>): import("./Http").IHttpRequest;
|
|
10
|
+
delete(url: string, data?: Record<string, unknown>): import("./Http").IHttpRequest;
|
|
11
|
+
}>;
|
|
12
|
+
createHttpResponse: (response: Response, body: string) => import("./HttpResponse").IHttpResponse;
|
|
13
|
+
}>;
|
|
14
|
+
export default _default;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tools/http/index.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;AAKH,wBAGG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type AttachmentInput } from './attachments';
|
|
2
|
+
export type SendMailInput = {
|
|
3
|
+
to: string | string[];
|
|
4
|
+
subject: string;
|
|
5
|
+
text: string;
|
|
6
|
+
html?: string;
|
|
7
|
+
from?: {
|
|
8
|
+
address?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
};
|
|
11
|
+
attachments?: AttachmentInput[];
|
|
12
|
+
};
|
|
13
|
+
export type SendMailResult = {
|
|
14
|
+
ok: boolean;
|
|
15
|
+
driver: 'sendgrid' | 'disabled' | 'smtp' | 'ses' | 'mailgun';
|
|
16
|
+
messageId?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare const Mail: Readonly<{
|
|
19
|
+
send(input: SendMailInput): Promise<SendMailResult>;
|
|
20
|
+
}>;
|
|
21
|
+
export default Mail;
|
|
22
|
+
//# sourceMappingURL=Mail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mail.d.ts","sourceRoot":"","sources":["../../../../src/tools/mail/Mail.ts"],"names":[],"mappings":"AAQA,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAG7E,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE;QACL,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAkIF,eAAO,MAAM,IAAI;gBACG,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;EAqBzD,CAAC;AAEH,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { mailConfig } from '../../config/mail';
|
|
2
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
3
|
+
import { MailgunDriver } from './drivers/Mailgun';
|
|
4
|
+
import { SendGridDriver } from './drivers/SendGrid';
|
|
5
|
+
import { SesDriver } from './drivers/Ses';
|
|
6
|
+
import { SmtpDriver } from './drivers/Smtp';
|
|
7
|
+
import { resolveAttachments } from './attachments';
|
|
8
|
+
import { Storage } from '../storage';
|
|
9
|
+
const resolveFrom = (input) => {
|
|
10
|
+
const address = input?.address ?? mailConfig.from.address;
|
|
11
|
+
const name = input?.name ?? mailConfig.from.name;
|
|
12
|
+
if (address.trim() === '') {
|
|
13
|
+
const err = ErrorFactory.createConfigError('Mail: missing from address (set MAIL_FROM_ADDRESS or pass from.address)');
|
|
14
|
+
throw err;
|
|
15
|
+
}
|
|
16
|
+
return { email: address, name: name.trim() === '' ? undefined : name };
|
|
17
|
+
};
|
|
18
|
+
function assertStorageDiskLike(value) {
|
|
19
|
+
if (typeof value !== 'object' || value === null) {
|
|
20
|
+
const err = ErrorFactory.createConfigError('Storage disk is invalid (expected object)');
|
|
21
|
+
throw err;
|
|
22
|
+
}
|
|
23
|
+
const v = value;
|
|
24
|
+
const driver = v['driver'];
|
|
25
|
+
if (typeof driver !== 'object' || driver === null) {
|
|
26
|
+
const err = ErrorFactory.createConfigError('Storage disk driver is invalid (expected object)');
|
|
27
|
+
throw err;
|
|
28
|
+
}
|
|
29
|
+
const d = driver;
|
|
30
|
+
if (typeof d['get'] !== 'function') {
|
|
31
|
+
const err = ErrorFactory.createConfigError('Storage disk driver is missing get()');
|
|
32
|
+
throw err;
|
|
33
|
+
}
|
|
34
|
+
if (typeof d['exists'] !== 'function') {
|
|
35
|
+
const err = ErrorFactory.createConfigError('Storage disk driver is missing exists()');
|
|
36
|
+
throw err;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const getDiskSafe = (disk) => {
|
|
40
|
+
const diskValue = Storage.getDisk(disk);
|
|
41
|
+
assertStorageDiskLike(diskValue);
|
|
42
|
+
return diskValue;
|
|
43
|
+
};
|
|
44
|
+
const createStorageWrapper = () => ({
|
|
45
|
+
async get(disk, path) {
|
|
46
|
+
const d = getDiskSafe(disk);
|
|
47
|
+
const result = await Promise.resolve(d.driver.get(d.config, path));
|
|
48
|
+
return result;
|
|
49
|
+
},
|
|
50
|
+
async exists(disk, path) {
|
|
51
|
+
const d = getDiskSafe(disk);
|
|
52
|
+
const result = await Promise.resolve(d.driver.exists(d.config, path));
|
|
53
|
+
return Boolean(result);
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
const sendWithDriver = async (driver, message) => {
|
|
57
|
+
if (driver.driver === 'sendgrid') {
|
|
58
|
+
const result = await SendGridDriver.send({ apiKey: driver.apiKey }, message);
|
|
59
|
+
return { ok: result.ok, driver: 'sendgrid', messageId: result.messageId };
|
|
60
|
+
}
|
|
61
|
+
if (driver.driver === 'mailgun') {
|
|
62
|
+
const result = await MailgunDriver.send({ apiKey: driver.apiKey, domain: driver.domain, baseUrl: driver.baseUrl }, message);
|
|
63
|
+
return { ok: result.ok, driver: 'mailgun', messageId: result.messageId };
|
|
64
|
+
}
|
|
65
|
+
if (driver.driver === 'smtp') {
|
|
66
|
+
const result = await SmtpDriver.send({
|
|
67
|
+
host: driver.host,
|
|
68
|
+
port: driver.port,
|
|
69
|
+
username: driver.username,
|
|
70
|
+
password: driver.password,
|
|
71
|
+
secure: driver.secure,
|
|
72
|
+
}, message);
|
|
73
|
+
return { ok: result.ok, driver: 'smtp', messageId: result.messageId };
|
|
74
|
+
}
|
|
75
|
+
if (driver.driver === 'ses') {
|
|
76
|
+
const result = await SesDriver.send({ region: driver.region }, message);
|
|
77
|
+
return { ok: result.ok, driver: 'ses', messageId: result.messageId };
|
|
78
|
+
}
|
|
79
|
+
// Config exists for future drivers, but implementations are intentionally CLI/runtime-safe and added incrementally.
|
|
80
|
+
{
|
|
81
|
+
const err = ErrorFactory.createConfigError(`Mail driver not implemented: ${mailConfig.default}`);
|
|
82
|
+
throw err;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
export const Mail = Object.freeze({
|
|
86
|
+
async send(input) {
|
|
87
|
+
const driver = mailConfig.getDriver();
|
|
88
|
+
if (driver.driver === 'disabled') {
|
|
89
|
+
const err = ErrorFactory.createConfigError('Mail driver is disabled (set MAIL_DRIVER)');
|
|
90
|
+
throw err;
|
|
91
|
+
}
|
|
92
|
+
const from = resolveFrom(input.from);
|
|
93
|
+
const storage = createStorageWrapper();
|
|
94
|
+
const attachments = await resolveAttachments(input.attachments, { storage });
|
|
95
|
+
return sendWithDriver(driver, {
|
|
96
|
+
to: input.to,
|
|
97
|
+
from,
|
|
98
|
+
subject: input.subject,
|
|
99
|
+
text: input.text,
|
|
100
|
+
html: input.html,
|
|
101
|
+
attachments,
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
export default Mail;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type DiskAttachment = {
|
|
2
|
+
disk: string;
|
|
3
|
+
path: string;
|
|
4
|
+
filename?: string;
|
|
5
|
+
};
|
|
6
|
+
export type InlineAttachment = {
|
|
7
|
+
content: Buffer | string;
|
|
8
|
+
filename: string;
|
|
9
|
+
};
|
|
10
|
+
export type AttachmentInput = DiskAttachment | InlineAttachment;
|
|
11
|
+
export type ResolvedAttachment = {
|
|
12
|
+
filename: string;
|
|
13
|
+
content: Buffer;
|
|
14
|
+
};
|
|
15
|
+
export type StorageLike = {
|
|
16
|
+
get: (disk: string, path: string) => Promise<Buffer> | Buffer;
|
|
17
|
+
exists?: (disk: string, path: string) => Promise<boolean> | boolean;
|
|
18
|
+
url?: (disk: string, path: string) => string;
|
|
19
|
+
};
|
|
20
|
+
export declare function resolveAttachments(attachments: Array<AttachmentInput> | undefined, options?: {
|
|
21
|
+
storage?: StorageLike;
|
|
22
|
+
}): Promise<ResolvedAttachment[]>;
|
|
23
|
+
//# sourceMappingURL=attachments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../../../../src/tools/mail/attachments.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAC/E,MAAM,MAAM,gBAAgB,GAAG;IAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAC9E,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,gBAAgB,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvE,MAAM,MAAM,WAAW,GAAG;IACxB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAC9D,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACpE,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CAC9C,CAAC;AAEF,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,KAAK,CAAC,eAAe,CAAC,GAAG,SAAS,EAC/C,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,WAAW,CAAA;CAAO,GACtC,OAAO,CAAC,kBAAkB,EAAE,CAAC,CA6B/B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
2
|
+
export async function resolveAttachments(attachments, options = {}) {
|
|
3
|
+
if (!attachments || attachments.length === 0)
|
|
4
|
+
return [];
|
|
5
|
+
const storage = options.storage;
|
|
6
|
+
const resolveOne = async (att) => {
|
|
7
|
+
if ('content' in att) {
|
|
8
|
+
const a = att;
|
|
9
|
+
const content = typeof a.content === 'string' ? Buffer.from(a.content) : a.content;
|
|
10
|
+
return { filename: a.filename, content };
|
|
11
|
+
}
|
|
12
|
+
// Disk-based attachment
|
|
13
|
+
const d = att;
|
|
14
|
+
if (!storage) {
|
|
15
|
+
throw ErrorFactory.createValidationError('Storage is required to resolve disk attachments');
|
|
16
|
+
}
|
|
17
|
+
const exists = storage.exists ? await Promise.resolve(storage.exists(d.disk, d.path)) : true;
|
|
18
|
+
if (!exists) {
|
|
19
|
+
throw ErrorFactory.createNotFoundError(`Attachment not found: ${d.disk}:${d.path}`);
|
|
20
|
+
}
|
|
21
|
+
const content = await Promise.resolve(storage.get(d.disk, d.path));
|
|
22
|
+
const filename = d.filename ?? d.path.split('/').pop() ?? 'attachment';
|
|
23
|
+
return { filename, content };
|
|
24
|
+
};
|
|
25
|
+
return Promise.all(attachments.map(resolveOne));
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseDriver.d.ts","sourceRoot":"","sources":["../../../../../src/tools/mail/drivers/BaseDriver.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;YACP,OAAO,CAAC,OAAO,CAAC;EAI9B,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ErrorFactory } from '../../../exceptions/ZintrustError';
|
|
2
|
+
export const BaseDriver = Object.freeze({
|
|
3
|
+
async send() {
|
|
4
|
+
await Promise.resolve();
|
|
5
|
+
throw ErrorFactory.createConfigError('Mail driver must implement send()');
|
|
6
|
+
},
|
|
7
|
+
});
|
|
8
|
+
export default BaseDriver;
|