@nfdi4plants/arctrl 1.0.0-alpha10

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 (296) hide show
  1. package/ARC.js +262 -0
  2. package/Contract/Contract.js +95 -0
  3. package/Contracts/Contracts.ARCtrl.js +35 -0
  4. package/Contracts/Contracts.ArcAssay.js +65 -0
  5. package/Contracts/Contracts.ArcInvestigation.js +58 -0
  6. package/Contracts/Contracts.ArcStudy.js +65 -0
  7. package/Contracts/Contracts.Git.js +91 -0
  8. package/FileSystem/Commit.js +18 -0
  9. package/FileSystem/DefaultGitignore.js +3 -0
  10. package/FileSystem/FileSystem.js +53 -0
  11. package/FileSystem/FileSystemTree.js +223 -0
  12. package/FileSystem/Path.js +38 -0
  13. package/FileSystemTree.js +51 -0
  14. package/ISA/ISA/ArcTypes/ArcTable.js +848 -0
  15. package/ISA/ISA/ArcTypes/ArcTableAux.js +1105 -0
  16. package/ISA/ISA/ArcTypes/ArcTables.js +479 -0
  17. package/ISA/ISA/ArcTypes/ArcTypes.js +2281 -0
  18. package/ISA/ISA/ArcTypes/CompositeCell.js +180 -0
  19. package/ISA/ISA/ArcTypes/CompositeColumn.js +48 -0
  20. package/ISA/ISA/ArcTypes/CompositeHeader.js +668 -0
  21. package/ISA/ISA/ArcTypes/CompositeRow.js +111 -0
  22. package/ISA/ISA/ArcTypes/IdentifierSetters.js +26 -0
  23. package/ISA/ISA/Builder/Types.js +243 -0
  24. package/ISA/ISA/Fable.js +50 -0
  25. package/ISA/ISA/Helper.js +338 -0
  26. package/ISA/ISA/Identifier.js +76 -0
  27. package/ISA/ISA/JsonTypes/AnnotationValue.js +56 -0
  28. package/ISA/ISA/JsonTypes/Assay.js +620 -0
  29. package/ISA/ISA/JsonTypes/AssayMaterials.js +39 -0
  30. package/ISA/ISA/JsonTypes/ColumnIndex.js +246 -0
  31. package/ISA/ISA/JsonTypes/Comment.js +58 -0
  32. package/ISA/ISA/JsonTypes/CommentList.js +139 -0
  33. package/ISA/ISA/JsonTypes/Component.js +158 -0
  34. package/ISA/ISA/JsonTypes/Data.js +55 -0
  35. package/ISA/ISA/JsonTypes/DataFile.js +68 -0
  36. package/ISA/ISA/JsonTypes/Factor.js +128 -0
  37. package/ISA/ISA/JsonTypes/FactorValue.js +109 -0
  38. package/ISA/ISA/JsonTypes/Investigation.js +204 -0
  39. package/ISA/ISA/JsonTypes/Material.js +66 -0
  40. package/ISA/ISA/JsonTypes/MaterialAttribute.js +101 -0
  41. package/ISA/ISA/JsonTypes/MaterialAttributeValue.js +126 -0
  42. package/ISA/ISA/JsonTypes/MaterialType.js +41 -0
  43. package/ISA/ISA/JsonTypes/OntologyAnnotation.js +219 -0
  44. package/ISA/ISA/JsonTypes/OntologySourceReference.js +85 -0
  45. package/ISA/ISA/JsonTypes/Person.js +137 -0
  46. package/ISA/ISA/JsonTypes/Process.js +401 -0
  47. package/ISA/ISA/JsonTypes/ProcessInput.js +297 -0
  48. package/ISA/ISA/JsonTypes/ProcessOutput.js +263 -0
  49. package/ISA/ISA/JsonTypes/ProcessParameterValue.js +129 -0
  50. package/ISA/ISA/JsonTypes/ProcessSequence.js +255 -0
  51. package/ISA/ISA/JsonTypes/Protocol.js +277 -0
  52. package/ISA/ISA/JsonTypes/ProtocolParameter.js +101 -0
  53. package/ISA/ISA/JsonTypes/Publication.js +105 -0
  54. package/ISA/ISA/JsonTypes/Sample.js +71 -0
  55. package/ISA/ISA/JsonTypes/Source.js +54 -0
  56. package/ISA/ISA/JsonTypes/Study.js +942 -0
  57. package/ISA/ISA/JsonTypes/StudyMaterials.js +45 -0
  58. package/ISA/ISA/JsonTypes/URI.js +19 -0
  59. package/ISA/ISA/JsonTypes/Value.js +210 -0
  60. package/ISA/ISA/Regex.js +588 -0
  61. package/ISA/ISA.Json/Assay.js +123 -0
  62. package/ISA/ISA.Json/Comment.js +84 -0
  63. package/ISA/ISA.Json/ConverterOptions.js +33 -0
  64. package/ISA/ISA.Json/Data.js +271 -0
  65. package/ISA/ISA.Json/Decode.js +46 -0
  66. package/ISA/ISA.Json/Factor.js +194 -0
  67. package/ISA/ISA.Json/GEncode.js +15 -0
  68. package/ISA/ISA.Json/Investigation.js +132 -0
  69. package/ISA/ISA.Json/Material.js +233 -0
  70. package/ISA/ISA.Json/Ontology.js +204 -0
  71. package/ISA/ISA.Json/Person.js +204 -0
  72. package/ISA/ISA.Json/Process.js +291 -0
  73. package/ISA/ISA.Json/Protocol.js +242 -0
  74. package/ISA/ISA.Json/Publication.js +92 -0
  75. package/ISA/ISA.Json/Study.js +230 -0
  76. package/ISA/ISA.Json/Validation/Fable.js +69 -0
  77. package/ISA/ISA.Json/Validation/JsonSchemaValidation.js +88 -0
  78. package/ISA/ISA.Json/Validation/ValidationResult.js +45 -0
  79. package/ISA/ISA.Spreadsheet/AnnotationTable/ArcTable.js +137 -0
  80. package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeCell.js +78 -0
  81. package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeColumn.js +59 -0
  82. package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeHeader.js +478 -0
  83. package/ISA/ISA.Spreadsheet/ArcAssay.js +150 -0
  84. package/ISA/ISA.Spreadsheet/ArcInvestigation.js +314 -0
  85. package/ISA/ISA.Spreadsheet/ArcStudy.js +67 -0
  86. package/ISA/ISA.Spreadsheet/CollectionAux.js +128 -0
  87. package/ISA/ISA.Spreadsheet/Metadata/Assays.js +81 -0
  88. package/ISA/ISA.Spreadsheet/Metadata/Comment.js +60 -0
  89. package/ISA/ISA.Spreadsheet/Metadata/Contacts.js +104 -0
  90. package/ISA/ISA.Spreadsheet/Metadata/Conversions.js +180 -0
  91. package/ISA/ISA.Spreadsheet/Metadata/DesignDescriptors.js +27 -0
  92. package/ISA/ISA.Spreadsheet/Metadata/Factors.js +85 -0
  93. package/ISA/ISA.Spreadsheet/Metadata/OntologyAnnotation.js +65 -0
  94. package/ISA/ISA.Spreadsheet/Metadata/OntologySourceReference.js +73 -0
  95. package/ISA/ISA.Spreadsheet/Metadata/Protocols.js +116 -0
  96. package/ISA/ISA.Spreadsheet/Metadata/Publication.js +96 -0
  97. package/ISA/ISA.Spreadsheet/Metadata/SparseTable.js +451 -0
  98. package/ISA/ISA.Spreadsheet/Metadata/Study.js +260 -0
  99. package/README.md +277 -0
  100. package/SemVer.js +60 -0
  101. package/Templates/Template.Json.js +85 -0
  102. package/Templates/Template.Spreadsheet.js +315 -0
  103. package/Templates/Template.Web.js +27 -0
  104. package/Templates/Template.js +179 -0
  105. package/Templates/Templates.js +82 -0
  106. package/WebRequest/WebRequest.js +38 -0
  107. package/fable_modules/Fable.Fetch.2.6.0/Fable.Fetch.fableproj +21 -0
  108. package/fable_modules/Fable.Fetch.2.6.0/Fetch.fs +469 -0
  109. package/fable_modules/Fable.Fetch.2.6.0/Fetch.fs.js +111 -0
  110. package/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs +57 -0
  111. package/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js +104 -0
  112. package/fable_modules/Fable.Promise.3.2.0/Fable.Promise.fableproj +20 -0
  113. package/fable_modules/Fable.Promise.3.2.0/Promise.fs +766 -0
  114. package/fable_modules/Fable.Promise.3.2.0/Promise.fs.js +217 -0
  115. package/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs +31 -0
  116. package/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js +19 -0
  117. package/fable_modules/Fable.SimpleHttp.3.5.0/Fable.SimpleHttp.fableproj +23 -0
  118. package/fable_modules/Fable.SimpleHttp.3.5.0/Http.fs +357 -0
  119. package/fable_modules/Fable.SimpleHttp.3.5.0/Http.fs.js +429 -0
  120. package/fable_modules/Fable.SimpleHttp.3.5.0/Types.fs +52 -0
  121. package/fable_modules/Fable.SimpleHttp.3.5.0/Types.fs.js +112 -0
  122. package/fable_modules/FsSpreadsheet.4.1.0/Cells/FsCell.fs +387 -0
  123. package/fable_modules/FsSpreadsheet.4.1.0/Cells/FsCell.fs.js +240 -0
  124. package/fable_modules/FsSpreadsheet.4.1.0/Cells/FsCellsCollection.fs +725 -0
  125. package/fable_modules/FsSpreadsheet.4.1.0/Cells/FsCellsCollection.fs.js +522 -0
  126. package/fable_modules/FsSpreadsheet.4.1.0/DSL/CellBuilder.fs +195 -0
  127. package/fable_modules/FsSpreadsheet.4.1.0/DSL/CellBuilder.fs.js +208 -0
  128. package/fable_modules/FsSpreadsheet.4.1.0/DSL/ColumnBuilder.fs +209 -0
  129. package/fable_modules/FsSpreadsheet.4.1.0/DSL/ColumnBuilder.fs.js +137 -0
  130. package/fable_modules/FsSpreadsheet.4.1.0/DSL/DSL.fs +61 -0
  131. package/fable_modules/FsSpreadsheet.4.1.0/DSL/DSL.fs.js +62 -0
  132. package/fable_modules/FsSpreadsheet.4.1.0/DSL/Expression.fs +24 -0
  133. package/fable_modules/FsSpreadsheet.4.1.0/DSL/Expression.fs.js +56 -0
  134. package/fable_modules/FsSpreadsheet.4.1.0/DSL/Operators.fs +102 -0
  135. package/fable_modules/FsSpreadsheet.4.1.0/DSL/Operators.fs.js +6 -0
  136. package/fable_modules/FsSpreadsheet.4.1.0/DSL/RowBuilder.fs +200 -0
  137. package/fable_modules/FsSpreadsheet.4.1.0/DSL/RowBuilder.fs.js +137 -0
  138. package/fable_modules/FsSpreadsheet.4.1.0/DSL/SheetBuilder.fs +139 -0
  139. package/fable_modules/FsSpreadsheet.4.1.0/DSL/SheetBuilder.fs.js +116 -0
  140. package/fable_modules/FsSpreadsheet.4.1.0/DSL/TableBuilder.fs +120 -0
  141. package/fable_modules/FsSpreadsheet.4.1.0/DSL/TableBuilder.fs.js +120 -0
  142. package/fable_modules/FsSpreadsheet.4.1.0/DSL/Transform.fs +229 -0
  143. package/fable_modules/FsSpreadsheet.4.1.0/DSL/Transform.fs.js +421 -0
  144. package/fable_modules/FsSpreadsheet.4.1.0/DSL/Types.fs +151 -0
  145. package/fable_modules/FsSpreadsheet.4.1.0/DSL/Types.fs.js +277 -0
  146. package/fable_modules/FsSpreadsheet.4.1.0/DSL/WorkbookBuilder.fs +114 -0
  147. package/fable_modules/FsSpreadsheet.4.1.0/DSL/WorkbookBuilder.fs.js +104 -0
  148. package/fable_modules/FsSpreadsheet.4.1.0/FsAddress.fs +177 -0
  149. package/fable_modules/FsSpreadsheet.4.1.0/FsAddress.fs.js +249 -0
  150. package/fable_modules/FsSpreadsheet.4.1.0/FsColumn.fs +200 -0
  151. package/fable_modules/FsSpreadsheet.4.1.0/FsColumn.fs.js +125 -0
  152. package/fable_modules/FsSpreadsheet.4.1.0/FsRow.fs +202 -0
  153. package/fable_modules/FsSpreadsheet.4.1.0/FsRow.fs.js +135 -0
  154. package/fable_modules/FsSpreadsheet.4.1.0/FsSpreadsheet.fableproj +58 -0
  155. package/fable_modules/FsSpreadsheet.4.1.0/FsWorkbook.fs +183 -0
  156. package/fable_modules/FsSpreadsheet.4.1.0/FsWorkbook.fs.js +138 -0
  157. package/fable_modules/FsSpreadsheet.4.1.0/FsWorksheet.fs +628 -0
  158. package/fable_modules/FsSpreadsheet.4.1.0/FsWorksheet.fs.js +398 -0
  159. package/fable_modules/FsSpreadsheet.4.1.0/Ranges/FsRange.fs +19 -0
  160. package/fable_modules/FsSpreadsheet.4.1.0/Ranges/FsRange.fs.js +41 -0
  161. package/fable_modules/FsSpreadsheet.4.1.0/Ranges/FsRangeAddress.fs +222 -0
  162. package/fable_modules/FsSpreadsheet.4.1.0/Ranges/FsRangeAddress.fs.js +235 -0
  163. package/fable_modules/FsSpreadsheet.4.1.0/Ranges/FsRangeBase.fs +93 -0
  164. package/fable_modules/FsSpreadsheet.4.1.0/Ranges/FsRangeBase.fs.js +91 -0
  165. package/fable_modules/FsSpreadsheet.4.1.0/Ranges/FsRangeColumn.fs +65 -0
  166. package/fable_modules/FsSpreadsheet.4.1.0/Ranges/FsRangeColumn.fs.js +74 -0
  167. package/fable_modules/FsSpreadsheet.4.1.0/Ranges/FsRangeRow.fs +22 -0
  168. package/fable_modules/FsSpreadsheet.4.1.0/Ranges/FsRangeRow.fs.js +40 -0
  169. package/fable_modules/FsSpreadsheet.4.1.0/SheetBuilder.fs +249 -0
  170. package/fable_modules/FsSpreadsheet.4.1.0/SheetBuilder.fs.js +325 -0
  171. package/fable_modules/FsSpreadsheet.4.1.0/Tables/FsTable.fs +455 -0
  172. package/fable_modules/FsSpreadsheet.4.1.0/Tables/FsTable.fs.js +310 -0
  173. package/fable_modules/FsSpreadsheet.4.1.0/Tables/FsTableField.fs +140 -0
  174. package/fable_modules/FsSpreadsheet.4.1.0/Tables/FsTableField.fs.js +173 -0
  175. package/fable_modules/FsSpreadsheet.4.1.0/Tables/FsTableRow.fs +6 -0
  176. package/fable_modules/FsSpreadsheet.4.1.0/Tables/FsTableRow.fs.js +17 -0
  177. package/fable_modules/FsSpreadsheet.4.1.0/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
  178. package/fable_modules/FsSpreadsheet.4.1.0/obj/Debug/netstandard2.0/FsSpreadsheet.AssemblyInfo.fs +19 -0
  179. package/fable_modules/FsSpreadsheet.4.1.0/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
  180. package/fable_modules/FsSpreadsheet.4.1.0/obj/Release/netstandard2.0/FsSpreadsheet.AssemblyInfo.fs +19 -0
  181. package/fable_modules/Thoth.Json.10.1.0/Decode.fs +1366 -0
  182. package/fable_modules/Thoth.Json.10.1.0/Decode.fs.js +1798 -0
  183. package/fable_modules/Thoth.Json.10.1.0/Encode.fs +621 -0
  184. package/fable_modules/Thoth.Json.10.1.0/Encode.fs.js +472 -0
  185. package/fable_modules/Thoth.Json.10.1.0/Extra.fs +31 -0
  186. package/fable_modules/Thoth.Json.10.1.0/Extra.fs.js +8 -0
  187. package/fable_modules/Thoth.Json.10.1.0/Thoth.Json.fableproj +30 -0
  188. package/fable_modules/Thoth.Json.10.1.0/Types.fs +59 -0
  189. package/fable_modules/Thoth.Json.10.1.0/Types.fs.js +98 -0
  190. package/fable_modules/Thoth.Json.10.1.0/obj/Release/netstandard2.0/Thoth.Json.AssemblyInfo.fs +19 -0
  191. package/fable_modules/Thoth.Json.10.1.0/package.json +5 -0
  192. package/fable_modules/fable-library.4.1.4/Array.d.ts +120 -0
  193. package/fable_modules/fable-library.4.1.4/Array.js +1204 -0
  194. package/fable_modules/fable-library.4.1.4/Async.d.ts +32 -0
  195. package/fable_modules/fable-library.4.1.4/Async.js +158 -0
  196. package/fable_modules/fable-library.4.1.4/AsyncBuilder.d.ts +59 -0
  197. package/fable_modules/fable-library.4.1.4/AsyncBuilder.js +183 -0
  198. package/fable_modules/fable-library.4.1.4/BigInt.d.ts +115 -0
  199. package/fable_modules/fable-library.4.1.4/BigInt.js +282 -0
  200. package/fable_modules/fable-library.4.1.4/BitConverter.d.ts +27 -0
  201. package/fable_modules/fable-library.4.1.4/BitConverter.js +138 -0
  202. package/fable_modules/fable-library.4.1.4/Boolean.d.ts +3 -0
  203. package/fable_modules/fable-library.4.1.4/Boolean.js +21 -0
  204. package/fable_modules/fable-library.4.1.4/Char.d.ts +65 -0
  205. package/fable_modules/fable-library.4.1.4/Char.js +169 -0
  206. package/fable_modules/fable-library.4.1.4/Choice.d.ts +138 -0
  207. package/fable_modules/fable-library.4.1.4/Choice.js +227 -0
  208. package/fable_modules/fable-library.4.1.4/Date.d.ts +70 -0
  209. package/fable_modules/fable-library.4.1.4/Date.js +451 -0
  210. package/fable_modules/fable-library.4.1.4/DateOffset.d.ts +63 -0
  211. package/fable_modules/fable-library.4.1.4/DateOffset.js +268 -0
  212. package/fable_modules/fable-library.4.1.4/DateOnly.d.ts +18 -0
  213. package/fable_modules/fable-library.4.1.4/DateOnly.js +124 -0
  214. package/fable_modules/fable-library.4.1.4/Decimal.d.ts +45 -0
  215. package/fable_modules/fable-library.4.1.4/Decimal.js +212 -0
  216. package/fable_modules/fable-library.4.1.4/Double.d.ts +11 -0
  217. package/fable_modules/fable-library.4.1.4/Double.js +46 -0
  218. package/fable_modules/fable-library.4.1.4/Encoding.d.ts +12 -0
  219. package/fable_modules/fable-library.4.1.4/Encoding.js +173 -0
  220. package/fable_modules/fable-library.4.1.4/Event.d.ts +31 -0
  221. package/fable_modules/fable-library.4.1.4/Event.js +93 -0
  222. package/fable_modules/fable-library.4.1.4/FSharp.Collections.d.ts +7 -0
  223. package/fable_modules/fable-library.4.1.4/FSharp.Collections.js +27 -0
  224. package/fable_modules/fable-library.4.1.4/FSharp.Core.d.ts +17 -0
  225. package/fable_modules/fable-library.4.1.4/FSharp.Core.js +69 -0
  226. package/fable_modules/fable-library.4.1.4/Global.d.ts +24 -0
  227. package/fable_modules/fable-library.4.1.4/Global.js +8 -0
  228. package/fable_modules/fable-library.4.1.4/Guid.d.ts +10 -0
  229. package/fable_modules/fable-library.4.1.4/Guid.js +142 -0
  230. package/fable_modules/fable-library.4.1.4/Int32.d.ts +28 -0
  231. package/fable_modules/fable-library.4.1.4/Int32.js +135 -0
  232. package/fable_modules/fable-library.4.1.4/List.d.ts +143 -0
  233. package/fable_modules/fable-library.4.1.4/List.js +1273 -0
  234. package/fable_modules/fable-library.4.1.4/Long.d.ts +3 -0
  235. package/fable_modules/fable-library.4.1.4/Long.js +46 -0
  236. package/fable_modules/fable-library.4.1.4/MailboxProcessor.d.ts +25 -0
  237. package/fable_modules/fable-library.4.1.4/MailboxProcessor.js +93 -0
  238. package/fable_modules/fable-library.4.1.4/Map.d.ts +178 -0
  239. package/fable_modules/fable-library.4.1.4/Map.js +1396 -0
  240. package/fable_modules/fable-library.4.1.4/MapUtil.d.ts +10 -0
  241. package/fable_modules/fable-library.4.1.4/MapUtil.js +112 -0
  242. package/fable_modules/fable-library.4.1.4/MutableMap.d.ts +52 -0
  243. package/fable_modules/fable-library.4.1.4/MutableMap.js +326 -0
  244. package/fable_modules/fable-library.4.1.4/MutableSet.d.ts +39 -0
  245. package/fable_modules/fable-library.4.1.4/MutableSet.js +232 -0
  246. package/fable_modules/fable-library.4.1.4/Native.d.ts +2 -0
  247. package/fable_modules/fable-library.4.1.4/Native.js +8 -0
  248. package/fable_modules/fable-library.4.1.4/Numeric.d.ts +19 -0
  249. package/fable_modules/fable-library.4.1.4/Numeric.js +71 -0
  250. package/fable_modules/fable-library.4.1.4/Observable.d.ts +32 -0
  251. package/fable_modules/fable-library.4.1.4/Observable.js +113 -0
  252. package/fable_modules/fable-library.4.1.4/Option.d.ts +28 -0
  253. package/fable_modules/fable-library.4.1.4/Option.js +96 -0
  254. package/fable_modules/fable-library.4.1.4/README.md +3 -0
  255. package/fable_modules/fable-library.4.1.4/Random.d.ts +37 -0
  256. package/fable_modules/fable-library.4.1.4/Random.js +170 -0
  257. package/fable_modules/fable-library.4.1.4/Range.d.ts +12 -0
  258. package/fable_modules/fable-library.4.1.4/Range.js +45 -0
  259. package/fable_modules/fable-library.4.1.4/Reflection.d.ts +119 -0
  260. package/fable_modules/fable-library.4.1.4/Reflection.js +461 -0
  261. package/fable_modules/fable-library.4.1.4/RegExp.d.ts +10 -0
  262. package/fable_modules/fable-library.4.1.4/RegExp.js +132 -0
  263. package/fable_modules/fable-library.4.1.4/Seq.d.ts +165 -0
  264. package/fable_modules/fable-library.4.1.4/Seq.js +1379 -0
  265. package/fable_modules/fable-library.4.1.4/Seq2.d.ts +18 -0
  266. package/fable_modules/fable-library.4.1.4/Seq2.js +111 -0
  267. package/fable_modules/fable-library.4.1.4/Set.d.ts +190 -0
  268. package/fable_modules/fable-library.4.1.4/Set.js +1789 -0
  269. package/fable_modules/fable-library.4.1.4/String.d.ts +49 -0
  270. package/fable_modules/fable-library.4.1.4/String.js +540 -0
  271. package/fable_modules/fable-library.4.1.4/System.Collections.Generic.d.ts +71 -0
  272. package/fable_modules/fable-library.4.1.4/System.Collections.Generic.js +307 -0
  273. package/fable_modules/fable-library.4.1.4/System.Text.d.ts +30 -0
  274. package/fable_modules/fable-library.4.1.4/System.Text.js +110 -0
  275. package/fable_modules/fable-library.4.1.4/SystemException.d.ts +5 -0
  276. package/fable_modules/fable-library.4.1.4/SystemException.js +5 -0
  277. package/fable_modules/fable-library.4.1.4/TimeOnly.d.ts +15 -0
  278. package/fable_modules/fable-library.4.1.4/TimeOnly.js +122 -0
  279. package/fable_modules/fable-library.4.1.4/TimeSpan.d.ts +34 -0
  280. package/fable_modules/fable-library.4.1.4/TimeSpan.js +177 -0
  281. package/fable_modules/fable-library.4.1.4/Timer.d.ts +19 -0
  282. package/fable_modules/fable-library.4.1.4/Timer.js +67 -0
  283. package/fable_modules/fable-library.4.1.4/Types.d.ts +58 -0
  284. package/fable_modules/fable-library.4.1.4/Types.js +208 -0
  285. package/fable_modules/fable-library.4.1.4/Unicode.13.0.0.d.ts +2 -0
  286. package/fable_modules/fable-library.4.1.4/Unicode.13.0.0.js +4 -0
  287. package/fable_modules/fable-library.4.1.4/Uri.d.ts +29 -0
  288. package/fable_modules/fable-library.4.1.4/Uri.js +142 -0
  289. package/fable_modules/fable-library.4.1.4/Util.d.ts +187 -0
  290. package/fable_modules/fable-library.4.1.4/Util.js +662 -0
  291. package/fable_modules/fable-library.4.1.4/lib/big.d.ts +338 -0
  292. package/fable_modules/fable-library.4.1.4/lib/big.js +826 -0
  293. package/fable_modules/fable-library.4.1.4/package.json +23 -0
  294. package/fable_modules/project_cracked.json +1 -0
  295. package/index.js +13 -0
  296. package/package.json +24 -0
@@ -0,0 +1,217 @@
1
+ import { Result_MapError, Result_Map, FSharpResult$2 } from "../fable-library.4.1.4/Choice.js";
2
+ import { class_type } from "../fable-library.4.1.4/Reflection.js";
3
+ import { disposeSafe, getEnumerator } from "../fable-library.4.1.4/Util.js";
4
+
5
+ /**
6
+ * This is an identity function, it calls the given function and return the promise value untouched.
7
+ * <example>
8
+ * <code lang="fsharp">
9
+ * fetchUser ()
10
+ * |> Promise.tap (fun user ->
11
+ * // Do something
12
+ * console.log "The user has been received"
13
+ * )
14
+ * |> Promise.map (fun user ->
15
+ * // user value is available here untouched
16
+ * )
17
+ * </code>
18
+ * </example>
19
+ */
20
+ export function tap(fn, a) {
21
+ return a.then((x) => {
22
+ fn(x);
23
+ return x;
24
+ });
25
+ }
26
+
27
+ /**
28
+ * Map the <c>Promise</c> result into a <c>Result</c> type.
29
+ * <example>
30
+ * <code lang="fsharp">
31
+ * Success example
32
+ * Promise.lift 42
33
+ * |> Promise.result
34
+ * |> Promise.map (fun value ->
35
+ * // value = Ok 42
36
+ * )
37
+ *
38
+ * // Fail example
39
+ * Promise.reject "Invalid value"
40
+ * |> Promise.result
41
+ * |> Promise.map (fun value ->
42
+ * // value = Error "Invalid value"
43
+ * )
44
+ * </code>
45
+ * </example>
46
+ */
47
+ export function result(a) {
48
+ return a.then((arg) => (new FSharpResult$2(0, [arg]))).catch((arg_1) => (new FSharpResult$2(1, [arg_1])));
49
+ }
50
+
51
+ /**
52
+ * Evaluates to `myPromise |> Promise.map (Result.map fn)`
53
+ * <example>
54
+ * <code lang="fsharp">
55
+ * Promise.lift 42
56
+ * |> Promise.result
57
+ * |> Promise.mapResult (fun value ->
58
+ * value + 10
59
+ * )
60
+ * |> Promise.map (fun value ->
61
+ * // value = Ok 52
62
+ * )
63
+ * </code>
64
+ * </example>
65
+ */
66
+ export function mapResult(fn, a) {
67
+ return a.then((result_1) => Result_Map(fn, result_1));
68
+ }
69
+
70
+ /**
71
+ * Transform the success part of a result promise into another promise.
72
+ * <example>
73
+ * <code lang="fsharp">
74
+ * let multiplyBy2 (value : int) =
75
+ * Promise.create (fun resolve reject ->
76
+ * resolve (value * 2)
77
+ * )
78
+ *
79
+ * Promise.lift 42
80
+ * |> Promise.result
81
+ * |> Promise.bindResult (fun value ->
82
+ * multiplyBy2 value
83
+ * )
84
+ * |> Promise.map (fun value ->
85
+ * // value = Ok 84
86
+ * )
87
+ * </code>
88
+ * </example>
89
+ */
90
+ export function bindResult(fn, a) {
91
+ return a.then((a_1) => {
92
+ if (a_1.tag === 1) {
93
+ return Promise.resolve(new FSharpResult$2(1, [a_1.fields[0]]));
94
+ }
95
+ else {
96
+ const pr = fn(a_1.fields[0]);
97
+ return pr.then((arg) => (new FSharpResult$2(0, [arg])));
98
+ }
99
+ });
100
+ }
101
+
102
+ /**
103
+ * Evaluates to <c>myPromise |> Promise.map (Result.map fn)</c>
104
+ * <example>
105
+ * <code lang="fsharp">
106
+ * Promise.reject -1
107
+ * |> Promise.result
108
+ * |> Promise.mapResultError (fun value ->
109
+ * $"%s{value} is not a valid value"
110
+ * )
111
+ * |> Promise.map (fun value ->
112
+ * // value = Error "-1 is not a valid value"
113
+ * )
114
+ * </code>
115
+ * </example>
116
+ */
117
+ export function mapResultError(fn, a) {
118
+ return a.then((result_1) => Result_MapError(fn, result_1));
119
+ }
120
+
121
+ export class PromiseBuilder {
122
+ constructor() {
123
+ }
124
+ }
125
+
126
+ export function PromiseBuilder_$reflection() {
127
+ return class_type("Promise.PromiseBuilder", void 0, PromiseBuilder);
128
+ }
129
+
130
+ export function PromiseBuilder_$ctor() {
131
+ return new PromiseBuilder();
132
+ }
133
+
134
+ export function PromiseBuilder__For_1565554B(_, seq, body) {
135
+ let pr;
136
+ let p = Promise.resolve(void 0);
137
+ const enumerator = getEnumerator(seq);
138
+ try {
139
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
140
+ const a = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
141
+ p = ((pr = p, pr.then(() => body(a))));
142
+ }
143
+ }
144
+ finally {
145
+ disposeSafe(enumerator);
146
+ }
147
+ return p;
148
+ }
149
+
150
+ export function PromiseBuilder__While_2044D34(this$, guard, p) {
151
+ if (guard()) {
152
+ return p.then(() => PromiseBuilder__While_2044D34(this$, guard, p));
153
+ }
154
+ else {
155
+ return Promise.resolve(void 0);
156
+ }
157
+ }
158
+
159
+ export function PromiseBuilder__TryFinally_7D49A2FD(_, p, compensation) {
160
+ return p.then((x) => {
161
+ compensation();
162
+ return x;
163
+ }).catch((er) => {
164
+ compensation();
165
+ throw er;
166
+ });
167
+ }
168
+
169
+ export function PromiseBuilder__Delay_62FBFDE1(_, generator) {
170
+ return {
171
+ then: (onSuccess, onError) => {
172
+ try {
173
+ return generator().then(onSuccess, onError);
174
+ }
175
+ catch (er) {
176
+ if (onError == null) {
177
+ return Promise.reject(er);
178
+ }
179
+ else {
180
+ try {
181
+ const a = onError(er);
182
+ return Promise.resolve(a);
183
+ }
184
+ catch (er_1) {
185
+ return Promise.reject(er_1);
186
+ }
187
+ }
188
+ }
189
+ },
190
+ catch: (onError_1) => {
191
+ try {
192
+ return generator().catch(onError_1);
193
+ }
194
+ catch (er_2) {
195
+ try {
196
+ const a_1 = onError_1(er_2);
197
+ return Promise.resolve(a_1);
198
+ }
199
+ catch (er_3) {
200
+ return Promise.reject(er_3);
201
+ }
202
+ }
203
+ },
204
+ };
205
+ }
206
+
207
+ export function PromiseBuilder__Run_212F1D4B(_, p) {
208
+ return p.then((x) => x);
209
+ }
210
+
211
+ export function PromiseBuilder__Using_74F7E79D(this$, resource, binder) {
212
+ return PromiseBuilder__TryFinally_7D49A2FD(this$, binder(resource), () => {
213
+ let copyOfStruct = resource;
214
+ disposeSafe(copyOfStruct);
215
+ });
216
+ }
217
+
@@ -0,0 +1,31 @@
1
+ [<AutoOpen>]
2
+ module PromiseImpl
3
+
4
+ let promise = Promise.PromiseBuilder()
5
+
6
+ [<RequireQualifiedAccess>]
7
+ module SettledValue =
8
+
9
+ /// <summary>
10
+ /// Helper functionm to convert a settled result into an F# result
11
+ /// </summary>
12
+ /// <param name="p">The settled result</param>
13
+ /// <typeparam name="'T"></typeparam>
14
+ /// <returns>The F# result</returns>
15
+ /// <example>
16
+ /// <code lang="fsharp">
17
+ /// Promise.allSettled [success; rejection]
18
+ /// |> Promise.iter (fun results ->
19
+ /// for result in results do
20
+ /// match SettledValue.toResult result with
21
+ /// | Ok value ->
22
+ /// printfn "Success: %A" value
23
+ /// | Error err ->
24
+ /// eprintfn "Error: %O" err
25
+ /// )
26
+ /// </code>
27
+ /// </example>
28
+ let toResult (p: Promise.SettledValue<'T>) =
29
+ match p.status with
30
+ | Promise.Fulfilled -> Ok p.value.Value
31
+ | Promise.Rejected -> Error p.reason.Value
@@ -0,0 +1,19 @@
1
+ import { PromiseBuilder_$ctor } from "./Promise.fs.js";
2
+ import { value } from "../fable-library.4.1.4/Option.js";
3
+ import { FSharpResult$2 } from "../fable-library.4.1.4/Choice.js";
4
+
5
+ export const promise = PromiseBuilder_$ctor();
6
+
7
+ /**
8
+ * Helper functionm to convert a settled result into an F# result
9
+ */
10
+ export function SettledValue_toResult(p) {
11
+ const matchValue = p.status;
12
+ if (matchValue === "rejected") {
13
+ return new FSharpResult$2(1, [value(p.reason)]);
14
+ }
15
+ else {
16
+ return new FSharpResult$2(0, [value(p.value)]);
17
+ }
18
+ }
19
+
@@ -0,0 +1,23 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+ <PropertyGroup>
3
+ <Description>A library for easily making Http requests in Fable projects.</Description>
4
+ <PackageProjectUrl>https://github.com/Zaid-Ajaj/Fable.SimpleHttp</PackageProjectUrl>
5
+ <RepositoryUrl>https://github.com/Zaid-Ajaj/Fable.SimpleHttp.git</RepositoryUrl>
6
+ <PackageLicenseUrl>https://github.com/Zaid-Ajaj/Fable.SimpleHttp/blob/master/LICENSE</PackageLicenseUrl>
7
+ <PackageIconUrl></PackageIconUrl>
8
+ <PackageTags>fsharp;fable;http</PackageTags>
9
+ <Authors>Zaid Ajaj</Authors>
10
+ <Version>3.5.0</Version>
11
+ <TargetFramework>netstandard2.0</TargetFramework>
12
+ <PackageReleaseNotes>Removing prerelease flag from Fable.Core dependency</PackageReleaseNotes>
13
+ <GenerateDocumentationFile>true</GenerateDocumentationFile>
14
+ </PropertyGroup>
15
+ <ItemGroup>
16
+ <Compile Include="Types.fs" />
17
+ <Compile Include="Http.fs" />
18
+ </ItemGroup>
19
+ <ItemGroup>
20
+ <Content Include="*.fsproj; *.fs;" Exclude="**\*.fs.js" PackagePath="fable\" />
21
+ </ItemGroup>
22
+ <Import Project="..\.paket\Paket.Restore.targets" />
23
+ </Project>
@@ -0,0 +1,357 @@
1
+ namespace Fable.SimpleHttp
2
+
3
+ open System
4
+ open Browser
5
+ open Browser.Types
6
+ open Fable.Core
7
+
8
+ #if !FABLE_COMPILER
9
+ open System.Net.Http
10
+ #endif
11
+
12
+ module Blob =
13
+ /// Creates a Blob from the given input string
14
+ [<Emit("new Blob([$0], { 'type':'text/plain' })")>]
15
+ let fromText (value: string) : Blob = jsNative
16
+
17
+ [<Emit("window.URL.createObjectURL($0)")>]
18
+ let createObjectURL (blob: Blob) : string = jsNative
19
+
20
+ /// Download a Blob
21
+ let download (blob: Blob) (fileName: string) =
22
+ let element = unbox<HTMLAnchorElement> (document.createElement "a")
23
+ element.target <- "_blank"
24
+ element.href <- createObjectURL(blob)
25
+ element.setAttribute("download", fileName)
26
+ document.body.appendChild(element) |> ignore
27
+ element.click()
28
+ document.body.removeChild(element) |> ignore
29
+
30
+ module File =
31
+ /// Creates a File from the given input string and file name
32
+ [<Emit("new File([$0], $1, { 'type':'text/plain' })")>]
33
+ let fromText (value: string) (fileName: string) : File = jsNative
34
+
35
+
36
+ /// Utility functions to work with blob and file APIs.
37
+ module FileReader =
38
+ /// Asynchronously reads the blob data content as string
39
+ let readBlobAsText (blob: Blob) : Async<string> =
40
+ Async.FromContinuations <| fun (resolve, _, _) ->
41
+ let reader = FileReader.Create()
42
+ reader.onload <- fun _ ->
43
+ if reader.readyState = FileReaderState.DONE
44
+ then resolve (unbox reader.result)
45
+
46
+ reader.readAsText(blob)
47
+
48
+ /// Asynchronously reads the blob data content as string
49
+ let readFileAsText (file: File) : Async<string> =
50
+ Async.FromContinuations <| fun (resolve, _, _) ->
51
+ let reader = FileReader.Create()
52
+ reader.onload <- fun _ ->
53
+ if reader.readyState = FileReaderState.DONE
54
+ then resolve (unbox reader.result)
55
+
56
+ reader.readAsText(file)
57
+
58
+ module FormData =
59
+
60
+ /// Creates a new FormData object
61
+ [<Emit("new FormData()")>]
62
+ let create() : FormData = jsNative
63
+
64
+ /// Appends a key-value pair to the form data
65
+ let append (key:string) (value:string) (form : FormData) : FormData =
66
+ form.append(key, value)
67
+ form
68
+
69
+ /// Appends a file to the form data
70
+ let appendFile (key: string) (file: File) (form: FormData) : FormData =
71
+ form.append (key, file)
72
+ form
73
+
74
+ /// Appends a named file to the form data
75
+ let appendNamedFile (key: string) (fileName: string) (file: File) (form: FormData) : FormData =
76
+ form.append (key, file, fileName)
77
+ form
78
+
79
+ /// Appends a blog to the form data
80
+ let appendBlob (key: string) (blob: Blob) (form: FormData) : FormData =
81
+ form.append (key, blob)
82
+ form
83
+
84
+ /// Appends a blog to the form data
85
+ let appendNamedBlob (key: string) (fileName: string) (blob: Blob) (form: FormData) : FormData =
86
+ form.append (key, blob, fileName)
87
+ form
88
+
89
+ module Headers =
90
+ let contentType value = Header("Content-Type", value)
91
+ let accept value = Header("Accept", value)
92
+ let acceptCharset value = Header("Accept-Charset", value)
93
+ let acceptEncoding value = Header("Accept-Encoding", value)
94
+ let acceptLanguage value = Header("Accept-Language", value)
95
+ let acceptDateTime value = Header("Accept-Datetime", value)
96
+ let authorization value = Header("Authorization", value)
97
+ let cacheControl value = Header("Cache-Control", value)
98
+ let connection value = Header("Connection", value)
99
+ let cookie value = Header("Cookie", value)
100
+ let contentMD5 value = Header("Content-MD5", value)
101
+ let date value = Header("Date", value)
102
+ let expect value = Header("Expect", value)
103
+ let ifMatch value = Header("If-Match", value)
104
+ let ifModifiedSince value = Header("If-Modified-Since", value)
105
+ let ifNoneMatch value = Header("If-None-Match", value)
106
+ let ifRange value = Header("If-Range", value)
107
+ let IfUnmodifiedSince value = Header("If-Unmodified-Since", value)
108
+ let maxForwards value = Header("Max-Forwards", value)
109
+ let origin value = Header ("Origin", value)
110
+ let pragma value = Header("Pragma", value)
111
+ let proxyAuthorization value = Header("Proxy-Authorization", value)
112
+ let range value = Header("Range", value)
113
+ let referer value = Header("Referer", value)
114
+ let userAgent value = Header("User-Agent", value)
115
+ let create key value = Header(key, value)
116
+
117
+ module Http =
118
+
119
+ let private defaultRequest =
120
+ { url = "";
121
+ method = HttpMethod.GET
122
+ headers = []
123
+ withCredentials = false
124
+ overridenMimeType = None
125
+ overridenResponseType = None
126
+ timeout = None
127
+ content = BodyContent.Empty }
128
+
129
+ let private emptyResponse =
130
+ { statusCode = 0
131
+ responseText = ""
132
+ responseType = ""
133
+ responseUrl = ""
134
+ responseHeaders = Map.empty
135
+ content = ResponseContent.Text "" }
136
+
137
+ let private splitAt (delimiter: string) (input: string) : string [] =
138
+ if String.IsNullOrEmpty input then [| input |]
139
+ else input.Split([| delimiter |], StringSplitOptions.None)
140
+
141
+ let private serializeMethod = function
142
+ | HttpMethod.GET -> "GET"
143
+ | HttpMethod.POST -> "POST"
144
+ | HttpMethod.PATCH -> "PATCH"
145
+ | HttpMethod.PUT -> "PUT"
146
+ | HttpMethod.DELETE -> "DELETE"
147
+ | HttpMethod.OPTIONS -> "OPTIONS"
148
+ | HttpMethod.HEAD -> "HEAD"
149
+
150
+ /// Starts the configuration of the request with the specified url
151
+ let request (url: string) : HttpRequest =
152
+ { defaultRequest with url = url }
153
+
154
+ /// Sets the Http method of the request
155
+ let method httpVerb (req: HttpRequest) =
156
+ { req with method = httpVerb }
157
+
158
+ /// Appends a header to the request configuration
159
+ let header (singleHeader: Header) (req: HttpRequest) =
160
+ { req with headers = List.append req.headers [singleHeader] }
161
+
162
+ /// Appends a list of headers to the request configuration
163
+ let headers (values: Header list) (req: HttpRequest) =
164
+ { req with headers = List.append req.headers values }
165
+
166
+ /// Enables cross-site credentials such as cookies
167
+ let withCredentials (enabled: bool) (req: HttpRequest) =
168
+ { req with withCredentials = enabled }
169
+
170
+ /// Enables Http request timeout
171
+ let withTimeout (timeoutInMilliseconds: int) (req: HttpRequest) =
172
+ { req with timeout = Some timeoutInMilliseconds}
173
+
174
+ /// Specifies a MIME type other than the one provided by the server to be used instead when interpreting the data being transferred in a request. This may be used, for example, to force a stream to be treated and parsed as "text/xml", even if the server does not report it as such.
175
+ let overrideMimeType (value: string) (req: HttpRequest) =
176
+ { req with overridenMimeType = Some value }
177
+
178
+ /// Change the expected response type from the server
179
+ let overrideResponseType (value: ResponseTypes) (req: HttpRequest) =
180
+ { req with overridenResponseType = Some value }
181
+
182
+ /// Sets the body content of the request
183
+ let content (bodyContent: BodyContent) (req: HttpRequest) : HttpRequest =
184
+ { req with content = bodyContent }
185
+
186
+ /// Sends the request to the server, this function does not throw
187
+ let send (req: HttpRequest) : Async<HttpResponse> =
188
+ #if FABLE_COMPILER
189
+ Async.FromContinuations <| fun (resolve, reject, _) ->
190
+ let xhr = XMLHttpRequest.Create()
191
+ xhr.``open``(serializeMethod req.method, req.url)
192
+ xhr.onreadystatechange <- fun _ ->
193
+ if xhr.readyState = ReadyState.Done
194
+ then resolve {
195
+ responseText =
196
+ match xhr.responseType with
197
+ | "" -> xhr.responseText
198
+ | "text" -> xhr.responseText
199
+ | _ -> ""
200
+
201
+ statusCode = int xhr.status
202
+ responseType = xhr.responseType
203
+ content =
204
+ match xhr.responseType with
205
+ | ("" | "text") -> ResponseContent.Text xhr.responseText
206
+ | "arraybuffer" -> ResponseContent.ArrayBuffer (unbox xhr.response)
207
+ | "blob" -> ResponseContent.Blob (unbox xhr.response)
208
+ | _ -> ResponseContent.Unknown xhr.response
209
+
210
+ responseHeaders =
211
+ xhr.getAllResponseHeaders()
212
+ |> splitAt "\r\n"
213
+ |> Array.choose (fun headerLine ->
214
+ let parts = splitAt ":" headerLine
215
+ match List.ofArray parts with
216
+ | key :: rest -> Some (key.ToLower(), (String.concat ":" rest).Trim())
217
+ | otherwise -> None)
218
+ |> Map.ofArray
219
+
220
+ responseUrl = xhr.responseURL
221
+ }
222
+
223
+ for (Header(key, value)) in req.headers do
224
+ xhr.setRequestHeader(key, value)
225
+
226
+ xhr.withCredentials <- req.withCredentials
227
+
228
+ match req.overridenMimeType with
229
+ | Some mimeType -> xhr.overrideMimeType(mimeType)
230
+ | None -> ()
231
+
232
+ match req.overridenResponseType with
233
+ | Some ResponseTypes.Text -> xhr.responseType <- "text"
234
+ | Some ResponseTypes.Blob -> xhr.responseType <- "blob"
235
+ | Some ResponseTypes.ArrayBuffer -> xhr.responseType <- "arraybuffer"
236
+ | None -> ()
237
+
238
+ match req.timeout with
239
+ | Some timeout -> xhr.timeout <- timeout
240
+ | None -> ()
241
+
242
+ match req.content with
243
+ | BodyContent.Empty -> xhr.send()
244
+ | BodyContent.Text value -> xhr.send(value)
245
+ | BodyContent.Form formData -> xhr.send(formData)
246
+ | BodyContent.Binary blob -> xhr.send(blob)
247
+ #else
248
+ async {
249
+ try
250
+ use requestMessage = new HttpRequestMessage()
251
+ requestMessage.RequestUri <- Uri(req.url)
252
+ requestMessage.Method <-
253
+ match req.method with
254
+ | HttpMethod.GET -> HttpMethod.Get
255
+ | HttpMethod.POST -> HttpMethod.Post
256
+ | HttpMethod.PUT -> HttpMethod.Put
257
+ | HttpMethod.PATCH -> HttpMethod "PATCH"
258
+ | HttpMethod.DELETE -> HttpMethod.Delete
259
+ | HttpMethod.HEAD -> HttpMethod.Head
260
+ | HttpMethod.OPTIONS -> HttpMethod.Options
261
+ req.headers
262
+ |> Seq.iter (fun (Header (key, value)) ->
263
+ requestMessage.Headers.Add(key, value))
264
+ use content =
265
+ match req.content with
266
+ | BodyContent.Text text -> new StringContent(text)
267
+ | BodyContent.Empty -> null
268
+ | _ -> failwith "Only BodyContent.Text is supported in the dotnet implementation"
269
+ requestMessage.Content <- content
270
+
271
+ use client = new HttpClient()
272
+
273
+ match req.timeout with
274
+ | Some timeout -> client.Timeout <- TimeSpan.FromMilliseconds(timeout)
275
+ | None -> ()
276
+
277
+ let! response = client.SendAsync requestMessage |> Async.AwaitTask
278
+ let! responseBody = response.Content.ReadAsStringAsync() |> Async.AwaitTask
279
+
280
+ let headers =
281
+ response.Headers
282
+ |> Seq.choose (fun kv ->
283
+ kv.Value
284
+ |> Seq.tryLast
285
+ |> Option.map (fun value -> kv.Key, value))
286
+ |> Map.ofSeq
287
+
288
+ return
289
+ { statusCode = int response.StatusCode
290
+ responseText = responseBody
291
+ responseType = "text"
292
+ responseHeaders = headers
293
+ responseUrl = req.url
294
+ content = ResponseContent.Text responseBody }
295
+ with
296
+ // We're catching a lot here to mimic the behaviour of the JS
297
+ // implementation, which isn't able to expose the kind of error.
298
+ | :? ArgumentException ->
299
+ return emptyResponse // invalid uri
300
+ | :? HttpRequestException
301
+ | :? AggregateException as aggrEx when (aggrEx.InnerException :? HttpRequestException) ->
302
+ return emptyResponse // connection errors
303
+ }
304
+ #endif
305
+
306
+ /// Safely sends a GET request and returns a tuple(status code * response text). This function does not throw.
307
+ let get url : Async<int * string> =
308
+ async {
309
+ let! response =
310
+ request url
311
+ |> method HttpMethod.GET
312
+ |> send
313
+ return response.statusCode, response.responseText
314
+ }
315
+
316
+ /// Safely sends a PUT request and returns a tuple(status code * response text). This function does not throw.
317
+ let put url (data: string) : Async<int * string> =
318
+ async {
319
+ let! response =
320
+ request url
321
+ |> method HttpMethod.PUT
322
+ |> content (BodyContent.Text data)
323
+ |> send
324
+ return response.statusCode, response.responseText
325
+ }
326
+
327
+ /// Safely sends a DELETE request and returns a tuple(status code * response text). This function does not throw.
328
+ let delete url : Async<int * string> =
329
+ async {
330
+ let! response =
331
+ request url
332
+ |> method HttpMethod.DELETE
333
+ |> send
334
+ return response.statusCode, response.responseText
335
+ }
336
+
337
+ /// Safely sends a PATCH request and returns a tuple(status code * response text). This function does not throw.
338
+ let patch url (data: string) : Async<int * string> =
339
+ async {
340
+ let! response =
341
+ request url
342
+ |> method HttpMethod.PATCH
343
+ |> content (BodyContent.Text data)
344
+ |> send
345
+ return response.statusCode, response.responseText
346
+ }
347
+
348
+ /// Safely sends a POST request and returns a tuple(status code * response text). This function does not throw.
349
+ let post url (data: string) : Async<int * string> =
350
+ async {
351
+ let! response =
352
+ request url
353
+ |> method HttpMethod.POST
354
+ |> content (BodyContent.Text data)
355
+ |> send
356
+ return response.statusCode, response.responseText
357
+ }