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
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import * as alepha23 from "alepha";
|
|
2
|
-
import { Alepha, AlephaError, Page, PageQuery, Primitive, Static, StaticEncode, TNull, TObject, TOptional, TSchema, TUnion } from "alepha";
|
|
2
|
+
import { Alepha, AlephaError, FileLike, Json, Page, PageQuery, Primitive, Static, StaticEncode, StreamLike, TNull, TObject, TOptional, TSchema, TUnion } from "alepha";
|
|
3
3
|
import * as alepha_api_notifications0 from "alepha/api/notifications";
|
|
4
4
|
import { VerificationController } from "alepha/api/verifications";
|
|
5
5
|
import * as alepha_server0 from "alepha/server";
|
|
6
6
|
import * as alepha_orm24 from "alepha/orm";
|
|
7
7
|
import { Page as Page$1, Repository } from "alepha/orm";
|
|
8
8
|
import { AuditService } from "alepha/api/audits";
|
|
9
|
-
import * as
|
|
9
|
+
import * as alepha_logger6 from "alepha/logger";
|
|
10
10
|
import * as alepha_bucket0 from "alepha/bucket";
|
|
11
11
|
import * as alepha_server_links0 from "alepha/server/links";
|
|
12
12
|
import { OAuth2Profile, ServerAuthProvider, WithLinkFn, WithLoginFn } from "alepha/server/auth";
|
|
13
13
|
import * as alepha_cache0 from "alepha/cache";
|
|
14
14
|
import { DateTime, DateTimeProvider } from "alepha/datetime";
|
|
15
15
|
import { CryptoProvider, IssuerPrimitive, IssuerPrimitiveOptions, UserAccount } from "alepha/security";
|
|
16
|
-
import {
|
|
16
|
+
import { Readable } from "node:stream";
|
|
17
17
|
import { FileController } from "alepha/api/files";
|
|
18
18
|
import "drizzle-orm/d1";
|
|
19
19
|
import * as drizzle_orm0 from "drizzle-orm";
|
|
@@ -83,114 +83,114 @@ type TObjectUpdate<T extends TObject> = TObject<{ [K in keyof T["properties"]]:
|
|
|
83
83
|
//#region ../../src/orm/primitives/$entity.d.ts
|
|
84
84
|
interface EntityPrimitiveOptions<T extends TObject, Keys = keyof Static<T>> {
|
|
85
85
|
/**
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
* The database table name that will be created for this entity.
|
|
87
|
+
* If not provided, name will be inferred from the $repository variable name.
|
|
88
|
+
*/
|
|
89
89
|
name: string;
|
|
90
90
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
* TypeBox schema defining the table structure and column types.
|
|
92
|
+
*/
|
|
93
93
|
schema: T;
|
|
94
94
|
/**
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
* Database indexes to create for query optimization.
|
|
96
|
+
*/
|
|
97
97
|
indexes?: (Keys | {
|
|
98
98
|
/**
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
* Single column to index.
|
|
100
|
+
*/
|
|
101
101
|
column: Keys;
|
|
102
102
|
/**
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
* Whether this should be a unique index (enforces uniqueness constraint).
|
|
104
|
+
*/
|
|
105
105
|
unique?: boolean;
|
|
106
106
|
/**
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
* Custom name for the index. If not provided, generates name automatically.
|
|
108
|
+
*/
|
|
109
109
|
name?: string;
|
|
110
110
|
} | {
|
|
111
111
|
/**
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
* Multiple columns for composite index (order matters for query optimization).
|
|
113
|
+
*/
|
|
114
114
|
columns: Keys[];
|
|
115
115
|
/**
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
* Whether this should be a unique index (enforces uniqueness constraint).
|
|
117
|
+
*/
|
|
118
118
|
unique?: boolean;
|
|
119
119
|
/**
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
* Custom name for the index. If not provided, generates name automatically.
|
|
121
|
+
*/
|
|
122
122
|
name?: string;
|
|
123
123
|
})[];
|
|
124
124
|
/**
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
* Foreign key constraints to maintain referential integrity.
|
|
126
|
+
*/
|
|
127
127
|
foreignKeys?: Array<{
|
|
128
128
|
/**
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
* Optional name for the foreign key constraint.
|
|
130
|
+
*/
|
|
131
131
|
name?: string;
|
|
132
132
|
/**
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
* Local columns that reference the foreign table.
|
|
134
|
+
*/
|
|
135
135
|
columns: Array<keyof Static<T>>;
|
|
136
136
|
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
* Referenced columns in the foreign table.
|
|
138
|
+
* Must be EntityColumn references from other entities.
|
|
139
|
+
*/
|
|
140
140
|
foreignColumns: Array<() => EntityColumn<any>>;
|
|
141
141
|
}>;
|
|
142
142
|
/**
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
143
|
+
* Additional table constraints for data validation.
|
|
144
|
+
*
|
|
145
|
+
* Constraints enforce business rules at the database level, providing
|
|
146
|
+
* an additional layer of data integrity beyond application validation.
|
|
147
|
+
*
|
|
148
|
+
* **Constraint Types**:
|
|
149
|
+
* - **Unique constraints**: Prevent duplicate values across columns
|
|
150
|
+
* - **Check constraints**: Enforce custom validation rules with SQL expressions
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```ts
|
|
154
|
+
* constraints: [
|
|
155
|
+
* {
|
|
156
|
+
* name: "unique_user_email",
|
|
157
|
+
* columns: ["email"],
|
|
158
|
+
* unique: true
|
|
159
|
+
* },
|
|
160
|
+
* {
|
|
161
|
+
* name: "valid_age_range",
|
|
162
|
+
* columns: ["age"],
|
|
163
|
+
* check: sql`age >= 0 AND age <= 150`
|
|
164
|
+
* },
|
|
165
|
+
* {
|
|
166
|
+
* name: "unique_user_username_per_tenant",
|
|
167
|
+
* columns: ["tenantId", "username"],
|
|
168
|
+
* unique: true
|
|
169
|
+
* }
|
|
170
|
+
* ]
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
173
|
constraints?: Array<{
|
|
174
174
|
/**
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
* Columns involved in this constraint.
|
|
176
|
+
*/
|
|
177
177
|
columns: Array<keyof Static<T>>;
|
|
178
178
|
/**
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
* Optional name for the constraint.
|
|
180
|
+
*/
|
|
181
181
|
name?: string;
|
|
182
182
|
/**
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
* Whether this is a unique constraint.
|
|
184
|
+
*/
|
|
185
185
|
unique?: boolean | {};
|
|
186
186
|
/**
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
* SQL expression for check constraint validation.
|
|
188
|
+
*/
|
|
189
189
|
check?: SQL;
|
|
190
190
|
}>;
|
|
191
191
|
/**
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
* Advanced Drizzle ORM configuration for complex table setups.
|
|
193
|
+
*/
|
|
194
194
|
config?: (self: BuildExtraConfigColumns<string, FromSchema<T>, "pg">) => PgTableExtraConfigValue[];
|
|
195
195
|
}
|
|
196
196
|
declare class EntityPrimitive<T extends TObject = TObject> {
|
|
@@ -244,8 +244,8 @@ type PgSymbols = {
|
|
|
244
244
|
[PG_REF]: PgRefOptions;
|
|
245
245
|
[PG_ENUM]: PgEnumOptions;
|
|
246
246
|
/**
|
|
247
|
-
|
|
248
|
-
|
|
247
|
+
* @deprecated Use `PG_IDENTITY` instead.
|
|
248
|
+
*/
|
|
249
249
|
[PG_SERIAL]: {};
|
|
250
250
|
};
|
|
251
251
|
type PgSymbolKeys = keyof PgSymbols;
|
|
@@ -278,416 +278,416 @@ declare class DbError extends AlephaError {
|
|
|
278
278
|
//#region ../../src/orm/interfaces/FilterOperators.d.ts
|
|
279
279
|
interface FilterOperators<TValue> {
|
|
280
280
|
/**
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
281
|
+
* Test that two values are equal.
|
|
282
|
+
*
|
|
283
|
+
* Remember that the SQL standard dictates that
|
|
284
|
+
* two NULL values are not equal, so if you want to test
|
|
285
|
+
* whether a value is null, you may want to use
|
|
286
|
+
* `isNull` instead.
|
|
287
|
+
*
|
|
288
|
+
* ## Examples
|
|
289
|
+
*
|
|
290
|
+
* ```ts
|
|
291
|
+
* // Select cars made by Ford
|
|
292
|
+
* db.select().from(cars)
|
|
293
|
+
* .where(eq(cars.make, 'Ford'))
|
|
294
|
+
* ```
|
|
295
|
+
*
|
|
296
|
+
* @see isNull for a way to test equality to NULL.
|
|
297
|
+
*/
|
|
298
298
|
eq?: TValue;
|
|
299
299
|
/**
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
300
|
+
* Test that two values are not equal.
|
|
301
|
+
*
|
|
302
|
+
* Remember that the SQL standard dictates that
|
|
303
|
+
* two NULL values are not equal, so if you want to test
|
|
304
|
+
* whether a value is not null, you may want to use
|
|
305
|
+
* `isNotNull` instead.
|
|
306
|
+
*
|
|
307
|
+
* ## Examples
|
|
308
|
+
*
|
|
309
|
+
* ```ts
|
|
310
|
+
* // Select cars not made by Ford
|
|
311
|
+
* db.select().from(cars)
|
|
312
|
+
* .where(ne(cars.make, 'Ford'))
|
|
313
|
+
* ```
|
|
314
|
+
*
|
|
315
|
+
* @see isNotNull for a way to test whether a value is not null.
|
|
316
|
+
*/
|
|
317
317
|
ne?: TValue;
|
|
318
318
|
/**
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
319
|
+
* Test that the first expression passed is greater than
|
|
320
|
+
* the second expression.
|
|
321
|
+
*
|
|
322
|
+
* ## Examples
|
|
323
|
+
*
|
|
324
|
+
* ```ts
|
|
325
|
+
* // Select cars made after 2000.
|
|
326
|
+
* db.select().from(cars)
|
|
327
|
+
* .where(gt(cars.year, 2000))
|
|
328
|
+
* ```
|
|
329
|
+
*
|
|
330
|
+
* @see gte for greater-than-or-equal
|
|
331
|
+
*/
|
|
332
332
|
gt?: TValue;
|
|
333
333
|
/**
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
334
|
+
* Test that the first expression passed is greater than
|
|
335
|
+
* or equal to the second expression. Use `gt` to
|
|
336
|
+
* test whether an expression is strictly greater
|
|
337
|
+
* than another.
|
|
338
|
+
*
|
|
339
|
+
* ## Examples
|
|
340
|
+
*
|
|
341
|
+
* ```ts
|
|
342
|
+
* // Select cars made on or after 2000.
|
|
343
|
+
* db.select().from(cars)
|
|
344
|
+
* .where(gte(cars.year, 2000))
|
|
345
|
+
* ```
|
|
346
|
+
*
|
|
347
|
+
* @see gt for a strictly greater-than condition
|
|
348
|
+
*/
|
|
349
349
|
gte?: TValue;
|
|
350
350
|
/**
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
351
|
+
* Test that the first expression passed is less than
|
|
352
|
+
* the second expression.
|
|
353
|
+
*
|
|
354
|
+
* ## Examples
|
|
355
|
+
*
|
|
356
|
+
* ```ts
|
|
357
|
+
* // Select cars made before 2000.
|
|
358
|
+
* db.select().from(cars)
|
|
359
|
+
* .where(lt(cars.year, 2000))
|
|
360
|
+
* ```
|
|
361
|
+
*
|
|
362
|
+
* @see lte for greater-than-or-equal
|
|
363
|
+
*/
|
|
364
364
|
lt?: TValue;
|
|
365
365
|
/**
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
366
|
+
* Test that the first expression passed is less than
|
|
367
|
+
* or equal to the second expression.
|
|
368
|
+
*
|
|
369
|
+
* ## Examples
|
|
370
|
+
*
|
|
371
|
+
* ```ts
|
|
372
|
+
* // Select cars made before 2000.
|
|
373
|
+
* db.select().from(cars)
|
|
374
|
+
* .where(lte(cars.year, 2000))
|
|
375
|
+
* ```
|
|
376
|
+
*
|
|
377
|
+
* @see lt for a strictly less-than condition
|
|
378
|
+
*/
|
|
379
379
|
lte?: TValue;
|
|
380
380
|
/**
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
381
|
+
* Test whether the first parameter, a column or expression,
|
|
382
|
+
* has a value from a list passed as the second argument.
|
|
383
|
+
*
|
|
384
|
+
* ## Throws
|
|
385
|
+
*
|
|
386
|
+
* The argument passed in the second array can't be empty:
|
|
387
|
+
* if an empty is provided, this method will throw.
|
|
388
|
+
*
|
|
389
|
+
* ## Examples
|
|
390
|
+
*
|
|
391
|
+
* ```ts
|
|
392
|
+
* // Select cars made by Ford or GM.
|
|
393
|
+
* db.select().from(cars)
|
|
394
|
+
* .where(inArray(cars.make, ['Ford', 'GM']))
|
|
395
|
+
* ```
|
|
396
|
+
*
|
|
397
|
+
* @see notInArray for the inverse of this test
|
|
398
|
+
*/
|
|
399
399
|
inArray?: TValue[];
|
|
400
400
|
/**
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
401
|
+
* Test whether the first parameter, a column or expression,
|
|
402
|
+
* has a value that is not present in a list passed as the
|
|
403
|
+
* second argument.
|
|
404
|
+
*
|
|
405
|
+
* ## Throws
|
|
406
|
+
*
|
|
407
|
+
* The argument passed in the second array can't be empty:
|
|
408
|
+
* if an empty is provided, this method will throw.
|
|
409
|
+
*
|
|
410
|
+
* ## Examples
|
|
411
|
+
*
|
|
412
|
+
* ```ts
|
|
413
|
+
* // Select cars made by any company except Ford or GM.
|
|
414
|
+
* db.select().from(cars)
|
|
415
|
+
* .where(notInArray(cars.make, ['Ford', 'GM']))
|
|
416
|
+
* ```
|
|
417
|
+
*
|
|
418
|
+
* @see inArray for the inverse of this test
|
|
419
|
+
*/
|
|
420
420
|
notInArray?: TValue[];
|
|
421
421
|
/**
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
422
|
+
* Test whether an expression is not NULL. By the SQL standard,
|
|
423
|
+
* NULL is neither equal nor not equal to itself, so
|
|
424
|
+
* it's recommended to use `isNull` and `notIsNull` for
|
|
425
|
+
* comparisons to NULL.
|
|
426
|
+
*
|
|
427
|
+
* ## Examples
|
|
428
|
+
*
|
|
429
|
+
* ```ts
|
|
430
|
+
* // Select cars that have been discontinued.
|
|
431
|
+
* db.select().from(cars)
|
|
432
|
+
* .where(isNotNull(cars.discontinuedAt))
|
|
433
|
+
* ```
|
|
434
|
+
*
|
|
435
|
+
* @see isNull for the inverse of this test
|
|
436
|
+
*/
|
|
437
437
|
isNotNull?: true;
|
|
438
438
|
/**
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
439
|
+
* Test whether an expression is NULL. By the SQL standard,
|
|
440
|
+
* NULL is neither equal nor not equal to itself, so
|
|
441
|
+
* it's recommended to use `isNull` and `notIsNull` for
|
|
442
|
+
* comparisons to NULL.
|
|
443
|
+
*
|
|
444
|
+
* ## Examples
|
|
445
|
+
*
|
|
446
|
+
* ```ts
|
|
447
|
+
* // Select cars that have no discontinuedAt date.
|
|
448
|
+
* db.select().from(cars)
|
|
449
|
+
* .where(isNull(cars.discontinuedAt))
|
|
450
|
+
* ```
|
|
451
|
+
*
|
|
452
|
+
* @see isNotNull for the inverse of this test
|
|
453
|
+
*/
|
|
454
454
|
isNull?: true;
|
|
455
455
|
/**
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
456
|
+
* Test whether an expression is between two values. This
|
|
457
|
+
* is an easier way to express range tests, which would be
|
|
458
|
+
* expressed mathematically as `x <= a <= y` but in SQL
|
|
459
|
+
* would have to be like `a >= x AND a <= y`.
|
|
460
|
+
*
|
|
461
|
+
* Between is inclusive of the endpoints: if `column`
|
|
462
|
+
* is equal to `min` or `max`, it will be TRUE.
|
|
463
|
+
*
|
|
464
|
+
* ## Examples
|
|
465
|
+
*
|
|
466
|
+
* ```ts
|
|
467
|
+
* // Select cars made between 1990 and 2000
|
|
468
|
+
* db.select().from(cars)
|
|
469
|
+
* .where(between(cars.year, 1990, 2000))
|
|
470
|
+
* ```
|
|
471
|
+
*
|
|
472
|
+
* @see notBetween for the inverse of this test
|
|
473
|
+
*/
|
|
474
474
|
between?: [number, number];
|
|
475
475
|
/**
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
476
|
+
* Test whether an expression is not between two values.
|
|
477
|
+
*
|
|
478
|
+
* This, like `between`, includes its endpoints, so if
|
|
479
|
+
* the `column` is equal to `min` or `max`, in this case
|
|
480
|
+
* it will evaluate to FALSE.
|
|
481
|
+
*
|
|
482
|
+
* ## Examples
|
|
483
|
+
*
|
|
484
|
+
* ```ts
|
|
485
|
+
* // Exclude cars made in the 1970s
|
|
486
|
+
* db.select().from(cars)
|
|
487
|
+
* .where(notBetween(cars.year, 1970, 1979))
|
|
488
|
+
* ```
|
|
489
|
+
*
|
|
490
|
+
* @see between for the inverse of this test
|
|
491
|
+
*/
|
|
492
492
|
notBetween?: [number, number];
|
|
493
493
|
/**
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
494
|
+
* Compare a column to a pattern, which can include `%` and `_`
|
|
495
|
+
* characters to match multiple variations. Including `%`
|
|
496
|
+
* in the pattern matches zero or more characters, and including
|
|
497
|
+
* `_` will match a single character.
|
|
498
|
+
*
|
|
499
|
+
* ## Examples
|
|
500
|
+
*
|
|
501
|
+
* ```ts
|
|
502
|
+
* // Select all cars with 'Turbo' in their names.
|
|
503
|
+
* db.select().from(cars)
|
|
504
|
+
* .where(like(cars.name, '%Turbo%'))
|
|
505
|
+
* ```
|
|
506
|
+
*
|
|
507
|
+
* @see ilike for a case-insensitive version of this condition
|
|
508
|
+
*/
|
|
509
509
|
like?: string;
|
|
510
510
|
/**
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
511
|
+
* The inverse of like - this tests that a given column
|
|
512
|
+
* does not match a pattern, which can include `%` and `_`
|
|
513
|
+
* characters to match multiple variations. Including `%`
|
|
514
|
+
* in the pattern matches zero or more characters, and including
|
|
515
|
+
* `_` will match a single character.
|
|
516
|
+
*
|
|
517
|
+
* ## Examples
|
|
518
|
+
*
|
|
519
|
+
* ```ts
|
|
520
|
+
* // Select all cars that don't have "ROver" in their name.
|
|
521
|
+
* db.select().from(cars)
|
|
522
|
+
* .where(notLike(cars.name, '%Rover%'))
|
|
523
|
+
* ```
|
|
524
|
+
*
|
|
525
|
+
* @see like for the inverse condition
|
|
526
|
+
* @see notIlike for a case-insensitive version of this condition
|
|
527
|
+
*/
|
|
528
528
|
notLike?: string;
|
|
529
529
|
/**
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
530
|
+
* Case-insensitively compare a column to a pattern,
|
|
531
|
+
* which can include `%` and `_`
|
|
532
|
+
* characters to match multiple variations. Including `%`
|
|
533
|
+
* in the pattern matches zero or more characters, and including
|
|
534
|
+
* `_` will match a single character.
|
|
535
|
+
*
|
|
536
|
+
* Unlike like, this performs a case-insensitive comparison.
|
|
537
|
+
*
|
|
538
|
+
* ## Examples
|
|
539
|
+
*
|
|
540
|
+
* ```ts
|
|
541
|
+
* // Select all cars with 'Turbo' in their names.
|
|
542
|
+
* db.select().from(cars)
|
|
543
|
+
* .where(ilike(cars.name, '%Turbo%'))
|
|
544
|
+
* ```
|
|
545
|
+
*
|
|
546
|
+
* @see like for a case-sensitive version of this condition
|
|
547
|
+
*/
|
|
548
548
|
ilike?: string;
|
|
549
549
|
/**
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
550
|
+
* The inverse of ilike - this case-insensitively tests that a given column
|
|
551
|
+
* does not match a pattern, which can include `%` and `_`
|
|
552
|
+
* characters to match multiple variations. Including `%`
|
|
553
|
+
* in the pattern matches zero or more characters, and including
|
|
554
|
+
* `_` will match a single character.
|
|
555
|
+
*
|
|
556
|
+
* ## Examples
|
|
557
|
+
*
|
|
558
|
+
* ```ts
|
|
559
|
+
* // Select all cars that don't have "Rover" in their name.
|
|
560
|
+
* db.select().from(cars)
|
|
561
|
+
* .where(notLike(cars.name, '%Rover%'))
|
|
562
|
+
* ```
|
|
563
|
+
*
|
|
564
|
+
* @see ilike for the inverse condition
|
|
565
|
+
* @see notLike for a case-sensitive version of this condition
|
|
566
|
+
*/
|
|
567
567
|
notIlike?: string;
|
|
568
568
|
/**
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
569
|
+
* Syntactic sugar for case-insensitive substring matching.
|
|
570
|
+
* Automatically wraps the value with `%` wildcards on both sides.
|
|
571
|
+
*
|
|
572
|
+
* Equivalent to: `ilike: '%value%'`
|
|
573
|
+
*
|
|
574
|
+
* ## Examples
|
|
575
|
+
*
|
|
576
|
+
* ```ts
|
|
577
|
+
* // Select all cars with "Turbo" anywhere in their name.
|
|
578
|
+
* db.select().from(cars)
|
|
579
|
+
* .where({ name: { contains: 'Turbo' } })
|
|
580
|
+
* // Same as: .where(ilike(cars.name, '%Turbo%'))
|
|
581
|
+
* ```
|
|
582
|
+
*
|
|
583
|
+
* @see ilike for manual pattern matching
|
|
584
|
+
* @see startsWith for prefix matching
|
|
585
|
+
* @see endsWith for suffix matching
|
|
586
|
+
*/
|
|
587
587
|
contains?: string;
|
|
588
588
|
/**
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
589
|
+
* Syntactic sugar for case-insensitive prefix matching.
|
|
590
|
+
* Automatically appends a `%` wildcard to the end of the value.
|
|
591
|
+
*
|
|
592
|
+
* Equivalent to: `ilike: 'value%'`
|
|
593
|
+
*
|
|
594
|
+
* ## Examples
|
|
595
|
+
*
|
|
596
|
+
* ```ts
|
|
597
|
+
* // Select all cars whose names start with "Ford".
|
|
598
|
+
* db.select().from(cars)
|
|
599
|
+
* .where({ name: { startsWith: 'Ford' } })
|
|
600
|
+
* // Same as: .where(ilike(cars.name, 'Ford%'))
|
|
601
|
+
* ```
|
|
602
|
+
*
|
|
603
|
+
* @see ilike for manual pattern matching
|
|
604
|
+
* @see contains for substring matching
|
|
605
|
+
* @see endsWith for suffix matching
|
|
606
|
+
*/
|
|
607
607
|
startsWith?: string;
|
|
608
608
|
/**
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
609
|
+
* Syntactic sugar for case-insensitive suffix matching.
|
|
610
|
+
* Automatically prepends a `%` wildcard to the beginning of the value.
|
|
611
|
+
*
|
|
612
|
+
* Equivalent to: `ilike: '%value'`
|
|
613
|
+
*
|
|
614
|
+
* ## Examples
|
|
615
|
+
*
|
|
616
|
+
* ```ts
|
|
617
|
+
* // Select all cars whose names end with "Turbo".
|
|
618
|
+
* db.select().from(cars)
|
|
619
|
+
* .where({ name: { endsWith: 'Turbo' } })
|
|
620
|
+
* // Same as: .where(ilike(cars.name, '%Turbo'))
|
|
621
|
+
* ```
|
|
622
|
+
*
|
|
623
|
+
* @see ilike for manual pattern matching
|
|
624
|
+
* @see contains for substring matching
|
|
625
|
+
* @see startsWith for prefix matching
|
|
626
|
+
*/
|
|
627
627
|
endsWith?: string;
|
|
628
628
|
/**
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
629
|
+
* Test that a column or expression contains all elements of
|
|
630
|
+
* the list passed as the second argument.
|
|
631
|
+
*
|
|
632
|
+
* ## Throws
|
|
633
|
+
*
|
|
634
|
+
* The argument passed in the second array can't be empty:
|
|
635
|
+
* if an empty is provided, this method will throw.
|
|
636
|
+
*
|
|
637
|
+
* ## Examples
|
|
638
|
+
*
|
|
639
|
+
* ```ts
|
|
640
|
+
* // Select posts where its tags contain "Typescript" and "ORM".
|
|
641
|
+
* db.select().from(posts)
|
|
642
|
+
* .where(arrayContains(posts.tags, ['Typescript', 'ORM']))
|
|
643
|
+
* ```
|
|
644
|
+
*
|
|
645
|
+
* @see arrayContained to find if an array contains all elements of a column or expression
|
|
646
|
+
* @see arrayOverlaps to find if a column or expression contains any elements of an array
|
|
647
|
+
*/
|
|
648
648
|
arrayContains?: TValue;
|
|
649
649
|
/**
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
650
|
+
* Test that the list passed as the second argument contains
|
|
651
|
+
* all elements of a column or expression.
|
|
652
|
+
*
|
|
653
|
+
* ## Throws
|
|
654
|
+
*
|
|
655
|
+
* The argument passed in the second array can't be empty:
|
|
656
|
+
* if an empty is provided, this method will throw.
|
|
657
|
+
*
|
|
658
|
+
* ## Examples
|
|
659
|
+
*
|
|
660
|
+
* ```ts
|
|
661
|
+
* // Select posts where its tags contain "Typescript", "ORM" or both,
|
|
662
|
+
* // but filtering posts that have additional tags.
|
|
663
|
+
* db.select().from(posts)
|
|
664
|
+
* .where(arrayContained(posts.tags, ['Typescript', 'ORM']))
|
|
665
|
+
* ```
|
|
666
|
+
*
|
|
667
|
+
* @see arrayContains to find if a column or expression contains all elements of an array
|
|
668
|
+
* @see arrayOverlaps to find if a column or expression contains any elements of an array
|
|
669
|
+
*/
|
|
670
670
|
arrayContained?: TValue;
|
|
671
671
|
/**
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
672
|
+
* Test that a column or expression contains any elements of
|
|
673
|
+
* the list passed as the second argument.
|
|
674
|
+
*
|
|
675
|
+
* ## Throws
|
|
676
|
+
*
|
|
677
|
+
* The argument passed in the second array can't be empty:
|
|
678
|
+
* if an empty is provided, this method will throw.
|
|
679
|
+
*
|
|
680
|
+
* ## Examples
|
|
681
|
+
*
|
|
682
|
+
* ```ts
|
|
683
|
+
* // Select posts where its tags contain "Typescript", "ORM" or both.
|
|
684
|
+
* db.select().from(posts)
|
|
685
|
+
* .where(arrayOverlaps(posts.tags, ['Typescript', 'ORM']))
|
|
686
|
+
* ```
|
|
687
|
+
*
|
|
688
|
+
* @see arrayContains to find if a column or expression contains all elements of an array
|
|
689
|
+
* @see arrayContained to find if an array contains all elements of a column or expression
|
|
690
|
+
*/
|
|
691
691
|
arrayOverlaps?: TValue;
|
|
692
692
|
}
|
|
693
693
|
//#endregion
|
|
@@ -746,71 +746,71 @@ type PgQueryWhereOrSQL<T extends TObject, Relations extends PgRelationMap<TObjec
|
|
|
746
746
|
type PgQueryWhereOperators<T extends TObject> = { [Key in keyof Static<T>]?: FilterOperators<Static<T>[Key]> | Static<T>[Key] };
|
|
747
747
|
type PgQueryWhereConditions<T extends TObject, Relations extends PgRelationMap<TObject> | undefined = undefined> = {
|
|
748
748
|
/**
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
749
|
+
* Combine a list of conditions with the `and` operator. Conditions
|
|
750
|
+
* that are equal `undefined` are automatically ignored.
|
|
751
|
+
*
|
|
752
|
+
* ## Examples
|
|
753
|
+
*
|
|
754
|
+
* ```ts
|
|
755
|
+
* db.select().from(cars)
|
|
756
|
+
* .where(
|
|
757
|
+
* and(
|
|
758
|
+
* eq(cars.make, 'Volvo'),
|
|
759
|
+
* eq(cars.year, 1950),
|
|
760
|
+
* )
|
|
761
|
+
* )
|
|
762
|
+
* ```
|
|
763
|
+
*/
|
|
764
764
|
and?: Array<PgQueryWhereOrSQL<T, Relations>>;
|
|
765
765
|
/**
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
766
|
+
* Combine a list of conditions with the `or` operator. Conditions
|
|
767
|
+
* that are equal `undefined` are automatically ignored.
|
|
768
|
+
*
|
|
769
|
+
* ## Examples
|
|
770
|
+
*
|
|
771
|
+
* ```ts
|
|
772
|
+
* db.select().from(cars)
|
|
773
|
+
* .where(
|
|
774
|
+
* or(
|
|
775
|
+
* eq(cars.make, 'GM'),
|
|
776
|
+
* eq(cars.make, 'Ford'),
|
|
777
|
+
* )
|
|
778
|
+
* )
|
|
779
|
+
* ```
|
|
780
|
+
*/
|
|
781
781
|
or?: Array<PgQueryWhereOrSQL<T, Relations>>;
|
|
782
782
|
/**
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
783
|
+
* Negate the meaning of an expression using the `not` keyword.
|
|
784
|
+
*
|
|
785
|
+
* ## Examples
|
|
786
|
+
*
|
|
787
|
+
* ```ts
|
|
788
|
+
* // Select cars _not_ made by GM or Ford.
|
|
789
|
+
* db.select().from(cars)
|
|
790
|
+
* .where(not(inArray(cars.make, ['GM', 'Ford'])))
|
|
791
|
+
* ```
|
|
792
|
+
*/
|
|
793
793
|
not?: PgQueryWhereOrSQL<T, Relations>;
|
|
794
794
|
/**
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
795
|
+
* Test whether a subquery evaluates to have any rows.
|
|
796
|
+
*
|
|
797
|
+
* ## Examples
|
|
798
|
+
*
|
|
799
|
+
* ```ts
|
|
800
|
+
* // Users whose `homeCity` column has a match in a cities
|
|
801
|
+
* // table.
|
|
802
|
+
* db
|
|
803
|
+
* .select()
|
|
804
|
+
* .from(users)
|
|
805
|
+
* .where(
|
|
806
|
+
* exists(db.select()
|
|
807
|
+
* .from(cities)
|
|
808
|
+
* .where(eq(users.homeCity, cities.id))),
|
|
809
|
+
* );
|
|
810
|
+
* ```
|
|
811
|
+
*
|
|
812
|
+
* @see notExists for the inverse of this test
|
|
813
|
+
*/
|
|
814
814
|
exists?: SQLWrapper;
|
|
815
815
|
};
|
|
816
816
|
type PgQueryWhereRelations<Relations extends PgRelationMap<TObject> | undefined = undefined> = Relations extends PgRelationMap<TObject> ? { [K in keyof Relations]?: PgQueryWhere<Relations[K]["join"]["schema"], Relations[K]["with"]> } : {};
|
|
@@ -831,8 +831,8 @@ interface PgAttrField {
|
|
|
831
831
|
//#region ../../src/orm/primitives/$sequence.d.ts
|
|
832
832
|
interface SequencePrimitiveOptions extends PgSequenceOptions {
|
|
833
833
|
/**
|
|
834
|
-
|
|
835
|
-
|
|
834
|
+
* The name of the sequence. If not provided, the property key will be used.
|
|
835
|
+
*/
|
|
836
836
|
name?: string;
|
|
837
837
|
provider?: DatabaseProvider;
|
|
838
838
|
}
|
|
@@ -872,72 +872,72 @@ interface TableConfigBuilders<TConfig> {
|
|
|
872
872
|
*/
|
|
873
873
|
declare abstract class ModelBuilder {
|
|
874
874
|
/**
|
|
875
|
-
|
|
876
|
-
|
|
875
|
+
* Build a table from an entity primitive.
|
|
876
|
+
*/
|
|
877
877
|
abstract buildTable(entity: EntityPrimitive, options: {
|
|
878
878
|
tables: Map<string, unknown>;
|
|
879
879
|
enums: Map<string, unknown>;
|
|
880
880
|
schema: string;
|
|
881
881
|
}): void;
|
|
882
882
|
/**
|
|
883
|
-
|
|
884
|
-
|
|
883
|
+
* Build a sequence from a sequence primitive.
|
|
884
|
+
*/
|
|
885
885
|
abstract buildSequence(sequence: SequencePrimitive, options: {
|
|
886
886
|
sequences: Map<string, unknown>;
|
|
887
887
|
schema: string;
|
|
888
888
|
}): void;
|
|
889
889
|
/**
|
|
890
|
-
|
|
891
|
-
|
|
890
|
+
* Convert camelCase to snake_case for column names.
|
|
891
|
+
*/
|
|
892
892
|
protected toColumnName(str: string): string;
|
|
893
893
|
/**
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
894
|
+
* Build the table configuration function for any database.
|
|
895
|
+
* This includes indexes, foreign keys, constraints, and custom config.
|
|
896
|
+
*
|
|
897
|
+
* @param entity - The entity primitive
|
|
898
|
+
* @param builders - Database-specific builder functions
|
|
899
|
+
* @param tableResolver - Function to resolve entity references to table columns
|
|
900
|
+
* @param customConfigHandler - Optional handler for custom config
|
|
901
|
+
*/
|
|
902
902
|
protected buildTableConfig<TConfig, TSelf>(entity: EntityPrimitive, builders: TableConfigBuilders<TConfig>, tableResolver?: (entityName: string) => any, customConfigHandler?: (config: any, self: TSelf) => TConfig[]): ((self: TSelf) => TConfig[]) | undefined;
|
|
903
903
|
}
|
|
904
904
|
//#endregion
|
|
905
905
|
//#region ../../src/orm/providers/DrizzleKitProvider.d.ts
|
|
906
906
|
declare class DrizzleKitProvider {
|
|
907
|
-
protected readonly log:
|
|
907
|
+
protected readonly log: alepha_logger6.Logger;
|
|
908
908
|
protected readonly alepha: Alepha;
|
|
909
909
|
/**
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
910
|
+
* Synchronize database with current schema definitions.
|
|
911
|
+
*
|
|
912
|
+
* In development mode, it will generate and execute migrations based on the current state.
|
|
913
|
+
* In testing mode, it will generate migrations from scratch without applying them.
|
|
914
|
+
*
|
|
915
|
+
* Does nothing in production mode, you must handle migrations manually.
|
|
916
|
+
*/
|
|
917
917
|
synchronize(provider: DatabaseProvider): Promise<void>;
|
|
918
918
|
/**
|
|
919
|
-
|
|
920
|
-
|
|
919
|
+
* Mostly used for testing purposes. You can generate SQL migration statements without executing them.
|
|
920
|
+
*/
|
|
921
921
|
generateMigration(provider: DatabaseProvider, prevSnapshot?: any): Promise<{
|
|
922
922
|
statements: string[];
|
|
923
923
|
models: Record<string, unknown>;
|
|
924
924
|
snapshot?: any;
|
|
925
925
|
}>;
|
|
926
926
|
/**
|
|
927
|
-
|
|
928
|
-
|
|
927
|
+
* Load all tables, enums, sequences, etc. from the provider's repositories.
|
|
928
|
+
*/
|
|
929
929
|
getModels(provider: DatabaseProvider): Record<string, unknown>;
|
|
930
930
|
/**
|
|
931
|
-
|
|
932
|
-
|
|
931
|
+
* Load the migration snapshot from the database.
|
|
932
|
+
*/
|
|
933
933
|
protected loadDevMigrations(provider: DatabaseProvider): Promise<DevMigrations | undefined>;
|
|
934
934
|
protected saveDevMigrations(provider: DatabaseProvider, curr: Record<string, any>, devMigrations?: DevMigrations): Promise<void>;
|
|
935
935
|
protected executeStatements(statements: string[], provider: DatabaseProvider, catchErrors?: boolean): Promise<void>;
|
|
936
936
|
protected createSchemaIfNotExists(provider: DatabaseProvider, schemaName: string): Promise<void>;
|
|
937
937
|
/**
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
938
|
+
* Try to load the official Drizzle Kit API.
|
|
939
|
+
* If not available, fallback to the local kit import.
|
|
940
|
+
*/
|
|
941
941
|
importDrizzleKit(): typeof DrizzleKit;
|
|
942
942
|
}
|
|
943
943
|
declare const devMigrationsSchema: alepha23.TObject<{
|
|
@@ -952,7 +952,7 @@ type DevMigrations = Static<typeof devMigrationsSchema>;
|
|
|
952
952
|
type SQLLike = SQLWrapper | string;
|
|
953
953
|
declare abstract class DatabaseProvider {
|
|
954
954
|
protected readonly alepha: Alepha;
|
|
955
|
-
protected readonly log:
|
|
955
|
+
protected readonly log: alepha_logger6.Logger;
|
|
956
956
|
protected abstract readonly builder: ModelBuilder;
|
|
957
957
|
protected abstract readonly kit: DrizzleKitProvider;
|
|
958
958
|
abstract readonly db: PgDatabase<any>;
|
|
@@ -970,39 +970,39 @@ declare abstract class DatabaseProvider {
|
|
|
970
970
|
abstract execute(statement: SQLLike): Promise<Record<string, unknown>[]>;
|
|
971
971
|
run<T extends TObject>(statement: SQLLike, schema: T): Promise<Array<Static<T>>>;
|
|
972
972
|
/**
|
|
973
|
-
|
|
974
|
-
|
|
973
|
+
* Get migrations folder path - can be overridden
|
|
974
|
+
*/
|
|
975
975
|
protected getMigrationsFolder(): string;
|
|
976
976
|
/**
|
|
977
|
-
|
|
978
|
-
|
|
977
|
+
* Base migration orchestration - handles environment logic
|
|
978
|
+
*/
|
|
979
979
|
migrate(): Promise<void>;
|
|
980
980
|
/**
|
|
981
|
-
|
|
982
|
-
|
|
981
|
+
* Production: run migrations from folder
|
|
982
|
+
*/
|
|
983
983
|
protected runProductionMigration(migrationsFolder: string): Promise<void>;
|
|
984
984
|
/**
|
|
985
|
-
|
|
986
|
-
|
|
985
|
+
* Test: always synchronize
|
|
986
|
+
*/
|
|
987
987
|
protected runTestMigration(): Promise<void>;
|
|
988
988
|
/**
|
|
989
|
-
|
|
990
|
-
|
|
989
|
+
* Development: default to synchronize (can be overridden)
|
|
990
|
+
*/
|
|
991
991
|
protected runDevelopmentMigration(migrationsFolder: string): Promise<void>;
|
|
992
992
|
/**
|
|
993
|
-
|
|
994
|
-
|
|
993
|
+
* Common synchronization with error handling
|
|
994
|
+
*/
|
|
995
995
|
protected synchronizeSchema(): Promise<void>;
|
|
996
996
|
/**
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
997
|
+
* Provider-specific migration execution
|
|
998
|
+
* MUST be implemented by each provider
|
|
999
|
+
*/
|
|
1000
1000
|
protected abstract executeMigrations(migrationsFolder: string): Promise<void>;
|
|
1001
1001
|
/**
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1002
|
+
* For testing purposes, generate a unique schema name.
|
|
1003
|
+
* The schema name will be generated based on the current date and time.
|
|
1004
|
+
* It will be in the format of `test_YYYYMMDD_HHMMSS_randomSuffix`.
|
|
1005
|
+
*/
|
|
1006
1006
|
protected generateTestSchemaName(): string;
|
|
1007
1007
|
}
|
|
1008
1008
|
//#endregion
|
|
@@ -1010,8 +1010,8 @@ declare abstract class DatabaseProvider {
|
|
|
1010
1010
|
declare class QueryManager {
|
|
1011
1011
|
protected readonly alepha: Alepha;
|
|
1012
1012
|
/**
|
|
1013
|
-
|
|
1014
|
-
|
|
1013
|
+
* Convert a query object to a SQL query.
|
|
1014
|
+
*/
|
|
1015
1015
|
toSQL(query: PgQueryWhereOrSQL<TObject>, options: {
|
|
1016
1016
|
schema: TObject;
|
|
1017
1017
|
col: (key: string) => PgColumn;
|
|
@@ -1019,22 +1019,22 @@ declare class QueryManager {
|
|
|
1019
1019
|
dialect: "postgresql" | "sqlite";
|
|
1020
1020
|
}): SQL | undefined;
|
|
1021
1021
|
/**
|
|
1022
|
-
|
|
1023
|
-
|
|
1022
|
+
* Check if an object has any filter operator properties.
|
|
1023
|
+
*/
|
|
1024
1024
|
protected hasFilterOperatorProperties(obj: any): boolean;
|
|
1025
1025
|
/**
|
|
1026
|
-
|
|
1027
|
-
|
|
1026
|
+
* Map a filter operator to a SQL query.
|
|
1027
|
+
*/
|
|
1028
1028
|
mapOperatorToSql(operator: FilterOperators<any> | any, column: PgColumn, columnSchema?: TObject, columnName?: string, dialect?: "postgresql" | "sqlite"): SQL | undefined;
|
|
1029
1029
|
/**
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1030
|
+
* Parse pagination sort string to orderBy format.
|
|
1031
|
+
* Format: "firstName,-lastName" -> [{ column: "firstName", direction: "asc" }, { column: "lastName", direction: "desc" }]
|
|
1032
|
+
* - Columns separated by comma
|
|
1033
|
+
* - Prefix with '-' for DESC direction
|
|
1034
|
+
*
|
|
1035
|
+
* @param sort Pagination sort string
|
|
1036
|
+
* @returns OrderBy array or single object
|
|
1037
|
+
*/
|
|
1038
1038
|
parsePaginationSort(sort: string): Array<{
|
|
1039
1039
|
column: string;
|
|
1040
1040
|
direction: "asc" | "desc";
|
|
@@ -1043,30 +1043,30 @@ declare class QueryManager {
|
|
|
1043
1043
|
direction: "asc" | "desc";
|
|
1044
1044
|
};
|
|
1045
1045
|
/**
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1046
|
+
* Normalize orderBy parameter to array format.
|
|
1047
|
+
* Supports 3 modes:
|
|
1048
|
+
* 1. String: "name" -> [{ column: "name", direction: "asc" }]
|
|
1049
|
+
* 2. Object: { column: "name", direction: "desc" } -> [{ column: "name", direction: "desc" }]
|
|
1050
|
+
* 3. Array: [{ column: "name" }, { column: "age", direction: "desc" }] -> normalized array
|
|
1051
|
+
*
|
|
1052
|
+
* @param orderBy The orderBy parameter
|
|
1053
|
+
* @returns Normalized array of order by clauses
|
|
1054
|
+
*/
|
|
1055
1055
|
normalizeOrderBy(orderBy: any): Array<{
|
|
1056
1056
|
column: string;
|
|
1057
1057
|
direction: "asc" | "desc";
|
|
1058
1058
|
}>;
|
|
1059
1059
|
/**
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1060
|
+
* Create a pagination object.
|
|
1061
|
+
*
|
|
1062
|
+
* @deprecated Use `createPagination` from alepha instead.
|
|
1063
|
+
* This method now delegates to the framework-level helper.
|
|
1064
|
+
*
|
|
1065
|
+
* @param entities The entities to paginate.
|
|
1066
|
+
* @param limit The limit of the pagination.
|
|
1067
|
+
* @param offset The offset of the pagination.
|
|
1068
|
+
* @param sort Optional sort metadata to include in response.
|
|
1069
|
+
*/
|
|
1070
1070
|
createPagination<T>(entities: T[], limit?: number, offset?: number, sort?: Array<{
|
|
1071
1071
|
column: string;
|
|
1072
1072
|
direction: "asc" | "desc";
|
|
@@ -1083,20 +1083,20 @@ interface PgJoin {
|
|
|
1083
1083
|
//#region ../../src/orm/services/PgRelationManager.d.ts
|
|
1084
1084
|
declare class PgRelationManager {
|
|
1085
1085
|
/**
|
|
1086
|
-
|
|
1087
|
-
|
|
1086
|
+
* Recursively build joins for the query builder based on the relations map
|
|
1087
|
+
*/
|
|
1088
1088
|
buildJoins(provider: DatabaseProvider, builder: PgSelectBase<any, any, any>, joins: Array<PgJoin>, withRelations: PgRelationMap<TObject>, table: PgTableWithColumns<any>, parentKey?: string): void;
|
|
1089
1089
|
/**
|
|
1090
|
-
|
|
1091
|
-
|
|
1090
|
+
* Map a row with its joined relations based on the joins definition
|
|
1091
|
+
*/
|
|
1092
1092
|
mapRowWithJoins(record: Record<string, unknown>, row: Record<string, unknown>, schema: TObject, joins: PgJoin[], parentKey?: string): Record<string, unknown>;
|
|
1093
1093
|
/**
|
|
1094
|
-
|
|
1095
|
-
|
|
1094
|
+
* Check if all values in an object are null (indicates a left join with no match)
|
|
1095
|
+
*/
|
|
1096
1096
|
private isAllNull;
|
|
1097
1097
|
/**
|
|
1098
|
-
|
|
1099
|
-
|
|
1098
|
+
* Build a schema that includes all join properties recursively
|
|
1099
|
+
*/
|
|
1100
1100
|
buildSchemaWithJoins(baseSchema: TObject, joins: PgJoin[], parentPath?: string): TObject;
|
|
1101
1101
|
}
|
|
1102
1102
|
//#endregion
|
|
@@ -1104,217 +1104,218 @@ declare class PgRelationManager {
|
|
|
1104
1104
|
declare abstract class Repository$1<T extends TObject> {
|
|
1105
1105
|
readonly entity: EntityPrimitive<T>;
|
|
1106
1106
|
readonly provider: DatabaseProvider;
|
|
1107
|
-
protected readonly log:
|
|
1107
|
+
protected readonly log: alepha_logger6.Logger;
|
|
1108
1108
|
protected readonly relationManager: PgRelationManager;
|
|
1109
1109
|
protected readonly queryManager: QueryManager;
|
|
1110
1110
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
1111
1111
|
protected readonly alepha: Alepha;
|
|
1112
|
+
static of<T extends TObject>(entity: EntityPrimitive<T>, provider?: typeof DatabaseProvider): new () => Repository$1<T>;
|
|
1112
1113
|
constructor(entity: EntityPrimitive<T>, provider?: typeof DatabaseProvider);
|
|
1113
1114
|
/**
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1115
|
+
* Represents the primary key of the table.
|
|
1116
|
+
* - Key is the name of the primary key column.
|
|
1117
|
+
* - Type is the type (TypeBox) of the primary key column.
|
|
1118
|
+
*
|
|
1119
|
+
* ID is mandatory. If the table does not have a primary key, it will throw an error.
|
|
1120
|
+
*/
|
|
1120
1121
|
get id(): {
|
|
1121
1122
|
type: TSchema;
|
|
1122
1123
|
key: keyof T["properties"];
|
|
1123
1124
|
col: PgColumn;
|
|
1124
1125
|
};
|
|
1125
1126
|
/**
|
|
1126
|
-
|
|
1127
|
-
|
|
1127
|
+
* Get Drizzle table object.
|
|
1128
|
+
*/
|
|
1128
1129
|
get table(): PgTableWithColumns<SchemaToTableConfig<T>>;
|
|
1129
1130
|
/**
|
|
1130
|
-
|
|
1131
|
-
|
|
1131
|
+
* Get SQL table name. (from Drizzle table object)
|
|
1132
|
+
*/
|
|
1132
1133
|
get tableName(): string;
|
|
1133
1134
|
/**
|
|
1134
|
-
|
|
1135
|
-
|
|
1135
|
+
* Getter for the database connection from the database provider.
|
|
1136
|
+
*/
|
|
1136
1137
|
protected get db(): PgDatabase<any>;
|
|
1137
1138
|
/**
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1139
|
+
* Execute a SQL query.
|
|
1140
|
+
*
|
|
1141
|
+
* This method allows executing raw SQL queries against the database.
|
|
1142
|
+
* This is by far the easiest way to run custom queries that are not covered by the repository's built-in methods!
|
|
1143
|
+
*
|
|
1144
|
+
* You must use the `sql` tagged template function from Drizzle ORM to create the query. https://orm.drizzle.team/docs/sql
|
|
1145
|
+
*
|
|
1146
|
+
* @example
|
|
1147
|
+
* ```ts
|
|
1148
|
+
* class App {
|
|
1149
|
+
* repository = $repository({ ... });
|
|
1150
|
+
* async getAdults() {
|
|
1151
|
+
* const users = repository.table; // Drizzle table object
|
|
1152
|
+
* await repository.query(sql`SELECT * FROM ${users} WHERE ${users.age} > ${18}`);
|
|
1153
|
+
* // or better
|
|
1154
|
+
* await repository.query((users) => sql`SELECT * FROM ${users} WHERE ${users.age} > ${18}`);
|
|
1155
|
+
* }
|
|
1156
|
+
* }
|
|
1157
|
+
* ```
|
|
1158
|
+
*/
|
|
1158
1159
|
query<R extends TObject = T>(query: SQLLike | ((table: PgTableWithColumns<SchemaToTableConfig<T>>, db: PgDatabase<any>) => SQLLike), schema?: R): Promise<Static<R>[]>;
|
|
1159
1160
|
/**
|
|
1160
|
-
|
|
1161
|
-
|
|
1161
|
+
* Map raw database fields to entity fields. (handles column name differences)
|
|
1162
|
+
*/
|
|
1162
1163
|
protected mapRawFieldsToEntity(row: Record<string, unknown>): any;
|
|
1163
1164
|
/**
|
|
1164
|
-
|
|
1165
|
-
|
|
1165
|
+
* Get a Drizzle column from the table by his name.
|
|
1166
|
+
*/
|
|
1166
1167
|
protected col(name: keyof StaticEncode<T>): PgColumn;
|
|
1167
1168
|
/**
|
|
1168
|
-
|
|
1169
|
-
|
|
1169
|
+
* Run a transaction.
|
|
1170
|
+
*/
|
|
1170
1171
|
transaction<T>(transaction: (tx: PgTransaction<any, Record<string, any>, any>) => Promise<T>, config?: PgTransactionConfig): Promise<T>;
|
|
1171
1172
|
/**
|
|
1172
|
-
|
|
1173
|
-
|
|
1173
|
+
* Start a SELECT query on the table.
|
|
1174
|
+
*/
|
|
1174
1175
|
protected rawSelect(opts?: StatementOptions): drizzle_orm_pg_core0.PgSelectBase<string, Record<string, PgColumn<drizzle_orm0.ColumnBaseConfig<drizzle_orm0.ColumnDataType, string>, {}, {}>>, "single", Record<string, "not-null">, false, never, {
|
|
1175
1176
|
[x: string]: unknown;
|
|
1176
1177
|
}[], {
|
|
1177
1178
|
[x: string]: PgColumn<drizzle_orm0.ColumnBaseConfig<drizzle_orm0.ColumnDataType, string>, {}, {}>;
|
|
1178
1179
|
}>;
|
|
1179
1180
|
/**
|
|
1180
|
-
|
|
1181
|
-
|
|
1181
|
+
* Start a SELECT DISTINCT query on the table.
|
|
1182
|
+
*/
|
|
1182
1183
|
protected rawSelectDistinct(opts?: StatementOptions, columns?: (keyof Static<T>)[]): drizzle_orm_pg_core0.PgSelectBase<string, Record<string, any>, "partial", Record<string, "not-null">, false, never, {
|
|
1183
1184
|
[x: string]: any;
|
|
1184
1185
|
}[], {
|
|
1185
1186
|
[x: string]: any;
|
|
1186
1187
|
}>;
|
|
1187
1188
|
/**
|
|
1188
|
-
|
|
1189
|
-
|
|
1189
|
+
* Start an INSERT query on the table.
|
|
1190
|
+
*/
|
|
1190
1191
|
protected rawInsert(opts?: StatementOptions): drizzle_orm_pg_core0.PgInsertBuilder<PgTableWithColumns<SchemaToTableConfig<T>>, any, false>;
|
|
1191
1192
|
/**
|
|
1192
|
-
|
|
1193
|
-
|
|
1193
|
+
* Start an UPDATE query on the table.
|
|
1194
|
+
*/
|
|
1194
1195
|
protected rawUpdate(opts?: StatementOptions): drizzle_orm_pg_core0.PgUpdateBuilder<PgTableWithColumns<SchemaToTableConfig<T>>, any>;
|
|
1195
1196
|
/**
|
|
1196
|
-
|
|
1197
|
-
|
|
1197
|
+
* Start a DELETE query on the table.
|
|
1198
|
+
*/
|
|
1198
1199
|
protected rawDelete(opts?: StatementOptions): drizzle_orm_pg_core0.PgDeleteBase<PgTableWithColumns<SchemaToTableConfig<T>>, any, undefined, undefined, false, never>;
|
|
1199
1200
|
/**
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1201
|
+
* Create a Drizzle `select` query based on a JSON query object.
|
|
1202
|
+
*
|
|
1203
|
+
* > This method is the base for `find`, `findOne`, `findById`, and `paginate`.
|
|
1204
|
+
*/
|
|
1204
1205
|
findMany<R extends PgRelationMap<T>>(query?: PgQueryRelations<T, R>, opts?: StatementOptions): Promise<PgStatic<T, R>[]>;
|
|
1205
1206
|
/**
|
|
1206
|
-
|
|
1207
|
-
|
|
1207
|
+
* Find a single entity.
|
|
1208
|
+
*/
|
|
1208
1209
|
findOne<R extends PgRelationMap<T>>(query: Pick<PgQueryRelations<T, R>, "with" | "where">, opts?: StatementOptions): Promise<PgStatic<T, R>>;
|
|
1209
1210
|
/**
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1211
|
+
* Find entities with pagination.
|
|
1212
|
+
*
|
|
1213
|
+
* It uses the same parameters as `find()`, but adds pagination metadata to the response.
|
|
1214
|
+
*
|
|
1215
|
+
* > Pagination CAN also do a count query to get the total number of elements.
|
|
1216
|
+
*/
|
|
1216
1217
|
paginate<R extends PgRelationMap<T>>(pagination?: PageQuery, query?: PgQueryRelations<T, R>, opts?: StatementOptions & {
|
|
1217
1218
|
count?: boolean;
|
|
1218
1219
|
}): Promise<Page<PgStatic<T, R>>>;
|
|
1219
1220
|
/**
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1221
|
+
* Find an entity by ID.
|
|
1222
|
+
*
|
|
1223
|
+
* This is a convenience method for `findOne` with a where clause on the primary key.
|
|
1224
|
+
* If you need more complex queries, use `findOne` instead.
|
|
1225
|
+
*/
|
|
1225
1226
|
findById(id: string | number, opts?: StatementOptions): Promise<Static<T>>;
|
|
1226
1227
|
/**
|
|
1227
|
-
|
|
1228
|
-
|
|
1228
|
+
* Helper to create a type-safe query object.
|
|
1229
|
+
*/
|
|
1229
1230
|
createQuery(): PgQuery<T>;
|
|
1230
1231
|
/**
|
|
1231
|
-
|
|
1232
|
-
|
|
1232
|
+
* Helper to create a type-safe where clause.
|
|
1233
|
+
*/
|
|
1233
1234
|
createQueryWhere(): PgQueryWhere<T>;
|
|
1234
1235
|
/**
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1236
|
+
* Create an entity.
|
|
1237
|
+
*
|
|
1238
|
+
* @param data The entity to create.
|
|
1239
|
+
* @param opts The options for creating the entity.
|
|
1240
|
+
* @returns The ID of the created entity.
|
|
1241
|
+
*/
|
|
1241
1242
|
create(data: Static<TObjectInsert<T>>, opts?: StatementOptions): Promise<Static<T>>;
|
|
1242
1243
|
/**
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1244
|
+
* Create many entities.
|
|
1245
|
+
*
|
|
1246
|
+
* Inserts are batched in chunks of 1000 to avoid hitting database limits.
|
|
1247
|
+
*
|
|
1248
|
+
* @param values The entities to create.
|
|
1249
|
+
* @param opts The statement options.
|
|
1250
|
+
* @returns The created entities.
|
|
1251
|
+
*/
|
|
1251
1252
|
createMany(values: Array<Static<TObjectInsert<T>>>, opts?: StatementOptions & {
|
|
1252
1253
|
batchSize?: number;
|
|
1253
1254
|
}): Promise<Static<T>[]>;
|
|
1254
1255
|
/**
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
updateOne(where: PgQueryWhereOrSQL<T>, data:
|
|
1258
|
-
/**
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1256
|
+
* Find an entity and update it.
|
|
1257
|
+
*/
|
|
1258
|
+
updateOne(where: PgQueryWhereOrSQL<T>, data: WithSQL<Static<TObjectUpdate<T>>>, opts?: StatementOptions): Promise<Static<T>>;
|
|
1259
|
+
/**
|
|
1260
|
+
* Save a given entity.
|
|
1261
|
+
*
|
|
1262
|
+
* @example
|
|
1263
|
+
* ```ts
|
|
1264
|
+
* const entity = await repository.findById(1);
|
|
1265
|
+
* entity.name = "New Name"; // update a field
|
|
1266
|
+
* delete entity.description; // delete a field
|
|
1267
|
+
* await repository.save(entity);
|
|
1268
|
+
* ```
|
|
1269
|
+
*
|
|
1270
|
+
* Difference with `updateById/updateOne`:
|
|
1271
|
+
*
|
|
1272
|
+
* - requires the entity to be fetched first (whole object is expected)
|
|
1273
|
+
* - check pg.version() if present -> optimistic locking
|
|
1274
|
+
* - validate entity against schema
|
|
1275
|
+
* - undefined values will be set to null, not ignored!
|
|
1276
|
+
*
|
|
1277
|
+
* @see {@link DbVersionMismatchError}
|
|
1278
|
+
*/
|
|
1278
1279
|
save(entity: Static<T>, opts?: StatementOptions): Promise<void>;
|
|
1279
1280
|
/**
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
updateById(id: string | number, data:
|
|
1281
|
+
* Find an entity by ID and update it.
|
|
1282
|
+
*/
|
|
1283
|
+
updateById(id: string | number, data: WithSQL<Static<TObjectUpdate<T>>>, opts?: StatementOptions): Promise<Static<T>>;
|
|
1283
1284
|
/**
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
updateMany(where: PgQueryWhereOrSQL<T>, data:
|
|
1285
|
+
* Find many entities and update all of them.
|
|
1286
|
+
*/
|
|
1287
|
+
updateMany(where: PgQueryWhereOrSQL<T>, data: WithSQL<Static<TObjectUpdate<T>>>, opts?: StatementOptions): Promise<Array<number | string>>;
|
|
1287
1288
|
/**
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1289
|
+
* Find many and delete all of them.
|
|
1290
|
+
* @returns Array of deleted entity IDs
|
|
1291
|
+
*/
|
|
1291
1292
|
deleteMany(where?: PgQueryWhereOrSQL<T>, opts?: StatementOptions): Promise<Array<number | string>>;
|
|
1292
1293
|
/**
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1294
|
+
* Delete all entities.
|
|
1295
|
+
* @returns Array of deleted entity IDs
|
|
1296
|
+
*/
|
|
1296
1297
|
clear(opts?: StatementOptions): Promise<Array<number | string>>;
|
|
1297
1298
|
/**
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1299
|
+
* Delete the given entity.
|
|
1300
|
+
*
|
|
1301
|
+
* You must fetch the entity first in order to delete it.
|
|
1302
|
+
* @returns Array containing the deleted entity ID
|
|
1303
|
+
*/
|
|
1303
1304
|
destroy(entity: Static<T>, opts?: StatementOptions): Promise<Array<number | string>>;
|
|
1304
1305
|
/**
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1306
|
+
* Find an entity and delete it.
|
|
1307
|
+
* @returns Array of deleted entity IDs (should contain at most one ID)
|
|
1308
|
+
*/
|
|
1308
1309
|
deleteOne(where?: PgQueryWhereOrSQL<T>, opts?: StatementOptions): Promise<Array<number | string>>;
|
|
1309
1310
|
/**
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1311
|
+
* Find an entity by ID and delete it.
|
|
1312
|
+
* @returns Array containing the deleted entity ID
|
|
1313
|
+
* @throws DbEntityNotFoundError if the entity is not found
|
|
1314
|
+
*/
|
|
1314
1315
|
deleteById(id: string | number, opts?: StatementOptions): Promise<Array<number | string>>;
|
|
1315
1316
|
/**
|
|
1316
|
-
|
|
1317
|
-
|
|
1317
|
+
* Count entities.
|
|
1318
|
+
*/
|
|
1318
1319
|
count(where?: PgQueryWhereOrSQL<T>, opts?: StatementOptions): Promise<number>;
|
|
1319
1320
|
protected conflictMessagePattern: string;
|
|
1320
1321
|
protected handleError(error: unknown, message: string): DbError;
|
|
@@ -1323,31 +1324,31 @@ declare abstract class Repository$1<T extends TObject> {
|
|
|
1323
1324
|
}): PgQueryWhereOrSQL<T>;
|
|
1324
1325
|
protected deletedAt(): PgAttrField | undefined;
|
|
1325
1326
|
/**
|
|
1326
|
-
|
|
1327
|
-
|
|
1327
|
+
* Convert something to valid Pg Insert Value.
|
|
1328
|
+
*/
|
|
1328
1329
|
protected cast(data: any, insert: boolean): PgInsertValue<PgTableWithColumns<SchemaToTableConfig<T>>>;
|
|
1329
1330
|
/**
|
|
1330
|
-
|
|
1331
|
-
|
|
1331
|
+
* Transform a row from the database into a clean entity.
|
|
1332
|
+
*/
|
|
1332
1333
|
protected clean<T extends TObject>(row: Record<string, unknown>, schema: T): Static<T>;
|
|
1333
1334
|
/**
|
|
1334
|
-
|
|
1335
|
-
|
|
1335
|
+
* Clean a row with joins recursively
|
|
1336
|
+
*/
|
|
1336
1337
|
protected cleanWithJoins<T extends TObject>(row: Record<string, unknown>, schema: T, joins: PgJoin[], parentPath?: string): Static<T>;
|
|
1337
1338
|
/**
|
|
1338
|
-
|
|
1339
|
-
|
|
1339
|
+
* Convert a where clause to SQL.
|
|
1340
|
+
*/
|
|
1340
1341
|
protected toSQL(where: PgQueryWhereOrSQL<T>, joins?: PgJoin[]): SQL | undefined;
|
|
1341
1342
|
/**
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1343
|
+
* Get the where clause for an ID.
|
|
1344
|
+
*
|
|
1345
|
+
* @param id The ID to get the where clause for.
|
|
1346
|
+
* @returns The where clause for the ID.
|
|
1347
|
+
*/
|
|
1347
1348
|
protected getWhereId(id: string | number): PgQueryWhere<T>;
|
|
1348
1349
|
/**
|
|
1349
|
-
|
|
1350
|
-
|
|
1350
|
+
* Find a primary key in the schema.
|
|
1351
|
+
*/
|
|
1351
1352
|
protected getPrimaryKey(schema: TObject): {
|
|
1352
1353
|
key: string;
|
|
1353
1354
|
col: PgColumn<drizzle_orm0.ColumnBaseConfig<drizzle_orm0.ColumnDataType, string>, {}, {}>;
|
|
@@ -1359,25 +1360,26 @@ declare abstract class Repository$1<T extends TObject> {
|
|
|
1359
1360
|
*/
|
|
1360
1361
|
interface StatementOptions {
|
|
1361
1362
|
/**
|
|
1362
|
-
|
|
1363
|
-
|
|
1363
|
+
* Transaction to use.
|
|
1364
|
+
*/
|
|
1364
1365
|
tx?: PgTransaction<any, Record<string, any>>;
|
|
1365
1366
|
/**
|
|
1366
|
-
|
|
1367
|
-
|
|
1367
|
+
* Lock strength.
|
|
1368
|
+
*/
|
|
1368
1369
|
for?: LockStrength | {
|
|
1369
1370
|
config: LockConfig;
|
|
1370
1371
|
strength: LockStrength;
|
|
1371
1372
|
};
|
|
1372
1373
|
/**
|
|
1373
|
-
|
|
1374
|
-
|
|
1374
|
+
* If true, ignore soft delete.
|
|
1375
|
+
*/
|
|
1375
1376
|
force?: boolean;
|
|
1376
1377
|
/**
|
|
1377
|
-
|
|
1378
|
-
|
|
1378
|
+
* Force the current time.
|
|
1379
|
+
*/
|
|
1379
1380
|
now?: DateTime | string;
|
|
1380
1381
|
}
|
|
1382
|
+
type WithSQL<T> = { [P in keyof T]?: T[P] | SQL };
|
|
1381
1383
|
//#endregion
|
|
1382
1384
|
//#region ../../src/api/users/entities/identities.d.ts
|
|
1383
1385
|
declare const identities: alepha_orm24.EntityPrimitive<alepha23.TObject<{
|
|
@@ -1449,20 +1451,20 @@ type RealmPrimitive = IssuerPrimitive & WithLinkFn & WithLoginFn;
|
|
|
1449
1451
|
declare const $realm: (options?: RealmOptions) => RealmPrimitive;
|
|
1450
1452
|
interface RealmOptions {
|
|
1451
1453
|
/**
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1454
|
+
* Secret key for signing tokens.
|
|
1455
|
+
*
|
|
1456
|
+
* If not provided, the secret from the SecurityProvider will be used (usually from the APP_SECRET environment variable).
|
|
1457
|
+
*/
|
|
1456
1458
|
secret?: string;
|
|
1457
1459
|
/**
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1460
|
+
* Issuer configuration options.
|
|
1461
|
+
*
|
|
1462
|
+
* It's already pre-configured for user management with admin and user roles.
|
|
1463
|
+
*/
|
|
1462
1464
|
issuer?: Partial<IssuerPrimitiveOptions>;
|
|
1463
1465
|
/**
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
+
* Override entities.
|
|
1467
|
+
*/
|
|
1466
1468
|
entities?: {
|
|
1467
1469
|
users?: Repository<typeof users.schema>;
|
|
1468
1470
|
identities?: Repository<typeof identities.schema>;
|
|
@@ -1474,11 +1476,20 @@ interface RealmOptions {
|
|
|
1474
1476
|
google?: true;
|
|
1475
1477
|
github?: true;
|
|
1476
1478
|
};
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1479
|
+
/**
|
|
1480
|
+
* Enable API key authentication.
|
|
1481
|
+
*
|
|
1482
|
+
* When enabled, users can create API keys to access protected endpoints
|
|
1483
|
+
* without using JWT tokens. API keys are useful for:
|
|
1484
|
+
* - Programmatic access (CLI tools, scripts)
|
|
1485
|
+
* - Long-lived authentication tokens
|
|
1486
|
+
* - Third-party integrations
|
|
1487
|
+
*
|
|
1488
|
+
* API keys can be passed via:
|
|
1489
|
+
* - Query parameter: `?api_key=ak_xxx`
|
|
1490
|
+
* - Bearer header: `Authorization: Bearer ak_xxx`
|
|
1491
|
+
*/
|
|
1492
|
+
apiKeys?: boolean;
|
|
1482
1493
|
}
|
|
1483
1494
|
//#endregion
|
|
1484
1495
|
//#region ../../src/api/users/providers/RealmProvider.d.ts
|
|
@@ -1538,11 +1549,10 @@ declare class RealmProvider {
|
|
|
1538
1549
|
}>>;
|
|
1539
1550
|
protected realms: Map<string, Realm>;
|
|
1540
1551
|
avatars: alepha_bucket0.BucketPrimitive;
|
|
1541
|
-
protected readonly onConfigure: alepha23.HookPrimitive<"configure">;
|
|
1542
1552
|
register(realmName: string, realmOptions?: RealmOptions): Realm;
|
|
1543
1553
|
/**
|
|
1544
|
-
|
|
1545
|
-
|
|
1554
|
+
* Gets a registered realm by name, auto-creating default if needed.
|
|
1555
|
+
*/
|
|
1546
1556
|
getRealm(realmName?: string): Realm;
|
|
1547
1557
|
identityRepository(realmName?: string): Repository<typeof identities.schema>;
|
|
1548
1558
|
sessionRepository(realmName?: string): Repository<typeof sessions.schema>;
|
|
@@ -1561,7 +1571,7 @@ type IdentityQuery = Static<typeof identityQuerySchema>;
|
|
|
1561
1571
|
//#endregion
|
|
1562
1572
|
//#region ../../src/api/users/services/IdentityService.d.ts
|
|
1563
1573
|
declare class IdentityService {
|
|
1564
|
-
protected readonly log:
|
|
1574
|
+
protected readonly log: alepha_logger6.Logger;
|
|
1565
1575
|
protected readonly realmProvider: RealmProvider;
|
|
1566
1576
|
protected readonly auditService: AuditService;
|
|
1567
1577
|
identities(userRealmName?: string): alepha_orm24.Repository<alepha23.TObject<{
|
|
@@ -1576,16 +1586,16 @@ declare class IdentityService {
|
|
|
1576
1586
|
providerData: alepha23.TOptional<alepha23.TRecord<string, alepha23.TAny>>;
|
|
1577
1587
|
}>>;
|
|
1578
1588
|
/**
|
|
1579
|
-
|
|
1580
|
-
|
|
1589
|
+
* Find identities with pagination and filtering.
|
|
1590
|
+
*/
|
|
1581
1591
|
findIdentities(q?: IdentityQuery, userRealmName?: string): Promise<Page$1<IdentityEntity>>;
|
|
1582
1592
|
/**
|
|
1583
|
-
|
|
1584
|
-
|
|
1593
|
+
* Get an identity by ID.
|
|
1594
|
+
*/
|
|
1585
1595
|
getIdentityById(id: string, userRealmName?: string): Promise<IdentityEntity>;
|
|
1586
1596
|
/**
|
|
1587
|
-
|
|
1588
|
-
|
|
1597
|
+
* Delete an identity by ID.
|
|
1598
|
+
*/
|
|
1589
1599
|
deleteIdentity(id: string, userRealmName?: string): Promise<void>;
|
|
1590
1600
|
}
|
|
1591
1601
|
//#endregion
|
|
@@ -1595,8 +1605,8 @@ declare class AdminIdentityController {
|
|
|
1595
1605
|
protected readonly group = "admin:identities";
|
|
1596
1606
|
protected readonly identityService: IdentityService;
|
|
1597
1607
|
/**
|
|
1598
|
-
|
|
1599
|
-
|
|
1608
|
+
* Find identities with pagination and filtering.
|
|
1609
|
+
*/
|
|
1600
1610
|
readonly findIdentities: alepha_server0.ActionPrimitiveFn<{
|
|
1601
1611
|
query: alepha23.TObject<{
|
|
1602
1612
|
page: alepha23.TOptional<alepha23.TInteger>;
|
|
@@ -1618,8 +1628,8 @@ declare class AdminIdentityController {
|
|
|
1618
1628
|
}>>;
|
|
1619
1629
|
}>;
|
|
1620
1630
|
/**
|
|
1621
|
-
|
|
1622
|
-
|
|
1631
|
+
* Get an identity by ID.
|
|
1632
|
+
*/
|
|
1623
1633
|
readonly getIdentity: alepha_server0.ActionPrimitiveFn<{
|
|
1624
1634
|
params: alepha23.TObject<{
|
|
1625
1635
|
id: alepha23.TString;
|
|
@@ -1639,8 +1649,8 @@ declare class AdminIdentityController {
|
|
|
1639
1649
|
}>;
|
|
1640
1650
|
}>;
|
|
1641
1651
|
/**
|
|
1642
|
-
|
|
1643
|
-
|
|
1652
|
+
* Delete an identity.
|
|
1653
|
+
*/
|
|
1644
1654
|
readonly deleteIdentity: alepha_server0.ActionPrimitiveFn<{
|
|
1645
1655
|
params: alepha23.TObject<{
|
|
1646
1656
|
id: alepha23.TString;
|
|
@@ -1667,7 +1677,7 @@ type SessionQuery = Static<typeof sessionQuerySchema>;
|
|
|
1667
1677
|
//#endregion
|
|
1668
1678
|
//#region ../../src/api/users/services/SessionCrudService.d.ts
|
|
1669
1679
|
declare class SessionCrudService {
|
|
1670
|
-
protected readonly log:
|
|
1680
|
+
protected readonly log: alepha_logger6.Logger;
|
|
1671
1681
|
protected readonly realmProvider: RealmProvider;
|
|
1672
1682
|
sessions(userRealmName?: string): alepha_orm24.Repository<alepha23.TObject<{
|
|
1673
1683
|
id: alepha_orm24.PgAttr<alepha_orm24.PgAttr<alepha23.TString, typeof alepha_orm24.PG_PRIMARY_KEY>, typeof alepha_orm24.PG_DEFAULT>;
|
|
@@ -1685,16 +1695,16 @@ declare class SessionCrudService {
|
|
|
1685
1695
|
}>>;
|
|
1686
1696
|
}>>;
|
|
1687
1697
|
/**
|
|
1688
|
-
|
|
1689
|
-
|
|
1698
|
+
* Find sessions with pagination and filtering.
|
|
1699
|
+
*/
|
|
1690
1700
|
findSessions(q?: SessionQuery, userRealmName?: string): Promise<Page$1<SessionEntity>>;
|
|
1691
1701
|
/**
|
|
1692
|
-
|
|
1693
|
-
|
|
1702
|
+
* Get a session by ID.
|
|
1703
|
+
*/
|
|
1694
1704
|
getSessionById(id: string, userRealmName?: string): Promise<SessionEntity>;
|
|
1695
1705
|
/**
|
|
1696
|
-
|
|
1697
|
-
|
|
1706
|
+
* Delete a session by ID.
|
|
1707
|
+
*/
|
|
1698
1708
|
deleteSession(id: string, userRealmName?: string): Promise<void>;
|
|
1699
1709
|
}
|
|
1700
1710
|
//#endregion
|
|
@@ -1704,8 +1714,8 @@ declare class AdminSessionController {
|
|
|
1704
1714
|
protected readonly group = "admin:sessions";
|
|
1705
1715
|
protected readonly sessionService: SessionCrudService;
|
|
1706
1716
|
/**
|
|
1707
|
-
|
|
1708
|
-
|
|
1717
|
+
* Find sessions with pagination and filtering.
|
|
1718
|
+
*/
|
|
1709
1719
|
readonly findSessions: alepha_server0.ActionPrimitiveFn<{
|
|
1710
1720
|
query: alepha23.TObject<{
|
|
1711
1721
|
page: alepha23.TOptional<alepha23.TInteger>;
|
|
@@ -1731,8 +1741,8 @@ declare class AdminSessionController {
|
|
|
1731
1741
|
}>>;
|
|
1732
1742
|
}>;
|
|
1733
1743
|
/**
|
|
1734
|
-
|
|
1735
|
-
|
|
1744
|
+
* Get a session by ID.
|
|
1745
|
+
*/
|
|
1736
1746
|
readonly getSession: alepha_server0.ActionPrimitiveFn<{
|
|
1737
1747
|
params: alepha23.TObject<{
|
|
1738
1748
|
id: alepha23.TString;
|
|
@@ -1757,8 +1767,8 @@ declare class AdminSessionController {
|
|
|
1757
1767
|
}>;
|
|
1758
1768
|
}>;
|
|
1759
1769
|
/**
|
|
1760
|
-
|
|
1761
|
-
|
|
1770
|
+
* Delete a session.
|
|
1771
|
+
*/
|
|
1762
1772
|
readonly deleteSession: alepha_server0.ActionPrimitiveFn<{
|
|
1763
1773
|
params: alepha23.TObject<{
|
|
1764
1774
|
id: alepha23.TString;
|
|
@@ -1849,7 +1859,7 @@ type UserQuery = Static<typeof userQuerySchema>;
|
|
|
1849
1859
|
//#endregion
|
|
1850
1860
|
//#region ../../src/api/users/services/UserService.d.ts
|
|
1851
1861
|
declare class UserService {
|
|
1852
|
-
protected readonly log:
|
|
1862
|
+
protected readonly log: alepha_logger6.Logger;
|
|
1853
1863
|
protected readonly verificationController: alepha_server_links0.HttpVirtualClient<VerificationController>;
|
|
1854
1864
|
protected readonly userNotifications: UserNotifications;
|
|
1855
1865
|
protected readonly realmProvider: RealmProvider;
|
|
@@ -1871,41 +1881,41 @@ declare class UserService {
|
|
|
1871
1881
|
emailVerified: alepha_orm24.PgAttr<alepha23.TBoolean, typeof alepha_orm24.PG_DEFAULT>;
|
|
1872
1882
|
}>>;
|
|
1873
1883
|
/**
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1884
|
+
* Request email verification for a user.
|
|
1885
|
+
* @param email - The email address to verify.
|
|
1886
|
+
* @param userRealmName - Optional realm name.
|
|
1887
|
+
* @param method - The verification method: "code" (default) or "link".
|
|
1888
|
+
* @param verifyUrl - Base URL for verification link (required when method is "link").
|
|
1889
|
+
*/
|
|
1880
1890
|
requestEmailVerification(email: string, userRealmName?: string, method?: "code" | "link", verifyUrl?: string): Promise<boolean>;
|
|
1881
1891
|
/**
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1892
|
+
* Verify a user's email using a valid verification token.
|
|
1893
|
+
* Supports both code (6-digit) and link (UUID) verification tokens.
|
|
1894
|
+
*/
|
|
1885
1895
|
verifyEmail(email: string, token: string, userRealmName?: string): Promise<void>;
|
|
1886
1896
|
/**
|
|
1887
|
-
|
|
1888
|
-
|
|
1897
|
+
* Check if an email is verified.
|
|
1898
|
+
*/
|
|
1889
1899
|
isEmailVerified(email: string, userRealmName?: string): Promise<boolean>;
|
|
1890
1900
|
/**
|
|
1891
|
-
|
|
1892
|
-
|
|
1901
|
+
* Find users with pagination and filtering.
|
|
1902
|
+
*/
|
|
1893
1903
|
findUsers(q?: UserQuery, userRealmName?: string): Promise<Page$1<UserEntity>>;
|
|
1894
1904
|
/**
|
|
1895
|
-
|
|
1896
|
-
|
|
1905
|
+
* Get a user by ID.
|
|
1906
|
+
*/
|
|
1897
1907
|
getUserById(id: string, userRealmName?: string): Promise<UserEntity>;
|
|
1898
1908
|
/**
|
|
1899
|
-
|
|
1900
|
-
|
|
1909
|
+
* Create a new user.
|
|
1910
|
+
*/
|
|
1901
1911
|
createUser(data: CreateUser, userRealmName?: string): Promise<UserEntity>;
|
|
1902
1912
|
/**
|
|
1903
|
-
|
|
1904
|
-
|
|
1913
|
+
* Update an existing user.
|
|
1914
|
+
*/
|
|
1905
1915
|
updateUser(id: string, data: UpdateUser, userRealmName?: string): Promise<UserEntity>;
|
|
1906
1916
|
/**
|
|
1907
|
-
|
|
1908
|
-
|
|
1917
|
+
* Delete a user by ID.
|
|
1918
|
+
*/
|
|
1909
1919
|
deleteUser(id: string, userRealmName?: string): Promise<void>;
|
|
1910
1920
|
}
|
|
1911
1921
|
//#endregion
|
|
@@ -1915,8 +1925,8 @@ declare class AdminUserController {
|
|
|
1915
1925
|
protected readonly group = "admin:users";
|
|
1916
1926
|
protected readonly userService: UserService;
|
|
1917
1927
|
/**
|
|
1918
|
-
|
|
1919
|
-
|
|
1928
|
+
* Find users with pagination and filtering.
|
|
1929
|
+
*/
|
|
1920
1930
|
readonly findUsers: alepha_server0.ActionPrimitiveFn<{
|
|
1921
1931
|
query: alepha23.TObject<{
|
|
1922
1932
|
page: alepha23.TOptional<alepha23.TInteger>;
|
|
@@ -1947,8 +1957,8 @@ declare class AdminUserController {
|
|
|
1947
1957
|
}>>;
|
|
1948
1958
|
}>;
|
|
1949
1959
|
/**
|
|
1950
|
-
|
|
1951
|
-
|
|
1960
|
+
* Get a user by ID.
|
|
1961
|
+
*/
|
|
1952
1962
|
readonly getUser: alepha_server0.ActionPrimitiveFn<{
|
|
1953
1963
|
params: alepha23.TObject<{
|
|
1954
1964
|
id: alepha23.TString;
|
|
@@ -1974,8 +1984,8 @@ declare class AdminUserController {
|
|
|
1974
1984
|
}>;
|
|
1975
1985
|
}>;
|
|
1976
1986
|
/**
|
|
1977
|
-
|
|
1978
|
-
|
|
1987
|
+
* Create a new user.
|
|
1988
|
+
*/
|
|
1979
1989
|
readonly createUser: alepha_server0.ActionPrimitiveFn<{
|
|
1980
1990
|
query: alepha23.TObject<{
|
|
1981
1991
|
userRealmName: alepha23.TOptional<alepha23.TString>;
|
|
@@ -2013,8 +2023,8 @@ declare class AdminUserController {
|
|
|
2013
2023
|
}>;
|
|
2014
2024
|
}>;
|
|
2015
2025
|
/**
|
|
2016
|
-
|
|
2017
|
-
|
|
2026
|
+
* Update a user.
|
|
2027
|
+
*/
|
|
2018
2028
|
readonly updateUser: alepha_server0.ActionPrimitiveFn<{
|
|
2019
2029
|
params: alepha23.TObject<{
|
|
2020
2030
|
id: alepha23.TString;
|
|
@@ -2050,8 +2060,8 @@ declare class AdminUserController {
|
|
|
2050
2060
|
}>;
|
|
2051
2061
|
}>;
|
|
2052
2062
|
/**
|
|
2053
|
-
|
|
2054
|
-
|
|
2063
|
+
* Delete a user.
|
|
2064
|
+
*/
|
|
2055
2065
|
readonly deleteUser: alepha_server0.ActionPrimitiveFn<{
|
|
2056
2066
|
params: alepha23.TObject<{
|
|
2057
2067
|
id: alepha23.TString;
|
|
@@ -2078,9 +2088,9 @@ declare class RealmController {
|
|
|
2078
2088
|
protected readonly realmProvider: RealmProvider;
|
|
2079
2089
|
protected readonly serverAuthProvider: ServerAuthProvider;
|
|
2080
2090
|
/**
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2091
|
+
* Get realm configuration settings.
|
|
2092
|
+
* This endpoint is not exposed in the API documentation.
|
|
2093
|
+
*/
|
|
2084
2094
|
readonly getRealmConfig: alepha_server0.ActionPrimitiveFn<{
|
|
2085
2095
|
query: alepha23.TObject<{
|
|
2086
2096
|
realmName: alepha23.TOptional<alepha23.TString>;
|
|
@@ -2170,7 +2180,7 @@ interface PasswordResetIntent {
|
|
|
2170
2180
|
expiresAt: string;
|
|
2171
2181
|
}
|
|
2172
2182
|
declare class CredentialService {
|
|
2173
|
-
protected readonly log:
|
|
2183
|
+
protected readonly log: alepha_logger6.Logger;
|
|
2174
2184
|
protected readonly cryptoProvider: CryptoProvider;
|
|
2175
2185
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
2176
2186
|
protected readonly verificationController: alepha_server_links0.HttpVirtualClient<VerificationController>;
|
|
@@ -2221,36 +2231,36 @@ declare class CredentialService {
|
|
|
2221
2231
|
providerData: alepha23.TOptional<alepha23.TRecord<string, alepha23.TAny>>;
|
|
2222
2232
|
}>>;
|
|
2223
2233
|
/**
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2234
|
+
* Phase 1: Create a password reset intent.
|
|
2235
|
+
*
|
|
2236
|
+
* Validates the email, checks for existing user with credentials,
|
|
2237
|
+
* sends verification code, and stores the intent in cache.
|
|
2238
|
+
*
|
|
2239
|
+
* @param email - User's email address
|
|
2240
|
+
* @param userRealmName - Optional realm name
|
|
2241
|
+
* @returns Intent response with intentId and expiration (always returns for security)
|
|
2242
|
+
*/
|
|
2233
2243
|
createPasswordResetIntent(email: string, userRealmName?: string): Promise<PasswordResetIntentResponse>;
|
|
2234
2244
|
/**
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2245
|
+
* Phase 2: Complete password reset using an intent.
|
|
2246
|
+
*
|
|
2247
|
+
* Validates the verification code, updates the password,
|
|
2248
|
+
* and invalidates all existing sessions.
|
|
2249
|
+
*
|
|
2250
|
+
* @param body - Request body with intentId, code, and newPassword
|
|
2251
|
+
*/
|
|
2242
2252
|
completePasswordReset(body: CompletePasswordResetRequest): Promise<void>;
|
|
2243
2253
|
/**
|
|
2244
|
-
|
|
2245
|
-
|
|
2254
|
+
* @deprecated Use createPasswordResetIntent instead
|
|
2255
|
+
*/
|
|
2246
2256
|
requestPasswordReset(email: string, userRealmName?: string): Promise<boolean>;
|
|
2247
2257
|
/**
|
|
2248
|
-
|
|
2249
|
-
|
|
2258
|
+
* @deprecated Use completePasswordReset instead
|
|
2259
|
+
*/
|
|
2250
2260
|
validateResetToken(email: string, token: string, _userRealmName?: string): Promise<string>;
|
|
2251
2261
|
/**
|
|
2252
|
-
|
|
2253
|
-
|
|
2262
|
+
* @deprecated Use completePasswordReset instead
|
|
2263
|
+
*/
|
|
2254
2264
|
resetPassword(email: string, token: string, newPassword: string, userRealmName?: string): Promise<void>;
|
|
2255
2265
|
}
|
|
2256
2266
|
//#endregion
|
|
@@ -2312,7 +2322,7 @@ interface RegistrationIntent {
|
|
|
2312
2322
|
expiresAt: string;
|
|
2313
2323
|
}
|
|
2314
2324
|
declare class RegistrationService {
|
|
2315
|
-
protected readonly log:
|
|
2325
|
+
protected readonly log: alepha_logger6.Logger;
|
|
2316
2326
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
2317
2327
|
protected readonly cryptoProvider: CryptoProvider;
|
|
2318
2328
|
protected readonly verificationController: alepha_server_links0.HttpVirtualClient<VerificationController>;
|
|
@@ -2321,38 +2331,38 @@ declare class RegistrationService {
|
|
|
2321
2331
|
protected readonly auditService: AuditService;
|
|
2322
2332
|
protected readonly intentCache: alepha_cache0.CachePrimitiveFn<RegistrationIntent, any[]>;
|
|
2323
2333
|
/**
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2334
|
+
* Phase 1: Create a registration intent.
|
|
2335
|
+
*
|
|
2336
|
+
* Validates the registration data, checks for existing users,
|
|
2337
|
+
* creates verification sessions, and stores the intent in cache.
|
|
2338
|
+
*/
|
|
2329
2339
|
createRegistrationIntent(body: RegisterRequest, userRealmName?: string): Promise<RegistrationIntentResponse>;
|
|
2330
2340
|
/**
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2341
|
+
* Phase 2: Complete registration using an intent.
|
|
2342
|
+
*
|
|
2343
|
+
* Validates all requirements (verification codes, captcha),
|
|
2344
|
+
* creates the user and credentials, and returns the user.
|
|
2345
|
+
*/
|
|
2336
2346
|
completeRegistration(body: CompleteRegistrationRequest): Promise<UserEntity>;
|
|
2337
2347
|
/**
|
|
2338
|
-
|
|
2339
|
-
|
|
2348
|
+
* Check if username, email, and phone are available.
|
|
2349
|
+
*/
|
|
2340
2350
|
protected checkUserAvailability(body: Pick<RegisterRequest, "username" | "email" | "phoneNumber">, userRealmName?: string): Promise<void>;
|
|
2341
2351
|
/**
|
|
2342
|
-
|
|
2343
|
-
|
|
2352
|
+
* Send email verification code.
|
|
2353
|
+
*/
|
|
2344
2354
|
protected sendEmailVerification(email: string): Promise<void>;
|
|
2345
2355
|
/**
|
|
2346
|
-
|
|
2347
|
-
|
|
2356
|
+
* Send phone verification code.
|
|
2357
|
+
*/
|
|
2348
2358
|
protected sendPhoneVerification(phoneNumber: string): Promise<void>;
|
|
2349
2359
|
/**
|
|
2350
|
-
|
|
2351
|
-
|
|
2360
|
+
* Verify email code using verification service.
|
|
2361
|
+
*/
|
|
2352
2362
|
protected verifyEmailCode(email: string, code: string): Promise<void>;
|
|
2353
2363
|
/**
|
|
2354
|
-
|
|
2355
|
-
|
|
2364
|
+
* Verify phone code using verification service.
|
|
2365
|
+
*/
|
|
2356
2366
|
protected verifyPhoneCode(phoneNumber: string, code: string): Promise<void>;
|
|
2357
2367
|
}
|
|
2358
2368
|
//#endregion
|
|
@@ -2364,9 +2374,9 @@ declare class UserController {
|
|
|
2364
2374
|
protected readonly userService: UserService;
|
|
2365
2375
|
protected readonly registrationService: RegistrationService;
|
|
2366
2376
|
/**
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2377
|
+
* Phase 1: Create a registration intent.
|
|
2378
|
+
* Validates data, creates verification sessions, and stores intent in cache.
|
|
2379
|
+
*/
|
|
2370
2380
|
readonly createRegistrationIntent: alepha_server0.ActionPrimitiveFn<{
|
|
2371
2381
|
body: alepha23.TObject<{
|
|
2372
2382
|
password: alepha23.TString;
|
|
@@ -2389,9 +2399,9 @@ declare class UserController {
|
|
|
2389
2399
|
}>;
|
|
2390
2400
|
}>;
|
|
2391
2401
|
/**
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2402
|
+
* Phase 2: Complete registration using an intent.
|
|
2403
|
+
* Validates verification codes and creates the user.
|
|
2404
|
+
*/
|
|
2395
2405
|
readonly createUserFromIntent: alepha_server0.ActionPrimitiveFn<{
|
|
2396
2406
|
body: alepha23.TObject<{
|
|
2397
2407
|
intentId: alepha23.TString;
|
|
@@ -2417,9 +2427,9 @@ declare class UserController {
|
|
|
2417
2427
|
}>;
|
|
2418
2428
|
}>;
|
|
2419
2429
|
/**
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2430
|
+
* Phase 1: Create a password reset intent.
|
|
2431
|
+
* Validates email, sends verification code, and stores intent in cache.
|
|
2432
|
+
*/
|
|
2423
2433
|
readonly createPasswordResetIntent: alepha_server0.ActionPrimitiveFn<{
|
|
2424
2434
|
query: alepha23.TObject<{
|
|
2425
2435
|
userRealmName: alepha23.TOptional<alepha23.TString>;
|
|
@@ -2433,9 +2443,9 @@ declare class UserController {
|
|
|
2433
2443
|
}>;
|
|
2434
2444
|
}>;
|
|
2435
2445
|
/**
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2446
|
+
* Phase 2: Complete password reset using an intent.
|
|
2447
|
+
* Validates verification code, updates password, and invalidates sessions.
|
|
2448
|
+
*/
|
|
2439
2449
|
readonly completePasswordReset: alepha_server0.ActionPrimitiveFn<{
|
|
2440
2450
|
body: alepha23.TObject<{
|
|
2441
2451
|
intentId: alepha23.TString;
|
|
@@ -2449,8 +2459,8 @@ declare class UserController {
|
|
|
2449
2459
|
}>;
|
|
2450
2460
|
}>;
|
|
2451
2461
|
/**
|
|
2452
|
-
|
|
2453
|
-
|
|
2462
|
+
* @deprecated Use createPasswordResetIntent instead
|
|
2463
|
+
*/
|
|
2454
2464
|
requestPasswordReset: alepha_server0.ActionPrimitiveFn<{
|
|
2455
2465
|
query: alepha23.TObject<{
|
|
2456
2466
|
userRealmName: alepha23.TOptional<alepha23.TString>;
|
|
@@ -2464,8 +2474,8 @@ declare class UserController {
|
|
|
2464
2474
|
}>;
|
|
2465
2475
|
}>;
|
|
2466
2476
|
/**
|
|
2467
|
-
|
|
2468
|
-
|
|
2477
|
+
* @deprecated Use completePasswordReset instead
|
|
2478
|
+
*/
|
|
2469
2479
|
validateResetToken: alepha_server0.ActionPrimitiveFn<{
|
|
2470
2480
|
query: alepha23.TObject<{
|
|
2471
2481
|
email: alepha23.TString;
|
|
@@ -2478,8 +2488,8 @@ declare class UserController {
|
|
|
2478
2488
|
}>;
|
|
2479
2489
|
}>;
|
|
2480
2490
|
/**
|
|
2481
|
-
|
|
2482
|
-
|
|
2491
|
+
* @deprecated Use completePasswordReset instead
|
|
2492
|
+
*/
|
|
2483
2493
|
resetPassword: alepha_server0.ActionPrimitiveFn<{
|
|
2484
2494
|
query: alepha23.TObject<{
|
|
2485
2495
|
userRealmName: alepha23.TOptional<alepha23.TString>;
|
|
@@ -2495,11 +2505,11 @@ declare class UserController {
|
|
|
2495
2505
|
}>;
|
|
2496
2506
|
}>;
|
|
2497
2507
|
/**
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2508
|
+
* Request email verification.
|
|
2509
|
+
* Generates a verification token using verification service and sends an email to the user.
|
|
2510
|
+
* @param method - The verification method: "code" (default) sends a 6-digit code, "link" sends a clickable verification link.
|
|
2511
|
+
* @param verifyUrl - Required when method is "link". The base URL for the verification link. Token and email will be appended as query params.
|
|
2512
|
+
*/
|
|
2503
2513
|
requestEmailVerification: alepha_server0.ActionPrimitiveFn<{
|
|
2504
2514
|
query: alepha23.TObject<{
|
|
2505
2515
|
userRealmName: alepha23.TOptional<alepha23.TString>;
|
|
@@ -2515,9 +2525,9 @@ declare class UserController {
|
|
|
2515
2525
|
}>;
|
|
2516
2526
|
}>;
|
|
2517
2527
|
/**
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2528
|
+
* Verify email with a valid token.
|
|
2529
|
+
* Updates the user's emailVerified status.
|
|
2530
|
+
*/
|
|
2521
2531
|
verifyEmail: alepha_server0.ActionPrimitiveFn<{
|
|
2522
2532
|
query: alepha23.TObject<{
|
|
2523
2533
|
userRealmName: alepha23.TOptional<alepha23.TString>;
|
|
@@ -2532,8 +2542,8 @@ declare class UserController {
|
|
|
2532
2542
|
}>;
|
|
2533
2543
|
}>;
|
|
2534
2544
|
/**
|
|
2535
|
-
|
|
2536
|
-
|
|
2545
|
+
* Check if an email is verified.
|
|
2546
|
+
*/
|
|
2537
2547
|
checkEmailVerification: alepha_server0.ActionPrimitiveFn<{
|
|
2538
2548
|
query: alepha23.TObject<{
|
|
2539
2549
|
email: alepha23.TString;
|
|
@@ -2660,13 +2670,303 @@ declare const userResourceSchema: alepha23.TObject<{
|
|
|
2660
2670
|
}>;
|
|
2661
2671
|
type UserResource = Static<typeof userResourceSchema>;
|
|
2662
2672
|
//#endregion
|
|
2673
|
+
//#region ../../src/system/providers/FileSystemProvider.d.ts
|
|
2674
|
+
/**
|
|
2675
|
+
* Options for creating a file from a URL
|
|
2676
|
+
*/
|
|
2677
|
+
interface CreateFileFromUrlOptions {
|
|
2678
|
+
/**
|
|
2679
|
+
* The URL to load the file from (file://, http://, or https://)
|
|
2680
|
+
*/
|
|
2681
|
+
url: string;
|
|
2682
|
+
/**
|
|
2683
|
+
* The MIME type of the file (optional, will be detected from filename if not provided)
|
|
2684
|
+
*/
|
|
2685
|
+
type?: string;
|
|
2686
|
+
/**
|
|
2687
|
+
* The name of the file (optional, will be extracted from URL if not provided)
|
|
2688
|
+
*/
|
|
2689
|
+
name?: string;
|
|
2690
|
+
}
|
|
2691
|
+
/**
|
|
2692
|
+
* Options for creating a file from a path (URL with file:// scheme)
|
|
2693
|
+
*/
|
|
2694
|
+
interface CreateFileFromPathOptions {
|
|
2695
|
+
/**
|
|
2696
|
+
* The path to the file on the local filesystem
|
|
2697
|
+
*/
|
|
2698
|
+
path: string;
|
|
2699
|
+
/**
|
|
2700
|
+
* The MIME type of the file (optional, will be detected from filename if not provided)
|
|
2701
|
+
*/
|
|
2702
|
+
type?: string;
|
|
2703
|
+
/**
|
|
2704
|
+
* The name of the file (optional, will be extracted from URL if not provided)
|
|
2705
|
+
*/
|
|
2706
|
+
name?: string;
|
|
2707
|
+
}
|
|
2708
|
+
/**
|
|
2709
|
+
* Options for creating a file from a Buffer
|
|
2710
|
+
*/
|
|
2711
|
+
interface CreateFileFromBufferOptions {
|
|
2712
|
+
/**
|
|
2713
|
+
* The Buffer containing the file data
|
|
2714
|
+
*/
|
|
2715
|
+
buffer: Buffer;
|
|
2716
|
+
/**
|
|
2717
|
+
* The MIME type of the file (optional, will be detected from name if not provided)
|
|
2718
|
+
*/
|
|
2719
|
+
type?: string;
|
|
2720
|
+
/**
|
|
2721
|
+
* The name of the file (required for proper content type detection)
|
|
2722
|
+
*/
|
|
2723
|
+
name?: string;
|
|
2724
|
+
}
|
|
2725
|
+
/**
|
|
2726
|
+
* Options for creating a file from a stream
|
|
2727
|
+
*/
|
|
2728
|
+
interface CreateFileFromStreamOptions {
|
|
2729
|
+
/**
|
|
2730
|
+
* The readable stream containing the file data
|
|
2731
|
+
*/
|
|
2732
|
+
stream: StreamLike;
|
|
2733
|
+
/**
|
|
2734
|
+
* The MIME type of the file (optional, will be detected from name if not provided)
|
|
2735
|
+
*/
|
|
2736
|
+
type?: string;
|
|
2737
|
+
/**
|
|
2738
|
+
* The name of the file (required for proper content type detection)
|
|
2739
|
+
*/
|
|
2740
|
+
name?: string;
|
|
2741
|
+
/**
|
|
2742
|
+
* The size of the file in bytes (optional)
|
|
2743
|
+
*/
|
|
2744
|
+
size?: number;
|
|
2745
|
+
}
|
|
2746
|
+
/**
|
|
2747
|
+
* Options for creating a file from text content
|
|
2748
|
+
*/
|
|
2749
|
+
interface CreateFileFromTextOptions {
|
|
2750
|
+
/**
|
|
2751
|
+
* The text content to create the file from
|
|
2752
|
+
*/
|
|
2753
|
+
text: string;
|
|
2754
|
+
/**
|
|
2755
|
+
* The MIME type of the file (default: text/plain)
|
|
2756
|
+
*/
|
|
2757
|
+
type?: string;
|
|
2758
|
+
/**
|
|
2759
|
+
* The name of the file (default: "file.txt")
|
|
2760
|
+
*/
|
|
2761
|
+
name?: string;
|
|
2762
|
+
}
|
|
2763
|
+
interface CreateFileFromResponseOptions {
|
|
2764
|
+
/**
|
|
2765
|
+
* The Response object containing the file data
|
|
2766
|
+
*/
|
|
2767
|
+
response: Response;
|
|
2768
|
+
/**
|
|
2769
|
+
* Override the name (optional, uses filename from Content-Disposition header if not provided)
|
|
2770
|
+
*/
|
|
2771
|
+
name?: string;
|
|
2772
|
+
/**
|
|
2773
|
+
* Override the MIME type (optional, uses file.type if not provided)
|
|
2774
|
+
*/
|
|
2775
|
+
type?: string;
|
|
2776
|
+
}
|
|
2777
|
+
/**
|
|
2778
|
+
* Options for creating a file from a Web File object
|
|
2779
|
+
*/
|
|
2780
|
+
interface CreateFileFromWebFileOptions {
|
|
2781
|
+
/**
|
|
2782
|
+
* The Web File object
|
|
2783
|
+
*/
|
|
2784
|
+
file: File;
|
|
2785
|
+
/**
|
|
2786
|
+
* Override the MIME type (optional, uses file.type if not provided)
|
|
2787
|
+
*/
|
|
2788
|
+
type?: string;
|
|
2789
|
+
/**
|
|
2790
|
+
* Override the name (optional, uses file.name if not provided)
|
|
2791
|
+
*/
|
|
2792
|
+
name?: string;
|
|
2793
|
+
/**
|
|
2794
|
+
* Override the size (optional, uses file.size if not provided)
|
|
2795
|
+
*/
|
|
2796
|
+
size?: number;
|
|
2797
|
+
}
|
|
2798
|
+
/**
|
|
2799
|
+
* Options for creating a file from an ArrayBuffer
|
|
2800
|
+
*/
|
|
2801
|
+
interface CreateFileFromArrayBufferOptions {
|
|
2802
|
+
/**
|
|
2803
|
+
* The ArrayBuffer containing the file data
|
|
2804
|
+
*/
|
|
2805
|
+
arrayBuffer: ArrayBuffer;
|
|
2806
|
+
/**
|
|
2807
|
+
* The MIME type of the file (optional, will be detected from name if not provided)
|
|
2808
|
+
*/
|
|
2809
|
+
type?: string;
|
|
2810
|
+
/**
|
|
2811
|
+
* The name of the file (required for proper content type detection)
|
|
2812
|
+
*/
|
|
2813
|
+
name?: string;
|
|
2814
|
+
}
|
|
2815
|
+
/**
|
|
2816
|
+
* Union type for all createFile options
|
|
2817
|
+
*/
|
|
2818
|
+
type CreateFileOptions = CreateFileFromUrlOptions | CreateFileFromPathOptions | CreateFileFromBufferOptions | CreateFileFromStreamOptions | CreateFileFromTextOptions | CreateFileFromWebFileOptions | CreateFileFromResponseOptions | CreateFileFromArrayBufferOptions;
|
|
2819
|
+
/**
|
|
2820
|
+
* Options for rm (remove) operation
|
|
2821
|
+
*/
|
|
2822
|
+
interface RmOptions {
|
|
2823
|
+
/**
|
|
2824
|
+
* If true, removes directories and their contents recursively
|
|
2825
|
+
*/
|
|
2826
|
+
recursive?: boolean;
|
|
2827
|
+
/**
|
|
2828
|
+
* If true, no error will be thrown if the path does not exist
|
|
2829
|
+
*/
|
|
2830
|
+
force?: boolean;
|
|
2831
|
+
}
|
|
2832
|
+
/**
|
|
2833
|
+
* Options for cp (copy) operation
|
|
2834
|
+
*/
|
|
2835
|
+
interface CpOptions {
|
|
2836
|
+
/**
|
|
2837
|
+
* If true, copy directories recursively
|
|
2838
|
+
*/
|
|
2839
|
+
recursive?: boolean;
|
|
2840
|
+
/**
|
|
2841
|
+
* If true, overwrite existing destination
|
|
2842
|
+
*/
|
|
2843
|
+
force?: boolean;
|
|
2844
|
+
}
|
|
2845
|
+
/**
|
|
2846
|
+
* Options for mkdir operation
|
|
2847
|
+
*/
|
|
2848
|
+
interface MkdirOptions {
|
|
2849
|
+
/**
|
|
2850
|
+
* If true, creates parent directories as needed
|
|
2851
|
+
*/
|
|
2852
|
+
recursive?: boolean;
|
|
2853
|
+
/**
|
|
2854
|
+
* File mode (permission and sticky bits)
|
|
2855
|
+
*/
|
|
2856
|
+
mode?: number;
|
|
2857
|
+
}
|
|
2858
|
+
/**
|
|
2859
|
+
* Options for ls (list) operation
|
|
2860
|
+
*/
|
|
2861
|
+
interface LsOptions {
|
|
2862
|
+
/**
|
|
2863
|
+
* If true, list contents of directories recursively
|
|
2864
|
+
*/
|
|
2865
|
+
recursive?: boolean;
|
|
2866
|
+
/**
|
|
2867
|
+
* If true, include hidden files (starting with .)
|
|
2868
|
+
*/
|
|
2869
|
+
hidden?: boolean;
|
|
2870
|
+
}
|
|
2871
|
+
/**
|
|
2872
|
+
* FileSystem interface providing utilities for working with files.
|
|
2873
|
+
*/
|
|
2874
|
+
declare abstract class FileSystemProvider {
|
|
2875
|
+
/**
|
|
2876
|
+
* Joins multiple path segments into a single path.
|
|
2877
|
+
*
|
|
2878
|
+
* @param paths - The path segments to join
|
|
2879
|
+
* @returns The joined path
|
|
2880
|
+
*/
|
|
2881
|
+
abstract join(...paths: string[]): string;
|
|
2882
|
+
/**
|
|
2883
|
+
* Creates a FileLike object from various sources.
|
|
2884
|
+
*
|
|
2885
|
+
* @param options - Options for creating the file
|
|
2886
|
+
* @returns A FileLike object
|
|
2887
|
+
*/
|
|
2888
|
+
abstract createFile(options: CreateFileOptions): FileLike;
|
|
2889
|
+
/**
|
|
2890
|
+
* Removes a file or directory.
|
|
2891
|
+
*
|
|
2892
|
+
* @param path - The path to remove
|
|
2893
|
+
* @param options - Remove options
|
|
2894
|
+
*/
|
|
2895
|
+
abstract rm(path: string, options?: RmOptions): Promise<void>;
|
|
2896
|
+
/**
|
|
2897
|
+
* Copies a file or directory.
|
|
2898
|
+
*
|
|
2899
|
+
* @param src - Source path
|
|
2900
|
+
* @param dest - Destination path
|
|
2901
|
+
* @param options - Copy options
|
|
2902
|
+
*/
|
|
2903
|
+
abstract cp(src: string, dest: string, options?: CpOptions): Promise<void>;
|
|
2904
|
+
/**
|
|
2905
|
+
* Moves/renames a file or directory.
|
|
2906
|
+
*
|
|
2907
|
+
* @param src - Source path
|
|
2908
|
+
* @param dest - Destination path
|
|
2909
|
+
*/
|
|
2910
|
+
abstract mv(src: string, dest: string): Promise<void>;
|
|
2911
|
+
/**
|
|
2912
|
+
* Creates a directory.
|
|
2913
|
+
*
|
|
2914
|
+
* @param path - The directory path to create
|
|
2915
|
+
* @param options - Mkdir options
|
|
2916
|
+
*/
|
|
2917
|
+
abstract mkdir(path: string, options?: MkdirOptions): Promise<void>;
|
|
2918
|
+
/**
|
|
2919
|
+
* Lists files in a directory.
|
|
2920
|
+
*
|
|
2921
|
+
* @param path - The directory path to list
|
|
2922
|
+
* @param options - List options
|
|
2923
|
+
* @returns Array of filenames
|
|
2924
|
+
*/
|
|
2925
|
+
abstract ls(path: string, options?: LsOptions): Promise<string[]>;
|
|
2926
|
+
/**
|
|
2927
|
+
* Checks if a file or directory exists.
|
|
2928
|
+
*
|
|
2929
|
+
* @param path - The path to check
|
|
2930
|
+
* @returns True if the path exists, false otherwise
|
|
2931
|
+
*/
|
|
2932
|
+
abstract exists(path: string): Promise<boolean>;
|
|
2933
|
+
/**
|
|
2934
|
+
* Reads the content of a file.
|
|
2935
|
+
*
|
|
2936
|
+
* @param path - The file path to read
|
|
2937
|
+
* @returns The file content as a Buffer
|
|
2938
|
+
*/
|
|
2939
|
+
abstract readFile(path: string): Promise<Buffer>;
|
|
2940
|
+
/**
|
|
2941
|
+
* Writes data to a file.
|
|
2942
|
+
*
|
|
2943
|
+
* @param path - The file path to write to
|
|
2944
|
+
* @param data - The data to write (Buffer or string)
|
|
2945
|
+
*/
|
|
2946
|
+
abstract writeFile(path: string, data: Uint8Array | Buffer | string | FileLike): Promise<void>;
|
|
2947
|
+
/**
|
|
2948
|
+
* Reads the content of a file as a string.
|
|
2949
|
+
*
|
|
2950
|
+
* @param path - The file path to read
|
|
2951
|
+
* @returns The file content as a string
|
|
2952
|
+
*/
|
|
2953
|
+
abstract readTextFile(path: string): Promise<string>;
|
|
2954
|
+
/**
|
|
2955
|
+
* Reads the content of a file as JSON.
|
|
2956
|
+
*
|
|
2957
|
+
* @param path - The file path to read
|
|
2958
|
+
* @returns The parsed JSON content
|
|
2959
|
+
*/
|
|
2960
|
+
abstract readJsonFile<T = unknown>(path: string): Promise<T>;
|
|
2961
|
+
}
|
|
2962
|
+
//#endregion
|
|
2663
2963
|
//#region ../../src/api/users/services/SessionService.d.ts
|
|
2664
2964
|
declare class SessionService {
|
|
2665
2965
|
protected readonly alepha: Alepha;
|
|
2666
2966
|
protected readonly fsp: FileSystemProvider;
|
|
2667
2967
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
2668
2968
|
protected readonly cryptoProvider: CryptoProvider;
|
|
2669
|
-
protected readonly log:
|
|
2969
|
+
protected readonly log: alepha_logger6.Logger;
|
|
2670
2970
|
protected readonly realmProvider: RealmProvider;
|
|
2671
2971
|
protected readonly fileController: alepha_server_links0.HttpVirtualClient<FileController>;
|
|
2672
2972
|
protected readonly auditService: AuditService;
|
|
@@ -2713,13 +3013,13 @@ declare class SessionService {
|
|
|
2713
3013
|
providerData: alepha23.TOptional<alepha23.TRecord<string, alepha23.TAny>>;
|
|
2714
3014
|
}>>;
|
|
2715
3015
|
/**
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
3016
|
+
* Random delay to prevent timing attacks (50-200ms)
|
|
3017
|
+
* Uses cryptographically secure random number generation
|
|
3018
|
+
*/
|
|
2719
3019
|
protected randomDelay(): Promise<void>;
|
|
2720
3020
|
/**
|
|
2721
|
-
|
|
2722
|
-
|
|
3021
|
+
* Validate user credentials and return the user if valid.
|
|
3022
|
+
*/
|
|
2723
3023
|
login(provider: string, username: string, password: string, userRealmName?: string): Promise<UserEntity>;
|
|
2724
3024
|
createSession(user: UserAccount, expiresIn: number, userRealmName?: string): Promise<{
|
|
2725
3025
|
refreshToken: string;
|
|
@@ -2810,10 +3110,21 @@ declare class SessionService {
|
|
|
2810
3110
|
//#endregion
|
|
2811
3111
|
//#region ../../src/api/users/index.d.ts
|
|
2812
3112
|
/**
|
|
2813
|
-
*
|
|
3113
|
+
* | type | quality | stability |
|
|
3114
|
+
* |------|---------|-----------|
|
|
3115
|
+
* | backend | epic | stable |
|
|
3116
|
+
*
|
|
3117
|
+
* Complete user management with multi-realm support for multi-tenant applications.
|
|
2814
3118
|
*
|
|
2815
|
-
*
|
|
2816
|
-
*
|
|
3119
|
+
* **Features:**
|
|
3120
|
+
* - User registration, login, and profile management
|
|
3121
|
+
* - Password reset workflows
|
|
3122
|
+
* - Email verification
|
|
3123
|
+
* - Session management with multiple devices
|
|
3124
|
+
* - Identity management (social logins, SSO)
|
|
3125
|
+
* - Multi-realm support for tenant isolation
|
|
3126
|
+
* - Credential management
|
|
3127
|
+
* - Entities: `users`, `identities`, `sessions`
|
|
2817
3128
|
*
|
|
2818
3129
|
* @module alepha.api.users
|
|
2819
3130
|
*/
|