okmodel 0.8.0 → 0.9.0

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 (202) hide show
  1. package/README.md +14 -0
  2. package/dist/dialects/pg/ext/btree-gin.d.ts +26 -0
  3. package/dist/dialects/pg/ext/btree-gin.js +20 -0
  4. package/dist/dialects/pg/ext/btree-gist.d.ts +26 -0
  5. package/dist/dialects/pg/ext/btree-gist.js +20 -0
  6. package/dist/dialects/pg/ext/call.d.ts +53 -0
  7. package/dist/dialects/pg/ext/citext.js +1 -1
  8. package/dist/dialects/pg/ext/feature.d.ts +26 -0
  9. package/dist/dialects/pg/ext/fuzzystrmatch.d.ts +34 -0
  10. package/dist/dialects/pg/ext/fuzzystrmatch.js +33 -0
  11. package/dist/dialects/pg/ext/hstore.d.ts +41 -0
  12. package/dist/dialects/pg/ext/hstore.js +29 -0
  13. package/dist/dialects/pg/ext/index.d.ts +56 -0
  14. package/dist/dialects/pg/ext/index.js +1 -1
  15. package/dist/dialects/pg/ext/ltree.d.ts +41 -0
  16. package/dist/dialects/pg/ext/ltree.js +29 -0
  17. package/dist/dialects/pg/ext/pg-trgm.js +4 -13
  18. package/dist/dialects/pg/ext/pgcrypto.d.ts +33 -0
  19. package/dist/dialects/pg/ext/pgcrypto.js +33 -0
  20. package/dist/dialects/pg/ext/unaccent.d.ts +26 -0
  21. package/dist/dialects/pg/ext/unaccent.js +21 -0
  22. package/dist/dialects/pg/ext/using.d.ts +23 -0
  23. package/dist/dialects/pg/ext/versions.d.ts +36 -0
  24. package/dist/dialects/pg/external.d.ts +19 -0
  25. package/dist/dialects/pg/fn/index.js +4 -4
  26. package/dist/dialects/pg/index.d.ts +1 -0
  27. package/dist/dialects/pg/index.js +16 -11
  28. package/dist/dialects/pg/view/index.js +5 -5
  29. package/dist/dialects/pg/view/scratch.d.ts +4 -1
  30. package/dist/runtime/artifact-file.d.ts +22 -0
  31. package/dist/runtime/client.d.ts +10 -0
  32. package/dist/runtime/drift-detail.d.ts +2 -1
  33. package/dist/runtime/drift.d.ts +3 -10
  34. package/dist/runtime/pg/bun.js +4 -4
  35. package/dist/runtime/pg/neon.js +4 -4
  36. package/dist/runtime/pg/pg.js +4 -4
  37. package/dist/runtime/pg/pglite.js +4 -4
  38. package/dist/runtime/pg/postgresjs.js +4 -4
  39. package/dist/runtime/server-check.d.ts +36 -6
  40. package/dist/runtime/traits/index.js +5 -5
  41. package/dist/runtime/validate/index.js +1 -1
  42. package/dist/shared/{4m6hskg8.js → 0j6qe91y.js} +4 -4
  43. package/dist/shared/{14x60fbf.js → 1mxm04fy.js} +5 -5
  44. package/dist/shared/{b6d6p0zc.js → 2szgv6yj.js} +5 -5
  45. package/dist/shared/{f4jy1j7x.js → 2zdxkt7b.js} +909 -100
  46. package/dist/shared/{mnvjvqyp.js → 3456242y.js} +17 -17
  47. package/dist/shared/3t6kw83m.js +1 -1
  48. package/dist/shared/{6m78c8ss.js → 5kyb3tqx.js} +1 -1
  49. package/dist/shared/61bmrmhr.js +35 -0
  50. package/dist/shared/{zbqbmmrp.js → 62b603gr.js} +8 -8
  51. package/dist/shared/{jgqj11w4.js → 6f0z3hzh.js} +4 -0
  52. package/dist/shared/{dpc2r7rb.js → 6nae0spm.js} +150 -89
  53. package/dist/shared/{0wrea3jq.js → 71n0jmhc.js} +1 -1
  54. package/dist/shared/7ba5h6pb.js +17 -0
  55. package/dist/shared/{k86n8vq3.js → 8jesqsrk.js} +1 -1
  56. package/dist/shared/{qd9hhd8f.js → 8n688yjg.js} +1 -1
  57. package/dist/shared/{zgex00fd.js → 8qzkd9f3.js} +5 -5
  58. package/dist/shared/{mkrn359n.js → 90sg0w5a.js} +159 -31
  59. package/dist/shared/{7ghwamrf.js → 99qp9vtg.js} +1 -1
  60. package/dist/shared/{bxas03mq.js → 9dtgn1z2.js} +1 -1
  61. package/dist/shared/{p5nh3r8q.js → aksb89mn.js} +2 -2
  62. package/dist/shared/{wcrheftc.js → bphrgwz9.js} +2 -2
  63. package/dist/shared/{wz2a78mp.js → c3mvnq7a.js} +1 -1
  64. package/dist/shared/{pan0370z.js → ccsmhv9r.js} +24 -6
  65. package/dist/shared/{n0jmpgj1.js → cexb7z6b.js} +1 -1
  66. package/dist/shared/{wvdjznah.js → cf8zdz5p.js} +5 -5
  67. package/dist/shared/{3449rcae.js → ckz05z15.js} +4 -4
  68. package/dist/shared/{35q0n9tz.js → dd5pmnky.js} +7 -7
  69. package/dist/shared/{e8zyaqvj.js → ds229x4r.js} +1 -1
  70. package/dist/{tooling/shared/yw30vnq2.js → shared/e275q7sd.js} +1 -1
  71. package/dist/shared/{mfedzr74.js → ebhz8vh6.js} +4 -4
  72. package/dist/shared/{z581d7ny.js → fdsz3w80.js} +2 -2
  73. package/dist/shared/{sjk86yrx.js → fk9vef30.js} +84 -73
  74. package/dist/shared/{needfe47.js → g89fmz5s.js} +1 -1
  75. package/dist/shared/{m4xff2a6.js → ghqzdp94.js} +2 -2
  76. package/dist/shared/h9811jjm.js +17 -0
  77. package/dist/shared/{kj9d8maq.js → jpybhf98.js} +1 -1
  78. package/dist/shared/kzgrnckd.js +29 -0
  79. package/dist/shared/{agsfb86s.js → mazpbcdj.js} +4 -4
  80. package/dist/shared/{195pzzzz.js → mgaq2sd3.js} +10 -7
  81. package/dist/shared/{5mtf6cj3.js → mvmm3xpb.js} +5 -2
  82. package/dist/shared/{p3xbdcvt.js → myk8fswx.js} +55 -6
  83. package/dist/shared/{njga14v4.js → n306gqkd.js} +8 -8
  84. package/dist/shared/n5whk3mt.js +665 -0
  85. package/dist/shared/{bah9nbg3.js → npdftanb.js} +12 -20
  86. package/dist/shared/{16kvjebh.js → pg4ezgyf.js} +7 -26
  87. package/dist/{tooling/shared/08kemxjd.js → shared/pgsak1yw.js} +1 -1
  88. package/dist/shared/{jp36k7dp.js → qvwwp1mp.js} +61 -40
  89. package/dist/shared/rbxt795q.js +1766 -0
  90. package/dist/shared/{g5yc06ka.js → s7he5e5d.js} +1 -1
  91. package/dist/shared/{hfqmpasr.js → ss2kv2rs.js} +5 -5
  92. package/dist/shared/stfa9xcw.js +450 -0
  93. package/dist/{tooling/shared/rs1jb051.js → shared/tr64w5p0.js} +1 -1
  94. package/dist/shared/{jebgrkeq.js → tw1nvvfj.js} +2 -2
  95. package/dist/shared/{v1wad97q.js → wvtjg5m3.js} +1 -1
  96. package/dist/shared/xqacq37x.js +61 -0
  97. package/dist/shared/{n05z9nwz.js → xtsydxjg.js} +1 -1
  98. package/dist/shared/{jx2m62cs.js → xv8qj97g.js} +5 -5
  99. package/dist/shared/{63f4ksbz.js → xwhdcrm4.js} +1 -1
  100. package/dist/shared/{hm5f8jby.js → yvabyg9k.js} +6 -6
  101. package/dist/shared/yybhre6n.js +136 -0
  102. package/dist/shared/zdqf8k5d.js +8 -0
  103. package/dist/tooling/cli.js +94 -22
  104. package/dist/tooling/driver-run.js +15 -332
  105. package/dist/tooling/github/comment.d.ts +50 -0
  106. package/dist/tooling/github/post-comment.d.ts +17 -0
  107. package/dist/tooling/migrate/commands.d.ts +2 -1
  108. package/dist/tooling/migrate/config.d.ts +13 -0
  109. package/dist/tooling/migrate/export.d.ts +165 -0
  110. package/dist/tooling/migrate/ext-surface.d.ts +80 -0
  111. package/dist/tooling/migrate/ext.d.ts +31 -4
  112. package/dist/tooling/migrate/import-drizzle.d.ts +40 -0
  113. package/dist/tooling/migrate/index.d.ts +3 -0
  114. package/dist/tooling/migrate/index.js +55 -10
  115. package/dist/tooling/migrate/lint-rules.d.ts +18 -1
  116. package/dist/tooling/migrate/lint.d.ts +14 -1
  117. package/dist/tooling/migrate/place.d.ts +18 -0
  118. package/dist/tooling/migrate/plan-json.d.ts +65 -0
  119. package/dist/tooling/migrate/project.d.ts +10 -1
  120. package/dist/tooling/migrate/pull-emit.d.ts +98 -0
  121. package/dist/tooling/migrate/pull-routines.d.ts +126 -0
  122. package/dist/tooling/migrate/pull-verify.d.ts +26 -0
  123. package/dist/tooling/migrate/pull.d.ts +62 -0
  124. package/dist/tooling/migrate/reprint.d.ts +32 -0
  125. package/dist/tooling/migrate/sandbox.d.ts +8 -2
  126. package/dist/tooling/migrate/schema-api.d.ts +43 -0
  127. package/dist/tooling/migrate/sql-lex.d.ts +18 -0
  128. package/dist/tooling/shared/{3m1hkg7z.js → 04svnxxj.js} +4 -4
  129. package/dist/tooling/shared/{ppnnnvj8.js → 0j0jtse1.js} +1 -1
  130. package/dist/tooling/shared/{z8d7ptht.js → 0r05zhyq.js} +5 -5
  131. package/dist/tooling/shared/{a6pp9d12.js → 1800eymw.js} +3 -3
  132. package/dist/tooling/shared/{cmptmb4f.js → 35zemrmf.js} +1 -1
  133. package/dist/tooling/shared/{w7qe8sj1.js → 3rmaz3pq.js} +1 -1
  134. package/dist/{shared/q0cqt2sp.js → tooling/shared/3yn79q5m.js} +1 -1
  135. package/dist/tooling/shared/{2revefqt.js → 57btdkgm.js} +2 -2
  136. package/dist/tooling/shared/{ma2340rx.js → 5bmksndh.js} +2 -2
  137. package/dist/tooling/shared/{9xzm7hjg.js → 5p8km5jb.js} +3 -3
  138. package/dist/tooling/shared/{xhrnjch9.js → 5x3pf400.js} +3 -3
  139. package/dist/tooling/shared/{wwnekq5n.js → 5zrzffnk.js} +1 -1
  140. package/dist/tooling/shared/{p7f08ktn.js → 62fxpc1p.js} +7 -7
  141. package/dist/tooling/shared/{7ae7rjmn.js → 68tf18v4.js} +2 -2
  142. package/dist/tooling/shared/{rf83gr2d.js → 6vk28rjp.js} +7 -3
  143. package/dist/tooling/shared/76pv6qff.js +9 -0
  144. package/dist/tooling/shared/{bz2dqhab.js → 7aews1zg.js} +3 -3
  145. package/dist/tooling/shared/{9kazs5p6.js → 7b3xp9gc.js} +3 -3
  146. package/dist/tooling/shared/{4d2w25vw.js → 7pxncnzs.js} +2 -2
  147. package/dist/tooling/shared/{zvnhh1n0.js → 829fjxyw.js} +2 -2
  148. package/dist/tooling/shared/{dzx85q70.js → 8m5znpdt.js} +1 -1
  149. package/dist/tooling/shared/{g9ad4n80.js → 8yr7ges1.js} +7 -7
  150. package/dist/tooling/shared/{tn8gay14.js → 9qr9rkbh.js} +6 -6
  151. package/dist/tooling/shared/{8sqrsw3s.js → 9sfbtwsk.js} +3 -3
  152. package/dist/{shared/bnby0esn.js → tooling/shared/9wsnsvbf.js} +1 -1
  153. package/dist/tooling/shared/{aftb2mwr.js → a2xe04bm.js} +1 -1
  154. package/dist/tooling/shared/{nf7jmhfa.js → a4pzghha.js} +2 -2
  155. package/dist/tooling/shared/{y5656f0e.js → am04v8na.js} +5 -5
  156. package/dist/tooling/shared/{417zdsk7.js → asgr07mp.js} +5 -5
  157. package/dist/tooling/shared/{pqy21k24.js → c0xevn1h.js} +4 -4
  158. package/dist/tooling/shared/dhatassp.js +134 -0
  159. package/dist/tooling/shared/{spk1jg3r.js → ezqn88nj.js} +8 -8
  160. package/dist/tooling/shared/{6nyfyw70.js → f77nnfqy.js} +2 -2
  161. package/dist/tooling/shared/{wt7j7nf6.js → fh07z1dt.js} +1 -1
  162. package/dist/tooling/shared/{3rrw5w8f.js → gqwevek4.js} +1 -1
  163. package/dist/tooling/shared/{f9mphxej.js → hfq3n3bd.js} +346 -19
  164. package/dist/tooling/shared/{vs0t6qt8.js → j664qjrt.js} +2 -2
  165. package/dist/tooling/shared/{733a1tq3.js → jpgmjsx3.js} +3 -3
  166. package/dist/tooling/shared/{mtrqn2hn.js → jr2nmr81.js} +22 -30
  167. package/dist/{shared/mtw6jz76.js → tooling/shared/jsjjz875.js} +1 -1
  168. package/dist/tooling/shared/{2wtvc7rw.js → kbqnrs1x.js} +2 -2
  169. package/dist/tooling/shared/{gfvtj6d0.js → kz715295.js} +7 -7
  170. package/dist/tooling/shared/{a7q7t4n3.js → m3xt8b1h.js} +2 -2
  171. package/dist/tooling/shared/{dw08f3m8.js → m4hhb8aa.js} +2 -2
  172. package/dist/tooling/shared/{y031jct9.js → mw5npye0.js} +2 -2
  173. package/dist/tooling/shared/{vraj6d74.js → nxq95eb6.js} +3 -3
  174. package/dist/tooling/shared/{fb9k2qwd.js → qartgazh.js} +11 -30
  175. package/dist/tooling/shared/{xjs6zqtc.js → rcywj2w8.js} +9 -9
  176. package/dist/tooling/shared/{dy672fz6.js → s6qha57m.js} +2 -2
  177. package/dist/tooling/shared/{vx86qjv8.js → shjs0379.js} +3 -3
  178. package/dist/tooling/shared/{345tbc2k.js → sjwkt1pg.js} +1 -1
  179. package/dist/tooling/shared/{rq5kk8j6.js → stebqyyd.js} +3 -3
  180. package/dist/tooling/shared/{yk9mp7vb.js → t4xveemq.js} +4 -4
  181. package/dist/tooling/shared/{djydjpqt.js → t6zjeake.js} +5 -5
  182. package/dist/tooling/shared/{zhwnfyb2.js → tcwpjvxe.js} +1 -1
  183. package/dist/tooling/shared/{72fyg4zv.js → tpssp7ac.js} +1 -1
  184. package/dist/tooling/shared/{jne7b93p.js → v6j1ep6w.js} +3 -3
  185. package/dist/tooling/shared/{ec71zqgt.js → vwr2y833.js} +2 -2
  186. package/dist/tooling/shared/{j9t5s12a.js → w17sj05d.js} +2 -2
  187. package/dist/tooling/shared/{3tq8pnb8.js → w5d89rb4.js} +1 -1
  188. package/dist/tooling/shared/{smn6kz1p.js → wbwq1jsa.js} +2 -2
  189. package/dist/tooling/shared/{pwsytxm5.js → wezxf3h8.js} +1 -1
  190. package/dist/tooling/shared/{5bvw2nev.js → yb4kd19s.js} +1 -1
  191. package/dist/tooling/shared/{gmcf9cxf.js → ybdew6j7.js} +2 -2
  192. package/dist/tooling/shared/{ep8zh3bk.js → yfedr1zb.js} +1 -1
  193. package/dist/tooling/shared/{ddjtfgnx.js → yhp829bx.js} +3 -3
  194. package/dist/tooling/shared/{yfr8hzhm.js → ytk1tjs0.js} +1 -1
  195. package/dist/tooling/shared/{03k6res6.js → zs9aymcp.js} +1 -1
  196. package/dist/tooling/shared/zx3v9phv.js +8 -0
  197. package/dist/tooling/testing/index.js +2 -2
  198. package/package.json +38 -9
  199. package/dist/shared/fjpnhqan.js +0 -71
  200. package/dist/shared/n41w4fbz.js +0 -113
  201. package/dist/tooling/shared/pw8fgahx.js +0 -69
  202. /package/dist/shared/{ae4j5f42.js → mfvx6kjx.js} +0 -0
@@ -1,29 +1,29 @@
1
1
  import {
2
2
  DriverError2,
3
3
  isConnectionFailure
4
- } from "./f9mphxej.js";
4
+ } from "./hfq3n3bd.js";
5
5
  import {
6
6
  send2,
7
7
  reserve2,
8
8
  park2
9
- } from "./xjs6zqtc.js";
9
+ } from "./rcywj2w8.js";
10
10
  import {
11
11
  resetSession2,
12
12
  refuseWhenLost2
13
- } from "./4d2w25vw.js";
13
+ } from "./7pxncnzs.js";
14
14
  import {
15
15
  cursorStream
16
16
  } from "./7kms6fvj.js";
17
17
  import {
18
18
  WireSession
19
- } from "./yw30vnq2.js";
19
+ } from "./jsjjz875.js";
20
20
  import {
21
21
  noTimeout
22
- } from "./rs1jb051.js";
22
+ } from "./3yn79q5m.js";
23
23
  import {
24
24
  rejectClosed,
25
25
  runCall
26
- } from "./xhrnjch9.js";
26
+ } from "./5x3pf400.js";
27
27
 
28
28
  // src/adapters/pg/bunsql-extra.ts
29
29
  async function recover(sql, error, text, depth, clientRead, closedDuring, again) {
@@ -122,7 +122,7 @@ async function checkout(held) {
122
122
  if (gone !== undefined)
123
123
  return gone;
124
124
  return guard(() => runCall(isClosed(), options, async (watch) => {
125
- const { runAtomicBatch } = await import("./3rrw5w8f.js");
125
+ const { runAtomicBatch } = await import("./gqwevek4.js");
126
126
  return runAtomicBatch(session, statements, watch);
127
127
  }));
128
128
  },
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  DriverError2,
3
3
  isConnectionLost
4
- } from "./f9mphxej.js";
4
+ } from "./hfq3n3bd.js";
5
5
  import {
6
6
  armDriverError2,
7
7
  send3,
8
8
  connectClient2
9
- } from "./417zdsk7.js";
9
+ } from "./asgr07mp.js";
10
10
  import {
11
11
  resetSession2
12
- } from "./4d2w25vw.js";
12
+ } from "./7pxncnzs.js";
13
13
  import {
14
14
  cursorStream
15
15
  } from "./7kms6fvj.js";
16
16
  import {
17
17
  WireSession
18
- } from "./yw30vnq2.js";
18
+ } from "./jsjjz875.js";
19
19
  import {
20
20
  rejectClosed,
21
21
  runCall
22
- } from "./xhrnjch9.js";
22
+ } from "./5x3pf400.js";
23
23
 
24
24
  // src/adapters/pg/nodepostgres-extra.ts
25
25
  async function checkout(held) {
@@ -62,7 +62,7 @@ async function checkout(held) {
62
62
  return {
63
63
  execute: (text, params, options) => guard(() => runCall(isClosed(), options, (watch) => session.query(text, params, watch))),
64
64
  batch: (statements, options) => guard(() => runCall(isClosed(), options, async (watch) => {
65
- const { runAtomicBatch } = await import("./3rrw5w8f.js");
65
+ const { runAtomicBatch } = await import("./gqwevek4.js");
66
66
  return runAtomicBatch(session, statements, watch);
67
67
  })),
68
68
  cancel() {
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  open5
3
- } from "./y5656f0e.js";
3
+ } from "./am04v8na.js";
4
4
  import {
5
5
  createClient
6
- } from "./mtrqn2hn.js";
6
+ } from "./jr2nmr81.js";
7
7
 
8
8
  // src/runtime/pg/neon.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, (config) => open5({
11
+ return import("./kbqnrs1x.js").then((mod) => mod.default(target, options, (config) => open5({
12
12
  url: config.url,
13
13
  ...options.mode !== undefined ? { mode: options.mode } : {},
14
14
  ...config.max !== undefined ? { max: config.max } : {},
@@ -2,7 +2,7 @@ import {
2
2
  resetSession2,
3
3
  resetQueried2,
4
4
  refuseWhenLost2
5
- } from "./7ghwamrf.js";
5
+ } from "./7pxncnzs.js";
6
6
  export {
7
7
  refuseWhenLost2 as refuseWhenLost,
8
8
  resetQueried2 as resetQueried,
@@ -6,7 +6,7 @@ import {
6
6
  acquireTimeout2,
7
7
  errorField2,
8
8
  mapDriverError2
9
- } from "./f9mphxej.js";
9
+ } from "./hfq3n3bd.js";
10
10
  export {
11
11
  DriverError2 as DriverError,
12
12
  acquireTimeout2 as acquireTimeout,
@@ -3,12 +3,12 @@ import {
3
3
  open4,
4
4
  send3,
5
5
  connectClient2
6
- } from "./417zdsk7.js";
6
+ } from "./asgr07mp.js";
7
7
  import {
8
8
  NODE_POSTGRES_CAPABILITIES,
9
9
  readCapability2,
10
10
  hasCapability2
11
- } from "./xhrnjch9.js";
11
+ } from "./5x3pf400.js";
12
12
  export {
13
13
  armDriverError2 as armDriverError,
14
14
  NODE_POSTGRES_CAPABILITIES as capabilities,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  outcomeUnknown2
3
- } from "./f9mphxej.js";
3
+ } from "./hfq3n3bd.js";
4
4
  import {
5
5
  noticeBuffer,
6
6
  WireSession
7
- } from "./yw30vnq2.js";
7
+ } from "./jsjjz875.js";
8
8
  import {
9
9
  noTimeout
10
- } from "./rs1jb051.js";
10
+ } from "./3yn79q5m.js";
11
11
  import {
12
12
  NEON_WEBSOCKET_CAPABILITIES,
13
13
  NEON_HTTP_CAPABILITIES,
@@ -17,7 +17,7 @@ import {
17
17
  runCall,
18
18
  EMPTY_NOTICES,
19
19
  resultFrom
20
- } from "./xhrnjch9.js";
20
+ } from "./5x3pf400.js";
21
21
 
22
22
  // src/adapters/pg/neon.ts
23
23
  import {
@@ -117,7 +117,7 @@ async function openWebSocket(config) {
117
117
  counters.busy = Math.max(0, counters.busy - 1);
118
118
  });
119
119
  const held = { pool, acquireMs, counters, notices, named, isClosed };
120
- const checkout = () => closed ? rejectClosed() : import("./gfvtj6d0.js").then((mod) => mod.checkout(held));
120
+ const checkout = () => closed ? rejectClosed() : import("./kz715295.js").then((mod) => mod.checkout(held));
121
121
  return {
122
122
  capabilities: NEON_WEBSOCKET_CAPABILITIES,
123
123
  execute(text, params, options) {
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  noticeBuffer,
3
3
  WireSession
4
- } from "./yw30vnq2.js";
4
+ } from "./jsjjz875.js";
5
5
  import {
6
6
  NODE_POSTGRES_CAPABILITIES,
7
7
  driverErrors,
8
8
  rejectClosed,
9
9
  mapFailure,
10
10
  runCall
11
- } from "./xhrnjch9.js";
11
+ } from "./5x3pf400.js";
12
12
 
13
13
  // src/adapters/pg/nodepostgres.ts
14
14
  import net from "node:net";
@@ -55,7 +55,7 @@ function open4(config) {
55
55
  counters.busy = Math.max(0, counters.busy - 1);
56
56
  }, inflight);
57
57
  const held = { pool, acquireMs, counters, notices, named, isClosed };
58
- const checkout = () => closed ? rejectClosed() : import("./tn8gay14.js").then((mod) => mod.checkout(held));
58
+ const checkout = () => closed ? rejectClosed() : import("./9qr9rkbh.js").then((mod) => mod.checkout(held));
59
59
  return {
60
60
  capabilities: NODE_POSTGRES_CAPABILITIES,
61
61
  execute(text, params, options) {
@@ -88,14 +88,14 @@ function open4(config) {
88
88
  reserve: () => checkout(),
89
89
  stream(text, params) {
90
90
  return async function* () {
91
- const { streamRows } = await import("./tn8gay14.js");
91
+ const { streamRows } = await import("./9qr9rkbh.js");
92
92
  yield* streamRows(checkout, text, params);
93
93
  }();
94
94
  },
95
95
  listen(channel, onNotify) {
96
96
  if (closed)
97
97
  return rejectClosed();
98
- return import("./tn8gay14.js").then((mod) => mod.listen(held, channel, onNotify));
98
+ return import("./9qr9rkbh.js").then((mod) => mod.listen(held, channel, onNotify));
99
99
  },
100
100
  cancel() {
101
101
  for (const pending of inflight)
@@ -2,11 +2,11 @@ import {
2
2
  readSelectFragment,
3
3
  emitSqlSelect,
4
4
  decodeSqlNumber
5
- } from "./gmcf9cxf.js";
6
- import"./3tq8pnb8.js";
5
+ } from "./ybdew6j7.js";
6
+ import"./w5d89rb4.js";
7
7
  import {
8
8
  refusePrototypeKey
9
- } from "./ppnnnvj8.js";
9
+ } from "./0j0jtse1.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 "./f9mphxej.js";
23
+ } from "./hfq3n3bd.js";
24
24
 
25
25
  // src/dialects/pg/ops/window.ts
26
26
  var RUNTIME = Symbol.for("okmodel.window");
@@ -0,0 +1,134 @@
1
+ import {
2
+ withHttp,
3
+ attachHttp,
4
+ mapOptions
5
+ } from "./jr2nmr81.js";
6
+ import {
7
+ OkmError,
8
+ POSTGRES_FLOOR,
9
+ isPostgresMajor,
10
+ parsePostgresFloor,
11
+ serverNeedsPostgres
12
+ } from "./hfq3n3bd.js";
13
+
14
+ // src/runtime/artifact-file.ts
15
+ function artifactDir(catalogDir) {
16
+ if (catalogDir !== undefined)
17
+ return catalogDir.replace(/[/\\]+$/, "");
18
+ const cwd = globalThis.process?.cwd?.() ?? ".";
19
+ return `${cwd}/.okm`;
20
+ }
21
+ async function readText(path) {
22
+ const bun = globalThis.Bun;
23
+ if (bun !== undefined) {
24
+ const file = bun.file(path);
25
+ if (!await file.exists())
26
+ return;
27
+ return file.text();
28
+ }
29
+ const loader = globalThis.process?.getBuiltinModule;
30
+ if (loader === undefined)
31
+ return;
32
+ try {
33
+ return await loader("node:fs/promises").readFile(path, "utf8");
34
+ } catch {
35
+ return;
36
+ }
37
+ }
38
+
39
+ // src/runtime/server-check.ts
40
+ var versionQuery = "select current_setting('server_version_num'), version(), (select (xpath('//catalog_hash/text()', query_to_xml('select catalog_hash from okm_meta where id = ''head''', true, false, '')))[1]::text where to_regclass('okm_meta') is not null)";
41
+ var historyQuery = "select migration_id, class, catalog_hash from okm_history order by migration_id, step_index";
42
+ async function versionSql(namespace) {
43
+ if (namespace === "public")
44
+ return versionQuery;
45
+ const relation = await qualified("okm_meta", namespace);
46
+ const literal = relation.replaceAll("'", "''");
47
+ return `select current_setting('server_version_num'), version(), (select (xpath('//catalog_hash/text()', query_to_xml('select catalog_hash from ${literal} where id = ''head''', true, false, '')))[1]::text where to_regclass('${literal}') is not null)`;
48
+ }
49
+ async function historySql2(namespace) {
50
+ if (namespace === "public")
51
+ return historyQuery;
52
+ return `select migration_id, class, catalog_hash from ${await qualified("okm_history", namespace)} order by migration_id, step_index`;
53
+ }
54
+ async function recordedNamespace(catalogDir) {
55
+ const text = await readText(`${artifactDir(catalogDir)}/namespace`);
56
+ if (text === undefined)
57
+ return "public";
58
+ const line = text.trim();
59
+ if (line === "" || line === "public")
60
+ return "public";
61
+ if (line.includes("\x00") || line.includes(`
62
+ `) || line.includes("\r")) {
63
+ throw new OkmError("OKM1122", "The catalog namespace file is not one identifier.", {
64
+ fix: { summary: "Run okm build so .okm/namespace is the schema from defineConfig." }
65
+ });
66
+ }
67
+ return line;
68
+ }
69
+ async function acceptServer2(pool, schema, http, requireMeta, options, source) {
70
+ const namespace = await recordedNamespace(source.catalogDir);
71
+ let rows;
72
+ try {
73
+ const result = await pool.execute(await versionSql(namespace), undefined, options);
74
+ rows = result.rows;
75
+ } catch (error) {
76
+ const { mapPostgresError } = await import("./yfedr1zb.js");
77
+ throw mapPostgresError(error, mapOptions(http, false, schema));
78
+ }
79
+ for (const name in schema.model) {
80
+ if (schema.model[name]?.presets !== undefined) {
81
+ (await import("./5bmksndh.js")).checkSchema(schema);
82
+ break;
83
+ }
84
+ }
85
+ const version = rows[0]?.[1];
86
+ if (version === null || version === undefined || !version.startsWith("PostgreSQL")) {
87
+ throw new OkmError("OKM1801", "The server is not PostgreSQL. The schema dialect is postgres.", withHttp(http, {
88
+ fix: { summary: "Open the schema with the Postgres driver that matches it." }
89
+ }));
90
+ }
91
+ const recorded = rows[0]?.[2];
92
+ if (recorded === null || recorded === undefined || recorded.length === 0) {
93
+ if (requireMeta) {
94
+ throw new OkmError("OKM1520", "okm_meta has no catalog hash.", withHttp(http, {
95
+ fix: {
96
+ summary: "Apply migrations so okm_meta records the catalog, or omit requireMeta to adopt this database."
97
+ }
98
+ }));
99
+ }
100
+ } else {
101
+ const { assertCompatible } = await import("./qartgazh.js");
102
+ try {
103
+ await assertCompatible(pool, schema, recorded, source, options, namespace);
104
+ } catch (error) {
105
+ if (error instanceof OkmError)
106
+ throw attachHttp(http, error);
107
+ throw error;
108
+ }
109
+ }
110
+ const major = Math.floor(Number(rows[0]?.[0] ?? "0") / 1e4);
111
+ const raw = schema.requires?.postgres;
112
+ if (raw === undefined) {
113
+ if (major < POSTGRES_FLOOR) {
114
+ throw new OkmError("OKM1803", serverNeedsPostgres(major, POSTGRES_FLOOR), withHttp(http, {
115
+ fix: {
116
+ summary: `Upgrade to PostgreSQL ${String(POSTGRES_FLOOR)} or higher.`
117
+ }
118
+ }));
119
+ }
120
+ return;
121
+ }
122
+ const need = parsePostgresFloor(raw);
123
+ if (!isPostgresMajor(need) || major < need) {
124
+ throw new OkmError("OKM1802", serverNeedsPostgres(major, isPostgresMajor(need) ? need : POSTGRES_FLOOR), withHttp(http, {
125
+ fix: { summary: "Upgrade the server, or lower minPostgres to a major the server meets." }
126
+ }));
127
+ }
128
+ }
129
+ async function qualified(table, namespace) {
130
+ const { quoteIdent } = await import("./zx3v9phv.js");
131
+ return `${quoteIdent(namespace)}.${table}`;
132
+ }
133
+
134
+ export { artifactDir, readText, historySql2, acceptServer2 };
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  stack2
3
- } from "./cmptmb4f.js";
3
+ } from "./35zemrmf.js";
4
4
  import {
5
5
  assertOperatorFits,
6
6
  textArray,
7
7
  arrayElementType
8
- } from "./3tq8pnb8.js";
8
+ } from "./w5d89rb4.js";
9
9
  import {
10
10
  runWrite
11
11
  } from "./n4jqhpqz.js";
@@ -34,7 +34,7 @@ import {
34
34
  orFail,
35
35
  registerFailFix,
36
36
  fail2
37
- } from "./f9mphxej.js";
37
+ } from "./hfq3n3bd.js";
38
38
 
39
39
  // src/runtime/predicate.ts
40
40
  function effectivePredicate(where) {
@@ -199,7 +199,7 @@ async function requireValidationImport(schema, op, tableName, options) {
199
199
  const source = stored.tables?.find((item) => item.name === tableName);
200
200
  if (source === undefined || !writeWouldValidate(stored.validation, source, options))
201
201
  return;
202
- const { refuseMissingValidation } = await import("./wt7j7nf6.js");
202
+ const { refuseMissingValidation } = await import("./fh07z1dt.js");
203
203
  refuseMissingValidation();
204
204
  }
205
205
  function validationRegistered(schema) {
@@ -269,7 +269,7 @@ async function planWrite(schema, generators, op, tableName, input, options, mods
269
269
  fail2("OKM1120", `Table ${tableName} is not in the schema.`);
270
270
  }
271
271
  if (mods.uses !== undefined && op !== "insert") {
272
- const { resolve } = await import("./ma2340rx.js");
272
+ const { resolve } = await import("./5bmksndh.js");
273
273
  mods = { ...mods, presets: resolve(schema, tableName, mods.uses).wheres };
274
274
  }
275
275
  const record = isRecord(options) ? options : {};
@@ -279,7 +279,7 @@ async function planWrite(schema, generators, op, tableName, input, options, mods
279
279
  }
280
280
  if (op === "update") {
281
281
  if (traitNamed(table, "versioned")) {
282
- const { planVersioned } = await import("./yk9mp7vb.js");
282
+ const { planVersioned } = await import("./t4xveemq.js");
283
283
  return withRowFilters(scope, mods.archive, () => {
284
284
  noteArchive(table, mods.archive);
285
285
  const planned = planVersioned(schema, table, input, record, mods);
@@ -325,12 +325,12 @@ async function planInsert(table, input, options, mods, generators, scope, tenanc
325
325
  keyColumns: undefined
326
326
  };
327
327
  }
328
- const conflictMod = options.onConflict === undefined || options.onConflict === "error" ? undefined : await import("./6nyfyw70.js");
328
+ const conflictMod = options.onConflict === undefined || options.onConflict === "error" ? undefined : await import("./f77nnfqy.js");
329
329
  const conflict = conflictMod?.readConflict(table, options.onConflict, allow, tenantKeyList(tenancy));
330
330
  if (conflict?.kind === "update" && traitNamed(table, "versioned")) {
331
331
  fail2("OKM1120", `onConflict update on ${table.model.name} does not check the version you read.`, "Read the row and update. ignore and return do not change the existing row.");
332
332
  }
333
- const sortMod = sorting ? await import("./w7qe8sj1.js") : undefined;
333
+ const sortMod = sorting ? await import("./3rmaz3pq.js") : undefined;
334
334
  const chunks = chunkRows(rows.map((row) => cellsFor(columns, row)));
335
335
  const statements = [];
336
336
  const quiet = [];
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  touchFields,
3
3
  fieldSealed
4
- } from "./spk1jg3r.js";
4
+ } from "./ezqn88nj.js";
5
5
  import {
6
6
  throwNamed,
7
7
  projectExpr,
@@ -10,7 +10,7 @@ import {
10
10
  isRecord,
11
11
  registerFailFix,
12
12
  fail2
13
- } from "./f9mphxej.js";
13
+ } from "./hfq3n3bd.js";
14
14
 
15
15
  // src/runtime/conflict.ts
16
16
  registerFailFix("OKM1104", "Set on to the columns of a unique constraint or the primary key.");
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  OkmError
3
- } from "./f9mphxej.js";
3
+ } from "./hfq3n3bd.js";
4
4
 
5
5
  // src/runtime/validate/closed.ts
6
6
  var VALIDATION_NOT_IMPORTED = "Validation is enabled but `okmodel/validate` was not imported.";
@@ -3,7 +3,7 @@ import {
3
3
  outcomeUnknown2,
4
4
  mapDriverError2,
5
5
  isConnectionLost
6
- } from "./f9mphxej.js";
6
+ } from "./hfq3n3bd.js";
7
7
 
8
8
  // src/adapters/pg/batch.ts
9
9
  var savepointIds = 0;