okmodel 0.8.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 (237) hide show
  1. package/README.md +23 -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/btree-gin.d.ts +26 -0
  11. package/dist/dialects/pg/ext/btree-gin.js +20 -0
  12. package/dist/dialects/pg/ext/btree-gist.d.ts +26 -0
  13. package/dist/dialects/pg/ext/btree-gist.js +20 -0
  14. package/dist/dialects/pg/ext/call.d.ts +53 -0
  15. package/dist/dialects/pg/ext/citext.js +1 -1
  16. package/dist/dialects/pg/ext/feature.d.ts +26 -0
  17. package/dist/dialects/pg/ext/fuzzystrmatch.d.ts +34 -0
  18. package/dist/dialects/pg/ext/fuzzystrmatch.js +33 -0
  19. package/dist/dialects/pg/ext/hstore.d.ts +41 -0
  20. package/dist/dialects/pg/ext/hstore.js +29 -0
  21. package/dist/dialects/pg/ext/index.d.ts +56 -0
  22. package/dist/dialects/pg/ext/index.js +1 -1
  23. package/dist/dialects/pg/ext/ltree.d.ts +41 -0
  24. package/dist/dialects/pg/ext/ltree.js +29 -0
  25. package/dist/dialects/pg/ext/pg-trgm.js +4 -13
  26. package/dist/dialects/pg/ext/pgcrypto.d.ts +33 -0
  27. package/dist/dialects/pg/ext/pgcrypto.js +33 -0
  28. package/dist/dialects/pg/ext/unaccent.d.ts +26 -0
  29. package/dist/dialects/pg/ext/unaccent.js +21 -0
  30. package/dist/dialects/pg/ext/using.d.ts +23 -0
  31. package/dist/dialects/pg/ext/versions.d.ts +36 -0
  32. package/dist/dialects/pg/external.d.ts +19 -0
  33. package/dist/dialects/pg/filters.d.ts +2 -2
  34. package/dist/dialects/pg/fn/index.js +5 -5
  35. package/dist/dialects/pg/index.d.ts +1 -0
  36. package/dist/dialects/pg/index.js +19 -14
  37. package/dist/dialects/pg/introspect.d.ts +12 -0
  38. package/dist/dialects/pg/view/index.js +7 -7
  39. package/dist/dialects/pg/view/scratch.d.ts +4 -1
  40. package/dist/runtime/artifact-file.d.ts +22 -0
  41. package/dist/runtime/client.d.ts +10 -0
  42. package/dist/runtime/drift-detail.d.ts +2 -1
  43. package/dist/runtime/drift.d.ts +3 -10
  44. package/dist/runtime/param-limit.d.ts +20 -0
  45. package/dist/runtime/pg/bun.js +4 -4
  46. package/dist/runtime/pg/neon.js +4 -4
  47. package/dist/runtime/pg/pg.js +4 -4
  48. package/dist/runtime/pg/pglite.js +4 -4
  49. package/dist/runtime/pg/postgresjs.js +11 -11
  50. package/dist/runtime/server-check.d.ts +36 -6
  51. package/dist/runtime/tenancy/index.js +1 -1
  52. package/dist/runtime/traits/index.js +6 -6
  53. package/dist/runtime/validate/index.js +2 -2
  54. package/dist/runtime/write.d.ts +1 -1
  55. package/dist/shared/{4m6hskg8.js → 0j6qe91y.js} +4 -4
  56. package/dist/shared/{6m78c8ss.js → 1h5h1rf5.js} +1 -1
  57. package/dist/shared/{4vbf83xx.js → 2vcnpf0n.js} +1 -1
  58. package/dist/shared/{qd9hhd8f.js → 3ap5hxvj.js} +2 -1
  59. package/dist/shared/{v1wad97q.js → 3d7a80fq.js} +1 -1
  60. package/dist/shared/{wcrheftc.js → 3dr444ny.js} +58 -79
  61. package/dist/shared/{hm5f8jby.js → 3vvpcphd.js} +8 -7
  62. package/dist/shared/{760ppr76.js → 4a3mmhhe.js} +2 -2
  63. package/dist/shared/{mkrn359n.js → 4pkz5nvw.js} +222 -39
  64. package/dist/shared/{agsfb86s.js → 4te76xc5.js} +4 -4
  65. package/dist/shared/{63f4ksbz.js → 60y4ahmw.js} +1 -1
  66. package/dist/shared/61bmrmhr.js +35 -0
  67. package/dist/shared/{bxas03mq.js → 63qjmhnp.js} +100 -17
  68. package/dist/shared/{g5yc06ka.js → 67w3kn71.js} +1 -1
  69. package/dist/shared/{jgqj11w4.js → 6f0z3hzh.js} +4 -0
  70. package/dist/shared/{njga14v4.js → 6vfvsdkt.js} +10 -8
  71. package/dist/shared/{kj9d8maq.js → 6xqvesa5.js} +1 -1
  72. package/dist/shared/8gdbty5v.js +665 -0
  73. package/dist/shared/{pan0370z.js → 8ma6drzr.js} +211 -30
  74. package/dist/shared/{mnvjvqyp.js → 8p2bgye0.js} +124 -32
  75. package/dist/shared/{mfedzr74.js → 8qwqrxed.js} +14 -6
  76. package/dist/shared/{hfqmpasr.js → 8v7vzpgt.js} +11 -8
  77. package/dist/shared/{7ghwamrf.js → 99qp9vtg.js} +1 -1
  78. package/dist/shared/{zgex00fd.js → ak61ye1f.js} +5 -5
  79. package/dist/shared/{dpc2r7rb.js → bdekbvmt.js} +218 -95
  80. package/dist/shared/{jebgrkeq.js → bxjq6xqv.js} +2 -2
  81. package/dist/shared/c7dqd3gk.js +1806 -0
  82. package/dist/shared/ddh72ym5.js +20 -0
  83. package/dist/shared/e1c55v04.js +10 -0
  84. package/dist/shared/{mtw6jz76.js → e275q7sd.js} +1 -1
  85. package/dist/shared/{k86n8vq3.js → ekhq3ytz.js} +1 -1
  86. package/dist/shared/esy4dyxe.js +17 -0
  87. package/dist/shared/{gcefca6p.js → f9t9g54z.js} +22 -9
  88. package/dist/shared/{sjk86yrx.js → fk9vef30.js} +84 -73
  89. package/dist/shared/fkjne6gx.js +8 -0
  90. package/dist/shared/{e8zyaqvj.js → fne90dvz.js} +4 -1
  91. package/dist/shared/{needfe47.js → g89fmz5s.js} +1 -1
  92. package/dist/shared/{m4xff2a6.js → ghqzdp94.js} +2 -2
  93. package/dist/shared/{n0jmpgj1.js → gr9sn4za.js} +1 -1
  94. package/dist/shared/{5mtf6cj3.js → gzgfsspx.js} +5 -2
  95. package/dist/shared/h9811jjm.js +17 -0
  96. package/dist/shared/{z581d7ny.js → hgt69zjf.js} +2 -2
  97. package/dist/shared/{35q0n9tz.js → jvxcp1qk.js} +71 -87
  98. package/dist/shared/k73e8n9d.js +136 -0
  99. package/dist/shared/{195pzzzz.js → kzgrcy8s.js} +12 -8
  100. package/dist/shared/kzgrnckd.js +29 -0
  101. package/dist/shared/{p3xbdcvt.js → mz48rs74.js} +68 -8
  102. package/dist/shared/{zbqbmmrp.js → n6je5b28.js} +13 -26
  103. package/dist/shared/{b6d6p0zc.js → ns35jqz0.js} +75 -49
  104. package/dist/shared/{n05z9nwz.js → nstwgzn8.js} +1 -1
  105. package/dist/{tooling/shared/08kemxjd.js → shared/pgsak1yw.js} +1 -1
  106. package/dist/shared/py2zrrm6.js +451 -0
  107. package/dist/shared/{9dr2qnx7.js → qqm3ze6q.js} +1 -1
  108. package/dist/shared/{wvdjznah.js → rcjm0yn7.js} +31 -38
  109. package/dist/shared/rged92v6.js +17 -0
  110. package/dist/shared/{jp36k7dp.js → rw4tpcd0.js} +81 -51
  111. package/dist/shared/{bsek72fg.js → s5qe47a6.js} +3 -0
  112. package/dist/shared/{1d9q9cv2.js → smxzjz60.js} +2 -2
  113. package/dist/shared/{wz2a78mp.js → th5rnaxw.js} +1 -1
  114. package/dist/{tooling/shared/rs1jb051.js → shared/tr64w5p0.js} +1 -1
  115. package/dist/shared/{14x60fbf.js → tyqapcgk.js} +73 -10
  116. package/dist/shared/vsna85qf.js +8 -0
  117. package/dist/shared/{63qtkrca.js → vy47ryqa.js} +55 -5
  118. package/dist/shared/{jx2m62cs.js → wbdh9qbg.js} +7 -5
  119. package/dist/shared/{f4jy1j7x.js → wp7y8q3y.js} +946 -105
  120. package/dist/shared/{16kvjebh.js → xbd9xs6p.js} +7 -26
  121. package/dist/shared/{bah9nbg3.js → xbvz446k.js} +18 -23
  122. package/dist/shared/{p5nh3r8q.js → y6tfjk9q.js} +2 -2
  123. package/dist/shared/{3bb7wsqt.js → ycnft340.js} +1 -1
  124. package/dist/shared/{z7s6fpxv.js → ymenf259.js} +1 -1
  125. package/dist/shared/{0wrea3jq.js → ysdw2fg3.js} +10 -2
  126. package/dist/shared/zecrwdk9.js +61 -0
  127. package/dist/shared/{3t6kw83m.js → zm2rzqba.js} +2 -1
  128. package/dist/tooling/cli.js +200 -50
  129. package/dist/tooling/driver-run.js +109 -343
  130. package/dist/tooling/github/comment.d.ts +56 -0
  131. package/dist/tooling/github/post-comment.d.ts +17 -0
  132. package/dist/tooling/migrate/apply.d.ts +17 -2
  133. package/dist/tooling/migrate/commands.d.ts +2 -1
  134. package/dist/tooling/migrate/config.d.ts +13 -0
  135. package/dist/tooling/migrate/drift.d.ts +12 -0
  136. package/dist/tooling/migrate/driver-url.d.ts +17 -0
  137. package/dist/tooling/migrate/export.d.ts +165 -0
  138. package/dist/tooling/migrate/ext-surface.d.ts +80 -0
  139. package/dist/tooling/migrate/ext.d.ts +31 -4
  140. package/dist/tooling/migrate/import-drizzle.d.ts +40 -0
  141. package/dist/tooling/migrate/index.d.ts +3 -0
  142. package/dist/tooling/migrate/index.js +57 -10
  143. package/dist/tooling/migrate/lint-rules.d.ts +18 -1
  144. package/dist/tooling/migrate/lint.d.ts +14 -1
  145. package/dist/tooling/migrate/place.d.ts +18 -0
  146. package/dist/tooling/migrate/plan-json.d.ts +65 -0
  147. package/dist/tooling/migrate/policy.d.ts +17 -5
  148. package/dist/tooling/migrate/pooler-probe.d.ts +23 -0
  149. package/dist/tooling/migrate/project.d.ts +10 -1
  150. package/dist/tooling/migrate/pull-emit.d.ts +98 -0
  151. package/dist/tooling/migrate/pull-routines.d.ts +126 -0
  152. package/dist/tooling/migrate/pull-verify.d.ts +26 -0
  153. package/dist/tooling/migrate/pull.d.ts +65 -0
  154. package/dist/tooling/migrate/reprint.d.ts +32 -0
  155. package/dist/tooling/migrate/runner.d.ts +24 -1
  156. package/dist/tooling/migrate/sandbox.d.ts +8 -2
  157. package/dist/tooling/migrate/schema-api.d.ts +43 -0
  158. package/dist/tooling/migrate/sql-lex.d.ts +18 -0
  159. package/dist/tooling/shared/{ppnnnvj8.js → 09a6vsys.js} +1 -1
  160. package/dist/tooling/shared/{7ae7rjmn.js → 0v9ptnxp.js} +8 -8
  161. package/dist/tooling/shared/{fb9k2qwd.js → 0wtzps9p.js} +11 -30
  162. package/dist/tooling/shared/{a6pp9d12.js → 0yhf1db4.js} +6 -6
  163. package/dist/tooling/shared/{dy672fz6.js → 19msgrsc.js} +2 -2
  164. package/dist/{shared/q0cqt2sp.js → tooling/shared/1fwfm5m3.js} +1 -1
  165. package/dist/tooling/shared/{f9mphxej.js → 2jdn09e2.js} +401 -24
  166. package/dist/tooling/shared/{jne7b93p.js → 2qrte2ct.js} +5 -5
  167. package/dist/tooling/shared/{5bvw2nev.js → 2v4nwnkb.js} +1 -1
  168. package/dist/tooling/shared/{spk1jg3r.js → 33z39trp.js} +106 -23
  169. package/dist/tooling/shared/{z8d7ptht.js → 353vnw9z.js} +5 -5
  170. package/dist/tooling/shared/{dw08f3m8.js → 390kry9g.js} +2 -2
  171. package/dist/tooling/shared/{xjs6zqtc.js → 3f6etb9z.js} +18 -31
  172. package/dist/{shared/bnby0esn.js → tooling/shared/3t2cqmsx.js} +1 -1
  173. package/dist/tooling/shared/{wwnekq5n.js → 4dzvjtpy.js} +1 -1
  174. package/dist/tooling/shared/{y5656f0e.js → 4ec0nxvw.js} +10 -10
  175. package/dist/tooling/shared/{3m1hkg7z.js → 4tg2bn41.js} +59 -78
  176. package/dist/tooling/shared/{zvnhh1n0.js → 5rah55z0.js} +2 -2
  177. package/dist/tooling/shared/{pqy21k24.js → 804w1t69.js} +4 -4
  178. package/dist/tooling/shared/8g0m0rvd.js +134 -0
  179. package/dist/tooling/shared/8msbtw5s.js +8 -0
  180. package/dist/tooling/shared/{4d2w25vw.js → 8t22h3h7.js} +2 -2
  181. package/dist/tooling/shared/{smn6kz1p.js → 91c59b7b.js} +2 -2
  182. package/dist/tooling/shared/{aftb2mwr.js → adk9k6va.js} +1 -1
  183. package/dist/tooling/shared/{j9t5s12a.js → ajjd5cwz.js} +2 -2
  184. package/dist/tooling/shared/{cmptmb4f.js → angjck01.js} +1 -1
  185. package/dist/tooling/shared/{yw30vnq2.js → asnnc3v5.js} +1 -1
  186. package/dist/tooling/shared/{ma2340rx.js → bj1kyqc8.js} +2 -2
  187. package/dist/tooling/shared/{2wtvc7rw.js → bt3tjemb.js} +11 -3
  188. package/dist/tooling/shared/{ec71zqgt.js → chk2bh4f.js} +2 -2
  189. package/dist/tooling/shared/{gmcf9cxf.js → ckq4z5ax.js} +5 -2
  190. package/dist/tooling/shared/{w7qe8sj1.js → d3rhb24q.js} +1 -1
  191. package/dist/tooling/shared/{y031jct9.js → d8q00vxg.js} +4 -4
  192. package/dist/tooling/shared/{vs0t6qt8.js → dx188rxs.js} +2 -2
  193. package/dist/tooling/shared/{g9ad4n80.js → efq6p9df.js} +35 -42
  194. package/dist/tooling/shared/{ddjtfgnx.js → en6rwzq0.js} +3 -3
  195. package/dist/tooling/shared/{6nyfyw70.js → f2r5g0fs.js} +2 -2
  196. package/dist/tooling/shared/{03k6res6.js → f4gep0nk.js} +1 -1
  197. package/dist/tooling/shared/{gfvtj6d0.js → f8a010fm.js} +13 -11
  198. package/dist/tooling/shared/{3tq8pnb8.js → fdsek6pa.js} +1 -1
  199. package/dist/tooling/shared/fvmrxsd1.js +8 -0
  200. package/dist/tooling/shared/{733a1tq3.js → g3xybeqf.js} +4 -3
  201. package/dist/tooling/shared/{pwsytxm5.js → gefmpwsa.js} +1 -1
  202. package/dist/tooling/shared/{mtrqn2hn.js → gjj71hfh.js} +25 -30
  203. package/dist/tooling/shared/{8sqrsw3s.js → jgzt69pa.js} +5 -5
  204. package/dist/tooling/shared/{nf7jmhfa.js → jm30k2ca.js} +10 -8
  205. package/dist/tooling/shared/{vx86qjv8.js → kayqzpbk.js} +6 -3
  206. package/dist/tooling/shared/{zhwnfyb2.js → kvw1672d.js} +1 -1
  207. package/dist/tooling/shared/{rq5kk8j6.js → mr1kcgpw.js} +3 -3
  208. package/dist/tooling/shared/{72fyg4zv.js → mwbdf409.js} +1 -1
  209. package/dist/tooling/shared/{wt7j7nf6.js → ns9207v3.js} +1 -1
  210. package/dist/tooling/shared/{9xzm7hjg.js → p6tjv97k.js} +3 -3
  211. package/dist/tooling/shared/{yfr8hzhm.js → p73evwf0.js} +1 -1
  212. package/dist/tooling/shared/{dzx85q70.js → phc1nc4g.js} +1 -1
  213. package/dist/tooling/shared/{417zdsk7.js → ppybjw50.js} +79 -16
  214. package/dist/tooling/shared/{yk9mp7vb.js → qdrn8ghn.js} +5 -4
  215. package/dist/tooling/shared/rd8h01ta.js +20 -0
  216. package/dist/tooling/shared/{bz2dqhab.js → rwg8y90m.js} +3 -3
  217. package/dist/tooling/shared/{xhrnjch9.js → ry2f3w8p.js} +3 -3
  218. package/dist/tooling/shared/{a7q7t4n3.js → ryc5sa58.js} +8 -8
  219. package/dist/tooling/shared/{2revefqt.js → ss87qxwv.js} +2 -2
  220. package/dist/tooling/shared/{rf83gr2d.js → vg68k11z.js} +7 -3
  221. package/dist/tooling/shared/{p7f08ktn.js → vms9dta5.js} +73 -89
  222. package/dist/tooling/shared/{3rrw5w8f.js → xchpnbdv.js} +1 -1
  223. package/dist/tooling/shared/{djydjpqt.js → xn6p01fh.js} +5 -5
  224. package/dist/tooling/shared/{9kazs5p6.js → xwr6q618.js} +3 -3
  225. package/dist/tooling/shared/{ep8zh3bk.js → xx3gmq94.js} +1 -1
  226. package/dist/tooling/shared/{tn8gay14.js → y2bd7yfx.js} +21 -13
  227. package/dist/tooling/shared/{vraj6d74.js → y4gq9rbe.js} +11 -11
  228. package/dist/tooling/shared/y4vwft92.js +9 -0
  229. package/dist/tooling/shared/{345tbc2k.js → yz68xcmc.js} +1 -1
  230. package/dist/tooling/testing/factories.d.ts +1 -3
  231. package/dist/tooling/testing/index.js +2 -2
  232. package/package.json +39 -9
  233. package/dist/shared/3449rcae.js +0 -14
  234. package/dist/shared/fjpnhqan.js +0 -71
  235. package/dist/shared/n41w4fbz.js +0 -113
  236. package/dist/tooling/shared/pw8fgahx.js +0 -69
  237. /package/dist/shared/{ae4j5f42.js → mfvx6kjx.js} +0 -0
@@ -1,20 +1,20 @@
1
1
  import {
2
- open5,
3
- connectClient3,
4
- send4
5
- } from "./y5656f0e.js";
2
+ open2,
3
+ connectClient2,
4
+ send2
5
+ } from "./4ec0nxvw.js";
6
6
  import {
7
7
  NEON_WEBSOCKET_CAPABILITIES,
8
8
  NEON_HTTP_CAPABILITIES,
9
9
  readCapability2,
10
10
  hasCapability2
11
- } from "./xhrnjch9.js";
11
+ } from "./ry2f3w8p.js";
12
12
  export {
13
13
  NEON_WEBSOCKET_CAPABILITIES as capabilities,
14
- connectClient3 as connectClient,
14
+ connectClient2 as connectClient,
15
15
  hasCapability2 as hasCapability,
16
16
  NEON_HTTP_CAPABILITIES as httpCapabilities,
17
- open5 as open,
17
+ open2 as open,
18
18
  readCapability2 as readCapability,
19
- send4 as send
19
+ send2 as send
20
20
  };
@@ -1,10 +1,14 @@
1
1
  import {
2
2
  OkmError,
3
3
  catalogFileText2
4
- } from "./f9mphxej.js";
4
+ } from "./2jdn09e2.js";
5
+ import {
6
+ artifactDir,
7
+ readText
8
+ } from "./8g0m0rvd.js";
5
9
 
6
10
  // src/runtime/drift.ts
7
- async function assertCompatible(pool, schema, recordedHash, source, options) {
11
+ async function assertCompatible(pool, schema, recordedHash, source, options, namespace = "public") {
8
12
  const code = await codeHash(schema, source);
9
13
  if (code.hash === recordedHash)
10
14
  return;
@@ -12,7 +16,7 @@ async function assertCompatible(pool, schema, recordedHash, source, options) {
12
16
  if (code.artifact !== undefined) {
13
17
  const artifact = code.artifact;
14
18
  await loadOnce(`text\x00${artifact.hash}`, async () => {
15
- const { loadTrustedCatalog } = await import("./5bvw2nev.js");
19
+ const { loadTrustedCatalog } = await import("./2v4nwnkb.js");
16
20
  loadTrustedCatalog(artifact.text, artifact.hash);
17
21
  });
18
22
  } else if (code.fromFile) {
@@ -26,12 +30,12 @@ async function assertCompatible(pool, schema, recordedHash, source, options) {
26
30
  }
27
31
  });
28
32
  }
29
- const { loadTrustedCatalog } = await import("./5bvw2nev.js");
33
+ const { loadTrustedCatalog } = await import("./2v4nwnkb.js");
30
34
  loadTrustedCatalog(text, code.hash);
31
35
  });
32
36
  }
33
- const { assertDrift } = await import("./rf83gr2d.js");
34
- await assertDrift(pool, code.hash, recordedHash, options);
37
+ const { assertDrift } = await import("./vg68k11z.js");
38
+ await assertDrift(pool, code.hash, recordedHash, options, namespace);
35
39
  }
36
40
  async function codeHash(schema, source) {
37
41
  if (source.catalog !== undefined) {
@@ -40,7 +44,7 @@ async function codeHash(schema, source) {
40
44
  const listed = await readHashFile(source.catalogDir);
41
45
  if (listed !== undefined)
42
46
  return { hash: listed, fromFile: true };
43
- const { catalogHash } = await import("./5bvw2nev.js");
47
+ const { catalogHash } = await import("./2v4nwnkb.js");
44
48
  return { hash: catalogHash(schemaCatalog(schema)), fromFile: false };
45
49
  }
46
50
  function schemaCatalog(schema) {
@@ -61,29 +65,6 @@ async function readHashFile(catalogDir) {
61
65
  const hash = catalogFileText2(text, "catalog.hash").trim();
62
66
  return hash.length === 0 ? undefined : hash;
63
67
  }
64
- function artifactDir(catalogDir) {
65
- if (catalogDir !== undefined)
66
- return catalogDir.replace(/[/\\]+$/, "");
67
- const cwd = globalThis.process?.cwd?.() ?? ".";
68
- return `${cwd}/.okm`;
69
- }
70
- async function readText(path) {
71
- const bun = globalThis.Bun;
72
- if (bun !== undefined) {
73
- const file = bun.file(path);
74
- if (!await file.exists())
75
- return;
76
- return file.text();
77
- }
78
- const loader = globalThis.process?.getBuiltinModule;
79
- if (loader === undefined)
80
- return;
81
- try {
82
- return await loader("node:fs/promises").readFile(path, "utf8");
83
- } catch {
84
- return;
85
- }
86
- }
87
68
  export {
88
69
  assertCompatible
89
70
  };
@@ -1,22 +1,22 @@
1
1
  import {
2
2
  markClientPool2,
3
- open2
4
- } from "./xjs6zqtc.js";
3
+ open3
4
+ } from "./3f6etb9z.js";
5
5
  import {
6
6
  createClient
7
- } from "./mtrqn2hn.js";
7
+ } from "./gjj71hfh.js";
8
8
 
9
9
  // src/runtime/pg/bun.ts
10
10
  function connect(target, options) {
11
11
  if (typeof target === "object" && !isPool(target)) {
12
- return import("./2wtvc7rw.js").then((mod) => mod.default(target, options, (config) => {
13
- const pool = open2(config);
12
+ return import("./bt3tjemb.js").then((mod) => mod.default(target, options, (config) => {
13
+ const pool = open3(config);
14
14
  markClientPool2(pool);
15
15
  return pool;
16
16
  }));
17
17
  }
18
18
  const owned = !isPool(target);
19
- const pool = isPool(target) ? target : open2({
19
+ const pool = isPool(target) ? target : open3({
20
20
  url: target,
21
21
  ...options.max !== undefined ? { max: options.max } : {},
22
22
  ...options.timeouts !== undefined ? { timeouts: options.timeouts } : {},
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  open6,
3
3
  seal2
4
- } from "./djydjpqt.js";
4
+ } from "./xn6p01fh.js";
5
5
  import {
6
6
  PGLITE_CAPABILITIES,
7
7
  readCapability2,
8
8
  hasCapability2
9
- } from "./xhrnjch9.js";
9
+ } from "./ry2f3w8p.js";
10
10
  export {
11
11
  PGLITE_CAPABILITIES as capabilities,
12
12
  hasCapability2 as hasCapability,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  rejectUncancellable
3
- } from "./ae4j5f42.js";
3
+ } from "./ry2f3w8p.js";
4
4
 
5
5
  // src/adapters/pg/no-inflight-timeout.ts
6
6
  function noTimeout(options) {
@@ -531,7 +531,7 @@ function mapPostgresError2(error, options) {
531
531
  return error;
532
532
  if (!isDriverError2(error))
533
533
  return OkmError.from(error);
534
- const search = searchInputError(error);
534
+ const search = searchInputError(error, options);
535
535
  if (search !== undefined)
536
536
  return search;
537
537
  const kind = kindOf(error);
@@ -540,6 +540,7 @@ function mapPostgresError2(error, options) {
540
540
  const fieldReason = hint?.reason ?? (kind === "not_null" ? "not_null" : reasonOf(kind, error.table, error.constraint, columns, options?.schema));
541
541
  const values = options?.includeValues === true ? valuesOf(error.detail, columns) : undefined;
542
542
  const code = kind === "outcome_unknown" ? "OKM1401" : kind;
543
+ const redactCause = options?.includeValues !== true && needsSafeCause(options?.schema, error.table, columns);
543
544
  return new OkmError(code, summaryOf(kind, error, columns, fieldReason), {
544
545
  kind,
545
546
  fieldReason,
@@ -549,11 +550,59 @@ function mapPostgresError2(error, options) {
549
550
  ...error.constraint !== undefined ? { constraint: error.constraint } : {},
550
551
  ...error.sqlstate !== undefined ? { sqlstate: error.sqlstate } : {},
551
552
  batchIndex: error.batchIndex,
552
- cause: error.cause ?? error,
553
+ cause: redactCause ? safeCause(error) : error.cause ?? error,
553
554
  ...options?.includeValues === true && values !== undefined ? { includeValues: true, values } : {},
554
555
  ...options?.http !== undefined ? { http: options.http } : {}
555
556
  });
556
557
  }
558
+ function needsSafeCause(schema, table, columns) {
559
+ if (schema === undefined)
560
+ return false;
561
+ const model = modelForTable(schema, table);
562
+ if (model !== undefined && model.columns.some((column) => column.sensitive === true)) {
563
+ return true;
564
+ }
565
+ if (columns.length === 0)
566
+ return false;
567
+ for (const item of Object.values(schema.model)) {
568
+ for (const column of item.columns) {
569
+ if (column.sensitive !== true)
570
+ continue;
571
+ for (const name of columns) {
572
+ if (column.sql === name || column.field === name)
573
+ return true;
574
+ }
575
+ }
576
+ }
577
+ return false;
578
+ }
579
+ function safeCause(error) {
580
+ const out = { name: "DriverError" };
581
+ if (error.sqlstate !== undefined)
582
+ out.sqlstate = error.sqlstate;
583
+ if (error.constraint !== undefined)
584
+ out.constraint = error.constraint;
585
+ if (error.table !== undefined)
586
+ out.table = error.table;
587
+ if (error.column !== undefined)
588
+ out.column = error.column;
589
+ const nested = error.cause;
590
+ if (typeof nested === "object" && nested !== null) {
591
+ const code = Reflect.get(nested, "code");
592
+ if (typeof code === "string" && code.length > 0 && code.length <= 64)
593
+ out.code = code;
594
+ }
595
+ return out;
596
+ }
597
+ function modelForTable(schema, table) {
598
+ if (table === undefined)
599
+ return;
600
+ for (const item of Object.values(schema.model)) {
601
+ if (item.sql === table)
602
+ return item;
603
+ }
604
+ return schema.model[table];
605
+ }
557
606
  var TLS_CODE = /^(ERR_TLS_|ERR_POSTGRES_TLS_|SELF_SIGNED_CERT_|DEPTH_ZERO_SELF_SIGNED_CERT$|UNABLE_TO_VERIFY_LEAF_SIGNATURE$)/;
558
607
  function isTlsFailure(error) {
559
608
  const cause = error.cause;
@@ -572,14 +621,15 @@ function searchQuery(error) {
572
621
  const query = Reflect.get(cause, "query");
573
622
  return typeof query === "string" && query.includes("to_tsquery");
574
623
  }
575
- function searchInputError(error) {
624
+ function searchInputError(error, options) {
576
625
  const sqlstate = error.sqlstate;
577
626
  const message = error.message;
627
+ const cause = options?.includeValues !== true && needsSafeCause(options?.schema, error.table, columnsOf(error)) ? safeCause(error) : error.cause ?? error;
578
628
  if (sqlstate === "42601" && (message.includes("tsquery") || searchQuery(error))) {
579
629
  return new OkmError("OKM1120", `Search input is not valid. ${stripRowValues(message)}`, {
580
630
  kind: "invalid",
581
631
  sqlstate,
582
- cause: error.cause ?? error,
632
+ cause,
583
633
  fix: { summary: "Fix the advanced search text, or use natural, all-words, or phrase." }
584
634
  });
585
635
  }
@@ -587,7 +637,7 @@ function searchInputError(error) {
587
637
  return new OkmError("OKM1122", stripRowValues(message), {
588
638
  kind: "invalid",
589
639
  sqlstate,
590
- cause: error.cause ?? error,
640
+ cause,
591
641
  fix: {
592
642
  summary: "Use a text search configuration that exists, such as english, or omit language."
593
643
  }
@@ -2285,6 +2335,351 @@ function isPlainRecord(value) {
2285
2335
  function assertNever2(value) {
2286
2336
  return catalogError("OKM1020", `Unexpected catalog object ${JSON.stringify(value)}.`);
2287
2337
  }
2338
+ // src/dialects/pg/quote.ts
2339
+ function quoteLiteral(value) {
2340
+ return `'${value.replaceAll("'", "''")}'`;
2341
+ }
2342
+ function arrayElement(encoded, raw) {
2343
+ if (raw && (encoded === "true" || encoded === "false" || isBareNumber(encoded))) {
2344
+ return encoded;
2345
+ }
2346
+ return `"${encoded.replaceAll("\\", "\\\\").replaceAll('"', "\\\"")}"`;
2347
+ }
2348
+ function isBareNumber(encoded) {
2349
+ let pattern = bareNumber;
2350
+ pattern ??= /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;
2351
+ bareNumber = pattern;
2352
+ return pattern.test(encoded);
2353
+ }
2354
+ var bareNumber;
2355
+
2356
+ // src/dialects/pg/ddl.ts
2357
+ function quoteIdent2(name) {
2358
+ return `"${name.replaceAll('"', '""')}"`;
2359
+ }
2360
+ function renderCatalog2(source, schema) {
2361
+ const folded = foldedKeys(source);
2362
+ const statements = [];
2363
+ const ordered = creationOrder2(source);
2364
+ const created = uniqueBeforeForeignKey(ordered);
2365
+ for (const object of ordered) {
2366
+ if (object.kind !== "type" || object.owner === "ignored")
2367
+ continue;
2368
+ const sql = createObjectSql(object, schema);
2369
+ if (sql !== undefined)
2370
+ statements.push(sql);
2371
+ }
2372
+ for (const object of created) {
2373
+ if (object.kind === "type" || object.kind === "function" || object.kind === "trigger" || object.kind === "view" || object.kind === "materializedView" || object.kind === "policy" || ownedByView(object)) {
2374
+ continue;
2375
+ }
2376
+ if (object.owner === "ignored")
2377
+ continue;
2378
+ const key = identityKey(object.identity);
2379
+ if (object.kind === "table") {
2380
+ statements.push(createTableSql(object, source, schema));
2381
+ continue;
2382
+ }
2383
+ if (folded.has(key))
2384
+ continue;
2385
+ const sql = createObjectSql(object, schema);
2386
+ if (sql !== undefined)
2387
+ statements.push(sql);
2388
+ }
2389
+ for (const object of created) {
2390
+ if (object.kind !== "policy" || object.owner === "ignored")
2391
+ continue;
2392
+ for (const step of policyCreatePlan(object, schema))
2393
+ statements.push(step.sql);
2394
+ }
2395
+ for (const kind of ["function", "trigger"]) {
2396
+ for (const object of ordered) {
2397
+ if (object.kind !== kind || object.owner === "ignored")
2398
+ continue;
2399
+ const sql = createObjectSql(object, schema);
2400
+ if (sql !== undefined)
2401
+ statements.push(sql);
2402
+ }
2403
+ }
2404
+ for (const kind of ["view", "materializedView"]) {
2405
+ for (const object of ordered) {
2406
+ if (object.kind !== kind || object.owner === "ignored")
2407
+ continue;
2408
+ const sql = createObjectSql(object, schema);
2409
+ if (sql !== undefined)
2410
+ statements.push(sql);
2411
+ }
2412
+ }
2413
+ for (const object of ordered) {
2414
+ if (!ownedByView(object) || object.owner === "ignored")
2415
+ continue;
2416
+ const sql = createObjectSql(object, schema);
2417
+ if (sql !== undefined)
2418
+ statements.push(sql);
2419
+ }
2420
+ return statements;
2421
+ }
2422
+ function uniqueBeforeForeignKey(objects) {
2423
+ const uniques = objects.filter((object) => object.kind === "constraint" && object.definition.constraintKind === "unique");
2424
+ if (uniques.length === 0)
2425
+ return objects;
2426
+ const emitted = new Set;
2427
+ const result = [];
2428
+ for (const object of objects) {
2429
+ if (emitted.has(object))
2430
+ continue;
2431
+ if (object.kind === "constraint" && object.definition.constraintKind === "foreignKey") {
2432
+ const target = object.definition.references;
2433
+ if (target !== undefined && !coveredByPrimary(objects, target.parent, target.columns)) {
2434
+ const columns = target.columns.join("\x00");
2435
+ for (const unique of uniques) {
2436
+ if (emitted.has(unique))
2437
+ continue;
2438
+ if (!sameRef2(unique.identity.parent, target.parent))
2439
+ continue;
2440
+ if (unique.definition.columns.join("\x00") !== columns)
2441
+ continue;
2442
+ result.push(unique);
2443
+ emitted.add(unique);
2444
+ }
2445
+ }
2446
+ }
2447
+ result.push(object);
2448
+ emitted.add(object);
2449
+ }
2450
+ return result;
2451
+ }
2452
+ function coveredByPrimary(objects, parent, columns) {
2453
+ const key = columns.join("\x00");
2454
+ return objects.some((object) => object.kind === "constraint" && object.definition.constraintKind === "primaryKey" && sameRef2(object.identity.parent, parent) && object.definition.columns.join("\x00") === key);
2455
+ }
2456
+ function sameRef2(left, right) {
2457
+ if (left.name !== right.name || left.namespace.form !== right.namespace.form)
2458
+ return false;
2459
+ if (left.namespace.form === "static" && right.namespace.form === "static") {
2460
+ return left.namespace.name === right.namespace.name;
2461
+ }
2462
+ return left.namespace.form === "template" && right.namespace.form === "template" ? left.namespace.pattern === right.namespace.pattern : false;
2463
+ }
2464
+ function ownedByView(object) {
2465
+ if (object.kind !== "index")
2466
+ return false;
2467
+ return object.dependencies.some((edge) => edge.target.kind === "view" || edge.target.kind === "materializedView");
2468
+ }
2469
+ function createObjectSql(object, schema) {
2470
+ switch (object.kind) {
2471
+ case "column":
2472
+ return `alter table ${qualify(schema, object.identity.parent.name)} add column ${columnSql(object)}`;
2473
+ case "index":
2474
+ return createIndexSql(object, schema);
2475
+ case "constraint":
2476
+ return `alter table ${qualify(schema, object.identity.parent.name)} add constraint ${quoteIdent2(object.identity.name)} ${constraintBody(object, schema)}`;
2477
+ case "sequence":
2478
+ return createSequenceSql(object, schema);
2479
+ case "type":
2480
+ return createTypeSql(object, schema);
2481
+ case "extension":
2482
+ return createExtensionSql(object);
2483
+ case "function":
2484
+ return functionSql(object, schema, false);
2485
+ case "trigger":
2486
+ return triggerSql(object, schema);
2487
+ case "view":
2488
+ return viewSql(object, schema, false);
2489
+ case "materializedView":
2490
+ return materializedViewSql(object, schema);
2491
+ case "table":
2492
+ return;
2493
+ default:
2494
+ return;
2495
+ }
2496
+ }
2497
+ function functionSql(object, schema, replace) {
2498
+ const definition = object.definition;
2499
+ const args = definition.arguments.map((argument) => `${quoteIdent2(argument.name)} ${argument.type}`).join(", ");
2500
+ const head = `${replace ? "create or replace" : "create"} function ${qualify(schema, object.identity.name)}(${args})`;
2501
+ const security = ` security ${definition.security}`;
2502
+ const path = definition.searchPath === undefined ? "" : ` set search_path to ${definition.searchPath}`;
2503
+ const tail = `returns ${definition.returns} language ${definition.language} ${definition.volatility}${security}${path}`;
2504
+ if (definition.atomic)
2505
+ return `${head} ${tail} ${definition.body}`;
2506
+ return `${head} ${tail} as ${dollarQuote(definition.body)}`;
2507
+ }
2508
+ function viewSql(object, schema, replace) {
2509
+ const verb = replace ? "create or replace view" : "create view";
2510
+ const invoker = object.definition.securityInvoker === true ? " with (security_invoker = true)" : "";
2511
+ return `${verb} ${qualify(schema, object.identity.name)}${invoker} as ${object.definition.query}`;
2512
+ }
2513
+ function policyCreatePlan(object, schema) {
2514
+ const table = qualify(schema, object.identity.parent.name);
2515
+ const name = quoteIdent2(object.identity.name);
2516
+ const command = object.definition.command === "all" ? "all" : "select";
2517
+ const check = object.definition.command === "all" ? ` with check ${object.definition.expression}` : "";
2518
+ const create = {
2519
+ sql: `create policy ${name} on ${table} as permissive for ${command} using ${object.definition.expression}${check}`,
2520
+ kind: "create-policy"
2521
+ };
2522
+ if (object.definition.command !== "all")
2523
+ return [create];
2524
+ return [
2525
+ { sql: `alter table ${table} enable row level security`, kind: "enable-rls" },
2526
+ { sql: `alter table ${table} force row level security`, kind: "enable-rls" },
2527
+ create
2528
+ ];
2529
+ }
2530
+ function materializedViewSql(object, schema) {
2531
+ return `create materialized view ${qualify(schema, object.identity.name)} as ${object.definition.query} with no data`;
2532
+ }
2533
+ function triggerSql(object, schema) {
2534
+ const definition = object.definition;
2535
+ const timing = definition.timing === "instead" ? "instead of" : definition.timing;
2536
+ const events = definition.events.map((event) => {
2537
+ if (event !== "update" || definition.updateOf === undefined)
2538
+ return event;
2539
+ return `update of ${definition.updateOf.map((column) => quoteIdent2(column)).join(", ")}`;
2540
+ }).join(" or ");
2541
+ const when = definition.when === undefined ? "" : ` when (${definition.when})`;
2542
+ const args = definition.calls.argTypes.join(", ");
2543
+ const fn = `${qualify(schema, definition.calls.name)}(${args})`;
2544
+ return `create trigger ${quoteIdent2(object.identity.name)} ${timing} ${events} on ${qualify(schema, object.identity.parent.name)} for each ${definition.level}${when} execute function ${fn}`;
2545
+ }
2546
+ function dollarQuote(body) {
2547
+ let tag = "okm";
2548
+ while (body.includes(`$${tag}$`))
2549
+ tag = `${tag}_`;
2550
+ return `$${tag}$${body}$${tag}$`;
2551
+ }
2552
+ function identitySequence(sequence, source) {
2553
+ const key = identityKey(sequence.identity);
2554
+ return source.objects.some((object) => {
2555
+ if (object.kind !== "column" || object.definition.identity === undefined)
2556
+ return false;
2557
+ return object.dependencies.some((edge) => identityKey(edge.target) === key);
2558
+ });
2559
+ }
2560
+ function foldedKeys(source) {
2561
+ const keys = new Set;
2562
+ for (const object of source.objects) {
2563
+ if (object.kind === "column")
2564
+ keys.add(identityKey(object.identity));
2565
+ if (object.kind === "constraint" && object.definition.constraintKind === "primaryKey") {
2566
+ keys.add(identityKey(object.identity));
2567
+ }
2568
+ if (object.kind === "sequence" && identitySequence(object, source)) {
2569
+ keys.add(identityKey(object.identity));
2570
+ }
2571
+ }
2572
+ return keys;
2573
+ }
2574
+ function createTableSql(tableObject, source, schema) {
2575
+ const parent = tableObject.identity.name;
2576
+ const columns = source.objects.filter((object) => object.kind === "column" && object.identity.parent.name === parent);
2577
+ const primary = source.objects.find((object) => object.kind === "constraint" && object.definition.constraintKind === "primaryKey" && object.identity.parent.name === parent);
2578
+ const lines = columns.map((column) => columnSql(column));
2579
+ if (primary !== undefined) {
2580
+ const cols = primary.definition.columns.map((name) => quoteIdent2(name)).join(", ");
2581
+ lines.push(`constraint ${quoteIdent2(primary.identity.name)} primary key (${cols})`);
2582
+ }
2583
+ const partition = tableObject.definition.partition;
2584
+ const tail = partition === undefined ? "" : ` partition by ${partition.method} (${partition.columns.map((name) => quoteIdent2(name)).join(", ")})`;
2585
+ return `create table ${qualify(schema, parent)} (
2586
+ ${lines.join(`,
2587
+ `)}
2588
+ )${tail}`;
2589
+ }
2590
+ function collateSql(collation) {
2591
+ if (collation === undefined)
2592
+ return "";
2593
+ return ` collate ${quoteIdent2(collation)}`;
2594
+ }
2595
+ function createTypeSql(object, schema) {
2596
+ if (isDomain(object.definition)) {
2597
+ const name = object.identity.name;
2598
+ const constraint = quoteIdent2(fitIdentifier(`${name}_check`));
2599
+ return `create domain ${qualify(schema, name)} as ${object.definition.base} constraint ${constraint} check (${object.definition.check})`;
2600
+ }
2601
+ const labels = object.definition.labels.map((label) => quoteLiteral(label)).join(", ");
2602
+ return `create type ${qualify(schema, object.identity.name)} as enum (${labels})`;
2603
+ }
2604
+ function columnSql(column) {
2605
+ const definition = column.definition;
2606
+ let sql = `${quoteIdent2(column.identity.name)} ${definition.dataType}${collateSql(definition.collation)}`;
2607
+ if (definition.identity !== undefined) {
2608
+ sql += definition.identity.always ? " generated always as identity" : " generated by default as identity";
2609
+ } else if (definition.generated !== undefined) {
2610
+ sql += ` generated always as (${definition.generated.expression}) stored`;
2611
+ }
2612
+ if (!definition.nullable)
2613
+ sql += " not null";
2614
+ if (definition.defaultExpression !== undefined)
2615
+ sql += ` default ${definition.defaultExpression}`;
2616
+ return sql;
2617
+ }
2618
+ function createIndexSql(object, schema) {
2619
+ const unique = object.definition.unique ? "unique " : "";
2620
+ const where = object.definition.predicate === undefined ? "" : ` where ${object.definition.predicate}`;
2621
+ const expression = object.definition.expression;
2622
+ const name = quoteIdent2(object.identity.name);
2623
+ const on = qualify(schema, object.identity.parent.name);
2624
+ if (expression !== undefined && expression.startsWith("using ")) {
2625
+ return `create ${unique}index ${name} on ${on} ${expression}${where}`;
2626
+ }
2627
+ const target = expression !== undefined ? `(${expression})` : object.definition.columns.map((column) => quoteIdent2(column)).join(", ");
2628
+ return `create ${unique}index ${name} on ${on} (${target})${where}`;
2629
+ }
2630
+ function createExtensionSql(object) {
2631
+ const version = object.definition.version;
2632
+ const pinned = version !== undefined && /^\d+(?:\.\d+)*$/.test(version) ? ` version ${quoteLiteral(version)}` : "";
2633
+ return `create extension ${quoteIdent2(object.identity.name)} schema ${quoteIdent2(object.definition.schema)}${pinned}`;
2634
+ }
2635
+ function createSequenceSql(object, schema) {
2636
+ const definition = object.definition;
2637
+ const cycle = definition.cycle ? " cycle" : "";
2638
+ return `create sequence ${qualify(schema, object.identity.name)} as ${definition.dataType} start ${definition.start} increment ${definition.increment}${cycle}`;
2639
+ }
2640
+ function referenceSchema(object, schema) {
2641
+ const references = object.definition.references;
2642
+ if (references === undefined)
2643
+ return schema;
2644
+ const target = references.parent.namespace;
2645
+ const parent = object.identity.parent.namespace;
2646
+ if (target.form === "static" && parent.form === "static" && target.name !== parent.name) {
2647
+ return target.name;
2648
+ }
2649
+ return schema;
2650
+ }
2651
+ function constraintBody(object, schema) {
2652
+ const definition = object.definition;
2653
+ const columns = definition.columns.map((name) => quoteIdent2(name)).join(", ");
2654
+ switch (definition.constraintKind) {
2655
+ case "primaryKey":
2656
+ return `primary key (${columns})`;
2657
+ case "unique": {
2658
+ const nulls = definition.nullsNotDistinct ? " nulls not distinct" : "";
2659
+ return `unique${nulls} (${columns})${deferClause(definition)}`;
2660
+ }
2661
+ case "check":
2662
+ return `check (${definition.expression ?? "true"})${deferClause(definition)}`;
2663
+ case "foreignKey": {
2664
+ const references = definition.references;
2665
+ const target = references === undefined ? "" : ` references ${qualify(referenceSchema(object, schema), references.parent.name)} (${references.columns.map((name) => quoteIdent2(name)).join(", ")})`;
2666
+ const onDelete = references?.onDelete === undefined ? "" : ` on delete ${references.onDelete}`;
2667
+ const onUpdate = references?.onUpdate === undefined ? "" : ` on update ${references.onUpdate}`;
2668
+ return `foreign key (${columns})${target}${onDelete}${onUpdate}${deferClause(definition)}`;
2669
+ }
2670
+ default:
2671
+ return definition.constraintKind;
2672
+ }
2673
+ }
2674
+ function deferClause(definition) {
2675
+ if (!definition.deferrable)
2676
+ return "";
2677
+ return ` deferrable initially ${definition.initially}`;
2678
+ }
2679
+ function qualify(schema, name) {
2680
+ return `${quoteIdent2(schema)}.${quoteIdent2(name)}`;
2681
+ }
2682
+
2288
2683
  // src/dialects/pg/floor.ts
2289
2684
  var POSTGRES_FLOOR = 15;
2290
2685
  var UUIDV7_POSTGRES = 18;
@@ -2363,24 +2758,6 @@ function rejected(message) {
2363
2758
  throw new OkmError(CODEC_VALUE_CODE, message);
2364
2759
  }
2365
2760
 
2366
- // src/dialects/pg/quote.ts
2367
- function quoteLiteral(value) {
2368
- return `'${value.replaceAll("'", "''")}'`;
2369
- }
2370
- function arrayElement(encoded, raw) {
2371
- if (raw && (encoded === "true" || encoded === "false" || isBareNumber(encoded))) {
2372
- return encoded;
2373
- }
2374
- return `"${encoded.replaceAll("\\", "\\\\").replaceAll('"', "\\\"")}"`;
2375
- }
2376
- function isBareNumber(encoded) {
2377
- let pattern = bareNumber;
2378
- pattern ??= /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;
2379
- bareNumber = pattern;
2380
- return pattern.test(encoded);
2381
- }
2382
- var bareNumber;
2383
-
2384
2761
  // src/dialects/pg/array-literal.ts
2385
2762
  function writeArray(value, dims, encode, raw) {
2386
2763
  return writeLevel(value, dims, encode, raw);
@@ -3786,4 +4163,4 @@ function postgresUrl(port) {
3786
4163
  return `postgres://${USER}:${PASSWORD}@${HOST}:${port}/${DATABASE}`;
3787
4164
  }
3788
4165
 
3789
- export { OkmError, safe, catalogError, throwNamed, DriverError2, cancelled2, timedOut2, outcomeUnknown2, acquireTimeout2, errorField2, mapDriverError2, isConnectionSqlstate, isConnectionErrno, isConnectionFailure, isConnectionLost, mapPostgresError2, assertIdentifier, fitIdentifier, assertStoredText, staticNamespace, identityKey, identityLabel, sameNamespace, CATALOG_VERSION, table, column, index, constraint, sequence, compareText, enumType, domainType, isDomain, sameEnumLabels, indexObjects, orderIndexed, creationOrder2, catalogHash2, loadTrustedCatalog2, catalogFileText2, quoteLiteral, clientGenerator, readClientGenerator, definition, unavailable, rejected, writeArray, ColumnBuilder, required, openColumn, formatType, retarget, POSTGRES_FLOOR, UUIDV7_POSTGRES, isPostgresMajor, parsePostgresFloor, formatPostgresFloor, minPostgresDefinition, uuidv7NeedsPostgres, serverNeedsPostgres, isOperator, operatorName, operatorValue, tag, json, jsonb, encodeJson, safetyInstalled, runSafety, withRowFilters, archiveRules, readOptionNames, installOperatorSql, readNeedsOperatorSql, orderHasRelevance, emitRelationFrom, needsOperatorSql, bindCall, compileCall, decodeResult, logicalIntent, appliedRules, emitJoin, emitWhere, emitOrder, emitPrimaryOrder, refuseHidden, emitLimit, selectedColumns, parseOrder, rejectKeys, readLimit, takeObject, projectExpr, jsonExpr, decodeRow, cell, indexes, quote, list, isRecord, orFail, registerFailFix, fail2, primaryUrl };
4166
+ export { OkmError, safe, catalogError, throwNamed, DriverError2, cancelled2, timedOut2, outcomeUnknown2, acquireTimeout2, errorField2, mapDriverError2, isConnectionSqlstate, isConnectionErrno, isConnectionFailure, isConnectionLost, mapPostgresError2, assertIdentifier, fitIdentifier, assertStoredText, staticNamespace, identityKey, identityLabel, sameNamespace, CATALOG_VERSION, table, column, index, constraint, sequence, compareText, enumType, domainType, sameEnumLabels, indexObjects, orderIndexed, creationOrder2, catalogHash2, loadTrustedCatalog2, catalogFileText2, quoteLiteral, quoteIdent2, renderCatalog2, clientGenerator, readClientGenerator, definition, unavailable, rejected, writeArray, ColumnBuilder, required, openColumn, formatType, retarget, POSTGRES_FLOOR, UUIDV7_POSTGRES, isPostgresMajor, parsePostgresFloor, formatPostgresFloor, minPostgresDefinition, uuidv7NeedsPostgres, serverNeedsPostgres, isOperator, operatorName, operatorValue, tag, json, jsonb, encodeJson, safetyInstalled, runSafety, withRowFilters, archiveRules, readOptionNames, installOperatorSql, readNeedsOperatorSql, orderHasRelevance, emitRelationFrom, needsOperatorSql, bindCall, compileCall, decodeResult, logicalIntent, appliedRules, emitJoin, emitWhere, emitOrder, emitPrimaryOrder, refuseHidden, emitLimit, selectedColumns, parseOrder, rejectKeys, readLimit, takeObject, projectExpr, jsonExpr, decodeRow, cell, indexes, quote, list, isRecord, orFail, registerFailFix, fail2, primaryUrl };
@@ -1,17 +1,17 @@
1
1
  import {
2
- open4
3
- } from "./417zdsk7.js";
2
+ open5
3
+ } from "./ppybjw50.js";
4
4
  import {
5
5
  createClient
6
- } from "./mtrqn2hn.js";
6
+ } from "./gjj71hfh.js";
7
7
 
8
8
  // src/runtime/pg/pg.ts
9
9
  function connect(target, options) {
10
10
  if (typeof target === "object" && !isPool(target)) {
11
- return import("./2wtvc7rw.js").then((mod) => mod.default(target, options, open4));
11
+ return import("./bt3tjemb.js").then((mod) => mod.default(target, options, open5));
12
12
  }
13
13
  const owned = !isPool(target);
14
- const pool = isPool(target) ? target : open4({
14
+ const pool = isPool(target) ? target : open5({
15
15
  url: target,
16
16
  ...options.max !== undefined ? { max: options.max } : {},
17
17
  ...options.timeouts !== undefined ? { timeouts: options.timeouts } : {},