initial commit - bus funcs

This commit is contained in:
projectmoon 2024-04-09 23:05:05 +02:00
commit 2372ac0dd9
8 changed files with 434 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.env
supabase/.temp
supabase/.branches

163
supabase/config.toml Normal file
View File

@ -0,0 +1,163 @@
# A string used to distinguish different Supabase projects on the same host. Defaults to the
# working directory name when running `supabase init`.
project_id = "jokullbase"
[api]
enabled = true
# Port to use for the API URL.
port = 54321
# Schemas to expose in your API. Tables, views and stored procedures in this schema will get API
# endpoints. public and storage are always included.
schemas = ["public", "storage", "graphql_public"]
# Extra schemas to add to the search_path of every request. public is always included.
extra_search_path = ["public", "extensions"]
# The maximum number of rows returns from a view, table, or stored procedure. Limits payload size
# for accidental or malicious requests.
max_rows = 1000
[db]
# Port to use for the local database URL.
port = 54322
# Port used by db diff command to initialize the shadow database.
shadow_port = 54320
# The database major version to use. This has to be the same as your remote database's. Run `SHOW
# server_version;` on the remote database to check.
major_version = 15
[db.pooler]
enabled = false
# Port to use for the local connection pooler.
port = 54329
# Specifies when a server connection can be reused by other clients.
# Configure one of the supported pooler modes: `transaction`, `session`.
pool_mode = "transaction"
# How many server connections to allow per user/database pair.
default_pool_size = 20
# Maximum number of client connections allowed.
max_client_conn = 100
[realtime]
enabled = true
# Bind realtime via either IPv4 or IPv6. (default: IPv6)
# ip_version = "IPv6"
# The maximum length in bytes of HTTP request headers. (default: 4096)
# max_header_length = 4096
[studio]
enabled = true
# Port to use for Supabase Studio.
port = 54323
# External URL of the API server that frontend connects to.
api_url = "http://127.0.0.1"
# OpenAI API Key to use for Supabase AI in the Supabase Studio.
openai_api_key = "env(OPENAI_API_KEY)"
# Email testing server. Emails sent with the local dev setup are not actually sent - rather, they
# are monitored, and you can view the emails that would have been sent from the web interface.
[inbucket]
enabled = true
# Port to use for the email testing server web interface.
port = 54324
# Uncomment to expose additional ports for testing user applications that send emails.
# smtp_port = 54325
# pop3_port = 54326
[storage]
enabled = true
# The maximum file size allowed (e.g. "5MB", "500KB").
file_size_limit = "50MiB"
[auth]
enabled = true
# The base URL of your website. Used as an allow-list for redirects and for constructing URLs used
# in emails.
site_url = "http://127.0.0.1:3000"
# A list of *exact* URLs that auth providers are permitted to redirect to post authentication.
additional_redirect_urls = ["https://127.0.0.1:3000"]
# How long tokens are valid for, in seconds. Defaults to 3600 (1 hour), maximum 604,800 (1 week).
jwt_expiry = 3600
# If disabled, the refresh token will never expire.
enable_refresh_token_rotation = true
# Allows refresh tokens to be reused after expiry, up to the specified interval in seconds.
# Requires enable_refresh_token_rotation = true.
refresh_token_reuse_interval = 10
# Allow/disallow new user signups to your project.
enable_signup = true
# Allow/disallow anonymous sign-ins to your project.
enable_anonymous_sign_ins = false
# Allow/disallow testing manual linking of accounts
enable_manual_linking = false
[auth.email]
# Allow/disallow new user signups via email to your project.
enable_signup = true
# If enabled, a user will be required to confirm any email change on both the old, and new email
# addresses. If disabled, only the new email is required to confirm.
double_confirm_changes = true
# If enabled, users need to confirm their email address before signing in.
enable_confirmations = false
# Uncomment to customize email template
# [auth.email.template.invite]
# subject = "You have been invited"
# content_path = "./supabase/templates/invite.html"
[auth.sms]
# Allow/disallow new user signups via SMS to your project.
enable_signup = true
# If enabled, users need to confirm their phone number before signing in.
enable_confirmations = false
# Template for sending OTP to users
template = "Your code is {{ .Code }} ."
# Use pre-defined map of phone number to OTP for testing.
[auth.sms.test_otp]
# 4152127777 = "123456"
# This hook runs before a token is issued and allows you to add additional claims based on the authentication method used.
[auth.hook.custom_access_token]
# enabled = true
# uri = "pg-functions://<database>/<schema>/<hook_name>"
# Configure one of the supported SMS providers: `twilio`, `twilio_verify`, `messagebird`, `textlocal`, `vonage`.
[auth.sms.twilio]
enabled = false
account_sid = ""
message_service_sid = ""
# DO NOT commit your Twilio auth token to git. Use environment variable substitution instead:
auth_token = "env(SUPABASE_AUTH_SMS_TWILIO_AUTH_TOKEN)"
# Use an external OAuth provider. The full list of providers are: `apple`, `azure`, `bitbucket`,
# `discord`, `facebook`, `github`, `gitlab`, `google`, `keycloak`, `linkedin_oidc`, `notion`, `twitch`,
# `twitter`, `slack`, `spotify`, `workos`, `zoom`.
[auth.external.apple]
enabled = false
client_id = ""
# DO NOT commit your OAuth provider secret to git. Use environment variable substitution instead:
secret = "env(SUPABASE_AUTH_EXTERNAL_APPLE_SECRET)"
# Overrides the default auth redirectUrl.
redirect_uri = ""
# Overrides the default auth provider URL. Used to support self-hosted gitlab, single-tenant Azure,
# or any other third-party OIDC providers.
url = ""
[analytics]
enabled = false
port = 54327
vector_port = 54328
# Configure one of the supported backends: `postgres`, `bigquery`.
backend = "postgres"
# Experimental features may be deprecated any time
[experimental]
# Configures Postgres storage engine to use OrioleDB (S3)
orioledb_version = ""
# Configures S3 bucket URL, eg. <bucket_name>.s3-<region>.amazonaws.com
s3_host = "env(S3_HOST)"
# Configures S3 bucket region, eg. us-east-1
s3_region = "env(S3_REGION)"
# Configures AWS_ACCESS_KEY_ID for S3 bucket
s3_access_key = "env(S3_ACCESS_KEY)"
# Configures AWS_SECRET_ACCESS_KEY for S3 bucket
s3_secret_key = "env(S3_SECRET_KEY)"

View File

@ -0,0 +1,2 @@
((typescript-ts-mode . ((lsp-disabled-clients . (ts-ls)))))
((typescript-tsx-mode . ((lsp-disabled-clients . (ts-ls)))))

View File

@ -0,0 +1,7 @@
{
"imports": {
// The dollar sign in front of "std" isn't special - it's an optional
// convention to show that $std is an alias set up in an import map
"$std/": "https://deno.land/std@0.221.0/"
}
}

View File

@ -0,0 +1,155 @@
{
"version": "3",
"redirects": {
"https://deno.land/x/base64/base64url.ts": "https://deno.land/x/base64@v0.2.1/base64url.ts"
},
"remote": {
"https://deno.land/std@0.177.0/async/abortable.ts": "73acfb3ed7261ce0d930dbe89e43db8d34e017b063cf0eaa7d215477bf53442e",
"https://deno.land/std@0.177.0/async/deadline.ts": "c5facb0b404eede83e38bd2717ea8ab34faa2ffb20ef87fd261fcba32ba307aa",
"https://deno.land/std@0.177.0/async/debounce.ts": "adab11d04ca38d699444ac8a9d9856b4155e8dda2afd07ce78276c01ea5a4332",
"https://deno.land/std@0.177.0/async/deferred.ts": "42790112f36a75a57db4a96d33974a936deb7b04d25c6084a9fa8a49f135def8",
"https://deno.land/std@0.177.0/async/delay.ts": "73aa04cec034c84fc748c7be49bb15cac3dd43a57174bfdb7a4aec22c248f0dd",
"https://deno.land/std@0.177.0/async/mod.ts": "f04344fa21738e5ad6bea37a6bfffd57c617c2d372bb9f9dcfd118a1b622e576",
"https://deno.land/std@0.177.0/async/mux_async_iterator.ts": "70c7f2ee4e9466161350473ad61cac0b9f115cff4c552eaa7ef9d50c4cbb4cc9",
"https://deno.land/std@0.177.0/async/pool.ts": "fd082bd4aaf26445909889435a5c74334c017847842ec035739b4ae637ae8260",
"https://deno.land/std@0.177.0/async/retry.ts": "5efa3ba450ac0c07a40a82e2df296287b5013755d232049efd7ea2244f15b20f",
"https://deno.land/std@0.177.0/async/tee.ts": "47e42d35f622650b02234d43803d0383a89eb4387e1b83b5a40106d18ae36757",
"https://deno.land/std@0.177.0/http/server.ts": "cbb17b594651215ba95c01a395700684e569c165a567e4e04bba327f41197433",
"https://deno.land/x/base64@v0.2.1/base.ts": "47dc8d68f07dc91524bdd6db36eccbe59cf4d935b5fc09f27357a3944bb3ff7b",
"https://deno.land/x/base64@v0.2.1/base64url.ts": "18bbf879b31f1f32cca8adaa2b6885ae325c2cec6a66c5817b684ca12c46ad5e",
"https://deno.land/x/sha1@v1.0.3/deps.ts": "2e1af51a48c8507017fdb057b950366601b177fb7e73d5de54c1b3e0e115d72e",
"https://deno.land/x/sha1@v1.0.3/mod.ts": "146a101c9776cc9c807053c93f23e4b321ade5251f65745df418f4a75d5fd27b",
"https://deno.land/x/upstash_redis@v1.19.3/mod.ts": "f1a992becfa0885c41706cfed6ba7c97fc8b87662d2f5161559629694b5bcb56",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/append.ts": "7c1612a3a5543926afb8dd3ca8086e5d7ef5c3dcbda0ca30eb720259e707f651",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/bitcount.ts": "8efbd9bfa25a58daf0773adaf00f7ae2c6a7a6a621f11158c53bcfe88d12b255",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/bitop.ts": "dcaa11a96429b0fb5595a63967f7e8751683785a0baba87d7aa027df03fcd06e",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/bitpos.ts": "2c74aa14054407f66a12764f9cd2a3ca16a5d4f4f59c70815274362c015aa428",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/command.ts": "7447816c249ca1be25a542d39bb24b90023ed7acaf91cc47a7f86ed0f055255a",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/dbsize.ts": "7509e8630675755e82d7294a556466f1b36cb3caf3829f836b25cdb7cf95e404",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/decr.ts": "3ee6c714f01b12f9fa9bd755d99b098f7c7b42c50ff1589e6c47ccb720fef3c2",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/decrby.ts": "1abe00bb7a8f935413dd3a5030d94df1761cd44c0bcffa5caa641f8e32d0961f",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/del.ts": "898bf42c3f758bae1d3d2a9d9ac82e1fdfdf72179caa65fd8c42ebe191db6cea",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/echo.ts": "8bcb79701c8fe9439c2fd92f0a83d5db663c8e084da65c8cbb851a071b8c8bb6",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/eval.ts": "99d740003e7769e26f5511896f65a57ee4c987ec875b744cefe1f2522cfd2c05",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/evalsha.ts": "da213bf79e83b6895dc8805dc033e00fa357f95728fef87ab7e066d0aa0683d3",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/exists.ts": "96310238f26a8569a0100a36f2dc2bc60de371736fe723809ceb4c49c8a6cc74",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/expire.ts": "f9ea57ea9e3c801c1f628d74f55337cf04f9184c8f3e75f55528dee29c881fad",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/expireat.ts": "ec738e5cca59c56b0d43e564ef16951cdda963b4849850ced1df3ba62596994c",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/flushall.ts": "365876a9cfe254286da033f275ac4a0d11349c96cacd1461f0d3c23b07957ac6",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/flushdb.ts": "369e628d24ce41ba6c0518a955c48e2a9359dd4b831d7211fc8d0621ccfc0af7",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/get.ts": "ef4968bc57ffc5826d178f56bdade982b6d93ab875d2bb516363beefef52fc59",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/getbit.ts": "c29aec972672a1827796a2b4419ccc5b91d8d080fd237eb2b1cc4cdd88d2967b",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/getdel.ts": "b2caaffdf46957769c2c278e637cf8d8f1a594e4747a0bb7ef0155e1b121754d",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/getrange.ts": "65deab3bd5ea316693fb966912ba4a1114c619c2a1d00b72599e40c532456481",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/getset.ts": "df7ded3779f9faf329c2023097db901302aaeece7bde0691ae61ea1daf967b39",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/hdel.ts": "e777b005f41ee3078593dddf89d72275af7a66050fcc7ed93221caffd9a71810",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/hexists.ts": "4f96fcdf8b15a982922b6bf9cfa9fc891582b5da9b0eb9d92a9eb13594c99048",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/hget.ts": "5566c8e0a0f9ecdb9e65a66cfc740d224c90d9a172558361abc180c1dc2e9522",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/hgetall.ts": "64b7edc984a385ef64e046e4761e83dbfb460c310893b02e9ef7390a1ca30bd5",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/hincrby.ts": "d112a0bf6de6ee49ef43053687f263b300cd6ff8da999299b423906ce9e06b3c",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/hincrbyfloat.ts": "e22c06c24fbaa51849938e65e89daca9e77a95229154c1a99a9514124ad057ef",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/hkeys.ts": "516edcd187a3d5387201db43adacfe029fe87d687224e46d3fa5694fd01c07ba",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/hlen.ts": "2b1e8c671706e32f83246cf94e828e5e6d8c3c39373ce4c27fee41bc3b239bc1",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/hmget.ts": "2ee9bfe03982411fb0b1f58be7332b44afe38906c3e9d90ac35ba2e0e14ac8ec",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/hmset.ts": "c9388d874f8825be5b3f2c991b46686b942df35b6abd39bcdb2a829c6348f905",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/hrandfield.ts": "1128cea1d732b99e8993a2ad472f654d77829e31de0f2fbd0143dfbe793a01f2",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/hscan.ts": "5297cf93d7231494456fcd0318fbea916aa7338dc19d442a787426834390e5c0",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/hset.ts": "ebb77f26c642ea9791402c08aaf8149e66f035122b971bcb07de403187e95291",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/hsetnx.ts": "4e51c84029d748cd56374d02b6fadb58b372b6274723c89505454c874a4a764c",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/hstrlen.ts": "9fd3e3ff9dda9fd1592f24c08e30224f905a76de057099d848dd1c5e7c3fdc3d",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/hvals.ts": "a8dc9595641af7aa9eabdeab2b4dc6d08ce6de28491c44d0154f547fbea0a212",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/incr.ts": "1cdbddd6d29bec792f0ba8f435cbdced660d7f23d87a444c850e5d4c400cc398",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/incrby.ts": "ccbaae06a96987ddeba48ac999e3274c63f37fc5d2ee8de4780c8845b3829a55",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/incrbyfloat.ts": "07e87c6ca61dfb5220df723f8f6d442a7b0878586bf765914f45998269432e5d",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/keys.ts": "36dd4074c17d59b8913679d881f9ef0a9d64be5843b4ddcd9633f9c22f1ad5e3",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/lindex.ts": "19fdf660c92984aff4c3e8c50f2b7a6b92430d6ba79822ecb8c21de534f4aafa",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/linsert.ts": "1792c369262f6145fbb99a91d047ce01a07dccad07962b4a4e34f4b818669ca9",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/llen.ts": "0c82404707e01288e1fd347a92b245b07cdb4f6d9f1ccdc653d61df78e493104",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/lmove.ts": "1bda0e31af0c33341368ea8e2f463078ce6caeff7dcc044dac3531a96652d760",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/lpop.ts": "36d61a02a1658ed86fc966d314afab3690b8e4275fdc6229694fc9c8def0313e",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/lpos.ts": "62bf0b311b74f5284f00fe31e8374f6f3b9b4ec8a868309bbb7787c952251744",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/lpush.ts": "77da2034c6f2143604cea38ea6cc1248564cb9d65b727f0b140ae51dea18088f",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/lpushx.ts": "cc12838b65ec8940c52a6a1677baa49716a4246d70284cb2e5fd50f6896caa34",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/lrange.ts": "05c3315fd9c5f587a66176e64ad73b627f2ac16e06fc680fd357cd1684c538f6",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/lrem.ts": "17979b4b14d5f76f2f4165ab1f5fd5ea9ad57f8c537f0994b5306553f4955a10",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/lset.ts": "b4bf2d63090082a37b5f07f7b1a84e13315c286a90b673ac9877f97b94dc3af4",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/ltrim.ts": "645ed938098b8bdea5511edb10961fdd174b85876fb912f6dc5f01dca83721e0",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/mget.ts": "1c3d158b324528bf297df2e3569038d5ab3f2a2c5725c37fffe8e9f52aee0e40",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/mod.ts": "9979890a91c5bd244d49b2a30a5563455f2701ab020c2c7c4bf441d173c711b9",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/mset.ts": "1bd2071ff2c1300469c5052fe22482a528e9486770adce358842f9e63631bbba",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/msetnx.ts": "c444321245e5e8380834646d032d819036f0cdfc4a4cf21e1f7ef13375994e37",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/persist.ts": "8b2084e4f463e35c6a73a95f62109c3c7e04771cf2ee5a7fbd0591f79bd220f6",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/pexpire.ts": "9671f8fc89d3a435adf51fefd1b3dec2c646399da11ddbe8a071c8967236c682",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/pexpireat.ts": "102acd28e00ade7cdaecd71cbffb9f3898973e0341ac9ae4e75baa8aa413e656",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/ping.ts": "c2a3bdacbdd2bbd67490e434f4ef705dd230d0ee1b7362491ee8fcf331c88d5e",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/psetex.ts": "3d5f50d81f18fedf2972b9faeefc955e770500102f6670616bcae72aeea7e6bc",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/pttl.ts": "1dc04eebde6a97fe3ab1fa5a21f70fbbf20d0587275b55c67d84176020f0c53a",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/publish.ts": "e736798115caf72cdf7bde9f4aad0a65bb1c63097956f9877b521df16aeac473",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/randomkey.ts": "ef02967dd2b2cfcfe9842850b840c4bd02af5ee1938d98d97ef8d751d0223f06",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/rename.ts": "57ea600f060cbf73220afcb413097e5b022315c991417602980a5907d696bec9",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/renamenx.ts": "63873b5add504aeb469df82bca2603d5077e12a9258ea43434047bd5daba763e",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/rpop.ts": "05f54a6f69a5b646b467bf6ecce6832807a586ba448ccf5b438b5c286dff3bc7",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/rpush.ts": "ccf283281faba2107a467121445edec7d117132b0899b6d4a4dd5079cf83d80a",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/rpushx.ts": "08d3ac8e377dd7792cb7a5591dea5d3464608ecabaa3760d8950f77fc60dbdd4",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/sadd.ts": "8242a9d4e34e2f2fe7e6032e7eee5ced4c724aeb2597c5e431d568a6426a9ada",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/scan.ts": "d8eed51a34134190e90c3b77bfbf807cbb1080273ac1028f81beea5dadc2d6d8",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/scard.ts": "c0cd0a9560e729dde42c9370bedbbcabe8beb559dcdab37c712e990ad1ab6f47",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/script_exists.ts": "ec34a802ad8ccccecd149acbd5fce8e83299eb867b27a832ae32590dc877dc18",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/script_flush.ts": "c88cd9df52cc3e7f5039d5c2739b6d7137087407e1ad992513cd5794f69bc528",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/script_load.ts": "2bb0eddfe4c0a0d49efce6ed62318e9ee1482d8f31905b43c91981e2c02cf557",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/sdiff.ts": "9caca14e5d21c2fca58b724735b69ac4c0ebafadbda4402bff5e78bf7ebdd97d",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/sdiffstore.ts": "f02b0280dfc2671fa630cceacfddf8c4fd67d0577f9616e43f5ce538228e21db",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/set.ts": "10630826a4ec10d24b8ef867e3d817d671111b5999bac5df0683f26677b8070b",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/setbit.ts": "7e1dfa1f29e50412c742e862d560e953010212d3e0d6f1ff5f6829f111255ee6",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/setex.ts": "a4bb2007a6f6d43b1d207680e8cb40a9d1eedeff1188755a1a9937a510bad4e2",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/setnx.ts": "c4a0ae9ea88a3c9e3576863221cee1f5974c1e86f20701b0df7483b78d8dda1d",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/setrange.ts": "d5598d0e8f0d901d09293dc3cdd934827b07173d1b3617fafa5e9fb79dad19a5",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/sinter.ts": "8e650a63534e9ecdf0b94e11666fe37e6e8b66184a7a96bfb7f25375b794899d",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/sinterstore.ts": "60b04d306de90048c11f50851725d3398735ba918dfcb965e52546f174ba9b29",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/sismember.ts": "dcaeb0422ef38d02793c3680950dafcbcf3a935130c9923b0bf62d80d7db604c",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/smembers.ts": "69ebcf8a4d384b0c15709e875e56ad3b8c61cf79034a8c30c88c0795a36ecf67",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/smismember.ts": "47457d5211e051f314eb16565b0ea15bb6341be497daaeaea2b5fb284cbb3b9d",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/smove.ts": "64d7c5b8d4d4f17cb10e0aa024b371dbe59c22f96248388bdc63411fbc093106",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/spop.ts": "96cdec492f2ad652c6eb50bf4f838aba1247c12dc641ca63aa1c7af9a1caa464",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/srandmember.ts": "e429f6f96e00f8cc19fbeed53cebe52740f0417d7b15ec2ed1f20a9ecb51c043",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/srem.ts": "0b3f22a1f68739aaec4e7eb24d4c4a0a21a20e76169abe5d12e8c414dc612203",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/sscan.ts": "2d9980294af9e7533d071ac5cc681a4353be6f6d44a08f543eaba014fe6fb0d1",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/strlen.ts": "c4473211982ab1928be97a0508355c938d85c5e407eb50c031cf60222ed76748",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/sunion.ts": "17288149935bb1d5d5ee2a573316f8548279b2f40fc489e21f0d7b67165b3de9",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/sunionstore.ts": "e1fd559d77ee55045f449a70c16b64d51a76c39dd91cca5acb08b3674804fd65",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/time.ts": "a9369529c7f90dad581399729756833e07aa021113c81e884728b1d88180c42b",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/touch.ts": "de30108091d443f1d839784068a24e23a31cfa2849bb2830ae880637cd6c6bee",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/ttl.ts": "59c6bb55279eeca818ded3b064a4468c207dc20a9bb1adf041a7641db25cf2bf",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/type.ts": "45f6a2cf5bef44067d85d399dbe996d519797dad91b125b592082adb0cd21346",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/unlink.ts": "8e4f798f269e1d90b09cd651e6bb7299d73ac0851b63d528bd1977415eae66a7",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/zadd.ts": "81b17c7f0b640b8bcbb6151e5753ed1b8d56bafd13be171c608bafcfaa6e6041",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/zcard.ts": "aabcb2807530ca78b4e5209d2d438ec5ed63b4a2024d6f62fe7cc5447816c2f2",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/zcount.ts": "ad88591dcefc8bcaa24f32dbcfff35f82a61ccd36a562429b3ff8216ac754146",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/zdiffstore.ts": "6007fb514e79593e3b37a7872a711849c3c4506419c908e9e12328568b243000",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/zincrby.ts": "e58e72348f27cad636320a76a6461b6e7708c990027b8709b3a7ac84120617be",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/zinterstore.ts": "6fb94390fb902e74dbc577a614d7e315e13d5c47309675b938fdb323f7cca06f",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/zlexcount.ts": "ced0b60c255f81008ddb7a8ae75d55493035ac37050fba681e416e723c3ceadc",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/zmscore.ts": "ac8162797d0d35f0a72651b3db953cfbb2f56cccc911d42934c8e7cd66d12d11",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/zpopmax.ts": "3367e079bc3e07a0e6f7eda43ec52a1929e287a1e261cf5c63df32f275b9b567",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/zpopmin.ts": "b8998941e29ebe7a5e9b2df43faabffe9126f7a3682debe34c92b2cb0190e6a3",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/zrange.ts": "7a3d840525aa17bd7fc06062c6919a5affe3a36c240895dcd22f96b7884774c5",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/zrank.ts": "a5010f33b3b18f6d28fda1b45275840f11b31d162e8ffca5cb60785fc15c9b38",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/zrem.ts": "d5fa92243158fe1c0ddd161d7aef7c4fab3d6d2180dc6e478d8a423aac0078da",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/zremrangebylex.ts": "0c023863bd770f842150ea3218b391e9317c1edcd3ebb22a610fbcb71797aa81",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/zremrangebyrank.ts": "44a08191c50edd38d83e025a83cea4ac8e240981aa7a7e24f9a2931f5a380d6c",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/zremrangebyscore.ts": "20d5c9f19b2bd67b84790ebb83092541318b16701623d9787c60f24db92b71ff",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/zrevrank.ts": "55a50470a8c089e61325d16a8cd42ea376c1fb4857df5ea4b1a2d8fb5e328a32",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/zscan.ts": "eab7069ba31cb8b24df3db139b4f8899af0342ea43327463608ef4e92cd06fdf",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/zscore.ts": "1977f586cbc9374dda8d4ad790c7b3c0a34cbde6d91cf6a7e5b064ed030a77ad",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/commands/zunionstore.ts": "67393ede82edfe0708ad9f2eb8ef78a1e3099ee7365f9925ce22097e465452cb",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/error.ts": "17c357eab8dca7700286355581e395d64f454bd5c478444f12be273d8a3e5ffe",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/http.ts": "d8eec68aecc4225f36ad68c59d1d07e7749e54943b43e57e0c9c4ca79c6d1f51",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/pipeline.ts": "d5b344e4536fe30e25f61f7c622a85be7258025cb7ef5d5ef29f9b0cd2d2a9e1",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/redis.ts": "ee183cb3023ff6730fb90d5d7b560a161c176c808a2f819b88ee9cb929e8d96a",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/script.ts": "4f7510a8511b9cc4fe63d8c14e381bd753cc2b296d88904c6c0e1bb950b31a4e",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/types.ts": "f9363a02964f5c2af8f4f054cba2cfde222af8eb9e908c37ca508a6399ac9e29",
"https://deno.land/x/upstash_redis@v1.19.3/pkg/util.ts": "bda4f5eb90ff82d2443ec8908a376079a44af328ee64390d2e5ee7687a171556",
"https://deno.land/x/upstash_redis@v1.19.3/version.ts": "fb553d493437bc431a81483e2940d14fc1a31e476128ef89e1e77db317ea4baf",
"https://denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.ts": "4a927e5cd1d9b080d72881eb285b3b94edb6dadc1828aeb194117645f4481ac0"
}
}

View File

@ -0,0 +1,38 @@
// Follow this setup guide to integrate the Deno language server with your editor:
// https://deno.land/manual/getting_started/setup_your_environment
// This enables autocomplete, go to definition, etc.
import { serve } from "https://deno.land/std@0.177.0/http/server.ts";
import { Redis } from "https://deno.land/x/upstash_redis@v1.19.3/mod.ts";
serve(async (req) => {
console.log('hello we are executing');
const redis = new Redis({
url: Deno.env.get("UPSTASH_REDIS_REST_URL")!,
token: Deno.env.get("UPSTASH_REDIS_REST_TOKEN")!,
});
console.log('attempting to get text');
const text = await req.text();
console.log(text);
redis.set('hello_from_supabase', text);
console.log('set in redis');
return new Response(JSON.stringify({ "status": "success" }), {
headers: { "Content-Type": "application/json" },
});
});
/* To invoke locally:
1. Run `supabase start` (see: https://supabase.com/docs/reference/cli/supabase-start)
2. Make an HTTP request:
curl -i --location --request POST 'http://127.0.0.1:54321/functions/v1/test' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0' \
--header 'Content-Type: application/json' \
--data '{"name":"Functions"}'
*/

View File

@ -0,0 +1,66 @@
-- extensions
CREATE EXTENSION IF NOT EXISTS "plv8" SCHEMA pg_catalog;
CREATE EXTENSION IF NOT EXISTS "pg_cron" SCHEMA pg_catalog;
CREATE EXTENSION IF NOT EXISTS "pg_net" SCHEMA extensions;
-- request ID is inserted by first cron job,
-- then second cron job updates from net._http_response table.
create table if not exists raw_bus_positions (
request_id int not null,
response_status int null,
response_json jsonb null
);
-- used to help craft the API URL. Requires plv8 extension.
-- because we are lazy. just use javascript in the database. why not?
create or replace function to_straeto_querystring(jsonb) returns text
language plv8 strict immutable as $$
const obj = $1;
return Object.keys(obj).map(function(variableName) {
const variableValue = obj[variableName];
if (typeof variableValue == 'object') {
return encodeURIComponent(variableName) + '=' + encodeURIComponent(JSON.stringify(variableValue));
} else {
return encodeURIComponent(variableName) + '=' + encodeURIComponent(variableValue);
}
}).join('&');
$$;
create or replace function create_straeto_parameters(bus_routes text[]) returns jsonb
language plpgsql as $$
declare query_params jsonb;
begin
query_params := '{
"operationName": "BusLocationByRoute",
"variables": { "trips":[], "routes": [] },
"extensions": {
"persistedQuery": {
"version": 1,
"sha256Hash": "8f9ee84171961f8a3b9a9d1a7b2a7ac49e7e122e1ba1727e75cfe3a94ff3edb8"
}
}
}'::jsonb;
select into query_params
jsonb_set(query_params, '{variables, routes}', array_to_json(bus_routes)::jsonb);
return query_params;
end
$$;
create or replace function create_api_url(bus_routes text[]) returns text language sql as $$
select concat(
'https://straeto.is/graphql?',
to_straeto_querystring(create_straeto_parameters(bus_routes))
);
$$;
create or replace function gather_bus_data()
returns int language sql
as $$
select
net.http_get(
url := create_api_url(array['1', '2', '3']),
headers := '{"Content-Type": "application/json"}'::jsonb
)
as request_id;
$$;

0
supabase/seed.sql Normal file
View File