@anteros/core 0.0.2 → 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/database/file.ts +21 -7
- package/lib/files.ts +91 -49
- package/package.json +3 -3
- package/server/api.ts +327 -519
- package/server/config.ts +1 -1
- package/tests/api.test.ts +0 -8
- package/types/api.d.ts +0 -1
- package/types/collection.d.ts +13 -18
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" });
|
package/types/api.d.ts
CHANGED
package/types/collection.d.ts
CHANGED
|
@@ -28,20 +28,17 @@ export type Collection = {
|
|
|
28
28
|
payload: any;
|
|
29
29
|
error: typeof fn.error;
|
|
30
30
|
jwt: typeof jwt;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
delete: (name: string) => void;
|
|
43
|
-
}
|
|
44
|
-
|
|
31
|
+
cookies: {
|
|
32
|
+
set: (name: string, value: string, options?: {
|
|
33
|
+
httpOnly?: boolean;
|
|
34
|
+
secure?: boolean;
|
|
35
|
+
maxAge?: number;
|
|
36
|
+
path?: string;
|
|
37
|
+
domain?: string;
|
|
38
|
+
sameSite?: 'lax' | 'strict' | 'none';
|
|
39
|
+
}) => any;
|
|
40
|
+
get: (name: string) => string | undefined;
|
|
41
|
+
delete: (name: string) => void;
|
|
45
42
|
}
|
|
46
43
|
}) => Promise<{
|
|
47
44
|
token: string;
|
|
@@ -52,10 +49,8 @@ export type Collection = {
|
|
|
52
49
|
payload: any;
|
|
53
50
|
error: typeof fn.error;
|
|
54
51
|
jwt: typeof jwt;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
delete: (name: string) => void;
|
|
58
|
-
}
|
|
52
|
+
cookies: {
|
|
53
|
+
delete: (name: string) => void;
|
|
59
54
|
}
|
|
60
55
|
}) => Promise<void>;
|
|
61
56
|
};
|