@nfdi4plants/arctrl 2.0.1 → 2.1.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARC.js +43 -108
- package/Contract/ARC.js +1 -1
- package/Contract/ArcAssay.js +37 -14
- package/Contract/ArcInvestigation.js +4 -4
- package/Contract/ArcStudy.js +37 -14
- package/Contract/Contract.js +6 -6
- package/Contract/Datamap.js +5 -5
- package/Contract/Git.js +6 -6
- package/Contract/ValidationPackagesConfig.js +5 -5
- package/Core/ArcTypes.js +17 -17
- package/Core/Comment.js +16 -9
- package/Core/CommentList.js +6 -6
- package/Core/Conversion.js +64 -64
- package/Core/Data.js +11 -11
- package/Core/DataContext.js +4 -4
- package/Core/DataFile.js +2 -2
- package/Core/DataMap.js +4 -4
- package/Core/Helper/Collections.js +11 -11
- package/Core/Helper/HashCodes.js +5 -5
- package/Core/Helper/Identifier.js +9 -9
- package/Core/Helper/Regex.js +38 -38
- package/Core/Helper/SemVer.js +8 -8
- package/Core/OntologyAnnotation.js +11 -11
- package/Core/OntologySourceReference.js +4 -4
- package/Core/Person.js +11 -11
- package/Core/Process/ColumnIndex.js +7 -7
- package/Core/Process/Component.js +10 -10
- package/Core/Process/Factor.js +6 -6
- package/Core/Process/FactorValue.js +10 -10
- package/Core/Process/Material.js +5 -5
- package/Core/Process/MaterialAttribute.js +4 -4
- package/Core/Process/MaterialAttributeValue.js +10 -10
- package/Core/Process/MaterialType.js +2 -2
- package/Core/Process/Process.js +19 -19
- package/Core/Process/ProcessInput.js +16 -16
- package/Core/Process/ProcessOutput.js +16 -16
- package/Core/Process/ProcessParameterValue.js +10 -10
- package/Core/Process/ProcessSequence.js +6 -6
- package/Core/Process/Protocol.js +5 -5
- package/Core/Process/ProtocolParameter.js +4 -4
- package/Core/Process/Sample.js +5 -5
- package/Core/Process/Source.js +5 -5
- package/Core/Publication.js +10 -10
- package/Core/Table/ArcTable.js +35 -28
- package/Core/Table/ArcTableAux.js +22 -22
- package/Core/Table/ArcTables.js +14 -14
- package/Core/Table/CompositeCell.js +6 -6
- package/Core/Table/CompositeColumn.js +5 -5
- package/Core/Table/CompositeHeader.js +9 -9
- package/Core/Template.js +7 -7
- package/Core/Templates.js +8 -8
- package/Core/Value.js +11 -11
- package/FileSystem/Commit.js +2 -2
- package/FileSystem/FileSystem.js +4 -4
- package/FileSystem/FileSystemTree.js +14 -14
- package/FileSystem/Path.js +3 -3
- package/Json/ARC.js +21 -15
- package/Json/Assay.js +108 -169
- package/Json/Comment.js +84 -122
- package/Json/ConverterOptions.js +2 -2
- package/Json/Data.js +100 -107
- package/Json/DataFile.js +22 -57
- package/Json/DataMap/DataContext.js +25 -16
- package/Json/DataMap/DataMap.js +11 -7
- package/Json/Decode.js +11 -14
- package/Json/Encode.js +24 -13
- package/Json/IDTable.js +14 -3
- package/Json/Investigation.js +194 -176
- package/Json/OntologyAnnotation.js +113 -127
- package/Json/OntologySourceReference.js +93 -111
- package/Json/Person.js +204 -135
- package/Json/Process/AssayMaterials.js +12 -14
- package/Json/Process/Component.js +23 -68
- package/Json/Process/Factor.js +28 -46
- package/Json/Process/FactorValue.js +28 -50
- package/Json/Process/Material.js +56 -83
- package/Json/Process/MaterialAttribute.js +23 -45
- package/Json/Process/MaterialAttributeValue.js +28 -71
- package/Json/Process/MaterialType.js +17 -35
- package/Json/Process/Process.js +70 -85
- package/Json/Process/ProcessInput.js +18 -45
- package/Json/Process/ProcessOutput.js +15 -63
- package/Json/Process/ProcessParameterValue.js +21 -70
- package/Json/Process/Protocol.js +80 -83
- package/Json/Process/ProtocolParameter.js +23 -44
- package/Json/Process/Sample.js +66 -93
- package/Json/Process/Source.js +54 -81
- package/Json/Process/StudyMaterials.js +13 -15
- package/Json/Process/Value.js +19 -29
- package/Json/PropertyValue.js +86 -28
- package/Json/Publication.js +92 -115
- package/Json/ROCrateObject.js +146 -0
- package/Json/StringTable.js +27 -10
- package/Json/Study.js +193 -182
- package/Json/Table/ArcTable.js +119 -115
- package/Json/Table/CellTable.js +24 -11
- package/Json/Table/CompositeCell.js +40 -41
- package/Json/Table/CompositeHeader.js +24 -36
- package/Json/Table/IOType.js +9 -31
- package/Json/Table/OATable.js +23 -10
- package/Json/Table/Templates.js +82 -90
- package/Json/context/rocrate/isa_assay_context.js +60 -4
- package/Json/context/rocrate/isa_comment_context.js +28 -4
- package/Json/context/rocrate/isa_component_context.js +44 -4
- package/Json/context/rocrate/isa_data_context.js +40 -4
- package/Json/context/rocrate/isa_factor_context.js +40 -4
- package/Json/context/rocrate/isa_factor_value_context.js +52 -4
- package/Json/context/rocrate/isa_investigation_context.js +68 -4
- package/Json/context/rocrate/isa_material_attribute_context.js +32 -4
- package/Json/context/rocrate/isa_material_attribute_value_context.js +48 -4
- package/Json/context/rocrate/isa_material_context.js +36 -4
- package/Json/context/rocrate/isa_ontology_annotation_context.js +36 -4
- package/Json/context/rocrate/isa_ontology_source_reference_context.js +40 -4
- package/Json/context/rocrate/isa_organization_context.js +24 -4
- package/Json/context/rocrate/isa_person_context.js +85 -5
- package/Json/context/rocrate/isa_process_context.js +56 -4
- package/Json/context/rocrate/isa_process_parameter_value_context.js +48 -4
- package/Json/context/rocrate/isa_protocol_context.js +60 -4
- package/Json/context/rocrate/isa_protocol_parameter_context.js +32 -4
- package/Json/context/rocrate/isa_publication_context.js +44 -4
- package/Json/context/rocrate/isa_sample_context.js +32 -4
- package/Json/context/rocrate/isa_source_context.js +32 -4
- package/Json/context/rocrate/isa_study_context.js +72 -4
- package/Json/context/rocrate/property_value_context.js +58 -2
- package/Json/context/rocrate/rocrate_context.js +45 -5
- package/Json.js +12 -12
- package/JsonIO/ARC.js +31 -0
- package/JsonIO/Assay.js +99 -0
- package/JsonIO/Comment.js +73 -0
- package/JsonIO/Data.js +50 -0
- package/JsonIO/DataFile.js +49 -0
- package/JsonIO/DataMap/DataMap.js +29 -0
- package/JsonIO/Decode.js +4 -0
- package/JsonIO/Investigation.js +99 -0
- package/JsonIO/OntologyAnnotation.js +73 -0
- package/JsonIO/OntologySourceReference.js +73 -0
- package/JsonIO/Person.js +74 -0
- package/JsonIO/Process/Component.js +50 -0
- package/JsonIO/Process/Factor.js +28 -0
- package/JsonIO/Process/FactorValue.js +29 -0
- package/JsonIO/Process/Material.js +50 -0
- package/JsonIO/Process/MaterialAttribute.js +29 -0
- package/JsonIO/Process/MaterialAttributeValue.js +50 -0
- package/JsonIO/Process/MaterialType.js +28 -0
- package/JsonIO/Process/Process.js +50 -0
- package/JsonIO/Process/ProcessInput.js +29 -0
- package/JsonIO/Process/ProcessOutput.js +50 -0
- package/JsonIO/Process/ProcessParameterValue.js +50 -0
- package/{Json → JsonIO}/Process/ProcessSequence.js +16 -16
- package/JsonIO/Process/Protocol.js +50 -0
- package/JsonIO/Process/ProtocolParameter.js +28 -0
- package/JsonIO/Process/Sample.js +50 -0
- package/JsonIO/Process/Source.js +50 -0
- package/JsonIO/Process/StudyMaterials.js +22 -0
- package/JsonIO/Process/Value.js +23 -0
- package/JsonIO/Publication.js +74 -0
- package/JsonIO/ROCrateObject.js +146 -0
- package/JsonIO/Study.js +99 -0
- package/JsonIO/Table/ArcTable.js +82 -0
- package/JsonIO/Table/CompositeCell.js +28 -0
- package/JsonIO/Table/CompositeHeader.js +28 -0
- package/{Json → JsonIO}/Table/Compression.js +20 -10
- package/JsonIO/Table/IOType.js +28 -0
- package/JsonIO/Table/Templates.js +88 -0
- package/ROCrate/ISAProfile/Assay.js +32 -0
- package/ROCrate/ISAProfile/Data.js +28 -0
- package/ROCrate/ISAProfile/Dataset.js +18 -0
- package/ROCrate/ISAProfile/Investigation.js +35 -0
- package/ROCrate/ISAProfile/LabProcess.js +32 -0
- package/ROCrate/ISAProfile/LabProtocol.js +33 -0
- package/ROCrate/ISAProfile/Person.js +35 -0
- package/ROCrate/ISAProfile/PropertyValue.js +30 -0
- package/ROCrate/ISAProfile/Sample.js +27 -0
- package/ROCrate/ISAProfile/ScholarlyArticle.js +30 -0
- package/ROCrate/ISAProfile/Study.js +35 -0
- package/ROCrate/ROCrateObject.js +61 -0
- package/Spreadsheet/AnnotationTable/ArcTable.js +16 -16
- package/Spreadsheet/AnnotationTable/CompositeCell.js +2 -2
- package/Spreadsheet/AnnotationTable/CompositeColumn.js +7 -7
- package/Spreadsheet/AnnotationTable/CompositeHeader.js +25 -25
- package/Spreadsheet/ArcAssay.js +9 -9
- package/Spreadsheet/ArcInvestigation.js +14 -14
- package/Spreadsheet/ArcStudy.js +7 -7
- package/Spreadsheet/CollectionAux.js +11 -11
- package/Spreadsheet/DataMap.js +3 -3
- package/Spreadsheet/DataMapTable/DataMapColumn.js +6 -6
- package/Spreadsheet/DataMapTable/DataMapHeader.js +23 -23
- package/Spreadsheet/DataMapTable/DataMapTable.js +13 -13
- package/Spreadsheet/Metadata/Assays.js +11 -11
- package/Spreadsheet/Metadata/Comment.js +5 -5
- package/Spreadsheet/Metadata/Contacts.js +7 -7
- package/Spreadsheet/Metadata/Conversions.js +7 -7
- package/Spreadsheet/Metadata/DesignDescriptors.js +1 -1
- package/Spreadsheet/Metadata/Factors.js +8 -8
- package/Spreadsheet/Metadata/OntologyAnnotation.js +6 -6
- package/Spreadsheet/Metadata/OntologySourceReference.js +6 -6
- package/Spreadsheet/Metadata/Protocols.js +9 -9
- package/Spreadsheet/Metadata/Publication.js +7 -7
- package/Spreadsheet/Metadata/SparseTable.js +21 -21
- package/Spreadsheet/Metadata/Study.js +12 -12
- package/Spreadsheet/Template.js +21 -21
- package/Template.Web.js +6 -6
- package/ValidationPackages/ValidationPackage.js +6 -6
- package/ValidationPackages/ValidationPackagesConfig.js +9 -9
- package/WebRequest/WebRequest.Node.js +2 -2
- package/WebRequest/WebRequest.js +2 -2
- package/Xlsx.js +9 -9
- package/Yaml/Encode.js +1 -1
- package/Yaml/ValidationPackage.js +5 -5
- package/Yaml/ValidationPackagesConfig.js +5 -5
- package/fable_modules/DynamicObj.4.0.0/DynObj.fs +219 -0
- package/fable_modules/DynamicObj.4.0.0/DynObj.fs.js +209 -0
- package/fable_modules/DynamicObj.4.0.0/DynamicObj.fableproj +47 -0
- package/fable_modules/DynamicObj.4.0.0/DynamicObj.fs +310 -0
- package/fable_modules/DynamicObj.4.0.0/DynamicObj.fs.js +166 -0
- package/fable_modules/DynamicObj.4.0.0/FableJS.fs +162 -0
- package/fable_modules/DynamicObj.4.0.0/FableJS.fs.js +141 -0
- package/fable_modules/DynamicObj.4.0.0/FablePy.fs +215 -0
- package/fable_modules/DynamicObj.4.0.0/HashCodes.fs +46 -0
- package/fable_modules/DynamicObj.4.0.0/HashCodes.fs.js +43 -0
- package/fable_modules/DynamicObj.4.0.0/PropertyHelper.fs +33 -0
- package/fable_modules/DynamicObj.4.0.0/PropertyHelper.fs.js +21 -0
- package/fable_modules/DynamicObj.4.0.0/ReflectionUtils.fs +72 -0
- package/fable_modules/DynamicObj.4.0.0/ReflectionUtils.fs.js +86 -0
- package/fable_modules/{Thoth.Json.JavaScript.0.1.0/obj/Release → DynamicObj.4.0.0/obj/Debug}/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +1 -1
- package/fable_modules/DynamicObj.4.0.0/obj/Debug/netstandard2.0/DynamicObj.AssemblyInfo.fs +19 -0
- package/fable_modules/{Thoth.Json.Core.0.2.1/obj/Debug → DynamicObj.4.0.0/obj/Release}/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +1 -1
- package/fable_modules/DynamicObj.4.0.0/obj/Release/netstandard2.0/DynamicObj.AssemblyInfo.fs +19 -0
- package/fable_modules/Fable.Fetch.2.6.0/Fetch.fs.js +8 -8
- package/fable_modules/Fable.Promise.2.2.2/Promise.fs.js +6 -6
- package/fable_modules/Fable.SimpleHttp.3.5.0/Http.fs.js +11 -11
- package/fable_modules/Fable.SimpleHttp.3.5.0/Types.fs.js +4 -4
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Cells/FsCell.fs.js +15 -15
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Cells/FsCellsCollection.fs.js +11 -11
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/CellBuilder.fs.js +7 -7
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/ColumnBuilder.fs.js +4 -4
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/DSL.fs.js +3 -3
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/Expression.fs.js +1 -1
- package/fable_modules/FsSpreadsheet.6.3.0-alpha.4/DSL/Operators.fs.js +6 -0
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/RowBuilder.fs.js +4 -4
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/SheetBuilder.fs.js +4 -4
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/TableBuilder.fs.js +4 -4
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/Transform.fs.js +10 -10
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/Types.fs.js +6 -6
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/WorkbookBuilder.fs.js +4 -4
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/FsAddress.fs.js +11 -11
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/FsColumn.fs.js +5 -5
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/FsRow.fs.js +5 -5
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/FsSpreadsheet.fableproj +5 -5
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/FsWorkbook.fs.js +7 -7
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/FsWorksheet.fs.js +11 -11
- package/fable_modules/FsSpreadsheet.6.3.0-alpha.4/Json/Cell.fs.js +64 -0
- package/fable_modules/FsSpreadsheet.6.3.0-alpha.4/Json/Column.fs.js +39 -0
- package/fable_modules/FsSpreadsheet.6.3.0-alpha.4/Json/Row.fs.js +39 -0
- package/fable_modules/FsSpreadsheet.6.3.0-alpha.4/Json/Table.fs.js +30 -0
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Json/Value.fs.js +38 -13
- package/fable_modules/FsSpreadsheet.6.3.0-alpha.4/Json/Workbook.fs.js +46 -0
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Json/Worksheet.fs.js +33 -8
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Ranges/FsRange.fs.js +4 -4
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Ranges/FsRangeAddress.fs.js +4 -4
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Ranges/FsRangeBase.fs.js +4 -4
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Ranges/FsRangeColumn.fs.js +4 -4
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Ranges/FsRangeRow.fs.js +2 -2
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/SheetBuilder.fs.js +10 -10
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Tables/FsTable.fs.js +11 -11
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Tables/FsTableField.fs.js +5 -5
- package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Tables/FsTableRow.fs.js +2 -2
- package/fable_modules/{Thoth.Json.Core.0.2.1 → Thoth.Json.Core.0.4.0}/Decode.fs +67 -28
- package/fable_modules/{Thoth.Json.Core.0.2.1 → Thoth.Json.Core.0.4.0}/Decode.fs.js +79 -50
- package/fable_modules/{Thoth.Json.Core.0.2.1 → Thoth.Json.Core.0.4.0}/Encode.fs +139 -54
- package/fable_modules/Thoth.Json.Core.0.4.0/Encode.fs.js +192 -0
- package/fable_modules/Thoth.Json.Core.0.4.0/Thoth.Json.Core.fableproj +33 -0
- package/fable_modules/{Thoth.Json.Core.0.2.1 → Thoth.Json.Core.0.4.0}/Types.fs +12 -5
- package/fable_modules/{Thoth.Json.Core.0.2.1 → Thoth.Json.Core.0.4.0}/Types.fs.js +2 -2
- package/fable_modules/{Thoth.Json.JavaScript.0.1.0 → Thoth.Json.JavaScript.0.3.0}/Decode.fs +9 -0
- package/fable_modules/{Thoth.Json.JavaScript.0.1.0 → Thoth.Json.JavaScript.0.3.0}/Decode.fs.js +16 -2
- package/fable_modules/{Thoth.Json.JavaScript.0.1.0 → Thoth.Json.JavaScript.0.3.0}/Encode.fs +13 -5
- package/fable_modules/Thoth.Json.JavaScript.0.3.0/Encode.fs.js +58 -0
- package/fable_modules/Thoth.Json.JavaScript.0.3.0/Thoth.Json.JavaScript.fableproj +28 -0
- package/fable_modules/YAMLicious.0.0.1/Decode.fs.js +17 -17
- package/fable_modules/YAMLicious.0.0.1/Encode.fs.js +6 -6
- package/fable_modules/YAMLicious.0.0.1/Library.fs.js +1 -1
- package/fable_modules/YAMLicious.0.0.1/Persil.fs.js +4 -4
- package/fable_modules/YAMLicious.0.0.1/Preprocessing.fs.js +6 -6
- package/fable_modules/YAMLicious.0.0.1/Reader.fs.js +9 -9
- package/fable_modules/YAMLicious.0.0.1/RegexActivePatterns.fs.js +36 -36
- package/fable_modules/YAMLicious.0.0.1/Writer.fs.js +4 -4
- package/fable_modules/YAMLicious.0.0.1/YAMLiciousTypes.fs.js +6 -6
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Array.js +10 -10
- package/fable_modules/fable-library-js.4.22.0/Async.d.ts +27 -0
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Async.js +1 -7
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/AsyncBuilder.d.ts +13 -13
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/BigInt.js +4 -3
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/CHANGELOG.md +40 -1
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Choice.js +2 -2
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Date.js +4 -5
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Decimal.js +6 -6
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/List.js +31 -31
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/MailboxProcessor.d.ts +2 -2
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Map.js +10 -10
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/MutableMap.js +1 -1
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/MutableSet.js +1 -1
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Random.js +2 -2
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Range.js +4 -4
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Reflection.d.ts +1 -1
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/RegExp.js +0 -1
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Result.js +2 -2
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Seq.js +47 -48
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Set.js +3 -3
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/String.d.ts +1 -1
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/String.js +17 -6
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/System.Text.js +1 -1
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/TimeSpan.js +2 -2
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Types.d.ts +2 -2
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Uri.d.ts +2 -0
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Uri.js +19 -2
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Util.d.ts +2 -2
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Util.js +0 -1
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/lib/big.js +0 -1
- package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/package.json +1 -1
- package/fable_modules/project_cracked.json +1 -1
- package/package.json +1 -1
- package/fable_modules/FsSpreadsheet.6.2.0/DSL/Operators.fs.js +0 -6
- package/fable_modules/FsSpreadsheet.6.2.0/Json/Cell.fs.js +0 -38
- package/fable_modules/FsSpreadsheet.6.2.0/Json/Column.fs.js +0 -24
- package/fable_modules/FsSpreadsheet.6.2.0/Json/Row.fs.js +0 -24
- package/fable_modules/FsSpreadsheet.6.2.0/Json/Table.fs.js +0 -15
- package/fable_modules/FsSpreadsheet.6.2.0/Json/Workbook.fs.js +0 -35
- package/fable_modules/Thoth.Json.Core.0.2.1/Encode.fs.js +0 -113
- package/fable_modules/Thoth.Json.Core.0.2.1/Thoth.Json.Core.fableproj +0 -28
- package/fable_modules/Thoth.Json.Core.0.2.1/obj/Debug/netstandard2.0/Thoth.Json.Core.AssemblyInfo.fs +0 -20
- package/fable_modules/Thoth.Json.JavaScript.0.1.0/Encode.fs.js +0 -45
- package/fable_modules/Thoth.Json.JavaScript.0.1.0/Thoth.Json.JavaScript.fableproj +0 -21
- package/fable_modules/Thoth.Json.JavaScript.0.1.0/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -3
- package/fable_modules/Thoth.Json.JavaScript.0.1.0/obj/Debug/netstandard2.0/Thoth.Json.JavaScript.AssemblyInfo.fs +0 -18
- package/fable_modules/Thoth.Json.JavaScript.0.1.0/obj/Release/netstandard2.0/Thoth.Json.JavaScript.AssemblyInfo.fs +0 -19
- package/fable_modules/fable-library-js.4.16.0/Async.d.ts +0 -32
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Cells/FsCell.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Cells/FsCellsCollection.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/CellBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/ColumnBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/DSL.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/Expression.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/Operators.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/RowBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/SheetBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/TableBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/Transform.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/Types.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/DSL/WorkbookBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/FsAddress.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/FsColumn.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/FsRow.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/FsWorkbook.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/FsWorksheet.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Json/Cell.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Json/Column.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Json/Row.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Json/Table.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Json/Value.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Json/Workbook.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Json/Worksheet.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Ranges/FsRange.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Ranges/FsRangeAddress.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Ranges/FsRangeBase.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Ranges/FsRangeColumn.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Ranges/FsRangeRow.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/SheetBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Tables/FsTable.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Tables/FsTableField.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/Tables/FsTableRow.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/obj/Debug/netstandard2.0/FsSpreadsheet.AssemblyInfo.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.2.0 → FsSpreadsheet.6.3.0-alpha.4}/obj/Release/netstandard2.0/FsSpreadsheet.AssemblyInfo.fs +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Array.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/AsyncBuilder.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/BigInt.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/BitConverter.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/BitConverter.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Boolean.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Boolean.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Char.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Char.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Choice.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/ConditionalWeakTable.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/ConditionalWeakTable.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Date.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/DateOffset.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/DateOffset.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/DateOnly.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/DateOnly.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Decimal.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Double.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Double.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Encoding.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Encoding.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Event.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Event.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/FSharp.Collections.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/FSharp.Collections.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/FSharp.Core.CompilerServices.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/FSharp.Core.CompilerServices.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/FSharp.Core.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/FSharp.Core.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Global.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Global.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Guid.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Guid.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Int32.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Int32.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/List.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Long.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Long.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/MailboxProcessor.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Map.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/MapUtil.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/MapUtil.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/MutableMap.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/MutableSet.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Native.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Native.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Numeric.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Numeric.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Observable.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Observable.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Option.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Option.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/README.md +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Random.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Range.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Reflection.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/RegExp.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Result.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Seq.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Seq2.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Seq2.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Set.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/System.Collections.Generic.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/System.Collections.Generic.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/System.Text.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/SystemException.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/SystemException.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/TimeOnly.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/TimeOnly.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/TimeSpan.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Timer.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Timer.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Types.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Unicode.13.0.0.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/Unicode.13.0.0.js +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/big.d.ts +0 -0
- /package/fable_modules/{fable-library-js.4.16.0 → fable-library-js.4.22.0}/lib/big.d.ts +0 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { DynamicObj } from "./DynamicObj.fs.js";
|
|
2
|
+
import { disposeSafe, getEnumerator } from "../fable-library-js.4.22.0/Util.js";
|
|
3
|
+
import { value as value_1 } from "../fable-library-js.4.22.0/Option.js";
|
|
4
|
+
import { printf, toConsole, join } from "../fable-library-js.4.22.0/String.js";
|
|
5
|
+
import { map, delay, toList } from "../fable-library-js.4.22.0/Seq.js";
|
|
6
|
+
import { rangeDouble } from "../fable-library-js.4.22.0/Range.js";
|
|
7
|
+
import { reverse, cons, empty, ofSeq as ofSeq_1, head, tail, isEmpty } from "../fable-library-js.4.22.0/List.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new DynamicObj from a Dictionary containing dynamic properties.
|
|
11
|
+
*/
|
|
12
|
+
export function ofDict(dynamicProperties) {
|
|
13
|
+
return DynamicObj.ofDict(dynamicProperties);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new DynamicObj from a sequence of key value pairs containing dynamic properties.
|
|
18
|
+
*/
|
|
19
|
+
export function ofSeq(dynamicProperties) {
|
|
20
|
+
const dynamicProperties_1 = new Map(new Map(dynamicProperties));
|
|
21
|
+
return DynamicObj.ofDict(dynamicProperties_1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new DynamicObj from a list of key value pairs containing dynamic properties.
|
|
26
|
+
*/
|
|
27
|
+
export function ofList(dynamicProperties) {
|
|
28
|
+
return ofSeq(dynamicProperties);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new DynamicObj from an array of key value pairs containing dynamic properties.
|
|
33
|
+
*/
|
|
34
|
+
export function ofArray(dynamicProperties) {
|
|
35
|
+
return ofSeq(dynamicProperties);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Combines the dynamic properties of the second DynamicObj onto the first.
|
|
40
|
+
*
|
|
41
|
+
* In case of duplicate property names the members of the second object override those of the first.
|
|
42
|
+
*/
|
|
43
|
+
export function combine(first, second) {
|
|
44
|
+
const enumerator = getEnumerator(second.GetProperties(true));
|
|
45
|
+
try {
|
|
46
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
47
|
+
const kv = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
48
|
+
const matchValue = kv[1];
|
|
49
|
+
if (matchValue instanceof DynamicObj) {
|
|
50
|
+
const valueS = matchValue;
|
|
51
|
+
const matchValue_1 = first.TryGetPropertyValue(kv[0]);
|
|
52
|
+
if (matchValue_1 == null) {
|
|
53
|
+
first.SetProperty(kv[0], valueS);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
const tmp = combine(value_1(matchValue_1), valueS);
|
|
57
|
+
first.SetProperty(kv[0], tmp);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
first.SetProperty(kv[0], kv[1]);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
disposeSafe(enumerator);
|
|
67
|
+
}
|
|
68
|
+
return first;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Sets the dynamic (or static) property value with the given name on the given DynamicObj, creating a new dynamic property if none exists.
|
|
73
|
+
*/
|
|
74
|
+
export function setProperty(propertyName, propertyValue, dynObj) {
|
|
75
|
+
dynObj.SetProperty(propertyName, propertyValue);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Sets the dynamic (or static) property value with the given name, creating a new dynamic property if none exists on the given DynamicObj and returns it.
|
|
80
|
+
*/
|
|
81
|
+
export function withProperty(propertyName, propertyValue, dynObj) {
|
|
82
|
+
setProperty(propertyName, propertyValue, dynObj);
|
|
83
|
+
return dynObj;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Sets the dynamic (or static) property value with the given name on the given DynamicObj if the value is Some('TPropertyValue), creating a new dynamic property if none exists.
|
|
88
|
+
* If the given propertyValue is None, does nothing to the input DynamicObj.
|
|
89
|
+
*/
|
|
90
|
+
export function setOptionalProperty(propertyName, propertyValue, dynObj) {
|
|
91
|
+
if (propertyValue == null) {
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
setProperty(propertyName, value_1(propertyValue), dynObj);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Sets the dynamic (or static) property value with the given name on the given DynamicObj if the value is Some('TPropertyValue), creating a new dynamic property if none exists, and returns it.
|
|
100
|
+
* If the given propertyValue is None, does nothing to the input DynamicObj.
|
|
101
|
+
*/
|
|
102
|
+
export function withOptionalProperty(propertyName, propertyValue, dynObj) {
|
|
103
|
+
if (propertyValue == null) {
|
|
104
|
+
return dynObj;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
return withProperty(propertyName, value_1(propertyValue), dynObj);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Sets the given dynamic (or static) property with the result of a mapping function applied to the given property value on the given DynamicObj if the value is Some('TPropertyValue).
|
|
113
|
+
* If the given propertyValue is None, does nothing to the input DynamicObj.
|
|
114
|
+
*/
|
|
115
|
+
export function setOptionalPropertyBy(propertyName, propertyValue, mapping, dynObj) {
|
|
116
|
+
if (propertyValue == null) {
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
setProperty(propertyName, mapping(value_1(propertyValue)), dynObj);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Sets the given dynamic (or static) property with the result of a mapping function applied to the given property value on the given DynamicObj if the value is Some('TPropertyValue) and returns it.
|
|
125
|
+
* If the given propertyValue is None, returns the unchanged DynamicObj.
|
|
126
|
+
*/
|
|
127
|
+
export function withOptionalPropertyBy(propertyName, propertyValue, mapping, dynObj) {
|
|
128
|
+
if (propertyValue == null) {
|
|
129
|
+
return dynObj;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
return withProperty(propertyName, mapping(value_1(propertyValue)), dynObj);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Returns Some(boxed property value) if a dynamic (or static) property with the given name exists on the input, otherwise None.
|
|
138
|
+
*/
|
|
139
|
+
export function tryGetPropertyValue(propertyName, dynObj) {
|
|
140
|
+
return dynObj.TryGetPropertyValue(propertyName);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Removes any dynamic property with the given name from the input DynamicObj.
|
|
145
|
+
* If the property is static and mutable, it will be set to null.
|
|
146
|
+
* Static immutable properties cannot be removed.
|
|
147
|
+
*/
|
|
148
|
+
export function removeProperty(propertyName, dynObj) {
|
|
149
|
+
dynObj.RemoveProperty(propertyName);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Removes any dynamic property with the given name from the input DynamicObj and returns it.
|
|
154
|
+
* If the property is static and mutable, it will be set to null.
|
|
155
|
+
* Static immutable properties cannot be removed.
|
|
156
|
+
*/
|
|
157
|
+
export function withoutProperty(propertyName, dynObj) {
|
|
158
|
+
removeProperty(propertyName, dynObj);
|
|
159
|
+
return dynObj;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Returns a formatted string containing all static and dynamic properties of the given DynamicObj
|
|
164
|
+
*/
|
|
165
|
+
export function format(dynObj) {
|
|
166
|
+
const loop = (object_mut, indentationLevel_mut, membersLeft_mut, acc_mut) => {
|
|
167
|
+
loop:
|
|
168
|
+
while (true) {
|
|
169
|
+
const object = object_mut, indentationLevel = indentationLevel_mut, membersLeft = membersLeft_mut, acc = acc_mut;
|
|
170
|
+
const indent = join("", toList(delay(() => map((i) => " ", rangeDouble(0, 1, indentationLevel - 1)))));
|
|
171
|
+
if (!isEmpty(membersLeft)) {
|
|
172
|
+
const rest = tail(membersLeft);
|
|
173
|
+
const m = head(membersLeft);
|
|
174
|
+
const item = m.GetValue(object);
|
|
175
|
+
const dynamicIndicator = m.IsDynamic ? "?" : "";
|
|
176
|
+
const name = m.Name;
|
|
177
|
+
if (item instanceof DynamicObj) {
|
|
178
|
+
const item_1 = item;
|
|
179
|
+
object_mut = object;
|
|
180
|
+
indentationLevel_mut = indentationLevel;
|
|
181
|
+
membersLeft_mut = rest;
|
|
182
|
+
acc_mut = cons(`${indent}${dynamicIndicator}${name}:${"\n"}${loop(item_1, indentationLevel + 1, ofSeq_1(item_1.GetPropertyHelpers(true)), empty())}`, acc);
|
|
183
|
+
continue loop;
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
object_mut = object;
|
|
187
|
+
indentationLevel_mut = indentationLevel;
|
|
188
|
+
membersLeft_mut = rest;
|
|
189
|
+
acc_mut = cons(`${indent}${dynamicIndicator}${name}: ${item}`, acc);
|
|
190
|
+
continue loop;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
return join("\n", reverse(acc));
|
|
195
|
+
}
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
return loop(dynObj, 0, ofSeq_1(dynObj.GetPropertyHelpers(true)), empty());
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Prints a formatted string containing all static and dynamic properties of the given DynamicObj
|
|
204
|
+
*/
|
|
205
|
+
export function print(dynObj) {
|
|
206
|
+
const arg = format(dynObj);
|
|
207
|
+
toConsole(printf("%s"))(arg);
|
|
208
|
+
}
|
|
209
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
|
2
|
+
|
|
3
|
+
<PropertyGroup>
|
|
4
|
+
<TargetFrameworks>netstandard2.0</TargetFrameworks>
|
|
5
|
+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
|
6
|
+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
|
7
|
+
<IncludeSymbols>true</IncludeSymbols>
|
|
8
|
+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
|
9
|
+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
|
10
|
+
<SignAssembly>true</SignAssembly>
|
|
11
|
+
<AssemblyOriginatorKeyFile>../../key.snk</AssemblyOriginatorKeyFile>
|
|
12
|
+
</PropertyGroup>
|
|
13
|
+
|
|
14
|
+
<PropertyGroup>
|
|
15
|
+
<Authors>Timo Mühlhaus, Kevin Schneider, Heinrich Lukas Weil, F# open source contributors</Authors>
|
|
16
|
+
<Description>F# library supporting Dynamic Objects including inheritance in functional style. Compatible with Fable javascript and python transpilation.</Description>
|
|
17
|
+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
|
18
|
+
<PackageProjectUrl>https://csbiology.github.io/DynamicObj/</PackageProjectUrl>
|
|
19
|
+
<PackageTags>F# FSharp dotnet dynamic object</PackageTags>
|
|
20
|
+
<RepositoryUrl>https://github.com/CSBiology/DynamicObj</RepositoryUrl>
|
|
21
|
+
<RepositoryType>git</RepositoryType>
|
|
22
|
+
<FsDocsLicenseLink>https://github.com/CSBiology/DynamicObj/blob/main/LICENSE</FsDocsLicenseLink>
|
|
23
|
+
<FsDocsReleaseNotesLink>https://github.com/CSBiology/DynamicObj/blob/main/RELEASE_NOTES.md</FsDocsReleaseNotesLink>
|
|
24
|
+
<PackageReadmeFile>README.md</PackageReadmeFile>
|
|
25
|
+
</PropertyGroup>
|
|
26
|
+
|
|
27
|
+
<ItemGroup>
|
|
28
|
+
<Compile Include="HashCodes.fs" />
|
|
29
|
+
<Compile Include="PropertyHelper.fs" />
|
|
30
|
+
<Compile Include="FablePy.fs" />
|
|
31
|
+
<Compile Include="FableJS.fs" />
|
|
32
|
+
<Compile Include="ReflectionUtils.fs" />
|
|
33
|
+
<Compile Include="DynamicObj.fs" />
|
|
34
|
+
<Compile Include="DynObj.fs" />
|
|
35
|
+
<None Include="Playground.fsx" />
|
|
36
|
+
<None Include="..\..\README.md" Pack="true" PackagePath="\"/>
|
|
37
|
+
</ItemGroup>
|
|
38
|
+
|
|
39
|
+
<ItemGroup>
|
|
40
|
+
<PackageReference Include="Fable.Core" Version="4.3.0" />
|
|
41
|
+
</ItemGroup>
|
|
42
|
+
|
|
43
|
+
<ItemGroup>
|
|
44
|
+
<Content Include="*.fsproj; **\*.fs; **\*.fsi" PackagePath="fable\" />
|
|
45
|
+
</ItemGroup>
|
|
46
|
+
|
|
47
|
+
</Project>
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
namespace DynamicObj
|
|
2
|
+
|
|
3
|
+
#if !FABLE_COMPILER
|
|
4
|
+
open System.Dynamic
|
|
5
|
+
#endif
|
|
6
|
+
|
|
7
|
+
open System.Collections.Generic
|
|
8
|
+
open Fable.Core
|
|
9
|
+
|
|
10
|
+
[<AttachMembers>]
|
|
11
|
+
type DynamicObj() =
|
|
12
|
+
|
|
13
|
+
#if !FABLE_COMPILER
|
|
14
|
+
inherit DynamicObject()
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
let mutable properties = new Dictionary<string, obj>()
|
|
18
|
+
|
|
19
|
+
/// <summary>
|
|
20
|
+
/// A dictionary of dynamic boxed properties
|
|
21
|
+
/// </summary>
|
|
22
|
+
member this.Properties
|
|
23
|
+
with get() = properties
|
|
24
|
+
and internal set(value) = properties <- value
|
|
25
|
+
|
|
26
|
+
/// <summary>
|
|
27
|
+
/// Creates a new DynamicObj from a Dictionary containing dynamic properties.
|
|
28
|
+
/// </summary>
|
|
29
|
+
/// <param name="dynamicProperties">The dictionary with the dynamic properties</param>
|
|
30
|
+
static member ofDict (dynamicProperties: Dictionary<string,obj>) =
|
|
31
|
+
let obj = DynamicObj()
|
|
32
|
+
obj.Properties <- dynamicProperties
|
|
33
|
+
obj
|
|
34
|
+
|
|
35
|
+
/// <summary>
|
|
36
|
+
/// Returns Some(PropertyHelper) if a static property with the given name exists, otherwise None.
|
|
37
|
+
/// </summary>
|
|
38
|
+
/// <param name="propertyName">The name of the property to get the PropertyHelper for</param>
|
|
39
|
+
member this.TryGetStaticPropertyHelper (propertyName: string) : PropertyHelper option =
|
|
40
|
+
ReflectionUtils.tryGetStaticPropertyInfo this propertyName
|
|
41
|
+
|
|
42
|
+
/// <summary>
|
|
43
|
+
/// Returns Some(PropertyHelper) if a dynamic property with the given name exists, otherwise None.
|
|
44
|
+
/// </summary>
|
|
45
|
+
/// <param name="propertyName">The name of the property to get the PropertyHelper for</param>
|
|
46
|
+
member this.TryGetDynamicPropertyHelper (propertyName: string) : PropertyHelper option =
|
|
47
|
+
#if FABLE_COMPILER_JAVASCRIPT || FABLE_COMPILER_TYPESCRIPT
|
|
48
|
+
FableJS.tryGetDynamicPropertyHelper this propertyName
|
|
49
|
+
#endif
|
|
50
|
+
#if FABLE_COMPILER_PYTHON
|
|
51
|
+
FablePy.tryGetDynamicPropertyHelper this propertyName
|
|
52
|
+
#endif
|
|
53
|
+
#if !FABLE_COMPILER
|
|
54
|
+
match properties.TryGetValue propertyName with
|
|
55
|
+
| true,_ ->
|
|
56
|
+
Some {
|
|
57
|
+
Name = propertyName
|
|
58
|
+
IsStatic = false
|
|
59
|
+
IsDynamic = true
|
|
60
|
+
IsMutable = true
|
|
61
|
+
IsImmutable = false
|
|
62
|
+
GetValue = fun o -> properties.[propertyName]
|
|
63
|
+
SetValue = fun o v -> properties.[propertyName] <- v
|
|
64
|
+
RemoveValue = fun o -> properties.Remove(propertyName) |> ignore
|
|
65
|
+
}
|
|
66
|
+
| _ -> None
|
|
67
|
+
#endif
|
|
68
|
+
|
|
69
|
+
/// <summary>
|
|
70
|
+
/// Returns Some(PropertyHelper) if a property (static or dynamic) with the given name exists, otherwise None.
|
|
71
|
+
/// </summary>
|
|
72
|
+
/// <param name="propertyName">The name of the property to get the PropertyHelper for</param>
|
|
73
|
+
member this.TryGetPropertyHelper (propertyName: string) : PropertyHelper option =
|
|
74
|
+
match this.TryGetStaticPropertyHelper propertyName with
|
|
75
|
+
| Some pi -> Some pi
|
|
76
|
+
| None -> this.TryGetDynamicPropertyHelper propertyName
|
|
77
|
+
|
|
78
|
+
/// <summary>
|
|
79
|
+
/// Returns Some(boxed property value) if a dynamic (or static) property with the given name exists, otherwise None.
|
|
80
|
+
/// </summary>
|
|
81
|
+
/// <param name="name">the name of the property to get</param>
|
|
82
|
+
member this.TryGetPropertyValue (propertyName: string) =
|
|
83
|
+
// first check the Properties collection for member
|
|
84
|
+
this.TryGetPropertyHelper(propertyName)
|
|
85
|
+
|> Option.map (fun pi -> pi.GetValue(this))
|
|
86
|
+
|
|
87
|
+
/// <summary>
|
|
88
|
+
/// Returns the boxed property value of the dynamic (or static) property with the given name.
|
|
89
|
+
/// </summary>
|
|
90
|
+
/// <param name="propertyName">the name of the property to get</param>
|
|
91
|
+
/// <exception cref="System.MissingMemberException">Thrown if no dynamic or static property with the given name exists</exception>
|
|
92
|
+
member this.GetPropertyValue (propertyName: string) =
|
|
93
|
+
match this.TryGetPropertyValue(propertyName) with
|
|
94
|
+
| Some value -> value
|
|
95
|
+
| None -> raise <| System.MissingMemberException($"No dynamic or static property \"{propertyName}\" does exist on object.")
|
|
96
|
+
|
|
97
|
+
#if !FABLE_COMPILER
|
|
98
|
+
|
|
99
|
+
/// <summary>
|
|
100
|
+
/// Returns Some('TPropertyValue) when a dynamic (or static) property with the given name and type exists, otherwise None.
|
|
101
|
+
///
|
|
102
|
+
/// This method is not Fable-compatible and can therefore not be used in code that will be transpiled.
|
|
103
|
+
/// </summary>
|
|
104
|
+
/// <param name="propertyName">the name of the property to get</param>
|
|
105
|
+
/// <remarks>This method is not Fable-compatible and can therefore not be used in code that will be transpiled.</remarks>
|
|
106
|
+
member this.TryGetTypedPropertyValue<'TPropertyValue> (propertyName: string) =
|
|
107
|
+
|
|
108
|
+
match (this.TryGetPropertyValue propertyName) with
|
|
109
|
+
| None -> None
|
|
110
|
+
| Some o ->
|
|
111
|
+
match o with
|
|
112
|
+
| :? 'TPropertyValue as o -> o |> Some
|
|
113
|
+
| _ -> None
|
|
114
|
+
#endif
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
/// <summary>
|
|
118
|
+
/// Sets the dynamic (or static) property value with the given name, creating a new dynamic property if none exists.
|
|
119
|
+
/// </summary>
|
|
120
|
+
/// <param name="propertyName">the name of the property to set</param>
|
|
121
|
+
/// <param name="propertyValue">the value of the property to set</param>
|
|
122
|
+
member this.SetProperty (
|
|
123
|
+
propertyName: string,
|
|
124
|
+
propertyValue: obj
|
|
125
|
+
) =
|
|
126
|
+
// first check to see if there's a native property to set
|
|
127
|
+
match this.TryGetStaticPropertyHelper propertyName with
|
|
128
|
+
| Some pi ->
|
|
129
|
+
if pi.IsMutable then
|
|
130
|
+
pi.SetValue this propertyValue
|
|
131
|
+
else
|
|
132
|
+
failwith $"Cannot set value for static, immutable property \"{propertyName}\""
|
|
133
|
+
| None ->
|
|
134
|
+
#if FABLE_COMPILER_JAVASCRIPT || FABLE_COMPILER_TYPESCRIPT
|
|
135
|
+
FableJS.setPropertyValue this propertyName propertyValue
|
|
136
|
+
#endif
|
|
137
|
+
#if FABLE_COMPILER_PYTHON
|
|
138
|
+
FablePy.setPropertyValue this propertyName propertyValue
|
|
139
|
+
#endif
|
|
140
|
+
#if !FABLE_COMPILER
|
|
141
|
+
// Next check the Properties collection for member
|
|
142
|
+
match properties.TryGetValue propertyName with
|
|
143
|
+
| true,_ -> properties.[propertyName] <- propertyValue
|
|
144
|
+
| _ -> properties.Add(propertyName,propertyValue)
|
|
145
|
+
#endif
|
|
146
|
+
|
|
147
|
+
/// <summary>
|
|
148
|
+
/// Removes any dynamic property with the given name from the input DynamicObj.
|
|
149
|
+
/// If the property is static and mutable, it will be set to null.
|
|
150
|
+
/// Static immutable properties cannot be removed.
|
|
151
|
+
/// </summary>
|
|
152
|
+
/// <param name="propertyName">the name of the property to remove</param>
|
|
153
|
+
/// <exception cref="System.MemberAccessException">Thrown if the dynamic property does not exist</exception>
|
|
154
|
+
member this.RemoveProperty (propertyName: string) =
|
|
155
|
+
match this.TryGetPropertyHelper propertyName with
|
|
156
|
+
| Some pi when pi.IsMutable ->
|
|
157
|
+
pi.RemoveValue this
|
|
158
|
+
true
|
|
159
|
+
| Some _ ->
|
|
160
|
+
raise <| System.MemberAccessException($"Cannot remove value for static, immutable property \"{propertyName}\"")
|
|
161
|
+
| None -> false
|
|
162
|
+
|
|
163
|
+
/// <summary>
|
|
164
|
+
/// Returns PropertyHelpers for all dynamic properties of the DynamicObj.
|
|
165
|
+
///
|
|
166
|
+
/// When includeInstanceProperties is set to true, instance properties (= 'static' properties on the class) are included in the result.
|
|
167
|
+
/// </summary>
|
|
168
|
+
/// <param name="includeInstanceProperties">whether to include instance properties (= 'static' properties on the class)</param>
|
|
169
|
+
member this.GetPropertyHelpers (includeInstanceProperties: bool) =
|
|
170
|
+
#if FABLE_COMPILER_JAVASCRIPT || FABLE_COMPILER_TYPESCRIPT
|
|
171
|
+
FableJS.getPropertyHelpers this
|
|
172
|
+
|> Seq.filter (fun pd ->
|
|
173
|
+
includeInstanceProperties || pd.IsDynamic
|
|
174
|
+
)
|
|
175
|
+
#endif
|
|
176
|
+
#if FABLE_COMPILER_PYTHON
|
|
177
|
+
FablePy.getPropertyHelpers this
|
|
178
|
+
|> Seq.filter (fun pd ->
|
|
179
|
+
includeInstanceProperties || pd.IsDynamic
|
|
180
|
+
)
|
|
181
|
+
#endif
|
|
182
|
+
#if !FABLE_COMPILER
|
|
183
|
+
seq [
|
|
184
|
+
if includeInstanceProperties then
|
|
185
|
+
yield! ReflectionUtils.getStaticProperties (this)
|
|
186
|
+
for key in properties.Keys ->
|
|
187
|
+
{
|
|
188
|
+
Name = key
|
|
189
|
+
IsStatic = false
|
|
190
|
+
IsDynamic = true
|
|
191
|
+
IsMutable = true
|
|
192
|
+
IsImmutable = false
|
|
193
|
+
GetValue = fun o -> properties.[key]
|
|
194
|
+
SetValue = fun o v -> properties.[key] <- v
|
|
195
|
+
RemoveValue = fun o -> properties.Remove(key) |> ignore
|
|
196
|
+
}
|
|
197
|
+
]
|
|
198
|
+
#endif
|
|
199
|
+
|> Seq.filter (fun p -> p.Name.ToLower() <> "properties")
|
|
200
|
+
|
|
201
|
+
/// <summary>
|
|
202
|
+
/// Returns a sequence of all dynamic properties as a key value pair of the property names and the boxed property values.
|
|
203
|
+
///
|
|
204
|
+
/// When includeInstanceProperties is set to true, instance properties (= 'static' properties on the class) are included in the result.
|
|
205
|
+
/// </summary>
|
|
206
|
+
/// <param name="includeInstanceProperties">whether to include instance properties (= 'static' properties on the class)</param>
|
|
207
|
+
member this.GetProperties includeInstanceProperties : seq<KeyValuePair<string,obj>> =
|
|
208
|
+
this.GetPropertyHelpers(includeInstanceProperties)
|
|
209
|
+
|> Seq.choose (fun kv ->
|
|
210
|
+
if kv.Name <> "properties" then
|
|
211
|
+
Some (KeyValuePair(kv.Name, kv.GetValue this))
|
|
212
|
+
else
|
|
213
|
+
None
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
/// <summary>
|
|
217
|
+
/// Returns a sequence of all dynamic property names.
|
|
218
|
+
///
|
|
219
|
+
/// When includeInstanceProperties is set to true, instance properties (= 'static' properties on the class) are included in the result.
|
|
220
|
+
/// </summary>
|
|
221
|
+
/// <param name="includeInstanceProperties"></param>
|
|
222
|
+
member this.GetPropertyNames(includeInstanceProperties) =
|
|
223
|
+
this.GetProperties(includeInstanceProperties)
|
|
224
|
+
|> Seq.map (fun kv -> kv.Key)
|
|
225
|
+
|
|
226
|
+
/// <summary>
|
|
227
|
+
/// Copies all dynamic members of the DynamicObj to the target DynamicObj.
|
|
228
|
+
///
|
|
229
|
+
/// If overWrite is set to true, existing properties on the target object will be overwritten.
|
|
230
|
+
///
|
|
231
|
+
/// Note that this method will not perform nested checks, e.g. if a property is a DynamicObj itself, it will not be copied recursively.
|
|
232
|
+
/// </summary>
|
|
233
|
+
/// <param name="target">The target object to copy dynamic members to</param>
|
|
234
|
+
/// <param name="overWrite">Whether existing properties on the target object will be overwritten</param>
|
|
235
|
+
member this.CopyDynamicPropertiesTo(target:#DynamicObj, ?overWrite) =
|
|
236
|
+
let overWrite = defaultArg overWrite false
|
|
237
|
+
this.GetProperties(false)
|
|
238
|
+
|> Seq.iter (fun kv ->
|
|
239
|
+
match target.TryGetPropertyHelper kv.Key with
|
|
240
|
+
| Some pi when overWrite -> pi.SetValue target kv.Value
|
|
241
|
+
| Some _ -> failwith $"Property \"{kv.Key}\" already exists on target object and overWrite was not set to true."
|
|
242
|
+
| None -> target.SetProperty(kv.Key,kv.Value)
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
/// <summary>
|
|
246
|
+
/// Returns a new DynamicObj with only the dynamic properties of the original DynamicObj (sans instance properties).
|
|
247
|
+
/// </summary>
|
|
248
|
+
member this.CopyDynamicProperties() =
|
|
249
|
+
let target = DynamicObj()
|
|
250
|
+
this.CopyDynamicPropertiesTo(target)
|
|
251
|
+
target
|
|
252
|
+
|
|
253
|
+
#if !FABLE_COMPILER
|
|
254
|
+
// Some necessary overrides for methods inherited from System.Dynamic.DynamicObject()
|
|
255
|
+
//
|
|
256
|
+
// Needed mainly for making Newtonsoft.Json Serialization work
|
|
257
|
+
override this.TryGetMember(binder:GetMemberBinder,result:obj byref ) =
|
|
258
|
+
match this.TryGetPropertyValue binder.Name with
|
|
259
|
+
| Some value -> result <- value; true
|
|
260
|
+
| None -> false
|
|
261
|
+
|
|
262
|
+
override this.TrySetMember(binder:SetMemberBinder, value:obj) =
|
|
263
|
+
this.SetProperty(binder.Name,value)
|
|
264
|
+
true
|
|
265
|
+
|
|
266
|
+
/// Returns both instance and dynamic member names.
|
|
267
|
+
/// Important to return both so JSON serialization with Json.NET works.
|
|
268
|
+
override this.GetDynamicMemberNames() = this.GetPropertyNames(true)
|
|
269
|
+
|
|
270
|
+
//// potential deserialization support
|
|
271
|
+
//[<JsonExtensionData>]
|
|
272
|
+
//member private this._additionalData : IDictionary<string, JToken> = new Dictionary<string, JToken>()
|
|
273
|
+
|
|
274
|
+
//[<OnDeserialized>]
|
|
275
|
+
//member private this.OnDeserialized(context:StreamingContext) = ()
|
|
276
|
+
// map over key value pairs in additional data, box the token values and set dynamic properties via SetProperty.
|
|
277
|
+
|
|
278
|
+
#endif
|
|
279
|
+
|
|
280
|
+
/// <summary>
|
|
281
|
+
/// Operator to access a property by name
|
|
282
|
+
///
|
|
283
|
+
/// This method is not Fable-compatible and can therefore not be used in code that will be transpiled.
|
|
284
|
+
/// </summary>
|
|
285
|
+
/// <remarks>This method is not Fable-compatible and can therefore not be used in code that will be transpiled.</remarks>
|
|
286
|
+
static member (?) (lookup:#DynamicObj,name:string) =
|
|
287
|
+
match lookup.TryGetPropertyValue name with
|
|
288
|
+
| Some(value) -> value
|
|
289
|
+
| None -> raise <| System.MemberAccessException()
|
|
290
|
+
|
|
291
|
+
/// <summary>
|
|
292
|
+
/// Operator to set a property value
|
|
293
|
+
///
|
|
294
|
+
/// This method is not Fable-compatible and can therefore not be used in code that will be transpiled.
|
|
295
|
+
/// </summary>
|
|
296
|
+
/// <remarks>This method is not Fable-compatible and can therefore not be used in code that will be transpiled.</remarks>
|
|
297
|
+
static member (?<-) (lookup:#DynamicObj,name:string,value:'v) =
|
|
298
|
+
lookup.SetProperty (name,value)
|
|
299
|
+
|
|
300
|
+
override this.GetHashCode () =
|
|
301
|
+
this.GetProperties(true)
|
|
302
|
+
|> Seq.sortBy (fun pair -> pair.Key)
|
|
303
|
+
|> HashCodes.boxHashKeyValSeq
|
|
304
|
+
|> fun x -> x :?> int
|
|
305
|
+
|
|
306
|
+
override this.Equals o =
|
|
307
|
+
match o with
|
|
308
|
+
| :? DynamicObj as other ->
|
|
309
|
+
this.GetHashCode() = other.GetHashCode()
|
|
310
|
+
| _ -> false
|