alepha 0.21.2 → 0.22.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/README.md +0 -1
- package/dist/api/audits/index.browser.js.map +1 -1
- package/dist/api/audits/index.d.ts +393 -403
- package/dist/api/audits/index.d.ts.map +1 -1
- package/dist/api/audits/index.js +25 -56
- package/dist/api/audits/index.js.map +1 -1
- package/dist/api/files/index.browser.js +31 -1
- package/dist/api/files/index.browser.js.map +1 -1
- package/dist/api/files/index.d.ts +313 -208
- package/dist/api/files/index.d.ts.map +1 -1
- package/dist/api/files/index.js +152 -42
- package/dist/api/files/index.js.map +1 -1
- package/dist/api/jobs/index.browser.js +2 -2
- package/dist/api/jobs/index.browser.js.map +1 -1
- package/dist/api/jobs/index.d.ts +289 -292
- package/dist/api/jobs/index.d.ts.map +1 -1
- package/dist/api/jobs/index.js +39 -33
- package/dist/api/jobs/index.js.map +1 -1
- package/dist/api/keys/index.d.ts +211 -216
- package/dist/api/keys/index.d.ts.map +1 -1
- package/dist/api/keys/index.js.map +1 -1
- package/dist/api/notifications/index.browser.js.map +1 -1
- package/dist/api/notifications/index.d.ts +188 -195
- package/dist/api/notifications/index.d.ts.map +1 -1
- package/dist/api/notifications/index.js.map +1 -1
- package/dist/api/oauth/index.d.ts +71 -76
- package/dist/api/oauth/index.d.ts.map +1 -1
- package/dist/api/oauth/index.js.map +1 -1
- package/dist/api/organizations/index.browser.js.map +1 -1
- package/dist/api/organizations/index.d.ts +104 -109
- package/dist/api/organizations/index.d.ts.map +1 -1
- package/dist/api/organizations/index.js.map +1 -1
- package/dist/api/parameters/index.browser.js +43 -16
- package/dist/api/parameters/index.browser.js.map +1 -1
- package/dist/api/parameters/index.d.ts +488 -344
- package/dist/api/parameters/index.d.ts.map +1 -1
- package/dist/api/parameters/index.js +175 -35
- package/dist/api/parameters/index.js.map +1 -1
- package/dist/api/payments/index.d.ts +396 -402
- package/dist/api/payments/index.d.ts.map +1 -1
- package/dist/api/payments/index.js.map +1 -1
- package/dist/api/subscriptions/index.d.ts +644 -652
- package/dist/api/subscriptions/index.d.ts.map +1 -1
- package/dist/api/subscriptions/index.js +1 -1
- package/dist/api/subscriptions/index.js.map +1 -1
- package/dist/api/users/index.browser.js +7 -0
- package/dist/api/users/index.browser.js.map +1 -1
- package/dist/api/users/index.d.ts +1073 -1006
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +283 -61
- package/dist/api/users/index.js.map +1 -1
- package/dist/api/verifications/index.browser.js.map +1 -1
- package/dist/api/verifications/index.d.ts +134 -140
- package/dist/api/verifications/index.d.ts.map +1 -1
- package/dist/api/verifications/index.js.map +1 -1
- package/dist/background/index.d.ts +95 -0
- package/dist/background/index.d.ts.map +1 -0
- package/dist/background/index.js +121 -0
- package/dist/background/index.js.map +1 -0
- package/dist/background/index.workerd.js +110 -0
- package/dist/background/index.workerd.js.map +1 -0
- package/dist/batch/index.d.ts +5 -7
- package/dist/batch/index.d.ts.map +1 -1
- package/dist/batch/index.js.map +1 -1
- package/dist/bin/index.js.map +1 -1
- package/dist/bucket/index.d.ts +76 -54
- package/dist/bucket/index.d.ts.map +1 -1
- package/dist/bucket/index.js +58 -11
- package/dist/bucket/index.js.map +1 -1
- package/dist/bucket/index.workerd.js +200 -5
- package/dist/bucket/index.workerd.js.map +1 -1
- package/dist/cache/core/index.d.ts +7 -10
- package/dist/cache/core/index.d.ts.map +1 -1
- package/dist/cache/core/index.js.map +1 -1
- package/dist/cache/core/index.workerd.js.map +1 -1
- package/dist/cache/database/index.d.ts +22 -26
- package/dist/cache/database/index.d.ts.map +1 -1
- package/dist/cache/database/index.js.map +1 -1
- package/dist/cache/redis/index.d.ts +4 -7
- package/dist/cache/redis/index.d.ts.map +1 -1
- package/dist/cache/redis/index.js.map +1 -1
- package/dist/captcha/index.d.ts +3 -6
- package/dist/captcha/index.d.ts.map +1 -1
- package/dist/captcha/index.js.map +1 -1
- package/dist/cli/config/index.d.ts.map +1 -1
- package/dist/cli/config/index.js.map +1 -1
- package/dist/cli/core/index.d.ts +417 -214
- package/dist/cli/core/index.d.ts.map +1 -1
- package/dist/cli/core/index.js +325 -563
- package/dist/cli/core/index.js.map +1 -1
- package/dist/cli/devtools/index.d.ts +3 -5
- package/dist/cli/devtools/index.d.ts.map +1 -1
- package/dist/cli/devtools/index.js.map +1 -1
- package/dist/cli/i18n/index.d.ts +8 -12
- package/dist/cli/i18n/index.d.ts.map +1 -1
- package/dist/cli/i18n/index.js.map +1 -1
- package/dist/cli/platform/index.d.ts +126 -1342
- package/dist/cli/platform/index.d.ts.map +1 -1
- package/dist/cli/platform/index.js +136 -2374
- package/dist/cli/platform/index.js.map +1 -1
- package/dist/cli/platform-lib/index.d.ts +1446 -0
- package/dist/cli/platform-lib/index.d.ts.map +1 -0
- package/dist/cli/platform-lib/index.js +2597 -0
- package/dist/cli/platform-lib/index.js.map +1 -0
- package/dist/cli/vendor/index.d.ts +17 -21
- package/dist/cli/vendor/index.d.ts.map +1 -1
- package/dist/cli/vendor/index.js.map +1 -1
- package/dist/command/index.d.ts +21 -20
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +39 -10
- package/dist/command/index.js.map +1 -1
- package/dist/{containers → container}/core/index.d.ts +13 -15
- package/dist/container/core/index.d.ts.map +1 -0
- package/dist/{containers → container}/core/index.js +23 -14
- package/dist/container/core/index.js.map +1 -0
- package/dist/{containers → container}/core/index.workerd.js +37 -22
- package/dist/container/core/index.workerd.js.map +1 -0
- package/dist/core/index.browser.js +27 -1
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +48 -24
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +27 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +27 -1
- package/dist/core/index.native.js.map +1 -1
- package/dist/core/index.workerd.js +27 -1
- package/dist/core/index.workerd.js.map +1 -1
- package/dist/crypto/index.browser.js.map +1 -1
- package/dist/crypto/index.d.ts +5 -8
- package/dist/crypto/index.d.ts.map +1 -1
- package/dist/crypto/index.js.map +1 -1
- package/dist/datetime/index.d.ts +3 -4
- package/dist/datetime/index.d.ts.map +1 -1
- package/dist/datetime/index.js.map +1 -1
- package/dist/email/brevo/index.d.ts +2 -4
- package/dist/email/brevo/index.d.ts.map +1 -1
- package/dist/email/brevo/index.js.map +1 -1
- package/dist/email/cloudflare/index.d.ts +20 -7
- package/dist/email/cloudflare/index.d.ts.map +1 -1
- package/dist/email/cloudflare/index.js +46 -9
- package/dist/email/cloudflare/index.js.map +1 -1
- package/dist/email/core/index.d.ts +6 -9
- package/dist/email/core/index.d.ts.map +1 -1
- package/dist/email/core/index.js.map +1 -1
- package/dist/email/core/index.workerd.js.map +1 -1
- package/dist/email/smtp/index.d.ts +10 -13
- package/dist/email/smtp/index.d.ts.map +1 -1
- package/dist/email/smtp/index.js +107 -32
- package/dist/email/smtp/index.js.map +1 -1
- package/dist/fake/index.d.ts +1 -2
- package/dist/fake/index.d.ts.map +1 -1
- package/dist/fake/index.js.map +1 -1
- package/dist/lock/core/index.d.ts +9 -14
- package/dist/lock/core/index.d.ts.map +1 -1
- package/dist/lock/core/index.js.map +1 -1
- package/dist/lock/redis/index.d.ts +2 -4
- 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 +105 -76
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +196 -174
- package/dist/logger/index.js.map +1 -1
- package/dist/mcp/index.d.ts +16 -20
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/orm/core/index.browser.js.map +1 -1
- package/dist/orm/core/index.bun.js +19 -1
- package/dist/orm/core/index.bun.js.map +1 -1
- package/dist/orm/core/index.d.ts +76 -62
- package/dist/orm/core/index.d.ts.map +1 -1
- package/dist/orm/core/index.js +20 -2
- package/dist/orm/core/index.js.map +1 -1
- package/dist/orm/postgres/index.bun.js.map +1 -1
- package/dist/orm/postgres/index.d.ts +28 -20
- package/dist/orm/postgres/index.d.ts.map +1 -1
- package/dist/orm/postgres/index.js.map +1 -1
- package/dist/queue/core/index.d.ts +12 -15
- package/dist/queue/core/index.d.ts.map +1 -1
- package/dist/queue/core/index.js.map +1 -1
- package/dist/queue/core/index.workerd.js.map +1 -1
- package/dist/queue/redis/index.d.ts +3 -5
- package/dist/queue/redis/index.d.ts.map +1 -1
- package/dist/queue/redis/index.js.map +1 -1
- package/dist/react/auth/index.browser.js +9 -2
- package/dist/react/auth/index.browser.js.map +1 -1
- package/dist/react/auth/index.d.ts +14 -9
- package/dist/react/auth/index.d.ts.map +1 -1
- package/dist/react/auth/index.js +9 -2
- package/dist/react/auth/index.js.map +1 -1
- package/dist/react/core/index.d.ts +7 -8
- package/dist/react/core/index.d.ts.map +1 -1
- package/dist/react/core/index.js +6 -3
- package/dist/react/core/index.js.map +1 -1
- package/dist/react/form/index.d.ts +2 -4
- package/dist/react/form/index.d.ts.map +1 -1
- 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 +2 -4
- 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 -11
- package/dist/react/i18n/index.d.ts.map +1 -1
- package/dist/react/i18n/index.js +33 -1
- package/dist/react/i18n/index.js.map +1 -1
- package/dist/react/intro/index.d.ts +1 -2
- package/dist/react/intro/index.d.ts.map +1 -1
- package/dist/react/intro/index.js +2 -2
- package/dist/react/intro/index.js.map +1 -1
- package/dist/react/router/index.browser.js +65 -19
- package/dist/react/router/index.browser.js.map +1 -1
- package/dist/react/router/index.d.ts +327 -222
- package/dist/react/router/index.d.ts.map +1 -1
- package/dist/react/router/index.js +65 -29
- package/dist/react/router/index.js.map +1 -1
- package/dist/react/testing/index.d.ts +1 -2
- package/dist/react/testing/index.d.ts.map +1 -1
- package/dist/react/testing/index.js +16 -17
- package/dist/react/testing/index.js.map +1 -1
- package/dist/react/ui/index.d.ts +20 -25
- package/dist/react/ui/index.d.ts.map +1 -1
- package/dist/react/ui/index.js.map +1 -1
- package/dist/redis/index.bun.js.map +1 -1
- package/dist/redis/index.d.ts +17 -19
- package/dist/redis/index.d.ts.map +1 -1
- package/dist/redis/index.js.map +1 -1
- package/dist/retry/index.d.ts +2 -4
- 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 +10 -13
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js.map +1 -1
- package/dist/scheduler/index.workerd.js.map +1 -1
- package/dist/security/index.browser.js.map +1 -1
- package/dist/security/index.d.ts +45 -48
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js.map +1 -1
- package/dist/server/auth/index.browser.js.map +1 -1
- package/dist/server/auth/index.d.ts +167 -172
- package/dist/server/auth/index.d.ts.map +1 -1
- package/dist/server/auth/index.js +4 -8
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/cookies/index.browser.js.map +1 -1
- package/dist/server/cookies/index.d.ts +5 -7
- package/dist/server/cookies/index.d.ts.map +1 -1
- package/dist/server/cookies/index.js.map +1 -1
- package/dist/server/core/index.browser.js.map +1 -1
- package/dist/server/core/index.d.ts +88 -73
- package/dist/server/core/index.d.ts.map +1 -1
- package/dist/server/core/index.js +19 -0
- package/dist/server/core/index.js.map +1 -1
- package/dist/server/cors/index.d.ts +11 -14
- package/dist/server/cors/index.d.ts.map +1 -1
- package/dist/server/cors/index.js.map +1 -1
- package/dist/server/etag/index.d.ts +6 -9
- 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 -21
- package/dist/server/health/index.d.ts.map +1 -1
- package/dist/server/health/index.js.map +1 -1
- package/dist/server/links/index.browser.js +2 -0
- package/dist/server/links/index.browser.js.map +1 -1
- package/dist/server/links/index.d.ts +63 -67
- package/dist/server/links/index.d.ts.map +1 -1
- package/dist/server/links/index.js +2 -0
- package/dist/server/links/index.js.map +1 -1
- package/dist/server/metrics/index.d.ts +5 -7
- package/dist/server/metrics/index.d.ts.map +1 -1
- package/dist/server/metrics/index.js.map +1 -1
- package/dist/server/proxy/index.d.ts +3 -5
- 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 +10 -13
- package/dist/server/rate-limit/index.d.ts.map +1 -1
- package/dist/server/rate-limit/index.js.map +1 -1
- package/dist/server/static/index.d.ts +3 -5
- 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 +5 -8
- package/dist/server/swagger/index.d.ts.map +1 -1
- package/dist/server/swagger/index.js.map +1 -1
- package/dist/sms/index.d.ts +3 -5
- 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 +2 -4
- package/dist/system/index.d.ts.map +1 -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 +4 -6
- package/dist/topic/core/index.d.ts.map +1 -1
- package/dist/topic/core/index.js.map +1 -1
- package/dist/topic/redis/index.d.ts +5 -8
- package/dist/topic/redis/index.d.ts.map +1 -1
- package/dist/topic/redis/index.js.map +1 -1
- package/package.json +45 -22
- package/src/api/audits/__tests__/AuditService.spec.ts +18 -110
- package/src/api/audits/controllers/AdminAuditController.ts +14 -0
- package/src/api/audits/services/AuditService.ts +21 -88
- package/src/api/files/__tests__/FileService.spec.ts +207 -2
- package/src/api/files/index.ts +3 -0
- package/src/api/files/schemas/fileCreatorSummarySchema.ts +22 -0
- package/src/api/files/schemas/fileResourceSchema.ts +10 -1
- package/src/api/files/services/FileService.ts +170 -72
- package/src/api/jobs/__tests__/$job.spec.ts +24 -1
- package/src/api/jobs/index.ts +4 -3
- package/src/api/jobs/primitives/$job.ts +7 -3
- package/src/api/jobs/providers/DirectJobDispatcher.ts +17 -36
- package/src/api/jobs/providers/JobProvider.ts +53 -24
- package/src/api/jobs/schemas/jobConfigAtom.ts +1 -1
- package/src/api/jobs/schemas/jobExecutionResourceSchema.ts +4 -1
- package/src/api/keys/schemas/adminApiKeyResourceSchema.ts +3 -1
- package/src/api/parameters/__tests__/$parameter.spec.ts +19 -2
- package/src/api/parameters/audits/ParameterAudits.ts +17 -0
- package/src/api/parameters/controllers/AdminParameterController.ts +95 -19
- package/src/api/parameters/index.ts +3 -0
- package/src/api/parameters/schemas/activateParameterBodySchema.ts +3 -3
- package/src/api/parameters/schemas/createParameterVersionBodySchema.ts +3 -2
- package/src/api/parameters/schemas/parameterCreatorSummarySchema.ts +25 -0
- package/src/api/parameters/schemas/parameterResponseSchema.ts +5 -0
- package/src/api/parameters/schemas/rollbackParameterBodySchema.ts +4 -2
- package/src/api/parameters/services/ParameterProvider.ts +69 -6
- package/src/api/subscriptions/jobs/SubscriptionJobs.ts +1 -1
- package/src/api/users/__tests__/AdminSessionController.spec.ts +37 -0
- package/src/api/users/audits/SessionAudits.ts +33 -0
- package/src/api/users/audits/UserAudits.ts +19 -43
- package/src/api/users/controllers/AdminUserController.ts +66 -1
- package/src/api/users/entities/sessions.ts +6 -0
- package/src/api/users/entities/users.ts +2 -0
- package/src/api/users/index.ts +9 -1
- package/src/api/users/primitives/$realm.ts +3 -0
- package/src/api/users/schemas/sessionResourceSchema.ts +16 -0
- package/src/api/users/schemas/updateUserSchema.ts +1 -8
- package/src/api/users/schemas/userQuerySchema.ts +7 -0
- package/src/api/users/services/CredentialService.ts +15 -6
- package/src/api/users/services/IdentityService.ts +2 -1
- package/src/api/users/services/RegistrationService.ts +2 -1
- package/src/api/users/services/SessionCrudService.ts +19 -2
- package/src/api/users/services/SessionService.ts +39 -19
- package/src/api/users/services/UserService.ts +106 -8
- package/src/background/__tests__/BackgroundTaskProvider.spec.ts +96 -0
- package/src/background/index.ts +37 -0
- package/src/background/index.workerd.ts +28 -0
- package/src/background/providers/BackgroundTaskProvider.ts +70 -0
- package/src/background/providers/WorkerdBackgroundTaskProvider.ts +43 -0
- package/src/bucket/__tests__/$bucket.spec.ts +18 -0
- package/src/bucket/__tests__/LocalFileStorageProvider.spec.ts +5 -0
- package/src/bucket/__tests__/MemoryFileStorageProvider.spec.ts +5 -0
- package/src/bucket/__tests__/NodeS3BucketProvider.spec.ts +23 -4
- package/src/bucket/__tests__/shared.ts +30 -0
- package/src/bucket/index.ts +5 -5
- package/src/bucket/index.workerd.ts +11 -4
- package/src/bucket/primitives/$bucket.ts +27 -0
- package/src/bucket/providers/FileStorageProvider.ts +13 -0
- package/src/bucket/providers/LocalFileStorageProvider.ts +17 -1
- package/src/bucket/providers/MemoryFileStorageProvider.ts +7 -0
- package/src/bucket/providers/{CloudflareR2Provider.ts → R2FileStorageProvider.ts} +10 -1
- package/src/bucket/providers/{NodeS3BucketProvider.ts → S3FileStorageProvider.ts} +27 -5
- package/src/cli/core/__tests__/BuildDockerTask.spec.ts +25 -1
- package/src/cli/core/__tests__/init.spec.ts +0 -219
- package/src/cli/core/commands/__tests__/BuildCommand.spec.ts +43 -0
- package/src/cli/core/commands/build.ts +108 -30
- package/src/cli/core/commands/init.ts +0 -12
- package/src/cli/core/commands/pack.ts +133 -0
- package/src/cli/core/index.ts +3 -0
- package/src/cli/core/providers/ViteDevServerProvider.ts +40 -16
- package/src/cli/core/services/PackageManagerUtils.ts +0 -16
- package/src/cli/core/services/ProjectScaffolder.ts +29 -291
- package/src/cli/core/tasks/BuildCloudflareTask.ts +353 -47
- package/src/cli/core/tasks/BuildDockerTask.ts +33 -3
- package/src/cli/core/tasks/BuildTask.ts +34 -0
- package/src/cli/core/templates/apiIndexTs.ts +1 -22
- package/src/cli/core/templates/mainCss.ts +0 -1
- package/src/cli/core/templates/webAppRouterTs.ts +0 -99
- package/src/cli/core/templates/webIndexTs.ts +1 -22
- package/src/cli/platform/__tests__/SecretsCommand.spec.ts +5 -3
- package/src/cli/platform/commands/SecretsCommand.ts +8 -6
- package/src/cli/platform/commands/platform.ts +192 -46
- package/src/cli/platform/index.ts +12 -52
- package/src/cli/{platform → platform-lib}/__tests__/CloudflareAdapter.spec.ts +426 -169
- package/src/cli/{platform → platform-lib}/__tests__/NamingService.spec.ts +91 -4
- package/src/cli/{platform → platform-lib}/__tests__/VercelAdapter.spec.ts +56 -85
- package/src/cli/{platform → platform-lib}/adapters/CloudflareAdapter.ts +402 -165
- package/src/cli/{platform → platform-lib}/adapters/PlatformAdapter.ts +62 -35
- package/src/cli/{platform → platform-lib}/adapters/VercelAdapter.ts +6 -10
- package/src/cli/{platform → platform-lib}/atoms/platformOptions.ts +34 -1
- package/src/cli/platform-lib/index.ts +67 -0
- package/src/cli/platform-lib/services/NamingService.ts +136 -0
- package/src/cli/{platform → platform-lib}/services/PlatformInspector.ts +60 -13
- package/src/cli/{platform → platform-lib}/services/PlatformOrchestrator.ts +54 -43
- package/src/cli/{platform → platform-lib}/services/WranglerApi.ts +4 -2
- package/src/command/__tests__/Runner.spec.ts +20 -0
- package/src/command/helpers/EnvUtils.ts +19 -3
- package/src/command/helpers/Runner.ts +12 -2
- package/src/command/providers/CliProvider.ts +34 -1
- package/src/{containers → container}/core/__tests__/$container.spec.ts +5 -5
- package/src/{containers → container}/core/index.ts +4 -4
- package/src/{containers → container}/core/index.workerd.ts +19 -3
- package/src/{containers → container}/core/primitives/$container.ts +1 -1
- package/src/{containers → container}/core/providers/CloudflareContainerProvider.ts +17 -19
- package/src/{containers → container}/core/providers/ContainerProvider.ts +16 -2
- package/src/{containers → container}/core/providers/MockContainerProvider.ts +1 -1
- package/src/core/Alepha.ts +49 -1
- package/src/core/__tests__/$env.spec.ts +42 -0
- package/src/core/__tests__/dump.spec.ts +47 -0
- package/src/email/cloudflare/__tests__/CloudflareEmailProvider.spec.ts +42 -10
- package/src/email/cloudflare/index.ts +14 -5
- package/src/email/cloudflare/providers/CloudflareEmailProvider.ts +54 -9
- package/src/logger/__tests__/Logger.spec.ts +55 -0
- package/src/logger/index.ts +13 -0
- package/src/logger/services/Logger.ts +31 -1
- package/src/orm/__tests__/orm-showcase-tests.ts +27 -0
- package/src/orm/__tests__/orm-showcase.spec.ts +12 -0
- package/src/orm/core/interfaces/PgQuery.ts +4 -1
- package/src/orm/core/services/Repository.ts +27 -11
- package/src/react/auth/hooks/useAuth.ts +10 -5
- package/src/react/core/__tests__/useQuery.browser.spec.tsx +25 -0
- package/src/react/core/hooks/useAction.ts +14 -3
- package/src/react/core/hooks/useQuery.ts +24 -4
- package/src/react/i18n/components/Translate.tsx +47 -0
- package/src/react/i18n/index.ts +2 -0
- package/src/react/intro/components/GettingStartedAdminSlide.tsx +2 -2
- package/src/react/router/__tests__/$page.spec.tsx +3 -2
- package/src/react/router/__tests__/page-can.spec.ts +18 -13
- package/src/react/router/hooks/useQueryParams.ts +114 -14
- package/src/react/router/primitives/$page.ts +85 -4
- package/src/react/router/providers/ReactBrowserRouterProvider.ts +3 -7
- package/src/react/router/providers/ReactServerProvider.ts +4 -13
- package/src/react/ui/services/SchemaControl.ts +3 -4
- package/src/server/core/providers/ServerMultipartProvider.ts +19 -0
- package/src/server/links/providers/LinkProvider.ts +10 -0
- package/dist/containers/core/index.d.ts.map +0 -1
- package/dist/containers/core/index.js.map +0 -1
- package/dist/containers/core/index.workerd.js.map +0 -1
- package/src/cli/core/templates/componentsJsonTs.ts +0 -39
- package/src/cli/core/templates/saasAdminLayoutTsx.ts +0 -77
- package/src/cli/core/templates/saasAdminPagesTsx.ts +0 -26
- package/src/cli/core/templates/saasAuthLayoutTsx.ts +0 -22
- package/src/cli/core/templates/saasAuthPagesTsx.ts +0 -62
- package/src/cli/core/templates/saasRealmProviderTs.ts +0 -52
- package/src/cli/platform/services/NamingService.ts +0 -54
- /package/dist/orm/core/{chunk-o8xxKEmq.js → chunk-B4FMCO8f.js} +0 -0
- /package/dist/react/testing/{chunk-6Ep1yQYe.js → chunk-BpyX8vjI.js} +0 -0
- /package/src/cli/{platform → platform-lib}/__tests__/GitHubSecretStore.spec.ts +0 -0
- /package/src/cli/{platform → platform-lib}/__tests__/PlatformCacheProvider.spec.ts +0 -0
- /package/src/cli/{platform → platform-lib}/__tests__/PlatformInspector.spec.ts +0 -0
- /package/src/cli/{platform → platform-lib}/__tests__/PlatformOrchestrator.spec.ts +0 -0
- /package/src/cli/{platform → platform-lib}/__tests__/SecretFilterService.spec.ts +0 -0
- /package/src/cli/{platform → platform-lib}/__tests__/detectResources.spec.ts +0 -0
- /package/src/cli/{platform → platform-lib}/providers/GitHubSecretStore.ts +0 -0
- /package/src/cli/{platform → platform-lib}/providers/MemorySecretStore.ts +0 -0
- /package/src/cli/{platform → platform-lib}/providers/PlatformCacheProvider.ts +0 -0
- /package/src/cli/{platform → platform-lib}/providers/SecretStoreProvider.ts +0 -0
- /package/src/cli/{platform → platform-lib}/schemas/cloudflare.ts +0 -0
- /package/src/cli/{platform → platform-lib}/schemas/platform.ts +0 -0
- /package/src/cli/{platform → platform-lib}/schemas/vercel.ts +0 -0
- /package/src/cli/{platform → platform-lib}/services/CloudflareApi.ts +0 -0
- /package/src/cli/{platform → platform-lib}/services/SecretFilterService.ts +0 -0
- /package/src/cli/{platform → platform-lib}/services/VercelApi.ts +0 -0
- /package/src/cli/{platform → platform-lib}/services/VercelCli.ts +0 -0
- /package/src/{containers → container}/core/interfaces/ContainerOptions.ts +0 -0
- /package/src/{containers → container}/core/providers/NodeContainerProvider.ts +0 -0
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
import { describe, test } from "vitest";
|
|
10
10
|
import { CloudflareAdapter } from "../adapters/CloudflareAdapter.ts";
|
|
11
11
|
import type { PlatformContext } from "../adapters/PlatformAdapter.ts";
|
|
12
|
+
import { platformOptions } from "../atoms/platformOptions.ts";
|
|
12
13
|
import { CloudflareApi } from "../services/CloudflareApi.ts";
|
|
13
14
|
import { NamingService } from "../services/NamingService.ts";
|
|
14
15
|
|
|
@@ -203,7 +204,14 @@ describe("CloudflareAdapter", () => {
|
|
|
203
204
|
project: "acme-portal",
|
|
204
205
|
env: "production",
|
|
205
206
|
envConfig: { adapter: "cloudflare" },
|
|
206
|
-
|
|
207
|
+
entry: { root: "/project", server: "src/main.ts" },
|
|
208
|
+
resources: {
|
|
209
|
+
hasDatabase: false,
|
|
210
|
+
hasBucket: false,
|
|
211
|
+
hasKV: false,
|
|
212
|
+
hasQueue: false,
|
|
213
|
+
hasCron: false,
|
|
214
|
+
},
|
|
207
215
|
root: "/project",
|
|
208
216
|
naming: naming.forContext("acme-portal", "production"),
|
|
209
217
|
...overrides,
|
|
@@ -270,20 +278,14 @@ describe("CloudflareAdapter", () => {
|
|
|
270
278
|
}) => {
|
|
271
279
|
const { adapter, naming, api } = createTestEnv();
|
|
272
280
|
const ctx = makeCtx(naming, {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
hasKV: false,
|
|
282
|
-
hasQueue: false,
|
|
283
|
-
hasCron: false,
|
|
284
|
-
},
|
|
285
|
-
},
|
|
286
|
-
],
|
|
281
|
+
entry: { root: "/project", server: "src/main.ts" },
|
|
282
|
+
resources: {
|
|
283
|
+
hasDatabase: true,
|
|
284
|
+
hasBucket: false,
|
|
285
|
+
hasKV: false,
|
|
286
|
+
hasQueue: false,
|
|
287
|
+
hasCron: false,
|
|
288
|
+
},
|
|
287
289
|
});
|
|
288
290
|
|
|
289
291
|
const run = createMockRun();
|
|
@@ -298,20 +300,14 @@ describe("CloudflareAdapter", () => {
|
|
|
298
300
|
}) => {
|
|
299
301
|
const { adapter, naming, api } = createTestEnv();
|
|
300
302
|
const ctx = makeCtx(naming, {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
hasKV: false,
|
|
310
|
-
hasQueue: false,
|
|
311
|
-
hasCron: false,
|
|
312
|
-
},
|
|
313
|
-
},
|
|
314
|
-
],
|
|
303
|
+
entry: { root: "/project", server: "src/main.ts" },
|
|
304
|
+
resources: {
|
|
305
|
+
hasDatabase: true,
|
|
306
|
+
hasBucket: false,
|
|
307
|
+
hasKV: false,
|
|
308
|
+
hasQueue: false,
|
|
309
|
+
hasCron: false,
|
|
310
|
+
},
|
|
315
311
|
});
|
|
316
312
|
|
|
317
313
|
// Pre-seed existing database
|
|
@@ -333,20 +329,14 @@ describe("CloudflareAdapter", () => {
|
|
|
333
329
|
}) => {
|
|
334
330
|
const { adapter, naming, api } = createTestEnv();
|
|
335
331
|
const ctx = makeCtx(naming, {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
hasKV: false,
|
|
345
|
-
hasQueue: false,
|
|
346
|
-
hasCron: false,
|
|
347
|
-
},
|
|
348
|
-
},
|
|
349
|
-
],
|
|
332
|
+
entry: { root: "/project", server: "src/main.ts" },
|
|
333
|
+
resources: {
|
|
334
|
+
hasDatabase: false,
|
|
335
|
+
hasBucket: true,
|
|
336
|
+
hasKV: false,
|
|
337
|
+
hasQueue: false,
|
|
338
|
+
hasCron: false,
|
|
339
|
+
},
|
|
350
340
|
});
|
|
351
341
|
|
|
352
342
|
const run = createMockRun();
|
|
@@ -361,20 +351,14 @@ describe("CloudflareAdapter", () => {
|
|
|
361
351
|
}) => {
|
|
362
352
|
const { adapter, naming, api } = createTestEnv();
|
|
363
353
|
const ctx = makeCtx(naming, {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
hasKV: true,
|
|
373
|
-
hasQueue: false,
|
|
374
|
-
hasCron: false,
|
|
375
|
-
},
|
|
376
|
-
},
|
|
377
|
-
],
|
|
354
|
+
entry: { root: "/project", server: "src/main.ts" },
|
|
355
|
+
resources: {
|
|
356
|
+
hasDatabase: false,
|
|
357
|
+
hasBucket: false,
|
|
358
|
+
hasKV: true,
|
|
359
|
+
hasQueue: false,
|
|
360
|
+
hasCron: false,
|
|
361
|
+
},
|
|
378
362
|
});
|
|
379
363
|
|
|
380
364
|
const run = createMockRun();
|
|
@@ -389,20 +373,14 @@ describe("CloudflareAdapter", () => {
|
|
|
389
373
|
}) => {
|
|
390
374
|
const { adapter, naming, api } = createTestEnv();
|
|
391
375
|
const ctx = makeCtx(naming, {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
hasKV: false,
|
|
401
|
-
hasQueue: true,
|
|
402
|
-
hasCron: false,
|
|
403
|
-
},
|
|
404
|
-
},
|
|
405
|
-
],
|
|
376
|
+
entry: { root: "/project", server: "src/main.ts" },
|
|
377
|
+
resources: {
|
|
378
|
+
hasDatabase: false,
|
|
379
|
+
hasBucket: false,
|
|
380
|
+
hasKV: false,
|
|
381
|
+
hasQueue: true,
|
|
382
|
+
hasCron: false,
|
|
383
|
+
},
|
|
406
384
|
});
|
|
407
385
|
|
|
408
386
|
const run = createMockRun();
|
|
@@ -419,20 +397,14 @@ describe("CloudflareAdapter", () => {
|
|
|
419
397
|
}) => {
|
|
420
398
|
const { adapter, fs, naming, api } = createTestEnv();
|
|
421
399
|
const ctx = makeCtx(naming, {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
hasKV: false,
|
|
431
|
-
hasQueue: false,
|
|
432
|
-
hasCron: false,
|
|
433
|
-
},
|
|
434
|
-
},
|
|
435
|
-
],
|
|
400
|
+
entry: { root: "/project", server: "src/main.ts" },
|
|
401
|
+
resources: {
|
|
402
|
+
hasDatabase: false,
|
|
403
|
+
hasBucket: false,
|
|
404
|
+
hasKV: false,
|
|
405
|
+
hasQueue: false,
|
|
406
|
+
hasCron: false,
|
|
407
|
+
},
|
|
436
408
|
});
|
|
437
409
|
|
|
438
410
|
await fs.writeFile(
|
|
@@ -457,23 +429,293 @@ describe("CloudflareAdapter", () => {
|
|
|
457
429
|
expect(names).toEqual(["APP_SECRET", "GOOGLE_API_KEY"]);
|
|
458
430
|
});
|
|
459
431
|
|
|
432
|
+
test("with platform.secrets.keys, resolves the allowlist from process.env (no .env file) and ignores ambient vars", async ({
|
|
433
|
+
expect,
|
|
434
|
+
}) => {
|
|
435
|
+
const { adapter, alepha, naming, api } = createTestEnv();
|
|
436
|
+
// Declare an explicit allowlist — the CI shape: secrets arrive via the
|
|
437
|
+
// job environment, there is no .env.production on the runner.
|
|
438
|
+
alepha.set(platformOptions, {
|
|
439
|
+
secrets: { keys: ["APP_SECRET", "GOOGLE_CLIENT_ID", "EMAIL_FROM"] },
|
|
440
|
+
environments: { production: { adapter: "cloudflare" } },
|
|
441
|
+
} as any);
|
|
442
|
+
|
|
443
|
+
const ctx = makeCtx(naming, {
|
|
444
|
+
entry: { root: "/project", server: "src/main.ts" },
|
|
445
|
+
resources: {
|
|
446
|
+
hasDatabase: false,
|
|
447
|
+
hasBucket: false,
|
|
448
|
+
hasKV: false,
|
|
449
|
+
hasQueue: false,
|
|
450
|
+
hasCron: false,
|
|
451
|
+
},
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
process.env.APP_SECRET = "from-env-secret";
|
|
455
|
+
process.env.GOOGLE_CLIENT_ID = "from-env-google";
|
|
456
|
+
// EMAIL_FROM intentionally unset → declared but unresolved, not pushed.
|
|
457
|
+
// PATH-style ambient var that must never leak into worker secrets.
|
|
458
|
+
process.env.AMBIENT_RUNNER_VAR = "leak-me-not";
|
|
459
|
+
try {
|
|
460
|
+
const run = createMockRun();
|
|
461
|
+
await adapter.secrets(ctx, run);
|
|
462
|
+
} finally {
|
|
463
|
+
delete process.env.APP_SECRET;
|
|
464
|
+
delete process.env.GOOGLE_CLIENT_ID;
|
|
465
|
+
delete process.env.AMBIENT_RUNNER_VAR;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
const pushed = api.secrets.get("acme-portal-production") ?? [];
|
|
469
|
+
const names = pushed.map((s) => s.name).sort();
|
|
470
|
+
expect(names).toEqual(["APP_SECRET", "GOOGLE_CLIENT_ID"]);
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
test("with platform.secrets.keys, the .env file overrides process.env per key", async ({
|
|
474
|
+
expect,
|
|
475
|
+
}) => {
|
|
476
|
+
const { adapter, alepha, fs, naming, api } = createTestEnv();
|
|
477
|
+
alepha.set(platformOptions, {
|
|
478
|
+
secrets: { keys: ["APP_SECRET", "GOOGLE_CLIENT_ID"] },
|
|
479
|
+
environments: { production: { adapter: "cloudflare" } },
|
|
480
|
+
} as any);
|
|
481
|
+
|
|
482
|
+
const ctx = makeCtx(naming, {
|
|
483
|
+
entry: { root: "/project", server: "src/main.ts" },
|
|
484
|
+
resources: {
|
|
485
|
+
hasDatabase: false,
|
|
486
|
+
hasBucket: false,
|
|
487
|
+
hasKV: false,
|
|
488
|
+
hasQueue: false,
|
|
489
|
+
hasCron: false,
|
|
490
|
+
},
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
// APP_SECRET in the file → file wins. GOOGLE_CLIENT_ID only in env → env.
|
|
494
|
+
await fs.writeFile(
|
|
495
|
+
"/project/.env.production",
|
|
496
|
+
["APP_SECRET=from-file", ""].join("\n"),
|
|
497
|
+
);
|
|
498
|
+
process.env.APP_SECRET = "from-env";
|
|
499
|
+
process.env.GOOGLE_CLIENT_ID = "env-google";
|
|
500
|
+
try {
|
|
501
|
+
const run = createMockRun();
|
|
502
|
+
await adapter.secrets(ctx, run);
|
|
503
|
+
} finally {
|
|
504
|
+
delete process.env.APP_SECRET;
|
|
505
|
+
delete process.env.GOOGLE_CLIENT_ID;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
// Secret *values* land in the full binding set (api.bindings); the
|
|
509
|
+
// api.secrets projection only keeps names.
|
|
510
|
+
const bindings = api.bindings.get("acme-portal-production") ?? [];
|
|
511
|
+
const byName = Object.fromEntries(
|
|
512
|
+
bindings
|
|
513
|
+
.filter((b) => b.type === "secret_text")
|
|
514
|
+
.map((b) => [b.name, b.text]),
|
|
515
|
+
);
|
|
516
|
+
expect(byName.APP_SECRET).toBe("from-file");
|
|
517
|
+
expect(byName.GOOGLE_CLIENT_ID).toBe("env-google");
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
test("uses dist/manifest.json `env` as the default allowlist, resolved from process.env", async ({
|
|
521
|
+
expect,
|
|
522
|
+
}) => {
|
|
523
|
+
const { adapter, fs, naming, api } = createTestEnv();
|
|
524
|
+
// No platform.secrets.keys and no .env file → the manifest's declared
|
|
525
|
+
// env list is the allowlist. This is the CI shape.
|
|
526
|
+
const ctx = makeCtx(naming, {
|
|
527
|
+
entry: { root: "/project", server: "src/main.ts" },
|
|
528
|
+
resources: {
|
|
529
|
+
hasDatabase: false,
|
|
530
|
+
hasBucket: false,
|
|
531
|
+
hasKV: false,
|
|
532
|
+
hasQueue: false,
|
|
533
|
+
hasCron: false,
|
|
534
|
+
},
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
await fs.writeFile(
|
|
538
|
+
"/project/dist/manifest.json",
|
|
539
|
+
JSON.stringify({
|
|
540
|
+
env: [
|
|
541
|
+
"APP_SECRET",
|
|
542
|
+
"GOOGLE_CLIENT_ID",
|
|
543
|
+
"CLOUDFLARE_ZONE",
|
|
544
|
+
"LOG_LEVEL",
|
|
545
|
+
],
|
|
546
|
+
}),
|
|
547
|
+
);
|
|
548
|
+
|
|
549
|
+
process.env.APP_SECRET = "s1";
|
|
550
|
+
process.env.GOOGLE_CLIENT_ID = "g1";
|
|
551
|
+
process.env.CLOUDFLARE_ZONE = "example.com"; // declared but EXCLUDED
|
|
552
|
+
// LOG_LEVEL is declared + ambient in the runner, but EXCLUDED (infra knob).
|
|
553
|
+
try {
|
|
554
|
+
const run = createMockRun();
|
|
555
|
+
await adapter.secrets(ctx, run);
|
|
556
|
+
} finally {
|
|
557
|
+
delete process.env.APP_SECRET;
|
|
558
|
+
delete process.env.GOOGLE_CLIENT_ID;
|
|
559
|
+
delete process.env.CLOUDFLARE_ZONE;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
const pushed = api.secrets.get("acme-portal-production") ?? [];
|
|
563
|
+
expect(pushed.map((s) => s.name).sort()).toEqual([
|
|
564
|
+
"APP_SECRET",
|
|
565
|
+
"GOOGLE_CLIENT_ID",
|
|
566
|
+
]);
|
|
567
|
+
});
|
|
568
|
+
|
|
569
|
+
test("pushes per-deploy keys from .env.<env>.local even when not in the manifest", async ({
|
|
570
|
+
expect,
|
|
571
|
+
}) => {
|
|
572
|
+
const { adapter, fs, naming, api } = createTestEnv();
|
|
573
|
+
const ctx = makeCtx(naming, {
|
|
574
|
+
entry: { root: "/project", server: "src/main.ts" },
|
|
575
|
+
resources: {
|
|
576
|
+
hasDatabase: false,
|
|
577
|
+
hasBucket: false,
|
|
578
|
+
hasKV: false,
|
|
579
|
+
hasQueue: false,
|
|
580
|
+
hasCron: false,
|
|
581
|
+
},
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
// Manifest declares only APP_SECRET…
|
|
585
|
+
await fs.writeFile(
|
|
586
|
+
"/project/dist/manifest.json",
|
|
587
|
+
JSON.stringify({ env: ["APP_SECRET"] }),
|
|
588
|
+
);
|
|
589
|
+
// …but an orchestrator (Rocket) injected CLUB_CONFIG_JSON into the
|
|
590
|
+
// per-deploy override file. It must still be pushed.
|
|
591
|
+
await fs.writeFile(
|
|
592
|
+
"/project/.env.production.local",
|
|
593
|
+
["APP_SECRET=s1", 'CLUB_CONFIG_JSON={"id":"b14"}', ""].join("\n"),
|
|
594
|
+
);
|
|
595
|
+
|
|
596
|
+
const run = createMockRun();
|
|
597
|
+
await adapter.secrets(ctx, run);
|
|
598
|
+
|
|
599
|
+
const pushed = api.secrets.get("acme-portal-production") ?? [];
|
|
600
|
+
expect(pushed.map((s) => s.name).sort()).toEqual([
|
|
601
|
+
"APP_SECRET",
|
|
602
|
+
"CLUB_CONFIG_JSON",
|
|
603
|
+
]);
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
test("platform.secrets.keys overrides the manifest `env` allowlist", async ({
|
|
607
|
+
expect,
|
|
608
|
+
}) => {
|
|
609
|
+
const { adapter, alepha, fs, naming, api } = createTestEnv();
|
|
610
|
+
alepha.set(platformOptions, {
|
|
611
|
+
secrets: { keys: ["APP_SECRET"] }, // narrow override
|
|
612
|
+
environments: { production: { adapter: "cloudflare" } },
|
|
613
|
+
} as any);
|
|
614
|
+
|
|
615
|
+
const ctx = makeCtx(naming, {
|
|
616
|
+
entry: { root: "/project", server: "src/main.ts" },
|
|
617
|
+
resources: {
|
|
618
|
+
hasDatabase: false,
|
|
619
|
+
hasBucket: false,
|
|
620
|
+
hasKV: false,
|
|
621
|
+
hasQueue: false,
|
|
622
|
+
hasCron: false,
|
|
623
|
+
},
|
|
624
|
+
});
|
|
625
|
+
|
|
626
|
+
// Manifest lists more keys, but the explicit override wins.
|
|
627
|
+
await fs.writeFile(
|
|
628
|
+
"/project/dist/manifest.json",
|
|
629
|
+
JSON.stringify({ env: ["APP_SECRET", "GOOGLE_CLIENT_ID"] }),
|
|
630
|
+
);
|
|
631
|
+
|
|
632
|
+
process.env.APP_SECRET = "s1";
|
|
633
|
+
process.env.GOOGLE_CLIENT_ID = "g1";
|
|
634
|
+
try {
|
|
635
|
+
const run = createMockRun();
|
|
636
|
+
await adapter.secrets(ctx, run);
|
|
637
|
+
} finally {
|
|
638
|
+
delete process.env.APP_SECRET;
|
|
639
|
+
delete process.env.GOOGLE_CLIENT_ID;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
const pushed = api.secrets.get("acme-portal-production") ?? [];
|
|
643
|
+
expect(pushed.map((s) => s.name)).toEqual(["APP_SECRET"]);
|
|
644
|
+
});
|
|
645
|
+
|
|
646
|
+
test("auto-derives PUBLIC_URL from the configured domain", async ({
|
|
647
|
+
expect,
|
|
648
|
+
}) => {
|
|
649
|
+
const { adapter, fs, naming, api } = createTestEnv();
|
|
650
|
+
const ctx = makeCtx(naming, {
|
|
651
|
+
envConfig: { adapter: "cloudflare", domain: "lore.alepha.dev" },
|
|
652
|
+
});
|
|
653
|
+
|
|
654
|
+
await fs.writeFile(
|
|
655
|
+
"/project/.env.production",
|
|
656
|
+
["APP_SECRET=my-secret", ""].join("\n"),
|
|
657
|
+
);
|
|
658
|
+
|
|
659
|
+
const run = createMockRun();
|
|
660
|
+
await adapter.secrets(ctx, run);
|
|
661
|
+
|
|
662
|
+
const bindings = api.bindings.get("acme-portal-production") ?? [];
|
|
663
|
+
const publicUrl = bindings.find((b) => b.name === "PUBLIC_URL");
|
|
664
|
+
expect(publicUrl?.text).toBe("https://lore.alepha.dev");
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
test("derives PUBLIC_URL for a tenant subdomain", async ({ expect }) => {
|
|
668
|
+
const { adapter, fs, naming, api } = createTestEnv();
|
|
669
|
+
const ctx = makeCtx(naming, {
|
|
670
|
+
envConfig: { adapter: "cloudflare", domain: "alepha.dev" },
|
|
671
|
+
tenant: "acme",
|
|
672
|
+
});
|
|
673
|
+
|
|
674
|
+
await fs.writeFile(
|
|
675
|
+
"/project/.env.production",
|
|
676
|
+
["APP_SECRET=my-secret", ""].join("\n"),
|
|
677
|
+
);
|
|
678
|
+
|
|
679
|
+
const run = createMockRun();
|
|
680
|
+
await adapter.secrets(ctx, run);
|
|
681
|
+
|
|
682
|
+
const bindings = api.bindings.get("acme-portal-production") ?? [];
|
|
683
|
+
const publicUrl = bindings.find((b) => b.name === "PUBLIC_URL");
|
|
684
|
+
expect(publicUrl?.text).toBe("https://acme.alepha.dev");
|
|
685
|
+
});
|
|
686
|
+
|
|
687
|
+
test("honors an explicit PUBLIC_URL over the derived one", async ({
|
|
688
|
+
expect,
|
|
689
|
+
}) => {
|
|
690
|
+
const { adapter, fs, naming, api } = createTestEnv();
|
|
691
|
+
const ctx = makeCtx(naming, {
|
|
692
|
+
envConfig: { adapter: "cloudflare", domain: "lore.alepha.dev" },
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
await fs.writeFile(
|
|
696
|
+
"/project/.env.production",
|
|
697
|
+
["PUBLIC_URL=https://custom.example.com", ""].join("\n"),
|
|
698
|
+
);
|
|
699
|
+
|
|
700
|
+
const run = createMockRun();
|
|
701
|
+
await adapter.secrets(ctx, run);
|
|
702
|
+
|
|
703
|
+
const bindings = api.bindings.get("acme-portal-production") ?? [];
|
|
704
|
+
const publicUrl = bindings.find((b) => b.name === "PUBLIC_URL");
|
|
705
|
+
expect(publicUrl?.text).toBe("https://custom.example.com");
|
|
706
|
+
});
|
|
707
|
+
|
|
460
708
|
test("skips when no env file exists", async ({ expect }) => {
|
|
461
709
|
const { adapter, naming, api } = createTestEnv();
|
|
462
710
|
const ctx = makeCtx(naming, {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
hasKV: false,
|
|
472
|
-
hasQueue: false,
|
|
473
|
-
hasCron: false,
|
|
474
|
-
},
|
|
475
|
-
},
|
|
476
|
-
],
|
|
711
|
+
entry: { root: "/project", server: "src/main.ts" },
|
|
712
|
+
resources: {
|
|
713
|
+
hasDatabase: false,
|
|
714
|
+
hasBucket: false,
|
|
715
|
+
hasKV: false,
|
|
716
|
+
hasQueue: false,
|
|
717
|
+
hasCron: false,
|
|
718
|
+
},
|
|
477
719
|
});
|
|
478
720
|
|
|
479
721
|
const run = createMockRun();
|
|
@@ -485,20 +727,14 @@ describe("CloudflareAdapter", () => {
|
|
|
485
727
|
test("skips comments and empty lines", async ({ expect }) => {
|
|
486
728
|
const { adapter, fs, naming, api } = createTestEnv();
|
|
487
729
|
const ctx = makeCtx(naming, {
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
hasKV: false,
|
|
497
|
-
hasQueue: false,
|
|
498
|
-
hasCron: false,
|
|
499
|
-
},
|
|
500
|
-
},
|
|
501
|
-
],
|
|
730
|
+
entry: { root: "/project", server: "src/main.ts" },
|
|
731
|
+
resources: {
|
|
732
|
+
hasDatabase: false,
|
|
733
|
+
hasBucket: false,
|
|
734
|
+
hasKV: false,
|
|
735
|
+
hasQueue: false,
|
|
736
|
+
hasCron: false,
|
|
737
|
+
},
|
|
502
738
|
});
|
|
503
739
|
|
|
504
740
|
await fs.writeFile(
|
|
@@ -518,20 +754,14 @@ describe("CloudflareAdapter", () => {
|
|
|
518
754
|
}) => {
|
|
519
755
|
const { adapter, fs, naming, api } = createTestEnv();
|
|
520
756
|
const ctx = makeCtx(naming, {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
hasKV: false,
|
|
530
|
-
hasQueue: false,
|
|
531
|
-
hasCron: false,
|
|
532
|
-
},
|
|
533
|
-
},
|
|
534
|
-
],
|
|
757
|
+
entry: { root: "/project", server: "src/main.ts" },
|
|
758
|
+
resources: {
|
|
759
|
+
hasDatabase: false,
|
|
760
|
+
hasBucket: false,
|
|
761
|
+
hasKV: false,
|
|
762
|
+
hasQueue: false,
|
|
763
|
+
hasCron: false,
|
|
764
|
+
},
|
|
535
765
|
});
|
|
536
766
|
|
|
537
767
|
await fs.writeFile(
|
|
@@ -570,20 +800,14 @@ describe("CloudflareAdapter", () => {
|
|
|
570
800
|
test("PATCHes when secrets changed (hash mismatch)", async ({ expect }) => {
|
|
571
801
|
const { adapter, fs, naming, api } = createTestEnv();
|
|
572
802
|
const ctx = makeCtx(naming, {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
hasKV: false,
|
|
582
|
-
hasQueue: false,
|
|
583
|
-
hasCron: false,
|
|
584
|
-
},
|
|
585
|
-
},
|
|
586
|
-
],
|
|
803
|
+
entry: { root: "/project", server: "src/main.ts" },
|
|
804
|
+
resources: {
|
|
805
|
+
hasDatabase: false,
|
|
806
|
+
hasBucket: false,
|
|
807
|
+
hasKV: false,
|
|
808
|
+
hasQueue: false,
|
|
809
|
+
hasCron: false,
|
|
810
|
+
},
|
|
587
811
|
});
|
|
588
812
|
|
|
589
813
|
await fs.writeFile("/project/.env.production", "APP_SECRET=v1");
|
|
@@ -614,20 +838,14 @@ describe("CloudflareAdapter", () => {
|
|
|
614
838
|
}) => {
|
|
615
839
|
const { adapter, naming, api } = createTestEnv();
|
|
616
840
|
const ctx = makeCtx(naming, {
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
hasKV: false,
|
|
626
|
-
hasQueue: false,
|
|
627
|
-
hasCron: false,
|
|
628
|
-
},
|
|
629
|
-
},
|
|
630
|
-
],
|
|
841
|
+
entry: { root: "/project", server: "src/main.ts" },
|
|
842
|
+
resources: {
|
|
843
|
+
hasDatabase: true,
|
|
844
|
+
hasBucket: true,
|
|
845
|
+
hasKV: false,
|
|
846
|
+
hasQueue: false,
|
|
847
|
+
hasCron: false,
|
|
848
|
+
},
|
|
631
849
|
});
|
|
632
850
|
|
|
633
851
|
// Pre-seed existing resources
|
|
@@ -664,20 +882,14 @@ describe("CloudflareAdapter", () => {
|
|
|
664
882
|
test("deletes resources via REST API", async ({ expect }) => {
|
|
665
883
|
const { adapter, naming, api } = createTestEnv();
|
|
666
884
|
const ctx = makeCtx(naming, {
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
hasKV: true,
|
|
676
|
-
hasQueue: false,
|
|
677
|
-
hasCron: false,
|
|
678
|
-
},
|
|
679
|
-
},
|
|
680
|
-
],
|
|
885
|
+
entry: { root: "/project", server: "src/main.ts" },
|
|
886
|
+
resources: {
|
|
887
|
+
hasDatabase: true,
|
|
888
|
+
hasBucket: true,
|
|
889
|
+
hasKV: true,
|
|
890
|
+
hasQueue: false,
|
|
891
|
+
hasCron: false,
|
|
892
|
+
},
|
|
681
893
|
});
|
|
682
894
|
|
|
683
895
|
// Pre-seed existing resources
|
|
@@ -702,6 +914,51 @@ describe("CloudflareAdapter", () => {
|
|
|
702
914
|
expect(api.kvNamespaces).toHaveLength(0);
|
|
703
915
|
});
|
|
704
916
|
});
|
|
917
|
+
|
|
918
|
+
describe("exportDb", () => {
|
|
919
|
+
test("dumps remote D1 and imports it into a local SQLite snapshot", async ({
|
|
920
|
+
expect,
|
|
921
|
+
}) => {
|
|
922
|
+
const { adapter, naming } = createTestEnv();
|
|
923
|
+
const ctx = makeCtx(naming, {
|
|
924
|
+
resources: {
|
|
925
|
+
hasDatabase: true,
|
|
926
|
+
hasBucket: false,
|
|
927
|
+
hasKV: false,
|
|
928
|
+
hasQueue: false,
|
|
929
|
+
hasCron: false,
|
|
930
|
+
},
|
|
931
|
+
});
|
|
932
|
+
|
|
933
|
+
// Record the raw shell strings exportDb issues via run().
|
|
934
|
+
const commands: string[] = [];
|
|
935
|
+
const run: any = async (cmd: any) => {
|
|
936
|
+
if (typeof cmd === "string") commands.push(cmd);
|
|
937
|
+
};
|
|
938
|
+
run.pause = () => {};
|
|
939
|
+
run.resume = () => {};
|
|
940
|
+
run.end = () => {};
|
|
941
|
+
|
|
942
|
+
await adapter.exportDb(ctx, run, {
|
|
943
|
+
output: "/tmp/snap.db",
|
|
944
|
+
keepSql: true,
|
|
945
|
+
});
|
|
946
|
+
|
|
947
|
+
expect(
|
|
948
|
+
commands.some((c) => /^wrangler d1 export .+ --remote /.test(c)),
|
|
949
|
+
).toBe(true);
|
|
950
|
+
expect(commands.some((c) => /sqlite3 '\/tmp\/snap\.db' < /.test(c))).toBe(
|
|
951
|
+
true,
|
|
952
|
+
);
|
|
953
|
+
});
|
|
954
|
+
|
|
955
|
+
test("refuses when no database is detected", async ({ expect }) => {
|
|
956
|
+
const { adapter, naming } = createTestEnv();
|
|
957
|
+
const ctx = makeCtx(naming); // resources.hasDatabase defaults to false
|
|
958
|
+
const run = createMockRun();
|
|
959
|
+
await expect(adapter.exportDb(ctx, run)).rejects.toThrow(/no database/i);
|
|
960
|
+
});
|
|
961
|
+
});
|
|
705
962
|
});
|
|
706
963
|
|
|
707
964
|
/**
|