@aeriajs/core 0.0.153 → 0.0.154
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 +1 -1
- package/dist/__scripts__/postinstall.mjs +1 -1
- package/dist/collection/traverseDocument.js +2 -1
- package/dist/collection/traverseDocument.mjs +2 -1
- package/dist/functions/get.d.ts +1 -1
- package/dist/functions/insert.d.ts +1 -1
- package/dist/functions/upload.js +1 -1
- package/dist/functions/upload.mjs +1 -1
- package/package.json +8 -8
|
@@ -68,7 +68,7 @@ const install = async () => {
|
|
|
68
68
|
const { types = 'src/index.ts' } = JSON.parse(await fs.promises.readFile(path.join(base, 'package.json'), {
|
|
69
69
|
encoding: 'utf8',
|
|
70
70
|
}));
|
|
71
|
-
const dts = makeDts(path.join('..', types));
|
|
71
|
+
const dts = makeDts(path.join('..', types).split(path.sep).join('/'));
|
|
72
72
|
await fs.promises.writeFile(path.join(aeriaDir, DTS_FILENAME), dts);
|
|
73
73
|
};
|
|
74
74
|
install();
|
|
@@ -44,7 +44,7 @@ const install = async () => {
|
|
|
44
44
|
const { types = "src/index.ts" } = JSON.parse(await fs.promises.readFile(path.join(base, "package.json"), {
|
|
45
45
|
encoding: "utf8"
|
|
46
46
|
}));
|
|
47
|
-
const dts = makeDts(path.join("..", types));
|
|
47
|
+
const dts = makeDts(path.join("..", types).split(path.sep).join("/"));
|
|
48
48
|
await fs.promises.writeFile(path.join(aeriaDir, DTS_FILENAME), dts);
|
|
49
49
|
};
|
|
50
50
|
install();
|
|
@@ -30,6 +30,7 @@ const validation_1 = require("@aeriajs/validation");
|
|
|
30
30
|
const mongodb_1 = require("mongodb");
|
|
31
31
|
const assets_js_1 = require("../assets.js");
|
|
32
32
|
const preload_js_1 = require("./preload.js");
|
|
33
|
+
const path = __importStar(require("path"));
|
|
33
34
|
const fs = __importStar(require("fs/promises"));
|
|
34
35
|
const getProperty = (propName, parentProperty) => {
|
|
35
36
|
if (propName === '_id') {
|
|
@@ -200,7 +201,7 @@ const moveFiles = async (value, ctx) => {
|
|
|
200
201
|
await disposeOldFiles(ctx);
|
|
201
202
|
}
|
|
202
203
|
const { _id: fileId, ...newFile } = tempFile;
|
|
203
|
-
newFile.absolute_path = `${ctx.options.context.config.storage.fs}/${tempFile.absolute_path.
|
|
204
|
+
newFile.absolute_path = `${ctx.options.context.config.storage.fs}/${tempFile.absolute_path.split(path.sep).at(-1)}`;
|
|
204
205
|
await fs.rename(tempFile.absolute_path, newFile.absolute_path);
|
|
205
206
|
const file = await ctx.options.context.collections.file.model.insertOne(newFile);
|
|
206
207
|
return file.insertedId;
|
|
@@ -5,6 +5,7 @@ import { makeValidationError, validateProperty, validateWholeness } from "@aeria
|
|
|
5
5
|
import { ObjectId } from "mongodb";
|
|
6
6
|
import { getCollectionAsset } from "../assets.mjs";
|
|
7
7
|
import { preloadDescription } from "./preload.mjs";
|
|
8
|
+
import * as path from "path";
|
|
8
9
|
import * as fs from "fs/promises";
|
|
9
10
|
const getProperty = (propName, parentProperty) => {
|
|
10
11
|
if (propName === "_id") {
|
|
@@ -166,7 +167,7 @@ const moveFiles = async (value, ctx) => {
|
|
|
166
167
|
await disposeOldFiles(ctx);
|
|
167
168
|
}
|
|
168
169
|
const { _id: fileId, ...newFile } = tempFile;
|
|
169
|
-
newFile.absolute_path = `${ctx.options.context.config.storage.fs}/${tempFile.absolute_path.
|
|
170
|
+
newFile.absolute_path = `${ctx.options.context.config.storage.fs}/${tempFile.absolute_path.split(path.sep).at(-1)}`;
|
|
170
171
|
await fs.rename(tempFile.absolute_path, newFile.absolute_path);
|
|
171
172
|
const file = await ctx.options.context.collections.file.model.insertOne(newFile);
|
|
172
173
|
return file.insertedId;
|
package/dist/functions/get.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import type { Context, SchemaWithId, GetPayload, GetReturnType } from '@aeriajs/
|
|
|
2
2
|
export type GetOptions = {
|
|
3
3
|
bypassSecurity?: boolean;
|
|
4
4
|
};
|
|
5
|
-
export declare const get: <TContext extends Context>(payload: GetPayload<SchemaWithId<TContext["description"]>>, context: TContext
|
|
5
|
+
export declare const get: <TContext extends Context>(payload: GetPayload<SchemaWithId<TContext["description"]>>, context: TContext, options?: GetOptions) => Promise<GetReturnType<SchemaWithId<TContext["description"]>>>;
|
|
@@ -33,4 +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
|
|
36
|
+
export declare const insert: <TContext extends Context>(payload: InsertPayload<SchemaWithId<TContext["description"]>>, context: TContext, options?: InsertOptions) => Promise<InsertReturnType<SchemaWithId<TContext["description"]>>>;
|
package/dist/functions/upload.js
CHANGED
|
@@ -43,7 +43,7 @@ const streamToFs = (metadata, context) => {
|
|
|
43
43
|
.update(metadata.name + Date.now())
|
|
44
44
|
.digest('hex');
|
|
45
45
|
const extension = metadata.name.includes('.')
|
|
46
|
-
? metadata.name.split('.').
|
|
46
|
+
? metadata.name.split('.').at(-1)
|
|
47
47
|
: 'bin';
|
|
48
48
|
const tmpPath = context.config.storage
|
|
49
49
|
? context.config.storage.tempFs || context.config.storage.fs
|
|
@@ -15,7 +15,7 @@ const [FileMetadata, validateFileMetadata] = validator({
|
|
|
15
15
|
});
|
|
16
16
|
const streamToFs = (metadata, context) => {
|
|
17
17
|
const nameHash = createHash("sha1").update(metadata.name + Date.now()).digest("hex");
|
|
18
|
-
const extension = metadata.name.includes(".") ? metadata.name.split(".").
|
|
18
|
+
const extension = metadata.name.includes(".") ? metadata.name.split(".").at(-1) : "bin";
|
|
19
19
|
const tmpPath = context.config.storage ? context.config.storage.tempFs || context.config.storage.fs : null;
|
|
20
20
|
if (!tmpPath) {
|
|
21
21
|
throw new Error();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.154",
|
|
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.154",
|
|
46
|
+
"@aeriajs/common": "^0.0.93",
|
|
47
|
+
"@aeriajs/entrypoint": "^0.0.95",
|
|
48
|
+
"@aeriajs/http": "^0.0.105",
|
|
49
|
+
"@aeriajs/security": "^0.0.154",
|
|
50
|
+
"@aeriajs/types": "^0.0.80",
|
|
51
|
+
"@aeriajs/validation": "^0.0.96"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"mongodb": "^6.5.0",
|