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
@@ -2,10 +2,10 @@ import {
2
2
  DriverError2,
3
3
  timedOut2,
4
4
  isConnectionLost
5
- } from "./hfq3n3bd.js";
5
+ } from "./2jdn09e2.js";
6
6
  import {
7
7
  PgSession2
8
- } from "./62fxpc1p.js";
8
+ } from "./vms9dta5.js";
9
9
  import {
10
10
  driverErrors,
11
11
  rejectClosed,
@@ -13,7 +13,7 @@ import {
13
13
  runCall,
14
14
  rowsFrom,
15
15
  resultFrom
16
- } from "./5x3pf400.js";
16
+ } from "./ry2f3w8p.js";
17
17
 
18
18
  // src/adapters/pg/postgres-extra.ts
19
19
  var RESET_ALL = "RESET ALL";
@@ -48,7 +48,7 @@ async function checkout(pool, timeoutMs) {
48
48
  batch: (statements, options) => {
49
49
  remember(options?.timeout);
50
50
  return guard(() => runCall(pool.isClosed(), options, async (watch) => {
51
- const { runAtomicBatch } = await import("./gqwevek4.js");
51
+ const { runAtomicBatch } = await import("./xchpnbdv.js");
52
52
  return runAtomicBatch(session, statements, watch);
53
53
  }));
54
54
  },
@@ -78,18 +78,12 @@ async function checkout(pool, timeoutMs) {
78
78
  };
79
79
  }
80
80
  async function describe(sql, text, params) {
81
- const pending = sql.unsafe(text, asParams(params), { prepare: true });
82
- const described = await pending.describe();
83
- return {
84
- columns: described.columns.map((column) => column.name),
85
- parameterCount: described.types.length
86
- };
81
+ const d = await sql.unsafe(text, asParams(params), { prepare: true }).describe();
82
+ return { columns: d.columns.map((c) => c.name), parameterCount: d.types.length };
87
83
  }
88
84
  async function* stream(sql, text, params) {
89
- const pending = sql.unsafe(text, asParams(params));
90
- for await (const chunk of pending.cursor(64)) {
85
+ for await (const chunk of sql.unsafe(text, asParams(params)).cursor(64))
91
86
  yield rowsFrom(chunk);
92
- }
93
87
  }
94
88
  function poolWaits(sql) {
95
89
  const options = sql.options;
@@ -103,14 +97,14 @@ function poolWaits(sql) {
103
97
  n.add(id);
104
98
  if (n.size < options.max) {
105
99
  queueMicrotask(() => {
106
- for (const wait of q)
107
- wait.a();
100
+ for (const w of q)
101
+ w.a();
108
102
  });
109
103
  return;
110
104
  }
111
105
  n.clear();
112
- for (const wait of q)
113
- wait.s();
106
+ for (const w of q)
107
+ w.s();
114
108
  q.clear();
115
109
  };
116
110
  return options;
@@ -192,41 +186,40 @@ function reserveConnection(sql, acquireMs, counters, callMs) {
192
186
  counters.waiting = Math.max(0, counters.waiting - 1);
193
187
  };
194
188
  return new Promise((resolve, reject) => {
195
- let timer;
196
- if (acquireMs !== undefined) {
197
- timer = setTimeout(() => {
198
- if (settled)
199
- return;
200
- settled = true;
201
- finish();
202
- driverErrors().then((errors) => {
203
- reject(errors.acquireTimeout());
204
- });
205
- }, acquireMs);
206
- }
207
- const ms = callMs !== undefined && callMs > 0 ? callMs : 0;
208
- deadline(ms, () => sql.reserve(), sql).then((connection) => {
209
- if (settled) {
210
- resetConnection(connection, 0).catch(() => {
211
- return;
212
- }).finally(() => {
213
- connection.release();
214
- });
189
+ const timer = acquireMs === undefined ? undefined : setTimeout(() => {
190
+ if (settled)
215
191
  return;
216
- }
217
192
  settled = true;
218
- if (timer !== undefined)
219
- clearTimeout(timer);
220
193
  finish();
221
- resolve(connection);
222
- }, (error) => {
194
+ driverErrors().then((errors) => {
195
+ reject(errors.acquireTimeout());
196
+ });
197
+ }, acquireMs);
198
+ const done = (fn) => {
223
199
  if (settled)
224
200
  return;
225
201
  settled = true;
226
202
  if (timer !== undefined)
227
203
  clearTimeout(timer);
228
204
  finish();
229
- mapFailure(error).then(reject);
205
+ fn();
206
+ };
207
+ deadline(callMs !== undefined && callMs > 0 ? callMs : 0, () => sql.reserve(), sql).then((connection) => {
208
+ if (settled) {
209
+ resetConnection(connection, 0).catch(() => {
210
+ return;
211
+ }).finally(() => {
212
+ connection.release();
213
+ });
214
+ return;
215
+ }
216
+ done(() => {
217
+ resolve(connection);
218
+ });
219
+ }, (error) => {
220
+ done(() => {
221
+ mapFailure(error).then(reject);
222
+ });
230
223
  });
231
224
  });
232
225
  }
@@ -235,22 +228,20 @@ async function resetConnection(sql, depth) {
235
228
  await sql.unsafe("ROLLBACK").catch(() => {
236
229
  return;
237
230
  });
238
- try {
231
+ const clear = async () => {
239
232
  await sql.unsafe(RESET_ALL);
240
233
  await sql.unsafe(UNLOCK);
234
+ };
235
+ try {
236
+ await clear();
241
237
  } catch {
242
238
  await sql.unsafe("ROLLBACK").catch(() => {
243
239
  return;
244
240
  });
245
- await sql.unsafe(RESET_ALL);
246
- await sql.unsafe(UNLOCK);
241
+ await clear();
247
242
  }
248
243
  }
249
- function asParams(params) {
250
- if (params === undefined)
251
- return [];
252
- return params;
253
- }
244
+ var asParams = (params) => params ?? [];
254
245
  function arm(sql, lost) {
255
246
  const unsafe = sql.unsafe.bind(sql);
256
247
  sql.unsafe = (text, params, options) => unsafe(text, params, {
@@ -268,14 +259,7 @@ async function holdCheckout(gate, checkout) {
268
259
  const connection = await checkout();
269
260
  let released = false;
270
261
  const release = connection.release.bind(connection);
271
- connection.release = () => {
272
- if (released)
273
- return Promise.resolve();
274
- released = true;
275
- return release().finally(() => {
276
- gate.leave();
277
- });
278
- };
262
+ connection.release = () => released ? Promise.resolve() : (released = true, release().finally(() => gate.leave()));
279
263
  return connection;
280
264
  } catch (error) {
281
265
  gate.leave();
@@ -290,11 +274,9 @@ async function holdListener(gate, start) {
290
274
  if (stopped)
291
275
  return;
292
276
  stopped = true;
293
- try {
294
- await stop();
295
- } finally {
277
+ await stop().finally(() => {
296
278
  gate.leave();
297
- }
279
+ });
298
280
  };
299
281
  } catch (error) {
300
282
  gate.leave();
@@ -302,36 +284,35 @@ async function holdListener(gate, start) {
302
284
  }
303
285
  }
304
286
  function watchQuery(pending, watch, onAbort, ctx) {
287
+ const done = () => {
288
+ ctx.leave();
289
+ ctx.untrack(pending);
290
+ watch.signal.removeEventListener("abort", onAbort);
291
+ };
305
292
  return pending.then((value) => {
306
- finishWatch(pending, watch, onAbort, ctx);
293
+ done();
307
294
  const why = watch.reason();
308
295
  if (why === "timeout" || why === "cancelled")
309
296
  return classify(why, watch);
310
297
  ctx.note(ctx.text);
311
298
  return resultFrom(value, ctx.notices.since(ctx.start));
312
299
  }, (error) => {
313
- finishWatch(pending, watch, onAbort, ctx);
300
+ done();
314
301
  return classify(error, watch);
315
302
  });
316
303
  }
317
- function finishWatch(pending, watch, onAbort, ctx) {
318
- ctx.leave();
319
- ctx.untrack(pending);
320
- watch.signal.removeEventListener("abort", onAbort);
321
- }
322
304
  async function classify(error, watch) {
323
305
  const errors = await driverErrors();
324
306
  if (error instanceof errors.DriverError)
325
- return Promise.reject(error);
307
+ throw error;
326
308
  const why = typeof error === "string" ? error : watch.reason();
327
- if (why === "timeout") {
328
- return Promise.reject(errors.timedOut(typeof error === "string" ? undefined : error));
329
- }
330
- const code = errors.errorField(error, "code");
331
- if (why === "cancelled" || code === "57014") {
332
- return Promise.reject(errors.cancelled(typeof error === "string" ? undefined : error));
309
+ const cause = typeof error === "string" ? undefined : error;
310
+ if (why === "timeout")
311
+ throw errors.timedOut(cause);
312
+ if (why === "cancelled" || errors.errorField(error, "code") === "57014") {
313
+ throw errors.cancelled(cause);
333
314
  }
334
- return Promise.reject(errors.mapDriverError(error));
315
+ throw errors.mapDriverError(error);
335
316
  }
336
317
  export {
337
318
  checkout,
@@ -3,7 +3,7 @@ import {
3
3
  readHandle,
4
4
  readCall,
5
5
  attachHttp
6
- } from "./jr2nmr81.js";
6
+ } from "./gjj71hfh.js";
7
7
  import {
8
8
  OkmError,
9
9
  throwNamed,
@@ -17,7 +17,7 @@ import {
17
17
  isRecord,
18
18
  registerFailFix,
19
19
  fail2
20
- } from "./hfq3n3bd.js";
20
+ } from "./2jdn09e2.js";
21
21
 
22
22
  // src/runtime/page.ts
23
23
  registerFailFix("OKM1130", "Request the next page with the same orderBy and the exact next value the previous page returned. The cursor encodes that order.");
@@ -2,11 +2,11 @@ import {
2
2
  readSelectFragment,
3
3
  emitSqlSelect,
4
4
  decodeSqlNumber
5
- } from "./ybdew6j7.js";
6
- import"./w5d89rb4.js";
5
+ } from "./ckq4z5ax.js";
6
+ import"./fdsek6pa.js";
7
7
  import {
8
8
  refusePrototypeKey
9
- } from "./0j0jtse1.js";
9
+ } from "./09a6vsys.js";
10
10
  import {
11
11
  throwNamed,
12
12
  emitWhere,
@@ -20,7 +20,7 @@ import {
20
20
  list,
21
21
  isRecord,
22
22
  fail2
23
- } from "./hfq3n3bd.js";
23
+ } from "./2jdn09e2.js";
24
24
 
25
25
  // src/dialects/pg/ops/window.ts
26
26
  var RUNTIME = Symbol.for("okmodel.window");
@@ -2,14 +2,14 @@ import {
2
2
  withHttp,
3
3
  attachHttp,
4
4
  mapOptions
5
- } from "./jr2nmr81.js";
5
+ } from "./gjj71hfh.js";
6
6
  import {
7
7
  OkmError,
8
8
  POSTGRES_FLOOR,
9
9
  isPostgresMajor,
10
10
  parsePostgresFloor,
11
11
  serverNeedsPostgres
12
- } from "./hfq3n3bd.js";
12
+ } from "./2jdn09e2.js";
13
13
 
14
14
  // src/runtime/artifact-file.ts
15
15
  function artifactDir(catalogDir) {
@@ -73,12 +73,12 @@ async function acceptServer2(pool, schema, http, requireMeta, options, source) {
73
73
  const result = await pool.execute(await versionSql(namespace), undefined, options);
74
74
  rows = result.rows;
75
75
  } catch (error) {
76
- const { mapPostgresError } = await import("./yfedr1zb.js");
76
+ const { mapPostgresError } = await import("./xx3gmq94.js");
77
77
  throw mapPostgresError(error, mapOptions(http, false, schema));
78
78
  }
79
79
  for (const name in schema.model) {
80
80
  if (schema.model[name]?.presets !== undefined) {
81
- (await import("./5bmksndh.js")).checkSchema(schema);
81
+ (await import("./bj1kyqc8.js")).checkSchema(schema);
82
82
  break;
83
83
  }
84
84
  }
@@ -98,7 +98,7 @@ async function acceptServer2(pool, schema, http, requireMeta, options, source) {
98
98
  }));
99
99
  }
100
100
  } else {
101
- const { assertCompatible } = await import("./qartgazh.js");
101
+ const { assertCompatible } = await import("./0wtzps9p.js");
102
102
  try {
103
103
  await assertCompatible(pool, schema, recorded, source, options, namespace);
104
104
  } catch (error) {
@@ -127,7 +127,7 @@ async function acceptServer2(pool, schema, http, requireMeta, options, source) {
127
127
  }
128
128
  }
129
129
  async function qualified(table, namespace) {
130
- const { quoteIdent } = await import("./zx3v9phv.js");
130
+ const { quoteIdent } = await import("./8msbtw5s.js");
131
131
  return `${quoteIdent(namespace)}.${table}`;
132
132
  }
133
133
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  quoteIdent2,
3
3
  renderCatalog2
4
- } from "./hfq3n3bd.js";
4
+ } from "./2jdn09e2.js";
5
5
  export {
6
6
  quoteIdent2 as quoteIdent,
7
7
  renderCatalog2 as renderCatalog
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  rejectClosed
3
- } from "./5x3pf400.js";
3
+ } from "./ry2f3w8p.js";
4
4
  import {
5
5
  isConnectionLost
6
- } from "./hfq3n3bd.js";
6
+ } from "./2jdn09e2.js";
7
7
 
8
8
  // src/adapters/pg/reserved.ts
9
9
  var RESET_ALL = "RESET ALL";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  assertNoControl
3
- } from "./w5d89rb4.js";
3
+ } from "./fdsek6pa.js";
4
4
  import {
5
5
  throwNamed,
6
6
  isOperator,
@@ -12,7 +12,7 @@ import {
12
12
  list,
13
13
  isRecord,
14
14
  fail2
15
- } from "./hfq3n3bd.js";
15
+ } from "./2jdn09e2.js";
16
16
 
17
17
  // src/dialects/pg/ops/search-query.ts
18
18
  function searchValue(query, options) {
@@ -6,7 +6,7 @@ import {
6
6
  acquireTimeout2,
7
7
  errorField2,
8
8
  mapDriverError2
9
- } from "./hfq3n3bd.js";
9
+ } from "./2jdn09e2.js";
10
10
  export {
11
11
  DriverError2 as DriverError,
12
12
  acquireTimeout2 as acquireTimeout,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  build3
3
- } from "./829fjxyw.js";
4
- import"./jr2nmr81.js";
3
+ } from "./5rah55z0.js";
4
+ import"./gjj71hfh.js";
5
5
  export {
6
6
  build3 as build
7
7
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  tag
3
- } from "./hfq3n3bd.js";
3
+ } from "./2jdn09e2.js";
4
4
 
5
5
  // src/runtime/preset-stack.ts
6
6
  function stack2(where, presets) {
@@ -4,7 +4,7 @@ import {
4
4
  nextTransactionDepth,
5
5
  EMPTY_NOTICES,
6
6
  resultFrom
7
- } from "./5x3pf400.js";
7
+ } from "./ry2f3w8p.js";
8
8
 
9
9
  // src/adapters/pg/session.ts
10
10
  function noticeBuffer() {
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  stack2
3
- } from "./35zemrmf.js";
3
+ } from "./angjck01.js";
4
4
  import {
5
5
  OkmError,
6
6
  isOperator,
7
7
  operatorValue
8
- } from "./hfq3n3bd.js";
8
+ } from "./2jdn09e2.js";
9
9
 
10
10
  // src/dialects/pg/preset.ts
11
11
  var RESERVED_PRESETS = new Set([
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  createClient
3
- } from "./jr2nmr81.js";
3
+ } from "./gjj71hfh.js";
4
4
  import {
5
5
  OkmError,
6
6
  isConnectionSqlstate,
7
7
  isConnectionErrno
8
- } from "./hfq3n3bd.js";
8
+ } from "./2jdn09e2.js";
9
9
 
10
10
  // src/runtime/topology.ts
11
11
  var CIRCUIT_AT = 2;
@@ -1166,7 +1166,15 @@ function fromSelect(handle, select, candidates) {
1166
1166
  lag: byteLagNumber(handle, endpoint)
1167
1167
  });
1168
1168
  }
1169
- const returned = select(offered, { op: "read" });
1169
+ let returned;
1170
+ try {
1171
+ returned = select(offered, { op: "read" });
1172
+ } catch (error) {
1173
+ if (error instanceof OkmError)
1174
+ throw error;
1175
+ const message = error instanceof Error ? error.message : "routing.select threw.";
1176
+ throw new OkmError("invalid", message, { kind: "invalid", cause: error });
1177
+ }
1170
1178
  if (typeof returned === "string") {
1171
1179
  const endpoint = endpoints.find((item) => item.name === returned);
1172
1180
  if (endpoint !== undefined)
@@ -2,7 +2,7 @@ import {
2
2
  readHandle,
3
3
  readCall,
4
4
  attachHttp
5
- } from "./jr2nmr81.js";
5
+ } from "./gjj71hfh.js";
6
6
  import {
7
7
  OkmError,
8
8
  throwNamed,
@@ -17,7 +17,7 @@ import {
17
17
  list,
18
18
  isRecord,
19
19
  fail2
20
- } from "./hfq3n3bd.js";
20
+ } from "./2jdn09e2.js";
21
21
 
22
22
  // src/runtime/tree.ts
23
23
  var OPTIONS = [
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  assertNoControl
3
- } from "./w5d89rb4.js";
3
+ } from "./fdsek6pa.js";
4
4
  import {
5
5
  OkmError,
6
6
  throwNamed,
@@ -12,7 +12,7 @@ import {
12
12
  quote,
13
13
  list,
14
14
  fail2
15
- } from "./hfq3n3bd.js";
15
+ } from "./2jdn09e2.js";
16
16
 
17
17
  // src/dialects/pg/ops/fragment.ts
18
18
  var IDENT = Symbol("okmodel.sql.ident");
@@ -57,6 +57,9 @@ function scanLiteral(literal, state) {
57
57
  for (let index = 0;index < literal.length; index += 1) {
58
58
  const char = literal[index] ?? "";
59
59
  const code = literal.charCodeAt(index);
60
+ if (char === "\\") {
61
+ fragmentError("A fragment cannot include a backslash.", "Pass the value as an interpolation.");
62
+ }
60
63
  if (state.quote !== undefined) {
61
64
  if (char !== state.quote)
62
65
  continue;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  quote,
3
3
  fail2
4
- } from "./hfq3n3bd.js";
4
+ } from "./2jdn09e2.js";
5
5
 
6
6
  // src/runtime/sort.ts
7
7
  function insertAtEnd(table, columns, rows, group, tenantFields) {
@@ -1,16 +1,16 @@
1
1
  import {
2
- open3,
2
+ open4,
3
3
  PgSession2
4
- } from "./62fxpc1p.js";
4
+ } from "./vms9dta5.js";
5
5
  import {
6
6
  POSTGRESJS_CAPABILITIES,
7
7
  readCapability2,
8
8
  hasCapability2
9
- } from "./5x3pf400.js";
9
+ } from "./ry2f3w8p.js";
10
10
  export {
11
11
  PgSession2 as PgSession,
12
12
  POSTGRESJS_CAPABILITIES as capabilities,
13
13
  hasCapability2 as hasCapability,
14
- open3 as open,
14
+ open4 as open,
15
15
  readCapability2 as readCapability
16
16
  };
@@ -3,12 +3,12 @@ import {
3
3
  readHandle,
4
4
  readCall,
5
5
  attachHttp
6
- } from "./jr2nmr81.js";
6
+ } from "./gjj71hfh.js";
7
7
  import {
8
8
  OkmError,
9
9
  throwNamed,
10
10
  fail2
11
- } from "./hfq3n3bd.js";
11
+ } from "./2jdn09e2.js";
12
12
 
13
13
  // src/runtime/lock.ts
14
14
  var LOCKS = ["update", "share"];