alepha 0.22.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 +242 -230
- 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 -1109
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +454 -369
- 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 +169 -157
- 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 +244 -475
- package/dist/cli/core/index.d.ts.map +1 -1
- package/dist/cli/core/index.js +308 -383
- 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 +20 -39
- package/dist/cli/i18n/index.d.ts.map +1 -1
- package/dist/cli/i18n/index.js +51 -17
- 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 +383 -410
- package/dist/cli/platform-lib/index.d.ts.map +1 -1
- package/dist/cli/platform-lib/index.js +300 -258
- 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 +82 -194
- 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 +36 -90
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +65 -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 -6
- package/dist/react/form/index.d.ts.map +1 -1
- package/dist/react/form/index.js +107 -71
- 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 +47 -5
- package/dist/react/i18n/index.d.ts.map +1 -1
- package/dist/react/i18n/index.js +116 -12
- 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 +188 -29
- package/dist/react/router/index.browser.js.map +1 -1
- package/dist/react/router/index.d.ts +480 -372
- package/dist/react/router/index.d.ts.map +1 -1
- package/dist/react/router/index.js +261 -47
- package/dist/react/router/index.js.map +1 -1
- package/dist/react/sitemap/index.browser.js +35 -0
- package/dist/react/sitemap/index.browser.js.map +1 -0
- package/dist/react/sitemap/index.d.ts +91 -0
- package/dist/react/sitemap/index.d.ts.map +1 -0
- package/dist/react/sitemap/index.js +131 -0
- package/dist/react/sitemap/index.js.map +1 -0
- 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 +215 -187
- package/dist/server/auth/index.d.ts.map +1 -1
- package/dist/server/auth/index.js +1145 -86
- 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 +86 -4
- package/dist/server/cookies/index.d.ts.map +1 -1
- package/dist/server/cookies/index.js +121 -8
- 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 +134 -85
- package/dist/server/core/index.d.ts.map +1 -1
- package/dist/server/core/index.js +130 -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 +36 -36
- 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 -9
- 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 -0
- 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 -10
- 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 -88
- 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 -49
- 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/index.ts +0 -3
- package/src/cli/core/tasks/BuildCloudflareTask.ts +138 -245
- package/src/cli/core/tasks/BuildPrerenderTask.ts +44 -7
- package/src/cli/core/templates/apiHelloResponseSchemaTs.ts +4 -4
- package/src/cli/devtools/atoms/devtoolsOptions.ts +6 -6
- package/src/cli/i18n/__tests__/I18nCheckService.spec.ts +48 -0
- package/src/cli/i18n/atoms/i18nOptions.ts +8 -8
- package/src/cli/i18n/services/I18nCheckService.ts +65 -11
- 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 +141 -50
- 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 +82 -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/providers/McpServerProvider.ts +55 -0
- 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 +71 -0
- package/src/react/form/__tests__/form-submitting-reactive.browser.spec.tsx +96 -0
- 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 +124 -86
- package/src/react/form/services/parseField.ts +66 -27
- package/src/react/i18n/__tests__/I18nProvider.spec.ts +89 -0
- package/src/react/i18n/__tests__/Localize.spec.tsx +1 -1
- package/src/react/i18n/__tests__/locale-routing.spec.ts +107 -0
- package/src/react/i18n/providers/I18nProvider.ts +173 -14
- 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/__tests__/RouterLocaleProvider.spec.ts +127 -0
- 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/index.browser.ts +4 -0
- package/src/react/router/index.shared.ts +1 -0
- package/src/react/router/index.ts +9 -0
- package/src/react/router/primitives/$page.ts +2 -2
- package/src/react/router/providers/ReactBrowserProvider.ts +64 -13
- package/src/react/router/providers/ReactBrowserRouterProvider.ts +15 -1
- package/src/react/router/providers/ReactPageProvider.ts +38 -13
- package/src/react/router/providers/ReactServerProvider.ts +105 -16
- package/src/react/router/providers/RootComponentsProvider.ts +13 -0
- package/src/react/router/providers/RouterLocaleProvider.ts +125 -0
- package/src/react/router/providers/__tests__/RootComponentsProvider.spec.ts +15 -0
- package/src/react/router/providers/__tests__/rootComponents.ssr.browser.spec.tsx +67 -0
- package/src/react/sitemap/__tests__/$sitemap.spec.ts +131 -0
- package/src/react/sitemap/index.browser.ts +21 -0
- package/src/react/sitemap/index.ts +25 -0
- package/src/react/sitemap/primitives/$sitemap.browser.ts +26 -0
- package/src/react/sitemap/primitives/$sitemap.ts +196 -0
- 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/__tests__/appleClientSecret.spec.ts +34 -0
- package/src/server/auth/__tests__/federationRedirectReplay.spec.ts +44 -0
- package/src/server/auth/helpers/appleClientSecret.ts +24 -0
- package/src/server/auth/helpers/jtiReplayGuard.ts +41 -0
- package/src/server/auth/helpers/safeRedirectPath.ts +19 -0
- package/src/server/auth/index.ts +1 -0
- 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 +67 -52
- 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 +82 -12
- 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 +32 -4
- 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 +14 -14
- package/src/server/core/primitives/$action.ts +26 -36
- package/src/server/core/primitives/$route.ts +27 -0
- 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/cli/core/tasks/BuildSitemapTask.ts +0 -130
- 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/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,27 +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
|
-
}))
|
|
291
|
-
/**
|
|
292
|
-
* Sitemap generation configuration.
|
|
293
|
-
*/
|
|
294
|
-
sitemap: t.optional(t.object({
|
|
295
|
-
/**
|
|
296
|
-
* Base URL for sitemap entries.
|
|
297
|
-
*/
|
|
298
|
-
hostname: t.string() }))
|
|
289
|
+
offline: z.boolean().optional()
|
|
290
|
+
}).optional()
|
|
299
291
|
}),
|
|
300
292
|
default: {}
|
|
301
293
|
});
|
|
@@ -310,11 +302,11 @@ hostname: t.string() }))
|
|
|
310
302
|
const devOptions = $atom({
|
|
311
303
|
name: "alepha.cli.dev.options",
|
|
312
304
|
description: "Dev configuration options",
|
|
313
|
-
schema:
|
|
305
|
+
schema: z.object({
|
|
314
306
|
/**
|
|
315
307
|
* Disable Vite React plugin.
|
|
316
308
|
*/
|
|
317
|
-
noViteReactPlugin:
|
|
309
|
+
noViteReactPlugin: z.boolean().default(false).optional() }),
|
|
318
310
|
default: {}
|
|
319
311
|
});
|
|
320
312
|
//#endregion
|
|
@@ -1263,11 +1255,11 @@ export class HelloController {
|
|
|
1263
1255
|
//#endregion
|
|
1264
1256
|
//#region ../../src/cli/core/templates/apiHelloResponseSchemaTs.ts
|
|
1265
1257
|
const apiHelloResponseSchemaTs = () => {
|
|
1266
|
-
return `import { type Static,
|
|
1258
|
+
return `import { type Static, z } from "alepha";
|
|
1267
1259
|
|
|
1268
|
-
export const helloResponseSchema =
|
|
1269
|
-
appName:
|
|
1270
|
-
serverTime:
|
|
1260
|
+
export const helloResponseSchema = z.object({
|
|
1261
|
+
appName: z.text(),
|
|
1262
|
+
serverTime: z.datetime(),
|
|
1271
1263
|
});
|
|
1272
1264
|
|
|
1273
1265
|
export type HelloResponse = Static<typeof helloResponseSchema>;
|
|
@@ -2074,6 +2066,14 @@ var BuildClientTask = class extends BuildTask {
|
|
|
2074
2066
|
//#region ../../src/cli/core/tasks/BuildCloudflareTask.ts
|
|
2075
2067
|
const CLOUDFLARE_EMAIL_PROVIDER_NAME = "CloudflareEmailProvider";
|
|
2076
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
|
+
/**
|
|
2077
2077
|
* Generate Cloudflare Workers deployment configuration.
|
|
2078
2078
|
*
|
|
2079
2079
|
* Creates:
|
|
@@ -2119,16 +2119,16 @@ var BuildCloudflareTask = class BuildCloudflareTask extends BuildTask {
|
|
|
2119
2119
|
head_sampling_rate: 1
|
|
2120
2120
|
};
|
|
2121
2121
|
this.enhanceDomain(wrangler);
|
|
2122
|
+
this.enhanceServices(wrangler);
|
|
2122
2123
|
this.enhanceCron(ctx, wrangler);
|
|
2123
2124
|
this.enhanceDatabase(wrangler);
|
|
2124
2125
|
this.enhanceR2(wrangler);
|
|
2125
2126
|
this.enhanceKV(wrangler);
|
|
2126
2127
|
this.enhanceQueue(wrangler);
|
|
2127
2128
|
this.enhanceEmail(ctx, wrangler);
|
|
2128
|
-
const containers = this.enhanceContainers(ctx, wrangler);
|
|
2129
2129
|
await this.fs.writeFile(this.fs.join(root, distDir, "wrangler.jsonc"), JSON.stringify(wrangler, null, 2));
|
|
2130
|
-
if (!ctx.manifest) await this.writeManifest(ctx, root, distDir, name
|
|
2131
|
-
await this.writeWorkerEntryPoint(root, distDir
|
|
2130
|
+
if (!ctx.manifest) await this.writeManifest(ctx, root, distDir, name);
|
|
2131
|
+
await this.writeWorkerEntryPoint(root, distDir);
|
|
2132
2132
|
}
|
|
2133
2133
|
/**
|
|
2134
2134
|
* Write `dist/manifest.json` — a build-time snapshot of everything
|
|
@@ -2137,7 +2137,7 @@ var BuildCloudflareTask = class BuildCloudflareTask extends BuildTask {
|
|
|
2137
2137
|
* the deploy path can skip the Vite-based introspection step and the
|
|
2138
2138
|
* workspace's runtime npm install.
|
|
2139
2139
|
*/
|
|
2140
|
-
async writeManifest(ctx, root, distDir, name
|
|
2140
|
+
async writeManifest(ctx, root, distDir, name) {
|
|
2141
2141
|
let hasDatabase = false;
|
|
2142
2142
|
let hasBucket = false;
|
|
2143
2143
|
let hasKV = false;
|
|
@@ -2165,6 +2165,11 @@ var BuildCloudflareTask = class BuildCloudflareTask extends BuildTask {
|
|
|
2165
2165
|
try {
|
|
2166
2166
|
env = Object.keys(ctx.alepha.dump().env).sort();
|
|
2167
2167
|
} catch {}
|
|
2168
|
+
let email;
|
|
2169
|
+
try {
|
|
2170
|
+
ctx.alepha.inject(CLOUDFLARE_EMAIL_PROVIDER_NAME);
|
|
2171
|
+
email = { binding: SEND_EMAIL_DEFAULT_BINDING };
|
|
2172
|
+
} catch {}
|
|
2168
2173
|
const manifest = {
|
|
2169
2174
|
version: 1,
|
|
2170
2175
|
project: name,
|
|
@@ -2179,31 +2184,36 @@ var BuildCloudflareTask = class BuildCloudflareTask extends BuildTask {
|
|
|
2179
2184
|
hasCron: crons.length > 0
|
|
2180
2185
|
},
|
|
2181
2186
|
crons,
|
|
2182
|
-
|
|
2183
|
-
name: c.name,
|
|
2184
|
-
className: c.className,
|
|
2185
|
-
image: c.image,
|
|
2186
|
-
port: c.port,
|
|
2187
|
-
sleepAfter: c.sleepAfter,
|
|
2188
|
-
instanceType: c.instanceType,
|
|
2189
|
-
maxInstances: c.maxInstances
|
|
2190
|
-
})),
|
|
2187
|
+
email,
|
|
2191
2188
|
env
|
|
2192
2189
|
};
|
|
2193
2190
|
await this.fs.writeFile(this.fs.join(root, distDir, "manifest.json"), JSON.stringify(manifest, null, 2));
|
|
2194
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
|
+
}
|
|
2195
2199
|
enhanceDomain(wrangler) {
|
|
2196
2200
|
const domain = process.env.CLOUDFLARE_DOMAIN;
|
|
2197
2201
|
if (!domain) return;
|
|
2198
2202
|
if (domain.includes("*")) {
|
|
2199
|
-
const zone = process.env.CLOUDFLARE_ZONE;
|
|
2200
|
-
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);
|
|
2201
2204
|
wrangler.routes = [{
|
|
2202
2205
|
pattern: domain.endsWith("/*") ? domain : `${domain}/*`,
|
|
2203
2206
|
zone_name: zone
|
|
2204
2207
|
}];
|
|
2205
2208
|
return;
|
|
2206
2209
|
}
|
|
2210
|
+
if (process.env.CLOUDFLARE_ZONE) {
|
|
2211
|
+
wrangler.routes = [{
|
|
2212
|
+
pattern: `${domain}/*`,
|
|
2213
|
+
zone_name: process.env.CLOUDFLARE_ZONE
|
|
2214
|
+
}];
|
|
2215
|
+
return;
|
|
2216
|
+
}
|
|
2207
2217
|
wrangler.routes = [{
|
|
2208
2218
|
pattern: domain,
|
|
2209
2219
|
custom_domain: true
|
|
@@ -2238,13 +2248,11 @@ var BuildCloudflareTask = class BuildCloudflareTask extends BuildTask {
|
|
|
2238
2248
|
if (!url?.startsWith("d1:")) return;
|
|
2239
2249
|
const [dbName, id] = url.replace("d1://", "").replace("d1:", "").split(":");
|
|
2240
2250
|
const binding = BuildCloudflareTask.D1_BINDING;
|
|
2241
|
-
const jurisdiction = process.env.CLOUDFLARE_JURISDICTION;
|
|
2242
2251
|
wrangler.d1_databases = wrangler.d1_databases || [];
|
|
2243
2252
|
wrangler.d1_databases.push({
|
|
2244
2253
|
binding,
|
|
2245
2254
|
database_name: dbName,
|
|
2246
|
-
database_id: id
|
|
2247
|
-
...jurisdiction ? { jurisdiction } : {}
|
|
2255
|
+
database_id: id
|
|
2248
2256
|
});
|
|
2249
2257
|
wrangler.vars ??= {};
|
|
2250
2258
|
wrangler.vars.DATABASE_URL = `d1://${binding}`;
|
|
@@ -2293,111 +2301,45 @@ var BuildCloudflareTask = class BuildCloudflareTask extends BuildTask {
|
|
|
2293
2301
|
binding: QUEUE_DEFAULT_BINDING,
|
|
2294
2302
|
queue: queueName
|
|
2295
2303
|
});
|
|
2304
|
+
const maxRetries = Number(process.env.CLOUDFLARE_QUEUE_MAX_RETRIES);
|
|
2296
2305
|
wrangler.queues.consumers = wrangler.queues.consumers || [];
|
|
2297
|
-
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
|
+
});
|
|
2298
2311
|
}
|
|
2299
2312
|
enhanceEmail(ctx, wrangler) {
|
|
2300
|
-
|
|
2301
|
-
|
|
2313
|
+
let binding;
|
|
2314
|
+
if (ctx.manifest) binding = ctx.manifest.email?.binding;
|
|
2315
|
+
else if (ctx.alepha) try {
|
|
2302
2316
|
ctx.alepha.inject(CLOUDFLARE_EMAIL_PROVIDER_NAME);
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2317
|
+
binding = SEND_EMAIL_DEFAULT_BINDING;
|
|
2318
|
+
} catch {}
|
|
2319
|
+
if (!binding) return;
|
|
2306
2320
|
wrangler.send_email = wrangler.send_email || [];
|
|
2307
|
-
if (wrangler.send_email.some((b) => b.name ===
|
|
2308
|
-
|
|
2309
|
-
wrangler.send_email.push(entry);
|
|
2321
|
+
if (wrangler.send_email.some((b) => b.name === binding)) return;
|
|
2322
|
+
wrangler.send_email.push({ name: binding });
|
|
2310
2323
|
}
|
|
2311
|
-
|
|
2312
|
-
* Discover `$container` primitives and emit the matching Cloudflare
|
|
2313
|
-
* Containers bindings, Durable Object bindings, and migrations into
|
|
2314
|
-
* `wrangler.jsonc`. The DO class declarations are added later, when
|
|
2315
|
-
* the worker entry point is written.
|
|
2316
|
-
*
|
|
2317
|
-
* Returns the list of container descriptors so
|
|
2318
|
-
* `writeWorkerEntryPoint` can emit `export class <NAME> extends
|
|
2319
|
-
* Container` declarations referencing them.
|
|
2320
|
-
*/
|
|
2321
|
-
discoverContainers(ctx) {
|
|
2322
|
-
return ctx.alepha.primitives("container").map((p) => ({
|
|
2323
|
-
name: p.name.toUpperCase(),
|
|
2324
|
-
className: p.name.split(/[^a-zA-Z0-9]/).filter(Boolean).map((s) => s[0].toUpperCase() + s.slice(1)).join(""),
|
|
2325
|
-
image: p.options.image,
|
|
2326
|
-
port: p.options.port ?? 3e3,
|
|
2327
|
-
sleepAfter: typeof p.options.sleepAfter === "string" ? p.options.sleepAfter : "15m",
|
|
2328
|
-
instanceType: p.options.instanceType === "dev" ? "lite" : p.options.instanceType ?? "lite",
|
|
2329
|
-
maxInstances: p.options.maxInstances ?? 5,
|
|
2330
|
-
envVars: p.options.envVars
|
|
2331
|
-
}));
|
|
2332
|
-
}
|
|
2333
|
-
/**
|
|
2334
|
-
* Expand a short image ref (e.g. `alepha-rocket:0.1.0`) into the
|
|
2335
|
-
* fully-qualified `registry.cloudflare.com/<account>/<image>:<tag>`
|
|
2336
|
-
* URL that wrangler validates at deploy time.
|
|
2337
|
-
*
|
|
2338
|
-
* Cloudflare Containers only pulls from `registry.cloudflare.com`;
|
|
2339
|
-
* wrangler accepts either a Dockerfile path or a fully-qualified
|
|
2340
|
-
* registry URL in the `image` field — not a bare DockerHub-style
|
|
2341
|
-
* name. We let `$container({ image })` callers write the short
|
|
2342
|
-
* form (it matches what `wrangler containers push <local>` accepts
|
|
2343
|
-
* + matches the local docker tag) and rewrite to the CF registry
|
|
2344
|
-
* URL here.
|
|
2345
|
-
*
|
|
2346
|
-
* Pass-through cases:
|
|
2347
|
-
* - already a full URL: starts with `registry.cloudflare.com/`
|
|
2348
|
-
* or contains a scheme/`://`
|
|
2349
|
-
* - looks like a Dockerfile path: starts with `./` or `/`
|
|
2350
|
-
*/
|
|
2351
|
-
resolveContainerImage(image) {
|
|
2352
|
-
if (image.startsWith("./") || image.startsWith("/") || image.startsWith("registry.cloudflare.com/") || image.includes("://")) return image;
|
|
2353
|
-
const accountId = process.env.CLOUDFLARE_ACCOUNT_ID;
|
|
2354
|
-
if (!accountId) return image;
|
|
2355
|
-
return `registry.cloudflare.com/${accountId}/${image}`;
|
|
2356
|
-
}
|
|
2357
|
-
enhanceContainers(ctx, wrangler) {
|
|
2358
|
-
const descriptors = ctx.manifest ? ctx.manifest.containers : this.discoverContainers(ctx);
|
|
2359
|
-
if (descriptors.length === 0) return [];
|
|
2360
|
-
wrangler.containers = wrangler.containers || [];
|
|
2361
|
-
wrangler.durable_objects = wrangler.durable_objects || {};
|
|
2362
|
-
wrangler.durable_objects.bindings = wrangler.durable_objects.bindings || [];
|
|
2363
|
-
wrangler.migrations = wrangler.migrations || [];
|
|
2364
|
-
const newSqliteClasses = [];
|
|
2365
|
-
for (const d of descriptors) {
|
|
2366
|
-
wrangler.containers.push({
|
|
2367
|
-
class_name: d.className,
|
|
2368
|
-
image: this.resolveContainerImage(d.image),
|
|
2369
|
-
instance_type: d.instanceType,
|
|
2370
|
-
max_instances: d.maxInstances
|
|
2371
|
-
});
|
|
2372
|
-
wrangler.durable_objects.bindings.push({
|
|
2373
|
-
name: d.name,
|
|
2374
|
-
class_name: d.className
|
|
2375
|
-
});
|
|
2376
|
-
newSqliteClasses.push(d.className);
|
|
2377
|
-
}
|
|
2378
|
-
if (newSqliteClasses.length > 0) wrangler.migrations.push({
|
|
2379
|
-
tag: "containers-v1",
|
|
2380
|
-
new_sqlite_classes: newSqliteClasses
|
|
2381
|
-
});
|
|
2382
|
-
return descriptors;
|
|
2383
|
-
}
|
|
2384
|
-
async writeWorkerEntryPoint(root, distDir, containers = []) {
|
|
2385
|
-
const containerDeclarations = containers.map((c) => {
|
|
2386
|
-
const envVars = c.envVars ? ` envVars = ${JSON.stringify(c.envVars)};\n` : "";
|
|
2387
|
-
return `export class ${c.className} extends globalThis.__alepha_CloudflareContainer {\n defaultPort = ${c.port};\n sleepAfter = "${c.sleepAfter}";\n${envVars}}`;
|
|
2388
|
-
}).join("\n\n");
|
|
2324
|
+
async writeWorkerEntryPoint(root, distDir) {
|
|
2389
2325
|
const workerCode = `
|
|
2390
2326
|
import "./index.js";
|
|
2391
2327
|
|
|
2392
|
-
//
|
|
2393
|
-
// so background work (notably $job direct dispatch)
|
|
2394
|
-
// alive past the response.
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
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 });
|
|
2401
2343
|
};
|
|
2402
2344
|
|
|
2403
2345
|
// Bind the per-invocation Worker \`env\`: keep the full binding (D1, R2, KV, …)
|
|
@@ -2413,7 +2355,6 @@ export default {
|
|
|
2413
2355
|
const ctx = { req: request, res: undefined };
|
|
2414
2356
|
|
|
2415
2357
|
bindEnv(env);
|
|
2416
|
-
setWaitUntil(executionCtx);
|
|
2417
2358
|
|
|
2418
2359
|
try {
|
|
2419
2360
|
await __alepha.start();
|
|
@@ -2422,14 +2363,15 @@ export default {
|
|
|
2422
2363
|
return new Response("Internal Server Error", { status: 500 });
|
|
2423
2364
|
}
|
|
2424
2365
|
|
|
2425
|
-
await
|
|
2366
|
+
await withExecutionContext(executionCtx, () =>
|
|
2367
|
+
__alepha.events.emit("web:request", ctx),
|
|
2368
|
+
);
|
|
2426
2369
|
|
|
2427
2370
|
return ctx.res;
|
|
2428
2371
|
},
|
|
2429
2372
|
|
|
2430
2373
|
scheduled: async (event, env, executionCtx) => {
|
|
2431
2374
|
bindEnv(env);
|
|
2432
|
-
setWaitUntil(executionCtx);
|
|
2433
2375
|
|
|
2434
2376
|
try {
|
|
2435
2377
|
await __alepha.start();
|
|
@@ -2438,15 +2380,16 @@ export default {
|
|
|
2438
2380
|
throw err;
|
|
2439
2381
|
}
|
|
2440
2382
|
|
|
2441
|
-
await
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2383
|
+
await withExecutionContext(executionCtx, () =>
|
|
2384
|
+
__alepha.events.emit("cloudflare:scheduled", {
|
|
2385
|
+
cron: event.cron,
|
|
2386
|
+
scheduledTime: event.scheduledTime,
|
|
2387
|
+
}),
|
|
2388
|
+
);
|
|
2445
2389
|
},
|
|
2446
2390
|
|
|
2447
2391
|
queue: async (batch, env, executionCtx) => {
|
|
2448
2392
|
bindEnv(env);
|
|
2449
|
-
setWaitUntil(executionCtx);
|
|
2450
2393
|
|
|
2451
2394
|
try {
|
|
2452
2395
|
await __alepha.start();
|
|
@@ -2455,19 +2398,20 @@ export default {
|
|
|
2455
2398
|
throw err;
|
|
2456
2399
|
}
|
|
2457
2400
|
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
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
|
+
}
|
|
2464
2409
|
}
|
|
2465
|
-
}
|
|
2410
|
+
});
|
|
2466
2411
|
},
|
|
2467
2412
|
};
|
|
2468
2413
|
`.trim();
|
|
2469
|
-
|
|
2470
|
-
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());
|
|
2471
2415
|
}
|
|
2472
2416
|
};
|
|
2473
2417
|
//#endregion
|
|
@@ -2760,11 +2704,18 @@ CMD ["${command}", "index.js"]
|
|
|
2760
2704
|
//#endregion
|
|
2761
2705
|
//#region ../../src/cli/core/tasks/BuildPrerenderTask.ts
|
|
2762
2706
|
/**
|
|
2763
|
-
* Pre-render static pages defined in the Alepha application.
|
|
2707
|
+
* Pre-render static pages and routes defined in the Alepha application.
|
|
2764
2708
|
*
|
|
2765
|
-
*
|
|
2766
|
-
*
|
|
2767
|
-
* routes via `static.entries`
|
|
2709
|
+
* Two passes, both writing into `dist/public`:
|
|
2710
|
+
* - **pages** — every `$page` with `static: true` is rendered to an HTML file
|
|
2711
|
+
* (supports parameterized routes via `static.entries`).
|
|
2712
|
+
* - **routes** — every `static` route primitive (a `$route({ static: true })`
|
|
2713
|
+
* or a `$sitemap`) is invoked in-process and its body written verbatim to
|
|
2714
|
+
* `{path}` (e.g. `sitemap.xml`, `robots.txt`).
|
|
2715
|
+
*
|
|
2716
|
+
* Both passes read the primitive registry and call a method on the already
|
|
2717
|
+
* created primitive instances — no provider is re-injected, so this works in
|
|
2718
|
+
* the build's configured-but-not-started container.
|
|
2768
2719
|
*/
|
|
2769
2720
|
var BuildPrerenderTask = class extends BuildTask {
|
|
2770
2721
|
fs = $inject(FileSystemProvider);
|
|
@@ -2772,15 +2723,17 @@ var BuildPrerenderTask = class extends BuildTask {
|
|
|
2772
2723
|
if (ctx.flags?.prebuilt) return;
|
|
2773
2724
|
if (!ctx.hasClient) return;
|
|
2774
2725
|
const pages = this.getStaticPages(ctx);
|
|
2775
|
-
|
|
2726
|
+
const routes = this.getStaticRoutePrimitives(ctx);
|
|
2727
|
+
if (pages.length === 0 && routes.length === 0) return;
|
|
2776
2728
|
const distDir = ctx.options.output?.dist ?? "dist";
|
|
2777
2729
|
const publicDir = ctx.options.output?.public ?? "public";
|
|
2778
2730
|
const dist = this.fs.join(ctx.root, distDir, publicDir);
|
|
2779
2731
|
await ctx.run({
|
|
2780
|
-
name: "pre-render
|
|
2732
|
+
name: "pre-render",
|
|
2781
2733
|
handler: async () => {
|
|
2782
2734
|
if (!ctx.alepha.isConfigured()) await ctx.alepha.events.emit("configure", ctx.alepha);
|
|
2783
|
-
await this.prerenderFromAlepha(pages, dist);
|
|
2735
|
+
if (pages.length > 0) await this.prerenderFromAlepha(pages, dist);
|
|
2736
|
+
if (routes.length > 0) await this.prerenderRoutes(routes, dist);
|
|
2784
2737
|
}
|
|
2785
2738
|
});
|
|
2786
2739
|
}
|
|
@@ -2790,6 +2743,15 @@ var BuildPrerenderTask = class extends BuildTask {
|
|
|
2790
2743
|
return options.static && !options.children;
|
|
2791
2744
|
});
|
|
2792
2745
|
}
|
|
2746
|
+
/**
|
|
2747
|
+
* Static route primitives to snapshot: `$route({ static: true })` and every
|
|
2748
|
+
* `$sitemap`. Both expose an async `prerender(): { path, body }`.
|
|
2749
|
+
*/
|
|
2750
|
+
getStaticRoutePrimitives(ctx) {
|
|
2751
|
+
const routes = ctx.alepha.primitives("route").filter((route) => route.options?.static === true);
|
|
2752
|
+
const sitemaps = ctx.alepha.primitives("sitemap");
|
|
2753
|
+
return [...routes, ...sitemaps];
|
|
2754
|
+
}
|
|
2793
2755
|
async prerenderFromAlepha(pages, dist) {
|
|
2794
2756
|
let count = 0;
|
|
2795
2757
|
for (const page of pages) {
|
|
@@ -2807,6 +2769,14 @@ var BuildPrerenderTask = class extends BuildTask {
|
|
|
2807
2769
|
}
|
|
2808
2770
|
return count;
|
|
2809
2771
|
}
|
|
2772
|
+
async prerenderRoutes(primitives, dist) {
|
|
2773
|
+
for (const primitive of primitives) {
|
|
2774
|
+
const { path, body } = await primitive.prerender();
|
|
2775
|
+
const filepath = this.fs.join(dist, path);
|
|
2776
|
+
await this.fs.mkdir(dirname(filepath));
|
|
2777
|
+
await this.fs.writeFile(filepath, body);
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2810
2780
|
async renderFile(page, options, dist) {
|
|
2811
2781
|
const { html, state } = await page.render({
|
|
2812
2782
|
html: true,
|
|
@@ -3080,76 +3050,6 @@ var BuildServerTask = class extends BuildTask {
|
|
|
3080
3050
|
}
|
|
3081
3051
|
};
|
|
3082
3052
|
//#endregion
|
|
3083
|
-
//#region ../../src/cli/core/tasks/BuildSitemapTask.ts
|
|
3084
|
-
/**
|
|
3085
|
-
* Generate sitemap.xml from Alepha page primitives.
|
|
3086
|
-
*
|
|
3087
|
-
* Queries all page primitives and generates a sitemap.xml
|
|
3088
|
-
* containing URLs for all accessible pages.
|
|
3089
|
-
*/
|
|
3090
|
-
var BuildSitemapTask = class extends BuildTask {
|
|
3091
|
-
fs = $inject(FileSystemProvider);
|
|
3092
|
-
async run(ctx) {
|
|
3093
|
-
const hostname = ctx.options.sitemap?.hostname;
|
|
3094
|
-
if (!hostname) return;
|
|
3095
|
-
const pages = this.getSitemapPages(ctx);
|
|
3096
|
-
if (pages.length === 0) return;
|
|
3097
|
-
const distDir = ctx.options.output?.dist ?? "dist";
|
|
3098
|
-
const publicDir = ctx.options.output?.public ?? "public";
|
|
3099
|
-
const output = this.fs.join(ctx.root, distDir, publicDir, "sitemap.xml");
|
|
3100
|
-
await ctx.run({
|
|
3101
|
-
name: "generate sitemap",
|
|
3102
|
-
handler: async () => {
|
|
3103
|
-
const xml = this.generateSitemapFromPages(pages, hostname);
|
|
3104
|
-
await this.fs.writeFile(output, xml);
|
|
3105
|
-
}
|
|
3106
|
-
});
|
|
3107
|
-
}
|
|
3108
|
-
getSitemapPages(ctx) {
|
|
3109
|
-
return ctx.alepha.primitives("page").filter((page) => {
|
|
3110
|
-
const options = page.options;
|
|
3111
|
-
const path = options.path ?? "";
|
|
3112
|
-
if (options.children) return false;
|
|
3113
|
-
if (path.includes("*")) return false;
|
|
3114
|
-
if (path === "/404") return false;
|
|
3115
|
-
if (!options.schema?.params) return true;
|
|
3116
|
-
if (options.static && typeof options.static === "object" && options.static.entries) return true;
|
|
3117
|
-
return false;
|
|
3118
|
-
});
|
|
3119
|
-
}
|
|
3120
|
-
generateSitemapFromPages(pages, baseUrl) {
|
|
3121
|
-
const urls = [];
|
|
3122
|
-
const normalizedBaseUrl = baseUrl.replace(/\/$/, "");
|
|
3123
|
-
for (const page of pages) {
|
|
3124
|
-
const options = page.options;
|
|
3125
|
-
if (!options.schema?.params) {
|
|
3126
|
-
const path = options.path || "";
|
|
3127
|
-
const url = `${normalizedBaseUrl}${path === "" ? "/" : path}`;
|
|
3128
|
-
urls.push(url);
|
|
3129
|
-
} else if (options.static && typeof options.static === "object" && options.static.entries) for (const entry of options.static.entries) {
|
|
3130
|
-
const url = `${normalizedBaseUrl}${this.buildPathFromParams(options.path || "", entry.params || {})}`;
|
|
3131
|
-
urls.push(url);
|
|
3132
|
-
}
|
|
3133
|
-
}
|
|
3134
|
-
return this.buildSitemapXml(urls);
|
|
3135
|
-
}
|
|
3136
|
-
buildPathFromParams(pathPattern, params) {
|
|
3137
|
-
let path = pathPattern;
|
|
3138
|
-
for (const [key, value] of Object.entries(params)) path = path.replace(`:${key}`, String(value));
|
|
3139
|
-
return path || "/";
|
|
3140
|
-
}
|
|
3141
|
-
buildSitemapXml(urls) {
|
|
3142
|
-
const lastMod = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
3143
|
-
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
3144
|
-
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
3145
|
-
${urls.map((url) => ` <url>\n <loc>${this.escapeXml(url)}</loc>\n <lastmod>${lastMod}</lastmod>\n </url>`).join("\n")}
|
|
3146
|
-
</urlset>`;
|
|
3147
|
-
}
|
|
3148
|
-
escapeXml(str) {
|
|
3149
|
-
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
3150
|
-
}
|
|
3151
|
-
};
|
|
3152
|
-
//#endregion
|
|
3153
3053
|
//#region ../../src/cli/core/tasks/BuildStaticTask.ts
|
|
3154
3054
|
/**
|
|
3155
3055
|
* Generate a static site output.
|
|
@@ -3414,7 +3314,6 @@ var BuildCommand = class {
|
|
|
3414
3314
|
$inject(BuildClientTask),
|
|
3415
3315
|
$inject(BuildServerTask),
|
|
3416
3316
|
$inject(BuildAssetsTask),
|
|
3417
|
-
$inject(BuildSitemapTask),
|
|
3418
3317
|
$inject(BuildPwaTask),
|
|
3419
3318
|
$inject(BuildPrerenderTask),
|
|
3420
3319
|
$inject(BuildVercelTask),
|
|
@@ -3465,37 +3364,24 @@ var BuildCommand = class {
|
|
|
3465
3364
|
name: "build",
|
|
3466
3365
|
mode: "production",
|
|
3467
3366
|
description: "Build the project for production",
|
|
3468
|
-
flags:
|
|
3469
|
-
stats:
|
|
3470
|
-
target:
|
|
3367
|
+
flags: z.object({
|
|
3368
|
+
stats: z.union([z.boolean(), z.enum(["json"])]).describe("Generate build stats report").optional(),
|
|
3369
|
+
target: z.enum([
|
|
3471
3370
|
"bare",
|
|
3472
3371
|
"docker",
|
|
3473
3372
|
"vercel",
|
|
3474
3373
|
"cloudflare",
|
|
3475
3374
|
"cf",
|
|
3476
3375
|
"static"
|
|
3477
|
-
],
|
|
3478
|
-
|
|
3479
|
-
description: "Deployment target (cf = cloudflare)"
|
|
3480
|
-
})),
|
|
3481
|
-
runtime: t.optional(t.enum([
|
|
3376
|
+
]).meta({ aliases: ["t"] }).describe("Deployment target (cf = cloudflare)").optional(),
|
|
3377
|
+
runtime: z.enum([
|
|
3482
3378
|
"node",
|
|
3483
3379
|
"bun",
|
|
3484
3380
|
"workerd"
|
|
3485
|
-
],
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
image: t.optional(t.union([t.boolean(), t.text()], {
|
|
3490
|
-
aliases: ["i"],
|
|
3491
|
-
description: "Build Docker image. Use -i for latest, -i=<version> for specific version"
|
|
3492
|
-
})),
|
|
3493
|
-
compile: t.optional(t.boolean({
|
|
3494
|
-
aliases: ["c"],
|
|
3495
|
-
description: "Compile server to a single static binary (requires --target=docker --runtime=bun)"
|
|
3496
|
-
})),
|
|
3497
|
-
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." })),
|
|
3498
|
-
sitemap: t.optional(t.text({ description: "Generate sitemap.xml with base URL" }))
|
|
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()
|
|
3499
3385
|
}),
|
|
3500
3386
|
handler: async ({ flags, run, root }) => {
|
|
3501
3387
|
process.env.NODE_ENV = "production";
|
|
@@ -3513,8 +3399,7 @@ var BuildCommand = class {
|
|
|
3513
3399
|
...flags.compile !== void 0 && { docker: {
|
|
3514
3400
|
...current.docker,
|
|
3515
3401
|
compile: flags.compile ? current.docker?.compile ?? true : false
|
|
3516
|
-
} }
|
|
3517
|
-
...flags.sitemap && { sitemap: { hostname: flags.sitemap } }
|
|
3402
|
+
} }
|
|
3518
3403
|
};
|
|
3519
3404
|
});
|
|
3520
3405
|
const options = this.options;
|
|
@@ -3594,7 +3479,7 @@ var CleanCommand = class {
|
|
|
3594
3479
|
};
|
|
3595
3480
|
//#endregion
|
|
3596
3481
|
//#region ../../src/cli/core/commands/db.ts
|
|
3597
|
-
const drizzleCommandFlags =
|
|
3482
|
+
const drizzleCommandFlags = z.object({ provider: z.text({ description: "Database provider name to target (e.g., 'postgres', 'sqlite')" }).optional() });
|
|
3598
3483
|
var DbCommand = class {
|
|
3599
3484
|
log = $logger();
|
|
3600
3485
|
fs = $inject(FileSystemProvider);
|
|
@@ -3602,7 +3487,6 @@ var DbCommand = class {
|
|
|
3602
3487
|
pm = $inject(PackageManagerUtils);
|
|
3603
3488
|
entryProvider = $inject(AppEntryProvider);
|
|
3604
3489
|
viteUtil = $inject(ViteUtils);
|
|
3605
|
-
runner = $inject(Runner);
|
|
3606
3490
|
/**
|
|
3607
3491
|
* Check if database migrations are up to date.
|
|
3608
3492
|
*/
|
|
@@ -3610,12 +3494,12 @@ var DbCommand = class {
|
|
|
3610
3494
|
name: "check",
|
|
3611
3495
|
mode: true,
|
|
3612
3496
|
description: "Check if migration files are up to date",
|
|
3613
|
-
args:
|
|
3497
|
+
args: z.text({
|
|
3614
3498
|
title: "path",
|
|
3615
3499
|
description: "Path to the Alepha server entry file"
|
|
3616
|
-
})),
|
|
3500
|
+
}).optional(),
|
|
3617
3501
|
flags: drizzleCommandFlags,
|
|
3618
|
-
handler: async ({
|
|
3502
|
+
handler: async ({ flags, root }) => {
|
|
3619
3503
|
const rootDir = root;
|
|
3620
3504
|
this.log.debug(`Using project root: ${rootDir}`);
|
|
3621
3505
|
const entry = await this.entryProvider.getAppEntry(root);
|
|
@@ -3626,16 +3510,18 @@ var DbCommand = class {
|
|
|
3626
3510
|
const repositoryProvider = alepha.inject("RepositoryProvider");
|
|
3627
3511
|
const drizzleKitProvider = alepha.inject("DrizzleKitProvider");
|
|
3628
3512
|
const accepted = /* @__PURE__ */ new Set([]);
|
|
3513
|
+
const drifted = [];
|
|
3629
3514
|
for (const primitive of repositoryProvider.getRepositories()) {
|
|
3630
3515
|
const provider = primitive.provider;
|
|
3631
3516
|
const providerName = provider.name;
|
|
3632
3517
|
if (accepted.has(providerName)) continue;
|
|
3633
3518
|
accepted.add(providerName);
|
|
3519
|
+
if (flags.provider && flags.provider !== providerName) continue;
|
|
3634
3520
|
const migrationDir = this.fs.join(rootDir, "migrations", providerName);
|
|
3635
3521
|
const journalBuffer = await this.fs.readFile(this.fs.join(migrationDir, "meta", "_journal.json")).catch(() => null);
|
|
3636
3522
|
if (!journalBuffer) {
|
|
3637
|
-
this.log.info(
|
|
3638
|
-
|
|
3523
|
+
this.log.info(`No migration journal found for '${providerName}'.`);
|
|
3524
|
+
continue;
|
|
3639
3525
|
}
|
|
3640
3526
|
const journal = JSON.parse(journalBuffer.toString("utf-8"));
|
|
3641
3527
|
const lastMigration = journal.entries[journal.entries.length - 1];
|
|
@@ -3643,18 +3529,27 @@ var DbCommand = class {
|
|
|
3643
3529
|
const lastSnapshot = JSON.parse(snapshotBuffer.toString("utf-8"));
|
|
3644
3530
|
const { statements: migrationStatements } = await drizzleKitProvider.generateMigration(provider, lastSnapshot, { withoutSchema: true });
|
|
3645
3531
|
if (migrationStatements.length === 0) {
|
|
3646
|
-
this.log.info(
|
|
3647
|
-
|
|
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.`);
|
|
3648
3548
|
}
|
|
3649
3549
|
this.log.info("");
|
|
3650
|
-
this.log.info("Detected migration statements:");
|
|
3651
|
-
this.log.info("");
|
|
3652
|
-
for (const stmt of migrationStatements) this.log.info(stmt);
|
|
3653
|
-
this.log.info("");
|
|
3654
|
-
this.log.info(`At least ${migrationStatements.length} change(s) detected.`);
|
|
3655
3550
|
this.log.info("Please, run 'alepha db migrations generate' to update the migration files.");
|
|
3656
3551
|
this.log.info("");
|
|
3657
|
-
throw new AlephaError(
|
|
3552
|
+
throw new AlephaError(`Database migrations are not up to date (${drifted.map((d) => d.provider).join(", ")}).`);
|
|
3658
3553
|
}
|
|
3659
3554
|
}
|
|
3660
3555
|
});
|
|
@@ -3665,13 +3560,13 @@ var DbCommand = class {
|
|
|
3665
3560
|
name: "create",
|
|
3666
3561
|
mode: true,
|
|
3667
3562
|
description: "Generate migration files from current schema",
|
|
3668
|
-
args:
|
|
3563
|
+
args: z.text({
|
|
3669
3564
|
title: "path",
|
|
3670
3565
|
description: "Path to the Alepha server entry file"
|
|
3671
|
-
})),
|
|
3672
|
-
flags:
|
|
3673
|
-
custom:
|
|
3674
|
-
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()
|
|
3675
3570
|
}),
|
|
3676
3571
|
handler: async ({ args, flags, root }) => {
|
|
3677
3572
|
const parts = [];
|
|
@@ -3695,11 +3590,11 @@ var DbCommand = class {
|
|
|
3695
3590
|
name: "push",
|
|
3696
3591
|
mode: true,
|
|
3697
3592
|
description: "Push database schema changes directly to the database",
|
|
3698
|
-
args:
|
|
3593
|
+
args: z.text({
|
|
3699
3594
|
title: "path",
|
|
3700
3595
|
description: "Path to the Alepha server entry file"
|
|
3701
|
-
})),
|
|
3702
|
-
flags:
|
|
3596
|
+
}).optional(),
|
|
3597
|
+
flags: drizzleCommandFlags.extend({ dryRun: z.boolean().describe("Preview SQL statements without executing them").optional() }),
|
|
3703
3598
|
handler: async ({ root, args, flags }) => {
|
|
3704
3599
|
if (flags.dryRun) {
|
|
3705
3600
|
const entry = await this.entryProvider.getAppEntry(root);
|
|
@@ -3754,10 +3649,10 @@ var DbCommand = class {
|
|
|
3754
3649
|
name: "apply",
|
|
3755
3650
|
mode: true,
|
|
3756
3651
|
description: "Apply pending migrations to the database",
|
|
3757
|
-
args:
|
|
3652
|
+
args: z.text({
|
|
3758
3653
|
title: "path",
|
|
3759
3654
|
description: "Path to the Alepha server entry file"
|
|
3760
|
-
})),
|
|
3655
|
+
}).optional(),
|
|
3761
3656
|
flags: drizzleCommandFlags,
|
|
3762
3657
|
handler: async ({ root, run, mode }) => {
|
|
3763
3658
|
const entry = await this.entryProvider.getAppEntry(root);
|
|
@@ -3765,7 +3660,6 @@ var DbCommand = class {
|
|
|
3765
3660
|
name: `db migrate (${mode || "development"})`,
|
|
3766
3661
|
handler: async () => {
|
|
3767
3662
|
process.env.MIGRATE = "true";
|
|
3768
|
-
if (this.runner.useDynamicLogger) process.env.LOG_LEVEL = "warn";
|
|
3769
3663
|
await (await this.viteUtil.runAlepha({
|
|
3770
3664
|
entry,
|
|
3771
3665
|
mode: "production"
|
|
@@ -3781,10 +3675,10 @@ var DbCommand = class {
|
|
|
3781
3675
|
name: "studio",
|
|
3782
3676
|
mode: true,
|
|
3783
3677
|
description: "Launch Drizzle Studio database browser",
|
|
3784
|
-
args:
|
|
3678
|
+
args: z.text({
|
|
3785
3679
|
title: "path",
|
|
3786
3680
|
description: "Path to the Alepha server entry file"
|
|
3787
|
-
})),
|
|
3681
|
+
}).optional(),
|
|
3788
3682
|
flags: drizzleCommandFlags,
|
|
3789
3683
|
handler: async ({ root, args, flags }) => {
|
|
3790
3684
|
await this.runDrizzleKitCommand({
|
|
@@ -3865,6 +3759,9 @@ var DbCommand = class {
|
|
|
3865
3759
|
rootDir,
|
|
3866
3760
|
command: options.command
|
|
3867
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();
|
|
3868
3765
|
const flags = options.commandFlags ? ` ${options.commandFlags}` : "";
|
|
3869
3766
|
const drizzleKit = this.utils.resolveBin("drizzle-kit");
|
|
3870
3767
|
await this.utils.exec(`node "${drizzleKit}" ${options.command} --config=${drizzleConfigJsPath}${flags}`, {
|
|
@@ -3874,7 +3771,10 @@ var DbCommand = class {
|
|
|
3874
3771
|
NODE_OPTIONS: [process.env.NODE_OPTIONS, "--import tsx"].filter(Boolean).join(" ")
|
|
3875
3772
|
}
|
|
3876
3773
|
});
|
|
3877
|
-
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)));
|
|
3878
3778
|
}
|
|
3879
3779
|
}
|
|
3880
3780
|
/**
|
|
@@ -3897,6 +3797,53 @@ var DbCommand = class {
|
|
|
3897
3797
|
}
|
|
3898
3798
|
}
|
|
3899
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
|
+
/**
|
|
3900
3847
|
* Prepare Drizzle configuration files for a database provider.
|
|
3901
3848
|
*/
|
|
3902
3849
|
async prepareDrizzleConfig(options) {
|
|
@@ -4390,7 +4337,7 @@ if (import.meta.hot) {
|
|
|
4390
4337
|
const file = queue.pop();
|
|
4391
4338
|
if (invalidated.has(file)) continue;
|
|
4392
4339
|
invalidated.add(file);
|
|
4393
|
-
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)] : []]);
|
|
4394
4341
|
if (mods.size === 0) continue;
|
|
4395
4342
|
for (const mod of mods) {
|
|
4396
4343
|
graph.invalidateModule(mod);
|
|
@@ -4415,7 +4362,7 @@ if (import.meta.hot) {
|
|
|
4415
4362
|
if (/[/\\]\.idea[/\\]/.test(file)) return;
|
|
4416
4363
|
console.log();
|
|
4417
4364
|
console.log(this.colors.set("CYAN", " ⟳ Retrying..."));
|
|
4418
|
-
const filesToInvalidate = new Set([file]);
|
|
4365
|
+
const filesToInvalidate = /* @__PURE__ */ new Set([file]);
|
|
4419
4366
|
try {
|
|
4420
4367
|
const alepha = await this.loadAlepha(false, filesToInvalidate);
|
|
4421
4368
|
this.waitingForRetry = false;
|
|
@@ -4522,7 +4469,7 @@ var DevCommand = class {
|
|
|
4522
4469
|
name: "dev",
|
|
4523
4470
|
mode: true,
|
|
4524
4471
|
description: "Run the project in development mode",
|
|
4525
|
-
flags:
|
|
4472
|
+
flags: z.object({ only: z.string().describe("Run only specific apps (comma-separated: --only api,companion)").optional() }),
|
|
4526
4473
|
handler: async ({ root, flags }) => {
|
|
4527
4474
|
const apps = await this.discoverApps(root);
|
|
4528
4475
|
if (apps.length > 0) await this.runMultiple(root, apps, flags);
|
|
@@ -4659,12 +4606,12 @@ const DEFAULT_IGNORE = [
|
|
|
4659
4606
|
*/
|
|
4660
4607
|
const changelogOptions = $atom({
|
|
4661
4608
|
name: "alepha.cli.changelog.options",
|
|
4662
|
-
schema:
|
|
4609
|
+
schema: z.object({
|
|
4663
4610
|
/**
|
|
4664
4611
|
* Scopes to ignore (e.g., "project", "release", "chore").
|
|
4665
4612
|
* Commits like `feat(chore): ...` will be excluded from changelog.
|
|
4666
4613
|
*/
|
|
4667
|
-
ignore:
|
|
4614
|
+
ignore: z.array(z.string()).optional() }),
|
|
4668
4615
|
default: { ignore: DEFAULT_IGNORE }
|
|
4669
4616
|
});
|
|
4670
4617
|
//#endregion
|
|
@@ -4805,25 +4752,19 @@ var ChangelogCommand = class {
|
|
|
4805
4752
|
command = $command({
|
|
4806
4753
|
name: "changelog",
|
|
4807
4754
|
description: "Generate changelog from conventional commits (outputs to stdout)",
|
|
4808
|
-
flags:
|
|
4755
|
+
flags: z.object({
|
|
4809
4756
|
/**
|
|
4810
4757
|
* Show changes from this ref (tag, commit, branch).
|
|
4811
4758
|
* Defaults to the latest version tag.
|
|
4812
4759
|
* Example: --from=1.0.0
|
|
4813
4760
|
*/
|
|
4814
|
-
from:
|
|
4815
|
-
aliases: ["f"],
|
|
4816
|
-
description: "Starting ref (default: latest tag)"
|
|
4817
|
-
})),
|
|
4761
|
+
from: z.string().meta({ aliases: ["f"] }).describe("Starting ref (default: latest tag)").optional(),
|
|
4818
4762
|
/**
|
|
4819
4763
|
* Show changes up to this ref (tag, commit, branch).
|
|
4820
4764
|
* Defaults to HEAD.
|
|
4821
4765
|
* Example: --to=main
|
|
4822
4766
|
*/
|
|
4823
|
-
to:
|
|
4824
|
-
aliases: ["t"],
|
|
4825
|
-
description: "Ending ref (default: HEAD)"
|
|
4826
|
-
}))
|
|
4767
|
+
to: z.string().meta({ aliases: ["t"] }).describe("Ending ref (default: HEAD)").optional()
|
|
4827
4768
|
}),
|
|
4828
4769
|
handler: async ({ flags, root }) => {
|
|
4829
4770
|
const git = (cmd) => this.git.exec(cmd, root);
|
|
@@ -4865,10 +4806,10 @@ var GenEnvCommand = class {
|
|
|
4865
4806
|
command = $command({
|
|
4866
4807
|
name: "env",
|
|
4867
4808
|
description: "Extract environment variables from server entry file",
|
|
4868
|
-
flags:
|
|
4809
|
+
flags: z.object({ out: z.text({
|
|
4869
4810
|
aliases: ["o"],
|
|
4870
4811
|
description: "Output file path (e.g., .env)"
|
|
4871
|
-
})) }),
|
|
4812
|
+
}).optional() }),
|
|
4872
4813
|
handler: async ({ root, flags }) => {
|
|
4873
4814
|
const alepha = await this.utils.loadAlephaFromServerEntryFile({
|
|
4874
4815
|
root,
|
|
@@ -4900,10 +4841,10 @@ var OpenApiCommand = class {
|
|
|
4900
4841
|
command = $command({
|
|
4901
4842
|
name: "openapi",
|
|
4902
4843
|
description: "Generate OpenAPI specification from actions",
|
|
4903
|
-
flags:
|
|
4844
|
+
flags: z.object({ out: z.text({
|
|
4904
4845
|
aliases: ["o"],
|
|
4905
4846
|
description: "Output file path"
|
|
4906
|
-
})) }),
|
|
4847
|
+
}).optional() }),
|
|
4907
4848
|
handler: async ({ root, flags }) => {
|
|
4908
4849
|
const alepha = await this.utils.loadAlephaFromServerEntryFile({
|
|
4909
4850
|
root,
|
|
@@ -4964,28 +4905,22 @@ var InitCommand = class {
|
|
|
4964
4905
|
init = $command({
|
|
4965
4906
|
name: "init",
|
|
4966
4907
|
description: "Add missing Alepha configuration files to the project",
|
|
4967
|
-
args:
|
|
4908
|
+
args: z.text({
|
|
4968
4909
|
title: "path",
|
|
4969
4910
|
trim: true,
|
|
4970
4911
|
lowercase: true
|
|
4971
|
-
})),
|
|
4972
|
-
flags:
|
|
4973
|
-
pm:
|
|
4912
|
+
}).optional(),
|
|
4913
|
+
flags: z.object({
|
|
4914
|
+
pm: z.enum([
|
|
4974
4915
|
"yarn",
|
|
4975
4916
|
"npm",
|
|
4976
4917
|
"pnpm",
|
|
4977
4918
|
"bun"
|
|
4978
|
-
]
|
|
4979
|
-
api:
|
|
4980
|
-
react:
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
})),
|
|
4984
|
-
tailwind: t.optional(t.boolean({ description: "Include Tailwind CSS with Vite plugin. Implies --react" })),
|
|
4985
|
-
force: t.optional(t.boolean({
|
|
4986
|
-
aliases: ["f"],
|
|
4987
|
-
description: "Override existing files"
|
|
4988
|
-
}))
|
|
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()
|
|
4989
4924
|
}),
|
|
4990
4925
|
handler: async ({ run, flags, root, args }) => {
|
|
4991
4926
|
await this.scaffolder.init({
|
|
@@ -5043,15 +4978,15 @@ var PackCommand = class {
|
|
|
5043
4978
|
pack = $command({
|
|
5044
4979
|
name: "pack",
|
|
5045
4980
|
description: "Pack the workspace into a deployable tar.gz (for `alepha platform --prebuilt` consumers like Alepha Rocket).",
|
|
5046
|
-
flags:
|
|
5047
|
-
tag:
|
|
4981
|
+
flags: z.object({
|
|
4982
|
+
tag: z.text({
|
|
5048
4983
|
aliases: ["t"],
|
|
5049
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."
|
|
5050
|
-
})),
|
|
5051
|
-
output:
|
|
4985
|
+
}).optional(),
|
|
4986
|
+
output: z.text({
|
|
5052
4987
|
aliases: ["o"],
|
|
5053
4988
|
description: "Output directory for the tar.gz (default: current dir)."
|
|
5054
|
-
}))
|
|
4989
|
+
}).optional()
|
|
5055
4990
|
}),
|
|
5056
4991
|
handler: async ({ flags, root, run }) => {
|
|
5057
4992
|
const pkgPath = this.fs.join(root, "package.json");
|
|
@@ -5106,10 +5041,7 @@ var RootCommand = class {
|
|
|
5106
5041
|
*/
|
|
5107
5042
|
root = $command({
|
|
5108
5043
|
root: true,
|
|
5109
|
-
flags:
|
|
5110
|
-
description: "Show Alepha CLI version",
|
|
5111
|
-
aliases: ["v"]
|
|
5112
|
-
})) }),
|
|
5044
|
+
flags: z.object({ version: z.boolean().meta({ aliases: ["v"] }).describe("Show Alepha CLI version").optional() }),
|
|
5113
5045
|
handler: async ({ flags }) => {
|
|
5114
5046
|
if (flags.version) {
|
|
5115
5047
|
this.log.info(this.color.set("WHITE_BOLD", `Alepha v${version}`));
|
|
@@ -5129,18 +5061,12 @@ var TestCommand = class {
|
|
|
5129
5061
|
test = $command({
|
|
5130
5062
|
name: "test",
|
|
5131
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`",
|
|
5132
|
-
args:
|
|
5064
|
+
args: z.text({
|
|
5133
5065
|
title: "filter",
|
|
5134
5066
|
description: "Only run spec files whose path matches this string"
|
|
5135
|
-
})),
|
|
5136
|
-
flags:
|
|
5137
|
-
|
|
5138
|
-
alias: "c"
|
|
5139
|
-
})) }),
|
|
5140
|
-
env: t.object({ VITEST_ARGS: t.optional(t.string({
|
|
5141
|
-
default: "",
|
|
5142
|
-
description: "Additional arguments to pass to Vitest. E.g., --coverage"
|
|
5143
|
-
})) }),
|
|
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() }),
|
|
5144
5070
|
handler: async ({ run, root, flags, env, args }) => {
|
|
5145
5071
|
await this.scaffolder.ensureConfig(root, { tsconfigJson: true });
|
|
5146
5072
|
const config = flags.config ? `--config=${flags.config}` : "";
|
|
@@ -5271,12 +5197,11 @@ const AlephaCli = $module({
|
|
|
5271
5197
|
BuildDockerTask,
|
|
5272
5198
|
BuildPrerenderTask,
|
|
5273
5199
|
BuildServerTask,
|
|
5274
|
-
BuildSitemapTask,
|
|
5275
5200
|
BuildStaticTask,
|
|
5276
5201
|
BuildVercelTask
|
|
5277
5202
|
]
|
|
5278
5203
|
});
|
|
5279
5204
|
//#endregion
|
|
5280
|
-
export { AlephaCli, AlephaCliExtensionProvider, AlephaCliServices, AlephaCliUtils, AppEntryProvider, BuildAssetsTask, BuildClientTask, BuildCloudflareTask, BuildCommand, BuildCompressTask, BuildDockerTask, BuildPrerenderTask, BuildServerTask,
|
|
5205
|
+
export { AlephaCli, AlephaCliExtensionProvider, AlephaCliServices, AlephaCliUtils, AppEntryProvider, BuildAssetsTask, BuildClientTask, BuildCloudflareTask, BuildCommand, BuildCompressTask, BuildDockerTask, BuildPrerenderTask, BuildServerTask, BuildStaticTask, BuildTask, BuildVercelTask, ChangelogCommand, CleanCommand, DEFAULT_IGNORE, DbCommand, DevCommand, GitMessageParser, GitProvider, InitCommand, LintCommand, OpenApiCommand, PackCommand, PackageManagerUtils, ProjectScaffolder, RootCommand, TestCommand, TypecheckCommand, VerifyCommand, ViteBuildProvider, ViteDevServerProvider, ViteUtils, alephaPackageJson, appEntryOptions, buildOptions, changelogOptions, devOptions, version };
|
|
5281
5206
|
|
|
5282
5207
|
//# sourceMappingURL=index.js.map
|