@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.
Files changed (335) hide show
  1. package/ARC.js +47 -11
  2. package/Contract/Contract.js +3 -3
  3. package/Contracts/Contracts.ArcTypes.js +30 -18
  4. package/Contracts/Contracts.Git.js +4 -4
  5. package/FileSystem/Commit.js +2 -2
  6. package/FileSystem/FileSystem.js +4 -4
  7. package/FileSystem/FileSystemTree.js +8 -8
  8. package/FileSystem/Path.js +2 -2
  9. package/FileSystemTree.js +1 -1
  10. package/ISA/ISA/ArcTypes/ArcTable.js +23 -31
  11. package/ISA/ISA/ArcTypes/ArcTableAux.js +27 -16
  12. package/ISA/ISA/ArcTypes/ArcTables.js +11 -11
  13. package/ISA/ISA/ArcTypes/ArcTypes.js +118 -83
  14. package/ISA/ISA/ArcTypes/CompositeCell.js +4 -4
  15. package/ISA/ISA/ArcTypes/CompositeColumn.js +8 -7
  16. package/ISA/ISA/ArcTypes/CompositeHeader.js +5 -5
  17. package/ISA/ISA/ArcTypes/CompositeRow.js +1 -1
  18. package/ISA/ISA/Builder/Types.js +5 -5
  19. package/ISA/ISA/Fable.js +6 -6
  20. package/ISA/ISA/Helper.js +15 -13
  21. package/ISA/ISA/Identifier.js +1 -1
  22. package/ISA/ISA/JsonTypes/Assay.js +8 -8
  23. package/ISA/ISA/JsonTypes/AssayMaterials.js +4 -4
  24. package/ISA/ISA/JsonTypes/ColumnIndex.js +5 -5
  25. package/ISA/ISA/JsonTypes/Comment.js +3 -3
  26. package/ISA/ISA/JsonTypes/CommentList.js +4 -4
  27. package/ISA/ISA/JsonTypes/Component.js +4 -4
  28. package/ISA/ISA/JsonTypes/Data.js +4 -4
  29. package/ISA/ISA/JsonTypes/DataFile.js +2 -2
  30. package/ISA/ISA/JsonTypes/Factor.js +6 -6
  31. package/ISA/ISA/JsonTypes/FactorValue.js +5 -5
  32. package/ISA/ISA/JsonTypes/Investigation.js +6 -6
  33. package/ISA/ISA/JsonTypes/Material.js +5 -5
  34. package/ISA/ISA/JsonTypes/MaterialAttribute.js +3 -3
  35. package/ISA/ISA/JsonTypes/MaterialAttributeValue.js +5 -5
  36. package/ISA/ISA/JsonTypes/MaterialType.js +2 -2
  37. package/ISA/ISA/JsonTypes/OntologyAnnotation.js +6 -6
  38. package/ISA/ISA/JsonTypes/OntologySourceReference.js +6 -6
  39. package/ISA/ISA/JsonTypes/Person.js +23 -8
  40. package/ISA/ISA/JsonTypes/Process.js +13 -13
  41. package/ISA/ISA/JsonTypes/ProcessInput.js +5 -5
  42. package/ISA/ISA/JsonTypes/ProcessOutput.js +5 -5
  43. package/ISA/ISA/JsonTypes/ProcessParameterValue.js +5 -5
  44. package/ISA/ISA/JsonTypes/ProcessSequence.js +6 -6
  45. package/ISA/ISA/JsonTypes/Protocol.js +6 -6
  46. package/ISA/ISA/JsonTypes/ProtocolParameter.js +3 -3
  47. package/ISA/ISA/JsonTypes/Publication.js +6 -6
  48. package/ISA/ISA/JsonTypes/Sample.js +5 -5
  49. package/ISA/ISA/JsonTypes/Source.js +5 -5
  50. package/ISA/ISA/JsonTypes/Study.js +8 -8
  51. package/ISA/ISA/JsonTypes/StudyMaterials.js +4 -4
  52. package/ISA/ISA/JsonTypes/Value.js +22 -29
  53. package/ISA/ISA/Regex.js +3 -3
  54. package/ISA/ISA.Json/ArcTypes/ArcAssay.js +157 -65
  55. package/ISA/ISA.Json/ArcTypes/ArcInvestigation.js +78 -49
  56. package/ISA/ISA.Json/ArcTypes/ArcStudy.js +136 -24
  57. package/ISA/ISA.Json/ArcTypes/ArcTable.js +183 -21
  58. package/ISA/ISA.Json/ArcTypes/CellTable.js +40 -0
  59. package/ISA/ISA.Json/ArcTypes/CompositeCell.js +34 -23
  60. package/ISA/ISA.Json/ArcTypes/CompositeHeader.js +18 -46
  61. package/ISA/ISA.Json/ArcTypes/IOType.js +11 -13
  62. package/ISA/ISA.Json/ArcTypes/OATable.js +42 -0
  63. package/ISA/ISA.Json/Assay.js +71 -47
  64. package/ISA/ISA.Json/Comment.js +31 -35
  65. package/ISA/ISA.Json/ConverterOptions.js +19 -1
  66. package/ISA/ISA.Json/Data.js +119 -137
  67. package/ISA/ISA.Json/Decode.js +51 -36
  68. package/ISA/ISA.Json/Factor.js +90 -90
  69. package/ISA/ISA.Json/GEncode.js +31 -6
  70. package/ISA/ISA.Json/Investigation.js +54 -79
  71. package/ISA/ISA.Json/Material.js +103 -104
  72. package/ISA/ISA.Json/Ontology.js +99 -92
  73. package/ISA/ISA.Json/Person.js +47 -65
  74. package/ISA/ISA.Json/Process.js +144 -130
  75. package/ISA/ISA.Json/Protocol.js +144 -105
  76. package/ISA/ISA.Json/Publication.js +34 -40
  77. package/ISA/ISA.Json/StringTable.js +44 -0
  78. package/ISA/ISA.Json/Study.js +70 -96
  79. package/ISA/ISA.Json/context/rocrate/isa_assay_context.js +34 -0
  80. package/ISA/ISA.Json/context/rocrate/isa_comment_context.js +23 -0
  81. package/ISA/ISA.Json/context/rocrate/isa_component_context.js +24 -0
  82. package/ISA/ISA.Json/context/rocrate/isa_data_context.js +25 -0
  83. package/ISA/ISA.Json/context/rocrate/isa_factor_context.js +25 -0
  84. package/ISA/ISA.Json/context/rocrate/isa_factor_value_context.js +25 -0
  85. package/ISA/ISA.Json/context/rocrate/isa_investigation_context.js +33 -0
  86. package/ISA/ISA.Json/context/rocrate/isa_material_attribute_context.js +23 -0
  87. package/ISA/ISA.Json/context/rocrate/isa_material_attribute_value_context.js +25 -0
  88. package/ISA/ISA.Json/context/rocrate/isa_material_context.js +26 -0
  89. package/ISA/ISA.Json/context/rocrate/isa_ontology_annotation_context.js +25 -0
  90. package/ISA/ISA.Json/context/rocrate/isa_ontology_source_reference_context.js +26 -0
  91. package/ISA/ISA.Json/context/rocrate/isa_organization_context.js +22 -0
  92. package/ISA/ISA.Json/context/rocrate/isa_person_context.js +31 -0
  93. package/ISA/ISA.Json/context/rocrate/isa_process_context.js +31 -0
  94. package/ISA/ISA.Json/context/rocrate/isa_process_parameter_value_context.js +25 -0
  95. package/ISA/ISA.Json/context/rocrate/isa_protocol_context.js +30 -0
  96. package/ISA/ISA.Json/context/rocrate/isa_protocol_parameter_context.js +23 -0
  97. package/ISA/ISA.Json/context/rocrate/isa_publication_context.js +27 -0
  98. package/ISA/ISA.Json/context/rocrate/isa_sample_context.js +26 -0
  99. package/ISA/ISA.Json/context/rocrate/isa_source_context.js +25 -0
  100. package/ISA/ISA.Json/context/rocrate/isa_study_context.js +42 -0
  101. package/ISA/ISA.Json/context/rocrate/rocrate_context.js +25 -0
  102. package/ISA/ISA.Spreadsheet/AnnotationTable/ArcTable.js +56 -43
  103. package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeCell.js +3 -3
  104. package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeColumn.js +11 -11
  105. package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeHeader.js +5 -5
  106. package/ISA/ISA.Spreadsheet/ArcAssay.js +100 -88
  107. package/ISA/ISA.Spreadsheet/ArcInvestigation.js +12 -12
  108. package/ISA/ISA.Spreadsheet/ArcStudy.js +36 -24
  109. package/ISA/ISA.Spreadsheet/CollectionAux.js +8 -8
  110. package/ISA/ISA.Spreadsheet/Metadata/Assays.js +5 -5
  111. package/ISA/ISA.Spreadsheet/Metadata/Comment.js +31 -20
  112. package/ISA/ISA.Spreadsheet/Metadata/Contacts.js +5 -5
  113. package/ISA/ISA.Spreadsheet/Metadata/Conversions.js +5 -5
  114. package/ISA/ISA.Spreadsheet/Metadata/DesignDescriptors.js +1 -1
  115. package/ISA/ISA.Spreadsheet/Metadata/Factors.js +5 -5
  116. package/ISA/ISA.Spreadsheet/Metadata/OntologyAnnotation.js +5 -5
  117. package/ISA/ISA.Spreadsheet/Metadata/OntologySourceReference.js +5 -5
  118. package/ISA/ISA.Spreadsheet/Metadata/Protocols.js +5 -5
  119. package/ISA/ISA.Spreadsheet/Metadata/Publication.js +5 -5
  120. package/ISA/ISA.Spreadsheet/Metadata/SparseTable.js +28 -23
  121. package/ISA/ISA.Spreadsheet/Metadata/Study.js +8 -8
  122. package/README.md +20 -3
  123. package/SemVer.js +6 -6
  124. package/Templates/Template.Json.js +43 -36
  125. package/Templates/Template.Spreadsheet.js +12 -12
  126. package/Templates/Template.Web.js +4 -4
  127. package/Templates/Template.js +7 -7
  128. package/Templates/Templates.js +7 -7
  129. package/WebRequest/WebRequest.Node.js +15 -0
  130. package/WebRequest/WebRequest.js +10 -29
  131. package/fable_modules/Fable.Fetch.2.6.0/Fetch.fs.js +7 -7
  132. package/fable_modules/Fable.Promise.2.2.2/Promise.fs.js +3 -3
  133. package/fable_modules/Fable.SimpleHttp.3.5.0/Http.fs.js +8 -8
  134. package/fable_modules/Fable.SimpleHttp.3.5.0/Types.fs.js +2 -2
  135. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Cells/FsCell.fs.js +14 -14
  136. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Cells/FsCellsCollection.fs.js +6 -6
  137. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/CellBuilder.fs.js +4 -4
  138. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/ColumnBuilder.fs.js +3 -3
  139. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/DSL.fs.js +2 -2
  140. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/Expression.fs.js +1 -1
  141. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/RowBuilder.fs.js +3 -3
  142. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/SheetBuilder.fs.js +3 -3
  143. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/TableBuilder.fs.js +3 -3
  144. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/Transform.fs.js +6 -6
  145. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/Types.fs.js +4 -4
  146. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/WorkbookBuilder.fs.js +3 -3
  147. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsAddress.fs +22 -8
  148. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsAddress.fs.js +24 -14
  149. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsColumn.fs.js +3 -3
  150. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsRow.fs.js +3 -3
  151. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsWorkbook.fs.js +6 -6
  152. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsWorksheet.fs +12 -6
  153. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsWorksheet.fs.js +21 -17
  154. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Ranges/FsRange.fs.js +3 -3
  155. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Ranges/FsRangeAddress.fs.js +4 -3
  156. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Ranges/FsRangeBase.fs.js +3 -3
  157. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Ranges/FsRangeColumn.fs.js +3 -3
  158. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Ranges/FsRangeRow.fs.js +1 -1
  159. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/SheetBuilder.fs.js +8 -8
  160. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Tables/FsTable.fs.js +7 -7
  161. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Tables/FsTableField.fs.js +4 -4
  162. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Tables/FsTableRow.fs.js +1 -1
  163. package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/obj/Release/netstandard2.0/FsSpreadsheet.AssemblyInfo.fs +3 -3
  164. package/fable_modules/Thoth.Json.Core.0.2.1/Decode.fs +1390 -0
  165. package/fable_modules/Thoth.Json.Core.0.2.1/Decode.fs.js +1230 -0
  166. package/fable_modules/Thoth.Json.Core.0.2.1/Encode.fs +233 -0
  167. package/fable_modules/Thoth.Json.Core.0.2.1/Encode.fs.js +113 -0
  168. package/fable_modules/Thoth.Json.Core.0.2.1/Thoth.Json.Core.fableproj +28 -0
  169. package/fable_modules/Thoth.Json.Core.0.2.1/Types.fs +76 -0
  170. package/fable_modules/Thoth.Json.Core.0.2.1/Types.fs.js +33 -0
  171. package/fable_modules/Thoth.Json.Core.0.2.1/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
  172. 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
  173. package/fable_modules/Thoth.Json.JavaScript.0.1.0/Decode.fs +79 -0
  174. package/fable_modules/Thoth.Json.JavaScript.0.1.0/Decode.fs.js +85 -0
  175. package/fable_modules/Thoth.Json.JavaScript.0.1.0/Encode.fs +32 -0
  176. package/fable_modules/Thoth.Json.JavaScript.0.1.0/Encode.fs.js +45 -0
  177. package/fable_modules/Thoth.Json.JavaScript.0.1.0/Thoth.Json.JavaScript.fableproj +21 -0
  178. package/fable_modules/Thoth.Json.JavaScript.0.1.0/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
  179. package/fable_modules/Thoth.Json.JavaScript.0.1.0/obj/Debug/netstandard2.0/Thoth.Json.JavaScript.AssemblyInfo.fs +18 -0
  180. package/fable_modules/Thoth.Json.JavaScript.0.1.0/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
  181. package/fable_modules/Thoth.Json.JavaScript.0.1.0/obj/Release/netstandard2.0/Thoth.Json.JavaScript.AssemblyInfo.fs +19 -0
  182. package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Array.d.ts +4 -1
  183. package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Array.js +124 -86
  184. package/fable_modules/fable-library-js.4.13.0/CHANGELOG.md +29 -0
  185. package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Choice.d.ts +0 -17
  186. package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Choice.js +0 -43
  187. package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Date.js +3 -2
  188. package/fable_modules/fable-library-js.4.13.0/FSharp.Core.CompilerServices.d.ts +12 -0
  189. package/fable_modules/fable-library-js.4.13.0/FSharp.Core.CompilerServices.js +27 -0
  190. package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/List.js +3 -3
  191. package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Map.js +3 -3
  192. package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/MutableMap.js +2 -1
  193. package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/MutableSet.js +2 -1
  194. package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Random.js +7 -7
  195. package/fable_modules/fable-library-js.4.13.0/Result.d.ts +37 -0
  196. package/fable_modules/fable-library-js.4.13.0/Result.js +165 -0
  197. package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Set.js +2 -2
  198. package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/String.d.ts +1 -0
  199. package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/String.js +8 -5
  200. package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/System.Collections.Generic.d.ts +15 -7
  201. package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/System.Collections.Generic.js +46 -36
  202. package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/System.Text.d.ts +9 -1
  203. package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/System.Text.js +60 -8
  204. package/fable_modules/fable-library-js.4.13.0/big.d.ts +338 -0
  205. package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/package.json +4 -3
  206. package/fable_modules/project_cracked.json +1 -1
  207. package/package.json +1 -1
  208. package/ISA/ISA.Json/Validation/Fable.js +0 -69
  209. package/ISA/ISA.Json/Validation/JsonSchemaValidation.js +0 -88
  210. package/ISA/ISA.Json/Validation/ValidationResult.js +0 -45
  211. package/fable_modules/Thoth.Json.10.1.0/Decode.fs +0 -1366
  212. package/fable_modules/Thoth.Json.10.1.0/Decode.fs.js +0 -1798
  213. package/fable_modules/Thoth.Json.10.1.0/Encode.fs +0 -621
  214. package/fable_modules/Thoth.Json.10.1.0/Encode.fs.js +0 -472
  215. package/fable_modules/Thoth.Json.10.1.0/Extra.fs +0 -31
  216. package/fable_modules/Thoth.Json.10.1.0/Extra.fs.js +0 -8
  217. package/fable_modules/Thoth.Json.10.1.0/Thoth.Json.fableproj +0 -30
  218. package/fable_modules/Thoth.Json.10.1.0/Types.fs +0 -59
  219. package/fable_modules/Thoth.Json.10.1.0/Types.fs.js +0 -98
  220. package/fable_modules/Thoth.Json.10.1.0/package.json +0 -5
  221. package/fable_modules/fable-library.4.5.0/CHANGELOG.md +0 -11
  222. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Cells/FsCell.fs +0 -0
  223. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Cells/FsCellsCollection.fs +0 -0
  224. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/CellBuilder.fs +0 -0
  225. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/ColumnBuilder.fs +0 -0
  226. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/DSL.fs +0 -0
  227. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/Expression.fs +0 -0
  228. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/Operators.fs +0 -0
  229. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/Operators.fs.js +0 -0
  230. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/RowBuilder.fs +0 -0
  231. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/SheetBuilder.fs +0 -0
  232. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/TableBuilder.fs +0 -0
  233. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/Transform.fs +0 -0
  234. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/Types.fs +0 -0
  235. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/DSL/WorkbookBuilder.fs +0 -0
  236. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsColumn.fs +0 -0
  237. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsRow.fs +0 -0
  238. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsSpreadsheet.fableproj +0 -0
  239. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/FsWorkbook.fs +0 -0
  240. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Ranges/FsRange.fs +0 -0
  241. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Ranges/FsRangeAddress.fs +0 -0
  242. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Ranges/FsRangeBase.fs +0 -0
  243. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Ranges/FsRangeColumn.fs +0 -0
  244. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Ranges/FsRangeRow.fs +0 -0
  245. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/SheetBuilder.fs +0 -0
  246. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Tables/FsTable.fs +0 -0
  247. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Tables/FsTableField.fs +0 -0
  248. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/Tables/FsTableRow.fs +0 -0
  249. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
  250. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/obj/Debug/netstandard2.0/FsSpreadsheet.AssemblyInfo.fs +0 -0
  251. /package/fable_modules/{FsSpreadsheet.5.1.2 → FsSpreadsheet.5.1.3}/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
  252. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Async.d.ts +0 -0
  253. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Async.js +0 -0
  254. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/AsyncBuilder.d.ts +0 -0
  255. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/AsyncBuilder.js +0 -0
  256. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/BigInt.d.ts +0 -0
  257. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/BigInt.js +0 -0
  258. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/BitConverter.d.ts +0 -0
  259. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/BitConverter.js +0 -0
  260. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Boolean.d.ts +0 -0
  261. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Boolean.js +0 -0
  262. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Char.d.ts +0 -0
  263. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Char.js +0 -0
  264. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Date.d.ts +0 -0
  265. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/DateOffset.d.ts +0 -0
  266. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/DateOffset.js +0 -0
  267. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/DateOnly.d.ts +0 -0
  268. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/DateOnly.js +0 -0
  269. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Decimal.d.ts +0 -0
  270. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Decimal.js +0 -0
  271. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Double.d.ts +0 -0
  272. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Double.js +0 -0
  273. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Encoding.d.ts +0 -0
  274. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Encoding.js +0 -0
  275. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Event.d.ts +0 -0
  276. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Event.js +0 -0
  277. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/FSharp.Collections.d.ts +0 -0
  278. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/FSharp.Collections.js +0 -0
  279. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/FSharp.Core.d.ts +0 -0
  280. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/FSharp.Core.js +0 -0
  281. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Global.d.ts +0 -0
  282. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Global.js +0 -0
  283. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Guid.d.ts +0 -0
  284. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Guid.js +0 -0
  285. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Int32.d.ts +0 -0
  286. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Int32.js +0 -0
  287. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/List.d.ts +0 -0
  288. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Long.d.ts +0 -0
  289. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Long.js +0 -0
  290. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/MailboxProcessor.d.ts +0 -0
  291. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/MailboxProcessor.js +0 -0
  292. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Map.d.ts +0 -0
  293. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/MapUtil.d.ts +0 -0
  294. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/MapUtil.js +0 -0
  295. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/MutableMap.d.ts +0 -0
  296. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/MutableSet.d.ts +0 -0
  297. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Native.d.ts +0 -0
  298. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Native.js +0 -0
  299. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Numeric.d.ts +0 -0
  300. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Numeric.js +0 -0
  301. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Observable.d.ts +0 -0
  302. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Observable.js +0 -0
  303. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Option.d.ts +0 -0
  304. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Option.js +0 -0
  305. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/README.md +0 -0
  306. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Random.d.ts +0 -0
  307. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Range.d.ts +0 -0
  308. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Range.js +0 -0
  309. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Reflection.d.ts +0 -0
  310. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Reflection.js +0 -0
  311. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/RegExp.d.ts +0 -0
  312. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/RegExp.js +0 -0
  313. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Seq.d.ts +0 -0
  314. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Seq.js +0 -0
  315. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Seq2.d.ts +0 -0
  316. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Seq2.js +0 -0
  317. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Set.d.ts +0 -0
  318. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/SystemException.d.ts +0 -0
  319. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/SystemException.js +0 -0
  320. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/TimeOnly.d.ts +0 -0
  321. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/TimeOnly.js +0 -0
  322. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/TimeSpan.d.ts +0 -0
  323. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/TimeSpan.js +0 -0
  324. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Timer.d.ts +0 -0
  325. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Timer.js +0 -0
  326. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Types.d.ts +0 -0
  327. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Types.js +0 -0
  328. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Unicode.13.0.0.d.ts +0 -0
  329. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Unicode.13.0.0.js +0 -0
  330. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Uri.d.ts +0 -0
  331. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Uri.js +0 -0
  332. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Util.d.ts +0 -0
  333. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/Util.js +0 -0
  334. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/lib/big.d.ts +0 -0
  335. /package/fable_modules/{fable-library.4.5.0 → fable-library-js.4.13.0}/lib/big.js +0 -0
@@ -1,621 +0,0 @@
1
- namespace Thoth.Json
2
- open System.Text.RegularExpressions
3
-
4
- [<RequireQualifiedAccess>]
5
- module Encode =
6
-
7
- open System.Collections.Generic
8
- open System.Globalization
9
- open Fable.Core
10
- open Fable.Core.JsInterop
11
-
12
- [<Emit("Array.from($0)")>]
13
- let private arrayFrom(x: JsonValue seq): JsonValue = jsNative
14
-
15
- ///**Description**
16
- /// Encode a string
17
- ///
18
- ///**Parameters**
19
- /// * `value` - parameter of type `string`
20
- ///
21
- ///**Output Type**
22
- /// * `Value`
23
- ///
24
- ///**Exceptions**
25
- ///
26
- let inline string (value : string) : JsonValue =
27
- box value
28
-
29
- let inline char (value : char) : JsonValue =
30
- box value
31
-
32
- ///**Description**
33
- /// Encode a GUID
34
- ///
35
- ///**Parameters**
36
- /// * `value` - parameter of type `System.Guid`
37
- ///
38
- ///**Output Type**
39
- /// * `Value`
40
- ///
41
- ///**Exceptions**
42
- ///
43
- let guid (value : System.Guid) : JsonValue =
44
- box (value.ToString())
45
-
46
- ///**Description**
47
- /// Encode a Float. `Infinity` and `NaN` are encoded as `null`.
48
- ///
49
- ///**Parameters**
50
- /// * `value` - parameter of type `float`
51
- ///
52
- ///**Output Type**
53
- /// * `Value`
54
- ///
55
- ///**Exceptions**
56
- ///
57
- let inline float (value : float) : JsonValue =
58
- box value
59
-
60
- let inline float32 (value : float32) : JsonValue =
61
- box value
62
-
63
- ///**Description**
64
- /// Encode a Decimal.
65
- ///
66
- ///**Parameters**
67
- /// * `value` - parameter of type `decimal`
68
- ///
69
- ///**Output Type**
70
- /// * `Value`
71
- ///
72
- ///**Exceptions**
73
- ///
74
- let decimal (value : decimal) : JsonValue =
75
- value.ToString() |> string
76
-
77
- ///**Description**
78
- /// Encode null
79
- ///
80
- ///**Parameters**
81
- ///
82
- ///**Output Type**
83
- /// * `Value`
84
- ///
85
- ///**Exceptions**
86
- ///
87
- let nil : JsonValue =
88
- box null
89
-
90
- ///**Description**
91
- /// Encode a bool
92
- ///**Parameters**
93
- /// * `value` - parameter of type `bool`
94
- ///
95
- ///**Output Type**
96
- /// * `Value`
97
- ///
98
- ///**Exceptions**
99
- ///
100
- let inline bool (value : bool) : JsonValue =
101
- box value
102
-
103
- ///**Description**
104
- /// Encode an object
105
- ///
106
- ///**Parameters**
107
- /// * `values` - parameter of type `(string * Value) list`
108
- ///
109
- ///**Output Type**
110
- /// * `Value`
111
- ///
112
- ///**Exceptions**
113
- ///
114
- let object (values : (string * JsonValue) seq) : JsonValue =
115
- let o = obj()
116
- for (key, value) in values do
117
- o?(key) <- value
118
- box o
119
-
120
- ///**Description**
121
- /// Encode an array
122
- ///
123
- ///**Parameters**
124
- /// * `values` - parameter of type `Value array`
125
- ///
126
- ///**Output Type**
127
- /// * `Value`
128
- ///
129
- ///**Exceptions**
130
- ///
131
- let inline array (values : JsonValue array) : JsonValue =
132
- box values
133
-
134
- ///**Description**
135
- /// Encode a list
136
- ///**Parameters**
137
- /// * `values` - parameter of type `Value list`
138
- ///
139
- ///**Output Type**
140
- /// * `Value`
141
- ///
142
- ///**Exceptions**
143
- ///
144
- let list (values : JsonValue list) : JsonValue =
145
- // Don't use List.toArray as it may create a typed array
146
- arrayFrom values
147
-
148
- let seq (values : JsonValue seq) : JsonValue =
149
- arrayFrom values
150
-
151
- ///**Description**
152
- /// Encode a dictionary
153
- ///**Parameters**
154
- /// * `values` - parameter of type `Map<string, Value>`
155
- ///
156
- ///**Output Type**
157
- /// * `Value`
158
- ///
159
- ///**Exceptions**
160
- ///
161
- let dict (values : Map<string, JsonValue>) : JsonValue =
162
- values
163
- |> Map.toList
164
- |> object
165
-
166
- let bigint (value : bigint) : JsonValue =
167
- box (value.ToString())
168
-
169
- let datetimeOffset (value : System.DateTimeOffset) : JsonValue =
170
- value.ToString("O", CultureInfo.InvariantCulture) |> string
171
-
172
- /// **Description**
173
- /// Encode a timespan
174
- /// **Parameters**
175
- /// * `value` - parameter of type `System.TimeSpan`
176
- ///
177
- /// **Output Type**
178
- /// * `Value`
179
- ///
180
- /// **Exceptions**
181
- ///
182
- let timespan (value : System.TimeSpan) : JsonValue =
183
- value.ToString() |> string
184
-
185
- let inline sbyte (value : sbyte) : JsonValue =
186
- box value
187
-
188
- let inline byte (value : byte) : JsonValue =
189
- box value
190
-
191
- let inline int16 (value : int16) : JsonValue =
192
- box value
193
-
194
- let inline uint16 (value : uint16) : JsonValue =
195
- box value
196
-
197
- let inline int (value : int) : JsonValue =
198
- box value
199
-
200
- let inline uint32 (value : uint32) : JsonValue =
201
- box value
202
-
203
- let int64 (value : int64) : JsonValue =
204
- box (value.ToString(CultureInfo.InvariantCulture))
205
-
206
- let uint64 (value : uint64) : JsonValue =
207
- box (value.ToString(CultureInfo.InvariantCulture))
208
-
209
- let unit () : JsonValue =
210
- box null
211
-
212
- let tuple2
213
- (enc1 : Encoder<'T1>)
214
- (enc2 : Encoder<'T2>)
215
- (v1, v2) : JsonValue =
216
- box [| enc1 v1
217
- enc2 v2 |]
218
-
219
- let tuple3
220
- (enc1 : Encoder<'T1>)
221
- (enc2 : Encoder<'T2>)
222
- (enc3 : Encoder<'T3>)
223
- (v1, v2, v3) : JsonValue =
224
- box [| enc1 v1
225
- enc2 v2
226
- enc3 v3 |]
227
-
228
- let tuple4
229
- (enc1 : Encoder<'T1>)
230
- (enc2 : Encoder<'T2>)
231
- (enc3 : Encoder<'T3>)
232
- (enc4 : Encoder<'T4>)
233
- (v1, v2, v3, v4) : JsonValue =
234
- box [| enc1 v1
235
- enc2 v2
236
- enc3 v3
237
- enc4 v4 |]
238
-
239
- let tuple5
240
- (enc1 : Encoder<'T1>)
241
- (enc2 : Encoder<'T2>)
242
- (enc3 : Encoder<'T3>)
243
- (enc4 : Encoder<'T4>)
244
- (enc5 : Encoder<'T5>)
245
- (v1, v2, v3, v4, v5) : JsonValue =
246
- box [| enc1 v1
247
- enc2 v2
248
- enc3 v3
249
- enc4 v4
250
- enc5 v5 |]
251
-
252
- let tuple6
253
- (enc1 : Encoder<'T1>)
254
- (enc2 : Encoder<'T2>)
255
- (enc3 : Encoder<'T3>)
256
- (enc4 : Encoder<'T4>)
257
- (enc5 : Encoder<'T5>)
258
- (enc6 : Encoder<'T6>)
259
- (v1, v2, v3, v4, v5, v6) : JsonValue =
260
- box [| enc1 v1
261
- enc2 v2
262
- enc3 v3
263
- enc4 v4
264
- enc5 v5
265
- enc6 v6 |]
266
-
267
- let tuple7
268
- (enc1 : Encoder<'T1>)
269
- (enc2 : Encoder<'T2>)
270
- (enc3 : Encoder<'T3>)
271
- (enc4 : Encoder<'T4>)
272
- (enc5 : Encoder<'T5>)
273
- (enc6 : Encoder<'T6>)
274
- (enc7 : Encoder<'T7>)
275
- (v1, v2, v3, v4, v5, v6, v7) : JsonValue =
276
- box [| enc1 v1
277
- enc2 v2
278
- enc3 v3
279
- enc4 v4
280
- enc5 v5
281
- enc6 v6
282
- enc7 v7 |]
283
-
284
- let tuple8
285
- (enc1 : Encoder<'T1>)
286
- (enc2 : Encoder<'T2>)
287
- (enc3 : Encoder<'T3>)
288
- (enc4 : Encoder<'T4>)
289
- (enc5 : Encoder<'T5>)
290
- (enc6 : Encoder<'T6>)
291
- (enc7 : Encoder<'T7>)
292
- (enc8 : Encoder<'T8>)
293
- (v1, v2, v3, v4, v5, v6, v7, v8) : JsonValue =
294
- box [| enc1 v1
295
- enc2 v2
296
- enc3 v3
297
- enc4 v4
298
- enc5 v5
299
- enc6 v6
300
- enc7 v7
301
- enc8 v8 |]
302
-
303
- let map (keyEncoder : Encoder<'key>) (valueEncoder : Encoder<'value>) (values : Map<'key, 'value>) : JsonValue =
304
- values
305
- |> Map.toList
306
- |> List.map (tuple2 keyEncoder valueEncoder)
307
- |> list
308
-
309
- ////////////
310
- // Enum ///
311
- /////////
312
-
313
- module Enum =
314
-
315
- let byte<'TEnum when 'TEnum : enum<byte>> (value : 'TEnum) : JsonValue =
316
- LanguagePrimitives.EnumToValue value
317
- |> byte
318
-
319
- let sbyte<'TEnum when 'TEnum : enum<sbyte>> (value : 'TEnum) : JsonValue =
320
- LanguagePrimitives.EnumToValue value
321
- |> sbyte
322
-
323
- let int16<'TEnum when 'TEnum : enum<int16>> (value : 'TEnum) : JsonValue =
324
- LanguagePrimitives.EnumToValue value
325
- |> int16
326
-
327
- let uint16<'TEnum when 'TEnum : enum<uint16>> (value : 'TEnum) : JsonValue =
328
- LanguagePrimitives.EnumToValue value
329
- |> uint16
330
-
331
- let int<'TEnum when 'TEnum : enum<int>> (value : 'TEnum) : JsonValue =
332
- LanguagePrimitives.EnumToValue value
333
- |> int
334
-
335
- let uint32<'TEnum when 'TEnum : enum<uint32>> (value : 'TEnum) : JsonValue =
336
- LanguagePrimitives.EnumToValue value
337
- |> uint32
338
-
339
- /// **Description**
340
- ///
341
- /// The DateTime is always encoded using UTC representation
342
- ///
343
- /// **Parameters**
344
- /// * `value` - parameter of type `System.DateTime`
345
- ///
346
- /// **Output Type**
347
- /// * `Value`
348
- ///
349
- /// **Exceptions**
350
- ///
351
- let datetime (value : System.DateTime) : JsonValue =
352
- value.ToString("O", CultureInfo.InvariantCulture) |> string
353
-
354
- ///**Description**
355
- /// Convert a `Value` into a prettified string.
356
- ///**Parameters**
357
- /// * `space` - parameter of type `int` - Amount of indentation
358
- /// * `value` - parameter of type `obj` - Value to convert
359
- ///
360
- ///**Output Type**
361
- /// * `string`
362
- ///
363
- ///**Exceptions**
364
- ///
365
- let toString (space: int) (value: JsonValue) : string =
366
- JS.JSON.stringify(value, space=space)
367
-
368
- ///**Description**
369
- /// Encode an option
370
- ///**Parameters**
371
- /// * `encoder` - parameter of type `'a -> Value`
372
- ///
373
- ///**Output Type**
374
- /// * `'a option -> Value`
375
- ///
376
- ///**Exceptions**
377
- ///
378
- let option (encoder : 'a -> JsonValue) =
379
- Option.map encoder >> Option.defaultWith (fun _ -> nil)
380
-
381
- //////////////////
382
- // Reflection ///
383
- ////////////////
384
-
385
- open FSharp.Reflection
386
- open Fable.Core.DynamicExtensions
387
-
388
- // As generics are erased by Fable, let's just do an unsafe cast for performance
389
- let inline boxEncoder (d: Encoder<'T>): BoxedEncoder =
390
- !!d
391
-
392
- let inline unboxEncoder (d: BoxedEncoder): Encoder<'T> =
393
- !!d
394
-
395
- let rec private autoEncodeRecordsAndUnions extra (caseStrategy : CaseStrategy) (skipNullField : bool) (t: System.Type) : BoxedEncoder =
396
- // Add the encoder to extra in case one of the fields is recursive
397
- let encoderRef = ref Unchecked.defaultof<_>
398
- let extra =
399
- // As of 3.7.17 Fable assigns empty name to anonymous record, we shouldn't add them to the map to avoid conflicts.
400
- // Anonymous records cannot be recursive anyways, see #144
401
- match t.FullName with
402
- | "" -> extra
403
- | fullName -> extra |> Map.add fullName encoderRef
404
- let encoder =
405
- if FSharpType.IsRecord(t, allowAccessToPrivateRepresentation=true) then
406
- let setters =
407
- FSharpType.GetRecordFields(t, allowAccessToPrivateRepresentation=true)
408
- |> Array.map (fun fi ->
409
- let targetKey = Util.Casing.convert caseStrategy fi.Name
410
- let encode = autoEncoder extra caseStrategy skipNullField fi.PropertyType
411
- fun (source: obj) (target: JsonValue) ->
412
- let value = FSharpValue.GetRecordField(source, fi)
413
- if not skipNullField || (skipNullField && not (isNull value)) then // Discard null fields
414
- target.[targetKey] <- encode value
415
- target)
416
- fun (source: obj) ->
417
- (JsonValue(), setters) ||> Seq.fold (fun target set -> set source target)
418
- elif FSharpType.IsUnion(t, allowAccessToPrivateRepresentation=true) then
419
- fun (value: obj) ->
420
- let info, fields = FSharpValue.GetUnionFields(value, t, allowAccessToPrivateRepresentation=true)
421
- match fields.Length with
422
- | 0 -> string info.Name
423
- | len ->
424
- let fieldTypes = info.GetFields()
425
- let target = Array.zeroCreate<JsonValue> (len + 1)
426
- target.[0] <- string info.Name
427
- for i = 1 to len do
428
- let encode = autoEncoder extra caseStrategy skipNullField fieldTypes.[i-1].PropertyType
429
- target.[i] <- encode fields.[i-1]
430
- array target
431
- else
432
- // Don't use failwithf here, for some reason F#/Fable compiles it as a function
433
- // when the return type is a function too, so it doesn't fail immediately
434
- sprintf """Cannot generate auto encoder for %s. Please pass an extra encoder.
435
-
436
- Documentation available at: https://thoth-org.github.io/Thoth.Json/documentation/auto/extra-coders.html#ready-to-use-extra-coders""" t.FullName
437
- |> failwith
438
- encoderRef.Value <- encoder
439
- encoder
440
-
441
- and private autoEncoder (extra: Map<string, ref<BoxedEncoder>>) caseStrategy (skipNullField : bool) (t: System.Type) : BoxedEncoder =
442
- let fullname = t.FullName
443
- match Map.tryFind fullname extra with
444
- | Some encoderRef -> fun v -> encoderRef.contents v
445
- | None ->
446
- if t.IsArray then
447
- let encoder = t.GetElementType() |> autoEncoder extra caseStrategy skipNullField
448
- fun (value: obj) ->
449
- value :?> obj seq |> Seq.map encoder |> seq
450
- elif t.IsEnum then
451
- let enumType = System.Enum.GetUnderlyingType(t).FullName
452
- if enumType = typeof<sbyte>.FullName then
453
- boxEncoder sbyte
454
- elif enumType = typeof<byte>.FullName then
455
- boxEncoder byte
456
- elif enumType = typeof<int16>.FullName then
457
- boxEncoder int16
458
- elif enumType = typeof<uint16>.FullName then
459
- boxEncoder uint16
460
- elif enumType = typeof<int>.FullName then
461
- boxEncoder int
462
- elif enumType = typeof<uint32>.FullName then
463
- boxEncoder uint32
464
- else
465
- failwithf
466
- """Cannot generate auto encoder for %s.
467
- Thoth.Json.Net only support the following enum types:
468
- - sbyte
469
- - byte
470
- - int16
471
- - uint16
472
- - int
473
- - uint32
474
-
475
- If you can't use one of these types, please pass an extra encoder.
476
-
477
- Documentation available at: https://thoth-org.github.io/Thoth.Json/documentation/auto/extra-coders.html#ready-to-use-extra-coders
478
- """ t.FullName
479
- elif t.IsGenericType then
480
- if FSharpType.IsTuple(t) then
481
- let encoders =
482
- FSharpType.GetTupleElements(t)
483
- |> Array.map (autoEncoder extra caseStrategy skipNullField)
484
- fun (value: obj) ->
485
- FSharpValue.GetTupleFields(value)
486
- |> Seq.mapi (fun i x -> encoders.[i] x) |> seq
487
- else
488
- let fullname = t.GetGenericTypeDefinition().FullName
489
- if fullname = typedefof<obj option>.FullName then
490
- // Evaluate lazily so we don't need to generate the encoder for null values
491
- let encoder = lazy
492
- t.GenericTypeArguments.[0]
493
- |> autoEncoder extra caseStrategy skipNullField
494
- |> option
495
- |> boxEncoder
496
- boxEncoder(fun (value: obj) ->
497
- if isNull value then nil
498
- else encoder.Value value)
499
- elif fullname = typedefof<obj list>.FullName
500
- || fullname = typedefof<Set<string>>.FullName
501
- || fullname = typedefof<obj seq>.FullName then
502
- let encoder = t.GenericTypeArguments.[0] |> autoEncoder extra caseStrategy skipNullField
503
- fun (value: obj) ->
504
- value :?> obj seq |> Seq.map encoder |> seq
505
- elif fullname = typedefof< Map<string, obj> >.FullName then
506
- let keyType = t.GenericTypeArguments.[0]
507
- let valueEncoder = t.GenericTypeArguments.[1] |> autoEncoder extra caseStrategy skipNullField
508
- if keyType.FullName = typeof<string>.FullName
509
- || keyType.FullName = typeof<System.Guid>.FullName then
510
- fun value ->
511
- // Fable compiles Guids as strings so this works, but maybe we should make the conversion explicit
512
- // (see dotnet version) in case Fable implementation of Guids change
513
- (JsonValue(), value :?> Map<string, obj>)
514
- ||> Seq.fold (fun target (KeyValue(k,v)) ->
515
- target.[k] <- valueEncoder v
516
- target)
517
- else
518
- let keyEncoder = keyType |> autoEncoder extra caseStrategy skipNullField
519
- fun value ->
520
- value :?> Map<string, obj> |> Seq.map (fun (KeyValue(k,v)) ->
521
- array [|keyEncoder k; valueEncoder v|]) |> seq
522
- else
523
- autoEncodeRecordsAndUnions extra caseStrategy skipNullField t
524
- else
525
- if fullname = typeof<bool>.FullName then
526
- boxEncoder bool
527
- elif fullname = typeof<unit>.FullName then
528
- boxEncoder unit
529
- elif fullname = typeof<string>.FullName then
530
- boxEncoder string
531
- elif fullname = typeof<char>.FullName then
532
- boxEncoder char
533
- elif fullname = typeof<sbyte>.FullName then
534
- boxEncoder sbyte
535
- elif fullname = typeof<byte>.FullName then
536
- boxEncoder byte
537
- elif fullname = typeof<int16>.FullName then
538
- boxEncoder int16
539
- elif fullname = typeof<uint16>.FullName then
540
- boxEncoder uint16
541
- elif fullname = typeof<int>.FullName then
542
- boxEncoder int
543
- elif fullname = typeof<uint32>.FullName then
544
- boxEncoder uint32
545
- elif fullname = typeof<float>.FullName then
546
- boxEncoder float
547
- elif fullname = typeof<float32>.FullName then
548
- boxEncoder float32
549
- // These number types require extra libraries in Fable. To prevent penalizing
550
- // all users, extra encoders (withInt64, etc) must be passed when they're needed.
551
-
552
- // elif fullname = typeof<int64>.FullName then
553
- // boxEncoder int64
554
- // elif fullname = typeof<uint64>.FullName then
555
- // boxEncoder uint64
556
- // elif fullname = typeof<bigint>.FullName then
557
- // boxEncoder bigint
558
- // elif fullname = typeof<decimal>.FullName then
559
- // boxEncoder decimal
560
- elif fullname = typeof<System.DateTime>.FullName then
561
- boxEncoder datetime
562
- elif fullname = typeof<System.DateTimeOffset>.FullName then
563
- boxEncoder datetimeOffset
564
- elif fullname = typeof<System.TimeSpan>.FullName then
565
- boxEncoder timespan
566
- elif fullname = typeof<System.Guid>.FullName then
567
- boxEncoder guid
568
- elif fullname = typeof<obj>.FullName then
569
- boxEncoder id
570
- else
571
- autoEncodeRecordsAndUnions extra caseStrategy skipNullField t
572
-
573
- let private makeExtra (extra: ExtraCoders option) =
574
- match extra with
575
- | None -> Map.empty
576
- | Some e -> Map.map (fun _ (enc,_) -> ref enc) e.Coders
577
-
578
- type Auto =
579
- static member generateBoxedEncoderCached(t: System.Type, ?caseStrategy : CaseStrategy, ?extra: ExtraCoders, ?skipNullField: bool): BoxedEncoder =
580
- let caseStrategy = defaultArg caseStrategy PascalCase
581
- let skipNullField = defaultArg skipNullField true
582
-
583
- let key =
584
- t.FullName
585
- |> (+) (Operators.string caseStrategy)
586
- |> (+) (extra |> Option.map (fun e -> e.Hash) |> Option.defaultValue "")
587
-
588
- Util.CachedEncoders.GetOrAdd(key , fun _ ->
589
- autoEncoder (makeExtra extra) caseStrategy skipNullField t)
590
-
591
- static member inline generateEncoderCached<'T>(?caseStrategy : CaseStrategy, ?extra: ExtraCoders, ?skipNullField: bool): Encoder<'T> =
592
- Auto.generateBoxedEncoderCached(typeof<'T>, ?caseStrategy=caseStrategy, ?extra=extra) |> unboxEncoder
593
-
594
- static member generateBoxedEncoder(t: System.Type, ?caseStrategy : CaseStrategy, ?extra: ExtraCoders, ?skipNullField: bool): BoxedEncoder =
595
- let caseStrategy = defaultArg caseStrategy PascalCase
596
- let skipNullField = defaultArg skipNullField true
597
- autoEncoder (makeExtra extra) caseStrategy skipNullField t
598
-
599
- static member inline generateEncoder<'T>(?caseStrategy : CaseStrategy, ?extra: ExtraCoders, ?skipNullField: bool): Encoder<'T> =
600
- Auto.generateBoxedEncoder(typeof<'T>, ?caseStrategy=caseStrategy, ?extra=extra, ?skipNullField=skipNullField) |> unboxEncoder
601
-
602
- static member inline toString(space : int, value : 'T, ?caseStrategy : CaseStrategy, ?extra: ExtraCoders, ?skipNullField: bool) : string =
603
- let encoder = Auto.generateEncoder(?caseStrategy=caseStrategy, ?extra=extra, ?skipNullField=skipNullField)
604
- encoder value |> toString space
605
-
606
- static member inline toString(value : 'T, ?caseStrategy : CaseStrategy, ?extra: ExtraCoders, ?skipNullField: bool) : string =
607
- Auto.toString(0, value, ?caseStrategy=caseStrategy, ?extra=extra, ?skipNullField=skipNullField)
608
-
609
- ///**Description**
610
- /// Convert a `Value` into a prettified string.
611
- ///**Parameters**
612
- /// * `space` - parameter of type `int` - Amount of indentation
613
- /// * `value` - parameter of type `obj` - Value to convert
614
- ///
615
- ///**Output Type**
616
- /// * `string`
617
- ///
618
- ///**Exceptions**
619
- ///
620
- [<System.Obsolete("Please use toString instead")>]
621
- let encode (space: int) (value: JsonValue) : string = toString space value