@nfdi4plants/arctrl 2.3.0 → 2.3.1

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.
Files changed (2) hide show
  1. package/ARC.js +105 -8
  2. package/package.json +1 -1
package/ARC.js CHANGED
@@ -14,7 +14,7 @@ import { getAllFilePathsAsync } from "./ContractIO/FileSystemHelper.js";
14
14
  import { FSharpResult$2 } from "./fable_modules/fable-library-js.4.24.0/Result.js";
15
15
  import { comparePrimitives, safeHash, stringHash } from "./fable_modules/fable-library-js.4.24.0/Util.js";
16
16
  import { getStudyFolderPath, getAssayFolderPath } from "./FileSystem/Path.js";
17
- import { printf, toText, replace } from "./fable_modules/fable-library-js.4.24.0/String.js";
17
+ import { toText, printf, toFail, join, replace } from "./fable_modules/fable-library-js.4.24.0/String.js";
18
18
  import { Contract } from "./Contract/Contract.js";
19
19
  import { tryISAReadContractFromPath } from "./Contract/ARC.js";
20
20
  import { ArcTables } from "./Core/Table/ArcTables.js";
@@ -122,15 +122,15 @@ export class ARC {
122
122
  const this$ = this;
123
123
  this$._fs = fs;
124
124
  }
125
- WriteAsync(arcPath) {
125
+ TryWriteAsync(arcPath) {
126
126
  const this$ = this;
127
127
  return fullFillContractBatchAsync(arcPath, this$.GetWriteContracts());
128
128
  }
129
- UpdateAsync(arcPath) {
129
+ TryUpdateAsync(arcPath) {
130
130
  const this$ = this;
131
131
  return fullFillContractBatchAsync(arcPath, this$.GetUpdateContracts());
132
132
  }
133
- static loadAsync(arcPath) {
133
+ static tryLoadAsync(arcPath) {
134
134
  return PromiseBuilder__Run_212F1D4B(promise, PromiseBuilder__Delay_62FBFDE1(promise, () => (getAllFilePathsAsync(arcPath).then((_arg) => {
135
135
  const arc = ARC.fromFilePaths(toArray(_arg));
136
136
  const contracts = arc.GetReadContracts();
@@ -173,7 +173,7 @@ export class ARC {
173
173
  this$.SetFilePaths(filteredPaths);
174
174
  return toArray(delay(() => append(singleton(ARCtrl_ArcAssay__ArcAssay_ToDeleteContract(assay)), delay(() => append(singleton(ARCtrl_ArcInvestigation__ArcInvestigation_ToUpdateContract(isa)), delay(() => map_1(ARCtrl_ArcStudy__ArcStudy_ToUpdateContract, studies)))))));
175
175
  }
176
- RemoveAssayAsync(arcPath, assayIdentifier) {
176
+ TryRemoveAssayAsync(arcPath, assayIdentifier) {
177
177
  const this$ = this;
178
178
  return fullFillContractBatchAsync(arcPath, this$.GetAssayRemoveContracts(assayIdentifier));
179
179
  }
@@ -203,7 +203,7 @@ export class ARC {
203
203
  this$.SetFilePaths(renamedPaths);
204
204
  return toArray(delay(() => append(singleton(Contract.createRename(oldAssayFolderPath, newAssayFolderPath)), delay(() => this$.GetUpdateContracts()))));
205
205
  }
206
- RenameAssayAsync(arcPath, oldAssayIdentifier, newAssayIdentifier) {
206
+ TryRenameAssayAsync(arcPath, oldAssayIdentifier, newAssayIdentifier) {
207
207
  const this$ = this;
208
208
  return fullFillContractBatchAsync(arcPath, this$.GetAssayRenameContracts(oldAssayIdentifier, newAssayIdentifier));
209
209
  }
@@ -224,7 +224,7 @@ export class ARC {
224
224
  this$.SetFilePaths(filteredPaths);
225
225
  return [Contract.createDelete(studyFolderPath), ARCtrl_ArcInvestigation__ArcInvestigation_ToUpdateContract(isa)];
226
226
  }
227
- RemoveStudyAsync(arcPath, studyIdentifier) {
227
+ TryRemoveStudyAsync(arcPath, studyIdentifier) {
228
228
  const this$ = this;
229
229
  return fullFillContractBatchAsync(arcPath, this$.GetStudyRemoveContracts(studyIdentifier));
230
230
  }
@@ -254,10 +254,107 @@ export class ARC {
254
254
  this$.SetFilePaths(renamedPaths);
255
255
  return toArray(delay(() => append(singleton(Contract.createRename(oldStudyFolderPath, newStudyFolderPath)), delay(() => this$.GetUpdateContracts()))));
256
256
  }
257
- RenameStudyAsync(arcPath, oldStudyIdentifier, newStudyIdentifier) {
257
+ TryRenameStudyAsync(arcPath, oldStudyIdentifier, newStudyIdentifier) {
258
258
  const this$ = this;
259
259
  return fullFillContractBatchAsync(arcPath, this$.GetStudyRenameContracts(oldStudyIdentifier, newStudyIdentifier));
260
260
  }
261
+ WriteAsync(arcPath) {
262
+ const this$ = this;
263
+ return PromiseBuilder__Run_212F1D4B(promise, PromiseBuilder__Delay_62FBFDE1(promise, () => (this$.TryWriteAsync(arcPath).then((_arg) => {
264
+ const result = _arg;
265
+ if (result.tag === 1) {
266
+ const appended = join("\n", map((e) => e, result.fields[0]));
267
+ toFail(printf("Could not write ARC, failed with the following errors %s"))(appended);
268
+ return Promise.resolve();
269
+ }
270
+ else {
271
+ return Promise.resolve();
272
+ }
273
+ }))));
274
+ }
275
+ UpdateAsync(arcPath) {
276
+ const this$ = this;
277
+ return PromiseBuilder__Run_212F1D4B(promise, PromiseBuilder__Delay_62FBFDE1(promise, () => (this$.TryUpdateAsync(arcPath).then((_arg) => {
278
+ const result = _arg;
279
+ if (result.tag === 1) {
280
+ const appended = join("\n", map((e) => e, result.fields[0]));
281
+ toFail(printf("Could not update ARC, failed with the following errors %s"))(appended);
282
+ return Promise.resolve();
283
+ }
284
+ else {
285
+ return Promise.resolve();
286
+ }
287
+ }))));
288
+ }
289
+ RemoveAssayAsync(arcPath, assayIdentifier) {
290
+ const this$ = this;
291
+ return PromiseBuilder__Run_212F1D4B(promise, PromiseBuilder__Delay_62FBFDE1(promise, () => (this$.TryRemoveAssayAsync(arcPath, assayIdentifier).then((_arg) => {
292
+ const result = _arg;
293
+ if (result.tag === 1) {
294
+ const appended = join("\n", map((e) => e, result.fields[0]));
295
+ toFail(printf("Could not remove assay, failed with the following errors %s"))(appended);
296
+ return Promise.resolve();
297
+ }
298
+ else {
299
+ return Promise.resolve();
300
+ }
301
+ }))));
302
+ }
303
+ RenameAssayAsync(arcPath, oldAssayIdentifier, newAssayIdentifier) {
304
+ const this$ = this;
305
+ return PromiseBuilder__Run_212F1D4B(promise, PromiseBuilder__Delay_62FBFDE1(promise, () => (this$.TryRenameAssayAsync(arcPath, oldAssayIdentifier, newAssayIdentifier).then((_arg) => {
306
+ const result = _arg;
307
+ if (result.tag === 1) {
308
+ const appended = join("\n", map((e) => e, result.fields[0]));
309
+ toFail(printf("Could not rename assay, failed with the following errors %s"))(appended);
310
+ return Promise.resolve();
311
+ }
312
+ else {
313
+ return Promise.resolve();
314
+ }
315
+ }))));
316
+ }
317
+ RemoveStudyAsync(arcPath, studyIdentifier) {
318
+ const this$ = this;
319
+ return PromiseBuilder__Run_212F1D4B(promise, PromiseBuilder__Delay_62FBFDE1(promise, () => (this$.TryRemoveStudyAsync(arcPath, studyIdentifier).then((_arg) => {
320
+ const result = _arg;
321
+ if (result.tag === 1) {
322
+ const appended = join("\n", map((e) => e, result.fields[0]));
323
+ toFail(printf("Could not remove study, failed with the following errors %s"))(appended);
324
+ return Promise.resolve();
325
+ }
326
+ else {
327
+ return Promise.resolve();
328
+ }
329
+ }))));
330
+ }
331
+ RenameStudyAsync(arcPath, oldStudyIdentifier, newStudyIdentifier) {
332
+ const this$ = this;
333
+ return PromiseBuilder__Run_212F1D4B(promise, PromiseBuilder__Delay_62FBFDE1(promise, () => (this$.TryRenameStudyAsync(arcPath, oldStudyIdentifier, newStudyIdentifier).then((_arg) => {
334
+ const result = _arg;
335
+ if (result.tag === 1) {
336
+ const appended = join("\n", map((e) => e, result.fields[0]));
337
+ toFail(printf("Could not rename study, failed with the following errors %s"))(appended);
338
+ return Promise.resolve();
339
+ }
340
+ else {
341
+ return Promise.resolve();
342
+ }
343
+ }))));
344
+ }
345
+ static loadAsync(arcPath) {
346
+ return PromiseBuilder__Run_212F1D4B(promise, PromiseBuilder__Delay_62FBFDE1(promise, () => (ARC.tryLoadAsync(arcPath).then((_arg) => {
347
+ const result = _arg;
348
+ if (result.tag === 1) {
349
+ const appended = join("\n", map((e) => e, result.fields[0]));
350
+ toFail(printf("Could not load ARC, failed with the following errors %s"))(appended);
351
+ return Promise.resolve(new ARC());
352
+ }
353
+ else {
354
+ return Promise.resolve(result.fields[0]);
355
+ }
356
+ }))));
357
+ }
261
358
  static fromFilePaths(filePaths) {
262
359
  return new ARC(undefined, undefined, FileSystem.fromFilePaths(filePaths));
263
360
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nfdi4plants/arctrl",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "Top level ARC DataModel and API function descriptions.",
5
5
  "type": "module",
6
6
  "main": "index.js",