@aeriajs/core 0.0.188 → 0.0.190
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/collection/traverseDocument.d.ts +2 -1
- package/dist/functions/count.d.ts +3 -7
- package/dist/functions/count.js +10 -4
- package/dist/functions/count.mjs +12 -6
- package/dist/functions/get.d.ts +1 -0
- package/dist/functions/get.js +7 -3
- package/dist/functions/get.mjs +8 -4
- package/dist/functions/getAll.d.ts +1 -0
- package/dist/functions/getAll.js +8 -4
- package/dist/functions/getAll.mjs +9 -5
- package/dist/functions/insert.d.ts +0 -31
- package/dist/functions/insert.js +1 -23
- package/dist/functions/insert.mjs +1 -22
- package/dist/functions/remove.js +1 -0
- package/dist/functions/remove.mjs +2 -1
- package/dist/functions/removeAll.js +1 -0
- package/dist/functions/removeAll.mjs +2 -1
- package/package.json +8 -8
|
@@ -7,6 +7,7 @@ export type TraverseOptionsBase = {
|
|
|
7
7
|
validateWholeness?: boolean | 'deep';
|
|
8
8
|
fromProperties?: boolean;
|
|
9
9
|
allowOperators?: boolean;
|
|
10
|
+
allowInsecureOperators?: boolean;
|
|
10
11
|
undefinedToNull?: boolean;
|
|
11
12
|
preserveHidden?: boolean;
|
|
12
13
|
recurseDeep?: boolean;
|
|
@@ -46,7 +47,7 @@ export declare const traverseDocument: <TWhat>(what: TWhat, description: Descrip
|
|
|
46
47
|
readonly result: TWhat;
|
|
47
48
|
} | {
|
|
48
49
|
readonly _tag: "Error";
|
|
49
|
-
readonly error: ACError.InsecureOperator |
|
|
50
|
+
readonly error: ACError.InsecureOperator | ValidationError | TraverseError;
|
|
50
51
|
readonly result: undefined;
|
|
51
52
|
}>;
|
|
52
53
|
export {};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import type { Context, SchemaWithId, CountPayload } from '@aeriajs/types';
|
|
2
|
-
import { Result } from '@aeriajs/types';
|
|
1
|
+
import type { Context, SchemaWithId, CountPayload, CountReturnType } from '@aeriajs/types';
|
|
3
2
|
export type CountOptions = {
|
|
4
3
|
bypassSecurity?: boolean;
|
|
4
|
+
allowInsecureOperators?: boolean;
|
|
5
5
|
};
|
|
6
|
-
export declare const count: <TContext extends Context>(payload: CountPayload<SchemaWithId<TContext["description"]>>, context: TContext extends Context ? TContext : never, options?: CountOptions) => Promise<
|
|
7
|
-
readonly _tag: "Result";
|
|
8
|
-
readonly error: undefined;
|
|
9
|
-
readonly result: any;
|
|
10
|
-
}>;
|
|
6
|
+
export declare const count: <TContext extends Context>(payload: CountPayload<SchemaWithId<TContext["description"]>>, context: TContext extends Context ? TContext : never, options?: CountOptions) => Promise<CountReturnType>;
|
package/dist/functions/count.js
CHANGED
|
@@ -5,7 +5,7 @@ const security_1 = require("@aeriajs/security");
|
|
|
5
5
|
const types_1 = require("@aeriajs/types");
|
|
6
6
|
const common_1 = require("@aeriajs/common");
|
|
7
7
|
const index_js_1 = require("../collection/index.js");
|
|
8
|
-
const internalCount = async (payload, context) => {
|
|
8
|
+
const internalCount = async (payload, context, options) => {
|
|
9
9
|
const { filters = {} } = payload;
|
|
10
10
|
const $text = '$text' in filters
|
|
11
11
|
? filters.$text
|
|
@@ -16,6 +16,8 @@ const internalCount = async (payload, context) => {
|
|
|
16
16
|
const traversedFilters = (0, common_1.throwIfError)(await (0, index_js_1.traverseDocument)(filters, context.description, {
|
|
17
17
|
autoCast: true,
|
|
18
18
|
allowOperators: true,
|
|
19
|
+
allowInsecureOperators: options.allowInsecureOperators,
|
|
20
|
+
context,
|
|
19
21
|
}));
|
|
20
22
|
if ($text) {
|
|
21
23
|
const pipeline = [];
|
|
@@ -39,13 +41,17 @@ const internalCount = async (payload, context) => {
|
|
|
39
41
|
};
|
|
40
42
|
const count = async (payload, context, options = {}) => {
|
|
41
43
|
if (options.bypassSecurity) {
|
|
42
|
-
return internalCount(payload, context);
|
|
44
|
+
return internalCount(payload, context, options);
|
|
43
45
|
}
|
|
44
46
|
const security = (0, security_1.useSecurity)(context);
|
|
45
47
|
const { error, result: securedPayload } = await security.secureReadPayload(payload);
|
|
46
48
|
if (error) {
|
|
47
|
-
return types_1.
|
|
49
|
+
return context.error(types_1.HTTPStatus.Forbidden, {
|
|
50
|
+
code: error,
|
|
51
|
+
});
|
|
48
52
|
}
|
|
49
|
-
return (0, security_1.applyReadMiddlewares)(securedPayload, context,
|
|
53
|
+
return (0, security_1.applyReadMiddlewares)(securedPayload, context, (payload, context) => {
|
|
54
|
+
return internalCount(payload, context, options);
|
|
55
|
+
});
|
|
50
56
|
};
|
|
51
57
|
exports.count = count;
|
package/dist/functions/count.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { useSecurity, applyReadMiddlewares } from "@aeriajs/security";
|
|
3
|
-
import { Result } from "@aeriajs/types";
|
|
3
|
+
import { Result, HTTPStatus } from "@aeriajs/types";
|
|
4
4
|
import { throwIfError } from "@aeriajs/common";
|
|
5
5
|
import { traverseDocument } from "../collection/index.mjs";
|
|
6
|
-
const internalCount = async (payload, context) => {
|
|
6
|
+
const internalCount = async (payload, context, options) => {
|
|
7
7
|
const { filters = {} } = payload;
|
|
8
8
|
const $text = "$text" in filters ? filters.$text : void 0;
|
|
9
9
|
if ("$text" in filters) {
|
|
@@ -11,7 +11,9 @@ const internalCount = async (payload, context) => {
|
|
|
11
11
|
}
|
|
12
12
|
const traversedFilters = throwIfError(await traverseDocument(filters, context.description, {
|
|
13
13
|
autoCast: true,
|
|
14
|
-
allowOperators: true
|
|
14
|
+
allowOperators: true,
|
|
15
|
+
allowInsecureOperators: options.allowInsecureOperators,
|
|
16
|
+
context
|
|
15
17
|
}));
|
|
16
18
|
if ($text) {
|
|
17
19
|
const pipeline = [];
|
|
@@ -33,12 +35,16 @@ const internalCount = async (payload, context) => {
|
|
|
33
35
|
};
|
|
34
36
|
export const count = async (payload, context, options = {}) => {
|
|
35
37
|
if (options.bypassSecurity) {
|
|
36
|
-
return internalCount(payload, context);
|
|
38
|
+
return internalCount(payload, context, options);
|
|
37
39
|
}
|
|
38
40
|
const security = useSecurity(context);
|
|
39
41
|
const { error, result: securedPayload } = await security.secureReadPayload(payload);
|
|
40
42
|
if (error) {
|
|
41
|
-
return
|
|
43
|
+
return context.error(HTTPStatus.Forbidden, {
|
|
44
|
+
code: error
|
|
45
|
+
});
|
|
42
46
|
}
|
|
43
|
-
return applyReadMiddlewares(securedPayload, context,
|
|
47
|
+
return applyReadMiddlewares(securedPayload, context, (payload2, context2) => {
|
|
48
|
+
return internalCount(payload2, context2, options);
|
|
49
|
+
});
|
|
44
50
|
};
|
package/dist/functions/get.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Context, SchemaWithId, GetPayload, GetReturnType } from '@aeriajs/types';
|
|
2
2
|
export type GetOptions = {
|
|
3
3
|
bypassSecurity?: boolean;
|
|
4
|
+
allowInsecureOperators?: boolean;
|
|
4
5
|
};
|
|
5
6
|
export declare const get: <TContext extends Context>(payload: GetPayload<SchemaWithId<TContext["description"]>>, context: TContext, options?: GetOptions) => Promise<GetReturnType<SchemaWithId<TContext["description"]>>>;
|
package/dist/functions/get.js
CHANGED
|
@@ -5,7 +5,7 @@ const security_1 = require("@aeriajs/security");
|
|
|
5
5
|
const types_1 = require("@aeriajs/types");
|
|
6
6
|
const common_1 = require("@aeriajs/common");
|
|
7
7
|
const index_js_1 = require("../collection/index.js");
|
|
8
|
-
const internalGet = async (payload, context) => {
|
|
8
|
+
const internalGet = async (payload, context, options) => {
|
|
9
9
|
const { filters = {}, project, } = payload;
|
|
10
10
|
if (Object.keys(filters).length === 0) {
|
|
11
11
|
return context.error(types_1.HTTPStatus.BadRequest, {
|
|
@@ -19,6 +19,8 @@ const internalGet = async (payload, context) => {
|
|
|
19
19
|
const { error: filtersError, result: traversedFilters } = await (0, index_js_1.traverseDocument)(filters, context.description, {
|
|
20
20
|
autoCast: true,
|
|
21
21
|
allowOperators: true,
|
|
22
|
+
allowInsecureOperators: options.allowInsecureOperators,
|
|
23
|
+
context,
|
|
22
24
|
});
|
|
23
25
|
if (filtersError) {
|
|
24
26
|
switch (filtersError) {
|
|
@@ -62,7 +64,7 @@ const internalGet = async (payload, context) => {
|
|
|
62
64
|
};
|
|
63
65
|
const get = async (payload, context, options = {}) => {
|
|
64
66
|
if (options.bypassSecurity) {
|
|
65
|
-
return internalGet(payload, context);
|
|
67
|
+
return internalGet(payload, context, options);
|
|
66
68
|
}
|
|
67
69
|
const security = (0, security_1.useSecurity)(context);
|
|
68
70
|
const { error, result: securedPayload } = await security.secureReadPayload(payload);
|
|
@@ -74,6 +76,8 @@ const get = async (payload, context, options = {}) => {
|
|
|
74
76
|
code: error,
|
|
75
77
|
});
|
|
76
78
|
}
|
|
77
|
-
return (0, security_1.applyReadMiddlewares)(securedPayload, context,
|
|
79
|
+
return (0, security_1.applyReadMiddlewares)(securedPayload, context, (payload, context) => {
|
|
80
|
+
return internalGet(payload, context, options);
|
|
81
|
+
});
|
|
78
82
|
};
|
|
79
83
|
exports.get = get;
|
package/dist/functions/get.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
getReferences,
|
|
9
9
|
buildLookupPipeline
|
|
10
10
|
} from "../collection/index.mjs";
|
|
11
|
-
const internalGet = async (payload, context) => {
|
|
11
|
+
const internalGet = async (payload, context, options) => {
|
|
12
12
|
const {
|
|
13
13
|
filters = {},
|
|
14
14
|
project
|
|
@@ -24,7 +24,9 @@ const internalGet = async (payload, context) => {
|
|
|
24
24
|
});
|
|
25
25
|
const { error: filtersError, result: traversedFilters } = await traverseDocument(filters, context.description, {
|
|
26
26
|
autoCast: true,
|
|
27
|
-
allowOperators: true
|
|
27
|
+
allowOperators: true,
|
|
28
|
+
allowInsecureOperators: options.allowInsecureOperators,
|
|
29
|
+
context
|
|
28
30
|
});
|
|
29
31
|
if (filtersError) {
|
|
30
32
|
switch (filtersError) {
|
|
@@ -68,7 +70,7 @@ const internalGet = async (payload, context) => {
|
|
|
68
70
|
};
|
|
69
71
|
export const get = async (payload, context, options = {}) => {
|
|
70
72
|
if (options.bypassSecurity) {
|
|
71
|
-
return internalGet(payload, context);
|
|
73
|
+
return internalGet(payload, context, options);
|
|
72
74
|
}
|
|
73
75
|
const security = useSecurity(context);
|
|
74
76
|
const { error, result: securedPayload } = await security.secureReadPayload(payload);
|
|
@@ -81,5 +83,7 @@ export const get = async (payload, context, options = {}) => {
|
|
|
81
83
|
code: error
|
|
82
84
|
});
|
|
83
85
|
}
|
|
84
|
-
return applyReadMiddlewares(securedPayload, context,
|
|
86
|
+
return applyReadMiddlewares(securedPayload, context, (payload2, context2) => {
|
|
87
|
+
return internalGet(payload2, context2, options);
|
|
88
|
+
});
|
|
85
89
|
};
|
|
@@ -2,5 +2,6 @@ import type { Context, SchemaWithId, GetAllPayload, GetAllReturnType } from '@ae
|
|
|
2
2
|
export type GetAllOptions = {
|
|
3
3
|
bypassSecurity?: boolean;
|
|
4
4
|
noDefaultLimit?: boolean;
|
|
5
|
+
allowInsecureOperators?: boolean;
|
|
5
6
|
};
|
|
6
7
|
export declare const getAll: <TContext extends Context>(payload: GetAllPayload<SchemaWithId<TContext["description"]>> | undefined, context: TContext, options?: GetAllOptions) => Promise<GetAllReturnType<SchemaWithId<TContext["description"]>>>;
|
package/dist/functions/getAll.js
CHANGED
|
@@ -5,7 +5,7 @@ const security_1 = require("@aeriajs/security");
|
|
|
5
5
|
const types_1 = require("@aeriajs/types");
|
|
6
6
|
const common_1 = require("@aeriajs/common");
|
|
7
7
|
const index_js_1 = require("../collection/index.js");
|
|
8
|
-
const internalGetAll = async (payload, context) => {
|
|
8
|
+
const internalGetAll = async (payload, context, options) => {
|
|
9
9
|
const { limit, sort, project, offset = 0, } = payload;
|
|
10
10
|
const filters = payload.filters
|
|
11
11
|
? Object.assign({}, payload.filters)
|
|
@@ -42,6 +42,8 @@ const internalGetAll = async (payload, context) => {
|
|
|
42
42
|
const { error: filtersError, result: traversedFilters } = await (0, index_js_1.traverseDocument)(filters, context.description, {
|
|
43
43
|
autoCast: true,
|
|
44
44
|
allowOperators: true,
|
|
45
|
+
allowInsecureOperators: options.allowInsecureOperators,
|
|
46
|
+
context,
|
|
45
47
|
});
|
|
46
48
|
if (filtersError) {
|
|
47
49
|
switch (filtersError) {
|
|
@@ -100,10 +102,10 @@ const internalGetAll = async (payload, context) => {
|
|
|
100
102
|
};
|
|
101
103
|
const getAll = async (payload, context, options = {}) => {
|
|
102
104
|
if (!payload) {
|
|
103
|
-
return internalGetAll({}, context);
|
|
105
|
+
return internalGetAll({}, context, options);
|
|
104
106
|
}
|
|
105
107
|
if (options.bypassSecurity) {
|
|
106
|
-
return internalGetAll(payload, context);
|
|
108
|
+
return internalGetAll(payload, context, options);
|
|
107
109
|
}
|
|
108
110
|
const security = (0, security_1.useSecurity)(context);
|
|
109
111
|
const { error, result: securedPayload } = await security.secureReadPayload(payload);
|
|
@@ -115,6 +117,8 @@ const getAll = async (payload, context, options = {}) => {
|
|
|
115
117
|
if (!options.noDefaultLimit) {
|
|
116
118
|
securedPayload.limit ||= context.config.defaultPaginationLimit;
|
|
117
119
|
}
|
|
118
|
-
return (0, security_1.applyReadMiddlewares)(securedPayload, context,
|
|
120
|
+
return (0, security_1.applyReadMiddlewares)(securedPayload, context, (payload, context) => {
|
|
121
|
+
return internalGetAll(payload, context, options);
|
|
122
|
+
});
|
|
119
123
|
};
|
|
120
124
|
exports.getAll = getAll;
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
getReferences,
|
|
9
9
|
buildLookupPipeline
|
|
10
10
|
} from "../collection/index.mjs";
|
|
11
|
-
const internalGetAll = async (payload, context) => {
|
|
11
|
+
const internalGetAll = async (payload, context, options) => {
|
|
12
12
|
const {
|
|
13
13
|
limit,
|
|
14
14
|
sort,
|
|
@@ -41,7 +41,9 @@ const internalGetAll = async (payload, context) => {
|
|
|
41
41
|
}
|
|
42
42
|
const { error: filtersError, result: traversedFilters } = await traverseDocument(filters, context.description, {
|
|
43
43
|
autoCast: true,
|
|
44
|
-
allowOperators: true
|
|
44
|
+
allowOperators: true,
|
|
45
|
+
allowInsecureOperators: options.allowInsecureOperators,
|
|
46
|
+
context
|
|
45
47
|
});
|
|
46
48
|
if (filtersError) {
|
|
47
49
|
switch (filtersError) {
|
|
@@ -100,10 +102,10 @@ const internalGetAll = async (payload, context) => {
|
|
|
100
102
|
};
|
|
101
103
|
export const getAll = async (payload, context, options = {}) => {
|
|
102
104
|
if (!payload) {
|
|
103
|
-
return internalGetAll({}, context);
|
|
105
|
+
return internalGetAll({}, context, options);
|
|
104
106
|
}
|
|
105
107
|
if (options.bypassSecurity) {
|
|
106
|
-
return internalGetAll(payload, context);
|
|
108
|
+
return internalGetAll(payload, context, options);
|
|
107
109
|
}
|
|
108
110
|
const security = useSecurity(context);
|
|
109
111
|
const { error, result: securedPayload } = await security.secureReadPayload(payload);
|
|
@@ -115,5 +117,7 @@ export const getAll = async (payload, context, options = {}) => {
|
|
|
115
117
|
if (!options.noDefaultLimit) {
|
|
116
118
|
securedPayload.limit ||= context.config.defaultPaginationLimit;
|
|
117
119
|
}
|
|
118
|
-
return applyReadMiddlewares(securedPayload, context,
|
|
120
|
+
return applyReadMiddlewares(securedPayload, context, (payload2, context2) => {
|
|
121
|
+
return internalGetAll(payload2, context2, options);
|
|
122
|
+
});
|
|
119
123
|
};
|
|
@@ -1,36 +1,5 @@
|
|
|
1
1
|
import type { Context, SchemaWithId, InsertPayload, InsertReturnType } from '@aeriajs/types';
|
|
2
|
-
import { HTTPStatus, ACError, ValidationErrorCode, TraverseError } from '@aeriajs/types';
|
|
3
2
|
export type InsertOptions = {
|
|
4
3
|
bypassSecurity?: boolean;
|
|
5
4
|
};
|
|
6
|
-
export declare const insertErrorSchema: () => {
|
|
7
|
-
readonly type: "object";
|
|
8
|
-
readonly properties: {
|
|
9
|
-
readonly _tag: {
|
|
10
|
-
readonly const: "Error";
|
|
11
|
-
};
|
|
12
|
-
readonly result: {
|
|
13
|
-
readonly const: undefined;
|
|
14
|
-
};
|
|
15
|
-
readonly error: {
|
|
16
|
-
readonly type: "object";
|
|
17
|
-
readonly required: readonly ["httpStatus", "code"];
|
|
18
|
-
readonly properties: {
|
|
19
|
-
readonly httpStatus: {
|
|
20
|
-
readonly enum: [HTTPStatus.Forbidden, HTTPStatus.NotFound, HTTPStatus.UnprocessableContent, HTTPStatus.BadRequest];
|
|
21
|
-
};
|
|
22
|
-
readonly code: {
|
|
23
|
-
readonly enum: [ACError.InsecureOperator, ACError.OwnershipError, ACError.ResourceNotFound, ACError.TargetImmutable, ACError.MalformedInput, ValidationErrorCode.EmptyTarget, ValidationErrorCode.InvalidProperties, ValidationErrorCode.MissingProperties, TraverseError.InvalidDocumentId, TraverseError.InvalidTempfile];
|
|
24
|
-
};
|
|
25
|
-
readonly message: {
|
|
26
|
-
readonly type: "string";
|
|
27
|
-
};
|
|
28
|
-
readonly details: {
|
|
29
|
-
readonly type: "object";
|
|
30
|
-
readonly variable: true;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
5
|
export declare const insert: <TContext extends Context>(payload: InsertPayload<SchemaWithId<TContext["description"]>>, context: TContext, options?: InsertOptions) => Promise<InsertReturnType<SchemaWithId<TContext["description"]>>>;
|
package/dist/functions/insert.js
CHANGED
|
@@ -1,33 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.insert =
|
|
3
|
+
exports.insert = void 0;
|
|
4
4
|
const mongodb_1 = require("mongodb");
|
|
5
5
|
const types_1 = require("@aeriajs/types");
|
|
6
6
|
const security_1 = require("@aeriajs/security");
|
|
7
|
-
const common_1 = require("@aeriajs/common");
|
|
8
7
|
const index_js_1 = require("../collection/index.js");
|
|
9
8
|
const get_js_1 = require("./get.js");
|
|
10
|
-
const insertErrorSchema = () => (0, common_1.endpointErrorSchema)({
|
|
11
|
-
httpStatus: [
|
|
12
|
-
types_1.HTTPStatus.Forbidden,
|
|
13
|
-
types_1.HTTPStatus.NotFound,
|
|
14
|
-
types_1.HTTPStatus.UnprocessableContent,
|
|
15
|
-
types_1.HTTPStatus.BadRequest,
|
|
16
|
-
],
|
|
17
|
-
code: [
|
|
18
|
-
types_1.ACError.InsecureOperator,
|
|
19
|
-
types_1.ACError.OwnershipError,
|
|
20
|
-
types_1.ACError.ResourceNotFound,
|
|
21
|
-
types_1.ACError.TargetImmutable,
|
|
22
|
-
types_1.ACError.MalformedInput,
|
|
23
|
-
types_1.ValidationErrorCode.EmptyTarget,
|
|
24
|
-
types_1.ValidationErrorCode.InvalidProperties,
|
|
25
|
-
types_1.ValidationErrorCode.MissingProperties,
|
|
26
|
-
types_1.TraverseError.InvalidDocumentId,
|
|
27
|
-
types_1.TraverseError.InvalidTempfile,
|
|
28
|
-
],
|
|
29
|
-
});
|
|
30
|
-
exports.insertErrorSchema = insertErrorSchema;
|
|
31
9
|
const prepareCreate = (doc, description) => {
|
|
32
10
|
const result = {};
|
|
33
11
|
if (description.defaults) {
|
|
@@ -1,30 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { ObjectId } from "mongodb";
|
|
3
|
-
import { Result, HTTPStatus
|
|
3
|
+
import { Result, HTTPStatus } from "@aeriajs/types";
|
|
4
4
|
import { useSecurity, applyWriteMiddlewares } from "@aeriajs/security";
|
|
5
|
-
import { endpointErrorSchema } from "@aeriajs/common";
|
|
6
5
|
import { traverseDocument } from "../collection/index.mjs";
|
|
7
6
|
import { get } from "./get.mjs";
|
|
8
|
-
export const insertErrorSchema = () => endpointErrorSchema({
|
|
9
|
-
httpStatus: [
|
|
10
|
-
HTTPStatus.Forbidden,
|
|
11
|
-
HTTPStatus.NotFound,
|
|
12
|
-
HTTPStatus.UnprocessableContent,
|
|
13
|
-
HTTPStatus.BadRequest
|
|
14
|
-
],
|
|
15
|
-
code: [
|
|
16
|
-
ACError.InsecureOperator,
|
|
17
|
-
ACError.OwnershipError,
|
|
18
|
-
ACError.ResourceNotFound,
|
|
19
|
-
ACError.TargetImmutable,
|
|
20
|
-
ACError.MalformedInput,
|
|
21
|
-
ValidationErrorCode.EmptyTarget,
|
|
22
|
-
ValidationErrorCode.InvalidProperties,
|
|
23
|
-
ValidationErrorCode.MissingProperties,
|
|
24
|
-
TraverseError.InvalidDocumentId,
|
|
25
|
-
TraverseError.InvalidTempfile
|
|
26
|
-
]
|
|
27
|
-
});
|
|
28
7
|
const prepareCreate = (doc, description) => {
|
|
29
8
|
const result = {};
|
|
30
9
|
if (description.defaults) {
|
package/dist/functions/remove.js
CHANGED
|
@@ -13,6 +13,7 @@ const internalRemove = async (payload, context) => {
|
|
|
13
13
|
}
|
|
14
14
|
const filters = (0, common_1.throwIfError)(await (0, index_js_1.traverseDocument)(payload.filters, context.description, {
|
|
15
15
|
autoCast: true,
|
|
16
|
+
context,
|
|
16
17
|
}));
|
|
17
18
|
const target = await context.collection.model.findOne(filters);
|
|
18
19
|
if (!target) {
|
|
@@ -10,7 +10,8 @@ const internalRemove = async (payload, context) => {
|
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
const filters = throwIfError(await traverseDocument(payload.filters, context.description, {
|
|
13
|
-
autoCast: true
|
|
13
|
+
autoCast: true,
|
|
14
|
+
context
|
|
14
15
|
}));
|
|
15
16
|
const target = await context.collection.model.findOne(filters);
|
|
16
17
|
if (!target) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.190",
|
|
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.190",
|
|
46
|
+
"@aeriajs/common": "^0.0.116",
|
|
47
|
+
"@aeriajs/entrypoint": "^0.0.119",
|
|
48
|
+
"@aeriajs/http": "^0.0.130",
|
|
49
|
+
"@aeriajs/security": "^0.0.190",
|
|
50
|
+
"@aeriajs/types": "^0.0.99",
|
|
51
|
+
"@aeriajs/validation": "^0.0.119"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"mongodb": "^6.5.0",
|