mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-30 13:16:08 +03:00
Delete obsolete data related to OptimizedDecoder stripping.
This commit is contained in:
parent
dc4d336ad1
commit
2af7accfe8
@ -87,7 +87,6 @@ import Pages.Internal.StaticHttpBody as Body
|
||||
import Pages.StaticHttp.Request as HashRequest
|
||||
import Pages.StaticHttpRequest exposing (RawRequest(..))
|
||||
import RequestsAndPending exposing (RequestsAndPending)
|
||||
import Set exposing (Set)
|
||||
|
||||
|
||||
{-| A DataSource represents data that will be gathered at build time. Multiple `DataSource`s can be combined together using the `mapN` functions,
|
||||
@ -128,8 +127,8 @@ map fn requestInfo =
|
||||
RequestError error ->
|
||||
RequestError error
|
||||
|
||||
Request partiallyStripped ( urls, lookupFn ) ->
|
||||
Request partiallyStripped
|
||||
Request ( urls, lookupFn ) ->
|
||||
Request
|
||||
( urls
|
||||
, \rawResponses ->
|
||||
map fn (lookupFn rawResponses)
|
||||
@ -218,8 +217,8 @@ map2 fn request1 request2 =
|
||||
( _, RequestError error ) ->
|
||||
RequestError error
|
||||
|
||||
( Request newDict1 ( urls1, lookupFn1 ), Request newDict2 ( urls2, lookupFn2 ) ) ->
|
||||
Request (Set.union newDict1 newDict2)
|
||||
( Request ( urls1, lookupFn1 ), Request ( urls2, lookupFn2 ) ) ->
|
||||
Request
|
||||
( urls1 ++ urls2
|
||||
, \rawResponses ->
|
||||
map2 fn
|
||||
@ -227,8 +226,8 @@ map2 fn request1 request2 =
|
||||
(lookupFn2 rawResponses)
|
||||
)
|
||||
|
||||
( Request dict1 ( urls1, lookupFn1 ), ApiRoute value2 ) ->
|
||||
Request dict1
|
||||
( Request ( urls1, lookupFn1 ), ApiRoute value2 ) ->
|
||||
Request
|
||||
( urls1
|
||||
, \rawResponses ->
|
||||
map2 fn
|
||||
@ -236,8 +235,8 @@ map2 fn request1 request2 =
|
||||
(ApiRoute value2)
|
||||
)
|
||||
|
||||
( ApiRoute value2, Request dict1 ( urls1, lookupFn1 ) ) ->
|
||||
Request dict1
|
||||
( ApiRoute value2, Request ( urls1, lookupFn1 ) ) ->
|
||||
Request
|
||||
( urls1
|
||||
, \rawResponses ->
|
||||
map2 fn
|
||||
@ -255,7 +254,7 @@ lookup requestInfo rawResponses =
|
||||
RequestError error ->
|
||||
Err error
|
||||
|
||||
Request strippedResponses ( urls, lookupFn ) ->
|
||||
Request ( urls, lookupFn ) ->
|
||||
lookup
|
||||
(addUrls urls (lookupFn rawResponses))
|
||||
rawResponses
|
||||
@ -270,8 +269,8 @@ addUrls urlsToAdd requestInfo =
|
||||
RequestError error ->
|
||||
RequestError error
|
||||
|
||||
Request stripped ( initialUrls, function ) ->
|
||||
Request stripped ( initialUrls ++ urlsToAdd, function )
|
||||
Request ( initialUrls, function ) ->
|
||||
Request ( initialUrls ++ urlsToAdd, function )
|
||||
|
||||
ApiRoute value ->
|
||||
ApiRoute value
|
||||
@ -294,7 +293,7 @@ lookupUrls requestInfo =
|
||||
-- TODO should this have URLs passed through?
|
||||
[]
|
||||
|
||||
Request _ ( urls, _ ) ->
|
||||
Request ( urls, _ ) ->
|
||||
urls
|
||||
|
||||
ApiRoute _ ->
|
||||
@ -321,7 +320,7 @@ from the previous response to build up the URL, headers, etc. that you send to t
|
||||
andThen : (a -> DataSource b) -> DataSource a -> DataSource b
|
||||
andThen fn requestInfo =
|
||||
-- TODO should this be non-empty Dict? Or should it be passed down some other way?
|
||||
Request Set.empty
|
||||
Request
|
||||
( lookupUrls requestInfo
|
||||
, \rawResponses ->
|
||||
lookup
|
||||
@ -330,14 +329,12 @@ andThen fn requestInfo =
|
||||
|> (\result ->
|
||||
case result of
|
||||
Err error ->
|
||||
-- TODO should I pass through strippedResponses here?
|
||||
--( strippedResponses, fn value )
|
||||
RequestError error
|
||||
|
||||
Ok value ->
|
||||
case fn value of
|
||||
Request dict ( values, function ) ->
|
||||
Request dict ( values, function )
|
||||
Request ( values, function ) ->
|
||||
Request ( values, function )
|
||||
|
||||
RequestError error ->
|
||||
RequestError error
|
||||
|
@ -58,7 +58,6 @@ import Pages.Internal.StaticHttpBody as Body
|
||||
import Pages.StaticHttp.Request as HashRequest
|
||||
import Pages.StaticHttpRequest exposing (RawRequest(..))
|
||||
import RequestsAndPending
|
||||
import Set exposing (Set)
|
||||
|
||||
|
||||
{-| Build an empty body for a DataSource.Http request. See [elm/http's `Http.emptyBody`](https://package.elm-lang.org/packages/elm/http/latest/Http#emptyBody).
|
||||
@ -207,7 +206,7 @@ request :
|
||||
request request_ expect =
|
||||
case expect of
|
||||
ExpectJson decoder ->
|
||||
Request Set.empty
|
||||
Request
|
||||
( [ request_ ]
|
||||
, \rawResponseDict ->
|
||||
rawResponseDict
|
||||
@ -247,7 +246,7 @@ request request_ expect =
|
||||
)
|
||||
|
||||
ExpectString mapStringFn ->
|
||||
Request Set.empty
|
||||
Request
|
||||
( [ request_ ]
|
||||
, \rawResponseDict ->
|
||||
rawResponseDict
|
||||
|
@ -4,12 +4,11 @@ import BuildError exposing (BuildError)
|
||||
import List.Extra
|
||||
import Pages.StaticHttp.Request
|
||||
import RequestsAndPending exposing (RequestsAndPending)
|
||||
import Set exposing (Set)
|
||||
import TerminalText as Terminal
|
||||
|
||||
|
||||
type RawRequest value
|
||||
= Request (Set String) ( List Pages.StaticHttp.Request.Request, RequestsAndPending -> RawRequest value )
|
||||
= Request ( List Pages.StaticHttp.Request.Request, RequestsAndPending -> RawRequest value )
|
||||
| RequestError Error
|
||||
| ApiRoute value
|
||||
|
||||
@ -57,7 +56,7 @@ resolve request rawResponses =
|
||||
RequestError error ->
|
||||
Err error
|
||||
|
||||
Request _ ( _, lookupFn ) ->
|
||||
Request ( _, lookupFn ) ->
|
||||
case lookupFn rawResponses of
|
||||
nextRequest ->
|
||||
resolve nextRequest rawResponses
|
||||
@ -83,7 +82,7 @@ resolveUrlsHelp rawResponses soFar request =
|
||||
_ ->
|
||||
soFar
|
||||
|
||||
Request _ ( urlList, lookupFn ) ->
|
||||
Request ( urlList, lookupFn ) ->
|
||||
resolveUrlsHelp
|
||||
rawResponses
|
||||
(soFar ++ urlList)
|
||||
@ -126,7 +125,7 @@ cacheRequestResolutionHelp foundUrls rawResponses request =
|
||||
UserCalledStaticHttpFail _ ->
|
||||
HasPermanentError error
|
||||
|
||||
Request _ ( urlList, lookupFn ) ->
|
||||
Request ( urlList, lookupFn ) ->
|
||||
cacheRequestResolutionHelp urlList
|
||||
rawResponses
|
||||
(lookupFn rawResponses)
|
||||
|
Loading…
Reference in New Issue
Block a user