@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
package/src/orm/Database.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Database Manager
|
|
3
3
|
* Central database connection management and query execution
|
|
4
4
|
*/
|
|
5
|
-
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
6
|
-
import { EventEmitter } from '../node-singletons/events';
|
|
7
|
-
import { D1Adapter } from './adapters/D1Adapter';
|
|
8
|
-
import { MySQLAdapter } from './adapters/MySQLAdapter';
|
|
9
|
-
import { PostgreSQLAdapter } from './adapters/PostgreSQLAdapter';
|
|
10
|
-
import { SQLiteAdapter } from './adapters/SQLiteAdapter';
|
|
11
|
-
import { SQLServerAdapter } from './adapters/SQLServerAdapter';
|
|
12
|
-
import { QueryBuilder } from './QueryBuilder';
|
|
5
|
+
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
6
|
+
import { EventEmitter } from '../node-singletons/events.js';
|
|
7
|
+
import { D1Adapter } from './adapters/D1Adapter.js';
|
|
8
|
+
import { MySQLAdapter } from './adapters/MySQLAdapter.js';
|
|
9
|
+
import { PostgreSQLAdapter } from './adapters/PostgreSQLAdapter.js';
|
|
10
|
+
import { SQLiteAdapter } from './adapters/SQLiteAdapter.js';
|
|
11
|
+
import { SQLServerAdapter } from './adapters/SQLServerAdapter.js';
|
|
12
|
+
import { QueryBuilder } from './QueryBuilder.js';
|
|
13
13
|
/**
|
|
14
14
|
* Database Manager
|
|
15
15
|
* Refactored to Functional Object pattern
|
package/src/orm/Model.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Enhanced Model with Relationships
|
|
3
3
|
* Full ORM capabilities with eager/lazy loading
|
|
4
4
|
*/
|
|
5
|
-
import { DEFAULTS } from '../config/constants';
|
|
6
|
-
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
7
|
-
import { useDatabase } from './Database';
|
|
8
|
-
import { QueryBuilder } from './QueryBuilder';
|
|
9
|
-
import { BelongsTo, BelongsToMany, HasMany, HasOne } from './Relationships';
|
|
5
|
+
import { DEFAULTS } from '../config/constants.js';
|
|
6
|
+
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
7
|
+
import { useDatabase } from './Database.js';
|
|
8
|
+
import { QueryBuilder } from './QueryBuilder.js';
|
|
9
|
+
import { BelongsTo, BelongsToMany, HasMany, HasOne } from './Relationships.js';
|
|
10
10
|
const getRelatedTableName = (relatedModel) => {
|
|
11
11
|
if (typeof relatedModel.getTable === 'function') {
|
|
12
12
|
return relatedModel.getTable();
|
package/src/orm/QueryBuilder.js
CHANGED
package/src/orm/Relationships.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Relationship Types
|
|
3
3
|
* Define how models relate to each other
|
|
4
4
|
*/
|
|
5
|
-
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
5
|
+
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
6
6
|
const getRelatedTableName = (relatedModel) => {
|
|
7
7
|
if (typeof relatedModel.getTable === 'function') {
|
|
8
8
|
return relatedModel.getTable();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Cloudflare D1 Database Adapter
|
|
3
3
|
*/
|
|
4
|
-
import { Cloudflare } from '../../config/cloudflare';
|
|
5
|
-
import { FeatureFlags } from '../../config/features';
|
|
6
|
-
import { Logger } from '../../config/logger';
|
|
7
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
8
|
-
import { QueryBuilder } from '../QueryBuilder';
|
|
4
|
+
import { Cloudflare } from '../../config/cloudflare.js';
|
|
5
|
+
import { FeatureFlags } from '../../config/features.js';
|
|
6
|
+
import { Logger } from '../../config/logger.js';
|
|
7
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
8
|
+
import { QueryBuilder } from '../QueryBuilder.js';
|
|
9
9
|
/**
|
|
10
10
|
* Get D1 binding from config or global environment
|
|
11
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MySQLAdapter.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/MySQLAdapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MySQLAdapter.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/MySQLAdapter.ts"],"names":[],"mappings":"AACA;;GAEG;AAKH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAe,MAAM,sBAAsB,CAAC;AAGrF;;;GAGG;AACH,eAAO,MAAM,YAAY;IACvB;;OAEG;mBACY,cAAc,GAAG,gBAAgB;EA8EhD,CAAC;AAEH,eAAe,YAAY,CAAC"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
// TEMPLATE_START
|
|
2
1
|
/* eslint-disable @typescript-eslint/require-await */
|
|
3
2
|
/**
|
|
4
3
|
* MySQL Database Adapter
|
|
5
4
|
*/
|
|
6
|
-
import { FeatureFlags } from '../../config/features';
|
|
7
|
-
import { Logger } from '../../config/logger';
|
|
8
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
9
|
-
import { QueryBuilder } from '../QueryBuilder';
|
|
5
|
+
import { FeatureFlags } from '../../config/features.js';
|
|
6
|
+
import { Logger } from '../../config/logger.js';
|
|
7
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
8
|
+
import { QueryBuilder } from '../QueryBuilder.js';
|
|
10
9
|
/**
|
|
11
10
|
* MySQL adapter implementation
|
|
12
11
|
* Sealed namespace for immutability
|
|
@@ -88,4 +87,3 @@ export const MySQLAdapter = Object.freeze({
|
|
|
88
87
|
},
|
|
89
88
|
});
|
|
90
89
|
export default MySQLAdapter;
|
|
91
|
-
// TEMPLATE_END
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostgreSQLAdapter.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/PostgreSQLAdapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PostgreSQLAdapter.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/PostgreSQLAdapter.ts"],"names":[],"mappings":"AACA;;GAEG;AAKH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAe,MAAM,sBAAsB,CAAC;AAGrF;;;GAGG;AACH,eAAO,MAAM,iBAAiB;IAC5B;;OAEG;mBACY,cAAc,GAAG,gBAAgB;EAiFhD,CAAC;AAEH,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
// TEMPLATE_START
|
|
2
1
|
/* eslint-disable @typescript-eslint/require-await */
|
|
3
2
|
/**
|
|
4
3
|
* PostgreSQL Database Adapter
|
|
5
4
|
*/
|
|
6
|
-
import { FeatureFlags } from '../../config/features';
|
|
7
|
-
import { Logger } from '../../config/logger';
|
|
8
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
9
|
-
import { QueryBuilder } from '../QueryBuilder';
|
|
5
|
+
import { FeatureFlags } from '../../config/features.js';
|
|
6
|
+
import { Logger } from '../../config/logger.js';
|
|
7
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
8
|
+
import { QueryBuilder } from '../QueryBuilder.js';
|
|
10
9
|
/**
|
|
11
10
|
* PostgreSQL adapter implementation
|
|
12
11
|
* Sealed namespace for immutability
|
|
@@ -88,4 +87,3 @@ export const PostgreSQLAdapter = Object.freeze({
|
|
|
88
87
|
},
|
|
89
88
|
});
|
|
90
89
|
export default PostgreSQLAdapter;
|
|
91
|
-
// TEMPLATE_END
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SQLServerAdapter.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/SQLServerAdapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SQLServerAdapter.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/SQLServerAdapter.ts"],"names":[],"mappings":"AACA;;GAEG;AAKH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAe,MAAM,sBAAsB,CAAC;AAGrF;;;GAGG;AACH,eAAO,MAAM,gBAAgB;IAC3B;;OAEG;mBACY,cAAc,GAAG,gBAAgB;EA4EhD,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
// TEMPLATE_START
|
|
2
1
|
/* eslint-disable @typescript-eslint/require-await */
|
|
3
2
|
/**
|
|
4
3
|
* SQL Server Database Adapter
|
|
5
4
|
*/
|
|
6
|
-
import { FeatureFlags } from '../../config/features';
|
|
7
|
-
import { Logger } from '../../config/logger';
|
|
8
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
9
|
-
import { QueryBuilder } from '../QueryBuilder';
|
|
5
|
+
import { FeatureFlags } from '../../config/features.js';
|
|
6
|
+
import { Logger } from '../../config/logger.js';
|
|
7
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
8
|
+
import { QueryBuilder } from '../QueryBuilder.js';
|
|
10
9
|
/**
|
|
11
10
|
* SQL Server adapter implementation
|
|
12
11
|
* Sealed namespace for immutability
|
|
@@ -82,4 +81,3 @@ export const SQLServerAdapter = Object.freeze({
|
|
|
82
81
|
},
|
|
83
82
|
});
|
|
84
83
|
export default SQLServerAdapter;
|
|
85
|
-
// TEMPLATE_END
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SQLiteAdapter.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/SQLiteAdapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SQLiteAdapter.d.ts","sourceRoot":"","sources":["../../../../src/orm/adapters/SQLiteAdapter.ts"],"names":[],"mappings":"AACA;;;GAGG;AAMH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAe,MAAM,sBAAsB,CAAC;AA6HrF,iBAAS,mBAAmB,CAAC,MAAM,EAAE,cAAc,GAAG,gBAAgB,CAoDrE;AAED,eAAO,MAAM,aAAa;;EAExB,CAAC"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
// TEMPLATE_START
|
|
2
1
|
/* eslint-disable @typescript-eslint/require-await */
|
|
3
2
|
/**
|
|
4
3
|
* SQLite Database Adapter
|
|
5
4
|
* Production Implementation
|
|
6
5
|
*/
|
|
7
|
-
import { FeatureFlags } from '../../config/features';
|
|
8
|
-
import { Logger } from '../../config/logger';
|
|
9
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
10
|
-
import { performance } from '../../node-singletons/perf-hooks';
|
|
11
|
-
import { QueryBuilder } from '../QueryBuilder';
|
|
6
|
+
import { FeatureFlags } from '../../config/features.js';
|
|
7
|
+
import { Logger } from '../../config/logger.js';
|
|
8
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
9
|
+
import { performance } from '../../node-singletons/perf-hooks.js';
|
|
10
|
+
import { QueryBuilder } from '../QueryBuilder.js';
|
|
12
11
|
import Database from 'better-sqlite3';
|
|
13
12
|
function normalizeFilename(database) {
|
|
14
13
|
const value = (database ?? '').trim();
|
|
@@ -132,4 +131,3 @@ function createSQLiteAdapter(config) {
|
|
|
132
131
|
export const SQLiteAdapter = Object.freeze({
|
|
133
132
|
create: createSQLiteAdapter,
|
|
134
133
|
});
|
|
135
|
-
// TEMPLATE_END
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* Code Generation Benchmarks
|
|
3
3
|
* Measure performance of all code generators
|
|
4
4
|
*/
|
|
5
|
-
import { esmFilePath } from '../common/index';
|
|
6
|
-
import { Logger } from '../config/logger';
|
|
7
|
-
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
5
|
+
import { esmFilePath } from '../common/index.js';
|
|
6
|
+
import { Logger } from '../config/logger.js';
|
|
7
|
+
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
8
8
|
import { fs } from '../node-singletons/index.js';
|
|
9
|
-
import * as path from '../node-singletons/path';
|
|
10
|
-
import { Benchmark, MemoryMonitor } from './Benchmark';
|
|
9
|
+
import * as path from '../node-singletons/path.js';
|
|
10
|
+
import { Benchmark, MemoryMonitor } from './Benchmark.js';
|
|
11
11
|
function isBenchmarkFactory(value) {
|
|
12
12
|
if (typeof value !== 'object' || value === null)
|
|
13
13
|
return false;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Performance Optimizations for Code Generation
|
|
3
3
|
* Implements caching, lazy-loading, and parallel generation
|
|
4
4
|
*/
|
|
5
|
-
import { Logger } from '../config/logger';
|
|
6
|
-
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
5
|
+
import { Logger } from '../config/logger.js';
|
|
6
|
+
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
7
7
|
import { fs } from '../node-singletons/index.js';
|
|
8
|
-
import * as path from '../node-singletons/path';
|
|
8
|
+
import * as path from '../node-singletons/path.js';
|
|
9
9
|
const GENERATION_CACHE_STATE_SYMBOL = Symbol.for('zintrust:GenerationCacheState');
|
|
10
10
|
function isUnrefableTimer(value) {
|
|
11
11
|
if (typeof value !== 'object' || value === null)
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Establish Performance Baseline
|
|
3
3
|
* Run all code generator benchmarks and save baseline metrics
|
|
4
4
|
*/
|
|
5
|
-
import { esmFilePath } from '../common/index';
|
|
6
|
-
import { Logger } from '../config/logger';
|
|
5
|
+
import { esmFilePath } from '../common/index.js';
|
|
6
|
+
import { Logger } from '../config/logger.js';
|
|
7
7
|
import { fs } from '../node-singletons/index.js';
|
|
8
|
-
import * as path from '../node-singletons/path';
|
|
9
|
-
import { CodeGenerationBenchmark } from './CodeGenerationBenchmark';
|
|
8
|
+
import * as path from '../node-singletons/path.js';
|
|
9
|
+
import { CodeGenerationBenchmark } from './CodeGenerationBenchmark.js';
|
|
10
10
|
/**
|
|
11
11
|
* Run baseline and save results
|
|
12
12
|
*/
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Request Profiler
|
|
3
3
|
* Comprehensive profiling of request execution combining query, N+1, and memory metrics
|
|
4
4
|
*/
|
|
5
|
-
import { MemoryProfiler } from './MemoryProfiler';
|
|
6
|
-
import { N1Detector } from './N1Detector';
|
|
7
|
-
import { QueryLogger } from './QueryLogger';
|
|
5
|
+
import { MemoryProfiler } from './MemoryProfiler.js';
|
|
6
|
+
import { N1Detector } from './N1Detector.js';
|
|
7
|
+
import { QueryLogger } from './QueryLogger.js';
|
|
8
8
|
/**
|
|
9
9
|
* RequestProfiler orchestrates query logging, N+1 detection, and memory profiling
|
|
10
10
|
* Sealed namespace for immutability
|
|
@@ -90,5 +90,5 @@ function formatN1Section(patterns) {
|
|
|
90
90
|
/**
|
|
91
91
|
* Re-export MemoryProfiler's static formatBytes for convenience
|
|
92
92
|
*/
|
|
93
|
-
export { MemoryProfiler } from './MemoryProfiler';
|
|
93
|
+
export { MemoryProfiler } from './MemoryProfiler.js';
|
|
94
94
|
export default RequestProfiler;
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* Plugin Manager
|
|
5
5
|
* Handles installation and removal of framework plugins.
|
|
6
6
|
*/
|
|
7
|
-
import { SpawnUtil } from '../cli/utils/spawn';
|
|
8
|
-
import { esmDirname, resolvePackageManager } from '../common/index';
|
|
9
|
-
import { Logger } from '../config/logger';
|
|
10
|
-
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
11
|
-
import { execSync } from '../node-singletons/child-process';
|
|
12
|
-
import { existsSync, fsPromises as fs } from '../node-singletons/fs';
|
|
13
|
-
import * as path from '../node-singletons/path';
|
|
14
|
-
import { PluginRegistry } from './PluginRegistry';
|
|
7
|
+
import { SpawnUtil } from '../cli/utils/spawn.js';
|
|
8
|
+
import { esmDirname, resolvePackageManager } from '../common/index.js';
|
|
9
|
+
import { Logger } from '../config/logger.js';
|
|
10
|
+
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
11
|
+
import { execSync } from '../node-singletons/child-process.js';
|
|
12
|
+
import { existsSync, fsPromises as fs } from '../node-singletons/fs.js';
|
|
13
|
+
import * as path from '../node-singletons/path.js';
|
|
14
|
+
import { PluginRegistry } from './PluginRegistry.js';
|
|
15
15
|
const __dirname = esmDirname(import.meta.url);
|
|
16
16
|
const MAX_PACKAGE_ROOT_SEARCH_DEPTH = 20;
|
|
17
17
|
function findPackageRoot(startDir) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeDetector.d.ts","sourceRoot":"","sources":["../../../src/runtime/RuntimeDetector.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"RuntimeDetector.d.ts","sourceRoot":"","sources":["../../../src/runtime/RuntimeDetector.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAkKzF,eAAO,MAAM,eAAe;;;yBA9GF,MAAM;4BAyBD,aAAa,KAAG,cAAc;uCAQnB,MAAM,UAAU,aAAa,KAAG,cAAc;0BAuD7D,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;EA6BhD,CAAC;AA8IH,eAAO,MAAM,oBAAoB;0BAtGE,eAAe,KAAG,OAAO,CAAC,IAAI,CAAC;wBA0DlC,MAAM,KAAe,OAAO,CAAC,IAAI,CAAC;iCAmChC,IAAI;EAapC,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Env } from '../config/env';
|
|
2
|
-
import Logger from '../config/logger';
|
|
3
|
-
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
4
|
-
import { CloudflareAdapter } from './adapters/CloudflareAdapter';
|
|
5
|
-
import { DenoAdapter } from './adapters/DenoAdapter';
|
|
6
|
-
import { FargateAdapter } from './adapters/FargateAdapter';
|
|
7
|
-
import { LambdaAdapter } from './adapters/LambdaAdapter';
|
|
8
|
-
import { NodeServerAdapter } from './adapters/NodeServerAdapter';
|
|
1
|
+
import { Env } from '../config/env.js';
|
|
2
|
+
import Logger from '../config/logger.js';
|
|
3
|
+
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
4
|
+
import { CloudflareAdapter } from './adapters/CloudflareAdapter.js';
|
|
5
|
+
import { DenoAdapter } from './adapters/DenoAdapter.js';
|
|
6
|
+
import { FargateAdapter } from './adapters/FargateAdapter.js';
|
|
7
|
+
import { LambdaAdapter } from './adapters/LambdaAdapter.js';
|
|
8
|
+
import { NodeServerAdapter } from './adapters/NodeServerAdapter.js';
|
|
9
9
|
/**
|
|
10
10
|
* Runtime detector - automatically selects appropriate adapter based on environment
|
|
11
11
|
* Supports: Lambda, Fargate, Cloudflare Workers, Deno, and standard Node.js
|
|
@@ -20,10 +20,20 @@ function ensureInstanceOfCompat(adapterExport) {
|
|
|
20
20
|
const obj = adapterExport;
|
|
21
21
|
if (obj[Symbol.hasInstance] !== undefined)
|
|
22
22
|
return;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
// Adapters are typically exported as sealed/frozen namespaces.
|
|
24
|
+
// Some tests mock adapters as plain extensible objects and still assert via `instanceof`.
|
|
25
|
+
// Only patch mocks; never attempt to mutate a sealed export.
|
|
26
|
+
if (Object.isExtensible(obj) === false)
|
|
27
|
+
return;
|
|
28
|
+
try {
|
|
29
|
+
Object.defineProperty(obj, Symbol.hasInstance, {
|
|
30
|
+
value: (instance) => typeof instance === 'object' && instance !== null,
|
|
31
|
+
configurable: true,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// Best-effort only; never crash runtime detection because of test-compat shims.
|
|
36
|
+
}
|
|
27
37
|
}
|
|
28
38
|
// Some tests mock adapters as plain factory objects (not constructors) but still
|
|
29
39
|
// assert via `instanceof`. Adding Symbol.hasInstance avoids a TypeError.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Runtime adapter for Cloudflare Workers
|
|
3
3
|
*/
|
|
4
|
-
import { appConfig } from '../../config';
|
|
5
|
-
import { Logger } from '../../config/logger';
|
|
6
|
-
import { createMockHttpObjects, ErrorResponse, HttpResponse, } from '../RuntimeAdapter';
|
|
4
|
+
import { appConfig } from '../../config/index.js';
|
|
5
|
+
import { Logger } from '../../config/logger.js';
|
|
6
|
+
import { createMockHttpObjects, ErrorResponse, HttpResponse, } from '../RuntimeAdapter.js';
|
|
7
7
|
/**
|
|
8
8
|
* Cloudflare Workers adapter for Cloudflare's edge compute platform
|
|
9
9
|
* Uses fetch API and handles D1 database, KV storage bindings
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Runtime adapter for Deno
|
|
3
3
|
*/
|
|
4
|
-
import Logger from '../../config/logger';
|
|
5
|
-
import { createMockHttpObjects, ErrorResponse, } from '../RuntimeAdapter';
|
|
4
|
+
import Logger from '../../config/logger.js';
|
|
5
|
+
import { createMockHttpObjects, ErrorResponse, } from '../RuntimeAdapter.js';
|
|
6
6
|
/**
|
|
7
7
|
* Deno runtime adapter for Deno Deploy and edge compute environments
|
|
8
8
|
* Sealed namespace for immutability
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* - Extracted all internal logic into exported, named functions so they can be unit tested directly.
|
|
6
6
|
* - Removed nested event-handler nesting where possible by introducing readIncomingMessageBody().
|
|
7
7
|
*/
|
|
8
|
-
import { Env } from '../../config/env';
|
|
9
|
-
import { Logger } from '../../config/logger';
|
|
10
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
11
|
-
import { createServer, } from '../../node-singletons/http';
|
|
8
|
+
import { Env } from '../../config/env.js';
|
|
9
|
+
import { Logger } from '../../config/logger.js';
|
|
10
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
11
|
+
import { createServer, } from '../../node-singletons/http.js';
|
|
12
12
|
export function createFargateAdapter(config) {
|
|
13
13
|
const logger = config.logger ?? createDefaultFargateLogger();
|
|
14
14
|
const state = {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Runtime adapter for AWS Lambda
|
|
3
3
|
*/
|
|
4
|
-
import { Env } from '../../config/env';
|
|
5
|
-
import { Logger } from '../../config/logger';
|
|
6
|
-
import { IncomingMessage, ServerResponse, } from '../../node-singletons/http';
|
|
7
|
-
import { ErrorResponse, HttpResponse, } from '../RuntimeAdapter';
|
|
4
|
+
import { Env } from '../../config/env.js';
|
|
5
|
+
import { Logger } from '../../config/logger.js';
|
|
6
|
+
import { IncomingMessage, ServerResponse, } from '../../node-singletons/http.js';
|
|
7
|
+
import { ErrorResponse, HttpResponse, } from '../RuntimeAdapter.js';
|
|
8
8
|
/**
|
|
9
9
|
* AWS Lambda adapter for API Gateway and ALB events
|
|
10
10
|
* Converts Lambda events to standard HTTP format for Zintrust framework
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Env } from '../../config/env';
|
|
2
|
-
import Logger from '../../config/logger';
|
|
3
|
-
import { ErrorFactory } from '../../exceptions/ZintrustError';
|
|
4
|
-
import { createServer } from '../../node-singletons/http';
|
|
1
|
+
import { Env } from '../../config/env.js';
|
|
2
|
+
import Logger from '../../config/logger.js';
|
|
3
|
+
import { ErrorFactory } from '../../exceptions/ZintrustError.js';
|
|
4
|
+
import { createServer } from '../../node-singletons/http.js';
|
|
5
5
|
/**
|
|
6
6
|
* Node.js HTTP Server adapter for standard containers and traditional servers
|
|
7
7
|
* Uses Node.js built-in HTTP server for maximum compatibility
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* ScheduleRunner
|
|
3
3
|
* Lightweight, zero-dependency schedule runner for long-running runtimes
|
|
4
4
|
*/
|
|
5
|
-
import { Logger } from '../config/logger';
|
|
6
|
-
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
5
|
+
import { Logger } from '../config/logger.js';
|
|
6
|
+
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
7
7
|
const createRegister = (runner, invokeHandler) => (schedule) => {
|
|
8
8
|
if (runner.schedules.has(schedule.name)) {
|
|
9
9
|
Logger.warn(`Schedule replaced: ${schedule.name}`);
|
package/src/scheduler/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { create as createScheduleRunner } from './ScheduleRunner';
|
|
1
|
+
export { create as createScheduleRunner } from './ScheduleRunner.js';
|
package/src/schedules/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as logCleanup } from './log-cleanup';
|
|
1
|
+
export { default as logCleanup } from './log-cleanup.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Env } from '../config/env';
|
|
2
|
-
import { Logger, cleanLogsOnce } from '../config/logger';
|
|
1
|
+
import { Env } from '../config/env.js';
|
|
2
|
+
import { Logger, cleanLogsOnce } from '../config/logger.js';
|
|
3
3
|
const intervalMs = Env.getInt('LOG_CLEANUP_INTERVAL_MS', 3600000);
|
|
4
4
|
const LogCleanupSchedule = {
|
|
5
5
|
name: 'log.cleanup',
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
* Usage:
|
|
10
10
|
* tsx src/scripts/GenerateEnvArtifacts.ts
|
|
11
11
|
*/
|
|
12
|
-
import { Logger } from '../config/logger';
|
|
13
|
-
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
14
|
-
import fs from '../node-singletons/fs';
|
|
15
|
-
import * as path from '../node-singletons/path';
|
|
12
|
+
import { Logger } from '../config/logger.js';
|
|
13
|
+
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
14
|
+
import fs from '../node-singletons/fs.js';
|
|
15
|
+
import * as path from '../node-singletons/path.js';
|
|
16
16
|
const ROOT_DIR = path.resolve(process.cwd());
|
|
17
17
|
const GENERATED_MARKER = 'Generated by src/scripts/GenerateEnvArtifacts.ts';
|
|
18
18
|
const walkDir = (dirAbs) => {
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* Runs during npm run build
|
|
5
5
|
*/
|
|
6
6
|
import { TemplateRegistry } from '../templates/TemplateRegistry.js';
|
|
7
|
-
import { ensureDir, esmDirname } from '../common/index';
|
|
8
|
-
import { Logger } from '../config/logger';
|
|
9
|
-
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
10
|
-
import * as crypto from '../node-singletons/crypto';
|
|
11
|
-
import fs from '../node-singletons/fs';
|
|
12
|
-
import * as path from '../node-singletons/path';
|
|
7
|
+
import { ensureDir, esmDirname } from '../common/index.js';
|
|
8
|
+
import { Logger } from '../config/logger.js';
|
|
9
|
+
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
10
|
+
import * as crypto from '../node-singletons/crypto.js';
|
|
11
|
+
import fs from '../node-singletons/fs.js';
|
|
12
|
+
import * as path from '../node-singletons/path.js';
|
|
13
13
|
const __dirname = esmDirname(import.meta.url);
|
|
14
14
|
const ROOT_DIR = path.resolve(__dirname, '../../');
|
|
15
15
|
/**
|
|
@@ -224,6 +224,8 @@ const syncStarterProjectTemplates = (params) => {
|
|
|
224
224
|
baseDirRel: 'src/database',
|
|
225
225
|
templateDirRel: `${params.projectRoot}/database`,
|
|
226
226
|
description: 'Starter project database/* (from src/database/*)',
|
|
227
|
+
transformContent: rewriteStarterTemplateImports,
|
|
228
|
+
checksumSalt: 'starter-imports-v3',
|
|
227
229
|
});
|
|
228
230
|
const s4 = syncProjectTemplateDir({
|
|
229
231
|
checksums: params.checksums,
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* CSRF Token Manager
|
|
3
3
|
* Generate, validate, and bind CSRF tokens to sessions
|
|
4
4
|
*/
|
|
5
|
-
import { Env } from '../config/env';
|
|
6
|
-
import { randomBytes } from '../node-singletons/crypto';
|
|
5
|
+
import { Env } from '../config/env.js';
|
|
6
|
+
import { randomBytes } from '../node-singletons/crypto.js';
|
|
7
7
|
/**
|
|
8
8
|
* Create a new CSRF token manager instance
|
|
9
9
|
*/
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Encryptor
|
|
3
3
|
* Password hashing with dual support: PBKDF2 (default) and optional bcrypt
|
|
4
4
|
*/
|
|
5
|
-
import { Logger } from '../config/logger';
|
|
6
|
-
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
7
|
-
import { pbkdf2Sync, randomBytes } from '../node-singletons/crypto';
|
|
5
|
+
import { Logger } from '../config/logger.js';
|
|
6
|
+
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
7
|
+
import { pbkdf2Sync, randomBytes } from '../node-singletons/crypto.js';
|
|
8
8
|
function isBcryptModule(value) {
|
|
9
9
|
if (typeof value !== 'object' || value === null)
|
|
10
10
|
return false;
|
package/src/security/Hash.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Runtime-aware: uses dynamic import for bcrypt.
|
|
6
6
|
*/
|
|
7
|
-
import { Logger } from '../config/logger';
|
|
8
|
-
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
7
|
+
import { Logger } from '../config/logger.js';
|
|
8
|
+
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
9
9
|
function isBcryptModule(value) {
|
|
10
10
|
if (typeof value !== 'object' || value === null)
|
|
11
11
|
return false;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* JSON Web Token generation, verification, and claims management
|
|
4
4
|
* Uses native Node.js crypto module (zero external dependencies)
|
|
5
5
|
*/
|
|
6
|
-
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
7
|
-
import { createHmac, createSign, createVerify, randomBytes } from '../node-singletons/crypto';
|
|
6
|
+
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
7
|
+
import { createHmac, createSign, createVerify, randomBytes } from '../node-singletons/crypto.js';
|
|
8
8
|
/**
|
|
9
9
|
* Create a new JWT manager instance
|
|
10
10
|
*/
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* Validates critical secrets early at boot time so production misconfiguration
|
|
5
5
|
* fails fast and predictably.
|
|
6
6
|
*/
|
|
7
|
-
import { appConfig } from '../config/app';
|
|
8
|
-
import { securityConfig } from '../config/security';
|
|
9
|
-
import { startupConfig } from '../config/startup';
|
|
10
|
-
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
7
|
+
import { appConfig } from '../config/app.js';
|
|
8
|
+
import { securityConfig } from '../config/security.js';
|
|
9
|
+
import { startupConfig } from '../config/startup.js';
|
|
10
|
+
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
11
11
|
const validateApiKeySecret = () => {
|
|
12
12
|
if (!securityConfig.apiKey.enabled)
|
|
13
13
|
return null;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Security Utilities
|
|
3
3
|
* Mitigates SSRF (SonarQube S5144)
|
|
4
4
|
*/
|
|
5
|
-
import { ErrorFactory } from '../exceptions/ZintrustError';
|
|
5
|
+
import { ErrorFactory } from '../exceptions/ZintrustError.js';
|
|
6
6
|
/**
|
|
7
7
|
* Validate URL for SSRF protection
|
|
8
8
|
* Ensures URL is either internal or matches allowed domains
|
package/src/security/Xss.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - Strings: strip tags, then escape HTML entities.
|
|
7
7
|
* - Arrays/Objects: sanitize recursively.
|
|
8
8
|
*/
|
|
9
|
-
import { XssProtection } from './XssProtection';
|
|
9
|
+
import { XssProtection } from './XssProtection.js';
|
|
10
10
|
const stripTags = (value) => {
|
|
11
11
|
// Remove all HTML tags in linear time (no regex backtracking / ReDoS risk).
|
|
12
12
|
let out = '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XssProtection.d.ts","sourceRoot":"","sources":["../../../src/security/XssProtection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"XssProtection.d.ts","sourceRoot":"","sources":["../../../src/security/XssProtection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA6SH;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,OAAO,KAAG,MAGzC,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC;CAClC;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,cAO1B,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* HTML escaping and sanitization (pure TypeScript, zero dependencies)
|
|
4
4
|
* Sealed namespace pattern - all exports through XssProtection namespace
|
|
5
5
|
*/
|
|
6
|
-
import { Logger } from '../config/logger';
|
|
6
|
+
import { Logger } from '../config/logger.js';
|
|
7
7
|
const HTML_ESCAPE_MAP = {
|
|
8
8
|
'&': '&',
|
|
9
9
|
'<': '<',
|
|
@@ -31,8 +31,13 @@ const sanitizeHtml = (html) => {
|
|
|
31
31
|
if (typeof html !== 'string') {
|
|
32
32
|
return '';
|
|
33
33
|
}
|
|
34
|
-
// Remove script tags and content
|
|
35
|
-
let sanitized = html
|
|
34
|
+
// Remove script tags and content (loop until stable to avoid incomplete multi-character sanitization)
|
|
35
|
+
let sanitized = html;
|
|
36
|
+
let prevScriptSanitized;
|
|
37
|
+
do {
|
|
38
|
+
prevScriptSanitized = sanitized;
|
|
39
|
+
sanitized = sanitized.replaceAll(/<script\b[\s\S]*?<\/script[^<]*?>/gi, '');
|
|
40
|
+
} while (sanitized !== prevScriptSanitized);
|
|
36
41
|
// Remove iframe, object, embed, and base tags
|
|
37
42
|
sanitized = sanitized.replaceAll(/<(?:iframe|object|embed|base)\b[\s\S]*?>/gi, '');
|
|
38
43
|
sanitized = sanitized.replaceAll(/<\/(?:iframe|object|embed|base)>/gi, '');
|