@nfdi4plants/arctrl 1.0.7 → 1.2.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.
- package/ARC.js +47 -11
- package/Contract/Contract.js +3 -3
- package/Contracts/Contracts.ArcTypes.js +30 -18
- package/Contracts/Contracts.Git.js +4 -4
- package/FileSystem/Commit.js +2 -2
- package/FileSystem/FileSystem.js +4 -4
- package/FileSystem/FileSystemTree.js +8 -8
- package/FileSystem/Path.js +2 -2
- package/FileSystemTree.js +1 -1
- package/ISA/ISA/ArcTypes/ArcTable.js +23 -31
- package/ISA/ISA/ArcTypes/ArcTableAux.js +27 -16
- package/ISA/ISA/ArcTypes/ArcTables.js +11 -11
- package/ISA/ISA/ArcTypes/ArcTypes.js +118 -83
- package/ISA/ISA/ArcTypes/CompositeCell.js +4 -4
- package/ISA/ISA/ArcTypes/CompositeColumn.js +8 -7
- package/ISA/ISA/ArcTypes/CompositeHeader.js +5 -5
- package/ISA/ISA/ArcTypes/CompositeRow.js +1 -1
- package/ISA/ISA/Builder/Types.js +5 -5
- package/ISA/ISA/Fable.js +6 -6
- package/ISA/ISA/Helper.js +15 -13
- package/ISA/ISA/Identifier.js +1 -1
- package/ISA/ISA/JsonTypes/Assay.js +8 -8
- package/ISA/ISA/JsonTypes/AssayMaterials.js +4 -4
- package/ISA/ISA/JsonTypes/ColumnIndex.js +5 -5
- package/ISA/ISA/JsonTypes/Comment.js +3 -3
- package/ISA/ISA/JsonTypes/CommentList.js +4 -4
- package/ISA/ISA/JsonTypes/Component.js +4 -4
- package/ISA/ISA/JsonTypes/Data.js +4 -4
- package/ISA/ISA/JsonTypes/DataFile.js +2 -2
- package/ISA/ISA/JsonTypes/Factor.js +6 -6
- package/ISA/ISA/JsonTypes/FactorValue.js +5 -5
- package/ISA/ISA/JsonTypes/Investigation.js +6 -6
- package/ISA/ISA/JsonTypes/Material.js +5 -5
- package/ISA/ISA/JsonTypes/MaterialAttribute.js +3 -3
- package/ISA/ISA/JsonTypes/MaterialAttributeValue.js +5 -5
- package/ISA/ISA/JsonTypes/MaterialType.js +2 -2
- package/ISA/ISA/JsonTypes/OntologyAnnotation.js +6 -6
- package/ISA/ISA/JsonTypes/OntologySourceReference.js +6 -6
- package/ISA/ISA/JsonTypes/Person.js +23 -8
- package/ISA/ISA/JsonTypes/Process.js +13 -13
- package/ISA/ISA/JsonTypes/ProcessInput.js +5 -5
- package/ISA/ISA/JsonTypes/ProcessOutput.js +5 -5
- package/ISA/ISA/JsonTypes/ProcessParameterValue.js +5 -5
- package/ISA/ISA/JsonTypes/ProcessSequence.js +6 -6
- package/ISA/ISA/JsonTypes/Protocol.js +6 -6
- package/ISA/ISA/JsonTypes/ProtocolParameter.js +3 -3
- package/ISA/ISA/JsonTypes/Publication.js +6 -6
- package/ISA/ISA/JsonTypes/Sample.js +5 -5
- package/ISA/ISA/JsonTypes/Source.js +5 -5
- package/ISA/ISA/JsonTypes/Study.js +8 -8
- package/ISA/ISA/JsonTypes/StudyMaterials.js +4 -4
- package/ISA/ISA/JsonTypes/Value.js +22 -29
- package/ISA/ISA/Regex.js +3 -3
- package/ISA/ISA.Json/ArcTypes/ArcAssay.js +157 -65
- package/ISA/ISA.Json/ArcTypes/ArcInvestigation.js +78 -49
- package/ISA/ISA.Json/ArcTypes/ArcStudy.js +136 -24
- package/ISA/ISA.Json/ArcTypes/ArcTable.js +183 -21
- package/ISA/ISA.Json/ArcTypes/CellTable.js +40 -0
- package/ISA/ISA.Json/ArcTypes/CompositeCell.js +34 -23
- package/ISA/ISA.Json/ArcTypes/CompositeHeader.js +18 -46
- package/ISA/ISA.Json/ArcTypes/IOType.js +11 -13
- package/ISA/ISA.Json/ArcTypes/OATable.js +42 -0
- package/ISA/ISA.Json/Assay.js +71 -47
- package/ISA/ISA.Json/Comment.js +31 -35
- package/ISA/ISA.Json/ConverterOptions.js +19 -1
- package/ISA/ISA.Json/Data.js +119 -137
- package/ISA/ISA.Json/Decode.js +51 -36
- package/ISA/ISA.Json/Factor.js +90 -90
- package/ISA/ISA.Json/GEncode.js +31 -6
- package/ISA/ISA.Json/Investigation.js +54 -79
- package/ISA/ISA.Json/Material.js +103 -104
- package/ISA/ISA.Json/Ontology.js +99 -92
- package/ISA/ISA.Json/Person.js +47 -65
- package/ISA/ISA.Json/Process.js +144 -130
- package/ISA/ISA.Json/Protocol.js +144 -105
- package/ISA/ISA.Json/Publication.js +34 -40
- package/ISA/ISA.Json/StringTable.js +44 -0
- package/ISA/ISA.Json/Study.js +70 -96
- package/ISA/ISA.Json/context/rocrate/isa_assay_context.js +34 -0
- package/ISA/ISA.Json/context/rocrate/isa_comment_context.js +23 -0
- package/ISA/ISA.Json/context/rocrate/isa_component_context.js +24 -0
- package/ISA/ISA.Json/context/rocrate/isa_data_context.js +25 -0
- package/ISA/ISA.Json/context/rocrate/isa_factor_context.js +25 -0
- package/ISA/ISA.Json/context/rocrate/isa_factor_value_context.js +25 -0
- package/ISA/ISA.Json/context/rocrate/isa_investigation_context.js +33 -0
- package/ISA/ISA.Json/context/rocrate/isa_material_attribute_context.js +23 -0
- package/ISA/ISA.Json/context/rocrate/isa_material_attribute_value_context.js +25 -0
- package/ISA/ISA.Json/context/rocrate/isa_material_context.js +26 -0
- package/ISA/ISA.Json/context/rocrate/isa_ontology_annotation_context.js +25 -0
- package/ISA/ISA.Json/context/rocrate/isa_ontology_source_reference_context.js +26 -0
- package/ISA/ISA.Json/context/rocrate/isa_organization_context.js +22 -0
- package/ISA/ISA.Json/context/rocrate/isa_person_context.js +31 -0
- package/ISA/ISA.Json/context/rocrate/isa_process_context.js +31 -0
- package/ISA/ISA.Json/context/rocrate/isa_process_parameter_value_context.js +25 -0
- package/ISA/ISA.Json/context/rocrate/isa_protocol_context.js +30 -0
- package/ISA/ISA.Json/context/rocrate/isa_protocol_parameter_context.js +23 -0
- package/ISA/ISA.Json/context/rocrate/isa_publication_context.js +27 -0
- package/ISA/ISA.Json/context/rocrate/isa_sample_context.js +26 -0
- package/ISA/ISA.Json/context/rocrate/isa_source_context.js +25 -0
- package/ISA/ISA.Json/context/rocrate/isa_study_context.js +42 -0
- package/ISA/ISA.Json/context/rocrate/rocrate_context.js +25 -0
- package/ISA/ISA.Spreadsheet/AnnotationTable/ArcTable.js +56 -43
- package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeCell.js +3 -3
- package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeColumn.js +11 -11
- package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeHeader.js +5 -5
- package/ISA/ISA.Spreadsheet/ArcAssay.js +100 -88
- package/ISA/ISA.Spreadsheet/ArcInvestigation.js +12 -12
- package/ISA/ISA.Spreadsheet/ArcStudy.js +36 -24
- package/ISA/ISA.Spreadsheet/CollectionAux.js +8 -8
- package/ISA/ISA.Spreadsheet/Metadata/Assays.js +5 -5
- package/ISA/ISA.Spreadsheet/Metadata/Comment.js +31 -20
- package/ISA/ISA.Spreadsheet/Metadata/Contacts.js +5 -5
- package/ISA/ISA.Spreadsheet/Metadata/Conversions.js +5 -5
- package/ISA/ISA.Spreadsheet/Metadata/DesignDescriptors.js +1 -1
- package/ISA/ISA.Spreadsheet/Metadata/Factors.js +5 -5
- package/ISA/ISA.Spreadsheet/Metadata/OntologyAnnotation.js +5 -5
- package/ISA/ISA.Spreadsheet/Metadata/OntologySourceReference.js +5 -5
- package/ISA/ISA.Spreadsheet/Metadata/Protocols.js +5 -5
- package/ISA/ISA.Spreadsheet/Metadata/Publication.js +5 -5
- package/ISA/ISA.Spreadsheet/Metadata/SparseTable.js +28 -23
- package/ISA/ISA.Spreadsheet/Metadata/Study.js +8 -8
- package/README.md +20 -3
- package/SemVer.js +6 -6
- package/Templates/Template.Json.js +43 -36
- package/Templates/Template.Spreadsheet.js +12 -12
- package/Templates/Template.Web.js +4 -4
- package/Templates/Template.js +7 -7
- package/Templates/Templates.js +7 -7
- package/WebRequest/WebRequest.Node.js +15 -0
- package/WebRequest/WebRequest.js +10 -29
- package/fable_modules/Fable.Fetch.2.6.0/Fetch.fs.js +7 -7
- package/fable_modules/Fable.Promise.2.2.2/Promise.fs.js +3 -3
- package/fable_modules/Fable.SimpleHttp.3.5.0/Http.fs.js +8 -8
- package/fable_modules/Fable.SimpleHttp.3.5.0/Types.fs.js +2 -2
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Cells/FsCell.fs.js +14 -14
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Cells/FsCellsCollection.fs.js +6 -6
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/CellBuilder.fs.js +4 -4
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/ColumnBuilder.fs.js +3 -3
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/DSL.fs.js +2 -2
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/Expression.fs.js +1 -1
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/RowBuilder.fs.js +3 -3
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/SheetBuilder.fs.js +3 -3
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/TableBuilder.fs.js +3 -3
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/Transform.fs.js +6 -6
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/Types.fs.js +4 -4
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/WorkbookBuilder.fs.js +3 -3
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsAddress.fs +22 -8
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsAddress.fs.js +24 -14
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsColumn.fs.js +3 -3
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsRow.fs.js +3 -3
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsWorkbook.fs.js +6 -6
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsWorksheet.fs +12 -6
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsWorksheet.fs.js +21 -17
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Ranges/FsRange.fs.js +3 -3
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Ranges/FsRangeAddress.fs.js +4 -3
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Ranges/FsRangeBase.fs.js +3 -3
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Ranges/FsRangeColumn.fs.js +3 -3
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Ranges/FsRangeRow.fs.js +1 -1
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/SheetBuilder.fs.js +8 -8
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Tables/FsTable.fs.js +7 -7
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Tables/FsTableField.fs.js +4 -4
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Tables/FsTableRow.fs.js +1 -1
- package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/obj/Release/netstandard2.0/FsSpreadsheet.AssemblyInfo.fs +3 -3
- package/fable_modules/Thoth.Json.Core.0.2.1/Decode.fs +1390 -0
- package/fable_modules/Thoth.Json.Core.0.2.1/Decode.fs.js +1230 -0
- package/fable_modules/Thoth.Json.Core.0.2.1/Encode.fs +233 -0
- package/fable_modules/Thoth.Json.Core.0.2.1/Encode.fs.js +113 -0
- package/fable_modules/Thoth.Json.Core.0.2.1/Thoth.Json.Core.fableproj +28 -0
- package/fable_modules/Thoth.Json.Core.0.2.1/Types.fs +76 -0
- package/fable_modules/Thoth.Json.Core.0.2.1/Types.fs.js +33 -0
- package/fable_modules/Thoth.Json.Core.0.2.1/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
- package/fable_modules/{Thoth.Json.10.1.0/obj/Release/netstandard2.0/Thoth.Json.AssemblyInfo.fs → Thoth.Json.Core.0.2.1/obj/Debug/netstandard2.0/Thoth.Json.Core.AssemblyInfo.fs} +8 -7
- package/fable_modules/Thoth.Json.JavaScript.0.1.0/Decode.fs +79 -0
- package/fable_modules/Thoth.Json.JavaScript.0.1.0/Decode.fs.js +85 -0
- package/fable_modules/Thoth.Json.JavaScript.0.1.0/Encode.fs +32 -0
- package/fable_modules/Thoth.Json.JavaScript.0.1.0/Encode.fs.js +45 -0
- package/fable_modules/Thoth.Json.JavaScript.0.1.0/Thoth.Json.JavaScript.fableproj +21 -0
- package/fable_modules/Thoth.Json.JavaScript.0.1.0/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
- package/fable_modules/Thoth.Json.JavaScript.0.1.0/obj/Debug/netstandard2.0/Thoth.Json.JavaScript.AssemblyInfo.fs +18 -0
- package/fable_modules/Thoth.Json.JavaScript.0.1.0/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
- package/fable_modules/Thoth.Json.JavaScript.0.1.0/obj/Release/netstandard2.0/Thoth.Json.JavaScript.AssemblyInfo.fs +19 -0
- package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Array.d.ts +4 -1
- package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Array.js +124 -86
- package/fable_modules/fable-library-js.4.13.0/CHANGELOG.md +29 -0
- package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Choice.d.ts +0 -17
- package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Choice.js +0 -43
- package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Date.js +3 -2
- package/fable_modules/fable-library-js.4.13.0/FSharp.Core.CompilerServices.d.ts +12 -0
- package/fable_modules/fable-library-js.4.13.0/FSharp.Core.CompilerServices.js +27 -0
- package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/List.js +3 -3
- package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Map.js +3 -3
- package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/MutableMap.js +2 -1
- package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/MutableSet.js +2 -1
- package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Random.js +7 -7
- package/fable_modules/fable-library-js.4.13.0/Result.d.ts +37 -0
- package/fable_modules/fable-library-js.4.13.0/Result.js +165 -0
- package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Set.js +2 -2
- package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/String.d.ts +1 -0
- package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/String.js +8 -5
- package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/System.Collections.Generic.d.ts +15 -7
- package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/System.Collections.Generic.js +46 -36
- package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/System.Text.d.ts +9 -1
- package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/System.Text.js +60 -8
- package/fable_modules/fable-library-js.4.13.0/big.d.ts +338 -0
- package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/package.json +4 -3
- package/fable_modules/project_cracked.json +1 -1
- package/package.json +1 -1
- package/ISA/ISA.Json/Validation/Fable.js +0 -69
- package/ISA/ISA.Json/Validation/JsonSchemaValidation.js +0 -88
- package/ISA/ISA.Json/Validation/ValidationResult.js +0 -45
- package/fable_modules/Thoth.Json.10.1.0/Decode.fs +0 -1366
- package/fable_modules/Thoth.Json.10.1.0/Decode.fs.js +0 -1798
- package/fable_modules/Thoth.Json.10.1.0/Encode.fs +0 -621
- package/fable_modules/Thoth.Json.10.1.0/Encode.fs.js +0 -472
- package/fable_modules/Thoth.Json.10.1.0/Extra.fs +0 -31
- package/fable_modules/Thoth.Json.10.1.0/Extra.fs.js +0 -8
- package/fable_modules/Thoth.Json.10.1.0/Thoth.Json.fableproj +0 -30
- package/fable_modules/Thoth.Json.10.1.0/Types.fs +0 -59
- package/fable_modules/Thoth.Json.10.1.0/Types.fs.js +0 -98
- package/fable_modules/Thoth.Json.10.1.0/package.json +0 -5
- package/fable_modules/fable-library.4.5.0/CHANGELOG.md +0 -11
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Cells/FsCell.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Cells/FsCellsCollection.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/CellBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/ColumnBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/DSL.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/Expression.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/Operators.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/Operators.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/RowBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/SheetBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/TableBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/Transform.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/Types.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/WorkbookBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsColumn.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsRow.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsSpreadsheet.fableproj +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsWorkbook.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Ranges/FsRange.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Ranges/FsRangeAddress.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Ranges/FsRangeBase.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Ranges/FsRangeColumn.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Ranges/FsRangeRow.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/SheetBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Tables/FsTable.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Tables/FsTableField.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Tables/FsTableRow.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/obj/Debug/netstandard2.0/FsSpreadsheet.AssemblyInfo.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Async.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Async.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/AsyncBuilder.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/AsyncBuilder.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/BigInt.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/BigInt.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/BitConverter.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/BitConverter.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Boolean.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Boolean.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Char.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Char.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Date.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/DateOffset.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/DateOffset.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/DateOnly.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/DateOnly.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Decimal.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Decimal.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Double.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Double.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Encoding.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Encoding.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Event.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Event.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/FSharp.Collections.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/FSharp.Collections.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/FSharp.Core.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/FSharp.Core.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Global.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Global.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Guid.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Guid.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Int32.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Int32.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/List.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Long.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Long.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/MailboxProcessor.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/MailboxProcessor.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Map.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/MapUtil.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/MapUtil.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/MutableMap.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/MutableSet.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Native.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Native.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Numeric.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Numeric.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Observable.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Observable.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Option.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Option.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/README.md +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Random.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Range.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Range.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Reflection.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Reflection.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/RegExp.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/RegExp.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Seq.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Seq.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Seq2.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Seq2.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Set.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/SystemException.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/SystemException.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/TimeOnly.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/TimeOnly.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/TimeSpan.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/TimeSpan.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Timer.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Timer.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Types.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Types.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Unicode.13.0.0.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Unicode.13.0.0.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Uri.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Uri.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Util.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Util.js +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/lib/big.d.ts +0 -0
- /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/lib/big.js +0 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
namespace Thoth.Json.Core
|
|
2
|
+
|
|
3
|
+
open Fable.Core
|
|
4
|
+
open System.Globalization
|
|
5
|
+
open System
|
|
6
|
+
|
|
7
|
+
[<RequireQualifiedAccess>]
|
|
8
|
+
module Encode =
|
|
9
|
+
|
|
10
|
+
let inline string value = Json.String value
|
|
11
|
+
let inline char value = Json.Char value
|
|
12
|
+
let inline guid value = value.ToString() |> string
|
|
13
|
+
let inline float value = Json.DecimalNumber value
|
|
14
|
+
|
|
15
|
+
let float32 (value: float32) =
|
|
16
|
+
Json.DecimalNumber(Operators.float value)
|
|
17
|
+
|
|
18
|
+
let inline decimal (value: decimal) =
|
|
19
|
+
value.ToString(CultureInfo.InvariantCulture) |> string
|
|
20
|
+
|
|
21
|
+
let inline nil<'T> = Json.Null
|
|
22
|
+
let inline bool value = Json.Boolean value
|
|
23
|
+
let inline object values = Json.Object values
|
|
24
|
+
let inline array values = Json.Array values
|
|
25
|
+
let list values = Json.Array(values |> List.toArray)
|
|
26
|
+
let seq values = Json.Array(values |> Seq.toArray)
|
|
27
|
+
let dict (values: Map<string, Json>) : Json = values |> Map.toList |> object
|
|
28
|
+
|
|
29
|
+
let inline bigint (value: bigint) = value.ToString() |> string
|
|
30
|
+
|
|
31
|
+
let inline datetimeOffset (value: DateTimeOffset) =
|
|
32
|
+
value.ToString("O", CultureInfo.InvariantCulture) |> string
|
|
33
|
+
|
|
34
|
+
let inline timespan value = value.ToString() |> string
|
|
35
|
+
|
|
36
|
+
let inline datetime (value: DateTime) =
|
|
37
|
+
value.ToString("O", CultureInfo.InvariantCulture) |> string
|
|
38
|
+
|
|
39
|
+
let inline sbyte (value: sbyte) = Json.IntegralNumber(uint32 value)
|
|
40
|
+
let inline byte (value: byte) = Json.IntegralNumber(uint32 value)
|
|
41
|
+
let inline int16 (value: int16) = Json.IntegralNumber(uint32 value)
|
|
42
|
+
let inline uint16 (value: uint16) = Json.IntegralNumber(uint32 value)
|
|
43
|
+
let inline int (value: int) = Json.IntegralNumber(uint32 value)
|
|
44
|
+
let inline uint32 (value: uint32) = Json.IntegralNumber value
|
|
45
|
+
|
|
46
|
+
let inline int64 (value: int64) =
|
|
47
|
+
value.ToString(CultureInfo.InvariantCulture) |> string
|
|
48
|
+
|
|
49
|
+
let inline uint64 (value: uint64) =
|
|
50
|
+
value.ToString(CultureInfo.InvariantCulture) |> string
|
|
51
|
+
|
|
52
|
+
let inline unit () = Json.Unit
|
|
53
|
+
|
|
54
|
+
let tuple2 (enc1: Encoder<'T1>) (enc2: Encoder<'T2>) (v1, v2) : Json =
|
|
55
|
+
array
|
|
56
|
+
[|
|
|
57
|
+
enc1 v1
|
|
58
|
+
enc2 v2
|
|
59
|
+
|]
|
|
60
|
+
|
|
61
|
+
let tuple3
|
|
62
|
+
(enc1: Encoder<'T1>)
|
|
63
|
+
(enc2: Encoder<'T2>)
|
|
64
|
+
(enc3: Encoder<'T3>)
|
|
65
|
+
(v1, v2, v3)
|
|
66
|
+
: Json
|
|
67
|
+
=
|
|
68
|
+
array
|
|
69
|
+
[|
|
|
70
|
+
enc1 v1
|
|
71
|
+
enc2 v2
|
|
72
|
+
enc3 v3
|
|
73
|
+
|]
|
|
74
|
+
|
|
75
|
+
let tuple4
|
|
76
|
+
(enc1: Encoder<'T1>)
|
|
77
|
+
(enc2: Encoder<'T2>)
|
|
78
|
+
(enc3: Encoder<'T3>)
|
|
79
|
+
(enc4: Encoder<'T4>)
|
|
80
|
+
(v1, v2, v3, v4)
|
|
81
|
+
: Json
|
|
82
|
+
=
|
|
83
|
+
array
|
|
84
|
+
[|
|
|
85
|
+
enc1 v1
|
|
86
|
+
enc2 v2
|
|
87
|
+
enc3 v3
|
|
88
|
+
enc4 v4
|
|
89
|
+
|]
|
|
90
|
+
|
|
91
|
+
let tuple5
|
|
92
|
+
(enc1: Encoder<'T1>)
|
|
93
|
+
(enc2: Encoder<'T2>)
|
|
94
|
+
(enc3: Encoder<'T3>)
|
|
95
|
+
(enc4: Encoder<'T4>)
|
|
96
|
+
(enc5: Encoder<'T5>)
|
|
97
|
+
(v1, v2, v3, v4, v5)
|
|
98
|
+
: Json
|
|
99
|
+
=
|
|
100
|
+
array
|
|
101
|
+
[|
|
|
102
|
+
enc1 v1
|
|
103
|
+
enc2 v2
|
|
104
|
+
enc3 v3
|
|
105
|
+
enc4 v4
|
|
106
|
+
enc5 v5
|
|
107
|
+
|]
|
|
108
|
+
|
|
109
|
+
let tuple6
|
|
110
|
+
(enc1: Encoder<'T1>)
|
|
111
|
+
(enc2: Encoder<'T2>)
|
|
112
|
+
(enc3: Encoder<'T3>)
|
|
113
|
+
(enc4: Encoder<'T4>)
|
|
114
|
+
(enc5: Encoder<'T5>)
|
|
115
|
+
(enc6: Encoder<'T6>)
|
|
116
|
+
(v1, v2, v3, v4, v5, v6)
|
|
117
|
+
: Json
|
|
118
|
+
=
|
|
119
|
+
array
|
|
120
|
+
[|
|
|
121
|
+
enc1 v1
|
|
122
|
+
enc2 v2
|
|
123
|
+
enc3 v3
|
|
124
|
+
enc4 v4
|
|
125
|
+
enc5 v5
|
|
126
|
+
enc6 v6
|
|
127
|
+
|]
|
|
128
|
+
|
|
129
|
+
let tuple7
|
|
130
|
+
(enc1: Encoder<'T1>)
|
|
131
|
+
(enc2: Encoder<'T2>)
|
|
132
|
+
(enc3: Encoder<'T3>)
|
|
133
|
+
(enc4: Encoder<'T4>)
|
|
134
|
+
(enc5: Encoder<'T5>)
|
|
135
|
+
(enc6: Encoder<'T6>)
|
|
136
|
+
(enc7: Encoder<'T7>)
|
|
137
|
+
(v1, v2, v3, v4, v5, v6, v7)
|
|
138
|
+
: Json
|
|
139
|
+
=
|
|
140
|
+
array
|
|
141
|
+
[|
|
|
142
|
+
enc1 v1
|
|
143
|
+
enc2 v2
|
|
144
|
+
enc3 v3
|
|
145
|
+
enc4 v4
|
|
146
|
+
enc5 v5
|
|
147
|
+
enc6 v6
|
|
148
|
+
enc7 v7
|
|
149
|
+
|]
|
|
150
|
+
|
|
151
|
+
let tuple8
|
|
152
|
+
(enc1: Encoder<'T1>)
|
|
153
|
+
(enc2: Encoder<'T2>)
|
|
154
|
+
(enc3: Encoder<'T3>)
|
|
155
|
+
(enc4: Encoder<'T4>)
|
|
156
|
+
(enc5: Encoder<'T5>)
|
|
157
|
+
(enc6: Encoder<'T6>)
|
|
158
|
+
(enc7: Encoder<'T7>)
|
|
159
|
+
(enc8: Encoder<'T8>)
|
|
160
|
+
(v1, v2, v3, v4, v5, v6, v7, v8)
|
|
161
|
+
: Json
|
|
162
|
+
=
|
|
163
|
+
array
|
|
164
|
+
[|
|
|
165
|
+
enc1 v1
|
|
166
|
+
enc2 v2
|
|
167
|
+
enc3 v3
|
|
168
|
+
enc4 v4
|
|
169
|
+
enc5 v5
|
|
170
|
+
enc6 v6
|
|
171
|
+
enc7 v7
|
|
172
|
+
enc8 v8
|
|
173
|
+
|]
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
let map
|
|
177
|
+
(keyEncoder: Encoder<'key>)
|
|
178
|
+
(valueEncoder: Encoder<'value>)
|
|
179
|
+
(values: Map<'key, 'value>)
|
|
180
|
+
: Json
|
|
181
|
+
=
|
|
182
|
+
values
|
|
183
|
+
|> Map.toList
|
|
184
|
+
|> List.map (tuple2 keyEncoder valueEncoder)
|
|
185
|
+
|> list
|
|
186
|
+
|
|
187
|
+
////////////
|
|
188
|
+
/// Enum ///
|
|
189
|
+
///////////
|
|
190
|
+
|
|
191
|
+
module Enum =
|
|
192
|
+
|
|
193
|
+
let byte<'TEnum when 'TEnum: enum<byte>> (value: 'TEnum) : Json =
|
|
194
|
+
LanguagePrimitives.EnumToValue value |> byte
|
|
195
|
+
|
|
196
|
+
let sbyte<'TEnum when 'TEnum: enum<sbyte>> (value: 'TEnum) : Json =
|
|
197
|
+
LanguagePrimitives.EnumToValue value |> sbyte
|
|
198
|
+
|
|
199
|
+
let int16<'TEnum when 'TEnum: enum<int16>> (value: 'TEnum) : Json =
|
|
200
|
+
LanguagePrimitives.EnumToValue value |> int16
|
|
201
|
+
|
|
202
|
+
let uint16<'TEnum when 'TEnum: enum<uint16>> (value: 'TEnum) : Json =
|
|
203
|
+
LanguagePrimitives.EnumToValue value |> uint16
|
|
204
|
+
|
|
205
|
+
let int<'TEnum when 'TEnum: enum<int>> (value: 'TEnum) : Json =
|
|
206
|
+
LanguagePrimitives.EnumToValue value |> int
|
|
207
|
+
|
|
208
|
+
let uint32<'TEnum when 'TEnum: enum<uint32>> (value: 'TEnum) : Json =
|
|
209
|
+
LanguagePrimitives.EnumToValue value |> uint32
|
|
210
|
+
|
|
211
|
+
let option (encoder: 'a -> Json) =
|
|
212
|
+
Option.map encoder >> Option.defaultWith (fun _ -> nil)
|
|
213
|
+
|
|
214
|
+
let rec toJsonValue (helpers: IEncoderHelpers<'JsonValue>) (json: Json) =
|
|
215
|
+
match json with
|
|
216
|
+
| Json.String value -> helpers.encodeString value
|
|
217
|
+
| Json.IntegralNumber value -> helpers.encodeIntegralNumber value
|
|
218
|
+
| Json.Object values ->
|
|
219
|
+
let o = helpers.createEmptyObject ()
|
|
220
|
+
|
|
221
|
+
values
|
|
222
|
+
|> Seq.iter (fun (k, v) ->
|
|
223
|
+
helpers.setPropertyOnObject (o, k, toJsonValue helpers v)
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
o
|
|
227
|
+
| Json.Char value -> helpers.encodeChar value
|
|
228
|
+
| Json.DecimalNumber value -> helpers.encodeDecimalNumber value
|
|
229
|
+
| Json.Null -> helpers.encodeNull ()
|
|
230
|
+
| Json.Boolean value -> helpers.encodeBool value
|
|
231
|
+
| Json.Array value ->
|
|
232
|
+
value |> Array.map (toJsonValue helpers) |> helpers.encodeArray
|
|
233
|
+
| Json.Unit -> helpers.encodeNull ()
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { Json } from "./Types.fs.js";
|
|
2
|
+
import { map as map_1, toArray } from "../fable-library-js.4.13.0/List.js";
|
|
3
|
+
import { iterate, toArray as toArray_1 } from "../fable-library-js.4.13.0/Seq.js";
|
|
4
|
+
import { toList } from "../fable-library-js.4.13.0/Map.js";
|
|
5
|
+
import { map as map_2, defaultArgWith } from "../fable-library-js.4.13.0/Option.js";
|
|
6
|
+
import { map as map_3 } from "../fable-library-js.4.13.0/Array.js";
|
|
7
|
+
|
|
8
|
+
export function float32(value) {
|
|
9
|
+
return new Json(2, [value]);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function list(values) {
|
|
13
|
+
return new Json(6, [toArray(values)]);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function seq(values) {
|
|
17
|
+
return new Json(6, [toArray_1(values)]);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function dict(values) {
|
|
21
|
+
return new Json(5, [toList(values)]);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function tuple2(enc1, enc2, v1, v2) {
|
|
25
|
+
return new Json(6, [[enc1(v1), enc2(v2)]]);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function tuple3(enc1, enc2, enc3, v1, v2, v3) {
|
|
29
|
+
return new Json(6, [[enc1(v1), enc2(v2), enc3(v3)]]);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function tuple4(enc1, enc2, enc3, enc4, v1, v2, v3, v4) {
|
|
33
|
+
return new Json(6, [[enc1(v1), enc2(v2), enc3(v3), enc4(v4)]]);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function tuple5(enc1, enc2, enc3, enc4, enc5, v1, v2, v3, v4, v5) {
|
|
37
|
+
return new Json(6, [[enc1(v1), enc2(v2), enc3(v3), enc4(v4), enc5(v5)]]);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function tuple6(enc1, enc2, enc3, enc4, enc5, enc6, v1, v2, v3, v4, v5, v6) {
|
|
41
|
+
return new Json(6, [[enc1(v1), enc2(v2), enc3(v3), enc4(v4), enc5(v5), enc6(v6)]]);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function tuple7(enc1, enc2, enc3, enc4, enc5, enc6, enc7, v1, v2, v3, v4, v5, v6, v7) {
|
|
45
|
+
return new Json(6, [[enc1(v1), enc2(v2), enc3(v3), enc4(v4), enc5(v5), enc6(v6), enc7(v7)]]);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function tuple8(enc1, enc2, enc3, enc4, enc5, enc6, enc7, enc8, v1, v2, v3, v4, v5, v6, v7, v8) {
|
|
49
|
+
return new Json(6, [[enc1(v1), enc2(v2), enc3(v3), enc4(v4), enc5(v5), enc6(v6), enc7(v7), enc8(v8)]]);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function map(keyEncoder, valueEncoder, values) {
|
|
53
|
+
return list(map_1((tupledArg) => tuple2(keyEncoder, valueEncoder, tupledArg[0], tupledArg[1]), toList(values)));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function Enum_byte(value) {
|
|
57
|
+
return new Json(7, [value]);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function Enum_sbyte(value) {
|
|
61
|
+
return new Json(7, [value >>> 0]);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function Enum_int16(value) {
|
|
65
|
+
return new Json(7, [value >>> 0]);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function Enum_uint16(value) {
|
|
69
|
+
return new Json(7, [value]);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function Enum_int(value) {
|
|
73
|
+
return new Json(7, [value >>> 0]);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function Enum_uint32(value) {
|
|
77
|
+
return new Json(7, [value]);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function option(encoder) {
|
|
81
|
+
return (arg) => defaultArgWith(map_2(encoder, arg), () => (new Json(3, [])));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function toJsonValue(helpers, json) {
|
|
85
|
+
switch (json.tag) {
|
|
86
|
+
case 7:
|
|
87
|
+
return helpers.encodeIntegralNumber(json.fields[0]);
|
|
88
|
+
case 5: {
|
|
89
|
+
const o = helpers.createEmptyObject();
|
|
90
|
+
iterate((tupledArg) => {
|
|
91
|
+
helpers.setPropertyOnObject(o, tupledArg[0], toJsonValue(helpers, tupledArg[1]));
|
|
92
|
+
}, json.fields[0]);
|
|
93
|
+
return o;
|
|
94
|
+
}
|
|
95
|
+
case 1:
|
|
96
|
+
return helpers.encodeChar(json.fields[0]);
|
|
97
|
+
case 2:
|
|
98
|
+
return helpers.encodeDecimalNumber(json.fields[0]);
|
|
99
|
+
case 3:
|
|
100
|
+
return helpers.encodeNull();
|
|
101
|
+
case 4:
|
|
102
|
+
return helpers.encodeBool(json.fields[0]);
|
|
103
|
+
case 6: {
|
|
104
|
+
const arg = map_3((json_1) => toJsonValue(helpers, json_1), json.fields[0]);
|
|
105
|
+
return helpers.encodeArray(arg);
|
|
106
|
+
}
|
|
107
|
+
case 8:
|
|
108
|
+
return helpers.encodeNull();
|
|
109
|
+
default:
|
|
110
|
+
return helpers.encodeString(json.fields[0]);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
|
3
|
+
<PropertyGroup>
|
|
4
|
+
<Description>
|
|
5
|
+
Elm-inspired encoder and decoder for JSON, this package is intended to be use on Fable side only.
|
|
6
|
+
|
|
7
|
+
If you are interested on using it against .NET Core or .NET Framework, please use Thoth.Json.Net.
|
|
8
|
+
</Description>
|
|
9
|
+
<PackageTags>fable;fsharp;json</PackageTags>
|
|
10
|
+
</PropertyGroup>
|
|
11
|
+
<PropertyGroup>
|
|
12
|
+
<TargetFramework>netstandard2.0</TargetFramework>
|
|
13
|
+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
|
14
|
+
</PropertyGroup>
|
|
15
|
+
<ItemGroup>
|
|
16
|
+
<Compile Include="Types.fs" />
|
|
17
|
+
<Compile Include="Decode.fs" />
|
|
18
|
+
<Compile Include="Encode.fs" />
|
|
19
|
+
<!-- <Compile Include="Extra.fs" /> -->
|
|
20
|
+
</ItemGroup>
|
|
21
|
+
<ItemGroup>
|
|
22
|
+
<PackageReference Include="Fable.Core" />
|
|
23
|
+
<PackageReference Include="Ionide.KeepAChangelog.Tasks" PrivateAssets="all" />
|
|
24
|
+
</ItemGroup>
|
|
25
|
+
<ItemGroup>
|
|
26
|
+
<Content Include="*.fsproj; **\*.fs" PackagePath="fable" />
|
|
27
|
+
</ItemGroup>
|
|
28
|
+
</Project>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
namespace Thoth.Json.Core
|
|
2
|
+
|
|
3
|
+
type IDecoderHelpers<'JsonValue> =
|
|
4
|
+
abstract isString: 'JsonValue -> bool
|
|
5
|
+
abstract isNumber: 'JsonValue -> bool
|
|
6
|
+
abstract isBoolean: 'JsonValue -> bool
|
|
7
|
+
abstract isNullValue: 'JsonValue -> bool
|
|
8
|
+
abstract isArray: 'JsonValue -> bool
|
|
9
|
+
abstract isObject: 'JsonValue -> bool
|
|
10
|
+
abstract hasProperty: string -> 'JsonValue -> bool
|
|
11
|
+
abstract isIntegralValue: 'JsonValue -> bool
|
|
12
|
+
abstract asString: 'JsonValue -> string
|
|
13
|
+
abstract asFloat: 'JsonValue -> float
|
|
14
|
+
abstract asFloat32: 'JsonValue -> float32
|
|
15
|
+
abstract asInt: 'JsonValue -> int
|
|
16
|
+
abstract asBoolean: 'JsonValue -> bool
|
|
17
|
+
abstract asArray: 'JsonValue -> 'JsonValue[]
|
|
18
|
+
abstract getProperty: string * 'JsonValue -> 'JsonValue
|
|
19
|
+
abstract getProperties: 'JsonValue -> string seq
|
|
20
|
+
abstract anyToString: 'JsonValue -> string
|
|
21
|
+
|
|
22
|
+
type IEncoderHelpers<'JsonValue> =
|
|
23
|
+
abstract encodeString: string -> 'JsonValue
|
|
24
|
+
abstract encodeChar: char -> 'JsonValue
|
|
25
|
+
abstract encodeDecimalNumber: float -> 'JsonValue
|
|
26
|
+
abstract encodeBool: bool -> 'JsonValue
|
|
27
|
+
abstract encodeNull: unit -> 'JsonValue
|
|
28
|
+
abstract createEmptyObject: unit -> 'JsonValue
|
|
29
|
+
abstract setPropertyOnObject: 'JsonValue * string * 'JsonValue -> unit
|
|
30
|
+
abstract encodeArray: 'JsonValue array -> 'JsonValue
|
|
31
|
+
abstract encodeList: 'JsonValue list -> 'JsonValue
|
|
32
|
+
abstract encodeSeq: 'JsonValue seq -> 'JsonValue
|
|
33
|
+
abstract encodeIntegralNumber: uint32 -> 'JsonValue
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
type ErrorReason<'JsonValue> =
|
|
37
|
+
| BadPrimitive of string * 'JsonValue
|
|
38
|
+
| BadPrimitiveExtra of string * 'JsonValue * string
|
|
39
|
+
| BadType of string * 'JsonValue
|
|
40
|
+
| BadField of string * 'JsonValue
|
|
41
|
+
| BadPath of string * 'JsonValue * string
|
|
42
|
+
| TooSmallArray of string * 'JsonValue
|
|
43
|
+
| FailMessage of string
|
|
44
|
+
| BadOneOf of DecoderError<'JsonValue> list
|
|
45
|
+
|
|
46
|
+
and DecoderError<'JsonValue> = string * ErrorReason<'JsonValue>
|
|
47
|
+
|
|
48
|
+
type Decoder<'T> =
|
|
49
|
+
abstract member Decode<'JsonValue> :
|
|
50
|
+
helpers: IDecoderHelpers<'JsonValue> * value: 'JsonValue ->
|
|
51
|
+
Result<'T, DecoderError<'JsonValue>>
|
|
52
|
+
|
|
53
|
+
/// <summary>
|
|
54
|
+
/// A JSON value
|
|
55
|
+
/// </summary>
|
|
56
|
+
/// <remarks>
|
|
57
|
+
/// Some types don't have a direct representation in this DU,
|
|
58
|
+
/// this to make sure we represent them in the same way between the different
|
|
59
|
+
/// backends.
|
|
60
|
+
///
|
|
61
|
+
/// For example, <c>decimal</c> use <c>string</c> as the underlying type.
|
|
62
|
+
/// </remarks>
|
|
63
|
+
[<RequireQualifiedAccess; NoComparison>]
|
|
64
|
+
type Json =
|
|
65
|
+
| String of string
|
|
66
|
+
| Char of char
|
|
67
|
+
| DecimalNumber of float
|
|
68
|
+
| Null
|
|
69
|
+
| Boolean of bool
|
|
70
|
+
| Object of (string * Json) seq
|
|
71
|
+
| Array of Json[]
|
|
72
|
+
// Thoth.Json as an abritrary limit to the size of numbers
|
|
73
|
+
| IntegralNumber of uint32
|
|
74
|
+
| Unit
|
|
75
|
+
|
|
76
|
+
type Encoder<'T> = 'T -> Json
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Union } from "../fable-library-js.4.13.0/Types.js";
|
|
2
|
+
import { uint32_type, array_type, class_type, bool_type, float64_type, char_type, union_type, list_type, tuple_type, string_type } from "../fable-library-js.4.13.0/Reflection.js";
|
|
3
|
+
|
|
4
|
+
export class ErrorReason$1 extends Union {
|
|
5
|
+
constructor(tag, fields) {
|
|
6
|
+
super();
|
|
7
|
+
this.tag = tag;
|
|
8
|
+
this.fields = fields;
|
|
9
|
+
}
|
|
10
|
+
cases() {
|
|
11
|
+
return ["BadPrimitive", "BadPrimitiveExtra", "BadType", "BadField", "BadPath", "TooSmallArray", "FailMessage", "BadOneOf"];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function ErrorReason$1_$reflection(gen0) {
|
|
16
|
+
return union_type("Thoth.Json.Core.ErrorReason`1", [gen0], ErrorReason$1, () => [[["Item1", string_type], ["Item2", gen0]], [["Item1", string_type], ["Item2", gen0], ["Item3", string_type]], [["Item1", string_type], ["Item2", gen0]], [["Item1", string_type], ["Item2", gen0]], [["Item1", string_type], ["Item2", gen0], ["Item3", string_type]], [["Item1", string_type], ["Item2", gen0]], [["Item", string_type]], [["Item", list_type(tuple_type(string_type, ErrorReason$1_$reflection(gen0)))]]]);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class Json extends Union {
|
|
20
|
+
constructor(tag, fields) {
|
|
21
|
+
super();
|
|
22
|
+
this.tag = tag;
|
|
23
|
+
this.fields = fields;
|
|
24
|
+
}
|
|
25
|
+
cases() {
|
|
26
|
+
return ["String", "Char", "DecimalNumber", "Null", "Boolean", "Object", "Array", "IntegralNumber", "Unit"];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function Json_$reflection() {
|
|
31
|
+
return union_type("Thoth.Json.Core.Json", [], Json, () => [[["Item", string_type]], [["Item", char_type]], [["Item", float64_type]], [], [["Item", bool_type]], [["Item", class_type("System.Collections.Generic.IEnumerable`1", [tuple_type(string_type, Json_$reflection())])]], [["Item", array_type(Json_$reflection())]], [["Item", uint32_type]], []]);
|
|
32
|
+
}
|
|
33
|
+
|
|
@@ -7,13 +7,14 @@ open System
|
|
|
7
7
|
open System.Reflection
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
[<assembly: System.Reflection.AssemblyMetadataAttribute("BuildDate", "2023-12-12")>]
|
|
10
11
|
[<assembly: System.Reflection.AssemblyCompanyAttribute("Maxime Mangel")>]
|
|
11
|
-
[<assembly: System.Reflection.AssemblyConfigurationAttribute("
|
|
12
|
-
[<assembly: System.Reflection.AssemblyDescriptionAttribute("\nElm-inspired encoder and decoder for JSON, this package is intended to be use on Fable side only.\n\nIf you are interested on using it against .NET Core or .NET Framework, please use Thoth.Json.Net.\n
|
|
13
|
-
[<assembly: System.Reflection.AssemblyFileVersionAttribute("
|
|
14
|
-
[<assembly: System.Reflection.AssemblyInformationalVersionAttribute("
|
|
15
|
-
[<assembly: System.Reflection.AssemblyProductAttribute("Thoth.Json")>]
|
|
16
|
-
[<assembly: System.Reflection.AssemblyTitleAttribute("Thoth.Json")>]
|
|
17
|
-
[<assembly: System.Reflection.AssemblyVersionAttribute("
|
|
12
|
+
[<assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")>]
|
|
13
|
+
[<assembly: System.Reflection.AssemblyDescriptionAttribute("\nElm-inspired encoder and decoder for JSON, this package is intended to be use on Fable side only.\n\nIf you are interested on using it against .NET Core or .NET Framework, please use Thoth.Json.Net.\n ")>]
|
|
14
|
+
[<assembly: System.Reflection.AssemblyFileVersionAttribute("0.2.1.0")>]
|
|
15
|
+
[<assembly: System.Reflection.AssemblyInformationalVersionAttribute("0.2.1")>]
|
|
16
|
+
[<assembly: System.Reflection.AssemblyProductAttribute("Thoth.Json.Core")>]
|
|
17
|
+
[<assembly: System.Reflection.AssemblyTitleAttribute("Thoth.Json.Core")>]
|
|
18
|
+
[<assembly: System.Reflection.AssemblyVersionAttribute("0.2.1.0")>]
|
|
18
19
|
[<assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://github.com/thoth-org/Thoth.Json")>]
|
|
19
20
|
do()
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
namespace Thoth.Json.JavaScript
|
|
2
|
+
|
|
3
|
+
open Fable.Core
|
|
4
|
+
open Fable.Core.JsInterop
|
|
5
|
+
open Thoth.Json.Core
|
|
6
|
+
|
|
7
|
+
[<RequireQualifiedAccess>]
|
|
8
|
+
module Decode =
|
|
9
|
+
|
|
10
|
+
let helpers =
|
|
11
|
+
{ new IDecoderHelpers<obj> with
|
|
12
|
+
member _.isString jsonValue = jsonValue :? string
|
|
13
|
+
member _.isNumber jsonValue = jsTypeof jsonValue = "number"
|
|
14
|
+
member _.isBoolean jsonValue = jsonValue :? bool
|
|
15
|
+
member _.isNullValue jsonValue = isNull jsonValue
|
|
16
|
+
|
|
17
|
+
member _.isArray jsonValue =
|
|
18
|
+
JS.Constructors.Array.isArray (jsonValue)
|
|
19
|
+
|
|
20
|
+
member _.isObject jsonValue =
|
|
21
|
+
emitJsStatement
|
|
22
|
+
jsonValue
|
|
23
|
+
"""
|
|
24
|
+
return $0 === null ? false : (Object.getPrototypeOf($0 || false) === Object.prototype)
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
member _.hasProperty fieldName jsonValue =
|
|
28
|
+
emitJsStatement
|
|
29
|
+
(jsonValue, fieldName)
|
|
30
|
+
"""
|
|
31
|
+
return $0.hasOwnProperty($1);
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
member _.isIntegralValue jsonValue =
|
|
35
|
+
emitJsStatement
|
|
36
|
+
jsonValue
|
|
37
|
+
"""
|
|
38
|
+
return isFinite($0) && Math.floor($0) === $0
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
member _.asString jsonValue = unbox jsonValue
|
|
42
|
+
member _.asBoolean jsonValue = unbox jsonValue
|
|
43
|
+
member _.asArray jsonValue = unbox jsonValue
|
|
44
|
+
member _.asFloat jsonValue = unbox jsonValue
|
|
45
|
+
member _.asFloat32 jsonValue = unbox jsonValue
|
|
46
|
+
member _.asInt jsonValue = unbox jsonValue
|
|
47
|
+
|
|
48
|
+
member _.getProperties jsonValue =
|
|
49
|
+
upcast JS.Constructors.Object.keys (jsonValue)
|
|
50
|
+
|
|
51
|
+
member _.getProperty(fieldName: string, jsonValue: obj) =
|
|
52
|
+
jsonValue?(fieldName)
|
|
53
|
+
|
|
54
|
+
member _.anyToString jsonValue =
|
|
55
|
+
emitJsStatement
|
|
56
|
+
jsonValue
|
|
57
|
+
"""
|
|
58
|
+
return JSON.stringify($0, null, 4) + ''
|
|
59
|
+
"""
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
module Helpers =
|
|
63
|
+
|
|
64
|
+
[<Emit("$0 instanceof SyntaxError")>]
|
|
65
|
+
let isSyntaxError (_: obj) : bool = jsNative
|
|
66
|
+
|
|
67
|
+
let fromString (decoder: Decoder<'T>) =
|
|
68
|
+
fun value ->
|
|
69
|
+
try
|
|
70
|
+
let json = JS.JSON.parse value
|
|
71
|
+
|
|
72
|
+
match decoder.Decode(helpers, json) with
|
|
73
|
+
| Ok success -> Ok success
|
|
74
|
+
| Error error ->
|
|
75
|
+
let finalError = error |> Decode.Helpers.prependPath "$"
|
|
76
|
+
Error(Decode.errorToString helpers finalError)
|
|
77
|
+
|
|
78
|
+
with ex when Helpers.isSyntaxError ex ->
|
|
79
|
+
Error("Given an invalid JSON: " + ex.Message)
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { FSharpResult$2 } from "../fable-library-js.4.13.0/Result.js";
|
|
2
|
+
import { errorToString, Helpers_prependPath } from "../Thoth.Json.Core.0.2.1/Decode.fs.js";
|
|
3
|
+
|
|
4
|
+
export const helpers = {
|
|
5
|
+
isString(jsonValue) {
|
|
6
|
+
return typeof jsonValue === "string";
|
|
7
|
+
},
|
|
8
|
+
isNumber(jsonValue_1) {
|
|
9
|
+
return (typeof jsonValue_1) === "number";
|
|
10
|
+
},
|
|
11
|
+
isBoolean(jsonValue_2) {
|
|
12
|
+
return typeof jsonValue_2 === "boolean";
|
|
13
|
+
},
|
|
14
|
+
isNullValue(jsonValue_3) {
|
|
15
|
+
return jsonValue_3 == null;
|
|
16
|
+
},
|
|
17
|
+
isArray(jsonValue_4) {
|
|
18
|
+
return Array.isArray(jsonValue_4);
|
|
19
|
+
},
|
|
20
|
+
isObject(jsonValue_5) {
|
|
21
|
+
return jsonValue_5 === null ? false : (Object.getPrototypeOf(jsonValue_5 || false) === Object.prototype)
|
|
22
|
+
;
|
|
23
|
+
},
|
|
24
|
+
hasProperty(fieldName, jsonValue_6) {
|
|
25
|
+
return jsonValue_6.hasOwnProperty(fieldName);
|
|
26
|
+
;
|
|
27
|
+
},
|
|
28
|
+
isIntegralValue(jsonValue_7) {
|
|
29
|
+
return isFinite(jsonValue_7) && Math.floor(jsonValue_7) === jsonValue_7
|
|
30
|
+
;
|
|
31
|
+
},
|
|
32
|
+
asString(jsonValue_8) {
|
|
33
|
+
return jsonValue_8;
|
|
34
|
+
},
|
|
35
|
+
asBoolean(jsonValue_9) {
|
|
36
|
+
return jsonValue_9;
|
|
37
|
+
},
|
|
38
|
+
asArray(jsonValue_10) {
|
|
39
|
+
return jsonValue_10;
|
|
40
|
+
},
|
|
41
|
+
asFloat(jsonValue_11) {
|
|
42
|
+
return jsonValue_11;
|
|
43
|
+
},
|
|
44
|
+
asFloat32(jsonValue_12) {
|
|
45
|
+
return jsonValue_12;
|
|
46
|
+
},
|
|
47
|
+
asInt(jsonValue_13) {
|
|
48
|
+
return jsonValue_13;
|
|
49
|
+
},
|
|
50
|
+
getProperties(jsonValue_14) {
|
|
51
|
+
return Object.keys(jsonValue_14);
|
|
52
|
+
},
|
|
53
|
+
getProperty(fieldName_1, jsonValue_15) {
|
|
54
|
+
return jsonValue_15[fieldName_1];
|
|
55
|
+
},
|
|
56
|
+
anyToString(jsonValue_16) {
|
|
57
|
+
return JSON.stringify(jsonValue_16, null, 4) + ''
|
|
58
|
+
;
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export function fromString(decoder, value) {
|
|
63
|
+
try {
|
|
64
|
+
const json = JSON.parse(value);
|
|
65
|
+
const matchValue = decoder.Decode(helpers, json);
|
|
66
|
+
if (matchValue.tag === 1) {
|
|
67
|
+
let finalError;
|
|
68
|
+
const tupledArg = matchValue.fields[0];
|
|
69
|
+
finalError = Helpers_prependPath("$", tupledArg[0], tupledArg[1]);
|
|
70
|
+
return new FSharpResult$2(1, [errorToString(helpers, finalError[0], finalError[1])]);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
return new FSharpResult$2(0, [matchValue.fields[0]]);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
catch (matchValue_1) {
|
|
77
|
+
if (matchValue_1 instanceof SyntaxError) {
|
|
78
|
+
return new FSharpResult$2(1, ["Given an invalid JSON: " + matchValue_1.message]);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
throw matchValue_1;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|