@orion-js/file-manager 3.0.24 → 3.0.28
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/lib/File/index.js
CHANGED
|
@@ -4,19 +4,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const models_1 = require("@orion-js/models");
|
|
7
|
+
const Files_1 = __importDefault(require("../Files"));
|
|
8
|
+
const pick_1 = __importDefault(require("lodash/pick"));
|
|
9
|
+
const omit_1 = __importDefault(require("lodash/omit"));
|
|
7
10
|
const schema_1 = __importDefault(require("./schema"));
|
|
8
11
|
exports.default = (0, models_1.createModel)({
|
|
9
12
|
name: 'File',
|
|
10
13
|
schema: schema_1.default,
|
|
11
|
-
resolvers: () => require('./resolvers')
|
|
14
|
+
resolvers: () => require('./resolvers'),
|
|
12
15
|
// this is only called when its child
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
async clean(value) {
|
|
17
|
+
if (!value)
|
|
18
|
+
return null;
|
|
19
|
+
const fileId = value._id;
|
|
20
|
+
const file = await Files_1.default.findOne(fileId);
|
|
21
|
+
if (!file)
|
|
22
|
+
return null;
|
|
23
|
+
const keys = Object.keys((0, omit_1.default)(schema_1.default, 'createdBy', 'createdAt', 'status'));
|
|
24
|
+
const data = (0, pick_1.default)(file, keys);
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
22
27
|
});
|
|
@@ -16,7 +16,7 @@ exports.default = (0, resolvers_1.resolver)({
|
|
|
16
16
|
mutation: true,
|
|
17
17
|
async resolve({ fileId }, viewer) {
|
|
18
18
|
const file = await Files_1.default.findOne({ createdBy: viewer.userId, _id: fileId });
|
|
19
|
-
await
|
|
19
|
+
await Files_1.default.updateOne(file, { $set: { status: 'uploaded' } });
|
|
20
20
|
return file;
|
|
21
21
|
}
|
|
22
22
|
});
|
package/lib/resolvers/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ declare const _default: {
|
|
|
13
13
|
completeUpload: import("@orion-js/resolvers").Resolver<({ fileId }: any, viewer: any) => Promise<any>, undefined>;
|
|
14
14
|
generateUploadCredentials: import("@orion-js/resolvers").Resolver<(params: any, viewer: any) => Promise<{
|
|
15
15
|
key: string;
|
|
16
|
-
fileId:
|
|
16
|
+
fileId: any;
|
|
17
17
|
}>, undefined>;
|
|
18
18
|
};
|
|
19
19
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-js/file-manager",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.28",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"author": "nicolaslopezj",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@orion-js/helpers": "^3.0.17",
|
|
16
|
-
"@orion-js/models": "^3.0.
|
|
17
|
-
"@orion-js/mongodb": "^3.0.
|
|
18
|
-
"@orion-js/paginated-mongodb": "^3.0.
|
|
16
|
+
"@orion-js/models": "^3.0.28",
|
|
17
|
+
"@orion-js/mongodb": "^3.0.28",
|
|
18
|
+
"@orion-js/paginated-mongodb": "^3.0.28",
|
|
19
19
|
"@orion-js/resolvers": "^3.0.24",
|
|
20
20
|
"@orion-js/schema": "^3.0.7",
|
|
21
21
|
"aws-sdk": "^2.1028.0",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "a1d1623ecf7eefbacb87451255c6fa778e748f6a"
|
|
43
43
|
}
|