mirror of
https://github.com/VibedByKaKi/t3-code-android-nightly.git
synced 2026-10-09 11:51:15 +02:00
110 lines
5 KiB
Diff
110 lines
5 KiB
Diff
diff --git a/lib/Drizzle/Postgres.d.ts b/lib/Drizzle/Postgres.d.ts
|
|
index ddba2e1..31335e2 100644
|
|
--- a/lib/Drizzle/Postgres.d.ts
|
|
+++ b/lib/Drizzle/Postgres.d.ts
|
|
@@ -4,6 +4,11 @@ import type { EffectPgDatabase } from "drizzle-orm/effect-postgres";
|
|
import type { EffectDrizzlePgConfig } from "drizzle-orm/pg-core/effect/utils";
|
|
import * as Effect from "effect/Effect";
|
|
import type * as Redacted from "effect/Redacted";
|
|
+/**
|
|
+ * `@effect/sql-pg` client settings that cannot be carried in the URL, e.g.
|
|
+ * `prepare: false` for transaction-mode poolers such as Hyperdrive.
|
|
+ */
|
|
+export type PostgresClientOptions = Omit<PgClient.PgPoolConfig, "url" | "ssl">;
|
|
/**
|
|
* Open a Drizzle/Postgres database from a connection URL using the
|
|
* `drizzle-orm/effect-postgres` integration.
|
|
@@ -39,7 +44,7 @@ import type * as Redacted from "effect/Redacted";
|
|
*
|
|
* @binding
|
|
*/
|
|
-export declare const Postgres: <TRelations extends AnyRelations = EmptyRelations, E = never, R = never>(connectionString: Effect.Effect<Redacted.Redacted<string>, E, R>, config?: EffectDrizzlePgConfig<TRelations>) => Effect.Effect<EffectPgDatabase<TRelations> & {
|
|
+export declare const Postgres: <TRelations extends AnyRelations = EmptyRelations, E = never, R = never>(connectionString: Effect.Effect<Redacted.Redacted<string>, E, R>, config?: EffectDrizzlePgConfig<TRelations>, pgClient?: PostgresClientOptions) => Effect.Effect<EffectPgDatabase<TRelations> & {
|
|
$client: PgClient.PgClient;
|
|
}, never, never>;
|
|
//# sourceMappingURL=Postgres.d.ts.map
|
|
\ No newline at end of file
|
|
diff --git a/lib/Drizzle/Postgres.js b/lib/Drizzle/Postgres.js
|
|
index fdd0942..e745228 100644
|
|
--- a/lib/Drizzle/Postgres.js
|
|
+++ b/lib/Drizzle/Postgres.js
|
|
@@ -38,13 +38,13 @@ import { proxyChain } from "../Util/proxy-chain.js";
|
|
*
|
|
* @binding
|
|
*/
|
|
-export const Postgres = (connectionString, config) => Effect.map(makeExecutionMemo(Effect.gen(function* () {
|
|
+export const Postgres = (connectionString, config, pgClient) => Effect.map(makeExecutionMemo(Effect.gen(function* () {
|
|
const [PgClient, PgDrizzle] = yield* Effect.promise(() => Promise.all([
|
|
import("@effect/sql-pg/PgClient"),
|
|
import("drizzle-orm/effect-postgres"),
|
|
]));
|
|
const url = yield* connectionString;
|
|
- const pgCtx = yield* Layer.build(PgClient.layer(resolveConnectionOptions(url)));
|
|
+ const pgCtx = yield* Layer.build(PgClient.layer({ ...pgClient, ...resolveConnectionOptions(url) }));
|
|
return yield* PgDrizzle.makeWithDefaults(config).pipe(Effect.provideContext(pgCtx));
|
|
})), (db) => proxyChain(db));
|
|
//# sourceMappingURL=Postgres.js.map
|
|
\ No newline at end of file
|
|
diff --git a/lib/Test/Vitest.js b/lib/Test/Vitest.js
|
|
index bada542..f135b00 100644
|
|
--- a/lib/Test/Vitest.js
|
|
+++ b/lib/Test/Vitest.js
|
|
@@ -3,7 +3,7 @@ import { it } from "@effect/vitest";
|
|
import * as Effect from "effect/Effect";
|
|
import * as Exit from "effect/Exit";
|
|
import * as Scope from "effect/Scope";
|
|
-import { afterAll as vitestAfterAll, afterEach as vitestAfterEach, beforeAll as vitestBeforeAll, beforeEach as vitestBeforeEach, } from "vitest";
|
|
+import { afterAll as vitestAfterAll, afterEach as vitestAfterEach, beforeAll as vitestBeforeAll, beforeEach as vitestBeforeEach, } from "vite-plus/test";
|
|
import * as Core from "./Core.js";
|
|
export { executeWhenReady, getWhenReady, guardContentType, guardedFetchLayer, rpcClientLayer, WorkerNotReady, } from "./Http.js";
|
|
export const defaultStage = Core.defaultStage;
|
|
diff --git a/src/Drizzle/Postgres.ts b/src/Drizzle/Postgres.ts
|
|
index 2d13891..61ae549 100644
|
|
--- a/src/Drizzle/Postgres.ts
|
|
+++ b/src/Drizzle/Postgres.ts
|
|
@@ -48,6 +48,15 @@ import { proxyChain } from "../Util/proxy-chain.ts";
|
|
* @binding
|
|
*/
|
|
|
|
+/**
|
|
+ * `@effect/sql-pg` client settings that cannot be carried in the URL, e.g.
|
|
+ * `prepare: false` for transaction-mode poolers such as Hyperdrive.
|
|
+ */
|
|
+export type PostgresClientOptions = Omit<
|
|
+ PgClient.PgPoolConfig,
|
|
+ "url" | "ssl"
|
|
+>;
|
|
+
|
|
export const Postgres = <
|
|
TRelations extends AnyRelations = EmptyRelations,
|
|
E = never,
|
|
@@ -55,6 +64,7 @@ export const Postgres = <
|
|
>(
|
|
connectionString: Effect.Effect<Redacted.Redacted<string>, E, R>,
|
|
config?: EffectDrizzlePgConfig<TRelations>,
|
|
+ pgClient?: PostgresClientOptions,
|
|
) =>
|
|
Effect.map(
|
|
makeExecutionMemo(
|
|
@@ -67,7 +77,7 @@ export const Postgres = <
|
|
);
|
|
const url = yield* connectionString;
|
|
const pgCtx = yield* Layer.build(
|
|
- PgClient.layer(resolveConnectionOptions(url)),
|
|
+ PgClient.layer({ ...pgClient, ...resolveConnectionOptions(url) }),
|
|
);
|
|
return yield* PgDrizzle.makeWithDefaults(config).pipe(
|
|
Effect.provideContext(pgCtx),
|
|
diff --git a/src/Test/Vitest.ts b/src/Test/Vitest.ts
|
|
index 7dd3576..0bcfc4d 100644
|
|
--- a/src/Test/Vitest.ts
|
|
+++ b/src/Test/Vitest.ts
|
|
@@ -8,7 +8,7 @@ import {
|
|
afterEach as vitestAfterEach,
|
|
beforeAll as vitestBeforeAll,
|
|
beforeEach as vitestBeforeEach,
|
|
-} from "vitest";
|
|
+} from "vite-plus/test";
|
|
|
|
import type { AlchemyContext } from "../AlchemyContext.ts";
|
|
import type { CompiledStack } from "../Stack.ts";
|