@palbase/backend 27.1.0 → 28.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 +133 -38
- package/dist/bin/palbase-backend.cjs.map +1 -1
- package/dist/bin/palbase-backend.js +4 -4
- package/dist/{chunk-JVZQCC77.js → chunk-3TUJWHC2.js} +8 -3
- package/dist/chunk-3TUJWHC2.js.map +1 -0
- package/dist/{chunk-EB3TUX5J.js → chunk-75YROPRZ.js} +102 -38
- package/dist/chunk-75YROPRZ.js.map +1 -0
- package/dist/{chunk-XABHGMUT.js → chunk-IVZERLTM.js} +2 -2
- package/dist/{chunk-BQN723PL.js → chunk-RVP6BTEZ.js} +63 -6
- package/dist/chunk-RVP6BTEZ.js.map +1 -0
- package/dist/{chunk-OZKSM3JW.js → chunk-SNDXY565.js} +3 -2
- package/dist/chunk-SNDXY565.js.map +1 -0
- package/dist/db/index.cjs +4 -1
- 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 +143 -38
- 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 +11 -4
- package/dist/{index-H-0qv5d4.d.cts → index-9C3JHxg-.d.cts} +112 -5
- package/dist/{index-CAKOgAlP.d.ts → index-BbvOoZFr.d.ts} +112 -5
- package/dist/{index-CgE4sVhg.d.cts → index-DtISj9QX.d.cts} +94 -11
- package/dist/{index-V7QRh1wg.d.ts → index-dTTLlHIn.d.ts} +94 -11
- package/dist/index.cjs +67 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -22
- package/dist/index.d.ts +6 -22
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/openapi/index.d.cts +2 -2
- package/dist/openapi/index.d.ts +2 -2
- package/dist/{registry-4EI8aaFs.d.ts → registry-JQNIX-eA.d.ts} +1 -1
- package/dist/{registry-DHsPDY0_.d.cts → registry-qIPM5BQe.d.cts} +1 -1
- package/dist/test/index.cjs +73 -6
- 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 +70 -6
- package/dist/test/index.js.map +1 -1
- package/docs/README.md +1 -1
- package/docs/database.md +69 -1
- package/docs/llms-full.txt +70 -2
- package/package.json +1 -1
- package/template/package.json +1 -1
- package/dist/chunk-BQN723PL.js.map +0 -1
- package/dist/chunk-EB3TUX5J.js.map +0 -1
- package/dist/chunk-JVZQCC77.js.map +0 -1
- package/dist/chunk-OZKSM3JW.js.map +0 -1
- /package/dist/{chunk-XABHGMUT.js.map → chunk-IVZERLTM.js.map} +0 -0
package/dist/openapi/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenApiGeneratorV31 } from '@asteasolutions/zod-to-openapi';
|
|
2
2
|
import { ZodTypeAny } from 'zod';
|
|
3
|
-
import { A as AuthSpec, R as RateLimitConfig } from '../index-
|
|
4
|
-
import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig, S as SseConfig } from '../registry-
|
|
3
|
+
import { A as AuthSpec, R as RateLimitConfig } from '../index-DtISj9QX.cjs';
|
|
4
|
+
import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig, S as SseConfig } from '../registry-qIPM5BQe.cjs';
|
|
5
5
|
import '../db/env.cjs';
|
|
6
6
|
import '../stack.cjs';
|
|
7
7
|
import 'node:async_hooks';
|
package/dist/openapi/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenApiGeneratorV31 } from '@asteasolutions/zod-to-openapi';
|
|
2
2
|
import { ZodTypeAny } from 'zod';
|
|
3
|
-
import { A as AuthSpec, R as RateLimitConfig } from '../index-
|
|
4
|
-
import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig, S as SseConfig } from '../registry-
|
|
3
|
+
import { A as AuthSpec, R as RateLimitConfig } from '../index-dTTLlHIn.js';
|
|
4
|
+
import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig, S as SseConfig } from '../registry-JQNIX-eA.js';
|
|
5
5
|
import '../db/env.js';
|
|
6
6
|
import '../stack.js';
|
|
7
7
|
import 'node:async_hooks';
|
package/dist/test/index.cjs
CHANGED
|
@@ -389,8 +389,11 @@ __name(isColumnExpr, "isColumnExpr");
|
|
|
389
389
|
function assertNoExpressionHandles(caller, table, cols, data) {
|
|
390
390
|
for (const c of cols) {
|
|
391
391
|
const v = data[c];
|
|
392
|
+
if (isNowExpr(v)) {
|
|
393
|
+
throw new Error(`${caller}(${table}): "${c}" now() ald\u0131 \u2014 bu yolda de\u011Fer beklenir. Sat\u0131r EKLEN\u0130RKEN sunucu saatini yazman\u0131n yolu kolonu defaultNow() ile bildirmek (varsay\u0131lan kolonun yan\u0131nda durur, her \xE7a\u011Fr\u0131da tekrarlanmaz); var olan bir sat\u0131r\u0131 damgalamak i\xE7in updateMany({ where, set: { ${c}: now() } }) ya da $transaction i\xE7inde tx.public.${table}.updateWhere(where, { ${c}: now() }).`);
|
|
394
|
+
}
|
|
392
395
|
if (isColumnExpr(v)) {
|
|
393
|
-
throw new Error(`${caller}(${table}): "${c}" bir ifade tutama\u011F\u0131 ald\u0131 (increment()/decrement()
|
|
396
|
+
throw new Error(`${caller}(${table}): "${c}" bir ifade tutama\u011F\u0131 ald\u0131 (increment()/decrement()). Bu yolda de\u011Fer beklenir. Saya\xE7 art\u0131\u015F\u0131 i\xE7in updateMany({ where, set: { ${c}: increment(n) } }) ya da $transaction i\xE7inde tx.public.${table}.updateWhere(where, { ${c}: increment(n) }) kullan\u0131n.`);
|
|
394
397
|
}
|
|
395
398
|
if (isColRef(v)) {
|
|
396
399
|
throw new Error(`${caller}(${table}): "${c}" bir col() ald\u0131. Kolon referans\u0131 yaln\u0131z F\u0130LTREDE durabilir; bir kolonun de\u011Ferini ba\u015Fka bir kolona yazmak i\xE7in $query kullan\u0131n.`);
|
|
@@ -804,6 +807,22 @@ function createMockDB() {
|
|
|
804
807
|
]);
|
|
805
808
|
}
|
|
806
809
|
__name(track, "track");
|
|
810
|
+
function resolveInsertValues(caller, table, data) {
|
|
811
|
+
const out = {};
|
|
812
|
+
for (const [k, v] of Object.entries(data)) {
|
|
813
|
+
const expr = columnExprOf(v);
|
|
814
|
+
if (expr !== null && expr.fn === "now") {
|
|
815
|
+
out[k] = (/* @__PURE__ */ new Date()).toISOString();
|
|
816
|
+
continue;
|
|
817
|
+
}
|
|
818
|
+
if (expr !== null) {
|
|
819
|
+
throw new Error(`${caller}(${table}): "${k}" ${expr.fn === "inc" ? "increment()" : "decrement()"} ald\u0131 \u2014 sat\u0131r HEN\xDCZ YOK, yani "kolonun \u015Fu anki de\u011Feri" diye bir \u015Fey yok.`);
|
|
820
|
+
}
|
|
821
|
+
out[k] = v;
|
|
822
|
+
}
|
|
823
|
+
return out;
|
|
824
|
+
}
|
|
825
|
+
__name(resolveInsertValues, "resolveInsertValues");
|
|
807
826
|
const ops = {
|
|
808
827
|
// The bulk ops and count run against the SAME in-memory store the direct
|
|
809
828
|
// ops write to, so a test that writes three rows and counts them gets 3 —
|
|
@@ -866,7 +885,8 @@ function createMockDB() {
|
|
|
866
885
|
async query(_sql, _params) {
|
|
867
886
|
return [];
|
|
868
887
|
},
|
|
869
|
-
async insert(table,
|
|
888
|
+
async insert(table, raw) {
|
|
889
|
+
const data = resolveInsertValues("insert", table, raw);
|
|
870
890
|
assertUsableWriteValues("insert", table, Object.keys(data), data);
|
|
871
891
|
assertNoExpressionHandles("insert", table, Object.keys(data), data);
|
|
872
892
|
const record = {
|
|
@@ -878,6 +898,38 @@ function createMockDB() {
|
|
|
878
898
|
return record;
|
|
879
899
|
},
|
|
880
900
|
/**
|
|
901
|
+
* `insertMany` — motorla PARİTE, ANAHTAR KÜMESİ kuralı dahil.
|
|
902
|
+
*
|
|
903
|
+
* Fake bu kuralı bilmeseydi farklı şekilli satırları kabul eder, test yeşil
|
|
904
|
+
* kalır, üretimde motor adıyla reddederdi — yani fake, sürüm atlamayı
|
|
905
|
+
* kolaylaştırmak yerine gizlerdi.
|
|
906
|
+
*/
|
|
907
|
+
async insertMany(table, rows) {
|
|
908
|
+
if (rows.length === 0) return [];
|
|
909
|
+
const cols = Object.keys(rows[0]);
|
|
910
|
+
for (let i = 1; i < rows.length; i++) {
|
|
911
|
+
const missing = cols.filter((c) => !(c in rows[i]));
|
|
912
|
+
const extra = Object.keys(rows[i]).filter((k) => !cols.includes(k));
|
|
913
|
+
if (missing.length > 0 || extra.length > 0) {
|
|
914
|
+
throw new Error(`insertMany(${table}): ${i}. sat\u0131r\u0131n kolonlar\u0131 ilk sat\u0131rla ayn\u0131 de\u011Fil` + (missing.length > 0 ? ` (eksik: ${missing.join(", ")})` : "") + (extra.length > 0 ? ` (fazla: ${extra.join(", ")})` : "") + `. Eksikler i\xE7in null yaz\u0131n, ya da farkl\u0131 \u015Fekilli sat\u0131rlar\u0131 ayr\u0131 \xE7a\u011Fr\u0131larda ekleyin.`);
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
const out = [];
|
|
918
|
+
for (const rawRow of rows) {
|
|
919
|
+
const data = resolveInsertValues("insertMany", table, rawRow);
|
|
920
|
+
assertUsableWriteValues("insertMany", table, cols, data);
|
|
921
|
+
assertNoExpressionHandles("insertMany", table, cols, data);
|
|
922
|
+
const record = {
|
|
923
|
+
id: crypto.randomUUID(),
|
|
924
|
+
...data
|
|
925
|
+
};
|
|
926
|
+
rowsOf(table).push(record);
|
|
927
|
+
track(tracked.inserted, table, record);
|
|
928
|
+
out.push(record);
|
|
929
|
+
}
|
|
930
|
+
return out;
|
|
931
|
+
},
|
|
932
|
+
/**
|
|
881
933
|
* `claim` — motorla PARİTE (FR-033).
|
|
882
934
|
*
|
|
883
935
|
* Fake bunu sunmasaydı `claim` ile yazılmış bir servis, iskelenin yazarlara
|
|
@@ -936,10 +988,11 @@ function createMockDB() {
|
|
|
936
988
|
},
|
|
937
989
|
// Same semantics the engine's SQL has: match on the conflict columns, update
|
|
938
990
|
// everything else, and return the resulting row either way.
|
|
939
|
-
async put(table,
|
|
991
|
+
async put(table, rawData, opts) {
|
|
940
992
|
if (opts.onConflict.length === 0) {
|
|
941
993
|
throw new Error(`put into ${table}: onConflict en az bir kolon ad\u0131 ister`);
|
|
942
994
|
}
|
|
995
|
+
const data = resolveInsertValues("put", table, rawData);
|
|
943
996
|
assertUsableWriteValues("upsert", table, Object.keys(data), data);
|
|
944
997
|
assertNoExpressionHandles("upsert", table, Object.keys(data), data);
|
|
945
998
|
const rows = rowsOf(table);
|
|
@@ -960,15 +1013,29 @@ function createMockDB() {
|
|
|
960
1013
|
},
|
|
961
1014
|
async update(table, id, data) {
|
|
962
1015
|
assertUsableWriteValues("update", table, Object.keys(data), data);
|
|
963
|
-
assertNoExpressionHandles("update", table, Object.keys(data), data);
|
|
964
1016
|
const rows = store.get(table) ?? [];
|
|
965
1017
|
const idx = rows.findIndex((r) => r["id"] === id);
|
|
1018
|
+
const current = idx >= 0 ? rows[idx] : {};
|
|
1019
|
+
const applied = {};
|
|
1020
|
+
for (const [k, v] of Object.entries(data)) {
|
|
1021
|
+
const expr = columnExprOf(v);
|
|
1022
|
+
if (expr !== null && expr.fn === "now") {
|
|
1023
|
+
applied[k] = /* @__PURE__ */ new Date();
|
|
1024
|
+
continue;
|
|
1025
|
+
}
|
|
1026
|
+
if (expr !== null) {
|
|
1027
|
+
applied[k] = addDecimal(current[k], expr.by, expr.fn === "inc" ? 1 : -1);
|
|
1028
|
+
continue;
|
|
1029
|
+
}
|
|
1030
|
+
applied[k] = v;
|
|
1031
|
+
}
|
|
1032
|
+
assertNoExpressionHandles("update", table, Object.keys(applied), applied);
|
|
966
1033
|
const updated = idx >= 0 ? {
|
|
967
1034
|
...rows[idx],
|
|
968
|
-
...
|
|
1035
|
+
...applied
|
|
969
1036
|
} : {
|
|
970
1037
|
id,
|
|
971
|
-
...
|
|
1038
|
+
...applied
|
|
972
1039
|
};
|
|
973
1040
|
if (idx >= 0) {
|
|
974
1041
|
rows[idx] = updated;
|