Skip to content

Commit

Permalink
upgrade gleam
Browse files Browse the repository at this point in the history
  • Loading branch information
dmmulroy committed Aug 24, 2024
1 parent 843ebc6 commit 37fd0b7
Show file tree
Hide file tree
Showing 16 changed files with 99 additions and 170 deletions.
36 changes: 15 additions & 21 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 3 additions & 20 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,10 @@
imports = [];
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
perSystem = { config, self', inputs', pkgs, system, ... }:
let pkgs' = inputs'.nixpkgs_master.legacyPackages.extend (self: super: {
gleam = super.stdenv.mkDerivation rec {
name = "gleam";
version = "1.1.0";
src = super.fetchurl {
url = "https://github.com/gleam-lang/gleam/releases/download/v${version}/gleam-v${version}-aarch64-apple-darwin.tar.gz";
sha256 = "sha256-Lf0rvZeGpd0+RqX9d9Tz/eFAYXwmLJ1md/+3aNCc7kY=";
};
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out/bin
tar -xvf $src -C $out/bin
chmod +x $out/bin/gleam
'';
};
});
in
{
{
devShells = {
default = pkgs'.mkShell {
buildInputs = with pkgs'; [gleam erlang_26 rebar3 bun];
default = pkgs.mkShell {
buildInputs = with pkgs; [gleam erlang_27 rebar3 bun];
};
};
};
Expand Down
17 changes: 9 additions & 8 deletions gleam.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name = "glitch"
version = "0.0.6"
gleam = ">= 0.32.0"

# Fill out these fields if you intend to generate HTML documentation or publish
# your project to the Hex package manager.
Expand All @@ -13,18 +14,18 @@ version = "0.0.6"
# https://gleam.run/writing-gleam/gleam-toml/.

[dependencies]
gleam_stdlib = "~> 0.34 or ~> 1.0"
gleam_stdlib = "~> 0.40.0"
logging = "~> 1.0"
gleam_json = "~> 1.0"
gleam_httpc = "~> 2.1"
gleam_http = "~> 3.5"
gleam_json = "~> 2.0"
gleam_httpc = "~> 2.2"
gleam_http = "~> 3.6"
dot_env = "~> 0.2"
gleam_otp = "~> 0.10"
mist = "~> 1.0"
gleam_otp = "~> 0.11"
mist = "~> 2.0"
gleam_erlang = "~> 0.25"
shellout = "~> 1.6"
prng = "~> 3.0"
stratus = "~> 0.5"
stratus = "~> 0.9"

[dev-dependencies]
gleeunit = "~> 1.0"
gleeunit = "~> 1.2"
38 changes: 19 additions & 19 deletions manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,42 @@
# You typically do not need to edit this file

packages = [
{ name = "birl", version = "1.6.1", build_tools = ["gleam"], requirements = ["gleam_stdlib", "ranger"], otp_app = "birl", source = "hex", outer_checksum = "976CFF85D34D50F7775896615A71745FBE0C325E50399787088F941B539A0497" },
{ name = "birl", version = "1.7.1", build_tools = ["gleam"], requirements = ["gleam_stdlib", "ranger"], otp_app = "birl", source = "hex", outer_checksum = "5C66647D62BCB11FE327E7A6024907C4A17954EF22865FE0940B54A852446D01" },
{ name = "dot_env", version = "0.5.1", build_tools = ["gleam"], requirements = ["gleam_stdlib", "simplifile"], otp_app = "dot_env", source = "hex", outer_checksum = "AF5C972D6129F67AF3BB00134AB2808D37111A8D61686CFA86F3ADF652548982" },
{ name = "filepath", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "EFB6FF65C98B2A16378ABC3EE2B14124168C0CE5201553DE652E2644DCFDB594" },
{ name = "gleam_bitwise", version = "1.3.1", build_tools = ["gleam"], requirements = [], otp_app = "gleam_bitwise", source = "hex", outer_checksum = "B36E1D3188D7F594C7FD4F43D0D2CE17561DE896202017548578B16FE1FE9EFC" },
{ name = "gleam_crypto", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_crypto", source = "hex", outer_checksum = "ADD058DEDE8F0341F1ADE3AAC492A224F15700829D9A3A3F9ADF370F875C51B7" },
{ name = "gleam_erlang", version = "0.25.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "054D571A7092D2A9727B3E5D183B7507DAB0DA41556EC9133606F09C15497373" },
{ name = "gleam_http", version = "3.6.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_http", source = "hex", outer_checksum = "8C07DF9DF8CC7F054C650839A51C30A7D3C26482AC241C899C1CEA86B22DBE51" },
{ name = "gleam_httpc", version = "2.2.0", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_stdlib"], otp_app = "gleam_httpc", source = "hex", outer_checksum = "CF76C71002DEECF6DC5D9CA83D962728FAE166B57926BE442D827004D3C7DF1B" },
{ name = "gleam_json", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "thoas"], otp_app = "gleam_json", source = "hex", outer_checksum = "8B197DD5D578EA6AC2C0D4BDC634C71A5BCA8E7DB5F47091C263ECB411A60DF3" },
{ name = "gleam_otp", version = "0.10.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "0B04FE915ACECE539B317F9652CAADBBC0F000184D586AAAF2D94C100945D72B" },
{ name = "gleam_stdlib", version = "0.37.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "5398BD6C2ABA17338F676F42F404B9B7BABE1C8DC7380031ACB05BBE1BCF3742" },
{ name = "gleeunit", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "72CDC3D3F719478F26C4E2C5FED3E657AC81EC14A47D2D2DEBB8693CA3220C3B" },
{ name = "glisten", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_otp", "gleam_stdlib"], otp_app = "glisten", source = "hex", outer_checksum = "CF3A9383E9BA4A8CBAF2F7B799716290D02F2AC34E7A77556B49376B662B9314" },
{ name = "gramps", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_crypto", "gleam_http", "gleam_stdlib"], otp_app = "gramps", source = "hex", outer_checksum = "E4E6C0DB2A0527570DF3080706976BE47DEAABC4A7F57C9FE436FF619C27DC9E" },
{ name = "gleam_json", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "CB10B0E7BF44282FB25162F1A24C1A025F6B93E777CCF238C4017E4EEF2CDE97" },
{ name = "gleam_otp", version = "0.11.2", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "517FFB679E44AD71D059F3EF6A17BA6EFC8CB94FA174D52E22FB6768CF684D78" },
{ name = "gleam_stdlib", version = "0.40.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "86606B75A600BBD05E539EB59FABC6E307EEEA7B1E5865AFB6D980A93BCB2181" },
{ name = "gleeunit", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "F7A7228925D3EE7D0813C922E062BFD6D7E9310F0BEE585D3A42F3307E3CFD13" },
{ name = "glisten", version = "5.0.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_otp", "gleam_stdlib", "logging", "telemetry"], otp_app = "glisten", source = "hex", outer_checksum = "48EF7F6D1DCA877C2F49AF35CC33946C7129EEB05A114758A2CC569C708BFAF8" },
{ name = "gramps", version = "2.0.3", build_tools = ["gleam"], requirements = ["gleam_crypto", "gleam_erlang", "gleam_http", "gleam_stdlib"], otp_app = "gramps", source = "hex", outer_checksum = "3CCAA6E081225180D95C79679D383BBF51C8D1FDC1B84DA1DA444F628C373793" },
{ name = "hpack_erl", version = "0.3.0", build_tools = ["rebar3"], requirements = [], otp_app = "hpack", source = "hex", outer_checksum = "D6137D7079169D8C485C6962DFE261AF5B9EF60FBC557344511C1E65E3D95FB0" },
{ name = "logging", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "logging", source = "hex", outer_checksum = "82C112ED9B6C30C1772A6FE2613B94B13F62EA35F5869A2630D13948D297BD39" },
{ name = "mist", version = "1.0.0", build_tools = ["gleam"], requirements = ["birl", "gleam_erlang", "gleam_http", "gleam_otp", "gleam_stdlib", "glisten", "hpack_erl", "logging"], otp_app = "mist", source = "hex", outer_checksum = "7765E53DCC9ACCACF217B8E0CA3DE7E848C783BFAE5118B75011E81C2C80385C" },
{ name = "logging", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "logging", source = "hex", outer_checksum = "1098FBF10B54B44C2C7FDF0B01C1253CAFACDACABEFB4B0D027803246753E06D" },
{ name = "mist", version = "2.0.0", build_tools = ["gleam"], requirements = ["birl", "gleam_erlang", "gleam_http", "gleam_otp", "gleam_stdlib", "glisten", "gramps", "hpack_erl", "logging"], otp_app = "mist", source = "hex", outer_checksum = "981F12FC8BA0656B40099EC876D6F2BEE7B95593610F342E9AB0DC4E663A932F" },
{ name = "prng", version = "3.0.3", build_tools = ["gleam"], requirements = ["gleam_bitwise", "gleam_stdlib"], otp_app = "prng", source = "hex", outer_checksum = "53006736FE23A0F61828C95B505193E10905D8DB76E128F1642D3E571E08F589" },
{ name = "ranger", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "ranger", source = "hex", outer_checksum = "1566C272B1D141B3BBA38B25CB761EF56E312E79EC0E2DFD4D3C19FB0CC1F98C" },
{ name = "shellout", version = "1.6.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "shellout", source = "hex", outer_checksum = "E2FCD18957F0E9F67E1F497FC9FF57393392F8A9BAEAEA4779541DE7A68DD7E0" },
{ name = "simplifile", version = "1.7.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "1D5DFA3A2F9319EC85825F6ED88B8E449F381B0D55A62F5E61424E748E7DDEB0" },
{ name = "stratus", version = "0.5.0", build_tools = ["gleam"], requirements = ["gleam_crypto", "gleam_erlang", "gleam_http", "gleam_otp", "gleam_stdlib", "gramps", "logging"], otp_app = "stratus", source = "hex", outer_checksum = "09DD25B2D59B0387159081C0456765178922AACCB4F0F0BB0F84371B12CD8D1F" },
{ name = "thoas", version = "0.4.1", build_tools = ["rebar3"], requirements = [], otp_app = "thoas", source = "hex", outer_checksum = "4918D50026C073C4AB1388437132C77A6F6F7C8AC43C60C13758CC0ADCE2134E" },
{ name = "stratus", version = "0.9.2", build_tools = ["gleam"], requirements = ["gleam_crypto", "gleam_erlang", "gleam_http", "gleam_otp", "gleam_stdlib", "gramps", "logging"], otp_app = "stratus", source = "hex", outer_checksum = "BC4125B762A1DA4B02EA851EE013909373184EC2B5B023EB79CD256AC2A883E4" },
{ name = "telemetry", version = "1.3.0", build_tools = ["rebar3"], requirements = [], otp_app = "telemetry", source = "hex", outer_checksum = "7015FC8919DBE63764F4B4B87A95B7C0996BD539E0D499BE6EC9D7F3875B79E6" },
]

[requirements]
dot_env = { version = "~> 0.2" }
gleam_erlang = { version = "~> 0.25" }
gleam_http = { version = "~> 3.5" }
gleam_httpc = { version = "~> 2.1" }
gleam_json = { version = "~> 1.0" }
gleam_otp = { version = "~> 0.10" }
gleam_stdlib = { version = "~> 0.34 or ~> 1.0" }
gleeunit = { version = "~> 1.0" }
gleam_http = { version = "~> 3.6" }
gleam_httpc = { version = "~> 2.2" }
gleam_json = { version = "~> 2.0" }
gleam_otp = { version = "~> 0.11" }
gleam_stdlib = { version = "~> 0.40.0" }
gleeunit = { version = "~> 1.2" }
logging = { version = "~> 1.0" }
mist = { version = "~> 1.0" }
mist = { version = "~> 2.0" }
prng = { version = "~> 3.0" }
shellout = { version = "~> 1.6" }
stratus = { version = "~> 0.5" }
stratus = { version = "~> 0.9" }
5 changes: 2 additions & 3 deletions src/glitch/api/api.gleam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import gleam/result
import gleam/httpc
import gleam/result
import glitch/api/api_request.{type TwitchApiRequest}
import glitch/api/api_response.{type TwitchApiResponse}
import glitch/error.{type TwitchError, RequestError}
Expand All @@ -10,7 +10,6 @@ pub fn send(
request
|> api_request.to_http_request
|> httpc.send
|> result.map_error(RequestError)
// TODO: Consider the Error type
|> result.map(api_response.of_http_response)
|> result.map_error(RequestError)
}
4 changes: 2 additions & 2 deletions src/glitch/api/auth.gleam
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import gleam/dynamic.{type Dynamic}
import gleam/http.{Get, Post}
import gleam/result
import gleam/uri.{type Uri}
import gleam/http.{Get, Post}
import glitch/api/api
import glitch/api/api_response
import glitch/api/api_request
import glitch/api/api_response
import glitch/error.{type TwitchError, AuthError, InvalidGetTokenRequest}
import glitch/types/access_token.{type AccessToken}
import glitch/types/grant.{
Expand Down
4 changes: 2 additions & 2 deletions src/glitch/api/client.gleam
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import gleam/result
import gleam/http.{type Header, Get, Post}
import gleam/result
import glitch/api/api
import glitch/api/api_request.{type TwitchApiRequest}
import glitch/api/api_response.{type TwitchApiResponse}
import glitch/auth/auth_provider.{type AuthProvider}
import glitch/types/access_token.{type AccessToken}
import glitch/error.{type TwitchError}
import glitch/types/access_token.{type AccessToken}

pub opaque type Client {
Client(auth_provider: AuthProvider)
Expand Down
6 changes: 3 additions & 3 deletions src/glitch/api/user.gleam
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import gleam/dynamic.{type Decoder}
import gleam/json.{type DecodeError, type Json}
import gleam/list
import gleam/option.{type Option}
import gleam/result
import gleam/uri.{type Uri}
import gleam/json.{type DecodeError, type Json}
import glitch/api/client.{type Client}
import glitch/api/api_request
import glitch/api/api_response
import glitch/api/client.{type Client}
import glitch/error.{type TwitchError}
import glitch/extended/dynamic_ext
import glitch/extended/json_ext
import glitch/error.{type TwitchError}

pub type User {
User(
Expand Down
2 changes: 1 addition & 1 deletion src/glitch/auth/auth_provider.gleam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import gleam/result
import gleam/option.{type Option, None, Some}
import gleam/result
import glitch/api/auth.{type GetTokenRequest}
import glitch/error.{
type AuthError, type TwitchError, AccessTokenExpired, AuthError,
Expand Down
12 changes: 6 additions & 6 deletions src/glitch/auth/redirect_server.gleam
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import gleam/bytes_builder
import gleam/list
import gleam/option.{type Option, None, Some}
import gleam/result
import gleam/uri.{type Uri}
import gleam/erlang/process.{type Subject}
import gleam/http.{Get}
import gleam/http/request.{type Request, Request}
import gleam/http/response.{type Response}
import gleam/erlang/process.{type Subject}
import gleam/otp/supervisor.{type Message as SupervisorMessage}
import gleam/list
import gleam/option.{type Option, None, Some}
import gleam/otp/actor.{type StartError}
import gleam/otp/supervisor.{type Message as SupervisorMessage}
import gleam/result
import gleam/uri.{type Uri}
import mist.{type Connection, type ResponseData}

pub opaque type RedirectServer {
Expand Down
20 changes: 10 additions & 10 deletions src/glitch/auth/token_fetcher.gleam
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import gleam/bit_array
import gleam/erlang/os
import gleam/erlang/process.{type Subject}
import gleam/function
import gleam/list
import gleam/option.{type Option, None, Some}
import gleam/otp/actor
import gleam/pair
import gleam/result
import gleam/string
import gleam/uri.{type Uri, Uri}
import gleam/option.{type Option, None, Some}
import gleam/result
import gleam/erlang/os
import gleam/erlang/process.{type Subject}
import gleam/otp/actor
import prng/random
import prng/seed
import shellout
import glitch/auth/redirect_server
import glitch/api/auth
import glitch/auth/redirect_server
import glitch/error.{
type AuthError, type TwitchError, AuthError, TokenFetcherFetchError,
TokenFetcherStartError,
}
import glitch/extended/uri_ext
import glitch/types/access_token.{type AccessToken}
import glitch/types/scope.{type Scope}
import glitch/extended/uri_ext
import prng/random
import prng/seed
import shellout

const base_authorization_uri = Uri(
Some("https"),
Expand Down
2 changes: 1 addition & 1 deletion src/glitch/extended/json_ext.gleam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import gleam/json.{type DecodeError, type Json}
import gleam/option.{type Option}
import gleam/uri.{type Uri}
import gleam/json.{type DecodeError, type Json}

pub type JsonDecoder(input, output) =
fn(input) -> Result(output, DecodeError)
Expand Down
4 changes: 2 additions & 2 deletions src/glitch/extended/request_ext.gleam
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import gleam/http.{type Header}
import gleam/http/request.{type Request, Request}
import gleam/list
import gleam/option.{type Option}
import gleam/string
import gleam/http.{type Header}
import gleam/http/request.{type Request, Request}

pub fn merge_headers(
request: Request(data),
Expand Down
2 changes: 1 addition & 1 deletion src/glitch/extended/uri_ext.gleam
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import gleam/http.{type Scheme}
import gleam/list
import gleam/option.{None, Some}
import gleam/string
import gleam/uri.{type Uri, Uri}
import gleam/http.{type Scheme}

const empty = Uri(
scheme: None,
Expand Down
2 changes: 1 addition & 1 deletion src/glitch/types/access_token.gleam
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import gleam/dynamic.{type Decoder, type Dynamic}
import gleam/erlang
import gleam/option.{type Option}
import gleam/result
import gleam/erlang
import glitch/error.{type TwitchError, AuthError, InvalidAccessToken}
import glitch/types/scope.{type Scope}

Expand Down
Loading

0 comments on commit 37fd0b7

Please sign in to comment.