alepha 0.14.2 → 0.14.4
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 +1 -1
- package/dist/api/audits/index.browser.js +5 -5
- package/dist/api/audits/index.browser.js.map +1 -1
- package/dist/api/audits/index.d.ts +706 -785
- package/dist/api/audits/index.d.ts.map +1 -1
- package/dist/api/audits/index.js +13 -13
- package/dist/api/audits/index.js.map +1 -1
- package/dist/api/files/index.browser.js +5 -5
- package/dist/api/files/index.browser.js.map +1 -1
- package/dist/api/files/index.d.ts +58 -137
- package/dist/api/files/index.d.ts.map +1 -1
- package/dist/api/files/index.js +71 -71
- package/dist/api/files/index.js.map +1 -1
- package/dist/api/jobs/index.browser.js +5 -5
- package/dist/api/jobs/index.browser.js.map +1 -1
- package/dist/api/jobs/index.d.ts +29 -108
- package/dist/api/jobs/index.d.ts.map +1 -1
- package/dist/api/jobs/index.js +10 -10
- package/dist/api/jobs/index.js.map +1 -1
- package/dist/api/notifications/index.browser.js +10 -10
- package/dist/api/notifications/index.browser.js.map +1 -1
- package/dist/api/notifications/index.d.ts +504 -171
- package/dist/api/notifications/index.d.ts.map +1 -1
- package/dist/api/notifications/index.js +12 -12
- package/dist/api/notifications/index.js.map +1 -1
- package/dist/api/parameters/index.browser.js +163 -10
- package/dist/api/parameters/index.browser.js.map +1 -1
- package/dist/api/parameters/index.d.ts +277 -351
- package/dist/api/parameters/index.d.ts.map +1 -1
- package/dist/api/parameters/index.js +196 -91
- package/dist/api/parameters/index.js.map +1 -1
- package/dist/api/users/index.browser.js +19 -19
- package/dist/api/users/index.browser.js.map +1 -1
- package/dist/api/users/index.d.ts +787 -852
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +827 -596
- package/dist/api/users/index.js.map +1 -1
- package/dist/api/verifications/index.browser.js +6 -6
- package/dist/api/verifications/index.browser.js.map +1 -1
- package/dist/api/verifications/index.d.ts +128 -128
- package/dist/api/verifications/index.d.ts.map +1 -1
- package/dist/api/verifications/index.js +6 -6
- package/dist/api/verifications/index.js.map +1 -1
- package/dist/bin/index.d.ts +1 -2
- package/dist/bin/index.js +0 -1
- package/dist/bin/index.js.map +1 -1
- package/dist/cli/index.d.ts +252 -131
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +595 -395
- package/dist/cli/index.js.map +1 -1
- package/dist/command/index.d.ts +46 -11
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +99 -19
- package/dist/command/index.js.map +1 -1
- package/dist/core/index.browser.js +40 -22
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +45 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +40 -22
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +40 -22
- package/dist/core/index.native.js.map +1 -1
- package/dist/fake/index.js +195 -168
- package/dist/fake/index.js.map +1 -1
- package/dist/file/index.d.ts +8 -0
- package/dist/file/index.d.ts.map +1 -1
- package/dist/file/index.js +3 -0
- package/dist/file/index.js.map +1 -1
- package/dist/logger/index.d.ts +1 -1
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +12 -2
- package/dist/logger/index.js.map +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/orm/index.d.ts +59 -195
- package/dist/orm/index.d.ts.map +1 -1
- package/dist/orm/index.js +201 -430
- package/dist/orm/index.js.map +1 -1
- package/dist/security/index.d.ts +1 -1
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +1 -1
- package/dist/security/index.js.map +1 -1
- package/dist/server/auth/index.d.ts +171 -155
- package/dist/server/auth/index.d.ts.map +1 -1
- package/dist/server/auth/index.js +0 -1
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/cache/index.d.ts +12 -0
- package/dist/server/cache/index.d.ts.map +1 -1
- package/dist/server/cache/index.js +55 -2
- package/dist/server/cache/index.js.map +1 -1
- package/dist/server/compress/index.d.ts +6 -0
- package/dist/server/compress/index.d.ts.map +1 -1
- package/dist/server/compress/index.js +38 -1
- package/dist/server/compress/index.js.map +1 -1
- package/dist/server/core/index.browser.js +2 -2
- package/dist/server/core/index.browser.js.map +1 -1
- package/dist/server/core/index.d.ts +10 -10
- package/dist/server/core/index.d.ts.map +1 -1
- package/dist/server/core/index.js +7 -4
- package/dist/server/core/index.js.map +1 -1
- package/dist/server/links/index.browser.js +22 -6
- package/dist/server/links/index.browser.js.map +1 -1
- package/dist/server/links/index.d.ts +46 -44
- package/dist/server/links/index.d.ts.map +1 -1
- package/dist/server/links/index.js +24 -41
- package/dist/server/links/index.js.map +1 -1
- package/dist/server/static/index.d.ts.map +1 -1
- package/dist/server/static/index.js +4 -0
- package/dist/server/static/index.js.map +1 -1
- package/dist/server/swagger/index.d.ts +2 -1
- package/dist/server/swagger/index.d.ts.map +1 -1
- package/dist/server/swagger/index.js +9 -5
- package/dist/server/swagger/index.js.map +1 -1
- package/dist/vite/index.d.ts +101 -106
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +574 -503
- package/dist/vite/index.js.map +1 -1
- package/dist/websocket/index.d.ts +7 -7
- package/package.json +7 -7
- package/src/api/audits/controllers/{AuditController.ts → AdminAuditController.ts} +5 -6
- package/src/api/audits/entities/audits.ts +5 -5
- package/src/api/audits/index.browser.ts +1 -1
- package/src/api/audits/index.ts +3 -3
- package/src/api/audits/primitives/$audit.spec.ts +276 -0
- package/src/api/audits/services/AuditService.spec.ts +495 -0
- package/src/api/files/__tests__/$bucket.spec.ts +91 -0
- package/src/api/files/controllers/AdminFileStatsController.spec.ts +166 -0
- package/src/api/files/controllers/{StorageStatsController.ts → AdminFileStatsController.ts} +2 -2
- package/src/api/files/controllers/FileController.spec.ts +558 -0
- package/src/api/files/controllers/FileController.ts +4 -5
- package/src/api/files/entities/files.ts +5 -5
- package/src/api/files/index.browser.ts +1 -1
- package/src/api/files/index.ts +4 -4
- package/src/api/files/jobs/FileJobs.spec.ts +52 -0
- package/src/api/files/services/FileService.spec.ts +109 -0
- package/src/api/jobs/__tests__/JobController.spec.ts +343 -0
- package/src/api/jobs/controllers/{JobController.ts → AdminJobController.ts} +2 -2
- package/src/api/jobs/entities/jobExecutions.ts +5 -5
- package/src/api/jobs/index.ts +3 -3
- package/src/api/jobs/primitives/$job.spec.ts +476 -0
- package/src/api/notifications/controllers/{NotificationController.ts → AdminNotificationController.ts} +4 -5
- package/src/api/notifications/entities/notifications.ts +5 -5
- package/src/api/notifications/index.browser.ts +1 -1
- package/src/api/notifications/index.ts +4 -4
- package/src/api/parameters/controllers/{ConfigController.ts → AdminConfigController.ts} +46 -107
- package/src/api/parameters/entities/parameters.ts +7 -17
- package/src/api/parameters/index.ts +3 -3
- package/src/api/parameters/primitives/$config.spec.ts +356 -0
- package/src/api/parameters/schemas/activateConfigBodySchema.ts +12 -0
- package/src/api/parameters/schemas/checkScheduledResponseSchema.ts +8 -0
- package/src/api/parameters/schemas/configCurrentResponseSchema.ts +13 -0
- package/src/api/parameters/schemas/configHistoryResponseSchema.ts +9 -0
- package/src/api/parameters/schemas/configNameParamSchema.ts +10 -0
- package/src/api/parameters/schemas/configNamesResponseSchema.ts +8 -0
- package/src/api/parameters/schemas/configTreeNodeSchema.ts +13 -0
- package/src/api/parameters/schemas/configVersionParamSchema.ts +9 -0
- package/src/api/parameters/schemas/configVersionResponseSchema.ts +9 -0
- package/src/api/parameters/schemas/configsByStatusResponseSchema.ts +9 -0
- package/src/api/parameters/schemas/createConfigVersionBodySchema.ts +24 -0
- package/src/api/parameters/schemas/index.ts +15 -0
- package/src/api/parameters/schemas/parameterResponseSchema.ts +26 -0
- package/src/api/parameters/schemas/parameterStatusSchema.ts +13 -0
- package/src/api/parameters/schemas/rollbackConfigBodySchema.ts +15 -0
- package/src/api/parameters/schemas/statusParamSchema.ts +9 -0
- package/src/api/users/__tests__/EmailVerification.spec.ts +369 -0
- package/src/api/users/__tests__/PasswordReset.spec.ts +550 -0
- package/src/api/users/controllers/AdminIdentityController.spec.ts +365 -0
- package/src/api/users/controllers/{IdentityController.ts → AdminIdentityController.ts} +3 -4
- package/src/api/users/controllers/AdminSessionController.spec.ts +274 -0
- package/src/api/users/controllers/{SessionController.ts → AdminSessionController.ts} +3 -4
- package/src/api/users/controllers/AdminUserController.spec.ts +372 -0
- package/src/api/users/controllers/AdminUserController.ts +116 -0
- package/src/api/users/controllers/UserController.ts +4 -107
- package/src/api/users/controllers/UserRealmController.ts +3 -0
- package/src/api/users/entities/identities.ts +6 -6
- package/src/api/users/entities/sessions.ts +6 -6
- package/src/api/users/entities/users.ts +9 -9
- package/src/api/users/index.ts +9 -6
- package/src/api/users/primitives/$userRealm.ts +13 -8
- package/src/api/users/services/CredentialService.spec.ts +509 -0
- package/src/api/users/services/CredentialService.ts +46 -0
- package/src/api/users/services/IdentityService.ts +15 -0
- package/src/api/users/services/RegistrationService.spec.ts +630 -0
- package/src/api/users/services/RegistrationService.ts +18 -0
- package/src/api/users/services/SessionService.spec.ts +301 -0
- package/src/api/users/services/SessionService.ts +110 -1
- package/src/api/users/services/UserService.ts +67 -2
- package/src/api/verifications/__tests__/CodeVerification.spec.ts +318 -0
- package/src/api/verifications/__tests__/LinkVerification.spec.ts +279 -0
- package/src/api/verifications/entities/verifications.ts +6 -6
- package/src/api/verifications/jobs/VerificationJobs.spec.ts +50 -0
- package/src/batch/__tests__/startup-buffering.spec.ts +458 -0
- package/src/batch/primitives/$batch.spec.ts +766 -0
- package/src/batch/providers/BatchProvider.spec.ts +786 -0
- package/src/bin/index.ts +0 -1
- package/src/bucket/__tests__/shared.ts +194 -0
- package/src/bucket/primitives/$bucket.spec.ts +104 -0
- package/src/bucket/providers/FileStorageProvider.spec.ts +13 -0
- package/src/bucket/providers/LocalFileStorageProvider.spec.ts +77 -0
- package/src/bucket/providers/MemoryFileStorageProvider.spec.ts +82 -0
- package/src/cache/core/__tests__/shared.ts +377 -0
- package/src/cache/core/primitives/$cache.spec.ts +111 -0
- package/src/cache/redis/__tests__/cache-redis.spec.ts +70 -0
- package/src/cli/apps/AlephaCli.ts +25 -6
- package/src/cli/atoms/buildOptions.ts +88 -0
- package/src/cli/commands/build.ts +32 -69
- package/src/cli/commands/db.ts +0 -4
- package/src/cli/commands/dev.ts +34 -10
- package/src/cli/commands/gen/changelog.spec.ts +315 -0
- package/src/cli/commands/{changelog.ts → gen/changelog.ts} +9 -9
- package/src/cli/commands/gen/env.ts +53 -0
- package/src/cli/commands/gen/openapi.ts +71 -0
- package/src/cli/commands/gen/resource.ts +15 -0
- package/src/cli/commands/gen.ts +24 -0
- package/src/cli/commands/init.ts +2 -1
- package/src/cli/commands/root.ts +12 -3
- package/src/cli/commands/test.ts +0 -1
- package/src/cli/commands/typecheck.ts +5 -0
- package/src/cli/commands/verify.ts +1 -1
- package/src/cli/defineConfig.ts +49 -7
- package/src/cli/index.ts +2 -2
- package/src/cli/services/AlephaCliUtils.ts +105 -55
- package/src/cli/services/GitMessageParser.ts +1 -1
- package/src/command/helpers/Asker.spec.ts +127 -0
- package/src/command/helpers/Runner.spec.ts +126 -0
- package/src/command/helpers/Runner.ts +1 -1
- package/src/command/primitives/$command.spec.ts +1588 -0
- package/src/command/primitives/$command.ts +0 -6
- package/src/command/providers/CliProvider.ts +75 -27
- package/src/core/Alepha.ts +87 -0
- package/src/core/__tests__/Alepha-emit.spec.ts +22 -0
- package/src/core/__tests__/Alepha-graph.spec.ts +93 -0
- package/src/core/__tests__/Alepha-has.spec.ts +41 -0
- package/src/core/__tests__/Alepha-inject.spec.ts +93 -0
- package/src/core/__tests__/Alepha-register.spec.ts +81 -0
- package/src/core/__tests__/Alepha-start.spec.ts +176 -0
- package/src/core/__tests__/Alepha-with.spec.ts +14 -0
- package/src/core/__tests__/TypeBox-usecases.spec.ts +35 -0
- package/src/core/__tests__/TypeBoxLocale.spec.ts +15 -0
- package/src/core/__tests__/descriptor.spec.ts +34 -0
- package/src/core/__tests__/fixtures/A.ts +5 -0
- package/src/core/__tests__/pagination.spec.ts +77 -0
- package/src/core/helpers/jsonSchemaToTypeBox.ts +2 -2
- package/src/core/primitives/$atom.spec.ts +43 -0
- package/src/core/primitives/$hook.spec.ts +130 -0
- package/src/core/primitives/$inject.spec.ts +175 -0
- package/src/core/primitives/$module.spec.ts +115 -0
- package/src/core/providers/CodecManager.spec.ts +740 -0
- package/src/core/providers/EventManager.spec.ts +762 -0
- package/src/core/providers/EventManager.ts +4 -0
- package/src/core/providers/StateManager.spec.ts +365 -0
- package/src/core/providers/TypeProvider.spec.ts +1607 -0
- package/src/core/providers/TypeProvider.ts +20 -26
- package/src/datetime/primitives/$interval.spec.ts +103 -0
- package/src/datetime/providers/DateTimeProvider.spec.ts +86 -0
- package/src/email/primitives/$email.spec.ts +175 -0
- package/src/email/providers/LocalEmailProvider.spec.ts +341 -0
- package/src/fake/__tests__/keyName.example.ts +40 -0
- package/src/fake/__tests__/keyName.spec.ts +152 -0
- package/src/fake/__tests__/module.example.ts +32 -0
- package/src/fake/providers/FakeProvider.spec.ts +438 -0
- package/src/file/providers/FileSystemProvider.ts +8 -0
- package/src/file/providers/NodeFileSystemProvider.spec.ts +418 -0
- package/src/file/providers/NodeFileSystemProvider.ts +5 -0
- package/src/file/services/FileDetector.spec.ts +591 -0
- package/src/lock/core/__tests__/shared.ts +190 -0
- package/src/lock/core/providers/MemoryLockProvider.spec.ts +25 -0
- package/src/lock/redis/providers/RedisLockProvider.spec.ts +25 -0
- package/src/logger/__tests__/SimpleFormatterProvider.spec.ts +109 -0
- package/src/logger/index.ts +15 -3
- package/src/logger/primitives/$logger.spec.ts +108 -0
- package/src/logger/services/Logger.spec.ts +295 -0
- package/src/mcp/__tests__/errors.spec.ts +175 -0
- package/src/mcp/__tests__/integration.spec.ts +450 -0
- package/src/mcp/helpers/jsonrpc.spec.ts +380 -0
- package/src/mcp/primitives/$prompt.spec.ts +468 -0
- package/src/mcp/primitives/$resource.spec.ts +390 -0
- package/src/mcp/primitives/$tool.spec.ts +406 -0
- package/src/mcp/providers/McpServerProvider.spec.ts +797 -0
- package/src/mcp/transports/StdioMcpTransport.ts +1 -1
- package/src/orm/__tests__/$repository-crud.spec.ts +276 -0
- package/src/orm/__tests__/$repository-hooks.spec.ts +325 -0
- package/src/orm/__tests__/$repository-orderBy.spec.ts +128 -0
- package/src/orm/__tests__/$repository-pagination-sort.spec.ts +149 -0
- package/src/orm/__tests__/$repository-save.spec.ts +37 -0
- package/src/orm/__tests__/ModelBuilder-integration.spec.ts +490 -0
- package/src/orm/__tests__/ModelBuilder-types.spec.ts +186 -0
- package/src/orm/__tests__/PostgresProvider.spec.ts +46 -0
- package/src/orm/__tests__/delete-returning.spec.ts +256 -0
- package/src/orm/__tests__/deletedAt.spec.ts +80 -0
- package/src/orm/__tests__/enums.spec.ts +315 -0
- package/src/orm/__tests__/execute.spec.ts +72 -0
- package/src/orm/__tests__/fixtures/bigEntitySchema.ts +65 -0
- package/src/orm/__tests__/fixtures/userEntitySchema.ts +27 -0
- package/src/orm/__tests__/joins.spec.ts +1114 -0
- package/src/orm/__tests__/page.spec.ts +287 -0
- package/src/orm/__tests__/primaryKey.spec.ts +87 -0
- package/src/orm/__tests__/query-date-encoding.spec.ts +402 -0
- package/src/orm/__tests__/ref-auto-onDelete.spec.ts +156 -0
- package/src/orm/__tests__/references.spec.ts +102 -0
- package/src/orm/__tests__/security.spec.ts +710 -0
- package/src/orm/__tests__/sqlite.spec.ts +111 -0
- package/src/orm/__tests__/string-operators.spec.ts +429 -0
- package/src/orm/__tests__/timestamps.spec.ts +388 -0
- package/src/orm/__tests__/validation.spec.ts +183 -0
- package/src/orm/__tests__/version.spec.ts +64 -0
- package/src/orm/helpers/parseQueryString.spec.ts +196 -0
- package/src/orm/index.ts +2 -8
- package/src/orm/primitives/$repository.spec.ts +137 -0
- package/src/orm/primitives/$sequence.spec.ts +29 -0
- package/src/orm/primitives/$transaction.spec.ts +82 -0
- package/src/orm/providers/drivers/BunPostgresProvider.ts +3 -3
- package/src/orm/providers/drivers/BunSqliteProvider.ts +1 -1
- package/src/orm/providers/drivers/CloudflareD1Provider.ts +1 -1
- package/src/orm/providers/drivers/DatabaseProvider.ts +1 -1
- package/src/orm/providers/drivers/NodePostgresProvider.ts +3 -3
- package/src/orm/providers/drivers/NodeSqliteProvider.ts +1 -1
- package/src/orm/providers/drivers/PglitePostgresProvider.ts +2 -2
- package/src/orm/services/ModelBuilder.spec.ts +575 -0
- package/src/orm/services/Repository.spec.ts +137 -0
- package/src/queue/core/__tests__/shared.ts +143 -0
- package/src/queue/core/providers/MemoryQueueProvider.spec.ts +23 -0
- package/src/queue/core/providers/WorkerProvider.spec.ts +394 -0
- package/src/queue/redis/providers/RedisQueueProvider.spec.ts +23 -0
- package/src/redis/__tests__/redis.spec.ts +58 -0
- package/src/retry/primitives/$retry.spec.ts +234 -0
- package/src/retry/providers/RetryProvider.spec.ts +438 -0
- package/src/router/__tests__/match.spec.ts +252 -0
- package/src/router/providers/RouterProvider.spec.ts +197 -0
- package/src/scheduler/__tests__/$scheduler-cron.spec.ts +25 -0
- package/src/scheduler/__tests__/$scheduler-interval.spec.ts +25 -0
- package/src/scheduler/__tests__/shared.ts +77 -0
- package/src/security/__tests__/bug-1-wildcard-after-start.spec.ts +229 -0
- package/src/security/__tests__/bug-2-password-validation.spec.ts +245 -0
- package/src/security/__tests__/bug-3-regex-vulnerability.spec.ts +407 -0
- package/src/security/__tests__/bug-4-oauth2-validation.spec.ts +439 -0
- package/src/security/__tests__/multi-layer-permissions.spec.ts +522 -0
- package/src/security/primitives/$permission.spec.ts +30 -0
- package/src/security/primitives/$permission.ts +2 -2
- package/src/security/primitives/$realm.spec.ts +101 -0
- package/src/security/primitives/$role.spec.ts +52 -0
- package/src/security/primitives/$serviceAccount.spec.ts +61 -0
- package/src/security/providers/SecurityProvider.spec.ts +350 -0
- package/src/server/auth/providers/ServerAuthProvider.ts +0 -2
- package/src/server/cache/providers/ServerCacheProvider.spec.ts +1125 -0
- package/src/server/cache/providers/ServerCacheProvider.ts +94 -9
- package/src/server/compress/providers/ServerCompressProvider.spec.ts +31 -0
- package/src/server/compress/providers/ServerCompressProvider.ts +63 -2
- package/src/server/cookies/providers/ServerCookiesProvider.spec.ts +253 -0
- package/src/server/core/__tests__/ServerRouterProvider-getRoutes.spec.ts +334 -0
- package/src/server/core/__tests__/ServerRouterProvider-requestId.spec.ts +129 -0
- package/src/server/core/helpers/ServerReply.ts +2 -2
- package/src/server/core/primitives/$action.spec.ts +191 -0
- package/src/server/core/primitives/$route.spec.ts +65 -0
- package/src/server/core/providers/ServerBodyParserProvider.spec.ts +93 -0
- package/src/server/core/providers/ServerLoggerProvider.spec.ts +100 -0
- package/src/server/core/providers/ServerProvider.ts +14 -2
- package/src/server/core/services/HttpClient.spec.ts +123 -0
- package/src/server/core/services/UserAgentParser.spec.ts +111 -0
- package/src/server/cors/providers/ServerCorsProvider.spec.ts +481 -0
- package/src/server/health/providers/ServerHealthProvider.spec.ts +22 -0
- package/src/server/helmet/providers/ServerHelmetProvider.spec.ts +105 -0
- package/src/server/links/__tests__/$action.spec.ts +238 -0
- package/src/server/links/__tests__/fixtures/CrudApp.ts +122 -0
- package/src/server/links/__tests__/requestId.spec.ts +120 -0
- package/src/server/links/primitives/$remote.spec.ts +228 -0
- package/src/server/links/providers/LinkProvider.spec.ts +54 -0
- package/src/server/links/providers/LinkProvider.ts +49 -3
- package/src/server/links/providers/ServerLinksProvider.ts +1 -53
- package/src/server/links/schemas/apiLinksResponseSchema.ts +7 -0
- package/src/server/metrics/providers/ServerMetricsProvider.spec.ts +25 -0
- package/src/server/multipart/providers/ServerMultipartProvider.spec.ts +528 -0
- package/src/server/proxy/primitives/$proxy.spec.ts +87 -0
- package/src/server/rate-limit/__tests__/ActionRateLimit.spec.ts +211 -0
- package/src/server/rate-limit/providers/ServerRateLimitProvider.spec.ts +344 -0
- package/src/server/security/__tests__/BasicAuth.spec.ts +684 -0
- package/src/server/security/__tests__/ServerSecurityProvider-realm.spec.ts +388 -0
- package/src/server/security/providers/ServerSecurityProvider.spec.ts +123 -0
- package/src/server/static/primitives/$serve.spec.ts +193 -0
- package/src/server/static/providers/ServerStaticProvider.ts +10 -0
- package/src/server/swagger/__tests__/ui.spec.ts +52 -0
- package/src/server/swagger/primitives/$swagger.spec.ts +193 -0
- package/src/server/swagger/providers/ServerSwaggerProvider.ts +19 -12
- package/src/sms/primitives/$sms.spec.ts +165 -0
- package/src/sms/providers/LocalSmsProvider.spec.ts +224 -0
- package/src/sms/providers/MemorySmsProvider.spec.ts +193 -0
- package/src/thread/primitives/$thread.spec.ts +186 -0
- package/src/topic/core/__tests__/shared.ts +144 -0
- package/src/topic/core/providers/MemoryTopicProvider.spec.ts +23 -0
- package/src/topic/redis/providers/RedisTopicProvider.spec.ts +23 -0
- package/src/vite/helpers/importViteReact.ts +13 -0
- package/src/vite/index.ts +1 -21
- package/src/vite/plugins/viteAlephaDev.ts +32 -5
- package/src/vite/plugins/viteAlephaSsrPreload.ts +222 -0
- package/src/vite/tasks/buildClient.ts +11 -0
- package/src/vite/tasks/buildServer.ts +47 -3
- package/src/vite/tasks/devServer.ts +69 -0
- package/src/vite/tasks/index.ts +2 -1
- package/src/vite/tasks/runAlepha.ts +7 -1
- package/src/websocket/__tests__/$websocket-new.spec.ts +195 -0
- package/src/websocket/primitives/$channel.spec.ts +30 -0
- package/src/cli/assets/viteConfigTs.ts +0 -14
- package/src/cli/commands/run.ts +0 -24
- package/src/vite/plugins/viteAlepha.ts +0 -37
- package/src/vite/plugins/viteAlephaBuild.ts +0 -281
|
@@ -1,245 +1,566 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as alepha587 from "alepha";
|
|
2
2
|
import { Alepha, KIND, Primitive, Static, TNull, TObject, TOptional, TSchema, TUnion } from "alepha";
|
|
3
|
-
import * as alepha_orm71 from "alepha/orm";
|
|
4
|
-
import { Page } from "alepha/orm";
|
|
5
3
|
import * as alepha_server0 from "alepha/server";
|
|
6
4
|
import { ServerRequest } from "alepha/server";
|
|
5
|
+
import * as alepha_orm12 from "alepha/orm";
|
|
6
|
+
import { Page } from "alepha/orm";
|
|
7
7
|
import * as alepha_logger0 from "alepha/logger";
|
|
8
|
-
import "bun";
|
|
9
|
-
import "bun:sqlite";
|
|
10
|
-
import "drizzle-orm/bun-sql";
|
|
11
|
-
import "drizzle-orm/bun-sqlite";
|
|
12
8
|
import "drizzle-orm/d1";
|
|
13
9
|
import { BuildExtraConfigColumns, SQL } from "drizzle-orm";
|
|
14
10
|
import { PgColumnBuilderBase, PgSequenceOptions, PgTableExtraConfigValue, UpdateDeleteAction } from "drizzle-orm/pg-core";
|
|
15
11
|
import "alepha/datetime";
|
|
16
12
|
import "alepha/retry";
|
|
17
|
-
import "alepha/lock";
|
|
18
13
|
import "drizzle-orm/sqlite-core";
|
|
14
|
+
import "alepha/lock";
|
|
19
15
|
import "drizzle-orm/postgres-js";
|
|
20
16
|
import "postgres";
|
|
21
17
|
|
|
22
|
-
//#region ../../src/
|
|
18
|
+
//#region ../../src/orm/schemas/insertSchema.d.ts
|
|
23
19
|
/**
|
|
24
|
-
*
|
|
20
|
+
* Transforms a TObject schema for insert operations.
|
|
21
|
+
* All default properties at the root level are made optional.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* Before: { name: string; age: number(default=0); }
|
|
25
|
+
* After: { name: string; age?: number; }
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
type TObjectInsert<T extends TObject> = TObject<{ [K in keyof T["properties"]]: T["properties"][K] extends {
|
|
28
|
+
[PG_DEFAULT]: any;
|
|
29
|
+
} | {
|
|
30
|
+
"~optional": true;
|
|
31
|
+
} ? TOptional<T["properties"][K]> : T["properties"][K] }>;
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region ../../src/orm/schemas/updateSchema.d.ts
|
|
28
34
|
/**
|
|
29
|
-
*
|
|
35
|
+
* Transforms a TObject schema for update operations.
|
|
36
|
+
* All optional properties at the root level are made nullable (i.e., `T | null`).
|
|
37
|
+
* This allows an API endpoint to explicitly accept `null` to clear an optional field in the database.
|
|
30
38
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* - When it happened (createdAt)
|
|
35
|
-
* - Context and details (metadata, ipAddress, userAgent)
|
|
39
|
+
* @example
|
|
40
|
+
* Before: { name?: string; age: number; }
|
|
41
|
+
* After: { name?: string | null; age: number; }
|
|
36
42
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
* Audit event type (e.g., "auth", "user", "payment", "system").
|
|
42
|
-
* Used for categorizing and filtering audit events.
|
|
43
|
-
*/
|
|
44
|
-
type: alepha349.TString;
|
|
45
|
-
/**
|
|
46
|
-
* Specific action performed (e.g., "login", "logout", "create", "update", "delete").
|
|
47
|
-
*/
|
|
48
|
-
action: alepha349.TString;
|
|
49
|
-
/**
|
|
50
|
-
* Severity level of the event.
|
|
51
|
-
*/
|
|
52
|
-
severity: alepha_orm71.PgAttr<alepha349.TUnsafe<"info" | "warning" | "critical">, typeof alepha_orm71.PG_DEFAULT>;
|
|
53
|
-
/**
|
|
54
|
-
* User ID who performed the action (null for system events).
|
|
55
|
-
*/
|
|
56
|
-
userId: alepha349.TOptional<alepha349.TString>;
|
|
57
|
-
/**
|
|
58
|
-
* User realm for multi-tenant support.
|
|
59
|
-
*/
|
|
60
|
-
userRealm: alepha349.TOptional<alepha349.TString>;
|
|
61
|
-
/**
|
|
62
|
-
* User email at the time of the event (denormalized for history).
|
|
63
|
-
*/
|
|
64
|
-
userEmail: alepha349.TOptional<alepha349.TString>;
|
|
65
|
-
/**
|
|
66
|
-
* Resource type affected (e.g., "user", "order", "file").
|
|
67
|
-
*/
|
|
68
|
-
resourceType: alepha349.TOptional<alepha349.TString>;
|
|
43
|
+
type TObjectUpdate<T extends TObject> = TObject<{ [K in keyof T["properties"]]: T["properties"][K] extends TOptional<infer U> ? TOptional<TUnion<[U, TNull]>> : T["properties"][K] }>;
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region ../../src/orm/primitives/$entity.d.ts
|
|
46
|
+
interface EntityPrimitiveOptions<T extends TObject, Keys = keyof Static<T>> {
|
|
69
47
|
/**
|
|
70
|
-
*
|
|
48
|
+
* The database table name that will be created for this entity.
|
|
49
|
+
* If not provided, name will be inferred from the $repository variable name.
|
|
71
50
|
*/
|
|
72
|
-
|
|
51
|
+
name: string;
|
|
73
52
|
/**
|
|
74
|
-
*
|
|
53
|
+
* TypeBox schema defining the table structure and column types.
|
|
75
54
|
*/
|
|
76
|
-
|
|
55
|
+
schema: T;
|
|
77
56
|
/**
|
|
78
|
-
*
|
|
57
|
+
* Database indexes to create for query optimization.
|
|
79
58
|
*/
|
|
80
|
-
|
|
59
|
+
indexes?: (Keys | {
|
|
60
|
+
/**
|
|
61
|
+
* Single column to index.
|
|
62
|
+
*/
|
|
63
|
+
column: Keys;
|
|
64
|
+
/**
|
|
65
|
+
* Whether this should be a unique index (enforces uniqueness constraint).
|
|
66
|
+
*/
|
|
67
|
+
unique?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Custom name for the index. If not provided, generates name automatically.
|
|
70
|
+
*/
|
|
71
|
+
name?: string;
|
|
72
|
+
} | {
|
|
73
|
+
/**
|
|
74
|
+
* Multiple columns for composite index (order matters for query optimization).
|
|
75
|
+
*/
|
|
76
|
+
columns: Keys[];
|
|
77
|
+
/**
|
|
78
|
+
* Whether this should be a unique index (enforces uniqueness constraint).
|
|
79
|
+
*/
|
|
80
|
+
unique?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Custom name for the index. If not provided, generates name automatically.
|
|
83
|
+
*/
|
|
84
|
+
name?: string;
|
|
85
|
+
})[];
|
|
81
86
|
/**
|
|
82
|
-
*
|
|
87
|
+
* Foreign key constraints to maintain referential integrity.
|
|
83
88
|
*/
|
|
84
|
-
|
|
89
|
+
foreignKeys?: Array<{
|
|
90
|
+
/**
|
|
91
|
+
* Optional name for the foreign key constraint.
|
|
92
|
+
*/
|
|
93
|
+
name?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Local columns that reference the foreign table.
|
|
96
|
+
*/
|
|
97
|
+
columns: Array<keyof Static<T>>;
|
|
98
|
+
/**
|
|
99
|
+
* Referenced columns in the foreign table.
|
|
100
|
+
* Must be EntityColumn references from other entities.
|
|
101
|
+
*/
|
|
102
|
+
foreignColumns: Array<() => EntityColumn<any>>;
|
|
103
|
+
}>;
|
|
85
104
|
/**
|
|
86
|
-
*
|
|
105
|
+
* Additional table constraints for data validation.
|
|
106
|
+
*
|
|
107
|
+
* Constraints enforce business rules at the database level, providing
|
|
108
|
+
* an additional layer of data integrity beyond application validation.
|
|
109
|
+
*
|
|
110
|
+
* **Constraint Types**:
|
|
111
|
+
* - **Unique constraints**: Prevent duplicate values across columns
|
|
112
|
+
* - **Check constraints**: Enforce custom validation rules with SQL expressions
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* constraints: [
|
|
117
|
+
* {
|
|
118
|
+
* name: "unique_user_email",
|
|
119
|
+
* columns: ["email"],
|
|
120
|
+
* unique: true
|
|
121
|
+
* },
|
|
122
|
+
* {
|
|
123
|
+
* name: "valid_age_range",
|
|
124
|
+
* columns: ["age"],
|
|
125
|
+
* check: sql`age >= 0 AND age <= 150`
|
|
126
|
+
* },
|
|
127
|
+
* {
|
|
128
|
+
* name: "unique_user_username_per_tenant",
|
|
129
|
+
* columns: ["tenantId", "username"],
|
|
130
|
+
* unique: true
|
|
131
|
+
* }
|
|
132
|
+
* ]
|
|
133
|
+
* ```
|
|
87
134
|
*/
|
|
88
|
-
|
|
135
|
+
constraints?: Array<{
|
|
136
|
+
/**
|
|
137
|
+
* Columns involved in this constraint.
|
|
138
|
+
*/
|
|
139
|
+
columns: Array<keyof Static<T>>;
|
|
140
|
+
/**
|
|
141
|
+
* Optional name for the constraint.
|
|
142
|
+
*/
|
|
143
|
+
name?: string;
|
|
144
|
+
/**
|
|
145
|
+
* Whether this is a unique constraint.
|
|
146
|
+
*/
|
|
147
|
+
unique?: boolean | {};
|
|
148
|
+
/**
|
|
149
|
+
* SQL expression for check constraint validation.
|
|
150
|
+
*/
|
|
151
|
+
check?: SQL;
|
|
152
|
+
}>;
|
|
89
153
|
/**
|
|
90
|
-
*
|
|
154
|
+
* Advanced Drizzle ORM configuration for complex table setups.
|
|
91
155
|
*/
|
|
92
|
-
|
|
156
|
+
config?: (self: BuildExtraConfigColumns<string, FromSchema<T>, "pg">) => PgTableExtraConfigValue[];
|
|
157
|
+
}
|
|
158
|
+
declare class EntityPrimitive<T extends TObject = TObject> {
|
|
159
|
+
readonly options: EntityPrimitiveOptions<T>;
|
|
160
|
+
constructor(options: EntityPrimitiveOptions<T>);
|
|
161
|
+
alias(alias: string): this;
|
|
162
|
+
get cols(): EntityColumns<T>;
|
|
163
|
+
get name(): string;
|
|
164
|
+
get schema(): T;
|
|
165
|
+
get insertSchema(): TObjectInsert<T>;
|
|
166
|
+
get updateSchema(): TObjectUpdate<T>;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Convert a schema to columns.
|
|
170
|
+
*/
|
|
171
|
+
type FromSchema<T extends TObject> = { [key in keyof T["properties"]]: PgColumnBuilderBase };
|
|
172
|
+
type EntityColumn<T extends TObject> = {
|
|
173
|
+
name: string;
|
|
174
|
+
entity: EntityPrimitive<T>;
|
|
175
|
+
};
|
|
176
|
+
type EntityColumns<T extends TObject> = { [key in keyof T["properties"]]: EntityColumn<T> };
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region ../../src/orm/constants/PG_SYMBOLS.d.ts
|
|
179
|
+
declare const PG_DEFAULT: unique symbol;
|
|
180
|
+
declare const PG_PRIMARY_KEY: unique symbol;
|
|
181
|
+
declare const PG_CREATED_AT: unique symbol;
|
|
182
|
+
declare const PG_UPDATED_AT: unique symbol;
|
|
183
|
+
declare const PG_DELETED_AT: unique symbol;
|
|
184
|
+
declare const PG_VERSION: unique symbol;
|
|
185
|
+
declare const PG_IDENTITY: unique symbol;
|
|
186
|
+
declare const PG_ENUM: unique symbol;
|
|
187
|
+
declare const PG_REF: unique symbol;
|
|
188
|
+
/**
|
|
189
|
+
* @deprecated Use `PG_IDENTITY` instead.
|
|
190
|
+
*/
|
|
191
|
+
declare const PG_SERIAL: unique symbol;
|
|
192
|
+
type PgSymbols = {
|
|
193
|
+
[PG_DEFAULT]: {};
|
|
194
|
+
[PG_PRIMARY_KEY]: {};
|
|
195
|
+
[PG_CREATED_AT]: {};
|
|
196
|
+
[PG_UPDATED_AT]: {};
|
|
197
|
+
[PG_DELETED_AT]: {};
|
|
198
|
+
[PG_VERSION]: {};
|
|
199
|
+
[PG_IDENTITY]: PgIdentityOptions;
|
|
200
|
+
[PG_REF]: PgRefOptions;
|
|
201
|
+
[PG_ENUM]: PgEnumOptions;
|
|
93
202
|
/**
|
|
94
|
-
*
|
|
203
|
+
* @deprecated Use `PG_IDENTITY` instead.
|
|
95
204
|
*/
|
|
96
|
-
|
|
205
|
+
[PG_SERIAL]: {};
|
|
206
|
+
};
|
|
207
|
+
type PgSymbolKeys = keyof PgSymbols;
|
|
208
|
+
type PgIdentityOptions = {
|
|
209
|
+
mode: "always" | "byDefault";
|
|
210
|
+
} & PgSequenceOptions & {
|
|
211
|
+
name?: string;
|
|
212
|
+
};
|
|
213
|
+
interface PgEnumOptions {
|
|
214
|
+
name?: string;
|
|
215
|
+
description?: string;
|
|
216
|
+
}
|
|
217
|
+
interface PgRefOptions {
|
|
218
|
+
ref: () => {
|
|
219
|
+
name: string;
|
|
220
|
+
entity: EntityPrimitive;
|
|
221
|
+
};
|
|
222
|
+
actions?: {
|
|
223
|
+
onUpdate?: UpdateDeleteAction;
|
|
224
|
+
onDelete?: UpdateDeleteAction;
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region ../../src/orm/helpers/pgAttr.d.ts
|
|
229
|
+
/**
|
|
230
|
+
* Type representation.
|
|
231
|
+
*/
|
|
232
|
+
type PgAttr<T extends TSchema, TAttr extends PgSymbolKeys> = T & { [K in TAttr]: PgSymbols[K] };
|
|
233
|
+
//#endregion
|
|
234
|
+
//#region ../../src/orm/providers/drivers/NodePostgresProvider.d.ts
|
|
235
|
+
declare module "alepha" {
|
|
236
|
+
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
237
|
+
}
|
|
238
|
+
declare const envSchema: alepha587.TObject<{
|
|
97
239
|
/**
|
|
98
|
-
*
|
|
240
|
+
* Main configuration for database connection.
|
|
241
|
+
* Accept a string in the format of a Postgres connection URL.
|
|
242
|
+
* Example: postgres://user:password@localhost:5432/database
|
|
243
|
+
* or
|
|
244
|
+
* Example: postgres://user:password@localhost:5432/database?sslmode=require
|
|
99
245
|
*/
|
|
100
|
-
|
|
246
|
+
DATABASE_URL: alepha587.TOptional<alepha587.TString>;
|
|
101
247
|
/**
|
|
102
|
-
*
|
|
248
|
+
* In addition to the DATABASE_URL, you can specify the postgres schema name.
|
|
249
|
+
*
|
|
250
|
+
* It will monkey patch drizzle tables.
|
|
103
251
|
*/
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
252
|
+
POSTGRES_SCHEMA: alepha587.TOptional<alepha587.TString>;
|
|
253
|
+
}>;
|
|
254
|
+
//#endregion
|
|
255
|
+
//#region ../../src/orm/providers/drivers/NodeSqliteProvider.d.ts
|
|
256
|
+
/**
|
|
257
|
+
* Configuration options for the Node.js SQLite database provider.
|
|
258
|
+
*/
|
|
259
|
+
declare const nodeSqliteOptions: alepha587.Atom<alepha587.TObject<{
|
|
260
|
+
path: alepha587.TOptional<alepha587.TString>;
|
|
261
|
+
}>, "alepha.postgres.node-sqlite.options">;
|
|
262
|
+
type NodeSqliteProviderOptions = Static<typeof nodeSqliteOptions.schema>;
|
|
263
|
+
declare module "alepha" {
|
|
264
|
+
interface State {
|
|
265
|
+
[nodeSqliteOptions.key]: NodeSqliteProviderOptions;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Add a fake support for SQLite in Node.js based on Postgres interfaces.
|
|
270
|
+
*
|
|
271
|
+
* This is NOT a real SQLite provider, it's a workaround to use SQLite with Drizzle ORM.
|
|
272
|
+
* This is NOT recommended for production use.
|
|
273
|
+
*/
|
|
274
|
+
//#endregion
|
|
275
|
+
//#region ../../src/orm/index.d.ts
|
|
276
|
+
declare module "alepha" {
|
|
277
|
+
interface Hooks {
|
|
278
|
+
/**
|
|
279
|
+
* Fires before creating an entity in the repository.
|
|
280
|
+
*/
|
|
281
|
+
"repository:create:before": {
|
|
282
|
+
tableName: string;
|
|
283
|
+
data: any;
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* Fires after creating an entity in the repository.
|
|
287
|
+
*/
|
|
288
|
+
"repository:create:after": {
|
|
289
|
+
tableName: string;
|
|
290
|
+
data: any;
|
|
291
|
+
entity: any;
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* Fires before updating entities in the repository.
|
|
295
|
+
*/
|
|
296
|
+
"repository:update:before": {
|
|
297
|
+
tableName: string;
|
|
298
|
+
where: any;
|
|
299
|
+
data: any;
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* Fires after updating entities in the repository.
|
|
303
|
+
*/
|
|
304
|
+
"repository:update:after": {
|
|
305
|
+
tableName: string;
|
|
306
|
+
where: any;
|
|
307
|
+
data: any;
|
|
308
|
+
entities: any[];
|
|
309
|
+
};
|
|
310
|
+
/**
|
|
311
|
+
* Fires before deleting entities from the repository.
|
|
312
|
+
*/
|
|
313
|
+
"repository:delete:before": {
|
|
314
|
+
tableName: string;
|
|
315
|
+
where: any;
|
|
316
|
+
};
|
|
317
|
+
/**
|
|
318
|
+
* Fires after deleting entities from the repository.
|
|
319
|
+
*/
|
|
320
|
+
"repository:delete:after": {
|
|
321
|
+
tableName: string;
|
|
322
|
+
where: any;
|
|
323
|
+
ids: Array<string | number>;
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* Fires before reading entities from the repository.
|
|
327
|
+
*/
|
|
328
|
+
"repository:read:before": {
|
|
329
|
+
tableName: string;
|
|
330
|
+
query: any;
|
|
331
|
+
};
|
|
332
|
+
/**
|
|
333
|
+
* Fires after reading entities from the repository.
|
|
334
|
+
*/
|
|
335
|
+
"repository:read:after": {
|
|
336
|
+
tableName: string;
|
|
337
|
+
query: any;
|
|
338
|
+
entities: any[];
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
//#endregion
|
|
343
|
+
//#region ../../src/api/audits/entities/audits.d.ts
|
|
344
|
+
/**
|
|
345
|
+
* Audit severity levels for categorizing events.
|
|
346
|
+
*/
|
|
347
|
+
declare const auditSeveritySchema: alepha587.TUnsafe<"info" | "warning" | "critical">;
|
|
348
|
+
type AuditSeverity = Static<typeof auditSeveritySchema>;
|
|
349
|
+
/**
|
|
350
|
+
* Audit log entity for tracking important system events.
|
|
351
|
+
*
|
|
352
|
+
* Stores comprehensive audit information including:
|
|
353
|
+
* - Who performed the action (userId, userRealm)
|
|
354
|
+
* - What happened (type, action, resource)
|
|
355
|
+
* - When it happened (createdAt)
|
|
356
|
+
* - Context and details (metadata, ipAddress, userAgent)
|
|
357
|
+
*/
|
|
358
|
+
declare const audits: alepha_orm12.EntityPrimitive<alepha587.TObject<{
|
|
359
|
+
id: alepha_orm12.PgAttr<alepha_orm12.PgAttr<alepha587.TString, typeof alepha_orm12.PG_PRIMARY_KEY>, typeof alepha_orm12.PG_DEFAULT>;
|
|
360
|
+
createdAt: alepha_orm12.PgAttr<alepha_orm12.PgAttr<alepha587.TString, typeof alepha_orm12.PG_CREATED_AT>, typeof alepha_orm12.PG_DEFAULT>;
|
|
361
|
+
/**
|
|
362
|
+
* Audit event type (e.g., "auth", "user", "payment", "system").
|
|
363
|
+
* Used for categorizing and filtering audit events.
|
|
364
|
+
*/
|
|
365
|
+
type: alepha587.TString;
|
|
366
|
+
/**
|
|
367
|
+
* Specific action performed (e.g., "login", "logout", "create", "update", "delete").
|
|
368
|
+
*/
|
|
369
|
+
action: alepha587.TString;
|
|
370
|
+
/**
|
|
371
|
+
* Severity level of the event.
|
|
372
|
+
*/
|
|
373
|
+
severity: alepha_orm12.PgAttr<alepha587.TUnsafe<"info" | "warning" | "critical">, typeof alepha_orm12.PG_DEFAULT>;
|
|
374
|
+
/**
|
|
375
|
+
* User ID who performed the action (null for system events).
|
|
376
|
+
*/
|
|
377
|
+
userId: alepha587.TOptional<alepha587.TString>;
|
|
378
|
+
/**
|
|
379
|
+
* User realm for multi-tenant support.
|
|
380
|
+
*/
|
|
381
|
+
userRealm: alepha587.TOptional<alepha587.TString>;
|
|
382
|
+
/**
|
|
383
|
+
* User email at the time of the event (denormalized for history).
|
|
384
|
+
*/
|
|
385
|
+
userEmail: alepha587.TOptional<alepha587.TString>;
|
|
386
|
+
/**
|
|
387
|
+
* Resource type affected (e.g., "user", "order", "file").
|
|
388
|
+
*/
|
|
389
|
+
resourceType: alepha587.TOptional<alepha587.TString>;
|
|
390
|
+
/**
|
|
391
|
+
* Resource ID affected.
|
|
392
|
+
*/
|
|
393
|
+
resourceId: alepha587.TOptional<alepha587.TString>;
|
|
394
|
+
/**
|
|
395
|
+
* Human-readable description of the event.
|
|
396
|
+
*/
|
|
397
|
+
description: alepha587.TOptional<alepha587.TString>;
|
|
398
|
+
/**
|
|
399
|
+
* Additional metadata/context as JSON.
|
|
400
|
+
*/
|
|
401
|
+
metadata: alepha587.TOptional<alepha587.TRecord<string, alepha587.TAny>>;
|
|
402
|
+
/**
|
|
403
|
+
* Client IP address.
|
|
404
|
+
*/
|
|
405
|
+
ipAddress: alepha587.TOptional<alepha587.TString>;
|
|
406
|
+
/**
|
|
407
|
+
* Client user agent.
|
|
408
|
+
*/
|
|
409
|
+
userAgent: alepha587.TOptional<alepha587.TString>;
|
|
410
|
+
/**
|
|
411
|
+
* Session ID if applicable.
|
|
412
|
+
*/
|
|
413
|
+
sessionId: alepha587.TOptional<alepha587.TString>;
|
|
414
|
+
/**
|
|
415
|
+
* Request ID for correlation.
|
|
416
|
+
*/
|
|
417
|
+
requestId: alepha587.TOptional<alepha587.TString>;
|
|
418
|
+
/**
|
|
419
|
+
* Whether the action was successful.
|
|
420
|
+
*/
|
|
421
|
+
success: alepha_orm12.PgAttr<alepha587.TBoolean, typeof alepha_orm12.PG_DEFAULT>;
|
|
422
|
+
/**
|
|
423
|
+
* Error message if the action failed.
|
|
424
|
+
*/
|
|
425
|
+
errorMessage: alepha587.TOptional<alepha587.TString>;
|
|
426
|
+
}>>;
|
|
427
|
+
declare const auditEntitySchema: alepha587.TObject<{
|
|
428
|
+
id: alepha_orm12.PgAttr<alepha_orm12.PgAttr<alepha587.TString, typeof alepha_orm12.PG_PRIMARY_KEY>, typeof alepha_orm12.PG_DEFAULT>;
|
|
429
|
+
createdAt: alepha_orm12.PgAttr<alepha_orm12.PgAttr<alepha587.TString, typeof alepha_orm12.PG_CREATED_AT>, typeof alepha_orm12.PG_DEFAULT>;
|
|
430
|
+
/**
|
|
431
|
+
* Audit event type (e.g., "auth", "user", "payment", "system").
|
|
111
432
|
* Used for categorizing and filtering audit events.
|
|
112
433
|
*/
|
|
113
|
-
type:
|
|
434
|
+
type: alepha587.TString;
|
|
114
435
|
/**
|
|
115
436
|
* Specific action performed (e.g., "login", "logout", "create", "update", "delete").
|
|
116
437
|
*/
|
|
117
|
-
action:
|
|
438
|
+
action: alepha587.TString;
|
|
118
439
|
/**
|
|
119
440
|
* Severity level of the event.
|
|
120
441
|
*/
|
|
121
|
-
severity:
|
|
442
|
+
severity: alepha_orm12.PgAttr<alepha587.TUnsafe<"info" | "warning" | "critical">, typeof alepha_orm12.PG_DEFAULT>;
|
|
122
443
|
/**
|
|
123
444
|
* User ID who performed the action (null for system events).
|
|
124
445
|
*/
|
|
125
|
-
userId:
|
|
446
|
+
userId: alepha587.TOptional<alepha587.TString>;
|
|
126
447
|
/**
|
|
127
448
|
* User realm for multi-tenant support.
|
|
128
449
|
*/
|
|
129
|
-
userRealm:
|
|
450
|
+
userRealm: alepha587.TOptional<alepha587.TString>;
|
|
130
451
|
/**
|
|
131
452
|
* User email at the time of the event (denormalized for history).
|
|
132
453
|
*/
|
|
133
|
-
userEmail:
|
|
454
|
+
userEmail: alepha587.TOptional<alepha587.TString>;
|
|
134
455
|
/**
|
|
135
456
|
* Resource type affected (e.g., "user", "order", "file").
|
|
136
457
|
*/
|
|
137
|
-
resourceType:
|
|
458
|
+
resourceType: alepha587.TOptional<alepha587.TString>;
|
|
138
459
|
/**
|
|
139
460
|
* Resource ID affected.
|
|
140
461
|
*/
|
|
141
|
-
resourceId:
|
|
462
|
+
resourceId: alepha587.TOptional<alepha587.TString>;
|
|
142
463
|
/**
|
|
143
464
|
* Human-readable description of the event.
|
|
144
465
|
*/
|
|
145
|
-
description:
|
|
466
|
+
description: alepha587.TOptional<alepha587.TString>;
|
|
146
467
|
/**
|
|
147
468
|
* Additional metadata/context as JSON.
|
|
148
469
|
*/
|
|
149
|
-
metadata:
|
|
470
|
+
metadata: alepha587.TOptional<alepha587.TRecord<string, alepha587.TAny>>;
|
|
150
471
|
/**
|
|
151
472
|
* Client IP address.
|
|
152
473
|
*/
|
|
153
|
-
ipAddress:
|
|
474
|
+
ipAddress: alepha587.TOptional<alepha587.TString>;
|
|
154
475
|
/**
|
|
155
476
|
* Client user agent.
|
|
156
477
|
*/
|
|
157
|
-
userAgent:
|
|
478
|
+
userAgent: alepha587.TOptional<alepha587.TString>;
|
|
158
479
|
/**
|
|
159
480
|
* Session ID if applicable.
|
|
160
481
|
*/
|
|
161
|
-
sessionId:
|
|
482
|
+
sessionId: alepha587.TOptional<alepha587.TString>;
|
|
162
483
|
/**
|
|
163
484
|
* Request ID for correlation.
|
|
164
485
|
*/
|
|
165
|
-
requestId:
|
|
486
|
+
requestId: alepha587.TOptional<alepha587.TString>;
|
|
166
487
|
/**
|
|
167
488
|
* Whether the action was successful.
|
|
168
489
|
*/
|
|
169
|
-
success:
|
|
490
|
+
success: alepha_orm12.PgAttr<alepha587.TBoolean, typeof alepha_orm12.PG_DEFAULT>;
|
|
170
491
|
/**
|
|
171
492
|
* Error message if the action failed.
|
|
172
493
|
*/
|
|
173
|
-
errorMessage:
|
|
494
|
+
errorMessage: alepha587.TOptional<alepha587.TString>;
|
|
174
495
|
}>;
|
|
175
|
-
declare const auditEntityInsertSchema:
|
|
176
|
-
id:
|
|
177
|
-
createdAt:
|
|
496
|
+
declare const auditEntityInsertSchema: alepha_orm12.TObjectInsert<alepha587.TObject<{
|
|
497
|
+
id: alepha_orm12.PgAttr<alepha_orm12.PgAttr<alepha587.TString, typeof alepha_orm12.PG_PRIMARY_KEY>, typeof alepha_orm12.PG_DEFAULT>;
|
|
498
|
+
createdAt: alepha_orm12.PgAttr<alepha_orm12.PgAttr<alepha587.TString, typeof alepha_orm12.PG_CREATED_AT>, typeof alepha_orm12.PG_DEFAULT>;
|
|
178
499
|
/**
|
|
179
500
|
* Audit event type (e.g., "auth", "user", "payment", "system").
|
|
180
501
|
* Used for categorizing and filtering audit events.
|
|
181
502
|
*/
|
|
182
|
-
type:
|
|
503
|
+
type: alepha587.TString;
|
|
183
504
|
/**
|
|
184
505
|
* Specific action performed (e.g., "login", "logout", "create", "update", "delete").
|
|
185
506
|
*/
|
|
186
|
-
action:
|
|
507
|
+
action: alepha587.TString;
|
|
187
508
|
/**
|
|
188
509
|
* Severity level of the event.
|
|
189
510
|
*/
|
|
190
|
-
severity:
|
|
511
|
+
severity: alepha_orm12.PgAttr<alepha587.TUnsafe<"info" | "warning" | "critical">, typeof alepha_orm12.PG_DEFAULT>;
|
|
191
512
|
/**
|
|
192
513
|
* User ID who performed the action (null for system events).
|
|
193
514
|
*/
|
|
194
|
-
userId:
|
|
515
|
+
userId: alepha587.TOptional<alepha587.TString>;
|
|
195
516
|
/**
|
|
196
517
|
* User realm for multi-tenant support.
|
|
197
518
|
*/
|
|
198
|
-
userRealm:
|
|
519
|
+
userRealm: alepha587.TOptional<alepha587.TString>;
|
|
199
520
|
/**
|
|
200
521
|
* User email at the time of the event (denormalized for history).
|
|
201
522
|
*/
|
|
202
|
-
userEmail:
|
|
523
|
+
userEmail: alepha587.TOptional<alepha587.TString>;
|
|
203
524
|
/**
|
|
204
525
|
* Resource type affected (e.g., "user", "order", "file").
|
|
205
526
|
*/
|
|
206
|
-
resourceType:
|
|
527
|
+
resourceType: alepha587.TOptional<alepha587.TString>;
|
|
207
528
|
/**
|
|
208
529
|
* Resource ID affected.
|
|
209
530
|
*/
|
|
210
|
-
resourceId:
|
|
531
|
+
resourceId: alepha587.TOptional<alepha587.TString>;
|
|
211
532
|
/**
|
|
212
533
|
* Human-readable description of the event.
|
|
213
534
|
*/
|
|
214
|
-
description:
|
|
535
|
+
description: alepha587.TOptional<alepha587.TString>;
|
|
215
536
|
/**
|
|
216
537
|
* Additional metadata/context as JSON.
|
|
217
538
|
*/
|
|
218
|
-
metadata:
|
|
539
|
+
metadata: alepha587.TOptional<alepha587.TRecord<string, alepha587.TAny>>;
|
|
219
540
|
/**
|
|
220
541
|
* Client IP address.
|
|
221
542
|
*/
|
|
222
|
-
ipAddress:
|
|
543
|
+
ipAddress: alepha587.TOptional<alepha587.TString>;
|
|
223
544
|
/**
|
|
224
545
|
* Client user agent.
|
|
225
546
|
*/
|
|
226
|
-
userAgent:
|
|
547
|
+
userAgent: alepha587.TOptional<alepha587.TString>;
|
|
227
548
|
/**
|
|
228
549
|
* Session ID if applicable.
|
|
229
550
|
*/
|
|
230
|
-
sessionId:
|
|
551
|
+
sessionId: alepha587.TOptional<alepha587.TString>;
|
|
231
552
|
/**
|
|
232
553
|
* Request ID for correlation.
|
|
233
554
|
*/
|
|
234
|
-
requestId:
|
|
555
|
+
requestId: alepha587.TOptional<alepha587.TString>;
|
|
235
556
|
/**
|
|
236
557
|
* Whether the action was successful.
|
|
237
558
|
*/
|
|
238
|
-
success:
|
|
559
|
+
success: alepha_orm12.PgAttr<alepha587.TBoolean, typeof alepha_orm12.PG_DEFAULT>;
|
|
239
560
|
/**
|
|
240
561
|
* Error message if the action failed.
|
|
241
562
|
*/
|
|
242
|
-
errorMessage:
|
|
563
|
+
errorMessage: alepha587.TOptional<alepha587.TString>;
|
|
243
564
|
}>>;
|
|
244
565
|
type AuditEntity = Static<typeof audits.schema>;
|
|
245
566
|
//#endregion
|
|
@@ -247,21 +568,21 @@ type AuditEntity = Static<typeof audits.schema>;
|
|
|
247
568
|
/**
|
|
248
569
|
* Query schema for searching and filtering audit logs.
|
|
249
570
|
*/
|
|
250
|
-
declare const auditQuerySchema:
|
|
251
|
-
page:
|
|
252
|
-
size:
|
|
253
|
-
sort:
|
|
254
|
-
type:
|
|
255
|
-
action:
|
|
256
|
-
severity:
|
|
257
|
-
userId:
|
|
258
|
-
userRealm:
|
|
259
|
-
resourceType:
|
|
260
|
-
resourceId:
|
|
261
|
-
success:
|
|
262
|
-
from:
|
|
263
|
-
to:
|
|
264
|
-
search:
|
|
571
|
+
declare const auditQuerySchema: alepha587.TObject<{
|
|
572
|
+
page: alepha587.TOptional<alepha587.TInteger>;
|
|
573
|
+
size: alepha587.TOptional<alepha587.TInteger>;
|
|
574
|
+
sort: alepha587.TOptional<alepha587.TString>;
|
|
575
|
+
type: alepha587.TOptional<alepha587.TString>;
|
|
576
|
+
action: alepha587.TOptional<alepha587.TString>;
|
|
577
|
+
severity: alepha587.TOptional<alepha587.TUnsafe<"info" | "warning" | "critical">>;
|
|
578
|
+
userId: alepha587.TOptional<alepha587.TString>;
|
|
579
|
+
userRealm: alepha587.TOptional<alepha587.TString>;
|
|
580
|
+
resourceType: alepha587.TOptional<alepha587.TString>;
|
|
581
|
+
resourceId: alepha587.TOptional<alepha587.TString>;
|
|
582
|
+
success: alepha587.TOptional<alepha587.TBoolean>;
|
|
583
|
+
from: alepha587.TOptional<alepha587.TString>;
|
|
584
|
+
to: alepha587.TOptional<alepha587.TString>;
|
|
585
|
+
search: alepha587.TOptional<alepha587.TString>;
|
|
265
586
|
}>;
|
|
266
587
|
type AuditQuery = Static<typeof auditQuerySchema>;
|
|
267
588
|
//#endregion
|
|
@@ -269,23 +590,23 @@ type AuditQuery = Static<typeof auditQuerySchema>;
|
|
|
269
590
|
/**
|
|
270
591
|
* Schema for creating a new audit log entry.
|
|
271
592
|
*/
|
|
272
|
-
declare const createAuditSchema:
|
|
273
|
-
type:
|
|
274
|
-
action:
|
|
275
|
-
severity:
|
|
276
|
-
userId:
|
|
277
|
-
userRealm:
|
|
278
|
-
userEmail:
|
|
279
|
-
resourceType:
|
|
280
|
-
resourceId:
|
|
281
|
-
description:
|
|
282
|
-
metadata:
|
|
283
|
-
ipAddress:
|
|
284
|
-
userAgent:
|
|
285
|
-
sessionId:
|
|
286
|
-
requestId:
|
|
287
|
-
success:
|
|
288
|
-
errorMessage:
|
|
593
|
+
declare const createAuditSchema: alepha587.TObject<{
|
|
594
|
+
type: alepha587.TString;
|
|
595
|
+
action: alepha587.TString;
|
|
596
|
+
severity: alepha587.TOptional<alepha587.TUnsafe<"info" | "warning" | "critical">>;
|
|
597
|
+
userId: alepha587.TOptional<alepha587.TString>;
|
|
598
|
+
userRealm: alepha587.TOptional<alepha587.TString>;
|
|
599
|
+
userEmail: alepha587.TOptional<alepha587.TString>;
|
|
600
|
+
resourceType: alepha587.TOptional<alepha587.TString>;
|
|
601
|
+
resourceId: alepha587.TOptional<alepha587.TString>;
|
|
602
|
+
description: alepha587.TOptional<alepha587.TString>;
|
|
603
|
+
metadata: alepha587.TOptional<alepha587.TRecord<string, alepha587.TAny>>;
|
|
604
|
+
ipAddress: alepha587.TOptional<alepha587.TString>;
|
|
605
|
+
userAgent: alepha587.TOptional<alepha587.TString>;
|
|
606
|
+
sessionId: alepha587.TOptional<alepha587.TString>;
|
|
607
|
+
requestId: alepha587.TOptional<alepha587.TString>;
|
|
608
|
+
success: alepha587.TOptional<alepha587.TBoolean>;
|
|
609
|
+
errorMessage: alepha587.TOptional<alepha587.TString>;
|
|
289
610
|
}>;
|
|
290
611
|
type CreateAudit = Static<typeof createAuditSchema>;
|
|
291
612
|
//#endregion
|
|
@@ -310,25 +631,25 @@ interface AuditTypeDefinition {
|
|
|
310
631
|
declare class AuditService {
|
|
311
632
|
protected readonly alepha: Alepha;
|
|
312
633
|
protected readonly log: alepha_logger0.Logger;
|
|
313
|
-
protected readonly repo:
|
|
314
|
-
id:
|
|
315
|
-
createdAt:
|
|
316
|
-
type:
|
|
317
|
-
action:
|
|
318
|
-
severity:
|
|
319
|
-
userId:
|
|
320
|
-
userRealm:
|
|
321
|
-
userEmail:
|
|
322
|
-
resourceType:
|
|
323
|
-
resourceId:
|
|
324
|
-
description:
|
|
325
|
-
metadata:
|
|
326
|
-
ipAddress:
|
|
327
|
-
userAgent:
|
|
328
|
-
sessionId:
|
|
329
|
-
requestId:
|
|
330
|
-
success:
|
|
331
|
-
errorMessage:
|
|
634
|
+
protected readonly repo: alepha_orm12.Repository<alepha587.TObject<{
|
|
635
|
+
id: alepha_orm12.PgAttr<alepha_orm12.PgAttr<alepha587.TString, typeof alepha_orm12.PG_PRIMARY_KEY>, typeof alepha_orm12.PG_DEFAULT>;
|
|
636
|
+
createdAt: alepha_orm12.PgAttr<alepha_orm12.PgAttr<alepha587.TString, typeof alepha_orm12.PG_CREATED_AT>, typeof alepha_orm12.PG_DEFAULT>;
|
|
637
|
+
type: alepha587.TString;
|
|
638
|
+
action: alepha587.TString;
|
|
639
|
+
severity: alepha_orm12.PgAttr<alepha587.TUnsafe<"info" | "warning" | "critical">, typeof alepha_orm12.PG_DEFAULT>;
|
|
640
|
+
userId: alepha587.TOptional<alepha587.TString>;
|
|
641
|
+
userRealm: alepha587.TOptional<alepha587.TString>;
|
|
642
|
+
userEmail: alepha587.TOptional<alepha587.TString>;
|
|
643
|
+
resourceType: alepha587.TOptional<alepha587.TString>;
|
|
644
|
+
resourceId: alepha587.TOptional<alepha587.TString>;
|
|
645
|
+
description: alepha587.TOptional<alepha587.TString>;
|
|
646
|
+
metadata: alepha587.TOptional<alepha587.TRecord<string, alepha587.TAny>>;
|
|
647
|
+
ipAddress: alepha587.TOptional<alepha587.TString>;
|
|
648
|
+
userAgent: alepha587.TOptional<alepha587.TString>;
|
|
649
|
+
sessionId: alepha587.TOptional<alepha587.TString>;
|
|
650
|
+
requestId: alepha587.TOptional<alepha587.TString>;
|
|
651
|
+
success: alepha_orm12.PgAttr<alepha587.TBoolean, typeof alepha_orm12.PG_DEFAULT>;
|
|
652
|
+
errorMessage: alepha587.TOptional<alepha587.TString>;
|
|
332
653
|
}>>;
|
|
333
654
|
/**
|
|
334
655
|
* Registry of audit types and their allowed actions.
|
|
@@ -415,7 +736,7 @@ interface AuditStats {
|
|
|
415
736
|
recentFailures: AuditEntity[];
|
|
416
737
|
}
|
|
417
738
|
//#endregion
|
|
418
|
-
//#region ../../src/api/audits/controllers/
|
|
739
|
+
//#region ../../src/api/audits/controllers/AdminAuditController.d.ts
|
|
419
740
|
/**
|
|
420
741
|
* REST API controller for audit log management.
|
|
421
742
|
*
|
|
@@ -425,245 +746,245 @@ interface AuditStats {
|
|
|
425
746
|
* - Getting audit statistics
|
|
426
747
|
* - Viewing registered audit types
|
|
427
748
|
*/
|
|
428
|
-
declare class
|
|
749
|
+
declare class AdminAuditController {
|
|
429
750
|
protected readonly url = "/audits";
|
|
430
|
-
protected readonly group = "audits";
|
|
751
|
+
protected readonly group = "admin:audits";
|
|
431
752
|
protected readonly auditService: AuditService;
|
|
432
753
|
/**
|
|
433
754
|
* Find audit entries with filtering and pagination.
|
|
434
755
|
*/
|
|
435
756
|
readonly findAudits: alepha_server0.ActionPrimitiveFn<{
|
|
436
|
-
query:
|
|
437
|
-
page:
|
|
438
|
-
size:
|
|
439
|
-
sort:
|
|
440
|
-
type:
|
|
441
|
-
action:
|
|
442
|
-
severity:
|
|
443
|
-
userId:
|
|
444
|
-
userRealm:
|
|
445
|
-
resourceType:
|
|
446
|
-
resourceId:
|
|
447
|
-
success:
|
|
448
|
-
from:
|
|
449
|
-
to:
|
|
450
|
-
search:
|
|
757
|
+
query: alepha587.TObject<{
|
|
758
|
+
page: alepha587.TOptional<alepha587.TInteger>;
|
|
759
|
+
size: alepha587.TOptional<alepha587.TInteger>;
|
|
760
|
+
sort: alepha587.TOptional<alepha587.TString>;
|
|
761
|
+
type: alepha587.TOptional<alepha587.TString>;
|
|
762
|
+
action: alepha587.TOptional<alepha587.TString>;
|
|
763
|
+
severity: alepha587.TOptional<alepha587.TUnsafe<"info" | "warning" | "critical">>;
|
|
764
|
+
userId: alepha587.TOptional<alepha587.TString>;
|
|
765
|
+
userRealm: alepha587.TOptional<alepha587.TString>;
|
|
766
|
+
resourceType: alepha587.TOptional<alepha587.TString>;
|
|
767
|
+
resourceId: alepha587.TOptional<alepha587.TString>;
|
|
768
|
+
success: alepha587.TOptional<alepha587.TBoolean>;
|
|
769
|
+
from: alepha587.TOptional<alepha587.TString>;
|
|
770
|
+
to: alepha587.TOptional<alepha587.TString>;
|
|
771
|
+
search: alepha587.TOptional<alepha587.TString>;
|
|
451
772
|
}>;
|
|
452
|
-
response:
|
|
453
|
-
id:
|
|
454
|
-
createdAt:
|
|
455
|
-
type:
|
|
456
|
-
action:
|
|
457
|
-
severity:
|
|
458
|
-
userId:
|
|
459
|
-
userRealm:
|
|
460
|
-
userEmail:
|
|
461
|
-
resourceType:
|
|
462
|
-
resourceId:
|
|
463
|
-
description:
|
|
464
|
-
metadata:
|
|
465
|
-
ipAddress:
|
|
466
|
-
userAgent:
|
|
467
|
-
sessionId:
|
|
468
|
-
requestId:
|
|
469
|
-
success:
|
|
470
|
-
errorMessage:
|
|
773
|
+
response: alepha587.TPage<alepha587.TObject<{
|
|
774
|
+
id: PgAttr<PgAttr<alepha587.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
775
|
+
createdAt: PgAttr<PgAttr<alepha587.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
776
|
+
type: alepha587.TString;
|
|
777
|
+
action: alepha587.TString;
|
|
778
|
+
severity: PgAttr<alepha587.TUnsafe<"info" | "warning" | "critical">, typeof PG_DEFAULT>;
|
|
779
|
+
userId: alepha587.TOptional<alepha587.TString>;
|
|
780
|
+
userRealm: alepha587.TOptional<alepha587.TString>;
|
|
781
|
+
userEmail: alepha587.TOptional<alepha587.TString>;
|
|
782
|
+
resourceType: alepha587.TOptional<alepha587.TString>;
|
|
783
|
+
resourceId: alepha587.TOptional<alepha587.TString>;
|
|
784
|
+
description: alepha587.TOptional<alepha587.TString>;
|
|
785
|
+
metadata: alepha587.TOptional<alepha587.TRecord<string, alepha587.TAny>>;
|
|
786
|
+
ipAddress: alepha587.TOptional<alepha587.TString>;
|
|
787
|
+
userAgent: alepha587.TOptional<alepha587.TString>;
|
|
788
|
+
sessionId: alepha587.TOptional<alepha587.TString>;
|
|
789
|
+
requestId: alepha587.TOptional<alepha587.TString>;
|
|
790
|
+
success: PgAttr<alepha587.TBoolean, typeof PG_DEFAULT>;
|
|
791
|
+
errorMessage: alepha587.TOptional<alepha587.TString>;
|
|
471
792
|
}>>;
|
|
472
793
|
}>;
|
|
473
794
|
/**
|
|
474
795
|
* Get a single audit entry by ID.
|
|
475
796
|
*/
|
|
476
797
|
readonly getAudit: alepha_server0.ActionPrimitiveFn<{
|
|
477
|
-
params:
|
|
478
|
-
id:
|
|
798
|
+
params: alepha587.TObject<{
|
|
799
|
+
id: alepha587.TString;
|
|
479
800
|
}>;
|
|
480
|
-
response:
|
|
481
|
-
id:
|
|
482
|
-
createdAt:
|
|
483
|
-
type:
|
|
484
|
-
action:
|
|
485
|
-
severity:
|
|
486
|
-
userId:
|
|
487
|
-
userRealm:
|
|
488
|
-
userEmail:
|
|
489
|
-
resourceType:
|
|
490
|
-
resourceId:
|
|
491
|
-
description:
|
|
492
|
-
metadata:
|
|
493
|
-
ipAddress:
|
|
494
|
-
userAgent:
|
|
495
|
-
sessionId:
|
|
496
|
-
requestId:
|
|
497
|
-
success:
|
|
498
|
-
errorMessage:
|
|
801
|
+
response: alepha587.TObject<{
|
|
802
|
+
id: PgAttr<PgAttr<alepha587.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
803
|
+
createdAt: PgAttr<PgAttr<alepha587.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
804
|
+
type: alepha587.TString;
|
|
805
|
+
action: alepha587.TString;
|
|
806
|
+
severity: PgAttr<alepha587.TUnsafe<"info" | "warning" | "critical">, typeof PG_DEFAULT>;
|
|
807
|
+
userId: alepha587.TOptional<alepha587.TString>;
|
|
808
|
+
userRealm: alepha587.TOptional<alepha587.TString>;
|
|
809
|
+
userEmail: alepha587.TOptional<alepha587.TString>;
|
|
810
|
+
resourceType: alepha587.TOptional<alepha587.TString>;
|
|
811
|
+
resourceId: alepha587.TOptional<alepha587.TString>;
|
|
812
|
+
description: alepha587.TOptional<alepha587.TString>;
|
|
813
|
+
metadata: alepha587.TOptional<alepha587.TRecord<string, alepha587.TAny>>;
|
|
814
|
+
ipAddress: alepha587.TOptional<alepha587.TString>;
|
|
815
|
+
userAgent: alepha587.TOptional<alepha587.TString>;
|
|
816
|
+
sessionId: alepha587.TOptional<alepha587.TString>;
|
|
817
|
+
requestId: alepha587.TOptional<alepha587.TString>;
|
|
818
|
+
success: PgAttr<alepha587.TBoolean, typeof PG_DEFAULT>;
|
|
819
|
+
errorMessage: alepha587.TOptional<alepha587.TString>;
|
|
499
820
|
}>;
|
|
500
821
|
}>;
|
|
501
822
|
/**
|
|
502
823
|
* Create a new audit entry.
|
|
503
824
|
*/
|
|
504
825
|
readonly createAudit: alepha_server0.ActionPrimitiveFn<{
|
|
505
|
-
body:
|
|
506
|
-
type:
|
|
507
|
-
action:
|
|
508
|
-
severity:
|
|
509
|
-
userId:
|
|
510
|
-
userRealm:
|
|
511
|
-
userEmail:
|
|
512
|
-
resourceType:
|
|
513
|
-
resourceId:
|
|
514
|
-
description:
|
|
515
|
-
metadata:
|
|
516
|
-
ipAddress:
|
|
517
|
-
userAgent:
|
|
518
|
-
sessionId:
|
|
519
|
-
requestId:
|
|
520
|
-
success:
|
|
521
|
-
errorMessage:
|
|
826
|
+
body: alepha587.TObject<{
|
|
827
|
+
type: alepha587.TString;
|
|
828
|
+
action: alepha587.TString;
|
|
829
|
+
severity: alepha587.TOptional<alepha587.TUnsafe<"info" | "warning" | "critical">>;
|
|
830
|
+
userId: alepha587.TOptional<alepha587.TString>;
|
|
831
|
+
userRealm: alepha587.TOptional<alepha587.TString>;
|
|
832
|
+
userEmail: alepha587.TOptional<alepha587.TString>;
|
|
833
|
+
resourceType: alepha587.TOptional<alepha587.TString>;
|
|
834
|
+
resourceId: alepha587.TOptional<alepha587.TString>;
|
|
835
|
+
description: alepha587.TOptional<alepha587.TString>;
|
|
836
|
+
metadata: alepha587.TOptional<alepha587.TRecord<string, alepha587.TAny>>;
|
|
837
|
+
ipAddress: alepha587.TOptional<alepha587.TString>;
|
|
838
|
+
userAgent: alepha587.TOptional<alepha587.TString>;
|
|
839
|
+
sessionId: alepha587.TOptional<alepha587.TString>;
|
|
840
|
+
requestId: alepha587.TOptional<alepha587.TString>;
|
|
841
|
+
success: alepha587.TOptional<alepha587.TBoolean>;
|
|
842
|
+
errorMessage: alepha587.TOptional<alepha587.TString>;
|
|
522
843
|
}>;
|
|
523
|
-
response:
|
|
524
|
-
id:
|
|
525
|
-
createdAt:
|
|
526
|
-
type:
|
|
527
|
-
action:
|
|
528
|
-
severity:
|
|
529
|
-
userId:
|
|
530
|
-
userRealm:
|
|
531
|
-
userEmail:
|
|
532
|
-
resourceType:
|
|
533
|
-
resourceId:
|
|
534
|
-
description:
|
|
535
|
-
metadata:
|
|
536
|
-
ipAddress:
|
|
537
|
-
userAgent:
|
|
538
|
-
sessionId:
|
|
539
|
-
requestId:
|
|
540
|
-
success:
|
|
541
|
-
errorMessage:
|
|
844
|
+
response: alepha587.TObject<{
|
|
845
|
+
id: PgAttr<PgAttr<alepha587.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
846
|
+
createdAt: PgAttr<PgAttr<alepha587.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
847
|
+
type: alepha587.TString;
|
|
848
|
+
action: alepha587.TString;
|
|
849
|
+
severity: PgAttr<alepha587.TUnsafe<"info" | "warning" | "critical">, typeof PG_DEFAULT>;
|
|
850
|
+
userId: alepha587.TOptional<alepha587.TString>;
|
|
851
|
+
userRealm: alepha587.TOptional<alepha587.TString>;
|
|
852
|
+
userEmail: alepha587.TOptional<alepha587.TString>;
|
|
853
|
+
resourceType: alepha587.TOptional<alepha587.TString>;
|
|
854
|
+
resourceId: alepha587.TOptional<alepha587.TString>;
|
|
855
|
+
description: alepha587.TOptional<alepha587.TString>;
|
|
856
|
+
metadata: alepha587.TOptional<alepha587.TRecord<string, alepha587.TAny>>;
|
|
857
|
+
ipAddress: alepha587.TOptional<alepha587.TString>;
|
|
858
|
+
userAgent: alepha587.TOptional<alepha587.TString>;
|
|
859
|
+
sessionId: alepha587.TOptional<alepha587.TString>;
|
|
860
|
+
requestId: alepha587.TOptional<alepha587.TString>;
|
|
861
|
+
success: PgAttr<alepha587.TBoolean, typeof PG_DEFAULT>;
|
|
862
|
+
errorMessage: alepha587.TOptional<alepha587.TString>;
|
|
542
863
|
}>;
|
|
543
864
|
}>;
|
|
544
865
|
/**
|
|
545
866
|
* Get audit entries for a specific user.
|
|
546
867
|
*/
|
|
547
868
|
readonly findByUser: alepha_server0.ActionPrimitiveFn<{
|
|
548
|
-
params:
|
|
549
|
-
userId:
|
|
869
|
+
params: alepha587.TObject<{
|
|
870
|
+
userId: alepha587.TString;
|
|
550
871
|
}>;
|
|
551
|
-
query:
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
872
|
+
query: alepha587.TObject<{
|
|
873
|
+
type: alepha587.TOptional<alepha587.TString>;
|
|
874
|
+
search: alepha587.TOptional<alepha587.TString>;
|
|
875
|
+
action: alepha587.TOptional<alepha587.TString>;
|
|
876
|
+
severity: alepha587.TOptional<alepha587.TUnsafe<"info" | "warning" | "critical">>;
|
|
877
|
+
sort: alepha587.TOptional<alepha587.TString>;
|
|
878
|
+
userRealm: alepha587.TOptional<alepha587.TString>;
|
|
879
|
+
resourceType: alepha587.TOptional<alepha587.TString>;
|
|
880
|
+
resourceId: alepha587.TOptional<alepha587.TString>;
|
|
881
|
+
success: alepha587.TOptional<alepha587.TBoolean>;
|
|
882
|
+
page: alepha587.TOptional<alepha587.TInteger>;
|
|
883
|
+
size: alepha587.TOptional<alepha587.TInteger>;
|
|
884
|
+
from: alepha587.TOptional<alepha587.TString>;
|
|
885
|
+
to: alepha587.TOptional<alepha587.TString>;
|
|
565
886
|
}>;
|
|
566
|
-
response:
|
|
567
|
-
id:
|
|
568
|
-
createdAt:
|
|
569
|
-
type:
|
|
570
|
-
action:
|
|
571
|
-
severity:
|
|
572
|
-
userId:
|
|
573
|
-
userRealm:
|
|
574
|
-
userEmail:
|
|
575
|
-
resourceType:
|
|
576
|
-
resourceId:
|
|
577
|
-
description:
|
|
578
|
-
metadata:
|
|
579
|
-
ipAddress:
|
|
580
|
-
userAgent:
|
|
581
|
-
sessionId:
|
|
582
|
-
requestId:
|
|
583
|
-
success:
|
|
584
|
-
errorMessage:
|
|
887
|
+
response: alepha587.TPage<alepha587.TObject<{
|
|
888
|
+
id: PgAttr<PgAttr<alepha587.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
889
|
+
createdAt: PgAttr<PgAttr<alepha587.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
890
|
+
type: alepha587.TString;
|
|
891
|
+
action: alepha587.TString;
|
|
892
|
+
severity: PgAttr<alepha587.TUnsafe<"info" | "warning" | "critical">, typeof PG_DEFAULT>;
|
|
893
|
+
userId: alepha587.TOptional<alepha587.TString>;
|
|
894
|
+
userRealm: alepha587.TOptional<alepha587.TString>;
|
|
895
|
+
userEmail: alepha587.TOptional<alepha587.TString>;
|
|
896
|
+
resourceType: alepha587.TOptional<alepha587.TString>;
|
|
897
|
+
resourceId: alepha587.TOptional<alepha587.TString>;
|
|
898
|
+
description: alepha587.TOptional<alepha587.TString>;
|
|
899
|
+
metadata: alepha587.TOptional<alepha587.TRecord<string, alepha587.TAny>>;
|
|
900
|
+
ipAddress: alepha587.TOptional<alepha587.TString>;
|
|
901
|
+
userAgent: alepha587.TOptional<alepha587.TString>;
|
|
902
|
+
sessionId: alepha587.TOptional<alepha587.TString>;
|
|
903
|
+
requestId: alepha587.TOptional<alepha587.TString>;
|
|
904
|
+
success: PgAttr<alepha587.TBoolean, typeof PG_DEFAULT>;
|
|
905
|
+
errorMessage: alepha587.TOptional<alepha587.TString>;
|
|
585
906
|
}>>;
|
|
586
907
|
}>;
|
|
587
908
|
/**
|
|
588
909
|
* Get audit entries for a specific resource.
|
|
589
910
|
*/
|
|
590
911
|
readonly findByResource: alepha_server0.ActionPrimitiveFn<{
|
|
591
|
-
params:
|
|
592
|
-
resourceType:
|
|
593
|
-
resourceId:
|
|
912
|
+
params: alepha587.TObject<{
|
|
913
|
+
resourceType: alepha587.TString;
|
|
914
|
+
resourceId: alepha587.TString;
|
|
594
915
|
}>;
|
|
595
|
-
query:
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
916
|
+
query: alepha587.TObject<{
|
|
917
|
+
type: alepha587.TOptional<alepha587.TString>;
|
|
918
|
+
search: alepha587.TOptional<alepha587.TString>;
|
|
919
|
+
action: alepha587.TOptional<alepha587.TString>;
|
|
920
|
+
severity: alepha587.TOptional<alepha587.TUnsafe<"info" | "warning" | "critical">>;
|
|
921
|
+
sort: alepha587.TOptional<alepha587.TString>;
|
|
922
|
+
userId: alepha587.TOptional<alepha587.TString>;
|
|
923
|
+
userRealm: alepha587.TOptional<alepha587.TString>;
|
|
924
|
+
success: alepha587.TOptional<alepha587.TBoolean>;
|
|
925
|
+
page: alepha587.TOptional<alepha587.TInteger>;
|
|
926
|
+
size: alepha587.TOptional<alepha587.TInteger>;
|
|
927
|
+
from: alepha587.TOptional<alepha587.TString>;
|
|
928
|
+
to: alepha587.TOptional<alepha587.TString>;
|
|
608
929
|
}>;
|
|
609
|
-
response:
|
|
610
|
-
id:
|
|
611
|
-
createdAt:
|
|
612
|
-
type:
|
|
613
|
-
action:
|
|
614
|
-
severity:
|
|
615
|
-
userId:
|
|
616
|
-
userRealm:
|
|
617
|
-
userEmail:
|
|
618
|
-
resourceType:
|
|
619
|
-
resourceId:
|
|
620
|
-
description:
|
|
621
|
-
metadata:
|
|
622
|
-
ipAddress:
|
|
623
|
-
userAgent:
|
|
624
|
-
sessionId:
|
|
625
|
-
requestId:
|
|
626
|
-
success:
|
|
627
|
-
errorMessage:
|
|
930
|
+
response: alepha587.TPage<alepha587.TObject<{
|
|
931
|
+
id: PgAttr<PgAttr<alepha587.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
932
|
+
createdAt: PgAttr<PgAttr<alepha587.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
933
|
+
type: alepha587.TString;
|
|
934
|
+
action: alepha587.TString;
|
|
935
|
+
severity: PgAttr<alepha587.TUnsafe<"info" | "warning" | "critical">, typeof PG_DEFAULT>;
|
|
936
|
+
userId: alepha587.TOptional<alepha587.TString>;
|
|
937
|
+
userRealm: alepha587.TOptional<alepha587.TString>;
|
|
938
|
+
userEmail: alepha587.TOptional<alepha587.TString>;
|
|
939
|
+
resourceType: alepha587.TOptional<alepha587.TString>;
|
|
940
|
+
resourceId: alepha587.TOptional<alepha587.TString>;
|
|
941
|
+
description: alepha587.TOptional<alepha587.TString>;
|
|
942
|
+
metadata: alepha587.TOptional<alepha587.TRecord<string, alepha587.TAny>>;
|
|
943
|
+
ipAddress: alepha587.TOptional<alepha587.TString>;
|
|
944
|
+
userAgent: alepha587.TOptional<alepha587.TString>;
|
|
945
|
+
sessionId: alepha587.TOptional<alepha587.TString>;
|
|
946
|
+
requestId: alepha587.TOptional<alepha587.TString>;
|
|
947
|
+
success: PgAttr<alepha587.TBoolean, typeof PG_DEFAULT>;
|
|
948
|
+
errorMessage: alepha587.TOptional<alepha587.TString>;
|
|
628
949
|
}>>;
|
|
629
950
|
}>;
|
|
630
951
|
/**
|
|
631
952
|
* Get audit statistics.
|
|
632
953
|
*/
|
|
633
954
|
readonly getStats: alepha_server0.ActionPrimitiveFn<{
|
|
634
|
-
query:
|
|
635
|
-
from:
|
|
636
|
-
to:
|
|
637
|
-
userRealm:
|
|
955
|
+
query: alepha587.TObject<{
|
|
956
|
+
from: alepha587.TOptional<alepha587.TString>;
|
|
957
|
+
to: alepha587.TOptional<alepha587.TString>;
|
|
958
|
+
userRealm: alepha587.TOptional<alepha587.TString>;
|
|
638
959
|
}>;
|
|
639
|
-
response:
|
|
640
|
-
total:
|
|
641
|
-
byType:
|
|
642
|
-
bySeverity:
|
|
643
|
-
info:
|
|
644
|
-
warning:
|
|
645
|
-
critical:
|
|
960
|
+
response: alepha587.TObject<{
|
|
961
|
+
total: alepha587.TInteger;
|
|
962
|
+
byType: alepha587.TRecord<"^.*$", alepha587.TInteger>;
|
|
963
|
+
bySeverity: alepha587.TObject<{
|
|
964
|
+
info: alepha587.TInteger;
|
|
965
|
+
warning: alepha587.TInteger;
|
|
966
|
+
critical: alepha587.TInteger;
|
|
646
967
|
}>;
|
|
647
|
-
successRate:
|
|
648
|
-
recentFailures:
|
|
649
|
-
id:
|
|
650
|
-
createdAt:
|
|
651
|
-
type:
|
|
652
|
-
action:
|
|
653
|
-
severity:
|
|
654
|
-
userId:
|
|
655
|
-
userRealm:
|
|
656
|
-
userEmail:
|
|
657
|
-
resourceType:
|
|
658
|
-
resourceId:
|
|
659
|
-
description:
|
|
660
|
-
metadata:
|
|
661
|
-
ipAddress:
|
|
662
|
-
userAgent:
|
|
663
|
-
sessionId:
|
|
664
|
-
requestId:
|
|
665
|
-
success:
|
|
666
|
-
errorMessage:
|
|
968
|
+
successRate: alepha587.TNumber;
|
|
969
|
+
recentFailures: alepha587.TArray<alepha587.TObject<{
|
|
970
|
+
id: PgAttr<PgAttr<alepha587.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
971
|
+
createdAt: PgAttr<PgAttr<alepha587.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
972
|
+
type: alepha587.TString;
|
|
973
|
+
action: alepha587.TString;
|
|
974
|
+
severity: PgAttr<alepha587.TUnsafe<"info" | "warning" | "critical">, typeof PG_DEFAULT>;
|
|
975
|
+
userId: alepha587.TOptional<alepha587.TString>;
|
|
976
|
+
userRealm: alepha587.TOptional<alepha587.TString>;
|
|
977
|
+
userEmail: alepha587.TOptional<alepha587.TString>;
|
|
978
|
+
resourceType: alepha587.TOptional<alepha587.TString>;
|
|
979
|
+
resourceId: alepha587.TOptional<alepha587.TString>;
|
|
980
|
+
description: alepha587.TOptional<alepha587.TString>;
|
|
981
|
+
metadata: alepha587.TOptional<alepha587.TRecord<string, alepha587.TAny>>;
|
|
982
|
+
ipAddress: alepha587.TOptional<alepha587.TString>;
|
|
983
|
+
userAgent: alepha587.TOptional<alepha587.TString>;
|
|
984
|
+
sessionId: alepha587.TOptional<alepha587.TString>;
|
|
985
|
+
requestId: alepha587.TOptional<alepha587.TString>;
|
|
986
|
+
success: PgAttr<alepha587.TBoolean, typeof PG_DEFAULT>;
|
|
987
|
+
errorMessage: alepha587.TOptional<alepha587.TString>;
|
|
667
988
|
}>>;
|
|
668
989
|
}>;
|
|
669
990
|
}>;
|
|
@@ -671,21 +992,21 @@ declare class AuditController {
|
|
|
671
992
|
* Get registered audit types.
|
|
672
993
|
*/
|
|
673
994
|
readonly getTypes: alepha_server0.ActionPrimitiveFn<{
|
|
674
|
-
response:
|
|
675
|
-
type:
|
|
676
|
-
description:
|
|
677
|
-
actions:
|
|
995
|
+
response: alepha587.TArray<alepha587.TObject<{
|
|
996
|
+
type: alepha587.TString;
|
|
997
|
+
description: alepha587.TOptional<alepha587.TString>;
|
|
998
|
+
actions: alepha587.TArray<alepha587.TString>;
|
|
678
999
|
}>>;
|
|
679
1000
|
}>;
|
|
680
1001
|
/**
|
|
681
1002
|
* Get distinct values for filters.
|
|
682
1003
|
*/
|
|
683
1004
|
readonly getFilterOptions: alepha_server0.ActionPrimitiveFn<{
|
|
684
|
-
response:
|
|
685
|
-
types:
|
|
686
|
-
actions:
|
|
687
|
-
resourceTypes:
|
|
688
|
-
userRealms:
|
|
1005
|
+
response: alepha587.TObject<{
|
|
1006
|
+
types: alepha587.TArray<alepha587.TString>;
|
|
1007
|
+
actions: alepha587.TArray<alepha587.TString>;
|
|
1008
|
+
resourceTypes: alepha587.TArray<alepha587.TString>;
|
|
1009
|
+
userRealms: alepha587.TArray<alepha587.TString>;
|
|
689
1010
|
}>;
|
|
690
1011
|
}>;
|
|
691
1012
|
}
|
|
@@ -803,429 +1124,29 @@ declare const $audit: {
|
|
|
803
1124
|
[KIND]: typeof AuditPrimitive;
|
|
804
1125
|
};
|
|
805
1126
|
//#endregion
|
|
806
|
-
//#region ../../src/orm/schemas/insertSchema.d.ts
|
|
807
|
-
/**
|
|
808
|
-
* Transforms a TObject schema for insert operations.
|
|
809
|
-
* All default properties at the root level are made optional.
|
|
810
|
-
*
|
|
811
|
-
* @example
|
|
812
|
-
* Before: { name: string; age: number(default=0); }
|
|
813
|
-
* After: { name: string; age?: number; }
|
|
814
|
-
*/
|
|
815
|
-
type TObjectInsert<T extends TObject> = TObject<{ [K in keyof T["properties"]]: T["properties"][K] extends {
|
|
816
|
-
[PG_DEFAULT]: any;
|
|
817
|
-
} | {
|
|
818
|
-
"~optional": true;
|
|
819
|
-
} ? TOptional<T["properties"][K]> : T["properties"][K] }>;
|
|
820
|
-
//#endregion
|
|
821
|
-
//#region ../../src/orm/schemas/updateSchema.d.ts
|
|
822
|
-
/**
|
|
823
|
-
* Transforms a TObject schema for update operations.
|
|
824
|
-
* All optional properties at the root level are made nullable (i.e., `T | null`).
|
|
825
|
-
* This allows an API endpoint to explicitly accept `null` to clear an optional field in the database.
|
|
826
|
-
*
|
|
827
|
-
* @example
|
|
828
|
-
* Before: { name?: string; age: number; }
|
|
829
|
-
* After: { name?: string | null; age: number; }
|
|
830
|
-
*/
|
|
831
|
-
type TObjectUpdate<T extends TObject> = TObject<{ [K in keyof T["properties"]]: T["properties"][K] extends TOptional<infer U> ? TOptional<TUnion<[U, TNull]>> : T["properties"][K] }>;
|
|
832
|
-
//#endregion
|
|
833
|
-
//#region ../../src/orm/primitives/$entity.d.ts
|
|
834
|
-
interface EntityPrimitiveOptions<T extends TObject, Keys = keyof Static<T>> {
|
|
835
|
-
/**
|
|
836
|
-
* The database table name that will be created for this entity.
|
|
837
|
-
* If not provided, name will be inferred from the $repository variable name.
|
|
838
|
-
*/
|
|
839
|
-
name: string;
|
|
840
|
-
/**
|
|
841
|
-
* TypeBox schema defining the table structure and column types.
|
|
842
|
-
*/
|
|
843
|
-
schema: T;
|
|
844
|
-
/**
|
|
845
|
-
* Database indexes to create for query optimization.
|
|
846
|
-
*/
|
|
847
|
-
indexes?: (Keys | {
|
|
848
|
-
/**
|
|
849
|
-
* Single column to index.
|
|
850
|
-
*/
|
|
851
|
-
column: Keys;
|
|
852
|
-
/**
|
|
853
|
-
* Whether this should be a unique index (enforces uniqueness constraint).
|
|
854
|
-
*/
|
|
855
|
-
unique?: boolean;
|
|
856
|
-
/**
|
|
857
|
-
* Custom name for the index. If not provided, generates name automatically.
|
|
858
|
-
*/
|
|
859
|
-
name?: string;
|
|
860
|
-
} | {
|
|
861
|
-
/**
|
|
862
|
-
* Multiple columns for composite index (order matters for query optimization).
|
|
863
|
-
*/
|
|
864
|
-
columns: Keys[];
|
|
865
|
-
/**
|
|
866
|
-
* Whether this should be a unique index (enforces uniqueness constraint).
|
|
867
|
-
*/
|
|
868
|
-
unique?: boolean;
|
|
869
|
-
/**
|
|
870
|
-
* Custom name for the index. If not provided, generates name automatically.
|
|
871
|
-
*/
|
|
872
|
-
name?: string;
|
|
873
|
-
})[];
|
|
874
|
-
/**
|
|
875
|
-
* Foreign key constraints to maintain referential integrity.
|
|
876
|
-
*/
|
|
877
|
-
foreignKeys?: Array<{
|
|
878
|
-
/**
|
|
879
|
-
* Optional name for the foreign key constraint.
|
|
880
|
-
*/
|
|
881
|
-
name?: string;
|
|
882
|
-
/**
|
|
883
|
-
* Local columns that reference the foreign table.
|
|
884
|
-
*/
|
|
885
|
-
columns: Array<keyof Static<T>>;
|
|
886
|
-
/**
|
|
887
|
-
* Referenced columns in the foreign table.
|
|
888
|
-
* Must be EntityColumn references from other entities.
|
|
889
|
-
*/
|
|
890
|
-
foreignColumns: Array<() => EntityColumn<any>>;
|
|
891
|
-
}>;
|
|
892
|
-
/**
|
|
893
|
-
* Additional table constraints for data validation.
|
|
894
|
-
*
|
|
895
|
-
* Constraints enforce business rules at the database level, providing
|
|
896
|
-
* an additional layer of data integrity beyond application validation.
|
|
897
|
-
*
|
|
898
|
-
* **Constraint Types**:
|
|
899
|
-
* - **Unique constraints**: Prevent duplicate values across columns
|
|
900
|
-
* - **Check constraints**: Enforce custom validation rules with SQL expressions
|
|
901
|
-
*
|
|
902
|
-
* @example
|
|
903
|
-
* ```ts
|
|
904
|
-
* constraints: [
|
|
905
|
-
* {
|
|
906
|
-
* name: "unique_user_email",
|
|
907
|
-
* columns: ["email"],
|
|
908
|
-
* unique: true
|
|
909
|
-
* },
|
|
910
|
-
* {
|
|
911
|
-
* name: "valid_age_range",
|
|
912
|
-
* columns: ["age"],
|
|
913
|
-
* check: sql`age >= 0 AND age <= 150`
|
|
914
|
-
* },
|
|
915
|
-
* {
|
|
916
|
-
* name: "unique_user_username_per_tenant",
|
|
917
|
-
* columns: ["tenantId", "username"],
|
|
918
|
-
* unique: true
|
|
919
|
-
* }
|
|
920
|
-
* ]
|
|
921
|
-
* ```
|
|
922
|
-
*/
|
|
923
|
-
constraints?: Array<{
|
|
924
|
-
/**
|
|
925
|
-
* Columns involved in this constraint.
|
|
926
|
-
*/
|
|
927
|
-
columns: Array<keyof Static<T>>;
|
|
928
|
-
/**
|
|
929
|
-
* Optional name for the constraint.
|
|
930
|
-
*/
|
|
931
|
-
name?: string;
|
|
932
|
-
/**
|
|
933
|
-
* Whether this is a unique constraint.
|
|
934
|
-
*/
|
|
935
|
-
unique?: boolean | {};
|
|
936
|
-
/**
|
|
937
|
-
* SQL expression for check constraint validation.
|
|
938
|
-
*/
|
|
939
|
-
check?: SQL;
|
|
940
|
-
}>;
|
|
941
|
-
/**
|
|
942
|
-
* Advanced Drizzle ORM configuration for complex table setups.
|
|
943
|
-
*/
|
|
944
|
-
config?: (self: BuildExtraConfigColumns<string, FromSchema<T>, "pg">) => PgTableExtraConfigValue[];
|
|
945
|
-
}
|
|
946
|
-
declare class EntityPrimitive<T extends TObject = TObject> {
|
|
947
|
-
readonly options: EntityPrimitiveOptions<T>;
|
|
948
|
-
constructor(options: EntityPrimitiveOptions<T>);
|
|
949
|
-
alias(alias: string): this;
|
|
950
|
-
get cols(): EntityColumns<T>;
|
|
951
|
-
get name(): string;
|
|
952
|
-
get schema(): T;
|
|
953
|
-
get insertSchema(): TObjectInsert<T>;
|
|
954
|
-
get updateSchema(): TObjectUpdate<T>;
|
|
955
|
-
}
|
|
956
|
-
/**
|
|
957
|
-
* Convert a schema to columns.
|
|
958
|
-
*/
|
|
959
|
-
type FromSchema<T extends TObject> = { [key in keyof T["properties"]]: PgColumnBuilderBase };
|
|
960
|
-
type EntityColumn<T extends TObject> = {
|
|
961
|
-
name: string;
|
|
962
|
-
entity: EntityPrimitive<T>;
|
|
963
|
-
};
|
|
964
|
-
type EntityColumns<T extends TObject> = { [key in keyof T["properties"]]: EntityColumn<T> };
|
|
965
|
-
//#endregion
|
|
966
|
-
//#region ../../src/orm/constants/PG_SYMBOLS.d.ts
|
|
967
|
-
declare const PG_DEFAULT: unique symbol;
|
|
968
|
-
declare const PG_PRIMARY_KEY: unique symbol;
|
|
969
|
-
declare const PG_CREATED_AT: unique symbol;
|
|
970
|
-
declare const PG_UPDATED_AT: unique symbol;
|
|
971
|
-
declare const PG_DELETED_AT: unique symbol;
|
|
972
|
-
declare const PG_VERSION: unique symbol;
|
|
973
|
-
declare const PG_IDENTITY: unique symbol;
|
|
974
|
-
declare const PG_ENUM: unique symbol;
|
|
975
|
-
declare const PG_REF: unique symbol;
|
|
976
|
-
/**
|
|
977
|
-
* @deprecated Use `PG_IDENTITY` instead.
|
|
978
|
-
*/
|
|
979
|
-
declare const PG_SERIAL: unique symbol;
|
|
980
|
-
type PgSymbols = {
|
|
981
|
-
[PG_DEFAULT]: {};
|
|
982
|
-
[PG_PRIMARY_KEY]: {};
|
|
983
|
-
[PG_CREATED_AT]: {};
|
|
984
|
-
[PG_UPDATED_AT]: {};
|
|
985
|
-
[PG_DELETED_AT]: {};
|
|
986
|
-
[PG_VERSION]: {};
|
|
987
|
-
[PG_IDENTITY]: PgIdentityOptions;
|
|
988
|
-
[PG_REF]: PgRefOptions;
|
|
989
|
-
[PG_ENUM]: PgEnumOptions;
|
|
990
|
-
/**
|
|
991
|
-
* @deprecated Use `PG_IDENTITY` instead.
|
|
992
|
-
*/
|
|
993
|
-
[PG_SERIAL]: {};
|
|
994
|
-
};
|
|
995
|
-
type PgSymbolKeys = keyof PgSymbols;
|
|
996
|
-
type PgIdentityOptions = {
|
|
997
|
-
mode: "always" | "byDefault";
|
|
998
|
-
} & PgSequenceOptions & {
|
|
999
|
-
name?: string;
|
|
1000
|
-
};
|
|
1001
|
-
interface PgEnumOptions {
|
|
1002
|
-
name?: string;
|
|
1003
|
-
description?: string;
|
|
1004
|
-
}
|
|
1005
|
-
interface PgRefOptions {
|
|
1006
|
-
ref: () => {
|
|
1007
|
-
name: string;
|
|
1008
|
-
entity: EntityPrimitive;
|
|
1009
|
-
};
|
|
1010
|
-
actions?: {
|
|
1011
|
-
onUpdate?: UpdateDeleteAction;
|
|
1012
|
-
onDelete?: UpdateDeleteAction;
|
|
1013
|
-
};
|
|
1014
|
-
}
|
|
1015
|
-
//#endregion
|
|
1016
|
-
//#region ../../src/orm/helpers/pgAttr.d.ts
|
|
1017
|
-
/**
|
|
1018
|
-
* Type representation.
|
|
1019
|
-
*/
|
|
1020
|
-
type PgAttr<T extends TSchema, TAttr extends PgSymbolKeys> = T & { [K in TAttr]: PgSymbols[K] };
|
|
1021
|
-
//#endregion
|
|
1022
|
-
//#region ../../src/orm/providers/drivers/BunPostgresProvider.d.ts
|
|
1023
|
-
declare module "alepha" {
|
|
1024
|
-
interface Env extends Partial<Static<typeof envSchema$1>> {}
|
|
1025
|
-
}
|
|
1026
|
-
declare const envSchema$1: alepha349.TObject<{
|
|
1027
|
-
/**
|
|
1028
|
-
* Main configuration for database connection.
|
|
1029
|
-
* Accept a string in the format of a Postgres connection URL.
|
|
1030
|
-
* Example: postgres://user:password@localhost:5432/database
|
|
1031
|
-
* or
|
|
1032
|
-
* Example: postgres://user:password@localhost:5432/database?sslmode=require
|
|
1033
|
-
*/
|
|
1034
|
-
DATABASE_URL: alepha349.TOptional<alepha349.TString>;
|
|
1035
|
-
/**
|
|
1036
|
-
* In addition to the DATABASE_URL, you can specify the postgres schema name.
|
|
1037
|
-
*/
|
|
1038
|
-
POSTGRES_SCHEMA: alepha349.TOptional<alepha349.TString>;
|
|
1039
|
-
}>;
|
|
1040
|
-
/**
|
|
1041
|
-
* Bun PostgreSQL provider using Drizzle ORM with Bun's native SQL client.
|
|
1042
|
-
*
|
|
1043
|
-
* This provider uses Bun's built-in SQL class for PostgreSQL connections,
|
|
1044
|
-
* which provides excellent performance on the Bun runtime.
|
|
1045
|
-
*
|
|
1046
|
-
* @example
|
|
1047
|
-
* ```ts
|
|
1048
|
-
* // Set DATABASE_URL environment variable
|
|
1049
|
-
* // DATABASE_URL=postgres://user:password@localhost:5432/database
|
|
1050
|
-
*
|
|
1051
|
-
* // Or configure programmatically
|
|
1052
|
-
* alepha.with({
|
|
1053
|
-
* provide: DatabaseProvider,
|
|
1054
|
-
* use: BunPostgresProvider,
|
|
1055
|
-
* });
|
|
1056
|
-
* ```
|
|
1057
|
-
*/
|
|
1058
|
-
//#endregion
|
|
1059
|
-
//#region ../../src/orm/providers/drivers/BunSqliteProvider.d.ts
|
|
1060
|
-
/**
|
|
1061
|
-
* Configuration options for the Bun SQLite database provider.
|
|
1062
|
-
*/
|
|
1063
|
-
declare const bunSqliteOptions: alepha349.Atom<alepha349.TObject<{
|
|
1064
|
-
path: alepha349.TOptional<alepha349.TString>;
|
|
1065
|
-
}>, "alepha.postgres.bun-sqlite.options">;
|
|
1066
|
-
type BunSqliteProviderOptions = Static<typeof bunSqliteOptions.schema>;
|
|
1067
|
-
declare module "alepha" {
|
|
1068
|
-
interface State {
|
|
1069
|
-
[bunSqliteOptions.key]: BunSqliteProviderOptions;
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
/**
|
|
1073
|
-
* Bun SQLite provider using Drizzle ORM with Bun's native SQLite client.
|
|
1074
|
-
*
|
|
1075
|
-
* This provider uses Bun's built-in `bun:sqlite` for SQLite connections,
|
|
1076
|
-
* which provides excellent performance on the Bun runtime.
|
|
1077
|
-
*
|
|
1078
|
-
* @example
|
|
1079
|
-
* ```ts
|
|
1080
|
-
* // Set DATABASE_URL environment variable
|
|
1081
|
-
* // DATABASE_URL=sqlite://./my-database.db
|
|
1082
|
-
*
|
|
1083
|
-
* // Or configure programmatically
|
|
1084
|
-
* alepha.with({
|
|
1085
|
-
* provide: DatabaseProvider,
|
|
1086
|
-
* use: BunSqliteProvider,
|
|
1087
|
-
* });
|
|
1088
|
-
*
|
|
1089
|
-
* // Or use options atom
|
|
1090
|
-
* alepha.store.mut(bunSqliteOptions, (old) => ({
|
|
1091
|
-
* ...old,
|
|
1092
|
-
* path: ":memory:",
|
|
1093
|
-
* }));
|
|
1094
|
-
* ```
|
|
1095
|
-
*/
|
|
1096
|
-
//#endregion
|
|
1097
|
-
//#region ../../src/orm/providers/drivers/NodePostgresProvider.d.ts
|
|
1098
|
-
declare module "alepha" {
|
|
1099
|
-
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
1100
|
-
}
|
|
1101
|
-
declare const envSchema: alepha349.TObject<{
|
|
1102
|
-
/**
|
|
1103
|
-
* Main configuration for database connection.
|
|
1104
|
-
* Accept a string in the format of a Postgres connection URL.
|
|
1105
|
-
* Example: postgres://user:password@localhost:5432/database
|
|
1106
|
-
* or
|
|
1107
|
-
* Example: postgres://user:password@localhost:5432/database?sslmode=require
|
|
1108
|
-
*/
|
|
1109
|
-
DATABASE_URL: alepha349.TOptional<alepha349.TString>;
|
|
1110
|
-
/**
|
|
1111
|
-
* In addition to the DATABASE_URL, you can specify the postgres schema name.
|
|
1112
|
-
*
|
|
1113
|
-
* It will monkey patch drizzle tables.
|
|
1114
|
-
*/
|
|
1115
|
-
POSTGRES_SCHEMA: alepha349.TOptional<alepha349.TString>;
|
|
1116
|
-
}>;
|
|
1117
|
-
//#endregion
|
|
1118
|
-
//#region ../../src/orm/providers/drivers/NodeSqliteProvider.d.ts
|
|
1119
|
-
/**
|
|
1120
|
-
* Configuration options for the Node.js SQLite database provider.
|
|
1121
|
-
*/
|
|
1122
|
-
declare const nodeSqliteOptions: alepha349.Atom<alepha349.TObject<{
|
|
1123
|
-
path: alepha349.TOptional<alepha349.TString>;
|
|
1124
|
-
}>, "alepha.postgres.node-sqlite.options">;
|
|
1125
|
-
type NodeSqliteProviderOptions = Static<typeof nodeSqliteOptions.schema>;
|
|
1126
|
-
declare module "alepha" {
|
|
1127
|
-
interface State {
|
|
1128
|
-
[nodeSqliteOptions.key]: NodeSqliteProviderOptions;
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
/**
|
|
1132
|
-
* Add a fake support for SQLite in Node.js based on Postgres interfaces.
|
|
1133
|
-
*
|
|
1134
|
-
* This is NOT a real SQLite provider, it's a workaround to use SQLite with Drizzle ORM.
|
|
1135
|
-
* This is NOT recommended for production use.
|
|
1136
|
-
*/
|
|
1137
|
-
//#endregion
|
|
1138
|
-
//#region ../../src/orm/index.d.ts
|
|
1139
|
-
declare module "alepha" {
|
|
1140
|
-
interface Hooks {
|
|
1141
|
-
/**
|
|
1142
|
-
* Fires before creating an entity in the repository.
|
|
1143
|
-
*/
|
|
1144
|
-
"repository:create:before": {
|
|
1145
|
-
tableName: string;
|
|
1146
|
-
data: any;
|
|
1147
|
-
};
|
|
1148
|
-
/**
|
|
1149
|
-
* Fires after creating an entity in the repository.
|
|
1150
|
-
*/
|
|
1151
|
-
"repository:create:after": {
|
|
1152
|
-
tableName: string;
|
|
1153
|
-
data: any;
|
|
1154
|
-
entity: any;
|
|
1155
|
-
};
|
|
1156
|
-
/**
|
|
1157
|
-
* Fires before updating entities in the repository.
|
|
1158
|
-
*/
|
|
1159
|
-
"repository:update:before": {
|
|
1160
|
-
tableName: string;
|
|
1161
|
-
where: any;
|
|
1162
|
-
data: any;
|
|
1163
|
-
};
|
|
1164
|
-
/**
|
|
1165
|
-
* Fires after updating entities in the repository.
|
|
1166
|
-
*/
|
|
1167
|
-
"repository:update:after": {
|
|
1168
|
-
tableName: string;
|
|
1169
|
-
where: any;
|
|
1170
|
-
data: any;
|
|
1171
|
-
entities: any[];
|
|
1172
|
-
};
|
|
1173
|
-
/**
|
|
1174
|
-
* Fires before deleting entities from the repository.
|
|
1175
|
-
*/
|
|
1176
|
-
"repository:delete:before": {
|
|
1177
|
-
tableName: string;
|
|
1178
|
-
where: any;
|
|
1179
|
-
};
|
|
1180
|
-
/**
|
|
1181
|
-
* Fires after deleting entities from the repository.
|
|
1182
|
-
*/
|
|
1183
|
-
"repository:delete:after": {
|
|
1184
|
-
tableName: string;
|
|
1185
|
-
where: any;
|
|
1186
|
-
ids: Array<string | number>;
|
|
1187
|
-
};
|
|
1188
|
-
/**
|
|
1189
|
-
* Fires before reading entities from the repository.
|
|
1190
|
-
*/
|
|
1191
|
-
"repository:read:before": {
|
|
1192
|
-
tableName: string;
|
|
1193
|
-
query: any;
|
|
1194
|
-
};
|
|
1195
|
-
/**
|
|
1196
|
-
* Fires after reading entities from the repository.
|
|
1197
|
-
*/
|
|
1198
|
-
"repository:read:after": {
|
|
1199
|
-
tableName: string;
|
|
1200
|
-
query: any;
|
|
1201
|
-
entities: any[];
|
|
1202
|
-
};
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
//#endregion
|
|
1206
1127
|
//#region ../../src/api/audits/schemas/auditResourceSchema.d.ts
|
|
1207
1128
|
/**
|
|
1208
1129
|
* Resource schema for audit log responses.
|
|
1209
1130
|
*/
|
|
1210
|
-
declare const auditResourceSchema:
|
|
1211
|
-
id: PgAttr<PgAttr<
|
|
1212
|
-
createdAt: PgAttr<PgAttr<
|
|
1213
|
-
type:
|
|
1214
|
-
action:
|
|
1215
|
-
severity: PgAttr<
|
|
1216
|
-
userId:
|
|
1217
|
-
userRealm:
|
|
1218
|
-
userEmail:
|
|
1219
|
-
resourceType:
|
|
1220
|
-
resourceId:
|
|
1221
|
-
description:
|
|
1222
|
-
metadata:
|
|
1223
|
-
ipAddress:
|
|
1224
|
-
userAgent:
|
|
1225
|
-
sessionId:
|
|
1226
|
-
requestId:
|
|
1227
|
-
success: PgAttr<
|
|
1228
|
-
errorMessage:
|
|
1131
|
+
declare const auditResourceSchema: alepha587.TObject<{
|
|
1132
|
+
id: PgAttr<PgAttr<alepha587.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
1133
|
+
createdAt: PgAttr<PgAttr<alepha587.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
1134
|
+
type: alepha587.TString;
|
|
1135
|
+
action: alepha587.TString;
|
|
1136
|
+
severity: PgAttr<alepha587.TUnsafe<"info" | "warning" | "critical">, typeof PG_DEFAULT>;
|
|
1137
|
+
userId: alepha587.TOptional<alepha587.TString>;
|
|
1138
|
+
userRealm: alepha587.TOptional<alepha587.TString>;
|
|
1139
|
+
userEmail: alepha587.TOptional<alepha587.TString>;
|
|
1140
|
+
resourceType: alepha587.TOptional<alepha587.TString>;
|
|
1141
|
+
resourceId: alepha587.TOptional<alepha587.TString>;
|
|
1142
|
+
description: alepha587.TOptional<alepha587.TString>;
|
|
1143
|
+
metadata: alepha587.TOptional<alepha587.TRecord<string, alepha587.TAny>>;
|
|
1144
|
+
ipAddress: alepha587.TOptional<alepha587.TString>;
|
|
1145
|
+
userAgent: alepha587.TOptional<alepha587.TString>;
|
|
1146
|
+
sessionId: alepha587.TOptional<alepha587.TString>;
|
|
1147
|
+
requestId: alepha587.TOptional<alepha587.TString>;
|
|
1148
|
+
success: PgAttr<alepha587.TBoolean, typeof PG_DEFAULT>;
|
|
1149
|
+
errorMessage: alepha587.TOptional<alepha587.TString>;
|
|
1229
1150
|
}>;
|
|
1230
1151
|
type AuditResource = Static<typeof auditResourceSchema>;
|
|
1231
1152
|
//#endregion
|
|
@@ -1268,7 +1189,7 @@ type AuditResource = Static<typeof auditResourceSchema>;
|
|
|
1268
1189
|
* }
|
|
1269
1190
|
* ```
|
|
1270
1191
|
*/
|
|
1271
|
-
declare const AlephaApiAudits:
|
|
1192
|
+
declare const AlephaApiAudits: alepha587.Service<alepha587.Module>;
|
|
1272
1193
|
//#endregion
|
|
1273
|
-
export { $audit,
|
|
1194
|
+
export { $audit, AdminAuditController, AlephaApiAudits, AuditEntity, AuditLogOptions, AuditPrimitive, AuditPrimitiveOptions, AuditQuery, AuditResource, AuditService, AuditSeverity, AuditStats, AuditTypeDefinition, CreateAudit, auditEntityInsertSchema, auditEntitySchema, auditQuerySchema, auditResourceSchema, auditSeveritySchema, audits, createAuditSchema };
|
|
1274
1195
|
//# sourceMappingURL=index.d.ts.map
|