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,29 @@
1
+ import {
2
+ extension2
3
+ } from "../../../shared/6f0z3hzh.js";
4
+ import {
5
+ opArg
6
+ } from "../../../shared/zecrwdk9.js";
7
+ import {
8
+ usingIndex
9
+ } from "../../../shared/h9811jjm.js";
10
+
11
+ // src/dialects/pg/ext/ltree.ts
12
+ function ltree(options = {}) {
13
+ const declared = extension2("ltree", options);
14
+ return {
15
+ ...declared,
16
+ ancestorOf(value) {
17
+ return opArg("@>", value, "ltree");
18
+ },
19
+ descendantOf(value) {
20
+ return opArg("<@", value, "ltree");
21
+ },
22
+ gist(column) {
23
+ return usingIndex(column, "gist", "gist_ltree_ops");
24
+ }
25
+ };
26
+ }
27
+ export {
28
+ ltree
29
+ };
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  extension2
3
- } from "../../../shared/jgqj11w4.js";
3
+ } from "../../../shared/6f0z3hzh.js";
4
+ import {
5
+ usingIndex
6
+ } from "../../../shared/h9811jjm.js";
4
7
  import {
5
8
  tag
6
9
  } from "../../../shared/cn0n68ft.js";
@@ -25,18 +28,6 @@ function pgTrgm(options = {}) {
25
28
  }
26
29
  };
27
30
  }
28
- function usingIndex(column, method, opclass) {
29
- const quoted = `"${column.replaceAll('"', '""')}"`;
30
- const call = {
31
- columns: [column],
32
- isUnique: false,
33
- expression: `using ${method} (${quoted} ${opclass})`,
34
- unique() {
35
- return call;
36
- }
37
- };
38
- return call;
39
- }
40
31
  export {
41
32
  pgTrgm
42
33
  };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The `pgcrypto` extension. `digest` compares a hex digest. `fipsMode` needs version 1.4 and PostgreSQL 18.
3
+ *
4
+ * Generated by scripts/ext-generate.ts. Do not edit.
5
+ * `minPostgres` for the base methods is 15. A feature
6
+ * a declared version lacks fails with OKM1812.
7
+ */
8
+ import type { Fragment } from "../ops/fragment.js";
9
+ import { type Extension, type ExtensionOptions } from "./index.js";
10
+ /** `pgcrypto` plus the methods the naming overlay selected. */
11
+ export type Pgcrypto = Extension & {
12
+ /**
13
+ * `encode(digest(column, algorithm), 'hex') = hex`.
14
+ *
15
+ * @param algorithm - Digest algorithm, such as `sha256`
16
+ * @param hex - Expected hex digest
17
+ * @returns A where fragment
18
+ */
19
+ digest(algorithm: string, hex: string): Fragment;
20
+ /**
21
+ * `fips_mode()` is true or false on the column's row. Needs pgcrypto 1.4 and PostgreSQL 18.
22
+ *
23
+ * @returns A where fragment
24
+ */
25
+ fipsMode(): Fragment;
26
+ };
27
+ /**
28
+ * Declares `pgcrypto`.
29
+ *
30
+ * @param options - Schema and version pin
31
+ * @returns The extension object and its methods
32
+ */
33
+ export declare function pgcrypto(options?: ExtensionOptions): Pgcrypto;
@@ -0,0 +1,33 @@
1
+ import {
2
+ extension2
3
+ } from "../../../shared/6f0z3hzh.js";
4
+ import {
5
+ assertExtFeature
6
+ } from "../../../shared/kzgrnckd.js";
7
+ import {
8
+ bareCall,
9
+ digestEquals
10
+ } from "../../../shared/zecrwdk9.js";
11
+
12
+ // src/dialects/pg/ext/pgcrypto.ts
13
+ function pgcrypto(options = {}) {
14
+ const declared = extension2("pgcrypto", options);
15
+ const schema = declared.schema;
16
+ return {
17
+ ...declared,
18
+ digest(algorithm, hex) {
19
+ return digestEquals(schema, algorithm, hex);
20
+ },
21
+ fipsMode() {
22
+ assertExtFeature(options.version, "fips_mode", {
23
+ name: "pgcrypto",
24
+ extension: "1.4",
25
+ postgres: 18
26
+ });
27
+ return bareCall(schema, "fips_mode");
28
+ }
29
+ };
30
+ }
31
+ export {
32
+ pgcrypto
33
+ };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The `unaccent` extension. `unaccent` folds accents on a text column.
3
+ *
4
+ * Generated by scripts/ext-generate.ts. Do not edit.
5
+ * `minPostgres` for the base methods is 15. A feature
6
+ * a declared version lacks fails with OKM1812.
7
+ */
8
+ import type { Fragment } from "../ops/fragment.js";
9
+ import { type Extension, type ExtensionOptions } from "./index.js";
10
+ /** `unaccent` plus the methods the naming overlay selected. */
11
+ export type Unaccent = Extension & {
12
+ /**
13
+ * `unaccent(column) = unaccent(value)`.
14
+ *
15
+ * @param value - Text to compare
16
+ * @returns A where fragment
17
+ */
18
+ unaccent(value: string): Fragment;
19
+ };
20
+ /**
21
+ * Declares `unaccent`.
22
+ *
23
+ * @param options - Schema and version pin
24
+ * @returns The extension object and its methods
25
+ */
26
+ export declare function unaccent(options?: ExtensionOptions): Unaccent;
@@ -0,0 +1,21 @@
1
+ import {
2
+ extension2
3
+ } from "../../../shared/6f0z3hzh.js";
4
+ import {
5
+ fnEqualsArg
6
+ } from "../../../shared/zecrwdk9.js";
7
+
8
+ // src/dialects/pg/ext/unaccent.ts
9
+ function unaccent(options = {}) {
10
+ const declared = extension2("unaccent", options);
11
+ const schema = declared.schema;
12
+ return {
13
+ ...declared,
14
+ unaccent(value) {
15
+ return fnEqualsArg(schema, "unaccent", value);
16
+ }
17
+ };
18
+ }
19
+ export {
20
+ unaccent
21
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Index tails for extension operator classes.
3
+ *
4
+ * The catalog index stores `using …`. The core index factory does not grow a
5
+ * `using` field. `pg_trgm` and the generated packs share this helper.
6
+ */
7
+ import type { IndexCall } from "../table.js";
8
+ /**
9
+ * Quotes one identifier the extension wrote, not a caller string from SQL.
10
+ *
11
+ * @param name - Identifier
12
+ * @returns A double-quoted identifier
13
+ */
14
+ export declare function quotedIdent(name: string): string;
15
+ /**
16
+ * An index call whose expression is a `using` tail.
17
+ *
18
+ * @param column - SQL column name
19
+ * @param method - Index method, such as `gin` or `gist`
20
+ * @param opclass - Operator class, such as `gin_trgm_ops`
21
+ * @returns The index call
22
+ */
23
+ export declare function usingIndex(column: string, method: string, opclass: string): IndexCall;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Default versions and drift signatures for the generated packs.
3
+ *
4
+ * Generated by scripts/ext-generate.ts. Do not edit.
5
+ * Versions are the control-file default on each supported major.
6
+ */
7
+ /** One object the drift check requires on the connected server. */
8
+ export type ExtSignature = {
9
+ readonly kind: "function";
10
+ readonly name: string;
11
+ readonly args: string;
12
+ } | {
13
+ readonly kind: "operator";
14
+ readonly name: string;
15
+ readonly left: string;
16
+ readonly right: string;
17
+ } | {
18
+ readonly kind: "opclass";
19
+ readonly name: string;
20
+ readonly method: string;
21
+ };
22
+ /** One generated pack's versions and the objects the drift check names. */
23
+ export type ExtPackRecord = {
24
+ readonly name: string;
25
+ readonly versions: {
26
+ readonly 15: string;
27
+ readonly 16: string;
28
+ readonly 17: string;
29
+ readonly 18: string;
30
+ };
31
+ /** Oldest major the base methods exist on. */
32
+ readonly minPostgres: 15;
33
+ readonly signatures: readonly ExtSignature[];
34
+ };
35
+ /** Packs this version generates. `vector` is not in the list (D281). */
36
+ export declare const EXT_PACKS: readonly ExtPackRecord[];
@@ -0,0 +1,19 @@
1
+ /**
2
+ * A table owned by another catalog.
3
+ *
4
+ * The mark is the same one `withOwner(..., "external")` stores. `schema()`
5
+ * does not read it. Tooling stamps the catalog and, when `defineConfig`
6
+ * names a snapshot, keeps this table's namespace and name from that file.
7
+ */
8
+ import type { AnyTable } from "./table.js";
9
+ /**
10
+ * Turns a table exported by another catalog into an external definition.
11
+ *
12
+ * The table object is the same value: its name and columns stay. SQL for a
13
+ * managed foreign key is schema-qualified. A plan never creates, alters, or
14
+ * drops this table. `okm check` verifies it against the snapshot.
15
+ *
16
+ * @param table - A `table()` value declared by the owning catalog
17
+ * @returns The same table, marked external
18
+ */
19
+ export declare function external<T extends AnyTable>(table: T): T;
@@ -11,9 +11,9 @@ import type { FilterSpec, ParsedFilters } from "./table.js";
11
11
  * @param table - Table the filters belong to
12
12
  * @param relations - Relation calls stored on the table, when it has any
13
13
  * @param spec - Allow, sort, and relation fields
14
- * @param hiddenFields - `table.field` keys recorded while tables were defined
14
+ * @param isHidden - Whether `table.field` is hidden (own columns or related names)
15
15
  * @returns A parser for one request object
16
16
  */
17
- export declare function openFilters(table: string, relations: unknown, spec: FilterSpec, hiddenFields: ReadonlySet<string>): {
17
+ export declare function openFilters(table: string, relations: unknown, spec: FilterSpec, isHidden: (table: string, field: string) => boolean): {
18
18
  parse(query: unknown): Promise<ParsedFilters>;
19
19
  };
@@ -2,14 +2,14 @@ import {
2
2
  functionObject,
3
3
  triggerObject
4
4
  } from "../../../shared/12z7aznj.js";
5
+ import {
6
+ quoteIdent2
7
+ } from "../../../shared/fk9vef30.js";
5
8
  import {
6
9
  isFragmentParts,
7
10
  sqlExpression,
8
11
  identName
9
- } from "../../../shared/bsek72fg.js";
10
- import {
11
- quoteIdent
12
- } from "../../../shared/sjk86yrx.js";
12
+ } from "../../../shared/s5qe47a6.js";
13
13
  import {
14
14
  staticNamespace2
15
15
  } from "../../../shared/358zsv4r.js";
@@ -103,7 +103,7 @@ function invoke(schemaName, name, declared, returns, args) {
103
103
  if (args.length !== declared.length) {
104
104
  throw new OkmError2("OKM1120", `Function ${name} expects ${String(declared.length)} arguments.`, { fix: { summary: "Pass one value for each declared argument, in order." } });
105
105
  }
106
- const parts = [{ k: "t", s: `${quoteIdent(schemaName)}.${quoteIdent(name)}(` }];
106
+ const parts = [{ k: "t", s: `${quoteIdent2(schemaName)}.${quoteIdent2(name)}(` }];
107
107
  for (let index = 0;index < args.length; index += 1) {
108
108
  if (index > 0)
109
109
  parts.push({ k: "t", s: ", " });
@@ -7,6 +7,7 @@
7
7
  export { type PostgresMajor } from "./floor.js";
8
8
  export { schema, type BuiltSchema, type SchemaCodecs, type SchemaInput, type SchemaRequires, } from "./schema.js";
9
9
  export { withOwner, type DeclaredOwner } from "./owner.js";
10
+ export { external } from "./external.js";
10
11
  export { index, sql, table, type AnyTable, type ColumnHandle, type IndexCall, type SqlText, type SqlValue, type FilterOperator, type Table, type TableOptions, } from "./table.js";
11
12
  export type { PresetQuery } from "./preset.js";
12
13
  export { custom } from "./custom.js";
@@ -1,9 +1,7 @@
1
1
  import"../../shared/12z7aznj.js";
2
2
  import {
3
- jsonReplacer2,
4
- json2,
5
- jsonb2
6
- } from "../../shared/vk7rag46.js";
3
+ quoteIdent2
4
+ } from "../../shared/fk9vef30.js";
7
5
  import {
8
6
  searchValue
9
7
  } from "../../shared/dzj09cye.js";
@@ -13,6 +11,11 @@ import {
13
11
  denseRank2,
14
12
  runningTotal2
15
13
  } from "../../shared/9a4ae4p8.js";
14
+ import {
15
+ jsonReplacer2,
16
+ json2,
17
+ jsonb2
18
+ } from "../../shared/vk7rag46.js";
16
19
  import {
17
20
  bucket2
18
21
  } from "../../shared/nbw1z4yd.js";
@@ -44,7 +47,7 @@ import {
44
47
  } from "../../shared/ecn8mfdq.js";
45
48
  import {
46
49
  schema2
47
- } from "../../shared/9dr2qnx7.js";
50
+ } from "../../shared/qqm3ze6q.js";
48
51
  import {
49
52
  one2,
50
53
  many2,
@@ -65,7 +68,7 @@ import {
65
68
  table2,
66
69
  index2,
67
70
  sql2
68
- } from "../../shared/gcefca6p.js";
71
+ } from "../../shared/f9t9g54z.js";
69
72
  import {
70
73
  ColumnBuilder2,
71
74
  required,
@@ -75,10 +78,7 @@ import {
75
78
  isFragmentParts,
76
79
  fragment2,
77
80
  ident2
78
- } from "../../shared/bsek72fg.js";
79
- import {
80
- quoteIdent
81
- } from "../../shared/sjk86yrx.js";
81
+ } from "../../shared/s5qe47a6.js";
82
82
  import {
83
83
  domainType
84
84
  } from "../../shared/ywspezzx.js";
@@ -115,6 +115,10 @@ var __export = (target, all) => {
115
115
  set: __exportSetter.bind(all, name)
116
116
  });
117
117
  };
118
+ // src/dialects/pg/external.ts
119
+ function external(table) {
120
+ return withOwner2(table, "external");
121
+ }
118
122
  // src/dialects/pg/custom.ts
119
123
  function custom(spec) {
120
124
  if (spec.sqlType.length === 0) {
@@ -1021,7 +1025,7 @@ function writeIdent(name, sink, table) {
1021
1025
  fix: { summary: "A raw statement cannot name a hidden field." }
1022
1026
  });
1023
1027
  }
1024
- sink.text(quoteIdent(column.sql));
1028
+ sink.text(quoteIdent2(column.sql));
1025
1029
  }
1026
1030
  function readClass(statement) {
1027
1031
  if (statement === READ || statement === WRITE)
@@ -1085,7 +1089,7 @@ function guardOf(table, tenancy, userCount) {
1085
1089
  if (tenancy !== undefined)
1086
1090
  parts.push(shift(tenancy.text, userCount));
1087
1091
  if (archive !== undefined)
1088
- parts.push(`okm_tenant.${quoteIdent(archive)} is null`);
1092
+ parts.push(`okm_tenant.${quoteIdent2(archive)} is null`);
1089
1093
  return { text: parts.join(" and "), params: tenancy?.params ?? [] };
1090
1094
  }
1091
1095
  function requireKey(table, tenantKey, parts) {
@@ -1116,8 +1120,8 @@ function wrap(table, tenantKey, text, where) {
1116
1120
  if (column === undefined) {
1117
1121
  unverifiable("A raw read needs one primary key column besides the tenant key.", "Declare one primary key. The tenant predicate binds that column.");
1118
1122
  }
1119
- const quoted = quoteIdent(column.sql);
1120
- return `select okm_raw.* from (${text}) as okm_raw where okm_raw.${quoted} in (select ${quoted} from ${quoteIdent(table.model.sql)} as okm_tenant where ${where})`;
1123
+ const quoted = quoteIdent2(column.sql);
1124
+ return `select okm_raw.* from (${text}) as okm_raw where okm_raw.${quoted} in (select ${quoted} from ${quoteIdent2(table.model.sql)} as okm_tenant where ${where})`;
1121
1125
  }
1122
1126
  function shift(text, by) {
1123
1127
  if (by === 0)
@@ -1210,6 +1214,7 @@ export {
1210
1214
  eq,
1211
1215
  every,
1212
1216
  explain,
1217
+ external,
1213
1218
  fragment2 as fragment,
1214
1219
  gt,
1215
1220
  gte,
@@ -74,3 +74,15 @@ export declare function atomicBody(definition: string): string;
74
74
  * @returns The reprinted expression, without the `CHECK` keyword
75
75
  */
76
76
  export declare function reprintCheck(runner: CatalogQuery, expression: string): Promise<string>;
77
+ /**
78
+ * Creates a temporary domain and reads the check Postgres stores.
79
+ *
80
+ * Domain checks use `VALUE`, which is not valid on a table check. Two
81
+ * authoring spellings of the same domain predicate compare equal after this.
82
+ *
83
+ * @param runner - Database connection
84
+ * @param base - Domain base type, as Postgres `format_type` spells it
85
+ * @param expression - Check expression without the `CHECK` keyword
86
+ * @returns The reprinted expression, without the `CHECK` keyword
87
+ */
88
+ export declare function reprintDomainCheck(runner: CatalogQuery, base: string, expression: string): Promise<string>;
@@ -3,18 +3,18 @@ import {
3
3
  materializedViewObject,
4
4
  materializedViewIndex
5
5
  } from "../../../shared/12z7aznj.js";
6
+ import {
7
+ quoteIdent2
8
+ } from "../../../shared/fk9vef30.js";
6
9
  import {
7
10
  viewClient
8
- } from "../../../shared/760ppr76.js";
11
+ } from "../../../shared/4a3mmhhe.js";
9
12
  import {
10
13
  snakeCase
11
- } from "../../../shared/gcefca6p.js";
14
+ } from "../../../shared/f9t9g54z.js";
12
15
  import {
13
16
  formatType
14
17
  } from "../../../shared/606g0nbf.js";
15
- import {
16
- quoteIdent
17
- } from "../../../shared/sjk86yrx.js";
18
18
  import {
19
19
  staticNamespace2
20
20
  } from "../../../shared/358zsv4r.js";
@@ -204,10 +204,10 @@ function renderQuery(name, recipe, casing) {
204
204
  }
205
205
  const sqlName = columnSql(column, field, casing);
206
206
  columns.push({ name: sqlName, type: columnType(column, field) });
207
- selected.push(quoteIdent(sqlName));
207
+ selected.push(quoteIdent2(sqlName));
208
208
  }
209
209
  const tableName = tableSql(recipe.table, casing);
210
- let query = `select ${selected.join(", ")} from ${quoteIdent(tableName)}`;
210
+ let query = `select ${selected.join(", ")} from ${quoteIdent2(tableName)}`;
211
211
  if (recipe.predicate !== undefined && recipe.predicate.trim().length > 0) {
212
212
  query += ` where ${recipe.predicate}`;
213
213
  }
@@ -6,7 +6,10 @@
6
6
  * replaces the author query and `pg_depend` supplies column edges (D117).
7
7
  * A `BEGIN ATOMIC` body is replaced with the `pg_get_functiondef` block, so a
8
8
  * plan from the live catalog does not treat Postgres's reprint as a change
9
- * (D273). The scratch schema is dropped before this returns. Plans never use it.
9
+ * (D273). A name that appears once is that row. Overloads compare identity
10
+ * arguments after typmods and aliases are folded, so two overloads do not
11
+ * share a body. The scratch schema is dropped before this returns. Plans
12
+ * never use it.
10
13
  */
11
14
  import type { Catalog } from "../../../contracts/catalog/types.js";
12
15
  import { type CatalogQuery } from "../introspect.js";
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Optional build files under `.okm`.
3
+ *
4
+ * The runtime layer cannot import `node:fs`. Bun and Node expose a file read
5
+ * without that import. A missing file is `undefined`.
6
+ */
7
+ /**
8
+ * Directory of `catalog.hash` and `catalog.json`.
9
+ *
10
+ * A trailing `/` or `\` is removed so the joined file name is one path.
11
+ *
12
+ * @param catalogDir - Directory the caller passed, or the default `.okm`
13
+ * @returns The directory, without a trailing slash
14
+ */
15
+ export declare function artifactDir(catalogDir: string | undefined): string;
16
+ /**
17
+ * Reads an optional build artifact.
18
+ *
19
+ * @param path - File path
20
+ * @returns The text, or `undefined` when the file is missing
21
+ */
22
+ export declare function readText(path: string): Promise<string | undefined>;
@@ -7,6 +7,7 @@
7
7
  import type { DriverPool } from "../contracts/driver.js";
8
8
  import type { IdGenerators } from "../contracts/generator.js";
9
9
  import { OkmError, type ErrorStatuses, type OkmErrorOptions } from "../contracts/error.js";
10
+ import type { MapPostgresErrorOptions } from "../dialects/pg/errors.js";
10
11
  import type { PresetUse, QuerySchema } from "../dialects/pg/model.js";
11
12
  import { type ArchiveView, type Plan, type ReadCall, type CallScope, type ReadOp } from "./plan.js";
12
13
  import type { CatalogArtifact, Connected, Hookm, Timeouts } from "./types.js";
@@ -148,6 +149,15 @@ export declare function withHttp(http: ErrorStatuses | undefined, options: OkmEr
148
149
  * @returns The error `toHttp()` reads
149
150
  */
150
151
  export declare function attachHttp(http: ErrorStatuses | undefined, error: OkmError): OkmError;
152
+ /**
153
+ * Statuses and schema the Postgres error mapper reads.
154
+ *
155
+ * @param http - Status overrides from `connect`
156
+ * @param includeValues - When true, a mapped error may include bound values
157
+ * @param schema - Schema whose names the mapper can mention
158
+ * @returns Mapper options
159
+ */
160
+ export declare function mapOptions(http: ErrorStatuses | undefined, includeValues: boolean, schema: QuerySchema): MapPostgresErrorOptions;
151
161
  /**
152
162
  * Maps a driver or query error and records it on the session logger.
153
163
  *
@@ -44,5 +44,6 @@ export declare function driftVerdict(codeHash: string, recordedHash: string, mig
44
44
  * @param codeHash - Hash of the code's catalog
45
45
  * @param recordedHash - Hash from the startup query
46
46
  * @param options - The call's cancellation and deadline
47
+ * @param namespace - Schema that stores `okm_history`. `public` stays unqualified
47
48
  */
48
- export declare function assertDrift(pool: DriverPool, codeHash: string, recordedHash: string, options: ExecuteOptions | undefined): Promise<void>;
49
+ export declare function assertDrift(pool: DriverPool, codeHash: string, recordedHash: string, options: ExecuteOptions | undefined, namespace?: string): Promise<void>;
@@ -8,6 +8,7 @@
8
8
  */
9
9
  import type { DriverPool, ExecuteOptions } from "../contracts/driver.js";
10
10
  import type { QuerySchema } from "../dialects/pg/model.js";
11
+ export { artifactDir } from "./artifact-file.js";
11
12
  /** Build artifact `okm build` wrote. */
12
13
  export type CatalogArtifact = {
13
14
  readonly text: string;
@@ -24,17 +25,9 @@ export type CatalogArtifact = {
24
25
  * @param recordedHash - Hash from the startup query
25
26
  * @param source - Optional build artifact, or a directory that contains one
26
27
  * @param options - Cancellation and deadline for the history query
28
+ * @param namespace - Schema that stores `okm_history`. `public` stays unqualified
27
29
  */
28
30
  export declare function assertCompatible(pool: DriverPool, schema: QuerySchema, recordedHash: string, source: {
29
31
  readonly catalog?: CatalogArtifact;
30
32
  readonly catalogDir?: string;
31
- }, options: ExecuteOptions | undefined): Promise<void>;
32
- /**
33
- * Directory of `catalog.hash` and `catalog.json`.
34
- *
35
- * A trailing `/` or `\` is removed so the joined file name is one path.
36
- *
37
- * @param catalogDir - Directory the caller passed, or the default `.okm`
38
- * @returns The directory, without a trailing slash
39
- */
40
- export declare function artifactDir(catalogDir: string | undefined): string;
33
+ }, options: ExecuteOptions | undefined, namespace?: string): Promise<void>;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Postgres protocol parameter budget (B-40).
3
+ *
4
+ * Loaded only when a statement goes over the limit. Small statements pay one
5
+ * integer compare in the path that already holds the parameter list.
6
+ */
7
+ /** Postgres binds at most this many parameters on one statement. */
8
+ export declare const PG_PARAM_LIMIT = 65535;
9
+ /**
10
+ * Refuses a statement that exceeds the protocol parameter limit.
11
+ *
12
+ * @param count - Parameter count of the finished statement
13
+ */
14
+ export declare function refuseParamLimit(count: number): never;
15
+ /**
16
+ * Throws OKM1126 when `count` is above {@link PG_PARAM_LIMIT}.
17
+ *
18
+ * @param count - Parameter count of the finished statement
19
+ */
20
+ export declare function assertParamCount(count: number): void;
@@ -4,20 +4,20 @@ import {
4
4
  import {
5
5
  markClientPool,
6
6
  open5
7
- } from "../../shared/zbqbmmrp.js";
7
+ } from "../../shared/n6je5b28.js";
8
8
  import {
9
9
  BUNSQL_CAPABILITIES,
10
10
  readCapability2,
11
11
  hasCapability2
12
- } from "../../shared/ae4j5f42.js";
12
+ } from "../../shared/mfvx6kjx.js";
13
13
  import {
14
14
  createClient
15
- } from "../../shared/bah9nbg3.js";
15
+ } from "../../shared/xbvz446k.js";
16
16
 
17
17
  // src/runtime/pg/bun.ts
18
18
  function connect(target, options) {
19
19
  if (typeof target === "object" && !isPool(target)) {
20
- return import("../../shared/0wrea3jq.js").then((mod) => mod.default(target, options, (config) => {
20
+ return import("../../shared/ysdw2fg3.js").then((mod) => mod.default(target, options, (config) => {
21
21
  const pool = open5(config);
22
22
  markClientPool(pool);
23
23
  return pool;
@@ -3,21 +3,21 @@ import {
3
3
  } from "../../shared/cm3w0ywp.js";
4
4
  import {
5
5
  open6
6
- } from "../../shared/agsfb86s.js";
6
+ } from "../../shared/4te76xc5.js";
7
7
  import {
8
8
  NEON_WEBSOCKET_CAPABILITIES,
9
9
  NEON_HTTP_CAPABILITIES,
10
10
  readCapability2,
11
11
  hasCapability2
12
- } from "../../shared/ae4j5f42.js";
12
+ } from "../../shared/mfvx6kjx.js";
13
13
  import {
14
14
  createClient
15
- } from "../../shared/bah9nbg3.js";
15
+ } from "../../shared/xbvz446k.js";
16
16
 
17
17
  // src/runtime/pg/neon.ts
18
18
  function connect(target, options) {
19
19
  if (typeof target === "object" && !isPool(target)) {
20
- return import("../../shared/0wrea3jq.js").then((mod) => mod.default(target, options, (config) => open6({
20
+ return import("../../shared/ysdw2fg3.js").then((mod) => mod.default(target, options, (config) => open6({
21
21
  url: config.url,
22
22
  ...options.mode !== undefined ? { mode: options.mode } : {},
23
23
  ...config.max !== undefined ? { max: config.max } : {},
@@ -3,20 +3,20 @@ import {
3
3
  } from "../../shared/cm3w0ywp.js";
4
4
  import {
5
5
  open4
6
- } from "../../shared/14x60fbf.js";
6
+ } from "../../shared/tyqapcgk.js";
7
7
  import {
8
8
  NODE_POSTGRES_CAPABILITIES,
9
9
  readCapability2,
10
10
  hasCapability2
11
- } from "../../shared/ae4j5f42.js";
11
+ } from "../../shared/mfvx6kjx.js";
12
12
  import {
13
13
  createClient
14
- } from "../../shared/bah9nbg3.js";
14
+ } from "../../shared/xbvz446k.js";
15
15
 
16
16
  // src/runtime/pg/pg.ts
17
17
  function connect(target, options) {
18
18
  if (typeof target === "object" && !isPool(target)) {
19
- return import("../../shared/0wrea3jq.js").then((mod) => mod.default(target, options, open4));
19
+ return import("../../shared/ysdw2fg3.js").then((mod) => mod.default(target, options, open4));
20
20
  }
21
21
  const owned = !isPool(target);
22
22
  const pool = isPool(target) ? target : open4({