@aeriajs/core 0.0.238 → 0.0.240
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.
|
@@ -47,11 +47,7 @@ const preferredRemove = async (targetId, reference, parentContext) => {
|
|
|
47
47
|
const { result: removeAll } = await (0, assets_js_1.getFunction)(reference.referencedCollection, 'removeAll');
|
|
48
48
|
if (removeAll) {
|
|
49
49
|
return removeAll({
|
|
50
|
-
filters:
|
|
51
|
-
_id: {
|
|
52
|
-
$in: nonNullable,
|
|
53
|
-
},
|
|
54
|
-
},
|
|
50
|
+
filters: nonNullable,
|
|
55
51
|
}, context);
|
|
56
52
|
}
|
|
57
53
|
return coll.deleteMany({
|
|
@@ -44,11 +44,7 @@ export const preferredRemove = async (targetId, reference, parentContext) => {
|
|
|
44
44
|
const { result: removeAll } = await getFunction(reference.referencedCollection, "removeAll");
|
|
45
45
|
if (removeAll) {
|
|
46
46
|
return removeAll({
|
|
47
|
-
filters:
|
|
48
|
-
_id: {
|
|
49
|
-
$in: nonNullable
|
|
50
|
-
}
|
|
51
|
-
}
|
|
47
|
+
filters: nonNullable
|
|
52
48
|
}, context);
|
|
53
49
|
}
|
|
54
50
|
return coll.deleteMany({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Context,
|
|
1
|
+
import type { Context, RemoveAllPayload } from '@aeriajs/types';
|
|
2
2
|
import { Result } from '@aeriajs/types';
|
|
3
3
|
export type RemoveAllOptions = {
|
|
4
4
|
bypassSecurity?: boolean;
|
|
5
5
|
};
|
|
6
|
-
export declare const removeAll: <TContext extends Context>(
|
|
6
|
+
export declare const removeAll: <TContext extends Context>(_payload: RemoveAllPayload, context: TContext, options?: RemoveAllOptions) => Promise<{
|
|
7
7
|
readonly _tag: "Result";
|
|
8
8
|
readonly error: undefined;
|
|
9
9
|
readonly result: import("mongodb").DeleteResult;
|
|
@@ -6,11 +6,7 @@ const common_1 = require("@aeriajs/common");
|
|
|
6
6
|
const security_1 = require("@aeriajs/security");
|
|
7
7
|
const index_js_1 = require("../collection/index.js");
|
|
8
8
|
const internalRemoveAll = async (payload, context) => {
|
|
9
|
-
const filters = (0, common_1.throwIfError)(await (0, index_js_1.traverseDocument)({
|
|
10
|
-
_id: {
|
|
11
|
-
$in: payload.filters,
|
|
12
|
-
},
|
|
13
|
-
}, context.description, {
|
|
9
|
+
const filters = (0, common_1.throwIfError)(await (0, index_js_1.traverseDocument)(payload.filters, context.description, {
|
|
14
10
|
autoCast: true,
|
|
15
11
|
context,
|
|
16
12
|
}));
|
|
@@ -21,7 +17,14 @@ const internalRemoveAll = async (payload, context) => {
|
|
|
21
17
|
}
|
|
22
18
|
return types_1.Result.result(await context.collection.model.deleteMany(filters));
|
|
23
19
|
};
|
|
24
|
-
const removeAll = async (
|
|
20
|
+
const removeAll = async (_payload, context, options = {}) => {
|
|
21
|
+
const payload = {
|
|
22
|
+
filters: {
|
|
23
|
+
_id: {
|
|
24
|
+
$in: _payload.filters,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
25
28
|
if (options.bypassSecurity) {
|
|
26
29
|
return internalRemoveAll(payload, context);
|
|
27
30
|
}
|
|
@@ -4,11 +4,7 @@ import { throwIfError } from "@aeriajs/common";
|
|
|
4
4
|
import { useSecurity } from "@aeriajs/security";
|
|
5
5
|
import { traverseDocument, cascadingRemove } from "../collection/index.mjs";
|
|
6
6
|
const internalRemoveAll = async (payload, context) => {
|
|
7
|
-
const filters = throwIfError(await traverseDocument({
|
|
8
|
-
_id: {
|
|
9
|
-
$in: payload.filters
|
|
10
|
-
}
|
|
11
|
-
}, context.description, {
|
|
7
|
+
const filters = throwIfError(await traverseDocument(payload.filters, context.description, {
|
|
12
8
|
autoCast: true,
|
|
13
9
|
context
|
|
14
10
|
}));
|
|
@@ -19,7 +15,14 @@ const internalRemoveAll = async (payload, context) => {
|
|
|
19
15
|
}
|
|
20
16
|
return Result.result(await context.collection.model.deleteMany(filters));
|
|
21
17
|
};
|
|
22
|
-
export const removeAll = async (
|
|
18
|
+
export const removeAll = async (_payload, context, options = {}) => {
|
|
19
|
+
const payload = {
|
|
20
|
+
filters: {
|
|
21
|
+
_id: {
|
|
22
|
+
$in: _payload.filters
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
23
26
|
if (options.bypassSecurity) {
|
|
24
27
|
return internalRemoveAll(payload, context);
|
|
25
28
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.240",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"aeriaMain": "tests/fixtures/aeriaMain.js",
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"mongodb-memory-server": "^9.2.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@aeriajs/builtins": "^0.0.
|
|
46
|
-
"@aeriajs/common": "^0.0.
|
|
47
|
-
"@aeriajs/entrypoint": "^0.0.
|
|
48
|
-
"@aeriajs/http": "^0.0.
|
|
49
|
-
"@aeriajs/security": "^0.0.
|
|
50
|
-
"@aeriajs/types": "^0.0.
|
|
51
|
-
"@aeriajs/validation": "^0.0.
|
|
45
|
+
"@aeriajs/builtins": "^0.0.240",
|
|
46
|
+
"@aeriajs/common": "^0.0.136",
|
|
47
|
+
"@aeriajs/entrypoint": "^0.0.140",
|
|
48
|
+
"@aeriajs/http": "^0.0.164",
|
|
49
|
+
"@aeriajs/security": "^0.0.240",
|
|
50
|
+
"@aeriajs/types": "^0.0.118",
|
|
51
|
+
"@aeriajs/validation": "^0.0.152"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"mongodb": "^6.5.0",
|