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
@@ -0,0 +1,20 @@
1
+ import {
2
+ OkmError2
3
+ } from "./52szzakm.js";
4
+
5
+ // src/runtime/param-limit.ts
6
+ var PG_PARAM_LIMIT = 65535;
7
+ function refuseParamLimit2(count) {
8
+ throw new OkmError2("OKM1126", `${String(count)} parameters (max ${String(PG_PARAM_LIMIT)}).`, {
9
+ kind: "invalid",
10
+ retryable: false,
11
+ fix: { summary: "Chunk the work, or use = any(array)." }
12
+ });
13
+ }
14
+ function assertParamCount2(count) {
15
+ if (count <= PG_PARAM_LIMIT)
16
+ return;
17
+ refuseParamLimit2(count);
18
+ }
19
+
20
+ export { refuseParamLimit2, assertParamCount2 };
@@ -0,0 +1,10 @@
1
+ import {
2
+ assertStableBackend
3
+ } from "./bdekbvmt.js";
4
+
5
+ // src/tooling/migrate/pooler-probe.ts
6
+ async function probeStableBackend(_url, readPid, allowPooler, options) {
7
+ await assertStableBackend(readPid, allowPooler, options);
8
+ }
9
+
10
+ export { probeStableBackend };
@@ -4,7 +4,7 @@ import {
4
4
  nextTransactionDepth,
5
5
  EMPTY_NOTICES,
6
6
  resultFrom
7
- } from "./ae4j5f42.js";
7
+ } from "./mfvx6kjx.js";
8
8
 
9
9
  // src/adapters/pg/session.ts
10
10
  function noticeBuffer() {
@@ -3,7 +3,7 @@ import {
3
3
  readHandle,
4
4
  readCall,
5
5
  attachHttp
6
- } from "./bah9nbg3.js";
6
+ } from "./xbvz446k.js";
7
7
  import {
8
8
  fail2
9
9
  } from "./kgwp4jdd.js";
@@ -0,0 +1,17 @@
1
+ import {
2
+ pullProject2,
3
+ pullLayout2,
4
+ commitPullFiles2
5
+ } from "./c7dqd3gk.js";
6
+ import"./mz48rs74.js";
7
+ import"./wp7y8q3y.js";
8
+ import"./bdekbvmt.js";
9
+ import"./n442h54c.js";
10
+ import"./fk9vef30.js";
11
+ import"./12z7aznj.js";
12
+ import"./jvxcp1qk.js";
13
+ export {
14
+ commitPullFiles2 as commitPullFiles,
15
+ pullLayout2 as pullLayout,
16
+ pullProject2 as pullProject
17
+ };
@@ -12,19 +12,19 @@ import {
12
12
  } from "./52szzakm.js";
13
13
 
14
14
  // src/dialects/pg/filters.ts
15
- function openFilters(table, relations, spec, hiddenFields) {
15
+ function openFilters(table, relations, spec, isHidden) {
16
16
  const allow = spec.allow ?? {};
17
17
  const sort = spec.sort ?? [];
18
18
  for (const field of Object.keys(allow))
19
- deny(hiddenFields, table, field);
19
+ deny(isHidden, table, field);
20
20
  for (const field of sort)
21
- deny(hiddenFields, table, field);
21
+ deny(isHidden, table, field);
22
22
  const nested = spec.relations;
23
23
  if (nested !== undefined) {
24
24
  for (const name of Object.keys(nested)) {
25
25
  const target = relationTable(relations, name);
26
26
  for (const field of nested[name] ?? [])
27
- deny(hiddenFields, target, field);
27
+ deny(isHidden, target, field);
28
28
  }
29
29
  }
30
30
  return {
@@ -33,8 +33,8 @@ function openFilters(table, relations, spec, hiddenFields) {
33
33
  }
34
34
  };
35
35
  }
36
- function deny(hiddenFields, table, field) {
37
- if (!hiddenFields.has(`${table}.${field}`))
36
+ function deny(isHidden, table, field) {
37
+ if (!isHidden(table, field))
38
38
  return;
39
39
  throw new OkmError2("OKM1123", `Field ${table}.${field} is hidden.`, {
40
40
  fix: {
@@ -87,7 +87,8 @@ function table2(name, columns, options) {
87
87
  name,
88
88
  columns,
89
89
  filters(spec) {
90
- return openFilters(name, options?.relations, spec, hiddenFields);
90
+ const ownHidden = hiddenColumnFields(columns);
91
+ return openFilters(name, options?.relations, spec, (tableName, field) => tableName === name ? ownHidden.has(field) : hiddenFields.has(`${tableName}.${field}`));
91
92
  },
92
93
  ...options !== undefined ? { options } : {},
93
94
  ...source !== undefined ? { source } : {}
@@ -190,11 +191,23 @@ function sqlValue(value) {
190
191
  definition("sql accepts a column, a string, a number, a boolean, or null.");
191
192
  }
192
193
  var hiddenFields = new Set;
193
- function remember(name, columns) {
194
+ function hiddenColumnFields(columns) {
195
+ const fields = new Set;
194
196
  for (const field of Object.keys(columns)) {
195
197
  const column = columns[field];
196
198
  if (column?.state?.hidden === true)
197
- hiddenFields.add(`${name}.${field}`);
199
+ fields.add(field);
200
+ }
201
+ return fields;
202
+ }
203
+ function remember(name, columns) {
204
+ const prefix = `${name}.`;
205
+ for (const key of hiddenFields) {
206
+ if (key.startsWith(prefix))
207
+ hiddenFields.delete(key);
208
+ }
209
+ for (const field of hiddenColumnFields(columns)) {
210
+ hiddenFields.add(`${name}.${field}`);
198
211
  }
199
212
  }
200
213
 
@@ -15,49 +15,49 @@ import {
15
15
  } from "./nfzc5z0w.js";
16
16
 
17
17
  // src/dialects/pg/ddl.ts
18
- function quoteIdent(name) {
18
+ function quoteIdent2(name) {
19
19
  return `"${name.replaceAll('"', '""')}"`;
20
20
  }
21
- function renderCatalog(source, schema) {
21
+ function renderCatalog2(source, schema) {
22
22
  const folded = foldedKeys(source);
23
23
  const statements = [];
24
24
  const ordered = creationOrder2(source);
25
- const created = uniqueBeforeForeignKey(ordered);
25
+ const created = uniqueBeforeForeignKey2(ordered);
26
26
  for (const object of ordered) {
27
27
  if (object.kind !== "type" || object.owner === "ignored")
28
28
  continue;
29
- const sql = createObjectSql(object, schema);
29
+ const sql = createObjectSql2(object, schema);
30
30
  if (sql !== undefined)
31
31
  statements.push(sql);
32
32
  }
33
33
  for (const object of created) {
34
- if (object.kind === "type" || object.kind === "function" || object.kind === "trigger" || object.kind === "view" || object.kind === "materializedView" || object.kind === "policy" || ownedByView(object)) {
34
+ if (object.kind === "type" || object.kind === "function" || object.kind === "trigger" || object.kind === "view" || object.kind === "materializedView" || object.kind === "policy" || ownedByView2(object)) {
35
35
  continue;
36
36
  }
37
37
  if (object.owner === "ignored")
38
38
  continue;
39
39
  const key = identityKey2(object.identity);
40
40
  if (object.kind === "table") {
41
- statements.push(createTableSql(object, source, schema));
41
+ statements.push(createTableSql2(object, source, schema));
42
42
  continue;
43
43
  }
44
44
  if (folded.has(key))
45
45
  continue;
46
- const sql = createObjectSql(object, schema);
46
+ const sql = createObjectSql2(object, schema);
47
47
  if (sql !== undefined)
48
48
  statements.push(sql);
49
49
  }
50
50
  for (const object of created) {
51
51
  if (object.kind !== "policy" || object.owner === "ignored")
52
52
  continue;
53
- for (const step of policyCreatePlan(object, schema))
53
+ for (const step of policyCreatePlan2(object, schema))
54
54
  statements.push(step.sql);
55
55
  }
56
56
  for (const kind of ["function", "trigger"]) {
57
57
  for (const object of ordered) {
58
58
  if (object.kind !== kind || object.owner === "ignored")
59
59
  continue;
60
- const sql = createObjectSql(object, schema);
60
+ const sql = createObjectSql2(object, schema);
61
61
  if (sql !== undefined)
62
62
  statements.push(sql);
63
63
  }
@@ -66,21 +66,21 @@ function renderCatalog(source, schema) {
66
66
  for (const object of ordered) {
67
67
  if (object.kind !== kind || object.owner === "ignored")
68
68
  continue;
69
- const sql = createObjectSql(object, schema);
69
+ const sql = createObjectSql2(object, schema);
70
70
  if (sql !== undefined)
71
71
  statements.push(sql);
72
72
  }
73
73
  }
74
74
  for (const object of ordered) {
75
- if (!ownedByView(object) || object.owner === "ignored")
75
+ if (!ownedByView2(object) || object.owner === "ignored")
76
76
  continue;
77
- const sql = createObjectSql(object, schema);
77
+ const sql = createObjectSql2(object, schema);
78
78
  if (sql !== undefined)
79
79
  statements.push(sql);
80
80
  }
81
81
  return statements;
82
82
  }
83
- function uniqueBeforeForeignKey(objects) {
83
+ function uniqueBeforeForeignKey2(objects) {
84
84
  const uniques = objects.filter((object) => object.kind === "constraint" && object.definition.constraintKind === "unique");
85
85
  if (uniques.length === 0)
86
86
  return objects;
@@ -122,49 +122,49 @@ function sameRef(left, right) {
122
122
  }
123
123
  return left.namespace.form === "template" && right.namespace.form === "template" ? left.namespace.pattern === right.namespace.pattern : false;
124
124
  }
125
- function ownedByView(object) {
125
+ function ownedByView2(object) {
126
126
  if (object.kind !== "index")
127
127
  return false;
128
128
  return object.dependencies.some((edge) => edge.target.kind === "view" || edge.target.kind === "materializedView");
129
129
  }
130
- function dropObjectSql(object, schema) {
130
+ function dropObjectSql2(object, schema) {
131
131
  if (object.owner === "ignored")
132
132
  return;
133
133
  switch (object.kind) {
134
134
  case "table":
135
- return `drop table ${qualify(schema, object.identity.name)}`;
135
+ return `drop table ${qualify2(schema, object.identity.name)}`;
136
136
  case "column":
137
- return `alter table ${qualify(schema, object.identity.parent.name)} drop column ${quoteIdent(object.identity.name)}`;
137
+ return `alter table ${qualify2(schema, object.identity.parent.name)} drop column ${quoteIdent2(object.identity.name)}`;
138
138
  case "index":
139
- return `drop index ${qualify(schema, object.identity.name)}`;
139
+ return `drop index ${qualify2(schema, object.identity.name)}`;
140
140
  case "constraint":
141
- return `alter table ${qualify(schema, object.identity.parent.name)} drop constraint ${quoteIdent(object.identity.name)}`;
141
+ return `alter table ${qualify2(schema, object.identity.parent.name)} drop constraint ${quoteIdent2(object.identity.name)}`;
142
142
  case "sequence":
143
- return `drop sequence ${qualify(schema, object.identity.name)}`;
143
+ return `drop sequence ${qualify2(schema, object.identity.name)}`;
144
144
  case "type":
145
- return `drop type ${qualify(schema, object.identity.name)}`;
145
+ return `drop type ${qualify2(schema, object.identity.name)}`;
146
146
  case "extension":
147
- return `drop extension ${quoteIdent(object.identity.name)}`;
147
+ return `drop extension ${quoteIdent2(object.identity.name)}`;
148
148
  case "function":
149
- return `drop function ${qualify(schema, object.identity.name)}(${object.identity.argTypes.join(", ")})`;
149
+ return `drop function ${qualify2(schema, object.identity.name)}(${object.identity.argTypes.join(", ")})`;
150
150
  case "trigger":
151
- return `drop trigger ${quoteIdent(object.identity.name)} on ${qualify(schema, object.identity.parent.name)}`;
151
+ return `drop trigger ${quoteIdent2(object.identity.name)} on ${qualify2(schema, object.identity.parent.name)}`;
152
152
  case "view":
153
- return `drop view ${qualify(schema, object.identity.name)}`;
153
+ return `drop view ${qualify2(schema, object.identity.name)}`;
154
154
  case "materializedView":
155
- return `drop materialized view ${qualify(schema, object.identity.name)}`;
155
+ return `drop materialized view ${qualify2(schema, object.identity.name)}`;
156
156
  default:
157
157
  return;
158
158
  }
159
159
  }
160
- function createObjectSql(object, schema) {
160
+ function createObjectSql2(object, schema) {
161
161
  switch (object.kind) {
162
162
  case "column":
163
- return `alter table ${qualify(schema, object.identity.parent.name)} add column ${columnSql(object)}`;
163
+ return `alter table ${qualify2(schema, object.identity.parent.name)} add column ${columnSql(object)}`;
164
164
  case "index":
165
165
  return createIndexSql(object, schema);
166
166
  case "constraint":
167
- return `alter table ${qualify(schema, object.identity.parent.name)} add constraint ${quoteIdent(object.identity.name)} ${constraintBody(object, schema)}`;
167
+ return `alter table ${qualify2(schema, object.identity.parent.name)} add constraint ${quoteIdent2(object.identity.name)} ${constraintBody(object, schema)}`;
168
168
  case "sequence":
169
169
  return createSequenceSql(object, schema);
170
170
  case "type":
@@ -172,11 +172,11 @@ function createObjectSql(object, schema) {
172
172
  case "extension":
173
173
  return createExtensionSql(object);
174
174
  case "function":
175
- return functionSql(object, schema, false);
175
+ return functionSql2(object, schema, false);
176
176
  case "trigger":
177
177
  return triggerSql(object, schema);
178
178
  case "view":
179
- return viewSql(object, schema, false);
179
+ return viewSql2(object, schema, false);
180
180
  case "materializedView":
181
181
  return materializedViewSql(object, schema);
182
182
  case "table":
@@ -185,10 +185,10 @@ function createObjectSql(object, schema) {
185
185
  return;
186
186
  }
187
187
  }
188
- function functionSql(object, schema, replace) {
188
+ function functionSql2(object, schema, replace) {
189
189
  const definition = object.definition;
190
- const args = definition.arguments.map((argument) => `${quoteIdent(argument.name)} ${argument.type}`).join(", ");
191
- const head = `${replace ? "create or replace" : "create"} function ${qualify(schema, object.identity.name)}(${args})`;
190
+ const args = definition.arguments.map((argument) => `${quoteIdent2(argument.name)} ${argument.type}`).join(", ");
191
+ const head = `${replace ? "create or replace" : "create"} function ${qualify2(schema, object.identity.name)}(${args})`;
192
192
  const security = ` security ${definition.security}`;
193
193
  const path = definition.searchPath === undefined ? "" : ` set search_path to ${definition.searchPath}`;
194
194
  const tail = `returns ${definition.returns} language ${definition.language} ${definition.volatility}${security}${path}`;
@@ -196,14 +196,14 @@ function functionSql(object, schema, replace) {
196
196
  return `${head} ${tail} ${definition.body}`;
197
197
  return `${head} ${tail} as ${dollarQuote(definition.body)}`;
198
198
  }
199
- function viewSql(object, schema, replace) {
199
+ function viewSql2(object, schema, replace) {
200
200
  const verb = replace ? "create or replace view" : "create view";
201
201
  const invoker = object.definition.securityInvoker === true ? " with (security_invoker = true)" : "";
202
- return `${verb} ${qualify(schema, object.identity.name)}${invoker} as ${object.definition.query}`;
202
+ return `${verb} ${qualify2(schema, object.identity.name)}${invoker} as ${object.definition.query}`;
203
203
  }
204
- function policyCreatePlan(object, schema) {
205
- const table = qualify(schema, object.identity.parent.name);
206
- const name = quoteIdent(object.identity.name);
204
+ function policyCreatePlan2(object, schema) {
205
+ const table = qualify2(schema, object.identity.parent.name);
206
+ const name = quoteIdent2(object.identity.name);
207
207
  const command = object.definition.command === "all" ? "all" : "select";
208
208
  const check = object.definition.command === "all" ? ` with check ${object.definition.expression}` : "";
209
209
  const create = {
@@ -218,10 +218,10 @@ function policyCreatePlan(object, schema) {
218
218
  create
219
219
  ];
220
220
  }
221
- function policyDropPlan(object, schema) {
222
- const table = qualify(schema, object.identity.parent.name);
221
+ function policyDropPlan2(object, schema) {
222
+ const table = qualify2(schema, object.identity.parent.name);
223
223
  const drop = {
224
- sql: `drop policy ${quoteIdent(object.identity.name)} on ${table}`,
224
+ sql: `drop policy ${quoteIdent2(object.identity.name)} on ${table}`,
225
225
  kind: "drop-policy"
226
226
  };
227
227
  if (object.definition.command !== "all")
@@ -233,11 +233,11 @@ function policyDropPlan(object, schema) {
233
233
  ];
234
234
  }
235
235
  function materializedViewSql(object, schema) {
236
- return `create materialized view ${qualify(schema, object.identity.name)} as ${object.definition.query} with no data`;
236
+ return `create materialized view ${qualify2(schema, object.identity.name)} as ${object.definition.query} with no data`;
237
237
  }
238
- function refreshMaterializedViewSql(object, schema, populated = false) {
238
+ function refreshMaterializedViewSql2(object, schema, populated = false) {
239
239
  const concurrently = populated && object.definition.refresh === "concurrently" ? " concurrently" : "";
240
- return `refresh materialized view${concurrently} ${qualify(schema, object.identity.name)}`;
240
+ return `refresh materialized view${concurrently} ${qualify2(schema, object.identity.name)}`;
241
241
  }
242
242
  function triggerSql(object, schema) {
243
243
  const definition = object.definition;
@@ -245,12 +245,12 @@ function triggerSql(object, schema) {
245
245
  const events = definition.events.map((event) => {
246
246
  if (event !== "update" || definition.updateOf === undefined)
247
247
  return event;
248
- return `update of ${definition.updateOf.map((column) => quoteIdent(column)).join(", ")}`;
248
+ return `update of ${definition.updateOf.map((column) => quoteIdent2(column)).join(", ")}`;
249
249
  }).join(" or ");
250
250
  const when = definition.when === undefined ? "" : ` when (${definition.when})`;
251
251
  const args = definition.calls.argTypes.join(", ");
252
- const fn = `${qualify(schema, definition.calls.name)}(${args})`;
253
- return `create trigger ${quoteIdent(object.identity.name)} ${timing} ${events} on ${qualify(schema, object.identity.parent.name)} for each ${definition.level}${when} execute function ${fn}`;
252
+ const fn = `${qualify2(schema, definition.calls.name)}(${args})`;
253
+ return `create trigger ${quoteIdent2(object.identity.name)} ${timing} ${events} on ${qualify2(schema, object.identity.parent.name)} for each ${definition.level}${when} execute function ${fn}`;
254
254
  }
255
255
  function dollarQuote(body) {
256
256
  let tag = "okm";
@@ -258,10 +258,10 @@ function dollarQuote(body) {
258
258
  tag = `${tag}_`;
259
259
  return `$${tag}$${body}$${tag}$`;
260
260
  }
261
- function alterColumnSql(before, after, schema) {
261
+ function alterColumnSql2(before, after, schema) {
262
262
  const statements = [];
263
- const table = qualify(schema, after.identity.parent.name);
264
- const name = quoteIdent(after.identity.name);
263
+ const table = qualify2(schema, after.identity.parent.name);
264
+ const name = quoteIdent2(after.identity.name);
265
265
  const typeChanged = before.definition.dataType !== after.definition.dataType;
266
266
  const collationChanged = before.definition.collation !== after.definition.collation;
267
267
  if (typeChanged || collationChanged) {
@@ -276,7 +276,7 @@ function alterColumnSql(before, after, schema) {
276
276
  }
277
277
  return statements;
278
278
  }
279
- function identitySequence(sequence, source) {
279
+ function identitySequence2(sequence, source) {
280
280
  const key = identityKey2(sequence.identity);
281
281
  return source.objects.some((object) => {
282
282
  if (object.kind !== "column" || object.definition.identity === undefined)
@@ -292,24 +292,24 @@ function foldedKeys(source) {
292
292
  if (object.kind === "constraint" && object.definition.constraintKind === "primaryKey") {
293
293
  keys.add(identityKey2(object.identity));
294
294
  }
295
- if (object.kind === "sequence" && identitySequence(object, source)) {
295
+ if (object.kind === "sequence" && identitySequence2(object, source)) {
296
296
  keys.add(identityKey2(object.identity));
297
297
  }
298
298
  }
299
299
  return keys;
300
300
  }
301
- function createTableSql(tableObject, source, schema) {
301
+ function createTableSql2(tableObject, source, schema) {
302
302
  const parent = tableObject.identity.name;
303
303
  const columns = source.objects.filter((object) => object.kind === "column" && object.identity.parent.name === parent);
304
304
  const primary = source.objects.find((object) => object.kind === "constraint" && object.definition.constraintKind === "primaryKey" && object.identity.parent.name === parent);
305
305
  const lines = columns.map((column) => columnSql(column));
306
306
  if (primary !== undefined) {
307
- const cols = primary.definition.columns.map((name) => quoteIdent(name)).join(", ");
308
- lines.push(`constraint ${quoteIdent(primary.identity.name)} primary key (${cols})`);
307
+ const cols = primary.definition.columns.map((name) => quoteIdent2(name)).join(", ");
308
+ lines.push(`constraint ${quoteIdent2(primary.identity.name)} primary key (${cols})`);
309
309
  }
310
310
  const partition = tableObject.definition.partition;
311
- const tail = partition === undefined ? "" : ` partition by ${partition.method} (${partition.columns.map((name) => quoteIdent(name)).join(", ")})`;
312
- return `create table ${qualify(schema, parent)} (
311
+ const tail = partition === undefined ? "" : ` partition by ${partition.method} (${partition.columns.map((name) => quoteIdent2(name)).join(", ")})`;
312
+ return `create table ${qualify2(schema, parent)} (
313
313
  ${lines.join(`,
314
314
  `)}
315
315
  )${tail}`;
@@ -317,20 +317,20 @@ function createTableSql(tableObject, source, schema) {
317
317
  function collateSql(collation) {
318
318
  if (collation === undefined)
319
319
  return "";
320
- return ` collate ${quoteIdent(collation)}`;
320
+ return ` collate ${quoteIdent2(collation)}`;
321
321
  }
322
322
  function createTypeSql(object, schema) {
323
323
  if (isDomain(object.definition)) {
324
324
  const name = object.identity.name;
325
- const constraint = quoteIdent(fitIdentifier2(`${name}_check`));
326
- return `create domain ${qualify(schema, name)} as ${object.definition.base} constraint ${constraint} check (${object.definition.check})`;
325
+ const constraint = quoteIdent2(fitIdentifier2(`${name}_check`));
326
+ return `create domain ${qualify2(schema, name)} as ${object.definition.base} constraint ${constraint} check (${object.definition.check})`;
327
327
  }
328
328
  const labels = object.definition.labels.map((label) => quoteLiteral(label)).join(", ");
329
- return `create type ${qualify(schema, object.identity.name)} as enum (${labels})`;
329
+ return `create type ${qualify2(schema, object.identity.name)} as enum (${labels})`;
330
330
  }
331
331
  function columnSql(column) {
332
332
  const definition = column.definition;
333
- let sql = `${quoteIdent(column.identity.name)} ${definition.dataType}${collateSql(definition.collation)}`;
333
+ let sql = `${quoteIdent2(column.identity.name)} ${definition.dataType}${collateSql(definition.collation)}`;
334
334
  if (definition.identity !== undefined) {
335
335
  sql += definition.identity.always ? " generated always as identity" : " generated by default as identity";
336
336
  } else if (definition.generated !== undefined) {
@@ -346,27 +346,38 @@ function createIndexSql(object, schema) {
346
346
  const unique = object.definition.unique ? "unique " : "";
347
347
  const where = object.definition.predicate === undefined ? "" : ` where ${object.definition.predicate}`;
348
348
  const expression = object.definition.expression;
349
- const name = quoteIdent(object.identity.name);
350
- const on = qualify(schema, object.identity.parent.name);
349
+ const name = quoteIdent2(object.identity.name);
350
+ const on = qualify2(schema, object.identity.parent.name);
351
351
  if (expression !== undefined && expression.startsWith("using ")) {
352
352
  return `create ${unique}index ${name} on ${on} ${expression}${where}`;
353
353
  }
354
- const target = expression !== undefined ? `(${expression})` : object.definition.columns.map((column) => quoteIdent(column)).join(", ");
354
+ const target = expression !== undefined ? `(${expression})` : object.definition.columns.map((column) => quoteIdent2(column)).join(", ");
355
355
  return `create ${unique}index ${name} on ${on} (${target})${where}`;
356
356
  }
357
357
  function createExtensionSql(object) {
358
358
  const version = object.definition.version;
359
359
  const pinned = version !== undefined && /^\d+(?:\.\d+)*$/.test(version) ? ` version ${quoteLiteral(version)}` : "";
360
- return `create extension ${quoteIdent(object.identity.name)} schema ${quoteIdent(object.definition.schema)}${pinned}`;
360
+ return `create extension ${quoteIdent2(object.identity.name)} schema ${quoteIdent2(object.definition.schema)}${pinned}`;
361
361
  }
362
362
  function createSequenceSql(object, schema) {
363
363
  const definition = object.definition;
364
364
  const cycle = definition.cycle ? " cycle" : "";
365
- return `create sequence ${qualify(schema, object.identity.name)} as ${definition.dataType} start ${definition.start} increment ${definition.increment}${cycle}`;
365
+ return `create sequence ${qualify2(schema, object.identity.name)} as ${definition.dataType} start ${definition.start} increment ${definition.increment}${cycle}`;
366
+ }
367
+ function referenceSchema(object, schema) {
368
+ const references = object.definition.references;
369
+ if (references === undefined)
370
+ return schema;
371
+ const target = references.parent.namespace;
372
+ const parent = object.identity.parent.namespace;
373
+ if (target.form === "static" && parent.form === "static" && target.name !== parent.name) {
374
+ return target.name;
375
+ }
376
+ return schema;
366
377
  }
367
378
  function constraintBody(object, schema) {
368
379
  const definition = object.definition;
369
- const columns = definition.columns.map((name) => quoteIdent(name)).join(", ");
380
+ const columns = definition.columns.map((name) => quoteIdent2(name)).join(", ");
370
381
  switch (definition.constraintKind) {
371
382
  case "primaryKey":
372
383
  return `primary key (${columns})`;
@@ -378,7 +389,7 @@ function constraintBody(object, schema) {
378
389
  return `check (${definition.expression ?? "true"})${deferClause(definition)}`;
379
390
  case "foreignKey": {
380
391
  const references = definition.references;
381
- const target = references === undefined ? "" : ` references ${qualify(schema, references.parent.name)} (${references.columns.map((name) => quoteIdent(name)).join(", ")})`;
392
+ const target = references === undefined ? "" : ` references ${qualify2(referenceSchema(object, schema), references.parent.name)} (${references.columns.map((name) => quoteIdent2(name)).join(", ")})`;
382
393
  const onDelete = references?.onDelete === undefined ? "" : ` on delete ${references.onDelete}`;
383
394
  const onUpdate = references?.onUpdate === undefined ? "" : ` on update ${references.onUpdate}`;
384
395
  return `foreign key (${columns})${target}${onDelete}${onUpdate}${deferClause(definition)}`;
@@ -392,8 +403,8 @@ function deferClause(definition) {
392
403
  return "";
393
404
  return ` deferrable initially ${definition.initially}`;
394
405
  }
395
- function qualify(schema, name) {
396
- return `${quoteIdent(schema)}.${quoteIdent(name)}`;
406
+ function qualify2(schema, name) {
407
+ return `${quoteIdent2(schema)}.${quoteIdent2(name)}`;
397
408
  }
398
409
 
399
- export { quoteIdent, renderCatalog, uniqueBeforeForeignKey, ownedByView, dropObjectSql, createObjectSql, functionSql, viewSql, policyCreatePlan, policyDropPlan, refreshMaterializedViewSql, alterColumnSql, identitySequence, createTableSql, qualify };
410
+ export { quoteIdent2, renderCatalog2, uniqueBeforeForeignKey2, ownedByView2, dropObjectSql2, createObjectSql2, functionSql2, viewSql2, policyCreatePlan2, policyDropPlan2, refreshMaterializedViewSql2, alterColumnSql2, identitySequence2, createTableSql2, qualify2 };
@@ -0,0 +1,8 @@
1
+ import {
2
+ refuseParamLimit2,
3
+ assertParamCount2
4
+ } from "./ddh72ym5.js";
5
+ export {
6
+ assertParamCount2 as assertParamCount,
7
+ refuseParamLimit2 as refuseParamLimit
8
+ };
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  withHttp,
9
9
  settleCall
10
- } from "./bah9nbg3.js";
10
+ } from "./xbvz446k.js";
11
11
  import {
12
12
  rejectKeys,
13
13
  isRecord,
@@ -47,6 +47,9 @@ async function batch(session, ops, options, replica) {
47
47
  if (item.checked === "parent") {
48
48
  throw new OkmError2("OKM1705", "batch does not take an update that sets a path column. The parent is checked in the statement, and a batch cannot report that after it commits. Use update({ where, set }) inside tx().", { fix: { summary: "Use update({ where, set }) inside tx()." } });
49
49
  }
50
+ if (item.checked === "tree") {
51
+ fail2("OKM1121", "batch does not take an update that sets a tree parent. The cycle is checked in the statement, and a batch cannot report that after it commits. Use update({ where, set }) inside tx().");
52
+ }
50
53
  if (item.checked !== undefined) {
51
54
  fail2("OKM1121", item.checked === "restore" ? "batch does not take restore: it is refused while its parent is archived, and a batch cannot report that after it commits. Use tx()." : "batch does not take a write with expect: the count is checked after the statement ran, and a batch cannot report that after it commits. Use tx().");
52
55
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mapFailure
3
- } from "./ae4j5f42.js";
3
+ } from "./mfvx6kjx.js";
4
4
 
5
5
  // src/adapters/pg/pglite-wire.ts
6
6
  var OIDS = [
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  open3,
3
3
  seal2
4
- } from "./4m6hskg8.js";
4
+ } from "./0j6qe91y.js";
5
5
  import {
6
6
  PGLITE_CAPABILITIES,
7
7
  readCapability2,
8
8
  hasCapability2
9
- } from "./ae4j5f42.js";
9
+ } from "./mfvx6kjx.js";
10
10
  export {
11
11
  PGLITE_CAPABILITIES as capabilities,
12
12
  hasCapability2 as hasCapability,
@@ -3,7 +3,7 @@ import {
3
3
  readHandle,
4
4
  readCall,
5
5
  attachHttp
6
- } from "./bah9nbg3.js";
6
+ } from "./xbvz446k.js";
7
7
  import {
8
8
  selectedColumns,
9
9
  parseOrder,
@@ -1,3 +1,6 @@
1
+ import {
2
+ historySql2
3
+ } from "./k73e8n9d.js";
1
4
  import {
2
5
  BEHIND_EXPAND,
3
6
  BEHIND_CONTRACT,
@@ -37,10 +40,10 @@ function driftVerdict(codeHash, recordedHash, migrations) {
37
40
  const last = migrations.at(-1);
38
41
  return { state: "behind", migrationId: last?.id ?? "" };
39
42
  }
40
- async function assertDrift(pool, codeHash, recordedHash, options) {
43
+ async function assertDrift(pool, codeHash, recordedHash, options, namespace = "public") {
41
44
  let rows;
42
45
  try {
43
- const result = await pool.execute("select migration_id, class, catalog_hash from okm_history order by migration_id, step_index", undefined, options);
46
+ const result = await pool.execute(await historySql2(namespace), undefined, options);
44
47
  rows = result.rows;
45
48
  } catch (error) {
46
49
  throw gapError({ state: "behind", migrationId: "" }, error);
@@ -0,0 +1,17 @@
1
+ // src/dialects/pg/ext/using.ts
2
+ function quotedIdent(name) {
3
+ return `"${name.replaceAll('"', '""')}"`;
4
+ }
5
+ function usingIndex(column, method, opclass) {
6
+ const call = {
7
+ columns: [column],
8
+ isUnique: false,
9
+ expression: `using ${method} (${quotedIdent(column)} ${opclass})`,
10
+ unique() {
11
+ return call;
12
+ }
13
+ };
14
+ return call;
15
+ }
16
+
17
+ export { quotedIdent, usingIndex };
@@ -7,8 +7,8 @@ import {
7
7
  holdCheckout2,
8
8
  holdListener2,
9
9
  watchQuery2
10
- } from "./wcrheftc.js";
11
- import"./35q0n9tz.js";
10
+ } from "./3dr444ny.js";
11
+ import"./jvxcp1qk.js";
12
12
  import"./cm3w0ywp.js";
13
13
  export {
14
14
  checkout2 as checkout,