diff --git a/.github/workflows/studio-build.yml b/.github/workflows/studio-build.yml index bb90e12f18c..b51253bbf04 100644 --- a/.github/workflows/studio-build.yml +++ b/.github/workflows/studio-build.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: - node-version: [14.x] + node-version: [16.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: diff --git a/.github/workflows/studio-tests.yml b/.github/workflows/studio-tests.yml index fa0dc31697b..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: @@ -17,7 +19,7 @@ jobs: strategy: matrix: - node-version: [14.x] + node-version: [16.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: @@ -28,8 +30,8 @@ jobs: node-version: ${{ matrix.node-version }} cache: 'npm' - name: Install deps - run: npm i - working-directory: ./studio + run: npm install + working-directory: ./ - name: Run tests run: npm test working-directory: ./studio diff --git a/.turbo-cookie b/.turbo-cookie new file mode 100755 index 00000000000..9e5d1817106 --- /dev/null +++ b/.turbo-cookie @@ -0,0 +1 @@ +cookie \ No newline at end of file diff --git a/README.md b/README.md index 2edd811d316..446e3316709 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ To see how to Contribute, visit [Getting Started](./DEVELOPERS.md) We are currently in Public Beta. Watch "releases" of this repo to get notified of major updates. -Watch this repo +Watch this repo --- @@ -200,10 +200,12 @@ Our approach for client libraries is modular. Each sub-library is a standalone i - [Arabic | العربية](/i18n/README.ar.md) - [Albanian / Shqip](/i18n/README.sq.md) - [Bangla / বাংলা](/i18n/README.bn.md) +- [Bulgarian / Български](/i18n/README.bg.md) - [Catalan / Català](/i18n/README.ca.md) - [Danish / Dansk](/i18n/README.da.md) - [Dutch / Nederlands](/i18n/README.nl.md) - [English](https://github.com/supabase/supabase) +- [Finnish / Suomalainen](/i18n/README.fi.md) - [French / Français](/i18n/README.fr.md) - [German / Deutsch](/i18n/README.de.md) - [Greek / Ελληνικά](/i18n/README.gr.md) diff --git a/SECURITY.md b/SECURITY.md index 247288302c4..b257313bf5d 120000 --- a/SECURITY.md +++ b/SECURITY.md @@ -1 +1 @@ -web/static/.well-known/security.txt \ No newline at end of file +apps/reference/static/.well-known/security.txt 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 1ca53e7ece4..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 = supabase.auth.session(); -``` - -## Examples - -### Get the session data - -```dart -final session = supabase.auth.session(); -``` 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 639c2b47b27..00000000000 --- a/apps/reference/_supabase_dart/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/generated/auth-signinwithprovider.mdx b/apps/reference/_supabase_dart/generated/auth-signinwithprovider.mdx deleted file mode 100644 index c44069bacb6..00000000000 --- a/apps/reference/_supabase_dart/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/generated/auth-signout.mdx b/apps/reference/_supabase_dart/generated/auth-signout.mdx deleted file mode 100644 index 2f05b6435da..00000000000 --- a/apps/reference/_supabase_dart/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/generated/auth-signup.mdx b/apps/reference/_supabase_dart/generated/auth-signup.mdx deleted file mode 100644 index a9a12b7ffc3..00000000000 --- a/apps/reference/_supabase_dart/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/generated/auth-update.mdx b/apps/reference/_supabase_dart/generated/auth-update.mdx deleted file mode 100644 index 69b16bd7af8..00000000000 --- a/apps/reference/_supabase_dart/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/generated/auth-user.mdx b/apps/reference/_supabase_dart/generated/auth-user.mdx deleted file mode 100644 index d789a54798a..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 = supabase.auth.user(); -``` - -## Examples - -### Get the logged in user - -```dart -final user = supabase.auth.user(); -``` diff --git a/apps/reference/_supabase_dart/generated/containedby.mdx b/apps/reference/_supabase_dart/generated/containedby.mdx deleted file mode 100644 index 7410fab9675..00000000000 --- a/apps/reference/_supabase_dart/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/generated/contains.mdx b/apps/reference/_supabase_dart/generated/contains.mdx deleted file mode 100644 index 4349bd001b9..00000000000 --- a/apps/reference/_supabase_dart/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/generated/delete.mdx b/apps/reference/_supabase_dart/generated/delete.mdx deleted file mode 100644 index 5f7de2ff42b..00000000000 --- a/apps/reference/_supabase_dart/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/generated/eq.mdx b/apps/reference/_supabase_dart/generated/eq.mdx deleted file mode 100644 index af396084f38..00000000000 --- a/apps/reference/_supabase_dart/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/generated/filter.mdx b/apps/reference/_supabase_dart/generated/filter.mdx deleted file mode 100644 index 9f41c021f89..00000000000 --- a/apps/reference/_supabase_dart/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/generated/getsubscriptions.mdx b/apps/reference/_supabase_dart/generated/getsubscriptions.mdx deleted file mode 100644 index 9d7ed2989d7..00000000000 --- a/apps/reference/_supabase_dart/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/generated/gt.mdx b/apps/reference/_supabase_dart/generated/gt.mdx deleted file mode 100644 index 7bc6f4c15b1..00000000000 --- a/apps/reference/_supabase_dart/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/generated/gte.mdx b/apps/reference/_supabase_dart/generated/gte.mdx deleted file mode 100644 index c9a36c36cd8..00000000000 --- a/apps/reference/_supabase_dart/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/generated/ilike.mdx b/apps/reference/_supabase_dart/generated/ilike.mdx deleted file mode 100644 index 88bd0f5ad70..00000000000 --- a/apps/reference/_supabase_dart/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/generated/in_.mdx b/apps/reference/_supabase_dart/generated/in_.mdx deleted file mode 100644 index be147c9fc43..00000000000 --- a/apps/reference/_supabase_dart/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/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 6330ee63c0c..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 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/generated/invoke.mdx b/apps/reference/_supabase_dart/generated/invoke.mdx deleted file mode 100644 index 1bc5f777f03..00000000000 --- a/apps/reference/_supabase_dart/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/generated/is_.mdx b/apps/reference/_supabase_dart/generated/is_.mdx deleted file mode 100644 index 89e4b117d88..00000000000 --- a/apps/reference/_supabase_dart/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/generated/like.mdx b/apps/reference/_supabase_dart/generated/like.mdx deleted file mode 100644 index 69ec224c02e..00000000000 --- a/apps/reference/_supabase_dart/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/generated/limit.mdx b/apps/reference/_supabase_dart/generated/limit.mdx deleted file mode 100644 index 69358c1d106..00000000000 --- a/apps/reference/_supabase_dart/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/generated/lt.mdx b/apps/reference/_supabase_dart/generated/lt.mdx deleted file mode 100644 index 130a5a09de7..00000000000 --- a/apps/reference/_supabase_dart/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/generated/lte.mdx b/apps/reference/_supabase_dart/generated/lte.mdx deleted file mode 100644 index 15fa4ac1280..00000000000 --- a/apps/reference/_supabase_dart/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/generated/match.mdx b/apps/reference/_supabase_dart/generated/match.mdx deleted file mode 100644 index d5f51720cc7..00000000000 --- a/apps/reference/_supabase_dart/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/generated/neq.mdx b/apps/reference/_supabase_dart/generated/neq.mdx deleted file mode 100644 index 8634f355312..00000000000 --- a/apps/reference/_supabase_dart/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/generated/not.mdx b/apps/reference/_supabase_dart/generated/not.mdx deleted file mode 100644 index a616d4ee84e..00000000000 --- a/apps/reference/_supabase_dart/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/generated/or.mdx b/apps/reference/_supabase_dart/generated/or.mdx deleted file mode 100644 index 6ff5d72f7ca..00000000000 --- a/apps/reference/_supabase_dart/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/generated/order.mdx b/apps/reference/_supabase_dart/generated/order.mdx deleted file mode 100644 index 3d559c632b9..00000000000 --- a/apps/reference/_supabase_dart/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/generated/overlaps.mdx b/apps/reference/_supabase_dart/generated/overlaps.mdx deleted file mode 100644 index 3985e4f2f89..00000000000 --- a/apps/reference/_supabase_dart/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/generated/range.mdx b/apps/reference/_supabase_dart/generated/range.mdx deleted file mode 100644 index fe8f1e987cc..00000000000 --- a/apps/reference/_supabase_dart/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/generated/rangeadjacent.mdx b/apps/reference/_supabase_dart/generated/rangeadjacent.mdx deleted file mode 100644 index 002f1ee8c73..00000000000 --- a/apps/reference/_supabase_dart/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/generated/rangegt.mdx b/apps/reference/_supabase_dart/generated/rangegt.mdx deleted file mode 100644 index 1a44b170727..00000000000 --- a/apps/reference/_supabase_dart/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/generated/rangegte.mdx b/apps/reference/_supabase_dart/generated/rangegte.mdx deleted file mode 100644 index a641d5eeba9..00000000000 --- a/apps/reference/_supabase_dart/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/generated/rangelt.mdx b/apps/reference/_supabase_dart/generated/rangelt.mdx deleted file mode 100644 index 99f8484a912..00000000000 --- a/apps/reference/_supabase_dart/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/generated/rangelte.mdx b/apps/reference/_supabase_dart/generated/rangelte.mdx deleted file mode 100644 index 548b61c2668..00000000000 --- a/apps/reference/_supabase_dart/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/generated/removesubscription.mdx b/apps/reference/_supabase_dart/generated/removesubscription.mdx deleted file mode 100644 index 5c95f1b1a60..00000000000 --- a/apps/reference/_supabase_dart/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/generated/reset-password-email.mdx b/apps/reference/_supabase_dart/generated/reset-password-email.mdx deleted file mode 100644 index d7c61047c9f..00000000000 --- a/apps/reference/_supabase_dart/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/generated/rpc.mdx b/apps/reference/_supabase_dart/generated/rpc.mdx deleted file mode 100644 index 78f0367e7a6..00000000000 --- a/apps/reference/_supabase_dart/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/generated/select.mdx b/apps/reference/_supabase_dart/generated/select.mdx deleted file mode 100644 index 827be2a3f6a..00000000000 --- a/apps/reference/_supabase_dart/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/generated/single.mdx b/apps/reference/_supabase_dart/generated/single.mdx deleted file mode 100644 index 04a9c0c853a..00000000000 --- a/apps/reference/_supabase_dart/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/generated/storage-createbucket.mdx b/apps/reference/_supabase_dart/generated/storage-createbucket.mdx deleted file mode 100644 index dd3ba519532..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 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/generated/storage-deletebucket.mdx b/apps/reference/_supabase_dart/generated/storage-deletebucket.mdx deleted file mode 100644 index d8466d3ddd6..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 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/generated/storage-emptybucket.mdx b/apps/reference/_supabase_dart/generated/storage-emptybucket.mdx deleted file mode 100644 index 47372c505ee..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 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/generated/storage-from-createsignedurl.mdx b/apps/reference/_supabase_dart/generated/storage-from-createsignedurl.mdx deleted file mode 100644 index e4c4ea26957..00000000000 --- a/apps/reference/_supabase_dart/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/generated/storage-from-download.mdx b/apps/reference/_supabase_dart/generated/storage-from-download.mdx deleted file mode 100644 index 44c80600d91..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 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/generated/storage-from-getpublicurl.mdx b/apps/reference/_supabase_dart/generated/storage-from-getpublicurl.mdx deleted file mode 100644 index 44cfa40072c..00000000000 --- a/apps/reference/_supabase_dart/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/generated/storage-from-list.mdx b/apps/reference/_supabase_dart/generated/storage-from-list.mdx deleted file mode 100644 index d760e8b757f..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 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/generated/storage-from-move.mdx b/apps/reference/_supabase_dart/generated/storage-from-move.mdx deleted file mode 100644 index 0a0462da7ed..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 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/generated/storage-from-remove.mdx b/apps/reference/_supabase_dart/generated/storage-from-remove.mdx deleted file mode 100644 index 4267ab63d0e..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 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/generated/storage-from-update.mdx b/apps/reference/_supabase_dart/generated/storage-from-update.mdx deleted file mode 100644 index 03dac7904f4..00000000000 --- a/apps/reference/_supabase_dart/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/generated/storage-from-upload.mdx b/apps/reference/_supabase_dart/generated/storage-from-upload.mdx deleted file mode 100644 index f9454c41893..00000000000 --- a/apps/reference/_supabase_dart/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/generated/storage-getbucket.mdx b/apps/reference/_supabase_dart/generated/storage-getbucket.mdx deleted file mode 100644 index bc086060252..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 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/generated/storage-listbuckets.mdx b/apps/reference/_supabase_dart/generated/storage-listbuckets.mdx deleted file mode 100644 index b51a7024740..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 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/generated/storage-updatebucket.mdx b/apps/reference/_supabase_dart/generated/storage-updatebucket.mdx deleted file mode 100644 index 38809788af9..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', { 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/generated/stream.mdx b/apps/reference/_supabase_dart/generated/stream.mdx deleted file mode 100644 index 994d8005507..00000000000 --- a/apps/reference/_supabase_dart/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/generated/subscribe.mdx b/apps/reference/_supabase_dart/generated/subscribe.mdx deleted file mode 100644 index 866fed8d0ec..00000000000 --- a/apps/reference/_supabase_dart/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/generated/textsearch.mdx b/apps/reference/_supabase_dart/generated/textsearch.mdx deleted file mode 100644 index 810eeb04b7a..00000000000 --- a/apps/reference/_supabase_dart/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/generated/update.mdx b/apps/reference/_supabase_dart/generated/update.mdx deleted file mode 100644 index 280172efbed..00000000000 --- a/apps/reference/_supabase_dart/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/generated/upsert.mdx b/apps/reference/_supabase_dart/generated/upsert.mdx deleted file mode 100644 index 5230a5dab54..00000000000 --- a/apps/reference/_supabase_dart/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/generated/using-filters.mdx b/apps/reference/_supabase_dart/generated/using-filters.mdx deleted file mode 100644 index 839a35fc748..00000000000 --- a/apps/reference/_supabase_dart/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/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/generated/initializing.mdx b/apps/reference/_supabase_dart/initializing.mdx similarity index 82% rename from apps/reference/_supabase_dart/generated/initializing.mdx rename to apps/reference/_supabase_dart/initializing.mdx index 4d8e7de815f..e779b7e8ac2 100644 --- a/apps/reference/_supabase_dart/generated/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' @@ -21,13 +20,13 @@ For `supabase_flutter`, you will be using the static `initialize()` method on `S ## Examples -### Dart SupabaseClient() +### Dart `SupabaseClient()` ```dart final supabase = SupabaseClient('https://xyzcompany.supabase.co', 'public-anon-key'); ``` -### Flutter initialize() +### Flutter `initialize()` ```dart title="main.dart" Future main() async { diff --git a/apps/reference/_supabase_dart/generated/installing.mdx b/apps/reference/_supabase_dart/installing.mdx similarity index 88% rename from apps/reference/_supabase_dart/generated/installing.mdx rename to apps/reference/_supabase_dart/installing.mdx index 4930b9baeff..2ed91c356fd 100644 --- a/apps/reference/_supabase_dart/generated/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/intro.mdx b/apps/reference/_supabase_dart/intro.mdx index 29286743efb..f1f68aea552 100644 --- a/apps/reference/_supabase_dart/intro.mdx +++ b/apps/reference/_supabase_dart/intro.mdx @@ -6,6 +6,14 @@ sidebar_label: Supabase Dart Library # Supabase Dart Library +:::note + +You're viewing the Supabase docs for a developer preview version. + +Refer to the `v0` docs for the previous release. + +::: + This reference documents every object and method available in Supabase's isomorphic Dart library, `supabase-dart`. You can use the `supabase-dart` library to: @@ -19,4 +27,4 @@ You can use the `supabase-dart` library to: ## Additional Links - Source Code: [github.com/supabase/supabase-dart](https://github.com/supabase/supabase-dart) -- [Known bugs and issues](https://github.com/supabase/supabase-dart/issues) +- [Known bugs and issues](https://github.com/supabase/supabase-flutter/issues) diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/.gitkeep b/apps/reference/_supabase_dart_versioned_docs/version-v0/generated/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/apps/reference/_supabase_dart_versioned_docs/version-v0/intro.mdx b/apps/reference/_supabase_dart_versioned_docs/version-v0/intro.mdx new file mode 100644 index 00000000000..29286743efb --- /dev/null +++ b/apps/reference/_supabase_dart_versioned_docs/version-v0/intro.mdx @@ -0,0 +1,22 @@ +--- +id: intro +slug: / +sidebar_label: Supabase Dart Library +--- + +# Supabase Dart Library + +This reference documents every object and method available in Supabase's isomorphic Dart library, `supabase-dart`. + +You can use the `supabase-dart` library to: + +- interact with your Postgres database +- listen to database changes +- invoke Deno Edge Functions +- build login and user management functionality +- manage large files + +## Additional Links + +- Source Code: [github.com/supabase/supabase-dart](https://github.com/supabase/supabase-dart) +- [Known bugs and issues](https://github.com/supabase/supabase-dart/issues) diff --git a/apps/reference/_supabase_dart_versioned_sidebars/version-v0-sidebars.json b/apps/reference/_supabase_dart_versioned_sidebars/version-v0-sidebars.json new file mode 100644 index 00000000000..44acc0181ad --- /dev/null +++ b/apps/reference/_supabase_dart_versioned_sidebars/version-v0-sidebars.json @@ -0,0 +1,120 @@ +{ + "sidebar": [ + { + "type": "category", + "label": "Getting Started", + "items": ["intro", "generated/installing", "generated/initializing"], + "collapsed": true + }, + { + "type": "category", + "label": "Auth", + "items": [ + "generated/auth-signup", + "generated/auth-signin", + "generated/auth-signinwithprovider", + "generated/auth-signout", + "generated/auth-session", + "generated/auth-user", + "generated/auth-update", + "generated/auth-onauthstatechange", + "generated/reset-password-email" + ], + "collapsed": true + }, + { + "type": "category", + "label": "Functions", + "items": ["generated/invoke"], + "collapsed": true + }, + { + "type": "category", + "label": "Database", + "items": [ + "generated/select", + "generated/insert", + "generated/update", + "generated/upsert", + "generated/delete", + "generated/rpc" + ], + "collapsed": true + }, + { + "type": "category", + "label": "Realtime", + "items": [ + "generated/subscribe", + "generated/removesubscription", + "generated/getsubscriptions", + "generated/stream" + ], + "collapsed": true + }, + { + "type": "category", + "label": "Storage", + "items": [ + "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-remove", + "generated/storage-from-createsignedurl", + "generated/storage-from-getpublicurl" + ], + "collapsed": true + }, + { + "type": "category", + "label": "Modifiers", + "items": [ + "generated/using-modifiers", + "generated/limit", + "generated/order", + "generated/range", + "generated/single" + ], + "collapsed": true + }, + { + "type": "category", + "label": "Filters", + "items": [ + "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/_supabase_dart_versions.json b/apps/reference/_supabase_dart_versions.json index fe51488c706..574c045ecaf 100644 --- a/apps/reference/_supabase_dart_versions.json +++ b/apps/reference/_supabase_dart_versions.json @@ -1 +1 @@ -[] +["v0"] 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 912ecf90e03..00000000000 --- a/apps/reference/_supabase_js/generated/auth-admin-generatelink.mdx +++ /dev/null @@ -1,155 +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 be sent via a custom email provider. - -```js -const { data, error } = await supabase.auth.admin.generateLink( - 'email@example.com' - 'signup', - { - '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( - 'email@example.com' - 'signup', - { - 'password': 'secret' - } -) -``` - -### Generate an invite link. - -```js -const { data, error } = await supabase.auth.admin.generateLink( - 'email@example.com' - 'invite', -) -``` 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 cda380e0313..00000000000 --- a/apps/reference/_supabase_js/generated/auth-resetpasswordforemail.mdx +++ /dev/null @@ -1,136 +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 { error, data } = await supabase.auth.resetPasswordForEmail(email, options: { - 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 password reset link in the email, 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). - -`#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 [update the user](/docs/reference/javascript/next/auth-updateuser) as follows: - -```js -const { error, data } = await supabase.auth.updateUser({ - password: new_password, -}) -``` - -## Examples - -### Reset password - -```js -const { error, data } = await supabase.auth.resetPasswordForEmail(email, options: { - redirectTo: 'https://example.com/update-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 26531fedd98..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.signInWithPassword({ - 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 1a5021bc07e..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. -- Email updates will send an email to both the user's current and new email with a confirmation link by default. - To only send a single confirmation link to the user's new email, you can toggle the "Secure email change" setting in [your project](https://app.supabase.com/project/_/auth/settings). - -## Examples - -### Update the email of 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 of 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 a31371f4b96..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' - -Finds all rows whose json, array, or range value on the stated `column` is -contained by the specified `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 column to filter on. - -
    - -
  • - -
  • -

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

    -
    - -The 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 36f1f707df5..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' - -Finds all rows whose json, array, or range value on the stated `column` -contains the values specified in `value`. - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, main_exports') - .contains('main_exports', ['oil']) -``` - -## Parameters - -
    - -
  • -

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

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

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

    -
    - -The 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/delete.mdx b/apps/reference/_supabase_js/generated/delete.mdx deleted file mode 100644 index 5d39de0c4c7..00000000000 --- a/apps/reference/_supabase_js/generated/delete.mdx +++ /dev/null @@ -1,174 +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' - -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
      - -
    • -

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

      -
      - -Count algorithm to use to count rows in a table. - -
      - -
        -
        Properties
        - -
      • -

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

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

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

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

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

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

      - - rollback - - - optional - - - boolean - -

      -
      - -Rollback the operation - -
      - -
    • - -
    - -
  • - -
- -## 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 c073e0e8191..00000000000 --- a/apps/reference/_supabase_js/generated/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_v2_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 - - - 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 84740a83798..00000000000 --- a/apps/reference/_supabase_js/generated/filter.mdx +++ /dev/null @@ -1,606 +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' - -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 - - - 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. - -
    - -
      -
      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. - -
    - -
  • - -
- -## 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 317fd9804df..00000000000 --- a/apps/reference/_supabase_js/generated/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_v2_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 - - - 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 6a6e5e513e6..00000000000 --- a/apps/reference/_supabase_js/generated/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_v2_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 - - - 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 a3076b0b0ca..00000000000 --- a/apps/reference/_supabase_js/generated/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_v2_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 - - - ColumnName - -

    -
    - -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/generated/in.mdx b/apps/reference/_supabase_js/generated/in.mdx deleted file mode 100644 index 155b6f2cb2d..00000000000 --- a/apps/reference/_supabase_js/generated/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_v2_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 - - - ColumnName - -

    -
    - -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/generated/index.mdx b/apps/reference/_supabase_js/generated/index.mdx deleted file mode 100644 index 22955c42880..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: ../../spec/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 03c4f33f7c4..00000000000 --- a/apps/reference/_supabase_js/generated/insert.mdx +++ /dev/null @@ -1,249 +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' - -Performs an INSERT into the table. - -```js -const { data, error } = await supabase - .from('cities') - .insert([{ name: 'The Shire', country_id: 554 }]) -``` - -## Parameters - -
    - -
  • -

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

    -
    - -The values to insert. - -
    - -
      -
      Properties
      - -
    • -

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

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

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

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

    - - __namedParameters - - - required - - - object - -

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

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

      -
      - -Count algorithm to use to count rows in a table. - -
      - -
        -
        Properties
        - -
      • -

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

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

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

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

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

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

      - - rollback - - - optional - - - boolean - -

      -
      - -Rollback the operation - -
      - -
    • - -
    - -
  • - -
- -## 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 fb7895c1087..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' - -Invokes 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 f1228f0c3d8..00000000000 --- a/apps/reference/_supabase_js/generated/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_v2_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 - - - 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 213c4496032..00000000000 --- a/apps/reference/_supabase_js/generated/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_v2_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 - - - ColumnName - -

    -
    - -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/generated/limit.mdx b/apps/reference/_supabase_js/generated/limit.mdx deleted file mode 100644 index 904fb1716b8..00000000000 --- a/apps/reference/_supabase_js/generated/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_v2_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. - -
    - -
  • - -
  • -

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

    -
    - -The foreign table to use (for foreign columns). - -
    - -
      -
      Properties
      - -
    • -

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

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
- -## 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 119d5d3da9f..00000000000 --- a/apps/reference/_supabase_js/generated/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_v2_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 - - - 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 10caa460d38..00000000000 --- a/apps/reference/_supabase_js/generated/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_v2_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 - - - 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 546f42dee8a..00000000000 --- a/apps/reference/_supabase_js/generated/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_v2_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/generated/maybesingle.mdx b/apps/reference/_supabase_js/generated/maybesingle.mdx deleted file mode 100644 index 7b1d7dd0d06..00000000000 --- a/apps/reference/_supabase_js/generated/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_v2_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/generated/neq.mdx b/apps/reference/_supabase_js/generated/neq.mdx deleted file mode 100644 index 05d70c11258..00000000000 --- a/apps/reference/_supabase_js/generated/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_v2_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 - - - 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 4fbd74c182f..00000000000 --- a/apps/reference/_supabase_js/generated/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_v2_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 - - - ColumnName - -

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

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

    -
    - -The operator to filter with. - -
    - -
  • - -
  • -

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

    -
    - -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/generated/or.mdx b/apps/reference/_supabase_js/generated/or.mdx deleted file mode 100644 index f448c047085..00000000000 --- a/apps/reference/_supabase_js/generated/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_v2_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. - -
    - -
  • - -
  • -

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

    -
    - -The foreign table to use (if `column` is a foreign column). - -
    - -
      -
      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 e5d0f3822cd..00000000000 --- a/apps/reference/_supabase_js/generated/order.mdx +++ /dev/null @@ -1,150 +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' - -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 - - - ColumnName - -

    -
    - -The column to order on. - -
    - -
  • - -
  • -

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

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

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

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

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

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

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

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
- -## 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 21d92e6ad7a..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' - -Finds all rows whose array or range value on the stated `column` overlaps -(has a value in common) with the specified `value`. - -```js -const { data, error } = await supabase - .from('countries') - .select('name, id, main_exports') - .overlaps('main_exports', ['computers', 'minerals']) -``` - -## Parameters - -
    - -
  • -

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

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

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

    -
    - -The 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 ffa3c3d597c..00000000000 --- a/apps/reference/_supabase_js/generated/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_v2_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. - -
    - -
  • - -
  • -

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

    -
    - -The foreign table to use (for foreign columns). - -
    - -
      -
      Properties
      - -
    • -

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

      -
      - -No description provided. - -
      - -
    • - -
    - -
  • - -
- -## 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 1affe88d70f..00000000000 --- a/apps/reference/_supabase_js/generated/rangeadjacent.mdx +++ /dev/null @@ -1,103 +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' - -Finds all rows whose range value on the stated `column` is adjacent to -the specified `range`. - -```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 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 15c346bc81f..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' - -Finds all rows whose range value on the stated `column` is strictly to -the right of the specified `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 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 5dd689bff4d..00000000000 --- a/apps/reference/_supabase_js/generated/rangegte.mdx +++ /dev/null @@ -1,103 +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' - -Finds all rows whose range value on the stated `column` does not extend -to the left of the specified `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 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 5252510dcf8..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' - -Finds all rows whose range value on the stated `column` is strictly to the -left of the specified `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 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 495037f6a6f..00000000000 --- a/apps/reference/_supabase_js/generated/rangelte.mdx +++ /dev/null @@ -1,103 +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' - -Finds all rows whose range value on the stated `column` does not extend -to the right of the specified `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 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 1fe6b7dc081..00000000000 --- a/apps/reference/_supabase_js/generated/rpc.mdx +++ /dev/null @@ -1,272 +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 parameters to pass to the function call. - -
    - -
  • - -
  • -

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

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

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

      -
      - -Count algorithm to use to count rows in a table. - -
      - -
        -
        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, no data will be returned. - -
      - -
    • - -
    • -

      - - rollback - - - optional - - - boolean - -

      -
      - -Rollback the operation - -
      - -
    • - -
    - -
  • - -
- -## 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 f857c1aa310..00000000000 --- a/apps/reference/_supabase_js/generated/select.mdx +++ /dev/null @@ -1,309 +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' - -Performs vertical filtering with SELECT. - -```js -const { data, error } = await supabase.from('cities').select() -``` - -## Parameters - -
    - -
  • -

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

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

    - - __namedParameters - - - required - - - object - -

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

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

      -
      - -Count algorithm to use to count rows in a table. - -
      - -
        -
        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, select will void data. - -
      - -
    • - -
    - -
  • - -
- -## 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 f8c0fe17ef5..00000000000 --- a/apps/reference/_supabase_js/generated/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_v2_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/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 14135ae9fff..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' - -Finds all rows whose text or tsvector value on the stated `column` matches -the tsquery in `query`. - -## Parameters - -
    - -
  • -

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

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

    - - query - - - required - - - string - -

    -
    - -The Postgres tsquery string to filter with. - -
    - -
  • - -
  • -

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

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

      - - config - - - optional - - - string - -

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

      - - type - - - optional - - - plain | phrase | websearch - -

      -
      - -No description provided. - -
      - -
        -
        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 1e01e58e41b..00000000000 --- a/apps/reference/_supabase_js/generated/update.mdx +++ /dev/null @@ -1,210 +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' - -Performs an UPDATE on the table. - -```js -const { data, error } = await supabase - .from('cities') - .update({ name: 'Middle Earth' }) - .match({ name: 'Auckland' }) -``` - -## Parameters - -
    - -
  • -

    - - values - - - required - - - Row - -

    -
    - -The values to update. - -
    - -
  • - -
  • -

    - - __namedParameters - - - required - - - object - -

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

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

      -
      - -Count algorithm to use to count rows in a table. - -
      - -
        -
        Properties
        - -
      • -

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

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

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

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

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

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

      - - rollback - - - optional - - - boolean - -

      -
      - -Rollback the operation - -
      - -
    • - -
    - -
  • - -
- -## 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 abd86057a36..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' - -Performs an UPSERT into the table. - -```js -const { data, error } = await supabase - .from('messages') - .upsert({ id: 3, message: 'foo', username: 'supabot' }) -``` - -## Parameters - -
    - -
  • -

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

    -
    - -The values to insert. - -
    - -
      -
      Properties
      - -
    • -

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

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

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

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

    - - __namedParameters - - - required - - - object - -

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

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

      -
      - -Count algorithm to use to count rows in a table. - -
      - -
        -
        Properties
        - -
      • -

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

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

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

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

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

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

      - - ignoreDuplicates - - - optional - - - boolean - -

      -
      - -Specifies if duplicate rows should be ignored and not inserted. - -
      - -
    • - -
    • -

      - - onConflict - - - optional - - - string - -

      -
      - -By specifying the `on_conflict` query parameter, you can make UPSERT work on a column(s) that has a UNIQUE constraint. - -
      - -
    • - -
    • -

      - - rollback - - - optional - - - boolean - -

      -
      - -Rollback the operation - -
      - -
    • - -
    - -
  • - -
- -## 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/release-notes.md b/apps/reference/_supabase_js/release-notes.md index 0865e2053ad..9a242632754 100644 --- a/apps/reference/_supabase_js/release-notes.md +++ b/apps/reference/_supabase_js/release-notes.md @@ -78,7 +78,7 @@ Previously `nullsFirst` defaults to `false` , meaning `null`s are ordered last. ### Cookies and localstorage namespace -Storage key name in the Auth library has changed to include project reference which means that existing website that had their JWT expiry set to a longer time could find their user’s logged out with this upgrade. +Storage key name in the Auth library has changed to include project reference which means that existing websites that had their JWT expiry set to a longer time could find their users logged out with this upgrade. ```jsx const defaultStorageKey = `sb-${ diff --git a/apps/reference/_supabase_js/working-with-types.md b/apps/reference/_supabase_js/working-with-types.md index a5c8900b532..90314b8fa92 100644 --- a/apps/reference/_supabase_js/working-with-types.md +++ b/apps/reference/_supabase_js/working-with-types.md @@ -31,7 +31,7 @@ interface Database { } ``` -There is a different between `selects`, `inserts`, and `updates`, because often you will set default values in your database for specific columns. +There is a difference between `selects`, `inserts`, and `updates`, because often you will set default values in your database for specific columns. With default values you do not need to send any data over the network, even if that column is a "required" field. Our type system is granular enough to handle these situations. 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 c9bc16d7e3a..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 links to be sent via email or other. - -## 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 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 8b62fc6e743..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/auth-api-resetpasswordforemail.mdx +++ /dev/null @@ -1,136 +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 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 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: - -```js -const { error, data } = await supabase.auth.api.updateUser(access_token, { - password: new_password, -}) -``` - -## Examples - -### Reset password - -```js -const { data, error } = await supabase.auth.api.resetPasswordForEmail( - 'user@email.com' -) -``` 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 c864b92e637..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: Email updates will send an email to both the user's current and new email with a confirmation link by default. -To toggle this behavior off and only send a single confirmation link to the new email, toggle "Double confirm email changes" under "Authentication" -> "Settings" off. - -User metadata: 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 email for 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 password for authenticated user. - -```js -const { user, error } = await supabase.auth.update({ password: 'new password' }) -``` - -### Update a 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..a5089800e99 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 --- -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..d4f3a229100 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 --- -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..5b95cefa7dc 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 --- -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..37dca1ccac5 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 --- -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 06f1ecb2aaa..00000000000 --- a/apps/reference/_supabase_js_versioned_docs/version-v1/upsert.mdx +++ /dev/null @@ -1,199 +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. - -## 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/about.mdx b/apps/reference/docs/about.mdx index aa1142a407c..07e696f4a9e 100755 --- a/apps/reference/docs/about.mdx +++ b/apps/reference/docs/about.mdx @@ -150,7 +150,7 @@ Supabase is just Postgres, which makes it compatible with a large number of tool
{frameworks.map((x) => ( -
+
) : ( `/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/auth.mdx b/apps/reference/docs/guides/auth.mdx index b6d661b8483..1505754d7ef 100644 --- a/apps/reference/docs/guides/auth.mdx +++ b/apps/reference/docs/guides/auth.mdx @@ -44,7 +44,7 @@ You can authenticate your users in several ways: ### Providers -We provide a suite of Providers and login methods, as well as [Auth helpers](/docs/guides/auth/auth-helpers/auth-ui). +We provide a suite of Providers and login methods, as well as [Auth helpers](/docs/guides/auth/auth-helpers/).
diff --git a/apps/reference/docs/guides/auth/auth-google.mdx b/apps/reference/docs/guides/auth/auth-google.mdx index ad0eef20f80..e3788c3f3aa 100644 --- a/apps/reference/docs/guides/auth/auth-google.mdx +++ b/apps/reference/docs/guides/auth/auth-google.mdx @@ -70,9 +70,9 @@ The next step requires a callback URL, which looks like this: /> -### Create your credentials +### Create your Google credentials -- Click `Credentials` at the left to go to the `Credentials` page +- Click `Credentials` at the left to go to the `Credentials` page on the Google Cloud Platform console. - Click `Create Credentials` near the top then select `OAuth client ID` - On the `Create OAuth client ID` page, select your application type. If you're not sure, choose `Web application`. - Fill in your app name. diff --git a/apps/reference/docs/guides/auth/auth-helpers/index.mdx b/apps/reference/docs/guides/auth/auth-helpers/index.mdx new file mode 100644 index 00000000000..91247a76c9c --- /dev/null +++ b/apps/reference/docs/guides/auth/auth-helpers/index.mdx @@ -0,0 +1,55 @@ +--- +id: index +title: Auth Helpers +description: A collection of framework-specific Auth utilities for working with Supabase. +sidebar_label: Overview +--- + +import useBaseUrl from '@docusaurus/useBaseUrl' +import ButtonCard from '@site/src/components/ButtonCard' + +A collection of framework-specific Auth utilities for working with Supabase. + +
+
+ {/* Auth UI */} +
+ +
+ {/* Next.js */} +
+ +
+ {/* SvelteKit */} +
+ +
+
+
+ +## Status + +The Auth Helpers are in `beta`. They are usable in their current state, but it's likely that there will be breaking changes. + +## Additional Links + +- [Source code](https://github.com/supabase/auth-helpers) +- [Known bugs and issues](https://github.com/supabase/auth-helpers/issues) diff --git a/apps/reference/docs/guides/auth/auth-helpers/nextjs.mdx b/apps/reference/docs/guides/auth/auth-helpers/nextjs.mdx new file mode 100644 index 00000000000..193a970ebe9 --- /dev/null +++ b/apps/reference/docs/guides/auth/auth-helpers/nextjs.mdx @@ -0,0 +1,319 @@ +--- +id: nextjs +title: Supabase Auth with Next.js +description: Authentication helpers for Next.js API routes, middleware, and SSR. +sidebar_label: "Next.js" +--- + +This submodule provides convenience helpers for implementing user authentication in Next.js applications. + +## Installation + +Using [npm](https://npmjs.org): + +```sh +npm install @supabase/auth-helpers-nextjs + +# Main components and hooks for React based frameworks (optional) +npm install @supabase/auth-helpers-react +``` + +Using [yarn](https://yarnpkg.com/): + +```sh +yarn add @supabase/auth-helpers-nextjs + +# Main components and hooks for React based frameworks (optional) +yarn add @supabase/auth-helpers-react +``` + +This library supports the following tooling versions: + +- Node.js: `^10.13.0 || >=12.0.0` + +- Next.js: `>=10` + +## Getting Started + +### Configuration + +Set up the following env vars. For local development you can set them in a `.env.local` file. See an [example](https://github.com/supabase/auth-helpers/blob/main/examples/nextjs/.env.local.example). + +```bash +# Find these in your Supabase project settings > API +NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co +NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key +``` + +### Basic Setup + +- Create an `auth` directory under the `/pages/api/` directory. + +- Create a `[...supabase].js` file under the newly created `auth` directory. + +The path to your dynamic API route file would be `/pages/api/auth/[...supabase].js`. Populate that file as follows: + +```js +import { handleAuth } from '@supabase/auth-helpers-nextjs' + +export default handleAuth({ logout: { returnTo: '/' } }) +``` + +Executing `handleAuth()` creates the following route handlers under the hood that perform different parts of the authentication flow: + +- `/api/auth/callback`: The `UserProvider` 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`: Your Next.js application logs out the user. You can optionally pass a `returnTo` parameter to return to a custom relative URL after logout, eg `/api/auth/logout?returnTo=/login`. This will overwrite the logout `returnTo` option specified `handleAuth()` + +Wrap your `pages/_app.js` component with the `UserProvider` component: + +```jsx +// pages/_app.js +import React from 'react' +import { UserProvider } from '@supabase/auth-helpers-react' +import { supabaseClient } from '@supabase/auth-helpers-nextjs' + +export default function App({ Component, pageProps }) { + return ( + + + + ) +} +``` + +You can now determine if a user is authenticated by checking that the `user` object returned by the `useUser()` hook is defined. + +## 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-nextjs` and only run your query once the user is defined client-side in the `useUser()` hook: + +```js +import { Auth } from '@supabase/ui' +import { useUser } from '@supabase/auth-helpers-react' +import { supabaseClient } from '@supabase/auth-helpers-nextjs' +import { useEffect, useState } from 'react' + +const LoginPage = () => { + const { user, error } = useUser() + const [data, setData] = useState() + + useEffect(() => { + async function loadData() { + const { data } = await supabaseClient.from('test').select('*') + setData(data) + } + // Only run query once user is logged in. + if (user) loadData() + }, [user]) + + if (!user) + return ( + <> + {error &&

{error.message}

} + + + ) + + return ( + <> + +

user:

+
{JSON.stringify(user, null, 2)}
+

client-side data fetching with RLS

+
{JSON.stringify(data, null, 2)}
+ + ) +} + +export default LoginPage +``` + +### Server-side rendering (SSR) - withPageAuth + +If you wrap your `getServerSideProps` with `withPageAuth` your props object will be augmented with the user object. + +```js +// pages/profile.js +import { withPageAuth } from '@supabase/auth-helpers-nextjs' + +export default function Profile({ user }) { + return
Hello {user.name}
+} + +export const getServerSideProps = withPageAuth({ redirectTo: '/login' }) +``` + +If there is no authenticated user, they will be redirect to your home page, unless you specify the `redirectTo` option. + +You can pass in your own `getServerSideProps` method, the props returned from this will be merged with the +user props. You can also access the user session data by calling `getUser` inside of this method, eg: + +```js +// pages/protected-page.js +import { withPageAuth, getUser } from '@supabase/auth-helpers-nextjs' + +export default function ProtectedPage({ user, customProp }) { + return
Protected content
+} + +export const getServerSideProps = withPageAuth({ + redirectTo: '/foo', + async getServerSideProps(ctx) { + // Access the user object + const { user, accessToken } = await getUser(ctx) + return { props: { email: user?.email } } + }, +}) +``` + +### 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: + +```js +import { + User, + withPageAuth, + supabaseServerClient, +} from '@supabase/auth-helpers-nextjs' + +export default function ProtectedPage({ + user, + data, +}: { + user: User, + data: any, +}) { + return ( + <> +
Protected content for {user.email}
+
{JSON.stringify(data, null, 2)}
+
{JSON.stringify(user, null, 2)}
+ + ) +} + +export const getServerSideProps = withPageAuth({ + redirectTo: '/', + async getServerSideProps(ctx) { + // Run queries with RLS on the server + const { data } = await supabaseServerClient(ctx).from('test').select('*') + return { props: { data } } + }, +}) +``` + +### Server-side data fetching to OAuth APIs using `provider_token` + +When using third-party auth providers, sessions are initiated with an additional `provider_token` field which is persisted as an HTTPOnly cookie upon logging in to enabled usage on the server side. The `provider_token` can be used to make API requests to the OAuth provider's API endpoints on behalf of the logged-in user. In the following example, we fetch the user's full profile from the third-party API during SSR using their id and auth token: + +```js +import { User, withPageAuth, getUser } from '@supabase/auth-helpers-nextjs' + +interface Profile { + /* ... */ +} + +export default function ProtectedPage({ + user, + data, +}: { + user: User, + profile: Profile, +}) { + return
Protected content
+} + +export const getServerSideProps = withPageAuth({ + redirectTo: '/', + async getServerSideProps(ctx) { + // Retrieve provider_token from cookies + const provider_token = ctx.req.cookies['sb-provider-token'] + // Get logged in user's third-party id from metadata + const { user } = await getUser(ctx) + const userId = user?.user_metadata.provider_id + const profile: Profile = await ( + await fetch(`https://api.example.com/users/${userId}`, { + method: 'GET', + headers: { + Authorization: `Bearer ${provider_token}`, + }, + }) + ).json() + return { props: { profile } } + }, +}) +``` + +## Protecting API routes + +Wrap an API Route to check that the user has a valid session. If they're not logged in the handler will return a +401 Unauthorized. + +```js +// pages/api/protected-route.js +import { + withApiAuth, + supabaseServerClient, +} from '@supabase/auth-helpers-nextjs' + +export default withApiAuth(async function ProtectedRoute(req, res) { + // Run queries with RLS on the server + const { data } = await supabaseServerClient({ req, res }) + .from('test') + .select('*') + res.json(data) +}) +``` + +If you visit `/api/protected-route` without a valid session cookie, you will get a 401 response. + +## Protecting routes with [Nextjs Middleware](https://nextjs.org/docs/middleware) + +As an alternative to protecting individual pages using `getServerSideProps` with `withPageAuth`, `withMiddlewareAuth` can be used from inside a `_middleware` file to protect an entire directory. In the following example, all requests to `/protected/*` will check whether a user is signed in, if successful the request will be forwarded to the destination route, otherwise the user will be redirected to `/login` (defaults to: `/`) with a 307 Temporary Redirect response status: + +```ts +// pages/protected/_middleware.ts +import { withMiddlewareAuth } from '@supabase/auth-helpers-nextjs/middleware' + +export const middleware = withMiddlewareAuth({ redirectTo: '/login' }) +``` + +It is also possible to add finer granularity based on the user logged in. I.e. you can specify a promise to determine if a specific user has permission or not. + +```ts +// pages/protected/_middleware.ts +import { withMiddlewareAuth } from '@supabase/auth-helpers-nextjs/dist/middleware' + +export const middleware = withMiddlewareAuth({ + redirectTo: '/login', + authGuard: { + isPermitted: async (user) => user.email?.endsWith('@example.com') ?? false, + redirectTo: '/insufficient-permissions', + }, +}) +``` + +## Migrating from @supabase/supabase-auth-helpers to @supabase/auth-helpers + +This is a step by step guide on migrating away from the `@supabase/supabase-auth-helpers` to the newly released `@supabase/auth-helpers`. + +1. Install `@supabase/supabase-js`, `@supabase/auth-helpers-nextjs` and `@supabase/auth-helpers-react` libraries from npm. +2. Replace all imports of `@supabase/supabase-auth-helpers/nextjs` in your project with `@supabase/auth-helpers-nextjs`. +3. Replace all imports of `@supabase/supabase-auth-helpers/react` in your project with `@supabase/auth-helpers-react`. +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 new file mode 100644 index 00000000000..849c9c5a771 --- /dev/null +++ b/apps/reference/docs/guides/auth/auth-helpers/sveltekit.mdx @@ -0,0 +1,309 @@ +--- +id: sveltekit +title: Supabase Auth with SvelteKit +description: Convenience helpers for implementing user authentication in SvelteKit. +sidebar_label: SvelteKit +--- + +This submodule provides convenience helpers for implementing user authentication in [SvelteKit](https://kit.svelte.dev/) applications. + +## Installation + +Using [npm](https://npmjs.org): + +```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 + +### Configuration + +Set up the fillowing env vars. For local development you can set them in a `.env` file. See an [example](https://github.com/supabase/auth-helpers/blob/main/examples/sveltekit/.env.example). + +```bash +# Find these in your Supabase project settings > API +VITE_SUPABASE_URL=https://your-project.supabase.co +VITE_SUPABASE_ANON_KEY=your-anon-key +``` + +### SupabaseClient and SupaAuthHelper component setup + +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. + +```ts +// 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 } +``` + +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 + + + + + +``` + +### 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' + +export const handle: Handle = sequence(...handleAuth()) + +export const getSession: GetSession = async (event) => { + 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 + +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. + +```ts +// 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 + } + interface Locals extends UserSession { + error: import('@supabase/supabase-js').ApiError + } + + 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. + +```html +Sign out +``` + +### Logout handler configuration + +In your `src/hooks.ts` file the logout handler is already setup and you can configure the redirect path from here. + +> 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 + + +{#if !$session.user} +

I am not logged in

+{:else} +

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 + + +{#if !$session.user} + {#if $error} +

{$error.message}

+ {/if} +

{$isLoading ? `Loading...` : `Loaded!`}

+ +{:else} + Sign out +

user:

+
{JSON.stringify($session.user, null, 2)}
+

client-side data fetching with RLS

+
{JSON.stringify(loadedData, null, 2)}
+{/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: + +```html + + + +
Protected content for {user.email}
+
{JSON.stringify(data, null, 2)}
+
{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[] +} + +export const GET: RequestHandler = async ({ locals }) => + withApiAuth( + { + redirectTo: '/', + user: locals.user, + }, + async () => { + const { data } = await supabaseServerClient(session.accessToken) + .from('test') + .select('*') + + return { + body: { + user: locals.user, + data, + }, + } + } + ) +``` + +## Protecting API routes + +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. + +```ts +// 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 +} + +interface GetOutput { + 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('*') + + return { + status: 200, + body: { data }, + } + }) +``` + +If you visit `/api/protected-route` without a valid session cookie, you will get a 303 response. + +## 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-linkedin.mdx b/apps/reference/docs/guides/auth/auth-linkedin.mdx index caf7eb602d1..db857f6fed4 100644 --- a/apps/reference/docs/guides/auth/auth-linkedin.mdx +++ b/apps/reference/docs/guides/auth/auth-linkedin.mdx @@ -14,7 +14,7 @@ To enable LinkedIn Auth for your project, you need to set up a LinkedIn OAuth ap Setting up LinkedIn logins for your application consists of 3 parts: - Create and configure a LinkedIn Project and App on the [LinkedIn Developer Dashboard](https://www.linkedin.com/developers/apps). -- Add your LinkedIn `API Key` and `API Secret Key` to your [Supabase Project](https://app.supabase.com). +- Add your LinkedIn `client_id` and `client_secret` to your [Supabase Project](https://app.supabase.com). - Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js). ## Steps @@ -65,7 +65,7 @@ The next step requires a callback URL, which looks like this: - Click `Settings` from the list to go to the `Authentication Settings` page. - Enter the final (hosted) URL of your app under `Site URL` (this is important). - Under `External OAuth Providers` turn `LinkedIn Enabled` to ON. -- Enter your `API Key` (`client_id`) and `API Secret Key` (`client_secret`) saved in the previous step. +- Enter your `client_id` and `client_secret` saved in the previous step. - Click `Save`. ### Add login code to your client app diff --git a/apps/reference/docs/guides/auth/row-level-security.mdx b/apps/reference/docs/guides/auth/row-level-security.mdx index 21c04b69e71..a103c6a676e 100644 --- a/apps/reference/docs/guides/auth/row-level-security.mdx +++ b/apps/reference/docs/guides/auth/row-level-security.mdx @@ -238,7 +238,7 @@ alter table leaderboard create policy "Only Blizzard staff can update leaderboard" on leaderboard for update using ( - right(auth.email(), 13) = '@blizzard.com' + right(auth.jwt() ->> 'email', 13) = '@blizzard.com' ); ``` 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 04ec661421f..ee4234bd43c 100644 --- a/apps/reference/docs/guides/database.mdx +++ b/apps/reference/docs/guides/database.mdx @@ -60,10 +60,12 @@ Supabase comes with a SQL Editor. You can also save your favorite queries to run - Supabase extends Postgres with realtime functionality using our [Realtime Server](https://github.com/supabase/realtime). - Every project is a full Postgres database, with `postgres` level access. -- Managed backups - Supabase handles all your database backups.[^backups] -- Data imports - import directly from a CSV or excel spreadsheet. +- Supabase manages your database backups. +- Import data directly from a CSV or excel spreadsheet. -[^backups] Database backups do _NOT_ include objects stored via the Storage API, as the database only includes metadata about these objects. Restoring an old backup will not restore objects that have been deleted since then. +:::info +Database backups **do not** include objects stored via the Storage API, as the database only includes metadata about these objects. Restoring an old backup does not restore objects that have been deleted since then. +::: ### Extensions @@ -83,157 +85,7 @@ 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; -``` - -### Migrating between projects - -Migrating projects can be achieved using standard PostgreSQL tooling. This is particularly useful for older projects (e.g. to use a newer Postgres version). - -#### Before you begin - -- Make sure [Postgres](https://www.postgresql.org/download/) is installed so you can run `psql` and `pg_dump`. -- Create a new Supabase project. -- If you enabled Database Webhooks on your old project, enable it on your new project. -- Store the old project's database URL as `$OLD_DB_URL` and the new project's as `$NEW_DB_URL`. - -#### Migrate the database - -1. Run `ALTER ROLE postgres SUPERUSER` in the _old_ project's SQL editor -2. Run `pg_dump --clean --if-exists --quote-all-identifiers -h $OLD_DB_URL -U postgres > dump.sql` from your terminal -3. Run `ALTER ROLE postgres NOSUPERUSER` in the _old_ project's SQL editor -4. Run `ALTER ROLE postgres SUPERUSER` in the _new_ project's SQL editor -5. Run `psql -h $NEW_DB_URL -U postgres -f dump.sql` from your terminal -6. Run `TRUNCATE storage.objects` in the _new_ project's SQL editor -7. Run `ALTER ROLE postgres NOSUPERUSER` in the _new_ project's SQL editor - -#### Migrate storage objects - -This script moves storage objects from one project to another. If you have more than 10k objects, we can move the objects for you. Just contact us at [support@supabase.io](mailto:support@supabase.io). - -```js -const { createClient } = require('@supabase/supabase-js') - -const OLD_PROJECT_URL = 'https://xxx.supabase.co' -const OLD_PROJECT_SERVICE_KEY = 'old-project-service-key-xxx' - -const NEW_PROJECT_URL = 'https://yyy.supabase.co' -const NEW_PROJECT_SERVICE_KEY = 'new-project-service-key-yyy' - -;(async () => { - const oldSupabaseRestClient = createClient( - OLD_PROJECT_URL, - OLD_PROJECT_SERVICE_KEY, - { - schema: 'storage', - } - ) - const oldSupabaseClient = createClient( - OLD_PROJECT_URL, - OLD_PROJECT_SERVICE_KEY - ) - const newSupabaseClient = createClient( - NEW_PROJECT_URL, - NEW_PROJECT_SERVICE_KEY - ) - - // make sure you update max_rows in postgrest settings if you have a lot of objects - // or paginate here - const { data: oldObjects, error } = await oldSupabaseRestClient - .from('objects') - .select() - if (error) { - console.log('error getting objects from old bucket') - throw error - } - - for (const objectData of oldObjects) { - console.log(`moving ${objectData.id}`) - try { - const { data, error: downloadObjectError } = - await oldSupabaseClient.storage - .from(objectData.bucket_id) - .download(objectData.name) - if (downloadObjectError) { - throw downloadObjectError - } - - const { _, error: uploadObjectError } = await newSupabaseClient.storage - .from(objectData.bucket_id) - .upload(objectData.name, data, { - upsert: true, - contentType: objectData.metadata.mimetype, - cacheControl: objectData.metadata.cacheControl, - }) - if (uploadObjectError) { - throw uploadObjectError - } - } catch (err) { - console.log('error moving ', objectData) - console.log(err) - } - } -})() -``` - -#### Caveats - -- The new project will have the old project's Storage buckets, but not the objects. You will need to migrate Storage objects manually. - -### Resetting your project password - -When you create a new project in Supabase we ask for a password. You can use this password to connect directly to your Postgres database. - -If you forget your password, you can reset it from the Dashboard under the database settings page. - -Read more in [Database Configuration](/docs/guides/database/managing-passwords). - -### Changing the timezone of your server. - -Your database is initialized with the UTC timezone. We recommend keeping it this way, as it is helpful for time calculations. -If, however, you want to update the timezone, you can do so using any of the [database timezones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). - -For example: - -```sql -alter database postgres set timezone to 'America/New_York'; -``` - -Read more in [Database Configuration](/docs/guides/database/managing-timezones). +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/connecting-to-postgres.mdx b/apps/reference/docs/guides/database/connecting-to-postgres.mdx index 39c3b284eda..3d05bfa1c74 100644 --- a/apps/reference/docs/guides/database/connecting-to-postgres.mdx +++ b/apps/reference/docs/guides/database/connecting-to-postgres.mdx @@ -112,12 +112,7 @@ This is the most granular option. Connections are returned to the pool after eve 3. Find your Connection Info and Connection String. Connection pooling is on port `6543`. ## Connecting with SSL diff --git a/apps/reference/docs/guides/database/extensions/pgtap.mdx b/apps/reference/docs/guides/database/extensions/pgtap.mdx index 17e82c5f200..ab1104e517d 100644 --- a/apps/reference/docs/guides/database/extensions/pgtap.mdx +++ b/apps/reference/docs/guides/database/extensions/pgtap.mdx @@ -106,7 +106,7 @@ API: ```sql begin; -select plan( 1 ); +select plan( 2 ); select has_column( 'profiles', 'id' ); select col_is_pk( 'profiles', 'id' ); diff --git a/apps/reference/docs/guides/database/migrating-between-projects.mdx b/apps/reference/docs/guides/database/migrating-between-projects.mdx new file mode 100644 index 00000000000..536fb45f810 --- /dev/null +++ b/apps/reference/docs/guides/database/migrating-between-projects.mdx @@ -0,0 +1,97 @@ +--- +id: migrating-between-projects +title: 'Migrating Between Projects' +description: Migrate data from one project to another +--- + +Migrating projects can be achieved using standard PostgreSQL tooling. This is particularly useful for older projects (e.g. to use a newer Postgres version). + +## Before you begin + +- Install [Postgres](https://www.postgresql.org/download/) so you can run `psql` and `pg_dump`. +- Create a new [Supabase project](https://app.supabase.com). +- Enable [Database Webhooks](https://app.supabase.com/project/_/database/hooks) in your new project if you enabled them in your old project. +- Store the old project's database URL as `$OLD_DB_URL` and the new project's as `$NEW_DB_URL`. + +## Migrate the database + +In your old project: +1. Run `ALTER ROLE postgres SUPERUSER` in the [SQL editor](https://app.supabase.com/project/_/sql). +1. Run `pg_dump --clean --if-exists --quote-all-identifiers -h $OLD_DB_URL -U postgres > dump.sql` from your terminal. +1. Run `ALTER ROLE postgres NOSUPERUSER` in the [SQL editor](https://app.supabase.com/project/_/sql). + +In your new project: +1. Run `ALTER ROLE postgres SUPERUSER` in the [SQL editor](https://app.supabase.com/project/_/sql). +1. Run `psql -h $NEW_DB_URL -U postgres -f dump.sql` from your terminal. +1. Run `TRUNCATE storage.objects` in the [SQL editor](https://app.supabase.com/project/_/sql). +1. Run `ALTER ROLE postgres NOSUPERUSER` in the [SQL editor](https://app.supabase.com/project/_/sql). + +## Migrate storage objects + +The new project has the old project's Storage buckets, but the Storage objects need to be migrated manually. Use this script to move storage objects from one project to another. If you have more than 10k objects, we can move the objects for you. Just contact us at [support@supabase.io](mailto:support@supabase.io). + +```js +const { createClient } = require('@supabase/supabase-js') + +const OLD_PROJECT_URL = 'https://xxx.supabase.co' +const OLD_PROJECT_SERVICE_KEY = 'old-project-service-key-xxx' + +const NEW_PROJECT_URL = 'https://yyy.supabase.co' +const NEW_PROJECT_SERVICE_KEY = 'new-project-service-key-yyy' + +;(async () => { + const oldSupabaseRestClient = createClient( + OLD_PROJECT_URL, + OLD_PROJECT_SERVICE_KEY, + { + schema: 'storage', + } + ) + const oldSupabaseClient = createClient( + OLD_PROJECT_URL, + OLD_PROJECT_SERVICE_KEY + ) + const newSupabaseClient = createClient( + NEW_PROJECT_URL, + NEW_PROJECT_SERVICE_KEY + ) + + // make sure you update max_rows in postgrest settings if you have a lot of objects + // or paginate here + const { data: oldObjects, error } = await oldSupabaseRestClient + .from('objects') + .select() + if (error) { + console.log('error getting objects from old bucket') + throw error + } + + for (const objectData of oldObjects) { + console.log(`moving ${objectData.id}`) + try { + const { data, error: downloadObjectError } = + await oldSupabaseClient.storage + .from(objectData.bucket_id) + .download(objectData.name) + if (downloadObjectError) { + throw downloadObjectError + } + + const { _, error: uploadObjectError } = await newSupabaseClient.storage + .from(objectData.bucket_id) + .upload(objectData.name, data, { + upsert: true, + contentType: objectData.metadata.mimetype, + cacheControl: objectData.metadata.cacheControl, + }) + if (uploadObjectError) { + throw uploadObjectError + } + } catch (err) { + console.log('error moving ', objectData) + console.log(err) + } + } +})() +``` + diff --git a/apps/reference/docs/guides/examples.mdx b/apps/reference/docs/guides/examples.mdx index 13bc61a4d3a..db3d704842b 100644 --- a/apps/reference/docs/guides/examples.mdx +++ b/apps/reference/docs/guides/examples.mdx @@ -130,6 +130,7 @@ Build a basic Todo List with Supabase and your favorite frontend framework: - Supabase + Nuxt3 + nuxtjs/supabase [Github](https://github.com/nuxt-community/supabase-module/tree/main/demo) - Supabase + Ory Kratos & Ory Oathkeeper [Github](https://github.com/ory/examples/tree/master/kratos-keto-oathkeeper-supabase) - Supabase + Ory Cloud [Github](https://github.com/ory/examples/tree/master/supabase-ory-cloud) +- Supabase Auth with React Native + Next.js (Monorepo) [Github](https://github.com/mateoguzmana/react-native-next-supabase-auth-monorepo) ### Blog Posts 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/sequin.mdx b/apps/reference/docs/guides/integrations/sequin.mdx new file mode 100644 index 00000000000..3ba6e7afae9 --- /dev/null +++ b/apps/reference/docs/guides/integrations/sequin.mdx @@ -0,0 +1,84 @@ +--- +id: sequin +title: 'Sequin' +description: 'Sync platforms like Stripe and Salesforce with your Supabase database in real-time using Sequin.' +--- + +This guide explains how to quickly setup a sync between Sequin and a Supabase Postgres database. + +[Sequin](https://sequin.io) allows you to sync platforms like Stripe and Salesforce with Supabase in real-time. You'll be able to read and write to your [Stripe](https://stripe.com/) customers or [Salesforce](https://www.salesforce.com/) accounts right from the Supabase client using SQL. Here's how to get setup. + +## Step 1: Connect Sequin to Supabase + +To connect Supabase to Sequin, you'll first need to retrieve the credentials for your Supabase Postgres database: + +1. In the Supabase dashboard, go to the settings page and open up your **Database** settings. In the **Connection info** section, you'll find the credentials you need - like `host` and `user`: + + ![TBD](/img/guides/integrations/sequin/001_supabase_dash.png) + +2. In the [Sequin console](https://app.sequin.io), go to your sync's configuration and open the **Destination** section. Select **Launch or Connect** and then click **Connect** to configure the connection to your Supabase Postgres: + + ![TBD](/img/guides/integrations/sequin/002_connect.png) + +3. In the connection modal that appears, enter the `Host` and `Port` for your Supabase database and click **Continue**. + + ![TBD](/img/guides/integrations/sequin/003_step_1.png) + +4. Now, enter the `Database name` and set the `schema` name for your sync. For instance, if your syncing Stripe, you'll likely want to name your synced schema something like `stripe`. Finally, enter the `user` and `password` for your Supabase database and then click **Continue**. Sequin will verify it can properly connect to your database with the correct permissions. + + ![TBD](/img/guides/integrations/sequin/004_step_2.png) + +5. Sequin is now connected to your Supabase Postgres database and will ask you to confirm which database users should be able to access your synced schema. Select all of the users and click **Continue**: + + ![TBD](/img/guides/integrations/sequin/005_step_3.png) + +6. That's it. Sequin will now create a new schema and permissions group in your Supabase database. Name the database connection in Sequin something like `Supabase` and your done! + +In the Supabase dashboard, you can go to the **Table Editor** and you'll see a new schema full of your synced platform data. + +![TBD](/img/guides/integrations/sequin/006_see_data.png) + +## Step 2: Grant Permissions + +To ensure the right users can access the synced schema Sequin manages, you'll need to run a couple permission grants. + +1. In the Sequin console, click the **Connect** button next to your sync and copy down your `Schema` and unique `Read Group`. + + ![TBD](/img/guides/integrations/sequin/007_get_read.png) + +2. Now, in the Supabase dashboard, go to the **SQL Editor** and run the following permission grants: + + ```sql + GRANT sequin_read_▒▒▒▒ TO postgres, anon, authenticated, service_role; + + GRANT USAGE ON SCHEMA {{your_schema_name}} TO anon, authenticated, service_role; + + GRANT ALL ON ALL TABLES IN SCHEMA {{your_schema_name}} TO anon, authenticated, service_role; + + ALTER DEFAULT PRIVILEGES FOR ROLE postgres, supabase_admin IN SCHEMA {{your_schema_name}} GRANT ALL ON TABLES TO anon, authenticated, service_role; + ``` + + These permission grants ensure that the various Supabase database users can access and read all the tables in your synced schema. + +## Step 3: Configure the Supabase Client + +Finally, you'll need to define a new [Supabase client](https://supabase.com/docs/reference/javascript/initializing#api-schemas) in your application to access your synced schema. In the file where you initialized your Supabase client, define a new client with a `schema` parameter: + +```javascript +export const supabase_schema = createClient( + 'https://xyzcompany.supabase.co', + 'public-anon-key', + { + schema: {{your_schema_name}}, + } +); +``` + +You'll use this client to query for data in your synced schema. + +## Resources + +- [Sequin](https://sequin.io*) official website. +- [Sequin Console](https://app.sequin.io*). +- [Sequin](https://docs.sequin.io/welcome) documentation. +- [Sequin + Supabase + Stripe Tutorial](https://github.com/sequin-io/build-a-saas-with-next-js-supabase-stripe-and-sequin) diff --git a/apps/reference/docs/guides/migrations/heroku.mdx b/apps/reference/docs/guides/migrations/heroku.mdx index 2701312e3af..c77546484d4 100644 --- a/apps/reference/docs/guides/migrations/heroku.mdx +++ b/apps/reference/docs/guides/migrations/heroku.mdx @@ -7,6 +7,8 @@ sidebar_label: Heroku Supabase is one of the best [free alternatives to Heroku Postgres](https://supabase.com/alternatives/supabase-vs-heroku-postgres). This guide shows how to migrate your Heroku Postgres database to Supabase. This migration requires the [pg_dump](https://www.postgresql.org/docs/current/app-pgdump.html) and [psql](https://www.postgresql.org/docs/current/app-psql.html) CLI tools, which are installed automatically as part of the complete PostgreSQL installation package. +Alternatively, use the [Heroku to Supabase migration tool](https://migrate.supabase.com/) to migrate in just a few clicks. + ## Quick demo
diff --git a/apps/reference/docs/guides/platform/disk-usage.mdx b/apps/reference/docs/guides/platform/disk-usage.mdx new file mode 100644 index 00000000000..d59a90db9f2 --- /dev/null +++ b/apps/reference/docs/guides/platform/disk-usage.mdx @@ -0,0 +1,26 @@ +--- +id: disk-usage +title: Disk space usage +description: Learn how database disk space usage is reported. +--- + + +Database disk space usage refers to the _monthly average disk usage_, as reported by Postgres. This metric is reported in your project's [billing page](https://app.supabase.com/project/_/settings/billing) and is updated daily. + +For an instantaneous live view of the DB disk space being used by your project, you can execute in Postgres: + +```sql +SELECT SUM(pg_database_size(pg_database.datname)) / (1024 * 1024) as db_size_mb FROM pg_database; +``` + +This value is also reported in the [database settings page](https://app.supabase.com/project/_/settings/database). + +## Vacuum operations + +Postgres does not immediately reclaim the physical space used by dead tuples (i.e., deleted rows) in the DB. Instead, they are internally marked as removed until a [vacuum operation](https://www.postgresql.org/docs/current/routine-vacuuming.html) is executed. As a result, deleting data from your DB may not immediately reduce the reported disk usage. + +:::note +Vacuum operations can temporarily increase resource utilization, which can adversely impact the observed performance of your project until the maintenance is completed. +::: + +Supabase projects have automatic vacuuming enabled, which ensures that these operations are performed regularly to keep the database healthy and performant. However, it can be necessary to either [fine-tune](https://www.percona.com/blog/2018/08/10/tuning-autovacuum-in-postgresql-and-autovacuum-internals/) [the autovacuum parameters](https://www.enterprisedb.com/blog/postgresql-vacuum-and-analyze-best-practice-tips), or [manually initiate](https://www.postgresql.org/docs/current/sql-vacuum.html) vacuum operations. For example, running a manual vacuum after deleting large amounts of data from your DB could help reduce the reported disk usage by Postgres. diff --git a/apps/reference/docs/guides/platform/performance.mdx b/apps/reference/docs/guides/platform/performance.mdx index 300d70674cd..07dfa92dc61 100644 --- a/apps/reference/docs/guides/platform/performance.mdx +++ b/apps/reference/docs/guides/platform/performance.mdx @@ -30,7 +30,19 @@ $ psql -U postgres -h ... FATAL: remaining connection slots are reserved for non-replication superuser connections ``` -In such a scenario, you can consider either upgrading to a larger compute add-on, or alternatively, by manually configuring the database for a higher number of connections. +In such a scenario, you can consider: + +- [upgrading to a larger compute add-on](https://app.supabase.com/project/_/settings/billing) +- configuring your clients to use fewer connections +- manually configuring the database for a higher number of connections + +### Configuring clients to use fewer connections + +You can use the [pg_stat_activity](https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ACTIVITY-VIEW) view to debug which clients are holding open connections on your DB. `pg_stat_activity` only exposes information on direct connections to the database. Information on the number of connections to pgbouncer is available [via the metrics endpoint](../platform/metrics). + +Depending on the clients involved, you might be able to configure them to work with fewer connections (e.g. by imposing a limit on the maximum number of connections they're allowed to use), or shift specific workloads to connect via [pgbouncer](/docs/guides/database/connecting-to-postgres#connection-pool) instead. Transient workflows, which can quickly scale up and down in response to traffic (e.g. serverless functions), can especially benefit from using a connection pooler rather than connecting to the DB directly. + +### Allowing higher number of connections You can configure Postgres by executing the following statement, followed by a server restart: 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/realtime/presence.mdx b/apps/reference/docs/guides/realtime/presence.mdx index 96dc472728c..f98b99924d6 100644 --- a/apps/reference/docs/guides/realtime/presence.mdx +++ b/apps/reference/docs/guides/realtime/presence.mdx @@ -31,11 +31,11 @@ channel .on('presence', { event: 'sync' }, () => { console.log('currently online users', channel.presenceState()) }) - .on('presence', { event: 'join' }, ({ newUser }) => { - console.log('a new user has joined', newUser) + .on('presence', { event: 'join' }, ({ newPresences }) => { + console.log('new users have joined', newPresences) }) - .on('presence', { event: 'leave' }, ({ leftUser }) => - console.log('a user has left', leftUser) + .on('presence', { event: 'leave' }, ({ leftPresences }) => + console.log('users have left', leftPresences) ) .subscribe(async (status) => { if (status === 'SUBSCRIBED') { diff --git a/apps/reference/docs/guides/storage-cdn.mdx b/apps/reference/docs/guides/storage-cdn.mdx new file mode 100644 index 00000000000..7527c9e8c3c --- /dev/null +++ b/apps/reference/docs/guides/storage-cdn.mdx @@ -0,0 +1,34 @@ +--- +id: storage-cdn +title: Storage CDN +description: How Supabase Storage caches objects with a CDN +sidebar_label: CDN +--- + +## CDN basics + +All assets uploaded to storage are cached on a Content Delivery Network (CDN). + +To improve the latency for users all around the world, Supabase uses a CDN. CDNs are a geographically distributed set of servers or **nodes** which caches content from an **origin server**. For Supabase Storage, the origin is the storage server running in the [same region as your project](https://app.supabase.com/project/_/settings/general). + +Let’s walk through an example of how a CDN helps with performance. A new bucket is created for a Supabase project launched in Singapore. All requests to the Supabase Storage API first hit the CDN. A user from the United States requests an object and is routed to the U.S. CDN. At this point, that CDN node does not have the object in its cache and pings the origin server in Singapore. Another user, also in the United States, requests the same object and is served directly from the CDN cache in the United States instead of routing the request back to Singapore. + +Aside from performance, CDNs also help with security and availability by mitigating Distributed Denial of Service and other application attacks. + +## Cache duration + +By default, assets are cached both in the CDN and in the user’s browser for 1 hour. After this, the CDN nodes ping the storage server to see if an object has been updated. + +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. + +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.