@alchemy.run/drizzle 2.0.0-beta.85 → 2.0.0-beta.86
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/lib/Cloudflare.d.ts.map +1 -1
- package/lib/Cloudflare.js.map +1 -1
- package/lib/D1.d.ts +13 -20
- package/lib/D1.d.ts.map +1 -1
- package/lib/D1.js +16 -26
- package/lib/D1.js.map +1 -1
- package/lib/LibSQL.d.ts +12 -16
- package/lib/LibSQL.d.ts.map +1 -1
- package/lib/LibSQL.js +16 -19
- package/lib/LibSQL.js.map +1 -1
- package/lib/MySQL.d.ts +9 -9
- package/lib/MySQL.d.ts.map +1 -1
- package/lib/MySQL.js +10 -12
- package/lib/MySQL.js.map +1 -1
- package/lib/Postgres.d.ts +15 -22
- package/lib/Postgres.d.ts.map +1 -1
- package/lib/Postgres.js +21 -29
- package/lib/Postgres.js.map +1 -1
- package/lib/Providers.d.ts.map +1 -1
- package/lib/Providers.js.map +1 -1
- package/lib/Schema.d.ts +27 -0
- package/lib/Schema.d.ts.map +1 -1
- package/lib/Schema.js +18 -4
- package/lib/Schema.js.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +17 -17
- package/src/D1.ts +25 -49
- package/src/LibSQL.ts +29 -42
- package/src/MySQL.ts +24 -45
- package/src/Postgres.ts +30 -55
- package/src/Schema.ts +37 -4
package/lib/Cloudflare.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cloudflare.d.ts","
|
|
1
|
+
{"version":3,"file":"Cloudflare.d.ts","sources":["../src/Cloudflare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AACxF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,KAAK,cAAc,MAAM,oCAAoC,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,eAAe,MAAM,8BAA8B,CAAC;AAGhE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/C;AAED,MAAM,WAAW,mBAAmB,CAClC,UAAU,SAAS,YAAY,GAAG,cAAc,CAChD,SAAQ,eAAe,CAAC,2BAA2B,CAAC,UAAU,CAAC;IAC/D;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,GAAG,uBAAuB,GAAG,SAAS,CAAC;CAC3E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AACH,eAAO,MAAM,aAAa,GACxB,UAAU,SAAS,YAAY;;+FAiC/B,CAAC"}
|
package/lib/Cloudflare.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cloudflare.js","
|
|
1
|
+
{"version":3,"file":"Cloudflare.js","sources":["../src/Cloudflare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAExF,OAAO,KAAK,cAAc,MAAM,oCAAoC,CAAC;AAErE,OAAO,KAAK,eAAe,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAChE,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAyB9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,EAAE,CAAC,uBAAuB,CAAC,CAAC,QAAQ,CAAC,EAEvE,MAAwC;IACxC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,kBAAkB,CAAC;IACxC,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;IAClC,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;IACtD,oEAAoE;IACpE,sEAAsE;IACtE,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IACvE,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;IAClE,MAAM,QAAQ,GAAG,MAAM,CAAC,eAAe,CAAC;IACxC,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACvD,MAAM,eAAe,GAAkC,CAAC,IAAI,EAAE,EAAE,CAC9D,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;IAC7E,8EAA8E;IAC9E,4EAA4E;IAC5E,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC;IACrE,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,eAAe,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC,IAAI,CACpE,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,CAChC,CAAC;IACF,IAAI,UAAU,KAAK,SAAS,IAAI,MAAM,IAAI,UAAU,EAAE,CAAC;QACrD,KAAK,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;SAAM,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QACpC,qEAAqE;QACrE,oEAAoE;QACpE,sDAAsD;QACtD,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE;YACjB,UAAU,EAAE,UAAU,CAAC,UAAU;YACjC,GAAG,CAAC,UAAU,CAAC,eAAe,KAAK,SAAS;gBAC1C,CAAC,CAAC,EAAE,eAAe,EAAE,UAAU,CAAC,eAAe,EAAE;gBACjD,CAAC,CAAC,EAAE,CAAC;SACR,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC,CAAC"}
|
package/lib/D1.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { D1DatabaseSource } from "@alchemy.run/cloudflare/D1/SQL";
|
|
2
2
|
import * as D1Client from "@effect/sql-d1/D1Client";
|
|
3
3
|
import type { AnyRelations, EmptyRelations } from "drizzle-orm";
|
|
4
|
-
import type { EffectSQLiteD1Database } from "drizzle-orm/effect-d1";
|
|
5
4
|
import * as SQLiteD1Drizzle from "drizzle-orm/effect-d1";
|
|
6
5
|
import * as Effect from "effect/Effect";
|
|
7
6
|
/**
|
|
@@ -10,11 +9,8 @@ import * as Effect from "effect/Effect";
|
|
|
10
9
|
* `@effect/sql-d1`'s `D1Client`).
|
|
11
10
|
*
|
|
12
11
|
* Accepts the client returned by `Cloudflare.D1.QueryDatabase(db)` — or its
|
|
13
|
-
* `raw` effect directly
|
|
14
|
-
*
|
|
15
|
-
* step, every call records args, and the chain is replayed against the
|
|
16
|
-
* resolved drizzle db when it's finally yielded as an Effect. Callers don't
|
|
17
|
-
* need a separate `yield* conn` step:
|
|
12
|
+
* `raw` effect directly. Resolve it once at Construction phase and use it
|
|
13
|
+
* from any handler:
|
|
18
14
|
*
|
|
19
15
|
* ```typescript
|
|
20
16
|
* const d1 = yield* Cloudflare.D1.QueryDatabase(Db);
|
|
@@ -25,24 +21,21 @@ import * as Effect from "effect/Effect";
|
|
|
25
21
|
* });
|
|
26
22
|
* ```
|
|
27
23
|
*
|
|
28
|
-
* The
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
24
|
+
* The database is a real `EffectSQLiteD1Database`. Queries, subqueries, CTEs
|
|
25
|
+
* and `sql` fragments are built by drizzle's own code, without the binding.
|
|
26
|
+
* Running a query resolves the binding. The `D1Client` over it (and its
|
|
27
|
+
* prepared-statement cache) is built at most once per execution — a Worker
|
|
28
|
+
* `fetch`/`queue`/`scheduled` event, a Durable Object call, or a Workflow
|
|
29
|
+
* run — and reused by every query in it. Deploy / plan-time invocations
|
|
30
|
+
* (where `WorkerEnvironment` isn't provided) never touch D1.
|
|
35
31
|
*
|
|
36
|
-
* The client
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* `Effect.scoped` narrows both the memo and the client's lifetime to that
|
|
40
|
-
* block: memo key and finalizer target are always the same scope object, so
|
|
41
|
-
* they cannot disagree.
|
|
32
|
+
* The client belongs to the execution's `Scope` and is released when the
|
|
33
|
+
* request / run settles. Wrapping queries in a nested `Effect.scoped` gives
|
|
34
|
+
* that block its own client, released when the block ends.
|
|
42
35
|
*
|
|
43
36
|
* @binding
|
|
44
37
|
*/
|
|
45
|
-
export declare const D1: <TRelations extends AnyRelations = EmptyRelations, E = never, R = never>(database: D1DatabaseSource<E, R>, config?: SQLiteD1Drizzle.EffectDrizzleSQLiteD1Config<TRelations>) => Effect.Effect<EffectSQLiteD1Database<TRelations> & {
|
|
38
|
+
export declare const D1: <TRelations extends AnyRelations = EmptyRelations, E = never, R = never>(database: D1DatabaseSource<E, R>, config?: SQLiteD1Drizzle.EffectDrizzleSQLiteD1Config<TRelations> | undefined) => Effect.Effect<SQLiteD1Drizzle.EffectSQLiteD1Database<TRelations> & {
|
|
46
39
|
$client: D1Client.D1Client;
|
|
47
40
|
}, never, never>;
|
|
48
41
|
//# sourceMappingURL=D1.d.ts.map
|
package/lib/D1.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"D1.d.ts","
|
|
1
|
+
{"version":3,"file":"D1.d.ts","sources":["../src/D1.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,EAAE,GACb,UAAU,SAAS,YAAY,mBAC/B,CAAC,UACD,CAAC;;gBASD,CAAC"}
|
package/lib/D1.js
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import * as D1Client from "@effect/sql-d1/D1Client";
|
|
2
|
-
import { makeExecutionMemo } from "alchemy/Runtime/ExecutionMemo";
|
|
3
|
-
import { proxyChain } from "alchemy/Util/proxy-chain";
|
|
4
2
|
import * as SQLiteD1Drizzle from "drizzle-orm/effect-d1";
|
|
5
3
|
import * as Effect from "effect/Effect";
|
|
6
|
-
import * as Layer from "effect/Layer";
|
|
7
4
|
/**
|
|
8
5
|
* Open a Drizzle database over a Cloudflare D1 binding using the
|
|
9
6
|
* `drizzle-orm/effect-d1` integration (which drives queries through
|
|
10
7
|
* `@effect/sql-d1`'s `D1Client`).
|
|
11
8
|
*
|
|
12
9
|
* Accepts the client returned by `Cloudflare.D1.QueryDatabase(db)` — or its
|
|
13
|
-
* `raw` effect directly
|
|
14
|
-
*
|
|
15
|
-
* step, every call records args, and the chain is replayed against the
|
|
16
|
-
* resolved drizzle db when it's finally yielded as an Effect. Callers don't
|
|
17
|
-
* need a separate `yield* conn` step:
|
|
10
|
+
* `raw` effect directly. Resolve it once at Construction phase and use it
|
|
11
|
+
* from any handler:
|
|
18
12
|
*
|
|
19
13
|
* ```typescript
|
|
20
14
|
* const d1 = yield* Cloudflare.D1.QueryDatabase(Db);
|
|
@@ -25,26 +19,22 @@ import * as Layer from "effect/Layer";
|
|
|
25
19
|
* });
|
|
26
20
|
* ```
|
|
27
21
|
*
|
|
28
|
-
* The
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
22
|
+
* The database is a real `EffectSQLiteD1Database`. Queries, subqueries, CTEs
|
|
23
|
+
* and `sql` fragments are built by drizzle's own code, without the binding.
|
|
24
|
+
* Running a query resolves the binding. The `D1Client` over it (and its
|
|
25
|
+
* prepared-statement cache) is built at most once per execution — a Worker
|
|
26
|
+
* `fetch`/`queue`/`scheduled` event, a Durable Object call, or a Workflow
|
|
27
|
+
* run — and reused by every query in it. Deploy / plan-time invocations
|
|
28
|
+
* (where `WorkerEnvironment` isn't provided) never touch D1.
|
|
35
29
|
*
|
|
36
|
-
* The client
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* `Effect.scoped` narrows both the memo and the client's lifetime to that
|
|
40
|
-
* block: memo key and finalizer target are always the same scope object, so
|
|
41
|
-
* they cannot disagree.
|
|
30
|
+
* The client belongs to the execution's `Scope` and is released when the
|
|
31
|
+
* request / run settles. Wrapping queries in a nested `Effect.scoped` gives
|
|
32
|
+
* that block its own client, released when the block ends.
|
|
42
33
|
*
|
|
43
34
|
* @binding
|
|
44
35
|
*/
|
|
45
|
-
export const D1 =
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
})), (db) => proxyChain(db));
|
|
36
|
+
export const D1 = Effect.fn(function* (database, config) {
|
|
37
|
+
const SQL = yield* Effect.promise(() => import("@alchemy.run/cloudflare/D1/SQL"));
|
|
38
|
+
return yield* SQLiteD1Drizzle.makeWithDefaults(config ?? {}).pipe(Effect.provideServiceEffect(D1Client.D1Client, SQL.D1(database)));
|
|
39
|
+
});
|
|
50
40
|
//# sourceMappingURL=D1.js.map
|
package/lib/D1.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"D1.js","
|
|
1
|
+
{"version":3,"file":"D1.js","sources":["../src/D1.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAKnC,QAAgC,EAChC,MAAgE;IAEhE,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,gCAAgC,CAAC,CAAC,CAAC;IAClF,OAAO,KAAK,CAAC,CAAC,eAAe,CAAC,gBAAgB,CAC5C,MAAM,IAAK,EAA8D,CAC1E,CAAC,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC3E,CAAC,CAAC,CAAC"}
|
package/lib/LibSQL.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { LibSQLConfig, LibSQLSource } from "@alchemy.run/sql/SQLite";
|
|
2
|
-
import type * as LibsqlClient from "@effect/sql-libsql/LibsqlClient";
|
|
3
2
|
import type { AnyRelations, EmptyRelations } from "drizzle-orm";
|
|
4
|
-
import type { EffectLibsqlDatabase } from "drizzle-orm/effect-libsql";
|
|
5
3
|
import type { EffectDrizzleSQLiteConfig } from "drizzle-orm/sqlite-core/effect/utils";
|
|
6
4
|
import * as Effect from "effect/Effect";
|
|
7
5
|
/**
|
|
@@ -9,11 +7,8 @@ import * as Effect from "effect/Effect";
|
|
|
9
7
|
* `drizzle-orm/effect-libsql` integration.
|
|
10
8
|
*
|
|
11
9
|
* Accepts the client returned by `Turso.Connect(db)` — or any
|
|
12
|
-
* `{ url, authToken }
|
|
13
|
-
*
|
|
14
|
-
* step, every call records args, and the chain is replayed against the
|
|
15
|
-
* resolved drizzle db when it's finally yielded as an Effect. Callers don't
|
|
16
|
-
* need a separate `yield* conn` step:
|
|
10
|
+
* `{ url, authToken }`. Resolve it once at Construction phase and use it
|
|
11
|
+
* from any handler:
|
|
17
12
|
*
|
|
18
13
|
* ```typescript
|
|
19
14
|
* const conn = yield* Turso.Connect(Db);
|
|
@@ -24,22 +19,23 @@ import * as Effect from "effect/Effect";
|
|
|
24
19
|
* });
|
|
25
20
|
* ```
|
|
26
21
|
*
|
|
27
|
-
* The
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* event, a Durable Object call, a
|
|
31
|
-
*
|
|
32
|
-
*
|
|
22
|
+
* The database is a real `EffectLibsqlDatabase`. Queries, subqueries, CTEs
|
|
23
|
+
* and `sql` fragments are built by drizzle's own code, with no connection.
|
|
24
|
+
* Running a query opens the client. It is opened at most once per execution
|
|
25
|
+
* — a Worker `fetch`/`queue`/`scheduled` event, a Durable Object call, a
|
|
26
|
+
* Workflow run, or a Lambda invocation — and closed when that execution
|
|
27
|
+
* settles. The URL and token resolve then too, so deploy / plan-time
|
|
28
|
+
* invocations never connect.
|
|
33
29
|
*
|
|
34
30
|
* `@effect/sql-libsql` client options (e.g. `intMode`) are passed via
|
|
35
31
|
* `config.client`.
|
|
36
32
|
*
|
|
37
33
|
* @binding
|
|
38
34
|
*/
|
|
39
|
-
export declare const LibSQL: <TRelations extends AnyRelations = EmptyRelations, E = never, R = never>(source: LibSQLSource<E, R>, config?: EffectDrizzleSQLiteConfig<TRelations> & {
|
|
35
|
+
export declare const LibSQL: <TRelations extends AnyRelations = EmptyRelations, E = never, R = never>(source: LibSQLSource<E, R>, config?: (EffectDrizzleSQLiteConfig<TRelations> & {
|
|
40
36
|
/** Overrides for the underlying `@effect/sql-libsql` client. */
|
|
41
37
|
readonly client?: LibSQLConfig;
|
|
42
|
-
}) => Effect.Effect<EffectLibsqlDatabase<TRelations> & {
|
|
43
|
-
$client: LibsqlClient.LibsqlClient;
|
|
38
|
+
}) | undefined) => Effect.Effect<import("drizzle-orm/effect-libsql").EffectLibsqlDatabase<TRelations> & {
|
|
39
|
+
$client: import("@effect/sql-libsql/LibsqlClient").LibsqlClient;
|
|
44
40
|
}, never, never>;
|
|
45
41
|
//# sourceMappingURL=LibSQL.d.ts.map
|
package/lib/LibSQL.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LibSQL.d.ts","
|
|
1
|
+
{"version":3,"file":"LibSQL.d.ts","sources":["../src/LibSQL.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,MAAM,GACjB,UAAU,SAAS,YAAY,mBAC/B,CAAC,UACD,CAAC;IAIC,gEAAgE;sBAC9C,YAAY;;;gBAiBhC,CAAC"}
|
package/lib/LibSQL.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import { makeExecutionMemo } from "alchemy/Runtime/ExecutionMemo";
|
|
2
|
-
import { proxyChain } from "alchemy/Util/proxy-chain";
|
|
3
1
|
import * as Effect from "effect/Effect";
|
|
4
|
-
import * as Layer from "effect/Layer";
|
|
5
2
|
/**
|
|
6
3
|
* Open a Drizzle database over a libSQL database (e.g. Turso) using the
|
|
7
4
|
* `drizzle-orm/effect-libsql` integration.
|
|
8
5
|
*
|
|
9
6
|
* Accepts the client returned by `Turso.Connect(db)` — or any
|
|
10
|
-
* `{ url, authToken }
|
|
11
|
-
*
|
|
12
|
-
* step, every call records args, and the chain is replayed against the
|
|
13
|
-
* resolved drizzle db when it's finally yielded as an Effect. Callers don't
|
|
14
|
-
* need a separate `yield* conn` step:
|
|
7
|
+
* `{ url, authToken }`. Resolve it once at Construction phase and use it
|
|
8
|
+
* from any handler:
|
|
15
9
|
*
|
|
16
10
|
* ```typescript
|
|
17
11
|
* const conn = yield* Turso.Connect(Db);
|
|
@@ -22,26 +16,29 @@ import * as Layer from "effect/Layer";
|
|
|
22
16
|
* });
|
|
23
17
|
* ```
|
|
24
18
|
*
|
|
25
|
-
* The
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* event, a Durable Object call, a
|
|
29
|
-
*
|
|
30
|
-
*
|
|
19
|
+
* The database is a real `EffectLibsqlDatabase`. Queries, subqueries, CTEs
|
|
20
|
+
* and `sql` fragments are built by drizzle's own code, with no connection.
|
|
21
|
+
* Running a query opens the client. It is opened at most once per execution
|
|
22
|
+
* — a Worker `fetch`/`queue`/`scheduled` event, a Durable Object call, a
|
|
23
|
+
* Workflow run, or a Lambda invocation — and closed when that execution
|
|
24
|
+
* settles. The URL and token resolve then too, so deploy / plan-time
|
|
25
|
+
* invocations never connect.
|
|
31
26
|
*
|
|
32
27
|
* `@effect/sql-libsql` client options (e.g. `intMode`) are passed via
|
|
33
28
|
* `config.client`.
|
|
34
29
|
*
|
|
35
30
|
* @binding
|
|
36
31
|
*/
|
|
37
|
-
export const LibSQL =
|
|
38
|
-
|
|
32
|
+
export const LibSQL = Effect.fn(function* (source, config) {
|
|
33
|
+
// `@effect/sql-libsql` (and @libsql/client underneath) are optional peers —
|
|
34
|
+
// value imports are deferred to the call so `@alchemy.run/drizzle` resolves
|
|
35
|
+
// without them installed.
|
|
36
|
+
const [{ LibsqlClient }, LibsqlDrizzle, SQL] = yield* Effect.promise(() => Promise.all([
|
|
39
37
|
import("@effect/sql-libsql/LibsqlClient"),
|
|
40
38
|
import("drizzle-orm/effect-libsql"),
|
|
41
39
|
import("@alchemy.run/sql/SQLite"),
|
|
42
40
|
]));
|
|
43
41
|
const { client, ...drizzleConfig } = config ?? {};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
})), (db) => proxyChain(db));
|
|
42
|
+
return yield* LibsqlDrizzle.makeWithDefaults(drizzleConfig).pipe(Effect.provideServiceEffect(LibsqlClient, SQL.LibSQL(source, client)));
|
|
43
|
+
});
|
|
47
44
|
//# sourceMappingURL=LibSQL.js.map
|
package/lib/LibSQL.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LibSQL.js","
|
|
1
|
+
{"version":3,"file":"LibSQL.js","sources":["../src/LibSQL.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAKvC,MAA0B,EAC1B,MAGC;IAED,4EAA4E;IAC5E,4EAA4E;IAC5E,0BAA0B;IAC1B,MAAM,CAAC,EAAE,YAAY,EAAE,EAAE,aAAa,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CACxE,OAAO,CAAC,GAAG,CAAC;QACV,MAAM,CAAC,iCAAiC,CAAC;QACzC,MAAM,CAAC,2BAA2B,CAAC;QACnC,MAAM,CAAC,yBAAyB,CAAC;KAClC,CAAC,CACH,CAAC;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;IAClD,OAAO,KAAK,CAAC,CAAC,aAAa,CAAC,gBAAgB,CAC1C,aAAsD,CACvD,CAAC,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC,CAAC"}
|
package/lib/MySQL.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { MySQLConfig } from "@alchemy.run/sql/MySQL";
|
|
2
|
-
import type * as MysqlClient from "@effect/sql-mysql2/MysqlClient";
|
|
3
2
|
import type { AnyRelations, EmptyRelations } from "drizzle-orm";
|
|
4
|
-
import type { EffectMysql2Database } from "drizzle-orm/effect-mysql2";
|
|
5
3
|
import type { EffectDrizzleMySqlConfig } from "drizzle-orm/mysql-core/effect/utils";
|
|
6
4
|
import * as Effect from "effect/Effect";
|
|
7
5
|
import type * as Redacted from "effect/Redacted";
|
|
@@ -18,10 +16,12 @@ import type * as Redacted from "effect/Redacted";
|
|
|
18
16
|
* });
|
|
19
17
|
* ```
|
|
20
18
|
*
|
|
21
|
-
* The
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
19
|
+
* The database is a real `EffectMysql2Database`. Queries, subqueries, CTEs
|
|
20
|
+
* and `sql` fragments are built by drizzle's own code, with no connection.
|
|
21
|
+
* Running a query opens the pool. The pool is opened at most once per
|
|
22
|
+
* execution and closes when the event settles. The connection string
|
|
23
|
+
* resolves then too, so deploy / plan-time invocations never connect.
|
|
24
|
+
* Workers defaults (`resolveMySQLConfig`) are overridden via `config.client`:
|
|
25
25
|
*
|
|
26
26
|
* ```typescript
|
|
27
27
|
* const db = yield* Drizzle.MySQL(connectionString, {
|
|
@@ -32,14 +32,14 @@ import type * as Redacted from "effect/Redacted";
|
|
|
32
32
|
*
|
|
33
33
|
* @binding
|
|
34
34
|
*/
|
|
35
|
-
export declare const MySQL: <TRelations extends AnyRelations = EmptyRelations, E = never, R = never>(connectionString: Effect.Effect<Redacted.Redacted<string>, E, R>, config?: EffectDrizzleMySqlConfig<TRelations> & {
|
|
35
|
+
export declare const MySQL: <TRelations extends AnyRelations = EmptyRelations, E = never, R = never>(connectionString: Effect.Effect<Redacted.Redacted<string>, E, R>, config?: (EffectDrizzleMySqlConfig<TRelations> & {
|
|
36
36
|
/**
|
|
37
37
|
* Overrides for the underlying `@effect/sql-mysql2` client — pool
|
|
38
38
|
* options (e.g. `poolConfig.ssl` for a direct TLS connection),
|
|
39
39
|
* `disablePreparedStatements`, `maxConnections`, and friends.
|
|
40
40
|
*/
|
|
41
41
|
readonly client?: Omit<MySQLConfig, "url">;
|
|
42
|
-
}) => Effect.Effect<EffectMysql2Database<TRelations> & {
|
|
43
|
-
$client: MysqlClient.MysqlClient;
|
|
42
|
+
}) | undefined) => Effect.Effect<import("drizzle-orm/effect-mysql2").EffectMysql2Database<TRelations> & {
|
|
43
|
+
$client: import("@effect/sql-mysql2/MysqlClient").MysqlClient;
|
|
44
44
|
}, never, never>;
|
|
45
45
|
//# sourceMappingURL=MySQL.d.ts.map
|
package/lib/MySQL.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MySQL.d.ts","
|
|
1
|
+
{"version":3,"file":"MySQL.d.ts","sources":["../src/MySQL.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,KAAK,GAChB,UAAU,SAAS,YAAY,mBAC/B,CAAC,UACD,CAAC;IAIC;;;;OAIG;sBACe,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC;;;gBAc5C,CAAC"}
|
package/lib/MySQL.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { makeExecutionMemo } from "alchemy/Runtime/ExecutionMemo";
|
|
2
|
-
import { proxyChain } from "alchemy/Util/proxy-chain";
|
|
3
1
|
import * as Effect from "effect/Effect";
|
|
4
|
-
import * as Layer from "effect/Layer";
|
|
5
2
|
/**
|
|
6
3
|
* Open a Drizzle/MySQL database from a connection URL using the
|
|
7
4
|
* `drizzle-orm/effect-mysql2` integration.
|
|
@@ -15,10 +12,12 @@ import * as Layer from "effect/Layer";
|
|
|
15
12
|
* });
|
|
16
13
|
* ```
|
|
17
14
|
*
|
|
18
|
-
* The
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
15
|
+
* The database is a real `EffectMysql2Database`. Queries, subqueries, CTEs
|
|
16
|
+
* and `sql` fragments are built by drizzle's own code, with no connection.
|
|
17
|
+
* Running a query opens the pool. The pool is opened at most once per
|
|
18
|
+
* execution and closes when the event settles. The connection string
|
|
19
|
+
* resolves then too, so deploy / plan-time invocations never connect.
|
|
20
|
+
* Workers defaults (`resolveMySQLConfig`) are overridden via `config.client`:
|
|
22
21
|
*
|
|
23
22
|
* ```typescript
|
|
24
23
|
* const db = yield* Drizzle.MySQL(connectionString, {
|
|
@@ -29,14 +28,13 @@ import * as Layer from "effect/Layer";
|
|
|
29
28
|
*
|
|
30
29
|
* @binding
|
|
31
30
|
*/
|
|
32
|
-
export const MySQL =
|
|
33
|
-
const [MysqlClient, MySqlDrizzle,
|
|
31
|
+
export const MySQL = Effect.fn(function* (connectionString, config) {
|
|
32
|
+
const [{ MysqlClient }, MySqlDrizzle, SQL] = yield* Effect.promise(() => Promise.all([
|
|
34
33
|
import("@effect/sql-mysql2/MysqlClient"),
|
|
35
34
|
import("drizzle-orm/effect-mysql2"),
|
|
36
35
|
import("@alchemy.run/sql/MySQL"),
|
|
37
36
|
]));
|
|
38
37
|
const { client, ...drizzleConfig } = config ?? {};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
})), (db) => proxyChain(db));
|
|
38
|
+
return yield* MySqlDrizzle.makeWithDefaults(drizzleConfig).pipe(Effect.provideServiceEffect(MysqlClient, SQL.MySQL({ ...client, url: connectionString })));
|
|
39
|
+
});
|
|
42
40
|
//# sourceMappingURL=MySQL.js.map
|
package/lib/MySQL.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MySQL.js","
|
|
1
|
+
{"version":3,"file":"MySQL.js","sources":["../src/MySQL.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAKtC,gBAAgE,EAChE,MAOC;IAED,MAAM,CAAC,EAAE,WAAW,EAAE,EAAE,YAAY,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CACtE,OAAO,CAAC,GAAG,CAAC;QACV,MAAM,CAAC,gCAAgC,CAAC;QACxC,MAAM,CAAC,2BAA2B,CAAC;QACnC,MAAM,CAAC,wBAAwB,CAAC;KACjC,CAAC,CACH,CAAC;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;IAClD,OAAO,KAAK,CAAC,CAAC,YAAY,CAAC,gBAAgB,CACzC,aAAqD,CACtD,CAAC,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,WAAW,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,CAAC;AACpG,CAAC,CAAC,CAAC"}
|
package/lib/Postgres.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type * as PgClient from "@effect/sql-pg/PgClient";
|
|
2
2
|
import type { AnyRelations, EmptyRelations } from "drizzle-orm";
|
|
3
|
-
import type { EffectPgDatabase } from "drizzle-orm/effect-postgres";
|
|
4
3
|
import type { EffectDrizzlePgConfig } from "drizzle-orm/pg-core/effect/utils";
|
|
5
4
|
import * as Effect from "effect/Effect";
|
|
6
5
|
import type * as Redacted from "effect/Redacted";
|
|
@@ -8,10 +7,7 @@ import type * as Redacted from "effect/Redacted";
|
|
|
8
7
|
* Open a Drizzle/Postgres database from a connection URL using the
|
|
9
8
|
* `drizzle-orm/effect-postgres` integration.
|
|
10
9
|
*
|
|
11
|
-
*
|
|
12
|
-
* every property read records a step, every call records args, and the
|
|
13
|
-
* chain is replayed against the resolved drizzle db when it's finally
|
|
14
|
-
* yielded as an Effect. Callers don't need a separate `yield* conn` step:
|
|
10
|
+
* Resolve it once at Construction phase and use it from any handler:
|
|
15
11
|
*
|
|
16
12
|
* ```typescript
|
|
17
13
|
* const db = yield* Drizzle.Postgres(hd.connectionString);
|
|
@@ -21,21 +17,18 @@ import type * as Redacted from "effect/Redacted";
|
|
|
21
17
|
* });
|
|
22
18
|
* ```
|
|
23
19
|
*
|
|
24
|
-
* The
|
|
25
|
-
*
|
|
26
|
-
* is
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* connection string
|
|
30
|
-
* (where `WorkerEnvironment` isn't provided) never
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* The pool
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* a nested `Effect.scoped` narrows both the memo and the pool's lifetime to
|
|
37
|
-
* that block: memo key and finalizer target are always the same scope
|
|
38
|
-
* object, so they cannot disagree.
|
|
20
|
+
* The database is a real `EffectPgDatabase`. Queries, subqueries, CTEs and
|
|
21
|
+
* `sql` fragments are built by drizzle's own code, with no connection.
|
|
22
|
+
* Running a query opens the pool. The pool is opened at most once per
|
|
23
|
+
* execution — a Worker `fetch`/`queue`/`scheduled` event, a Durable Object
|
|
24
|
+
* call, a Workflow run, or a Lambda invocation — and reused by every query
|
|
25
|
+
* and `task` step in it. The connection string resolves then too, so deploy
|
|
26
|
+
* / plan-time invocations (where `WorkerEnvironment` isn't provided) never
|
|
27
|
+
* connect.
|
|
28
|
+
*
|
|
29
|
+
* The pool belongs to the execution's `Scope` and closes when the request /
|
|
30
|
+
* run settles. Wrapping queries in a nested `Effect.scoped` gives that block
|
|
31
|
+
* its own pool, closed when the block ends.
|
|
39
32
|
*
|
|
40
33
|
* `@effect/sql-pg` client options are passed via `config.client`. Behind a
|
|
41
34
|
* transaction-mode pooler such as Hyperdrive, turn off named prepared
|
|
@@ -50,13 +43,13 @@ import type * as Redacted from "effect/Redacted";
|
|
|
50
43
|
*
|
|
51
44
|
* @binding
|
|
52
45
|
*/
|
|
53
|
-
export declare const Postgres: <TRelations extends AnyRelations = EmptyRelations, E = never, R = never>(connectionString: Effect.Effect<Redacted.Redacted<string>, E, R>, config?: EffectDrizzlePgConfig<TRelations> & {
|
|
46
|
+
export declare const Postgres: <TRelations extends AnyRelations = EmptyRelations, E = never, R = never>(connectionString: Effect.Effect<Redacted.Redacted<string>, E, R>, config?: (EffectDrizzlePgConfig<TRelations> & {
|
|
54
47
|
/**
|
|
55
48
|
* Overrides for the underlying `@effect/sql-pg` client — `prepare`,
|
|
56
49
|
* `ssl`, pool limits, and friends. The URL comes from `connectionString`.
|
|
57
50
|
*/
|
|
58
51
|
readonly client?: Omit<PgClient.PgPoolConfig, "url">;
|
|
59
|
-
}) => Effect.Effect<EffectPgDatabase<TRelations> & {
|
|
52
|
+
}) | undefined) => Effect.Effect<import("drizzle-orm/effect-postgres").EffectPgDatabase<TRelations> & {
|
|
60
53
|
$client: PgClient.PgClient;
|
|
61
54
|
}, never, never>;
|
|
62
55
|
//# sourceMappingURL=Postgres.d.ts.map
|
package/lib/Postgres.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Postgres.d.ts","
|
|
1
|
+
{"version":3,"file":"Postgres.d.ts","sources":["../src/Postgres.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,QAAQ,GACnB,UAAU,SAAS,YAAY,mBAC/B,CAAC,UACD,CAAC;IAIC;;;OAGG;sBACe,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,KAAK,CAAC;;;gBActD,CAAC"}
|
package/lib/Postgres.js
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import { resolvePoolConfig } from "@alchemy.run/sql/PostgresTls";
|
|
2
|
-
import { makeExecutionMemo } from "alchemy/Runtime/ExecutionMemo";
|
|
3
|
-
import { proxyChain } from "alchemy/Util/proxy-chain";
|
|
4
1
|
import * as Effect from "effect/Effect";
|
|
5
|
-
import * as Layer from "effect/Layer";
|
|
6
2
|
/**
|
|
7
3
|
* Open a Drizzle/Postgres database from a connection URL using the
|
|
8
4
|
* `drizzle-orm/effect-postgres` integration.
|
|
9
5
|
*
|
|
10
|
-
*
|
|
11
|
-
* every property read records a step, every call records args, and the
|
|
12
|
-
* chain is replayed against the resolved drizzle db when it's finally
|
|
13
|
-
* yielded as an Effect. Callers don't need a separate `yield* conn` step:
|
|
6
|
+
* Resolve it once at Construction phase and use it from any handler:
|
|
14
7
|
*
|
|
15
8
|
* ```typescript
|
|
16
9
|
* const db = yield* Drizzle.Postgres(hd.connectionString);
|
|
@@ -20,21 +13,18 @@ import * as Layer from "effect/Layer";
|
|
|
20
13
|
* });
|
|
21
14
|
* ```
|
|
22
15
|
*
|
|
23
|
-
* The
|
|
24
|
-
*
|
|
25
|
-
* is
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* connection string
|
|
29
|
-
* (where `WorkerEnvironment` isn't provided) never
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* The pool
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* a nested `Effect.scoped` narrows both the memo and the pool's lifetime to
|
|
36
|
-
* that block: memo key and finalizer target are always the same scope
|
|
37
|
-
* object, so they cannot disagree.
|
|
16
|
+
* The database is a real `EffectPgDatabase`. Queries, subqueries, CTEs and
|
|
17
|
+
* `sql` fragments are built by drizzle's own code, with no connection.
|
|
18
|
+
* Running a query opens the pool. The pool is opened at most once per
|
|
19
|
+
* execution — a Worker `fetch`/`queue`/`scheduled` event, a Durable Object
|
|
20
|
+
* call, a Workflow run, or a Lambda invocation — and reused by every query
|
|
21
|
+
* and `task` step in it. The connection string resolves then too, so deploy
|
|
22
|
+
* / plan-time invocations (where `WorkerEnvironment` isn't provided) never
|
|
23
|
+
* connect.
|
|
24
|
+
*
|
|
25
|
+
* The pool belongs to the execution's `Scope` and closes when the request /
|
|
26
|
+
* run settles. Wrapping queries in a nested `Effect.scoped` gives that block
|
|
27
|
+
* its own pool, closed when the block ends.
|
|
38
28
|
*
|
|
39
29
|
* `@effect/sql-pg` client options are passed via `config.client`. Behind a
|
|
40
30
|
* transaction-mode pooler such as Hyperdrive, turn off named prepared
|
|
@@ -49,11 +39,13 @@ import * as Layer from "effect/Layer";
|
|
|
49
39
|
*
|
|
50
40
|
* @binding
|
|
51
41
|
*/
|
|
52
|
-
export const Postgres =
|
|
53
|
-
const [PgClient, PgDrizzle] = yield* Effect.promise(() => Promise.all([
|
|
54
|
-
|
|
42
|
+
export const Postgres = Effect.fn(function* (connectionString, config) {
|
|
43
|
+
const [{ PgClient }, PgDrizzle, SQL] = yield* Effect.promise(() => Promise.all([
|
|
44
|
+
import("@effect/sql-pg/PgClient"),
|
|
45
|
+
import("drizzle-orm/effect-postgres"),
|
|
46
|
+
import("@alchemy.run/sql/Postgres"),
|
|
47
|
+
]));
|
|
55
48
|
const { client, ...drizzleConfig } = config ?? {};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
})), (db) => proxyChain(db));
|
|
49
|
+
return yield* PgDrizzle.makeWithDefaults(drizzleConfig).pipe(Effect.provideServiceEffect(PgClient, SQL.Postgres({ ...client, url: connectionString })));
|
|
50
|
+
});
|
|
59
51
|
//# sourceMappingURL=Postgres.js.map
|
package/lib/Postgres.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Postgres.js","
|
|
1
|
+
{"version":3,"file":"Postgres.js","sources":["../src/Postgres.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAKzC,gBAAgE,EAChE,MAMC;IAED,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAChE,OAAO,CAAC,GAAG,CAAC;QACV,MAAM,CAAC,yBAAyB,CAAC;QACjC,MAAM,CAAC,6BAA6B,CAAC;QACrC,MAAM,CAAC,2BAA2B,CAAC;KACpC,CAAC,CACH,CAAC;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;IAClD,OAAO,KAAK,CAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,aAAkD,CAAC,CAAC,IAAI,CAC/F,MAAM,CAAC,oBAAoB,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAC1F,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/lib/Providers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Providers.d.ts","
|
|
1
|
+
{"version":3,"file":"Providers.d.ts","sources":["../src/Providers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;;AAGtC,qBAAa,SAAU,SAAQ,cAAmD;CAAG;AAErF,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,SAAS,0GAInB,CAAC"}
|
package/lib/Providers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Providers.js","
|
|
1
|
+
{"version":3,"file":"Providers.js","sources":["../src/Providers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,OAAO,SAAU,SAAQ,QAAQ,CAAC,kBAAkB,EAAa,CAAC,SAAS,CAAC;CAAG;AAIrF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAC5B,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CACzD,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,EAC/B,KAAK,CAAC,KAAK,CACZ,CAAC"}
|