@aeriajs/core 0.0.215 → 0.0.217
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 +2 -2
- package/dist/__scripts__/postinstall.mjs +2 -2
- package/dist/collection/makePagination.js +1 -1
- package/dist/collection/makePagination.mjs +1 -1
- package/dist/collection/traverseDocument.d.ts +2 -4
- package/dist/collection/traverseDocument.js +2 -2
- package/dist/collection/traverseDocument.mjs +2 -2
- package/dist/database.js +2 -2
- package/dist/database.mjs +1 -1
- package/dist/functions/upload.js +5 -5
- package/dist/functions/upload.mjs +3 -3
- package/package.json +8 -8
|
@@ -33,8 +33,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
const path = __importStar(require("path"));
|
|
37
|
-
const fs = __importStar(require("fs"));
|
|
36
|
+
const path = __importStar(require("node:path"));
|
|
37
|
+
const fs = __importStar(require("node:fs"));
|
|
38
38
|
const DTS_FILENAME = 'aeria.d.ts';
|
|
39
39
|
const makeDts = (typesPath) => `// this file will be overwritten
|
|
40
40
|
import type {} from '@aeriajs/types'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
import * as fs from "fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import * as fs from "node:fs";
|
|
4
4
|
const DTS_FILENAME = "aeria.d.ts";
|
|
5
5
|
const makeDts = (typesPath) => `// this file will be overwritten
|
|
6
6
|
import type {} from '@aeriajs/types'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.makePagination = void 0;
|
|
4
|
-
const count_js_1 = require("../functions/count.js");
|
|
5
4
|
const common_1 = require("@aeriajs/common");
|
|
5
|
+
const count_js_1 = require("../functions/count.js");
|
|
6
6
|
const makePagination = async (payload, documents, context) => {
|
|
7
7
|
const { offset = 0, limit = context.config.defaultPaginationLimit, } = payload;
|
|
8
8
|
const recordsTotal = typeof context.collection.functions.count === 'function'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Description, Property, ValidationError, RouteContext } from '@aeriajs/types';
|
|
1
|
+
import type { Description, Property, ValidationError, RouteContext, TempId } from '@aeriajs/types';
|
|
2
2
|
import { ACError, TraverseError } from '@aeriajs/types';
|
|
3
3
|
import { ObjectId } from 'mongodb';
|
|
4
4
|
export type TraverseOptionsBase = {
|
|
@@ -27,9 +27,7 @@ export type TraverseNormalized = {
|
|
|
27
27
|
description: Description;
|
|
28
28
|
pipe: (value: unknown, phaseContext: PhaseContext) => unknown;
|
|
29
29
|
};
|
|
30
|
-
export type ValidTempFile = null | undefined | ObjectId |
|
|
31
|
-
tempId: string;
|
|
32
|
-
};
|
|
30
|
+
export type ValidTempFile = null | undefined | ObjectId | TempId;
|
|
33
31
|
type PhaseContext = {
|
|
34
32
|
target: Record<string, unknown>;
|
|
35
33
|
root: {
|
|
@@ -34,6 +34,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.traverseDocument = void 0;
|
|
37
|
+
const path = __importStar(require("node:path"));
|
|
38
|
+
const fs = __importStar(require("node:fs/promises"));
|
|
37
39
|
const types_1 = require("@aeriajs/types");
|
|
38
40
|
const common_1 = require("@aeriajs/common");
|
|
39
41
|
const validation_1 = require("@aeriajs/validation");
|
|
@@ -44,8 +46,6 @@ const context_js_1 = require("../context.js");
|
|
|
44
46
|
const preload_js_1 = require("./preload.js");
|
|
45
47
|
const reference_js_1 = require("./reference.js");
|
|
46
48
|
const cascadingRemove_js_1 = require("./cascadingRemove.js");
|
|
47
|
-
const path = __importStar(require("path"));
|
|
48
|
-
const fs = __importStar(require("fs/promises"));
|
|
49
49
|
const escapeRegExp = (text) => {
|
|
50
50
|
return text.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&');
|
|
51
51
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import * as fs from "node:fs/promises";
|
|
2
4
|
import { Result, ACError, ValidationErrorCode, TraverseError } from "@aeriajs/types";
|
|
3
5
|
import { throwIfError, pipe, isReference, getReferenceProperty, getValueFromPath, isError } from "@aeriajs/common";
|
|
4
6
|
import { makeValidationError, validateProperty, validateWholeness } from "@aeriajs/validation";
|
|
@@ -9,8 +11,6 @@ import { createContext } from "../context.mjs";
|
|
|
9
11
|
import { preloadDescription } from "./preload.mjs";
|
|
10
12
|
import { getReferences } from "./reference.mjs";
|
|
11
13
|
import { preferredRemove } from "./cascadingRemove.mjs";
|
|
12
|
-
import * as path from "path";
|
|
13
|
-
import * as fs from "fs/promises";
|
|
14
14
|
const escapeRegExp = (text) => {
|
|
15
15
|
return text.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&");
|
|
16
16
|
};
|
package/dist/database.js
CHANGED
|
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.getDatabaseCollection = exports.getDatabaseSync = exports.getDatabase = exports.ObjectId = void 0;
|
|
37
37
|
const entrypoint_1 = require("@aeriajs/entrypoint");
|
|
38
|
-
const
|
|
38
|
+
const node_util_1 = require("node:util");
|
|
39
39
|
const mongodb_1 = require("mongodb");
|
|
40
40
|
var mongodb_2 = require("mongodb");
|
|
41
41
|
Object.defineProperty(exports, "ObjectId", { enumerable: true, get: function () { return mongodb_2.ObjectId; } });
|
|
@@ -59,7 +59,7 @@ const getDatabase = async () => {
|
|
|
59
59
|
});
|
|
60
60
|
if (logQueries) {
|
|
61
61
|
client.on('commandStarted', (event) => {
|
|
62
|
-
console.debug((0,
|
|
62
|
+
console.debug((0, node_util_1.inspect)(event, {
|
|
63
63
|
colors: true,
|
|
64
64
|
compact: false,
|
|
65
65
|
depth: Infinity,
|
package/dist/database.mjs
CHANGED
package/dist/functions/upload.js
CHANGED
|
@@ -36,9 +36,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.upload = void 0;
|
|
37
37
|
const types_1 = require("@aeriajs/types");
|
|
38
38
|
const validation_1 = require("@aeriajs/validation");
|
|
39
|
-
const path = __importStar(require("path"));
|
|
40
|
-
const
|
|
41
|
-
const
|
|
39
|
+
const path = __importStar(require("node:path"));
|
|
40
|
+
const node_fs_1 = require("node:fs");
|
|
41
|
+
const node_crypto_1 = require("node:crypto");
|
|
42
42
|
const [FileMetadata, validateFileMetadata] = (0, validation_1.validator)({
|
|
43
43
|
type: 'object',
|
|
44
44
|
required: ['name'],
|
|
@@ -55,7 +55,7 @@ const [FileMetadata, validateFileMetadata] = (0, validation_1.validator)({
|
|
|
55
55
|
},
|
|
56
56
|
});
|
|
57
57
|
const streamToFs = (metadata, context) => {
|
|
58
|
-
const nameHash = (0,
|
|
58
|
+
const nameHash = (0, node_crypto_1.createHash)('sha1')
|
|
59
59
|
.update(metadata.name + Date.now())
|
|
60
60
|
.digest('hex');
|
|
61
61
|
const extension = metadata.name.includes('.')
|
|
@@ -69,7 +69,7 @@ const streamToFs = (metadata, context) => {
|
|
|
69
69
|
}
|
|
70
70
|
const absolutePath = path.join(tmpPath, `${nameHash}.${extension}`);
|
|
71
71
|
return new Promise(async (resolve, reject) => {
|
|
72
|
-
const stream = (0,
|
|
72
|
+
const stream = (0, node_fs_1.createWriteStream)(absolutePath);
|
|
73
73
|
stream.on('close', () => resolve(absolutePath));
|
|
74
74
|
stream.on('error', (error) => reject(error));
|
|
75
75
|
switch (metadata.format) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { Result, ACError, HTTPStatus } from "@aeriajs/types";
|
|
3
3
|
import { validate, validator } from "@aeriajs/validation";
|
|
4
|
-
import * as path from "path";
|
|
5
|
-
import { createWriteStream } from "fs";
|
|
6
|
-
import { createHash } from "crypto";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
import { createWriteStream } from "node:fs";
|
|
6
|
+
import { createHash } from "node:crypto";
|
|
7
7
|
const [FileMetadata, validateFileMetadata] = validator({
|
|
8
8
|
type: "object",
|
|
9
9
|
required: ["name"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.217",
|
|
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.217",
|
|
46
|
+
"@aeriajs/common": "^0.0.126",
|
|
47
|
+
"@aeriajs/entrypoint": "^0.0.129",
|
|
48
|
+
"@aeriajs/http": "^0.0.152",
|
|
49
|
+
"@aeriajs/security": "^0.0.217",
|
|
50
|
+
"@aeriajs/types": "^0.0.108",
|
|
51
|
+
"@aeriajs/validation": "^0.0.141"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"mongodb": "^6.5.0",
|