alepha 0.23.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/swagger-ui/swagger-ui-bundle.js +1 -1
- package/assets/swagger-ui/swagger-ui-standalone-preset.js +1 -1
- package/dist/api/audits/index.browser.js +49 -52
- package/dist/api/audits/index.browser.js.map +1 -1
- package/dist/api/audits/index.d.ts +629 -565
- package/dist/api/audits/index.d.ts.map +1 -1
- package/dist/api/audits/index.js +206 -98
- package/dist/api/audits/index.js.map +1 -1
- package/dist/api/files/index.browser.js +44 -44
- package/dist/api/files/index.browser.js.map +1 -1
- package/dist/api/files/index.d.ts +292 -293
- package/dist/api/files/index.d.ts.map +1 -1
- package/dist/api/files/index.js +61 -64
- package/dist/api/files/index.js.map +1 -1
- package/dist/api/jobs/index.browser.js +61 -59
- package/dist/api/jobs/index.browser.js.map +1 -1
- package/dist/api/jobs/index.d.ts +546 -347
- package/dist/api/jobs/index.d.ts.map +1 -1
- package/dist/api/jobs/index.js +165 -86
- package/dist/api/jobs/index.js.map +1 -1
- package/dist/api/keys/index.d.ts +247 -235
- package/dist/api/keys/index.d.ts.map +1 -1
- package/dist/api/keys/index.js +63 -66
- package/dist/api/keys/index.js.map +1 -1
- package/dist/api/notifications/index.browser.js +40 -38
- package/dist/api/notifications/index.browser.js.map +1 -1
- package/dist/api/notifications/index.d.ts +339 -209
- package/dist/api/notifications/index.d.ts.map +1 -1
- package/dist/api/notifications/index.js +108 -60
- package/dist/api/notifications/index.js.map +1 -1
- package/dist/api/oauth/index.d.ts +190 -78
- package/dist/api/oauth/index.d.ts.map +1 -1
- package/dist/api/oauth/index.js +290 -68
- package/dist/api/oauth/index.js.map +1 -1
- package/dist/api/organizations/index.browser.js +14 -14
- package/dist/api/organizations/index.browser.js.map +1 -1
- package/dist/api/organizations/index.d.ts +158 -134
- package/dist/api/organizations/index.d.ts.map +1 -1
- package/dist/api/organizations/index.js +18 -18
- package/dist/api/organizations/index.js.map +1 -1
- package/dist/api/parameters/index.browser.js +74 -53
- package/dist/api/parameters/index.browser.js.map +1 -1
- package/dist/api/parameters/index.d.ts +607 -513
- package/dist/api/parameters/index.d.ts.map +1 -1
- package/dist/api/parameters/index.js +205 -127
- package/dist/api/parameters/index.js.map +1 -1
- package/dist/api/payments/index.d.ts +652 -449
- package/dist/api/payments/index.d.ts.map +1 -1
- package/dist/api/payments/index.js +159 -93
- package/dist/api/payments/index.js.map +1 -1
- package/dist/api/subscriptions/index.d.ts +1032 -762
- package/dist/api/subscriptions/index.d.ts.map +1 -1
- package/dist/api/subscriptions/index.js +166 -185
- package/dist/api/subscriptions/index.js.map +1 -1
- package/dist/api/users/index.browser.js +48 -71
- package/dist/api/users/index.browser.js.map +1 -1
- package/dist/api/users/index.d.ts +1297 -1143
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +456 -392
- package/dist/api/users/index.js.map +1 -1
- package/dist/api/verifications/index.browser.js +17 -17
- package/dist/api/verifications/index.browser.js.map +1 -1
- package/dist/api/verifications/index.d.ts +167 -155
- package/dist/api/verifications/index.d.ts.map +1 -1
- package/dist/api/verifications/index.js +47 -95
- package/dist/api/verifications/index.js.map +1 -1
- package/dist/background/index.d.ts +0 -1
- package/dist/background/index.d.ts.map +1 -1
- package/dist/background/index.js.map +1 -1
- package/dist/background/index.workerd.js.map +1 -1
- package/dist/batch/index.d.ts +0 -1
- package/dist/batch/index.d.ts.map +1 -1
- package/dist/batch/index.js.map +1 -1
- package/dist/bin/index.js +1 -1
- package/dist/bin/index.js.map +1 -1
- package/dist/bucket/index.d.ts +27 -32
- package/dist/bucket/index.d.ts.map +1 -1
- package/dist/bucket/index.js +56 -26
- package/dist/bucket/index.js.map +1 -1
- package/dist/bucket/index.workerd.js +52 -24
- package/dist/bucket/index.workerd.js.map +1 -1
- package/dist/cache/core/index.d.ts +4 -6
- package/dist/cache/core/index.d.ts.map +1 -1
- package/dist/cache/core/index.js +4 -10
- package/dist/cache/core/index.js.map +1 -1
- package/dist/cache/core/index.workerd.js +4 -10
- package/dist/cache/core/index.workerd.js.map +1 -1
- package/dist/cache/database/index.d.ts +22 -23
- package/dist/cache/database/index.d.ts.map +1 -1
- package/dist/cache/database/index.js +11 -20
- package/dist/cache/database/index.js.map +1 -1
- package/dist/cache/redis/index.d.ts +3 -4
- package/dist/cache/redis/index.d.ts.map +1 -1
- package/dist/cache/redis/index.js +2 -2
- package/dist/cache/redis/index.js.map +1 -1
- package/dist/captcha/index.d.ts.map +1 -1
- package/dist/captcha/index.js +4 -4
- package/dist/captcha/index.js.map +1 -1
- package/dist/cli/config/index.d.ts +0 -1
- package/dist/cli/config/index.d.ts.map +1 -1
- package/dist/cli/core/index.d.ts +205 -442
- package/dist/cli/core/index.d.ts.map +1 -1
- package/dist/cli/core/index.js +259 -284
- package/dist/cli/core/index.js.map +1 -1
- package/dist/cli/devtools/index.d.ts +3 -9
- package/dist/cli/devtools/index.d.ts.map +1 -1
- package/dist/cli/devtools/index.js +3 -3
- package/dist/cli/devtools/index.js.map +1 -1
- package/dist/cli/i18n/index.d.ts +8 -34
- package/dist/cli/i18n/index.d.ts.map +1 -1
- package/dist/cli/i18n/index.js +6 -6
- package/dist/cli/i18n/index.js.map +1 -1
- package/dist/cli/platform/index.d.ts +89 -82
- package/dist/cli/platform/index.d.ts.map +1 -1
- package/dist/cli/platform/index.js +27 -33
- package/dist/cli/platform/index.js.map +1 -1
- package/dist/cli/platform-lib/index.d.ts +351 -404
- package/dist/cli/platform-lib/index.d.ts.map +1 -1
- package/dist/cli/platform-lib/index.js +218 -239
- package/dist/cli/platform-lib/index.js.map +1 -1
- package/dist/cli/vendor/index.d.ts +17 -41
- package/dist/cli/vendor/index.d.ts.map +1 -1
- package/dist/cli/vendor/index.js +10 -13
- package/dist/cli/vendor/index.js.map +1 -1
- package/dist/command/index.d.ts +83 -195
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +160 -563
- package/dist/command/index.js.map +1 -1
- package/dist/core/index.browser.js +845 -859
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +787 -527
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +845 -859
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +845 -859
- package/dist/core/index.native.js.map +1 -1
- package/dist/core/index.workerd.js +845 -859
- package/dist/core/index.workerd.js.map +1 -1
- package/dist/crypto/index.browser.js +1 -1
- package/dist/crypto/index.browser.js.map +1 -1
- package/dist/crypto/index.d.ts +3 -4
- package/dist/crypto/index.d.ts.map +1 -1
- package/dist/crypto/index.js +6 -3
- package/dist/crypto/index.js.map +1 -1
- package/dist/datetime/index.d.ts +12 -2
- package/dist/datetime/index.d.ts.map +1 -1
- package/dist/datetime/index.js +6 -1
- package/dist/datetime/index.js.map +1 -1
- package/dist/email/brevo/index.d.ts +0 -1
- package/dist/email/brevo/index.d.ts.map +1 -1
- package/dist/email/brevo/index.js +4 -4
- package/dist/email/brevo/index.js.map +1 -1
- package/dist/email/cloudflare/index.d.ts +0 -1
- package/dist/email/cloudflare/index.d.ts.map +1 -1
- package/dist/email/cloudflare/index.js +2 -2
- package/dist/email/cloudflare/index.js.map +1 -1
- package/dist/email/core/index.d.ts +15 -7
- package/dist/email/core/index.d.ts.map +1 -1
- package/dist/email/core/index.js +14 -5
- package/dist/email/core/index.js.map +1 -1
- package/dist/email/core/index.workerd.js +5 -1
- package/dist/email/core/index.workerd.js.map +1 -1
- package/dist/email/smtp/index.d.ts +8 -9
- package/dist/email/smtp/index.d.ts.map +1 -1
- package/dist/email/smtp/index.js +702 -479
- package/dist/email/smtp/index.js.map +1 -1
- package/dist/fake/index.d.ts +1580 -1238
- package/dist/fake/index.d.ts.map +1 -1
- package/dist/fake/index.js +11728 -32131
- package/dist/fake/index.js.map +1 -1
- package/dist/lock/core/index.d.ts +13 -9
- package/dist/lock/core/index.d.ts.map +1 -1
- package/dist/lock/core/index.js +5 -5
- package/dist/lock/core/index.js.map +1 -1
- package/dist/lock/redis/index.d.ts +0 -1
- package/dist/lock/redis/index.d.ts.map +1 -1
- package/dist/lock/redis/index.js.map +1 -1
- package/dist/logger/index.d.ts +81 -69
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +123 -56
- package/dist/logger/index.js.map +1 -1
- package/dist/mcp/index.d.ts +27 -90
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +42 -70
- package/dist/mcp/index.js.map +1 -1
- package/dist/orm/core/index.browser.js +54 -40
- package/dist/orm/core/index.browser.js.map +1 -1
- package/dist/orm/core/index.bun.js +140 -106
- package/dist/orm/core/index.bun.js.map +1 -1
- package/dist/orm/core/index.d.ts +145 -150
- package/dist/orm/core/index.d.ts.map +1 -1
- package/dist/orm/core/index.js +144 -109
- package/dist/orm/core/index.js.map +1 -1
- package/dist/orm/postgres/index.bun.js +64 -54
- package/dist/orm/postgres/index.bun.js.map +1 -1
- package/dist/orm/postgres/index.d.ts +36 -76
- package/dist/orm/postgres/index.d.ts.map +1 -1
- package/dist/orm/postgres/index.js +67 -57
- package/dist/orm/postgres/index.js.map +1 -1
- package/dist/queue/core/index.d.ts +62 -75
- package/dist/queue/core/index.d.ts.map +1 -1
- package/dist/queue/core/index.js +48 -71
- package/dist/queue/core/index.js.map +1 -1
- package/dist/queue/core/index.workerd.js +48 -71
- package/dist/queue/core/index.workerd.js.map +1 -1
- package/dist/queue/redis/index.d.ts +3 -4
- package/dist/queue/redis/index.d.ts.map +1 -1
- package/dist/queue/redis/index.js +2 -2
- package/dist/queue/redis/index.js.map +1 -1
- package/dist/react/auth/index.browser.js.map +1 -1
- package/dist/react/auth/index.d.ts +7 -4
- package/dist/react/auth/index.d.ts.map +1 -1
- package/dist/react/auth/index.js.map +1 -1
- package/dist/react/core/index.d.ts +87 -5
- package/dist/react/core/index.d.ts.map +1 -1
- package/dist/react/core/index.js +170 -23
- package/dist/react/core/index.js.map +1 -1
- package/dist/react/form/index.d.ts +4 -5
- package/dist/react/form/index.d.ts.map +1 -1
- package/dist/react/form/index.js +91 -56
- package/dist/react/form/index.js.map +1 -1
- package/dist/react/head/index.browser.js.map +1 -1
- package/dist/react/head/index.d.ts +0 -1
- package/dist/react/head/index.d.ts.map +1 -1
- package/dist/react/head/index.js.map +1 -1
- package/dist/react/i18n/index.d.ts +4 -5
- package/dist/react/i18n/index.d.ts.map +1 -1
- package/dist/react/i18n/index.js +2 -2
- package/dist/react/i18n/index.js.map +1 -1
- package/dist/react/intro/index.d.ts +1 -4
- package/dist/react/intro/index.d.ts.map +1 -1
- package/dist/react/intro/index.js.map +1 -1
- package/dist/react/router/index.browser.js +60 -24
- package/dist/react/router/index.browser.js.map +1 -1
- package/dist/react/router/index.d.ts +378 -377
- package/dist/react/router/index.d.ts.map +1 -1
- package/dist/react/router/index.js +77 -41
- package/dist/react/router/index.js.map +1 -1
- package/dist/react/sitemap/index.d.ts +0 -1
- package/dist/react/sitemap/index.d.ts.map +1 -1
- package/dist/react/sitemap/index.js.map +1 -1
- package/dist/react/testing/index.d.ts +4 -5
- package/dist/react/testing/index.d.ts.map +1 -1
- package/dist/react/testing/index.js +41 -15
- package/dist/react/testing/index.js.map +1 -1
- package/dist/react/testing/{chunk-BpyX8vjI.js → rolldown-runtime-Bl3dcgcQ.js} +1 -1
- package/dist/react/ui/index.d.ts +35 -34
- package/dist/react/ui/index.d.ts.map +1 -1
- package/dist/react/ui/index.js +12 -17
- package/dist/react/ui/index.js.map +1 -1
- package/dist/redis/index.bun.js +5 -5
- package/dist/redis/index.bun.js.map +1 -1
- package/dist/redis/index.d.ts +6 -7
- package/dist/redis/index.d.ts.map +1 -1
- package/dist/redis/index.js +6 -6
- package/dist/redis/index.js.map +1 -1
- package/dist/retry/index.d.ts +0 -1
- package/dist/retry/index.d.ts.map +1 -1
- package/dist/retry/index.js.map +1 -1
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js.map +1 -1
- package/dist/scheduler/index.d.ts +4 -12
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +9 -4
- package/dist/scheduler/index.js.map +1 -1
- package/dist/scheduler/index.workerd.js +9 -4
- package/dist/scheduler/index.workerd.js.map +1 -1
- package/dist/security/index.browser.js +30 -28
- package/dist/security/index.browser.js.map +1 -1
- package/dist/security/index.d.ts +113 -44
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +452 -37
- package/dist/security/index.js.map +1 -1
- package/dist/server/auth/index.browser.js +19 -19
- package/dist/server/auth/index.browser.js.map +1 -1
- package/dist/server/auth/index.d.ts +198 -274
- package/dist/server/auth/index.d.ts.map +1 -1
- package/dist/server/auth/index.js +83 -621
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/cookies/index.browser.js +103 -5
- package/dist/server/cookies/index.browser.js.map +1 -1
- package/dist/server/cookies/index.d.ts +72 -5
- package/dist/server/cookies/index.d.ts.map +1 -1
- package/dist/server/cookies/index.js +103 -9
- package/dist/server/cookies/index.js.map +1 -1
- package/dist/server/core/index.browser.js +22 -27
- package/dist/server/core/index.browser.js.map +1 -1
- package/dist/server/core/index.d.ts +116 -85
- package/dist/server/core/index.d.ts.map +1 -1
- package/dist/server/core/index.js +105 -118
- package/dist/server/core/index.js.map +1 -1
- package/dist/server/cors/index.d.ts +9 -10
- package/dist/server/cors/index.d.ts.map +1 -1
- package/dist/server/cors/index.js +14 -26
- package/dist/server/cors/index.js.map +1 -1
- package/dist/server/etag/index.d.ts +2 -3
- package/dist/server/etag/index.d.ts.map +1 -1
- package/dist/server/etag/index.js.map +1 -1
- package/dist/server/health/index.d.ts +18 -19
- package/dist/server/health/index.d.ts.map +1 -1
- package/dist/server/health/index.js +6 -6
- package/dist/server/health/index.js.map +1 -1
- package/dist/server/links/index.browser.js +15 -18
- package/dist/server/links/index.browser.js.map +1 -1
- package/dist/server/links/index.d.ts +66 -67
- package/dist/server/links/index.d.ts.map +1 -1
- package/dist/server/links/index.js +29 -32
- package/dist/server/links/index.js.map +1 -1
- package/dist/server/metrics/index.d.ts +0 -1
- package/dist/server/metrics/index.d.ts.map +1 -1
- package/dist/server/metrics/index.js +10 -3
- package/dist/server/metrics/index.js.map +1 -1
- package/dist/server/proxy/index.d.ts +0 -1
- package/dist/server/proxy/index.d.ts.map +1 -1
- package/dist/server/proxy/index.js.map +1 -1
- package/dist/server/rate-limit/index.d.ts +8 -9
- package/dist/server/rate-limit/index.d.ts.map +1 -1
- package/dist/server/rate-limit/index.js +6 -12
- package/dist/server/rate-limit/index.js.map +1 -1
- package/dist/server/static/index.d.ts +0 -1
- package/dist/server/static/index.d.ts.map +1 -1
- package/dist/server/static/index.js.map +1 -1
- package/dist/server/swagger/index.d.ts +4 -4
- package/dist/server/swagger/index.d.ts.map +1 -1
- package/dist/server/swagger/index.js +37 -25
- package/dist/server/swagger/index.js.map +1 -1
- package/dist/sms/index.d.ts +0 -1
- package/dist/sms/index.d.ts.map +1 -1
- package/dist/sms/index.js.map +1 -1
- package/dist/system/index.browser.js.map +1 -1
- package/dist/system/index.d.ts +0 -1
- package/dist/system/index.d.ts.map +1 -1
- package/dist/system/index.js +2 -1
- package/dist/system/index.js.map +1 -1
- package/dist/system/index.workerd.js.map +1 -1
- package/dist/topic/core/index.d.ts +19 -20
- package/dist/topic/core/index.d.ts.map +1 -1
- package/dist/topic/core/index.js +8 -8
- package/dist/topic/core/index.js.map +1 -1
- package/dist/topic/redis/index.d.ts +3 -4
- package/dist/topic/redis/index.d.ts.map +1 -1
- package/dist/topic/redis/index.js +2 -2
- package/dist/topic/redis/index.js.map +1 -1
- package/package.json +22 -35
- package/src/api/audits/__tests__/AuditJobs.spec.ts +83 -0
- package/src/api/audits/__tests__/AuditService.spec.ts +139 -1
- package/src/api/audits/controllers/AdminAuditController.ts +41 -41
- package/src/api/audits/entities/audits.ts +22 -22
- package/src/api/audits/index.ts +6 -1
- package/src/api/audits/jobs/AuditJobs.ts +29 -0
- package/src/api/audits/parameters/AuditParameters.ts +51 -0
- package/src/api/audits/primitives/$audit.ts +24 -0
- package/src/api/audits/schemas/auditQuerySchema.ts +13 -13
- package/src/api/audits/schemas/createAuditSchema.ts +18 -18
- package/src/api/audits/services/AuditService.ts +79 -7
- package/src/api/files/__tests__/FileController.spec.ts +5 -5
- package/src/api/files/__tests__/FileJobs.spec.ts +6 -0
- package/src/api/files/controllers/FileController.ts +25 -25
- package/src/api/files/entities/files.ts +15 -15
- package/src/api/files/schemas/fileCreatorSummarySchema.ts +7 -7
- package/src/api/files/schemas/fileQuerySchema.ts +9 -9
- package/src/api/files/schemas/fileResourceSchema.ts +7 -9
- package/src/api/files/schemas/storageStatsSchema.ts +13 -13
- package/src/api/jobs/__tests__/$job-hardening.spec.ts +289 -0
- package/src/api/jobs/__tests__/$job.spec.ts +18 -18
- package/src/api/jobs/controllers/AdminJobController.ts +8 -8
- package/src/api/jobs/entities/jobExecutionEntity.ts +29 -19
- package/src/api/jobs/providers/JobProvider.ts +128 -12
- package/src/api/jobs/providers/JobQueueProvider.ts +2 -2
- package/src/api/jobs/schemas/jobConfigAtom.ts +22 -22
- package/src/api/jobs/schemas/jobExecutionQuerySchema.ts +6 -6
- package/src/api/jobs/schemas/jobExecutionResourceSchema.ts +11 -15
- package/src/api/jobs/schemas/jobRegistrationSchema.ts +20 -19
- package/src/api/jobs/schemas/triggerJobSchema.ts +3 -3
- package/src/api/jobs/services/JobService.ts +6 -6
- package/src/api/keys/__tests__/ApiKeyService.spec.ts +2 -2
- package/src/api/keys/controllers/AdminApiKeyController.ts +10 -10
- package/src/api/keys/entities/apiKeyEntity.ts +15 -15
- package/src/api/keys/schemas/adminApiKeyQuerySchema.ts +4 -4
- package/src/api/keys/schemas/adminApiKeyResourceSchema.ts +15 -15
- package/src/api/keys/schemas/createApiKeyBodySchema.ts +5 -5
- package/src/api/keys/schemas/createApiKeyResponseSchema.ts +9 -9
- package/src/api/keys/schemas/listApiKeyResponseSchema.ts +13 -13
- package/src/api/keys/schemas/revokeApiKeyParamsSchema.ts +3 -3
- package/src/api/keys/schemas/revokeApiKeyResponseSchema.ts +3 -3
- package/src/api/notifications/__tests__/AlephaApiNotifications.spec.ts +2 -2
- package/src/api/notifications/controllers/AdminNotificationController.ts +38 -14
- package/src/api/notifications/jobs/NotificationJobs.ts +7 -6
- package/src/api/notifications/primitives/$notification.ts +43 -4
- package/src/api/notifications/schemas/notificationContactPreferencesSchema.ts +4 -4
- package/src/api/notifications/schemas/notificationContactSchema.ts +7 -7
- package/src/api/notifications/schemas/notificationDetailResourceSchema.ts +9 -11
- package/src/api/notifications/schemas/notificationPayloadSchema.ts +11 -9
- package/src/api/notifications/schemas/notificationQuerySchema.ts +6 -6
- package/src/api/notifications/schemas/notificationResourceSchema.ts +14 -14
- package/src/api/notifications/services/NotificationSenderService.ts +38 -2
- package/src/api/oauth/__tests__/OAuthClientService.spec.ts +42 -0
- package/src/api/oauth/__tests__/OAuthController.spec.ts +128 -0
- package/src/api/oauth/controllers/OAuthController.ts +132 -12
- package/src/api/oauth/entities/oauthClientEntity.ts +29 -12
- package/src/api/oauth/helpers/oauthMetadata.ts +1 -0
- package/src/api/oauth/helpers/oidcMetadata.ts +19 -0
- package/src/api/oauth/index.ts +1 -0
- package/src/api/oauth/schemas/authorizeDecisionBodySchema.ts +12 -11
- package/src/api/oauth/schemas/authorizeQuerySchema.ts +12 -10
- package/src/api/oauth/schemas/registerClientBodySchema.ts +10 -11
- package/src/api/oauth/schemas/tokenRequestBodySchema.ts +9 -8
- package/src/api/oauth/services/OAuthClientService.ts +228 -15
- package/src/api/organizations/controllers/AdminOrganizationController.ts +8 -8
- package/src/api/organizations/entities/organizations.ts +6 -6
- package/src/api/organizations/schemas/createOrganizationSchema.ts +5 -5
- package/src/api/organizations/schemas/organizationQuerySchema.ts +4 -4
- package/src/api/organizations/schemas/updateOrganizationSchema.ts +1 -2
- package/src/api/parameters/__tests__/$parameter.spec.ts +229 -50
- package/src/api/parameters/controllers/AdminParameterController.ts +9 -12
- package/src/api/parameters/entities/parameters.ts +29 -16
- package/src/api/parameters/primitives/$parameter.ts +3 -3
- package/src/api/parameters/schemas/activateParameterBodySchema.ts +4 -4
- package/src/api/parameters/schemas/createParameterVersionBodySchema.ts +15 -15
- package/src/api/parameters/schemas/parameterCreatorSummarySchema.ts +7 -7
- package/src/api/parameters/schemas/parameterCurrentResponseSchema.ts +7 -7
- package/src/api/parameters/schemas/parameterHistoryResponseSchema.ts +3 -3
- package/src/api/parameters/schemas/parameterNameParamSchema.ts +2 -3
- package/src/api/parameters/schemas/parameterNamesResponseSchema.ts +3 -3
- package/src/api/parameters/schemas/parameterResponseSchema.ts +3 -3
- package/src/api/parameters/schemas/parameterStatusSchema.ts +2 -2
- package/src/api/parameters/schemas/parameterTreeNodeSchema.ts +6 -6
- package/src/api/parameters/schemas/parameterVersionParamSchema.ts +5 -6
- package/src/api/parameters/schemas/parameterVersionResponseSchema.ts +3 -3
- package/src/api/parameters/schemas/rollbackParameterBodySchema.ts +6 -9
- package/src/api/parameters/services/ParameterProvider.ts +152 -65
- package/src/api/payments/controllers/AdminPaymentController.ts +7 -7
- package/src/api/payments/controllers/MockCheckoutController.ts +79 -28
- package/src/api/payments/controllers/PaymentController.ts +4 -4
- package/src/api/payments/entities/paymentIntents.ts +11 -11
- package/src/api/payments/entities/paymentMethods.ts +11 -11
- package/src/api/payments/entities/refunds.ts +9 -9
- package/src/api/payments/providers/PaymentProvider.ts +18 -0
- package/src/api/payments/schemas/intentSchemas.ts +25 -25
- package/src/api/payments/schemas/paymentMethodSchemas.ts +3 -3
- package/src/api/payments/services/PaymentService.ts +60 -3
- package/src/api/subscriptions/__tests__/SubscriptionService.spec.ts +14 -0
- package/src/api/subscriptions/controllers/AdminSubscriptionController.ts +11 -11
- package/src/api/subscriptions/controllers/SubscriptionController.ts +5 -4
- package/src/api/subscriptions/entities/subscriptionEvents.ts +15 -15
- package/src/api/subscriptions/entities/subscriptions.ts +22 -22
- package/src/api/subscriptions/notifications/SubscriptionNotifications.ts +22 -22
- package/src/api/subscriptions/schemas/cancelSubscriptionSchema.ts +4 -4
- package/src/api/subscriptions/schemas/changePlanSchema.ts +5 -5
- package/src/api/subscriptions/schemas/createSubscriptionSchema.ts +14 -7
- package/src/api/subscriptions/schemas/entitlementsSchema.ts +10 -10
- package/src/api/subscriptions/schemas/mrrSchema.ts +9 -9
- package/src/api/subscriptions/schemas/planDefinitionSchema.ts +21 -21
- package/src/api/subscriptions/schemas/planResourceSchema.ts +19 -19
- package/src/api/subscriptions/schemas/subscriptionQuerySchema.ts +8 -8
- package/src/api/subscriptions/schemas/subscriptionSettingsSchema.ts +7 -7
- package/src/api/subscriptions/schemas/subscriptionStatsSchema.ts +17 -17
- package/src/api/subscriptions/services/SubscriptionConfig.ts +2 -2
- package/src/api/users/__tests__/ApiKeys-integration.spec.ts +11 -11
- package/src/api/users/atoms/realmAuthSettingsAtom.ts +111 -119
- package/src/api/users/controllers/AdminIdentityController.ts +29 -19
- package/src/api/users/controllers/AdminSessionController.ts +37 -27
- package/src/api/users/controllers/AdminUserController.ts +75 -53
- package/src/api/users/controllers/MySessionController.ts +125 -0
- package/src/api/users/controllers/RealmController.ts +9 -10
- package/src/api/users/controllers/UserController.ts +55 -55
- package/src/api/users/entities/identities.ts +8 -8
- package/src/api/users/entities/sessions.ts +17 -17
- package/src/api/users/entities/users.ts +17 -17
- package/src/api/users/index.ts +3 -0
- package/src/api/users/notifications/UserNotifications.ts +76 -24
- package/src/api/users/primitives/$realm.ts +12 -26
- package/src/api/users/providers/RealmProvider.ts +0 -15
- package/src/api/users/schemas/completePasswordResetRequestSchema.ts +8 -12
- package/src/api/users/schemas/completeRegistrationRequestSchema.ts +17 -20
- package/src/api/users/schemas/createUserSchema.ts +2 -2
- package/src/api/users/schemas/identityQuerySchema.ts +4 -4
- package/src/api/users/schemas/identityResourceSchema.ts +3 -2
- package/src/api/users/schemas/loginSchema.ts +4 -4
- package/src/api/users/schemas/passwordResetIntentResponseSchema.ts +6 -8
- package/src/api/users/schemas/realmConfigSchema.ts +10 -24
- package/src/api/users/schemas/registerQuerySchema.ts +6 -6
- package/src/api/users/schemas/registerRequestSchema.ts +21 -43
- package/src/api/users/schemas/registerResponseSchema.ts +2 -2
- package/src/api/users/schemas/registerSchema.ts +13 -31
- package/src/api/users/schemas/registrationIntentResponseSchema.ts +19 -23
- package/src/api/users/schemas/resetPasswordSchema.ts +10 -17
- package/src/api/users/schemas/sessionQuerySchema.ts +3 -3
- package/src/api/users/schemas/sessionResourceSchema.ts +25 -25
- package/src/api/users/schemas/updateUserSchema.ts +3 -4
- package/src/api/users/schemas/userQuerySchema.ts +7 -7
- package/src/api/users/services/RegistrationService.ts +25 -11
- package/src/api/users/services/UserService.ts +12 -6
- package/src/api/verifications/__tests__/CodeVerification.spec.ts +63 -101
- package/src/api/verifications/__tests__/LinkVerification.spec.ts +23 -92
- package/src/api/verifications/controllers/VerificationController.ts +13 -27
- package/src/api/verifications/entities/verifications.ts +13 -14
- package/src/api/verifications/schemas/requestVerificationCodeResponseSchema.ts +17 -14
- package/src/api/verifications/schemas/validateVerificationCodeResponseSchema.ts +9 -10
- package/src/api/verifications/schemas/verificationSettingsSchema.ts +65 -66
- package/src/api/verifications/schemas/verificationTypeEnumSchema.ts +2 -2
- package/src/api/verifications/services/VerificationService.ts +12 -0
- package/src/background/__tests__/BackgroundTaskProvider.spec.ts +36 -0
- package/src/batch/__tests__/$batch.spec.ts +22 -22
- package/src/batch/__tests__/startup-buffering.spec.ts +9 -9
- package/src/bin/index.ts +1 -1
- package/src/bucket/__tests__/TenantScopedBucket.spec.ts +60 -0
- package/src/bucket/providers/LocalFileStorageProvider.ts +14 -6
- package/src/bucket/providers/MemoryFileStorageProvider.ts +18 -7
- package/src/bucket/providers/R2FileStorageProvider.ts +14 -6
- package/src/bucket/providers/S3FileStorageProvider.ts +31 -15
- package/src/cache/core/primitives/$cache.ts +7 -10
- package/src/cache/database/entities/cacheEntries.ts +16 -27
- package/src/cache/database/providers/DatabaseCacheProvider.ts +15 -13
- package/src/cache/redis/providers/RedisCacheProvider.ts +6 -6
- package/src/captcha/providers/TurnstileCaptchaProvider.ts +4 -4
- package/src/cli/core/__tests__/BuildCloudflareTask.spec.ts +178 -0
- package/src/cli/core/__tests__/BuildDockerTask.spec.ts +0 -2
- package/src/cli/core/__tests__/DbCommand.spec.ts +108 -0
- package/src/cli/core/atoms/appEntryOptions.ts +5 -5
- package/src/cli/core/atoms/buildOptions.ts +76 -76
- package/src/cli/core/atoms/changelogOptions.ts +3 -3
- package/src/cli/core/atoms/devOptions.ts +3 -3
- package/src/cli/core/commands/build.ts +36 -39
- package/src/cli/core/commands/db.ts +171 -83
- package/src/cli/core/commands/dev.ts +8 -8
- package/src/cli/core/commands/gen/changelog.ts +12 -14
- package/src/cli/core/commands/gen/env.ts +6 -6
- package/src/cli/core/commands/gen/openapi.ts +6 -6
- package/src/cli/core/commands/init.ts +28 -33
- package/src/cli/core/commands/pack.ts +10 -10
- package/src/cli/core/commands/root.ts +7 -8
- package/src/cli/core/commands/test.ts +17 -20
- package/src/cli/core/tasks/BuildCloudflareTask.ts +103 -230
- package/src/cli/core/templates/apiHelloResponseSchemaTs.ts +4 -4
- package/src/cli/devtools/atoms/devtoolsOptions.ts +6 -6
- package/src/cli/i18n/atoms/i18nOptions.ts +8 -8
- package/src/cli/platform/commands/SecretsCommand.ts +24 -25
- package/src/cli/platform/commands/platform.ts +40 -46
- package/src/cli/platform/index.ts +1 -1
- package/src/cli/platform-lib/__tests__/CloudflareAdapter.spec.ts +0 -4
- package/src/cli/platform-lib/__tests__/PlatformInspector.spec.ts +10 -3
- package/src/cli/platform-lib/__tests__/VercelAdapter.spec.ts +0 -2
- package/src/cli/platform-lib/adapters/CloudflareAdapter.ts +13 -14
- package/src/cli/platform-lib/adapters/VercelAdapter.ts +6 -11
- package/src/cli/platform-lib/atoms/platformOptions.ts +46 -25
- package/src/cli/platform-lib/schemas/cloudflare.ts +87 -87
- package/src/cli/platform-lib/schemas/platform.ts +51 -51
- package/src/cli/platform-lib/schemas/vercel.ts +28 -28
- package/src/cli/platform-lib/services/CloudflareApi.ts +5 -5
- package/src/cli/platform-lib/services/VercelApi.ts +4 -4
- package/src/cli/platform-lib/services/VercelCli.ts +6 -15
- package/src/cli/platform-lib/services/WranglerApi.ts +6 -15
- package/src/cli/vendor/atoms/vendorOptions.ts +9 -9
- package/src/cli/vendor/commands/VendorCommand.ts +11 -12
- package/src/command/__tests__/$command.spec.ts +82 -83
- package/src/command/__tests__/Asker.spec.ts +6 -13
- package/src/command/__tests__/CliProvider.spec.ts +136 -149
- package/src/command/__tests__/Runner.spec.ts +86 -110
- package/src/command/helpers/Asker.ts +23 -58
- package/src/command/helpers/Runner.ts +34 -110
- package/src/command/index.ts +4 -9
- package/src/command/primitives/$command.ts +10 -10
- package/src/command/providers/CliProvider.ts +183 -161
- package/src/core/Alepha.ts +62 -13
- package/src/core/__tests__/$atom.spec.ts +52 -3
- package/src/core/__tests__/$computed.spec.ts +129 -0
- package/src/core/__tests__/$env.spec.ts +13 -13
- package/src/core/__tests__/$inject.spec.ts +4 -4
- package/src/core/__tests__/$module.spec.ts +1 -1
- package/src/core/__tests__/Alepha-graph.spec.ts +1 -1
- package/src/core/__tests__/Alepha-parseEnv.spec.ts +32 -32
- package/src/core/__tests__/Alepha-start.spec.ts +3 -3
- package/src/core/__tests__/CodecManager.spec.ts +113 -94
- package/src/core/__tests__/KeylessJsonSchemaCodec.spec.ts +138 -138
- package/src/core/__tests__/SchemaValidator.spec.ts +43 -44
- package/src/core/__tests__/StateManager.persist.browser.spec.ts +87 -0
- package/src/core/__tests__/StateManager.spec.ts +423 -0
- package/src/core/__tests__/TypeBox-usecases.spec.ts +8 -8
- package/src/core/__tests__/TypeProvider.spec.ts +314 -309
- package/src/core/__tests__/dump.spec.ts +6 -6
- package/src/core/__tests__/pagination.spec.ts +4 -4
- package/src/core/__tests__/scoped-after-start.spec.ts +43 -0
- package/src/core/errors/TypeBoxError.ts +10 -4
- package/src/core/helpers/FileLike.ts +5 -5
- package/src/core/helpers/coerceStrings.ts +70 -0
- package/src/core/helpers/jsonSchemaToZod.ts +112 -0
- package/src/core/index.shared.ts +4 -1
- package/src/core/primitives/$atom.ts +95 -27
- package/src/core/primitives/$computed.ts +148 -0
- package/src/core/primitives/$env.ts +5 -5
- package/src/core/primitives/$state.ts +1 -1
- package/src/core/providers/AlsProvider.ts +26 -0
- package/src/core/providers/CodecManager.ts +1 -2
- package/src/core/providers/JsonSchemaCodec.ts +1 -2
- package/src/core/providers/KeylessJsonSchemaCodec.ts +82 -57
- package/src/core/providers/SchemaValidator.ts +48 -158
- package/src/core/providers/StateManager.ts +383 -9
- package/src/core/providers/TypeProvider.ts +80 -734
- package/src/core/providers/ZodProvider.ts +380 -0
- package/src/core/providers/zodAugment.ts +69 -0
- package/src/core/schemas/pageQuerySchema.ts +19 -21
- package/src/core/schemas/pageSchema.ts +47 -57
- package/src/crypto/__tests__/SecretProvider.spec.ts +31 -0
- package/src/crypto/providers/SecretProvider.ts +16 -10
- package/src/datetime/primitives/$throttle.ts +6 -1
- package/src/email/brevo/providers/BrevoEmailProvider.ts +4 -4
- package/src/email/cloudflare/providers/CloudflareEmailProvider.ts +6 -6
- package/src/email/core/index.ts +7 -2
- package/src/email/core/primitives/$email.ts +5 -1
- package/src/email/core/providers/LocalEmailProvider.ts +5 -5
- package/src/email/smtp/providers/NodemailerEmailProvider.ts +41 -52
- package/src/fake/__tests__/FakeProvider.spec.ts +110 -110
- package/src/fake/__tests__/keyName.example.ts +21 -21
- package/src/fake/__tests__/keyName.spec.ts +41 -41
- package/src/fake/__tests__/module.example.ts +8 -8
- package/src/fake/providers/FakeProvider.ts +122 -121
- package/src/lock/core/__tests__/lock-mutual-exclusion.spec.ts +44 -0
- package/src/lock/core/index.ts +1 -0
- package/src/lock/core/primitives/$lock.ts +13 -6
- package/src/logger/__tests__/CliFormatterProvider.spec.ts +76 -0
- package/src/logger/__tests__/Logger.spec.ts +49 -0
- package/src/logger/index.ts +25 -18
- package/src/logger/providers/CliFormatterProvider.ts +75 -0
- package/src/logger/schemas/logEntrySchema.ts +10 -10
- package/src/logger/services/Logger.ts +18 -0
- package/src/mcp/__tests__/$prompt.spec.ts +21 -23
- package/src/mcp/__tests__/$tool.spec.ts +22 -22
- package/src/mcp/__tests__/McpServerProvider.spec.ts +11 -11
- package/src/mcp/__tests__/StreamableHttpMcpTransport.spec.ts +2 -2
- package/src/mcp/__tests__/integration.spec.ts +33 -33
- package/src/mcp/primitives/$prompt.ts +11 -9
- package/src/mcp/primitives/$tool.ts +27 -86
- package/src/mcp/transports/StreamableHttpMcpTransport.ts +7 -7
- package/src/orm/__tests__/$repository-tests.ts +133 -27
- package/src/orm/__tests__/$repository.spec.ts +23 -0
- package/src/orm/__tests__/$transactional-tests.ts +4 -4
- package/src/orm/__tests__/ModelBuilder-tests.ts +28 -28
- package/src/orm/__tests__/ModelBuilder.spec.ts +124 -106
- package/src/orm/__tests__/QueryManager.spec.ts +5 -5
- package/src/orm/__tests__/delete-returning-tests.ts +11 -11
- package/src/orm/__tests__/deletedAt-tests.ts +3 -3
- package/src/orm/__tests__/enums.spec.ts +29 -25
- package/src/orm/__tests__/execute-tests.ts +8 -8
- package/src/orm/__tests__/fixtures/bigEntitySchema.ts +48 -48
- package/src/orm/__tests__/fixtures/userEntitySchema.ts +6 -6
- package/src/orm/__tests__/joins-tests.ts +30 -30
- package/src/orm/__tests__/organization-tests.ts +105 -3
- package/src/orm/__tests__/organization.spec.ts +46 -0
- package/src/orm/__tests__/orm-errors.spec.ts +10 -10
- package/src/orm/__tests__/orm-next-tests.ts +29 -29
- package/src/orm/__tests__/orm-showcase-tests.ts +9 -9
- package/src/orm/__tests__/primaryKey.spec.ts +4 -4
- package/src/orm/__tests__/query-date-encoding-tests.ts +17 -17
- package/src/orm/__tests__/ref-auto-onDelete.spec.ts +14 -14
- package/src/orm/__tests__/references.spec.ts +7 -7
- package/src/orm/__tests__/security.spec.ts +17 -17
- package/src/orm/__tests__/string-operators-tests.ts +5 -5
- package/src/orm/__tests__/timestamps-tests.ts +14 -14
- package/src/orm/__tests__/validation-tests.ts +5 -5
- package/src/orm/core/__tests__/BunSqliteProvider.bun.spec.ts +8 -8
- package/src/orm/core/constants/PG_SYMBOLS.ts +13 -1
- package/src/orm/core/entities/alephaSequences.ts +8 -8
- package/src/orm/core/helpers/pgAttr.ts +4 -4
- package/src/orm/core/primitives/$entity.ts +10 -6
- package/src/orm/core/providers/DatabaseTypeProvider.ts +46 -53
- package/src/orm/core/providers/drivers/BunSqliteProvider.ts +8 -8
- package/src/orm/core/providers/drivers/CloudflareD1Provider.ts +3 -5
- package/src/orm/core/providers/drivers/NodeSqliteProvider.ts +8 -8
- package/src/orm/core/schemas/databaseEnvSchema.ts +4 -4
- package/src/orm/core/schemas/insertSchema.ts +14 -18
- package/src/orm/core/schemas/legacyIdSchema.ts +2 -2
- package/src/orm/core/schemas/updateSchema.ts +10 -16
- package/src/orm/core/services/PgRelationManager.ts +2 -2
- package/src/orm/core/services/QueryManager.ts +13 -2
- package/src/orm/core/services/Repository.ts +88 -33
- package/src/orm/core/services/SqliteModelBuilder.ts +38 -45
- package/src/orm/postgres/__tests__/BunPostgresProvider.bun.spec.ts +4 -4
- package/src/orm/postgres/providers/CloudflareHyperdriveProvider.ts +4 -6
- package/src/orm/postgres/schemas/postgresEnvSchema.ts +6 -6
- package/src/orm/postgres/services/PostgresModelBuilder.ts +127 -114
- package/src/queue/core/__tests__/$consumer.spec.ts +4 -4
- package/src/queue/core/__tests__/WorkerProvider.spec.ts +4 -4
- package/src/queue/core/__tests__/shared.ts +6 -6
- package/src/queue/core/primitives/$consumer.ts +5 -5
- package/src/queue/core/primitives/$queue.ts +44 -61
- package/src/queue/core/providers/CloudflareQueueProvider.ts +6 -0
- package/src/queue/core/providers/WorkerProvider.ts +17 -14
- package/src/queue/redis/providers/RedisQueueProvider.ts +3 -3
- package/src/react/core/__tests__/ErrorBoundary.browser.spec.tsx +92 -0
- package/src/react/core/__tests__/Router.spec.tsx +4 -4
- package/src/react/core/__tests__/useComputed.browser.spec.tsx +192 -0
- package/src/react/core/__tests__/useQuery.browser.spec.tsx +48 -0
- package/src/react/core/__tests__/useSelector.browser.spec.tsx +105 -0
- package/src/react/core/__tests__/useStore.browser.spec.tsx +113 -0
- package/src/react/core/components/ErrorBoundary.tsx +42 -0
- package/src/react/core/hooks/useAction.ts +56 -19
- package/src/react/core/hooks/useComputed.ts +91 -0
- package/src/react/core/hooks/useSelector.ts +67 -0
- package/src/react/core/hooks/useStore.ts +36 -17
- package/src/react/core/index.ts +3 -0
- package/src/react/core/utils/shallowEqual.ts +36 -0
- package/src/react/form/__tests__/FormModel-submit-loading.spec.ts +2 -2
- package/src/react/form/__tests__/form-submitting-reactive.browser.spec.tsx +5 -5
- package/src/react/form/__tests__/useForm.browser.spec.tsx +54 -54
- package/src/react/form/errors/FormValidationError.ts +0 -2
- package/src/react/form/hooks/useForm.ts +19 -4
- package/src/react/form/hooks/useFormQuerySync.ts +0 -0
- package/src/react/form/services/FormModel.ts +67 -47
- package/src/react/form/services/parseField.ts +66 -27
- package/src/react/i18n/__tests__/Localize.spec.tsx +1 -1
- package/src/react/i18n/providers/I18nProvider.ts +2 -2
- package/src/react/router/__tests__/$page.browser.spec.tsx +19 -19
- package/src/react/router/__tests__/$page.spec.tsx +21 -21
- package/src/react/router/__tests__/ReactBrowserProvider.browser.spec.ts +87 -1
- package/src/react/router/atoms/ssrManifestAtom.ts +16 -16
- package/src/react/router/components/NestedView.tsx +11 -3
- package/src/react/router/hooks/useQueryParams.ts +1 -1
- package/src/react/router/primitives/$page.ts +2 -2
- package/src/react/router/providers/ReactBrowserProvider.ts +64 -13
- package/src/react/router/providers/ReactPageProvider.ts +26 -12
- package/src/react/router/providers/ReactServerProvider.ts +13 -15
- package/src/react/sitemap/__tests__/$sitemap.spec.ts +2 -2
- package/src/react/ui/atoms/uiAtom.ts +6 -6
- package/src/react/ui/atoms/uiThemeListAtom.ts +7 -7
- package/src/react/ui/hooks/useColorMode.ts +11 -4
- package/src/react/ui/services/SchemaControl.ts +4 -4
- package/src/redis/providers/BunRedisProvider.ts +19 -11
- package/src/redis/providers/NodeRedisProvider.ts +3 -3
- package/src/scheduler/primitives/$scheduler.ts +21 -8
- package/src/security/__tests__/assertRealmScope.spec.ts +29 -0
- package/src/security/atoms/currentTenantAtom.ts +6 -6
- package/src/security/atoms/currentUserAtom.ts +2 -2
- package/src/security/primitives/$issuer.ts +24 -2
- package/src/security/providers/JwtProvider.ts +100 -0
- package/src/security/providers/SecurityProvider.ts +43 -2
- package/src/security/schemas/permissionSchema.ts +19 -19
- package/src/security/schemas/roleSchema.ts +22 -28
- package/src/security/schemas/userAccountInfoSchema.ts +47 -37
- package/src/server/auth/index.ts +0 -3
- package/src/server/auth/primitives/$auth.ts +6 -6
- package/src/server/auth/primitives/$authApple.ts +10 -10
- package/src/server/auth/primitives/$authFacebook.ts +10 -10
- package/src/server/auth/primitives/$authFranceConnect.ts +10 -10
- package/src/server/auth/primitives/$authGithub.ts +10 -10
- package/src/server/auth/primitives/$authGoogle.ts +10 -10
- package/src/server/auth/primitives/$authMicrosoft.ts +14 -14
- package/src/server/auth/providers/ServerAuthProvider.ts +49 -48
- package/src/server/auth/schemas/authenticationProviderSchema.ts +9 -12
- package/src/server/auth/schemas/tokenResponseSchema.ts +2 -2
- package/src/server/auth/schemas/tokensSchema.ts +16 -16
- package/src/server/auth/schemas/userinfoResponseSchema.ts +3 -3
- package/src/server/cookies/__tests__/AtomCookieBinding.spec.ts +80 -0
- package/src/server/cookies/__tests__/AtomCookiePersistence.browser.spec.ts +169 -0
- package/src/server/cookies/__tests__/AtomCookiePersistence.spec.ts +294 -0
- package/src/server/cookies/__tests__/ServerCookiesProvider.spec.ts +14 -14
- package/src/server/cookies/index.browser.ts +4 -1
- package/src/server/cookies/index.ts +8 -1
- package/src/server/cookies/primitives/$cookie.browser.ts +1 -1
- package/src/server/cookies/primitives/$cookie.ts +16 -0
- package/src/server/cookies/providers/AtomCookiePersistence.browser.ts +133 -0
- package/src/server/cookies/providers/AtomCookiePersistence.ts +148 -0
- package/src/server/cookies/providers/ServerCookiesProvider.ts +13 -5
- package/src/server/cookies/services/CookieParser.ts +6 -1
- package/src/server/core/__tests__/$action.spec.ts +13 -13
- package/src/server/core/__tests__/$middleware.spec.ts +10 -10
- package/src/server/core/__tests__/$route.spec.ts +9 -9
- package/src/server/core/__tests__/$sse.spec.ts +26 -26
- package/src/server/core/__tests__/BunHttpServerProvider.bun.spec.ts +6 -6
- package/src/server/core/__tests__/HttpClient.spec.ts +2 -2
- package/src/server/core/__tests__/NodeHttpServerProvider.spec.ts +15 -3
- package/src/server/core/__tests__/ServerBodyParserProvider.spec.ts +14 -14
- package/src/server/core/__tests__/ServerMultipartProvider.spec.ts +33 -33
- package/src/server/core/__tests__/ServerRouterProvider-errorHandler.spec.ts +5 -1
- package/src/server/core/__tests__/ServerRouterProvider-getRoutes.spec.ts +25 -25
- package/src/server/core/__tests__/ServerRouterProvider-serializationError.spec.ts +9 -5
- package/src/server/core/__tests__/ServerRouterProvider-validationError.spec.ts +56 -24
- package/src/server/core/errors/ValidationError.ts +6 -3
- package/src/server/core/helpers/isMultipart.ts +2 -1
- package/src/server/core/index.ts +5 -2
- package/src/server/core/interfaces/ServerRequest.ts +6 -14
- package/src/server/core/primitives/$action.ts +26 -36
- package/src/server/core/primitives/$sse.ts +3 -3
- package/src/server/core/providers/BunHttpServerProvider.ts +8 -9
- package/src/server/core/providers/NodeHttpServerProvider.ts +8 -9
- package/src/server/core/providers/ServerBodyParserProvider.ts +20 -12
- package/src/server/core/providers/ServerCompressProvider.ts +9 -10
- package/src/server/core/providers/ServerHelmetProvider.ts +26 -27
- package/src/server/core/providers/ServerMultipartProvider.ts +19 -19
- package/src/server/core/providers/ServerRouterProvider.ts +44 -15
- package/src/server/core/schemas/errorSchema.ts +20 -25
- package/src/server/core/schemas/okSchema.ts +9 -14
- package/src/server/core/services/HttpClient.ts +13 -1
- package/src/server/core/services/ServerRequestParser.ts +6 -6
- package/src/server/cors/providers/ServerCorsProvider.ts +26 -28
- package/src/server/health/schemas/healthSchema.ts +6 -6
- package/src/server/links/__tests__/$remote.spec.ts +3 -3
- package/src/server/links/__tests__/BatchEndpoint.spec.ts +9 -9
- package/src/server/links/__tests__/LinkProvider.spec.ts +9 -9
- package/src/server/links/__tests__/ServerLinksProvider.spec.ts +23 -23
- package/src/server/links/__tests__/fixtures/CrudApp.ts +21 -21
- package/src/server/links/atoms/apiLinksAtom.ts +2 -2
- package/src/server/links/atoms/linkOptionsAtom.ts +6 -6
- package/src/server/links/primitives/$remote.ts +3 -3
- package/src/server/links/providers/LinkProvider.ts +3 -3
- package/src/server/links/providers/ServerLinksProvider.ts +20 -20
- package/src/server/links/schemas/apiLinksResponseSchema.ts +23 -23
- package/src/server/proxy/__tests__/$proxy.spec.ts +9 -9
- package/src/server/proxy/providers/ServerProxyProvider.ts +5 -0
- package/src/server/rate-limit/providers/ServerRateLimitProvider.ts +18 -20
- package/src/server/swagger/__tests__/$swagger.spec.ts +91 -94
- package/src/server/swagger/__tests__/ui.spec.ts +3 -3
- package/src/server/swagger/providers/ServerSwaggerProvider.ts +66 -43
- package/src/system/__tests__/NodeShellProvider.spec.ts +46 -0
- package/src/system/providers/NodeShellProvider.ts +4 -1
- package/src/topic/core/__tests__/$subscriber.spec.ts +4 -4
- package/src/topic/core/__tests__/shared.ts +8 -8
- package/src/topic/core/primitives/$subscriber.ts +5 -5
- package/src/topic/core/primitives/$topic.ts +14 -14
- package/src/topic/redis/providers/RedisTopicProvider.ts +3 -3
- package/dist/container/core/index.d.ts +0 -236
- package/dist/container/core/index.d.ts.map +0 -1
- package/dist/container/core/index.js +0 -231
- package/dist/container/core/index.js.map +0 -1
- package/dist/container/core/index.workerd.js +0 -192
- package/dist/container/core/index.workerd.js.map +0 -1
- package/src/command/helpers/PrettyAsker.ts +0 -256
- package/src/command/helpers/PrettyPrint.ts +0 -332
- package/src/container/core/__tests__/$container.spec.ts +0 -83
- package/src/container/core/index.ts +0 -50
- package/src/container/core/index.workerd.ts +0 -53
- package/src/container/core/interfaces/ContainerOptions.ts +0 -69
- package/src/container/core/primitives/$container.ts +0 -100
- package/src/container/core/providers/CloudflareContainerProvider.ts +0 -70
- package/src/container/core/providers/ContainerProvider.ts +0 -92
- package/src/container/core/providers/MockContainerProvider.ts +0 -62
- package/src/container/core/providers/NodeContainerProvider.ts +0 -53
- package/src/core/__tests__/jsonSchemaToTypeBox.spec.ts +0 -771
- package/src/core/helpers/jsonSchemaToTypeBox.ts +0 -359
- package/src/server/auth/__tests__/authFederationClient.spec.ts +0 -40
- package/src/server/auth/__tests__/federationAssertion.spec.ts +0 -146
- package/src/server/auth/helpers/federationAssertion.ts +0 -74
- package/src/server/auth/primitives/$authFederationBroker.ts +0 -273
- package/src/server/auth/primitives/$authFederationClient.ts +0 -89
- /package/dist/orm/core/{chunk-B4FMCO8f.js → rolldown-runtime-B4FMCO8f.js} +0 -0
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import { type Static,
|
|
1
|
+
import { type Static, z } from "alepha";
|
|
2
2
|
import { logEntrySchema } from "alepha/logger";
|
|
3
3
|
import { notificationResourceSchema } from "./notificationResourceSchema.ts";
|
|
4
4
|
|
|
5
|
-
export const notificationDetailResourceSchema =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
{
|
|
5
|
+
export const notificationDetailResourceSchema = notificationResourceSchema
|
|
6
|
+
.extend({
|
|
7
|
+
variables: z.record(z.text(), z.any()).optional(),
|
|
8
|
+
rendered: z.record(z.text(), z.any()).optional(),
|
|
9
|
+
logs: z.array(logEntrySchema).optional(),
|
|
10
|
+
})
|
|
11
|
+
.meta({
|
|
13
12
|
title: "NotificationDetailResource",
|
|
14
13
|
description: "A notification resource with rendered content and logs.",
|
|
15
|
-
}
|
|
16
|
-
);
|
|
14
|
+
});
|
|
17
15
|
|
|
18
16
|
export type NotificationDetailResource = Static<
|
|
19
17
|
typeof notificationDetailResourceSchema
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { type Static,
|
|
1
|
+
import { type Static, z } from "alepha";
|
|
2
2
|
|
|
3
|
-
export const notificationPayloadSchema =
|
|
4
|
-
type:
|
|
5
|
-
template:
|
|
6
|
-
contact:
|
|
7
|
-
variables:
|
|
8
|
-
category:
|
|
9
|
-
critical:
|
|
10
|
-
sensitive:
|
|
3
|
+
export const notificationPayloadSchema = z.object({
|
|
4
|
+
type: z.enum(["email", "sms"]),
|
|
5
|
+
template: z.text(),
|
|
6
|
+
contact: z.text(),
|
|
7
|
+
variables: z.record(z.text(), z.any()).optional(),
|
|
8
|
+
category: z.text().optional(),
|
|
9
|
+
critical: z.boolean().optional(),
|
|
10
|
+
sensitive: z.boolean().optional(),
|
|
11
|
+
/** Recipient language (e.g. "fr" or "fr-FR") used to pick `translations`. */
|
|
12
|
+
lang: z.text().optional(),
|
|
11
13
|
});
|
|
12
14
|
|
|
13
15
|
export type NotificationPayload = Static<typeof notificationPayloadSchema>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type Static,
|
|
1
|
+
import { type Static, z } from "alepha";
|
|
2
2
|
import { pageQuerySchema } from "alepha/orm";
|
|
3
3
|
|
|
4
|
-
export const notificationQuerySchema =
|
|
5
|
-
status:
|
|
6
|
-
|
|
4
|
+
export const notificationQuerySchema = pageQuerySchema.extend({
|
|
5
|
+
status: z
|
|
6
|
+
.enum([
|
|
7
7
|
"pending",
|
|
8
8
|
"scheduled",
|
|
9
9
|
"retrying",
|
|
@@ -11,8 +11,8 @@ export const notificationQuerySchema = t.extend(pageQuerySchema, {
|
|
|
11
11
|
"completed",
|
|
12
12
|
"dead",
|
|
13
13
|
"cancelled",
|
|
14
|
-
])
|
|
15
|
-
|
|
14
|
+
])
|
|
15
|
+
.optional(),
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
export type NotificationQuery = Static<typeof notificationQuerySchema>;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { type Static,
|
|
1
|
+
import { type Static, z } from "alepha";
|
|
2
2
|
|
|
3
|
-
export const notificationResourceSchema =
|
|
4
|
-
id:
|
|
5
|
-
createdAt:
|
|
6
|
-
status:
|
|
7
|
-
template:
|
|
8
|
-
type:
|
|
9
|
-
contact:
|
|
10
|
-
category:
|
|
11
|
-
critical:
|
|
12
|
-
sensitive:
|
|
13
|
-
startedAt:
|
|
14
|
-
completedAt:
|
|
15
|
-
error:
|
|
3
|
+
export const notificationResourceSchema = z.object({
|
|
4
|
+
id: z.uuid(),
|
|
5
|
+
createdAt: z.datetime(),
|
|
6
|
+
status: z.text(),
|
|
7
|
+
template: z.text().optional(),
|
|
8
|
+
type: z.text().optional(),
|
|
9
|
+
contact: z.text().optional(),
|
|
10
|
+
category: z.text().optional(),
|
|
11
|
+
critical: z.boolean().optional(),
|
|
12
|
+
sensitive: z.boolean().optional(),
|
|
13
|
+
startedAt: z.datetime().optional(),
|
|
14
|
+
completedAt: z.datetime().optional(),
|
|
15
|
+
error: z.text().optional(),
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
export type NotificationResource = Static<typeof notificationResourceSchema>;
|
|
@@ -5,6 +5,14 @@ import { SmsProvider } from "alepha/sms";
|
|
|
5
5
|
import { $notification } from "../primitives/$notification.ts";
|
|
6
6
|
import type { NotificationPayload } from "../schemas/notificationPayloadSchema.ts";
|
|
7
7
|
|
|
8
|
+
type NotificationMessageEmail = {
|
|
9
|
+
subject: string;
|
|
10
|
+
body: string | ((variables: any) => string);
|
|
11
|
+
};
|
|
12
|
+
type NotificationMessageSms = {
|
|
13
|
+
message: string | ((variables: any) => string);
|
|
14
|
+
};
|
|
15
|
+
|
|
8
16
|
export class NotificationSenderService {
|
|
9
17
|
protected readonly alepha = $inject(Alepha);
|
|
10
18
|
protected readonly log = $logger();
|
|
@@ -51,7 +59,9 @@ export class NotificationSenderService {
|
|
|
51
59
|
public renderSms(payload: NotificationPayload) {
|
|
52
60
|
const { variables, contact, template } = this.load(payload);
|
|
53
61
|
|
|
54
|
-
const sms =
|
|
62
|
+
const sms =
|
|
63
|
+
this.translation(template.options, payload.lang)?.sms ??
|
|
64
|
+
template.options.sms;
|
|
55
65
|
if (!sms) {
|
|
56
66
|
throw new AlephaError(
|
|
57
67
|
`Notification template ${payload.template} has no sms defined`,
|
|
@@ -69,7 +79,9 @@ export class NotificationSenderService {
|
|
|
69
79
|
public renderEmail(payload: NotificationPayload) {
|
|
70
80
|
const { variables, contact, template } = this.load(payload);
|
|
71
81
|
|
|
72
|
-
const email =
|
|
82
|
+
const email =
|
|
83
|
+
this.translation(template.options, payload.lang)?.email ??
|
|
84
|
+
template.options.email;
|
|
73
85
|
if (!email) {
|
|
74
86
|
throw new AlephaError(
|
|
75
87
|
`Notification template ${payload.template} has no email defined`,
|
|
@@ -85,6 +97,30 @@ export class NotificationSenderService {
|
|
|
85
97
|
return { to: contact, subject, body };
|
|
86
98
|
}
|
|
87
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Pick the template's `translations` entry for the payload language:
|
|
102
|
+
* exact match ("fr-FR") first, then the base language ("fr"). Returns
|
|
103
|
+
* undefined when there is no match — callers fall back to the default
|
|
104
|
+
* (template-level) message.
|
|
105
|
+
*/
|
|
106
|
+
protected translation(
|
|
107
|
+
options: {
|
|
108
|
+
translations?: Record<
|
|
109
|
+
string,
|
|
110
|
+
{ email?: unknown; sms?: unknown } | undefined
|
|
111
|
+
>;
|
|
112
|
+
},
|
|
113
|
+
lang?: string,
|
|
114
|
+
):
|
|
115
|
+
| { email?: NotificationMessageEmail; sms?: NotificationMessageSms }
|
|
116
|
+
| undefined {
|
|
117
|
+
if (!lang || !options.translations) return undefined;
|
|
118
|
+
const exact = options.translations[lang];
|
|
119
|
+
if (exact) return exact as any;
|
|
120
|
+
const base = lang.split("-")[0]?.toLowerCase();
|
|
121
|
+
return base ? (options.translations[base] as any) : undefined;
|
|
122
|
+
}
|
|
123
|
+
|
|
88
124
|
protected load(payload: NotificationPayload) {
|
|
89
125
|
const variables = payload.variables || {};
|
|
90
126
|
const contact = payload.contact;
|
|
@@ -55,6 +55,48 @@ describe("OAuthClientService.register", () => {
|
|
|
55
55
|
});
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
+
describe("OAuthClientService.intersectScopes", () => {
|
|
59
|
+
const setup = async () => {
|
|
60
|
+
const alepha = Alepha.create().with(AlephaOrmPostgres);
|
|
61
|
+
const service = alepha.inject(OAuthClientService);
|
|
62
|
+
await alepha.start();
|
|
63
|
+
return service;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
it("drops requested scopes the client is not registered for", async ({
|
|
67
|
+
expect,
|
|
68
|
+
}) => {
|
|
69
|
+
const service = await setup();
|
|
70
|
+
// Client registered for ["mcp"] but asks for admin → admin is stripped.
|
|
71
|
+
expect(service.intersectScopes(["mcp", "admin"], ["mcp"])).toEqual(["mcp"]);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("falls back to the client's registered scopes when none requested", async ({
|
|
75
|
+
expect,
|
|
76
|
+
}) => {
|
|
77
|
+
const service = await setup();
|
|
78
|
+
expect(service.intersectScopes(undefined, ["mcp", "openid"])).toEqual([
|
|
79
|
+
"mcp",
|
|
80
|
+
"openid",
|
|
81
|
+
]);
|
|
82
|
+
expect(service.intersectScopes([], ["mcp"])).toEqual(["mcp"]);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("preserves requested order and de-duplicates", async ({ expect }) => {
|
|
86
|
+
const service = await setup();
|
|
87
|
+
expect(
|
|
88
|
+
service.intersectScopes(["openid", "mcp", "openid"], ["mcp", "openid"]),
|
|
89
|
+
).toEqual(["openid", "mcp"]);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it("returns nothing when no requested scope is allowed", async ({
|
|
93
|
+
expect,
|
|
94
|
+
}) => {
|
|
95
|
+
const service = await setup();
|
|
96
|
+
expect(service.intersectScopes(["admin"], ["mcp"])).toEqual([]);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
58
100
|
describe("OAuthClientService authorization code", () => {
|
|
59
101
|
it("mints and verifies a single-use auth code bound to PKCE", async ({
|
|
60
102
|
expect,
|
|
@@ -231,3 +231,131 @@ describe("OAuthController authorize + token", () => {
|
|
|
231
231
|
expect(body.error).toBe("unsupported_grant_type");
|
|
232
232
|
});
|
|
233
233
|
});
|
|
234
|
+
|
|
235
|
+
describe("OAuthController refresh_token grant", () => {
|
|
236
|
+
/**
|
|
237
|
+
* Boot a server with a **session-backed** issuer (like the platform IdP
|
|
238
|
+
* realm, which wires `onCreateSession`/`onRefreshSession` via
|
|
239
|
+
* `alepha/api/users`). Token-only issuers can't refresh through the endpoint
|
|
240
|
+
* (the old access token isn't carried), so a session store is required to
|
|
241
|
+
* exercise the refresh grant end-to-end.
|
|
242
|
+
*/
|
|
243
|
+
const boot = async () => {
|
|
244
|
+
const sessions = new Map<string, string>(); // refresh_token -> userId
|
|
245
|
+
|
|
246
|
+
class App {
|
|
247
|
+
issuer = $issuer({
|
|
248
|
+
name: "users",
|
|
249
|
+
secret: "test-secret",
|
|
250
|
+
settings: {
|
|
251
|
+
onCreateSession: async (user) => {
|
|
252
|
+
const refreshToken = randomUUID();
|
|
253
|
+
sessions.set(refreshToken, user.id);
|
|
254
|
+
return { refreshToken, sessionId: randomUUID() };
|
|
255
|
+
},
|
|
256
|
+
onRefreshSession: async (refreshToken) => {
|
|
257
|
+
const userId = sessions.get(refreshToken);
|
|
258
|
+
if (!userId) throw new Error("unknown refresh token");
|
|
259
|
+
return {
|
|
260
|
+
user: { id: userId, roles: [] } as UserAccount,
|
|
261
|
+
expiresIn: 3600,
|
|
262
|
+
};
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const alepha = Alepha.create()
|
|
269
|
+
.with(AlephaServer)
|
|
270
|
+
.with(AlephaOrmPostgres)
|
|
271
|
+
.with(AlephaOAuth);
|
|
272
|
+
alepha.set(oauthOptions, {
|
|
273
|
+
realm: "users",
|
|
274
|
+
resource: "/mcp",
|
|
275
|
+
loginPath: "/login",
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
const app = alepha.inject(App);
|
|
279
|
+
await alepha.start();
|
|
280
|
+
|
|
281
|
+
const service = alepha.inject(OAuthClientService);
|
|
282
|
+
service.registerIssuer(
|
|
283
|
+
"users",
|
|
284
|
+
app.issuer,
|
|
285
|
+
async (id) => ({ id, roles: [] }) as UserAccount,
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
const { hostname } = alepha.inject(ServerProvider);
|
|
289
|
+
return { hostname, service };
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
const registerClient = async (
|
|
293
|
+
hostname: string,
|
|
294
|
+
redirectUri: string,
|
|
295
|
+
): Promise<string> => {
|
|
296
|
+
const resp = await fetch(`${hostname}/oauth/register`, {
|
|
297
|
+
method: "POST",
|
|
298
|
+
headers: { "content-type": "application/json" },
|
|
299
|
+
body: JSON.stringify({
|
|
300
|
+
client_name: "Test Client",
|
|
301
|
+
redirect_uris: [redirectUri],
|
|
302
|
+
}),
|
|
303
|
+
});
|
|
304
|
+
const body = (await resp.json()) as Record<string, string>;
|
|
305
|
+
return body.client_id;
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
it("re-mints an id_token on the refresh grant for openid clients", async ({
|
|
309
|
+
expect,
|
|
310
|
+
}) => {
|
|
311
|
+
const { hostname, service } = await boot();
|
|
312
|
+
const redirectUri = "https://claude.ai/api/mcp/auth_callback";
|
|
313
|
+
const clientId = await registerClient(hostname, redirectUri);
|
|
314
|
+
|
|
315
|
+
const verifier = "the-code-verifier-value-1234567890";
|
|
316
|
+
const challenge = createHash("sha256").update(verifier).digest("base64url");
|
|
317
|
+
const userId = randomUUID();
|
|
318
|
+
|
|
319
|
+
// 1) authorization_code exchange → access + refresh + id token.
|
|
320
|
+
const code = await service.createAuthorizationCode("users", {
|
|
321
|
+
userId,
|
|
322
|
+
clientId,
|
|
323
|
+
redirectUri,
|
|
324
|
+
codeChallenge: challenge,
|
|
325
|
+
scopes: ["openid"],
|
|
326
|
+
});
|
|
327
|
+
const tokenResp = await fetch(`${hostname}/oauth/token`, {
|
|
328
|
+
method: "POST",
|
|
329
|
+
headers: { "content-type": "application/x-www-form-urlencoded" },
|
|
330
|
+
body: new URLSearchParams({
|
|
331
|
+
grant_type: "authorization_code",
|
|
332
|
+
code,
|
|
333
|
+
client_id: clientId,
|
|
334
|
+
redirect_uri: redirectUri,
|
|
335
|
+
code_verifier: verifier,
|
|
336
|
+
}).toString(),
|
|
337
|
+
});
|
|
338
|
+
expect(tokenResp.status).toBe(200);
|
|
339
|
+
const tokenBody = (await tokenResp.json()) as Record<string, string>;
|
|
340
|
+
expect(typeof tokenBody.refresh_token).toBe("string");
|
|
341
|
+
expect(typeof tokenBody.id_token).toBe("string");
|
|
342
|
+
|
|
343
|
+
// 2) refresh_token grant — MUST return a fresh id_token so an id_token-based
|
|
344
|
+
// relying party (the stateless Club RP forwards the id_token as Bearer)
|
|
345
|
+
// actually renews its identity, not just the access token.
|
|
346
|
+
const refreshResp = await fetch(`${hostname}/oauth/token`, {
|
|
347
|
+
method: "POST",
|
|
348
|
+
headers: { "content-type": "application/x-www-form-urlencoded" },
|
|
349
|
+
body: new URLSearchParams({
|
|
350
|
+
grant_type: "refresh_token",
|
|
351
|
+
refresh_token: tokenBody.refresh_token,
|
|
352
|
+
client_id: clientId,
|
|
353
|
+
}).toString(),
|
|
354
|
+
});
|
|
355
|
+
expect(refreshResp.status).toBe(200);
|
|
356
|
+
const refreshBody = (await refreshResp.json()) as Record<string, string>;
|
|
357
|
+
expect(typeof refreshBody.access_token).toBe("string");
|
|
358
|
+
expect(refreshBody.token_type).toBe("Bearer");
|
|
359
|
+
expect(typeof refreshBody.id_token).toBe("string");
|
|
360
|
+
});
|
|
361
|
+
});
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { $atom, $inject, $state,
|
|
1
|
+
import { $atom, $inject, $state, z } from "alepha";
|
|
2
2
|
import { $logger } from "alepha/logger";
|
|
3
|
+
import { JwtProvider } from "alepha/security";
|
|
3
4
|
import { $route } from "alepha/server";
|
|
4
5
|
import { renderConsentPage } from "../helpers/consentPage.ts";
|
|
5
6
|
import {
|
|
6
7
|
buildAuthorizationServerMetadata,
|
|
7
8
|
buildProtectedResourceMetadata,
|
|
8
9
|
} from "../helpers/oauthMetadata.ts";
|
|
10
|
+
import { buildOpenIdConfiguration } from "../helpers/oidcMetadata.ts";
|
|
9
11
|
import { authorizeDecisionBodySchema } from "../schemas/authorizeDecisionBodySchema.ts";
|
|
10
12
|
import { authorizeQuerySchema } from "../schemas/authorizeQuerySchema.ts";
|
|
11
13
|
import { registerClientBodySchema } from "../schemas/registerClientBodySchema.ts";
|
|
@@ -22,10 +24,10 @@ import { OAuthClientService } from "../services/OAuthClientService.ts";
|
|
|
22
24
|
export const oauthOptions = $atom({
|
|
23
25
|
name: "alepha.api.oauth.options",
|
|
24
26
|
description: "Configuration for the OAuth authorization server.",
|
|
25
|
-
schema:
|
|
26
|
-
realm:
|
|
27
|
-
resource:
|
|
28
|
-
loginPath:
|
|
27
|
+
schema: z.object({
|
|
28
|
+
realm: z.text({ default: "users" }),
|
|
29
|
+
resource: z.text({ default: "/mcp" }),
|
|
30
|
+
loginPath: z.text({ default: "/login" }),
|
|
29
31
|
}),
|
|
30
32
|
default: { realm: "users", resource: "/mcp", loginPath: "/login" },
|
|
31
33
|
});
|
|
@@ -39,6 +41,7 @@ export class OAuthController {
|
|
|
39
41
|
protected readonly log = $logger();
|
|
40
42
|
protected readonly options = $state(oauthOptions);
|
|
41
43
|
protected readonly clients = $inject(OAuthClientService);
|
|
44
|
+
protected readonly jwt = $inject(JwtProvider);
|
|
42
45
|
|
|
43
46
|
/**
|
|
44
47
|
* Absolute origin of the current request, e.g. https://app.com.
|
|
@@ -70,6 +73,24 @@ export class OAuthController {
|
|
|
70
73
|
},
|
|
71
74
|
});
|
|
72
75
|
|
|
76
|
+
openidConfiguration = $route({
|
|
77
|
+
method: "GET",
|
|
78
|
+
path: "/.well-known/openid-configuration",
|
|
79
|
+
handler: ({ url, reply }) => {
|
|
80
|
+
reply.headers["content-type"] = "application/json";
|
|
81
|
+
reply.body = JSON.stringify(buildOpenIdConfiguration(this.baseUrl(url)));
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
jwks = $route({
|
|
86
|
+
method: "GET",
|
|
87
|
+
path: "/oauth/jwks",
|
|
88
|
+
handler: async ({ reply }) => {
|
|
89
|
+
reply.headers["content-type"] = "application/json";
|
|
90
|
+
reply.body = JSON.stringify(await this.jwt.getJwks(this.options.realm));
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
|
|
73
94
|
register = $route({
|
|
74
95
|
method: "POST",
|
|
75
96
|
path: "/oauth/register",
|
|
@@ -129,7 +150,22 @@ export class OAuthController {
|
|
|
129
150
|
reply.body = "redirect_uri not registered";
|
|
130
151
|
return;
|
|
131
152
|
}
|
|
153
|
+
const silent = query.prompt === "none";
|
|
154
|
+
// Skip the consent screen for `prompt=none` (silent SSO) AND for trusted
|
|
155
|
+
// first-party clients (the AS's own product — consent is for third-party
|
|
156
|
+
// apps). A non-silent trusted client still sends an unauthenticated user
|
|
157
|
+
// through login first; it just never shows the "wants to connect" page.
|
|
158
|
+
const skipConsent = silent || client.trusted === true;
|
|
159
|
+
|
|
132
160
|
if (!user) {
|
|
161
|
+
if (silent) {
|
|
162
|
+
// Silent SSO with no IdP session → OIDC `login_required`.
|
|
163
|
+
const redirect = new URL(query.redirect_uri);
|
|
164
|
+
redirect.searchParams.set("error", "login_required");
|
|
165
|
+
if (query.state) redirect.searchParams.set("state", query.state);
|
|
166
|
+
reply.redirect(redirect.toString(), 302);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
133
169
|
const returnTo = encodeURIComponent(url.pathname + url.search);
|
|
134
170
|
reply.redirect(
|
|
135
171
|
`${this.options.loginPath}?redirect_uri=${returnTo}`,
|
|
@@ -137,11 +173,42 @@ export class OAuthController {
|
|
|
137
173
|
);
|
|
138
174
|
return;
|
|
139
175
|
}
|
|
176
|
+
|
|
177
|
+
if (skipConsent) {
|
|
178
|
+
// Authenticated + (prompt=none OR trusted client) → skip consent and
|
|
179
|
+
// mint the code directly (silent SSO + first-party login).
|
|
180
|
+
const code = await this.clients.createAuthorizationCode(
|
|
181
|
+
this.options.realm,
|
|
182
|
+
{
|
|
183
|
+
userId: user.id,
|
|
184
|
+
clientId: query.client_id,
|
|
185
|
+
redirectUri: query.redirect_uri,
|
|
186
|
+
codeChallenge: query.code_challenge,
|
|
187
|
+
scopes: this.clients.intersectScopes(
|
|
188
|
+
query.scope?.split(" "),
|
|
189
|
+
client.scopes,
|
|
190
|
+
),
|
|
191
|
+
resource: query.resource || undefined,
|
|
192
|
+
nonce: query.nonce,
|
|
193
|
+
},
|
|
194
|
+
);
|
|
195
|
+
const redirect = new URL(query.redirect_uri);
|
|
196
|
+
redirect.searchParams.set("code", code);
|
|
197
|
+
if (query.state) redirect.searchParams.set("state", query.state);
|
|
198
|
+
reply.redirect(redirect.toString(), 302);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
|
|
140
202
|
reply.headers["content-type"] = "text/html; charset=utf-8";
|
|
141
203
|
reply.body = renderConsentPage({
|
|
142
204
|
clientName: client.clientName,
|
|
143
205
|
userName: user.name ?? user.email ?? "your account",
|
|
144
|
-
scopes
|
|
206
|
+
// Show the user the scopes they will actually grant, not the raw
|
|
207
|
+
// (possibly over-broad) request.
|
|
208
|
+
scopes: this.clients.intersectScopes(
|
|
209
|
+
query.scope?.split(" "),
|
|
210
|
+
client.scopes,
|
|
211
|
+
),
|
|
145
212
|
hidden: {
|
|
146
213
|
response_type: query.response_type,
|
|
147
214
|
client_id: query.client_id,
|
|
@@ -151,6 +218,7 @@ export class OAuthController {
|
|
|
151
218
|
scope: query.scope ?? "",
|
|
152
219
|
state: query.state ?? "",
|
|
153
220
|
resource: query.resource ?? "",
|
|
221
|
+
nonce: query.nonce ?? "",
|
|
154
222
|
},
|
|
155
223
|
});
|
|
156
224
|
},
|
|
@@ -201,8 +269,12 @@ export class OAuthController {
|
|
|
201
269
|
clientId: body.client_id,
|
|
202
270
|
redirectUri: body.redirect_uri,
|
|
203
271
|
codeChallenge: body.code_challenge,
|
|
204
|
-
scopes:
|
|
272
|
+
scopes: this.clients.intersectScopes(
|
|
273
|
+
body.scope?.split(" "),
|
|
274
|
+
client.scopes,
|
|
275
|
+
),
|
|
205
276
|
resource: body.resource || undefined,
|
|
277
|
+
nonce: body.nonce,
|
|
206
278
|
},
|
|
207
279
|
);
|
|
208
280
|
redirect.searchParams.set("code", code);
|
|
@@ -222,10 +294,29 @@ export class OAuthController {
|
|
|
222
294
|
path: "/oauth/token",
|
|
223
295
|
schema: { body: tokenRequestBodySchema },
|
|
224
296
|
use: [],
|
|
225
|
-
handler: async ({ body, reply }) => {
|
|
297
|
+
handler: async ({ body, url, reply }) => {
|
|
226
298
|
reply.headers["content-type"] = "application/json";
|
|
227
299
|
try {
|
|
228
300
|
if (body.grant_type === "authorization_code") {
|
|
301
|
+
const client = await this.clients.findByClientId(
|
|
302
|
+
body.client_id ?? "",
|
|
303
|
+
);
|
|
304
|
+
if (!client || client.revokedAt) {
|
|
305
|
+
reply.status = 400;
|
|
306
|
+
reply.body = JSON.stringify({ error: "invalid_client" });
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
if (client.type === "confidential") {
|
|
310
|
+
const ok = await this.clients.verifySecret(
|
|
311
|
+
client.clientId,
|
|
312
|
+
body.client_secret ?? "",
|
|
313
|
+
);
|
|
314
|
+
if (!ok) {
|
|
315
|
+
reply.status = 401;
|
|
316
|
+
reply.body = JSON.stringify({ error: "invalid_client" });
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
229
320
|
const grant = await this.clients.consumeAuthorizationCode(
|
|
230
321
|
this.options.realm,
|
|
231
322
|
body.code ?? "",
|
|
@@ -239,13 +330,25 @@ export class OAuthController {
|
|
|
239
330
|
this.options.realm,
|
|
240
331
|
{ ...grant, clientId: body.client_id ?? "" },
|
|
241
332
|
);
|
|
242
|
-
|
|
333
|
+
const response: Record<string, unknown> = {
|
|
243
334
|
access_token: tokens.access_token,
|
|
244
335
|
token_type: "Bearer",
|
|
245
336
|
expires_in: tokens.expires_in,
|
|
246
337
|
refresh_token: tokens.refresh_token,
|
|
247
338
|
scope: grant.scopes.join(" "),
|
|
248
|
-
}
|
|
339
|
+
};
|
|
340
|
+
if (grant.scopes.includes("openid")) {
|
|
341
|
+
response.id_token = await this.clients.issueIdToken(
|
|
342
|
+
this.options.realm,
|
|
343
|
+
{
|
|
344
|
+
userId: grant.userId,
|
|
345
|
+
clientId: body.client_id ?? "",
|
|
346
|
+
issuer: this.baseUrl(url),
|
|
347
|
+
nonce: grant.nonce,
|
|
348
|
+
},
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
reply.body = JSON.stringify(response);
|
|
249
352
|
return;
|
|
250
353
|
}
|
|
251
354
|
|
|
@@ -254,12 +357,29 @@ export class OAuthController {
|
|
|
254
357
|
this.options.realm,
|
|
255
358
|
body.refresh_token ?? "",
|
|
256
359
|
);
|
|
257
|
-
|
|
360
|
+
const response: Record<string, unknown> = {
|
|
258
361
|
access_token: tokens.access_token,
|
|
259
362
|
token_type: "Bearer",
|
|
260
363
|
expires_in: tokens.expires_in,
|
|
261
364
|
refresh_token: tokens.refresh_token,
|
|
262
|
-
}
|
|
365
|
+
};
|
|
366
|
+
// Re-mint an OIDC `id_token` so id_token-based relying parties (e.g. a
|
|
367
|
+
// stateless OIDC RP that forwards the id_token as the request Bearer)
|
|
368
|
+
// actually renew their identity on refresh — without it the RP keeps
|
|
369
|
+
// forwarding the now-expired id_token and every call 401s. Per OIDC
|
|
370
|
+
// Core §12.2 the refreshed id_token carries no `nonce`; `sub` is
|
|
371
|
+
// unchanged. Requires `client_id` to set the `aud`.
|
|
372
|
+
if (body.client_id) {
|
|
373
|
+
response.id_token = await this.clients.issueIdToken(
|
|
374
|
+
this.options.realm,
|
|
375
|
+
{
|
|
376
|
+
userId: tokens.userId,
|
|
377
|
+
clientId: body.client_id,
|
|
378
|
+
issuer: this.baseUrl(url),
|
|
379
|
+
},
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
reply.body = JSON.stringify(response);
|
|
263
383
|
return;
|
|
264
384
|
}
|
|
265
385
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Static,
|
|
1
|
+
import { type Static, z } from "alepha";
|
|
2
2
|
import { $entity, db } from "alepha/orm";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -11,19 +11,36 @@ import { $entity, db } from "alepha/orm";
|
|
|
11
11
|
*/
|
|
12
12
|
export const oauthClientEntity = $entity({
|
|
13
13
|
name: "oauth_clients",
|
|
14
|
-
schema:
|
|
15
|
-
id: db.primaryKey(
|
|
14
|
+
schema: z.object({
|
|
15
|
+
id: db.primaryKey(z.uuid()),
|
|
16
16
|
createdAt: db.createdAt(),
|
|
17
17
|
updatedAt: db.updatedAt(),
|
|
18
|
-
clientId:
|
|
19
|
-
clientName:
|
|
20
|
-
redirectUris: db.default(
|
|
21
|
-
scopes: db.default(
|
|
22
|
-
realm:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
clientId: z.text({ maxLength: 64 }),
|
|
19
|
+
clientName: z.text({ maxLength: 200 }),
|
|
20
|
+
redirectUris: db.default(z.array(z.text({ maxLength: 2048 })), []),
|
|
21
|
+
scopes: db.default(z.array(z.text({ maxLength: 64 })), []),
|
|
22
|
+
realm: z.text({ maxLength: 100 }),
|
|
23
|
+
/**
|
|
24
|
+
* OAuth client type. `confidential` clients authenticate at the token
|
|
25
|
+
* endpoint with a secret; `public` clients rely on PKCE only.
|
|
26
|
+
*/
|
|
27
|
+
type: db.default(z.enum(["public", "confidential"]), "public"),
|
|
28
|
+
/**
|
|
29
|
+
* First-party client: skip the consent screen. Consent exists to protect a
|
|
30
|
+
* user from THIRD-party apps requesting their data; a trusted client is the
|
|
31
|
+
* authorization server's own product (same vendor), so an authenticated
|
|
32
|
+
* user is sent straight back with a code — no "App X wants to connect" page.
|
|
33
|
+
*/
|
|
34
|
+
trusted: db.default(z.boolean(), false),
|
|
35
|
+
/**
|
|
36
|
+
* Scrypt hash of the client secret (confidential clients only). Null for
|
|
37
|
+
* public clients. Verified via `OAuthClientService.verifySecret`.
|
|
38
|
+
*/
|
|
39
|
+
clientSecretHash: z.text({ maxLength: 256 }).optional(),
|
|
40
|
+
source: db.default(z.text({ maxLength: 16 }), "dcr"),
|
|
41
|
+
createdByUserId: z.uuid().optional(),
|
|
42
|
+
lastUsedAt: z.datetime().optional(),
|
|
43
|
+
revokedAt: z.datetime().optional(),
|
|
27
44
|
}),
|
|
28
45
|
indexes: [{ columns: ["clientId"], unique: true }],
|
|
29
46
|
});
|
|
@@ -7,6 +7,7 @@ export const buildAuthorizationServerMetadata = (baseUrl: string) => ({
|
|
|
7
7
|
authorization_endpoint: `${baseUrl}/oauth/authorize`,
|
|
8
8
|
token_endpoint: `${baseUrl}/oauth/token`,
|
|
9
9
|
registration_endpoint: `${baseUrl}/oauth/register`,
|
|
10
|
+
jwks_uri: `${baseUrl}/oauth/jwks`,
|
|
10
11
|
response_types_supported: ["code"],
|
|
11
12
|
grant_types_supported: ["authorization_code", "refresh_token"],
|
|
12
13
|
code_challenge_methods_supported: ["S256"],
|