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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import { Alepha } from "../Alepha.ts";
|
|
3
|
-
import { TypeProvider,
|
|
3
|
+
import { TypeProvider, z } from "../providers/TypeProvider.ts";
|
|
4
4
|
|
|
5
5
|
describe("TypeProvider", () => {
|
|
6
6
|
describe("Primitive Types", () => {
|
|
@@ -8,7 +8,7 @@ describe("TypeProvider", () => {
|
|
|
8
8
|
it("should decode valid strings", async () => {
|
|
9
9
|
const alepha = Alepha.create();
|
|
10
10
|
await alepha.start();
|
|
11
|
-
const schema =
|
|
11
|
+
const schema = z.string();
|
|
12
12
|
|
|
13
13
|
expect(alepha.codec.decode(schema, "hello")).toBe("hello");
|
|
14
14
|
expect(alepha.codec.decode(schema, "")).toBe("");
|
|
@@ -18,19 +18,19 @@ describe("TypeProvider", () => {
|
|
|
18
18
|
it("should encode strings", async () => {
|
|
19
19
|
const alepha = Alepha.create();
|
|
20
20
|
await alepha.start();
|
|
21
|
-
const schema =
|
|
21
|
+
const schema = z.string();
|
|
22
22
|
|
|
23
23
|
expect(alepha.codec.encode(schema, "test")).toBe("test");
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
it("should
|
|
26
|
+
it("should reject non-strings (no coercion)", async () => {
|
|
27
27
|
const alepha = Alepha.create();
|
|
28
28
|
await alepha.start();
|
|
29
|
-
const schema =
|
|
29
|
+
const schema = z.string();
|
|
30
30
|
|
|
31
|
-
//
|
|
32
|
-
expect(alepha.codec.validate(schema, 123)).
|
|
33
|
-
expect(alepha.codec.validate(schema, true)).
|
|
31
|
+
// Strict zod: no value coercion — non-strings are rejected.
|
|
32
|
+
expect(() => alepha.codec.validate(schema, 123)).toThrow();
|
|
33
|
+
expect(() => alepha.codec.validate(schema, true)).toThrow();
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
36
|
|
|
@@ -38,7 +38,7 @@ describe("TypeProvider", () => {
|
|
|
38
38
|
it("should decode valid numbers", async () => {
|
|
39
39
|
const alepha = Alepha.create();
|
|
40
40
|
await alepha.start();
|
|
41
|
-
const schema =
|
|
41
|
+
const schema = z.number();
|
|
42
42
|
|
|
43
43
|
expect(alepha.codec.decode(schema, 123)).toBe(123);
|
|
44
44
|
expect(alepha.codec.decode(schema, 0)).toBe(0);
|
|
@@ -49,26 +49,26 @@ describe("TypeProvider", () => {
|
|
|
49
49
|
it("should encode numbers", async () => {
|
|
50
50
|
const alepha = Alepha.create();
|
|
51
51
|
await alepha.start();
|
|
52
|
-
const schema =
|
|
52
|
+
const schema = z.number();
|
|
53
53
|
|
|
54
54
|
expect(alepha.codec.encode(schema, 42)).toBe(42);
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
-
it("should
|
|
57
|
+
it("should reject non-numbers (no coercion)", async () => {
|
|
58
58
|
const alepha = Alepha.create();
|
|
59
59
|
await alepha.start();
|
|
60
|
-
const schema =
|
|
60
|
+
const schema = z.number();
|
|
61
61
|
|
|
62
|
-
//
|
|
63
|
-
expect(alepha.codec.validate(schema, "123")).
|
|
64
|
-
expect(alepha.codec.validate(schema, true)).
|
|
65
|
-
expect(alepha.codec.validate(schema, false)).
|
|
62
|
+
// Strict zod: no value coercion — strings/booleans are rejected.
|
|
63
|
+
expect(() => alepha.codec.validate(schema, "123")).toThrow();
|
|
64
|
+
expect(() => alepha.codec.validate(schema, true)).toThrow();
|
|
65
|
+
expect(() => alepha.codec.validate(schema, false)).toThrow();
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
it("should validate constraints", async () => {
|
|
69
69
|
const alepha = Alepha.create();
|
|
70
70
|
await alepha.start();
|
|
71
|
-
const schema =
|
|
71
|
+
const schema = z.number().min(0).max(100);
|
|
72
72
|
|
|
73
73
|
expect(alepha.codec.validate(schema, 0)).toBe(0);
|
|
74
74
|
expect(alepha.codec.validate(schema, 50)).toBe(50);
|
|
@@ -83,7 +83,7 @@ describe("TypeProvider", () => {
|
|
|
83
83
|
it("should decode valid booleans", async () => {
|
|
84
84
|
const alepha = Alepha.create();
|
|
85
85
|
await alepha.start();
|
|
86
|
-
const schema =
|
|
86
|
+
const schema = z.boolean();
|
|
87
87
|
|
|
88
88
|
expect(alepha.codec.decode(schema, true)).toBe(true);
|
|
89
89
|
expect(alepha.codec.decode(schema, false)).toBe(false);
|
|
@@ -92,22 +92,22 @@ describe("TypeProvider", () => {
|
|
|
92
92
|
it("should encode booleans", async () => {
|
|
93
93
|
const alepha = Alepha.create();
|
|
94
94
|
await alepha.start();
|
|
95
|
-
const schema =
|
|
95
|
+
const schema = z.boolean();
|
|
96
96
|
|
|
97
97
|
expect(alepha.codec.encode(schema, true)).toBe(true);
|
|
98
98
|
expect(alepha.codec.encode(schema, false)).toBe(false);
|
|
99
99
|
});
|
|
100
100
|
|
|
101
|
-
it("should
|
|
101
|
+
it("should reject non-booleans (no coercion)", async () => {
|
|
102
102
|
const alepha = Alepha.create();
|
|
103
103
|
await alepha.start();
|
|
104
|
-
const schema =
|
|
104
|
+
const schema = z.boolean();
|
|
105
105
|
|
|
106
|
-
//
|
|
107
|
-
expect(alepha.codec.validate(schema, "true")).
|
|
108
|
-
expect(alepha.codec.validate(schema, "false")).
|
|
109
|
-
expect(alepha.codec.validate(schema, 1)).
|
|
110
|
-
expect(alepha.codec.validate(schema, 0)).
|
|
106
|
+
// Strict zod: no value coercion — strings/numbers are rejected.
|
|
107
|
+
expect(() => alepha.codec.validate(schema, "true")).toThrow();
|
|
108
|
+
expect(() => alepha.codec.validate(schema, "false")).toThrow();
|
|
109
|
+
expect(() => alepha.codec.validate(schema, 1)).toThrow();
|
|
110
|
+
expect(() => alepha.codec.validate(schema, 0)).toThrow();
|
|
111
111
|
});
|
|
112
112
|
});
|
|
113
113
|
|
|
@@ -115,7 +115,7 @@ describe("TypeProvider", () => {
|
|
|
115
115
|
it("should decode null", async () => {
|
|
116
116
|
const alepha = Alepha.create();
|
|
117
117
|
await alepha.start();
|
|
118
|
-
const schema =
|
|
118
|
+
const schema = z.null();
|
|
119
119
|
|
|
120
120
|
expect(alepha.codec.decode(schema, null)).toBe(null);
|
|
121
121
|
});
|
|
@@ -125,7 +125,7 @@ describe("TypeProvider", () => {
|
|
|
125
125
|
it("should decode undefined", async () => {
|
|
126
126
|
const alepha = Alepha.create();
|
|
127
127
|
await alepha.start();
|
|
128
|
-
const schema =
|
|
128
|
+
const schema = z.undefined();
|
|
129
129
|
|
|
130
130
|
expect(alepha.codec.decode(schema, undefined)).toBe(undefined);
|
|
131
131
|
});
|
|
@@ -135,7 +135,7 @@ describe("TypeProvider", () => {
|
|
|
135
135
|
it("should decode void as undefined", async () => {
|
|
136
136
|
const alepha = Alepha.create();
|
|
137
137
|
await alepha.start();
|
|
138
|
-
const schema =
|
|
138
|
+
const schema = z.void();
|
|
139
139
|
|
|
140
140
|
expect(alepha.codec.decode(schema, undefined)).toBe(undefined);
|
|
141
141
|
});
|
|
@@ -145,12 +145,13 @@ describe("TypeProvider", () => {
|
|
|
145
145
|
it("should accept any value", async () => {
|
|
146
146
|
const alepha = Alepha.create();
|
|
147
147
|
await alepha.start();
|
|
148
|
-
const schema =
|
|
148
|
+
const schema = z.any();
|
|
149
149
|
|
|
150
150
|
expect(alepha.codec.decode(schema, "string")).toBe("string");
|
|
151
151
|
expect(alepha.codec.decode(schema, 123)).toBe(123);
|
|
152
152
|
expect(alepha.codec.decode(schema, true)).toBe(true);
|
|
153
|
-
|
|
153
|
+
// Strict zod: no null->undefined normalization — null stays null.
|
|
154
|
+
expect(alepha.codec.decode(schema, null)).toBe(null);
|
|
154
155
|
expect(alepha.codec.decode(schema, undefined)).toBe(undefined);
|
|
155
156
|
expect(alepha.codec.decode(schema, { key: "value" })).toEqual({
|
|
156
157
|
key: "value",
|
|
@@ -165,7 +166,7 @@ describe("TypeProvider", () => {
|
|
|
165
166
|
it("should accept text within 255 chars", async () => {
|
|
166
167
|
const alepha = Alepha.create();
|
|
167
168
|
await alepha.start();
|
|
168
|
-
const schema =
|
|
169
|
+
const schema = z.text();
|
|
169
170
|
|
|
170
171
|
const validText = "a".repeat(255);
|
|
171
172
|
expect(alepha.codec.decode(schema, validText)).toBe(validText);
|
|
@@ -174,7 +175,7 @@ describe("TypeProvider", () => {
|
|
|
174
175
|
it("should trim whitespace by default", async () => {
|
|
175
176
|
const alepha = Alepha.create();
|
|
176
177
|
await alepha.start();
|
|
177
|
-
const schema =
|
|
178
|
+
const schema = z.text();
|
|
178
179
|
|
|
179
180
|
expect(alepha.codec.decode(schema, " hello ")).toBe("hello");
|
|
180
181
|
});
|
|
@@ -182,7 +183,7 @@ describe("TypeProvider", () => {
|
|
|
182
183
|
it("should reject text over 255 chars", async () => {
|
|
183
184
|
const alepha = Alepha.create();
|
|
184
185
|
await alepha.start();
|
|
185
|
-
const schema =
|
|
186
|
+
const schema = z.text();
|
|
186
187
|
|
|
187
188
|
const tooLong = "a".repeat(256);
|
|
188
189
|
expect(() => alepha.codec.validate(schema, tooLong)).toThrow();
|
|
@@ -191,7 +192,7 @@ describe("TypeProvider", () => {
|
|
|
191
192
|
it("should encode text", async () => {
|
|
192
193
|
const alepha = Alepha.create();
|
|
193
194
|
await alepha.start();
|
|
194
|
-
const schema =
|
|
195
|
+
const schema = z.text();
|
|
195
196
|
|
|
196
197
|
expect(alepha.codec.encode(schema, "test")).toBe("test");
|
|
197
198
|
});
|
|
@@ -201,7 +202,7 @@ describe("TypeProvider", () => {
|
|
|
201
202
|
it("should validate short text (64 chars max)", async () => {
|
|
202
203
|
const alepha = Alepha.create();
|
|
203
204
|
await alepha.start();
|
|
204
|
-
const shortSchema =
|
|
205
|
+
const shortSchema = z.text({ size: "short" });
|
|
205
206
|
|
|
206
207
|
expect(alepha.codec.validate(shortSchema, "a".repeat(64))).toBe(
|
|
207
208
|
"a".repeat(64),
|
|
@@ -214,7 +215,7 @@ describe("TypeProvider", () => {
|
|
|
214
215
|
it("should validate regular text (255 chars max)", async () => {
|
|
215
216
|
const alepha = Alepha.create();
|
|
216
217
|
await alepha.start();
|
|
217
|
-
const regularSchema =
|
|
218
|
+
const regularSchema = z.text({ size: "regular" });
|
|
218
219
|
|
|
219
220
|
expect(alepha.codec.validate(regularSchema, "a".repeat(255))).toBe(
|
|
220
221
|
"a".repeat(255),
|
|
@@ -227,7 +228,7 @@ describe("TypeProvider", () => {
|
|
|
227
228
|
it("should validate long text (1024 chars max)", async () => {
|
|
228
229
|
const alepha = Alepha.create();
|
|
229
230
|
await alepha.start();
|
|
230
|
-
const longSchema =
|
|
231
|
+
const longSchema = z.text({ size: "long" });
|
|
231
232
|
|
|
232
233
|
expect(alepha.codec.validate(longSchema, "a".repeat(1024))).toBe(
|
|
233
234
|
"a".repeat(1024),
|
|
@@ -240,7 +241,7 @@ describe("TypeProvider", () => {
|
|
|
240
241
|
it("should validate rich text (65535 chars max)", async () => {
|
|
241
242
|
const alepha = Alepha.create();
|
|
242
243
|
await alepha.start();
|
|
243
|
-
const richSchema =
|
|
244
|
+
const richSchema = z.text({ size: "rich" });
|
|
244
245
|
|
|
245
246
|
expect(alepha.codec.validate(richSchema, "a".repeat(1000))).toBe(
|
|
246
247
|
"a".repeat(1000),
|
|
@@ -258,7 +259,7 @@ describe("TypeProvider", () => {
|
|
|
258
259
|
it("should validate shortText (64 chars)", async () => {
|
|
259
260
|
const alepha = Alepha.create();
|
|
260
261
|
await alepha.start();
|
|
261
|
-
const shortSchema =
|
|
262
|
+
const shortSchema = z.shortText();
|
|
262
263
|
|
|
263
264
|
expect(alepha.codec.validate(shortSchema, "a".repeat(64))).toBe(
|
|
264
265
|
"a".repeat(64),
|
|
@@ -271,7 +272,7 @@ describe("TypeProvider", () => {
|
|
|
271
272
|
it("should validate longText (1024 chars)", async () => {
|
|
272
273
|
const alepha = Alepha.create();
|
|
273
274
|
await alepha.start();
|
|
274
|
-
const longSchema =
|
|
275
|
+
const longSchema = z.longText();
|
|
275
276
|
|
|
276
277
|
expect(alepha.codec.validate(longSchema, "a".repeat(1024))).toBe(
|
|
277
278
|
"a".repeat(1024),
|
|
@@ -284,7 +285,7 @@ describe("TypeProvider", () => {
|
|
|
284
285
|
it("should validate richText (65535 chars)", async () => {
|
|
285
286
|
const alepha = Alepha.create();
|
|
286
287
|
await alepha.start();
|
|
287
|
-
const richSchema =
|
|
288
|
+
const richSchema = z.richText();
|
|
288
289
|
|
|
289
290
|
expect(alepha.codec.decode(richSchema, "a".repeat(1000))).toBe(
|
|
290
291
|
"a".repeat(1000),
|
|
@@ -296,7 +297,7 @@ describe("TypeProvider", () => {
|
|
|
296
297
|
it("should trim when enabled", async () => {
|
|
297
298
|
const alepha = Alepha.create();
|
|
298
299
|
await alepha.start();
|
|
299
|
-
const trimSchema =
|
|
300
|
+
const trimSchema = z.text({ trim: true });
|
|
300
301
|
|
|
301
302
|
expect(alepha.codec.decode(trimSchema, " hello ")).toBe("hello");
|
|
302
303
|
expect(alepha.codec.decode(trimSchema, "\n\ttest\n\t")).toBe("test");
|
|
@@ -305,7 +306,7 @@ describe("TypeProvider", () => {
|
|
|
305
306
|
it("should not trim when disabled", async () => {
|
|
306
307
|
const alepha = Alepha.create();
|
|
307
308
|
await alepha.start();
|
|
308
|
-
const noTrimSchema =
|
|
309
|
+
const noTrimSchema = z.text({ trim: false });
|
|
309
310
|
|
|
310
311
|
expect(alepha.codec.decode(noTrimSchema, " hello ")).toBe(
|
|
311
312
|
" hello ",
|
|
@@ -314,10 +315,10 @@ describe("TypeProvider", () => {
|
|
|
314
315
|
});
|
|
315
316
|
|
|
316
317
|
describe("text lowercase option", () => {
|
|
317
|
-
it("should lowercase with
|
|
318
|
+
it("should lowercase with z.text when enabled", async () => {
|
|
318
319
|
const alepha = Alepha.create();
|
|
319
320
|
await alepha.start();
|
|
320
|
-
const schema =
|
|
321
|
+
const schema = z.text({ lowercase: true });
|
|
321
322
|
|
|
322
323
|
expect(alepha.codec.decode(schema, "HELLO")).toBe("hello");
|
|
323
324
|
expect(alepha.codec.decode(schema, "Hello World")).toBe("hello world");
|
|
@@ -326,22 +327,24 @@ describe("TypeProvider", () => {
|
|
|
326
327
|
);
|
|
327
328
|
});
|
|
328
329
|
|
|
329
|
-
it("should lowercase
|
|
330
|
+
it("should not lowercase enum values (no coercion)", async () => {
|
|
330
331
|
const alepha = Alepha.create();
|
|
331
332
|
await alepha.start();
|
|
332
|
-
const schema =
|
|
333
|
-
|
|
334
|
-
|
|
333
|
+
const schema = z
|
|
334
|
+
.enum(["active", "inactive", "pending"])
|
|
335
|
+
.meta({ lowercase: true });
|
|
335
336
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
expect(alepha.codec.
|
|
337
|
+
// Strict zod: enum membership is exact — uppercase input is rejected,
|
|
338
|
+
// not lowercased into a matching member.
|
|
339
|
+
expect(alepha.codec.decode(schema, "active")).toBe("active");
|
|
340
|
+
expect(() => alepha.codec.validate(schema, "ACTIVE")).toThrow();
|
|
341
|
+
expect(() => alepha.codec.validate(schema, "INACTIVE")).toThrow();
|
|
339
342
|
});
|
|
340
343
|
|
|
341
|
-
it("should combine trim and lowercase with
|
|
344
|
+
it("should combine trim and lowercase with z.text", async () => {
|
|
342
345
|
const alepha = Alepha.create();
|
|
343
346
|
await alepha.start();
|
|
344
|
-
const schema =
|
|
347
|
+
const schema = z.text({ trim: true, lowercase: true });
|
|
345
348
|
|
|
346
349
|
expect(alepha.codec.decode(schema, " HELLO ")).toBe("hello");
|
|
347
350
|
expect(alepha.codec.decode(schema, "\n\tTEST\n\t")).toBe("test");
|
|
@@ -350,7 +353,7 @@ describe("TypeProvider", () => {
|
|
|
350
353
|
it("should not lowercase when not enabled", async () => {
|
|
351
354
|
const alepha = Alepha.create();
|
|
352
355
|
await alepha.start();
|
|
353
|
-
const schema =
|
|
356
|
+
const schema = z.text();
|
|
354
357
|
|
|
355
358
|
expect(alepha.codec.decode(schema, "HELLO")).toBe("HELLO");
|
|
356
359
|
expect(alepha.codec.decode(schema, "MixedCase")).toBe("MixedCase");
|
|
@@ -361,7 +364,7 @@ describe("TypeProvider", () => {
|
|
|
361
364
|
it("should accept values matching the pattern", async () => {
|
|
362
365
|
const alepha = Alepha.create();
|
|
363
366
|
await alepha.start();
|
|
364
|
-
const schema =
|
|
367
|
+
const schema = z.text({ pattern: "^[A-Z]{3}$" });
|
|
365
368
|
|
|
366
369
|
expect(alepha.codec.decode(schema, "ABC")).toBe("ABC");
|
|
367
370
|
expect(alepha.codec.decode(schema, "XYZ")).toBe("XYZ");
|
|
@@ -370,7 +373,7 @@ describe("TypeProvider", () => {
|
|
|
370
373
|
it("should reject values not matching the pattern", async () => {
|
|
371
374
|
const alepha = Alepha.create();
|
|
372
375
|
await alepha.start();
|
|
373
|
-
const schema =
|
|
376
|
+
const schema = z.text({ pattern: "^[A-Z]{3}$" });
|
|
374
377
|
|
|
375
378
|
expect(() => alepha.codec.validate(schema, "abc")).toThrow();
|
|
376
379
|
expect(() => alepha.codec.validate(schema, "ABCD")).toThrow();
|
|
@@ -381,7 +384,7 @@ describe("TypeProvider", () => {
|
|
|
381
384
|
it("should work with alphanumeric pattern", async () => {
|
|
382
385
|
const alepha = Alepha.create();
|
|
383
386
|
await alepha.start();
|
|
384
|
-
const schema =
|
|
387
|
+
const schema = z.text({ pattern: "^[a-zA-Z0-9]+$" });
|
|
385
388
|
|
|
386
389
|
expect(alepha.codec.decode(schema, "Hello123")).toBe("Hello123");
|
|
387
390
|
expect(alepha.codec.decode(schema, "test")).toBe("test");
|
|
@@ -394,7 +397,7 @@ describe("TypeProvider", () => {
|
|
|
394
397
|
it("should work with slug pattern", async () => {
|
|
395
398
|
const alepha = Alepha.create();
|
|
396
399
|
await alepha.start();
|
|
397
|
-
const schema =
|
|
400
|
+
const schema = z.text({ pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$" });
|
|
398
401
|
|
|
399
402
|
expect(alepha.codec.decode(schema, "hello-world")).toBe("hello-world");
|
|
400
403
|
expect(alepha.codec.decode(schema, "my-blog-post")).toBe(
|
|
@@ -410,7 +413,7 @@ describe("TypeProvider", () => {
|
|
|
410
413
|
it("should combine pattern with maxLength", async () => {
|
|
411
414
|
const alepha = Alepha.create();
|
|
412
415
|
await alepha.start();
|
|
413
|
-
const schema =
|
|
416
|
+
const schema = z.text({ pattern: "^[A-Z]+$", maxLength: 5 });
|
|
414
417
|
|
|
415
418
|
expect(alepha.codec.decode(schema, "HELLO")).toBe("HELLO");
|
|
416
419
|
expect(alepha.codec.decode(schema, "AB")).toBe("AB");
|
|
@@ -422,7 +425,7 @@ describe("TypeProvider", () => {
|
|
|
422
425
|
it("should trim before pattern validation", async () => {
|
|
423
426
|
const alepha = Alepha.create();
|
|
424
427
|
await alepha.start();
|
|
425
|
-
const schema =
|
|
428
|
+
const schema = z.text({ pattern: "^[A-Z]+$", trim: true });
|
|
426
429
|
|
|
427
430
|
expect(alepha.codec.decode(schema, " HELLO ")).toBe("HELLO");
|
|
428
431
|
});
|
|
@@ -434,7 +437,7 @@ describe("TypeProvider", () => {
|
|
|
434
437
|
it("should decode valid 32-bit integers", async () => {
|
|
435
438
|
const alepha = Alepha.create();
|
|
436
439
|
await alepha.start();
|
|
437
|
-
const schema =
|
|
440
|
+
const schema = z.integer();
|
|
438
441
|
|
|
439
442
|
expect(alepha.codec.decode(schema, 0)).toBe(0);
|
|
440
443
|
expect(alepha.codec.decode(schema, 123456)).toBe(123456);
|
|
@@ -446,15 +449,16 @@ describe("TypeProvider", () => {
|
|
|
446
449
|
it("should reject non-integers", async () => {
|
|
447
450
|
const alepha = Alepha.create();
|
|
448
451
|
await alepha.start();
|
|
449
|
-
const schema =
|
|
452
|
+
const schema = z.integer();
|
|
450
453
|
|
|
451
|
-
|
|
454
|
+
// Strict zod: no truncation — a float is rejected, not floored.
|
|
455
|
+
expect(() => alepha.codec.decode(schema, 3.14)).toThrow();
|
|
452
456
|
});
|
|
453
457
|
|
|
454
458
|
it("should reject values outside 32-bit range", async () => {
|
|
455
459
|
const alepha = Alepha.create();
|
|
456
460
|
await alepha.start();
|
|
457
|
-
const schema =
|
|
461
|
+
const schema = z.int32();
|
|
458
462
|
|
|
459
463
|
expect(() => alepha.codec.validate(schema, 2147483648)).toThrow();
|
|
460
464
|
expect(() => alepha.codec.validate(schema, -2147483649)).toThrow();
|
|
@@ -465,10 +469,11 @@ describe("TypeProvider", () => {
|
|
|
465
469
|
it("should work as alias for int", async () => {
|
|
466
470
|
const alepha = Alepha.create();
|
|
467
471
|
await alepha.start();
|
|
468
|
-
const schema =
|
|
472
|
+
const schema = z.int32();
|
|
469
473
|
|
|
470
474
|
expect(alepha.codec.decode(schema, 42)).toBe(42);
|
|
471
|
-
|
|
475
|
+
// Strict zod: no truncation — a float is rejected.
|
|
476
|
+
expect(() => alepha.codec.decode(schema, 3.14)).toThrow();
|
|
472
477
|
});
|
|
473
478
|
});
|
|
474
479
|
|
|
@@ -476,7 +481,7 @@ describe("TypeProvider", () => {
|
|
|
476
481
|
it("should decode valid safe integers", async () => {
|
|
477
482
|
const alepha = Alepha.create();
|
|
478
483
|
await alepha.start();
|
|
479
|
-
const schema =
|
|
484
|
+
const schema = z.int64();
|
|
480
485
|
|
|
481
486
|
expect(alepha.codec.decode(schema, 0)).toBe(0);
|
|
482
487
|
expect(alepha.codec.decode(schema, 9007199254740991)).toBe(
|
|
@@ -490,7 +495,7 @@ describe("TypeProvider", () => {
|
|
|
490
495
|
it("should reject non-integers", async () => {
|
|
491
496
|
const alepha = Alepha.create();
|
|
492
497
|
await alepha.start();
|
|
493
|
-
const schema =
|
|
498
|
+
const schema = z.int64();
|
|
494
499
|
|
|
495
500
|
expect(() => alepha.codec.validate(schema, 3.14)).toThrow();
|
|
496
501
|
});
|
|
@@ -498,7 +503,7 @@ describe("TypeProvider", () => {
|
|
|
498
503
|
it("should reject values outside safe integer range", async () => {
|
|
499
504
|
const alepha = Alepha.create();
|
|
500
505
|
await alepha.start();
|
|
501
|
-
const schema =
|
|
506
|
+
const schema = z.int64();
|
|
502
507
|
|
|
503
508
|
expect(() => alepha.codec.validate(schema, 9007199254740992)).toThrow();
|
|
504
509
|
expect(() =>
|
|
@@ -508,14 +513,14 @@ describe("TypeProvider", () => {
|
|
|
508
513
|
});
|
|
509
514
|
});
|
|
510
515
|
|
|
511
|
-
// Codec Types tests removed -
|
|
516
|
+
// Codec Types tests removed - z.bigint(), z.url(), z.binary() are now plain strings without transformation
|
|
512
517
|
|
|
513
518
|
describe("Format Types", () => {
|
|
514
519
|
describe("uuid", () => {
|
|
515
520
|
it("should accept valid UUIDs", async () => {
|
|
516
521
|
const alepha = Alepha.create();
|
|
517
522
|
await alepha.start();
|
|
518
|
-
const schema =
|
|
523
|
+
const schema = z.uuid();
|
|
519
524
|
|
|
520
525
|
const validUuid = "550e8400-e29b-41d4-a716-446655440000";
|
|
521
526
|
expect(alepha.codec.decode(schema, validUuid)).toBe(validUuid);
|
|
@@ -524,7 +529,7 @@ describe("TypeProvider", () => {
|
|
|
524
529
|
it("should encode UUIDs", async () => {
|
|
525
530
|
const alepha = Alepha.create();
|
|
526
531
|
await alepha.start();
|
|
527
|
-
const schema =
|
|
532
|
+
const schema = z.uuid();
|
|
528
533
|
|
|
529
534
|
const validUuid = "550e8400-e29b-41d4-a716-446655440000";
|
|
530
535
|
expect(alepha.codec.encode(schema, validUuid)).toBe(validUuid);
|
|
@@ -533,7 +538,7 @@ describe("TypeProvider", () => {
|
|
|
533
538
|
it("should reject invalid UUIDs", async () => {
|
|
534
539
|
const alepha = Alepha.create();
|
|
535
540
|
await alepha.start();
|
|
536
|
-
const schema =
|
|
541
|
+
const schema = z.uuid();
|
|
537
542
|
|
|
538
543
|
expect(() => alepha.codec.validate(schema, "not-a-uuid")).toThrow();
|
|
539
544
|
expect(() =>
|
|
@@ -547,7 +552,7 @@ describe("TypeProvider", () => {
|
|
|
547
552
|
it("should accept valid emails", async () => {
|
|
548
553
|
const alepha = Alepha.create();
|
|
549
554
|
await alepha.start();
|
|
550
|
-
const schema =
|
|
555
|
+
const schema = z.email();
|
|
551
556
|
|
|
552
557
|
expect(alepha.codec.decode(schema, "user@example.com")).toBe(
|
|
553
558
|
"user@example.com",
|
|
@@ -557,43 +562,45 @@ describe("TypeProvider", () => {
|
|
|
557
562
|
).toBe("test.user+tag@subdomain.example.co.uk");
|
|
558
563
|
});
|
|
559
564
|
|
|
560
|
-
it("should trim emails", async () => {
|
|
565
|
+
it("should not trim emails (whitespace rejected)", async () => {
|
|
561
566
|
const alepha = Alepha.create();
|
|
562
567
|
await alepha.start();
|
|
563
|
-
const schema =
|
|
568
|
+
const schema = z.email();
|
|
564
569
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
570
|
+
// Strict zod: no auto-trim — surrounding whitespace makes it invalid.
|
|
571
|
+
expect(() =>
|
|
572
|
+
alepha.codec.validate(schema, " user@example.com "),
|
|
573
|
+
).toThrow();
|
|
568
574
|
});
|
|
569
575
|
|
|
570
|
-
it("should lowercase emails", async () => {
|
|
576
|
+
it("should not lowercase emails", async () => {
|
|
571
577
|
const alepha = Alepha.create();
|
|
572
578
|
await alepha.start();
|
|
573
|
-
const schema =
|
|
579
|
+
const schema = z.email();
|
|
574
580
|
|
|
581
|
+
// Strict zod: no auto-lowercase — case is preserved as-is.
|
|
575
582
|
expect(alepha.codec.decode(schema, "User@Example.COM")).toBe(
|
|
576
|
-
"
|
|
583
|
+
"User@Example.COM",
|
|
577
584
|
);
|
|
578
585
|
expect(alepha.codec.decode(schema, "JOHN.DOE@GMAIL.COM")).toBe(
|
|
579
|
-
"
|
|
586
|
+
"JOHN.DOE@GMAIL.COM",
|
|
580
587
|
);
|
|
581
588
|
});
|
|
582
589
|
|
|
583
|
-
it("should trim
|
|
590
|
+
it("should not trim or lowercase emails (whitespace rejected)", async () => {
|
|
584
591
|
const alepha = Alepha.create();
|
|
585
592
|
await alepha.start();
|
|
586
|
-
const schema =
|
|
593
|
+
const schema = z.email();
|
|
587
594
|
|
|
588
|
-
expect(
|
|
589
|
-
"
|
|
590
|
-
);
|
|
595
|
+
expect(() =>
|
|
596
|
+
alepha.codec.validate(schema, " User@Example.COM "),
|
|
597
|
+
).toThrow();
|
|
591
598
|
});
|
|
592
599
|
|
|
593
600
|
it("should reject invalid emails", async () => {
|
|
594
601
|
const alepha = Alepha.create();
|
|
595
602
|
await alepha.start();
|
|
596
|
-
const schema =
|
|
603
|
+
const schema = z.email();
|
|
597
604
|
|
|
598
605
|
expect(() => alepha.codec.validate(schema, "not an email")).toThrow();
|
|
599
606
|
expect(() => alepha.codec.validate(schema, "@example.com")).toThrow();
|
|
@@ -606,7 +613,7 @@ describe("TypeProvider", () => {
|
|
|
606
613
|
it("should accept valid E.164 phone numbers", async () => {
|
|
607
614
|
const alepha = Alepha.create();
|
|
608
615
|
await alepha.start();
|
|
609
|
-
const schema =
|
|
616
|
+
const schema = z.e164();
|
|
610
617
|
|
|
611
618
|
expect(alepha.codec.decode(schema, "+1234567890")).toBe("+1234567890");
|
|
612
619
|
expect(alepha.codec.decode(schema, "+12025551234")).toBe(
|
|
@@ -620,7 +627,7 @@ describe("TypeProvider", () => {
|
|
|
620
627
|
it("should reject invalid E.164 phone numbers", async () => {
|
|
621
628
|
const alepha = Alepha.create();
|
|
622
629
|
await alepha.start();
|
|
623
|
-
const schema =
|
|
630
|
+
const schema = z.e164();
|
|
624
631
|
|
|
625
632
|
expect(() => alepha.codec.validate(schema, "1234567890")).toThrow(); // Missing +
|
|
626
633
|
expect(() => alepha.codec.validate(schema, "+0123456789")).toThrow(); // Starts with 0
|
|
@@ -636,7 +643,7 @@ describe("TypeProvider", () => {
|
|
|
636
643
|
it("should accept valid BCP 47 language tags", async () => {
|
|
637
644
|
const alepha = Alepha.create();
|
|
638
645
|
await alepha.start();
|
|
639
|
-
const schema =
|
|
646
|
+
const schema = z.bcp47();
|
|
640
647
|
|
|
641
648
|
expect(alepha.codec.decode(schema, "en")).toBe("en");
|
|
642
649
|
expect(alepha.codec.decode(schema, "en-US")).toBe("en-US");
|
|
@@ -648,7 +655,7 @@ describe("TypeProvider", () => {
|
|
|
648
655
|
it("should reject invalid BCP 47 tags", async () => {
|
|
649
656
|
const alepha = Alepha.create();
|
|
650
657
|
await alepha.start();
|
|
651
|
-
const schema =
|
|
658
|
+
const schema = z.bcp47();
|
|
652
659
|
|
|
653
660
|
expect(() => alepha.codec.validate(schema, "EN")).toThrow(); // Uppercase language
|
|
654
661
|
expect(() => alepha.codec.validate(schema, "en-us")).toThrow(); // Lowercase region
|
|
@@ -662,7 +669,7 @@ describe("TypeProvider", () => {
|
|
|
662
669
|
it("should accept valid constantCase strings", async () => {
|
|
663
670
|
const alepha = Alepha.create();
|
|
664
671
|
await alepha.start();
|
|
665
|
-
const schema =
|
|
672
|
+
const schema = z.constantCase();
|
|
666
673
|
|
|
667
674
|
expect(alepha.codec.decode(schema, "HELLO")).toBe("HELLO");
|
|
668
675
|
expect(alepha.codec.decode(schema, "HELLO_WORLD")).toBe("HELLO_WORLD");
|
|
@@ -673,7 +680,7 @@ describe("TypeProvider", () => {
|
|
|
673
680
|
it("should reject invalid constantCase", async () => {
|
|
674
681
|
const alepha = Alepha.create();
|
|
675
682
|
await alepha.start();
|
|
676
|
-
const schema =
|
|
683
|
+
const schema = z.constantCase();
|
|
677
684
|
|
|
678
685
|
expect(() => alepha.codec.validate(schema, "hello")).toThrow(); // Lowercase
|
|
679
686
|
expect(() => alepha.codec.validate(schema, "Hello_World")).toThrow(); // Mixed case
|
|
@@ -688,10 +695,10 @@ describe("TypeProvider", () => {
|
|
|
688
695
|
it("should decode valid objects", async () => {
|
|
689
696
|
const alepha = Alepha.create();
|
|
690
697
|
await alepha.start();
|
|
691
|
-
const schema =
|
|
692
|
-
name:
|
|
693
|
-
age:
|
|
694
|
-
active:
|
|
698
|
+
const schema = z.object({
|
|
699
|
+
name: z.text(),
|
|
700
|
+
age: z.integer(),
|
|
701
|
+
active: z.boolean(),
|
|
695
702
|
});
|
|
696
703
|
|
|
697
704
|
const valid = { name: "John", age: 30, active: true };
|
|
@@ -702,10 +709,10 @@ describe("TypeProvider", () => {
|
|
|
702
709
|
it("should encode objects", async () => {
|
|
703
710
|
const alepha = Alepha.create();
|
|
704
711
|
await alepha.start();
|
|
705
|
-
const schema =
|
|
706
|
-
name:
|
|
707
|
-
age:
|
|
708
|
-
active:
|
|
712
|
+
const schema = z.object({
|
|
713
|
+
name: z.text(),
|
|
714
|
+
age: z.integer(),
|
|
715
|
+
active: z.boolean(),
|
|
709
716
|
});
|
|
710
717
|
|
|
711
718
|
const valid = { name: "John", age: 30, active: true };
|
|
@@ -716,10 +723,10 @@ describe("TypeProvider", () => {
|
|
|
716
723
|
it("should reject missing required fields", async () => {
|
|
717
724
|
const alepha = Alepha.create();
|
|
718
725
|
await alepha.start();
|
|
719
|
-
const schema =
|
|
720
|
-
name:
|
|
721
|
-
age:
|
|
722
|
-
active:
|
|
726
|
+
const schema = z.object({
|
|
727
|
+
name: z.text(),
|
|
728
|
+
age: z.integer(),
|
|
729
|
+
active: z.boolean(),
|
|
723
730
|
});
|
|
724
731
|
|
|
725
732
|
expect(() =>
|
|
@@ -727,35 +734,32 @@ describe("TypeProvider", () => {
|
|
|
727
734
|
).toThrow();
|
|
728
735
|
});
|
|
729
736
|
|
|
730
|
-
it("should
|
|
737
|
+
it("should reject invalid field types (no coercion)", async () => {
|
|
731
738
|
const alepha = Alepha.create();
|
|
732
739
|
await alepha.start();
|
|
733
|
-
const schema =
|
|
734
|
-
name:
|
|
735
|
-
age:
|
|
736
|
-
active:
|
|
740
|
+
const schema = z.object({
|
|
741
|
+
name: z.text(),
|
|
742
|
+
age: z.integer(),
|
|
743
|
+
active: z.boolean(),
|
|
737
744
|
});
|
|
738
745
|
|
|
739
|
-
|
|
746
|
+
// Strict zod: a string `age` is rejected, not coerced to a number.
|
|
747
|
+
expect(() =>
|
|
740
748
|
alepha.codec.decode(schema, {
|
|
741
749
|
name: "John",
|
|
742
750
|
age: "30",
|
|
743
751
|
active: true,
|
|
744
752
|
}),
|
|
745
|
-
).
|
|
746
|
-
name: "John",
|
|
747
|
-
age: 30,
|
|
748
|
-
active: true,
|
|
749
|
-
});
|
|
753
|
+
).toThrow();
|
|
750
754
|
});
|
|
751
755
|
|
|
752
756
|
it("should fix additional properties by default", async () => {
|
|
753
757
|
const alepha = Alepha.create();
|
|
754
758
|
await alepha.start();
|
|
755
|
-
const schema =
|
|
756
|
-
name:
|
|
757
|
-
age:
|
|
758
|
-
active:
|
|
759
|
+
const schema = z.object({
|
|
760
|
+
name: z.text(),
|
|
761
|
+
age: z.integer(),
|
|
762
|
+
active: z.boolean(),
|
|
759
763
|
});
|
|
760
764
|
|
|
761
765
|
expect(
|
|
@@ -775,14 +779,14 @@ describe("TypeProvider", () => {
|
|
|
775
779
|
it("should support nested objects", async () => {
|
|
776
780
|
const alepha = Alepha.create();
|
|
777
781
|
await alepha.start();
|
|
778
|
-
const schema =
|
|
779
|
-
user:
|
|
780
|
-
name:
|
|
781
|
-
email:
|
|
782
|
+
const schema = z.object({
|
|
783
|
+
user: z.object({
|
|
784
|
+
name: z.text(),
|
|
785
|
+
email: z.email(),
|
|
782
786
|
}),
|
|
783
|
-
metadata:
|
|
784
|
-
createdAt:
|
|
785
|
-
updatedAt:
|
|
787
|
+
metadata: z.object({
|
|
788
|
+
createdAt: z.string(),
|
|
789
|
+
updatedAt: z.string(),
|
|
786
790
|
}),
|
|
787
791
|
});
|
|
788
792
|
|
|
@@ -805,7 +809,7 @@ describe("TypeProvider", () => {
|
|
|
805
809
|
it("should decode valid arrays", async () => {
|
|
806
810
|
const alepha = Alepha.create();
|
|
807
811
|
await alepha.start();
|
|
808
|
-
const schema =
|
|
812
|
+
const schema = z.array(z.text());
|
|
809
813
|
|
|
810
814
|
expect(alepha.codec.decode(schema, [])).toEqual([]);
|
|
811
815
|
expect(alepha.codec.decode(schema, ["a", "b", "c"])).toEqual([
|
|
@@ -815,22 +819,21 @@ describe("TypeProvider", () => {
|
|
|
815
819
|
]);
|
|
816
820
|
});
|
|
817
821
|
|
|
818
|
-
it("
|
|
822
|
+
it("does not cap array length by default (native zod arrays are unbounded)", async () => {
|
|
819
823
|
const alepha = Alepha.create();
|
|
820
824
|
await alepha.start();
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
const
|
|
824
|
-
expect(alepha.codec.decode(schema, maxArray)).toEqual(maxArray);
|
|
825
|
+
// Native `z.array(...)` IS `zod.array(...)` — no implicit max-items cap.
|
|
826
|
+
// Bounds must be set explicitly via `.max()` (see next test).
|
|
827
|
+
const schema = z.array(z.text());
|
|
825
828
|
|
|
826
|
-
const
|
|
827
|
-
expect(
|
|
829
|
+
const big = new Array(1001).fill("x");
|
|
830
|
+
expect(alepha.codec.decode(schema, big)).toEqual(big);
|
|
828
831
|
});
|
|
829
832
|
|
|
830
833
|
it("should support custom maxItems", async () => {
|
|
831
834
|
const alepha = Alepha.create();
|
|
832
835
|
await alepha.start();
|
|
833
|
-
const schema =
|
|
836
|
+
const schema = z.array(z.integer()).max(5);
|
|
834
837
|
|
|
835
838
|
expect(alepha.codec.decode(schema, [1, 2, 3, 4, 5])).toEqual([
|
|
836
839
|
1, 2, 3, 4, 5,
|
|
@@ -840,33 +843,33 @@ describe("TypeProvider", () => {
|
|
|
840
843
|
).toThrow();
|
|
841
844
|
});
|
|
842
845
|
|
|
843
|
-
it("should reject invalid item types", async () => {
|
|
846
|
+
it("should reject invalid item types (no coercion)", async () => {
|
|
844
847
|
const alepha = Alepha.create();
|
|
845
848
|
await alepha.start();
|
|
846
|
-
const schema =
|
|
849
|
+
const schema = z.array(z.text());
|
|
847
850
|
|
|
848
|
-
|
|
851
|
+
// Strict zod: a numeric item is rejected, not coerced to a string.
|
|
852
|
+
expect(() =>
|
|
849
853
|
alepha.codec.decode(schema, ["valid", 123, "also valid"]),
|
|
850
|
-
).
|
|
854
|
+
).toThrow();
|
|
851
855
|
});
|
|
852
856
|
|
|
853
|
-
it("should auto-cast non-array values to single-element array", async () => {
|
|
857
|
+
it("should not auto-cast non-array values to a single-element array", async () => {
|
|
854
858
|
const alepha = Alepha.create();
|
|
855
859
|
await alepha.start();
|
|
856
|
-
const schema =
|
|
860
|
+
const schema = z.array(z.text());
|
|
857
861
|
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
]);
|
|
862
|
+
// Strict zod: a scalar is rejected, not wrapped into `[value]`.
|
|
863
|
+
expect(() => alepha.codec.validate(schema, "not an array")).toThrow();
|
|
861
864
|
});
|
|
862
865
|
|
|
863
866
|
it("should support array of objects", async () => {
|
|
864
867
|
const alepha = Alepha.create();
|
|
865
868
|
await alepha.start();
|
|
866
|
-
const schema =
|
|
867
|
-
|
|
868
|
-
id:
|
|
869
|
-
name:
|
|
869
|
+
const schema = z.array(
|
|
870
|
+
z.object({
|
|
871
|
+
id: z.integer(),
|
|
872
|
+
name: z.text(),
|
|
870
873
|
}),
|
|
871
874
|
);
|
|
872
875
|
|
|
@@ -883,7 +886,7 @@ describe("TypeProvider", () => {
|
|
|
883
886
|
it("should accept any type in the union", async () => {
|
|
884
887
|
const alepha = Alepha.create();
|
|
885
888
|
await alepha.start();
|
|
886
|
-
const schema =
|
|
889
|
+
const schema = z.union([z.text(), z.integer()]);
|
|
887
890
|
|
|
888
891
|
expect(alepha.codec.decode(schema, "hello")).toBe("hello");
|
|
889
892
|
expect(alepha.codec.decode(schema, 123)).toBe(123);
|
|
@@ -892,7 +895,7 @@ describe("TypeProvider", () => {
|
|
|
892
895
|
it("should reject types not in the union", async () => {
|
|
893
896
|
const alepha = Alepha.create();
|
|
894
897
|
await alepha.start();
|
|
895
|
-
const schema =
|
|
898
|
+
const schema = z.union([z.text(), z.integer()]);
|
|
896
899
|
|
|
897
900
|
expect(() => alepha.codec.validate(schema, {})).toThrow();
|
|
898
901
|
});
|
|
@@ -900,9 +903,9 @@ describe("TypeProvider", () => {
|
|
|
900
903
|
it("should support union of object types", async () => {
|
|
901
904
|
const alepha = Alepha.create();
|
|
902
905
|
await alepha.start();
|
|
903
|
-
const schema =
|
|
904
|
-
|
|
905
|
-
|
|
906
|
+
const schema = z.union([
|
|
907
|
+
z.object({ type: z.const("A"), value: z.text() }),
|
|
908
|
+
z.object({ type: z.const("B"), count: z.integer() }),
|
|
906
909
|
]);
|
|
907
910
|
|
|
908
911
|
expect(
|
|
@@ -922,7 +925,7 @@ describe("TypeProvider", () => {
|
|
|
922
925
|
it("should decode valid records", async () => {
|
|
923
926
|
const alepha = Alepha.create();
|
|
924
927
|
await alepha.start();
|
|
925
|
-
const schema =
|
|
928
|
+
const schema = z.record(z.text(), z.integer());
|
|
926
929
|
|
|
927
930
|
const valid = { a: 1, b: 2, c: 3 };
|
|
928
931
|
expect(alepha.codec.decode(schema, valid)).toEqual(valid);
|
|
@@ -931,7 +934,7 @@ describe("TypeProvider", () => {
|
|
|
931
934
|
it("should accept empty records", async () => {
|
|
932
935
|
const alepha = Alepha.create();
|
|
933
936
|
await alepha.start();
|
|
934
|
-
const schema =
|
|
937
|
+
const schema = z.record(z.text(), z.integer());
|
|
935
938
|
|
|
936
939
|
expect(alepha.codec.decode(schema, {})).toEqual({});
|
|
937
940
|
});
|
|
@@ -939,7 +942,7 @@ describe("TypeProvider", () => {
|
|
|
939
942
|
it("should reject invalid value types", async () => {
|
|
940
943
|
const alepha = Alepha.create();
|
|
941
944
|
await alepha.start();
|
|
942
|
-
const schema =
|
|
945
|
+
const schema = z.record(z.text(), z.integer());
|
|
943
946
|
|
|
944
947
|
expect(() =>
|
|
945
948
|
alepha.codec.validate(schema, { a: "not a number" }),
|
|
@@ -951,7 +954,7 @@ describe("TypeProvider", () => {
|
|
|
951
954
|
it("should accept any JSON object", async () => {
|
|
952
955
|
const alepha = Alepha.create();
|
|
953
956
|
await alepha.start();
|
|
954
|
-
const schema =
|
|
957
|
+
const schema = z.json();
|
|
955
958
|
|
|
956
959
|
expect(alepha.codec.decode(schema, { key: "value" })).toEqual({
|
|
957
960
|
key: "value",
|
|
@@ -969,7 +972,7 @@ describe("TypeProvider", () => {
|
|
|
969
972
|
it("should decode valid tuples", async () => {
|
|
970
973
|
const alepha = Alepha.create();
|
|
971
974
|
await alepha.start();
|
|
972
|
-
const schema =
|
|
975
|
+
const schema = z.tuple([z.text(), z.integer(), z.boolean()]);
|
|
973
976
|
|
|
974
977
|
expect(alepha.codec.decode(schema, ["hello", 42, true])).toEqual([
|
|
975
978
|
"hello",
|
|
@@ -981,24 +984,25 @@ describe("TypeProvider", () => {
|
|
|
981
984
|
it("should reject tuples with wrong length", async () => {
|
|
982
985
|
const alepha = Alepha.create();
|
|
983
986
|
await alepha.start();
|
|
984
|
-
const schema =
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
flag:
|
|
987
|
+
const schema = z.tuple([
|
|
988
|
+
z.text(),
|
|
989
|
+
z.integer(),
|
|
990
|
+
z.object({
|
|
991
|
+
flag: z.boolean(),
|
|
989
992
|
}),
|
|
990
993
|
]);
|
|
991
994
|
|
|
992
995
|
expect(() => alepha.codec.validate(schema, ["hello", 42])).toThrow();
|
|
993
|
-
|
|
996
|
+
// Strict zod: an over-long tuple is rejected, not truncated.
|
|
997
|
+
expect(() =>
|
|
994
998
|
alepha.codec.decode(schema, ["hello", 42, { flag: true }, "extra"]),
|
|
995
|
-
).
|
|
999
|
+
).toThrow();
|
|
996
1000
|
});
|
|
997
1001
|
|
|
998
1002
|
it("should reject tuples with wrong types", async () => {
|
|
999
1003
|
const alepha = Alepha.create();
|
|
1000
1004
|
await alepha.start();
|
|
1001
|
-
const schema =
|
|
1005
|
+
const schema = z.tuple([z.text(), z.integer(), z.boolean()]);
|
|
1002
1006
|
|
|
1003
1007
|
expect(() =>
|
|
1004
1008
|
alepha.codec.validate(schema, ["hello", "not a number", true]),
|
|
@@ -1012,9 +1016,9 @@ describe("TypeProvider", () => {
|
|
|
1012
1016
|
it("should make fields optional", async () => {
|
|
1013
1017
|
const alepha = Alepha.create();
|
|
1014
1018
|
await alepha.start();
|
|
1015
|
-
const schema =
|
|
1016
|
-
required:
|
|
1017
|
-
optional:
|
|
1019
|
+
const schema = z.object({
|
|
1020
|
+
required: z.text(),
|
|
1021
|
+
optional: z.text().optional(),
|
|
1018
1022
|
});
|
|
1019
1023
|
|
|
1020
1024
|
expect(
|
|
@@ -1044,8 +1048,8 @@ describe("TypeProvider", () => {
|
|
|
1044
1048
|
it("should allow null values", async () => {
|
|
1045
1049
|
const alepha = Alepha.create();
|
|
1046
1050
|
await alepha.start();
|
|
1047
|
-
const schema =
|
|
1048
|
-
value:
|
|
1051
|
+
const schema = z.object({
|
|
1052
|
+
value: z.text().nullable(),
|
|
1049
1053
|
});
|
|
1050
1054
|
|
|
1051
1055
|
expect(alepha.codec.decode(schema, { value: "test" })).toEqual({
|
|
@@ -1059,8 +1063,8 @@ describe("TypeProvider", () => {
|
|
|
1059
1063
|
it("should require field to be present", async () => {
|
|
1060
1064
|
const alepha = Alepha.create();
|
|
1061
1065
|
await alepha.start();
|
|
1062
|
-
const schema =
|
|
1063
|
-
value:
|
|
1066
|
+
const schema = z.object({
|
|
1067
|
+
value: z.text().nullable(),
|
|
1064
1068
|
});
|
|
1065
1069
|
|
|
1066
1070
|
expect(() => alepha.codec.validate(schema, {})).toThrow();
|
|
@@ -1071,8 +1075,8 @@ describe("TypeProvider", () => {
|
|
|
1071
1075
|
it("should allow string, null, or omitted", async () => {
|
|
1072
1076
|
const alepha = Alepha.create();
|
|
1073
1077
|
await alepha.start();
|
|
1074
|
-
const schema =
|
|
1075
|
-
value:
|
|
1078
|
+
const schema = z.object({
|
|
1079
|
+
value: z.text().nullable().optional(),
|
|
1076
1080
|
});
|
|
1077
1081
|
|
|
1078
1082
|
expect(alepha.codec.decode(schema, { value: "test" })).toEqual({
|
|
@@ -1089,13 +1093,13 @@ describe("TypeProvider", () => {
|
|
|
1089
1093
|
it("should make all fields optional", async () => {
|
|
1090
1094
|
const alepha = Alepha.create();
|
|
1091
1095
|
await alepha.start();
|
|
1092
|
-
const baseSchema =
|
|
1093
|
-
name:
|
|
1094
|
-
age:
|
|
1095
|
-
email:
|
|
1096
|
+
const baseSchema = z.object({
|
|
1097
|
+
name: z.text(),
|
|
1098
|
+
age: z.integer(),
|
|
1099
|
+
email: z.email(),
|
|
1096
1100
|
});
|
|
1097
1101
|
|
|
1098
|
-
const partialSchema =
|
|
1102
|
+
const partialSchema = baseSchema.partial();
|
|
1099
1103
|
|
|
1100
1104
|
expect(alepha.codec.decode(partialSchema, {})).toEqual({});
|
|
1101
1105
|
expect(alepha.codec.decode(partialSchema, { name: "John" })).toEqual({
|
|
@@ -1125,14 +1129,14 @@ describe("TypeProvider", () => {
|
|
|
1125
1129
|
it("should pick only specified fields", async () => {
|
|
1126
1130
|
const alepha = Alepha.create();
|
|
1127
1131
|
await alepha.start();
|
|
1128
|
-
const baseSchema =
|
|
1129
|
-
id:
|
|
1130
|
-
name:
|
|
1131
|
-
email:
|
|
1132
|
-
age:
|
|
1132
|
+
const baseSchema = z.object({
|
|
1133
|
+
id: z.integer(),
|
|
1134
|
+
name: z.text(),
|
|
1135
|
+
email: z.email(),
|
|
1136
|
+
age: z.integer(),
|
|
1133
1137
|
});
|
|
1134
1138
|
|
|
1135
|
-
const pickedSchema =
|
|
1139
|
+
const pickedSchema = baseSchema.pick({ name: true, email: true });
|
|
1136
1140
|
|
|
1137
1141
|
expect(
|
|
1138
1142
|
alepha.codec.decode(pickedSchema, {
|
|
@@ -1148,14 +1152,14 @@ describe("TypeProvider", () => {
|
|
|
1148
1152
|
it("should reject unpicked fields", async () => {
|
|
1149
1153
|
const alepha = Alepha.create();
|
|
1150
1154
|
await alepha.start();
|
|
1151
|
-
const baseSchema =
|
|
1152
|
-
id:
|
|
1153
|
-
name:
|
|
1154
|
-
email:
|
|
1155
|
-
age:
|
|
1155
|
+
const baseSchema = z.object({
|
|
1156
|
+
id: z.integer(),
|
|
1157
|
+
name: z.text(),
|
|
1158
|
+
email: z.email(),
|
|
1159
|
+
age: z.integer(),
|
|
1156
1160
|
});
|
|
1157
1161
|
|
|
1158
|
-
const pickedSchema =
|
|
1162
|
+
const pickedSchema = baseSchema.pick({ name: true, email: true });
|
|
1159
1163
|
|
|
1160
1164
|
expect(
|
|
1161
1165
|
alepha.codec.decode(pickedSchema, {
|
|
@@ -1172,14 +1176,14 @@ describe("TypeProvider", () => {
|
|
|
1172
1176
|
it("should require all picked fields", async () => {
|
|
1173
1177
|
const alepha = Alepha.create();
|
|
1174
1178
|
await alepha.start();
|
|
1175
|
-
const baseSchema =
|
|
1176
|
-
id:
|
|
1177
|
-
name:
|
|
1178
|
-
email:
|
|
1179
|
-
age:
|
|
1179
|
+
const baseSchema = z.object({
|
|
1180
|
+
id: z.integer(),
|
|
1181
|
+
name: z.text(),
|
|
1182
|
+
email: z.email(),
|
|
1183
|
+
age: z.integer(),
|
|
1180
1184
|
});
|
|
1181
1185
|
|
|
1182
|
-
const pickedSchema =
|
|
1186
|
+
const pickedSchema = baseSchema.pick({ name: true, email: true });
|
|
1183
1187
|
|
|
1184
1188
|
expect(() =>
|
|
1185
1189
|
alepha.codec.validate(pickedSchema, { name: "John" }),
|
|
@@ -1191,14 +1195,14 @@ describe("TypeProvider", () => {
|
|
|
1191
1195
|
it("should omit specified fields", async () => {
|
|
1192
1196
|
const alepha = Alepha.create();
|
|
1193
1197
|
await alepha.start();
|
|
1194
|
-
const baseSchema =
|
|
1195
|
-
id:
|
|
1196
|
-
name:
|
|
1197
|
-
email:
|
|
1198
|
-
password:
|
|
1198
|
+
const baseSchema = z.object({
|
|
1199
|
+
id: z.integer(),
|
|
1200
|
+
name: z.text(),
|
|
1201
|
+
email: z.email(),
|
|
1202
|
+
password: z.text(),
|
|
1199
1203
|
});
|
|
1200
1204
|
|
|
1201
|
-
const omittedSchema =
|
|
1205
|
+
const omittedSchema = baseSchema.omit({ password: true });
|
|
1202
1206
|
|
|
1203
1207
|
expect(
|
|
1204
1208
|
alepha.codec.decode(omittedSchema, {
|
|
@@ -1216,14 +1220,14 @@ describe("TypeProvider", () => {
|
|
|
1216
1220
|
it("should reject omitted fields", async () => {
|
|
1217
1221
|
const alepha = Alepha.create();
|
|
1218
1222
|
await alepha.start();
|
|
1219
|
-
const baseSchema =
|
|
1220
|
-
id:
|
|
1221
|
-
name:
|
|
1222
|
-
email:
|
|
1223
|
-
password:
|
|
1223
|
+
const baseSchema = z.object({
|
|
1224
|
+
id: z.integer(),
|
|
1225
|
+
name: z.text(),
|
|
1226
|
+
email: z.email(),
|
|
1227
|
+
password: z.text(),
|
|
1224
1228
|
});
|
|
1225
1229
|
|
|
1226
|
-
const omittedSchema =
|
|
1230
|
+
const omittedSchema = baseSchema.omit({ password: true });
|
|
1227
1231
|
|
|
1228
1232
|
expect(
|
|
1229
1233
|
alepha.codec.decode(omittedSchema, {
|
|
@@ -1246,7 +1250,7 @@ describe("TypeProvider", () => {
|
|
|
1246
1250
|
it("should accept valid enum values", async () => {
|
|
1247
1251
|
const alepha = Alepha.create();
|
|
1248
1252
|
await alepha.start();
|
|
1249
|
-
const schema =
|
|
1253
|
+
const schema = z.enum(["ACTIVE", "INACTIVE", "PENDING"]);
|
|
1250
1254
|
|
|
1251
1255
|
expect(alepha.codec.decode(schema, "ACTIVE")).toBe("ACTIVE");
|
|
1252
1256
|
expect(alepha.codec.decode(schema, "INACTIVE")).toBe("INACTIVE");
|
|
@@ -1256,7 +1260,7 @@ describe("TypeProvider", () => {
|
|
|
1256
1260
|
it("should reject invalid enum values", async () => {
|
|
1257
1261
|
const alepha = Alepha.create();
|
|
1258
1262
|
await alepha.start();
|
|
1259
|
-
const schema =
|
|
1263
|
+
const schema = z.enum(["ACTIVE", "INACTIVE", "PENDING"]);
|
|
1260
1264
|
|
|
1261
1265
|
expect(() => alepha.codec.validate(schema, "INVALID")).toThrow();
|
|
1262
1266
|
expect(() => alepha.codec.validate(schema, "active")).toThrow(); // Case sensitive
|
|
@@ -1268,7 +1272,7 @@ describe("TypeProvider", () => {
|
|
|
1268
1272
|
it("should accept only the literal value", async () => {
|
|
1269
1273
|
const alepha = Alepha.create();
|
|
1270
1274
|
await alepha.start();
|
|
1271
|
-
const schema =
|
|
1275
|
+
const schema = z.const("FIXED_VALUE");
|
|
1272
1276
|
|
|
1273
1277
|
expect(alepha.codec.decode(schema, "FIXED_VALUE")).toBe("FIXED_VALUE");
|
|
1274
1278
|
});
|
|
@@ -1276,7 +1280,7 @@ describe("TypeProvider", () => {
|
|
|
1276
1280
|
it("should reject non-matching values", async () => {
|
|
1277
1281
|
const alepha = Alepha.create();
|
|
1278
1282
|
await alepha.start();
|
|
1279
|
-
const schema =
|
|
1283
|
+
const schema = z.const("FIXED_VALUE");
|
|
1280
1284
|
|
|
1281
1285
|
expect(() => alepha.codec.validate(schema, "OTHER_VALUE")).toThrow();
|
|
1282
1286
|
expect(() => alepha.codec.validate(schema, "")).toThrow();
|
|
@@ -1285,7 +1289,7 @@ describe("TypeProvider", () => {
|
|
|
1285
1289
|
it("should support number literals", async () => {
|
|
1286
1290
|
const alepha = Alepha.create();
|
|
1287
1291
|
await alepha.start();
|
|
1288
|
-
const schema =
|
|
1292
|
+
const schema = z.const(42);
|
|
1289
1293
|
|
|
1290
1294
|
expect(alepha.codec.decode(schema, 42)).toBe(42);
|
|
1291
1295
|
expect(() => alepha.codec.decode(schema, 43)).toThrow();
|
|
@@ -1298,7 +1302,7 @@ describe("TypeProvider", () => {
|
|
|
1298
1302
|
it("should decode valid valueLabel objects", async () => {
|
|
1299
1303
|
const alepha = Alepha.create();
|
|
1300
1304
|
await alepha.start();
|
|
1301
|
-
const schema =
|
|
1305
|
+
const schema = z.valueLabel();
|
|
1302
1306
|
|
|
1303
1307
|
const valid = {
|
|
1304
1308
|
value: "ACTIVE",
|
|
@@ -1310,7 +1314,7 @@ describe("TypeProvider", () => {
|
|
|
1310
1314
|
it("should support optional description", async () => {
|
|
1311
1315
|
const alepha = Alepha.create();
|
|
1312
1316
|
await alepha.start();
|
|
1313
|
-
const schema =
|
|
1317
|
+
const schema = z.valueLabel();
|
|
1314
1318
|
|
|
1315
1319
|
const withDesc = {
|
|
1316
1320
|
value: "PENDING",
|
|
@@ -1323,7 +1327,7 @@ describe("TypeProvider", () => {
|
|
|
1323
1327
|
it("should validate value is constantCase", async () => {
|
|
1324
1328
|
const alepha = Alepha.create();
|
|
1325
1329
|
await alepha.start();
|
|
1326
|
-
const schema =
|
|
1330
|
+
const schema = z.valueLabel();
|
|
1327
1331
|
|
|
1328
1332
|
expect(() =>
|
|
1329
1333
|
alepha.codec.decode(schema, {
|
|
@@ -1340,19 +1344,20 @@ describe("TypeProvider", () => {
|
|
|
1340
1344
|
it("should create file schema with binary format", async () => {
|
|
1341
1345
|
const alepha = Alepha.create();
|
|
1342
1346
|
await alepha.start();
|
|
1343
|
-
const schema =
|
|
1347
|
+
const schema = z.file();
|
|
1344
1348
|
|
|
1345
1349
|
expect(schema).toBeDefined();
|
|
1346
|
-
|
|
1350
|
+
// Format tag now lives in zod `.meta()`, read via `z.schema.format`.
|
|
1351
|
+
expect(z.schema.format(schema)).toBe("binary");
|
|
1347
1352
|
});
|
|
1348
1353
|
|
|
1349
1354
|
it("should support maxSize option", async () => {
|
|
1350
1355
|
const alepha = Alepha.create();
|
|
1351
1356
|
await alepha.start();
|
|
1352
|
-
const schema =
|
|
1357
|
+
const schema = z.file({ maxSize: 1024 * 1024 }); // 1MB
|
|
1353
1358
|
|
|
1354
1359
|
expect(schema).toBeDefined();
|
|
1355
|
-
expect(
|
|
1360
|
+
expect(z.schema.format(schema)).toBe("binary");
|
|
1356
1361
|
});
|
|
1357
1362
|
});
|
|
1358
1363
|
|
|
@@ -1360,10 +1365,10 @@ describe("TypeProvider", () => {
|
|
|
1360
1365
|
it("should create stream schema", async () => {
|
|
1361
1366
|
const alepha = Alepha.create();
|
|
1362
1367
|
await alepha.start();
|
|
1363
|
-
const schema =
|
|
1368
|
+
const schema = z.stream();
|
|
1364
1369
|
|
|
1365
1370
|
expect(schema).toBeDefined();
|
|
1366
|
-
expect(
|
|
1371
|
+
expect(z.schema.format(schema)).toBe("stream");
|
|
1367
1372
|
});
|
|
1368
1373
|
});
|
|
1369
1374
|
});
|
|
@@ -1373,21 +1378,21 @@ describe("TypeProvider", () => {
|
|
|
1373
1378
|
const alepha = Alepha.create();
|
|
1374
1379
|
await alepha.start();
|
|
1375
1380
|
|
|
1376
|
-
const schema =
|
|
1377
|
-
id:
|
|
1378
|
-
user:
|
|
1379
|
-
name:
|
|
1380
|
-
email:
|
|
1381
|
-
age:
|
|
1382
|
-
roles:
|
|
1381
|
+
const schema = z.object({
|
|
1382
|
+
id: z.uuid(),
|
|
1383
|
+
user: z.object({
|
|
1384
|
+
name: z.shortText(),
|
|
1385
|
+
email: z.email(),
|
|
1386
|
+
age: z.integer().optional(),
|
|
1387
|
+
roles: z.array(z.enum(["ADMIN", "USER", "GUEST"])),
|
|
1383
1388
|
}),
|
|
1384
|
-
metadata:
|
|
1385
|
-
|
|
1386
|
-
createdAt:
|
|
1387
|
-
tags:
|
|
1388
|
-
})
|
|
1389
|
-
|
|
1390
|
-
settings:
|
|
1389
|
+
metadata: z
|
|
1390
|
+
.object({
|
|
1391
|
+
createdAt: z.string(),
|
|
1392
|
+
tags: z.array(z.text()),
|
|
1393
|
+
})
|
|
1394
|
+
.nullable(),
|
|
1395
|
+
settings: z.record(z.text(), z.boolean()),
|
|
1391
1396
|
});
|
|
1392
1397
|
|
|
1393
1398
|
const valid = {
|
|
@@ -1422,13 +1427,13 @@ describe("TypeProvider", () => {
|
|
|
1422
1427
|
const alepha = Alepha.create();
|
|
1423
1428
|
await alepha.start();
|
|
1424
1429
|
|
|
1425
|
-
const schema =
|
|
1426
|
-
text:
|
|
1427
|
-
number:
|
|
1428
|
-
bool:
|
|
1429
|
-
array:
|
|
1430
|
-
nested:
|
|
1431
|
-
key:
|
|
1430
|
+
const schema = z.object({
|
|
1431
|
+
text: z.text(),
|
|
1432
|
+
number: z.number(),
|
|
1433
|
+
bool: z.boolean(),
|
|
1434
|
+
array: z.array(z.integer()),
|
|
1435
|
+
nested: z.object({
|
|
1436
|
+
key: z.text(),
|
|
1432
1437
|
}),
|
|
1433
1438
|
});
|
|
1434
1439
|
|
|
@@ -1452,9 +1457,9 @@ describe("TypeProvider", () => {
|
|
|
1452
1457
|
const alepha = Alepha.create();
|
|
1453
1458
|
await alepha.start();
|
|
1454
1459
|
|
|
1455
|
-
const schema =
|
|
1456
|
-
name:
|
|
1457
|
-
age:
|
|
1460
|
+
const schema = z.object({
|
|
1461
|
+
name: z.text(),
|
|
1462
|
+
age: z.integer(),
|
|
1458
1463
|
});
|
|
1459
1464
|
|
|
1460
1465
|
try {
|
|
@@ -1468,126 +1473,126 @@ describe("TypeProvider", () => {
|
|
|
1468
1473
|
|
|
1469
1474
|
describe("TypeGuard", () => {
|
|
1470
1475
|
it("should correctly identify string schemas", () => {
|
|
1471
|
-
const { schema } =
|
|
1476
|
+
const { schema } = z;
|
|
1472
1477
|
|
|
1473
|
-
expect(schema.isString(
|
|
1474
|
-
expect(schema.isString(
|
|
1478
|
+
expect(schema.isString(z.text())).toBe(true);
|
|
1479
|
+
expect(schema.isString(z.integer())).toBe(false);
|
|
1475
1480
|
});
|
|
1476
1481
|
|
|
1477
1482
|
it("should correctly identify number schemas", () => {
|
|
1478
|
-
const { schema } =
|
|
1483
|
+
const { schema } = z;
|
|
1479
1484
|
|
|
1480
|
-
expect(schema.isNumber(
|
|
1481
|
-
expect(schema.isNumber(
|
|
1485
|
+
expect(schema.isNumber(z.number())).toBe(true);
|
|
1486
|
+
expect(schema.isNumber(z.text())).toBe(false);
|
|
1482
1487
|
});
|
|
1483
1488
|
|
|
1484
1489
|
it("should correctly identify integer schemas", () => {
|
|
1485
|
-
const { schema } =
|
|
1490
|
+
const { schema } = z;
|
|
1486
1491
|
|
|
1487
|
-
expect(schema.isInteger(
|
|
1488
|
-
expect(schema.isInteger(
|
|
1492
|
+
expect(schema.isInteger(z.integer())).toBe(true);
|
|
1493
|
+
expect(schema.isInteger(z.number())).toBe(false);
|
|
1489
1494
|
});
|
|
1490
1495
|
|
|
1491
1496
|
it("should correctly identify boolean schemas", () => {
|
|
1492
|
-
const { schema } =
|
|
1497
|
+
const { schema } = z;
|
|
1493
1498
|
|
|
1494
|
-
expect(schema.isBoolean(
|
|
1495
|
-
expect(schema.isBoolean(
|
|
1499
|
+
expect(schema.isBoolean(z.boolean())).toBe(true);
|
|
1500
|
+
expect(schema.isBoolean(z.text())).toBe(false);
|
|
1496
1501
|
});
|
|
1497
1502
|
|
|
1498
1503
|
it("should correctly identify object schemas", () => {
|
|
1499
|
-
const { schema } =
|
|
1504
|
+
const { schema } = z;
|
|
1500
1505
|
|
|
1501
|
-
expect(schema.isObject(
|
|
1502
|
-
expect(schema.isObject(
|
|
1506
|
+
expect(schema.isObject(z.object({ key: z.text() }))).toBe(true);
|
|
1507
|
+
expect(schema.isObject(z.array(z.text()))).toBe(false);
|
|
1503
1508
|
});
|
|
1504
1509
|
|
|
1505
1510
|
it("should correctly identify array schemas", () => {
|
|
1506
|
-
const { schema } =
|
|
1511
|
+
const { schema } = z;
|
|
1507
1512
|
|
|
1508
|
-
expect(schema.isArray(
|
|
1509
|
-
expect(schema.isArray(
|
|
1513
|
+
expect(schema.isArray(z.array(z.text()))).toBe(true);
|
|
1514
|
+
expect(schema.isArray(z.text())).toBe(false);
|
|
1510
1515
|
});
|
|
1511
1516
|
|
|
1512
1517
|
it("should correctly identify union schemas", () => {
|
|
1513
|
-
const { schema } =
|
|
1518
|
+
const { schema } = z;
|
|
1514
1519
|
|
|
1515
|
-
expect(schema.isUnion(
|
|
1516
|
-
expect(schema.isUnion(
|
|
1520
|
+
expect(schema.isUnion(z.union([z.text(), z.integer()]))).toBe(true);
|
|
1521
|
+
expect(schema.isUnion(z.text())).toBe(false);
|
|
1517
1522
|
});
|
|
1518
1523
|
|
|
1519
1524
|
it("should correctly identify optional schemas", () => {
|
|
1520
|
-
const { schema } =
|
|
1525
|
+
const { schema } = z;
|
|
1521
1526
|
|
|
1522
|
-
expect(schema.isOptional(
|
|
1523
|
-
expect(schema.isOptional(
|
|
1527
|
+
expect(schema.isOptional(z.text().optional())).toBe(true);
|
|
1528
|
+
expect(schema.isOptional(z.text())).toBe(false);
|
|
1524
1529
|
});
|
|
1525
1530
|
|
|
1526
1531
|
it("should correctly identify null schemas", () => {
|
|
1527
|
-
const { schema } =
|
|
1532
|
+
const { schema } = z;
|
|
1528
1533
|
|
|
1529
|
-
expect(schema.isNull(
|
|
1530
|
-
expect(schema.isNull(
|
|
1534
|
+
expect(schema.isNull(z.null())).toBe(true);
|
|
1535
|
+
expect(schema.isNull(z.undefined())).toBe(false);
|
|
1531
1536
|
});
|
|
1532
1537
|
|
|
1533
1538
|
it("should correctly identify undefined schemas", () => {
|
|
1534
|
-
const { schema } =
|
|
1539
|
+
const { schema } = z;
|
|
1535
1540
|
|
|
1536
|
-
expect(schema.isUndefined(
|
|
1537
|
-
expect(schema.isUndefined(
|
|
1541
|
+
expect(schema.isUndefined(z.undefined())).toBe(true);
|
|
1542
|
+
expect(schema.isUndefined(z.null())).toBe(false);
|
|
1538
1543
|
});
|
|
1539
1544
|
|
|
1540
1545
|
it("should correctly identify any schemas", () => {
|
|
1541
|
-
const { schema } =
|
|
1546
|
+
const { schema } = z;
|
|
1542
1547
|
|
|
1543
|
-
expect(schema.isAny(
|
|
1544
|
-
expect(schema.isAny(
|
|
1548
|
+
expect(schema.isAny(z.any())).toBe(true);
|
|
1549
|
+
expect(schema.isAny(z.text())).toBe(false);
|
|
1545
1550
|
});
|
|
1546
1551
|
|
|
1547
1552
|
it("should correctly identify record schemas", () => {
|
|
1548
|
-
const { schema } =
|
|
1553
|
+
const { schema } = z;
|
|
1549
1554
|
|
|
1550
|
-
expect(schema.isRecord(
|
|
1551
|
-
expect(schema.isRecord(
|
|
1555
|
+
expect(schema.isRecord(z.record(z.text(), z.integer()))).toBe(true);
|
|
1556
|
+
expect(schema.isRecord(z.object({}))).toBe(false);
|
|
1552
1557
|
});
|
|
1553
1558
|
|
|
1554
1559
|
it("should correctly identify tuple schemas", () => {
|
|
1555
|
-
const { schema } =
|
|
1560
|
+
const { schema } = z;
|
|
1556
1561
|
|
|
1557
|
-
expect(schema.isTuple(
|
|
1558
|
-
expect(schema.isTuple(
|
|
1562
|
+
expect(schema.isTuple(z.tuple([z.text(), z.integer()]))).toBe(true);
|
|
1563
|
+
expect(schema.isTuple(z.array(z.text()))).toBe(false);
|
|
1559
1564
|
});
|
|
1560
1565
|
|
|
1561
1566
|
it("should correctly identify void schemas", () => {
|
|
1562
|
-
const { schema } =
|
|
1567
|
+
const { schema } = z;
|
|
1563
1568
|
|
|
1564
|
-
expect(schema.isVoid(
|
|
1565
|
-
expect(schema.isVoid(
|
|
1569
|
+
expect(schema.isVoid(z.void())).toBe(true);
|
|
1570
|
+
expect(schema.isVoid(z.undefined())).toBe(false);
|
|
1566
1571
|
});
|
|
1567
1572
|
|
|
1568
1573
|
it("should correctly identify uuid schemas", () => {
|
|
1569
|
-
const { schema } =
|
|
1574
|
+
const { schema } = z;
|
|
1570
1575
|
|
|
1571
|
-
expect(schema.isUUID(
|
|
1572
|
-
expect(schema.isUUID(
|
|
1576
|
+
expect(schema.isUUID(z.uuid())).toBe(true);
|
|
1577
|
+
expect(schema.isUUID(z.text())).toBe(false);
|
|
1573
1578
|
});
|
|
1574
1579
|
|
|
1575
1580
|
it("should correctly identify bigint schemas", () => {
|
|
1576
|
-
const { schema } =
|
|
1581
|
+
const { schema } = z;
|
|
1577
1582
|
|
|
1578
|
-
expect(schema.isBigInt(
|
|
1579
|
-
expect(schema.isBigInt(
|
|
1583
|
+
expect(schema.isBigInt(z.bigint())).toBe(true);
|
|
1584
|
+
expect(schema.isBigInt(z.integer())).toBe(false);
|
|
1580
1585
|
});
|
|
1581
1586
|
|
|
1582
1587
|
it("should correctly identify scalar schemas", () => {
|
|
1583
|
-
const { schema } =
|
|
1584
|
-
|
|
1585
|
-
expect(schema.isScalar(
|
|
1586
|
-
expect(schema.isScalar(
|
|
1587
|
-
expect(schema.isScalar(
|
|
1588
|
-
expect(schema.isScalar(
|
|
1589
|
-
expect(schema.isScalar(
|
|
1590
|
-
expect(schema.isScalar(
|
|
1588
|
+
const { schema } = z;
|
|
1589
|
+
|
|
1590
|
+
expect(schema.isScalar(z.string())).toBe(true);
|
|
1591
|
+
expect(schema.isScalar(z.number())).toBe(true);
|
|
1592
|
+
expect(schema.isScalar(z.integer())).toBe(true);
|
|
1593
|
+
expect(schema.isScalar(z.boolean())).toBe(true);
|
|
1594
|
+
expect(schema.isScalar(z.object({}))).toBe(false);
|
|
1595
|
+
expect(schema.isScalar(z.array(z.string()))).toBe(false);
|
|
1591
1596
|
});
|
|
1592
1597
|
});
|
|
1593
1598
|
|