rads-db 3.1.15 → 3.2.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.
@@ -36,9 +36,9 @@ function getEffectFor(entityName, aggregateRelationField, eventEntityName, schem
36
36
  if (!d.doc.id || docsById[d.doc.id]) continue;
37
37
  docsById[d.doc.id] = d.doc;
38
38
  const aggId = d.doc[aggregateRelationField].id;
39
- if (!aggId) throw new Error(`Missing ${entityName}.${aggregateRelationField}.id`);
39
+ if (!aggId) throw new Error(`Missing ${eventEntityName}.${aggregateRelationField}.id`);
40
40
  if (d.oldDoc && aggId !== d.oldDoc[aggregateRelationField].id) {
41
- throw new Error(`Field ${entityName}.${aggregateRelationField}.id cannot be changed`);
41
+ throw new Error(`Field ${eventEntityName}.${aggregateRelationField}.id cannot be changed`);
42
42
  }
43
43
  if (!docsByAggId[aggId]) docsByAggId[aggId] = [];
44
44
  docsByAggId[aggId].push(d.doc);
@@ -28,9 +28,9 @@ function getEffectFor(entityName, aggregateRelationField, eventEntityName, schem
28
28
  if (!d.doc.id || docsById[d.doc.id]) continue;
29
29
  docsById[d.doc.id] = d.doc;
30
30
  const aggId = d.doc[aggregateRelationField].id;
31
- if (!aggId) throw new Error(`Missing ${entityName}.${aggregateRelationField}.id`);
31
+ if (!aggId) throw new Error(`Missing ${eventEntityName}.${aggregateRelationField}.id`);
32
32
  if (d.oldDoc && aggId !== d.oldDoc[aggregateRelationField].id) {
33
- throw new Error(`Field ${entityName}.${aggregateRelationField}.id cannot be changed`);
33
+ throw new Error(`Field ${eventEntityName}.${aggregateRelationField}.id cannot be changed`);
34
34
  }
35
35
  if (!docsByAggId[aggId]) docsByAggId[aggId] = [];
36
36
  docsByAggId[aggId].push(d.doc);
@@ -68,6 +68,9 @@ function getRestRoutes(options) {
68
68
  POST: (args, ctx) => db[entity.handle].getMany(args.body, ctx),
69
69
  PUT: (args, ctx) => db[entity.handle].putMany(args.body?.data, ctx)
70
70
  };
71
+ routes[`${prefix}${entity.handle}/agg`] = {
72
+ POST: (args, ctx) => db[entity.handle].getAgg(args.body, ctx)
73
+ };
71
74
  }
72
75
  return routes;
73
76
  }
@@ -38,6 +38,9 @@ export function getRestRoutes(options) {
38
38
  POST: (args, ctx) => db[entity.handle].getMany(args.body, ctx),
39
39
  PUT: (args, ctx) => db[entity.handle].putMany(args.body?.data, ctx)
40
40
  };
41
+ routes[`${prefix}${entity.handle}/agg`] = {
42
+ POST: (args, ctx) => db[entity.handle].getAgg(args.body, ctx)
43
+ };
41
44
  }
42
45
  return routes;
43
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rads-db",
3
- "version": "3.1.15",
3
+ "version": "3.2.0",
4
4
  "description": "Say goodbye to boilerplate code and hello to efficient and elegant syntax.",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -56,6 +56,7 @@
56
56
  "@supabase/supabase-js": ">=2",
57
57
  "dexie": ">=3",
58
58
  "h3": ">=1.6.0",
59
+ "mssql": ">=9",
59
60
  "typescript": ">=5.0.0"
60
61
  },
61
62
  "peerDependenciesMeta": {
@@ -73,6 +74,9 @@
73
74
  },
74
75
  "dexie": {
75
76
  "optional": true
77
+ },
78
+ "mssql": {
79
+ "optional": true
76
80
  }
77
81
  },
78
82
  "dependencies": {
@@ -91,6 +95,7 @@
91
95
  "@types/eslint": "^8.44.8",
92
96
  "@types/klaw": "^3.0.3",
93
97
  "@types/lodash": "4.14.191",
98
+ "@types/mssql": "^9.1.8",
94
99
  "@types/uuid": "^9.0.2",
95
100
  "@vitest/ui": "^1.6.0",
96
101
  "cross-env": "^7.0.3",