@palbase/backend 38.0.16 → 39.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 +46 -1
- package/dist/bin/palbase-backend.cjs.map +1 -1
- package/dist/bin/palbase-backend.js +5 -5
- package/dist/{chunk-LFUNRWUE.js → chunk-4J6I4KVQ.js} +67 -3
- package/dist/{chunk-LFUNRWUE.js.map → chunk-4J6I4KVQ.js.map} +1 -1
- package/dist/{chunk-7WAGQ3VR.js → chunk-AR2I4M7I.js} +497 -17
- package/dist/chunk-AR2I4M7I.js.map +1 -0
- package/dist/{chunk-YANGWAIM.js → chunk-H7EKL6HC.js} +2 -2
- package/dist/{chunk-EHKEMHB4.js → chunk-JJSR4BUX.js} +49 -5
- package/dist/chunk-JJSR4BUX.js.map +1 -0
- package/dist/{chunk-CS6NQ6PO.js → chunk-JPTFYHP3.js} +2 -2
- package/dist/{chunk-CS6NQ6PO.js.map → chunk-JPTFYHP3.js.map} +1 -1
- package/dist/{chunk-X7UR3VXA.js → chunk-XZWOMPD3.js} +3 -2
- package/dist/chunk-XZWOMPD3.js.map +1 -0
- package/dist/{chunk-PDD55QWN.js → chunk-ZNQDL466.js} +2 -2
- package/dist/db/index.cjs +378 -14
- package/dist/db/index.cjs.map +1 -1
- package/dist/db/index.d.cts +1 -1
- package/dist/db/index.d.ts +1 -1
- package/dist/db/index.js +3 -3
- package/dist/engine/index.cjs +46 -1
- package/dist/engine/index.cjs.map +1 -1
- package/dist/engine/index.d.cts +3 -3
- package/dist/engine/index.d.ts +3 -3
- package/dist/engine/index.js +5 -5
- package/dist/{index-CI7S0Wqv.d.cts → index-B0mjUnxy.d.cts} +25 -2
- package/dist/{index-CUy50OLU.d.ts → index-eN4KzGa5.d.ts} +555 -29
- package/dist/{index-DRx880KY.d.cts → index-pK2At5Yc.d.cts} +555 -29
- package/dist/{index-Ogi30dbt.d.ts → index-yDno9Ju9.d.ts} +25 -2
- package/dist/index.cjs +629 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +216 -8
- package/dist/index.d.ts +216 -8
- package/dist/index.js +75 -6
- package/dist/index.js.map +1 -1
- package/dist/openapi/index.cjs.map +1 -1
- package/dist/openapi/index.d.cts +2 -2
- package/dist/openapi/index.d.ts +2 -2
- package/dist/openapi/index.js +2 -2
- package/dist/{registry-C7UCkQf0.d.cts → registry-9dNeVN5d.d.cts} +1 -1
- package/dist/{registry-DJcvbomD.d.ts → registry-B8ddZiMY.d.ts} +1 -1
- package/dist/test/index.cjs +19 -0
- package/dist/test/index.cjs.map +1 -1
- package/dist/test/index.d.cts +1 -1
- package/dist/test/index.d.ts +1 -1
- package/dist/test/index.js +20 -2
- package/dist/test/index.js.map +1 -1
- package/docs/README.md +1 -1
- package/docs/database.md +129 -0
- package/docs/llms-full.txt +512 -33
- package/docs/schema.md +382 -32
- package/package.json +1 -1
- package/template/package.json +1 -1
- package/dist/chunk-7WAGQ3VR.js.map +0 -1
- package/dist/chunk-EHKEMHB4.js.map +0 -1
- package/dist/chunk-X7UR3VXA.js.map +0 -1
- /package/dist/{chunk-YANGWAIM.js.map → chunk-H7EKL6HC.js.map} +0 -0
- /package/dist/{chunk-PDD55QWN.js.map → chunk-ZNQDL466.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -5,11 +5,16 @@ import {
|
|
|
5
5
|
PolicyBuilder,
|
|
6
6
|
PolicyExprRef,
|
|
7
7
|
TABLE_META,
|
|
8
|
+
backfill,
|
|
8
9
|
can,
|
|
10
|
+
check,
|
|
9
11
|
col,
|
|
10
12
|
defineSchema,
|
|
11
13
|
defineTable,
|
|
12
14
|
exprCtx,
|
|
15
|
+
foreignKey,
|
|
16
|
+
freeze,
|
|
17
|
+
guard,
|
|
13
18
|
index,
|
|
14
19
|
isPalbaseExtension,
|
|
15
20
|
makeTypedDB,
|
|
@@ -18,11 +23,11 @@ import {
|
|
|
18
23
|
raw,
|
|
19
24
|
sqlFragment,
|
|
20
25
|
withRetry
|
|
21
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-AR2I4M7I.js";
|
|
22
27
|
import {
|
|
23
28
|
defineError,
|
|
24
29
|
getErrorRegistry
|
|
25
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-ZNQDL466.js";
|
|
26
31
|
import {
|
|
27
32
|
DECLARATION_REFUSAL,
|
|
28
33
|
DeclarationRefused,
|
|
@@ -40,7 +45,7 @@ import {
|
|
|
40
45
|
makeEnvDts,
|
|
41
46
|
roomsOf,
|
|
42
47
|
webhooksOf
|
|
43
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-H7EKL6HC.js";
|
|
44
49
|
import {
|
|
45
50
|
Auth,
|
|
46
51
|
Cache,
|
|
@@ -60,7 +65,7 @@ import {
|
|
|
60
65
|
__setRuntime,
|
|
61
66
|
onShutdown,
|
|
62
67
|
onStart
|
|
63
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-XZWOMPD3.js";
|
|
64
69
|
import {
|
|
65
70
|
bigint,
|
|
66
71
|
boolean,
|
|
@@ -85,7 +90,7 @@ import {
|
|
|
85
90
|
increment,
|
|
86
91
|
now,
|
|
87
92
|
toSchemaJSON
|
|
88
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-4J6I4KVQ.js";
|
|
89
94
|
import {
|
|
90
95
|
Controller,
|
|
91
96
|
__resetDefaultAuth,
|
|
@@ -115,7 +120,7 @@ import {
|
|
|
115
120
|
Unauthorized,
|
|
116
121
|
UniqueViolation,
|
|
117
122
|
isRetryable
|
|
118
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-JPTFYHP3.js";
|
|
119
124
|
import {
|
|
120
125
|
__name
|
|
121
126
|
} from "./chunk-VXPNPVAG.js";
|
|
@@ -1352,6 +1357,64 @@ function sameDeclaration(a, b) {
|
|
|
1352
1357
|
}
|
|
1353
1358
|
__name(sameDeclaration, "sameDeclaration");
|
|
1354
1359
|
|
|
1360
|
+
// src/db/repository.ts
|
|
1361
|
+
function defineRepository(table, opts) {
|
|
1362
|
+
const tenantColumn = opts.tenant;
|
|
1363
|
+
const rowKey = opts.key ?? "id";
|
|
1364
|
+
const scope = /* @__PURE__ */ __name((tenant) => ({
|
|
1365
|
+
[tenantColumn]: tenant
|
|
1366
|
+
}), "scope");
|
|
1367
|
+
const scopeRow = /* @__PURE__ */ __name((tenant, id) => ({
|
|
1368
|
+
[tenantColumn]: tenant,
|
|
1369
|
+
[rowKey]: id
|
|
1370
|
+
}), "scopeRow");
|
|
1371
|
+
const scopedPayload = /* @__PURE__ */ __name((values, tenant) => ({
|
|
1372
|
+
...values,
|
|
1373
|
+
[tenantColumn]: tenant
|
|
1374
|
+
}), "scopedPayload");
|
|
1375
|
+
let Repository = class Repository {
|
|
1376
|
+
static {
|
|
1377
|
+
__name(this, "Repository");
|
|
1378
|
+
}
|
|
1379
|
+
list(tenant) {
|
|
1380
|
+
return table.findMany({
|
|
1381
|
+
where: scope(tenant)
|
|
1382
|
+
});
|
|
1383
|
+
}
|
|
1384
|
+
async find(tenant, id) {
|
|
1385
|
+
const rows = await table.findMany({
|
|
1386
|
+
where: scopeRow(tenant, id),
|
|
1387
|
+
limit: 1
|
|
1388
|
+
});
|
|
1389
|
+
return rows[0] ?? null;
|
|
1390
|
+
}
|
|
1391
|
+
insert(tenant, values) {
|
|
1392
|
+
return table.insert(scopedPayload(values, tenant));
|
|
1393
|
+
}
|
|
1394
|
+
async update(tenant, id, patch) {
|
|
1395
|
+
const row = await this.updateScoped(tenant, id, patch);
|
|
1396
|
+
if (row === null) {
|
|
1397
|
+
throw new NotFound(`${String(tenantColumn)}=${String(tenant)} kapsam\u0131nda ${rowKey}=${String(id)} bulunamad\u0131`);
|
|
1398
|
+
}
|
|
1399
|
+
return row;
|
|
1400
|
+
}
|
|
1401
|
+
async updateScoped(tenant, id, patch) {
|
|
1402
|
+
const rows = await table.updateMany({
|
|
1403
|
+
where: scopeRow(tenant, id),
|
|
1404
|
+
set: patch
|
|
1405
|
+
});
|
|
1406
|
+
return rows[0] ?? null;
|
|
1407
|
+
}
|
|
1408
|
+
async delete(tenant, id) {
|
|
1409
|
+
await table.deleteMany({
|
|
1410
|
+
where: scopeRow(tenant, id)
|
|
1411
|
+
});
|
|
1412
|
+
}
|
|
1413
|
+
};
|
|
1414
|
+
return Repository;
|
|
1415
|
+
}
|
|
1416
|
+
__name(defineRepository, "defineRepository");
|
|
1417
|
+
|
|
1355
1418
|
// src/stack-gen.ts
|
|
1356
1419
|
function liveNames(names) {
|
|
1357
1420
|
return [
|
|
@@ -2099,11 +2162,13 @@ export {
|
|
|
2099
2162
|
__setRuntime,
|
|
2100
2163
|
assertNoOrphanEntryPoints,
|
|
2101
2164
|
assertZeroArgConstructor,
|
|
2165
|
+
backfill,
|
|
2102
2166
|
bigint,
|
|
2103
2167
|
boolean,
|
|
2104
2168
|
buildContainer,
|
|
2105
2169
|
buildModuleClients,
|
|
2106
2170
|
can,
|
|
2171
|
+
check,
|
|
2107
2172
|
col,
|
|
2108
2173
|
controllersOf,
|
|
2109
2174
|
dec,
|
|
@@ -2112,10 +2177,13 @@ export {
|
|
|
2112
2177
|
defineDefaultAuth,
|
|
2113
2178
|
defineError,
|
|
2114
2179
|
defineMiddleware,
|
|
2180
|
+
defineRepository,
|
|
2115
2181
|
defineSchema,
|
|
2116
2182
|
defineTable,
|
|
2117
2183
|
enumType,
|
|
2118
2184
|
exprCtx,
|
|
2185
|
+
foreignKey,
|
|
2186
|
+
freeze,
|
|
2119
2187
|
getErrorRegistry,
|
|
2120
2188
|
getHookConfig,
|
|
2121
2189
|
getHookManifest,
|
|
@@ -2125,6 +2193,7 @@ export {
|
|
|
2125
2193
|
getRoutes,
|
|
2126
2194
|
getWebhookConfig,
|
|
2127
2195
|
getWebhookManifest,
|
|
2196
|
+
guard,
|
|
2128
2197
|
hooksOf,
|
|
2129
2198
|
inc,
|
|
2130
2199
|
increment,
|