alepha 0.15.0 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -98
- package/dist/api/audits/index.d.ts +630 -653
- package/dist/api/audits/index.d.ts.map +1 -1
- package/dist/api/audits/index.js +12 -35
- package/dist/api/audits/index.js.map +1 -1
- package/dist/api/files/index.d.ts +365 -358
- package/dist/api/files/index.d.ts.map +1 -1
- package/dist/api/files/index.js +12 -5
- package/dist/api/files/index.js.map +1 -1
- package/dist/api/jobs/index.d.ts +255 -248
- package/dist/api/jobs/index.d.ts.map +1 -1
- package/dist/api/jobs/index.js +10 -3
- package/dist/api/jobs/index.js.map +1 -1
- package/dist/api/keys/index.d.ts +413 -0
- package/dist/api/keys/index.d.ts.map +1 -0
- package/dist/api/keys/index.js +476 -0
- package/dist/api/keys/index.js.map +1 -0
- package/dist/api/notifications/index.browser.js +4 -4
- package/dist/api/notifications/index.browser.js.map +1 -1
- package/dist/api/notifications/index.d.ts +84 -78
- package/dist/api/notifications/index.d.ts.map +1 -1
- package/dist/api/notifications/index.js +14 -8
- package/dist/api/notifications/index.js.map +1 -1
- package/dist/api/parameters/index.d.ts +528 -535
- package/dist/api/parameters/index.d.ts.map +1 -1
- package/dist/api/parameters/index.js +30 -37
- package/dist/api/parameters/index.js.map +1 -1
- package/dist/api/users/index.d.ts +1221 -910
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +2556 -248
- package/dist/api/users/index.js.map +1 -1
- package/dist/api/verifications/index.d.ts +142 -136
- package/dist/api/verifications/index.d.ts.map +1 -1
- package/dist/api/verifications/index.js +12 -4
- package/dist/api/verifications/index.js.map +1 -1
- package/dist/batch/index.d.ts +142 -162
- package/dist/batch/index.d.ts.map +1 -1
- package/dist/batch/index.js +31 -44
- package/dist/batch/index.js.map +1 -1
- package/dist/bucket/index.d.ts +595 -171
- package/dist/bucket/index.d.ts.map +1 -1
- package/dist/bucket/index.js +1856 -12
- package/dist/bucket/index.js.map +1 -1
- package/dist/cache/core/index.d.ts +225 -53
- package/dist/cache/core/index.d.ts.map +1 -1
- package/dist/cache/core/index.js +213 -7
- package/dist/cache/core/index.js.map +1 -1
- package/dist/cache/redis/index.d.ts +1 -0
- package/dist/cache/redis/index.d.ts.map +1 -1
- package/dist/cache/redis/index.js +6 -2
- package/dist/cache/redis/index.js.map +1 -1
- package/dist/cli/index.d.ts +834 -226
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2872 -417
- package/dist/cli/index.js.map +1 -1
- package/dist/command/index.d.ts +458 -310
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +2011 -76
- package/dist/command/index.js.map +1 -1
- package/dist/core/index.browser.js +309 -97
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +796 -701
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +329 -97
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +309 -97
- package/dist/core/index.native.js.map +1 -1
- package/dist/datetime/index.d.ts +59 -44
- package/dist/datetime/index.d.ts.map +1 -1
- package/dist/datetime/index.js +15 -0
- package/dist/datetime/index.js.map +1 -1
- package/dist/email/index.d.ts +314 -19
- package/dist/email/index.d.ts.map +1 -1
- package/dist/email/index.js +1852 -7
- package/dist/email/index.js.map +1 -1
- package/dist/fake/index.d.ts +5500 -5418
- package/dist/fake/index.d.ts.map +1 -1
- package/dist/fake/index.js +113 -42
- package/dist/fake/index.js.map +1 -1
- package/dist/lock/core/index.d.ts +219 -212
- package/dist/lock/core/index.d.ts.map +1 -1
- package/dist/lock/core/index.js +11 -4
- package/dist/lock/core/index.js.map +1 -1
- package/dist/lock/redis/index.d.ts.map +1 -1
- package/dist/logger/index.d.ts +41 -90
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +15 -68
- package/dist/logger/index.js.map +1 -1
- package/dist/mcp/index.d.ts +228 -230
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +32 -31
- package/dist/mcp/index.js.map +1 -1
- package/dist/orm/index.browser.js +12 -12
- package/dist/orm/index.browser.js.map +1 -1
- package/dist/orm/index.bun.js +90 -80
- package/dist/orm/index.bun.js.map +1 -1
- package/dist/orm/index.d.ts +1434 -1459
- package/dist/orm/index.d.ts.map +1 -1
- package/dist/orm/index.js +112 -130
- package/dist/orm/index.js.map +1 -1
- package/dist/queue/core/index.d.ts +262 -254
- package/dist/queue/core/index.d.ts.map +1 -1
- package/dist/queue/core/index.js +14 -6
- package/dist/queue/core/index.js.map +1 -1
- package/dist/queue/redis/index.d.ts.map +1 -1
- package/dist/react/auth/index.browser.js +108 -0
- package/dist/react/auth/index.browser.js.map +1 -0
- package/dist/react/auth/index.d.ts +100 -0
- package/dist/react/auth/index.d.ts.map +1 -0
- package/dist/react/auth/index.js +145 -0
- package/dist/react/auth/index.js.map +1 -0
- package/dist/react/core/index.d.ts +469 -0
- package/dist/react/core/index.d.ts.map +1 -0
- package/dist/react/core/index.js +464 -0
- package/dist/react/core/index.js.map +1 -0
- package/dist/react/form/index.d.ts +232 -0
- package/dist/react/form/index.d.ts.map +1 -0
- package/dist/react/form/index.js +432 -0
- package/dist/react/form/index.js.map +1 -0
- package/dist/react/head/index.browser.js +423 -0
- package/dist/react/head/index.browser.js.map +1 -0
- package/dist/react/head/index.d.ts +288 -0
- package/dist/react/head/index.d.ts.map +1 -0
- package/dist/react/head/index.js +465 -0
- package/dist/react/head/index.js.map +1 -0
- package/dist/react/i18n/index.d.ts +175 -0
- package/dist/react/i18n/index.d.ts.map +1 -0
- package/dist/react/i18n/index.js +224 -0
- package/dist/react/i18n/index.js.map +1 -0
- package/dist/react/router/index.browser.js +1980 -0
- package/dist/react/router/index.browser.js.map +1 -0
- package/dist/react/router/index.d.ts +2068 -0
- package/dist/react/router/index.d.ts.map +1 -0
- package/dist/react/router/index.js +4932 -0
- package/dist/react/router/index.js.map +1 -0
- package/dist/react/websocket/index.d.ts +117 -0
- package/dist/react/websocket/index.d.ts.map +1 -0
- package/dist/react/websocket/index.js +107 -0
- package/dist/react/websocket/index.js.map +1 -0
- package/dist/redis/index.bun.js +4 -0
- package/dist/redis/index.bun.js.map +1 -1
- package/dist/redis/index.d.ts +127 -130
- package/dist/redis/index.d.ts.map +1 -1
- package/dist/redis/index.js +16 -25
- package/dist/redis/index.js.map +1 -1
- package/dist/retry/index.d.ts +80 -71
- package/dist/retry/index.d.ts.map +1 -1
- package/dist/retry/index.js +11 -2
- package/dist/retry/index.js.map +1 -1
- package/dist/router/index.d.ts +6 -6
- package/dist/router/index.d.ts.map +1 -1
- package/dist/scheduler/index.d.ts +119 -28
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +404 -3
- package/dist/scheduler/index.js.map +1 -1
- package/dist/security/index.d.ts +642 -228
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +1579 -37
- package/dist/security/index.js.map +1 -1
- package/dist/server/auth/index.d.ts +1141 -111
- package/dist/server/auth/index.d.ts.map +1 -1
- package/dist/server/auth/index.js +1261 -25
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/cache/index.d.ts +63 -78
- package/dist/server/cache/index.d.ts.map +1 -1
- package/dist/server/cache/index.js +7 -22
- package/dist/server/cache/index.js.map +1 -1
- package/dist/server/compress/index.d.ts +13 -5
- package/dist/server/compress/index.d.ts.map +1 -1
- package/dist/server/compress/index.js +10 -2
- package/dist/server/compress/index.js.map +1 -1
- package/dist/server/cookies/index.d.ts +46 -22
- package/dist/server/cookies/index.d.ts.map +1 -1
- package/dist/server/cookies/index.js +7 -5
- package/dist/server/cookies/index.js.map +1 -1
- package/dist/server/core/index.d.ts +307 -196
- package/dist/server/core/index.d.ts.map +1 -1
- package/dist/server/core/index.js +271 -38
- package/dist/server/core/index.js.map +1 -1
- package/dist/server/cors/index.d.ts +24 -34
- package/dist/server/cors/index.d.ts.map +1 -1
- package/dist/server/cors/index.js +7 -21
- package/dist/server/cors/index.js.map +1 -1
- package/dist/server/health/index.d.ts +25 -19
- package/dist/server/health/index.d.ts.map +1 -1
- package/dist/server/health/index.js +8 -2
- package/dist/server/health/index.js.map +1 -1
- package/dist/server/helmet/index.d.ts +13 -5
- package/dist/server/helmet/index.d.ts.map +1 -1
- package/dist/server/helmet/index.js +11 -3
- package/dist/server/helmet/index.js.map +1 -1
- package/dist/server/links/index.browser.js +9 -1
- package/dist/server/links/index.browser.js.map +1 -1
- package/dist/server/links/index.d.ts +133 -128
- package/dist/server/links/index.d.ts.map +1 -1
- package/dist/server/links/index.js +24 -11
- package/dist/server/links/index.js.map +1 -1
- package/dist/server/metrics/index.d.ts +524 -4
- package/dist/server/metrics/index.d.ts.map +1 -1
- package/dist/server/metrics/index.js +4472 -7
- package/dist/server/metrics/index.js.map +1 -1
- package/dist/server/multipart/index.d.ts +15 -9
- package/dist/server/multipart/index.d.ts.map +1 -1
- package/dist/server/multipart/index.js +9 -3
- package/dist/server/multipart/index.js.map +1 -1
- package/dist/server/proxy/index.d.ts +110 -104
- package/dist/server/proxy/index.d.ts.map +1 -1
- package/dist/server/proxy/index.js +8 -2
- package/dist/server/proxy/index.js.map +1 -1
- package/dist/server/rate-limit/index.d.ts +46 -51
- package/dist/server/rate-limit/index.d.ts.map +1 -1
- package/dist/server/rate-limit/index.js +18 -55
- package/dist/server/rate-limit/index.js.map +1 -1
- package/dist/server/static/index.d.ts +181 -48
- package/dist/server/static/index.d.ts.map +1 -1
- package/dist/server/static/index.js +1848 -5
- package/dist/server/static/index.js.map +1 -1
- package/dist/server/swagger/index.d.ts +348 -53
- package/dist/server/swagger/index.d.ts.map +1 -1
- package/dist/server/swagger/index.js +1849 -6
- package/dist/server/swagger/index.js.map +1 -1
- package/dist/sms/index.d.ts +312 -18
- package/dist/sms/index.d.ts.map +1 -1
- package/dist/sms/index.js +1854 -10
- package/dist/sms/index.js.map +1 -1
- package/dist/system/index.browser.js +496 -0
- package/dist/system/index.browser.js.map +1 -0
- package/dist/system/index.d.ts +1158 -0
- package/dist/system/index.d.ts.map +1 -0
- package/dist/{file → system}/index.js +412 -20
- package/dist/system/index.js.map +1 -0
- package/dist/thread/index.d.ts +82 -73
- package/dist/thread/index.d.ts.map +1 -1
- package/dist/thread/index.js +13 -4
- package/dist/thread/index.js.map +1 -1
- package/dist/topic/core/index.d.ts +330 -323
- package/dist/topic/core/index.d.ts.map +1 -1
- package/dist/topic/core/index.js +12 -5
- package/dist/topic/core/index.js.map +1 -1
- package/dist/topic/redis/index.d.ts +6 -6
- package/dist/topic/redis/index.d.ts.map +1 -1
- package/dist/vite/index.d.ts +163 -5825
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +130 -477
- package/dist/vite/index.js.map +1 -1
- package/dist/websocket/index.browser.js +3 -3
- package/dist/websocket/index.browser.js.map +1 -1
- package/dist/websocket/index.d.ts +287 -283
- package/dist/websocket/index.d.ts.map +1 -1
- package/dist/websocket/index.js +15 -11
- package/dist/websocket/index.js.map +1 -1
- package/package.json +86 -17
- package/src/api/audits/index.ts +10 -33
- package/src/api/files/__tests__/$bucket.spec.ts +1 -1
- package/src/api/files/controllers/AdminFileStatsController.spec.ts +1 -1
- package/src/api/files/controllers/FileController.spec.ts +1 -1
- package/src/api/files/index.ts +10 -3
- package/src/api/files/jobs/FileJobs.spec.ts +1 -1
- package/src/api/files/services/FileService.spec.ts +1 -1
- package/src/api/jobs/index.ts +10 -3
- package/src/api/keys/controllers/AdminApiKeyController.ts +75 -0
- package/src/api/keys/controllers/ApiKeyController.ts +103 -0
- package/src/api/keys/entities/apiKeyEntity.ts +41 -0
- package/src/api/keys/index.ts +49 -0
- package/src/api/keys/schemas/adminApiKeyQuerySchema.ts +7 -0
- package/src/api/keys/schemas/adminApiKeyResourceSchema.ts +17 -0
- package/src/api/keys/schemas/createApiKeyBodySchema.ts +7 -0
- package/src/api/keys/schemas/createApiKeyResponseSchema.ts +11 -0
- package/src/api/keys/schemas/listApiKeyResponseSchema.ts +15 -0
- package/src/api/keys/schemas/revokeApiKeyParamsSchema.ts +5 -0
- package/src/api/keys/schemas/revokeApiKeyResponseSchema.ts +5 -0
- package/src/api/keys/services/ApiKeyService.spec.ts +553 -0
- package/src/api/keys/services/ApiKeyService.ts +306 -0
- package/src/api/logs/TODO.md +52 -0
- package/src/api/notifications/index.ts +10 -4
- package/src/api/parameters/index.ts +9 -30
- package/src/api/parameters/primitives/$config.ts +12 -4
- package/src/api/parameters/services/ConfigStore.ts +9 -3
- package/src/api/users/__tests__/ApiKeys-integration.spec.ts +1035 -0
- package/src/api/users/__tests__/ApiKeys.spec.ts +401 -0
- package/src/api/users/index.ts +14 -3
- package/src/api/users/primitives/$realm.ts +33 -5
- package/src/api/users/providers/RealmProvider.ts +1 -12
- package/src/api/users/services/SessionService.ts +1 -11
- package/src/api/verifications/controllers/VerificationController.ts +2 -0
- package/src/api/verifications/index.ts +10 -4
- package/src/batch/index.ts +9 -36
- package/src/batch/primitives/$batch.ts +0 -8
- package/src/batch/providers/BatchProvider.ts +29 -2
- package/src/bucket/__tests__/shared.ts +1 -1
- package/src/bucket/index.ts +13 -6
- package/src/bucket/primitives/$bucket.ts +1 -1
- package/src/bucket/providers/LocalFileStorageProvider.ts +1 -1
- package/src/bucket/providers/MemoryFileStorageProvider.ts +1 -1
- package/src/cache/core/__tests__/shared.ts +30 -0
- package/src/cache/core/index.ts +11 -6
- package/src/cache/core/primitives/$cache.spec.ts +5 -0
- package/src/cache/core/providers/CacheProvider.ts +17 -0
- package/src/cache/core/providers/MemoryCacheProvider.ts +300 -1
- package/src/cache/redis/__tests__/cache-redis.spec.ts +5 -0
- package/src/cache/redis/providers/RedisCacheProvider.ts +9 -0
- package/src/cli/apps/AlephaCli.ts +3 -16
- package/src/cli/apps/AlephaPackageBuilderCli.ts +10 -2
- package/src/cli/atoms/appEntryOptions.ts +13 -0
- package/src/cli/atoms/buildOptions.ts +1 -1
- package/src/cli/atoms/changelogOptions.ts +1 -1
- package/src/cli/commands/build.ts +64 -52
- package/src/cli/commands/db.ts +17 -11
- package/src/cli/commands/deploy.ts +1 -1
- package/src/cli/commands/dev.ts +13 -49
- package/src/cli/commands/gen/env.ts +6 -3
- package/src/cli/commands/gen/openapi.ts +5 -2
- package/src/cli/commands/init.spec.ts +544 -0
- package/src/cli/commands/init.ts +101 -58
- package/src/cli/commands/lint.ts +8 -2
- package/src/cli/commands/typecheck.ts +11 -0
- package/src/cli/defineConfig.ts +9 -0
- package/src/cli/index.ts +2 -1
- package/src/cli/providers/AppEntryProvider.ts +131 -0
- package/src/cli/providers/ViteBuildProvider.ts +40 -0
- package/src/cli/providers/ViteDevServerProvider.ts +378 -0
- package/src/cli/services/AlephaCliUtils.ts +39 -93
- package/src/cli/services/PackageManagerUtils.ts +140 -17
- package/src/cli/services/ProjectScaffolder.ts +169 -101
- package/src/cli/services/ViteUtils.ts +82 -0
- package/src/cli/{assets/claudeMd.ts → templates/agentMd.ts} +41 -28
- package/src/cli/{assets → templates}/apiHelloControllerTs.ts +2 -1
- package/src/cli/{assets → templates}/biomeJson.ts +2 -1
- package/src/cli/{assets → templates}/dummySpecTs.ts +2 -1
- package/src/cli/{assets → templates}/editorconfig.ts +2 -1
- package/src/cli/templates/gitignore.ts +39 -0
- package/src/cli/{assets → templates}/mainBrowserTs.ts +2 -1
- package/src/cli/templates/mainCss.ts +33 -0
- package/src/cli/templates/mainServerTs.ts +33 -0
- package/src/cli/{assets → templates}/tsconfigJson.ts +2 -1
- package/src/cli/templates/webAppRouterTs.ts +50 -0
- package/src/cli/templates/webHelloComponentTsx.ts +20 -0
- package/src/command/helpers/Runner.spec.ts +4 -0
- package/src/command/helpers/Runner.ts +3 -21
- package/src/command/index.ts +12 -4
- package/src/command/providers/CliProvider.spec.ts +1067 -0
- package/src/command/providers/CliProvider.ts +203 -40
- package/src/core/Alepha.ts +3 -9
- package/src/core/__tests__/Alepha-start.spec.ts +4 -4
- package/src/core/helpers/jsonSchemaToTypeBox.spec.ts +771 -0
- package/src/core/helpers/jsonSchemaToTypeBox.ts +62 -10
- package/src/core/index.shared.ts +1 -0
- package/src/core/index.ts +20 -0
- package/src/core/primitives/$module.ts +12 -0
- package/src/core/providers/EventManager.spec.ts +0 -71
- package/src/core/providers/EventManager.ts +3 -15
- package/src/core/providers/Json.ts +2 -14
- package/src/core/providers/KeylessJsonSchemaCodec.spec.ts +257 -0
- package/src/core/providers/KeylessJsonSchemaCodec.ts +396 -14
- package/src/core/providers/SchemaValidator.spec.ts +236 -0
- package/src/datetime/index.ts +15 -0
- package/src/email/index.ts +10 -5
- package/src/email/providers/LocalEmailProvider.spec.ts +1 -1
- package/src/email/providers/LocalEmailProvider.ts +1 -1
- package/src/fake/__tests__/keyName.example.ts +1 -1
- package/src/fake/__tests__/keyName.spec.ts +5 -5
- package/src/fake/index.ts +9 -6
- package/src/fake/providers/FakeProvider.spec.ts +258 -40
- package/src/fake/providers/FakeProvider.ts +133 -19
- package/src/lock/core/index.ts +11 -4
- package/src/logger/index.ts +17 -66
- package/src/logger/providers/PrettyFormatterProvider.ts +0 -9
- package/src/mcp/errors/McpError.ts +30 -0
- package/src/mcp/index.ts +13 -27
- package/src/mcp/transports/SseMcpTransport.ts +6 -7
- package/src/orm/__tests__/PostgresProvider.spec.ts +2 -2
- package/src/orm/index.browser.ts +2 -2
- package/src/orm/index.bun.ts +4 -2
- package/src/orm/index.ts +21 -47
- package/src/orm/providers/DrizzleKitProvider.ts +3 -5
- package/src/orm/providers/drivers/BunSqliteProvider.ts +1 -0
- package/src/orm/services/Repository.ts +18 -3
- package/src/queue/core/index.ts +14 -6
- package/src/react/auth/__tests__/$auth.spec.ts +202 -0
- package/src/react/auth/hooks/useAuth.ts +32 -0
- package/src/react/auth/index.browser.ts +13 -0
- package/src/react/auth/index.shared.ts +2 -0
- package/src/react/auth/index.ts +48 -0
- package/src/react/auth/providers/ReactAuthProvider.ts +16 -0
- package/src/react/auth/services/ReactAuth.ts +135 -0
- package/src/react/core/__tests__/Router.spec.tsx +169 -0
- package/src/react/core/components/ClientOnly.tsx +49 -0
- package/src/react/core/components/ErrorBoundary.tsx +73 -0
- package/src/react/core/contexts/AlephaContext.ts +7 -0
- package/src/react/core/contexts/AlephaProvider.tsx +42 -0
- package/src/react/core/hooks/useAction.browser.spec.tsx +569 -0
- package/src/react/core/hooks/useAction.ts +480 -0
- package/src/react/core/hooks/useAlepha.ts +26 -0
- package/src/react/core/hooks/useClient.ts +17 -0
- package/src/react/core/hooks/useEvents.ts +51 -0
- package/src/react/core/hooks/useInject.ts +12 -0
- package/src/react/core/hooks/useStore.ts +52 -0
- package/src/react/core/index.ts +90 -0
- package/src/react/form/components/FormState.tsx +17 -0
- package/src/react/form/errors/FormValidationError.ts +18 -0
- package/src/react/form/hooks/useForm.browser.spec.tsx +366 -0
- package/src/react/form/hooks/useForm.ts +47 -0
- package/src/react/form/hooks/useFormState.ts +130 -0
- package/src/react/form/index.ts +44 -0
- package/src/react/form/services/FormModel.ts +614 -0
- package/src/react/head/helpers/SeoExpander.spec.ts +203 -0
- package/src/react/head/helpers/SeoExpander.ts +142 -0
- package/src/react/head/hooks/useHead.spec.tsx +288 -0
- package/src/react/head/hooks/useHead.ts +62 -0
- package/src/react/head/index.browser.ts +26 -0
- package/src/react/head/index.ts +44 -0
- package/src/react/head/interfaces/Head.ts +105 -0
- package/src/react/head/primitives/$head.ts +25 -0
- package/src/react/head/providers/BrowserHeadProvider.browser.spec.ts +196 -0
- package/src/react/head/providers/BrowserHeadProvider.ts +212 -0
- package/src/react/head/providers/HeadProvider.ts +168 -0
- package/src/react/head/providers/ServerHeadProvider.ts +31 -0
- package/src/react/i18n/__tests__/integration.spec.tsx +239 -0
- package/src/react/i18n/components/Localize.spec.tsx +357 -0
- package/src/react/i18n/components/Localize.tsx +35 -0
- package/src/react/i18n/hooks/useI18n.browser.spec.tsx +438 -0
- package/src/react/i18n/hooks/useI18n.ts +18 -0
- package/src/react/i18n/index.ts +41 -0
- package/src/react/i18n/primitives/$dictionary.ts +69 -0
- package/src/react/i18n/providers/I18nProvider.spec.ts +389 -0
- package/src/react/i18n/providers/I18nProvider.ts +278 -0
- package/src/react/router/__tests__/page-head-browser.browser.spec.ts +95 -0
- package/src/react/router/__tests__/page-head.spec.ts +48 -0
- package/src/react/router/__tests__/seo-head.spec.ts +125 -0
- package/src/react/router/atoms/ssrManifestAtom.ts +58 -0
- package/src/react/router/components/ErrorViewer.tsx +872 -0
- package/src/react/router/components/Link.tsx +23 -0
- package/src/react/router/components/NestedView.tsx +223 -0
- package/src/react/router/components/NotFound.tsx +30 -0
- package/src/react/router/constants/PAGE_PRELOAD_KEY.ts +6 -0
- package/src/react/router/contexts/RouterLayerContext.ts +12 -0
- package/src/react/router/errors/Redirection.ts +28 -0
- package/src/react/router/hooks/useActive.ts +52 -0
- package/src/react/router/hooks/useQueryParams.ts +63 -0
- package/src/react/router/hooks/useRouter.ts +20 -0
- package/src/react/router/hooks/useRouterState.ts +11 -0
- package/src/react/router/index.browser.ts +45 -0
- package/src/react/router/index.shared.ts +19 -0
- package/src/react/router/index.ts +142 -0
- package/src/react/router/primitives/$page.browser.spec.tsx +851 -0
- package/src/react/router/primitives/$page.spec.tsx +708 -0
- package/src/react/router/primitives/$page.ts +497 -0
- package/src/react/router/providers/ReactBrowserProvider.ts +309 -0
- package/src/react/router/providers/ReactBrowserRendererProvider.ts +25 -0
- package/src/react/router/providers/ReactBrowserRouterProvider.ts +168 -0
- package/src/react/router/providers/ReactPageProvider.ts +726 -0
- package/src/react/router/providers/ReactServerProvider.spec.tsx +316 -0
- package/src/react/router/providers/ReactServerProvider.ts +558 -0
- package/src/react/router/providers/ReactServerTemplateProvider.ts +979 -0
- package/src/react/router/providers/SSRManifestProvider.ts +334 -0
- package/src/react/router/services/ReactPageServerService.ts +48 -0
- package/src/react/router/services/ReactPageService.ts +27 -0
- package/src/react/router/services/ReactRouter.ts +262 -0
- package/src/react/websocket/hooks/useRoom.tsx +242 -0
- package/src/react/websocket/index.ts +7 -0
- package/src/redis/__tests__/redis.spec.ts +13 -0
- package/src/redis/index.ts +9 -25
- package/src/redis/providers/BunRedisProvider.ts +9 -0
- package/src/redis/providers/NodeRedisProvider.ts +8 -0
- package/src/redis/providers/RedisProvider.ts +16 -0
- package/src/retry/index.ts +11 -2
- package/src/router/index.ts +15 -0
- package/src/scheduler/index.ts +11 -2
- package/src/security/__tests__/BasicAuth.spec.ts +2 -0
- package/src/security/__tests__/ServerSecurityProvider.spec.ts +13 -5
- package/src/security/index.ts +15 -10
- package/src/security/interfaces/IssuerResolver.ts +27 -0
- package/src/security/primitives/$issuer.ts +55 -0
- package/src/security/providers/SecurityProvider.ts +179 -0
- package/src/security/providers/ServerBasicAuthProvider.ts +6 -2
- package/src/security/providers/ServerSecurityProvider.ts +36 -22
- package/src/server/auth/index.ts +12 -7
- package/src/server/cache/index.ts +7 -22
- package/src/server/compress/index.ts +10 -2
- package/src/server/cookies/index.ts +7 -5
- package/src/server/cookies/primitives/$cookie.ts +33 -11
- package/src/server/core/index.ts +17 -7
- package/src/server/core/interfaces/ServerRequest.ts +83 -1
- package/src/server/core/primitives/$action.spec.ts +1 -1
- package/src/server/core/primitives/$action.ts +8 -3
- package/src/server/core/providers/BunHttpServerProvider.ts +1 -1
- package/src/server/core/providers/NodeHttpServerProvider.spec.ts +125 -0
- package/src/server/core/providers/NodeHttpServerProvider.ts +77 -22
- package/src/server/core/providers/ServerLoggerProvider.ts +2 -2
- package/src/server/core/providers/ServerProvider.ts +9 -12
- package/src/server/core/services/ServerRequestParser.spec.ts +520 -0
- package/src/server/core/services/ServerRequestParser.ts +306 -13
- package/src/server/cors/index.ts +7 -21
- package/src/server/cors/primitives/$cors.ts +6 -2
- package/src/server/health/index.ts +8 -2
- package/src/server/helmet/index.ts +11 -3
- package/src/server/links/atoms/apiLinksAtom.ts +7 -0
- package/src/server/links/index.browser.ts +2 -0
- package/src/server/links/index.ts +13 -6
- package/src/server/metrics/index.ts +10 -3
- package/src/server/multipart/index.ts +9 -3
- package/src/server/proxy/index.ts +8 -2
- package/src/server/rate-limit/index.ts +21 -25
- package/src/server/rate-limit/primitives/$rateLimit.ts +6 -2
- package/src/server/rate-limit/providers/ServerRateLimitProvider.spec.ts +38 -14
- package/src/server/rate-limit/providers/ServerRateLimitProvider.ts +22 -56
- package/src/server/static/index.ts +8 -2
- package/src/server/static/providers/ServerStaticProvider.ts +1 -1
- package/src/server/swagger/index.ts +9 -4
- package/src/server/swagger/providers/ServerSwaggerProvider.ts +1 -1
- package/src/sms/index.ts +9 -5
- package/src/sms/providers/LocalSmsProvider.spec.ts +1 -1
- package/src/sms/providers/LocalSmsProvider.ts +1 -1
- package/src/system/index.browser.ts +11 -0
- package/src/system/index.ts +62 -0
- package/src/{file → system}/providers/FileSystemProvider.ts +16 -0
- package/src/{file → system}/providers/MemoryFileSystemProvider.ts +116 -3
- package/src/system/providers/MemoryShellProvider.ts +164 -0
- package/src/{file → system}/providers/NodeFileSystemProvider.spec.ts +2 -2
- package/src/{file → system}/providers/NodeFileSystemProvider.ts +36 -0
- package/src/system/providers/NodeShellProvider.ts +184 -0
- package/src/system/providers/ShellProvider.ts +74 -0
- package/src/{file → system}/services/FileDetector.spec.ts +2 -2
- package/src/thread/index.ts +11 -2
- package/src/topic/core/index.ts +12 -5
- package/src/vite/index.ts +3 -2
- package/src/vite/tasks/buildClient.ts +2 -8
- package/src/vite/tasks/buildServer.ts +84 -21
- package/src/vite/tasks/copyAssets.ts +5 -4
- package/src/vite/tasks/generateSitemap.ts +64 -23
- package/src/vite/tasks/index.ts +0 -2
- package/src/vite/tasks/prerenderPages.ts +49 -24
- package/src/websocket/index.ts +12 -8
- package/dist/file/index.d.ts +0 -839
- package/dist/file/index.d.ts.map +0 -1
- package/dist/file/index.js.map +0 -1
- package/src/cli/assets/indexHtml.ts +0 -15
- package/src/cli/assets/mainServerTs.ts +0 -24
- package/src/cli/assets/webAppRouterTs.ts +0 -15
- package/src/cli/assets/webHelloComponentTsx.ts +0 -16
- package/src/cli/commands/format.ts +0 -23
- package/src/file/index.ts +0 -43
- package/src/vite/helpers/boot.ts +0 -117
- package/src/vite/plugins/viteAlephaDev.ts +0 -177
- package/src/vite/tasks/devServer.ts +0 -71
- package/src/vite/tasks/runAlepha.ts +0 -270
- /package/dist/orm/{chunk-DtkW-qnP.js → chunk-DH6iiROE.js} +0 -0
- /package/src/cli/{assets → templates}/apiIndexTs.ts +0 -0
- /package/src/cli/{assets → templates}/webIndexTs.ts +0 -0
- /package/src/{file → system}/errors/FileError.ts +0 -0
- /package/src/{file → system}/services/FileDetector.ts +0 -0
package/dist/core/index.d.ts
CHANGED
|
@@ -45,19 +45,19 @@ type AbstractClass<T extends object = any> = abstract new (...args: any[]) => T;
|
|
|
45
45
|
*/
|
|
46
46
|
interface ServiceSubstitution<T extends object = any> {
|
|
47
47
|
/**
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
* Every time someone asks for this class, it will be provided with the 'use' class.
|
|
49
|
+
*/
|
|
50
50
|
provide: Service<T>;
|
|
51
51
|
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
* Service to use instead of the 'provide' service.
|
|
53
|
+
*
|
|
54
|
+
* Syntax is inspired by Angular's DI system.
|
|
55
|
+
*/
|
|
56
56
|
use: Service<T>;
|
|
57
57
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
* If true, if the service already exists -> just ignore the substitution and do not throw an error.
|
|
59
|
+
* Mostly used for plugins to enforce a substitution without throwing an error.
|
|
60
|
+
*/
|
|
61
61
|
optional?: boolean;
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
@@ -90,8 +90,8 @@ declare abstract class Primitive<T extends object = {}> {
|
|
|
90
90
|
readonly config: PrimitiveConfig;
|
|
91
91
|
constructor(args: PrimitiveArgs<T>);
|
|
92
92
|
/**
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
* Called automatically by Alepha after the primitive is created.
|
|
94
|
+
*/
|
|
95
95
|
protected onInit(): void;
|
|
96
96
|
}
|
|
97
97
|
type PrimitiveFactory<TPrimitive extends Primitive = Primitive> = {
|
|
@@ -155,55 +155,55 @@ interface TypeBoxErrorParams {
|
|
|
155
155
|
//#region ../../src/core/helpers/FileLike.d.ts
|
|
156
156
|
interface FileLike {
|
|
157
157
|
/**
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
* Filename.
|
|
159
|
+
* @default "file"
|
|
160
|
+
*/
|
|
161
161
|
name: string;
|
|
162
162
|
/**
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
* Mandatory MIME type of the file.
|
|
164
|
+
* @default "application/octet-stream"
|
|
165
|
+
*/
|
|
166
166
|
type: string;
|
|
167
167
|
/**
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
168
|
+
* Size of the file in bytes.
|
|
169
|
+
*
|
|
170
|
+
* Always 0 for streams, as the size is not known until the stream is fully read.
|
|
171
|
+
*
|
|
172
|
+
* @default 0
|
|
173
|
+
*/
|
|
174
174
|
size: number;
|
|
175
175
|
/**
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
176
|
+
* Last modified timestamp in milliseconds since epoch.
|
|
177
|
+
*
|
|
178
|
+
* Always the current timestamp for streams, as the last modified time is not known.
|
|
179
|
+
* We use this field to ensure compatibility with File API.
|
|
180
|
+
*
|
|
181
|
+
* @default Date.now()
|
|
182
|
+
*/
|
|
183
183
|
lastModified: number;
|
|
184
184
|
/**
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
* Returns a ReadableStream or Node.js Readable stream of the file content.
|
|
186
|
+
*
|
|
187
|
+
* For streams, this is the original stream.
|
|
188
|
+
*/
|
|
189
189
|
stream(): StreamLike;
|
|
190
190
|
/**
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
191
|
+
* Returns the file content as an ArrayBuffer.
|
|
192
|
+
*
|
|
193
|
+
* For streams, this reads the entire stream into memory.
|
|
194
|
+
*/
|
|
195
195
|
arrayBuffer(): Promise<ArrayBuffer>;
|
|
196
196
|
/**
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
197
|
+
* Returns the file content as a string.
|
|
198
|
+
*
|
|
199
|
+
* For streams, this reads the entire stream into memory and converts it to a string.
|
|
200
|
+
*/
|
|
201
201
|
text(): Promise<string>;
|
|
202
202
|
/**
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
203
|
+
* Optional file path, if the file is stored on disk.
|
|
204
|
+
*
|
|
205
|
+
* This is not from the File API, but rather a custom field to indicate where the file is stored.
|
|
206
|
+
*/
|
|
207
207
|
filepath?: string;
|
|
208
208
|
}
|
|
209
209
|
/**
|
|
@@ -259,47 +259,47 @@ declare class TypeProvider {
|
|
|
259
259
|
static setLocale(locale: string): void;
|
|
260
260
|
static isValidBigInt(value: string | number): boolean;
|
|
261
261
|
/**
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
262
|
+
* Default maximum length for strings.
|
|
263
|
+
*
|
|
264
|
+
* It can be set to a larger value:
|
|
265
|
+
* ```ts
|
|
266
|
+
* TypeProvider.DEFAULT_STRING_MAX_LENGTH = 1000000;
|
|
267
|
+
* TypeProvider.DEFAULT_STRING_MAX_LENGTH = undefined; // no limit (not recommended)
|
|
268
|
+
* ```
|
|
269
|
+
*/
|
|
270
270
|
static DEFAULT_STRING_MAX_LENGTH: number | undefined;
|
|
271
271
|
/**
|
|
272
|
-
|
|
273
|
-
|
|
272
|
+
* Maximum length for short strings, such as names or titles.
|
|
273
|
+
*/
|
|
274
274
|
static DEFAULT_SHORT_STRING_MAX_LENGTH: number | undefined;
|
|
275
275
|
/**
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
276
|
+
* Maximum length for long strings, such as descriptions or comments.
|
|
277
|
+
* It can be overridden in the string options.
|
|
278
|
+
*
|
|
279
|
+
* It can be set to a larger value:
|
|
280
|
+
* ```ts
|
|
281
|
+
* TypeProvider.DEFAULT_LONG_STRING_MAX_LENGTH = 2048;
|
|
282
|
+
* ```
|
|
283
|
+
*/
|
|
284
284
|
static DEFAULT_LONG_STRING_MAX_LENGTH: number | undefined;
|
|
285
285
|
/**
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
286
|
+
* Maximum length for rich strings, such as HTML or Markdown.
|
|
287
|
+
* This is a large value to accommodate rich text content.
|
|
288
|
+
* > It's also the maximum length of PG's TEXT type.
|
|
289
|
+
*
|
|
290
|
+
* It can be overridden in the string options.
|
|
291
|
+
*
|
|
292
|
+
* It can be set to a larger value:
|
|
293
|
+
* ```ts
|
|
294
|
+
* TypeProvider.DEFAULT_RICH_STRING_MAX_LENGTH = 1000000;
|
|
295
|
+
* ```
|
|
296
|
+
*/
|
|
297
297
|
static DEFAULT_RICH_STRING_MAX_LENGTH: number | undefined;
|
|
298
298
|
/**
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
299
|
+
* Maximum number of items in an array.
|
|
300
|
+
* This is a default value to prevent excessive memory usage.
|
|
301
|
+
* It can be overridden in the array options.
|
|
302
|
+
*/
|
|
303
303
|
static DEFAULT_ARRAY_MAX_ITEMS: number;
|
|
304
304
|
raw: typeof Type;
|
|
305
305
|
any: typeof Type.Any;
|
|
@@ -312,16 +312,16 @@ declare class TypeProvider {
|
|
|
312
312
|
const: typeof Type.Literal;
|
|
313
313
|
options: typeof Type.Options;
|
|
314
314
|
/**
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
315
|
+
* Type guards to check the type of schema.
|
|
316
|
+
* This is not a runtime type check, but a compile-time type guard.
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
* ```ts
|
|
320
|
+
* if (t.schema.isString(schema)) {
|
|
321
|
+
* // schema is TString
|
|
322
|
+
* }
|
|
323
|
+
* ```
|
|
324
|
+
*/
|
|
325
325
|
readonly schema: TypeGuard;
|
|
326
326
|
extend<T extends TSchema$1[], U extends TProperties$1>(schema: [...T], properties: U, options?: TSchemaOptions): TInterface<T, U>;
|
|
327
327
|
extend<T extends TObject$1, U extends TProperties$1>(schema: T, properties: U, options?: TSchemaOptions): TInterface<[T], U>;
|
|
@@ -329,76 +329,76 @@ declare class TypeProvider {
|
|
|
329
329
|
omit<T extends TObject$1, Indexer extends PropertyKey[]>(schema: T, keys: [...Indexer], options?: TObjectOptions$1): TOmit<T, TKeysToIndexer$1<Indexer>>;
|
|
330
330
|
partial<T extends TSchema$1>(schema: T, options?: TSchemaOptions): TPartial<T>;
|
|
331
331
|
/**
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
332
|
+
* Create a schema for an object.
|
|
333
|
+
* By default, additional properties are not allowed.
|
|
334
|
+
*
|
|
335
|
+
* @example
|
|
336
|
+
* ```ts
|
|
337
|
+
* const userSchema = t.object({
|
|
338
|
+
* id: t.integer(),
|
|
339
|
+
* name: t.string(),
|
|
340
|
+
* });
|
|
341
|
+
* ```
|
|
342
|
+
*/
|
|
343
343
|
object<T extends TProperties$1>(properties: T, options?: TObjectOptions$1): TObject$1<T>;
|
|
344
344
|
/**
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
345
|
+
* Create a schema for an array.
|
|
346
|
+
* By default, the maximum number of items is limited to prevent excessive memory usage.
|
|
347
|
+
*
|
|
348
|
+
* @see TypeProvider.DEFAULT_ARRAY_MAX_ITEMS
|
|
349
|
+
*/
|
|
350
350
|
array<T extends TSchema$1>(schema: T, options?: TArrayOptions): TArray$1<T>;
|
|
351
351
|
/**
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
352
|
+
* Create a schema for a string.
|
|
353
|
+
* For db or input fields, consider using `t.text()` instead, which has length limits.
|
|
354
|
+
*
|
|
355
|
+
* If you need a string with specific format (e.g. email, uuid), consider using the corresponding method (e.g. `t.email()`, `t.uuid()`).
|
|
356
|
+
*/
|
|
357
357
|
string(options?: TStringOptions$1): TString$1;
|
|
358
358
|
/**
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
359
|
+
* Create a schema for a string with length limits.
|
|
360
|
+
* For internal strings without length limits, consider using `t.string()` instead.
|
|
361
|
+
*
|
|
362
|
+
* Default size is "regular", which has a max length of 255 characters.
|
|
363
|
+
*/
|
|
364
364
|
text(options?: TTextOptions): TString$1;
|
|
365
365
|
/**
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
366
|
+
* Create a schema for a JSON object.
|
|
367
|
+
* This is a record with string keys and any values.
|
|
368
|
+
*/
|
|
369
369
|
json<T = any>(options?: TSchemaOptions): TRecord$1<string, TAny$1>;
|
|
370
370
|
/**
|
|
371
|
-
|
|
372
|
-
|
|
371
|
+
* Create a schema for a boolean.
|
|
372
|
+
*/
|
|
373
373
|
boolean(options?: TSchemaOptions): TBoolean$1;
|
|
374
374
|
/**
|
|
375
|
-
|
|
376
|
-
|
|
375
|
+
* Create a schema for a number.
|
|
376
|
+
*/
|
|
377
377
|
number(options?: TNumberOptions$1): TNumber$1;
|
|
378
378
|
/**
|
|
379
|
-
|
|
380
|
-
|
|
379
|
+
* Create a schema for an integer.
|
|
380
|
+
*/
|
|
381
381
|
integer(options?: TNumberOptions$1): TInteger$1;
|
|
382
382
|
int32(options?: TNumberOptions$1): TInteger$1;
|
|
383
383
|
/**
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
384
|
+
* Mimic a signed 64-bit integer.
|
|
385
|
+
*
|
|
386
|
+
* This is NOT a true int64, as JavaScript cannot represent all int64 values.
|
|
387
|
+
* It is a number that is an integer and between -9007199254740991 and 9007199254740991.
|
|
388
|
+
* Use `t.bigint()` for true int64 values represented as strings.
|
|
389
|
+
*/
|
|
390
390
|
int64(options?: TNumberOptions$1): TNumber$1;
|
|
391
391
|
/**
|
|
392
|
-
|
|
393
|
-
|
|
392
|
+
* Make a schema optional.
|
|
393
|
+
*/
|
|
394
394
|
optional<T extends TSchema$1>(schema: T): TOptionalAdd$1<T>;
|
|
395
395
|
/**
|
|
396
|
-
|
|
397
|
-
|
|
396
|
+
* Make a schema nullable.
|
|
397
|
+
*/
|
|
398
398
|
nullable<T extends TSchema$1>(schema: T, options?: TObjectOptions$1): TUnion$1<[TNull$1, T]>;
|
|
399
399
|
/**
|
|
400
|
-
|
|
401
|
-
|
|
400
|
+
* Create a schema that maps all properties of an object schema to nullable.
|
|
401
|
+
*/
|
|
402
402
|
nullify: <T extends TSchema$1>(schema: T, options?: TObjectOptions$1) => typebox0.TMappedInstantiate<{}, {
|
|
403
403
|
callstack: [];
|
|
404
404
|
}, Type.TIdentifier<"K">, typebox0.TKeyOfInstantiate<{}, {
|
|
@@ -407,65 +407,65 @@ declare class TypeProvider {
|
|
|
407
407
|
callstack: [];
|
|
408
408
|
}, T, Type.TRef<"K">>, TNull$1]>>;
|
|
409
409
|
/**
|
|
410
|
-
|
|
411
|
-
|
|
410
|
+
* Create a schema for a string enum.
|
|
411
|
+
*/
|
|
412
412
|
enum<T extends string[]>(values: [...T], options?: TTextOptions): TUnsafe$1<T[number]>;
|
|
413
413
|
/**
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
414
|
+
* Create a schema for a bigint represented as a string.
|
|
415
|
+
* This is a string that validates bigint format (e.g. "123456789").
|
|
416
|
+
*/
|
|
417
417
|
bigint(options?: TStringOptions$1): TString$1;
|
|
418
418
|
/**
|
|
419
|
-
|
|
420
|
-
|
|
419
|
+
* Create a schema for a URL represented as a string.
|
|
420
|
+
*/
|
|
421
421
|
url(options?: TStringOptions$1): TString$1;
|
|
422
422
|
/**
|
|
423
|
-
|
|
424
|
-
|
|
423
|
+
* Create a schema for binary data represented as a base64 string.
|
|
424
|
+
*/
|
|
425
425
|
binary(options: TStringOptions$1): TString$1;
|
|
426
426
|
/**
|
|
427
|
-
|
|
428
|
-
|
|
427
|
+
* Create a schema for uuid.
|
|
428
|
+
*/
|
|
429
429
|
uuid(options?: TStringOptions$1): TString$1;
|
|
430
430
|
/**
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
431
|
+
* Create a schema for a file-like object.
|
|
432
|
+
*
|
|
433
|
+
* File like mimics the File API in browsers, but is adapted to work in Node.js as well.
|
|
434
|
+
*
|
|
435
|
+
* Implementation of file-like objects is handled by "alepha/file" package.
|
|
436
|
+
*/
|
|
437
437
|
file(options?: {
|
|
438
438
|
maxSize?: number;
|
|
439
439
|
}): TFile;
|
|
440
440
|
/**
|
|
441
|
-
|
|
442
|
-
|
|
441
|
+
* @experimental
|
|
442
|
+
*/
|
|
443
443
|
stream(): TStream;
|
|
444
444
|
email(options?: TStringOptions$1): TString$1;
|
|
445
445
|
e164(options?: TStringOptions$1): TString$1;
|
|
446
446
|
bcp47(options?: TStringOptions$1): TString$1;
|
|
447
447
|
/**
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
448
|
+
* Create a schema for short text, such as names or titles.
|
|
449
|
+
* Default max length is 64 characters.
|
|
450
|
+
*/
|
|
451
451
|
shortText(options?: TStringOptions$1): TString$1;
|
|
452
452
|
/**
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
453
|
+
* Create a schema for long text, such as descriptions or comments.
|
|
454
|
+
* Default max length is 1024 characters.
|
|
455
|
+
*/
|
|
456
456
|
longText(options?: TStringOptions$1): TString$1;
|
|
457
457
|
/**
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
458
|
+
* Create a schema for rich text, such as HTML or Markdown.
|
|
459
|
+
* Default max length is 65535 characters.
|
|
460
|
+
*/
|
|
461
461
|
richText(options?: TStringOptions$1): TString$1;
|
|
462
462
|
/**
|
|
463
|
-
|
|
464
|
-
|
|
463
|
+
* Create a schema for a string enum e.g. LIKE_THIS.
|
|
464
|
+
*/
|
|
465
465
|
snakeCase: (options?: TStringOptions$1) => TString$1;
|
|
466
466
|
/**
|
|
467
|
-
|
|
468
|
-
|
|
467
|
+
* Create a schema for an object with a value and label.
|
|
468
|
+
*/
|
|
469
469
|
valueLabel: (options?: TObjectOptions$1) => TObject$1<{
|
|
470
470
|
value: TString$1;
|
|
471
471
|
label: TString$1;
|
|
@@ -479,29 +479,29 @@ declare class TypeProvider {
|
|
|
479
479
|
type TextLength = "short" | "regular" | "long" | "rich";
|
|
480
480
|
interface TTextOptions extends TStringOptions$1 {
|
|
481
481
|
/**
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
482
|
+
* Predefined size of the text.
|
|
483
|
+
*
|
|
484
|
+
* - `short` - short text, such as names or titles. Default max length is 64 characters.
|
|
485
|
+
* - `regular` - regular text, such as single-line input. Default max length is 255 characters.
|
|
486
|
+
* - `long` - long text, such as descriptions or comments. Default max length is 1024 characters.
|
|
487
|
+
* - `rich` - rich text, such as HTML or Markdown. Default max length is 65535 characters.
|
|
488
|
+
*
|
|
489
|
+
* You can override the default max length by specifying `maxLength` in the options.
|
|
490
|
+
*
|
|
491
|
+
* @default "regular"
|
|
492
|
+
*/
|
|
493
493
|
size?: TextLength;
|
|
494
494
|
/**
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
495
|
+
* Trim whitespace from both ends of the string.
|
|
496
|
+
*
|
|
497
|
+
* @default true
|
|
498
|
+
*/
|
|
499
499
|
trim?: boolean;
|
|
500
500
|
/**
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
501
|
+
* Convert the string to lowercase.
|
|
502
|
+
*
|
|
503
|
+
* @default false
|
|
504
|
+
*/
|
|
505
505
|
lowercase?: boolean;
|
|
506
506
|
}
|
|
507
507
|
declare const t: TypeProvider;
|
|
@@ -577,25 +577,25 @@ declare const $inject: <T extends object>(type: Service<T>, opts?: InjectOptions
|
|
|
577
577
|
declare class InjectPrimitive extends Primitive {}
|
|
578
578
|
interface InjectOptions<T extends object = any> {
|
|
579
579
|
/**
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
580
|
+
* - 'transient' → Always a new instance on every inject. Zero caching.
|
|
581
|
+
* - 'singleton' → One instance per Alepha runtime (per-thread). Never disposed until Alepha shuts down. (default)
|
|
582
|
+
* - 'scoped' → One instance per AsyncLocalStorage context.
|
|
583
|
+
* - A new scope is created when Alepha handles a request, a scheduled job, a queue worker task...
|
|
584
|
+
* - You can also start a manual scope via alepha.context.run(() => { ... }).
|
|
585
|
+
* - When the scope ends, the scoped registry is discarded.
|
|
586
|
+
*
|
|
587
|
+
* @default "singleton"
|
|
588
|
+
*/
|
|
589
589
|
lifetime?: "transient" | "singleton" | "scoped";
|
|
590
590
|
/**
|
|
591
|
-
|
|
592
|
-
|
|
591
|
+
* Constructor arguments to pass when creating a new instance.
|
|
592
|
+
*/
|
|
593
593
|
args?: ConstructorParameters<InstantiableClass<T>>;
|
|
594
594
|
/**
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
595
|
+
* Parent that requested the instance.
|
|
596
|
+
*
|
|
597
|
+
* @internal
|
|
598
|
+
*/
|
|
599
599
|
parent?: Service | null;
|
|
600
600
|
}
|
|
601
601
|
//#endregion
|
|
@@ -651,30 +651,34 @@ interface InjectOptions<T extends object = any> {
|
|
|
651
651
|
declare const $module: <T extends object = {}>(options: ModulePrimitiveOptions) => Service<Module>;
|
|
652
652
|
interface ModulePrimitiveOptions {
|
|
653
653
|
/**
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
654
|
+
* Name of the module.
|
|
655
|
+
*
|
|
656
|
+
* It should be in the format of `project.module.submodule`.
|
|
657
|
+
*/
|
|
658
658
|
name: string;
|
|
659
659
|
/**
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
660
|
+
* List all services related to this module.
|
|
661
|
+
*
|
|
662
|
+
* If you don't declare 'register' function, all services will be registered automatically.
|
|
663
|
+
* If you declare 'register' function, you must handle the registration of ALL services manually.
|
|
664
|
+
*/
|
|
665
665
|
services?: Array<Service>;
|
|
666
666
|
/**
|
|
667
|
-
|
|
668
|
-
|
|
667
|
+
* List of $primitives to register in the module.
|
|
668
|
+
*/
|
|
669
669
|
primitives?: Array<PrimitiveFactoryLike>;
|
|
670
670
|
/**
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
671
|
+
* By default, module will register ALL services.
|
|
672
|
+
* You can override this behavior by providing a register function.
|
|
673
|
+
* It's useful when you want to register services conditionally or in a specific order.
|
|
674
|
+
*
|
|
675
|
+
* Again, if you declare 'register', you must handle the registration of ALL services manually.
|
|
676
|
+
*/
|
|
677
677
|
register?: (alepha: Alepha) => void;
|
|
678
|
+
/**
|
|
679
|
+
* List of atoms to register in the module.
|
|
680
|
+
*/
|
|
681
|
+
atoms?: Array<Atom<any>>;
|
|
678
682
|
}
|
|
679
683
|
/**
|
|
680
684
|
* Base class for all modules.
|
|
@@ -684,14 +688,14 @@ declare abstract class Module {
|
|
|
684
688
|
abstract register(alepha: Alepha): void;
|
|
685
689
|
static NAME_REGEX: RegExp;
|
|
686
690
|
/**
|
|
687
|
-
|
|
688
|
-
|
|
691
|
+
* Check if a Service is a Module.
|
|
692
|
+
*/
|
|
689
693
|
static is(ctor: Service): boolean;
|
|
690
694
|
/**
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
+
* Get the Module of a Service.
|
|
696
|
+
*
|
|
697
|
+
* Returns undefined if the Service is not part of a Module.
|
|
698
|
+
*/
|
|
695
699
|
static of(ctor: Service): Service<Module> | undefined;
|
|
696
700
|
}
|
|
697
701
|
/**
|
|
@@ -721,23 +725,26 @@ declare class AlsProvider {
|
|
|
721
725
|
* Used across the codebase via dependency injection.
|
|
722
726
|
*/
|
|
723
727
|
declare class Json {
|
|
724
|
-
stringify
|
|
725
|
-
|
|
728
|
+
stringify: {
|
|
729
|
+
(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
|
|
730
|
+
(value: any, replacer?: (number | string)[] | null, space?: string | number): string;
|
|
731
|
+
};
|
|
732
|
+
parse: (text: string, reviver?: (this: any, key: string, value: any) => any) => any;
|
|
726
733
|
}
|
|
727
734
|
//#endregion
|
|
728
735
|
//#region ../../src/core/providers/SchemaCodec.d.ts
|
|
729
736
|
declare abstract class SchemaCodec {
|
|
730
737
|
/**
|
|
731
|
-
|
|
732
|
-
|
|
738
|
+
* Encode the value to a string format.
|
|
739
|
+
*/
|
|
733
740
|
abstract encodeToString<T extends TSchema>(schema: T, value: Static<T>): string;
|
|
734
741
|
/**
|
|
735
|
-
|
|
736
|
-
|
|
742
|
+
* Encode the value to a binary format.
|
|
743
|
+
*/
|
|
737
744
|
abstract encodeToBinary<T extends TSchema>(schema: T, value: Static<T>): Uint8Array;
|
|
738
745
|
/**
|
|
739
|
-
|
|
740
|
-
|
|
746
|
+
* Decode string, binary, or other formats to the schema type.
|
|
747
|
+
*/
|
|
741
748
|
abstract decode<T>(schema: TSchema, value: unknown): T;
|
|
742
749
|
}
|
|
743
750
|
//#endregion
|
|
@@ -751,61 +758,6 @@ declare class JsonSchemaCodec extends SchemaCodec {
|
|
|
751
758
|
decode<T>(schema: TSchema$1, value: unknown): T;
|
|
752
759
|
}
|
|
753
760
|
//#endregion
|
|
754
|
-
//#region ../../src/core/providers/KeylessJsonSchemaCodec.d.ts
|
|
755
|
-
interface KeylessCodec<T = any> {
|
|
756
|
-
encode: (value: T) => string;
|
|
757
|
-
decode: (str: string) => T;
|
|
758
|
-
}
|
|
759
|
-
/**
|
|
760
|
-
* KeylessJsonSchemaCodec provides schema-driven JSON encoding without keys.
|
|
761
|
-
*
|
|
762
|
-
* It uses the schema to determine field order, allowing the encoded output
|
|
763
|
-
* to be a simple JSON array instead of an object with keys.
|
|
764
|
-
*
|
|
765
|
-
* Performance characteristics:
|
|
766
|
-
* - Encode: 0.94-1.53x vs JSON.stringify (faster for complex objects)
|
|
767
|
-
* - Decode: 1.76-2.00x vs JSON.parse
|
|
768
|
-
* - Size: 50-56% smaller than JSON
|
|
769
|
-
*/
|
|
770
|
-
declare class KeylessJsonSchemaCodec extends SchemaCodec {
|
|
771
|
-
protected readonly cache: Map<TSchema$1, KeylessCodec<any>>;
|
|
772
|
-
protected readonly encoder: TextEncoder;
|
|
773
|
-
protected readonly decoder: TextDecoder;
|
|
774
|
-
protected varCounter: number;
|
|
775
|
-
/**
|
|
776
|
-
* Encode value to a keyless JSON string.
|
|
777
|
-
*/
|
|
778
|
-
encodeToString<T extends TSchema$1>(schema: T, value: Static<T>): string;
|
|
779
|
-
/**
|
|
780
|
-
* Encode value to binary (UTF-8 encoded keyless JSON).
|
|
781
|
-
*/
|
|
782
|
-
encodeToBinary<T extends TSchema$1>(schema: T, value: Static<T>): Uint8Array;
|
|
783
|
-
/**
|
|
784
|
-
* Decode keyless JSON string or binary to value.
|
|
785
|
-
*/
|
|
786
|
-
decode<T>(schema: TSchema$1, value: unknown): T;
|
|
787
|
-
/**
|
|
788
|
-
* Get a compiled codec for the given schema.
|
|
789
|
-
* Codecs are cached for reuse.
|
|
790
|
-
*/
|
|
791
|
-
protected getCodec<T>(schema: TSchema$1): KeylessCodec<T>;
|
|
792
|
-
protected nextVar(): string;
|
|
793
|
-
protected compile(schema: TSchema$1): KeylessCodec;
|
|
794
|
-
protected genEnc(schema: TSchema$1, ve: string): string;
|
|
795
|
-
protected genDec(schema: TSchema$1): {
|
|
796
|
-
code: string;
|
|
797
|
-
result: string;
|
|
798
|
-
};
|
|
799
|
-
protected genDecFromValue(schema: TSchema$1, expr: string): string;
|
|
800
|
-
protected isEnum(schema: TSchema$1): boolean;
|
|
801
|
-
protected isNullable(schema: TSchema$1): boolean;
|
|
802
|
-
protected unwrap(schema: TSchema$1): TSchema$1;
|
|
803
|
-
/**
|
|
804
|
-
* Reconstruct an object from a parsed array (for when input is already parsed).
|
|
805
|
-
*/
|
|
806
|
-
protected reconstructObject(schema: TSchema$1, arr: any[]): any;
|
|
807
|
-
}
|
|
808
|
-
//#endregion
|
|
809
761
|
//#region ../../src/core/primitives/$hook.d.ts
|
|
810
762
|
/**
|
|
811
763
|
* Registers a new hook.
|
|
@@ -852,24 +804,24 @@ declare const $hook: {
|
|
|
852
804
|
};
|
|
853
805
|
interface HookOptions<T extends keyof Hooks> {
|
|
854
806
|
/**
|
|
855
|
-
|
|
856
|
-
|
|
807
|
+
* The name of the hook. "configure", "start", "ready", "stop", ...
|
|
808
|
+
*/
|
|
857
809
|
on: T;
|
|
858
810
|
/**
|
|
859
|
-
|
|
860
|
-
|
|
811
|
+
* The handler to run when the hook is triggered.
|
|
812
|
+
*/
|
|
861
813
|
handler: (args: Hooks[T]) => Async<any>;
|
|
862
814
|
/**
|
|
863
|
-
|
|
864
|
-
|
|
815
|
+
* Force the hook to run first or last on the list of hooks.
|
|
816
|
+
*/
|
|
865
817
|
priority?: "first" | "last";
|
|
866
818
|
/**
|
|
867
|
-
|
|
868
|
-
|
|
819
|
+
* Empty placeholder, not implemented yet. :-)
|
|
820
|
+
*/
|
|
869
821
|
before?: object | Array<object>;
|
|
870
822
|
/**
|
|
871
|
-
|
|
872
|
-
|
|
823
|
+
* Empty placeholder, not implemented yet. :-)
|
|
824
|
+
*/
|
|
873
825
|
after?: object | Array<object>;
|
|
874
826
|
}
|
|
875
827
|
declare class HookPrimitive<T extends keyof Hooks> extends Primitive<HookOptions<T>> {
|
|
@@ -877,27 +829,152 @@ declare class HookPrimitive<T extends keyof Hooks> extends Primitive<HookOptions
|
|
|
877
829
|
protected onInit(): void;
|
|
878
830
|
}
|
|
879
831
|
//#endregion
|
|
832
|
+
//#region ../../src/core/providers/KeylessJsonSchemaCodec.d.ts
|
|
833
|
+
interface KeylessCodec<T = any> {
|
|
834
|
+
encode: (value: T) => string;
|
|
835
|
+
decode: (str: string) => T;
|
|
836
|
+
}
|
|
837
|
+
interface KeylessCodecOptions {
|
|
838
|
+
/**
|
|
839
|
+
* Whether to use `new Function()` for code compilation.
|
|
840
|
+
* When false, uses an interpreter-based approach (safer but slower).
|
|
841
|
+
*
|
|
842
|
+
* @default Auto-detected: false in browser (CSP compatibility), true on server
|
|
843
|
+
*/
|
|
844
|
+
useFunctionCompilation?: boolean;
|
|
845
|
+
/**
|
|
846
|
+
* Maximum allowed array length during encoding/decoding.
|
|
847
|
+
* Prevents DoS attacks via large arrays.
|
|
848
|
+
*
|
|
849
|
+
* @default 10000
|
|
850
|
+
*/
|
|
851
|
+
maxArrayLength?: number;
|
|
852
|
+
/**
|
|
853
|
+
* Maximum allowed string length during encoding/decoding.
|
|
854
|
+
* Prevents DoS attacks via large strings.
|
|
855
|
+
*
|
|
856
|
+
* @default 1000000 (1MB)
|
|
857
|
+
*/
|
|
858
|
+
maxStringLength?: number;
|
|
859
|
+
/**
|
|
860
|
+
* Maximum recursion depth for nested objects.
|
|
861
|
+
* Prevents stack overflow attacks.
|
|
862
|
+
*
|
|
863
|
+
* @default 50
|
|
864
|
+
*/
|
|
865
|
+
maxDepth?: number;
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* KeylessJsonSchemaCodec provides schema-driven JSON encoding without keys.
|
|
869
|
+
*
|
|
870
|
+
* It uses the schema to determine field order, allowing the encoded output
|
|
871
|
+
* to be a simple JSON array instead of an object with keys.
|
|
872
|
+
*/
|
|
873
|
+
declare class KeylessJsonSchemaCodec extends SchemaCodec {
|
|
874
|
+
protected readonly cache: Map<TSchema$1, KeylessCodec<any>>;
|
|
875
|
+
protected readonly textEncoder: TextEncoder;
|
|
876
|
+
protected readonly textDecoder: TextDecoder;
|
|
877
|
+
protected varCounter: number;
|
|
878
|
+
protected useFunctionCompilation: boolean;
|
|
879
|
+
protected maxArrayLength: number;
|
|
880
|
+
protected maxStringLength: number;
|
|
881
|
+
protected maxDepth: number;
|
|
882
|
+
/**
|
|
883
|
+
* Configure codec options.
|
|
884
|
+
*/
|
|
885
|
+
configure(options: KeylessCodecOptions): this;
|
|
886
|
+
/**
|
|
887
|
+
* Hook to auto-detect safe mode on configure.
|
|
888
|
+
* Disables function compilation in browser by default.
|
|
889
|
+
*/
|
|
890
|
+
protected onConfigure: HookPrimitive<"configure">;
|
|
891
|
+
/**
|
|
892
|
+
* Encode value to a keyless JSON string.
|
|
893
|
+
*/
|
|
894
|
+
encodeToString<T extends TSchema$1>(schema: T, value: Static<T>): string;
|
|
895
|
+
/**
|
|
896
|
+
* Encode value to binary (UTF-8 encoded keyless JSON).
|
|
897
|
+
*/
|
|
898
|
+
encodeToBinary<T extends TSchema$1>(schema: T, value: Static<T>): Uint8Array;
|
|
899
|
+
/**
|
|
900
|
+
* Decode keyless JSON string or binary to value.
|
|
901
|
+
*/
|
|
902
|
+
decode<T>(schema: TSchema$1, value: unknown): T;
|
|
903
|
+
/**
|
|
904
|
+
* Test if `new Function()` is available (not blocked by CSP).
|
|
905
|
+
*/
|
|
906
|
+
protected canUseFunction(): boolean;
|
|
907
|
+
/**
|
|
908
|
+
* Validate schema keys for prototype pollution.
|
|
909
|
+
* Uses a visited set to avoid infinite recursion on recursive schemas.
|
|
910
|
+
*/
|
|
911
|
+
protected validateSchemaKeys(schema: TSchema$1, depth?: number, visited?: Set<TSchema$1>): void;
|
|
912
|
+
/**
|
|
913
|
+
* Validate array length.
|
|
914
|
+
*/
|
|
915
|
+
protected validateArrayLength(arr: unknown[]): void;
|
|
916
|
+
/**
|
|
917
|
+
* Validate string length.
|
|
918
|
+
*/
|
|
919
|
+
protected validateStringLength(str: string): void;
|
|
920
|
+
/**
|
|
921
|
+
* Get a compiled codec for the given schema.
|
|
922
|
+
* Codecs are cached for reuse.
|
|
923
|
+
*/
|
|
924
|
+
protected getCodec<T>(schema: TSchema$1): KeylessCodec<T>;
|
|
925
|
+
protected nextVar(): string;
|
|
926
|
+
/**
|
|
927
|
+
* Compile codec using `new Function()` for maximum performance.
|
|
928
|
+
* Only used when CSP allows and useFunctionCompilation is true.
|
|
929
|
+
*/
|
|
930
|
+
protected compileWithFunction(schema: TSchema$1): KeylessCodec;
|
|
931
|
+
/**
|
|
932
|
+
* Compile codec using interpreter-based approach.
|
|
933
|
+
* Safer (no eval/Function) but slower. Used in browser by default.
|
|
934
|
+
*/
|
|
935
|
+
protected compileInterpreted(schema: TSchema$1): KeylessCodec;
|
|
936
|
+
protected interpretEncode(schema: TSchema$1, value: any): any;
|
|
937
|
+
protected interpretDecode(schema: TSchema$1, ctx: {
|
|
938
|
+
arr: any[];
|
|
939
|
+
i: number;
|
|
940
|
+
}): any;
|
|
941
|
+
protected interpretDecodeFromValue(schema: TSchema$1, value: any): any;
|
|
942
|
+
protected genEnc(schema: TSchema$1, ve: string): string;
|
|
943
|
+
protected genDec(schema: TSchema$1): {
|
|
944
|
+
code: string;
|
|
945
|
+
result: string;
|
|
946
|
+
};
|
|
947
|
+
protected genDecFromValue(schema: TSchema$1, expr: string): string;
|
|
948
|
+
protected isEnum(schema: TSchema$1): boolean;
|
|
949
|
+
protected isNullable(schema: TSchema$1): boolean;
|
|
950
|
+
protected unwrap(schema: TSchema$1): TSchema$1;
|
|
951
|
+
/**
|
|
952
|
+
* Reconstruct an object from a parsed array (for when input is already parsed).
|
|
953
|
+
*/
|
|
954
|
+
protected reconstructObject(schema: TSchema$1, arr: any[]): any;
|
|
955
|
+
}
|
|
956
|
+
//#endregion
|
|
880
957
|
//#region ../../src/core/providers/SchemaValidator.d.ts
|
|
881
958
|
declare class SchemaValidator {
|
|
882
959
|
protected cache: Map<TSchema$1, Validator<typebox0.TProperties, TSchema$1, unknown, unknown>>;
|
|
883
960
|
protected useEval: boolean;
|
|
884
961
|
/**
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
962
|
+
* Validate the value against the provided schema.
|
|
963
|
+
*
|
|
964
|
+
* Validation create a new value by applying some preprocessing. (e.g., trimming text)
|
|
965
|
+
*/
|
|
889
966
|
validate<T extends TSchema$1>(schema: T, value: unknown, options?: ValidateOptions): Static<T>;
|
|
890
967
|
protected getValidator<T extends TSchema$1>(schema: T): Validator<{}, T>;
|
|
891
968
|
/**
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
969
|
+
* Preprocess the value based on the schema before validation.
|
|
970
|
+
*
|
|
971
|
+
* - If the value is `null` and the schema does not allow `null`, it converts it to `undefined`.
|
|
972
|
+
* - If the value is a string and the schema has a `~options.trim` flag, it trims whitespace from the string.
|
|
973
|
+
*/
|
|
897
974
|
beforeParse(schema: any, value: any, options: ValidateOptions): any;
|
|
898
975
|
/**
|
|
899
|
-
|
|
900
|
-
|
|
976
|
+
* Used by `beforeParse` to determine if a schema allows null values.
|
|
977
|
+
*/
|
|
901
978
|
protected isSchemaNullable: (schema: any) => boolean;
|
|
902
979
|
protected onConfigure: HookPrimitive<"configure">;
|
|
903
980
|
protected canEval(): boolean;
|
|
@@ -912,35 +989,35 @@ interface ValidateOptions {
|
|
|
912
989
|
type Encoding = "object" | "string" | "binary";
|
|
913
990
|
interface EncodeOptions<T extends Encoding = Encoding> {
|
|
914
991
|
/**
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
992
|
+
* The output encoding format:
|
|
993
|
+
* - 'string': Returns JSON string
|
|
994
|
+
* - 'binary': Returns Uint8Array (for protobuf, msgpack, etc.)
|
|
995
|
+
*
|
|
996
|
+
* @default "string"
|
|
997
|
+
*/
|
|
921
998
|
as?: T;
|
|
922
999
|
/**
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
1000
|
+
* The encoder to use (e.g., 'json', 'protobuf', 'msgpack')
|
|
1001
|
+
*
|
|
1002
|
+
* @default "json"
|
|
1003
|
+
*/
|
|
927
1004
|
encoder?: string;
|
|
928
1005
|
/**
|
|
929
|
-
|
|
930
|
-
|
|
1006
|
+
* Validation options to apply before encoding.
|
|
1007
|
+
*/
|
|
931
1008
|
validation?: ValidateOptions | false;
|
|
932
1009
|
}
|
|
933
1010
|
type EncodeResult<T extends TSchema$1, E extends Encoding> = E extends "string" ? string : E extends "binary" ? Uint8Array : StaticEncode$1<T>;
|
|
934
1011
|
interface DecodeOptions {
|
|
935
1012
|
/**
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1013
|
+
* The encoder to use (e.g., 'json', 'protobuf', 'msgpack')
|
|
1014
|
+
*
|
|
1015
|
+
* @default "json"
|
|
1016
|
+
*/
|
|
940
1017
|
encoder?: string;
|
|
941
1018
|
/**
|
|
942
|
-
|
|
943
|
-
|
|
1019
|
+
* Validation options to apply before encoding.
|
|
1020
|
+
*/
|
|
944
1021
|
validation?: ValidateOptions | false;
|
|
945
1022
|
}
|
|
946
1023
|
/**
|
|
@@ -955,30 +1032,30 @@ declare class CodecManager {
|
|
|
955
1032
|
default: string;
|
|
956
1033
|
constructor();
|
|
957
1034
|
/**
|
|
958
|
-
|
|
959
|
-
|
|
1035
|
+
* Register a new codec format.
|
|
1036
|
+
*/
|
|
960
1037
|
register(opts: CodecRegisterOptions): void;
|
|
961
1038
|
/**
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
1039
|
+
* Get a specific codec by name.
|
|
1040
|
+
*
|
|
1041
|
+
* @param name - The name of the codec
|
|
1042
|
+
* @returns The codec instance
|
|
1043
|
+
* @throws {AlephaError} If the codec is not found
|
|
1044
|
+
*/
|
|
968
1045
|
getCodec(name: string): SchemaCodec;
|
|
969
1046
|
/**
|
|
970
|
-
|
|
971
|
-
|
|
1047
|
+
* Encode data using the specified codec and output format.
|
|
1048
|
+
*/
|
|
972
1049
|
encode<T extends TSchema$1, E extends Encoding = "object">(schema: T, value: unknown, options?: EncodeOptions<E>): EncodeResult<T, E>;
|
|
973
1050
|
/**
|
|
974
|
-
|
|
975
|
-
|
|
1051
|
+
* Decode data using the specified codec.
|
|
1052
|
+
*/
|
|
976
1053
|
decode<T extends TSchema$1>(schema: T, data: any, options?: DecodeOptions): Static<T>;
|
|
977
1054
|
/**
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
1055
|
+
* Validate decoded data against the schema.
|
|
1056
|
+
*
|
|
1057
|
+
* This is automatically called before encoding or after decoding.
|
|
1058
|
+
*/
|
|
982
1059
|
validate<T extends TSchema$1>(schema: T, value: unknown, options?: ValidateOptions): Static<T>;
|
|
983
1060
|
}
|
|
984
1061
|
interface CodecRegisterOptions {
|
|
@@ -998,67 +1075,60 @@ type CompiledEventExecutor<T> = (payload: T) => void | Promise<void>;
|
|
|
998
1075
|
*/
|
|
999
1076
|
interface CompileOptions {
|
|
1000
1077
|
/**
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1078
|
+
* If true, errors will be caught and logged instead of throwing.
|
|
1079
|
+
* @default false
|
|
1080
|
+
*/
|
|
1004
1081
|
catch?: boolean;
|
|
1005
1082
|
}
|
|
1006
1083
|
declare class EventManager {
|
|
1007
1084
|
logFn?: () => LoggerInterface | undefined;
|
|
1008
1085
|
/**
|
|
1009
|
-
|
|
1010
|
-
|
|
1086
|
+
* List of events that can be triggered. Powered by $hook().
|
|
1087
|
+
*/
|
|
1011
1088
|
protected events: Record<string, Array<Hook>>;
|
|
1012
1089
|
constructor(logFn?: () => LoggerInterface | undefined);
|
|
1013
1090
|
protected get log(): LoggerInterface | undefined;
|
|
1014
1091
|
clear(): void;
|
|
1015
1092
|
/**
|
|
1016
|
-
|
|
1017
|
-
|
|
1093
|
+
* Registers a hook for the specified event.
|
|
1094
|
+
*/
|
|
1018
1095
|
on<T extends keyof Hooks>(event: T, hookOrFunc: Hook<T> | ((payload: Hooks[T]) => Async<void>)): () => void;
|
|
1019
1096
|
/**
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1097
|
+
* Compiles an event into an optimized executor function.
|
|
1098
|
+
*
|
|
1099
|
+
* Call this after all hooks are registered (e.g., after Alepha.start()).
|
|
1100
|
+
* The returned function checks each hook's return value and awaits promises.
|
|
1101
|
+
* Returns undefined if all hooks are sync, or a Promise if any hook returns one.
|
|
1102
|
+
*
|
|
1103
|
+
* @example
|
|
1104
|
+
* ```ts
|
|
1105
|
+
* // At startup (after hooks are registered)
|
|
1106
|
+
* const onRequest = alepha.events.compile("server:onRequest", { catch: true });
|
|
1107
|
+
*
|
|
1108
|
+
* // In hot path - only await if promise returned
|
|
1109
|
+
* const result = onRequest({ request, route });
|
|
1110
|
+
* if (result) await result;
|
|
1111
|
+
* ```
|
|
1112
|
+
*/
|
|
1036
1113
|
compile<T extends keyof Hooks>(event: T, options?: CompileOptions): CompiledEventExecutor<Hooks[T]>;
|
|
1037
1114
|
/**
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1115
|
+
* Emits the specified event with the given payload.
|
|
1116
|
+
*
|
|
1117
|
+
* For hot paths (like HTTP request handling), use compile() instead
|
|
1118
|
+
* to get an optimized executor.
|
|
1119
|
+
*/
|
|
1043
1120
|
emit<T extends keyof Hooks>(func: T, payload: Hooks[T], options?: {
|
|
1044
1121
|
/**
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
*/
|
|
1050
|
-
reverse?: boolean;
|
|
1051
|
-
/**
|
|
1052
|
-
* If true, the hooks will be logged with their execution time.
|
|
1053
|
-
*
|
|
1054
|
-
* @default false
|
|
1055
|
-
*/
|
|
1122
|
+
* If true, the hooks will be logged with their execution time.
|
|
1123
|
+
*
|
|
1124
|
+
* @default false
|
|
1125
|
+
*/
|
|
1056
1126
|
log?: boolean;
|
|
1057
1127
|
/**
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1128
|
+
* If true, errors will be caught and logged instead of throwing.
|
|
1129
|
+
*
|
|
1130
|
+
* @default false
|
|
1131
|
+
*/
|
|
1062
1132
|
catch?: boolean;
|
|
1063
1133
|
}): Promise<void>;
|
|
1064
1134
|
}
|
|
@@ -1078,39 +1148,39 @@ declare class StateManager<State$1 extends object = State> {
|
|
|
1078
1148
|
getAtoms(context?: boolean): Array<AtomWithValue>;
|
|
1079
1149
|
register(atom: Atom<any>): this;
|
|
1080
1150
|
/**
|
|
1081
|
-
|
|
1082
|
-
|
|
1151
|
+
* Get a value from the state with proper typing
|
|
1152
|
+
*/
|
|
1083
1153
|
get<T extends TAtomObject>(target: Atom<T>): Static<T>;
|
|
1084
1154
|
get<Key extends keyof State$1>(target: Key): State$1[Key] | undefined;
|
|
1085
1155
|
/**
|
|
1086
|
-
|
|
1087
|
-
|
|
1156
|
+
* Set a value in the state
|
|
1157
|
+
*/
|
|
1088
1158
|
set<T extends TAtomObject>(target: Atom<T>, value: AtomStatic<T>, options?: SetStateOptions): this;
|
|
1089
1159
|
set<Key extends keyof State$1>(target: Key, value: State$1[Key] | undefined, options?: SetStateOptions): this;
|
|
1090
1160
|
/**
|
|
1091
|
-
|
|
1092
|
-
|
|
1161
|
+
* Mutate a value in the state.
|
|
1162
|
+
*/
|
|
1093
1163
|
mut<T extends TObject$1>(target: Atom<T>, mutator: (current: Static<T>) => Static<T>): this;
|
|
1094
1164
|
mut<Key extends keyof State$1>(target: Key, mutator: (current: State$1[Key] | undefined) => State$1[Key] | undefined): this;
|
|
1095
1165
|
/**
|
|
1096
|
-
|
|
1097
|
-
|
|
1166
|
+
* Check if a key exists in the state
|
|
1167
|
+
*/
|
|
1098
1168
|
has<Key extends keyof State$1>(key: Key): boolean;
|
|
1099
1169
|
/**
|
|
1100
|
-
|
|
1101
|
-
|
|
1170
|
+
* Delete a key from the state (set to undefined)
|
|
1171
|
+
*/
|
|
1102
1172
|
del<Key extends keyof State$1>(key: Key): this;
|
|
1103
1173
|
/**
|
|
1104
|
-
|
|
1105
|
-
|
|
1174
|
+
* Push a value to an array in the state
|
|
1175
|
+
*/
|
|
1106
1176
|
push<Key extends keyof OnlyArray<State$1>>(key: Key, ...value: Array<NonNullable<State$1[Key]> extends Array<infer U> ? U : never>): this;
|
|
1107
1177
|
/**
|
|
1108
|
-
|
|
1109
|
-
|
|
1178
|
+
* Clear all state
|
|
1179
|
+
*/
|
|
1110
1180
|
clear(): this;
|
|
1111
1181
|
/**
|
|
1112
|
-
|
|
1113
|
-
|
|
1182
|
+
* Get all keys that exist in the state
|
|
1183
|
+
*/
|
|
1114
1184
|
keys(): (keyof State$1)[];
|
|
1115
1185
|
}
|
|
1116
1186
|
type OnlyArray<T extends object> = { [K in keyof T]: NonNullable<T[K]> extends Array<any> ? K : never };
|
|
@@ -1245,264 +1315,264 @@ interface SetStateOptions {
|
|
|
1245
1315
|
*/
|
|
1246
1316
|
declare class Alepha {
|
|
1247
1317
|
/**
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1318
|
+
* Creates a new instance of the Alepha container with some helpers:
|
|
1319
|
+
*
|
|
1320
|
+
* - merges `process.env` with the provided state.env when available.
|
|
1321
|
+
* - populates the test hooks for Vitest or Jest environments when available.
|
|
1322
|
+
*
|
|
1323
|
+
* If you are not interested about these helpers, you can use the constructor directly.
|
|
1324
|
+
*/
|
|
1255
1325
|
static create(state?: Partial<State>): Alepha;
|
|
1256
1326
|
/**
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1327
|
+
* Flag indicating whether the App won't accept any further changes.
|
|
1328
|
+
* Pass to true when #start() is called.
|
|
1329
|
+
*/
|
|
1260
1330
|
protected locked: boolean;
|
|
1261
1331
|
/**
|
|
1262
|
-
|
|
1263
|
-
|
|
1332
|
+
* True if the App has been configured.
|
|
1333
|
+
*/
|
|
1264
1334
|
protected configured: boolean;
|
|
1265
1335
|
/**
|
|
1266
|
-
|
|
1267
|
-
|
|
1336
|
+
* True if the App has started.
|
|
1337
|
+
*/
|
|
1268
1338
|
protected started: boolean;
|
|
1269
1339
|
/**
|
|
1270
|
-
|
|
1271
|
-
|
|
1340
|
+
* True if the App is ready.
|
|
1341
|
+
*/
|
|
1272
1342
|
protected ready: boolean;
|
|
1273
1343
|
/**
|
|
1274
|
-
|
|
1275
|
-
|
|
1344
|
+
* A promise that resolves when the App has started.
|
|
1345
|
+
*/
|
|
1276
1346
|
protected starting?: PromiseWithResolvers<this>;
|
|
1277
1347
|
/**
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1348
|
+
* During the instantiation process, we keep a list of pending instantiations.
|
|
1349
|
+
* > It allows us to detect circular dependencies.
|
|
1350
|
+
*/
|
|
1281
1351
|
protected pendingInstantiations: Service[];
|
|
1282
1352
|
/**
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1353
|
+
* Cache for environment variables.
|
|
1354
|
+
* > It allows us to avoid parsing the same schema multiple times.
|
|
1355
|
+
*/
|
|
1286
1356
|
protected cacheEnv: Map<TSchema, any>;
|
|
1287
1357
|
/**
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1358
|
+
* List of modules that are registered in the container.
|
|
1359
|
+
*
|
|
1360
|
+
* Modules are used to group services and provide a way to register them in the container.
|
|
1361
|
+
*/
|
|
1292
1362
|
protected modules: Array<Module>;
|
|
1293
1363
|
/**
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1364
|
+
* List of service substitutions.
|
|
1365
|
+
*
|
|
1366
|
+
* Services registered here will be replaced by the specified service when injected.
|
|
1367
|
+
*/
|
|
1298
1368
|
protected substitutions: Map<Service, {
|
|
1299
1369
|
use: Service;
|
|
1300
1370
|
}>;
|
|
1301
1371
|
/**
|
|
1302
|
-
|
|
1303
|
-
|
|
1372
|
+
* Registry of primitives.
|
|
1373
|
+
*/
|
|
1304
1374
|
protected primitiveRegistry: Map<Service<Primitive<{}>>, Primitive<{}>[]>;
|
|
1305
1375
|
/**
|
|
1306
|
-
|
|
1307
|
-
|
|
1376
|
+
* List of all services + how they are provided.
|
|
1377
|
+
*/
|
|
1308
1378
|
protected registry: Map<Service, ServiceDefinition>;
|
|
1309
1379
|
/**
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1380
|
+
* Node.js feature that allows to store context across asynchronous calls.
|
|
1381
|
+
*
|
|
1382
|
+
* This is used for logging, tracing, and other context-related features.
|
|
1383
|
+
*
|
|
1384
|
+
* Mocked for browser environments.
|
|
1385
|
+
*/
|
|
1316
1386
|
context: AlsProvider;
|
|
1317
1387
|
/**
|
|
1318
|
-
|
|
1319
|
-
|
|
1388
|
+
* Event manager to handle lifecycle events and custom events.
|
|
1389
|
+
*/
|
|
1320
1390
|
events: EventManager;
|
|
1321
1391
|
/**
|
|
1322
|
-
|
|
1323
|
-
|
|
1392
|
+
* State manager to store arbitrary values.
|
|
1393
|
+
*/
|
|
1324
1394
|
store: StateManager<State>;
|
|
1325
1395
|
/**
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1396
|
+
* Codec manager for encoding and decoding data with different formats.
|
|
1397
|
+
*
|
|
1398
|
+
* Supports multiple codec formats (JSON, Protobuf, etc.) with a unified interface.
|
|
1399
|
+
*/
|
|
1330
1400
|
codec: CodecManager;
|
|
1331
1401
|
/**
|
|
1332
|
-
|
|
1333
|
-
|
|
1402
|
+
* Get logger instance.
|
|
1403
|
+
*/
|
|
1334
1404
|
get log(): LoggerInterface | undefined;
|
|
1335
1405
|
/**
|
|
1336
|
-
|
|
1337
|
-
|
|
1406
|
+
* The environment variables for the App.
|
|
1407
|
+
*/
|
|
1338
1408
|
get env(): Readonly<Env>;
|
|
1339
1409
|
constructor(state?: Partial<State>);
|
|
1340
1410
|
set<T extends TAtomObject>(target: Atom<T>, value: AtomStatic<T>): this;
|
|
1341
1411
|
set<Key extends keyof State>(target: Key, value: State[Key] | undefined): this;
|
|
1342
1412
|
/**
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1413
|
+
* True when start() is called.
|
|
1414
|
+
*
|
|
1415
|
+
* -> No more services can be added, it's over, bye!
|
|
1416
|
+
*/
|
|
1347
1417
|
isLocked(): boolean;
|
|
1348
1418
|
/**
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1419
|
+
* Returns whether the App is configured.
|
|
1420
|
+
*
|
|
1421
|
+
* It means that Alepha#configure() has been called.
|
|
1422
|
+
*
|
|
1423
|
+
* > By default, configure() is called automatically when start() is called, but you can also call it manually.
|
|
1424
|
+
*/
|
|
1355
1425
|
isConfigured(): boolean;
|
|
1356
1426
|
/**
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1427
|
+
* Returns whether the App has started.
|
|
1428
|
+
*
|
|
1429
|
+
* It means that #start() has been called but maybe not all services are ready.
|
|
1430
|
+
*/
|
|
1361
1431
|
isStarted(): boolean;
|
|
1362
1432
|
/**
|
|
1363
|
-
|
|
1364
|
-
|
|
1433
|
+
* True if the App is ready. It means that Alepha is started AND ready() hook has beed called.
|
|
1434
|
+
*/
|
|
1365
1435
|
isReady(): boolean;
|
|
1366
1436
|
/**
|
|
1367
|
-
|
|
1368
|
-
|
|
1437
|
+
* True if the App is running in a Continuous Integration environment.
|
|
1438
|
+
*/
|
|
1369
1439
|
isCI(): boolean;
|
|
1370
1440
|
/**
|
|
1371
|
-
|
|
1372
|
-
|
|
1441
|
+
* True if the App is running in a browser environment.
|
|
1442
|
+
*/
|
|
1373
1443
|
isBrowser(): boolean;
|
|
1374
1444
|
/**
|
|
1375
|
-
|
|
1376
|
-
|
|
1445
|
+
* Returns whether the App is running in Vite dev mode.
|
|
1446
|
+
*/
|
|
1377
1447
|
isViteDev(): boolean;
|
|
1378
1448
|
isBun(): boolean;
|
|
1379
1449
|
/**
|
|
1380
|
-
|
|
1381
|
-
|
|
1450
|
+
* Returns whether the App is running in a serverless environment.
|
|
1451
|
+
*/
|
|
1382
1452
|
isServerless(): boolean;
|
|
1383
1453
|
/**
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1454
|
+
* Returns whether the App is in test mode. (Running in a test environment)
|
|
1455
|
+
*
|
|
1456
|
+
* > This is automatically set when running tests with Jest or Vitest.
|
|
1457
|
+
*/
|
|
1388
1458
|
isTest(): boolean;
|
|
1389
1459
|
/**
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1460
|
+
* Returns whether the App is in production mode. (Running in a production environment)
|
|
1461
|
+
*
|
|
1462
|
+
* > This is automatically set by Vite or Vercel. However, you have to set it manually when running Docker apps.
|
|
1463
|
+
*/
|
|
1394
1464
|
isProduction(): boolean;
|
|
1395
1465
|
/**
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1466
|
+
* Starts the App.
|
|
1467
|
+
*
|
|
1468
|
+
* - Lock any further changes to the container.
|
|
1469
|
+
* - Run "configure" hook for all services. Primitives will be processed.
|
|
1470
|
+
* - Run "start" hook for all services. Providers will connect/listen/...
|
|
1471
|
+
* - Run "ready" hook for all services. This is the point where the App is ready to serve requests.
|
|
1472
|
+
*
|
|
1473
|
+
* @return A promise that resolves when the App has started.
|
|
1474
|
+
*/
|
|
1405
1475
|
start(): Promise<this>;
|
|
1406
1476
|
/**
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1477
|
+
* Stops the App.
|
|
1478
|
+
*
|
|
1479
|
+
* - Run "stop" hook for all services.
|
|
1480
|
+
*
|
|
1481
|
+
* Stop will NOT reset the container.
|
|
1482
|
+
* Stop will NOT unlock the container.
|
|
1483
|
+
*
|
|
1484
|
+
* > Stop is used to gracefully shut down the application, nothing more. There is no "restart".
|
|
1485
|
+
*
|
|
1486
|
+
* @return A promise that resolves when the App has stopped.
|
|
1487
|
+
*/
|
|
1418
1488
|
stop(): Promise<void>;
|
|
1419
1489
|
/**
|
|
1420
|
-
|
|
1421
|
-
|
|
1490
|
+
* Check if entry is registered in the container.
|
|
1491
|
+
*/
|
|
1422
1492
|
has(entry: ServiceEntry, opts?: {
|
|
1423
1493
|
/**
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1494
|
+
* Check if the entry is registered in the pending instantiation stack.
|
|
1495
|
+
*
|
|
1496
|
+
* @default true
|
|
1497
|
+
*/
|
|
1428
1498
|
inStack?: boolean;
|
|
1429
1499
|
/**
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1500
|
+
* Check if the entry is registered in the container registry.
|
|
1501
|
+
*
|
|
1502
|
+
* @default true
|
|
1503
|
+
*/
|
|
1434
1504
|
inRegistry?: boolean;
|
|
1435
1505
|
/**
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1506
|
+
* Check if the entry is registered in the substitutions.
|
|
1507
|
+
*
|
|
1508
|
+
* @default true
|
|
1509
|
+
*/
|
|
1440
1510
|
inSubstitutions?: boolean;
|
|
1441
1511
|
/**
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1512
|
+
* Where to look for registered services.
|
|
1513
|
+
*
|
|
1514
|
+
* @default this.registry
|
|
1515
|
+
*/
|
|
1446
1516
|
registry?: Map<Service, ServiceDefinition>;
|
|
1447
1517
|
}): boolean;
|
|
1448
1518
|
/**
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1519
|
+
* Registers the specified service in the container.
|
|
1520
|
+
*
|
|
1521
|
+
* - If the service is ALREADY registered, the method does nothing.
|
|
1522
|
+
* - If the service is NOT registered, a new instance is created and registered.
|
|
1523
|
+
*
|
|
1524
|
+
* Method is chainable, so you can register multiple services in a single call.
|
|
1525
|
+
*
|
|
1526
|
+
* > ServiceEntry allows to provide a service **substitution** feature.
|
|
1527
|
+
*
|
|
1528
|
+
* @example
|
|
1529
|
+
* ```ts
|
|
1530
|
+
* class A { value = "a"; }
|
|
1531
|
+
* class B { value = "b"; }
|
|
1532
|
+
* class M { a = $inject(A); }
|
|
1533
|
+
*
|
|
1534
|
+
* Alepha.create().with({ provide: A, use: B }).get(M).a.value; // "b"
|
|
1535
|
+
* ```
|
|
1536
|
+
*
|
|
1537
|
+
* > **Substitution** is an advanced feature that allows you to replace a service with another service.
|
|
1538
|
+
* > It's useful for testing or for providing different implementations of a service.
|
|
1539
|
+
* > If you are interested in configuring a service, use Alepha#configure() instead.
|
|
1540
|
+
*
|
|
1541
|
+
* @param serviceEntry - The service to register in the container.
|
|
1542
|
+
* @return Current instance of Alepha.
|
|
1543
|
+
*/
|
|
1474
1544
|
with<T extends object>(serviceEntry: ServiceEntry<T> | {
|
|
1475
1545
|
default: ServiceEntry<T>;
|
|
1476
1546
|
}): this;
|
|
1477
1547
|
/**
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1548
|
+
* Get an instance of the specified service from the container.
|
|
1549
|
+
*
|
|
1550
|
+
* @see {@link InjectOptions} for the available options.
|
|
1551
|
+
*/
|
|
1482
1552
|
inject<T extends object>(service: Service<T> | string, opts?: InjectOptions<T>): T;
|
|
1483
1553
|
/**
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1554
|
+
* Applies environment variables to the provided schema and state object.
|
|
1555
|
+
*
|
|
1556
|
+
* It replaces also all templated $ENV inside string values.
|
|
1557
|
+
*
|
|
1558
|
+
* @param schema - The schema object to apply environment variables to.
|
|
1559
|
+
* @return The schema object with environment variables applied.
|
|
1560
|
+
*/
|
|
1491
1561
|
parseEnv<T extends TObject$1>(schema: T): Static$1<T>;
|
|
1492
1562
|
/**
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1563
|
+
* Get all environment variable schemas and their parsed values.
|
|
1564
|
+
*
|
|
1565
|
+
* This is useful for DevTools to display all expected environment variables.
|
|
1566
|
+
*/
|
|
1497
1567
|
getEnvSchemas(): Array<{
|
|
1498
1568
|
schema: TSchema;
|
|
1499
1569
|
values: Record<string, any>;
|
|
1500
1570
|
}>;
|
|
1501
1571
|
/**
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1572
|
+
* Dump the current dependency graph of the App.
|
|
1573
|
+
*
|
|
1574
|
+
* This method returns a record where the keys are the names of the services.
|
|
1575
|
+
*/
|
|
1506
1576
|
graph(): Record<string, {
|
|
1507
1577
|
from: string[];
|
|
1508
1578
|
as?: string[];
|
|
@@ -1511,8 +1581,8 @@ declare class Alepha {
|
|
|
1511
1581
|
dump(): AlephaDump;
|
|
1512
1582
|
services<T extends object>(base: Service<T>): Array<T>;
|
|
1513
1583
|
/**
|
|
1514
|
-
|
|
1515
|
-
|
|
1584
|
+
* Get all primitives of the specified type.
|
|
1585
|
+
*/
|
|
1516
1586
|
primitives<TPrimitive extends Primitive>(factory: {
|
|
1517
1587
|
[KIND]: InstantiableClass<TPrimitive>;
|
|
1518
1588
|
} | string): Array<TPrimitive>;
|
|
@@ -1543,145 +1613,145 @@ interface AlephaDumpEnvVariable {
|
|
|
1543
1613
|
*/
|
|
1544
1614
|
interface ServiceDefinition<T extends object = any> {
|
|
1545
1615
|
/**
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1616
|
+
* The instance of the class or type definition.
|
|
1617
|
+
* Mostly used for caching / singleton but can be used for other purposes like forcing the instance.
|
|
1618
|
+
*/
|
|
1549
1619
|
instance: T;
|
|
1550
1620
|
/**
|
|
1551
|
-
|
|
1552
|
-
|
|
1621
|
+
* List of classes which use this class.
|
|
1622
|
+
*/
|
|
1553
1623
|
parents: Array<Service | null>;
|
|
1554
1624
|
}
|
|
1555
1625
|
interface Env {
|
|
1556
1626
|
[key: string]: string | boolean | number | undefined;
|
|
1557
1627
|
/**
|
|
1558
|
-
|
|
1559
|
-
|
|
1628
|
+
* Optional environment variable that indicates the current environment.
|
|
1629
|
+
*/
|
|
1560
1630
|
NODE_ENV?: string;
|
|
1561
1631
|
/**
|
|
1562
|
-
|
|
1563
|
-
|
|
1632
|
+
* Optional name of the application.
|
|
1633
|
+
*/
|
|
1564
1634
|
APP_NAME?: string;
|
|
1565
1635
|
/**
|
|
1566
|
-
|
|
1567
|
-
|
|
1636
|
+
* Optional root module name.
|
|
1637
|
+
*/
|
|
1568
1638
|
MODULE_NAME?: string;
|
|
1569
1639
|
}
|
|
1570
1640
|
interface State {
|
|
1571
1641
|
/**
|
|
1572
|
-
|
|
1573
|
-
|
|
1642
|
+
* Environment variables for the application.
|
|
1643
|
+
*/
|
|
1574
1644
|
env?: Readonly<Env>;
|
|
1575
1645
|
/**
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1646
|
+
* Logger instance to be used by the Alepha container.
|
|
1647
|
+
*
|
|
1648
|
+
* @internal
|
|
1649
|
+
*/
|
|
1580
1650
|
"alepha.logger"?: LoggerInterface;
|
|
1581
1651
|
/**
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1652
|
+
* If defined, the Alepha container will only register this service and its dependencies.
|
|
1653
|
+
*
|
|
1654
|
+
* @example
|
|
1655
|
+
* ```ts
|
|
1656
|
+
* class MigrateCmd {
|
|
1657
|
+
* db = $inject(DatabaseProvider);
|
|
1658
|
+
* alepha = $inject(Alepha);
|
|
1659
|
+
* env = $env(
|
|
1660
|
+
* t.object({
|
|
1661
|
+
* MIGRATE: t.optional(t.boolean()),
|
|
1662
|
+
* }),
|
|
1663
|
+
* );
|
|
1664
|
+
*
|
|
1665
|
+
* constructor() {
|
|
1666
|
+
* if (this.env.MIGRATE) {
|
|
1667
|
+
* this.alepha.set("alepha.target", MigrateCmd);
|
|
1668
|
+
* }
|
|
1669
|
+
* }
|
|
1670
|
+
*
|
|
1671
|
+
* ready = $hook({
|
|
1672
|
+
* on: "ready",
|
|
1673
|
+
* handler: async () => {
|
|
1674
|
+
* if (this.env.MIGRATE) {
|
|
1675
|
+
* await this.db.migrate();
|
|
1676
|
+
* }
|
|
1677
|
+
* },
|
|
1678
|
+
* });
|
|
1679
|
+
* }
|
|
1680
|
+
* ```
|
|
1681
|
+
*/
|
|
1612
1682
|
"alepha.target"?: Service;
|
|
1613
1683
|
/**
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1684
|
+
* Bind to Vitest 'beforeAll' hook.
|
|
1685
|
+
* Used for testing purposes.
|
|
1686
|
+
* This is automatically attached if Alepha#create() detects a test environment and global 'beforeAll' is available.
|
|
1687
|
+
*/
|
|
1618
1688
|
"alepha.test.beforeAll"?: (run: any) => any;
|
|
1619
1689
|
/**
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1690
|
+
* Bind to Vitest 'afterAll' hook.
|
|
1691
|
+
* Used for testing purposes.
|
|
1692
|
+
* This is automatically attached if Alepha#create() detects a test environment and global 'afterAll' is available.
|
|
1693
|
+
*/
|
|
1624
1694
|
"alepha.test.afterAll"?: (run: any) => any;
|
|
1625
1695
|
/**
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1696
|
+
* Bind to Vitest 'afterEach' hook.
|
|
1697
|
+
* Used for testing purposes.
|
|
1698
|
+
* This is automatically attached if Alepha#create() detects a test environment and global 'afterEach' is available.
|
|
1699
|
+
*/
|
|
1630
1700
|
"alepha.test.afterEach"?: (run: any) => any;
|
|
1631
1701
|
/**
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1702
|
+
* Bind to Vitest 'onTestFinished' hook.
|
|
1703
|
+
* Used for testing purposes.
|
|
1704
|
+
* This is automatically attached if Alepha#create() detects a test environment and global 'onTestFinished' is available.
|
|
1705
|
+
*/
|
|
1636
1706
|
"alepha.test.onTestFinished"?: (run: any) => any;
|
|
1637
1707
|
/**
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1708
|
+
* List of static assets to be copied to the output directory during the build process.
|
|
1709
|
+
*
|
|
1710
|
+
* Used for Alepha-based applications that require static assets.
|
|
1711
|
+
*
|
|
1712
|
+
* See alepha/vite for more details.
|
|
1713
|
+
*/
|
|
1644
1714
|
"alepha.build.assets"?: Array<string>;
|
|
1645
1715
|
}
|
|
1646
1716
|
interface Hooks {
|
|
1647
1717
|
/**
|
|
1648
|
-
|
|
1649
|
-
|
|
1718
|
+
* Used for testing purposes.
|
|
1719
|
+
*/
|
|
1650
1720
|
echo: unknown;
|
|
1651
1721
|
/**
|
|
1652
|
-
|
|
1653
|
-
|
|
1722
|
+
* Triggered during the configuration phase. Before the start phase.
|
|
1723
|
+
*/
|
|
1654
1724
|
configure: Alepha;
|
|
1655
1725
|
/**
|
|
1656
|
-
|
|
1657
|
-
|
|
1726
|
+
* Triggered during the start phase. When `Alepha#start()` is called.
|
|
1727
|
+
*/
|
|
1658
1728
|
start: Alepha;
|
|
1659
1729
|
/**
|
|
1660
|
-
|
|
1661
|
-
|
|
1730
|
+
* Triggered during the ready phase. After the start phase.
|
|
1731
|
+
*/
|
|
1662
1732
|
ready: Alepha;
|
|
1663
1733
|
/**
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1734
|
+
* Triggered during the stop phase.
|
|
1735
|
+
*
|
|
1736
|
+
* - Stop should be called after a SIGINT or SIGTERM signal in order to gracefully shutdown the application. (@see `run()` method)
|
|
1737
|
+
*
|
|
1738
|
+
*/
|
|
1669
1739
|
stop: Alepha;
|
|
1670
1740
|
/**
|
|
1671
|
-
|
|
1672
|
-
|
|
1741
|
+
* Triggered when a state value is mutated.
|
|
1742
|
+
*/
|
|
1673
1743
|
"state:mutate": {
|
|
1674
1744
|
/**
|
|
1675
|
-
|
|
1676
|
-
|
|
1745
|
+
* The key of the state that was mutated.
|
|
1746
|
+
*/
|
|
1677
1747
|
key: keyof State;
|
|
1678
1748
|
/**
|
|
1679
|
-
|
|
1680
|
-
|
|
1749
|
+
* The new value of the state.
|
|
1750
|
+
*/
|
|
1681
1751
|
value: any;
|
|
1682
1752
|
/**
|
|
1683
|
-
|
|
1684
|
-
|
|
1753
|
+
* The previous value of the state.
|
|
1754
|
+
*/
|
|
1685
1755
|
prevValue: any;
|
|
1686
1756
|
};
|
|
1687
1757
|
}
|
|
@@ -1796,8 +1866,8 @@ type TPage<T extends TObject | TRecord> = TObject<{
|
|
|
1796
1866
|
*/
|
|
1797
1867
|
type Page<T> = {
|
|
1798
1868
|
/**
|
|
1799
|
-
|
|
1800
|
-
|
|
1869
|
+
* Array of items on the current page.
|
|
1870
|
+
*/
|
|
1801
1871
|
content: T[];
|
|
1802
1872
|
page: Static<typeof pageMetadataSchema>;
|
|
1803
1873
|
};
|
|
@@ -1805,8 +1875,8 @@ type PageMetadata = Static<typeof pageMetadataSchema>;
|
|
|
1805
1875
|
declare module "alepha" {
|
|
1806
1876
|
interface TypeProvider {
|
|
1807
1877
|
/**
|
|
1808
|
-
|
|
1809
|
-
|
|
1878
|
+
* Create a schema for a paginated response.
|
|
1879
|
+
*/
|
|
1810
1880
|
page<T extends TObject | TRecord>(itemSchema: T): TPage<T>;
|
|
1811
1881
|
}
|
|
1812
1882
|
} //# sourceMappingURL=pageSchema.d.ts.map
|
|
@@ -1887,7 +1957,10 @@ interface JsonSchemaObject {
|
|
|
1887
1957
|
minItems?: number;
|
|
1888
1958
|
maxItems?: number;
|
|
1889
1959
|
uniqueItems?: boolean;
|
|
1890
|
-
"~
|
|
1960
|
+
"~options"?: {
|
|
1961
|
+
trim?: boolean;
|
|
1962
|
+
lowercase?: boolean;
|
|
1963
|
+
};
|
|
1891
1964
|
oneOf?: JsonSchemaObject[];
|
|
1892
1965
|
anyOf?: JsonSchemaObject[];
|
|
1893
1966
|
allOf?: JsonSchemaObject[];
|
|
@@ -1907,11 +1980,13 @@ interface JsonSchemaObject {
|
|
|
1907
1980
|
* - Nested objects with required/optional properties
|
|
1908
1981
|
* - Arrays with item schemas
|
|
1909
1982
|
* - Common validation options: minLength, maxLength, minimum, maximum, pattern
|
|
1983
|
+
* - anyOf/oneOf/allOf with nullable patterns (e.g., `anyOf: [type, null]` → `t.nullable(type)`)
|
|
1984
|
+
* - Alepha ~options (trim, lowercase) pass-through
|
|
1910
1985
|
*
|
|
1911
1986
|
* **Not supported:**
|
|
1912
|
-
* - oneOf, anyOf, allOf, not (composition schemas)
|
|
1913
1987
|
* - $ref (references)
|
|
1914
1988
|
* - additionalProperties, patternProperties
|
|
1989
|
+
* - Complex composition schemas (multiple non-null types in anyOf/oneOf/allOf)
|
|
1915
1990
|
*
|
|
1916
1991
|
* @param schema - JSON Schema object to convert
|
|
1917
1992
|
* @returns TypeBox TSchema
|
|
@@ -1937,7 +2012,7 @@ interface JsonSchemaObject {
|
|
|
1937
2012
|
* // })
|
|
1938
2013
|
* ```
|
|
1939
2014
|
*/
|
|
1940
|
-
declare function jsonSchemaToTypeBox(schema: JsonSchemaObject):
|
|
2015
|
+
declare function jsonSchemaToTypeBox(schema: JsonSchemaObject): any;
|
|
1941
2016
|
//#endregion
|
|
1942
2017
|
//#region ../../src/core/interfaces/Pagination.d.ts
|
|
1943
2018
|
/**
|
|
@@ -1965,14 +2040,14 @@ declare function jsonSchemaToTypeBox(schema: JsonSchemaObject): TSchema$1;
|
|
|
1965
2040
|
*/
|
|
1966
2041
|
interface PageRequest {
|
|
1967
2042
|
/**
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
2043
|
+
* The page number to retrieve (0-indexed).
|
|
2044
|
+
* @default 0
|
|
2045
|
+
*/
|
|
1971
2046
|
page?: number;
|
|
1972
2047
|
/**
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
2048
|
+
* The number of items per page.
|
|
2049
|
+
* @default 10
|
|
2050
|
+
*/
|
|
1976
2051
|
size?: number;
|
|
1977
2052
|
}
|
|
1978
2053
|
/**
|
|
@@ -1984,13 +2059,13 @@ type SortDirection = "asc" | "desc";
|
|
|
1984
2059
|
*/
|
|
1985
2060
|
interface SortField {
|
|
1986
2061
|
/**
|
|
1987
|
-
|
|
1988
|
-
|
|
2062
|
+
* The field/column name to sort by.
|
|
2063
|
+
*/
|
|
1989
2064
|
field: string;
|
|
1990
2065
|
/**
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
2066
|
+
* The sort direction.
|
|
2067
|
+
* @default "asc"
|
|
2068
|
+
*/
|
|
1994
2069
|
direction: SortDirection;
|
|
1995
2070
|
}
|
|
1996
2071
|
//#endregion
|
|
@@ -2025,17 +2100,17 @@ interface SortField {
|
|
|
2025
2100
|
declare const $context: () => ContextPrimitive;
|
|
2026
2101
|
interface ContextPrimitive {
|
|
2027
2102
|
/**
|
|
2028
|
-
|
|
2029
|
-
|
|
2103
|
+
* Alepha instance.
|
|
2104
|
+
*/
|
|
2030
2105
|
alepha: Alepha;
|
|
2031
2106
|
/**
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2107
|
+
* Service definition which is creating this primitive.
|
|
2108
|
+
* This is NOT the instance but the service definition.
|
|
2109
|
+
*/
|
|
2035
2110
|
service?: Service;
|
|
2036
2111
|
/**
|
|
2037
|
-
|
|
2038
|
-
|
|
2112
|
+
* Module definition, if any.
|
|
2113
|
+
*/
|
|
2039
2114
|
module?: Service;
|
|
2040
2115
|
}
|
|
2041
2116
|
//#endregion
|
|
@@ -2104,31 +2179,51 @@ type PageQuery = Static<typeof pageQuerySchema>;
|
|
|
2104
2179
|
//#region ../../src/core/interfaces/Run.d.ts
|
|
2105
2180
|
interface RunOptions {
|
|
2106
2181
|
/**
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2182
|
+
* Environment variables to be used by the application.
|
|
2183
|
+
* It will be merged with the current process environment.
|
|
2184
|
+
*/
|
|
2110
2185
|
env?: Env;
|
|
2111
2186
|
/**
|
|
2112
|
-
|
|
2113
|
-
|
|
2187
|
+
* A callback that will be executed before the application starts.
|
|
2188
|
+
*/
|
|
2114
2189
|
configure?: (alepha: Alepha) => Async<void>;
|
|
2115
2190
|
/**
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2191
|
+
* A callback that will be executed once the application is ready.
|
|
2192
|
+
* This is useful for initializing resources or starting background tasks.
|
|
2193
|
+
*/
|
|
2119
2194
|
ready?: (alepha: Alepha) => Async<void>;
|
|
2120
2195
|
/**
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2196
|
+
* If true, the application will .stop() after the ready callback is executed.
|
|
2197
|
+
* Useful for one-time tasks!
|
|
2198
|
+
*/
|
|
2124
2199
|
once?: boolean;
|
|
2125
2200
|
/**
|
|
2126
|
-
|
|
2127
|
-
|
|
2201
|
+
* If true, the application will run in cluster mode.
|
|
2202
|
+
*/
|
|
2128
2203
|
cluster?: boolean;
|
|
2129
2204
|
}
|
|
2130
2205
|
//#endregion
|
|
2131
2206
|
//#region ../../src/core/index.d.ts
|
|
2207
|
+
/**
|
|
2208
|
+
* | type | quality | stability |
|
|
2209
|
+
* |------|---------|-----------|
|
|
2210
|
+
* | tooling | epic | stable |
|
|
2211
|
+
*
|
|
2212
|
+
* Foundation of the entire framework with dependency injection and lifecycle management.
|
|
2213
|
+
*
|
|
2214
|
+
* **Features:**
|
|
2215
|
+
* - Dependency injection for services
|
|
2216
|
+
* - Service substitution/mocking
|
|
2217
|
+
* - Type-safe environment variable loading with TypeBox schemas
|
|
2218
|
+
* - Lifecycle hooks (start, stop, log, etc.)
|
|
2219
|
+
* - Module definitions and composition
|
|
2220
|
+
* - Request-scoped context access via Async Local Storage (ALS)
|
|
2221
|
+
* - Reactive state management with atoms
|
|
2222
|
+
* - Cluster mode with automatic worker forking
|
|
2223
|
+
* - Full TypeScript generics and type inference
|
|
2224
|
+
*
|
|
2225
|
+
* @module alepha.core
|
|
2226
|
+
*/
|
|
2132
2227
|
declare const AlephaCore: Service<Module>;
|
|
2133
2228
|
/**
|
|
2134
2229
|
* Run Alepha application, trigger start lifecycle.
|
|
@@ -2146,5 +2241,5 @@ declare const AlephaCore: Service<Module>;
|
|
|
2146
2241
|
*/
|
|
2147
2242
|
declare const run: (entry: Alepha | Service | Array<Service>, opts?: RunOptions) => Alepha;
|
|
2148
2243
|
//#endregion
|
|
2149
|
-
export { $atom, $context, $env, $hook, $inject, $module, $use, AbstractClass, Alepha, AlephaCore, AlephaDump, AlephaDumpEnvVariable, AlephaError, AlsProvider, AppNotStartedError, Async, AsyncFn, AsyncLocalStorageData, Atom, AtomOptions, AtomStatic, AtomWithValue, CircularDependencyError, CodecManager, CodecRegisterOptions, CompileOptions, CompiledEventExecutor, ContainerLockedError, ContextPrimitive, DecodeOptions, EncodeOptions, EncodeResult, Encoding, Env, EventManager, FileLike, Format, Hook, HookOptions, HookPrimitive, Hooks, InjectOptions, InjectPrimitive, InstantiableClass, JsonSchemaCodec, JsonSchemaObject, KIND, KeylessCodec, KeylessJsonSchemaCodec, LogLevel, LoggerInterface, MaybePromise, Module, ModulePrimitiveOptions, OPTIONS, Page, PageMetadata, PageQuery, PageRequest, Primitive, PrimitiveArgs, PrimitiveConfig, PrimitiveFactory, PrimitiveFactoryLike, RunFunction, SchemaCodec, Service, ServiceEntry, ServiceSubstitution, SetStateOptions, SortDirection, SortField, State, StateManager, type Static, type StaticDecode, type StaticEncode, StreamLike, type TAny, type TArray, TAtomObject, type TBigInt, type TBoolean, TFile, type TInteger, type TKeysToIndexer, type TNull, type TNumber, type TNumberOptions, type TObject, type TObjectOptions, type TOptional, type TOptionalAdd, TPage, type TPick, type TProperties, type TRecord, type TSchema, TStream, type TString, type TStringOptions, TTextOptions, type TTuple, type TUnion, type TUnsafe, type TVoid, TextLength, TooLateSubstitutionError, Type, TypeBoxError, TypeBoxErrorParams, TypeGuard, TypeProvider, Value, WithModule, createPagination, createPrimitive, isClass, isFileLike, isTypeFile, isUUID, jsonSchemaToTypeBox, pageMetadataSchema, pageQuerySchema, pageSchema, run, t };
|
|
2244
|
+
export { $atom, $context, $env, $hook, $inject, $module, $use, AbstractClass, Alepha, AlephaCore, AlephaDump, AlephaDumpEnvVariable, AlephaError, AlsProvider, AppNotStartedError, Async, AsyncFn, AsyncLocalStorageData, Atom, AtomOptions, AtomStatic, AtomWithValue, CircularDependencyError, CodecManager, CodecRegisterOptions, CompileOptions, CompiledEventExecutor, ContainerLockedError, ContextPrimitive, DecodeOptions, EncodeOptions, EncodeResult, Encoding, Env, EventManager, FileLike, Format, Hook, HookOptions, HookPrimitive, Hooks, InjectOptions, InjectPrimitive, InstantiableClass, Json, JsonSchemaCodec, JsonSchemaObject, KIND, KeylessCodec, KeylessCodecOptions, KeylessJsonSchemaCodec, LogLevel, LoggerInterface, MaybePromise, Module, ModulePrimitiveOptions, OPTIONS, Page, PageMetadata, PageQuery, PageRequest, Primitive, PrimitiveArgs, PrimitiveConfig, PrimitiveFactory, PrimitiveFactoryLike, RunFunction, SchemaCodec, Service, ServiceEntry, ServiceSubstitution, SetStateOptions, SortDirection, SortField, State, StateManager, type Static, type StaticDecode, type StaticEncode, StreamLike, type TAny, type TArray, TAtomObject, type TBigInt, type TBoolean, TFile, type TInteger, type TKeysToIndexer, type TNull, type TNumber, type TNumberOptions, type TObject, type TObjectOptions, type TOptional, type TOptionalAdd, TPage, type TPick, type TProperties, type TRecord, type TSchema, TStream, type TString, type TStringOptions, TTextOptions, type TTuple, type TUnion, type TUnsafe, type TVoid, TextLength, TooLateSubstitutionError, Type, TypeBoxError, TypeBoxErrorParams, TypeGuard, TypeProvider, Value, WithModule, createPagination, createPrimitive, isClass, isFileLike, isTypeFile, isUUID, jsonSchemaToTypeBox, pageMetadataSchema, pageQuerySchema, pageSchema, run, t };
|
|
2150
2245
|
//# sourceMappingURL=index.d.ts.map
|