diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000000..b5924c32836 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +node_modules/ +.vercel +.next +.env.local +.env.production +.env.dev +.env.* \ No newline at end of file diff --git a/.github/workflows/studio-tests.yml b/.github/workflows/studio-tests.yml index f9d28288a50..5f4c6cf4b04 100644 --- a/.github/workflows/studio-tests.yml +++ b/.github/workflows/studio-tests.yml @@ -6,6 +6,8 @@ name: Studio Unit Tests on: push: branches: [ master ] + paths: + - 'studio/**' pull_request: branches: [ master ] paths: diff --git a/README.md b/README.md index 446e3316709..e8a1708cb3e 100644 --- a/README.md +++ b/README.md @@ -225,6 +225,7 @@ Our approach for client libraries is modular. Each sub-library is a standalone i - [Portuguese (Brazilian) / Português Brasileiro](/i18n/README.pt-br.md) - [Romanian / Română](/i18n/README.ro.md) - [Russian / Pусский](/i18n/README.ru.md) +- [Serbian / Srpski](/i18n/README.sr.md) - [Sinhala / සිංහල](/i18n/README.si.md) - [Spanish / Español](/i18n/README.es.md) - [Simplified Chinese / 简体中文](/i18n/README.zh-cn.md) diff --git a/apps/reference/.gitignore b/apps/reference/.gitignore index 8ea2c34929e..6327667b400 100644 --- a/apps/reference/.gitignore +++ b/apps/reference/.gitignore @@ -19,5 +19,4 @@ npm-debug.log* yarn-debug.log* yarn-error.log* -# _supabase_js/sdk/**/* -# !_supabase_js/sdk/.gitkeep \ No newline at end of file +**/*/generated \ No newline at end of file diff --git a/apps/reference/_api/usage.mdx b/apps/reference/_api/usage.mdx index f9aaa960c54..09584d7a96b 100644 --- a/apps/reference/_api/usage.mdx +++ b/apps/reference/_api/usage.mdx @@ -334,6 +334,9 @@ POST https://api.supabase.com/v1/projects "ap-south-1", "sa-east-1" ] + }, + "kps_enabled": { + "type": "boolean" } }, "required": [ @@ -511,6 +514,18 @@ GET https://api.supabase.com/v1/projects/{ref}/functions ``` + + + + + + + + + + + + @@ -583,7 +598,7 @@ POST https://api.supabase.com/v1/projects/{ref}/functions "properties": { "slug": { "type": "string", - "pattern": {} + "pattern": "/^[A-Za-z0-9_-]+$/" }, "name": { "type": "string" @@ -667,6 +682,18 @@ POST https://api.supabase.com/v1/projects/{ref}/functions ``` + + + + + + + + + + + + @@ -814,6 +841,18 @@ GET https://api.supabase.com/v1/projects/{ref}/functions/{function_slug} ``` + + + + + + + + + + + + @@ -979,6 +1018,18 @@ PATCH https://api.supabase.com/v1/projects/{ref}/functions/{function_slug} ``` + + + + + + + + + + + + @@ -1075,6 +1126,18 @@ DELETE https://api.supabase.com/v1/projects/{ref}/functions/{function_slug} + + + + + + + + + + + + @@ -1176,6 +1239,18 @@ GET https://api.supabase.com/v1/projects/{ref}/secrets ``` + + + + + + + + + + + + @@ -1253,7 +1328,7 @@ POST https://api.supabase.com/v1/projects/{ref}/secrets }, "value": { "type": "string", - "pattern": {} + "pattern": "/^(?!SUPABASE_).*/" } }, "required": [ @@ -1280,6 +1355,18 @@ POST https://api.supabase.com/v1/projects/{ref}/secrets + + + + + + + + + + + + @@ -1379,6 +1466,18 @@ DELETE https://api.supabase.com/v1/projects/{ref}/secrets ``` + + + + + + + + + + + + diff --git a/apps/reference/_supabase_js_versioned_docs/.gitkeep b/apps/reference/_cli/generated/.gitkeep similarity index 100% rename from apps/reference/_supabase_js_versioned_docs/.gitkeep rename to apps/reference/_cli/generated/.gitkeep diff --git a/apps/reference/_cli/generated/config.mdx b/apps/reference/_cli/generated/config.mdx deleted file mode 100644 index 4f69366e0f0..00000000000 --- a/apps/reference/_cli/generated/config.mdx +++ /dev/null @@ -1,337 +0,0 @@ ---- -id: config -slug: /config -title: Configuration -toc_max_heading_level: 3 ---- - - - -A `config.toml` file is generated after running `supabase init`. - -This file is located in the `supabase` folder under `supabase/config.toml`. - - - -## General {#general} - -### `project_id` {#project_id} - -A string used to distinguish different Supabase projects on the same host. Defaults to the working directory name when running `supabase init`. - - - -
- - - -## Auth Settings {#auth} - -### `auth.site_url` {#auth.site_url} - -The base URL of your website. Used as an allow-list for redirects and for constructing URLs used in emails. - - - -
- -### `auth.additional_redirect_urls` {#auth.additional_redirect_urls} - -A list of _exact_ URLs that auth providers are permitted to redirect to post authentication. - - - -
- -### `auth.jwt_expiry` {#auth.jwt_expiry} - -How long tokens are valid for, in seconds. Defaults to 3600 (1 hour), maximum 604,800 seconds (one week). - - - -
- -### `auth.enable_signup` {#auth.enable_signup} - -Allow/disallow new user signups to your project. - - - -
- -### `auth.email.enable_signup` {#auth.email.enable_signup} - -Allow/disallow new user signups via email to your project. - - - -
- -### `auth.email.double_confirm_changes` {#auth.email.double_confirm_changes} - -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. - - - -
- -### `auth.email.enable_confirmations` {#auth.email.enable_confirmations} - -If enabled, users need to confirm their email address before signing in. - - - -
- -### `auth.external..enabled` {#auth.external.provider.enabled} - -Use an external OAuth provider. The full list of providers are: - -- `apple` -- `azure` -- `bitbucket` -- `discord` -- `facebook` -- `github` -- `gitlab` -- `google` -- `twitch` -- `twitter` -- `slack` -- `spotify` - - - -
- -### `auth.external..client_id` {#auth.external.provider.client_id} - -Client ID for the external OAuth provider. - - - -
- -### `auth.external..secret` {#auth.external.provider.secret} - -Client secret for the external OAuth provider. - - - -
- - - -## API Settings {#api} - -### `api.port` {#api.port} - -Port to use for the API URL. - - - -
- -### `api.extra_search_path` {#api.extra_search_path} - -Extra schemas to add to the `search_path` of every request. - - - -
- -### `api.max_rows` {#api.max_rows} - -The maximum number of rows returned from a view, table, or stored procedure. Limits payload size for accidental or malicious requests. - - - -
- - - -## Database Settings {#database} - -### `db.port` {#db.port} - -Port to use for the local database URL. - - - -
- -### `db.major_version` {#db.major_version} - -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. - - - -
- - - -## Dashboard Settings {#dashboard} - -### `studio.port` {#studio.port} - -Port to use for Supabase Studio. - -
    -
  • - Required: true -
  • -
  • - Default: 54323 -
  • -
- -
- - - -## Local Development {#local} - -### `inbucket.port` {#inbucket.port} - -Port to use for the email testing server web interface. - -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. - - - -
diff --git a/apps/reference/_cli/generated/usage.mdx b/apps/reference/_cli/generated/usage.mdx deleted file mode 100644 index 7235621cecb..00000000000 --- a/apps/reference/_cli/generated/usage.mdx +++ /dev/null @@ -1,1008 +0,0 @@ ---- -id: usage -slug: /usage -title: Usage -toc_max_heading_level: 3 ---- - - - -Supabase CLI provides you with tools to develop your application locally, and deploy your application to the Supabase platform. - - - -
-
- -### Stop all local Supabase containers {#supabase-stop} - - - -```sh -supabase stop [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for stop -``` - - - -
-
- -### Show status of local Supabase containers {#supabase-status} - - - -```sh -supabase status [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for status -``` - - - -
-
- -### Start containers for Supabase local development {#supabase-start} - - - -```sh -supabase start [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for start -``` - - - -
-
- -## Manage Supabase secrets {#supabase-secrets} - - - - - -**Available Commands** - -- - supabase secrets list - - -- - supabase secrets set - - -- - supabase secrets unset - - - - -**Options** - -```sh - -h, --help help for secrets -``` - - - -
-
- -### Unset a secret(s) on Supabase {#supabase-secrets-unset} - - - -Unset a secret(s) from the linked Supabase project. - -```sh -supabase secrets unset ... [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for unset -``` - - - -
-
- -### Set a secret(s) on Supabase {#supabase-secrets-set} - - - -Set a secret(s) to the linked Supabase project. - -```sh -supabase secrets set [flags] ... -``` - - - - - -**Options** - -```sh - --env-file string Read secrets from a .env file. - -h, --help help for set -``` - - - -
-
- -### List all secrets on Supabase {#supabase-secrets-list} - - - -List all secrets in the linked project. - -```sh -supabase secrets list [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for list -``` - - - -
-
- -## Manage Supabase projects {#supabase-projects} - - - - - -**Available Commands** - -- - supabase projects create - - -- - supabase projects list - - - - -**Options** - -```sh - -h, --help help for projects -``` - - - -
-
- -### List all Supabase projects {#supabase-projects-list} - - - -List all Supabase projects the logged-in user can access. - -```sh -supabase projects list [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for list -``` - - - -
-
- -### Create a project on Supabase {#supabase-projects-create} - - - -```sh -supabase projects create [flags] -``` - - - - - -**Options** - -```sh - --db-password string Database password of the project. - -h, --help help for create - -i, --interactive Enables interactive mode. - --org-id string Organization ID to create the project in. - --plan string Select a plan that suits your needs. (default "free") - --region string Select a region close to you for the best performance. -``` - - - -
-
- -## Manage Supabase organizations {#supabase-orgs} - - - - - -**Available Commands** - -- - supabase orgs list - - - - -**Options** - -```sh - -h, --help help for orgs -``` - - - -
-
- -### List all organizations {#supabase-orgs-list} - - - -List all organizations the logged-in user belongs. - -```sh -supabase orgs list [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for list -``` - - - -
-
- -## Manage database migration scripts {#supabase-migration} - - - - - -**Available Commands** - -- - supabase migration list - - -- - supabase migration new - - - - -**Options** - -```sh - -h, --help help for migration -``` - - - -
-
- -### Create an empty migration script {#supabase-migration-new} - - - -```sh -supabase migration new [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for new -``` - - - -
-
- -### List local and remote migrations {#supabase-migration-list} - - - -```sh -supabase migration list [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for list - -p, --password string Password to your remote Postgres database. -``` - - - -
-
- -### Authenticate using an access token {#supabase-login} - - - -```sh -supabase login [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for login -``` - - - -
-
- -### Link to a Supabase project {#supabase-link} - - - -```sh -supabase link [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for link - -p, --password string Password to your remote Postgres database. - --project-ref string Project ref of the Supabase project. -``` - - - -
-
- -### Initialize a local project {#supabase-init} - - - -```sh -supabase init [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for init -``` - - - -
-
- -## Run code generation tools {#supabase-gen} - - - - - -**Available Commands** - -- - supabase gen types - - - - -**Options** - -```sh - -h, --help help for gen -``` - - - -
-
- -## Generate types from Postgres schema {#supabase-gen-types} - - - - - -**Available Commands** - -- - supabase gen types typescript - - - - -**Options** - -```sh - -h, --help help for types -``` - - - -
-
- -### Generate types for TypeScript {#supabase-gen-types-typescript} - - - -Generate types for TypeScript. Must specify either --local or --db-url - -```sh -supabase gen types typescript [flags] -``` - - - - - -**Options** - -```sh - --db-url string Generate types from a database url. - -h, --help help for typescript - --local Generate types from the local dev database. -``` - - - -
-
- -## Manage Supabase Edge functions {#supabase-functions} - - - - - -**Available Commands** - -- - supabase functions delete - - -- - supabase functions deploy - - -- - supabase functions new - - -- - supabase functions serve - - - - -**Options** - -```sh - -h, --help help for functions -``` - - - -
-
- -### Serve a Function locally {#supabase-functions-serve} - - - -```sh -supabase functions serve [flags] -``` - - - - - -**Options** - -```sh - --env-file string Path to an env file to be populated to the Function environment. - -h, --help help for serve - --no-verify-jwt Disable JWT verification for the Function. -``` - - - -
-
- -### Create a new Function locally {#supabase-functions-new} - - - -```sh -supabase functions new [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for new -``` - - - -
-
- -### Deploy a Function to Supabase {#supabase-functions-deploy} - - - -Deploy a Function to the linked Supabase project. - -```sh -supabase functions deploy [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for deploy - --no-verify-jwt Disable JWT verification for the Function. - --project-ref string Project ref of the Supabase project. -``` - - - -
-
- -### Delete a Function from Supabase {#supabase-functions-delete} - - - -Delete a Function from the linked Supabase project. This does NOT remove the Function locally. - -```sh -supabase functions delete [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for delete - --project-ref string Project ref of the Supabase project. -``` - - - -
-
- -## Manage local Postgres databases {#supabase-db} - - - - - -**Available Commands** - -- - supabase db branch - - -- - supabase db diff - - -- - supabase db push - - -- - supabase db remote - - -- - supabase db reset - - - - -**Options** - -```sh - -h, --help help for db -``` - - - -
-
- -### Resets the local database to current migrations {#supabase-db-reset} - - - -```sh -supabase db reset [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for reset -``` - - - -
-
- -## Manage remote databases {#supabase-db-remote} - - - - - -**Available Commands** - -- - supabase db remote changes - - -- - supabase db remote commit - - - - -**Options** - -```sh - -h, --help help for remote - -p, --password string Password to your remote Postgres database. -``` - - - -
-
- -### Commit remote changes as a new migration {#supabase-db-remote-commit} - - - -```sh -supabase db remote commit [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for commit -``` - - - -
-
- -### Show changes on the remote database {#supabase-db-remote-changes} - - - -Show changes on the remote database since last migration. - -```sh -supabase db remote changes [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for changes -``` - - - -
-
- -### Push new migrations to the remote database {#supabase-db-push} - - - -```sh -supabase db push [flags] -``` - - - - - -**Options** - -```sh - --dry-run Print the migrations that would be applied, but don't actually apply them. - -h, --help help for push - -p, --password string Password to your remote Postgres database. -``` - - - -
-
- -### Diffs the local database for schema changes {#supabase-db-diff} - - - -```sh -supabase db diff [flags] -``` - - - - - -**Options** - -```sh - -f, --file string Saves schema diff to a file. - -h, --help help for diff - -s, --schema strings List of schema to include. (default [public]) - --use-migra Use migra to generate schema diff. -``` - - - -
-
- -## Manage local database branches {#supabase-db-branch} - - - -Manage local database branches. Each branch is associated with a separate local database. Forking remote databases is NOT supported. - - - -**Available Commands** - -- - supabase db branch create - - -- - supabase db branch delete - - -- - supabase db branch list - - -- - supabase db branch switch - - - - -**Options** - -```sh - -h, --help help for branch -``` - - - -
-
- -### Switch the active branch {#supabase-db-branch-switch} - - - -```sh -supabase db branch switch [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for switch -``` - - - -
-
- -### List branches {#supabase-db-branch-list} - - - -```sh -supabase db branch list [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for list -``` - - - -
-
- -### Delete a branch {#supabase-db-branch-delete} - - - -```sh -supabase db branch delete [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for delete -``` - - - -
-
- -### Create a branch {#supabase-db-branch-create} - - - -```sh -supabase db branch create [flags] -``` - - - - - -**Options** - -```sh - -h, --help help for create -``` - - diff --git a/apps/reference/_gotrue/config.mdx b/apps/reference/_gotrue/config.mdx index dfa0090df45..9a00a5a380e 100644 --- a/apps/reference/_gotrue/config.mdx +++ b/apps/reference/_gotrue/config.mdx @@ -1,244 +1,35 @@ --- id: config +slug: /config title: Configuration +toc_max_heading_level: 3 --- -## Security + -| Parameter | Type | Description | -| :-------------------------------------------------------------------- | :------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `SITE_URL` | `string` | **Required**. The base URL your site is located at. Currently used in combination with other settings to construct URLs used in emails. Any URI that shares a host with `SITE_URL` is a permitted value for `redirect_to` params (see `/authorize` etc.). | -| `URI_ALLOW_LIST` | `string` | A comma separated list of URIs (e.g. `"https://foo.example.com,https://*.foo.example.com"`) which are permitted as valid `redirect_to` destinations. Defaults to [ ].

Supports wildcard matching through globbing. (e.g. `https://*.foo.example.com` will allow `https://a.foo.example.com` and `https://b.foo.example.com` to be accepted.)

Globbing is also supported on subdomains. (e.g. `https://foo.example.com/*` will allow `https://foo.example.com/page1` and `https://foo.example.com/page2` to be accepted.)
For more common glob patterns, check out the [following link](https://pkg.go.dev/github.com/gobwas/glob#Compile). | -| `OPERATOR_TOKEN` | `string` | The shared secret with an operator for this microservice. Used to verify requests have been proxied through the operator and the payload values can be trusted. | -| `DISABLE_SIGNUP` | `bool` | When signup is disabled the only way to create new users is through invites. Defaults to `false`, all signups enabled. | -| `EXTERNAL_EMAIL_ENABLED` | `bool` | Use this to disable email signups (users can still use external oauth providers to sign up / sign in) | -| `EXTERNAL_PHONE_ENABLED` | `bool` | Use this to disable phone signups (users can still use external oauth providers to sign up / sign in) | -| `RATE_LIMIT_TOKEN_REFRESH` | `string` | Rate limit the number of requests sent to `/token` | -| `RATE_LIMIT_EMAIL_SENT` | `string` | Rate limit the number of emails sent per hr on the following endpoints: `/signup`, `/invite`, `/magiclink`, `/recover`, `/otp`, & `/user`. | -| `PASSWORD_MIN_LENGTH` | `int` | Minimum password length, defaults to 6. | +A `config.toml` file is generated after running `supabase init`. -These options control additional security settings available in gotrue. If self-hosting, they need to be prefixed with `GOTRUE_SECURITY_` . +This file is located in the `supabase` folder under `supabase/config.toml`. -| Parameter | Type | Description | -| :---------------------------------------------------------------------------------------------------- | :------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `REFRESH_TOKEN_ROTATION_ENABLED` | `bool` | If refresh token rotation is enabled, gotrue will automatically detect malicious attempts to reuse a revoked refresh token. When a malicious attempt is detected, gotrue immediately revokes all tokens that descended from the offending token. | -| `REFRESH_TOKEN_REUSE_INTERVAL` | `string` | This setting is only applicable if `REFRESH_TOKEN_ROTATION_ENABLED` is enabled. The reuse interval for a refresh token allows for exchanging the refresh token multiple times during the interval to support concurrency or offline issues.
During the reuse interval, gotrue will not consider using a revoked token as a malicious attempt and will simply return the child refresh token.
Only the previous revoked token can be reused. Using an old refresh token way before the current valid refresh token will trigger the reuse detection. | -| `CAPTCHA_ENABLED` | `string` | Enables the captcha middleware. | -| `CAPTCHA_PROVIDER` | `string` | The only captcha provider option supported is: `hcaptcha`. | -| `CAPTCHA_SECRET` | `string` | The captcha secret token. Retrieve this from your captcha account. | -| `CAPTCHA_TIMEOUT` | `string` | The http timeout on the captcha request. | -| `UPDATE_PASSWORD_REQUIRE_REAUTHENTICATION` | `bool` | When enabled, this requires a user to reauthenticate before being able to update their password. | -## API -| Parameter | Type | Description | -| :------------------------------------------------------ | :------- | :--------------------------------------------------------------------------------------------- | -| `API_HOST` | `string` | Hostname to listen on. | -| `PORT` | `number` | Port number to listen on. Defaults to `8081`. | -| `REQUEST_ID_HEADER` | `string` | If you wish to inherit a request ID from the incoming request, specify the name in this value. | -## Database + -| Parameter | Type | Description | -| :---------------------------------------------------- | :------- | :-------------------------------------------------------------------------------------------------------------------------------------- | -| `DB_DRIVER` | `string` | **Required**. Chooses what dialect of database you want. Must be `postgres`. | -| `DATABASE_URL` | `string` | **Required**. Connection string for the database. | -| `DB_MAX_POOL_SIZE` | `int` | Sets the maximum number of open connections to the database. Defaults to 0 which is equivalent to an "unlimited" number of connections. | -| `DB_NAMESPACE` | `string` | Specifies the schema in which the tables are to be created in. | +## General {#general} -## JSON Web Tokens (JWT) -| Parameter | Type | Description | -| :---------------------------------------------------------------- | :------- | :----------------------------------------------------------------------------------- | -| `JWT_SECRET` | `string` | **Required**. The secret used to sign JWT tokens with. | -| `JWT_EXP` | `number` | How long tokens are valid for in seconds. Defaults to 3600 (1 hour). | -| `JWT_AUD` | `string` | The default JWT audience. Use audiences to group users. Defaults to `authenticated`. | -| `JWT_ADMIN_GROUP_NAME` | `string` | The name of the admin group (if enabled). Defaults to `admin`. | -| `JWT_DEFAULT_GROUP_NAME` | `string` | The default group to assign all new users to. | -## External Authentication Providers +### `project_id` {#project_id} -We support `apple`, `azure`, `bitbucket`, `discord`, `facebook`, `github`, `gitlab`, `google`, `keycloak`, `linkedin`, `notion`, `spotify`, `slack`, `twitch`, `twitter` and `workos` for external authentication. +A string used to distinguish different Supabase projects on the same host. Defaults to the working directory name when running `supabase init`. -Use the names as the keys underneath `external` to configure each separately. -No external providers are required, but you must provide the required values if you choose to enable any. +
    +
  • Required: true
  • +
  • Default: None
  • +
-| Parameter | Type | Description | -| :------------------------------------------------------------------ | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `EXTERNAL_X_ENABLED` | `bool` | Whether this external provider is enabled or not | -| `EXTERNAL_X_CLIENT_ID` | `string` | **Required**. The OAuth2 Client ID registered with the external provider. | -| `EXTERNAL_X_SECRET` | `string` | **Required**. The OAuth2 Client Secret provided by the external provider when you registered. | -| `EXTERNAL_X_REDIRECT_URI` | `string` | **Required**. Also known as the callback url, this is the URI an OAuth2 provider will redirect to with the `code` and `state` values. | -| `EXTERNAL_X_URL` | `string` | The base URL used for constructing the URLs to request authorization and access tokens. Used by `gitlab` and `keycloak`. For `gitlab` it defaults to `https://gitlab.com`. For `keycloak` you need to set this to your realm url, (e.g. `https://keycloak.example.com/auth/realms/myrealm`) | +
-### Apple OAuth -To try out sign-in with Apple locally, you will need to do the following: - -1. Run GoTrue over `https` via a reverse proxy (like ngrok). -2. Generate the `crt` and `key` file. See [here](https://www.freecodecamp.org/news/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec/) for more information. -3. Generate the `GOTRUE_EXTERNAL_APPLE_SECRET` by following this [post](https://medium.com/identity-beyond-borders/how-to-configure-sign-in-with-apple-77c61e336003)! - -## SMTP Configuration - -Sending email is not required, but highly recommended for password recovery. If `mailer_autoconfirm` is enabled, no emails will be sent out for `signup`, `recovery`, `invite`. Emails will only be sent out for `magiclink`. - -| Parameter | Type | Description | -| :-------------------------------------------------------- | :------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `SMTP_ADMIN_EMAIL` | `string` | **Required**. The `From` email address for all emails sent. | -| `SMTP_HOST` | `string` | **Required**. The mail server hostname to send emails through. | -| `SMTP_PORT` | `string` | **Required**. The port number to connect to the mail server on. | -| `SMTP_USER` | `string` | **Required**. If the mail server requires authentication, the username to use. | -| `SMTP_PASS` | `string` | **Required**. If the mail server requires authentication, the password to use. | -| `SMTP_MAX_FREQUENCY` | `string` | Controls the minimum amount of time that must pass before sending another signup confirmation or password reset email. The value is the number of seconds. Defaults to 60 seconds. | -| `SMTP_SENDER_NAME` | `string` | Sets the name of the sender. Defaults to the `SMTP_ADMIN_EMAIL` if not used. | - -## Email - -These options control the emails sent from GoTrue. - -| Parameter | Type | Description | -| :---------------------------------------------------------------------------------------- | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `MAILER_AUTOCONFIRM` | `bool` | If you do not require email confirmation, you may set this to `true`. Defaults to `false`. | -| `MAILER_SECURE_EMAIL_CHANGE_ENABLED` | `bool` | If `true`, send an email to both the user's current and new email with a confirmation link, otherwise send an email with confirmation link only to new email. Defaults to `true`. | -| `MAILER_OTP_EXP` | `string` | Controls the duration an email link or otp is valid for. Defaults to 24 hrs. | -| `MAILER_URLPATHS_INVITE` | `string` | URL path to use in the user invite email. Defaults to `/`. | -| `MAILER_URLPATHS_CONFIRMATION` | `string` | URL path to use in the signup confirmation email. Defaults to `/`. | -| `MAILER_URLPATHS_RECOVERY` | `string` | URL path to use in the password reset email. Defaults to `/`. | -| `MAILER_URLPATHS_EMAIL_CHANGE` | `string` | URL path to use in the email change confirmation email. Defaults to `/`. | -| `MAILER_SUBJECTS_INVITE` | `string` | Email subject to use for user invite. Defaults to `You have been invited`. | -| `MAILER_SUBJECTS_CONFIRMATION` | `string` | Email subject to use for signup confirmation. Defaults to `Confirm Your Signup`. | -| `MAILER_SUBJECTS_RECOVERY` | `string` | Email subject to use for password reset. Defaults to `Reset Your Password`. | -| `MAILER_SUBJECTS_MAGIC_LINK` | `string` | Email subject to use for magic link email. Defaults to `Your Magic Link`. | -| `MAILER_SUBJECTS_EMAIL_CHANGE` | `string` | Email subject to use for email change confirmation. Defaults to `Confirm Email Change`. | - -## Email Templates - -| Parameter | Type | Description | -| :------------------------------------------------------------------ | :------- | :---------------------------------------------------------------------------------------------------------------------------- | -| `MAILER_TEMPLATES_INVITE` | `string` | URL path to an email template to use when inviting a user. `SiteURL`, `Email`, and `ConfirmationURL` variables are available. | - -Default Content (if template is unavailable): - -```html -

You have been invited

-

- You have been invited to create a user on {{ .SiteURL }}. Follow this link to - accept the invite: -

-

Accept the invite

-``` - -| Parameter | Type | Description | -| :------------------------------------------------------------------------------ | :------- | :-------------------------------------------------------------------------------------------------------------------------------- | -| `MAILER_TEMPLATES_CONFIRMATION` | `string` | URL path to an email template to use when confirming a signup. `SiteURL`, `Email`, and `ConfirmationURL` variables are available. | - -Default Content (if template is unavailable): - -```html -

Confirm your signup

- -

Follow this link to confirm your user:

-

Confirm your mail

-``` - -| Parameter | Type | Description | -| :---------------------------------------------------------------------- | :------- | :--------------------------------------------------------------------------------------------------------------------------------- | -| `MAILER_TEMPLATES_RECOVERY` | `string` | URL path to an email template to use when resetting a password. `SiteURL`, `Email`, and `ConfirmationURL` variables are available. | - -Default Content (if template is unavailable): - -```html -

Reset Password

- -

Follow this link to reset the password for your user:

-

Reset Password

-``` - -| Parameter | Type | Description | -| :-------------------------------------------------------------------------- | :------- | :------------------------------------------------------------------------------------------------------------------------------- | -| `MAILER_TEMPLATES_MAGIC_LINK` | `string` | URL path to an email template to use when sending magic link. `SiteURL`, `Email`, and `ConfirmationURL` variables are available. | - -Default Content (if template is unavailable): - -```html -

Magic Link

- -

Follow this link to login:

-

Log In

-``` - -| Parameter | Type | Description | -| :------------------------------------------------------------------------------ | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `MAILER_TEMPLATES_EMAIL_CHANGE` | `string` | URL path to an email template to use when confirming the change of an email address. `SiteURL`, `Email`, `NewEmail` and `ConfirmationURL` variables are available. | - -Default Content (if template is unavailable): - -```html -

Confirm Change of Email

- -

- Follow this link to confirm the update of your email from {{ .Email }} to {{ - .NewEmail }}: -

-

Change Email

-``` - -### Phone Auth - -These options control the SMS-es sent from GoTrue. - -| Parameter | Type | Description | -| :------------------------------------------------------ | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------- | -| `SMS_AUTOCONFIRM` | `bool` | If you do not require phone confirmation, you may set this to `true`. Defaults to `false`. | -| `SMS_MAX_FREQUENCY` | `number` | Controls the minimum amount of time that must pass before sending another sms otp. The value is the number of seconds. Defaults to 60 (1 minute)). | -| `SMS_OTP_EXP` | `number` | Controls the duration an sms otp is valid for. | -| `SMS_OTP_LENGTH` | `number` | Controls the number of digits of the sms otp sent. Valid otp lengths are between [6 - 10] digits | -| `SMS_PROVIDER` | `string` | Available options are: `twilio`, `messagebird`, `textlocal`, and `vonage` | - -If you're using twilio, you can obtain your credentials from the [twilio dashboard](https://www.twilio.com/docs/usage/requests-to-twilio#credentials): - -You can find the `SMS_TWILIO_ACCOUNT_SID` and `SMS_TWILIO_AUTH_TOKEN` in the account info page of the twilio console dashboard. - -| Parameter | Type | Description | -| :---------------------------------------------------------------------------- | :------- | :------------------------------------------- | -| `SMS_TWILIO_ACCOUNT_SID` | `string` | Your twilio account string identifier (SID). | -| `SMS_TWILIO_AUTH_TOKEN` | `string` | Your twilio auth token. | -| `SMS_TWILIO_MESSAGE_SERVICE_SID` | `string` | Your twilio sender mobile number | - -If you're using MessageBird, you can obtain your credentials from the [MessageBird dashboard](https://dashboard.messagebird.com/en/developers/access): - -| Parameter | Type | Description | -| :-------------------------------------------------------------------- | :------- | :----------------------------------------------------------- | -| `SMS_MESSAGEBIRD_ACCESS_KEY` | `string` | Your MessageBird access key. | -| `SMS_MESSAGEBIRD_ORIGINATOR` | `string` | Your MessageBird sender phone number with + or company name. | - -## Logging - -| Parameter | Type | Description | -| :-------------------------------------- | :------- | :-------------------------------------------------------------------------------------------------------------------------- | -| `LOG_LEVEL` | `string` | Controls what log levels are output. Choose from `panic`, `fatal`, `error`, `warn`, `info`, or `debug`. Defaults to `info`. | -| `LOG_FILE` | `string` | If you wish logs to be written to a file, set `log_file` to a valid file path. | - -## Opentracing - -Currently Datadog is the only tracer supported. - -| Parameter | Type | Description | -| :-------------------------------------------------- | :------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `TRACING_ENABLED` | `bool` | Whether tracing is enabled or not. Defaults to `false`. | -| `TRACING_HOST` | `string` | The tracing destination. (e.g. `GOTRUE_TRACING_HOST=127.0.0.1`) | -| `TRACING_PORT` | `int` | The port for the tracing host. | -| `TRACING_TAGS` | `string` | A comma separated list of key:value pairs. These key value pairs will be added as tags to all opentracing spans. (e.g. `GOTRUE_TRACING_TAGS="tag1:value1,tag2:value2"`) | -| `SERVICE_NAME` | `string` | The name to use for the service. | - -## Webhooks - -| Parameter | Type | Description | -| :---------------------------------------------------------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `WEBHOOK_URL` | `string` | URL of the webhook receiver endpoint. This will be called when events like `validate`, `signup` or `login` occur. | -| `WEBHOOK_SECRET` | `string` | Shared secret to authorize webhook requests. This secret signs the [JSON Web Signature](https://tools.ietf.org/html/draft-ietf-jose-json-web-signature-41) of the request. You _should_ use this to verify the integrity of the request. Otherwise others can feed your webhook receiver with fake data. | -| `WEBHOOK_RETRIES` | `number` | How often GoTrue should try a failed hook. | -| `WEBHOOK_TIMEOUT_SEC` | `number` | Time between retries (in seconds). | -| `WEBHOOK_EVENTS` | `list` | Which events should trigger a webhook. You can provide a comma separated list. For example to listen to all events, provide the values `validate,signup,login`. | diff --git a/apps/reference/_storage/generated/config.mdx b/apps/reference/_storage/generated/config.mdx deleted file mode 100644 index 2cfc75f1a27..00000000000 --- a/apps/reference/_storage/generated/config.mdx +++ /dev/null @@ -1,264 +0,0 @@ ---- -id: config -slug: /config -title: Configuration -toc_max_heading_level: 3 ---- - - - -A sample `.env` file is located in the [storage repository](https://github.com/supabase/storage-api/blob/master/.env.sample). - -Use this file to configure your environment variables for your Storage server. - - - - - - -## General {#general} - - - -### `ANON_KEY` {#ANON_KEY} - -A long-lived JWT with anonymous Postgres privileges. - - -
    -
  • Required: true
  • -
  • Default: None
  • -
- -
- - -### `SERVICE_KEY` {#SERVICE_KEY} - -A long-lived JWT with Postgres privileges to bypass Row Level Security. - - -
    -
  • Required: true
  • -
  • Default: None
  • -
- -
- - -### `TENANT_ID` {#TENANT_ID} - -The ID of a Storage tenant. - - -
    -
  • Required: true
  • -
  • Default: None
  • -
- -
- - -### `REGION` {#REGION} - -Region of your S3 bucket. - - -
    -
  • Required: true
  • -
  • Default: None
  • -
- -
- - -### `GLOBAL_S3_BUCKET` {#GLOBAL_S3_BUCKET} - -Name of your S3 bucket. - - -
    -
  • Required: true
  • -
  • Default: None
  • -
- -
- - -### `POSTGREST_URL` {#POSTGREST_URL} - -The URL of your PostgREST server. - - -
    -
  • Required: true
  • -
  • Default: None
  • -
- -
- - -### `PGRST_JWT_SECRET` {#PGRST_JWT_SECRET} - -A JWT Secret for the PostgREST database. - - -
    -
  • Required: true
  • -
  • Default: None
  • -
- -
- - -### `DATABASE_URL` {#DATABASE_URL} - -The URL of your Postgres database. - - -
    -
  • Required: true
  • -
  • Default: None
  • -
- -
- - -### `PGOPTIONS` {#PGOPTIONS} - -Additional configuration parameters for Postgres startup. - - -
    -
  • Required: true
  • -
  • Default: None
  • -
- -
- - -### `FILE_SIZE_LIMIT` {#FILE_SIZE_LIMIT} - -The maximum file size allowed. - - -
    -
  • Required: true
  • -
  • Default: None
  • -
- -
- - -### `STORAGE_BACKEND` {#STORAGE_BACKEND} - -The storage provider. - - -
    -
  • Required: true
  • -
  • Default: None
  • -
- -
- - -### `FILE_STORAGE_BACKEND_PATH` {#FILE_STORAGE_BACKEND_PATH} - -The location storage when the "STORAGE_BACKEND" is set to "file". - - -
    -
  • Required: true
  • -
  • Default: None
  • -
- -
- - - - - - -## Multi-tenant {#multitenant} - - - -### `IS_MULTITENANT` {#IS_MULTITENANT} - -Operate across multiple tenants. - - -
    -
  • Required: true
  • -
  • Default: None
  • -
- -
- - -### `MULTITENANT_DATABASE_URL` {#MULTITENANT_DATABASE_URL} - -The URL of the multitenant Postgres database. - - -
    -
  • Required: true
  • -
  • Default: None
  • -
- -
- - -### `X_FORWARDED_HOST_REGEXP` {#X_FORWARDED_HOST_REGEXP} - -TBD. - - -
    -
  • Required: true
  • -
  • Default: None
  • -
- -
- - -### `POSTGREST_URL_SUFFIX` {#POSTGREST_URL_SUFFIX} - -The suffix for the PostgREST instance. - - -
    -
  • Required: true
  • -
  • Default: None
  • -
- -
- - -### `ADMIN_API_KEYS` {#ADMIN_API_KEYS} - -Secure API key for administrative endpoints. - - -
    -
  • Required: true
  • -
  • Default: None
  • -
- -
- - -### `ENCRYPTION_KEY` {#ENCRYPTION_KEY} - -An key for encryting/decrypting secrets. - - -
    -
  • Required: true
  • -
  • Default: None
  • -
- -
- - diff --git a/apps/reference/_storage/generated/usage.mdx b/apps/reference/_storage/generated/usage.mdx deleted file mode 100644 index c7d850ac82b..00000000000 --- a/apps/reference/_storage/generated/usage.mdx +++ /dev/null @@ -1,3452 +0,0 @@ ---- -id: usage -slug: /usage -title: Usage -toc_max_heading_level: 3 ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - - - - -API documentation for Supabase Storage - - - - - - -## Object {#object} - -Object end-points - - - - - -### Delete an object {#delete-an-object} - -``` -DELETE /object/{bucketName}/{wildcard} -``` - - - - -#### Path Parameters - -
    - -
  • -

    - - bucketName - - - required - - - - -

    - -

    - Example: - - avatars - -

    - -
    - -
    -
  • - -
  • -

    - - * - - - required - - - - -

    - -

    - Example: - - folder/cat.png - -

    - -
    - -
    -
  • - -
- - - -#### Header Parameters -
    - -
  • -

    - - authorization - - - required - - - - -

    - -

    - Example: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs - -

    - -
    - -
    -
  • - -
- - - - - - - - - -#### Responses - - - - - -Successful response - - - - -```json -{ - "schema": { - "description": "Successful response", - "type": "object", - "properties": { - "message": { - "type": "string", - "example": "Successfully deleted" - } - } - } -} -``` - - - - - - - - -Error response - - - - -```json -{ - "schema": { - "description": "Error response", - "type": "object", - "properties": { - "statusCode": { - "type": "string" - }, - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "required": [ - "statusCode", - "error", - "message" - ], - "title": "errorSchema" - } -} -``` - - - - - - - - -
- - - - -### Update the object at an existing key {#update-the-object-at-an-existing-key} - -``` -PUT /object/{bucketName}/{wildcard} -``` - - - - -#### Path Parameters - -
    - -
  • -

    - - bucketName - - - required - - - - -

    - -

    - Example: - - avatars - -

    - -
    - -
    -
  • - -
  • -

    - - * - - - required - - - - -

    - -

    - Example: - - folder/cat.png - -

    - -
    - -
    -
  • - -
- - - -#### Header Parameters -
    - -
  • -

    - - authorization - - - required - - - - -

    - -

    - Example: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs - -

    - -
    - -
    -
  • - -
- - - - - - - - - -#### Responses - - - - - -Successful response - - - - -```json -{ - "schema": { - "description": "Successful response", - "type": "object", - "properties": { - "Key": { - "type": "string", - "example": "projectref/avatars/folder/cat.png" - } - }, - "required": [ - "Key" - ] - } -} -``` - - - - - - - - -Error response - - - - -```json -{ - "schema": { - "description": "Error response", - "type": "object", - "properties": { - "statusCode": { - "type": "string" - }, - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "required": [ - "statusCode", - "error", - "message" - ], - "title": "errorSchema" - } -} -``` - - - - - - - - -
- - - - -### Upload a new object {#upload-a-new-object} - -``` -POST /object/{bucketName}/{wildcard} -``` - - - - -#### Path Parameters - -
    - -
  • -

    - - bucketName - - - required - - - - -

    - -

    - Example: - - avatars - -

    - -
    - -
    -
  • - -
  • -

    - - * - - - required - - - - -

    - -

    - Example: - - folder/cat.png - -

    - -
    - -
    -
  • - -
- - - -#### Header Parameters -
    - -
  • -

    - - authorization - - - required - - - - -

    - -

    - Example: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs - -

    - -
    - -
    -
  • - -
- - - - - - - - - -#### Responses - - - - - -Successful response - - - - -```json -{ - "schema": { - "description": "Successful response", - "type": "object", - "properties": { - "Key": { - "type": "string", - "example": "avatars/folder/cat.png" - } - }, - "required": [ - "Key" - ] - } -} -``` - - - - - - - - -Error response - - - - -```json -{ - "schema": { - "description": "Error response", - "type": "object", - "properties": { - "statusCode": { - "type": "string" - }, - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "required": [ - "statusCode", - "error", - "message" - ], - "title": "errorSchema" - } -} -``` - - - - - - - - -
- - - - -### Delete multiple objects {#delete-multiple-objects} - -``` -DELETE /object/{bucketName} -``` - - - - -#### Path Parameters - -
    - -
  • -

    - - bucketName - - - required - - - - -

    - -

    - Example: - - avatars - -

    - -
    - -
    -
  • - -
- - - -#### Header Parameters -
    - -
  • -

    - - authorization - - - required - - - - -

    - -

    - Example: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs - -

    - -
    - -
    -
  • - -
- - - - - - -#### Body Parameters - -```json -{ - "schema": { - "type": "object", - "properties": { - "prefixes": { - "type": "array", - "items": { - "type": "string" - }, - "minItems": 1, - "example": [ - "folder/cat.png", - "folder/morecats.png" - ] - } - }, - "required": [ - "prefixes" - ] - } -} -``` - - - - -#### Responses - - - - - -Successful response - - - - -```json -{ - "schema": { - "description": "Successful response", - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "bucket_id": { - "type": "string" - }, - "owner": { - "type": "string" - }, - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "updated_at": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "created_at": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "last_accessed_at": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ] - }, - "buckets": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "owner": { - "type": "string" - }, - "public": { - "type": "boolean" - }, - "created_at": { - "type": "string" - }, - "updated_at": { - "type": "string" - } - }, - "required": [ - "id", - "name" - ], - "additionalProperties": false, - "example": { - "id": "bucket2", - "name": "bucket2", - "owner": "4d56e902-f0a0-4662-8448-a4d9e643c142", - "created_at": "2021-02-17T04:43:32.770206+00:00", - "updated_at": "2021-02-17T04:43:32.770206+00:00" - } - } - }, - "required": [ - "name" - ], - "additionalProperties": false, - "title": "objectSchema", - "example": { - "name": "folder/cat.png", - "bucket_id": "avatars", - "owner": "317eadce-631a-4429-a0bb-f19a7a517b4a", - "id": "eaa8bdb5-2e00-4767-b5a9-d2502efe2196", - "updated_at": "2021-04-06T16:30:35.394674+00:00", - "created_at": "2021-04-06T16:30:35.394674+00:00", - "last_accessed_at": "2021-04-06T16:30:35.394674+00:00", - "metadata": { - "size": 1234 - } - } - } - } -} -``` - - - - - - - - -Error response - - - - -```json -{ - "schema": { - "description": "Error response", - "type": "object", - "properties": { - "statusCode": { - "type": "string" - }, - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "required": [ - "statusCode", - "error", - "message" - ], - "title": "errorSchema" - } -} -``` - - - - - - - - -
- - - - -### Retrieve an object {#retrieve-an-object} - -``` -GET /object/authenticated/{bucketName}/{wildcard} -``` - - - - -#### Path Parameters - -
    - -
  • -

    - - bucketName - - - required - - - - -

    - -

    - Example: - - avatars - -

    - -
    - -
    -
  • - -
  • -

    - - * - - - required - - - - -

    - -

    - Example: - - folder/cat.png - -

    - -
    - -
    -
  • - -
- - - -#### Header Parameters -
    - -
  • -

    - - authorization - - - required - - - - -

    - -

    - Example: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs - -

    - -
    - -
    -
  • - -
- - - - - - - - - -#### Responses - - - - - -Error response - - - - -```json -{ - "schema": { - "description": "Error response", - "type": "object", - "properties": { - "statusCode": { - "type": "string" - }, - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "required": [ - "statusCode", - "error", - "message" - ], - "title": "errorSchema" - } -} -``` - - - - - - - - -
- - - - -### Generate a presigned url to retrieve an object {#generate-a-presigned-url-to-retrieve-an-object} - -``` -POST /object/sign/{bucketName}/{wildcard} -``` - - - - -#### Path Parameters - -
    - -
  • -

    - - bucketName - - - required - - - - -

    - -

    - Example: - - avatars - -

    - -
    - -
    -
  • - -
  • -

    - - * - - - required - - - - -

    - -

    - Example: - - folder/cat.png - -

    - -
    - -
    -
  • - -
- - - -#### Header Parameters -
    - -
  • -

    - - authorization - - - required - - - - -

    - -

    - Example: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs - -

    - -
    - -
    -
  • - -
- - - - - - -#### Body Parameters - -```json -{ - "schema": { - "type": "object", - "properties": { - "expiresIn": { - "type": "integer", - "minimum": 1, - "example": 60000 - } - }, - "required": [ - "expiresIn" - ] - } -} -``` - - - - -#### Responses - - - - - -Successful response - - - - -```json -{ - "schema": { - "description": "Successful response", - "type": "object", - "properties": { - "signedURL": { - "type": "string", - "example": "/object/sign/avatars/folder/cat.png?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmwiOiJhdmF0YXJzL2ZvbGRlci9jYXQucG5nIiwiaWF0IjoxNjE3NzI2MjczLCJleHAiOjE2MTc3MjcyNzN9.s7Gt8ME80iREVxPhH01ZNv8oUn4XtaWsmiQ5csiUHn4" - } - }, - "required": [ - "signedURL" - ] - } -} -``` - - - - - - - - -Error response - - - - -```json -{ - "schema": { - "description": "Error response", - "type": "object", - "properties": { - "statusCode": { - "type": "string" - }, - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "required": [ - "statusCode", - "error", - "message" - ], - "title": "errorSchema" - } -} -``` - - - - - - - - -
- - - - -### Retrieve an object via a presigned URL {#retrieve-an-object-via-a-presigned-url} - -``` -GET /object/sign/{bucketName}/{wildcard} -``` - - - - -#### Path Parameters - -
    - -
  • -

    - - bucketName - - - required - - - - -

    - -

    - Example: - - avatars - -

    - -
    - -
    -
  • - -
  • -

    - - * - - - required - - - - -

    - -

    - Example: - - folder/cat.png - -

    - -
    - -
    -
  • - -
- - - - - - - - - - - -#### Responses - - - - - -Error response - - - - -```json -{ - "schema": { - "description": "Error response", - "type": "object", - "properties": { - "statusCode": { - "type": "string" - }, - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "required": [ - "statusCode", - "error", - "message" - ], - "title": "errorSchema" - } -} -``` - - - - - - - - -
- - - - -### Generate presigned urls to retrieve objects {#generate-presigned-urls-to-retrieve-objects} - -``` -POST /object/sign/{bucketName} -``` - - - - -#### Path Parameters - -
    - -
  • -

    - - bucketName - - - required - - - - -

    - -

    - Example: - - avatars - -

    - -
    - -
    -
  • - -
- - - -#### Header Parameters -
    - -
  • -

    - - authorization - - - required - - - - -

    - -

    - Example: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs - -

    - -
    - -
    -
  • - -
- - - - - - -#### Body Parameters - -```json -{ - "schema": { - "type": "object", - "properties": { - "expiresIn": { - "type": "integer", - "minimum": 1, - "example": 60000 - }, - "paths": { - "type": "array", - "items": { - "type": "string" - }, - "minItems": 1, - "example": [ - "folder/cat.png", - "folder/morecats.png" - ] - } - }, - "required": [ - "expiresIn", - "paths" - ] - } -} -``` - - - - -#### Responses - - - - - -Successful response - - - - -```json -{ - "schema": { - "description": "Successful response", - "type": "array", - "items": { - "type": "object", - "properties": { - "error": { - "error": [ - "string", - "null" - ], - "example": "Either the object does not exist or you do not have access to it" - }, - "path": { - "type": "string", - "example": "folder/cat.png" - }, - "signedURL": { - "type": [ - "string", - "null" - ], - "example": "/object/sign/avatars/folder/cat.png?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmwiOiJhdmF0YXJzL2ZvbGRlci9jYXQucG5nIiwiaWF0IjoxNjE3NzI2MjczLCJleHAiOjE2MTc3MjcyNzN9.s7Gt8ME80iREVxPhH01ZNv8oUn4XtaWsmiQ5csiUHn4" - } - }, - "required": [ - "error", - "path", - "signedURL" - ] - } - } -} -``` - - - - - - - - -Error response - - - - -```json -{ - "schema": { - "description": "Error response", - "type": "object", - "properties": { - "statusCode": { - "type": "string" - }, - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "required": [ - "statusCode", - "error", - "message" - ], - "title": "errorSchema" - } -} -``` - - - - - - - - -
- - - - -### Moves an object {#moves-an-object} - -``` -POST /object/move -``` - - - - - - -#### Header Parameters -
    - -
  • -

    - - authorization - - - required - - - - -

    - -

    - Example: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs - -

    - -
    - -
    -
  • - -
- - - - - - -#### Body Parameters - -```json -{ - "schema": { - "type": "object", - "properties": { - "bucketId": { - "type": "string", - "example": "avatars" - }, - "sourceKey": { - "type": "string", - "example": "folder/cat.png" - }, - "destinationKey": { - "type": "string", - "example": "folder/newcat.png" - } - }, - "required": [ - "bucketId", - "sourceKey", - "destinationKey" - ] - } -} -``` - - - - -#### Responses - - - - - -Successful response - - - - -```json -{ - "schema": { - "description": "Successful response", - "type": "object", - "properties": { - "message": { - "type": "string", - "example": "Successfully moved" - } - }, - "required": [ - "message" - ] - } -} -``` - - - - - - - - -Error response - - - - -```json -{ - "schema": { - "description": "Error response", - "type": "object", - "properties": { - "statusCode": { - "type": "string" - }, - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "required": [ - "statusCode", - "error", - "message" - ], - "title": "errorSchema" - } -} -``` - - - - - - - - -
- - - - -### Search for objects under a prefix {#search-for-objects-under-a-prefix} - -``` -POST /object/list/{bucketName} -``` - - - - -#### Path Parameters - -
    - -
  • -

    - - bucketName - - - required - - - - -

    - -
    - -
    -
  • - -
- - - -#### Header Parameters -
    - -
  • -

    - - authorization - - - required - - - - -

    - -

    - Example: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs - -

    - -
    - -
    -
  • - -
- - - - - - -#### Body Parameters - -```json -{ - "schema": { - "type": "object", - "properties": { - "prefix": { - "type": "string", - "example": "folder/subfolder" - }, - "limit": { - "type": "integer", - "minimum": 1, - "example": 10 - }, - "offset": { - "type": "integer", - "minimum": 0, - "example": 0 - }, - "sortBy": { - "type": "object", - "properties": { - "column": { - "type": "string", - "enum": [ - "name", - "updated_at", - "created_at", - "last_accessed_at" - ] - }, - "order": { - "type": "string", - "enum": [ - "asc", - "desc" - ] - } - }, - "required": [ - "column" - ] - }, - "search": { - "type": "string" - } - }, - "required": [ - "prefix" - ] - } -} -``` - - - - -#### Responses - - - - - -Successful response - - - - -```json -{ - "schema": { - "description": "Successful response", - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "bucket_id": { - "type": "string" - }, - "owner": { - "type": "string" - }, - "id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "updated_at": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "created_at": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "last_accessed_at": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - }, - "metadata": { - "anyOf": [ - { - "type": "object", - "additionalProperties": true - }, - { - "type": "null" - } - ] - }, - "buckets": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "owner": { - "type": "string" - }, - "public": { - "type": "boolean" - }, - "created_at": { - "type": "string" - }, - "updated_at": { - "type": "string" - } - }, - "required": [ - "id", - "name" - ], - "additionalProperties": false, - "example": { - "id": "bucket2", - "name": "bucket2", - "owner": "4d56e902-f0a0-4662-8448-a4d9e643c142", - "created_at": "2021-02-17T04:43:32.770206+00:00", - "updated_at": "2021-02-17T04:43:32.770206+00:00" - } - } - }, - "required": [ - "name" - ], - "additionalProperties": false, - "example": { - "name": "folder/cat.png", - "bucket_id": "avatars", - "owner": "317eadce-631a-4429-a0bb-f19a7a517b4a", - "id": "eaa8bdb5-2e00-4767-b5a9-d2502efe2196", - "updated_at": "2021-04-06T16:30:35.394674+00:00", - "created_at": "2021-04-06T16:30:35.394674+00:00", - "last_accessed_at": "2021-04-06T16:30:35.394674+00:00", - "metadata": { - "size": 1234 - } - } - } - } -} -``` - - - - - - - - -Error response - - - - -```json -{ - "schema": { - "description": "Error response", - "type": "object", - "properties": { - "statusCode": { - "type": "string" - }, - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "required": [ - "statusCode", - "error", - "message" - ], - "title": "errorSchema" - } -} -``` - - - - - - - - -
- - - - -### Copies an object {#copies-an-object} - -``` -POST /object/copy -``` - - - - - - -#### Header Parameters -
    - -
  • -

    - - authorization - - - required - - - - -

    - -

    - Example: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs - -

    - -
    - -
    -
  • - -
- - - - - - -#### Body Parameters - -```json -{ - "schema": { - "type": "object", - "properties": { - "sourceKey": { - "type": "string", - "example": "folder/source.png" - }, - "bucketId": { - "type": "string", - "example": "avatars" - }, - "destinationKey": { - "type": "string", - "example": "folder/destination.png" - } - }, - "required": [ - "sourceKey", - "bucketId", - "destinationKey" - ] - } -} -``` - - - - -#### Responses - - - - - -Successful response - - - - -```json -{ - "schema": { - "description": "Successful response", - "type": "object", - "properties": { - "Key": { - "type": "string", - "example": "folder/destination.png" - } - }, - "required": [ - "Key" - ] - } -} -``` - - - - - - - - -Error response - - - - -```json -{ - "schema": { - "description": "Error response", - "type": "object", - "properties": { - "statusCode": { - "type": "string" - }, - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "required": [ - "statusCode", - "error", - "message" - ], - "title": "errorSchema" - } -} -``` - - - - - - - - -
- - - - -### Retrieve an object from a public bucket {#retrieve-an-object-from-a-public-bucket} - -``` -GET /object/public/{bucketName}/{wildcard} -``` - - - - -#### Path Parameters - -
    - -
  • -

    - - bucketName - - - required - - - - -

    - -

    - Example: - - avatars - -

    - -
    - -
    -
  • - -
  • -

    - - * - - - required - - - - -

    - -

    - Example: - - folder/cat.png - -

    - -
    - -
    -
  • - -
- - - - - - - - - - - -#### Responses - - - - - -Error response - - - - -```json -{ - "schema": { - "description": "Error response", - "type": "object", - "properties": { - "statusCode": { - "type": "string" - }, - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "required": [ - "statusCode", - "error", - "message" - ], - "title": "errorSchema" - } -} -``` - - - - - - - - -
- - - -## Bucket {#bucket} - -Bucket end-points - - - - - -### Create a bucket {#create-a-bucket} - -``` -POST /bucket/ -``` - - - - - - -#### Header Parameters -
    - -
  • -

    - - authorization - - - required - - - - -

    - -

    - Example: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs - -

    - -
    - -
    -
  • - -
- - - - - - -#### Body Parameters - -```json -{ - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "example": "avatars" - }, - "id": { - "type": "string", - "example": "avatars" - }, - "public": { - "type": "boolean", - "example": false - } - }, - "required": [ - "name" - ] - } -} -``` - - - - -#### Responses - - - - - -Successful response - - - - -```json -{ - "schema": { - "description": "Successful response", - "type": "object", - "properties": { - "name": { - "type": "string", - "example": "avatars" - } - }, - "required": [ - "name" - ] - } -} -``` - - - - - - - - -Error response - - - - -```json -{ - "schema": { - "description": "Error response", - "type": "object", - "properties": { - "statusCode": { - "type": "string" - }, - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "required": [ - "statusCode", - "error", - "message" - ], - "title": "errorSchema" - } -} -``` - - - - - - - - -
- - - - -### Gets all buckets {#gets-all-buckets} - -``` -GET /bucket/ -``` - - - - - - -#### Header Parameters -
    - -
  • -

    - - authorization - - - required - - - - -

    - -

    - Example: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs - -

    - -
    - -
    -
  • - -
- - - - - - - - - -#### Responses - - - - - -Successful response - - - - -```json -{ - "schema": { - "description": "Successful response", - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "owner": { - "type": "string" - }, - "public": { - "type": "boolean" - }, - "created_at": { - "type": "string" - }, - "updated_at": { - "type": "string" - } - }, - "required": [ - "id", - "name" - ], - "additionalProperties": false, - "title": "bucketSchema", - "example": { - "id": "bucket2", - "name": "bucket2", - "owner": "4d56e902-f0a0-4662-8448-a4d9e643c142", - "created_at": "2021-02-17T04:43:32.770206+00:00", - "updated_at": "2021-02-17T04:43:32.770206+00:00" - } - }, - "example": [ - { - "id": "bucket2", - "name": "bucket2", - "owner": "4d56e902-f0a0-4662-8448-a4d9e643c142", - "created_at": "2021-02-17T04:43:32.770206+00:00", - "updated_at": "2021-02-17T04:43:32.770206+00:00" - } - ] - }, - "example": [ - { - "id": "bucket2", - "name": "bucket2", - "owner": "4d56e902-f0a0-4662-8448-a4d9e643c142", - "created_at": "2021-02-17T04:43:32.770206+00:00", - "updated_at": "2021-02-17T04:43:32.770206+00:00" - } - ] -} -``` - - - - - - - - -Error response - - - - -```json -{ - "schema": { - "description": "Error response", - "type": "object", - "properties": { - "statusCode": { - "type": "string" - }, - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "required": [ - "statusCode", - "error", - "message" - ], - "title": "errorSchema" - } -} -``` - - - - - - - - -
- - - - -### Empty a bucket {#empty-a-bucket} - -``` -POST /bucket/{bucketId}/empty -``` - - - - -#### Path Parameters - -
    - -
  • -

    - - bucketId - - - required - - - - -

    - -

    - Example: - - avatars - -

    - -
    - -
    -
  • - -
- - - -#### Header Parameters -
    - -
  • -

    - - authorization - - - required - - - - -

    - -

    - Example: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs - -

    - -
    - -
    -
  • - -
- - - - - - - - - -#### Responses - - - - - -Successful response - - - - -```json -{ - "schema": { - "description": "Successful response", - "type": "object", - "properties": { - "message": { - "type": "string", - "example": "Successfully emptied" - } - } - } -} -``` - - - - - - - - -Error response - - - - -```json -{ - "schema": { - "description": "Error response", - "type": "object", - "properties": { - "statusCode": { - "type": "string" - }, - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "required": [ - "statusCode", - "error", - "message" - ], - "title": "errorSchema" - } -} -``` - - - - - - - - -
- - - - -### Get details of a bucket {#get-details-of-a-bucket} - -``` -GET /bucket/{bucketId} -``` - - - - -#### Path Parameters - -
    - -
  • -

    - - bucketId - - - required - - - - -

    - -

    - Example: - - avatars - -

    - -
    - -
    -
  • - -
- - - -#### Header Parameters -
    - -
  • -

    - - authorization - - - required - - - - -

    - -

    - Example: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs - -

    - -
    - -
    -
  • - -
- - - - - - - - - -#### Responses - - - - - -Successful response - - - - -```json -{ - "schema": { - "description": "Successful response", - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "owner": { - "type": "string" - }, - "public": { - "type": "boolean" - }, - "created_at": { - "type": "string" - }, - "updated_at": { - "type": "string" - } - }, - "required": [ - "id", - "name" - ], - "additionalProperties": false, - "example": { - "id": "bucket2", - "name": "bucket2", - "owner": "4d56e902-f0a0-4662-8448-a4d9e643c142", - "created_at": "2021-02-17T04:43:32.770206+00:00", - "updated_at": "2021-02-17T04:43:32.770206+00:00" - } - }, - "example": { - "id": "bucket2", - "name": "bucket2", - "owner": "4d56e902-f0a0-4662-8448-a4d9e643c142", - "created_at": "2021-02-17T04:43:32.770206+00:00", - "updated_at": "2021-02-17T04:43:32.770206+00:00" - } -} -``` - - - - - - - - -Error response - - - - -```json -{ - "schema": { - "description": "Error response", - "type": "object", - "properties": { - "statusCode": { - "type": "string" - }, - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "required": [ - "statusCode", - "error", - "message" - ], - "title": "errorSchema" - } -} -``` - - - - - - - - -
- - - - -### Update properties of a bucket {#update-properties-of-a-bucket} - -``` -PUT /bucket/{bucketId} -``` - - - - - - -#### Header Parameters -
    - -
  • -

    - - authorization - - - required - - - - -

    - -

    - Example: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs - -

    - -
    - -
    -
  • - -
- - - - - - -#### Body Parameters - -```json -{ - "schema": { - "type": "object", - "properties": { - "public": { - "type": "boolean", - "example": false - } - } - } -} -``` - - - - -#### Responses - - - - - -Successful response - - - - -```json -{ - "schema": { - "description": "Successful response", - "type": "object", - "properties": { - "message": { - "type": "string", - "example": "Successfully updated" - } - }, - "required": [ - "message" - ] - } -} -``` - - - - - - - - -Error response - - - - -```json -{ - "schema": { - "description": "Error response", - "type": "object", - "properties": { - "statusCode": { - "type": "string" - }, - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "required": [ - "statusCode", - "error", - "message" - ], - "title": "errorSchema" - } -} -``` - - - - - - - - -
- - - - -### Delete a bucket {#delete-a-bucket} - -``` -DELETE /bucket/{bucketId} -``` - - - - -#### Path Parameters - -
    - -
  • -

    - - bucketId - - - required - - - - -

    - -

    - Example: - - avatars - -

    - -
    - -
    -
  • - -
- - - -#### Header Parameters -
    - -
  • -

    - - authorization - - - required - - - - -

    - -

    - Example: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs - -

    - -
    - -
    -
  • - -
- - - - - - - - - -#### Responses - - - - - -Successful response - - - - -```json -{ - "schema": { - "description": "Successful response", - "type": "object", - "properties": { - "message": { - "type": "string", - "example": "Successfully deleted" - } - } - } -} -``` - - - - - - - - -Error response - - - - -```json -{ - "schema": { - "description": "Error response", - "type": "object", - "properties": { - "statusCode": { - "type": "string" - }, - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "required": [ - "statusCode", - "error", - "message" - ], - "title": "errorSchema" - } -} -``` - - - - - - - - -
- - - -## Deprecated {#deprecated} - -Deprecated end-points - - - - - -### Get object {#get-object} - -``` -GET /object/{bucketName}/{wildcard} -``` - - - - -#### Path Parameters - -
    - -
  • -

    - - bucketName - - - required - - - - -

    - -

    - Example: - - avatars - -

    - -
    - -
    -
  • - -
  • -

    - - * - - - required - - - - -

    - -

    - Example: - - folder/cat.png - -

    - -
    - -
    -
  • - -
- - - -#### Header Parameters -
    - -
  • -

    - - authorization - - - required - - - - -

    - -

    - Example: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs - -

    - -
    - -
    -
  • - -
- - - - - - - - - -#### Responses - - - - - -Default Response - - - - -```json -{ - "schema": { - "type": "object", - "properties": { - "statusCode": { - "type": "string" - }, - "error": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "required": [ - "statusCode", - "error", - "message" - ], - "title": "errorSchema" - } -} -``` - - - - - - - - -
- diff --git a/apps/reference/_supabase_dart/generated/auth-onauthstatechange.mdx b/apps/reference/_supabase_dart/generated/auth-onauthstatechange.mdx deleted file mode 100644 index 20bea627851..00000000000 --- a/apps/reference/_supabase_dart/generated/auth-onauthstatechange.mdx +++ /dev/null @@ -1,29 +0,0 @@ ---- -id: auth-onauthstatechange -title: 'auth.onAuthStateChange()' -slug: /auth-onauthstatechange -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Receive a notification every time an auth event happens. - -```dart -final subscription = supabase.auth.onAuthStateChange((event, session) { - print(session?.user?.id); - // handle auth state change -}); -``` - -## Examples - -### Listen to auth changes - -```dart -final subscription = supabase.auth.onAuthStateChange((event, session) { - print(session?.user?.id); - // handle auth state change -}); -``` diff --git a/apps/reference/_supabase_dart/generated/auth-session.mdx b/apps/reference/_supabase_dart/generated/auth-session.mdx deleted file mode 100644 index 2695de7e177..00000000000 --- a/apps/reference/_supabase_dart/generated/auth-session.mdx +++ /dev/null @@ -1,23 +0,0 @@ ---- -id: auth-session -title: 'auth.session()' -slug: /auth-session -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Returns the session data, if there is an active session. - -```dart -final Session? session = supabase.auth.currentSession; -``` - -## Examples - -### Get the session data - -```dart -final Session? session = supabase.auth.currentSession; -``` diff --git a/apps/reference/_supabase_dart/generated/auth-signin.mdx b/apps/reference/_supabase_dart/generated/auth-signin.mdx deleted file mode 100644 index 93c12ffd39b..00000000000 --- a/apps/reference/_supabase_dart/generated/auth-signin.mdx +++ /dev/null @@ -1,54 +0,0 @@ ---- -id: auth-signin -title: 'auth.signIn()' -slug: /auth-signin -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Log in an existing user, or login via a third-party provider. - -```dart -final GotrueSessionResponse res = await supabase.auth.signIn(email: 'example@email.com', password: 'example-password'); - -final User? user = res.user; -``` - -## Notes - -- A user can sign up via email, phone number. -- If you provide `email` without a `password`, the user will be sent a magic link. -- The magic link's destination URL is determined by the SITE_URL config variable. To change this, you can go to Authentication -> Settings on [app.supabase.com](https://app.supabase.com) -- Similarly, if you provide `phone` without a `password`, the user will be sent a one time password. -- If you are looking to sign users in with OAuth in Flutter apps, go to [`signInWithProvider()`](/docs/reference/dart/auth-signinwithprovider). - -## Examples - -### Sign in with email. - -```dart -final GotrueSessionResponse res = await supabase.auth.signIn(email: 'example@email.com', password: 'example-password'); - -final User? user = res.user; -``` - -### Sign in with magic link. - -If email is provided, but no password is provided, the user will be sent a "magic link" to their email address, which they can click to open your application with a valid session. By default, a given user can only request a Magic Link once every 60 seconds. - -```dart -final GotrueSessionResponse res = await supabase.auth.signIn(email: 'example@email.com'); -``` - -### Get OAuth sign in URL. - -Passing provider parameter to `signIn()` will return a URL to sign your user in via OAuth. -If you are looking to sign in a user via OAuth on Flutter app, go to [`signInWithProvider()`](/docs/reference/dart/auth-signinwithprovider). - -```dart -final GotrueSessionResponse res = await supabase.auth.signIn(provider: Provider.github); - -final User? user = res.user; -``` diff --git a/apps/reference/_supabase_dart/generated/auth-signinwithprovider.mdx b/apps/reference/_supabase_dart/generated/auth-signinwithprovider.mdx deleted file mode 100644 index cc7078af3f4..00000000000 --- a/apps/reference/_supabase_dart/generated/auth-signinwithprovider.mdx +++ /dev/null @@ -1,55 +0,0 @@ ---- -id: auth-signinwithprovider -title: 'auth.signInWithProvider()' -slug: /auth-signinwithprovider -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Signs the user in using third party OAuth providers. - -```dart -await supabase.auth.signInWithProvider(Provider.github); -``` - -## Notes - -- `auth.signInWithProvider()` is only available on `supabase_flutter` -- It will open the browser to the relevant login page. - -## Examples - -### Sign in with provider. - -```dart -await supabase.auth.signInWithProvider(Provider.github); -``` - -### With `redirectTo` - -Specify the redirect link to bring back the user via deeplink. -Note that `redirectTo` should be null for Flutter Web. - -```dart -await supabase.auth.signInWithProvider(Provider.github, - options: const AuthOptions( - redirectTo: - kIsWeb ? null : 'io.supabase.flutter://reset-callback/')); -``` - -### With scopes - -If you need additional data from an OAuth provider, you can include a space-separated list of scopes in your request to get back an OAuth provider token. -You may also need to specify the scopes in the provider's OAuth app settings, depending on the provider. - -```dart -await supabase.auth.signInWithProvider(Provider.github, - options: const AuthOptions(scopes: 'repo gist notifications')); -... -// after user comes back from signin flow - -final Session? session = supabase.auth.currentSession; -final String? oAuthToken = session?.providerToken; -``` diff --git a/apps/reference/_supabase_dart/generated/auth-signout.mdx b/apps/reference/_supabase_dart/generated/auth-signout.mdx deleted file mode 100644 index 9a85917e778..00000000000 --- a/apps/reference/_supabase_dart/generated/auth-signout.mdx +++ /dev/null @@ -1,23 +0,0 @@ ---- -id: auth-signout -title: 'auth.signOut()' -slug: /auth-signout -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Signs out the current user, if there is a logged in user. - -```dart -await supabase.auth.signOut(); -``` - -## Examples - -### Sign out - -```dart -await supabase.auth.signOut(); -``` diff --git a/apps/reference/_supabase_dart/generated/auth-signup.mdx b/apps/reference/_supabase_dart/generated/auth-signup.mdx deleted file mode 100644 index 1174fb7a608..00000000000 --- a/apps/reference/_supabase_dart/generated/auth-signup.mdx +++ /dev/null @@ -1,38 +0,0 @@ ---- -id: auth-signup -title: 'auth.signUp()' -slug: /auth-signup -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Creates a new user. - -```dart -final GotrueSessionResponse res = await supabase.auth.signUp('example@email.com', 'example-password'); - -final User? user = res.user; -``` - -## Notes - -- By default, the user will need to verify their email address before logging in. If you would like to change this, you can disable "Email Confirmations" by going to Authentication -> Settings on [app.supabase.com](https://app.supabase.com) -- If "Email Confirmations" is turned on, a user is returned but session will be null -- If "Email Confirmations" is turned off, both a `user` and a `session` will be returned -- When the user confirms their email address, they will be redirected to localhost:3000 by default. To change this, you can go to Authentication -> Settings on [app.supabase.com](https://app.supabase.com) - -## Examples - -### Sign up. - -```dart -final GotrueSessionResponse res = await supabase.auth.signUp('example@email.com', 'example-password'); - -final User? user = res.user; -``` - -### Sign up with third-party providers. - -If you are using Flutter, you can sign up with OAuth providers using the [`signInWithProvider()`](/docs/reference/dart/auth-signinwithprovider) method available on `supabase_flutter`. diff --git a/apps/reference/_supabase_dart/generated/auth-update.mdx b/apps/reference/_supabase_dart/generated/auth-update.mdx deleted file mode 100644 index 1d95999e765..00000000000 --- a/apps/reference/_supabase_dart/generated/auth-update.mdx +++ /dev/null @@ -1,28 +0,0 @@ ---- -id: auth-update -title: 'auth.update()' -slug: /auth-update -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Updates user data, if there is a logged in user. - -```dart -final GotrueUserResponse res = await supabase.auth.update(UserAttributes(data: {'hello': 'world'})); -``` - -## Notes - -It's generally better to store user data in a table inside your public schema (i.e. `public.users`). -Use the `update()` method if you have data which rarely changes or is specific only to the logged in user. - -## Examples - -### Update a user's metadata. - -```dart -final GotrueUserResponse res = await supabase.auth.update(UserAttributes(data: {'hello': 'world'})); -``` diff --git a/apps/reference/_supabase_dart/generated/auth-user.mdx b/apps/reference/_supabase_dart/generated/auth-user.mdx deleted file mode 100644 index 25be1f9609c..00000000000 --- a/apps/reference/_supabase_dart/generated/auth-user.mdx +++ /dev/null @@ -1,23 +0,0 @@ ---- -id: auth-user -title: 'auth.user()' -slug: /auth-user -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Returns the user data, if there is a logged in user. - -```dart -final User? user = supabase.auth.currentUser; -``` - -## Examples - -### Get the logged in user - -```dart -final User? user = supabase.auth.currentUser; -``` diff --git a/apps/reference/_supabase_dart/generated/containedby.mdx b/apps/reference/_supabase_dart/generated/containedby.mdx deleted file mode 100644 index 0e09e8326fd..00000000000 --- a/apps/reference/_supabase_dart/generated/containedby.mdx +++ /dev/null @@ -1,54 +0,0 @@ ---- -id: containedby -title: '.containedBy()' -slug: /containedby -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```dart -final data = await supabase - .from('countries') - .select('name, id, main_exports') - .containedBy('main_exports', ['cars', 'food', 'machine']); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('countries') - .select('name, id, main_exports') - .containedBy('main_exports', ['cars', 'food', 'machine']); -``` - -### With `update()` - -```dart -final data = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .containedBy('main_exports', ['orks', 'surveillance', 'evil']); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('countries') - .delete() - .containedBy('main_exports', ['cars', 'food', 'machine']); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_countries') - .containedBy('main_exports', ['cars', 'food', 'machine']); -``` diff --git a/apps/reference/_supabase_dart/generated/contains.mdx b/apps/reference/_supabase_dart/generated/contains.mdx deleted file mode 100644 index c1a7823d494..00000000000 --- a/apps/reference/_supabase_dart/generated/contains.mdx +++ /dev/null @@ -1,54 +0,0 @@ ---- -id: contains -title: '.contains()' -slug: /contains -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```dart -final data = await supabase - .from('countries') - .select('name, id, main_exports') - .contains('main_exports', ['oil']); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('countries') - .select('name, id, main_exports') - .contains('main_exports', ['oil']); -``` - -### With `update()` - -```dart -final data = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .contains('main_exports', ['oil']); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('countries') - .delete() - .contains('main_exports', ['oil']); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_countries') - .contains('main_exports', ['oil']); -``` diff --git a/apps/reference/_supabase_dart/generated/delete.mdx b/apps/reference/_supabase_dart/generated/delete.mdx deleted file mode 100644 index d94a6df55bf..00000000000 --- a/apps/reference/_supabase_dart/generated/delete.mdx +++ /dev/null @@ -1,33 +0,0 @@ ---- -id: delete -title: 'Delete data: delete()' -slug: /delete -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Performs a DELETE on the table. - -```dart -final data = await supabase - .from('cities') - .delete() - .match({ 'id': 666 }); -``` - -## Notes - -- `delete()` should always be combined with [Filters](/docs/reference/dart/using-filters) to target the item(s) you wish to delete. - -## Examples - -### Delete records - -```dart -final data = await supabase - .from('cities') - .delete() - .match({ 'id': 666 }); -``` diff --git a/apps/reference/_supabase_dart/generated/eq.mdx b/apps/reference/_supabase_dart/generated/eq.mdx deleted file mode 100644 index 1cb74567cc5..00000000000 --- a/apps/reference/_supabase_dart/generated/eq.mdx +++ /dev/null @@ -1,56 +0,0 @@ ---- -id: eq -title: '.eq()' -slug: /eq -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` exactly matches the specified `value`. - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'The shire'); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'The shire'); -``` - -### With `update()` - -```dart -final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .eq('name', 'San Francisco'); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('cities') - .delete() - .eq('name', 'Mordor'); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_cities') - .eq('name', 'San Francisco'); -``` diff --git a/apps/reference/_supabase_dart/generated/filter.mdx b/apps/reference/_supabase_dart/generated/filter.mdx deleted file mode 100644 index 253945c18ad..00000000000 --- a/apps/reference/_supabase_dart/generated/filter.mdx +++ /dev/null @@ -1,75 +0,0 @@ ---- -id: filter -title: '.filter()' -slug: /filter -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose `column` satisfies the filter. - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .filter('name', 'in', '("Paris","Tokyo")'); -``` - -## Notes - -- `.filter()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values, so it should only be used as an escape hatch in case other filters don't work. - ```dart - .filter('arraycol','cs','{"a","b"}') // Use Postgres array {} and 'cs' for contains. - .filter('rangecol','cs','(1,2]') // Use Postgres range syntax for range column. - .filter('id','in','(6,7)') // Use Postgres list () and 'in' for in_ filter. - .filter('id','cs','{${mylist.join(',')}}') // You can insert a Dart array list. - ``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .filter('name', 'in', '("Paris","Tokyo")'); -``` - -### With `update()` - -```dart -final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .filter('name', 'in', '("Paris","Tokyo")'); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('cities') - .delete() - .filter('name', 'in', '("Paris","Tokyo")'); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_cities') - .filter('name', 'in', '("Paris","Tokyo")') -``` - -### Filter embedded resources - -```dart -final data = await supabase - .from('cities') - .select('name, countries ( name )') - .filter('countries.name', 'in', '("France","Japan")'); -``` diff --git a/apps/reference/_supabase_dart/generated/getchannels.mdx b/apps/reference/_supabase_dart/generated/getchannels.mdx deleted file mode 100644 index 3f01145853f..00000000000 --- a/apps/reference/_supabase_dart/generated/getchannels.mdx +++ /dev/null @@ -1,23 +0,0 @@ ---- -id: getchannels -title: 'getChannels()' -slug: /getchannels -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Returns all Realtime channels. - -```dart -final channels = supabase.getChannels(); -``` - -## Examples - -### Get all channels - -```dart -final channels = supabase.getChannels(); -``` diff --git a/apps/reference/_supabase_dart/generated/gt.mdx b/apps/reference/_supabase_dart/generated/gt.mdx deleted file mode 100644 index c2f9e44d6a1..00000000000 --- a/apps/reference/_supabase_dart/generated/gt.mdx +++ /dev/null @@ -1,56 +0,0 @@ ---- -id: gt -title: '.gt()' -slug: /gt -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` is greater than the specified `value`. - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .gt('country_id', 250); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .gt('country_id', 250); -``` - -### With `update()` - -```dart -final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .gt('country_id', 250); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('cities') - .delete() - .gt('country_id', 250); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_cities') - .gt('country_id', 250); -``` diff --git a/apps/reference/_supabase_dart/generated/gte.mdx b/apps/reference/_supabase_dart/generated/gte.mdx deleted file mode 100644 index d64aab2d69d..00000000000 --- a/apps/reference/_supabase_dart/generated/gte.mdx +++ /dev/null @@ -1,56 +0,0 @@ ---- -id: gte -title: '.gte()' -slug: /gte -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` is greater than or equal to the specified `value`. - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .gte('country_id', 250); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .gte('country_id', 250); -``` - -### With `update()` - -```dart -final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .gte('country_id', 250); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('cities') - .delete() - .gte('country_id', 250); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_cities') - .gte('country_id', 250); -``` diff --git a/apps/reference/_supabase_dart/generated/ilike.mdx b/apps/reference/_supabase_dart/generated/ilike.mdx deleted file mode 100644 index 202f61746e3..00000000000 --- a/apps/reference/_supabase_dart/generated/ilike.mdx +++ /dev/null @@ -1,56 +0,0 @@ ---- -id: ilike -title: '.ilike()' -slug: /ilike -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value in the stated `column` matches the supplied `pattern` (case insensitive). - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .ilike('name', '%la%'); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .ilike('name', '%la%'); -``` - -### With `update()` - -```dart -final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .ilike('name', '%la%'); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('cities') - .delete() - .ilike('name', '%la%'); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_cities') - .ilike('name', '%la%'); -``` diff --git a/apps/reference/_supabase_dart/generated/in_.mdx b/apps/reference/_supabase_dart/generated/in_.mdx deleted file mode 100644 index 5bfef4a1107..00000000000 --- a/apps/reference/_supabase_dart/generated/in_.mdx +++ /dev/null @@ -1,58 +0,0 @@ ---- -id: in_ -title: '.in_()' -slug: /in_ -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` is found on the specified `values`. - -`is_` and `in_` filter methods are suffixed with `_` to avoid collisions with reserved keywords. - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .in_('name', ['Rio de Janeiro', 'San Francisco']); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .in_('name', ['Rio de Janeiro', 'San Francisco']); -``` - -### With `update()` - -```dart -final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .in_('name', ['Rio de Janeiro', 'San Francisco']); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('cities') - .delete() - .in_('name', ['Rio de Janeiro', 'San Francisco']); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_cities') - .in_('name', ['Rio de Janeiro', 'San Francisco']); -``` diff --git a/apps/reference/_supabase_dart/generated/index.mdx b/apps/reference/_supabase_dart/generated/index.mdx deleted file mode 100644 index 946a7d97d95..00000000000 --- a/apps/reference/_supabase_dart/generated/index.mdx +++ /dev/null @@ -1,11 +0,0 @@ ---- -id: index -title: 'Getting started' -slug: getting-started -custom_edit_url: ../../spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Supabase Dart. diff --git a/apps/reference/_supabase_dart/generated/insert.mdx b/apps/reference/_supabase_dart/generated/insert.mdx deleted file mode 100644 index 201f39357fb..00000000000 --- a/apps/reference/_supabase_dart/generated/insert.mdx +++ /dev/null @@ -1,48 +0,0 @@ ---- -id: insert -title: 'Create data: insert()' -slug: /insert -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Performs an INSERT into the table. - -```dart -final data = await supabase - .from('cities') - .insert([ - {'name': 'The Shire', 'country_id': 554} - ]); -``` - -## Notes - -- By default, every time you run `insert()`, the client library will make a `select` to return the full record. - This is convenient, but it can also cause problems if your Policies are not configured to allow the `select` operation. - If you are using Row Level Security and you are encountering problems, try setting the `returning` param to `minimal`. - -## Examples - -### Create a record - -```dart -final data = await supabase - .from('cities') - .insert([ - {'name': 'The Shire', 'country_id': 554} - ]); -``` - -### Bulk create - -```dart -final data = await supabase - .from('cities') - .insert([ - {'name': 'The Shire', 'country_id': 554}, - {'name': 'Rohan', 'country_id': 555}, - ]); -``` diff --git a/apps/reference/_supabase_dart/generated/invoke.mdx b/apps/reference/_supabase_dart/generated/invoke.mdx deleted file mode 100644 index cd946b09aaa..00000000000 --- a/apps/reference/_supabase_dart/generated/invoke.mdx +++ /dev/null @@ -1,57 +0,0 @@ ---- -id: invoke -title: 'invoke()' -slug: /invoke -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Invokes a Supabase Function. See the [guide](/docs/guides/functions) for details on writing Functions. - -```dart -final res = await supabase.functions.invoke('hello', body: {'foo': 'baa'}); -final data = res.data; -``` - -## Notes - -- Requires an Authorization header. -- Invoke params generally match the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) spec. - -## Examples - -### Basic invocation. - -```dart -final res = await supabase.functions.invoke('hello', body: {'foo': 'baa'}); -final data = res.data; -``` - -### Specifying response type. - -By default, `invoke()` will parse the response as JSON. You can parse the response in the following formats: `json`, `blob`, `text`, and `arrayBuffer`. - -```dart -final res = await supabase.functions.invoke( - 'hello', - body: {'foo': 'baa'}, - responseType: ResponseType.text, -); -final data = res.data; -``` - -### Parsing custom headers. - -Any `headers` will be passed through to the function. A common pattern is to pass a logged-in user's JWT token as an Authorization header. - -```dart -final res = await supabase.functions.invoke( - 'hello', - body: {'foo': 'baa'}, - headers: { - 'Authorization': 'Bearer ${supabase.auth.currentSession?.accessToken}' - }, -); -``` diff --git a/apps/reference/_supabase_dart/generated/is_.mdx b/apps/reference/_supabase_dart/generated/is_.mdx deleted file mode 100644 index daae2c1e29b..00000000000 --- a/apps/reference/_supabase_dart/generated/is_.mdx +++ /dev/null @@ -1,58 +0,0 @@ ---- -id: is_ -title: '.is_()' -slug: /is_ -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -A check for exact equality (null, true, false), finds all rows whose value on the stated `column` exactly match the specified `value`. - -`is_` and `in_` filter methods are suffixed with `_` to avoid collisions with reserved keywords. - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .is_('name', null); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .is_('name', null); -``` - -### With `update()` - -```dart -final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .is_('name', null); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('cities') - .delete() - .is_('name', null); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_cities') - .is_('name', null); -``` diff --git a/apps/reference/_supabase_dart/generated/like.mdx b/apps/reference/_supabase_dart/generated/like.mdx deleted file mode 100644 index 3bb8f1aacdb..00000000000 --- a/apps/reference/_supabase_dart/generated/like.mdx +++ /dev/null @@ -1,102 +0,0 @@ ---- -id: like -title: '.like()' -slug: /like -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value in the stated `column` matches the supplied `pattern` (case sensitive). - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .like('name', '%la%'); -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - object - -

    -
    - -The column to filter on. - -
    - -
  • - -
  • -

    - - pattern - - - required - - - string - -

    -
    - -The pattern to filter with. - -
    - -
  • - -
- -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .like('name', '%la%'); -``` - -### With `update()` - -```dart -final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .like('name', '%la%'); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('cities') - .delete() - .like('name', '%la%'); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_cities') - .like('name', '%la%'); -``` diff --git a/apps/reference/_supabase_dart/generated/limit.mdx b/apps/reference/_supabase_dart/generated/limit.mdx deleted file mode 100644 index e1dd3bc9d51..00000000000 --- a/apps/reference/_supabase_dart/generated/limit.mdx +++ /dev/null @@ -1,39 +0,0 @@ ---- -id: limit -title: 'limit()' -slug: /limit -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Limits the result with the specified count. - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .limit(1); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .limit(1); -``` - -### With embedded resources - -```dart -final data = await supabase - .from('countries') - .select('name, cities(name)') - .eq('name', 'United States') - .limit(1, foreignTable: 'cities' ); -``` diff --git a/apps/reference/_supabase_dart/generated/lt.mdx b/apps/reference/_supabase_dart/generated/lt.mdx deleted file mode 100644 index 2d8f3506dc2..00000000000 --- a/apps/reference/_supabase_dart/generated/lt.mdx +++ /dev/null @@ -1,56 +0,0 @@ ---- -id: lt -title: '.lt()' -slug: /lt -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` is less than the specified `value`. - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .lt('country_id', 250); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .lt('country_id', 250); -``` - -### With `update()` - -```dart -final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .lt('country_id', 250); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('cities') - .delete() - .lt('country_id', 250); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_cities') - .lt('country_id', 250); -``` diff --git a/apps/reference/_supabase_dart/generated/lte.mdx b/apps/reference/_supabase_dart/generated/lte.mdx deleted file mode 100644 index 5f33a32f83e..00000000000 --- a/apps/reference/_supabase_dart/generated/lte.mdx +++ /dev/null @@ -1,102 +0,0 @@ ---- -id: lte -title: '.lte()' -slug: /lte -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` is less than or equal to the specified `value`. - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .lte('country_id', 250); -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - object - -

    -
    - -The column to filter on. - -
    - -
  • - -
  • -

    - - value - - - required - - - object - -

    -
    - -The value to filter with. - -
    - -
  • - -
- -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .lte('country_id', 250); -``` - -### With `update()` - -```dart -final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .lte('country_id', 250); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('cities') - .delete() - .lte('country_id', 250); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_cities') - .lte('country_id', 250); -``` diff --git a/apps/reference/_supabase_dart/generated/match.mdx b/apps/reference/_supabase_dart/generated/match.mdx deleted file mode 100644 index 91c0a592d65..00000000000 --- a/apps/reference/_supabase_dart/generated/match.mdx +++ /dev/null @@ -1,56 +0,0 @@ ---- -id: match -title: '.match()' -slug: /match -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose columns match the specified `query` object. - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .match({'name': 'Beijing', 'country_id': 156}); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .match({'name': 'Beijing', 'country_id': 156}); -``` - -### With `update()` - -```dart -final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .match({'name': 'Beijing', 'country_id': 156}); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('cities') - .delete() - .match({'name': 'Beijing', 'country_id': 156}); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_cities') - .match({'name': 'Beijing', 'country_id': 156}); -``` diff --git a/apps/reference/_supabase_dart/generated/neq.mdx b/apps/reference/_supabase_dart/generated/neq.mdx deleted file mode 100644 index 819ef1006ab..00000000000 --- a/apps/reference/_supabase_dart/generated/neq.mdx +++ /dev/null @@ -1,56 +0,0 @@ ---- -id: neq -title: '.neq()' -slug: /neq -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` doesn't match the specified `value`. - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .neq('name', 'The shire'); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .neq('name', 'The shire'); -``` - -### With `update()` - -```dart -final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .neq('name', 'San Francisco'); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('cities') - .delete() - .neq('name', 'Mordor'); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_cities') - .neq('name', 'Lagos'); -``` diff --git a/apps/reference/_supabase_dart/generated/not.mdx b/apps/reference/_supabase_dart/generated/not.mdx deleted file mode 100644 index e2dffc5c3b5..00000000000 --- a/apps/reference/_supabase_dart/generated/not.mdx +++ /dev/null @@ -1,68 +0,0 @@ ---- -id: not -title: '.not()' -slug: /not -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows which doesn't satisfy the filter. - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .not('name', 'eq', 'Paris'); -``` - -## Notes - -- `.not()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values. - - ```dart - .not('name','eq','Paris') - .not('arraycol','cs','{"a","b"}') // Use Postgres array {} for array column and 'cs' for contains. - .not('rangecol','cs','(1,2]') // Use Postgres range syntax for range column. - .not('id','in','(6,7)') // Use Postgres list () and 'in' for in_ filter. - .not('id','in','(${mylist.join(',')})') // You can insert a Dart list array. - ``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .not('name', 'eq', 'Paris'); -``` - -### With `update()` - -```dart -final data = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .not('name', 'eq', 'Paris'); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('cities') - .delete() - .not('name', 'eq', 'Paris'); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_cities) - .not('name', 'eq', 'Paris'); -``` diff --git a/apps/reference/_supabase_dart/generated/or.mdx b/apps/reference/_supabase_dart/generated/or.mdx deleted file mode 100644 index f4ebb8e3088..00000000000 --- a/apps/reference/_supabase_dart/generated/or.mdx +++ /dev/null @@ -1,48 +0,0 @@ ---- -id: or -title: '.or()' -slug: /or -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows satisfying at least one of the filters. - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .or('id.eq.20,id.eq.30'); -``` - -## Notes - -- `.or()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values. - - ```dart - .or('id.in.(6,7),arraycol.cs.{"a","b"}') // Use Postgres list () and 'in' for in_ filter. Array {} and 'cs' for contains. - .or('id.in.(${mylist.join(',')}),arraycol.cs.{${mylistArray.join(',')}}') // You can insert a Dart list for list or array column. - .or('id.in.(${mylist.join(',')}),rangecol.cs.(${mylistRange.join(',')}]') // You can insert a Dart list for list or range column. - ``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .or('id.eq.20,id.eq.30'); -``` - -### Use `or` with `and` - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .or('id.gt.20,and(name.eq.New Zealand,name.eq.France)'); -``` diff --git a/apps/reference/_supabase_dart/generated/order.mdx b/apps/reference/_supabase_dart/generated/order.mdx deleted file mode 100644 index 1e306a81069..00000000000 --- a/apps/reference/_supabase_dart/generated/order.mdx +++ /dev/null @@ -1,39 +0,0 @@ ---- -id: order -title: 'order()' -slug: /order -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Orders the result with the specified column. - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .order('id', ascending: false ); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .order('id', ascending: false ); -``` - -### With embedded resources - -```dart -final data = await supabase - .from('countries') - .select('name, cities(name)') - .eq('name', 'United States') - .order('name', foreignTable: 'cities'); -``` diff --git a/apps/reference/_supabase_dart/generated/overlaps.mdx b/apps/reference/_supabase_dart/generated/overlaps.mdx deleted file mode 100644 index eae54bbdef2..00000000000 --- a/apps/reference/_supabase_dart/generated/overlaps.mdx +++ /dev/null @@ -1,54 +0,0 @@ ---- -id: overlaps -title: '.overlaps()' -slug: /overlaps -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```dart -final data = await supabase - .from('countries') - .select('name, id, main_exports') - .overlaps('main_exports', ['computers', 'minerals']); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('countries') - .select('name, id, main_exports') - .overlaps('main_exports', ['computers', 'minerals']); -``` - -### With `update()` - -```dart -final data = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .overlaps('main_exports', ['computers', 'minerals']); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('countries') - .delete() - .overlaps('main_exports', ['computers', 'minerals']); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_countries') - .overlaps('main_exports', ['computers', 'minerals']); -``` diff --git a/apps/reference/_supabase_dart/generated/range.mdx b/apps/reference/_supabase_dart/generated/range.mdx deleted file mode 100644 index 25c6b2c0dbe..00000000000 --- a/apps/reference/_supabase_dart/generated/range.mdx +++ /dev/null @@ -1,29 +0,0 @@ ---- -id: range -title: 'range()' -slug: /range -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Limits the result to rows within the specified range, inclusive. - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .range(0,3); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .range(0,3); -``` diff --git a/apps/reference/_supabase_dart/generated/rangeadjacent.mdx b/apps/reference/_supabase_dart/generated/rangeadjacent.mdx deleted file mode 100644 index f3b85d3275c..00000000000 --- a/apps/reference/_supabase_dart/generated/rangeadjacent.mdx +++ /dev/null @@ -1,54 +0,0 @@ ---- -id: rangeadjacent -title: '.rangeAdjacent()' -slug: /rangeadjacent -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```dart -final data = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeAdjacent('population_range_millions', '[70, 185]'); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeAdjacent('population_range_millions', '[70, 185]'); -``` - -### With `update()` - -```dart -final data = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .rangeAdjacent('population_range_millions', '[70, 185]'); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('countries') - .delete() - .rangeAdjacent('population_range_millions', '[70, 185]'); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_countries') - .rangeAdjacent('population_range_millions', '[70, 185]'); -``` diff --git a/apps/reference/_supabase_dart/generated/rangegt.mdx b/apps/reference/_supabase_dart/generated/rangegt.mdx deleted file mode 100644 index 259d2aac135..00000000000 --- a/apps/reference/_supabase_dart/generated/rangegt.mdx +++ /dev/null @@ -1,54 +0,0 @@ ---- -id: rangegt -title: '.rangeGt()' -slug: /rangegt -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```dart -final data = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGt('population_range_millions', '[150, 250]'); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGt('population_range_millions', '[150, 250]'); -``` - -### With `update()` - -```dart -final data = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .rangeGt('population_range_millions', '[150, 250]'); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('countries') - .delete() - .rangeGt('population_range_millions', '[150, 250]'); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_countries') - .rangeGt('population_range_millions', '[150, 250]'); -``` diff --git a/apps/reference/_supabase_dart/generated/rangegte.mdx b/apps/reference/_supabase_dart/generated/rangegte.mdx deleted file mode 100644 index 8d6888ce0fd..00000000000 --- a/apps/reference/_supabase_dart/generated/rangegte.mdx +++ /dev/null @@ -1,54 +0,0 @@ ---- -id: rangegte -title: '.rangeGte()' -slug: /rangegte -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```dart -final data = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGte('population_range_millions', '[150, 250]'); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGte('population_range_millions', '[150, 250]'); -``` - -### With `update()` - -```dart -final data = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .rangeGte('population_range_millions', '[150, 250]'); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('countries') - .delete() - .rangeGte('population_range_millions', '[150, 250]'); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_countries') - .rangeGte('population_range_millions', '[150, 250]'); -``` diff --git a/apps/reference/_supabase_dart/generated/rangelt.mdx b/apps/reference/_supabase_dart/generated/rangelt.mdx deleted file mode 100644 index a9c27e4b7d0..00000000000 --- a/apps/reference/_supabase_dart/generated/rangelt.mdx +++ /dev/null @@ -1,54 +0,0 @@ ---- -id: rangelt -title: '.rangeLt()' -slug: /rangelt -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```dart -final data = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLt('population_range_millions', '[150, 250]'); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLt('population_range_millions', '[150, 250]'); -``` - -### With `update()` - -```dart -final data = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .rangeLt('population_range_millions', '[150, 250]'); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('countries') - .delete() - .rangeLt('population_range_millions', '[150, 250]'); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_countries') - .rangeLt('population_range_millions', '[150, 250]'); -``` diff --git a/apps/reference/_supabase_dart/generated/rangelte.mdx b/apps/reference/_supabase_dart/generated/rangelte.mdx deleted file mode 100644 index 68f4f7fd496..00000000000 --- a/apps/reference/_supabase_dart/generated/rangelte.mdx +++ /dev/null @@ -1,54 +0,0 @@ ---- -id: rangelte -title: '.rangeLte()' -slug: /rangelte -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```dart -final data = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLte('population_range_millions', '[150, 250]'); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLte('population_range_millions', '[150, 250]'); -``` - -### With `update()` - -```dart -final data = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .rangeLte('population_range_millions', '[150, 250]'); -``` - -### With `delete()` - -```dart -final data = await supabase - .from('countries') - .delete() - .rangeLte('population_range_millions', '[150, 250]'); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final data = await supabase - .rpc('echo_all_countries') - .rangeLte('population_range_millions', [150, 250]); -``` diff --git a/apps/reference/_supabase_dart/generated/removeallchannels.mdx b/apps/reference/_supabase_dart/generated/removeallchannels.mdx deleted file mode 100644 index 7bfa2a276a1..00000000000 --- a/apps/reference/_supabase_dart/generated/removeallchannels.mdx +++ /dev/null @@ -1,27 +0,0 @@ ---- -id: removeallchannels -title: 'removeAllChannels()' -slug: /removeallchannels -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Unsubscribes and removes all Realtime channels from Realtime client. - -```dart -final statuses = await supabase.removeAllChannels(); -``` - -## Notes - -- Removing channels is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed. - -## Examples - -### Remove all channels - -```dart -final statuses = await supabase.removeAllChannels(); -``` diff --git a/apps/reference/_supabase_dart/generated/removechannel.mdx b/apps/reference/_supabase_dart/generated/removechannel.mdx deleted file mode 100644 index b0ec98929f2..00000000000 --- a/apps/reference/_supabase_dart/generated/removechannel.mdx +++ /dev/null @@ -1,27 +0,0 @@ ---- -id: removechannel -title: 'removeChannel()' -slug: /removechannel -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Unsubscribes and removes Realtime channel from Realtime client. - -```dart -final status = await supabase.removeChannel(channel); -``` - -## Notes - -- Removing a channel is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed. - -## Examples - -### Remove a channel - -```dart -final status = await supabase.removeChannel(channel); -``` diff --git a/apps/reference/_supabase_dart/generated/reset-password-email.mdx b/apps/reference/_supabase_dart/generated/reset-password-email.mdx deleted file mode 100644 index 10bbfcb0607..00000000000 --- a/apps/reference/_supabase_dart/generated/reset-password-email.mdx +++ /dev/null @@ -1,55 +0,0 @@ ---- -id: reset-password-email -title: 'Reset Password (Email)' -slug: /reset-password-email -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Sends a reset request to an email address. - -```dart -final res = await supabase.auth.api.resetPasswordForEmail('user@example.com'); -``` - -## Notes - -Sends a reset request to an email address. - -When the user clicks the reset link in the email they will be forwarded to: - -`#access_token=x&refresh_token=y&expires_in=z&token_type=bearer&type=recovery` - -Your app must detect `type=recovery` in the fragment and display a password reset form to the user. - -You should then use the access_token in the url and new password to update the user as follows: - -```dart -final res = await supabase.auth.api.updateUser( - accessToken, - UserAttributes(password: 'NEW_PASSWORD'), -); -``` - -## Examples - -### Reset password - -```dart -final res = await supabase.auth.api.resetPasswordForEmail('user@example.com'); -``` - -### Reset password for Flutter - -You can pass `redirectTo` to open the app via deeplink when user opens the password reset email. - -```dart -final res = await supabase.auth.api.resetPasswordForEmail( - 'user@example.com', - options: AuthOptions(redirectTo: kIsWeb - ? null - : 'io.supabase.flutter://reset-callback/'), -); -``` diff --git a/apps/reference/_supabase_dart/generated/rpc.mdx b/apps/reference/_supabase_dart/generated/rpc.mdx deleted file mode 100644 index 8e1dfe9daa2..00000000000 --- a/apps/reference/_supabase_dart/generated/rpc.mdx +++ /dev/null @@ -1,48 +0,0 @@ ---- -id: rpc -title: 'Stored Procedures: rpc()' -slug: /rpc -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -You can call stored procedures as a "Remote Procedure Call". - -That's a fancy way of saying that you can put some logic into your database then call it from anywhere. -It's especially useful when the logic rarely changes - like password resets and updates. - -```dart -final data = await supabase - .rpc('hello_world'); -``` - -## Examples - -### Call a stored procedure - -This is an example invoking a stored procedure. - -```dart -final data = await supabase - .rpc('hello_world'); -``` - -### With Parameters - -```dart -final data = await supabase - .rpc('echo_city', params: { 'name': 'The Shire' }); -``` - -### With count option - -You can specify a count option to get the row count along with your data. -Allowed values for count option are `exact`, `planned` and `estimated`. - -```dart -final data = await supabase - .rpc('hello_world') - .execute(count: CountOption.exact); -``` diff --git a/apps/reference/_supabase_dart/generated/select.mdx b/apps/reference/_supabase_dart/generated/select.mdx deleted file mode 100644 index 42eb6bfc5fb..00000000000 --- a/apps/reference/_supabase_dart/generated/select.mdx +++ /dev/null @@ -1,133 +0,0 @@ ---- -id: select -title: 'Fetch data: select()' -slug: /select -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Performs vertical filtering with SELECT. - -```dart -final data = await supabase - .from('cities') - .select(); -``` - -## Notes - -- By default, Supabase projects will return a maximum of 1,000 rows. This setting can be changed in Project API Settings. It's recommended that you keep it low to limit the payload size of accidental or malicious requests. You can use `range()` queries to paginate through your data. -- `select()` can be combined with [Modifiers](/docs/reference/dart/using-modifiers) -- `select()` can be combined with [Filters](/docs/reference/dart/using-filters) -- If using the Supabase hosted platform `apikey` is technically a reserved keyword, since the API gateway will pluck it out for authentication. [It should be avoided as a column name](https://github.com/supabase/supabase/issues/5465). - -## Examples - -### Getting your data - -```dart -final data = await supabase - .from('cities') - .select(); -``` - -### Selecting specific columns - -You can select specific fields from your tables. - -```dart -final data = await supabase - .from('cities') - .select('name'); -``` - -### Query foreign tables - -If your database has relationships, you can query related tables too. - -```dart -final data = await supabase - .from('countries') - .select(''' - name, - cities ( - name - ) - '''); -``` - -### Query the same foreign table multiple times - -Sometimes you will need to query the same foreign table twice. -In this case, you can use the name of the joined column to identify -which join you intend to use. For convenience, you can also give an -alias for each column. For example, if we had a shop of products, -and we wanted to get the supplier and the purchaser at the same time -(both in the users) table: - -```dart -final data = await supabase - .from('products') - .select(''' - id, - supplier:supplier_id ( name ), - purchaser:purchaser_id ( name ) - '''); -``` - -### Filtering with inner joins - -If you want to filter a table based on a child table's values you can use the `!inner()` function. For example, if you wanted -to select all rows in a `message` table which belong to a user with the `username` "Jane": - -```dart -final data = await supabase - .from('messages') - .select('*, users!inner(*)') - .eq('users.username', 'Jane'); -``` - -### Querying with count option - -You can get the number of rows by using the count option. -Allowed values for count option are [exact](https://postgrest.org/en/stable/api.html#exact-count), [planned](https://postgrest.org/en/stable/api.html#planned-count) and [estimated](https://postgrest.org/en/stable/api.html#estimated-count). - -```dart -final data = await supabase - .from('cities') - .select('name') - .execute(count: CountOption.exact); - -final count = res.count; -``` - -### Querying JSON data - -If you have data inside of a JSONB column, you can apply select -and query filters to the data values. Postgres offers a -[number of operators](https://www.postgresql.org/docs/current/functions-json.html) -for querying JSON data. Also see -[PostgREST docs](http://postgrest.org/en/v7.0.0/api.html#json-columns) for more details. - -```dart -final data = await supabase - .from('users') - .select(''' - id, name, - address->street - ''') - .eq('address->postcode', 90210); -``` - -### Return data as CSV - -By default the data is returned in JSON format, however you can also request for it to be returned as Comma Separated Values. - -```dart -final data = await supabase - .from('users') - .select() - .csv(); -``` diff --git a/apps/reference/_supabase_dart/generated/single.mdx b/apps/reference/_supabase_dart/generated/single.mdx deleted file mode 100644 index 93cf85294f3..00000000000 --- a/apps/reference/_supabase_dart/generated/single.mdx +++ /dev/null @@ -1,29 +0,0 @@ ---- -id: single -title: 'single()' -slug: /single -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Retrieves only one row from the result. Result must be one row (e.g. using limit), otherwise this will result in an error. - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .single(); -``` - -## Examples - -### With `select()` - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .single(); -``` diff --git a/apps/reference/_supabase_dart/generated/storage-createbucket.mdx b/apps/reference/_supabase_dart/generated/storage-createbucket.mdx deleted file mode 100644 index 7abae13d89b..00000000000 --- a/apps/reference/_supabase_dart/generated/storage-createbucket.mdx +++ /dev/null @@ -1,33 +0,0 @@ ---- -id: storage-createbucket -title: 'createBucket()' -slug: /storage-createbucket -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Creates a new Storage bucket - -```dart -final String bucketId = await supabase - .storage - .createBucket('avatars'); -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: `insert` - - `objects` permissions: none - -## Examples - -### Create bucket - -```dart -final String bucketId = await supabase - .storage - .createBucket('avatars'); -``` diff --git a/apps/reference/_supabase_dart/generated/storage-deletebucket.mdx b/apps/reference/_supabase_dart/generated/storage-deletebucket.mdx deleted file mode 100644 index c1867fdaac9..00000000000 --- a/apps/reference/_supabase_dart/generated/storage-deletebucket.mdx +++ /dev/null @@ -1,33 +0,0 @@ ---- -id: storage-deletebucket -title: 'deleteBucket()' -slug: /storage-deletebucket -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Deletes an existing bucket. A bucket can't be deleted with existing objects inside it. You must first `empty()` the bucket. - -```dart -final String result = await supabase - .storage - .deleteBucket('avatars'); -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: `select` and `delete` - - `objects` permissions: none - -## Examples - -### Delete bucket - -```dart -final String result = await supabase - .storage - .deleteBucket('avatars'); -``` diff --git a/apps/reference/_supabase_dart/generated/storage-emptybucket.mdx b/apps/reference/_supabase_dart/generated/storage-emptybucket.mdx deleted file mode 100644 index 3ebe3d0481e..00000000000 --- a/apps/reference/_supabase_dart/generated/storage-emptybucket.mdx +++ /dev/null @@ -1,33 +0,0 @@ ---- -id: storage-emptybucket -title: 'emptyBucket()' -slug: /storage-emptybucket -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Removes all objects inside a single bucket. - -```dart -final String result = await supabase - .storage - .emptyBucket('avatars'); -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: `select` - - `objects` permissions: `select` and `delete` - -## Examples - -### Empty bucket - -```dart -final String result = await supabase - .storage - .emptyBucket('avatars'); -``` diff --git a/apps/reference/_supabase_dart/generated/storage-from-createsignedurl.mdx b/apps/reference/_supabase_dart/generated/storage-from-createsignedurl.mdx deleted file mode 100644 index 0b6691979d5..00000000000 --- a/apps/reference/_supabase_dart/generated/storage-from-createsignedurl.mdx +++ /dev/null @@ -1,35 +0,0 @@ ---- -id: storage-from-createsignedurl -title: 'from.createSignedUrl()' -slug: /storage-from-createsignedurl -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Create signed url to download file without requiring permissions. This URL can be valid for a set number of seconds. - -```dart -final String signedUrl = await supabase - .storage - .from('avatars') - .createSignedUrl('avatar1.png', 60); -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `select` - -## Examples - -### Create Signed URL - -```dart -final String signedUrl = await supabase - .storage - .from('avatars') - .createSignedUrl('avatar1.png', 60); -``` diff --git a/apps/reference/_supabase_dart/generated/storage-from-download.mdx b/apps/reference/_supabase_dart/generated/storage-from-download.mdx deleted file mode 100644 index 5b205e0bb08..00000000000 --- a/apps/reference/_supabase_dart/generated/storage-from-download.mdx +++ /dev/null @@ -1,35 +0,0 @@ ---- -id: storage-from-download -title: 'from.download()' -slug: /storage-from-download -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Downloads a file. - -```dart -final Uint8List file = await supabase - .storage - .from('avatars') - .download('avatar1.png'); -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `select` - -## Examples - -### Download file - -```dart -final Uint8List file = await supabase - .storage - .from('avatars') - .download('avatar1.png'); -``` diff --git a/apps/reference/_supabase_dart/generated/storage-from-getpublicurl.mdx b/apps/reference/_supabase_dart/generated/storage-from-getpublicurl.mdx deleted file mode 100644 index 18853e773ac..00000000000 --- a/apps/reference/_supabase_dart/generated/storage-from-getpublicurl.mdx +++ /dev/null @@ -1,36 +0,0 @@ ---- -id: storage-from-getpublicurl -title: 'from.getPublicUrl()' -slug: /storage-from-getpublicurl -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Retrieve URLs for assets in public buckets - -```dart -final String publicUrl = supabase - .storage - .from('public-bucket') - .getPublicUrl('avatar1.png'); -``` - -## Notes - -- The bucket needs to be set to public, either via [updateBucket()](/docs/reference/javascript/storage-updatebucket) or by going to Storage on [app.supabase.com](https://app.supabase.com), clicking the overflow menu on a bucket and choosing "Make public" -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: none - -## Examples - -### Returns the URL for an asset in a public bucket - -```dart -final String publicUrl = supabase - .storage - .from('public-bucket') - .getPublicUrl('avatar1.png'); -``` diff --git a/apps/reference/_supabase_dart/generated/storage-from-list.mdx b/apps/reference/_supabase_dart/generated/storage-from-list.mdx deleted file mode 100644 index b19550f4eab..00000000000 --- a/apps/reference/_supabase_dart/generated/storage-from-list.mdx +++ /dev/null @@ -1,35 +0,0 @@ ---- -id: storage-from-list -title: 'from.list()' -slug: /storage-from-list -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Lists all the files within a bucket. - -```dart -final List objects = await supabase - .storage - .from('avatars') - .list(); -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `select` - -## Examples - -### List files in a bucket - -```dart -final List objects = await supabase - .storage - .from('avatars') - .list(); -``` diff --git a/apps/reference/_supabase_dart/generated/storage-from-move.mdx b/apps/reference/_supabase_dart/generated/storage-from-move.mdx deleted file mode 100644 index ea147d37463..00000000000 --- a/apps/reference/_supabase_dart/generated/storage-from-move.mdx +++ /dev/null @@ -1,35 +0,0 @@ ---- -id: storage-from-move -title: 'from.move()' -slug: /storage-from-move -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Moves an existing file, optionally renaming it at the same time. - -```dart -final String result = await supabase - .storage - .from('avatars') - .move('public/avatar1.png', 'private/avatar2.png'); -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `update` and `select` - -## Examples - -### Move file - -```dart -final String result = await supabase - .storage - .from('avatars') - .move('public/avatar1.png', 'private/avatar2.png'); -``` diff --git a/apps/reference/_supabase_dart/generated/storage-from-remove.mdx b/apps/reference/_supabase_dart/generated/storage-from-remove.mdx deleted file mode 100644 index a15ccbd2938..00000000000 --- a/apps/reference/_supabase_dart/generated/storage-from-remove.mdx +++ /dev/null @@ -1,35 +0,0 @@ ---- -id: storage-from-remove -title: 'from.remove()' -slug: /storage-from-remove -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Deletes files within the same bucket - -```dart -final List objects = await supabase - .storage - .from('avatars') - .remove(['avatar1.png']); -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `delete` and `select` - -## Examples - -### Delete file - -```dart -final List objects = await supabase - .storage - .from('avatars') - .remove(['avatar1.png']); -``` diff --git a/apps/reference/_supabase_dart/generated/storage-from-update.mdx b/apps/reference/_supabase_dart/generated/storage-from-update.mdx deleted file mode 100644 index 51946d2b8af..00000000000 --- a/apps/reference/_supabase_dart/generated/storage-from-update.mdx +++ /dev/null @@ -1,40 +0,0 @@ ---- -id: storage-from-update -title: 'from.update()' -slug: /storage-from-update -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Replaces an existing file at the specified path with a new one. - -```dart -final avatarFile = File('path/to/local/file'); -final String path = await supabase.storage.from('avatars').update( - 'public/avatar1.png', - avatarFile, - fileOptions: const FileOptions(cacheControl: '3600', upsert: false), - ); - -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `update` and `select` - -## Examples - -### Update file - -```dart -final avatarFile = File('path/to/local/file'); -final String path = await supabase.storage.from('avatars').update( - 'public/avatar1.png', - avatarFile, - fileOptions: const FileOptions(cacheControl: '3600', upsert: false), - ); -``` diff --git a/apps/reference/_supabase_dart/generated/storage-from-upload.mdx b/apps/reference/_supabase_dart/generated/storage-from-upload.mdx deleted file mode 100644 index d776350c958..00000000000 --- a/apps/reference/_supabase_dart/generated/storage-from-upload.mdx +++ /dev/null @@ -1,168 +0,0 @@ ---- -id: storage-from-upload -title: 'from.upload()' -slug: /storage-from-upload -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Uploads a file to an existing bucket. - -```dart -final avatarFile = File('path/to/file'); -final String path = await supabase.storage.from('avatars').upload( - 'public/avatar1.png', - avatarFile, - fileOptions: const FileOptions(cacheControl: '3600', upsert: false), - ); -``` - -## Parameters - -
    - -
  • -

    - - path - - - required - - - string - -

    -
    - -The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload. - -
    - -
  • - -
  • -

    - - fileBody - - - required - - - File - -

    -
    - -The body of the file to be stored in the bucket. - -
    - -
  • - -
  • -

    - - fileOptions - - - optional - - - FileOptions - -

    -
    - -
      -
      Properties
      - -
    • -

      - - cacheControl - - - optional - - - string - -

      -
      - -The Cache-Control: max-age=[seconds] seconds value. - -
      - -
    • - -
    • -

      - - contentType - - - optional - - - string - -

      -
      - -The Content-Type header value. By default, the SDK reads the content type and sets the header. - -
      - -
    • - -
    • -

      - - upsert - - - optional - - - boolean - -

      -
      - -Whether to perform an upsert. - -
      - -
    • - -
    - -
    - -
  • - -
- -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `insert` - -## Examples - -### Upload file - -```dart -final avatarFile = File('path/to/file'); -final String path = await supabase.storage.from('avatars').upload( - 'public/avatar1.png', - avatarFile, - fileOptions: const FileOptions(cacheControl: '3600', upsert: false), - ); -``` diff --git a/apps/reference/_supabase_dart/generated/storage-getbucket.mdx b/apps/reference/_supabase_dart/generated/storage-getbucket.mdx deleted file mode 100644 index a6166dc199c..00000000000 --- a/apps/reference/_supabase_dart/generated/storage-getbucket.mdx +++ /dev/null @@ -1,59 +0,0 @@ ---- -id: storage-getbucket -title: 'getBucket()' -slug: /storage-getbucket -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Retrieves the details of an existing Storage bucket. - -```dart -final Bucket bucket = await supabase - .storage - .getBucket('avatars'); -``` - -## Parameters - -
    - -
  • -

    - - id - - - required - - - string - -

    -
    - -The unique identifier of the bucket you would like to retrieve. - -
    - -
  • - -
- -## Notes - -- Policy permissions required: - - `buckets` permissions: `select` - - `objects` permissions: none - -## Examples - -### Get bucket - -```dart -final Bucket bucket = await supabase - .storage - .getBucket('avatars'); -``` diff --git a/apps/reference/_supabase_dart/generated/storage-listbuckets.mdx b/apps/reference/_supabase_dart/generated/storage-listbuckets.mdx deleted file mode 100644 index ff7ea234122..00000000000 --- a/apps/reference/_supabase_dart/generated/storage-listbuckets.mdx +++ /dev/null @@ -1,33 +0,0 @@ ---- -id: storage-listbuckets -title: 'listBuckets()' -slug: /storage-listbuckets -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Retrieves the details of all Storage buckets within an existing product. - -```dart -final List buckets = await supabase - .storage - .listBuckets(); -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: `select` - - `objects` permissions: none - -## Examples - -### List buckets - -```dart -final List buckets = await supabase - .storage - .listBuckets(); -``` diff --git a/apps/reference/_supabase_dart/generated/storage-updatebucket.mdx b/apps/reference/_supabase_dart/generated/storage-updatebucket.mdx deleted file mode 100644 index ac0e92585a8..00000000000 --- a/apps/reference/_supabase_dart/generated/storage-updatebucket.mdx +++ /dev/null @@ -1,33 +0,0 @@ ---- -id: storage-updatebucket -title: 'updateBucket()' -slug: /storage-updatebucket -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Updates a new Storage bucket - -```dart -final res = await supabase - .storage - .updateBucket('avatars', const BucketOptions(public: false)); -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: `update` - - `objects` permissions: none - -## Examples - -### Update bucket - -```dart -final res = await supabase - .storage - .updateBucket('avatars', const BucketOptions(public: false)); -``` diff --git a/apps/reference/_supabase_dart/generated/stream.mdx b/apps/reference/_supabase_dart/generated/stream.mdx deleted file mode 100644 index 603d60e5045..00000000000 --- a/apps/reference/_supabase_dart/generated/stream.mdx +++ /dev/null @@ -1,106 +0,0 @@ ---- -id: stream -title: 'stream()' -slug: /stream -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Notifies of data at the queried table. - -```dart -supabase.from('countries') - .stream(['id']) - .listen((List> data) { - // Do something awesome with the data -}); -``` - -## Notes - -- `stream()` will emit the initial data as well as any further change on the database as `Stream` of `List>` by combining Postgrest and Realtime. -- Takes a list of primary key columns as its argument. - -## Examples - -### Listening to a specific table - -```dart -supabase.from('countries') - .stream(['id']) - .listen((List> data) { - // Do something awesome with the data -}); -``` - -### Listening to a specific rows within a table - -You can add up to one `eq` filter to your `stream()` query. - -```dart -supabase.from('countries') - .stream(['id']) - .eq('id', '120') - .listen((List> data) { - // Do something awesome with the data -}); -``` - -### With `order()` - -Allows you to order the queried data by the value of the specified column. - -```dart -supabase.from('countries') - .stream(['id']) - .order('name', ascending: true) - .listen((List> data) { - // Do something awesome with the data -}); -``` - -### With `limit()` - -Allows you to limit the number of rows returned. - -```dart -supabase.from('countries') - .stream(['id']) - .order('name', ascending: true) - .limit(10) - .listen((List> data) { - // Do something awesome with the data -}); -``` - -### Using `stream()` with `StreamBuilder` - -When using `stream()` with a `StreamBuilder` within your Flutter application, make sure to store your stream in a variable to prevent refetching upon rebuilding. - -```dart -final supabase = Supabase.instance.client; - -class MyWidget extends StatefulWidget { - const MyWidget({Key? key}) : super(key: key); - - @override - State createState() => _MyWidgetState(); -} - -class _MyWidgetState extends State { - // Persist the stream in a local variable to prevent refetching upon rebuilds - final _stream = supabase.from('countries').stream(['id']); - - @override - Widget build(BuildContext context) { - return StreamBuilder( - stream: _stream, - builder: (context, snapshot) { - // Return your widget with the data from the snapshot - }, - ); - } -} -``` \ No newline at end of file diff --git a/apps/reference/_supabase_dart/generated/subscribe.mdx b/apps/reference/_supabase_dart/generated/subscribe.mdx deleted file mode 100644 index 1bfff16bbdb..00000000000 --- a/apps/reference/_supabase_dart/generated/subscribe.mdx +++ /dev/null @@ -1,120 +0,0 @@ ---- -id: subscribe -title: 'on().subscribe()' -slug: /subscribe -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Subscribe to realtime changes in your database. - -```dart -supabase.channel('*').on(RealtimeListenTypes.postgresChanges, - ChannelFilter(event: '*', schema: '*'), (payload, [ref]) { - print('Change received: ${payload.toString()}'); -}).subscribe(); -``` - -## Notes - -- Realtime is disabled by default for new Projects for better database performance and security. You can turn it on by managing replication. -Row level security is not applied to delete statements. -- If you want to receive the "previous" data for updates and deletes, you will need to set REPLICA IDENTITY to FULL, like this: ALTER TABLE your_table REPLICA IDENTITY FULL; -- When a delete occurs, the contents of old_record will be broadcast to all subscribers to that table so ensure that each table's replica identity only contains information that is safe to expose publicly. -- The channel name must exactly match the schema/table/filter you want to listen to separated by colons. See below examples for additional context. - -## Examples - -### Listen to all database changes - -```dart -supabase.channel('*').on(RealtimeListenTypes.postgresChanges, - ChannelFilter(event: '*', schema: '*'), (payload, [ref]) { - print('Change received: ${payload.toString()}'); -}).subscribe(); -``` - -### Listening to a specific table - -```dart -supabase.channel('public:countries').on(RealtimeListenTypes.postgresChanges, - ChannelFilter(event: '*', schema: 'public', table: 'countries'), (payload, [ref]) { - print('Change received: ${payload.toString()}'); -}).subscribe(); -``` - -### Listening to inserts - -```dart -supabase.channel('public:countries').on(RealtimeListenTypes.postgresChanges, - ChannelFilter(event: 'INSERT', schema: 'public', table: 'countries'), (payload, [ref]) { - print('Change received: ${payload.toString()}'); -}).subscribe(); -``` - -### Listening to updates - -By default, Supabase will send only the updated record. If you want to receive the previous values as well you can -enable full replication for the table you are listening too: - -```sql -alter table "your_table" replica identity full; -``` - -```dart -supabase.channel('public:countries').on(RealtimeListenTypes.postgresChanges, - ChannelFilter(event: 'UPDATE', schema: 'public', table: 'countries'), (payload, [ref]) { - print('Change received: ${payload.toString()}'); -}).subscribe(); -``` - -### Listening to deletes - -By default, Supabase does not send deleted records. If you want to receive the deleted record you can -enable full replication for the table you are listening too: - -```sql -alter table "your_table" replica identity full; -``` - -```dart -supabase.channel('public:countries').on(RealtimeListenTypes.postgresChanges, - ChannelFilter(event: 'DELETE', schema: 'public', table: 'countries'), (payload, [ref]) { - print('Change received: ${payload.toString()}'); -}).subscribe(); -``` - -### Listening to multiple events - -You can chain listeners if you want to listen to multiple events for each table. - -```dart -supabase.channel('public:countries').on(RealtimeListenTypes.postgresChanges, - ChannelFilter(event: 'INSERT', schema: 'public', table: 'countries'), - (payload, [ref]) { - print('Change received: ${payload.toString()}'); -}).on(RealtimeListenTypes.postgresChanges, - ChannelFilter(event: 'DELETE', schema: 'public', table: 'countries'), - (payload, [ref]) { - print('Change received: ${payload.toString()}'); -}).subscribe(); -``` - -### Listening to row level changes - -You can listen to individual rows using the format `{table}:{col}=eq.{val}` - where `{col}` is the column name, and `{val}` is the value which you want to match. - -```dart - supabase.channel('public:countries:id=eq.200').on( - RealtimeListenTypes.postgresChanges, - ChannelFilter( - event: 'UPDATE', - schema: 'public', - table: 'countries', - filter: 'id=eq.200', - ), (payload, [ref]) { - print('Change received: ${payload.toString()}'); - }).subscribe(); -``` diff --git a/apps/reference/_supabase_dart/generated/textsearch.mdx b/apps/reference/_supabase_dart/generated/textsearch.mdx deleted file mode 100644 index 2b290e1ab27..00000000000 --- a/apps/reference/_supabase_dart/generated/textsearch.mdx +++ /dev/null @@ -1,73 +0,0 @@ ---- -id: textsearch -title: '.textSearch()' -slug: /textsearch -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose tsvector value on the stated `column` matches to_tsquery(query). - -## Examples - -### Text search - -```dart -final data = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', "'fat' & 'cat'", - config: 'english' - ); -``` - -### Basic normalization - -Uses PostgreSQL's `plainto_tsquery` function. - -```dart -final data = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', "'fat' & 'cat'", - type: TextSearchType.plain, - config: 'english' - ); -``` - -### Full normalization - -Uses PostgreSQL's `phraseto_tsquery` function. - -```dart -final data = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', "'fat' & 'cat'", - type: TextSearchType.phrase, - config: 'english' - ); -``` - -### Full normalization - -Uses PostgreSQL's `websearch_to_tsquery` function. -This function will never raise syntax errors, which makes it possible to use raw user-supplied input for search, and can be used -with advanced operators. - -- `unquoted text`: text not inside quote marks will be converted to terms separated by & operators, as if processed by plainto_tsquery. -- `"quoted text"`: text inside quote marks will be converted to terms separated by <-> operators, as if processed by phraseto_tsquery. -- `OR`: the word “or” will be converted to the | operator. -- `-`: a dash will be converted to the ! operator. - -```dart -final data = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', "'fat or cat'", - type: TextSearchType.websearch, - config: 'english' - ); -``` diff --git a/apps/reference/_supabase_dart/generated/update.mdx b/apps/reference/_supabase_dart/generated/update.mdx deleted file mode 100644 index 19f8d6335a3..00000000000 --- a/apps/reference/_supabase_dart/generated/update.mdx +++ /dev/null @@ -1,52 +0,0 @@ ---- -id: update -title: 'Modify data: update()' -slug: /update -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Performs an UPDATE on the table. - -```dart -final data = await supabase - .from('cities') - .update({ 'name': 'Middle Earth' }) - .match({ 'name': 'Auckland' }); -``` - -## Notes - -- `update()` should always be combined with [Filters](/docs/reference/dart/using-filters) to target the item(s) you wish to update. - -## Examples - -### Updating your data - -```dart -final data = await supabase - .from('cities') - .update({ 'name': 'Middle Earth' }) - .match({ 'name': 'Auckland' }); -``` - -### Updating JSON data - -Postgres offers a -[number of operators](https://www.postgresql.org/docs/current/functions-json.html) -for working with JSON data. Right now it is only possible to update an entire JSON document, -but we are [working on ideas](https://github.com/PostgREST/postgrest/issues/465) for updating individual keys. - -```dart -final data = await supabase - .from('users') - .update({ - 'address': { - 'street': 'Melrose Place', - 'postcode': 90210 - } - }) - .eq('address->postcode', 90210); -``` diff --git a/apps/reference/_supabase_dart/generated/upsert.mdx b/apps/reference/_supabase_dart/generated/upsert.mdx deleted file mode 100644 index e295e133589..00000000000 --- a/apps/reference/_supabase_dart/generated/upsert.mdx +++ /dev/null @@ -1,59 +0,0 @@ ---- -id: upsert -title: 'Upsert data: upsert()' -slug: /upsert -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Performs an UPSERT into the table. - -```dart -final data = await supabase - .from('messages') - .upsert({ 'id': 3, 'message': 'foo', 'username': 'supabot' }); -``` - -## Notes - -- Primary keys should be included in the data payload in order for an update to work correctly. -- Primary keys must be natural, not surrogate. There are however, [workarounds](https://github.com/PostgREST/postgrest/issues/1118) for surrogate primary keys. - -## Examples - -### Upsert your data - -```dart -final data = await supabase - .from('messages') - .upsert({ 'id': 3, 'message': 'foo', 'username': 'supabot' }); -``` - -### Upserting into tables with constraints - -Running the following will cause supabase to upsert data into the `users` table. -If the username 'supabot' already exists, the `onConflict` argument tells supabase to overwrite that row -based on the column passed into `onConflict`. - -```dart -final data = await supabase - .from('users') - .upsert({ 'username': 'supabot' }, { 'onConflict': 'username' }); -``` - -### Return the exact number of rows - -Allowed values for count option are `exact`, `planned` and `estimated`. - -```dart -final data = await supabase - .from('users') - .upsert({ - 'id': 3, - 'message': 'foo', - 'username': 'supabot' - }) - .execute(count: CountOption.exact); -``` diff --git a/apps/reference/_supabase_dart/generated/using-filters.mdx b/apps/reference/_supabase_dart/generated/using-filters.mdx deleted file mode 100644 index 71e13bf36af..00000000000 --- a/apps/reference/_supabase_dart/generated/using-filters.mdx +++ /dev/null @@ -1,41 +0,0 @@ ---- -id: using-filters -title: 'Using Filters' -slug: /using-filters -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Filters can be used on `select()`, `update()`, and `delete()` queries. - -If a Stored Procedure returns a table response, you can also apply filters. - -### Applying Filters - -You must apply your filters to the end of your query. For example: - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'The Shire') // Correct; - -final data = await supabase - .from('cities') - .eq('name', 'The Shire') // Incorrect - .select('name, country_id'); -``` - -### Chaining - -Filters can be chained together to produce advanced queries. For example: - -```dart -final data = await supabase - .from('cities') - .select('name, country_id') - .gte('population', 1000) - .lt('population', 10000); -``` diff --git a/apps/reference/_supabase_dart/generated/using-modifiers.mdx b/apps/reference/_supabase_dart/generated/using-modifiers.mdx deleted file mode 100644 index 5fbbe72b81a..00000000000 --- a/apps/reference/_supabase_dart/generated/using-modifiers.mdx +++ /dev/null @@ -1,13 +0,0 @@ ---- -id: using-modifiers -title: 'Using Modifiers' -slug: /using-modifiers -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Modifiers can be used on `select()` queries. - -If a Stored Procedure returns a table response, you can also apply modifiers to the `rpc()` function. diff --git a/apps/reference/_supabase_dart/initializing.mdx b/apps/reference/_supabase_dart/initializing.mdx index 282de1b232f..e779b7e8ac2 100644 --- a/apps/reference/_supabase_dart/initializing.mdx +++ b/apps/reference/_supabase_dart/initializing.mdx @@ -1,8 +1,7 @@ --- id: initializing title: 'Initializing' -slug: /initializing -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml +slug: initializing --- import Tabs from '@theme/Tabs' diff --git a/apps/reference/_supabase_dart/installing.mdx b/apps/reference/_supabase_dart/installing.mdx index 4930b9baeff..2ed91c356fd 100644 --- a/apps/reference/_supabase_dart/installing.mdx +++ b/apps/reference/_supabase_dart/installing.mdx @@ -1,8 +1,7 @@ --- id: installing title: 'Installing' -slug: /installing -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml +slug: installing --- import Tabs from '@theme/Tabs' diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-onauthstatechange.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-onauthstatechange.mdx deleted file mode 100644 index 20bea627851..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-onauthstatechange.mdx +++ /dev/null @@ -1,29 +0,0 @@ ---- -id: auth-onauthstatechange -title: 'auth.onAuthStateChange()' -slug: /auth-onauthstatechange -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Receive a notification every time an auth event happens. - -```dart -final subscription = supabase.auth.onAuthStateChange((event, session) { - print(session?.user?.id); - // handle auth state change -}); -``` - -## Examples - -### Listen to auth changes - -```dart -final subscription = supabase.auth.onAuthStateChange((event, session) { - print(session?.user?.id); - // handle auth state change -}); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-session.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-session.mdx deleted file mode 100644 index 1ca53e7ece4..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-session.mdx +++ /dev/null @@ -1,23 +0,0 @@ ---- -id: auth-session -title: 'auth.session()' -slug: /auth-session -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Returns the session data, if there is an active session. - -```dart -final session = supabase.auth.session(); -``` - -## Examples - -### Get the session data - -```dart -final session = supabase.auth.session(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-signin.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-signin.mdx deleted file mode 100644 index 639c2b47b27..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-signin.mdx +++ /dev/null @@ -1,59 +0,0 @@ ---- -id: auth-signin -title: 'auth.signIn()' -slug: /auth-signin -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Log in an existing user, or login via a third-party provider. - -```dart -final res = await supabase.auth.signIn(email: 'example@email.com', password: 'example-password'); - -final user = res.data?.user; -final error = res.error; -``` - -## Notes - -- A user can sign up via email, phone number. -- If you provide `email` without a `password`, the user will be sent a magic link. -- The magic link's destination URL is determined by the SITE_URL config variable. To change this, you can go to Authentication -> Settings on [app.supabase.com](https://app.supabase.com) -- Similarly, if you provide `phone` without a `password`, the user will be sent a one time password. -- If you are looking to sign users in with OAuth in Flutter apps, go to [`signInWithProvider()`](/docs/reference/dart/auth-signinwithprovider). - -## Examples - -### Sign in with email. - -```dart -final res = await supabase.auth.signIn(email: 'example@email.com', password: 'example-password'); - -final user = res.data?.user; -final error = res.error; -``` - -### Sign in with magic link. - -If email is provided, but no password is provided, the user will be sent a "magic link" to their email address, which they can click to open your application with a valid session. By default, a given user can only request a Magic Link once every 60 seconds. - -```dart -final res = await supabase.auth.signIn(email: 'example@email.com'); - -final error = res.error; -``` - -### Get OAuth sign in URL. - -Passing provider parameter to `signIn()` will return a URL to sign your user in via OAuth. -If you are looking to sign in a user via OAuth on Flutter app, go to [`signInWithProvider()`](/docs/reference/dart/auth-signinwithprovider). - -```dart -final res = await supabase.auth.signIn(provider: Provider.github); - -final url = res.data?.url; -final error = res.error; -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-signinwithprovider.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-signinwithprovider.mdx deleted file mode 100644 index c44069bacb6..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-signinwithprovider.mdx +++ /dev/null @@ -1,63 +0,0 @@ ---- -id: auth-signinwithprovider -title: 'auth.signInWithProvider()' -slug: /auth-signinwithprovider -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Signs the user in using third party OAuth providers. - -```dart -final res = await supabase.auth.signInWithProvider(Provider.github); - -final error = res.error; -``` - -## Notes - -- `auth.signInWithProvider()` is only available on `supabase_flutter` -- It will open the browser to the relevant login page. - -## Examples - -### Sign in with provider. - -```dart -final res = await supabase.auth.signInWithProvider(Provider.github); - -final error = res.error; -``` - -### With `redirectTo` - -Specify the redirect link to bring back the user via deeplink. -Note that `redirectTo` should be null for Flutter Web. - -```dart -final res = await supabase.auth.signInWithProvider( - Provider.github, - options: AuthOptions( - redirectTo: kIsWeb - ? null - : 'io.supabase.flutter://reset-callback/'), -); - -final error = res.error; -``` - -### With scopes - -If you need additional data from an OAuth provider, you can include a space-separated list of scopes in your request to get back an OAuth provider token. -You may also need to specify the scopes in the provider's OAuth app settings, depending on the provider. - -```dart -const { user, session, error } = await supabase.auth.signIn({ - provider: 'github' -}, { - scopes: 'repo gist notifications' -}) -const oAuthToken = session.provider_token // use to access provider API -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-signout.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-signout.mdx deleted file mode 100644 index 2f05b6435da..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-signout.mdx +++ /dev/null @@ -1,27 +0,0 @@ ---- -id: auth-signout -title: 'auth.signOut()' -slug: /auth-signout -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Signs out the current user, if there is a logged in user. - -```dart -final res = await supabase.auth.signOut(); - -final error = res.error; -``` - -## Examples - -### Sign out - -```dart -final res = await supabase.auth.signOut(); - -final error = res.error; -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-signup.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-signup.mdx deleted file mode 100644 index a9a12b7ffc3..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-signup.mdx +++ /dev/null @@ -1,40 +0,0 @@ ---- -id: auth-signup -title: 'auth.signUp()' -slug: /auth-signup -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Creates a new user. - -```dart -final res = await supabase.auth.signUp('example@email.com', 'example-password'); - -final user = res.data?.user; -final error = res.error; -``` - -## Notes - -- By default, the user will need to verify their email address before logging in. If you would like to change this, you can disable "Email Confirmations" by going to Authentication -> Settings on [app.supabase.com](https://app.supabase.com) -- If "Email Confirmations" is turned on, a user is returned but session will be null -- If "Email Confirmations" is turned off, both a `user` and a `session` will be returned -- When the user confirms their email address, they will be redirected to localhost:3000 by default. To change this, you can go to Authentication -> Settings on [app.supabase.com](https://app.supabase.com) - -## Examples - -### Sign up. - -```dart -final res = await supabase.auth.signUp('example@email.com', 'example-password'); - -final user = res.data?.user; -final error = res.error; -``` - -### Sign up with third-party providers. - -If you are using Flutter, you can sign up with OAuth providers using the [`signInWithProvider()`](/docs/reference/dart/auth-signinwithprovider) method available on `supabase_flutter`. diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-update.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-update.mdx deleted file mode 100644 index 69b16bd7af8..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-update.mdx +++ /dev/null @@ -1,36 +0,0 @@ ---- -id: auth-update -title: 'auth.update()' -slug: /auth-update -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Updates user data, if there is a logged in user. - -```dart -final res = await supabase.auth.update( - UserAttributes(data: {'hello': 'world'}) -); - -final error = res.error; -``` - -## Notes - -It's generally better to store user data in a table inside your public schema (i.e. `public.users`). -Use the `update()` method if you have data which rarely changes or is specific only to the logged in user. - -## Examples - -### Update a user's metadata. - -```dart -final res = await supabase.auth.update( - UserAttributes(data: {'hello': 'world'}) -); - -final error = res.error; -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-user.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-user.mdx deleted file mode 100644 index d789a54798a..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/auth-user.mdx +++ /dev/null @@ -1,23 +0,0 @@ ---- -id: auth-user -title: 'auth.user()' -slug: /auth-user -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Returns the user data, if there is a logged in user. - -```dart -final user = supabase.auth.user(); -``` - -## Examples - -### Get the logged in user - -```dart -final user = supabase.auth.user(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/containedby.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/containedby.mdx deleted file mode 100644 index 7410fab9675..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/containedby.mdx +++ /dev/null @@ -1,59 +0,0 @@ ---- -id: containedby -title: '.containedBy()' -slug: /containedby -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```dart -final res = await supabase - .from('countries') - .select('name, id, main_exports') - .containedBy('main_exports', ['cars', 'food', 'machine']) - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('countries') - .select('name, id, main_exports') - .containedBy('main_exports', ['cars', 'food', 'machine']) - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .containedBy('main_exports', ['orks', 'surveillance', 'evil']) - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('countries') - .delete() - .containedBy('main_exports', ['cars', 'food', 'machine']) - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_countries') - .containedBy('main_exports', ['cars', 'food', 'machine']) - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/contains.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/contains.mdx deleted file mode 100644 index 4349bd001b9..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/contains.mdx +++ /dev/null @@ -1,59 +0,0 @@ ---- -id: contains -title: '.contains()' -slug: /contains -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```dart -final res = await supabase - .from('countries') - .select('name, id, main_exports') - .contains('main_exports', ['oil']) - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('countries') - .select('name, id, main_exports') - .contains('main_exports', ['oil']) - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .contains('main_exports', ['oil']) - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('countries') - .delete() - .contains('main_exports', ['oil']) - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_countries') - .contains('main_exports', ['oil']) - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/delete.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/delete.mdx deleted file mode 100644 index 5f7de2ff42b..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/delete.mdx +++ /dev/null @@ -1,35 +0,0 @@ ---- -id: delete -title: 'Delete data: delete()' -slug: /delete -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Performs a DELETE on the table. - -```dart -final res = await supabase - .from('cities') - .delete() - .match({ 'id': 666 }) - .execute(); -``` - -## Notes - -- `delete()` should always be combined with [Filters](/docs/reference/dart/using-filters) to target the item(s) you wish to delete. - -## Examples - -### Delete records - -```dart -final res = await supabase - .from('cities') - .delete() - .match({ 'id': 666 }) - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/eq.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/eq.mdx deleted file mode 100644 index af396084f38..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/eq.mdx +++ /dev/null @@ -1,61 +0,0 @@ ---- -id: eq -title: '.eq()' -slug: /eq -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` exactly matches the specified `value`. - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'The shire') - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'The shire') - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .eq('name', 'San Francisco') - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('cities') - .delete() - .eq('name', 'Mordor') - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_cities') - .eq('name', 'San Francisco') - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/filter.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/filter.mdx deleted file mode 100644 index 9f41c021f89..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/filter.mdx +++ /dev/null @@ -1,80 +0,0 @@ ---- -id: filter -title: '.filter()' -slug: /filter -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose `column` satisfies the filter. - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .filter('name', 'in', '("Paris","Tokyo")') - .execute(); -``` - -## Notes - -- `.filter()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values, so it should only be used as an escape hatch in case other filters don't work. - ```dart - .filter('arraycol','cs','{"a","b"}') // Use Postgres array {} and 'cs' for contains. - .filter('rangecol','cs','(1,2]') // Use Postgres range syntax for range column. - .filter('id','in','(6,7)') // Use Postgres list () and 'in' for in_ filter. - .filter('id','cs','{${mylist.join(',')}}') // You can insert a Dart array list. - ``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .filter('name', 'in', '("Paris","Tokyo")') - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .filter('name', 'in', '("Paris","Tokyo")') - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('cities') - .delete() - .filter('name', 'in', '("Paris","Tokyo")') - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_cities') - .filter('name', 'in', '("Paris","Tokyo")') -``` - -### Filter embedded resources - -```dart -final res = await supabase - .from('cities') - .select('name, countries ( name )') - .filter('countries.name', 'in', '("France","Japan")') - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/getsubscriptions.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/getsubscriptions.mdx deleted file mode 100644 index 9d7ed2989d7..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/getsubscriptions.mdx +++ /dev/null @@ -1,23 +0,0 @@ ---- -id: getsubscriptions -title: 'getSubscriptions()' -slug: /getsubscriptions -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Returns an array of all your subscriptions. - -```dart -final subscriptions = supabase.getSubscriptions(); -``` - -## Examples - -### Get all subscriptions - -```dart -final subscriptions = supabase.getSubscriptions(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/gt.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/gt.mdx deleted file mode 100644 index 7bc6f4c15b1..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/gt.mdx +++ /dev/null @@ -1,61 +0,0 @@ ---- -id: gt -title: '.gt()' -slug: /gt -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` is greater than the specified `value`. - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .gt('country_id', 250) - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .gt('country_id', 250) - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .gt('country_id', 250) - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('cities') - .delete() - .gt('country_id', 250) - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_cities') - .gt('country_id', 250) - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/gte.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/gte.mdx deleted file mode 100644 index c9a36c36cd8..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/gte.mdx +++ /dev/null @@ -1,61 +0,0 @@ ---- -id: gte -title: '.gte()' -slug: /gte -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` is greater than or equal to the specified `value`. - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .gte('country_id', 250) - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .gte('country_id', 250) - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .gte('country_id', 250) - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('cities') - .delete() - .gte('country_id', 250) - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_cities') - .gte('country_id', 250) - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/ilike.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/ilike.mdx deleted file mode 100644 index 88bd0f5ad70..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/ilike.mdx +++ /dev/null @@ -1,61 +0,0 @@ ---- -id: ilike -title: '.ilike()' -slug: /ilike -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value in the stated `column` matches the supplied `pattern` (case insensitive). - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .ilike('name', '%la%') - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .ilike('name', '%la%') - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .ilike('name', '%la%') - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('cities') - .delete() - .ilike('name', '%la%') - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_cities') - .ilike('name', '%la%') - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/in_.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/in_.mdx deleted file mode 100644 index be147c9fc43..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/in_.mdx +++ /dev/null @@ -1,63 +0,0 @@ ---- -id: in_ -title: '.in_()' -slug: /in_ -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` is found on the specified `values`. - -`is_` and `in_` filter methods are suffixed with `_` to avoid collisions with reserved keywords. - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .in_('name', ['Rio de Janeiro', 'San Francisco']) - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .in_('name', ['Rio de Janeiro', 'San Francisco']) - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .in_('name', ['Rio de Janeiro', 'San Francisco']) - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('cities') - .delete() - .in_('name', ['Rio de Janeiro', 'San Francisco']) - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_cities') - .in_('name', ['Rio de Janeiro', 'San Francisco']) - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/index.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/index.mdx deleted file mode 100644 index 946a7d97d95..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/index.mdx +++ /dev/null @@ -1,11 +0,0 @@ ---- -id: index -title: 'Getting started' -slug: getting-started -custom_edit_url: ../../spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Supabase Dart. diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/initializing.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/initializing.mdx deleted file mode 100644 index 4d8e7de815f..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/initializing.mdx +++ /dev/null @@ -1,37 +0,0 @@ ---- -id: initializing -title: 'Initializing' -slug: /initializing -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -## Dart - -You can initialize a new Supabase client using the `SupabaseClient()` method. - -The Supabase client is your entrypoint to the rest of the Supabase functionality -and is the easiest way to interact with everything we offer within the Supabase ecosystem. - -## Flutter - -For `supabase_flutter`, you will be using the static `initialize()` method on `Supabase` class. - -## Examples - -### Dart SupabaseClient() - -```dart -final supabase = SupabaseClient('https://xyzcompany.supabase.co', 'public-anon-key'); -``` - -### Flutter initialize() - -```dart title="main.dart" -Future main() async { - await Supabase.initialize(url: 'https://xyzcompany.supabase.co', anonKey: 'public-anon-key'); - runApp(MyApp()); -} -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/insert.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/insert.mdx deleted file mode 100644 index 6330ee63c0c..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/insert.mdx +++ /dev/null @@ -1,48 +0,0 @@ ---- -id: insert -title: 'Create data: insert()' -slug: /insert -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Performs an INSERT into the table. - -```dart -final res = await supabase - .from('cities') - .insert([ - {'name': 'The Shire', 'country_id': 554} - ]).execute(); -``` - -## Notes - -- By default, every time you run `insert()`, the client library will make a `select` to return the full record. - This is convenient, but it can also cause problems if your Policies are not configured to allow the `select` operation. - If you are using Row Level Security and you are encountering problems, try setting the `returning` param to `minimal`. - -## Examples - -### Create a record - -```dart -final res = await supabase - .from('cities') - .insert([ - {'name': 'The Shire', 'country_id': 554} - ]).execute(); -``` - -### Bulk create - -```dart -final res = await supabase - .from('cities') - .insert([ - {'name': 'The Shire', 'country_id': 554}, - {'name': 'Rohan', 'country_id': 555}, - ]).execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/installing.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/installing.mdx deleted file mode 100644 index 4930b9baeff..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/installing.mdx +++ /dev/null @@ -1,32 +0,0 @@ ---- -id: installing -title: 'Installing' -slug: /installing -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -## Dart - -Dart libraries are built and supported by the community. - -```bash -dart pub add supabase -``` - -Find the source code on [GitHub](https://github.com/supabase/supabase-dart). - -## Flutter - -For Flutter project, you can use [supabase_flutter](https://github.com/supabase/supabase-flutter). - -```bash -flutter pub add supabase_flutter -``` - -`supabase_flutter` plugin uses `supabase` plugin internally, and it adds some Flutter specific functionality such as handling deeplinks coming back from magic link verifications. -If you are creating a Flutter application, we recommend using `supabase_flutter` instead of `supabase`. - -For the most part `supabase_flutter` shares the same API as `supabase` with few exceptions such as initialization or OAuth sign in. diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/invoke.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/invoke.mdx deleted file mode 100644 index 1bc5f777f03..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/invoke.mdx +++ /dev/null @@ -1,60 +0,0 @@ ---- -id: invoke -title: 'invoke()' -slug: /invoke -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Invokes a Supabase Function. See the [guide](/docs/guides/functions) for details on writing Functions. - -```dart -final res = await supabaseClient.functions.invoke('hello', body: {'foo': 'baa'}); -final data = res.data; -final error = res.error; -``` - -## Notes - -- Requires an Authorization header. -- Invoke params generally match the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) spec. - -## Examples - -### Basic invocation. - -```dart -final res = await supabaseClient.functions.invoke('hello', body: {'foo': 'baa'}); -final data = res.data; -final error = res.error; -``` - -### Specifying response type. - -By default, `invoke()` will parse the response as JSON. You can parse the response in the following formats: `json`, `blob`, `text`, and `arrayBuffer`. - -```dart -final res = await supabaseClient.functions.invoke( - 'hello', - body: {'foo': 'baa'}, - responseType: ResponseType.text, -); -final data = res.data; -final error = res.error; -``` - -### Parsing custom headers. - -Any `headers` will be passed through to the function. A common pattern is to pass a logged-in user's JWT token as an Authorization header. - -```dart -final res = await supabaseClient.functions.invoke( - 'hello', - body: {'foo': 'baa'}, - headers: { - 'Authorization': 'Bearer ${supabase.auth.session()?.access_token}' - }, -); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/is_.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/is_.mdx deleted file mode 100644 index 89e4b117d88..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/is_.mdx +++ /dev/null @@ -1,63 +0,0 @@ ---- -id: is_ -title: '.is_()' -slug: /is_ -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -A check for exact equality (null, true, false), finds all rows whose value on the stated `column` exactly match the specified `value`. - -`is_` and `in_` filter methods are suffixed with `_` to avoid collisions with reserved keywords. - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .is_('name', null) - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .is_('name', null) - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .is_('name', null) - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('cities') - .delete() - .is_('name', null) - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_cities') - .is_('name', null) - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/like.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/like.mdx deleted file mode 100644 index 69ec224c02e..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/like.mdx +++ /dev/null @@ -1,107 +0,0 @@ ---- -id: like -title: '.like()' -slug: /like -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value in the stated `column` matches the supplied `pattern` (case sensitive). - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .like('name', '%la%') - .execute(); -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - object - -

    -
    - -The column to filter on. - -
    - -
  • - -
  • -

    - - pattern - - - required - - - string - -

    -
    - -The pattern to filter with. - -
    - -
  • - -
- -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .like('name', '%la%') - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .like('name', '%la%') - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('cities') - .delete() - .like('name', '%la%') - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_cities') - .like('name', '%la%') - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/limit.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/limit.mdx deleted file mode 100644 index 69358c1d106..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/limit.mdx +++ /dev/null @@ -1,42 +0,0 @@ ---- -id: limit -title: 'limit()' -slug: /limit -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Limits the result with the specified count. - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .limit(1) - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .limit(1) - .execute(); -``` - -### With embedded resources - -```dart -final res = await supabase - .from('countries') - .select('name, cities(name)') - .eq('name', 'United States') - .limit(1, foreignTable: 'cities' ) - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/lt.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/lt.mdx deleted file mode 100644 index 130a5a09de7..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/lt.mdx +++ /dev/null @@ -1,61 +0,0 @@ ---- -id: lt -title: '.lt()' -slug: /lt -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` is less than the specified `value`. - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .lt('country_id', 250) - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .lt('country_id', 250) - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .lt('country_id', 250) - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('cities') - .delete() - .lt('country_id', 250) - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_cities') - .lt('country_id', 250) - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/lte.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/lte.mdx deleted file mode 100644 index 15fa4ac1280..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/lte.mdx +++ /dev/null @@ -1,107 +0,0 @@ ---- -id: lte -title: '.lte()' -slug: /lte -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` is less than or equal to the specified `value`. - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .lte('country_id', 250) - .execute(); -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - object - -

    -
    - -The column to filter on. - -
    - -
  • - -
  • -

    - - value - - - required - - - object - -

    -
    - -The value to filter with. - -
    - -
  • - -
- -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .lte('country_id', 250) - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .lte('country_id', 250) - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('cities') - .delete() - .lte('country_id', 250) - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_cities') - .lte('country_id', 250) - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/match.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/match.mdx deleted file mode 100644 index d5f51720cc7..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/match.mdx +++ /dev/null @@ -1,61 +0,0 @@ ---- -id: match -title: '.match()' -slug: /match -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose columns match the specified `query` object. - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .match({'name': 'Beijing', 'country_id': 156}) - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .match({'name': 'Beijing', 'country_id': 156}) - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .match({'name': 'Beijing', 'country_id': 156}) - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('cities') - .delete() - .match({'name': 'Beijing', 'country_id': 156}) - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_cities') - .match({'name': 'Beijing', 'country_id': 156}) - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/neq.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/neq.mdx deleted file mode 100644 index 8634f355312..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/neq.mdx +++ /dev/null @@ -1,61 +0,0 @@ ---- -id: neq -title: '.neq()' -slug: /neq -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` doesn't match the specified `value`. - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .neq('name', 'The shire') - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .neq('name', 'The shire') - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .neq('name', 'San Francisco') - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('cities') - .delete() - .neq('name', 'Mordor') - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_cities') - .neq('name', 'Lagos') - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/not.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/not.mdx deleted file mode 100644 index a616d4ee84e..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/not.mdx +++ /dev/null @@ -1,73 +0,0 @@ ---- -id: not -title: '.not()' -slug: /not -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows which doesn't satisfy the filter. - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .not('name', 'eq', 'Paris') - .execute(); -``` - -## Notes - -- `.not()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values. - - ```dart - .not('name','eq','Paris') - .not('arraycol','cs','{"a","b"}') // Use Postgres array {} for array column and 'cs' for contains. - .not('rangecol','cs','(1,2]') // Use Postgres range syntax for range column. - .not('id','in','(6,7)') // Use Postgres list () and 'in' for in_ filter. - .not('id','in','(${mylist.join(',')})') // You can insert a Dart list array. - ``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .not('name', 'eq', 'Paris') - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('cities') - .update({ 'name': 'Mordor' }) - .not('name', 'eq', 'Paris') - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('cities') - .delete() - .not('name', 'eq', 'Paris') - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_cities) - .not('name', 'eq', 'Paris') - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/or.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/or.mdx deleted file mode 100644 index 6ff5d72f7ca..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/or.mdx +++ /dev/null @@ -1,51 +0,0 @@ ---- -id: or -title: '.or()' -slug: /or -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows satisfying at least one of the filters. - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .or('id.eq.20,id.eq.30') - .execute(); -``` - -## Notes - -- `.or()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values. - - ```dart - .or('id.in.(6,7),arraycol.cs.{"a","b"}') // Use Postgres list () and 'in' for in_ filter. Array {} and 'cs' for contains. - .or('id.in.(${mylist.join(',')}),arraycol.cs.{${mylistArray.join(',')}}') // You can insert a Dart list for list or array column. - .or('id.in.(${mylist.join(',')}),rangecol.cs.(${mylistRange.join(',')}]') // You can insert a Dart list for list or range column. - ``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .or('id.eq.20,id.eq.30') - .execute(); -``` - -### Use `or` with `and` - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .or('id.gt.20,and(name.eq.New Zealand,name.eq.France)') - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/order.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/order.mdx deleted file mode 100644 index 3d559c632b9..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/order.mdx +++ /dev/null @@ -1,42 +0,0 @@ ---- -id: order -title: 'order()' -slug: /order -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Orders the result with the specified column. - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .order('id', ascending: false ) - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .order('id', ascending: false ) - .execute(); -``` - -### With embedded resources - -```dart -final res = await supabase - .from('countries') - .select('name, cities(name)') - .eq('name', 'United States') - .order('name', foreignTable: 'cities') - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/overlaps.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/overlaps.mdx deleted file mode 100644 index 3985e4f2f89..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/overlaps.mdx +++ /dev/null @@ -1,59 +0,0 @@ ---- -id: overlaps -title: '.overlaps()' -slug: /overlaps -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```dart -final res = await supabase - .from('countries') - .select('name, id, main_exports') - .overlaps('main_exports', ['computers', 'minerals']) - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('countries') - .select('name, id, main_exports') - .overlaps('main_exports', ['computers', 'minerals']) - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .overlaps('main_exports', ['computers', 'minerals']) - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('countries') - .delete() - .overlaps('main_exports', ['computers', 'minerals']) - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_countries') - .overlaps('main_exports', ['computers', 'minerals']) - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/range.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/range.mdx deleted file mode 100644 index fe8f1e987cc..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/range.mdx +++ /dev/null @@ -1,31 +0,0 @@ ---- -id: range -title: 'range()' -slug: /range -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Limits the result to rows within the specified range, inclusive. - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .range(0,3) - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .range(0,3) - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/rangeadjacent.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/rangeadjacent.mdx deleted file mode 100644 index 002f1ee8c73..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/rangeadjacent.mdx +++ /dev/null @@ -1,59 +0,0 @@ ---- -id: rangeadjacent -title: '.rangeAdjacent()' -slug: /rangeadjacent -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```dart -final res = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeAdjacent('population_range_millions', '[70, 185]') - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeAdjacent('population_range_millions', '[70, 185]') - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .rangeAdjacent('population_range_millions', '[70, 185]') - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('countries') - .delete() - .rangeAdjacent('population_range_millions', '[70, 185]') - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_countries') - .rangeAdjacent('population_range_millions', '[70, 185]') - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/rangegt.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/rangegt.mdx deleted file mode 100644 index 1a44b170727..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/rangegt.mdx +++ /dev/null @@ -1,59 +0,0 @@ ---- -id: rangegt -title: '.rangeGt()' -slug: /rangegt -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```dart -final res = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGt('population_range_millions', '[150, 250]') - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGt('population_range_millions', '[150, 250]') - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .rangeGt('population_range_millions', '[150, 250]') - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('countries') - .delete() - .rangeGt('population_range_millions', '[150, 250]') - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_countries') - .rangeGt('population_range_millions', '[150, 250]') - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/rangegte.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/rangegte.mdx deleted file mode 100644 index a641d5eeba9..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/rangegte.mdx +++ /dev/null @@ -1,59 +0,0 @@ ---- -id: rangegte -title: '.rangeGte()' -slug: /rangegte -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```dart -final res = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGte('population_range_millions', '[150, 250]') - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGte('population_range_millions', '[150, 250]') - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .rangeGte('population_range_millions', '[150, 250]') - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('countries') - .delete() - .rangeGte('population_range_millions', '[150, 250]') - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_countries') - .rangeGte('population_range_millions', '[150, 250]') - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/rangelt.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/rangelt.mdx deleted file mode 100644 index 99f8484a912..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/rangelt.mdx +++ /dev/null @@ -1,59 +0,0 @@ ---- -id: rangelt -title: '.rangeLt()' -slug: /rangelt -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```dart -final res = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLt('population_range_millions', '[150, 250]') - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLt('population_range_millions', '[150, 250]') - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .rangeLt('population_range_millions', '[150, 250]') - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('countries') - .delete() - .rangeLt('population_range_millions', '[150, 250]') - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_countries') - .rangeLt('population_range_millions', '[150, 250]') - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/rangelte.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/rangelte.mdx deleted file mode 100644 index 548b61c2668..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/rangelte.mdx +++ /dev/null @@ -1,59 +0,0 @@ ---- -id: rangelte -title: '.rangeLte()' -slug: /rangelte -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```dart -final res = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLte('population_range_millions', '[150, 250]') - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLte('population_range_millions', '[150, 250]') - .execute(); -``` - -### With `update()` - -```dart -final res = await supabase - .from('countries') - .update({ 'name': 'Mordor' }) - .rangeLte('population_range_millions', '[150, 250]') - .execute(); -``` - -### With `delete()` - -```dart -final res = await supabase - .from('countries') - .delete() - .rangeLte('population_range_millions', '[150, 250]') - .execute(); -``` - -### With `rpc()` - -```dart -// Only valid if the Stored Procedure returns a table type. -final res = await supabase - .rpc('echo_all_countries') - .rangeLte('population_range_millions', [150, 250]) - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/removesubscription.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/removesubscription.mdx deleted file mode 100644 index 5c95f1b1a60..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/removesubscription.mdx +++ /dev/null @@ -1,27 +0,0 @@ ---- -id: removesubscription -title: 'removeSubscription()' -slug: /removesubscription -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Removes an active subscription and returns the number of open connections. - -```dart -supabase.removeSubscription(mySubscription); -``` - -## Notes - -- Removing subscriptions is a great way to maintain the performance of your project's database. Supabase will automatically handle cleanup 30 seconds after a user is disconnected, but unused subscriptions may cause degradation as more users are simultaneously subscribed. - -## Examples - -### Remove a subscription - -```dart -supabase.removeSubscription(mySubscription); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/reset-password-email.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/reset-password-email.mdx deleted file mode 100644 index d7c61047c9f..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/reset-password-email.mdx +++ /dev/null @@ -1,61 +0,0 @@ ---- -id: reset-password-email -title: 'Reset Password (Email)' -slug: /reset-password-email -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Sends a reset request to an email address. - -```dart -final res = await supabase.auth.api.resetPasswordForEmail('user@example.com'); - -final error = res.error; -``` - -## Notes - -Sends a reset request to an email address. - -When the user clicks the reset link in the email they will be forwarded to: - -`#access_token=x&refresh_token=y&expires_in=z&token_type=bearer&type=recovery` - -Your app must detect `type=recovery` in the fragment and display a password reset form to the user. - -You should then use the access_token in the url and new password to update the user as follows: - -```dart -final res = await supabase.auth.api.updateUser( - accessToken, - UserAttributes(password: 'NEW_PASSWORD'), -); -``` - -## Examples - -### Reset password - -```dart -final res = await supabase.auth.api.resetPasswordForEmail('user@example.com'); - -final error = res.error; -``` - -### Reset password for Flutter - -You can pass `redirectTo` to open the app via deeplink when user opens the password reset email. - -```dart -final res = await supabase.auth.api.resetPasswordForEmail( - 'user@example.com', - options: AuthOptions(redirectTo: kIsWeb - ? null - : 'io.supabase.flutter://reset-callback/'), -); - -final error = res.error; -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/rpc.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/rpc.mdx deleted file mode 100644 index 78f0367e7a6..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/rpc.mdx +++ /dev/null @@ -1,51 +0,0 @@ ---- -id: rpc -title: 'Stored Procedures: rpc()' -slug: /rpc -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -You can call stored procedures as a "Remote Procedure Call". - -That's a fancy way of saying that you can put some logic into your database then call it from anywhere. -It's especially useful when the logic rarely changes - like password resets and updates. - -```dart -final res = await supabase - .rpc('hello_world') - .execute(); -``` - -## Examples - -### Call a stored procedure - -This is an example invoking a stored procedure. - -```dart -final res = await supabase - .rpc('hello_world') - .execute(); -``` - -### With Parameters - -```dart -final res = await supabase - .rpc('echo_city', params: { 'name': 'The Shire' }) - .execute(); -``` - -### With count option - -You can specify a count option to get the row count along with your data. -Allowed values for count option are `exact`, `planned` and `estimated`. - -```dart -final res = await supabase - .rpc('hello_world') - .execute(count: CountOption.exact); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/select.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/select.mdx deleted file mode 100644 index 827be2a3f6a..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/select.mdx +++ /dev/null @@ -1,147 +0,0 @@ ---- -id: select -title: 'Fetch data: select()' -slug: /select -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Performs vertical filtering with SELECT. - -```dart -final res = await supabase - .from('cities') - .select() - .execute(); - -final data = res.data; -final error = res.error; -``` - -## Notes - -- By default, Supabase projects will return a maximum of 1,000 rows. This setting can be changed in Project API Settings. It's recommended that you keep it low to limit the payload size of accidental or malicious requests. You can use `range()` queries to paginate through your data. -- `select()` can be combined with [Modifiers](/docs/reference/dart/using-modifiers) -- `select()` can be combined with [Filters](/docs/reference/dart/using-filters) -- If using the Supabase hosted platform `apikey` is technically a reserved keyword, since the API gateway will pluck it out for authentication. [It should be avoided as a column name](https://github.com/supabase/supabase/issues/5465). - -## Examples - -### Getting your data - -```dart -final res = await supabase - .from('cities') - .select() - .execute(); - -final data = res.data; -final error = res.error; -``` - -### Selecting specific columns - -You can select specific fields from your tables. - -```dart -final res = await supabase - .from('cities') - .select('name') - .execute(); -``` - -### Query foreign tables - -If your database has relationships, you can query related tables too. - -```dart -final res = await supabase - .from('countries') - .select(''' - name, - cities ( - name - ) - ''') - .execute(); -``` - -### Query the same foreign table multiple times - -Sometimes you will need to query the same foreign table twice. -In this case, you can use the name of the joined column to identify -which join you intend to use. For convenience, you can also give an -alias for each column. For example, if we had a shop of products, -and we wanted to get the supplier and the purchaser at the same time -(both in the users) table: - -```dart -final res = await supabase - .from('products') - .select(''' - id, - supplier:supplier_id ( name ), - purchaser:purchaser_id ( name ) - ''') - .execute(); -``` - -### Filtering with inner joins - -If you want to filter a table based on a child table's values you can use the `!inner()` function. For example, if you wanted -to select all rows in a `message` table which belong to a user with the `username` "Jane": - -```dart -final res = await supabase - .from('messages') - .select('*, users!inner(*)') - .eq('users.username', 'Jane') - .execute(); -``` - -### Querying with count option - -You can get the number of rows by using the count option. -Allowed values for count option are [exact](https://postgrest.org/en/stable/api.html#exact-count), [planned](https://postgrest.org/en/stable/api.html#planned-count) and [estimated](https://postgrest.org/en/stable/api.html#estimated-count). - -```dart -final res = await supabase - .from('cities') - .select('name') - .execute(count: CountOption.exact); - -final count = res.count; -``` - -### Querying JSON data - -If you have data inside of a JSONB column, you can apply select -and query filters to the data values. Postgres offers a -[number of operators](https://www.postgresql.org/docs/current/functions-json.html) -for querying JSON data. Also see -[PostgREST docs](http://postgrest.org/en/v7.0.0/api.html#json-columns) for more details. - -```dart -final res = await supabase - .from('users') - .select(''' - id, name, - address->street - ''') - .eq('address->postcode', 90210) - .execute(); -``` - -### Return data as CSV - -By default the data is returned in JSON format, however you can also request for it to be returned as Comma Separated Values. - -```dart -final res = await supabase - .from('users') - .select() - .csv() - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/single.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/single.mdx deleted file mode 100644 index 04a9c0c853a..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/single.mdx +++ /dev/null @@ -1,31 +0,0 @@ ---- -id: single -title: 'single()' -slug: /single -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Retrieves only one row from the result. Result must be one row (e.g. using limit), otherwise this will result in an error. - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .single() - .execute(); -``` - -## Examples - -### With `select()` - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .single() - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-createbucket.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-createbucket.mdx deleted file mode 100644 index dd3ba519532..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-createbucket.mdx +++ /dev/null @@ -1,33 +0,0 @@ ---- -id: storage-createbucket -title: 'createBucket()' -slug: /storage-createbucket -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Creates a new Storage bucket - -```dart -final res = await supabase - .storage - .createBucket('avatars'); -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: `insert` - - `objects` permissions: none - -## Examples - -### Create bucket - -```dart -final res = await supabase - .storage - .createBucket('avatars'); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-deletebucket.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-deletebucket.mdx deleted file mode 100644 index d8466d3ddd6..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-deletebucket.mdx +++ /dev/null @@ -1,33 +0,0 @@ ---- -id: storage-deletebucket -title: 'deleteBucket()' -slug: /storage-deletebucket -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Deletes an existing bucket. A bucket can't be deleted with existing objects inside it. You must first `empty()` the bucket. - -```dart -final res = await supabase - .storage - .deleteBucket('avatars'); -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: `select` and `delete` - - `objects` permissions: none - -## Examples - -### Delete bucket - -```dart -final res = await supabase - .storage - .deleteBucket('avatars'); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-emptybucket.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-emptybucket.mdx deleted file mode 100644 index 47372c505ee..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-emptybucket.mdx +++ /dev/null @@ -1,33 +0,0 @@ ---- -id: storage-emptybucket -title: 'emptyBucket()' -slug: /storage-emptybucket -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Removes all objects inside a single bucket. - -```dart -final res = await supabase - .storage - .emptyBucket('avatars'); -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: `select` - - `objects` permissions: `select` and `delete` - -## Examples - -### Empty bucket - -```dart -final res = await supabase - .storage - .emptyBucket('avatars'); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-createsignedurl.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-createsignedurl.mdx deleted file mode 100644 index e4c4ea26957..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-createsignedurl.mdx +++ /dev/null @@ -1,39 +0,0 @@ ---- -id: storage-from-createsignedurl -title: 'from.createSignedUrl()' -slug: /storage-from-createsignedurl -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Create signed url to download file without requiring permissions. This URL can be valid for a set number of seconds. - -```dart -final res = await supabase - .storage - .from('avatars') - .createSignedUrl('avatar1.png', 60); - -final signedURL = res.data; -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `select` - -## Examples - -### Create Signed URL - -```dart -final res = await supabase - .storage - .from('avatars') - .createSignedUrl('avatar1.png', 60); - -final signedURL = res.data; -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-download.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-download.mdx deleted file mode 100644 index 44c80600d91..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-download.mdx +++ /dev/null @@ -1,35 +0,0 @@ ---- -id: storage-from-download -title: 'from.download()' -slug: /storage-from-download -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Downloads a file. - -```dart -final res = await supabase - .storage - .from('avatars') - .download('avatar1.png'); -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `select` - -## Examples - -### Download file - -```dart -final res = await supabase - .storage - .from('avatars') - .download('avatar1.png'); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-getpublicurl.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-getpublicurl.mdx deleted file mode 100644 index 44cfa40072c..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-getpublicurl.mdx +++ /dev/null @@ -1,40 +0,0 @@ ---- -id: storage-from-getpublicurl -title: 'from.getPublicUrl()' -slug: /storage-from-getpublicurl -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Retrieve URLs for assets in public buckets - -```dart -final res = supabase - .storage - .from('public-bucket') - .getPublicUrl('avatar1.png'); - -final publicURL = res.data; -``` - -## Notes - -- The bucket needs to be set to public, either via [updateBucket()](/docs/reference/javascript/storage-updatebucket) or by going to Storage on [app.supabase.com](https://app.supabase.com), clicking the overflow menu on a bucket and choosing "Make public" -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: none - -## Examples - -### Returns the URL for an asset in a public bucket - -```dart -final res = supabase - .storage - .from('public-bucket') - .getPublicUrl('avatar1.png'); - -final publicURL = res.data; -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-list.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-list.mdx deleted file mode 100644 index d760e8b757f..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-list.mdx +++ /dev/null @@ -1,35 +0,0 @@ ---- -id: storage-from-list -title: 'from.list()' -slug: /storage-from-list -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Lists all the files within a bucket. - -```dart -final res = await supabase - .storage - .from('avatars') - .list(); -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `select` - -## Examples - -### List files in a bucket - -```dart -final res = await supabase - .storage - .from('avatars') - .list(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-move.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-move.mdx deleted file mode 100644 index 0a0462da7ed..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-move.mdx +++ /dev/null @@ -1,35 +0,0 @@ ---- -id: storage-from-move -title: 'from.move()' -slug: /storage-from-move -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Moves an existing file, optionally renaming it at the same time. - -```dart -final res = await supabase - .storage - .from('avatars') - .move('public/avatar1.png', 'private/avatar2.png'); -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `update` and `select` - -## Examples - -### Move file - -```dart -final res = await supabase - .storage - .from('avatars') - .move('public/avatar1.png', 'private/avatar2.png'); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-remove.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-remove.mdx deleted file mode 100644 index 4267ab63d0e..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-remove.mdx +++ /dev/null @@ -1,35 +0,0 @@ ---- -id: storage-from-remove -title: 'from.remove()' -slug: /storage-from-remove -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Deletes files within the same bucket - -```dart -final res = await supabase - .storage - .from('avatars') - .remove(['avatar1.png']); -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `delete` and `select` - -## Examples - -### Delete file - -```dart -final res = await supabase - .storage - .from('avatars') - .remove(['avatar1.png']); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-update.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-update.mdx deleted file mode 100644 index 03dac7904f4..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-update.mdx +++ /dev/null @@ -1,43 +0,0 @@ ---- -id: storage-from-update -title: 'from.update()' -slug: /storage-from-update -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Replaces an existing file at the specified path with a new one. - -```dart -final avatarFile = File('path/to/file'); -final res = await supabase - .storage - .from('avatars') - .update('public/avatar1.png', avatarFile, fileOptions: FileOptions( - cacheControl: '3600', - upsert: false - )); -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `update` and `select` - -## Examples - -### Update file - -```dart -final avatarFile = File('path/to/file'); -final res = await supabase - .storage - .from('avatars') - .update('public/avatar1.png', avatarFile, fileOptions: FileOptions( - cacheControl: '3600', - upsert: false - )); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-upload.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-upload.mdx deleted file mode 100644 index f9454c41893..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-from-upload.mdx +++ /dev/null @@ -1,112 +0,0 @@ ---- -id: storage-from-upload -title: 'from.upload()' -slug: /storage-from-upload -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Uploads a file to an existing bucket. - -```dart -final avatarFile = File('path/to/file'); -final res = await supabase - .storage - .from('avatars') - .upload('public/avatar1.png', avatarFile, fileOptions: FileOptions( - cacheControl: '3600', - upsert: false - )); -``` - -## Parameters - -
    - -
  • -

    - - path - - - required - - - string - -

    -
    - -The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload. - -
    - -
  • - -
  • -

    - - fileBody - - - required - - - ArrayBuffer | ArrayBufferView | Blob | Buffer | File | FormData | ReadableStream | ReadableStream | URLSearchParams | string - -

    -
    - -The body of the file to be stored in the bucket. - -
    - -
  • - -
  • -

    - - fileOptions - - - optional - - - FileOptions - -

    -
    - -HTTP headers. -`cacheControl`: string, the `Cache-Control: max-age=` seconds value. -`contentType`: string, the `Content-Type` header value. Should be specified if using a `fileBody` that is neither `Blob` nor `File` nor `FormData`, otherwise will default to `text/plain;charset=UTF-8`. -`upsert`: boolean, whether to perform an upsert. - -
    - -
  • - -
- -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `insert` - -## Examples - -### Upload file - -```dart -final avatarFile = File('path/to/file'); -final res = await supabase - .storage - .from('avatars') - .upload('public/avatar1.png', avatarFile, fileOptions: FileOptions( - cacheControl: '3600', - upsert: false - )); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-getbucket.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-getbucket.mdx deleted file mode 100644 index bc086060252..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-getbucket.mdx +++ /dev/null @@ -1,59 +0,0 @@ ---- -id: storage-getbucket -title: 'getBucket()' -slug: /storage-getbucket -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Retrieves the details of an existing Storage bucket. - -```dart -final res = await supabase - .storage - .getBucket('avatars') -``` - -## Parameters - -
    - -
  • -

    - - id - - - required - - - string - -

    -
    - -The unique identifier of the bucket you would like to retrieve. - -
    - -
  • - -
- -## Notes - -- Policy permissions required: - - `buckets` permissions: `select` - - `objects` permissions: none - -## Examples - -### Get bucket - -```dart -final res = await supabase - .storage - .getBucket('avatars') -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-listbuckets.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-listbuckets.mdx deleted file mode 100644 index b51a7024740..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-listbuckets.mdx +++ /dev/null @@ -1,33 +0,0 @@ ---- -id: storage-listbuckets -title: 'listBuckets()' -slug: /storage-listbuckets -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Retrieves the details of all Storage buckets within an existing product. - -```dart -final res = await supabase - .storage - .listBuckets() -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: `select` - - `objects` permissions: none - -## Examples - -### List buckets - -```dart -final res = await supabase - .storage - .listBuckets() -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-updatebucket.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-updatebucket.mdx deleted file mode 100644 index 38809788af9..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/storage-updatebucket.mdx +++ /dev/null @@ -1,33 +0,0 @@ ---- -id: storage-updatebucket -title: 'updateBucket()' -slug: /storage-updatebucket -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Updates a new Storage bucket - -```dart -final res = await supabase - .storage - .updateBucket('avatars', { public: false }); -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: `update` - - `objects` permissions: none - -## Examples - -### Update bucket - -```dart -final res = await supabase - .storage - .updateBucket('avatars', { public: false }); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/stream.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/stream.mdx deleted file mode 100644 index 994d8005507..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/stream.mdx +++ /dev/null @@ -1,67 +0,0 @@ ---- -id: stream -title: 'stream()' -slug: /stream -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Notifies of data at the queried table. - -```dart -supabase - .from('countries') - .stream(['id']) - .execute(); -``` - -## Notes - -- `stream()` will emit the initial data as well as any further change on the database as `Stream` of `List>` by combining Postgrest and Realtime. -- Takes a list of primary key columns as its argument. - -## Examples - -### Listening to a specific table - -```dart -supabase - .from('countries') - .stream(['id']) - .execute(); -``` - -### Listening to a specific rows within a table - -You can listen to individual rows using the format `{table}:{col}=eq.{val}` - where `{col}` is the column name, and `{val}` is the value which you want to match. -This syntax is the as how you can filter data in Realtime - -```dart -supabase - .from('countries:id=eq.120') - .stream(['id']) - .execute(); -``` - -### With `order()` - -```dart -supabase - .from('countries') - .stream(['id']) - .order('name', ascending: false) - .execute(); -``` - -### With `limit()` - -```dart -supabase - .from('countries') - .stream(['id']) - .order('name', ascending: false) - .limit(10) - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/subscribe.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/subscribe.mdx deleted file mode 100644 index 866fed8d0ec..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/subscribe.mdx +++ /dev/null @@ -1,119 +0,0 @@ ---- -id: subscribe -title: 'on().subscribe()' -slug: /subscribe -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Subscribe to realtime changes in your database. - -```dart -final mySubscription = supabase - .from('countries') - .on(SupabaseEventTypes.all, (payload) { - // Handle realtime payload - }) - .subscribe(); -``` - -## Notes - -- Realtime is disabled by default for new Projects for better database performance and security. You can turn it on by [managing replication](/docs/guides/api#managing-realtime). -- If you want to receive the "previous" data for updates and deletes, you will need to set `REPLICA IDENTITY` to `FULL`, like this: `ALTER TABLE your_table REPLICA IDENTITY FULL;` - -## Examples - -### Listen to all database changes - -```dart -final mySubscription = supabase - .from('countries') - .on(SupabaseEventTypes.all, (payload) { - // Handle realtime payload - }) - .subscribe(); -``` - -### Listening to a specific table - -```dart -final mySubscription = supabase - .from('countries') - .on(SupabaseEventTypes.all, (payload) { - // Handle realtime payload - }) - .subscribe(); -``` - -### Listening to inserts - -```dart -final mySubscription = supabase - .from('countries') - .on(SupabaseEventTypes.insert, (payload) { - // Handle realtime payload - }) - .subscribe(); -``` - -### Listening to updates - -By default, Supabase will send only the updated record. If you want to receive the previous values as well you can -enable full replication for the table you are listening too: - -```sql -alter table "your_table" replica identity full; -``` - -```dart -final mySubscription = supabase - .from('countries') - .on(SupabaseEventTypes.update, (payload) { - // Handle realtime payload - }) - .subscribe(); -``` - -### Listening to deletes - -By default, Supabase does not send deleted records. If you want to receive the deleted record you can -enable full replication for the table you are listening too: - -```sql -alter table "your_table" replica identity full; -``` - -```dart -final mySubscription = supabase - .from('countries') - .on(SupabaseEventTypes.delete, (payload) { - // Handle realtime payload - }) - .subscribe(); -``` - -### Listening to multiple events - -You can chain listeners if you want to listen to multiple events for each table. - -```dart -final mySubscription = supabase - .from('countries') - .on(SupabaseEventTypes.insert, handleInsert) - .on(SupabaseEventTypes.delete, handleDelete) - .subscribe(); -``` - -### Listening to row level changes - -You can listen to individual rows using the format `{table}:{col}=eq.{val}` - where `{col}` is the column name, and `{val}` is the value which you want to match. - -```dart -final mySubscription = supabase - .from('countries:id=eq.200') - .on(SupabaseEventTypes.update, handleRecordUpdated) - .subscribe(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/textsearch.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/textsearch.mdx deleted file mode 100644 index 810eeb04b7a..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/textsearch.mdx +++ /dev/null @@ -1,77 +0,0 @@ ---- -id: textsearch -title: '.textSearch()' -slug: /textsearch -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose tsvector value on the stated `column` matches to_tsquery(query). - -## Examples - -### Text search - -```dart -final res = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', "'fat' & 'cat'", - config: 'english' - ) - .execute(); -``` - -### Basic normalization - -Uses PostgreSQL's `plainto_tsquery` function. - -```dart -final res = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', "'fat' & 'cat'", - type: TextSearchType.plain, - config: 'english' - ) - .execute(); -``` - -### Full normalization - -Uses PostgreSQL's `phraseto_tsquery` function. - -```dart -final res = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', "'fat' & 'cat'", - type: TextSearchType.phrase, - config: 'english' - ) - .execute(); -``` - -### Full normalization - -Uses PostgreSQL's `websearch_to_tsquery` function. -This function will never raise syntax errors, which makes it possible to use raw user-supplied input for search, and can be used -with advanced operators. - -- `unquoted text`: text not inside quote marks will be converted to terms separated by & operators, as if processed by plainto_tsquery. -- `"quoted text"`: text inside quote marks will be converted to terms separated by <-> operators, as if processed by phraseto_tsquery. -- `OR`: the word “or” will be converted to the | operator. -- `-`: a dash will be converted to the ! operator. - -```dart -final res = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', "'fat or cat'", - type: TextSearchType.websearch, - config: 'english' - ) - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/update.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/update.mdx deleted file mode 100644 index 280172efbed..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/update.mdx +++ /dev/null @@ -1,55 +0,0 @@ ---- -id: update -title: 'Modify data: update()' -slug: /update -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Performs an UPDATE on the table. - -```dart -final res = await supabase - .from('cities') - .update({ 'name': 'Middle Earth' }) - .match({ 'name': 'Auckland' }) - .execute(); -``` - -## Notes - -- `update()` should always be combined with [Filters](/docs/reference/dart/using-filters) to target the item(s) you wish to update. - -## Examples - -### Updating your data - -```dart -final res = await supabase - .from('cities') - .update({ 'name': 'Middle Earth' }) - .match({ 'name': 'Auckland' }) - .execute(); -``` - -### Updating JSON data - -Postgres offers a -[number of operators](https://www.postgresql.org/docs/current/functions-json.html) -for working with JSON data. Right now it is only possible to update an entire JSON document, -but we are [working on ideas](https://github.com/PostgREST/postgrest/issues/465) for updating individual keys. - -```dart -final res = await supabase - .from('users') - .update({ - 'address': { - 'street': 'Melrose Place', - 'postcode': 90210 - } - }) - .eq('address->postcode', 90210) - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/upsert.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/upsert.mdx deleted file mode 100644 index 5230a5dab54..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/upsert.mdx +++ /dev/null @@ -1,62 +0,0 @@ ---- -id: upsert -title: 'Upsert data: upsert()' -slug: /upsert -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Performs an UPSERT into the table. - -```dart -final res = await supabase - .from('messages') - .upsert({ 'id': 3, 'message': 'foo', 'username': 'supabot' }) - .execute(); -``` - -## Notes - -- Primary keys should be included in the data payload in order for an update to work correctly. -- Primary keys must be natural, not surrogate. There are however, [workarounds](https://github.com/PostgREST/postgrest/issues/1118) for surrogate primary keys. - -## Examples - -### Upsert your data - -```dart -final res = await supabase - .from('messages') - .upsert({ 'id': 3, 'message': 'foo', 'username': 'supabot' }) - .execute(); -``` - -### Upserting into tables with constraints - -Running the following will cause supabase to upsert data into the `users` table. -If the username 'supabot' already exists, the `onConflict` argument tells supabase to overwrite that row -based on the column passed into `onConflict`. - -```dart -final res = await supabase - .from('users') - .upsert({ 'username': 'supabot' }, { 'onConflict': 'username' }) - .execute(); -``` - -### Return the exact number of rows - -Allowed values for count option are `exact`, `planned` and `estimated`. - -```dart -final res = await supabase - .from('users') - .upsert({ - 'id': 3, - 'message': 'foo', - 'username': 'supabot' - }) - .execute(count: CountOption.exact); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/using-filters.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/using-filters.mdx deleted file mode 100644 index 839a35fc748..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/using-filters.mdx +++ /dev/null @@ -1,44 +0,0 @@ ---- -id: using-filters -title: 'Using Filters' -slug: /using-filters -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Filters can be used on `select()`, `update()`, and `delete()` queries. - -If a Stored Procedure returns a table response, you can also apply filters. - -### Applying Filters - -You must apply your filters to the end of your query. For example: - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'The Shire') // Correct - .execute(); - -final res = await supabase - .from('cities') - .eq('name', 'The Shire') // Incorrect - .select('name, country_id') - .execute(); -``` - -### Chaining - -Filters can be chained together to produce advanced queries. For example: - -```dart -final res = await supabase - .from('cities') - .select('name, country_id') - .gte('population', 1000) - .lt('population', 10000) - .execute(); -``` diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/using-modifiers.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/using-modifiers.mdx deleted file mode 100644 index 5fbbe72b81a..00000000000 --- a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/using-modifiers.mdx +++ /dev/null @@ -1,13 +0,0 @@ ---- -id: using-modifiers -title: 'Using Modifiers' -slug: /using-modifiers -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_dart_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Modifiers can be used on `select()` queries. - -If a Stored Procedure returns a table response, you can also apply modifiers to the `rpc()` function. diff --git a/apps/reference/_supabase_js/generated/auth-admin-createuser.mdx b/apps/reference/_supabase_js/generated/auth-admin-createuser.mdx deleted file mode 100644 index e690ec05e4b..00000000000 --- a/apps/reference/_supabase_js/generated/auth-admin-createuser.mdx +++ /dev/null @@ -1,263 +0,0 @@ ---- -id: auth-admin-createuser -title: 'createUser()' -slug: /auth-admin-createuser -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Creates a new user. -This function should only be called on a server. Never expose your `service_role` key in the browser. - -```js -const { data, error } = await supabase.auth.admin.createUser({ - email: 'user@email.com', - password: 'password', - user_metadata: { name: 'Yoda' }, -}) -``` - -## Parameters - -
    - -
  • -

    - - AdminUserAttributes - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - app_metadata - - - optional - - - object - -

      -
      - -A custom data object to store the user's application specific metadata. This maps to the `auth.users.app_metadata` column. - -Only a service role can modify. - -The `app_metadata` should be a JSON object that includes app-specific info, such as identity providers, roles, and other -access control information. - -
      - -
    • - -
    • -

      - - data - - - optional - - - object - -

      -
      - -A custom data object to store the user's metadata. This maps to the `auth.users.user_metadata` column. - -The `data` should be a JSON object that includes user-specific info, such as their first and last name. - -
      - -
    • - -
    • -

      - - email - - - optional - - - string - -

      -
      - -The user's email. - -
      - -
    • - -
    • -

      - - email_confirm - - - optional - - - boolean - -

      -
      - -Confirms the user's email address if set to true. - -Only a service role can modify. - -
      - -
    • - -
    • -

      - - password - - - optional - - - string - -

      -
      - -The user's password. - -
      - -
    • - -
    • -

      - - phone - - - optional - - - string - -

      -
      - -The user's phone. - -
      - -
    • - -
    • -

      - - phone_confirm - - - optional - - - boolean - -

      -
      - -Confirms the user's phone number if set to true. - -Only a service role can modify. - -
      - -
    • - -
    • -

      - - user_metadata - - - optional - - - object - -

      -
      - -A custom data object to store the user's metadata. This maps to the `auth.users.user_metadata` column. - -Only a service role can modify. - -The `user_metadata` should be a JSON object that includes user-specific info, such as their first and last name. - -Note: When using the GoTrueAdminApi and wanting to modify a user's metadata, -this attribute is used instead of UserAttributes data. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- To confirm the user's email address or phone number, set `email_confirm` or `phone_confirm` to true. Both arguments default to false. - -## Examples - -### Create a new user with custom user metadata - -```js -const { data, error } = await supabase.auth.admin.createUser({ - email: 'user@email.com', - password: 'password', - user_metadata: { name: 'Yoda' }, -}) -``` - -### Auto-confirm the user's email - -```js -const { data, error } = await supabase.auth.admin.createUser({ - email: 'user@email.com', - email_confirm: true, -}) -``` - -### Auto-confirm the user's phone number - -```js -const { data, error } = await supabase.auth.admin.createUser({ - phone: '1234567890', - phone_confirm: true, -}) -``` diff --git a/apps/reference/_supabase_js/generated/auth-admin-deleteuser.mdx b/apps/reference/_supabase_js/generated/auth-admin-deleteuser.mdx deleted file mode 100644 index d7e96b605e4..00000000000 --- a/apps/reference/_supabase_js/generated/auth-admin-deleteuser.mdx +++ /dev/null @@ -1,59 +0,0 @@ ---- -id: auth-admin-deleteuser -title: 'deleteUser()' -slug: /auth-admin-deleteuser -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Delete a user. Requires a `service_role` key. - -```js -const { data, error } = await supabase.auth.admin.deleteUser( - '715ed5db-f090-4b8c-a067-640ecee36aa0' -) -``` - -## Parameters - -
    - -
  • -

    - - id - - - required - - - string - -

    -
    - -The user id you want to remove. - -This function should only be called on a server. Never expose your `service_role` key in the browser. - -
    - -
  • - -
- -## Notes - -- The `deleteUser()` method requires the user's ID, which maps to the `auth.users.id` column. - -## Examples - -### Removes a user - -```js -const { data, error } = await supabase.auth.admin.deleteUser( - '715ed5db-f090-4b8c-a067-640ecee36aa0' -) -``` diff --git a/apps/reference/_supabase_js/generated/auth-admin-generatelink.mdx b/apps/reference/_supabase_js/generated/auth-admin-generatelink.mdx deleted file mode 100644 index 5c5a79e4721..00000000000 --- a/apps/reference/_supabase_js/generated/auth-admin-generatelink.mdx +++ /dev/null @@ -1,183 +0,0 @@ ---- -id: auth-admin-generatelink -title: 'generateLink()' -slug: /auth-admin-generatelink -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Generates email links and OTPs to send via a custom email provider. - -```js -const { data, error } = await supabase.auth.admin.generateLink({ - type: 'signup', - email: 'email@example.com', - options: { - password: 'secret', - }, -}) -``` - -## Parameters - -
    - -
  • -

    - - GenerateLinkParams - - - required - - - GenerateSignupLinkParams | GenerateInviteOrMagiclinkParams | GenerateRecoveryLinkParams | GenerateEmailChangeLinkParams - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - GenerateSignupLinkParams - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - GenerateRecoveryLinkParams - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - GenerateInviteOrMagiclinkParams - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - GenerateEmailChangeLinkParams - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
- -## Examples - -### Generate a signup link - -```js -const { data, error } = await supabase.auth.admin.generateLink({ - type: 'signup', - email: 'email@example.com', - options: { - password: 'secret', - }, -}) -``` - -### Generate an invite link - -```js -const { data, error } = await supabase.auth.admin.generateLink({ - type: 'invite', - email: 'email@example.com', -}) -``` - -### Generate a magic link - -```js -const { data, error } = await supabase.auth.admin.generateLink({ - type: 'magiclink', - email: 'email@example.com', -}) -``` - -### Generate a recovery link - -```js -const { data, error } = await supabase.auth.admin.generateLink({ - type: 'recovery', - email: 'email@example.com', -}) -``` - -### Generate a link to change email addresses - -```js -const { data, error } = await supabase.auth.admin.generateLink({ - type: 'email_change_current', - email: 'old.email@example.com', - newEmail: 'new.email@example.com', -}) -``` diff --git a/apps/reference/_supabase_js/generated/auth-admin-getuserbyid.mdx b/apps/reference/_supabase_js/generated/auth-admin-getuserbyid.mdx deleted file mode 100644 index d4a31673288..00000000000 --- a/apps/reference/_supabase_js/generated/auth-admin-getuserbyid.mdx +++ /dev/null @@ -1,56 +0,0 @@ ---- -id: auth-admin-getuserbyid -title: 'getUserById()' -slug: /auth-admin-getuserbyid -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Get user by id. - -```js -const { data, error } = await supabase.auth.admin.getUserById(1) -``` - -## Parameters - -
    - -
  • -

    - - uid - - - required - - - string - -

    -
    - -The user's unique identifier - -This function should only be called on a server. Never expose your `service_role` key in the browser. - -
    - -
  • - -
- -## Notes - -- Fetches the user object from the database based on the user's id. -- The `getUserById()` method requires the user's id which maps to the `auth.users.id` column. - -## Examples - -### Fetch the user object using the access_token jwt. - -```js -const { data, error } = await supabase.auth.admin.getUserById(1) -``` diff --git a/apps/reference/_supabase_js/generated/auth-admin-inviteuserbyemail.mdx b/apps/reference/_supabase_js/generated/auth-admin-inviteuserbyemail.mdx deleted file mode 100644 index d35c8d80387..00000000000 --- a/apps/reference/_supabase_js/generated/auth-admin-inviteuserbyemail.mdx +++ /dev/null @@ -1,122 +0,0 @@ ---- -id: auth-admin-inviteuserbyemail -title: 'inviteUserByEmail()' -slug: /auth-admin-inviteuserbyemail -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Sends an invite link to an email address. - -```js -const { data, error } = await supabase.auth.admin.inviteUserByEmail( - 'email@example.com' -) -``` - -## Parameters - -
    - -
  • -

    - - email - - - required - - - string - -

    -
    - -The email address of the user. - -
    - -
  • - -
  • -

    - - options - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - data - - - optional - - - object - -

      -
      - -Optional user metadata - -
      - -
    • - -
    • -

      - - redirectTo - - - optional - - - string - -

      -
      - -A URL or mobile deeplink to send the user to after they are confirmed. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- Sends an invite link to the user's email address. - -## Examples - -### Invite a user - -```js -const { data, error } = await supabase.auth.admin.inviteUserByEmail( - 'email@example.com' -) -``` diff --git a/apps/reference/_supabase_js/generated/auth-admin-listusers.mdx b/apps/reference/_supabase_js/generated/auth-admin-listusers.mdx deleted file mode 100644 index 8865b657add..00000000000 --- a/apps/reference/_supabase_js/generated/auth-admin-listusers.mdx +++ /dev/null @@ -1,31 +0,0 @@ ---- -id: auth-admin-listusers -title: 'listUsers()' -slug: /auth-admin-listusers -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Get a list of users. - -This function should only be called on a server. Never expose your `service_role` key in the browser. - -```js -const { - data: { users }, - error, -} = await supabase.auth.admin.listUsers() -``` - -## Examples - -### Get a full list of users. - -```js -const { - data: { users }, - error, -} = await supabase.auth.admin.listUsers() -``` diff --git a/apps/reference/_supabase_js/generated/auth-admin-updateuserbyid.mdx b/apps/reference/_supabase_js/generated/auth-admin-updateuserbyid.mdx deleted file mode 100644 index d6ca9bd9078..00000000000 --- a/apps/reference/_supabase_js/generated/auth-admin-updateuserbyid.mdx +++ /dev/null @@ -1,303 +0,0 @@ ---- -id: auth-admin-updateuserbyid -title: 'updateUserById()' -slug: /auth-admin-updateuserbyid -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Updates the user data. - -```js -const { data: user, error } = await supabase.auth.admin.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { user_metadata: { hello: 'world' } } -) -``` - -## Parameters - -
    - -
  • -

    - - uid - - - required - - - string - -

    -
    - -No description provided. - -
    - -
  • - -
  • -

    - - AdminUserAttributes - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - app_metadata - - - optional - - - object - -

      -
      - -A custom data object to store the user's application specific metadata. This maps to the `auth.users.app_metadata` column. - -Only a service role can modify. - -The `app_metadata` should be a JSON object that includes app-specific info, such as identity providers, roles, and other -access control information. - -
      - -
    • - -
    • -

      - - data - - - optional - - - object - -

      -
      - -A custom data object to store the user's metadata. This maps to the `auth.users.user_metadata` column. - -The `data` should be a JSON object that includes user-specific info, such as their first and last name. - -
      - -
    • - -
    • -

      - - email - - - optional - - - string - -

      -
      - -The user's email. - -
      - -
    • - -
    • -

      - - email_confirm - - - optional - - - boolean - -

      -
      - -Confirms the user's email address if set to true. - -Only a service role can modify. - -
      - -
    • - -
    • -

      - - password - - - optional - - - string - -

      -
      - -The user's password. - -
      - -
    • - -
    • -

      - - phone - - - optional - - - string - -

      -
      - -The user's phone. - -
      - -
    • - -
    • -

      - - phone_confirm - - - optional - - - boolean - -

      -
      - -Confirms the user's phone number if set to true. - -Only a service role can modify. - -
      - -
    • - -
    • -

      - - user_metadata - - - optional - - - object - -

      -
      - -A custom data object to store the user's metadata. This maps to the `auth.users.user_metadata` column. - -Only a service role can modify. - -The `user_metadata` should be a JSON object that includes user-specific info, such as their first and last name. - -Note: When using the GoTrueAdminApi and wanting to modify a user's metadata, -this attribute is used instead of UserAttributes data. - -
      - -
    • - -
    - -
  • - -
- -## Examples - -### Updates a user's email. - -```js -const { data: user, error } = await supabase.auth.admin.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { email: 'new@email.com' } -) -``` - -### Updates a user's password. - -```js -const { data: user, error } = await supabase.auth.admin.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { password: 'new_password' } -) -``` - -### Updates a user's metadata. - -```js -const { data: user, error } = await supabase.auth.admin.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { user_metadata: { hello: 'world' } } -) -``` - -### Updates a user's app_metadata. - -```js -const { data: user, error } = await supabase.auth.admin.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { app_metadata: { plan: 'trial' } } -) -``` - -### Confirms a user's email address. - -```js -const { data: user, error } = await supabase.auth.admin.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { email_confirm: true } -) -``` - -### Confirms a user's phone number. - -```js -const { data: user, error } = await supabase.auth.admin.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { phone_confirm: true } -) -``` diff --git a/apps/reference/_supabase_js/generated/auth-getsession.mdx b/apps/reference/_supabase_js/generated/auth-getsession.mdx deleted file mode 100644 index 5d48abae16e..00000000000 --- a/apps/reference/_supabase_js/generated/auth-getsession.mdx +++ /dev/null @@ -1,24 +0,0 @@ ---- -id: auth-getsession -title: 'getSession()' -slug: /auth-getsession -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Returns the session, refreshing it if necessary. -The session returned can be null if the session is not detected which can happen in the event a user is not signed-in or has logged out. - -```js -const { data, error } = await supabase.auth.getSession() -``` - -## Examples - -### Get the session data - -```js -const { data, error } = await supabase.auth.getSession() -``` diff --git a/apps/reference/_supabase_js/generated/auth-getuser.mdx b/apps/reference/_supabase_js/generated/auth-getuser.mdx deleted file mode 100644 index c43a4e02a74..00000000000 --- a/apps/reference/_supabase_js/generated/auth-getuser.mdx +++ /dev/null @@ -1,66 +0,0 @@ ---- -id: auth-getuser -title: 'getUser()' -slug: /auth-getuser -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Gets the current user details if there is an existing session. - -```js -const { - data: { user }, -} = await supabase.auth.getUser() -``` - -## Parameters - -
    - -
  • -

    - - jwt - - - optional - - - string - -

    -
    - -Takes in an optional access token jwt. If no jwt is provided, getUser() will attempt to get the jwt from the current session. - -
    - -
  • - -
- -## Notes - -- This method gets the user object from the current session. -- Fetches the user object from the database instead of local session. - -## Examples - -### Get the logged in user with the current existing session - -```js -const { - data: { user }, -} = await supabase.auth.getUser() -``` - -### Get the logged in user with a custom access token jwt. - -```js -const { - data: { user }, -} = await supabase.auth.getUser(jwt) -``` diff --git a/apps/reference/_supabase_js/generated/auth-onauthstatechange.mdx b/apps/reference/_supabase_js/generated/auth-onauthstatechange.mdx deleted file mode 100644 index d35e657fde6..00000000000 --- a/apps/reference/_supabase_js/generated/auth-onauthstatechange.mdx +++ /dev/null @@ -1,105 +0,0 @@ ---- -id: auth-onauthstatechange -title: 'onAuthStateChange()' -slug: /auth-onauthstatechange -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Receive a notification every time an auth event happens. - -```js -supabase.auth.onAuthStateChange((event, session) => { - console.log(event, session) -}) -``` - -## Parameters - -
    - -
  • -

    - - callback - - - required - - - object - -

    -
    - -A callback function to be invoked when an auth event happens. - -
    - -
  • - -
- -## Notes - -- Types of auth events: `SIGNED_IN`, `SIGNED_OUT`, `TOKEN_REFRESHED`, `USER_UPDATED`, `USER_DELETED`, `PASSWORD_RECOVERY` - -## Examples - -### Listen to auth changes - -```js -supabase.auth.onAuthStateChange((event, session) => { - console.log(event, session) -}) -``` - -### Listen to sign in - -```js -supabase.auth.onAuthStateChange((event, session) => { - if (event == 'SIGNED_IN') console.log('SIGNED_IN', session) -}) -``` - -### Listen to sign out - -```js -supabase.auth.onAuthStateChange((event, session) => { - if (event == 'SIGNED_OUT') console.log('SIGNED_OUT', session) -}) -``` - -### Listen to token refresh - -```js -supabase.auth.onAuthStateChange((event, session) => { - if (event == 'TOKEN_REFRESHED') console.log('TOKEN_REFRESHED', session) -}) -``` - -### Listen to user updates - -```js -supabase.auth.onAuthStateChange((event, session) => { - if (event == 'USER_UPDATED') console.log('USER_UPDATED', session) -}) -``` - -### Listen to user deleted - -```js -supabase.auth.onAuthStateChange((event, session) => { - if (event == 'USER_DELETED') console.log('USER_DELETED', session) -}) -``` - -### Listen to password recovery events - -```js -supabase.auth.onAuthStateChange((event, session) => { - if (event == 'PASSWORD_RECOVERY') console.log('PASSWORD_RECOVERY', session) -}) -``` diff --git a/apps/reference/_supabase_js/generated/auth-resetpasswordforemail.mdx b/apps/reference/_supabase_js/generated/auth-resetpasswordforemail.mdx deleted file mode 100644 index d68a4488398..00000000000 --- a/apps/reference/_supabase_js/generated/auth-resetpasswordforemail.mdx +++ /dev/null @@ -1,160 +0,0 @@ ---- -id: auth-resetpasswordforemail -title: 'resetPasswordForEmail()' -slug: /auth-resetpasswordforemail -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Sends a password reset request to an email address. - -```js -const { data, error } = await supabase.auth.resetPasswordForEmail(email, { - redirectTo: 'https://example.com/update-password', -}) -``` - -## Parameters - -
    - -
  • -

    - - email - - - required - - - string - -

    -
    - -The email address of the user. - -
    - -
  • - -
  • -

    - - options - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - captchaToken - - - optional - - - string - -

      -
      - -Verification token received when the user completes the captcha on the site. - -
      - -
    • - -
    • -

      - - redirectTo - - - optional - - - string - -

      -
      - -The URL to send the user to after they click the password reset link. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -Sends a password reset request to an email address. -When the user clicks the reset link in the email they are redirected back to your application. -Prompt the user for a new password and call `auth.updateUser()`: - -```js -const { data, error } = await supabase.auth.updateUser({ - password: new_password, -}) -``` - -## Examples - -### Reset password - -```js -const { data, error } = await supabase.auth.resetPasswordForEmail(email, { - redirectTo: 'https://example.com/update-password', -}) -``` - -### Reset password (React) - -```js -/** - * Step 1: Send the user an email to get a password reset token. - * This email contains a link which sends the user back to your application. - */ -const { data, error } = await supabase.auth.resetPasswordForEmail( - 'user@email.com' -) - -/** - * Step 2: Once the user is redirected back to your application, - * ask the user to reset their password. - */ -useEffect(() => { - supabase.auth.onAuthStateChange(async (event, session) => { - if (event == 'PASSWORD_RECOVERY') { - const newPassword = prompt('What would you like your new password to be?') - const { data, error } = await supabase.auth.updateUser({ - password: newPassword, - }) - - if (data) alert('Password updated successfully!') - if (error) alert('There was an error updating your password.') - } - }) -}, []) -``` diff --git a/apps/reference/_supabase_js/generated/auth-setsession.mdx b/apps/reference/_supabase_js/generated/auth-setsession.mdx deleted file mode 100644 index 220ded4d77a..00000000000 --- a/apps/reference/_supabase_js/generated/auth-setsession.mdx +++ /dev/null @@ -1,58 +0,0 @@ ---- -id: auth-setsession -title: 'setSession()' -slug: /auth-setsession -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Sets the session data from refresh token and returns current session or an error if the refresh token is invalid. - -```js -const { data, error } = supabase.auth.setSession(refresh_token) -``` - -## Parameters - -
    - -
  • -

    - - refresh_token - - - required - - - string - -

    -
    - -A refresh token returned by supabase auth. - -
    - -
  • - -
- -## Notes - -- `setSession()` takes in a refresh token and uses it to get a new session. -- The refresh token can only be used once to obtain a new session. -- Refresh token rotation (see [`REFRESH_TOKEN_ROTATION_ENABLED`](https://supabase.com/docs/reference/auth/config#refresh_token_rotation_enabled)) is enabled by default on all projects to guard against replay attacks. -- You can configure the [`REFRESH_TOKEN_REUSE_INTERVAL`](https://supabase.com/docs/reference/auth/config#refresh_token_reuse_interval) which provides a short window in which the same refresh token can be used multiple times in the event of concurrency or offline issues. - -## Examples - -### Refresh the session - -Sets the session data from refresh_token and returns current session or an error if the refresh_token is invalid. - -```js -const { data, error } = supabase.auth.setSession(refresh_token) -``` diff --git a/apps/reference/_supabase_js/generated/auth-signinwithoauth.mdx b/apps/reference/_supabase_js/generated/auth-signinwithoauth.mdx deleted file mode 100644 index bcdceac369c..00000000000 --- a/apps/reference/_supabase_js/generated/auth-signinwithoauth.mdx +++ /dev/null @@ -1,197 +0,0 @@ ---- -id: auth-signinwithoauth -title: 'signInWithOAuth()' -slug: /auth-signinwithoauth -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Log in an existing user via a third-party provider. - -```js -const { data, error } = await supabase.auth.signInWithOAuth({ - provider: 'github', -}) -``` - -## Parameters - -
    - -
  • -

    - - SignInWithOAuthCredentials - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - provider - - - required - - - Provider - -

      -
      - -One of the providers supported by GoTrue. - -
      - -
    • - -
    • -

      - - options - - - optional - - - object - -

      -
      - -No description provided. - -
      - -
        -
        Properties
        - -
      • -

        - - queryParams - - - optional - - - object - -

        -
        - -An object of query params - -
        - -
      • - -
      • -

        - - redirectTo - - - optional - - - string - -

        -
        - -A URL to send the user to after they are confirmed. - -
        - -
      • - -
      • -

        - - scopes - - - optional - - - string - -

        -
        - -A space-separated list of scopes granted to the OAuth application. - -
        - -
      • - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- This method is used for signing in using a third-party provider. -- Supabase supports many different [third-party providers](https://supabase.com/docs/guides/auth#providers). - -## Examples - -### Sign in using a third-party provider - -```js -const { data, error } = await supabase.auth.signInWithOAuth({ - provider: 'github', -}) -``` - -### Sign in using a third-party provider with redirect - -When the third-party provider successfully authenticates the user, the provider will redirect the user to the URL specified in the `redirectTo` parameter. This parameter defaults to the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url). It does not redirect the user immediately after invoking this method. -You can modify the `SITE_URL` or add additional redirect urls in [your project](https://app.supabase.com/project/_/auth/settings). - -```js -const { data, error } = await supabase.auth.signInWithOAuth({ - provider: 'github' - options: { - redirectTo: 'https://example.com/welcome' - } -} -``` - -### Sign in with scopes - -If you need additional data from an OAuth provider, you can include a space-separated list of scopes in your request to get back an OAuth provider token. -You may also need to specify the scopes in the provider's OAuth app settings, depending on the provider. The list of scopes will be documented by the third-party provider you are using and specifying scopes will enable you to use the OAuth provider token to call additional APIs supported by the third-party provider to get more information. - -```js -const { data, error } = await supabase.auth.signInWithOAuth({ - provider: 'github' - options: { - scopes: 'repo gist notifications' - } -}) -const oAuthToken = data.session.provider_token // use to access provider API -``` diff --git a/apps/reference/_supabase_js/generated/auth-signinwithotp.mdx b/apps/reference/_supabase_js/generated/auth-signinwithotp.mdx deleted file mode 100644 index bcdfeed047a..00000000000 --- a/apps/reference/_supabase_js/generated/auth-signinwithotp.mdx +++ /dev/null @@ -1,321 +0,0 @@ ---- -id: auth-signinwithotp -title: 'signInWithOtp()' -slug: /auth-signinwithotp -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Log in a user using magiclink or a one-time password (OTP). -If the `{{ .ConfirmationURL }}` variable is specified in the email template, a magiclink will be sent. -If the `{{ .Token }}` variable is specified in the email template, an OTP will be sent. -If you're using phone sign-ins, only an OTP will be sent. You won't be able to send a magiclink for phone sign-ins. - -```js -const { data, error } = await supabase.auth.signInWithOtp({ - email: 'example@email.com', -}) -``` - -## Parameters - -
    - -
  • -

    - - SignInWithPasswordlessCredentials - - - required - - - reflection | reflection - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - object - - - required - - - object - -

      -
      - -No description provided. - -
      - -
        -
        Properties
        - -
      • -

        - - phone - - - required - - - string - -

        -
        - -The user's phone number. - -
        - -
      • - -
      • -

        - - options - - - optional - - - object - -

        -
        - -No description provided. - -
        - -
          -
          Properties
          - -
        • -

          - - captchaToken - - - optional - - - string - -

          -
          - -Verification token received when the user completes the captcha on the site. - -
          - -
        • - -
        • -

          - - shouldCreateUser - - - optional - - - boolean - -

          -
          - -If set to false, this method will not create a new user. Defaults to true. - -
          - -
        • - -
        - -
      • - -
      - -
    • - -
    • -

      - - object - - - required - - - object - -

      -
      - -No description provided. - -
      - -
        -
        Properties
        - -
      • -

        - - email - - - required - - - string - -

        -
        - -The user's email address. - -
        - -
      • - -
      • -

        - - options - - - optional - - - object - -

        -
        - -No description provided. - -
        - -
          -
          Properties
          - -
        • -

          - - captchaToken - - - optional - - - string - -

          -
          - -Verification token received when the user completes the captcha on the site. - -
          - -
        • - -
        • -

          - - emailRedirectTo - - - optional - - - string - -

          -
          - -The redirect url embedded in the email link - -
          - -
        • - -
        • -

          - - shouldCreateUser - - - optional - - - boolean - -

          -
          - -If set to false, this method will not create a new user. Defaults to true. - -
          - -
        • - -
        - -
      • - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- Requires either an email or phone number. -- This method is used for passwordless sign-ins where a OTP is sent to the user's email or phone number. -- If you're using an email, you can configure whether you want the user to receive a magiclink or a OTP. -- If you're using phone, you can configure whether you want the user to receive a OTP. -- The magic link's destination URL is determined by the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url). You can modify the `SITE_URL` or add additional redirect urls in [your project](https://app.supabase.com/project/_/auth/settings). - -## Examples - -### Sign in with email. - -The user will be sent an email which contains either a magiclink or a OTP or both. By default, a given user can only request a OTP once every 60 seconds. - -```js -const { data, error } = await supabase.auth.signInWithOtp({ - email: 'example@email.com', -}) -``` - -### Sign in with SMS OTP. - -The user will be sent a SMS which contains a OTP. By default, a given user can only request a OTP once every 60 seconds. - -```js -const { data, error } = await supabase.auth.signInWithOtp({ - phone: '+13334445555', -}) -``` diff --git a/apps/reference/_supabase_js/generated/auth-signinwithpassword.mdx b/apps/reference/_supabase_js/generated/auth-signinwithpassword.mdx deleted file mode 100644 index 08546b8140a..00000000000 --- a/apps/reference/_supabase_js/generated/auth-signinwithpassword.mdx +++ /dev/null @@ -1,299 +0,0 @@ ---- -id: auth-signinwithpassword -title: 'signInWithPassword()' -slug: /auth-signinwithpassword -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Log in an existing user with an email and password or phone and password. - -```js -const { data, error } = await supabase.auth.signInWithPassword({ - email: 'example@email.com', - password: 'example-password', -}) -``` - -## Parameters - -
    - -
  • -

    - - SignInWithPasswordCredentials - - - required - - - reflection | reflection - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - object - - - required - - - object - -

      -
      - -No description provided. - -
      - -
        -
        Properties
        - -
      • -

        - - phone - - - required - - - string - -

        -
        - -The user's phone number. - -
        - -
      • - -
      • -

        - - password - - - required - - - string - -

        -
        - -The user's password. - -
        - -
      • - -
      • -

        - - options - - - optional - - - object - -

        -
        - -No description provided. - -
        - -
          -
          Properties
          - -
        • -

          - - captchaToken - - - optional - - - string - -

          -
          - -Verification token received when the user completes the captcha on the site. - -
          - -
        • - -
        - -
      • - -
      - -
    • - -
    • -

      - - object - - - required - - - object - -

      -
      - -No description provided. - -
      - -
        -
        Properties
        - -
      • -

        - - password - - - required - - - string - -

        -
        - -The user's password. - -
        - -
      • - -
      • -

        - - email - - - required - - - string - -

        -
        - -The user's email address. - -
        - -
      • - -
      • -

        - - options - - - optional - - - object - -

        -
        - -No description provided. - -
        - -
          -
          Properties
          - -
        • -

          - - captchaToken - - - optional - - - string - -

          -
          - -Verification token received when the user completes the captcha on the site. - -
          - -
        • - -
        - -
      • - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- Requires either an email and password or a phone number and password. - -## Examples - -### Sign in with email and password - -```js -const { data, error } = await supabase.auth.signInWithPassword({ - email: 'example@email.com', - password: 'example-password', -}) -``` - -### Sign in with phone and password - -```js -const { data, error } = await supabase.auth.signInWithPassword({ - phone: '+13334445555', - password: 'some-password', -}) - -// After receiving a SMS with a OTP. -const { data, error } = await supabase.auth.verifyOtp({ - phone: '+13334445555', - token: '123456', -}) -``` diff --git a/apps/reference/_supabase_js/generated/auth-signout.mdx b/apps/reference/_supabase_js/generated/auth-signout.mdx deleted file mode 100644 index c8b9f3de082..00000000000 --- a/apps/reference/_supabase_js/generated/auth-signout.mdx +++ /dev/null @@ -1,31 +0,0 @@ ---- -id: auth-signout -title: 'signOut()' -slug: /auth-signout -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Inside a browser context, `signOut()` will remove the logged in user from the browser session -and log them out - removing all items from localstorage and then trigger a `"SIGNED_OUT"` event. - -For server-side management, you can revoke all refresh tokens for a user by passing a user's JWT through to `auth.api.signOut(JWT: string)`. -There is no way to revoke a user's access token jwt until it expires. It is recommended to set a shorter expiry on the jwt for this reason. - -```js -const { error } = await supabase.auth.signOut() -``` - -## Notes - -- In order to use the `signOut()` method, the user needs to be signed in first. - -## Examples - -### Sign out - -```js -const { error } = await supabase.auth.signOut() -``` diff --git a/apps/reference/_supabase_js/generated/auth-signup.mdx b/apps/reference/_supabase_js/generated/auth-signup.mdx deleted file mode 100644 index e2155d6bb28..00000000000 --- a/apps/reference/_supabase_js/generated/auth-signup.mdx +++ /dev/null @@ -1,371 +0,0 @@ ---- -id: auth-signup -title: 'signUp()' -slug: /auth-signup -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Creates a new user. - -```js -const { data, error } = await supabase.auth.signUp({ - email: 'example@email.com', - password: 'example-password', -}) -``` - -## Parameters - -
    - -
  • -

    - - SignUpWithPasswordCredentials - - - required - - - reflection | reflection - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - object - - - required - - - object - -

      -
      - -No description provided. - -
      - -
        -
        Properties
        - -
      • -

        - - phone - - - required - - - string - -

        -
        - -The user's phone number. - -
        - -
      • - -
      • -

        - - password - - - required - - - string - -

        -
        - -The user's password. - -
        - -
      • - -
      • -

        - - options - - - optional - - - object - -

        -
        - -No description provided. - -
        - -
          -
          Properties
          - -
        • -

          - - captchaToken - - - optional - - - string - -

          -
          - -Verification token received when the user completes the captcha on the site. - -
          - -
        • - -
        • -

          - - data - - - optional - - - object - -

          -
          - -A custom data object to store the user's metadata. This maps to the `auth.users.user_metadata` column. - -The `data` should be a JSON object that includes user-specific info, such as their first and last name. - -
          - -
        • - -
        - -
      • - -
      - -
    • - -
    • -

      - - object - - - required - - - object - -

      -
      - -No description provided. - -
      - -
        -
        Properties
        - -
      • -

        - - password - - - required - - - string - -

        -
        - -The user's password. - -
        - -
      • - -
      • -

        - - email - - - required - - - string - -

        -
        - -The user's email address. - -
        - -
      • - -
      • -

        - - options - - - optional - - - object - -

        -
        - -No description provided. - -
        - -
          -
          Properties
          - -
        • -

          - - captchaToken - - - optional - - - string - -

          -
          - -Verification token received when the user completes the captcha on the site. - -
          - -
        • - -
        • -

          - - data - - - optional - - - object - -

          -
          - -A custom data object to store the user's metadata. This maps to the `auth.users.user_metadata` column. - -The `data` should be a JSON object that includes user-specific info, such as their first and last name. - -
          - -
        • - -
        • -

          - - emailRedirectTo - - - optional - - - string - -

          -
          - -The redirect url embedded in the email link - -
          - -
        • - -
        - -
      • - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- By default, the user needs to verify their email address before logging in. To turn this off, disable **Confirm email** in [your project](https://app.supabase.com/project/_/auth/settings). -- **Confirm email** determines if users need to confirm their email address after signing up. - - If **Confirm email** is enabled, a `user` is returned but `session` is null. - - If **Confirm email** is disabled, both a `user` and a `session` are returned. -- When the user confirms their email address, they are redirected to the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url) by default. You can modify your `SITE_URL` or add additional redirect URLs in [your project](https://app.supabase.com/project/_/auth/settings). -- If signUp() is called for an existing confirmed user: - - If **Confirm email** is enabled in [your project](https://app.supabase.com/project/_/auth/settings), an obfuscated/fake user object is returned. - - If **Confirm email** is disabled, the error message, `User already registered` is returned. -- To fetch the currently logged-in user, refer to [`getUser()`](/docs/reference/javascript/next/auth-getuser). - -## Examples - -### Sign up. - -```js -const { data, error } = await supabase.auth.signUp({ - email: 'example@email.com', - password: 'example-password', -}) -``` - -### Sign up with additional user metadata. - -```js -const { data, error } = await supabase.auth.signUp({ - email: 'example@email.com', - password: 'example-password', - options: { - data: { - first_name: 'John', - age: 27, - }, - }, -}) -``` diff --git a/apps/reference/_supabase_js/generated/auth-updateuser.mdx b/apps/reference/_supabase_js/generated/auth-updateuser.mdx deleted file mode 100644 index 449d21f0bda..00000000000 --- a/apps/reference/_supabase_js/generated/auth-updateuser.mdx +++ /dev/null @@ -1,164 +0,0 @@ ---- -id: auth-updateuser -title: 'updateUser()' -slug: /auth-updateuser -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Updates user data, if there is a logged in user. - -```js -const { data, error } = await supabase.auth.updateUser({ - data: { hello: 'world' }, -}) -``` - -## Parameters - -
    - -
  • -

    - - UserAttributes - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - data - - - optional - - - object - -

      -
      - -A custom data object to store the user's metadata. This maps to the `auth.users.user_metadata` column. - -The `data` should be a JSON object that includes user-specific info, such as their first and last name. - -
      - -
    • - -
    • -

      - - email - - - optional - - - string - -

      -
      - -The user's email. - -
      - -
    • - -
    • -

      - - password - - - optional - - - string - -

      -
      - -The user's password. - -
      - -
    • - -
    • -

      - - phone - - - optional - - - string - -

      -
      - -The user's phone. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- In order to use the `updateUser()` method, the user needs to be signed in first. -- By Default, email updates sends a confirmation link to both the user's current and new email. - To only send a confirmation link to the user's new email, disable **Secure email change** in your project's [email auth provider settings](https://app.supabase.com/project/_/auth/settings). - -## Examples - -### Update the email for an authenticated user - -Sends a "Confirm Email Change" email to the new email address. - -```js -const { data, error } = await supabase.auth.updateUser({ - email: 'new@email.com', -}) -``` - -### Update the password for an authenticated user - -```js -const { data, error } = await supabase.auth.updateUser({ - password: 'new password', -}) -``` - -### Update the user's metadata - -```js -const { data, error } = await supabase.auth.updateUser({ - data: { hello: 'world' }, -}) -``` diff --git a/apps/reference/_supabase_js/generated/auth-verifyotp.mdx b/apps/reference/_supabase_js/generated/auth-verifyotp.mdx deleted file mode 100644 index 8fde34f03eb..00000000000 --- a/apps/reference/_supabase_js/generated/auth-verifyotp.mdx +++ /dev/null @@ -1,117 +0,0 @@ ---- -id: auth-verifyotp -title: 'verifyOtp()' -slug: /auth-verifyotp -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Log in a user given a User supplied OTP received via mobile. - -```js -const { data, error } = await supabase.auth.verifyOtp({ - phone, - token, - type: 'sms', -}) -``` - -## Parameters - -
    - -
  • -

    - - VerifyOtpParams - - - required - - - VerifyMobileOtpParams | VerifyEmailOtpParams - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - VerifyMobileOtpParams - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - VerifyEmailOtpParams - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- The `verifyOtp` method takes in different verification types. If a phone number is used, the type can either be `sms` or `phone_change`. If an email address is used, the type can be one of the following: `signup`, `magiclink`, `recovery`, `invite` or `email_change`. -- The verification type used should be determined based on the corresponding auth method called before `verifyOtp` to sign up / sign-in a user. - -## Examples - -### Verify Sms One-Time Password (OTP) - -```js -const { data, error } = await supabase.auth.verifyOtp({ - phone, - token, - type: 'sms', -}) -``` - -### Verify Signup One-Time Password (OTP) - -```js -const { data, error } = await supabase.auth.verifyOtp({ - email, - token, - type: 'signup', -}) -``` diff --git a/apps/reference/_supabase_js/generated/containedby.mdx b/apps/reference/_supabase_js/generated/containedby.mdx deleted file mode 100644 index b9b7646c7e6..00000000000 --- a/apps/reference/_supabase_js/generated/containedby.mdx +++ /dev/null @@ -1,179 +0,0 @@ ---- -id: containedby -title: 'containedBy()' -slug: /containedby -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Only relevant for jsonb, array, and range columns. Match only rows where -every element appearing in `column` is contained by `value`. - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, main_exports') - .containedBy('main_exports', ['cars', 'food', 'machine']) -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The jsonb, array, or range column to filter on - -
    - -
  • - -
  • -

    - - value - - - required - - - string | Record | array - -

    -
    - -The jsonb, array, or range value to filter with - -
    - -
      -
      Properties
      - -
    • -

      - - object - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - string - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - Record - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- `.containedBy()` can work on array columns or range columns. - - ```js - .containedBy('arraycol',["a","b"]) // You can use a javascript array for an array column - .containedBy('arraycol','{"a","b"}') // You can use a string with Postgres array {} for array column. - .containedBy('rangecol','(1,2]') // Use Postgres range syntax for range column. - .containedBy('rangecol',`(${arr}]`) // You can insert an array into a string. - ``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, main_exports') - .containedBy('main_exports', ['cars', 'food', 'machine']) -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .containedBy('main_exports', ['orks', 'surveillance', 'evil']) -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('countries') - .delete() - .containedBy('main_exports', ['cars', 'food', 'machine']) -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_countries') - .containedBy('main_exports', ['cars', 'food', 'machine']) -``` diff --git a/apps/reference/_supabase_js/generated/contains.mdx b/apps/reference/_supabase_js/generated/contains.mdx deleted file mode 100644 index 9251b9d4e1e..00000000000 --- a/apps/reference/_supabase_js/generated/contains.mdx +++ /dev/null @@ -1,180 +0,0 @@ ---- -id: contains -title: 'contains()' -slug: /contains -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Only relevant for jsonb, array, and range columns. Match only rows where -`column` contains every element appearing in `value`. - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, main_exports') - .contains('main_exports', ['oil']) -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The jsonb, array, or range column to filter on - -
    - -
  • - -
  • -

    - - value - - - required - - - string | Record | array - -

    -
    - -The jsonb, array, or range value to filter with - -
    - -
      -
      Properties
      - -
    • -

      - - object - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - string - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - Record - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- `.contains()` can work on array columns or range columns. - It is very useful for finding rows where a tag array contains all the values in the filter array. - - ```js - .contains('arraycol',["a","b"]) // You can use a javascript array for an array column - .contains('arraycol','{"a","b"}') // You can use a string with Postgres array {} for array column. - .contains('rangecol','(1,2]') // Use Postgres range syntax for range column. - .contains('rangecol',`(${arr}]`) // You can insert an array into a string. - ``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, main_exports') - .contains('main_exports', ['oil']) -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .contains('main_exports', ['oil']) -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('countries') - .delete() - .contains('main_exports', ['oil']) -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_countries') - .contains('main_exports', ['oil']) -``` diff --git a/apps/reference/_supabase_js/generated/db-abortsignal.mdx b/apps/reference/_supabase_js/generated/db-abortsignal.mdx deleted file mode 100644 index 68c5a6beda0..00000000000 --- a/apps/reference/_supabase_js/generated/db-abortsignal.mdx +++ /dev/null @@ -1,37 +0,0 @@ ---- -id: db-abortsignal -title: 'abortSignal()' -slug: /db-abortsignal -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Set the AbortSignal for the fetch request. - -## Parameters - -
    - -
  • -

    - - signal - - - required - - - AbortSignal - -

    -
    - -The AbortSignal to use for the fetch request - -
    - -
  • - -
diff --git a/apps/reference/_supabase_js/generated/db-csv.mdx b/apps/reference/_supabase_js/generated/db-csv.mdx deleted file mode 100644 index 088f37c669a..00000000000 --- a/apps/reference/_supabase_js/generated/db-csv.mdx +++ /dev/null @@ -1,11 +0,0 @@ ---- -id: db-csv -title: 'csv()' -slug: /db-csv -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Return `data` as a string in CSV format. diff --git a/apps/reference/_supabase_js/generated/db-explain.mdx b/apps/reference/_supabase_js/generated/db-explain.mdx deleted file mode 100644 index fb748b95f28..00000000000 --- a/apps/reference/_supabase_js/generated/db-explain.mdx +++ /dev/null @@ -1,211 +0,0 @@ ---- -id: db-explain -title: 'explain()' -slug: /db-explain -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Return `data` as the EXPLAIN plan for the query. - -## Parameters - -
    - -
  • -

    - - options - - - required - - - object - -

    -
    - -Named parameters - -
    - -
      -
      Properties
      - -
    • -

      - - analyze - - - optional - - - boolean - -

      -
      - -If `true`, the query will be executed and the -actual run time will be returned - -
      - -
    • - -
    • -

      - - buffers - - - optional - - - boolean - -

      -
      - -If `true`, include information on buffer usage - -
      - -
    • - -
    • -

      - - format - - - optional - - - text | json - -

      -
      - -The format of the output, can be `"text"` (default) -or `"json"` - -
      - -
        -
        Properties
        - -
      • -

        - - json - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - text - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      - -
    • - -
    • -

      - - settings - - - optional - - - boolean - -

      -
      - -If `true`, include information on configuration -parameters that affect query planning - -
      - -
    • - -
    • -

      - - verbose - - - optional - - - boolean - -

      -
      - -If `true`, the query identifier will be returned -and `data` will include the output columns of the query - -
      - -
    • - -
    • -

      - - wal - - - optional - - - boolean - -

      -
      - -If `true`, include information on WAL record generation - -
      - -
    • - -
    - -
  • - -
diff --git a/apps/reference/_supabase_js/generated/db-geojson.mdx b/apps/reference/_supabase_js/generated/db-geojson.mdx deleted file mode 100644 index d5b2268d728..00000000000 --- a/apps/reference/_supabase_js/generated/db-geojson.mdx +++ /dev/null @@ -1,11 +0,0 @@ ---- -id: db-geojson -title: 'geojson()' -slug: /db-geojson -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Return `data` as an object in [GeoJSON](https://geojson.org) format. diff --git a/apps/reference/_supabase_js/generated/db-modifiers-select.mdx b/apps/reference/_supabase_js/generated/db-modifiers-select.mdx deleted file mode 100644 index f8f1b003436..00000000000 --- a/apps/reference/_supabase_js/generated/db-modifiers-select.mdx +++ /dev/null @@ -1,41 +0,0 @@ ---- -id: db-modifiers-select -title: 'select()' -slug: /db-modifiers-select -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Perform a SELECT on the query result. - -By default, `.insert()`, `.update()`, `.upsert()`, and `.delete()` do not -return modified rows. By calling this method, modified rows are returned in -`data`. - -## Parameters - -
    - -
  • -

    - - columns - - - optional - - - Query - -

    -
    - -The columns to retrieve, separated by commas - -
    - -
  • - -
diff --git a/apps/reference/_supabase_js/generated/db-rollback.mdx b/apps/reference/_supabase_js/generated/db-rollback.mdx deleted file mode 100644 index 165dc25110f..00000000000 --- a/apps/reference/_supabase_js/generated/db-rollback.mdx +++ /dev/null @@ -1,13 +0,0 @@ ---- -id: db-rollback -title: 'rollback()' -slug: /db-rollback -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Rollback the query. - -`data` will still be returned, but the query is not committed. diff --git a/apps/reference/_supabase_js/generated/delete.mdx b/apps/reference/_supabase_js/generated/delete.mdx deleted file mode 100644 index eb20f02a558..00000000000 --- a/apps/reference/_supabase_js/generated/delete.mdx +++ /dev/null @@ -1,166 +0,0 @@ ---- -id: delete -title: 'Delete data: delete()' -slug: /delete -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Perform a DELETE on the table or view. - -By default, deleted rows are not returned. To return it, chain the call -with `.select()` after filters. - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .match({ id: 666 }) -``` - -## Parameters - -
    - -
  • -

    - - options - - - required - - - object - -

    -
    - -Named parameters - -
    - -
      -
      Properties
      - -
    • -

      - - count - - - optional - - - exact | planned | estimated - -

      -
      - -Count algorithm to use to count deleted rows. - -`"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the -hood. - -`"planned"`: Approximated but fast count algorithm. Uses the Postgres -statistics under the hood. - -`"estimated"`: Uses exact count for low numbers and planned count for high -numbers. - -
      - -
        -
        Properties
        - -
      • -

        - - estimated - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - planned - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - exact - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- `delete()` should always be combined with [filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to delete. -- If you use `delete()` with filters and you have - [RLS](/docs/learn/auth-deep-dive/auth-row-level-security) enabled, only - rows visible through `SELECT` policies are deleted. Note that by default - no rows are visible, so you need at least one `SELECT`/`ALL` policy that - makes the rows visible. - -## Examples - -### Delete records - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .match({ id: 666 }) -``` diff --git a/apps/reference/_supabase_js/generated/eq.mdx b/apps/reference/_supabase_js/generated/eq.mdx deleted file mode 100644 index 960d203882c..00000000000 --- a/apps/reference/_supabase_js/generated/eq.mdx +++ /dev/null @@ -1,104 +0,0 @@ ---- -id: eq -title: 'eq()' -slug: /eq -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Match only rows where `column` is equal to `value`. - -To check if the value of `column` is NULL, you should use `.is()` instead. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'The shire') -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The column to filter on - -
    - -
  • - -
  • -

    - - value - - - required - - - object - -

    -
    - -The value to filter with - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'The shire') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .eq('name', 'San Francisco') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .eq('name', 'Mordor') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .eq('name', 'San Francisco') -``` diff --git a/apps/reference/_supabase_js/generated/filter.mdx b/apps/reference/_supabase_js/generated/filter.mdx deleted file mode 100644 index 7b781898277..00000000000 --- a/apps/reference/_supabase_js/generated/filter.mdx +++ /dev/null @@ -1,612 +0,0 @@ ---- -id: filter -title: 'filter()' -slug: /filter -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Match only rows which satisfy the filter. This is an escape hatch - you -should use the specific filter methods wherever possible. - -Unlike most filters, `opearator` and `value` are used as-is and need to -follow [PostgREST -syntax](https://postgrest.org/en/stable/api.html#operators). You also need -to make sure they are properly sanitized. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .filter('name', 'in', '("Paris","Tokyo")') -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The column to filter on - -
    - -
  • - -
  • -

    - - operator - - - required - - - FilterOperator | not.eq | not.neq | not.gt | not.gte | not.lt | not.lte | not.like | not.ilike | not.is | not.in | not.cs | not.cd | not.sl | not.sr | not.nxl | not.nxr | not.adj | not.ov | not.fts | not.plfts | not.phfts | not.wfts - -

    -
    - -The operator to filter with, following PostgREST syntax - -
    - -
      -
      Properties
      - -
    • -

      - - not.wfts - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.phfts - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.plfts - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.fts - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.ov - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.adj - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.nxr - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.nxl - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.sr - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.sl - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.cd - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.cs - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.in - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.is - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.ilike - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.like - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.lte - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.lt - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.gte - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.gt - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.neq - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - not.eq - - - required - - - literal - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - FilterOperator - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
  • -

    - - value - - - required - - - unknown - -

    -
    - -The value to filter with, following PostgREST syntax - -
    - -
  • - -
- -## Notes - -- `.filter()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values, so it should only be used as an escape hatch in case other filters don't work. - ```js - .filter('arraycol','cs','{"a","b"}') // Use Postgres array {} for array column and 'cs' for contains. - .filter('rangecol','cs','(1,2]') // Use Postgres range syntax for range column. - .filter('id','in','(6,7)') // Use Postgres list () for in filter. - .filter('id','in',`(${arr})`) // You can insert a javascript array. - ``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .filter('name', 'in', '("Paris","Tokyo")') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .filter('name', 'in', '("Paris","Tokyo")') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .filter('name', 'in', '("Paris","Tokyo")') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .filter('name', 'in', '("Paris","Tokyo")') -``` - -### Filter embedded resources - -```js -const { data, error } = await supabase - .from('cities') - .select('name, countries ( name )') - .filter('countries.name', 'in', '("France","Japan")') -``` diff --git a/apps/reference/_supabase_js/generated/getchannels.mdx b/apps/reference/_supabase_js/generated/getchannels.mdx deleted file mode 100644 index 8297655b33e..00000000000 --- a/apps/reference/_supabase_js/generated/getchannels.mdx +++ /dev/null @@ -1,23 +0,0 @@ ---- -id: getchannels -title: 'getChannels()' -slug: /getchannels -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Returns all Realtime channels. - -```js -const channels = supabase.getChannels() -``` - -## Examples - -### Get all channels - -```js -const channels = supabase.getChannels() -``` diff --git a/apps/reference/_supabase_js/generated/gt.mdx b/apps/reference/_supabase_js/generated/gt.mdx deleted file mode 100644 index 86a5640de96..00000000000 --- a/apps/reference/_supabase_js/generated/gt.mdx +++ /dev/null @@ -1,102 +0,0 @@ ---- -id: gt -title: 'gt()' -slug: /gt -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Match only rows where `column` is greater than `value`. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .gt('country_id', 250) -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The column to filter on - -
    - -
  • - -
  • -

    - - value - - - required - - - object - -

    -
    - -The value to filter with - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .gt('country_id', 250) -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .gt('country_id', 250) -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .gt('country_id', 250) -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .gt('country_id', 250) -``` diff --git a/apps/reference/_supabase_js/generated/gte.mdx b/apps/reference/_supabase_js/generated/gte.mdx deleted file mode 100644 index cb4d0488e36..00000000000 --- a/apps/reference/_supabase_js/generated/gte.mdx +++ /dev/null @@ -1,102 +0,0 @@ ---- -id: gte -title: 'gte()' -slug: /gte -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Match only rows where `column` is greater than or equal to `value`. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .gte('country_id', 250) -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The column to filter on - -
    - -
  • - -
  • -

    - - value - - - required - - - object - -

    -
    - -The value to filter with - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .gte('country_id', 250) -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .gte('country_id', 250) -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .gte('country_id', 250) -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .gte('country_id', 250) -``` diff --git a/apps/reference/_supabase_js/generated/ilike.mdx b/apps/reference/_supabase_js/generated/ilike.mdx deleted file mode 100644 index ea6cf4de817..00000000000 --- a/apps/reference/_supabase_js/generated/ilike.mdx +++ /dev/null @@ -1,102 +0,0 @@ ---- -id: ilike -title: 'ilike()' -slug: /ilike -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Match only rows where `column` matches `pattern` case-insensitively. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .ilike('name', '%la%') -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The column to filter on - -
    - -
  • - -
  • -

    - - pattern - - - required - - - string - -

    -
    - -The pattern to match with - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .ilike('name', '%la%') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .ilike('name', '%la%') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .ilike('name', '%la%') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .ilike('name', '%la%') -``` diff --git a/apps/reference/_supabase_js/generated/in.mdx b/apps/reference/_supabase_js/generated/in.mdx deleted file mode 100644 index 8eddb153846..00000000000 --- a/apps/reference/_supabase_js/generated/in.mdx +++ /dev/null @@ -1,102 +0,0 @@ ---- -id: in -title: 'in()' -slug: /in -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Match only rows where `column` is included in the `values` array. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .in('name', ['Rio de Janeiro', 'San Francisco']) -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The column to filter on - -
    - -
  • - -
  • -

    - - values - - - required - - - object - -

    -
    - -The values array to filter with - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .in('name', ['Rio de Janeiro', 'San Francisco']) -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .in('name', ['Rio de Janeiro', 'San Francisco']) -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .in('name', ['Rio de Janeiro', 'San Francisco']) -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .in('name', ['Rio de Janeiro', 'San Francisco']) -``` diff --git a/apps/reference/_supabase_js/generated/index.mdx b/apps/reference/_supabase_js/generated/index.mdx deleted file mode 100644 index c2e0ae69ed0..00000000000 --- a/apps/reference/_supabase_js/generated/index.mdx +++ /dev/null @@ -1,11 +0,0 @@ ---- -id: index -title: 'Supabase Client' -slug: /supabase-client -custom_edit_url: ../supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Supabase JavaScript. diff --git a/apps/reference/_supabase_js/generated/initializing.mdx b/apps/reference/_supabase_js/generated/initializing.mdx deleted file mode 100644 index 0f86781c565..00000000000 --- a/apps/reference/_supabase_js/generated/initializing.mdx +++ /dev/null @@ -1,437 +0,0 @@ ---- -id: initializing -title: 'Initializing' -slug: /initializing -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -You can initialize a new Supabase client using the `createClient()` method. - -The Supabase client is your entrypoint to the rest of the Supabase functionality -and is the easiest way to interact with everything we offer within the Supabase ecosystem. - -## Parameters - -
    - -
  • -

    - - supabaseUrl - - - required - - - string - -

    -
    - -The unique Supabase URL which is supplied when you create a new project in your project dashboard. - -
    - -
  • - -
  • -

    - - supabaseKey - - - required - - - string - -

    -
    - -The unique Supabase Key which is supplied when you create a new project in your project dashboard. - -
    - -
  • - -
  • -

    - - SupabaseClientOptions - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - auth - - - optional - - - object - -

      -
      - -No description provided. - -
      - -
        -
        Properties
        - -
      • -

        - - autoRefreshToken - - - optional - - - boolean - -

        -
        - -Automatically refreshes the token for logged in users. - -
        - -
      • - -
      • -

        - - cookieOptions - - - optional - - - object - -

        -
        - -Options passed to the gotrue-js instance - -
        - -
      • - -
      • -

        - - detectSessionInUrl - - - optional - - - boolean - -

        -
        - -Detect a session from the URL. Used for OAuth login callbacks. - -
        - -
      • - -
      • -

        - - persistSession - - - optional - - - boolean - -

        -
        - -Whether to persist a logged in session to storage. - -
        - -
      • - -
      • -

        - - storage - - - optional - - - object - -

        -
        - -A storage provider. Used to store the logged in session. - -
        - -
      • - -
      • -

        - - storageKey - - - optional - - - string - -

        -
        - -Optional key name used for storing tokens in local storage - -
        - -
      • - -
      - -
    • - -
    • -

      - - db - - - optional - - - object - -

      -
      - -The Postgres schema which your tables belong to. Must be on the list of exposed schemas in Supabase. Defaults to 'public'. - -
      - -
        -
        Properties
        - -
      • -

        - - schema - - - optional - - - SchemaName - -

        -
        - -No description provided. - -
        - -
      • - -
      - -
    • - -
    • -

      - - global - - - optional - - - object - -

      -
      - -No description provided. - -
      - -
        -
        Properties
        - -
      • -

        - - fetch - - - optional - - - Fetch - -

        -
        - -A custom `fetch` implementation. - -
        - -
      • - -
      • -

        - - headers - - - optional - - - Record - -

        -
        - -Optional headers for initializing the client. - -
        - -
      • - -
      - -
    • - -
    • -

      - - realtime - - - optional - - - RealtimeClientOptions - -

      -
      - -Options passed to the realtime-js instance - -
      - -
    • - -
    - -
  • - -
- -## Examples - -### createClient() - -```js -import { createClient } from '@supabase/supabase-js' - -// Create a single supabase client for interacting with your database -const supabase = createClient( - 'https://xyzcompany.supabase.co', - 'public-anon-key' -) -``` - -### With additional parameters - -```js -import { createClient } from '@supabase/supabase-js' - -const options = { - db: { - schema: 'public', - }, - auth: { - autoRefreshToken: true, - persistSession: true, - detectSessionInUrl: true, - }, - global: { - headers: { 'x-my-custom-header': 'my-app-name' }, - }, -} -const supabase = createClient( - 'https://xyzcompany.supabase.co', - 'public-anon-key', - options -) -``` - -### API schemas - -```js -import { createClient } from '@supabase/supabase-js' - -// Provide a custom schema. Defaults to "public". -const supabase = createClient( - 'https://xyzcompany.supabase.co', - 'public-anon-key', - { - db: { schema: 'other_schema' }, - } -) -``` - -By default the API server points to the `public` schema. You can enable other database schemas within the Dashboard. -Go to `Settings > API > Schema` and add the schema which you want to expose to the API. - -Note: each client connection can only access a single schema, so the code above can access the `other_schema` schema but cannot access the `public` schema. - -### Custom `fetch` implementation - -```js -import { createClient } from '@supabase/supabase-js' - -const supabase = createClient( - 'https://xyzcompany.supabase.co', - 'public-anon-key', - { - global: { fetch: fetch.bind(globalThis) }, - } -) -``` - -`supabase-js` uses the [`cross-fetch`](https://www.npmjs.com/package/cross-fetch) library to make HTTP requests, -but an alternative `fetch` implementation can be provided as an option. -This is most useful in environments where `cross-fetch` is not compatible (for instance Cloudflare Workers). diff --git a/apps/reference/_supabase_js/generated/insert.mdx b/apps/reference/_supabase_js/generated/insert.mdx deleted file mode 100644 index 3672b1fc3ba..00000000000 --- a/apps/reference/_supabase_js/generated/insert.mdx +++ /dev/null @@ -1,242 +0,0 @@ ---- -id: insert -title: 'Create data: insert()' -slug: /insert -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Perform an INSERT into the table or view. - -By default, inserted rows are not returned. To return it, chain the call -with `.select()`. - -```js -const { data, error } = await supabase - .from('cities') - .insert([{ name: 'The Shire', country_id: 554 }]) -``` - -## Parameters - -
    - -
  • -

    - - values - - - required - - - Row | array - -

    -
    - -The values to insert. Pass an object to insert a single row -or an array to insert multiple rows. - -
    - -
      -
      Properties
      - -
    • -

      - - object - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - Row - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
  • -

    - - options - - - required - - - object - -

    -
    - -Named parameters - -
    - -
      -
      Properties
      - -
    • -

      - - count - - - optional - - - exact | planned | estimated - -

      -
      - -Count algorithm to use to count inserted rows. - -`"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the -hood. - -`"planned"`: Approximated but fast count algorithm. Uses the Postgres -statistics under the hood. - -`"estimated"`: Uses exact count for low numbers and planned count for high -numbers. - -
      - -
        -
        Properties
        - -
      • -

        - - estimated - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - planned - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - exact - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      - -
    • - -
    - -
  • - -
- -## Examples - -### Create a record - -```js -const { data, error } = await supabase - .from('cities') - .insert([{ name: 'The Shire', country_id: 554 }]) -``` - -### Create a record and return it - -```js -const { data, error } = await supabase - .from('cities') - .insert([{ name: 'The Shire', country_id: 554 }]) - .select() -``` - -### Bulk create - -When running a bulk create, the operation is handled in a single transaction. If any of the inserts fail, all other operations are -rolled back. - -```js -const { data, error } = await supabase.from('cities').insert([ - { name: 'The Shire', country_id: 554 }, - { name: 'Rohan', country_id: 555 }, -]) -``` diff --git a/apps/reference/_supabase_js/generated/invoke.mdx b/apps/reference/_supabase_js/generated/invoke.mdx deleted file mode 100644 index 88339ab0d1a..00000000000 --- a/apps/reference/_supabase_js/generated/invoke.mdx +++ /dev/null @@ -1,312 +0,0 @@ ---- -id: invoke -title: 'invoke()' -slug: /invoke -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Invoke a Supabase Function. - -```js -const { data: user, error } = await supabase.functions.invoke('hello', { - body: { foo: 'bar' }, -}) -``` - -## Parameters - -
    - -
  • -

    - - functionName - - - required - - - string - -

    -
    - -the name of the function to invoke - -
    - -
  • - -
  • -

    - - FunctionInvokeOptions - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - body - - - optional - - - File | Blob | ArrayBuffer | FormData | ReadableStream | Record | string - -

      -
      - -the body of the request - -
      - -
        -
        Properties
        - -
      • -

        - - string - - - required - - - object - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - Record - - - required - - - object - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - ReadableStream - - - required - - - object - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - FormData - - - required - - - object - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - File - - - required - - - object - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - Blob - - - required - - - object - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - ArrayBuffer - - - required - - - object - -

        -
        - -No description provided. - -
        - -
      • - -
      - -
    • - -
    • -

      - - headers - - - optional - - - object - -

      -
      - -object representing the headers to send with the request - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- Requires an Authorization header. -- Invoke params generally match the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) spec. -- When you pass in a body to your function, we automatically attach the Content-Type header for `Blob`, `ArrayBuffer`, `File`, `FormData` and `String`. If it doesn't match any of these types we assume the payload is `json`, serialise it and attach the `Content-Type` header as `application/json`. You can override this behaviour by passing in a `Content-Type` header of your own. -- Responses are automatically parsed as `json`, `blob` and `form-data` depending on the `Content-Type` header sent by your function. Responses are parsed as `text` by default. - -## Examples - -### Basic invocation. - -null - -```js -const { data: user, error } = await supabase.functions.invoke('hello', { - body: { foo: 'bar' }, -}) -``` - -### Error handling. - -A `FunctionsHttpError` error is returned if your function throws an error, `FunctionsRelayError` if the Supabase Relay has an error processing your function and `FunctionsFetchError` if there is a network error in calling your function. - -```js -import { - FunctionsHttpError, - FunctionsRelayError, - FunctionsFetchError, -} from '@supabase/supabase-js' - -const { data: user, error } = await supabase.functions.invoke('hello', { - headers: { - 'my-custom-header': 'my-custom-header-value', - }, - body: { foo: 'bar' }, -}) - -if (error instanceof FunctionsHttpError) { - console.log('Function returned an error', error.message) -} else if (error instanceof FunctionsRelayError) { - console.log('Relay error:', error.message) -} else if (error instanceof FunctionsFetchError) { - console.log('Fetch error:', error.message) -} -``` - -### Passing custom headers. - -You can pass custom headers to your function. Note: supabase-js automatically passes the `Authorization` header with the signed in user's JWT. - -```js -const { data: user, error } = await supabase.functions.invoke('hello', { - headers: { - 'my-custom-header': 'my-custom-header-value', - }, - body: { foo: 'bar' }, -}) -``` diff --git a/apps/reference/_supabase_js/generated/is.mdx b/apps/reference/_supabase_js/generated/is.mdx deleted file mode 100644 index a1323e7565d..00000000000 --- a/apps/reference/_supabase_js/generated/is.mdx +++ /dev/null @@ -1,103 +0,0 @@ ---- -id: is -title: 'is()' -slug: /is -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Match only rows where `column` IS `value`. - -For non-boolean columns, this is only relevant for checking if the value of -`column` is NULL by setting `value` to `null`. - -For boolean columns, you can also set `value` to `true` or `false` and it -will behave the same way as `.eq()`. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .is('name', null) -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The column to filter on - -
    - -
  • - -
  • -

    - - value - - - required - - - object - -

    -
    - -The value to filter with - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .is('name', null) -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .is('name', null) -``` - -### With `delete()` - -```js -const { data, error } = await supabase.from('cities').delete().is('name', null) -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase.rpc('echo_all_cities').is('name', null) -``` diff --git a/apps/reference/_supabase_js/generated/like.mdx b/apps/reference/_supabase_js/generated/like.mdx deleted file mode 100644 index 4fd8987a65a..00000000000 --- a/apps/reference/_supabase_js/generated/like.mdx +++ /dev/null @@ -1,102 +0,0 @@ ---- -id: like -title: 'like()' -slug: /like -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Match only rows where `column` matches `pattern` case-sensitively. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .like('name', '%la%') -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The column to filter on - -
    - -
  • - -
  • -

    - - pattern - - - required - - - string - -

    -
    - -The pattern to match with - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .like('name', '%la%') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .like('name', '%la%') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .like('name', '%la%') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .like('name', '%la%') -``` diff --git a/apps/reference/_supabase_js/generated/limit.mdx b/apps/reference/_supabase_js/generated/limit.mdx deleted file mode 100644 index 8c19798a775..00000000000 --- a/apps/reference/_supabase_js/generated/limit.mdx +++ /dev/null @@ -1,111 +0,0 @@ ---- -id: limit -title: 'limit()' -slug: /limit -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Limit the query result by `count`. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .limit(1) -``` - -## Parameters - -
    - -
  • -

    - - count - - - required - - - number - -

    -
    - -The maximum number of rows to return - -
    - -
  • - -
  • -

    - - options - - - required - - - object - -

    -
    - -Named parameters - -
    - -
      -
      Properties
      - -
    • -

      - - foreignTable - - - optional - - - string - -

      -
      - -Set this to limit rows of foreign tables -instead of the current table - -
      - -
    • - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .limit(1) -``` - -### With embedded resources - -```js -const { data, error } = await supabase - .from('countries') - .select('name, cities(name)') - .eq('name', 'United States') - .limit(1, { foreignTable: 'cities' }) -``` diff --git a/apps/reference/_supabase_js/generated/lt.mdx b/apps/reference/_supabase_js/generated/lt.mdx deleted file mode 100644 index b3a79165666..00000000000 --- a/apps/reference/_supabase_js/generated/lt.mdx +++ /dev/null @@ -1,102 +0,0 @@ ---- -id: lt -title: 'lt()' -slug: /lt -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Match only rows where `column` is less than `value`. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .lt('country_id', 250) -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The column to filter on - -
    - -
  • - -
  • -

    - - value - - - required - - - object - -

    -
    - -The value to filter with - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .lt('country_id', 250) -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .lt('country_id', 250) -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .lt('country_id', 250) -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .lt('country_id', 250) -``` diff --git a/apps/reference/_supabase_js/generated/lte.mdx b/apps/reference/_supabase_js/generated/lte.mdx deleted file mode 100644 index 0c5fff4336c..00000000000 --- a/apps/reference/_supabase_js/generated/lte.mdx +++ /dev/null @@ -1,102 +0,0 @@ ---- -id: lte -title: 'lte()' -slug: /lte -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Match only rows where `column` is less than or equal to `value`. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .lte('country_id', 250) -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The column to filter on - -
    - -
  • - -
  • -

    - - value - - - required - - - object - -

    -
    - -The value to filter with - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .lte('country_id', 250) -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .lte('country_id', 250) -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .lte('country_id', 250) -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .lte('country_id', 250) -``` diff --git a/apps/reference/_supabase_js/generated/match.mdx b/apps/reference/_supabase_js/generated/match.mdx deleted file mode 100644 index 11fcc31e0a0..00000000000 --- a/apps/reference/_supabase_js/generated/match.mdx +++ /dev/null @@ -1,84 +0,0 @@ ---- -id: match -title: 'match()' -slug: /match -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Match only rows where each column in `query` keys is equal to its -associated value. Shorthand for multiple `.eq()`s. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .match({ name: 'Beijing', country_id: 156 }) -``` - -## Parameters - -
    - -
  • -

    - - query - - - required - - - Record - -

    -
    - -The object to filter with, with column names as keys mapped -to their filter values - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .match({ name: 'Beijing', country_id: 156 }) -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .match({ name: 'Beijing', country_id: 156 }) -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .match({ name: 'Beijing', country_id: 156 }) -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .match({ name: 'Beijing', country_id: 156 }) -``` diff --git a/apps/reference/_supabase_js/generated/maybesingle.mdx b/apps/reference/_supabase_js/generated/maybesingle.mdx deleted file mode 100644 index 77c7e0af2a1..00000000000 --- a/apps/reference/_supabase_js/generated/maybesingle.mdx +++ /dev/null @@ -1,34 +0,0 @@ ---- -id: maybesingle -title: 'maybeSingle()' -slug: /maybesingle -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Return `data` as a single object instead of an array of objects. - -Query result must be zero or one row (e.g. using `.limit(1)`), otherwise -this returns an error. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'Singapore') - .maybeSingle() -``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'Singapore') - .maybeSingle() -``` diff --git a/apps/reference/_supabase_js/generated/neq.mdx b/apps/reference/_supabase_js/generated/neq.mdx deleted file mode 100644 index 9b65ed8cc39..00000000000 --- a/apps/reference/_supabase_js/generated/neq.mdx +++ /dev/null @@ -1,102 +0,0 @@ ---- -id: neq -title: 'neq()' -slug: /neq -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Match only rows where `column` is not equal to `value`. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .neq('name', 'The shire') -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The column to filter on - -
    - -
  • - -
  • -

    - - value - - - required - - - object - -

    -
    - -The value to filter with - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .neq('name', 'The shire') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .neq('name', 'San Francisco') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .neq('name', 'Mordor') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .neq('name', 'Lagos') -``` diff --git a/apps/reference/_supabase_js/generated/not.mdx b/apps/reference/_supabase_js/generated/not.mdx deleted file mode 100644 index d72667d25c8..00000000000 --- a/apps/reference/_supabase_js/generated/not.mdx +++ /dev/null @@ -1,140 +0,0 @@ ---- -id: not -title: 'not()' -slug: /not -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Match only rows which doesn't satisfy the filter. - -Unlike most filters, `opearator` and `value` are used as-is and need to -follow [PostgREST -syntax](https://postgrest.org/en/stable/api.html#operators). You also need -to make sure they are properly sanitized. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .not('name', 'eq', 'Paris') -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The column to filter on - -
    - -
  • - -
  • -

    - - operator - - - required - - - FilterOperator - -

    -
    - -The operator to be negated to filter with, following -PostgREST syntax - -
    - -
  • - -
  • -

    - - value - - - required - - - object - -

    -
    - -The value to filter with, following PostgREST syntax - -
    - -
  • - -
- -## Notes - -- `.not()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values. - - ```js - .not('name','eq','Paris') - .not('arraycol','cs','{"a","b"}') // Use Postgres array {} for array column and 'cs' for contains. - .not('rangecol','cs','(1,2]') // Use Postgres range syntax for range column. - .not('id','in','(6,7)') // Use Postgres list () for in filter. - .not('id','in',`(${arr})`) // You can insert a javascript array. - ``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .not('name', 'eq', 'Paris') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .not('name', 'eq', 'Paris') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .not('name', 'eq', 'Paris') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .not('name', 'eq', 'Paris') -``` diff --git a/apps/reference/_supabase_js/generated/or.mdx b/apps/reference/_supabase_js/generated/or.mdx deleted file mode 100644 index a679144ae54..00000000000 --- a/apps/reference/_supabase_js/generated/or.mdx +++ /dev/null @@ -1,135 +0,0 @@ ---- -id: or -title: 'or()' -slug: /or -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Match only rows which satisfy at least one of the filters. - -Unlike most filters, `filters` is used as-is and needs to follow [PostgREST -syntax](https://postgrest.org/en/stable/api.html#operators). You also need -to make sure it's properly sanitized. - -It's currently not possible to do an `.or()` filter across multiple tables. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .or('id.eq.20,id.eq.30') -``` - -## Parameters - -
    - -
  • -

    - - filters - - - required - - - string - -

    -
    - -The filters to use, following PostgREST syntax - -
    - -
  • - -
  • -

    - - foreignTable - - - required - - - object - -

    -
    - -Set this to filter on foreign tables instead of the -current table - -
    - -
      -
      Properties
      - -
    • -

      - - foreignTable - - - optional - - - string - -

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- `.or()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values. - - ```js - .or('id.in.(6,7), arraycol.cs.{"a","b"}') // Use Postgres list () for in filter. Array {} for array column and 'cs' for contains. - .or(`id.in.(${arrList}),arraycol.cs.{${arr}}`) // You can insert a javascipt array for list or array on array column. - .or(`id.in.(${arrList}),rangecol.cs.[${arrRange})`) // You can insert a javascipt array for list or range on a range column. - ``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .or('id.eq.20,id.eq.30') -``` - -### Use `or` with `and` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .or('id.gt.20,and(name.eq.New Zealand,name.eq.France)') -``` - -### Use `or` on foreign tables - -```js -const { data, error } = await supabase - .from('countries') - .select('id, cities(*)') - .or('name.eq.Wellington,name.eq.Paris', { foreignTable: 'cities' }) -``` diff --git a/apps/reference/_supabase_js/generated/order.mdx b/apps/reference/_supabase_js/generated/order.mdx deleted file mode 100644 index acb56ebe027..00000000000 --- a/apps/reference/_supabase_js/generated/order.mdx +++ /dev/null @@ -1,157 +0,0 @@ ---- -id: order -title: 'order()' -slug: /order -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Order the query result by `column`. - -You can call this method multiple times to order by multiple columns. - -You can order foreign tables, but it doesn't affect the ordering of the -current table. - -```js -const { data, error } = await supabase - .from('cities') - .select('name', 'country_id') - .order('id', { ascending: false }) -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The column to order by - -
    - -
  • - -
  • -

    - - options - - - optional - - - object - -

    -
    - -Named parameters - -
    - -
      -
      Properties
      - -
    • -

      - - ascending - - - optional - - - boolean - -

      -
      - -If `true`, the result will be in ascending order - -
      - -
    • - -
    • -

      - - foreignTable - - - optional - - - undefined - -

      -
      - -Set this to order a foreign table by foreign -columns - -
      - -
    • - -
    • -

      - - nullsFirst - - - optional - - - boolean - -

      -
      - -If `true`, `null`s appear first. If `false`, -`null`s appear last. - -
      - -
    • - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name', 'country_id') - .order('id', { ascending: false }) -``` - -### With embedded resources - -```js -const { data, error } = await supabase - .from('countries') - .select('name, cities(name)') - .eq('name', 'United States') - .order('name', { foreignTable: 'cities' }) -``` diff --git a/apps/reference/_supabase_js/generated/overlaps.mdx b/apps/reference/_supabase_js/generated/overlaps.mdx deleted file mode 100644 index 1555fd0a48a..00000000000 --- a/apps/reference/_supabase_js/generated/overlaps.mdx +++ /dev/null @@ -1,159 +0,0 @@ ---- -id: overlaps -title: 'overlaps()' -slug: /overlaps -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Only relevant for array and range columns. Match only rows where -`column` and `value` have an element in common. - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, main_exports') - .overlaps('main_exports', ['computers', 'minerals']) -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The array or range column to filter on - -
    - -
  • - -
  • -

    - - value - - - required - - - string | array - -

    -
    - -The array or range value to filter with - -
    - -
      -
      Properties
      - -
    • -

      - - object - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - string - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- `.overlaps()` can work on array columns or range columns. - - ```js - .overlaps('arraycol',["a","b"]) // You can use a javascript array for an array column - .overlaps('arraycol','{"a","b"}') // You can use a string with Postgres array {} for array column. - .overlaps('rangecol','(1,2]') // Use Postgres range syntax for range column. - .overlaps('rangecol',`(${arr}]`) // You can insert an array into a string. - ``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, main_exports') - .overlaps('main_exports', ['computers', 'minerals']) -``` - -### With `update()` - -```js -let countries = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .overlaps('main_exports', ['computers', 'minerals']) -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('countries') - .delete() - .overlaps('main_exports', ['computers', 'minerals']) -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_countries') - .overlaps('main_exports', ['computers', 'minerals']) -``` diff --git a/apps/reference/_supabase_js/generated/range.mdx b/apps/reference/_supabase_js/generated/range.mdx deleted file mode 100644 index d993ff88901..00000000000 --- a/apps/reference/_supabase_js/generated/range.mdx +++ /dev/null @@ -1,121 +0,0 @@ ---- -id: range -title: 'range()' -slug: /range -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Limit the query result by `from` and `to` inclusively. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .range(0, 3) -``` - -## Parameters - -
    - -
  • -

    - - from - - - required - - - number - -

    -
    - -The starting index from which to limit the result - -
    - -
  • - -
  • -

    - - to - - - required - - - number - -

    -
    - -The last index to which to limit the result - -
    - -
  • - -
  • -

    - - options - - - required - - - object - -

    -
    - -Named parameters - -
    - -
      -
      Properties
      - -
    • -

      - - foreignTable - - - optional - - - string - -

      -
      - -Set this to limit rows of foreign tables -instead of the current table - -
      - -
    • - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .range(0, 3) -``` diff --git a/apps/reference/_supabase_js/generated/rangeadjacent.mdx b/apps/reference/_supabase_js/generated/rangeadjacent.mdx deleted file mode 100644 index b914235562e..00000000000 --- a/apps/reference/_supabase_js/generated/rangeadjacent.mdx +++ /dev/null @@ -1,104 +0,0 @@ ---- -id: rangeadjacent -title: 'rangeAdjacent()' -slug: /rangeadjacent -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Only relevant for range columns. Match only rows where `column` is -mutually exclusive to `range` and there can be no element between the two -ranges. - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeAdjacent('population_range_millions', '[70, 185]') -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The range column to filter on - -
    - -
  • - -
  • -

    - - range - - - required - - - string - -

    -
    - -The range to filter with - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeAdjacent('population_range_millions', '[70, 185]') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .rangeAdjacent('population_range_millions', '[70, 185]') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('countries') - .delete() - .rangeAdjacent('population_range_millions', '[70, 185]') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_countries') - .rangeAdjacent('population_range_millions', '[70, 185]') -``` diff --git a/apps/reference/_supabase_js/generated/rangegt.mdx b/apps/reference/_supabase_js/generated/rangegt.mdx deleted file mode 100644 index fec4709eb04..00000000000 --- a/apps/reference/_supabase_js/generated/rangegt.mdx +++ /dev/null @@ -1,103 +0,0 @@ ---- -id: rangegt -title: 'rangeGt()' -slug: /rangegt -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Only relevant for range columns. Match only rows where every element in -`column` is greater than any element in `range`. - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGt('population_range_millions', '[150, 250]') -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The range column to filter on - -
    - -
  • - -
  • -

    - - range - - - required - - - string - -

    -
    - -The range to filter with - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGt('population_range_millions', '[150, 250]') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .rangeGt('population_range_millions', '[150, 250]') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('countries') - .delete() - .rangeGt('population_range_millions', '[150, 250]') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_countries') - .rangeGt('population_range_millions', '[150, 250]') -``` diff --git a/apps/reference/_supabase_js/generated/rangegte.mdx b/apps/reference/_supabase_js/generated/rangegte.mdx deleted file mode 100644 index d2b34265774..00000000000 --- a/apps/reference/_supabase_js/generated/rangegte.mdx +++ /dev/null @@ -1,104 +0,0 @@ ---- -id: rangegte -title: 'rangeGte()' -slug: /rangegte -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Only relevant for range columns. Match only rows where every element in -`column` is either contained in `range` or greater than any element in -`range`. - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGte('population_range_millions', '[150, 250]') -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The range column to filter on - -
    - -
  • - -
  • -

    - - range - - - required - - - string - -

    -
    - -The range to filter with - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGte('population_range_millions', '[150, 250]') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .rangeGte('population_range_millions', '[150, 250]') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('countries') - .delete() - .rangeGte('population_range_millions', '[150, 250]') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_countries') - .rangeGte('population_range_millions', '[150, 250]') -``` diff --git a/apps/reference/_supabase_js/generated/rangelt.mdx b/apps/reference/_supabase_js/generated/rangelt.mdx deleted file mode 100644 index 6cc7d3333d8..00000000000 --- a/apps/reference/_supabase_js/generated/rangelt.mdx +++ /dev/null @@ -1,103 +0,0 @@ ---- -id: rangelt -title: 'rangeLt()' -slug: /rangelt -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Only relevant for range columns. Match only rows where every element in -`column` is less than any element in `range`. - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLt('population_range_millions', '[150, 250]') -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The range column to filter on - -
    - -
  • - -
  • -

    - - range - - - required - - - string - -

    -
    - -The range to filter with - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLt('population_range_millions', '[150, 250]') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .rangeLt('population_range_millions', '[150, 250]') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('countries') - .delete() - .rangeLt('population_range_millions', '[150, 250]') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_countries') - .rangeLt('population_range_millions', '[150, 250]') -``` diff --git a/apps/reference/_supabase_js/generated/rangelte.mdx b/apps/reference/_supabase_js/generated/rangelte.mdx deleted file mode 100644 index 10c1ec3d288..00000000000 --- a/apps/reference/_supabase_js/generated/rangelte.mdx +++ /dev/null @@ -1,104 +0,0 @@ ---- -id: rangelte -title: 'rangeLte()' -slug: /rangelte -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Only relevant for range columns. Match only rows where every element in -`column` is either contained in `range` or less than any element in -`range`. - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLte('population_range_millions', '[150, 250]') -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The range column to filter on - -
    - -
  • - -
  • -

    - - range - - - required - - - string - -

    -
    - -The range to filter with - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLte('population_range_millions', '[150, 250]') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .rangeLte('population_range_millions', '[150, 250]') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('countries') - .delete() - .rangeLte('population_range_millions', '[150, 250]') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_countries') - .rangeLte('population_range_millions', '[150, 250]') -``` diff --git a/apps/reference/_supabase_js/generated/removeallchannels.mdx b/apps/reference/_supabase_js/generated/removeallchannels.mdx deleted file mode 100644 index b1651609f85..00000000000 --- a/apps/reference/_supabase_js/generated/removeallchannels.mdx +++ /dev/null @@ -1,27 +0,0 @@ ---- -id: removeallchannels -title: 'removeAllChannels()' -slug: /removeallchannels -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Unsubscribes and removes all Realtime channels from Realtime client. - -```js -supabase.removeAllChannels() -``` - -## Notes - -- Removing channels is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed. - -## Examples - -### Remove all channels - -```js -supabase.removeAllChannels() -``` diff --git a/apps/reference/_supabase_js/generated/removechannel.mdx b/apps/reference/_supabase_js/generated/removechannel.mdx deleted file mode 100644 index 17d20d2bf69..00000000000 --- a/apps/reference/_supabase_js/generated/removechannel.mdx +++ /dev/null @@ -1,838 +0,0 @@ ---- -id: removechannel -title: 'removeChannel()' -slug: /removechannel -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Unsubscribes and removes Realtime channel from Realtime client. - -```js -supabase.removeChannel(myChannel) -``` - -## Parameters - -
    - -
  • -

    - - RealtimeChannel - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - updateJoinPayload - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - untrack - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - unsubscribe - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - trigger - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - track - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - topic - - - required - - - string - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - timeout - - - required - - - number - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - subscribe - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - state - - - required - - - CHANNEL_STATES - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - socket - - - required - - - default - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - send - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - replyEventName - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - rejoinUntilConnected - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - rejoinTimer - - - required - - - default - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - rejoin - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - pushBuffer - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - push - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - presenceState - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - presence - - - required - - - default - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - params - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - onMessage - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - onError - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - onClose - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - on - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - off - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - joinRef - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - joinPush - - - required - - - default - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - joinedOnce - - - required - - - boolean - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - isMember - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - isLeaving - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - isJoining - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - isJoined - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - isErrored - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - isEqual - - - required - - - any - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - isClosed - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - getPayloadRecords - - - required - - - any - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - constructor - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - canPush - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - bindings - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- Removing a channel is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed. - -## Examples - -### Removes a channel - -```js -supabase.removeChannel(myChannel) -``` diff --git a/apps/reference/_supabase_js/generated/rpc.mdx b/apps/reference/_supabase_js/generated/rpc.mdx deleted file mode 100644 index d5247808471..00000000000 --- a/apps/reference/_supabase_js/generated/rpc.mdx +++ /dev/null @@ -1,264 +0,0 @@ ---- -id: rpc -title: 'Postgres functions: rpc()' -slug: /rpc -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -You can call Postgres functions as a "Remote Procedure Call". - -That's a fancy way of saying that you can put some logic into your database then call it from anywhere. -It's especially useful when the logic rarely changes - like password resets and updates. - -```sql -create or replace function hello_world() returns text as $$ - select 'Hello world'; -$$ language sql; -``` - -```js -const { data, error } = await supabase.rpc('hello_world') -``` - -## Parameters - -
    - -
  • -

    - - fn - - - required - - - FunctionName - -

    -
    - -The function name to call - -
    - -
  • - -
  • -

    - - args - - - required - - - object - -

    -
    - -The arguments to pass to the function call - -
    - -
  • - -
  • -

    - - options - - - required - - - object - -

    -
    - -Named parameters - -
    - -
      -
      Properties
      - -
    • -

      - - count - - - optional - - - exact | planned | estimated - -

      -
      - -Count algorithm to use to count rows returned by the -function. Only applicable for [set-returning -functions](https://www.postgresql.org/docs/current/functions-srf.html). - -`"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the -hood. - -`"planned"`: Approximated but fast count algorithm. Uses the Postgres -statistics under the hood. - -`"estimated"`: Uses exact count for low numbers and planned count for high -numbers. - -
      - -
        -
        Properties
        - -
      • -

        - - estimated - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - planned - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - exact - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      - -
    • - -
    • -

      - - head - - - optional - - - boolean - -

      -
      - -When set to `true`, `data` will not be returned. -Useful if you only need the count. - -
      - -
    • - -
    - -
  • - -
- -## Examples - -### Call a Postgres function - -This is an example of invoking a Postgres function with no parameters. - -```js -const { data, error } = await supabase.rpc('hello_world') -``` - -### With Parameters - -```js -const { data, error } = await supabase.rpc('echo_city', { name: 'The Shire' }) -``` - -### Bulk processing - -You can process large payloads at once using [array parameters](https://postgrest.org/en/stable/api.html#calling-functions-with-array-parameters). - -```js -const { data, error } = await postgrest.rpc('echo_cities', { - names: ['The Shire', 'Mordor'], -}) -``` - -### With filters - -Postgres functions that return tables can also be combined with -[Modifiers](/docs/reference/javascript/using-modifiers) and -[Filters](/docs/reference/javascript/using-filters). - -```js -const { data, error } = await supabase - .rpc('echo_all_cities') - .select('name, population') - .eq('name', 'The Shire') -``` - -### With count option - -You can specify a count option to get the row count along with your data. -Allowed values for count option are `null`, `exact`, `planned` and `estimated`. - -```js -const { data, error, count } = await supabase.rpc( - 'hello_world', - {}, - { count: 'exact' } -) -``` diff --git a/apps/reference/_supabase_js/generated/select.mdx b/apps/reference/_supabase_js/generated/select.mdx deleted file mode 100644 index 276461f0eb6..00000000000 --- a/apps/reference/_supabase_js/generated/select.mdx +++ /dev/null @@ -1,319 +0,0 @@ ---- -id: select -title: 'Fetch data: select()' -slug: /select -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Perform a SELECT query on the table or view. - -```js -const { data, error } = await supabase.from('cities').select() -``` - -## Parameters - -
    - -
  • -

    - - columns - - - optional - - - Query - -

    -
    - -The columns to retrieve, separated by commas - -
    - -
  • - -
  • -

    - - options - - - required - - - object - -

    -
    - -Named parameters - -
    - -
      -
      Properties
      - -
    • -

      - - count - - - optional - - - exact | planned | estimated - -

      -
      - -Count algorithm to use to count rows in the table or view. - -`"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the -hood. - -`"planned"`: Approximated but fast count algorithm. Uses the Postgres -statistics under the hood. - -`"estimated"`: Uses exact count for low numbers and planned count for high -numbers. - -
      - -
        -
        Properties
        - -
      • -

        - - estimated - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - planned - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - exact - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      - -
    • - -
    • -

      - - head - - - optional - - - boolean - -

      -
      - -When set to `true`, `data` will not be returned. -Useful if you only need the count. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- By default, Supabase projects will return a maximum of 1,000 rows. This setting can be changed in Project API Settings. It's recommended that you keep it low to limit the payload size of accidental or malicious requests. You can use `range()` queries to paginate through your data. -- `select()` can be combined with [Modifiers](/docs/reference/javascript/using-modifiers) -- `select()` can be combined with [Filters](/docs/reference/javascript/using-filters) -- If using the Supabase hosted platform `apikey` is technically a reserved keyword, since the API gateway will pluck it out for authentication. [It should be avoided as a column name](https://github.com/supabase/supabase/issues/5465). - -## Examples - -### Getting your data - -```js -const { data, error } = await supabase.from('cities').select() -``` - -### Selecting specific columns - -You can select specific fields from your tables. - -```js -const { data, error } = await supabase.from('cities').select('name') -``` - -### Query foreign tables - -If your database has foreign key relationships, you can query related tables too. - -```js -const { data, error } = await supabase.from('countries').select(` - name, - cities ( - name - ) - `) -``` - -:::note What about join tables -If you're in a situation where your tables are **NOT** directly related, but instead are joined by a _join table_, -you can still use the `select()` method to query the related data. The PostgREST engine detects the relationship automatically. -For more details, [follow the link](https://postgrest.org/en/latest/api.html#embedding-through-join-tables). - -::: - -### Query the same foreign table multiple times - -Sometimes you will need to query the same foreign table twice. -In this case, you can use the name of the joined column to identify -which join you intend to use. For convenience, you can also give an -alias for each column. For example, if we had a shop of products, -and we wanted to get the supplier and the purchaser at the same time -(both in the users) table: - -```js -const { data, error } = await supabase.from('products').select(` - id, - supplier:supplier_id ( name ), - purchaser:purchaser_id ( name ) - `) -``` - -### Filtering with inner joins - -If you want to filter a table based on a child table's values you can use the `!inner()` function. For example, if you wanted -to select all rows in a `message` table which belong to a user with the `username` "Jane": - -```js -const { data, error } = await supabase - .from('messages') - .select('*, users!inner(*)') - .eq('users.username', 'Jane') -``` - -### Querying with count option - -You can get the number of rows by using the count option. -Allowed values for count option are `null`, [exact](https://postgrest.org/en/stable/api.html#exact-count), [planned](https://postgrest.org/en/stable/api.html#planned-count) and [estimated](https://postgrest.org/en/stable/api.html#estimated-count). - -```js -const { data, error, count } = await supabase - .from('cities') - .select('name', { count: 'exact' }) // if you don't want to return any rows, you can use { count: 'exact', head: true } -``` - -### Querying JSON data - -If you have data inside of a JSONB column, you can apply select -and query filters to the data values. Postgres offers a -[number of operators](https://www.postgresql.org/docs/current/functions-json.html) -for querying JSON data. Also see -[PostgREST docs](http://postgrest.org/en/v7.0.0/api.html#json-columns) for more details. - -```js -const { data, error } = await supabase - .from('users') - .select( - ` - id, name, - address->street - ` - ) - .eq('address->postcode', 90210) -``` - -### Return data as CSV - -By default the data is returned in JSON format, however you can also request for it to be returned as Comma Separated Values. - -```js -const { data, error } = await supabase.from('users').select().csv() -``` - -### Aborting requests in-flight - -You can use an [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) to abort requests. Note that `status` and `statusText` doesn't mean anything for aborted requests, since the request wasn't actually fulfilled. - -```js -const ac = new AbortController() -supabase - .from('very_big_table') - .select() - .abortSignal(ac.signal) - .then(console.log) -ac.abort() -// { -// error: { -// message: 'FetchError: The user aborted a request.', -// details: '', -// hint: '', -// code: '' -// }, -// data: null, -// body: null, -// count: null, -// status: 400, -// statusText: 'Bad Request' -// } -``` diff --git a/apps/reference/_supabase_js/generated/single.mdx b/apps/reference/_supabase_js/generated/single.mdx deleted file mode 100644 index c012196ab58..00000000000 --- a/apps/reference/_supabase_js/generated/single.mdx +++ /dev/null @@ -1,34 +0,0 @@ ---- -id: single -title: 'single()' -slug: /single -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Return `data` as a single object instead of an array of objects. - -Query result must be one row (e.g. using `.limit(1)`), otherwise this -returns an error. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .limit(1) - .single() -``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .limit(1) - .single() -``` diff --git a/apps/reference/_supabase_js/generated/storage-createbucket.mdx b/apps/reference/_supabase_js/generated/storage-createbucket.mdx deleted file mode 100644 index d82af4997c6..00000000000 --- a/apps/reference/_supabase_js/generated/storage-createbucket.mdx +++ /dev/null @@ -1,105 +0,0 @@ ---- -id: storage-createbucket -title: 'createBucket()' -slug: /storage-createbucket -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Creates a new Storage bucket - -```js -const { data, error } = await supabase.storage.createBucket('avatars', { - public: false, -}) -``` - -## Parameters - -
    - -
  • -

    - - id - - - required - - - string - -

    -
    - -A unique identifier for the bucket you are creating. - -
    - -
  • - -
  • -

    - - options - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - public - - - required - - - boolean - -

      -
      - -The visibility of the bucket. Public buckets don't require an authorization token to download objects, but still require a valid token for all other operations. By default, buckets are private. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- RLS policy permissions required: - - `buckets` table permissions: `insert` - - `objects` table permissions: none -- Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - -## Examples - -### Create bucket - -```js -const { data, error } = await supabase.storage.createBucket('avatars', { - public: false, -}) -``` diff --git a/apps/reference/_supabase_js/generated/storage-deletebucket.mdx b/apps/reference/_supabase_js/generated/storage-deletebucket.mdx deleted file mode 100644 index fa15415b793..00000000000 --- a/apps/reference/_supabase_js/generated/storage-deletebucket.mdx +++ /dev/null @@ -1,57 +0,0 @@ ---- -id: storage-deletebucket -title: 'deleteBucket()' -slug: /storage-deletebucket -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Deletes an existing bucket. A bucket can't be deleted with existing objects inside it. -You must first `empty()` the bucket. - -```js -const { data, error } = await supabase.storage.deleteBucket('avatars') -``` - -## Parameters - -
    - -
  • -

    - - id - - - required - - - string - -

    -
    - -The unique identifier of the bucket you would like to delete. - -
    - -
  • - -
- -## Notes - -- RLS policy permissions required: - - `buckets` table permissions: `select` and `delete` - - `objects` table permissions: none -- Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - -## Examples - -### Delete bucket - -```js -const { data, error } = await supabase.storage.deleteBucket('avatars') -``` diff --git a/apps/reference/_supabase_js/generated/storage-emptybucket.mdx b/apps/reference/_supabase_js/generated/storage-emptybucket.mdx deleted file mode 100644 index 568e5cea01c..00000000000 --- a/apps/reference/_supabase_js/generated/storage-emptybucket.mdx +++ /dev/null @@ -1,56 +0,0 @@ ---- -id: storage-emptybucket -title: 'emptyBucket()' -slug: /storage-emptybucket -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Removes all objects inside a single bucket. - -```js -const { data, error } = await supabase.storage.emptyBucket('avatars') -``` - -## Parameters - -
    - -
  • -

    - - id - - - required - - - string - -

    -
    - -The unique identifier of the bucket you would like to empty. - -
    - -
  • - -
- -## Notes - -- RLS policy permissions required: - - `buckets` table permissions: `select` - - `objects` table permissions: `select` and `delete` -- Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - -## Examples - -### Empty bucket - -```js -const { data, error } = await supabase.storage.emptyBucket('avatars') -``` diff --git a/apps/reference/_supabase_js/generated/storage-from-copy.mdx b/apps/reference/_supabase_js/generated/storage-from-copy.mdx deleted file mode 100644 index 14ba7920ae6..00000000000 --- a/apps/reference/_supabase_js/generated/storage-from-copy.mdx +++ /dev/null @@ -1,80 +0,0 @@ ---- -id: storage-from-copy -title: 'from.copy()' -slug: /storage-from-copy -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Copies an existing file to a new path in the same bucket. - -```js -const { data, error } = await supabase.storage - .from('avatars') - .copy('public/avatar1.png', 'private/avatar2.png') -``` - -## Parameters - -
    - -
  • -

    - - fromPath - - - required - - - string - -

    -
    - -The original file path, including the current file name. For example `folder/image.png`. - -
    - -
  • - -
  • -

    - - toPath - - - required - - - string - -

    -
    - -The new file path, including the new file name. For example `folder/image-copy.png`. - -
    - -
  • - -
- -## Notes - -- RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: `insert` and `select` -- Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - -## Examples - -### Copy file - -```js -const { data, error } = await supabase.storage - .from('avatars') - .copy('public/avatar1.png', 'private/avatar2.png') -``` diff --git a/apps/reference/_supabase_js/generated/storage-from-createsignedurl.mdx b/apps/reference/_supabase_js/generated/storage-from-createsignedurl.mdx deleted file mode 100644 index 8b9603b008a..00000000000 --- a/apps/reference/_supabase_js/generated/storage-from-createsignedurl.mdx +++ /dev/null @@ -1,80 +0,0 @@ ---- -id: storage-from-createsignedurl -title: 'from.createSignedUrl()' -slug: /storage-from-createsignedurl -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Creates a signed URL. Use a signed URL to share a file for a fixed amount of time. - -```js -const { data, error } = await supabase.storage - .from('avatars') - .createSignedUrl('folder/avatar1.png', 60) -``` - -## Parameters - -
    - -
  • -

    - - path - - - required - - - string - -

    -
    - -The file path, including the current file name. For example `folder/image.png`. - -
    - -
  • - -
  • -

    - - expiresIn - - - required - - - number - -

    -
    - -The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute. - -
    - -
  • - -
- -## Notes - -- RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: `select` -- Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - -## Examples - -### Create Signed URL - -```js -const { data, error } = await supabase.storage - .from('avatars') - .createSignedUrl('folder/avatar1.png', 60) -``` diff --git a/apps/reference/_supabase_js/generated/storage-from-createsignedurls.mdx b/apps/reference/_supabase_js/generated/storage-from-createsignedurls.mdx deleted file mode 100644 index 7a2ebb9a98b..00000000000 --- a/apps/reference/_supabase_js/generated/storage-from-createsignedurls.mdx +++ /dev/null @@ -1,80 +0,0 @@ ---- -id: storage-from-createsignedurls -title: 'from.createSignedUrls()' -slug: /storage-from-createsignedurls -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Creates multiple signed URLs. Use a signed URL to share a file for a fixed amount of time. - -```js -const { data, error } = await supabase.storage - .from('avatars') - .createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60) -``` - -## Parameters - -
    - -
  • -

    - - paths - - - required - - - object - -

    -
    - -The file paths to be downloaded, including the current file names. For example `['folder/image.png', 'folder2/image2.png']`. - -
    - -
  • - -
  • -

    - - expiresIn - - - required - - - number - -

    -
    - -The number of seconds until the signed URLs expire. For example, `60` for URLs which are valid for one minute. - -
    - -
  • - -
- -## Notes - -- RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: `select` -- Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - -## Examples - -### Create Signed URLs - -```js -const { data, error } = await supabase.storage - .from('avatars') - .createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60) -``` diff --git a/apps/reference/_supabase_js/generated/storage-from-download.mdx b/apps/reference/_supabase_js/generated/storage-from-download.mdx deleted file mode 100644 index e30cb64ae5c..00000000000 --- a/apps/reference/_supabase_js/generated/storage-from-download.mdx +++ /dev/null @@ -1,60 +0,0 @@ ---- -id: storage-from-download -title: 'from.download()' -slug: /storage-from-download -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Downloads a file. - -```js -const { data, error } = await supabase.storage - .from('avatars') - .download('folder/avatar1.png') -``` - -## Parameters - -
    - -
  • -

    - - path - - - required - - - string - -

    -
    - -The full path and file name of the file to be downloaded. For example `folder/image.png`. - -
    - -
  • - -
- -## Notes - -- RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: `select` -- Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - -## Examples - -### Download file - -```js -const { data, error } = await supabase.storage - .from('avatars') - .download('folder/avatar1.png') -``` diff --git a/apps/reference/_supabase_js/generated/storage-from-getpublicurl.mdx b/apps/reference/_supabase_js/generated/storage-from-getpublicurl.mdx deleted file mode 100644 index 0956a453ff4..00000000000 --- a/apps/reference/_supabase_js/generated/storage-from-getpublicurl.mdx +++ /dev/null @@ -1,62 +0,0 @@ ---- -id: storage-from-getpublicurl -title: 'from.getPublicUrl()' -slug: /storage-from-getpublicurl -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Retrieves the URL for an asset in a public bucket. -This function does not verify if the bucket is public. If a public URL is created for a bucket which is not public, you will not be able to download the asset. - -```js -const { data } = supabase.storage - .from('public-bucket') - .getPublicUrl('folder/avatar1.png') -``` - -## Parameters - -
    - -
  • -

    - - path - - - required - - - string - -

    -
    - -The path and name of the file to generate the public URL for. For example `folder/image.png`. - -
    - -
  • - -
- -## Notes - -- The bucket needs to be set to public, either via [updateBucket()](/docs/reference/javascript/storage-updatebucket) or by going to Storage on [app.supabase.com](https://app.supabase.com), clicking the overflow menu on a bucket and choosing "Make public" -- RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: none -- Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - -## Examples - -### Returns the URL for an asset in a public bucket - -```js -const { data } = supabase.storage - .from('public-bucket') - .getPublicUrl('folder/avatar1.png') -``` diff --git a/apps/reference/_supabase_js/generated/storage-from-list.mdx b/apps/reference/_supabase_js/generated/storage-from-list.mdx deleted file mode 100644 index 332933a8b66..00000000000 --- a/apps/reference/_supabase_js/generated/storage-from-list.mdx +++ /dev/null @@ -1,225 +0,0 @@ ---- -id: storage-from-list -title: 'from.list()' -slug: /storage-from-list -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Lists all the files within a bucket. - -```js -const { data, error } = await supabase.storage.from('avatars').list('folder', { - limit: 100, - offset: 0, - sortBy: { column: 'name', order: 'asc' }, -}) -``` - -## Parameters - -
    - -
  • -

    - - path - - - optional - - - string - -

    -
    - -The folder path. - -
    - -
  • - -
  • -

    - - SearchOptions - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - limit - - - optional - - - number - -

      -
      - -The number of files you want to be returned. - -
      - -
    • - -
    • -

      - - offset - - - optional - - - number - -

      -
      - -The starting position. - -
      - -
    • - -
    • -

      - - search - - - optional - - - string - -

      -
      - -The search string to filter files by. - -
      - -
    • - -
    • -

      - - sortBy - - - optional - - - SortBy - -

      -
      - -The column to sort by. Can be any column inside a FileObject. - -
      - -
    • - -
    - -
  • - -
  • -

    - - FetchParameters - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - signal - - - optional - - - AbortSignal - -

      -
      - -Pass in an AbortController's signal to cancel the request. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: `select` -- Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - -## Examples - -### List files in a bucket - -```js -const { data, error } = await supabase.storage.from('avatars').list('folder', { - limit: 100, - offset: 0, - sortBy: { column: 'name', order: 'asc' }, -}) -``` - -### Search files in a bucket - -```js -const { data, error } = await supabase.storage.from('avatars').list('folder', { - limit: 100, - offset: 0, - sortBy: { column: 'name', order: 'asc' }, - search: 'jon', -}) -``` diff --git a/apps/reference/_supabase_js/generated/storage-from-move.mdx b/apps/reference/_supabase_js/generated/storage-from-move.mdx deleted file mode 100644 index 0aca1f66819..00000000000 --- a/apps/reference/_supabase_js/generated/storage-from-move.mdx +++ /dev/null @@ -1,80 +0,0 @@ ---- -id: storage-from-move -title: 'from.move()' -slug: /storage-from-move -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Moves an existing file to a new path in the same bucket. - -```js -const { data, error } = await supabase.storage - .from('avatars') - .move('public/avatar1.png', 'private/avatar2.png') -``` - -## Parameters - -
    - -
  • -

    - - fromPath - - - required - - - string - -

    -
    - -The original file path, including the current file name. For example `folder/image.png`. - -
    - -
  • - -
  • -

    - - toPath - - - required - - - string - -

    -
    - -The new file path, including the new file name. For example `folder/image-new.png`. - -
    - -
  • - -
- -## Notes - -- RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: `update` and `select` -- Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - -## Examples - -### Move file - -```js -const { data, error } = await supabase.storage - .from('avatars') - .move('public/avatar1.png', 'private/avatar2.png') -``` diff --git a/apps/reference/_supabase_js/generated/storage-from-remove.mdx b/apps/reference/_supabase_js/generated/storage-from-remove.mdx deleted file mode 100644 index bb23a7a117a..00000000000 --- a/apps/reference/_supabase_js/generated/storage-from-remove.mdx +++ /dev/null @@ -1,60 +0,0 @@ ---- -id: storage-from-remove -title: 'from.remove()' -slug: /storage-from-remove -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Deletes files within the same bucket - -```js -const { data, error } = await supabase.storage - .from('avatars') - .remove(['folder/avatar1.png']) -``` - -## Parameters - -
    - -
  • -

    - - paths - - - required - - - object - -

    -
    - -An array of files to delete, including the path and file name. For example [`'folder/image.png'`]. - -
    - -
  • - -
- -## Notes - -- RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: `delete` and `select` -- Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - -## Examples - -### Delete file - -```js -const { data, error } = await supabase.storage - .from('avatars') - .remove(['folder/avatar1.png']) -``` diff --git a/apps/reference/_supabase_js/generated/storage-from-update.mdx b/apps/reference/_supabase_js/generated/storage-from-update.mdx deleted file mode 100644 index 0f88af17c72..00000000000 --- a/apps/reference/_supabase_js/generated/storage-from-update.mdx +++ /dev/null @@ -1,391 +0,0 @@ ---- -id: storage-from-update -title: 'from.update()' -slug: /storage-from-update -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Replaces an existing file at the specified path with a new one. - -```js -const avatarFile = event.target.files[0] -const { data, error } = await supabase.storage - .from('avatars') - .update('public/avatar1.png', avatarFile, { - cacheControl: '3600', - upsert: false, - }) -``` - -## Parameters - -
    - -
  • -

    - - path - - - required - - - string - -

    -
    - -The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to update. - -
    - -
  • - -
  • -

    - - fileBody - - - required - - - string | ArrayBuffer | ArrayBufferView | Blob | Buffer | File | FormData | ReadableStream | ReadableStream | URLSearchParams - -

    -
    - -The body of the file to be stored in the bucket. - -
    - -
      -
      Properties
      - -
    • -

      - - URLSearchParams - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - string - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - ReadableStream - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - ReadableStream - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - FormData - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - File - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - Buffer - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - Blob - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - ArrayBufferView - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - ArrayBuffer - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
  • -

    - - FileOptions - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - cacheControl - - - optional - - - string - -

      -
      - -The number of seconds the asset is cached in the browser and in the Supabase CDN. This is set in the `Cache-Control: max-age=` header. Defaults to 3600 seconds. - -
      - -
    • - -
    • -

      - - contentType - - - optional - - - string - -

      -
      - -the `Content-Type` header value. Should be specified if using a `fileBody` that is neither `Blob` nor `File` nor `FormData`, otherwise will default to `text/plain;charset=UTF-8`. - -
      - -
    • - -
    • -

      - - upsert - - - optional - - - boolean - -

      -
      - -When upsert is set to true, the file is overwritten if it exists. When set to false, an error is thrown if the object already exists. Defaults to false. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: `update` and `select` -- Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works -- For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Update file using `ArrayBuffer` from base64 file data instead, see example below. - -## Examples - -### Update file - -```js -const avatarFile = event.target.files[0] -const { data, error } = await supabase.storage - .from('avatars') - .update('public/avatar1.png', avatarFile, { - cacheControl: '3600', - upsert: false, - }) -``` - -### Update file using `ArrayBuffer` from base64 file data - -```js -import { decode } from 'base64-arraybuffer' - -const { data, error } = await supabase.storage - .from('avatars') - .update('public/avatar1.png', decode('base64FileData'), { - contentType: 'image/png', - }) -``` diff --git a/apps/reference/_supabase_js/generated/storage-from-upload.mdx b/apps/reference/_supabase_js/generated/storage-from-upload.mdx deleted file mode 100644 index 1723775455a..00000000000 --- a/apps/reference/_supabase_js/generated/storage-from-upload.mdx +++ /dev/null @@ -1,391 +0,0 @@ ---- -id: storage-from-upload -title: 'from.upload()' -slug: /storage-from-upload -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Uploads a file to an existing bucket. - -```js -const avatarFile = event.target.files[0] -const { data, error } = await supabase.storage - .from('avatars') - .upload('public/avatar1.png', avatarFile, { - cacheControl: '3600', - upsert: false, - }) -``` - -## Parameters - -
    - -
  • -

    - - path - - - required - - - string - -

    -
    - -The file path, including the file name. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload. - -
    - -
  • - -
  • -

    - - fileBody - - - required - - - string | ArrayBuffer | ArrayBufferView | Blob | Buffer | File | FormData | ReadableStream | ReadableStream | URLSearchParams - -

    -
    - -The body of the file to be stored in the bucket. - -
    - -
      -
      Properties
      - -
    • -

      - - URLSearchParams - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - string - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - ReadableStream - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - ReadableStream - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - FormData - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - File - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - Buffer - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - Blob - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - ArrayBufferView - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - ArrayBuffer - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
  • -

    - - FileOptions - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - cacheControl - - - optional - - - string - -

      -
      - -The number of seconds the asset is cached in the browser and in the Supabase CDN. This is set in the `Cache-Control: max-age=` header. Defaults to 3600 seconds. - -
      - -
    • - -
    • -

      - - contentType - - - optional - - - string - -

      -
      - -the `Content-Type` header value. Should be specified if using a `fileBody` that is neither `Blob` nor `File` nor `FormData`, otherwise will default to `text/plain;charset=UTF-8`. - -
      - -
    • - -
    • -

      - - upsert - - - optional - - - boolean - -

      -
      - -When upsert is set to true, the file is overwritten if it exists. When set to false, an error is thrown if the object already exists. Defaults to false. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- RLS policy permissions required: - - `buckets` table permissions: none - - `objects` table permissions: `insert` -- Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works -- For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Upload file using `ArrayBuffer` from base64 file data instead, see example below. - -## Examples - -### Upload file - -```js -const avatarFile = event.target.files[0] -const { data, error } = await supabase.storage - .from('avatars') - .upload('public/avatar1.png', avatarFile, { - cacheControl: '3600', - upsert: false, - }) -``` - -### Upload file using `ArrayBuffer` from base64 file data - -```js -import { decode } from 'base64-arraybuffer' - -const { data, error } = await supabase.storage - .from('avatars') - .upload('public/avatar1.png', decode('base64FileData'), { - contentType: 'image/png', - }) -``` diff --git a/apps/reference/_supabase_js/generated/storage-getbucket.mdx b/apps/reference/_supabase_js/generated/storage-getbucket.mdx deleted file mode 100644 index 13636f5758f..00000000000 --- a/apps/reference/_supabase_js/generated/storage-getbucket.mdx +++ /dev/null @@ -1,56 +0,0 @@ ---- -id: storage-getbucket -title: 'getBucket()' -slug: /storage-getbucket -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Retrieves the details of an existing Storage bucket. - -```js -const { data, error } = await supabase.storage.getBucket('avatars') -``` - -## Parameters - -
    - -
  • -

    - - id - - - required - - - string - -

    -
    - -The unique identifier of the bucket you would like to retrieve. - -
    - -
  • - -
- -## Notes - -- RLS policy permissions required: - - `buckets` table permissions: `select` - - `objects` table permissions: none -- Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - -## Examples - -### Get bucket - -```js -const { data, error } = await supabase.storage.getBucket('avatars') -``` diff --git a/apps/reference/_supabase_js/generated/storage-listbuckets.mdx b/apps/reference/_supabase_js/generated/storage-listbuckets.mdx deleted file mode 100644 index a6597d1ec15..00000000000 --- a/apps/reference/_supabase_js/generated/storage-listbuckets.mdx +++ /dev/null @@ -1,30 +0,0 @@ ---- -id: storage-listbuckets -title: 'listBuckets()' -slug: /storage-listbuckets -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Retrieves the details of all Storage buckets within an existing project. - -```js -const { data, error } = await supabase.storage.listBuckets() -``` - -## Notes - -- RLS policy permissions required: - - `buckets` table permissions: `select` - - `objects` table permissions: none -- Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - -## Examples - -### List buckets - -```js -const { data, error } = await supabase.storage.listBuckets() -``` diff --git a/apps/reference/_supabase_js/generated/storage-updatebucket.mdx b/apps/reference/_supabase_js/generated/storage-updatebucket.mdx deleted file mode 100644 index 5a7eddc95f0..00000000000 --- a/apps/reference/_supabase_js/generated/storage-updatebucket.mdx +++ /dev/null @@ -1,105 +0,0 @@ ---- -id: storage-updatebucket -title: 'updateBucket()' -slug: /storage-updatebucket -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Updates a Storage bucket - -```js -const { data, error } = await supabase.storage.updateBucket('avatars', { - public: false, -}) -``` - -## Parameters - -
    - -
  • -

    - - id - - - required - - - string - -

    -
    - -A unique identifier for the bucket you are updating. - -
    - -
  • - -
  • -

    - - options - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - public - - - required - - - boolean - -

      -
      - -The visibility of the bucket. Public buckets don't require an authorization token to download objects, but still require a valid token for all other operations. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- RLS policy permissions required: - - `buckets` table permissions: `update` - - `objects` table permissions: none -- Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works - -## Examples - -### Update bucket - -```js -const { data, error } = await supabase.storage.updateBucket('avatars', { - public: false, -}) -``` diff --git a/apps/reference/_supabase_js/generated/subscribe.mdx b/apps/reference/_supabase_js/generated/subscribe.mdx deleted file mode 100644 index c78f6362474..00000000000 --- a/apps/reference/_supabase_js/generated/subscribe.mdx +++ /dev/null @@ -1,219 +0,0 @@ ---- -id: subscribe -title: 'on().subscribe()' -slug: /subscribe -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```js -supabase - .channel('*') - .on('postgres_changes', { event: '*', schema: '*' }, (payload) => { - console.log('Change received!', payload) - }) - .subscribe() -``` - -## Parameters - -
    - -
  • -

    - - type - - - required - - - string - -

    -
    - -"postgres_changes" is the only type supported at this time - -
    - -
  • - -
  • -

    - - filter - - - required - - - object - -

    -
    - -An object with an event property and a schema property. Event property can be `*`, `insert`, `create`, `update`, or `delete`. - -
    - -
  • - -
  • -

    - - callback - - - required - - - Function - -

    -
    - -A callback function that will be called when the channel receives a message. - -
    - -
  • - -
- -## Notes - -- Realtime is disabled by default for new Projects for better database performance and security. You can turn it on by [managing replication](/docs/guides/api#managing-realtime). -- Row level security is not applied to delete statements. -- If you want to receive the "previous" data for updates and deletes, you will need to set `REPLICA IDENTITY` to `FULL`, like this: `ALTER TABLE your_table REPLICA IDENTITY FULL;` -- When a delete occurs, the contents of old_record will be broadcast to all subscribers to that table so ensure that each table's replica identity only contains information that is safe to expose publicly. -- The channel name must exactly match the schema/table/filter you want to listen to separated by colons. See below examples for additional context. - -## Examples - -### Listen to all database changes - -```js -supabase - .channel('*') - .on('postgres_changes', { event: '*', schema: '*' }, (payload) => { - console.log('Change received!', payload) - }) - .subscribe() -``` - -### Listening to a specific table - -```js -supabase - .channel('public:countries') - .on( - 'postgres_changes', - { event: '*', schema: 'public', table: 'countries' }, - (payload) => { - console.log('Change received!', payload) - } - ) - .subscribe() -``` - -### Listening to inserts - -```js -supabase - .channel('public:countries') - .on( - 'postgres_changes', - { event: 'INSERT', schema: 'public', table: 'countries' }, - (payload) => { - console.log('Change received!', payload) - } - ) - .subscribe() -``` - -### Listening to updates - -By default, Supabase will send only the updated record. If you want to receive the previous values as well you can -enable full replication for the table you are listening to: - -```sql -alter table "your_table" replica identity full; -``` - -```js -supabase - .channel('public:countries') - .on( - 'postgres_changes', - { event: 'UPDATE', schema: 'public', table: 'countries' }, - (payload) => { - console.log('Change received!', payload) - } - ) - .subscribe() -``` - -### Listening to deletes - -By default, Supabase does not send deleted records. If you want to receive the deleted record you can -enable full replication for the table you are listening too: - -```sql -alter table "your_table" replica identity full; -``` - -```js -supabase - .channel('public:countries') - .on( - 'postgres_changes', - { event: 'DELETE', schema: 'public', table: 'countries' }, - (payload) => { - console.log('Change received!', payload) - } - ) - .subscribe() -``` - -### Listening to multiple events - -You can chain listeners if you want to listen to multiple events for each table. - -```js -supabase - .channel('public:countries') - .on( - 'postgres_changes', - { event: 'INSERT', schema: 'public', table: 'countries' }, - handleRecordInserted - ) - .on( - 'postgres_changes', - { event: 'DELETE', schema: 'public', table: 'countries' }, - handleRecordDeleted - ) - .subscribe() -``` - -### Listening to row level changes - -You can listen to individual rows using the format `{table}:{col}=eq.{val}` - where `{col}` is the column name, and `{val}` is the value which you want to match. - -```js -supabase - .channel('public:countries:id=eq.200') - .on( - 'postgres_changes', - { - event: 'UPDATE', - schema: 'public', - table: 'countries', - filter: 'id=eq.200', - }, - handleRecordUpdated - ) - .subscribe() -``` diff --git a/apps/reference/_supabase_js/generated/supabase-auth-admin-api.mdx b/apps/reference/_supabase_js/generated/supabase-auth-admin-api.mdx deleted file mode 100644 index f191296b7db..00000000000 --- a/apps/reference/_supabase_js/generated/supabase-auth-admin-api.mdx +++ /dev/null @@ -1,14 +0,0 @@ ---- -id: supabase-auth-admin-api -title: 'Overview' -slug: /supabase-auth-admin-api -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -## Notes - -- Any method under the `supabase.auth.admin` namespace requires a `service_role` key. -- These methods are considered admin methods and should be called on a trusted server. Never expose your `service_role` key in the browser. diff --git a/apps/reference/_supabase_js/generated/textsearch.mdx b/apps/reference/_supabase_js/generated/textsearch.mdx deleted file mode 100644 index f7facded25a..00000000000 --- a/apps/reference/_supabase_js/generated/textsearch.mdx +++ /dev/null @@ -1,250 +0,0 @@ ---- -id: textsearch -title: 'textSearch()' -slug: /textsearch -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Only relevant for text and tsvector columns. Match only rows where -`column` matches the query string in `query`. - -## Parameters - -
    - -
  • -

    - - column - - - required - - - ColumnName - -

    -
    - -The text or tsvector column to filter on - -
    - -
  • - -
  • -

    - - query - - - required - - - string - -

    -
    - -The query text to match with - -
    - -
  • - -
  • -

    - - options - - - optional - - - object - -

    -
    - -Named parameters - -
    - -
      -
      Properties
      - -
    • -

      - - config - - - optional - - - string - -

      -
      - -The text search configuration to use - -
      - -
    • - -
    • -

      - - type - - - optional - - - plain | phrase | websearch - -

      -
      - -Change how the `query` text is interpreted - -
      - -
        -
        Properties
        - -
      • -

        - - websearch - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - phrase - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - plain - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      - -
    • - -
    - -
  • - -
- -## Examples - -### Text search - -```js -const { data, error } = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', `'fat' & 'cat'`, { - config: 'english', - }) -``` - -### Basic normalization - -Uses PostgreSQL's `plainto_tsquery` function. - -```js -const { data, error } = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', `'fat' & 'cat'`, { - type: 'plain', - config: 'english', - }) -``` - -### Full normalization - -Uses PostgreSQL's `phraseto_tsquery` function. - -```js -const { data, error } = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', `'fat' & 'cat'`, { - type: 'phrase', - config: 'english', - }) -``` - -### Websearch - -Uses PostgreSQL's `websearch_to_tsquery` function. -This function will never raise syntax errors, which makes it possible to use raw user-supplied input for search, and can be used -with advanced operators. - -- `unquoted text`: text not inside quote marks will be converted to terms separated by & operators, as if processed by plainto_tsquery. -- `"quoted text"`: text inside quote marks will be converted to terms separated by <-> operators, as if processed by phraseto_tsquery. -- `OR`: the word “or” will be converted to the | operator. -- `-`: a dash will be converted to the ! operator. - -```js -const { data, error } = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', `'fat or cat'`, { - type: 'websearch', - config: 'english', - }) -``` diff --git a/apps/reference/_supabase_js/generated/update.mdx b/apps/reference/_supabase_js/generated/update.mdx deleted file mode 100644 index c2adbc12f24..00000000000 --- a/apps/reference/_supabase_js/generated/update.mdx +++ /dev/null @@ -1,202 +0,0 @@ ---- -id: update -title: 'Modify data: update()' -slug: /update -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Perform an UPDATE on the table or view. - -By default, updated rows are not returned. To return it, chain the call -with `.select()` after filters. - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Middle Earth' }) - .match({ name: 'Auckland' }) -``` - -## Parameters - -
    - -
  • -

    - - values - - - required - - - Row - -

    -
    - -The values to update with - -
    - -
  • - -
  • -

    - - options - - - required - - - object - -

    -
    - -Named parameters - -
    - -
      -
      Properties
      - -
    • -

      - - count - - - optional - - - exact | planned | estimated - -

      -
      - -Count algorithm to use to count updated rows. - -`"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the -hood. - -`"planned"`: Approximated but fast count algorithm. Uses the Postgres -statistics under the hood. - -`"estimated"`: Uses exact count for low numbers and planned count for high -numbers. - -
      - -
        -
        Properties
        - -
      • -

        - - estimated - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - planned - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - exact - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- `update()` should always be combined with [Filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to update. - -## Examples - -### Updating your data - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Middle Earth' }) - .match({ name: 'Auckland' }) -``` - -### Updating JSON data - -Postgres offers a -[number of operators](https://www.postgresql.org/docs/current/functions-json.html) -for working with JSON data. Right now it is only possible to update an entire JSON document, -but we are [working on ideas](https://github.com/PostgREST/postgrest/issues/465) for updating individual keys. For example: - -```js -const { data, error } = await supabase - .from('users') - .update( - ` - address: { - street: 'Melrose Place', - postcode: 90210 - } - ` - ) - .eq('address->postcode', 90210) -``` diff --git a/apps/reference/_supabase_js/generated/upsert.mdx b/apps/reference/_supabase_js/generated/upsert.mdx deleted file mode 100644 index 038d48d1099..00000000000 --- a/apps/reference/_supabase_js/generated/upsert.mdx +++ /dev/null @@ -1,309 +0,0 @@ ---- -id: upsert -title: 'Upsert data: upsert()' -slug: /upsert -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Perform an UPSERT on the table or view. Depending on the column(s) passed -to `onConflict`, `.upsert()` allows you to perform the equivalent of -`.insert()` if a row with the corresponding `onConflict` columns doesn't -exist, or if it does exist, perform an alternative action depending on -`ignoreDuplicates`. - -By default, upserted rows are not returned. To return it, chain the call -with `.select()`. - -```js -const { data, error } = await supabase - .from('messages') - .upsert({ id: 3, message: 'foo', username: 'supabot' }) -``` - -## Parameters - -
    - -
  • -

    - - values - - - required - - - Row | array - -

    -
    - -The values to upsert with. Pass an object to upsert a -single row or an array to upsert multiple rows. - -
    - -
      -
      Properties
      - -
    • -

      - - object - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - Row - - - required - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
  • -

    - - options - - - required - - - object - -

    -
    - -Named parameters - -
    - -
      -
      Properties
      - -
    • -

      - - count - - - optional - - - exact | planned | estimated - -

      -
      - -Count algorithm to use to count upserted rows. - -`"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the -hood. - -`"planned"`: Approximated but fast count algorithm. Uses the Postgres -statistics under the hood. - -`"estimated"`: Uses exact count for low numbers and planned count for high -numbers. - -
      - -
        -
        Properties
        - -
      • -

        - - estimated - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - planned - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      • -

        - - exact - - - required - - - literal - -

        -
        - -No description provided. - -
        - -
      • - -
      - -
    • - -
    • -

      - - ignoreDuplicates - - - optional - - - boolean - -

      -
      - -If `true`, duplicate rows are ignored. If -`false`, duplicate rows are merged with existing rows. - -
      - -
    • - -
    • -

      - - onConflict - - - optional - - - string - -

      -
      - -Comma-separated UNIQUE column(s) to specify how -duplicate rows are determined. Two rows are duplicates if all the -`onConflict` columns are equal. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- Primary keys should be included in the data payload in order for an update to work correctly. -- Primary keys must be natural, not surrogate. There are however, [workarounds](https://github.com/PostgREST/postgrest/issues/1118) for surrogate primary keys. - -## Examples - -### Upsert your data - -```js -const { data, error } = await supabase - .from('messages') - .upsert({ id: 3, message: 'foo', username: 'supabot' }) -``` - -### Bulk Upsert your data - -```js -const { data, error } = await supabase.from('messages').upsert([ - { id: 3, message: 'foo', username: 'supabot' }, - { id: 4, message: 'bar', username: 'supabot' }, -]) -``` - -### Upserting into tables with constraints - -Running the following will cause supabase to upsert data into the `users` table. -If the username 'supabot' already exists, the `onConflict` argument tells supabase to overwrite that row -based on the column passed into `onConflict`. - -```js -const { data, error } = await supabase - .from('users') - .upsert({ username: 'supabot' }, { onConflict: 'username' }) -``` - -### Return the exact number of rows - -```js -const { data, error, count } = await supabase.from('users').upsert( - { - id: 3, - message: 'foo', - username: 'supabot', - }, - { - count: 'exact', - } -) -``` diff --git a/apps/reference/_supabase_js/generated/using-filters.mdx b/apps/reference/_supabase_js/generated/using-filters.mdx deleted file mode 100644 index 6fc5eb2e9a4..00000000000 --- a/apps/reference/_supabase_js/generated/using-filters.mdx +++ /dev/null @@ -1,65 +0,0 @@ ---- -id: using-filters -title: 'Using Filters' -slug: /using-filters -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Filters can be used on `select()`, `update()`, and `delete()` queries. - -If a Postgres function returns a table response, you can also apply filters. - -### Applying Filters - -You must apply your filters to the end of your query. For example: - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'The Shire') // Correct - -const { data, error } = await supabase - .from('cities') - .eq('name', 'The Shire') // Incorrect - .select('name, country_id') -``` - -### Chaining - -Filters can be chained together to produce advanced queries. For example: - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .gte('population', 1000) - .lt('population', 10000) -``` - -### Conditional Chaining - -Filters can be built up one step at a time and then executed. For example: - -```js -const filterByName = null -const filterPopLow = 1000 -const filterPopHigh = 10000 - -let query = supabase.from('cities').select('name, country_id') - -if (filterByName) { - query = query.eq('name', filterByName) -} -if (filterPopLow) { - query = query.gte('population', filterPopLow) -} -if (filterPopHigh) { - query = query.lt('population', filterPopHigh) -} - -const { data, error } = await query -``` diff --git a/apps/reference/_supabase_js/generated/using-modifiers.mdx b/apps/reference/_supabase_js/generated/using-modifiers.mdx deleted file mode 100644 index 1d6571a967b..00000000000 --- a/apps/reference/_supabase_js/generated/using-modifiers.mdx +++ /dev/null @@ -1,13 +0,0 @@ ---- -id: using-modifiers -title: 'Using Modifiers' -slug: /using-modifiers -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Modifiers can be used on `select()` queries. - -If a Postgres function returns a table response, you can also apply modifiers to the `rpc()` function. diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-createuser.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-createuser.mdx deleted file mode 100644 index adc4efa05c4..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-createuser.mdx +++ /dev/null @@ -1,83 +0,0 @@ ---- -id: auth-api-createuser -title: 'createUser()' -slug: auth-api-createuser -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Creates a new user. - -This function should only be called on a server. Never expose your `service_role` key in the browser. - -```js -const { data: user, error } = await supabase.auth.api.createUser({ - email: 'user@email.com', - password: 'password', - user_metadata: { name: 'Yoda' }, -}) -``` - -## Parameters - -
    - -
  • -

    - - attributes - - - required - - - AdminUserAttributes - -

    -
    - -The data you want to create the user with. - -
    - -
  • - -
- -## Notes - -- Requires a `service_role` key. -- This function should be called on a server. Never expose your `service_role` key in the browser. -- If you do not provide the `email_confirm` and `phone_confirm` options to this function, both will default to false. - -## Examples - -### Create a new user. - -```js -const { data: user, error } = await supabase.auth.api.createUser({ - email: 'user@email.com', - password: 'password', - user_metadata: { name: 'Yoda' }, -}) -``` - -### Auto-confirm email. - -```js -const { data: user, error } = await supabase.auth.api.createUser({ - email: 'user@email.com', - email_confirm: true, -}) -``` - -### Auto-confirm phone. - -```js -const { data: user, error } = await supabase.auth.api.createUser({ - phone: '1234567890', - phone_confirm: true, -}) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-deleteuser.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-deleteuser.mdx deleted file mode 100644 index 5217ed7d109..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-deleteuser.mdx +++ /dev/null @@ -1,60 +0,0 @@ ---- -id: auth-api-deleteuser -title: 'deleteUser()' -slug: auth-api-deleteuser -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Delete a user. Requires a `service_role` key. - -This function should only be called on a server. Never expose your `service_role` key in the browser. - -```js -const { data: user, error } = await supabase.auth.api.deleteUser( - '715ed5db-f090-4b8c-a067-640ecee36aa0' -) -``` - -## Parameters - -
    - -
  • -

    - - uid - - - required - - - string - -

    -
    - -The user uid you want to remove. - -
    - -
  • - -
- -## Notes - -- Requires a `service_role` key. -- This function should be called on a server. Never expose your `service_role` key in the browser. - -## Examples - -### Remove a user completely. - -```js -const { data: user, error } = await supabase.auth.api.deleteUser( - '715ed5db-f090-4b8c-a067-640ecee36aa0' -) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-generatelink.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-generatelink.mdx deleted file mode 100644 index 290eaebe8de..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-generatelink.mdx +++ /dev/null @@ -1,158 +0,0 @@ ---- -id: auth-api-generatelink -title: 'generateLink()' -slug: auth-api-generatelink -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Generates authentication links to send via email. - -## Parameters - -
    - -
  • -

    - - type - - - required - - - signup | magiclink | recovery | invite | email_change_current | email_change_new - -

    -
    - -The link type ("signup" or "magiclink" or "recovery" or "invite"). - -
    - -
  • - -
  • -

    - - email - - - required - - - string - -

    -
    - -The user's email. - -
    - -
  • - -
  • -

    - - options - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - data - - - optional - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - password - - - optional - - - string - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - redirectTo - - - optional - - - string - -

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- Requires a `service_role` key. -- This function should only be called on a server. Never expose your `service_role` key in the browser. - -## Examples - -### Generate an invite link - -```js -const { data: user, error } = await supabase.auth.api.generateLink( - 'invite', - 'email@example.com' -) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-getuser.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-getuser.mdx deleted file mode 100644 index 053e6326b90..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-getuser.mdx +++ /dev/null @@ -1,59 +0,0 @@ ---- -id: auth-api-getuser -title: 'getUser()' -slug: auth-api-getuser -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Gets the current user details. - -This method is called by the GoTrueClient `update` where -the jwt is set to this.currentSession.access_token -and therefore, acts like getting the currently authenticated user - -```js -const { user, error } = await supabase.auth.api.getUser('ACCESS_TOKEN_JWT') -``` - -## Parameters - -
    - -
  • -

    - - jwt - - - required - - - string - -

    -
    - -A valid, logged-in JWT. Typically, the access_token for the currentSession - -
    - -
  • - -
- -## Notes - -- Fetches the user object from the database instead of local storage. -- Note that user() fetches the user object from local storage which might not be the most updated. -- Requires the user's access_token. - -## Examples - -### Fetch the user object using the access_token jwt. - -```js -const { user, error } = await supabase.auth.api.getUser('ACCESS_TOKEN_JWT') -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-inviteuserbyemail.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-inviteuserbyemail.mdx deleted file mode 100644 index ac02d608f34..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-inviteuserbyemail.mdx +++ /dev/null @@ -1,117 +0,0 @@ ---- -id: auth-api-inviteuserbyemail -title: 'inviteUserByEmail()' -slug: auth-api-inviteuserbyemail -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Sends an invite link to an email address. - -## Parameters - -
    - -
  • -

    - - email - - - required - - - string - -

    -
    - -The email address of the user. - -
    - -
  • - -
  • -

    - - options - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - data - - - optional - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - redirectTo - - - optional - - - string - -

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- Requires a `service_role` key. -- This function should only be called on a server. Never expose your `service_role` key in the browser. - -## Examples - -### Basic example. - -```js -const { data: user, error } = await supabase.auth.api.inviteUserByEmail( - 'email@example.com' -) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-listusers.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-listusers.mdx deleted file mode 100644 index 0b14bd4ba43..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-listusers.mdx +++ /dev/null @@ -1,30 +0,0 @@ ---- -id: auth-api-listusers -title: 'listUsers()' -slug: auth-api-listusers -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Get a list of users. - -This function should only be called on a server. Never expose your `service_role` key in the browser. - -```js -const { data: user, error } = await supabase.auth.api.listUsers() -``` - -## Notes - -- Requires a `service_role` key. -- This function should be called on a server. Never expose your `service_role` key in the browser. - -## Examples - -### Get a full list of users. - -```js -const { data: user, error } = await supabase.auth.api.listUsers() -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-resetpasswordforemail.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-resetpasswordforemail.mdx deleted file mode 100644 index 3f43f15a224..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-resetpasswordforemail.mdx +++ /dev/null @@ -1,160 +0,0 @@ ---- -id: auth-api-resetpasswordforemail -title: 'resetPasswordForEmail()' -slug: auth-api-resetpasswordforemail -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Sends a password reset request to an email address. - -```js -const { data, error } = await supabase.auth.api.resetPasswordForEmail( - 'user@email.com' -) -``` - -## Parameters - -
    - -
  • -

    - - email - - - required - - - string - -

    -
    - -The email address of the user. - -
    - -
  • - -
  • -

    - - options - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - captchaToken - - - optional - - - string - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - redirectTo - - - optional - - - string - -

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -Sends a reset request to an email address. -When the user clicks the reset link in the email they are redirected back to your application. -Prompt the user for a new password and call `auth.update()`: - -```js -const { data, error } = await supabase.auth.update({ - password: new_password, -}) -``` - -## Examples - -### Reset password - -```js -const { data, error } = await supabase.auth.api.resetPasswordForEmail( - 'user@email.com' -) -``` - -### Reset password (React) - -```js -/** - * Step 1: Send the user an email to get a password reset token. - * This email contains a link which sends the user back to your application. - */ -const { data, error } = await supabase.auth.api.resetPasswordForEmail( - 'user@email.com' -) - -/** - * Step 2: Once the user is redirected back to your application, - * ask the user to reset their password. - */ -useEffect(() => { - supabase.auth.onAuthStateChange(async (event, session) => { - if (event == 'PASSWORD_RECOVERY') { - const newPassword = prompt('What would you like your new password to be?') - const { data, error } = await supabase.auth.update({ - password: newPassword, - }) - - if (data) alert('Password updated successfully!') - if (error) alert('There was an error updating your password.') - } - }) -}, []) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-sendmobileotp.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-sendmobileotp.mdx deleted file mode 100644 index 08a1a60903c..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-sendmobileotp.mdx +++ /dev/null @@ -1,115 +0,0 @@ ---- -id: auth-api-sendmobileotp -title: 'sendMobileOTP()' -slug: auth-api-sendmobileotp -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Sends a mobile OTP via SMS. Will register the account if it doesn't already exist - -## Parameters - -
    - -
  • -

    - - phone - - - required - - - string - -

    -
    - -The user's phone number WITH international prefix - -
    - -
  • - -
  • -

    - - options - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - captchaToken - - - optional - - - string - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - shouldCreateUser - - - optional - - - boolean - -

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- Requires a `service_role` key. -- This function should only be called on a server. Never expose your `service_role` key in the browser. - -## Examples - -### Basic example. - -```js -const { data: user, error } = await supabase.auth.api.sendMobileOTP('12345879') -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-updateuserbyid.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-updateuserbyid.mdx deleted file mode 100644 index 46a9489f7e8..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-updateuserbyid.mdx +++ /dev/null @@ -1,127 +0,0 @@ ---- -id: auth-api-updateuserbyid -title: 'updateUserById()' -slug: auth-api-updateuserbyid -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Updates the user data. - -```js -const { data: user, error } = await supabase.auth.api.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { email: 'new@email.com' } -) -``` - -## Parameters - -
    - -
  • -

    - - uid - - - required - - - string - -

    -
    - -No description provided. - -
    - -
  • - -
  • -

    - - attributes - - - required - - - AdminUserAttributes - -

    -
    - -The data you want to update. - -This function should only be called on a server. Never expose your `service_role` key in the browser. - -
    - -
  • - -
- -## Notes - -- Requires a `service_role` key. -- This function should only be called on a server. Never expose your `service_role` key in the browser. - -## Examples - -### Updates a user's email. - -```js -const { data: user, error } = await supabase.auth.api.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { email: 'new@email.com' } -) -``` - -### Updates a user's password. - -```js -const { data: user, error } = await supabase.auth.api.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { password: 'new_password' } -) -``` - -### Updates a user's metadata. - -```js -const { data: user, error } = await supabase.auth.api.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { user_metadata: { hello: 'world' } } -) -``` - -### Updates a user's app_metadata. - -```js -const { data: user, error } = await supabase.auth.api.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { app_metadata: { plan: 'trial' } } -) -``` - -### Confirms a user's email address. - -```js -const { data: user, error } = await supabase.auth.api.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { email_confirm: true } -) -``` - -### Confirms a user's phone number. - -```js -const { data: user, error } = await supabase.auth.api.updateUserById( - '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4', - { phone_confirm: true } -) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-onauthstatechange.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/auth-onauthstatechange.mdx deleted file mode 100644 index e978622e0b8..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-onauthstatechange.mdx +++ /dev/null @@ -1,101 +0,0 @@ ---- -id: auth-onauthstatechange -title: 'onAuthStateChange()' -slug: auth-onauthstatechange -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Receive a notification every time an auth event happens. - -```js -supabase.auth.onAuthStateChange((event, session) => { - console.log(event, session) -}) -``` - -## Parameters - -
    - -
  • -

    - - callback - - - required - - - object - -

    -
    - -No description provided. - -
    - -
  • - -
- -## Examples - -### Listen to auth changes - -```js -supabase.auth.onAuthStateChange((event, session) => { - console.log(event, session) -}) -``` - -### Listen to sign in - -```js -supabase.auth.onAuthStateChange((event, session) => { - if (event == 'SIGNED_IN') console.log('SIGNED_IN', session) -}) -``` - -### Listen to sign out - -```js -supabase.auth.onAuthStateChange((event, session) => { - if (event == 'SIGNED_OUT') console.log('SIGNED_OUT', session) -}) -``` - -### Listen to token refresh - -```js -supabase.auth.onAuthStateChange((event, session) => { - if (event == 'TOKEN_REFRESHED') console.log('TOKEN_REFRESHED', session) -}) -``` - -### Listen to user updates - -```js -supabase.auth.onAuthStateChange((event, session) => { - if (event == 'USER_UPDATED') console.log('USER_UPDATED', session) -}) -``` - -### Listen to user deleted - -```js -supabase.auth.onAuthStateChange((event, session) => { - if (event == 'USER_DELETED') console.log('USER_DELETED', session) -}) -``` - -### Listen to password recovery events - -```js -supabase.auth.onAuthStateChange((event, session) => { - if (event == 'PASSWORD_RECOVERY') console.log('PASSWORD_RECOVERY', session) -}) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-session.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/auth-session.mdx deleted file mode 100644 index 131cd870799..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-session.mdx +++ /dev/null @@ -1,23 +0,0 @@ ---- -id: auth-session -title: 'session()' -slug: auth-session -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Returns the session data, if there is an active session. - -```js -const session = supabase.auth.session() -``` - -## Examples - -### Get the session data - -```js -const session = supabase.auth.session() -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-setauth.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/auth-setauth.mdx deleted file mode 100644 index f6b3a246965..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-setauth.mdx +++ /dev/null @@ -1,110 +0,0 @@ ---- -id: auth-setauth -title: 'setAuth()' -slug: auth-setauth -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Overrides the JWT on the current client. The JWT will then be sent in all subsequent network requests. - -```js -function apiFunction(req, res) { - // Assuming the access token was sent as a header "X-Supabase-Auth" - const { access_token } = req.get('X-Supabase-Auth') - - // You can now use it within a Supabase Client - const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key") - const { user, error } = supabase.auth.setAuth(access_token) - - // This client will now send requests as this user - const { data } = await supabase.from('your_table').select() -} -``` - -## Parameters - -
    - -
  • -

    - - access_token - - - required - - - string - -

    -
    - -a jwt access token - -
    - -
  • - -
- -## Examples - -### Basic example. - -This is most useful on server-side functions where you cannot log the user in, but have access to the user's access token. - -```js -function apiFunction(req, res) { - // Assuming the access token was sent as a header "X-Supabase-Auth" - const { access_token } = req.get('X-Supabase-Auth') - - // You can now use it within a Supabase Client - const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key") - const { user, error } = supabase.auth.setAuth(access_token) - - // This client will now send requests as this user - const { data } = await supabase.from('your_table').select() -} -``` - -### With Express. - -```js -/** - * Make a request from the client to your server function - */ -async function makeApiRequest() { - const token = newClient.session()?.access_token - - await fetch('https://example.com/withAuth', { - method: 'GET', - withCredentials: true, - credentials: 'include', - headers: { - 'Content-Type': 'application/json', - Authorization: bearer, // Your own auth - 'X-Supabase-Auth': token, // Set the Supabase user - }, - }) -} - -/** - * Use the Auth token in your server-side function. - */ -async function apiFunction(req, res) { - const { access_token } = req.get('X-Supabase-Auth') - - // You can now use it within a Supabase Client - const supabase = createClient( - 'https://xyzcompany.supabase.co', - 'public-anon-key' - ) - const { user, error } = supabase.auth.setAuth(access_token) - - // This client will now send requests as this user - const { data } = await supabase.from('your_table').select() -} -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-signin.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/auth-signin.mdx deleted file mode 100644 index c7ff4baf7ff..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-signin.mdx +++ /dev/null @@ -1,275 +0,0 @@ ---- -id: auth-signin -title: 'signIn()' -slug: auth-signin -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Log in an existing user, or login via a third-party provider. - -```js -const { user, session, error } = await supabase.auth.signIn({ - email: 'example@email.com', - password: 'example-password', -}) -``` - -## Parameters - -
    - -
  • -

    - - __namedParameters - - - required - - - UserCredentials - -

    -
    - -No description provided. - -
    - -
  • - -
  • -

    - - options - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - captchaToken - - - optional - - - string - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - queryParams - - - optional - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - redirectTo - - - optional - - - string - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - scopes - - - optional - - - string - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - shouldCreateUser - - - optional - - - boolean - -

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- A user can sign up either via email or OAuth. -- If you provide `email` without a `password`, the user will be sent a magic link. -- The magic link's destination URL is determined by the SITE_URL config variable. To change this, you can go to Authentication -> Settings on [app.supabase.com](https://app.supabase.com) -- Specifying a `provider` will open the browser to the relevant login page. - -## Examples - -### Sign in with email. - -```js -const { user, session, error } = await supabase.auth.signIn({ - email: 'example@email.com', - password: 'example-password', -}) -``` - -### Sign in with magic link. - -If no password is provided, the user will be sent a "magic link" to their email address, which they can click to open your application with a valid session. By default, a given user can only request a Magic Link once every 60 seconds. - -```js -const { user, session, error } = await supabase.auth.signIn({ - email: 'example@email.com', -}) -``` - -### Sign in using third-party providers. - -Supabase supports many different [third-party providers](https://supabase.com/docs/guides/auth#providers). - -```js -const { user, session, error } = await supabase.auth.signIn({ - // provider can be 'github', 'google', 'gitlab', and more - provider: 'github', -}) -``` - -### Sign in with Phone. - -Supabase supports Phone Auth. - -```js -const { user, session, error } = await supabase.auth.signIn({ - phone: '+13334445555', - password: 'some-password', -}) -``` - -### Sign in with redirect. - -Note that the `redirectTo` param is only relevant for OAuth logins, where the login flow is managed by -the Auth server. If you are using email/phone logins you should set up your own redirects (within the email/sms template). - -Sometimes you want to control where the user is redirected to after they are logged in. Supabase supports this for -any URL path on your website (the URL must either be on the same domain as your Site URL [see Auth>Settings in dashboard], or must match one of the Additional Redirect URLs [also in Auth>Settings]). - -```js -const { user, session, error } = await supabase.auth.signIn( - { - provider: 'github', - }, - { - redirectTo: 'https://example.com/welcome', - } -) -``` - -### Sign in with scopes. - -If you need additional data from an OAuth provider, you can include a space-separated list of scopes in your request to get back an OAuth provider token. -You may also need to specify the scopes in the provider's OAuth app settings, depending on the provider. - -```js -const { user, session, error } = await supabase.auth.signIn( - { - provider: 'github', - }, - { - scopes: 'repo gist notifications', - } -) -const oAuthToken = session.provider_token // use to access provider API -``` - -### Sign in using a refresh token (e.g. in React Native). - -If you are completing a sign up or login in a React Native app you can pass the refresh token obtained from the provider to obtain a session. - -```js -// An example using Expo's `AuthSession` -const redirectUri = AuthSession.makeRedirectUri({ useProxy: false }) -const provider = 'google' - -AuthSession.startAsync({ - authUrl: `https://MYSUPABASEAPP.supabase.co/auth/v1/authorize?provider=${provider}&redirect_to=${redirectUri}`, - returnUrl: redirectUri, -}).then(async (response: any) => { - if (!response) return - const { user, session, error } = await supabase.auth.signIn({ - refreshToken: response.params?.refresh_token, - }) -}) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-signout.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/auth-signout.mdx deleted file mode 100644 index 976cf373065..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-signout.mdx +++ /dev/null @@ -1,26 +0,0 @@ ---- -id: auth-signout -title: 'signOut()' -slug: auth-signout -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Inside a browser context, `signOut()` will remove the logged in user from the browser session -and log them out - removing all items from localstorage and then trigger a "SIGNED_OUT" event. - -For server-side management, you can revoke all refresh tokens for a user by passing a user's JWT through to `auth.api.signOut(JWT: string)`. There is no way to revoke a user's session JWT before it automatically expires - -```js -const { error } = await supabase.auth.signOut() -``` - -## Examples - -### Sign out - -```js -const { error } = await supabase.auth.signOut() -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-signup.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/auth-signup.mdx deleted file mode 100644 index 387e018a814..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-signup.mdx +++ /dev/null @@ -1,189 +0,0 @@ ---- -id: auth-signup -title: 'signUp()' -slug: auth-signup -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Creates a new user. - -```js -const { user, session, error } = await supabase.auth.signUp({ - email: 'example@email.com', - password: 'example-password', -}) -``` - -## Parameters - -
    - -
  • -

    - - __namedParameters - - - required - - - UserCredentials - -

    -
    - -No description provided. - -
    - -
  • - -
  • -

    - - options - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - captchaToken - - - optional - - - string - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - data - - - optional - - - object - -

      -
      - -No description provided. - -
      - -
    • - -
    • -

      - - redirectTo - - - optional - - - string - -

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- By default, the user will need to verify their email address before logging in. If you would like to change this, you can disable "Email Confirmations" by going to Authentication -> Settings on [app.supabase.com](https://app.supabase.com) -- If "Email Confirmations" is turned on, a `user` is returned but `session` will be null -- If "Email Confirmations" is turned off, both a `user` and a `session` will be returned -- When the user confirms their email address, they will be redirected to localhost:3000 by default. To change this, you can go to Authentication -> Settings on [app.supabase.com](https://app.supabase.com) -- If signUp() is called for an existing confirmed user: - - If "Enable email confirmations" is enabled on the "Authentication" -> "Settings" page, an obfuscated / fake user object will be returned. - - If "Enable email confirmations" is disabled, an error with a message "User already registered" will be returned. -- To check if a user already exists, refer to getUser(). - -## Examples - -### Sign up. - -```js -const { user, session, error } = await supabase.auth.signUp({ - email: 'example@email.com', - password: 'example-password', -}) -``` - -### Sign up with additional user meta data. - -```js -const { user, session, error } = await supabase.auth.signUp( - { - email: 'example@email.com', - password: 'example-password', - }, - { - data: { - first_name: 'John', - age: 27, - }, - } -) -``` - -### Sign up with third-party providers. - -You can sign up with OAuth providers using the [`signIn()`](/docs/reference/javascript/auth-signin#sign-in-using-third-party-providers) method. - -### Sign up with Phone. - -Supabase supports Phone Auth. After a user has verified their number, they can use the [`signIn()`](/docs/reference/javascript/auth-signin#sign-in-using-phone) method. - -```js -const { user, session, error } = await supabase.auth.signUp({ - phone: '+13334445555', - password: 'some-password', -}) - -// After receiving an SMS with One Time Password. -let { session, error } = await supabase.auth.verifyOTP({ - phone: '+13334445555', - token: '123456', -}) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-update.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/auth-update.mdx deleted file mode 100644 index f330fc9600d..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-update.mdx +++ /dev/null @@ -1,73 +0,0 @@ ---- -id: auth-update -title: 'update()' -slug: auth-update -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Updates user data, if there is a logged in user. - -```js -const { user, error } = await supabase.auth.update({ email: 'new@email.com' }) -``` - -## Parameters - -
    - -
  • -

    - - attributes - - - required - - - UserAttributes - -

    -
    - -No description provided. - -
    - -
  • - -
- -## Notes - -User email: By Default, email updates sends a confirmation link to both the user's current and new email. -To only send a confirmation link to the user's new email, disable **Secure email change** in your project's [email auth provider settings](https://app.supabase.com/project/_/auth/settings). - -User metadata: It's generally better to store user data in a table within your public schema (i.e., `public.users`). -Use the `update()` method if you have data which rarely changes or is specific only to the logged in user. - -## Examples - -### Update the email for an authenticated user - -Sends a "Confirm Email Change" email to the new email address. - -```js -const { user, error } = await supabase.auth.update({ email: 'new@email.com' }) -``` - -### Update the password for an authenticated user - -```js -const { user, error } = await supabase.auth.update({ password: 'new password' }) -``` - -### Update the user's metadata - -```js -const { user, error } = await supabase.auth.update({ - data: { hello: 'world' }, -}) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-user.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/auth-user.mdx deleted file mode 100644 index 242000a148b..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-user.mdx +++ /dev/null @@ -1,29 +0,0 @@ ---- -id: auth-user -title: 'user()' -slug: auth-user -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Inside a browser context, `user()` will return the user data, if there is a logged in user. - -For server-side management, you can get a user through `auth.api.getUserByCookie()` - -```js -const user = supabase.auth.user() -``` - -## Notes - -This method gets the user object from memory. - -## Examples - -### Get the logged in user - -```js -const user = supabase.auth.user() -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/containedby.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/containedby.mdx deleted file mode 100644 index 2c5dcddee2a..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/containedby.mdx +++ /dev/null @@ -1,65 +0,0 @@ ---- -id: containedby -title: '.containedBy()' -slug: containedby -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, main_exports') - .containedBy('main_exports', ['cars', 'food', 'machine']) -``` - -## Notes - -- `.containedBy()` can work on array columns or range columns. - - ```js - .containedBy('arraycol',["a","b"]) // You can use a javascript array for an array column - .containedBy('arraycol','{"a","b"}') // You can use a string with Postgres array {} for array column. - .containedBy('rangecol','(1,2]') // Use Postgres range syntax for range column. - .containedBy('rangecol',`(${arr}]`) // You can insert an array into a string. - ``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, main_exports') - .containedBy('main_exports', ['cars', 'food', 'machine']) -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .containedBy('main_exports', ['orks', 'surveillance', 'evil']) -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('countries') - .delete() - .containedBy('main_exports', ['cars', 'food', 'machine']) -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_countries') - .containedBy('main_exports', ['cars', 'food', 'machine']) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/contains.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/contains.mdx deleted file mode 100644 index f92e086dc69..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/contains.mdx +++ /dev/null @@ -1,66 +0,0 @@ ---- -id: contains -title: '.contains()' -slug: contains -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, main_exports') - .contains('main_exports', ['oil']) -``` - -## Notes - -- `.contains()` can work on array columns or range columns. - It is very useful for finding rows where a tag array contains all the values in the filter array. - - ```js - .contains('arraycol',["a","b"]) // You can use a javascript array for an array column - .contains('arraycol','{"a","b"}') // You can use a string with Postgres array {} for array column. - .contains('rangecol','(1,2]') // Use Postgres range syntax for range column. - .contains('rangecol',`(${arr}]`) // You can insert an array into a string. - ``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, main_exports') - .contains('main_exports', ['oil']) -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .contains('main_exports', ['oil']) -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('countries') - .delete() - .contains('main_exports', ['oil']) -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_countries') - .contains('main_exports', ['oil']) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/delete.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/delete.mdx deleted file mode 100644 index 86e08987590..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/delete.mdx +++ /dev/null @@ -1,109 +0,0 @@ ---- -id: delete -title: 'Delete data: delete()' -slug: delete -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Performs a DELETE on the table. - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .match({ id: 666 }) -``` - -## Parameters - -
    - -
  • -

    - - __namedParameters - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - returning - - - required - - - minimal | representation - -

      -
      - -If `true`, return the deleted row(s) in the response. - -
      - -
    • - -
    • -

      - - count - - - required - - - null | exact | planned | estimated - -

      -
      - -Count algorithm to use to count rows in a table. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- `delete()` should always be combined with [filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to delete. -- If you use `delete()` with filters and you have - [RLS](/docs/learn/auth-deep-dive/auth-row-level-security) enabled, only - rows visible through `SELECT` policies are deleted. Note that by default - no rows are visible, so you need at least one `SELECT`/`ALL` policy that - makes the rows visible. - -## Examples - -### Delete records - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .match({ id: 666 }) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/eq.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/eq.mdx deleted file mode 100644 index f41a2a305b0..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/eq.mdx +++ /dev/null @@ -1,103 +0,0 @@ ---- -id: eq -title: '.eq()' -slug: eq -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` exactly matches the -specified `value`. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'The shire') -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - object - -

    -
    - -The column to filter on. - -
    - -
  • - -
  • -

    - - value - - - required - - - object - -

    -
    - -The value to filter with. - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'The shire') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .eq('name', 'San Francisco') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .eq('name', 'Mordor') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .eq('name', 'San Francisco') -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/filter.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/filter.mdx deleted file mode 100644 index 80437616d9e..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/filter.mdx +++ /dev/null @@ -1,141 +0,0 @@ ---- -id: filter -title: '.filter()' -slug: filter -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose `column` satisfies the filter. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .filter('name', 'in', '("Paris","Tokyo")') -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - object - -

    -
    - -The column to filter on. - -
    - -
  • - -
  • -

    - - operator - - - required - - - FilterOperator - -

    -
    - -The operator to filter with. - -
    - -
  • - -
  • -

    - - value - - - required - - - any - -

    -
    - -The value to filter with. - -
    - -
  • - -
- -## Notes - -- `.filter()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values, so it should only be used as an escape hatch in case other filters don't work. - ```js - .filter('arraycol','cs','{"a","b"}') // Use Postgres array {} for array column and 'cs' for contains. - .filter('rangecol','cs','(1,2]') // Use Postgres range syntax for range column. - .filter('id','in','(6,7)') // Use Postgres list () for in filter. - .filter('id','in',`(${arr})`) // You can insert a javascript array. - ``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .filter('name', 'in', '("Paris","Tokyo")') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .filter('name', 'in', '("Paris","Tokyo")') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .filter('name', 'in', '("Paris","Tokyo")') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .filter('name', 'in', '("Paris","Tokyo")') -``` - -### Filter embedded resources - -```js -const { data, error } = await supabase - .from('cities') - .select('name, countries ( name )') - .filter('countries.name', 'in', '("France","Japan")') -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/generated/.gitkeep b/apps/reference/_supabase_js_versioned_docs/version-v1/generated/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/generating-types.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/generating-types.mdx index a95fef1ec9f..83aa820316b 100644 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/generating-types.mdx +++ b/apps/reference/_supabase_js_versioned_docs/version-v1/generating-types.mdx @@ -1,12 +1,12 @@ --- id: generating-types -title: 'Generating Types' +title: "Generating Types" slug: generating-types -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml +custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1.yml --- -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; Supabase will soon release native type generators that dump your database types for various languages. For now, we support TypeScript [through third-party tools](/docs/guides/api/generating-types). @@ -19,12 +19,12 @@ If you don't provide a type for the row you need to explicitly pass `from(' ```ts type Message = { - id: number - inserted_at: string - message: string - user_id: string - channel_id: number - author: { username: string } + id: number; + inserted_at: string; + message: string; + user_id: string; + channel_id: number; + author: { username: string }; } const response = await supabase @@ -39,4 +39,4 @@ const response = await supabase .select('*, author:user_id(username)') .match({ channel_id: 2 }) response.data // Response data will be of type Array. -``` +``` \ No newline at end of file diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/getsubscriptions.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/getsubscriptions.mdx deleted file mode 100644 index a4c69999390..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/getsubscriptions.mdx +++ /dev/null @@ -1,23 +0,0 @@ ---- -id: getsubscriptions -title: 'getSubscriptions()' -slug: getsubscriptions -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Returns an array of all your subscriptions. - -```js -const subscriptions = supabase.getSubscriptions() -``` - -## Examples - -### Get all subscriptions - -```js -const subscriptions = supabase.getSubscriptions() -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/gt.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/gt.mdx deleted file mode 100644 index c176de4161f..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/gt.mdx +++ /dev/null @@ -1,103 +0,0 @@ ---- -id: gt -title: '.gt()' -slug: gt -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` is greater than the -specified `value`. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .gt('country_id', 250) -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - object - -

    -
    - -The column to filter on. - -
    - -
  • - -
  • -

    - - value - - - required - - - object - -

    -
    - -The value to filter with. - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .gt('country_id', 250) -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .gt('country_id', 250) -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .gt('country_id', 250) -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .gt('country_id', 250) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/gte.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/gte.mdx deleted file mode 100644 index 02a67e876f8..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/gte.mdx +++ /dev/null @@ -1,103 +0,0 @@ ---- -id: gte -title: '.gte()' -slug: gte -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` is greater than or -equal to the specified `value`. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .gte('country_id', 250) -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - object - -

    -
    - -The column to filter on. - -
    - -
  • - -
  • -

    - - value - - - required - - - object - -

    -
    - -The value to filter with. - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .gte('country_id', 250) -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .gte('country_id', 250) -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .gte('country_id', 250) -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .gte('country_id', 250) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/ilike.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/ilike.mdx deleted file mode 100644 index ed9d9b80231..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/ilike.mdx +++ /dev/null @@ -1,103 +0,0 @@ ---- -id: ilike -title: '.ilike()' -slug: ilike -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value in the stated `column` matches the supplied -`pattern` (case insensitive). - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .ilike('name', '%la%') -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - object - -

    -
    - -The column to filter on. - -
    - -
  • - -
  • -

    - - pattern - - - required - - - string - -

    -
    - -The pattern to filter with. - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .ilike('name', '%la%') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .ilike('name', '%la%') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .ilike('name', '%la%') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .ilike('name', '%la%') -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/in.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/in.mdx deleted file mode 100644 index e52122350c9..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/in.mdx +++ /dev/null @@ -1,103 +0,0 @@ ---- -id: in -title: '.in()' -slug: in -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` is found on the -specified `values`. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .in('name', ['Rio de Janeiro', 'San Francisco']) -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - object - -

    -
    - -The column to filter on. - -
    - -
  • - -
  • -

    - - values - - - required - - - object - -

    -
    - -The values to filter with. - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .in('name', ['Rio de Janeiro', 'San Francisco']) -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .in('name', ['Rio de Janeiro', 'San Francisco']) -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .in('name', ['Rio de Janeiro', 'San Francisco']) -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .in('name', ['Rio de Janeiro', 'San Francisco']) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/index.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/index.mdx index 0d0cc97fc5d..b775dbbf9dc 100644 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/index.mdx +++ b/apps/reference/_supabase_js_versioned_docs/version-v1/index.mdx @@ -1,11 +1,12 @@ --- id: index -title: 'Supabase Client' +title: "Supabase Client" slug: supabase-client -custom_edit_url: ../../spec/supabase_js_v1_legacy.yml +custom_edit_url: ../../spec/supabase_js_v1.yml --- -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; -Supabase JavaScript. + +Supabase JavaScript. \ No newline at end of file diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/initializing.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/initializing.mdx index 3051613f499..705503497f6 100644 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/initializing.mdx +++ b/apps/reference/_supabase_js_versioned_docs/version-v1/initializing.mdx @@ -1,20 +1,24 @@ --- id: initializing -title: 'Initializing' +title: "Initializing" slug: initializing -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml +custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1.yml --- -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; You can initialize a new Supabase client using the `createClient()` method. The Supabase client is your entrypoint to the rest of the Supabase functionality and is the easiest way to interact with everything we offer within the Supabase ecosystem. + + + ## Parameters +
  • @@ -37,6 +41,7 @@ The unique Supabase URL which is supplied when you create a new project in your
  • +
  • @@ -57,6 +62,7 @@ The unique Supabase Key which is supplied when you create a new project in your

  • +
  • @@ -71,7 +77,7 @@ The unique Supabase Key which is supplied when you create a new project in your

    -No description provided. +No description provided.
    @@ -79,22 +85,36 @@ No description provided.
+ + + + + + + + + + + + + ## Examples ### createClient() + + ```js import { createClient } from '@supabase/supabase-js' // Create a single supabase client for interacting with your database -const supabase = createClient( - 'https://xyzcompany.supabase.co', - 'public-anon-key' -) +const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key') ``` ### With additional parameters + + ```js import { createClient } from '@supabase/supabase-js' @@ -103,28 +123,22 @@ const options = { headers: { 'x-my-custom-header': 'my-app-name' }, autoRefreshToken: true, persistSession: true, - detectSessionInUrl: true, + detectSessionInUrl: true } -const supabase = createClient( - 'https://xyzcompany.supabase.co', - 'public-anon-key', - options -) +const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key", options) ``` ### API schemas + + ```js import { createClient } from '@supabase/supabase-js' // Provide a custom schema. Defaults to "public". -const supabase = createClient( - 'https://xyzcompany.supabase.co', - 'public-anon-key', - { - schema: 'other_schema', - } -) +const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', { + schema: 'other_schema' +}) ``` By default the API server points to the `public` schema. You can enable other database schemas within the Dashboard. @@ -134,18 +148,16 @@ Note: each client connection can only access a single schema, so the code above ### Custom `fetch` implementation + + ```js import { createClient } from '@supabase/supabase-js' -const supabase = createClient( - 'https://xyzcompany.supabase.co', - 'public-anon-key', - { - fetch: fetch.bind(globalThis), - } -) +const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', { + fetch: fetch.bind(globalThis) +}) ``` `supabase-js` uses the [`cross-fetch`](https://www.npmjs.com/package/cross-fetch) library to make HTTP requests, but an alternative `fetch` implementation can be provided as an option. -This is most useful in environments where `cross-fetch` is not compatible (for instance Cloudflare Workers). +This is most useful in environments where `cross-fetch` is not compatible (for instance Cloudflare Workers). \ No newline at end of file diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/insert.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/insert.mdx deleted file mode 100644 index 9b33b5019f5..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/insert.mdx +++ /dev/null @@ -1,110 +0,0 @@ ---- -id: insert -title: 'Create data: insert()' -slug: insert -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Performs an INSERT into the table. - -```js -const { data, error } = await supabase - .from('cities') - .insert([{ name: 'The Shire', country_id: 554 }]) -``` - -## Parameters - -
    - -
  • -

    - - values - - - required - - - Partial | array - -

    -
    - -The values to insert. - -
    - -
  • - -
  • -

    - - options - - - optional - - - undefined | reflection - -

    -
    - -No description provided. - -
    - -
  • - -
- -## Notes - -- By default, every time you run `insert()`, the client library will make a `select` to return the full record. - This is convenient, but it can also cause problems if your Policies are not configured to allow the `select` operation. - If you are using Row Level Security and you are encountering problems, try setting the `returning` param to `minimal`. - -## Examples - -### Create a record - -```js -const { data, error } = await supabase - .from('cities') - .insert([{ name: 'The Shire', country_id: 554 }]) -``` - -### Bulk create - -When running a bulk create, the operation is handled in a single transaction. If any of the inserts fail, all other operations are -rolled back. - -```js -const { data, error } = await supabase.from('cities').insert([ - { name: 'The Shire', country_id: 554 }, - { name: 'Rohan', country_id: 555 }, -]) -``` - -### Upsert - -For upsert, if set to true, primary key columns would need to be included -in the data parameter in order for an update to properly happen. Also, primary keys -used must be natural, not surrogate. There are however, -[workarounds](https://github.com/PostgREST/postgrest/issues/1118) -for surrogate primary keys. - -```js -const { data, error } = await supabase.from('cities').insert( - [ - { name: 'The Shire', country_id: 554 }, - { name: 'Rohan', country_id: 555 }, - { name: 'City by the Bay', country_id: 840 }, - ], - { upsert: true } -) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/installing.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/installing.mdx index 5fe252d4cb0..5e21a5ba8f4 100644 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/installing.mdx +++ b/apps/reference/_supabase_js_versioned_docs/version-v1/installing.mdx @@ -1,12 +1,12 @@ --- id: installing -title: 'Installing' +title: "Installing" slug: installing -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml +custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1.yml --- -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; All JavaScript libraries are built directly by the Supabase team. @@ -15,13 +15,11 @@ Other languages are built by the community and supported by Supabase. ## JavaScript Via NPM - ```bash npm install @supabase/supabase-js ``` Via Yarn - ```bash yarn add @supabase/supabase-js ``` @@ -29,9 +27,8 @@ yarn add @supabase/supabase-js Find the source code on [GitHub](https://github.com/supabase/supabase-js). Or via CDN - ```js //or -``` +``` \ No newline at end of file diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/invoke.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/invoke.mdx deleted file mode 100644 index 4e58484e479..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/invoke.mdx +++ /dev/null @@ -1,105 +0,0 @@ ---- -id: invoke -title: 'invoke()' -slug: invoke -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Invokes a Supabase Function. - -```js -const { data: user, error } = await supabase.functions.invoke('hello', { - body: JSON.stringify({ foo: 'bar' }), -}) -``` - -## Parameters - -
    - -
  • -

    - - functionName - - - required - - - string - -

    -
    - -the name of the function to invoke - -
    - -
  • - -
  • -

    - - invokeOptions - - - optional - - - FunctionInvokeOptions - -

    -
    - -object with the following properties -`headers`: object representing the headers to send with the request -`body`: the body of the request -`responseType`: how the response should be parsed. The default is `json` - -
    - -
  • - -
- -## Notes - -- Requires an Authorization header. -- Invoke params generally match the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) spec. - -## Examples - -### Basic invocation. - -```js -const { data: user, error } = await supabase.functions.invoke('hello', { - body: JSON.stringify({ foo: 'bar' }), -}) -``` - -### Specifying response type. - -By default, `invoke()` will parse the response as JSON. You can parse the response in the following formats: `json`, `blob`, `text`, and `arrayBuffer`. - -```js -const { data: user, error } = await supabase.functions.invoke('hello', { - responseType: 'text', - body: JSON.stringify({ foo: 'bar' }), -}) -``` - -### Parsing custom headers. - -You can pass custom headers to your function. Note: supabase-js automatically passes the `Authorization` header with the signed in user's JWT. - -```js -const { data: user, error } = await supabase.functions.invoke('hello', { - headers: { - 'my-custom-header': 'my-custom-header-value', - }, - body: JSON.stringify({ foo: 'bar' }), -}) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/is.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/is.mdx deleted file mode 100644 index c84c1df43dd..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/is.mdx +++ /dev/null @@ -1,98 +0,0 @@ ---- -id: is -title: '.is()' -slug: is -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -A check for exact equality (null, true, false), finds all rows whose -value on the stated `column` exactly match the specified `value`. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .is('name', null) -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - object - -

    -
    - -The column to filter on. - -
    - -
  • - -
  • -

    - - value - - - required - - - boolean | null - -

    -
    - -The value to filter with. - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .is('name', null) -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .is('name', null) -``` - -### With `delete()` - -```js -const { data, error } = await supabase.from('cities').delete().is('name', null) -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase.rpc('echo_all_cities').is('name', null) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/like.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/like.mdx deleted file mode 100644 index 4fb5fea0b39..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/like.mdx +++ /dev/null @@ -1,103 +0,0 @@ ---- -id: like -title: '.like()' -slug: like -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value in the stated `column` matches the supplied -`pattern` (case sensitive). - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .like('name', '%la%') -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - object - -

    -
    - -The column to filter on. - -
    - -
  • - -
  • -

    - - pattern - - - required - - - string - -

    -
    - -The pattern to filter with. - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .like('name', '%la%') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .like('name', '%la%') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .like('name', '%la%') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .like('name', '%la%') -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/limit.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/limit.mdx deleted file mode 100644 index 1ae5329fb62..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/limit.mdx +++ /dev/null @@ -1,110 +0,0 @@ ---- -id: limit -title: 'limit()' -slug: limit -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Limits the result with the specified `count`. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .limit(1) -``` - -## Parameters - -
    - -
  • -

    - - count - - - required - - - number - -

    -
    - -The maximum no. of rows to limit to. - -
    - -
  • - -
  • -

    - - __namedParameters - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - foreignTable - - - required - - - undefined | string - -

      -
      - -The foreign table to use (for foreign columns). - -
      - -
    • - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .limit(1) -``` - -### With embedded resources - -```js -const { data, error } = await supabase - .from('countries') - .select('name, cities(name)') - .eq('name', 'United States') - .limit(1, { foreignTable: 'cities' }) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/lt.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/lt.mdx deleted file mode 100644 index f43a76cff4f..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/lt.mdx +++ /dev/null @@ -1,103 +0,0 @@ ---- -id: lt -title: '.lt()' -slug: lt -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` is less than the -specified `value`. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .lt('country_id', 250) -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - object - -

    -
    - -The column to filter on. - -
    - -
  • - -
  • -

    - - value - - - required - - - object - -

    -
    - -The value to filter with. - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .lt('country_id', 250) -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .lt('country_id', 250) -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .lt('country_id', 250) -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .lt('country_id', 250) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/lte.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/lte.mdx deleted file mode 100644 index 766815379b5..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/lte.mdx +++ /dev/null @@ -1,103 +0,0 @@ ---- -id: lte -title: '.lte()' -slug: lte -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` is less than or equal -to the specified `value`. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .lte('country_id', 250) -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - object - -

    -
    - -The column to filter on. - -
    - -
  • - -
  • -

    - - value - - - required - - - object - -

    -
    - -The value to filter with. - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .lte('country_id', 250) -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .lte('country_id', 250) -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .lte('country_id', 250) -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .lte('country_id', 250) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/match.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/match.mdx deleted file mode 100644 index bdbce2c2815..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/match.mdx +++ /dev/null @@ -1,83 +0,0 @@ ---- -id: match -title: '.match()' -slug: match -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose columns match the specified `query` object. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .match({ name: 'Beijing', country_id: 156 }) -``` - -## Parameters - -
    - -
  • -

    - - query - - - required - - - Record - -

    -
    - -The object to filter with, with column names as keys mapped -to their filter values. - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .match({ name: 'Beijing', country_id: 156 }) -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .match({ name: 'Beijing', country_id: 156 }) -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .match({ name: 'Beijing', country_id: 156 }) -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .match({ name: 'Beijing', country_id: 156 }) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/maybesingle.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/maybesingle.mdx deleted file mode 100644 index 3c01ac380e3..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/maybesingle.mdx +++ /dev/null @@ -1,33 +0,0 @@ ---- -id: maybesingle -title: 'maybeSingle()' -slug: maybesingle -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Retrieves at most one row from the result. Result must be at most one row -(e.g. using `eq` on a UNIQUE column), otherwise this will result in an -error. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'Singapore') - .maybeSingle() -``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'Singapore') - .maybeSingle() -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/neq.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/neq.mdx deleted file mode 100644 index d6883f2c401..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/neq.mdx +++ /dev/null @@ -1,103 +0,0 @@ ---- -id: neq -title: '.neq()' -slug: neq -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose value on the stated `column` doesn't match the -specified `value`. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .neq('name', 'The shire') -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - object - -

    -
    - -The column to filter on. - -
    - -
  • - -
  • -

    - - value - - - required - - - object - -

    -
    - -The value to filter with. - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .neq('name', 'The shire') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .neq('name', 'San Francisco') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .neq('name', 'Mordor') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .neq('name', 'Lagos') -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/not.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/not.mdx deleted file mode 100644 index fc4a371f31d..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/not.mdx +++ /dev/null @@ -1,134 +0,0 @@ ---- -id: not -title: '.not()' -slug: not -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows which doesn't satisfy the filter. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .not('name', 'eq', 'Paris') -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - object - -

    -
    - -The column to filter on. - -
    - -
  • - -
  • -

    - - operator - - - required - - - FilterOperator - -

    -
    - -The operator to filter with. - -
    - -
  • - -
  • -

    - - value - - - required - - - any - -

    -
    - -The value to filter with. - -
    - -
  • - -
- -## Notes - -- `.not()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values. - - ```js - .not('name','eq','Paris') - .not('arraycol','cs','{"a","b"}') // Use Postgres array {} for array column and 'cs' for contains. - .not('rangecol','cs','(1,2]') // Use Postgres range syntax for range column. - .not('id','in','(6,7)') // Use Postgres list () for in filter. - .not('id','in',`(${arr})`) // You can insert a javascript array. - ``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .not('name', 'eq', 'Paris') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Mordor' }) - .not('name', 'eq', 'Paris') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('cities') - .delete() - .not('name', 'eq', 'Paris') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_cities') - .not('name', 'eq', 'Paris') -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/or.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/or.mdx deleted file mode 100644 index daae1074551..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/or.mdx +++ /dev/null @@ -1,128 +0,0 @@ ---- -id: or -title: '.or()' -slug: or -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows satisfying at least one of the filters. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .or('id.eq.20,id.eq.30') -``` - -## Parameters - -
    - -
  • -

    - - filters - - - required - - - string - -

    -
    - -The filters to use, separated by commas. - -
    - -
  • - -
  • -

    - - __namedParameters - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - foreignTable - - - required - - - undefined | string - -

      -
      - -The foreign table to use (if `column` is a foreign column). - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- `.or()` expects you to use the raw [PostgREST syntax](https://postgrest.org/en/stable/api.html#horizontal-filtering-rows) for the filter names and values. - - ```js - .or('id.in.(6,7), arraycol.cs.{"a","b"}') // Use Postgres list () for in filter. Array {} for array column and 'cs' for contains. - .or(`id.in.(${arrList}),arraycol.cs.{${arr}}`) // You can insert a javascipt array for list or array on array column. - .or(`id.in.(${arrList}),rangecol.cs.[${arrRange})`) // You can insert a javascipt array for list or range on a range column. - ``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .or('id.eq.20,id.eq.30') -``` - -### Use `or` with `and` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .or('id.gt.20,and(name.eq.New Zealand,name.eq.France)') -``` - -### Use `or` on foreign tables - -```js -const { data, error } = await supabase - .from('countries') - .select('id, cities(*)') - .or('name.eq.Wellington,name.eq.Paris', { foreignTable: 'cities' }) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/order.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/order.mdx deleted file mode 100644 index e8df0a356e4..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/order.mdx +++ /dev/null @@ -1,160 +0,0 @@ ---- -id: order -title: 'order()' -slug: order -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Orders the result with the specified `column`. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .order('id', { ascending: false }) -``` - -## Parameters - -
    - -
  • -

    - - column - - - required - - - object - -

    -
    - -The column to order on. - -
    - -
  • - -
  • -

    - - __namedParameters - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - nullsFirst - - - required - - - boolean - -

      -
      - -If `true`, `null`s appear first. - -
      - -
    • - -
    • -

      - - foreignTable - - - required - - - undefined | string - -

      -
      - -The foreign table to use (if `column` is a foreign column). - -
      - -
    • - -
    • -

      - - ascending - - - required - - - boolean - -

      -
      - -If `true`, the result will be in ascending order. - -
      - -
    • - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .order('id', { ascending: false }) -``` - -### With embedded resources - -```js -const { data, error } = await supabase - .from('countries') - .select('name, cities(name)') - .eq('name', 'United States') - .order('name', { foreignTable: 'cities' }) -``` - -### Ordering multiple columns - -```js -const { data, error } = await supabase - .from('cities') - .select('name', 'country_id') - .order('country_id', { ascending: false }) - .order('name', { ascending: false }) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/overlaps.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/overlaps.mdx deleted file mode 100644 index 4871bab1949..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/overlaps.mdx +++ /dev/null @@ -1,65 +0,0 @@ ---- -id: overlaps -title: '.overlaps()' -slug: overlaps -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, main_exports') - .overlaps('main_exports', ['computers', 'minerals']) -``` - -## Notes - -- `.overlaps()` can work on array columns or range columns. - - ```js - .overlaps('arraycol',["a","b"]) // You can use a javascript array for an array column - .overlaps('arraycol','{"a","b"}') // You can use a string with Postgres array {} for array column. - .overlaps('rangecol','(1,2]') // Use Postgres range syntax for range column. - .overlaps('rangecol',`(${arr}]`) // You can insert an array into a string. - ``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, main_exports') - .overlaps('main_exports', ['computers', 'minerals']) -``` - -### With `update()` - -```js -let countries = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .overlaps('main_exports', ['computers', 'minerals']) -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('countries') - .delete() - .overlaps('main_exports', ['computers', 'minerals']) -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_countries') - .overlaps('main_exports', ['computers', 'minerals']) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/range.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/range.mdx deleted file mode 100644 index 3a86d479740..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/range.mdx +++ /dev/null @@ -1,120 +0,0 @@ ---- -id: range -title: 'range()' -slug: range -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Limits the result to rows within the specified range, inclusive. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .range(0, 3) -``` - -## Parameters - -
    - -
  • -

    - - from - - - required - - - number - -

    -
    - -The starting index from which to limit the result, inclusive. - -
    - -
  • - -
  • -

    - - to - - - required - - - number - -

    -
    - -The last index to which to limit the result, inclusive. - -
    - -
  • - -
  • -

    - - __namedParameters - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - foreignTable - - - required - - - undefined | string - -

      -
      - -The foreign table to use (for foreign columns). - -
      - -
    • - -
    - -
  • - -
- -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .range(0, 3) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/rangeadjacent.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/rangeadjacent.mdx deleted file mode 100644 index 6ae5058e156..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/rangeadjacent.mdx +++ /dev/null @@ -1,54 +0,0 @@ ---- -id: rangeadjacent -title: '.rangeAdjacent()' -slug: rangeadjacent -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeAdjacent('population_range_millions', '[70, 185]') -``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeAdjacent('population_range_millions', '[70, 185]') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .rangeAdjacent('population_range_millions', '[70, 185]') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('countries') - .delete() - .rangeAdjacent('population_range_millions', '[70, 185]') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_countries') - .rangeAdjacent('population_range_millions', '[70, 185]') -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/rangegt.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/rangegt.mdx deleted file mode 100644 index 3ead16ad803..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/rangegt.mdx +++ /dev/null @@ -1,54 +0,0 @@ ---- -id: rangegt -title: '.rangeGt()' -slug: rangegt -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGt('population_range_millions', '[150, 250]') -``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGt('population_range_millions', '[150, 250]') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .rangeGt('population_range_millions', '[150, 250]') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('countries') - .delete() - .rangeGt('population_range_millions', '[150, 250]') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_countries') - .rangeGt('population_range_millions', '[150, 250]') -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/rangegte.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/rangegte.mdx deleted file mode 100644 index 0e87160bc6c..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/rangegte.mdx +++ /dev/null @@ -1,54 +0,0 @@ ---- -id: rangegte -title: '.rangeGte()' -slug: rangegte -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGte('population_range_millions', '[150, 250]') -``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeGte('population_range_millions', '[150, 250]') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .rangeGte('population_range_millions', '[150, 250]') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('countries') - .delete() - .rangeGte('population_range_millions', '[150, 250]') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_countries') - .rangeGte('population_range_millions', '[150, 250]') -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/rangelt.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/rangelt.mdx deleted file mode 100644 index 623b74d1e96..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/rangelt.mdx +++ /dev/null @@ -1,54 +0,0 @@ ---- -id: rangelt -title: '.rangeLt()' -slug: rangelt -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLt('population_range_millions', '[150, 250]') -``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLt('population_range_millions', '[150, 250]') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .rangeLt('population_range_millions', '[150, 250]') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('countries') - .delete() - .rangeLt('population_range_millions', '[150, 250]') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_countries') - .rangeLt('population_range_millions', '[150, 250]') -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/rangelte.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/rangelte.mdx deleted file mode 100644 index 4bf89e9ac7a..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/rangelte.mdx +++ /dev/null @@ -1,54 +0,0 @@ ---- -id: rangelte -title: '.rangeLte()' -slug: rangelte -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLte('population_range_millions', '[150, 250]') -``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, population_range_millions') - .rangeLte('population_range_millions', '[150, 250]') -``` - -### With `update()` - -```js -const { data, error } = await supabase - .from('countries') - .update({ name: 'Mordor' }) - .rangeLte('population_range_millions', '[150, 250]') -``` - -### With `delete()` - -```js -const { data, error } = await supabase - .from('countries') - .delete() - .rangeLte('population_range_millions', '[150, 250]') -``` - -### With `rpc()` - -```js -// Only valid if the Postgres function returns a table type. -const { data, error } = await supabase - .rpc('echo_all_countries') - .rangeLte('population_range_millions', '[150, 250]') -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/removeallsubscriptions.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/removeallsubscriptions.mdx deleted file mode 100644 index b78bc655139..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/removeallsubscriptions.mdx +++ /dev/null @@ -1,28 +0,0 @@ ---- -id: removeallsubscriptions -title: 'removeAllSubscriptions()' -slug: removeallsubscriptions -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Closes and removes all subscriptions and returns a list of removed -subscriptions and their errors. - -```js -supabase.removeAllSubscriptions() -``` - -## Notes - -- Removing subscriptions is a great way to maintain the performance of your project's database. Supabase will automatically handle cleanup 30 seconds after a user is disconnected, but unused subscriptions may cause degradation as more users are simultaneously subscribed. - -## Examples - -### Removes all subscriptions - -```js -supabase.removeAllSubscriptions() -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/removesubscription.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/removesubscription.mdx deleted file mode 100644 index 23a00f9f6df..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/removesubscription.mdx +++ /dev/null @@ -1,53 +0,0 @@ ---- -id: removesubscription -title: 'removeSubscription()' -slug: removesubscription -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Closes and removes a subscription and returns the number of open subscriptions. - -```js -supabase.removeSubscription(mySubscription) -``` - -## Parameters - -
    - -
  • -

    - - subscription - - - required - - - default - -

    -
    - -The subscription you want to close and remove. - -
    - -
  • - -
- -## Notes - -- Removing subscriptions is a great way to maintain the performance of your project's database. Supabase will automatically handle cleanup 30 seconds after a user is disconnected, but unused subscriptions may cause degradation as more users are simultaneously subscribed. - -## Examples - -### Remove a subscription - -```js -supabase.removeSubscription(mySubscription) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/rpc.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/rpc.mdx deleted file mode 100644 index ed042c72dd1..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/rpc.mdx +++ /dev/null @@ -1,187 +0,0 @@ ---- -id: rpc -title: 'Postgres functions: rpc()' -slug: rpc -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -You can call Postgres functions as a "Remote Procedure Call". - -That's a fancy way of saying that you can put some logic into your database then call it from anywhere. -It's especially useful when the logic rarely changes - like password resets and updates. - -```sql -create or replace function hello_world() returns text as $$ - select 'Hello world'; -$$ language sql; -``` - -```js -const { data, error } = await supabase.rpc('hello_world') -``` - -## Parameters - -
    - -
  • -

    - - fn - - - required - - - string - -

    -
    - -The function name to call. - -
    - -
  • - -
  • -

    - - params - - - optional - - - undefined | object - -

    -
    - -The parameters to pass to the function call. - -
    - -
  • - -
  • -

    - - __namedParameters - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - head - - - required - - - boolean - -

      -
      - -When set to true, no data will be returned. - -
      - -
    • - -
    • -

      - - count - - - required - - - null | exact | planned | estimated - -

      -
      - -Count algorithm to use to count rows in a table. - -
      - -
    • - -
    - -
  • - -
- -## Examples - -### Call a Postgres function - -This is an example of invoking a Postgres function with no parameters. - -```js -const { data, error } = await supabase.rpc('hello_world') -``` - -### With Parameters - -```js -const { data, error } = await supabase.rpc('echo_city', { name: 'The Shire' }) -``` - -### Bulk processing - -You can process large payloads at once using [array parameters](https://postgrest.org/en/stable/api.html#calling-functions-with-array-parameters). - -```js -const { data, error } = await postgrest.rpc('echo_cities', { - names: ['The Shire', 'Mordor'], -}) -``` - -### With filters - -Postgres functions that return tables can also be combined with -[Modifiers](/docs/reference/javascript/using-modifiers) and -[Filters](/docs/reference/javascript/using-filters). - -```js -const { data, error } = await supabase - .rpc('echo_all_cities') - .select('name, population') - .eq('name', 'The Shire') -``` - -### With count option - -You can specify a count option to get the row count along with your data. -Allowed values for count option are `null`, `exact`, `planned` and `estimated`. - -```js -const { data, error, count } = await supabase.rpc( - 'hello_world', - {}, - { count: 'exact' } -) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/select.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/select.mdx deleted file mode 100644 index 62395cdab2f..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/select.mdx +++ /dev/null @@ -1,244 +0,0 @@ ---- -id: select -title: 'Fetch data: select()' -slug: select -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Performs vertical filtering with SELECT. - -```js -const { data, error } = await supabase.from('cities').select() -``` - -## Parameters - -
    - -
  • -

    - - columns - - - required - - - string - -

    -
    - -The columns to retrieve, separated by commas. - -
    - -
  • - -
  • -

    - - __namedParameters - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - head - - - required - - - boolean - -

      -
      - -When set to true, select will void data. - -
      - -
    • - -
    • -

      - - count - - - required - - - null | exact | planned | estimated - -

      -
      - -Count algorithm to use to count rows in a table. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- By default, Supabase projects will return a maximum of 1,000 rows. This setting can be changed in Project API Settings. It's recommended that you keep it low to limit the payload size of accidental or malicious requests. You can use `range()` queries to paginate through your data. -- `select()` can be combined with [Modifiers](/docs/reference/javascript/using-modifiers) -- `select()` can be combined with [Filters](/docs/reference/javascript/using-filters) -- If using the Supabase hosted platform `apikey` is technically a reserved keyword, since the API gateway will pluck it out for authentication. [It should be avoided as a column name](https://github.com/supabase/supabase/issues/5465). - -## Examples - -### Getting your data - -```js -const { data, error } = await supabase.from('cities').select() -``` - -### Selecting specific columns - -You can select specific fields from your tables. - -```js -const { data, error } = await supabase.from('cities').select('name') -``` - -### Query foreign tables - -If your database has foreign key relationships, you can query related tables too. - -```js -const { data, error } = await supabase.from('countries').select(` - name, - cities ( - name - ) - `) -``` - -:::note What about join tables -If you're in a situation where your tables are **NOT** directly related, but instead are joined by a _join table_, -you can still use the `select()` method to query the related data. The PostgREST engine detects the relationship automatically. -For more details, [follow the link](https://postgrest.org/en/latest/api.html#embedding-through-join-tables). - -::: - -### Query the same foreign table multiple times - -Sometimes you will need to query the same foreign table twice. -In this case, you can use the name of the joined column to identify -which join you intend to use. For convenience, you can also give an -alias for each column. For example, if we had a shop of products, -and we wanted to get the supplier and the purchaser at the same time -(both in the users) table: - -```js -const { data, error } = await supabase.from('products').select(` - id, - supplier:supplier_id ( name ), - purchaser:purchaser_id ( name ) - `) -``` - -### Filtering with inner joins - -If you want to filter a table based on a child table's values you can use the `!inner()` function. For example, if you wanted -to select all rows in a `message` table which belong to a user with the `username` "Jane": - -```js -const { data, error } = await supabase - .from('messages') - .select('*, users!inner(*)') - .eq('users.username', 'Jane') -``` - -### Querying with count option - -You can get the number of rows by using the count option. -Allowed values for count option are `null`, [exact](https://postgrest.org/en/stable/api.html#exact-count), [planned](https://postgrest.org/en/stable/api.html#planned-count) and [estimated](https://postgrest.org/en/stable/api.html#estimated-count). - -```js -const { data, error, count } = await supabase - .from('cities') - .select('name', { count: 'exact' }) // if you don't want to return any rows, you can use { count: 'exact', head: true } -``` - -### Querying JSON data - -If you have data inside of a JSONB column, you can apply select -and query filters to the data values. Postgres offers a -[number of operators](https://www.postgresql.org/docs/current/functions-json.html) -for querying JSON data. Also see -[PostgREST docs](http://postgrest.org/en/v7.0.0/api.html#json-columns) for more details. - -```js -const { data, error } = await supabase - .from('users') - .select( - ` - id, name, - address->street - ` - ) - .eq('address->postcode', 90210) -``` - -### Return data as CSV - -By default the data is returned in JSON format, however you can also request for it to be returned as Comma Separated Values. - -```js -const { data, error } = await supabase.from('users').select().csv() -``` - -### Aborting requests in-flight - -You can use an [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) to abort requests. Note that `status` and `statusText` doesn't mean anything for aborted requests, since the request wasn't actually fulfilled. - -```js -const ac = new AbortController() -supabase - .from('very_big_table') - .select() - .abortSignal(ac.signal) - .then(console.log) -ac.abort() -// { -// error: { -// message: 'FetchError: The user aborted a request.', -// details: '', -// hint: '', -// code: '' -// }, -// data: null, -// body: null, -// count: null, -// status: 400, -// statusText: 'Bad Request' -// } -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/single.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/single.mdx deleted file mode 100644 index d9599591717..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/single.mdx +++ /dev/null @@ -1,32 +0,0 @@ ---- -id: single -title: 'single()' -slug: single -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Retrieves only one row from the result. Result must be one row (e.g. using -`limit`), otherwise this will result in an error. - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .limit(1) - .single() -``` - -## Examples - -### With `select()` - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .limit(1) - .single() -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-createbucket.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/storage-createbucket.mdx deleted file mode 100644 index 95c1ddd7fb4..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-createbucket.mdx +++ /dev/null @@ -1,104 +0,0 @@ ---- -id: storage-createbucket -title: 'createBucket()' -slug: storage-createbucket -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Creates a new Storage bucket - -```js -const { data, error } = await supabase.storage.createBucket('avatars', { - public: false, -}) -``` - -## Parameters - -
    - -
  • -

    - - id - - - required - - - string - -

    -
    - -A unique identifier for the bucket you are creating. - -
    - -
  • - -
  • -

    - - options - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - public - - - required - - - boolean - -

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- Policy permissions required: - - `buckets` permissions: `insert` - - `objects` permissions: none - -## Examples - -### Create bucket - -```js -const { data, error } = await supabase.storage.createBucket('avatars', { - public: false, -}) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-deletebucket.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/storage-deletebucket.mdx deleted file mode 100644 index 3db6ad86b34..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-deletebucket.mdx +++ /dev/null @@ -1,56 +0,0 @@ ---- -id: storage-deletebucket -title: 'deleteBucket()' -slug: storage-deletebucket -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Deletes an existing bucket. A bucket can't be deleted with existing objects inside it. -You must first `empty()` the bucket. - -```js -const { data, error } = await supabase.storage.deleteBucket('avatars') -``` - -## Parameters - -
    - -
  • -

    - - id - - - required - - - string - -

    -
    - -The unique identifier of the bucket you would like to delete. - -
    - -
  • - -
- -## Notes - -- Policy permissions required: - - `buckets` permissions: `select` and `delete` - - `objects` permissions: none - -## Examples - -### Delete bucket - -```js -const { data, error } = await supabase.storage.deleteBucket('avatars') -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-emptybucket.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/storage-emptybucket.mdx deleted file mode 100644 index 328882c22f9..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-emptybucket.mdx +++ /dev/null @@ -1,55 +0,0 @@ ---- -id: storage-emptybucket -title: 'emptyBucket()' -slug: storage-emptybucket -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Removes all objects inside a single bucket. - -```js -const { data, error } = await supabase.storage.emptyBucket('avatars') -``` - -## Parameters - -
    - -
  • -

    - - id - - - required - - - string - -

    -
    - -The unique identifier of the bucket you would like to empty. - -
    - -
  • - -
- -## Notes - -- Policy permissions required: - - `buckets` permissions: `select` - - `objects` permissions: `select` and `delete` - -## Examples - -### Empty bucket - -```js -const { data, error } = await supabase.storage.emptyBucket('avatars') -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-copy.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-copy.mdx deleted file mode 100644 index ffb320a47da..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-copy.mdx +++ /dev/null @@ -1,79 +0,0 @@ ---- -id: storage-from-copy -title: 'from.copy()' -slug: storage-from-copy -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Copies an existing file. - -```js -const { data, error } = await supabase.storage - .from('avatars') - .copy('public/avatar1.png', 'private/avatar2.png') -``` - -## Parameters - -
    - -
  • -

    - - fromPath - - - required - - - string - -

    -
    - -The original file path, including the current file name. For example `folder/image.png`. - -
    - -
  • - -
  • -

    - - toPath - - - required - - - string - -

    -
    - -The new file path, including the new file name. For example `folder/image-copy.png`. - -
    - -
  • - -
- -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `insert` and `select` - -## Examples - -### Copy file - -```js -const { data, error } = await supabase.storage - .from('avatars') - .copy('public/avatar1.png', 'private/avatar2.png') -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-createsignedurl.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-createsignedurl.mdx deleted file mode 100644 index a3e4b69dc34..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-createsignedurl.mdx +++ /dev/null @@ -1,79 +0,0 @@ ---- -id: storage-from-createsignedurl -title: 'from.createSignedUrl()' -slug: storage-from-createsignedurl -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Create signed URL to download file without requiring permissions. This URL can be valid for a set number of seconds. - -```js -const { signedURL, error } = await supabase.storage - .from('avatars') - .createSignedUrl('folder/avatar1.png', 60) -``` - -## Parameters - -
    - -
  • -

    - - path - - - required - - - string - -

    -
    - -The file path to be downloaded, including the current file name. For example `folder/image.png`. - -
    - -
  • - -
  • -

    - - expiresIn - - - required - - - number - -

    -
    - -The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute. - -
    - -
  • - -
- -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `select` - -## Examples - -### Create Signed URL - -```js -const { signedURL, error } = await supabase.storage - .from('avatars') - .createSignedUrl('folder/avatar1.png', 60) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-createsignedurls.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-createsignedurls.mdx deleted file mode 100644 index 3f03752bce1..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-createsignedurls.mdx +++ /dev/null @@ -1,79 +0,0 @@ ---- -id: storage-from-createsignedurls -title: 'from.createSignedUrls()' -slug: storage-from-createsignedurls -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Create signed URLs to download files without requiring permissions. These URLs can be valid for a set number of seconds. - -```js -const { data, error } = await supabase.storage - .from('avatars') - .createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60) -``` - -## Parameters - -
    - -
  • -

    - - paths - - - required - - - object - -

    -
    - -The file paths to be downloaded, including the current file names. For example `['folder/image.png', 'folder2/image2.png']`. - -
    - -
  • - -
  • -

    - - expiresIn - - - required - - - number - -

    -
    - -The number of seconds until the signed URLs expire. For example, `60` for URLs which are valid for one minute. - -
    - -
  • - -
- -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `select` - -## Examples - -### Create Signed URLs - -```js -const { data, error } = await supabase.storage - .from('avatars') - .createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-download.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-download.mdx deleted file mode 100644 index 7c02120f8bc..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-download.mdx +++ /dev/null @@ -1,59 +0,0 @@ ---- -id: storage-from-download -title: 'from.download()' -slug: storage-from-download -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Downloads a file. - -```js -const { data, error } = await supabase.storage - .from('avatars') - .download('folder/avatar1.png') -``` - -## Parameters - -
    - -
  • -

    - - path - - - required - - - string - -

    -
    - -The file path to be downloaded, including the path and file name. For example `folder/image.png`. - -
    - -
  • - -
- -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `select` - -## Examples - -### Download file - -```js -const { data, error } = await supabase.storage - .from('avatars') - .download('folder/avatar1.png') -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-getpublicurl.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-getpublicurl.mdx deleted file mode 100644 index 918fdcb9ddb..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-getpublicurl.mdx +++ /dev/null @@ -1,60 +0,0 @@ ---- -id: storage-from-getpublicurl -title: 'from.getPublicUrl()' -slug: storage-from-getpublicurl -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Retrieve URLs for assets in public buckets - -```js -const { publicURL, error } = supabase.storage - .from('public-bucket') - .getPublicUrl('folder/avatar1.png') -``` - -## Parameters - -
    - -
  • -

    - - path - - - required - - - string - -

    -
    - -The file path to be downloaded, including the path and file name. For example `folder/image.png`. - -
    - -
  • - -
- -## Notes - -- The bucket needs to be set to public, either via [updateBucket()](/docs/reference/javascript/storage-updatebucket) or by going to Storage on [app.supabase.com](https://app.supabase.com), clicking the overflow menu on a bucket and choosing "Make public" -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: none - -## Examples - -### Returns the URL for an asset in a public bucket - -```js -const { publicURL, error } = supabase.storage - .from('public-bucket') - .getPublicUrl('folder/avatar1.png') -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-list.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-list.mdx deleted file mode 100644 index a9257b5d64e..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-list.mdx +++ /dev/null @@ -1,114 +0,0 @@ ---- -id: storage-from-list -title: 'from.list()' -slug: storage-from-list -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Lists all the files within a bucket. - -```js -const { data, error } = await supabase.storage.from('avatars').list('folder', { - limit: 100, - offset: 0, - sortBy: { column: 'name', order: 'asc' }, -}) -``` - -## Parameters - -
    - -
  • -

    - - path - - - optional - - - undefined | string - -

    -
    - -The folder path. - -
    - -
  • - -
  • -

    - - options - - - optional - - - SearchOptions - -

    -
    - -Search options, including `limit`, `offset`, `sortBy`, and `search`. - -
    - -
  • - -
  • -

    - - parameters - - - optional - - - FetchParameters - -

    -
    - -Fetch parameters, currently only supports `signal`, which is an AbortController's signal - -
    - -
  • - -
- -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `select` - -## Examples - -### List files in a bucket - -```js -const { data, error } = await supabase.storage.from('avatars').list('folder', { - limit: 100, - offset: 0, - sortBy: { column: 'name', order: 'asc' }, -}) -``` - -### Search files in a bucket - -```js -const { data, error } = await supabase.storage.from('avatars').list('folder', { - limit: 100, - offset: 0, - sortBy: { column: 'name', order: 'asc' }, - search: 'jon', -}) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-move.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-move.mdx deleted file mode 100644 index 19bf572a353..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-move.mdx +++ /dev/null @@ -1,79 +0,0 @@ ---- -id: storage-from-move -title: 'from.move()' -slug: storage-from-move -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Moves an existing file. - -```js -const { data, error } = await supabase.storage - .from('avatars') - .move('public/avatar1.png', 'private/avatar2.png') -``` - -## Parameters - -
    - -
  • -

    - - fromPath - - - required - - - string - -

    -
    - -The original file path, including the current file name. For example `folder/image.png`. - -
    - -
  • - -
  • -

    - - toPath - - - required - - - string - -

    -
    - -The new file path, including the new file name. For example `folder/image-new.png`. - -
    - -
  • - -
- -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `update` and `select` - -## Examples - -### Move file - -```js -const { data, error } = await supabase.storage - .from('avatars') - .move('public/avatar1.png', 'private/avatar2.png') -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-remove.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-remove.mdx deleted file mode 100644 index ccaf7b3aad6..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-remove.mdx +++ /dev/null @@ -1,59 +0,0 @@ ---- -id: storage-from-remove -title: 'from.remove()' -slug: storage-from-remove -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Deletes files within the same bucket - -```js -const { data, error } = await supabase.storage - .from('avatars') - .remove(['folder/avatar1.png']) -``` - -## Parameters - -
    - -
  • -

    - - paths - - - required - - - object - -

    -
    - -An array of files to be deleted, including the path and file name. For example [`folder/image.png`]. - -
    - -
  • - -
- -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `delete` and `select` - -## Examples - -### Delete file - -```js -const { data, error } = await supabase.storage - .from('avatars') - .remove(['folder/avatar1.png']) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-update.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-update.mdx deleted file mode 100644 index fb5cea0c821..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-update.mdx +++ /dev/null @@ -1,123 +0,0 @@ ---- -id: storage-from-update -title: 'from.update()' -slug: storage-from-update -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Replaces an existing file at the specified path with a new one. - -```js -const avatarFile = event.target.files[0] -const { data, error } = await supabase.storage - .from('avatars') - .update('public/avatar1.png', avatarFile, { - cacheControl: '3600', - upsert: false, - }) -``` - -## Parameters - -
    - -
  • -

    - - path - - - required - - - string - -

    -
    - -The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload. - -
    - -
  • - -
  • -

    - - fileBody - - - required - - - ArrayBuffer | ArrayBufferView | Blob | Buffer | File | FormData | ReadableStream | ReadableStream | URLSearchParams | string - -

    -
    - -The body of the file to be stored in the bucket. - -
    - -
  • - -
  • -

    - - fileOptions - - - optional - - - FileOptions - -

    -
    - -HTTP headers. -`cacheControl`: string, the `Cache-Control: max-age=` seconds value. -`contentType`: string, the `Content-Type` header value. Should be specified if using a `fileBody` that is neither `Blob` nor `File` nor `FormData`, otherwise will default to `text/plain;charset=UTF-8`. -`upsert`: boolean, whether to perform an upsert. - -
    - -
  • - -
- -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `update` and `select` -- For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Update file using `ArrayBuffer` from base64 file data instead, see example below. - -## Examples - -### Update file - -```js -const avatarFile = event.target.files[0] -const { data, error } = await supabase.storage - .from('avatars') - .update('public/avatar1.png', avatarFile, { - cacheControl: '3600', - upsert: false, - }) -``` - -### Update file using `ArrayBuffer` from base64 file data - -```js -import { decode } from 'base64-arraybuffer' - -const { data, error } = await supabase.storage - .from('avatars') - .update('public/avatar1.png', decode('base64FileData'), { - contentType: 'image/png', - }) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-upload.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-upload.mdx deleted file mode 100644 index a4861490519..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-from-upload.mdx +++ /dev/null @@ -1,123 +0,0 @@ ---- -id: storage-from-upload -title: 'from.upload()' -slug: storage-from-upload -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Uploads a file to an existing bucket. - -```js -const avatarFile = event.target.files[0] -const { data, error } = await supabase.storage - .from('avatars') - .upload('public/avatar1.png', avatarFile, { - cacheControl: '3600', - upsert: false, - }) -``` - -## Parameters - -
    - -
  • -

    - - path - - - required - - - string - -

    -
    - -The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload. - -
    - -
  • - -
  • -

    - - fileBody - - - required - - - ArrayBuffer | ArrayBufferView | Blob | Buffer | File | FormData | ReadableStream | ReadableStream | URLSearchParams | string - -

    -
    - -The body of the file to be stored in the bucket. - -
    - -
  • - -
  • -

    - - fileOptions - - - optional - - - FileOptions - -

    -
    - -HTTP headers. -`cacheControl`: string, the `Cache-Control: max-age=` seconds value. -`contentType`: string, the `Content-Type` header value. Should be specified if using a `fileBody` that is neither `Blob` nor `File` nor `FormData`, otherwise will default to `text/plain;charset=UTF-8`. -`upsert`: boolean, whether to perform an upsert. - -
    - -
  • - -
- -## Notes - -- Policy permissions required: - - `buckets` permissions: none - - `objects` permissions: `insert` -- For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Upload file using `ArrayBuffer` from base64 file data instead, see example below. - -## Examples - -### Upload file - -```js -const avatarFile = event.target.files[0] -const { data, error } = await supabase.storage - .from('avatars') - .upload('public/avatar1.png', avatarFile, { - cacheControl: '3600', - upsert: false, - }) -``` - -### Upload file using `ArrayBuffer` from base64 file data - -```js -import { decode } from 'base64-arraybuffer' - -const { data, error } = await supabase.storage - .from('avatars') - .upload('public/avatar1.png', decode('base64FileData'), { - contentType: 'image/png', - }) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-getbucket.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/storage-getbucket.mdx deleted file mode 100644 index c8df1c3ad4f..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-getbucket.mdx +++ /dev/null @@ -1,55 +0,0 @@ ---- -id: storage-getbucket -title: 'getBucket()' -slug: storage-getbucket -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Retrieves the details of an existing Storage bucket. - -```js -const { data, error } = await supabase.storage.getBucket('avatars') -``` - -## Parameters - -
    - -
  • -

    - - id - - - required - - - string - -

    -
    - -The unique identifier of the bucket you would like to retrieve. - -
    - -
  • - -
- -## Notes - -- Policy permissions required: - - `buckets` permissions: `select` - - `objects` permissions: none - -## Examples - -### Get bucket - -```js -const { data, error } = await supabase.storage.getBucket('avatars') -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-listbuckets.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/storage-listbuckets.mdx deleted file mode 100644 index 866d5834099..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-listbuckets.mdx +++ /dev/null @@ -1,29 +0,0 @@ ---- -id: storage-listbuckets -title: 'listBuckets()' -slug: storage-listbuckets -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Retrieves the details of all Storage buckets within an existing project. - -```js -const { data, error } = await supabase.storage.listBuckets() -``` - -## Notes - -- Policy permissions required: - - `buckets` permissions: `select` - - `objects` permissions: none - -## Examples - -### List buckets - -```js -const { data, error } = await supabase.storage.listBuckets() -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-updatebucket.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/storage-updatebucket.mdx deleted file mode 100644 index c6f28aa3cec..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/storage-updatebucket.mdx +++ /dev/null @@ -1,104 +0,0 @@ ---- -id: storage-updatebucket -title: 'updateBucket()' -slug: storage-updatebucket -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Updates a new Storage bucket - -```js -const { data, error } = await supabase.storage.updateBucket('avatars', { - public: false, -}) -``` - -## Parameters - -
    - -
  • -

    - - id - - - required - - - string - -

    -
    - -A unique identifier for the bucket you are updating. - -
    - -
  • - -
  • -

    - - options - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - public - - - required - - - boolean - -

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- Policy permissions required: - - `buckets` permissions: `update` - - `objects` permissions: none - -## Examples - -### Update bucket - -```js -const { data, error } = await supabase.storage.updateBucket('avatars', { - public: false, -}) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/subscribe.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/subscribe.mdx deleted file mode 100644 index 6f12cb21aad..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/subscribe.mdx +++ /dev/null @@ -1,165 +0,0 @@ ---- -id: subscribe -title: 'on().subscribe()' -slug: subscribe -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Subscribe to realtime changes in your database. - -```js -const mySubscription = supabase - .from('*') - .on('*', (payload) => { - console.log('Change received!', payload) - }) - .subscribe() -``` - -## Parameters - -
    - -
  • -

    - - event - - - required - - - SupabaseEventTypes - -

    -
    - -The database event which you would like to receive updates for, or you can use the special wildcard `*` to listen to all changes. - -
    - -
  • - -
  • -

    - - callback - - - required - - - object - -

    -
    - -A callback that will handle the payload that is sent whenever your database changes. - -
    - -
  • - -
- -## Notes - -- Realtime is disabled by default for new Projects for better database performance and security. You can turn it on by [managing replication](/docs/guides/api#managing-realtime). -- If you want to receive the "previous" data for updates and deletes, you will need to set `REPLICA IDENTITY` to `FULL`, like this: `ALTER TABLE your_table REPLICA IDENTITY FULL;` - -## Examples - -### Listen to all database changes - -```js -const mySubscription = supabase - .from('*') - .on('*', (payload) => { - console.log('Change received!', payload) - }) - .subscribe() -``` - -### Listening to a specific table - -```js -const mySubscription = supabase - .from('countries') - .on('*', (payload) => { - console.log('Change received!', payload) - }) - .subscribe() -``` - -### Listening to inserts - -```js -const mySubscription = supabase - .from('countries') - .on('INSERT', (payload) => { - console.log('Change received!', payload) - }) - .subscribe() -``` - -### Listening to updates - -By default, Supabase will send only the updated record. If you want to receive the previous values as well you can -enable full replication for the table you are listening too: - -```sql -alter table "your_table" replica identity full; -``` - -```js -const mySubscription = supabase - .from('countries') - .on('UPDATE', (payload) => { - console.log('Change received!', payload) - }) - .subscribe() -``` - -### Listening to deletes - -By default, Supabase does not send deleted records. If you want to receive the deleted record you can -enable full replication for the table you are listening too: - -```sql -alter table "your_table" replica identity full; -``` - -```js -const mySubscription = supabase - .from('countries') - .on('DELETE', (payload) => { - console.log('Change received!', payload) - }) - .subscribe() -``` - -### Listening to multiple events - -You can chain listeners if you want to listen to multiple events for each table. - -```js -const mySubscription = supabase - .from('countries') - .on('INSERT', handleRecordInserted) - .on('DELETE', handleRecordDeleted) - .subscribe() -``` - -### Listening to row level changes - -You can listen to individual rows using the format `{table}:{col}=eq.{val}` - where `{col}` is the column name, and `{val}` is the value which you want to match. - -```js -const mySubscription = supabase - .from('countries:id=eq.200') - .on('UPDATE', handleRecordUpdated) - .subscribe() -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/textsearch.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/textsearch.mdx deleted file mode 100644 index 4403d602741..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/textsearch.mdx +++ /dev/null @@ -1,165 +0,0 @@ ---- -id: textsearch -title: '.textSearch()' -slug: textsearch -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Finds all rows whose tsvector value on the stated `column` matches -to_tsquery(`query`). - -## Parameters - -
    - -
  • -

    - - column - - - required - - - object - -

    -
    - -The column to filter on. - -
    - -
  • - -
  • -

    - - query - - - required - - - string - -

    -
    - -The Postgres tsquery string to filter with. - -
    - -
  • - -
  • -

    - - __namedParameters - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - config - - - required - - - undefined | string - -

      -
      - -The text search configuration to use. - -
      - -
    • - -
    - -
  • - -
- -## Examples - -### Text search - -```js -const { data, error } = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', `'fat' & 'cat'`, { - config: 'english', - }) -``` - -### Basic normalization - -Uses PostgreSQL's `plainto_tsquery` function. - -```js -const { data, error } = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', `'fat' & 'cat'`, { - type: 'plain', - config: 'english', - }) -``` - -### Full normalization - -Uses PostgreSQL's `phraseto_tsquery` function. - -```js -const { data, error } = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', `'fat' & 'cat'`, { - type: 'phrase', - config: 'english', - }) -``` - -### Websearch - -Uses PostgreSQL's `websearch_to_tsquery` function. -This function will never raise syntax errors, which makes it possible to use raw user-supplied input for search, and can be used -with advanced operators. - -- `unquoted text`: text not inside quote marks will be converted to terms separated by & operators, as if processed by plainto_tsquery. -- `"quoted text"`: text inside quote marks will be converted to terms separated by <-> operators, as if processed by phraseto_tsquery. -- `OR`: the word “or” will be converted to the | operator. -- `-`: a dash will be converted to the ! operator. - -```js -const { data, error } = await supabase - .from('quotes') - .select('catchphrase') - .textSearch('catchphrase', `'fat or cat'`, { - type: 'websearch', - config: 'english', - }) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/update.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/update.mdx deleted file mode 100644 index d14ce2859ef..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/update.mdx +++ /dev/null @@ -1,145 +0,0 @@ ---- -id: update -title: 'Modify data: update()' -slug: update -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Performs an UPDATE on the table. - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Middle Earth' }) - .match({ name: 'Auckland' }) -``` - -## Parameters - -
    - -
  • -

    - - values - - - required - - - Partial - -

    -
    - -The values to update. - -
    - -
  • - -
  • -

    - - __namedParameters - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - returning - - - required - - - minimal | representation - -

      -
      - -By default the updated record is returned. Set this to 'minimal' if you don't need this value. - -
      - -
    • - -
    • -

      - - count - - - required - - - null | exact | planned | estimated - -

      -
      - -Count algorithm to use to count rows in a table. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- `update()` should always be combined with [Filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to update. - -## Examples - -### Updating your data - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Middle Earth' }) - .match({ name: 'Auckland' }) -``` - -### Updating JSON data - -Postgres offers a -[number of operators](https://www.postgresql.org/docs/current/functions-json.html) -for working with JSON data. Right now it is only possible to update an entire JSON document, -but we are [working on ideas](https://github.com/PostgREST/postgrest/issues/465) for updating individual keys. - -```js -const { data, error } = await supabase - .from('users') - .update( - ` - address: { - street: 'Melrose Place', - postcode: 90210 - } - ` - ) - .eq('address->postcode', 90210) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/upsert.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/upsert.mdx deleted file mode 100644 index 12bf3d0476f..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/upsert.mdx +++ /dev/null @@ -1,200 +0,0 @@ ---- -id: upsert -title: 'Upsert data: upsert()' -slug: upsert -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Performs an UPSERT into the table. - -```js -const { data, error } = await supabase - .from('messages') - .upsert({ id: 3, message: 'foo', username: 'supabot' }) -``` - -## Parameters - -
    - -
  • -

    - - values - - - required - - - Partial | array - -

    -
    - -The values to insert. - -
    - -
  • - -
  • -

    - - __namedParameters - - - required - - - object - -

    -
    - -No description provided. - -
    - -
      -
      Properties
      - -
    • -

      - - returning - - - required - - - minimal | representation - -

      -
      - -By default the new record is returned. Set this to 'minimal' if you don't need this value. - -
      - -
    • - -
    • -

      - - onConflict - - - required - - - undefined | string - -

      -
      - -By specifying the `on_conflict` query parameter, you can make UPSERT work on a column(s) that has a UNIQUE constraint. - -
      - -
    • - -
    • -

      - - ignoreDuplicates - - - required - - - boolean - -

      -
      - -Specifies if duplicate rows should be ignored and not inserted. - -
      - -
    • - -
    • -

      - - count - - - required - - - null | exact | planned | estimated - -

      -
      - -Count algorithm to use to count rows in a table. - -
      - -
    • - -
    - -
  • - -
- -## Notes - -- Primary keys should be included in the data payload in order for an update to work correctly. -- Primary keys must be natural, not surrogate. There are however, [workarounds](https://github.com/PostgREST/postgrest/issues/1118) for surrogate primary keys. -- If you need to insert new data and update existing data at the same time, use [Postgres triggers](https://github.com/supabase/postgrest-js/issues/173#issuecomment-825124550). - -## Examples - -### Upsert your data - -```js -const { data, error } = await supabase - .from('messages') - .upsert({ id: 3, message: 'foo', username: 'supabot' }) -``` - -### Bulk Upsert your data - -```js -const { data, error } = await supabase.from('messages').upsert([ - { id: 3, message: 'foo', username: 'supabot' }, - { id: 4, message: 'bar', username: 'supabot' }, -]) -``` - -### Upserting into tables with constraints - -Running the following will cause supabase to upsert data into the `users` table. -If the username 'supabot' already exists, the `onConflict` argument tells supabase to overwrite that row -based on the column passed into `onConflict`. - -```js -const { data, error } = await supabase - .from('users') - .upsert({ username: 'supabot' }, { onConflict: 'username' }) -``` - -### Return the exact number of rows - -```js -const { data, error, count } = await supabase.from('users').upsert( - { - id: 3, - message: 'foo', - username: 'supabot', - }, - { - count: 'exact', - } -) -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/using-filters.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/using-filters.mdx deleted file mode 100644 index 3bd2617a45f..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/using-filters.mdx +++ /dev/null @@ -1,65 +0,0 @@ ---- -id: using-filters -title: 'Using Filters' -slug: using-filters -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Filters can be used on `select()`, `update()`, and `delete()` queries. - -If a Postgres function returns a table response, you can also apply filters. - -### Applying Filters - -You must apply your filters to the end of your query. For example: - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .eq('name', 'The Shire') // Correct - -const { data, error } = await supabase - .from('cities') - .eq('name', 'The Shire') // Incorrect - .select('name, country_id') -``` - -### Chaining - -Filters can be chained together to produce advanced queries. For example: - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .gte('population', 1000) - .lt('population', 10000) -``` - -### Conditional Chaining - -Filters can be built up one step at a time and then executed. For example: - -```js -const filterByName = null -const filterPopLow = 1000 -const filterPopHigh = 10000 - -let query = supabase.from('cities').select('name, country_id') - -if (filterByName) { - query = query.eq('name', filterByName) -} -if (filterPopLow) { - query = query.gte('population', filterPopLow) -} -if (filterPopHigh) { - query = query.lt('population', filterPopHigh) -} - -const { data, error } = await query -``` diff --git a/apps/reference/_supabase_js_versioned_docs/version-v1/using-modifiers.mdx b/apps/reference/_supabase_js_versioned_docs/version-v1/using-modifiers.mdx deleted file mode 100644 index 1262fbc7c79..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/using-modifiers.mdx +++ /dev/null @@ -1,13 +0,0 @@ ---- -id: using-modifiers -title: 'Using Modifiers' -slug: using-modifiers -custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v1_legacy.yml ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -Modifiers can be used on `select()` queries. - -If a Postgres function returns a table response, you can also apply modifiers to the `rpc()` function. diff --git a/apps/reference/_supabase_js_versioned_sidebars/version-v1-sidebars.json b/apps/reference/_supabase_js_versioned_sidebars/version-v1-sidebars.json index 42b51fd7950..8687644761e 100644 --- a/apps/reference/_supabase_js_versioned_sidebars/version-v1-sidebars.json +++ b/apps/reference/_supabase_js_versioned_sidebars/version-v1-sidebars.json @@ -10,16 +10,16 @@ "type": "category", "label": "Auth", "items": [ - "auth-signup", - "auth-signin", - "auth-signout", - "auth-session", - "auth-user", - "auth-update", - "auth-setauth", - "auth-onauthstatechange", - "auth-api-getuser", - "auth-api-resetpasswordforemail" + "generated/auth-signup", + "generated/auth-signin", + "generated/auth-signout", + "generated/auth-session", + "generated/auth-user", + "generated/auth-update", + "generated/auth-setauth", + "generated/auth-onauthstatechange", + "generated/auth-api-getuser", + "generated/auth-api-resetpasswordforemail" ], "collapsed": true }, @@ -27,36 +27,43 @@ "type": "category", "label": "Auth (Server Only)", "items": [ - "auth-api-listusers", - "auth-api-createuser", - "auth-api-deleteuser", - "auth-api-generatelink", - "auth-api-inviteuserbyemail", - "auth-api-sendmobileotp", - "auth-api-updateuserbyid" + "generated/auth-api-listusers", + "generated/auth-api-createuser", + "generated/auth-api-deleteuser", + "generated/auth-api-generatelink", + "generated/auth-api-inviteuserbyemail", + "generated/auth-api-sendmobileotp", + "generated/auth-api-updateuserbyid" ], "collapsed": true }, { "type": "category", "label": "Functions", - "items": ["invoke"], + "items": ["generated/invoke"], "collapsed": true }, { "type": "category", "label": "Database", - "items": ["select", "insert", "update", "upsert", "delete", "rpc"], + "items": [ + "generated/select", + "generated/insert", + "generated/update", + "generated/upsert", + "generated/delete", + "generated/rpc" + ], "collapsed": true }, { "type": "category", "label": "Realtime", "items": [ - "subscribe", - "removesubscription", - "removeallsubscriptions", - "getsubscriptions" + "generated/subscribe", + "generated/removesubscription", + "generated/removeallsubscriptions", + "generated/getsubscriptions" ], "collapsed": true }, @@ -64,22 +71,22 @@ "type": "category", "label": "Storage", "items": [ - "storage-createbucket", - "storage-getbucket", - "storage-listbuckets", - "storage-updatebucket", - "storage-deletebucket", - "storage-emptybucket", - "storage-from-upload", - "storage-from-download", - "storage-from-list", - "storage-from-update", - "storage-from-move", - "storage-from-copy", - "storage-from-remove", - "storage-from-createsignedurl", - "storage-from-createsignedurls", - "storage-from-getpublicurl" + "generated/storage-createbucket", + "generated/storage-getbucket", + "generated/storage-listbuckets", + "generated/storage-updatebucket", + "generated/storage-deletebucket", + "generated/storage-emptybucket", + "generated/storage-from-upload", + "generated/storage-from-download", + "generated/storage-from-list", + "generated/storage-from-update", + "generated/storage-from-move", + "generated/storage-from-copy", + "generated/storage-from-remove", + "generated/storage-from-createsignedurl", + "generated/storage-from-createsignedurls", + "generated/storage-from-getpublicurl" ], "collapsed": true }, @@ -87,12 +94,12 @@ "type": "category", "label": "Modifiers", "items": [ - "using-modifiers", - "limit", - "order", - "range", - "single", - "maybesingle" + "generated/using-modifiers", + "generated/limit", + "generated/order", + "generated/range", + "generated/single", + "generated/maybesingle" ], "collapsed": true }, @@ -100,30 +107,30 @@ "type": "category", "label": "Filters", "items": [ - "using-filters", - "or", - "not", - "match", - "eq", - "neq", - "gt", - "gte", - "lt", - "lte", - "like", - "ilike", - "is", - "in", - "contains", - "containedby", - "rangelt", - "rangegt", - "rangegte", - "rangelte", - "rangeadjacent", - "overlaps", - "textsearch", - "filter" + "generated/using-filters", + "generated/or", + "generated/not", + "generated/match", + "generated/eq", + "generated/neq", + "generated/gt", + "generated/gte", + "generated/lt", + "generated/lte", + "generated/like", + "generated/ilike", + "generated/is", + "generated/in", + "generated/contains", + "generated/containedby", + "generated/rangelt", + "generated/rangegt", + "generated/rangegte", + "generated/rangelte", + "generated/rangeadjacent", + "generated/overlaps", + "generated/textsearch", + "generated/filter" ], "collapsed": true } diff --git a/apps/reference/docs/architecture.mdx b/apps/reference/docs/architecture.mdx index 9e32fda5401..cbf6530b138 100755 --- a/apps/reference/docs/architecture.mdx +++ b/apps/reference/docs/architecture.mdx @@ -15,3 +15,25 @@ Supabase is not a 1-to-1 mapping of Firebase. While we are building many of the Our technological choices are quite different from Firebase. Everything we use is open source. Wherever possible, we use and support existing tools rather than developing from scratch. Most notably, we use Postgres rather than a NoSQL store. This choice was deliberate. We believe that no other database offers the scalability and functionality required to compete with Firebase. + +## Feature Status + +| Product | Feature | Stage | Docs | +| -------------------------- | ---------------------- | ----- | ------------------------------------------------ | +| Database | Postgres | GA | [Link](/docs/guides/database) | +| Database | Webhooks | Alpha | | +| Database | Point in time Recovery | Alpha | | +| Realtime | Postgres Changes | Beta | [Link](/docs/guides/realtime/postgres-changes) | +| Realtime | Broadcast | Alpha | [Link](/docs/guides/realtime/broadcast) | +| Realtime | Presence | Alpha | [Link](/docs/guides/realtime/presence) | +| Storage | | Beta | [Link](/docs/guides/storage) | +| Storage | CDN | Beta | [Link](/docs/guides/storage-cdn) | +| Edge Functions | | Beta | [Link](/docs/guides/functions) | +| Auth | OAuth Providers | Beta | [Link](/docs/guides/auth/auth-apple) | +| Auth | Passwordless | Beta | [Link](/guides/auth/auth-magic-link) | +| Auth | Next.js Auth Helpers | Alpha | [Link](/docs/guides/auth/auth-helpers/nextjs) | +| Auth | SvelteKit Auth Helpers | Alpha | [Link](/docs/guides/auth/auth-helpers/sveltekit) | +| Public API | | Beta | [Link](/docs/reference/api) | +| CLI | | Beta | [Link](/docs/guides/cli) | +| Client Library: JavaScript | | GA | [Link](/docs/reference/javascript/next/) | +| Client Library: Dart | | Beta | [Link](/docs/reference/dart) | diff --git a/apps/reference/docs/going-into-prod.mdx b/apps/reference/docs/going-into-prod.mdx index 1abefc05cdb..ffa0ca1f879 100644 --- a/apps/reference/docs/going-into-prod.mdx +++ b/apps/reference/docs/going-into-prod.mdx @@ -47,17 +47,6 @@ After developing your project and deciding it's time to Go Live With Real Users, - Nightly backups for Pro tier projects are available on the Supabase dashboard for up to 7 days. - Upgrading to the Supabase Pro Tier will give you access to email support on support@supabase.io -## Platform status - -If Supabase experiences outages, we keep you as informed as possible, as early as possible. We provide the following feedback channels: - -- Status page: [status.supabase.com](https://status.supabase.com/) -- RSS Feed: [status.supabase.com/history.rss](https://status.supabase.com/history.rss) -- Atom Feed: [status.supabase.com/history.atom](https://status.supabase.com/history.atom) -- Slack Alerts: You can receive updates via the RSS feed, using Slack's [built-in RSS functionality](https://slack.com/help/articles/218688467-Add-RSS-feeds-to-Slack)
`/feed subscribe https://status.supabase.com/history.atom` - -Make sure to review our [SLA](/docs/company/sla) for details on our commitment to Platform Stability. - ## Next steps This checklist is always growing so be sure to check back frequently, and also feel free to suggest additions and amendments by making a PR on [GitHub](https://github.com/supabase/supabase). diff --git a/apps/reference/docs/guides/api/generating-types.mdx b/apps/reference/docs/guides/api/generating-types.mdx index 21ce6c15340..7c1ccdb41f8 100644 --- a/apps/reference/docs/guides/api/generating-types.mdx +++ b/apps/reference/docs/guides/api/generating-types.mdx @@ -26,7 +26,7 @@ Important notes: - Since the generator uses JSON API, there is no way to determine if a column is an Array. It will generate array types as `string`, even though Supabase handles this automatically and returns arrays. You can fix this manually in the files by changing the type, e.g. `names: string` -> `names: string[]` -- The types won't automatically stay in sync with your database, so make sure to regenerate your types after your make changes to your database. +- The types won't automatically stay in sync with your database, so make sure to regenerate your types after you make changes to your database. After you have generated your types, you can use them in your TypeScript projects: diff --git a/apps/reference/docs/guides/auth/auth-azure.mdx b/apps/reference/docs/guides/auth/auth-azure.mdx index 4123c627219..0f7984fdaa5 100644 --- a/apps/reference/docs/guides/auth/auth-azure.mdx +++ b/apps/reference/docs/guides/auth/auth-azure.mdx @@ -16,7 +16,7 @@ Azure OAuth consists of four broad steps: - Create an application under Azure Active Directory. - Obtain a `Application (client) ID` with “Sign In with Azure” capabilities. This will be used as the `client id`. - Create a `Secret ID` with “Sign In with Azure” capabilities. The value of the secret will be used as the `client secret`. -- Whitelist the callback url of your application. +- Add the callback url of your application to the allowlist. ## Steps diff --git a/apps/reference/docs/guides/auth/auth-captcha.mdx b/apps/reference/docs/guides/auth/auth-captcha.mdx new file mode 100644 index 00000000000..65837976a17 --- /dev/null +++ b/apps/reference/docs/guides/auth/auth-captcha.mdx @@ -0,0 +1,113 @@ +--- +id: auth-captcha +title: 'Enable Captcha Protection' +description: Add Captcha Protection to your Supabase project +--- + +import Tabs from '@theme/Tabs' +import TabItem from '@theme/TabItem' + +# hCaptcha guide + +Supabase provides you with the option of adding captcha to your sign-in, sign-up, and password reset forms. This keeps your website safe from bots and malicious scripts. Supabase authentication has support for [hCaptcha](https://www.hcaptcha.com/). + +### Sign up for hCaptcha + +Go to the [hCaptcha](https://www.hcaptcha.com/) website and sign up for an account. On the welcome page, copy the **Sitekey** and **Secret key**. + +If you have already signed up and didn't copy this information from the welcome page, you can get the **Secret key** from the settings page. + +![site_secret_settings.png](/img/guides/auth-captcha/site_secret_settings.png) + +The **Sitekey** can be found in the **Settings** of the active site you created. + +![sites_dashboard.png](/img/guides/auth-captcha/sites_dashboard.png) + +In the Settings page, look for the **Sitekey** section and copy the key. + +![sitekey_settings.png](/img/guides/auth-captcha/sitekey_settings.png) + +### Enable hCaptcha protection for your Supabase project + +Navigate to the **[Authentication](https://app.supabase.com/project/_/auth/settings)** page in the Supabase Dashboard and find the **Enable hCaptcha protection** toggle under the **Security and Protection** section. + +![supabase_auth_general_settings.png](/img/guides/auth-captcha/supabase_auth_general_settings.png) + +Enter your hCaptcha **Secret key** and click **Save**. + +### Add the hCaptcha frontend component + +The frontend requires some changes to provide the captcha on-screen for the user. This example uses React and the hCaptcha React component, but hCaptcha can be used with any JavaScript framework. + +Install `@hcaptcha/react-hcaptcha` in your project as a dependency. + +```bash +npm install @hcaptcha/react-hcaptcha +``` + +Now import the `HCaptcha` component from the `@hcaptcha/react-hcaptcha` library. + +```javascript +import HCaptcha from '@hcaptcha/react-hcaptcha' +``` + +Let’s create a empty state to store our `captchaToken` + +```jsx +const [captchaToken, setCaptchaToken] = useState() +``` + +Now lets add the HCaptcha component to the JSX section of our code + +```html + +``` + +We will pass it the sitekey we copied from the hCaptcha website as a property along with a onVerify property which takes a callback function. This callback function will have a token as one of its properties. Let's set the token in the state using `setCaptchaToken` + +```jsx + { setCaptchaToken(token) } +/> +``` + +Now lets use the captcha token we receive in our Supabase signUp function. + +```jsx +await supabase.auth.signUp({ + email, + password, + options: { captchaToken }, +}) +``` + +We will also need to reset the captcha challenge after we have made a call to the function above. + +Create a ref to use on our HCaptcha component. + +```jsx +const captcha = useRef() +``` + +Let's add a ref attribute on the `HCaptcha` component and assign the `captcha` constant to it. + +```jsx + { + setCaptchaToken(token) + }} +/> +``` + +Reset the `captcha` after the signUp function is called using the following code: + +```jsx +captcha.current.resetCaptcha() +``` + +In order to test that this works locally we will need to use something like [ngrok](https://ngrok.com/) or add an entry to your hosts file. You can read more about this in the [hCaptcha docs](https://docs.hcaptcha.com/#local-development). + +Run the application and you should now be provided with a captcha challenge. diff --git a/apps/reference/docs/guides/auth/auth-helpers/nextjs.mdx b/apps/reference/docs/guides/auth/auth-helpers/nextjs.mdx index 2215dfa8db1..193a970ebe9 100644 --- a/apps/reference/docs/guides/auth/auth-helpers/nextjs.mdx +++ b/apps/reference/docs/guides/auth/auth-helpers/nextjs.mdx @@ -312,3 +312,8 @@ This is a step by step guide on migrating away from the `@supabase/supabase-auth 4. Replace all instances of `withAuthRequired` in any of your NextJS pages with `withPageAuth`. 5. Replace all instances of `withAuthRequired` in any of your NextJS API endpoints with `withApiAuth`. 6. Uninstall `@supabase/supabase-auth-helpers`. + +## Additional Links + +- [Auth Helpers Source code](https://github.com/supabase/auth-helpers) +- [Next.js example](https://github.com/supabase/auth-helpers/tree/main/examples/nextjs) diff --git a/apps/reference/docs/guides/auth/auth-helpers/sveltekit.mdx b/apps/reference/docs/guides/auth/auth-helpers/sveltekit.mdx index 62127c83747..4d7d1f3d317 100644 --- a/apps/reference/docs/guides/auth/auth-helpers/sveltekit.mdx +++ b/apps/reference/docs/guides/auth/auth-helpers/sveltekit.mdx @@ -5,31 +5,39 @@ description: Convenience helpers for implementing user authentication in SvelteK sidebar_label: SvelteKit --- +import Tabs from '@theme/Tabs' +import TabItem from '@theme/TabItem' + This submodule provides convenience helpers for implementing user authentication in [SvelteKit](https://kit.svelte.dev/) applications. ## Installation -Using [npm](https://npmjs.org): +This library supports Node.js `^16.15.0`. + + + + ```sh npm install @supabase/auth-helpers-sveltekit - -# Main component for Svelte based frameworks (optional but recommended) -npm install @supabase/auth-helpers-svelte ``` -Using [yarn](https://yarnpkg.com/): + + + ```sh yarn add @supabase/auth-helpers-sveltekit - -# Main component for Svelte based frameworks (optional but recommended) -yarn add @supabase/auth-helpers-svelte ``` -This library supports the following tooling versions: - -- Node.js: `^16.15.0` + + ## Getting Started @@ -39,34 +47,488 @@ Set up the fillowing env vars. For local development you can set them in a `.env ```bash # Find these in your Supabase project settings > API -VITE_SUPABASE_URL=https://your-project.supabase.co -VITE_SUPABASE_ANON_KEY=your-anon-key +PUBLIC_SUPABASE_URL=https://your-project.supabase.co +PUBLIC_SUPABASE_ANON_KEY=your-anon-key ``` -### SupabaseClient and SupaAuthHelper component setup +### Set up the Supabase client -We will start off by creating a `db.ts` file inside of our `src/lib` directory. Now lets instantiate our `supabaseClient` by using our `createSupabaseClient` function from the `@supabase/auth-helpers-sveltekit` library. +Start off by creating a `db.ts` file inside of the `src/lib` directory and instantiate the `supabaseClient`. + +```ts title="src/lib/db.ts" +import { createClient } from '@supabase/supabase-js'; +import { setupSupabaseHelpers } from '@supabase/auth-helpers-sveltekit'; +import { dev } from '$app/environment'; +import { env } from '$env/dynamic/public'; +// or use the static env +// import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public'; + +export const supabaseClient = createClient(env.PUBLIC_SUPABASE_URL, env.PUBLIC_SUPABASE_ANON_KEY, { + persistSession: false, + autoRefreshToken: false +}); + +setupSupabaseHelpers({ + supabaseClient, + cookieOptions: { + secure: !dev + } +}); +``` + +### Initialize the client + +Edit your `+layout.svelte` file and set up the client-side. + +```html title="src/routes/+layout.svelte" + + + +``` + +### Set up hooks + +The `hooks.ts` file is where the heavy lifting of this library happens: + +```ts title="src/hooks.server.ts" +// make sure the supabase instance is initialized on the server +import '$lib/db'; +import { dev } from '$app/environment'; +import { auth } from '@supabase/auth-helpers-sveltekit/server'; + +export const handle = auth(); + +// use the sequence helper if you have additional Handle methods +import { sequence } from '@sveltejs/kit/hooks'; + +export const handle = sequence(auth(), yourHandler); +``` + +There are three handle methods available: + +- `callback()`: + This creates a handler for `/api/auth/callback`. The `client` forwards the session details here every time `onAuthStateChange` fires on the client-side. This is needed to set up the cookies for your application so that SSR works seamlessly. +- `session()`: + This parses the session from the cookie and populate it in locals +- `auth()`: + a shorthand for `sequence(callback(), session())` that uses both handlers + +### Send session to client + +In order to make the session available to the UI (e.g., pages and layouts), pass the session in the root layout load function: + +```ts title="src/routes/+layout.server.ts" +import type { LayoutServerLoad } from './$types'; + +export const load: LayoutServerLoad = async ({ locals }) => { + return { + session: locals.session + }; +}; +``` + +### Typings + +In order to get the most out of TypeScript and IntelliSense, import the types into the `app.d.ts` type definition file that comes with your SvelteKit project. + +```ts title="src/app.d.ts" +/// + +// See https://kit.svelte.dev/docs/types#app +// for information about these interfaces +// and what to do when importing types +declare namespace App { + interface Locals { + session: import('@supabase/auth-helpers-sveltekit').SupabaseSession; + } + interface PageData { + session: import('@supabase/auth-helpers-sveltekit').SupabaseSession; + } + // interface Error {} + // interface Platform {} +} +``` + +### Signing out + +This library has provided a method to delete the session cookie. + +Create a server only page with an action to delete the cookie + +```ts title="src/routes/logout/+page.server.ts" +import { deleteSession } from '@supabase/auth-helpers-sveltekit/server'; +import { redirect } from '@sveltejs/kit'; +import type { Actions } from './$types'; + +export const actions: Actions = { + async default({ cookies }) { + deleteSession(cookies); + throw redirect(303, '/'); + } +}; +``` +Then make a **POST** request with a form to the server only page above. + +```html + + +
+ +
+``` + +### Basic setup + +You can now determine if a user is authenticated on the client-side by checking that the `user` object in `$page.data.session` is defined. + +```html title="src/routes/+page.svelte" + + +{#if !$page.data.session.user} +

I am not logged in

+{:else} +

Welcome {$page.data.session.user.email}

+

I am logged in!

+{/if} +``` + +## Client-side data fetching with RLS + +For [row level security](https://supabase.com/docs/learn/auth-deep-dive/auth-row-level-security) to work properly when fetching data client-side, you need to make sure to import the `{ supabaseClient }` from `$lib/db` and only run your query once the user is defined client-side in `$page.data.session`: + +```html + + +{#if $page.data.session.user} +

client-side data fetching with RLS

+
{JSON.stringify(loadedData, null, 2)}
+{/if} +``` + +## Server-side data fetching with RLS + +```html title="src/routes/profile/+page.svelte" + + +
Protected content for {user.email}
+
{JSON.stringify(tableData, null, 2)}
+
{JSON.stringify(user, null, 2)}
+``` + +For [row level security](https://supabase.com/docs/learn/auth-deep-dive/auth-row-level-security) to work in a server environment, you need to use the `withAuth` helper to check if the user is authenticated. The helper extends the event with `session` and `getSupabaseClient()`: + +```ts title="src/routes/profile/+page.ts" +import type { PageLoad } from './$types'; +import { withAuth } from '@supabase/auth-helpers-sveltekit'; +import { redirect } from '@sveltejs/kit'; + +interface TestTable { + id: string; + created_at: string; +} + +export const load: PageLoad = withAuth(async ({ getSupabaseClient, session }) => { + if (!session.user) { + throw redirect(303, '/'); + } + const { data: tableData } = await getSupabaseClient() + .from('test') + .select('*'); + + return { + user: session.user, + tableData + }; +); +``` + +**Caution:** + +Always use the instance returned by `getSupabaseClient()` directly! ```ts -// src/lib/db.ts -import { createSupabaseClient } from '@supabase/auth-helpers-sveltekit' +// Bad +const supabaseClient = getSupabaseClient(); + +await supabaseClient.from('table1').select(); +await supabaseClient.from('table2').select(); + +// Good +await getSupabaseClient().from('table1').select(); +await getSupabaseClient().from('table2').select(); +``` + +## Protecting API routes + +Wrap an API Route to check that the user has a valid session. If they're not logged in the session is `null`. + +```ts title="src/routes/api/protected-route/+server.ts" +import type { RequestHandler } from './$types'; +import { withAuth } from '@supabase/auth-helpers-sveltekit'; +import { json, redirect } from '@sveltejs/kit'; + +interface TestTable { + id: string; + created_at: string; +} + +export const GET: RequestHandler = withAuth(async ({ session, getSupabaseClient }) => { + if (!session.user) { + throw redirect(303, '/'); + } + const { data } = await getSupabaseClient() + .from('test') + .select('*'); + + return json({ data }); +); +``` + +If you visit `/api/protected-route` without a valid session cookie, you will get a 303 response. + +## Protecting Actions + +Wrap an Action to check that the user has a valid session. If they're not logged in, the session is `null`. + +```ts title="src/routes/posts/+page.server.ts" +import type { Actions } from './$types'; +import { withAuth } from '@supabase/auth-helpers-sveltekit'; +import { error, invalid } from '@sveltejs/kit'; + +export const actions: Actions = { + createPost: withAuth(async ({ session, getSupabaseClient, request }) => { + if (!session.user) { + // the user is not signed in + throw error(403, { message: 'Unauthorized' }); + } + // we are save, let the user create the post + const formData = await request.formData(); + const content = formData.get('content'); + + const { error: createPostError, data: newPost } = await getSupabaseClient() + .from('posts') + .insert({ content }); + + if (createPostError) { + return invalid(500, { + supabaseErrorMessage: createPostError.message + }); + } + return { + newPost + }; + }) +}; +``` + +If you try to submit a form with the action `?/createPost` without a valid session cookie, you will get a 403 error response. + +## Saving and deleting the session + +Use `saveSession` to save the session cookies: + +```ts +import type { Actions } from './$types'; +import { supabaseClient } from '$lib/db'; +import { invalid, redirect } from '@sveltejs/kit'; +import { saveSession } from '@supabase/auth-helpers-sveltekit/server'; + +export const actions: Actions = { + async signin({ request, cookies, url }) { + const formData = await request.formData(); + + const email = formData.get('email') as string; + const password = formData.get('password') as string; + + const { data, error } = await supabaseClient.auth.api.signInWithEmail( + email, + password, + { + redirectTo: `${url.origin}/logging-in` + } + ); + + if (error || !data) { + if (error?.status === 400) { + return invalid(400, { + error: 'Invalid credentials', + values: { + email + } + }); + } + return invalid(500, { + error: 'Server error. Try again later.', + values: { + email + } + }); + } + + saveSession(cookies, data); + throw redirect(303, '/dashboard'); + } +}; +``` + +Use `deleteSession` to delete the session cookies: + +```ts +import type { Actions } from './$types'; +import { deleteSession } from '@supabase/auth-helpers-sveltekit/server'; +import { redirect } from '@sveltejs/kit'; + +export const actions: Actions = { + async logout({ cookies }) { + deleteSession(cookies); + throw redirect(303, '/'); + } +}; +``` + +## Custom session namespace + +If you want to use something other than `locals.session` and `$page.data.session`, update the types and create three helper functions: + +```ts title="src/app.d.ts" +declare namespace App { + interface Locals { + mySupabaseSession: import('@supabase/auth-helpers-sveltekit').SupabaseSession; + } + interface PageData { + mySupabaseSession: import('@supabase/auth-helpers-sveltekit').SupabaseSession; + } +} +``` + +```ts title="src/hooks.server.ts" +setupSupabaseServer({ + supabaseClient, + cookieOptions: { + secure: !dev + }, + // --- change location within locals --- + getSessionFromLocals: (locals) => locals.mySupabaseSession, + setSessionToLocals: (locals, session) => (locals.mySupabaseSession = session) +}); +``` + +```ts title="src/lib/db.ts" +setupSupabaseClient({ + supabaseClient, + // --- change location within pageData --- + getSessionFromPageData: (data) => data.mySupabaseSession +}); +``` + +## Migrate from 0.6.11 and below to 0.7.0 {#migration} + +There are numerous breaking changes in the latest 0.7.0 version of this library. + +### Environment variable prefix + +The environment variable prefix is now `PUBLIC_` instead of `VITE_` (e.g., `VITE_SUPABASE_URL` is now `PUBLIC_SUPABASE_URL`). + +### Set up the Supabase client {#migration-set-up-supabase-client} + + + + + +```js title="src/lib/db.ts" +import { createSupabaseClient } from '@supabase/auth-helpers-sveltekit'; const { supabaseClient } = createSupabaseClient( import.meta.env.VITE_SUPABASE_URL as string, import.meta.env.VITE_SUPABASE_ANON_KEY as string -) +); -export { supabaseClient } +export { supabaseClient }; ``` -Edit your `__layout.svelte` file and add import the `SupaAuthHelper` component, the `supabaseClient` we just instantiated and the `session` store. + -```html -// src/routes/__layout.svelte + + +```js title="src/lib/db.ts" +import { createClient } from '@supabase/supabase-js'; +import { setupSupabaseHelpers } from '@supabase/auth-helpers-sveltekit'; +import { dev } from '$app/environment'; +import { env } from '$env/dynamic/public'; +// or use the static env + +// import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from '$env/static/public'; + +export const supabaseClient = createClient(env.PUBLIC_SUPABASE_URL, env.PUBLIC_SUPABASE_ANON_KEY, { + persistSession: false, + autoRefreshToken: false +}); + +setupSupabaseHelpers({ + supabaseClient, + cookieOptions: { + secure: !dev + } +}); +``` + + + + +### Initialize the client {#migration-initialize-client} + + + + + +```html title="src/routes/__layout.svelte" @@ -74,229 +536,340 @@ Edit your `__layout.svelte` file and add import the `SupaAuthHelper` component, ``` -### Hooks setup + -Our `hooks.ts` file is where the heavy lifting of this library happens, we need to import our function to handle the sign in, signing out and cookie creation phase. we can import all the hooks using `handleAuth` function and destructure its returned data. + -```ts -// src/hooks.ts -import { handleAuth } from '@supabase/auth-helpers-sveltekit' -import type { GetSession, Handle } from '@sveltejs/kit' -import { sequence } from '@sveltejs/kit/hooks' +The `@supabase/auth-helpers-svelte` library is no longer required as the `@supabase/auth-helpers-sveltekit` library handles all the client-side code. -export const handle: Handle = sequence(...handleAuth()) +```html title="src/routes/+layout.svelte" + + + +``` + + + + +### Set up hooks {#migration-set-up-hooks} + + + + + +```ts title="src/hooks.ts" +import { handleAuth } from '@supabase/auth-helpers-sveltekit'; +import type { GetSession, Handle } from '@sveltejs/kit'; +import { sequence } from '@sveltejs/kit/hooks'; + +export const handle: Handle = sequence(...handleAuth()); export const getSession: GetSession = async (event) => { - const { user, accessToken, error } = event.locals - return { - user, - accessToken, - error, + const { user, accessToken, error } = event.locals; + return { + user, + accessToken, + error } } ``` -These will create the handlers under the hood that perform different parts of the authentication flow: + -- `/api/auth/callback`: The `UserHelper` forwards the session details here every time `onAuthStateChange` fires on the client side. This is needed to set up the cookies for your application so that SSR works seamlessly. -- `/api/auth/user`: You can fetch user profile information in JSON format. -- `/api/auth/logout`: You can logout the user. + -### Typings +```ts title="src/hooks.server.ts" +// make sure the supabase instance is initialized on the server +import '$lib/db'; +import { dev } from '$app/environment'; +import { auth } from '@supabase/auth-helpers-sveltekit/server'; -In order to get the most out of TypeScript and its intellisense, you should import our types into the `app.d.ts` type definition file that comes with your SvelteKit project. +export const handle = auth(); +``` -```ts -// src/app.d.ts +**Optional** *if using additional handle methods* + +```ts title="src/hooks.server.ts" +// make sure the supabase instance is initialized on the server +import '$lib/db'; +import { dev } from '$app/environment'; +import { auth } from '@supabase/auth-helpers-sveltekit/server'; +import { sequence } from '@sveltejs/kit/hooks'; + +export const handle = sequence(auth(), yourHandler); +``` + + + + +### Typings {#migration-typings} + + + + + +```ts title="src/app.d.ts" /// // See https://kit.svelte.dev/docs/types#app // for information about these interfaces declare namespace App { interface UserSession { - user: import('@supabase/supabase-js').User - accessToken?: string + user: import('@supabase/supabase-js').User; + accessToken?: string; } + interface Locals extends UserSession { - error: import('@supabase/supabase-js').ApiError + error: import('@supabase/supabase-js').ApiError; } - interface Session extends UserSession {} // interface Platform {} // interface Stuff {} + interface Session extends UserSession {} + + // interface Platform {} + // interface Stuff {} } ``` -### Signing out + -This library has provided a dedicated endpoint for you to use to sign a user out. This endpoint will sign the user out of the Gotrue server, clear the cookies that were set when the user logged in and redirect the user to a configurable path. + -The logout handler endpoint is `/api/auth/logout`, this will take a `GET` request which means it can be used as the href for a normal `a` tag in your html. +```ts title="src/app.d.ts" +/// -```html -Sign out +// See https://kit.svelte.dev/docs/types#app +// for information about these interfaces +// and what to do when importing types +declare namespace App { + interface Locals { + session: import('@supabase/auth-helpers-sveltekit').SupabaseSession; + } + + interface PageData { + session: import('@supabase/auth-helpers-sveltekit').SupabaseSession; + } + + // interface Error {} + // interface Platform {} +} ``` -### Logout handler configuration + + -In your `src/hooks.ts` file the logout handler is already setup and you can configure the redirect path from here. +### Check the user on the client -> By default the redirect path after logging out will be `/`. + -```ts -export const handle = sequence( - ...handleAuth({ - logout: { returnTo: '/auth/signin' }, - }) -) -``` + -### Basic Setup - -You can now determine if a user is authenticated on the client-side by checking that the `user` object returned by the `$session` store is defined. - -```html -// example +```html title="src/routes/index.svelte" {#if !$session.user} -

I am not logged in

+

I am not logged in

{:else} -

Welcome {$session.user.email}

-

I am logged in!

+

Welcome {$session.user.email}

+

I am logged in!

{/if} ``` -## Client-side data fetching with RLS +
-For [row level security](https://supabase.com/docs/learn/auth-deep-dive/auth-row-level-security) to work properly when fetching data client-side, you need to make sure to import the `{ supabaseClient }` from `@supabase/auth-helpers-sveltekit` and only run your query once the user is defined client-side in the `$session`: + -```html +```html title="src/routes/+page.svelte" -{#if !$session.user} - {#if $error} -

{$error.message}

- {/if} -

{$isLoading ? `Loading...` : `Loaded!`}

- +{#if !$page.data.session.user} +

I am not logged in

{:else} - Sign out -

user:

-
{JSON.stringify($session.user, null, 2)}
-

client-side data fetching with RLS

-
{JSON.stringify(loadedData, null, 2)}
+

Welcome {$page.data.session.user.email}

+

I am logged in!

{/if} ``` -### Server-side data fetching with RLS +
+
-For [row level security](https://supabase.com/docs/learn/auth-deep-dive/auth-row-level-security) to work in a server environment, you need to inject the request context into the supabase client: +### withPageAuth + + + + + +```html title="src/routes/protected-route.svelte" + -```html -
Protected content for {user.email}
+

server-side fetched data with RLS:

{JSON.stringify(data, null, 2)}
+

user:

{JSON.stringify(user, null, 2)}
``` -```ts -// src/routes/profile.ts -import { - supabaseServerClient, - withApiAuth, -} from '@supabase/auth-helpers-sveltekit' -import type { RequestHandler } from './__types/profile' +
-interface TestTable { - id: string - created_at: string -} + -interface GetOutput { - user: User - data: TestTable[] -} +```html title="src/routes/protected-route/+page.svelte" + - return { - body: { - user: locals.user, - data, - }, - } - } - ) + +
Protected content for {user.email}
+

server-side fetched data with RLS:

+
{JSON.stringify(tableData, null, 2)}
+

user:

+
{JSON.stringify(user, null, 2)}
``` -## Protecting API routes +```ts title="src/routes/protected-route/+page.ts" +import { withAuth } from '@supabase/auth-helpers-sveltekit'; +import { redirect } from '@sveltejs/kit'; +import type { PageLoad } from './$types'; -Wrap an API Route to check that the user has a valid session. If they're not logged in the handler will return a -303 and redirect header. +export const load: PageLoad = withAuth(async ({ session, getSupabaseClient }) => { + if (!session.user) { + throw redirect(303, '/'); + } -```ts -// src/routes/api/protected-route.ts -import { - supabaseServerClient, - withApiAuth, -} from '@supabase/auth-helpers-sveltekit' -import type { RequestHandler } from './__types/protected-route' + const { data: tableData } = await getSupabaseClient().from('test').select('*'); + return { tableData, user: session.user }; +}); +``` + +
+
+ +### withApiAuth + + + + + +```ts title="src/routes/api/protected-route.ts" +import { supabaseServerClient, withApiAuth } from "@supabase/auth-helpers-sveltekit"; +import type { RequestHandler } from "./__types/protected-route"; interface TestTable { - id: string - created_at: string + id: string; + created_at: string; } interface GetOutput { - data: TestTable[] + data: TestTable[]; } export const GET: RequestHandler = async ({ locals, request }) => withApiAuth({ user: locals.user }, async () => { // Run queries with RLS on the server - const { data } = await supabaseServerClient(request) - .from('test') - .select('*') + const { data } = await supabaseServerClient(request).from("test").select("*"); return { status: 200, - body: { data }, - } - }) + body: { data } + }; + }); ``` -If you visit `/api/protected-route` without a valid session cookie, you will get a 303 response. + + + + +```ts title="src/routes/api/protected-route/+server.ts" +import type { RequestHandler } from './$types'; +import { withAuth } from '@supabase/auth-helpers-sveltekit'; +import { json, redirect } from '@sveltejs/kit'; + +interface TestTable { + id: string; + created_at: string; +} + +export const GET: RequestHandler = withAuth(async ({ session, getSupabaseClient }) => { + if (!session.user) { + throw redirect(303, '/'); + } + + const { data } = await getSupabaseClient() + .from('test') + .select('*'); + + return json({ data }); +); +``` + + + + +## Additional Links + +- [Auth Helpers Source code](https://github.com/supabase/auth-helpers) +- [SvelteKit example](https://github.com/supabase/auth-helpers/tree/main/examples/sveltekit) +- [SvelteKit Email/Password example](https://github.com/supabase/auth-helpers/tree/main/examples/sveltekit-email-password) +- [SvelteKit Magiclink example](https://github.com/supabase/auth-helpers/tree/main/examples/sveltekit-magic-link) diff --git a/apps/reference/docs/guides/auth/auth-keycloak.mdx b/apps/reference/docs/guides/auth/auth-keycloak.mdx index 39d1eb96196..0282eb6cb75 100644 --- a/apps/reference/docs/guides/auth/auth-keycloak.mdx +++ b/apps/reference/docs/guides/auth/auth-keycloak.mdx @@ -22,7 +22,7 @@ Keycloak OAuth consists of five broad steps: - Ensure that the new client has the "Client Protocol" set to "openid-connect" and the "Access Type" is set to "confidential". - The `Client ID` of the client created will be used as the `client id`. - Obtain the `Secret` from the credentials tab which will be used as the `client secret`. -- Whitelist the callback url of your application. +- Add the callback url of your application to your allowlist. ## Steps diff --git a/apps/reference/docs/guides/cli/local-development.mdx b/apps/reference/docs/guides/cli/local-development.mdx index aade041eaa5..7883f25647c 100644 --- a/apps/reference/docs/guides/cli/local-development.mdx +++ b/apps/reference/docs/guides/cli/local-development.mdx @@ -107,6 +107,10 @@ http://localhost:54321/auth/v1/ # Auth (GoTrue) +:::note +To access the database from an edge function in your local Supabase setup, replace `localhost` with `host.docker.internal`. +::: + ## Database migrations Database changes are managed through "migrations." Database migrations are a common way of tracking changes to your database over time. diff --git a/apps/reference/docs/guides/client-libraries.mdx b/apps/reference/docs/guides/client-libraries.mdx deleted file mode 100755 index b9959d2f87f..00000000000 --- a/apps/reference/docs/guides/client-libraries.mdx +++ /dev/null @@ -1,483 +0,0 @@ ---- -id: client-libraries -title: Client Libraries -description: 'Supabase provides client libraries in several languages.' ---- - -import Tabs from '@theme/Tabs' -import TabItem from '@theme/TabItem' - -The [Supabase Client](/docs/reference/javascript/installing) makes it simple for developers to build secure and scalable products. - -## Auth - -Create new users using [`signUp()`](/docs/reference/javascript/auth-signup). By default, the user will need to verify their email address before logging in.
-If confirmations are disabled the response will contain an access token and also a confirmed_at value, otherwise it will just contain a confirmation_sent_at attribute. - - - - - -```js -const { error, data } = await supabase.auth.signUp({ - email: 'example@email.com', - password: 'example-password', -}) -``` - - - - -```py -import os -from supabase import create_client, Client - -url: str = os.environ.get("SUPABASE_TEST_URL") -key: str = os.environ.get("SUPABASE_TEST_KEY") -supabase: Client = create_client(url, key) -user = supabase.auth.sign_up( - email='example@email.com', - password='example-password', -) -``` - - - - - -```dart -import 'package:supabase/supabase.dart'; - -void main() async { - final client = SupabaseClient('supabaseUrl', 'supabaseKey'); - - // Sign up user with email and password - final response = await client - .auth - .signUp('example@email.com', 'example-password'); -} -``` - - - - - -Existing users can log in using [`signIn()`](/docs/reference/javascript/auth-signin). - - - - - -```js -const { error, data } = await supabase.auth.signIn({ - email: 'example@email.com', - password: 'example-password', -}) -``` - - - - -```py -import os -from supabase import create_client, Client - -url: str = os.environ.get("SUPABASE_TEST_URL") -key: str = os.environ.get("SUPABASE_TEST_KEY") -supabase: Client = create_client(url, key) -user = supabase.auth.sign_in( - email='example@email.com', - password='example-password' -) -``` - - - - - -```dart -import 'package:supabase/supabase.dart'; - -void main() async { - final client = SupabaseClient('supabaseUrl', 'supabaseKey'); - - // Sign in user with email and password - final response = await client - .auth - .signIn(email: 'example@email.com', password: 'example-password'); -} -``` - - - - - -If there is an email, but no password passed to [`signIn()`](/docs/reference/javascript/auth-signin), the user will receive a magic link. - - - - - -```js -const { error, data } = await supabase.auth.signIn({ - email: 'example@email.com', -}) -``` - - - - -```py -import os -from supabase import create_client, Client - -url: str = os.environ.get("SUPABASE_TEST_URL") -key: str = os.environ.get("SUPABASE_TEST_KEY") -supabase: Client = create_client(url, key) -user = supabase.auth.sign_in( - email='example@email.com' -) -``` - - - - - -```dart -import 'package:supabase/supabase.dart'; - -void main() async { - final client = SupabaseClient('supabaseUrl', 'supabaseKey'); - - // Sign in user with email and magic link - final response = await client - .auth - .signIn(email: 'example@email.com'); -} -``` - - - - - -Third party logins are also handled through [`signIn()`](/docs/reference/javascript/auth-signin). - - - - - -```js -const { user, error } = await supabase.auth.signIn({ - // provider can be 'github', 'google', 'gitlab', or 'bitbucket' - provider: 'github', -}) -``` - - - - -```py -# Not yet implemented -``` - - - - - -```dart -import 'package:supabase/supabase.dart'; - -void main() async { - final client = SupabaseClient('supabaseUrl', 'supabaseKey'); - - final response = await client - .auth - .signIn(provider: Provider.github); -} -``` - - - - - -## Managing data - -Since Postgres is a Relational database, the client makes it simple to query tables and fetch related data in one round-trip, using [`select()`](/docs/reference/javascript/select). - - - - - -```js -const { data, error } = await supabase.from('countries').select(` - name, - cities ( - name - ) - `) -``` - - - - -```py -import os -from supabase import create_client, Client - -url: str = os.environ.get("SUPABASE_TEST_URL") -key: str = os.environ.get("SUPABASE_TEST_KEY") -supabase: Client = create_client(url, key) - -data = supabase.table('countries').select('name').execute() -``` - - - - - -```dart -import 'package:supabase/supabase.dart'; - -void main() async { - final client = SupabaseClient('supabaseUrl', 'supabaseKey'); - - // Query tables and fetch related data in one round-trip, using select() - final response = await client - .from('countries') - .select('name') - .execute(); -} -``` - - - - - -You can do advanced [filtering](/docs/reference/javascript/using-filters) to extract only the data that you need. - - - - - -```js -const { data, error } = await supabase - .from('cities') - .select('name, country_id') - .lt('country_id', 100) - .limit(10) -``` - - - - -```py -data = supabase.table('cities').select('name, country_id').eq('name', 'Germany').execute() -# Assert we pulled real data. -assert len(data.get("data", [])) > 0 -``` - - - - - -```dart -import 'package:supabase/supabase.dart'; - -void main() async { - final client = SupabaseClient('supabaseUrl', 'supabaseKey'); - - // When fetching data, use advanced filtering to only extract data, that you need. - final response = await client - .from('cities') - .select('name,country_id') - .lt('country_id', 100) - .limit(10) - .execute(); -} -``` - - - - - -You can create data easily using [`insert()`](/docs/reference/javascript/insert). - - - - - -```js -const { data, error } = await supabase.from('cities').insert([ - { name: 'The Shire', country_id: 554 }, - { name: 'Rohan', country_id: 555 }, -]) -``` - - - - -```py -data = supabase.table('cities').insert({'name': 'Gotham', 'country_id': 556 }).execute() -# assert if insert response is a success -assert data.get("status_code") in (200, 201) - -# bulk insert -data = supabase.table('cities').insert([ -{'name': 'Gotham', 'country_id': 556 }, -{'name': 'The Shire', 'country_id': 557 } -]).execute() - -``` - - - - - -```dart -import 'package:supabase/supabase.dart'; - -void main() async { - final client = SupabaseClient('supabaseUrl', 'supabaseKey'); - - // Create data easily, using insert() - final response = await client - .from('cities') - .insert([ - { 'name': 'The Shire', 'country_id': 554 }, - { 'name': 'Rohan', 'country_id': 555 }, - ]) - .execute(); -} -``` - - - - - -## Realtime Changes - -The Supabase client makes it simple to listen to realtime database changes, using [`subscribe()`](/docs/reference/javascript/subscribe). - - - - - -```js -const mySubscription = supabase - .from('countries') - .on('*', (payload) => { - console.log('Change received!', payload) - }) - .subscribe() -``` - - - - -```py -# Not yet implemented -``` - - - - - -```dart -import 'package:supabase/supabase.dart'; - -void main() async { - final client = SupabaseClient('supabaseUrl', 'supabaseKey'); - - // Listen to realtime database changes, using subscribe() - final response = await client - .from('countries') - .on(SupabaseEventTypes.all, (payload) { - print('Something happened: ${payload.eventType}'); - }) - .subscribe((String event, {String? errorMsg}) { - print('event: $event error: $errorMsg'); - }); -} -``` - - - - - -You can even [listen to Row Level changes](/docs/reference/javascript/subscribe#listening-to-row-level-changes). - - - - - -```js -const mySubscription = supabase - .from('countries:id.eq.200') - .on('UPDATE', handleRecordUpdated) - .subscribe() -``` - - - - -```py -# Not yet implemented -``` - - - - - -```dart -import 'package:supabase/supabase.dart'; - -void main() async { - final client = SupabaseClient('supabaseUrl', 'supabaseKey'); - - // You can even listen to Row Level changes - final response = await client - .from('countries:id.eq.200') - .on(SupabaseEventTypes.update, (payload) { - print('Something happened: ${payload.eventType}'); - }) - .subscribe((String event, {String? errorMsg}) { - print('event: $event error: $errorMsg'); - }); -} -``` - - - - - -## Next steps - -- View the [Client Docs](/docs/reference/javascript/installing) -- Sign in: [app.supabase.com](https://app.supabase.com) diff --git a/apps/reference/docs/guides/database.mdx b/apps/reference/docs/guides/database.mdx index c21efcb9918..ee4234bd43c 100644 --- a/apps/reference/docs/guides/database.mdx +++ b/apps/reference/docs/guides/database.mdx @@ -85,43 +85,6 @@ You can enable Postgres extensions with the click of a button within the Supabas ## Tips -### Realtime - -Supabase provides a realtime engine on top of Postgres, so that you can listen to changes as they happen. -Our realtime engine uses the built-in replication functionality of Postgres. - -Realtime server broadcasts database changes to authorized users depending on your Row Level Security (RLS) policies. -We recommend that you enable row level security and set row security policies on tables that you add to the publication. -However, you may choose to disable RLS on a table and have changes broadcast to all connected clients. - -You can manage the realtime system, simply by -[updating](/docs/guides/database/replication) the `supabase_realtime` publication. - -For example to enable realtime only for individual tables: - -```sql -begin; - -- remove the realtime publication - drop publication if exists supabase_realtime; - - -- re-create the publication but don't enable it for any tables - create publication supabase_realtime; -commit; - --- add a table to the publication -alter publication supabase_realtime add table products; - --- add other tables to the publication -alter publication supabase_realtime add table posts; -``` - -By default only "new" values are sent, but if you want to receive the old record (previous values) whenever you `update` or `delete` a record, -you can update the replica identity of your tables, setting it to `full`: - -```sql -alter table your_table replica identity full; -``` - Read about resetting your database password [here](/docs/guides/database/managing-passwords) and changing the timezone of your server [here](/docs/guides/database/managing-timezones). ## Next steps diff --git a/apps/reference/docs/guides/database/functions.mdx b/apps/reference/docs/guides/database/functions.mdx index 9e2b4e407d6..8a108157bc3 100644 --- a/apps/reference/docs/guides/database/functions.mdx +++ b/apps/reference/docs/guides/database/functions.mdx @@ -278,10 +278,10 @@ final res = await supabase ### Database Functions vs Edge Functions -For data-intensive operations we recommend using [Database Functions](../../guides/database/functions), which are executed within your database +For data-intensive operations, use Database Functions, which are executed within your database and can be called remotely using the [REST and GraphQL API](../api). -For use-cases which require low-latency we recommend [Edge Functions](../../guides/functions), which are globally-distributed and can be written in Typescript. +For use-cases which require low-latency, use [Edge Functions](../../guides/functions), which are globally-distributed and can be written in Typescript. ### Security `definer` vs `invoker` @@ -302,6 +302,18 @@ $$; It is best practice to use `security invoker` (which is also the default). If you ever use `security definer`, you _must_ set the `search_path`. This limits the potential damage if you allow access to schemas which the user executing the function should not have. +### Function privileges + +By default, database functions can be executed by any role. You can restrict this by altering the default privileges and then choosing which roles can execute functions. + +```sql +ALTER DEFAULT PRIVILEGES REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC; + +-- Choose which roles can execute functions +GRANT EXECUTE ON FUNCTION hello_world TO authenticated; +GRANT EXECUTE ON FUNCTION hello_world TO service_role; +``` + ## Resources - Official Client libraries: [JavaScript](../../reference/javascript/rpc) and [Dart](../../reference/dart/rpc) diff --git a/apps/reference/docs/guides/functions.mdx b/apps/reference/docs/guides/functions.mdx index 7321cfc957d..b88a5c21a29 100644 --- a/apps/reference/docs/guides/functions.mdx +++ b/apps/reference/docs/guides/functions.mdx @@ -30,7 +30,7 @@ const examples = [ }, ] -Edge Functions are server-side TypeScript functions, distributed globally at the edge - close to your users. They can be used for listening to webhooks or integrating your Supabase project with third-parties, like Stripe. +Edge Functions are server-side TypeScript functions, distributed globally at the edge—close to your users. They can be used for listening to webhooks or integrating your Supabase project with third-parties [like Stripe](https://github.com/supabase/supabase/tree/master/examples/edge-functions/supabase/functions/stripe-webhooks). Edge Functions are developed using [Deno](https://deno.com), which offers a few benefits to you as a developer: @@ -285,6 +285,24 @@ We recommend developing “fat functions”. This means that you should develop We recommend using hyphens to name functions because hyphens are the most URL-friendly of all the naming conventions (snake_case, camelCase, PascalCase). +### CORS (Cross-Origin Resource Sharing) + +We recommend adding a check to handle [CORS Preflight](https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request) requests in your edge function to be able to invoke the function from browsers. + +```ts +export const corsHeaders = { + 'Access-Control-Allow-Origin': '*', + 'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey', +} + +serve(async (req) => { + if (req.method === 'OPTIONS') { + return new Response('ok', { headers: corsHeaders }) + } + ... +}) +``` + ## Limitations - Deno Deploy limitations diff --git a/apps/reference/docs/guides/hosting/platform.mdx b/apps/reference/docs/guides/hosting/platform.mdx index 3a997d26c91..9304734111f 100644 --- a/apps/reference/docs/guides/hosting/platform.mdx +++ b/apps/reference/docs/guides/hosting/platform.mdx @@ -2,6 +2,7 @@ id: platform title: Supabase Platform description: Getting started with the Supabase Platform. +sidebar_label: Overview --- Supabase is a hosted platform which makes it very simple to get started without needing to manage any infrastructure. @@ -10,12 +11,14 @@ Visit [app.supabase.com](https://app.supabase.com) and sign in to start creating ## Projects -Each project on Supabase comes with these features: +Each project on Supabase comes with: -- A dedicated Postgres database. [Learn more](/docs/guides/database) -- Auto-generated APIs. [Learn more](/docs/guides/api) -- Auth and User management. [Learn more](/docs/guides/auth) -- Storage. [Learn more](/docs/guides/storage) +- A dedicated [Postgres database](/docs/guides/database) +- [Auto-generated APIs](/docs/guides/api) +- [Auth and user management](/docs/guides/auth) +- [Edge Functions](/docs/guides/functions) +- [Realtime API](/docs/guides/realtime) +- [Storage](/docs/guides/storage) ## Organizations @@ -31,36 +34,47 @@ You can invite your team members into your organizations to collaborate on proje You can also assign roles to your team members with different access levels. The table below shows the corresponding permissions for each available role in the Dashboard. -| Permissions | Owner | Administrator | Developer | -| ---------------------------- | ----- | ------------- | --------- | -| **Organization** | -| Can change organization name | ✅ | | | -| Can delete organization | ✅ | | | -| **Members** | -| Can add an Owner | ✅ | | | -| Can remove an Owner | ✅ | | | -| Can add an Adminstrator | ✅ | ✅ | | -| Can remove an Administrator | ✅ | ✅ | | -| Can add a Developer | ✅ | ✅ | | -| Can remove a Developer | ✅ | ✅ | | -| Can revoke an invite | ✅ | ✅ | | -| Can resend an invite | ✅ | ✅ | | -| **Billing** | -| Can read invoices | ✅ | ✅ | ✅ | -| Can read billing email | ✅ | ✅ | ✅ | -| Can change billing email | ✅ | | | -| Can view subscription | ✅ | ✅ | ✅ | -| Can update subscription | ✅ | ✅ | | -| Can read billing address | ✅ | ✅ | ✅ | -| Can update billing address | ✅ | ✅ | | -| Can read tax codes | ✅ | ✅ | ✅ | -| Can update tax codes | ✅ | ✅ | | -| Can read payment methods | ✅ | ✅ | ✅ | -| Can update payment methods | ✅ | ✅ | | -| **Projects** | -| Can create a project | ✅ | ✅ | | -| Can delete a project | ✅ | ✅ | | -| Can update a project | ✅ | ✅ | | -| Can pause a project | ✅ | ✅ | | -| Can resume a project | ✅ | ✅ | | -| Can restart a project | ✅ | ✅ | ✅ | +| Permissions | Owner | Administrator | Developer | +| ------------------------ | ----- | ------------- | --------- | +| **Organization** | +| Change organization name | ✅ | | | +| Delete organization | ✅ | | | +| **Members** | +| Add an Owner | ✅ | | | +| Remove an Owner | ✅ | | | +| Add an Adminstrator | ✅ | ✅ | | +| Remove an Administrator | ✅ | ✅ | | +| Add a Developer | ✅ | ✅ | | +| Remove a Developer | ✅ | ✅ | | +| Revoke an invite | ✅ | ✅ | | +| Resend an invite | ✅ | ✅ | | +| **Billing** | +| Read invoices | ✅ | ✅ | ✅ | +| Read billing email | ✅ | ✅ | ✅ | +| Change billing email | ✅ | | | +| View subscription | ✅ | ✅ | ✅ | +| Update subscription | ✅ | ✅ | | +| Read billing address | ✅ | ✅ | ✅ | +| Update billing address | ✅ | ✅ | | +| Read tax codes | ✅ | ✅ | ✅ | +| Update tax codes | ✅ | ✅ | | +| Read payment methods | ✅ | ✅ | ✅ | +| Update payment methods | ✅ | ✅ | | +| **Projects** | +| Create a project | ✅ | ✅ | | +| Delete a project | ✅ | ✅ | | +| Update a project | ✅ | ✅ | | +| Pause a project | ✅ | ✅ | | +| Resume a project | ✅ | ✅ | | +| Restart a project | ✅ | ✅ | ✅ | + +## Platform status + +If Supabase experiences outages, we keep you as informed as possible, as early as possible. We provide the following feedback channels: + +- Status page: [status.supabase.com](https://status.supabase.com/) +- RSS Feed: [status.supabase.com/history.rss](https://status.supabase.com/history.rss) +- Atom Feed: [status.supabase.com/history.atom](https://status.supabase.com/history.atom) +- Slack Alerts: You can receive updates via the RSS feed, using Slack's [built-in RSS functionality](https://slack.com/help/articles/218688467-Add-RSS-feeds-to-Slack)
`/feed subscribe https://status.supabase.com/history.atom` + +Make sure to review our [SLA](/docs/company/sla) for details on our commitment to Platform Stability. diff --git a/apps/reference/docs/guides/integrations/polyscale.mdx b/apps/reference/docs/guides/integrations/polyscale.mdx new file mode 100644 index 00000000000..a3534305bf4 --- /dev/null +++ b/apps/reference/docs/guides/integrations/polyscale.mdx @@ -0,0 +1,63 @@ +--- +id: polyscale +title: 'PolyScale' +description: 'The easiest way to get low-latency reads from your Supabase database for multi-region applications is by using PolyScale, a code-free global caching service.' +--- + +[PolyScale](https://polyscale.ai) is an intelligent, serverless database caching engine which allows low-latency reads from Supabase globally, no coding required. Supabase can be connected to PolyScale in minutes, providing you fast access to your Supabase data around the globe. + +This guide explains how to connect Supabase to a PolyScale cache. + +The video below illustrates how to get connected. Or you can read the steps below. + +
+ +
+ +## Step 0: Create a PolyScale account + +If you do not already have a PolyScale account, you can create an account [here](https://app.polyscale.ai/signup). PolyScale offers a free tier and no credit card is required. + +## Step 1: Create your PolyScale Cache + +### 1.1 Retrieve your Supabase Host + +In your Supabase project, click on `Settings > Database` and scroll down to the `Connection info` section to copy your database `Host`. + +![supabase-host](/img/guides/integrations/polyscale/supabase-host.png) + +### 1.2 Configure your PolyScale Cache + +- In your PolyScale account, click on the **New Cache** button +- Give the cache a **Name** +- Select **PostgreSQL** for the **Type** +- Enter the **Host** from Step 1.1 above +- Enter `5432` for the **Port** +- Click **Create** + +![create-cache-supabase](/img/guides/integrations/polyscale/create-cache-supabase-400.png) + +Your cache is now created. PolyScale automatically checks to see that your database is accessible from all our global PoPs. + +## Step 2: Connect to your PolyScale Cache + +Using your PolyScale cache is simple -- instead of connecting to your Supabase database directly, you'll replace your orignal connection string with the PolyScale connection string in your application. + +For example, if your original connection string was: `postgres://postgres:zqSPGHFAbPLvVCKw@db.rogpiubvixysbakciwqz.supabase.co:5432` + +Your PolyScale connection string would be: `postgres://postgres:zqSPGHFAbPLvVCKw@psedge.global:5432?application_name=a645cb93-fa53-46b2-9d6c-227e357e5bfb` + +You can read more about connecting to PolyScale [here](https://docs.polyscale.ai/connecting-to-polyscale#postgresql) + +That's it. + +## All done! + +You can read more about PolyScale [here](https://www.polyscale.ai/) or check out our [documentation](https://docs.polyscale.ai/). \ No newline at end of file diff --git a/apps/reference/docs/guides/platform/logs.mdx b/apps/reference/docs/guides/platform/logs.mdx index 7219fd5f673..1607b4f3ae8 100644 --- a/apps/reference/docs/guides/platform/logs.mdx +++ b/apps/reference/docs/guides/platform/logs.mdx @@ -4,78 +4,212 @@ title: Logging description: Getting started with Supabase Platform Log Browser --- -The Supabase Platform provides a log explorer that allows log tracing and debugging. Currently, PostgreSQL and Cloudflare edge logs are available. +import Tabs from '@theme/Tabs' +import TabItem from '@theme/TabItem' +import ThemedImage from '@theme/ThemedImage'; +import useBaseUrl from '@docusaurus/useBaseUrl'; + +The Supabase Platform includes a Logs Explorer that allows log tracing and debugging. Log retention is based on your [project's pricing plan](https://supabase.com/pricing). :::note - -The features discussed in this article are only available through the Supabase Platform and are not available on self-hosted. - +These features are not currently available for self-hosting and local development.
+This is on the roadmap and you can follow the progress in the [Logflare repository](https://github.com/Logflare/logflare). ::: ## Product Logs -As well as a Log Explorer, Supabase provides a logging interface specific to each product. +Supabase provides a logging interface specific to each product. You can use simple regular expressions for keywords and patterns to search log event messages. You can also export and download the log events matching your query as a spreadsheet. -### API Logs + + + + + +[API logs](https://app.supabase.com/project/_/database/api-logs) show all network requests and response for the REST and GraphQL [APIs](../../guides/api). ![API Logs](/img/guides/platform/logs/logs-api.png) -The API Logs can be found under `Database > API Logs`. These show all network requests for the REST and GraphQL [API](../../guides/api). + + -### Postgres Logs +[Postgres logs](https://app.supabase.com/project/_/database/postgres-logs) show all queries and activity for your [database](../../guides/database). ![Postgres Logs](/img/guides/platform/logs/logs-database.png) -The Postgres Logs can be found under `Database > Postgres Logs`. These show all queries and activity for your [Database](../../guides/database). + + -## Log Explorer +[Auth logs](https://app.supabase.com/project/_/auth/logs) show all server logs for your [Auth usage](../../guides/auth). -![Sidebar navigation steps](/img/guides/platform/logs/sidebar-navigation.png) +![Auth Logs](/img/guides/platform/logs/logs-auth.png) -The log browser can be accessed in the sidebar under **Logs Explorer**. The **Logs Explorer** is for querying and aggregating project logs across products using SQL `SELECT` queries. + + -### Example +[Storage logs](https://app.supabase.com/project/_/storage/logs) shows all server logs for your [Storage API](../../guides/storage). -For example, you may enter the following into the SQL editor to query for each user's IP address: +![Storage Logs](/img/guides/platform/logs/logs-storage.png) + + + + +[Realtime logs](https://app.supabase.com/project/_/database/realtime-logs) show all server logs for your [Realtime API usage](../../guides/realtime). + +![Realtime Logs](/img/guides/platform/logs/logs-realtime.png) + + + + +For each [Edge Function](https://app.supabase.com/project/_/functions), logs are available under the following tabs: + +**Invocations** + +The Invocations tab displays the edge logs of function calls. + +![Function Edge Logs](/img/guides/platform/logs/logs-functions-edge.png) + +**Logs** + +The Logs tab displays logs emitted during function execution. + +![Function Logs](/img/guides/platform/logs/logs-functions.png) + + + + +## Logs Explorer + +The [Logs Explorer](https://app.supabase.com/project/_/logs-explorer) exposes logs from each part of the Supabase stack as a separate table that can be queried and joined using SQL. + +![Logs Explorer](/img/guides/platform/logs/logs-explorer.png) + +You can access the following logs from the **Sources** drop-down: + +- `auth_logs`: GoTrue server logs, containing authentication/authorization activity. +- `edge_logs`: Edge network logs, containing request and response metadata retrieved from Cloudflare. +- `function_edge_logs`: Edge network logs for only edge functions, containing network requests and response metadata for each execution. +- `function_logs`: Function internal logs, containing any `console` logging from within the edge function. +- `postgres_logs`: Postgres database logs, containing statements executed by connected applications. +- `realtime_logs`: Realtime server logs, containing client connection information. +- `storage_logs`: Storage server logs, containing object upload and retrieval information. + +## Querying with the Logs Explorer + +The Logs Explorer uses BigQuery and supports all [available SQL functions and operators](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators). + +### Timestamp Display and Behavior + +Each log entry is stored with a `timestamp` as a `TIMESTAMP` data type. Use the appropriate [timestamp function](https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#timestamp) to utilize the `timestamp` field in a query. + +Raw top-level timestamp values are rendered as unix microsecond. To render the timestamps in a human-readable format, use the `DATETIME()` function to convert the unix timestamp display into an ISO-8601 timestamp. ```sql -SELECT timestamp, h.x_real_ip -FROM edge_logs - LEFT JOIN UNNEST(metadata) as m ON TRUE - LEFT JOIN UNNEST(m.request) AS r ON TRUE - LEFT JOIN UNNEST(r.headers) AS h ON TRUE -WHERE h.x_real_ip IS NOT NULL +-- timestamp column without datetime() +select timestamp from .... +-- 1664270180000 + +-- timestamp column with datetime() +select datetime(timestamp) from .... +-- 2022-09-27T09:17:10.439Z ``` -![SELECT query example](/img/guides/platform/logs/select-query.png) - -The list of supported product sources can be found under the **Sources** dropdown. - ### Unnesting Arrays -To query the metadata in the above example, you can unnest the field and "join" the unnested data. Clicking on the log row shows that log metadata is stored as an array of objects. +Each log event stores metadata an array of objects with multiple levels, and can be seen by selecting single log events in the Logs Explorer. To query arrays, use `unnest()` on each array field and add it to the query as a join. This allows you to reference the nested objects with an alias and select their individual fields. -In order to query any value that is an array, we would need to `UNNEST()` that field and add it to the query as a join, thereby allowing us to reference the nested fields within the array. +For example, to query the edge logs without any joins: -:::caution +```sql +select timestamp, metadata from edge_logs t +``` +The resulting `metadata` key is rendered as an array of objects in the Logs Explorer. In the following diagram, each box represents a nested array of objects: -Large projects may run into a `Resources Exceeded` memory limit error when selecting large objects with many nested keys. To avoid this error, select individual keys separately or reduce the queried date range. -::: + -### Functions + -You may have also noticed from the above examples that we are able to use certain SQL functions within our queries. The querying engine currently supported is BigQuery, hence you may use [any valid BigQuery function](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators) within your query. -#### Timestamp Behavior +Perform a `cross join unnest()` to work with the keys nested in the `metadata` key. -Each log entry is stored with a `timestamp`. In order to utilize the `timestamp` field in a query, you can use the appropriate [timestamp functions](https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#timestamp). +To query for a nested value, add a join for each array level: -:::note +```sql +select timestamp, request.method, header.cf_ipcountry +from edge_logs t +cross join unnest(t.metadata) as metadata +cross join unnest(metadata.request) as request +cross join unnest(request.headers) as header +``` -In the Log Explorer, timestamps are rendered as unix microsecond timestamps. SQL queries, however, should always use the `TIMESTAMP` data type. If you are using a unix timestamp value in a query, cast the value to a `TIMESTAMP` data type. +This surfaces the following columns available for selection: -::: + -## Templates +This allows you to select the `method` and `cf_ipcountry` columns. In JS dot notation, the full paths for each selected column are: -Templates are available to help craft you log queries. Templates are available under the **Templates** tab, or under the **Templates** Dropdown in the **Query** tab. +- `metadata[].request[].method` +- `metadata[].request[].headers[].cf_ipcountry` + +### LIMIT and Result Row Limitations + +The Logs Explorer has a maximum of 1000 rows per run. Use `LIMIT` to optimize your queries by reducing the number of rows returned further. + +### Best Practices + +1. Include a filter over **timestamp** + + Querying your entire log history might seem appealing. For **Enterprise** customers that have a large retention range, you run the risk of timeouts due additional time required to scan the larger dataset. + +2. Avoid selecting large nested objects. Select individual values instead. + + When querying large objects, the columnar storage engine selects each column associated with each nested key, resulting in a large number of columns being selected. This inadvertently impacts the query speed and may result in timeouts or memory errors, especially for projects with a lot of logs. + + Instead, select only the values required. + + ```sql + -- ❌ Avoid doing this + select + datetime(timestamp), + m as metadata -- <- metadata contains many nested keys + from edge_logs t + cross join unnest(t.metadata) as m; + + -- ✅ Do this + select + datetime(timestamp), + r.method -- <- select only the required values + from edge_logs t + cross join unnest(t.metadata) as m + cross join unnest(m.request) as r + ``` + +### Examples and Templates + +The Logs Explorer includes **Templates** (available in the Templates tab or the dropdown in the Query tab) to help you get started. + +For example, you can enter the following query in the SQL Editor to retrieve each user's IP address: + +```sql +select datetime(timestamp), h.x_real_ip +from edge_logs + cross join unnest(metadata) as m + cross join unnest(m.request) AS r + cross join unnest(r.headers) AS h +where h.x_real_ip is not null and r.method = "GET" +``` diff --git a/apps/reference/docs/guides/realtime/postgres-changes.mdx b/apps/reference/docs/guides/realtime/postgres-changes.mdx index 4c1b618ea73..e9f01b06460 100644 --- a/apps/reference/docs/guides/realtime/postgres-changes.mdx +++ b/apps/reference/docs/guides/realtime/postgres-changes.mdx @@ -4,15 +4,35 @@ title: Postgres Changes description: Getting started with Realtime's Postgres Changes feature --- -Supabase Postgres Changes enable clients to listen to Postgres database events, specifically INSERT, UPDATE, and DELETE events. +Supabase Postgres Changes listen for database changes and sends them to clients. Clients are required to subscribe with a JWT dictating which changes they are allowed to receive based on the database's [Row Level Security](/docs/guides/auth/row-level-security). -Clients can elect to get changes for all tables in the public schema, a specific table, or a specific column's value. Replication is not enabled by default—enable it for the entities you are interested in the [Dashboard](https://app.supabase.com/project/_/database/replication). +:::caution +Anyone with access to a valid JWT signed with the project's JWT secret is able to listen to your database's changes, unless tables have [Row Level Security](/docs/guides/auth/row-level-security) enabled and policies in place. +::: -Anyone with access to a valid JWT signed with the project's JWT secret is able to listen to database changes, unless the tables enabled for replication are protected with [Row Level Security](/docs/guides/auth/row-level-security). +Clients can choose to receive `INSERT`, `UPDATE`, `DELETE`, or `*` (all) changes for all changes in a schema, a table in a schema, or a column's value in a table.Your clients can only listen to tables in the `public` schema and you must first enable the tables you want your clients to listen to. You can do this in the [Replication](https://app.supabase.com/project/_/database/replication) section in the Dashboard or with the [SQL editor](https://app.supabase.com/project/_/sql): -The postgres changes functionality is supported by supabase-js v2 release candidate. +```sql +begin; + -- remove the supabase_realtime publication + drop publication if exists supabase_realtime; -To listen to all events on all tables in the public schema: + -- re-create the supabase_realtime publication with no tables + create publication supabase_realtime; +commit; + +-- add a table to the publication +alter publication supabase_realtime add table messages; +``` + +By default, only `new` record changes are sent but if you want to receive the `old` record (previous values) whenever you `UPDATE` or `DELETE` a record, +you can set the `replica identity` of your table to `full`: + +```sql +alter table messages replica identity full; +``` + +To listen to all changes in the `public` schema: ```js const { createClient } = require('@supabase/supabase-js') @@ -23,24 +43,28 @@ const supabase = createClient( ) /* - The name of the channel can be set to any string. - Event can be either INSERT, UPDATE, DELETE, or * for all events. + Channel name can be any string. + Event name can can be one of: + - INSERT + - UPDATE + - DELETE + - * */ const channel = supabase - .channel('db-changes') - .on('postgres_changes', { event: '*', schema: '*' }, (payload) => + .channel('schema-db-changes') + .on('postgres_changes', { event: '*', schema: 'public' }, (payload) => console.log(payload) ) .subscribe() ``` -To listen to INSERT events on the messages table in the public schema: +To listen to changes on a table in the `public` schema: ```js -// Setup +// Supabase client setup const channel = supabase - .channel('db-changes') + .channel('table-db-changes') .on( 'postgres_changes', { event: 'INSERT', schema: 'public', table: 'messages' }, @@ -49,31 +73,36 @@ const channel = supabase .subscribe() ``` -To listen to UPDATE events only when a specific column matches a value: +To listen to changes when a column's value in a table matches a client-specified value: ```js -// Setup +// Supabase client setup const channel = supabase - .channel('db-changes') + .channel('value-db-changes') .on( 'postgres_changes', - { event: 'UPDATE', schema: 'public', table: 'messages', filter: 'id=eq.1' }, + { + event: 'UPDATE', + schema: 'public', + table: 'messages', + filter: 'body=eq.hey', + }, (payload) => console.log(payload) ) .subscribe() ``` -Clients can also mix and match and listen to different events and schema/tables/filters: +To listen to different events and schema/tables/filters combinations with the same channel: ```js -// Setup +// Supabase client setup const channel = supabase .channel('db-changes') .on( 'postgres_changes', - { event: '*', schema: 'public', table: 'messages', filter: 'id=eq.23' }, + { event: '*', schema: 'public', table: 'messages', filter: 'body=eq.bye' }, (payload) => console.log(payload) ) .on( diff --git a/apps/reference/docs/guides/storage-caching.mdx b/apps/reference/docs/guides/storage-cdn.mdx similarity index 79% rename from apps/reference/docs/guides/storage-caching.mdx rename to apps/reference/docs/guides/storage-cdn.mdx index 3eacdd8efd0..7527c9e8c3c 100644 --- a/apps/reference/docs/guides/storage-caching.mdx +++ b/apps/reference/docs/guides/storage-cdn.mdx @@ -1,8 +1,8 @@ --- -id: storage-caching -title: Storage Caching -description: How Supabase Storage caches objects -sidebar_label: Caching +id: storage-cdn +title: Storage CDN +description: How Supabase Storage caches objects with a CDN +sidebar_label: CDN --- ## CDN basics @@ -21,12 +21,14 @@ By default, assets are cached both in the CDN and in the user’s browser for 1 You can modify this cache time when you are [uploading](https://supabase.com/docs/reference/javascript/next/storage-from-upload) or [updating](https://supabase.com/docs/reference/javascript/next/storage-from-update) an object by modifying the `cacheControl` parameter. -The cache status of a particular request is sent in the `cf-cache-status` header. A cache status of `MISS` indicates that the CDN node did not have the object in its cache and had to ping the origin to get it. A cache status of `HIT` indicates that the object was sent directly from the CDN. - -## Performance - If you expect the object to not change at a given URL, setting a longer cache duration is preferable. If you need to update the version of the object stored in the CDN, there are various cache-busting techniques you can use. The most common way to do this is to add a version query parameter in the URL. For example, you can use a URL like `/storage/v1/object/sign/profile-pictures/cat.jpg?token=eyJh...&version=1` in your applications and set a long cache time of 1 year. When you want to update the cat picture, you can increment the version query parameter in the URL. The CDN will treat `/storage/v1/object/sign/profile-pictures/cat.jpg?token=eyJh...&version=2` as a new object and pings the origin for the updated version. Note that CDNs might still evict your object from their cache if it has not been requested for a while from a specific region. For example, if no user from United States requests your object, it will be removed from the CDN cache even if you set a very long cache control duration. + +The cache status of a particular request is sent in the `cf-cache-status` header. A cache status of `MISS` indicates that the CDN node did not have the object in its cache and had to ping the origin to get it. A cache status of `HIT` indicates that the object was sent directly from the CDN. + +## Public vs Private Buckets + +Objects in public buckets do not require any Authorization to access objects. This leads to a better cache hit rate compared to private buckets. For private buckets, permissions for accessing each object is checked on a per user level. For example, if two different users access the same object in a private bucket from the same region, it results in a cache miss for both the users since they might have different security policies attached to them. On the other hand, if two different users access the same object in a public bucket from the same region, it results in a cache hit for the second user. diff --git a/apps/reference/docs/guides/storage.mdx b/apps/reference/docs/guides/storage.mdx index 409693649f3..0dfc47ef526 100644 --- a/apps/reference/docs/guides/storage.mdx +++ b/apps/reference/docs/guides/storage.mdx @@ -24,7 +24,7 @@ organize your files. You can store them in whichever folder structure suits your Buckets are distinct containers for files and folders. You can think of them like "super folders". Generally you would create distinct buckets for different Security and Access Rules. For example, you might -keep all public files in a "public" bucket, and other files that require logged-in access in a "restricted" bucket. +keep all video files in a "video" bucket, and profile pictures in an "avatar" bucket.