@palbase/backend 27.0.0 → 27.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 +32 -1
- package/dist/bin/palbase-backend.cjs.map +1 -1
- package/dist/bin/palbase-backend.js +4 -4
- package/dist/{chunk-I3C4PFIW.js → chunk-BQN723PL.js} +3 -3
- package/dist/{chunk-OO7R25AI.js → chunk-EB3TUX5J.js} +20 -5
- package/dist/chunk-EB3TUX5J.js.map +1 -0
- package/dist/{chunk-GYK6QYS4.js → chunk-JVZQCC77.js} +21 -1
- package/dist/chunk-JVZQCC77.js.map +1 -0
- package/dist/{chunk-DRZFQRJI.js → chunk-OZKSM3JW.js} +2 -2
- package/dist/chunk-OZKSM3JW.js.map +1 -0
- package/dist/{chunk-TS4U7NBD.js → chunk-XABHGMUT.js} +2 -2
- package/dist/db/index.cjs +26 -0
- 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 +32 -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 +4 -4
- package/dist/{index-NuzRCuxe.d.ts → index-CAKOgAlP.d.ts} +2 -2
- package/dist/{index-Bve7BBTL.d.cts → index-CgE4sVhg.d.cts} +32 -12
- package/dist/{index-VtToZmUm.d.cts → index-H-0qv5d4.d.cts} +2 -2
- package/dist/{index-BrvvxSpn.d.ts → index-V7QRh1wg.d.ts} +32 -12
- package/dist/index.cjs +26 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +4 -4
- package/dist/openapi/index.d.cts +2 -2
- package/dist/openapi/index.d.ts +2 -2
- package/dist/{registry-B0eyOF9x.d.ts → registry-4EI8aaFs.d.ts} +1 -1
- package/dist/{registry-Bk9_rbNd.d.cts → registry-DHsPDY0_.d.cts} +1 -1
- package/dist/test/index.cjs +27 -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 +19 -1
- package/dist/test/index.js.map +1 -1
- package/docs/database.md +35 -1
- package/docs/llms-full.txt +35 -1
- package/package.json +1 -1
- package/dist/chunk-DRZFQRJI.js.map +0 -1
- package/dist/chunk-GYK6QYS4.js.map +0 -1
- package/dist/chunk-OO7R25AI.js.map +0 -1
- /package/dist/{chunk-I3C4PFIW.js.map → chunk-BQN723PL.js.map} +0 -0
- /package/dist/{chunk-TS4U7NBD.js.map → chunk-XABHGMUT.js.map} +0 -0
|
@@ -29,9 +29,11 @@ __name(brandOf, "brandOf");
|
|
|
29
29
|
function looksLikeUnbrandedRef(v) {
|
|
30
30
|
if (typeof v !== "object" || v === null) return null;
|
|
31
31
|
if (brandOf(v) !== void 0) return null;
|
|
32
|
+
if (isColumnExpr(v)) return null;
|
|
32
33
|
const o = v;
|
|
33
34
|
if (typeof o.$col === "string") return "col";
|
|
34
35
|
if (o.$sql !== void 0 && typeof o.$sql === "object" && o.$sql !== null) return "sql";
|
|
36
|
+
if (o.$expr !== void 0 && typeof o.$expr === "object" && o.$expr !== null) return "expr";
|
|
35
37
|
return null;
|
|
36
38
|
}
|
|
37
39
|
__name(looksLikeUnbrandedRef, "looksLikeUnbrandedRef");
|
|
@@ -58,6 +60,16 @@ function isSqlFragment(v) {
|
|
|
58
60
|
}
|
|
59
61
|
__name(isSqlFragment, "isSqlFragment");
|
|
60
62
|
var TX_EXPR = /* @__PURE__ */ Symbol.for("palbase.tx.expr");
|
|
63
|
+
function isNowExpr(v) {
|
|
64
|
+
if (!isColumnExpr(v)) return false;
|
|
65
|
+
try {
|
|
66
|
+
const e = v[TX_EXPR];
|
|
67
|
+
return typeof e === "object" && e !== null && e.fn === "now";
|
|
68
|
+
} catch {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
__name(isNowExpr, "isNowExpr");
|
|
61
73
|
function isColumnExpr(v) {
|
|
62
74
|
if (typeof v !== "object" && typeof v !== "function") return false;
|
|
63
75
|
if (v === null) return false;
|
|
@@ -140,6 +152,7 @@ function assertUsableFilter(caller, table, where) {
|
|
|
140
152
|
}
|
|
141
153
|
if (cond === null || typeof cond !== "object" || Array.isArray(cond)) continue;
|
|
142
154
|
if (isColRef(cond)) continue;
|
|
155
|
+
if (isNowExpr(cond)) continue;
|
|
143
156
|
const entries = Object.entries(cond);
|
|
144
157
|
if (entries.length === 0) {
|
|
145
158
|
throw new Error(`${caller}(${table}): where.${col} bo\u015F bir operat\xF6r nesnesi ({}) \u2014 hi\xE7bir ko\u015Ful \xFCretmez, yani bu alan filtreden sessizce D\xDC\u015EERD\u0130. Ko\u015Ful kurulmayacaksa anahtar\u0131 filtreye hi\xE7 koymay\u0131n (D-21).`);
|
|
@@ -281,6 +294,11 @@ function encodeValue(value, column, allowColumnExpr) {
|
|
|
281
294
|
field: ref.field
|
|
282
295
|
}
|
|
283
296
|
}, "ref");
|
|
297
|
+
if (isNowExpr(value)) return {
|
|
298
|
+
$expr: {
|
|
299
|
+
fn: "now"
|
|
300
|
+
}
|
|
301
|
+
};
|
|
284
302
|
const expr = exprOf(value);
|
|
285
303
|
if (expr) {
|
|
286
304
|
if (expr.fn !== "now" && !allowColumnExpr) {
|
|
@@ -2063,6 +2081,10 @@ function compileWhereBare(table, colSet, where, add, caller = "search", alias =
|
|
|
2063
2081
|
parts.push(`${q} = ${colRefSql(table, colSet, cond, caller, alias)}`);
|
|
2064
2082
|
continue;
|
|
2065
2083
|
}
|
|
2084
|
+
if (isNowExpr(cond)) {
|
|
2085
|
+
parts.push(`${q} = now()`);
|
|
2086
|
+
continue;
|
|
2087
|
+
}
|
|
2066
2088
|
if (cond !== null && typeof cond === "object" && !Array.isArray(cond)) {
|
|
2067
2089
|
for (const [op, v] of Object.entries(cond)) {
|
|
2068
2090
|
if (op === "contains" || op === "icontains" || op === "startsWith" || op === "endsWith") {
|
|
@@ -2091,6 +2113,13 @@ function compileWhereBare(table, colSet, where, add, caller = "search", alias =
|
|
|
2091
2113
|
continue;
|
|
2092
2114
|
}
|
|
2093
2115
|
parts.push(`${q} IN (${v.map((x) => bind(x)).join(", ")})`);
|
|
2116
|
+
} else if (isNowExpr(v)) {
|
|
2117
|
+
if (!(op in WHERE_OPS)) {
|
|
2118
|
+
throw new Error(`${caller}(${table}): where.${col}.${op} now() ile kullan\u0131lamaz \u2014 e\u015Fitlik i\xE7in \xE7\u0131plak bi\xE7imi kullan\u0131n: { ${col}: now() }`);
|
|
2119
|
+
}
|
|
2120
|
+
parts.push(`${q} ${WHERE_OPS[op]} now()`);
|
|
2121
|
+
} else if (isColumnExpr(v)) {
|
|
2122
|
+
throw new Error(`${caller}(${table}): where.${col}.${op} bir YAZMA ifadesi ald\u0131 (increment/decrement) \u2014 kar\u015F\u0131la\u015Ft\u0131rma de\u011Feri de\u011Fil. Sunucu saati i\xE7in now() kullan\u0131n; say\u0131sal bir e\u015Fik i\xE7in de\u011Feri yaz\u0131n.`);
|
|
2094
2123
|
} else if (isColRef(v)) {
|
|
2095
2124
|
if (!(op in WHERE_OPS)) {
|
|
2096
2125
|
throw new Error(`${caller}(${table}): where.${col}.${op} col() ile kullan\u0131lamaz \u2014 e\u015Fitlik i\xE7in \xE7\u0131plak bi\xE7imi kullan\u0131n: { ${col}: col("\u2026") }`);
|
|
@@ -2098,7 +2127,9 @@ function compileWhereBare(table, colSet, where, add, caller = "search", alias =
|
|
|
2098
2127
|
parts.push(`${q} ${WHERE_OPS[op]} ${colRefSql(table, colSet, v, caller, alias)}`);
|
|
2099
2128
|
} else if (looksLikeUnbrandedRef(v) !== null) {
|
|
2100
2129
|
const kind = looksLikeUnbrandedRef(v);
|
|
2101
|
-
|
|
2130
|
+
const made = kind === "col" ? "col()" : kind === "sql" ? "sqlFragment" : "now()";
|
|
2131
|
+
const how = kind === "col" ? 'col("kolon_ad\u0131")' : kind === "sql" ? "sqlFragment`\u2026`" : "now()";
|
|
2132
|
+
throw new Error(`${caller}(${table}): where.${col}.${op} bir ${made} TAKL\u0130D\u0130 ald\u0131 \u2014 bu nesne bu s\xFCre\xE7te ${made} ile \xFCretilmemi\u015F. \u0130stek g\xF6vdesinden gelen bir filtre i\u015Faret\xE7i TA\u015EIYAMAZ; ko\u015Fulu kendi kodunuzda ${how} ile kurun.`);
|
|
2102
2133
|
} else if (op in WHERE_OPS) {
|
|
2103
2134
|
if (v === null && op === "neq") {
|
|
2104
2135
|
parts.push(`${q} IS NOT NULL`);
|