@palbase/backend 33.0.2 → 34.1.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/bin/palbase-backend.cjs +2273 -358
- package/dist/bin/palbase-backend.cjs.map +1 -1
- package/dist/bin/palbase-backend.js +9 -7
- package/dist/bin/palbase-backend.js.map +1 -1
- package/dist/{chunk-YIQ4RS4F.js → chunk-5UGPXKMJ.js} +331 -5
- package/dist/chunk-5UGPXKMJ.js.map +1 -0
- package/dist/chunk-GHNC2UHS.js +20 -0
- package/dist/chunk-GHNC2UHS.js.map +1 -0
- package/dist/{chunk-AAT5G7KY.js → chunk-JJW3L62T.js} +2 -2
- package/dist/chunk-JJW3L62T.js.map +1 -0
- package/dist/{chunk-SI4KGEM3.js → chunk-P7MGSAFT.js} +102 -96
- package/dist/chunk-P7MGSAFT.js.map +1 -0
- package/dist/{chunk-XOX6RFPZ.js → chunk-PRH45NZU.js} +46 -3
- package/dist/chunk-PRH45NZU.js.map +1 -0
- package/dist/{chunk-26GH54D2.js → chunk-RZLY4BOY.js} +5 -3
- package/dist/{chunk-26GH54D2.js.map → chunk-RZLY4BOY.js.map} +1 -1
- package/dist/{chunk-KATPXCJ5.js → chunk-UMESJJRS.js} +19 -40
- package/dist/chunk-UMESJJRS.js.map +1 -0
- package/dist/chunk-VXPNPVAG.js +40 -0
- package/dist/chunk-VXPNPVAG.js.map +1 -0
- package/dist/{chunk-WWUG2QXF.js → chunk-X2UYIXDS.js} +59 -4
- package/dist/chunk-X2UYIXDS.js.map +1 -0
- package/dist/{chunk-C6COAB3E.js → chunk-XZPDPYVY.js} +1905 -195
- package/dist/chunk-XZPDPYVY.js.map +1 -0
- package/dist/{chunk-TVCCR6SO.js → chunk-YO5GYM73.js} +58 -9
- package/dist/chunk-YO5GYM73.js.map +1 -0
- package/dist/db/env.cjs.map +1 -1
- package/dist/db/env.d.cts +2 -0
- package/dist/db/env.d.ts +2 -0
- package/dist/db/index.cjs +285 -2
- package/dist/db/index.cjs.map +1 -1
- package/dist/db/index.d.cts +46 -3
- package/dist/db/index.d.ts +46 -3
- package/dist/db/index.js +14 -5
- package/dist/{index-DMZG3kpo.d.ts → endpoint-BXPdsTA5.d.ts} +370 -58
- package/dist/{index-DB_nW-AV.d.cts → endpoint-DqhUP7RT.d.cts} +370 -58
- package/dist/engine/index.cjs +2279 -356
- package/dist/engine/index.cjs.map +1 -1
- package/dist/engine/index.d.cts +5 -5
- package/dist/engine/index.d.ts +5 -5
- package/dist/engine/index.js +17 -7
- package/dist/{index-DLveQoOf.d.cts → index-Co0Hj_aO.d.cts} +108 -50
- package/dist/{index-D-3duy8Y.d.ts → index-MhCL7ll4.d.ts} +108 -50
- package/dist/index.cjs +806 -386
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +27 -15
- package/dist/index.js.map +1 -1
- package/dist/openapi/index.cjs +7 -0
- package/dist/openapi/index.cjs.map +1 -1
- package/dist/openapi/index.d.cts +3 -3
- package/dist/openapi/index.d.ts +3 -3
- package/dist/openapi/index.js +4 -3
- package/dist/openapi/index.js.map +1 -1
- package/dist/{registry-DSTThhKf.d.cts → registry-BkIVHPzB.d.cts} +3 -1
- package/dist/{registry-JjF5lcj4.d.ts → registry-CvGLR5j1.d.ts} +3 -1
- package/dist/test/index.cjs +103 -66
- package/dist/test/index.cjs.map +1 -1
- package/dist/test/index.d.cts +3 -3
- package/dist/test/index.d.ts +3 -3
- package/dist/test/index.js +33 -7
- package/dist/test/index.js.map +1 -1
- package/docs/README.md +1 -1
- package/docs/auth.md +58 -0
- package/docs/database.md +308 -0
- package/docs/examples/check-query-contracts.ts +5 -0
- package/docs/examples/database-dx.contract.json +65 -0
- package/docs/examples/database-dx.ts +63 -0
- package/docs/examples/money-transfer.ts +73 -0
- package/docs/llms-full.txt +382 -1
- package/docs/schema.md +15 -0
- package/package.json +1 -2
- package/template/db/public.ts +12 -0
- package/template/package.json +1 -1
- package/dist/chunk-AAT5G7KY.js.map +0 -1
- package/dist/chunk-C6COAB3E.js.map +0 -1
- package/dist/chunk-KATPXCJ5.js.map +0 -1
- package/dist/chunk-SI4KGEM3.js.map +0 -1
- package/dist/chunk-TVCCR6SO.js.map +0 -1
- package/dist/chunk-WWUG2QXF.js.map +0 -1
- package/dist/chunk-XOX6RFPZ.js.map +0 -1
- package/dist/chunk-YIQ4RS4F.js.map +0 -1
- package/stack-images.json +0 -24
package/dist/test/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { T as Token } from '../module-Dl1KFVtc.cjs';
|
|
2
|
-
import { E as EnvServiceDatabase,
|
|
3
|
-
import '../db/env.cjs';
|
|
4
|
-
import '../stack.cjs';
|
|
2
|
+
import { E as EnvServiceDatabase, a as DBClient, b as RuntimeServices } from '../endpoint-DqhUP7RT.cjs';
|
|
5
3
|
import 'zod';
|
|
4
|
+
import '../stack.cjs';
|
|
5
|
+
import '../db/env.cjs';
|
|
6
6
|
import 'node:async_hooks';
|
|
7
7
|
|
|
8
8
|
/** The client a tenant's tests use to call their own backend.
|
package/dist/test/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { T as Token } from '../module-Dl1KFVtc.js';
|
|
2
|
-
import { E as EnvServiceDatabase,
|
|
3
|
-
import '../db/env.js';
|
|
4
|
-
import '../stack.js';
|
|
2
|
+
import { E as EnvServiceDatabase, a as DBClient, b as RuntimeServices } from '../endpoint-BXPdsTA5.js';
|
|
5
3
|
import 'zod';
|
|
4
|
+
import '../stack.js';
|
|
5
|
+
import '../db/env.js';
|
|
6
6
|
import 'node:async_hooks';
|
|
7
7
|
|
|
8
8
|
/** The client a tenant's tests use to call their own backend.
|
package/dist/test/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
validateInsertManyOptions
|
|
3
|
+
} from "../chunk-GHNC2UHS.js";
|
|
1
4
|
import {
|
|
2
5
|
__requestALS,
|
|
3
6
|
makeTypedSurface
|
|
4
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-YO5GYM73.js";
|
|
5
8
|
import {
|
|
6
9
|
assertNoExpressionHandles,
|
|
7
10
|
assertUsableFilter,
|
|
@@ -11,10 +14,10 @@ import {
|
|
|
11
14
|
isColumnExpr,
|
|
12
15
|
isNowExpr,
|
|
13
16
|
isSqlFragment
|
|
14
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-P7MGSAFT.js";
|
|
15
18
|
import {
|
|
16
19
|
__name
|
|
17
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-VXPNPVAG.js";
|
|
18
21
|
|
|
19
22
|
// ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/_dnt.shims.js
|
|
20
23
|
var dntGlobals = {};
|
|
@@ -1636,6 +1639,14 @@ function createMockDB() {
|
|
|
1636
1639
|
}
|
|
1637
1640
|
__name(resolveInsertValues, "resolveInsertValues");
|
|
1638
1641
|
const ops = {
|
|
1642
|
+
diagnostics: /* @__PURE__ */ __name(() => null, "diagnostics"),
|
|
1643
|
+
readQuery: /* @__PURE__ */ __name((query) => ops.findMany(query.table, query.where, query.options), "readQuery"),
|
|
1644
|
+
compileQuery() {
|
|
1645
|
+
throw new Error("MockDB cannot compile PostgreSQL query plans; use the real engine to inspect SQL");
|
|
1646
|
+
},
|
|
1647
|
+
async explainQuery() {
|
|
1648
|
+
throw new Error("MockDB cannot EXPLAIN PostgreSQL plans; use a PostgreSQL integration test");
|
|
1649
|
+
},
|
|
1639
1650
|
// The bulk ops and count run against the SAME in-memory store the direct
|
|
1640
1651
|
// ops write to, so a test that writes three rows and counts them gets 3 —
|
|
1641
1652
|
// a mock that answered 0 would make the surface look broken in exactly the
|
|
@@ -1773,8 +1784,10 @@ function createMockDB() {
|
|
|
1773
1784
|
return out;
|
|
1774
1785
|
});
|
|
1775
1786
|
},
|
|
1776
|
-
async
|
|
1777
|
-
|
|
1787
|
+
insertMany: /* @__PURE__ */ __name(async function(table, rows, opts) {
|
|
1788
|
+
validateInsertManyOptions(opts);
|
|
1789
|
+
if (opts?.onConflict?.length) throw new Error("fakeDatabase insertMany cannot enforce PostgreSQL unique constraints; use an integration test for onConflict");
|
|
1790
|
+
if (rows.length === 0) return opts?.returning === false ? 0 : [];
|
|
1778
1791
|
const cols = Object.keys(rows[0]);
|
|
1779
1792
|
for (let i = 1; i < rows.length; i++) {
|
|
1780
1793
|
const missing = cols.filter((c) => !(c in rows[i]));
|
|
@@ -1796,8 +1809,8 @@ function createMockDB() {
|
|
|
1796
1809
|
track(tracked.inserted, table, record);
|
|
1797
1810
|
out.push(record);
|
|
1798
1811
|
}
|
|
1799
|
-
return out;
|
|
1800
|
-
},
|
|
1812
|
+
return opts?.returning === false ? out.length : out;
|
|
1813
|
+
}, "insertMany"),
|
|
1801
1814
|
/**
|
|
1802
1815
|
* `claim` — motorla PARİTE (FR-033).
|
|
1803
1816
|
*
|
|
@@ -1919,6 +1932,9 @@ function createMockDB() {
|
|
|
1919
1932
|
id
|
|
1920
1933
|
]);
|
|
1921
1934
|
},
|
|
1935
|
+
async findUnique() {
|
|
1936
|
+
throw new Error("MockDB.findUnique cannot verify declared PostgreSQL unique constraints; use a PostgreSQL integration test");
|
|
1937
|
+
},
|
|
1922
1938
|
async findById(table, id) {
|
|
1923
1939
|
const rows = store.get(table) ?? [];
|
|
1924
1940
|
return rows.find((r) => r["id"] === id) ?? null;
|
|
@@ -1927,6 +1943,9 @@ function createMockDB() {
|
|
|
1927
1943
|
// equality, an object is an operator set. A fake that understood less would
|
|
1928
1944
|
// pass a service test that the live database then fails — which is the one
|
|
1929
1945
|
// thing a stand-in must never do.
|
|
1946
|
+
async page() {
|
|
1947
|
+
throw new Error("fakeDatabase cannot reproduce PostgreSQL cursor ordering, collations or RLS; use a PostgreSQL integration test or inject an explicit page response");
|
|
1948
|
+
},
|
|
1930
1949
|
async findMany(table, query, opts) {
|
|
1931
1950
|
assertUsableFilter("findMany", table, query);
|
|
1932
1951
|
refuseFragment("findMany", table, query);
|
|
@@ -2121,6 +2140,13 @@ function createMockDB() {
|
|
|
2121
2140
|
__name(applyOp, "applyOp");
|
|
2122
2141
|
const client = {
|
|
2123
2142
|
...ops,
|
|
2143
|
+
async command(plan, options) {
|
|
2144
|
+
if (options?.mode === "compiled") throw new Error("fakeDatabase does not run the PostgreSQL command executor; verify compiled mode against PostgreSQL");
|
|
2145
|
+
return client.txPlan(plan);
|
|
2146
|
+
},
|
|
2147
|
+
async atomic() {
|
|
2148
|
+
throw new Error("fakeDatabase cannot verify physical transaction isolation, COMMIT or retry; test $atomic against PostgreSQL or inject a transaction test double explicitly");
|
|
2149
|
+
},
|
|
2124
2150
|
// No real savepoint in memory: the fake runs the callback against the SAME
|
|
2125
2151
|
// store. An assertion about rollback here would be asserting the fake.
|
|
2126
2152
|
attempt: /* @__PURE__ */ __name((fn) => fn(ops), "attempt"),
|