okmodel 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/dist/adapters/pg/bunsql-extra.d.ts +5 -5
- package/dist/adapters/pg/bunsql.d.ts +6 -2
- package/dist/adapters/pg/nodepostgres.d.ts +16 -1
- package/dist/adapters/pg/postgres-extra.d.ts +3 -17
- package/dist/adapters/pg/postgresjs.d.ts +2 -1
- package/dist/contracts/driver.d.ts +3 -2
- package/dist/contracts/error.d.ts +1 -1
- package/dist/dialects/pg/errors.d.ts +2 -0
- package/dist/dialects/pg/ext/fuzzystrmatch.js +1 -1
- package/dist/dialects/pg/ext/hstore.js +1 -1
- package/dist/dialects/pg/ext/ltree.js +1 -1
- package/dist/dialects/pg/ext/pgcrypto.js +1 -1
- package/dist/dialects/pg/ext/unaccent.js +1 -1
- package/dist/dialects/pg/filters.d.ts +2 -2
- package/dist/dialects/pg/fn/index.js +1 -1
- package/dist/dialects/pg/index.js +3 -3
- package/dist/dialects/pg/introspect.d.ts +12 -0
- package/dist/dialects/pg/view/index.js +2 -2
- package/dist/runtime/param-limit.d.ts +20 -0
- package/dist/runtime/pg/bun.js +3 -3
- package/dist/runtime/pg/neon.js +3 -3
- package/dist/runtime/pg/pg.js +3 -3
- package/dist/runtime/pg/pglite.js +2 -2
- package/dist/runtime/pg/postgresjs.js +10 -10
- package/dist/runtime/tenancy/index.js +1 -1
- package/dist/runtime/traits/index.js +2 -2
- package/dist/runtime/validate/index.js +2 -2
- package/dist/runtime/write.d.ts +1 -1
- package/dist/shared/{5kyb3tqx.js → 1h5h1rf5.js} +1 -1
- package/dist/shared/{4vbf83xx.js → 2vcnpf0n.js} +1 -1
- package/dist/shared/{8n688yjg.js → 3ap5hxvj.js} +2 -1
- package/dist/shared/{wvtjg5m3.js → 3d7a80fq.js} +1 -1
- package/dist/shared/{bphrgwz9.js → 3dr444ny.js} +57 -78
- package/dist/shared/{yvabyg9k.js → 3vvpcphd.js} +7 -6
- package/dist/shared/{760ppr76.js → 4a3mmhhe.js} +2 -2
- package/dist/shared/{90sg0w5a.js → 4pkz5nvw.js} +65 -10
- package/dist/shared/{mazpbcdj.js → 4te76xc5.js} +1 -1
- package/dist/shared/{xwhdcrm4.js → 60y4ahmw.js} +1 -1
- package/dist/shared/{9dtgn1z2.js → 63qjmhnp.js} +100 -17
- package/dist/shared/{s7he5e5d.js → 67w3kn71.js} +1 -1
- package/dist/shared/{n306gqkd.js → 6vfvsdkt.js} +9 -7
- package/dist/shared/{jpybhf98.js → 6xqvesa5.js} +1 -1
- package/dist/shared/{n5whk3mt.js → 8gdbty5v.js} +8 -8
- package/dist/shared/{ccsmhv9r.js → 8ma6drzr.js} +194 -31
- package/dist/shared/{3456242y.js → 8p2bgye0.js} +110 -18
- package/dist/shared/{ebhz8vh6.js → 8qwqrxed.js} +11 -3
- package/dist/shared/{ss2kv2rs.js → 8v7vzpgt.js} +10 -7
- package/dist/shared/{8qzkd9f3.js → ak61ye1f.js} +3 -3
- package/dist/shared/{6nae0spm.js → bdekbvmt.js} +69 -7
- package/dist/shared/{tw1nvvfj.js → bxjq6xqv.js} +2 -2
- package/dist/shared/{rbxt795q.js → c7dqd3gk.js} +81 -41
- package/dist/shared/ddh72ym5.js +20 -0
- package/dist/shared/e1c55v04.js +10 -0
- package/dist/shared/{8jesqsrk.js → ekhq3ytz.js} +1 -1
- package/dist/shared/{7ba5h6pb.js → esy4dyxe.js} +5 -5
- package/dist/shared/{gcefca6p.js → f9t9g54z.js} +22 -9
- package/dist/shared/fkjne6gx.js +8 -0
- package/dist/shared/{ds229x4r.js → fne90dvz.js} +4 -1
- package/dist/shared/{cexb7z6b.js → gr9sn4za.js} +1 -1
- package/dist/shared/{mvmm3xpb.js → gzgfsspx.js} +1 -1
- package/dist/shared/{fdsz3w80.js → hgt69zjf.js} +2 -2
- package/dist/shared/{dd5pmnky.js → jvxcp1qk.js} +70 -86
- package/dist/shared/{yybhre6n.js → k73e8n9d.js} +3 -3
- package/dist/shared/{mgaq2sd3.js → kzgrcy8s.js} +8 -7
- package/dist/shared/{myk8fswx.js → mz48rs74.js} +14 -3
- package/dist/shared/{62b603gr.js → n6je5b28.js} +10 -23
- package/dist/shared/{2szgv6yj.js → ns35jqz0.js} +71 -45
- package/dist/shared/{xtsydxjg.js → nstwgzn8.js} +1 -1
- package/dist/shared/{stfa9xcw.js → py2zrrm6.js} +7 -6
- package/dist/shared/{9dr2qnx7.js → qqm3ze6q.js} +1 -1
- package/dist/shared/{cf8zdz5p.js → rcjm0yn7.js} +27 -34
- package/dist/shared/{ckz05z15.js → rged92v6.js} +7 -4
- package/dist/shared/{qvwwp1mp.js → rw4tpcd0.js} +30 -21
- package/dist/shared/{bsek72fg.js → s5qe47a6.js} +3 -0
- package/dist/shared/{1d9q9cv2.js → smxzjz60.js} +2 -2
- package/dist/shared/{c3mvnq7a.js → th5rnaxw.js} +1 -1
- package/dist/shared/{1mxm04fy.js → tyqapcgk.js} +71 -8
- package/dist/shared/{zdqf8k5d.js → vsna85qf.js} +1 -1
- package/dist/shared/{63qtkrca.js → vy47ryqa.js} +55 -5
- package/dist/shared/{xv8qj97g.js → wbdh9qbg.js} +3 -1
- package/dist/shared/{2zdxkt7b.js → wp7y8q3y.js} +41 -9
- package/dist/shared/{pg4ezgyf.js → xbd9xs6p.js} +2 -2
- package/dist/shared/{npdftanb.js → xbvz446k.js} +16 -13
- package/dist/shared/{aksb89mn.js → y6tfjk9q.js} +2 -2
- package/dist/shared/{3bb7wsqt.js → ycnft340.js} +1 -1
- package/dist/shared/{z7s6fpxv.js → ymenf259.js} +1 -1
- package/dist/shared/{71n0jmhc.js → ysdw2fg3.js} +10 -2
- package/dist/shared/{xqacq37x.js → zecrwdk9.js} +1 -1
- package/dist/shared/{3t6kw83m.js → zm2rzqba.js} +2 -1
- package/dist/tooling/cli.js +122 -44
- package/dist/tooling/driver-run.js +107 -24
- package/dist/tooling/github/comment.d.ts +8 -2
- package/dist/tooling/migrate/apply.d.ts +17 -2
- package/dist/tooling/migrate/drift.d.ts +12 -0
- package/dist/tooling/migrate/driver-url.d.ts +17 -0
- package/dist/tooling/migrate/index.js +9 -7
- package/dist/tooling/migrate/policy.d.ts +17 -5
- package/dist/tooling/migrate/pooler-probe.d.ts +23 -0
- package/dist/tooling/migrate/pull.d.ts +3 -0
- package/dist/tooling/migrate/runner.d.ts +24 -1
- package/dist/tooling/shared/{0j0jtse1.js → 09a6vsys.js} +1 -1
- package/dist/tooling/shared/{68tf18v4.js → 0v9ptnxp.js} +8 -8
- package/dist/tooling/shared/{qartgazh.js → 0wtzps9p.js} +6 -6
- package/dist/tooling/shared/{1800eymw.js → 0yhf1db4.js} +6 -6
- package/dist/tooling/shared/{s6qha57m.js → 19msgrsc.js} +2 -2
- package/dist/tooling/shared/{3yn79q5m.js → 1fwfm5m3.js} +1 -1
- package/dist/tooling/shared/{hfq3n3bd.js → 2jdn09e2.js} +55 -5
- package/dist/tooling/shared/{v6j1ep6w.js → 2qrte2ct.js} +5 -5
- package/dist/tooling/shared/{yb4kd19s.js → 2v4nwnkb.js} +1 -1
- package/dist/tooling/shared/{ezqn88nj.js → 33z39trp.js} +106 -23
- package/dist/tooling/shared/{0r05zhyq.js → 353vnw9z.js} +5 -5
- package/dist/tooling/shared/{m4hhb8aa.js → 390kry9g.js} +2 -2
- package/dist/tooling/shared/{rcywj2w8.js → 3f6etb9z.js} +18 -31
- package/dist/tooling/shared/{9wsnsvbf.js → 3t2cqmsx.js} +1 -1
- package/dist/tooling/shared/{5zrzffnk.js → 4dzvjtpy.js} +1 -1
- package/dist/tooling/shared/{am04v8na.js → 4ec0nxvw.js} +10 -10
- package/dist/tooling/shared/{04svnxxj.js → 4tg2bn41.js} +59 -78
- package/dist/tooling/shared/{829fjxyw.js → 5rah55z0.js} +2 -2
- package/dist/tooling/shared/{c0xevn1h.js → 804w1t69.js} +4 -4
- package/dist/tooling/shared/{dhatassp.js → 8g0m0rvd.js} +6 -6
- package/dist/tooling/shared/{zx3v9phv.js → 8msbtw5s.js} +1 -1
- package/dist/tooling/shared/{7pxncnzs.js → 8t22h3h7.js} +2 -2
- package/dist/tooling/shared/{wbwq1jsa.js → 91c59b7b.js} +2 -2
- package/dist/tooling/shared/{a2xe04bm.js → adk9k6va.js} +1 -1
- package/dist/tooling/shared/{w17sj05d.js → ajjd5cwz.js} +2 -2
- package/dist/tooling/shared/{35zemrmf.js → angjck01.js} +1 -1
- package/dist/tooling/shared/{jsjjz875.js → asnnc3v5.js} +1 -1
- package/dist/tooling/shared/{5bmksndh.js → bj1kyqc8.js} +2 -2
- package/dist/tooling/shared/{kbqnrs1x.js → bt3tjemb.js} +11 -3
- package/dist/tooling/shared/{vwr2y833.js → chk2bh4f.js} +2 -2
- package/dist/tooling/shared/{ybdew6j7.js → ckq4z5ax.js} +5 -2
- package/dist/tooling/shared/{3rmaz3pq.js → d3rhb24q.js} +1 -1
- package/dist/tooling/shared/{mw5npye0.js → d8q00vxg.js} +4 -4
- package/dist/tooling/shared/{j664qjrt.js → dx188rxs.js} +2 -2
- package/dist/tooling/shared/{8yr7ges1.js → efq6p9df.js} +35 -42
- package/dist/tooling/shared/{yhp829bx.js → en6rwzq0.js} +3 -3
- package/dist/tooling/shared/{f77nnfqy.js → f2r5g0fs.js} +2 -2
- package/dist/tooling/shared/{zs9aymcp.js → f4gep0nk.js} +1 -1
- package/dist/tooling/shared/{kz715295.js → f8a010fm.js} +13 -11
- package/dist/tooling/shared/{w5d89rb4.js → fdsek6pa.js} +1 -1
- package/dist/tooling/shared/fvmrxsd1.js +8 -0
- package/dist/tooling/shared/{jpgmjsx3.js → g3xybeqf.js} +4 -3
- package/dist/tooling/shared/{wezxf3h8.js → gefmpwsa.js} +1 -1
- package/dist/tooling/shared/{jr2nmr81.js → gjj71hfh.js} +23 -20
- package/dist/tooling/shared/{9sfbtwsk.js → jgzt69pa.js} +5 -5
- package/dist/tooling/shared/{a4pzghha.js → jm30k2ca.js} +10 -8
- package/dist/tooling/shared/{shjs0379.js → kayqzpbk.js} +6 -3
- package/dist/tooling/shared/{tcwpjvxe.js → kvw1672d.js} +1 -1
- package/dist/tooling/shared/{stebqyyd.js → mr1kcgpw.js} +3 -3
- package/dist/tooling/shared/{tpssp7ac.js → mwbdf409.js} +1 -1
- package/dist/tooling/shared/{fh07z1dt.js → ns9207v3.js} +1 -1
- package/dist/tooling/shared/{5p8km5jb.js → p6tjv97k.js} +3 -3
- package/dist/tooling/shared/{ytk1tjs0.js → p73evwf0.js} +1 -1
- package/dist/tooling/shared/{8m5znpdt.js → phc1nc4g.js} +1 -1
- package/dist/tooling/shared/{asgr07mp.js → ppybjw50.js} +79 -16
- package/dist/tooling/shared/{t4xveemq.js → qdrn8ghn.js} +5 -4
- package/dist/tooling/shared/rd8h01ta.js +20 -0
- package/dist/tooling/shared/{7aews1zg.js → rwg8y90m.js} +3 -3
- package/dist/tooling/shared/{5x3pf400.js → ry2f3w8p.js} +3 -3
- package/dist/tooling/shared/{m3xt8b1h.js → ryc5sa58.js} +8 -8
- package/dist/tooling/shared/{57btdkgm.js → ss87qxwv.js} +2 -2
- package/dist/tooling/shared/{6vk28rjp.js → vg68k11z.js} +3 -3
- package/dist/tooling/shared/{62fxpc1p.js → vms9dta5.js} +73 -89
- package/dist/tooling/shared/{gqwevek4.js → xchpnbdv.js} +1 -1
- package/dist/tooling/shared/{t6zjeake.js → xn6p01fh.js} +5 -5
- package/dist/tooling/shared/{7b3xp9gc.js → xwr6q618.js} +3 -3
- package/dist/tooling/shared/{yfedr1zb.js → xx3gmq94.js} +1 -1
- package/dist/tooling/shared/{9qr9rkbh.js → y2bd7yfx.js} +21 -13
- package/dist/tooling/shared/{nxq95eb6.js → y4gq9rbe.js} +11 -11
- package/dist/tooling/shared/{76pv6qff.js → y4vwft92.js} +2 -2
- package/dist/tooling/shared/{sjwkt1pg.js → yz68xcmc.js} +1 -1
- package/dist/tooling/testing/factories.d.ts +1 -3
- package/dist/tooling/testing/index.js +1 -1
- package/package.json +2 -1
package/dist/tooling/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import"../shared/12z7aznj.js";
|
|
2
2
|
import"../shared/n442h54c.js";
|
|
3
3
|
import"../shared/fk9vef30.js";
|
|
4
|
-
import"../shared/
|
|
4
|
+
import"../shared/jvxcp1qk.js";
|
|
5
5
|
import {
|
|
6
6
|
formatFindings,
|
|
7
7
|
hasError,
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
planProject,
|
|
12
12
|
checkProject,
|
|
13
13
|
exportProject
|
|
14
|
-
} from "../shared/
|
|
14
|
+
} from "../shared/wp7y8q3y.js";
|
|
15
15
|
import {
|
|
16
16
|
sessionFailure
|
|
17
|
-
} from "../shared/
|
|
17
|
+
} from "../shared/bdekbvmt.js";
|
|
18
18
|
import {
|
|
19
19
|
OkmError2
|
|
20
20
|
} from "../shared/52szzakm.js";
|
|
@@ -65,7 +65,7 @@ async function run(argv, io) {
|
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
if (command === "check") {
|
|
68
|
-
const findings = await checkProject(cwd, invoke(splitFlags(rest)));
|
|
68
|
+
const findings = await checkProject(cwd, invoke(splitFlags(rest, "check")));
|
|
69
69
|
const warnings = formatFindings(findings);
|
|
70
70
|
if (warnings.length > 0)
|
|
71
71
|
stdout(warnings);
|
|
@@ -74,7 +74,7 @@ async function run(argv, io) {
|
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
if (command === "generate") {
|
|
77
|
-
const parsed = splitFlags(rest);
|
|
77
|
+
const parsed = splitFlags(rest, "generate");
|
|
78
78
|
const written = await generateProject(cwd, parsed.name ?? "migration", parsed.flags);
|
|
79
79
|
stdout(written === undefined ? `no changes
|
|
80
80
|
` : `${written.path}
|
|
@@ -84,17 +84,17 @@ async function run(argv, io) {
|
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
if (command === "dev") {
|
|
87
|
-
const { devProject } = await import("../shared/
|
|
87
|
+
const { devProject } = await import("../shared/ak61ye1f.js");
|
|
88
88
|
stdout(await devProject(cwd));
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
91
|
if (command === "push") {
|
|
92
|
-
const { pushProject } = await import("../shared/
|
|
93
|
-
stdout(await pushProject(cwd, invoke(splitFlags(rest))));
|
|
92
|
+
const { pushProject } = await import("../shared/6vfvsdkt.js");
|
|
93
|
+
stdout(await pushProject(cwd, invoke(splitFlags(rest, "push"))));
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
if (command === "pull") {
|
|
97
|
-
const { pullProject } = await import("../shared/
|
|
97
|
+
const { pullProject } = await import("../shared/esy4dyxe.js");
|
|
98
98
|
stdout((await pullProject(cwd, rest)).text);
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
@@ -105,14 +105,20 @@ async function run(argv, io) {
|
|
|
105
105
|
fix: { summary: "Use okm import drizzle <path>." }
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
|
-
const { importDrizzle } = await import("../shared/
|
|
108
|
+
const { importDrizzle } = await import("../shared/8gdbty5v.js");
|
|
109
109
|
stdout((await importDrizzle(cwd, rest.slice(1))).text);
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
112
|
if (command === "migrate") {
|
|
113
113
|
const sub = rest[0];
|
|
114
114
|
const migrateArgs = rest.slice(1);
|
|
115
|
-
const
|
|
115
|
+
const commandKey = sub === "plan" ? "migrate plan" : sub === "apply" ? "migrate apply" : sub === "status" ? "migrate status" : sub === "check" ? "migrate check" : undefined;
|
|
116
|
+
if (commandKey === undefined) {
|
|
117
|
+
throw new OkmError2("invalid", `Unknown command migrate ${sub ?? ""}.`, {
|
|
118
|
+
fix: { summary: "Use okm migrate plan, apply, status, or check." }
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
const parsed = splitFlags(sub === "plan" ? migrateArgs.filter((arg) => arg !== "--json") : migrateArgs, commandKey);
|
|
116
122
|
if (sub === "plan") {
|
|
117
123
|
if (parsed.name === undefined) {
|
|
118
124
|
throw new OkmError2("invalid", "okm migrate plan needs a name.");
|
|
@@ -129,36 +135,35 @@ async function run(argv, io) {
|
|
|
129
135
|
return;
|
|
130
136
|
}
|
|
131
137
|
if (sub === "apply") {
|
|
132
|
-
const { applyProject } = await import("../shared/
|
|
138
|
+
const { applyProject } = await import("../shared/6vfvsdkt.js");
|
|
133
139
|
stdout(await applyProject(cwd, invoke(parsed), stdout));
|
|
134
140
|
return;
|
|
135
141
|
}
|
|
136
142
|
if (sub === "status") {
|
|
137
|
-
const { statusProject } = await import("../shared/
|
|
143
|
+
const { statusProject } = await import("../shared/kzgrcy8s.js");
|
|
138
144
|
stdout(await statusProject(cwd, invoke(parsed)));
|
|
139
145
|
return;
|
|
140
146
|
}
|
|
141
147
|
if (sub === "check") {
|
|
142
|
-
const { checkMigrations } = await import("../shared/
|
|
143
|
-
|
|
144
|
-
stdout(await checkMigrations(cwd, invoke(parsed), { provision }));
|
|
148
|
+
const { checkMigrations } = await import("../shared/rw4tpcd0.js");
|
|
149
|
+
stdout(await checkMigrations(cwd, invoke(parsed), { provision: parsed.provision }));
|
|
145
150
|
return;
|
|
146
151
|
}
|
|
147
152
|
}
|
|
148
153
|
if (command === "seed") {
|
|
149
|
-
const parsed = splitFlags(rest);
|
|
154
|
+
const parsed = splitFlags(rest, "seed");
|
|
150
155
|
if (parsed.name === undefined) {
|
|
151
156
|
throw new OkmError2("invalid", "okm seed needs a file.", {
|
|
152
157
|
fix: { summary: "Pass okm seed <file>." }
|
|
153
158
|
});
|
|
154
159
|
}
|
|
155
|
-
const { seedProject } = await import("../shared/
|
|
160
|
+
const { seedProject } = await import("../shared/8v7vzpgt.js");
|
|
156
161
|
stdout(await seedProject(cwd, parsed.name, invoke(parsed)));
|
|
157
162
|
return;
|
|
158
163
|
}
|
|
159
164
|
if (command === "doctor") {
|
|
160
|
-
const parsed = splitFlags(rest);
|
|
161
|
-
const { doctorProject } = await import("../shared/
|
|
165
|
+
const parsed = splitFlags(rest, "doctor");
|
|
166
|
+
const { doctorProject } = await import("../shared/3vvpcphd.js");
|
|
162
167
|
stdout(await doctorProject(cwd, parsed.name, invoke(parsed)));
|
|
163
168
|
return;
|
|
164
169
|
}
|
|
@@ -178,14 +183,14 @@ async function run(argv, io) {
|
|
|
178
183
|
const sub = rest[0];
|
|
179
184
|
if (sub === "scaffold" || sub === "test") {
|
|
180
185
|
const parsed = extInvocation(rest.slice(1));
|
|
181
|
-
const { extScaffold, extTest } = await import("../shared/
|
|
186
|
+
const { extScaffold, extTest } = await import("../shared/py2zrrm6.js");
|
|
182
187
|
const text = sub === "scaffold" ? await extScaffold(cwd, requireName(parsed, "okm ext scaffold <name>"), parsed.flags, parsed.out) : await extTest(cwd, requireName(parsed, "okm ext test <file>"), parsed.flags);
|
|
183
188
|
stdout(text);
|
|
184
189
|
return;
|
|
185
190
|
}
|
|
186
191
|
if (sub === "list" || sub === "check") {
|
|
187
|
-
const { extProject } = await import("../shared/
|
|
188
|
-
stdout(await extProject(cwd, sub, invoke(splitFlags(rest.slice(1)))));
|
|
192
|
+
const { extProject } = await import("../shared/py2zrrm6.js");
|
|
193
|
+
stdout(await extProject(cwd, sub, invoke(splitFlags(rest.slice(1), "ext"))));
|
|
189
194
|
return;
|
|
190
195
|
}
|
|
191
196
|
throw new OkmError2("invalid", `Unknown command ext ${sub ?? ""}.`, {
|
|
@@ -221,7 +226,7 @@ function extInvocation(args) {
|
|
|
221
226
|
}
|
|
222
227
|
rest.push(arg);
|
|
223
228
|
}
|
|
224
|
-
const parsed = splitFlags(rest);
|
|
229
|
+
const parsed = splitFlags(rest, "ext");
|
|
225
230
|
return { name: parsed.name, out, flags: invoke(parsed) };
|
|
226
231
|
}
|
|
227
232
|
function invoke(parsed) {
|
|
@@ -233,55 +238,90 @@ function invoke(parsed) {
|
|
|
233
238
|
...parsed.statementTimeoutMs !== undefined ? { statementTimeoutMs: parsed.statementTimeoutMs } : {}
|
|
234
239
|
};
|
|
235
240
|
}
|
|
236
|
-
|
|
241
|
+
var COMMAND_FLAGS = {
|
|
242
|
+
check: ["--target", "--allow-pooler", "--lock-timeout", "--statement-timeout"],
|
|
243
|
+
generate: ["--replace"],
|
|
244
|
+
push: ["--target", "--allow-protected", "--allow-pooler"],
|
|
245
|
+
seed: ["--target", "--allow-protected", "--allow-pooler"],
|
|
246
|
+
doctor: ["--target"],
|
|
247
|
+
ext: ["--target", "--allow-pooler", "--out"],
|
|
248
|
+
"migrate plan": ["--target", "--allow-protected", "--replace", "--json"],
|
|
249
|
+
"migrate apply": [
|
|
250
|
+
"--target",
|
|
251
|
+
"--allow-protected",
|
|
252
|
+
"--allow-pooler",
|
|
253
|
+
"--lock-timeout",
|
|
254
|
+
"--statement-timeout"
|
|
255
|
+
],
|
|
256
|
+
"migrate status": ["--target"],
|
|
257
|
+
"migrate check": [
|
|
258
|
+
"--target",
|
|
259
|
+
"--allow-protected",
|
|
260
|
+
"--allow-pooler",
|
|
261
|
+
"--provision",
|
|
262
|
+
"--lock-timeout",
|
|
263
|
+
"--statement-timeout"
|
|
264
|
+
]
|
|
265
|
+
};
|
|
266
|
+
function splitFlags(args, command) {
|
|
267
|
+
const allowed = new Set(COMMAND_FLAGS[command]);
|
|
237
268
|
const flags = [];
|
|
238
269
|
const positionals = [];
|
|
239
270
|
let target;
|
|
240
271
|
let allowProtected = false;
|
|
241
272
|
let allowPooler = false;
|
|
273
|
+
let provision = false;
|
|
242
274
|
let lockTimeoutMs;
|
|
243
275
|
let statementTimeoutMs;
|
|
244
276
|
for (let index = 0;index < args.length; index += 1) {
|
|
245
277
|
const arg = args[index] ?? "";
|
|
246
|
-
if (arg === "--replace") {
|
|
247
|
-
|
|
248
|
-
|
|
278
|
+
if (arg === "--replace" || arg.startsWith("--replace=")) {
|
|
279
|
+
refuseUnknown(command, "--replace", allowed);
|
|
280
|
+
const value = arg === "--replace" ? args[index + 1] : arg.slice("--replace=".length);
|
|
281
|
+
if (value === undefined || value.length === 0 || arg === "--replace" && value.startsWith("--")) {
|
|
249
282
|
throw new OkmError2("OKM1541", "--replace needs table.column.old=new.", {
|
|
250
283
|
fix: { summary: "Pass --replace <table>.<column>.<old>=<new>." }
|
|
251
284
|
});
|
|
252
285
|
}
|
|
253
286
|
flags.push(value);
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
if (arg.startsWith("--replace=")) {
|
|
258
|
-
flags.push(arg.slice("--replace=".length));
|
|
287
|
+
if (arg === "--replace")
|
|
288
|
+
index += 1;
|
|
259
289
|
continue;
|
|
260
290
|
}
|
|
261
291
|
if (arg === "--allow-protected") {
|
|
292
|
+
refuseUnknown(command, arg, allowed);
|
|
262
293
|
allowProtected = true;
|
|
263
294
|
continue;
|
|
264
295
|
}
|
|
265
296
|
if (arg === "--allow-pooler") {
|
|
297
|
+
refuseUnknown(command, arg, allowed);
|
|
266
298
|
allowPooler = true;
|
|
267
299
|
continue;
|
|
268
300
|
}
|
|
269
|
-
if (arg === "--
|
|
270
|
-
|
|
271
|
-
|
|
301
|
+
if (arg === "--provision") {
|
|
302
|
+
refuseUnknown(command, arg, allowed);
|
|
303
|
+
provision = true;
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
if (arg === "--json") {
|
|
307
|
+
refuseUnknown(command, arg, allowed);
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
if (arg === "--target" || arg.startsWith("--target=")) {
|
|
311
|
+
refuseUnknown(command, "--target", allowed);
|
|
312
|
+
const value = arg === "--target" ? args[index + 1] : arg.slice("--target=".length);
|
|
313
|
+
if (value === undefined || value.length === 0 || arg === "--target" && value.startsWith("--")) {
|
|
272
314
|
throw new OkmError2("OKM1853", "--target needs a name.", {
|
|
273
315
|
fix: { summary: "Pass --target <name>." }
|
|
274
316
|
});
|
|
275
317
|
}
|
|
276
318
|
target = value;
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
if (arg.startsWith("--target=")) {
|
|
281
|
-
target = arg.slice("--target=".length);
|
|
319
|
+
if (arg === "--target")
|
|
320
|
+
index += 1;
|
|
282
321
|
continue;
|
|
283
322
|
}
|
|
284
323
|
if (arg === "--lock-timeout" || arg === "--statement-timeout") {
|
|
324
|
+
refuseUnknown(command, arg, allowed);
|
|
285
325
|
const value = numberFlag(arg, args[index + 1]);
|
|
286
326
|
if (arg === "--lock-timeout")
|
|
287
327
|
lockTimeoutMs = value;
|
|
@@ -290,6 +330,13 @@ function splitFlags(args) {
|
|
|
290
330
|
index += 1;
|
|
291
331
|
continue;
|
|
292
332
|
}
|
|
333
|
+
if (arg.startsWith("-")) {
|
|
334
|
+
throw new OkmError2("invalid", `Unknown flag ${arg}.`, {
|
|
335
|
+
fix: {
|
|
336
|
+
summary: `Use okm ${command} --help for the flags this command accepts.`
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
}
|
|
293
340
|
positionals.push(arg);
|
|
294
341
|
}
|
|
295
342
|
return {
|
|
@@ -298,15 +345,25 @@ function splitFlags(args) {
|
|
|
298
345
|
target,
|
|
299
346
|
allowProtected,
|
|
300
347
|
allowPooler,
|
|
348
|
+
provision,
|
|
301
349
|
lockTimeoutMs,
|
|
302
350
|
statementTimeoutMs
|
|
303
351
|
};
|
|
304
352
|
}
|
|
353
|
+
function refuseUnknown(command, flag, allowed) {
|
|
354
|
+
if (allowed.has(flag))
|
|
355
|
+
return;
|
|
356
|
+
throw new OkmError2("invalid", `Unknown flag ${flag}.`, {
|
|
357
|
+
fix: {
|
|
358
|
+
summary: `Use okm ${command} --help for the flags this command accepts.`
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
}
|
|
305
362
|
var COMMANDS = [
|
|
306
363
|
["build", "Write the schema build."],
|
|
307
364
|
["catalog export", "Write the catalog snapshot."],
|
|
308
365
|
["check", "Lint the schema and compare it with one target."],
|
|
309
|
-
["dev", "
|
|
366
|
+
["dev", "Open a PGlite database in .okm/dev-db, or name a target called dev."],
|
|
310
367
|
["doctor [code]", "Print a target report, or one error code."],
|
|
311
368
|
["driver test <driver>", "Run conformance against one driver."],
|
|
312
369
|
["ext list", "List extensions the server can install."],
|
|
@@ -343,10 +400,31 @@ function commandHelp(argv) {
|
|
|
343
400
|
|
|
344
401
|
${commandsTable()}`;
|
|
345
402
|
}
|
|
346
|
-
|
|
347
|
-
|
|
403
|
+
const flags = flagsForHelp(found[0]);
|
|
404
|
+
const lines = [found[0], found[1]];
|
|
405
|
+
if (flags.length > 0) {
|
|
406
|
+
lines.push("", "Flags:");
|
|
407
|
+
for (const flag of flags)
|
|
408
|
+
lines.push(` ${flag}`);
|
|
409
|
+
}
|
|
410
|
+
return `${lines.join(`
|
|
411
|
+
`)}
|
|
348
412
|
`;
|
|
349
413
|
}
|
|
414
|
+
function flagsForHelp(commandLine) {
|
|
415
|
+
const key = helpCommandKey(commandLine);
|
|
416
|
+
if (key === undefined)
|
|
417
|
+
return [];
|
|
418
|
+
return COMMAND_FLAGS[key];
|
|
419
|
+
}
|
|
420
|
+
function helpCommandKey(commandLine) {
|
|
421
|
+
const name = commandLine.replace(/\s+\[.*?\]/g, "").replace(/\s+<.*?>/g, "").trim();
|
|
422
|
+
if (name in COMMAND_FLAGS)
|
|
423
|
+
return name;
|
|
424
|
+
if (name.startsWith("ext "))
|
|
425
|
+
return "ext";
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
350
428
|
function numberFlag(flag, value) {
|
|
351
429
|
const parsed = value === undefined ? Number.NaN : Number(value);
|
|
352
430
|
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
jsonb,
|
|
46
46
|
quote,
|
|
47
47
|
primaryUrl
|
|
48
|
-
} from "./shared/
|
|
48
|
+
} from "./shared/2jdn09e2.js";
|
|
49
49
|
import { createRequire } from "node:module";
|
|
50
50
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
51
51
|
|
|
@@ -352,8 +352,7 @@ function registerDriverSuite(suite) {
|
|
|
352
352
|
try {
|
|
353
353
|
const setting = await scalar(second, "SELECT current_setting('okm.p13', true)");
|
|
354
354
|
expect(setting).not.toBe("yes");
|
|
355
|
-
expect(await scalar(second,
|
|
356
|
-
expect(await scalar(second, "SELECT count(*)::text FROM pg_locks WHERE locktype = 'advisory' AND pid = pg_backend_pid()")).toBe("0");
|
|
355
|
+
expect(await scalar(second, `SELECT count(*)::text FROM pg_locks WHERE locktype = 'advisory' AND pid = ${pid}`)).toBe("0");
|
|
357
356
|
} finally {
|
|
358
357
|
await second.release();
|
|
359
358
|
}
|
|
@@ -444,9 +443,28 @@ async function using(open, fn) {
|
|
|
444
443
|
try {
|
|
445
444
|
await fn(pool);
|
|
446
445
|
} finally {
|
|
446
|
+
await dropOkmTables(pool);
|
|
447
447
|
await pool.close();
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
|
+
async function dropOkmTables(pool) {
|
|
451
|
+
try {
|
|
452
|
+
await pool.execute(`
|
|
453
|
+
do $$
|
|
454
|
+
declare
|
|
455
|
+
r record;
|
|
456
|
+
begin
|
|
457
|
+
for r in
|
|
458
|
+
select tablename
|
|
459
|
+
from pg_tables
|
|
460
|
+
where schemaname = current_schema()
|
|
461
|
+
and tablename like 'okm\\_%' escape '\\'
|
|
462
|
+
loop
|
|
463
|
+
execute format('drop table if exists %I cascade', r.tablename);
|
|
464
|
+
end loop;
|
|
465
|
+
end $$`);
|
|
466
|
+
} catch {}
|
|
467
|
+
}
|
|
450
468
|
function tableName() {
|
|
451
469
|
return `okm_${Math.random().toString(36).slice(2, 10)}`;
|
|
452
470
|
}
|
|
@@ -614,9 +632,28 @@ async function using2(open, fn) {
|
|
|
614
632
|
try {
|
|
615
633
|
await fn(pool);
|
|
616
634
|
} finally {
|
|
635
|
+
await dropOkmTables2(pool);
|
|
617
636
|
await pool.close();
|
|
618
637
|
}
|
|
619
638
|
}
|
|
639
|
+
async function dropOkmTables2(pool) {
|
|
640
|
+
try {
|
|
641
|
+
await pool.execute(`
|
|
642
|
+
do $$
|
|
643
|
+
declare
|
|
644
|
+
r record;
|
|
645
|
+
begin
|
|
646
|
+
for r in
|
|
647
|
+
select tablename
|
|
648
|
+
from pg_tables
|
|
649
|
+
where schemaname = current_schema()
|
|
650
|
+
and tablename like 'okm\\_%' escape '\\'
|
|
651
|
+
loop
|
|
652
|
+
execute format('drop table if exists %I cascade', r.tablename);
|
|
653
|
+
end loop;
|
|
654
|
+
end $$`);
|
|
655
|
+
} catch {}
|
|
656
|
+
}
|
|
620
657
|
async function mapped(pending) {
|
|
621
658
|
try {
|
|
622
659
|
await pending;
|
|
@@ -887,29 +924,29 @@ function readTenancy(value) {
|
|
|
887
924
|
}
|
|
888
925
|
|
|
889
926
|
// src/dialects/pg/filters.ts
|
|
890
|
-
function openFilters(table, relations, spec,
|
|
927
|
+
function openFilters(table, relations, spec, isHidden) {
|
|
891
928
|
const allow = spec.allow ?? {};
|
|
892
929
|
const sort = spec.sort ?? [];
|
|
893
930
|
for (const field of Object.keys(allow))
|
|
894
|
-
deny(
|
|
931
|
+
deny(isHidden, table, field);
|
|
895
932
|
for (const field of sort)
|
|
896
|
-
deny(
|
|
933
|
+
deny(isHidden, table, field);
|
|
897
934
|
const nested = spec.relations;
|
|
898
935
|
if (nested !== undefined) {
|
|
899
936
|
for (const name of Object.keys(nested)) {
|
|
900
937
|
const target = relationTable(relations, name);
|
|
901
938
|
for (const field of nested[name] ?? [])
|
|
902
|
-
deny(
|
|
939
|
+
deny(isHidden, target, field);
|
|
903
940
|
}
|
|
904
941
|
}
|
|
905
942
|
return {
|
|
906
943
|
parse(query) {
|
|
907
|
-
return import("./shared/
|
|
944
|
+
return import("./shared/f4gep0nk.js").then((mod) => mod.parseQuery(allow, sort, query, nested));
|
|
908
945
|
}
|
|
909
946
|
};
|
|
910
947
|
}
|
|
911
|
-
function deny(
|
|
912
|
-
if (!
|
|
948
|
+
function deny(isHidden, table, field) {
|
|
949
|
+
if (!isHidden(table, field))
|
|
913
950
|
return;
|
|
914
951
|
throw new OkmError("OKM1123", `Field ${table}.${field} is hidden.`, {
|
|
915
952
|
fix: {
|
|
@@ -962,7 +999,8 @@ function table2(name, columns, options) {
|
|
|
962
999
|
name,
|
|
963
1000
|
columns,
|
|
964
1001
|
filters(spec) {
|
|
965
|
-
|
|
1002
|
+
const ownHidden = hiddenColumnFields(columns);
|
|
1003
|
+
return openFilters(name, options?.relations, spec, (tableName, field) => tableName === name ? ownHidden.has(field) : hiddenFields.has(`${tableName}.${field}`));
|
|
966
1004
|
},
|
|
967
1005
|
...options !== undefined ? { options } : {},
|
|
968
1006
|
...source !== undefined ? { source } : {}
|
|
@@ -1026,11 +1064,23 @@ function rejectLater(options, known, later, where) {
|
|
|
1026
1064
|
}
|
|
1027
1065
|
}
|
|
1028
1066
|
var hiddenFields = new Set;
|
|
1029
|
-
function
|
|
1067
|
+
function hiddenColumnFields(columns) {
|
|
1068
|
+
const fields = new Set;
|
|
1030
1069
|
for (const field of Object.keys(columns)) {
|
|
1031
1070
|
const column = columns[field];
|
|
1032
1071
|
if (column?.state?.hidden === true)
|
|
1033
|
-
|
|
1072
|
+
fields.add(field);
|
|
1073
|
+
}
|
|
1074
|
+
return fields;
|
|
1075
|
+
}
|
|
1076
|
+
function remember(name, columns) {
|
|
1077
|
+
const prefix = `${name}.`;
|
|
1078
|
+
for (const key of hiddenFields) {
|
|
1079
|
+
if (key.startsWith(prefix))
|
|
1080
|
+
hiddenFields.delete(key);
|
|
1081
|
+
}
|
|
1082
|
+
for (const field of hiddenColumnFields(columns)) {
|
|
1083
|
+
hiddenFields.add(`${name}.${field}`);
|
|
1034
1084
|
}
|
|
1035
1085
|
}
|
|
1036
1086
|
|
|
@@ -4305,7 +4355,7 @@ function skipped(test, reason) {
|
|
|
4305
4355
|
return skipFor(test, reason, (name) => `${name} (${reason})`);
|
|
4306
4356
|
}
|
|
4307
4357
|
async function openSuiteAdmin(url) {
|
|
4308
|
-
const { openPostgres } = await import("./shared/
|
|
4358
|
+
const { openPostgres } = await import("./shared/gefmpwsa.js");
|
|
4309
4359
|
return openPostgres(url);
|
|
4310
4360
|
}
|
|
4311
4361
|
async function failure2(promise) {
|
|
@@ -4338,14 +4388,45 @@ function barrier(parties) {
|
|
|
4338
4388
|
}
|
|
4339
4389
|
|
|
4340
4390
|
// packages/harness/src/driver-run.ts
|
|
4391
|
+
var MIN_BUN = "1.4.0";
|
|
4341
4392
|
async function executeDriverTest(argv) {
|
|
4342
4393
|
process.env.TZ = "UTC";
|
|
4394
|
+
refuseOldBun();
|
|
4343
4395
|
const parsed = parseArgs(argv);
|
|
4344
4396
|
const target = await loadTarget(parsed.driver, parsed.url);
|
|
4345
4397
|
const rows = await runTarget(target);
|
|
4346
4398
|
const failed = rows.filter((row) => row.result === "fail").length;
|
|
4347
4399
|
return { text: render(target.name, rows), failed };
|
|
4348
4400
|
}
|
|
4401
|
+
function refuseOldBun() {
|
|
4402
|
+
if (typeof Bun === "undefined")
|
|
4403
|
+
return;
|
|
4404
|
+
const version = typeof Bun.version === "string" ? Bun.version : "";
|
|
4405
|
+
if (bunAtLeast(version, MIN_BUN))
|
|
4406
|
+
return;
|
|
4407
|
+
throw new Error(`okm driver test needs Bun >=${MIN_BUN} (package.json engines.bun). This process is ${version === "" ? "Bun (unknown version)" : `Bun ${version}`}.`);
|
|
4408
|
+
}
|
|
4409
|
+
function bunAtLeast(version, minimum) {
|
|
4410
|
+
const left = parseSemver(version);
|
|
4411
|
+
const right = parseSemver(minimum);
|
|
4412
|
+
if (left === undefined || right === undefined)
|
|
4413
|
+
return false;
|
|
4414
|
+
for (let index = 0;index < 3; index += 1) {
|
|
4415
|
+
const a = left[index] ?? 0;
|
|
4416
|
+
const b = right[index] ?? 0;
|
|
4417
|
+
if (a > b)
|
|
4418
|
+
return true;
|
|
4419
|
+
if (a < b)
|
|
4420
|
+
return false;
|
|
4421
|
+
}
|
|
4422
|
+
return true;
|
|
4423
|
+
}
|
|
4424
|
+
function parseSemver(value) {
|
|
4425
|
+
const match = /^(\d+)\.(\d+)\.(\d+)/.exec(value.trim());
|
|
4426
|
+
if (match === null)
|
|
4427
|
+
return;
|
|
4428
|
+
return [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
4429
|
+
}
|
|
4349
4430
|
if (__require.main == __require.module) {
|
|
4350
4431
|
executeDriverTest(process.argv.slice(2)).then((report) => {
|
|
4351
4432
|
process.stdout.write(report.text);
|
|
@@ -4403,8 +4484,8 @@ async function loadTarget(driver, url) {
|
|
|
4403
4484
|
}
|
|
4404
4485
|
async function firstParty(driver, url) {
|
|
4405
4486
|
if (driver === "pglite") {
|
|
4406
|
-
const adapter = await import("./shared/
|
|
4407
|
-
const runtime = await import("./shared/
|
|
4487
|
+
const adapter = await import("./shared/19msgrsc.js");
|
|
4488
|
+
const runtime = await import("./shared/p6tjv97k.js");
|
|
4408
4489
|
return {
|
|
4409
4490
|
name: "pglite",
|
|
4410
4491
|
capabilities: adapter.capabilities,
|
|
@@ -4419,8 +4500,8 @@ async function firstParty(driver, url) {
|
|
|
4419
4500
|
if (url === undefined)
|
|
4420
4501
|
throw new Error(`okm driver test ${driver} needs --url or DATABASE_URL.`);
|
|
4421
4502
|
if (driver === "postgresjs") {
|
|
4422
|
-
const adapter = await import("./shared/
|
|
4423
|
-
const runtime = await import("./shared/
|
|
4503
|
+
const adapter = await import("./shared/d8q00vxg.js");
|
|
4504
|
+
const runtime = await import("./shared/y4gq9rbe.js");
|
|
4424
4505
|
return networked("postgres.js", adapter.capabilities, true, url, (config) => adapter.open({
|
|
4425
4506
|
url: config.url ?? url,
|
|
4426
4507
|
max: config.max,
|
|
@@ -4429,8 +4510,8 @@ async function firstParty(driver, url) {
|
|
|
4429
4510
|
}), (pool, options) => runtime.connect(pool, options));
|
|
4430
4511
|
}
|
|
4431
4512
|
if (driver === "pg") {
|
|
4432
|
-
const adapter = await import("./shared/
|
|
4433
|
-
const runtime = await import("./shared/
|
|
4513
|
+
const adapter = await import("./shared/jm30k2ca.js");
|
|
4514
|
+
const runtime = await import("./shared/2qrte2ct.js");
|
|
4434
4515
|
return networked("node-postgres", adapter.capabilities, true, url, (config) => adapter.open({
|
|
4435
4516
|
url: config.url ?? url,
|
|
4436
4517
|
max: config.max,
|
|
@@ -4439,8 +4520,8 @@ async function firstParty(driver, url) {
|
|
|
4439
4520
|
}), (pool, options) => runtime.connect(pool, options));
|
|
4440
4521
|
}
|
|
4441
4522
|
if (driver === "neon") {
|
|
4442
|
-
const adapter = await import("./shared/
|
|
4443
|
-
const runtime = await import("./shared/
|
|
4523
|
+
const adapter = await import("./shared/0v9ptnxp.js");
|
|
4524
|
+
const runtime = await import("./shared/jgzt69pa.js");
|
|
4444
4525
|
return networked("neon", adapter.capabilities, false, url, (config) => adapter.open({
|
|
4445
4526
|
url: config.url ?? url,
|
|
4446
4527
|
max: config.max,
|
|
@@ -4451,8 +4532,8 @@ async function firstParty(driver, url) {
|
|
|
4451
4532
|
if (typeof Bun === "undefined" || typeof Bun.SQL !== "function") {
|
|
4452
4533
|
throw new Error("bun runs only under Bun.");
|
|
4453
4534
|
}
|
|
4454
|
-
const adapter = await import("./shared/
|
|
4455
|
-
const runtime = await import("./shared/
|
|
4535
|
+
const adapter = await import("./shared/ryc5sa58.js");
|
|
4536
|
+
const runtime = await import("./shared/0yhf1db4.js");
|
|
4456
4537
|
return networked("bun.sql", adapter.capabilities, false, url, (config) => adapter.open({
|
|
4457
4538
|
url: config.url ?? url,
|
|
4458
4539
|
max: config.max,
|
|
@@ -4650,5 +4731,7 @@ function render(driver, rows) {
|
|
|
4650
4731
|
`;
|
|
4651
4732
|
}
|
|
4652
4733
|
export {
|
|
4734
|
+
MIN_BUN,
|
|
4735
|
+
bunAtLeast,
|
|
4653
4736
|
executeDriverTest
|
|
4654
4737
|
};
|
|
@@ -10,10 +10,14 @@ import { type PlanDocument } from "../migrate/plan-json.js";
|
|
|
10
10
|
* A later push updates the comment whose body contains this marker.
|
|
11
11
|
*/
|
|
12
12
|
export declare const PLAN_COMMENT_MARKER = "<!-- okmodel-migrate-plan -->";
|
|
13
|
+
/** Default login that posts the Action comment with `GITHUB_TOKEN`. */
|
|
14
|
+
export declare const PLAN_COMMENT_BOT = "github-actions[bot]";
|
|
13
15
|
/** A comment the sticky update may replace. */
|
|
14
16
|
export type StickyComment = {
|
|
15
17
|
readonly id: number;
|
|
16
18
|
readonly body: string;
|
|
19
|
+
/** GitHub login of the comment author. */
|
|
20
|
+
readonly author: string;
|
|
17
21
|
};
|
|
18
22
|
/**
|
|
19
23
|
* Renders the plan comment.
|
|
@@ -38,13 +42,15 @@ export declare function renderPlanComment(plan: PlanDocument): string;
|
|
|
38
42
|
*/
|
|
39
43
|
export declare function planCommentBody(text: string | undefined, checkStatus: string, planStatus: string): string;
|
|
40
44
|
/**
|
|
41
|
-
* The comment to update, when one already carries the marker.
|
|
45
|
+
* The comment to update, when one already carries the marker and an allowed author.
|
|
42
46
|
*
|
|
43
47
|
* The first match wins. A missing match means the caller creates a comment.
|
|
48
|
+
* A marker on another author's comment is ignored so the Action never edits it.
|
|
44
49
|
*
|
|
45
50
|
* @param comments - Comments already on the pull request
|
|
51
|
+
* @param authors - Logins allowed to own the sticky comment. Default is the Actions bot
|
|
46
52
|
* @returns The id to update, or `undefined` to create one
|
|
47
53
|
*/
|
|
48
|
-
export declare function stickyCommentTarget(comments: readonly StickyComment[]): {
|
|
54
|
+
export declare function stickyCommentTarget(comments: readonly StickyComment[], authors?: readonly string[]): {
|
|
49
55
|
readonly updateId: number;
|
|
50
56
|
} | undefined;
|
|
@@ -93,6 +93,20 @@ export type ApplyRequest = {
|
|
|
93
93
|
readonly reference: readonly ReferenceTable[];
|
|
94
94
|
readonly only?: boolean;
|
|
95
95
|
};
|
|
96
|
+
/**
|
|
97
|
+
* Catalog hash `okm_meta` must record when this run finishes.
|
|
98
|
+
*
|
|
99
|
+
* When the plan (or pending units) leave the database matching the schema
|
|
100
|
+
* but `okm_meta` still holds an older hash — for example an external table
|
|
101
|
+
* gained a column and the dependent exported a new snapshot — the runner
|
|
102
|
+
* re-stamps `okm_meta` and `okm_history` under a fresh id. File apply only
|
|
103
|
+
* enables that path when `defineConfig({ external })` is set; a foreign or
|
|
104
|
+
* legacy hash without external snapshots is left for connect or the pre-D208
|
|
105
|
+
* restamp.
|
|
106
|
+
*/
|
|
107
|
+
readonly headHash?: string;
|
|
108
|
+
/** When true, an empty apply may re-stamp `okm_meta` to {@link headHash}. */
|
|
109
|
+
readonly restampHead?: boolean;
|
|
96
110
|
};
|
|
97
111
|
/** Migrations that ran at least one step in this invocation. */
|
|
98
112
|
export type ApplyReport = {
|
|
@@ -147,8 +161,9 @@ export declare function applyProject(cwd: string, flags: InvokeFlags, write?: (t
|
|
|
147
161
|
/**
|
|
148
162
|
* Prototype sync. Blocked on a protected target.
|
|
149
163
|
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
164
|
+
* Plans from the live catalog on the target (not the last migration file),
|
|
165
|
+
* applies under a fresh `push-<n>` id from `okm_history`, and re-stamps
|
|
166
|
+
* `okm_meta` when the schema hash moved with no DDL (B-29, B-21).
|
|
152
167
|
*
|
|
153
168
|
* @param cwd - Project directory
|
|
154
169
|
* @param flags - Target and protection flags
|