@hestia-earth/api 0.24.45 → 0.24.47
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.
|
@@ -167,11 +167,14 @@ export declare const analysesFolder = "analyses";
|
|
|
167
167
|
export declare const glossaryFolder = "glossary";
|
|
168
168
|
export declare const termFolder = "term";
|
|
169
169
|
export declare const reconciliationFolder = "reconciliation";
|
|
170
|
+
export declare const isAnalysis: (path: string) => boolean;
|
|
170
171
|
export declare const isReconciliation: (path: string) => boolean;
|
|
171
172
|
export declare const isGlossary: (path: string) => boolean;
|
|
172
173
|
export declare const isTerm: (path: string) => boolean;
|
|
173
174
|
export declare const aggregationFolder = "aggregation";
|
|
174
175
|
export declare const isAggregation: (path: string) => boolean;
|
|
176
|
+
export type adminFolder = typeof termFolder | typeof analysesFolder | typeof aggregationFolder | typeof reconciliationFolder;
|
|
177
|
+
export declare const isAdminFolder: (path: string) => boolean;
|
|
175
178
|
export declare const isFolderUpload: (path: string, termsOnly?: boolean) => boolean;
|
|
176
179
|
export declare const userFolder: (user: User) => any;
|
|
177
180
|
export declare const isOwner: (file: Partial<File>, user: User) => boolean;
|
|
@@ -182,7 +185,6 @@ export declare const validatedStatuses: FileStatus[];
|
|
|
182
185
|
export declare const canValidate: ({ status, isPrivate, archived }: Partial<File>, user: Pick<User, 'role'>) => boolean;
|
|
183
186
|
export declare const isValidated: ({ validatedAt, status }: Partial<File>) => boolean;
|
|
184
187
|
export declare const canSubmit: (file: Partial<File>, user: User) => boolean;
|
|
185
|
-
export declare const canFeedback: ({ status }: File) => boolean;
|
|
186
188
|
export declare const isDraft: ({ filepath, filename }: Partial<File>) => boolean;
|
|
187
189
|
export declare const canEditComment: (comment: IFileComment, user: User) => boolean;
|
|
188
190
|
export declare const canCommitHestiaData: (file: File, user: User) => boolean;
|
|
@@ -25,8 +25,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
25
25
|
};
|
|
26
26
|
var _a;
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.
|
|
29
|
-
exports.canCommitHestiaData = exports.canEditComment = exports.isDraft = exports.
|
|
28
|
+
exports.validatedStatuses = exports.canRemove = exports.isAssigned = exports.isAuthorized = exports.isOwner = exports.userFolder = exports.isFolderUpload = exports.isAdminFolder = exports.isAggregation = exports.aggregationFolder = exports.isTerm = exports.isGlossary = 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.FilePipelineError = exports.FilePipelineProgress = exports.FilePipelineStatus = exports.FileError = exports.FileStatus = exports.FileProgress = exports.FileFindFields = exports.HestiaExtensions = exports.finalFormatExtensions = exports.maxFileSizeByFile = exports.SupportedExtensions = exports.maxFileSize = exports.maxFileSizeMb = exports.sizeInMb = exports.mb = void 0;
|
|
29
|
+
exports.canCommitHestiaData = exports.canEditComment = exports.isDraft = exports.canSubmit = exports.isValidated = exports.canValidate = void 0;
|
|
30
30
|
var model_base_1 = require("../../db/model.base");
|
|
31
31
|
var model_1 = require("../../users/model/model");
|
|
32
32
|
exports.mb = 1048576;
|
|
@@ -240,6 +240,8 @@ exports.analysesFolder = 'analyses';
|
|
|
240
240
|
exports.glossaryFolder = 'glossary';
|
|
241
241
|
exports.termFolder = 'term';
|
|
242
242
|
exports.reconciliationFolder = 'reconciliation';
|
|
243
|
+
var isAnalysis = function (path) { return (0, exports.rootFolderFromPath)(path) === exports.analysesFolder; };
|
|
244
|
+
exports.isAnalysis = isAnalysis;
|
|
243
245
|
var isReconciliation = function (path) { return (0, exports.rootFolderFromPath)(path) === exports.reconciliationFolder; };
|
|
244
246
|
exports.isReconciliation = isReconciliation;
|
|
245
247
|
var isGlossary = function (path) { return (0, exports.rootFolderFromPath)(path) === exports.glossaryFolder; };
|
|
@@ -249,6 +251,10 @@ exports.isTerm = isTerm;
|
|
|
249
251
|
exports.aggregationFolder = 'aggregation';
|
|
250
252
|
var isAggregation = function (path) { return (0, exports.rootFolderFromPath)(path) === exports.aggregationFolder; };
|
|
251
253
|
exports.isAggregation = isAggregation;
|
|
254
|
+
var isAdminFolder = function (path) {
|
|
255
|
+
return !!path && [exports.isTerm, exports.isAnalysis, exports.isAggregation, exports.isReconciliation].some(function (f) { return f(path); });
|
|
256
|
+
};
|
|
257
|
+
exports.isAdminFolder = isAdminFolder;
|
|
252
258
|
var isFolderUpload = function (path, termsOnly) {
|
|
253
259
|
if (termsOnly === void 0) { termsOnly = false; }
|
|
254
260
|
return __spreadArray([exports.isGlossary, exports.isTerm], (termsOnly ? [] : [exports.isAggregation, exports.isReconciliation]), true).some(function (f) { return f(path); });
|
|
@@ -291,23 +297,6 @@ var canSubmit = function (file, user) {
|
|
|
291
297
|
((0, exports.isOwner)(file, user) || (0, exports.isAuthorized)(file, user));
|
|
292
298
|
};
|
|
293
299
|
exports.canSubmit = canSubmit;
|
|
294
|
-
var feedbackStatuses = [
|
|
295
|
-
FileStatus.checkExistingDone,
|
|
296
|
-
FileStatus.extendBibliographyDone,
|
|
297
|
-
FileStatus.addMetadataDone,
|
|
298
|
-
FileStatus.validateHestiaDone,
|
|
299
|
-
FileStatus.validateDataDone,
|
|
300
|
-
FileError.checkExistingError,
|
|
301
|
-
FileError.extendBibliographyError,
|
|
302
|
-
FileError.addMetadataError,
|
|
303
|
-
FileError.validateHestiaError,
|
|
304
|
-
FileError.validateDataError
|
|
305
|
-
];
|
|
306
|
-
var canFeedback = function (_a) {
|
|
307
|
-
var status = _a.status;
|
|
308
|
-
return feedbackStatuses.includes(status);
|
|
309
|
-
};
|
|
310
|
-
exports.canFeedback = canFeedback;
|
|
311
300
|
var isDraft = function (_a) {
|
|
312
301
|
var filepath = _a.filepath, filename = _a.filename;
|
|
313
302
|
return (filepath || filename || '').endsWith(SupportedExtensions.draft);
|