@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
package/dist/db/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { f as AnyColumn, k as ColumnBuilder, l as ColumnDef, m as ColumnMap, n as ColumnType, E as EXTENSION_DEPENDENCIES, s as EmbeddingModelRef, u as EnvServiceDatabase, w as EnvTypedDatabase, N as InsertShape, V as Materialized, a0 as OnDeleteAction, a1 as PALBASE_EXTENSIONS, aA as PalbaseExtension, bx as PolicyBuilder, by as PolicyCommand, bz as PolicyDef, bC as PolicyMode, bE as RawConstraintDef, bG as Ref, bI as RowShape, S as SchemaDef, bR as TABLE_META, bS as TableDef, bT as TableHandle, bU as TableInput, bW as TxColumnExpr, bX as TxInsertShape, bZ as TxNow, b_ as TxPlan, T as TxPlanBody, b$ as TxPlanError, c0 as TxPlanHandle, c1 as TxPlanOpResult, c2 as TxPlanRejection, b as TxPlanResponse, c3 as TxRefError, c4 as TxRow, c5 as TxRows, c6 as TxSelectOptions, c7 as TxSetShape, c9 as TxTable, ca as TxTables, cb as TxWhere, ch as TypedDB, ci as TypedTable, cj as TypedTx, cs as bigint, ct as boolean, cv as dec, cy as defineSchema, cz as defineTable, cA as enumType, cC as inc, cF as installationRef, cG as integer, cH as isPalbaseExtension, cJ as jsonb, cK as makeTypedDB, cL as now, cP as openai, cQ as ownedByUser, cR as policy, cS as raw, cU as text, cV as timestamp, cW as userRef, cX as uuid, cY as vector } from '../index-
|
|
1
|
+
export { f as AnyColumn, k as ColumnBuilder, l as ColumnDef, m as ColumnMap, n as ColumnType, E as EXTENSION_DEPENDENCIES, s as EmbeddingModelRef, u as EnvServiceDatabase, w as EnvTypedDatabase, N as InsertShape, V as Materialized, a0 as OnDeleteAction, a1 as PALBASE_EXTENSIONS, aA as PalbaseExtension, bx as PolicyBuilder, by as PolicyCommand, bz as PolicyDef, bC as PolicyMode, bE as RawConstraintDef, bG as Ref, bI as RowShape, S as SchemaDef, bR as TABLE_META, bS as TableDef, bT as TableHandle, bU as TableInput, bW as TxColumnExpr, bX as TxInsertShape, bZ as TxNow, b_ as TxPlan, T as TxPlanBody, b$ as TxPlanError, c0 as TxPlanHandle, c1 as TxPlanOpResult, c2 as TxPlanRejection, b as TxPlanResponse, c3 as TxRefError, c4 as TxRow, c5 as TxRows, c6 as TxSelectOptions, c7 as TxSetShape, c9 as TxTable, ca as TxTables, cb as TxWhere, ch as TypedDB, ci as TypedTable, cj as TypedTx, cs as bigint, ct as boolean, cv as dec, cy as defineSchema, cz as defineTable, cA as enumType, cC as inc, cF as installationRef, cG as integer, cH as isPalbaseExtension, cJ as jsonb, cK as makeTypedDB, cL as now, cP as openai, cQ as ownedByUser, cR as policy, cS as raw, cU as text, cV as timestamp, cW as userRef, cX as uuid, cY as vector } from '../index-CgE4sVhg.cjs';
|
|
2
2
|
import './env.cjs';
|
|
3
3
|
import '../stack.cjs';
|
|
4
4
|
import 'zod';
|
package/dist/db/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { f as AnyColumn, k as ColumnBuilder, l as ColumnDef, m as ColumnMap, n as ColumnType, E as EXTENSION_DEPENDENCIES, s as EmbeddingModelRef, u as EnvServiceDatabase, w as EnvTypedDatabase, N as InsertShape, V as Materialized, a0 as OnDeleteAction, a1 as PALBASE_EXTENSIONS, aA as PalbaseExtension, bx as PolicyBuilder, by as PolicyCommand, bz as PolicyDef, bC as PolicyMode, bE as RawConstraintDef, bG as Ref, bI as RowShape, S as SchemaDef, bR as TABLE_META, bS as TableDef, bT as TableHandle, bU as TableInput, bW as TxColumnExpr, bX as TxInsertShape, bZ as TxNow, b_ as TxPlan, T as TxPlanBody, b$ as TxPlanError, c0 as TxPlanHandle, c1 as TxPlanOpResult, c2 as TxPlanRejection, b as TxPlanResponse, c3 as TxRefError, c4 as TxRow, c5 as TxRows, c6 as TxSelectOptions, c7 as TxSetShape, c9 as TxTable, ca as TxTables, cb as TxWhere, ch as TypedDB, ci as TypedTable, cj as TypedTx, cs as bigint, ct as boolean, cv as dec, cy as defineSchema, cz as defineTable, cA as enumType, cC as inc, cF as installationRef, cG as integer, cH as isPalbaseExtension, cJ as jsonb, cK as makeTypedDB, cL as now, cP as openai, cQ as ownedByUser, cR as policy, cS as raw, cU as text, cV as timestamp, cW as userRef, cX as uuid, cY as vector } from '../index-
|
|
1
|
+
export { f as AnyColumn, k as ColumnBuilder, l as ColumnDef, m as ColumnMap, n as ColumnType, E as EXTENSION_DEPENDENCIES, s as EmbeddingModelRef, u as EnvServiceDatabase, w as EnvTypedDatabase, N as InsertShape, V as Materialized, a0 as OnDeleteAction, a1 as PALBASE_EXTENSIONS, aA as PalbaseExtension, bx as PolicyBuilder, by as PolicyCommand, bz as PolicyDef, bC as PolicyMode, bE as RawConstraintDef, bG as Ref, bI as RowShape, S as SchemaDef, bR as TABLE_META, bS as TableDef, bT as TableHandle, bU as TableInput, bW as TxColumnExpr, bX as TxInsertShape, bZ as TxNow, b_ as TxPlan, T as TxPlanBody, b$ as TxPlanError, c0 as TxPlanHandle, c1 as TxPlanOpResult, c2 as TxPlanRejection, b as TxPlanResponse, c3 as TxRefError, c4 as TxRow, c5 as TxRows, c6 as TxSelectOptions, c7 as TxSetShape, c9 as TxTable, ca as TxTables, cb as TxWhere, ch as TypedDB, ci as TypedTable, cj as TypedTx, cs as bigint, ct as boolean, cv as dec, cy as defineSchema, cz as defineTable, cA as enumType, cC as inc, cF as installationRef, cG as integer, cH as isPalbaseExtension, cJ as jsonb, cK as makeTypedDB, cL as now, cP as openai, cQ as ownedByUser, cR as policy, cS as raw, cU as text, cV as timestamp, cW as userRef, cX as uuid, cY as vector } from '../index-V7QRh1wg.js';
|
|
2
2
|
import './env.js';
|
|
3
3
|
import '../stack.js';
|
|
4
4
|
import 'zod';
|
package/dist/db/index.js
CHANGED
|
@@ -21,17 +21,17 @@ import {
|
|
|
21
21
|
userRef,
|
|
22
22
|
uuid,
|
|
23
23
|
vector
|
|
24
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-XABHGMUT.js";
|
|
25
25
|
import {
|
|
26
26
|
makeTypedDB
|
|
27
|
-
} from "../chunk-
|
|
27
|
+
} from "../chunk-OZKSM3JW.js";
|
|
28
28
|
import {
|
|
29
29
|
TxPlanError,
|
|
30
30
|
TxRefError,
|
|
31
31
|
dec,
|
|
32
32
|
inc,
|
|
33
33
|
now
|
|
34
|
-
} from "../chunk-
|
|
34
|
+
} from "../chunk-JVZQCC77.js";
|
|
35
35
|
import "../chunk-CGNN2PUH.js";
|
|
36
36
|
import "../chunk-VXPNPVAG.js";
|
|
37
37
|
export {
|
package/dist/engine/index.cjs
CHANGED
|
@@ -62,9 +62,11 @@ __name(brandOf, "brandOf");
|
|
|
62
62
|
function looksLikeUnbrandedRef(v) {
|
|
63
63
|
if (typeof v !== "object" || v === null) return null;
|
|
64
64
|
if (brandOf(v) !== void 0) return null;
|
|
65
|
+
if (isColumnExpr(v)) return null;
|
|
65
66
|
const o = v;
|
|
66
67
|
if (typeof o.$col === "string") return "col";
|
|
67
68
|
if (o.$sql !== void 0 && typeof o.$sql === "object" && o.$sql !== null) return "sql";
|
|
69
|
+
if (o.$expr !== void 0 && typeof o.$expr === "object" && o.$expr !== null) return "expr";
|
|
68
70
|
return null;
|
|
69
71
|
}
|
|
70
72
|
__name(looksLikeUnbrandedRef, "looksLikeUnbrandedRef");
|
|
@@ -91,6 +93,16 @@ function isSqlFragment(v) {
|
|
|
91
93
|
}
|
|
92
94
|
__name(isSqlFragment, "isSqlFragment");
|
|
93
95
|
var TX_EXPR = /* @__PURE__ */ Symbol.for("palbase.tx.expr");
|
|
96
|
+
function isNowExpr(v) {
|
|
97
|
+
if (!isColumnExpr(v)) return false;
|
|
98
|
+
try {
|
|
99
|
+
const e = v[TX_EXPR];
|
|
100
|
+
return typeof e === "object" && e !== null && e.fn === "now";
|
|
101
|
+
} catch {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
__name(isNowExpr, "isNowExpr");
|
|
94
106
|
function isColumnExpr(v) {
|
|
95
107
|
if (typeof v !== "object" && typeof v !== "function") return false;
|
|
96
108
|
if (v === null) return false;
|
|
@@ -173,6 +185,7 @@ function assertUsableFilter(caller, table, where) {
|
|
|
173
185
|
}
|
|
174
186
|
if (cond === null || typeof cond !== "object" || Array.isArray(cond)) continue;
|
|
175
187
|
if (isColRef(cond)) continue;
|
|
188
|
+
if (isNowExpr(cond)) continue;
|
|
176
189
|
const entries = Object.entries(cond);
|
|
177
190
|
if (entries.length === 0) {
|
|
178
191
|
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).`);
|
|
@@ -314,6 +327,11 @@ function encodeValue(value, column, allowColumnExpr) {
|
|
|
314
327
|
field: ref.field
|
|
315
328
|
}
|
|
316
329
|
}, "ref");
|
|
330
|
+
if (isNowExpr(value)) return {
|
|
331
|
+
$expr: {
|
|
332
|
+
fn: "now"
|
|
333
|
+
}
|
|
334
|
+
};
|
|
317
335
|
const expr = exprOf(value);
|
|
318
336
|
if (expr) {
|
|
319
337
|
if (expr.fn !== "now" && !allowColumnExpr) {
|
|
@@ -2096,6 +2114,10 @@ function compileWhereBare(table, colSet, where, add, caller = "search", alias =
|
|
|
2096
2114
|
parts.push(`${q} = ${colRefSql(table, colSet, cond, caller, alias)}`);
|
|
2097
2115
|
continue;
|
|
2098
2116
|
}
|
|
2117
|
+
if (isNowExpr(cond)) {
|
|
2118
|
+
parts.push(`${q} = now()`);
|
|
2119
|
+
continue;
|
|
2120
|
+
}
|
|
2099
2121
|
if (cond !== null && typeof cond === "object" && !Array.isArray(cond)) {
|
|
2100
2122
|
for (const [op, v] of Object.entries(cond)) {
|
|
2101
2123
|
if (op === "contains" || op === "icontains" || op === "startsWith" || op === "endsWith") {
|
|
@@ -2124,6 +2146,13 @@ function compileWhereBare(table, colSet, where, add, caller = "search", alias =
|
|
|
2124
2146
|
continue;
|
|
2125
2147
|
}
|
|
2126
2148
|
parts.push(`${q} IN (${v.map((x) => bind(x)).join(", ")})`);
|
|
2149
|
+
} else if (isNowExpr(v)) {
|
|
2150
|
+
if (!(op in WHERE_OPS)) {
|
|
2151
|
+
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() }`);
|
|
2152
|
+
}
|
|
2153
|
+
parts.push(`${q} ${WHERE_OPS[op]} now()`);
|
|
2154
|
+
} else if (isColumnExpr(v)) {
|
|
2155
|
+
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.`);
|
|
2127
2156
|
} else if (isColRef(v)) {
|
|
2128
2157
|
if (!(op in WHERE_OPS)) {
|
|
2129
2158
|
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") }`);
|
|
@@ -2131,7 +2160,9 @@ function compileWhereBare(table, colSet, where, add, caller = "search", alias =
|
|
|
2131
2160
|
parts.push(`${q} ${WHERE_OPS[op]} ${colRefSql(table, colSet, v, caller, alias)}`);
|
|
2132
2161
|
} else if (looksLikeUnbrandedRef(v) !== null) {
|
|
2133
2162
|
const kind = looksLikeUnbrandedRef(v);
|
|
2134
|
-
|
|
2163
|
+
const made = kind === "col" ? "col()" : kind === "sql" ? "sqlFragment" : "now()";
|
|
2164
|
+
const how = kind === "col" ? 'col("kolon_ad\u0131")' : kind === "sql" ? "sqlFragment`\u2026`" : "now()";
|
|
2165
|
+
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.`);
|
|
2135
2166
|
} else if (op in WHERE_OPS) {
|
|
2136
2167
|
if (v === null && op === "neq") {
|
|
2137
2168
|
parts.push(`${q} IS NOT NULL`);
|