alepha 0.23.0 → 0.24.0
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/assets/swagger-ui/swagger-ui-bundle.js +1 -1
- package/assets/swagger-ui/swagger-ui-standalone-preset.js +1 -1
- package/dist/api/audits/index.browser.js +49 -52
- package/dist/api/audits/index.browser.js.map +1 -1
- package/dist/api/audits/index.d.ts +629 -565
- package/dist/api/audits/index.d.ts.map +1 -1
- package/dist/api/audits/index.js +206 -98
- package/dist/api/audits/index.js.map +1 -1
- package/dist/api/files/index.browser.js +44 -44
- package/dist/api/files/index.browser.js.map +1 -1
- package/dist/api/files/index.d.ts +292 -293
- package/dist/api/files/index.d.ts.map +1 -1
- package/dist/api/files/index.js +61 -64
- package/dist/api/files/index.js.map +1 -1
- package/dist/api/jobs/index.browser.js +61 -59
- package/dist/api/jobs/index.browser.js.map +1 -1
- package/dist/api/jobs/index.d.ts +546 -347
- package/dist/api/jobs/index.d.ts.map +1 -1
- package/dist/api/jobs/index.js +165 -86
- package/dist/api/jobs/index.js.map +1 -1
- package/dist/api/keys/index.d.ts +247 -235
- package/dist/api/keys/index.d.ts.map +1 -1
- package/dist/api/keys/index.js +63 -66
- package/dist/api/keys/index.js.map +1 -1
- package/dist/api/notifications/index.browser.js +40 -38
- package/dist/api/notifications/index.browser.js.map +1 -1
- package/dist/api/notifications/index.d.ts +339 -209
- package/dist/api/notifications/index.d.ts.map +1 -1
- package/dist/api/notifications/index.js +108 -60
- package/dist/api/notifications/index.js.map +1 -1
- package/dist/api/oauth/index.d.ts +190 -78
- package/dist/api/oauth/index.d.ts.map +1 -1
- package/dist/api/oauth/index.js +290 -68
- package/dist/api/oauth/index.js.map +1 -1
- package/dist/api/organizations/index.browser.js +14 -14
- package/dist/api/organizations/index.browser.js.map +1 -1
- package/dist/api/organizations/index.d.ts +158 -134
- package/dist/api/organizations/index.d.ts.map +1 -1
- package/dist/api/organizations/index.js +18 -18
- package/dist/api/organizations/index.js.map +1 -1
- package/dist/api/parameters/index.browser.js +74 -53
- package/dist/api/parameters/index.browser.js.map +1 -1
- package/dist/api/parameters/index.d.ts +607 -513
- package/dist/api/parameters/index.d.ts.map +1 -1
- package/dist/api/parameters/index.js +205 -127
- package/dist/api/parameters/index.js.map +1 -1
- package/dist/api/payments/index.d.ts +652 -449
- package/dist/api/payments/index.d.ts.map +1 -1
- package/dist/api/payments/index.js +159 -93
- package/dist/api/payments/index.js.map +1 -1
- package/dist/api/subscriptions/index.d.ts +1032 -762
- package/dist/api/subscriptions/index.d.ts.map +1 -1
- package/dist/api/subscriptions/index.js +166 -185
- package/dist/api/subscriptions/index.js.map +1 -1
- package/dist/api/users/index.browser.js +48 -71
- package/dist/api/users/index.browser.js.map +1 -1
- package/dist/api/users/index.d.ts +1297 -1143
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +456 -392
- package/dist/api/users/index.js.map +1 -1
- package/dist/api/verifications/index.browser.js +17 -17
- package/dist/api/verifications/index.browser.js.map +1 -1
- package/dist/api/verifications/index.d.ts +167 -155
- package/dist/api/verifications/index.d.ts.map +1 -1
- package/dist/api/verifications/index.js +47 -95
- package/dist/api/verifications/index.js.map +1 -1
- package/dist/background/index.d.ts +0 -1
- package/dist/background/index.d.ts.map +1 -1
- package/dist/background/index.js.map +1 -1
- package/dist/background/index.workerd.js.map +1 -1
- package/dist/batch/index.d.ts +0 -1
- package/dist/batch/index.d.ts.map +1 -1
- package/dist/batch/index.js.map +1 -1
- package/dist/bin/index.js +1 -1
- package/dist/bin/index.js.map +1 -1
- package/dist/bucket/index.d.ts +27 -32
- package/dist/bucket/index.d.ts.map +1 -1
- package/dist/bucket/index.js +56 -26
- package/dist/bucket/index.js.map +1 -1
- package/dist/bucket/index.workerd.js +52 -24
- package/dist/bucket/index.workerd.js.map +1 -1
- package/dist/cache/core/index.d.ts +4 -6
- package/dist/cache/core/index.d.ts.map +1 -1
- package/dist/cache/core/index.js +4 -10
- package/dist/cache/core/index.js.map +1 -1
- package/dist/cache/core/index.workerd.js +4 -10
- package/dist/cache/core/index.workerd.js.map +1 -1
- package/dist/cache/database/index.d.ts +22 -23
- package/dist/cache/database/index.d.ts.map +1 -1
- package/dist/cache/database/index.js +11 -20
- package/dist/cache/database/index.js.map +1 -1
- package/dist/cache/redis/index.d.ts +3 -4
- package/dist/cache/redis/index.d.ts.map +1 -1
- package/dist/cache/redis/index.js +2 -2
- package/dist/cache/redis/index.js.map +1 -1
- package/dist/captcha/index.d.ts.map +1 -1
- package/dist/captcha/index.js +4 -4
- package/dist/captcha/index.js.map +1 -1
- package/dist/cli/config/index.d.ts +0 -1
- package/dist/cli/config/index.d.ts.map +1 -1
- package/dist/cli/core/index.d.ts +205 -442
- package/dist/cli/core/index.d.ts.map +1 -1
- package/dist/cli/core/index.js +259 -284
- package/dist/cli/core/index.js.map +1 -1
- package/dist/cli/devtools/index.d.ts +3 -9
- package/dist/cli/devtools/index.d.ts.map +1 -1
- package/dist/cli/devtools/index.js +3 -3
- package/dist/cli/devtools/index.js.map +1 -1
- package/dist/cli/i18n/index.d.ts +8 -34
- package/dist/cli/i18n/index.d.ts.map +1 -1
- package/dist/cli/i18n/index.js +6 -6
- package/dist/cli/i18n/index.js.map +1 -1
- package/dist/cli/platform/index.d.ts +89 -82
- package/dist/cli/platform/index.d.ts.map +1 -1
- package/dist/cli/platform/index.js +27 -33
- package/dist/cli/platform/index.js.map +1 -1
- package/dist/cli/platform-lib/index.d.ts +351 -404
- package/dist/cli/platform-lib/index.d.ts.map +1 -1
- package/dist/cli/platform-lib/index.js +218 -239
- package/dist/cli/platform-lib/index.js.map +1 -1
- package/dist/cli/vendor/index.d.ts +17 -41
- package/dist/cli/vendor/index.d.ts.map +1 -1
- package/dist/cli/vendor/index.js +10 -13
- package/dist/cli/vendor/index.js.map +1 -1
- package/dist/command/index.d.ts +83 -195
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +160 -563
- package/dist/command/index.js.map +1 -1
- package/dist/core/index.browser.js +845 -859
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +787 -527
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +845 -859
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +845 -859
- package/dist/core/index.native.js.map +1 -1
- package/dist/core/index.workerd.js +845 -859
- package/dist/core/index.workerd.js.map +1 -1
- package/dist/crypto/index.browser.js +1 -1
- package/dist/crypto/index.browser.js.map +1 -1
- package/dist/crypto/index.d.ts +3 -4
- package/dist/crypto/index.d.ts.map +1 -1
- package/dist/crypto/index.js +6 -3
- package/dist/crypto/index.js.map +1 -1
- package/dist/datetime/index.d.ts +12 -2
- package/dist/datetime/index.d.ts.map +1 -1
- package/dist/datetime/index.js +6 -1
- package/dist/datetime/index.js.map +1 -1
- package/dist/email/brevo/index.d.ts +0 -1
- package/dist/email/brevo/index.d.ts.map +1 -1
- package/dist/email/brevo/index.js +4 -4
- package/dist/email/brevo/index.js.map +1 -1
- package/dist/email/cloudflare/index.d.ts +0 -1
- package/dist/email/cloudflare/index.d.ts.map +1 -1
- package/dist/email/cloudflare/index.js +2 -2
- package/dist/email/cloudflare/index.js.map +1 -1
- package/dist/email/core/index.d.ts +15 -7
- package/dist/email/core/index.d.ts.map +1 -1
- package/dist/email/core/index.js +14 -5
- package/dist/email/core/index.js.map +1 -1
- package/dist/email/core/index.workerd.js +5 -1
- package/dist/email/core/index.workerd.js.map +1 -1
- package/dist/email/smtp/index.d.ts +8 -9
- package/dist/email/smtp/index.d.ts.map +1 -1
- package/dist/email/smtp/index.js +702 -479
- package/dist/email/smtp/index.js.map +1 -1
- package/dist/fake/index.d.ts +1580 -1238
- package/dist/fake/index.d.ts.map +1 -1
- package/dist/fake/index.js +11728 -32131
- package/dist/fake/index.js.map +1 -1
- package/dist/lock/core/index.d.ts +13 -9
- package/dist/lock/core/index.d.ts.map +1 -1
- package/dist/lock/core/index.js +5 -5
- package/dist/lock/core/index.js.map +1 -1
- package/dist/lock/redis/index.d.ts +0 -1
- package/dist/lock/redis/index.d.ts.map +1 -1
- package/dist/lock/redis/index.js.map +1 -1
- package/dist/logger/index.d.ts +81 -69
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +123 -56
- package/dist/logger/index.js.map +1 -1
- package/dist/mcp/index.d.ts +27 -90
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +42 -70
- package/dist/mcp/index.js.map +1 -1
- package/dist/orm/core/index.browser.js +54 -40
- package/dist/orm/core/index.browser.js.map +1 -1
- package/dist/orm/core/index.bun.js +140 -106
- package/dist/orm/core/index.bun.js.map +1 -1
- package/dist/orm/core/index.d.ts +145 -150
- package/dist/orm/core/index.d.ts.map +1 -1
- package/dist/orm/core/index.js +144 -109
- package/dist/orm/core/index.js.map +1 -1
- package/dist/orm/postgres/index.bun.js +64 -54
- package/dist/orm/postgres/index.bun.js.map +1 -1
- package/dist/orm/postgres/index.d.ts +36 -76
- package/dist/orm/postgres/index.d.ts.map +1 -1
- package/dist/orm/postgres/index.js +67 -57
- package/dist/orm/postgres/index.js.map +1 -1
- package/dist/queue/core/index.d.ts +62 -75
- package/dist/queue/core/index.d.ts.map +1 -1
- package/dist/queue/core/index.js +48 -71
- package/dist/queue/core/index.js.map +1 -1
- package/dist/queue/core/index.workerd.js +48 -71
- package/dist/queue/core/index.workerd.js.map +1 -1
- package/dist/queue/redis/index.d.ts +3 -4
- package/dist/queue/redis/index.d.ts.map +1 -1
- package/dist/queue/redis/index.js +2 -2
- package/dist/queue/redis/index.js.map +1 -1
- package/dist/react/auth/index.browser.js.map +1 -1
- package/dist/react/auth/index.d.ts +7 -4
- package/dist/react/auth/index.d.ts.map +1 -1
- package/dist/react/auth/index.js.map +1 -1
- package/dist/react/core/index.d.ts +87 -5
- package/dist/react/core/index.d.ts.map +1 -1
- package/dist/react/core/index.js +170 -23
- package/dist/react/core/index.js.map +1 -1
- package/dist/react/form/index.d.ts +4 -5
- package/dist/react/form/index.d.ts.map +1 -1
- package/dist/react/form/index.js +91 -56
- package/dist/react/form/index.js.map +1 -1
- package/dist/react/head/index.browser.js.map +1 -1
- package/dist/react/head/index.d.ts +0 -1
- package/dist/react/head/index.d.ts.map +1 -1
- package/dist/react/head/index.js.map +1 -1
- package/dist/react/i18n/index.d.ts +4 -5
- package/dist/react/i18n/index.d.ts.map +1 -1
- package/dist/react/i18n/index.js +2 -2
- package/dist/react/i18n/index.js.map +1 -1
- package/dist/react/intro/index.d.ts +1 -4
- package/dist/react/intro/index.d.ts.map +1 -1
- package/dist/react/intro/index.js.map +1 -1
- package/dist/react/router/index.browser.js +60 -24
- package/dist/react/router/index.browser.js.map +1 -1
- package/dist/react/router/index.d.ts +378 -377
- package/dist/react/router/index.d.ts.map +1 -1
- package/dist/react/router/index.js +77 -41
- package/dist/react/router/index.js.map +1 -1
- package/dist/react/sitemap/index.d.ts +0 -1
- package/dist/react/sitemap/index.d.ts.map +1 -1
- package/dist/react/sitemap/index.js.map +1 -1
- package/dist/react/testing/index.d.ts +4 -5
- package/dist/react/testing/index.d.ts.map +1 -1
- package/dist/react/testing/index.js +41 -15
- package/dist/react/testing/index.js.map +1 -1
- package/dist/react/testing/{chunk-BpyX8vjI.js → rolldown-runtime-Bl3dcgcQ.js} +1 -1
- package/dist/react/ui/index.d.ts +35 -34
- package/dist/react/ui/index.d.ts.map +1 -1
- package/dist/react/ui/index.js +12 -17
- package/dist/react/ui/index.js.map +1 -1
- package/dist/redis/index.bun.js +5 -5
- package/dist/redis/index.bun.js.map +1 -1
- package/dist/redis/index.d.ts +6 -7
- package/dist/redis/index.d.ts.map +1 -1
- package/dist/redis/index.js +6 -6
- package/dist/redis/index.js.map +1 -1
- package/dist/retry/index.d.ts +0 -1
- package/dist/retry/index.d.ts.map +1 -1
- package/dist/retry/index.js.map +1 -1
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js.map +1 -1
- package/dist/scheduler/index.d.ts +4 -12
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +9 -4
- package/dist/scheduler/index.js.map +1 -1
- package/dist/scheduler/index.workerd.js +9 -4
- package/dist/scheduler/index.workerd.js.map +1 -1
- package/dist/security/index.browser.js +30 -28
- package/dist/security/index.browser.js.map +1 -1
- package/dist/security/index.d.ts +113 -44
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +452 -37
- package/dist/security/index.js.map +1 -1
- package/dist/server/auth/index.browser.js +19 -19
- package/dist/server/auth/index.browser.js.map +1 -1
- package/dist/server/auth/index.d.ts +198 -274
- package/dist/server/auth/index.d.ts.map +1 -1
- package/dist/server/auth/index.js +83 -621
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/cookies/index.browser.js +103 -5
- package/dist/server/cookies/index.browser.js.map +1 -1
- package/dist/server/cookies/index.d.ts +72 -5
- package/dist/server/cookies/index.d.ts.map +1 -1
- package/dist/server/cookies/index.js +103 -9
- package/dist/server/cookies/index.js.map +1 -1
- package/dist/server/core/index.browser.js +22 -27
- package/dist/server/core/index.browser.js.map +1 -1
- package/dist/server/core/index.d.ts +116 -85
- package/dist/server/core/index.d.ts.map +1 -1
- package/dist/server/core/index.js +105 -118
- package/dist/server/core/index.js.map +1 -1
- package/dist/server/cors/index.d.ts +9 -10
- package/dist/server/cors/index.d.ts.map +1 -1
- package/dist/server/cors/index.js +14 -26
- package/dist/server/cors/index.js.map +1 -1
- package/dist/server/etag/index.d.ts +2 -3
- package/dist/server/etag/index.d.ts.map +1 -1
- package/dist/server/etag/index.js.map +1 -1
- package/dist/server/health/index.d.ts +18 -19
- package/dist/server/health/index.d.ts.map +1 -1
- package/dist/server/health/index.js +6 -6
- package/dist/server/health/index.js.map +1 -1
- package/dist/server/links/index.browser.js +15 -18
- package/dist/server/links/index.browser.js.map +1 -1
- package/dist/server/links/index.d.ts +66 -67
- package/dist/server/links/index.d.ts.map +1 -1
- package/dist/server/links/index.js +29 -32
- package/dist/server/links/index.js.map +1 -1
- package/dist/server/metrics/index.d.ts +0 -1
- package/dist/server/metrics/index.d.ts.map +1 -1
- package/dist/server/metrics/index.js +10 -3
- package/dist/server/metrics/index.js.map +1 -1
- package/dist/server/proxy/index.d.ts +0 -1
- package/dist/server/proxy/index.d.ts.map +1 -1
- package/dist/server/proxy/index.js.map +1 -1
- package/dist/server/rate-limit/index.d.ts +8 -9
- package/dist/server/rate-limit/index.d.ts.map +1 -1
- package/dist/server/rate-limit/index.js +6 -12
- package/dist/server/rate-limit/index.js.map +1 -1
- package/dist/server/static/index.d.ts +0 -1
- package/dist/server/static/index.d.ts.map +1 -1
- package/dist/server/static/index.js.map +1 -1
- package/dist/server/swagger/index.d.ts +4 -4
- package/dist/server/swagger/index.d.ts.map +1 -1
- package/dist/server/swagger/index.js +37 -25
- package/dist/server/swagger/index.js.map +1 -1
- package/dist/sms/index.d.ts +0 -1
- package/dist/sms/index.d.ts.map +1 -1
- package/dist/sms/index.js.map +1 -1
- package/dist/system/index.browser.js.map +1 -1
- package/dist/system/index.d.ts +0 -1
- package/dist/system/index.d.ts.map +1 -1
- package/dist/system/index.js +2 -1
- package/dist/system/index.js.map +1 -1
- package/dist/system/index.workerd.js.map +1 -1
- package/dist/topic/core/index.d.ts +19 -20
- package/dist/topic/core/index.d.ts.map +1 -1
- package/dist/topic/core/index.js +8 -8
- package/dist/topic/core/index.js.map +1 -1
- package/dist/topic/redis/index.d.ts +3 -4
- package/dist/topic/redis/index.d.ts.map +1 -1
- package/dist/topic/redis/index.js +2 -2
- package/dist/topic/redis/index.js.map +1 -1
- package/package.json +22 -35
- package/src/api/audits/__tests__/AuditJobs.spec.ts +83 -0
- package/src/api/audits/__tests__/AuditService.spec.ts +139 -1
- package/src/api/audits/controllers/AdminAuditController.ts +41 -41
- package/src/api/audits/entities/audits.ts +22 -22
- package/src/api/audits/index.ts +6 -1
- package/src/api/audits/jobs/AuditJobs.ts +29 -0
- package/src/api/audits/parameters/AuditParameters.ts +51 -0
- package/src/api/audits/primitives/$audit.ts +24 -0
- package/src/api/audits/schemas/auditQuerySchema.ts +13 -13
- package/src/api/audits/schemas/createAuditSchema.ts +18 -18
- package/src/api/audits/services/AuditService.ts +79 -7
- package/src/api/files/__tests__/FileController.spec.ts +5 -5
- package/src/api/files/__tests__/FileJobs.spec.ts +6 -0
- package/src/api/files/controllers/FileController.ts +25 -25
- package/src/api/files/entities/files.ts +15 -15
- package/src/api/files/schemas/fileCreatorSummarySchema.ts +7 -7
- package/src/api/files/schemas/fileQuerySchema.ts +9 -9
- package/src/api/files/schemas/fileResourceSchema.ts +7 -9
- package/src/api/files/schemas/storageStatsSchema.ts +13 -13
- package/src/api/jobs/__tests__/$job-hardening.spec.ts +289 -0
- package/src/api/jobs/__tests__/$job.spec.ts +18 -18
- package/src/api/jobs/controllers/AdminJobController.ts +8 -8
- package/src/api/jobs/entities/jobExecutionEntity.ts +29 -19
- package/src/api/jobs/providers/JobProvider.ts +128 -12
- package/src/api/jobs/providers/JobQueueProvider.ts +2 -2
- package/src/api/jobs/schemas/jobConfigAtom.ts +22 -22
- package/src/api/jobs/schemas/jobExecutionQuerySchema.ts +6 -6
- package/src/api/jobs/schemas/jobExecutionResourceSchema.ts +11 -15
- package/src/api/jobs/schemas/jobRegistrationSchema.ts +20 -19
- package/src/api/jobs/schemas/triggerJobSchema.ts +3 -3
- package/src/api/jobs/services/JobService.ts +6 -6
- package/src/api/keys/__tests__/ApiKeyService.spec.ts +2 -2
- package/src/api/keys/controllers/AdminApiKeyController.ts +10 -10
- package/src/api/keys/entities/apiKeyEntity.ts +15 -15
- package/src/api/keys/schemas/adminApiKeyQuerySchema.ts +4 -4
- package/src/api/keys/schemas/adminApiKeyResourceSchema.ts +15 -15
- package/src/api/keys/schemas/createApiKeyBodySchema.ts +5 -5
- package/src/api/keys/schemas/createApiKeyResponseSchema.ts +9 -9
- package/src/api/keys/schemas/listApiKeyResponseSchema.ts +13 -13
- package/src/api/keys/schemas/revokeApiKeyParamsSchema.ts +3 -3
- package/src/api/keys/schemas/revokeApiKeyResponseSchema.ts +3 -3
- package/src/api/notifications/__tests__/AlephaApiNotifications.spec.ts +2 -2
- package/src/api/notifications/controllers/AdminNotificationController.ts +38 -14
- package/src/api/notifications/jobs/NotificationJobs.ts +7 -6
- package/src/api/notifications/primitives/$notification.ts +43 -4
- package/src/api/notifications/schemas/notificationContactPreferencesSchema.ts +4 -4
- package/src/api/notifications/schemas/notificationContactSchema.ts +7 -7
- package/src/api/notifications/schemas/notificationDetailResourceSchema.ts +9 -11
- package/src/api/notifications/schemas/notificationPayloadSchema.ts +11 -9
- package/src/api/notifications/schemas/notificationQuerySchema.ts +6 -6
- package/src/api/notifications/schemas/notificationResourceSchema.ts +14 -14
- package/src/api/notifications/services/NotificationSenderService.ts +38 -2
- package/src/api/oauth/__tests__/OAuthClientService.spec.ts +42 -0
- package/src/api/oauth/__tests__/OAuthController.spec.ts +128 -0
- package/src/api/oauth/controllers/OAuthController.ts +132 -12
- package/src/api/oauth/entities/oauthClientEntity.ts +29 -12
- package/src/api/oauth/helpers/oauthMetadata.ts +1 -0
- package/src/api/oauth/helpers/oidcMetadata.ts +19 -0
- package/src/api/oauth/index.ts +1 -0
- package/src/api/oauth/schemas/authorizeDecisionBodySchema.ts +12 -11
- package/src/api/oauth/schemas/authorizeQuerySchema.ts +12 -10
- package/src/api/oauth/schemas/registerClientBodySchema.ts +10 -11
- package/src/api/oauth/schemas/tokenRequestBodySchema.ts +9 -8
- package/src/api/oauth/services/OAuthClientService.ts +228 -15
- package/src/api/organizations/controllers/AdminOrganizationController.ts +8 -8
- package/src/api/organizations/entities/organizations.ts +6 -6
- package/src/api/organizations/schemas/createOrganizationSchema.ts +5 -5
- package/src/api/organizations/schemas/organizationQuerySchema.ts +4 -4
- package/src/api/organizations/schemas/updateOrganizationSchema.ts +1 -2
- package/src/api/parameters/__tests__/$parameter.spec.ts +229 -50
- package/src/api/parameters/controllers/AdminParameterController.ts +9 -12
- package/src/api/parameters/entities/parameters.ts +29 -16
- package/src/api/parameters/primitives/$parameter.ts +3 -3
- package/src/api/parameters/schemas/activateParameterBodySchema.ts +4 -4
- package/src/api/parameters/schemas/createParameterVersionBodySchema.ts +15 -15
- package/src/api/parameters/schemas/parameterCreatorSummarySchema.ts +7 -7
- package/src/api/parameters/schemas/parameterCurrentResponseSchema.ts +7 -7
- package/src/api/parameters/schemas/parameterHistoryResponseSchema.ts +3 -3
- package/src/api/parameters/schemas/parameterNameParamSchema.ts +2 -3
- package/src/api/parameters/schemas/parameterNamesResponseSchema.ts +3 -3
- package/src/api/parameters/schemas/parameterResponseSchema.ts +3 -3
- package/src/api/parameters/schemas/parameterStatusSchema.ts +2 -2
- package/src/api/parameters/schemas/parameterTreeNodeSchema.ts +6 -6
- package/src/api/parameters/schemas/parameterVersionParamSchema.ts +5 -6
- package/src/api/parameters/schemas/parameterVersionResponseSchema.ts +3 -3
- package/src/api/parameters/schemas/rollbackParameterBodySchema.ts +6 -9
- package/src/api/parameters/services/ParameterProvider.ts +152 -65
- package/src/api/payments/controllers/AdminPaymentController.ts +7 -7
- package/src/api/payments/controllers/MockCheckoutController.ts +79 -28
- package/src/api/payments/controllers/PaymentController.ts +4 -4
- package/src/api/payments/entities/paymentIntents.ts +11 -11
- package/src/api/payments/entities/paymentMethods.ts +11 -11
- package/src/api/payments/entities/refunds.ts +9 -9
- package/src/api/payments/providers/PaymentProvider.ts +18 -0
- package/src/api/payments/schemas/intentSchemas.ts +25 -25
- package/src/api/payments/schemas/paymentMethodSchemas.ts +3 -3
- package/src/api/payments/services/PaymentService.ts +60 -3
- package/src/api/subscriptions/__tests__/SubscriptionService.spec.ts +14 -0
- package/src/api/subscriptions/controllers/AdminSubscriptionController.ts +11 -11
- package/src/api/subscriptions/controllers/SubscriptionController.ts +5 -4
- package/src/api/subscriptions/entities/subscriptionEvents.ts +15 -15
- package/src/api/subscriptions/entities/subscriptions.ts +22 -22
- package/src/api/subscriptions/notifications/SubscriptionNotifications.ts +22 -22
- package/src/api/subscriptions/schemas/cancelSubscriptionSchema.ts +4 -4
- package/src/api/subscriptions/schemas/changePlanSchema.ts +5 -5
- package/src/api/subscriptions/schemas/createSubscriptionSchema.ts +14 -7
- package/src/api/subscriptions/schemas/entitlementsSchema.ts +10 -10
- package/src/api/subscriptions/schemas/mrrSchema.ts +9 -9
- package/src/api/subscriptions/schemas/planDefinitionSchema.ts +21 -21
- package/src/api/subscriptions/schemas/planResourceSchema.ts +19 -19
- package/src/api/subscriptions/schemas/subscriptionQuerySchema.ts +8 -8
- package/src/api/subscriptions/schemas/subscriptionSettingsSchema.ts +7 -7
- package/src/api/subscriptions/schemas/subscriptionStatsSchema.ts +17 -17
- package/src/api/subscriptions/services/SubscriptionConfig.ts +2 -2
- package/src/api/users/__tests__/ApiKeys-integration.spec.ts +11 -11
- package/src/api/users/atoms/realmAuthSettingsAtom.ts +111 -119
- package/src/api/users/controllers/AdminIdentityController.ts +29 -19
- package/src/api/users/controllers/AdminSessionController.ts +37 -27
- package/src/api/users/controllers/AdminUserController.ts +75 -53
- package/src/api/users/controllers/MySessionController.ts +125 -0
- package/src/api/users/controllers/RealmController.ts +9 -10
- package/src/api/users/controllers/UserController.ts +55 -55
- package/src/api/users/entities/identities.ts +8 -8
- package/src/api/users/entities/sessions.ts +17 -17
- package/src/api/users/entities/users.ts +17 -17
- package/src/api/users/index.ts +3 -0
- package/src/api/users/notifications/UserNotifications.ts +76 -24
- package/src/api/users/primitives/$realm.ts +12 -26
- package/src/api/users/providers/RealmProvider.ts +0 -15
- package/src/api/users/schemas/completePasswordResetRequestSchema.ts +8 -12
- package/src/api/users/schemas/completeRegistrationRequestSchema.ts +17 -20
- package/src/api/users/schemas/createUserSchema.ts +2 -2
- package/src/api/users/schemas/identityQuerySchema.ts +4 -4
- package/src/api/users/schemas/identityResourceSchema.ts +3 -2
- package/src/api/users/schemas/loginSchema.ts +4 -4
- package/src/api/users/schemas/passwordResetIntentResponseSchema.ts +6 -8
- package/src/api/users/schemas/realmConfigSchema.ts +10 -24
- package/src/api/users/schemas/registerQuerySchema.ts +6 -6
- package/src/api/users/schemas/registerRequestSchema.ts +21 -43
- package/src/api/users/schemas/registerResponseSchema.ts +2 -2
- package/src/api/users/schemas/registerSchema.ts +13 -31
- package/src/api/users/schemas/registrationIntentResponseSchema.ts +19 -23
- package/src/api/users/schemas/resetPasswordSchema.ts +10 -17
- package/src/api/users/schemas/sessionQuerySchema.ts +3 -3
- package/src/api/users/schemas/sessionResourceSchema.ts +25 -25
- package/src/api/users/schemas/updateUserSchema.ts +3 -4
- package/src/api/users/schemas/userQuerySchema.ts +7 -7
- package/src/api/users/services/RegistrationService.ts +25 -11
- package/src/api/users/services/UserService.ts +12 -6
- package/src/api/verifications/__tests__/CodeVerification.spec.ts +63 -101
- package/src/api/verifications/__tests__/LinkVerification.spec.ts +23 -92
- package/src/api/verifications/controllers/VerificationController.ts +13 -27
- package/src/api/verifications/entities/verifications.ts +13 -14
- package/src/api/verifications/schemas/requestVerificationCodeResponseSchema.ts +17 -14
- package/src/api/verifications/schemas/validateVerificationCodeResponseSchema.ts +9 -10
- package/src/api/verifications/schemas/verificationSettingsSchema.ts +65 -66
- package/src/api/verifications/schemas/verificationTypeEnumSchema.ts +2 -2
- package/src/api/verifications/services/VerificationService.ts +12 -0
- package/src/background/__tests__/BackgroundTaskProvider.spec.ts +36 -0
- package/src/batch/__tests__/$batch.spec.ts +22 -22
- package/src/batch/__tests__/startup-buffering.spec.ts +9 -9
- package/src/bin/index.ts +1 -1
- package/src/bucket/__tests__/TenantScopedBucket.spec.ts +60 -0
- package/src/bucket/providers/LocalFileStorageProvider.ts +14 -6
- package/src/bucket/providers/MemoryFileStorageProvider.ts +18 -7
- package/src/bucket/providers/R2FileStorageProvider.ts +14 -6
- package/src/bucket/providers/S3FileStorageProvider.ts +31 -15
- package/src/cache/core/primitives/$cache.ts +7 -10
- package/src/cache/database/entities/cacheEntries.ts +16 -27
- package/src/cache/database/providers/DatabaseCacheProvider.ts +15 -13
- package/src/cache/redis/providers/RedisCacheProvider.ts +6 -6
- package/src/captcha/providers/TurnstileCaptchaProvider.ts +4 -4
- package/src/cli/core/__tests__/BuildCloudflareTask.spec.ts +178 -0
- package/src/cli/core/__tests__/BuildDockerTask.spec.ts +0 -2
- package/src/cli/core/__tests__/DbCommand.spec.ts +108 -0
- package/src/cli/core/atoms/appEntryOptions.ts +5 -5
- package/src/cli/core/atoms/buildOptions.ts +76 -76
- package/src/cli/core/atoms/changelogOptions.ts +3 -3
- package/src/cli/core/atoms/devOptions.ts +3 -3
- package/src/cli/core/commands/build.ts +36 -39
- package/src/cli/core/commands/db.ts +171 -83
- package/src/cli/core/commands/dev.ts +8 -8
- package/src/cli/core/commands/gen/changelog.ts +12 -14
- package/src/cli/core/commands/gen/env.ts +6 -6
- package/src/cli/core/commands/gen/openapi.ts +6 -6
- package/src/cli/core/commands/init.ts +28 -33
- package/src/cli/core/commands/pack.ts +10 -10
- package/src/cli/core/commands/root.ts +7 -8
- package/src/cli/core/commands/test.ts +17 -20
- package/src/cli/core/tasks/BuildCloudflareTask.ts +103 -230
- package/src/cli/core/templates/apiHelloResponseSchemaTs.ts +4 -4
- package/src/cli/devtools/atoms/devtoolsOptions.ts +6 -6
- package/src/cli/i18n/atoms/i18nOptions.ts +8 -8
- package/src/cli/platform/commands/SecretsCommand.ts +24 -25
- package/src/cli/platform/commands/platform.ts +40 -46
- package/src/cli/platform/index.ts +1 -1
- package/src/cli/platform-lib/__tests__/CloudflareAdapter.spec.ts +0 -4
- package/src/cli/platform-lib/__tests__/PlatformInspector.spec.ts +10 -3
- package/src/cli/platform-lib/__tests__/VercelAdapter.spec.ts +0 -2
- package/src/cli/platform-lib/adapters/CloudflareAdapter.ts +13 -14
- package/src/cli/platform-lib/adapters/VercelAdapter.ts +6 -11
- package/src/cli/platform-lib/atoms/platformOptions.ts +46 -25
- package/src/cli/platform-lib/schemas/cloudflare.ts +87 -87
- package/src/cli/platform-lib/schemas/platform.ts +51 -51
- package/src/cli/platform-lib/schemas/vercel.ts +28 -28
- package/src/cli/platform-lib/services/CloudflareApi.ts +5 -5
- package/src/cli/platform-lib/services/VercelApi.ts +4 -4
- package/src/cli/platform-lib/services/VercelCli.ts +6 -15
- package/src/cli/platform-lib/services/WranglerApi.ts +6 -15
- package/src/cli/vendor/atoms/vendorOptions.ts +9 -9
- package/src/cli/vendor/commands/VendorCommand.ts +11 -12
- package/src/command/__tests__/$command.spec.ts +82 -83
- package/src/command/__tests__/Asker.spec.ts +6 -13
- package/src/command/__tests__/CliProvider.spec.ts +136 -149
- package/src/command/__tests__/Runner.spec.ts +86 -110
- package/src/command/helpers/Asker.ts +23 -58
- package/src/command/helpers/Runner.ts +34 -110
- package/src/command/index.ts +4 -9
- package/src/command/primitives/$command.ts +10 -10
- package/src/command/providers/CliProvider.ts +183 -161
- package/src/core/Alepha.ts +62 -13
- package/src/core/__tests__/$atom.spec.ts +52 -3
- package/src/core/__tests__/$computed.spec.ts +129 -0
- package/src/core/__tests__/$env.spec.ts +13 -13
- package/src/core/__tests__/$inject.spec.ts +4 -4
- package/src/core/__tests__/$module.spec.ts +1 -1
- package/src/core/__tests__/Alepha-graph.spec.ts +1 -1
- package/src/core/__tests__/Alepha-parseEnv.spec.ts +32 -32
- package/src/core/__tests__/Alepha-start.spec.ts +3 -3
- package/src/core/__tests__/CodecManager.spec.ts +113 -94
- package/src/core/__tests__/KeylessJsonSchemaCodec.spec.ts +138 -138
- package/src/core/__tests__/SchemaValidator.spec.ts +43 -44
- package/src/core/__tests__/StateManager.persist.browser.spec.ts +87 -0
- package/src/core/__tests__/StateManager.spec.ts +423 -0
- package/src/core/__tests__/TypeBox-usecases.spec.ts +8 -8
- package/src/core/__tests__/TypeProvider.spec.ts +314 -309
- package/src/core/__tests__/dump.spec.ts +6 -6
- package/src/core/__tests__/pagination.spec.ts +4 -4
- package/src/core/__tests__/scoped-after-start.spec.ts +43 -0
- package/src/core/errors/TypeBoxError.ts +10 -4
- package/src/core/helpers/FileLike.ts +5 -5
- package/src/core/helpers/coerceStrings.ts +70 -0
- package/src/core/helpers/jsonSchemaToZod.ts +112 -0
- package/src/core/index.shared.ts +4 -1
- package/src/core/primitives/$atom.ts +95 -27
- package/src/core/primitives/$computed.ts +148 -0
- package/src/core/primitives/$env.ts +5 -5
- package/src/core/primitives/$state.ts +1 -1
- package/src/core/providers/AlsProvider.ts +26 -0
- package/src/core/providers/CodecManager.ts +1 -2
- package/src/core/providers/JsonSchemaCodec.ts +1 -2
- package/src/core/providers/KeylessJsonSchemaCodec.ts +82 -57
- package/src/core/providers/SchemaValidator.ts +48 -158
- package/src/core/providers/StateManager.ts +383 -9
- package/src/core/providers/TypeProvider.ts +80 -734
- package/src/core/providers/ZodProvider.ts +380 -0
- package/src/core/providers/zodAugment.ts +69 -0
- package/src/core/schemas/pageQuerySchema.ts +19 -21
- package/src/core/schemas/pageSchema.ts +47 -57
- package/src/crypto/__tests__/SecretProvider.spec.ts +31 -0
- package/src/crypto/providers/SecretProvider.ts +16 -10
- package/src/datetime/primitives/$throttle.ts +6 -1
- package/src/email/brevo/providers/BrevoEmailProvider.ts +4 -4
- package/src/email/cloudflare/providers/CloudflareEmailProvider.ts +6 -6
- package/src/email/core/index.ts +7 -2
- package/src/email/core/primitives/$email.ts +5 -1
- package/src/email/core/providers/LocalEmailProvider.ts +5 -5
- package/src/email/smtp/providers/NodemailerEmailProvider.ts +41 -52
- package/src/fake/__tests__/FakeProvider.spec.ts +110 -110
- package/src/fake/__tests__/keyName.example.ts +21 -21
- package/src/fake/__tests__/keyName.spec.ts +41 -41
- package/src/fake/__tests__/module.example.ts +8 -8
- package/src/fake/providers/FakeProvider.ts +122 -121
- package/src/lock/core/__tests__/lock-mutual-exclusion.spec.ts +44 -0
- package/src/lock/core/index.ts +1 -0
- package/src/lock/core/primitives/$lock.ts +13 -6
- package/src/logger/__tests__/CliFormatterProvider.spec.ts +76 -0
- package/src/logger/__tests__/Logger.spec.ts +49 -0
- package/src/logger/index.ts +25 -18
- package/src/logger/providers/CliFormatterProvider.ts +75 -0
- package/src/logger/schemas/logEntrySchema.ts +10 -10
- package/src/logger/services/Logger.ts +18 -0
- package/src/mcp/__tests__/$prompt.spec.ts +21 -23
- package/src/mcp/__tests__/$tool.spec.ts +22 -22
- package/src/mcp/__tests__/McpServerProvider.spec.ts +11 -11
- package/src/mcp/__tests__/StreamableHttpMcpTransport.spec.ts +2 -2
- package/src/mcp/__tests__/integration.spec.ts +33 -33
- package/src/mcp/primitives/$prompt.ts +11 -9
- package/src/mcp/primitives/$tool.ts +27 -86
- package/src/mcp/transports/StreamableHttpMcpTransport.ts +7 -7
- package/src/orm/__tests__/$repository-tests.ts +133 -27
- package/src/orm/__tests__/$repository.spec.ts +23 -0
- package/src/orm/__tests__/$transactional-tests.ts +4 -4
- package/src/orm/__tests__/ModelBuilder-tests.ts +28 -28
- package/src/orm/__tests__/ModelBuilder.spec.ts +124 -106
- package/src/orm/__tests__/QueryManager.spec.ts +5 -5
- package/src/orm/__tests__/delete-returning-tests.ts +11 -11
- package/src/orm/__tests__/deletedAt-tests.ts +3 -3
- package/src/orm/__tests__/enums.spec.ts +29 -25
- package/src/orm/__tests__/execute-tests.ts +8 -8
- package/src/orm/__tests__/fixtures/bigEntitySchema.ts +48 -48
- package/src/orm/__tests__/fixtures/userEntitySchema.ts +6 -6
- package/src/orm/__tests__/joins-tests.ts +30 -30
- package/src/orm/__tests__/organization-tests.ts +105 -3
- package/src/orm/__tests__/organization.spec.ts +46 -0
- package/src/orm/__tests__/orm-errors.spec.ts +10 -10
- package/src/orm/__tests__/orm-next-tests.ts +29 -29
- package/src/orm/__tests__/orm-showcase-tests.ts +9 -9
- package/src/orm/__tests__/primaryKey.spec.ts +4 -4
- package/src/orm/__tests__/query-date-encoding-tests.ts +17 -17
- package/src/orm/__tests__/ref-auto-onDelete.spec.ts +14 -14
- package/src/orm/__tests__/references.spec.ts +7 -7
- package/src/orm/__tests__/security.spec.ts +17 -17
- package/src/orm/__tests__/string-operators-tests.ts +5 -5
- package/src/orm/__tests__/timestamps-tests.ts +14 -14
- package/src/orm/__tests__/validation-tests.ts +5 -5
- package/src/orm/core/__tests__/BunSqliteProvider.bun.spec.ts +8 -8
- package/src/orm/core/constants/PG_SYMBOLS.ts +13 -1
- package/src/orm/core/entities/alephaSequences.ts +8 -8
- package/src/orm/core/helpers/pgAttr.ts +4 -4
- package/src/orm/core/primitives/$entity.ts +10 -6
- package/src/orm/core/providers/DatabaseTypeProvider.ts +46 -53
- package/src/orm/core/providers/drivers/BunSqliteProvider.ts +8 -8
- package/src/orm/core/providers/drivers/CloudflareD1Provider.ts +3 -5
- package/src/orm/core/providers/drivers/NodeSqliteProvider.ts +8 -8
- package/src/orm/core/schemas/databaseEnvSchema.ts +4 -4
- package/src/orm/core/schemas/insertSchema.ts +14 -18
- package/src/orm/core/schemas/legacyIdSchema.ts +2 -2
- package/src/orm/core/schemas/updateSchema.ts +10 -16
- package/src/orm/core/services/PgRelationManager.ts +2 -2
- package/src/orm/core/services/QueryManager.ts +13 -2
- package/src/orm/core/services/Repository.ts +88 -33
- package/src/orm/core/services/SqliteModelBuilder.ts +38 -45
- package/src/orm/postgres/__tests__/BunPostgresProvider.bun.spec.ts +4 -4
- package/src/orm/postgres/providers/CloudflareHyperdriveProvider.ts +4 -6
- package/src/orm/postgres/schemas/postgresEnvSchema.ts +6 -6
- package/src/orm/postgres/services/PostgresModelBuilder.ts +127 -114
- package/src/queue/core/__tests__/$consumer.spec.ts +4 -4
- package/src/queue/core/__tests__/WorkerProvider.spec.ts +4 -4
- package/src/queue/core/__tests__/shared.ts +6 -6
- package/src/queue/core/primitives/$consumer.ts +5 -5
- package/src/queue/core/primitives/$queue.ts +44 -61
- package/src/queue/core/providers/CloudflareQueueProvider.ts +6 -0
- package/src/queue/core/providers/WorkerProvider.ts +17 -14
- package/src/queue/redis/providers/RedisQueueProvider.ts +3 -3
- package/src/react/core/__tests__/ErrorBoundary.browser.spec.tsx +92 -0
- package/src/react/core/__tests__/Router.spec.tsx +4 -4
- package/src/react/core/__tests__/useComputed.browser.spec.tsx +192 -0
- package/src/react/core/__tests__/useQuery.browser.spec.tsx +48 -0
- package/src/react/core/__tests__/useSelector.browser.spec.tsx +105 -0
- package/src/react/core/__tests__/useStore.browser.spec.tsx +113 -0
- package/src/react/core/components/ErrorBoundary.tsx +42 -0
- package/src/react/core/hooks/useAction.ts +56 -19
- package/src/react/core/hooks/useComputed.ts +91 -0
- package/src/react/core/hooks/useSelector.ts +67 -0
- package/src/react/core/hooks/useStore.ts +36 -17
- package/src/react/core/index.ts +3 -0
- package/src/react/core/utils/shallowEqual.ts +36 -0
- package/src/react/form/__tests__/FormModel-submit-loading.spec.ts +2 -2
- package/src/react/form/__tests__/form-submitting-reactive.browser.spec.tsx +5 -5
- package/src/react/form/__tests__/useForm.browser.spec.tsx +54 -54
- package/src/react/form/errors/FormValidationError.ts +0 -2
- package/src/react/form/hooks/useForm.ts +19 -4
- package/src/react/form/hooks/useFormQuerySync.ts +0 -0
- package/src/react/form/services/FormModel.ts +67 -47
- package/src/react/form/services/parseField.ts +66 -27
- package/src/react/i18n/__tests__/Localize.spec.tsx +1 -1
- package/src/react/i18n/providers/I18nProvider.ts +2 -2
- package/src/react/router/__tests__/$page.browser.spec.tsx +19 -19
- package/src/react/router/__tests__/$page.spec.tsx +21 -21
- package/src/react/router/__tests__/ReactBrowserProvider.browser.spec.ts +87 -1
- package/src/react/router/atoms/ssrManifestAtom.ts +16 -16
- package/src/react/router/components/NestedView.tsx +11 -3
- package/src/react/router/hooks/useQueryParams.ts +1 -1
- package/src/react/router/primitives/$page.ts +2 -2
- package/src/react/router/providers/ReactBrowserProvider.ts +64 -13
- package/src/react/router/providers/ReactPageProvider.ts +26 -12
- package/src/react/router/providers/ReactServerProvider.ts +13 -15
- package/src/react/sitemap/__tests__/$sitemap.spec.ts +2 -2
- package/src/react/ui/atoms/uiAtom.ts +6 -6
- package/src/react/ui/atoms/uiThemeListAtom.ts +7 -7
- package/src/react/ui/hooks/useColorMode.ts +11 -4
- package/src/react/ui/services/SchemaControl.ts +4 -4
- package/src/redis/providers/BunRedisProvider.ts +19 -11
- package/src/redis/providers/NodeRedisProvider.ts +3 -3
- package/src/scheduler/primitives/$scheduler.ts +21 -8
- package/src/security/__tests__/assertRealmScope.spec.ts +29 -0
- package/src/security/atoms/currentTenantAtom.ts +6 -6
- package/src/security/atoms/currentUserAtom.ts +2 -2
- package/src/security/primitives/$issuer.ts +24 -2
- package/src/security/providers/JwtProvider.ts +100 -0
- package/src/security/providers/SecurityProvider.ts +43 -2
- package/src/security/schemas/permissionSchema.ts +19 -19
- package/src/security/schemas/roleSchema.ts +22 -28
- package/src/security/schemas/userAccountInfoSchema.ts +47 -37
- package/src/server/auth/index.ts +0 -3
- package/src/server/auth/primitives/$auth.ts +6 -6
- package/src/server/auth/primitives/$authApple.ts +10 -10
- package/src/server/auth/primitives/$authFacebook.ts +10 -10
- package/src/server/auth/primitives/$authFranceConnect.ts +10 -10
- package/src/server/auth/primitives/$authGithub.ts +10 -10
- package/src/server/auth/primitives/$authGoogle.ts +10 -10
- package/src/server/auth/primitives/$authMicrosoft.ts +14 -14
- package/src/server/auth/providers/ServerAuthProvider.ts +49 -48
- package/src/server/auth/schemas/authenticationProviderSchema.ts +9 -12
- package/src/server/auth/schemas/tokenResponseSchema.ts +2 -2
- package/src/server/auth/schemas/tokensSchema.ts +16 -16
- package/src/server/auth/schemas/userinfoResponseSchema.ts +3 -3
- package/src/server/cookies/__tests__/AtomCookieBinding.spec.ts +80 -0
- package/src/server/cookies/__tests__/AtomCookiePersistence.browser.spec.ts +169 -0
- package/src/server/cookies/__tests__/AtomCookiePersistence.spec.ts +294 -0
- package/src/server/cookies/__tests__/ServerCookiesProvider.spec.ts +14 -14
- package/src/server/cookies/index.browser.ts +4 -1
- package/src/server/cookies/index.ts +8 -1
- package/src/server/cookies/primitives/$cookie.browser.ts +1 -1
- package/src/server/cookies/primitives/$cookie.ts +16 -0
- package/src/server/cookies/providers/AtomCookiePersistence.browser.ts +133 -0
- package/src/server/cookies/providers/AtomCookiePersistence.ts +148 -0
- package/src/server/cookies/providers/ServerCookiesProvider.ts +13 -5
- package/src/server/cookies/services/CookieParser.ts +6 -1
- package/src/server/core/__tests__/$action.spec.ts +13 -13
- package/src/server/core/__tests__/$middleware.spec.ts +10 -10
- package/src/server/core/__tests__/$route.spec.ts +9 -9
- package/src/server/core/__tests__/$sse.spec.ts +26 -26
- package/src/server/core/__tests__/BunHttpServerProvider.bun.spec.ts +6 -6
- package/src/server/core/__tests__/HttpClient.spec.ts +2 -2
- package/src/server/core/__tests__/NodeHttpServerProvider.spec.ts +15 -3
- package/src/server/core/__tests__/ServerBodyParserProvider.spec.ts +14 -14
- package/src/server/core/__tests__/ServerMultipartProvider.spec.ts +33 -33
- package/src/server/core/__tests__/ServerRouterProvider-errorHandler.spec.ts +5 -1
- package/src/server/core/__tests__/ServerRouterProvider-getRoutes.spec.ts +25 -25
- package/src/server/core/__tests__/ServerRouterProvider-serializationError.spec.ts +9 -5
- package/src/server/core/__tests__/ServerRouterProvider-validationError.spec.ts +56 -24
- package/src/server/core/errors/ValidationError.ts +6 -3
- package/src/server/core/helpers/isMultipart.ts +2 -1
- package/src/server/core/index.ts +5 -2
- package/src/server/core/interfaces/ServerRequest.ts +6 -14
- package/src/server/core/primitives/$action.ts +26 -36
- package/src/server/core/primitives/$sse.ts +3 -3
- package/src/server/core/providers/BunHttpServerProvider.ts +8 -9
- package/src/server/core/providers/NodeHttpServerProvider.ts +8 -9
- package/src/server/core/providers/ServerBodyParserProvider.ts +20 -12
- package/src/server/core/providers/ServerCompressProvider.ts +9 -10
- package/src/server/core/providers/ServerHelmetProvider.ts +26 -27
- package/src/server/core/providers/ServerMultipartProvider.ts +19 -19
- package/src/server/core/providers/ServerRouterProvider.ts +44 -15
- package/src/server/core/schemas/errorSchema.ts +20 -25
- package/src/server/core/schemas/okSchema.ts +9 -14
- package/src/server/core/services/HttpClient.ts +13 -1
- package/src/server/core/services/ServerRequestParser.ts +6 -6
- package/src/server/cors/providers/ServerCorsProvider.ts +26 -28
- package/src/server/health/schemas/healthSchema.ts +6 -6
- package/src/server/links/__tests__/$remote.spec.ts +3 -3
- package/src/server/links/__tests__/BatchEndpoint.spec.ts +9 -9
- package/src/server/links/__tests__/LinkProvider.spec.ts +9 -9
- package/src/server/links/__tests__/ServerLinksProvider.spec.ts +23 -23
- package/src/server/links/__tests__/fixtures/CrudApp.ts +21 -21
- package/src/server/links/atoms/apiLinksAtom.ts +2 -2
- package/src/server/links/atoms/linkOptionsAtom.ts +6 -6
- package/src/server/links/primitives/$remote.ts +3 -3
- package/src/server/links/providers/LinkProvider.ts +3 -3
- package/src/server/links/providers/ServerLinksProvider.ts +20 -20
- package/src/server/links/schemas/apiLinksResponseSchema.ts +23 -23
- package/src/server/proxy/__tests__/$proxy.spec.ts +9 -9
- package/src/server/proxy/providers/ServerProxyProvider.ts +5 -0
- package/src/server/rate-limit/providers/ServerRateLimitProvider.ts +18 -20
- package/src/server/swagger/__tests__/$swagger.spec.ts +91 -94
- package/src/server/swagger/__tests__/ui.spec.ts +3 -3
- package/src/server/swagger/providers/ServerSwaggerProvider.ts +66 -43
- package/src/system/__tests__/NodeShellProvider.spec.ts +46 -0
- package/src/system/providers/NodeShellProvider.ts +4 -1
- package/src/topic/core/__tests__/$subscriber.spec.ts +4 -4
- package/src/topic/core/__tests__/shared.ts +8 -8
- package/src/topic/core/primitives/$subscriber.ts +5 -5
- package/src/topic/core/primitives/$topic.ts +14 -14
- package/src/topic/redis/providers/RedisTopicProvider.ts +3 -3
- package/dist/container/core/index.d.ts +0 -236
- package/dist/container/core/index.d.ts.map +0 -1
- package/dist/container/core/index.js +0 -231
- package/dist/container/core/index.js.map +0 -1
- package/dist/container/core/index.workerd.js +0 -192
- package/dist/container/core/index.workerd.js.map +0 -1
- package/src/command/helpers/PrettyAsker.ts +0 -256
- package/src/command/helpers/PrettyPrint.ts +0 -332
- package/src/container/core/__tests__/$container.spec.ts +0 -83
- package/src/container/core/index.ts +0 -50
- package/src/container/core/index.workerd.ts +0 -53
- package/src/container/core/interfaces/ContainerOptions.ts +0 -69
- package/src/container/core/primitives/$container.ts +0 -100
- package/src/container/core/providers/CloudflareContainerProvider.ts +0 -70
- package/src/container/core/providers/ContainerProvider.ts +0 -92
- package/src/container/core/providers/MockContainerProvider.ts +0 -62
- package/src/container/core/providers/NodeContainerProvider.ts +0 -53
- package/src/core/__tests__/jsonSchemaToTypeBox.spec.ts +0 -771
- package/src/core/helpers/jsonSchemaToTypeBox.ts +0 -359
- package/src/server/auth/__tests__/authFederationClient.spec.ts +0 -40
- package/src/server/auth/__tests__/federationAssertion.spec.ts +0 -146
- package/src/server/auth/helpers/federationAssertion.ts +0 -74
- package/src/server/auth/primitives/$authFederationBroker.ts +0 -273
- package/src/server/auth/primitives/$authFederationClient.ts +0 -89
- /package/dist/orm/core/{chunk-B4FMCO8f.js → rolldown-runtime-B4FMCO8f.js} +0 -0
package/dist/cli/core/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
import { $atom, $hook, $inject, $module, $state, Alepha, AlephaError, __alephaRef,
|
|
3
|
-
import { $command, CliProvider, EnvUtils
|
|
2
|
+
import { $atom, $hook, $inject, $module, $state, Alepha, AlephaError, __alephaRef, z } from "alepha";
|
|
3
|
+
import { $command, CliProvider, EnvUtils } from "alepha/command";
|
|
4
4
|
import { $logger, ConsoleColorProvider } from "alepha/logger";
|
|
5
5
|
import { FileSystemProvider, ShellProvider } from "alepha/system";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
@@ -11,7 +11,7 @@ import pkg from "alepha/package.json" with { type: "json" };
|
|
|
11
11
|
import { analyzer } from "vite-bundle-analyzer";
|
|
12
12
|
import { KV_DEFAULT_BINDING } from "alepha/cache";
|
|
13
13
|
import { SEND_EMAIL_DEFAULT_BINDING } from "alepha/email/cloudflare";
|
|
14
|
-
import { QUEUE_DEFAULT_BINDING } from "alepha/queue";
|
|
14
|
+
import { QUEUE_DEFAULT_BINDING, QUEUE_DEFAULT_MAX_RETRIES } from "alepha/queue";
|
|
15
15
|
import { promisify } from "node:util";
|
|
16
16
|
import { brotliCompress, gzip } from "node:zlib";
|
|
17
17
|
import { exec, spawn } from "node:child_process";
|
|
@@ -20,10 +20,10 @@ import { pathToFileURL } from "node:url";
|
|
|
20
20
|
//#region ../../src/cli/core/atoms/appEntryOptions.ts
|
|
21
21
|
const appEntryOptions = $atom({
|
|
22
22
|
name: "alepha.cli.appEntry.options",
|
|
23
|
-
schema:
|
|
24
|
-
server:
|
|
25
|
-
browser:
|
|
26
|
-
style:
|
|
23
|
+
schema: z.object({
|
|
24
|
+
server: z.text().optional(),
|
|
25
|
+
browser: z.text().optional(),
|
|
26
|
+
style: z.text().optional()
|
|
27
27
|
}),
|
|
28
28
|
default: {}
|
|
29
29
|
});
|
|
@@ -38,14 +38,14 @@ const appEntryOptions = $atom({
|
|
|
38
38
|
const buildOptions = $atom({
|
|
39
39
|
name: "alepha.cli.build.options",
|
|
40
40
|
description: "Build configuration options",
|
|
41
|
-
schema:
|
|
41
|
+
schema: z.object({
|
|
42
42
|
/**
|
|
43
43
|
* Generate build stats report.
|
|
44
44
|
*
|
|
45
45
|
* - `true` - Generate a static HTML report
|
|
46
46
|
* - `"json"` - Generate a JSON report
|
|
47
47
|
*/
|
|
48
|
-
stats:
|
|
48
|
+
stats: z.union([z.boolean(), z.enum(["json"])]).optional(),
|
|
49
49
|
/**
|
|
50
50
|
* Deployment target for the build output.
|
|
51
51
|
*
|
|
@@ -53,13 +53,13 @@ const buildOptions = $atom({
|
|
|
53
53
|
* - `vercel` - Generate Vercel deployment configuration (forces node runtime)
|
|
54
54
|
* - `cloudflare` - Generate Cloudflare Workers configuration (forces workerd runtime)
|
|
55
55
|
*/
|
|
56
|
-
target:
|
|
56
|
+
target: z.enum([
|
|
57
57
|
"bare",
|
|
58
58
|
"docker",
|
|
59
59
|
"vercel",
|
|
60
60
|
"cloudflare",
|
|
61
61
|
"static"
|
|
62
|
-
])),
|
|
62
|
+
]).optional(),
|
|
63
63
|
/**
|
|
64
64
|
* JavaScript runtime for the build output.
|
|
65
65
|
*
|
|
@@ -71,71 +71,71 @@ const buildOptions = $atom({
|
|
|
71
71
|
* - `cloudflare` always uses `workerd`
|
|
72
72
|
* - `vercel` always uses `node`
|
|
73
73
|
*/
|
|
74
|
-
runtime:
|
|
74
|
+
runtime: z.enum([
|
|
75
75
|
"node",
|
|
76
76
|
"bun",
|
|
77
77
|
"workerd"
|
|
78
|
-
])),
|
|
78
|
+
]).optional(),
|
|
79
79
|
/**
|
|
80
80
|
* Output directory configuration.
|
|
81
81
|
*/
|
|
82
|
-
output:
|
|
82
|
+
output: z.object({
|
|
83
83
|
/**
|
|
84
84
|
* Root dist directory.
|
|
85
85
|
*
|
|
86
86
|
* @default "dist"
|
|
87
87
|
*/
|
|
88
|
-
dist:
|
|
88
|
+
dist: z.string().default("dist").optional(),
|
|
89
89
|
/**
|
|
90
90
|
* Public/client subdirectory.
|
|
91
91
|
*
|
|
92
92
|
* @default "public"
|
|
93
93
|
*/
|
|
94
|
-
public:
|
|
95
|
-
})),
|
|
94
|
+
public: z.string().default("public").optional()
|
|
95
|
+
}).optional(),
|
|
96
96
|
/**
|
|
97
97
|
* Vercel-specific deployment configuration.
|
|
98
98
|
*
|
|
99
99
|
* Note: Set `target: "vercel"` to enable Vercel deployment.
|
|
100
100
|
* This object is only for additional configuration.
|
|
101
101
|
*/
|
|
102
|
-
vercel:
|
|
103
|
-
projectName:
|
|
104
|
-
orgId:
|
|
105
|
-
projectId:
|
|
106
|
-
config:
|
|
107
|
-
path:
|
|
108
|
-
schedule:
|
|
109
|
-
}))) }))
|
|
110
|
-
})),
|
|
102
|
+
vercel: z.object({
|
|
103
|
+
projectName: z.string().optional(),
|
|
104
|
+
orgId: z.string().optional(),
|
|
105
|
+
projectId: z.string().optional(),
|
|
106
|
+
config: z.object({ crons: z.array(z.object({
|
|
107
|
+
path: z.string(),
|
|
108
|
+
schedule: z.string()
|
|
109
|
+
})).optional() }).optional()
|
|
110
|
+
}).optional(),
|
|
111
111
|
/**
|
|
112
112
|
* Cloudflare-specific deployment configuration.
|
|
113
113
|
*
|
|
114
114
|
* Note: Set `target: "cloudflare"` to enable Cloudflare deployment.
|
|
115
115
|
* This object is only for additional configuration.
|
|
116
116
|
*/
|
|
117
|
-
cloudflare:
|
|
117
|
+
cloudflare: z.object({ config: z.json().optional() }).optional(),
|
|
118
118
|
/**
|
|
119
119
|
* Docker-specific deployment configuration.
|
|
120
120
|
*
|
|
121
121
|
* Note: Set `target: "docker"` to enable Docker deployment.
|
|
122
122
|
* This object is only for additional configuration.
|
|
123
123
|
*/
|
|
124
|
-
docker:
|
|
124
|
+
docker: z.object({
|
|
125
125
|
/**
|
|
126
126
|
* Base image for the Dockerfile (FROM instruction).
|
|
127
127
|
*
|
|
128
128
|
* @default "node:24-alpine" for node runtime
|
|
129
129
|
* @default "oven/bun:alpine" for bun runtime
|
|
130
130
|
*/
|
|
131
|
-
from:
|
|
131
|
+
from: z.string().optional(),
|
|
132
132
|
/**
|
|
133
133
|
* Command to run in the Docker container.
|
|
134
134
|
*
|
|
135
135
|
* @default "node" for node runtime
|
|
136
136
|
* @default "bun" for bun runtime
|
|
137
137
|
*/
|
|
138
|
-
command:
|
|
138
|
+
command: z.string().optional(),
|
|
139
139
|
/**
|
|
140
140
|
* Extra packages to install globally in the generated image.
|
|
141
141
|
*
|
|
@@ -149,11 +149,11 @@ const buildOptions = $atom({
|
|
|
149
149
|
*
|
|
150
150
|
* @example install: ["wrangler"]
|
|
151
151
|
*/
|
|
152
|
-
install:
|
|
152
|
+
install: z.array(z.string()).optional(),
|
|
153
153
|
/**
|
|
154
154
|
* Docker build options (used when --image flag is passed).
|
|
155
155
|
*/
|
|
156
|
-
image:
|
|
156
|
+
image: z.object({
|
|
157
157
|
/**
|
|
158
158
|
* Default image tag (name without version).
|
|
159
159
|
*
|
|
@@ -165,13 +165,13 @@ const buildOptions = $atom({
|
|
|
165
165
|
* @example "myproject/myapp"
|
|
166
166
|
* @example "ghcr.io/myorg/myapp"
|
|
167
167
|
*/
|
|
168
|
-
tag:
|
|
168
|
+
tag: z.string(),
|
|
169
169
|
/**
|
|
170
170
|
* Additional arguments to pass to `docker build`.
|
|
171
171
|
*
|
|
172
172
|
* @example '--platform linux/amd64 --no-cache'
|
|
173
173
|
*/
|
|
174
|
-
args:
|
|
174
|
+
args: z.string().optional(),
|
|
175
175
|
/**
|
|
176
176
|
* Auto-add OCI standard labels (revision, created, version).
|
|
177
177
|
*
|
|
@@ -180,8 +180,8 @@ const buildOptions = $atom({
|
|
|
180
180
|
* - org.opencontainers.image.created (build timestamp)
|
|
181
181
|
* - org.opencontainers.image.version (from image tag)
|
|
182
182
|
*/
|
|
183
|
-
oci:
|
|
184
|
-
})),
|
|
183
|
+
oci: z.boolean().optional()
|
|
184
|
+
}).optional(),
|
|
185
185
|
/**
|
|
186
186
|
* Compile the server entry to a single static binary using
|
|
187
187
|
* `bun build --compile`, then package it inside a minimal base image
|
|
@@ -197,7 +197,7 @@ const buildOptions = $atom({
|
|
|
197
197
|
*
|
|
198
198
|
* Pass `true` to enable with defaults, or an object to override.
|
|
199
199
|
*/
|
|
200
|
-
compile:
|
|
200
|
+
compile: z.union([z.boolean(), z.object({
|
|
201
201
|
/**
|
|
202
202
|
* Bun target triple, e.g. `bun-linux-x64-musl`,
|
|
203
203
|
* `bun-linux-arm64-musl`, or `bun-linux-x64-modern-musl`
|
|
@@ -205,27 +205,27 @@ const buildOptions = $atom({
|
|
|
205
205
|
*
|
|
206
206
|
* @default derived from host arch — always linux-musl.
|
|
207
207
|
*/
|
|
208
|
-
target:
|
|
208
|
+
target: z.string().optional(),
|
|
209
209
|
/**
|
|
210
210
|
* Base image for the generated Dockerfile.
|
|
211
211
|
*
|
|
212
212
|
* @default "gcr.io/distroless/static-debian12"
|
|
213
213
|
*/
|
|
214
|
-
base:
|
|
214
|
+
base: z.string().optional(),
|
|
215
215
|
/**
|
|
216
216
|
* Minify the compiled output.
|
|
217
217
|
*
|
|
218
218
|
* @default true
|
|
219
219
|
*/
|
|
220
|
-
minify:
|
|
221
|
-
})]))
|
|
222
|
-
})),
|
|
220
|
+
minify: z.boolean().optional()
|
|
221
|
+
})]).optional()
|
|
222
|
+
}).optional(),
|
|
223
223
|
/**
|
|
224
224
|
* Static site deployment configuration.
|
|
225
225
|
*
|
|
226
226
|
* Note: Set `target: "static"` to enable static site generation.
|
|
227
227
|
*/
|
|
228
|
-
static:
|
|
228
|
+
static: z.object({
|
|
229
229
|
/**
|
|
230
230
|
* Surge domain for deployment.
|
|
231
231
|
*
|
|
@@ -235,36 +235,36 @@ const buildOptions = $atom({
|
|
|
235
235
|
* @example "my-app.surge.sh"
|
|
236
236
|
* @example "my-custom-domain.com"
|
|
237
237
|
*/
|
|
238
|
-
domain:
|
|
238
|
+
domain: z.string().optional() }).optional(),
|
|
239
239
|
/**
|
|
240
240
|
* PWA (Progressive Web App) configuration.
|
|
241
241
|
*
|
|
242
242
|
* Generates a web app manifest and enables installability.
|
|
243
243
|
* Requires a client-side bundle (React).
|
|
244
244
|
*/
|
|
245
|
-
pwa:
|
|
245
|
+
pwa: z.object({
|
|
246
246
|
/**
|
|
247
247
|
* Full application name displayed on the splash screen
|
|
248
248
|
* and in the OS app switcher.
|
|
249
249
|
*/
|
|
250
|
-
name:
|
|
250
|
+
name: z.string(),
|
|
251
251
|
/**
|
|
252
252
|
* Short name displayed on the home screen icon.
|
|
253
253
|
* Falls back to `name` if omitted.
|
|
254
254
|
*/
|
|
255
|
-
shortName:
|
|
255
|
+
shortName: z.string().optional(),
|
|
256
256
|
/**
|
|
257
257
|
* Theme color used for the browser toolbar and OS chrome.
|
|
258
258
|
*
|
|
259
259
|
* @default "#ffffff"
|
|
260
260
|
*/
|
|
261
|
-
themeColor:
|
|
261
|
+
themeColor: z.string().optional(),
|
|
262
262
|
/**
|
|
263
263
|
* Background color for the splash screen.
|
|
264
264
|
*
|
|
265
265
|
* @default "#ffffff"
|
|
266
266
|
*/
|
|
267
|
-
backgroundColor:
|
|
267
|
+
backgroundColor: z.string().optional(),
|
|
268
268
|
/**
|
|
269
269
|
* Display mode for the installed PWA.
|
|
270
270
|
*
|
|
@@ -275,19 +275,19 @@ domain: t.optional(t.string()) })),
|
|
|
275
275
|
*
|
|
276
276
|
* @default "standalone"
|
|
277
277
|
*/
|
|
278
|
-
display:
|
|
278
|
+
display: z.enum([
|
|
279
279
|
"standalone",
|
|
280
280
|
"fullscreen",
|
|
281
281
|
"minimal-ui",
|
|
282
282
|
"browser"
|
|
283
|
-
])),
|
|
283
|
+
]).optional(),
|
|
284
284
|
/**
|
|
285
285
|
* Enable offline support via service worker.
|
|
286
286
|
*
|
|
287
287
|
* TODO: Not yet implemented.
|
|
288
288
|
*/
|
|
289
|
-
offline:
|
|
290
|
-
}))
|
|
289
|
+
offline: z.boolean().optional()
|
|
290
|
+
}).optional()
|
|
291
291
|
}),
|
|
292
292
|
default: {}
|
|
293
293
|
});
|
|
@@ -302,11 +302,11 @@ domain: t.optional(t.string()) })),
|
|
|
302
302
|
const devOptions = $atom({
|
|
303
303
|
name: "alepha.cli.dev.options",
|
|
304
304
|
description: "Dev configuration options",
|
|
305
|
-
schema:
|
|
305
|
+
schema: z.object({
|
|
306
306
|
/**
|
|
307
307
|
* Disable Vite React plugin.
|
|
308
308
|
*/
|
|
309
|
-
noViteReactPlugin:
|
|
309
|
+
noViteReactPlugin: z.boolean().default(false).optional() }),
|
|
310
310
|
default: {}
|
|
311
311
|
});
|
|
312
312
|
//#endregion
|
|
@@ -1255,11 +1255,11 @@ export class HelloController {
|
|
|
1255
1255
|
//#endregion
|
|
1256
1256
|
//#region ../../src/cli/core/templates/apiHelloResponseSchemaTs.ts
|
|
1257
1257
|
const apiHelloResponseSchemaTs = () => {
|
|
1258
|
-
return `import { type Static,
|
|
1258
|
+
return `import { type Static, z } from "alepha";
|
|
1259
1259
|
|
|
1260
|
-
export const helloResponseSchema =
|
|
1261
|
-
appName:
|
|
1262
|
-
serverTime:
|
|
1260
|
+
export const helloResponseSchema = z.object({
|
|
1261
|
+
appName: z.text(),
|
|
1262
|
+
serverTime: z.datetime(),
|
|
1263
1263
|
});
|
|
1264
1264
|
|
|
1265
1265
|
export type HelloResponse = Static<typeof helloResponseSchema>;
|
|
@@ -2066,6 +2066,14 @@ var BuildClientTask = class extends BuildTask {
|
|
|
2066
2066
|
//#region ../../src/cli/core/tasks/BuildCloudflareTask.ts
|
|
2067
2067
|
const CLOUDFLARE_EMAIL_PROVIDER_NAME = "CloudflareEmailProvider";
|
|
2068
2068
|
/**
|
|
2069
|
+
* Best-effort Cloudflare zone (registrable domain) for a wildcard Worker route:
|
|
2070
|
+
* strip the leading `*.` and any subdomain labels, keep the last two — e.g.
|
|
2071
|
+
* `*.club.alepha.dev` → `alepha.dev`, `*.alepha.club` → `alepha.club`. Correct
|
|
2072
|
+
* for single-label TLDs (the common case); a multi-label public suffix
|
|
2073
|
+
* (`.co.uk`) or a CF subdomain zone needs an explicit `CLOUDFLARE_ZONE`.
|
|
2074
|
+
*/
|
|
2075
|
+
const deriveZone = (domain) => domain.replace(/^\*\./, "").split(".").slice(-2).join(".");
|
|
2076
|
+
/**
|
|
2069
2077
|
* Generate Cloudflare Workers deployment configuration.
|
|
2070
2078
|
*
|
|
2071
2079
|
* Creates:
|
|
@@ -2111,16 +2119,16 @@ var BuildCloudflareTask = class BuildCloudflareTask extends BuildTask {
|
|
|
2111
2119
|
head_sampling_rate: 1
|
|
2112
2120
|
};
|
|
2113
2121
|
this.enhanceDomain(wrangler);
|
|
2122
|
+
this.enhanceServices(wrangler);
|
|
2114
2123
|
this.enhanceCron(ctx, wrangler);
|
|
2115
2124
|
this.enhanceDatabase(wrangler);
|
|
2116
2125
|
this.enhanceR2(wrangler);
|
|
2117
2126
|
this.enhanceKV(wrangler);
|
|
2118
2127
|
this.enhanceQueue(wrangler);
|
|
2119
2128
|
this.enhanceEmail(ctx, wrangler);
|
|
2120
|
-
const containers = this.enhanceContainers(ctx, wrangler);
|
|
2121
2129
|
await this.fs.writeFile(this.fs.join(root, distDir, "wrangler.jsonc"), JSON.stringify(wrangler, null, 2));
|
|
2122
|
-
if (!ctx.manifest) await this.writeManifest(ctx, root, distDir, name
|
|
2123
|
-
await this.writeWorkerEntryPoint(root, distDir
|
|
2130
|
+
if (!ctx.manifest) await this.writeManifest(ctx, root, distDir, name);
|
|
2131
|
+
await this.writeWorkerEntryPoint(root, distDir);
|
|
2124
2132
|
}
|
|
2125
2133
|
/**
|
|
2126
2134
|
* Write `dist/manifest.json` — a build-time snapshot of everything
|
|
@@ -2129,7 +2137,7 @@ var BuildCloudflareTask = class BuildCloudflareTask extends BuildTask {
|
|
|
2129
2137
|
* the deploy path can skip the Vite-based introspection step and the
|
|
2130
2138
|
* workspace's runtime npm install.
|
|
2131
2139
|
*/
|
|
2132
|
-
async writeManifest(ctx, root, distDir, name
|
|
2140
|
+
async writeManifest(ctx, root, distDir, name) {
|
|
2133
2141
|
let hasDatabase = false;
|
|
2134
2142
|
let hasBucket = false;
|
|
2135
2143
|
let hasKV = false;
|
|
@@ -2176,32 +2184,36 @@ var BuildCloudflareTask = class BuildCloudflareTask extends BuildTask {
|
|
|
2176
2184
|
hasCron: crons.length > 0
|
|
2177
2185
|
},
|
|
2178
2186
|
crons,
|
|
2179
|
-
containers: containers.map((c) => ({
|
|
2180
|
-
name: c.name,
|
|
2181
|
-
className: c.className,
|
|
2182
|
-
image: c.image,
|
|
2183
|
-
port: c.port,
|
|
2184
|
-
sleepAfter: c.sleepAfter,
|
|
2185
|
-
instanceType: c.instanceType,
|
|
2186
|
-
maxInstances: c.maxInstances
|
|
2187
|
-
})),
|
|
2188
2187
|
email,
|
|
2189
2188
|
env
|
|
2190
2189
|
};
|
|
2191
2190
|
await this.fs.writeFile(this.fs.join(root, distDir, "manifest.json"), JSON.stringify(manifest, null, 2));
|
|
2192
2191
|
}
|
|
2192
|
+
/** Worker-to-worker service bindings, from CLOUDFLARE_SERVICES (JSON). */
|
|
2193
|
+
enhanceServices(wrangler) {
|
|
2194
|
+
const raw = process.env.CLOUDFLARE_SERVICES;
|
|
2195
|
+
if (!raw) return;
|
|
2196
|
+
const services = JSON.parse(raw);
|
|
2197
|
+
if (services.length > 0) wrangler.services = services;
|
|
2198
|
+
}
|
|
2193
2199
|
enhanceDomain(wrangler) {
|
|
2194
2200
|
const domain = process.env.CLOUDFLARE_DOMAIN;
|
|
2195
2201
|
if (!domain) return;
|
|
2196
2202
|
if (domain.includes("*")) {
|
|
2197
|
-
const zone = process.env.CLOUDFLARE_ZONE;
|
|
2198
|
-
if (!zone) throw new Error(`Wildcard domain "${domain}" requires CLOUDFLARE_ZONE to be set (the parent zone name, e.g. "alepha.dev").`);
|
|
2203
|
+
const zone = process.env.CLOUDFLARE_ZONE || deriveZone(domain);
|
|
2199
2204
|
wrangler.routes = [{
|
|
2200
2205
|
pattern: domain.endsWith("/*") ? domain : `${domain}/*`,
|
|
2201
2206
|
zone_name: zone
|
|
2202
2207
|
}];
|
|
2203
2208
|
return;
|
|
2204
2209
|
}
|
|
2210
|
+
if (process.env.CLOUDFLARE_ZONE) {
|
|
2211
|
+
wrangler.routes = [{
|
|
2212
|
+
pattern: `${domain}/*`,
|
|
2213
|
+
zone_name: process.env.CLOUDFLARE_ZONE
|
|
2214
|
+
}];
|
|
2215
|
+
return;
|
|
2216
|
+
}
|
|
2205
2217
|
wrangler.routes = [{
|
|
2206
2218
|
pattern: domain,
|
|
2207
2219
|
custom_domain: true
|
|
@@ -2236,13 +2248,11 @@ var BuildCloudflareTask = class BuildCloudflareTask extends BuildTask {
|
|
|
2236
2248
|
if (!url?.startsWith("d1:")) return;
|
|
2237
2249
|
const [dbName, id] = url.replace("d1://", "").replace("d1:", "").split(":");
|
|
2238
2250
|
const binding = BuildCloudflareTask.D1_BINDING;
|
|
2239
|
-
const jurisdiction = process.env.CLOUDFLARE_JURISDICTION;
|
|
2240
2251
|
wrangler.d1_databases = wrangler.d1_databases || [];
|
|
2241
2252
|
wrangler.d1_databases.push({
|
|
2242
2253
|
binding,
|
|
2243
2254
|
database_name: dbName,
|
|
2244
|
-
database_id: id
|
|
2245
|
-
...jurisdiction ? { jurisdiction } : {}
|
|
2255
|
+
database_id: id
|
|
2246
2256
|
});
|
|
2247
2257
|
wrangler.vars ??= {};
|
|
2248
2258
|
wrangler.vars.DATABASE_URL = `d1://${binding}`;
|
|
@@ -2291,8 +2301,13 @@ var BuildCloudflareTask = class BuildCloudflareTask extends BuildTask {
|
|
|
2291
2301
|
binding: QUEUE_DEFAULT_BINDING,
|
|
2292
2302
|
queue: queueName
|
|
2293
2303
|
});
|
|
2304
|
+
const maxRetries = Number(process.env.CLOUDFLARE_QUEUE_MAX_RETRIES);
|
|
2294
2305
|
wrangler.queues.consumers = wrangler.queues.consumers || [];
|
|
2295
|
-
wrangler.queues.consumers.push({
|
|
2306
|
+
wrangler.queues.consumers.push({
|
|
2307
|
+
queue: queueName,
|
|
2308
|
+
dead_letter_queue: process.env.CLOUDFLARE_QUEUE_DLQ_NAME || `${queueName}-dlq`,
|
|
2309
|
+
max_retries: Number.isSafeInteger(maxRetries) ? maxRetries : QUEUE_DEFAULT_MAX_RETRIES
|
|
2310
|
+
});
|
|
2296
2311
|
}
|
|
2297
2312
|
enhanceEmail(ctx, wrangler) {
|
|
2298
2313
|
let binding;
|
|
@@ -2306,96 +2321,25 @@ var BuildCloudflareTask = class BuildCloudflareTask extends BuildTask {
|
|
|
2306
2321
|
if (wrangler.send_email.some((b) => b.name === binding)) return;
|
|
2307
2322
|
wrangler.send_email.push({ name: binding });
|
|
2308
2323
|
}
|
|
2309
|
-
|
|
2310
|
-
* Discover `$container` primitives and emit the matching Cloudflare
|
|
2311
|
-
* Containers bindings, Durable Object bindings, and migrations into
|
|
2312
|
-
* `wrangler.jsonc`. The DO class declarations are added later, when
|
|
2313
|
-
* the worker entry point is written.
|
|
2314
|
-
*
|
|
2315
|
-
* Returns the list of container descriptors so
|
|
2316
|
-
* `writeWorkerEntryPoint` can emit `export class <NAME> extends
|
|
2317
|
-
* Container` declarations referencing them.
|
|
2318
|
-
*/
|
|
2319
|
-
discoverContainers(ctx) {
|
|
2320
|
-
return ctx.alepha.primitives("container").map((p) => ({
|
|
2321
|
-
name: p.name.toUpperCase(),
|
|
2322
|
-
className: p.name.split(/[^a-zA-Z0-9]/).filter(Boolean).map((s) => s[0].toUpperCase() + s.slice(1)).join(""),
|
|
2323
|
-
image: p.options.image,
|
|
2324
|
-
port: p.options.port ?? 3e3,
|
|
2325
|
-
sleepAfter: typeof p.options.sleepAfter === "string" ? p.options.sleepAfter : "15m",
|
|
2326
|
-
instanceType: p.options.instanceType === "dev" ? "lite" : p.options.instanceType ?? "lite",
|
|
2327
|
-
maxInstances: p.options.maxInstances ?? 5,
|
|
2328
|
-
envVars: p.options.envVars
|
|
2329
|
-
}));
|
|
2330
|
-
}
|
|
2331
|
-
/**
|
|
2332
|
-
* Expand a short image ref (e.g. `alepha-rocket:0.1.0`) into the
|
|
2333
|
-
* fully-qualified `registry.cloudflare.com/<account>/<image>:<tag>`
|
|
2334
|
-
* URL that wrangler validates at deploy time.
|
|
2335
|
-
*
|
|
2336
|
-
* Cloudflare Containers only pulls from `registry.cloudflare.com`;
|
|
2337
|
-
* wrangler accepts either a Dockerfile path or a fully-qualified
|
|
2338
|
-
* registry URL in the `image` field — not a bare DockerHub-style
|
|
2339
|
-
* name. We let `$container({ image })` callers write the short
|
|
2340
|
-
* form (it matches what `wrangler containers push <local>` accepts
|
|
2341
|
-
* + matches the local docker tag) and rewrite to the CF registry
|
|
2342
|
-
* URL here.
|
|
2343
|
-
*
|
|
2344
|
-
* Pass-through cases:
|
|
2345
|
-
* - already a full URL: starts with `registry.cloudflare.com/`
|
|
2346
|
-
* or contains a scheme/`://`
|
|
2347
|
-
* - looks like a Dockerfile path: starts with `./` or `/`
|
|
2348
|
-
*/
|
|
2349
|
-
resolveContainerImage(image) {
|
|
2350
|
-
if (image.startsWith("./") || image.startsWith("/") || image.startsWith("registry.cloudflare.com/") || image.includes("://")) return image;
|
|
2351
|
-
const accountId = process.env.CLOUDFLARE_ACCOUNT_ID;
|
|
2352
|
-
if (!accountId) return image;
|
|
2353
|
-
return `registry.cloudflare.com/${accountId}/${image}`;
|
|
2354
|
-
}
|
|
2355
|
-
enhanceContainers(ctx, wrangler) {
|
|
2356
|
-
const descriptors = ctx.manifest ? ctx.manifest.containers : this.discoverContainers(ctx);
|
|
2357
|
-
if (descriptors.length === 0) return [];
|
|
2358
|
-
wrangler.containers = wrangler.containers || [];
|
|
2359
|
-
wrangler.durable_objects = wrangler.durable_objects || {};
|
|
2360
|
-
wrangler.durable_objects.bindings = wrangler.durable_objects.bindings || [];
|
|
2361
|
-
wrangler.migrations = wrangler.migrations || [];
|
|
2362
|
-
const newSqliteClasses = [];
|
|
2363
|
-
for (const d of descriptors) {
|
|
2364
|
-
wrangler.containers.push({
|
|
2365
|
-
class_name: d.className,
|
|
2366
|
-
image: this.resolveContainerImage(d.image),
|
|
2367
|
-
instance_type: d.instanceType,
|
|
2368
|
-
max_instances: d.maxInstances
|
|
2369
|
-
});
|
|
2370
|
-
wrangler.durable_objects.bindings.push({
|
|
2371
|
-
name: d.name,
|
|
2372
|
-
class_name: d.className
|
|
2373
|
-
});
|
|
2374
|
-
newSqliteClasses.push(d.className);
|
|
2375
|
-
}
|
|
2376
|
-
if (newSqliteClasses.length > 0) wrangler.migrations.push({
|
|
2377
|
-
tag: "containers-v1",
|
|
2378
|
-
new_sqlite_classes: newSqliteClasses
|
|
2379
|
-
});
|
|
2380
|
-
return descriptors;
|
|
2381
|
-
}
|
|
2382
|
-
async writeWorkerEntryPoint(root, distDir, containers = []) {
|
|
2383
|
-
const containerDeclarations = containers.map((c) => {
|
|
2384
|
-
const envVars = c.envVars ? ` envVars = ${JSON.stringify(c.envVars)};\n` : "";
|
|
2385
|
-
return `export class ${c.className} extends globalThis.__alepha_CloudflareContainer {\n defaultPort = ${c.port};\n sleepAfter = "${c.sleepAfter}";\n${envVars}}`;
|
|
2386
|
-
}).join("\n\n");
|
|
2324
|
+
async writeWorkerEntryPoint(root, distDir) {
|
|
2387
2325
|
const workerCode = `
|
|
2388
2326
|
import "./index.js";
|
|
2389
2327
|
|
|
2390
|
-
//
|
|
2391
|
-
// so background work (notably $job direct dispatch)
|
|
2392
|
-
// alive past the response.
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2328
|
+
// Run an invocation inside an Alepha fork carrying THIS invocation's
|
|
2329
|
+
// \`executionCtx.waitUntil\`, so background work (notably $job direct dispatch)
|
|
2330
|
+
// can keep the isolate alive past the response.
|
|
2331
|
+
//
|
|
2332
|
+
// It must be the async context, never the shared store: one isolate serves
|
|
2333
|
+
// concurrent invocations, so a store slot would let request B overwrite
|
|
2334
|
+
// request A's handle — A's background work would then call B's already-returned
|
|
2335
|
+
// context ("waitUntil after response") and be silently dropped.
|
|
2336
|
+
const withExecutionContext = (executionCtx, fn) => {
|
|
2337
|
+
const waitUntil =
|
|
2338
|
+
executionCtx && typeof executionCtx.waitUntil === "function"
|
|
2339
|
+
? (p) => executionCtx.waitUntil(p)
|
|
2340
|
+
: undefined;
|
|
2341
|
+
|
|
2342
|
+
return __alepha.context.run(fn, { "cloudflare.waitUntil": waitUntil });
|
|
2399
2343
|
};
|
|
2400
2344
|
|
|
2401
2345
|
// Bind the per-invocation Worker \`env\`: keep the full binding (D1, R2, KV, …)
|
|
@@ -2411,7 +2355,6 @@ export default {
|
|
|
2411
2355
|
const ctx = { req: request, res: undefined };
|
|
2412
2356
|
|
|
2413
2357
|
bindEnv(env);
|
|
2414
|
-
setWaitUntil(executionCtx);
|
|
2415
2358
|
|
|
2416
2359
|
try {
|
|
2417
2360
|
await __alepha.start();
|
|
@@ -2420,14 +2363,15 @@ export default {
|
|
|
2420
2363
|
return new Response("Internal Server Error", { status: 500 });
|
|
2421
2364
|
}
|
|
2422
2365
|
|
|
2423
|
-
await
|
|
2366
|
+
await withExecutionContext(executionCtx, () =>
|
|
2367
|
+
__alepha.events.emit("web:request", ctx),
|
|
2368
|
+
);
|
|
2424
2369
|
|
|
2425
2370
|
return ctx.res;
|
|
2426
2371
|
},
|
|
2427
2372
|
|
|
2428
2373
|
scheduled: async (event, env, executionCtx) => {
|
|
2429
2374
|
bindEnv(env);
|
|
2430
|
-
setWaitUntil(executionCtx);
|
|
2431
2375
|
|
|
2432
2376
|
try {
|
|
2433
2377
|
await __alepha.start();
|
|
@@ -2436,15 +2380,16 @@ export default {
|
|
|
2436
2380
|
throw err;
|
|
2437
2381
|
}
|
|
2438
2382
|
|
|
2439
|
-
await
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2383
|
+
await withExecutionContext(executionCtx, () =>
|
|
2384
|
+
__alepha.events.emit("cloudflare:scheduled", {
|
|
2385
|
+
cron: event.cron,
|
|
2386
|
+
scheduledTime: event.scheduledTime,
|
|
2387
|
+
}),
|
|
2388
|
+
);
|
|
2443
2389
|
},
|
|
2444
2390
|
|
|
2445
2391
|
queue: async (batch, env, executionCtx) => {
|
|
2446
2392
|
bindEnv(env);
|
|
2447
|
-
setWaitUntil(executionCtx);
|
|
2448
2393
|
|
|
2449
2394
|
try {
|
|
2450
2395
|
await __alepha.start();
|
|
@@ -2453,19 +2398,20 @@ export default {
|
|
|
2453
2398
|
throw err;
|
|
2454
2399
|
}
|
|
2455
2400
|
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2401
|
+
await withExecutionContext(executionCtx, async () => {
|
|
2402
|
+
for (const msg of batch.messages) {
|
|
2403
|
+
try {
|
|
2404
|
+
await __alepha.events.emit("cloudflare:queue", msg.body);
|
|
2405
|
+
msg.ack();
|
|
2406
|
+
} catch (e) {
|
|
2407
|
+
msg.retry();
|
|
2408
|
+
}
|
|
2462
2409
|
}
|
|
2463
|
-
}
|
|
2410
|
+
});
|
|
2464
2411
|
},
|
|
2465
2412
|
};
|
|
2466
2413
|
`.trim();
|
|
2467
|
-
|
|
2468
|
-
await this.fs.writeFile(this.fs.join(root, distDir, "main.cloudflare.js"), `${this.warningComment}\n${containerBlock}${workerCode}`.trim());
|
|
2414
|
+
await this.fs.writeFile(this.fs.join(root, distDir, "main.cloudflare.js"), `${this.warningComment}\n${workerCode}`.trim());
|
|
2469
2415
|
}
|
|
2470
2416
|
};
|
|
2471
2417
|
//#endregion
|
|
@@ -3418,36 +3364,24 @@ var BuildCommand = class {
|
|
|
3418
3364
|
name: "build",
|
|
3419
3365
|
mode: "production",
|
|
3420
3366
|
description: "Build the project for production",
|
|
3421
|
-
flags:
|
|
3422
|
-
stats:
|
|
3423
|
-
target:
|
|
3367
|
+
flags: z.object({
|
|
3368
|
+
stats: z.union([z.boolean(), z.enum(["json"])]).describe("Generate build stats report").optional(),
|
|
3369
|
+
target: z.enum([
|
|
3424
3370
|
"bare",
|
|
3425
3371
|
"docker",
|
|
3426
3372
|
"vercel",
|
|
3427
3373
|
"cloudflare",
|
|
3428
3374
|
"cf",
|
|
3429
3375
|
"static"
|
|
3430
|
-
],
|
|
3431
|
-
|
|
3432
|
-
description: "Deployment target (cf = cloudflare)"
|
|
3433
|
-
})),
|
|
3434
|
-
runtime: t.optional(t.enum([
|
|
3376
|
+
]).meta({ aliases: ["t"] }).describe("Deployment target (cf = cloudflare)").optional(),
|
|
3377
|
+
runtime: z.enum([
|
|
3435
3378
|
"node",
|
|
3436
3379
|
"bun",
|
|
3437
3380
|
"workerd"
|
|
3438
|
-
],
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
image: t.optional(t.union([t.boolean(), t.text()], {
|
|
3443
|
-
aliases: ["i"],
|
|
3444
|
-
description: "Build Docker image. Use -i for latest, -i=<version> for specific version"
|
|
3445
|
-
})),
|
|
3446
|
-
compile: t.optional(t.boolean({
|
|
3447
|
-
aliases: ["c"],
|
|
3448
|
-
description: "Compile server to a single static binary (requires --target=docker --runtime=bun)"
|
|
3449
|
-
})),
|
|
3450
|
-
prebuilt: t.optional(t.boolean({ description: "Skip the bundle steps (Vite client/server + asset compression). Only regenerates target-specific deploy config (e.g. wrangler.jsonc). Use when `dist/` is already built and you just need the config refreshed." }))
|
|
3381
|
+
]).meta({ aliases: ["r"] }).describe("JavaScript runtime").optional(),
|
|
3382
|
+
image: z.union([z.boolean(), z.text()]).meta({ aliases: ["i"] }).describe("Build Docker image. Use -i for latest, -i=<version> for specific version").optional(),
|
|
3383
|
+
compile: z.boolean().meta({ aliases: ["c"] }).describe("Compile server to a single static binary (requires --target=docker --runtime=bun)").optional(),
|
|
3384
|
+
prebuilt: z.boolean().describe("Skip the bundle steps (Vite client/server + asset compression). Only regenerates target-specific deploy config (e.g. wrangler.jsonc). Use when `dist/` is already built and you just need the config refreshed.").optional()
|
|
3451
3385
|
}),
|
|
3452
3386
|
handler: async ({ flags, run, root }) => {
|
|
3453
3387
|
process.env.NODE_ENV = "production";
|
|
@@ -3545,7 +3479,7 @@ var CleanCommand = class {
|
|
|
3545
3479
|
};
|
|
3546
3480
|
//#endregion
|
|
3547
3481
|
//#region ../../src/cli/core/commands/db.ts
|
|
3548
|
-
const drizzleCommandFlags =
|
|
3482
|
+
const drizzleCommandFlags = z.object({ provider: z.text({ description: "Database provider name to target (e.g., 'postgres', 'sqlite')" }).optional() });
|
|
3549
3483
|
var DbCommand = class {
|
|
3550
3484
|
log = $logger();
|
|
3551
3485
|
fs = $inject(FileSystemProvider);
|
|
@@ -3553,7 +3487,6 @@ var DbCommand = class {
|
|
|
3553
3487
|
pm = $inject(PackageManagerUtils);
|
|
3554
3488
|
entryProvider = $inject(AppEntryProvider);
|
|
3555
3489
|
viteUtil = $inject(ViteUtils);
|
|
3556
|
-
runner = $inject(Runner);
|
|
3557
3490
|
/**
|
|
3558
3491
|
* Check if database migrations are up to date.
|
|
3559
3492
|
*/
|
|
@@ -3561,12 +3494,12 @@ var DbCommand = class {
|
|
|
3561
3494
|
name: "check",
|
|
3562
3495
|
mode: true,
|
|
3563
3496
|
description: "Check if migration files are up to date",
|
|
3564
|
-
args:
|
|
3497
|
+
args: z.text({
|
|
3565
3498
|
title: "path",
|
|
3566
3499
|
description: "Path to the Alepha server entry file"
|
|
3567
|
-
})),
|
|
3500
|
+
}).optional(),
|
|
3568
3501
|
flags: drizzleCommandFlags,
|
|
3569
|
-
handler: async ({
|
|
3502
|
+
handler: async ({ flags, root }) => {
|
|
3570
3503
|
const rootDir = root;
|
|
3571
3504
|
this.log.debug(`Using project root: ${rootDir}`);
|
|
3572
3505
|
const entry = await this.entryProvider.getAppEntry(root);
|
|
@@ -3577,16 +3510,18 @@ var DbCommand = class {
|
|
|
3577
3510
|
const repositoryProvider = alepha.inject("RepositoryProvider");
|
|
3578
3511
|
const drizzleKitProvider = alepha.inject("DrizzleKitProvider");
|
|
3579
3512
|
const accepted = /* @__PURE__ */ new Set([]);
|
|
3513
|
+
const drifted = [];
|
|
3580
3514
|
for (const primitive of repositoryProvider.getRepositories()) {
|
|
3581
3515
|
const provider = primitive.provider;
|
|
3582
3516
|
const providerName = provider.name;
|
|
3583
3517
|
if (accepted.has(providerName)) continue;
|
|
3584
3518
|
accepted.add(providerName);
|
|
3519
|
+
if (flags.provider && flags.provider !== providerName) continue;
|
|
3585
3520
|
const migrationDir = this.fs.join(rootDir, "migrations", providerName);
|
|
3586
3521
|
const journalBuffer = await this.fs.readFile(this.fs.join(migrationDir, "meta", "_journal.json")).catch(() => null);
|
|
3587
3522
|
if (!journalBuffer) {
|
|
3588
|
-
this.log.info(
|
|
3589
|
-
|
|
3523
|
+
this.log.info(`No migration journal found for '${providerName}'.`);
|
|
3524
|
+
continue;
|
|
3590
3525
|
}
|
|
3591
3526
|
const journal = JSON.parse(journalBuffer.toString("utf-8"));
|
|
3592
3527
|
const lastMigration = journal.entries[journal.entries.length - 1];
|
|
@@ -3594,18 +3529,27 @@ var DbCommand = class {
|
|
|
3594
3529
|
const lastSnapshot = JSON.parse(snapshotBuffer.toString("utf-8"));
|
|
3595
3530
|
const { statements: migrationStatements } = await drizzleKitProvider.generateMigration(provider, lastSnapshot, { withoutSchema: true });
|
|
3596
3531
|
if (migrationStatements.length === 0) {
|
|
3597
|
-
this.log.info(
|
|
3598
|
-
|
|
3532
|
+
this.log.info(`No changes detected for '${providerName}'.`);
|
|
3533
|
+
continue;
|
|
3534
|
+
}
|
|
3535
|
+
drifted.push({
|
|
3536
|
+
provider: providerName,
|
|
3537
|
+
statements: migrationStatements
|
|
3538
|
+
});
|
|
3539
|
+
}
|
|
3540
|
+
if (drifted.length > 0) {
|
|
3541
|
+
for (const { provider: providerName, statements } of drifted) {
|
|
3542
|
+
this.log.info("");
|
|
3543
|
+
this.log.info(`Detected migration statements for '${providerName}':`);
|
|
3544
|
+
this.log.info("");
|
|
3545
|
+
for (const stmt of statements) this.log.info(stmt);
|
|
3546
|
+
this.log.info("");
|
|
3547
|
+
this.log.info(`At least ${statements.length} change(s) detected.`);
|
|
3599
3548
|
}
|
|
3600
3549
|
this.log.info("");
|
|
3601
|
-
this.log.info("Detected migration statements:");
|
|
3602
|
-
this.log.info("");
|
|
3603
|
-
for (const stmt of migrationStatements) this.log.info(stmt);
|
|
3604
|
-
this.log.info("");
|
|
3605
|
-
this.log.info(`At least ${migrationStatements.length} change(s) detected.`);
|
|
3606
3550
|
this.log.info("Please, run 'alepha db migrations generate' to update the migration files.");
|
|
3607
3551
|
this.log.info("");
|
|
3608
|
-
throw new AlephaError(
|
|
3552
|
+
throw new AlephaError(`Database migrations are not up to date (${drifted.map((d) => d.provider).join(", ")}).`);
|
|
3609
3553
|
}
|
|
3610
3554
|
}
|
|
3611
3555
|
});
|
|
@@ -3616,13 +3560,13 @@ var DbCommand = class {
|
|
|
3616
3560
|
name: "create",
|
|
3617
3561
|
mode: true,
|
|
3618
3562
|
description: "Generate migration files from current schema",
|
|
3619
|
-
args:
|
|
3563
|
+
args: z.text({
|
|
3620
3564
|
title: "path",
|
|
3621
3565
|
description: "Path to the Alepha server entry file"
|
|
3622
|
-
})),
|
|
3623
|
-
flags:
|
|
3624
|
-
custom:
|
|
3625
|
-
name:
|
|
3566
|
+
}).optional(),
|
|
3567
|
+
flags: drizzleCommandFlags.extend({
|
|
3568
|
+
custom: z.boolean().describe("Generate an empty migration file for custom SQL (e.g., for data migrations or manual adjustments)").optional(),
|
|
3569
|
+
name: z.text({ description: "Name for the generated migration file" }).optional()
|
|
3626
3570
|
}),
|
|
3627
3571
|
handler: async ({ args, flags, root }) => {
|
|
3628
3572
|
const parts = [];
|
|
@@ -3646,11 +3590,11 @@ var DbCommand = class {
|
|
|
3646
3590
|
name: "push",
|
|
3647
3591
|
mode: true,
|
|
3648
3592
|
description: "Push database schema changes directly to the database",
|
|
3649
|
-
args:
|
|
3593
|
+
args: z.text({
|
|
3650
3594
|
title: "path",
|
|
3651
3595
|
description: "Path to the Alepha server entry file"
|
|
3652
|
-
})),
|
|
3653
|
-
flags:
|
|
3596
|
+
}).optional(),
|
|
3597
|
+
flags: drizzleCommandFlags.extend({ dryRun: z.boolean().describe("Preview SQL statements without executing them").optional() }),
|
|
3654
3598
|
handler: async ({ root, args, flags }) => {
|
|
3655
3599
|
if (flags.dryRun) {
|
|
3656
3600
|
const entry = await this.entryProvider.getAppEntry(root);
|
|
@@ -3705,10 +3649,10 @@ var DbCommand = class {
|
|
|
3705
3649
|
name: "apply",
|
|
3706
3650
|
mode: true,
|
|
3707
3651
|
description: "Apply pending migrations to the database",
|
|
3708
|
-
args:
|
|
3652
|
+
args: z.text({
|
|
3709
3653
|
title: "path",
|
|
3710
3654
|
description: "Path to the Alepha server entry file"
|
|
3711
|
-
})),
|
|
3655
|
+
}).optional(),
|
|
3712
3656
|
flags: drizzleCommandFlags,
|
|
3713
3657
|
handler: async ({ root, run, mode }) => {
|
|
3714
3658
|
const entry = await this.entryProvider.getAppEntry(root);
|
|
@@ -3716,7 +3660,6 @@ var DbCommand = class {
|
|
|
3716
3660
|
name: `db migrate (${mode || "development"})`,
|
|
3717
3661
|
handler: async () => {
|
|
3718
3662
|
process.env.MIGRATE = "true";
|
|
3719
|
-
if (this.runner.useDynamicLogger) process.env.LOG_LEVEL = "warn";
|
|
3720
3663
|
await (await this.viteUtil.runAlepha({
|
|
3721
3664
|
entry,
|
|
3722
3665
|
mode: "production"
|
|
@@ -3732,10 +3675,10 @@ var DbCommand = class {
|
|
|
3732
3675
|
name: "studio",
|
|
3733
3676
|
mode: true,
|
|
3734
3677
|
description: "Launch Drizzle Studio database browser",
|
|
3735
|
-
args:
|
|
3678
|
+
args: z.text({
|
|
3736
3679
|
title: "path",
|
|
3737
3680
|
description: "Path to the Alepha server entry file"
|
|
3738
|
-
})),
|
|
3681
|
+
}).optional(),
|
|
3739
3682
|
flags: drizzleCommandFlags,
|
|
3740
3683
|
handler: async ({ root, args, flags }) => {
|
|
3741
3684
|
await this.runDrizzleKitCommand({
|
|
@@ -3816,6 +3759,9 @@ var DbCommand = class {
|
|
|
3816
3759
|
rootDir,
|
|
3817
3760
|
command: options.command
|
|
3818
3761
|
});
|
|
3762
|
+
const migrationsDir = this.fs.join(rootDir, "migrations", providerName);
|
|
3763
|
+
const isGenerate = options.command === "generate";
|
|
3764
|
+
const before = isGenerate ? new Set(await this.fs.ls(migrationsDir).catch(() => [])) : /* @__PURE__ */ new Set();
|
|
3819
3765
|
const flags = options.commandFlags ? ` ${options.commandFlags}` : "";
|
|
3820
3766
|
const drizzleKit = this.utils.resolveBin("drizzle-kit");
|
|
3821
3767
|
await this.utils.exec(`node "${drizzleKit}" ${options.command} --config=${drizzleConfigJsPath}${flags}`, {
|
|
@@ -3825,7 +3771,10 @@ var DbCommand = class {
|
|
|
3825
3771
|
NODE_OPTIONS: [process.env.NODE_OPTIONS, "--import tsx"].filter(Boolean).join(" ")
|
|
3826
3772
|
}
|
|
3827
3773
|
});
|
|
3828
|
-
if (
|
|
3774
|
+
if (!isGenerate) continue;
|
|
3775
|
+
if (dialect === "postgresql") await this.stripPublicSchemaFromMigrations(migrationsDir);
|
|
3776
|
+
const after = await this.fs.ls(migrationsDir).catch(() => []);
|
|
3777
|
+
await this.assertNoDestructiveMigrations(migrationsDir, after.filter((file) => !before.has(file)));
|
|
3829
3778
|
}
|
|
3830
3779
|
}
|
|
3831
3780
|
/**
|
|
@@ -3848,6 +3797,53 @@ var DbCommand = class {
|
|
|
3848
3797
|
}
|
|
3849
3798
|
}
|
|
3850
3799
|
/**
|
|
3800
|
+
* Refuse a freshly generated migration that drops a table.
|
|
3801
|
+
*
|
|
3802
|
+
* Drizzle rebuilds a SQLite table by dropping and recreating it. On
|
|
3803
|
+
* Cloudflare D1 that is a data-loss bomb: D1 ignores `PRAGMA
|
|
3804
|
+
* foreign_keys=OFF`, so dropping a table that other tables reference with
|
|
3805
|
+
* `ON DELETE CASCADE` silently wipes every child row — with no error, on
|
|
3806
|
+
* deploy, in production.
|
|
3807
|
+
*
|
|
3808
|
+
* The generated file is left on disk on purpose: the point is to force a
|
|
3809
|
+
* human to read it. If the drop really is intended, keep the file and move
|
|
3810
|
+
* on (a re-run detects no schema diff, so nothing is regenerated and this
|
|
3811
|
+
* guard stays quiet).
|
|
3812
|
+
*/
|
|
3813
|
+
async assertNoDestructiveMigrations(migrationsDir, files) {
|
|
3814
|
+
const offenders = [];
|
|
3815
|
+
for (const file of files) {
|
|
3816
|
+
if (!file.endsWith(".sql")) continue;
|
|
3817
|
+
const content = await this.fs.readFile(this.fs.join(migrationsDir, file));
|
|
3818
|
+
const drops = this.findDropTableStatements(content.toString("utf-8"));
|
|
3819
|
+
for (const drop of drops) offenders.push(` ${file}: ${drop}`);
|
|
3820
|
+
}
|
|
3821
|
+
if (offenders.length === 0) return;
|
|
3822
|
+
throw new AlephaError([
|
|
3823
|
+
`Refusing to generate a destructive migration: DROP TABLE found in ${offenders.length} statement(s).`,
|
|
3824
|
+
"",
|
|
3825
|
+
...offenders,
|
|
3826
|
+
"",
|
|
3827
|
+
"On Cloudflare D1, dropping a table that CASCADE children reference wipes those child rows silently.",
|
|
3828
|
+
"Review the generated file above. If the drop is intentional, keep it and re-run — nothing will be regenerated.",
|
|
3829
|
+
"If it is not, delete the file and adjust your schema (e.g. keep the column, or drop it in a hand-written migration)."
|
|
3830
|
+
].join("\n"));
|
|
3831
|
+
}
|
|
3832
|
+
/**
|
|
3833
|
+
* Extract `DROP TABLE` statements from a SQL migration, skipping any that sit
|
|
3834
|
+
* inside a `--` line comment.
|
|
3835
|
+
*/
|
|
3836
|
+
findDropTableStatements(sql) {
|
|
3837
|
+
const statements = [];
|
|
3838
|
+
for (const rawLine of sql.split(/\r?\n/)) {
|
|
3839
|
+
const line = rawLine.trim();
|
|
3840
|
+
if (line.startsWith("--")) continue;
|
|
3841
|
+
const code = line.split("--")[0];
|
|
3842
|
+
if (/\bDROP\s+TABLE\b/i.test(code)) statements.push(code.trim());
|
|
3843
|
+
}
|
|
3844
|
+
return statements;
|
|
3845
|
+
}
|
|
3846
|
+
/**
|
|
3851
3847
|
* Prepare Drizzle configuration files for a database provider.
|
|
3852
3848
|
*/
|
|
3853
3849
|
async prepareDrizzleConfig(options) {
|
|
@@ -4341,7 +4337,7 @@ if (import.meta.hot) {
|
|
|
4341
4337
|
const file = queue.pop();
|
|
4342
4338
|
if (invalidated.has(file)) continue;
|
|
4343
4339
|
invalidated.add(file);
|
|
4344
|
-
const mods = new Set([...graph.getModulesByFile(file) ?? [], ...graph.getModuleById(file) ? [graph.getModuleById(file)] : []]);
|
|
4340
|
+
const mods = /* @__PURE__ */ new Set([...graph.getModulesByFile(file) ?? [], ...graph.getModuleById(file) ? [graph.getModuleById(file)] : []]);
|
|
4345
4341
|
if (mods.size === 0) continue;
|
|
4346
4342
|
for (const mod of mods) {
|
|
4347
4343
|
graph.invalidateModule(mod);
|
|
@@ -4366,7 +4362,7 @@ if (import.meta.hot) {
|
|
|
4366
4362
|
if (/[/\\]\.idea[/\\]/.test(file)) return;
|
|
4367
4363
|
console.log();
|
|
4368
4364
|
console.log(this.colors.set("CYAN", " ⟳ Retrying..."));
|
|
4369
|
-
const filesToInvalidate = new Set([file]);
|
|
4365
|
+
const filesToInvalidate = /* @__PURE__ */ new Set([file]);
|
|
4370
4366
|
try {
|
|
4371
4367
|
const alepha = await this.loadAlepha(false, filesToInvalidate);
|
|
4372
4368
|
this.waitingForRetry = false;
|
|
@@ -4473,7 +4469,7 @@ var DevCommand = class {
|
|
|
4473
4469
|
name: "dev",
|
|
4474
4470
|
mode: true,
|
|
4475
4471
|
description: "Run the project in development mode",
|
|
4476
|
-
flags:
|
|
4472
|
+
flags: z.object({ only: z.string().describe("Run only specific apps (comma-separated: --only api,companion)").optional() }),
|
|
4477
4473
|
handler: async ({ root, flags }) => {
|
|
4478
4474
|
const apps = await this.discoverApps(root);
|
|
4479
4475
|
if (apps.length > 0) await this.runMultiple(root, apps, flags);
|
|
@@ -4610,12 +4606,12 @@ const DEFAULT_IGNORE = [
|
|
|
4610
4606
|
*/
|
|
4611
4607
|
const changelogOptions = $atom({
|
|
4612
4608
|
name: "alepha.cli.changelog.options",
|
|
4613
|
-
schema:
|
|
4609
|
+
schema: z.object({
|
|
4614
4610
|
/**
|
|
4615
4611
|
* Scopes to ignore (e.g., "project", "release", "chore").
|
|
4616
4612
|
* Commits like `feat(chore): ...` will be excluded from changelog.
|
|
4617
4613
|
*/
|
|
4618
|
-
ignore:
|
|
4614
|
+
ignore: z.array(z.string()).optional() }),
|
|
4619
4615
|
default: { ignore: DEFAULT_IGNORE }
|
|
4620
4616
|
});
|
|
4621
4617
|
//#endregion
|
|
@@ -4756,25 +4752,19 @@ var ChangelogCommand = class {
|
|
|
4756
4752
|
command = $command({
|
|
4757
4753
|
name: "changelog",
|
|
4758
4754
|
description: "Generate changelog from conventional commits (outputs to stdout)",
|
|
4759
|
-
flags:
|
|
4755
|
+
flags: z.object({
|
|
4760
4756
|
/**
|
|
4761
4757
|
* Show changes from this ref (tag, commit, branch).
|
|
4762
4758
|
* Defaults to the latest version tag.
|
|
4763
4759
|
* Example: --from=1.0.0
|
|
4764
4760
|
*/
|
|
4765
|
-
from:
|
|
4766
|
-
aliases: ["f"],
|
|
4767
|
-
description: "Starting ref (default: latest tag)"
|
|
4768
|
-
})),
|
|
4761
|
+
from: z.string().meta({ aliases: ["f"] }).describe("Starting ref (default: latest tag)").optional(),
|
|
4769
4762
|
/**
|
|
4770
4763
|
* Show changes up to this ref (tag, commit, branch).
|
|
4771
4764
|
* Defaults to HEAD.
|
|
4772
4765
|
* Example: --to=main
|
|
4773
4766
|
*/
|
|
4774
|
-
to:
|
|
4775
|
-
aliases: ["t"],
|
|
4776
|
-
description: "Ending ref (default: HEAD)"
|
|
4777
|
-
}))
|
|
4767
|
+
to: z.string().meta({ aliases: ["t"] }).describe("Ending ref (default: HEAD)").optional()
|
|
4778
4768
|
}),
|
|
4779
4769
|
handler: async ({ flags, root }) => {
|
|
4780
4770
|
const git = (cmd) => this.git.exec(cmd, root);
|
|
@@ -4816,10 +4806,10 @@ var GenEnvCommand = class {
|
|
|
4816
4806
|
command = $command({
|
|
4817
4807
|
name: "env",
|
|
4818
4808
|
description: "Extract environment variables from server entry file",
|
|
4819
|
-
flags:
|
|
4809
|
+
flags: z.object({ out: z.text({
|
|
4820
4810
|
aliases: ["o"],
|
|
4821
4811
|
description: "Output file path (e.g., .env)"
|
|
4822
|
-
})) }),
|
|
4812
|
+
}).optional() }),
|
|
4823
4813
|
handler: async ({ root, flags }) => {
|
|
4824
4814
|
const alepha = await this.utils.loadAlephaFromServerEntryFile({
|
|
4825
4815
|
root,
|
|
@@ -4851,10 +4841,10 @@ var OpenApiCommand = class {
|
|
|
4851
4841
|
command = $command({
|
|
4852
4842
|
name: "openapi",
|
|
4853
4843
|
description: "Generate OpenAPI specification from actions",
|
|
4854
|
-
flags:
|
|
4844
|
+
flags: z.object({ out: z.text({
|
|
4855
4845
|
aliases: ["o"],
|
|
4856
4846
|
description: "Output file path"
|
|
4857
|
-
})) }),
|
|
4847
|
+
}).optional() }),
|
|
4858
4848
|
handler: async ({ root, flags }) => {
|
|
4859
4849
|
const alepha = await this.utils.loadAlephaFromServerEntryFile({
|
|
4860
4850
|
root,
|
|
@@ -4915,28 +4905,22 @@ var InitCommand = class {
|
|
|
4915
4905
|
init = $command({
|
|
4916
4906
|
name: "init",
|
|
4917
4907
|
description: "Add missing Alepha configuration files to the project",
|
|
4918
|
-
args:
|
|
4908
|
+
args: z.text({
|
|
4919
4909
|
title: "path",
|
|
4920
4910
|
trim: true,
|
|
4921
4911
|
lowercase: true
|
|
4922
|
-
})),
|
|
4923
|
-
flags:
|
|
4924
|
-
pm:
|
|
4912
|
+
}).optional(),
|
|
4913
|
+
flags: z.object({
|
|
4914
|
+
pm: z.enum([
|
|
4925
4915
|
"yarn",
|
|
4926
4916
|
"npm",
|
|
4927
4917
|
"pnpm",
|
|
4928
4918
|
"bun"
|
|
4929
|
-
]
|
|
4930
|
-
api:
|
|
4931
|
-
react:
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
})),
|
|
4935
|
-
tailwind: t.optional(t.boolean({ description: "Include Tailwind CSS with Vite plugin. Implies --react" })),
|
|
4936
|
-
force: t.optional(t.boolean({
|
|
4937
|
-
aliases: ["f"],
|
|
4938
|
-
description: "Override existing files"
|
|
4939
|
-
}))
|
|
4919
|
+
]).describe("Package manager to use").optional(),
|
|
4920
|
+
api: z.boolean().describe("Include API module structure (src/api/)").optional(),
|
|
4921
|
+
react: z.boolean().meta({ aliases: ["r"] }).describe("Include React dependencies and web module (src/web/)").optional(),
|
|
4922
|
+
tailwind: z.boolean().describe("Include Tailwind CSS with Vite plugin. Implies --react").optional(),
|
|
4923
|
+
force: z.boolean().meta({ aliases: ["f"] }).describe("Override existing files").optional()
|
|
4940
4924
|
}),
|
|
4941
4925
|
handler: async ({ run, flags, root, args }) => {
|
|
4942
4926
|
await this.scaffolder.init({
|
|
@@ -4994,15 +4978,15 @@ var PackCommand = class {
|
|
|
4994
4978
|
pack = $command({
|
|
4995
4979
|
name: "pack",
|
|
4996
4980
|
description: "Pack the workspace into a deployable tar.gz (for `alepha platform --prebuilt` consumers like Alepha Rocket).",
|
|
4997
|
-
flags:
|
|
4998
|
-
tag:
|
|
4981
|
+
flags: z.object({
|
|
4982
|
+
tag: z.text({
|
|
4999
4983
|
aliases: ["t"],
|
|
5000
4984
|
description: "Tag suffix for the artifact name (Docker-style). Defaults to `latest` → `<project>-latest.tar.gz`. Pass a real version like `0.0.2` for a pinned artifact."
|
|
5001
|
-
})),
|
|
5002
|
-
output:
|
|
4985
|
+
}).optional(),
|
|
4986
|
+
output: z.text({
|
|
5003
4987
|
aliases: ["o"],
|
|
5004
4988
|
description: "Output directory for the tar.gz (default: current dir)."
|
|
5005
|
-
}))
|
|
4989
|
+
}).optional()
|
|
5006
4990
|
}),
|
|
5007
4991
|
handler: async ({ flags, root, run }) => {
|
|
5008
4992
|
const pkgPath = this.fs.join(root, "package.json");
|
|
@@ -5057,10 +5041,7 @@ var RootCommand = class {
|
|
|
5057
5041
|
*/
|
|
5058
5042
|
root = $command({
|
|
5059
5043
|
root: true,
|
|
5060
|
-
flags:
|
|
5061
|
-
description: "Show Alepha CLI version",
|
|
5062
|
-
aliases: ["v"]
|
|
5063
|
-
})) }),
|
|
5044
|
+
flags: z.object({ version: z.boolean().meta({ aliases: ["v"] }).describe("Show Alepha CLI version").optional() }),
|
|
5064
5045
|
handler: async ({ flags }) => {
|
|
5065
5046
|
if (flags.version) {
|
|
5066
5047
|
this.log.info(this.color.set("WHITE_BOLD", `Alepha v${version}`));
|
|
@@ -5080,18 +5061,12 @@ var TestCommand = class {
|
|
|
5080
5061
|
test = $command({
|
|
5081
5062
|
name: "test",
|
|
5082
5063
|
description: "Run tests using Vitest. Pass a filter to run only matching specs, e.g. `alepha test user` or `alepha test test/auth.spec.ts`",
|
|
5083
|
-
args:
|
|
5064
|
+
args: z.text({
|
|
5084
5065
|
title: "filter",
|
|
5085
5066
|
description: "Only run spec files whose path matches this string"
|
|
5086
|
-
})),
|
|
5087
|
-
flags:
|
|
5088
|
-
|
|
5089
|
-
alias: "c"
|
|
5090
|
-
})) }),
|
|
5091
|
-
env: t.object({ VITEST_ARGS: t.optional(t.string({
|
|
5092
|
-
default: "",
|
|
5093
|
-
description: "Additional arguments to pass to Vitest. E.g., --coverage"
|
|
5094
|
-
})) }),
|
|
5067
|
+
}).optional(),
|
|
5068
|
+
flags: z.object({ config: z.string().meta({ alias: "c" }).describe("Path to Vitest config file").optional() }),
|
|
5069
|
+
env: z.object({ VITEST_ARGS: z.string().describe("Additional arguments to pass to Vitest. E.g., --coverage").default("").optional() }),
|
|
5095
5070
|
handler: async ({ run, root, flags, env, args }) => {
|
|
5096
5071
|
await this.scaffolder.ensureConfig(root, { tsconfigJson: true });
|
|
5097
5072
|
const config = flags.config ? `--config=${flags.config}` : "";
|