alepha 0.21.2 → 0.23.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 +282 -285
- 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 +217 -222
- 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 +1106 -1005
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +307 -64
- 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 +137 -143
- 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 +458 -249
- package/dist/cli/core/index.d.ts.map +1 -1
- package/dist/cli/core/index.js +372 -660
- 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 +20 -17
- package/dist/cli/i18n/index.d.ts.map +1 -1
- package/dist/cli/i18n/index.js +45 -11
- 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 +1472 -0
- package/dist/cli/platform-lib/index.d.ts.map +1 -0
- package/dist/cli/platform-lib/index.js +2660 -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 +20 -19
- 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 +25 -20
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +23 -0
- 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 -5
- package/dist/react/form/index.d.ts.map +1 -1
- package/dist/react/form/index.js +16 -15
- 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 +90 -11
- package/dist/react/i18n/index.d.ts.map +1 -1
- package/dist/react/i18n/index.js +147 -11
- 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 +193 -24
- package/dist/react/router/index.browser.js.map +1 -1
- package/dist/react/router/index.d.ts +434 -222
- package/dist/react/router/index.d.ts.map +1 -1
- package/dist/react/router/index.js +249 -35
- package/dist/react/router/index.js.map +1 -1
- package/dist/react/sitemap/index.browser.js +35 -0
- package/dist/react/sitemap/index.browser.js.map +1 -0
- package/dist/react/sitemap/index.d.ts +92 -0
- package/dist/react/sitemap/index.d.ts.map +1 -0
- package/dist/react/sitemap/index.js +131 -0
- package/dist/react/sitemap/index.js.map +1 -0
- package/dist/react/testing/index.d.ts +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 +272 -173
- package/dist/server/auth/index.d.ts.map +1 -1
- package/dist/server/auth/index.js +1608 -15
- 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 +20 -7
- package/dist/server/cookies/index.d.ts.map +1 -1
- package/dist/server/cookies/index.js +22 -3
- 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 +106 -73
- package/dist/server/core/index.d.ts.map +1 -1
- package/dist/server/core/index.js +44 -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 +59 -23
- 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/controllers/RealmController.ts +1 -0
- 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 +29 -0
- package/src/api/users/providers/RealmProvider.ts +15 -0
- package/src/api/users/schemas/realmConfigSchema.ts +14 -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/atoms/buildOptions.ts +0 -12
- package/src/cli/core/commands/__tests__/BuildCommand.spec.ts +43 -0
- package/src/cli/core/commands/build.ts +105 -37
- 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 -3
- 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 +382 -56
- package/src/cli/core/tasks/BuildDockerTask.ts +33 -3
- package/src/cli/core/tasks/BuildPrerenderTask.ts +44 -7
- 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/i18n/__tests__/I18nCheckService.spec.ts +48 -0
- package/src/cli/i18n/services/I18nCheckService.ts +65 -11
- 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 +519 -190
- 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/mcp/__tests__/McpServerProvider.spec.ts +71 -0
- package/src/mcp/providers/McpServerProvider.ts +55 -0
- 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/form/__tests__/FormModel-submit-loading.spec.ts +71 -0
- package/src/react/form/__tests__/form-submitting-reactive.browser.spec.tsx +96 -0
- package/src/react/form/services/FormModel.ts +57 -39
- package/src/react/i18n/__tests__/I18nProvider.spec.ts +89 -0
- package/src/react/i18n/__tests__/locale-routing.spec.ts +107 -0
- package/src/react/i18n/components/Translate.tsx +47 -0
- package/src/react/i18n/index.ts +2 -0
- package/src/react/i18n/providers/I18nProvider.ts +171 -12
- package/src/react/intro/components/GettingStartedAdminSlide.tsx +2 -2
- package/src/react/router/__tests__/$page.spec.tsx +3 -2
- package/src/react/router/__tests__/RouterLocaleProvider.spec.ts +127 -0
- package/src/react/router/__tests__/page-can.spec.ts +18 -13
- package/src/react/router/hooks/useQueryParams.ts +114 -14
- package/src/react/router/index.browser.ts +4 -0
- package/src/react/router/index.shared.ts +1 -0
- package/src/react/router/index.ts +9 -0
- package/src/react/router/primitives/$page.ts +85 -4
- package/src/react/router/providers/ReactBrowserRouterProvider.ts +18 -8
- package/src/react/router/providers/ReactPageProvider.ts +12 -1
- package/src/react/router/providers/ReactServerProvider.ts +96 -14
- package/src/react/router/providers/RootComponentsProvider.ts +13 -0
- package/src/react/router/providers/RouterLocaleProvider.ts +125 -0
- package/src/react/router/providers/__tests__/RootComponentsProvider.spec.ts +15 -0
- package/src/react/router/providers/__tests__/rootComponents.ssr.browser.spec.tsx +67 -0
- package/src/react/sitemap/__tests__/$sitemap.spec.ts +131 -0
- package/src/react/sitemap/index.browser.ts +21 -0
- package/src/react/sitemap/index.ts +25 -0
- package/src/react/sitemap/primitives/$sitemap.browser.ts +26 -0
- package/src/react/sitemap/primitives/$sitemap.ts +196 -0
- package/src/react/ui/services/SchemaControl.ts +3 -4
- package/src/server/auth/__tests__/appleClientSecret.spec.ts +34 -0
- package/src/server/auth/__tests__/authFederationClient.spec.ts +40 -0
- package/src/server/auth/__tests__/federationAssertion.spec.ts +146 -0
- package/src/server/auth/__tests__/federationRedirectReplay.spec.ts +44 -0
- package/src/server/auth/helpers/appleClientSecret.ts +24 -0
- package/src/server/auth/helpers/federationAssertion.ts +74 -0
- package/src/server/auth/helpers/jtiReplayGuard.ts +41 -0
- package/src/server/auth/helpers/safeRedirectPath.ts +19 -0
- package/src/server/auth/index.ts +4 -0
- package/src/server/auth/primitives/$authFederationBroker.ts +273 -0
- package/src/server/auth/primitives/$authFederationClient.ts +89 -0
- package/src/server/auth/providers/ServerAuthProvider.ts +18 -4
- package/src/server/cookies/__tests__/ServerCookiesProvider.spec.ts +70 -0
- package/src/server/cookies/providers/ServerCookiesProvider.ts +23 -3
- package/src/server/core/interfaces/ServerRequest.ts +8 -0
- package/src/server/core/primitives/$route.ts +27 -0
- 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/tasks/BuildSitemapTask.ts +0 -130
- 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/api/audits/entities/audits.ts","../../../src/api/audits/schemas/auditQuerySchema.ts","../../../src/api/audits/schemas/createAuditSchema.ts","../../../src/api/audits/services/AuditService.ts","../../../src/api/audits/controllers/AdminAuditController.ts","../../../src/api/audits/primitives/$audit.ts","../../../src/orm/core/schemas/insertSchema.ts","../../../src/orm/core/schemas/updateSchema.ts","../../../src/orm/core/primitives/$entity.ts","../../../src/orm/core/constants/PG_SYMBOLS.ts","../../../src/orm/core/helpers/pgAttr.ts","../../../src/orm/core/schemas/databaseEnvSchema.ts","../../../src/api/audits/schemas/auditResourceSchema.ts","../../../src/api/audits/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/api/audits/entities/audits.ts","../../../src/api/audits/schemas/auditQuerySchema.ts","../../../src/api/audits/schemas/createAuditSchema.ts","../../../src/api/audits/services/AuditService.ts","../../../src/api/audits/controllers/AdminAuditController.ts","../../../src/api/audits/primitives/$audit.ts","../../../src/orm/core/schemas/insertSchema.ts","../../../src/orm/core/schemas/updateSchema.ts","../../../src/orm/core/primitives/$entity.ts","../../../src/orm/core/constants/PG_SYMBOLS.ts","../../../src/orm/core/helpers/pgAttr.ts","../../../src/orm/core/schemas/databaseEnvSchema.ts","../../../src/api/audits/schemas/auditResourceSchema.ts","../../../src/api/audits/index.ts"],"mappings":";;;;;;;;;cAOa,mBAAA,oBAAmB,OAAA;AAAA,KAKpB,aAAA,GAAgB,MAAM,QAAQ,mBAAA;;;;;;;;;AAL1C;cAgBa,MAAA,uBAAM,eAAA,mBAAA,OAAA;;;;EAXP;;;;;EAWC;;;;EAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA2GN,iBAAA,oBAAiB,OAAA;;;;;;;;;;;;;EAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cACjC,uBAAA,uBAAuB,aAAA,mBAAA,OAAA;;;;;;;;;;;;;;AAApC;;;EAA0D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAC9C,WAAA,GAAc,MAAM,QAAQ,MAAA,CAAO,MAAA;;;;;;cC5HlC,gBAAA,oBAAgB,OAAA;;;;;;;;;;;;;;;;KAcjB,UAAA,GAAa,MAAM,QAAQ,gBAAA;;;;;;cCf1B,iBAAA,oBAAiB,OAAA;;;;;;;;;;;;;;;;;;KAmBlB,WAAA,GAAc,MAAM,QAAQ,iBAAA;;;;;;UCXvB,mBAAA;EACf,IAAA;EACA,WAAA;EACA,OAAA;AAAA;AHXF;;;;AAAgC;AAKhC;;;;AALA,cGuBa,YAAA;EAAA,mBACQ,MAAA,EAAM,MAAA;EAAA,mBACN,GAAA,0BAAG,MAAA;EAAA,mBACH,IAAA,uBAAI,UAAA,mBAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;qBAKJ,UAAA,EAAU,GAAA,SAAA,mBAAA;;;;EAKtB,YAAA,CAAa,UAAA,EAAY,mBAAA;;;;EAWzB,kBAAA,IAAsB,mBAAA;;;;;;;;;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EACV,IAAA;AAAA,IACE,iBAAiB;EACjB,IAAA;AAAA;AAAA,UAGa,aAAA;EACf,IAAA;EACA,WAAW;AAAA;AAAA,UAGI,kBAAA;;;;EAIf,UAAA,EAAY,GAAG;;;;;;EAOf,IAAA;AAAA;AAAA,UAGe,YAAA;EACf,GAAA;IACE,IAAA;IACA,MAAA,EAAQ,eAAA;EAAA;EAEV,OAAA;IACE,QAAA,GAAW,kBAAA;IACX,QAAA,GAAW,kBAAA;EAAA;AAAA;;;;ATrE8C;AAW7D;KU8BY,MAAA,WAAiB,OAAA,gBAAuB,YAAA,IAAgB,CAAA,WAC5D,KAAA,GAAQ,SAAA,CAAU,CAAA;;;;;;;;;;;;;;;;cCvCb,iBAAA,oBAAiB,OAAA;;;;AXRE;AAKhC;;;;;;;YWiBY,GAAA,SAAY,OAAA,CAAQ,MAAA,QAAc,iBAAA;AAAA;;;;;;cCvBjC,mBAAA,oBAAmB,OAAA;sDAAgB,cAAA;;;;;;;;;;;;;;;;;;;;KAEpC,aAAA,GAAgB,MAAM,QAAQ,mBAAA;;;;;;;;;;AZD1C;;;;caoBa,eAAA,mBAAe,OAAA,kBAAA,MAAA"}
|
package/dist/api/audits/index.js
CHANGED
|
@@ -195,6 +195,17 @@ var AuditService = class {
|
|
|
195
195
|
return Array.from(this.auditTypes.values());
|
|
196
196
|
}
|
|
197
197
|
/**
|
|
198
|
+
* Distinct action names across all registered audit types, sorted.
|
|
199
|
+
*
|
|
200
|
+
* Sourced from the `$audit` type registry. Audit types register lazily —
|
|
201
|
+
* when their holder (e.g. `SessionAudits`, `ParameterAudits`) is first
|
|
202
|
+
* injected — so the admin filter only lists actions for audit domains that
|
|
203
|
+
* are actually in use, which is the intended behaviour.
|
|
204
|
+
*/
|
|
205
|
+
getDistinctActions() {
|
|
206
|
+
return [...new Set(this.getRegisteredTypes().flatMap((type) => type.actions))].sort();
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
198
209
|
* Get current request context if available.
|
|
199
210
|
*/
|
|
200
211
|
getRequestContext() {
|
|
@@ -224,11 +235,12 @@ var AuditService = class {
|
|
|
224
235
|
action: data.action,
|
|
225
236
|
userId: data.userId ?? contextData.userId
|
|
226
237
|
});
|
|
238
|
+
const success = data.success ?? true;
|
|
227
239
|
const entry = await this.repo.create({
|
|
228
240
|
...contextData,
|
|
229
241
|
...data,
|
|
230
|
-
severity: data.severity ?? "info",
|
|
231
|
-
success
|
|
242
|
+
severity: data.severity ?? (success ? "info" : "warning"),
|
|
243
|
+
success
|
|
232
244
|
});
|
|
233
245
|
this.log.debug("Audit entry created", {
|
|
234
246
|
id: entry.id,
|
|
@@ -248,60 +260,6 @@ var AuditService = class {
|
|
|
248
260
|
});
|
|
249
261
|
}
|
|
250
262
|
/**
|
|
251
|
-
* Record an authentication event.
|
|
252
|
-
*/
|
|
253
|
-
async recordAuth(action, options = {}) {
|
|
254
|
-
return this.create({
|
|
255
|
-
type: "auth",
|
|
256
|
-
action,
|
|
257
|
-
severity: action === "login_failed" ? "warning" : "info",
|
|
258
|
-
...options
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Record a user management event.
|
|
263
|
-
*/
|
|
264
|
-
async recordUser(action, options = {}) {
|
|
265
|
-
return this.create({
|
|
266
|
-
type: "user",
|
|
267
|
-
action,
|
|
268
|
-
resourceType: "user",
|
|
269
|
-
...options
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Record a data access event.
|
|
274
|
-
*/
|
|
275
|
-
async recordAccess(action, options = {}) {
|
|
276
|
-
return this.create({
|
|
277
|
-
type: "access",
|
|
278
|
-
action,
|
|
279
|
-
...options
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Record a security event.
|
|
284
|
-
*/
|
|
285
|
-
async recordSecurity(action, options = {}) {
|
|
286
|
-
return this.create({
|
|
287
|
-
type: "security",
|
|
288
|
-
action,
|
|
289
|
-
severity: "warning",
|
|
290
|
-
...options
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Record a system event.
|
|
295
|
-
*/
|
|
296
|
-
async recordSystem(action, options = {}) {
|
|
297
|
-
return this.create({
|
|
298
|
-
type: "system",
|
|
299
|
-
action,
|
|
300
|
-
severity: action === "error" ? "critical" : "info",
|
|
301
|
-
...options
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
263
|
* Find audit entries with filtering and pagination.
|
|
306
264
|
*/
|
|
307
265
|
async find(query = {}) {
|
|
@@ -550,6 +508,17 @@ var AdminAuditController = class {
|
|
|
550
508
|
})
|
|
551
509
|
});
|
|
552
510
|
/**
|
|
511
|
+
* List distinct action names present in the audit log (for filters).
|
|
512
|
+
*/
|
|
513
|
+
getAuditActions = $action({
|
|
514
|
+
path: `${this.url}/actions`,
|
|
515
|
+
group: this.group,
|
|
516
|
+
use: [$secure({ permissions: ["admin:audit:read"] })],
|
|
517
|
+
description: "List distinct action names present in the audit log",
|
|
518
|
+
schema: { response: t.array(t.text()) },
|
|
519
|
+
handler: () => this.auditService.getDistinctActions()
|
|
520
|
+
});
|
|
521
|
+
/**
|
|
553
522
|
* Get registered audit types.
|
|
554
523
|
*/
|
|
555
524
|
getTypes = $action({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/api/audits/entities/audits.ts","../../../src/api/audits/schemas/auditQuerySchema.ts","../../../src/api/audits/schemas/auditResourceSchema.ts","../../../src/api/audits/schemas/createAuditSchema.ts","../../../src/api/audits/services/AuditService.ts","../../../src/api/audits/controllers/AdminAuditController.ts","../../../src/api/audits/primitives/$audit.ts","../../../src/api/audits/index.ts"],"sourcesContent":["import type { Static } from \"alepha\";\nimport { t } from \"alepha\";\nimport { $entity, db } from \"alepha/orm\";\n\n/**\n * Audit severity levels for categorizing events.\n */\nexport const auditSeveritySchema = t.enum([\"info\", \"warning\", \"critical\"], {\n default: \"info\",\n description: \"Severity level of the audit event\",\n});\n\nexport type AuditSeverity = Static<typeof auditSeveritySchema>;\n\n/**\n * Audit log entity for tracking important system events.\n *\n * Stores comprehensive audit information including:\n * - Who performed the action (userId, userRealm)\n * - What happened (type, action, resource)\n * - When it happened (createdAt)\n * - Context and details (metadata, ipAddress, userAgent)\n */\nexport const audits = $entity({\n name: \"audits\",\n schema: t.object({\n id: db.primaryKey(t.bigint()),\n createdAt: db.createdAt(),\n organizationId: db.organization(),\n\n /**\n * Audit event type (e.g., \"auth\", \"user\", \"payment\", \"system\").\n * Used for categorizing and filtering audit events.\n */\n type: t.text({\n description: \"Audit event type (e.g., auth, user, payment, system)\",\n }),\n\n /**\n * Specific action performed (e.g., \"login\", \"logout\", \"create\", \"update\", \"delete\").\n */\n action: t.text({\n description: \"Specific action performed (e.g., login, create, update)\",\n }),\n\n /**\n * Severity level of the event.\n */\n severity: db.default(auditSeveritySchema, \"info\"),\n\n /**\n * User ID who performed the action (null for system events).\n */\n userId: t.optional(t.uuid()),\n\n /**\n * User realm for multi-tenant support.\n */\n userRealm: t.optional(t.text()),\n\n /**\n * User email at the time of the event (denormalized for history).\n */\n userEmail: t.optional(t.email()),\n\n /**\n * Resource type affected (e.g., \"user\", \"order\", \"file\").\n */\n resourceType: t.optional(t.text()),\n\n /**\n * Resource ID affected.\n */\n resourceId: t.optional(t.text()),\n\n /**\n * Human-readable description of the event.\n */\n description: t.optional(t.text()),\n\n /**\n * Additional metadata/context as JSON.\n */\n metadata: t.optional(t.json()),\n\n /**\n * Client IP address.\n */\n ipAddress: t.optional(t.text()),\n\n /**\n * Client user agent.\n */\n userAgent: t.optional(t.text()),\n\n /**\n * Session ID if applicable.\n */\n sessionId: t.optional(t.uuid()),\n\n /**\n * Request ID for correlation.\n */\n requestId: t.optional(t.text()),\n\n /**\n * Whether the action was successful.\n */\n success: db.default(t.boolean(), true),\n\n /**\n * Error message if the action failed.\n */\n errorMessage: t.optional(t.text()),\n }),\n indexes: [\n \"createdAt\",\n \"type\",\n \"action\",\n \"userId\",\n \"userRealm\",\n \"resourceType\",\n \"resourceId\",\n \"severity\",\n { columns: [\"type\", \"action\"] },\n { columns: [\"userId\", \"createdAt\"] },\n { columns: [\"userRealm\", \"createdAt\"] },\n ],\n});\n\nexport const auditEntitySchema = audits.schema;\nexport const auditEntityInsertSchema = audits.insertSchema;\nexport type AuditEntity = Static<typeof audits.schema>;\n","import type { Static } from \"alepha\";\nimport { t } from \"alepha\";\nimport { pageQuerySchema } from \"alepha/orm\";\nimport { auditSeveritySchema } from \"../entities/audits.ts\";\n\n/**\n * Query schema for searching and filtering audit logs.\n */\nexport const auditQuerySchema = t.extend(pageQuerySchema, {\n type: t.optional(t.text({ description: \"Filter by audit type\" })),\n action: t.optional(t.text({ description: \"Filter by action\" })),\n severity: t.optional(auditSeveritySchema),\n userId: t.optional(t.uuid({ description: \"Filter by user ID\" })),\n userRealm: t.optional(t.text({ description: \"Filter by user realm\" })),\n resourceType: t.optional(t.text({ description: \"Filter by resource type\" })),\n resourceId: t.optional(t.text({ description: \"Filter by resource ID\" })),\n success: t.optional(t.boolean({ description: \"Filter by success status\" })),\n from: t.optional(t.datetime({ description: \"Start date filter\" })),\n to: t.optional(t.datetime({ description: \"End date filter\" })),\n search: t.optional(t.text({ description: \"Search in description\" })),\n});\n\nexport type AuditQuery = Static<typeof auditQuerySchema>;\n","import type { Static } from \"alepha\";\nimport { audits } from \"../entities/audits.ts\";\n\n/**\n * Resource schema for audit log responses.\n */\nexport const auditResourceSchema = audits.schema;\n\nexport type AuditResource = Static<typeof auditResourceSchema>;\n","import type { Static } from \"alepha\";\nimport { t } from \"alepha\";\nimport { auditSeveritySchema } from \"../entities/audits.ts\";\n\n/**\n * Schema for creating a new audit log entry.\n */\nexport const createAuditSchema = t.object({\n type: t.text({ description: \"Audit event type\" }),\n action: t.text({ description: \"Specific action performed\" }),\n severity: t.optional(auditSeveritySchema),\n userId: t.optional(t.uuid()),\n userRealm: t.optional(t.text()),\n userEmail: t.optional(t.email()),\n resourceType: t.optional(t.text()),\n resourceId: t.optional(t.text()),\n description: t.optional(t.text()),\n metadata: t.optional(t.json()),\n ipAddress: t.optional(t.text()),\n userAgent: t.optional(t.text()),\n sessionId: t.optional(t.uuid()),\n requestId: t.optional(t.text()),\n success: t.optional(t.boolean()),\n errorMessage: t.optional(t.text()),\n});\n\nexport type CreateAudit = Static<typeof createAuditSchema>;\n","import { $inject, Alepha } from \"alepha\";\nimport { $logger } from \"alepha/logger\";\nimport { $repository, type Page } from \"alepha/orm\";\nimport type { ServerRequest } from \"alepha/server\";\nimport {\n type AuditEntity,\n type AuditSeverity,\n audits,\n} from \"../entities/audits.ts\";\nimport type { AuditQuery } from \"../schemas/auditQuerySchema.ts\";\nimport type { CreateAudit } from \"../schemas/createAuditSchema.ts\";\n\n/**\n * Registered audit type definition.\n */\nexport interface AuditTypeDefinition {\n type: string;\n description?: string;\n actions: string[];\n}\n\n/**\n * Service for managing audit logs.\n *\n * Provides methods for:\n * - Creating audit entries\n * - Querying audit history\n * - Aggregating audit statistics\n * - Managing registered audit types\n */\nexport class AuditService {\n protected readonly alepha = $inject(Alepha);\n protected readonly log = $logger();\n protected readonly repo = $repository(audits);\n\n /**\n * Registry of audit types and their allowed actions.\n */\n protected readonly auditTypes = new Map<string, AuditTypeDefinition>();\n\n /**\n * Register an audit type with its allowed actions.\n */\n public registerType(definition: AuditTypeDefinition): void {\n this.auditTypes.set(definition.type, definition);\n this.log.debug(\"Audit type registered\", {\n type: definition.type,\n actions: definition.actions,\n });\n }\n\n /**\n * Get all registered audit types.\n */\n public getRegisteredTypes(): AuditTypeDefinition[] {\n return Array.from(this.auditTypes.values());\n }\n\n /**\n * Get current request context if available.\n */\n protected getRequestContext(): ServerRequest | undefined {\n return this.alepha.store.get(\"alepha.http.request\");\n }\n\n /**\n * Create a new audit log entry.\n * Automatically populates ipAddress, userAgent, and requestId from the current request context.\n */\n public async create(data: CreateAudit): Promise<AuditEntity> {\n const request = this.getRequestContext();\n\n // Auto-populate from request context if not provided\n const contextData: Partial<CreateAudit> = {};\n\n if (request) {\n if (!data.ipAddress && request.ip) {\n contextData.ipAddress = request.ip;\n }\n if (!data.userAgent && request.headers[\"user-agent\"]) {\n contextData.userAgent = request.headers[\"user-agent\"];\n }\n if (!data.requestId && request.requestId) {\n contextData.requestId = request.requestId;\n }\n // Check for session in metadata\n if (!data.sessionId && request.metadata?.sessionId) {\n contextData.sessionId = request.metadata.sessionId;\n }\n // Extract user from request.user (set by ServerSecurityProvider)\n const user = request.user;\n if (user) {\n if (!data.userId && user.id) {\n contextData.userId = user.id;\n }\n if (!data.userEmail && user.email) {\n contextData.userEmail = user.email;\n }\n if (!data.userRealm && user.realm) {\n contextData.userRealm = user.realm;\n }\n }\n }\n\n this.log.trace(\"Creating audit entry\", {\n type: data.type,\n action: data.action,\n userId: data.userId ?? contextData.userId,\n });\n\n const entry = await this.repo.create({\n ...contextData,\n ...data,\n severity: data.severity ?? \"info\",\n success: data.success ?? true,\n });\n\n this.log.debug(\"Audit entry created\", {\n id: entry.id,\n type: data.type,\n action: data.action,\n });\n\n return entry;\n }\n\n /**\n * Record an audit event (convenience method).\n */\n public async record(\n type: string,\n action: string,\n options: Omit<CreateAudit, \"type\" | \"action\"> = {},\n ): Promise<AuditEntity> {\n return this.create({ type, action, ...options });\n }\n\n /**\n * Record an authentication event.\n */\n public async recordAuth(\n action:\n | \"login\"\n | \"logout\"\n | \"login_failed\"\n | \"token_refresh\"\n | \"mfa_setup\"\n | \"mfa_verify\",\n options: Omit<CreateAudit, \"type\" | \"action\"> = {},\n ): Promise<AuditEntity> {\n return this.create({\n type: \"auth\",\n action,\n severity: action === \"login_failed\" ? \"warning\" : \"info\",\n ...options,\n });\n }\n\n /**\n * Record a user management event.\n */\n public async recordUser(\n action:\n | \"create\"\n | \"update\"\n | \"delete\"\n | \"enable\"\n | \"disable\"\n | \"role_change\",\n options: Omit<CreateAudit, \"type\" | \"action\"> = {},\n ): Promise<AuditEntity> {\n return this.create({\n type: \"user\",\n action,\n resourceType: \"user\",\n ...options,\n });\n }\n\n /**\n * Record a data access event.\n */\n public async recordAccess(\n action: \"view\" | \"export\" | \"download\",\n options: Omit<CreateAudit, \"type\" | \"action\"> = {},\n ): Promise<AuditEntity> {\n return this.create({ type: \"access\", action, ...options });\n }\n\n /**\n * Record a security event.\n */\n public async recordSecurity(\n action:\n | \"permission_denied\"\n | \"suspicious_activity\"\n | \"rate_limited\"\n | \"blocked\",\n options: Omit<CreateAudit, \"type\" | \"action\"> = {},\n ): Promise<AuditEntity> {\n return this.create({\n type: \"security\",\n action,\n severity: \"warning\",\n ...options,\n });\n }\n\n /**\n * Record a system event.\n */\n public async recordSystem(\n action: \"startup\" | \"shutdown\" | \"config_change\" | \"maintenance\" | \"error\",\n options: Omit<CreateAudit, \"type\" | \"action\"> = {},\n ): Promise<AuditEntity> {\n return this.create({\n type: \"system\",\n action,\n severity: action === \"error\" ? \"critical\" : \"info\",\n ...options,\n });\n }\n\n /**\n * Find audit entries with filtering and pagination.\n */\n public async find(query: AuditQuery = {}): Promise<Page<AuditEntity>> {\n this.log.trace(\"Finding audit entries\", { query });\n\n query.sort ??= \"-createdAt\";\n\n const where = this.repo.createQueryWhere();\n\n if (query.type) {\n where.type = { eq: query.type };\n }\n\n if (query.action) {\n where.action = { eq: query.action };\n }\n\n if (query.severity) {\n where.severity = { eq: query.severity };\n }\n\n if (query.userId) {\n where.userId = { eq: query.userId };\n }\n\n if (query.userRealm) {\n where.userRealm = { eq: query.userRealm };\n }\n\n if (query.resourceType) {\n where.resourceType = { eq: query.resourceType };\n }\n\n if (query.resourceId) {\n where.resourceId = { eq: query.resourceId };\n }\n\n if (query.success !== undefined) {\n where.success = { eq: query.success };\n }\n\n if (query.from) {\n where.createdAt = { ...(where.createdAt as object), gte: query.from };\n }\n\n if (query.to) {\n where.createdAt = { ...(where.createdAt as object), lte: query.to };\n }\n\n if (query.search) {\n where.description = { like: `%${query.search}%` };\n }\n\n const result = await this.repo.paginate(query, { where }, { count: true });\n\n this.log.debug(\"Audit entries found\", {\n count: result.content.length,\n total: result.page.totalElements,\n });\n\n return result;\n }\n\n /**\n * Get audit entry by ID.\n */\n public async getById(id: string): Promise<AuditEntity> {\n return this.repo.getById(id);\n }\n\n /**\n * Get audit entries for a specific user.\n */\n public async findByUser(\n userId: string,\n query: Omit<AuditQuery, \"userId\"> = {},\n ): Promise<Page<AuditEntity>> {\n return this.find({ ...query, userId });\n }\n\n /**\n * Get audit entries for a specific resource.\n */\n public async findByResource(\n resourceType: string,\n resourceId: string,\n query: Omit<AuditQuery, \"resourceType\" | \"resourceId\"> = {},\n ): Promise<Page<AuditEntity>> {\n return this.find({ ...query, resourceType, resourceId });\n }\n\n /**\n * Get audit statistics for a time period.\n */\n public async getStats(\n options: { from?: Date; to?: Date; userRealm?: string } = {},\n ): Promise<AuditStats> {\n this.log.trace(\"Getting audit stats\", options);\n\n const where = this.repo.createQueryWhere();\n\n if (options.from) {\n where.createdAt = { gte: options.from.toISOString() };\n }\n\n if (options.to) {\n where.createdAt = {\n ...(where.createdAt as object),\n lte: options.to.toISOString(),\n };\n }\n\n if (options.userRealm) {\n where.userRealm = { eq: options.userRealm };\n }\n\n const all = await this.repo.findMany({ where });\n\n const stats: AuditStats = {\n total: all.length,\n byType: {},\n bySeverity: { info: 0, warning: 0, critical: 0 },\n successRate: 0,\n recentFailures: [],\n };\n\n let successCount = 0;\n\n for (const entry of all) {\n // Count by type\n stats.byType[entry.type] = (stats.byType[entry.type] || 0) + 1;\n\n // Count by severity\n const severity = entry.severity as AuditSeverity;\n stats.bySeverity[severity]++;\n\n // Count successes\n if (entry.success) {\n successCount++;\n }\n }\n\n stats.successRate = stats.total > 0 ? successCount / stats.total : 1;\n\n // Get recent failures\n const failures = all\n .filter((e) => !e.success)\n .sort(\n (a, b) =>\n new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime(),\n )\n .slice(0, 10);\n\n stats.recentFailures = failures;\n\n return stats;\n }\n\n /**\n * Delete old audit entries (for retention policy).\n */\n public async deleteOlderThan(date: Date): Promise<number> {\n this.log.info(\"Deleting old audit entries\", { olderThan: date });\n\n const old = await this.repo.findMany({\n where: { createdAt: { lt: date.toISOString() } },\n });\n\n for (const entry of old) {\n await this.repo.deleteById(entry.id);\n }\n\n this.log.info(\"Old audit entries deleted\", { count: old.length });\n\n return old.length;\n }\n}\n\n/**\n * Audit statistics summary.\n */\nexport interface AuditStats {\n total: number;\n byType: Record<string, number>;\n bySeverity: Record<AuditSeverity, number>;\n successRate: number;\n recentFailures: AuditEntity[];\n}\n","import { $inject, t } from \"alepha\";\nimport { $repository } from \"alepha/orm\";\nimport { $secure } from \"alepha/security\";\nimport { $action } from \"alepha/server\";\nimport { audits } from \"../entities/audits.ts\";\nimport { auditQuerySchema } from \"../schemas/auditQuerySchema.ts\";\nimport { auditResourceSchema } from \"../schemas/auditResourceSchema.ts\";\nimport { createAuditSchema } from \"../schemas/createAuditSchema.ts\";\nimport { AuditService } from \"../services/AuditService.ts\";\n\n/**\n * REST API controller for audit log management.\n *\n * Provides endpoints for:\n * - Querying audit logs with filtering\n * - Creating audit entries\n * - Getting audit statistics\n * - Viewing registered audit types\n */\nexport class AdminAuditController {\n protected readonly url = \"/audits\";\n protected readonly group = \"admin:audits\";\n protected readonly auditService = $inject(AuditService);\n protected readonly repo = $repository(audits);\n\n /**\n * Find audit entries with filtering and pagination.\n */\n public readonly findAudits = $action({\n path: this.url,\n group: this.group,\n use: [$secure({ permissions: [\"admin:audit:read\"] })],\n description: \"Find audit entries with filtering and pagination\",\n schema: {\n query: auditQuerySchema,\n response: t.page(auditResourceSchema),\n },\n handler: ({ query }) => this.auditService.find(query),\n });\n\n /**\n * Get a single audit entry by ID.\n */\n public readonly getAudit = $action({\n path: `${this.url}/:id`,\n group: this.group,\n use: [$secure({ permissions: [\"admin:audit:read\"] })],\n description: \"Get a single audit entry by ID\",\n schema: {\n params: t.object({\n id: t.text(),\n }),\n response: auditResourceSchema,\n },\n handler: ({ params }) => this.auditService.getById(params.id),\n });\n\n /**\n * Delete many audit entries by id in one repository call. Use with care —\n * audit logs are usually retained for compliance reasons.\n */\n public readonly deleteAudits = $action({\n method: \"POST\",\n path: `${this.url}/delete`,\n group: this.group,\n use: [$secure({ permissions: [\"admin:audit:delete\"] })],\n description: \"Delete many audit entries\",\n schema: {\n body: t.object({\n ids: t.array(t.text(), { minItems: 1, maxItems: 1000 }),\n }),\n response: t.object({\n deleted: t.array(t.text()),\n }),\n },\n handler: async ({ body }) => {\n const deleted = await this.repo.deleteMany({\n id: { inArray: body.ids },\n });\n return { deleted: deleted.map(String) };\n },\n });\n\n /**\n * Create a new audit entry.\n * System-only — this permission should never be assigned to human roles.\n */\n public readonly createAudit = $action({\n method: \"POST\",\n path: this.url,\n group: this.group,\n use: [$secure({ permissions: [\"admin:audit:create\"] })],\n description: \"Create a new audit entry\",\n schema: {\n body: createAuditSchema,\n response: auditResourceSchema,\n },\n handler: ({ body }) => this.auditService.create(body),\n });\n\n /**\n * Get audit entries for a specific user.\n */\n public readonly findByUser = $action({\n path: `${this.url}/user/:userId`,\n group: this.group,\n use: [$secure({ permissions: [\"admin:audit:read\"] })],\n description: \"Get audit entries for a specific user\",\n schema: {\n params: t.object({\n userId: t.uuid(),\n }),\n query: t.omit(auditQuerySchema, [\"userId\"]),\n response: t.page(auditResourceSchema),\n },\n handler: ({ params, query }) =>\n this.auditService.findByUser(params.userId, query),\n });\n\n /**\n * Get audit entries for a specific resource.\n */\n public readonly findByResource = $action({\n path: `${this.url}/resource/:resourceType/:resourceId`,\n group: this.group,\n use: [$secure({ permissions: [\"admin:audit:read\"] })],\n description: \"Get audit entries for a specific resource\",\n schema: {\n params: t.object({\n resourceType: t.text(),\n resourceId: t.text(),\n }),\n query: t.omit(auditQuerySchema, [\"resourceType\", \"resourceId\"]),\n response: t.page(auditResourceSchema),\n },\n handler: ({ params, query }) =>\n this.auditService.findByResource(\n params.resourceType,\n params.resourceId,\n query,\n ),\n });\n\n /**\n * Get audit statistics.\n */\n public readonly getAuditStats = $action({\n path: `${this.url}/stats`,\n group: this.group,\n use: [$secure({ permissions: [\"admin:audit:read\"] })],\n description: \"Get audit statistics for a time period\",\n schema: {\n query: t.object({\n from: t.optional(t.datetime()),\n to: t.optional(t.datetime()),\n userRealm: t.optional(t.text()),\n }),\n response: t.object({\n total: t.integer(),\n byType: t.record(t.text(), t.integer()),\n bySeverity: t.object({\n info: t.integer(),\n warning: t.integer(),\n critical: t.integer(),\n }),\n successRate: t.number(),\n recentFailures: t.array(auditResourceSchema),\n }),\n },\n handler: ({ query }) =>\n this.auditService.getStats({\n from: query.from ? new Date(query.from) : undefined,\n to: query.to ? new Date(query.to) : undefined,\n userRealm: query.userRealm,\n }),\n });\n\n /**\n * Get registered audit types.\n */\n public readonly getTypes = $action({\n path: `${this.url}/types`,\n group: this.group,\n use: [$secure({ permissions: [\"admin:audit:read\"] })],\n description: \"Get all registered audit types\",\n schema: {\n response: t.array(\n t.object({\n type: t.text(),\n description: t.optional(t.text()),\n actions: t.array(t.text()),\n }),\n ),\n },\n handler: () => this.auditService.getRegisteredTypes(),\n });\n\n /**\n * Get distinct values for filters.\n */\n public readonly getFilterOptions = $action({\n path: `${this.url}/filters`,\n group: this.group,\n use: [$secure({ permissions: [\"admin:audit:read\"] })],\n description: \"Get distinct values for audit filters\",\n schema: {\n response: t.object({\n types: t.array(t.text()),\n actions: t.array(t.text()),\n resourceTypes: t.array(t.text()),\n userRealms: t.array(t.text()),\n }),\n },\n handler: async () => {\n const types = this.auditService.getRegisteredTypes();\n return {\n types: types.map((t) => t.type),\n actions: types.flatMap((t) => t.actions),\n resourceTypes: [\"user\", \"session\", \"file\", \"order\", \"payment\"],\n userRealms: [\"default\"],\n };\n },\n });\n}\n","import { $inject, createPrimitive, KIND, Primitive } from \"alepha\";\nimport {\n AuditService,\n type AuditTypeDefinition,\n} from \"../services/AuditService.ts\";\n\n/**\n * Options for creating an audit type primitive.\n */\nexport interface AuditPrimitiveOptions {\n /**\n * Unique audit type identifier (e.g., \"auth\", \"payment\", \"order\").\n */\n type: string;\n\n /**\n * Human-readable description of this audit type.\n */\n description?: string;\n\n /**\n * List of allowed actions for this audit type.\n */\n actions: string[];\n}\n\n/**\n * Audit type primitive for registering domain-specific audit events.\n *\n * Provides a type-safe way to define and log audit events within a specific domain.\n *\n * @example\n * ```ts\n * class PaymentAudits {\n * audit = $audit({\n * type: \"payment\",\n * description: \"Payment-related audit events\",\n * actions: [\"create\", \"refund\", \"cancel\", \"dispute\"],\n * });\n *\n * async logPaymentCreated(paymentId: string, userId: string, amount: number) {\n * await this.audit.log(\"create\", {\n * userId,\n * resourceType: \"payment\",\n * resourceId: paymentId,\n * description: `Payment of ${amount} created`,\n * metadata: { amount },\n * });\n * }\n * }\n * ```\n */\nexport class AuditPrimitive extends Primitive<AuditPrimitiveOptions> {\n protected readonly auditService = $inject(AuditService);\n\n /**\n * The audit type identifier.\n */\n public get type(): string {\n return this.options.type;\n }\n\n /**\n * The audit type description.\n */\n public get description(): string | undefined {\n return this.options.description;\n }\n\n /**\n * The allowed actions for this audit type.\n */\n public get actions(): string[] {\n return this.options.actions;\n }\n\n /**\n * Log an audit event for this type.\n */\n public async log(\n action: string,\n options: AuditLogOptions = {},\n ): Promise<void> {\n await this.auditService.record(this.options.type, action, options);\n }\n\n /**\n * Log a successful audit event.\n */\n public async logSuccess(\n action: string,\n options: Omit<AuditLogOptions, \"success\"> = {},\n ): Promise<void> {\n await this.log(action, { ...options, success: true });\n }\n\n /**\n * Log a failed audit event.\n */\n public async logFailure(\n action: string,\n errorMessage: string,\n options: Omit<AuditLogOptions, \"success\" | \"errorMessage\"> = {},\n ): Promise<void> {\n await this.log(action, { ...options, success: false, errorMessage });\n }\n\n /**\n * Called during initialization to register this audit type.\n */\n protected onInit(): void {\n const definition: AuditTypeDefinition = {\n type: this.options.type,\n description: this.options.description,\n actions: this.options.actions,\n };\n this.auditService.registerType(definition);\n }\n}\n\n/**\n * Options for logging an audit event.\n */\nexport interface AuditLogOptions {\n severity?: \"info\" | \"warning\" | \"critical\";\n userId?: string;\n userRealm?: string;\n userEmail?: string;\n resourceType?: string;\n resourceId?: string;\n description?: string;\n metadata?: Record<string, unknown>;\n ipAddress?: string;\n userAgent?: string;\n sessionId?: string;\n requestId?: string;\n success?: boolean;\n errorMessage?: string;\n}\n\n/**\n * Create an audit type primitive.\n *\n * @example\n * ```ts\n * class OrderAudits {\n * audit = $audit({\n * type: \"order\",\n * description: \"Order management events\",\n * actions: [\"create\", \"update\", \"cancel\", \"fulfill\", \"ship\"],\n * });\n * }\n * ```\n */\nexport const $audit = (options: AuditPrimitiveOptions) => {\n return createPrimitive(AuditPrimitive, options);\n};\n\n$audit[KIND] = AuditPrimitive;\n","import { $module } from \"alepha\";\nimport { AdminAuditController } from \"./controllers/AdminAuditController.ts\";\nimport { AuditService } from \"./services/AuditService.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport * from \"./controllers/AdminAuditController.ts\";\nexport * from \"./entities/audits.ts\";\nexport * from \"./primitives/$audit.ts\";\nexport * from \"./schemas/auditQuerySchema.ts\";\nexport * from \"./schemas/auditResourceSchema.ts\";\nexport * from \"./schemas/createAuditSchema.ts\";\nexport * from \"./services/AuditService.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * Audit trail for compliance.\n *\n * **Features:**\n * - Domain-specific audit types\n * - Audit event logging\n * - Filtering and searching\n * - User action tracking\n *\n * @module alepha.api.audits\n */\nexport const AlephaApiAudits = $module({\n name: \"alepha.api.audits\",\n services: [AuditService, AdminAuditController],\n});\n"],"mappings":";;;;;;;;;AAOA,MAAa,sBAAsB,EAAE,KAAK;CAAC;CAAQ;CAAW;CAAW,EAAE;CACzE,SAAS;CACT,aAAa;CACd,CAAC;;;;;;;;;;AAaF,MAAa,SAAS,QAAQ;CAC5B,MAAM;CACN,QAAQ,EAAE,OAAO;EACf,IAAI,GAAG,WAAW,EAAE,QAAQ,CAAC;EAC7B,WAAW,GAAG,WAA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AC1B,SAAS,KAAK,QAAQ;GACvB;EACD,KAAK,aAAa,aAAa,WAAW;;;;;;;;;;;;;;;;;AAsC9C,MAAa,UAAU,YAAmC;CACxD,OAAO,gBAAgB,gBAAgB,QAAQ;;AAGjD,OAAO,QAAQ;;;;;;;;;;;;;;ACnIf,MAAa,kBAAkB,QAAQ;CACrC,MAAM;CACN,UAAU,CAAC,cAAc,qBAAqB;CAC/C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/api/audits/entities/audits.ts","../../../src/api/audits/schemas/auditQuerySchema.ts","../../../src/api/audits/schemas/auditResourceSchema.ts","../../../src/api/audits/schemas/createAuditSchema.ts","../../../src/api/audits/services/AuditService.ts","../../../src/api/audits/controllers/AdminAuditController.ts","../../../src/api/audits/primitives/$audit.ts","../../../src/api/audits/index.ts"],"sourcesContent":["import type { Static } from \"alepha\";\nimport { t } from \"alepha\";\nimport { $entity, db } from \"alepha/orm\";\n\n/**\n * Audit severity levels for categorizing events.\n */\nexport const auditSeveritySchema = t.enum([\"info\", \"warning\", \"critical\"], {\n default: \"info\",\n description: \"Severity level of the audit event\",\n});\n\nexport type AuditSeverity = Static<typeof auditSeveritySchema>;\n\n/**\n * Audit log entity for tracking important system events.\n *\n * Stores comprehensive audit information including:\n * - Who performed the action (userId, userRealm)\n * - What happened (type, action, resource)\n * - When it happened (createdAt)\n * - Context and details (metadata, ipAddress, userAgent)\n */\nexport const audits = $entity({\n name: \"audits\",\n schema: t.object({\n id: db.primaryKey(t.bigint()),\n createdAt: db.createdAt(),\n organizationId: db.organization(),\n\n /**\n * Audit event type (e.g., \"auth\", \"user\", \"payment\", \"system\").\n * Used for categorizing and filtering audit events.\n */\n type: t.text({\n description: \"Audit event type (e.g., auth, user, payment, system)\",\n }),\n\n /**\n * Specific action performed (e.g., \"login\", \"logout\", \"create\", \"update\", \"delete\").\n */\n action: t.text({\n description: \"Specific action performed (e.g., login, create, update)\",\n }),\n\n /**\n * Severity level of the event.\n */\n severity: db.default(auditSeveritySchema, \"info\"),\n\n /**\n * User ID who performed the action (null for system events).\n */\n userId: t.optional(t.uuid()),\n\n /**\n * User realm for multi-tenant support.\n */\n userRealm: t.optional(t.text()),\n\n /**\n * User email at the time of the event (denormalized for history).\n */\n userEmail: t.optional(t.email()),\n\n /**\n * Resource type affected (e.g., \"user\", \"order\", \"file\").\n */\n resourceType: t.optional(t.text()),\n\n /**\n * Resource ID affected.\n */\n resourceId: t.optional(t.text()),\n\n /**\n * Human-readable description of the event.\n */\n description: t.optional(t.text()),\n\n /**\n * Additional metadata/context as JSON.\n */\n metadata: t.optional(t.json()),\n\n /**\n * Client IP address.\n */\n ipAddress: t.optional(t.text()),\n\n /**\n * Client user agent.\n */\n userAgent: t.optional(t.text()),\n\n /**\n * Session ID if applicable.\n */\n sessionId: t.optional(t.uuid()),\n\n /**\n * Request ID for correlation.\n */\n requestId: t.optional(t.text()),\n\n /**\n * Whether the action was successful.\n */\n success: db.default(t.boolean(), true),\n\n /**\n * Error message if the action failed.\n */\n errorMessage: t.optional(t.text()),\n }),\n indexes: [\n \"createdAt\",\n \"type\",\n \"action\",\n \"userId\",\n \"userRealm\",\n \"resourceType\",\n \"resourceId\",\n \"severity\",\n { columns: [\"type\", \"action\"] },\n { columns: [\"userId\", \"createdAt\"] },\n { columns: [\"userRealm\", \"createdAt\"] },\n ],\n});\n\nexport const auditEntitySchema = audits.schema;\nexport const auditEntityInsertSchema = audits.insertSchema;\nexport type AuditEntity = Static<typeof audits.schema>;\n","import type { Static } from \"alepha\";\nimport { t } from \"alepha\";\nimport { pageQuerySchema } from \"alepha/orm\";\nimport { auditSeveritySchema } from \"../entities/audits.ts\";\n\n/**\n * Query schema for searching and filtering audit logs.\n */\nexport const auditQuerySchema = t.extend(pageQuerySchema, {\n type: t.optional(t.text({ description: \"Filter by audit type\" })),\n action: t.optional(t.text({ description: \"Filter by action\" })),\n severity: t.optional(auditSeveritySchema),\n userId: t.optional(t.uuid({ description: \"Filter by user ID\" })),\n userRealm: t.optional(t.text({ description: \"Filter by user realm\" })),\n resourceType: t.optional(t.text({ description: \"Filter by resource type\" })),\n resourceId: t.optional(t.text({ description: \"Filter by resource ID\" })),\n success: t.optional(t.boolean({ description: \"Filter by success status\" })),\n from: t.optional(t.datetime({ description: \"Start date filter\" })),\n to: t.optional(t.datetime({ description: \"End date filter\" })),\n search: t.optional(t.text({ description: \"Search in description\" })),\n});\n\nexport type AuditQuery = Static<typeof auditQuerySchema>;\n","import type { Static } from \"alepha\";\nimport { audits } from \"../entities/audits.ts\";\n\n/**\n * Resource schema for audit log responses.\n */\nexport const auditResourceSchema = audits.schema;\n\nexport type AuditResource = Static<typeof auditResourceSchema>;\n","import type { Static } from \"alepha\";\nimport { t } from \"alepha\";\nimport { auditSeveritySchema } from \"../entities/audits.ts\";\n\n/**\n * Schema for creating a new audit log entry.\n */\nexport const createAuditSchema = t.object({\n type: t.text({ description: \"Audit event type\" }),\n action: t.text({ description: \"Specific action performed\" }),\n severity: t.optional(auditSeveritySchema),\n userId: t.optional(t.uuid()),\n userRealm: t.optional(t.text()),\n userEmail: t.optional(t.email()),\n resourceType: t.optional(t.text()),\n resourceId: t.optional(t.text()),\n description: t.optional(t.text()),\n metadata: t.optional(t.json()),\n ipAddress: t.optional(t.text()),\n userAgent: t.optional(t.text()),\n sessionId: t.optional(t.uuid()),\n requestId: t.optional(t.text()),\n success: t.optional(t.boolean()),\n errorMessage: t.optional(t.text()),\n});\n\nexport type CreateAudit = Static<typeof createAuditSchema>;\n","import { $inject, Alepha } from \"alepha\";\nimport { $logger } from \"alepha/logger\";\nimport { $repository, type Page } from \"alepha/orm\";\nimport type { ServerRequest } from \"alepha/server\";\nimport {\n type AuditEntity,\n type AuditSeverity,\n audits,\n} from \"../entities/audits.ts\";\nimport type { AuditQuery } from \"../schemas/auditQuerySchema.ts\";\nimport type { CreateAudit } from \"../schemas/createAuditSchema.ts\";\n\n/**\n * Registered audit type definition.\n */\nexport interface AuditTypeDefinition {\n type: string;\n description?: string;\n actions: string[];\n}\n\n/**\n * Service for managing audit logs.\n *\n * Provides methods for:\n * - Creating audit entries\n * - Querying audit history\n * - Aggregating audit statistics\n * - Managing registered audit types\n */\nexport class AuditService {\n protected readonly alepha = $inject(Alepha);\n protected readonly log = $logger();\n protected readonly repo = $repository(audits);\n\n /**\n * Registry of audit types and their allowed actions.\n */\n protected readonly auditTypes = new Map<string, AuditTypeDefinition>();\n\n /**\n * Register an audit type with its allowed actions.\n */\n public registerType(definition: AuditTypeDefinition): void {\n this.auditTypes.set(definition.type, definition);\n this.log.debug(\"Audit type registered\", {\n type: definition.type,\n actions: definition.actions,\n });\n }\n\n /**\n * Get all registered audit types.\n */\n public getRegisteredTypes(): AuditTypeDefinition[] {\n return Array.from(this.auditTypes.values());\n }\n\n /**\n * Distinct action names across all registered audit types, sorted.\n *\n * Sourced from the `$audit` type registry. Audit types register lazily —\n * when their holder (e.g. `SessionAudits`, `ParameterAudits`) is first\n * injected — so the admin filter only lists actions for audit domains that\n * are actually in use, which is the intended behaviour.\n */\n public getDistinctActions(): string[] {\n return [\n ...new Set(this.getRegisteredTypes().flatMap((type) => type.actions)),\n ].sort();\n }\n\n /**\n * Get current request context if available.\n */\n protected getRequestContext(): ServerRequest | undefined {\n return this.alepha.store.get(\"alepha.http.request\");\n }\n\n /**\n * Create a new audit log entry.\n * Automatically populates ipAddress, userAgent, and requestId from the current request context.\n */\n public async create(data: CreateAudit): Promise<AuditEntity> {\n const request = this.getRequestContext();\n\n // Auto-populate from request context if not provided\n const contextData: Partial<CreateAudit> = {};\n\n if (request) {\n if (!data.ipAddress && request.ip) {\n contextData.ipAddress = request.ip;\n }\n if (!data.userAgent && request.headers[\"user-agent\"]) {\n contextData.userAgent = request.headers[\"user-agent\"];\n }\n if (!data.requestId && request.requestId) {\n contextData.requestId = request.requestId;\n }\n // Check for session in metadata\n if (!data.sessionId && request.metadata?.sessionId) {\n contextData.sessionId = request.metadata.sessionId;\n }\n // Extract user from request.user (set by ServerSecurityProvider)\n const user = request.user;\n if (user) {\n if (!data.userId && user.id) {\n contextData.userId = user.id;\n }\n if (!data.userEmail && user.email) {\n contextData.userEmail = user.email;\n }\n if (!data.userRealm && user.realm) {\n contextData.userRealm = user.realm;\n }\n }\n }\n\n this.log.trace(\"Creating audit entry\", {\n type: data.type,\n action: data.action,\n userId: data.userId ?? contextData.userId,\n });\n\n const success = data.success ?? true;\n const entry = await this.repo.create({\n ...contextData,\n ...data,\n // Outcome drives severity: a failed audit (success:false) defaults to\n // `warning`, otherwise `info`. Explicit `severity` always wins. This is\n // the single place the OK/Failed → severity rule lives, so holders and\n // `$audit` primitives don't repeat it.\n severity: data.severity ?? (success ? \"info\" : \"warning\"),\n success,\n });\n\n this.log.debug(\"Audit entry created\", {\n id: entry.id,\n type: data.type,\n action: data.action,\n });\n\n return entry;\n }\n\n /**\n * Record an audit event (convenience method).\n */\n public async record(\n type: string,\n action: string,\n options: Omit<CreateAudit, \"type\" | \"action\"> = {},\n ): Promise<AuditEntity> {\n return this.create({ type, action, ...options });\n }\n\n /**\n * Find audit entries with filtering and pagination.\n */\n public async find(query: AuditQuery = {}): Promise<Page<AuditEntity>> {\n this.log.trace(\"Finding audit entries\", { query });\n\n query.sort ??= \"-createdAt\";\n\n const where = this.repo.createQueryWhere();\n\n if (query.type) {\n where.type = { eq: query.type };\n }\n\n if (query.action) {\n where.action = { eq: query.action };\n }\n\n if (query.severity) {\n where.severity = { eq: query.severity };\n }\n\n if (query.userId) {\n where.userId = { eq: query.userId };\n }\n\n if (query.userRealm) {\n where.userRealm = { eq: query.userRealm };\n }\n\n if (query.resourceType) {\n where.resourceType = { eq: query.resourceType };\n }\n\n if (query.resourceId) {\n where.resourceId = { eq: query.resourceId };\n }\n\n if (query.success !== undefined) {\n where.success = { eq: query.success };\n }\n\n if (query.from) {\n where.createdAt = { ...(where.createdAt as object), gte: query.from };\n }\n\n if (query.to) {\n where.createdAt = { ...(where.createdAt as object), lte: query.to };\n }\n\n if (query.search) {\n where.description = { like: `%${query.search}%` };\n }\n\n const result = await this.repo.paginate(query, { where }, { count: true });\n\n this.log.debug(\"Audit entries found\", {\n count: result.content.length,\n total: result.page.totalElements,\n });\n\n return result;\n }\n\n /**\n * Get audit entry by ID.\n */\n public async getById(id: string): Promise<AuditEntity> {\n return this.repo.getById(id);\n }\n\n /**\n * Get audit entries for a specific user.\n */\n public async findByUser(\n userId: string,\n query: Omit<AuditQuery, \"userId\"> = {},\n ): Promise<Page<AuditEntity>> {\n return this.find({ ...query, userId });\n }\n\n /**\n * Get audit entries for a specific resource.\n */\n public async findByResource(\n resourceType: string,\n resourceId: string,\n query: Omit<AuditQuery, \"resourceType\" | \"resourceId\"> = {},\n ): Promise<Page<AuditEntity>> {\n return this.find({ ...query, resourceType, resourceId });\n }\n\n /**\n * Get audit statistics for a time period.\n */\n public async getStats(\n options: { from?: Date; to?: Date; userRealm?: string } = {},\n ): Promise<AuditStats> {\n this.log.trace(\"Getting audit stats\", options);\n\n const where = this.repo.createQueryWhere();\n\n if (options.from) {\n where.createdAt = { gte: options.from.toISOString() };\n }\n\n if (options.to) {\n where.createdAt = {\n ...(where.createdAt as object),\n lte: options.to.toISOString(),\n };\n }\n\n if (options.userRealm) {\n where.userRealm = { eq: options.userRealm };\n }\n\n const all = await this.repo.findMany({ where });\n\n const stats: AuditStats = {\n total: all.length,\n byType: {},\n bySeverity: { info: 0, warning: 0, critical: 0 },\n successRate: 0,\n recentFailures: [],\n };\n\n let successCount = 0;\n\n for (const entry of all) {\n // Count by type\n stats.byType[entry.type] = (stats.byType[entry.type] || 0) + 1;\n\n // Count by severity\n const severity = entry.severity as AuditSeverity;\n stats.bySeverity[severity]++;\n\n // Count successes\n if (entry.success) {\n successCount++;\n }\n }\n\n stats.successRate = stats.total > 0 ? successCount / stats.total : 1;\n\n // Get recent failures\n const failures = all\n .filter((e) => !e.success)\n .sort(\n (a, b) =>\n new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime(),\n )\n .slice(0, 10);\n\n stats.recentFailures = failures;\n\n return stats;\n }\n\n /**\n * Delete old audit entries (for retention policy).\n */\n public async deleteOlderThan(date: Date): Promise<number> {\n this.log.info(\"Deleting old audit entries\", { olderThan: date });\n\n const old = await this.repo.findMany({\n where: { createdAt: { lt: date.toISOString() } },\n });\n\n for (const entry of old) {\n await this.repo.deleteById(entry.id);\n }\n\n this.log.info(\"Old audit entries deleted\", { count: old.length });\n\n return old.length;\n }\n}\n\n/**\n * Audit statistics summary.\n */\nexport interface AuditStats {\n total: number;\n byType: Record<string, number>;\n bySeverity: Record<AuditSeverity, number>;\n successRate: number;\n recentFailures: AuditEntity[];\n}\n","import { $inject, t } from \"alepha\";\nimport { $repository } from \"alepha/orm\";\nimport { $secure } from \"alepha/security\";\nimport { $action } from \"alepha/server\";\nimport { audits } from \"../entities/audits.ts\";\nimport { auditQuerySchema } from \"../schemas/auditQuerySchema.ts\";\nimport { auditResourceSchema } from \"../schemas/auditResourceSchema.ts\";\nimport { createAuditSchema } from \"../schemas/createAuditSchema.ts\";\nimport { AuditService } from \"../services/AuditService.ts\";\n\n/**\n * REST API controller for audit log management.\n *\n * Provides endpoints for:\n * - Querying audit logs with filtering\n * - Creating audit entries\n * - Getting audit statistics\n * - Viewing registered audit types\n */\nexport class AdminAuditController {\n protected readonly url = \"/audits\";\n protected readonly group = \"admin:audits\";\n protected readonly auditService = $inject(AuditService);\n protected readonly repo = $repository(audits);\n\n /**\n * Find audit entries with filtering and pagination.\n */\n public readonly findAudits = $action({\n path: this.url,\n group: this.group,\n use: [$secure({ permissions: [\"admin:audit:read\"] })],\n description: \"Find audit entries with filtering and pagination\",\n schema: {\n query: auditQuerySchema,\n response: t.page(auditResourceSchema),\n },\n handler: ({ query }) => this.auditService.find(query),\n });\n\n /**\n * Get a single audit entry by ID.\n */\n public readonly getAudit = $action({\n path: `${this.url}/:id`,\n group: this.group,\n use: [$secure({ permissions: [\"admin:audit:read\"] })],\n description: \"Get a single audit entry by ID\",\n schema: {\n params: t.object({\n id: t.text(),\n }),\n response: auditResourceSchema,\n },\n handler: ({ params }) => this.auditService.getById(params.id),\n });\n\n /**\n * Delete many audit entries by id in one repository call. Use with care —\n * audit logs are usually retained for compliance reasons.\n */\n public readonly deleteAudits = $action({\n method: \"POST\",\n path: `${this.url}/delete`,\n group: this.group,\n use: [$secure({ permissions: [\"admin:audit:delete\"] })],\n description: \"Delete many audit entries\",\n schema: {\n body: t.object({\n ids: t.array(t.text(), { minItems: 1, maxItems: 1000 }),\n }),\n response: t.object({\n deleted: t.array(t.text()),\n }),\n },\n handler: async ({ body }) => {\n const deleted = await this.repo.deleteMany({\n id: { inArray: body.ids },\n });\n return { deleted: deleted.map(String) };\n },\n });\n\n /**\n * Create a new audit entry.\n * System-only — this permission should never be assigned to human roles.\n */\n public readonly createAudit = $action({\n method: \"POST\",\n path: this.url,\n group: this.group,\n use: [$secure({ permissions: [\"admin:audit:create\"] })],\n description: \"Create a new audit entry\",\n schema: {\n body: createAuditSchema,\n response: auditResourceSchema,\n },\n handler: ({ body }) => this.auditService.create(body),\n });\n\n /**\n * Get audit entries for a specific user.\n */\n public readonly findByUser = $action({\n path: `${this.url}/user/:userId`,\n group: this.group,\n use: [$secure({ permissions: [\"admin:audit:read\"] })],\n description: \"Get audit entries for a specific user\",\n schema: {\n params: t.object({\n userId: t.uuid(),\n }),\n query: t.omit(auditQuerySchema, [\"userId\"]),\n response: t.page(auditResourceSchema),\n },\n handler: ({ params, query }) =>\n this.auditService.findByUser(params.userId, query),\n });\n\n /**\n * Get audit entries for a specific resource.\n */\n public readonly findByResource = $action({\n path: `${this.url}/resource/:resourceType/:resourceId`,\n group: this.group,\n use: [$secure({ permissions: [\"admin:audit:read\"] })],\n description: \"Get audit entries for a specific resource\",\n schema: {\n params: t.object({\n resourceType: t.text(),\n resourceId: t.text(),\n }),\n query: t.omit(auditQuerySchema, [\"resourceType\", \"resourceId\"]),\n response: t.page(auditResourceSchema),\n },\n handler: ({ params, query }) =>\n this.auditService.findByResource(\n params.resourceType,\n params.resourceId,\n query,\n ),\n });\n\n /**\n * Get audit statistics.\n */\n public readonly getAuditStats = $action({\n path: `${this.url}/stats`,\n group: this.group,\n use: [$secure({ permissions: [\"admin:audit:read\"] })],\n description: \"Get audit statistics for a time period\",\n schema: {\n query: t.object({\n from: t.optional(t.datetime()),\n to: t.optional(t.datetime()),\n userRealm: t.optional(t.text()),\n }),\n response: t.object({\n total: t.integer(),\n byType: t.record(t.text(), t.integer()),\n bySeverity: t.object({\n info: t.integer(),\n warning: t.integer(),\n critical: t.integer(),\n }),\n successRate: t.number(),\n recentFailures: t.array(auditResourceSchema),\n }),\n },\n handler: ({ query }) =>\n this.auditService.getStats({\n from: query.from ? new Date(query.from) : undefined,\n to: query.to ? new Date(query.to) : undefined,\n userRealm: query.userRealm,\n }),\n });\n\n /**\n * List distinct action names present in the audit log (for filters).\n */\n public readonly getAuditActions = $action({\n path: `${this.url}/actions`,\n group: this.group,\n use: [$secure({ permissions: [\"admin:audit:read\"] })],\n description: \"List distinct action names present in the audit log\",\n schema: {\n response: t.array(t.text()),\n },\n handler: () => this.auditService.getDistinctActions(),\n });\n\n /**\n * Get registered audit types.\n */\n public readonly getTypes = $action({\n path: `${this.url}/types`,\n group: this.group,\n use: [$secure({ permissions: [\"admin:audit:read\"] })],\n description: \"Get all registered audit types\",\n schema: {\n response: t.array(\n t.object({\n type: t.text(),\n description: t.optional(t.text()),\n actions: t.array(t.text()),\n }),\n ),\n },\n handler: () => this.auditService.getRegisteredTypes(),\n });\n\n /**\n * Get distinct values for filters.\n */\n public readonly getFilterOptions = $action({\n path: `${this.url}/filters`,\n group: this.group,\n use: [$secure({ permissions: [\"admin:audit:read\"] })],\n description: \"Get distinct values for audit filters\",\n schema: {\n response: t.object({\n types: t.array(t.text()),\n actions: t.array(t.text()),\n resourceTypes: t.array(t.text()),\n userRealms: t.array(t.text()),\n }),\n },\n handler: async () => {\n const types = this.auditService.getRegisteredTypes();\n return {\n types: types.map((t) => t.type),\n actions: types.flatMap((t) => t.actions),\n resourceTypes: [\"user\", \"session\", \"file\", \"order\", \"payment\"],\n userRealms: [\"default\"],\n };\n },\n });\n}\n","import { $inject, createPrimitive, KIND, Primitive } from \"alepha\";\nimport {\n AuditService,\n type AuditTypeDefinition,\n} from \"../services/AuditService.ts\";\n\n/**\n * Options for creating an audit type primitive.\n */\nexport interface AuditPrimitiveOptions {\n /**\n * Unique audit type identifier (e.g., \"auth\", \"payment\", \"order\").\n */\n type: string;\n\n /**\n * Human-readable description of this audit type.\n */\n description?: string;\n\n /**\n * List of allowed actions for this audit type.\n */\n actions: string[];\n}\n\n/**\n * Audit type primitive for registering domain-specific audit events.\n *\n * Provides a type-safe way to define and log audit events within a specific domain.\n *\n * @example\n * ```ts\n * class PaymentAudits {\n * audit = $audit({\n * type: \"payment\",\n * description: \"Payment-related audit events\",\n * actions: [\"create\", \"refund\", \"cancel\", \"dispute\"],\n * });\n *\n * async logPaymentCreated(paymentId: string, userId: string, amount: number) {\n * await this.audit.log(\"create\", {\n * userId,\n * resourceType: \"payment\",\n * resourceId: paymentId,\n * description: `Payment of ${amount} created`,\n * metadata: { amount },\n * });\n * }\n * }\n * ```\n */\nexport class AuditPrimitive extends Primitive<AuditPrimitiveOptions> {\n protected readonly auditService = $inject(AuditService);\n\n /**\n * The audit type identifier.\n */\n public get type(): string {\n return this.options.type;\n }\n\n /**\n * The audit type description.\n */\n public get description(): string | undefined {\n return this.options.description;\n }\n\n /**\n * The allowed actions for this audit type.\n */\n public get actions(): string[] {\n return this.options.actions;\n }\n\n /**\n * Log an audit event for this type.\n */\n public async log(\n action: string,\n options: AuditLogOptions = {},\n ): Promise<void> {\n await this.auditService.record(this.options.type, action, options);\n }\n\n /**\n * Log a successful audit event.\n */\n public async logSuccess(\n action: string,\n options: Omit<AuditLogOptions, \"success\"> = {},\n ): Promise<void> {\n await this.log(action, { ...options, success: true });\n }\n\n /**\n * Log a failed audit event.\n */\n public async logFailure(\n action: string,\n errorMessage: string,\n options: Omit<AuditLogOptions, \"success\" | \"errorMessage\"> = {},\n ): Promise<void> {\n await this.log(action, { ...options, success: false, errorMessage });\n }\n\n /**\n * Called during initialization to register this audit type.\n */\n protected onInit(): void {\n const definition: AuditTypeDefinition = {\n type: this.options.type,\n description: this.options.description,\n actions: this.options.actions,\n };\n this.auditService.registerType(definition);\n }\n}\n\n/**\n * Options for logging an audit event.\n */\nexport interface AuditLogOptions {\n severity?: \"info\" | \"warning\" | \"critical\";\n userId?: string;\n userRealm?: string;\n userEmail?: string;\n resourceType?: string;\n resourceId?: string;\n description?: string;\n metadata?: Record<string, unknown>;\n ipAddress?: string;\n userAgent?: string;\n sessionId?: string;\n requestId?: string;\n success?: boolean;\n errorMessage?: string;\n}\n\n/**\n * Create an audit type primitive.\n *\n * @example\n * ```ts\n * class OrderAudits {\n * audit = $audit({\n * type: \"order\",\n * description: \"Order management events\",\n * actions: [\"create\", \"update\", \"cancel\", \"fulfill\", \"ship\"],\n * });\n * }\n * ```\n */\nexport const $audit = (options: AuditPrimitiveOptions) => {\n return createPrimitive(AuditPrimitive, options);\n};\n\n$audit[KIND] = AuditPrimitive;\n","import { $module } from \"alepha\";\nimport { AdminAuditController } from \"./controllers/AdminAuditController.ts\";\nimport { AuditService } from \"./services/AuditService.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport * from \"./controllers/AdminAuditController.ts\";\nexport * from \"./entities/audits.ts\";\nexport * from \"./primitives/$audit.ts\";\nexport * from \"./schemas/auditQuerySchema.ts\";\nexport * from \"./schemas/auditResourceSchema.ts\";\nexport * from \"./schemas/createAuditSchema.ts\";\nexport * from \"./services/AuditService.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * Audit trail for compliance.\n *\n * **Features:**\n * - Domain-specific audit types\n * - Audit event logging\n * - Filtering and searching\n * - User action tracking\n *\n * @module alepha.api.audits\n */\nexport const AlephaApiAudits = $module({\n name: \"alepha.api.audits\",\n services: [AuditService, AdminAuditController],\n});\n"],"mappings":";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,CAAC;CACrE;;;;CAKA,SAAyB;EACvB,MAAM,aAAkC;GACtC,MAAM,KAAK,QAAQ;GACnB,aAAa,KAAK,QAAQ;GAC1B,SAAS,KAAK,QAAQ;EACxB;EACA,KAAK,aAAa,aAAa,UAAU;CAC3C;AACF;;;;;;;;;;;;;;;AAoCA,MAAa,UAAU,YAAmC;CACxD,OAAO,gBAAgB,gBAAgB,OAAO;AAChD;AAEA,OAAO,QAAQ;;;;;;;;;;;;;;ACnIf,MAAa,kBAAkB,QAAQ;CACrC,MAAM;CACN,UAAU,CAAC,cAAc,oBAAoB;AAC/C,CAAC"}
|
|
@@ -67,8 +67,38 @@ const fileQuerySchema = t.extend(pageQuerySchema, {
|
|
|
67
67
|
createdBefore: t.optional(t.datetime())
|
|
68
68
|
});
|
|
69
69
|
//#endregion
|
|
70
|
+
//#region ../../src/api/files/schemas/fileCreatorSummarySchema.ts
|
|
71
|
+
/**
|
|
72
|
+
* Slim view of a file's uploader, embedded by the admin listing via a
|
|
73
|
+
* best-effort left join (`files.creator` → `users.id`) so the UI can render
|
|
74
|
+
* a human-readable identifier instead of a bare UUID.
|
|
75
|
+
*
|
|
76
|
+
* Optional end-to-end: the join only runs when the `users` entity is
|
|
77
|
+
* registered in the running app (see `FileService.findFiles`), and even then
|
|
78
|
+
* a file whose creator was deleted — or who lives in a non-default realm —
|
|
79
|
+
* comes back with `user` undefined. Callers must fall back to `creatorName`
|
|
80
|
+
* or the raw `creator` id.
|
|
81
|
+
*/
|
|
82
|
+
const fileCreatorSummarySchema = t.object({
|
|
83
|
+
id: t.uuid(),
|
|
84
|
+
email: t.optional(t.string({ format: "email" })),
|
|
85
|
+
username: t.optional(t.shortText({
|
|
86
|
+
minLength: 3,
|
|
87
|
+
maxLength: 30
|
|
88
|
+
})),
|
|
89
|
+
firstName: t.optional(t.string()),
|
|
90
|
+
lastName: t.optional(t.string())
|
|
91
|
+
});
|
|
92
|
+
//#endregion
|
|
70
93
|
//#region ../../src/api/files/schemas/fileResourceSchema.ts
|
|
71
|
-
const fileResourceSchema = t.extend(files.schema, {
|
|
94
|
+
const fileResourceSchema = t.extend(files.schema, {
|
|
95
|
+
/**
|
|
96
|
+
* Uploader summary, embedded by the admin listing via a best-effort
|
|
97
|
+
* left join. Optional — see `fileCreatorSummarySchema`. Distinct from
|
|
98
|
+
* the denormalized `creatorName`, which is set only on direct uploads
|
|
99
|
+
* and never carries an email.
|
|
100
|
+
*/
|
|
101
|
+
user: t.optional(fileCreatorSummarySchema) }, {
|
|
72
102
|
title: "FileResource",
|
|
73
103
|
description: "A file resource representing a file stored in the system."
|
|
74
104
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.browser.js","names":[],"sources":["../../../src/api/files/entities/files.ts","../../../src/api/files/schemas/fileQuerySchema.ts","../../../src/api/files/schemas/fileResourceSchema.ts","../../../src/api/files/schemas/storageStatsSchema.ts","../../../src/api/files/index.browser.ts"],"sourcesContent":["import { type Static, t } from \"alepha\";\nimport { $entity, db } from \"alepha/orm\";\n\nexport const files = $entity({\n name: \"files\",\n schema: t.object({\n id: db.primaryKey(t.uuid()),\n version: db.version(),\n createdAt: db.createdAt(),\n updatedAt: db.updatedAt(),\n organizationId: db.organization(),\n blobId: t.text(),\n creator: t.optional(t.uuid()),\n creatorRealm: t.optional(t.string()),\n creatorName: t.optional(t.string()),\n bucket: t.text(),\n expirationDate: t.optional(t.datetime()),\n /**\n * Display name. Mutable via `FileService.updateFile` — can be renamed\n * by callers (e.g. an Archive UI letting users rename uploaded blobs).\n * Initialized to the uploader's filename at upload time. Use\n * `originalName` if you need the as-uploaded filename after a rename.\n */\n name: t.text(),\n /**\n * Immutable record of the uploader's filename at upload time. Set once\n * by `FileService.uploadFile` and the `bucket:file:uploaded` hook;\n * `FileService.updateFile` never touches it. Useful for download\n * headers (Content-Disposition), audit trails, and any UI that wants\n * to show \"originally uploaded as X\" alongside a renamed file.\n */\n originalName: t.optional(t.string()),\n size: t.number(),\n mimeType: t.string(),\n /**\n * Free-form taxonomy. Normalized server-side (trim/lowercase/dedupe is\n * caller's responsibility for now). Use with `FileQuery.tags` to\n * filter via array-contains.\n */\n tags: t.optional(t.array(t.text())),\n /**\n * SHA-256 hex digest of the file content (64 lowercase hex chars).\n * Computed at upload time by `FileService.calculateChecksum`. Stable\n * — never recomputed after upload. Use for integrity verification,\n * content-based dedup, or downstream virus-scan correlation.\n */\n checksum: t.optional(t.string()),\n }),\n indexes: [\n \"expirationDate\",\n \"bucket\",\n \"creator\",\n \"createdAt\",\n \"mimeType\",\n {\n columns: [\"bucket\", \"createdAt\"],\n },\n ],\n});\n\nexport type FileEntity = Static<typeof files.schema>;\n","import type { Static } from \"alepha\";\nimport { t } from \"alepha\";\nimport { pageQuerySchema } from \"alepha/orm\";\n\nexport const fileQuerySchema = t.extend(pageQuerySchema, {\n bucket: t.optional(t.string()),\n tags: t.optional(t.array(t.string())),\n name: t.optional(t.string()),\n mimeType: t.optional(t.string()),\n creator: t.optional(t.uuid()),\n createdAfter: t.optional(t.datetime()),\n createdBefore: t.optional(t.datetime()),\n});\n\nexport type FileQuery = Static<typeof fileQuerySchema>;\n","import { type Static, t } from \"alepha\";\nimport { files } from \"../entities/files.ts\";\n\nexport const fileResourceSchema = t.extend(\n files.schema,\n {},\n {\n title: \"FileResource\",\n description: \"A file resource representing a file stored in the system.\",\n },\n);\n\nexport type FileResource = Static<typeof fileResourceSchema>;\n","import type { Static } from \"alepha\";\nimport { t } from \"alepha\";\n\nexport const bucketStatsSchema = t.object({\n bucket: t.string(),\n totalSize: t.number(),\n fileCount: t.number(),\n});\n\nexport const mimeTypeStatsSchema = t.object({\n mimeType: t.string(),\n fileCount: t.number(),\n});\n\nexport const storageStatsSchema = t.object({\n totalSize: t.number(),\n totalFiles: t.number(),\n byBucket: t.array(bucketStatsSchema),\n byMimeType: t.array(mimeTypeStatsSchema),\n});\n\nexport type BucketStats = Static<typeof bucketStatsSchema>;\nexport type MimeTypeStats = Static<typeof mimeTypeStatsSchema>;\nexport type StorageStats = Static<typeof storageStatsSchema>;\n","import { $module } from \"alepha\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport type * from \"./controllers/AdminFileStatsController.ts\";\nexport type * from \"./controllers/FileController.ts\";\nexport * from \"./entities/files.ts\";\nexport * from \"./schemas/fileQuerySchema.ts\";\nexport * from \"./schemas/fileResourceSchema.ts\";\nexport * from \"./schemas/storageStatsSchema.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport const AlephaApiFiles = $module({\n name: \"alepha.api.files\",\n services: [],\n});\n"],"mappings":";;;AAGA,MAAa,QAAQ,QAAQ;CAC3B,MAAM;CACN,QAAQ,EAAE,OAAO;EACf,IAAI,GAAG,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"index.browser.js","names":[],"sources":["../../../src/api/files/entities/files.ts","../../../src/api/files/schemas/fileQuerySchema.ts","../../../src/api/files/schemas/fileCreatorSummarySchema.ts","../../../src/api/files/schemas/fileResourceSchema.ts","../../../src/api/files/schemas/storageStatsSchema.ts","../../../src/api/files/index.browser.ts"],"sourcesContent":["import { type Static, t } from \"alepha\";\nimport { $entity, db } from \"alepha/orm\";\n\nexport const files = $entity({\n name: \"files\",\n schema: t.object({\n id: db.primaryKey(t.uuid()),\n version: db.version(),\n createdAt: db.createdAt(),\n updatedAt: db.updatedAt(),\n organizationId: db.organization(),\n blobId: t.text(),\n creator: t.optional(t.uuid()),\n creatorRealm: t.optional(t.string()),\n creatorName: t.optional(t.string()),\n bucket: t.text(),\n expirationDate: t.optional(t.datetime()),\n /**\n * Display name. Mutable via `FileService.updateFile` — can be renamed\n * by callers (e.g. an Archive UI letting users rename uploaded blobs).\n * Initialized to the uploader's filename at upload time. Use\n * `originalName` if you need the as-uploaded filename after a rename.\n */\n name: t.text(),\n /**\n * Immutable record of the uploader's filename at upload time. Set once\n * by `FileService.uploadFile` and the `bucket:file:uploaded` hook;\n * `FileService.updateFile` never touches it. Useful for download\n * headers (Content-Disposition), audit trails, and any UI that wants\n * to show \"originally uploaded as X\" alongside a renamed file.\n */\n originalName: t.optional(t.string()),\n size: t.number(),\n mimeType: t.string(),\n /**\n * Free-form taxonomy. Normalized server-side (trim/lowercase/dedupe is\n * caller's responsibility for now). Use with `FileQuery.tags` to\n * filter via array-contains.\n */\n tags: t.optional(t.array(t.text())),\n /**\n * SHA-256 hex digest of the file content (64 lowercase hex chars).\n * Computed at upload time by `FileService.calculateChecksum`. Stable\n * — never recomputed after upload. Use for integrity verification,\n * content-based dedup, or downstream virus-scan correlation.\n */\n checksum: t.optional(t.string()),\n }),\n indexes: [\n \"expirationDate\",\n \"bucket\",\n \"creator\",\n \"createdAt\",\n \"mimeType\",\n {\n columns: [\"bucket\", \"createdAt\"],\n },\n ],\n});\n\nexport type FileEntity = Static<typeof files.schema>;\n","import type { Static } from \"alepha\";\nimport { t } from \"alepha\";\nimport { pageQuerySchema } from \"alepha/orm\";\n\nexport const fileQuerySchema = t.extend(pageQuerySchema, {\n bucket: t.optional(t.string()),\n tags: t.optional(t.array(t.string())),\n name: t.optional(t.string()),\n mimeType: t.optional(t.string()),\n creator: t.optional(t.uuid()),\n createdAfter: t.optional(t.datetime()),\n createdBefore: t.optional(t.datetime()),\n});\n\nexport type FileQuery = Static<typeof fileQuerySchema>;\n","import { type Static, t } from \"alepha\";\n\n/**\n * Slim view of a file's uploader, embedded by the admin listing via a\n * best-effort left join (`files.creator` → `users.id`) so the UI can render\n * a human-readable identifier instead of a bare UUID.\n *\n * Optional end-to-end: the join only runs when the `users` entity is\n * registered in the running app (see `FileService.findFiles`), and even then\n * a file whose creator was deleted — or who lives in a non-default realm —\n * comes back with `user` undefined. Callers must fall back to `creatorName`\n * or the raw `creator` id.\n */\nexport const fileCreatorSummarySchema = t.object({\n id: t.uuid(),\n email: t.optional(t.string({ format: \"email\" })),\n username: t.optional(t.shortText({ minLength: 3, maxLength: 30 })),\n firstName: t.optional(t.string()),\n lastName: t.optional(t.string()),\n});\n\nexport type FileCreatorSummary = Static<typeof fileCreatorSummarySchema>;\n","import { type Static, t } from \"alepha\";\nimport { files } from \"../entities/files.ts\";\nimport { fileCreatorSummarySchema } from \"./fileCreatorSummarySchema.ts\";\n\nexport const fileResourceSchema = t.extend(\n files.schema,\n {\n /**\n * Uploader summary, embedded by the admin listing via a best-effort\n * left join. Optional — see `fileCreatorSummarySchema`. Distinct from\n * the denormalized `creatorName`, which is set only on direct uploads\n * and never carries an email.\n */\n user: t.optional(fileCreatorSummarySchema),\n },\n {\n title: \"FileResource\",\n description: \"A file resource representing a file stored in the system.\",\n },\n);\n\nexport type FileResource = Static<typeof fileResourceSchema>;\n","import type { Static } from \"alepha\";\nimport { t } from \"alepha\";\n\nexport const bucketStatsSchema = t.object({\n bucket: t.string(),\n totalSize: t.number(),\n fileCount: t.number(),\n});\n\nexport const mimeTypeStatsSchema = t.object({\n mimeType: t.string(),\n fileCount: t.number(),\n});\n\nexport const storageStatsSchema = t.object({\n totalSize: t.number(),\n totalFiles: t.number(),\n byBucket: t.array(bucketStatsSchema),\n byMimeType: t.array(mimeTypeStatsSchema),\n});\n\nexport type BucketStats = Static<typeof bucketStatsSchema>;\nexport type MimeTypeStats = Static<typeof mimeTypeStatsSchema>;\nexport type StorageStats = Static<typeof storageStatsSchema>;\n","import { $module } from \"alepha\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport type * from \"./controllers/AdminFileStatsController.ts\";\nexport type * from \"./controllers/FileController.ts\";\nexport * from \"./entities/files.ts\";\nexport * from \"./schemas/fileQuerySchema.ts\";\nexport * from \"./schemas/fileResourceSchema.ts\";\nexport * from \"./schemas/storageStatsSchema.ts\";\n\n// ---------------------------------------------------------------------------------------------------------------------\n\nexport const AlephaApiFiles = $module({\n name: \"alepha.api.files\",\n services: [],\n});\n"],"mappings":";;;AAGA,MAAa,QAAQ,QAAQ;CAC3B,MAAM;CACN,QAAQ,EAAE,OAAO;EACf,IAAI,GAAG,WAAW,EAAE,KAAK,CAAC;EAC1B,SAAS,GAAG,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