alepha 0.21.1 → 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 +353 -207
- package/dist/api/files/index.d.ts.map +1 -1
- package/dist/api/files/index.js +211 -45
- 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 +1072 -1005
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +311 -87
- package/dist/api/users/index.js.map +1 -1
- package/dist/api/verifications/index.browser.js +1 -0
- package/dist/api/verifications/index.browser.js.map +1 -1
- package/dist/api/verifications/index.d.ts +144 -133
- package/dist/api/verifications/index.d.ts.map +1 -1
- package/dist/api/verifications/index.js +5 -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 +460 -188
- package/dist/cli/core/index.d.ts.map +1 -1
- package/dist/cli/core/index.js +411 -551
- 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 +127 -1382
- package/dist/cli/platform/index.d.ts.map +1 -1
- package/dist/cli/platform/index.js +188 -2493
- 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/container/core/index.d.ts +236 -0
- package/dist/container/core/index.d.ts.map +1 -0
- package/dist/container/core/index.js +231 -0
- package/dist/container/core/index.js.map +1 -0
- package/dist/container/core/index.workerd.js +192 -0
- 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 +103 -0
- package/dist/email/cloudflare/index.d.ts.map +1 -0
- package/dist/email/cloudflare/index.js +153 -0
- package/dist/email/cloudflare/index.js.map +1 -0
- 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 +21 -3
- 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 +22 -4
- 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 +38 -5
- package/dist/react/form/index.d.ts.map +1 -1
- package/dist/react/form/index.js +91 -3
- 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 +66 -20
- 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 +66 -30
- 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 +57 -12
- 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/controllers/FileController.ts +41 -1
- package/src/api/files/index.ts +3 -0
- package/src/api/files/providers/FileAccessProvider.ts +23 -1
- 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 +175 -75
- 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 +52 -32
- 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/api/verifications/entities/verifications.ts +8 -0
- package/src/api/verifications/services/VerificationService.ts +14 -0
- 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 +49 -1
- package/src/cli/core/__tests__/init.spec.ts +0 -219
- package/src/cli/core/atoms/buildOptions.ts +15 -0
- package/src/cli/core/commands/__tests__/BuildCommand.spec.ts +43 -0
- package/src/cli/core/commands/build.ts +122 -32
- 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/BuildAssetsTask.ts +3 -0
- package/src/cli/core/tasks/BuildClientTask.ts +3 -0
- package/src/cli/core/tasks/BuildCloudflareTask.ts +453 -13
- package/src/cli/core/tasks/BuildCompressTask.ts +3 -0
- package/src/cli/core/tasks/BuildDockerTask.ts +43 -2
- package/src/cli/core/tasks/BuildPrerenderTask.ts +3 -0
- package/src/cli/core/tasks/BuildPwaTask.ts +3 -0
- package/src/cli/core/tasks/BuildServerTask.ts +3 -0
- package/src/cli/core/tasks/BuildTask.ts +42 -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 +265 -122
- package/src/cli/platform/index.ts +25 -53
- package/src/cli/{platform → platform-lib}/__tests__/CloudflareAdapter.spec.ts +426 -169
- package/src/cli/{platform → platform-lib}/__tests__/NamingService.spec.ts +81 -36
- package/src/cli/{platform → platform-lib}/__tests__/PlatformInspector.spec.ts +4 -48
- package/src/cli/{platform → platform-lib}/__tests__/VercelAdapter.spec.ts +56 -85
- package/src/cli/{platform → platform-lib}/adapters/CloudflareAdapter.ts +412 -199
- package/src/cli/{platform → platform-lib}/adapters/PlatformAdapter.ts +68 -33
- package/src/cli/{platform → platform-lib}/adapters/VercelAdapter.ts +11 -25
- package/src/cli/{platform → platform-lib}/atoms/platformOptions.ts +34 -6
- package/src/cli/platform-lib/index.ts +67 -0
- package/src/cli/platform-lib/services/NamingService.ts +136 -0
- package/src/cli/platform-lib/services/PlatformInspector.ts +153 -0
- package/src/cli/{platform → platform-lib}/services/PlatformOrchestrator.ts +80 -127
- 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/container/core/__tests__/$container.spec.ts +83 -0
- package/src/container/core/index.ts +50 -0
- package/src/container/core/index.workerd.ts +53 -0
- package/src/container/core/interfaces/ContainerOptions.ts +69 -0
- package/src/container/core/primitives/$container.ts +100 -0
- package/src/container/core/providers/CloudflareContainerProvider.ts +70 -0
- package/src/container/core/providers/ContainerProvider.ts +92 -0
- package/src/container/core/providers/MockContainerProvider.ts +62 -0
- package/src/container/core/providers/NodeContainerProvider.ts +53 -0
- 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 +182 -0
- package/src/email/cloudflare/index.ts +35 -0
- package/src/email/cloudflare/providers/CloudflareEmailProvider.ts +205 -0
- 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 +38 -13
- 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/form/hooks/useFormQuerySync.ts +0 -0
- package/src/react/form/index.ts +1 -0
- package/src/react/form/services/FormModel.ts +18 -2
- 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/ReactBrowserProvider.ts +12 -3
- 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/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/hooks/PlatformHook.ts +0 -51
- package/src/cli/platform/services/NamingService.ts +0 -55
- package/src/cli/platform/services/PlatformInspector.ts +0 -140
- package/src/orm/REFACTORING.md +0 -330
- /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__/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
|
@@ -1,37 +1,32 @@
|
|
|
1
|
-
import * as _$alepha from "alepha";
|
|
2
1
|
import { Alepha, FileLike, Static, TNull, TObject, TOptional, TSchema, TUnion } from "alepha";
|
|
3
2
|
import { BucketPrimitive } from "alepha/bucket";
|
|
4
3
|
import { UserAccountToken } from "alepha/security";
|
|
5
|
-
import * as _$alepha_server0 from "alepha/server";
|
|
6
4
|
import { Ok } from "alepha/server";
|
|
7
5
|
import { DateTime, DateTimeProvider, DurationLike } from "alepha/datetime";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { Page } from "alepha/orm";
|
|
11
|
-
import * as _$alepha_scheduler0 from "alepha/scheduler";
|
|
12
|
-
import * as _$typebox from "typebox";
|
|
6
|
+
import { Page, RepositoryProvider } from "alepha/orm";
|
|
7
|
+
import { FileSystemProvider } from "alepha/system";
|
|
13
8
|
import { BuildExtraConfigColumns, SQL } from "drizzle-orm";
|
|
14
9
|
import { PgColumnBuilderBase, PgSequenceOptions, PgTableExtraConfigValue, UpdateDeleteAction } from "drizzle-orm/pg-core";
|
|
15
10
|
//#region ../../src/api/files/entities/files.d.ts
|
|
16
|
-
declare const files:
|
|
17
|
-
id:
|
|
18
|
-
version:
|
|
19
|
-
createdAt:
|
|
20
|
-
updatedAt:
|
|
21
|
-
organizationId:
|
|
22
|
-
blobId:
|
|
23
|
-
creator:
|
|
24
|
-
creatorRealm:
|
|
25
|
-
creatorName:
|
|
26
|
-
bucket:
|
|
27
|
-
expirationDate:
|
|
11
|
+
declare const files: import("alepha/orm").EntityPrimitive<import("typebox").TObject<{
|
|
12
|
+
id: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("typebox").TString, typeof import("alepha/orm").PG_PRIMARY_KEY>, typeof import("alepha/orm").PG_DEFAULT>;
|
|
13
|
+
version: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("typebox").TInteger, typeof import("alepha/orm").PG_VERSION>, typeof import("alepha/orm").PG_DEFAULT>;
|
|
14
|
+
createdAt: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("typebox").TString, typeof import("alepha/orm").PG_CREATED_AT>, typeof import("alepha/orm").PG_DEFAULT>;
|
|
15
|
+
updatedAt: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("typebox").TString, typeof import("alepha/orm").PG_UPDATED_AT>, typeof import("alepha/orm").PG_DEFAULT>;
|
|
16
|
+
organizationId: import("alepha/orm").PgAttr<import("typebox").TString, typeof import("alepha/orm").PG_ORGANIZATION>;
|
|
17
|
+
blobId: import("typebox").TString;
|
|
18
|
+
creator: import("typebox").TOptional<import("typebox").TString>;
|
|
19
|
+
creatorRealm: import("typebox").TOptional<import("typebox").TString>;
|
|
20
|
+
creatorName: import("typebox").TOptional<import("typebox").TString>;
|
|
21
|
+
bucket: import("typebox").TString;
|
|
22
|
+
expirationDate: import("typebox").TOptional<import("typebox").TString>;
|
|
28
23
|
/**
|
|
29
24
|
* Display name. Mutable via `FileService.updateFile` — can be renamed
|
|
30
25
|
* by callers (e.g. an Archive UI letting users rename uploaded blobs).
|
|
31
26
|
* Initialized to the uploader's filename at upload time. Use
|
|
32
27
|
* `originalName` if you need the as-uploaded filename after a rename.
|
|
33
28
|
*/
|
|
34
|
-
name:
|
|
29
|
+
name: import("typebox").TString;
|
|
35
30
|
/**
|
|
36
31
|
* Immutable record of the uploader's filename at upload time. Set once
|
|
37
32
|
* by `FileService.uploadFile` and the `bucket:file:uploaded` hook;
|
|
@@ -39,37 +34,37 @@ declare const files: _$alepha_orm0.EntityPrimitive<_$typebox.TObject<{
|
|
|
39
34
|
* headers (Content-Disposition), audit trails, and any UI that wants
|
|
40
35
|
* to show "originally uploaded as X" alongside a renamed file.
|
|
41
36
|
*/
|
|
42
|
-
originalName:
|
|
43
|
-
size:
|
|
44
|
-
mimeType:
|
|
37
|
+
originalName: import("typebox").TOptional<import("typebox").TString>;
|
|
38
|
+
size: import("typebox").TNumber;
|
|
39
|
+
mimeType: import("typebox").TString;
|
|
45
40
|
/**
|
|
46
41
|
* Free-form taxonomy. Normalized server-side (trim/lowercase/dedupe is
|
|
47
42
|
* caller's responsibility for now). Use with `FileQuery.tags` to
|
|
48
43
|
* filter via array-contains.
|
|
49
44
|
*/
|
|
50
|
-
tags:
|
|
45
|
+
tags: import("typebox").TOptional<import("typebox").TArray<import("typebox").TString>>;
|
|
51
46
|
/**
|
|
52
47
|
* SHA-256 hex digest of the file content (64 lowercase hex chars).
|
|
53
48
|
* Computed at upload time by `FileService.calculateChecksum`. Stable
|
|
54
49
|
* — never recomputed after upload. Use for integrity verification,
|
|
55
50
|
* content-based dedup, or downstream virus-scan correlation.
|
|
56
51
|
*/
|
|
57
|
-
checksum:
|
|
52
|
+
checksum: import("typebox").TOptional<import("typebox").TString>;
|
|
58
53
|
}>>;
|
|
59
54
|
type FileEntity = Static<typeof files.schema>;
|
|
60
55
|
//#endregion
|
|
61
56
|
//#region ../../src/api/files/schemas/fileQuerySchema.d.ts
|
|
62
|
-
declare const fileQuerySchema:
|
|
63
|
-
page:
|
|
64
|
-
size:
|
|
65
|
-
sort:
|
|
66
|
-
bucket:
|
|
67
|
-
tags:
|
|
68
|
-
name:
|
|
69
|
-
mimeType:
|
|
70
|
-
creator:
|
|
71
|
-
createdAfter:
|
|
72
|
-
createdBefore:
|
|
57
|
+
declare const fileQuerySchema: import("typebox").TObject<{
|
|
58
|
+
page: import("typebox").TOptional<import("typebox").TInteger>;
|
|
59
|
+
size: import("typebox").TOptional<import("typebox").TInteger>;
|
|
60
|
+
sort: import("typebox").TOptional<import("typebox").TString>;
|
|
61
|
+
bucket: import("typebox").TOptional<import("typebox").TString>;
|
|
62
|
+
tags: import("typebox").TOptional<import("typebox").TArray<import("typebox").TString>>;
|
|
63
|
+
name: import("typebox").TOptional<import("typebox").TString>;
|
|
64
|
+
mimeType: import("typebox").TOptional<import("typebox").TString>;
|
|
65
|
+
creator: import("typebox").TOptional<import("typebox").TString>;
|
|
66
|
+
createdAfter: import("typebox").TOptional<import("typebox").TString>;
|
|
67
|
+
createdBefore: import("typebox").TOptional<import("typebox").TString>;
|
|
73
68
|
}>;
|
|
74
69
|
type FileQuery = Static<typeof fileQuerySchema>;
|
|
75
70
|
//#endregion
|
|
@@ -364,8 +359,8 @@ type PgAttr<T extends TSchema, TAttr extends PgSymbolKeys> = T & { [K in TAttr]:
|
|
|
364
359
|
* - `d1://BINDING_NAME` — Cloudflare D1
|
|
365
360
|
* - `hyperdrive://BINDING_NAME` — Cloudflare Hyperdrive
|
|
366
361
|
*/
|
|
367
|
-
declare const databaseEnvSchema:
|
|
368
|
-
DATABASE_URL:
|
|
362
|
+
declare const databaseEnvSchema: import("typebox").TObject<{
|
|
363
|
+
DATABASE_URL: import("typebox").TOptional<import("typebox").TString>;
|
|
369
364
|
/**
|
|
370
365
|
* Enable or disable push-based schema synchronization (drizzle-kit push).
|
|
371
366
|
*
|
|
@@ -373,55 +368,62 @@ declare const databaseEnvSchema: _$typebox.TObject<{
|
|
|
373
368
|
* Set to `false` in development to skip automatic schema sync
|
|
374
369
|
* (e.g. when managing migrations manually).
|
|
375
370
|
*/
|
|
376
|
-
DATABASE_SYNC:
|
|
371
|
+
DATABASE_SYNC: import("typebox").TOptional<import("typebox").TBoolean>;
|
|
377
372
|
}>;
|
|
378
373
|
declare module "alepha" {
|
|
379
374
|
interface Env extends Partial<Static<typeof databaseEnvSchema>> {}
|
|
380
375
|
} //# sourceMappingURL=databaseEnvSchema.d.ts.map
|
|
381
376
|
//#endregion
|
|
382
377
|
//#region ../../src/api/files/schemas/fileResourceSchema.d.ts
|
|
383
|
-
declare const fileResourceSchema:
|
|
384
|
-
id: PgAttr<PgAttr<
|
|
385
|
-
version: PgAttr<PgAttr<
|
|
386
|
-
createdAt: PgAttr<PgAttr<
|
|
387
|
-
updatedAt: PgAttr<PgAttr<
|
|
388
|
-
organizationId: PgAttr<
|
|
389
|
-
blobId:
|
|
390
|
-
creator:
|
|
391
|
-
creatorRealm:
|
|
392
|
-
creatorName:
|
|
393
|
-
bucket:
|
|
394
|
-
expirationDate:
|
|
395
|
-
name:
|
|
396
|
-
originalName:
|
|
397
|
-
size:
|
|
398
|
-
mimeType:
|
|
399
|
-
tags:
|
|
400
|
-
checksum:
|
|
378
|
+
declare const fileResourceSchema: import("typebox").TObject<{
|
|
379
|
+
id: PgAttr<PgAttr<import("typebox").TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
380
|
+
version: PgAttr<PgAttr<import("typebox").TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
381
|
+
createdAt: PgAttr<PgAttr<import("typebox").TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
382
|
+
updatedAt: PgAttr<PgAttr<import("typebox").TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
383
|
+
organizationId: PgAttr<import("typebox").TString, typeof PG_ORGANIZATION>;
|
|
384
|
+
blobId: import("typebox").TString;
|
|
385
|
+
creator: import("typebox").TOptional<import("typebox").TString>;
|
|
386
|
+
creatorRealm: import("typebox").TOptional<import("typebox").TString>;
|
|
387
|
+
creatorName: import("typebox").TOptional<import("typebox").TString>;
|
|
388
|
+
bucket: import("typebox").TString;
|
|
389
|
+
expirationDate: import("typebox").TOptional<import("typebox").TString>;
|
|
390
|
+
name: import("typebox").TString;
|
|
391
|
+
originalName: import("typebox").TOptional<import("typebox").TString>;
|
|
392
|
+
size: import("typebox").TNumber;
|
|
393
|
+
mimeType: import("typebox").TString;
|
|
394
|
+
tags: import("typebox").TOptional<import("typebox").TArray<import("typebox").TString>>;
|
|
395
|
+
checksum: import("typebox").TOptional<import("typebox").TString>;
|
|
396
|
+
user: import("typebox").TOptional<import("typebox").TObject<{
|
|
397
|
+
id: import("typebox").TString;
|
|
398
|
+
email: import("typebox").TOptional<import("typebox").TString>;
|
|
399
|
+
username: import("typebox").TOptional<import("typebox").TString>;
|
|
400
|
+
firstName: import("typebox").TOptional<import("typebox").TString>;
|
|
401
|
+
lastName: import("typebox").TOptional<import("typebox").TString>;
|
|
402
|
+
}>>;
|
|
401
403
|
}>;
|
|
402
404
|
type FileResource = Static<typeof fileResourceSchema>;
|
|
403
405
|
//#endregion
|
|
404
406
|
//#region ../../src/api/files/schemas/storageStatsSchema.d.ts
|
|
405
|
-
declare const bucketStatsSchema:
|
|
406
|
-
bucket:
|
|
407
|
-
totalSize:
|
|
408
|
-
fileCount:
|
|
407
|
+
declare const bucketStatsSchema: import("typebox").TObject<{
|
|
408
|
+
bucket: import("typebox").TString;
|
|
409
|
+
totalSize: import("typebox").TNumber;
|
|
410
|
+
fileCount: import("typebox").TNumber;
|
|
409
411
|
}>;
|
|
410
|
-
declare const mimeTypeStatsSchema:
|
|
411
|
-
mimeType:
|
|
412
|
-
fileCount:
|
|
412
|
+
declare const mimeTypeStatsSchema: import("typebox").TObject<{
|
|
413
|
+
mimeType: import("typebox").TString;
|
|
414
|
+
fileCount: import("typebox").TNumber;
|
|
413
415
|
}>;
|
|
414
|
-
declare const storageStatsSchema:
|
|
415
|
-
totalSize:
|
|
416
|
-
totalFiles:
|
|
417
|
-
byBucket:
|
|
418
|
-
bucket:
|
|
419
|
-
totalSize:
|
|
420
|
-
fileCount:
|
|
416
|
+
declare const storageStatsSchema: import("typebox").TObject<{
|
|
417
|
+
totalSize: import("typebox").TNumber;
|
|
418
|
+
totalFiles: import("typebox").TNumber;
|
|
419
|
+
byBucket: import("typebox").TArray<import("typebox").TObject<{
|
|
420
|
+
bucket: import("typebox").TString;
|
|
421
|
+
totalSize: import("typebox").TNumber;
|
|
422
|
+
fileCount: import("typebox").TNumber;
|
|
421
423
|
}>>;
|
|
422
|
-
byMimeType:
|
|
423
|
-
mimeType:
|
|
424
|
-
fileCount:
|
|
424
|
+
byMimeType: import("typebox").TArray<import("typebox").TObject<{
|
|
425
|
+
mimeType: import("typebox").TString;
|
|
426
|
+
fileCount: import("typebox").TNumber;
|
|
425
427
|
}>>;
|
|
426
428
|
}>;
|
|
427
429
|
type BucketStats = Static<typeof bucketStatsSchema>;
|
|
@@ -431,38 +433,74 @@ type StorageStats = Static<typeof storageStatsSchema>;
|
|
|
431
433
|
//#region ../../src/api/files/services/FileService.d.ts
|
|
432
434
|
declare class FileService {
|
|
433
435
|
protected readonly alepha: Alepha;
|
|
434
|
-
protected readonly log:
|
|
436
|
+
protected readonly log: import("alepha/logger").Logger;
|
|
435
437
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
438
|
+
protected readonly repositoryProvider: RepositoryProvider;
|
|
439
|
+
protected readonly fileSystem: FileSystemProvider;
|
|
436
440
|
protected readonly defaultBucket: BucketPrimitive;
|
|
437
|
-
readonly fileRepository:
|
|
438
|
-
id:
|
|
439
|
-
version:
|
|
440
|
-
createdAt:
|
|
441
|
-
updatedAt:
|
|
442
|
-
organizationId:
|
|
443
|
-
blobId:
|
|
444
|
-
creator:
|
|
445
|
-
creatorRealm:
|
|
446
|
-
creatorName:
|
|
447
|
-
bucket:
|
|
448
|
-
expirationDate:
|
|
449
|
-
name:
|
|
450
|
-
originalName:
|
|
451
|
-
size:
|
|
452
|
-
mimeType:
|
|
453
|
-
tags:
|
|
454
|
-
checksum:
|
|
441
|
+
readonly fileRepository: import("alepha/orm").Repository<import("typebox").TObject<{
|
|
442
|
+
id: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("typebox").TString, typeof import("alepha/orm").PG_PRIMARY_KEY>, typeof import("alepha/orm").PG_DEFAULT>;
|
|
443
|
+
version: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("typebox").TInteger, typeof import("alepha/orm").PG_VERSION>, typeof import("alepha/orm").PG_DEFAULT>;
|
|
444
|
+
createdAt: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("typebox").TString, typeof import("alepha/orm").PG_CREATED_AT>, typeof import("alepha/orm").PG_DEFAULT>;
|
|
445
|
+
updatedAt: import("alepha/orm").PgAttr<import("alepha/orm").PgAttr<import("typebox").TString, typeof import("alepha/orm").PG_UPDATED_AT>, typeof import("alepha/orm").PG_DEFAULT>;
|
|
446
|
+
organizationId: import("alepha/orm").PgAttr<import("typebox").TString, typeof import("alepha/orm").PG_ORGANIZATION>;
|
|
447
|
+
blobId: import("typebox").TString;
|
|
448
|
+
creator: import("typebox").TOptional<import("typebox").TString>;
|
|
449
|
+
creatorRealm: import("typebox").TOptional<import("typebox").TString>;
|
|
450
|
+
creatorName: import("typebox").TOptional<import("typebox").TString>;
|
|
451
|
+
bucket: import("typebox").TString;
|
|
452
|
+
expirationDate: import("typebox").TOptional<import("typebox").TString>;
|
|
453
|
+
name: import("typebox").TString;
|
|
454
|
+
originalName: import("typebox").TOptional<import("typebox").TString>;
|
|
455
|
+
size: import("typebox").TNumber;
|
|
456
|
+
mimeType: import("typebox").TString;
|
|
457
|
+
tags: import("typebox").TOptional<import("typebox").TArray<import("typebox").TString>>;
|
|
458
|
+
checksum: import("typebox").TOptional<import("typebox").TString>;
|
|
455
459
|
}>>;
|
|
456
|
-
|
|
457
|
-
|
|
460
|
+
/**
|
|
461
|
+
* Best-effort left join embedding the uploader on every file row, so the
|
|
462
|
+
* admin UI can render `user.email` instead of the bare `creator` UUID.
|
|
463
|
+
* Joins `files.creator` → `users.id`. Only applied when the `users` table is
|
|
464
|
+
* actually registered in the app (see `findFiles`) — the files module stays
|
|
465
|
+
* usable standalone, without `alepha/api/users`. Targets the default `users`
|
|
466
|
+
* table, so creators in non-default realms come back unmatched (`user`
|
|
467
|
+
* undefined), which the UI handles by falling back to `creatorName`.
|
|
468
|
+
*
|
|
469
|
+
* The `users` entity is resolved from the repository registry at runtime
|
|
470
|
+
* rather than imported: the users module already depends on the files module
|
|
471
|
+
* (avatars), so a compile-time import here would form a circular dependency.
|
|
472
|
+
*/
|
|
473
|
+
protected resolveCreatorJoin(): {
|
|
474
|
+
user: {
|
|
475
|
+
join: import("alepha/orm").EntityPrimitive<import("typebox").TObject<import("typebox").TProperties>>;
|
|
476
|
+
on: ["creator", {
|
|
477
|
+
name: string;
|
|
478
|
+
}];
|
|
479
|
+
};
|
|
480
|
+
} | undefined;
|
|
481
|
+
protected onUploadFile: import("alepha").HookPrimitive<"bucket:file:uploaded">;
|
|
482
|
+
protected onDeleteBucketFile: import("alepha").HookPrimitive<"bucket:file:deleted">;
|
|
458
483
|
/**
|
|
459
484
|
* Calculates SHA-256 checksum of a file.
|
|
460
485
|
*
|
|
486
|
+
* Reads the whole file into memory. Callers that already hold the bytes
|
|
487
|
+
* should use {@link hashBuffer} instead to avoid re-reading — re-reading a
|
|
488
|
+
* one-shot stream either yields the wrong hash or drains a stream another
|
|
489
|
+
* step still needs.
|
|
490
|
+
*
|
|
461
491
|
* @param file - The file to calculate checksum for
|
|
462
492
|
* @returns Hexadecimal string representation of the SHA-256 hash
|
|
463
493
|
* @protected
|
|
464
494
|
*/
|
|
465
495
|
protected calculateChecksum(file: FileLike): Promise<string>;
|
|
496
|
+
/**
|
|
497
|
+
* Calculates the SHA-256 checksum of an already-read body.
|
|
498
|
+
*
|
|
499
|
+
* @param data - The file bytes
|
|
500
|
+
* @returns Hexadecimal string representation of the SHA-256 hash
|
|
501
|
+
* @protected
|
|
502
|
+
*/
|
|
503
|
+
protected hashBuffer(data: ArrayBuffer): string;
|
|
466
504
|
/**
|
|
467
505
|
* Gets a bucket primitive by name.
|
|
468
506
|
*
|
|
@@ -514,14 +552,35 @@ declare class FileService {
|
|
|
514
552
|
tags?: string[];
|
|
515
553
|
}): Promise<FileEntity>;
|
|
516
554
|
/**
|
|
517
|
-
*
|
|
555
|
+
* Persists the metadata row for an already-uploaded blob, deleting the
|
|
556
|
+
* blob if the insert fails. Uploads are not atomic: the blob is written to
|
|
557
|
+
* storage first (the row needs the returned `blobId`), so a failed insert
|
|
558
|
+
* would otherwise leak the blob — an orphaned blob with no DB row. This
|
|
559
|
+
* compensates by removing the blob, favouring the recoverable failure
|
|
560
|
+
* (a missing blob) over the worse one (a row pointing at nothing).
|
|
518
561
|
*
|
|
519
|
-
*
|
|
562
|
+
* Best-effort: cleanup runs with `skipHook` so it neither re-emits
|
|
563
|
+
* `bucket:file:deleted` nor touches the (non-existent) DB row, and a failed
|
|
564
|
+
* cleanup is logged rather than thrown. The original write error is always
|
|
565
|
+
* rethrown so callers still see the real failure.
|
|
566
|
+
*
|
|
567
|
+
* @param bucket - The bucket the blob was uploaded to
|
|
568
|
+
* @param blobId - The id returned by `bucket.upload`
|
|
569
|
+
* @param insert - Thunk performing the metadata insert
|
|
570
|
+
* @returns The created file entity
|
|
571
|
+
*/
|
|
572
|
+
protected persistBlobMetadata(bucket: BucketPrimitive, blobId: string, insert: () => Promise<FileEntity>): Promise<FileEntity>;
|
|
573
|
+
/**
|
|
574
|
+
* Streams a file from storage by its database ID, or directly from an
|
|
575
|
+
* already-loaded `FileEntity` to avoid a duplicate DB roundtrip when the
|
|
576
|
+
* caller has already fetched the row (e.g. after an access check).
|
|
577
|
+
*
|
|
578
|
+
* @param id - The database ID (UUID) of the file, or the entity itself
|
|
520
579
|
* @returns The file object ready for streaming/downloading
|
|
521
580
|
* @throws {NotFoundError} If the file doesn't exist in the database
|
|
522
581
|
* @throws {FileNotFoundError} If the file exists in database but not in storage
|
|
523
582
|
*/
|
|
524
|
-
streamFile(id: string): Promise<FileLike>;
|
|
583
|
+
streamFile(id: string | FileEntity): Promise<FileLike>;
|
|
525
584
|
/**
|
|
526
585
|
* Updates file metadata (name, tags, expiration date).
|
|
527
586
|
* Does not modify the actual file content in storage.
|
|
@@ -567,6 +626,12 @@ declare class FileService {
|
|
|
567
626
|
/**
|
|
568
627
|
* Gets storage statistics including total size, file count, and breakdowns by bucket and MIME type.
|
|
569
628
|
*
|
|
629
|
+
* Aggregated in SQL (`SUM`/`COUNT` + `GROUP BY`) rather than by loading
|
|
630
|
+
* every row into memory — the table can hold millions of files, and this
|
|
631
|
+
* endpoint must stay O(groups), not O(rows). Totals are derived from the
|
|
632
|
+
* per-bucket groups (every row has exactly one bucket), so no extra query
|
|
633
|
+
* is needed.
|
|
634
|
+
*
|
|
570
635
|
* @returns Storage statistics with aggregated data
|
|
571
636
|
*/
|
|
572
637
|
getStorageStats(): Promise<StorageStats>;
|
|
@@ -594,18 +659,18 @@ declare class AdminFileStatsController {
|
|
|
594
659
|
* Returns aggregated data including total size, file count,
|
|
595
660
|
* and breakdowns by bucket and MIME type.
|
|
596
661
|
*/
|
|
597
|
-
readonly getFileStats:
|
|
598
|
-
response:
|
|
599
|
-
totalSize:
|
|
600
|
-
totalFiles:
|
|
601
|
-
byBucket:
|
|
602
|
-
bucket:
|
|
603
|
-
totalSize:
|
|
604
|
-
fileCount:
|
|
662
|
+
readonly getFileStats: import("alepha/server").ActionPrimitiveFn<{
|
|
663
|
+
response: import("typebox").TObject<{
|
|
664
|
+
totalSize: import("typebox").TNumber;
|
|
665
|
+
totalFiles: import("typebox").TNumber;
|
|
666
|
+
byBucket: import("typebox").TArray<import("typebox").TObject<{
|
|
667
|
+
bucket: import("typebox").TString;
|
|
668
|
+
totalSize: import("typebox").TNumber;
|
|
669
|
+
fileCount: import("typebox").TNumber;
|
|
605
670
|
}>>;
|
|
606
|
-
byMimeType:
|
|
607
|
-
mimeType:
|
|
608
|
-
fileCount:
|
|
671
|
+
byMimeType: import("typebox").TArray<import("typebox").TObject<{
|
|
672
|
+
mimeType: import("typebox").TString;
|
|
673
|
+
fileCount: import("typebox").TNumber;
|
|
609
674
|
}>>;
|
|
610
675
|
}>;
|
|
611
676
|
}>;
|
|
@@ -642,6 +707,25 @@ declare class FileAccessProvider {
|
|
|
642
707
|
* implementation is strict: only the uploader passes.
|
|
643
708
|
*/
|
|
644
709
|
assertReadable(file: FileEntity, user: UserAccountToken | undefined): Promise<void>;
|
|
710
|
+
/**
|
|
711
|
+
* Throws when `file` may not be served through the anonymous
|
|
712
|
+
* `/public/files/:id` route. The default is deny-all: nothing is public
|
|
713
|
+
* unless this method is overridden. Throws `NotFoundError` (not 403) so the
|
|
714
|
+
* endpoint doesn't leak the existence of private file ids.
|
|
715
|
+
*
|
|
716
|
+
* Typical override matches on bucket name:
|
|
717
|
+
*
|
|
718
|
+
* ```ts
|
|
719
|
+
* class MyAccess extends FileAccessProvider {
|
|
720
|
+
* async assertPublic(file) {
|
|
721
|
+
* if (file.bucket === "avatars") return;
|
|
722
|
+
* if (file.bucket === "campaign-icons") return;
|
|
723
|
+
* return super.assertPublic(file);
|
|
724
|
+
* }
|
|
725
|
+
* }
|
|
726
|
+
* ```
|
|
727
|
+
*/
|
|
728
|
+
assertPublic(file: FileEntity): Promise<void>;
|
|
645
729
|
}
|
|
646
730
|
//#endregion
|
|
647
731
|
//#region ../../src/api/files/controllers/FileController.d.ts
|
|
@@ -658,63 +742,70 @@ declare class FileController {
|
|
|
658
742
|
* GET /files - Lists files with optional filtering and pagination.
|
|
659
743
|
* Supports filtering by bucket and tags.
|
|
660
744
|
*/
|
|
661
|
-
readonly findFiles:
|
|
662
|
-
query:
|
|
663
|
-
page:
|
|
664
|
-
size:
|
|
665
|
-
sort:
|
|
666
|
-
bucket:
|
|
667
|
-
tags:
|
|
668
|
-
name:
|
|
669
|
-
mimeType:
|
|
670
|
-
creator:
|
|
671
|
-
createdAfter:
|
|
672
|
-
createdBefore:
|
|
745
|
+
readonly findFiles: import("alepha/server").ActionPrimitiveFn<{
|
|
746
|
+
query: import("typebox").TObject<{
|
|
747
|
+
page: import("typebox").TOptional<import("typebox").TInteger>;
|
|
748
|
+
size: import("typebox").TOptional<import("typebox").TInteger>;
|
|
749
|
+
sort: import("typebox").TOptional<import("typebox").TString>;
|
|
750
|
+
bucket: import("typebox").TOptional<import("typebox").TString>;
|
|
751
|
+
tags: import("typebox").TOptional<import("typebox").TArray<import("typebox").TString>>;
|
|
752
|
+
name: import("typebox").TOptional<import("typebox").TString>;
|
|
753
|
+
mimeType: import("typebox").TOptional<import("typebox").TString>;
|
|
754
|
+
creator: import("typebox").TOptional<import("typebox").TString>;
|
|
755
|
+
createdAfter: import("typebox").TOptional<import("typebox").TString>;
|
|
756
|
+
createdBefore: import("typebox").TOptional<import("typebox").TString>;
|
|
673
757
|
}>;
|
|
674
|
-
response:
|
|
675
|
-
id: PgAttr<PgAttr<
|
|
676
|
-
version: PgAttr<PgAttr<
|
|
677
|
-
createdAt: PgAttr<PgAttr<
|
|
678
|
-
updatedAt: PgAttr<PgAttr<
|
|
679
|
-
organizationId: PgAttr<
|
|
680
|
-
blobId:
|
|
681
|
-
creator:
|
|
682
|
-
creatorRealm:
|
|
683
|
-
creatorName:
|
|
684
|
-
bucket:
|
|
685
|
-
expirationDate:
|
|
686
|
-
name:
|
|
687
|
-
originalName:
|
|
688
|
-
size:
|
|
689
|
-
mimeType:
|
|
690
|
-
tags:
|
|
691
|
-
checksum:
|
|
758
|
+
response: import("alepha").TPage<import("typebox").TObject<{
|
|
759
|
+
id: PgAttr<PgAttr<import("typebox").TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
760
|
+
version: PgAttr<PgAttr<import("typebox").TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
761
|
+
createdAt: PgAttr<PgAttr<import("typebox").TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
762
|
+
updatedAt: PgAttr<PgAttr<import("typebox").TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
763
|
+
organizationId: PgAttr<import("typebox").TString, typeof PG_ORGANIZATION>;
|
|
764
|
+
blobId: import("typebox").TString;
|
|
765
|
+
creator: import("typebox").TOptional<import("typebox").TString>;
|
|
766
|
+
creatorRealm: import("typebox").TOptional<import("typebox").TString>;
|
|
767
|
+
creatorName: import("typebox").TOptional<import("typebox").TString>;
|
|
768
|
+
bucket: import("typebox").TString;
|
|
769
|
+
expirationDate: import("typebox").TOptional<import("typebox").TString>;
|
|
770
|
+
name: import("typebox").TString;
|
|
771
|
+
originalName: import("typebox").TOptional<import("typebox").TString>;
|
|
772
|
+
size: import("typebox").TNumber;
|
|
773
|
+
mimeType: import("typebox").TString;
|
|
774
|
+
tags: import("typebox").TOptional<import("typebox").TArray<import("typebox").TString>>;
|
|
775
|
+
checksum: import("typebox").TOptional<import("typebox").TString>;
|
|
776
|
+
user: import("typebox").TOptional<import("typebox").TObject<{
|
|
777
|
+
id: import("typebox").TString;
|
|
778
|
+
email: import("typebox").TOptional<import("typebox").TString>;
|
|
779
|
+
username: import("typebox").TOptional<import("typebox").TString>;
|
|
780
|
+
firstName: import("typebox").TOptional<import("typebox").TString>;
|
|
781
|
+
lastName: import("typebox").TOptional<import("typebox").TString>;
|
|
782
|
+
}>>;
|
|
692
783
|
}>>;
|
|
693
784
|
}>;
|
|
694
785
|
/**
|
|
695
786
|
* DELETE /files/:id - Deletes a file from both storage and database.
|
|
696
787
|
* Removes the file from the bucket and cleans up the database record.
|
|
697
788
|
*/
|
|
698
|
-
readonly deleteFile:
|
|
699
|
-
params:
|
|
700
|
-
id:
|
|
789
|
+
readonly deleteFile: import("alepha/server").ActionPrimitiveFn<{
|
|
790
|
+
params: import("typebox").TObject<{
|
|
791
|
+
id: import("typebox").TString;
|
|
701
792
|
}>;
|
|
702
|
-
response:
|
|
703
|
-
ok:
|
|
704
|
-
id:
|
|
705
|
-
count:
|
|
793
|
+
response: import("typebox").TObject<{
|
|
794
|
+
ok: import("typebox").TBoolean;
|
|
795
|
+
id: import("typebox").TOptional<import("typebox").TUnion<[import("typebox").TString, import("typebox").TInteger]>>;
|
|
796
|
+
count: import("typebox").TOptional<import("typebox").TNumber>;
|
|
706
797
|
}>;
|
|
707
798
|
}>;
|
|
708
799
|
/**
|
|
709
800
|
* POST /files/delete - Delete many files in one request, batching the
|
|
710
801
|
* underlying bucket calls per bucket (R2/S3 batch where supported).
|
|
711
802
|
*/
|
|
712
|
-
readonly deleteFiles:
|
|
713
|
-
body:
|
|
714
|
-
ids:
|
|
803
|
+
readonly deleteFiles: import("alepha/server").ActionPrimitiveFn<{
|
|
804
|
+
body: import("typebox").TObject<{
|
|
805
|
+
ids: import("typebox").TArray<import("typebox").TString>;
|
|
715
806
|
}>;
|
|
716
|
-
response:
|
|
717
|
-
deleted:
|
|
807
|
+
response: import("typebox").TObject<{
|
|
808
|
+
deleted: import("typebox").TArray<import("typebox").TString>;
|
|
718
809
|
}>;
|
|
719
810
|
}>;
|
|
720
811
|
/**
|
|
@@ -722,65 +813,79 @@ declare class FileController {
|
|
|
722
813
|
* Creates a database record with metadata and calculates checksum.
|
|
723
814
|
* Optionally specify bucket and expiration date.
|
|
724
815
|
*/
|
|
725
|
-
readonly uploadFile:
|
|
726
|
-
body:
|
|
727
|
-
file:
|
|
816
|
+
readonly uploadFile: import("alepha/server").ActionPrimitiveFn<{
|
|
817
|
+
body: import("typebox").TObject<{
|
|
818
|
+
file: import("alepha").TFile;
|
|
728
819
|
}>;
|
|
729
|
-
query:
|
|
730
|
-
expirationDate:
|
|
731
|
-
bucket:
|
|
820
|
+
query: import("typebox").TObject<{
|
|
821
|
+
expirationDate: import("typebox").TOptional<import("typebox").TString>;
|
|
822
|
+
bucket: import("typebox").TOptional<import("typebox").TString>;
|
|
732
823
|
}>;
|
|
733
|
-
response:
|
|
734
|
-
id: PgAttr<PgAttr<
|
|
735
|
-
version: PgAttr<PgAttr<
|
|
736
|
-
createdAt: PgAttr<PgAttr<
|
|
737
|
-
updatedAt: PgAttr<PgAttr<
|
|
738
|
-
organizationId: PgAttr<
|
|
739
|
-
blobId:
|
|
740
|
-
creator:
|
|
741
|
-
creatorRealm:
|
|
742
|
-
creatorName:
|
|
743
|
-
bucket:
|
|
744
|
-
expirationDate:
|
|
745
|
-
name:
|
|
746
|
-
originalName:
|
|
747
|
-
size:
|
|
748
|
-
mimeType:
|
|
749
|
-
tags:
|
|
750
|
-
checksum:
|
|
824
|
+
response: import("typebox").TObject<{
|
|
825
|
+
id: PgAttr<PgAttr<import("typebox").TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
826
|
+
version: PgAttr<PgAttr<import("typebox").TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
827
|
+
createdAt: PgAttr<PgAttr<import("typebox").TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
828
|
+
updatedAt: PgAttr<PgAttr<import("typebox").TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
829
|
+
organizationId: PgAttr<import("typebox").TString, typeof PG_ORGANIZATION>;
|
|
830
|
+
blobId: import("typebox").TString;
|
|
831
|
+
creator: import("typebox").TOptional<import("typebox").TString>;
|
|
832
|
+
creatorRealm: import("typebox").TOptional<import("typebox").TString>;
|
|
833
|
+
creatorName: import("typebox").TOptional<import("typebox").TString>;
|
|
834
|
+
bucket: import("typebox").TString;
|
|
835
|
+
expirationDate: import("typebox").TOptional<import("typebox").TString>;
|
|
836
|
+
name: import("typebox").TString;
|
|
837
|
+
originalName: import("typebox").TOptional<import("typebox").TString>;
|
|
838
|
+
size: import("typebox").TNumber;
|
|
839
|
+
mimeType: import("typebox").TString;
|
|
840
|
+
tags: import("typebox").TOptional<import("typebox").TArray<import("typebox").TString>>;
|
|
841
|
+
checksum: import("typebox").TOptional<import("typebox").TString>;
|
|
842
|
+
user: import("typebox").TOptional<import("typebox").TObject<{
|
|
843
|
+
id: import("typebox").TString;
|
|
844
|
+
email: import("typebox").TOptional<import("typebox").TString>;
|
|
845
|
+
username: import("typebox").TOptional<import("typebox").TString>;
|
|
846
|
+
firstName: import("typebox").TOptional<import("typebox").TString>;
|
|
847
|
+
lastName: import("typebox").TOptional<import("typebox").TString>;
|
|
848
|
+
}>>;
|
|
751
849
|
}>;
|
|
752
850
|
}>;
|
|
753
851
|
/**
|
|
754
852
|
* PATCH /files/:id - Updates file metadata.
|
|
755
853
|
* Allows updating name, tags, and expiration date without modifying file content.
|
|
756
854
|
*/
|
|
757
|
-
readonly updateFile:
|
|
758
|
-
params:
|
|
759
|
-
id:
|
|
855
|
+
readonly updateFile: import("alepha/server").ActionPrimitiveFn<{
|
|
856
|
+
params: import("typebox").TObject<{
|
|
857
|
+
id: import("typebox").TString;
|
|
760
858
|
}>;
|
|
761
|
-
body:
|
|
762
|
-
name:
|
|
763
|
-
tags:
|
|
764
|
-
expirationDate:
|
|
859
|
+
body: import("typebox").TObject<{
|
|
860
|
+
name: import("typebox").TOptional<import("typebox").TString>;
|
|
861
|
+
tags: import("typebox").TOptional<import("typebox").TArray<import("typebox").TString>>;
|
|
862
|
+
expirationDate: import("typebox").TOptional<import("typebox").TString>;
|
|
765
863
|
}>;
|
|
766
|
-
response:
|
|
767
|
-
id: PgAttr<PgAttr<
|
|
768
|
-
version: PgAttr<PgAttr<
|
|
769
|
-
createdAt: PgAttr<PgAttr<
|
|
770
|
-
updatedAt: PgAttr<PgAttr<
|
|
771
|
-
organizationId: PgAttr<
|
|
772
|
-
blobId:
|
|
773
|
-
creator:
|
|
774
|
-
creatorRealm:
|
|
775
|
-
creatorName:
|
|
776
|
-
bucket:
|
|
777
|
-
expirationDate:
|
|
778
|
-
name:
|
|
779
|
-
originalName:
|
|
780
|
-
size:
|
|
781
|
-
mimeType:
|
|
782
|
-
tags:
|
|
783
|
-
checksum:
|
|
864
|
+
response: import("typebox").TObject<{
|
|
865
|
+
id: PgAttr<PgAttr<import("typebox").TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
866
|
+
version: PgAttr<PgAttr<import("typebox").TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
867
|
+
createdAt: PgAttr<PgAttr<import("typebox").TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
868
|
+
updatedAt: PgAttr<PgAttr<import("typebox").TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
869
|
+
organizationId: PgAttr<import("typebox").TString, typeof PG_ORGANIZATION>;
|
|
870
|
+
blobId: import("typebox").TString;
|
|
871
|
+
creator: import("typebox").TOptional<import("typebox").TString>;
|
|
872
|
+
creatorRealm: import("typebox").TOptional<import("typebox").TString>;
|
|
873
|
+
creatorName: import("typebox").TOptional<import("typebox").TString>;
|
|
874
|
+
bucket: import("typebox").TString;
|
|
875
|
+
expirationDate: import("typebox").TOptional<import("typebox").TString>;
|
|
876
|
+
name: import("typebox").TString;
|
|
877
|
+
originalName: import("typebox").TOptional<import("typebox").TString>;
|
|
878
|
+
size: import("typebox").TNumber;
|
|
879
|
+
mimeType: import("typebox").TString;
|
|
880
|
+
tags: import("typebox").TOptional<import("typebox").TArray<import("typebox").TString>>;
|
|
881
|
+
checksum: import("typebox").TOptional<import("typebox").TString>;
|
|
882
|
+
user: import("typebox").TOptional<import("typebox").TObject<{
|
|
883
|
+
id: import("typebox").TString;
|
|
884
|
+
email: import("typebox").TOptional<import("typebox").TString>;
|
|
885
|
+
username: import("typebox").TOptional<import("typebox").TString>;
|
|
886
|
+
firstName: import("typebox").TOptional<import("typebox").TString>;
|
|
887
|
+
lastName: import("typebox").TOptional<import("typebox").TString>;
|
|
888
|
+
}>>;
|
|
784
889
|
}>;
|
|
785
890
|
}>;
|
|
786
891
|
/**
|
|
@@ -794,20 +899,61 @@ declare class FileController {
|
|
|
794
899
|
* Cache-Control is `private` because the per-user authorization decision
|
|
795
900
|
* cannot be cached by shared proxies/CDNs. Client-side ETag still works.
|
|
796
901
|
*/
|
|
797
|
-
readonly streamFile:
|
|
798
|
-
params:
|
|
799
|
-
id:
|
|
902
|
+
readonly streamFile: import("alepha/server").ActionPrimitiveFn<{
|
|
903
|
+
params: import("typebox").TObject<{
|
|
904
|
+
id: import("typebox").TString;
|
|
800
905
|
}>;
|
|
801
|
-
response:
|
|
906
|
+
response: import("alepha").TFile;
|
|
907
|
+
}>;
|
|
908
|
+
/**
|
|
909
|
+
* GET /public/files/:id - Anonymous, edge-cacheable download.
|
|
910
|
+
*
|
|
911
|
+
* Authorization is delegated to `FileAccessProvider.assertPublic`. The
|
|
912
|
+
* default policy is deny-all (throws `NotFoundError`), so consuming apps
|
|
913
|
+
* must override the provider to opt files in — typically by bucket name
|
|
914
|
+
* (avatars, campaign icons, etc.).
|
|
915
|
+
*
|
|
916
|
+
* Cache-Control is `public, immutable, max-age=1y` so Cloudflare's edge
|
|
917
|
+
* cache and any intermediary proxy can serve subsequent hits without
|
|
918
|
+
* touching the Worker. The split URL prefix (vs `/files/:id`) is what
|
|
919
|
+
* makes this safe: edge cache is URL-keyed, so public and private files
|
|
920
|
+
* live in separate cache lanes.
|
|
921
|
+
*/
|
|
922
|
+
readonly streamPublicFile: import("alepha/server").ActionPrimitiveFn<{
|
|
923
|
+
params: import("typebox").TObject<{
|
|
924
|
+
id: import("typebox").TString;
|
|
925
|
+
}>;
|
|
926
|
+
response: import("alepha").TFile;
|
|
802
927
|
}>;
|
|
803
928
|
}
|
|
804
929
|
//#endregion
|
|
805
930
|
//#region ../../src/api/files/jobs/FileJobs.d.ts
|
|
806
931
|
declare class FileJobs {
|
|
807
932
|
protected readonly fileService: FileService;
|
|
808
|
-
readonly purgeFiles:
|
|
933
|
+
readonly purgeFiles: import("alepha/scheduler").SchedulerPrimitive;
|
|
809
934
|
}
|
|
810
935
|
//#endregion
|
|
936
|
+
//#region ../../src/api/files/schemas/fileCreatorSummarySchema.d.ts
|
|
937
|
+
/**
|
|
938
|
+
* Slim view of a file's uploader, embedded by the admin listing via a
|
|
939
|
+
* best-effort left join (`files.creator` → `users.id`) so the UI can render
|
|
940
|
+
* a human-readable identifier instead of a bare UUID.
|
|
941
|
+
*
|
|
942
|
+
* Optional end-to-end: the join only runs when the `users` entity is
|
|
943
|
+
* registered in the running app (see `FileService.findFiles`), and even then
|
|
944
|
+
* a file whose creator was deleted — or who lives in a non-default realm —
|
|
945
|
+
* comes back with `user` undefined. Callers must fall back to `creatorName`
|
|
946
|
+
* or the raw `creator` id.
|
|
947
|
+
*/
|
|
948
|
+
declare const fileCreatorSummarySchema: import("typebox").TObject<{
|
|
949
|
+
id: import("typebox").TString;
|
|
950
|
+
email: import("typebox").TOptional<import("typebox").TString>;
|
|
951
|
+
username: import("typebox").TOptional<import("typebox").TString>;
|
|
952
|
+
firstName: import("typebox").TOptional<import("typebox").TString>;
|
|
953
|
+
lastName: import("typebox").TOptional<import("typebox").TString>;
|
|
954
|
+
}>;
|
|
955
|
+
type FileCreatorSummary = Static<typeof fileCreatorSummarySchema>;
|
|
956
|
+
//#endregion
|
|
811
957
|
//#region ../../src/api/files/index.d.ts
|
|
812
958
|
declare module "alepha/bucket" {
|
|
813
959
|
interface BucketFileOptions {
|
|
@@ -842,7 +988,7 @@ declare module "alepha/bucket" {
|
|
|
842
988
|
*
|
|
843
989
|
* @module alepha.api.files
|
|
844
990
|
*/
|
|
845
|
-
declare const AlephaApiFiles:
|
|
991
|
+
declare const AlephaApiFiles: import("alepha").Service<import("alepha").Module>;
|
|
846
992
|
//#endregion
|
|
847
|
-
export { AdminFileStatsController, AlephaApiFiles, BucketStats, FileAccessProvider, FileController, FileEntity, FileJobs, FileService, MimeTypeStats, StorageStats, bucketStatsSchema, files, mimeTypeStatsSchema, storageStatsSchema };
|
|
993
|
+
export { AdminFileStatsController, AlephaApiFiles, BucketStats, FileAccessProvider, FileController, FileCreatorSummary, FileEntity, FileJobs, FileQuery, FileResource, FileService, MimeTypeStats, StorageStats, bucketStatsSchema, fileCreatorSummarySchema, fileQuerySchema, fileResourceSchema, files, mimeTypeStatsSchema, storageStatsSchema };
|
|
848
994
|
//# sourceMappingURL=index.d.ts.map
|