@palbase/backend 36.0.1 → 37.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.
@@ -1849,10 +1849,15 @@ function createMockDB() {
1849
1849
  inserted: false,
1850
1850
  row: existing
1851
1851
  };
1852
- const record = {
1853
- id: crypto.randomUUID(),
1852
+ const data = resolveInsertValues("claim", table, {
1854
1853
  ...unique,
1855
1854
  ...extra
1855
+ });
1856
+ assertUsableWriteValues("claim", table, Object.keys(data), data);
1857
+ assertNoExpressionHandles("claim", table, Object.keys(data), data);
1858
+ const record = {
1859
+ id: crypto.randomUUID(),
1860
+ ...data
1856
1861
  };
1857
1862
  rowsOf(table).push(record);
1858
1863
  track(tracked.inserted, table, record);
@@ -1942,6 +1947,18 @@ function createMockDB() {
1942
1947
  async findMany(table, query, opts) {
1943
1948
  assertUsableFilter("findMany", table, query);
1944
1949
  refuseFragment("findMany", table, query);
1950
+ const { limit, offset } = opts ?? {};
1951
+ if (limit !== void 0 && (!Number.isInteger(limit) || limit < 0)) {
1952
+ throw new Error(`findMany: limit bir negatif olmayan tam say\u0131 olmal\u0131 (geldi: ${String(limit)})`);
1953
+ }
1954
+ if (offset !== void 0) {
1955
+ if (!Number.isInteger(offset) || offset < 0) {
1956
+ throw new Error(`findMany: offset bir negatif olmayan tam say\u0131 olmal\u0131 (geldi: ${String(offset)})`);
1957
+ }
1958
+ if (limit === void 0) {
1959
+ throw new Error("findMany: offset yaln\u0131z limit ile birlikte verilir \u2014 limitsiz offset bir sayfa de\u011Fil, s\u0131n\u0131rs\u0131z bir kuyru\u011Fun kayd\u0131r\u0131lm\u0131\u015F\u0131d\u0131r");
1960
+ }
1961
+ }
1945
1962
  if (opts?.with !== void 0 && Object.keys(opts.with).length > 0) {
1946
1963
  throw new Error(`findMany(${table}): fakeDatabase \`with\` desteklemiyor \u2014 ili\u015Fki grafi\u011Fi yabanc\u0131 anahtarlardan T\xDCRET\u0130L\u0130YOR ve fake \u015Femay\u0131 okumuyor. \u0130li\u015Fkili sat\u0131rlar\u0131 \xF6l\xE7en bir test ger\xE7ek motoru kullanmal\u0131; fake ile \xF6l\xE7mek istiyorsan\u0131z ilgili sat\u0131rlar\u0131 \`seed\` ile ayr\u0131 koyup ayr\u0131 sorgulay\u0131n.`);
1947
1964
  }
@@ -1973,7 +1990,8 @@ function createMockDB() {
1973
1990
  return 0;
1974
1991
  });
1975
1992
  }
1976
- const page = opts?.limit === void 0 ? out : out.slice(0, opts.limit);
1993
+ const start = offset ?? 0;
1994
+ const page = limit === void 0 ? out : out.slice(start, start + limit);
1977
1995
  const cols = opts?.select;
1978
1996
  if (cols === void 0 || cols.length === 0) return page;
1979
1997
  return page.map((row) => Object.fromEntries(cols.map((c) => [