okmodel 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/capabilities.d.ts +32 -0
- package/dist/adapters/failure.d.ts +1 -1
- package/dist/adapters/pg/bun-sql.d.ts +53 -0
- package/dist/adapters/pg/bunsql-extra.d.ts +1 -1
- package/dist/adapters/pg/bunsql.d.ts +1 -1
- package/dist/adapters/pg/neon-extra.d.ts +18 -0
- package/dist/adapters/pg/neon.d.ts +104 -0
- package/dist/adapters/pg/no-inflight-timeout.d.ts +1 -1
- package/dist/contracts/error.d.ts +1 -1
- package/dist/dialects/pg/fn/index.d.ts +39 -1
- package/dist/dialects/pg/fn/index.js +118 -26
- package/dist/dialects/pg/index.d.ts +2 -0
- package/dist/dialects/pg/index.js +393 -18
- package/dist/dialects/pg/introspect.d.ts +11 -0
- package/dist/dialects/pg/operators.d.ts +1 -1
- package/dist/dialects/pg/ops/fragment.d.ts +119 -0
- package/dist/dialects/pg/ops/lane.d.ts +49 -0
- package/dist/dialects/pg/view/client.d.ts +14 -6
- package/dist/dialects/pg/view/index.d.ts +73 -1
- package/dist/dialects/pg/view/index.js +156 -5
- package/dist/dialects/pg/view/scratch.d.ts +8 -5
- package/dist/runtime/otel.d.ts +105 -0
- package/dist/runtime/otel.js +97 -0
- package/dist/runtime/pg/bun.js +4 -4
- package/dist/runtime/pg/neon.d.ts +38 -0
- package/dist/runtime/pg/neon.js +64 -0
- package/dist/runtime/pg/pg.js +4 -4
- package/dist/runtime/pg/pglite.js +4 -4
- package/dist/runtime/pg/postgresjs.js +4 -4
- package/dist/runtime/plan.d.ts +1 -1
- package/dist/runtime/sql-fragment.d.ts +43 -0
- package/dist/runtime/tenancy/index.js +10 -10
- package/dist/runtime/topology.d.ts +1 -1
- package/dist/runtime/traits/index.js +15 -16
- package/dist/runtime/types.d.ts +15 -1
- package/dist/runtime/validate/index.js +4 -4
- package/dist/shared/{mtaszv5a.js → 0wrea3jq.js} +102 -4
- package/dist/shared/{qq3899ht.js → 12z7aznj.js} +243 -14
- package/dist/shared/{w79hsckn.js → 14x60fbf.js} +5 -5
- package/dist/shared/{ek2wt2dz.js → 16kvjebh.js} +4 -4
- package/dist/shared/{svncdeh5.js → 195pzzzz.js} +8 -8
- package/dist/shared/{gzaveazc.js → 1d9q9cv2.js} +29 -2
- package/dist/shared/{jvd0mqag.js → 3449rcae.js} +5 -5
- package/dist/shared/{14vx95q4.js → 35q0n9tz.js} +7 -7
- package/dist/shared/3bb7wsqt.js +99 -0
- package/dist/shared/{y6njgyda.js → 3t6kw83m.js} +2 -2
- package/dist/shared/{81ebdx9p.js → 4m6hskg8.js} +4 -4
- package/dist/shared/{xhfsfkgk.js → 4vbf83xx.js} +9 -2
- package/dist/shared/{bg3rym3g.js → 63f4ksbz.js} +2 -2
- package/dist/shared/{pt94kz7f.js → 6m78c8ss.js} +1 -1
- package/dist/shared/{5e3tf63j.js → 760ppr76.js} +14 -6
- package/dist/shared/{zm0ptry0.js → 7ghwamrf.js} +1 -1
- package/dist/shared/{xnxsed62.js → 9dr2qnx7.js} +14 -14
- package/dist/shared/{h15jx9bc.js → 9dvh1dr6.js} +1 -1
- package/dist/shared/{q5c6ngn3.js → a62rb2da.js} +1 -1
- package/dist/shared/{kb2sdhfb.js → ae4j5f42.js} +17 -1
- package/dist/shared/agsfb86s.js +233 -0
- package/dist/shared/{7k9grvf6.js → b6d6p0zc.js} +5 -5
- package/dist/shared/{tbrvgw6z.js → bah9nbg3.js} +17 -16
- package/dist/shared/{5fe3kbsh.js → bnby0esn.js} +1 -1
- package/dist/shared/bsek72fg.js +225 -0
- package/dist/shared/{1w508jbr.js → bxas03mq.js} +21 -17
- package/dist/shared/{dk8v79p3.js → d5nmj7vv.js} +1 -1
- package/dist/shared/{tsvww22q.js → dpc2r7rb.js} +7 -7
- package/dist/shared/{vb6qfyve.js → e8zyaqvj.js} +2 -2
- package/dist/shared/{hyh73qk6.js → ecn8mfdq.js} +5 -5
- package/dist/shared/{gs74dbj5.js → f4jy1j7x.js} +27 -14
- package/dist/shared/{ttsqgp4p.js → fjpnhqan.js} +2 -2
- package/dist/shared/{xjk7hnn5.js → g5yc06ka.js} +2 -2
- package/dist/shared/{w72kgg4q.js → hfqmpasr.js} +6 -6
- package/dist/shared/{kr0jzbw2.js → hm5f8jby.js} +7 -7
- package/dist/shared/{dkxgzaqd.js → hqpxf4a4.js} +1 -1
- package/dist/shared/{cn957f8d.js → jebgrkeq.js} +3 -3
- package/dist/shared/{wa07eas9.js → jp36k7dp.js} +11 -11
- package/dist/shared/jx2m62cs.js +96 -0
- package/dist/shared/{sfz1ksn6.js → k86n8vq3.js} +2 -2
- package/dist/shared/{67txcrcw.js → kgwp4jdd.js} +4 -4
- package/dist/shared/{8skf0cam.js → kj9d8maq.js} +1 -1
- package/dist/shared/{aytqh5y2.js → m4xff2a6.js} +2 -2
- package/dist/shared/{zp9fmend.js → mfedzr74.js} +4 -4
- package/dist/shared/{ax7qv55k.js → mkrn359n.js} +60 -11
- package/dist/shared/{m6p12kbr.js → mnvjvqyp.js} +10 -10
- package/dist/shared/{1qa0qajz.js → mtw6jz76.js} +1 -1
- package/dist/shared/{1est4ezg.js → n05z9nwz.js} +3 -3
- package/dist/shared/{pbp1ss85.js → n0jmpgj1.js} +2 -2
- package/dist/shared/{ktz42yez.js → n41w4fbz.js} +5 -5
- package/dist/shared/{n816peh1.js → n454kcnw.js} +1 -1
- package/dist/shared/n7kg8mmx.js +61 -0
- package/dist/shared/{g6evj1j3.js → needfe47.js} +1 -1
- package/dist/shared/{2shdbn8q.js → njga14v4.js} +9 -9
- package/dist/shared/{vqrjpcqn.js → nmnsgj7x.js} +1 -1
- package/dist/shared/{b5pftnn2.js → p3xbdcvt.js} +14 -18
- package/dist/shared/{te5as7z7.js → p5nh3r8q.js} +3 -3
- package/dist/shared/{p6qc5gcp.js → pan0370z.js} +6 -6
- package/dist/shared/{79dt02vc.js → q0cqt2sp.js} +1 -1
- package/dist/shared/{5v3xf80k.js → qd9hhd8f.js} +1 -1
- package/dist/shared/{bm22fvzr.js → qfw14tna.js} +2 -2
- package/dist/shared/{9s0ypp87.js → sjk86yrx.js} +1 -1
- package/dist/shared/{3v7t1yrv.js → th3be82n.js} +2 -2
- package/dist/shared/{ed0b8k4s.js → typ3vy7t.js} +1 -1
- package/dist/shared/{vczs8gd4.js → v1wad97q.js} +2 -2
- package/dist/shared/{9628a9xt.js → vk7rag46.js} +1 -1
- package/dist/shared/{ze4hxsmy.js → w9ejzaqf.js} +1 -1
- package/dist/shared/{bz84tkzm.js → wcrheftc.js} +2 -2
- package/dist/shared/{ab9gmbwy.js → wvdjznah.js} +5 -5
- package/dist/shared/{7mnme5tn.js → wz2a78mp.js} +1 -1
- package/dist/shared/{9y3mmmh1.js → xfhe73sb.js} +1 -1
- package/dist/shared/{je4axnm8.js → z581d7ny.js} +2 -2
- package/dist/shared/{x933k9a3.js → zbqbmmrp.js} +10 -10
- package/dist/shared/{rs73fca9.js → zgex00fd.js} +6 -6
- package/dist/shared/{jznfax0y.js → zq1he88x.js} +4 -4
- package/dist/tooling/cli.js +26 -13
- package/dist/tooling/driver-run.js +4971 -0
- package/dist/tooling/driver-test.d.ts +36 -0
- package/dist/tooling/migrate/commands.d.ts +2 -2
- package/dist/tooling/migrate/index.js +9 -9
- package/dist/tooling/migrate/project.d.ts +3 -0
- package/dist/tooling/shared/03k6res6.js +210 -0
- package/dist/tooling/shared/08kemxjd.js +10 -0
- package/dist/tooling/shared/2revefqt.js +209 -0
- package/dist/tooling/shared/2wtvc7rw.js +1425 -0
- package/dist/tooling/shared/345tbc2k.js +16 -0
- package/dist/tooling/shared/3m1hkg7z.js +344 -0
- package/dist/tooling/shared/3rrw5w8f.js +81 -0
- package/dist/tooling/shared/3tq8pnb8.js +131 -0
- package/dist/tooling/shared/417zdsk7.js +194 -0
- package/dist/tooling/shared/4d2w25vw.js +40 -0
- package/dist/tooling/shared/54tqkxja.js +51 -0
- package/dist/tooling/shared/5bvw2nev.js +12 -0
- package/dist/tooling/shared/6nyfyw70.js +231 -0
- package/dist/tooling/shared/72fyg4zv.js +160 -0
- package/dist/tooling/shared/733a1tq3.js +38 -0
- package/dist/tooling/shared/7ae7rjmn.js +20 -0
- package/dist/tooling/shared/7kms6fvj.js +20 -0
- package/dist/tooling/shared/8sqrsw3s.js +49 -0
- package/dist/tooling/shared/96ps4g1z.js +32 -0
- package/dist/tooling/shared/9kazs5p6.js +195 -0
- package/dist/tooling/shared/9xzm7hjg.js +38 -0
- package/dist/tooling/shared/a6pp9d12.js +49 -0
- package/dist/tooling/shared/a7q7t4n3.js +22 -0
- package/dist/tooling/shared/aftb2mwr.js +18 -0
- package/dist/tooling/shared/bz2dqhab.js +311 -0
- package/dist/tooling/shared/cmptmb4f.js +12 -0
- package/dist/tooling/shared/ddjtfgnx.js +177 -0
- package/dist/tooling/shared/djydjpqt.js +261 -0
- package/dist/tooling/shared/dw08f3m8.js +9 -0
- package/dist/tooling/shared/dy672fz6.js +16 -0
- package/dist/tooling/shared/dzx85q70.js +66 -0
- package/dist/tooling/shared/ec71zqgt.js +270 -0
- package/dist/tooling/shared/ep8zh3bk.js +6 -0
- package/dist/tooling/shared/f9mphxej.js +3789 -0
- package/dist/tooling/shared/fb9k2qwd.js +89 -0
- package/dist/tooling/shared/g9ad4n80.js +211 -0
- package/dist/tooling/shared/gfvtj6d0.js +94 -0
- package/dist/tooling/shared/gmcf9cxf.js +294 -0
- package/dist/tooling/shared/htnaj77v.js +17 -0
- package/dist/tooling/shared/j9t5s12a.js +7 -0
- package/dist/tooling/shared/jne7b93p.js +42 -0
- package/dist/tooling/shared/ma2340rx.js +118 -0
- package/dist/tooling/shared/mtrqn2hn.js +505 -0
- package/dist/tooling/shared/n4jqhpqz.js +27 -0
- package/dist/tooling/shared/nf7jmhfa.js +20 -0
- package/dist/tooling/shared/p7f08ktn.js +332 -0
- package/dist/tooling/shared/ppnnnvj8.js +13 -0
- package/dist/tooling/shared/pqy21k24.js +312 -0
- package/dist/tooling/shared/pw8fgahx.js +69 -0
- package/dist/tooling/shared/pwsytxm5.js +17 -0
- package/dist/tooling/shared/rf83gr2d.js +94 -0
- package/dist/tooling/shared/rq5kk8j6.js +401 -0
- package/dist/tooling/shared/rs1jb051.js +12 -0
- package/dist/tooling/shared/smn6kz1p.js +157 -0
- package/dist/tooling/shared/spk1jg3r.js +1696 -0
- package/dist/tooling/shared/tn8gay14.js +143 -0
- package/dist/tooling/shared/vraj6d74.js +42 -0
- package/dist/tooling/shared/vs0t6qt8.js +64 -0
- package/dist/tooling/shared/vx86qjv8.js +150 -0
- package/dist/tooling/shared/w7qe8sj1.js +140 -0
- package/dist/tooling/shared/wt7j7nf6.js +15 -0
- package/dist/tooling/shared/wwnekq5n.js +6 -0
- package/dist/tooling/shared/xhrnjch9.js +185 -0
- package/dist/tooling/shared/xjs6zqtc.js +190 -0
- package/dist/tooling/shared/y031jct9.js +16 -0
- package/dist/tooling/shared/y5656f0e.js +233 -0
- package/dist/tooling/shared/yfr8hzhm.js +604 -0
- package/dist/tooling/shared/yk9mp7vb.js +250 -0
- package/dist/tooling/shared/yw30vnq2.js +139 -0
- package/dist/tooling/shared/z8d7ptht.js +618 -0
- package/dist/tooling/shared/zhwnfyb2.js +9 -0
- package/dist/tooling/shared/zvnhh1n0.js +198 -0
- package/dist/tooling/testing/index.js +3 -3
- package/package.json +14 -2
- package/dist/shared/y34a8714.js +0 -150
- package/dist/shared/zy8r7qvz.js +0 -116
- package/dist/shared/{ywr8hmey.js → 606g0nbf.js} +3 -3
- package/dist/shared/{rpycarcr.js → gcefca6p.js} +4 -4
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseCatalog2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./12z7aznj.js";
|
|
4
4
|
import"./n442h54c.js";
|
|
5
5
|
import"./cm3w0ywp.js";
|
|
6
|
-
import"./
|
|
6
|
+
import"./35q0n9tz.js";
|
|
7
7
|
import {
|
|
8
8
|
watchReserved2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./wcrheftc.js";
|
|
10
10
|
import {
|
|
11
11
|
ensureMigrationTables2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./pan0370z.js";
|
|
13
13
|
import {
|
|
14
14
|
sealViews,
|
|
15
15
|
catalogQuery2,
|
|
16
16
|
managedRoleOptions2
|
|
17
|
-
} from "./
|
|
17
|
+
} from "./mkrn359n.js";
|
|
18
18
|
import {
|
|
19
19
|
assumeRole,
|
|
20
20
|
grantSchema,
|
|
21
21
|
assertSchemaUsageLanded,
|
|
22
22
|
catalogsEqual,
|
|
23
23
|
snapshotDifference
|
|
24
|
-
} from "./
|
|
24
|
+
} from "./mnvjvqyp.js";
|
|
25
25
|
import {
|
|
26
26
|
roleExists
|
|
27
|
-
} from "./
|
|
27
|
+
} from "./kj9d8maq.js";
|
|
28
28
|
import {
|
|
29
29
|
introspectSchema
|
|
30
|
-
} from "./
|
|
30
|
+
} from "./p3xbdcvt.js";
|
|
31
31
|
import {
|
|
32
32
|
projectPath,
|
|
33
33
|
loadMigrations,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
hasError,
|
|
37
37
|
lintRefusal,
|
|
38
38
|
openProject
|
|
39
|
-
} from "./
|
|
39
|
+
} from "./f4jy1j7x.js";
|
|
40
40
|
import {
|
|
41
41
|
sqlStatements,
|
|
42
42
|
transactionControl,
|
|
@@ -51,13 +51,13 @@ import {
|
|
|
51
51
|
assertDirectConnection,
|
|
52
52
|
assertStableBackend,
|
|
53
53
|
selectTarget
|
|
54
|
-
} from "./
|
|
54
|
+
} from "./dpc2r7rb.js";
|
|
55
55
|
import {
|
|
56
56
|
isConnectionLost
|
|
57
57
|
} from "./cnkky55j.js";
|
|
58
58
|
import {
|
|
59
59
|
quoteIdent
|
|
60
|
-
} from "./
|
|
60
|
+
} from "./sjk86yrx.js";
|
|
61
61
|
import {
|
|
62
62
|
catalog,
|
|
63
63
|
isDomain
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DriverError2
|
|
3
|
+
} from "./cm3w0ywp.js";
|
|
4
|
+
import {
|
|
5
|
+
connectClient2,
|
|
6
|
+
send3
|
|
7
|
+
} from "./agsfb86s.js";
|
|
8
|
+
import {
|
|
9
|
+
resetSession2
|
|
10
|
+
} from "./7ghwamrf.js";
|
|
11
|
+
import {
|
|
12
|
+
isConnectionLost
|
|
13
|
+
} from "./cnkky55j.js";
|
|
14
|
+
import {
|
|
15
|
+
noTimeout
|
|
16
|
+
} from "./q0cqt2sp.js";
|
|
17
|
+
import {
|
|
18
|
+
WireSession
|
|
19
|
+
} from "./mtw6jz76.js";
|
|
20
|
+
import {
|
|
21
|
+
rejectClosed,
|
|
22
|
+
runCall
|
|
23
|
+
} from "./ae4j5f42.js";
|
|
24
|
+
|
|
25
|
+
// src/adapters/pg/neon-extra.ts
|
|
26
|
+
async function checkout(held) {
|
|
27
|
+
const { pool, counters, named, isClosed } = held;
|
|
28
|
+
if (isClosed())
|
|
29
|
+
return rejectClosed();
|
|
30
|
+
const client = await connectClient2(pool, held.acquireMs, counters);
|
|
31
|
+
counters.reserved += 1;
|
|
32
|
+
let lost = false;
|
|
33
|
+
const onError = () => {
|
|
34
|
+
lost = true;
|
|
35
|
+
};
|
|
36
|
+
const events = client;
|
|
37
|
+
events.on("error", onError);
|
|
38
|
+
const local = new Set;
|
|
39
|
+
const session = new WireSession((text, params) => {
|
|
40
|
+
const pending = send3(client, text, params, named);
|
|
41
|
+
const guarded = pending.catch((error) => {
|
|
42
|
+
if (isConnectionLost(error) || lost) {
|
|
43
|
+
lost = true;
|
|
44
|
+
if (isConnectionLost(error))
|
|
45
|
+
throw error;
|
|
46
|
+
throw Object.assign(new DriverError2("CONNECTION_CLOSED", { cause: error }), {
|
|
47
|
+
code: "CONNECTION_CLOSED"
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
throw error;
|
|
51
|
+
});
|
|
52
|
+
return guarded;
|
|
53
|
+
}, held.notices, isClosed, false, () => {
|
|
54
|
+
counters.reservedBusy += 1;
|
|
55
|
+
}, () => {
|
|
56
|
+
counters.reservedBusy = Math.max(0, counters.reservedBusy - 1);
|
|
57
|
+
}, local);
|
|
58
|
+
const guard = (run) => lost ? rejectClosed() : run();
|
|
59
|
+
let released = false;
|
|
60
|
+
return {
|
|
61
|
+
execute: (text, params, options) => {
|
|
62
|
+
const refused = noTimeout(options);
|
|
63
|
+
if (refused !== undefined)
|
|
64
|
+
return refused;
|
|
65
|
+
return guard(() => runCall(isClosed(), options, (watch) => session.query(text, params, watch)));
|
|
66
|
+
},
|
|
67
|
+
batch: (statements, options) => {
|
|
68
|
+
const refused = noTimeout(options);
|
|
69
|
+
if (refused !== undefined)
|
|
70
|
+
return refused;
|
|
71
|
+
return guard(() => runCall(isClosed(), options, async (watch) => {
|
|
72
|
+
const { runAtomicBatch } = await import("./b76b8d95.js");
|
|
73
|
+
return runAtomicBatch(session, statements, watch);
|
|
74
|
+
}));
|
|
75
|
+
},
|
|
76
|
+
async release() {
|
|
77
|
+
if (released)
|
|
78
|
+
return;
|
|
79
|
+
released = true;
|
|
80
|
+
try {
|
|
81
|
+
if (!lost)
|
|
82
|
+
await reset(session, client);
|
|
83
|
+
} finally {
|
|
84
|
+
counters.reserved = Math.max(0, counters.reserved - 1);
|
|
85
|
+
events.removeListener("error", onError);
|
|
86
|
+
client.release(lost);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
async function reset(session, client) {
|
|
92
|
+
await resetSession2(session.depth(), (text) => client.query(text));
|
|
93
|
+
}
|
|
94
|
+
export {
|
|
95
|
+
checkout
|
|
96
|
+
};
|
|
@@ -138,12 +138,12 @@ function needsOperatorSql(table, value, key) {
|
|
|
138
138
|
function isTextColumn(dataType) {
|
|
139
139
|
return dataType === "text" || dataType === "citext" || dataType.startsWith("varchar(") || dataType.startsWith("char(") || dataType.startsWith("character");
|
|
140
140
|
}
|
|
141
|
-
function emitLazy(column, ref, name, value, sink, order) {
|
|
141
|
+
function emitLazy(table, column, ref, name, value, sink, order) {
|
|
142
142
|
const emit = operatorEmit;
|
|
143
143
|
if (emit === undefined) {
|
|
144
144
|
fail2("OKM1121", `Operator ${name} on ${column.field} is not loaded.`);
|
|
145
145
|
}
|
|
146
|
-
emit(column, ref, name, value, sink, order);
|
|
146
|
+
emit(table, column, ref, name, value, sink, order);
|
|
147
147
|
}
|
|
148
148
|
function verifyRead(schema, call) {
|
|
149
149
|
if (!safetyInstalled())
|
|
@@ -511,7 +511,7 @@ function emitOperator(schema, table, column, ref, name, value, sink, alias, dept
|
|
|
511
511
|
sink.text(" escape E'\\\\'");
|
|
512
512
|
return;
|
|
513
513
|
}
|
|
514
|
-
emitLazy(column, ref, name, value, sink);
|
|
514
|
+
emitLazy(table, column, ref, name, value, sink);
|
|
515
515
|
}
|
|
516
516
|
function emitNot(schema, table, column, ref, value, sink, alias, depth) {
|
|
517
517
|
if (value === null) {
|
|
@@ -636,7 +636,7 @@ function emitOrder(table, orderBy, sink, alias) {
|
|
|
636
636
|
if (index > 0)
|
|
637
637
|
sink.text(", ");
|
|
638
638
|
if (isOperator(value) && operatorName(value) === "relevance") {
|
|
639
|
-
emitLazy(column, `${alias}.${quote(column.sql)}`, "relevance", operatorValue(value), sink, true);
|
|
639
|
+
emitLazy(table, column, `${alias}.${quote(column.sql)}`, "relevance", operatorValue(value), sink, true);
|
|
640
640
|
continue;
|
|
641
641
|
}
|
|
642
642
|
const parsed = parseOrder(key, value);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
open3,
|
|
3
3
|
seal2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./4m6hskg8.js";
|
|
5
5
|
import {
|
|
6
6
|
PGLITE_CAPABILITIES,
|
|
7
7
|
readCapability2,
|
|
8
8
|
hasCapability2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./ae4j5f42.js";
|
|
10
10
|
export {
|
|
11
11
|
PGLITE_CAPABILITIES as capabilities,
|
|
12
12
|
hasCapability2 as hasCapability,
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
armDriverError,
|
|
6
6
|
send,
|
|
7
7
|
connectClient
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./14x60fbf.js";
|
|
9
9
|
import {
|
|
10
10
|
resetSession2
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./7ghwamrf.js";
|
|
12
12
|
import {
|
|
13
13
|
cursorStream
|
|
14
14
|
} from "./7kms6fvj.js";
|
|
@@ -17,11 +17,11 @@ import {
|
|
|
17
17
|
} from "./cnkky55j.js";
|
|
18
18
|
import {
|
|
19
19
|
WireSession
|
|
20
|
-
} from "./
|
|
20
|
+
} from "./mtw6jz76.js";
|
|
21
21
|
import {
|
|
22
22
|
rejectClosed,
|
|
23
23
|
runCall
|
|
24
|
-
} from "./
|
|
24
|
+
} from "./ae4j5f42.js";
|
|
25
25
|
|
|
26
26
|
// src/adapters/pg/nodepostgres-extra.ts
|
|
27
27
|
async function checkout(held) {
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
normaliseViewQuery,
|
|
3
|
+
viewObject,
|
|
4
|
+
materializedViewObject
|
|
5
|
+
} from "./12z7aznj.js";
|
|
1
6
|
import {
|
|
2
7
|
cellText,
|
|
3
8
|
VIEW_DEPENDENCIES,
|
|
4
9
|
viewDependencyEdges,
|
|
5
10
|
PUBLIC,
|
|
6
|
-
introspectSchema
|
|
7
|
-
|
|
11
|
+
introspectSchema,
|
|
12
|
+
atomicBody
|
|
13
|
+
} from "./p3xbdcvt.js";
|
|
8
14
|
import {
|
|
9
15
|
planMigration,
|
|
10
16
|
sessionFailure,
|
|
11
17
|
finishQuiet,
|
|
12
18
|
assertDirectConnection,
|
|
13
19
|
assertStableBackend
|
|
14
|
-
} from "./
|
|
20
|
+
} from "./dpc2r7rb.js";
|
|
15
21
|
import {
|
|
16
22
|
quoteIdent,
|
|
17
23
|
createObjectSql
|
|
18
|
-
} from "./
|
|
19
|
-
import {
|
|
20
|
-
normaliseViewQuery,
|
|
21
|
-
viewObject,
|
|
22
|
-
materializedViewObject
|
|
23
|
-
} from "./zy8r7qvz.js";
|
|
24
|
+
} from "./sjk86yrx.js";
|
|
24
25
|
import {
|
|
25
26
|
catalog
|
|
26
27
|
} from "./ywspezzx.js";
|
|
@@ -49,7 +50,8 @@ var VIEW_SHAPE = `
|
|
|
49
50
|
`;
|
|
50
51
|
async function sealViews(runner, source) {
|
|
51
52
|
const views = source.objects.filter((object) => object.kind === "view" || object.kind === "materializedView");
|
|
52
|
-
|
|
53
|
+
const hasAtomic = source.objects.some((object) => object.kind === "function" && object.definition.atomic === true);
|
|
54
|
+
if (views.length === 0 && !hasAtomic)
|
|
53
55
|
return source;
|
|
54
56
|
await dropScratch(runner);
|
|
55
57
|
await runner.query(`create schema ${quoteIdent(SCRATCH)}`);
|
|
@@ -65,12 +67,15 @@ async function sealViews(runner, source) {
|
|
|
65
67
|
await runner.query(stubTable(object, source));
|
|
66
68
|
}
|
|
67
69
|
await createObjects(runner, source, "function");
|
|
70
|
+
const reprinted = await reprintAtomicBodies(runner, source);
|
|
71
|
+
if (views.length === 0)
|
|
72
|
+
return reprinted;
|
|
68
73
|
await createViews(runner, views);
|
|
69
74
|
const shapes = await runner.query(VIEW_SHAPE, [SCRATCH]);
|
|
70
75
|
const deps = await runner.query(VIEW_DEPENDENCIES, [SCRATCH]);
|
|
71
76
|
const edges = viewDependencyEdges(deps, PUBLIC, source.objects);
|
|
72
77
|
const byName = new Map(shapes.map((row) => [cellText(row.name), row]));
|
|
73
|
-
const next =
|
|
78
|
+
const next = reprinted.objects.map((object) => {
|
|
74
79
|
if (object.kind !== "view" && object.kind !== "materializedView")
|
|
75
80
|
return object;
|
|
76
81
|
const row = byName.get(object.identity.name);
|
|
@@ -147,6 +152,40 @@ async function createObjects(runner, source, kind) {
|
|
|
147
152
|
await runner.query(statement);
|
|
148
153
|
}
|
|
149
154
|
}
|
|
155
|
+
var FUNCTION_DEFS = `
|
|
156
|
+
select pg_get_functiondef(p.oid) as definition
|
|
157
|
+
from pg_proc p
|
|
158
|
+
join pg_namespace n on n.oid = p.pronamespace
|
|
159
|
+
where n.nspname = $1 and p.prokind = 'f'
|
|
160
|
+
order by p.oid
|
|
161
|
+
`;
|
|
162
|
+
async function reprintAtomicBodies(runner, source) {
|
|
163
|
+
const created = source.objects.filter((object) => object.kind === "function");
|
|
164
|
+
if (!created.some((object) => object.definition.atomic === true))
|
|
165
|
+
return source;
|
|
166
|
+
const rows = await runner.query(FUNCTION_DEFS, [SCRATCH]);
|
|
167
|
+
if (rows.length !== created.length) {
|
|
168
|
+
throw new OkmError2("OKM1020", `Expected ${String(created.length)} functions in the scratch schema and found ${String(rows.length)}.`, { fix: { summary: "The function body has to run against the tables in this schema." } });
|
|
169
|
+
}
|
|
170
|
+
const bodies = new Map;
|
|
171
|
+
for (let index = 0;index < created.length; index += 1) {
|
|
172
|
+
const object = created[index];
|
|
173
|
+
if (object === undefined || object.definition.atomic !== true)
|
|
174
|
+
continue;
|
|
175
|
+
bodies.set(object, atomicBody(cellText(rows[index]?.definition)));
|
|
176
|
+
}
|
|
177
|
+
let changed = false;
|
|
178
|
+
const objects = source.objects.map((object) => {
|
|
179
|
+
if (object.kind !== "function")
|
|
180
|
+
return object;
|
|
181
|
+
const body = bodies.get(object);
|
|
182
|
+
if (body === undefined || body === object.definition.body)
|
|
183
|
+
return object;
|
|
184
|
+
changed = true;
|
|
185
|
+
return { ...object, definition: { ...object.definition, body } };
|
|
186
|
+
});
|
|
187
|
+
return changed ? catalog(objects) : source;
|
|
188
|
+
}
|
|
150
189
|
async function createViews(runner, views) {
|
|
151
190
|
const pending = [...views];
|
|
152
191
|
let last = "";
|
|
@@ -210,6 +249,12 @@ async function dropScratch(runner) {
|
|
|
210
249
|
join pg_namespace n on n.oid = c.relnamespace
|
|
211
250
|
where n.nspname = $1 and c.relkind in ('v', 'm', 'r')
|
|
212
251
|
`, [SCRATCH]);
|
|
252
|
+
const routines = await runner.query(`
|
|
253
|
+
select p.proname as name, pg_get_function_identity_arguments(p.oid) as args
|
|
254
|
+
from pg_proc p
|
|
255
|
+
join pg_namespace n on n.oid = p.pronamespace
|
|
256
|
+
where n.nspname = $1
|
|
257
|
+
`, [SCRATCH]);
|
|
213
258
|
const views = rows.filter((row) => cellText(row.kind) === "v" || cellText(row.kind) === "m");
|
|
214
259
|
for (let pass = 0;pass < Math.max(views.length, 1); pass += 1) {
|
|
215
260
|
for (const row of views) {
|
|
@@ -219,6 +264,10 @@ async function dropScratch(runner) {
|
|
|
219
264
|
} catch {}
|
|
220
265
|
}
|
|
221
266
|
}
|
|
267
|
+
for (const row of routines) {
|
|
268
|
+
const args = cellText(row.args);
|
|
269
|
+
await runner.query(`drop function if exists ${quoteIdent(SCRATCH)}.${quoteIdent(cellText(row.name))}(${args})`);
|
|
270
|
+
}
|
|
222
271
|
for (const row of rows) {
|
|
223
272
|
if (cellText(row.kind) !== "r")
|
|
224
273
|
continue;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
serializeCatalog2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./12z7aznj.js";
|
|
4
4
|
import {
|
|
5
5
|
roleExists
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./kj9d8maq.js";
|
|
7
7
|
import {
|
|
8
8
|
canonicalTypeName,
|
|
9
9
|
createdRoleName,
|
|
@@ -16,24 +16,24 @@ import {
|
|
|
16
16
|
planMigration,
|
|
17
17
|
sessionFailure,
|
|
18
18
|
assertTargetPolicy
|
|
19
|
-
} from "./
|
|
19
|
+
} from "./dpc2r7rb.js";
|
|
20
|
+
import {
|
|
21
|
+
snakeCase
|
|
22
|
+
} from "./gcefca6p.js";
|
|
20
23
|
import {
|
|
21
24
|
quoteIdent,
|
|
22
25
|
qualify
|
|
23
|
-
} from "./
|
|
24
|
-
import {
|
|
25
|
-
alignExtensionVersions
|
|
26
|
-
} from "./r3j8s5y0.js";
|
|
26
|
+
} from "./sjk86yrx.js";
|
|
27
27
|
import {
|
|
28
28
|
catalog,
|
|
29
29
|
isDomain
|
|
30
30
|
} from "./ywspezzx.js";
|
|
31
|
-
import {
|
|
32
|
-
snakeCase
|
|
33
|
-
} from "./rpycarcr.js";
|
|
34
31
|
import {
|
|
35
32
|
quoteLiteral
|
|
36
33
|
} from "./94ez8kzh.js";
|
|
34
|
+
import {
|
|
35
|
+
alignExtensionVersions
|
|
36
|
+
} from "./r3j8s5y0.js";
|
|
37
37
|
import {
|
|
38
38
|
identityKey2,
|
|
39
39
|
identityLabel2
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
readHandle,
|
|
4
4
|
readCall,
|
|
5
5
|
attachHttp
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./bah9nbg3.js";
|
|
7
7
|
import {
|
|
8
8
|
emitWhere,
|
|
9
9
|
emitOrder,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
list,
|
|
18
18
|
isRecord,
|
|
19
19
|
fail2
|
|
20
|
-
} from "./
|
|
20
|
+
} from "./kgwp4jdd.js";
|
|
21
21
|
import {
|
|
22
22
|
OkmError2,
|
|
23
23
|
throwNamed2
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
var BUCKET = Symbol.for("okmodel.bucket");
|
|
28
28
|
var bucketChunk;
|
|
29
29
|
function loadBucketGroup() {
|
|
30
|
-
return bucketChunk ??= import("./
|
|
30
|
+
return bucketChunk ??= import("./th3be82n.js");
|
|
31
31
|
}
|
|
32
32
|
var OPTIONS = [
|
|
33
33
|
"where",
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
readHandle,
|
|
4
4
|
readCall,
|
|
5
5
|
attachHttp
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./bah9nbg3.js";
|
|
7
7
|
import {
|
|
8
8
|
selectedColumns,
|
|
9
9
|
parseOrder,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
isRecord,
|
|
16
16
|
registerFailFix,
|
|
17
17
|
fail2
|
|
18
|
-
} from "./
|
|
18
|
+
} from "./kgwp4jdd.js";
|
|
19
19
|
import {
|
|
20
20
|
OkmError2,
|
|
21
21
|
throwNamed2
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
open2
|
|
3
|
-
} from "./
|
|
4
|
-
import"./
|
|
3
|
+
} from "./35q0n9tz.js";
|
|
4
|
+
import"./12z7aznj.js";
|
|
5
5
|
import"./n442h54c.js";
|
|
6
6
|
import {
|
|
7
7
|
openProject
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./f4jy1j7x.js";
|
|
9
9
|
import {
|
|
10
10
|
sessionFailure,
|
|
11
11
|
finishQuiet,
|
|
12
12
|
assertTargetPolicy,
|
|
13
13
|
selectTarget
|
|
14
|
-
} from "./
|
|
15
|
-
import"./
|
|
14
|
+
} from "./dpc2r7rb.js";
|
|
15
|
+
import"./sjk86yrx.js";
|
|
16
16
|
import {
|
|
17
17
|
isExactVersion,
|
|
18
18
|
compareExtensionVersions
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OkmError2
|
|
3
|
+
} from "./52szzakm.js";
|
|
4
|
+
|
|
5
|
+
// src/tooling/driver-test.ts
|
|
6
|
+
import { spawn } from "node:child_process";
|
|
7
|
+
import { existsSync } from "node:fs";
|
|
8
|
+
import { dirname, join } from "node:path";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
10
|
+
async function driverTest(args, stdout) {
|
|
11
|
+
const runner = driverRunnerPath(dirname(fileURLToPath(import.meta.url)));
|
|
12
|
+
if (!existsSync(runner)) {
|
|
13
|
+
throw new OkmError2("invalid", "okm driver test cannot find its runner.", {
|
|
14
|
+
fix: { summary: "Run bun run build, then retry." }
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
const command = runner.endsWith(".ts") ? "bun" : process.execPath;
|
|
18
|
+
const result = await runProcess(command, [runner, ...args]);
|
|
19
|
+
if (result.stdout.length > 0)
|
|
20
|
+
stdout(result.stdout);
|
|
21
|
+
if (result.code !== 0) {
|
|
22
|
+
const detail = result.stderr.trim();
|
|
23
|
+
throw new OkmError2("invalid", detail === "" ? "okm driver test failed." : detail, {
|
|
24
|
+
fix: { summary: "The report lists each failed case." }
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function driverRunnerPath(here) {
|
|
29
|
+
const source = join(here, "..", "..", "packages", "harness", "src", "driver-run.ts");
|
|
30
|
+
if (existsSync(source))
|
|
31
|
+
return source;
|
|
32
|
+
const beside = join(here, "driver-run.js");
|
|
33
|
+
if (existsSync(beside))
|
|
34
|
+
return beside;
|
|
35
|
+
return join(here, "..", "tooling", "driver-run.js");
|
|
36
|
+
}
|
|
37
|
+
function runProcess(command, args) {
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
const child = spawn(command, [...args], { stdio: ["ignore", "pipe", "pipe"] });
|
|
40
|
+
const out = [];
|
|
41
|
+
const err = [];
|
|
42
|
+
child.stdout.on("data", (chunk) => {
|
|
43
|
+
out.push(chunk);
|
|
44
|
+
});
|
|
45
|
+
child.stderr.on("data", (chunk) => {
|
|
46
|
+
err.push(chunk);
|
|
47
|
+
});
|
|
48
|
+
const proc = child;
|
|
49
|
+
proc.on("error", reject);
|
|
50
|
+
proc.on("close", (code) => {
|
|
51
|
+
resolve({
|
|
52
|
+
code: code ?? 1,
|
|
53
|
+
stdout: Buffer.concat(out).toString("utf8"),
|
|
54
|
+
stderr: Buffer.concat(err).toString("utf8")
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
driverTest
|
|
61
|
+
};
|
|
@@ -4,16 +4,16 @@ import {
|
|
|
4
4
|
applyProject2,
|
|
5
5
|
pushProject2,
|
|
6
6
|
backfillTiming2
|
|
7
|
-
} from "./
|
|
8
|
-
import"./
|
|
9
|
-
import"./
|
|
10
|
-
import"./
|
|
11
|
-
import"./
|
|
12
|
-
import"./
|
|
7
|
+
} from "./pan0370z.js";
|
|
8
|
+
import"./mnvjvqyp.js";
|
|
9
|
+
import"./kj9d8maq.js";
|
|
10
|
+
import"./p3xbdcvt.js";
|
|
11
|
+
import"./f4jy1j7x.js";
|
|
12
|
+
import"./dpc2r7rb.js";
|
|
13
13
|
import"./n442h54c.js";
|
|
14
|
-
import"./
|
|
15
|
-
import"./
|
|
16
|
-
import"./
|
|
14
|
+
import"./sjk86yrx.js";
|
|
15
|
+
import"./12z7aznj.js";
|
|
16
|
+
import"./35q0n9tz.js";
|
|
17
17
|
export {
|
|
18
18
|
applyProject2 as applyProject,
|
|
19
19
|
applyTarget2 as applyTarget,
|
|
@@ -1,35 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
2
|
roleObject,
|
|
3
3
|
grantObject,
|
|
4
|
-
defaultPrivilegeObject
|
|
5
|
-
|
|
4
|
+
defaultPrivilegeObject,
|
|
5
|
+
functionObject,
|
|
6
|
+
triggerObject,
|
|
7
|
+
normaliseViewQuery,
|
|
8
|
+
viewObject,
|
|
9
|
+
materializedViewObject,
|
|
10
|
+
materializedViewIndex
|
|
11
|
+
} from "./12z7aznj.js";
|
|
6
12
|
import {
|
|
7
13
|
columnPrivilege
|
|
8
|
-
} from "./
|
|
14
|
+
} from "./dpc2r7rb.js";
|
|
9
15
|
import {
|
|
10
16
|
quoteIdent
|
|
11
|
-
} from "./
|
|
17
|
+
} from "./sjk86yrx.js";
|
|
12
18
|
import {
|
|
13
19
|
policyObject
|
|
14
20
|
} from "./bdk4sty6.js";
|
|
15
|
-
import {
|
|
16
|
-
functionObject,
|
|
17
|
-
triggerObject
|
|
18
|
-
} from "./y34a8714.js";
|
|
19
|
-
import {
|
|
20
|
-
normaliseViewQuery,
|
|
21
|
-
viewObject,
|
|
22
|
-
materializedViewObject,
|
|
23
|
-
materializedViewIndex
|
|
24
|
-
} from "./zy8r7qvz.js";
|
|
25
|
-
import {
|
|
26
|
-
extensionObject
|
|
27
|
-
} from "./r3j8s5y0.js";
|
|
28
21
|
import {
|
|
29
22
|
catalog,
|
|
30
23
|
enumType,
|
|
31
24
|
domainType
|
|
32
25
|
} from "./ywspezzx.js";
|
|
26
|
+
import {
|
|
27
|
+
extensionObject
|
|
28
|
+
} from "./r3j8s5y0.js";
|
|
33
29
|
import {
|
|
34
30
|
staticNamespace2,
|
|
35
31
|
identityKey2,
|
|
@@ -1037,4 +1033,4 @@ function flag(row, key) {
|
|
|
1037
1033
|
return value === true || value === "true" || value === "t";
|
|
1038
1034
|
}
|
|
1039
1035
|
|
|
1040
|
-
export { cellText, VIEW_DEPENDENCIES, viewDependencyEdges, PUBLIC, introspectSchema, FUNCTION_ARG_TYPES };
|
|
1036
|
+
export { cellText, VIEW_DEPENDENCIES, viewDependencyEdges, PUBLIC, introspectSchema, FUNCTION_ARG_TYPES, atomicBody };
|