@nfdi4plants/arctrl 2.1.0-alpha.1 → 2.1.0-alpha.2
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/ARC.js +20 -85
- package/Contract/ArcAssay.js +33 -10
- package/Contract/ArcStudy.js +33 -10
- package/package.json +1 -1
package/ARC.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { append as append_1, contains as contains_1, concat, fold, map, exactlyOne, tryPick, choose } from "./fable_modules/fable-library-js.4.22.0/Array.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { ARCtrl_ArcAssay__ArcAssay_ToUpdateContract_6FCE9E49, ARCtrl_ArcAssay__ArcAssay_ToCreateContract_66CF920, ARCtrl_ArcAssay__ArcAssay_ToDeleteContract, ARCtrl_ArcAssay__ArcAssay_tryFromReadContract_Static_7570923F } from "./Contract/ArcAssay.js";
|
|
3
|
+
import { ARCtrl_DataMap__DataMap_tryFromReadContractForStudy_Static, ARCtrl_DataMap__DataMap_tryFromReadContractForAssay_Static } from "./Contract/Datamap.js";
|
|
4
|
+
import { ARCtrl_ArcStudy__ArcStudy_ToCreateContract_66CF920, ARCtrl_ArcStudy__ArcStudy_ToUpdateContract_6FCE9E49, ARCtrl_ArcStudy__ArcStudy_tryFromReadContract_Static_7570923F } from "./Contract/ArcStudy.js";
|
|
5
5
|
import { ARCtrl_ArcInvestigation__ArcInvestigation_ToUpdateContract, ARCtrl_ArcInvestigation__ArcInvestigation_tryFromReadContract_Static_7570923F } from "./Contract/ArcInvestigation.js";
|
|
6
|
-
import {
|
|
6
|
+
import { empty, iterate, find, tryFind, collect, singleton, append, delay, toList, contains, toArray } from "./fable_modules/fable-library-js.4.22.0/Seq.js";
|
|
7
7
|
import { FileSystemTree } from "./FileSystem/FileSystemTree.js";
|
|
8
8
|
import { FileSystem } from "./FileSystem/FileSystem.js";
|
|
9
|
-
import { bind, map as
|
|
9
|
+
import { bind, map as map_1, value as value_2, defaultArg, unwrap } from "./fable_modules/fable-library-js.4.22.0/Option.js";
|
|
10
10
|
import { comparePrimitives, safeHash, stringHash } from "./fable_modules/fable-library-js.4.22.0/Util.js";
|
|
11
11
|
import { getStudyFolderPath, getAssayFolderPath } from "./FileSystem/Path.js";
|
|
12
12
|
import { printf, toText, replace } from "./fable_modules/fable-library-js.4.22.0/String.js";
|
|
@@ -19,7 +19,7 @@ import { ARCtrl_ArcInvestigation__ArcInvestigation_toFsWorkbook_Static_Z720BD3FF
|
|
|
19
19
|
import { ArcInvestigation } from "./Core/ArcTypes.js";
|
|
20
20
|
import { Assay_datamapFileNameFromIdentifier, Assay_fileNameFromIdentifier, Study_datamapFileNameFromIdentifier, Study_fileNameFromIdentifier } from "./Core/Helper/Identifier.js";
|
|
21
21
|
import { ARCtrl_ArcStudy__ArcStudy_toFsWorkbook_Static_Z4CEFA522 } from "./Spreadsheet/ArcStudy.js";
|
|
22
|
-
import {
|
|
22
|
+
import { DataMap__set_StaticHash_Z524259A4 } from "./Core/DataMap.js";
|
|
23
23
|
import { toFsWorkbook } from "./Spreadsheet/DataMap.js";
|
|
24
24
|
import { ARCtrl_ArcAssay__ArcAssay_toFsWorkbook_Static_Z2508BE4F } from "./Spreadsheet/ArcAssay.js";
|
|
25
25
|
import { Dictionary_tryGet } from "./fable_modules/FsSpreadsheet.6.3.0-alpha.4/Cells/FsCellsCollection.fs.js";
|
|
@@ -143,7 +143,7 @@ export class ARC {
|
|
|
143
143
|
const assayFolderPath = getAssayFolderPath(assayIdentifier);
|
|
144
144
|
const filteredPaths = paths.filter((p) => !p.startsWith(assayFolderPath));
|
|
145
145
|
this$.SetFilePaths(filteredPaths);
|
|
146
|
-
const collection = toList(delay(() => append(singleton(ARCtrl_ArcAssay__ArcAssay_ToDeleteContract(assay)), delay(() => append(singleton(ARCtrl_ArcInvestigation__ArcInvestigation_ToUpdateContract(isa)), delay(() =>
|
|
146
|
+
const collection = toList(delay(() => append(singleton(ARCtrl_ArcAssay__ArcAssay_ToDeleteContract(assay)), delay(() => append(singleton(ARCtrl_ArcInvestigation__ArcInvestigation_ToUpdateContract(isa)), delay(() => collect(ARCtrl_ArcStudy__ArcStudy_ToUpdateContract_6FCE9E49, studies)))))));
|
|
147
147
|
return Array.from(collection);
|
|
148
148
|
}
|
|
149
149
|
RenameAssay(oldAssayIdentifier, newAssayIdentifier) {
|
|
@@ -297,8 +297,9 @@ export class ARC {
|
|
|
297
297
|
newFS = ARCAux_updateFSByCWL(this$._cwl, fs);
|
|
298
298
|
this$._fs = newFS;
|
|
299
299
|
}
|
|
300
|
-
GetWriteContracts() {
|
|
300
|
+
GetWriteContracts(datamapAsFile) {
|
|
301
301
|
const this$ = this;
|
|
302
|
+
const datamapAsFile_1 = defaultArg(datamapAsFile, false);
|
|
302
303
|
const workbooks = new Map([]);
|
|
303
304
|
const matchValue = this$.ISA;
|
|
304
305
|
if (matchValue == null) {
|
|
@@ -310,8 +311,8 @@ export class ARC {
|
|
|
310
311
|
inv.StaticHash = (inv.GetLightHashCode() | 0);
|
|
311
312
|
iterate((s) => {
|
|
312
313
|
s.StaticHash = (s.GetLightHashCode() | 0);
|
|
313
|
-
addToDict(workbooks, Study_fileNameFromIdentifier(s.Identifier), ["ISA_Study", ARCtrl_ArcStudy__ArcStudy_toFsWorkbook_Static_Z4CEFA522(s)]);
|
|
314
|
-
if (s.DataMap != null) {
|
|
314
|
+
addToDict(workbooks, Study_fileNameFromIdentifier(s.Identifier), ["ISA_Study", ARCtrl_ArcStudy__ArcStudy_toFsWorkbook_Static_Z4CEFA522(s, undefined, !datamapAsFile_1)]);
|
|
315
|
+
if ((s.DataMap != null) && datamapAsFile_1) {
|
|
315
316
|
const dm = value_2(s.DataMap);
|
|
316
317
|
DataMap__set_StaticHash_Z524259A4(dm, safeHash(dm));
|
|
317
318
|
addToDict(workbooks, Study_datamapFileNameFromIdentifier(s.Identifier), ["ISA_Datamap", toFsWorkbook(dm)]);
|
|
@@ -319,8 +320,8 @@ export class ARC {
|
|
|
319
320
|
}, inv.Studies);
|
|
320
321
|
iterate((a) => {
|
|
321
322
|
a.StaticHash = (a.GetLightHashCode() | 0);
|
|
322
|
-
addToDict(workbooks, Assay_fileNameFromIdentifier(a.Identifier), ["ISA_Assay", ARCtrl_ArcAssay__ArcAssay_toFsWorkbook_Static_Z2508BE4F(a)]);
|
|
323
|
-
if (a.DataMap != null) {
|
|
323
|
+
addToDict(workbooks, Assay_fileNameFromIdentifier(a.Identifier), ["ISA_Assay", ARCtrl_ArcAssay__ArcAssay_toFsWorkbook_Static_Z2508BE4F(a, !datamapAsFile_1)]);
|
|
324
|
+
if ((a.DataMap != null) && datamapAsFile_1) {
|
|
324
325
|
const dm_1 = value_2(a.DataMap);
|
|
325
326
|
DataMap__set_StaticHash_Z524259A4(dm_1, safeHash(dm_1));
|
|
326
327
|
addToDict(workbooks, Assay_datamapFileNameFromIdentifier(a.Identifier), ["ISA_Datamap", toFsWorkbook(dm_1)]);
|
|
@@ -339,7 +340,7 @@ export class ARC {
|
|
|
339
340
|
}
|
|
340
341
|
}, this$._fs.Tree.ToFilePaths(true));
|
|
341
342
|
}
|
|
342
|
-
GetUpdateContracts() {
|
|
343
|
+
GetUpdateContracts(datamapAsFile) {
|
|
343
344
|
let inv, inv_1, inv_2;
|
|
344
345
|
const this$ = this;
|
|
345
346
|
const matchValue = this$.ISA;
|
|
@@ -349,81 +350,15 @@ export class ARC {
|
|
|
349
350
|
inv_2.StaticHash = (hash | 0);
|
|
350
351
|
return append(collect((s) => {
|
|
351
352
|
const hash_1 = s.GetLightHashCode() | 0;
|
|
352
|
-
return append((s.StaticHash === 0) ?
|
|
353
|
-
let dm_1;
|
|
353
|
+
return append((s.StaticHash === 0) ? ARCtrl_ArcStudy__ArcStudy_ToCreateContract_66CF920(s, true, unwrap(datamapAsFile)) : ARCtrl_ArcStudy__ArcStudy_ToUpdateContract_6FCE9E49(s, unwrap(datamapAsFile)), delay(() => {
|
|
354
354
|
s.StaticHash = (hash_1 | 0);
|
|
355
|
-
|
|
356
|
-
let matchResult, dm_2, dm_3;
|
|
357
|
-
if (matchValue_1 != null) {
|
|
358
|
-
if (DataMap__get_StaticHash(matchValue_1) === 0) {
|
|
359
|
-
matchResult = 0;
|
|
360
|
-
dm_2 = matchValue_1;
|
|
361
|
-
}
|
|
362
|
-
else if ((dm_1 = matchValue_1, DataMap__get_StaticHash(dm_1) !== safeHash(dm_1))) {
|
|
363
|
-
matchResult = 1;
|
|
364
|
-
dm_3 = matchValue_1;
|
|
365
|
-
}
|
|
366
|
-
else {
|
|
367
|
-
matchResult = 2;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
else {
|
|
371
|
-
matchResult = 2;
|
|
372
|
-
}
|
|
373
|
-
switch (matchResult) {
|
|
374
|
-
case 0:
|
|
375
|
-
return append(singleton(ARCtrl_DataMap__DataMap_ToCreateContractForStudy_Z721C83C5(dm_2, s.Identifier)), delay(() => {
|
|
376
|
-
DataMap__set_StaticHash_Z524259A4(dm_2, safeHash(dm_2));
|
|
377
|
-
return empty();
|
|
378
|
-
}));
|
|
379
|
-
case 1:
|
|
380
|
-
return append(singleton(ARCtrl_DataMap__DataMap_ToUpdateContractForStudy_Z721C83C5(dm_3, s.Identifier)), delay(() => {
|
|
381
|
-
DataMap__set_StaticHash_Z524259A4(dm_3, safeHash(dm_3));
|
|
382
|
-
return empty();
|
|
383
|
-
}));
|
|
384
|
-
default: {
|
|
385
|
-
return empty();
|
|
386
|
-
}
|
|
387
|
-
}
|
|
355
|
+
return empty();
|
|
388
356
|
}));
|
|
389
357
|
}, inv_2.Studies), delay(() => collect((a) => {
|
|
390
358
|
const hash_2 = a.GetLightHashCode() | 0;
|
|
391
|
-
return append((a.StaticHash === 0) ?
|
|
392
|
-
let dm_5;
|
|
359
|
+
return append((a.StaticHash === 0) ? ARCtrl_ArcAssay__ArcAssay_ToCreateContract_66CF920(a, true, unwrap(datamapAsFile)) : ARCtrl_ArcAssay__ArcAssay_ToUpdateContract_6FCE9E49(a, unwrap(datamapAsFile)), delay(() => {
|
|
393
360
|
a.StaticHash = (hash_2 | 0);
|
|
394
|
-
|
|
395
|
-
let matchResult_1, dm_6, dm_7;
|
|
396
|
-
if (matchValue_2 != null) {
|
|
397
|
-
if (DataMap__get_StaticHash(matchValue_2) === 0) {
|
|
398
|
-
matchResult_1 = 0;
|
|
399
|
-
dm_6 = matchValue_2;
|
|
400
|
-
}
|
|
401
|
-
else if ((dm_5 = matchValue_2, DataMap__get_StaticHash(dm_5) !== safeHash(dm_5))) {
|
|
402
|
-
matchResult_1 = 1;
|
|
403
|
-
dm_7 = matchValue_2;
|
|
404
|
-
}
|
|
405
|
-
else {
|
|
406
|
-
matchResult_1 = 2;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
else {
|
|
410
|
-
matchResult_1 = 2;
|
|
411
|
-
}
|
|
412
|
-
switch (matchResult_1) {
|
|
413
|
-
case 0:
|
|
414
|
-
return append(singleton(ARCtrl_DataMap__DataMap_ToCreateContractForAssay_Z721C83C5(dm_6, a.Identifier)), delay(() => {
|
|
415
|
-
DataMap__set_StaticHash_Z524259A4(dm_6, safeHash(dm_6));
|
|
416
|
-
return empty();
|
|
417
|
-
}));
|
|
418
|
-
case 1:
|
|
419
|
-
return append(singleton(ARCtrl_DataMap__DataMap_ToUpdateContractForAssay_Z721C83C5(dm_7, a.Identifier)), delay(() => {
|
|
420
|
-
DataMap__set_StaticHash_Z524259A4(dm_7, safeHash(dm_7));
|
|
421
|
-
return empty();
|
|
422
|
-
}));
|
|
423
|
-
default: {
|
|
424
|
-
return empty();
|
|
425
|
-
}
|
|
426
|
-
}
|
|
361
|
+
return empty();
|
|
427
362
|
}));
|
|
428
363
|
}, inv_2.Assays)));
|
|
429
364
|
}));
|
|
@@ -438,14 +373,14 @@ export class ARC {
|
|
|
438
373
|
}
|
|
439
374
|
Copy() {
|
|
440
375
|
const this$ = this;
|
|
441
|
-
const isaCopy =
|
|
376
|
+
const isaCopy = map_1((i) => i.Copy(), this$._isa);
|
|
442
377
|
const fsCopy = this$._fs.Copy();
|
|
443
378
|
return new ARC(unwrap(isaCopy), this$._cwl, fsCopy);
|
|
444
379
|
}
|
|
445
380
|
GetRegisteredPayload(IgnoreHidden) {
|
|
446
381
|
let tree, paths, array_3;
|
|
447
382
|
const this$ = this;
|
|
448
|
-
const registeredStudies = defaultArg(
|
|
383
|
+
const registeredStudies = defaultArg(map_1((isa) => isa.Studies.slice(), map_1((i) => i.Copy(), this$._isa)), []);
|
|
449
384
|
const registeredAssays = concat(map((s) => s.RegisteredAssays.slice(), registeredStudies));
|
|
450
385
|
const includeFiles = unionMany([ofSeq(["isa.investigation.xlsx", "README.md"], {
|
|
451
386
|
Compare: comparePrimitives,
|
package/Contract/ArcAssay.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { equalsWith, item } from "../fable_modules/fable-library-js.4.22.0/Array.js";
|
|
2
2
|
import { getAssayFolderPath, combineMany } from "../FileSystem/Path.js";
|
|
3
|
-
import { defaultOf } from "../fable_modules/fable-library-js.4.22.0/Util.js";
|
|
4
|
-
import { unwrap, defaultArg } from "../fable_modules/fable-library-js.4.22.0/Option.js";
|
|
3
|
+
import { safeHash, defaultOf } from "../fable_modules/fable-library-js.4.22.0/Util.js";
|
|
4
|
+
import { unwrap, value, defaultArg } from "../fable_modules/fable-library-js.4.22.0/Option.js";
|
|
5
5
|
import { Assay_fileNameFromIdentifier } from "../Core/Helper/Identifier.js";
|
|
6
|
-
import { Contract } from "./Contract.js";
|
|
7
6
|
import { ARCtrl_ArcAssay__ArcAssay_fromFsWorkbook_Static_32154C9D, ARCtrl_ArcAssay__ArcAssay_toFsWorkbook_Static_Z2508BE4F } from "../Spreadsheet/ArcAssay.js";
|
|
7
|
+
import { Contract } from "./Contract.js";
|
|
8
8
|
import { empty, singleton, collect, append, delay, toArray } from "../fable_modules/fable-library-js.4.22.0/Seq.js";
|
|
9
9
|
import { FileSystemTree } from "../FileSystem/FileSystemTree.js";
|
|
10
|
+
import { DataMap__get_StaticHash, DataMap__set_StaticHash_Z524259A4 } from "../Core/DataMap.js";
|
|
11
|
+
import { ARCtrl_DataMap__DataMap_ToUpdateContractForAssay_Z721C83C5, ARCtrl_DataMap__DataMap_ToCreateContractForAssay_Z721C83C5 } from "./Datamap.js";
|
|
10
12
|
|
|
11
13
|
export function $007CAssayPath$007C_$007C(input) {
|
|
12
14
|
let matchResult;
|
|
@@ -36,19 +38,40 @@ export function $007CAssayPath$007C_$007C(input) {
|
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
export function
|
|
41
|
+
export function ARCtrl_ArcAssay__ArcAssay_ToCreateContract_66CF920(this$, WithFolder, datamapAsFile) {
|
|
40
42
|
const withFolder = defaultArg(WithFolder, false);
|
|
43
|
+
const dataMapAsFile = defaultArg(datamapAsFile, false);
|
|
41
44
|
const path = Assay_fileNameFromIdentifier(this$.Identifier);
|
|
42
|
-
const
|
|
45
|
+
const dto = ARCtrl_ArcAssay__ArcAssay_toFsWorkbook_Static_Z2508BE4F(this$, !dataMapAsFile);
|
|
46
|
+
const c = Contract.createCreate(path, "ISA_Assay", dto);
|
|
43
47
|
return toArray(delay(() => {
|
|
44
48
|
let folderFS;
|
|
45
|
-
return append(withFolder ? ((folderFS = FileSystemTree.createAssaysFolder([FileSystemTree.createAssayFolder(this$.Identifier)]), collect((p) => (((p !== path) && (p !== "assays/.gitkeep")) ? singleton(Contract.createCreate(p, "PlainText")) : empty()), folderFS.ToFilePaths(false)))) : empty(), delay(() =>
|
|
49
|
+
return append(withFolder ? ((folderFS = FileSystemTree.createAssaysFolder([FileSystemTree.createAssayFolder(this$.Identifier)]), collect((p) => (((p !== path) && (p !== "assays/.gitkeep")) ? singleton(Contract.createCreate(p, "PlainText")) : empty()), folderFS.ToFilePaths(false)))) : empty(), delay(() => {
|
|
50
|
+
let matchValue, dm;
|
|
51
|
+
return append((matchValue = this$.DataMap, (matchValue != null) ? ((dm = matchValue, (DataMap__set_StaticHash_Z524259A4(dm, safeHash(dm)), dataMapAsFile ? singleton(ARCtrl_DataMap__DataMap_ToCreateContractForAssay_Z721C83C5(dm, this$.Identifier)) : empty()))) : (empty())), delay(() => singleton(c)));
|
|
52
|
+
}));
|
|
46
53
|
}));
|
|
47
54
|
}
|
|
48
55
|
|
|
49
|
-
export function
|
|
56
|
+
export function ARCtrl_ArcAssay__ArcAssay_ToUpdateContract_6FCE9E49(this$, datamapAsFile) {
|
|
57
|
+
const datamapAsFile_1 = defaultArg(datamapAsFile, false);
|
|
50
58
|
const path = Assay_fileNameFromIdentifier(this$.Identifier);
|
|
51
|
-
|
|
59
|
+
const hash = this$.GetLightHashCode() | 0;
|
|
60
|
+
let datamapHasChanged;
|
|
61
|
+
const matchValue = this$.DataMap;
|
|
62
|
+
if (matchValue != null) {
|
|
63
|
+
const dm = matchValue;
|
|
64
|
+
const hc = safeHash(dm) !== DataMap__get_StaticHash(dm);
|
|
65
|
+
DataMap__set_StaticHash_Z524259A4(dm, safeHash(dm));
|
|
66
|
+
datamapHasChanged = hc;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
datamapHasChanged = false;
|
|
70
|
+
}
|
|
71
|
+
return toArray(delay(() => {
|
|
72
|
+
let dto;
|
|
73
|
+
return append(((hash !== this$.StaticHash) ? true : (datamapHasChanged && !datamapAsFile_1)) ? singleton((dto = ARCtrl_ArcAssay__ArcAssay_toFsWorkbook_Static_Z2508BE4F(this$, !datamapAsFile_1), Contract.createUpdate(path, "ISA_Assay", dto))) : empty(), delay(() => ((datamapHasChanged && datamapAsFile_1) ? singleton(ARCtrl_DataMap__DataMap_ToUpdateContractForAssay_Z721C83C5(value(this$.DataMap), this$.Identifier)) : empty())));
|
|
74
|
+
}));
|
|
52
75
|
}
|
|
53
76
|
|
|
54
77
|
export function ARCtrl_ArcAssay__ArcAssay_ToDeleteContract(this$) {
|
|
@@ -61,11 +84,11 @@ export function ARCtrl_ArcAssay__ArcAssay_toDeleteContract_Static_1501C0F8(assay
|
|
|
61
84
|
}
|
|
62
85
|
|
|
63
86
|
export function ARCtrl_ArcAssay__ArcAssay_toCreateContract_Static_Z2508BE4F(assay, WithFolder) {
|
|
64
|
-
return
|
|
87
|
+
return ARCtrl_ArcAssay__ArcAssay_ToCreateContract_66CF920(assay, unwrap(WithFolder));
|
|
65
88
|
}
|
|
66
89
|
|
|
67
90
|
export function ARCtrl_ArcAssay__ArcAssay_toUpdateContract_Static_1501C0F8(assay) {
|
|
68
|
-
return
|
|
91
|
+
return ARCtrl_ArcAssay__ArcAssay_ToUpdateContract_6FCE9E49(assay);
|
|
69
92
|
}
|
|
70
93
|
|
|
71
94
|
export function ARCtrl_ArcAssay__ArcAssay_tryFromReadContract_Static_7570923F(c) {
|
package/Contract/ArcStudy.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { equalsWith, item } from "../fable_modules/fable-library-js.4.22.0/Array.js";
|
|
2
2
|
import { getStudyFolderPath, combineMany } from "../FileSystem/Path.js";
|
|
3
|
-
import { defaultOf } from "../fable_modules/fable-library-js.4.22.0/Util.js";
|
|
4
|
-
import { unwrap, defaultArg } from "../fable_modules/fable-library-js.4.22.0/Option.js";
|
|
3
|
+
import { safeHash, defaultOf } from "../fable_modules/fable-library-js.4.22.0/Util.js";
|
|
4
|
+
import { unwrap, value, defaultArg } from "../fable_modules/fable-library-js.4.22.0/Option.js";
|
|
5
5
|
import { Study_fileNameFromIdentifier } from "../Core/Helper/Identifier.js";
|
|
6
|
-
import { Contract } from "./Contract.js";
|
|
7
6
|
import { ARCtrl_ArcStudy__ArcStudy_fromFsWorkbook_Static_32154C9D, ARCtrl_ArcStudy__ArcStudy_toFsWorkbook_Static_Z4CEFA522 } from "../Spreadsheet/ArcStudy.js";
|
|
7
|
+
import { Contract } from "./Contract.js";
|
|
8
8
|
import { empty, singleton, collect, append, delay, toArray } from "../fable_modules/fable-library-js.4.22.0/Seq.js";
|
|
9
9
|
import { FileSystemTree } from "../FileSystem/FileSystemTree.js";
|
|
10
|
+
import { DataMap__get_StaticHash, DataMap__set_StaticHash_Z524259A4 } from "../Core/DataMap.js";
|
|
11
|
+
import { ARCtrl_DataMap__DataMap_ToUpdateContractForStudy_Z721C83C5, ARCtrl_DataMap__DataMap_ToCreateContractForStudy_Z721C83C5 } from "./Datamap.js";
|
|
10
12
|
|
|
11
13
|
export function $007CStudyPath$007C_$007C(input) {
|
|
12
14
|
let matchResult;
|
|
@@ -36,19 +38,40 @@ export function $007CStudyPath$007C_$007C(input) {
|
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
export function
|
|
41
|
+
export function ARCtrl_ArcStudy__ArcStudy_ToCreateContract_66CF920(this$, WithFolder, datamapAsFile) {
|
|
40
42
|
const withFolder = defaultArg(WithFolder, false);
|
|
43
|
+
const dataMapAsFile = defaultArg(datamapAsFile, false);
|
|
41
44
|
const path = Study_fileNameFromIdentifier(this$.Identifier);
|
|
42
|
-
const
|
|
45
|
+
const dto = ARCtrl_ArcStudy__ArcStudy_toFsWorkbook_Static_Z4CEFA522(this$, undefined, !dataMapAsFile);
|
|
46
|
+
const c = Contract.createCreate(path, "ISA_Study", dto);
|
|
43
47
|
return toArray(delay(() => {
|
|
44
48
|
let folderFS;
|
|
45
|
-
return append(withFolder ? ((folderFS = FileSystemTree.createStudiesFolder([FileSystemTree.createStudyFolder(this$.Identifier)]), collect((p) => (((p !== path) && (p !== "studies/.gitkeep")) ? singleton(Contract.createCreate(p, "PlainText")) : empty()), folderFS.ToFilePaths(false)))) : empty(), delay(() =>
|
|
49
|
+
return append(withFolder ? ((folderFS = FileSystemTree.createStudiesFolder([FileSystemTree.createStudyFolder(this$.Identifier)]), collect((p) => (((p !== path) && (p !== "studies/.gitkeep")) ? singleton(Contract.createCreate(p, "PlainText")) : empty()), folderFS.ToFilePaths(false)))) : empty(), delay(() => {
|
|
50
|
+
let matchValue, dm;
|
|
51
|
+
return append((matchValue = this$.DataMap, (matchValue != null) ? ((dm = matchValue, (DataMap__set_StaticHash_Z524259A4(dm, safeHash(dm)), dataMapAsFile ? singleton(ARCtrl_DataMap__DataMap_ToCreateContractForStudy_Z721C83C5(dm, this$.Identifier)) : empty()))) : (empty())), delay(() => singleton(c)));
|
|
52
|
+
}));
|
|
46
53
|
}));
|
|
47
54
|
}
|
|
48
55
|
|
|
49
|
-
export function
|
|
56
|
+
export function ARCtrl_ArcStudy__ArcStudy_ToUpdateContract_6FCE9E49(this$, datamapAsFile) {
|
|
57
|
+
const datamapAsFile_1 = defaultArg(datamapAsFile, false);
|
|
50
58
|
const path = Study_fileNameFromIdentifier(this$.Identifier);
|
|
51
|
-
|
|
59
|
+
const hash = this$.GetLightHashCode() | 0;
|
|
60
|
+
let datamapHasChanged;
|
|
61
|
+
const matchValue = this$.DataMap;
|
|
62
|
+
if (matchValue != null) {
|
|
63
|
+
const dm = matchValue;
|
|
64
|
+
const hc = safeHash(dm) !== DataMap__get_StaticHash(dm);
|
|
65
|
+
DataMap__set_StaticHash_Z524259A4(dm, safeHash(dm));
|
|
66
|
+
datamapHasChanged = hc;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
datamapHasChanged = false;
|
|
70
|
+
}
|
|
71
|
+
return toArray(delay(() => {
|
|
72
|
+
let dto;
|
|
73
|
+
return append(((hash !== this$.StaticHash) ? true : (datamapHasChanged && !datamapAsFile_1)) ? singleton((dto = ARCtrl_ArcStudy__ArcStudy_toFsWorkbook_Static_Z4CEFA522(this$, undefined, !datamapAsFile_1), Contract.createUpdate(path, "ISA_Study", dto))) : empty(), delay(() => ((datamapHasChanged && datamapAsFile_1) ? singleton(ARCtrl_DataMap__DataMap_ToUpdateContractForStudy_Z721C83C5(value(this$.DataMap), this$.Identifier)) : empty())));
|
|
74
|
+
}));
|
|
52
75
|
}
|
|
53
76
|
|
|
54
77
|
export function ARCtrl_ArcStudy__ArcStudy_ToDeleteContract(this$) {
|
|
@@ -61,11 +84,11 @@ export function ARCtrl_ArcStudy__ArcStudy_toDeleteContract_Static_1680536E(study
|
|
|
61
84
|
}
|
|
62
85
|
|
|
63
86
|
export function ARCtrl_ArcStudy__ArcStudy_toCreateContract_Static_Z76BBA099(study, WithFolder) {
|
|
64
|
-
return
|
|
87
|
+
return ARCtrl_ArcStudy__ArcStudy_ToCreateContract_66CF920(study, unwrap(WithFolder));
|
|
65
88
|
}
|
|
66
89
|
|
|
67
90
|
export function ARCtrl_ArcStudy__ArcStudy_toUpdateContract_Static_1680536E(study) {
|
|
68
|
-
return
|
|
91
|
+
return ARCtrl_ArcStudy__ArcStudy_ToUpdateContract_6FCE9E49(study);
|
|
69
92
|
}
|
|
70
93
|
|
|
71
94
|
export function ARCtrl_ArcStudy__ArcStudy_tryFromReadContract_Static_7570923F(c) {
|