@palbase/backend 28.0.0 → 30.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 (49) hide show
  1. package/dist/bin/palbase-backend.cjs +166 -12
  2. package/dist/bin/palbase-backend.cjs.map +1 -1
  3. package/dist/bin/palbase-backend.js +3 -3
  4. package/dist/{chunk-RVP6BTEZ.js → chunk-5J5W75A6.js} +15 -4
  5. package/dist/chunk-5J5W75A6.js.map +1 -0
  6. package/dist/{chunk-IVZERLTM.js → chunk-ENZ2RFFJ.js} +2 -2
  7. package/dist/{chunk-SNDXY565.js → chunk-SG4UTNOP.js} +5 -2
  8. package/dist/chunk-SG4UTNOP.js.map +1 -0
  9. package/dist/{chunk-75YROPRZ.js → chunk-VN7NMDUH.js} +166 -15
  10. package/dist/chunk-VN7NMDUH.js.map +1 -0
  11. package/dist/db/index.cjs +4 -1
  12. package/dist/db/index.cjs.map +1 -1
  13. package/dist/db/index.d.cts +1 -1
  14. package/dist/db/index.d.ts +1 -1
  15. package/dist/db/index.js +2 -2
  16. package/dist/engine/index.cjs +166 -12
  17. package/dist/engine/index.cjs.map +1 -1
  18. package/dist/engine/index.d.cts +3 -3
  19. package/dist/engine/index.d.ts +3 -3
  20. package/dist/engine/index.js +3 -3
  21. package/dist/{index-dTTLlHIn.d.ts → index-8qy3kIuA.d.ts} +228 -12
  22. package/dist/{index-DtISj9QX.d.cts → index-DtCgaZAg.d.cts} +228 -12
  23. package/dist/{index-9C3JHxg-.d.cts → index-Zi7MptvP.d.cts} +30 -8
  24. package/dist/{index-BbvOoZFr.d.ts → index-b-Q3l7W5.d.ts} +30 -8
  25. package/dist/index.cjs +66 -3
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +51 -11
  28. package/dist/index.d.ts +51 -11
  29. package/dist/index.js +52 -3
  30. package/dist/index.js.map +1 -1
  31. package/dist/openapi/index.d.cts +2 -2
  32. package/dist/openapi/index.d.ts +2 -2
  33. package/dist/{registry-JQNIX-eA.d.ts → registry-BGJ-Al6F.d.ts} +1 -1
  34. package/dist/{registry-qIPM5BQe.d.cts → registry-CEYLH-Iz.d.cts} +1 -1
  35. package/dist/test/index.cjs +56 -0
  36. package/dist/test/index.cjs.map +1 -1
  37. package/dist/test/index.d.cts +1 -1
  38. package/dist/test/index.d.ts +1 -1
  39. package/dist/test/index.js +56 -0
  40. package/dist/test/index.js.map +1 -1
  41. package/docs/README.md +1 -1
  42. package/docs/database.md +49 -0
  43. package/docs/llms-full.txt +50 -1
  44. package/package.json +1 -1
  45. package/template/package.json +1 -1
  46. package/dist/chunk-75YROPRZ.js.map +0 -1
  47. package/dist/chunk-RVP6BTEZ.js.map +0 -1
  48. package/dist/chunk-SNDXY565.js.map +0 -1
  49. /package/dist/{chunk-IVZERLTM.js.map → chunk-ENZ2RFFJ.js.map} +0 -0
@@ -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-DtISj9QX.cjs';
4
- import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig, S as SseConfig } from '../registry-qIPM5BQe.cjs';
3
+ import { A as AuthSpec, R as RateLimitConfig } from '../index-DtCgaZAg.cjs';
4
+ import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig, S as SseConfig } from '../registry-CEYLH-Iz.cjs';
5
5
  import '../db/env.cjs';
6
6
  import '../stack.cjs';
7
7
  import 'node:async_hooks';
@@ -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-dTTLlHIn.js';
4
- import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig, S as SseConfig } from '../registry-JQNIX-eA.js';
3
+ import { A as AuthSpec, R as RateLimitConfig } from '../index-8qy3kIuA.js';
4
+ import { P as ParamMeta, T as ThrowDescriptor, U as UploadConfig, S as SseConfig } from '../registry-BGJ-Al6F.js';
5
5
  import '../db/env.js';
6
6
  import '../stack.js';
7
7
  import 'node:async_hooks';
@@ -1,4 +1,4 @@
1
- import { A as AuthSpec, R as RateLimitConfig } from './index-dTTLlHIn.js';
1
+ import { A as AuthSpec, R as RateLimitConfig } from './index-8qy3kIuA.js';
2
2
  import { ZodTypeAny } from 'zod';
3
3
  import { PalbaseBucketName } from './stack.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { A as AuthSpec, R as RateLimitConfig } from './index-DtISj9QX.cjs';
1
+ import { A as AuthSpec, R as RateLimitConfig } from './index-DtCgaZAg.cjs';
2
2
  import { ZodTypeAny } from 'zod';
3
3
  import { PalbaseBucketName } from './stack.cjs';
4
4
 
@@ -904,6 +904,62 @@ function createMockDB() {
904
904
  * kalır, üretimde motor adıyla reddederdi — yani fake, sürüm atlamayı
905
905
  * kolaylaştırmak yerine gizlerdi.
906
906
  */
907
+ /**
908
+ * `aggregate` — motorla PARİTE, PARA KESİNLİĞİ dahil.
909
+ *
910
+ * Fake toplamayı JS `number` ile yapsaydı test yeşil kalır ve üretimde
911
+ * `numeric` kesinliği kaybolurdu — yani fake tam da korunması gereken şeyi
912
+ * gizlerdi. `addDecimal` BigInt ölçekli toplama yapıyor, motorun
913
+ * `sum(numeric)::text`'inin karşılığı.
914
+ */
915
+ async aggregate(table, q) {
916
+ const rows = (store.get(table) ?? []).filter((r) => q.where === void 0 || rowMatchesFilter("aggregate", table, r, q.where));
917
+ const groups = q.groupBy ?? [];
918
+ const shape = /* @__PURE__ */ __name((bucket) => {
919
+ const out = {};
920
+ for (const c of q.sum ?? []) {
921
+ const vals = bucket.map((r) => r[c]).filter((v) => v !== null && v !== void 0);
922
+ (out["sum"] ??= {})[c] = vals.length === 0 ? null : String(vals.reduce((a, v) => addDecimal(a, v, 1), "0"));
923
+ }
924
+ for (const c of q.avg ?? []) {
925
+ const vals = bucket.map((r) => r[c]).filter((v) => v !== null && v !== void 0);
926
+ (out["avg"] ??= {})[c] = vals.length === 0 ? null : String(Number(vals.reduce((a, v) => addDecimal(a, v, 1), "0")) / vals.length);
927
+ }
928
+ for (const [fn, pick] of [
929
+ [
930
+ "min",
931
+ -1
932
+ ],
933
+ [
934
+ "max",
935
+ 1
936
+ ]
937
+ ]) {
938
+ for (const c of q[fn] ?? []) {
939
+ const vals = bucket.map((r) => r[c]).filter((v) => v !== null && v !== void 0);
940
+ (out[fn] ??= {})[c] = vals.length === 0 ? null : vals.reduce((a, v) => cmp(v, a, pick === 1 ? "gt" : "lt") ? v : a);
941
+ }
942
+ }
943
+ if (q.count === true) out["count"] = bucket.length;
944
+ return out;
945
+ }, "shape");
946
+ if (groups.length === 0) return shape(rows);
947
+ const byKey = /* @__PURE__ */ new Map();
948
+ for (const r of rows) {
949
+ const k = JSON.stringify(groups.map((c) => r[c]));
950
+ byKey.set(k, [
951
+ ...byKey.get(k) ?? [],
952
+ r
953
+ ]);
954
+ }
955
+ return [
956
+ ...byKey.values()
957
+ ].map((bucket) => {
958
+ const out = shape(bucket);
959
+ for (const c of groups) out[c] = bucket[0][c];
960
+ return out;
961
+ });
962
+ },
907
963
  async insertMany(table, rows) {
908
964
  if (rows.length === 0) return [];
909
965
  const cols = Object.keys(rows[0]);