@hestia-earth/api 0.26.11 → 0.26.13
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/esm/files/model/model.js +19 -3
- package/esm/users/model/model.js +1 -0
- package/files/model/model.d.ts +13 -4
- package/files/model/model.js +22 -5
- package/package.json +2 -2
- package/users/model/model.d.ts +2 -1
- package/users/model/model.js +1 -0
package/esm/files/model/model.js
CHANGED
|
@@ -12,14 +12,24 @@ export var SupportedExtensions;
|
|
|
12
12
|
SupportedExtensions["json"] = "json";
|
|
13
13
|
SupportedExtensions["draft"] = "txt";
|
|
14
14
|
SupportedExtensions["pdf"] = "pdf";
|
|
15
|
+
SupportedExtensions["md"] = "md";
|
|
15
16
|
})(SupportedExtensions || (SupportedExtensions = {}));
|
|
17
|
+
export const studyExtensions = [SupportedExtensions.pdf];
|
|
18
|
+
export const supplementaryExtensions = [
|
|
19
|
+
SupportedExtensions.pdf,
|
|
20
|
+
SupportedExtensions.xlsx,
|
|
21
|
+
SupportedExtensions.xls,
|
|
22
|
+
SupportedExtensions.csv,
|
|
23
|
+
SupportedExtensions.md
|
|
24
|
+
];
|
|
16
25
|
const maxFileSizeExt = {
|
|
17
26
|
[SupportedExtensions.csv]: maxFileSize,
|
|
18
27
|
[SupportedExtensions.xlsx]: maxFileSize / 2,
|
|
19
28
|
[SupportedExtensions.xls]: maxFileSize / 2,
|
|
20
29
|
[SupportedExtensions.draft]: maxFileSize,
|
|
21
30
|
[SupportedExtensions.json]: maxFileSize,
|
|
22
|
-
[SupportedExtensions.pdf]: maxFileSize / 2
|
|
31
|
+
[SupportedExtensions.pdf]: maxFileSize / 2,
|
|
32
|
+
[SupportedExtensions.md]: maxFileSize
|
|
23
33
|
};
|
|
24
34
|
export const maxFileSizeByFile = (filename) => maxFileSizeExt[fileExt(filename).replace('.', '')];
|
|
25
35
|
export const finalFormatExtensions = [SupportedExtensions.json, SupportedExtensions.csv];
|
|
@@ -104,14 +114,16 @@ export var FileValidationStatus;
|
|
|
104
114
|
FileValidationStatus["success"] = "success";
|
|
105
115
|
FileValidationStatus["error"] = "error";
|
|
106
116
|
})(FileValidationStatus || (FileValidationStatus = {}));
|
|
107
|
-
export class
|
|
117
|
+
export class BaseFile extends BaseModel {
|
|
108
118
|
filename;
|
|
109
119
|
filepath;
|
|
120
|
+
contentType;
|
|
121
|
+
}
|
|
122
|
+
export class File extends BaseFile {
|
|
110
123
|
folder;
|
|
111
124
|
user;
|
|
112
125
|
assignedUsers;
|
|
113
126
|
authorizedUsers;
|
|
114
|
-
contentType;
|
|
115
127
|
archived;
|
|
116
128
|
status;
|
|
117
129
|
pipelineStatus;
|
|
@@ -128,6 +140,9 @@ export class File extends BaseModel {
|
|
|
128
140
|
isPrivate;
|
|
129
141
|
skipValidation;
|
|
130
142
|
study;
|
|
143
|
+
supplementary;
|
|
144
|
+
extraction;
|
|
145
|
+
extractionLogs;
|
|
131
146
|
fromDraft;
|
|
132
147
|
deleted;
|
|
133
148
|
isOwner;
|
|
@@ -139,6 +154,7 @@ export class File extends BaseModel {
|
|
|
139
154
|
hestiaPath;
|
|
140
155
|
progressPath;
|
|
141
156
|
studyPath;
|
|
157
|
+
supplementaryPaths;
|
|
142
158
|
dataPath;
|
|
143
159
|
dataProgressPath;
|
|
144
160
|
dataCsvPath;
|
package/esm/users/model/model.js
CHANGED
|
@@ -27,6 +27,7 @@ export var UserPermission;
|
|
|
27
27
|
UserPermission["reconciliationsRead"] = "reconciliations-view";
|
|
28
28
|
UserPermission["reconciliationsUpdate"] = "reconciliations-update";
|
|
29
29
|
UserPermission["reconciliationsDelete"] = "reconciliations-delete";
|
|
30
|
+
UserPermission["filesPdfExtract"] = "files-pdf-extract";
|
|
30
31
|
})(UserPermission || (UserPermission = {}));
|
|
31
32
|
export var UserPermissionRequestStatus;
|
|
32
33
|
(function (UserPermissionRequestStatus) {
|
package/files/model/model.d.ts
CHANGED
|
@@ -11,8 +11,11 @@ export declare enum SupportedExtensions {
|
|
|
11
11
|
csv = "csv",
|
|
12
12
|
json = "json",
|
|
13
13
|
draft = "txt",
|
|
14
|
-
pdf = "pdf"
|
|
14
|
+
pdf = "pdf",
|
|
15
|
+
md = "md"
|
|
15
16
|
}
|
|
17
|
+
export declare const studyExtensions: SupportedExtensions[];
|
|
18
|
+
export declare const supplementaryExtensions: SupportedExtensions[];
|
|
16
19
|
export declare const maxFileSizeByFile: (filename: string) => any;
|
|
17
20
|
export declare const finalFormatExtensions: SupportedExtensions[];
|
|
18
21
|
export declare enum HestiaExtensions {
|
|
@@ -106,14 +109,16 @@ export interface IFileMetadata {
|
|
|
106
109
|
indexedNodesPerType?: Partial<Record<NodeType, number>>;
|
|
107
110
|
recalculatedNodesPerType?: Partial<Record<NodeType, number>>;
|
|
108
111
|
}
|
|
109
|
-
export declare class
|
|
112
|
+
export declare class BaseFile extends BaseModel {
|
|
110
113
|
filename: string;
|
|
111
114
|
filepath: string;
|
|
115
|
+
contentType?: string;
|
|
116
|
+
}
|
|
117
|
+
export declare class File extends BaseFile {
|
|
112
118
|
folder?: string;
|
|
113
119
|
user: User;
|
|
114
120
|
assignedUsers?: User[];
|
|
115
121
|
authorizedUsers?: User[];
|
|
116
|
-
contentType?: string;
|
|
117
122
|
archived: boolean;
|
|
118
123
|
status?: status;
|
|
119
124
|
pipelineStatus?: pipelineStatus;
|
|
@@ -129,7 +134,10 @@ export declare class File extends BaseModel {
|
|
|
129
134
|
metadata?: IFileMetadata;
|
|
130
135
|
isPrivate?: boolean;
|
|
131
136
|
skipValidation?: boolean;
|
|
132
|
-
study?:
|
|
137
|
+
study?: BaseFile;
|
|
138
|
+
supplementary?: BaseFile[];
|
|
139
|
+
extraction?: boolean;
|
|
140
|
+
extractionLogs?: string;
|
|
133
141
|
fromDraft?: boolean;
|
|
134
142
|
deleted?: boolean;
|
|
135
143
|
readonly isOwner?: boolean;
|
|
@@ -141,6 +149,7 @@ export declare class File extends BaseModel {
|
|
|
141
149
|
readonly hestiaPath?: string;
|
|
142
150
|
readonly progressPath?: string;
|
|
143
151
|
readonly studyPath?: string;
|
|
152
|
+
readonly supplementaryPaths?: string[];
|
|
144
153
|
readonly dataPath?: string;
|
|
145
154
|
readonly dataProgressPath?: string;
|
|
146
155
|
readonly dataCsvPath?: string;
|
package/files/model/model.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.hasAccess = exports.canCommitHestiaData = exports.canEditComment = exports.isDraft = exports.canSubmit = exports.isValidated = exports.canValidate = exports.validatedStatuses = exports.canRemove = exports.canForceRemove = exports.isLocked = void 0;
|
|
3
|
+
exports.userFolder = exports.isFolderUpload = exports.isAdminFolder = exports.isAggregation = exports.aggregationFolder = exports.isTerm = exports.isGlossary = exports.hasReconciliationAccess = exports.isReconciliation = exports.isAnalysis = exports.reconciliationFolder = exports.termFolder = exports.glossaryFolder = exports.analysesFolder = exports.filenameFromPath = exports.rootFolderFromPath = exports.folderFromPath = exports.normalizeFolder = exports.isFilepathValid = exports.isFilenameValid = exports.canUploadFolderFile = exports.canUseFolder = exports.replaceInvalidChars = exports.validPathChars = exports.filenameWithoutExt = exports.fileToExt = exports.isSupportedExt = exports.fileExt = exports.filepathSearch = exports.filenameSearch = exports.File = exports.BaseFile = exports.FileValidationStatus = exports.FilePipelineError = exports.FilePipelineProgress = exports.FilePipelineStatus = exports.FileError = exports.FileStatus = exports.FileProgress = exports.FileFindFields = exports.HestiaExtensions = exports.finalFormatExtensions = exports.maxFileSizeByFile = exports.supplementaryExtensions = exports.studyExtensions = exports.SupportedExtensions = exports.maxFileSize = exports.maxFileSizeMb = exports.sizeInMb = exports.mb = void 0;
|
|
4
|
+
exports.hasAccess = exports.canCommitHestiaData = exports.canEditComment = exports.isDraft = exports.canSubmit = exports.isValidated = exports.canValidate = exports.validatedStatuses = exports.canRemove = exports.canForceRemove = exports.isLocked = exports.isAssigned = exports.isAuthorized = exports.isOwner = void 0;
|
|
5
5
|
const model_base_1 = require("../../db/model.base");
|
|
6
6
|
const model_1 = require("../../users/model/model");
|
|
7
7
|
exports.mb = 1048576;
|
|
@@ -17,14 +17,24 @@ var SupportedExtensions;
|
|
|
17
17
|
SupportedExtensions["json"] = "json";
|
|
18
18
|
SupportedExtensions["draft"] = "txt";
|
|
19
19
|
SupportedExtensions["pdf"] = "pdf";
|
|
20
|
+
SupportedExtensions["md"] = "md";
|
|
20
21
|
})(SupportedExtensions || (exports.SupportedExtensions = SupportedExtensions = {}));
|
|
22
|
+
exports.studyExtensions = [SupportedExtensions.pdf];
|
|
23
|
+
exports.supplementaryExtensions = [
|
|
24
|
+
SupportedExtensions.pdf,
|
|
25
|
+
SupportedExtensions.xlsx,
|
|
26
|
+
SupportedExtensions.xls,
|
|
27
|
+
SupportedExtensions.csv,
|
|
28
|
+
SupportedExtensions.md
|
|
29
|
+
];
|
|
21
30
|
const maxFileSizeExt = {
|
|
22
31
|
[SupportedExtensions.csv]: exports.maxFileSize,
|
|
23
32
|
[SupportedExtensions.xlsx]: exports.maxFileSize / 2,
|
|
24
33
|
[SupportedExtensions.xls]: exports.maxFileSize / 2,
|
|
25
34
|
[SupportedExtensions.draft]: exports.maxFileSize,
|
|
26
35
|
[SupportedExtensions.json]: exports.maxFileSize,
|
|
27
|
-
[SupportedExtensions.pdf]: exports.maxFileSize / 2
|
|
36
|
+
[SupportedExtensions.pdf]: exports.maxFileSize / 2,
|
|
37
|
+
[SupportedExtensions.md]: exports.maxFileSize
|
|
28
38
|
};
|
|
29
39
|
const maxFileSizeByFile = (filename) => maxFileSizeExt[(0, exports.fileExt)(filename).replace('.', '')];
|
|
30
40
|
exports.maxFileSizeByFile = maxFileSizeByFile;
|
|
@@ -110,14 +120,17 @@ var FileValidationStatus;
|
|
|
110
120
|
FileValidationStatus["success"] = "success";
|
|
111
121
|
FileValidationStatus["error"] = "error";
|
|
112
122
|
})(FileValidationStatus || (exports.FileValidationStatus = FileValidationStatus = {}));
|
|
113
|
-
class
|
|
123
|
+
class BaseFile extends model_base_1.BaseModel {
|
|
114
124
|
filename;
|
|
115
125
|
filepath;
|
|
126
|
+
contentType;
|
|
127
|
+
}
|
|
128
|
+
exports.BaseFile = BaseFile;
|
|
129
|
+
class File extends BaseFile {
|
|
116
130
|
folder;
|
|
117
131
|
user;
|
|
118
132
|
assignedUsers;
|
|
119
133
|
authorizedUsers;
|
|
120
|
-
contentType;
|
|
121
134
|
archived;
|
|
122
135
|
status;
|
|
123
136
|
pipelineStatus;
|
|
@@ -134,6 +147,9 @@ class File extends model_base_1.BaseModel {
|
|
|
134
147
|
isPrivate;
|
|
135
148
|
skipValidation;
|
|
136
149
|
study;
|
|
150
|
+
supplementary;
|
|
151
|
+
extraction;
|
|
152
|
+
extractionLogs;
|
|
137
153
|
fromDraft;
|
|
138
154
|
deleted;
|
|
139
155
|
isOwner;
|
|
@@ -145,6 +161,7 @@ class File extends model_base_1.BaseModel {
|
|
|
145
161
|
hestiaPath;
|
|
146
162
|
progressPath;
|
|
147
163
|
studyPath;
|
|
164
|
+
supplementaryPaths;
|
|
148
165
|
dataPath;
|
|
149
166
|
dataProgressPath;
|
|
150
167
|
dataCsvPath;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hestia-earth/api",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.13",
|
|
4
4
|
"description": "Hestia API definitions",
|
|
5
5
|
"main": "models.js",
|
|
6
6
|
"module": "esm/models.js",
|
|
@@ -39,6 +39,6 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@hestia-earth/json-schema": ">=37.0.0",
|
|
41
41
|
"@hestia-earth/schema": ">=37.0.0",
|
|
42
|
-
"@hestia-earth/utils": "
|
|
42
|
+
"@hestia-earth/utils": "^0.17.17"
|
|
43
43
|
}
|
|
44
44
|
}
|
package/users/model/model.d.ts
CHANGED
|
@@ -22,7 +22,8 @@ export declare enum UserPermission {
|
|
|
22
22
|
reconciliationsCreate = "reconciliations-create",
|
|
23
23
|
reconciliationsRead = "reconciliations-view",
|
|
24
24
|
reconciliationsUpdate = "reconciliations-update",
|
|
25
|
-
reconciliationsDelete = "reconciliations-delete"
|
|
25
|
+
reconciliationsDelete = "reconciliations-delete",
|
|
26
|
+
filesPdfExtract = "files-pdf-extract"
|
|
26
27
|
}
|
|
27
28
|
export declare enum UserPermissionRequestStatus {
|
|
28
29
|
Approved = "approved",
|
package/users/model/model.js
CHANGED
|
@@ -30,6 +30,7 @@ var UserPermission;
|
|
|
30
30
|
UserPermission["reconciliationsRead"] = "reconciliations-view";
|
|
31
31
|
UserPermission["reconciliationsUpdate"] = "reconciliations-update";
|
|
32
32
|
UserPermission["reconciliationsDelete"] = "reconciliations-delete";
|
|
33
|
+
UserPermission["filesPdfExtract"] = "files-pdf-extract";
|
|
33
34
|
})(UserPermission || (exports.UserPermission = UserPermission = {}));
|
|
34
35
|
var UserPermissionRequestStatus;
|
|
35
36
|
(function (UserPermissionRequestStatus) {
|