From 5b92b944838219e49e34bbb2fa9353adb9027a85 Mon Sep 17 00:00:00 2001 From: James Carlson <jxxcarlson@gmail.com> Date: Mon, 15 Jul 2024 23:24:20 -0400 Subject: [PATCH] Update installer for magic link auth --- Makefile | 4 ++++ elm.json | 1 + preview/src/ReviewConfig.elm | 39 +++++++++++++++++------------------- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 6e679f2..acf5787 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,10 @@ install: cp vendor-secret/Env.elm counter/src npx elm-review --config preview counter/src --debug --fix-all +elm-json: + elm-json install MartinSStewart/elm-nonempty-string + uninstall: cp vendor-open/Env.elm src/ cp -r counter-original/src/. counter/src/ + diff --git a/elm.json b/elm.json index 67166d2..d74356f 100644 --- a/elm.json +++ b/elm.json @@ -18,6 +18,7 @@ ], "elm-version": "0.19.0 <= v < 0.20.0", "dependencies": { + "MartinSStewart/elm-nonempty-string": "2.0.0 <= v < 3.0.0", "elm/core": "1.0.5 <= v < 2.0.0", "elmcraft/core-extra": "2.0.0 <= v < 3.0.0", "jfmengels/elm-review": "2.13.0 <= v < 3.0.0", diff --git a/preview/src/ReviewConfig.elm b/preview/src/ReviewConfig.elm index 7e433cc..0526293 100644 --- a/preview/src/ReviewConfig.elm +++ b/preview/src/ReviewConfig.elm @@ -121,9 +121,8 @@ configUsers = configMagicLinkMinimal : List Rule configMagicLinkMinimal = [ Import.qualified "Types" [ "Dict", "AssocList", "EmailAddress", "LocalUUID", "Auth.Common", "MagicLink.Types", "Session", "User" ] |> Import.makeRule - , Import.qualified "Frontend" [ "Dict", "MagicLink.Types", "Auth.Common", "MagicLink.Frontend", "MagicLink.Auth" , "Pages.SignIn"] |> Import.makeRule + , Import.qualified "Frontend" [ "Dict", "MagicLink.Types", "Auth.Common", "MagicLink.Frontend", "MagicLink.Auth", "Pages.SignIn" ] |> Import.makeRule , Import.qualified "Backend" [ "Dict", "AssocList", "Time", "Auth.Flow", "MagicLink.Auth", "User", "LocalUUID" ] |> Import.makeRule - , TypeVariant.makeRule "Types" "FrontendMsg" [ "AuthFrontendMsg MagicLink.Types.Msg" ] , TypeVariant.makeRule "Types" "BackendMsg" [ "AuthBackendMsg Auth.Common.BackendMsg" ] , TypeVariant.makeRule "Types" "ToBackend" [ "AuthToBackend Auth.Common.ToBackend" ] @@ -137,9 +136,9 @@ configMagicLinkMinimal = , "RegistrationError String" , "UserRegistered User.User" , "SignInError String" + --, "CheckSignInResponse (Result BackendDataStatus User.SignInData)" ] - , FieldInTypeAlias.makeRule "Types" "BackendModel" [ "localUuidData : Maybe LocalUUID.Data" @@ -155,31 +154,29 @@ configMagicLinkMinimal = , "userNameToEmailString : Dict.Dict User.Username User.EmailString" , "time: Time.Posix" , "randomAtmosphericNumbers: Maybe (List Int)" - - ] , Initializer.makeRule "Frontend" "initLoaded" [ { field = "magicLinkModel", value = "Pages.SignIn.init loadingModel.initUrl" } ] , Initializer.makeRule "Backend" - "init" - [ { field = "randomAtmosphericNumbers", value = "Just [ 235880, 700828, 253400, 602641 ]" } - , { field = "time", value = "Time.millisToPosix 0" } - , { field = "sessions", value = "Dict.empty" } - , { field = "userNameToEmailString", value = "Dict.empty" } - , { field = "users", value = "Dict.empty" } - , { field = "sessionInfo", value = "Dict.empty" } - , { field = "pendingAuths", value = "Dict.empty" } - , { field = "localUuidData", value = "LocalUUID.initFrom4List [ 235880, 700828, 253400, 602641 ]" } - , { field = "pendingEmailAuths", value = "Dict.empty" } - , { field = "secretCounter", value = "0" } - , { field = "sessionDict", value = "AssocList.empty" } - , { field = "pendingLogins", value = "AssocList.empty" } - , { field = "log", value = "[]" } - ] + "init" + [ { field = "randomAtmosphericNumbers", value = "Just [ 235880, 700828, 253400, 602641 ]" } + , { field = "time", value = "Time.millisToPosix 0" } + , { field = "sessions", value = "Dict.empty" } + , { field = "userNameToEmailString", value = "Dict.empty" } + , { field = "users", value = "Dict.empty" } + , { field = "sessionInfo", value = "Dict.empty" } + , { field = "pendingAuths", value = "Dict.empty" } + , { field = "localUuidData", value = "LocalUUID.initFrom4List [ 235880, 700828, 253400, 602641 ]" } + , { field = "pendingEmailAuths", value = "Dict.empty" } + , { field = "secretCounter", value = "0" } + , { field = "sessionDict", value = "AssocList.empty" } + , { field = "pendingLogins", value = "AssocList.empty" } + , { field = "log", value = "[]" } + ] , ClauseInCase.init "Frontend" "updateLoaded" "AuthFrontendMsg authToFrontendMsg" "MagicLink.Auth.update authToFrontendMsg model.magicLinkModel |> Tuple.mapFirst (\\magicLinkModel -> { model | magicLinkModel = magicLinkModel })" |> ClauseInCase.makeRule , ClauseInCase.init "Backend" "updateFromFrontend" "AuthToBackend authMsg" "Auth.Flow.updateFromFrontend (MagicLink.Auth.backendConfig model) clientId sessionId authMsg model" |> ClauseInCase.makeRule , ClauseInCase.init "Backend" "update" "AuthBackendMsg _" "(model, Cmd.none)" |> ClauseInCase.makeRule , ReplaceFunction.init "Frontend" "tryLoading" tryLoading2 - |> ReplaceFunction.makeRule + |> ReplaceFunction.makeRule ]