@nfdi4plants/arctrl 3.0.0-alpha.4 → 3.0.0-beta.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/README.md +16 -8
- package/dist/ts/cjs/ts/ARC.js +31 -20
- package/dist/ts/cjs/ts/Conversion.js +122 -76
- package/dist/ts/cjs/ts/Core/ArcTypes.js +1 -1
- package/dist/ts/cjs/ts/Core/Conversion.js +110 -43
- package/dist/ts/cjs/ts/Core/Data.js +4 -2
- package/dist/ts/cjs/ts/Core/Helper/Collections.js +69 -1
- package/dist/ts/cjs/ts/Core/OntologyAnnotation.js +27 -23
- package/dist/ts/cjs/ts/Core/Table/ArcTable.js +234 -217
- package/dist/ts/cjs/ts/Core/Table/ArcTableAux.js +904 -255
- package/dist/ts/cjs/ts/Core/Table/ArcTables.js +12 -19
- package/dist/ts/cjs/ts/Core/Table/CompositeColumn.js +4 -2
- package/dist/ts/cjs/ts/FileSystem/DefaultGitattributes.js +1 -1
- package/dist/ts/cjs/ts/Json/Decode.js +105 -0
- package/dist/ts/cjs/ts/Json/Encode.js +42 -0
- package/dist/ts/cjs/ts/Json/Table/ArcTable.js +100 -113
- package/dist/ts/cjs/ts/Json.js +46 -1
- package/dist/ts/cjs/ts/ROCrateIO.js +12 -1
- package/dist/ts/cjs/ts/Spreadsheet/AnnotationTable/ArcTable.js +15 -4
- package/dist/ts/cjs/ts/Spreadsheet/AnnotationTable/CompositeColumn.js +77 -6
- package/dist/ts/cjs/ts/Spreadsheet/ArcInvestigation.js +31 -15
- package/dist/ts/cjs/ts/Spreadsheet/DataMapTable/DataMapHeader.js +1 -1
- package/dist/ts/cjs/ts/Spreadsheet/Metadata/SparseTable.js +2 -5
- package/dist/ts/esm/ts/ARC.js +34 -23
- package/dist/ts/esm/ts/Conversion.js +128 -82
- package/dist/ts/esm/ts/Core/ArcTypes.js +1 -1
- package/dist/ts/esm/ts/Core/Conversion.js +112 -45
- package/dist/ts/esm/ts/Core/Data.js +7 -5
- package/dist/ts/esm/ts/Core/Helper/Collections.js +61 -1
- package/dist/ts/esm/ts/Core/OntologyAnnotation.js +29 -25
- package/dist/ts/esm/ts/Core/Table/ArcTable.js +243 -226
- package/dist/ts/esm/ts/Core/Table/ArcTableAux.js +897 -264
- package/dist/ts/esm/ts/Core/Table/ArcTables.js +15 -22
- package/dist/ts/esm/ts/Core/Table/CompositeColumn.js +5 -3
- package/dist/ts/esm/ts/FileSystem/DefaultGitattributes.js +1 -1
- package/dist/ts/esm/ts/Json/Decode.js +105 -3
- package/dist/ts/esm/ts/Json/Encode.js +42 -2
- package/dist/ts/esm/ts/Json/Table/ArcTable.js +108 -121
- package/dist/ts/esm/ts/Json.js +39 -0
- package/dist/ts/esm/ts/ROCrateIO.js +14 -3
- package/dist/ts/esm/ts/Spreadsheet/AnnotationTable/ArcTable.js +17 -7
- package/dist/ts/esm/ts/Spreadsheet/AnnotationTable/CompositeColumn.js +78 -9
- package/dist/ts/esm/ts/Spreadsheet/ArcInvestigation.js +33 -17
- package/dist/ts/esm/ts/Spreadsheet/DataMapTable/DataMapHeader.js +1 -1
- package/dist/ts/esm/ts/Spreadsheet/Metadata/SparseTable.js +3 -6
- package/dist/ts/types/ts/ARC.d.ts +2 -2
- package/dist/ts/types/ts/ARC.d.ts.map +1 -1
- package/dist/ts/types/ts/Conversion.d.ts +15 -16
- package/dist/ts/types/ts/Conversion.d.ts.map +1 -1
- package/dist/ts/types/ts/Core/ArcTypes.d.ts +2 -0
- package/dist/ts/types/ts/Core/ArcTypes.d.ts.map +1 -1
- package/dist/ts/types/ts/Core/Conversion.d.ts +14 -15
- package/dist/ts/types/ts/Core/Conversion.d.ts.map +1 -1
- package/dist/ts/types/ts/Core/Data.d.ts.map +1 -1
- package/dist/ts/types/ts/Core/Helper/Collections.d.ts +8 -0
- package/dist/ts/types/ts/Core/Helper/Collections.d.ts.map +1 -1
- package/dist/ts/types/ts/Core/OntologyAnnotation.d.ts +9 -0
- package/dist/ts/types/ts/Core/OntologyAnnotation.d.ts.map +1 -1
- package/dist/ts/types/ts/Core/Table/ArcTable.d.ts +35 -28
- package/dist/ts/types/ts/Core/Table/ArcTable.d.ts.map +1 -1
- package/dist/ts/types/ts/Core/Table/ArcTableAux.d.ts +83 -35
- package/dist/ts/types/ts/Core/Table/ArcTableAux.d.ts.map +1 -1
- package/dist/ts/types/ts/Core/Table/ArcTables.d.ts.map +1 -1
- package/dist/ts/types/ts/Core/Table/CompositeColumn.d.ts.map +1 -1
- package/dist/ts/types/ts/FileSystem/DefaultGitattributes.d.ts +1 -1
- package/dist/ts/types/ts/FileSystem/DefaultGitattributes.d.ts.map +1 -1
- package/dist/ts/types/ts/Json/Decode.d.ts +6 -0
- package/dist/ts/types/ts/Json/Decode.d.ts.map +1 -1
- package/dist/ts/types/ts/Json/Encode.d.ts +2 -0
- package/dist/ts/types/ts/Json/Encode.d.ts.map +1 -1
- package/dist/ts/types/ts/Json/Table/ArcTable.d.ts +4 -3
- package/dist/ts/types/ts/Json/Table/ArcTable.d.ts.map +1 -1
- package/dist/ts/types/ts/Json.d.ts +17 -0
- package/dist/ts/types/ts/Json.d.ts.map +1 -1
- package/dist/ts/types/ts/ROCrateIO.d.ts +1 -1
- package/dist/ts/types/ts/ROCrateIO.d.ts.map +1 -1
- package/dist/ts/types/ts/Spreadsheet/AnnotationTable/ArcTable.d.ts +5 -0
- package/dist/ts/types/ts/Spreadsheet/AnnotationTable/ArcTable.d.ts.map +1 -1
- package/dist/ts/types/ts/Spreadsheet/AnnotationTable/CompositeColumn.d.ts +7 -0
- package/dist/ts/types/ts/Spreadsheet/AnnotationTable/CompositeColumn.d.ts.map +1 -1
- package/dist/ts/types/ts/Spreadsheet/ArcInvestigation.d.ts.map +1 -1
- package/dist/ts/types/ts/Spreadsheet/Metadata/SparseTable.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { append,
|
|
1
|
+
import { append, reduce, choose, map as map_1, delay, toList, length, findIndex, tryFindIndex } from "@fable-org/fable-library-js/Seq.js";
|
|
2
2
|
import { ArcTable } from "./ArcTable.js";
|
|
3
3
|
import { bind, map as map_2, unwrap, defaultArg, value as value_2 } from "@fable-org/fable-library-js/Option.js";
|
|
4
4
|
import { CompositeHeader_ProtocolREF, CompositeHeader_Output, CompositeHeader_Input } from "./CompositeHeader.js";
|
|
5
5
|
import { toIterator, equals, comparePrimitives, stringHash, compare, disposeSafe, getEnumerator } from "@fable-org/fable-library-js/Util.js";
|
|
6
|
-
import { Dictionary_tryFind } from "../Helper/Collections.js";
|
|
6
|
+
import { ResizeArray_collect, ResizeArray_groupBy, ResizeArray_map, ResizeArray_fold, ResizeArray_iter, Dictionary_tryFind } from "../Helper/Collections.js";
|
|
7
7
|
import { addToSet, addToDict } from "@fable-org/fable-library-js/MapUtil.js";
|
|
8
|
-
import {
|
|
9
|
-
import { Array_groupBy, distinct } from "@fable-org/fable-library-js/Seq2.js";
|
|
8
|
+
import { distinct } from "@fable-org/fable-library-js/Seq2.js";
|
|
10
9
|
import { FSharpSet__get_IsEmpty, ofSeq, intersect } from "@fable-org/fable-library-js/Set.js";
|
|
10
|
+
import { insertRangeInPlace } from "@fable-org/fable-library-js/Array.js";
|
|
11
11
|
import { tryFind, ofSeq as ofSeq_1 } from "@fable-org/fable-library-js/Map.js";
|
|
12
|
-
import { Unchecked_fillMissingCells } from "./ArcTableAux.js";
|
|
13
12
|
import { class_type } from "@fable-org/fable-library-js/Reflection.js";
|
|
14
13
|
/**
|
|
15
14
|
* If a table with the given name exists in the TableList, returns it, else returns None.
|
|
@@ -57,9 +56,9 @@ export function ArcTablesAux_getIOMap(tables) {
|
|
|
57
56
|
else {
|
|
58
57
|
const ic = value_2(matchValue_1);
|
|
59
58
|
const ioType_1 = value_2(ic.Header.TryInput());
|
|
60
|
-
|
|
59
|
+
ResizeArray_iter((c) => {
|
|
61
60
|
includeInMap(c.ToFreeTextCell().AsFreeText, ioType_1);
|
|
62
|
-
});
|
|
61
|
+
}, ic.Cells);
|
|
63
62
|
}
|
|
64
63
|
const matchValue_2 = table.TryGetOutputColumn();
|
|
65
64
|
if (matchValue_2 == null) {
|
|
@@ -67,9 +66,9 @@ export function ArcTablesAux_getIOMap(tables) {
|
|
|
67
66
|
else {
|
|
68
67
|
const oc = value_2(matchValue_2);
|
|
69
68
|
const ioType_2 = value_2(oc.Header.TryOutput());
|
|
70
|
-
|
|
69
|
+
ResizeArray_iter((c_1) => {
|
|
71
70
|
includeInMap(c_1.ToFreeTextCell().AsFreeText, ioType_2);
|
|
72
|
-
});
|
|
71
|
+
}, oc.Cells);
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
74
|
}
|
|
@@ -89,7 +88,7 @@ export function ArcTablesAux_applyIOMap(map, tables) {
|
|
|
89
88
|
else {
|
|
90
89
|
const ic = value_2(matchValue);
|
|
91
90
|
const index = findIndex((x) => x.isInput, table.Headers) | 0;
|
|
92
|
-
const newIOType =
|
|
91
|
+
const newIOType = ResizeArray_fold((io, c) => {
|
|
93
92
|
const matchValue_1 = Dictionary_tryFind(c.ToFreeTextCell().AsFreeText, map);
|
|
94
93
|
if (matchValue_1 == null) {
|
|
95
94
|
return io;
|
|
@@ -107,7 +106,7 @@ export function ArcTablesAux_applyIOMap(map, tables) {
|
|
|
107
106
|
else {
|
|
108
107
|
const oc = value_2(matchValue_2);
|
|
109
108
|
const index_1 = findIndex((x_1) => x_1.isOutput, table.Headers) | 0;
|
|
110
|
-
const newIOType_1 =
|
|
109
|
+
const newIOType_1 = ResizeArray_fold((io_1, c_1) => {
|
|
111
110
|
const matchValue_3 = Dictionary_tryFind(c_1.ToFreeTextCell().AsFreeText, map);
|
|
112
111
|
if (matchValue_3 == null) {
|
|
113
112
|
return io_1;
|
|
@@ -408,16 +407,13 @@ export class ArcTables {
|
|
|
408
407
|
this$.Tables.splice(newIndex, 0, table);
|
|
409
408
|
}
|
|
410
409
|
static updateReferenceTablesBySheets(referenceTables, sheetTables, keepUnusedRefTables) {
|
|
411
|
-
let collection, s,
|
|
410
|
+
let collection, s, a;
|
|
412
411
|
const keepUnusedRefTables_1 = defaultArg(keepUnusedRefTables, false);
|
|
413
412
|
const usedTables = new Set([]);
|
|
414
|
-
const referenceTableMap = ofSeq_1(choose((t) => map_2((c) => [
|
|
413
|
+
const referenceTableMap = ofSeq_1(choose((t) => map_2((c) => [c.Cells[0].AsFreeText, t], t.TryGetProtocolNameColumn()), referenceTables.Tables), {
|
|
415
414
|
Compare: comparePrimitives,
|
|
416
415
|
});
|
|
417
|
-
return new ArcTables((collection = ((s =
|
|
418
|
-
Unchecked_fillMissingCells(t_3.Headers, t_3.Values);
|
|
419
|
-
return t_3;
|
|
420
|
-
}, map_3((tupledArg) => reduce((table, table_1) => ArcTable.append(table, table_1), tupledArg[1]), Array_groupBy((t_2) => t_2.Name, map_3((t_1) => {
|
|
416
|
+
return new ArcTables((collection = ((s = ResizeArray_map((tupledArg) => reduce((table, table_1) => ArcTable.append(table, table_1), tupledArg[1]), ResizeArray_groupBy((t_2) => t_2.Name, ResizeArray_map((t_1) => {
|
|
421
417
|
const k = defaultArg(bind((c_1) => {
|
|
422
418
|
if (c_1.AsFreeText === "") {
|
|
423
419
|
return undefined;
|
|
@@ -434,12 +430,9 @@ export class ArcTables {
|
|
|
434
430
|
const rt = value_2(matchValue);
|
|
435
431
|
addToSet(k, usedTables);
|
|
436
432
|
const updatedTable = ArcTable.updateReferenceByAnnotationTable(rt, t_1);
|
|
437
|
-
return ArcTable.
|
|
433
|
+
return ArcTable.fromArcTableValues(t_1.Name, updatedTable.Headers, updatedTable.Values);
|
|
438
434
|
}
|
|
439
|
-
}, (
|
|
440
|
-
Equals: (x_2, y_1) => (x_2 === y_1),
|
|
441
|
-
GetHashCode: stringHash,
|
|
442
|
-
}))), keepUnusedRefTables_1 ? append(choose((kv) => {
|
|
435
|
+
}, (a = sheetTables.Tables, ResizeArray_collect(ArcTable.SplitByProtocolREF, a))))), keepUnusedRefTables_1 ? append(choose((kv) => {
|
|
443
436
|
if (usedTables.has(kv[0])) {
|
|
444
437
|
return undefined;
|
|
445
438
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { unwrap, defaultArg } from "@fable-org/fable-library-js/Option.js";
|
|
2
2
|
import { CompositeHeader_$reflection } from "./CompositeHeader.js";
|
|
3
3
|
import { CompositeCell_$reflection, CompositeCell } from "./CompositeCell.js";
|
|
4
|
-
import { fold, empty, singleton, collect, delay, toArray, exists } from "@fable-org/fable-library-js/Seq.js";
|
|
4
|
+
import { fold, isEmpty, empty, singleton, collect, delay, toArray, exists } from "@fable-org/fable-library-js/Seq.js";
|
|
5
5
|
import { Record } from "@fable-org/fable-library-js/Types.js";
|
|
6
6
|
import { record_type, array_type } from "@fable-org/fable-library-js/Reflection.js";
|
|
7
7
|
export class CompositeColumn extends Record {
|
|
@@ -19,8 +19,10 @@ export class CompositeColumn extends Record {
|
|
|
19
19
|
}
|
|
20
20
|
TryGetColumnUnits() {
|
|
21
21
|
const this$ = this;
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
let arr;
|
|
23
|
+
const collection = toArray(delay(() => collect((cell) => (cell.isUnitized ? singleton(cell.AsUnitized[1]) : empty()), this$.Cells)));
|
|
24
|
+
arr = Array.from(collection);
|
|
25
|
+
return isEmpty(arr) ? undefined : arr;
|
|
24
26
|
}
|
|
25
27
|
GetDefaultEmptyCell() {
|
|
26
28
|
const this$ = this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const dga = "**/dataset/**";
|
|
1
|
+
export const dga = "**/dataset/** filter=lfs diff=lfs merge=lfs -text";
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { ErrorReason$1_BadOneOf, ErrorReason$1_BadPrimitive, ErrorReason$1_FailMessage } from "../fable_modules/Thoth.Json.Core.0.4.0/Types.fs.js";
|
|
2
|
-
import { Getters$2__get_Errors, Getters$2_$ctor_Z4BE6C149, string } from "../fable_modules/Thoth.Json.Core.0.4.0/Decode.fs.js";
|
|
2
|
+
import { int, tuple2, Getters$2__get_Errors, Getters$2_$ctor_Z4BE6C149, string } from "../fable_modules/Thoth.Json.Core.0.4.0/Decode.fs.js";
|
|
3
3
|
import { Result_Map, FSharpResult$2_Ok, FSharpResult$2_Error } from "@fable-org/fable-library-js/Result.js";
|
|
4
4
|
import { printf, toText } from "@fable-org/fable-library-js/String.js";
|
|
5
5
|
import { exists } from "@fable-org/fable-library-js/Seq.js";
|
|
6
6
|
import { ofSeq, contains } from "@fable-org/fable-library-js/Set.js";
|
|
7
|
-
import { int32ToString, comparePrimitives } from "@fable-org/fable-library-js/Util.js";
|
|
8
|
-
import { head, length, isEmpty } from "@fable-org/fable-library-js/List.js";
|
|
7
|
+
import { structuralHash, equals, int32ToString, comparePrimitives } from "@fable-org/fable-library-js/Util.js";
|
|
8
|
+
import { tail, cons, empty, head, length, isEmpty } from "@fable-org/fable-library-js/List.js";
|
|
9
9
|
import { fold } from "@fable-org/fable-library-js/Array.js";
|
|
10
10
|
import { tryParse, minValue } from "@fable-org/fable-library-js/Date.js";
|
|
11
11
|
import { FSharpRef } from "@fable-org/fable-library-js/Types.js";
|
|
12
|
+
import { Dictionary } from "@fable-org/fable-library-js/MutableMap.js";
|
|
13
|
+
import { addToDict } from "@fable-org/fable-library-js/MapUtil.js";
|
|
12
14
|
export function Helpers_prependPath(path, err_, err__1) {
|
|
13
15
|
const err = [err_, err__1];
|
|
14
16
|
return [path + err[0], err[1]];
|
|
@@ -115,3 +117,103 @@ export const Decode_datetime = {
|
|
|
115
117
|
}
|
|
116
118
|
},
|
|
117
119
|
};
|
|
120
|
+
export function Decode_dictionary(keyDecoder, valueDecoder) {
|
|
121
|
+
return {
|
|
122
|
+
Decode(helpers, value) {
|
|
123
|
+
if (helpers.isArray(value)) {
|
|
124
|
+
let errors = empty();
|
|
125
|
+
const tokens = helpers.asArray(value);
|
|
126
|
+
const dict = new Dictionary([], {
|
|
127
|
+
Equals: equals,
|
|
128
|
+
GetHashCode: structuralHash,
|
|
129
|
+
});
|
|
130
|
+
const decoder = tuple2(keyDecoder, valueDecoder);
|
|
131
|
+
return fold((acc, value_1) => {
|
|
132
|
+
if (acc.tag === /* Ok */ 0) {
|
|
133
|
+
const acc_1 = acc.fields[0];
|
|
134
|
+
const matchValue = decoder.Decode(helpers, value_1);
|
|
135
|
+
if (matchValue.tag === /* Ok */ 0) {
|
|
136
|
+
const tupledArg = matchValue.fields[0];
|
|
137
|
+
addToDict(acc_1, tupledArg[0], tupledArg[1]);
|
|
138
|
+
return FSharpResult$2_Ok(acc_1);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
return FSharpResult$2_Error(matchValue.fields[0]);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
return acc;
|
|
146
|
+
}
|
|
147
|
+
}, FSharpResult$2_Ok(dict), tokens);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
return FSharpResult$2_Error(["", ErrorReason$1_BadPrimitive("an object", value)]);
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
export function Decode_intDictionary(valueDecoder) {
|
|
156
|
+
return {
|
|
157
|
+
Decode(helpers, value) {
|
|
158
|
+
if (helpers.isArray(value)) {
|
|
159
|
+
let errors = empty();
|
|
160
|
+
const tokens = helpers.asArray(value);
|
|
161
|
+
const dict = new Map([]);
|
|
162
|
+
const decoder = tuple2(int, valueDecoder);
|
|
163
|
+
return fold((acc, value_1) => {
|
|
164
|
+
if (acc.tag === /* Ok */ 0) {
|
|
165
|
+
const acc_1 = acc.fields[0];
|
|
166
|
+
const matchValue = decoder.Decode(helpers, value_1);
|
|
167
|
+
if (matchValue.tag === /* Ok */ 0) {
|
|
168
|
+
const tupledArg = matchValue.fields[0];
|
|
169
|
+
addToDict(acc_1, tupledArg[0], tupledArg[1]);
|
|
170
|
+
return FSharpResult$2_Ok(acc_1);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
return FSharpResult$2_Error(matchValue.fields[0]);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
return acc;
|
|
178
|
+
}
|
|
179
|
+
}, FSharpResult$2_Ok(dict), tokens);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
return FSharpResult$2_Error(["", ErrorReason$1_BadPrimitive("an object", value)]);
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
export function Decode_tryOneOf(decoders) {
|
|
188
|
+
return {
|
|
189
|
+
Decode(helpers, value) {
|
|
190
|
+
const loop = (errors_mut, decoders_1_mut) => {
|
|
191
|
+
loop: while (true) {
|
|
192
|
+
const errors = errors_mut, decoders_1 = decoders_1_mut;
|
|
193
|
+
if (!isEmpty(decoders_1)) {
|
|
194
|
+
let decodingResult;
|
|
195
|
+
try {
|
|
196
|
+
decodingResult = head(decoders_1).Decode(helpers, value);
|
|
197
|
+
}
|
|
198
|
+
catch (e) {
|
|
199
|
+
decodingResult = FSharpResult$2_Error(["", ErrorReason$1_FailMessage(e.message)]);
|
|
200
|
+
}
|
|
201
|
+
if (decodingResult.tag === /* Error */ 1) {
|
|
202
|
+
errors_mut = cons(decodingResult.fields[0], errors);
|
|
203
|
+
decoders_1_mut = tail(decoders_1);
|
|
204
|
+
continue loop;
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
return FSharpResult$2_Ok(decodingResult.fields[0]);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
return FSharpResult$2_Error(["", ErrorReason$1_BadOneOf(errors)]);
|
|
212
|
+
}
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
return loop(empty(), decoders);
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { defaultArg, value as value_2, map } from "@fable-org/fable-library-js/Option.js";
|
|
2
2
|
import { Json_Object } from "../fable_modules/Thoth.Json.Core.0.4.0/Types.fs.js";
|
|
3
|
-
import { append, map as map_1, isEmpty } from "@fable-org/fable-library-js/Seq.js";
|
|
4
|
-
import { list as list_1, seq } from "../fable_modules/Thoth.Json.Core.0.4.0/Encode.fs.js";
|
|
3
|
+
import { toArray, append, map as map_1, isEmpty } from "@fable-org/fable-library-js/Seq.js";
|
|
4
|
+
import { tuple2, list as list_1, seq } from "../fable_modules/Thoth.Json.Core.0.4.0/Encode.fs.js";
|
|
5
5
|
import { item, map as map_2 } from "@fable-org/fable-library-js/Array.js";
|
|
6
6
|
import { map as map_3, isEmpty as isEmpty_1 } from "@fable-org/fable-library-js/List.js";
|
|
7
7
|
import { toString } from "@fable-org/fable-library-js/Date.js";
|
|
8
|
+
import { count } from "@fable-org/fable-library-js/CollectionUtil.js";
|
|
9
|
+
import { printf, toFail } from "@fable-org/fable-library-js/String.js";
|
|
8
10
|
/**
|
|
9
11
|
* Try to encode the given object using the given encoder, or return Encode.nil if the object is null
|
|
10
12
|
*/
|
|
@@ -61,3 +63,41 @@ export function resizeArrayOrSingleton(encoder, values) {
|
|
|
61
63
|
return seq(map_1(encoder, values));
|
|
62
64
|
}
|
|
63
65
|
}
|
|
66
|
+
export function dictionary(keyEncoder, valueEncoder, values) {
|
|
67
|
+
if (count(values) === 0) {
|
|
68
|
+
return {
|
|
69
|
+
Encode(helpers) {
|
|
70
|
+
return helpers.encodeNull();
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
return seq(toArray(map_1((_arg) => {
|
|
76
|
+
const activePatternResult = _arg;
|
|
77
|
+
return tuple2(keyEncoder, valueEncoder, activePatternResult[0], activePatternResult[1]);
|
|
78
|
+
}, values)));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export function intDictionary(valueEncoder, values) {
|
|
82
|
+
if (count(values) === 0) {
|
|
83
|
+
return {
|
|
84
|
+
Encode(helpers) {
|
|
85
|
+
return helpers.encodeNull();
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
return seq(toArray(map_1((_arg) => {
|
|
91
|
+
const activePatternResult = _arg;
|
|
92
|
+
const k = activePatternResult[0] | 0;
|
|
93
|
+
if ((k > 2147483647) ? true : (k < -2147483648)) {
|
|
94
|
+
toFail(printf("Key %d is out of bounds for Int32"))(k);
|
|
95
|
+
}
|
|
96
|
+
return tuple2((value) => ({
|
|
97
|
+
Encode(helpers_1) {
|
|
98
|
+
return helpers_1.encodeSignedIntegralNumber(value);
|
|
99
|
+
},
|
|
100
|
+
}), valueEncoder, k, activePatternResult[1]);
|
|
101
|
+
}, values)));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -1,126 +1,99 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { int32ToString, disposeSafe, getEnumerator, arrayHash, equalArrays, compareArrays } from "@fable-org/fable-library-js/Util.js";
|
|
2
|
+
import { decoder as decoder_3, encoder as encoder_1 } from "./CompositeCell.js";
|
|
3
|
+
import { getItemFromDict } from "@fable-org/fable-library-js/MapUtil.js";
|
|
2
4
|
import { ErrorReason$1_BadPrimitive } from "../../fable_modules/Thoth.Json.Core.0.4.0/Types.fs.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { decoder as decoder_2, encoder as encoder_2 } from "./
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { empty, map, singleton, append, delay, toList } from "@fable-org/fable-library-js/Seq.js";
|
|
6
|
+
import { list } from "../../fable_modules/Thoth.Json.Core.0.4.0/Encode.fs.js";
|
|
7
|
+
import { decoder as decoder_2, encoder as encoder_2 } from "./CompositeHeader.js";
|
|
8
|
+
import { intDictionary } from "../Encode.js";
|
|
9
|
+
import { Unchecked_setCellAt, ArcTableValues, ColumnValueRefs_Sparse, ColumnValueRefs_Constant, ensureCellHashInValueMap } from "../../Core/Table/ArcTableAux.js";
|
|
8
10
|
import { ArcTable } from "../../Core/Table/ArcTable.js";
|
|
9
|
-
import { Helpers_prependPath, array as
|
|
11
|
+
import { Helpers_prependPath, array as array_1, resizeArray, map as map_1, string, int, tuple2, map$0027, list as list_1, object } from "../../fable_modules/Thoth.Json.Core.0.4.0/Decode.fs.js";
|
|
10
12
|
import { defaultArg } from "@fable-org/fable-library-js/Option.js";
|
|
11
|
-
import { empty as empty_1 } from "@fable-org/fable-library-js/List.js";
|
|
13
|
+
import { ofArray, empty as empty_1 } from "@fable-org/fable-library-js/List.js";
|
|
12
14
|
import { Dictionary } from "@fable-org/fable-library-js/MutableMap.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { rangeDouble } from "@fable-org/fable-library-js/Range.js";
|
|
16
|
-
import { fill, setItem, fold, iterateIndexed, map as map_2 } from "@fable-org/fable-library-js/Array.js";
|
|
15
|
+
import { empty as empty_2 } from "@fable-org/fable-library-js/Map.js";
|
|
16
|
+
import { Decode_dictionary, Decode_intDictionary, Decode_tryOneOf } from "../Decode.js";
|
|
17
17
|
import { FSharpResult$2_Ok, FSharpResult$2_Error } from "@fable-org/fable-library-js/Result.js";
|
|
18
|
+
import { encodeCell, decodeCell } from "./CellTable.js";
|
|
19
|
+
import { item, fill, setItem, fold, iterateIndexed } from "@fable-org/fable-library-js/Array.js";
|
|
18
20
|
import { decodeString, encodeString } from "../StringTable.js";
|
|
19
21
|
export function encoder(table) {
|
|
22
|
+
const valueMap = table.Values.ValueMap;
|
|
23
|
+
const cellEncoder = (hash) => encoder_1(getItemFromDict(valueMap, hash));
|
|
20
24
|
const values = toList(delay(() => {
|
|
21
|
-
let
|
|
22
|
-
return append(singleton(["name", (
|
|
23
|
-
Encode(helpers_2) {
|
|
24
|
-
return helpers_2.encodeString(value_4);
|
|
25
|
-
},
|
|
26
|
-
})]), delay(() => append((table.Headers.length !== 0) ? singleton(["header", list(toList(delay(() => map(encoder_1, table.Headers))))]) : empty(), delay(() => ((table.Values.size !== 0) ? singleton(["values", map_1((tupledArg) => tuple2((value) => ({
|
|
25
|
+
let value;
|
|
26
|
+
return append(singleton(["name", (value = table.Name, {
|
|
27
27
|
Encode(helpers) {
|
|
28
|
-
return helpers.
|
|
28
|
+
return helpers.encodeString(value);
|
|
29
29
|
},
|
|
30
|
-
}), (
|
|
31
|
-
|
|
32
|
-
return
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, table.Values))
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
})]), delay(() => append((table.Headers.length !== 0) ? singleton(["headers", list(toList(delay(() => map(encoder_2, table.Headers))))]) : empty(), delay(() => ((table.Values.RowCount !== 0) ? append(singleton(["columns", intDictionary((col) => {
|
|
31
|
+
if (col.tag === /* Sparse */ 1) {
|
|
32
|
+
return intDictionary(cellEncoder, col.fields[0]);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return cellEncoder(col.fields[0]);
|
|
36
|
+
}
|
|
37
|
+
}, table.Values.Columns)]), delay(() => {
|
|
38
|
+
let value_1;
|
|
39
|
+
return singleton(["rowCount", (value_1 = (table.RowCount | 0), {
|
|
40
|
+
Encode(helpers_1) {
|
|
41
|
+
return helpers_1.encodeSignedIntegralNumber(value_1);
|
|
42
|
+
},
|
|
43
|
+
})]);
|
|
44
|
+
})) : empty())))));
|
|
40
45
|
}));
|
|
41
46
|
return {
|
|
42
|
-
Encode(
|
|
43
|
-
const arg = map((
|
|
44
|
-
return
|
|
47
|
+
Encode(helpers_2) {
|
|
48
|
+
const arg = map((tupledArg) => [tupledArg[0], tupledArg[1].Encode(helpers_2)], values);
|
|
49
|
+
return helpers_2.encodeObject(arg);
|
|
45
50
|
},
|
|
46
51
|
};
|
|
47
52
|
}
|
|
48
|
-
export const
|
|
53
|
+
export const decoderV2Deprecated = object((get$) => {
|
|
49
54
|
let arg_1, objectArg, arg_3, objectArg_1, objectArg_2;
|
|
50
55
|
let decodedHeader;
|
|
51
|
-
const collection = defaultArg((arg_1 = list_1(
|
|
56
|
+
const collection = defaultArg((arg_1 = list_1(decoder_2), (objectArg = get$.Optional, objectArg.Field("header", arg_1))), empty_1());
|
|
52
57
|
decodedHeader = Array.from(collection);
|
|
53
|
-
const decodedValues = new Dictionary(defaultArg((arg_3 = map$0027(
|
|
58
|
+
const decodedValues = new Dictionary(defaultArg((arg_3 = map$0027(tuple2(int, int), decoder_3), (objectArg_1 = get$.Optional, objectArg_1.Field("values", arg_3))), empty_2({
|
|
54
59
|
Compare: compareArrays,
|
|
55
60
|
})), {
|
|
56
61
|
Equals: equalArrays,
|
|
57
62
|
GetHashCode: arrayHash,
|
|
58
63
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const arg = map_2((v) => v.Encode(helpers), values);
|
|
67
|
-
return helpers.encodeArray(arg);
|
|
68
|
-
},
|
|
69
|
-
};
|
|
64
|
+
const t = ArcTable.create((objectArg_2 = get$.Required, objectArg_2.Field("name", string)), decodedHeader, []);
|
|
65
|
+
let enumerator = getEnumerator(decodedValues);
|
|
66
|
+
try {
|
|
67
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
68
|
+
const activePatternResult = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
69
|
+
t.SetCellAt(activePatternResult[0][0], activePatternResult[0][1], activePatternResult[1]);
|
|
70
|
+
}
|
|
70
71
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
let from = 0;
|
|
74
|
-
const values_3 = toArray(delay(() => append(collect((i) => {
|
|
75
|
-
let values_1, value, value_1;
|
|
76
|
-
const next = getItemFromDict(table.Values, [columnIndex, i]);
|
|
77
|
-
return !equals(next, current) ? append(singleton((values_1 = [["f", (value = (from | 0), {
|
|
78
|
-
Encode(helpers_1) {
|
|
79
|
-
return helpers_1.encodeSignedIntegralNumber(value);
|
|
80
|
-
},
|
|
81
|
-
})], ["t", (value_1 = ((i - 1) | 0), {
|
|
82
|
-
Encode(helpers_2) {
|
|
83
|
-
return helpers_2.encodeSignedIntegralNumber(value_1);
|
|
84
|
-
},
|
|
85
|
-
})], ["v", encodeCell(cellTable, current)]], {
|
|
86
|
-
Encode(helpers_3) {
|
|
87
|
-
const arg_1 = map((tupledArg) => [tupledArg[0], tupledArg[1].Encode(helpers_3)], values_1);
|
|
88
|
-
return helpers_3.encodeObject(arg_1);
|
|
89
|
-
},
|
|
90
|
-
})), delay(() => {
|
|
91
|
-
current = next;
|
|
92
|
-
from = (i | 0);
|
|
93
|
-
return empty();
|
|
94
|
-
})) : empty();
|
|
95
|
-
}, rangeDouble(1, 1, rowCount - 1)), delay(() => {
|
|
96
|
-
let values_2, value_2, value_3;
|
|
97
|
-
return singleton((values_2 = [["f", (value_2 = (from | 0), {
|
|
98
|
-
Encode(helpers_4) {
|
|
99
|
-
return helpers_4.encodeSignedIntegralNumber(value_2);
|
|
100
|
-
},
|
|
101
|
-
})], ["t", (value_3 = ((rowCount - 1) | 0), {
|
|
102
|
-
Encode(helpers_5) {
|
|
103
|
-
return helpers_5.encodeSignedIntegralNumber(value_3);
|
|
104
|
-
},
|
|
105
|
-
})], ["v", encodeCell(cellTable, current)]], {
|
|
106
|
-
Encode(helpers_6) {
|
|
107
|
-
const arg_2 = map((tupledArg_1) => [tupledArg_1[0], tupledArg_1[1].Encode(helpers_6)], values_2);
|
|
108
|
-
return helpers_6.encodeObject(arg_2);
|
|
109
|
-
},
|
|
110
|
-
}));
|
|
111
|
-
}))));
|
|
112
|
-
return {
|
|
113
|
-
Encode(helpers_7) {
|
|
114
|
-
const arg_3 = map_2((v_3) => v_3.Encode(helpers_7), values_3);
|
|
115
|
-
return helpers_7.encodeArray(arg_3);
|
|
116
|
-
},
|
|
117
|
-
};
|
|
72
|
+
finally {
|
|
73
|
+
disposeSafe(enumerator);
|
|
118
74
|
}
|
|
119
|
-
|
|
75
|
+
return t;
|
|
76
|
+
});
|
|
77
|
+
export const decoder = (() => {
|
|
78
|
+
const valueMap = new Map([]);
|
|
79
|
+
const cellDecoder = map_1((cell) => ensureCellHashInValueMap(cell, valueMap), decoder_3);
|
|
80
|
+
const columnDecoder = Decode_tryOneOf(ofArray([map_1(ColumnValueRefs_Constant, cellDecoder), map_1(ColumnValueRefs_Sparse, Decode_intDictionary(cellDecoder))]));
|
|
81
|
+
const decoder_1 = object((get$) => {
|
|
82
|
+
let arg_1, objectArg, arg_3, objectArg_1, objectArg_2, objectArg_3;
|
|
83
|
+
const decodedHeader = defaultArg((arg_1 = resizeArray(decoder_2), (objectArg = get$.Optional, objectArg.Field("headers", arg_1))), []);
|
|
84
|
+
const values = new ArcTableValues(defaultArg((arg_3 = Decode_dictionary(int, columnDecoder), (objectArg_1 = get$.Optional, objectArg_1.Field("columns", arg_3))), new Map([])), valueMap, defaultArg((objectArg_2 = get$.Optional, objectArg_2.Field("rowCount", int)), 0));
|
|
85
|
+
return ArcTable.fromArcTableValues((objectArg_3 = get$.Required, objectArg_3.Field("name", string)), decodedHeader, values);
|
|
86
|
+
});
|
|
87
|
+
return {
|
|
88
|
+
Decode(helper, column) {
|
|
89
|
+
return helper.hasProperty("values", column) ? decoderV2Deprecated.Decode(helper, column) : decoder_1.Decode(helper, column);
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
})();
|
|
120
93
|
export function decoderCompressedColumn(cellTable, table, columnIndex) {
|
|
121
94
|
return {
|
|
122
95
|
Decode(helper, column) {
|
|
123
|
-
const matchValue =
|
|
96
|
+
const matchValue = array_1(decodeCell(cellTable)).Decode(helper, column);
|
|
124
97
|
if (matchValue.tag === /* Error */ 1) {
|
|
125
98
|
const err = matchValue.fields[0];
|
|
126
99
|
const rangeDecoder = object((get$) => {
|
|
@@ -135,15 +108,15 @@ export function decoderCompressedColumn(cellTable, table, columnIndex) {
|
|
|
135
108
|
const objectArg_2 = get$.Required;
|
|
136
109
|
value = objectArg_2.Field("v", arg_5);
|
|
137
110
|
for (let i = from; i <= to_; i++) {
|
|
138
|
-
|
|
111
|
+
Unchecked_setCellAt(columnIndex, i, value, table.Values);
|
|
139
112
|
}
|
|
140
113
|
});
|
|
141
|
-
const matchValue_1 =
|
|
114
|
+
const matchValue_1 = array_1(rangeDecoder).Decode(helper, column);
|
|
142
115
|
return (matchValue_1.tag === /* Error */ 1) ? FSharpResult$2_Error(matchValue_1.fields[0]) : FSharpResult$2_Ok(undefined);
|
|
143
116
|
}
|
|
144
117
|
else {
|
|
145
118
|
iterateIndexed((r, cell) => {
|
|
146
|
-
|
|
119
|
+
Unchecked_setCellAt(columnIndex, r, cell, table.Values);
|
|
147
120
|
}, matchValue.fields[0]);
|
|
148
121
|
return FSharpResult$2_Ok(undefined);
|
|
149
122
|
}
|
|
@@ -183,39 +156,53 @@ export function arrayi(decoderi) {
|
|
|
183
156
|
};
|
|
184
157
|
}
|
|
185
158
|
export function encoderCompressed(stringTable, oaTable, cellTable, table) {
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
159
|
+
const cellEncoder = (hash) => encodeCell(cellTable, getItemFromDict(table.Values.ValueMap, hash));
|
|
160
|
+
const values = toList(delay(() => append(singleton(["n", encodeString(stringTable, table.Name)]), delay(() => append((table.Headers.length !== 0) ? singleton(["h", list(toList(delay(() => map(encoder_2, table.Headers))))]) : empty(), delay(() => ((table.Values.RowCount !== 0) ? append(singleton(["c", intDictionary((col) => {
|
|
161
|
+
if (col.tag === /* Sparse */ 1) {
|
|
162
|
+
return intDictionary(cellEncoder, col.fields[0]);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
return cellEncoder(col.fields[0]);
|
|
166
|
+
}
|
|
167
|
+
}, table.Values.Columns)]), delay(() => {
|
|
168
|
+
let value;
|
|
169
|
+
return singleton(["r", (value = (table.RowCount | 0), {
|
|
170
|
+
Encode(helpers) {
|
|
171
|
+
return helpers.encodeSignedIntegralNumber(value);
|
|
172
|
+
},
|
|
173
|
+
})]);
|
|
174
|
+
})) : empty())))))));
|
|
201
175
|
return {
|
|
202
176
|
Encode(helpers_1) {
|
|
203
|
-
const
|
|
204
|
-
return helpers_1.encodeObject(
|
|
177
|
+
const arg = map((tupledArg) => [tupledArg[0], tupledArg[1].Encode(helpers_1)], values);
|
|
178
|
+
return helpers_1.encodeObject(arg);
|
|
205
179
|
},
|
|
206
180
|
};
|
|
207
181
|
}
|
|
208
|
-
export function
|
|
182
|
+
export function decoderCompressedV2Deprecated(stringTable, oaTable, cellTable) {
|
|
209
183
|
return object((get$) => {
|
|
210
184
|
let arg_1, objectArg, arg_3, objectArg_1, arg_5, objectArg_2;
|
|
211
185
|
let decodedHeader;
|
|
212
|
-
const collection = defaultArg((arg_1 = list_1(
|
|
186
|
+
const collection = defaultArg((arg_1 = list_1(decoder_2), (objectArg = get$.Optional, objectArg.Field("h", arg_1))), empty_1());
|
|
213
187
|
decodedHeader = Array.from(collection);
|
|
214
|
-
const table = ArcTable.create((arg_3 = decodeString(stringTable), (objectArg_1 = get$.Required, objectArg_1.Field("n", arg_3))), decodedHeader,
|
|
215
|
-
Equals: equalArrays,
|
|
216
|
-
GetHashCode: arrayHash,
|
|
217
|
-
}));
|
|
188
|
+
const table = ArcTable.create((arg_3 = decodeString(stringTable), (objectArg_1 = get$.Required, objectArg_1.Field("n", arg_3))), decodedHeader, []);
|
|
218
189
|
(arg_5 = arrayi((columnIndex) => decoderCompressedColumn(cellTable, table, columnIndex)), (objectArg_2 = get$.Optional, objectArg_2.Field("c", arg_5)));
|
|
219
190
|
return table;
|
|
220
191
|
});
|
|
221
192
|
}
|
|
193
|
+
export function decoderCompressed(stringTable, oaTable, cellTable) {
|
|
194
|
+
const valueMap = new Map([]);
|
|
195
|
+
const cellDecoder = map_1((i) => ensureCellHashInValueMap(item(i, cellTable), valueMap), int);
|
|
196
|
+
const columnDecoder = Decode_tryOneOf(ofArray([map_1(ColumnValueRefs_Constant, cellDecoder), map_1(ColumnValueRefs_Sparse, Decode_intDictionary(cellDecoder))]));
|
|
197
|
+
const decoder_1 = object((get$) => {
|
|
198
|
+
let arg_1, objectArg, arg_3, objectArg_1, objectArg_2, arg_7, objectArg_3;
|
|
199
|
+
const decodedHeader = defaultArg((arg_1 = resizeArray(decoder_2), (objectArg = get$.Optional, objectArg.Field("h", arg_1))), []);
|
|
200
|
+
const values = new ArcTableValues(defaultArg((arg_3 = Decode_dictionary(int, columnDecoder), (objectArg_1 = get$.Optional, objectArg_1.Field("c", arg_3))), new Map([])), valueMap, defaultArg((objectArg_2 = get$.Optional, objectArg_2.Field("r", int)), 0));
|
|
201
|
+
return ArcTable.fromArcTableValues((arg_7 = decodeString(stringTable), (objectArg_3 = get$.Required, objectArg_3.Field("n", arg_7))), decodedHeader, values);
|
|
202
|
+
});
|
|
203
|
+
return {
|
|
204
|
+
Decode(helper, column) {
|
|
205
|
+
return !helper.hasProperty("r", column) ? decoderCompressedV2Deprecated(stringTable, oaTable, cellTable).Decode(helper, column) : decoder_1.Decode(helper, column);
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
}
|