elm-pages 3.0.0-beta.41 → 3.0.0-beta.42

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.
@@ -92,8 +92,8 @@ typeToDeclaration name type_ =
92
92
  type Builder
93
93
  = ServerRender
94
94
  (List Elm.Declaration)
95
- { data : ( Type, Elm.Expression -> Elm.Expression )
96
- , action : ( Type, Elm.Expression -> Elm.Expression )
95
+ { data : ( Type, Elm.Expression -> Elm.Expression -> Elm.Expression )
96
+ , action : ( Type, Elm.Expression -> Elm.Expression -> Elm.Expression )
97
97
  , head : Elm.Expression -> Elm.Expression
98
98
  , moduleName : List String
99
99
  }
@@ -108,8 +108,8 @@ type Builder
108
108
 
109
109
  {-| -}
110
110
  serverRender :
111
- { data : ( Type, Elm.Expression -> Elm.Expression )
112
- , action : ( Type, Elm.Expression -> Elm.Expression )
111
+ { data : ( Type, Elm.Expression -> Elm.Expression -> Elm.Expression )
112
+ , action : ( Type, Elm.Expression -> Elm.Expression -> Elm.Expression )
113
113
  , head : Elm.Expression -> Elm.Expression
114
114
  , moduleName : List String
115
115
  }
@@ -203,7 +203,7 @@ buildNoState definitions builder_ =
203
203
  , app = app
204
204
  }
205
205
  , localState = Nothing
206
- , data = builder.data |> Tuple.second
206
+ , data = builder.data |> Tuple.second |> (\fn -> \_ -> fn)
207
207
  , action = builder.pages |> Pages
208
208
  , head = builder.head
209
209
  , types =
@@ -346,7 +346,7 @@ buildWithLocalState definitions builder_ =
346
346
  }
347
347
  , state = LocalState
348
348
  }
349
- , data = builder.data |> Tuple.second
349
+ , data = builder.data |> Tuple.second |> (\fn -> \_ -> fn)
350
350
  , action = builder.pages |> Pages
351
351
  , head = builder.head
352
352
  , types =
@@ -474,7 +474,7 @@ buildWithSharedState definitions builder_ =
474
474
  }
475
475
  , state = SharedState
476
476
  }
477
- , data = builder.data |> Tuple.second
477
+ , data = builder.data |> Tuple.second |> (\fn -> \_ -> fn)
478
478
  , action = builder.pages |> Pages
479
479
  , head = builder.head
480
480
  , types =
@@ -496,7 +496,7 @@ type State
496
496
 
497
497
 
498
498
  type ActionOrPages
499
- = Action (Elm.Expression -> Elm.Expression)
499
+ = Action (Elm.Expression -> Elm.Expression -> Elm.Expression)
500
500
  | Pages (Maybe Elm.Expression)
501
501
 
502
502
 
@@ -512,7 +512,7 @@ userFunction :
512
512
  , subscriptions : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression
513
513
  , state : State
514
514
  }
515
- , data : Elm.Expression -> Elm.Expression
515
+ , data : Elm.Expression -> Elm.Expression -> Elm.Expression
516
516
  , action : ActionOrPages
517
517
  , head : Elm.Expression -> Elm.Expression
518
518
  , types : { model : Type, msg : Type, data : Type, actionData : Type }
@@ -638,7 +638,7 @@ userFunction moduleName definitions =
638
638
  Elm.Declare.fn4
639
639
  "subscriptions"
640
640
  ( "routeParams", "RouteParams" |> Elm.Annotation.named [] |> Just )
641
- ( "path", Elm.Annotation.namedWith [ "Path" ] "Path" [] |> Just )
641
+ ( "path", Elm.Annotation.namedWith [ "UrlPath" ] "UrlPath" [] |> Just )
642
642
  ( "shared", Just (Elm.Annotation.named [ "Shared" ] "Model") )
643
643
  ( "model", localType "Model" |> Just )
644
644
  (\routeParams path shared model ->
@@ -656,7 +656,7 @@ userFunction moduleName definitions =
656
656
  Elm.Declare.function "data"
657
657
  []
658
658
  (\_ ->
659
- definitions.data Elm.unit
659
+ definitions.data Elm.unit Elm.unit
660
660
  |> Elm.withType
661
661
  (case definitions.action of
662
662
  Pages _ ->
@@ -674,11 +674,16 @@ userFunction moduleName definitions =
674
674
  |> Elm.Annotation.named []
675
675
  |> Just
676
676
  )
677
+ , ( "request"
678
+ , "Request"
679
+ |> Elm.Annotation.named [ "Server", "Request" ]
680
+ |> Just
681
+ )
677
682
  ]
678
683
  (\args ->
679
684
  case args of
680
- [ arg ] ->
681
- definitions.data arg
685
+ [ arg, arg2 ] ->
686
+ definitions.data arg arg2
682
687
  |> Elm.withType
683
688
  (case definitions.action of
684
689
  Pages _ ->
@@ -702,11 +707,16 @@ userFunction moduleName definitions =
702
707
  |> Elm.Annotation.named []
703
708
  |> Just
704
709
  )
710
+ , ( "request"
711
+ , "Request"
712
+ |> Elm.Annotation.named [ "Server", "Request" ]
713
+ |> Just
714
+ )
705
715
  ]
706
716
  (\args ->
707
717
  case args of
708
- [ arg ] ->
709
- action_ arg |> Elm.withType (myType "ActionData")
718
+ [ arg1, arg2 ] ->
719
+ action_ arg1 arg2 |> Elm.withType (myType "ActionData")
710
720
 
711
721
  _ ->
712
722
  Elm.unit
@@ -750,17 +760,17 @@ userFunction moduleName definitions =
750
760
  Action _ ->
751
761
  serverRender_
752
762
  { action =
753
- \routeParams ->
763
+ \routeParams request ->
754
764
  actionFn
755
765
  |> Maybe.map
756
766
  (\justActionFn ->
757
- justActionFn.call [ routeParams ]
767
+ justActionFn.call [ routeParams, request ]
758
768
  |> Elm.withType (myType "ActionData")
759
769
  )
760
770
  |> Maybe.withDefault Elm.unit
761
771
  , data =
762
- \routeParams ->
763
- dataFn.call [ routeParams ]
772
+ \routeParams request ->
773
+ dataFn.call [ routeParams, request ]
764
774
  |> Elm.withType (myType "Data")
765
775
  , head = headFn.call
766
776
  }
@@ -861,16 +871,18 @@ localType =
861
871
 
862
872
  myType : String -> Elm.Annotation.Annotation
863
873
  myType dataType =
864
- Elm.Annotation.namedWith [ "Server", "Request" ]
865
- "Parser"
866
- [ throwableTask
867
- (Elm.Annotation.namedWith [ "Server", "Response" ]
868
- "Response"
869
- [ Elm.Annotation.named [] dataType
870
- , Elm.Annotation.named [ "ErrorPage" ] "ErrorPage"
871
- ]
872
- )
873
- ]
874
+ --Elm.Annotation.function
875
+ -- [ Elm.Annotation.namedWith [ "Server", "Request" ]
876
+ -- "Request"
877
+ -- []
878
+ -- ]
879
+ throwableTask
880
+ (Elm.Annotation.namedWith [ "Server", "Response" ]
881
+ "Response"
882
+ [ Elm.Annotation.named [] dataType
883
+ , Elm.Annotation.named [ "ErrorPage" ] "ErrorPage"
884
+ ]
885
+ )
874
886
 
875
887
 
876
888
  appType : Elm.Annotation.Annotation
@@ -884,8 +896,8 @@ appType =
884
896
 
885
897
 
886
898
  serverRender_ :
887
- { data : Elm.Expression -> Elm.Expression
888
- , action : Elm.Expression -> Elm.Expression
899
+ { data : Elm.Expression -> Elm.Expression -> Elm.Expression
900
+ , action : Elm.Expression -> Elm.Expression -> Elm.Expression
889
901
  , head : Elm.Expression -> Elm.Expression
890
902
  }
891
903
  -> Elm.Expression
@@ -920,22 +932,20 @@ serverRender_ serverRenderArg =
920
932
  )
921
933
  , ( "action"
922
934
  , Elm.Annotation.function
923
- [ Elm.Annotation.var "routeParams" ]
924
- (Elm.Annotation.namedWith
925
- [ "Server", "Request" ]
926
- "Parser"
927
- [ throwableTask
928
- (Elm.Annotation.namedWith
929
- [ "Server", "Response" ]
930
- "Response"
931
- [ Elm.Annotation.var "action"
932
- , Elm.Annotation.namedWith
933
- [ "ErrorPage" ]
934
- "ErrorPage"
935
- []
936
- ]
937
- )
938
- ]
935
+ [ Elm.Annotation.var "routeParams"
936
+ , Elm.Annotation.named [ "Server", "Request" ] "Request"
937
+ ]
938
+ (throwableTask
939
+ (Elm.Annotation.namedWith
940
+ [ "Server", "Response" ]
941
+ "Response"
942
+ [ Elm.Annotation.var "action"
943
+ , Elm.Annotation.namedWith
944
+ [ "ErrorPage" ]
945
+ "ErrorPage"
946
+ []
947
+ ]
948
+ )
939
949
  )
940
950
  )
941
951
  , ( "head"
@@ -968,10 +978,20 @@ serverRender_ serverRenderArg =
968
978
  [ Elm.record
969
979
  [ Tuple.pair
970
980
  "data"
971
- (Elm.functionReduced "serverRenderUnpack" serverRenderArg.data)
981
+ (Elm.functionReduced
982
+ "dataUnpack"
983
+ (\functionReducedUnpack ->
984
+ Elm.functionReduced "dataUnpack2" (serverRenderArg.data functionReducedUnpack)
985
+ )
986
+ )
972
987
  , Tuple.pair
973
988
  "action"
974
- (Elm.functionReduced "serverRenderUnpack" serverRenderArg.action)
989
+ (Elm.functionReduced
990
+ "actionUnpack"
991
+ (\functionReducedUnpack ->
992
+ Elm.functionReduced "actionUnpack2" (serverRenderArg.action functionReducedUnpack)
993
+ )
994
+ )
975
995
  , Tuple.pair
976
996
  "head"
977
997
  (Elm.functionReduced "serverRenderUnpack" serverRenderArg.head)
@@ -1208,7 +1228,7 @@ buildWithLocalState_ buildWithLocalStateArg buildWithLocalStateArg0 =
1208
1228
  , ( "subscriptions"
1209
1229
  , Elm.Annotation.function
1210
1230
  [ Elm.Annotation.var "routeParams"
1211
- , Elm.Annotation.namedWith [ "Path" ] "Path" []
1231
+ , Elm.Annotation.namedWith [ "UrlPath" ] "UrlPath" []
1212
1232
  , Elm.Annotation.namedWith [ "Shared" ] "Model" []
1213
1233
  , Elm.Annotation.var "model"
1214
1234
  ]