@zintrust/core 0.1.5 → 0.1.7
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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ErrorFactory } from '../../../exceptions/ZintrustError';
|
|
2
|
-
import { createHash, createHmac } from '../../../node-singletons/crypto';
|
|
1
|
+
import { ErrorFactory } from '../../../exceptions/ZintrustError.js';
|
|
2
|
+
import { createHash, createHmac } from '../../../node-singletons/crypto.js';
|
|
3
3
|
const md5Hex = (data) => createHash('md5').update(data).digest('hex');
|
|
4
4
|
const buildQueryString = (params) => {
|
|
5
5
|
const keys = Object.keys(params).sort((a, b) => a.localeCompare(b));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Env } from '../../../config/env';
|
|
2
|
-
import { ErrorFactory } from '../../../exceptions/ZintrustError';
|
|
3
|
-
import { HttpClient } from '../../http/Http';
|
|
1
|
+
import { Env } from '../../../config/env.js';
|
|
2
|
+
import { ErrorFactory } from '../../../exceptions/ZintrustError.js';
|
|
3
|
+
import { HttpClient } from '../../http/Http.js';
|
|
4
4
|
const normalizePrefix = (value) => {
|
|
5
5
|
const prefix = (value ?? '').trim();
|
|
6
6
|
return prefix || 'broadcast:';
|
|
@@ -1,6 +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';
|
|
1
|
+
export { Broadcast } from './Broadcast.js';
|
|
2
|
+
export { BaseDriver } from './drivers/BaseDriver.js';
|
|
3
|
+
export { InMemoryDriver } from './drivers/InMemory.js';
|
|
4
|
+
export { PusherDriver } from './drivers/Pusher.js';
|
|
5
|
+
export { RedisDriver } from './drivers/Redis.js';
|
|
6
|
+
export { RedisHttpsDriver } from './drivers/RedisHttps.js';
|
package/src/tools/http/Http.js
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* await HttpClient.get('https://api.example.com/users').withAuth(token).send();
|
|
6
6
|
* await HttpClient.post('https://api.example.com/users', data).withTimeout(5000).send();
|
|
7
7
|
*/
|
|
8
|
-
import { Env } from '../../config/env';
|
|
9
|
-
import { Logger } from '../../config/logger';
|
|
10
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
11
|
-
import { createHttpResponse } from './HttpResponse';
|
|
8
|
+
import { Env } from '../../config/env.js';
|
|
9
|
+
import { Logger } from '../../config/logger.js';
|
|
10
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
11
|
+
import { createHttpResponse } from './HttpResponse.js';
|
|
12
12
|
/**
|
|
13
13
|
* Perform the actual request for a given state. Separated to keep the builder small
|
|
14
14
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* HttpResponse - Response wrapper with utility methods
|
|
3
3
|
* Provides convenient access to response status, headers, body, and parsed JSON
|
|
4
4
|
*/
|
|
5
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
5
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
6
6
|
/**
|
|
7
7
|
* Create HTTP response from fetch Response
|
|
8
8
|
*/
|
package/src/tools/http/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* HTTP Client Tools - Export all HTTP utilities
|
|
3
3
|
*/
|
|
4
|
-
import { HttpClient } from './Http';
|
|
5
|
-
import { createHttpResponse } from './HttpResponse';
|
|
4
|
+
import { HttpClient } from './Http.js';
|
|
5
|
+
import { createHttpResponse } from './HttpResponse.js';
|
|
6
6
|
export default Object.freeze({
|
|
7
7
|
HttpClient,
|
|
8
8
|
createHttpResponse,
|
package/src/tools/mail/Mail.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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';
|
|
1
|
+
import { mailConfig } from '../../config/mail.js';
|
|
2
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
3
|
+
import { MailgunDriver } from './drivers/Mailgun.js';
|
|
4
|
+
import { SendGridDriver } from './drivers/SendGrid.js';
|
|
5
|
+
import { SesDriver } from './drivers/Ses.js';
|
|
6
|
+
import { SmtpDriver } from './drivers/Smtp.js';
|
|
7
|
+
import { resolveAttachments } from './attachments.js';
|
|
8
|
+
import { Storage } from '../storage/index.js';
|
|
9
9
|
const resolveFrom = (input) => {
|
|
10
10
|
const address = input?.address ?? mailConfig.from.address;
|
|
11
11
|
const name = input?.name ?? mailConfig.from.name;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ErrorFactory } from '../../../exceptions/ZintrustError';
|
|
1
|
+
import { ErrorFactory } from '../../../exceptions/ZintrustError.js';
|
|
2
2
|
const normalizeRecipients = (to) => (Array.isArray(to) ? to : [to]);
|
|
3
3
|
const base64 = (value) => Buffer.from(value, 'utf8').toString('base64');
|
|
4
4
|
const toArrayBuffer = (buf) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ErrorFactory } from '../../../exceptions/ZintrustError';
|
|
1
|
+
import { ErrorFactory } from '../../../exceptions/ZintrustError.js';
|
|
2
2
|
const normalizeRecipients = (to) => (Array.isArray(to) ? to : [to]);
|
|
3
3
|
export const SendGridDriver = Object.freeze({
|
|
4
4
|
async send(config, message) {
|
|
@@ -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 = params.path;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { generateUuid } from '../../../common/uuid';
|
|
2
|
-
import { ErrorFactory } from '../../../exceptions/ZintrustError';
|
|
3
|
-
import * as net from '../../../node-singletons/net';
|
|
4
|
-
import * as tls from '../../../node-singletons/tls';
|
|
1
|
+
import { generateUuid } from '../../../common/uuid.js';
|
|
2
|
+
import { ErrorFactory } from '../../../exceptions/ZintrustError.js';
|
|
3
|
+
import * as net from '../../../node-singletons/net.js';
|
|
4
|
+
import * as tls from '../../../node-singletons/tls.js';
|
|
5
5
|
const normalizeRecipients = (to) => (Array.isArray(to) ? to : [to]);
|
|
6
6
|
const toBase64 = (value) => Buffer.from(value, 'utf8').toString('base64');
|
|
7
7
|
const isNodeRuntime = () => typeof process !== 'undefined' && typeof process.versions?.node === 'string';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { readFileSync } from '../../../../node-singletons/fs';
|
|
2
|
-
import { join } from '../../../../node-singletons/path';
|
|
1
|
+
import { readFileSync } from '../../../../node-singletons/fs.js';
|
|
2
|
+
import { join } from '../../../../node-singletons/path.js';
|
|
3
3
|
export const loadTemplate = (name) => {
|
|
4
4
|
// name e.g. 'auth/welcome'
|
|
5
5
|
const parts = name.split('/');
|
|
@@ -45,5 +45,5 @@ export const loadTemplate = (name) => {
|
|
|
45
45
|
const content = lines.slice(i).join('\n').trim();
|
|
46
46
|
return { content, ...meta };
|
|
47
47
|
};
|
|
48
|
-
export { listTemplates, renderTemplate } from '../../templates/markdown/registry';
|
|
48
|
+
export { listTemplates, renderTemplate } from '../../templates/markdown/registry.js';
|
|
49
49
|
export default { loadTemplate };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { loadTemplate } from '../../templates/markdown';
|
|
2
|
-
import { validateTemplateMeta } from '../../templates/markdown/validator';
|
|
3
|
-
import { readdirSync, statSync } from '../../../../node-singletons/fs';
|
|
4
|
-
import { join, relative } from '../../../../node-singletons/path';
|
|
5
|
-
import { MarkdownRenderer } from '../../../templates';
|
|
1
|
+
import { loadTemplate } from '../../templates/markdown/index.js';
|
|
2
|
+
import { validateTemplateMeta } from '../../templates/markdown/validator.js';
|
|
3
|
+
import { readdirSync, statSync } from '../../../../node-singletons/fs.js';
|
|
4
|
+
import { join, relative } from '../../../../node-singletons/path.js';
|
|
5
|
+
import { MarkdownRenderer } from '../../../templates/index.js';
|
|
6
6
|
const BASE = join(process.cwd(), 'src', 'tools', 'mail', 'templates', 'markdown');
|
|
7
7
|
const walkDir = (dir, base = dir) => {
|
|
8
8
|
const entries = readdirSync(dir);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ErrorFactory } from '../../../../exceptions/ZintrustError';
|
|
1
|
+
import { ErrorFactory } from '../../../../exceptions/ZintrustError.js';
|
|
2
2
|
export const validateTemplateMeta = (name, tpl) => {
|
|
3
3
|
if (tpl.subject === null || tpl.subject === undefined || tpl.subject.trim() === '') {
|
|
4
4
|
throw ErrorFactory.createValidationError('Template missing subject', { name });
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* A small wrapper over NotificationService to provide the expected module name.
|
|
5
5
|
*/
|
|
6
|
-
import { NotificationService } from './Service';
|
|
6
|
+
import { NotificationService } from './Service.js';
|
|
7
7
|
export const Notification = Object.freeze({
|
|
8
8
|
send: NotificationService.send,
|
|
9
9
|
listDrivers: NotificationService.listDrivers,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
2
|
-
import { ConsoleDriver } from './drivers/Console';
|
|
3
|
-
import { TermiiDriver } from './drivers/Termii';
|
|
1
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
2
|
+
import { ConsoleDriver } from './drivers/Console.js';
|
|
3
|
+
import { TermiiDriver } from './drivers/Termii.js';
|
|
4
4
|
const drivers = new Map();
|
|
5
5
|
drivers.set('termii', TermiiDriver);
|
|
6
6
|
drivers.set('console', ConsoleDriver);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
2
|
-
import { NotificationConfig } from './config';
|
|
3
|
-
import { NotificationRegistry } from './Registry';
|
|
1
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
2
|
+
import { NotificationConfig } from './config.js';
|
|
3
|
+
import { NotificationRegistry } from './Registry.js';
|
|
4
4
|
export const NotificationService = Object.freeze({
|
|
5
5
|
async send(recipient, message, options = {}) {
|
|
6
6
|
if (!recipient || typeof recipient !== 'string')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ErrorFactory } from '../../../exceptions/ZintrustError';
|
|
1
|
+
import { ErrorFactory } from '../../../exceptions/ZintrustError.js';
|
|
2
2
|
const buildUrl = (accountSid) => {
|
|
3
3
|
const base = 'https://api.twilio.com/2010-04-01/Accounts/';
|
|
4
4
|
return `${base}${accountSid}/Messages.json`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { readFileSync } from '../../../../node-singletons/fs';
|
|
2
|
-
import { join } from '../../../../node-singletons/path';
|
|
1
|
+
import { readFileSync } from '../../../../node-singletons/fs.js';
|
|
2
|
+
import { join } from '../../../../node-singletons/path.js';
|
|
3
3
|
export const loadTemplate = (name) => {
|
|
4
4
|
const parts = name.split('/');
|
|
5
5
|
const dir = join(process.cwd(), 'src', 'tools', 'notification', 'templates', 'markdown', ...parts.slice(0, -1));
|
|
@@ -34,5 +34,5 @@ export const loadTemplate = (name) => {
|
|
|
34
34
|
const content = lines.slice(i).join('\n').trim();
|
|
35
35
|
return { content, ...meta };
|
|
36
36
|
};
|
|
37
|
-
export { listTemplates, renderTemplate } from '../../templates/markdown/registry';
|
|
37
|
+
export { listTemplates, renderTemplate } from '../../templates/markdown/registry.js';
|
|
38
38
|
export default { loadTemplate };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { readdirSync, statSync } from '../../../../node-singletons/fs';
|
|
2
|
-
import { join, relative } from '../../../../node-singletons/path';
|
|
3
|
-
import { loadTemplate } from '../../templates/markdown';
|
|
4
|
-
import { MarkdownRenderer } from '../../../templates';
|
|
1
|
+
import { readdirSync, statSync } from '../../../../node-singletons/fs.js';
|
|
2
|
+
import { join, relative } from '../../../../node-singletons/path.js';
|
|
3
|
+
import { loadTemplate } from '../../templates/markdown/index.js';
|
|
4
|
+
import { MarkdownRenderer } from '../../../templates/index.js';
|
|
5
5
|
const BASE = join(process.cwd(), 'src', 'tools', 'notification', 'templates', 'markdown');
|
|
6
6
|
const walkDir = (dir, base = dir) => {
|
|
7
7
|
const entries = readdirSync(dir);
|
|
@@ -24,7 +24,7 @@ const walkDir = (dir, base = dir) => {
|
|
|
24
24
|
export const listTemplates = () => {
|
|
25
25
|
return walkDir(BASE);
|
|
26
26
|
};
|
|
27
|
-
import { ErrorFactory } from '../../../../exceptions/ZintrustError';
|
|
27
|
+
import { ErrorFactory } from '../../../../exceptions/ZintrustError.js';
|
|
28
28
|
export const renderTemplate = (name, vars = {}) => {
|
|
29
29
|
const tpl = loadTemplate(name);
|
|
30
30
|
// Basic validation: subject required
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NotificationRegistry } from './Registry';
|
|
2
|
-
import NotificationFake from './testing';
|
|
1
|
+
import { NotificationRegistry } from './Registry.js';
|
|
2
|
+
import NotificationFake from './testing.js';
|
|
3
3
|
export const useFakeDriver = (name = 'notification-fake', fake = NotificationFake) => {
|
|
4
4
|
let previous;
|
|
5
5
|
try {
|
package/src/tools/queue/Queue.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { generateUuid } from '../../../common/uuid';
|
|
2
|
-
import { ErrorFactory } from '../../../exceptions/ZintrustError';
|
|
1
|
+
import { generateUuid } from '../../../common/uuid.js';
|
|
2
|
+
import { ErrorFactory } from '../../../exceptions/ZintrustError.js';
|
|
3
3
|
const getRedisUrl = () => {
|
|
4
4
|
const url = (process.env['REDIS_URL'] ?? '').trim();
|
|
5
5
|
return url.length > 0 ? url : null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
2
|
-
import { createHmac } from '../../node-singletons/crypto';
|
|
1
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
2
|
+
import { createHmac } from '../../node-singletons/crypto.js';
|
|
3
3
|
const base64UrlEncode = (value) => {
|
|
4
4
|
const base64 = Buffer.isBuffer(value)
|
|
5
5
|
? value.toString('base64')
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Env } from '../../../config/env';
|
|
2
|
-
import { ErrorFactory } from '../../../exceptions/ZintrustError';
|
|
3
|
-
import { fsPromises as fs } from '../../../node-singletons/fs';
|
|
4
|
-
import * as path from '../../../node-singletons/path';
|
|
5
|
-
import { LocalSignedUrl } from '../LocalSignedUrl';
|
|
1
|
+
import { Env } from '../../../config/env.js';
|
|
2
|
+
import { ErrorFactory } from '../../../exceptions/ZintrustError.js';
|
|
3
|
+
import { fsPromises as fs } from '../../../node-singletons/fs.js';
|
|
4
|
+
import * as path from '../../../node-singletons/path.js';
|
|
5
|
+
import { LocalSignedUrl } from '../LocalSignedUrl.js';
|
|
6
6
|
export const LocalDriver = Object.freeze({
|
|
7
7
|
resolveKey(config, key) {
|
|
8
8
|
if (!config.root || config.root.trim() === '') {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ErrorFactory } from '../../../exceptions/ZintrustError';
|
|
2
|
-
import { S3Driver } from '../drivers/S3';
|
|
1
|
+
import { ErrorFactory } from '../../../exceptions/ZintrustError.js';
|
|
2
|
+
import { S3Driver } from '../drivers/S3.js';
|
|
3
3
|
export const R2Driver = Object.freeze({
|
|
4
4
|
async put(config, key, content) {
|
|
5
5
|
if (typeof config.endpoint !== 'string' || config.endpoint.trim() === '') {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AwsSigV4 } from '../../../common/index';
|
|
2
|
-
import { ErrorFactory } from '../../../exceptions/ZintrustError';
|
|
3
|
-
import { createHash, createHmac } from '../../../node-singletons/crypto';
|
|
1
|
+
import { AwsSigV4 } from '../../../common/index.js';
|
|
2
|
+
import { ErrorFactory } from '../../../exceptions/ZintrustError.js';
|
|
3
|
+
import { createHash, createHmac } from '../../../node-singletons/crypto.js';
|
|
4
4
|
const sha256Hex = (data) => createHash('sha256').update(data).digest('hex');
|
|
5
5
|
const buildAuthorization = (params) => {
|
|
6
6
|
const canonicalUri = params.path;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { GcsDriver } from '../../tools/storage/drivers/Gcs';
|
|
2
|
-
import { storageConfig } from '../../config/storage';
|
|
3
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
4
|
-
import { LocalDriver } from './drivers/Local';
|
|
5
|
-
import { R2Driver } from './drivers/R2';
|
|
6
|
-
import { S3Driver } from './drivers/S3';
|
|
1
|
+
import { GcsDriver } from '../../tools/storage/drivers/Gcs.js';
|
|
2
|
+
import { storageConfig } from '../../config/storage.js';
|
|
3
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
4
|
+
import { LocalDriver } from './drivers/Local.js';
|
|
5
|
+
import { R2Driver } from './drivers/R2.js';
|
|
6
|
+
import { S3Driver } from './drivers/S3.js';
|
|
7
7
|
const normalizers = {
|
|
8
8
|
local: (raw) => ({
|
|
9
9
|
root: String(raw['root'] ?? ''),
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* - Basic markdown features: headings, bold, italic, lists, links, code blocks, inline code
|
|
7
7
|
* - Safe link sanitization (only allow http(s), mailto, tel)
|
|
8
8
|
*/
|
|
9
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
10
|
-
import { XssProtection } from '../../security/XssProtection';
|
|
9
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
10
|
+
import { XssProtection } from '../../security/XssProtection.js';
|
|
11
11
|
const escapeHtml = (str) => XssProtection.escape(str);
|
|
12
12
|
const sanitizeHref = (href) => {
|
|
13
13
|
const trimmed = String(href ?? '').trim();
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Schema-based input validation with fluent API matching QueryBuilder style
|
|
4
4
|
* Sealed namespace pattern - all exports through Validator namespace
|
|
5
5
|
*/
|
|
6
|
-
import { Logger } from '../config/logger';
|
|
7
|
-
import { createValidationError } from './ValidationError';
|
|
6
|
+
import { Logger } from '../config/logger.js';
|
|
7
|
+
import { createValidationError } from './ValidationError.js';
|
|
8
8
|
const addSimpleRule = (schema, rules, field, rule, message) => {
|
|
9
9
|
if (!rules.has(field))
|
|
10
10
|
rules.set(field, []);
|
|
@@ -187,4 +187,4 @@ export const Validator = Object.freeze({
|
|
|
187
187
|
/**
|
|
188
188
|
* Export ValidationError for use in tests and applications
|
|
189
189
|
*/
|
|
190
|
-
export { ValidationError } from './ValidationError';
|
|
190
|
+
export { ValidationError } from './ValidationError.js';
|