alepha 0.22.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/swagger-ui/swagger-ui-bundle.js +1 -1
- package/assets/swagger-ui/swagger-ui-standalone-preset.js +1 -1
- package/dist/api/audits/index.browser.js +49 -52
- package/dist/api/audits/index.browser.js.map +1 -1
- package/dist/api/audits/index.d.ts +629 -565
- package/dist/api/audits/index.d.ts.map +1 -1
- package/dist/api/audits/index.js +206 -98
- package/dist/api/audits/index.js.map +1 -1
- package/dist/api/files/index.browser.js +44 -44
- package/dist/api/files/index.browser.js.map +1 -1
- package/dist/api/files/index.d.ts +292 -293
- package/dist/api/files/index.d.ts.map +1 -1
- package/dist/api/files/index.js +61 -64
- package/dist/api/files/index.js.map +1 -1
- package/dist/api/jobs/index.browser.js +61 -59
- package/dist/api/jobs/index.browser.js.map +1 -1
- package/dist/api/jobs/index.d.ts +546 -347
- package/dist/api/jobs/index.d.ts.map +1 -1
- package/dist/api/jobs/index.js +165 -86
- package/dist/api/jobs/index.js.map +1 -1
- package/dist/api/keys/index.d.ts +242 -230
- package/dist/api/keys/index.d.ts.map +1 -1
- package/dist/api/keys/index.js +63 -66
- package/dist/api/keys/index.js.map +1 -1
- package/dist/api/notifications/index.browser.js +40 -38
- package/dist/api/notifications/index.browser.js.map +1 -1
- package/dist/api/notifications/index.d.ts +339 -209
- package/dist/api/notifications/index.d.ts.map +1 -1
- package/dist/api/notifications/index.js +108 -60
- package/dist/api/notifications/index.js.map +1 -1
- package/dist/api/oauth/index.d.ts +190 -78
- package/dist/api/oauth/index.d.ts.map +1 -1
- package/dist/api/oauth/index.js +290 -68
- package/dist/api/oauth/index.js.map +1 -1
- package/dist/api/organizations/index.browser.js +14 -14
- package/dist/api/organizations/index.browser.js.map +1 -1
- package/dist/api/organizations/index.d.ts +158 -134
- package/dist/api/organizations/index.d.ts.map +1 -1
- package/dist/api/organizations/index.js +18 -18
- package/dist/api/organizations/index.js.map +1 -1
- package/dist/api/parameters/index.browser.js +74 -53
- package/dist/api/parameters/index.browser.js.map +1 -1
- package/dist/api/parameters/index.d.ts +607 -513
- package/dist/api/parameters/index.d.ts.map +1 -1
- package/dist/api/parameters/index.js +205 -127
- package/dist/api/parameters/index.js.map +1 -1
- package/dist/api/payments/index.d.ts +652 -449
- package/dist/api/payments/index.d.ts.map +1 -1
- package/dist/api/payments/index.js +159 -93
- package/dist/api/payments/index.js.map +1 -1
- package/dist/api/subscriptions/index.d.ts +1032 -762
- package/dist/api/subscriptions/index.d.ts.map +1 -1
- package/dist/api/subscriptions/index.js +166 -185
- package/dist/api/subscriptions/index.js.map +1 -1
- package/dist/api/users/index.browser.js +48 -71
- package/dist/api/users/index.browser.js.map +1 -1
- package/dist/api/users/index.d.ts +1297 -1109
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +454 -369
- package/dist/api/users/index.js.map +1 -1
- package/dist/api/verifications/index.browser.js +17 -17
- package/dist/api/verifications/index.browser.js.map +1 -1
- package/dist/api/verifications/index.d.ts +169 -157
- package/dist/api/verifications/index.d.ts.map +1 -1
- package/dist/api/verifications/index.js +47 -95
- package/dist/api/verifications/index.js.map +1 -1
- package/dist/background/index.d.ts +0 -1
- package/dist/background/index.d.ts.map +1 -1
- package/dist/background/index.js.map +1 -1
- package/dist/background/index.workerd.js.map +1 -1
- package/dist/batch/index.d.ts +0 -1
- package/dist/batch/index.d.ts.map +1 -1
- package/dist/batch/index.js.map +1 -1
- package/dist/bin/index.js +1 -1
- package/dist/bin/index.js.map +1 -1
- package/dist/bucket/index.d.ts +27 -32
- package/dist/bucket/index.d.ts.map +1 -1
- package/dist/bucket/index.js +56 -26
- package/dist/bucket/index.js.map +1 -1
- package/dist/bucket/index.workerd.js +52 -24
- package/dist/bucket/index.workerd.js.map +1 -1
- package/dist/cache/core/index.d.ts +4 -6
- package/dist/cache/core/index.d.ts.map +1 -1
- package/dist/cache/core/index.js +4 -10
- package/dist/cache/core/index.js.map +1 -1
- package/dist/cache/core/index.workerd.js +4 -10
- package/dist/cache/core/index.workerd.js.map +1 -1
- package/dist/cache/database/index.d.ts +22 -23
- package/dist/cache/database/index.d.ts.map +1 -1
- package/dist/cache/database/index.js +11 -20
- package/dist/cache/database/index.js.map +1 -1
- package/dist/cache/redis/index.d.ts +3 -4
- package/dist/cache/redis/index.d.ts.map +1 -1
- package/dist/cache/redis/index.js +2 -2
- package/dist/cache/redis/index.js.map +1 -1
- package/dist/captcha/index.d.ts.map +1 -1
- package/dist/captcha/index.js +4 -4
- package/dist/captcha/index.js.map +1 -1
- package/dist/cli/config/index.d.ts +0 -1
- package/dist/cli/config/index.d.ts.map +1 -1
- package/dist/cli/core/index.d.ts +244 -475
- package/dist/cli/core/index.d.ts.map +1 -1
- package/dist/cli/core/index.js +308 -383
- package/dist/cli/core/index.js.map +1 -1
- package/dist/cli/devtools/index.d.ts +3 -9
- package/dist/cli/devtools/index.d.ts.map +1 -1
- package/dist/cli/devtools/index.js +3 -3
- package/dist/cli/devtools/index.js.map +1 -1
- package/dist/cli/i18n/index.d.ts +20 -39
- package/dist/cli/i18n/index.d.ts.map +1 -1
- package/dist/cli/i18n/index.js +51 -17
- package/dist/cli/i18n/index.js.map +1 -1
- package/dist/cli/platform/index.d.ts +89 -82
- package/dist/cli/platform/index.d.ts.map +1 -1
- package/dist/cli/platform/index.js +27 -33
- package/dist/cli/platform/index.js.map +1 -1
- package/dist/cli/platform-lib/index.d.ts +383 -410
- package/dist/cli/platform-lib/index.d.ts.map +1 -1
- package/dist/cli/platform-lib/index.js +300 -258
- package/dist/cli/platform-lib/index.js.map +1 -1
- package/dist/cli/vendor/index.d.ts +17 -41
- package/dist/cli/vendor/index.d.ts.map +1 -1
- package/dist/cli/vendor/index.js +10 -13
- package/dist/cli/vendor/index.js.map +1 -1
- package/dist/command/index.d.ts +82 -194
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +160 -563
- package/dist/command/index.js.map +1 -1
- package/dist/core/index.browser.js +845 -859
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +787 -527
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +845 -859
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +845 -859
- package/dist/core/index.native.js.map +1 -1
- package/dist/core/index.workerd.js +845 -859
- package/dist/core/index.workerd.js.map +1 -1
- package/dist/crypto/index.browser.js +1 -1
- package/dist/crypto/index.browser.js.map +1 -1
- package/dist/crypto/index.d.ts +3 -4
- package/dist/crypto/index.d.ts.map +1 -1
- package/dist/crypto/index.js +6 -3
- package/dist/crypto/index.js.map +1 -1
- package/dist/datetime/index.d.ts +12 -2
- package/dist/datetime/index.d.ts.map +1 -1
- package/dist/datetime/index.js +6 -1
- package/dist/datetime/index.js.map +1 -1
- package/dist/email/brevo/index.d.ts +0 -1
- package/dist/email/brevo/index.d.ts.map +1 -1
- package/dist/email/brevo/index.js +4 -4
- package/dist/email/brevo/index.js.map +1 -1
- package/dist/email/cloudflare/index.d.ts +0 -1
- package/dist/email/cloudflare/index.d.ts.map +1 -1
- package/dist/email/cloudflare/index.js +2 -2
- package/dist/email/cloudflare/index.js.map +1 -1
- package/dist/email/core/index.d.ts +15 -7
- package/dist/email/core/index.d.ts.map +1 -1
- package/dist/email/core/index.js +14 -5
- package/dist/email/core/index.js.map +1 -1
- package/dist/email/core/index.workerd.js +5 -1
- package/dist/email/core/index.workerd.js.map +1 -1
- package/dist/email/smtp/index.d.ts +8 -9
- package/dist/email/smtp/index.d.ts.map +1 -1
- package/dist/email/smtp/index.js +702 -479
- package/dist/email/smtp/index.js.map +1 -1
- package/dist/fake/index.d.ts +1580 -1238
- package/dist/fake/index.d.ts.map +1 -1
- package/dist/fake/index.js +11728 -32131
- package/dist/fake/index.js.map +1 -1
- package/dist/lock/core/index.d.ts +13 -9
- package/dist/lock/core/index.d.ts.map +1 -1
- package/dist/lock/core/index.js +5 -5
- package/dist/lock/core/index.js.map +1 -1
- package/dist/lock/redis/index.d.ts +0 -1
- package/dist/lock/redis/index.d.ts.map +1 -1
- package/dist/lock/redis/index.js.map +1 -1
- package/dist/logger/index.d.ts +81 -69
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +123 -56
- package/dist/logger/index.js.map +1 -1
- package/dist/mcp/index.d.ts +36 -90
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +65 -70
- package/dist/mcp/index.js.map +1 -1
- package/dist/orm/core/index.browser.js +54 -40
- package/dist/orm/core/index.browser.js.map +1 -1
- package/dist/orm/core/index.bun.js +140 -106
- package/dist/orm/core/index.bun.js.map +1 -1
- package/dist/orm/core/index.d.ts +145 -150
- package/dist/orm/core/index.d.ts.map +1 -1
- package/dist/orm/core/index.js +144 -109
- package/dist/orm/core/index.js.map +1 -1
- package/dist/orm/postgres/index.bun.js +64 -54
- package/dist/orm/postgres/index.bun.js.map +1 -1
- package/dist/orm/postgres/index.d.ts +36 -76
- package/dist/orm/postgres/index.d.ts.map +1 -1
- package/dist/orm/postgres/index.js +67 -57
- package/dist/orm/postgres/index.js.map +1 -1
- package/dist/queue/core/index.d.ts +62 -75
- package/dist/queue/core/index.d.ts.map +1 -1
- package/dist/queue/core/index.js +48 -71
- package/dist/queue/core/index.js.map +1 -1
- package/dist/queue/core/index.workerd.js +48 -71
- package/dist/queue/core/index.workerd.js.map +1 -1
- package/dist/queue/redis/index.d.ts +3 -4
- package/dist/queue/redis/index.d.ts.map +1 -1
- package/dist/queue/redis/index.js +2 -2
- package/dist/queue/redis/index.js.map +1 -1
- package/dist/react/auth/index.browser.js.map +1 -1
- package/dist/react/auth/index.d.ts +7 -4
- package/dist/react/auth/index.d.ts.map +1 -1
- package/dist/react/auth/index.js.map +1 -1
- package/dist/react/core/index.d.ts +87 -5
- package/dist/react/core/index.d.ts.map +1 -1
- package/dist/react/core/index.js +170 -23
- package/dist/react/core/index.js.map +1 -1
- package/dist/react/form/index.d.ts +4 -6
- package/dist/react/form/index.d.ts.map +1 -1
- package/dist/react/form/index.js +107 -71
- package/dist/react/form/index.js.map +1 -1
- package/dist/react/head/index.browser.js.map +1 -1
- package/dist/react/head/index.d.ts +0 -1
- package/dist/react/head/index.d.ts.map +1 -1
- package/dist/react/head/index.js.map +1 -1
- package/dist/react/i18n/index.d.ts +47 -5
- package/dist/react/i18n/index.d.ts.map +1 -1
- package/dist/react/i18n/index.js +116 -12
- package/dist/react/i18n/index.js.map +1 -1
- package/dist/react/intro/index.d.ts +1 -4
- package/dist/react/intro/index.d.ts.map +1 -1
- package/dist/react/intro/index.js.map +1 -1
- package/dist/react/router/index.browser.js +188 -29
- package/dist/react/router/index.browser.js.map +1 -1
- package/dist/react/router/index.d.ts +480 -372
- package/dist/react/router/index.d.ts.map +1 -1
- package/dist/react/router/index.js +261 -47
- package/dist/react/router/index.js.map +1 -1
- package/dist/react/sitemap/index.browser.js +35 -0
- package/dist/react/sitemap/index.browser.js.map +1 -0
- package/dist/react/sitemap/index.d.ts +91 -0
- package/dist/react/sitemap/index.d.ts.map +1 -0
- package/dist/react/sitemap/index.js +131 -0
- package/dist/react/sitemap/index.js.map +1 -0
- package/dist/react/testing/index.d.ts +4 -5
- package/dist/react/testing/index.d.ts.map +1 -1
- package/dist/react/testing/index.js +41 -15
- package/dist/react/testing/index.js.map +1 -1
- package/dist/react/testing/{chunk-BpyX8vjI.js → rolldown-runtime-Bl3dcgcQ.js} +1 -1
- package/dist/react/ui/index.d.ts +35 -34
- package/dist/react/ui/index.d.ts.map +1 -1
- package/dist/react/ui/index.js +12 -17
- package/dist/react/ui/index.js.map +1 -1
- package/dist/redis/index.bun.js +5 -5
- package/dist/redis/index.bun.js.map +1 -1
- package/dist/redis/index.d.ts +6 -7
- package/dist/redis/index.d.ts.map +1 -1
- package/dist/redis/index.js +6 -6
- package/dist/redis/index.js.map +1 -1
- package/dist/retry/index.d.ts +0 -1
- package/dist/retry/index.d.ts.map +1 -1
- package/dist/retry/index.js.map +1 -1
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js.map +1 -1
- package/dist/scheduler/index.d.ts +4 -12
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +9 -4
- package/dist/scheduler/index.js.map +1 -1
- package/dist/scheduler/index.workerd.js +9 -4
- package/dist/scheduler/index.workerd.js.map +1 -1
- package/dist/security/index.browser.js +30 -28
- package/dist/security/index.browser.js.map +1 -1
- package/dist/security/index.d.ts +113 -44
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +452 -37
- package/dist/security/index.js.map +1 -1
- package/dist/server/auth/index.browser.js +19 -19
- package/dist/server/auth/index.browser.js.map +1 -1
- package/dist/server/auth/index.d.ts +215 -187
- package/dist/server/auth/index.d.ts.map +1 -1
- package/dist/server/auth/index.js +1145 -86
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/cookies/index.browser.js +103 -5
- package/dist/server/cookies/index.browser.js.map +1 -1
- package/dist/server/cookies/index.d.ts +86 -4
- package/dist/server/cookies/index.d.ts.map +1 -1
- package/dist/server/cookies/index.js +121 -8
- package/dist/server/cookies/index.js.map +1 -1
- package/dist/server/core/index.browser.js +22 -27
- package/dist/server/core/index.browser.js.map +1 -1
- package/dist/server/core/index.d.ts +134 -85
- package/dist/server/core/index.d.ts.map +1 -1
- package/dist/server/core/index.js +130 -118
- package/dist/server/core/index.js.map +1 -1
- package/dist/server/cors/index.d.ts +9 -10
- package/dist/server/cors/index.d.ts.map +1 -1
- package/dist/server/cors/index.js +14 -26
- package/dist/server/cors/index.js.map +1 -1
- package/dist/server/etag/index.d.ts +2 -3
- package/dist/server/etag/index.d.ts.map +1 -1
- package/dist/server/etag/index.js.map +1 -1
- package/dist/server/health/index.d.ts +18 -19
- package/dist/server/health/index.d.ts.map +1 -1
- package/dist/server/health/index.js +6 -6
- package/dist/server/health/index.js.map +1 -1
- package/dist/server/links/index.browser.js +15 -18
- package/dist/server/links/index.browser.js.map +1 -1
- package/dist/server/links/index.d.ts +66 -67
- package/dist/server/links/index.d.ts.map +1 -1
- package/dist/server/links/index.js +29 -32
- package/dist/server/links/index.js.map +1 -1
- package/dist/server/metrics/index.d.ts +0 -1
- package/dist/server/metrics/index.d.ts.map +1 -1
- package/dist/server/metrics/index.js +10 -3
- package/dist/server/metrics/index.js.map +1 -1
- package/dist/server/proxy/index.d.ts +0 -1
- package/dist/server/proxy/index.d.ts.map +1 -1
- package/dist/server/proxy/index.js.map +1 -1
- package/dist/server/rate-limit/index.d.ts +8 -9
- package/dist/server/rate-limit/index.d.ts.map +1 -1
- package/dist/server/rate-limit/index.js +6 -12
- package/dist/server/rate-limit/index.js.map +1 -1
- package/dist/server/static/index.d.ts +0 -1
- package/dist/server/static/index.d.ts.map +1 -1
- package/dist/server/static/index.js.map +1 -1
- package/dist/server/swagger/index.d.ts +4 -4
- package/dist/server/swagger/index.d.ts.map +1 -1
- package/dist/server/swagger/index.js +37 -25
- package/dist/server/swagger/index.js.map +1 -1
- package/dist/sms/index.d.ts +0 -1
- package/dist/sms/index.d.ts.map +1 -1
- package/dist/sms/index.js.map +1 -1
- package/dist/system/index.browser.js.map +1 -1
- package/dist/system/index.d.ts +0 -1
- package/dist/system/index.d.ts.map +1 -1
- package/dist/system/index.js +2 -1
- package/dist/system/index.js.map +1 -1
- package/dist/system/index.workerd.js.map +1 -1
- package/dist/topic/core/index.d.ts +19 -20
- package/dist/topic/core/index.d.ts.map +1 -1
- package/dist/topic/core/index.js +8 -8
- package/dist/topic/core/index.js.map +1 -1
- package/dist/topic/redis/index.d.ts +3 -4
- package/dist/topic/redis/index.d.ts.map +1 -1
- package/dist/topic/redis/index.js +2 -2
- package/dist/topic/redis/index.js.map +1 -1
- package/package.json +36 -36
- package/src/api/audits/__tests__/AuditJobs.spec.ts +83 -0
- package/src/api/audits/__tests__/AuditService.spec.ts +139 -1
- package/src/api/audits/controllers/AdminAuditController.ts +41 -41
- package/src/api/audits/entities/audits.ts +22 -22
- package/src/api/audits/index.ts +6 -1
- package/src/api/audits/jobs/AuditJobs.ts +29 -0
- package/src/api/audits/parameters/AuditParameters.ts +51 -0
- package/src/api/audits/primitives/$audit.ts +24 -0
- package/src/api/audits/schemas/auditQuerySchema.ts +13 -13
- package/src/api/audits/schemas/createAuditSchema.ts +18 -18
- package/src/api/audits/services/AuditService.ts +79 -7
- package/src/api/files/__tests__/FileController.spec.ts +5 -5
- package/src/api/files/__tests__/FileJobs.spec.ts +6 -0
- package/src/api/files/controllers/FileController.ts +25 -25
- package/src/api/files/entities/files.ts +15 -15
- package/src/api/files/schemas/fileCreatorSummarySchema.ts +7 -7
- package/src/api/files/schemas/fileQuerySchema.ts +9 -9
- package/src/api/files/schemas/fileResourceSchema.ts +7 -9
- package/src/api/files/schemas/storageStatsSchema.ts +13 -13
- package/src/api/jobs/__tests__/$job-hardening.spec.ts +289 -0
- package/src/api/jobs/__tests__/$job.spec.ts +18 -18
- package/src/api/jobs/controllers/AdminJobController.ts +8 -8
- package/src/api/jobs/entities/jobExecutionEntity.ts +29 -19
- package/src/api/jobs/providers/JobProvider.ts +128 -12
- package/src/api/jobs/providers/JobQueueProvider.ts +2 -2
- package/src/api/jobs/schemas/jobConfigAtom.ts +22 -22
- package/src/api/jobs/schemas/jobExecutionQuerySchema.ts +6 -6
- package/src/api/jobs/schemas/jobExecutionResourceSchema.ts +11 -15
- package/src/api/jobs/schemas/jobRegistrationSchema.ts +20 -19
- package/src/api/jobs/schemas/triggerJobSchema.ts +3 -3
- package/src/api/jobs/services/JobService.ts +6 -6
- package/src/api/keys/__tests__/ApiKeyService.spec.ts +2 -2
- package/src/api/keys/controllers/AdminApiKeyController.ts +10 -10
- package/src/api/keys/entities/apiKeyEntity.ts +15 -15
- package/src/api/keys/schemas/adminApiKeyQuerySchema.ts +4 -4
- package/src/api/keys/schemas/adminApiKeyResourceSchema.ts +15 -15
- package/src/api/keys/schemas/createApiKeyBodySchema.ts +5 -5
- package/src/api/keys/schemas/createApiKeyResponseSchema.ts +9 -9
- package/src/api/keys/schemas/listApiKeyResponseSchema.ts +13 -13
- package/src/api/keys/schemas/revokeApiKeyParamsSchema.ts +3 -3
- package/src/api/keys/schemas/revokeApiKeyResponseSchema.ts +3 -3
- package/src/api/notifications/__tests__/AlephaApiNotifications.spec.ts +2 -2
- package/src/api/notifications/controllers/AdminNotificationController.ts +38 -14
- package/src/api/notifications/jobs/NotificationJobs.ts +7 -6
- package/src/api/notifications/primitives/$notification.ts +43 -4
- package/src/api/notifications/schemas/notificationContactPreferencesSchema.ts +4 -4
- package/src/api/notifications/schemas/notificationContactSchema.ts +7 -7
- package/src/api/notifications/schemas/notificationDetailResourceSchema.ts +9 -11
- package/src/api/notifications/schemas/notificationPayloadSchema.ts +11 -9
- package/src/api/notifications/schemas/notificationQuerySchema.ts +6 -6
- package/src/api/notifications/schemas/notificationResourceSchema.ts +14 -14
- package/src/api/notifications/services/NotificationSenderService.ts +38 -2
- package/src/api/oauth/__tests__/OAuthClientService.spec.ts +42 -0
- package/src/api/oauth/__tests__/OAuthController.spec.ts +128 -0
- package/src/api/oauth/controllers/OAuthController.ts +132 -12
- package/src/api/oauth/entities/oauthClientEntity.ts +29 -12
- package/src/api/oauth/helpers/oauthMetadata.ts +1 -0
- package/src/api/oauth/helpers/oidcMetadata.ts +19 -0
- package/src/api/oauth/index.ts +1 -0
- package/src/api/oauth/schemas/authorizeDecisionBodySchema.ts +12 -11
- package/src/api/oauth/schemas/authorizeQuerySchema.ts +12 -10
- package/src/api/oauth/schemas/registerClientBodySchema.ts +10 -11
- package/src/api/oauth/schemas/tokenRequestBodySchema.ts +9 -8
- package/src/api/oauth/services/OAuthClientService.ts +228 -15
- package/src/api/organizations/controllers/AdminOrganizationController.ts +8 -8
- package/src/api/organizations/entities/organizations.ts +6 -6
- package/src/api/organizations/schemas/createOrganizationSchema.ts +5 -5
- package/src/api/organizations/schemas/organizationQuerySchema.ts +4 -4
- package/src/api/organizations/schemas/updateOrganizationSchema.ts +1 -2
- package/src/api/parameters/__tests__/$parameter.spec.ts +229 -50
- package/src/api/parameters/controllers/AdminParameterController.ts +9 -12
- package/src/api/parameters/entities/parameters.ts +29 -16
- package/src/api/parameters/primitives/$parameter.ts +3 -3
- package/src/api/parameters/schemas/activateParameterBodySchema.ts +4 -4
- package/src/api/parameters/schemas/createParameterVersionBodySchema.ts +15 -15
- package/src/api/parameters/schemas/parameterCreatorSummarySchema.ts +7 -7
- package/src/api/parameters/schemas/parameterCurrentResponseSchema.ts +7 -7
- package/src/api/parameters/schemas/parameterHistoryResponseSchema.ts +3 -3
- package/src/api/parameters/schemas/parameterNameParamSchema.ts +2 -3
- package/src/api/parameters/schemas/parameterNamesResponseSchema.ts +3 -3
- package/src/api/parameters/schemas/parameterResponseSchema.ts +3 -3
- package/src/api/parameters/schemas/parameterStatusSchema.ts +2 -2
- package/src/api/parameters/schemas/parameterTreeNodeSchema.ts +6 -6
- package/src/api/parameters/schemas/parameterVersionParamSchema.ts +5 -6
- package/src/api/parameters/schemas/parameterVersionResponseSchema.ts +3 -3
- package/src/api/parameters/schemas/rollbackParameterBodySchema.ts +6 -9
- package/src/api/parameters/services/ParameterProvider.ts +152 -65
- package/src/api/payments/controllers/AdminPaymentController.ts +7 -7
- package/src/api/payments/controllers/MockCheckoutController.ts +79 -28
- package/src/api/payments/controllers/PaymentController.ts +4 -4
- package/src/api/payments/entities/paymentIntents.ts +11 -11
- package/src/api/payments/entities/paymentMethods.ts +11 -11
- package/src/api/payments/entities/refunds.ts +9 -9
- package/src/api/payments/providers/PaymentProvider.ts +18 -0
- package/src/api/payments/schemas/intentSchemas.ts +25 -25
- package/src/api/payments/schemas/paymentMethodSchemas.ts +3 -3
- package/src/api/payments/services/PaymentService.ts +60 -3
- package/src/api/subscriptions/__tests__/SubscriptionService.spec.ts +14 -0
- package/src/api/subscriptions/controllers/AdminSubscriptionController.ts +11 -11
- package/src/api/subscriptions/controllers/SubscriptionController.ts +5 -4
- package/src/api/subscriptions/entities/subscriptionEvents.ts +15 -15
- package/src/api/subscriptions/entities/subscriptions.ts +22 -22
- package/src/api/subscriptions/notifications/SubscriptionNotifications.ts +22 -22
- package/src/api/subscriptions/schemas/cancelSubscriptionSchema.ts +4 -4
- package/src/api/subscriptions/schemas/changePlanSchema.ts +5 -5
- package/src/api/subscriptions/schemas/createSubscriptionSchema.ts +14 -7
- package/src/api/subscriptions/schemas/entitlementsSchema.ts +10 -10
- package/src/api/subscriptions/schemas/mrrSchema.ts +9 -9
- package/src/api/subscriptions/schemas/planDefinitionSchema.ts +21 -21
- package/src/api/subscriptions/schemas/planResourceSchema.ts +19 -19
- package/src/api/subscriptions/schemas/subscriptionQuerySchema.ts +8 -8
- package/src/api/subscriptions/schemas/subscriptionSettingsSchema.ts +7 -7
- package/src/api/subscriptions/schemas/subscriptionStatsSchema.ts +17 -17
- package/src/api/subscriptions/services/SubscriptionConfig.ts +2 -2
- package/src/api/users/__tests__/ApiKeys-integration.spec.ts +11 -11
- package/src/api/users/atoms/realmAuthSettingsAtom.ts +111 -119
- package/src/api/users/controllers/AdminIdentityController.ts +29 -19
- package/src/api/users/controllers/AdminSessionController.ts +37 -27
- package/src/api/users/controllers/AdminUserController.ts +75 -53
- package/src/api/users/controllers/MySessionController.ts +125 -0
- package/src/api/users/controllers/RealmController.ts +9 -9
- package/src/api/users/controllers/UserController.ts +55 -55
- package/src/api/users/entities/identities.ts +8 -8
- package/src/api/users/entities/sessions.ts +17 -17
- package/src/api/users/entities/users.ts +17 -17
- package/src/api/users/index.ts +3 -0
- package/src/api/users/notifications/UserNotifications.ts +76 -24
- package/src/api/users/primitives/$realm.ts +12 -0
- package/src/api/users/schemas/completePasswordResetRequestSchema.ts +8 -12
- package/src/api/users/schemas/completeRegistrationRequestSchema.ts +17 -20
- package/src/api/users/schemas/createUserSchema.ts +2 -2
- package/src/api/users/schemas/identityQuerySchema.ts +4 -4
- package/src/api/users/schemas/identityResourceSchema.ts +3 -2
- package/src/api/users/schemas/loginSchema.ts +4 -4
- package/src/api/users/schemas/passwordResetIntentResponseSchema.ts +6 -8
- package/src/api/users/schemas/realmConfigSchema.ts +10 -10
- package/src/api/users/schemas/registerQuerySchema.ts +6 -6
- package/src/api/users/schemas/registerRequestSchema.ts +21 -43
- package/src/api/users/schemas/registerResponseSchema.ts +2 -2
- package/src/api/users/schemas/registerSchema.ts +13 -31
- package/src/api/users/schemas/registrationIntentResponseSchema.ts +19 -23
- package/src/api/users/schemas/resetPasswordSchema.ts +10 -17
- package/src/api/users/schemas/sessionQuerySchema.ts +3 -3
- package/src/api/users/schemas/sessionResourceSchema.ts +25 -25
- package/src/api/users/schemas/updateUserSchema.ts +3 -4
- package/src/api/users/schemas/userQuerySchema.ts +7 -7
- package/src/api/users/services/RegistrationService.ts +25 -11
- package/src/api/users/services/UserService.ts +12 -6
- package/src/api/verifications/__tests__/CodeVerification.spec.ts +63 -101
- package/src/api/verifications/__tests__/LinkVerification.spec.ts +23 -92
- package/src/api/verifications/controllers/VerificationController.ts +13 -27
- package/src/api/verifications/entities/verifications.ts +13 -14
- package/src/api/verifications/schemas/requestVerificationCodeResponseSchema.ts +17 -14
- package/src/api/verifications/schemas/validateVerificationCodeResponseSchema.ts +9 -10
- package/src/api/verifications/schemas/verificationSettingsSchema.ts +65 -66
- package/src/api/verifications/schemas/verificationTypeEnumSchema.ts +2 -2
- package/src/api/verifications/services/VerificationService.ts +12 -0
- package/src/background/__tests__/BackgroundTaskProvider.spec.ts +36 -0
- package/src/batch/__tests__/$batch.spec.ts +22 -22
- package/src/batch/__tests__/startup-buffering.spec.ts +9 -9
- package/src/bin/index.ts +1 -1
- package/src/bucket/__tests__/TenantScopedBucket.spec.ts +60 -0
- package/src/bucket/providers/LocalFileStorageProvider.ts +14 -6
- package/src/bucket/providers/MemoryFileStorageProvider.ts +18 -7
- package/src/bucket/providers/R2FileStorageProvider.ts +14 -6
- package/src/bucket/providers/S3FileStorageProvider.ts +31 -15
- package/src/cache/core/primitives/$cache.ts +7 -10
- package/src/cache/database/entities/cacheEntries.ts +16 -27
- package/src/cache/database/providers/DatabaseCacheProvider.ts +15 -13
- package/src/cache/redis/providers/RedisCacheProvider.ts +6 -6
- package/src/captcha/providers/TurnstileCaptchaProvider.ts +4 -4
- package/src/cli/core/__tests__/BuildCloudflareTask.spec.ts +178 -0
- package/src/cli/core/__tests__/BuildDockerTask.spec.ts +0 -2
- package/src/cli/core/__tests__/DbCommand.spec.ts +108 -0
- package/src/cli/core/atoms/appEntryOptions.ts +5 -5
- package/src/cli/core/atoms/buildOptions.ts +76 -88
- package/src/cli/core/atoms/changelogOptions.ts +3 -3
- package/src/cli/core/atoms/devOptions.ts +3 -3
- package/src/cli/core/commands/build.ts +36 -49
- package/src/cli/core/commands/db.ts +171 -83
- package/src/cli/core/commands/dev.ts +8 -8
- package/src/cli/core/commands/gen/changelog.ts +12 -14
- package/src/cli/core/commands/gen/env.ts +6 -6
- package/src/cli/core/commands/gen/openapi.ts +6 -6
- package/src/cli/core/commands/init.ts +28 -33
- package/src/cli/core/commands/pack.ts +10 -10
- package/src/cli/core/commands/root.ts +7 -8
- package/src/cli/core/commands/test.ts +17 -20
- package/src/cli/core/index.ts +0 -3
- package/src/cli/core/tasks/BuildCloudflareTask.ts +138 -245
- package/src/cli/core/tasks/BuildPrerenderTask.ts +44 -7
- package/src/cli/core/templates/apiHelloResponseSchemaTs.ts +4 -4
- package/src/cli/devtools/atoms/devtoolsOptions.ts +6 -6
- package/src/cli/i18n/__tests__/I18nCheckService.spec.ts +48 -0
- package/src/cli/i18n/atoms/i18nOptions.ts +8 -8
- package/src/cli/i18n/services/I18nCheckService.ts +65 -11
- package/src/cli/platform/commands/SecretsCommand.ts +24 -25
- package/src/cli/platform/commands/platform.ts +40 -46
- package/src/cli/platform/index.ts +1 -1
- package/src/cli/platform-lib/__tests__/CloudflareAdapter.spec.ts +0 -4
- package/src/cli/platform-lib/__tests__/PlatformInspector.spec.ts +10 -3
- package/src/cli/platform-lib/__tests__/VercelAdapter.spec.ts +0 -2
- package/src/cli/platform-lib/adapters/CloudflareAdapter.ts +141 -50
- package/src/cli/platform-lib/adapters/VercelAdapter.ts +6 -11
- package/src/cli/platform-lib/atoms/platformOptions.ts +46 -25
- package/src/cli/platform-lib/schemas/cloudflare.ts +87 -87
- package/src/cli/platform-lib/schemas/platform.ts +51 -51
- package/src/cli/platform-lib/schemas/vercel.ts +28 -28
- package/src/cli/platform-lib/services/CloudflareApi.ts +5 -5
- package/src/cli/platform-lib/services/VercelApi.ts +4 -4
- package/src/cli/platform-lib/services/VercelCli.ts +6 -15
- package/src/cli/platform-lib/services/WranglerApi.ts +6 -15
- package/src/cli/vendor/atoms/vendorOptions.ts +9 -9
- package/src/cli/vendor/commands/VendorCommand.ts +11 -12
- package/src/command/__tests__/$command.spec.ts +82 -83
- package/src/command/__tests__/Asker.spec.ts +6 -13
- package/src/command/__tests__/CliProvider.spec.ts +136 -149
- package/src/command/__tests__/Runner.spec.ts +86 -110
- package/src/command/helpers/Asker.ts +23 -58
- package/src/command/helpers/Runner.ts +34 -110
- package/src/command/index.ts +4 -9
- package/src/command/primitives/$command.ts +10 -10
- package/src/command/providers/CliProvider.ts +183 -161
- package/src/core/Alepha.ts +62 -13
- package/src/core/__tests__/$atom.spec.ts +52 -3
- package/src/core/__tests__/$computed.spec.ts +129 -0
- package/src/core/__tests__/$env.spec.ts +13 -13
- package/src/core/__tests__/$inject.spec.ts +4 -4
- package/src/core/__tests__/$module.spec.ts +1 -1
- package/src/core/__tests__/Alepha-graph.spec.ts +1 -1
- package/src/core/__tests__/Alepha-parseEnv.spec.ts +32 -32
- package/src/core/__tests__/Alepha-start.spec.ts +3 -3
- package/src/core/__tests__/CodecManager.spec.ts +113 -94
- package/src/core/__tests__/KeylessJsonSchemaCodec.spec.ts +138 -138
- package/src/core/__tests__/SchemaValidator.spec.ts +43 -44
- package/src/core/__tests__/StateManager.persist.browser.spec.ts +87 -0
- package/src/core/__tests__/StateManager.spec.ts +423 -0
- package/src/core/__tests__/TypeBox-usecases.spec.ts +8 -8
- package/src/core/__tests__/TypeProvider.spec.ts +314 -309
- package/src/core/__tests__/dump.spec.ts +6 -6
- package/src/core/__tests__/pagination.spec.ts +4 -4
- package/src/core/__tests__/scoped-after-start.spec.ts +43 -0
- package/src/core/errors/TypeBoxError.ts +10 -4
- package/src/core/helpers/FileLike.ts +5 -5
- package/src/core/helpers/coerceStrings.ts +70 -0
- package/src/core/helpers/jsonSchemaToZod.ts +112 -0
- package/src/core/index.shared.ts +4 -1
- package/src/core/primitives/$atom.ts +95 -27
- package/src/core/primitives/$computed.ts +148 -0
- package/src/core/primitives/$env.ts +5 -5
- package/src/core/primitives/$state.ts +1 -1
- package/src/core/providers/AlsProvider.ts +26 -0
- package/src/core/providers/CodecManager.ts +1 -2
- package/src/core/providers/JsonSchemaCodec.ts +1 -2
- package/src/core/providers/KeylessJsonSchemaCodec.ts +82 -57
- package/src/core/providers/SchemaValidator.ts +48 -158
- package/src/core/providers/StateManager.ts +383 -9
- package/src/core/providers/TypeProvider.ts +80 -734
- package/src/core/providers/ZodProvider.ts +380 -0
- package/src/core/providers/zodAugment.ts +69 -0
- package/src/core/schemas/pageQuerySchema.ts +19 -21
- package/src/core/schemas/pageSchema.ts +47 -57
- package/src/crypto/__tests__/SecretProvider.spec.ts +31 -0
- package/src/crypto/providers/SecretProvider.ts +16 -10
- package/src/datetime/primitives/$throttle.ts +6 -1
- package/src/email/brevo/providers/BrevoEmailProvider.ts +4 -4
- package/src/email/cloudflare/providers/CloudflareEmailProvider.ts +6 -6
- package/src/email/core/index.ts +7 -2
- package/src/email/core/primitives/$email.ts +5 -1
- package/src/email/core/providers/LocalEmailProvider.ts +5 -5
- package/src/email/smtp/providers/NodemailerEmailProvider.ts +41 -52
- package/src/fake/__tests__/FakeProvider.spec.ts +110 -110
- package/src/fake/__tests__/keyName.example.ts +21 -21
- package/src/fake/__tests__/keyName.spec.ts +41 -41
- package/src/fake/__tests__/module.example.ts +8 -8
- package/src/fake/providers/FakeProvider.ts +122 -121
- package/src/lock/core/__tests__/lock-mutual-exclusion.spec.ts +44 -0
- package/src/lock/core/index.ts +1 -0
- package/src/lock/core/primitives/$lock.ts +13 -6
- package/src/logger/__tests__/CliFormatterProvider.spec.ts +76 -0
- package/src/logger/__tests__/Logger.spec.ts +49 -0
- package/src/logger/index.ts +25 -18
- package/src/logger/providers/CliFormatterProvider.ts +75 -0
- package/src/logger/schemas/logEntrySchema.ts +10 -10
- package/src/logger/services/Logger.ts +18 -0
- package/src/mcp/__tests__/$prompt.spec.ts +21 -23
- package/src/mcp/__tests__/$tool.spec.ts +22 -22
- package/src/mcp/__tests__/McpServerProvider.spec.ts +82 -11
- package/src/mcp/__tests__/StreamableHttpMcpTransport.spec.ts +2 -2
- package/src/mcp/__tests__/integration.spec.ts +33 -33
- package/src/mcp/primitives/$prompt.ts +11 -9
- package/src/mcp/primitives/$tool.ts +27 -86
- package/src/mcp/providers/McpServerProvider.ts +55 -0
- package/src/mcp/transports/StreamableHttpMcpTransport.ts +7 -7
- package/src/orm/__tests__/$repository-tests.ts +133 -27
- package/src/orm/__tests__/$repository.spec.ts +23 -0
- package/src/orm/__tests__/$transactional-tests.ts +4 -4
- package/src/orm/__tests__/ModelBuilder-tests.ts +28 -28
- package/src/orm/__tests__/ModelBuilder.spec.ts +124 -106
- package/src/orm/__tests__/QueryManager.spec.ts +5 -5
- package/src/orm/__tests__/delete-returning-tests.ts +11 -11
- package/src/orm/__tests__/deletedAt-tests.ts +3 -3
- package/src/orm/__tests__/enums.spec.ts +29 -25
- package/src/orm/__tests__/execute-tests.ts +8 -8
- package/src/orm/__tests__/fixtures/bigEntitySchema.ts +48 -48
- package/src/orm/__tests__/fixtures/userEntitySchema.ts +6 -6
- package/src/orm/__tests__/joins-tests.ts +30 -30
- package/src/orm/__tests__/organization-tests.ts +105 -3
- package/src/orm/__tests__/organization.spec.ts +46 -0
- package/src/orm/__tests__/orm-errors.spec.ts +10 -10
- package/src/orm/__tests__/orm-next-tests.ts +29 -29
- package/src/orm/__tests__/orm-showcase-tests.ts +9 -9
- package/src/orm/__tests__/primaryKey.spec.ts +4 -4
- package/src/orm/__tests__/query-date-encoding-tests.ts +17 -17
- package/src/orm/__tests__/ref-auto-onDelete.spec.ts +14 -14
- package/src/orm/__tests__/references.spec.ts +7 -7
- package/src/orm/__tests__/security.spec.ts +17 -17
- package/src/orm/__tests__/string-operators-tests.ts +5 -5
- package/src/orm/__tests__/timestamps-tests.ts +14 -14
- package/src/orm/__tests__/validation-tests.ts +5 -5
- package/src/orm/core/__tests__/BunSqliteProvider.bun.spec.ts +8 -8
- package/src/orm/core/constants/PG_SYMBOLS.ts +13 -1
- package/src/orm/core/entities/alephaSequences.ts +8 -8
- package/src/orm/core/helpers/pgAttr.ts +4 -4
- package/src/orm/core/primitives/$entity.ts +10 -6
- package/src/orm/core/providers/DatabaseTypeProvider.ts +46 -53
- package/src/orm/core/providers/drivers/BunSqliteProvider.ts +8 -8
- package/src/orm/core/providers/drivers/CloudflareD1Provider.ts +3 -5
- package/src/orm/core/providers/drivers/NodeSqliteProvider.ts +8 -8
- package/src/orm/core/schemas/databaseEnvSchema.ts +4 -4
- package/src/orm/core/schemas/insertSchema.ts +14 -18
- package/src/orm/core/schemas/legacyIdSchema.ts +2 -2
- package/src/orm/core/schemas/updateSchema.ts +10 -16
- package/src/orm/core/services/PgRelationManager.ts +2 -2
- package/src/orm/core/services/QueryManager.ts +13 -2
- package/src/orm/core/services/Repository.ts +88 -33
- package/src/orm/core/services/SqliteModelBuilder.ts +38 -45
- package/src/orm/postgres/__tests__/BunPostgresProvider.bun.spec.ts +4 -4
- package/src/orm/postgres/providers/CloudflareHyperdriveProvider.ts +4 -6
- package/src/orm/postgres/schemas/postgresEnvSchema.ts +6 -6
- package/src/orm/postgres/services/PostgresModelBuilder.ts +127 -114
- package/src/queue/core/__tests__/$consumer.spec.ts +4 -4
- package/src/queue/core/__tests__/WorkerProvider.spec.ts +4 -4
- package/src/queue/core/__tests__/shared.ts +6 -6
- package/src/queue/core/primitives/$consumer.ts +5 -5
- package/src/queue/core/primitives/$queue.ts +44 -61
- package/src/queue/core/providers/CloudflareQueueProvider.ts +6 -0
- package/src/queue/core/providers/WorkerProvider.ts +17 -14
- package/src/queue/redis/providers/RedisQueueProvider.ts +3 -3
- package/src/react/core/__tests__/ErrorBoundary.browser.spec.tsx +92 -0
- package/src/react/core/__tests__/Router.spec.tsx +4 -4
- package/src/react/core/__tests__/useComputed.browser.spec.tsx +192 -0
- package/src/react/core/__tests__/useQuery.browser.spec.tsx +48 -0
- package/src/react/core/__tests__/useSelector.browser.spec.tsx +105 -0
- package/src/react/core/__tests__/useStore.browser.spec.tsx +113 -0
- package/src/react/core/components/ErrorBoundary.tsx +42 -0
- package/src/react/core/hooks/useAction.ts +56 -19
- package/src/react/core/hooks/useComputed.ts +91 -0
- package/src/react/core/hooks/useSelector.ts +67 -0
- package/src/react/core/hooks/useStore.ts +36 -17
- package/src/react/core/index.ts +3 -0
- package/src/react/core/utils/shallowEqual.ts +36 -0
- package/src/react/form/__tests__/FormModel-submit-loading.spec.ts +71 -0
- package/src/react/form/__tests__/form-submitting-reactive.browser.spec.tsx +96 -0
- package/src/react/form/__tests__/useForm.browser.spec.tsx +54 -54
- package/src/react/form/errors/FormValidationError.ts +0 -2
- package/src/react/form/hooks/useForm.ts +19 -4
- package/src/react/form/hooks/useFormQuerySync.ts +0 -0
- package/src/react/form/services/FormModel.ts +124 -86
- package/src/react/form/services/parseField.ts +66 -27
- package/src/react/i18n/__tests__/I18nProvider.spec.ts +89 -0
- package/src/react/i18n/__tests__/Localize.spec.tsx +1 -1
- package/src/react/i18n/__tests__/locale-routing.spec.ts +107 -0
- package/src/react/i18n/providers/I18nProvider.ts +173 -14
- package/src/react/router/__tests__/$page.browser.spec.tsx +19 -19
- package/src/react/router/__tests__/$page.spec.tsx +21 -21
- package/src/react/router/__tests__/ReactBrowserProvider.browser.spec.ts +87 -1
- package/src/react/router/__tests__/RouterLocaleProvider.spec.ts +127 -0
- package/src/react/router/atoms/ssrManifestAtom.ts +16 -16
- package/src/react/router/components/NestedView.tsx +11 -3
- package/src/react/router/hooks/useQueryParams.ts +1 -1
- package/src/react/router/index.browser.ts +4 -0
- package/src/react/router/index.shared.ts +1 -0
- package/src/react/router/index.ts +9 -0
- package/src/react/router/primitives/$page.ts +2 -2
- package/src/react/router/providers/ReactBrowserProvider.ts +64 -13
- package/src/react/router/providers/ReactBrowserRouterProvider.ts +15 -1
- package/src/react/router/providers/ReactPageProvider.ts +38 -13
- package/src/react/router/providers/ReactServerProvider.ts +105 -16
- package/src/react/router/providers/RootComponentsProvider.ts +13 -0
- package/src/react/router/providers/RouterLocaleProvider.ts +125 -0
- package/src/react/router/providers/__tests__/RootComponentsProvider.spec.ts +15 -0
- package/src/react/router/providers/__tests__/rootComponents.ssr.browser.spec.tsx +67 -0
- package/src/react/sitemap/__tests__/$sitemap.spec.ts +131 -0
- package/src/react/sitemap/index.browser.ts +21 -0
- package/src/react/sitemap/index.ts +25 -0
- package/src/react/sitemap/primitives/$sitemap.browser.ts +26 -0
- package/src/react/sitemap/primitives/$sitemap.ts +196 -0
- package/src/react/ui/atoms/uiAtom.ts +6 -6
- package/src/react/ui/atoms/uiThemeListAtom.ts +7 -7
- package/src/react/ui/hooks/useColorMode.ts +11 -4
- package/src/react/ui/services/SchemaControl.ts +4 -4
- package/src/redis/providers/BunRedisProvider.ts +19 -11
- package/src/redis/providers/NodeRedisProvider.ts +3 -3
- package/src/scheduler/primitives/$scheduler.ts +21 -8
- package/src/security/__tests__/assertRealmScope.spec.ts +29 -0
- package/src/security/atoms/currentTenantAtom.ts +6 -6
- package/src/security/atoms/currentUserAtom.ts +2 -2
- package/src/security/primitives/$issuer.ts +24 -2
- package/src/security/providers/JwtProvider.ts +100 -0
- package/src/security/providers/SecurityProvider.ts +43 -2
- package/src/security/schemas/permissionSchema.ts +19 -19
- package/src/security/schemas/roleSchema.ts +22 -28
- package/src/security/schemas/userAccountInfoSchema.ts +47 -37
- package/src/server/auth/__tests__/appleClientSecret.spec.ts +34 -0
- package/src/server/auth/__tests__/federationRedirectReplay.spec.ts +44 -0
- package/src/server/auth/helpers/appleClientSecret.ts +24 -0
- package/src/server/auth/helpers/jtiReplayGuard.ts +41 -0
- package/src/server/auth/helpers/safeRedirectPath.ts +19 -0
- package/src/server/auth/index.ts +1 -0
- package/src/server/auth/primitives/$auth.ts +6 -6
- package/src/server/auth/primitives/$authApple.ts +10 -10
- package/src/server/auth/primitives/$authFacebook.ts +10 -10
- package/src/server/auth/primitives/$authFranceConnect.ts +10 -10
- package/src/server/auth/primitives/$authGithub.ts +10 -10
- package/src/server/auth/primitives/$authGoogle.ts +10 -10
- package/src/server/auth/primitives/$authMicrosoft.ts +14 -14
- package/src/server/auth/providers/ServerAuthProvider.ts +67 -52
- package/src/server/auth/schemas/authenticationProviderSchema.ts +9 -12
- package/src/server/auth/schemas/tokenResponseSchema.ts +2 -2
- package/src/server/auth/schemas/tokensSchema.ts +16 -16
- package/src/server/auth/schemas/userinfoResponseSchema.ts +3 -3
- package/src/server/cookies/__tests__/AtomCookieBinding.spec.ts +80 -0
- package/src/server/cookies/__tests__/AtomCookiePersistence.browser.spec.ts +169 -0
- package/src/server/cookies/__tests__/AtomCookiePersistence.spec.ts +294 -0
- package/src/server/cookies/__tests__/ServerCookiesProvider.spec.ts +82 -12
- package/src/server/cookies/index.browser.ts +4 -1
- package/src/server/cookies/index.ts +8 -1
- package/src/server/cookies/primitives/$cookie.browser.ts +1 -1
- package/src/server/cookies/primitives/$cookie.ts +16 -0
- package/src/server/cookies/providers/AtomCookiePersistence.browser.ts +133 -0
- package/src/server/cookies/providers/AtomCookiePersistence.ts +148 -0
- package/src/server/cookies/providers/ServerCookiesProvider.ts +32 -4
- package/src/server/cookies/services/CookieParser.ts +6 -1
- package/src/server/core/__tests__/$action.spec.ts +13 -13
- package/src/server/core/__tests__/$middleware.spec.ts +10 -10
- package/src/server/core/__tests__/$route.spec.ts +9 -9
- package/src/server/core/__tests__/$sse.spec.ts +26 -26
- package/src/server/core/__tests__/BunHttpServerProvider.bun.spec.ts +6 -6
- package/src/server/core/__tests__/HttpClient.spec.ts +2 -2
- package/src/server/core/__tests__/NodeHttpServerProvider.spec.ts +15 -3
- package/src/server/core/__tests__/ServerBodyParserProvider.spec.ts +14 -14
- package/src/server/core/__tests__/ServerMultipartProvider.spec.ts +33 -33
- package/src/server/core/__tests__/ServerRouterProvider-errorHandler.spec.ts +5 -1
- package/src/server/core/__tests__/ServerRouterProvider-getRoutes.spec.ts +25 -25
- package/src/server/core/__tests__/ServerRouterProvider-serializationError.spec.ts +9 -5
- package/src/server/core/__tests__/ServerRouterProvider-validationError.spec.ts +56 -24
- package/src/server/core/errors/ValidationError.ts +6 -3
- package/src/server/core/helpers/isMultipart.ts +2 -1
- package/src/server/core/index.ts +5 -2
- package/src/server/core/interfaces/ServerRequest.ts +14 -14
- package/src/server/core/primitives/$action.ts +26 -36
- package/src/server/core/primitives/$route.ts +27 -0
- package/src/server/core/primitives/$sse.ts +3 -3
- package/src/server/core/providers/BunHttpServerProvider.ts +8 -9
- package/src/server/core/providers/NodeHttpServerProvider.ts +8 -9
- package/src/server/core/providers/ServerBodyParserProvider.ts +20 -12
- package/src/server/core/providers/ServerCompressProvider.ts +9 -10
- package/src/server/core/providers/ServerHelmetProvider.ts +26 -27
- package/src/server/core/providers/ServerMultipartProvider.ts +19 -19
- package/src/server/core/providers/ServerRouterProvider.ts +44 -15
- package/src/server/core/schemas/errorSchema.ts +20 -25
- package/src/server/core/schemas/okSchema.ts +9 -14
- package/src/server/core/services/HttpClient.ts +13 -1
- package/src/server/core/services/ServerRequestParser.ts +6 -6
- package/src/server/cors/providers/ServerCorsProvider.ts +26 -28
- package/src/server/health/schemas/healthSchema.ts +6 -6
- package/src/server/links/__tests__/$remote.spec.ts +3 -3
- package/src/server/links/__tests__/BatchEndpoint.spec.ts +9 -9
- package/src/server/links/__tests__/LinkProvider.spec.ts +9 -9
- package/src/server/links/__tests__/ServerLinksProvider.spec.ts +23 -23
- package/src/server/links/__tests__/fixtures/CrudApp.ts +21 -21
- package/src/server/links/atoms/apiLinksAtom.ts +2 -2
- package/src/server/links/atoms/linkOptionsAtom.ts +6 -6
- package/src/server/links/primitives/$remote.ts +3 -3
- package/src/server/links/providers/LinkProvider.ts +3 -3
- package/src/server/links/providers/ServerLinksProvider.ts +20 -20
- package/src/server/links/schemas/apiLinksResponseSchema.ts +23 -23
- package/src/server/proxy/__tests__/$proxy.spec.ts +9 -9
- package/src/server/proxy/providers/ServerProxyProvider.ts +5 -0
- package/src/server/rate-limit/providers/ServerRateLimitProvider.ts +18 -20
- package/src/server/swagger/__tests__/$swagger.spec.ts +91 -94
- package/src/server/swagger/__tests__/ui.spec.ts +3 -3
- package/src/server/swagger/providers/ServerSwaggerProvider.ts +66 -43
- package/src/system/__tests__/NodeShellProvider.spec.ts +46 -0
- package/src/system/providers/NodeShellProvider.ts +4 -1
- package/src/topic/core/__tests__/$subscriber.spec.ts +4 -4
- package/src/topic/core/__tests__/shared.ts +8 -8
- package/src/topic/core/primitives/$subscriber.ts +5 -5
- package/src/topic/core/primitives/$topic.ts +14 -14
- package/src/topic/redis/providers/RedisTopicProvider.ts +3 -3
- package/dist/container/core/index.d.ts +0 -236
- package/dist/container/core/index.d.ts.map +0 -1
- package/dist/container/core/index.js +0 -231
- package/dist/container/core/index.js.map +0 -1
- package/dist/container/core/index.workerd.js +0 -192
- package/dist/container/core/index.workerd.js.map +0 -1
- package/src/cli/core/tasks/BuildSitemapTask.ts +0 -130
- package/src/command/helpers/PrettyAsker.ts +0 -256
- package/src/command/helpers/PrettyPrint.ts +0 -332
- package/src/container/core/__tests__/$container.spec.ts +0 -83
- package/src/container/core/index.ts +0 -50
- package/src/container/core/index.workerd.ts +0 -53
- package/src/container/core/interfaces/ContainerOptions.ts +0 -69
- package/src/container/core/primitives/$container.ts +0 -100
- package/src/container/core/providers/CloudflareContainerProvider.ts +0 -70
- package/src/container/core/providers/ContainerProvider.ts +0 -92
- package/src/container/core/providers/MockContainerProvider.ts +0 -62
- package/src/container/core/providers/NodeContainerProvider.ts +0 -53
- package/src/core/__tests__/jsonSchemaToTypeBox.spec.ts +0 -771
- package/src/core/helpers/jsonSchemaToTypeBox.ts +0 -359
- /package/dist/orm/core/{chunk-B4FMCO8f.js → rolldown-runtime-B4FMCO8f.js} +0 -0
package/dist/command/index.js
CHANGED
|
@@ -1,187 +1,24 @@
|
|
|
1
|
-
import { $atom, $env, $hook, $inject, $module, $state, Alepha, AlephaError, KIND, Primitive, TypeBoxError, createPrimitive,
|
|
1
|
+
import { $atom, $env, $hook, $inject, $module, $state, Alepha, AlephaError, KIND, Primitive, TypeBoxError, coerceScalar, createPrimitive, z } from "alepha";
|
|
2
2
|
import { stdin, stdout } from "node:process";
|
|
3
3
|
import { createInterface } from "node:readline/promises";
|
|
4
4
|
import { $logger, ConsoleColorProvider } from "alepha/logger";
|
|
5
5
|
import { FileSystemProvider, ShellProvider } from "alepha/system";
|
|
6
|
-
import { DateTimeProvider } from "alepha/datetime";
|
|
7
6
|
import * as fs from "node:fs/promises";
|
|
8
7
|
import { cp, glob, rm } from "node:fs/promises";
|
|
9
|
-
|
|
8
|
+
import { DateTimeProvider } from "alepha/datetime";
|
|
9
|
+
//#region ../../src/command/helpers/Asker.ts
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Reads interactive input from the terminal using plain readline prompts.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* One straightforward code path: questions are printed through the logger
|
|
14
|
+
* and answers are read with Node's `readline`. No raw-mode cursor control,
|
|
15
|
+
* no ANSI framing — output stays greppable and works the same in a TTY,
|
|
16
|
+
* under CI, or when piped.
|
|
15
17
|
*/
|
|
16
|
-
var PrettyAsker = class {
|
|
17
|
-
alepha = $inject(Alepha);
|
|
18
|
-
color = $inject(ConsoleColorProvider);
|
|
19
|
-
/**
|
|
20
|
-
* Whether to use pretty mode.
|
|
21
|
-
*
|
|
22
|
-
* Same conditions as Runner.useDynamicLogger.
|
|
23
|
-
*/
|
|
24
|
-
get enabled() {
|
|
25
|
-
if (this.alepha.isCI() || this.alepha.env.CLAUDECODE) return false;
|
|
26
|
-
const logLevel = String(this.alepha.env.LOG_LEVEL || "").toLowerCase();
|
|
27
|
-
if (logLevel === "debug" || logLevel === "trace") return false;
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Print the opening frame with a title.
|
|
32
|
-
*/
|
|
33
|
-
intro(title) {
|
|
34
|
-
const c = this.color;
|
|
35
|
-
this.write(`\n${c.set("DIM", "┌")} ${c.set("BOLD", title)}\n`);
|
|
36
|
-
this.write(`${c.set("DIM", "│")}\n`);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Print the closing frame with a message.
|
|
40
|
-
*/
|
|
41
|
-
outro(message) {
|
|
42
|
-
const c = this.color;
|
|
43
|
-
this.write(`${c.set("DIM", "│")}\n`);
|
|
44
|
-
this.write(`${c.set("DIM", "└")} ${message}\n\n`);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Arrow-key select prompt for enum schemas.
|
|
48
|
-
*/
|
|
49
|
-
async select(question, options) {
|
|
50
|
-
let selectedIndex = 0;
|
|
51
|
-
this.write(`${this.color.set("DIM", "│")}\n`);
|
|
52
|
-
this.writeActiveMarker(question);
|
|
53
|
-
this.renderOptions(options, selectedIndex);
|
|
54
|
-
return new Promise((resolve, reject) => {
|
|
55
|
-
if (!(typeof stdin.setRawMode === "function")) {
|
|
56
|
-
this.clearOptions(options.length);
|
|
57
|
-
this.writeCompletedMarker(question);
|
|
58
|
-
this.writeAnswer(options[0]);
|
|
59
|
-
resolve(options[0]);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
stdin.setRawMode(true);
|
|
63
|
-
stdin.resume();
|
|
64
|
-
const onKeypress = (data) => {
|
|
65
|
-
const key = data.toString();
|
|
66
|
-
if (key === "") {
|
|
67
|
-
cleanup();
|
|
68
|
-
stdin.setRawMode(false);
|
|
69
|
-
stdin.pause();
|
|
70
|
-
reject(new AlephaError("Aborted."));
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
if (key === "\x1B[A" || key === "k") {
|
|
74
|
-
selectedIndex = (selectedIndex - 1 + options.length) % options.length;
|
|
75
|
-
this.clearOptions(options.length);
|
|
76
|
-
this.renderOptions(options, selectedIndex);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
if (key === "\x1B[B" || key === "j") {
|
|
80
|
-
selectedIndex = (selectedIndex + 1) % options.length;
|
|
81
|
-
this.clearOptions(options.length);
|
|
82
|
-
this.renderOptions(options, selectedIndex);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
if (key === "\r" || key === "\n") {
|
|
86
|
-
cleanup();
|
|
87
|
-
stdin.setRawMode(false);
|
|
88
|
-
stdin.pause();
|
|
89
|
-
this.clearOptions(options.length);
|
|
90
|
-
this.clearActiveMarker();
|
|
91
|
-
this.writeCompletedMarker(question);
|
|
92
|
-
this.writeAnswer(options[selectedIndex]);
|
|
93
|
-
resolve(options[selectedIndex]);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
const cleanup = () => {
|
|
97
|
-
stdin.removeListener("data", onKeypress);
|
|
98
|
-
};
|
|
99
|
-
stdin.on("data", onKeypress);
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Text input prompt with clack framing.
|
|
104
|
-
*/
|
|
105
|
-
async text(question, schema) {
|
|
106
|
-
const c = this.color;
|
|
107
|
-
const defaultValue = schema && "default" in schema ? String(schema.default) : void 0;
|
|
108
|
-
this.write(`${c.set("DIM", "│")}\n`);
|
|
109
|
-
this.writeActiveMarker(question);
|
|
110
|
-
const defaultHint = defaultValue ? ` ${c.set("DIM", `(${defaultValue})`)}` : "";
|
|
111
|
-
this.write(`${c.set("DIM", "│")} ${c.set("DIM", ">")}${defaultHint} `);
|
|
112
|
-
const rl = this.createPromptInterface();
|
|
113
|
-
try {
|
|
114
|
-
const value = (await rl.question("")).trim() || defaultValue || "";
|
|
115
|
-
this.write("\x1B[1A\x1B[2K");
|
|
116
|
-
this.clearActiveMarker();
|
|
117
|
-
this.writeCompletedMarker(question);
|
|
118
|
-
this.writeAnswer(value);
|
|
119
|
-
if (schema) return this.alepha.codec.decode(schema, value || void 0);
|
|
120
|
-
return value;
|
|
121
|
-
} finally {
|
|
122
|
-
rl.close();
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Yes/No confirm prompt with clack framing.
|
|
127
|
-
*/
|
|
128
|
-
async confirm(question) {
|
|
129
|
-
const c = this.color;
|
|
130
|
-
this.write(`${c.set("DIM", "│")}\n`);
|
|
131
|
-
this.writeActiveMarker(`${question} ${c.set("DIM", "(Y/n)")}`);
|
|
132
|
-
this.write(`${c.set("DIM", "│")} ${c.set("DIM", ">")} `);
|
|
133
|
-
const rl = this.createPromptInterface();
|
|
134
|
-
try {
|
|
135
|
-
const value = (await rl.question("")).trim().toLowerCase();
|
|
136
|
-
const result = value !== "n" && value !== "no";
|
|
137
|
-
this.write("\x1B[1A\x1B[2K");
|
|
138
|
-
this.clearActiveMarker();
|
|
139
|
-
this.writeCompletedMarker(question);
|
|
140
|
-
this.writeAnswer(result ? "Yes" : "No");
|
|
141
|
-
return result;
|
|
142
|
-
} finally {
|
|
143
|
-
rl.close();
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
renderOptions(options, selectedIndex) {
|
|
147
|
-
const c = this.color;
|
|
148
|
-
for (let i = 0; i < options.length; i++) {
|
|
149
|
-
const marker = i === selectedIndex ? `${c.set("CYAN", "❯")} ${c.set("CYAN", options[i])}` : ` ${c.set("DIM", options[i])}`;
|
|
150
|
-
this.write(`${c.set("DIM", "│")} ${marker}\n`);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
clearOptions(count) {
|
|
154
|
-
for (let i = 0; i < count; i++) this.write("\x1B[1A\x1B[2K");
|
|
155
|
-
}
|
|
156
|
-
writeActiveMarker(question) {
|
|
157
|
-
this.write(`${this.color.set("CYAN", "◆")} ${question}\n`);
|
|
158
|
-
}
|
|
159
|
-
clearActiveMarker() {
|
|
160
|
-
this.write("\x1B[1A\x1B[2K");
|
|
161
|
-
}
|
|
162
|
-
writeCompletedMarker(question) {
|
|
163
|
-
this.write(`${this.color.set("DIM", "◇")} ${question}\n`);
|
|
164
|
-
}
|
|
165
|
-
writeAnswer(value) {
|
|
166
|
-
this.write(`${this.color.set("DIM", "│")} ${this.color.set("DIM", value)}\n`);
|
|
167
|
-
}
|
|
168
|
-
write(str) {
|
|
169
|
-
stdout.write(str);
|
|
170
|
-
}
|
|
171
|
-
createPromptInterface() {
|
|
172
|
-
return createInterface({
|
|
173
|
-
input: stdin,
|
|
174
|
-
output: stdout
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
//#endregion
|
|
179
|
-
//#region ../../src/command/helpers/Asker.ts
|
|
180
18
|
var Asker = class {
|
|
181
19
|
log = $logger();
|
|
182
20
|
ask;
|
|
183
21
|
alepha = $inject(Alepha);
|
|
184
|
-
pretty = $inject(PrettyAsker);
|
|
185
22
|
constructor() {
|
|
186
23
|
this.ask = this.createAskMethod();
|
|
187
24
|
}
|
|
@@ -190,45 +27,23 @@ var Asker = class {
|
|
|
190
27
|
return await this.prompt(question, options);
|
|
191
28
|
};
|
|
192
29
|
askFn.permission = async (question) => {
|
|
193
|
-
|
|
194
|
-
return (await this.prompt(`${question} [Y/n]`, { schema: t.enum([
|
|
30
|
+
return (await this.prompt(`${question} [Y/n]`, { schema: z.enum([
|
|
195
31
|
"Y",
|
|
196
32
|
"y",
|
|
197
33
|
"n",
|
|
198
34
|
"no",
|
|
199
35
|
"yes"
|
|
200
|
-
]
|
|
36
|
+
]).default("Y") })).charAt(0).toLowerCase() === "y";
|
|
201
37
|
};
|
|
202
38
|
askFn.intro = (title) => {
|
|
203
|
-
|
|
39
|
+
this.log.info(title);
|
|
204
40
|
};
|
|
205
41
|
askFn.outro = (message) => {
|
|
206
|
-
if (
|
|
42
|
+
if (message) this.log.info(message);
|
|
207
43
|
};
|
|
208
44
|
return askFn;
|
|
209
45
|
}
|
|
210
46
|
async prompt(question, options) {
|
|
211
|
-
if (this.pretty.enabled) return this.prettyPrompt(question, options);
|
|
212
|
-
return this.plainPrompt(question, options);
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Pretty mode: delegate to PrettyAsker based on schema type.
|
|
216
|
-
*/
|
|
217
|
-
async prettyPrompt(question, options) {
|
|
218
|
-
const schema = options.schema;
|
|
219
|
-
if (schema?.enum && Array.isArray(schema.enum)) {
|
|
220
|
-
const value = await this.pretty.select(question, schema.enum);
|
|
221
|
-
if (options.validate) options.validate(value);
|
|
222
|
-
return value;
|
|
223
|
-
}
|
|
224
|
-
const value = await this.pretty.text(question, schema);
|
|
225
|
-
if (options.validate) options.validate(value);
|
|
226
|
-
return value;
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Plain mode: readline-based prompts (CI, Claude Code, debug).
|
|
230
|
-
*/
|
|
231
|
-
async plainPrompt(question, options) {
|
|
232
47
|
const rl = this.createPromptInterface();
|
|
233
48
|
let value;
|
|
234
49
|
try {
|
|
@@ -236,8 +51,10 @@ var Asker = class {
|
|
|
236
51
|
try {
|
|
237
52
|
this.log.info(question);
|
|
238
53
|
const answer = await rl.question("> ");
|
|
239
|
-
if (options.schema)
|
|
240
|
-
|
|
54
|
+
if (options.schema) {
|
|
55
|
+
const raw = answer ? answer.trim() : void 0;
|
|
56
|
+
value = this.alepha.codec.decode(options.schema, raw === void 0 ? void 0 : coerceScalar(options.schema, raw));
|
|
57
|
+
} else value = String(answer.trim());
|
|
241
58
|
if (options.validate) options.validate(value);
|
|
242
59
|
} catch (error) {
|
|
243
60
|
if (error instanceof AlephaError) {
|
|
@@ -315,259 +132,41 @@ var EnvUtils = class {
|
|
|
315
132
|
}
|
|
316
133
|
};
|
|
317
134
|
//#endregion
|
|
318
|
-
//#region ../../src/command/helpers/PrettyPrint.ts
|
|
319
|
-
var PrettyPrint = class {
|
|
320
|
-
dateTimeProvider = $inject(DateTimeProvider);
|
|
321
|
-
spinnerInterval;
|
|
322
|
-
frames = [
|
|
323
|
-
"⠋",
|
|
324
|
-
"⠙",
|
|
325
|
-
"⠹",
|
|
326
|
-
"⠸",
|
|
327
|
-
"⠼",
|
|
328
|
-
"⠴",
|
|
329
|
-
"⠦",
|
|
330
|
-
"⠧",
|
|
331
|
-
"⠇",
|
|
332
|
-
"⠏"
|
|
333
|
-
];
|
|
334
|
-
tasks = /* @__PURE__ */ new Map();
|
|
335
|
-
lastLineCount = 0;
|
|
336
|
-
header;
|
|
337
|
-
commandStartTime;
|
|
338
|
-
paused = false;
|
|
339
|
-
originalStdoutWrite;
|
|
340
|
-
bufferedOutput = [];
|
|
341
|
-
isOwnWrite = false;
|
|
342
|
-
colors = {
|
|
343
|
-
reset: "\x1B[0m",
|
|
344
|
-
cyan: "\x1B[36m",
|
|
345
|
-
green: "\x1B[32m",
|
|
346
|
-
red: "\x1B[31m",
|
|
347
|
-
dim: "\x1B[2m"
|
|
348
|
-
};
|
|
349
|
-
/**
|
|
350
|
-
* Start a new command session with header
|
|
351
|
-
*/
|
|
352
|
-
startCommand(cliName, commandName) {
|
|
353
|
-
this.header = commandName ? `${cliName} ${commandName}` : cliName;
|
|
354
|
-
this.commandStartTime = this.dateTimeProvider.nowMillis();
|
|
355
|
-
this.tasks.clear();
|
|
356
|
-
this.lastLineCount = 0;
|
|
357
|
-
this.write(`┌─ ${this.header}\n`);
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* End the command session with footer
|
|
361
|
-
*/
|
|
362
|
-
endCommand() {
|
|
363
|
-
this.restoreStdout();
|
|
364
|
-
if (this.commandStartTime) {
|
|
365
|
-
const totalDuration = ((this.dateTimeProvider.nowMillis() - this.commandStartTime) / 1e3).toFixed(1);
|
|
366
|
-
this.write(`└─ Done in ${totalDuration}s\n`);
|
|
367
|
-
}
|
|
368
|
-
this.header = void 0;
|
|
369
|
-
this.commandStartTime = void 0;
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* Start an animated spinner with a task name
|
|
373
|
-
*/
|
|
374
|
-
startSpinner(id, taskName) {
|
|
375
|
-
this.tasks.set(id, {
|
|
376
|
-
taskName,
|
|
377
|
-
frameIndex: 0,
|
|
378
|
-
status: "running",
|
|
379
|
-
startTime: this.dateTimeProvider.nowMillis()
|
|
380
|
-
});
|
|
381
|
-
this.interceptStdout();
|
|
382
|
-
if (!this.spinnerInterval) this.spinnerInterval = this.dateTimeProvider.createInterval(() => this.updateDisplay(), 80, true);
|
|
383
|
-
this.updateDisplay();
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Stop the spinner and show success with a tick
|
|
387
|
-
*/
|
|
388
|
-
success(id, taskName, duration, message) {
|
|
389
|
-
const task = this.tasks.get(id);
|
|
390
|
-
if (task) {
|
|
391
|
-
task.status = "success";
|
|
392
|
-
if (taskName) task.taskName = taskName;
|
|
393
|
-
if (duration) task.duration = duration;
|
|
394
|
-
if (message) task.message = message;
|
|
395
|
-
this.updateDisplay();
|
|
396
|
-
}
|
|
397
|
-
this.checkIfAllDone();
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
* Stop the spinner and show error with a cross
|
|
401
|
-
*/
|
|
402
|
-
error(id, taskName) {
|
|
403
|
-
const task = this.tasks.get(id);
|
|
404
|
-
if (task) {
|
|
405
|
-
task.status = "error";
|
|
406
|
-
if (taskName) task.taskName = taskName;
|
|
407
|
-
this.updateDisplay();
|
|
408
|
-
}
|
|
409
|
-
this.checkIfAllDone();
|
|
410
|
-
this.restoreStdout();
|
|
411
|
-
}
|
|
412
|
-
/**
|
|
413
|
-
* Update the display for all tasks
|
|
414
|
-
*/
|
|
415
|
-
updateDisplay() {
|
|
416
|
-
if (this.lastLineCount > 0) for (let i = 0; i < this.lastLineCount; i++) this.write("\x1B[1A\x1B[2K");
|
|
417
|
-
if (this.bufferedOutput.length > 0) {
|
|
418
|
-
for (const chunk of this.bufferedOutput) this.write(chunk);
|
|
419
|
-
this.bufferedOutput = [];
|
|
420
|
-
}
|
|
421
|
-
const taskArray = Array.from(this.tasks.values());
|
|
422
|
-
const prefix = this.header ? "│ " : "";
|
|
423
|
-
for (const task of taskArray) {
|
|
424
|
-
let line = prefix;
|
|
425
|
-
if (task.status === "running") {
|
|
426
|
-
const frame = this.frames[task.frameIndex];
|
|
427
|
-
const elapsed = String(Math.floor((this.dateTimeProvider.nowMillis() - task.startTime) / 100) / 10).padEnd(3, ".0");
|
|
428
|
-
line += `${this.colors.cyan}${frame}${this.colors.reset} ${this.colors.dim}${task.taskName}${this.colors.reset} ${this.colors.dim}${elapsed}s${this.colors.reset}`;
|
|
429
|
-
task.frameIndex = (task.frameIndex + 1) % this.frames.length;
|
|
430
|
-
} else if (task.status === "success") {
|
|
431
|
-
const durationStr = task.duration ? ` ${this.colors.dim}${task.duration}${this.colors.reset}` : "";
|
|
432
|
-
const messageStr = task.message ? ` - ${task.message}` : "";
|
|
433
|
-
line += `${this.colors.green}✓${this.colors.reset} ${task.taskName}${durationStr}${messageStr}`;
|
|
434
|
-
} else if (task.status === "error") line += `${this.colors.red}✗${this.colors.reset} ${task.taskName}`;
|
|
435
|
-
this.write(`${line}\n`);
|
|
436
|
-
}
|
|
437
|
-
this.lastLineCount = taskArray.length;
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* Check if all tasks are done and stop the interval
|
|
441
|
-
*/
|
|
442
|
-
checkIfAllDone() {
|
|
443
|
-
if (!Array.from(this.tasks.values()).some((task) => task.status === "running") && this.spinnerInterval) {
|
|
444
|
-
this.dateTimeProvider.clearInterval(this.spinnerInterval);
|
|
445
|
-
this.spinnerInterval = void 0;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
/**
|
|
449
|
-
* Pause the spinner animation and restore stdout so external processes
|
|
450
|
-
* (e.g. interactive login) can write to the terminal directly.
|
|
451
|
-
*/
|
|
452
|
-
pause() {
|
|
453
|
-
if (this.paused) return;
|
|
454
|
-
this.paused = true;
|
|
455
|
-
this.stopSpinner();
|
|
456
|
-
if (this.lastLineCount > 0) {
|
|
457
|
-
for (let i = 0; i < this.lastLineCount; i++) this.write("\x1B[1A\x1B[2K");
|
|
458
|
-
this.lastLineCount = 0;
|
|
459
|
-
}
|
|
460
|
-
if (this.header) this.write("└───\n\n");
|
|
461
|
-
this.restoreStdout();
|
|
462
|
-
}
|
|
463
|
-
/**
|
|
464
|
-
* Resume the spinner animation after a pause.
|
|
465
|
-
*/
|
|
466
|
-
resume() {
|
|
467
|
-
if (!this.paused) return;
|
|
468
|
-
this.paused = false;
|
|
469
|
-
if (this.header) this.write("\n┌───\n");
|
|
470
|
-
this.interceptStdout();
|
|
471
|
-
if (Array.from(this.tasks.values()).some((task) => task.status === "running")) {
|
|
472
|
-
this.updateDisplay();
|
|
473
|
-
if (!this.spinnerInterval) this.spinnerInterval = this.dateTimeProvider.createInterval(() => this.updateDisplay(), 80, true);
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
/**
|
|
477
|
-
* Stop the spinner without showing any symbol
|
|
478
|
-
*/
|
|
479
|
-
stopSpinner() {
|
|
480
|
-
if (this.spinnerInterval) {
|
|
481
|
-
this.dateTimeProvider.clearInterval(this.spinnerInterval);
|
|
482
|
-
this.spinnerInterval = void 0;
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
/**
|
|
486
|
-
* Clear all tasks
|
|
487
|
-
*/
|
|
488
|
-
clear() {
|
|
489
|
-
this.tasks.clear();
|
|
490
|
-
this.stopSpinner();
|
|
491
|
-
this.restoreStdout();
|
|
492
|
-
this.lastLineCount = 0;
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* Intercept process.stdout.write so external writes (logs, wrangler output)
|
|
496
|
-
* are buffered instead of breaking the spinner animation. Buffered output is
|
|
497
|
-
* flushed above the spinner area on each redraw.
|
|
498
|
-
*/
|
|
499
|
-
interceptStdout() {
|
|
500
|
-
if (this.originalStdoutWrite) return;
|
|
501
|
-
const original = process.stdout.write.bind(process.stdout);
|
|
502
|
-
this.originalStdoutWrite = original;
|
|
503
|
-
process.stdout.write = ((chunk, encodingOrCb, cb) => {
|
|
504
|
-
if (this.isOwnWrite) return original(chunk, encodingOrCb, cb);
|
|
505
|
-
this.bufferedOutput.push(String(chunk));
|
|
506
|
-
return true;
|
|
507
|
-
});
|
|
508
|
-
}
|
|
509
|
-
/**
|
|
510
|
-
* Restore the original process.stdout.write and flush remaining buffer.
|
|
511
|
-
*/
|
|
512
|
-
restoreStdout() {
|
|
513
|
-
if (!this.originalStdoutWrite) return;
|
|
514
|
-
const original = this.originalStdoutWrite;
|
|
515
|
-
this.originalStdoutWrite = void 0;
|
|
516
|
-
process.stdout.write = original;
|
|
517
|
-
for (const chunk of this.bufferedOutput) original(chunk);
|
|
518
|
-
this.bufferedOutput = [];
|
|
519
|
-
}
|
|
520
|
-
/**
|
|
521
|
-
* Write to stdout bypassing the intercept.
|
|
522
|
-
*/
|
|
523
|
-
write(str) {
|
|
524
|
-
this.isOwnWrite = true;
|
|
525
|
-
process.stdout.write(str);
|
|
526
|
-
this.isOwnWrite = false;
|
|
527
|
-
}
|
|
528
|
-
};
|
|
529
|
-
//#endregion
|
|
530
135
|
//#region ../../src/command/errors/CommandError.ts
|
|
531
136
|
var CommandError = class extends AlephaError {
|
|
532
137
|
name = "CommandError";
|
|
533
138
|
};
|
|
534
139
|
//#endregion
|
|
535
140
|
//#region ../../src/command/helpers/Runner.ts
|
|
141
|
+
/**
|
|
142
|
+
* Runs CLI tasks (shell commands or functions) and logs their lifecycle.
|
|
143
|
+
*
|
|
144
|
+
* Output is intentionally plain and verbose: every task logs a
|
|
145
|
+
* `Starting …` / `Finished … after Ns` line through the standard logger,
|
|
146
|
+
* and shelled commands **stream** their stdout/stderr straight to the
|
|
147
|
+
* terminal (`capture: false`) so tool output — `vite build` warnings,
|
|
148
|
+
* Biome diagnostics, nested `alepha` subcommands — is visible live.
|
|
149
|
+
*/
|
|
536
150
|
var Runner = class {
|
|
537
151
|
log = $logger();
|
|
538
152
|
dateTime = $inject(DateTimeProvider);
|
|
539
153
|
timers = [];
|
|
540
154
|
startTime = this.dateTime.nowMillis();
|
|
541
|
-
prettyPrint = $inject(PrettyPrint);
|
|
542
155
|
alepha = $inject(Alepha);
|
|
543
156
|
shell = $inject(ShellProvider);
|
|
544
157
|
run;
|
|
545
|
-
cliName = "";
|
|
546
|
-
commandName = "";
|
|
547
|
-
firstTaskStarted = false;
|
|
548
|
-
taskCounter = 0;
|
|
549
158
|
constructor() {
|
|
550
159
|
this.run = this.createRunMethod();
|
|
551
160
|
}
|
|
552
|
-
get useDynamicLogger() {
|
|
553
|
-
if (this.alepha.isCI() || this.alepha.env.CLAUDECODE) return false;
|
|
554
|
-
const logLevel = String(this.alepha.store.get("alepha.logger.level") ?? this.alepha.env.LOG_LEVEL ?? "").toLowerCase();
|
|
555
|
-
if (logLevel === "debug" || logLevel === "trace") return false;
|
|
556
|
-
return (this.alepha.store.get("alepha.logger.format") ?? this.alepha.env.LOG_FORMAT) === "raw";
|
|
557
|
-
}
|
|
558
161
|
/**
|
|
559
|
-
* Start a new command session
|
|
162
|
+
* Start a new command session.
|
|
163
|
+
*
|
|
164
|
+
* Retained for API compatibility (the CLI calls it before each command);
|
|
165
|
+
* task lifecycle is now logged statelessly, so there is nothing to reset.
|
|
560
166
|
*/
|
|
561
|
-
startCommand(
|
|
562
|
-
this.cliName = cliName;
|
|
563
|
-
this.commandName = commandName;
|
|
564
|
-
this.firstTaskStarted = false;
|
|
565
|
-
this.taskCounter = 0;
|
|
566
|
-
}
|
|
167
|
+
startCommand(_cliName, _commandName) {}
|
|
567
168
|
createRunMethod() {
|
|
568
169
|
const runFn = async (cmd, options) => {
|
|
569
|
-
if (this.useDynamicLogger && !this.firstTaskStarted) this.prettyPrint.startCommand(this.cliName, this.commandName);
|
|
570
|
-
this.firstTaskStarted = true;
|
|
571
170
|
const root = typeof options === "object" && options.root ? options.root : void 0;
|
|
572
171
|
if (Array.isArray(cmd)) return await this.execute(cmd.map((it) => typeof it === "string" ? {
|
|
573
172
|
name: it,
|
|
@@ -610,18 +209,13 @@ var Runner = class {
|
|
|
610
209
|
}, options);
|
|
611
210
|
};
|
|
612
211
|
runFn.end = () => this.end();
|
|
613
|
-
runFn.pause = () => {
|
|
614
|
-
if (this.useDynamicLogger) this.prettyPrint.pause();
|
|
615
|
-
};
|
|
616
|
-
runFn.resume = () => {
|
|
617
|
-
if (this.useDynamicLogger) this.prettyPrint.resume();
|
|
618
|
-
};
|
|
619
212
|
return runFn;
|
|
620
213
|
}
|
|
621
214
|
async exec(cmd, opts = {}) {
|
|
215
|
+
const stream = this.log.isLevelEnabled("DEBUG");
|
|
622
216
|
return this.shell.run(cmd, {
|
|
623
217
|
root: opts.root,
|
|
624
|
-
capture:
|
|
218
|
+
capture: !stream
|
|
625
219
|
});
|
|
626
220
|
}
|
|
627
221
|
/**
|
|
@@ -639,55 +233,34 @@ var Runner = class {
|
|
|
639
233
|
* Prints a summary of all executed tasks and their durations.
|
|
640
234
|
*/
|
|
641
235
|
end() {
|
|
642
|
-
if (this.useDynamicLogger && this.firstTaskStarted) {
|
|
643
|
-
this.prettyPrint.endCommand();
|
|
644
|
-
return;
|
|
645
|
-
}
|
|
646
236
|
if (this.timers.length === 0) return;
|
|
647
|
-
this.log.info("");
|
|
648
237
|
const totalTime = ((this.dateTime.nowMillis() - this.startTime) / 1e3).toFixed(1);
|
|
649
238
|
this.log.info(`Total time: ${totalTime}s`);
|
|
650
|
-
this.log.info(``);
|
|
651
239
|
this.timers = [];
|
|
652
240
|
}
|
|
653
241
|
async executeTask(task) {
|
|
654
242
|
const now = this.dateTime.nowMillis();
|
|
655
|
-
|
|
656
|
-
if (this.useDynamicLogger) this.prettyPrint.startSpinner(taskId, task.name);
|
|
657
|
-
else this.log.info(`Starting '${task.name}' ...`);
|
|
243
|
+
this.log.info(`Starting '${task.name}' ...`);
|
|
658
244
|
let stdout = "";
|
|
659
245
|
try {
|
|
660
246
|
stdout = String(await task.handler() ?? "");
|
|
661
247
|
} catch (error) {
|
|
662
|
-
|
|
663
|
-
|
|
248
|
+
const err = error;
|
|
249
|
+
const captured = [err?.stdout, err?.stderr].filter(Boolean).join("\n").trim();
|
|
250
|
+
if (captured) this.log.info(`\n\n${captured}`);
|
|
664
251
|
throw new CommandError(`Task '${task.name}' failed`, { cause: error });
|
|
665
252
|
}
|
|
666
253
|
if (stdout) this.log.trace(stdout);
|
|
667
254
|
const duration = ((this.dateTime.nowMillis() - now) / 1e3).toFixed(1);
|
|
668
255
|
const message = stdout && !stdout.includes("\n") ? stdout.trim() : void 0;
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
const suffix = message ? ` - ${message}` : "";
|
|
672
|
-
this.log.info(`Finished '${task.name}' after ${duration}s${suffix}`);
|
|
673
|
-
}
|
|
256
|
+
const suffix = message ? ` - ${message}` : "";
|
|
257
|
+
this.log.info(`Finished '${task.name}' after ${duration}s${suffix}`);
|
|
674
258
|
this.timers.push({
|
|
675
259
|
name: task.name,
|
|
676
260
|
duration: `${duration}s`
|
|
677
261
|
});
|
|
678
262
|
return stdout;
|
|
679
263
|
}
|
|
680
|
-
renderTable(data) {
|
|
681
|
-
if (data.length === 0) return;
|
|
682
|
-
const col1Width = Math.max(...data.map(([col1]) => col1.length), 7);
|
|
683
|
-
const col2Width = Math.max(...data.map(([, col2]) => col2.length), 8);
|
|
684
|
-
const divider = `+${"-".repeat(col1Width + 2)}+${"-".repeat(col2Width + 2)}+`;
|
|
685
|
-
this.log.info(divider);
|
|
686
|
-
this.log.info(`| ${"Command".padEnd(col1Width)} | ${"Duration".padEnd(col2Width)} |`);
|
|
687
|
-
this.log.info(divider);
|
|
688
|
-
for (const [col1, col2] of data) this.log.info(`| ${col1.padEnd(col1Width)} | ${col2.padEnd(col2Width)} |`);
|
|
689
|
-
this.log.info(divider);
|
|
690
|
-
}
|
|
691
264
|
};
|
|
692
265
|
//#endregion
|
|
693
266
|
//#region ../../src/command/primitives/$command.ts
|
|
@@ -699,8 +272,8 @@ var Runner = class {
|
|
|
699
272
|
*/
|
|
700
273
|
const $command = (options) => createPrimitive(CommandPrimitive, options);
|
|
701
274
|
var CommandPrimitive = class extends Primitive {
|
|
702
|
-
flags = this.options.flags ??
|
|
703
|
-
env = this.options.env ??
|
|
275
|
+
flags = this.options.flags ?? z.object({});
|
|
276
|
+
env = this.options.env ?? z.object({});
|
|
704
277
|
aliases = this.options.aliases ?? [];
|
|
705
278
|
onInit() {
|
|
706
279
|
if (this.options.pre || this.options.post) this.options.hide ??= true;
|
|
@@ -733,12 +306,12 @@ var CommandPrimitive = class extends Primitive {
|
|
|
733
306
|
$command[KIND] = CommandPrimitive;
|
|
734
307
|
//#endregion
|
|
735
308
|
//#region ../../src/command/providers/CliProvider.ts
|
|
736
|
-
const envSchema =
|
|
737
|
-
CLI_NAME:
|
|
309
|
+
const envSchema = z.object({
|
|
310
|
+
CLI_NAME: z.text({
|
|
738
311
|
default: "cli",
|
|
739
312
|
description: "Name of the CLI application."
|
|
740
313
|
}),
|
|
741
|
-
CLI_DESCRIPTION:
|
|
314
|
+
CLI_DESCRIPTION: z.text({
|
|
742
315
|
default: "",
|
|
743
316
|
description: "Description of the CLI application."
|
|
744
317
|
})
|
|
@@ -748,10 +321,10 @@ const envSchema = t.object({
|
|
|
748
321
|
*/
|
|
749
322
|
const cliOptions = $atom({
|
|
750
323
|
name: "alepha.command.cli.options",
|
|
751
|
-
schema:
|
|
752
|
-
name:
|
|
753
|
-
description:
|
|
754
|
-
argv:
|
|
324
|
+
schema: z.object({
|
|
325
|
+
name: z.string().describe("Name of the CLI application.").optional(),
|
|
326
|
+
description: z.string().describe("Description of the CLI application.").optional(),
|
|
327
|
+
argv: z.array(z.string()).describe("Command line arguments to parse.").optional()
|
|
755
328
|
}),
|
|
756
329
|
default: {}
|
|
757
330
|
});
|
|
@@ -772,7 +345,7 @@ const cliOptions = $atom({
|
|
|
772
345
|
* build = $command({
|
|
773
346
|
* name: "build",
|
|
774
347
|
* description: "Build the project",
|
|
775
|
-
* flags:
|
|
348
|
+
* flags: z.object({ watch: z.boolean().optional() }),
|
|
776
349
|
* handler: async ({ flags }) => { ... }
|
|
777
350
|
* });
|
|
778
351
|
* }
|
|
@@ -806,12 +379,12 @@ var CliProvider = class {
|
|
|
806
379
|
help: {
|
|
807
380
|
aliases: ["h", "help"],
|
|
808
381
|
description: "Show this help message",
|
|
809
|
-
schema:
|
|
382
|
+
schema: z.boolean()
|
|
810
383
|
},
|
|
811
384
|
verbose: {
|
|
812
385
|
aliases: ["verbose"],
|
|
813
|
-
description: "Verbose output:
|
|
814
|
-
schema:
|
|
386
|
+
description: "Verbose output: trace-level logs (framework internals) in pretty format. Task output already streams by default.",
|
|
387
|
+
schema: z.boolean()
|
|
815
388
|
}
|
|
816
389
|
};
|
|
817
390
|
/**
|
|
@@ -828,8 +401,8 @@ var CliProvider = class {
|
|
|
828
401
|
key,
|
|
829
402
|
...value
|
|
830
403
|
})), { strict: false });
|
|
831
|
-
if (globalFlags.verbose) {
|
|
832
|
-
this.alepha.store.set("alepha.logger.level", "
|
|
404
|
+
if (globalFlags.verbose || !!this.alepha.env.CLAUDECODE) {
|
|
405
|
+
this.alepha.store.set("alepha.logger.level", "trace");
|
|
833
406
|
this.alepha.store.set("alepha.logger.format", "pretty");
|
|
834
407
|
}
|
|
835
408
|
if (globalFlags.help) {
|
|
@@ -1050,21 +623,44 @@ var CliProvider = class {
|
|
|
1050
623
|
return { ...this.globalFlags };
|
|
1051
624
|
}
|
|
1052
625
|
/**
|
|
626
|
+
* Read a schema's metadata (`title`, `description`, `aliases`, `alias`, …).
|
|
627
|
+
*
|
|
628
|
+
* Under zod these options live on the schema's `.meta()` registry rather than
|
|
629
|
+
* as direct properties (typebox), and they sit on the INNER schema — so any
|
|
630
|
+
* optional / nullable / default wrappers are peeled first.
|
|
631
|
+
*/
|
|
632
|
+
schemaMeta(schema) {
|
|
633
|
+
if (!schema) return {};
|
|
634
|
+
const base = z.schema.unwrap(schema);
|
|
635
|
+
return (typeof base?.meta === "function" ? base.meta() : void 0) ?? {};
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Build flag definitions (key, aliases, description, schema) from a flags
|
|
639
|
+
* object schema. Centralises the metadata reading so every call-site (parsing,
|
|
640
|
+
* arg-splitting, help) extracts aliases/descriptions the same way.
|
|
641
|
+
*/
|
|
642
|
+
extractFlagDefs(schema) {
|
|
643
|
+
return Object.entries(schema.properties).map(([key, value]) => {
|
|
644
|
+
const meta = this.schemaMeta(value);
|
|
645
|
+
return {
|
|
646
|
+
key,
|
|
647
|
+
aliases: [key, ...meta.aliases ?? (meta.alias ? [meta.alias] : [])],
|
|
648
|
+
description: meta.description,
|
|
649
|
+
schema: value
|
|
650
|
+
};
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
1053
654
|
* Parse command flags from argv using the command's flag schema
|
|
1054
655
|
*/
|
|
1055
656
|
parseCommandFlags(argv, schema, options = {}) {
|
|
1056
657
|
const { modeEnabled = false } = options;
|
|
1057
|
-
const flagDefs =
|
|
1058
|
-
key,
|
|
1059
|
-
aliases: [key, ...value.aliases ?? (value.alias ? [value.alias] : void 0) ?? []],
|
|
1060
|
-
description: value.description,
|
|
1061
|
-
schema: value
|
|
1062
|
-
}));
|
|
658
|
+
const flagDefs = this.extractFlagDefs(schema);
|
|
1063
659
|
if (modeEnabled) flagDefs.push({
|
|
1064
660
|
key: "__mode__",
|
|
1065
661
|
aliases: ["mode", "m"],
|
|
1066
662
|
description: void 0,
|
|
1067
|
-
schema:
|
|
663
|
+
schema: z.string()
|
|
1068
664
|
});
|
|
1069
665
|
const claimed = new Set(flagDefs.flatMap((d) => d.aliases));
|
|
1070
666
|
for (const [key, value] of Object.entries(this.getAllGlobalFlags())) {
|
|
@@ -1079,9 +675,9 @@ var CliProvider = class {
|
|
|
1079
675
|
const parsed = this.parseFlags(argv, flagDefs);
|
|
1080
676
|
parsed.__mode__ = void 0;
|
|
1081
677
|
for (const key of Object.keys(parsed)) if (key.startsWith("__global_")) delete parsed[key];
|
|
1082
|
-
for (const [key, value] of Object.entries(schema.properties)) if (!(key in parsed)
|
|
1083
|
-
const
|
|
1084
|
-
if (
|
|
678
|
+
for (const [key, value] of Object.entries(schema.properties)) if (!(key in parsed)) {
|
|
679
|
+
const def = z.schema.getDefault(value);
|
|
680
|
+
if (def !== void 0) parsed[key] = def;
|
|
1085
681
|
}
|
|
1086
682
|
try {
|
|
1087
683
|
return this.alepha.codec.decode(schema, parsed);
|
|
@@ -1099,8 +695,11 @@ var CliProvider = class {
|
|
|
1099
695
|
for (const [key, propSchema] of Object.entries(schema.properties)) {
|
|
1100
696
|
const value = process.env[key];
|
|
1101
697
|
if (value !== void 0) result[key] = value;
|
|
1102
|
-
else
|
|
1103
|
-
|
|
698
|
+
else {
|
|
699
|
+
const def = z.schema.getDefault(propSchema);
|
|
700
|
+
if (def !== void 0) result[key] = def;
|
|
701
|
+
else if (z.schema.isOptional(propSchema)) {} else missing.push(key);
|
|
702
|
+
}
|
|
1104
703
|
}
|
|
1105
704
|
if (missing.length > 0) {
|
|
1106
705
|
const vars = missing.join(", ");
|
|
@@ -1146,42 +745,47 @@ var CliProvider = class {
|
|
|
1146
745
|
const arg = argv[i];
|
|
1147
746
|
if (!arg.startsWith("-")) continue;
|
|
1148
747
|
const [rawKey, ...valueParts] = arg.replace(/^-{1,2}/, "").split("=");
|
|
1149
|
-
|
|
748
|
+
const value = valueParts.join("=");
|
|
1150
749
|
const def = flagDefs.find((d) => d.aliases.includes(rawKey));
|
|
1151
750
|
if (!def) {
|
|
1152
751
|
if (strict) throw new CommandError(`Unknown flag: --${rawKey}`);
|
|
1153
752
|
continue;
|
|
1154
753
|
}
|
|
1155
|
-
const
|
|
1156
|
-
|
|
754
|
+
const base = z.schema.unwrap(def.schema);
|
|
755
|
+
const isUnionWithBoolean = z.schema.isUnion(base) && base.anyOf.some((s) => z.schema.isBoolean(s));
|
|
756
|
+
if (z.schema.isBoolean(base)) result[def.key] = true;
|
|
1157
757
|
else if (isUnionWithBoolean && !value) {
|
|
1158
758
|
const nextArg = argv[i + 1];
|
|
1159
759
|
if (nextArg && !nextArg.startsWith("-")) {
|
|
1160
760
|
result[def.key] = nextArg;
|
|
1161
761
|
i++;
|
|
1162
762
|
} else result[def.key] = true;
|
|
1163
|
-
} else if (value)
|
|
1164
|
-
if (t.schema.isObject(def.schema) || t.schema.isArray(def.schema)) result[def.key] = JSON.parse(value);
|
|
1165
|
-
else result[def.key] = value;
|
|
1166
|
-
} catch {
|
|
1167
|
-
throw new CommandError(`Invalid JSON value for flag --${rawKey}`);
|
|
1168
|
-
}
|
|
763
|
+
} else if (value) result[def.key] = this.castFlagValue(value, base, rawKey);
|
|
1169
764
|
else {
|
|
1170
765
|
const nextArg = argv[i + 1];
|
|
1171
|
-
if (nextArg && !nextArg.startsWith("-"))
|
|
1172
|
-
|
|
1173
|
-
try {
|
|
1174
|
-
if (t.schema.isObject(def.schema) || t.schema.isArray(def.schema)) result[def.key] = JSON.parse(value);
|
|
1175
|
-
else result[def.key] = value;
|
|
1176
|
-
} catch {
|
|
1177
|
-
throw new CommandError(`Invalid JSON value for flag --${rawKey}`);
|
|
1178
|
-
}
|
|
1179
|
-
} else throw new CommandError(`Flag --${rawKey} requires a value.`);
|
|
766
|
+
if (nextArg && !nextArg.startsWith("-")) result[def.key] = this.castFlagValue(nextArg, base, rawKey);
|
|
767
|
+
else throw new CommandError(`Flag --${rawKey} requires a value.`);
|
|
1180
768
|
}
|
|
1181
769
|
}
|
|
1182
770
|
return result;
|
|
1183
771
|
}
|
|
1184
772
|
/**
|
|
773
|
+
* Convert a raw flag value string into the value its schema expects.
|
|
774
|
+
*
|
|
775
|
+
* zod no longer coerces, so scalar values (number / integer / boolean) are
|
|
776
|
+
* cast + validated via {@link parseArgumentValue} (same path as positional
|
|
777
|
+
* args); object / array / record values are JSON-parsed. `schema` is expected
|
|
778
|
+
* to already be unwrapped of optional/nullable/default.
|
|
779
|
+
*/
|
|
780
|
+
castFlagValue(value, schema, rawKey) {
|
|
781
|
+
if (z.schema.isObject(schema) || z.schema.isArray(schema) || z.schema.isRecord(schema)) try {
|
|
782
|
+
return JSON.parse(value);
|
|
783
|
+
} catch {
|
|
784
|
+
throw new CommandError(`Invalid JSON value for flag --${rawKey}`);
|
|
785
|
+
}
|
|
786
|
+
return this.parseArgumentValue(value, schema);
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
1185
789
|
* Get indices of argv elements consumed by flags (for separating args from flags)
|
|
1186
790
|
*/
|
|
1187
791
|
getFlagConsumedIndices(argv, flagDefs) {
|
|
@@ -1194,8 +798,9 @@ var CliProvider = class {
|
|
|
1194
798
|
const hasEqualValue = valueParts.length > 0;
|
|
1195
799
|
const def = flagDefs.find((d) => d.aliases.includes(rawKey));
|
|
1196
800
|
if (!def) continue;
|
|
1197
|
-
const
|
|
1198
|
-
|
|
801
|
+
const base = z.schema.unwrap(def.schema);
|
|
802
|
+
const isUnionWithBoolean = z.schema.isUnion(base) && base.anyOf.some((s) => z.schema.isBoolean(s));
|
|
803
|
+
if (!z.schema.isBoolean(base) && !isUnionWithBoolean && !hasEqualValue) {
|
|
1199
804
|
const nextArg = argv[i + 1];
|
|
1200
805
|
if (nextArg && !nextArg.startsWith("-")) consumed.add(i + 1);
|
|
1201
806
|
} else if (isUnionWithBoolean && !hasEqualValue) {
|
|
@@ -1207,25 +812,21 @@ var CliProvider = class {
|
|
|
1207
812
|
}
|
|
1208
813
|
parseCommandArgs(argv, schema, isRootCommand = false, flagSchema) {
|
|
1209
814
|
if (!schema) return;
|
|
1210
|
-
const flagDefs = flagSchema ?
|
|
1211
|
-
key,
|
|
1212
|
-
aliases: [key, ...value.aliases ?? (value.alias ? [value.alias] : void 0) ?? []],
|
|
1213
|
-
schema: value
|
|
1214
|
-
})) : [];
|
|
815
|
+
const flagDefs = flagSchema ? this.extractFlagDefs(flagSchema) : [];
|
|
1215
816
|
const consumedIndices = this.getFlagConsumedIndices(argv, flagDefs);
|
|
1216
817
|
const positionalArgs = argv.filter((arg, idx) => !arg.startsWith("-") && !consumedIndices.has(idx));
|
|
1217
818
|
const argsOnly = isRootCommand ? positionalArgs : positionalArgs.slice(1);
|
|
1218
819
|
try {
|
|
1219
|
-
if (
|
|
820
|
+
if (z.schema.isOptional(schema)) {
|
|
1220
821
|
if (argsOnly.length === 0) return;
|
|
1221
822
|
return this.parseArgumentValue(argsOnly[0], schema);
|
|
1222
|
-
} else if (
|
|
823
|
+
} else if (z.schema.isTuple(schema) && schema.items) {
|
|
1223
824
|
const result = [];
|
|
1224
825
|
const items = schema.items;
|
|
1225
826
|
for (let i = 0; i < items.length; i++) {
|
|
1226
827
|
const itemSchema = items[i];
|
|
1227
828
|
if (i < argsOnly.length) result.push(this.parseArgumentValue(argsOnly[i], itemSchema));
|
|
1228
|
-
else if (
|
|
829
|
+
else if (z.schema.isOptional(itemSchema)) result.push(void 0);
|
|
1229
830
|
else throw new CommandError(`Missing required argument at position ${i + 1}`);
|
|
1230
831
|
}
|
|
1231
832
|
return result;
|
|
@@ -1242,14 +843,14 @@ var CliProvider = class {
|
|
|
1242
843
|
* Convert a string argument value to the appropriate type based on schema
|
|
1243
844
|
*/
|
|
1244
845
|
parseArgumentValue(value, schema) {
|
|
1245
|
-
if (
|
|
1246
|
-
if (
|
|
846
|
+
if (z.schema.isString(schema)) return value;
|
|
847
|
+
if (z.schema.isNumber(schema) || z.schema.isInteger(schema)) {
|
|
1247
848
|
const num = Number(value);
|
|
1248
849
|
if (Number.isNaN(num)) throw new CommandError(`Expected number, got "${value}"`);
|
|
1249
|
-
if (
|
|
850
|
+
if (z.schema.isInteger(schema) && !Number.isInteger(num)) throw new CommandError(`Expected integer, got "${value}"`);
|
|
1250
851
|
return num;
|
|
1251
852
|
}
|
|
1252
|
-
if (
|
|
853
|
+
if (z.schema.isBoolean(schema)) {
|
|
1253
854
|
const lower = value.toLowerCase();
|
|
1254
855
|
if (lower === "true" || lower === "1") return true;
|
|
1255
856
|
if (lower === "false" || lower === "0") return false;
|
|
@@ -1262,28 +863,29 @@ var CliProvider = class {
|
|
|
1262
863
|
*/
|
|
1263
864
|
generateArgsUsage(schema) {
|
|
1264
865
|
if (!schema) return "";
|
|
1265
|
-
if (
|
|
866
|
+
if (z.schema.isOptional(schema)) {
|
|
1266
867
|
const typeName = this.getTypeName(schema);
|
|
1267
|
-
return ` [${
|
|
868
|
+
return ` [${this.schemaMeta(schema).title ?? "arg1"}${typeName}]`;
|
|
1268
869
|
}
|
|
1269
|
-
if (
|
|
870
|
+
if (z.schema.isTuple(schema) && schema.items) return ` ${schema.items.map((item, index) => {
|
|
1270
871
|
const argName = `arg${index + 1}`;
|
|
1271
872
|
const typeName = this.getTypeName(item);
|
|
1272
|
-
if (
|
|
873
|
+
if (z.schema.isOptional(item)) return `[${argName}${typeName}]`;
|
|
1273
874
|
return `<${argName}${typeName}>`;
|
|
1274
875
|
}).join(" ")}`;
|
|
1275
876
|
const typeName = this.getTypeName(schema);
|
|
1276
|
-
return ` <${
|
|
877
|
+
return ` <${this.schemaMeta(schema).title ?? "arg1"}${typeName}>`;
|
|
1277
878
|
}
|
|
1278
879
|
/**
|
|
1279
880
|
* Get display type name for a schema (e.g., ": number", ": boolean")
|
|
1280
881
|
*/
|
|
1281
882
|
getTypeName(schema) {
|
|
1282
883
|
if (!schema) return "";
|
|
1283
|
-
|
|
1284
|
-
if (
|
|
1285
|
-
if (
|
|
1286
|
-
if (
|
|
884
|
+
const base = z.schema.unwrap(schema);
|
|
885
|
+
if (z.schema.isString(base)) return "";
|
|
886
|
+
if (z.schema.isInteger(base)) return ": integer";
|
|
887
|
+
if (z.schema.isNumber(base)) return ": number";
|
|
888
|
+
if (z.schema.isBoolean(base)) return ": boolean";
|
|
1287
889
|
return "";
|
|
1288
890
|
}
|
|
1289
891
|
/**
|
|
@@ -1293,6 +895,7 @@ var CliProvider = class {
|
|
|
1293
895
|
* If omitted, shows general CLI help with all commands.
|
|
1294
896
|
*/
|
|
1295
897
|
printHelp(command) {
|
|
898
|
+
this.alepha.store.set("alepha.logger.format", "raw");
|
|
1296
899
|
const cliName = this.name || "cli";
|
|
1297
900
|
const c = this.color;
|
|
1298
901
|
this.log.info("");
|
|
@@ -1322,17 +925,12 @@ var CliProvider = class {
|
|
|
1322
925
|
this.log.info("");
|
|
1323
926
|
this.log.info(c.set("WHITE_BOLD", "Flags:"));
|
|
1324
927
|
const flags = [
|
|
1325
|
-
...
|
|
1326
|
-
key,
|
|
1327
|
-
schema: value,
|
|
1328
|
-
aliases: [key, ...value.aliases ?? (value.alias ? [value.alias] : [])],
|
|
1329
|
-
description: value.description
|
|
1330
|
-
})),
|
|
928
|
+
...this.extractFlagDefs(command.flags),
|
|
1331
929
|
...command.options.mode ? [{
|
|
1332
930
|
key: "mode",
|
|
1333
931
|
aliases: ["m", "mode"],
|
|
1334
932
|
description: typeof command.options.mode === "string" ? `Environment mode - loads .env.{mode} (default: ${command.options.mode})` : "Environment mode (e.g., production, staging) - loads .env.{mode}",
|
|
1335
|
-
schema:
|
|
933
|
+
schema: z.string()
|
|
1336
934
|
}] : [],
|
|
1337
935
|
...Object.entries(this.getAllGlobalFlags()).map(([key, value]) => ({
|
|
1338
936
|
key,
|
|
@@ -1355,7 +953,7 @@ var CliProvider = class {
|
|
|
1355
953
|
this.log.info(c.set("WHITE_BOLD", "Env:"));
|
|
1356
954
|
const maxEnvLength = Math.max(...envVars.map(([key]) => key.length));
|
|
1357
955
|
for (const [key, schema] of envVars) {
|
|
1358
|
-
const isOptional =
|
|
956
|
+
const isOptional = z.schema.isOptional(schema);
|
|
1359
957
|
const description = schema.description ?? "";
|
|
1360
958
|
const optionalStr = isOptional ? c.set("GREY_DARK", " (optional)") : c.set("RED", " (required)");
|
|
1361
959
|
const coloredKey = c.set("CYAN", key);
|
|
@@ -1379,12 +977,7 @@ var CliProvider = class {
|
|
|
1379
977
|
this.log.info("");
|
|
1380
978
|
this.log.info(c.set("WHITE_BOLD", "Flags:"));
|
|
1381
979
|
const rootCommand = this.commands.find((cmd) => cmd.name === "");
|
|
1382
|
-
const globalFlags = [...rootCommand ?
|
|
1383
|
-
key,
|
|
1384
|
-
aliases: [key, ...value.aliases ?? (value.alias ? [value.alias] : void 0) ?? []],
|
|
1385
|
-
description: value.description,
|
|
1386
|
-
schema: value
|
|
1387
|
-
})) : [], ...Object.values(this.getAllGlobalFlags())];
|
|
980
|
+
const globalFlags = [...rootCommand ? this.extractFlagDefs(rootCommand.flags) : [], ...Object.values(this.getAllGlobalFlags())];
|
|
1388
981
|
const maxFlagLength = this.getMaxFlagLength(globalFlags);
|
|
1389
982
|
for (const { aliases, description, schema } of globalFlags) {
|
|
1390
983
|
const flagStr = aliases.map((a) => a.length === 1 ? `-${a}` : `--${a}`).join(", ");
|
|
@@ -1402,19 +995,19 @@ var CliProvider = class {
|
|
|
1402
995
|
generateColoredArgsUsage(schema) {
|
|
1403
996
|
if (!schema) return "";
|
|
1404
997
|
const c = this.color;
|
|
1405
|
-
if (
|
|
998
|
+
if (z.schema.isOptional(schema)) {
|
|
1406
999
|
const typeName = this.getTypeName(schema);
|
|
1407
|
-
const key =
|
|
1000
|
+
const key = this.schemaMeta(schema).title ?? "arg1";
|
|
1408
1001
|
return ` ${c.set("GREY_DARK", `[${key}${typeName}]`)}`;
|
|
1409
1002
|
}
|
|
1410
|
-
if (
|
|
1003
|
+
if (z.schema.isTuple(schema) && schema.items) return ` ${schema.items.map((item, index) => {
|
|
1411
1004
|
const argName = `arg${index + 1}`;
|
|
1412
1005
|
const typeName = this.getTypeName(item);
|
|
1413
|
-
if (
|
|
1006
|
+
if (z.schema.isOptional(item)) return c.set("GREY_DARK", `[${argName}${typeName}]`);
|
|
1414
1007
|
return c.set("CYAN", `<${argName}${typeName}>`);
|
|
1415
1008
|
}).join(" ")}`;
|
|
1416
1009
|
const typeName = this.getTypeName(schema);
|
|
1417
|
-
const key =
|
|
1010
|
+
const key = this.schemaMeta(schema).title ?? "arg1";
|
|
1418
1011
|
return ` ${c.set("CYAN", `<${key}${typeName}>`)}`;
|
|
1419
1012
|
}
|
|
1420
1013
|
/**
|
|
@@ -1475,12 +1068,19 @@ var CliProvider = class {
|
|
|
1475
1068
|
*/
|
|
1476
1069
|
getEnumValues(schema) {
|
|
1477
1070
|
if (!schema) return void 0;
|
|
1478
|
-
|
|
1479
|
-
if (
|
|
1480
|
-
const
|
|
1071
|
+
const base = z.schema.unwrap(schema);
|
|
1072
|
+
if (z.schema.isEnum(base)) {
|
|
1073
|
+
const values = z.schema.enumValues(base);
|
|
1074
|
+
return values.length > 0 && values.every((v) => typeof v === "string") ? values : void 0;
|
|
1075
|
+
}
|
|
1076
|
+
if (z.schema.isUnion(base)) {
|
|
1077
|
+
const variants = base.anyOf ?? [];
|
|
1481
1078
|
const values = [];
|
|
1482
|
-
for (const variant of
|
|
1483
|
-
|
|
1079
|
+
for (const variant of variants) {
|
|
1080
|
+
const value = variant.value;
|
|
1081
|
+
if (z.schema.isLiteral(variant) && typeof value === "string") values.push(value);
|
|
1082
|
+
else return;
|
|
1083
|
+
}
|
|
1484
1084
|
return values.length > 0 ? values : void 0;
|
|
1485
1085
|
}
|
|
1486
1086
|
}
|
|
@@ -1506,9 +1106,8 @@ var CliProvider = class {
|
|
|
1506
1106
|
*
|
|
1507
1107
|
* **Features:**
|
|
1508
1108
|
* - CLI command definitions
|
|
1509
|
-
* - Interactive CLI prompts
|
|
1510
|
-
* - Command execution
|
|
1511
|
-
* - Formatted colored output
|
|
1109
|
+
* - Interactive CLI prompts (plain readline)
|
|
1110
|
+
* - Command execution with streamed, verbose output
|
|
1512
1111
|
* - Environment variable utilities
|
|
1513
1112
|
* - Schema validation for CLI arguments
|
|
1514
1113
|
*
|
|
@@ -1521,12 +1120,10 @@ const AlephaCommand = $module({
|
|
|
1521
1120
|
CliProvider,
|
|
1522
1121
|
Runner,
|
|
1523
1122
|
Asker,
|
|
1524
|
-
PrettyAsker,
|
|
1525
|
-
PrettyPrint,
|
|
1526
1123
|
EnvUtils
|
|
1527
1124
|
]
|
|
1528
1125
|
});
|
|
1529
1126
|
//#endregion
|
|
1530
|
-
export { $command, AlephaCommand, Asker, CliProvider, CommandError, CommandPrimitive, EnvUtils,
|
|
1127
|
+
export { $command, AlephaCommand, Asker, CliProvider, CommandError, CommandPrimitive, EnvUtils, Runner, cliOptions };
|
|
1531
1128
|
|
|
1532
1129
|
//# sourceMappingURL=index.js.map
|