@palbase/backend 38.0.16 → 39.0.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 +628 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +183 -8
- package/dist/index.d.ts +183 -8
- package/dist/index.js +74 -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 +79 -0
- package/docs/llms-full.txt +462 -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,63 @@ 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 scope = /* @__PURE__ */ __name((tenant) => ({
|
|
1364
|
+
[tenantColumn]: tenant
|
|
1365
|
+
}), "scope");
|
|
1366
|
+
const scopeRow = /* @__PURE__ */ __name((tenant, id) => ({
|
|
1367
|
+
[tenantColumn]: tenant,
|
|
1368
|
+
id
|
|
1369
|
+
}), "scopeRow");
|
|
1370
|
+
const scopedPayload = /* @__PURE__ */ __name((values, tenant) => ({
|
|
1371
|
+
...values,
|
|
1372
|
+
[tenantColumn]: tenant
|
|
1373
|
+
}), "scopedPayload");
|
|
1374
|
+
let Repository = class Repository {
|
|
1375
|
+
static {
|
|
1376
|
+
__name(this, "Repository");
|
|
1377
|
+
}
|
|
1378
|
+
list(tenant) {
|
|
1379
|
+
return table.findMany({
|
|
1380
|
+
where: scope(tenant)
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
async find(tenant, id) {
|
|
1384
|
+
const rows = await table.findMany({
|
|
1385
|
+
where: scopeRow(tenant, id),
|
|
1386
|
+
limit: 1
|
|
1387
|
+
});
|
|
1388
|
+
return rows[0] ?? null;
|
|
1389
|
+
}
|
|
1390
|
+
insert(tenant, values) {
|
|
1391
|
+
return table.insert(scopedPayload(values, tenant));
|
|
1392
|
+
}
|
|
1393
|
+
async update(tenant, id, patch) {
|
|
1394
|
+
const row = await this.updateScoped(tenant, id, patch);
|
|
1395
|
+
if (row === null) {
|
|
1396
|
+
throw new NotFound(`${String(tenantColumn)}=${String(tenant)} kapsam\u0131nda ${id} bulunamad\u0131`);
|
|
1397
|
+
}
|
|
1398
|
+
return row;
|
|
1399
|
+
}
|
|
1400
|
+
async updateScoped(tenant, id, patch) {
|
|
1401
|
+
const rows = await table.updateMany({
|
|
1402
|
+
where: scopeRow(tenant, id),
|
|
1403
|
+
set: patch
|
|
1404
|
+
});
|
|
1405
|
+
return rows[0] ?? null;
|
|
1406
|
+
}
|
|
1407
|
+
async delete(tenant, id) {
|
|
1408
|
+
await table.deleteMany({
|
|
1409
|
+
where: scopeRow(tenant, id)
|
|
1410
|
+
});
|
|
1411
|
+
}
|
|
1412
|
+
};
|
|
1413
|
+
return Repository;
|
|
1414
|
+
}
|
|
1415
|
+
__name(defineRepository, "defineRepository");
|
|
1416
|
+
|
|
1355
1417
|
// src/stack-gen.ts
|
|
1356
1418
|
function liveNames(names) {
|
|
1357
1419
|
return [
|
|
@@ -2099,11 +2161,13 @@ export {
|
|
|
2099
2161
|
__setRuntime,
|
|
2100
2162
|
assertNoOrphanEntryPoints,
|
|
2101
2163
|
assertZeroArgConstructor,
|
|
2164
|
+
backfill,
|
|
2102
2165
|
bigint,
|
|
2103
2166
|
boolean,
|
|
2104
2167
|
buildContainer,
|
|
2105
2168
|
buildModuleClients,
|
|
2106
2169
|
can,
|
|
2170
|
+
check,
|
|
2107
2171
|
col,
|
|
2108
2172
|
controllersOf,
|
|
2109
2173
|
dec,
|
|
@@ -2112,10 +2176,13 @@ export {
|
|
|
2112
2176
|
defineDefaultAuth,
|
|
2113
2177
|
defineError,
|
|
2114
2178
|
defineMiddleware,
|
|
2179
|
+
defineRepository,
|
|
2115
2180
|
defineSchema,
|
|
2116
2181
|
defineTable,
|
|
2117
2182
|
enumType,
|
|
2118
2183
|
exprCtx,
|
|
2184
|
+
foreignKey,
|
|
2185
|
+
freeze,
|
|
2119
2186
|
getErrorRegistry,
|
|
2120
2187
|
getHookConfig,
|
|
2121
2188
|
getHookManifest,
|
|
@@ -2125,6 +2192,7 @@ export {
|
|
|
2125
2192
|
getRoutes,
|
|
2126
2193
|
getWebhookConfig,
|
|
2127
2194
|
getWebhookManifest,
|
|
2195
|
+
guard,
|
|
2128
2196
|
hooksOf,
|
|
2129
2197
|
inc,
|
|
2130
2198
|
increment,
|