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
|
@@ -1,30 +1,9 @@
|
|
|
1
1
|
export interface ApiIndexTsOptions {
|
|
2
2
|
appName?: string;
|
|
3
|
-
/**
|
|
4
|
-
* Include `AlephaApiUsers` (realms, sessions, registration, identities,
|
|
5
|
-
* password reset, email verification, admin endpoints) plus the local
|
|
6
|
-
* `RealmProvider` that declares `$realm({ ... })`.
|
|
7
|
-
*/
|
|
8
|
-
saas?: boolean;
|
|
9
3
|
}
|
|
10
4
|
|
|
11
5
|
export const apiIndexTs = (options: ApiIndexTsOptions = {}) => {
|
|
12
|
-
const { appName = "app"
|
|
13
|
-
|
|
14
|
-
if (saas) {
|
|
15
|
-
return `
|
|
16
|
-
import { $module } from "alepha";
|
|
17
|
-
import { AlephaApiUsers } from "alepha/api/users";
|
|
18
|
-
import { HelloController } from "./controllers/HelloController.ts";
|
|
19
|
-
import { RealmProvider } from "./providers/RealmProvider.ts";
|
|
20
|
-
|
|
21
|
-
export const ApiModule = $module({
|
|
22
|
-
name: "${appName}.api",
|
|
23
|
-
services: [HelloController, RealmProvider],
|
|
24
|
-
imports: [AlephaApiUsers],
|
|
25
|
-
});
|
|
26
|
-
`.trim();
|
|
27
|
-
}
|
|
6
|
+
const { appName = "app" } = options;
|
|
28
7
|
|
|
29
8
|
return `
|
|
30
9
|
import { $module } from "alepha";
|
|
@@ -11,7 +11,6 @@ export const mainCss = (opts: { tailwind?: boolean } = {}) => {
|
|
|
11
11
|
*
|
|
12
12
|
* Options:
|
|
13
13
|
* - Tailwind CSS: Use \`alepha init --tailwind\` to add Tailwind CSS
|
|
14
|
-
* - shadcn/ui: Use \`alepha init --shadcn\` to add shadcn/ui setup
|
|
15
14
|
* - Raw CSS: Write your own styles below
|
|
16
15
|
*/
|
|
17
16
|
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
export interface WebAppRouterOptions {
|
|
2
2
|
api?: boolean;
|
|
3
|
-
saas?: boolean;
|
|
4
3
|
}
|
|
5
4
|
|
|
6
5
|
export const webAppRouterTs = (options: WebAppRouterOptions) => {
|
|
7
|
-
if (options.saas) {
|
|
8
|
-
return saasAppRouterTs();
|
|
9
|
-
}
|
|
10
|
-
return basicAppRouterTs(options);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const basicAppRouterTs = (options: WebAppRouterOptions) => {
|
|
14
6
|
const imports: string[] = ['import { $page } from "alepha/react/router";'];
|
|
15
7
|
const classMembers: string[] = [];
|
|
16
8
|
|
|
@@ -39,94 +31,3 @@ export class AppRouter {
|
|
|
39
31
|
${classMembers.join("\n\n")}
|
|
40
32
|
}`;
|
|
41
33
|
};
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* SaaS router wires three trees onto the app:
|
|
45
|
-
* / → Home
|
|
46
|
-
* /auth/* → AuthLayout + login / register / reset / verify
|
|
47
|
-
* /admin/* → AdminLayout + users / sessions / api-keys / parameters / audits
|
|
48
|
-
*
|
|
49
|
-
* Each auth page resolves the realm config from its loader, so the registry
|
|
50
|
-
* components render with everything they need on first paint.
|
|
51
|
-
*/
|
|
52
|
-
const saasAppRouterTs =
|
|
53
|
-
() => `import type { RealmController } from "alepha/api/users";
|
|
54
|
-
import { $page, NotFound } from "alepha/react/router";
|
|
55
|
-
import { $secure } from "alepha/security";
|
|
56
|
-
import { $client } from "alepha/server/links";
|
|
57
|
-
import type { HelloController } from "../api/controllers/HelloController.ts";
|
|
58
|
-
|
|
59
|
-
export class AppRouter {
|
|
60
|
-
protected readonly api = $client<HelloController>();
|
|
61
|
-
protected readonly realmApi = $client<RealmController>();
|
|
62
|
-
|
|
63
|
-
home = $page({
|
|
64
|
-
path: "/",
|
|
65
|
-
lazy: () => import("./components/Home.tsx"),
|
|
66
|
-
loader: () => this.api.hello(),
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
// ── /auth — login, register, reset, verify ─────────────────────────────
|
|
70
|
-
authLayout = $page({
|
|
71
|
-
path: "/auth",
|
|
72
|
-
lazy: () => import("./components/auth/AuthLayout.tsx"),
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
login = $page({
|
|
76
|
-
parent: this.authLayout,
|
|
77
|
-
path: "/login",
|
|
78
|
-
name: "login",
|
|
79
|
-
head: { title: "Sign in" },
|
|
80
|
-
lazy: () => import("./components/auth/Login.tsx"),
|
|
81
|
-
loader: async () => ({ realmConfig: await this.realmApi.getRealmConfig() }),
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
register = $page({
|
|
85
|
-
parent: this.authLayout,
|
|
86
|
-
path: "/register",
|
|
87
|
-
name: "register",
|
|
88
|
-
head: { title: "Sign up" },
|
|
89
|
-
lazy: () => import("./components/auth/Register.tsx"),
|
|
90
|
-
loader: async () => ({ realmConfig: await this.realmApi.getRealmConfig() }),
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
resetPassword = $page({
|
|
94
|
-
parent: this.authLayout,
|
|
95
|
-
path: "/reset-password",
|
|
96
|
-
head: { title: "Reset password" },
|
|
97
|
-
lazy: () => import("./components/auth/ResetPassword.tsx"),
|
|
98
|
-
loader: async () => ({ realmConfig: await this.realmApi.getRealmConfig() }),
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
verifyEmail = $page({
|
|
102
|
-
parent: this.authLayout,
|
|
103
|
-
path: "/verify-email",
|
|
104
|
-
head: { title: "Verify email" },
|
|
105
|
-
lazy: () => import("./components/auth/VerifyEmail.tsx"),
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
// ── /admin — gated by 'admin:ui' permission, declared in RealmProvider.
|
|
109
|
-
// Children inherit the gate via the parent chain.
|
|
110
|
-
adminLayout = $page({
|
|
111
|
-
path: "/admin",
|
|
112
|
-
use: [$secure({ permissions: ["admin:ui"] })],
|
|
113
|
-
lazy: () => import("./components/admin/AdminLayout.tsx"),
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
adminUsers = $page({
|
|
117
|
-
parent: this.adminLayout,
|
|
118
|
-
path: "/users",
|
|
119
|
-
head: { title: "Users" },
|
|
120
|
-
lazy: () => import("./components/admin/Users.tsx"),
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
adminSessions = $page({
|
|
124
|
-
parent: this.adminLayout,
|
|
125
|
-
path: "/sessions",
|
|
126
|
-
head: { title: "Sessions" },
|
|
127
|
-
lazy: () => import("./components/admin/Sessions.tsx"),
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
notFound = $page({ path: "/*", component: NotFound });
|
|
131
|
-
}
|
|
132
|
-
`;
|
|
@@ -1,30 +1,9 @@
|
|
|
1
1
|
export interface WebIndexTsOptions {
|
|
2
2
|
appName?: string;
|
|
3
|
-
/**
|
|
4
|
-
* SaaS bundle: auth pages need `useAuth()` (ReactAuth) which lives in the
|
|
5
|
-
* `alepha.react.auth` module. Importing it here registers ReactAuth in the
|
|
6
|
-
* container so the auth-* registry components can inject it.
|
|
7
|
-
*/
|
|
8
|
-
saas?: boolean;
|
|
9
3
|
}
|
|
10
4
|
|
|
11
5
|
export const webIndexTs = (options: WebIndexTsOptions = {}) => {
|
|
12
|
-
const { appName = "app"
|
|
13
|
-
|
|
14
|
-
if (saas) {
|
|
15
|
-
return `
|
|
16
|
-
import { $module } from "alepha";
|
|
17
|
-
import { AlephaReactAuth } from "alepha/react/auth";
|
|
18
|
-
import { AlephaReactI18n } from "alepha/react/i18n";
|
|
19
|
-
import { AppRouter } from "./AppRouter.ts";
|
|
20
|
-
|
|
21
|
-
export const WebModule = $module({
|
|
22
|
-
name: "${appName}.web",
|
|
23
|
-
services: [AppRouter],
|
|
24
|
-
imports: [AlephaReactAuth, AlephaReactI18n],
|
|
25
|
-
});
|
|
26
|
-
`.trim();
|
|
27
|
-
}
|
|
6
|
+
const { appName = "app" } = options;
|
|
28
7
|
|
|
29
8
|
return `
|
|
30
9
|
import { $module } from "alepha";
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Alepha } from "alepha";
|
|
2
|
+
import {
|
|
3
|
+
MemorySecretStore,
|
|
4
|
+
platformOptions,
|
|
5
|
+
type SecretStoreProvider,
|
|
6
|
+
} from "alepha/cli/platform-lib";
|
|
2
7
|
import { CliProvider } from "alepha/command";
|
|
3
8
|
import { FileSystemProvider, MemoryFileSystemProvider } from "alepha/system";
|
|
4
9
|
import { describe, test } from "vitest";
|
|
5
|
-
import { platformOptions } from "../atoms/platformOptions.ts";
|
|
6
10
|
import { SecretsCommand } from "../commands/SecretsCommand.ts";
|
|
7
|
-
import { MemorySecretStore } from "../providers/MemorySecretStore.ts";
|
|
8
|
-
import type { SecretStoreProvider } from "../providers/SecretStoreProvider.ts";
|
|
9
11
|
|
|
10
12
|
class TestSecretsCommand extends SecretsCommand {
|
|
11
13
|
public readonly testList = this.list;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { $inject, $state, AlephaError, t } from "alepha";
|
|
2
|
+
import {
|
|
3
|
+
GitHubSecretStore,
|
|
4
|
+
NamingService,
|
|
5
|
+
PlatformInspector,
|
|
6
|
+
platformOptions,
|
|
7
|
+
SecretFilterService,
|
|
8
|
+
type SecretStoreProvider,
|
|
9
|
+
} from "alepha/cli/platform-lib";
|
|
2
10
|
import { $command, EnvUtils } from "alepha/command";
|
|
3
11
|
import { $logger, ConsoleColorProvider } from "alepha/logger";
|
|
4
|
-
import { platformOptions } from "../atoms/platformOptions.ts";
|
|
5
|
-
import { GitHubSecretStore } from "../providers/GitHubSecretStore.ts";
|
|
6
|
-
import type { SecretStoreProvider } from "../providers/SecretStoreProvider.ts";
|
|
7
|
-
import { NamingService } from "../services/NamingService.ts";
|
|
8
|
-
import { PlatformInspector } from "../services/PlatformInspector.ts";
|
|
9
|
-
import { SecretFilterService } from "../services/SecretFilterService.ts";
|
|
10
12
|
|
|
11
13
|
export class SecretsCommand {
|
|
12
14
|
protected readonly log = $logger();
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
import { $inject, $state, AlephaError, t } from "alepha";
|
|
2
|
-
import { AppEntryProvider, ViteBuildProvider } from "alepha/cli";
|
|
3
|
-
import { $command, EnvUtils } from "alepha/command";
|
|
4
|
-
import { $logger, ConsoleColorProvider } from "alepha/logger";
|
|
5
|
-
import { CloudflareAdapter } from "../adapters/CloudflareAdapter.ts";
|
|
6
|
-
import type {
|
|
7
|
-
AppDefinition,
|
|
8
|
-
DetectedResources,
|
|
9
|
-
} from "../adapters/PlatformAdapter.ts";
|
|
10
|
-
import { VercelAdapter } from "../adapters/VercelAdapter.ts";
|
|
11
|
-
import { platformOptions } from "../atoms/platformOptions.ts";
|
|
12
|
-
import type {
|
|
13
|
-
PlatformPlanOutput,
|
|
14
|
-
PlatformStatusOutput,
|
|
15
|
-
} from "../schemas/platform.ts";
|
|
16
|
-
import { NamingService } from "../services/NamingService.ts";
|
|
2
|
+
import { type AppEntry, AppEntryProvider, ViteBuildProvider } from "alepha/cli";
|
|
17
3
|
import {
|
|
4
|
+
CloudflareAdapter,
|
|
5
|
+
type DetectedResources,
|
|
6
|
+
NamingService,
|
|
18
7
|
PlatformInspector,
|
|
8
|
+
PlatformOrchestrator,
|
|
9
|
+
type PlatformPlanOutput,
|
|
10
|
+
type PlatformStatusOutput,
|
|
11
|
+
platformOptions,
|
|
19
12
|
type ResolvedPlatformConfig,
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
resolveTenant,
|
|
14
|
+
VercelAdapter,
|
|
15
|
+
} from "alepha/cli/platform-lib";
|
|
16
|
+
import { $command, EnvUtils } from "alepha/command";
|
|
17
|
+
import { $logger, ConsoleColorProvider } from "alepha/logger";
|
|
22
18
|
import { SecretsCommand } from "./SecretsCommand.ts";
|
|
23
19
|
|
|
24
20
|
export class PlatformCommand {
|
|
@@ -43,6 +39,12 @@ export class PlatformCommand {
|
|
|
43
39
|
description: "Target environment",
|
|
44
40
|
}),
|
|
45
41
|
),
|
|
42
|
+
tenant: t.optional(
|
|
43
|
+
t.text({
|
|
44
|
+
description:
|
|
45
|
+
"Tenant slug (apps with tenancy: optional | required). Names resources <tenant>-<project>-<env> and serves <tenant>.<domain>.",
|
|
46
|
+
}),
|
|
47
|
+
),
|
|
46
48
|
verbose: t.optional(
|
|
47
49
|
t.boolean({
|
|
48
50
|
aliases: ["v"],
|
|
@@ -75,7 +77,8 @@ export class PlatformCommand {
|
|
|
75
77
|
config,
|
|
76
78
|
this.isServerless(adapterName),
|
|
77
79
|
);
|
|
78
|
-
const
|
|
80
|
+
const tenant = resolveTenant(config.tenancy, flags.tenant);
|
|
81
|
+
const namingCtx = this.naming.forContext(config.project, env, tenant);
|
|
79
82
|
|
|
80
83
|
// --- Data collection ---
|
|
81
84
|
|
|
@@ -231,14 +234,18 @@ export class PlatformCommand {
|
|
|
231
234
|
root,
|
|
232
235
|
config,
|
|
233
236
|
this.isServerless(adapter),
|
|
237
|
+
{ prebuilt: flags.prebuilt },
|
|
234
238
|
);
|
|
235
239
|
|
|
236
240
|
const result = await this.orchestrator.up({
|
|
237
241
|
root,
|
|
238
242
|
env,
|
|
239
|
-
apps,
|
|
243
|
+
entry: apps[0].entry,
|
|
244
|
+
resources: apps[0].resources,
|
|
245
|
+
|
|
240
246
|
run,
|
|
241
247
|
prebuilt: flags.prebuilt,
|
|
248
|
+
tenant: flags.tenant,
|
|
242
249
|
});
|
|
243
250
|
|
|
244
251
|
if (flags.json) {
|
|
@@ -296,8 +303,11 @@ export class PlatformCommand {
|
|
|
296
303
|
const completed = await this.orchestrator.down({
|
|
297
304
|
root,
|
|
298
305
|
env: flags.env,
|
|
299
|
-
apps,
|
|
306
|
+
entry: apps[0].entry,
|
|
307
|
+
resources: apps[0].resources,
|
|
308
|
+
|
|
300
309
|
run,
|
|
310
|
+
tenant: flags.tenant,
|
|
301
311
|
confirm: async (prompt) => {
|
|
302
312
|
if (flags.yes) {
|
|
303
313
|
return flags.env as string;
|
|
@@ -347,8 +357,11 @@ export class PlatformCommand {
|
|
|
347
357
|
const { state } = await this.orchestrator.status({
|
|
348
358
|
root,
|
|
349
359
|
env,
|
|
350
|
-
apps,
|
|
360
|
+
entry: apps[0].entry,
|
|
361
|
+
resources: apps[0].resources,
|
|
362
|
+
|
|
351
363
|
run,
|
|
364
|
+
tenant: flags.tenant,
|
|
352
365
|
});
|
|
353
366
|
|
|
354
367
|
// --- JSON output ---
|
|
@@ -521,20 +534,22 @@ export class PlatformCommand {
|
|
|
521
534
|
config,
|
|
522
535
|
this.isServerless(envConfig.adapter),
|
|
523
536
|
);
|
|
524
|
-
const
|
|
537
|
+
const tenant = resolveTenant(config.tenancy, flags.tenant);
|
|
538
|
+
const namingCtx = this.naming.forContext(config.project, env, tenant);
|
|
525
539
|
|
|
526
540
|
const ctx = {
|
|
527
541
|
project: config.project,
|
|
528
542
|
env,
|
|
529
543
|
envConfig,
|
|
530
|
-
apps,
|
|
544
|
+
entry: apps[0].entry,
|
|
545
|
+
resources: apps[0].resources,
|
|
546
|
+
|
|
531
547
|
root,
|
|
532
548
|
naming: namingCtx,
|
|
549
|
+
tenant,
|
|
533
550
|
};
|
|
534
551
|
|
|
535
|
-
|
|
536
|
-
await adapter.build({ ...ctx, app }, run);
|
|
537
|
-
}
|
|
552
|
+
await adapter.build(ctx, run);
|
|
538
553
|
},
|
|
539
554
|
});
|
|
540
555
|
|
|
@@ -552,22 +567,23 @@ export class PlatformCommand {
|
|
|
552
567
|
config,
|
|
553
568
|
this.isServerless(envConfig.adapter),
|
|
554
569
|
);
|
|
555
|
-
const
|
|
570
|
+
const tenant = resolveTenant(config.tenancy, flags.tenant);
|
|
571
|
+
const namingCtx = this.naming.forContext(config.project, env, tenant);
|
|
556
572
|
|
|
557
573
|
const ctx = {
|
|
558
574
|
project: config.project,
|
|
559
575
|
env,
|
|
560
576
|
envConfig,
|
|
561
|
-
apps,
|
|
577
|
+
entry: apps[0].entry,
|
|
578
|
+
resources: apps[0].resources,
|
|
579
|
+
|
|
562
580
|
root,
|
|
563
581
|
naming: namingCtx,
|
|
582
|
+
tenant,
|
|
564
583
|
};
|
|
565
584
|
|
|
566
585
|
await adapter.authenticate(ctx, run);
|
|
567
|
-
|
|
568
|
-
for (const app of apps) {
|
|
569
|
-
await adapter.deploy({ ...ctx, app }, run);
|
|
570
|
-
}
|
|
586
|
+
await adapter.deploy(ctx, run);
|
|
571
587
|
},
|
|
572
588
|
});
|
|
573
589
|
|
|
@@ -585,15 +601,19 @@ export class PlatformCommand {
|
|
|
585
601
|
config,
|
|
586
602
|
this.isServerless(envConfig.adapter),
|
|
587
603
|
);
|
|
588
|
-
const
|
|
604
|
+
const tenant = resolveTenant(config.tenancy, flags.tenant);
|
|
605
|
+
const namingCtx = this.naming.forContext(config.project, env, tenant);
|
|
589
606
|
|
|
590
607
|
const ctx = {
|
|
591
608
|
project: config.project,
|
|
592
609
|
env,
|
|
593
610
|
envConfig,
|
|
594
|
-
apps,
|
|
611
|
+
entry: apps[0].entry,
|
|
612
|
+
resources: apps[0].resources,
|
|
613
|
+
|
|
595
614
|
root,
|
|
596
615
|
naming: namingCtx,
|
|
616
|
+
tenant,
|
|
597
617
|
};
|
|
598
618
|
|
|
599
619
|
await adapter.authenticate(ctx, run);
|
|
@@ -611,6 +631,72 @@ export class PlatformCommand {
|
|
|
611
631
|
},
|
|
612
632
|
});
|
|
613
633
|
|
|
634
|
+
protected readonly dbExport = $command({
|
|
635
|
+
name: "export",
|
|
636
|
+
description:
|
|
637
|
+
"Export the deployed database to a local snapshot (remote → local dev DB).",
|
|
638
|
+
flags: t.object({
|
|
639
|
+
...this.envFlags.properties,
|
|
640
|
+
output: t.optional(
|
|
641
|
+
t.text({
|
|
642
|
+
description:
|
|
643
|
+
"Destination SQLite file. Defaults to the dev DB path (node_modules/.alepha/sqlite.db).",
|
|
644
|
+
}),
|
|
645
|
+
),
|
|
646
|
+
keepSql: t.optional(
|
|
647
|
+
t.boolean({
|
|
648
|
+
description: "Keep the intermediate .sql dump file.",
|
|
649
|
+
}),
|
|
650
|
+
),
|
|
651
|
+
}),
|
|
652
|
+
handler: async ({ flags, root, run }) => {
|
|
653
|
+
const config = await this.inspector.resolveConfig(root);
|
|
654
|
+
const env = flags.env ?? config.defaultEnv;
|
|
655
|
+
const envConfig = config.environments[env];
|
|
656
|
+
const adapter = this.orchestrator.resolveAdapter(envConfig.adapter);
|
|
657
|
+
const app = await this.resolveApp(
|
|
658
|
+
root,
|
|
659
|
+
config,
|
|
660
|
+
this.isServerless(envConfig.adapter),
|
|
661
|
+
);
|
|
662
|
+
const tenant = resolveTenant(config.tenancy, flags.tenant);
|
|
663
|
+
const namingCtx = this.naming.forContext(config.project, env, tenant);
|
|
664
|
+
|
|
665
|
+
const ctx = {
|
|
666
|
+
project: config.project,
|
|
667
|
+
env,
|
|
668
|
+
envConfig,
|
|
669
|
+
entry: app.entry,
|
|
670
|
+
resources: app.resources,
|
|
671
|
+
|
|
672
|
+
root,
|
|
673
|
+
naming: namingCtx,
|
|
674
|
+
tenant,
|
|
675
|
+
};
|
|
676
|
+
|
|
677
|
+
await adapter.authenticate(ctx, run);
|
|
678
|
+
await adapter.exportDb(ctx, run, {
|
|
679
|
+
output: flags.output,
|
|
680
|
+
keepSql: flags.keepSql,
|
|
681
|
+
});
|
|
682
|
+
},
|
|
683
|
+
});
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* `db` subgroup — operations against the *deployed* database (export,
|
|
687
|
+
* migrate). They live under `platform` (not core `alepha db`) because
|
|
688
|
+
* they need the env config, tenancy, adapter, and resource naming.
|
|
689
|
+
*/
|
|
690
|
+
protected readonly db = $command({
|
|
691
|
+
name: "db",
|
|
692
|
+
description: "Deployed-database operations (export, migrate).",
|
|
693
|
+
children: [this.dbExport, this.migrate],
|
|
694
|
+
handler: async ({ help, root }) => {
|
|
695
|
+
await this.inspector.resolveConfig(root);
|
|
696
|
+
help();
|
|
697
|
+
},
|
|
698
|
+
});
|
|
699
|
+
|
|
614
700
|
// -----------------------------------------------------------------------
|
|
615
701
|
// Parent command
|
|
616
702
|
// -----------------------------------------------------------------------
|
|
@@ -626,7 +712,7 @@ export class PlatformCommand {
|
|
|
626
712
|
this.status,
|
|
627
713
|
this.build,
|
|
628
714
|
this.deploy,
|
|
629
|
-
this.
|
|
715
|
+
this.db,
|
|
630
716
|
this.secretsCommand.secrets,
|
|
631
717
|
],
|
|
632
718
|
handler: async ({ help, root }) => {
|
|
@@ -649,11 +735,29 @@ export class PlatformCommand {
|
|
|
649
735
|
* ViteBuildProvider.init() per app. This is expensive -- only done
|
|
650
736
|
* for up/down/status, not for plan.
|
|
651
737
|
*/
|
|
652
|
-
protected async
|
|
738
|
+
protected async resolveApp(
|
|
653
739
|
root: string,
|
|
654
|
-
|
|
740
|
+
_config: ResolvedPlatformConfig,
|
|
655
741
|
isServerless: boolean,
|
|
656
|
-
|
|
742
|
+
options: { prebuilt?: boolean } = {},
|
|
743
|
+
): Promise<{ entry: AppEntry; resources: DetectedResources }> {
|
|
744
|
+
// Prebuilt + manifest fast-path: read `dist/manifest.json` produced
|
|
745
|
+
// by the original `alepha build` instead of re-booting the workspace
|
|
746
|
+
// via Vite. Lets external orchestrators (Alepha Rocket) avoid the
|
|
747
|
+
// workspace's runtime `npm install` — the app source is never
|
|
748
|
+
// imported here, so missing deps (react-dom, etc.) don't matter.
|
|
749
|
+
if (options.prebuilt) {
|
|
750
|
+
const manifest = await this.readManifest(root);
|
|
751
|
+
if (manifest) {
|
|
752
|
+
return {
|
|
753
|
+
entry: { root, server: "" },
|
|
754
|
+
resources: manifest.resources,
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
// No manifest — fall through to introspection. Useful for older
|
|
758
|
+
// artifacts that pre-date the manifest emission.
|
|
759
|
+
}
|
|
760
|
+
|
|
657
761
|
const entry = await this.boot.getAppEntry(root);
|
|
658
762
|
if (isServerless) {
|
|
659
763
|
process.env.ALEPHA_SERVERLESS = "true";
|
|
@@ -662,20 +766,62 @@ export class PlatformCommand {
|
|
|
662
766
|
delete process.env.ALEPHA_SERVERLESS;
|
|
663
767
|
const resources = this.detectResources(appAlepha);
|
|
664
768
|
|
|
665
|
-
return
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
769
|
+
return { entry, resources };
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* @deprecated single-app projects; use `resolveApp` directly.
|
|
774
|
+
* Kept temporarily so existing commands can be migrated one at a time.
|
|
775
|
+
*/
|
|
776
|
+
protected async resolveApps(
|
|
777
|
+
root: string,
|
|
778
|
+
config: ResolvedPlatformConfig,
|
|
779
|
+
isServerless: boolean,
|
|
780
|
+
options: { prebuilt?: boolean } = {},
|
|
781
|
+
): Promise<
|
|
782
|
+
Array<{
|
|
783
|
+
name: string;
|
|
784
|
+
path: string;
|
|
785
|
+
entry: AppEntry;
|
|
786
|
+
resources: DetectedResources;
|
|
787
|
+
}>
|
|
788
|
+
> {
|
|
789
|
+
const { entry, resources } = await this.resolveApp(
|
|
790
|
+
root,
|
|
791
|
+
config,
|
|
792
|
+
isServerless,
|
|
793
|
+
options,
|
|
794
|
+
);
|
|
795
|
+
return [{ name: config.project, path: "", entry, resources }];
|
|
673
796
|
}
|
|
674
797
|
|
|
675
798
|
protected isServerless(adapter: string): boolean {
|
|
676
799
|
return adapter === "vercel" || adapter === "cloudflare";
|
|
677
800
|
}
|
|
678
801
|
|
|
802
|
+
/**
|
|
803
|
+
* Read `dist/manifest.json` if present. Returns `null` when the file
|
|
804
|
+
* doesn't exist or isn't parseable — caller falls back to the
|
|
805
|
+
* Vite-introspection path.
|
|
806
|
+
*/
|
|
807
|
+
protected async readManifest(root: string): Promise<{
|
|
808
|
+
version: number;
|
|
809
|
+
project: string;
|
|
810
|
+
resources: DetectedResources;
|
|
811
|
+
} | null> {
|
|
812
|
+
try {
|
|
813
|
+
const fs = await import("node:fs/promises");
|
|
814
|
+
const path = await import("node:path");
|
|
815
|
+
const raw = await fs.readFile(
|
|
816
|
+
path.join(root, "dist", "manifest.json"),
|
|
817
|
+
"utf-8",
|
|
818
|
+
);
|
|
819
|
+
return JSON.parse(raw);
|
|
820
|
+
} catch {
|
|
821
|
+
return null;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
|
|
679
825
|
protected detectResources(alepha: any): DetectedResources {
|
|
680
826
|
let hasDatabase = false;
|
|
681
827
|
let hasBucket = false;
|
|
@@ -1,33 +1,23 @@
|
|
|
1
1
|
import { $context, $module } from "alepha";
|
|
2
2
|
import { AlephaCli } from "alepha/cli";
|
|
3
|
-
import { CloudflareAdapter } from "./adapters/CloudflareAdapter.ts";
|
|
4
|
-
import { VercelAdapter } from "./adapters/VercelAdapter.ts";
|
|
5
3
|
import {
|
|
4
|
+
AlephaPlatformLibPlugin,
|
|
6
5
|
type PlatformOptions,
|
|
7
6
|
platformOptions,
|
|
8
|
-
} from "
|
|
7
|
+
} from "alepha/cli/platform-lib";
|
|
9
8
|
import { PlatformCommand } from "./commands/platform.ts";
|
|
10
9
|
import { SecretsCommand } from "./commands/SecretsCommand.ts";
|
|
11
|
-
import { GitHubSecretStore } from "./providers/GitHubSecretStore.ts";
|
|
12
|
-
import { MemorySecretStore } from "./providers/MemorySecretStore.ts";
|
|
13
|
-
import { PlatformCacheProvider } from "./providers/PlatformCacheProvider.ts";
|
|
14
|
-
import { CloudflareApi } from "./services/CloudflareApi.ts";
|
|
15
|
-
import { NamingService } from "./services/NamingService.ts";
|
|
16
|
-
import { PlatformInspector } from "./services/PlatformInspector.ts";
|
|
17
|
-
import { PlatformOrchestrator } from "./services/PlatformOrchestrator.ts";
|
|
18
|
-
import { SecretFilterService } from "./services/SecretFilterService.ts";
|
|
19
|
-
import { VercelApi } from "./services/VercelApi.ts";
|
|
20
|
-
import { VercelCli } from "./services/VercelCli.ts";
|
|
21
|
-
import { WranglerApi } from "./services/WranglerApi.ts";
|
|
22
10
|
|
|
23
11
|
// ---------------------------------------------------------------------------
|
|
24
12
|
|
|
25
13
|
/**
|
|
26
14
|
* CLI plugin for multi-cloud deployment orchestration.
|
|
27
15
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
16
|
+
* Wraps `AlephaPlatformLibPlugin` (the framework-agnostic deploy
|
|
17
|
+
* services) with `$command` instances so the orchestration is
|
|
18
|
+
* reachable from `alepha platform …`. Non-CLI consumers (e.g. Alepha
|
|
19
|
+
* Rocket) should depend on `alepha/cli/platform-lib` directly instead
|
|
20
|
+
* of pulling in this command surface.
|
|
31
21
|
*
|
|
32
22
|
* Commands:
|
|
33
23
|
* - `alepha platform plan` — show project topology and resource names
|
|
@@ -35,9 +25,10 @@ import { WranglerApi } from "./services/WranglerApi.ts";
|
|
|
35
25
|
* - `alepha platform down` — teardown an environment
|
|
36
26
|
* - `alepha platform status` — inspect deployed resources
|
|
37
27
|
* - `alepha platform build` — build apps locally
|
|
38
|
-
* - `alepha platform deploy`
|
|
39
|
-
* - `alepha platform migrate` — run database migrations
|
|
40
|
-
* - `alepha platform
|
|
28
|
+
* - `alepha platform deploy` — deploy to cloud
|
|
29
|
+
* - `alepha platform db migrate` — run database migrations
|
|
30
|
+
* - `alepha platform db export` — pull the deployed DB into a local snapshot
|
|
31
|
+
* - `alepha platform secrets` — manage external secret stores
|
|
41
32
|
*
|
|
42
33
|
* Configuration in `alepha.config.ts`:
|
|
43
34
|
*
|
|
@@ -59,21 +50,9 @@ export const AlephaCliPlatformPlugin = $module({
|
|
|
59
50
|
name: "alepha.cli.plugins.platform",
|
|
60
51
|
services: [
|
|
61
52
|
AlephaCli,
|
|
53
|
+
AlephaPlatformLibPlugin,
|
|
62
54
|
PlatformCommand,
|
|
63
55
|
SecretsCommand,
|
|
64
|
-
CloudflareAdapter,
|
|
65
|
-
CloudflareApi,
|
|
66
|
-
VercelAdapter,
|
|
67
|
-
VercelApi,
|
|
68
|
-
VercelCli,
|
|
69
|
-
WranglerApi,
|
|
70
|
-
PlatformCacheProvider,
|
|
71
|
-
GitHubSecretStore,
|
|
72
|
-
MemorySecretStore,
|
|
73
|
-
NamingService,
|
|
74
|
-
SecretFilterService,
|
|
75
|
-
PlatformInspector,
|
|
76
|
-
PlatformOrchestrator,
|
|
77
56
|
],
|
|
78
57
|
});
|
|
79
58
|
|
|
@@ -99,24 +78,5 @@ export const platform = (options: PlatformOptions) => {
|
|
|
99
78
|
|
|
100
79
|
// ---------------------------------------------------------------------------
|
|
101
80
|
|
|
102
|
-
export * from "./adapters/CloudflareAdapter.ts";
|
|
103
|
-
export * from "./adapters/PlatformAdapter.ts";
|
|
104
|
-
export * from "./adapters/VercelAdapter.ts";
|
|
105
|
-
export * from "./atoms/platformOptions.ts";
|
|
106
81
|
export * from "./commands/platform.ts";
|
|
107
82
|
export * from "./commands/SecretsCommand.ts";
|
|
108
|
-
export * from "./providers/GitHubSecretStore.ts";
|
|
109
|
-
export * from "./providers/MemorySecretStore.ts";
|
|
110
|
-
export * from "./providers/PlatformCacheProvider.ts";
|
|
111
|
-
export * from "./providers/SecretStoreProvider.ts";
|
|
112
|
-
export * from "./schemas/cloudflare.ts";
|
|
113
|
-
export * from "./schemas/platform.ts";
|
|
114
|
-
export * from "./schemas/vercel.ts";
|
|
115
|
-
export * from "./services/CloudflareApi.ts";
|
|
116
|
-
export * from "./services/NamingService.ts";
|
|
117
|
-
export * from "./services/PlatformInspector.ts";
|
|
118
|
-
export * from "./services/PlatformOrchestrator.ts";
|
|
119
|
-
export * from "./services/SecretFilterService.ts";
|
|
120
|
-
export * from "./services/VercelApi.ts";
|
|
121
|
-
export * from "./services/VercelCli.ts";
|
|
122
|
-
export * from "./services/WranglerApi.ts";
|