@aeriajs/core 0.0.142 → 0.0.143
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/__scripts__/postinstall.js +6 -2
- package/dist/__scripts__/postinstall.mjs +6 -2
- package/dist/collection/index.d.ts +0 -1
- package/dist/collection/index.js +0 -1
- package/dist/collection/index.mjs +0 -1
- package/dist/collection/prepareInsert.js +1 -8
- package/dist/collection/prepareInsert.mjs +1 -8
- package/dist/functions/count.d.ts +1 -1
- package/dist/functions/get.js +3 -0
- package/dist/functions/get.mjs +3 -0
- package/dist/functions/getAll.d.ts +1 -1
- package/dist/functions/insert.d.ts +2 -6
- package/dist/functions/insert.js +7 -4
- package/dist/functions/insert.mjs +9 -6
- package/dist/functions/remove.d.ts +4 -0
- package/dist/functions/remove.js +3 -0
- package/dist/functions/remove.mjs +3 -0
- package/dist/functions/removeAll.d.ts +6 -1
- package/dist/functions/removeAll.js +3 -0
- package/dist/functions/removeAll.mjs +4 -1
- package/dist/functions/removeFile.d.ts +6 -1
- package/dist/functions/removeFile.js +3 -0
- package/dist/functions/removeFile.mjs +4 -1
- package/package.json +8 -8
- package/dist/collection/fill.d.ts +0 -2
- package/dist/collection/fill.js +0 -14
- package/dist/collection/fill.mjs +0 -11
|
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
const path = __importStar(require("path"));
|
|
27
27
|
const fs = __importStar(require("fs"));
|
|
28
28
|
const DTS_FILENAME = 'aeria.d.ts';
|
|
29
|
-
const
|
|
29
|
+
const makeDts = (typesPath) => `// this file will be overwritten
|
|
30
30
|
import type {} from '@aeriajs/types'
|
|
31
31
|
|
|
32
32
|
declare global {
|
|
@@ -38,7 +38,7 @@ declare global {
|
|
|
38
38
|
: never
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
type Collections = typeof import('
|
|
41
|
+
type Collections = typeof import('${typesPath}') extends infer EntrypointModule
|
|
42
42
|
? 'collections' extends keyof EntrypointModule
|
|
43
43
|
? UnpackCollections<EntrypointModule['collections']>
|
|
44
44
|
: 'default' extends keyof EntrypointModule
|
|
@@ -65,6 +65,10 @@ const install = async () => {
|
|
|
65
65
|
if (!fs.existsSync(aeriaDir)) {
|
|
66
66
|
await fs.promises.mkdir(aeriaDir);
|
|
67
67
|
}
|
|
68
|
+
const { types = 'src/index.ts' } = JSON.parse(await fs.promises.readFile(path.join(process.cwd(), 'package.json'), {
|
|
69
|
+
encoding: 'utf8',
|
|
70
|
+
}));
|
|
71
|
+
const dts = makeDts(path.join('..', types));
|
|
68
72
|
await fs.promises.writeFile(path.join(aeriaDir, DTS_FILENAME), dts);
|
|
69
73
|
};
|
|
70
74
|
install();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as path from "path";
|
|
3
3
|
import * as fs from "fs";
|
|
4
4
|
const DTS_FILENAME = "aeria.d.ts";
|
|
5
|
-
const
|
|
5
|
+
const makeDts = (typesPath) => `// this file will be overwritten
|
|
6
6
|
import type {} from '@aeriajs/types'
|
|
7
7
|
|
|
8
8
|
declare global {
|
|
@@ -14,7 +14,7 @@ declare global {
|
|
|
14
14
|
: never
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
type Collections = typeof import('
|
|
17
|
+
type Collections = typeof import('${typesPath}') extends infer EntrypointModule
|
|
18
18
|
? 'collections' extends keyof EntrypointModule
|
|
19
19
|
? UnpackCollections<EntrypointModule['collections']>
|
|
20
20
|
: 'default' extends keyof EntrypointModule
|
|
@@ -41,6 +41,10 @@ const install = async () => {
|
|
|
41
41
|
if (!fs.existsSync(aeriaDir)) {
|
|
42
42
|
await fs.promises.mkdir(aeriaDir);
|
|
43
43
|
}
|
|
44
|
+
const { types = "src/index.ts" } = JSON.parse(await fs.promises.readFile(path.join(process.cwd(), "package.json"), {
|
|
45
|
+
encoding: "utf8"
|
|
46
|
+
}));
|
|
47
|
+
const dts = makeDts(path.join("..", types));
|
|
44
48
|
await fs.promises.writeFile(path.join(aeriaDir, DTS_FILENAME), dts);
|
|
45
49
|
};
|
|
46
50
|
install();
|
package/dist/collection/index.js
CHANGED
|
@@ -17,7 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./cascadingRemove.js"), exports);
|
|
18
18
|
__exportStar(require("./define.js"), exports);
|
|
19
19
|
__exportStar(require("./description.js"), exports);
|
|
20
|
-
__exportStar(require("./fill.js"), exports);
|
|
21
20
|
__exportStar(require("./normalizeProjection.js"), exports);
|
|
22
21
|
__exportStar(require("./pagination.js"), exports);
|
|
23
22
|
__exportStar(require("./preload.js"), exports);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.prepareInsert = void 0;
|
|
4
|
-
const common_1 = require("@aeriajs/common");
|
|
5
4
|
const prepareCreate = (doc, description) => {
|
|
6
5
|
const result = Object.assign({}, description.defaults || {});
|
|
7
6
|
for (const propName in doc) {
|
|
@@ -34,14 +33,8 @@ const prepareInsert = (payload, description) => {
|
|
|
34
33
|
delete doc._id;
|
|
35
34
|
delete doc.created_at;
|
|
36
35
|
delete doc.updated_at;
|
|
37
|
-
|
|
36
|
+
return docId
|
|
38
37
|
? prepareUpdate(doc)
|
|
39
38
|
: prepareCreate(doc, description);
|
|
40
|
-
Object.keys(what).forEach((k) => {
|
|
41
|
-
if ((0, common_1.isEmptyObject)(what[k])) {
|
|
42
|
-
delete what[k];
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
return what;
|
|
46
39
|
};
|
|
47
40
|
exports.prepareInsert = prepareInsert;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import { isEmptyObject } from "@aeriajs/common";
|
|
3
2
|
const prepareCreate = (doc, description) => {
|
|
4
3
|
const result = Object.assign({}, description.defaults || {});
|
|
5
4
|
for (const propName in doc) {
|
|
@@ -32,11 +31,5 @@ export const prepareInsert = (payload, description) => {
|
|
|
32
31
|
delete doc._id;
|
|
33
32
|
delete doc.created_at;
|
|
34
33
|
delete doc.updated_at;
|
|
35
|
-
|
|
36
|
-
Object.keys(what).forEach((k) => {
|
|
37
|
-
if (isEmptyObject(what[k])) {
|
|
38
|
-
delete what[k];
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
return what;
|
|
34
|
+
return docId ? prepareUpdate(doc) : prepareCreate(doc, description);
|
|
42
35
|
};
|
|
@@ -8,6 +8,6 @@ export declare const count: <TContext extends Context>(payload: CountPayload<Sch
|
|
|
8
8
|
readonly result: any;
|
|
9
9
|
} | {
|
|
10
10
|
readonly _tag: "Error";
|
|
11
|
-
readonly error: import("@aeriajs/types").ACError.InvalidLimit;
|
|
11
|
+
readonly error: import("@aeriajs/types").ACError.InvalidLimit | import("@aeriajs/types").ACError.OwnershipError;
|
|
12
12
|
readonly result: undefined;
|
|
13
13
|
}>;
|
package/dist/functions/get.js
CHANGED
|
@@ -60,6 +60,9 @@ const get = async (payload, context, options = {}) => {
|
|
|
60
60
|
switch (error) {
|
|
61
61
|
case types_1.ACError.InvalidLimit: throw new Error;
|
|
62
62
|
}
|
|
63
|
+
return context.error(types_1.HTTPStatus.Forbidden, {
|
|
64
|
+
code: error,
|
|
65
|
+
});
|
|
63
66
|
}
|
|
64
67
|
return internalGet(securedPayload, context);
|
|
65
68
|
};
|
package/dist/functions/get.mjs
CHANGED
|
@@ -4,7 +4,7 @@ export type GetAllOptions = {
|
|
|
4
4
|
};
|
|
5
5
|
export declare const getAll: <TContext extends Context>(payload: GetAllPayload<SchemaWithId<TContext["description"]>> | undefined, context: TContext, options?: GetAllOptions) => Promise<{
|
|
6
6
|
readonly _tag: "Error";
|
|
7
|
-
readonly error: import("@aeriajs/types").ACError.InvalidLimit;
|
|
7
|
+
readonly error: import("@aeriajs/types").ACError.InvalidLimit | import("@aeriajs/types").ACError.OwnershipError;
|
|
8
8
|
readonly result: undefined;
|
|
9
9
|
} | {
|
|
10
10
|
readonly _tag: "Result";
|
|
@@ -17,7 +17,7 @@ export declare const insertErrorSchema: () => {
|
|
|
17
17
|
readonly required: readonly ["httpStatus", "code"];
|
|
18
18
|
readonly properties: {
|
|
19
19
|
readonly httpStatus: {
|
|
20
|
-
readonly enum: [HTTPStatus.
|
|
20
|
+
readonly enum: [HTTPStatus.Forbidden, HTTPStatus.NotFound, HTTPStatus.UnprocessableContent];
|
|
21
21
|
};
|
|
22
22
|
readonly code: {
|
|
23
23
|
readonly enum: [ACError.InsecureOperator, ACError.OwnershipError, ACError.ResourceNotFound, ACError.TargetImmutable, ValidationErrorCode.EmptyTarget, ValidationErrorCode.InvalidProperties, ValidationErrorCode.MissingProperties, TraverseError.InvalidDocumentId, TraverseError.InvalidTempfile];
|
|
@@ -33,8 +33,4 @@ export declare const insertErrorSchema: () => {
|
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
|
-
export declare const insert: <TContext extends Context>(payload: InsertPayload<SchemaWithId<TContext["description"]>>, context: TContext extends Context<any> ? TContext : never, options?: InsertOptions) => Promise<InsertReturnType<SchemaWithId<TContext["description"]
|
|
37
|
-
readonly _tag: "Error";
|
|
38
|
-
readonly error: ACError;
|
|
39
|
-
readonly result: undefined;
|
|
40
|
-
}>;
|
|
36
|
+
export declare const insert: <TContext extends Context>(payload: InsertPayload<SchemaWithId<TContext["description"]>>, context: TContext extends Context<any> ? TContext : never, options?: InsertOptions) => Promise<InsertReturnType<SchemaWithId<TContext["description"]>>>;
|
package/dist/functions/insert.js
CHANGED
|
@@ -7,8 +7,9 @@ const common_1 = require("@aeriajs/common");
|
|
|
7
7
|
const index_js_1 = require("../collection/index.js");
|
|
8
8
|
const insertErrorSchema = () => (0, common_1.endpointErrorSchema)({
|
|
9
9
|
httpStatus: [
|
|
10
|
-
types_1.HTTPStatus.
|
|
10
|
+
types_1.HTTPStatus.Forbidden,
|
|
11
11
|
types_1.HTTPStatus.NotFound,
|
|
12
|
+
types_1.HTTPStatus.UnprocessableContent,
|
|
12
13
|
],
|
|
13
14
|
code: [
|
|
14
15
|
types_1.ACError.InsecureOperator,
|
|
@@ -93,11 +94,11 @@ const internalInsert = async (payload, context) => {
|
|
|
93
94
|
code: types_1.ACError.ResourceNotFound,
|
|
94
95
|
});
|
|
95
96
|
}
|
|
96
|
-
const result = (0,
|
|
97
|
+
const result = (0, common_1.throwIfError)(await (0, index_js_1.traverseDocument)(doc, context.description, {
|
|
97
98
|
getters: true,
|
|
98
99
|
fromProperties: true,
|
|
99
100
|
recurseReferences: true,
|
|
100
|
-
}))
|
|
101
|
+
}));
|
|
101
102
|
return types_1.Result.result(result);
|
|
102
103
|
};
|
|
103
104
|
const insert = async (payload, context, options = {}) => {
|
|
@@ -107,7 +108,9 @@ const insert = async (payload, context, options = {}) => {
|
|
|
107
108
|
const security = (0, security_1.useSecurity)(context);
|
|
108
109
|
const { error, result: securedPayload } = await security.secureWritePayload(payload);
|
|
109
110
|
if (error) {
|
|
110
|
-
return types_1.
|
|
111
|
+
return context.error(types_1.HTTPStatus.Forbidden, {
|
|
112
|
+
code: error,
|
|
113
|
+
});
|
|
111
114
|
}
|
|
112
115
|
return internalInsert(securedPayload, context);
|
|
113
116
|
};
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
import { Result, HTTPStatus, ACError, ValidationErrorCode, TraverseError } from "@aeriajs/types";
|
|
3
3
|
import { useSecurity } from "@aeriajs/security";
|
|
4
4
|
import { throwIfError, endpointErrorSchema } from "@aeriajs/common";
|
|
5
|
-
import { traverseDocument, normalizeProjection, prepareInsert
|
|
5
|
+
import { traverseDocument, normalizeProjection, prepareInsert } from "../collection/index.mjs";
|
|
6
6
|
export const insertErrorSchema = () => endpointErrorSchema({
|
|
7
7
|
httpStatus: [
|
|
8
|
-
HTTPStatus.
|
|
9
|
-
HTTPStatus.NotFound
|
|
8
|
+
HTTPStatus.Forbidden,
|
|
9
|
+
HTTPStatus.NotFound,
|
|
10
|
+
HTTPStatus.UnprocessableContent
|
|
10
11
|
],
|
|
11
12
|
code: [
|
|
12
13
|
ACError.InsecureOperator,
|
|
@@ -82,11 +83,11 @@ const internalInsert = async (payload, context) => {
|
|
|
82
83
|
code: ACError.ResourceNotFound
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
|
-
const result =
|
|
86
|
+
const result = throwIfError(await traverseDocument(doc, context.description, {
|
|
86
87
|
getters: true,
|
|
87
88
|
fromProperties: true,
|
|
88
89
|
recurseReferences: true
|
|
89
|
-
}))
|
|
90
|
+
}));
|
|
90
91
|
return Result.result(result);
|
|
91
92
|
};
|
|
92
93
|
export const insert = async (payload, context, options = {}) => {
|
|
@@ -96,7 +97,9 @@ export const insert = async (payload, context, options = {}) => {
|
|
|
96
97
|
const security = useSecurity(context);
|
|
97
98
|
const { error, result: securedPayload } = await security.secureWritePayload(payload);
|
|
98
99
|
if (error) {
|
|
99
|
-
return
|
|
100
|
+
return context.error(HTTPStatus.Forbidden, {
|
|
101
|
+
code: error
|
|
102
|
+
});
|
|
100
103
|
}
|
|
101
104
|
return internalInsert(securedPayload, context);
|
|
102
105
|
};
|
|
@@ -11,4 +11,8 @@ export declare const remove: <TContext extends Context>(payload: RemovePayload<S
|
|
|
11
11
|
readonly code: ACError.ResourceNotFound;
|
|
12
12
|
} & {
|
|
13
13
|
httpStatus: HTTPStatus.NotFound;
|
|
14
|
+
}> | Result.Error<{
|
|
15
|
+
readonly code: ACError.OwnershipError;
|
|
16
|
+
} & {
|
|
17
|
+
httpStatus: HTTPStatus.Forbidden;
|
|
14
18
|
}>>;
|
package/dist/functions/remove.js
CHANGED
|
@@ -33,6 +33,9 @@ const remove = async (payload, context, options = {}) => {
|
|
|
33
33
|
switch (error) {
|
|
34
34
|
case types_1.ACError.InvalidLimit: throw new Error;
|
|
35
35
|
}
|
|
36
|
+
return context.error(types_1.HTTPStatus.Forbidden, {
|
|
37
|
+
code: error,
|
|
38
|
+
});
|
|
36
39
|
}
|
|
37
40
|
return internalRemove(securedPayload, context);
|
|
38
41
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Context, RemoveAllPayload } from '@aeriajs/types';
|
|
2
|
+
import { Result, ACError, HTTPStatus } from '@aeriajs/types';
|
|
2
3
|
export type RemoveAllOptions = {
|
|
3
4
|
bypassSecurity?: boolean;
|
|
4
5
|
};
|
|
@@ -6,4 +7,8 @@ export declare const removeAll: <TContext extends Context>(payload: RemoveAllPay
|
|
|
6
7
|
readonly _tag: "Result";
|
|
7
8
|
readonly error: undefined;
|
|
8
9
|
readonly result: import("mongodb").DeleteResult;
|
|
9
|
-
}
|
|
10
|
+
} | Result.Error<{
|
|
11
|
+
readonly code: ACError.OwnershipError;
|
|
12
|
+
} & {
|
|
13
|
+
httpStatus: HTTPStatus.Forbidden;
|
|
14
|
+
}>>;
|
|
@@ -32,6 +32,9 @@ const removeAll = async (payload, context, options = {}) => {
|
|
|
32
32
|
switch (error) {
|
|
33
33
|
case types_1.ACError.InvalidLimit: throw new Error;
|
|
34
34
|
}
|
|
35
|
+
return context.error(types_1.HTTPStatus.Forbidden, {
|
|
36
|
+
code: error,
|
|
37
|
+
});
|
|
35
38
|
}
|
|
36
39
|
return internalRemoveAll(securedPayload, context);
|
|
37
40
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import { Result, ACError } from "@aeriajs/types";
|
|
2
|
+
import { Result, ACError, HTTPStatus } from "@aeriajs/types";
|
|
3
3
|
import { throwIfError } from "@aeriajs/common";
|
|
4
4
|
import { useSecurity } from "@aeriajs/security";
|
|
5
5
|
import { traverseDocument, cascadingRemove } from "../collection/index.mjs";
|
|
@@ -31,6 +31,9 @@ export const removeAll = async (payload, context, options = {}) => {
|
|
|
31
31
|
case ACError.InvalidLimit:
|
|
32
32
|
throw new Error();
|
|
33
33
|
}
|
|
34
|
+
return context.error(HTTPStatus.Forbidden, {
|
|
35
|
+
code: error
|
|
36
|
+
});
|
|
34
37
|
}
|
|
35
38
|
return internalRemoveAll(securedPayload, context);
|
|
36
39
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Context, RemoveFilePayload } from '@aeriajs/types';
|
|
2
|
+
import { Result, ACError, HTTPStatus } from '@aeriajs/types';
|
|
2
3
|
export type RemoveFileOptions = {
|
|
3
4
|
bypassSecurity?: boolean;
|
|
4
5
|
};
|
|
@@ -6,4 +7,8 @@ export declare const removeFile: <TContext extends Context>(payload: RemoveFileP
|
|
|
6
7
|
readonly _tag: "Result";
|
|
7
8
|
readonly error: undefined;
|
|
8
9
|
readonly result: any;
|
|
9
|
-
}
|
|
10
|
+
} | Result.Error<{
|
|
11
|
+
readonly code: ACError.OwnershipError;
|
|
12
|
+
} & {
|
|
13
|
+
httpStatus: HTTPStatus.Forbidden;
|
|
14
|
+
}>>;
|
|
@@ -18,6 +18,9 @@ const removeFile = async (payload, context, options = {}) => {
|
|
|
18
18
|
switch (error) {
|
|
19
19
|
case types_1.ACError.InvalidLimit: throw new Error;
|
|
20
20
|
}
|
|
21
|
+
return context.error(types_1.HTTPStatus.Forbidden, {
|
|
22
|
+
code: error,
|
|
23
|
+
});
|
|
21
24
|
}
|
|
22
25
|
return internalRemoveFile(securedPayload, context);
|
|
23
26
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import { Result, ACError } from "@aeriajs/types";
|
|
2
|
+
import { Result, ACError, HTTPStatus } from "@aeriajs/types";
|
|
3
3
|
import { useSecurity } from "@aeriajs/security";
|
|
4
4
|
const internalRemoveFile = async (payload, context) => {
|
|
5
5
|
const {
|
|
@@ -21,6 +21,9 @@ export const removeFile = async (payload, context, options = {}) => {
|
|
|
21
21
|
case ACError.InvalidLimit:
|
|
22
22
|
throw new Error();
|
|
23
23
|
}
|
|
24
|
+
return context.error(HTTPStatus.Forbidden, {
|
|
25
|
+
code: error
|
|
26
|
+
});
|
|
24
27
|
}
|
|
25
28
|
return internalRemoveFile(securedPayload, context);
|
|
26
29
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.143",
|
|
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.143",
|
|
46
|
+
"@aeriajs/common": "^0.0.89",
|
|
47
|
+
"@aeriajs/entrypoint": "^0.0.91",
|
|
48
|
+
"@aeriajs/http": "^0.0.101",
|
|
49
|
+
"@aeriajs/security": "^0.0.143",
|
|
50
|
+
"@aeriajs/types": "^0.0.77",
|
|
51
|
+
"@aeriajs/validation": "^0.0.92"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"mongodb": "^6.5.0",
|
package/dist/collection/fill.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fill = void 0;
|
|
4
|
-
const common_1 = require("@aeriajs/common");
|
|
5
|
-
const fill = (doc, description) => {
|
|
6
|
-
const docCopy = Object.assign({}, doc);
|
|
7
|
-
for (const key in docCopy) {
|
|
8
|
-
if (docCopy[key] === null) {
|
|
9
|
-
delete docCopy[key];
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
return Object.assign((0, common_1.freshItem)(description), docCopy);
|
|
13
|
-
};
|
|
14
|
-
exports.fill = fill;
|
package/dist/collection/fill.mjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { freshItem } from "@aeriajs/common";
|
|
3
|
-
export const fill = (doc, description) => {
|
|
4
|
-
const docCopy = Object.assign({}, doc);
|
|
5
|
-
for (const key in docCopy) {
|
|
6
|
-
if (docCopy[key] === null) {
|
|
7
|
-
delete docCopy[key];
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
return Object.assign(freshItem(description), docCopy);
|
|
11
|
-
};
|