@aeriajs/core 0.0.169 → 0.0.170
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.
|
@@ -221,6 +221,7 @@ const moveFiles = async (value, ctx) => {
|
|
|
221
221
|
}
|
|
222
222
|
const { _id: fileId, ...newFile } = tempFile;
|
|
223
223
|
newFile.absolute_path = `${ctx.options.context.config.storage.fs}/${tempFile.absolute_path.split(path.sep).at(-1)}`;
|
|
224
|
+
newFile.owner = ctx.options.context.token.sub;
|
|
224
225
|
await fs.rename(tempFile.absolute_path, newFile.absolute_path);
|
|
225
226
|
const file = await ctx.options.context.collections.file.model.insertOne(newFile);
|
|
226
227
|
return file.insertedId;
|
|
@@ -186,6 +186,7 @@ const moveFiles = async (value, ctx) => {
|
|
|
186
186
|
}
|
|
187
187
|
const { _id: fileId, ...newFile } = tempFile;
|
|
188
188
|
newFile.absolute_path = `${ctx.options.context.config.storage.fs}/${tempFile.absolute_path.split(path.sep).at(-1)}`;
|
|
189
|
+
newFile.owner = ctx.options.context.token.sub;
|
|
189
190
|
await fs.rename(tempFile.absolute_path, newFile.absolute_path);
|
|
190
191
|
const file = await ctx.options.context.collections.file.model.insertOne(newFile);
|
|
191
192
|
return file.insertedId;
|
package/dist/context.js
CHANGED
|
@@ -61,11 +61,17 @@ const indepthCollection = (collectionName, collections, parentContext) => {
|
|
|
61
61
|
};
|
|
62
62
|
};
|
|
63
63
|
const createContext = async (options = {}) => {
|
|
64
|
-
const { collectionName, parentContext
|
|
64
|
+
const { collectionName, parentContext, token = {
|
|
65
|
+
authenticated: false,
|
|
66
|
+
sub: null,
|
|
67
|
+
}, } = options;
|
|
65
68
|
const { getCollectionAsset } = await Promise.resolve().then(() => __importStar(require('./assets.js')));
|
|
66
69
|
const collections = await (0, entrypoint_1.getCollections)();
|
|
67
70
|
const context = Object.assign({}, parentContext);
|
|
68
|
-
Object.assign(context,
|
|
71
|
+
Object.assign(context, {
|
|
72
|
+
...options,
|
|
73
|
+
token,
|
|
74
|
+
});
|
|
69
75
|
context.log = async (message, details) => {
|
|
70
76
|
return (0, database_js_1.getDatabaseCollection)('log').insertOne({
|
|
71
77
|
message,
|
package/dist/context.mjs
CHANGED
|
@@ -36,13 +36,19 @@ const indepthCollection = (collectionName, collections, parentContext) => {
|
|
|
36
36
|
export const createContext = async (options = {}) => {
|
|
37
37
|
const {
|
|
38
38
|
collectionName,
|
|
39
|
-
parentContext
|
|
40
|
-
token = {
|
|
39
|
+
parentContext,
|
|
40
|
+
token = {
|
|
41
|
+
authenticated: false,
|
|
42
|
+
sub: null
|
|
43
|
+
}
|
|
41
44
|
} = options;
|
|
42
45
|
const { getCollectionAsset } = await import("./assets.mjs");
|
|
43
46
|
const collections = await getCollections();
|
|
44
47
|
const context = Object.assign({}, parentContext);
|
|
45
|
-
Object.assign(context,
|
|
48
|
+
Object.assign(context, {
|
|
49
|
+
...options,
|
|
50
|
+
token
|
|
51
|
+
});
|
|
46
52
|
context.log = async (message, details) => {
|
|
47
53
|
return getDatabaseCollection("log").insertOne({
|
|
48
54
|
message,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.170",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"aeriaMain": "tests/fixtures/aeriaMain.js",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"mongodb-memory-server": "^9.2.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@aeriajs/builtins": "^0.0.
|
|
45
|
+
"@aeriajs/builtins": "^0.0.170",
|
|
46
46
|
"@aeriajs/common": "^0.0.104",
|
|
47
47
|
"@aeriajs/entrypoint": "^0.0.106",
|
|
48
48
|
"@aeriajs/http": "^0.0.117",
|
|
49
|
-
"@aeriajs/security": "^0.0.
|
|
49
|
+
"@aeriajs/security": "^0.0.170",
|
|
50
50
|
"@aeriajs/types": "^0.0.87",
|
|
51
51
|
"@aeriajs/validation": "^0.0.107"
|
|
52
52
|
},
|