git.iko.soy/rowtype-yoga/purescript-fetch
on main help sign in
17 files changed+2061−229
since splitsnapshots
unifiedsplit
.github/workflows/check.yaml+12−17 .gitignore+1 CHANGELOG.md+34 README.md+4−3 bower.json−33 packages.dhall−33 spago.dhall−23 spago.lock+1746 spago.yaml+51 src/Fetch.purs+38−40 src/Fetch/Internal/Headers.purs+22 src/Fetch/Internal/Request.purs+36−36 src/Fetch/Internal/RequestBody.purs+1−1 src/Fetch/Internal/Response.purs+11−16 test.dhall−21 test/Main.purs+2−3 test/Test/FetchSpec.purs+103−3
.github/workflows/check.yaml+12−17
@@ -2,47 +2,42 @@ name: CI
22
33on:
44 push:
5− branches: [main]
65 pull_request:
7− branches: [main]
86
97jobs:
108 build:
119 runs-on: ubuntu-latest
1210
1311 steps:
14− - uses: actions/checkout@v2
12+ - uses: actions/checkout@v4
1513
1614 - name: Set up a PureScript toolchain
1715 uses: purescript-contrib/setup-purescript@main
1816 with:
1917 purescript: "unstable"
20− purs-tidy: "latest"
18+ spago: "unstable"
19+ # purs-tidy: "latest"
2120
22− - uses: actions/setup-node@v2
21+ - uses: actions/setup-node@v4.3.0
2322 with:
24− node-version: "18"
23+ node-version: "20"
24+
2525 - name: Cache PureScript dependencies
26− uses: actions/cache@v2
26+ uses: actions/cache@v4
2727 with:
2828 key: ${{ runner.os }}-spago-${{ hashFiles('**/*.dhall') }}
2929 path: |
3030 .spago
3131 output
32+
3233 - name: Install dependencies
3334 run: spago install
3435
3536 - name: Build source
36− run: spago build --no-install --purs-args '--censor-lib --strict'
37+ run: spago build
3738
3839 - name: Run tests
39− run: NODE_OPTIONS=--experimental-fetch spago -x test.dhall test
40−
41− - name: Check formatting
42− run: purs-tidy check src test
40+ run: spago test
4341
44− - name: Verify Bower & Pulp
45− run: |
46− npm install bower pulp@16.0.1
47− npx bower install
48− npx pulp build -- --censor-lib --strict
42+ # - name: Check formatting
43+ # run: purs-tidy check src test
.gitignore+1
@@ -4,6 +4,7 @@
44/output/
55/generated-docs/
66/.psc-package/
7+/.idea/
78/.psc*
89/.purs*
910/.psa*
CHANGELOG.mdnew file+34
@@ -0,0 +1,34 @@
1+# Changelog
2+
3+Notable changes to this project are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4+
5+## [Unreleased]
6+
7+Breaking changes:
8+
9+New features:
10+
11+Bugfixes:
12+
13+Other improvements:
14+
15+## [v2.0.0](https://github.com/rowtype-yoga/purescript-fetch/releases/tag/v2.0.0) - 2023-08-07
16+
17+Breaking changes:
18+- Switch response headers to `Map CaseInsensitiveString String`
19+- Switch web-promise dependency to js-promise
20+
21+## [v1.1.0](https://github.com/rowtype-yoga/purescript-fetch/releases/tag/v1.1.0) - 2022-08-22
22+
23+Breaking changes:
24+
25+New features:
26+- Relax constraints to make type signatures simpler (@i-am-the-slime #1)
27+
28+Bugfixes:
29+
30+Other improvements:
31+
32+## [v1.0.0](https://github.com/rowtype-yoga/purescript-fetch/releases/tag/v1.0.0) - 2020-08-21
33+
34+- Initial release
README.md+4−3
@@ -19,7 +19,7 @@ Node.js `>=17.5` and `<18.0` requires the `--experimental-fetch` node options:
1919```bash
2020NODE_OPTIONS=--experimental-fetch spago run
2121```
22−Node.js `>18.0` you don't need to set the `--experimental-fetch` node option.
22+Node.js `>=18.0` you don't need to set the `--experimental-fetch` node option.
2323
2424Perform a simple `GET` request:
2525```purescript
@@ -41,6 +41,7 @@ do
4141
4242`fetch` works well with `yoga-json` and `argonaut`, use our little helper libraries.
4343
44+
4445### yoga-json
4546
4647```bash
@@ -54,7 +55,7 @@ main :: Effect Unit
5455main = launchAff_ do
5556 { json } <- fetch "https://httpbin.org/post"
5657 { method: POST
57− , body: """{"hello":"world"}"""
58+ , body: writeJSON { hello: "world" }
5859 , headers: { "Content-Type": "application/json" }
5960 }
6061 { json: { hello: world } } :: HttpBinResponse <- fromJSON json
@@ -73,7 +74,7 @@ type HttpBinResponse = { json :: { hello :: String } }
7374do
7475 { json } <- fetch "https://httpbin.org/post"
7576 { method: POST
76− , body: """{"hello":"world"}"""
77+ , body: toJsonString { hello: "world" }
7778 , headers: { "Content-Type": "application/json" }
7879 }
7980 { json: { hello: world } } :: HttpBinResponse <- fromJson json
bower.jsondeleted−33
@@ -1,33 +0,0 @@
1−{
2− "name": "purescript-fetch",
3− "license": [
4− "MIT"
5− ],
6− "repository": {
7− "type": "git",
8− "url": "https://github.com/rowtype-yoga/purescript-fetch.git"
9− },
10− "ignore": [
11− "**/.*",
12− "node_modules",
13− "bower_components",
14− "output"
15− ],
16− "dependencies": {
17− "purescript-aff": "^v7.0.0",
18− "purescript-aff-promise": "^v4.0.0",
19− "purescript-arraybuffer-types": "^v3.0.2",
20− "purescript-effect": "^v4.0.0",
21− "purescript-fetch-core": "https://github.com/rowtype-yoga/purescript-fetch-core.git#v4.0.4",
22− "purescript-foreign": "^v7.0.0",
23− "purescript-http-methods": "^v6.0.0",
24− "purescript-newtype": "^v5.0.0",
25− "purescript-prelude": "^v6.0.0",
26− "purescript-record": "^v4.0.0",
27− "purescript-typelevel-prelude": "^v7.0.0",
28− "purescript-unsafe-coerce": "^v6.0.0",
29− "purescript-web-file": "^v4.0.0",
30− "purescript-web-promise": "https://github.com/purescript-web/purescript-web-promise.git#v3.0.0",
31− "purescript-web-streams": "https://github.com/purescript-web/purescript-web-streams.git#v3.0.0"
32− }
33−}
packages.dhalldeleted−33
@@ -1,33 +0,0 @@
1−
2−let upstream =
3− https://github.com/purescript/package-sets/releases/download/psc-0.15.4-20220816/packages.dhall
4− sha256:8b4467b4b5041914f9b765779c8936d6d4c230b1f60eb64f6269c71812fd7e98
5−
6−in upstream
7− with fetch-core = {
8− dependencies = [
9− "arraybuffer-types"
10− , "arrays"
11− , "console"
12− , "effect"
13− , "foldable-traversable"
14− , "foreign"
15− , "foreign-object"
16− , "functions"
17− , "http-methods"
18− , "maybe"
19− , "newtype"
20− , "nullable"
21− , "prelude"
22− , "record"
23− , "tuples"
24− , "typelevel-prelude"
25− , "unfoldable"
26− , "unsafe-coerce"
27− , "web-file"
28− , "web-promise"
29− , "web-streams"
30− ],
31− version = "v4.0.4",
32− repo = "https://github.com/rowtype-yoga/purescript-fetch-core.git"
33− }
spago.dhalldeleted−23
@@ -1,23 +0,0 @@
1−{ name = "fetch"
2−, dependencies =
3− [ "aff"
4− , "aff-promise"
5− , "arraybuffer-types"
6− , "effect"
7− , "fetch-core"
8− , "foreign"
9− , "http-methods"
10− , "newtype"
11− , "prelude"
12− , "record"
13− , "typelevel-prelude"
14− , "unsafe-coerce"
15− , "web-file"
16− , "web-promise"
17− , "web-streams"
18− ]
19−, packages = ./packages.dhall
20−, sources = [ "src/**/*.purs" ]
21−, license = "MIT"
22−, repository = "https://github.com/rowtype-yoga/purescript-fetch.git"
23−}
spago.locknew file+1746
@@ -0,0 +1,1746 @@
1+{
2+ "workspace": {
3+ "packages": {
4+ "fetch": {
5+ "path": "./",
6+ "core": {
7+ "dependencies": [
8+ "aff",
9+ "arraybuffer-types",
10+ "bifunctors",
11+ "effect",
12+ "either",
13+ "foreign",
14+ "http-methods",
15+ "js-fetch",
16+ "js-promise",
17+ "js-promise-aff",
18+ "maybe",
19+ "newtype",
20+ "ordered-collections",
21+ "prelude",
22+ "record",
23+ "strings",
24+ "typelevel-prelude",
25+ "web-file",
26+ "web-streams"
27+ ],
28+ "build_plan": [
29+ "aff",
30+ "arraybuffer-types",
31+ "arrays",
32+ "bifunctors",
33+ "const",
34+ "contravariant",
35+ "control",
36+ "datetime",
37+ "distributive",
38+ "effect",
39+ "either",
40+ "enums",
41+ "exceptions",
42+ "exists",
43+ "foldable-traversable",
44+ "foreign",
45+ "foreign-object",
46+ "functions",
47+ "functors",
48+ "gen",
49+ "http-methods",
50+ "identity",
51+ "integers",
52+ "invariant",
53+ "js-fetch",
54+ "js-promise",
55+ "js-promise-aff",
56+ "lazy",
57+ "lists",
58+ "maybe",
59+ "media-types",
60+ "newtype",
61+ "nonempty",
62+ "nullable",
63+ "numbers",
64+ "ordered-collections",
65+ "orders",
66+ "parallel",
67+ "partial",
68+ "prelude",
69+ "profunctor",
70+ "record",
71+ "refs",
72+ "safe-coerce",
73+ "st",
74+ "strings",
75+ "tailrec",
76+ "transformers",
77+ "tuples",
78+ "type-equality",
79+ "typelevel-prelude",
80+ "unfoldable",
81+ "unsafe-coerce",
82+ "web-dom",
83+ "web-events",
84+ "web-file",
85+ "web-streams"
86+ ]
87+ },
88+ "test": {
89+ "dependencies": [
90+ "aff",
91+ "datetime",
92+ "effect",
93+ "either",
94+ "exceptions",
95+ "node-buffer",
96+ "node-event-emitter",
97+ "node-http",
98+ "node-net",
99+ "node-streams",
100+ "partial",
101+ "refs",
102+ "spec",
103+ "strings"
104+ ],
105+ "build_plan": [
106+ "aff",
107+ "ansi",
108+ "arraybuffer-types",
109+ "arrays",
110+ "avar",
111+ "bifunctors",
112+ "catenable-lists",
113+ "console",
114+ "const",
115+ "contravariant",
116+ "control",
117+ "datetime",
118+ "distributive",
119+ "effect",
120+ "either",
121+ "enums",
122+ "exceptions",
123+ "exists",
124+ "foldable-traversable",
125+ "foreign",
126+ "foreign-object",
127+ "fork",
128+ "free",
129+ "functions",
130+ "functors",
131+ "gen",
132+ "identity",
133+ "integers",
134+ "invariant",
135+ "js-date",
136+ "lazy",
137+ "lists",
138+ "maybe",
139+ "mmorph",
140+ "newtype",
141+ "node-buffer",
142+ "node-event-emitter",
143+ "node-fs",
144+ "node-http",
145+ "node-net",
146+ "node-path",
147+ "node-streams",
148+ "node-tls",
149+ "node-url",
150+ "nonempty",
151+ "now",
152+ "nullable",
153+ "numbers",
154+ "options",
155+ "ordered-collections",
156+ "orders",
157+ "parallel",
158+ "partial",
159+ "pipes",
160+ "prelude",
161+ "profunctor",
162+ "refs",
163+ "safe-coerce",
164+ "spec",
165+ "st",
166+ "strings",
167+ "tailrec",
168+ "transformers",
169+ "tuples",
170+ "type-equality",
171+ "typelevel-prelude",
172+ "unfoldable",
173+ "unsafe-coerce"
174+ ]
175+ }
176+ }
177+ },
178+ "package_set": {
179+ "address": {
180+ "registry": "63.3.0"
181+ },
182+ "compiler": ">=0.15.15 <0.16.0",
183+ "content": {
184+ "abc-parser": "2.0.1",
185+ "ace": "9.1.0",
186+ "address-rfc2821": "0.1.1",
187+ "aff": "8.0.0",
188+ "aff-bus": "6.0.0",
189+ "aff-coroutines": "9.0.0",
190+ "aff-promise": "4.0.0",
191+ "aff-retry": "2.0.0",
192+ "affjax": "13.0.0",
193+ "affjax-node": "1.0.0",
194+ "affjax-web": "1.0.0",
195+ "ansi": "7.0.0",
196+ "apexcharts": "0.5.0",
197+ "applicative-phases": "1.0.0",
198+ "argonaut": "9.0.0",
199+ "argonaut-aeson-generic": "0.4.1",
200+ "argonaut-codecs": "9.1.0",
201+ "argonaut-core": "7.0.0",
202+ "argonaut-generic": "8.0.0",
203+ "argonaut-traversals": "10.0.0",
204+ "argparse-basic": "2.0.0",
205+ "array-builder": "0.1.2",
206+ "array-search": "0.6.0",
207+ "arraybuffer": "13.2.0",
208+ "arraybuffer-builder": "3.1.0",
209+ "arraybuffer-types": "3.0.2",
210+ "arrays": "7.3.0",
211+ "arrays-extra": "0.6.1",
212+ "arrays-zipper": "2.0.1",
213+ "ask": "1.0.0",
214+ "assert": "6.0.0",
215+ "assert-multiple": "0.4.0",
216+ "avar": "5.0.1",
217+ "b64": "0.0.8",
218+ "barbies": "1.0.1",
219+ "barlow-lens": "0.9.0",
220+ "bifunctors": "6.0.0",
221+ "bigints": "7.0.1",
222+ "bolson": "0.3.9",
223+ "bookhound": "0.1.7",
224+ "bower-json": "3.0.0",
225+ "call-by-name": "4.0.1",
226+ "canvas": "6.0.0",
227+ "canvas-action": "9.0.0",
228+ "cartesian": "1.0.6",
229+ "catenable-lists": "7.0.0",
230+ "cbor-stream": "1.3.0",
231+ "chameleon": "1.0.0",
232+ "chameleon-halogen": "1.0.3",
233+ "chameleon-react-basic": "1.1.0",
234+ "chameleon-styled": "2.5.0",
235+ "chameleon-transformers": "1.0.0",
236+ "channel": "1.0.0",
237+ "checked-exceptions": "3.1.1",
238+ "choku": "1.0.2",
239+ "classless": "0.1.1",
240+ "classless-arbitrary": "0.1.1",
241+ "classless-decode-json": "0.1.1",
242+ "classless-encode-json": "0.1.3",
243+ "classnames": "2.0.0",
244+ "codec": "6.1.0",
245+ "codec-argonaut": "10.0.0",
246+ "codec-json": "2.0.0",
247+ "colors": "7.0.1",
248+ "concur-core": "0.5.0",
249+ "concur-react": "0.5.0",
250+ "concurrent-queues": "3.0.0",
251+ "console": "6.1.0",
252+ "const": "6.0.0",
253+ "contravariant": "6.0.0",
254+ "control": "6.0.0",
255+ "convertable-options": "1.0.0",
256+ "coroutines": "7.0.0",
257+ "css": "6.0.0",
258+ "css-class-name-extractor": "0.0.4",
259+ "css-frameworks": "1.0.1",
260+ "csv-stream": "2.3.0",
261+ "data-mvc": "0.0.2",
262+ "datetime": "6.1.0",
263+ "datetime-parsing": "0.2.0",
264+ "debounce": "0.1.0",
265+ "debug": "6.0.2",
266+ "decimals": "7.1.0",
267+ "default-values": "1.0.1",
268+ "deku": "0.9.23",
269+ "deno": "0.0.5",
270+ "dissect": "1.0.0",
271+ "distributive": "6.0.0",
272+ "dodo-printer": "2.2.3",
273+ "dom-filereader": "7.0.0",
274+ "dom-indexed": "12.0.0",
275+ "dom-simple": "0.4.0",
276+ "dotenv": "4.0.3",
277+ "droplet": "0.6.0",
278+ "dts": "1.0.0",
279+ "dual-numbers": "1.0.3",
280+ "dynamic-buffer": "3.0.1",
281+ "echarts-simple": "0.0.1",
282+ "effect": "4.0.0",
283+ "either": "6.1.0",
284+ "elmish": "0.13.0",
285+ "elmish-enzyme": "0.1.1",
286+ "elmish-hooks": "0.10.3",
287+ "elmish-html": "0.9.0",
288+ "elmish-testing-library": "0.3.2",
289+ "email-validate": "7.0.0",
290+ "encoding": "0.0.9",
291+ "enums": "6.0.1",
292+ "env-names": "0.4.0",
293+ "error": "2.0.0",
294+ "eta-conversion": "0.3.2",
295+ "exceptions": "6.1.0",
296+ "exists": "6.0.0",
297+ "exitcodes": "4.0.0",
298+ "expect-inferred": "3.0.0",
299+ "ezfetch": "1.1.0",
300+ "fahrtwind": "2.0.0",
301+ "fallback": "0.1.0",
302+ "fast-vect": "1.2.0",
303+ "fetch": "4.1.0",
304+ "fetch-argonaut": "1.0.1",
305+ "fetch-core": "5.1.0",
306+ "fetch-yoga-json": "1.1.0",
307+ "ffi-simple": "0.5.1",
308+ "fft-js": "0.1.0",
309+ "filterable": "5.0.0",
310+ "fix-functor": "0.1.0",
311+ "fixed-points": "7.0.0",
312+ "fixed-precision": "5.0.0",
313+ "flame": "1.3.0",
314+ "float32": "2.0.0",
315+ "fmt": "0.2.1",
316+ "foldable-traversable": "6.0.0",
317+ "foldable-traversable-extra": "0.0.6",
318+ "foreign": "7.0.0",
319+ "foreign-object": "4.1.0",
320+ "foreign-readwrite": "3.4.0",
321+ "forgetmenot": "0.1.0",
322+ "fork": "6.0.0",
323+ "form-urlencoded": "7.0.0",
324+ "formatters": "7.0.0",
325+ "framer-motion": "1.0.1",
326+ "free": "7.1.0",
327+ "freeap": "7.0.0",
328+ "freer-free": "0.0.1",
329+ "freet": "7.0.0",
330+ "functions": "6.0.0",
331+ "functor1": "3.0.0",
332+ "functors": "5.0.0",
333+ "fuzzy": "0.4.0",
334+ "gen": "4.0.0",
335+ "generate-values": "1.0.1",
336+ "generic-router": "0.0.1",
337+ "geojson": "0.0.5",
338+ "geometria": "2.2.0",
339+ "gojs": "0.1.1",
340+ "grain": "3.0.0",
341+ "grain-router": "3.0.0",
342+ "grain-virtualized": "3.0.0",
343+ "graphs": "8.1.0",
344+ "group": "4.1.1",
345+ "halogen": "7.0.0",
346+ "halogen-bootstrap5": "5.3.2",
347+ "halogen-canvas": "1.0.0",
348+ "halogen-css": "10.0.0",
349+ "halogen-echarts-simple": "0.0.4",
350+ "halogen-formless": "4.0.3",
351+ "halogen-helix": "1.0.1",
352+ "halogen-hooks": "0.6.3",
353+ "halogen-hooks-extra": "0.9.0",
354+ "halogen-infinite-scroll": "1.1.0",
355+ "halogen-store": "0.5.4",
356+ "halogen-storybook": "2.0.0",
357+ "halogen-subscriptions": "2.0.0",
358+ "halogen-svg-elems": "8.0.0",
359+ "halogen-typewriter": "1.0.4",
360+ "halogen-vdom": "8.0.0",
361+ "halogen-vdom-string-renderer": "0.5.0",
362+ "halogen-xterm": "2.0.0",
363+ "heckin": "2.0.1",
364+ "heterogeneous": "0.6.0",
365+ "homogeneous": "0.4.0",
366+ "http-methods": "6.0.0",
367+ "httpurple": "4.0.0",
368+ "huffman": "0.4.0",
369+ "humdrum": "0.0.1",
370+ "hyrule": "2.3.8",
371+ "identity": "6.0.0",
372+ "identy": "4.0.1",
373+ "indexed-db": "1.0.0",
374+ "indexed-monad": "3.0.0",
375+ "int64": "3.0.0",
376+ "integers": "6.0.0",
377+ "interpolate": "5.0.2",
378+ "intersection-observer": "1.0.1",
379+ "invariant": "6.0.0",
380+ "jarilo": "1.0.1",
381+ "jelly": "0.10.0",
382+ "jelly-router": "0.3.0",
383+ "jelly-signal": "0.4.0",
384+ "jest": "1.0.0",
385+ "js-abort-controller": "1.0.0",
386+ "js-bigints": "2.2.1",
387+ "js-date": "8.0.0",
388+ "js-fetch": "0.2.1",
389+ "js-fileio": "3.0.0",
390+ "js-intl": "1.1.4",
391+ "js-iterators": "0.1.1",
392+ "js-maps": "0.1.2",
393+ "js-promise": "1.0.0",
394+ "js-promise-aff": "1.0.0",
395+ "js-timers": "6.1.0",
396+ "js-uri": "3.1.0",
397+ "jsdom": "1.0.0",
398+ "json": "1.1.0",
399+ "json-codecs": "5.0.0",
400+ "justifill": "0.5.0",
401+ "jwt": "0.0.9",
402+ "labeled-data": "0.2.0",
403+ "language-cst-parser": "0.14.1",
404+ "lazy": "6.0.0",
405+ "lazy-joe": "1.0.0",
406+ "lcg": "4.0.0",
407+ "leibniz": "5.0.0",
408+ "leveldb": "1.0.1",
409+ "liminal": "1.0.1",
410+ "linalg": "6.0.0",
411+ "lists": "7.0.0",
412+ "literals": "1.0.2",
413+ "logging": "3.0.0",
414+ "logging-journald": "0.4.0",
415+ "lumi-components": "18.0.0",
416+ "machines": "7.0.0",
417+ "maps-eager": "0.5.0",
418+ "marionette": "1.0.0",
419+ "marionette-react-basic-hooks": "0.1.1",
420+ "marked": "0.1.0",
421+ "matrices": "5.0.1",
422+ "matryoshka": "1.0.0",
423+ "maybe": "6.0.0",
424+ "media-types": "6.0.0",
425+ "meowclient": "1.0.0",
426+ "midi": "4.0.0",
427+ "milkis": "9.0.0",
428+ "minibench": "4.0.1",
429+ "mmorph": "7.0.0",
430+ "monad-control": "5.0.0",
431+ "monad-logger": "1.3.1",
432+ "monad-loops": "0.5.0",
433+ "monad-unlift": "1.0.1",
434+ "monoid-extras": "0.0.1",
435+ "monoidal": "0.16.0",
436+ "morello": "0.4.0",
437+ "mote": "3.0.0",
438+ "motsunabe": "2.0.0",
439+ "mvc": "0.0.1",
440+ "mysql": "6.0.1",
441+ "n3": "0.1.0",
442+ "nano-id": "1.1.0",
443+ "nanoid": "0.1.0",
444+ "naturals": "3.0.0",
445+ "nested-functor": "0.2.1",
446+ "newtype": "5.0.0",
447+ "nextjs": "0.1.1",
448+ "nextui": "0.2.0",
449+ "node-buffer": "9.0.0",
450+ "node-child-process": "11.1.0",
451+ "node-event-emitter": "3.0.0",
452+ "node-execa": "5.0.0",
453+ "node-fs": "9.2.0",
454+ "node-glob-basic": "2.0.0",
455+ "node-http": "9.1.0",
456+ "node-http2": "1.1.1",
457+ "node-human-signals": "1.0.0",
458+ "node-net": "5.1.0",
459+ "node-os": "5.1.0",
460+ "node-path": "5.0.1",
461+ "node-process": "11.2.0",
462+ "node-readline": "8.1.1",
463+ "node-sqlite3": "8.0.0",
464+ "node-stream-pipes": "2.1.6",
465+ "node-streams": "9.0.1",
466+ "node-tls": "0.3.1",
467+ "node-url": "7.0.1",
468+ "node-workerbees": "0.3.1",
469+ "node-zlib": "0.4.0",
470+ "nonempty": "7.0.0",
471+ "now": "6.0.0",
472+ "npm-package-json": "2.0.0",
473+ "nullable": "6.0.0",
474+ "numberfield": "0.2.2",
475+ "numbers": "9.0.1",
476+ "oak": "3.1.1",
477+ "oak-debug": "1.2.2",
478+ "object-maps": "0.3.0",
479+ "ocarina": "1.5.4",
480+ "oooooooooorrrrrrrmm-lib": "0.0.1",
481+ "open-colors-scales-and-schemes": "1.0.0",
482+ "open-folds": "6.4.0",
483+ "open-foreign-generic": "11.0.3",
484+ "open-memoize": "6.2.0",
485+ "open-mkdirp-aff": "1.2.0",
486+ "open-pairing": "6.2.0",
487+ "open-smolder": "12.0.2",
488+ "options": "7.0.0",
489+ "optparse": "5.0.1",
490+ "ordered-collections": "3.2.0",
491+ "ordered-set": "0.4.0",
492+ "orders": "6.0.0",
493+ "owoify": "1.2.0",
494+ "pairs": "9.0.1",
495+ "parallel": "7.0.0",
496+ "parsing": "10.2.0",
497+ "parsing-dataview": "3.2.4",
498+ "partial": "4.0.0",
499+ "pathy": "9.0.0",
500+ "pha": "0.13.0",
501+ "phaser": "0.7.0",
502+ "phylio": "1.1.2",
503+ "pipes": "8.0.0",
504+ "pirates-charm": "0.0.1",
505+ "pmock": "0.9.0",
506+ "point-free": "1.0.0",
507+ "pointed-list": "0.5.1",
508+ "polymorphic-vectors": "4.0.0",
509+ "posix-types": "6.0.0",
510+ "postgresql": "2.0.20",
511+ "precise": "6.0.0",
512+ "precise-datetime": "7.0.0",
513+ "prelude": "6.0.2",
514+ "prettier-printer": "3.0.0",
515+ "printf": "0.1.0",
516+ "priority-queue": "0.1.2",
517+ "profunctor": "6.0.1",
518+ "profunctor-lenses": "8.0.0",
519+ "protobuf": "4.4.0",
520+ "psa-utils": "8.0.0",
521+ "psci-support": "6.0.0",
522+ "punycode": "1.0.0",
523+ "qualified-do": "2.2.0",
524+ "quantities": "12.2.0",
525+ "quickcheck": "8.0.1",
526+ "quickcheck-combinators": "0.1.3",
527+ "quickcheck-laws": "7.0.0",
528+ "quickcheck-utf8": "0.0.0",
529+ "random": "6.0.0",
530+ "rationals": "6.0.0",
531+ "rdf": "0.1.0",
532+ "react": "11.0.0",
533+ "react-aria": "0.2.0",
534+ "react-basic": "17.0.0",
535+ "react-basic-classic": "3.0.0",
536+ "react-basic-dnd": "10.1.0",
537+ "react-basic-dom": "7.0.0",
538+ "react-basic-dom-beta": "0.1.1",
539+ "react-basic-emotion": "7.1.0",
540+ "react-basic-hooks": "8.2.0",
541+ "react-basic-storybook": "2.0.0",
542+ "react-dom": "8.0.0",
543+ "react-halo": "3.0.0",
544+ "react-icons": "1.1.5",
545+ "react-markdown": "0.1.0",
546+ "react-testing-library": "4.0.1",
547+ "react-virtuoso": "1.0.0",
548+ "reactix": "0.6.1",
549+ "read": "1.0.1",
550+ "recharts": "1.1.0",
551+ "record": "4.0.0",
552+ "record-extra": "5.0.1",
553+ "record-ptional-fields": "0.1.2",
554+ "record-studio": "1.0.4",
555+ "refs": "6.0.0",
556+ "remotedata": "5.0.1",
557+ "repr": "0.5.0",
558+ "resize-observer": "1.0.0",
559+ "resource": "2.0.1",
560+ "resourcet": "1.0.0",
561+ "result": "1.0.3",
562+ "return": "0.2.0",
563+ "ring-modules": "5.0.1",
564+ "rito": "0.3.4",
565+ "roman": "0.4.0",
566+ "rough-notation": "1.0.2",
567+ "routing": "11.0.0",
568+ "routing-duplex": "0.7.0",
569+ "run": "5.0.0",
570+ "safe-coerce": "2.0.0",
571+ "safely": "4.0.1",
572+ "school-of-music": "1.3.0",
573+ "selection-foldable": "0.2.0",
574+ "selective-functors": "1.0.1",
575+ "semirings": "7.0.0",
576+ "shuffle": "1.1.0",
577+ "signal": "13.0.0",
578+ "simple-emitter": "3.0.1",
579+ "simple-i18n": "2.0.1",
580+ "simple-json": "9.0.0",
581+ "simple-json-generics": "0.2.1",
582+ "simple-ulid": "3.0.0",
583+ "sized-matrices": "1.0.0",
584+ "sized-vectors": "5.0.2",
585+ "slug": "3.1.0",
586+ "small-ffi": "4.0.1",
587+ "soundfonts": "4.1.0",
588+ "sparse-matrices": "2.0.1",
589+ "sparse-polynomials": "3.0.1",
590+ "spec": "8.1.1",
591+ "spec-discovery": "8.4.0",
592+ "spec-mocha": "5.1.1",
593+ "spec-node": "0.0.3",
594+ "spec-quickcheck": "5.0.2",
595+ "spec-reporter-xunit": "0.7.1",
596+ "splitmix": "2.1.0",
597+ "ssrs": "1.0.0",
598+ "st": "6.2.0",
599+ "statistics": "0.3.2",
600+ "strictlypositiveint": "1.0.1",
601+ "string-parsers": "8.0.0",
602+ "strings": "6.0.1",
603+ "strings-extra": "4.0.0",
604+ "stringutils": "0.0.12",
605+ "substitute": "0.2.3",
606+ "supply": "0.2.0",
607+ "svg-parser": "3.0.0",
608+ "systemd-journald": "0.3.0",
609+ "tagged": "4.0.2",
610+ "tailrec": "6.1.0",
611+ "tanstack-query": "2.0.0",
612+ "tecton": "0.2.1",
613+ "tecton-halogen": "0.2.0",
614+ "test-unit": "17.0.0",
615+ "thermite": "6.3.1",
616+ "thermite-dom": "0.3.1",
617+ "these": "6.0.0",
618+ "threading": "0.0.3",
619+ "tidy": "0.11.1",
620+ "tidy-codegen": "4.0.1",
621+ "tldr": "0.0.0",
622+ "toestand": "0.9.0",
623+ "transformation-matrix": "1.0.1",
624+ "transformers": "6.1.0",
625+ "tree-rose": "4.0.2",
626+ "trivial-unfold": "0.1.1",
627+ "ts-bridge": "4.0.0",
628+ "tuples": "7.0.0",
629+ "two-or-more": "1.0.0",
630+ "type-equality": "4.0.1",
631+ "typedenv": "2.0.1",
632+ "typelevel": "6.0.0",
633+ "typelevel-lists": "2.1.0",
634+ "typelevel-peano": "1.0.1",
635+ "typelevel-prelude": "7.0.0",
636+ "typelevel-regex": "0.0.3",
637+ "typelevel-rows": "0.1.0",
638+ "typisch": "0.4.0",
639+ "uint": "7.0.0",
640+ "ulid": "3.0.1",
641+ "uncurried-transformers": "1.1.0",
642+ "undefined": "2.0.0",
643+ "undefined-is-not-a-problem": "1.1.0",
644+ "unfoldable": "6.0.0",
645+ "unicode": "6.0.0",
646+ "unique": "0.6.1",
647+ "unlift": "1.0.1",
648+ "unordered-collections": "3.1.0",
649+ "unsafe-coerce": "6.0.0",
650+ "unsafe-reference": "5.0.0",
651+ "untagged-to-tagged": "0.1.4",
652+ "untagged-union": "1.0.0",
653+ "uri": "9.0.0",
654+ "url-immutable": "1.0.0",
655+ "uuid": "9.0.0",
656+ "uuidv4": "1.0.0",
657+ "validation": "6.0.0",
658+ "variant": "8.0.0",
659+ "variant-encodings": "2.0.0",
660+ "vectorfield": "1.0.1",
661+ "vectors": "2.1.0",
662+ "versions": "7.0.0",
663+ "visx": "0.0.2",
664+ "vitest": "1.0.0",
665+ "web-clipboard": "6.0.0",
666+ "web-cssom": "2.0.0",
667+ "web-cssom-view": "0.1.0",
668+ "web-dom": "6.0.0",
669+ "web-dom-parser": "8.0.0",
670+ "web-dom-xpath": "3.0.0",
671+ "web-encoding": "3.0.0",
672+ "web-events": "4.0.0",
673+ "web-fetch": "4.0.1",
674+ "web-file": "4.0.0",
675+ "web-geometry": "0.1.0",
676+ "web-html": "4.1.0",
677+ "web-pointerevents": "2.0.0",
678+ "web-proletarian": "1.0.0",
679+ "web-promise": "3.2.0",
680+ "web-resize-observer": "2.1.0",
681+ "web-router": "1.0.0",
682+ "web-socket": "4.0.0",
683+ "web-storage": "5.0.0",
684+ "web-streams": "4.0.0",
685+ "web-touchevents": "4.0.0",
686+ "web-uievents": "5.0.0",
687+ "web-url": "2.0.0",
688+ "web-workers": "1.1.0",
689+ "web-xhr": "5.0.1",
690+ "webextension-polyfill": "0.1.0",
691+ "webgpu": "0.0.1",
692+ "which": "2.0.0",
693+ "whine-core": "0.0.28",
694+ "xterm": "1.0.0",
695+ "yoga-fetch": "1.0.1",
696+ "yoga-json": "5.1.0",
697+ "yoga-om": "0.1.0",
698+ "yoga-postgres": "6.0.0",
699+ "yoga-react-dom": "1.0.1",
700+ "yoga-subtlecrypto": "0.1.0",
701+ "yoga-tree": "1.0.0",
702+ "z3": "0.0.2",
703+ "zipperarray": "2.0.0"
704+ }
705+ },
706+ "extra_packages": {}
707+ },
708+ "packages": {
709+ "aff": {
710+ "type": "registry",
711+ "version": "8.0.0",
712+ "integrity": "sha256-5MmdI4+0RHBtSBy+YlU3/Cq4R5W2ih3OaRedJIrVHdk=",
713+ "dependencies": [
714+ "bifunctors",
715+ "control",
716+ "datetime",
717+ "effect",
718+ "either",
719+ "exceptions",
720+ "foldable-traversable",
721+ "functions",
722+ "maybe",
723+ "newtype",
724+ "parallel",
725+ "prelude",
726+ "refs",
727+ "tailrec",
728+ "transformers",
729+ "unsafe-coerce"
730+ ]
731+ },
732+ "ansi": {
733+ "type": "registry",
734+ "version": "7.0.0",
735+ "integrity": "sha256-ZMB6HD+q9CXvn9fRCmJ8dvuDrOVHcjombL3oNOerVnE=",
736+ "dependencies": [
737+ "foldable-traversable",
738+ "lists",
739+ "strings"
740+ ]
741+ },
742+ "arraybuffer-types": {
743+ "type": "registry",
744+ "version": "3.0.2",
745+ "integrity": "sha256-mQKokysYVkooS4uXbO+yovmV/s8b138Ws3zQvOwIHRA=",
746+ "dependencies": []
747+ },
748+ "arrays": {
749+ "type": "registry",
750+ "version": "7.3.0",
751+ "integrity": "sha256-tmcklBlc/muUtUfr9RapdCPwnlQeB3aSrC4dK85gQlc=",
752+ "dependencies": [
753+ "bifunctors",
754+ "control",
755+ "foldable-traversable",
756+ "functions",
757+ "maybe",
758+ "nonempty",
759+ "partial",
760+ "prelude",
761+ "safe-coerce",
762+ "st",
763+ "tailrec",
764+ "tuples",
765+ "unfoldable",
766+ "unsafe-coerce"
767+ ]
768+ },
769+ "avar": {
770+ "type": "registry",
771+ "version": "5.0.1",
772+ "integrity": "sha256-f+bRR3qQPa/GVe4UbLQiJBy7+PzJkUCwT6qNn0UlkMY=",
773+ "dependencies": [
774+ "aff",
775+ "effect",
776+ "either",
777+ "exceptions",
778+ "functions",
779+ "maybe"
780+ ]
781+ },
782+ "bifunctors": {
783+ "type": "registry",
784+ "version": "6.0.0",
785+ "integrity": "sha256-/gZwC9YhNxZNQpnHa5BIYerCGM2jeX9ukZiEvYxm5Nw=",
786+ "dependencies": [
787+ "const",
788+ "either",
789+ "newtype",
790+ "prelude",
791+ "tuples"
792+ ]
793+ },
794+ "catenable-lists": {
795+ "type": "registry",
796+ "version": "7.0.0",
797+ "integrity": "sha256-76vYENhwF4BWTBsjeLuErCH2jqVT4M3R1HX+4RwSftA=",
798+ "dependencies": [
799+ "control",
800+ "foldable-traversable",
801+ "lists",
802+ "maybe",
803+ "prelude",
804+ "tuples",
805+ "unfoldable"
806+ ]
807+ },
808+ "console": {
809+ "type": "registry",
810+ "version": "6.1.0",
811+ "integrity": "sha256-CxmAzjgyuGDmt9FZW51VhV6rBPwR6o0YeKUzA9rSzcM=",
812+ "dependencies": [
813+ "effect",
814+ "prelude"
815+ ]
816+ },
817+ "const": {
818+ "type": "registry",
819+ "version": "6.0.0",
820+ "integrity": "sha256-tNrxDW8D8H4jdHE2HiPzpLy08zkzJMmGHdRqt5BQuTc=",
821+ "dependencies": [
822+ "invariant",
823+ "newtype",
824+ "prelude"
825+ ]
826+ },
827+ "contravariant": {
828+ "type": "registry",
829+ "version": "6.0.0",
830+ "integrity": "sha256-TP+ooAp3vvmdjfQsQJSichF5B4BPDHp3wAJoWchip6c=",
831+ "dependencies": [
832+ "const",
833+ "either",
834+ "newtype",
835+ "prelude",
836+ "tuples"
837+ ]
838+ },
839+ "control": {
840+ "type": "registry",
841+ "version": "6.0.0",
842+ "integrity": "sha256-sH7Pg9E96JCPF9PIA6oQ8+BjTyO/BH1ZuE/bOcyj4Jk=",
843+ "dependencies": [
844+ "newtype",
845+ "prelude"
846+ ]
847+ },
848+ "datetime": {
849+ "type": "registry",
850+ "version": "6.1.0",
851+ "integrity": "sha256-g/5X5BBegQWLpI9IWD+sY6mcaYpzzlW5lz5NBzaMtyI=",
852+ "dependencies": [
853+ "bifunctors",
854+ "control",
855+ "either",
856+ "enums",
857+ "foldable-traversable",
858+ "functions",
859+ "gen",
860+ "integers",
861+ "lists",
862+ "maybe",
863+ "newtype",
864+ "numbers",
865+ "ordered-collections",
866+ "partial",
867+ "prelude",
868+ "tuples"
869+ ]
870+ },
871+ "distributive": {
872+ "type": "registry",
873+ "version": "6.0.0",
874+ "integrity": "sha256-HTDdmEnzigMl+02SJB88j+gAXDx9VKsbvR4MJGDPbOQ=",
875+ "dependencies": [
876+ "identity",
877+ "newtype",
878+ "prelude",
879+ "tuples",
880+ "type-equality"
881+ ]
882+ },
883+ "effect": {
884+ "type": "registry",
885+ "version": "4.0.0",
886+ "integrity": "sha256-eBtZu+HZcMa5HilvI6kaDyVX3ji8p0W9MGKy2K4T6+M=",
887+ "dependencies": [
888+ "prelude"
889+ ]
890+ },
891+ "either": {
892+ "type": "registry",
893+ "version": "6.1.0",
894+ "integrity": "sha256-6hgTPisnMWVwQivOu2PKYcH8uqjEOOqDyaDQVUchTpY=",
895+ "dependencies": [
896+ "control",
897+ "invariant",
898+ "maybe",
899+ "prelude"
900+ ]
901+ },
902+ "enums": {
903+ "type": "registry",
904+ "version": "6.0.1",
905+ "integrity": "sha256-HWaD73JFLorc4A6trKIRUeDMdzE+GpkJaEOM1nTNkC8=",
906+ "dependencies": [
907+ "control",
908+ "either",
909+ "gen",
910+ "maybe",
911+ "newtype",
912+ "nonempty",
913+ "partial",
914+ "prelude",
915+ "tuples",
916+ "unfoldable"
917+ ]
918+ },
919+ "exceptions": {
920+ "type": "registry",
921+ "version": "6.1.0",
922+ "integrity": "sha256-K0T89IHtF3vBY7eSAO7eDOqSb2J9kZGAcDN5+IKsF8E=",
923+ "dependencies": [
924+ "effect",
925+ "either",
926+ "maybe",
927+ "prelude"
928+ ]
929+ },
930+ "exists": {
931+ "type": "registry",
932+ "version": "6.0.0",
933+ "integrity": "sha256-A0JQHpTfo1dNOj9U5/Fd3xndlRSE0g2IQWOGor2yXn8=",
934+ "dependencies": [
935+ "unsafe-coerce"
936+ ]
937+ },
938+ "foldable-traversable": {
939+ "type": "registry",
940+ "version": "6.0.0",
941+ "integrity": "sha256-fLeqRYM4jUrZD5H4WqcwUgzU7XfYkzO4zhgtNc3jcWM=",
942+ "dependencies": [
943+ "bifunctors",
944+ "const",
945+ "control",
946+ "either",
947+ "functors",
948+ "identity",
949+ "maybe",
950+ "newtype",
951+ "orders",
952+ "prelude",
953+ "tuples"
954+ ]
955+ },
956+ "foreign": {
957+ "type": "registry",
958+ "version": "7.0.0",
959+ "integrity": "sha256-1ORiqoS3HW+qfwSZAppHPWy4/6AQysxZ2t29jcdUMNA=",
960+ "dependencies": [
961+ "either",
962+ "functions",
963+ "identity",
964+ "integers",
965+ "lists",
966+ "maybe",
967+ "prelude",
968+ "strings",
969+ "transformers"
970+ ]
971+ },
972+ "foreign-object": {
973+ "type": "registry",
974+ "version": "4.1.0",
975+ "integrity": "sha256-q24okj6mT+yGHYQ+ei/pYPj5ih6sTbu7eDv/WU56JVo=",
976+ "dependencies": [
977+ "arrays",
978+ "foldable-traversable",
979+ "functions",
980+ "gen",
981+ "lists",
982+ "maybe",
983+ "prelude",
984+ "st",
985+ "tailrec",
986+ "tuples",
987+ "typelevel-prelude",
988+ "unfoldable"
989+ ]
990+ },
991+ "fork": {
992+ "type": "registry",
993+ "version": "6.0.0",
994+ "integrity": "sha256-X7u0SuCvFbLbzuNEKLBNuWjmcroqMqit4xEzpQwAP7E=",
995+ "dependencies": [
996+ "aff"
997+ ]
998+ },
999+ "free": {
1000+ "type": "registry",
1001+ "version": "7.1.0",
1002+ "integrity": "sha256-JAumgEsGSzJCNLD8AaFvuX7CpqS5yruCngi6yI7+V5k=",
1003+ "dependencies": [
1004+ "catenable-lists",
1005+ "control",
1006+ "distributive",
1007+ "either",
1008+ "exists",
1009+ "foldable-traversable",
1010+ "invariant",
1011+ "lazy",
1012+ "maybe",
1013+ "prelude",
1014+ "tailrec",
1015+ "transformers",
1016+ "tuples",
1017+ "unsafe-coerce"
1018+ ]
1019+ },
1020+ "functions": {
1021+ "type": "registry",
1022+ "version": "6.0.0",
1023+ "integrity": "sha256-adMyJNEnhGde2unHHAP79gPtlNjNqzgLB8arEOn9hLI=",
1024+ "dependencies": [
1025+ "prelude"
1026+ ]
1027+ },
1028+ "functors": {
1029+ "type": "registry",
1030+ "version": "5.0.0",
1031+ "integrity": "sha256-zfPWWYisbD84MqwpJSZFlvM6v86McM68ob8p9s27ywU=",
1032+ "dependencies": [
1033+ "bifunctors",
1034+ "const",
1035+ "contravariant",
1036+ "control",
1037+ "distributive",
1038+ "either",
1039+ "invariant",
1040+ "maybe",
1041+ "newtype",
1042+ "prelude",
1043+ "profunctor",
1044+ "tuples",
1045+ "unsafe-coerce"
1046+ ]
1047+ },
1048+ "gen": {
1049+ "type": "registry",
1050+ "version": "4.0.0",
1051+ "integrity": "sha256-f7yzAXWwr+xnaqEOcvyO3ezKdoes8+WXWdXIHDBCAPI=",
1052+ "dependencies": [
1053+ "either",
1054+ "foldable-traversable",
1055+ "identity",
1056+ "maybe",
1057+ "newtype",
1058+ "nonempty",
1059+ "prelude",
1060+ "tailrec",
1061+ "tuples",
1062+ "unfoldable"
1063+ ]
1064+ },
1065+ "http-methods": {
1066+ "type": "registry",
1067+ "version": "6.0.0",
1068+ "integrity": "sha256-Orr7rbDGcp7qoqmUMXPRMjBx+C4jqOQcFe9+gE3nMgU=",
1069+ "dependencies": [
1070+ "either",
1071+ "prelude",
1072+ "strings"
1073+ ]
1074+ },
1075+ "identity": {
1076+ "type": "registry",
1077+ "version": "6.0.0",
1078+ "integrity": "sha256-4wY0XZbAksjY6UAg99WkuKyJlQlWAfTi2ssadH0wVMY=",
1079+ "dependencies": [
1080+ "control",
1081+ "invariant",
1082+ "newtype",
1083+ "prelude"
1084+ ]
1085+ },
1086+ "integers": {
1087+ "type": "registry",
1088+ "version": "6.0.0",
1089+ "integrity": "sha256-sf+sK26R1hzwl3NhXR7WAu9zCDjQnfoXwcyGoseX158=",
1090+ "dependencies": [
1091+ "maybe",
1092+ "numbers",
1093+ "prelude"
1094+ ]
1095+ },
1096+ "invariant": {
1097+ "type": "registry",
1098+ "version": "6.0.0",
1099+ "integrity": "sha256-RGWWyYrz0Hs1KjPDA+87Kia67ZFBhfJ5lMGOMCEFoLo=",
1100+ "dependencies": [
1101+ "control",
1102+ "prelude"
1103+ ]
1104+ },
1105+ "js-date": {
1106+ "type": "registry",
1107+ "version": "8.0.0",
1108+ "integrity": "sha256-6TVF4DWg5JL+jRAsoMssYw8rgOVALMUHT1CuNZt8NRo=",
1109+ "dependencies": [
1110+ "datetime",
1111+ "effect",
1112+ "exceptions",
1113+ "foreign",
1114+ "integers",
1115+ "now"
1116+ ]
1117+ },
1118+ "js-fetch": {
1119+ "type": "registry",
1120+ "version": "0.2.1",
1121+ "integrity": "sha256-zQaVi9wFWku1SsWmdR11kRpOb+wxkNWR49cn928ucjw=",
1122+ "dependencies": [
1123+ "arraybuffer-types",
1124+ "arrays",
1125+ "effect",
1126+ "foldable-traversable",
1127+ "foreign",
1128+ "foreign-object",
1129+ "functions",
1130+ "http-methods",
1131+ "js-promise",
1132+ "maybe",
1133+ "newtype",
1134+ "prelude",
1135+ "record",
1136+ "tuples",
1137+ "typelevel-prelude",
1138+ "unfoldable",
1139+ "web-file",
1140+ "web-streams"
1141+ ]
1142+ },
1143+ "js-promise": {
1144+ "type": "registry",
1145+ "version": "1.0.0",
1146+ "integrity": "sha256-kXNo5g9RJgPdrTuKRe5oG2kBIwPp+j5VDPDplqZBJzQ=",
1147+ "dependencies": [
1148+ "effect",
1149+ "exceptions",
1150+ "foldable-traversable",
1151+ "functions",
1152+ "maybe",
1153+ "prelude"
1154+ ]
1155+ },
1156+ "js-promise-aff": {
1157+ "type": "registry",
1158+ "version": "1.0.0",
1159+ "integrity": "sha256-s9kml9Ei74hKlMMg41yyZp4GkbmYUwaH+gBWWrdhwec=",
1160+ "dependencies": [
1161+ "aff",
1162+ "foreign",
1163+ "js-promise"
1164+ ]
1165+ },
1166+ "lazy": {
1167+ "type": "registry",
1168+ "version": "6.0.0",
1169+ "integrity": "sha256-lMsfFOnlqfe4KzRRiW8ot5ge6HtcU3Eyh2XkXcP5IgU=",
1170+ "dependencies": [
1171+ "control",
1172+ "foldable-traversable",
1173+ "invariant",
1174+ "prelude"
1175+ ]
1176+ },
1177+ "lists": {
1178+ "type": "registry",
1179+ "version": "7.0.0",
1180+ "integrity": "sha256-EKF15qYqucuXP2lT/xPxhqy58f0FFT6KHdIB/yBOayI=",
1181+ "dependencies": [
1182+ "bifunctors",
1183+ "control",
1184+ "foldable-traversable",
1185+ "lazy",
1186+ "maybe",
1187+ "newtype",
1188+ "nonempty",
1189+ "partial",
1190+ "prelude",
1191+ "tailrec",
1192+ "tuples",
1193+ "unfoldable"
1194+ ]
1195+ },
1196+ "maybe": {
1197+ "type": "registry",
1198+ "version": "6.0.0",
1199+ "integrity": "sha256-5cCIb0wPwbat2PRkQhUeZO0jcAmf8jCt2qE0wbC3v2Q=",
1200+ "dependencies": [
1201+ "control",
1202+ "invariant",
1203+ "newtype",
1204+ "prelude"
1205+ ]
1206+ },
1207+ "media-types": {
1208+ "type": "registry",
1209+ "version": "6.0.0",
1210+ "integrity": "sha256-n/4FoGBasbVSYscGVRSyBunQ6CZbL3jsYL+Lp01mc9k=",
1211+ "dependencies": [
1212+ "newtype",
1213+ "prelude"
1214+ ]
1215+ },
1216+ "mmorph": {
1217+ "type": "registry",
1218+ "version": "7.0.0",
1219+ "integrity": "sha256-urZlZNNqGeQFe5D/ClHlR8QgGBNHTMFPtJ5S5IpflTQ=",
1220+ "dependencies": [
1221+ "free",
1222+ "functors",
1223+ "transformers"
1224+ ]
1225+ },
1226+ "newtype": {
1227+ "type": "registry",
1228+ "version": "5.0.0",
1229+ "integrity": "sha256-gdrQu8oGe9eZE6L3wOI8ql/igOg+zEGB5ITh2g+uttw=",
1230+ "dependencies": [
1231+ "prelude",
1232+ "safe-coerce"
1233+ ]
1234+ },
1235+ "node-buffer": {
1236+ "type": "registry",
1237+ "version": "9.0.0",
1238+ "integrity": "sha256-PWE2DJ5ruBLCmeA/fUiuySEFmUJ/VuRfyrnCuVZBlu4=",
1239+ "dependencies": [
1240+ "arraybuffer-types",
1241+ "effect",
1242+ "maybe",
1243+ "nullable",
1244+ "st",
1245+ "unsafe-coerce"
1246+ ]
1247+ },
1248+ "node-event-emitter": {
1249+ "type": "registry",
1250+ "version": "3.0.0",
1251+ "integrity": "sha256-Qw0MjsT4xRH2j2i4K8JmRjcMKnH5z1Cw39t00q4LE4w=",
1252+ "dependencies": [
1253+ "effect",
1254+ "either",
1255+ "functions",
1256+ "maybe",
1257+ "nullable",
1258+ "prelude",
1259+ "unsafe-coerce"
1260+ ]
1261+ },
1262+ "node-fs": {
1263+ "type": "registry",
1264+ "version": "9.2.0",
1265+ "integrity": "sha256-Sg0vkXycEzkEerX6hLccz21Ygd9w1+QSk1thotRZPGI=",
1266+ "dependencies": [
1267+ "datetime",
1268+ "effect",
1269+ "either",
1270+ "enums",
1271+ "exceptions",
1272+ "functions",
1273+ "integers",
1274+ "js-date",
1275+ "maybe",
1276+ "node-buffer",
1277+ "node-path",
1278+ "node-streams",
1279+ "nullable",
1280+ "partial",
1281+ "prelude",
1282+ "strings",
1283+ "unsafe-coerce"
1284+ ]
1285+ },
1286+ "node-http": {
1287+ "type": "registry",
1288+ "version": "9.1.0",
1289+ "integrity": "sha256-53H+0w73kew2VyXE8U0SpNxyzOojdxBMx38vctl8ak4=",
1290+ "dependencies": [
1291+ "arraybuffer-types",
1292+ "contravariant",
1293+ "effect",
1294+ "foreign",
1295+ "foreign-object",
1296+ "maybe",
1297+ "node-buffer",
1298+ "node-net",
1299+ "node-streams",
1300+ "node-tls",
1301+ "node-url",
1302+ "nullable",
1303+ "options",
1304+ "prelude",
1305+ "unsafe-coerce"
1306+ ]
1307+ },
1308+ "node-net": {
1309+ "type": "registry",
1310+ "version": "5.1.0",
1311+ "integrity": "sha256-WnYf9RoPBJrTUAEkzc0NbIhOqN0lKbhyDf0JNgZjAKY=",
1312+ "dependencies": [
1313+ "effect",
1314+ "either",
1315+ "exceptions",
1316+ "foreign",
1317+ "maybe",
1318+ "node-buffer",
1319+ "node-event-emitter",
1320+ "node-fs",
1321+ "nullable",
1322+ "options",
1323+ "prelude",
1324+ "transformers"
1325+ ]
1326+ },
1327+ "node-path": {
1328+ "type": "registry",
1329+ "version": "5.0.1",
1330+ "integrity": "sha256-ePOElFamHkffhwJcS0Ozq4A14rflnkasFU6X2B8/yXs=",
1331+ "dependencies": [
1332+ "effect"
1333+ ]
1334+ },
1335+ "node-streams": {
1336+ "type": "registry",
1337+ "version": "9.0.1",
1338+ "integrity": "sha256-7RJ6RqjOlhW+QlDFQNUHlkCG/CuYTTLT8yary5jhhsU=",
1339+ "dependencies": [
1340+ "aff",
1341+ "arrays",
1342+ "effect",
1343+ "either",
1344+ "exceptions",
1345+ "maybe",
1346+ "node-buffer",
1347+ "node-event-emitter",
1348+ "nullable",
1349+ "prelude",
1350+ "refs",
1351+ "st",
1352+ "tailrec",
1353+ "unsafe-coerce"
1354+ ]
1355+ },
1356+ "node-tls": {
1357+ "type": "registry",
1358+ "version": "0.3.1",
1359+ "integrity": "sha256-UlbPVYi2HtxWCelkWO18gTdiSJlpvQOncqXQleK3v9E=",
1360+ "dependencies": [
1361+ "console",
1362+ "effect",
1363+ "either",
1364+ "exceptions",
1365+ "foreign",
1366+ "maybe",
1367+ "node-buffer",
1368+ "node-event-emitter",
1369+ "node-net",
1370+ "nullable",
1371+ "partial",
1372+ "prelude",
1373+ "unsafe-coerce"
1374+ ]
1375+ },
1376+ "node-url": {
1377+ "type": "registry",
1378+ "version": "7.0.1",
1379+ "integrity": "sha256-V3l1miSKlMcd4rrxmYGzt+vCAbIfgtVEdWbHsM/2g+A=",
1380+ "dependencies": [
1381+ "effect",
1382+ "foreign",
1383+ "nullable",
1384+ "prelude",
1385+ "tuples"
1386+ ]
1387+ },
1388+ "nonempty": {
1389+ "type": "registry",
1390+ "version": "7.0.0",
1391+ "integrity": "sha256-54ablJZUHGvvlTJzi3oXyPCuvY6zsrWJuH/dMJ/MFLs=",
1392+ "dependencies": [
1393+ "control",
1394+ "foldable-traversable",
1395+ "maybe",
1396+ "prelude",
1397+ "tuples",
1398+ "unfoldable"
1399+ ]
1400+ },
1401+ "now": {
1402+ "type": "registry",
1403+ "version": "6.0.0",
1404+ "integrity": "sha256-xZ7x37ZMREfs6GCDw/h+FaKHV/3sPWmtqBZRGTxybQY=",
1405+ "dependencies": [
1406+ "datetime",
1407+ "effect"
1408+ ]
1409+ },
1410+ "nullable": {
1411+ "type": "registry",
1412+ "version": "6.0.0",
1413+ "integrity": "sha256-yiGBVl3AD+Guy4kNWWeN+zl1gCiJK+oeIFtZtPCw4+o=",
1414+ "dependencies": [
1415+ "effect",
1416+ "functions",
1417+ "maybe"
1418+ ]
1419+ },
1420+ "numbers": {
1421+ "type": "registry",
1422+ "version": "9.0.1",
1423+ "integrity": "sha256-/9M6aeMDBdB4cwYDeJvLFprAHZ49EbtKQLIJsneXLIk=",
1424+ "dependencies": [
1425+ "functions",
1426+ "maybe"
1427+ ]
1428+ },
1429+ "options": {
1430+ "type": "registry",
1431+ "version": "7.0.0",
1432+ "integrity": "sha256-treC6h+jvzcWhplPaF/aMENCOx+JGk+ysa5pL1BGHtg=",
1433+ "dependencies": [
1434+ "contravariant",
1435+ "foreign",
1436+ "foreign-object",
1437+ "maybe",
1438+ "tuples"
1439+ ]
1440+ },
1441+ "ordered-collections": {
1442+ "type": "registry",
1443+ "version": "3.2.0",
1444+ "integrity": "sha256-o9jqsj5rpJmMdoe/zyufWHFjYYFTTsJpgcuCnqCO6PM=",
1445+ "dependencies": [
1446+ "arrays",
1447+ "foldable-traversable",
1448+ "gen",
1449+ "lists",
1450+ "maybe",
1451+ "partial",
1452+ "prelude",
1453+ "st",
1454+ "tailrec",
1455+ "tuples",
1456+ "unfoldable"
1457+ ]
1458+ },
1459+ "orders": {
1460+ "type": "registry",
1461+ "version": "6.0.0",
1462+ "integrity": "sha256-nBA0g3/ai0euH8q9pSbGqk53W2q6agm/dECZTHcoink=",
1463+ "dependencies": [
1464+ "newtype",
1465+ "prelude"
1466+ ]
1467+ },
1468+ "parallel": {
1469+ "type": "registry",
1470+ "version": "7.0.0",
1471+ "integrity": "sha256-gUC9i4Txnx9K9RcMLsjujbwZz6BB1bnE2MLvw4GIw5o=",
1472+ "dependencies": [
1473+ "control",
1474+ "effect",
1475+ "either",
1476+ "foldable-traversable",
1477+ "functors",
1478+ "maybe",
1479+ "newtype",
1480+ "prelude",
1481+ "profunctor",
1482+ "refs",
1483+ "transformers"
1484+ ]
1485+ },
1486+ "partial": {
1487+ "type": "registry",
1488+ "version": "4.0.0",
1489+ "integrity": "sha256-fwXerld6Xw1VkReh8yeQsdtLVrjfGiVuC5bA1Wyo/J4=",
1490+ "dependencies": []
1491+ },
1492+ "pipes": {
1493+ "type": "registry",
1494+ "version": "8.0.0",
1495+ "integrity": "sha256-kvfqGM4cPA/wCcBHbp5psouFw5dZGvku2462x7ZBwSY=",
1496+ "dependencies": [
1497+ "aff",
1498+ "lists",
1499+ "mmorph",
1500+ "prelude",
1501+ "tailrec",
1502+ "transformers",
1503+ "tuples"
1504+ ]
1505+ },
1506+ "prelude": {
1507+ "type": "registry",
1508+ "version": "6.0.2",
1509+ "integrity": "sha256-kiAPZxihtAel8uRiTNdccf4qylp/9J3jNkEHNAD0MsE=",
1510+ "dependencies": []
1511+ },
1512+ "profunctor": {
1513+ "type": "registry",
1514+ "version": "6.0.1",
1515+ "integrity": "sha256-E58hSYdJvF2Qjf9dnWLPlJKh2Z2fLfFLkQoYi16vsFk=",
1516+ "dependencies": [
1517+ "control",
1518+ "distributive",
1519+ "either",
1520+ "exists",
1521+ "invariant",
1522+ "newtype",
1523+ "prelude",
1524+ "tuples"
1525+ ]
1526+ },
1527+ "record": {
1528+ "type": "registry",
1529+ "version": "4.0.0",
1530+ "integrity": "sha256-Za5U85bTRJEfGK5Sk4hM41oXy84YQI0I8TL3WUn1Qzg=",
1531+ "dependencies": [
1532+ "functions",
1533+ "prelude",
1534+ "unsafe-coerce"
1535+ ]
1536+ },
1537+ "refs": {
1538+ "type": "registry",
1539+ "version": "6.0.0",
1540+ "integrity": "sha256-Vgwne7jIbD3ZMoLNNETLT8Litw6lIYo3MfYNdtYWj9s=",
1541+ "dependencies": [
1542+ "effect",
1543+ "prelude"
1544+ ]
1545+ },
1546+ "safe-coerce": {
1547+ "type": "registry",
1548+ "version": "2.0.0",
1549+ "integrity": "sha256-a1ibQkiUcbODbLE/WAq7Ttbbh9ex+x33VCQ7GngKudU=",
1550+ "dependencies": [
1551+ "unsafe-coerce"
1552+ ]
1553+ },
1554+ "spec": {
1555+ "type": "registry",
1556+ "version": "8.1.1",
1557+ "integrity": "sha256-EM7UfQIaSgiw13LJ4ZASkfYmmRDKIlec3nYbGKFqGhk=",
1558+ "dependencies": [
1559+ "aff",
1560+ "ansi",
1561+ "arrays",
1562+ "avar",
1563+ "bifunctors",
1564+ "control",
1565+ "datetime",
1566+ "effect",
1567+ "either",
1568+ "exceptions",
1569+ "foldable-traversable",
1570+ "fork",
1571+ "identity",
1572+ "integers",
1573+ "lists",
1574+ "maybe",
1575+ "newtype",
1576+ "now",
1577+ "ordered-collections",
1578+ "parallel",
1579+ "pipes",
1580+ "prelude",
1581+ "refs",
1582+ "strings",
1583+ "tailrec",
1584+ "transformers",
1585+ "tuples"
1586+ ]
1587+ },
1588+ "st": {
1589+ "type": "registry",
1590+ "version": "6.2.0",
1591+ "integrity": "sha256-z9X0WsOUlPwNx9GlCC+YccCyz8MejC8Wb0C4+9fiBRY=",
1592+ "dependencies": [
1593+ "partial",
1594+ "prelude",
1595+ "tailrec",
1596+ "unsafe-coerce"
1597+ ]
1598+ },
1599+ "strings": {
1600+ "type": "registry",
1601+ "version": "6.0.1",
1602+ "integrity": "sha256-WssD3DbX4OPzxSdjvRMX0yvc9+pS7n5gyPv5I2Trb7k=",
1603+ "dependencies": [
1604+ "arrays",
1605+ "control",
1606+ "either",
1607+ "enums",
1608+ "foldable-traversable",
1609+ "gen",
1610+ "integers",
1611+ "maybe",
1612+ "newtype",
1613+ "nonempty",
1614+ "partial",
1615+ "prelude",
1616+ "tailrec",
1617+ "tuples",
1618+ "unfoldable",
1619+ "unsafe-coerce"
1620+ ]
1621+ },
1622+ "tailrec": {
1623+ "type": "registry",
1624+ "version": "6.1.0",
1625+ "integrity": "sha256-Xx19ECVDRrDWpz9D2GxQHHV89vd61dnXxQm0IcYQHGk=",
1626+ "dependencies": [
1627+ "bifunctors",
1628+ "effect",
1629+ "either",
1630+ "identity",
1631+ "maybe",
1632+ "partial",
1633+ "prelude",
1634+ "refs"
1635+ ]
1636+ },
1637+ "transformers": {
1638+ "type": "registry",
1639+ "version": "6.1.0",
1640+ "integrity": "sha256-3Bm+Z6tsC/paG888XkywDngJ2JMos+JfOhRlkVfb7gI=",
1641+ "dependencies": [
1642+ "control",
1643+ "distributive",
1644+ "effect",
1645+ "either",
1646+ "exceptions",
1647+ "foldable-traversable",
1648+ "identity",
1649+ "lazy",
1650+ "maybe",
1651+ "newtype",
1652+ "prelude",
1653+ "st",
1654+ "tailrec",
1655+ "tuples",
1656+ "unfoldable"
1657+ ]
1658+ },
1659+ "tuples": {
1660+ "type": "registry",
1661+ "version": "7.0.0",
1662+ "integrity": "sha256-1rXgTomes9105BjgXqIw0FL6Fz1lqqUTLWOumhWec1M=",
1663+ "dependencies": [
1664+ "control",
1665+ "invariant",
1666+ "prelude"
1667+ ]
1668+ },
1669+ "type-equality": {
1670+ "type": "registry",
1671+ "version": "4.0.1",
1672+ "integrity": "sha256-Hs9D6Y71zFi/b+qu5NSbuadUQXe5iv5iWx0226vOHUw=",
1673+ "dependencies": []
1674+ },
1675+ "typelevel-prelude": {
1676+ "type": "registry",
1677+ "version": "7.0.0",
1678+ "integrity": "sha256-uFF2ph+vHcQpfPuPf2a3ukJDFmLhApmkpTMviHIWgJM=",
1679+ "dependencies": [
1680+ "prelude",
1681+ "type-equality"
1682+ ]
1683+ },
1684+ "unfoldable": {
1685+ "type": "registry",
1686+ "version": "6.0.0",
1687+ "integrity": "sha256-JtikvJdktRap7vr/K4ITlxUX1QexpnqBq0G/InLr6eg=",
1688+ "dependencies": [
1689+ "foldable-traversable",
1690+ "maybe",
1691+ "partial",
1692+ "prelude",
1693+ "tuples"
1694+ ]
1695+ },
1696+ "unsafe-coerce": {
1697+ "type": "registry",
1698+ "version": "6.0.0",
1699+ "integrity": "sha256-IqIYW4Vkevn8sI+6aUwRGvd87tVL36BBeOr0cGAE7t0=",
1700+ "dependencies": []
1701+ },
1702+ "web-dom": {
1703+ "type": "registry",
1704+ "version": "6.0.0",
1705+ "integrity": "sha256-1kSKWFDI4LupdmpjK01b1MMxDFW7jvatEgPgVmCmSBQ=",
1706+ "dependencies": [
1707+ "web-events"
1708+ ]
1709+ },
1710+ "web-events": {
1711+ "type": "registry",
1712+ "version": "4.0.0",
1713+ "integrity": "sha256-YDt8b6u1tzGtnWyNRodne57iO8FNSGPaTCVzBUyUn4k=",
1714+ "dependencies": [
1715+ "datetime",
1716+ "enums",
1717+ "foreign",
1718+ "nullable"
1719+ ]
1720+ },
1721+ "web-file": {
1722+ "type": "registry",
1723+ "version": "4.0.0",
1724+ "integrity": "sha256-1h5jPBkvjY71jLEdwVadXCx86/2inNoMBO//Rd3eCSU=",
1725+ "dependencies": [
1726+ "foreign",
1727+ "media-types",
1728+ "web-dom"
1729+ ]
1730+ },
1731+ "web-streams": {
1732+ "type": "registry",
1733+ "version": "4.0.0",
1734+ "integrity": "sha256-02HgXIk6R+pU9fWOX42krukAI1QkCbLKcCv3b4Jq6WI=",
1735+ "dependencies": [
1736+ "arraybuffer-types",
1737+ "effect",
1738+ "exceptions",
1739+ "js-promise",
1740+ "nullable",
1741+ "prelude",
1742+ "tuples"
1743+ ]
1744+ }
1745+ }
1746+}
spago.yamlnew file+51
@@ -0,0 +1,51 @@
1+package:
2+ name: fetch
3+ publish:
4+ version: 4.1.1
5+ license: MIT
6+ location:
7+ githubOwner: rowtype-yoga
8+ githubRepo: purescript-fetch
9+ dependencies:
10+ - aff
11+ - arraybuffer-types
12+ - bifunctors
13+ - effect
14+ - either
15+ - foreign
16+ - http-methods
17+ - js-fetch
18+ - js-promise
19+ - js-promise-aff
20+ - maybe
21+ - newtype
22+ - ordered-collections
23+ - prelude
24+ - record
25+ - strings
26+ - typelevel-prelude
27+ - web-file
28+ - web-streams
29+ test:
30+ main: Test.Main
31+ dependencies:
32+ - node-http
33+ - spec
34+ - aff
35+ - datetime
36+ - effect
37+ - either
38+ - exceptions
39+ - spec
40+ - strings
41+ - node-buffer
42+ - node-event-emitter
43+ - node-http
44+ - node-net
45+ - node-streams
46+ - partial
47+ - refs
48+workspace:
49+ extraPackages: {}
50+ packageSet:
51+ registry: 63.3.0
src/Fetch.purs+38−40
@@ -1,44 +1,47 @@
11module Fetch
22 ( fetch
3− , fetchBody
43 , module Data.HTTP.Method
5− , module Fetch.Core.RequestCache
6− , module Fetch.Core.RequestCredentials
7− , module Fetch.Core.RequestMode
8− , module Fetch.Core.Referrer
9− , module Fetch.Core.Integrity
4+ , module JS.Fetch.RequestCache
5+ , module JS.Fetch.RequestCredentials
6+ , module JS.Fetch.RequestMode
7+ , module JS.Fetch.Referrer
8+ , module JS.Fetch.Integrity
109 , module Fetch.Internal.Request
1110 , module Fetch.Internal.RequestBody
1211 , module Fetch.Internal.Response
12+ , module Fetch.Internal.Headers
1313 ) where
1414
1515import Prelude
1616
17−import Control.Promise as Promise
17+import Data.Either (Either(Left, Right))
1818import Data.HTTP.Method (Method(..))
19−import Effect.Aff (Aff)
19+import Effect.Aff (Aff, effectCanceler, makeAff)
2020import Effect.Class (liftEffect)
21−import Fetch.Core as Core
22−import Fetch.Core.Integrity (Integrity(..))
23−import Fetch.Core.Referrer (Referrer(..))
24−import Fetch.Core.Request as CoreRequest
25−import Fetch.Core.RequestCache (RequestCache(..))
26−import Fetch.Core.RequestCredentials (RequestCredentials(Omit, Include))
27−import Fetch.Core.RequestMode (RequestMode(Cors, NoCors, Navigate))
21+import Fetch.Internal.Headers (contains, lookup, toHeaders)
2822import Fetch.Internal.Request (class ToCoreRequestOptions, class ToCoreRequestOptionsConverter, class ToCoreRequestOptionsHelper, HighlevelRequestOptions, convertHelper, convertImpl, new)
29−import Fetch.Internal.Request as Request
3023import Fetch.Internal.RequestBody (class ToRequestBody, toRequestBody)
31−import Fetch.Internal.Response (Response, ResponseR, arrayBuffer, blob, body, json, promiseToPromise, text)
32−import Fetch.Internal.Response as Response
24+import Fetch.Internal.Response (Response, ResponseR, arrayBuffer, blob, body, json, text)
25+import JS.Fetch.AbortController (AbortController)
26+import JS.Fetch.Integrity (Integrity(..))
27+import JS.Fetch.Referrer (Referrer(..))
28+import JS.Fetch.RequestCache (RequestCache(..))
29+import JS.Fetch.RequestCredentials (RequestCredentials(Include, Omit))
30+import JS.Fetch.RequestMode (RequestMode(Cors, Navigate, NoCors))
3331import Prim.Row (class Union)
34−import Type.Row.Homogeneous (class Homogeneous)
32+import JS.Fetch.AbortController (abort, new, signal) as AbortController
33+import JS.Fetch as Core
34+import JS.Fetch.Request as CoreRequest
35+import Promise (Promise, resolve, thenOrCatch) as Promise
36+import Promise.Aff as Promise.Aff
37+import Fetch.Internal.Request as Request
38+import Fetch.Internal.Response as Response
3539
3640-- | Implementation of `fetch`, see https://developer.mozilla.org/en-US/docs/Web/API/fetch
37−-- | For usage with `String` bodies. For other body types, see `fetchBody`
38−-- |
41+-- |
3942-- | Usage:
4043-- | ```purescript
41−-- | do
44+-- | do
4245-- | let requestUrl = "https://httpbin.org/get"
4346-- | { status, text } <- fetch requestUrl { headers: { "Accept": "application/json" }}
4447-- | responseBody <- text
@@ -56,9 +59,8 @@ import Type.Row.Homogeneous (class Homogeneous)
5659-- | foreignJsonValue <- json
5760-- | ```
5861fetch
59− :: forall input output thruIn thruOut headers
60− . Homogeneous headers String
61− => Union input thruIn (HighlevelRequestOptions headers String)
62+ :: forall input output @thruIn thruOut headers body
63+ . Union input thruIn (HighlevelRequestOptions headers body)
6264 => Union output thruOut CoreRequest.UnsafeRequestOptions
6365 => ToCoreRequestOptions input output
6466 => String
@@ -66,20 +68,16 @@ fetch
6668 -> Aff Response
6769fetch url r = do
6870 request <- liftEffect $ new url $ Request.convert r
69− cResponse <- Promise.toAffE $ Response.promiseToPromise <$> Core.fetch request
71+ abortController <- AbortController.new # liftEffect
72+ let signal = AbortController.signal abortController
73+ cResponse <- toAbortableAff abortController =<< liftEffect (Core.fetchWithOptions request { signal })
7074 pure $ Response.convert cResponse
7175
72−-- | Like `fetch`, but can accept arbitrary `RequestBody`s.
73−fetchBody
74− :: forall input output thruIn thruOut headers body
75− . ToRequestBody body
76− => Union input thruIn (HighlevelRequestOptions headers body)
77− => Union output thruOut CoreRequest.UnsafeRequestOptions
78− => ToCoreRequestOptions input output
79− => String
80− -> { | input }
81− -> Aff Response
82−fetchBody url r = do
83− request <- liftEffect $ new url $ Request.convert r
84− cResponse <- Promise.toAffE $ Response.promiseToPromise <$> Core.fetch request
85− pure $ Response.convert cResponse
76+toAbortableAff :: forall a. AbortController -> Promise.Promise a -> Aff a
77+toAbortableAff abortController p = makeAff \cb -> do
78+ void $ Promise.thenOrCatch
79+ (\a -> Promise.resolve <$> cb (Right a))
80+ (\e -> Promise.resolve <$> cb (Left (Promise.Aff.coerce e)))
81+ p
82+ pure $ effectCanceler (AbortController.abort abortController)
83+
src/Fetch/Internal/Headers.pursnew file+22
@@ -0,0 +1,22 @@
1+module Fetch.Internal.Headers
2+ ( contains
3+ , lookup
4+ , toHeaders
5+ ) where
6+
7+import Prelude
8+
9+import Data.Bifunctor (lmap)
10+import Data.Map as Map
11+import Data.Maybe (Maybe)
12+import Data.String.CaseInsensitive (CaseInsensitiveString(..))
13+import JS.Fetch.Headers as CoreHeaders
14+
15+toHeaders :: CoreHeaders.Headers -> Map.Map CaseInsensitiveString String
16+toHeaders = CoreHeaders.toArray >>> map (lmap CaseInsensitiveString) >>> Map.fromFoldable
17+
18+lookup :: String -> Map.Map CaseInsensitiveString String -> Maybe String
19+lookup key headers = Map.lookup (CaseInsensitiveString key) headers
20+
21+contains ∷ String → Map.Map CaseInsensitiveString String → Boolean
22+contains key headers = Map.member (CaseInsensitiveString key) headers
src/Fetch/Internal/Request.purs+36−36
@@ -16,28 +16,25 @@ import Data.Newtype (un)
1616import Data.Symbol (class IsSymbol)
1717import Effect (Effect)
1818import Effect.Uncurried (runEffectFn2)
19−import Fetch.Core.Headers (Headers)
20−import Fetch.Core.Headers as CoreHeaders
21−import Fetch.Core.Integrity (Integrity(..))
22−import Fetch.Core.Integrity as CoreIntegrity
23−import Fetch.Core.Referrer (Referrer)
24−import Fetch.Core.Referrer as CoreReferrer
25−import Fetch.Core.Referrer as Referrer
26−import Fetch.Core.ReferrerPolicy (ReferrerPolicy)
27−import Fetch.Core.ReferrerPolicy as CoreReferrerPolicy
28−import Fetch.Core.ReferrerPolicy as ReferrerPolicy
29−import Fetch.Core.Request (_unsafeNew)
30−import Fetch.Core.Request as CoreRequest
31−import Fetch.Core.RequestBody (RequestBody)
32−import Fetch.Core.RequestCache (RequestCache)
33−import Fetch.Core.RequestCache as CoreRequestCache
34−import Fetch.Core.RequestCache as RequestCache
35−import Fetch.Core.RequestCredentials (RequestCredentials)
36−import Fetch.Core.RequestCredentials as CoreRequestCredentials
37−import Fetch.Core.RequestCredentials as RequestCredentials
38−import Fetch.Core.RequestMode (RequestMode)
39−import Fetch.Core.RequestMode as CoreRequestMode
40−import Fetch.Core.RequestMode as RequestMode
19+import JS.Fetch.Duplex (Duplex)
20+import JS.Fetch.Duplex as Core.Duplex
21+import JS.Fetch.Headers (Headers)
22+import JS.Fetch.Headers as Core.Headers
23+import JS.Fetch.Integrity (Integrity(..))
24+import JS.Fetch.Integrity as Core.Integrity
25+import JS.Fetch.Referrer (Referrer)
26+import JS.Fetch.Referrer as Core.Referrer
27+import JS.Fetch.ReferrerPolicy (ReferrerPolicy)
28+import JS.Fetch.ReferrerPolicy as Core.ReferrerPolicy
29+import JS.Fetch.Request (_unsafeNew)
30+import JS.Fetch.Request as Core.Request
31+import JS.Fetch.RequestBody (RequestBody)
32+import JS.Fetch.RequestCache (RequestCache)
33+import JS.Fetch.RequestCache as Core.RequestCache
34+import JS.Fetch.RequestCredentials (RequestCredentials)
35+import JS.Fetch.RequestCredentials as Core.RequestCredentials
36+import JS.Fetch.RequestMode (RequestMode)
37+import JS.Fetch.RequestMode as Core.RequestMode
4138import Fetch.Internal.RequestBody (class ToRequestBody, toRequestBody)
4239import Prim.Row (class Lacks, class Union)
4340import Prim.Row as R
@@ -50,20 +47,21 @@ type HighlevelRequestOptions headers body =
5047 ( method :: Method
5148 , headers :: { | headers }
5249 , body :: body
53− , credentials :: CoreRequestCredentials.RequestCredentials
54− , cache :: CoreRequestCache.RequestCache
55− , mode :: CoreRequestMode.RequestMode
56− , referrer :: CoreReferrer.Referrer
57− , referrerPolicy :: CoreReferrerPolicy.ReferrerPolicy
58− , integrity :: CoreIntegrity.Integrity
50+ , credentials :: Core.RequestCredentials.RequestCredentials
51+ , cache :: Core.RequestCache.RequestCache
52+ , mode :: Core.RequestMode.RequestMode
53+ , referrer :: Core.Referrer.Referrer
54+ , referrerPolicy :: Core.ReferrerPolicy.ReferrerPolicy
55+ , integrity :: Core.Integrity.Integrity
56+ , duplex :: Core.Duplex.Duplex
5957 )
6058
6159new
6260 :: forall input thru
63− . Union input thru CoreRequest.UnsafeRequestOptions
61+ . Union input thru Core.Request.UnsafeRequestOptions
6462 => String
6563 -> { | input }
66− -> Effect CoreRequest.Request
64+ -> Effect Core.Request.Request
6765new url options = runEffectFn2 _unsafeNew url options
6866
6967class ToCoreRequestOptions input output | input -> output where
@@ -105,26 +103,28 @@ instance ToCoreRequestOptionsConverter "method" Method String where
105103 convertImpl _ = show
106104
107105instance (Homogeneous r String) => ToCoreRequestOptionsConverter "headers" { | r } Headers where
108− convertImpl _ = CoreHeaders.fromRecord
106+ convertImpl _ = Core.Headers.fromRecord
109107
110108instance (ToRequestBody body) => ToCoreRequestOptionsConverter "body" body RequestBody where
111109 convertImpl _ = toRequestBody
112110
113111instance ToCoreRequestOptionsConverter "credentials" RequestCredentials String where
114− convertImpl _ = RequestCredentials.toString
112+ convertImpl _ = Core.RequestCredentials.toString
115113
116114instance ToCoreRequestOptionsConverter "cache" RequestCache String where
117− convertImpl _ = RequestCache.toString
115+ convertImpl _ = Core.RequestCache.toString
118116
119117instance ToCoreRequestOptionsConverter "mode" RequestMode String where
120− convertImpl _ = RequestMode.toString
118+ convertImpl _ = Core.RequestMode.toString
121119
122120instance ToCoreRequestOptionsConverter "referrer" Referrer String where
123− convertImpl _ = Referrer.toString
121+ convertImpl _ = Core.Referrer.toString
124122
125123instance ToCoreRequestOptionsConverter "referrerPolicy" ReferrerPolicy String where
126− convertImpl _ = ReferrerPolicy.toString
124+ convertImpl _ = Core.ReferrerPolicy.toString
127125
128126instance ToCoreRequestOptionsConverter "integrity" Integrity String where
129127 convertImpl _ = un Integrity
130128
129+instance ToCoreRequestOptionsConverter "duplex" Duplex String where
130+ convertImpl _ = Core.Duplex.toString
src/Fetch/Internal/RequestBody.purs+1−1
@@ -1,7 +1,7 @@
11module Fetch.Internal.RequestBody where
22
33import Data.ArrayBuffer.Types (ArrayBuffer, ArrayView, Uint8Array)
4−import Fetch.Core.RequestBody as CoreRequestBody
4+import JS.Fetch.RequestBody as CoreRequestBody
55import Web.Streams.ReadableStream (ReadableStream)
66
77class ToRequestBody body where
src/Fetch/Internal/Response.purs+11−16
@@ -6,27 +6,25 @@ module Fetch.Internal.Response
66 , body
77 , convert
88 , json
9− , promiseToPromise
109 , text
1110 ) where
1211
1312import Prelude
1413
15−import Control.Promise as Control
16−import Control.Promise as Promise
1714import Data.ArrayBuffer.Types (ArrayBuffer, Uint8Array)
15+import Data.Map as Map
16+import Data.String.CaseInsensitive (CaseInsensitiveString)
1817import Effect (Effect)
1918import Effect.Aff (Aff)
20−import Fetch.Core.Headers (Headers)
21−import Fetch.Core.Response as CoreResponse
19+import JS.Fetch.Response as CoreResponse
20+import Fetch.Internal.Headers (toHeaders)
2221import Foreign (Foreign)
23−import Unsafe.Coerce (unsafeCoerce)
22+import Promise.Aff as Promise.Aff
2423import Web.File.Blob (Blob)
25−import Web.Promise as Web
2624import Web.Streams.ReadableStream (ReadableStream)
2725
2826type ResponseR =
29− ( headers :: Headers
27+ ( headers :: Map.Map CaseInsensitiveString String
3028 , ok :: Boolean
3129 , redirected :: Boolean
3230 , status :: Int
@@ -44,26 +42,23 @@ type Response =
4442 }
4543
4644text :: CoreResponse.Response -> Aff String
47−text response = CoreResponse.text response <#> promiseToPromise # Promise.toAffE
45+text response = CoreResponse.text response # Promise.Aff.toAffE
4846
4947body :: CoreResponse.Response -> Effect (ReadableStream Uint8Array)
5048body = CoreResponse.body
5149
5250json :: CoreResponse.Response -> Aff Foreign
53−json response = CoreResponse.json response <#> promiseToPromise # Promise.toAffE
51+json response = CoreResponse.json response # Promise.Aff.toAffE
5452
5553arrayBuffer :: CoreResponse.Response -> Aff ArrayBuffer
56−arrayBuffer response = CoreResponse.arrayBuffer response <#> promiseToPromise # Promise.toAffE
54+arrayBuffer response = CoreResponse.arrayBuffer response # Promise.Aff.toAffE
5755
5856blob :: CoreResponse.Response -> Aff Blob
59−blob response = CoreResponse.blob response <#> promiseToPromise # Promise.toAffE
60−
61−promiseToPromise :: Web.Promise ~> Control.Promise
62−promiseToPromise = unsafeCoerce
57+blob response = CoreResponse.blob response # Promise.Aff.toAffE
6358
6459convert :: CoreResponse.Response -> Response
6560convert response =
66− { headers: CoreResponse.headers response
61+ { headers: CoreResponse.headers response # toHeaders
6762 , ok: CoreResponse.ok response
6863 , redirected: CoreResponse.redirected response
6964 , status: CoreResponse.status response
test.dhalldeleted−21
@@ -1,21 +0,0 @@
1−let conf = ./spago.dhall
2−
3−in conf
4− // { sources = conf.sources # [ "test/**/*.purs" ]
5− , dependencies =
6− conf.dependencies
7− # [ "aff"
8− , "aff-promise"
9− , "console"
10− , "effect"
11− , "either"
12− , "exceptions"
13− , "lists"
14− , "spec"
15− , "spec-discovery"
16− , "strings"
17− , "transformers"
18− , "debug"
19− , "media-types"
20− ]
21− }
test/Main.purs+2−3
@@ -4,11 +4,10 @@ import Prelude
44
55import Effect (Effect)
66import Effect.Aff (launchAff_)
7−import Test.Spec.Discovery (discover)
87import Test.Spec.Reporter.Console (consoleReporter)
98import Test.Spec.Runner (runSpec)
9+import Test.FetchSpec (spec) as FetchSpec
1010
1111main :: Effect Unit
1212main = launchAff_ do
13− specs <- discover "\\..*Spec"
14− runSpec [ consoleReporter ] specs
13+ runSpec [ consoleReporter ] FetchSpec.spec
test/Test/FetchSpec.purs+103−3
@@ -3,11 +3,38 @@ module Test.FetchSpec where
33import Prelude
44
55import Data.ArrayBuffer.Types (Uint8Array)
6−import Fetch (Method(..), Referrer(..), RequestMode(..), fetch, fetchBody)
6+import Data.Maybe (Maybe(..), isNothing)
7+import Fetch (Method(..), Referrer(..), RequestMode(..), fetch)
8+import Fetch as Fetch
9+import JS.Fetch.Duplex (Duplex(..))
710import Foreign (unsafeFromForeign)
811import Test.Spec (Spec, describe, it)
9−import Test.Spec.Assertions (shouldEqual)
12+import Test.Spec.Assertions (shouldEqual, shouldSatisfy)
1013import Web.Streams.ReadableStream (ReadableStream)
14+import Effect.Aff (attempt, forkAff, launchAff_)
15+import Data.Either (blush)
16+import Effect.Aff (delay, joinFiber, killFiber) as Aff
17+import Data.Time.Duration (Milliseconds(Milliseconds))
18+import Effect.Exception (Error, error)
19+import Effect.Exception (message) as Exception
20+import Effect.Ref (new, read, write) as Ref
21+import Effect.Class (liftEffect)
22+import Node.HTTP as HTTP
23+import Node.EventEmitter (once_)
24+import Node.HTTP.Server as Server
25+import Node.Net.Server (listenTcp)
26+import Node.HTTP.OutgoingMessage as OM
27+import Node.Net.Server as NetServer
28+import Node.HTTP.IncomingMessage as IM
29+import Node.HTTP.ServerResponse as ServerResponse
30+import Partial.Unsafe (unsafeCrashWith)
31+import Node.Encoding (Encoding(UTF8))
32+import Node.Stream as Stream
33+import Node.HTTP.Types (HttpServer', IMServer, IncomingMessage, ServerResponse)
34+import Effect (Effect)
35+import Node.HTTP.Server (closeAllConnections)
36+import Effect.Ref (Ref)
37+
1138
1239-- | Returns a new ReadableStream that allows the content of the Blob to be read.
1340foreign import helloWorldStream :: ReadableStream Uint8Array
@@ -39,13 +66,86 @@ spec =
3966
4067 it "should send a Post request with stream body" do
4168
42− { status, json } <- fetchBody "https://httpbin.org/post"
69+ { status, json } <- fetch "https://httpbin.org/post"
4370 { method: POST
4471 , mode: Cors
4572 , body: helloWorldStream
4673 , headers: { "Content-Type": "application/json" }
4774 , referrer: (ReferrerUrl "https://httpbin.org")
75+ , duplex: Half
4876 }
4977 { json: j } <- json <#> unsafeFromForeign
5078 j `shouldEqual` { hello: "world" }
5179 status `shouldEqual` 200
80+
81+ it "should retrieve correct headers" do
82+
83+ { status, headers } <- fetch "https://httpbin.org/post"
84+ { method: POST
85+ , body: """{"hello":"world"}"""
86+ , headers: { "Content-Type": "application/json" }
87+ }
88+ Fetch.lookup "Access-Control-Allow-Origin" headers `shouldEqual` Just "*"
89+ Fetch.lookup "Content-Type" headers `shouldEqual` Just "application/json"
90+ Fetch.contains "Content-Length" headers `shouldEqual` true
91+ status `shouldEqual` 200
92+
93+ it "can be cancelled" do
94+ requestCancelledRef <- Ref.new Nothing # liftEffect
95+ -- Start a server that records our cancellation
96+ server requestCancelledRef # liftEffect
97+ requestFiber <- forkAff $ fetch "http://localhost:54045/" {}
98+ Aff.delay (40.0 # Milliseconds)
99+ requestCancelled <- Ref.read requestCancelledRef # liftEffect
100+ requestCancelled `shouldSatisfy` isNothing
101+ -- Cancel the request
102+ Aff.killFiber (error "Fetch Abort Test") requestFiber
103+ result <- attempt $ Aff.joinFiber requestFiber
104+ (Exception.message <$> blush result) `shouldEqual` (Just "Fetch Abort Test")
105+ Aff.delay (80.0 # Milliseconds)
106+ requestCancelled <- Ref.read requestCancelledRef # liftEffect
107+ (Exception.message <$> requestCancelled) `shouldEqual` (Just "aborted")
108+ where
109+
110+ -- | A server that will respond to a request after 100ms
111+ -- | it records the first error on the request stream in the ref
112+ -- | Adapted from: [node-http](https://github.com/purescript-node/purescript-node-http/blob/master/test/Main.purs)
113+ server ref = do
114+ server <- HTTP.createServer
115+ server # once_ Server.requestH (respond ref (killServer server))
116+ let netServer = Server.toNetServer server
117+ listenTcp netServer { host: "localhost", port: 54045 }
118+ where
119+
120+ respond :: Ref (Maybe Error) -> Effect Unit -> IncomingMessage IMServer -> ServerResponse -> Effect Unit
121+ respond ref closeServer req res = do
122+ ServerResponse.setStatusCode 200 res
123+ let
124+ im = IM.toReadable req
125+ om = ServerResponse.toOutgoingMessage res
126+ outputStream = OM.toWriteable om
127+
128+ -- Handle errors on the input stream
129+ -- and save them to the ref
130+ im # once_ Stream.errorH \err -> do
131+ whenM (Stream.destroyed im) do
132+ Ref.write (Just err) ref # liftEffect
133+
134+ case IM.method req of
135+ "GET" -> launchAff_ do
136+ -- Let's pretend this is answering slowly
137+ Aff.delay (100.0 # Milliseconds)
138+ void $ Stream.writeString outputStream UTF8 "ok" # liftEffect
139+ Stream.end outputStream # liftEffect
140+ _ ->
141+ unsafeCrashWith "Unexpected HTTP method"
142+ launchAff_ do
143+ Aff.delay (110.0 # Milliseconds)
144+ closeServer # liftEffect
145+
146+
147+ killServer :: forall transmissionType. HttpServer' transmissionType -> Effect Unit
148+ killServer s = do
149+ let ns = Server.toNetServer s
150+ closeAllConnections s
151+ NetServer.close ns