alepha 0.22.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 +242 -230
- 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 -1109
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +454 -369
- 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 +169 -157
- 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 +244 -475
- package/dist/cli/core/index.d.ts.map +1 -1
- package/dist/cli/core/index.js +308 -383
- 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 +20 -39
- package/dist/cli/i18n/index.d.ts.map +1 -1
- package/dist/cli/i18n/index.js +51 -17
- 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 +383 -410
- package/dist/cli/platform-lib/index.d.ts.map +1 -1
- package/dist/cli/platform-lib/index.js +300 -258
- 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 +82 -194
- 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 +36 -90
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +65 -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 -6
- package/dist/react/form/index.d.ts.map +1 -1
- package/dist/react/form/index.js +107 -71
- 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 +47 -5
- package/dist/react/i18n/index.d.ts.map +1 -1
- package/dist/react/i18n/index.js +116 -12
- 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 +188 -29
- package/dist/react/router/index.browser.js.map +1 -1
- package/dist/react/router/index.d.ts +480 -372
- package/dist/react/router/index.d.ts.map +1 -1
- package/dist/react/router/index.js +261 -47
- 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 +91 -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 +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 +215 -187
- package/dist/server/auth/index.d.ts.map +1 -1
- package/dist/server/auth/index.js +1145 -86
- 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 +86 -4
- package/dist/server/cookies/index.d.ts.map +1 -1
- package/dist/server/cookies/index.js +121 -8
- 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 +134 -85
- package/dist/server/core/index.d.ts.map +1 -1
- package/dist/server/core/index.js +130 -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 +36 -36
- 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 -9
- 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 -0
- 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 -10
- 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 -88
- 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 -49
- 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/index.ts +0 -3
- package/src/cli/core/tasks/BuildCloudflareTask.ts +138 -245
- package/src/cli/core/tasks/BuildPrerenderTask.ts +44 -7
- package/src/cli/core/templates/apiHelloResponseSchemaTs.ts +4 -4
- package/src/cli/devtools/atoms/devtoolsOptions.ts +6 -6
- package/src/cli/i18n/__tests__/I18nCheckService.spec.ts +48 -0
- package/src/cli/i18n/atoms/i18nOptions.ts +8 -8
- package/src/cli/i18n/services/I18nCheckService.ts +65 -11
- 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 +141 -50
- 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 +82 -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/providers/McpServerProvider.ts +55 -0
- 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 +71 -0
- package/src/react/form/__tests__/form-submitting-reactive.browser.spec.tsx +96 -0
- 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 +124 -86
- package/src/react/form/services/parseField.ts +66 -27
- package/src/react/i18n/__tests__/I18nProvider.spec.ts +89 -0
- package/src/react/i18n/__tests__/Localize.spec.tsx +1 -1
- package/src/react/i18n/__tests__/locale-routing.spec.ts +107 -0
- package/src/react/i18n/providers/I18nProvider.ts +173 -14
- 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/__tests__/RouterLocaleProvider.spec.ts +127 -0
- 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/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 +2 -2
- package/src/react/router/providers/ReactBrowserProvider.ts +64 -13
- package/src/react/router/providers/ReactBrowserRouterProvider.ts +15 -1
- package/src/react/router/providers/ReactPageProvider.ts +38 -13
- package/src/react/router/providers/ReactServerProvider.ts +105 -16
- 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/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/__tests__/appleClientSecret.spec.ts +34 -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/jtiReplayGuard.ts +41 -0
- package/src/server/auth/helpers/safeRedirectPath.ts +19 -0
- package/src/server/auth/index.ts +1 -0
- 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 +67 -52
- 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 +82 -12
- 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 +32 -4
- 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 +14 -14
- package/src/server/core/primitives/$action.ts +26 -36
- package/src/server/core/primitives/$route.ts +27 -0
- 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/cli/core/tasks/BuildSitemapTask.ts +0 -130
- 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/dist/orm/core/{chunk-B4FMCO8f.js → rolldown-runtime-B4FMCO8f.js} +0 -0
package/dist/core/index.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
-
import {
|
|
3
|
-
import Format from "typebox/format";
|
|
4
|
-
import { Validator } from "typebox/compile";
|
|
2
|
+
import { z as z$1 } from "zod";
|
|
5
3
|
import { Middleware as Middleware$1 } from "alepha";
|
|
6
|
-
import { TLocalizedValidationError } from "typebox/error";
|
|
7
4
|
import { Readable } from "node:stream";
|
|
8
5
|
import { ReadableStream as ReadableStream$1 } from "node:stream/web";
|
|
9
|
-
|
|
10
6
|
//#region ../../src/core/constants/KIND.d.ts
|
|
11
7
|
/**
|
|
12
8
|
* Used for identifying primitives.
|
|
@@ -153,28 +149,6 @@ interface LoggerInterface {
|
|
|
153
149
|
error(message: string, data?: unknown): void;
|
|
154
150
|
}
|
|
155
151
|
//#endregion
|
|
156
|
-
//#region ../../src/core/errors/AlephaError.d.ts
|
|
157
|
-
/**
|
|
158
|
-
* Default error class for Alepha.
|
|
159
|
-
*/
|
|
160
|
-
declare class AlephaError extends Error {
|
|
161
|
-
name: string;
|
|
162
|
-
}
|
|
163
|
-
//#endregion
|
|
164
|
-
//#region ../../src/core/errors/TypeBoxError.d.ts
|
|
165
|
-
declare class TypeBoxError extends AlephaError {
|
|
166
|
-
name: string;
|
|
167
|
-
readonly cause: TLocalizedValidationError;
|
|
168
|
-
readonly value: {
|
|
169
|
-
path: string;
|
|
170
|
-
message: string;
|
|
171
|
-
};
|
|
172
|
-
constructor(error: TLocalizedValidationError);
|
|
173
|
-
}
|
|
174
|
-
interface TypeBoxErrorParams {
|
|
175
|
-
requiredProperties?: string[];
|
|
176
|
-
}
|
|
177
|
-
//#endregion
|
|
178
152
|
//#region ../../src/core/helpers/FileLike.d.ts
|
|
179
153
|
interface FileLike {
|
|
180
154
|
/**
|
|
@@ -232,327 +206,296 @@ interface FileLike {
|
|
|
232
206
|
/**
|
|
233
207
|
* TypeBox view of FileLike.
|
|
234
208
|
*/
|
|
235
|
-
type TFile = TUnsafe
|
|
236
|
-
declare const isTypeFile: (value: TSchema
|
|
209
|
+
type TFile = TUnsafe<FileLike>;
|
|
210
|
+
declare const isTypeFile: (value: TSchema) => value is TFile;
|
|
237
211
|
declare const isFileLike: (value: any) => value is FileLike;
|
|
238
212
|
type StreamLike = ReadableStream | ReadableStream$1 | Readable | NodeJS.ReadableStream;
|
|
239
|
-
type TStream = TUnsafe
|
|
213
|
+
type TStream = TUnsafe<StreamLike>;
|
|
240
214
|
//#endregion
|
|
241
|
-
//#region ../../src/core/providers/
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
isScalar: (schema: TSchema$1) => boolean;
|
|
263
|
-
isFile: (value: TSchema$1) => value is TFile;
|
|
264
|
-
isDateTime: (schema: unknown) => boolean;
|
|
265
|
-
isDate: (schema: unknown) => boolean;
|
|
266
|
-
isTime: (schema: unknown) => boolean;
|
|
267
|
-
isDuration: (schema: unknown) => boolean;
|
|
268
|
-
}
|
|
269
|
-
declare module "typebox" {
|
|
270
|
-
interface TString {
|
|
271
|
-
format?: string;
|
|
272
|
-
minLength?: number;
|
|
273
|
-
maxLength?: number;
|
|
215
|
+
//#region ../../src/core/providers/zodAugment.d.ts
|
|
216
|
+
/**
|
|
217
|
+
* Legacy-compatibility shims so typebox-era structural accessors keep working
|
|
218
|
+
* on zod schemas (the "short path" for the migration — avoids rewriting
|
|
219
|
+
* hundreds of schema-walking call-sites):
|
|
220
|
+
*
|
|
221
|
+
* typebox zod alias added here
|
|
222
|
+
* ---------------- ------------ ----------------
|
|
223
|
+
* obj.properties obj.shape .properties -> .shape
|
|
224
|
+
* array.items array.element .items -> .element
|
|
225
|
+
* union.anyOf union.options .anyOf -> .options
|
|
226
|
+
*
|
|
227
|
+
* Both the runtime (prototype getters) and the type-level (`declare module`
|
|
228
|
+
* interface merge) are provided, so `schema.properties` resolves and typechecks.
|
|
229
|
+
*
|
|
230
|
+
* Imported for side-effects by ZodProvider so it loads with the `z` core.
|
|
231
|
+
*/
|
|
232
|
+
declare module "zod" {
|
|
233
|
+
interface ZodObject {
|
|
234
|
+
/** typebox-compat alias for {@link ZodObject.shape}. */
|
|
235
|
+
readonly properties: this["shape"];
|
|
274
236
|
}
|
|
275
|
-
interface
|
|
276
|
-
|
|
237
|
+
interface ZodArray {
|
|
238
|
+
/** typebox-compat alias for {@link ZodArray.element}. */
|
|
239
|
+
readonly items: this["element"];
|
|
277
240
|
}
|
|
241
|
+
interface ZodUnion {
|
|
242
|
+
/** typebox-compat alias for {@link ZodUnion.options}. */
|
|
243
|
+
readonly anyOf: this["options"];
|
|
244
|
+
}
|
|
245
|
+
interface ZodTuple {
|
|
246
|
+
/** typebox-compat alias for the tuple's element schemas. */
|
|
247
|
+
readonly items: readonly import("zod").ZodType[];
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
//#endregion
|
|
251
|
+
//#region ../../src/core/providers/ZodProvider.d.ts
|
|
252
|
+
/**
|
|
253
|
+
* Alepha's `z` — a thin, enhanceable wrapper over zod 4 that mirrors the
|
|
254
|
+
* ergonomics of the legacy typebox `t` provider (same call-shapes, so existing
|
|
255
|
+
* `t.*` call-sites become a near-mechanical rename), while delegating all
|
|
256
|
+
* validation + static-type inference to zod.
|
|
257
|
+
*
|
|
258
|
+
* Design notes:
|
|
259
|
+
* - No encode/decode. string -> string, number -> number. Validation is a plain
|
|
260
|
+
* `schema.parse(value)` — zod does NOT use `Function`/`eval`, so this is safe
|
|
261
|
+
* inside Cloudflare Workers (unlike typebox's `Compile`).
|
|
262
|
+
* - Metadata (`title`, `description`, `format`, custom `~options`) rides on zod's
|
|
263
|
+
* native `.meta()` registry, so `z.toJSONSchema()` round-trips it for OpenAPI
|
|
264
|
+
* + form generation. Defaults use `.default()`.
|
|
265
|
+
*/
|
|
266
|
+
type ZType = z$1.ZodType;
|
|
267
|
+
type ZObject<T extends z$1.ZodRawShape = any> = z$1.ZodObject<T>;
|
|
268
|
+
/** Replaces typebox `Static<T>`. */
|
|
269
|
+
type Infer<T extends z$1.ZodType> = z$1.infer<T>;
|
|
270
|
+
/**
|
|
271
|
+
* Shallow output-extraction for `T extends SomeSchema ? Static<T> : Fallback`
|
|
272
|
+
* conditional positions.
|
|
273
|
+
*
|
|
274
|
+
* Reads zod's `_zod.output` directly (a single shallow conditional) instead of
|
|
275
|
+
* first testing `T extends TRequestBody` / `TResponseBody` — those tests compare
|
|
276
|
+
* `T` against 5-6 member unions of deeply-recursive zod class types, and that
|
|
277
|
+
* structural assignability check is what trips TypeScript's instantiation-depth
|
|
278
|
+
* limit (TS2589) inside `$action`'s generics. The extracted type is identical to
|
|
279
|
+
* `Static<T>` for any real schema; non-schema `T` (e.g. `undefined`) yields
|
|
280
|
+
* `Fallback`.
|
|
281
|
+
*/
|
|
282
|
+
type SchemaOutput<T, Fallback = any> = [T] extends [{
|
|
283
|
+
_zod: {
|
|
284
|
+
output: infer O;
|
|
285
|
+
};
|
|
286
|
+
}] ? O : Fallback;
|
|
287
|
+
interface SchemaOptions {
|
|
288
|
+
title?: string;
|
|
289
|
+
description?: string;
|
|
290
|
+
default?: unknown;
|
|
291
|
+
format?: string;
|
|
292
|
+
/** Alepha string transforms, kept for JSON-Schema round-trip parity. */
|
|
293
|
+
"~options"?: {
|
|
294
|
+
trim?: boolean;
|
|
295
|
+
lowercase?: boolean;
|
|
296
|
+
};
|
|
297
|
+
[key: string]: unknown;
|
|
278
298
|
}
|
|
299
|
+
interface StringOptions extends SchemaOptions {
|
|
300
|
+
minLength?: number;
|
|
301
|
+
maxLength?: number;
|
|
302
|
+
pattern?: string | RegExp;
|
|
303
|
+
}
|
|
304
|
+
interface NumberOptions extends SchemaOptions {
|
|
305
|
+
minimum?: number;
|
|
306
|
+
maximum?: number;
|
|
307
|
+
}
|
|
308
|
+
interface TextOptions extends StringOptions {
|
|
309
|
+
size?: "short" | "regular" | "long" | "rich";
|
|
310
|
+
trim?: boolean;
|
|
311
|
+
lowercase?: boolean;
|
|
312
|
+
}
|
|
313
|
+
/** Defaults mirroring TypeProvider's static length caps. */
|
|
314
|
+
declare const Z_LIMITS: {
|
|
315
|
+
short: number;
|
|
316
|
+
regular: number;
|
|
317
|
+
long: number;
|
|
318
|
+
rich: number;
|
|
319
|
+
arrayMaxItems: number;
|
|
320
|
+
};
|
|
321
|
+
declare const z: {
|
|
322
|
+
/**
|
|
323
|
+
* Native zod coercion namespace (`z.coerce.number()`, `z.coerce.boolean()`…).
|
|
324
|
+
* Used at the HTTP/string boundary (query, headers, env) where everything
|
|
325
|
+
* arrives as a string; request bodies and the ORM stay strict (no coercion).
|
|
326
|
+
*/
|
|
327
|
+
coerce: typeof z$1.coerce;
|
|
328
|
+
object: typeof z$1.object;
|
|
329
|
+
array: typeof z$1.array;
|
|
330
|
+
record: typeof z$1.record;
|
|
331
|
+
tuple: typeof z$1.tuple;
|
|
332
|
+
union: typeof z$1.union;
|
|
333
|
+
string: typeof z$1.string;
|
|
334
|
+
number: typeof z$1.number;
|
|
335
|
+
boolean: typeof z$1.boolean;
|
|
336
|
+
null: typeof z$1.null;
|
|
337
|
+
any: typeof z$1.any;
|
|
338
|
+
void: typeof z$1.void;
|
|
339
|
+
undefined: typeof z$1.undefined;
|
|
340
|
+
literal: typeof z$1.literal;
|
|
341
|
+
/** Alias for `zod.literal` (legacy `t.const`). */
|
|
342
|
+
const: typeof z$1.literal;
|
|
343
|
+
enum: typeof z$1.enum;
|
|
344
|
+
/** Integer — native `z.int()` (format `safeint`, drives PG INT column). */
|
|
345
|
+
integer: typeof z$1.int;
|
|
346
|
+
/** Free-form JSON object (`Record<string, any>`). */
|
|
347
|
+
json: () => z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
|
|
348
|
+
text: (options?: TextOptions) => z$1.ZodString;
|
|
349
|
+
shortText: (options?: TextOptions) => z$1.ZodString;
|
|
350
|
+
longText: (options?: TextOptions) => z$1.ZodString;
|
|
351
|
+
richText: (options?: TextOptions) => z$1.ZodString;
|
|
352
|
+
email: () => z$1.ZodString;
|
|
353
|
+
uuid: () => z$1.ZodString;
|
|
354
|
+
url: () => z$1.ZodString;
|
|
355
|
+
datetime: () => z$1.ZodString;
|
|
356
|
+
date: () => z$1.ZodString;
|
|
357
|
+
time: () => z$1.ZodString;
|
|
358
|
+
/** bigint as a validated string (no codec). */
|
|
359
|
+
bigint: () => z$1.ZodString;
|
|
360
|
+
binary: () => z$1.ZodString;
|
|
361
|
+
duration: () => z$1.ZodString;
|
|
362
|
+
e164: () => z$1.ZodString;
|
|
363
|
+
bcp47: () => z$1.ZodString;
|
|
364
|
+
constantCase: () => z$1.ZodString;
|
|
365
|
+
int32: () => z$1.ZodInt;
|
|
366
|
+
int64: () => z$1.ZodInt;
|
|
367
|
+
file: (options?: {
|
|
368
|
+
maxSize?: number;
|
|
369
|
+
}) => z$1.ZodAny;
|
|
370
|
+
stream: () => z$1.ZodAny;
|
|
371
|
+
valueLabel: () => z$1.ZodObject<{
|
|
372
|
+
value: z$1.ZodString;
|
|
373
|
+
label: z$1.ZodString;
|
|
374
|
+
description: z$1.ZodOptional<z$1.ZodString>;
|
|
375
|
+
}, z$1.core.$strip>;
|
|
376
|
+
/** Pagination wrapper, mirrors `pageSchema(item)`. */
|
|
377
|
+
page: <T extends z$1.ZodType>(item: T) => z$1.ZodObject<{
|
|
378
|
+
content: z$1.ZodArray<T>;
|
|
379
|
+
page: z$1.ZodObject<{
|
|
380
|
+
number: z$1.ZodInt;
|
|
381
|
+
size: z$1.ZodInt;
|
|
382
|
+
offset: z$1.ZodInt;
|
|
383
|
+
numberOfElements: z$1.ZodInt;
|
|
384
|
+
totalElements: z$1.ZodOptional<z$1.ZodInt>;
|
|
385
|
+
totalPages: z$1.ZodOptional<z$1.ZodInt>;
|
|
386
|
+
isEmpty: z$1.ZodBoolean;
|
|
387
|
+
isFirst: z$1.ZodBoolean;
|
|
388
|
+
isLast: z$1.ZodBoolean;
|
|
389
|
+
}, z$1.core.$strip>;
|
|
390
|
+
}, z$1.core.$strip>;
|
|
391
|
+
/** Export a schema to JSON Schema (OpenAPI / form generation). */
|
|
392
|
+
toJSONSchema: typeof z$1.toJSONSchema;
|
|
393
|
+
/** Runtime type guards (`z.schema.*`) — schema introspection for ORM + forms. */
|
|
394
|
+
schema: {
|
|
395
|
+
isOptional: (s: any) => s is z$1.ZodOptional<z$1.core.$ZodType<unknown, unknown, z$1.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
396
|
+
isDefault: (s: any) => s is z$1.ZodDefault<z$1.core.$ZodType<unknown, unknown, z$1.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
397
|
+
isObject: (s: any) => s is z$1.ZodObject<z$1.core.$ZodLooseShape, z$1.core.$strip>;
|
|
398
|
+
isString: (s: any) => boolean;
|
|
399
|
+
isNumber: (s: any) => boolean;
|
|
400
|
+
isBoolean: (s: any) => s is z$1.ZodBoolean;
|
|
401
|
+
isArray: (s: any) => s is z$1.ZodArray<z$1.core.$ZodType<unknown, unknown, z$1.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
402
|
+
isUnion: (s: any) => s is z$1.ZodUnion<readonly z$1.core.$ZodType<unknown, unknown, z$1.core.$ZodTypeInternals<unknown, unknown>>[]>;
|
|
403
|
+
isNull: (s: any) => s is z$1.ZodNull;
|
|
404
|
+
isRecord: (s: any) => s is z$1.ZodRecord<z$1.core.$ZodRecordKey, z$1.core.$ZodType<unknown, unknown, z$1.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
405
|
+
isEnum: (s: any) => boolean;
|
|
406
|
+
isLiteral: (s: any) => boolean;
|
|
407
|
+
isAny: (s: any) => s is z$1.ZodAny;
|
|
408
|
+
isNullable: (s: any) => s is z$1.ZodNullable<z$1.core.$ZodType<unknown, unknown, z$1.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
409
|
+
isInteger: (s: any) => boolean;
|
|
410
|
+
isText: (s: any) => boolean;
|
|
411
|
+
isDateTime: (s: any) => boolean;
|
|
412
|
+
isDate: (s: any) => boolean;
|
|
413
|
+
isTime: (s: any) => boolean;
|
|
414
|
+
isBigInt: (s: any) => boolean;
|
|
415
|
+
isUuid: (s: any) => boolean;
|
|
416
|
+
isEmail: (s: any) => boolean;
|
|
417
|
+
isUrl: (s: any) => boolean;
|
|
418
|
+
isBinary: (s: any) => boolean;
|
|
419
|
+
isUUID: (s: any) => boolean;
|
|
420
|
+
isScalar: (s: any) => boolean;
|
|
421
|
+
isSchema: (s: any) => s is z$1.ZodType<unknown, unknown, z$1.core.$ZodTypeInternals<unknown, unknown>>;
|
|
422
|
+
isTuple: (s: any) => s is z$1.ZodTuple<readonly z$1.core.$ZodType<unknown, unknown, z$1.core.$ZodTypeInternals<unknown, unknown>>[], z$1.core.$ZodType<unknown, unknown, z$1.core.$ZodTypeInternals<unknown, unknown>> | null>;
|
|
423
|
+
isUndefined: (s: any) => s is z$1.ZodUndefined;
|
|
424
|
+
isUnsafe: (s: any) => s is z$1.ZodAny | z$1.ZodUnknown;
|
|
425
|
+
isVoid: (s: any) => s is z$1.ZodVoid;
|
|
426
|
+
format: (s: any) => string | undefined;
|
|
427
|
+
/** The string values of a `ZodEnum` (typebox-compat for `value.enum`). */
|
|
428
|
+
enumValues: (s: any) => string[];
|
|
429
|
+
/** Peel optional / nullable / default wrappers to the inner schema. */
|
|
430
|
+
unwrap: (s: any) => any;
|
|
431
|
+
/**
|
|
432
|
+
* Read a schema's default value (peeling optional/nullable wrappers), or
|
|
433
|
+
* `undefined` if there is none. In zod, defaults are a `ZodDefault` wrapper
|
|
434
|
+
* (not a `default` data property as in typebox), so `"default" in schema`
|
|
435
|
+
* is NOT a valid test — every schema has a `.default()` method.
|
|
436
|
+
*/
|
|
437
|
+
getDefault: (s: any) => unknown;
|
|
438
|
+
/** typebox-compat: the object's required (non-optional) field names. */
|
|
439
|
+
requiredKeys: (s: any) => string[];
|
|
440
|
+
};
|
|
441
|
+
};
|
|
442
|
+
type Z = typeof z;
|
|
443
|
+
//#endregion
|
|
444
|
+
//#region ../../src/core/providers/TypeProvider.d.ts
|
|
445
|
+
/** Raw zod namespace (legacy `Type` escape hatch). */
|
|
446
|
+
declare const Type: typeof z$1;
|
|
447
|
+
type Static<T extends ZType> = Infer<T>;
|
|
448
|
+
type StaticDecode<T extends ZType> = Infer<T>;
|
|
449
|
+
type StaticEncode<T extends ZType> = Infer<T>;
|
|
450
|
+
type TSchema = ZType;
|
|
451
|
+
type TObject<T extends z$1.ZodRawShape = any> = ZObject<T>;
|
|
452
|
+
type TProperties = z$1.ZodRawShape;
|
|
453
|
+
type TString = z$1.ZodString;
|
|
454
|
+
type TNumber = z$1.ZodNumber;
|
|
455
|
+
type TInteger = z$1.ZodNumber;
|
|
456
|
+
type TBoolean = z$1.ZodBoolean;
|
|
457
|
+
type TArray<T extends ZType = ZType> = z$1.ZodArray<T>;
|
|
458
|
+
type TUnion<_T extends ZType[] = ZType[]> = z$1.ZodUnion;
|
|
459
|
+
type TRecord = z$1.ZodRecord<any, any>;
|
|
460
|
+
type TTuple = ZType;
|
|
461
|
+
type TNull = z$1.ZodNull;
|
|
462
|
+
type TAny = z$1.ZodAny;
|
|
463
|
+
type TVoid = z$1.ZodVoid;
|
|
464
|
+
type TBigInt = z$1.ZodString;
|
|
465
|
+
type TUnsafe<_T = unknown> = ZType;
|
|
466
|
+
type TOptional<T extends ZType = ZType> = z$1.ZodOptional<T>;
|
|
467
|
+
type TOptionalAdd<T extends ZType = ZType> = z$1.ZodOptional<T>;
|
|
468
|
+
type TPick<T extends ZObject = ZObject, _K = unknown> = T;
|
|
469
|
+
type TOmit<T extends ZObject = ZObject, _K = unknown> = T;
|
|
470
|
+
type TPartial<_T extends ZObject = ZObject> = ZObject;
|
|
471
|
+
type TInterface<_T = unknown, _U = unknown> = ZObject;
|
|
472
|
+
type TKeysToIndexer<_T = unknown> = any;
|
|
473
|
+
type TSchemaOptions = SchemaOptions;
|
|
474
|
+
type TStringOptions = StringOptions;
|
|
475
|
+
type TNumberOptions = NumberOptions;
|
|
476
|
+
type TObjectOptions = SchemaOptions;
|
|
477
|
+
type TArrayOptions = SchemaOptions;
|
|
478
|
+
type TextLength = "short" | "regular" | "long" | "rich";
|
|
479
|
+
type TTextOptions = TextOptions;
|
|
480
|
+
interface TEnumOptions extends TextOptions {
|
|
481
|
+
/** `"text"` = TEXT column; omitted = a real PostgreSQL ENUM type. */
|
|
482
|
+
mode?: "text";
|
|
483
|
+
/** Custom PG ENUM type name (shared across tables). */
|
|
484
|
+
name?: string;
|
|
485
|
+
}
|
|
486
|
+
/** Legacy `TypeProvider` — kept for its static config knobs. */
|
|
279
487
|
declare class TypeProvider {
|
|
280
|
-
static format: typeof Format;
|
|
281
|
-
static translateError(error: TypeBoxError, _locale?: string): string;
|
|
282
|
-
static setLocale(_locale: string): void;
|
|
283
|
-
static isValidBigInt(value: string | number): boolean;
|
|
284
|
-
/**
|
|
285
|
-
* Default maximum length for strings.
|
|
286
|
-
*
|
|
287
|
-
* It can be set to a larger value:
|
|
288
|
-
* ```ts
|
|
289
|
-
* TypeProvider.DEFAULT_STRING_MAX_LENGTH = 1000000;
|
|
290
|
-
* TypeProvider.DEFAULT_STRING_MAX_LENGTH = undefined; // no limit (not recommended)
|
|
291
|
-
* ```
|
|
292
|
-
*/
|
|
293
488
|
static DEFAULT_STRING_MAX_LENGTH: number | undefined;
|
|
294
|
-
/**
|
|
295
|
-
* Maximum length for short strings, such as names or titles.
|
|
296
|
-
*/
|
|
297
489
|
static DEFAULT_SHORT_STRING_MAX_LENGTH: number | undefined;
|
|
298
|
-
/**
|
|
299
|
-
* Maximum length for long strings, such as descriptions or comments.
|
|
300
|
-
* It can be overridden in the string options.
|
|
301
|
-
*
|
|
302
|
-
* It can be set to a larger value:
|
|
303
|
-
* ```ts
|
|
304
|
-
* TypeProvider.DEFAULT_LONG_STRING_MAX_LENGTH = 2048;
|
|
305
|
-
* ```
|
|
306
|
-
*/
|
|
307
490
|
static DEFAULT_LONG_STRING_MAX_LENGTH: number | undefined;
|
|
308
|
-
/**
|
|
309
|
-
* Maximum length for rich strings, such as HTML or Markdown.
|
|
310
|
-
* This is a large value to accommodate rich text content.
|
|
311
|
-
* > It's also the maximum length of PG's TEXT type.
|
|
312
|
-
*
|
|
313
|
-
* It can be overridden in the string options.
|
|
314
|
-
*
|
|
315
|
-
* It can be set to a larger value:
|
|
316
|
-
* ```ts
|
|
317
|
-
* TypeProvider.DEFAULT_RICH_STRING_MAX_LENGTH = 1000000;
|
|
318
|
-
* ```
|
|
319
|
-
*/
|
|
320
491
|
static DEFAULT_RICH_STRING_MAX_LENGTH: number | undefined;
|
|
321
|
-
/**
|
|
322
|
-
* Maximum number of items in an array.
|
|
323
|
-
* This is a default value to prevent excessive memory usage.
|
|
324
|
-
* It can be overridden in the array options.
|
|
325
|
-
*/
|
|
326
492
|
static DEFAULT_ARRAY_MAX_ITEMS: number;
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
union: typeof Type.Union;
|
|
333
|
-
tuple: typeof Type.Tuple;
|
|
334
|
-
null: typeof Type.Null;
|
|
335
|
-
const: typeof Type.Literal;
|
|
336
|
-
options: typeof Type.Options;
|
|
337
|
-
/**
|
|
338
|
-
* Type guards to check the type of schema.
|
|
339
|
-
* This is not a runtime type check, but a compile-time type guard.
|
|
340
|
-
*
|
|
341
|
-
* @example
|
|
342
|
-
* ```ts
|
|
343
|
-
* if (t.schema.isString(schema)) {
|
|
344
|
-
* // schema is TString
|
|
345
|
-
* }
|
|
346
|
-
* ```
|
|
347
|
-
*/
|
|
348
|
-
readonly schema: TypeGuard;
|
|
349
|
-
extend<T extends TSchema$1[], U extends TProperties$1>(schema: [...T], properties: U, options?: TSchemaOptions): TInterface<T, U>;
|
|
350
|
-
extend<T extends TObject$1, U extends TProperties$1>(schema: T, properties: U, options?: TSchemaOptions): TInterface<[T], U>;
|
|
351
|
-
pick<T extends TObject$1, Indexer extends PropertyKey[]>(schema: T, keys: [...Indexer], options?: TObjectOptions$1): TPick$1<T, TKeysToIndexer$1<Indexer>>;
|
|
352
|
-
omit<T extends TObject$1, Indexer extends PropertyKey[]>(schema: T, keys: [...Indexer], options?: TObjectOptions$1): TOmit<T, TKeysToIndexer$1<Indexer>>;
|
|
353
|
-
partial<T extends TSchema$1>(schema: T, options?: TSchemaOptions): TPartial<T>;
|
|
354
|
-
/**
|
|
355
|
-
* Create a schema for an object.
|
|
356
|
-
* By default, additional properties are not allowed.
|
|
357
|
-
*
|
|
358
|
-
* @example
|
|
359
|
-
* ```ts
|
|
360
|
-
* const userSchema = t.object({
|
|
361
|
-
* id: t.integer(),
|
|
362
|
-
* name: t.string(),
|
|
363
|
-
* });
|
|
364
|
-
* ```
|
|
365
|
-
*/
|
|
366
|
-
object<T extends TProperties$1>(properties: T, options?: TObjectOptions$1): TObject$1<T>;
|
|
367
|
-
/**
|
|
368
|
-
* Create a schema for an array.
|
|
369
|
-
* By default, the maximum number of items is limited to prevent excessive memory usage.
|
|
370
|
-
*
|
|
371
|
-
* @see TypeProvider.DEFAULT_ARRAY_MAX_ITEMS
|
|
372
|
-
*/
|
|
373
|
-
array<T extends TSchema$1>(schema: T, options?: TArrayOptions): TArray$1<T>;
|
|
374
|
-
/**
|
|
375
|
-
* Create a schema for a string.
|
|
376
|
-
* For db or input fields, consider using `t.text()` instead, which has length limits.
|
|
377
|
-
*
|
|
378
|
-
* If you need a string with specific format (e.g. email, uuid), consider using the corresponding method (e.g. `t.email()`, `t.uuid()`).
|
|
379
|
-
*/
|
|
380
|
-
string(options?: TStringOptions$1): TString$1;
|
|
381
|
-
/**
|
|
382
|
-
* Create a schema for a string with length limits.
|
|
383
|
-
* For internal strings without length limits, consider using `t.string()` instead.
|
|
384
|
-
*
|
|
385
|
-
* Default size is "regular", which has a max length of 255 characters.
|
|
386
|
-
*/
|
|
387
|
-
text(options?: TTextOptions): TString$1;
|
|
388
|
-
/**
|
|
389
|
-
* Create a schema for a JSON object.
|
|
390
|
-
* This is a record with string keys and any values.
|
|
391
|
-
*/
|
|
392
|
-
json<T = any>(options?: TSchemaOptions): TRecord$1<string, TAny$1>;
|
|
393
|
-
/**
|
|
394
|
-
* Create a schema for a boolean.
|
|
395
|
-
*/
|
|
396
|
-
boolean(options?: TSchemaOptions): TBoolean$1;
|
|
397
|
-
/**
|
|
398
|
-
* Create a schema for a number.
|
|
399
|
-
*/
|
|
400
|
-
number(options?: TNumberOptions$1): TNumber$1;
|
|
401
|
-
/**
|
|
402
|
-
* Create a schema for an integer.
|
|
403
|
-
*/
|
|
404
|
-
integer(options?: TNumberOptions$1): TInteger$1;
|
|
405
|
-
int32(options?: TNumberOptions$1): TInteger$1;
|
|
406
|
-
/**
|
|
407
|
-
* Mimic a signed 64-bit integer.
|
|
408
|
-
*
|
|
409
|
-
* This is NOT a true int64, as JavaScript cannot represent all int64 values.
|
|
410
|
-
* It is a number that is an integer and between -9007199254740991 and 9007199254740991.
|
|
411
|
-
* Use `t.bigint()` for true int64 values represented as strings.
|
|
412
|
-
*/
|
|
413
|
-
int64(options?: TNumberOptions$1): TNumber$1;
|
|
414
|
-
/**
|
|
415
|
-
* Make a schema optional.
|
|
416
|
-
*/
|
|
417
|
-
optional<T extends TSchema$1>(schema: T): TOptionalAdd$1<T>;
|
|
418
|
-
/**
|
|
419
|
-
* Make a schema nullable.
|
|
420
|
-
*/
|
|
421
|
-
nullable<T extends TSchema$1>(schema: T, options?: TObjectOptions$1): TUnion$1<[TNull$1, T]>;
|
|
422
|
-
/**
|
|
423
|
-
* Create a schema that maps all properties of an object schema to nullable.
|
|
424
|
-
*/
|
|
425
|
-
nullify: (schema: TSchema$1, options?: TObjectOptions$1) => TSchema$1;
|
|
426
|
-
/**
|
|
427
|
-
* Create a schema for a string enum.
|
|
428
|
-
*
|
|
429
|
-
* By default, this creates a real PostgreSQL ENUM type in the database.
|
|
430
|
-
* Use `{ mode: "text" }` to store as a TEXT column instead.
|
|
431
|
-
*
|
|
432
|
-
* @example
|
|
433
|
-
* ```ts
|
|
434
|
-
* // PostgreSQL ENUM type (default)
|
|
435
|
-
* status: t.enum(["pending", "active", "archived"])
|
|
436
|
-
*
|
|
437
|
-
* // TEXT column
|
|
438
|
-
* status: t.enum(["pending", "active", "archived"], { mode: "text" })
|
|
439
|
-
*
|
|
440
|
-
* // Shared enum name across tables
|
|
441
|
-
* status: t.enum(["enabled", "disabled"], { name: "shared_status_enum" })
|
|
442
|
-
* ```
|
|
443
|
-
*/
|
|
444
|
-
enum<T extends string[]>(values: [...T], options?: TEnumOptions): TUnsafe$1<T[number]>;
|
|
445
|
-
/**
|
|
446
|
-
* Create a schema for a bigint represented as a string.
|
|
447
|
-
* This is a string that validates bigint format (e.g. "123456789").
|
|
448
|
-
*/
|
|
449
|
-
bigint(options?: TStringOptions$1): TString$1;
|
|
450
|
-
/**
|
|
451
|
-
* Create a schema for a URL represented as a string.
|
|
452
|
-
*/
|
|
453
|
-
url(options?: TStringOptions$1): TString$1;
|
|
454
|
-
/**
|
|
455
|
-
* Create a schema for binary data represented as a base64 string.
|
|
456
|
-
*/
|
|
457
|
-
binary(options?: TStringOptions$1): TString$1;
|
|
458
|
-
/**
|
|
459
|
-
* Create a schema for uuid.
|
|
460
|
-
*/
|
|
461
|
-
uuid(options?: TStringOptions$1): TString$1;
|
|
462
|
-
/**
|
|
463
|
-
* Create a schema for a file-like object.
|
|
464
|
-
*
|
|
465
|
-
* File like mimics the File API in browsers, but is adapted to work in Node.js as well.
|
|
466
|
-
*
|
|
467
|
-
* Implementation of file-like objects is handled by "alepha/file" package.
|
|
468
|
-
*/
|
|
469
|
-
file(options?: {
|
|
470
|
-
maxSize?: number;
|
|
471
|
-
}): TFile;
|
|
472
|
-
/**
|
|
473
|
-
* @experimental
|
|
474
|
-
*/
|
|
475
|
-
stream(): TStream;
|
|
476
|
-
email(options?: TStringOptions$1): TString$1;
|
|
477
|
-
e164(options?: TStringOptions$1): TString$1;
|
|
478
|
-
bcp47(options?: TStringOptions$1): TString$1;
|
|
479
|
-
/**
|
|
480
|
-
* Create a schema for short text, such as names or titles.
|
|
481
|
-
* Default max length is 64 characters.
|
|
482
|
-
*/
|
|
483
|
-
shortText(options?: TStringOptions$1): TString$1;
|
|
484
|
-
/**
|
|
485
|
-
* Create a schema for long text, such as descriptions or comments.
|
|
486
|
-
* Default max length is 1024 characters.
|
|
487
|
-
*/
|
|
488
|
-
longText(options?: TStringOptions$1): TString$1;
|
|
489
|
-
/**
|
|
490
|
-
* Create a schema for rich text, such as HTML or Markdown.
|
|
491
|
-
* Default max length is 65535 characters.
|
|
492
|
-
*/
|
|
493
|
-
richText(options?: TStringOptions$1): TString$1;
|
|
494
|
-
/**
|
|
495
|
-
* Create a schema for a constant case string e.g. LIKE_THIS.
|
|
496
|
-
*/
|
|
497
|
-
constantCase: (options?: TStringOptions$1) => TString$1;
|
|
498
|
-
/**
|
|
499
|
-
* Create a schema for an object with a value and label.
|
|
500
|
-
*/
|
|
501
|
-
valueLabel: (options?: TObjectOptions$1) => TObject$1<{
|
|
502
|
-
value: TString$1;
|
|
503
|
-
label: TString$1;
|
|
504
|
-
description: Type.TOptional<TString$1>;
|
|
505
|
-
}>;
|
|
506
|
-
datetime: (options?: TStringOptions$1) => TString$1;
|
|
507
|
-
date: (options?: TStringOptions$1) => TString$1;
|
|
508
|
-
time: (options?: TStringOptions$1) => TString$1;
|
|
509
|
-
duration: (options?: TStringOptions$1) => TString$1;
|
|
510
|
-
}
|
|
511
|
-
type TextLength = "short" | "regular" | "long" | "rich";
|
|
512
|
-
interface TEnumOptions extends TTextOptions {
|
|
513
|
-
/**
|
|
514
|
-
* Storage mode for the enum.
|
|
515
|
-
*
|
|
516
|
-
* - `"text"` — stores as a TEXT column in the database.
|
|
517
|
-
* - When omitted, creates a real PostgreSQL ENUM type.
|
|
518
|
-
*/
|
|
519
|
-
mode?: "text";
|
|
520
|
-
/**
|
|
521
|
-
* Custom name for the PostgreSQL ENUM type.
|
|
522
|
-
*
|
|
523
|
-
* Use this to share the same enum type across multiple tables.
|
|
524
|
-
* If not specified, the name is auto-generated from the table and column names.
|
|
525
|
-
*/
|
|
526
|
-
name?: string;
|
|
527
|
-
}
|
|
528
|
-
interface TTextOptions extends TStringOptions$1 {
|
|
529
|
-
/**
|
|
530
|
-
* Predefined size of the text.
|
|
531
|
-
*
|
|
532
|
-
* - `short` - short text, such as names or titles. Default max length is 64 characters.
|
|
533
|
-
* - `regular` - regular text, such as single-line input. Default max length is 255 characters.
|
|
534
|
-
* - `long` - long text, such as descriptions or comments. Default max length is 1024 characters.
|
|
535
|
-
* - `rich` - rich text, such as HTML or Markdown. Default max length is 65535 characters.
|
|
536
|
-
*
|
|
537
|
-
* You can override the default max length by specifying `maxLength` in the options.
|
|
538
|
-
*
|
|
539
|
-
* @default "regular"
|
|
540
|
-
*/
|
|
541
|
-
size?: TextLength;
|
|
542
|
-
/**
|
|
543
|
-
* Trim whitespace from both ends of the string.
|
|
544
|
-
*
|
|
545
|
-
* @default true
|
|
546
|
-
*/
|
|
547
|
-
trim?: boolean;
|
|
548
|
-
/**
|
|
549
|
-
* Convert the string to lowercase.
|
|
550
|
-
*
|
|
551
|
-
* @default false
|
|
552
|
-
*/
|
|
553
|
-
lowercase?: boolean;
|
|
493
|
+
static translateError: (error: {
|
|
494
|
+
message?: string;
|
|
495
|
+
}, _locale?: string) => string;
|
|
496
|
+
static setLocale: (_locale: string) => void;
|
|
497
|
+
static isValidBigInt: (value: string | number) => boolean;
|
|
554
498
|
}
|
|
555
|
-
declare const t: TypeProvider;
|
|
556
499
|
//#endregion
|
|
557
500
|
//#region ../../src/core/primitives/$atom.d.ts
|
|
558
501
|
/**
|
|
@@ -566,16 +509,16 @@ declare const t: TypeProvider;
|
|
|
566
509
|
* You control how state is structured and validated.
|
|
567
510
|
*
|
|
568
511
|
* Features:
|
|
569
|
-
* -
|
|
570
|
-
* -
|
|
571
|
-
* -
|
|
572
|
-
* - Automatic getter access in services with {@link $use}
|
|
512
|
+
* - Schema validation on every write (invalid writes throw)
|
|
513
|
+
* - Default value for initial state
|
|
514
|
+
* - Automatic getter access in services with {@link $state}
|
|
573
515
|
* - SSR support (server state automatically serialized and hydrated on client)
|
|
574
|
-
* - React integration (
|
|
575
|
-
* -
|
|
576
|
-
* - Persistence adapters (
|
|
577
|
-
* -
|
|
578
|
-
* -
|
|
516
|
+
* - React integration (useStore / useSelector hooks for automatic re-renders)
|
|
517
|
+
* - Derived values with {@link $computed} (useComputed hook)
|
|
518
|
+
* - Persistence adapters: cookie (SSR-safe), localStorage, sessionStorage
|
|
519
|
+
* - `serverOnly` flag to keep an atom out of the hydration payload
|
|
520
|
+
* - reset / watch helpers on the state manager
|
|
521
|
+
* - Documentation generation & devtools integration (mutation log)
|
|
579
522
|
*
|
|
580
523
|
* Common use cases:
|
|
581
524
|
* - user preferences
|
|
@@ -588,27 +531,166 @@ declare const t: TypeProvider;
|
|
|
588
531
|
* If you need to store complex data, consider using identifiers or references instead.
|
|
589
532
|
*/
|
|
590
533
|
declare const $atom: {
|
|
591
|
-
<T extends
|
|
534
|
+
<T extends ZType, N extends string>(options: AtomOptions<T, N>): Atom<T, N>;
|
|
592
535
|
[KIND]: string;
|
|
593
536
|
};
|
|
594
|
-
|
|
537
|
+
/**
|
|
538
|
+
* Persistence adapter for an atom.
|
|
539
|
+
*/
|
|
540
|
+
type AtomPersist = "cookie" | "localStorage" | "sessionStorage";
|
|
541
|
+
type AtomOptions<T extends ZType, N extends string> = {
|
|
595
542
|
name: N;
|
|
596
543
|
schema: T;
|
|
597
544
|
description?: string;
|
|
598
|
-
|
|
545
|
+
/**
|
|
546
|
+
* Persist this atom outside the in-memory store.
|
|
547
|
+
*
|
|
548
|
+
* - `"cookie"` — synced to an HTTP cookie by the `alepha/server/cookies`
|
|
549
|
+
* module. Works on the server AND in the browser, so it is the only
|
|
550
|
+
* correct adapter for SSR apps: the server reads it while rendering and
|
|
551
|
+
* the first paint matches the persisted state.
|
|
552
|
+
* - `"localStorage"` / `"sessionStorage"` — browser Web Storage. Fine for
|
|
553
|
+
* pure SPA apps. The server cannot see these values; registering such
|
|
554
|
+
* an atom during SSR logs a warning.
|
|
555
|
+
*
|
|
556
|
+
* Values are validated against the schema when read back; invalid or
|
|
557
|
+
* corrupted entries are discarded and the default is used.
|
|
558
|
+
*
|
|
559
|
+
* **Security: cookie-persisted atoms are attacker-controlled.** The
|
|
560
|
+
* cookie written by `persist: "cookie"` is unsigned, unencrypted, and
|
|
561
|
+
* freely writable by any client-side script (`AtomCookiePersistence`'s
|
|
562
|
+
* `cookieOptions()` sets no `sign`, `encrypt`, or `httpOnly`) — a request
|
|
563
|
+
* can present any value it wants for it. Never persist trust-bearing
|
|
564
|
+
* state — user ids, roles, entitlements, permissions — in a
|
|
565
|
+
* `persist: "cookie"` atom. If you need a signed, encrypted, and/or
|
|
566
|
+
* `httpOnly` cookie, declare an explicit
|
|
567
|
+
* `$cookie({ key: atom.key, sign: true, encrypt: true, httpOnly: true, ... })`
|
|
568
|
+
* binding instead — that is the escape hatch for trust-bearing values.
|
|
569
|
+
*/
|
|
570
|
+
persist?: AtomPersist;
|
|
571
|
+
/**
|
|
572
|
+
* Exclude this atom from the SSR hydration export
|
|
573
|
+
* (`StateManager.exportAtoms()`).
|
|
574
|
+
*
|
|
575
|
+
* This is the ONLY guarantee `serverOnly` makes: the value is never
|
|
576
|
+
* written into the `<script id="__ssr">` JSON block serialized into the
|
|
577
|
+
* HTML payload. It says nothing about any other channel a value can
|
|
578
|
+
* reach the browser through.
|
|
579
|
+
*
|
|
580
|
+
* **Cannot be combined with `persist`.** Every persistence adapter
|
|
581
|
+
* (`"cookie"`, `"localStorage"`, `"sessionStorage"`) targets the browser
|
|
582
|
+
* by definition — cookie persistence ships the value in a `Set-Cookie`
|
|
583
|
+
* response header, and web-storage persistence IS the browser. Declaring
|
|
584
|
+
* `serverOnly: true` together with any `persist` value throws
|
|
585
|
+
* `AlephaError` at `$atom()` call time, because the persistence channel
|
|
586
|
+
* would leak the exact value `serverOnly` is meant to keep server-side.
|
|
587
|
+
*
|
|
588
|
+
* Use `serverOnly` for atoms that may hold secrets or internal
|
|
589
|
+
* request-scoped state that must never leave the server, and never pair
|
|
590
|
+
* it with `persist`.
|
|
591
|
+
*
|
|
592
|
+
* **Never make a `serverOnly` atom a dependency of a `$computed` that the
|
|
593
|
+
* browser reads through `useComputed`.** A computed is re-derived, never
|
|
594
|
+
* serialized: the server derives it from the atom's real value, and the
|
|
595
|
+
* browser — which never received that value — re-derives it from the
|
|
596
|
+
* atom's default. The two disagree, producing a React hydration mismatch
|
|
597
|
+
* and a silently wrong value from then on. Keep such a computed
|
|
598
|
+
* server-side (`alepha.store.get`), or derive it from atoms that ship.
|
|
599
|
+
*/
|
|
600
|
+
serverOnly?: boolean;
|
|
601
|
+
} & (T extends z$1.ZodOptional<any> ? {
|
|
599
602
|
default?: Static<T>;
|
|
600
603
|
} : {
|
|
601
604
|
default: Static<T>;
|
|
602
605
|
});
|
|
603
|
-
declare class Atom<T extends
|
|
606
|
+
declare class Atom<T extends ZType = TObject, N extends string = string> {
|
|
604
607
|
readonly options: AtomOptions<T, N>;
|
|
605
608
|
get schema(): T;
|
|
606
609
|
get key(): N;
|
|
607
610
|
constructor(options: AtomOptions<T, N>);
|
|
608
611
|
}
|
|
609
|
-
type
|
|
610
|
-
type
|
|
611
|
-
|
|
612
|
+
type TAtomObject = ZType;
|
|
613
|
+
type AtomStatic<T extends ZType> = T extends z$1.ZodOptional<any> ? Static<T> | undefined : Static<T>;
|
|
614
|
+
//#endregion
|
|
615
|
+
//#region ../../src/core/primitives/$computed.d.ts
|
|
616
|
+
/**
|
|
617
|
+
* Define a derived, read-only value computed from one or more atoms
|
|
618
|
+
* (or other computed values).
|
|
619
|
+
*
|
|
620
|
+
* Dependencies are declared statically, which keeps the data flow explicit
|
|
621
|
+
* and lets subscribers know exactly which mutations invalidate the value.
|
|
622
|
+
*
|
|
623
|
+
* Computed values are never stored, serialized, hydrated, or persisted —
|
|
624
|
+
* they are recomputed from their dependencies on every read, so they are
|
|
625
|
+
* always correct inside request-scoped (fork) state on the server.
|
|
626
|
+
*
|
|
627
|
+
* ```ts
|
|
628
|
+
* const cartTotal = $computed({
|
|
629
|
+
* name: "cartTotal",
|
|
630
|
+
* deps: [cartAtom],
|
|
631
|
+
* get: (cart) => cart.items.reduce((sum, it) => sum + it.price, 0),
|
|
632
|
+
* });
|
|
633
|
+
*
|
|
634
|
+
* alepha.store.get(cartTotal); // number
|
|
635
|
+
* ```
|
|
636
|
+
*
|
|
637
|
+
* ### Footgun: a `serverOnly` dependency breaks hydration
|
|
638
|
+
*
|
|
639
|
+
* A computed whose deps include a `serverOnly` atom will NOT agree across the
|
|
640
|
+
* SSR boundary. `serverOnly` keeps the atom out of the hydration payload, so
|
|
641
|
+
* the server derives the value from the atom's real value while the browser
|
|
642
|
+
* re-derives it from the atom's *default* — React then hydrates a DOM that
|
|
643
|
+
* does not match the markup it received (a hydration mismatch, and a
|
|
644
|
+
* silently wrong value afterwards).
|
|
645
|
+
*
|
|
646
|
+
* Either keep the computed server-side only (read it via `alepha.store.get`,
|
|
647
|
+
* never through `useComputed`), or derive it from atoms that ship to the
|
|
648
|
+
* browser. Note this cuts the other way too: if the value is safe to send to
|
|
649
|
+
* the browser, the dependency should not have been `serverOnly` to begin
|
|
650
|
+
* with.
|
|
651
|
+
*/
|
|
652
|
+
declare const $computed: {
|
|
653
|
+
<const D extends ReadonlyArray<AnyDep>, R, N extends string = string>(options: ComputedOptions<D, R, N>): Computed<R, N>;
|
|
654
|
+
[KIND]: string;
|
|
655
|
+
};
|
|
656
|
+
type AnyDep = Atom<any, any> | Computed<any, any>;
|
|
657
|
+
type DepValues<D extends ReadonlyArray<AnyDep>> = { [K in keyof D]: D[K] extends Atom<infer T, any> ? AtomStatic<T> : D[K] extends Computed<infer R2, any> ? R2 : never; };
|
|
658
|
+
interface ComputedOptions<D extends ReadonlyArray<AnyDep>, R, N extends string = string> {
|
|
659
|
+
name: N;
|
|
660
|
+
deps: D;
|
|
661
|
+
get: (...values: DepValues<D>) => R;
|
|
662
|
+
description?: string;
|
|
663
|
+
}
|
|
664
|
+
declare class Computed<R = unknown, N extends string = string> {
|
|
665
|
+
readonly options: ComputedOptions<any, R, N>;
|
|
666
|
+
constructor(options: ComputedOptions<any, R, N>);
|
|
667
|
+
get key(): N;
|
|
668
|
+
/**
|
|
669
|
+
* Reentrancy guard for {@link keys}. Deps are declared as a `readonly`
|
|
670
|
+
* array at construction time, so a cycle can't be built through the
|
|
671
|
+
* public API — but the array itself isn't frozen, so nothing stops a
|
|
672
|
+
* caller from reaching in and creating one anyway. Without this guard,
|
|
673
|
+
* a cycle would recurse until the JS engine throws a native
|
|
674
|
+
* `RangeError`, which violates the repo's "never throw a bare `Error`"
|
|
675
|
+
* convention.
|
|
676
|
+
*/
|
|
677
|
+
protected resolvingKeys: boolean;
|
|
678
|
+
/**
|
|
679
|
+
* Reentrancy guard for {@link compute}, same rationale as
|
|
680
|
+
* {@link resolvingKeys}.
|
|
681
|
+
*/
|
|
682
|
+
protected computing: boolean;
|
|
683
|
+
/**
|
|
684
|
+
* Transitive atom keys this computed value depends on. Subscribers
|
|
685
|
+
* (useComputed, StateManager.watch) use this to know which `state:mutate`
|
|
686
|
+
* events invalidate the value.
|
|
687
|
+
*/
|
|
688
|
+
keys(): string[];
|
|
689
|
+
/**
|
|
690
|
+
* Resolve the value using the given dependency resolver.
|
|
691
|
+
*/
|
|
692
|
+
compute(resolve: (dep: AnyDep) => unknown): R;
|
|
693
|
+
}
|
|
612
694
|
//#endregion
|
|
613
695
|
//#region ../../src/core/primitives/$inject.d.ts
|
|
614
696
|
/**
|
|
@@ -803,6 +885,17 @@ declare class AlsProvider {
|
|
|
803
885
|
run<R>(callback: () => R, data?: Record<string, any>): R;
|
|
804
886
|
exists(): boolean;
|
|
805
887
|
get<T>(key: string, scope?: StateScope): T | undefined;
|
|
888
|
+
/**
|
|
889
|
+
* Return the raw ALS layer object that owns `key`, walking from the
|
|
890
|
+
* current layer up through parent forks — the same resolution order as
|
|
891
|
+
* the default-scope branch of {@link get}. Returns `undefined` when no
|
|
892
|
+
* active ALS layer (current or any ancestor) has the key.
|
|
893
|
+
*
|
|
894
|
+
* Used by `StateManager.register()` to decode a value in place, in
|
|
895
|
+
* whichever fork layer it physically lives, instead of flattening
|
|
896
|
+
* fork-scoped state into the app-level store.
|
|
897
|
+
*/
|
|
898
|
+
getLayer(key: string): AsyncLocalStorageData | undefined;
|
|
806
899
|
has(key: string): boolean;
|
|
807
900
|
set<T>(key: string, value: T): void;
|
|
808
901
|
}
|
|
@@ -842,9 +935,9 @@ declare class JsonSchemaCodec extends SchemaCodec {
|
|
|
842
935
|
protected readonly json: Json;
|
|
843
936
|
protected readonly encoder: TextEncoder;
|
|
844
937
|
protected readonly decoder: TextDecoder;
|
|
845
|
-
encodeToString<T extends TSchema
|
|
846
|
-
encodeToBinary<T extends TSchema
|
|
847
|
-
decode<T>(schema: TSchema
|
|
938
|
+
encodeToString<T extends TSchema>(schema: T, value: Static<T>): string;
|
|
939
|
+
encodeToBinary<T extends TSchema>(schema: T, value: Static<T>): Uint8Array;
|
|
940
|
+
decode<T>(schema: TSchema, value: unknown): T;
|
|
848
941
|
}
|
|
849
942
|
//#endregion
|
|
850
943
|
//#region ../../src/core/providers/KeylessJsonSchemaCodec.d.ts
|
|
@@ -868,7 +961,7 @@ interface KeylessCodecOptions {
|
|
|
868
961
|
* to be a simple JSON array instead of an object with keys.
|
|
869
962
|
*/
|
|
870
963
|
declare class KeylessJsonSchemaCodec extends SchemaCodec {
|
|
871
|
-
protected readonly cache: Map<
|
|
964
|
+
protected readonly cache: Map<import("alepha").ZType, KeylessCodec<any>>;
|
|
872
965
|
protected readonly textEncoder: TextEncoder;
|
|
873
966
|
protected readonly textDecoder: TextDecoder;
|
|
874
967
|
protected varCounter: number;
|
|
@@ -885,15 +978,15 @@ declare class KeylessJsonSchemaCodec extends SchemaCodec {
|
|
|
885
978
|
/**
|
|
886
979
|
* Encode value to a keyless JSON string.
|
|
887
980
|
*/
|
|
888
|
-
encodeToString<T extends TSchema
|
|
981
|
+
encodeToString<T extends TSchema>(schema: T, value: Static<T>): string;
|
|
889
982
|
/**
|
|
890
983
|
* Encode value to binary (UTF-8 encoded keyless JSON).
|
|
891
984
|
*/
|
|
892
|
-
encodeToBinary<T extends TSchema
|
|
985
|
+
encodeToBinary<T extends TSchema>(schema: T, value: Static<T>): Uint8Array;
|
|
893
986
|
/**
|
|
894
987
|
* Decode keyless JSON string or binary to value.
|
|
895
988
|
*/
|
|
896
|
-
decode<T>(schema: TSchema
|
|
989
|
+
decode<T>(schema: TSchema, value: unknown): T;
|
|
897
990
|
/**
|
|
898
991
|
* Test if `new Function()` is available (not blocked by CSP).
|
|
899
992
|
*/
|
|
@@ -902,80 +995,70 @@ declare class KeylessJsonSchemaCodec extends SchemaCodec {
|
|
|
902
995
|
* Get a compiled codec for the given schema.
|
|
903
996
|
* Codecs are cached for reuse.
|
|
904
997
|
*/
|
|
905
|
-
protected getCodec<T>(schema: TSchema
|
|
998
|
+
protected getCodec<T>(schema: TSchema): KeylessCodec<T>;
|
|
906
999
|
protected nextVar(): string;
|
|
907
1000
|
/**
|
|
908
1001
|
* Compile codec using `new Function()` for maximum performance.
|
|
909
1002
|
* Only used when CSP allows and useFunctionCompilation is true.
|
|
910
1003
|
*/
|
|
911
|
-
protected compileWithFunction(schema: TSchema
|
|
1004
|
+
protected compileWithFunction(schema: TSchema): KeylessCodec;
|
|
912
1005
|
/**
|
|
913
1006
|
* Compile codec using interpreter-based approach.
|
|
914
1007
|
* Safer (no eval/Function) but slower. Used in browser by default.
|
|
915
1008
|
*/
|
|
916
|
-
protected compileInterpreted(schema: TSchema
|
|
917
|
-
protected interpretEncode(schema: TSchema
|
|
918
|
-
protected interpretDecode(schema: TSchema
|
|
1009
|
+
protected compileInterpreted(schema: TSchema): KeylessCodec;
|
|
1010
|
+
protected interpretEncode(schema: TSchema, value: any): any;
|
|
1011
|
+
protected interpretDecode(schema: TSchema, ctx: {
|
|
919
1012
|
arr: any[];
|
|
920
1013
|
i: number;
|
|
921
1014
|
}): any;
|
|
922
|
-
protected interpretDecodeFromValue(schema: TSchema
|
|
923
|
-
protected genEnc(schema: TSchema
|
|
924
|
-
protected genDec(schema: TSchema
|
|
1015
|
+
protected interpretDecodeFromValue(schema: TSchema, value: any): any;
|
|
1016
|
+
protected genEnc(schema: TSchema, ve: string): string;
|
|
1017
|
+
protected genDec(schema: TSchema): {
|
|
925
1018
|
code: string;
|
|
926
1019
|
result: string;
|
|
927
1020
|
};
|
|
928
|
-
protected genDecFromValue(schema: TSchema
|
|
929
|
-
protected isLeaf(schema: TSchema
|
|
930
|
-
protected getObjectFields(schema: TObject
|
|
1021
|
+
protected genDecFromValue(schema: TSchema, expr: string): string;
|
|
1022
|
+
protected isLeaf(schema: TSchema): boolean;
|
|
1023
|
+
protected getObjectFields(schema: TObject): Array<{
|
|
931
1024
|
key: string;
|
|
932
1025
|
isOpt: boolean;
|
|
933
1026
|
isNullable: boolean;
|
|
934
|
-
inner: TSchema
|
|
1027
|
+
inner: TSchema;
|
|
935
1028
|
}>;
|
|
936
|
-
protected isEnum(schema: TSchema
|
|
937
|
-
protected isNullable(schema: TSchema
|
|
938
|
-
protected unwrap(schema: TSchema
|
|
1029
|
+
protected isEnum(schema: TSchema): boolean;
|
|
1030
|
+
protected isNullable(schema: TSchema): boolean;
|
|
1031
|
+
protected unwrap(schema: TSchema): TSchema;
|
|
939
1032
|
/**
|
|
940
1033
|
* Reconstruct an object from a parsed array (for when input is already parsed).
|
|
941
1034
|
*/
|
|
942
|
-
protected reconstructObject(schema: TSchema
|
|
1035
|
+
protected reconstructObject(schema: TSchema, arr: any[]): any;
|
|
943
1036
|
}
|
|
944
1037
|
//#endregion
|
|
945
1038
|
//#region ../../src/core/providers/SchemaValidator.d.ts
|
|
946
|
-
declare class SchemaValidator {
|
|
947
|
-
protected cache: Map<TSchema$1, Validator<import("typebox").TProperties, TSchema$1, unknown, unknown>>;
|
|
948
|
-
protected useEval: boolean;
|
|
949
|
-
/**
|
|
950
|
-
* Validate the value against the provided schema.
|
|
951
|
-
*
|
|
952
|
-
* Validation create a new value by applying some preprocessing. (e.g., trimming text)
|
|
953
|
-
*/
|
|
954
|
-
validate<T extends TSchema$1>(schema: T, value: unknown, options?: ValidateOptions): Static<T>;
|
|
955
|
-
/**
|
|
956
|
-
* Deep clone a schema. Useful when a schema is going to be mutated.
|
|
957
|
-
*/
|
|
958
|
-
clone<T extends TSchema$1>(schema: T): T;
|
|
959
|
-
protected getValidator<T extends TSchema$1>(schema: T): Validator<{}, T>;
|
|
960
|
-
/**
|
|
961
|
-
* Preprocess the value based on the schema before validation.
|
|
962
|
-
*
|
|
963
|
-
* - If the value is `null` and the schema does not allow `null`, it converts it to `undefined`.
|
|
964
|
-
* - If the value is a string and the schema has a `~options.trim` flag, it trims whitespace from the string.
|
|
965
|
-
*/
|
|
966
|
-
beforeParse(schema: any, value: any, options: ValidateOptions): any;
|
|
967
|
-
/**
|
|
968
|
-
* Used by `beforeParse` to determine if a schema allows null values.
|
|
969
|
-
*/
|
|
970
|
-
protected isSchemaNullable: (schema: any) => boolean;
|
|
971
|
-
protected onConfigure: import("alepha").HookPrimitive<"configure">;
|
|
972
|
-
protected canEval(): boolean;
|
|
973
|
-
}
|
|
974
1039
|
interface ValidateOptions {
|
|
975
1040
|
trim?: boolean;
|
|
976
1041
|
nullToUndefined?: boolean;
|
|
977
1042
|
deleteUndefined?: boolean;
|
|
978
1043
|
}
|
|
1044
|
+
/**
|
|
1045
|
+
* Validates + coerces a value against a zod schema.
|
|
1046
|
+
*
|
|
1047
|
+
* Trimming / lowercasing / defaults / unknown-key stripping all live in the
|
|
1048
|
+
* schema itself now (zod), so this is a thin wrapper over `schema.parse`.
|
|
1049
|
+
* No typebox `Compile`, no `eval` — safe inside Cloudflare Workers.
|
|
1050
|
+
*/
|
|
1051
|
+
declare class SchemaValidator {
|
|
1052
|
+
validate<T extends TSchema>(schema: T, value: unknown, _options?: ValidateOptions): Static<T>;
|
|
1053
|
+
safeValidate<T extends TSchema>(schema: T, value: unknown): import("zod").ZodSafeParseResult<import("zod").output<T>>;
|
|
1054
|
+
/** Zod schemas are immutable — clone is a pass-through. */
|
|
1055
|
+
clone<T extends TSchema>(schema: T): T;
|
|
1056
|
+
/**
|
|
1057
|
+
* Legacy pre-processing entry point. Coercion now happens inside `parse`,
|
|
1058
|
+
* so this is a no-op kept for call-site compatibility.
|
|
1059
|
+
*/
|
|
1060
|
+
beforeParse(_schema: unknown, value: unknown, _options?: ValidateOptions): unknown;
|
|
1061
|
+
}
|
|
979
1062
|
//#endregion
|
|
980
1063
|
//#region ../../src/core/providers/CodecManager.d.ts
|
|
981
1064
|
type Encoding = "object" | "string" | "binary";
|
|
@@ -999,7 +1082,7 @@ interface EncodeOptions<T extends Encoding = Encoding> {
|
|
|
999
1082
|
*/
|
|
1000
1083
|
validation?: ValidateOptions | false;
|
|
1001
1084
|
}
|
|
1002
|
-
type EncodeResult<T extends TSchema
|
|
1085
|
+
type EncodeResult<T extends TSchema, E extends Encoding> = E extends "string" ? string : E extends "binary" ? Uint8Array : StaticEncode<T>;
|
|
1003
1086
|
interface DecodeOptions {
|
|
1004
1087
|
/**
|
|
1005
1088
|
* The encoder to use (e.g., 'json', 'protobuf', 'msgpack')
|
|
@@ -1038,17 +1121,17 @@ declare class CodecManager {
|
|
|
1038
1121
|
/**
|
|
1039
1122
|
* Encode data using the specified codec and output format.
|
|
1040
1123
|
*/
|
|
1041
|
-
encode<T extends TSchema
|
|
1124
|
+
encode<T extends TSchema, E extends Encoding = "object">(schema: T, value: unknown, options?: EncodeOptions<E>): EncodeResult<T, E>;
|
|
1042
1125
|
/**
|
|
1043
1126
|
* Decode data using the specified codec.
|
|
1044
1127
|
*/
|
|
1045
|
-
decode<T extends TSchema
|
|
1128
|
+
decode<T extends TSchema>(schema: T, data: any, options?: DecodeOptions): Static<T>;
|
|
1046
1129
|
/**
|
|
1047
1130
|
* Validate decoded data against the schema.
|
|
1048
1131
|
*
|
|
1049
1132
|
* This is automatically called before encoding or after decoding.
|
|
1050
1133
|
*/
|
|
1051
|
-
validate<T extends TSchema
|
|
1134
|
+
validate<T extends TSchema>(schema: T, value: unknown, options?: ValidateOptions): Static<T>;
|
|
1052
1135
|
}
|
|
1053
1136
|
interface CodecRegisterOptions {
|
|
1054
1137
|
name: string;
|
|
@@ -1147,7 +1230,8 @@ declare class StateManager<State$1 extends object = State> {
|
|
|
1147
1230
|
protected readonly als: AlsProvider;
|
|
1148
1231
|
protected readonly events: EventManager;
|
|
1149
1232
|
protected readonly codec: JsonSchemaCodec;
|
|
1150
|
-
protected readonly
|
|
1233
|
+
protected readonly validator: SchemaValidator;
|
|
1234
|
+
protected readonly atoms: Map<keyof State$1, Atom<TObject, string>>;
|
|
1151
1235
|
protected store: Partial<State$1>;
|
|
1152
1236
|
constructor(store?: Partial<State$1>);
|
|
1153
1237
|
/**
|
|
@@ -1162,7 +1246,98 @@ declare class StateManager<State$1 extends object = State> {
|
|
|
1162
1246
|
*/
|
|
1163
1247
|
exportAtoms(scope?: "current" | "app"): Record<string, unknown>;
|
|
1164
1248
|
getAtoms(context?: boolean): Array<AtomWithValue>;
|
|
1249
|
+
/**
|
|
1250
|
+
* Return the registered atom for a state key, if any.
|
|
1251
|
+
*/
|
|
1252
|
+
getAtom(key: string): Atom | undefined;
|
|
1253
|
+
/**
|
|
1254
|
+
* Every atom registered so far, whatever store layer (if any) currently
|
|
1255
|
+
* holds its value.
|
|
1256
|
+
*
|
|
1257
|
+
* This is the order-independent way to discover atoms. The
|
|
1258
|
+
* `"state:register"` event fires exactly once per key and `EventManager`
|
|
1259
|
+
* has no replay buffer, so a service instantiated after an atom registered
|
|
1260
|
+
* never hears about it — a real hazard, since `$module.register()`
|
|
1261
|
+
* registers `atoms[]` BEFORE it wires `imports[]` and injects `services[]`.
|
|
1262
|
+
* Services that act on atoms (e.g. the cookie persistence adapter) must
|
|
1263
|
+
* read this registry on demand rather than build their own map from the
|
|
1264
|
+
* event.
|
|
1265
|
+
*/
|
|
1266
|
+
listAtoms(): Array<Atom>;
|
|
1165
1267
|
register(atom: Atom<any>): this;
|
|
1268
|
+
/**
|
|
1269
|
+
* Install the atom's declared default into the app-level store.
|
|
1270
|
+
*
|
|
1271
|
+
* Deliberately bypasses {@link set}, for two reasons:
|
|
1272
|
+
*
|
|
1273
|
+
* 1. `set()` short-circuits when the new value equals the currently
|
|
1274
|
+
* *resolved* value (`prevValue === value` for non-objects) — inside a
|
|
1275
|
+
* fork that already holds the same primitive value, the app-store write
|
|
1276
|
+
* would simply never happen.
|
|
1277
|
+
* 2. A registration seed is initialisation, NOT a mutation, so it must not
|
|
1278
|
+
* emit `state:mutate`. Persistence adapters listen on that event: an
|
|
1279
|
+
* atom registering lazily mid-request would otherwise emit a mutation
|
|
1280
|
+
* carrying its *default*, and the cookie adapter would dutifully write
|
|
1281
|
+
* it back as a `Set-Cookie` — overwriting the very cookie the request
|
|
1282
|
+
* arrived with.
|
|
1283
|
+
*
|
|
1284
|
+
* A `undefined` default (only reachable for an optional schema) is not
|
|
1285
|
+
* written at all, so the key stays absent from the store — matching the
|
|
1286
|
+
* previous behaviour of `set(key, undefined)`.
|
|
1287
|
+
*/
|
|
1288
|
+
protected seedDefault(atom: Atom<any>, key: keyof State$1): void;
|
|
1289
|
+
/**
|
|
1290
|
+
* A fresh, schema-validated copy of the atom's declared default.
|
|
1291
|
+
*
|
|
1292
|
+
* `atom.options.default` is a module-level object shared by every
|
|
1293
|
+
* container and every request in the process. Handing that exact reference
|
|
1294
|
+
* to the store would let an ordinary `store.mut(atom, s => ...)` mutate the
|
|
1295
|
+
* declaration itself, permanently and process-wide. Every other write path
|
|
1296
|
+
* round-trips through the validator (zod always returns a new object), so
|
|
1297
|
+
* these must too.
|
|
1298
|
+
*/
|
|
1299
|
+
protected cloneDefault(atom: Atom<any>): unknown;
|
|
1300
|
+
/**
|
|
1301
|
+
* Decode a value that already exists under an atom's key at registration
|
|
1302
|
+
* time, in place, in whichever layer it physically lives (an ALS fork
|
|
1303
|
+
* layer or the app store) — never flattening a fork-scoped value into the
|
|
1304
|
+
* app-level store.
|
|
1305
|
+
*
|
|
1306
|
+
* On schema mismatch, falls back to the atom's default (written into that
|
|
1307
|
+
* same layer) and emits a warning: a bad seed silently reverting a whole
|
|
1308
|
+
* atom to its defaults should be visible, not indistinguishable from
|
|
1309
|
+
* "nothing was ever set".
|
|
1310
|
+
*/
|
|
1311
|
+
protected decodeExisting(atom: Atom<any>, key: keyof State$1, layer: Record<string, any>): void;
|
|
1312
|
+
/**
|
|
1313
|
+
* Web-storage persistence (localStorage / sessionStorage) for atoms
|
|
1314
|
+
* declared with `persist`. Best-effort: quota errors and privacy modes
|
|
1315
|
+
* are swallowed. Cookie persistence is NOT handled here — it needs the
|
|
1316
|
+
* HTTP request cycle and lives in `alepha/server/cookies`
|
|
1317
|
+
* (AtomCookiePersistence), which discovers its atoms through
|
|
1318
|
+
* {@link listAtoms}. Both adapters are therefore registration-order
|
|
1319
|
+
* independent: one `persist` option, one reliability contract.
|
|
1320
|
+
*/
|
|
1321
|
+
protected bindWebStorage(atom: Atom<any>): void;
|
|
1322
|
+
/**
|
|
1323
|
+
* Best-effort `Storage#removeItem`. Some privacy modes throw on every
|
|
1324
|
+
* Storage method, including `removeItem` — this must never escape a
|
|
1325
|
+
* recovery `catch`, or persistence stops being best-effort.
|
|
1326
|
+
*/
|
|
1327
|
+
protected safeRemoveItem(storage: Storage, key: string): void;
|
|
1328
|
+
/**
|
|
1329
|
+
* Resolve a Web Storage area, or undefined when unavailable (server,
|
|
1330
|
+
* privacy mode that throws on access).
|
|
1331
|
+
*/
|
|
1332
|
+
protected getWebStorage(kind: "localStorage" | "sessionStorage"): Storage | undefined;
|
|
1333
|
+
/**
|
|
1334
|
+
* Best-effort logger lookup. `StateManager` lives in `core`, which cannot
|
|
1335
|
+
* depend on the logger module, so this reads the `"alepha.logger"` state
|
|
1336
|
+
* key directly (set by `Alepha.create()`, see `Alepha.ts`) instead of
|
|
1337
|
+
* injecting a logger service. May be `undefined` during early boot, before
|
|
1338
|
+
* the logger is wired up — callers must stay null-safe.
|
|
1339
|
+
*/
|
|
1340
|
+
protected get logger(): LoggerInterface | undefined;
|
|
1166
1341
|
/**
|
|
1167
1342
|
* Get a value from the state with proper typing.
|
|
1168
1343
|
*
|
|
@@ -1172,6 +1347,7 @@ declare class StateManager<State$1 extends object = State> {
|
|
|
1172
1347
|
* - `"parent"`: Read only from the immediate parent fork layer.
|
|
1173
1348
|
* - `"app"`: Read only from the root (app-level) store.
|
|
1174
1349
|
*/
|
|
1350
|
+
get<R>(target: Computed<R>, scope?: StateScope): R;
|
|
1175
1351
|
get<T extends TAtomObject>(target: Atom<T>, scope?: StateScope): Static<T>;
|
|
1176
1352
|
get<Key extends keyof State$1>(target: Key, scope?: StateScope): State$1[Key] | undefined;
|
|
1177
1353
|
/**
|
|
@@ -1179,10 +1355,38 @@ declare class StateManager<State$1 extends object = State> {
|
|
|
1179
1355
|
*/
|
|
1180
1356
|
set<T extends TAtomObject>(target: Atom<T>, value: AtomStatic<T>, options?: SetStateOptions): this;
|
|
1181
1357
|
set<Key extends keyof State$1>(target: Key, value: State$1[Key] | undefined, options?: SetStateOptions): this;
|
|
1358
|
+
/**
|
|
1359
|
+
* Reset an atom back to its declared default value.
|
|
1360
|
+
*/
|
|
1361
|
+
reset<T extends TAtomObject>(atom: Atom<T>): this;
|
|
1362
|
+
/**
|
|
1363
|
+
* Observe mutations of an atom, a computed value, or a raw state key
|
|
1364
|
+
* outside React. Returns an unsubscribe function.
|
|
1365
|
+
*
|
|
1366
|
+
* **`Computed` overload, server-side caveat.** A computed has no stored
|
|
1367
|
+
* value, so the watcher keeps the last computed result in a single `prev`
|
|
1368
|
+
* closure variable, created once at subscription time and shared by every
|
|
1369
|
+
* invocation. Request-scoped (fork) state is not: two concurrent requests
|
|
1370
|
+
* resolve different values for the same dependency atoms. So the
|
|
1371
|
+
* `prevValue` handed to the callback is "the value this watcher computed
|
|
1372
|
+
* last time it fired", which may well have been computed inside a
|
|
1373
|
+
* *different* request's fork. `value` is always correct (it is computed
|
|
1374
|
+
* fresh, inside the mutating context); only `prevValue` can cross request
|
|
1375
|
+
* boundaries.
|
|
1376
|
+
*
|
|
1377
|
+
* That is fine for `watch`'s intended use — app-level, non-React
|
|
1378
|
+
* observation of app-level state (React subscribes through `useComputed`,
|
|
1379
|
+
* which is per-component and browser-side, where there is only ever one
|
|
1380
|
+
* "request"). Do not build per-request logic on a computed's `prevValue`
|
|
1381
|
+
* on the server.
|
|
1382
|
+
*/
|
|
1383
|
+
watch<T extends TAtomObject>(target: Atom<T>, callback: (value: Static<T>, prevValue: Static<T> | undefined) => void): () => void;
|
|
1384
|
+
watch<R>(target: Computed<R>, callback: (value: R, prevValue: R | undefined) => void): () => void;
|
|
1385
|
+
watch<Key extends keyof State$1>(target: Key, callback: (value: State$1[Key] | undefined, prevValue: State$1[Key] | undefined) => void): () => void;
|
|
1182
1386
|
/**
|
|
1183
1387
|
* Mutate a value in the state.
|
|
1184
1388
|
*/
|
|
1185
|
-
mut<T extends TObject
|
|
1389
|
+
mut<T extends TObject>(target: Atom<T>, mutator: (current: Static<T>) => Static<T>): this;
|
|
1186
1390
|
mut<Key extends keyof State$1>(target: Key, mutator: (current: State$1[Key] | undefined) => State$1[Key] | undefined): this;
|
|
1187
1391
|
/**
|
|
1188
1392
|
* Check if a key exists in the state.
|
|
@@ -1206,10 +1410,15 @@ declare class StateManager<State$1 extends object = State> {
|
|
|
1206
1410
|
*/
|
|
1207
1411
|
keys(): (keyof State$1)[];
|
|
1208
1412
|
}
|
|
1209
|
-
type OnlyArray<T extends object> = { [K in keyof T]: NonNullable<T[K]> extends Array<any> ? K : never };
|
|
1413
|
+
type OnlyArray<T extends object> = { [K in keyof T]: NonNullable<T[K]> extends Array<any> ? K : never; };
|
|
1210
1414
|
interface SetStateOptions {
|
|
1211
1415
|
skipContext?: boolean;
|
|
1212
1416
|
skipEvents?: boolean;
|
|
1417
|
+
/**
|
|
1418
|
+
* Skip schema validation for this write. Internal escape hatch for
|
|
1419
|
+
* callers that have already validated the value (e.g. hydration).
|
|
1420
|
+
*/
|
|
1421
|
+
skipValidation?: boolean;
|
|
1213
1422
|
}
|
|
1214
1423
|
//#endregion
|
|
1215
1424
|
//#region ../../src/core/Alepha.d.ts
|
|
@@ -1273,8 +1482,8 @@ interface SetStateOptions {
|
|
|
1273
1482
|
* // But you should use $env() primitive to get typed values from the environment.
|
|
1274
1483
|
* class App {
|
|
1275
1484
|
* env = $env(
|
|
1276
|
-
*
|
|
1277
|
-
* MY_VAR:
|
|
1485
|
+
* z.object({
|
|
1486
|
+
* MY_VAR: z.text(),
|
|
1278
1487
|
* })
|
|
1279
1488
|
* );
|
|
1280
1489
|
* }
|
|
@@ -1443,10 +1652,15 @@ declare class Alepha {
|
|
|
1443
1652
|
get env(): Readonly<Env>;
|
|
1444
1653
|
constructor(state?: Partial<State>);
|
|
1445
1654
|
fork<R>(callback: () => R, data?: Record<string, any>): R;
|
|
1446
|
-
get<
|
|
1655
|
+
get<R>(target: Computed<R>, scope?: StateScope): R;
|
|
1656
|
+
get<T extends TAtomObject>(target: Atom<T>, scope?: StateScope): Static<T>;
|
|
1447
1657
|
get<Key extends keyof State>(target: Key, scope?: StateScope): State[Key] | undefined;
|
|
1448
1658
|
set<T extends TAtomObject>(target: Atom<T>, value: AtomStatic<T>): this;
|
|
1449
1659
|
set<Key extends keyof State>(target: Key, value: State[Key] | undefined): this;
|
|
1660
|
+
/**
|
|
1661
|
+
* Reset an atom back to its declared default value.
|
|
1662
|
+
*/
|
|
1663
|
+
reset<T extends TAtomObject>(target: Atom<T>): this;
|
|
1450
1664
|
/**
|
|
1451
1665
|
* True when start() is called.
|
|
1452
1666
|
*
|
|
@@ -1660,7 +1874,7 @@ declare class Alepha {
|
|
|
1660
1874
|
* @param schema - The schema object to apply environment variables to.
|
|
1661
1875
|
* @return The schema object with environment variables applied.
|
|
1662
1876
|
*/
|
|
1663
|
-
parseEnv<T extends TObject
|
|
1877
|
+
parseEnv<T extends TObject>(schema: T): Static<T>;
|
|
1664
1878
|
/**
|
|
1665
1879
|
* Get all environment variable schemas and their parsed values.
|
|
1666
1880
|
*
|
|
@@ -1776,8 +1990,8 @@ interface State {
|
|
|
1776
1990
|
* db = $inject(DatabaseProvider);
|
|
1777
1991
|
* alepha = $inject(Alepha);
|
|
1778
1992
|
* env = $env(
|
|
1779
|
-
*
|
|
1780
|
-
* MIGRATE:
|
|
1993
|
+
* z.object({
|
|
1994
|
+
* MIGRATE: z.boolean().optional(),
|
|
1781
1995
|
* }),
|
|
1782
1996
|
* );
|
|
1783
1997
|
*
|
|
@@ -1873,6 +2087,15 @@ interface Hooks {
|
|
|
1873
2087
|
*/
|
|
1874
2088
|
prevValue: any;
|
|
1875
2089
|
};
|
|
2090
|
+
/**
|
|
2091
|
+
* Triggered the first time an atom is registered in the state manager.
|
|
2092
|
+
*/
|
|
2093
|
+
"state:register": {
|
|
2094
|
+
/**
|
|
2095
|
+
* The atom that was registered.
|
|
2096
|
+
*/
|
|
2097
|
+
atom: Atom<any, any>;
|
|
2098
|
+
};
|
|
1876
2099
|
}
|
|
1877
2100
|
//#endregion
|
|
1878
2101
|
//#region ../../src/core/interfaces/Run.d.ts
|
|
@@ -1906,6 +2129,14 @@ interface RunOptions {
|
|
|
1906
2129
|
*/
|
|
1907
2130
|
declare const OPTIONS: unique symbol;
|
|
1908
2131
|
//#endregion
|
|
2132
|
+
//#region ../../src/core/errors/AlephaError.d.ts
|
|
2133
|
+
/**
|
|
2134
|
+
* Default error class for Alepha.
|
|
2135
|
+
*/
|
|
2136
|
+
declare class AlephaError extends Error {
|
|
2137
|
+
name: string;
|
|
2138
|
+
}
|
|
2139
|
+
//#endregion
|
|
1909
2140
|
//#region ../../src/core/errors/AppNotStartedError.d.ts
|
|
1910
2141
|
declare class AppNotStartedError extends AlephaError {
|
|
1911
2142
|
readonly name = "AppNotStartedError";
|
|
@@ -1930,25 +2161,66 @@ declare class TooLateSubstitutionError extends AlephaError {
|
|
|
1930
2161
|
constructor(original: string, substitution: string);
|
|
1931
2162
|
}
|
|
1932
2163
|
//#endregion
|
|
2164
|
+
//#region ../../src/core/errors/TypeBoxError.d.ts
|
|
2165
|
+
/** Minimal validation-error shape (decoupled from any schema lib). */
|
|
2166
|
+
interface ValidationErrorLike {
|
|
2167
|
+
message: string;
|
|
2168
|
+
instancePath?: string;
|
|
2169
|
+
params?: unknown;
|
|
2170
|
+
}
|
|
2171
|
+
declare class TypeBoxError extends AlephaError {
|
|
2172
|
+
name: string;
|
|
2173
|
+
readonly cause: ValidationErrorLike;
|
|
2174
|
+
readonly value: {
|
|
2175
|
+
path: string;
|
|
2176
|
+
message: string;
|
|
2177
|
+
};
|
|
2178
|
+
constructor(error: ValidationErrorLike);
|
|
2179
|
+
}
|
|
2180
|
+
interface TypeBoxErrorParams {
|
|
2181
|
+
requiredProperties?: string[];
|
|
2182
|
+
}
|
|
2183
|
+
//#endregion
|
|
2184
|
+
//#region ../../src/core/helpers/coerceStrings.d.ts
|
|
2185
|
+
/**
|
|
2186
|
+
* Coerce a single string value coming from a string-only boundary (HTTP query,
|
|
2187
|
+
* HTTP headers, environment variables) to the JS type its schema declares.
|
|
2188
|
+
*
|
|
2189
|
+
* This is the zod-standard `z.coerce` behavior applied only at the edges where
|
|
2190
|
+
* inputs are inherently strings — request bodies and the ORM stay strict. A
|
|
2191
|
+
* value that cannot be coerced is returned unchanged so the subsequent
|
|
2192
|
+
* validation produces a proper rejection. Arrays coerce element-wise.
|
|
2193
|
+
*/
|
|
2194
|
+
declare const coerceScalar: (schema: unknown, value: unknown) => unknown;
|
|
2195
|
+
/**
|
|
2196
|
+
* Coerce each declared field of an object against its object schema. Used to
|
|
2197
|
+
* normalize string-only boundary maps (env vars, query objects) before strict
|
|
2198
|
+
* validation. Undeclared keys are passed through untouched.
|
|
2199
|
+
*/
|
|
2200
|
+
declare const coerceObject: (schema: unknown, value: Record<string, unknown>) => Record<string, unknown>;
|
|
2201
|
+
//#endregion
|
|
1933
2202
|
//#region ../../src/core/schemas/pageSchema.d.ts
|
|
1934
|
-
declare const pageMetadataSchema:
|
|
1935
|
-
number: import("
|
|
1936
|
-
size: import("
|
|
1937
|
-
offset: import("
|
|
1938
|
-
numberOfElements: import("
|
|
1939
|
-
totalElements: import("
|
|
1940
|
-
totalPages: import("
|
|
1941
|
-
isEmpty: import("
|
|
1942
|
-
isFirst: import("
|
|
1943
|
-
isLast: import("
|
|
1944
|
-
sort: import("
|
|
1945
|
-
sorted: import("
|
|
1946
|
-
fields:
|
|
1947
|
-
field: import("
|
|
1948
|
-
direction: import("
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
}>;
|
|
2203
|
+
declare const pageMetadataSchema: import("zod").ZodObject<{
|
|
2204
|
+
number: import("zod").ZodInt;
|
|
2205
|
+
size: import("zod").ZodInt;
|
|
2206
|
+
offset: import("zod").ZodInt;
|
|
2207
|
+
numberOfElements: import("zod").ZodInt;
|
|
2208
|
+
totalElements: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
2209
|
+
totalPages: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
2210
|
+
isEmpty: import("zod").ZodBoolean;
|
|
2211
|
+
isFirst: import("zod").ZodBoolean;
|
|
2212
|
+
isLast: import("zod").ZodBoolean;
|
|
2213
|
+
sort: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
2214
|
+
sorted: import("zod").ZodBoolean;
|
|
2215
|
+
fields: import("zod").ZodArray<import("zod").ZodObject<{
|
|
2216
|
+
field: import("zod").ZodString;
|
|
2217
|
+
direction: import("zod").ZodEnum<{
|
|
2218
|
+
asc: "asc";
|
|
2219
|
+
desc: "desc";
|
|
2220
|
+
}>;
|
|
2221
|
+
}, import("zod/v4/core").$strip>>;
|
|
2222
|
+
}, import("zod/v4/core").$strip>>;
|
|
2223
|
+
}, import("zod/v4/core").$strip>;
|
|
1952
2224
|
/**
|
|
1953
2225
|
* Create a pagination schema for the given object schema.
|
|
1954
2226
|
*
|
|
@@ -1957,7 +2229,7 @@ declare const pageMetadataSchema: TObject<{
|
|
|
1957
2229
|
*
|
|
1958
2230
|
* @example
|
|
1959
2231
|
* ```ts
|
|
1960
|
-
* const userSchema =
|
|
2232
|
+
* const userSchema = z.object({ id: z.integer(), name: z.text() });
|
|
1961
2233
|
* const userPageSchema = pageSchema(userSchema);
|
|
1962
2234
|
* ```
|
|
1963
2235
|
*
|
|
@@ -1971,7 +2243,7 @@ declare const pageMetadataSchema: TObject<{
|
|
|
1971
2243
|
* })
|
|
1972
2244
|
* ```
|
|
1973
2245
|
*/
|
|
1974
|
-
declare const pageSchema: <T extends TObject | TRecord>(objectSchema: T
|
|
2246
|
+
declare const pageSchema: <T extends TObject | TRecord>(objectSchema: T) => TPage<T>;
|
|
1975
2247
|
type TPage<T extends TObject | TRecord> = TObject<{
|
|
1976
2248
|
content: TArray<T>;
|
|
1977
2249
|
page: typeof pageMetadataSchema;
|
|
@@ -2021,7 +2293,7 @@ declare module "alepha" {
|
|
|
2021
2293
|
*/
|
|
2022
2294
|
page<T extends TObject | TRecord>(itemSchema: T): TPage<T>;
|
|
2023
2295
|
}
|
|
2024
|
-
}
|
|
2296
|
+
}
|
|
2025
2297
|
//#endregion
|
|
2026
2298
|
//#region ../../src/core/helpers/createPagination.d.ts
|
|
2027
2299
|
/**
|
|
@@ -2073,88 +2345,19 @@ declare function createPagination<T>(entities: T[], limit?: number, offset?: num
|
|
|
2073
2345
|
direction: "asc" | "desc";
|
|
2074
2346
|
}>): Page<T>;
|
|
2075
2347
|
//#endregion
|
|
2076
|
-
//#region ../../src/core/helpers/
|
|
2077
|
-
/**
|
|
2078
|
-
* JSON Schema representation for conversion to TypeBox.
|
|
2079
|
-
*/
|
|
2080
|
-
interface JsonSchemaObject {
|
|
2081
|
-
type?: string | string[];
|
|
2082
|
-
properties?: Record<string, JsonSchemaObject>;
|
|
2083
|
-
required?: string[];
|
|
2084
|
-
items?: JsonSchemaObject;
|
|
2085
|
-
enum?: (string | number | boolean)[];
|
|
2086
|
-
const?: unknown;
|
|
2087
|
-
format?: string;
|
|
2088
|
-
title?: string;
|
|
2089
|
-
description?: string;
|
|
2090
|
-
default?: unknown;
|
|
2091
|
-
minLength?: number;
|
|
2092
|
-
maxLength?: number;
|
|
2093
|
-
minimum?: number;
|
|
2094
|
-
maximum?: number;
|
|
2095
|
-
exclusiveMinimum?: number;
|
|
2096
|
-
exclusiveMaximum?: number;
|
|
2097
|
-
multipleOf?: number;
|
|
2098
|
-
pattern?: string;
|
|
2099
|
-
minItems?: number;
|
|
2100
|
-
maxItems?: number;
|
|
2101
|
-
uniqueItems?: boolean;
|
|
2102
|
-
"~options"?: {
|
|
2103
|
-
trim?: boolean;
|
|
2104
|
-
lowercase?: boolean;
|
|
2105
|
-
};
|
|
2106
|
-
oneOf?: JsonSchemaObject[];
|
|
2107
|
-
anyOf?: JsonSchemaObject[];
|
|
2108
|
-
allOf?: JsonSchemaObject[];
|
|
2109
|
-
not?: JsonSchemaObject;
|
|
2110
|
-
$ref?: string;
|
|
2111
|
-
}
|
|
2348
|
+
//#region ../../src/core/helpers/jsonSchemaToZod.d.ts
|
|
2112
2349
|
/**
|
|
2113
|
-
*
|
|
2114
|
-
*
|
|
2115
|
-
*
|
|
2116
|
-
*
|
|
2117
|
-
*
|
|
2118
|
-
*
|
|
2119
|
-
*
|
|
2120
|
-
*
|
|
2121
|
-
*
|
|
2122
|
-
* - Nested objects with required/optional properties
|
|
2123
|
-
* - Arrays with item schemas
|
|
2124
|
-
* - Common validation options: minLength, maxLength, minimum, maximum, pattern
|
|
2125
|
-
* - anyOf/oneOf/allOf with nullable patterns (e.g., `anyOf: [type, null]` → `t.nullable(type)`)
|
|
2126
|
-
* - Alepha ~options (trim, lowercase) pass-through
|
|
2127
|
-
*
|
|
2128
|
-
* **Not supported:**
|
|
2129
|
-
* - $ref (references)
|
|
2130
|
-
* - additionalProperties, patternProperties
|
|
2131
|
-
* - Complex composition schemas (multiple non-null types in anyOf/oneOf/allOf)
|
|
2132
|
-
*
|
|
2133
|
-
* @param schema - JSON Schema object to convert
|
|
2134
|
-
* @returns TypeBox TSchema
|
|
2135
|
-
*
|
|
2136
|
-
* @example
|
|
2137
|
-
* ```ts
|
|
2138
|
-
* const jsonSchema = {
|
|
2139
|
-
* type: "object",
|
|
2140
|
-
* properties: {
|
|
2141
|
-
* email: { type: "string", format: "email" },
|
|
2142
|
-
* age: { type: "integer", minimum: 0 },
|
|
2143
|
-
* active: { type: "boolean" },
|
|
2144
|
-
* },
|
|
2145
|
-
* required: ["email"]
|
|
2146
|
-
* };
|
|
2147
|
-
*
|
|
2148
|
-
* const typeBoxSchema = jsonSchemaToTypeBox(jsonSchema);
|
|
2149
|
-
* // Equivalent to:
|
|
2150
|
-
* // t.object({
|
|
2151
|
-
* // email: t.email(),
|
|
2152
|
-
* // age: t.optional(t.integer({ minimum: 0 })),
|
|
2153
|
-
* // active: t.optional(t.boolean()),
|
|
2154
|
-
* // })
|
|
2155
|
-
* ```
|
|
2350
|
+
* Convert a JSON Schema object into a zod schema (the inverse of
|
|
2351
|
+
* `z.toJSONSchema`). zod 4 has no native `fromJSONSchema`, so this provides the
|
|
2352
|
+
* round-trip needed by dynamic, schema-driven UIs (e.g. devtools forms built
|
|
2353
|
+
* from an entity's or action's published JSON Schema).
|
|
2354
|
+
*
|
|
2355
|
+
* Covers the JSON Schema subset Alepha emits: object/array/string (+formats),
|
|
2356
|
+
* number/integer, boolean, null, enum, and `anyOf`/`oneOf` (including the
|
|
2357
|
+
* nullable `anyOf: [..., { type: "null" }]` shape). Anything unrecognized falls
|
|
2358
|
+
* back to `z.any()`.
|
|
2156
2359
|
*/
|
|
2157
|
-
declare
|
|
2360
|
+
declare const jsonSchemaToZod: (schema: any) => ZType;
|
|
2158
2361
|
//#endregion
|
|
2159
2362
|
//#region ../../src/core/helpers/ref.d.ts
|
|
2160
2363
|
/**
|
|
@@ -2169,6 +2372,64 @@ declare const __alephaRef: {
|
|
|
2169
2372
|
};
|
|
2170
2373
|
parent?: Service;
|
|
2171
2374
|
};
|
|
2375
|
+
/**
|
|
2376
|
+
* Note:
|
|
2377
|
+
*
|
|
2378
|
+
* This file is used to share context between $primitives and the Alepha core during the injection phase.
|
|
2379
|
+
*
|
|
2380
|
+
* There is no side effect as long as Alepha is not used concurrently in multiple contexts (which is not the case).
|
|
2381
|
+
*
|
|
2382
|
+
* // __alephaRef === undefined
|
|
2383
|
+
* // begin alepha.with()
|
|
2384
|
+
* // __alephaRef.context = alepha
|
|
2385
|
+
* // ... injection phase ...
|
|
2386
|
+
* // __alephaRef.context = undefined
|
|
2387
|
+
* // end alepha.with()
|
|
2388
|
+
* // __alephaRef === undefined
|
|
2389
|
+
*
|
|
2390
|
+
* As .with() is synchronous, there is no risk of context leakage.
|
|
2391
|
+
*
|
|
2392
|
+
* ---------------------------------------------------------------------------------------------------------------------
|
|
2393
|
+
*
|
|
2394
|
+
* Why this helper?
|
|
2395
|
+
*
|
|
2396
|
+
* It allows to avoid passing Alepha instance to every $hook, $inject, etc. calls. It's a beautiful syntactic sugar.
|
|
2397
|
+
*
|
|
2398
|
+
* With sugar:
|
|
2399
|
+
*
|
|
2400
|
+
* class A {
|
|
2401
|
+
* on = $hook( ... ) // <- __alephaRef is set here
|
|
2402
|
+
* }
|
|
2403
|
+
*
|
|
2404
|
+
* Without sugar:
|
|
2405
|
+
*
|
|
2406
|
+
* class A {
|
|
2407
|
+
* constructor(alepha: Alepha) {
|
|
2408
|
+
* this.on = $hook(alepha, ... ) // <- no need of __alephaRef
|
|
2409
|
+
* }
|
|
2410
|
+
* }
|
|
2411
|
+
*
|
|
2412
|
+
* One main goal of Alepha is working with classes but without the class verbosity.
|
|
2413
|
+
* Forcing to pass Alepha instance in constructors would be a step back in that direction!
|
|
2414
|
+
*
|
|
2415
|
+
* ---------------------------------------------------------------------------------------------------------------------
|
|
2416
|
+
*
|
|
2417
|
+
* TODO: harden the cursor against mid-instantiation throws.
|
|
2418
|
+
*
|
|
2419
|
+
* Today, the cleanup of `__alephaRef.alepha`, `__alephaRef.service`, `__alephaRef.parent`
|
|
2420
|
+
* is performed by the caller after the synchronous instantiation returns. If the
|
|
2421
|
+
* instantiation throws (e.g., a primitive factory blows up, or a user constructor
|
|
2422
|
+
* raises), the cursor can be left holding stale references until the next
|
|
2423
|
+
* instantiation overwrites them. In practice this is harmless because Alepha is
|
|
2424
|
+
* single-threaded synchronous during boot and the next inject() rewrites the
|
|
2425
|
+
* cursor — but it is a sharp edge for debuggers (frame inspection shows ghost
|
|
2426
|
+
* state) and any future tooling that introspects __alephaRef out-of-band.
|
|
2427
|
+
*
|
|
2428
|
+
* Plan: wrap each cursor mutation in Alepha.ts in a try/finally that snapshots
|
|
2429
|
+
* the previous value and restores it on exit (even on throw). Equivalent to a
|
|
2430
|
+
* lexically-scoped "with" — pushes/pops cleanly. Should be a 5-line refactor in
|
|
2431
|
+
* Alepha.ts:1131-1132 once we touch it.
|
|
2432
|
+
*/
|
|
2172
2433
|
//#endregion
|
|
2173
2434
|
//#region ../../src/core/interfaces/Pagination.d.ts
|
|
2174
2435
|
/**
|
|
@@ -2287,8 +2548,8 @@ interface ContextPrimitive {
|
|
|
2287
2548
|
* log = $logger();
|
|
2288
2549
|
*
|
|
2289
2550
|
* // program expect a var env "HELLO" as string to works
|
|
2290
|
-
* env = $env(
|
|
2291
|
-
* HELLO:
|
|
2551
|
+
* env = $env(z.object({
|
|
2552
|
+
* HELLO: z.text()
|
|
2292
2553
|
* }));
|
|
2293
2554
|
*
|
|
2294
2555
|
* sayHello = () => this.log.info("Hello ${this.env.HELLO}")
|
|
@@ -2297,7 +2558,7 @@ interface ContextPrimitive {
|
|
|
2297
2558
|
* run(alepha.with(App));
|
|
2298
2559
|
* ```
|
|
2299
2560
|
*/
|
|
2300
|
-
declare const $env: <T extends TObject
|
|
2561
|
+
declare const $env: <T extends TObject>(type: T) => Static<T>;
|
|
2301
2562
|
//#endregion
|
|
2302
2563
|
//#region ../../src/core/primitives/$hook.d.ts
|
|
2303
2564
|
/**
|
|
@@ -2486,7 +2747,6 @@ declare const $mode: (args: ModeOptions) => boolean;
|
|
|
2486
2747
|
* ```
|
|
2487
2748
|
*/
|
|
2488
2749
|
declare function $pipeline<T extends (...args: any[]) => any>(options: PipelineOptions<T>): PipelinePrimitiveFn<T>;
|
|
2489
|
-
declare namespace $pipeline {}
|
|
2490
2750
|
declare class PipelinePrimitive<TOptions extends PipelinePrimitiveOptions = PipelinePrimitiveOptions> extends Primitive<TOptions> {
|
|
2491
2751
|
readonly handler: PipelineHandler;
|
|
2492
2752
|
get middlewares(): MiddlewareMetadata[];
|
|
@@ -2595,7 +2855,7 @@ declare const $scope: () => Middleware;
|
|
|
2595
2855
|
*
|
|
2596
2856
|
* @example
|
|
2597
2857
|
* ```ts
|
|
2598
|
-
* const userState = $atom({ schema:
|
|
2858
|
+
* const userState = $atom({ schema: z.object({ name: z.text(), role: z.text() }) });
|
|
2599
2859
|
*
|
|
2600
2860
|
* class UserComponent {
|
|
2601
2861
|
* user = $state(userState); // Reactive reference to atom state
|
|
@@ -2609,11 +2869,11 @@ declare const $scope: () => Middleware;
|
|
|
2609
2869
|
declare const $state: <T extends TAtomObject, N extends string>(atom: Atom<T, N>) => Readonly<Static<T>>;
|
|
2610
2870
|
//#endregion
|
|
2611
2871
|
//#region ../../src/core/schemas/pageQuerySchema.d.ts
|
|
2612
|
-
declare const pageQuerySchema: import("
|
|
2613
|
-
page: import("
|
|
2614
|
-
size: import("
|
|
2615
|
-
sort: import("
|
|
2616
|
-
}>;
|
|
2872
|
+
declare const pageQuerySchema: import("zod").ZodObject<{
|
|
2873
|
+
page: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodInt>>;
|
|
2874
|
+
size: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodInt>>;
|
|
2875
|
+
sort: import("zod").ZodOptional<import("zod").ZodString>;
|
|
2876
|
+
}, import("zod/v4/core").$strip>;
|
|
2617
2877
|
type PageQuery = Static<typeof pageQuerySchema>;
|
|
2618
2878
|
//#endregion
|
|
2619
2879
|
//#region ../../src/core/index.d.ts
|
|
@@ -2649,5 +2909,5 @@ declare const AlephaCore: Service<import("alepha").Module>;
|
|
|
2649
2909
|
*/
|
|
2650
2910
|
declare const run: (entry: Alepha | Service | Array<Service>, opts?: RunOptions) => Alepha;
|
|
2651
2911
|
//#endregion
|
|
2652
|
-
export { $atom, $context, $env, $hook, $inject, $memoize, $mode, $module, $pipeline, $scope, $state, ALS_PARENT, AbstractClass, Alepha, AlephaCore, AlephaDump, AlephaDumpEnvVariable, AlephaError, AlsProvider, AppNotStartedError, Async, AsyncFn, AsyncLocalStorageData, Atom, AtomOptions, AtomStatic, AtomWithValue, CircularDependencyError, CodecManager, CodecRegisterOptions, CompileOptions, CompiledEventExecutor, ContainerLockedError, ContextPrimitive, CreateMiddlewareOptions, DecodeOptions, EncodeOptions, EncodeResult, Encoding, Env, EventManager, FileLike,
|
|
2912
|
+
export { $atom, $computed, $context, $env, $hook, $inject, $memoize, $mode, $module, $pipeline, $scope, $state, ALS_PARENT, AbstractClass, Alepha, AlephaCore, AlephaDump, AlephaDumpEnvVariable, AlephaError, AlsProvider, AnyDep, AppNotStartedError, Async, AsyncFn, AsyncLocalStorageData, Atom, AtomOptions, AtomPersist, AtomStatic, AtomWithValue, CircularDependencyError, CodecManager, CodecRegisterOptions, CompileOptions, CompiledEventExecutor, Computed, ComputedOptions, ContainerLockedError, ContextPrimitive, CreateMiddlewareOptions, DecodeOptions, DepValues, EncodeOptions, EncodeResult, Encoding, Env, EventManager, FileLike, Hook, HookOptions, HookPrimitive, Hooks, Infer, InjectOptions, InjectPrimitive, InstantiableClass, Json, JsonSchemaCodec, KIND, KeylessCodec, KeylessCodecOptions, KeylessJsonSchemaCodec, LogLevel, LoggerInterface, MaybePromise, MemoizeOptions, Middleware, MiddlewareMetadata, ModeOptions, Module, ModulePrimitiveOptions, NumberOptions, OPTIONS, Page, PageMetadata, PageQuery, PageRequest, PipelineHandler, PipelineOptions, PipelinePrimitive, PipelinePrimitiveFn, PipelinePrimitiveOptions, Primitive, PrimitiveArgs, PrimitiveConfig, PrimitiveFactoryLike, RunFunction, SchemaCodec, SchemaOptions, SchemaOutput, SchemaValidator, Service, ServiceEntry, ServiceSubstitution, SetStateOptions, SortDirection, SortField, State, StateManager, StateScope, Static, StaticDecode, StaticEncode, StreamLike, StringOptions, TAny, TArray, TArrayOptions, TAtomObject, TBigInt, TBoolean, TEnumOptions, TFile, TInteger, TInterface, TKeysToIndexer, TNull, TNumber, TNumberOptions, TObject, TObjectOptions, TOmit, TOptional, TOptionalAdd, TPage, TPartial, TPick, TProperties, TRecord, TSchema, TSchemaOptions, TStream, TString, TStringOptions, TTextOptions, TTuple, TUnion, TUnsafe, TVoid, TextLength, TextOptions, TooLateSubstitutionError, Type, TypeBoxError, TypeBoxErrorParams, TypeProvider, ValidateOptions, ValidationErrorLike, WithModule, Z, ZObject, ZType, Z_LIMITS, __alephaRef, coerceObject, coerceScalar, createMiddleware, createPagination, createPrimitive, isClass, isFileLike, isTypeFile, jsonSchemaToZod, pageMetadataSchema, pageQuerySchema, pageSchema, run, z };
|
|
2653
2913
|
//# sourceMappingURL=index.d.ts.map
|