@effect/sql-pg 4.0.0-rc.111 → 4.0.0-rc.113

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.
Files changed (60) hide show
  1. package/AGENTS.md +24 -9
  2. package/CLAUDE.md +24 -9
  3. package/ai-docs/package.json +2 -2
  4. package/ai-docs/src/01_effect/01_basics/02_effect-fn.ts +18 -5
  5. package/ai-docs/src/01_effect/01_basics/index.md +5 -3
  6. package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +1 -1
  7. package/ai-docs/src/01_effect/03_services/20_layer-unwrap.ts +2 -2
  8. package/ai-docs/src/01_effect/05_resources/10_acquire-release.ts +2 -2
  9. package/ai-docs/src/03_stream/30_encoding.ts +5 -7
  10. package/ai-docs/src/08_observability/10_logging.ts +1 -1
  11. package/ai-docs/src/70_cli/10_basics.ts +7 -7
  12. package/ai-docs/src/71_ai/10_language-model.ts +2 -2
  13. package/ai-docs/src/71_ai/20_tools.ts +1 -1
  14. package/ai-docs/src/71_ai/30_chat.ts +1 -1
  15. package/dist/PgAuth.d.ts +93 -0
  16. package/dist/PgAuth.d.ts.map +1 -0
  17. package/dist/PgAuth.js +229 -0
  18. package/dist/PgAuth.js.map +1 -0
  19. package/dist/PgClient.d.ts +49 -82
  20. package/dist/PgClient.d.ts.map +1 -1
  21. package/dist/PgClient.js +58 -510
  22. package/dist/PgClient.js.map +1 -1
  23. package/dist/PgConnection.d.ts +177 -0
  24. package/dist/PgConnection.d.ts.map +1 -0
  25. package/dist/PgConnection.js +1786 -0
  26. package/dist/PgConnection.js.map +1 -0
  27. package/dist/PgPool.d.ts +107 -0
  28. package/dist/PgPool.d.ts.map +1 -0
  29. package/dist/PgPool.js +124 -0
  30. package/dist/PgPool.js.map +1 -0
  31. package/dist/PgProtocol.d.ts +783 -0
  32. package/dist/PgProtocol.d.ts.map +1 -0
  33. package/dist/PgProtocol.js +1202 -0
  34. package/dist/PgProtocol.js.map +1 -0
  35. package/dist/PgTypes.d.ts +429 -0
  36. package/dist/PgTypes.d.ts.map +1 -0
  37. package/dist/PgTypes.js +1511 -0
  38. package/dist/PgTypes.js.map +1 -0
  39. package/dist/index.d.ts +20 -0
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +20 -0
  42. package/dist/index.js.map +1 -1
  43. package/dist/internal/connection.d.ts +2 -0
  44. package/dist/internal/connection.d.ts.map +1 -0
  45. package/dist/internal/connection.js +5 -0
  46. package/dist/internal/connection.js.map +1 -0
  47. package/dist/internal/sqlError.d.ts +10 -0
  48. package/dist/internal/sqlError.d.ts.map +1 -0
  49. package/dist/internal/sqlError.js +57 -0
  50. package/dist/internal/sqlError.js.map +1 -0
  51. package/package.json +8 -12
  52. package/src/PgAuth.ts +318 -0
  53. package/src/PgClient.ts +138 -681
  54. package/src/PgConnection.ts +2294 -0
  55. package/src/PgPool.ts +231 -0
  56. package/src/PgProtocol.ts +1863 -0
  57. package/src/PgTypes.ts +1998 -0
  58. package/src/index.ts +25 -0
  59. package/src/internal/connection.ts +26 -0
  60. package/src/internal/sqlError.ts +75 -0
package/dist/PgAuth.js ADDED
@@ -0,0 +1,229 @@
1
+ /**
2
+ * Password authentication for the PostgreSQL protocol: MD5 and
3
+ * SCRAM-SHA-256.
4
+ *
5
+ * Message framing lives in `PgProtocol` - SASL payloads travel as opaque
6
+ * bytes - so this module only computes what goes inside them. Cleartext
7
+ * authentication needs nothing from here; send the password as a
8
+ * `PasswordMessage`.
9
+ *
10
+ * `SCRAM-SHA-256-PLUS` is not implemented: channel binding needs the TLS
11
+ * socket, which this codec does not own. Passwords are used as UTF-8 without
12
+ * SASLprep normalisation, so non-ASCII passwords that require normalisation
13
+ * are not supported. Server iteration counts above 1,000,000 are rejected
14
+ * before password derivation.
15
+ *
16
+ * @since 4.0.0
17
+ */
18
+ import * as Data from "effect/Data";
19
+ import * as Encoding from "effect/Encoding";
20
+ import * as Result from "effect/Result";
21
+ import { createHash, createHmac, pbkdf2Sync } from "node:crypto";
22
+ /**
23
+ * Failure returned when an authentication exchange cannot be completed.
24
+ *
25
+ * @category errors
26
+ * @since 4.0.0
27
+ */
28
+ export class AuthError extends /*#__PURE__*/Data.TaggedError("PgAuthError") {}
29
+ const fail = message => {
30
+ throw new AuthError({
31
+ message
32
+ });
33
+ };
34
+ const result = evaluate => {
35
+ try {
36
+ return Result.succeed(evaluate());
37
+ } catch (error) {
38
+ if (error instanceof AuthError) return Result.fail(error);
39
+ throw error;
40
+ }
41
+ };
42
+ const textEncoder = /*#__PURE__*/new TextEncoder();
43
+ const textDecoder = /*#__PURE__*/new TextDecoder("utf-8", {
44
+ fatal: true
45
+ });
46
+ /** Bounds synchronous PBKDF2 work requested by an untrusted server. */
47
+ const maxScramIterations = 1_000_000;
48
+ const bytesOf = value => Uint8Array.from(value);
49
+ const sha256 = data => bytesOf(createHash("sha256").update(data).digest());
50
+ const hmacSha256 = (key, data) => bytesOf(createHmac("sha256", key).update(data).digest());
51
+ const xor = (left, right) => {
52
+ const result = new Uint8Array(left.length);
53
+ for (let i = 0; i < left.length; i++) {
54
+ result[i] = left[i] ^ right[i];
55
+ }
56
+ return result;
57
+ };
58
+ const toBase64 = bytes => Encoding.encodeBase64(bytes);
59
+ const fromBase64 = (text, field) => {
60
+ const decoded = Encoding.decodeBase64(text);
61
+ if (Result.isFailure(decoded)) {
62
+ return fail(`Invalid base64 in SCRAM attribute "${field}"`);
63
+ }
64
+ return decoded.success;
65
+ };
66
+ const decodeUtf8 = (bytes, what) => {
67
+ try {
68
+ return textDecoder.decode(bytes);
69
+ } catch {
70
+ return fail(`Invalid UTF-8 in ${what}`);
71
+ }
72
+ };
73
+ /**
74
+ * Computes the password string for an `AuthenticationMD5Password` challenge:
75
+ * `"md5" + md5(md5(password + user) + salt)`. Send the result verbatim as a
76
+ * `PasswordMessage`.
77
+ *
78
+ * @category MD5
79
+ * @since 4.0.0
80
+ */
81
+ const md5PasswordUnsafe = options => {
82
+ if (options.salt.length !== 4) {
83
+ return fail(`PostgreSQL MD5 salt must be exactly 4 bytes, received ${options.salt.length}`);
84
+ }
85
+ const inner = createHash("md5").update(textEncoder.encode(options.password + options.user)).digest("hex");
86
+ const outer = createHash("md5").update(textEncoder.encode(inner)).update(options.salt).digest("hex");
87
+ return `md5${outer}`;
88
+ };
89
+ /**
90
+ * Computes the legacy PostgreSQL MD5 password response.
91
+ *
92
+ * @category authentication
93
+ * @since 4.0.0
94
+ */
95
+ export const md5Password = options => result(() => md5PasswordUnsafe(options));
96
+ /**
97
+ * The only SASL mechanism this module implements.
98
+ *
99
+ * @category SCRAM
100
+ * @since 4.0.0
101
+ */
102
+ export const SCRAM_SHA_256 = "SCRAM-SHA-256";
103
+ const GS2_HEADER = "n,,";
104
+ /** Base64 of the GS2 header, the `c=` attribute value without channel binding. */
105
+ const CHANNEL_BINDING = "biws";
106
+ const parseAttributes = message => {
107
+ const attributes = new Map();
108
+ for (const part of message.split(",")) {
109
+ const separator = part.indexOf("=");
110
+ if (separator < 1) {
111
+ return fail(`Malformed SCRAM attribute: "${part}"`);
112
+ }
113
+ const key = part.slice(0, separator);
114
+ if (attributes.has(key)) {
115
+ return fail(`Duplicate SCRAM attribute "${key}"`);
116
+ }
117
+ attributes.set(key, part.slice(separator + 1));
118
+ }
119
+ return attributes;
120
+ };
121
+ const attribute = (attributes, key) => attributes.get(key) ?? fail(`Missing SCRAM attribute "${key}"`);
122
+ /**
123
+ * Starts a SCRAM-SHA-256 exchange. The `nonce` must be a fresh, random,
124
+ * printable ASCII string chosen by the caller; this module never generates
125
+ * randomness.
126
+ *
127
+ * The successful result contains the `initialResponse` bytes for a
128
+ * `SASLInitialResponse` message with mechanism `SCRAM_SHA_256`.
129
+ *
130
+ * @category SCRAM
131
+ * @since 4.0.0
132
+ */
133
+ const scramInitUnsafe = options => {
134
+ if (!/^[\x21-\x2b\x2d-\x7e]+$/.test(options.nonce)) {
135
+ return fail("SCRAM nonce must contain only printable ASCII characters other than comma");
136
+ }
137
+ const clientFirstMessageBare = `n=,r=${options.nonce}`;
138
+ return {
139
+ state: {
140
+ _tag: "ScramFirst",
141
+ password: options.password,
142
+ clientNonce: options.nonce,
143
+ clientFirstMessageBare
144
+ },
145
+ response: textEncoder.encode(GS2_HEADER + clientFirstMessageBare)
146
+ };
147
+ };
148
+ /**
149
+ * Creates the first SCRAM-SHA-256 client message.
150
+ *
151
+ * @category SCRAM
152
+ * @since 4.0.0
153
+ */
154
+ export const scramInit = options => result(() => scramInitUnsafe(options));
155
+ /**
156
+ * Answers an `AuthenticationSASLContinue` challenge.
157
+ *
158
+ * The successful result contains the payload bytes for a `SASLResponse`
159
+ * message.
160
+ *
161
+ * @category SCRAM
162
+ * @since 4.0.0
163
+ */
164
+ const scramContinueUnsafe = (state, challenge) => {
165
+ const serverFirstMessage = decodeUtf8(challenge, "the SCRAM server-first-message");
166
+ const attributes = parseAttributes(serverFirstMessage);
167
+ const nonce = attribute(attributes, "r");
168
+ if (!nonce.startsWith(state.clientNonce) || nonce.length === state.clientNonce.length) {
169
+ return fail("SCRAM server nonce does not extend the client nonce");
170
+ }
171
+ const saltText = attribute(attributes, "s");
172
+ if (saltText.length === 0) {
173
+ return fail("SCRAM salt must not be empty");
174
+ }
175
+ const salt = fromBase64(saltText, "s");
176
+ const iterationText = attribute(attributes, "i");
177
+ const iterations = Number(iterationText);
178
+ if (!/^[1-9]\d*$/.test(iterationText) || !Number.isSafeInteger(iterations) || iterations > maxScramIterations) {
179
+ return fail(`Invalid SCRAM iteration count: ${iterationText}`);
180
+ }
181
+ const saltedPassword = bytesOf(pbkdf2Sync(textEncoder.encode(state.password), salt, iterations, 32, "sha256"));
182
+ const clientKey = hmacSha256(saltedPassword, textEncoder.encode("Client Key"));
183
+ const storedKey = sha256(clientKey);
184
+ const clientFinalMessageWithoutProof = `c=${CHANNEL_BINDING},r=${nonce}`;
185
+ const authMessage = textEncoder.encode(`${state.clientFirstMessageBare},${serverFirstMessage},${clientFinalMessageWithoutProof}`);
186
+ const clientProof = xor(clientKey, hmacSha256(storedKey, authMessage));
187
+ const serverKey = hmacSha256(saltedPassword, textEncoder.encode("Server Key"));
188
+ return {
189
+ state: {
190
+ _tag: "ScramFinal",
191
+ serverSignature: hmacSha256(serverKey, authMessage)
192
+ },
193
+ response: textEncoder.encode(`${clientFinalMessageWithoutProof},p=${toBase64(clientProof)}`)
194
+ };
195
+ };
196
+ /**
197
+ * Processes the server's SCRAM challenge and creates the client proof.
198
+ *
199
+ * @category SCRAM
200
+ * @since 4.0.0
201
+ */
202
+ export const scramContinue = (state, challenge) => result(() => scramContinueUnsafe(state, challenge));
203
+ /**
204
+ * Verifies the server signature carried by `AuthenticationSASLFinal`. Returns
205
+ * `Result.void` on success and an `AuthError` failure when the server could
206
+ * not prove that it knows the stored key.
207
+ *
208
+ * @category SCRAM
209
+ * @since 4.0.0
210
+ */
211
+ const scramFinishUnsafe = (state, challenge) => {
212
+ const attributes = parseAttributes(decodeUtf8(challenge, "the SCRAM server-final-message"));
213
+ const error = attributes.get("e");
214
+ if (error !== undefined) {
215
+ fail(`SCRAM authentication failed: ${error}`);
216
+ }
217
+ const signature = fromBase64(attribute(attributes, "v"), "v");
218
+ if (toBase64(state.serverSignature) !== toBase64(signature)) {
219
+ fail("SCRAM server signature mismatch");
220
+ }
221
+ };
222
+ /**
223
+ * Verifies the server's final SCRAM message.
224
+ *
225
+ * @category SCRAM
226
+ * @since 4.0.0
227
+ */
228
+ export const scramFinish = (state, challenge) => result(() => scramFinishUnsafe(state, challenge));
229
+ //# sourceMappingURL=PgAuth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PgAuth.js","names":[],"sources":["../src/PgAuth.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;AAiBA,OAAO,KAAK,IAAI,MAAM,aAAa;AACnC,OAAO,KAAK,QAAQ,MAAM,iBAAiB;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC,SAAS,UAAU,EAAE,UAAU,EAAE,UAAU,QAAQ,aAAa;A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G,CAAC;EACjC,IAAI,KAAK,KAAK,SAAS,EAAE;IACvB,IAAI,CAAC,gCAAgC,KAAK,EAAE,CAAC;EAC/C;EACA,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC,UAAU,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC;EAC7D,IAAI,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,KAAK,QAAQ,CAAC,SAAS,CAAC,EAAE;IAC3D,IAAI,CAAC,iCAAiC,CAAC;EACzC;AACF,CAAC;AAED;;;;;;AAMA,OAAO,MAAM,WAAW,GAAG,CACzB,KAAiB,EACjB,SAAqB,KACc,MAAM,CAAC,MAAM,iBAAiB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC","ignoreList":[]}
@@ -1,36 +1,36 @@
1
1
  import * as Config from "effect/Config";
2
2
  import * as Context from "effect/Context";
3
- import * as Duration from "effect/Duration";
3
+ import type * as Duration from "effect/Duration";
4
4
  import * as Effect from "effect/Effect";
5
5
  import * as Layer from "effect/Layer";
6
- import * as Redacted from "effect/Redacted";
7
- import * as Scope from "effect/Scope";
8
- import * as Stream from "effect/Stream";
6
+ import type * as Queue from "effect/Queue";
7
+ import type * as Redacted from "effect/Redacted";
8
+ import type * as Scope from "effect/Scope";
9
9
  import * as Reactivity from "effect/unstable/reactivity/Reactivity";
10
10
  import * as Client from "effect/unstable/sql/SqlClient";
11
- import type * as SqlConnection from "effect/unstable/sql/SqlConnection";
12
- import { SqlError } from "effect/unstable/sql/SqlError";
11
+ import type { SqlError } from "effect/unstable/sql/SqlError";
13
12
  import type { Custom, Fragment } from "effect/unstable/sql/Statement";
14
13
  import * as Statement from "effect/unstable/sql/Statement";
15
14
  import type { Duplex } from "node:stream";
16
15
  import type { ConnectionOptions } from "node:tls";
17
- import * as Pg from "pg";
16
+ import * as PgConnection from "./PgConnection.ts";
17
+ import * as PgTypes from "./PgTypes.ts";
18
18
  /**
19
- * Runtime type identifier used to mark `PgClient` values.
19
+ * The runtime type identifier for `PgClient`.
20
20
  *
21
21
  * @category type IDs
22
22
  * @since 4.0.0
23
23
  */
24
24
  export declare const TypeId: TypeId;
25
25
  /**
26
- * Type-level identifier used to mark `PgClient` values.
26
+ * The type-level identifier for `PgClient`.
27
27
  *
28
28
  * @category type IDs
29
29
  * @since 4.0.0
30
30
  */
31
31
  export type TypeId = "~@effect/sql-pg/PgClient";
32
32
  /**
33
- * PostgreSQL client service, extending `SqlClient` with JSON parameter fragments and LISTEN/NOTIFY helpers.
33
+ * A PostgreSQL `SqlClient` with JSON and `LISTEN`/`NOTIFY` helpers.
34
34
  *
35
35
  * @category services
36
36
  * @since 4.0.0
@@ -39,22 +39,23 @@ export interface PgClient extends Client.SqlClient {
39
39
  readonly [TypeId]: TypeId;
40
40
  readonly config: PgClientConfig;
41
41
  readonly json: (_: unknown) => Fragment;
42
- readonly listen: (channel: string) => Stream.Stream<string, SqlError>;
42
+ /**
43
+ * Registers a channel listener and returns its non-empty payload queue after
44
+ * PostgreSQL confirms `LISTEN`. The listener holds a connection until the
45
+ * scope closes.
46
+ */
47
+ readonly listen: (channel: string) => Effect.Effect<Queue.Dequeue<PgConnection.Notification>, SqlError, Scope.Scope>;
43
48
  readonly notify: (channel: string, payload: string) => Effect.Effect<void, SqlError>;
44
49
  }
45
50
  /**
46
- * Service tag for the PostgreSQL client service.
47
- *
48
- * **When to use**
49
- *
50
- * Use to access or provide a PostgreSQL client through the Effect context.
51
+ * The service tag for `PgClient`.
51
52
  *
52
53
  * @category services
53
54
  * @since 4.0.0
54
55
  */
55
56
  export declare const PgClient: Context.Service<PgClient, PgClient>;
56
57
  /**
57
- * Configuration for a PostgreSQL client, including connection, TLS, custom stream, application name, type parser, JSON transform, and query/result name transform options.
58
+ * Connection and query settings for a PostgreSQL client.
58
59
  *
59
60
  * @category models
60
61
  * @since 4.0.0
@@ -75,10 +76,31 @@ export interface PgClientConfig {
75
76
  readonly transformResultNames?: ((str: string) => string) | undefined;
76
77
  readonly transformQueryNames?: ((str: string) => string) | undefined;
77
78
  readonly transformJson?: boolean | undefined;
78
- readonly types?: Pg.CustomTypesConfig | undefined;
79
+ readonly types?: PgTypes.Registry | undefined;
80
+ /**
81
+ * Pipelines queries from multiple fibers on each pooled connection.
82
+ * Transactions, streams, and listeners still reserve a connection.
83
+ */
84
+ readonly multiplex?: boolean | undefined;
85
+ /**
86
+ * How many statements may share one connection when `multiplex` is on.
87
+ * Defaults to `32`. Higher values trade tail latency for throughput: the
88
+ * statements sharing a connection are pipelined into one write, and they
89
+ * also queue behind the slowest of them.
90
+ */
91
+ readonly multiplexConcurrency?: number | undefined;
92
+ /**
93
+ * Caches prepared statements by name. Enabled by default. Disable it for
94
+ * poolers that cannot preserve named statements between queries.
95
+ */
96
+ readonly prepare?: boolean | undefined;
97
+ /** How many statements a connection keeps prepared. Defaults to `100`. */
98
+ readonly preparedStatementCacheSize?: number | undefined;
99
+ /** Maximum backend message size in bytes. Defaults to 16 MiB. */
100
+ readonly maxMessageSize?: number | undefined;
79
101
  }
80
102
  /**
81
- * PostgreSQL pool configuration, extending `PgClientConfig` with idle timeout, pool size, and connection lifetime settings.
103
+ * PostgreSQL client settings with connection pool limits and timeouts.
82
104
  *
83
105
  * @category models
84
106
  * @since 4.0.0
@@ -90,109 +112,54 @@ export interface PgPoolConfig extends PgClientConfig {
90
112
  readonly connectionTTL?: Duration.Input | undefined;
91
113
  }
92
114
  /**
93
- * Creates a scoped PostgreSQL client backed by a managed `pg` connection pool.
115
+ * Creates a scoped PostgreSQL client backed by a connection pool.
94
116
  *
95
117
  * @category constructors
96
118
  * @since 4.0.0
97
119
  */
98
120
  export declare const make: (options: PgPoolConfig) => Effect.Effect<PgClient, SqlError, Scope.Scope | Reactivity.Reactivity>;
99
121
  /**
100
- * Creates a scoped PostgreSQL client backed by a managed single `pg` client, optionally acquiring a separate client for streaming and LISTEN operations.
122
+ * Creates a scoped PostgreSQL client backed by one connection.
101
123
  *
102
124
  * @category constructors
103
125
  * @since 4.0.0
104
126
  */
105
127
  export declare const makeClient: (options: PgClientConfig & {
106
128
  /**
107
- * Whether to acquire a separate client for each sql.stream / sql.listen
129
+ * Opens a separate connection for each stream and listener when enabled.
108
130
  */
109
131
  readonly acquireForStream?: boolean | undefined;
110
132
  }) => Effect.Effect<PgClient, SqlError, Scope.Scope | Reactivity.Reactivity>;
111
133
  /**
112
- * Builds a PostgreSQL client from a scoped `pg` pool acquisition effect, deriving transaction, streaming, and LISTEN/NOTIFY support from that pool.
113
- *
114
- * @category constructors
115
- * @since 4.0.0
116
- */
117
- export declare const fromPool: (options: {
118
- readonly acquire: Effect.Effect<Pg.Pool, SqlError, Scope.Scope>;
119
- readonly applicationName?: string | undefined;
120
- readonly spanAttributes?: Record<string, unknown> | undefined;
121
- readonly transformResultNames?: ((str: string) => string) | undefined;
122
- readonly transformQueryNames?: ((str: string) => string) | undefined;
123
- readonly transformJson?: boolean | undefined;
124
- readonly types?: Pg.CustomTypesConfig | undefined;
125
- }) => Effect.Effect<PgClient, SqlError, Reactivity.Reactivity | Scope.Scope>;
126
- /**
127
- * Builds a PostgreSQL client from a scoped `pg` client acquisition effect, serializing access when sharing the client and optionally using separate clients for streams and LISTEN.
128
- *
129
- * @category constructors
130
- * @since 4.0.0
131
- */
132
- export declare const fromClient: (options: {
133
- readonly acquire: Effect.Effect<Pg.Client, SqlError, Scope.Scope>;
134
- /**
135
- * Whether to acquire a separate client for each sql.stream / sql.listen.
136
- */
137
- readonly acquireForStream: boolean;
138
- readonly applicationName?: string | undefined;
139
- readonly spanAttributes?: Record<string, unknown> | undefined;
140
- readonly transformResultNames?: ((str: string) => string) | undefined;
141
- readonly transformQueryNames?: ((str: string) => string) | undefined;
142
- readonly transformJson?: boolean | undefined;
143
- readonly types?: Pg.CustomTypesConfig | undefined;
144
- }) => Effect.Effect<PgClient, SqlError, Reactivity.Reactivity | Scope.Scope>;
145
- /**
146
- * Creates a `PgClient` from SQL connection acquirers, a LISTEN acquirer, client configuration, and transformation options.
147
- *
148
- * **When to use**
149
- *
150
- * Use to build a PostgreSQL client from custom connection acquisition logic
151
- * instead of the built-in pool or single-client constructors.
152
- *
153
- * @category constructors
154
- * @since 4.0.0
155
- */
156
- export declare const makeWith: (options: {
157
- readonly acquirer: SqlConnection.Acquirer;
158
- readonly transactionAcquirer: SqlConnection.Acquirer;
159
- readonly listenAcquirer: Effect.Effect<Pg.ClientBase, SqlError, Scope.Scope>;
160
- readonly config: PgClientConfig;
161
- readonly spanAttributes?: Record<string, unknown> | undefined;
162
- readonly transformResultNames?: ((str: string) => string) | undefined;
163
- readonly transformQueryNames?: ((str: string) => string) | undefined;
164
- readonly transformJson?: boolean | undefined;
165
- }) => Effect.Effect<PgClient, SqlError, Reactivity.Reactivity | Scope.Scope>;
166
- /**
167
- * Creates a layer from an effect that acquires a `PgClient`, providing both `PgClient` and `SqlClient`.
134
+ * Provides both `PgClient` and `SqlClient` from an acquisition effect.
168
135
  *
169
136
  * @category layers
170
137
  * @since 4.0.0
171
138
  */
172
139
  export declare const layerFrom: <E, R>(acquire: Effect.Effect<PgClient, E, R>) => Layer.Layer<PgClient | Client.SqlClient, E, Exclude<R, Scope.Scope | Reactivity.Reactivity>>;
173
140
  /**
174
- * Creates a layer from a `Config`-wrapped PostgreSQL pool configuration, providing both `PgClient` and `SqlClient`.
141
+ * Creates a client layer from wrapped pool configuration.
175
142
  *
176
143
  * @category layers
177
144
  * @since 4.0.0
178
145
  */
179
146
  export declare const layerConfig: (config: Config.Wrap<PgPoolConfig>) => Layer.Layer<PgClient | Client.SqlClient, Config.ConfigError | SqlError>;
180
147
  /**
181
- * Creates a layer from a concrete PostgreSQL pool configuration, providing both `PgClient` and `SqlClient`.
148
+ * Creates a client layer from pool configuration.
182
149
  *
183
150
  * @category layers
184
151
  * @since 4.0.0
185
152
  */
186
153
  export declare const layer: (config: PgPoolConfig) => Layer.Layer<PgClient | Client.SqlClient, SqlError>;
187
154
  /**
188
- * Creates the PostgreSQL statement compiler, using `$1` placeholders, double-quoted identifiers, PostgreSQL returning clauses, and optional JSON value transformation.
155
+ * Creates the PostgreSQL statement compiler.
189
156
  *
190
157
  * @category constructors
191
158
  * @since 4.0.0
192
159
  */
193
160
  export declare const makeCompiler: (transform?: (_: string) => string, transformJson?: boolean) => Statement.Compiler;
194
161
  /**
195
- * PostgreSQL-specific custom statement fragments supported by the compiler, currently JSON parameter fragments.
162
+ * PostgreSQL-specific statement fragments.
196
163
  *
197
164
  * @category models
198
165
  * @since 4.0.0
@@ -1 +1 @@
1
- {"version":3,"file":"PgClient.d.ts","sourceRoot":"","sources":["../src/PgClient.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAKrC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,UAAU,MAAM,uCAAuC,CAAA;AACnE,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAA;AAEvD,OAAO,KAAK,KAAK,aAAa,MAAM,mCAAmC,CAAA;AACvE,OAAO,EAQL,QAAQ,EAKT,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AACrE,OAAO,KAAK,SAAS,MAAM,+BAA+B,CAAA;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AAIxB;;;;;GAKG;AACH,eAAO,MAAM,MAAM,EAAE,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