Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Rename packages to JS.Fetch
  • Loading branch information
sigma-andex committed Sep 26, 2023
commit 58c7c706de78b8311505f709fa364ef28c564f3c
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# purescript-fetch-core

[![Latest release](http://img.shields.io/github/release/rowtype-yoga/purescript-fetch-core.svg)](https://github.com/rowtype-yoga/purescript-fetch-core/releases)
[![Build status](https://github.com/rowtype-yoga/purescript-fetch-core/workflows/CI/badge.svg?branch=master)](https://github.com/rowtype-yoga/purescript-fetch-core/actions?query=workflow%3ACI+branch%3Amaster)
[![Latest release](http://img.shields.io/github/release/purescript-contrib/purescript-js-fetch.svg)](https://github.com/purescript-contrib/purescript-js-fetch/releases)
[![Build status](https://github.com/purescript-contrib/purescript-js-fetch/workflows/CI/badge.svg?branch=master)](https://github.com/purescript-contrib/purescript-js-fetch/actions?query=workflow%3ACI+branch%3Amaster)
[![Pursuit](https://pursuit.purescript.org/packages/purescript-fetch-core/badge)](https://pursuit.purescript.org/packages/purescript-fetch-core)

Types and low-level implementations for the [WHATWG Fetch Living Standard](https://fetch.spec.whatwg.org/).
Expand All @@ -11,9 +11,9 @@ For a high-level library see [`purescript-fetch`](https://github.com/rowtype-yog
## Installation

```
spago install fetch-core
spago install js-fetch
```

## Documentation

Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-fetch-core).
Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-js-fetch).
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
],
"repository": {
"type": "git",
"url": "https://github.com/rowtype-yoga/purescript-fetch-core.git"
"url": "https://github.com/purescript-contrib/purescript-js-fetch.git"
},
"ignore": [
"**/.*",
Expand Down
2 changes: 1 addition & 1 deletion spago.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
, packages = ./packages.dhall
, sources = [ "src/**/*.purs" ]
, license = "MIT"
, repository = "https://github.com/rowtype-yoga/purescript-fetch-core.git"
, repository = "https://github.com/purescript-contrib/purescript-js-fetch.git"
}
File renamed without changes.
8 changes: 4 additions & 4 deletions src/Fetch/Core.purs → src/JS/Fetch/Core.purs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module Fetch.Core
module JS.Fetch
( FetchOptions
, fetch
, fetchWithOptions
) where

import Effect (Effect)
import Effect.Uncurried (EffectFn2, runEffectFn2)
import Fetch.Core.AbortController (AbortSignal)
import Fetch.Core.Request (Request)
import Fetch.Core.Response (Response)
import JS.Fetch.AbortController (AbortSignal)
import JS.Fetch.Request (Request)
import JS.Fetch.Response (Response)
import Prim.Row as Row
import Promise (Promise)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Fetch.Core.AbortController where
module JS.Fetch.AbortController where

import Effect (Effect)
import Prelude (Unit)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Fetch.Core.Duplex where
module JS.Fetch.Duplex where

import Prelude

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Fetch.Core.Headers
module JS.Fetch.Headers
( Headers
, fromFoldable
, fromRecord
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Fetch.Core.Integrity where
module JS.Fetch.Integrity where

import Data.Newtype (class Newtype)
import Prelude (class Eq, class Ord)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Fetch.Core.Referrer where
module JS.Fetch.Referrer where

data Referrer
= ReferrerNone
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Fetch.Core.ReferrerPolicy where
module JS.Fetch.ReferrerPolicy where

import Data.Maybe (Maybe(..))

Expand Down
File renamed without changes.
32 changes: 16 additions & 16 deletions src/Fetch/Core/Request.purs → src/JS/Fetch/Fetch/Request.purs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Fetch.Core.Request
module JS.Fetch.Request
( Request
, RequestOptions
, UnsafeRequestOptions
Expand All @@ -20,21 +20,21 @@ import Data.Newtype (un)
import Data.Symbol (class IsSymbol)
import Effect (Effect)
import Effect.Uncurried (EffectFn2, runEffectFn2)
import Fetch.Core.Duplex (Duplex)
import Fetch.Core.Duplex as Duplex
import Fetch.Core.Headers (Headers)
import Fetch.Core.Integrity (Integrity(..))
import Fetch.Core.Referrer (Referrer)
import Fetch.Core.Referrer as Referrer
import Fetch.Core.ReferrerPolicy (ReferrerPolicy)
import Fetch.Core.ReferrerPolicy as ReferrerPolicy
import Fetch.Core.RequestBody (RequestBody)
import Fetch.Core.RequestCache (RequestCache)
import Fetch.Core.RequestCache as RequestCache
import Fetch.Core.RequestCredentials (RequestCredentials)
import Fetch.Core.RequestCredentials as RequestCredentials
import Fetch.Core.RequestMode (RequestMode)
import Fetch.Core.RequestMode as RequestMode
import JS.Fetch.Duplex (Duplex)
import JS.Fetch.Duplex as Duplex
import JS.Fetch.Headers (Headers)
import JS.Fetch.Integrity (Integrity(..))
import JS.Fetch.Referrer (Referrer)
import JS.Fetch.Referrer as Referrer
import JS.Fetch.ReferrerPolicy (ReferrerPolicy)
import JS.Fetch.ReferrerPolicy as ReferrerPolicy
import JS.Fetch.RequestBody (RequestBody)
import JS.Fetch.RequestCache (RequestCache)
import JS.Fetch.RequestCache as RequestCache
import JS.Fetch.RequestCredentials (RequestCredentials)
import JS.Fetch.RequestCredentials as RequestCredentials
import JS.Fetch.RequestMode (RequestMode)
import JS.Fetch.RequestMode as RequestMode
import Prim.Row (class Lacks, class Union)
import Prim.Row as R
import Prim.RowList as RL
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Fetch.Core.RequestBody where
module JS.Fetch.RequestBody where

import Data.ArrayBuffer.Types (ArrayBuffer, ArrayView, Uint8Array)
import Web.Streams.ReadableStream (ReadableStream)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Fetch.Core.RequestCache where
module JS.Fetch.RequestCache where

import Data.Maybe (Maybe(..))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Fetch.Core.RequestCredentials where
module JS.Fetch.RequestCredentials where

import Data.Maybe (Maybe(..))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Fetch.Core.RequestMode where
module JS.Fetch.RequestMode where

import Data.Maybe (Maybe(..))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Fetch.Core.RequestRedirect where
module JS.Fetch.RequestRedirect where

import Data.Maybe (Maybe(..))

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Fetch.Core.Response
module JS.Fetch.Response
( Response
, arrayBuffer
, blob
Expand All @@ -15,8 +15,8 @@ module Fetch.Core.Response

import Data.ArrayBuffer.Types (ArrayBuffer, Uint8Array)
import Effect (Effect)
import Fetch.Core.Headers (Headers)
import Foreign (Foreign)
import JS.Fetch.Headers (Headers)
import Promise (Promise)
import Web.File.Blob (Blob)
import Web.Streams.ReadableStream (ReadableStream)
Expand Down
15 changes: 6 additions & 9 deletions test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import Effect (Effect)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Effect.Class.Console (log)
import Fetch.Core as Fetch
import Fetch.Core.Duplex (Duplex(..))
import Fetch.Core.Headers as Headers
import Fetch.Core.Request as Request
import Fetch.Core.RequestBody as RequestBody
import Fetch.Core.Response as Response
import JS.Fetch as Fetch
import JS.Fetch.Duplex (Duplex(..))
import JS.Fetch.Headers as Headers
import JS.Fetch.Request as Request
import JS.Fetch.RequestBody as RequestBody
import JS.Fetch.Response as Response
import Unsafe.Coerce (unsafeCoerce)

main :: Effect Unit
Expand All @@ -26,10 +26,7 @@ main = launchAff_ do
, headers: Headers.fromRecord { "Content-Type": "application/json" }
, duplex: Half
}
let _ = spy "request" request
response <- Promise.toAffE $ unsafeCoerce $ Fetch.fetch request
responseBody <- Promise.toAffE $ unsafeCoerce $ Response.text response
let _ = spy "response" response
log $ show $ Response.status response
log responseBody
log "You should add some tests."