@anteros/core 0.0.2-alpha.7 → 0.0.3
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/package.json +3 -3
- package/server/api.ts +1 -3
- package/server/config.ts +1 -1
- package/tests/api.test.ts +0 -8
- package/types/api.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anteros/core",
|
|
3
3
|
"module": "index.ts",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Anteros Core",
|
|
7
7
|
"private": false,
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"bentocache": "^1.6.1",
|
|
21
21
|
"boxen": "^8.0.1",
|
|
22
22
|
"dayjs": "^1.11.21",
|
|
23
|
-
"hono": "^4.12.
|
|
23
|
+
"hono": "^4.12.27",
|
|
24
24
|
"ioredis": "^5.11.1",
|
|
25
|
-
"joi": "^18.2.
|
|
25
|
+
"joi": "^18.2.3",
|
|
26
26
|
"jose": "^6.2.3",
|
|
27
27
|
"mongodb": "6.21.0",
|
|
28
28
|
"socket.io": "^4.8.3",
|
package/server/api.ts
CHANGED
|
@@ -31,7 +31,6 @@ const ActionsValues = [
|
|
|
31
31
|
'deleteMany',
|
|
32
32
|
'findOne',
|
|
33
33
|
'find',
|
|
34
|
-
'findOneAndUpdate',
|
|
35
34
|
'runService',
|
|
36
35
|
'upload',
|
|
37
36
|
'auth',
|
|
@@ -181,7 +180,6 @@ const crudHandlers: Record<string, CrudHandler> = {
|
|
|
181
180
|
insertMany: (rest, collection, body) => rest.insertMany(collection, body?.data),
|
|
182
181
|
updateOne: (rest, collection, body) => rest.updateOne(collection, body?.id || body?._id, body?.update || {}),
|
|
183
182
|
updateMany: (rest, collection, body) => rest.updateMany(collection, body?.ids || body?._ids || [], body?.update || {}),
|
|
184
|
-
findOneAndUpdate:(rest, collection, body) => rest.findOneAndUpdate(collection, body?.filter || {}, body?.update || {}, body?.options || {}),
|
|
185
183
|
deleteOne: (rest, collection, body) => rest.deleteOne(collection, body?.id || body?._id),
|
|
186
184
|
deleteMany: (rest, collection, body) => rest.deleteMany(collection, body?.ids || body?._ids || []),
|
|
187
185
|
};
|
|
@@ -378,7 +376,7 @@ function initializeApi(app: Hono<{ Variables: HonoVariables }>) {
|
|
|
378
376
|
// Strip readOnlyFields for mutations
|
|
379
377
|
if (action === 'insertOne' || action === 'insertMany') {
|
|
380
378
|
stripReadOnlyData(col, body);
|
|
381
|
-
} else if (action === 'updateOne' || action === 'updateMany'
|
|
379
|
+
} else if (action === 'updateOne' || action === 'updateMany') {
|
|
382
380
|
stripReadOnlyUpdate(col, body);
|
|
383
381
|
}
|
|
384
382
|
|
package/server/config.ts
CHANGED
|
@@ -53,7 +53,7 @@ function safePublicConfig() {
|
|
|
53
53
|
actions: [
|
|
54
54
|
'insertOne', 'insertMany', 'updateOne', 'updateMany',
|
|
55
55
|
'deleteOne', 'deleteMany', 'findOne', 'find',
|
|
56
|
-
'
|
|
56
|
+
'aggregate',
|
|
57
57
|
...Object.keys(c.actions ?? {}),
|
|
58
58
|
],
|
|
59
59
|
fields: (c.fields ?? []).map(f => ({
|
package/tests/api.test.ts
CHANGED
|
@@ -116,14 +116,6 @@ describe("updateMany", () => {
|
|
|
116
116
|
});
|
|
117
117
|
});
|
|
118
118
|
|
|
119
|
-
describe("findOneAndUpdate", () => {
|
|
120
|
-
it("finds and updates atomically", async () => {
|
|
121
|
-
await rest.insertOne("items", { title: "fau", count: 0 });
|
|
122
|
-
const doc = await rest.findOneAndUpdate("items", { title: "fau" }, { $set: { count: 10 } });
|
|
123
|
-
expect(doc.count).toBe(10);
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
|
|
127
119
|
describe("deleteMany", () => {
|
|
128
120
|
it("deletes multiple by ids", async () => {
|
|
129
121
|
const a = await rest.insertOne("items", { title: "d1" });
|