@palbase/backend 30.0.0 → 32.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.
Files changed (67) hide show
  1. package/dist/bin/palbase-backend.cjs +136 -3
  2. package/dist/bin/palbase-backend.cjs.map +1 -1
  3. package/dist/bin/palbase-backend.js +7 -7
  4. package/dist/{chunk-TWX6JTGJ.js → chunk-26GH54D2.js} +3 -5
  5. package/dist/{chunk-TWX6JTGJ.js.map → chunk-26GH54D2.js.map} +1 -1
  6. package/dist/{chunk-5J5W75A6.js → chunk-5C5UCILO.js} +27 -325
  7. package/dist/chunk-5C5UCILO.js.map +1 -0
  8. package/dist/{chunk-VN7NMDUH.js → chunk-AZJIKCOR.js} +113 -15
  9. package/dist/chunk-AZJIKCOR.js.map +1 -0
  10. package/dist/{chunk-VVMJEVQP.js → chunk-BRLJOXWS.js} +2 -2
  11. package/dist/{chunk-3TUJWHC2.js → chunk-IXAX5CON.js} +378 -19
  12. package/dist/chunk-IXAX5CON.js.map +1 -0
  13. package/dist/{chunk-CGNN2PUH.js → chunk-KATPXCJ5.js} +37 -4
  14. package/dist/{chunk-CGNN2PUH.js.map → chunk-KATPXCJ5.js.map} +1 -1
  15. package/dist/chunk-KGP6ALIU.js +361 -0
  16. package/dist/chunk-KGP6ALIU.js.map +1 -0
  17. package/dist/chunk-XEGZ3S2Q.js +346 -0
  18. package/dist/chunk-XEGZ3S2Q.js.map +1 -0
  19. package/dist/{chunk-ENZ2RFFJ.js → chunk-Z4CZRMNF.js} +3 -310
  20. package/dist/chunk-Z4CZRMNF.js.map +1 -0
  21. package/dist/db/index.cjs +29 -0
  22. package/dist/db/index.cjs.map +1 -1
  23. package/dist/db/index.d.cts +1 -1
  24. package/dist/db/index.d.ts +1 -1
  25. package/dist/db/index.js +12 -13
  26. package/dist/engine/index.cjs +136 -3
  27. package/dist/engine/index.cjs.map +1 -1
  28. package/dist/engine/index.d.cts +3 -3
  29. package/dist/engine/index.d.ts +3 -3
  30. package/dist/engine/index.js +7 -7
  31. package/dist/{index-b-Q3l7W5.d.ts → index-BILC9WwS.d.ts} +9 -2
  32. package/dist/{index-8qy3kIuA.d.ts → index-BgWnP07a.d.ts} +119 -17
  33. package/dist/{index-Zi7MptvP.d.cts → index-CWGiJ2Up.d.cts} +9 -2
  34. package/dist/{index-DtCgaZAg.d.cts → index-DgYkdNT9.d.cts} +119 -17
  35. package/dist/index.cjs +87 -5
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.cts +6 -23
  38. package/dist/index.d.ts +6 -23
  39. package/dist/index.js +48 -48
  40. package/dist/index.js.map +1 -1
  41. package/dist/openapi/index.d.cts +2 -2
  42. package/dist/openapi/index.d.ts +2 -2
  43. package/dist/openapi/index.js +3 -4
  44. package/dist/openapi/index.js.map +1 -1
  45. package/dist/{registry-CEYLH-Iz.d.cts → registry-BcRYIQ-R.d.cts} +1 -1
  46. package/dist/{registry-BGJ-Al6F.d.ts → registry-ClzjxIWy.d.ts} +1 -1
  47. package/dist/test/index.cjs +703 -14
  48. package/dist/test/index.cjs.map +1 -1
  49. package/dist/test/index.d.cts +59 -4
  50. package/dist/test/index.d.ts +59 -4
  51. package/dist/test/index.js +51 -13
  52. package/dist/test/index.js.map +1 -1
  53. package/docs/README.md +1 -1
  54. package/docs/database.md +54 -0
  55. package/docs/llms-full.txt +87 -1
  56. package/docs/schema.md +32 -0
  57. package/package.json +1 -1
  58. package/template/package.json +1 -1
  59. package/dist/chunk-3TUJWHC2.js.map +0 -1
  60. package/dist/chunk-5J5W75A6.js.map +0 -1
  61. package/dist/chunk-ENZ2RFFJ.js.map +0 -1
  62. package/dist/chunk-SG4UTNOP.js +0 -374
  63. package/dist/chunk-SG4UTNOP.js.map +0 -1
  64. package/dist/chunk-VN7NMDUH.js.map +0 -1
  65. package/dist/chunk-VXPNPVAG.js +0 -40
  66. package/dist/chunk-VXPNPVAG.js.map +0 -1
  67. /package/dist/{chunk-VVMJEVQP.js.map → chunk-BRLJOXWS.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- export { f as AnyColumn, l as ColumnBuilder, m as ColumnDef, n as ColumnMap, o as ColumnType, E as EXTENSION_DEPENDENCIES, t as EmbeddingModelRef, v as EnvServiceDatabase, x as EnvTypedDatabase, O as InsertShape, W as Materialized, a1 as OnDeleteAction, a2 as PALBASE_EXTENSIONS, aC as PalbaseExtension, bz as PolicyBuilder, bA as PolicyCommand, bB as PolicyDef, bE as PolicyMode, bG as RawConstraintDef, bI as Ref, bK as RowShape, S as SchemaDef, bT as TABLE_META, bU as TableDef, bV as TableHandle, bW as TableInput, bY as TxColumnExpr, bZ as TxInsertShape, b$ as TxNow, c0 as TxPlan, T as TxPlanBody, c1 as TxPlanError, c2 as TxPlanHandle, c3 as TxPlanOpResult, c4 as TxPlanRejection, b as TxPlanResponse, c5 as TxRefError, c6 as TxRow, c7 as TxRows, c8 as TxSelectOptions, c9 as TxSetShape, cb as TxTable, cc as TxTables, cd as TxWhere, cj as TypedDB, ck as TypedTable, cl as TypedTx, cu as bigint, cv as boolean, cx as dec, cA as defineSchema, cB as defineTable, cC as enumType, cE as inc, cH as installationRef, cI as integer, cJ as isPalbaseExtension, cL as jsonb, cM as makeTypedDB, cN as now, cR as openai, cS as ownedByUser, cT as policy, cU as raw, cW as text, cX as timestamp, cY as userRef, cZ as uuid, c_ as vector } from '../index-DtCgaZAg.cjs';
1
+ export { h as AnyColumn, n as ColumnBuilder, o as ColumnDef, p as ColumnMap, q as ColumnType, v as EXTENSION_DEPENDENCIES, w as EmbeddingModelRef, E as EnvServiceDatabase, z as EnvTypedDatabase, V as InsertShape, $ as Materialized, a6 as OnDeleteAction, a8 as PALBASE_EXTENSIONS, aI as PalbaseExtension, bF as PolicyBuilder, bG as PolicyCommand, bH as PolicyDef, bK as PolicyMode, bN as RawConstraintDef, bP as Ref, bR as RowShape, S as SchemaDef, b_ as TABLE_META, b$ as TableDef, c0 as TableHandle, c1 as TableInput, c3 as TxColumnExpr, c4 as TxInsertShape, c6 as TxNow, c7 as TxPlan, T as TxPlanBody, c8 as TxPlanError, c9 as TxPlanHandle, ca as TxPlanOpResult, cb as TxPlanRejection, c as TxPlanResponse, cc as TxRefError, cd as TxRow, ce as TxRows, cf as TxSelectOptions, cg as TxSetShape, ci as TxTable, cj as TxTables, ck as TxWhere, cq as TypedDB, cr as TypedTable, cs as TypedTx, cD as bigint, cE as boolean, cG as dec, cJ as defineSchema, cK as defineTable, cL as enumType, cN as inc, cQ as installationRef, cR as integer, cS as isPalbaseExtension, cU as jsonb, cV as makeTypedDB, cW as now, c_ as openai, c$ as ownedByUser, d0 as policy, d1 as raw, d3 as text, d4 as timestamp, d5 as userRef, d6 as uuid, d7 as vector } from '../index-DgYkdNT9.cjs';
2
2
  import './env.cjs';
3
3
  import '../stack.cjs';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- export { f as AnyColumn, l as ColumnBuilder, m as ColumnDef, n as ColumnMap, o as ColumnType, E as EXTENSION_DEPENDENCIES, t as EmbeddingModelRef, v as EnvServiceDatabase, x as EnvTypedDatabase, O as InsertShape, W as Materialized, a1 as OnDeleteAction, a2 as PALBASE_EXTENSIONS, aC as PalbaseExtension, bz as PolicyBuilder, bA as PolicyCommand, bB as PolicyDef, bE as PolicyMode, bG as RawConstraintDef, bI as Ref, bK as RowShape, S as SchemaDef, bT as TABLE_META, bU as TableDef, bV as TableHandle, bW as TableInput, bY as TxColumnExpr, bZ as TxInsertShape, b$ as TxNow, c0 as TxPlan, T as TxPlanBody, c1 as TxPlanError, c2 as TxPlanHandle, c3 as TxPlanOpResult, c4 as TxPlanRejection, b as TxPlanResponse, c5 as TxRefError, c6 as TxRow, c7 as TxRows, c8 as TxSelectOptions, c9 as TxSetShape, cb as TxTable, cc as TxTables, cd as TxWhere, cj as TypedDB, ck as TypedTable, cl as TypedTx, cu as bigint, cv as boolean, cx as dec, cA as defineSchema, cB as defineTable, cC as enumType, cE as inc, cH as installationRef, cI as integer, cJ as isPalbaseExtension, cL as jsonb, cM as makeTypedDB, cN as now, cR as openai, cS as ownedByUser, cT as policy, cU as raw, cW as text, cX as timestamp, cY as userRef, cZ as uuid, c_ as vector } from '../index-8qy3kIuA.js';
1
+ export { h as AnyColumn, n as ColumnBuilder, o as ColumnDef, p as ColumnMap, q as ColumnType, v as EXTENSION_DEPENDENCIES, w as EmbeddingModelRef, E as EnvServiceDatabase, z as EnvTypedDatabase, V as InsertShape, $ as Materialized, a6 as OnDeleteAction, a8 as PALBASE_EXTENSIONS, aI as PalbaseExtension, bF as PolicyBuilder, bG as PolicyCommand, bH as PolicyDef, bK as PolicyMode, bN as RawConstraintDef, bP as Ref, bR as RowShape, S as SchemaDef, b_ as TABLE_META, b$ as TableDef, c0 as TableHandle, c1 as TableInput, c3 as TxColumnExpr, c4 as TxInsertShape, c6 as TxNow, c7 as TxPlan, T as TxPlanBody, c8 as TxPlanError, c9 as TxPlanHandle, ca as TxPlanOpResult, cb as TxPlanRejection, c as TxPlanResponse, cc as TxRefError, cd as TxRow, ce as TxRows, cf as TxSelectOptions, cg as TxSetShape, ci as TxTable, cj as TxTables, ck as TxWhere, cq as TypedDB, cr as TypedTable, cs as TypedTx, cD as bigint, cE as boolean, cG as dec, cJ as defineSchema, cK as defineTable, cL as enumType, cN as inc, cQ as installationRef, cR as integer, cS as isPalbaseExtension, cU as jsonb, cV as makeTypedDB, cW as now, c_ as openai, c$ as ownedByUser, d0 as policy, d1 as raw, d3 as text, d4 as timestamp, d5 as userRef, d6 as uuid, d7 as vector } from '../index-BgWnP07a.js';
2
2
  import './env.js';
3
3
  import '../stack.js';
4
4
  import 'zod';
package/dist/db/index.js CHANGED
@@ -3,37 +3,36 @@ import {
3
3
  PALBASE_EXTENSIONS,
4
4
  PolicyBuilder,
5
5
  TABLE_META,
6
- bigint,
7
- boolean,
8
6
  defineSchema,
9
7
  defineTable,
8
+ isPalbaseExtension,
9
+ openai,
10
+ policy,
11
+ raw
12
+ } from "../chunk-Z4CZRMNF.js";
13
+ import {
14
+ bigint,
15
+ boolean,
10
16
  enumType,
11
17
  installationRef,
12
18
  integer,
13
- isPalbaseExtension,
14
19
  jsonb,
15
- openai,
16
20
  ownedByUser,
17
- policy,
18
- raw,
19
21
  text,
20
22
  timestamp,
21
23
  userRef,
22
24
  uuid,
23
25
  vector
24
- } from "../chunk-ENZ2RFFJ.js";
25
- import {
26
- makeTypedDB
27
- } from "../chunk-SG4UTNOP.js";
26
+ } from "../chunk-KGP6ALIU.js";
28
27
  import {
29
28
  TxPlanError,
30
29
  TxRefError,
31
30
  dec,
32
31
  inc,
32
+ makeTypedDB,
33
33
  now
34
- } from "../chunk-3TUJWHC2.js";
35
- import "../chunk-CGNN2PUH.js";
36
- import "../chunk-VXPNPVAG.js";
34
+ } from "../chunk-IXAX5CON.js";
35
+ import "../chunk-KATPXCJ5.js";
37
36
  export {
38
37
  EXTENSION_DEPENDENCIES,
39
38
  PALBASE_EXTENSIONS,
@@ -863,7 +863,11 @@ function qualifiedTableKey(schemaName, tableName) {
863
863
  __name(qualifiedTableKey, "qualifiedTableKey");
864
864
 
865
865
  // src/runtime.ts
866
- var __requestALS = new import_node_async_hooks.AsyncLocalStorage();
866
+ var REQUEST_ALS = /* @__PURE__ */ Symbol.for("palbase.backend.requestALS");
867
+ var __requestALS = (() => {
868
+ const g = globalThis;
869
+ return g[REQUEST_ALS] ??= new import_node_async_hooks.AsyncLocalStorage();
870
+ })();
867
871
  var runtime = null;
868
872
  function __runWithRuntime(services, fn) {
869
873
  return __requestALS.run({
@@ -1129,8 +1133,21 @@ var Flags = Object.assign({
1129
1133
  * the runtime proxy, so caching would leak one request's sibling into
1130
1134
  * another concurrent request. Mirrors `Database.asService()`.
1131
1135
  */
1132
- asService() {
1136
+ $asService() {
1133
1137
  return rawFlags.asService();
1138
+ },
1139
+ /**
1140
+ * The name this member carried before 31.0.0.
1141
+ *
1142
+ * It does NOT work silently. A retired member that quietly keeps returning
1143
+ * is how a rename becomes a mystery: the old call site goes on compiling,
1144
+ * the new name never spreads, and the two live side by side until somebody
1145
+ * greps for one and misses half the codebase. `Database` made this split
1146
+ * first (`$asService`), and this JSDoc promised "exactly like
1147
+ * Database.$asService()" while the promise went unkept.
1148
+ */
1149
+ asService() {
1150
+ throw new Error("Flags.asService() was renamed to Flags.$asService() in 31.0.0 \u2014 system members carry the `$` prefix, like Database.$asService().");
1134
1151
  }
1135
1152
  });
1136
1153
  var Realtime = makeServiceProxy("Realtime");
@@ -1503,6 +1520,25 @@ function makeMemoryCache(opts = {}) {
1503
1520
  }
1504
1521
  __name(makeMemoryCache, "makeMemoryCache");
1505
1522
 
1523
+ // src/db/columns.ts
1524
+ var CODECS = {
1525
+ // Exact-precision column → JS number. Safe below 2^53; a value above it is
1526
+ // not representable and the author wants `asDecimal()` instead.
1527
+ number: {
1528
+ fromDb: /* @__PURE__ */ __name((v) => Number(v), "fromDb"),
1529
+ toDb: /* @__PURE__ */ __name((v) => String(v), "toDb"),
1530
+ tsType: "number"
1531
+ },
1532
+ // Exact-precision column → the string Postgres sent. It exists so the
1533
+ // DECLARATION is explicit: "this column is a decimal I handle as text",
1534
+ // rather than the ABSENCE of a declaration meaning the same thing by default.
1535
+ decimal: {
1536
+ fromDb: /* @__PURE__ */ __name((v) => String(v), "fromDb"),
1537
+ toDb: /* @__PURE__ */ __name((v) => String(v), "toDb"),
1538
+ tsType: "string"
1539
+ }
1540
+ };
1541
+
1506
1542
  // src/db/env-gen.ts
1507
1543
  function forwardName(column) {
1508
1544
  return column.endsWith("_id") ? column.slice(0, -3) : column;
@@ -1716,6 +1752,15 @@ function transformsOf(schema, table) {
1716
1752
  if (def) {
1717
1753
  for (const [col, c] of Object.entries(def.columns ?? {})) {
1718
1754
  const d = c !== null && typeof c === "object" && "_def" in c ? c._def : c;
1755
+ const codec = d?.codec;
1756
+ if (typeof codec === "string" && codec in CODECS) {
1757
+ const c2 = CODECS[codec];
1758
+ out.set(col, {
1759
+ fromDb: c2.fromDb,
1760
+ toDb: c2.toDb
1761
+ });
1762
+ continue;
1763
+ }
1719
1764
  const t = d?.transform;
1720
1765
  if (t !== null && typeof t === "object") {
1721
1766
  out.set(col, t);
@@ -2051,6 +2096,29 @@ function selectClause(table, known, select) {
2051
2096
  }).join(", ");
2052
2097
  }
2053
2098
  __name(selectClause, "selectClause");
2099
+ function quoteLiteral(v) {
2100
+ return `'${v.replace(/'/g, "''")}'`;
2101
+ }
2102
+ __name(quoteLiteral, "quoteLiteral");
2103
+ function orderClauseFor(table, known, orderBy, alias) {
2104
+ if (orderBy === void 0 || orderBy === null) return "";
2105
+ const items = Array.isArray(orderBy) ? orderBy : [
2106
+ orderBy
2107
+ ];
2108
+ if (items.length === 0) return "";
2109
+ const rendered = items.map((o) => {
2110
+ const col = o.column;
2111
+ const shapeOK = /^[A-Za-z_][A-Za-z0-9_]*$/.test(col);
2112
+ if (known !== null ? !known.has(col) : !shapeOK) {
2113
+ throw new Error(`with(${table}): orderBy kolonu "${col}" tabloda yok`);
2114
+ }
2115
+ const dir = o.direction === "desc" ? "DESC" : "ASC";
2116
+ const nulls = o.nulls === "first" ? " NULLS FIRST" : o.nulls === "last" ? " NULLS LAST" : "";
2117
+ return `${alias}.${quoteIdent(col)} ${dir}${nulls}`;
2118
+ });
2119
+ return ` ORDER BY ${rendered.join(", ")}`;
2120
+ }
2121
+ __name(orderClauseFor, "orderClauseFor");
2054
2122
  function orderClause(table, known, orderBy) {
2055
2123
  if (!orderBy) return "";
2056
2124
  const items = Array.isArray(orderBy) ? orderBy : [
@@ -2354,6 +2422,65 @@ function aggregateExpr(table, fn, col, alias) {
2354
2422
  return t !== null && NUMERIC_PG_TYPES.has(t) && t !== "integer" ? `${fn}(${q})::text AS ${quoteIdent(alias)}` : `${fn}(${q}) AS ${quoteIdent(alias)}`;
2355
2423
  }
2356
2424
  __name(aggregateExpr, "aggregateExpr");
2425
+ function jsonObjectFor(table, cols, alias) {
2426
+ const pairs = cols.map((c) => {
2427
+ const t = columnTypeOf(table, c);
2428
+ const expr = t !== null && (t === "numeric" || t === "bigint") ? `${alias}.${quoteIdent(c)}::text` : `${alias}.${quoteIdent(c)}`;
2429
+ return `${quoteLiteral(c)}, ${expr}`;
2430
+ });
2431
+ return `json_build_object(${pairs.join(", ")})`;
2432
+ }
2433
+ __name(jsonObjectFor, "jsonObjectFor");
2434
+ function withClauses(table, spec, add, caller) {
2435
+ const rels = currentRelations.get(table) ?? [];
2436
+ const select = [];
2437
+ const joins = [];
2438
+ let i = 0;
2439
+ for (const [name, opt] of Object.entries(spec)) {
2440
+ if (opt === false || opt === void 0) continue;
2441
+ const rel = rels.find((r) => r.name === name);
2442
+ if (rel === void 0) {
2443
+ const known = rels.map((r) => r.name).sort();
2444
+ throw new Error(`${caller}(${table}): with.${name} diye bir ili\u015Fki yok` + (known.length > 0 ? ` (bilinenler: ${known.join(", ")})` : `. Bu tablo hi\xE7 yabanc\u0131 anahtar bildirmiyor ve ili\u015Fkiler onlardan T\xDCRET\u0130L\u0130R`) + `. \u0130li\u015Fkiler references(() => <tablo>.<kolon>) ile bildirilir.`);
2445
+ }
2446
+ const ourCol = rel.kind === "many" ? primaryKeyOf(table) : rel.via;
2447
+ const theirCol = rel.kind === "many" ? rel.via : primaryKeyOf(rel.to);
2448
+ if (ourCol === null || theirCol === null) {
2449
+ throw new Error(`${caller}(${table}): with.${name} birincil anahtar bilmeden kurulamaz \u2014 ili\u015Fkinin bir ucu tablonun PK's\u0131 ve bu tablo tek kolonlu bir PK bildirmiyor.`);
2450
+ }
2451
+ const o = typeof opt === "object" && opt !== null ? opt : {};
2452
+ const childAlias = `w${++i}`;
2453
+ const childKnown = schemaColumns(rel.to);
2454
+ const childCols = Array.isArray(o["select"]) && o["select"].length > 0 ? o["select"] : childKnown !== null ? [
2455
+ ...childKnown
2456
+ ] : [];
2457
+ if (childCols.length === 0) {
2458
+ throw new Error(`${caller}(${table}): with.${name} i\xE7in "${rel.to}" tablosunun kolonlar\u0131 bilinmiyor \u2014 select ile hangi kolonlar\u0131 istedi\u011Finizi yaz\u0131n.`);
2459
+ }
2460
+ for (const c of childCols) {
2461
+ if (childKnown !== null && !childKnown.has(c)) {
2462
+ throw new Error(`${caller}(${table}): with.${name}.select kolonu "${c}" "${rel.to}" tablosunda yok`);
2463
+ }
2464
+ }
2465
+ const obj = jsonObjectFor(rel.to, childCols, childAlias);
2466
+ const innerWhere = o["where"] !== void 0 && o["where"] !== null ? compileWhereBare(rel.to, childKnown, o["where"], add, caller, childAlias, i) : "";
2467
+ const link = `${childAlias}.${quoteIdent(theirCol)} = t.${quoteIdent(ourCol)}`;
2468
+ const cond = innerWhere === "" ? link : `${link} AND ${innerWhere}`;
2469
+ const inner = orderClauseFor(rel.to, childKnown, o["orderBy"], childAlias) + limitClause(o["limit"]);
2470
+ const outAlias = `wj${i}`;
2471
+ if (rel.kind === "many") {
2472
+ joins.push(`LEFT JOIN LATERAL (SELECT coalesce(json_agg(x.o), '[]'::json) AS d FROM (SELECT ${obj} AS o FROM ${quoteTable(rel.to)} ${childAlias} WHERE ${cond}${inner}) x) ${quoteIdent(outAlias)} ON true`);
2473
+ } else {
2474
+ joins.push(`LEFT JOIN LATERAL (SELECT ${obj} AS d FROM ${quoteTable(rel.to)} ${childAlias} WHERE ${cond}${inner} LIMIT 1) ${quoteIdent(outAlias)} ON true`);
2475
+ }
2476
+ select.push(`${quoteIdent(outAlias)}."d" AS ${quoteIdent(name)}`);
2477
+ }
2478
+ return {
2479
+ select,
2480
+ joins
2481
+ };
2482
+ }
2483
+ __name(withClauses, "withClauses");
2357
2484
  function createOps(tx) {
2358
2485
  const at = /* @__PURE__ */ __name(() => resolveTx(tx), "at");
2359
2486
  const ops = {
@@ -2797,7 +2924,13 @@ function createOps(tx) {
2797
2924
  const limit = limitClause(opts.limit);
2798
2925
  const offset = offsetClause(opts.offset, opts.limit);
2799
2926
  const cols = selectClause(table, known, opts.select);
2800
- const sql = `SELECT ${cols} FROM ${quoteTable(table)} t WHERE true${whereSql}${order}${limit}${offset}`;
2927
+ const w = opts.with !== void 0 && Object.keys(opts.with).length > 0 ? withClauses(table, opts.with, add, "findMany") : {
2928
+ select: [],
2929
+ joins: []
2930
+ };
2931
+ const selectList = w.select.length > 0 ? `${cols === "*" ? "t.*" : cols}, ${w.select.join(", ")}` : cols;
2932
+ const joinSql = w.joins.length > 0 ? ` ${w.joins.join(" ")}` : "";
2933
+ const sql = `SELECT ${selectList} FROM ${quoteTable(table)} t${joinSql} WHERE true${whereSql}${order}${limit}${offset}`;
2801
2934
  return asTableRows(table, await (await at()).unsafe(sql, params));
2802
2935
  },
2803
2936
  /**