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.
- package/dist/config.d.ts +1 -1
- package/dist/index.cjs +17 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +17 -3
- package/dist/{types-9cb9d6e7.d.ts → types-dd50fa7e.d.ts} +9 -8
- package/drivers/azureCosmos.cjs +75 -7
- package/drivers/azureCosmos.mjs +66 -7
- package/drivers/azureStorageBlob.cjs +4 -4
- package/drivers/azureStorageBlob.mjs +4 -4
- package/drivers/restApi.cjs +22 -2
- package/drivers/restApi.mjs +13 -2
- package/drivers/sql.cjs +848 -0
- package/drivers/sql.d.ts +12 -0
- package/drivers/sql.mjs +705 -0
- package/features/eventSourcing.cjs +2 -2
- package/features/eventSourcing.mjs +2 -2
- package/integrations/restEndpoints.cjs +3 -0
- package/integrations/restEndpoints.mjs +3 -0
- package/package.json +6 -1
|
@@ -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 ${
|
|
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 ${
|
|
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 ${
|
|
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 ${
|
|
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.
|
|
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",
|