A Haskell miso client library for supabase. This is a Haskell front-end library, meant for use with the JS, or Web Assembly backend with GHC.
Warning
This is a work in-progress, many things are not implemented. Please consider contributing.
For local development with miso you can include supabase as a JavaScript module.
----------------------------------------------------------------------------- {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} ----------------------------------------------------------------------------- module Main (main) where ----------------------------------------------------------------------------- import Supabase.Miso.Auth ----------------------------------------------------------------------------- main :: IO () main = run $ startApp myComponent { scripts = [ Module """ import { createClient } from 'https://cdn.jsdelivr.net/npm/@supabase/supabase-js/+esm' const supabase = createClient('https://<app-id>.supabase.co', '<anon-key>'); globalThis['supabase'] = supabase; console.log('Supabase Instance: ', supabase) """ ] } ----------------------------------------------------------------------------- data Action = SuccessfullyRegistered AuthResponse | ErrorRegistering MisoString | NewUserWithEmail SignUpEmail | NewUserWithPhone SignUpPhone deriving (Show, Eq) ----------------------------------------------------------------------------- update :: Action -> Effect parent model Action update = \case SuccessfullyRegistered response -> io_ $ do consoleLog "success" consoleLog $ ms (show response) ErrorRegistering errorMessage -> io_ (consoleError errorMessage) NewUserWithEmail email -> signUpEmail email SuccessfullyRegistered ErrorRegistering NewUserWithPhone phone -> signUpPhone email SuccessfullyRegistered ErrorRegistering -----------------------------------------------------------------------------$ cabal build- Create a new user
- Listen to auth events
- Create an anonymous user
- Sign in a user
- Sign in with ID Token
- Sign in a user through OTP
- Sign in a user through OAuth
- Sign in a user through SSO
- Get user claims from verified JWT
- Sign out a user
- Send a password reset request
- Verify and log in through OTP
- Retrieve a session
- Retrieve a new session
- Retrieve a user
- Update a user
- Retrieve identities linked to a user
- Link an identity to a user
- Unlink an identity from a user
- Send a password reauthentication nonce
- Resend an OTP
- Set the session data
- Exchange an auth code for a session
- Start auto-refresh session (non-browser)
- Stop auto-refresh session (non-browser)
- Subscribe to channel
- Unsubscribe from a channel
- Unsubscribe from all channels
- Retrieve all channels
- Broadcast a message
- Create a bucket
- Retrieve a bucket
- List all buckets
- Update a bucket
- Delete a bucket
- Empty a bucket
- Upload a file
- Download a file
- List all files in a bucket
- Replace an existing file
- Move an existing file
- Copy an existing file
- Delete files in a bucket
- Create a signed URL
- Create signed URLs
- Create signed upload URL
- Upload to a signed URL
- Retrieve public URL