@@ -2,12 +2,8 @@ import * as Socket from '@effect/platform/Socket'
22import * as neon from '@neondatabase/serverless'
33import type { DrizzleConfig } from 'drizzle-orm'
44import { drizzle , type NeonDatabase } from 'drizzle-orm/neon-serverless'
5- import { Config as C , Effect , pipe } from 'effect'
6- import type { ConfigError } from 'effect/ConfigError'
5+ import { Config as C , Context , Effect } from 'effect'
76
8- /**
9- * @public
10- */
117export namespace Adapter {
128 export type TSchema = Record < string , unknown >
139
@@ -21,8 +17,8 @@ export namespace Adapter {
2117 pool : Pool
2218 db : DB < T >
2319 } ,
24- ConfigError ,
25- Socket . WebSocketConstructor
20+ never ,
21+ Socket . WebSocketConstructor | AdapterConfig
2622 >
2723
2824 export type Config = Readonly < {
@@ -37,7 +33,8 @@ export function Adapter<T extends Adapter.TSchema = Record<string, never>>(
3733 options ?: Adapter . Options < T > ,
3834) : Adapter . Adapter < T > {
3935 return Effect . gen ( function * ( ) {
40- const connectionString = yield * Config . DATABASE_URL
36+ const config = yield * AdapterConfig
37+ const connectionString = config . DATABASE_POOL_URL
4138 const webSocketConstructor = yield * Socket . WebSocketConstructor
4239
4340 yield * Effect . sync ( ( ) => {
@@ -55,12 +52,6 @@ export function Adapter<T extends Adapter.TSchema = Record<string, never>>(
5552 } )
5653}
5754
58- /**
59- * @public
60- */
61- export const Config : Adapter . Config = Object . freeze ( {
62- DATABASE_URL : pipe (
63- C . nonEmptyString ( 'DATABASE_URL' ) ,
64- C . withDescription ( 'Neon database connection string' ) ,
65- ) ,
66- } )
55+ export class AdapterConfig extends Context . Tag ( 'AdapterConfig' ) < AdapterConfig , {
56+ readonly DATABASE_POOL_URL : string
57+ } > ( ) { }
0 commit comments