@hestia-earth/api 0.9.39 → 0.10.1-0
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.
|
@@ -71,6 +71,7 @@ export declare class File extends BaseModel {
|
|
|
71
71
|
filepath: string;
|
|
72
72
|
folder?: string;
|
|
73
73
|
user: User;
|
|
74
|
+
authorizedUsers?: User[];
|
|
74
75
|
contentType?: string;
|
|
75
76
|
archived: boolean;
|
|
76
77
|
status?: status;
|
|
@@ -88,6 +89,7 @@ export declare class File extends BaseModel {
|
|
|
88
89
|
skipValidation?: boolean;
|
|
89
90
|
study?: File;
|
|
90
91
|
readonly isOwner?: boolean;
|
|
92
|
+
readonly isAuthorized?: boolean;
|
|
91
93
|
readonly isValidated?: boolean;
|
|
92
94
|
readonly isDraft?: boolean;
|
|
93
95
|
readonly originalPath?: string;
|
|
@@ -123,3 +125,4 @@ export declare const isAggregation: (path: string) => boolean;
|
|
|
123
125
|
export declare const isFolderUpload: (path: string) => boolean;
|
|
124
126
|
export declare const isValidated: ({ validatedAt, status }: Partial<File>) => boolean;
|
|
125
127
|
export declare const isDraft: ({ filepath, filename }: Partial<File>) => boolean;
|
|
128
|
+
export declare const isAuthorized: ({ authorizedUsers }: Partial<File>, user: any) => boolean;
|
|
@@ -20,7 +20,7 @@ var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
|
20
20
|
return r;
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.isDraft = exports.isValidated = exports.isFolderUpload = exports.isAggregation = exports.aggregationFolder = exports.isGlossary = exports.glossaryFolder = exports.filenameFromPath = exports.rootFolderFromPath = exports.folderFromPath = exports.replaceInvalidChars = exports.validPathChars = exports.fileToExt = exports.filepathSearch = exports.filenameSearch = exports.File = exports.FilePipelineError = exports.FilePipelineProgress = exports.FilePipelineStatus = exports.FileError = exports.FileStatus = exports.FileProgress = exports.HestiaExtensions = exports.SupportedExtensions = exports.sizeInMb = exports.MAX_SIZE_MB = exports.MAX_SIZE = exports.mb = void 0;
|
|
23
|
+
exports.isAuthorized = exports.isDraft = exports.isValidated = exports.isFolderUpload = exports.isAggregation = exports.aggregationFolder = exports.isGlossary = exports.glossaryFolder = exports.filenameFromPath = exports.rootFolderFromPath = exports.folderFromPath = exports.replaceInvalidChars = exports.validPathChars = exports.fileToExt = exports.filepathSearch = exports.filenameSearch = exports.File = exports.FilePipelineError = exports.FilePipelineProgress = exports.FilePipelineStatus = exports.FileError = exports.FileStatus = exports.FileProgress = exports.HestiaExtensions = exports.SupportedExtensions = exports.sizeInMb = exports.MAX_SIZE_MB = exports.MAX_SIZE = exports.mb = void 0;
|
|
24
24
|
var model_base_1 = require("../../db/model.base");
|
|
25
25
|
exports.mb = 1048576;
|
|
26
26
|
exports.MAX_SIZE = 2;
|
|
@@ -165,3 +165,8 @@ exports.isDraft = function (_a) {
|
|
|
165
165
|
var filepath = _a.filepath, filename = _a.filename;
|
|
166
166
|
return (filepath || filename || '').endsWith(SupportedExtensions.draft);
|
|
167
167
|
};
|
|
168
|
+
var asString = function (v) { return typeof v === 'object' && v._id ? v._id.toString() : v.toString(); };
|
|
169
|
+
exports.isAuthorized = function (_a, user) {
|
|
170
|
+
var authorizedUsers = _a.authorizedUsers;
|
|
171
|
+
return (authorizedUsers || []).map(asString).includes(asString(user));
|
|
172
|
+
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hestia-earth/api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1-0",
|
|
4
4
|
"description": "Hestia API definitions",
|
|
5
5
|
"main": "dist/models.js",
|
|
6
6
|
"typings": "dist/models.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "rm -rf build && tsc -p tsconfig.build.json",
|
|
9
9
|
"build:module": "rm -rf dist && tsc -p tsconfig.dist.json",
|
|
10
|
-
"validate:jsonld": "hestia-validate-jsonld '' test",
|
|
10
|
+
"validate:jsonld": "hestia-validate-jsonld '' test/fixtures/nodes",
|
|
11
11
|
"start": "node index.js",
|
|
12
12
|
"dev": "ts-node-dev --respawn --rs dev.ts",
|
|
13
13
|
"watch": "tsc --watch",
|
|
@@ -30,17 +30,17 @@
|
|
|
30
30
|
"author": "Guillaume Royer <guillaumeroyer.mail@gmail.com>",
|
|
31
31
|
"license": "UNLICENSED",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@hestia-earth/schema": "^
|
|
33
|
+
"@hestia-earth/schema": "^8.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@commitlint/cli": "^16.2.4",
|
|
37
37
|
"@commitlint/config-conventional": "^16.2.4",
|
|
38
38
|
"@elastic/elasticsearch": "7.13.0",
|
|
39
39
|
"@hestia-earth/eslint-config": "0.0.3",
|
|
40
|
-
"@hestia-earth/json-schema": "^
|
|
41
|
-
"@hestia-earth/schema-convert": "^
|
|
42
|
-
"@hestia-earth/schema-validation": "^
|
|
43
|
-
"@hestia-earth/utils": "^0.10.
|
|
40
|
+
"@hestia-earth/json-schema": "^8.0.0",
|
|
41
|
+
"@hestia-earth/schema-convert": "^8.0.0",
|
|
42
|
+
"@hestia-earth/schema-validation": "^8.0.0",
|
|
43
|
+
"@hestia-earth/utils": "^0.10.20",
|
|
44
44
|
"@mendeley/api": "^10.0.2",
|
|
45
45
|
"@sentry/node": "^6.18.2",
|
|
46
46
|
"@sentry/tracing": "^6.18.2",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"mongoose-bcrypt": "^1.9.0",
|
|
92
92
|
"morgan": "^1.10.0",
|
|
93
93
|
"multer": "^1.4.4",
|
|
94
|
-
"multer-
|
|
94
|
+
"multer-s3": "^2.10.0",
|
|
95
95
|
"node-ses": "^3.0.3",
|
|
96
96
|
"nyc": "^15.1.0",
|
|
97
97
|
"orientjs": "^3.0.11",
|