@hestia-earth/api 0.18.19 → 0.18.21

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.
@@ -142,10 +142,12 @@ export declare const rootFolderFromPath: (path: string) => string;
142
142
  export declare const filenameFromPath: (path: string) => string;
143
143
  export declare const analysesFolder = "analyses";
144
144
  export declare const glossaryFolder = "glossary";
145
+ export declare const reconciliationFolder = "reconciliation";
146
+ export declare const isReconciliation: (path: string) => boolean;
145
147
  export declare const isGlossary: (path: string) => boolean;
146
148
  export declare const aggregationFolder = "aggregation";
147
149
  export declare const isAggregation: (path: string) => boolean;
148
- export declare const isFolderUpload: (path: string) => boolean;
150
+ export declare const isFolderUpload: (path: string, termsOnly?: boolean) => boolean;
149
151
  export declare const isOwner: (file: Partial<File>, user: User) => boolean;
150
152
  export declare const isAuthorized: ({ authorizedUsers }: Partial<File>, user: User) => boolean;
151
153
  export declare const isAssigned: ({ assignedUsers }: Partial<File>, user: User) => boolean;
@@ -24,7 +24,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
24
24
  return to.concat(ar || Array.prototype.slice.call(from));
25
25
  };
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.canEditComment = exports.isDraft = exports.canFeedback = exports.canSubmit = exports.isValidated = exports.canValidate = exports.validatedStatuses = exports.canRemove = exports.isAssigned = exports.isAuthorized = exports.isOwner = exports.isFolderUpload = exports.isAggregation = exports.aggregationFolder = exports.isGlossary = exports.glossaryFolder = exports.analysesFolder = exports.filenameFromPath = exports.rootFolderFromPath = exports.folderFromPath = exports.replaceInvalidChars = exports.validPathChars = exports.filenameWithoutExt = exports.fileToExt = exports.fileExt = exports.filepathSearch = exports.filenameSearch = exports.File = exports.FilePipelineError = exports.FilePipelineProgress = exports.FilePipelineStatus = exports.FileError = exports.FileStatus = exports.FileProgress = exports.HestiaExtensions = exports.finalFormatExtensions = exports.SupportedExtensions = exports.sizeInMb = exports.MAX_SIZE_MB = exports.MAX_SIZE = exports.mb = void 0;
27
+ exports.canEditComment = exports.isDraft = exports.canFeedback = exports.canSubmit = exports.isValidated = exports.canValidate = exports.validatedStatuses = exports.canRemove = exports.isAssigned = exports.isAuthorized = exports.isOwner = exports.isFolderUpload = exports.isAggregation = exports.aggregationFolder = exports.isGlossary = exports.isReconciliation = exports.reconciliationFolder = exports.glossaryFolder = exports.analysesFolder = exports.filenameFromPath = exports.rootFolderFromPath = exports.folderFromPath = exports.replaceInvalidChars = exports.validPathChars = exports.filenameWithoutExt = exports.fileToExt = exports.fileExt = exports.filepathSearch = exports.filenameSearch = exports.File = exports.FilePipelineError = exports.FilePipelineProgress = exports.FilePipelineStatus = exports.FileError = exports.FileStatus = exports.FileProgress = exports.HestiaExtensions = exports.finalFormatExtensions = exports.SupportedExtensions = exports.sizeInMb = exports.MAX_SIZE_MB = exports.MAX_SIZE = exports.mb = void 0;
28
28
  var model_base_1 = require("../../db/model.base");
29
29
  var model_1 = require("../../users/model/model");
30
30
  exports.mb = 1048576;
@@ -181,15 +181,25 @@ var filenameFromPath = function (path) { return path.split('/').pop(); };
181
181
  exports.filenameFromPath = filenameFromPath;
182
182
  exports.analysesFolder = 'analyses';
183
183
  exports.glossaryFolder = 'glossary';
184
+ exports.reconciliationFolder = 'reconciliation';
185
+ var isReconciliation = function (path) { return (0, exports.rootFolderFromPath)(path) === exports.reconciliationFolder; };
186
+ exports.isReconciliation = isReconciliation;
184
187
  var isGlossary = function (path) { return (0, exports.rootFolderFromPath)(path) === exports.glossaryFolder; };
185
188
  exports.isGlossary = isGlossary;
189
+ var isTerm = function (path) { return (0, exports.rootFolderFromPath)(path) === 'term'; };
186
190
  exports.aggregationFolder = 'aggregation';
187
191
  var isAggregation = function (path) { return (0, exports.rootFolderFromPath)(path) === exports.aggregationFolder; };
188
192
  exports.isAggregation = isAggregation;
189
- var isFolderUpload = function (path) { return [
190
- exports.isAggregation,
191
- exports.isGlossary
192
- ].some(function (f) { return f(path); }); };
193
+ var isFolderUpload = function (path, termsOnly) {
194
+ if (termsOnly === void 0) { termsOnly = false; }
195
+ return __spreadArray([
196
+ exports.isGlossary,
197
+ isTerm
198
+ ], (termsOnly ? [] : [
199
+ exports.isAggregation,
200
+ exports.isReconciliation
201
+ ]), true).some(function (f) { return f(path); });
202
+ };
193
203
  exports.isFolderUpload = isFolderUpload;
194
204
  var asString = function (v) { var _a, _b; return typeof v === 'object' ? ((_a = v === null || v === void 0 ? void 0 : v._id) === null || _a === void 0 ? void 0 : _a.toString()) || ((_b = v === null || v === void 0 ? void 0 : v.id) === null || _b === void 0 ? void 0 : _b.toString()) : v === null || v === void 0 ? void 0 : v.toString(); };
195
205
  var isOwner = function (file, user) { return asString(file === null || file === void 0 ? void 0 : file.user) === asString(user); };
@@ -20,3 +20,4 @@ export declare const parseLogMissingLookups: (data: string) => {
20
20
  export declare const formatForUpload: (nodes: any[], typeToId?: {
21
21
  [type: string]: string[];
22
22
  }) => any;
23
+ export declare const setPrivate: ({ source, defaultSource, ...node }: any) => any;
@@ -23,7 +23,7 @@ var __rest = (this && this.__rest) || function (s, e) {
23
23
  };
24
24
  var _a;
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.formatForUpload = exports.parseLogMissingLookups = exports.paramToNodeType = exports.nodeTypeToParam = exports.pathWithState = exports.allowedDataStates = exports.dataStatesTypeMapping = exports.DataState = exports.blankNodeTypes = void 0;
26
+ exports.setPrivate = exports.formatForUpload = exports.parseLogMissingLookups = exports.paramToNodeType = exports.nodeTypeToParam = exports.pathWithState = exports.allowedDataStates = exports.dataStatesTypeMapping = exports.DataState = exports.blankNodeTypes = void 0;
27
27
  var schema_1 = require("@hestia-earth/schema");
28
28
  var utils_1 = require("@hestia-earth/utils");
29
29
  var model_1 = require("../../files/model/model");
@@ -121,3 +121,8 @@ var formatForUpload = function (nodes, typeToId) {
121
121
  });
122
122
  };
123
123
  exports.formatForUpload = formatForUpload;
124
+ var setPrivate = function (_a) {
125
+ var source = _a.source, defaultSource = _a.defaultSource, node = __rest(_a, ["source", "defaultSource"]);
126
+ return (__assign(__assign({}, node), { dataPrivate: true }));
127
+ };
128
+ exports.setPrivate = setPrivate;
@@ -5,7 +5,7 @@ export declare enum ReconciliationLevel {
5
5
  danger = "danger"
6
6
  }
7
7
  export declare class Reconciliation extends BaseModel {
8
- idExpected: string;
8
+ idExpected?: string;
9
9
  idRecalculated: string;
10
10
  dataPrivate: boolean;
11
11
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hestia-earth/api",
3
- "version": "0.18.19",
3
+ "version": "0.18.21",
4
4
  "description": "Hestia API definitions",
5
5
  "main": "dist/models.js",
6
6
  "typings": "dist/models.d.ts",
@@ -9,7 +9,7 @@
9
9
  "build:module": "rm -rf dist && tsc -p tsconfig.dist.json",
10
10
  "validate:jsonld": "hestia-validate-jsonld '' test/fixtures/nodes",
11
11
  "start": "node index.js",
12
- "dev": "ts-node-dev --respawn --rs dev.ts",
12
+ "dev": "ts-node-dev --respawn --rs dev.ts --files --ignore-watch node_modules",
13
13
  "watch": "tsc --watch",
14
14
  "lint": "eslint \"src/**/*.ts\"",
15
15
  "lint:fix": "npm run lint -- --fix",