{"id":16710575,"url":"https://github.com/andrewmacmurray/elm-url-query-pipeline","last_synced_at":"2026-04-29T19:01:25.542Z","repository":{"id":62419706,"uuid":"504194161","full_name":"andrewMacmurray/elm-url-query-pipeline","owner":"andrewMacmurray","description":"Parse url Queries pipeline style","archived":false,"fork":false,"pushed_at":"2023-09-14T11:52:12.000Z","size":88,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-01T23:17:34.581Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://package.elm-lang.org/packages/andrewMacmurray/elm-url-query-pipeline/latest/","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrewMacmurray.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-16T14:47:02.000Z","updated_at":"2025-09-17T15:56:38.000Z","dependencies_parsed_at":"2025-01-21T18:48:07.683Z","dependency_job_id":"810ac621-ef80-4cf7-bd39-2e6f5e8a7dc5","html_url":"https://github.com/andrewMacmurray/elm-url-query-pipeline","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/andrewMacmurray/elm-url-query-pipeline","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewMacmurray%2Felm-url-query-pipeline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewMacmurray%2Felm-url-query-pipeline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewMacmurray%2Felm-url-query-pipeline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewMacmurray%2Felm-url-query-pipeline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewMacmurray","download_url":"https://codeload.github.com/andrewMacmurray/elm-url-query-pipeline/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewMacmurray%2Felm-url-query-pipeline/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32439301,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T18:12:22.909Z","status":"ssl_error","status_checked_at":"2026-04-29T18:11:33.322Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T20:08:58.886Z","updated_at":"2026-04-29T19:01:25.454Z","avatar_url":"https://github.com/andrewMacmurray.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Elm Url Query Pipeline\n\n[![CI](https://github.com/andrewMacmurray/elm-url-query-pipeline/actions/workflows/ci.yml/badge.svg)](https://github.com/andrewMacmurray/elm-url-query-pipeline/actions/workflows/ci.yml)\n\n### Parse Url Queries Pipeline Style\n\n```shell\nelm install andrewMacmurray/elm-url-query-pipeline\n```\n\n## What?\n\nSome helpers to combine [elm/url](https://package.elm-lang.org/packages/elm/url/latest/Url-Parser-Query) Url Query param\nparsers using a pipeline style -\nthink [elm-json-decode-pipeline](https://package.elm-lang.org/packages/NoRedInk/elm-json-decode-pipeline/latest/) but\nfor Url Query params:\n\n```elm\nimport Url.Parser.Query as Query -- from elm/url\nimport Url.Query.Pipeline as Pipeline\n\n\ntype alias AuthCallback =\n    { userId : Int\n    , userName : Maybe String\n    , idToken : String\n    , idTokenExpiresAt : Int\n    , refreshToken : String\n    }\n\n\nauthCallbackQuery : Query.Parser (Maybe AuthCallback)\nauthCallbackQuery =\n    Pipeline.succeed AuthCallback\n        |\u003e Pipeline.required (Query.int \"user_id\")\n        |\u003e Pipeline.optional (Query.string \"user_name\")\n        |\u003e Pipeline.required (Query.string \"id_token\")\n        |\u003e Pipeline.required (Query.int \"id_token_expires_at\")\n        |\u003e Pipeline.required (Query.string \"refresh_token\")\n\n\n\n```\n\nExamples where: `parseCallbackUrl : String -\u003e Maybe AuthCallback`\n\n```elm\nparseCallbackUrl \"/?user_id=1\u0026id_token=abc\u0026id_token_expires_at=123\u0026refresh_token=bca\"\n    == Just\n          { userId = 1\n          , userName = Nothing\n          , idToken = \"abc\"\n          , idTokenExpiresAt = 123\n          , refreshToken = \"bca\"\n          }\n\nparseCallbackUrl \"/?id_token=abc\u0026refresh_token=bca\"\n    == Nothing\n```\n\n## Why?\n\nParsing many url query params can get messy, particularly if you have a mixture of optional and required values where\nthe data you need doesn't make sense without them:\n\ne.g. the same query from above without pipelines:\n\n```elm\nimport Url.Parser.Query as Query -- from elm/url\n\n\ntype alias AuthCallback =\n    { userId : Int\n    , userName : Maybe String\n    , idToken : String\n    , idTokenExpiresAt : Int\n    , refreshToken : String\n    }\n\n\nauthCallbackQueryOld : Query.Parser (Maybe AuthCallback)\nauthCallbackQueryOld =\n    Query.map5\n        (\\maybeUserId userName maybeIdToken maybeIdTokenExpiresAt maybeRefreshToken -\u003e\n            Maybe.map4\n                (\\userId idToken idTokenExpiresAt refreshToken -\u003e\n                    { userId = userId\n                    , userName = userName\n                    , idToken = idToken\n                    , idTokenExpiresAt = idTokenExpiresAt\n                    , refreshToken = refreshToken\n                    }\n                )\n                maybeUserId\n                maybeIdToken\n                maybeIdTokenExpiresAt\n                maybeRefreshToken\n        )\n        (Query.int \"user_id\")\n        (Query.string \"user_name\")\n        (Query.string \"id_token\")\n        (Query.int \"id_token_expires_at\")\n        (Query.string \"refresh_token\")\n\n```\n\n## Why is the output `Maybe MyQuery`?\n\n`elm/url`'s [Query Parsers](https://package.elm-lang.org/packages/elm/url/latest/Url-Parser-Query) all return `Maybe a`.\n\nThe `Pipeline` functions is also `Maybe a` to maintain compatibility with `elm/url`.\n\n## How?\n\ninstall package and `elm/url` using\n\n```shell\nelm install elm/url\n```\n\n```shell\nelm install andrewMacmurray/elm-url-query-pipeline\n```\n\nUse with your regular `elm/url` parsers\n\n```elm\nimport Url exposing (Url)\nimport Url.Parser as Parser exposing ((\u003c?\u003e), s, top)\nimport Url.Parser.Query as Query\nimport Url.Query.Pipeline as Pipeline\n\n\ntype Route\n    = Home (Maybe MyQuery)\n    | AnotherRoute\n\n\ntype alias MyQuery =\n    { one : String\n    , two : Maybe String\n    , three : List Int\n    }\n\n\nquery : Query.Parser (Maybe MyQuery)\nquery =\n    Pipeline.succeed MyQuery\n        |\u003e Pipeline.required (Query.string \"one\")\n        |\u003e Pipeline.optional (Query.string \"two\")\n        |\u003e Pipeline.with (Query.custom \"three\" (List.filterMap String.toInt))\n\n\nroutes : Parser.Parser (Route -\u003e a) a\nroutes =\n    Parser.oneOf\n        [ Parser.map Home (top \u003c?\u003e query)\n        , Parser.map AnotherRoute (s \"another-route\")\n        ]\n\n\nfromString : String -\u003e Maybe Route\nfromString =\n    Url.fromString \u003e\u003e Maybe.andThen (Parser.parse routes)\n\n```\n\nSome examples from above:\n\n```elm\nfromString \"http://example/another-route\" == Just AnotherRoute\n\nfromString \"http://example?one=hello\u0026two=world\u0026three=1\u0026three=2\"\n    == Just\n        (Home\n            (Just\n                { one = \"hello\"\n                , two = Just \"world\"\n                , three = [ 1, 2 ]\n                }\n            )\n        )\n```\n\n## Develop Locally\n\ninstall dependencies:\n\n```shell\nnpm install\n```\n\nrun the tests:\n\n```shell\nnpm test\n```\n\npreview the docs:\n\n```shell\nnpm run docs\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewmacmurray%2Felm-url-query-pipeline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewmacmurray%2Felm-url-query-pipeline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewmacmurray%2Felm-url-query-pipeline/lists"}