Skip to content

Commit b17550a

Browse files
committed
feat: update libs and migrate test to supabase stack
1 parent 9340fc5 commit b17550a

File tree

8 files changed

+354
-13
lines changed

8 files changed

+354
-13
lines changed

Supabase/Supabase.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
<ItemGroup>
4545
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
4646
<PackageReference Include="Supabase.Core" Version="1.0.0" />
47-
<PackageReference Include="Supabase.Functions" Version="2.0.0" />
47+
<PackageReference Include="Supabase.Functions" Version="2.1.0" />
4848
<PackageReference Include="Supabase.Gotrue" Version="6.0.3" />
4949
<PackageReference Include="Supabase.Postgrest" Version="4.1.0" />
50-
<PackageReference Include="Supabase.Realtime" Version="7.1.0" />
50+
<PackageReference Include="Supabase.Realtime" Version="7.2.0" />
5151
<PackageReference Include="Supabase.Storage" Version="2.0.2" />
5252
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
5353
</ItemGroup>

SupabaseTests/Client.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ public async Task InitializeTest()
2626
{
2727
_instance = new Supabase.Client("http://localhost", null, new Supabase.SupabaseOptions
2828
{
29-
AuthUrlFormat = "{0}:9999",
30-
RealtimeUrlFormat = "ws://realtime-dev.localhost:4000/socket",
31-
RestUrlFormat = "{0}:3000",
29+
AuthUrlFormat = "{0}:54321/rest/v1",
30+
RealtimeUrlFormat = "ws://127.0.0.1:54321/realtime/v1",
31+
RestUrlFormat = "{0}:54321/rest/v1",
3232
AutoConnectRealtime = false,
3333
});
3434
await _instance.InitializeAsync();

SupabaseTests/StatelessClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ public class StatelessClient
1616
private string supabaseUrl = "http://localhost";
1717
private Supabase.SupabaseOptions options = new()
1818
{
19-
AuthUrlFormat = "{0}:9999",
20-
RealtimeUrlFormat = "{0}:4000/socket",
21-
RestUrlFormat = "{0}:3000"
19+
AuthUrlFormat = "{0}:54321/rest/v1",
20+
RealtimeUrlFormat = "ws://127.0.0.1:54321/realtime/v1",
21+
RestUrlFormat = "{0}:54321/rest/v1",
2222
};
2323

2424
[TestMethod("Can access Stateless REST")]

SupabaseTests/SupabaseTests.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
<IsPackable>false</IsPackable>
66
<ReleaseVersion>0.8.5</ReleaseVersion>
77
<OutputType>Library</OutputType>
8-
<TargetFramework>net7.0</TargetFramework>
8+
<TargetFramework>net9.0</TargetFramework>
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
13-
<PackageReference Include="MSTest.TestAdapter" Version="3.5.0" />
14-
<PackageReference Include="MSTest.TestFramework" Version="3.3.1" />
15-
<PackageReference Include="coverlet.collector" Version="6.0.2"><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
13+
<PackageReference Include="MSTest.TestAdapter" Version="3.9.3" />
14+
<PackageReference Include="MSTest.TestFramework" Version="3.9.3" />
15+
<PackageReference Include="coverlet.collector" Version="6.0.4"><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1616
<PrivateAssets>all</PrivateAssets>
1717
</PackageReference>
1818
</ItemGroup>

supabase/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Supabase
2+
.branches
3+
.temp
4+
5+
# dotenvx
6+
.env.keys
7+
.env.local
8+
.env.*.local

supabase/config.toml

Lines changed: 317 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,317 @@
1+
# For detailed configuration reference documentation, visit:
2+
# https://supabase.com/docs/guides/local-development/cli/config
3+
# A string used to distinguish different Supabase projects on the same host. Defaults to the
4+
# working directory name when running `supabase init`.
5+
project_id = "supabase-csharp"
6+
7+
[api]
8+
enabled = true
9+
# Port to use for the API URL.
10+
port = 54321
11+
# Schemas to expose in your API. Tables, views and stored procedures in this schema will get API
12+
# endpoints. `public` and `graphql_public` schemas are included by default.
13+
schemas = ["public", "graphql_public"]
14+
# Extra schemas to add to the search_path of every request.
15+
extra_search_path = ["public", "extensions"]
16+
# The maximum number of rows returns from a view, table, or stored procedure. Limits payload size
17+
# for accidental or malicious requests.
18+
max_rows = 1000
19+
20+
[api.tls]
21+
# Enable HTTPS endpoints locally using a self-signed certificate.
22+
enabled = false
23+
24+
[db]
25+
# Port to use for the local database URL.
26+
port = 54322
27+
# Port used by db diff command to initialize the shadow database.
28+
shadow_port = 54320
29+
# The database major version to use. This has to be the same as your remote database's. Run `SHOW
30+
# server_version;` on the remote database to check.
31+
major_version = 17
32+
33+
[db.pooler]
34+
enabled = false
35+
# Port to use for the local connection pooler.
36+
port = 54329
37+
# Specifies when a server connection can be reused by other clients.
38+
# Configure one of the supported pooler modes: `transaction`, `session`.
39+
pool_mode = "transaction"
40+
# How many server connections to allow per user/database pair.
41+
default_pool_size = 20
42+
# Maximum number of client connections allowed.
43+
max_client_conn = 100
44+
45+
# [db.vault]
46+
# secret_key = "env(SECRET_VALUE)"
47+
48+
[db.migrations]
49+
# If disabled, migrations will be skipped during a db push or reset.
50+
enabled = true
51+
# Specifies an ordered list of schema files that describe your database.
52+
# Supports glob patterns relative to supabase directory: "./schemas/*.sql"
53+
schema_paths = []
54+
55+
[db.seed]
56+
# If enabled, seeds the database after migrations during a db reset.
57+
enabled = true
58+
# Specifies an ordered list of seed files to load during db reset.
59+
# Supports glob patterns relative to supabase directory: "./seeds/*.sql"
60+
sql_paths = ["./seed.sql"]
61+
62+
[realtime]
63+
enabled = true
64+
# Bind realtime via either IPv4 or IPv6. (default: IPv4)
65+
# ip_version = "IPv6"
66+
# The maximum length in bytes of HTTP request headers. (default: 4096)
67+
# max_header_length = 4096
68+
69+
[studio]
70+
enabled = true
71+
# Port to use for Supabase Studio.
72+
port = 54323
73+
# External URL of the API server that frontend connects to.
74+
api_url = "http://127.0.0.1"
75+
# OpenAI API Key to use for Supabase AI in the Supabase Studio.
76+
openai_api_key = "env(OPENAI_API_KEY)"
77+
78+
# Email testing server. Emails sent with the local dev setup are not actually sent - rather, they
79+
# are monitored, and you can view the emails that would have been sent from the web interface.
80+
[inbucket]
81+
enabled = true
82+
# Port to use for the email testing server web interface.
83+
port = 54324
84+
# Uncomment to expose additional ports for testing user applications that send emails.
85+
# smtp_port = 54325
86+
# pop3_port = 54326
87+
# admin_email = "admin@email.com"
88+
# sender_name = "Admin"
89+
90+
[storage]
91+
enabled = true
92+
# The maximum file size allowed (e.g. "5MB", "500KB").
93+
file_size_limit = "50MiB"
94+
95+
# Image transformation API is available to Supabase Pro plan.
96+
# [storage.image_transformation]
97+
# enabled = true
98+
99+
# Uncomment to configure local storage buckets
100+
# [storage.buckets.images]
101+
# public = false
102+
# file_size_limit = "50MiB"
103+
# allowed_mime_types = ["image/png", "image/jpeg"]
104+
# objects_path = "./images"
105+
106+
[auth]
107+
enabled = true
108+
# The base URL of your website. Used as an allow-list for redirects and for constructing URLs used
109+
# in emails.
110+
site_url = "http://127.0.0.1:3000"
111+
# A list of *exact* URLs that auth providers are permitted to redirect to post authentication.
112+
additional_redirect_urls = ["https://127.0.0.1:3000"]
113+
# How long tokens are valid for, in seconds. Defaults to 3600 (1 hour), maximum 604,800 (1 week).
114+
jwt_expiry = 3600
115+
# If disabled, the refresh token will never expire.
116+
enable_refresh_token_rotation = true
117+
# Allows refresh tokens to be reused after expiry, up to the specified interval in seconds.
118+
# Requires enable_refresh_token_rotation = true.
119+
refresh_token_reuse_interval = 10
120+
# Allow/disallow new user signups to your project.
121+
enable_signup = true
122+
# Allow/disallow anonymous sign-ins to your project.
123+
enable_anonymous_sign_ins = false
124+
# Allow/disallow testing manual linking of accounts
125+
enable_manual_linking = false
126+
# Passwords shorter than this value will be rejected as weak. Minimum 6, recommended 8 or more.
127+
minimum_password_length = 6
128+
# Passwords that do not meet the following requirements will be rejected as weak. Supported values
129+
# are: `letters_digits`, `lower_upper_letters_digits`, `lower_upper_letters_digits_symbols`
130+
password_requirements = ""
131+
132+
[auth.rate_limit]
133+
# Number of emails that can be sent per hour. Requires auth.email.smtp to be enabled.
134+
email_sent = 2
135+
# Number of SMS messages that can be sent per hour. Requires auth.sms to be enabled.
136+
sms_sent = 30
137+
# Number of anonymous sign-ins that can be made per hour per IP address. Requires enable_anonymous_sign_ins = true.
138+
anonymous_users = 30
139+
# Number of sessions that can be refreshed in a 5 minute interval per IP address.
140+
token_refresh = 150
141+
# Number of sign up and sign-in requests that can be made in a 5 minute interval per IP address (excludes anonymous users).
142+
sign_in_sign_ups = 30
143+
# Number of OTP / Magic link verifications that can be made in a 5 minute interval per IP address.
144+
token_verifications = 30
145+
# Number of Web3 logins that can be made in a 5 minute interval per IP address.
146+
web3 = 30
147+
148+
# Configure one of the supported captcha providers: `hcaptcha`, `turnstile`.
149+
# [auth.captcha]
150+
# enabled = true
151+
# provider = "hcaptcha"
152+
# secret = ""
153+
154+
[auth.email]
155+
# Allow/disallow new user signups via email to your project.
156+
enable_signup = true
157+
# If enabled, a user will be required to confirm any email change on both the old, and new email
158+
# addresses. If disabled, only the new email is required to confirm.
159+
double_confirm_changes = true
160+
# If enabled, users need to confirm their email address before signing in.
161+
enable_confirmations = false
162+
# If enabled, users will need to reauthenticate or have logged in recently to change their password.
163+
secure_password_change = false
164+
# Controls the minimum amount of time that must pass before sending another signup confirmation or password reset email.
165+
max_frequency = "1s"
166+
# Number of characters used in the email OTP.
167+
otp_length = 6
168+
# Number of seconds before the email OTP expires (defaults to 1 hour).
169+
otp_expiry = 3600
170+
171+
# Use a production-ready SMTP server
172+
# [auth.email.smtp]
173+
# enabled = true
174+
# host = "smtp.sendgrid.net"
175+
# port = 587
176+
# user = "apikey"
177+
# pass = "env(SENDGRID_API_KEY)"
178+
# admin_email = "admin@email.com"
179+
# sender_name = "Admin"
180+
181+
# Uncomment to customize email template
182+
# [auth.email.template.invite]
183+
# subject = "You have been invited"
184+
# content_path = "./supabase/templates/invite.html"
185+
186+
[auth.sms]
187+
# Allow/disallow new user signups via SMS to your project.
188+
enable_signup = false
189+
# If enabled, users need to confirm their phone number before signing in.
190+
enable_confirmations = false
191+
# Template for sending OTP to users
192+
template = "Your code is {{ .Code }}"
193+
# Controls the minimum amount of time that must pass before sending another sms otp.
194+
max_frequency = "5s"
195+
196+
# Use pre-defined map of phone number to OTP for testing.
197+
# [auth.sms.test_otp]
198+
# 4152127777 = "123456"
199+
200+
# Configure logged in session timeouts.
201+
# [auth.sessions]
202+
# Force log out after the specified duration.
203+
# timebox = "24h"
204+
# Force log out if the user has been inactive longer than the specified duration.
205+
# inactivity_timeout = "8h"
206+
207+
# This hook runs before a token is issued and allows you to add additional claims based on the authentication method used.
208+
# [auth.hook.custom_access_token]
209+
# enabled = true
210+
# uri = "pg-functions://<database>/<schema>/<hook_name>"
211+
212+
# Configure one of the supported SMS providers: `twilio`, `twilio_verify`, `messagebird`, `textlocal`, `vonage`.
213+
[auth.sms.twilio]
214+
enabled = false
215+
account_sid = ""
216+
message_service_sid = ""
217+
# DO NOT commit your Twilio auth token to git. Use environment variable substitution instead:
218+
auth_token = "env(SUPABASE_AUTH_SMS_TWILIO_AUTH_TOKEN)"
219+
220+
# Multi-factor-authentication is available to Supabase Pro plan.
221+
[auth.mfa]
222+
# Control how many MFA factors can be enrolled at once per user.
223+
max_enrolled_factors = 10
224+
225+
# Control MFA via App Authenticator (TOTP)
226+
[auth.mfa.totp]
227+
enroll_enabled = false
228+
verify_enabled = false
229+
230+
# Configure MFA via Phone Messaging
231+
[auth.mfa.phone]
232+
enroll_enabled = false
233+
verify_enabled = false
234+
otp_length = 6
235+
template = "Your code is {{ .Code }}"
236+
max_frequency = "5s"
237+
238+
# Configure MFA via WebAuthn
239+
# [auth.mfa.web_authn]
240+
# enroll_enabled = true
241+
# verify_enabled = true
242+
243+
# Use an external OAuth provider. The full list of providers are: `apple`, `azure`, `bitbucket`,
244+
# `discord`, `facebook`, `github`, `gitlab`, `google`, `keycloak`, `linkedin_oidc`, `notion`, `twitch`,
245+
# `twitter`, `slack`, `spotify`, `workos`, `zoom`.
246+
[auth.external.apple]
247+
enabled = false
248+
client_id = ""
249+
# DO NOT commit your OAuth provider secret to git. Use environment variable substitution instead:
250+
secret = "env(SUPABASE_AUTH_EXTERNAL_APPLE_SECRET)"
251+
# Overrides the default auth redirectUrl.
252+
redirect_uri = ""
253+
# Overrides the default auth provider URL. Used to support self-hosted gitlab, single-tenant Azure,
254+
# or any other third-party OIDC providers.
255+
url = ""
256+
# If enabled, the nonce check will be skipped. Required for local sign in with Google auth.
257+
skip_nonce_check = false
258+
259+
# Allow Solana wallet holders to sign in to your project via the Sign in with Solana (SIWS, EIP-4361) standard.
260+
# You can configure "web3" rate limit in the [auth.rate_limit] section and set up [auth.captcha] if self-hosting.
261+
[auth.web3.solana]
262+
enabled = false
263+
264+
# Use Firebase Auth as a third-party provider alongside Supabase Auth.
265+
[auth.third_party.firebase]
266+
enabled = false
267+
# project_id = "my-firebase-project"
268+
269+
# Use Auth0 as a third-party provider alongside Supabase Auth.
270+
[auth.third_party.auth0]
271+
enabled = false
272+
# tenant = "my-auth0-tenant"
273+
# tenant_region = "us"
274+
275+
# Use AWS Cognito (Amplify) as a third-party provider alongside Supabase Auth.
276+
[auth.third_party.aws_cognito]
277+
enabled = false
278+
# user_pool_id = "my-user-pool-id"
279+
# user_pool_region = "us-east-1"
280+
281+
# Use Clerk as a third-party provider alongside Supabase Auth.
282+
[auth.third_party.clerk]
283+
enabled = false
284+
# Obtain from https://clerk.com/setup/supabase
285+
# domain = "example.clerk.accounts.dev"
286+
287+
[edge_runtime]
288+
enabled = true
289+
# Configure one of the supported request policies: `oneshot`, `per_worker`.
290+
# Use `oneshot` for hot reload, or `per_worker` for load testing.
291+
policy = "oneshot"
292+
# Port to attach the Chrome inspector for debugging edge functions.
293+
inspector_port = 8083
294+
# The Deno major version to use.
295+
deno_version = 1
296+
297+
# [edge_runtime.secrets]
298+
# secret_key = "env(SECRET_VALUE)"
299+
300+
[analytics]
301+
enabled = true
302+
port = 54327
303+
# Configure one of the supported backends: `postgres`, `bigquery`.
304+
backend = "postgres"
305+
306+
# Experimental features may be deprecated any time
307+
[experimental]
308+
# Configures Postgres storage engine to use OrioleDB (S3)
309+
orioledb_version = ""
310+
# Configures S3 bucket URL, eg. <bucket_name>.s3-<region>.amazonaws.com
311+
s3_host = "env(S3_HOST)"
312+
# Configures S3 bucket region, eg. us-east-1
313+
s3_region = "env(S3_REGION)"
314+
# Configures AWS_ACCESS_KEY_ID for S3 bucket
315+
s3_access_key = "env(S3_ACCESS_KEY)"
316+
# Configures AWS_SECRET_ACCESS_KEY for S3 bucket
317+
s3_secret_key = "env(S3_SECRET_KEY)"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
-- channels
2+
3+
create table public.channels (
4+
id int generated by default as identity,
5+
inserted_at timestamp without time zone default timezone('utc'::text, now()) not null,
6+
update_at timestamp without time zone default timezone('utc'::text, now()) not null,
7+
data jsonb default null,
8+
slug text
9+
);
10+
11+
alter table public.channels replica identity full;
12+
alter publication supabase_realtime add table public.channels;

0 commit comments

Comments
 (0)