@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
@@ -0,0 +1,783 @@
1
+ import * as Result from "effect/Result";
2
+ /**
3
+ * Default `maxMessageSize` for `makeParser`: 16 MiB.
4
+ *
5
+ * @category constants
6
+ * @since 4.0.0
7
+ */
8
+ export declare const defaultMaxMessageSize: number;
9
+ /**
10
+ * An incremental decoder for the post-startup backend message stream.
11
+ *
12
+ * @category models
13
+ * @since 4.0.0
14
+ */
15
+ export interface Parser<A = Uint8Array | null> {
16
+ /**
17
+ * Reads each `DataRow` field, for a parser built with one. A result's
18
+ * columns are only known from its `RowDescription`, which arrives on the
19
+ * same stream, so this is settable: replace it when the columns change.
20
+ */
21
+ readField: FieldReader<A> | undefined;
22
+ /**
23
+ * Decodes a chunk and returns every complete message. A partial message is
24
+ * retained for the next call. Parse and field-reader errors are terminal and
25
+ * discard messages decoded earlier in the same call.
26
+ *
27
+ * **Details**
28
+ *
29
+ * `DataRow`, `CopyData`, and `Unknown` payloads are views into an internal
30
+ * buffer. Copy a payload that must outlive the current row, otherwise its
31
+ * entire buffer remains in memory.
32
+ */
33
+ readonly push: (chunk: Uint8Array) => ReadonlyArray<BackendMessage<A>>;
34
+ /**
35
+ * Decodes a chunk and passes each complete message to `onMessage`
36
+ * immediately. This lets a `RowDescription` update `readField` before a
37
+ * `DataRow` later in the same chunk is decoded. The failure and
38
+ * buffer-lifetime rules match `push`, except messages
39
+ * delivered before a failure are not discarded.
40
+ */
41
+ readonly pushEach: (chunk: Uint8Array, onMessage: (message: BackendMessage<A>) => void) => void;
42
+ }
43
+ /**
44
+ * Creates a `Parser`.
45
+ *
46
+ * **Details**
47
+ *
48
+ * Special pre-startup replies have no type byte. Use `decodeSslResponse` for
49
+ * those replies.
50
+ *
51
+ * @category constructors
52
+ * @since 4.0.0
53
+ */
54
+ export declare const makeParser: <A = Uint8Array | null>(options?: {
55
+ readonly maxMessageSize?: number | undefined;
56
+ /**
57
+ * Reads each `DataRow` field as it is parsed, so a client that decodes its
58
+ * columns never needs a view per column. Without one every field is handed
59
+ * out as a view, which is the default.
60
+ */
61
+ readonly readField?: FieldReader<A> | undefined;
62
+ }) => Parser<A>;
63
+ /**
64
+ * Prepares a named or unnamed statement.
65
+ *
66
+ * @category models
67
+ * @since 4.0.0
68
+ */
69
+ export interface Parse {
70
+ readonly _tag: "Parse";
71
+ readonly name: string;
72
+ readonly query: string;
73
+ readonly parameterTypes: ReadonlyArray<number>;
74
+ }
75
+ /**
76
+ * Binds parameter values to a prepared statement and creates a portal.
77
+ * Parameters and results use the binary format.
78
+ *
79
+ * @category models
80
+ * @since 4.0.0
81
+ */
82
+ export interface Bind {
83
+ readonly _tag: "Bind";
84
+ readonly portal: string;
85
+ readonly statement: string;
86
+ readonly parameters: ReadonlyArray<Uint8Array | null>;
87
+ }
88
+ /**
89
+ * Runs a portal, optionally limiting the number of rows returned.
90
+ *
91
+ * @category models
92
+ * @since 4.0.0
93
+ */
94
+ export interface Execute {
95
+ readonly _tag: "Execute";
96
+ readonly portal: string;
97
+ readonly maxRows: number;
98
+ }
99
+ /**
100
+ * Which kind of object a `Describe` or `Close` message names.
101
+ *
102
+ * @category models
103
+ * @since 4.0.0
104
+ */
105
+ export type DescribeTarget = "statement" | "portal";
106
+ /**
107
+ * Asks for the parameter and row shape of a statement or portal.
108
+ *
109
+ * @category models
110
+ * @since 4.0.0
111
+ */
112
+ export interface Describe {
113
+ readonly _tag: "Describe";
114
+ readonly target: DescribeTarget;
115
+ readonly name: string;
116
+ }
117
+ /**
118
+ * Drops a prepared statement or portal.
119
+ *
120
+ * @category models
121
+ * @since 4.0.0
122
+ */
123
+ export interface Close {
124
+ readonly _tag: "Close";
125
+ readonly target: DescribeTarget;
126
+ readonly name: string;
127
+ }
128
+ /**
129
+ * Closes the current transaction block and requests a `ReadyForQuery`.
130
+ *
131
+ * @category models
132
+ * @since 4.0.0
133
+ */
134
+ export interface Sync {
135
+ readonly _tag: "Sync";
136
+ }
137
+ /**
138
+ * Asks the backend to deliver buffered output without ending the transaction.
139
+ *
140
+ * @category models
141
+ * @since 4.0.0
142
+ */
143
+ export interface Flush {
144
+ readonly _tag: "Flush";
145
+ }
146
+ /**
147
+ * Ends the session.
148
+ *
149
+ * @category models
150
+ * @since 4.0.0
151
+ */
152
+ export interface Terminate {
153
+ readonly _tag: "Terminate";
154
+ }
155
+ /**
156
+ * Answers a cleartext or MD5 password request.
157
+ *
158
+ * @category models
159
+ * @since 4.0.0
160
+ */
161
+ export interface PasswordMessage {
162
+ readonly _tag: "PasswordMessage";
163
+ readonly password: string;
164
+ }
165
+ /**
166
+ * Selects a SASL mechanism and carries its opaque initial response.
167
+ *
168
+ * @category models
169
+ * @since 4.0.0
170
+ */
171
+ export interface SASLInitialResponse {
172
+ readonly _tag: "SASLInitialResponse";
173
+ readonly mechanism: string;
174
+ readonly initialResponse: Uint8Array | null;
175
+ }
176
+ /**
177
+ * Carries an opaque SASL continuation payload.
178
+ *
179
+ * @category models
180
+ * @since 4.0.0
181
+ */
182
+ export interface SASLResponse {
183
+ readonly _tag: "SASLResponse";
184
+ readonly data: Uint8Array;
185
+ }
186
+ /**
187
+ * Any message the client sends after startup.
188
+ *
189
+ * @category models
190
+ * @since 4.0.0
191
+ */
192
+ export type FrontendMessage = Parse | Bind | Execute | Describe | Close | Sync | Flush | Terminate | PasswordMessage | SASLInitialResponse | SASLResponse;
193
+ declare const ParseError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
194
+ readonly _tag: "PgProtocolParseError";
195
+ } & Readonly<A>;
196
+ /**
197
+ * Error produced when bytes cannot be interpreted as a protocol message.
198
+ *
199
+ * @category errors
200
+ * @since 4.0.0
201
+ */
202
+ export declare class ParseError extends ParseError_base<{
203
+ readonly message: string;
204
+ }> {
205
+ }
206
+ declare const EncodeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
207
+ readonly _tag: "PgProtocolEncodeError";
208
+ } & Readonly<A>;
209
+ /**
210
+ * Error returned when a frontend message cannot be encoded.
211
+ *
212
+ * @category errors
213
+ * @since 4.0.0
214
+ */
215
+ export declare class EncodeError extends EncodeError_base<{
216
+ readonly message: string;
217
+ }> {
218
+ }
219
+ /**
220
+ * Encodes a `Parse` message.
221
+ *
222
+ * @category encoding
223
+ * @since 4.0.0
224
+ */
225
+ export declare const encodeParse: (options: Omit<Parse, "_tag">) => Result.Result<Uint8Array, EncodeError>;
226
+ /**
227
+ * Encodes a `Bind` message.
228
+ *
229
+ * @category encoding
230
+ * @since 4.0.0
231
+ */
232
+ export declare const encodeBind: (options: Omit<Bind, "_tag">) => Result.Result<Uint8Array, EncodeError>;
233
+ /**
234
+ * A sink for writing parameter bytes into a `Bind` frame. The frame reserves
235
+ * and backfills each parameter length. `PgTypes.writeParameter` supports
236
+ * OID-typed values.
237
+ *
238
+ * @category models
239
+ * @since 4.0.0
240
+ */
241
+ export interface ValueSink {
242
+ readonly uint8: (value: number) => void;
243
+ readonly int16: (value: number) => void;
244
+ readonly int32: (value: number) => void;
245
+ readonly float32: (value: number) => void;
246
+ readonly float64: (value: number) => void;
247
+ readonly bigInt64: (value: bigint) => void;
248
+ readonly raw: (value: Uint8Array) => void;
249
+ readonly utf8: (value: string) => void;
250
+ /** Writes SQL NULL. The value must write nothing else. */
251
+ readonly sqlNull: () => void;
252
+ /**
253
+ * Leaves room for an int32 length and returns a token for `endLength`, so a
254
+ * value that contains other values can frame them without knowing their
255
+ * sizes up front. Tokens nest, and must be closed in the order they were
256
+ * opened.
257
+ */
258
+ readonly beginLength: () => number;
259
+ /** Backfills the length of everything written since its `beginLength`. */
260
+ readonly endLength: (token: number) => void;
261
+ }
262
+ /**
263
+ * Creates a `Bind` encoder that writes parameters directly into the frame.
264
+ *
265
+ * **Details**
266
+ *
267
+ * `textFormat` identifies parameters encoded as text. All other parameters
268
+ * use the binary format.
269
+ *
270
+ * **Example** (Encoding a `Bind` message)
271
+ *
272
+ * ```ts
273
+ * import { PgProtocol, PgTypes } from "@effect/sql-pg"
274
+ *
275
+ * const encodeBind = PgProtocol.makeBindEncoder(PgTypes.writeParameter, PgTypes.isTextFormat)
276
+ * const frame = encodeBind({ portal: "", statement: "s1", parameters: [PgTypes.int4(1)] })
277
+ * ```
278
+ *
279
+ * @category encoding
280
+ * @since 4.0.0
281
+ */
282
+ export declare const makeBindEncoder: <A, E = never>(writeParameter: (sink: ValueSink, value: A) => Result.Result<void, E>, textFormat?: (value: A) => boolean) => (options: {
283
+ readonly portal: string;
284
+ readonly statement: string;
285
+ readonly parameters: ReadonlyArray<A>;
286
+ }) => Result.Result<Uint8Array, EncodeError | E>;
287
+ /**
288
+ * Encodes an `Execute` message.
289
+ *
290
+ * @category encoding
291
+ * @since 4.0.0
292
+ */
293
+ export declare const encodeExecute: (options: Omit<Execute, "_tag">) => Uint8Array;
294
+ /**
295
+ * Encodes a `Describe` message.
296
+ *
297
+ * @category encoding
298
+ * @since 4.0.0
299
+ */
300
+ export declare const encodeDescribe: (options: Omit<Describe, "_tag">) => Uint8Array;
301
+ /**
302
+ * Encodes a `Close` message.
303
+ *
304
+ * @category encoding
305
+ * @since 4.0.0
306
+ */
307
+ export declare const encodeClose: (options: Omit<Close, "_tag">) => Uint8Array;
308
+ /**
309
+ * Encodes a `Sync` message.
310
+ *
311
+ * @category encoding
312
+ * @since 4.0.0
313
+ */
314
+ export declare const encodeSync: () => Uint8Array;
315
+ /**
316
+ * Encodes a `Flush` message.
317
+ *
318
+ * @category encoding
319
+ * @since 4.0.0
320
+ */
321
+ export declare const encodeFlush: () => Uint8Array;
322
+ /**
323
+ * Encodes a `Terminate` message.
324
+ *
325
+ * @category encoding
326
+ * @since 4.0.0
327
+ */
328
+ export declare const encodeTerminate: () => Uint8Array;
329
+ /**
330
+ * Encodes a `PasswordMessage`. The password is sent verbatim, so MD5 hashing
331
+ * belongs to the caller - see `PgAuth.md5Password`.
332
+ *
333
+ * @category encoding
334
+ * @since 4.0.0
335
+ */
336
+ export declare const encodePasswordMessage: (options: Omit<PasswordMessage, "_tag">) => Uint8Array;
337
+ /**
338
+ * Encodes a `SASLInitialResponse` message.
339
+ *
340
+ * @category encoding
341
+ * @since 4.0.0
342
+ */
343
+ export declare const encodeSASLInitialResponse: (options: Omit<SASLInitialResponse, "_tag">) => Uint8Array;
344
+ /**
345
+ * Encodes a `SASLResponse` message.
346
+ *
347
+ * @category encoding
348
+ * @since 4.0.0
349
+ */
350
+ export declare const encodeSASLResponse: (options: Omit<SASLResponse, "_tag">) => Uint8Array;
351
+ /**
352
+ * Encodes any frontend message.
353
+ *
354
+ * @category encoding
355
+ * @since 4.0.0
356
+ */
357
+ export declare const encode: (message: FrontendMessage) => Result.Result<Uint8Array, EncodeError>;
358
+ /**
359
+ * Startup parameters. `user` is required; any other run-time parameter the
360
+ * server accepts may be passed alongside it.
361
+ *
362
+ * @category models
363
+ * @since 4.0.0
364
+ */
365
+ export interface StartupParameters {
366
+ readonly [key: string]: string | undefined;
367
+ readonly user: string;
368
+ readonly database?: string | undefined;
369
+ readonly application_name?: string | undefined;
370
+ }
371
+ /**
372
+ * Encodes an `SSLRequest`. It has no type byte and is only valid before
373
+ * startup.
374
+ *
375
+ * @category encoding
376
+ * @since 4.0.0
377
+ */
378
+ export declare const encodeSslRequest: () => Uint8Array;
379
+ /**
380
+ * Decodes the single byte the server sends in reply to an `SSLRequest`. `"S"`
381
+ * means the server will speak TLS, `"N"` means it will not.
382
+ *
383
+ * @category decoding
384
+ * @since 4.0.0
385
+ */
386
+ export declare const decodeSslResponse: (byte: number) => Result.Result<"S" | "N", ParseError>;
387
+ /**
388
+ * Encodes a `StartupMessage` for protocol 3.0. It has no type byte.
389
+ * `client_encoding` defaults to `UTF8` because this codec always writes UTF-8.
390
+ *
391
+ * @category encoding
392
+ * @since 4.0.0
393
+ */
394
+ export declare const encodeStartupMessage: (parameters: StartupParameters) => Uint8Array;
395
+ /**
396
+ * Encodes a `CancelRequest`. It has no type byte and is sent on a separate
397
+ * connection, using the `pid` and `secret` from `BackendKeyData`.
398
+ *
399
+ * @category encoding
400
+ * @since 4.0.0
401
+ */
402
+ export declare const encodeCancelRequest: (options: {
403
+ readonly pid: number;
404
+ readonly secret: number;
405
+ }) => Uint8Array;
406
+ /**
407
+ * Authentication succeeded.
408
+ *
409
+ * @category models
410
+ * @since 4.0.0
411
+ */
412
+ export interface AuthenticationOk {
413
+ readonly _tag: "AuthenticationOk";
414
+ }
415
+ /**
416
+ * The server wants the password in the clear.
417
+ *
418
+ * @category models
419
+ * @since 4.0.0
420
+ */
421
+ export interface AuthenticationCleartextPassword {
422
+ readonly _tag: "AuthenticationCleartextPassword";
423
+ }
424
+ /**
425
+ * The server wants an MD5-hashed password, salted with these four bytes.
426
+ *
427
+ * @category models
428
+ * @since 4.0.0
429
+ */
430
+ export interface AuthenticationMD5Password {
431
+ readonly _tag: "AuthenticationMD5Password";
432
+ readonly salt: Uint8Array;
433
+ }
434
+ /**
435
+ * The server offers these SASL mechanisms.
436
+ *
437
+ * @category models
438
+ * @since 4.0.0
439
+ */
440
+ export interface AuthenticationSASL {
441
+ readonly _tag: "AuthenticationSASL";
442
+ readonly mechanisms: ReadonlyArray<string>;
443
+ }
444
+ /**
445
+ * An opaque SASL challenge.
446
+ *
447
+ * @category models
448
+ * @since 4.0.0
449
+ */
450
+ export interface AuthenticationSASLContinue {
451
+ readonly _tag: "AuthenticationSASLContinue";
452
+ readonly data: Uint8Array;
453
+ }
454
+ /**
455
+ * The opaque final SASL payload, carrying the server signature.
456
+ *
457
+ * @category models
458
+ * @since 4.0.0
459
+ */
460
+ export interface AuthenticationSASLFinal {
461
+ readonly _tag: "AuthenticationSASLFinal";
462
+ readonly data: Uint8Array;
463
+ }
464
+ /**
465
+ * An authentication request this codec does not model, such as GSSAPI or
466
+ * SSPI. The `method` is the raw sub-type integer.
467
+ *
468
+ * @category models
469
+ * @since 4.0.0
470
+ */
471
+ export interface AuthenticationUnsupported {
472
+ readonly _tag: "AuthenticationUnsupported";
473
+ readonly method: number;
474
+ readonly payload: Uint8Array;
475
+ }
476
+ /**
477
+ * Reports a run-time parameter value, at startup or whenever it changes.
478
+ *
479
+ * @category models
480
+ * @since 4.0.0
481
+ */
482
+ export interface ParameterStatus {
483
+ readonly _tag: "ParameterStatus";
484
+ readonly name: string;
485
+ readonly value: string;
486
+ }
487
+ /**
488
+ * The identity a `CancelRequest` needs.
489
+ *
490
+ * @category models
491
+ * @since 4.0.0
492
+ */
493
+ export interface BackendKeyData {
494
+ readonly _tag: "BackendKeyData";
495
+ readonly pid: number;
496
+ readonly secret: number;
497
+ }
498
+ /**
499
+ * Transaction status: idle, in a transaction block, or in a failed
500
+ * transaction block.
501
+ *
502
+ * @category models
503
+ * @since 4.0.0
504
+ */
505
+ export type TransactionStatus = "I" | "T" | "E";
506
+ /**
507
+ * The backend is ready for a new query cycle.
508
+ *
509
+ * @category models
510
+ * @since 4.0.0
511
+ */
512
+ export interface ReadyForQuery {
513
+ readonly _tag: "ReadyForQuery";
514
+ readonly status: TransactionStatus;
515
+ }
516
+ /**
517
+ * One column of a `RowDescription`.
518
+ *
519
+ * @category models
520
+ * @since 4.0.0
521
+ */
522
+ export interface FieldDescription {
523
+ readonly name: string;
524
+ readonly tableOid: number;
525
+ readonly columnAttributeNumber: number;
526
+ readonly dataTypeOid: number;
527
+ readonly dataTypeSize: number;
528
+ readonly typeModifier: number;
529
+ readonly format: number;
530
+ }
531
+ /**
532
+ * Describes the columns a portal will return.
533
+ *
534
+ * @category models
535
+ * @since 4.0.0
536
+ */
537
+ export interface RowDescription {
538
+ readonly _tag: "RowDescription";
539
+ readonly fields: ReadonlyArray<FieldDescription>;
540
+ }
541
+ /**
542
+ * One result row. Values stay raw bytes; `null` is SQL NULL. Decoding them
543
+ * requires the OIDs from the matching `RowDescription`.
544
+ *
545
+ * @category models
546
+ * @since 4.0.0
547
+ */
548
+ export interface DataRow<out A = Uint8Array | null> {
549
+ readonly _tag: "DataRow";
550
+ readonly values: ReadonlyArray<A>;
551
+ }
552
+ /**
553
+ * Reads one `DataRow` field from the parser buffer.
554
+ *
555
+ * **Details**
556
+ *
557
+ * `size` is `-1` for SQL `NULL`, and `column` is the field index. Only bytes
558
+ * from `offset` through `offset + size` belong to the field. A thrown error
559
+ * permanently fails the parser.
560
+ *
561
+ * @category models
562
+ * @since 4.0.0
563
+ */
564
+ export type FieldReader<A> = (bytes: Uint8Array, offset: number, size: number, column: number) => A;
565
+ /**
566
+ * A command finished, reporting its tag such as `SELECT 3`.
567
+ *
568
+ * @category models
569
+ * @since 4.0.0
570
+ */
571
+ export interface CommandComplete {
572
+ readonly _tag: "CommandComplete";
573
+ readonly commandTag: string;
574
+ }
575
+ /**
576
+ * The query string was empty.
577
+ *
578
+ * @category models
579
+ * @since 4.0.0
580
+ */
581
+ export interface EmptyQueryResponse {
582
+ readonly _tag: "EmptyQueryResponse";
583
+ }
584
+ /**
585
+ * The statement or portal returns no rows.
586
+ *
587
+ * @category models
588
+ * @since 4.0.0
589
+ */
590
+ export interface NoData {
591
+ readonly _tag: "NoData";
592
+ }
593
+ /**
594
+ * A `Parse` succeeded.
595
+ *
596
+ * @category models
597
+ * @since 4.0.0
598
+ */
599
+ export interface ParseComplete {
600
+ readonly _tag: "ParseComplete";
601
+ }
602
+ /**
603
+ * A `Bind` succeeded.
604
+ *
605
+ * @category models
606
+ * @since 4.0.0
607
+ */
608
+ export interface BindComplete {
609
+ readonly _tag: "BindComplete";
610
+ }
611
+ /**
612
+ * A `Close` succeeded.
613
+ *
614
+ * @category models
615
+ * @since 4.0.0
616
+ */
617
+ export interface CloseComplete {
618
+ readonly _tag: "CloseComplete";
619
+ }
620
+ /**
621
+ * An `Execute` stopped at its row limit; the portal can be executed again.
622
+ *
623
+ * @category models
624
+ * @since 4.0.0
625
+ */
626
+ export interface PortalSuspended {
627
+ readonly _tag: "PortalSuspended";
628
+ }
629
+ /**
630
+ * The parameter OIDs of a described statement.
631
+ *
632
+ * @category models
633
+ * @since 4.0.0
634
+ */
635
+ export interface ParameterDescription {
636
+ readonly _tag: "ParameterDescription";
637
+ readonly parameterTypes: ReadonlyArray<number>;
638
+ }
639
+ /**
640
+ * The fields of an `ErrorResponse` or `NoticeResponse`. Unrecognised field
641
+ * codes are kept under their raw single-character key.
642
+ *
643
+ * @category models
644
+ * @since 4.0.0
645
+ */
646
+ export interface ErrorFields {
647
+ readonly [key: string]: string | undefined;
648
+ readonly severity?: string | undefined;
649
+ readonly severityUnlocalized?: string | undefined;
650
+ readonly code?: string | undefined;
651
+ readonly message?: string | undefined;
652
+ readonly detail?: string | undefined;
653
+ readonly hint?: string | undefined;
654
+ readonly position?: string | undefined;
655
+ readonly internalPosition?: string | undefined;
656
+ readonly internalQuery?: string | undefined;
657
+ readonly where?: string | undefined;
658
+ readonly schema?: string | undefined;
659
+ readonly table?: string | undefined;
660
+ readonly column?: string | undefined;
661
+ readonly dataType?: string | undefined;
662
+ readonly constraint?: string | undefined;
663
+ readonly file?: string | undefined;
664
+ readonly line?: string | undefined;
665
+ readonly routine?: string | undefined;
666
+ }
667
+ /**
668
+ * An error. `code` is the SQLSTATE.
669
+ *
670
+ * @category models
671
+ * @since 4.0.0
672
+ */
673
+ export interface ErrorResponse {
674
+ readonly _tag: "ErrorResponse";
675
+ readonly fields: ErrorFields;
676
+ }
677
+ /**
678
+ * A warning or notice. Same field set as `ErrorResponse`.
679
+ *
680
+ * @category models
681
+ * @since 4.0.0
682
+ */
683
+ export interface NoticeResponse {
684
+ readonly _tag: "NoticeResponse";
685
+ readonly fields: ErrorFields;
686
+ }
687
+ /**
688
+ * A `LISTEN`/`NOTIFY` message.
689
+ *
690
+ * @category models
691
+ * @since 4.0.0
692
+ */
693
+ export interface NotificationResponse {
694
+ readonly _tag: "NotificationResponse";
695
+ readonly pid: number;
696
+ readonly channel: string;
697
+ readonly payload: string;
698
+ }
699
+ /**
700
+ * The server speaks an older minor protocol version, or did not recognise
701
+ * some startup options.
702
+ *
703
+ * @category models
704
+ * @since 4.0.0
705
+ */
706
+ export interface NegotiateProtocolVersion {
707
+ readonly _tag: "NegotiateProtocolVersion";
708
+ readonly minorVersion: number;
709
+ readonly unrecognizedOptions: ReadonlyArray<string>;
710
+ }
711
+ /**
712
+ * The server is ready to receive `COPY` data.
713
+ *
714
+ * @category models
715
+ * @since 4.0.0
716
+ */
717
+ export interface CopyInResponse {
718
+ readonly _tag: "CopyInResponse";
719
+ readonly format: number;
720
+ readonly columnFormats: ReadonlyArray<number>;
721
+ }
722
+ /**
723
+ * The server is about to send `COPY` data.
724
+ *
725
+ * @category models
726
+ * @since 4.0.0
727
+ */
728
+ export interface CopyOutResponse {
729
+ readonly _tag: "CopyOutResponse";
730
+ readonly format: number;
731
+ readonly columnFormats: ReadonlyArray<number>;
732
+ }
733
+ /**
734
+ * The connection entered bidirectional `COPY` mode, as used by replication.
735
+ *
736
+ * @category models
737
+ * @since 4.0.0
738
+ */
739
+ export interface CopyBothResponse {
740
+ readonly _tag: "CopyBothResponse";
741
+ readonly format: number;
742
+ readonly columnFormats: ReadonlyArray<number>;
743
+ }
744
+ /**
745
+ * A chunk of `COPY` data.
746
+ *
747
+ * @category models
748
+ * @since 4.0.0
749
+ */
750
+ export interface CopyData {
751
+ readonly _tag: "CopyData";
752
+ readonly data: Uint8Array;
753
+ }
754
+ /**
755
+ * The `COPY` stream ended.
756
+ *
757
+ * @category models
758
+ * @since 4.0.0
759
+ */
760
+ export interface CopyDone {
761
+ readonly _tag: "CopyDone";
762
+ }
763
+ /**
764
+ * A message whose type byte this codec does not know. The payload excludes
765
+ * the type byte and the length prefix.
766
+ *
767
+ * @category models
768
+ * @since 4.0.0
769
+ */
770
+ export interface Unknown {
771
+ readonly _tag: "Unknown";
772
+ readonly type: number;
773
+ readonly payload: Uint8Array;
774
+ }
775
+ /**
776
+ * Any message the server sends after startup.
777
+ *
778
+ * @category models
779
+ * @since 4.0.0
780
+ */
781
+ export type BackendMessage<A = Uint8Array | null> = AuthenticationOk | AuthenticationCleartextPassword | AuthenticationMD5Password | AuthenticationSASL | AuthenticationSASLContinue | AuthenticationSASLFinal | AuthenticationUnsupported | ParameterStatus | BackendKeyData | ReadyForQuery | RowDescription | DataRow<A> | CommandComplete | EmptyQueryResponse | NoData | ParseComplete | BindComplete | CloseComplete | PortalSuspended | ParameterDescription | ErrorResponse | NoticeResponse | NotificationResponse | NegotiateProtocolVersion | CopyInResponse | CopyOutResponse | CopyBothResponse | CopyData | CopyDone | Unknown;
782
+ export {};
783
+ //# sourceMappingURL=PgProtocol.d.ts.map