okmodel 0.9.0 → 0.9.1

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 (175) hide show
  1. package/README.md +9 -1
  2. package/dist/adapters/pg/bunsql-extra.d.ts +5 -5
  3. package/dist/adapters/pg/bunsql.d.ts +6 -2
  4. package/dist/adapters/pg/nodepostgres.d.ts +16 -1
  5. package/dist/adapters/pg/postgres-extra.d.ts +3 -17
  6. package/dist/adapters/pg/postgresjs.d.ts +2 -1
  7. package/dist/contracts/driver.d.ts +3 -2
  8. package/dist/contracts/error.d.ts +1 -1
  9. package/dist/dialects/pg/errors.d.ts +2 -0
  10. package/dist/dialects/pg/ext/fuzzystrmatch.js +1 -1
  11. package/dist/dialects/pg/ext/hstore.js +1 -1
  12. package/dist/dialects/pg/ext/ltree.js +1 -1
  13. package/dist/dialects/pg/ext/pgcrypto.js +1 -1
  14. package/dist/dialects/pg/ext/unaccent.js +1 -1
  15. package/dist/dialects/pg/filters.d.ts +2 -2
  16. package/dist/dialects/pg/fn/index.js +1 -1
  17. package/dist/dialects/pg/index.js +3 -3
  18. package/dist/dialects/pg/introspect.d.ts +12 -0
  19. package/dist/dialects/pg/view/index.js +2 -2
  20. package/dist/runtime/param-limit.d.ts +20 -0
  21. package/dist/runtime/pg/bun.js +3 -3
  22. package/dist/runtime/pg/neon.js +3 -3
  23. package/dist/runtime/pg/pg.js +3 -3
  24. package/dist/runtime/pg/pglite.js +2 -2
  25. package/dist/runtime/pg/postgresjs.js +10 -10
  26. package/dist/runtime/tenancy/index.js +1 -1
  27. package/dist/runtime/traits/index.js +2 -2
  28. package/dist/runtime/validate/index.js +2 -2
  29. package/dist/runtime/write.d.ts +1 -1
  30. package/dist/shared/{5kyb3tqx.js → 1h5h1rf5.js} +1 -1
  31. package/dist/shared/{4vbf83xx.js → 2vcnpf0n.js} +1 -1
  32. package/dist/shared/{8n688yjg.js → 3ap5hxvj.js} +2 -1
  33. package/dist/shared/{wvtjg5m3.js → 3d7a80fq.js} +1 -1
  34. package/dist/shared/{bphrgwz9.js → 3dr444ny.js} +57 -78
  35. package/dist/shared/{yvabyg9k.js → 3vvpcphd.js} +7 -6
  36. package/dist/shared/{760ppr76.js → 4a3mmhhe.js} +2 -2
  37. package/dist/shared/{90sg0w5a.js → 4pkz5nvw.js} +65 -10
  38. package/dist/shared/{mazpbcdj.js → 4te76xc5.js} +1 -1
  39. package/dist/shared/{xwhdcrm4.js → 60y4ahmw.js} +1 -1
  40. package/dist/shared/{9dtgn1z2.js → 63qjmhnp.js} +100 -17
  41. package/dist/shared/{s7he5e5d.js → 67w3kn71.js} +1 -1
  42. package/dist/shared/{n306gqkd.js → 6vfvsdkt.js} +9 -7
  43. package/dist/shared/{jpybhf98.js → 6xqvesa5.js} +1 -1
  44. package/dist/shared/{n5whk3mt.js → 8gdbty5v.js} +8 -8
  45. package/dist/shared/{ccsmhv9r.js → 8ma6drzr.js} +194 -31
  46. package/dist/shared/{3456242y.js → 8p2bgye0.js} +110 -18
  47. package/dist/shared/{ebhz8vh6.js → 8qwqrxed.js} +11 -3
  48. package/dist/shared/{ss2kv2rs.js → 8v7vzpgt.js} +10 -7
  49. package/dist/shared/{8qzkd9f3.js → ak61ye1f.js} +3 -3
  50. package/dist/shared/{6nae0spm.js → bdekbvmt.js} +69 -7
  51. package/dist/shared/{tw1nvvfj.js → bxjq6xqv.js} +2 -2
  52. package/dist/shared/{rbxt795q.js → c7dqd3gk.js} +81 -41
  53. package/dist/shared/ddh72ym5.js +20 -0
  54. package/dist/shared/e1c55v04.js +10 -0
  55. package/dist/shared/{8jesqsrk.js → ekhq3ytz.js} +1 -1
  56. package/dist/shared/{7ba5h6pb.js → esy4dyxe.js} +5 -5
  57. package/dist/shared/{gcefca6p.js → f9t9g54z.js} +22 -9
  58. package/dist/shared/fkjne6gx.js +8 -0
  59. package/dist/shared/{ds229x4r.js → fne90dvz.js} +4 -1
  60. package/dist/shared/{cexb7z6b.js → gr9sn4za.js} +1 -1
  61. package/dist/shared/{mvmm3xpb.js → gzgfsspx.js} +1 -1
  62. package/dist/shared/{fdsz3w80.js → hgt69zjf.js} +2 -2
  63. package/dist/shared/{dd5pmnky.js → jvxcp1qk.js} +70 -86
  64. package/dist/shared/{yybhre6n.js → k73e8n9d.js} +3 -3
  65. package/dist/shared/{mgaq2sd3.js → kzgrcy8s.js} +8 -7
  66. package/dist/shared/{myk8fswx.js → mz48rs74.js} +14 -3
  67. package/dist/shared/{62b603gr.js → n6je5b28.js} +10 -23
  68. package/dist/shared/{2szgv6yj.js → ns35jqz0.js} +71 -45
  69. package/dist/shared/{xtsydxjg.js → nstwgzn8.js} +1 -1
  70. package/dist/shared/{stfa9xcw.js → py2zrrm6.js} +7 -6
  71. package/dist/shared/{9dr2qnx7.js → qqm3ze6q.js} +1 -1
  72. package/dist/shared/{cf8zdz5p.js → rcjm0yn7.js} +27 -34
  73. package/dist/shared/{ckz05z15.js → rged92v6.js} +7 -4
  74. package/dist/shared/{qvwwp1mp.js → rw4tpcd0.js} +30 -21
  75. package/dist/shared/{bsek72fg.js → s5qe47a6.js} +3 -0
  76. package/dist/shared/{1d9q9cv2.js → smxzjz60.js} +2 -2
  77. package/dist/shared/{c3mvnq7a.js → th5rnaxw.js} +1 -1
  78. package/dist/shared/{1mxm04fy.js → tyqapcgk.js} +71 -8
  79. package/dist/shared/{zdqf8k5d.js → vsna85qf.js} +1 -1
  80. package/dist/shared/{63qtkrca.js → vy47ryqa.js} +55 -5
  81. package/dist/shared/{xv8qj97g.js → wbdh9qbg.js} +3 -1
  82. package/dist/shared/{2zdxkt7b.js → wp7y8q3y.js} +41 -9
  83. package/dist/shared/{pg4ezgyf.js → xbd9xs6p.js} +2 -2
  84. package/dist/shared/{npdftanb.js → xbvz446k.js} +16 -13
  85. package/dist/shared/{aksb89mn.js → y6tfjk9q.js} +2 -2
  86. package/dist/shared/{3bb7wsqt.js → ycnft340.js} +1 -1
  87. package/dist/shared/{z7s6fpxv.js → ymenf259.js} +1 -1
  88. package/dist/shared/{71n0jmhc.js → ysdw2fg3.js} +10 -2
  89. package/dist/shared/{xqacq37x.js → zecrwdk9.js} +1 -1
  90. package/dist/shared/{3t6kw83m.js → zm2rzqba.js} +2 -1
  91. package/dist/tooling/cli.js +122 -44
  92. package/dist/tooling/driver-run.js +107 -24
  93. package/dist/tooling/github/comment.d.ts +8 -2
  94. package/dist/tooling/migrate/apply.d.ts +17 -2
  95. package/dist/tooling/migrate/drift.d.ts +12 -0
  96. package/dist/tooling/migrate/driver-url.d.ts +17 -0
  97. package/dist/tooling/migrate/index.js +9 -7
  98. package/dist/tooling/migrate/policy.d.ts +17 -5
  99. package/dist/tooling/migrate/pooler-probe.d.ts +23 -0
  100. package/dist/tooling/migrate/pull.d.ts +3 -0
  101. package/dist/tooling/migrate/runner.d.ts +24 -1
  102. package/dist/tooling/shared/{0j0jtse1.js → 09a6vsys.js} +1 -1
  103. package/dist/tooling/shared/{68tf18v4.js → 0v9ptnxp.js} +8 -8
  104. package/dist/tooling/shared/{qartgazh.js → 0wtzps9p.js} +6 -6
  105. package/dist/tooling/shared/{1800eymw.js → 0yhf1db4.js} +6 -6
  106. package/dist/tooling/shared/{s6qha57m.js → 19msgrsc.js} +2 -2
  107. package/dist/tooling/shared/{3yn79q5m.js → 1fwfm5m3.js} +1 -1
  108. package/dist/tooling/shared/{hfq3n3bd.js → 2jdn09e2.js} +55 -5
  109. package/dist/tooling/shared/{v6j1ep6w.js → 2qrte2ct.js} +5 -5
  110. package/dist/tooling/shared/{yb4kd19s.js → 2v4nwnkb.js} +1 -1
  111. package/dist/tooling/shared/{ezqn88nj.js → 33z39trp.js} +106 -23
  112. package/dist/tooling/shared/{0r05zhyq.js → 353vnw9z.js} +5 -5
  113. package/dist/tooling/shared/{m4hhb8aa.js → 390kry9g.js} +2 -2
  114. package/dist/tooling/shared/{rcywj2w8.js → 3f6etb9z.js} +18 -31
  115. package/dist/tooling/shared/{9wsnsvbf.js → 3t2cqmsx.js} +1 -1
  116. package/dist/tooling/shared/{5zrzffnk.js → 4dzvjtpy.js} +1 -1
  117. package/dist/tooling/shared/{am04v8na.js → 4ec0nxvw.js} +10 -10
  118. package/dist/tooling/shared/{04svnxxj.js → 4tg2bn41.js} +59 -78
  119. package/dist/tooling/shared/{829fjxyw.js → 5rah55z0.js} +2 -2
  120. package/dist/tooling/shared/{c0xevn1h.js → 804w1t69.js} +4 -4
  121. package/dist/tooling/shared/{dhatassp.js → 8g0m0rvd.js} +6 -6
  122. package/dist/tooling/shared/{zx3v9phv.js → 8msbtw5s.js} +1 -1
  123. package/dist/tooling/shared/{7pxncnzs.js → 8t22h3h7.js} +2 -2
  124. package/dist/tooling/shared/{wbwq1jsa.js → 91c59b7b.js} +2 -2
  125. package/dist/tooling/shared/{a2xe04bm.js → adk9k6va.js} +1 -1
  126. package/dist/tooling/shared/{w17sj05d.js → ajjd5cwz.js} +2 -2
  127. package/dist/tooling/shared/{35zemrmf.js → angjck01.js} +1 -1
  128. package/dist/tooling/shared/{jsjjz875.js → asnnc3v5.js} +1 -1
  129. package/dist/tooling/shared/{5bmksndh.js → bj1kyqc8.js} +2 -2
  130. package/dist/tooling/shared/{kbqnrs1x.js → bt3tjemb.js} +11 -3
  131. package/dist/tooling/shared/{vwr2y833.js → chk2bh4f.js} +2 -2
  132. package/dist/tooling/shared/{ybdew6j7.js → ckq4z5ax.js} +5 -2
  133. package/dist/tooling/shared/{3rmaz3pq.js → d3rhb24q.js} +1 -1
  134. package/dist/tooling/shared/{mw5npye0.js → d8q00vxg.js} +4 -4
  135. package/dist/tooling/shared/{j664qjrt.js → dx188rxs.js} +2 -2
  136. package/dist/tooling/shared/{8yr7ges1.js → efq6p9df.js} +35 -42
  137. package/dist/tooling/shared/{yhp829bx.js → en6rwzq0.js} +3 -3
  138. package/dist/tooling/shared/{f77nnfqy.js → f2r5g0fs.js} +2 -2
  139. package/dist/tooling/shared/{zs9aymcp.js → f4gep0nk.js} +1 -1
  140. package/dist/tooling/shared/{kz715295.js → f8a010fm.js} +13 -11
  141. package/dist/tooling/shared/{w5d89rb4.js → fdsek6pa.js} +1 -1
  142. package/dist/tooling/shared/fvmrxsd1.js +8 -0
  143. package/dist/tooling/shared/{jpgmjsx3.js → g3xybeqf.js} +4 -3
  144. package/dist/tooling/shared/{wezxf3h8.js → gefmpwsa.js} +1 -1
  145. package/dist/tooling/shared/{jr2nmr81.js → gjj71hfh.js} +23 -20
  146. package/dist/tooling/shared/{9sfbtwsk.js → jgzt69pa.js} +5 -5
  147. package/dist/tooling/shared/{a4pzghha.js → jm30k2ca.js} +10 -8
  148. package/dist/tooling/shared/{shjs0379.js → kayqzpbk.js} +6 -3
  149. package/dist/tooling/shared/{tcwpjvxe.js → kvw1672d.js} +1 -1
  150. package/dist/tooling/shared/{stebqyyd.js → mr1kcgpw.js} +3 -3
  151. package/dist/tooling/shared/{tpssp7ac.js → mwbdf409.js} +1 -1
  152. package/dist/tooling/shared/{fh07z1dt.js → ns9207v3.js} +1 -1
  153. package/dist/tooling/shared/{5p8km5jb.js → p6tjv97k.js} +3 -3
  154. package/dist/tooling/shared/{ytk1tjs0.js → p73evwf0.js} +1 -1
  155. package/dist/tooling/shared/{8m5znpdt.js → phc1nc4g.js} +1 -1
  156. package/dist/tooling/shared/{asgr07mp.js → ppybjw50.js} +79 -16
  157. package/dist/tooling/shared/{t4xveemq.js → qdrn8ghn.js} +5 -4
  158. package/dist/tooling/shared/rd8h01ta.js +20 -0
  159. package/dist/tooling/shared/{7aews1zg.js → rwg8y90m.js} +3 -3
  160. package/dist/tooling/shared/{5x3pf400.js → ry2f3w8p.js} +3 -3
  161. package/dist/tooling/shared/{m3xt8b1h.js → ryc5sa58.js} +8 -8
  162. package/dist/tooling/shared/{57btdkgm.js → ss87qxwv.js} +2 -2
  163. package/dist/tooling/shared/{6vk28rjp.js → vg68k11z.js} +3 -3
  164. package/dist/tooling/shared/{62fxpc1p.js → vms9dta5.js} +73 -89
  165. package/dist/tooling/shared/{gqwevek4.js → xchpnbdv.js} +1 -1
  166. package/dist/tooling/shared/{t6zjeake.js → xn6p01fh.js} +5 -5
  167. package/dist/tooling/shared/{7b3xp9gc.js → xwr6q618.js} +3 -3
  168. package/dist/tooling/shared/{yfedr1zb.js → xx3gmq94.js} +1 -1
  169. package/dist/tooling/shared/{9qr9rkbh.js → y2bd7yfx.js} +21 -13
  170. package/dist/tooling/shared/{nxq95eb6.js → y4gq9rbe.js} +11 -11
  171. package/dist/tooling/shared/{76pv6qff.js → y4vwft92.js} +2 -2
  172. package/dist/tooling/shared/{sjwkt1pg.js → yz68xcmc.js} +1 -1
  173. package/dist/tooling/testing/factories.d.ts +1 -3
  174. package/dist/tooling/testing/index.js +1 -1
  175. package/package.json +2 -1
package/README.md CHANGED
@@ -50,7 +50,15 @@ bun add okmodel @electric-sql/pglite
50
50
  bun add okmodel
51
51
  ```
52
52
 
53
- postgres.js is the default on Node and Bun. node-postgres is for a project that already has `pg`. PGlite runs Postgres in the process. The last line is Bun.sql, built into Bun, and it runs only there.
53
+ postgres.js is the default on Node and Bun. node-postgres is for a project that already has `pg`. PGlite runs Postgres in the process. The last line is Bun.sql, built into Bun 1.4+, and it runs only there.
54
+
55
+ Date and time columns need a `Temporal` global. Bun and Node 26 have it. On Node 22 and 24 assign a polyfill before those columns run (OKM1210 when it is missing). Example with `temporal-polyfill` (not part of the quickstart script):
56
+
57
+ ```typescript
58
+ import { Temporal } from "temporal-polyfill";
59
+
60
+ globalThis.Temporal = Temporal;
61
+ ```
54
62
 
55
63
  ## Quick start
56
64
 
@@ -4,14 +4,15 @@
4
4
  * Loaded on the first reserve, batch, stream, or dead connection. A read that
5
5
  * succeeds does not use it.
6
6
  */
7
- import type { ReservedSQL, SQL } from "./bun-sql.js";
7
+ import type { SQL } from "./bun-sql.js";
8
8
  import type { DriverConnection, WireValue } from "../../contracts/driver.js";
9
9
  import { type HeldPool } from "./bunsql.js";
10
10
  /**
11
11
  * Checks out one connection and clears it on release.
12
12
  *
13
- * A connection that is gone is neither reset nor parked: Bun.sql has already
14
- * dropped it, and parking it would hand a dead session to the next caller.
13
+ * A connection that is gone is neither reset nor returned to the pool: Bun.sql
14
+ * has already dropped it. A reset or release failure after the caller's work
15
+ * finished destroys the handle and does not fail the call.
15
16
  *
16
17
  * @param held - The pool and its counters
17
18
  * @returns A connection the caller must release
@@ -45,13 +46,12 @@ export declare function drainClosed(sql: SQL): Promise<void>;
45
46
  * Subscribes on one pooled connection.
46
47
  *
47
48
  * @param sql - The pool
48
- * @param parked - Reserved handles to put back first
49
49
  * @param closed - The pool is closed
50
50
  * @param channel - Notify channel
51
51
  * @param onNotify - Payload callback
52
52
  * @returns Stops the subscription
53
53
  */
54
- export declare function listen(sql: SQL, parked: ReservedSQL[], closed: boolean, channel: string, onNotify: (payload: string) => void): Promise<() => Promise<void>>;
54
+ export declare function listen(sql: SQL, closed: boolean, channel: string, onNotify: (payload: string) => void): Promise<() => Promise<void>>;
55
55
  export declare function checkout(held: HeldPool): Promise<DriverConnection & {
56
56
  evict(): void;
57
57
  }>;
@@ -36,7 +36,6 @@ export type BunSqlConfig = DriverPoolConfig & {
36
36
  /** What a checkout needs from the pool that opened it. */
37
37
  export type HeldPool = {
38
38
  readonly sql: SQL;
39
- readonly parked: ReservedSQL[];
40
39
  readonly acquireMs: number | undefined;
41
40
  readonly counters: Counters;
42
41
  readonly notices: ReturnType<typeof noticeBuffer>;
@@ -70,4 +69,9 @@ export type Counters = {
70
69
  export declare function open(config: BunSqlConfig): DriverPool;
71
70
  export declare function send(sql: SQL, text: string, params: readonly WireValue[] | undefined): WireQuery;
72
71
  export declare function reserve(sql: SQL, acquireMs: number | undefined, counters: Counters): Promise<ReservedSQL>;
73
- export declare function park(parked: ReservedSQL[], reserved: ReservedSQL): Promise<void>;
72
+ /**
73
+ * Returns a reserved handle to Bun's pool.
74
+ *
75
+ * @param reserved - The handle to release
76
+ */
77
+ export declare function releaseReserved(reserved: ReservedSQL): Promise<void>;
@@ -55,7 +55,22 @@ export type Counters = {
55
55
  * @param source - Pool or client
56
56
  * @param handle - What to do with the error
57
57
  */
58
- export declare function armDriverError(source: object, handle?: () => void): void;
58
+ export declare function armDriverError(source: object, handle?: (error?: unknown) => void): void;
59
+ /**
60
+ * Records an idle or checked-out client error on the notice path (B-44).
61
+ *
62
+ * Does not throw. The pool has already dropped a dead idle client.
63
+ *
64
+ * @param notices - Pool notice buffer
65
+ * @param error - The `error` event value
66
+ */
67
+ export declare function logClientError(notices: {
68
+ push(notice: {
69
+ severity: string;
70
+ message: string;
71
+ code?: string;
72
+ }): void;
73
+ }, error: unknown): void;
59
74
  /**
60
75
  * Opens a node-postgres pool for one endpoint.
61
76
  *
@@ -29,23 +29,7 @@ export type HeldPool = {
29
29
  * @returns A connection the caller must release
30
30
  */
31
31
  export declare function checkout(pool: HeldPool, timeoutMs?: number): Promise<DriverConnection>;
32
- /**
33
- * Describes a statement.
34
- *
35
- * @param sql - Pool client
36
- * @param text - SQL
37
- * @param params - Wire parameters
38
- * @returns Column names and the parameter count
39
- */
40
32
  export declare function describe(sql: Sql, text: string, params?: readonly WireValue[]): Promise<DescribeResult>;
41
- /**
42
- * Yields cursor chunks.
43
- *
44
- * @param sql - Pool client
45
- * @param text - SQL
46
- * @param params - Wire parameters
47
- * @returns Chunks of wire rows
48
- */
49
33
  export declare function stream(sql: Sql, text: string, params?: readonly WireValue[]): AsyncIterable<readonly (readonly WireValue[])[]>;
50
34
  /**
51
35
  * Settles `run` when `ms` elapses, the reserved connection closes, or every
@@ -80,7 +64,9 @@ export declare function runBatch(pool: HeldPool, statements: readonly Statement[
80
64
  * @param sql - Reserved connection
81
65
  * @param lost - Set when that socket closes
82
66
  */
83
- export declare function watchReserved(sql: Sql, lost: Lost): void;
67
+ declare function arm(sql: Sql, lost: Lost): void;
68
+ /** @inheritdoc */
69
+ export declare const watchReserved: typeof arm;
84
70
  type Gate = {
85
71
  enter(): void;
86
72
  leave(): void;
@@ -53,7 +53,8 @@ export declare function open(config: PostgresJsConfig): DriverPool;
53
53
  export declare class PgSession implements BatchSession {
54
54
  readonly canCancel = true;
55
55
  private transactionDepth;
56
- private readonly sql;
56
+ /** Current client. A storm rebuild assigns a new pool client here. */
57
+ sql: Sql;
57
58
  private readonly counters;
58
59
  private readonly scope;
59
60
  private readonly local;
@@ -162,8 +162,9 @@ export type DriverPoolConfig = {
162
162
  readonly max?: number;
163
163
  /**
164
164
  * Ceilings in milliseconds. An adapter reads `acquire`: it waits for a
165
- * connection up to that long, then fails with OKM1846. Omitted means wait
166
- * without a deadline. The other keys belong to the runtime.
165
+ * connection up to that long, then fails with OKM1846. Omitted means the
166
+ * adapter default (10 s on postgres.js and node-postgres). The other keys
167
+ * belong to the runtime.
167
168
  */
168
169
  readonly timeouts?: DriverTimeouts;
169
170
  };
@@ -31,7 +31,7 @@ export type ColumnCode = (typeof COLUMN_CODES)[number];
31
31
  * These are spec §21 codes. They are a type only, so the runtime entry does
32
32
  * not gain a second registry.
33
33
  */
34
- export type QueryCode = "OKM1101" | "OKM1102" | "OKM1104" | "OKM1105" | "OKM1111" | "OKM1120" | "OKM1121" | "OKM1124" | "OKM1125" | "OKM1130" | "OKM1190" | "OKM1701" | "OKM1704" | "OKM1801" | "OKM1802" | "OKM1803" | "OKM1843";
34
+ export type QueryCode = "OKM1101" | "OKM1102" | "OKM1104" | "OKM1105" | "OKM1111" | "OKM1120" | "OKM1121" | "OKM1124" | "OKM1125" | "OKM1126" | "OKM1130" | "OKM1190" | "OKM1701" | "OKM1704" | "OKM1801" | "OKM1802" | "OKM1803" | "OKM1843";
35
35
  /** Kinds from spec §14, in category order. */
36
36
  export declare const ERROR_KINDS: readonly ["invalid", "not_null", "check", "foreign_key", "unique", "exclusion", "conflict", "not_found", "not_unique", "forbidden", "serialization", "deadlock", "lock_timeout", "timeout", "cancelled", "unavailable", "schema_drift", "driver", "read_only", "outcome_unknown"];
37
37
  /** One spec §14 kind. */
@@ -25,6 +25,8 @@ export type MapPostgresErrorSchema = {
25
25
  type SqlField = {
26
26
  readonly field: string;
27
27
  readonly sql: string;
28
+ /** When true, mapped errors for this table keep values out of `cause` (B-33). */
29
+ readonly sensitive?: boolean;
28
30
  };
29
31
  /** Options for {@link mapPostgresError}. */
30
32
  export type MapPostgresErrorOptions = {
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  fnEqualsArg,
9
9
  fnDistance
10
- } from "../../../shared/xqacq37x.js";
10
+ } from "../../../shared/zecrwdk9.js";
11
11
 
12
12
  // src/dialects/pg/ext/fuzzystrmatch.ts
13
13
  function fuzzystrmatch(options = {}) {
@@ -3,7 +3,7 @@ import {
3
3
  } from "../../../shared/6f0z3hzh.js";
4
4
  import {
5
5
  opArg
6
- } from "../../../shared/xqacq37x.js";
6
+ } from "../../../shared/zecrwdk9.js";
7
7
  import {
8
8
  usingIndex
9
9
  } from "../../../shared/h9811jjm.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "../../../shared/6f0z3hzh.js";
4
4
  import {
5
5
  opArg
6
- } from "../../../shared/xqacq37x.js";
6
+ } from "../../../shared/zecrwdk9.js";
7
7
  import {
8
8
  usingIndex
9
9
  } from "../../../shared/h9811jjm.js";
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  bareCall,
9
9
  digestEquals
10
- } from "../../../shared/xqacq37x.js";
10
+ } from "../../../shared/zecrwdk9.js";
11
11
 
12
12
  // src/dialects/pg/ext/pgcrypto.ts
13
13
  function pgcrypto(options = {}) {
@@ -3,7 +3,7 @@ import {
3
3
  } from "../../../shared/6f0z3hzh.js";
4
4
  import {
5
5
  fnEqualsArg
6
- } from "../../../shared/xqacq37x.js";
6
+ } from "../../../shared/zecrwdk9.js";
7
7
 
8
8
  // src/dialects/pg/ext/unaccent.ts
9
9
  function unaccent(options = {}) {
@@ -11,9 +11,9 @@ import type { FilterSpec, ParsedFilters } from "./table.js";
11
11
  * @param table - Table the filters belong to
12
12
  * @param relations - Relation calls stored on the table, when it has any
13
13
  * @param spec - Allow, sort, and relation fields
14
- * @param hiddenFields - `table.field` keys recorded while tables were defined
14
+ * @param isHidden - Whether `table.field` is hidden (own columns or related names)
15
15
  * @returns A parser for one request object
16
16
  */
17
- export declare function openFilters(table: string, relations: unknown, spec: FilterSpec, hiddenFields: ReadonlySet<string>): {
17
+ export declare function openFilters(table: string, relations: unknown, spec: FilterSpec, isHidden: (table: string, field: string) => boolean): {
18
18
  parse(query: unknown): Promise<ParsedFilters>;
19
19
  };
@@ -9,7 +9,7 @@ import {
9
9
  isFragmentParts,
10
10
  sqlExpression,
11
11
  identName
12
- } from "../../../shared/bsek72fg.js";
12
+ } from "../../../shared/s5qe47a6.js";
13
13
  import {
14
14
  staticNamespace2
15
15
  } from "../../../shared/358zsv4r.js";
@@ -47,7 +47,7 @@ import {
47
47
  } from "../../shared/ecn8mfdq.js";
48
48
  import {
49
49
  schema2
50
- } from "../../shared/9dr2qnx7.js";
50
+ } from "../../shared/qqm3ze6q.js";
51
51
  import {
52
52
  one2,
53
53
  many2,
@@ -68,7 +68,7 @@ import {
68
68
  table2,
69
69
  index2,
70
70
  sql2
71
- } from "../../shared/gcefca6p.js";
71
+ } from "../../shared/f9t9g54z.js";
72
72
  import {
73
73
  ColumnBuilder2,
74
74
  required,
@@ -78,7 +78,7 @@ import {
78
78
  isFragmentParts,
79
79
  fragment2,
80
80
  ident2
81
- } from "../../shared/bsek72fg.js";
81
+ } from "../../shared/s5qe47a6.js";
82
82
  import {
83
83
  domainType
84
84
  } from "../../shared/ywspezzx.js";
@@ -74,3 +74,15 @@ export declare function atomicBody(definition: string): string;
74
74
  * @returns The reprinted expression, without the `CHECK` keyword
75
75
  */
76
76
  export declare function reprintCheck(runner: CatalogQuery, expression: string): Promise<string>;
77
+ /**
78
+ * Creates a temporary domain and reads the check Postgres stores.
79
+ *
80
+ * Domain checks use `VALUE`, which is not valid on a table check. Two
81
+ * authoring spellings of the same domain predicate compare equal after this.
82
+ *
83
+ * @param runner - Database connection
84
+ * @param base - Domain base type, as Postgres `format_type` spells it
85
+ * @param expression - Check expression without the `CHECK` keyword
86
+ * @returns The reprinted expression, without the `CHECK` keyword
87
+ */
88
+ export declare function reprintDomainCheck(runner: CatalogQuery, base: string, expression: string): Promise<string>;
@@ -8,10 +8,10 @@ import {
8
8
  } from "../../../shared/fk9vef30.js";
9
9
  import {
10
10
  viewClient
11
- } from "../../../shared/760ppr76.js";
11
+ } from "../../../shared/4a3mmhhe.js";
12
12
  import {
13
13
  snakeCase
14
- } from "../../../shared/gcefca6p.js";
14
+ } from "../../../shared/f9t9g54z.js";
15
15
  import {
16
16
  formatType
17
17
  } from "../../../shared/606g0nbf.js";
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Postgres protocol parameter budget (B-40).
3
+ *
4
+ * Loaded only when a statement goes over the limit. Small statements pay one
5
+ * integer compare in the path that already holds the parameter list.
6
+ */
7
+ /** Postgres binds at most this many parameters on one statement. */
8
+ export declare const PG_PARAM_LIMIT = 65535;
9
+ /**
10
+ * Refuses a statement that exceeds the protocol parameter limit.
11
+ *
12
+ * @param count - Parameter count of the finished statement
13
+ */
14
+ export declare function refuseParamLimit(count: number): never;
15
+ /**
16
+ * Throws OKM1126 when `count` is above {@link PG_PARAM_LIMIT}.
17
+ *
18
+ * @param count - Parameter count of the finished statement
19
+ */
20
+ export declare function assertParamCount(count: number): void;
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  markClientPool,
6
6
  open5
7
- } from "../../shared/62b603gr.js";
7
+ } from "../../shared/n6je5b28.js";
8
8
  import {
9
9
  BUNSQL_CAPABILITIES,
10
10
  readCapability2,
@@ -12,12 +12,12 @@ import {
12
12
  } from "../../shared/mfvx6kjx.js";
13
13
  import {
14
14
  createClient
15
- } from "../../shared/npdftanb.js";
15
+ } from "../../shared/xbvz446k.js";
16
16
 
17
17
  // src/runtime/pg/bun.ts
18
18
  function connect(target, options) {
19
19
  if (typeof target === "object" && !isPool(target)) {
20
- return import("../../shared/71n0jmhc.js").then((mod) => mod.default(target, options, (config) => {
20
+ return import("../../shared/ysdw2fg3.js").then((mod) => mod.default(target, options, (config) => {
21
21
  const pool = open5(config);
22
22
  markClientPool(pool);
23
23
  return pool;
@@ -3,7 +3,7 @@ import {
3
3
  } from "../../shared/cm3w0ywp.js";
4
4
  import {
5
5
  open6
6
- } from "../../shared/mazpbcdj.js";
6
+ } from "../../shared/4te76xc5.js";
7
7
  import {
8
8
  NEON_WEBSOCKET_CAPABILITIES,
9
9
  NEON_HTTP_CAPABILITIES,
@@ -12,12 +12,12 @@ import {
12
12
  } from "../../shared/mfvx6kjx.js";
13
13
  import {
14
14
  createClient
15
- } from "../../shared/npdftanb.js";
15
+ } from "../../shared/xbvz446k.js";
16
16
 
17
17
  // src/runtime/pg/neon.ts
18
18
  function connect(target, options) {
19
19
  if (typeof target === "object" && !isPool(target)) {
20
- return import("../../shared/71n0jmhc.js").then((mod) => mod.default(target, options, (config) => open6({
20
+ return import("../../shared/ysdw2fg3.js").then((mod) => mod.default(target, options, (config) => open6({
21
21
  url: config.url,
22
22
  ...options.mode !== undefined ? { mode: options.mode } : {},
23
23
  ...config.max !== undefined ? { max: config.max } : {},
@@ -3,7 +3,7 @@ import {
3
3
  } from "../../shared/cm3w0ywp.js";
4
4
  import {
5
5
  open4
6
- } from "../../shared/1mxm04fy.js";
6
+ } from "../../shared/tyqapcgk.js";
7
7
  import {
8
8
  NODE_POSTGRES_CAPABILITIES,
9
9
  readCapability2,
@@ -11,12 +11,12 @@ import {
11
11
  } from "../../shared/mfvx6kjx.js";
12
12
  import {
13
13
  createClient
14
- } from "../../shared/npdftanb.js";
14
+ } from "../../shared/xbvz446k.js";
15
15
 
16
16
  // src/runtime/pg/pg.ts
17
17
  function connect(target, options) {
18
18
  if (typeof target === "object" && !isPool(target)) {
19
- return import("../../shared/71n0jmhc.js").then((mod) => mod.default(target, options, open4));
19
+ return import("../../shared/ysdw2fg3.js").then((mod) => mod.default(target, options, open4));
20
20
  }
21
21
  const owned = !isPool(target);
22
22
  const pool = isPool(target) ? target : open4({
@@ -12,12 +12,12 @@ import {
12
12
  } from "../../shared/mfvx6kjx.js";
13
13
  import {
14
14
  createClient
15
- } from "../../shared/npdftanb.js";
15
+ } from "../../shared/xbvz446k.js";
16
16
 
17
17
  // src/runtime/pg/pglite.ts
18
18
  async function connect(target, options) {
19
19
  if (typeof target === "object" && !isPool(target)) {
20
- return import("../../shared/71n0jmhc.js").then((mod) => mod.default(target, options, open3));
20
+ return import("../../shared/ysdw2fg3.js").then((mod) => mod.default(target, options, open3));
21
21
  }
22
22
  const pool = isPool(target) ? seal2(target) : await open3({
23
23
  ...target !== undefined ? { dataDir: target } : {},
@@ -3,7 +3,7 @@ import {
3
3
  } from "../../shared/cm3w0ywp.js";
4
4
  import {
5
5
  open2
6
- } from "../../shared/dd5pmnky.js";
6
+ } from "../../shared/jvxcp1qk.js";
7
7
  import {
8
8
  POSTGRESJS_CAPABILITIES,
9
9
  readCapability2,
@@ -11,22 +11,22 @@ import {
11
11
  } from "../../shared/mfvx6kjx.js";
12
12
  import {
13
13
  createClient
14
- } from "../../shared/npdftanb.js";
14
+ } from "../../shared/xbvz446k.js";
15
15
 
16
16
  // src/runtime/pg/postgresjs.ts
17
17
  function connect(target, options) {
18
18
  if (typeof target === "object" && !isPool(target)) {
19
- return import("../../shared/71n0jmhc.js").then((mod) => mod.default(target, options, open2));
19
+ return import("../../shared/ysdw2fg3.js").then((mod) => mod.default(target, options, open2));
20
20
  }
21
21
  const owned = !isPool(target);
22
- const pool = isPool(target) ? target : open2({
22
+ const pool = owned ? open2({
23
23
  url: target,
24
- ...options.max !== undefined ? { max: options.max } : {},
25
- ...options.timeouts !== undefined ? { timeouts: options.timeouts } : {},
26
- ...options.prepared !== undefined ? { prepared: options.prepared } : {},
27
- ...options.searchPath !== undefined ? { searchPath: options.searchPath } : {},
28
- ...options.ssl !== undefined ? { ssl: options.ssl } : {}
29
- });
24
+ max: options.max,
25
+ timeouts: options.timeouts,
26
+ prepared: options.prepared,
27
+ searchPath: options.searchPath,
28
+ ssl: options.ssl
29
+ }) : target;
30
30
  return createClient(options.schema, pool, {
31
31
  ownsPool: owned,
32
32
  http: options.errors?.http,
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  index2,
12
12
  snakeCase
13
- } from "../../shared/gcefca6p.js";
13
+ } from "../../shared/f9t9g54z.js";
14
14
  import {
15
15
  ColumnBuilder2,
16
16
  retarget
@@ -24,7 +24,7 @@ import {
24
24
  } from "../../shared/ecn8mfdq.js";
25
25
  import {
26
26
  snakeCase
27
- } from "../../shared/gcefca6p.js";
27
+ } from "../../shared/f9t9g54z.js";
28
28
  import {
29
29
  ColumnBuilder2,
30
30
  retarget
@@ -41,7 +41,7 @@ import {
41
41
  queryHandle,
42
42
  attachHttp,
43
43
  settleCall
44
- } from "../../shared/npdftanb.js";
44
+ } from "../../shared/xbvz446k.js";
45
45
  import {
46
46
  installArchiveInspect,
47
47
  indexes,
@@ -3,10 +3,10 @@ import {
3
3
  } from "../../shared/w9ejzaqf.js";
4
4
  import {
5
5
  addSchemaHook
6
- } from "../../shared/9dr2qnx7.js";
6
+ } from "../../shared/qqm3ze6q.js";
7
7
  import {
8
8
  queryHandle
9
- } from "../../shared/npdftanb.js";
9
+ } from "../../shared/xbvz446k.js";
10
10
  import {
11
11
  OkmError2
12
12
  } from "../../shared/52szzakm.js";
@@ -39,7 +39,7 @@ export type PreparedWrite = {
39
39
  readonly statements: readonly Statement[];
40
40
  readonly options: ExecuteOptions | undefined;
41
41
  /** Set when `finish` can refuse a statement that already ran. `batch` refuses such a write (D183). */
42
- readonly checked?: "restore" | "expect" | "parent";
42
+ readonly checked?: "restore" | "expect" | "parent" | "tree";
43
43
  finish(results: readonly ExecuteResult[]): unknown;
44
44
  /**
45
45
  * More statements once the planned ones have run.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  build3
3
- } from "./cexb7z6b.js";
3
+ } from "./gr9sn4za.js";
4
4
  export {
5
5
  build3 as build
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  emitSqlValue
3
- } from "./3bb7wsqt.js";
3
+ } from "./ycnft340.js";
4
4
  import {
5
5
  assertOperatorFits,
6
6
  sqlType,
@@ -15,7 +15,8 @@ import {
15
15
  expectOf2,
16
16
  allowSet2,
17
17
  noteGuarded2
18
- } from "./9dtgn1z2.js";
18
+ } from "./63qjmhnp.js";
19
+ import"./ddh72ym5.js";
19
20
  import"./mss6ctgv.js";
20
21
  export {
21
22
  Sql2 as Sql,
@@ -8,7 +8,7 @@ import {
8
8
  openClient,
9
9
  withHttp,
10
10
  settleCall
11
- } from "./npdftanb.js";
11
+ } from "./xbvz446k.js";
12
12
  import {
13
13
  rejectKeys,
14
14
  isRecord,