alepha 0.14.4 → 0.15.1
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 +44 -102
- package/dist/api/audits/index.d.ts +331 -443
- package/dist/api/audits/index.d.ts.map +1 -1
- package/dist/api/audits/index.js +2 -2
- package/dist/api/audits/index.js.map +1 -1
- package/dist/api/files/index.d.ts +0 -113
- package/dist/api/files/index.d.ts.map +1 -1
- package/dist/api/files/index.js +2 -3
- package/dist/api/files/index.js.map +1 -1
- package/dist/api/jobs/index.d.ts +151 -262
- package/dist/api/jobs/index.d.ts.map +1 -1
- 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 +164 -276
- package/dist/api/notifications/index.d.ts.map +1 -1
- package/dist/api/notifications/index.js +4 -4
- package/dist/api/notifications/index.js.map +1 -1
- package/dist/api/parameters/index.d.ts +265 -377
- package/dist/api/parameters/index.d.ts.map +1 -1
- package/dist/api/users/index.browser.js +1 -2
- package/dist/api/users/index.browser.js.map +1 -1
- package/dist/api/users/index.d.ts +195 -301
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +203 -184
- package/dist/api/users/index.js.map +1 -1
- package/dist/api/verifications/index.d.ts.map +1 -1
- package/dist/batch/index.d.ts.map +1 -1
- package/dist/batch/index.js +1 -2
- package/dist/batch/index.js.map +1 -1
- package/dist/bucket/index.d.ts.map +1 -1
- package/dist/cache/core/index.d.ts.map +1 -1
- package/dist/cache/redis/index.d.ts.map +1 -1
- package/dist/cache/redis/index.js +2 -2
- package/dist/cache/redis/index.js.map +1 -1
- package/dist/cli/index.d.ts +5900 -165
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +1481 -639
- package/dist/cli/index.js.map +1 -1
- package/dist/command/index.d.ts +8 -4
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +29 -25
- package/dist/command/index.js.map +1 -1
- package/dist/core/index.browser.js +563 -54
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +175 -8
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +564 -54
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +563 -54
- package/dist/core/index.native.js.map +1 -1
- package/dist/datetime/index.d.ts.map +1 -1
- package/dist/datetime/index.js +4 -4
- package/dist/datetime/index.js.map +1 -1
- package/dist/email/index.d.ts +89 -42
- package/dist/email/index.d.ts.map +1 -1
- package/dist/email/index.js +129 -33
- package/dist/email/index.js.map +1 -1
- package/dist/fake/index.d.ts +7969 -2
- package/dist/fake/index.d.ts.map +1 -1
- package/dist/fake/index.js +22 -22
- package/dist/fake/index.js.map +1 -1
- package/dist/file/index.d.ts +134 -1
- package/dist/file/index.d.ts.map +1 -1
- package/dist/file/index.js +253 -1
- package/dist/file/index.js.map +1 -1
- package/dist/lock/core/index.d.ts.map +1 -1
- package/dist/lock/redis/index.d.ts.map +1 -1
- package/dist/logger/index.d.ts +1 -2
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +1 -5
- package/dist/logger/index.js.map +1 -1
- package/dist/mcp/index.d.ts +19 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +28 -4
- package/dist/mcp/index.js.map +1 -1
- package/dist/orm/chunk-DH6iiROE.js +38 -0
- package/dist/orm/index.browser.js +9 -9
- package/dist/orm/index.browser.js.map +1 -1
- package/dist/orm/index.bun.js +2821 -0
- package/dist/orm/index.bun.js.map +1 -0
- package/dist/orm/index.d.ts +318 -169
- package/dist/orm/index.d.ts.map +1 -1
- package/dist/orm/index.js +2086 -1776
- package/dist/orm/index.js.map +1 -1
- package/dist/queue/core/index.d.ts +4 -4
- package/dist/queue/core/index.d.ts.map +1 -1
- package/dist/queue/redis/index.d.ts.map +1 -1
- package/dist/redis/index.bun.js +285 -0
- package/dist/redis/index.bun.js.map +1 -0
- package/dist/redis/index.d.ts +13 -31
- package/dist/redis/index.d.ts.map +1 -1
- package/dist/redis/index.js +18 -38
- package/dist/redis/index.js.map +1 -1
- package/dist/retry/index.d.ts.map +1 -1
- package/dist/router/index.d.ts.map +1 -1
- package/dist/scheduler/index.d.ts +83 -1
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +393 -1
- package/dist/scheduler/index.js.map +1 -1
- package/dist/security/index.browser.js +5 -1
- package/dist/security/index.browser.js.map +1 -1
- package/dist/security/index.d.ts +598 -112
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +1808 -97
- package/dist/security/index.js.map +1 -1
- package/dist/server/auth/index.d.ts +1200 -175
- package/dist/server/auth/index.d.ts.map +1 -1
- package/dist/server/auth/index.js +1268 -37
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/cache/index.d.ts +6 -3
- package/dist/server/cache/index.d.ts.map +1 -1
- package/dist/server/cache/index.js +1 -1
- package/dist/server/cache/index.js.map +1 -1
- package/dist/server/compress/index.d.ts.map +1 -1
- package/dist/server/cookies/index.d.ts.map +1 -1
- package/dist/server/cookies/index.js +3 -3
- package/dist/server/cookies/index.js.map +1 -1
- package/dist/server/core/index.d.ts +115 -13
- package/dist/server/core/index.d.ts.map +1 -1
- package/dist/server/core/index.js +321 -139
- package/dist/server/core/index.js.map +1 -1
- package/dist/server/cors/index.d.ts +0 -1
- package/dist/server/cors/index.d.ts.map +1 -1
- package/dist/server/health/index.d.ts +0 -1
- package/dist/server/health/index.d.ts.map +1 -1
- package/dist/server/helmet/index.d.ts.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 +1 -2
- package/dist/server/links/index.d.ts.map +1 -1
- package/dist/server/links/index.js +14 -7
- package/dist/server/links/index.js.map +1 -1
- package/dist/server/metrics/index.d.ts +514 -1
- package/dist/server/metrics/index.d.ts.map +1 -1
- package/dist/server/metrics/index.js +4462 -4
- package/dist/server/metrics/index.js.map +1 -1
- package/dist/server/multipart/index.d.ts.map +1 -1
- package/dist/server/proxy/index.d.ts +0 -1
- package/dist/server/proxy/index.d.ts.map +1 -1
- package/dist/server/rate-limit/index.d.ts.map +1 -1
- package/dist/server/static/index.d.ts.map +1 -1
- package/dist/server/swagger/index.d.ts +1 -2
- package/dist/server/swagger/index.d.ts.map +1 -1
- package/dist/server/swagger/index.js +1 -2
- package/dist/server/swagger/index.js.map +1 -1
- package/dist/sms/index.d.ts +3 -1
- package/dist/sms/index.d.ts.map +1 -1
- package/dist/sms/index.js +10 -10
- package/dist/sms/index.js.map +1 -1
- package/dist/thread/index.d.ts +0 -1
- package/dist/thread/index.d.ts.map +1 -1
- package/dist/thread/index.js +2 -2
- package/dist/thread/index.js.map +1 -1
- package/dist/topic/core/index.d.ts.map +1 -1
- package/dist/topic/redis/index.d.ts.map +1 -1
- package/dist/vite/index.d.ts +6315 -149
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +140 -469
- package/dist/vite/index.js.map +1 -1
- package/dist/websocket/index.browser.js +9 -9
- package/dist/websocket/index.browser.js.map +1 -1
- package/dist/websocket/index.d.ts +28 -28
- package/dist/websocket/index.d.ts.map +1 -1
- package/dist/websocket/index.js +9 -9
- package/dist/websocket/index.js.map +1 -1
- package/package.json +13 -18
- package/src/api/files/controllers/AdminFileStatsController.ts +0 -1
- package/src/api/users/atoms/realmAuthSettingsAtom.ts +5 -0
- package/src/api/users/controllers/{UserRealmController.ts → RealmController.ts} +11 -11
- package/src/api/users/entities/users.ts +1 -1
- package/src/api/users/index.ts +8 -8
- package/src/api/users/primitives/{$userRealm.ts → $realm.ts} +17 -19
- package/src/api/users/providers/{UserRealmProvider.ts → RealmProvider.ts} +26 -30
- package/src/api/users/schemas/{userRealmConfigSchema.ts → realmConfigSchema.ts} +2 -2
- package/src/api/users/services/CredentialService.ts +7 -7
- package/src/api/users/services/IdentityService.ts +4 -4
- package/src/api/users/services/RegistrationService.spec.ts +25 -27
- package/src/api/users/services/RegistrationService.ts +38 -27
- package/src/api/users/services/SessionCrudService.ts +3 -3
- package/src/api/users/services/SessionService.spec.ts +3 -3
- package/src/api/users/services/SessionService.ts +27 -18
- package/src/api/users/services/UserService.ts +7 -7
- package/src/batch/providers/BatchProvider.ts +1 -2
- package/src/cli/apps/AlephaCli.ts +2 -2
- package/src/cli/apps/AlephaPackageBuilderCli.ts +47 -20
- package/src/cli/assets/apiHelloControllerTs.ts +19 -0
- package/src/cli/assets/apiIndexTs.ts +16 -0
- package/src/cli/assets/biomeJson.ts +2 -1
- package/src/cli/assets/claudeMd.ts +308 -0
- package/src/cli/assets/dummySpecTs.ts +2 -1
- package/src/cli/assets/editorconfig.ts +2 -1
- package/src/cli/assets/mainBrowserTs.ts +4 -3
- package/src/cli/assets/mainCss.ts +24 -0
- package/src/cli/assets/mainServerTs.ts +24 -0
- package/src/cli/assets/tsconfigJson.ts +2 -1
- package/src/cli/assets/webAppRouterTs.ts +16 -0
- package/src/cli/assets/webHelloComponentTsx.ts +20 -0
- package/src/cli/assets/webIndexTs.ts +16 -0
- 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 +97 -61
- package/src/cli/commands/db.ts +21 -18
- package/src/cli/commands/deploy.ts +17 -5
- package/src/cli/commands/dev.ts +26 -47
- package/src/cli/commands/gen/env.ts +1 -1
- package/src/cli/commands/init.ts +79 -25
- package/src/cli/commands/lint.ts +9 -3
- package/src/cli/commands/test.ts +8 -2
- package/src/cli/commands/typecheck.ts +5 -1
- package/src/cli/commands/verify.ts +4 -2
- 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 +82 -0
- package/src/cli/providers/ViteDevServerProvider.ts +350 -0
- package/src/cli/providers/ViteTemplateProvider.ts +27 -0
- package/src/cli/services/AlephaCliUtils.ts +72 -602
- package/src/cli/services/PackageManagerUtils.ts +308 -0
- package/src/cli/services/ProjectScaffolder.ts +329 -0
- package/src/command/helpers/Runner.ts +15 -3
- package/src/core/Alepha.ts +2 -8
- package/src/core/__tests__/Alepha-graph.spec.ts +4 -0
- package/src/core/index.shared.ts +1 -0
- package/src/core/index.ts +2 -0
- package/src/core/primitives/$hook.ts +6 -2
- package/src/core/primitives/$module.spec.ts +4 -0
- package/src/core/primitives/$module.ts +12 -0
- package/src/core/providers/AlsProvider.ts +1 -1
- package/src/core/providers/CodecManager.spec.ts +12 -6
- package/src/core/providers/CodecManager.ts +26 -6
- package/src/core/providers/EventManager.ts +169 -13
- package/src/core/providers/KeylessJsonSchemaCodec.spec.ts +878 -0
- package/src/core/providers/KeylessJsonSchemaCodec.ts +789 -0
- package/src/core/providers/SchemaValidator.spec.ts +236 -0
- package/src/core/providers/StateManager.spec.ts +27 -16
- package/src/email/providers/LocalEmailProvider.spec.ts +111 -87
- package/src/email/providers/LocalEmailProvider.ts +52 -15
- package/src/email/providers/NodemailerEmailProvider.ts +167 -56
- package/src/file/errors/FileError.ts +7 -0
- package/src/file/index.ts +9 -1
- package/src/file/providers/MemoryFileSystemProvider.ts +393 -0
- package/src/logger/providers/PrettyFormatterProvider.ts +0 -9
- package/src/mcp/errors/McpError.ts +30 -0
- package/src/mcp/index.ts +3 -0
- package/src/mcp/transports/SseMcpTransport.ts +16 -6
- package/src/orm/index.browser.ts +1 -19
- package/src/orm/index.bun.ts +77 -0
- package/src/orm/index.shared-server.ts +22 -0
- package/src/orm/index.shared.ts +15 -0
- package/src/orm/index.ts +19 -39
- package/src/orm/providers/DrizzleKitProvider.ts +3 -5
- package/src/orm/providers/drivers/BunPostgresProvider.ts +3 -5
- package/src/orm/providers/drivers/BunSqliteProvider.ts +1 -1
- package/src/orm/providers/drivers/CloudflareD1Provider.ts +4 -0
- package/src/orm/providers/drivers/DatabaseProvider.ts +4 -0
- package/src/orm/providers/drivers/PglitePostgresProvider.ts +4 -0
- package/src/orm/services/Repository.ts +19 -0
- package/src/redis/index.bun.ts +35 -0
- package/src/redis/providers/BunRedisProvider.ts +12 -43
- package/src/redis/providers/BunRedisSubscriberProvider.ts +2 -3
- package/src/redis/providers/NodeRedisProvider.ts +16 -34
- package/src/{server/security → security}/__tests__/BasicAuth.spec.ts +11 -11
- package/src/{server/security → security}/__tests__/ServerSecurityProvider-realm.spec.ts +21 -16
- package/src/{server/security/providers → security/__tests__}/ServerSecurityProvider.spec.ts +5 -5
- package/src/security/index.browser.ts +5 -0
- package/src/security/index.ts +90 -7
- package/src/security/primitives/{$realm.spec.ts → $issuer.spec.ts} +11 -11
- package/src/security/primitives/{$realm.ts → $issuer.ts} +20 -17
- package/src/security/primitives/$role.ts +5 -5
- package/src/security/primitives/$serviceAccount.spec.ts +5 -5
- package/src/security/primitives/$serviceAccount.ts +3 -3
- package/src/{server/security → security}/providers/ServerSecurityProvider.ts +5 -7
- package/src/server/auth/primitives/$auth.ts +10 -10
- package/src/server/auth/primitives/$authCredentials.ts +3 -3
- package/src/server/auth/primitives/$authGithub.ts +3 -3
- package/src/server/auth/primitives/$authGoogle.ts +3 -3
- package/src/server/auth/providers/ServerAuthProvider.ts +13 -13
- package/src/server/cache/providers/ServerCacheProvider.ts +1 -1
- package/src/server/cookies/providers/ServerCookiesProvider.ts +3 -3
- package/src/server/core/index.ts +1 -1
- 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 +92 -24
- package/src/server/core/providers/ServerBodyParserProvider.ts +19 -23
- package/src/server/core/providers/ServerLoggerProvider.ts +23 -19
- package/src/server/core/providers/ServerProvider.ts +144 -24
- package/src/server/core/providers/ServerRouterProvider.ts +259 -115
- package/src/server/core/providers/ServerTimingProvider.ts +2 -2
- package/src/server/links/atoms/apiLinksAtom.ts +7 -0
- package/src/server/links/index.browser.ts +2 -0
- package/src/server/links/index.ts +3 -1
- package/src/server/links/providers/LinkProvider.ts +1 -1
- package/src/server/swagger/index.ts +1 -1
- package/src/sms/providers/LocalSmsProvider.spec.ts +153 -111
- package/src/sms/providers/LocalSmsProvider.ts +8 -7
- package/src/vite/index.ts +3 -2
- package/src/vite/tasks/buildClient.ts +0 -1
- package/src/vite/tasks/buildServer.ts +80 -22
- package/src/vite/tasks/copyAssets.ts +5 -4
- package/src/vite/tasks/generateCloudflare.ts +7 -0
- 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/dist/server/security/index.browser.js +0 -13
- package/dist/server/security/index.browser.js.map +0 -1
- package/dist/server/security/index.d.ts +0 -173
- package/dist/server/security/index.d.ts.map +0 -1
- package/dist/server/security/index.js +0 -311
- package/dist/server/security/index.js.map +0 -1
- package/src/cli/assets/appRouterTs.ts +0 -9
- package/src/cli/assets/indexHtml.ts +0 -15
- package/src/cli/assets/mainTs.ts +0 -13
- package/src/cli/commands/format.ts +0 -17
- package/src/server/security/index.browser.ts +0 -10
- package/src/server/security/index.ts +0 -94
- package/src/vite/helpers/boot.ts +0 -106
- package/src/vite/plugins/viteAlephaDev.ts +0 -177
- package/src/vite/tasks/devServer.ts +0 -69
- package/src/vite/tasks/runAlepha.ts +0 -270
- /package/src/{server/security → security}/primitives/$basicAuth.ts +0 -0
- /package/src/{server/security → security}/providers/ServerBasicAuthProvider.ts +0 -0
package/dist/orm/index.d.ts
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { n as __reExport, t as __exportAll } from "./chunk-DH6iiROE.js";
|
|
2
|
+
import * as alepha34 from "alepha";
|
|
2
3
|
import { Alepha, AlephaError, KIND, Page, Page as Page$1, PageQuery, PageQuery as PageQuery$1, Primitive, Service, Static, StaticEncode, TBigInt, TInteger, TNull, TNumber, TNumberOptions, TObject, TObjectOptions, TOptional, TPage, TSchema, TString, TStringOptions, TUnion, TUnsafe, pageQuerySchema, pageSchema } from "alepha";
|
|
3
4
|
import { DateTime, DateTimeProvider } from "alepha/datetime";
|
|
4
|
-
import * as drizzle_orm0 from "drizzle-orm";
|
|
5
|
-
import { BuildColumns, BuildExtraConfigColumns, SQL, SQLWrapper, sql } from "drizzle-orm";
|
|
6
5
|
import * as drizzle_orm_pg_core0 from "drizzle-orm/pg-core";
|
|
7
6
|
import { LockConfig, LockStrength, PgColumn, PgColumnBuilderBase, PgDatabase, PgInsertValue, PgSchema, PgSelectBase, PgSequenceOptions, PgTableExtraConfigValue, PgTableWithColumns, PgTransaction, UpdateDeleteAction } from "drizzle-orm/pg-core";
|
|
8
|
-
import * as
|
|
7
|
+
import * as drizzle_orm0 from "drizzle-orm";
|
|
8
|
+
import { BuildColumns, BuildExtraConfigColumns, SQL, SQLWrapper, sql } from "drizzle-orm";
|
|
9
|
+
import * as alepha_logger4 from "alepha/logger";
|
|
10
|
+
import * as alepha_lock0 from "alepha/lock";
|
|
9
11
|
import * as pg$1 from "drizzle-orm/sqlite-core";
|
|
10
12
|
import { SQLiteColumnBuilderBase } from "drizzle-orm/sqlite-core";
|
|
11
|
-
import * as alepha_lock0 from "alepha/lock";
|
|
12
13
|
import { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
13
14
|
import postgres from "postgres";
|
|
14
15
|
import * as alepha_retry0 from "alepha/retry";
|
|
16
|
+
import { Database } from "bun:sqlite";
|
|
17
|
+
import { BunSQLDatabase } from "drizzle-orm/bun-sql";
|
|
18
|
+
import { BunSQLiteDatabase } from "drizzle-orm/bun-sqlite";
|
|
15
19
|
import { DrizzleD1Database } from "drizzle-orm/d1";
|
|
16
20
|
import { DatabaseSync } from "node:sqlite";
|
|
21
|
+
import { UpdateDeleteAction as UpdateDeleteAction$1 } from "drizzle-orm/pg-core/foreign-keys";
|
|
17
22
|
import { PgTransactionConfig } from "drizzle-orm/pg-core/session";
|
|
18
23
|
import * as DrizzleKit from "drizzle-kit/api";
|
|
19
|
-
import { UpdateDeleteAction as UpdateDeleteAction$1 } from "drizzle-orm/pg-core/foreign-keys";
|
|
20
24
|
import * as typebox1 from "typebox";
|
|
21
25
|
export * from "drizzle-orm/pg-core";
|
|
22
26
|
|
|
@@ -69,7 +73,7 @@ declare const updateSchema: <T extends TObject>(schema: T) => TObjectUpdate<T>;
|
|
|
69
73
|
* ```
|
|
70
74
|
*/
|
|
71
75
|
declare const $entity: {
|
|
72
|
-
<TSchema
|
|
76
|
+
<TSchema extends TObject>(options: EntityPrimitiveOptions<TSchema>): EntityPrimitive<TSchema>;
|
|
73
77
|
[KIND]: typeof EntityPrimitive;
|
|
74
78
|
};
|
|
75
79
|
interface EntityPrimitiveOptions<T extends TObject, Keys = keyof Static<T>> {
|
|
@@ -275,13 +279,6 @@ declare class DbConflictError extends DbError {
|
|
|
275
279
|
readonly status = 409;
|
|
276
280
|
}
|
|
277
281
|
//#endregion
|
|
278
|
-
//#region ../../src/orm/errors/DbEntityNotFoundError.d.ts
|
|
279
|
-
declare class DbEntityNotFoundError extends DbError {
|
|
280
|
-
readonly name = "DbEntityNotFoundError";
|
|
281
|
-
readonly status = 404;
|
|
282
|
-
constructor(entityName: string);
|
|
283
|
-
}
|
|
284
|
-
//#endregion
|
|
285
282
|
//#region ../../src/orm/errors/DbMigrationError.d.ts
|
|
286
283
|
declare class DbMigrationError extends DbError {
|
|
287
284
|
readonly name = "DbMigrationError";
|
|
@@ -299,6 +296,13 @@ declare class DbVersionMismatchError extends DbError {
|
|
|
299
296
|
constructor(table: string, id: any);
|
|
300
297
|
}
|
|
301
298
|
//#endregion
|
|
299
|
+
//#region ../../src/orm/errors/DbEntityNotFoundError.d.ts
|
|
300
|
+
declare class DbEntityNotFoundError extends DbError {
|
|
301
|
+
readonly name = "DbEntityNotFoundError";
|
|
302
|
+
readonly status = 404;
|
|
303
|
+
constructor(entityName: string);
|
|
304
|
+
}
|
|
305
|
+
//#endregion
|
|
302
306
|
//#region ../../src/orm/interfaces/FilterOperators.d.ts
|
|
303
307
|
interface FilterOperators<TValue> {
|
|
304
308
|
/**
|
|
@@ -939,6 +943,116 @@ interface PgAttrField {
|
|
|
939
943
|
one?: boolean;
|
|
940
944
|
}
|
|
941
945
|
//#endregion
|
|
946
|
+
//#region ../../src/orm/providers/DatabaseTypeProvider.d.ts
|
|
947
|
+
declare class DatabaseTypeProvider {
|
|
948
|
+
readonly attr: <T extends TSchema, Attr extends PgSymbolKeys>(type: T, attr: Attr, value?: PgSymbols[Attr]) => PgAttr<T, Attr>;
|
|
949
|
+
/**
|
|
950
|
+
* Creates a primary key with an identity column.
|
|
951
|
+
*/
|
|
952
|
+
readonly identityPrimaryKey: (identity?: PgIdentityOptions, options?: TNumberOptions) => PgAttr<PgAttr<PgAttr<TInteger, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
|
|
953
|
+
/**
|
|
954
|
+
* Creates a primary key with a big identity column. (default)
|
|
955
|
+
*/
|
|
956
|
+
readonly bigIdentityPrimaryKey: (identity?: PgIdentityOptions, options?: TNumberOptions) => PgAttr<PgAttr<PgAttr<TNumber, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
|
|
957
|
+
/**
|
|
958
|
+
* Creates a primary key with a UUID column.
|
|
959
|
+
*/
|
|
960
|
+
readonly uuidPrimaryKey: () => PgAttr<PgAttr<TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
961
|
+
/**
|
|
962
|
+
* Creates a primary key for a given type. Supports:
|
|
963
|
+
* - `t.integer()` -> PG INT (default)
|
|
964
|
+
* - `t.bigint()` -> PG BIGINT
|
|
965
|
+
* - `t.uuid()` -> PG UUID
|
|
966
|
+
*/
|
|
967
|
+
primaryKey(): PgAttr<PgAttr<TInteger, PgPrimaryKey>, PgDefault>;
|
|
968
|
+
primaryKey(type: TString, options?: TStringOptions): PgAttr<PgAttr<TString, PgPrimaryKey>, PgDefault>;
|
|
969
|
+
primaryKey(type: TInteger, options?: TNumberOptions, identity?: PgIdentityOptions): PgAttr<PgAttr<TInteger, PgPrimaryKey>, PgDefault>;
|
|
970
|
+
primaryKey(type: TNumber, options?: TNumberOptions, identity?: PgIdentityOptions): PgAttr<PgAttr<TNumber, PgPrimaryKey>, PgDefault>;
|
|
971
|
+
primaryKey(type: TBigInt, options?: TNumberOptions, identity?: PgIdentityOptions): PgAttr<PgAttr<TBigInt, PgPrimaryKey>, PgDefault>;
|
|
972
|
+
/**
|
|
973
|
+
* Wrap a schema with "default" attribute.
|
|
974
|
+
* This is used to set a default value for a column in the database.
|
|
975
|
+
*/
|
|
976
|
+
readonly default: <T extends TSchema>(type: T, value?: Static<T>) => PgAttr<T, PgDefault>;
|
|
977
|
+
/**
|
|
978
|
+
* Creates a column 'version'.
|
|
979
|
+
*
|
|
980
|
+
* This is used to track the version of a row in the database.
|
|
981
|
+
*
|
|
982
|
+
* You can use it for optimistic concurrency control (OCC) with {@link RepositoryPrimitive#save}.
|
|
983
|
+
*
|
|
984
|
+
* @see {@link RepositoryPrimitive#save}
|
|
985
|
+
* @see {@link PgVersionMismatchError}
|
|
986
|
+
*/
|
|
987
|
+
readonly version: (options?: TNumberOptions) => PgAttr<PgAttr<TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
988
|
+
/**
|
|
989
|
+
* Creates a column Created At. So just a datetime column with a default value of the current timestamp.
|
|
990
|
+
*/
|
|
991
|
+
readonly createdAt: (options?: TStringOptions) => PgAttr<PgAttr<TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
992
|
+
/**
|
|
993
|
+
* Creates a column Updated At. Like createdAt, but it is updated on every update of the row.
|
|
994
|
+
*/
|
|
995
|
+
readonly updatedAt: (options?: TStringOptions) => PgAttr<PgAttr<TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
996
|
+
/**
|
|
997
|
+
* Creates a column Deleted At for soft delete functionality.
|
|
998
|
+
* This is used to mark rows as deleted without actually removing them from the database.
|
|
999
|
+
* The column is nullable - NULL means not deleted, timestamp means deleted.
|
|
1000
|
+
*/
|
|
1001
|
+
readonly deletedAt: (options?: TStringOptions) => PgAttr<alepha34.TOptional<TString>, typeof PG_DELETED_AT>;
|
|
1002
|
+
/**
|
|
1003
|
+
* Creates a Postgres ENUM type.
|
|
1004
|
+
*
|
|
1005
|
+
* > By default, `t.enum()` is mapped to a TEXT column in Postgres.
|
|
1006
|
+
* > Using this method, you can create a real ENUM type in the database.
|
|
1007
|
+
*
|
|
1008
|
+
* @example
|
|
1009
|
+
* ```ts
|
|
1010
|
+
* const statusEnum = pg.enum(["pending", "active", "archived"], { name: "status_enum" });
|
|
1011
|
+
* ```
|
|
1012
|
+
*/
|
|
1013
|
+
readonly enum: <T extends string[]>(values: [...T], pgEnumOptions?: PgEnumOptions, typeOptions?: TStringOptions) => PgAttr<TUnsafe<T[number]>, typeof PG_ENUM>;
|
|
1014
|
+
/**
|
|
1015
|
+
* Creates a reference to another table or schema. Basically a foreign key.
|
|
1016
|
+
*/
|
|
1017
|
+
readonly ref: <T extends TSchema>(type: T, ref: () => any, actions?: {
|
|
1018
|
+
onUpdate?: UpdateDeleteAction$1;
|
|
1019
|
+
onDelete?: UpdateDeleteAction$1;
|
|
1020
|
+
}) => PgAttr<T, PgRef>;
|
|
1021
|
+
/**
|
|
1022
|
+
* Creates a page schema for a given object schema.
|
|
1023
|
+
* It's used by {@link Repository#paginate} method.
|
|
1024
|
+
*/
|
|
1025
|
+
readonly page: <T extends TObject>(resource: T, options?: TObjectOptions) => TPage<T>;
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* Wrapper of TypeProvider (`t`) for database types.
|
|
1029
|
+
*
|
|
1030
|
+
* Use `db` for improve TypeBox schema definitions with database-specific attributes.
|
|
1031
|
+
*
|
|
1032
|
+
* @example
|
|
1033
|
+
* ```ts
|
|
1034
|
+
* import { t } from "alepha";
|
|
1035
|
+
* import { db } from "alepha/orm";
|
|
1036
|
+
*
|
|
1037
|
+
* const userSchema = t.object({
|
|
1038
|
+
* id: db.primaryKey(t.uuid()),
|
|
1039
|
+
* email: t.email(),
|
|
1040
|
+
* createdAt: db.createdAt(),
|
|
1041
|
+
* });
|
|
1042
|
+
* ```
|
|
1043
|
+
*/
|
|
1044
|
+
declare const db: DatabaseTypeProvider;
|
|
1045
|
+
/**
|
|
1046
|
+
* @deprecated Use `db` instead.
|
|
1047
|
+
*/
|
|
1048
|
+
declare const pg: DatabaseTypeProvider;
|
|
1049
|
+
//#endregion
|
|
1050
|
+
//#region ../../src/orm/schemas/legacyIdSchema.d.ts
|
|
1051
|
+
/**
|
|
1052
|
+
* @deprecated Use `pg.primaryKey()` instead.
|
|
1053
|
+
*/
|
|
1054
|
+
declare const legacyIdSchema: PgAttr<PgAttr<PgAttr<alepha34.TInteger, typeof PG_PRIMARY_KEY>, typeof PG_SERIAL>, typeof PG_DEFAULT>;
|
|
1055
|
+
//#endregion
|
|
942
1056
|
//#region ../../src/orm/primitives/$sequence.d.ts
|
|
943
1057
|
/**
|
|
944
1058
|
* Creates a PostgreSQL sequence primitive for generating unique numeric values.
|
|
@@ -1022,7 +1136,7 @@ declare abstract class ModelBuilder {
|
|
|
1022
1136
|
//#endregion
|
|
1023
1137
|
//#region ../../src/orm/providers/DrizzleKitProvider.d.ts
|
|
1024
1138
|
declare class DrizzleKitProvider {
|
|
1025
|
-
protected readonly log:
|
|
1139
|
+
protected readonly log: alepha_logger4.Logger;
|
|
1026
1140
|
protected readonly alepha: Alepha;
|
|
1027
1141
|
/**
|
|
1028
1142
|
* Synchronize database with current schema definitions.
|
|
@@ -1058,11 +1172,11 @@ declare class DrizzleKitProvider {
|
|
|
1058
1172
|
*/
|
|
1059
1173
|
importDrizzleKit(): typeof DrizzleKit;
|
|
1060
1174
|
}
|
|
1061
|
-
declare const devMigrationsSchema:
|
|
1062
|
-
id:
|
|
1063
|
-
name:
|
|
1064
|
-
snapshot:
|
|
1065
|
-
created_at:
|
|
1175
|
+
declare const devMigrationsSchema: alepha34.TObject<{
|
|
1176
|
+
id: alepha34.TNumber;
|
|
1177
|
+
name: alepha34.TString;
|
|
1178
|
+
snapshot: alepha34.TString;
|
|
1179
|
+
created_at: alepha34.TString;
|
|
1066
1180
|
}>;
|
|
1067
1181
|
type DevMigrations = Static<typeof devMigrationsSchema>;
|
|
1068
1182
|
//#endregion
|
|
@@ -1070,7 +1184,7 @@ type DevMigrations = Static<typeof devMigrationsSchema>;
|
|
|
1070
1184
|
type SQLLike = SQLWrapper | string;
|
|
1071
1185
|
declare abstract class DatabaseProvider {
|
|
1072
1186
|
protected readonly alepha: Alepha;
|
|
1073
|
-
protected readonly log:
|
|
1187
|
+
protected readonly log: alepha_logger4.Logger;
|
|
1074
1188
|
protected abstract readonly builder: ModelBuilder;
|
|
1075
1189
|
protected abstract readonly kit: DrizzleKitProvider;
|
|
1076
1190
|
abstract readonly db: PgDatabase<any>;
|
|
@@ -1080,6 +1194,7 @@ declare abstract class DatabaseProvider {
|
|
|
1080
1194
|
readonly tables: Map<string, unknown>;
|
|
1081
1195
|
readonly sequences: Map<string, unknown>;
|
|
1082
1196
|
get name(): string;
|
|
1197
|
+
get driver(): string;
|
|
1083
1198
|
get schema(): string;
|
|
1084
1199
|
table<T extends TObject>(entity: EntityPrimitive<T>): PgTableWithColumns<SchemaToTableConfig<T>>;
|
|
1085
1200
|
registerEntity(entity: EntityPrimitive): void;
|
|
@@ -1187,7 +1302,7 @@ declare class QueryManager {
|
|
|
1187
1302
|
createPagination<T>(entities: T[], limit?: number, offset?: number, sort?: Array<{
|
|
1188
1303
|
column: string;
|
|
1189
1304
|
direction: "asc" | "desc";
|
|
1190
|
-
}>):
|
|
1305
|
+
}>): alepha34.Page<T>;
|
|
1191
1306
|
}
|
|
1192
1307
|
interface PgJoin {
|
|
1193
1308
|
table: string;
|
|
@@ -1221,10 +1336,12 @@ declare class PgRelationManager {
|
|
|
1221
1336
|
declare abstract class Repository<T extends TObject> {
|
|
1222
1337
|
readonly entity: EntityPrimitive<T>;
|
|
1223
1338
|
readonly provider: DatabaseProvider;
|
|
1339
|
+
protected readonly log: alepha_logger4.Logger;
|
|
1224
1340
|
protected readonly relationManager: PgRelationManager;
|
|
1225
1341
|
protected readonly queryManager: QueryManager;
|
|
1226
1342
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
1227
1343
|
protected readonly alepha: Alepha;
|
|
1344
|
+
static of<T extends TObject>(entity: EntityPrimitive<T>, provider?: typeof DatabaseProvider): new () => Repository<T>;
|
|
1228
1345
|
constructor(entity: EntityPrimitive<T>, provider?: typeof DatabaseProvider);
|
|
1229
1346
|
/**
|
|
1230
1347
|
* Represents the primary key of the table.
|
|
@@ -1622,110 +1739,6 @@ interface TransactionPrimitiveOptions<T extends any[], R> {
|
|
|
1622
1739
|
}
|
|
1623
1740
|
type TransactionContext = PgTransaction<any, any, any>;
|
|
1624
1741
|
//#endregion
|
|
1625
|
-
//#region ../../src/orm/providers/DatabaseTypeProvider.d.ts
|
|
1626
|
-
declare class DatabaseTypeProvider {
|
|
1627
|
-
readonly attr: <T extends TSchema, Attr extends PgSymbolKeys>(type: T, attr: Attr, value?: PgSymbols[Attr]) => PgAttr<T, Attr>;
|
|
1628
|
-
/**
|
|
1629
|
-
* Creates a primary key with an identity column.
|
|
1630
|
-
*/
|
|
1631
|
-
readonly identityPrimaryKey: (identity?: PgIdentityOptions, options?: TNumberOptions) => PgAttr<PgAttr<PgAttr<TInteger, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
|
|
1632
|
-
/**
|
|
1633
|
-
* Creates a primary key with a big identity column. (default)
|
|
1634
|
-
*/
|
|
1635
|
-
readonly bigIdentityPrimaryKey: (identity?: PgIdentityOptions, options?: TNumberOptions) => PgAttr<PgAttr<PgAttr<TNumber, typeof PG_PRIMARY_KEY>, typeof PG_IDENTITY>, typeof PG_DEFAULT>;
|
|
1636
|
-
/**
|
|
1637
|
-
* Creates a primary key with a UUID column.
|
|
1638
|
-
*/
|
|
1639
|
-
readonly uuidPrimaryKey: () => PgAttr<PgAttr<TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
|
|
1640
|
-
/**
|
|
1641
|
-
* Creates a primary key for a given type. Supports:
|
|
1642
|
-
* - `t.integer()` -> PG INT (default)
|
|
1643
|
-
* - `t.bigint()` -> PG BIGINT
|
|
1644
|
-
* - `t.uuid()` -> PG UUID
|
|
1645
|
-
*/
|
|
1646
|
-
primaryKey(): PgAttr<PgAttr<TInteger, PgPrimaryKey>, PgDefault>;
|
|
1647
|
-
primaryKey(type: TString, options?: TStringOptions): PgAttr<PgAttr<TString, PgPrimaryKey>, PgDefault>;
|
|
1648
|
-
primaryKey(type: TInteger, options?: TNumberOptions, identity?: PgIdentityOptions): PgAttr<PgAttr<TInteger, PgPrimaryKey>, PgDefault>;
|
|
1649
|
-
primaryKey(type: TNumber, options?: TNumberOptions, identity?: PgIdentityOptions): PgAttr<PgAttr<TNumber, PgPrimaryKey>, PgDefault>;
|
|
1650
|
-
primaryKey(type: TBigInt, options?: TNumberOptions, identity?: PgIdentityOptions): PgAttr<PgAttr<TBigInt, PgPrimaryKey>, PgDefault>;
|
|
1651
|
-
/**
|
|
1652
|
-
* Wrap a schema with "default" attribute.
|
|
1653
|
-
* This is used to set a default value for a column in the database.
|
|
1654
|
-
*/
|
|
1655
|
-
readonly default: <T extends TSchema>(type: T, value?: Static<T>) => PgAttr<T, PgDefault>;
|
|
1656
|
-
/**
|
|
1657
|
-
* Creates a column 'version'.
|
|
1658
|
-
*
|
|
1659
|
-
* This is used to track the version of a row in the database.
|
|
1660
|
-
*
|
|
1661
|
-
* You can use it for optimistic concurrency control (OCC) with {@link RepositoryPrimitive#save}.
|
|
1662
|
-
*
|
|
1663
|
-
* @see {@link RepositoryPrimitive#save}
|
|
1664
|
-
* @see {@link PgVersionMismatchError}
|
|
1665
|
-
*/
|
|
1666
|
-
readonly version: (options?: TNumberOptions) => PgAttr<PgAttr<TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
|
|
1667
|
-
/**
|
|
1668
|
-
* Creates a column Created At. So just a datetime column with a default value of the current timestamp.
|
|
1669
|
-
*/
|
|
1670
|
-
readonly createdAt: (options?: TStringOptions) => PgAttr<PgAttr<TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
|
|
1671
|
-
/**
|
|
1672
|
-
* Creates a column Updated At. Like createdAt, but it is updated on every update of the row.
|
|
1673
|
-
*/
|
|
1674
|
-
readonly updatedAt: (options?: TStringOptions) => PgAttr<PgAttr<TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
|
|
1675
|
-
/**
|
|
1676
|
-
* Creates a column Deleted At for soft delete functionality.
|
|
1677
|
-
* This is used to mark rows as deleted without actually removing them from the database.
|
|
1678
|
-
* The column is nullable - NULL means not deleted, timestamp means deleted.
|
|
1679
|
-
*/
|
|
1680
|
-
readonly deletedAt: (options?: TStringOptions) => PgAttr<alepha2.TOptional<TString>, typeof PG_DELETED_AT>;
|
|
1681
|
-
/**
|
|
1682
|
-
* Creates a Postgres ENUM type.
|
|
1683
|
-
*
|
|
1684
|
-
* > By default, `t.enum()` is mapped to a TEXT column in Postgres.
|
|
1685
|
-
* > Using this method, you can create a real ENUM type in the database.
|
|
1686
|
-
*
|
|
1687
|
-
* @example
|
|
1688
|
-
* ```ts
|
|
1689
|
-
* const statusEnum = pg.enum(["pending", "active", "archived"], { name: "status_enum" });
|
|
1690
|
-
* ```
|
|
1691
|
-
*/
|
|
1692
|
-
readonly enum: <T extends string[]>(values: [...T], pgEnumOptions?: PgEnumOptions, typeOptions?: TStringOptions) => PgAttr<TUnsafe<T[number]>, typeof PG_ENUM>;
|
|
1693
|
-
/**
|
|
1694
|
-
* Creates a reference to another table or schema. Basically a foreign key.
|
|
1695
|
-
*/
|
|
1696
|
-
readonly ref: <T extends TSchema>(type: T, ref: () => any, actions?: {
|
|
1697
|
-
onUpdate?: UpdateDeleteAction$1;
|
|
1698
|
-
onDelete?: UpdateDeleteAction$1;
|
|
1699
|
-
}) => PgAttr<T, PgRef>;
|
|
1700
|
-
/**
|
|
1701
|
-
* Creates a page schema for a given object schema.
|
|
1702
|
-
* It's used by {@link Repository#paginate} method.
|
|
1703
|
-
*/
|
|
1704
|
-
readonly page: <T extends TObject>(resource: T, options?: TObjectOptions) => TPage<T>;
|
|
1705
|
-
}
|
|
1706
|
-
/**
|
|
1707
|
-
* Wrapper of TypeProvider (`t`) for database types.
|
|
1708
|
-
*
|
|
1709
|
-
* Use `db` for improve TypeBox schema definitions with database-specific attributes.
|
|
1710
|
-
*
|
|
1711
|
-
* @example
|
|
1712
|
-
* ```ts
|
|
1713
|
-
* import { t } from "alepha";
|
|
1714
|
-
* import { db } from "alepha/orm";
|
|
1715
|
-
*
|
|
1716
|
-
* const userSchema = t.object({
|
|
1717
|
-
* id: db.primaryKey(t.uuid()),
|
|
1718
|
-
* email: t.email(),
|
|
1719
|
-
* createdAt: db.createdAt(),
|
|
1720
|
-
* });
|
|
1721
|
-
* ```
|
|
1722
|
-
*/
|
|
1723
|
-
declare const db: DatabaseTypeProvider;
|
|
1724
|
-
/**
|
|
1725
|
-
* @deprecated Use `db` instead.
|
|
1726
|
-
*/
|
|
1727
|
-
declare const pg: DatabaseTypeProvider;
|
|
1728
|
-
//#endregion
|
|
1729
1742
|
//#region ../../src/orm/services/SqliteModelBuilder.d.ts
|
|
1730
1743
|
declare class SqliteModelBuilder extends ModelBuilder {
|
|
1731
1744
|
buildTable(entity: EntityPrimitive<any>, options: {
|
|
@@ -1926,7 +1939,7 @@ interface D1ExecResult {
|
|
|
1926
1939
|
*/
|
|
1927
1940
|
declare class CloudflareD1Provider extends DatabaseProvider {
|
|
1928
1941
|
protected readonly kit: DrizzleKitProvider;
|
|
1929
|
-
protected readonly log:
|
|
1942
|
+
protected readonly log: alepha_logger4.Logger;
|
|
1930
1943
|
protected readonly builder: SqliteModelBuilder;
|
|
1931
1944
|
protected readonly env: {
|
|
1932
1945
|
DATABASE_URL: string;
|
|
@@ -1934,11 +1947,12 @@ declare class CloudflareD1Provider extends DatabaseProvider {
|
|
|
1934
1947
|
protected d1?: D1Database;
|
|
1935
1948
|
protected drizzleDb?: DrizzleD1Database;
|
|
1936
1949
|
get name(): string;
|
|
1950
|
+
get driver(): string;
|
|
1937
1951
|
readonly dialect = "sqlite";
|
|
1938
1952
|
get url(): string;
|
|
1939
1953
|
get db(): PgDatabase<any>;
|
|
1940
1954
|
execute(query: SQLLike): Promise<Array<Record<string, unknown>>>;
|
|
1941
|
-
protected readonly onStart:
|
|
1955
|
+
protected readonly onStart: alepha34.HookPrimitive<"start">;
|
|
1942
1956
|
protected executeMigrations(migrationsFolder: string): Promise<void>;
|
|
1943
1957
|
/**
|
|
1944
1958
|
* Override development migration to skip sync (not supported on D1).
|
|
@@ -1952,6 +1966,28 @@ declare class CloudflareD1Provider extends DatabaseProvider {
|
|
|
1952
1966
|
protected runTestMigration(): Promise<void>;
|
|
1953
1967
|
}
|
|
1954
1968
|
//#endregion
|
|
1969
|
+
//#region ../../src/orm/providers/RepositoryProvider.d.ts
|
|
1970
|
+
declare class RepositoryProvider {
|
|
1971
|
+
protected readonly alepha: Alepha;
|
|
1972
|
+
protected readonly registry: Map<EntityPrimitive<any>, Service<Repository<any>>>;
|
|
1973
|
+
getRepositories(provider?: DatabaseProvider): Repository<TObject<alepha34.TProperties>>[];
|
|
1974
|
+
getRepository<T extends TObject>(entity: EntityPrimitive<T>): Repository<T>;
|
|
1975
|
+
createClassRepository<T extends TObject>(entity: EntityPrimitive<T>): Service<Repository<T>>;
|
|
1976
|
+
}
|
|
1977
|
+
//#endregion
|
|
1978
|
+
//#region ../../src/orm/types/schema.d.ts
|
|
1979
|
+
/**
|
|
1980
|
+
* Postgres schema type.
|
|
1981
|
+
*/
|
|
1982
|
+
declare const schema: <TDocument extends TSchema>(name: string, document: TDocument) => drizzle_orm0.$Type<drizzle_orm_pg_core0.PgCustomColumnBuilder<{
|
|
1983
|
+
name: string;
|
|
1984
|
+
dataType: "custom";
|
|
1985
|
+
columnType: "PgCustomColumn";
|
|
1986
|
+
data: typebox1.StaticType<[], "Decode", {}, {}, TDocument>;
|
|
1987
|
+
driverParam: string;
|
|
1988
|
+
enumValues: undefined;
|
|
1989
|
+
}>, typebox1.StaticType<[], "Decode", {}, {}, TDocument>>;
|
|
1990
|
+
//#endregion
|
|
1955
1991
|
//#region ../../src/orm/services/PostgresModelBuilder.d.ts
|
|
1956
1992
|
declare class PostgresModelBuilder extends ModelBuilder {
|
|
1957
1993
|
protected schemas: Map<string, drizzle_orm_pg_core0.PgSchema<string>>;
|
|
@@ -1987,11 +2023,143 @@ declare class PostgresModelBuilder extends ModelBuilder {
|
|
|
1987
2023
|
}> | drizzle_orm_pg_core0.PgTimestampStringBuilderInitial<string> | drizzle_orm_pg_core0.PgDateStringBuilderInitial<string> | drizzle_orm_pg_core0.PgTextBuilderInitial<string, [string, ...string[]]>;
|
|
1988
2024
|
}
|
|
1989
2025
|
//#endregion
|
|
2026
|
+
//#region ../../src/orm/providers/drivers/BunPostgresProvider.d.ts
|
|
2027
|
+
declare module "alepha" {
|
|
2028
|
+
interface Env extends Partial<Static<typeof envSchema$1>> {}
|
|
2029
|
+
}
|
|
2030
|
+
declare const envSchema$1: alepha34.TObject<{
|
|
2031
|
+
/**
|
|
2032
|
+
* Main configuration for database connection.
|
|
2033
|
+
* Accept a string in the format of a Postgres connection URL.
|
|
2034
|
+
* Example: postgres://user:password@localhost:5432/database
|
|
2035
|
+
* or
|
|
2036
|
+
* Example: postgres://user:password@localhost:5432/database?sslmode=require
|
|
2037
|
+
*/
|
|
2038
|
+
DATABASE_URL: alepha34.TOptional<alepha34.TString>;
|
|
2039
|
+
/**
|
|
2040
|
+
* In addition to the DATABASE_URL, you can specify the postgres schema name.
|
|
2041
|
+
*/
|
|
2042
|
+
POSTGRES_SCHEMA: alepha34.TOptional<alepha34.TString>;
|
|
2043
|
+
}>;
|
|
2044
|
+
/**
|
|
2045
|
+
* Bun PostgreSQL provider using Drizzle ORM with Bun's native SQL client.
|
|
2046
|
+
*
|
|
2047
|
+
* This provider uses Bun's built-in SQL class for PostgreSQL connections,
|
|
2048
|
+
* which provides excellent performance on the Bun runtime.
|
|
2049
|
+
*
|
|
2050
|
+
* @example
|
|
2051
|
+
* ```ts
|
|
2052
|
+
* // Set DATABASE_URL environment variable
|
|
2053
|
+
* // DATABASE_URL=postgres://user:password@localhost:5432/database
|
|
2054
|
+
*
|
|
2055
|
+
* // Or configure programmatically
|
|
2056
|
+
* alepha.with({
|
|
2057
|
+
* provide: DatabaseProvider,
|
|
2058
|
+
* use: BunPostgresProvider,
|
|
2059
|
+
* });
|
|
2060
|
+
* ```
|
|
2061
|
+
*/
|
|
2062
|
+
declare class BunPostgresProvider extends DatabaseProvider {
|
|
2063
|
+
protected readonly log: alepha_logger4.Logger;
|
|
2064
|
+
protected readonly env: {
|
|
2065
|
+
DATABASE_URL?: string | undefined;
|
|
2066
|
+
POSTGRES_SCHEMA?: string | undefined;
|
|
2067
|
+
};
|
|
2068
|
+
protected readonly kit: DrizzleKitProvider;
|
|
2069
|
+
protected readonly builder: PostgresModelBuilder;
|
|
2070
|
+
protected client?: Bun.SQL;
|
|
2071
|
+
protected bunDb?: BunSQLDatabase;
|
|
2072
|
+
readonly dialect = "postgresql";
|
|
2073
|
+
get name(): string;
|
|
2074
|
+
/**
|
|
2075
|
+
* In testing mode, the schema name will be generated and deleted after the test.
|
|
2076
|
+
*/
|
|
2077
|
+
protected schemaForTesting: string | undefined;
|
|
2078
|
+
get url(): string;
|
|
2079
|
+
/**
|
|
2080
|
+
* Execute a SQL statement.
|
|
2081
|
+
*/
|
|
2082
|
+
execute(statement: SQLLike): Promise<Array<Record<string, unknown>>>;
|
|
2083
|
+
/**
|
|
2084
|
+
* Get Postgres schema used by this provider.
|
|
2085
|
+
*/
|
|
2086
|
+
get schema(): string;
|
|
2087
|
+
/**
|
|
2088
|
+
* Get the Drizzle Postgres database instance.
|
|
2089
|
+
*/
|
|
2090
|
+
get db(): PgDatabase<any>;
|
|
2091
|
+
protected executeMigrations(migrationsFolder: string): Promise<void>;
|
|
2092
|
+
protected readonly onStart: alepha34.HookPrimitive<"start">;
|
|
2093
|
+
protected readonly onStop: alepha34.HookPrimitive<"stop">;
|
|
2094
|
+
connect(): Promise<void>;
|
|
2095
|
+
close(): Promise<void>;
|
|
2096
|
+
protected migrateLock: alepha_lock0.LockPrimitive<() => Promise<void>>;
|
|
2097
|
+
}
|
|
2098
|
+
//#endregion
|
|
2099
|
+
//#region ../../src/orm/providers/drivers/BunSqliteProvider.d.ts
|
|
2100
|
+
/**
|
|
2101
|
+
* Configuration options for the Bun SQLite database provider.
|
|
2102
|
+
*/
|
|
2103
|
+
declare const bunSqliteOptions: alepha34.Atom<alepha34.TObject<{
|
|
2104
|
+
path: alepha34.TOptional<alepha34.TString>;
|
|
2105
|
+
}>, "alepha.postgres.bun-sqlite.options">;
|
|
2106
|
+
type BunSqliteProviderOptions = Static<typeof bunSqliteOptions.schema>;
|
|
2107
|
+
declare module "alepha" {
|
|
2108
|
+
interface State {
|
|
2109
|
+
[bunSqliteOptions.key]: BunSqliteProviderOptions;
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
/**
|
|
2113
|
+
* Bun SQLite provider using Drizzle ORM with Bun's native SQLite client.
|
|
2114
|
+
*
|
|
2115
|
+
* This provider uses Bun's built-in `bun:sqlite` for SQLite connections,
|
|
2116
|
+
* which provides excellent performance on the Bun runtime.
|
|
2117
|
+
*
|
|
2118
|
+
* @example
|
|
2119
|
+
* ```ts
|
|
2120
|
+
* // Set DATABASE_URL environment variable
|
|
2121
|
+
* // DATABASE_URL=sqlite://./my-database.db
|
|
2122
|
+
*
|
|
2123
|
+
* // Or configure programmatically
|
|
2124
|
+
* alepha.with({
|
|
2125
|
+
* provide: DatabaseProvider,
|
|
2126
|
+
* use: BunSqliteProvider,
|
|
2127
|
+
* });
|
|
2128
|
+
*
|
|
2129
|
+
* // Or use options atom
|
|
2130
|
+
* alepha.store.mut(bunSqliteOptions, (old) => ({
|
|
2131
|
+
* ...old,
|
|
2132
|
+
* path: ":memory:",
|
|
2133
|
+
* }));
|
|
2134
|
+
* ```
|
|
2135
|
+
*/
|
|
2136
|
+
declare class BunSqliteProvider extends DatabaseProvider {
|
|
2137
|
+
protected readonly kit: DrizzleKitProvider;
|
|
2138
|
+
protected readonly log: alepha_logger4.Logger;
|
|
2139
|
+
protected readonly env: {
|
|
2140
|
+
DATABASE_URL?: string | undefined;
|
|
2141
|
+
};
|
|
2142
|
+
protected readonly builder: SqliteModelBuilder;
|
|
2143
|
+
protected readonly options: Readonly<{
|
|
2144
|
+
path?: string | undefined;
|
|
2145
|
+
}>;
|
|
2146
|
+
protected sqlite?: Database;
|
|
2147
|
+
protected bunDb?: BunSQLiteDatabase;
|
|
2148
|
+
get name(): string;
|
|
2149
|
+
readonly dialect = "sqlite";
|
|
2150
|
+
get url(): string;
|
|
2151
|
+
get db(): PgDatabase<any>;
|
|
2152
|
+
execute(query: SQLLike): Promise<Array<Record<string, unknown>>>;
|
|
2153
|
+
protected readonly onStart: alepha34.HookPrimitive<"start">;
|
|
2154
|
+
protected readonly onStop: alepha34.HookPrimitive<"stop">;
|
|
2155
|
+
protected executeMigrations(migrationsFolder: string): Promise<void>;
|
|
2156
|
+
}
|
|
2157
|
+
//#endregion
|
|
1990
2158
|
//#region ../../src/orm/providers/drivers/NodePostgresProvider.d.ts
|
|
1991
2159
|
declare module "alepha" {
|
|
1992
2160
|
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
1993
2161
|
}
|
|
1994
|
-
declare const envSchema:
|
|
2162
|
+
declare const envSchema: alepha34.TObject<{
|
|
1995
2163
|
/**
|
|
1996
2164
|
* Main configuration for database connection.
|
|
1997
2165
|
* Accept a string in the format of a Postgres connection URL.
|
|
@@ -1999,17 +2167,17 @@ declare const envSchema: alepha2.TObject<{
|
|
|
1999
2167
|
* or
|
|
2000
2168
|
* Example: postgres://user:password@localhost:5432/database?sslmode=require
|
|
2001
2169
|
*/
|
|
2002
|
-
DATABASE_URL:
|
|
2170
|
+
DATABASE_URL: alepha34.TOptional<alepha34.TString>;
|
|
2003
2171
|
/**
|
|
2004
2172
|
* In addition to the DATABASE_URL, you can specify the postgres schema name.
|
|
2005
2173
|
*
|
|
2006
2174
|
* It will monkey patch drizzle tables.
|
|
2007
2175
|
*/
|
|
2008
|
-
POSTGRES_SCHEMA:
|
|
2176
|
+
POSTGRES_SCHEMA: alepha34.TOptional<alepha34.TString>;
|
|
2009
2177
|
}>;
|
|
2010
2178
|
declare class NodePostgresProvider extends DatabaseProvider {
|
|
2011
2179
|
static readonly SSL_MODES: readonly ["require", "allow", "prefer", "verify-full"];
|
|
2012
|
-
protected readonly log:
|
|
2180
|
+
protected readonly log: alepha_logger4.Logger;
|
|
2013
2181
|
protected readonly env: {
|
|
2014
2182
|
DATABASE_URL?: string | undefined;
|
|
2015
2183
|
POSTGRES_SCHEMA?: string | undefined;
|
|
@@ -2038,8 +2206,8 @@ declare class NodePostgresProvider extends DatabaseProvider {
|
|
|
2038
2206
|
*/
|
|
2039
2207
|
get db(): PostgresJsDatabase;
|
|
2040
2208
|
protected executeMigrations(migrationsFolder: string): Promise<void>;
|
|
2041
|
-
protected readonly onStart:
|
|
2042
|
-
protected readonly onStop:
|
|
2209
|
+
protected readonly onStart: alepha34.HookPrimitive<"start">;
|
|
2210
|
+
protected readonly onStop: alepha34.HookPrimitive<"stop">;
|
|
2043
2211
|
connect(): Promise<void>;
|
|
2044
2212
|
close(): Promise<void>;
|
|
2045
2213
|
protected migrateLock: alepha_lock0.LockPrimitive<() => Promise<void>>;
|
|
@@ -2054,8 +2222,8 @@ declare class NodePostgresProvider extends DatabaseProvider {
|
|
|
2054
2222
|
/**
|
|
2055
2223
|
* Configuration options for the Node.js SQLite database provider.
|
|
2056
2224
|
*/
|
|
2057
|
-
declare const nodeSqliteOptions:
|
|
2058
|
-
path:
|
|
2225
|
+
declare const nodeSqliteOptions: alepha34.Atom<alepha34.TObject<{
|
|
2226
|
+
path: alepha34.TOptional<alepha34.TString>;
|
|
2059
2227
|
}>, "alepha.postgres.node-sqlite.options">;
|
|
2060
2228
|
type NodeSqliteProviderOptions = Static<typeof nodeSqliteOptions.schema>;
|
|
2061
2229
|
declare module "alepha" {
|
|
@@ -2071,7 +2239,7 @@ declare module "alepha" {
|
|
|
2071
2239
|
*/
|
|
2072
2240
|
declare class NodeSqliteProvider extends DatabaseProvider {
|
|
2073
2241
|
protected readonly kit: DrizzleKitProvider;
|
|
2074
|
-
protected readonly log:
|
|
2242
|
+
protected readonly log: alepha_logger4.Logger;
|
|
2075
2243
|
protected readonly env: {
|
|
2076
2244
|
DATABASE_URL?: string | undefined;
|
|
2077
2245
|
};
|
|
@@ -2085,39 +2253,12 @@ declare class NodeSqliteProvider extends DatabaseProvider {
|
|
|
2085
2253
|
get url(): string;
|
|
2086
2254
|
execute(query: SQLLike): Promise<Array<Record<string, unknown>>>;
|
|
2087
2255
|
readonly db: PgDatabase<any>;
|
|
2088
|
-
protected readonly onStart:
|
|
2256
|
+
protected readonly onStart: alepha34.HookPrimitive<"start">;
|
|
2089
2257
|
protected executeMigrations(migrationsFolder: string): Promise<void>;
|
|
2090
2258
|
}
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
declare class RepositoryProvider {
|
|
2094
|
-
protected readonly alepha: Alepha;
|
|
2095
|
-
protected readonly registry: Map<EntityPrimitive<any>, Service<Repository<any>>>;
|
|
2096
|
-
getRepositories(provider?: DatabaseProvider): Repository<TObject<alepha2.TProperties>>[];
|
|
2097
|
-
getRepository<T extends TObject>(entity: EntityPrimitive<T>): Repository<T>;
|
|
2098
|
-
createClassRepository<T extends TObject>(entity: EntityPrimitive<T>): Service<Repository<T>>;
|
|
2259
|
+
declare namespace index_d_exports {
|
|
2260
|
+
export { $entity, $repository, $sequence, $transaction, AlephaPostgres, BunPostgresProvider, BunSqliteProvider, BunSqliteProviderOptions, CloudflareD1Provider, D1Database, D1ExecResult, D1PreparedStatement, D1Result, DatabaseProvider, DatabaseTypeProvider, DbConflictError, DbEntityNotFoundError, DbError, DbMigrationError, DbVersionMismatchError, DrizzleKitProvider, EntityColumn, EntityColumns, EntityPrimitive, EntityPrimitiveOptions, FilterOperators, FromSchema, NodePostgresProvider, NodeSqliteProvider, NodeSqliteProviderOptions, OrderBy, OrderByClause, OrderDirection, PG_CREATED_AT, PG_DEFAULT, PG_DELETED_AT, PG_ENUM, PG_IDENTITY, PG_PRIMARY_KEY, PG_REF, PG_SERIAL, PG_UPDATED_AT, PG_VERSION, Page, PageQuery, PgAttr, PgAttrField, PgDefault, PgEnumOptions, PgIdentityOptions, PgPrimaryKey, PgQuery, PgQueryRelations, PgQueryWhere, PgQueryWhereOrSQL, PgRef, PgRefOptions, PgRelation, PgRelationMap, PgStatic, PgSymbolKeys, PgSymbols, Repository, RepositoryProvider, SQLLike, SchemaToTableConfig, SequencePrimitive, SequencePrimitiveOptions, StatementOptions, TObjectInsert, TObjectUpdate, TransactionContext, TransactionPrimitiveOptions, buildQueryString, bunSqliteOptions, db, drizzle_orm0 as drizzle, getAttrFields, insertSchema, legacyIdSchema, nodeSqliteOptions, pageQuerySchema, pageSchema, parseQueryString, pg, pgAttr, schema, sql, updateSchema };
|
|
2099
2261
|
}
|
|
2100
|
-
//#endregion
|
|
2101
|
-
//#region ../../src/orm/schemas/legacyIdSchema.d.ts
|
|
2102
|
-
/**
|
|
2103
|
-
* @deprecated Use `pg.primaryKey()` instead.
|
|
2104
|
-
*/
|
|
2105
|
-
declare const legacyIdSchema: PgAttr<PgAttr<PgAttr<alepha2.TInteger, typeof PG_PRIMARY_KEY>, typeof PG_SERIAL>, typeof PG_DEFAULT>;
|
|
2106
|
-
//#endregion
|
|
2107
|
-
//#region ../../src/orm/types/schema.d.ts
|
|
2108
|
-
/**
|
|
2109
|
-
* Postgres schema type.
|
|
2110
|
-
*/
|
|
2111
|
-
declare const schema: <TDocument extends TSchema>(name: string, document: TDocument) => drizzle_orm0.$Type<drizzle_orm_pg_core0.PgCustomColumnBuilder<{
|
|
2112
|
-
name: string;
|
|
2113
|
-
dataType: "custom";
|
|
2114
|
-
columnType: "PgCustomColumn";
|
|
2115
|
-
data: typebox1.StaticType<[], "Decode", {}, {}, TDocument>;
|
|
2116
|
-
driverParam: string;
|
|
2117
|
-
enumValues: undefined;
|
|
2118
|
-
}>, typebox1.StaticType<[], "Decode", {}, {}, TDocument>>;
|
|
2119
|
-
//#endregion
|
|
2120
|
-
//#region ../../src/orm/index.d.ts
|
|
2121
2262
|
declare module "alepha" {
|
|
2122
2263
|
interface Hooks {
|
|
2123
2264
|
/**
|
|
@@ -2187,6 +2328,10 @@ declare module "alepha" {
|
|
|
2187
2328
|
/**
|
|
2188
2329
|
* Postgres client based on Drizzle ORM, Alepha type-safe friendly.
|
|
2189
2330
|
*
|
|
2331
|
+
* Automatically selects the appropriate provider based on runtime:
|
|
2332
|
+
* - Bun: Uses `BunPostgresProvider` or `BunSqliteProvider`
|
|
2333
|
+
* - Node.js: Uses `NodePostgresProvider` or `NodeSqliteProvider`
|
|
2334
|
+
*
|
|
2190
2335
|
* ```ts
|
|
2191
2336
|
* import { t } from "alepha";
|
|
2192
2337
|
* import { $entity, $repository, db } from "alepha/postgres";
|
|
@@ -2225,9 +2370,13 @@ declare module "alepha" {
|
|
|
2225
2370
|
* @see {@link $sequence}
|
|
2226
2371
|
* @see {@link $repository}
|
|
2227
2372
|
* @see {@link $transaction}
|
|
2373
|
+
* @see {@link NodePostgresProvider} - Node.js Postgres implementation
|
|
2374
|
+
* @see {@link NodeSqliteProvider} - Node.js SQLite implementation
|
|
2375
|
+
* @see {@link BunPostgresProvider} - Bun Postgres implementation
|
|
2376
|
+
* @see {@link BunSqliteProvider} - Bun SQLite implementation
|
|
2228
2377
|
* @module alepha.postgres
|
|
2229
2378
|
*/
|
|
2230
|
-
declare const AlephaPostgres:
|
|
2379
|
+
declare const AlephaPostgres: alepha34.Service<alepha34.Module>;
|
|
2231
2380
|
//#endregion
|
|
2232
|
-
export { $entity, $repository, $sequence, $transaction, AlephaPostgres, CloudflareD1Provider, D1Database, D1ExecResult, D1PreparedStatement, D1Result, DatabaseProvider, DatabaseTypeProvider, DbConflictError, DbEntityNotFoundError, DbError, DbMigrationError, DbVersionMismatchError, DrizzleKitProvider, EntityColumn, EntityColumns, EntityPrimitive, EntityPrimitiveOptions, FilterOperators, FromSchema, NodePostgresProvider, NodeSqliteProvider, NodeSqliteProviderOptions, OrderBy, OrderByClause, OrderDirection, PG_CREATED_AT, PG_DEFAULT, PG_DELETED_AT, PG_ENUM, PG_IDENTITY, PG_PRIMARY_KEY, PG_REF, PG_SERIAL, PG_UPDATED_AT, PG_VERSION, type Page, type PageQuery, PgAttr, PgAttrField, PgDefault, PgEnumOptions, PgIdentityOptions, PgPrimaryKey, PgQuery, PgQueryRelations, PgQueryWhere, PgQueryWhereOrSQL, PgRef, PgRefOptions, PgRelation, PgRelationMap, PgStatic, PgSymbolKeys, PgSymbols, Repository, RepositoryProvider, SQLLike, SchemaToTableConfig, SequencePrimitive, SequencePrimitiveOptions, StatementOptions, TObjectInsert, TObjectUpdate, TransactionContext, TransactionPrimitiveOptions, buildQueryString, db, drizzle_orm0 as drizzle, getAttrFields, insertSchema, legacyIdSchema, nodeSqliteOptions, pageQuerySchema, pageSchema, parseQueryString, pg, pgAttr, schema, sql, updateSchema };
|
|
2381
|
+
export { $entity, $repository, $sequence, $transaction, AlephaPostgres, BunPostgresProvider, BunSqliteProvider, BunSqliteProviderOptions, CloudflareD1Provider, D1Database, D1ExecResult, D1PreparedStatement, D1Result, DatabaseProvider, DatabaseTypeProvider, DbConflictError, DbEntityNotFoundError, DbError, DbMigrationError, DbVersionMismatchError, DrizzleKitProvider, EntityColumn, EntityColumns, EntityPrimitive, EntityPrimitiveOptions, FilterOperators, FromSchema, NodePostgresProvider, NodeSqliteProvider, NodeSqliteProviderOptions, OrderBy, OrderByClause, OrderDirection, PG_CREATED_AT, PG_DEFAULT, PG_DELETED_AT, PG_ENUM, PG_IDENTITY, PG_PRIMARY_KEY, PG_REF, PG_SERIAL, PG_UPDATED_AT, PG_VERSION, type Page, type PageQuery, PgAttr, PgAttrField, PgDefault, PgEnumOptions, PgIdentityOptions, PgPrimaryKey, PgQuery, PgQueryRelations, PgQueryWhere, PgQueryWhereOrSQL, PgRef, PgRefOptions, PgRelation, PgRelationMap, PgStatic, PgSymbolKeys, PgSymbols, Repository, RepositoryProvider, SQLLike, SchemaToTableConfig, SequencePrimitive, SequencePrimitiveOptions, StatementOptions, TObjectInsert, TObjectUpdate, TransactionContext, TransactionPrimitiveOptions, buildQueryString, bunSqliteOptions, db, drizzle_orm0 as drizzle, getAttrFields, insertSchema, legacyIdSchema, nodeSqliteOptions, pageQuerySchema, pageSchema, parseQueryString, pg, pgAttr, schema, sql, updateSchema };
|
|
2233
2382
|
//# sourceMappingURL=index.d.ts.map
|