@nfdi4plants/arctrl 2.0.0-beta.2 → 2.0.0

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 (83) hide show
  1. package/ARC.js +55 -18
  2. package/Contract/ArcAssay.js +4 -4
  3. package/Contract/ArcInvestigation.js +4 -4
  4. package/Contract/ArcStudy.js +3 -3
  5. package/Contract/Datamap.js +1 -1
  6. package/Contract/ValidationPackagesConfig.js +96 -0
  7. package/Core/ArcTypes.js +93 -90
  8. package/Core/Conversion.js +13 -13
  9. package/Core/DataContext.js +53 -6
  10. package/Core/{Table/DataMap.js → DataMap.js} +34 -22
  11. package/Core/Process/Component.js +15 -5
  12. package/Core/Process/FactorValue.js +14 -5
  13. package/Core/Process/MaterialAttributeValue.js +14 -5
  14. package/Core/Process/ProcessParameterValue.js +11 -2
  15. package/Core/Table/ArcTable.js +99 -11
  16. package/Core/Table/CompositeCell.js +38 -23
  17. package/Core/Table/CompositeColumn.js +7 -30
  18. package/Core/Table/CompositeHeader.js +5 -215
  19. package/Core/{Process/Value.js → Value.js} +9 -9
  20. package/Json/Assay.js +10 -9
  21. package/Json/{Process/Data.js → Data.js} +17 -17
  22. package/Json/{Process/DataFile.js → DataFile.js} +9 -9
  23. package/Json/DataMap/DataContext.js +30 -0
  24. package/Json/DataMap/DataMap.js +25 -0
  25. package/Json/Encode.js +10 -1
  26. package/Json/Process/Component.js +1 -1
  27. package/Json/Process/FactorValue.js +1 -1
  28. package/Json/Process/MaterialAttributeValue.js +1 -1
  29. package/Json/Process/ProcessInput.js +1 -1
  30. package/Json/Process/ProcessOutput.js +1 -1
  31. package/Json/Process/ProcessParameterValue.js +2 -2
  32. package/Json/Process/Value.js +3 -3
  33. package/Json/{Process/PropertyValue.js → PropertyValue.js} +30 -21
  34. package/Json/Study.js +9 -8
  35. package/Json/Table/CompositeCell.js +1 -1
  36. package/Json/context/rocrate/isa_data_context.js +1 -1
  37. package/Json/context/rocrate/isa_investigation_context.js +1 -1
  38. package/Json/context/rocrate/property_value_context.js +1 -1
  39. package/Spreadsheet/AnnotationTable/ArcTable.js +3 -2
  40. package/Spreadsheet/AnnotationTable/CompositeColumn.js +9 -7
  41. package/Spreadsheet/ArcAssay.js +62 -26
  42. package/Spreadsheet/ArcInvestigation.js +59 -38
  43. package/Spreadsheet/ArcStudy.js +51 -20
  44. package/Spreadsheet/DataMap.js +1 -1
  45. package/Spreadsheet/DataMapTable/DataMapTable.js +3 -3
  46. package/Spreadsheet/Template.js +1 -1
  47. package/ValidationPackages/ValidationPackage.js +61 -0
  48. package/ValidationPackages/ValidationPackagesConfig.js +88 -0
  49. package/Xlsx.js +9 -9
  50. package/Yaml/Encode.js +8 -0
  51. package/Yaml/ValidationPackage.js +47 -0
  52. package/Yaml/ValidationPackagesConfig.js +48 -0
  53. package/fable_modules/YAMLicious.0.0.1/Decode.fs +374 -0
  54. package/fable_modules/YAMLicious.0.0.1/Decode.fs.js +1684 -0
  55. package/fable_modules/YAMLicious.0.0.1/Encode.fs +148 -0
  56. package/fable_modules/YAMLicious.0.0.1/Encode.fs.js +74 -0
  57. package/fable_modules/YAMLicious.0.0.1/Interop/JsInterop.fs +14 -0
  58. package/fable_modules/YAMLicious.0.0.1/Interop/JsInterop.fs.js +11 -0
  59. package/fable_modules/YAMLicious.0.0.1/Interop/PyInterop.fs +9 -0
  60. package/fable_modules/YAMLicious.0.0.1/Library.fs +138 -0
  61. package/fable_modules/YAMLicious.0.0.1/Library.fs.js +7 -0
  62. package/fable_modules/YAMLicious.0.0.1/Persil.fs +86 -0
  63. package/fable_modules/YAMLicious.0.0.1/Persil.fs.js +49 -0
  64. package/fable_modules/YAMLicious.0.0.1/Preprocessing.fs +59 -0
  65. package/fable_modules/YAMLicious.0.0.1/Preprocessing.fs.js +102 -0
  66. package/fable_modules/YAMLicious.0.0.1/Reader.fs +295 -0
  67. package/fable_modules/YAMLicious.0.0.1/Reader.fs.js +530 -0
  68. package/fable_modules/YAMLicious.0.0.1/Regex.fs +108 -0
  69. package/fable_modules/YAMLicious.0.0.1/Regex.fs.js +19 -0
  70. package/fable_modules/YAMLicious.0.0.1/RegexActivePatterns.fs +166 -0
  71. package/fable_modules/YAMLicious.0.0.1/RegexActivePatterns.fs.js +225 -0
  72. package/fable_modules/YAMLicious.0.0.1/Writer.fs +84 -0
  73. package/fable_modules/YAMLicious.0.0.1/Writer.fs.js +161 -0
  74. package/fable_modules/YAMLicious.0.0.1/YAMLicious.fableproj +39 -0
  75. package/fable_modules/YAMLicious.0.0.1/YAMLiciousTypes.fs +82 -0
  76. package/fable_modules/YAMLicious.0.0.1/YAMLiciousTypes.fs.js +130 -0
  77. package/fable_modules/YAMLicious.0.0.1/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
  78. package/fable_modules/YAMLicious.0.0.1/obj/Debug/netstandard2.0/YAMLicious.AssemblyInfo.fs +19 -0
  79. package/fable_modules/YAMLicious.0.0.1/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
  80. package/fable_modules/YAMLicious.0.0.1/obj/Release/netstandard2.0/YAMLicious.AssemblyInfo.fs +19 -0
  81. package/fable_modules/project_cracked.json +1 -1
  82. package/index.js +1 -0
  83. package/package.json +1 -1
@@ -0,0 +1,102 @@
1
+ import { takeWhile, length } from "../fable-library-js.4.16.0/Seq.js";
2
+ import { Preprocessor, PreprocessorElement, Config__get_WhitespaceString, Config, Config_init_71136F3F } from "./YAMLiciousTypes.fs.js";
3
+ import { value as value_1 } from "../fable-library-js.4.16.0/Option.js";
4
+ import { StringBuilder__AppendLine_Z721C83C5, StringBuilder_$ctor } from "../fable-library-js.4.16.0/System.Text.js";
5
+ import { disposeSafe, getEnumerator } from "../fable-library-js.4.16.0/Util.js";
6
+ import { toString } from "../fable-library-js.4.16.0/Types.js";
7
+ import { pipeline } from "./Persil.fs.js";
8
+ import { ofSeq, ofArray, empty, reverse, skipWhile, takeWhile as takeWhile_1, cons, head, tail, isEmpty } from "../fable-library-js.4.16.0/List.js";
9
+
10
+ export function ReadHelpers_indentLevel(line) {
11
+ return length(takeWhile((c) => (c === " "), line.split("")));
12
+ }
13
+
14
+ export function write(rootElement, fconfig) {
15
+ let config_1;
16
+ const config = Config_init_71136F3F();
17
+ config_1 = ((fconfig != null) ? value_1(fconfig)(config) : config);
18
+ const sb = StringBuilder_$ctor();
19
+ const loop = (current, sb_1, config_2) => {
20
+ switch (current.tag) {
21
+ case 1: {
22
+ const nextConfig = new Config(config_2.Whitespace, config_2.Level + 1);
23
+ const enumerator = getEnumerator(current.fields[0]);
24
+ try {
25
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
26
+ loop(enumerator["System.Collections.Generic.IEnumerator`1.get_Current"](), sb_1, nextConfig);
27
+ }
28
+ }
29
+ finally {
30
+ disposeSafe(enumerator);
31
+ }
32
+ break;
33
+ }
34
+ case 0: {
35
+ const enumerator_1 = getEnumerator(current.fields[0]);
36
+ try {
37
+ while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
38
+ loop(enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"](), sb_1, config_2);
39
+ }
40
+ }
41
+ finally {
42
+ disposeSafe(enumerator_1);
43
+ }
44
+ break;
45
+ }
46
+ case 3: {
47
+ break;
48
+ }
49
+ default:
50
+ StringBuilder__AppendLine_Z721C83C5(sb_1, Config__get_WhitespaceString(config_2) + current.fields[0]);
51
+ }
52
+ };
53
+ loop(rootElement, sb, config_1);
54
+ return toString(sb);
55
+ }
56
+
57
+ export function read(yamlStr) {
58
+ const content = pipeline(yamlStr);
59
+ const loop = (lines_mut, currentIntendation_mut, acc_mut) => {
60
+ loop:
61
+ while (true) {
62
+ const lines = lines_mut, currentIntendation = currentIntendation_mut, acc = acc_mut;
63
+ if (!isEmpty(lines)) {
64
+ const rest = tail(lines);
65
+ const line = head(lines);
66
+ const lineEle = new PreprocessorElement(2, [line.trim()]);
67
+ const nextIntendation = ReadHelpers_indentLevel(line) | 0;
68
+ if (nextIntendation === currentIntendation) {
69
+ lines_mut = rest;
70
+ currentIntendation_mut = currentIntendation;
71
+ acc_mut = cons(new PreprocessorElement(2, [line.trim()]), acc);
72
+ continue loop;
73
+ }
74
+ else {
75
+ const nextLevelLines = takeWhile_1((l) => (ReadHelpers_indentLevel(l) > currentIntendation), rest);
76
+ lines_mut = skipWhile((l_1) => (ReadHelpers_indentLevel(l_1) > currentIntendation), rest);
77
+ currentIntendation_mut = currentIntendation;
78
+ acc_mut = cons(new PreprocessorElement(1, [cons(lineEle, reverse(loop(nextLevelLines, nextIntendation, empty())))]), acc);
79
+ continue loop;
80
+ }
81
+ }
82
+ else {
83
+ return acc;
84
+ }
85
+ break;
86
+ }
87
+ };
88
+ return new Preprocessor(new PreprocessorElement(0, [reverse(loop(ofArray(content.Lines), 0, empty()))]), content.StringMap, content.CommentMap);
89
+ }
90
+
91
+ export function mkLine(line) {
92
+ return new PreprocessorElement(2, [line]);
93
+ }
94
+
95
+ export function mklLevel(children) {
96
+ return new PreprocessorElement(0, [ofSeq(children)]);
97
+ }
98
+
99
+ export function mkIntendation(children) {
100
+ return new PreprocessorElement(1, [ofSeq(children)]);
101
+ }
102
+
@@ -0,0 +1,295 @@
1
+ module YAMLicious.Reader
2
+
3
+ open Regex
4
+ open Preprocessing
5
+ open System.Text.RegularExpressions
6
+ open RegexActivePatterns
7
+ open YAMLiciousTypes
8
+ open System.Collections.Generic
9
+
10
+ let private restoreStringReplace (stringDict: Dictionary<int, string>) (v: string) =
11
+ let m = Regex.Match(v, StringReplacementPattern)
12
+ if m.Success then
13
+ let index = m.Groups.["index"].Value |> int
14
+ stringDict.[index]
15
+ else
16
+ v
17
+
18
+ let private restoreCommentReplace (commentDict: Dictionary<int, string>) (commentId: int option) =
19
+ commentId |> Option.map (fun id -> commentDict.[id])
20
+
21
+ let rec collectSequenceElements (eles: PreprocessorElement list) : PreprocessorElement list list =
22
+ match eles with
23
+ | SequenceMinusOpener v::Intendation yamlAstList::rest ->
24
+ [
25
+ if v.Value.IsSome then
26
+ PreprocessorElement.Line v.Value.Value::yamlAstList
27
+ else
28
+ yamlAstList
29
+ yield! collectSequenceElements rest
30
+ ]
31
+ | SequenceMinusOpener v::rest ->
32
+ [
33
+ [PreprocessorElement.Line v.Value.Value]
34
+ yield! collectSequenceElements rest
35
+ ]
36
+ | YamlComment _ as v::rest ->
37
+ [
38
+ [v]
39
+ yield! collectSequenceElements rest
40
+ ]
41
+ | [] ->
42
+ []
43
+ | anyElse -> failwithf "Unknown pattern for sequence elements: %A" anyElse
44
+
45
+ let isSequenceElement = fun e -> match e with | Intendation _ | SequenceMinusOpener _ | YamlComment _ -> true | _ -> false
46
+
47
+ let private tokenize (yamlList: PreprocessorElement list) (stringDict: Dictionary<int, string>) (commentDict: Dictionary<int, string>) =
48
+ let rec loopRead (restlist: PreprocessorElement list) (acc: YAMLElement list) : YAMLElement =
49
+ match restlist with
50
+ | SchemaNamespace v::Intendation yamlAstList::rest0 -> //create/appendSequenceElement
51
+ //printfn "[tokenize] Case1"
52
+ let objectList =
53
+ PreprocessorElement.Line v.Key::yamlAstList
54
+ let sequenceElements = rest0 |> Seq.takeWhile isSequenceElement |> Seq.toList |> collectSequenceElements
55
+ let rest = rest0 |> Seq.skipWhile isSequenceElement |> Seq.toList
56
+ let current =
57
+ YAMLElement.Sequence [
58
+ loopRead objectList []
59
+ for i in sequenceElements do
60
+ loopRead i []
61
+ ]
62
+ loopRead rest (current::acc)
63
+ | SchemaNamespace v::rest0 -> //create/appendSequenceElement
64
+ //printfn "[tokenize] Case2"
65
+ let sequenceElements = rest0 |> Seq.takeWhile isSequenceElement |> Seq.toList |> collectSequenceElements
66
+ let rest = rest0 |> Seq.skipWhile isSequenceElement |> Seq.toList
67
+ let current =
68
+ YAMLElement.Sequence [
69
+ loopRead [PreprocessorElement.Line v.Key] []
70
+ for i in sequenceElements do
71
+ loopRead i []
72
+ ]
73
+ loopRead rest (current::acc)
74
+ // Example1:
75
+ // - My Value 1 <c f=1/>
76
+ // My Value 2
77
+ // - My Value 3
78
+ // Example2:
79
+ // -
80
+ // My Key1: My Value1
81
+ // My Key2: My Value2
82
+ // My Key3: My Value3
83
+ | SequenceMinusOpener v::Intendation yamlAstList::rest0 -> //create/appendSequenceElement
84
+ //printfn "[tokenize] Case1"
85
+ let objectList =
86
+ if v.Value.IsSome then
87
+ PreprocessorElement.Line v.Value.Value::yamlAstList
88
+ else
89
+ yamlAstList
90
+ let sequenceElements = rest0 |> Seq.takeWhile isSequenceElement |> Seq.toList |> collectSequenceElements
91
+ let rest = rest0 |> Seq.skipWhile isSequenceElement |> Seq.toList
92
+ let current =
93
+ YAMLElement.Sequence [
94
+ loopRead objectList []
95
+ for i in sequenceElements do
96
+ loopRead i []
97
+ ]
98
+ loopRead rest (current::acc)
99
+ | SequenceMinusOpener v::rest0 -> //create/appendSequenceElement
100
+ //printfn "[tokenize] Case2"
101
+ let sequenceElements = rest0 |> Seq.takeWhile isSequenceElement |> Seq.toList |> collectSequenceElements
102
+ let rest = rest0 |> Seq.skipWhile isSequenceElement |> Seq.toList
103
+ let current =
104
+ YAMLElement.Sequence [
105
+ loopRead [PreprocessorElement.Line v.Value.Value] []
106
+ for i in sequenceElements do
107
+ loopRead i []
108
+ ]
109
+ loopRead rest (current::acc)
110
+ // [test1, test2, test] <c f=1/>
111
+ | InlineSequence v::rest -> // create sequence
112
+ //printfn "[tokenize] Case3"
113
+ // ensure inline comment is added on top of the sequence
114
+ let c = restoreCommentReplace commentDict v.Comment
115
+ // split inline sequence by delimiter, then reuse default parsing into SequenceElements
116
+ let split = v.Value.Split([|SequenceSquareDelimiter|], System.StringSplitOptions.RemoveEmptyEntries)
117
+ let current =
118
+ YAMLElement.Sequence [
119
+ for value in split do
120
+ loopRead [PreprocessorElement.Line (value.Trim())] []
121
+ ]
122
+ let nextAcc =
123
+ if c.IsSome then
124
+ current::YAMLElement.Comment c.Value::acc
125
+ else
126
+ current::acc
127
+ loopRead rest nextAcc
128
+ // [ #c1
129
+ // v1,
130
+ // v2,
131
+ // v3
132
+ // ] #c2
133
+ | SequenceSquareOpener opener::Intendation iList::SequenceSquareCloser closer::rest ->
134
+ //printfn "[tokenize] Case3.5"
135
+ let c1 = opener.Comment |> restoreCommentReplace commentDict
136
+ let c2 = closer.Comment |> restoreCommentReplace commentDict
137
+ let current =
138
+ YAMLElement.Sequence [
139
+ for i in iList do
140
+ let i' =
141
+ match i with
142
+ | Line s -> s.TrimEnd(',') |> Line
143
+ | anyElse -> failwithf "Unexpected element in MultiLineSquareBrackets: %A" anyElse
144
+ loopRead [i'] []
145
+ ]
146
+ let nextAcc =
147
+ match c1, c2 with
148
+ | Some c1, Some c2 ->
149
+ YAMLElement.Comment c2::current::YAMLElement.Comment c1::acc
150
+ | Some c1, None ->
151
+ current::YAMLElement.Comment c1::acc
152
+ | None, Some c2 ->
153
+ YAMLElement.Comment c2::current::acc
154
+ | None, None ->
155
+ current::acc
156
+ loopRead rest nextAcc
157
+ | InlineJSON v::rest -> // create sequence
158
+ //printfn "[tokenize] Case3.1"
159
+ // ensure inline comment is added on top of the sequence
160
+ let c = restoreCommentReplace commentDict v.Comment
161
+ // split inline sequence by delimiter, then reuse default parsing into SequenceElements
162
+ let split = v.Value.Split([|SequenceSquareDelimiter|], System.StringSplitOptions.RemoveEmptyEntries)
163
+ let current =
164
+ [
165
+ for value in split do
166
+ match loopRead [PreprocessorElement.Line (value.Trim())] [] with
167
+ | YAMLElement.Object o -> yield! o
168
+ |_ -> failwith "Unexpected element in InlineJSON"
169
+
170
+ ]
171
+ |> List.rev
172
+ let nextAcc =
173
+ if c.IsSome then
174
+ current@(YAMLElement.Comment c.Value::acc)
175
+ else
176
+ current@acc
177
+ loopRead rest nextAcc
178
+ //Sammy Sosa: { #lel
179
+ // hr: 63,
180
+ // avg: 0.288,
181
+ //}
182
+ | JSONKeyOpener opener::Intendation iList::JSONCloser closer::rest ->
183
+ //printfn "[tokenize] Case3.6"
184
+ let c1 = opener.Comment |> restoreCommentReplace commentDict
185
+ let c2 = closer.Comment |> restoreCommentReplace commentDict
186
+ let current =
187
+ YAMLElement.Mapping (
188
+ YAMLContent.create(opener.Key, ?comment=c1),
189
+ YAMLElement.Object [
190
+ for i in iList do
191
+ let i' =
192
+ match i with
193
+ | Line s -> s.TrimEnd(',') |> Line
194
+ | anyElse -> failwithf "Unexpected element in MultiLineSquareBrackets: %A" anyElse
195
+ match loopRead [i'] [] with
196
+ | YAMLElement.Object o -> yield! o
197
+ |_ -> failwith "Unexpected element in MultilineJSON"
198
+ ]
199
+ )
200
+ let nextAcc =
201
+ match c2 with
202
+ | Some c2 ->
203
+ YAMLElement.Comment c2::current::acc
204
+ | None ->
205
+ current::acc
206
+ loopRead rest nextAcc
207
+ | Key v::Intendation yamlAstList::rest -> //createObject
208
+ //printfn "[tokenize] Case4"
209
+ let c = restoreCommentReplace commentDict v.Comment
210
+ let current =
211
+ YAMLElement.Mapping (
212
+ YAMLContent.create(v.Key, ?comment=c),
213
+ loopRead yamlAstList []
214
+ )
215
+ loopRead rest (current::acc)
216
+ | Key v::SequenceMinusOpener w::Intendation yamlAstList::rest0 -> //create/appendSequenceElement
217
+ //printfn "[tokenize] Case4.1"
218
+ let c = restoreCommentReplace commentDict v.Comment
219
+ let objectList =
220
+ if w.Value.IsSome then
221
+ PreprocessorElement.Line w.Value.Value::yamlAstList
222
+ else
223
+ yamlAstList
224
+ let sequenceElements = rest0 |> Seq.takeWhile isSequenceElement |> Seq.toList |> collectSequenceElements
225
+ let rest = rest0 |> Seq.skipWhile isSequenceElement |> Seq.toList
226
+ let seq =
227
+ YAMLElement.Sequence [
228
+ loopRead objectList []
229
+ for i in sequenceElements do
230
+ loopRead i []
231
+ ]
232
+ let current =
233
+ YAMLElement.Mapping (
234
+ YAMLContent.create(v.Key, ?comment=c),
235
+ YAMLElement.Object [seq]
236
+ )
237
+ loopRead rest (current::acc)
238
+ | Key v::SequenceMinusOpener w::rest0 -> //createObject
239
+ //printfn "[tokenize] Case4.2"
240
+ let c = restoreCommentReplace commentDict v.Comment
241
+ let sequenceElements = rest0 |> Seq.takeWhile isSequenceElement |> Seq.toList |> collectSequenceElements
242
+ let rest = rest0 |> Seq.skipWhile isSequenceElement |> Seq.toList
243
+ let seq =
244
+ YAMLElement.Sequence [
245
+ loopRead [PreprocessorElement.Line w.Value.Value] []
246
+ for i in sequenceElements do
247
+ loopRead i []
248
+ ]
249
+ let current =
250
+ YAMLElement.Mapping (
251
+ YAMLContent.create(v.Key, ?comment=c),
252
+ YAMLElement.Object [seq]
253
+ )
254
+ loopRead rest (current::acc)
255
+ // My Key: [My Value, Test2]
256
+ | KeyValue v::rest -> // createKeyValue
257
+ //printfn "[tokenize] Case5"
258
+ let current =
259
+ YAMLElement.Mapping (
260
+ YAMLContent.create(v.Key),
261
+ //reuse default parsing into SequenceElements
262
+ loopRead [PreprocessorElement.Line v.Value] []
263
+ )
264
+ loopRead rest (current::acc)
265
+ // <c f=1/>
266
+ | YamlComment v::rest -> // createComment
267
+ //printfn "[tokenize] Case5.5"
268
+ let c = commentDict.[v.Comment]
269
+ let current =
270
+ YAMLElement.Comment (c)
271
+ loopRead rest (current::acc)
272
+ // My Value <c f=1/>
273
+ | YamlValue v::rest -> // createValue
274
+ //printfn "[tokenize] Case6"
275
+ let raw = restoreStringReplace stringDict v.Value
276
+ let c = restoreCommentReplace commentDict v.Comment
277
+ let current =
278
+ YAMLElement.Value (
279
+ YAMLContent.create(raw, ?comment=c)
280
+ )
281
+ loopRead rest (current::acc)
282
+ | [] ->
283
+ //printfn "[tokenize] Exit Multiple: Object"
284
+ acc
285
+ |> List.rev
286
+ |> YAMLElement.Object
287
+ | anyElse -> failwithf "Unknown pattern: %A" anyElse
288
+ loopRead yamlList []
289
+
290
+ let read (yaml: string) =
291
+ let ast = read yaml
292
+ match ast.AST with
293
+ | Level lvl ->
294
+ tokenize lvl ast.StringMap ast.CommentMap
295
+ | _ -> failwith "Not a root!"