From 69ce915a9e25136ee291665bde5e406473ec1ff9 Mon Sep 17 00:00:00 2001 From: Ivan Vasilov Date: Wed, 11 Feb 2026 10:23:16 +0100 Subject: [PATCH] chore: Rename `SUPABASE_PUBLISHABLE_OR_ANON_KEY` to `SUPABASE_PUBLISHABLE_KEY` for all blocks (#42652) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR renames all `SUPABASE_PUBLISHABLE_OR_ANON_KEY` env vars into `SUPABASE_PUBLISHABLE_KEY` to make the new API keys default. This is in coordination with the rest of the docs. I've also cleaned up the `blocks/vue` package from unused files. ## Summary by CodeRabbit * **Breaking Changes** * Public environment variable names renamed from PUBLISHABLE_OR_ANON_KEY → PUBLISHABLE_KEY across all framework integrations; update your environment configs. * **Documentation** * All framework guides, .env examples and registry docs updated to use the new variable names. * **Chores** * Cleaned up UI registry/templates: some example Vue registry items and autogenerated registry artifacts were removed or simplified. --- apps/ui-library/.env | 2 +- .../ui-library/content/docs/nextjs/client.mdx | 2 +- .../docs/nextjs/password-based-auth.mdx | 2 +- .../content/docs/nextjs/social-auth.mdx | 2 +- .../ui-library/content/docs/nuxtjs/client.mdx | 2 +- .../docs/nuxtjs/password-based-auth.mdx | 2 +- .../content/docs/nuxtjs/social-auth.mdx | 2 +- .../content/docs/react-router/client.mdx | 2 +- .../docs/react-router/password-based-auth.mdx | 2 +- .../content/docs/react-router/social-auth.mdx | 2 +- apps/ui-library/content/docs/react/client.mdx | 2 +- .../docs/react/password-based-auth.mdx | 2 +- .../content/docs/react/social-auth.mdx | 2 +- .../content/docs/tanstack/client.mdx | 2 +- .../docs/tanstack/password-based-auth.mdx | 2 +- .../content/docs/tanstack/social-auth.mdx | 2 +- apps/ui-library/content/docs/vue/client.mdx | 2 +- .../content/docs/vue/password-based-auth.mdx | 2 +- .../content/docs/vue/social-auth.mdx | 2 +- apps/ui-library/public/r/ai-editor-rules.json | 2 +- .../public/r/current-user-avatar-nextjs.json | 10 +- .../r/current-user-avatar-react-router.json | 8 +- .../public/r/current-user-avatar-react.json | 6 +- .../r/current-user-avatar-tanstack.json | 8 +- apps/ui-library/public/r/dropzone-nextjs.json | 10 +- apps/ui-library/public/r/dropzone-nuxtjs.json | 2 +- .../public/r/dropzone-react-router.json | 8 +- apps/ui-library/public/r/dropzone-react.json | 6 +- .../public/r/dropzone-tanstack.json | 8 +- apps/ui-library/public/r/dropzone-vue.json | 2 +- .../public/r/password-based-auth-nextjs.json | 10 +- .../public/r/password-based-auth-nuxtjs.json | 2 +- .../r/password-based-auth-react-router.json | 8 +- .../public/r/password-based-auth-react.json | 6 +- .../r/password-based-auth-tanstack.json | 8 +- .../r/realtime-avatar-stack-nextjs.json | 10 +- .../r/realtime-avatar-stack-react-router.json | 8 +- .../public/r/realtime-avatar-stack-react.json | 6 +- .../r/realtime-avatar-stack-tanstack.json | 8 +- .../public/r/realtime-chat-nextjs.json | 10 +- .../public/r/realtime-chat-react-router.json | 8 +- .../public/r/realtime-chat-react.json | 6 +- .../public/r/realtime-chat-tanstack.json | 8 +- .../public/r/realtime-cursor-nextjs.json | 10 +- .../public/r/realtime-cursor-nuxtjs.json | 2 +- .../r/realtime-cursor-react-router.json | 8 +- .../public/r/realtime-cursor-react.json | 6 +- .../public/r/realtime-cursor-tanstack.json | 8 +- .../public/r/realtime-cursor-vue.json | 2 +- apps/ui-library/public/r/registry.json | 136 +++++++------- .../public/r/social-auth-nextjs.json | 10 +- .../public/r/social-auth-nuxtjs.json | 4 +- .../public/r/social-auth-react-router.json | 8 +- .../public/r/social-auth-react.json | 6 +- .../public/r/social-auth-tanstack.json | 8 +- .../public/r/supabase-client-nextjs.json | 10 +- .../public/r/supabase-client-nuxtjs.json | 12 +- .../r/supabase-client-react-router.json | 8 +- .../public/r/supabase-client-react.json | 6 +- .../public/r/supabase-client-tanstack.json | 8 +- .../public/r/supabase-client-vue.json | 6 +- .../writing-supabase-edge-functions.mdc | 2 +- .../clients/nextjs/lib/supabase/client.ts | 2 +- .../clients/nextjs/lib/supabase/middleware.ts | 2 +- .../clients/nextjs/lib/supabase/server.ts | 2 +- .../default/clients/nextjs/registry-item.json | 4 +- .../react-router/lib/supabase/client.ts | 2 +- .../react-router/lib/supabase/server.ts | 2 +- .../clients/react-router/registry-item.json | 4 +- .../clients/react/lib/supabase/client.ts | 2 +- .../default/clients/react/registry-item.json | 4 +- .../clients/tanstack/lib/supabase/client.ts | 2 +- .../clients/tanstack/lib/supabase/server.ts | 2 +- .../clients/tanstack/registry-item.json | 4 +- .../default/fixtures/lib/supabase/client.ts | 2 +- blocks/vue/__registry__/index.tsx | 33 ---- blocks/vue/lib/process-registry.ts | 86 --------- blocks/vue/package.json | 3 +- .../public/r/password-based-auth-nuxtjs.json | 96 ---------- .../vue/public/r/password-based-auth-vue.json | 42 ----- blocks/vue/registry.json | 168 ------------------ .../clients/nuxtjs/lib/supabase/client.ts | 2 +- .../default/clients/nuxtjs/registry-item.json | 4 +- .../clients/nuxtjs/server/api/profile.get.ts | 21 +-- .../server/middleware/is-authenticated.ts | 7 +- .../clients/nuxtjs/server/supabase/client.ts | 6 +- .../clients/vue/lib/supabase/client.ts | 2 +- .../default/clients/vue/registry-item.json | 4 +- .../app/composables/useSupabaseUpload.ts | 46 ++--- .../dropzone/nuxtjs/registry-item.json | 2 +- .../vue/composables/useSupabaseUpload.ts | 46 ++--- .../default/dropzone/vue/registry-item.json | 2 +- blocks/vue/registry/default/lib/utils.ts | 8 +- .../nuxtjs/server/routes/auth/confirm.get.ts | 3 +- .../app/composables/useRealtimeCursors.ts | 29 +-- .../realtime-cursor/nuxtjs/registry-item.json | 2 +- .../vue/composables/useRealtimeCursors.ts | 29 +-- .../realtime-cursor/vue/registry-item.json | 2 +- .../nuxtjs/server/middleware/auth.ts | 7 +- .../nuxtjs/server/routes/auth/oauth.ts | 13 +- blocks/vue/registry/password-based-auth.ts | 1 + blocks/vue/registry/social-auth.ts | 3 +- blocks/vue/tsconfig.base.json | 20 --- blocks/vue/tsconfig.json | 31 ++-- blocks/vue/tsconfig.scripts.json | 13 -- package.json | 4 +- pnpm-lock.yaml | 6 +- 107 files changed, 390 insertions(+), 851 deletions(-) delete mode 100644 blocks/vue/__registry__/index.tsx delete mode 100644 blocks/vue/lib/process-registry.ts delete mode 100644 blocks/vue/public/r/password-based-auth-nuxtjs.json delete mode 100644 blocks/vue/public/r/password-based-auth-vue.json delete mode 100644 blocks/vue/registry.json delete mode 100644 blocks/vue/tsconfig.base.json delete mode 100644 blocks/vue/tsconfig.scripts.json diff --git a/apps/ui-library/.env b/apps/ui-library/.env index 93da796409a..47f9a48d19b 100644 --- a/apps/ui-library/.env +++ b/apps/ui-library/.env @@ -1,5 +1,5 @@ # Default to local supabase for local development NEXT_PUBLIC_SUPABASE_URL=http://localhost:54321 -NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0 +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0 NEXT_PUBLIC_BASE_PATH=/ui NEXT_PUBLIC_API_URL="http://localhost:8080/platform" \ No newline at end of file diff --git a/apps/ui-library/content/docs/nextjs/client.mdx b/apps/ui-library/content/docs/nextjs/client.mdx index 57b803cf90c..10e7245ace5 100644 --- a/apps/ui-library/content/docs/nextjs/client.mdx +++ b/apps/ui-library/content/docs/nextjs/client.mdx @@ -23,7 +23,7 @@ After installing the block, you'll have the following environment variables in y ```env NEXT_PUBLIC_SUPABASE_URL= -NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY= +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY= ``` - If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true&connectTab=frameworks&framework=nextjs) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api). diff --git a/apps/ui-library/content/docs/nextjs/password-based-auth.mdx b/apps/ui-library/content/docs/nextjs/password-based-auth.mdx index 42ca65c26df..07b126ab2ea 100644 --- a/apps/ui-library/content/docs/nextjs/password-based-auth.mdx +++ b/apps/ui-library/content/docs/nextjs/password-based-auth.mdx @@ -28,7 +28,7 @@ After installing the block, you'll have the following environment variables in y ```env NEXT_PUBLIC_SUPABASE_URL= -NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY= +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY= ``` - If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true&connectTab=frameworks&framework=nextjs) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api). diff --git a/apps/ui-library/content/docs/nextjs/social-auth.mdx b/apps/ui-library/content/docs/nextjs/social-auth.mdx index 9f7d7ef471f..114c60bb717 100644 --- a/apps/ui-library/content/docs/nextjs/social-auth.mdx +++ b/apps/ui-library/content/docs/nextjs/social-auth.mdx @@ -30,7 +30,7 @@ After installing the block, you'll have the following environment variables in y ```env NEXT_PUBLIC_SUPABASE_URL= -NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY= +NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY= ``` - If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true&connectTab=frameworks&framework=nextjs) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api). diff --git a/apps/ui-library/content/docs/nuxtjs/client.mdx b/apps/ui-library/content/docs/nuxtjs/client.mdx index 01982c0a2db..e5a39cd5606 100644 --- a/apps/ui-library/content/docs/nuxtjs/client.mdx +++ b/apps/ui-library/content/docs/nuxtjs/client.mdx @@ -23,7 +23,7 @@ After installing the block, you'll have the following environment variables in y ```env NUXT_PUBLIC_SUPABASE_URL= -NUXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY= +NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY= ``` - If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true&connectTab=frameworks&framework=nuxt&using=supabasejs) under App Frameworks or in your project's [API keys](https://supabase.com/dashboard/project/_/settings/api-keys). diff --git a/apps/ui-library/content/docs/nuxtjs/password-based-auth.mdx b/apps/ui-library/content/docs/nuxtjs/password-based-auth.mdx index a49337cf2b7..6b606e77ca4 100644 --- a/apps/ui-library/content/docs/nuxtjs/password-based-auth.mdx +++ b/apps/ui-library/content/docs/nuxtjs/password-based-auth.mdx @@ -28,7 +28,7 @@ After installing the block, you'll have the following environment variables in y ```env NUXT_PUBLIC_SUPABASE_URL= -NUXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY= +NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY= ``` - If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api). diff --git a/apps/ui-library/content/docs/nuxtjs/social-auth.mdx b/apps/ui-library/content/docs/nuxtjs/social-auth.mdx index c1f12d6d57e..47b0f62b2ab 100644 --- a/apps/ui-library/content/docs/nuxtjs/social-auth.mdx +++ b/apps/ui-library/content/docs/nuxtjs/social-auth.mdx @@ -30,7 +30,7 @@ After installing the block, you'll have the following environment variables in y ```env NUXT_PUBLIC_SUPABASE_URL= -NUXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY= +NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY= ``` - If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true&connectTab=frameworks&framework=nuxtjs&using=supabasejs) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api). diff --git a/apps/ui-library/content/docs/react-router/client.mdx b/apps/ui-library/content/docs/react-router/client.mdx index e82cf870707..c8ba91f03f0 100644 --- a/apps/ui-library/content/docs/react-router/client.mdx +++ b/apps/ui-library/content/docs/react-router/client.mdx @@ -23,7 +23,7 @@ After installing the block, you'll have the following environment variables in y ```env VITE_SUPABASE_URL= -VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY= +VITE_SUPABASE_PUBLISHABLE_KEY= ``` - If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true&connectTab=frameworks&framework=react&using=vite&with=supabasejs) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api). diff --git a/apps/ui-library/content/docs/react-router/password-based-auth.mdx b/apps/ui-library/content/docs/react-router/password-based-auth.mdx index f9c77ca586f..a271e69d9ba 100644 --- a/apps/ui-library/content/docs/react-router/password-based-auth.mdx +++ b/apps/ui-library/content/docs/react-router/password-based-auth.mdx @@ -28,7 +28,7 @@ After installing the block, you'll have the following environment variables in y ```env VITE_SUPABASE_URL= -VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY= +VITE_SUPABASE_PUBLISHABLE_KEY= ``` - If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true&connectTab=frameworks&framework=react&using=vite&with=supabasejs) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api). diff --git a/apps/ui-library/content/docs/react-router/social-auth.mdx b/apps/ui-library/content/docs/react-router/social-auth.mdx index 27322ca24ec..b0689a4f52d 100644 --- a/apps/ui-library/content/docs/react-router/social-auth.mdx +++ b/apps/ui-library/content/docs/react-router/social-auth.mdx @@ -33,7 +33,7 @@ After installing the block, you'll have the following environment variables in y ```env VITE_SUPABASE_URL= -VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY= +VITE_SUPABASE_PUBLISHABLE_KEY= ``` - If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true&connectTab=frameworks&framework=react&using=vite&with=supabasejs) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api). diff --git a/apps/ui-library/content/docs/react/client.mdx b/apps/ui-library/content/docs/react/client.mdx index c1ad0c4e770..6a04875c602 100644 --- a/apps/ui-library/content/docs/react/client.mdx +++ b/apps/ui-library/content/docs/react/client.mdx @@ -23,7 +23,7 @@ After installing the block, you'll have the following environment variables in y ```env VITE_SUPABASE_URL= -VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY= +VITE_SUPABASE_PUBLISHABLE_KEY= ``` - If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true&connectTab=frameworks&framework=react&using=vite&with=supabasejs) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api). diff --git a/apps/ui-library/content/docs/react/password-based-auth.mdx b/apps/ui-library/content/docs/react/password-based-auth.mdx index 58caffd2e7e..5b69ac6ca96 100644 --- a/apps/ui-library/content/docs/react/password-based-auth.mdx +++ b/apps/ui-library/content/docs/react/password-based-auth.mdx @@ -28,7 +28,7 @@ After installing the block, you'll have the following environment variables in y ```env VITE_SUPABASE_URL= -VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY= +VITE_SUPABASE_PUBLISHABLE_KEY= ``` - If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true&connectTab=frameworks&framework=react&using=vite&with=supabasejs) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api). diff --git a/apps/ui-library/content/docs/react/social-auth.mdx b/apps/ui-library/content/docs/react/social-auth.mdx index 5f2561cc950..3d617f35e06 100644 --- a/apps/ui-library/content/docs/react/social-auth.mdx +++ b/apps/ui-library/content/docs/react/social-auth.mdx @@ -30,7 +30,7 @@ After installing the block, you'll have the following environment variables in y ```env VITE_SUPABASE_URL= -VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY= +VITE_SUPABASE_PUBLISHABLE_KEY= ``` - If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true&connectTab=frameworks&framework=react&using=vite&with=supabasejs) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api). diff --git a/apps/ui-library/content/docs/tanstack/client.mdx b/apps/ui-library/content/docs/tanstack/client.mdx index 25ea4660d01..ae707e8f7ef 100644 --- a/apps/ui-library/content/docs/tanstack/client.mdx +++ b/apps/ui-library/content/docs/tanstack/client.mdx @@ -25,7 +25,7 @@ After installing the block, you'll have the following environment variables in y ```env VITE_SUPABASE_URL= -VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY= +VITE_SUPABASE_PUBLISHABLE_KEY= ``` - If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true&connectTab=frameworks&framework=react&using=vite&with=supabasejs) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api). diff --git a/apps/ui-library/content/docs/tanstack/password-based-auth.mdx b/apps/ui-library/content/docs/tanstack/password-based-auth.mdx index a141edc9574..22380eae482 100644 --- a/apps/ui-library/content/docs/tanstack/password-based-auth.mdx +++ b/apps/ui-library/content/docs/tanstack/password-based-auth.mdx @@ -25,7 +25,7 @@ After installing the block, you'll have the following environment variables in y ```env VITE_SUPABASE_URL= -VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY= +VITE_SUPABASE_PUBLISHABLE_KEY= ``` - If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true&connectTab=frameworks&framework=react&using=vite&with=supabasejs) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api). diff --git a/apps/ui-library/content/docs/tanstack/social-auth.mdx b/apps/ui-library/content/docs/tanstack/social-auth.mdx index 6e00652150f..5081ff963d8 100644 --- a/apps/ui-library/content/docs/tanstack/social-auth.mdx +++ b/apps/ui-library/content/docs/tanstack/social-auth.mdx @@ -30,7 +30,7 @@ After installing the block, you'll have the following environment variables in y ```env VITE_SUPABASE_URL= -VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY= +VITE_SUPABASE_PUBLISHABLE_KEY= ``` - If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true&connectTab=frameworks&framework=react&using=vite&with=supabasejs) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api). diff --git a/apps/ui-library/content/docs/vue/client.mdx b/apps/ui-library/content/docs/vue/client.mdx index c56d6b87aeb..8b4804eae22 100644 --- a/apps/ui-library/content/docs/vue/client.mdx +++ b/apps/ui-library/content/docs/vue/client.mdx @@ -23,7 +23,7 @@ After installing the block, you'll have the following environment variables in y ```env VITE_SUPABASE_URL= -VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY= +VITE_SUPABASE_PUBLISHABLE_KEY= ``` - If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true&tab=frameworks&framework=vuejs&using=supabasejs) under App Frameworks or in your project's [API keys](https://supabase.com/dashboard/project/_/settings/api-keys). diff --git a/apps/ui-library/content/docs/vue/password-based-auth.mdx b/apps/ui-library/content/docs/vue/password-based-auth.mdx index d52fe66b058..b16d398e242 100644 --- a/apps/ui-library/content/docs/vue/password-based-auth.mdx +++ b/apps/ui-library/content/docs/vue/password-based-auth.mdx @@ -28,7 +28,7 @@ After installing the block, you'll have the following environment variables in y ```env VITE_SUPABASE_URL= -VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY= +VITE_SUPABASE_PUBLISHABLE_KEY= ``` - If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true&tab=frameworks&framework=vuejs&using=supabasejs) under App Frameworks or in your project's [API keys](https://supabase.com/dashboard/project/_/settings/api-keys). diff --git a/apps/ui-library/content/docs/vue/social-auth.mdx b/apps/ui-library/content/docs/vue/social-auth.mdx index 729dc532b5a..e49cd600969 100644 --- a/apps/ui-library/content/docs/vue/social-auth.mdx +++ b/apps/ui-library/content/docs/vue/social-auth.mdx @@ -30,7 +30,7 @@ After installing the block, you'll have the following environment variables in y ```env VITE_SUPABASE_URL= -VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY= +VITE_SUPABASE_PUBLISHABLE_KEY= ``` - If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true&connectTab=frameworks&framework=react&using=vite&with=supabasejs) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api). diff --git a/apps/ui-library/public/r/ai-editor-rules.json b/apps/ui-library/public/r/ai-editor-rules.json index 375824e29c8..4307763b36f 100644 --- a/apps/ui-library/public/r/ai-editor-rules.json +++ b/apps/ui-library/public/r/ai-editor-rules.json @@ -33,7 +33,7 @@ }, { "path": "registry/default/ai-editor-rules/writing-supabase-edge-functions.mdc", - "content": "---\ndescription: Coding rules for Supabase Edge Functions\nalwaysApply: false\n---\n\n# Writing Supabase Edge Functions\n\nYou're an expert in writing TypeScript and Deno JavaScript runtime. Generate **high-quality Supabase Edge Functions** that adhere to the following best practices:\n\n## Guidelines\n\n1. Try to use Web APIs and Deno’s core APIs instead of external dependencies (eg: use fetch instead of Axios, use WebSockets API instead of node-ws)\n2. If you are reusing utility methods between Edge Functions, add them to `supabase/functions/_shared` and import using a relative path. Do NOT have cross dependencies between Edge Functions.\n3. Do NOT use bare specifiers when importing dependencies. If you need to use an external dependency, make sure it's prefixed with either `npm:` or `jsr:`. For example, `@supabase/supabase-js` should be written as `npm:@supabase/supabase-js`.\n4. For external imports, always define a version. For example, `npm:@express` should be written as `npm:express@4.18.2`.\n5. For external dependencies, importing via `npm:` and `jsr:` is preferred. Minimize the use of imports from @`deno.land/x` , `esm.sh` and @`unpkg.com` . If you have a package from one of those CDNs, you can replace the CDN hostname with `npm:` specifier.\n6. You can also use Node built-in APIs. You will need to import them using `node:` specifier. For example, to import Node process: `import process from \"node:process\". Use Node APIs when you find gaps in Deno APIs.\n7. Do NOT use `import { serve } from \"https://deno.land/std@0.168.0/http/server.ts\"`. Instead use the built-in `Deno.serve`.\n8. Following environment variables (ie. secrets) are pre-populated in both local and hosted Supabase environments. Users don't need to manually set them:\n - SUPABASE_URL\n - SUPABASE_PUBLISHABLE_OR_ANON_KEY\n - SUPABASE_SERVICE_ROLE_KEY\n - SUPABASE_DB_URL\n9. To set other environment variables (ie. secrets) users can put them in a env file and run the `supabase secrets set --env-file path/to/env-file`\n10. A single Edge Function can handle multiple routes. It is recommended to use a library like Express or Hono to handle the routes as it's easier for developer to understand and maintain. Each route must be prefixed with `/function-name` so they are routed correctly.\n11. File write operations are ONLY permitted on `/tmp` directory. You can use either Deno or Node File APIs.\n12. Use `EdgeRuntime.waitUntil(promise)` static method to run long-running tasks in the background without blocking response to a request. Do NOT assume it is available in the request / execution context.\n\n## Example Templates\n\n### Simple Hello World Function\n\n```tsx\ninterface reqPayload {\n name: string\n}\n\nconsole.info('server started')\n\nDeno.serve(async (req: Request) => {\n const { name }: reqPayload = await req.json()\n const data = {\n message: `Hello ${name} from foo!`,\n }\n\n return new Response(JSON.stringify(data), {\n headers: { 'Content-Type': 'application/json', Connection: 'keep-alive' },\n })\n})\n```\n\n### Example Function using Node built-in API\n\n```tsx\nimport { randomBytes } from 'node:crypto'\nimport { createServer } from 'node:http'\nimport process from 'node:process'\n\nconst generateRandomString = (length) => {\n const buffer = randomBytes(length)\n return buffer.toString('hex')\n}\n\nconst randomString = generateRandomString(10)\nconsole.log(randomString)\n\nconst server = createServer((req, res) => {\n const message = `Hello`\n res.end(message)\n})\n\nserver.listen(9999)\n```\n\n### Using npm packages in Functions\n\n```tsx\nimport express from 'npm:express@4.18.2'\n\nconst app = express()\n\napp.get(/(.*)/, (req, res) => {\n res.send('Welcome to Supabase')\n})\n\napp.listen(8000)\n```\n\n### Generate embeddings using built-in @Supabase.ai API\n\n```tsx\nconst model = new Supabase.ai.Session('gte-small')\n\nDeno.serve(async (req: Request) => {\n const params = new URL(req.url).searchParams\n const input = params.get('text')\n const output = await model.run(input, { mean_pool: true, normalize: true })\n return new Response(JSON.stringify(output), {\n headers: {\n 'Content-Type': 'application/json',\n Connection: 'keep-alive',\n },\n })\n})\n```\n", + "content": "---\ndescription: Coding rules for Supabase Edge Functions\nalwaysApply: false\n---\n\n# Writing Supabase Edge Functions\n\nYou're an expert in writing TypeScript and Deno JavaScript runtime. Generate **high-quality Supabase Edge Functions** that adhere to the following best practices:\n\n## Guidelines\n\n1. Try to use Web APIs and Deno’s core APIs instead of external dependencies (eg: use fetch instead of Axios, use WebSockets API instead of node-ws)\n2. If you are reusing utility methods between Edge Functions, add them to `supabase/functions/_shared` and import using a relative path. Do NOT have cross dependencies between Edge Functions.\n3. Do NOT use bare specifiers when importing dependencies. If you need to use an external dependency, make sure it's prefixed with either `npm:` or `jsr:`. For example, `@supabase/supabase-js` should be written as `npm:@supabase/supabase-js`.\n4. For external imports, always define a version. For example, `npm:@express` should be written as `npm:express@4.18.2`.\n5. For external dependencies, importing via `npm:` and `jsr:` is preferred. Minimize the use of imports from @`deno.land/x` , `esm.sh` and @`unpkg.com` . If you have a package from one of those CDNs, you can replace the CDN hostname with `npm:` specifier.\n6. You can also use Node built-in APIs. You will need to import them using `node:` specifier. For example, to import Node process: `import process from \"node:process\". Use Node APIs when you find gaps in Deno APIs.\n7. Do NOT use `import { serve } from \"https://deno.land/std@0.168.0/http/server.ts\"`. Instead use the built-in `Deno.serve`.\n8. Following environment variables (ie. secrets) are pre-populated in both local and hosted Supabase environments. Users don't need to manually set them:\n - SUPABASE_URL\n - SUPABASE_PUBLISHABLE_KEY\n - SUPABASE_SERVICE_ROLE_KEY\n - SUPABASE_DB_URL\n9. To set other environment variables (ie. secrets) users can put them in a env file and run the `supabase secrets set --env-file path/to/env-file`\n10. A single Edge Function can handle multiple routes. It is recommended to use a library like Express or Hono to handle the routes as it's easier for developer to understand and maintain. Each route must be prefixed with `/function-name` so they are routed correctly.\n11. File write operations are ONLY permitted on `/tmp` directory. You can use either Deno or Node File APIs.\n12. Use `EdgeRuntime.waitUntil(promise)` static method to run long-running tasks in the background without blocking response to a request. Do NOT assume it is available in the request / execution context.\n\n## Example Templates\n\n### Simple Hello World Function\n\n```tsx\ninterface reqPayload {\n name: string\n}\n\nconsole.info('server started')\n\nDeno.serve(async (req: Request) => {\n const { name }: reqPayload = await req.json()\n const data = {\n message: `Hello ${name} from foo!`,\n }\n\n return new Response(JSON.stringify(data), {\n headers: { 'Content-Type': 'application/json', Connection: 'keep-alive' },\n })\n})\n```\n\n### Example Function using Node built-in API\n\n```tsx\nimport { randomBytes } from 'node:crypto'\nimport { createServer } from 'node:http'\nimport process from 'node:process'\n\nconst generateRandomString = (length) => {\n const buffer = randomBytes(length)\n return buffer.toString('hex')\n}\n\nconst randomString = generateRandomString(10)\nconsole.log(randomString)\n\nconst server = createServer((req, res) => {\n const message = `Hello`\n res.end(message)\n})\n\nserver.listen(9999)\n```\n\n### Using npm packages in Functions\n\n```tsx\nimport express from 'npm:express@4.18.2'\n\nconst app = express()\n\napp.get(/(.*)/, (req, res) => {\n res.send('Welcome to Supabase')\n})\n\napp.listen(8000)\n```\n\n### Generate embeddings using built-in @Supabase.ai API\n\n```tsx\nconst model = new Supabase.ai.Session('gte-small')\n\nDeno.serve(async (req: Request) => {\n const params = new URL(req.url).searchParams\n const input = params.get('text')\n const output = await model.run(input, { mean_pool: true, normalize: true })\n return new Response(JSON.stringify(output), {\n headers: {\n 'Content-Type': 'application/json',\n Connection: 'keep-alive',\n },\n })\n})\n```\n", "type": "registry:file", "target": "~/.cursor/rules/writing-supabase-edge-functions.mdc" }, diff --git a/apps/ui-library/public/r/current-user-avatar-nextjs.json b/apps/ui-library/public/r/current-user-avatar-nextjs.json index f6f6749e243..44046fecd08 100644 --- a/apps/ui-library/public/r/current-user-avatar-nextjs.json +++ b/apps/ui-library/public/r/current-user-avatar-nextjs.json @@ -29,23 +29,23 @@ }, { "path": "registry/default/clients/nextjs/lib/supabase/client.ts", - "content": "import { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "import { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/nextjs/lib/supabase/middleware.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { NextResponse, type NextRequest } from 'next/server'\n\nexport async function updateSession(request: NextRequest) {\n let supabaseResponse = NextResponse.next({\n request,\n })\n\n // With Fluid compute, don't put this client in a global environment\n // variable. Always create a new one on each request.\n const supabase = createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return request.cookies.getAll()\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value))\n supabaseResponse = NextResponse.next({\n request,\n })\n cookiesToSet.forEach(({ name, value, options }) =>\n supabaseResponse.cookies.set(name, value, options)\n )\n },\n },\n }\n )\n\n // Do not run code between createServerClient and\n // supabase.auth.getClaims(). A simple mistake could make it very hard to debug\n // issues with users being randomly logged out.\n\n // IMPORTANT: If you remove getClaims() and you use server-side rendering\n // with the Supabase client, your users may be randomly logged out.\n const { data } = await supabase.auth.getClaims()\n const user = data?.claims\n\n if (\n !user &&\n !request.nextUrl.pathname.startsWith('/login') &&\n !request.nextUrl.pathname.startsWith('/auth')\n ) {\n // no user, potentially respond by redirecting the user to the login page\n const url = request.nextUrl.clone()\n url.pathname = '/auth/login'\n return NextResponse.redirect(url)\n }\n\n // IMPORTANT: You *must* return the supabaseResponse object as it is.\n // If you're creating a new response object with NextResponse.next() make sure to:\n // 1. Pass the request in it, like so:\n // const myNewResponse = NextResponse.next({ request })\n // 2. Copy over the cookies, like so:\n // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())\n // 3. Change the myNewResponse object to fit your needs, but avoid changing\n // the cookies!\n // 4. Finally:\n // return myNewResponse\n // If this is not done, you may be causing the browser and server to go out\n // of sync and terminate the user's session prematurely!\n\n return supabaseResponse\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { NextResponse, type NextRequest } from 'next/server'\n\nexport async function updateSession(request: NextRequest) {\n let supabaseResponse = NextResponse.next({\n request,\n })\n\n // With Fluid compute, don't put this client in a global environment\n // variable. Always create a new one on each request.\n const supabase = createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return request.cookies.getAll()\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value))\n supabaseResponse = NextResponse.next({\n request,\n })\n cookiesToSet.forEach(({ name, value, options }) =>\n supabaseResponse.cookies.set(name, value, options)\n )\n },\n },\n }\n )\n\n // Do not run code between createServerClient and\n // supabase.auth.getClaims(). A simple mistake could make it very hard to debug\n // issues with users being randomly logged out.\n\n // IMPORTANT: If you remove getClaims() and you use server-side rendering\n // with the Supabase client, your users may be randomly logged out.\n const { data } = await supabase.auth.getClaims()\n const user = data?.claims\n\n if (\n !user &&\n !request.nextUrl.pathname.startsWith('/login') &&\n !request.nextUrl.pathname.startsWith('/auth')\n ) {\n // no user, potentially respond by redirecting the user to the login page\n const url = request.nextUrl.clone()\n url.pathname = '/auth/login'\n return NextResponse.redirect(url)\n }\n\n // IMPORTANT: You *must* return the supabaseResponse object as it is.\n // If you're creating a new response object with NextResponse.next() make sure to:\n // 1. Pass the request in it, like so:\n // const myNewResponse = NextResponse.next({ request })\n // 2. Copy over the cookies, like so:\n // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())\n // 3. Change the myNewResponse object to fit your needs, but avoid changing\n // the cookies!\n // 4. Finally:\n // return myNewResponse\n // If this is not done, you may be causing the browser and server to go out\n // of sync and terminate the user's session prematurely!\n\n return supabaseResponse\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/nextjs/lib/supabase/server.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { cookies } from 'next/headers'\n\n/**\n * If using Fluid compute: Don't put this client in a global variable. Always create a new client within each\n * function when using it.\n */\nexport async function createClient() {\n const cookieStore = await cookies()\n\n return createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return cookieStore.getAll()\n },\n setAll(cookiesToSet) {\n try {\n cookiesToSet.forEach(({ name, value, options }) =>\n cookieStore.set(name, value, options)\n )\n } catch {\n // The `setAll` method was called from a Server Component.\n // This can be ignored if you have middleware refreshing\n // user sessions.\n }\n },\n },\n }\n )\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { cookies } from 'next/headers'\n\n/**\n * If using Fluid compute: Don't put this client in a global variable. Always create a new client within each\n * function when using it.\n */\nexport async function createClient() {\n const cookieStore = await cookies()\n\n return createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return cookieStore.getAll()\n },\n setAll(cookiesToSet) {\n try {\n cookiesToSet.forEach(({ name, value, options }) =>\n cookieStore.set(name, value, options)\n )\n } catch {\n // The `setAll` method was called from a Server Component.\n // This can be ignored if you have middleware refreshing\n // user sessions.\n }\n },\n },\n }\n )\n}\n", "type": "registry:lib" } ], "envVars": { "NEXT_PUBLIC_SUPABASE_URL": "", - "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/current-user-avatar-react-router.json b/apps/ui-library/public/r/current-user-avatar-react-router.json index cd0b1884583..f8ebac349bb 100644 --- a/apps/ui-library/public/r/current-user-avatar-react-router.json +++ b/apps/ui-library/public/r/current-user-avatar-react-router.json @@ -29,18 +29,18 @@ }, { "path": "registry/default/clients/react-router/lib/supabase/client.ts", - "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/react-router/lib/supabase/server.ts", - "content": "import { createServerClient, parseCookieHeader, serializeCookieHeader } from '@supabase/ssr'\n\nexport function createClient(request: Request) {\n const headers = new Headers()\n\n const supabase = createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return parseCookieHeader(request.headers.get('Cookie') ?? '') as {\n name: string\n value: string\n }[]\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value, options }) =>\n headers.append('Set-Cookie', serializeCookieHeader(name, value, options))\n )\n },\n },\n }\n )\n\n return { supabase, headers }\n}\n", + "content": "import { createServerClient, parseCookieHeader, serializeCookieHeader } from '@supabase/ssr'\n\nexport function createClient(request: Request) {\n const headers = new Headers()\n\n const supabase = createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return parseCookieHeader(request.headers.get('Cookie') ?? '') as {\n name: string\n value: string\n }[]\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value, options }) =>\n headers.append('Set-Cookie', serializeCookieHeader(name, value, options))\n )\n },\n },\n }\n )\n\n return { supabase, headers }\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/current-user-avatar-react.json b/apps/ui-library/public/r/current-user-avatar-react.json index d9211798232..2c4d3ed974e 100644 --- a/apps/ui-library/public/r/current-user-avatar-react.json +++ b/apps/ui-library/public/r/current-user-avatar-react.json @@ -28,13 +28,13 @@ }, { "path": "registry/default/clients/react/lib/supabase/client.ts", - "content": "import { createClient as createSupabaseClient } from '@supabase/supabase-js'\n\nexport function createClient() {\n return createSupabaseClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "import { createClient as createSupabaseClient } from '@supabase/supabase-js'\n\nexport function createClient() {\n return createSupabaseClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/current-user-avatar-tanstack.json b/apps/ui-library/public/r/current-user-avatar-tanstack.json index ad9e45d6cfd..505f3dd6a57 100644 --- a/apps/ui-library/public/r/current-user-avatar-tanstack.json +++ b/apps/ui-library/public/r/current-user-avatar-tanstack.json @@ -29,18 +29,18 @@ }, { "path": "registry/default/clients/tanstack/lib/supabase/client.ts", - "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/tanstack/lib/supabase/server.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { getCookies, setCookie } from '@tanstack/react-start/server'\n\nexport function createClient() {\n return createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return Object.entries(getCookies()).map(\n ([name, value]) =>\n ({\n name,\n value,\n }) as { name: string; value: string }\n )\n },\n setAll(cookies) {\n cookies.forEach((cookie) => {\n setCookie(cookie.name, cookie.value)\n })\n },\n },\n }\n )\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { getCookies, setCookie } from '@tanstack/react-start/server'\n\nexport function createClient() {\n return createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return Object.entries(getCookies()).map(\n ([name, value]) =>\n ({\n name,\n value,\n }) as { name: string; value: string }\n )\n },\n setAll(cookies) {\n cookies.forEach((cookie) => {\n setCookie(cookie.name, cookie.value)\n })\n },\n },\n }\n )\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/dropzone-nextjs.json b/apps/ui-library/public/r/dropzone-nextjs.json index fd8580d9d59..9bbfcb14273 100644 --- a/apps/ui-library/public/r/dropzone-nextjs.json +++ b/apps/ui-library/public/r/dropzone-nextjs.json @@ -26,23 +26,23 @@ }, { "path": "registry/default/clients/nextjs/lib/supabase/client.ts", - "content": "import { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "import { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/nextjs/lib/supabase/middleware.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { NextResponse, type NextRequest } from 'next/server'\n\nexport async function updateSession(request: NextRequest) {\n let supabaseResponse = NextResponse.next({\n request,\n })\n\n // With Fluid compute, don't put this client in a global environment\n // variable. Always create a new one on each request.\n const supabase = createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return request.cookies.getAll()\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value))\n supabaseResponse = NextResponse.next({\n request,\n })\n cookiesToSet.forEach(({ name, value, options }) =>\n supabaseResponse.cookies.set(name, value, options)\n )\n },\n },\n }\n )\n\n // Do not run code between createServerClient and\n // supabase.auth.getClaims(). A simple mistake could make it very hard to debug\n // issues with users being randomly logged out.\n\n // IMPORTANT: If you remove getClaims() and you use server-side rendering\n // with the Supabase client, your users may be randomly logged out.\n const { data } = await supabase.auth.getClaims()\n const user = data?.claims\n\n if (\n !user &&\n !request.nextUrl.pathname.startsWith('/login') &&\n !request.nextUrl.pathname.startsWith('/auth')\n ) {\n // no user, potentially respond by redirecting the user to the login page\n const url = request.nextUrl.clone()\n url.pathname = '/auth/login'\n return NextResponse.redirect(url)\n }\n\n // IMPORTANT: You *must* return the supabaseResponse object as it is.\n // If you're creating a new response object with NextResponse.next() make sure to:\n // 1. Pass the request in it, like so:\n // const myNewResponse = NextResponse.next({ request })\n // 2. Copy over the cookies, like so:\n // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())\n // 3. Change the myNewResponse object to fit your needs, but avoid changing\n // the cookies!\n // 4. Finally:\n // return myNewResponse\n // If this is not done, you may be causing the browser and server to go out\n // of sync and terminate the user's session prematurely!\n\n return supabaseResponse\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { NextResponse, type NextRequest } from 'next/server'\n\nexport async function updateSession(request: NextRequest) {\n let supabaseResponse = NextResponse.next({\n request,\n })\n\n // With Fluid compute, don't put this client in a global environment\n // variable. Always create a new one on each request.\n const supabase = createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return request.cookies.getAll()\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value))\n supabaseResponse = NextResponse.next({\n request,\n })\n cookiesToSet.forEach(({ name, value, options }) =>\n supabaseResponse.cookies.set(name, value, options)\n )\n },\n },\n }\n )\n\n // Do not run code between createServerClient and\n // supabase.auth.getClaims(). A simple mistake could make it very hard to debug\n // issues with users being randomly logged out.\n\n // IMPORTANT: If you remove getClaims() and you use server-side rendering\n // with the Supabase client, your users may be randomly logged out.\n const { data } = await supabase.auth.getClaims()\n const user = data?.claims\n\n if (\n !user &&\n !request.nextUrl.pathname.startsWith('/login') &&\n !request.nextUrl.pathname.startsWith('/auth')\n ) {\n // no user, potentially respond by redirecting the user to the login page\n const url = request.nextUrl.clone()\n url.pathname = '/auth/login'\n return NextResponse.redirect(url)\n }\n\n // IMPORTANT: You *must* return the supabaseResponse object as it is.\n // If you're creating a new response object with NextResponse.next() make sure to:\n // 1. Pass the request in it, like so:\n // const myNewResponse = NextResponse.next({ request })\n // 2. Copy over the cookies, like so:\n // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())\n // 3. Change the myNewResponse object to fit your needs, but avoid changing\n // the cookies!\n // 4. Finally:\n // return myNewResponse\n // If this is not done, you may be causing the browser and server to go out\n // of sync and terminate the user's session prematurely!\n\n return supabaseResponse\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/nextjs/lib/supabase/server.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { cookies } from 'next/headers'\n\n/**\n * If using Fluid compute: Don't put this client in a global variable. Always create a new client within each\n * function when using it.\n */\nexport async function createClient() {\n const cookieStore = await cookies()\n\n return createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return cookieStore.getAll()\n },\n setAll(cookiesToSet) {\n try {\n cookiesToSet.forEach(({ name, value, options }) =>\n cookieStore.set(name, value, options)\n )\n } catch {\n // The `setAll` method was called from a Server Component.\n // This can be ignored if you have middleware refreshing\n // user sessions.\n }\n },\n },\n }\n )\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { cookies } from 'next/headers'\n\n/**\n * If using Fluid compute: Don't put this client in a global variable. Always create a new client within each\n * function when using it.\n */\nexport async function createClient() {\n const cookieStore = await cookies()\n\n return createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return cookieStore.getAll()\n },\n setAll(cookiesToSet) {\n try {\n cookiesToSet.forEach(({ name, value, options }) =>\n cookieStore.set(name, value, options)\n )\n } catch {\n // The `setAll` method was called from a Server Component.\n // This can be ignored if you have middleware refreshing\n // user sessions.\n }\n },\n },\n }\n )\n}\n", "type": "registry:lib" } ], "envVars": { "NEXT_PUBLIC_SUPABASE_URL": "", - "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/dropzone-nuxtjs.json b/apps/ui-library/public/r/dropzone-nuxtjs.json index 91f4668894c..f3df59c0986 100644 --- a/apps/ui-library/public/r/dropzone-nuxtjs.json +++ b/apps/ui-library/public/r/dropzone-nuxtjs.json @@ -33,7 +33,7 @@ }, { "path": "registry/default/dropzone/nuxtjs/app/composables/useSupabaseUpload.ts", - "content": "import { ref, computed, watch, onUnmounted } from 'vue'\nimport { useDropZone } from '@vueuse/core'\n// @ts-ignore\nimport { createClient } from \"@/lib/supabase/client\"\n\nconst supabase = createClient()\n\nexport interface FileWithPreview extends File {\n preview?: string\n errors: { code: string; message: string }[]\n}\n\nexport type UseSupabaseUploadOptions = {\n bucketName: string\n path?: string\n allowedMimeTypes?: string[]\n maxFileSize?: number\n maxFiles?: number\n cacheControl?: number\n upsert?: boolean\n}\n\nfunction validateFileType(file: File, allowedTypes: string[]) {\n if (!allowedTypes.length) return []\n const isValid = allowedTypes.some(t =>\n t.endsWith('/*')\n ? file.type.startsWith(t.replace('/*', ''))\n : file.type === t\n )\n return isValid\n ? []\n : [{ code: 'invalid-type', message: 'Invalid file type' }]\n}\n\nfunction validateFileSize(file: File, maxSize: number) {\n return file.size > maxSize\n ? [{ code: 'file-too-large', message: `File is larger than allowed size` }]\n : []\n}\n\nexport function useSupabaseUpload(options: UseSupabaseUploadOptions) {\n const {\n bucketName,\n path,\n allowedMimeTypes = [],\n maxFileSize = Number.POSITIVE_INFINITY,\n maxFiles = 1,\n cacheControl = 3600,\n upsert = false,\n } = options\n\n const files = ref([])\n const loading = ref(false)\n const errors = ref<{ name: string; message: string }[]>([])\n const successes = ref([])\n\n const isSuccess = computed(() => {\n if (!errors.value.length && !successes.value.length) return false\n return !errors.value.length && successes.value.length === files.value.length\n })\n\n const dropZoneRef = ref(null)\n\n const { isOverDropZone } = useDropZone(dropZoneRef, {\n onDrop(droppedFiles: File[] | null) {\n if (!droppedFiles) return\n\n const newFiles: FileWithPreview[] = droppedFiles.map(file => ({\n ...(file as FileWithPreview),\n preview: URL.createObjectURL(file),\n errors: [\n ...validateFileType(file, allowedMimeTypes),\n ...validateFileSize(file, maxFileSize),\n ],\n }))\n\n files.value = [...files.value, ...newFiles]\n },\n })\n\n const onUpload = async () => {\n loading.value = true\n\n try {\n const filesWithErrors = errors.value.map(e => e.name)\n\n const filesToUpload =\n filesWithErrors.length > 0\n ? files.value.filter(\n f =>\n filesWithErrors.includes(f.name) ||\n !successes.value.includes(f.name)\n )\n : files.value\n\n const responses = await Promise.all(\n filesToUpload.map(async file => {\n const { error } = await supabase.storage\n .from(bucketName)\n .upload(path ? `${path}/${file.name}` : file.name, file, {\n cacheControl: cacheControl.toString(),\n upsert,\n })\n\n return error\n ? { name: file.name, message: error.message }\n : { name: file.name, message: undefined }\n })\n )\n\n errors.value = responses.filter((r): r is { name: string; message: string } => r.message !== undefined)\n\n const successful = responses\n .filter(r => !r.message)\n .map(r => r.name)\n\n successes.value = Array.from(\n new Set([...successes.value, ...successful])\n )\n } catch (err) {\n console.error('Upload failed unexpectedly:', err)\n\n errors.value.push({\n name: 'upload',\n message: 'An unexpected error occurred during upload.',\n })\n } finally {\n loading.value = false\n }\n }\n\n\n watch(\n () => files.value.length,\n () => {\n if (!files.value.length) {\n errors.value = []\n successes.value = []\n }\n\n if (files.value.length > maxFiles) {\n errors.value.push({\n name: 'files',\n message: `You may upload up to ${maxFiles} files`,\n })\n }\n }\n )\n\n watch(\n files,\n (newFiles, oldFiles) => {\n const newPreviews = new Set(newFiles.map(f => f.preview))\n oldFiles.forEach(file => {\n if (file.preview && !newPreviews.has(file.preview)) {\n URL.revokeObjectURL(file.preview)\n }\n })\n },\n { deep: true }\n )\n\n onUnmounted(() => {\n files.value.forEach(file => {\n if (file.preview) {\n URL.revokeObjectURL(file.preview)\n }\n })\n })\n\n return {\n dropZoneRef,\n isOverDropZone,\n\n files,\n setFiles: (v: FileWithPreview[]) => (files.value = v),\n\n errors,\n setErrors: (v: { name: string; message: string }[]) => (errors.value = v),\n\n successes,\n isSuccess,\n loading,\n onUpload,\n\n maxFileSize,\n maxFiles,\n allowedMimeTypes,\n }\n}\n", + "content": "import { useDropZone } from '@vueuse/core'\nimport { computed, onUnmounted, ref, watch } from 'vue'\n\n// @ts-ignore\nimport { createClient } from '@/lib/supabase/client'\n\nconst supabase = createClient()\n\nexport interface FileWithPreview extends File {\n preview?: string\n errors: { code: string; message: string }[]\n}\n\nexport type UseSupabaseUploadOptions = {\n bucketName: string\n path?: string\n allowedMimeTypes?: string[]\n maxFileSize?: number\n maxFiles?: number\n cacheControl?: number\n upsert?: boolean\n}\n\nfunction validateFileType(file: File, allowedTypes: string[]) {\n if (!allowedTypes.length) return []\n const isValid = allowedTypes.some((t) =>\n t.endsWith('/*') ? file.type.startsWith(t.replace('/*', '')) : file.type === t\n )\n return isValid ? [] : [{ code: 'invalid-type', message: 'Invalid file type' }]\n}\n\nfunction validateFileSize(file: File, maxSize: number) {\n return file.size > maxSize\n ? [{ code: 'file-too-large', message: `File is larger than allowed size` }]\n : []\n}\n\nexport function useSupabaseUpload(options: UseSupabaseUploadOptions) {\n const {\n bucketName,\n path,\n allowedMimeTypes = [],\n maxFileSize = Number.POSITIVE_INFINITY,\n maxFiles = 1,\n cacheControl = 3600,\n upsert = false,\n } = options\n\n const files = ref([])\n const loading = ref(false)\n const errors = ref<{ name: string; message: string }[]>([])\n const successes = ref([])\n\n const isSuccess = computed(() => {\n if (!errors.value.length && !successes.value.length) return false\n return !errors.value.length && successes.value.length === files.value.length\n })\n\n const dropZoneRef = ref(null)\n\n const { isOverDropZone } = useDropZone(dropZoneRef, {\n onDrop(droppedFiles: File[] | null) {\n if (!droppedFiles) return\n\n const newFiles: FileWithPreview[] = droppedFiles.map((file) => ({\n ...(file as FileWithPreview),\n preview: URL.createObjectURL(file),\n errors: [\n ...validateFileType(file, allowedMimeTypes),\n ...validateFileSize(file, maxFileSize),\n ],\n }))\n\n files.value = [...files.value, ...newFiles]\n },\n })\n\n const onUpload = async () => {\n loading.value = true\n\n try {\n const filesWithErrors = errors.value.map((e) => e.name)\n\n const filesToUpload =\n filesWithErrors.length > 0\n ? files.value.filter(\n (f) => filesWithErrors.includes(f.name) || !successes.value.includes(f.name)\n )\n : files.value\n\n const responses = await Promise.all(\n filesToUpload.map(async (file) => {\n const { error } = await supabase.storage\n .from(bucketName)\n .upload(path ? `${path}/${file.name}` : file.name, file, {\n cacheControl: cacheControl.toString(),\n upsert,\n })\n\n return error\n ? { name: file.name, message: error.message }\n : { name: file.name, message: undefined }\n })\n )\n\n errors.value = responses.filter(\n (r): r is { name: string; message: string } => r.message !== undefined\n )\n\n const successful = responses.filter((r) => !r.message).map((r) => r.name)\n\n successes.value = Array.from(new Set([...successes.value, ...successful]))\n } catch (err) {\n console.error('Upload failed unexpectedly:', err)\n\n errors.value.push({\n name: 'upload',\n message: 'An unexpected error occurred during upload.',\n })\n } finally {\n loading.value = false\n }\n }\n\n watch(\n () => files.value.length,\n () => {\n if (!files.value.length) {\n errors.value = []\n successes.value = []\n }\n\n if (files.value.length > maxFiles) {\n errors.value.push({\n name: 'files',\n message: `You may upload up to ${maxFiles} files`,\n })\n }\n }\n )\n\n watch(\n files,\n (newFiles, oldFiles) => {\n const newPreviews = new Set(newFiles.map((f) => f.preview))\n oldFiles.forEach((file) => {\n if (file.preview && !newPreviews.has(file.preview)) {\n URL.revokeObjectURL(file.preview)\n }\n })\n },\n { deep: true }\n )\n\n onUnmounted(() => {\n files.value.forEach((file) => {\n if (file.preview) {\n URL.revokeObjectURL(file.preview)\n }\n })\n })\n\n return {\n dropZoneRef,\n isOverDropZone,\n\n files,\n setFiles: (v: FileWithPreview[]) => (files.value = v),\n\n errors,\n setErrors: (v: { name: string; message: string }[]) => (errors.value = v),\n\n successes,\n isSuccess,\n loading,\n onUpload,\n\n maxFileSize,\n maxFiles,\n allowedMimeTypes,\n }\n}\n", "type": "registry:component", "target": "app/composables/useSupabaseUpload.ts" } diff --git a/apps/ui-library/public/r/dropzone-react-router.json b/apps/ui-library/public/r/dropzone-react-router.json index 60d6a973af5..20ceefaef39 100644 --- a/apps/ui-library/public/r/dropzone-react-router.json +++ b/apps/ui-library/public/r/dropzone-react-router.json @@ -26,18 +26,18 @@ }, { "path": "registry/default/clients/react-router/lib/supabase/client.ts", - "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/react-router/lib/supabase/server.ts", - "content": "import { createServerClient, parseCookieHeader, serializeCookieHeader } from '@supabase/ssr'\n\nexport function createClient(request: Request) {\n const headers = new Headers()\n\n const supabase = createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return parseCookieHeader(request.headers.get('Cookie') ?? '') as {\n name: string\n value: string\n }[]\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value, options }) =>\n headers.append('Set-Cookie', serializeCookieHeader(name, value, options))\n )\n },\n },\n }\n )\n\n return { supabase, headers }\n}\n", + "content": "import { createServerClient, parseCookieHeader, serializeCookieHeader } from '@supabase/ssr'\n\nexport function createClient(request: Request) {\n const headers = new Headers()\n\n const supabase = createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return parseCookieHeader(request.headers.get('Cookie') ?? '') as {\n name: string\n value: string\n }[]\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value, options }) =>\n headers.append('Set-Cookie', serializeCookieHeader(name, value, options))\n )\n },\n },\n }\n )\n\n return { supabase, headers }\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/dropzone-react.json b/apps/ui-library/public/r/dropzone-react.json index 946f4cb911f..29c18c95cd2 100644 --- a/apps/ui-library/public/r/dropzone-react.json +++ b/apps/ui-library/public/r/dropzone-react.json @@ -25,13 +25,13 @@ }, { "path": "registry/default/clients/react/lib/supabase/client.ts", - "content": "import { createClient as createSupabaseClient } from '@supabase/supabase-js'\n\nexport function createClient() {\n return createSupabaseClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "import { createClient as createSupabaseClient } from '@supabase/supabase-js'\n\nexport function createClient() {\n return createSupabaseClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/dropzone-tanstack.json b/apps/ui-library/public/r/dropzone-tanstack.json index 36af19fde9e..470f6adf54e 100644 --- a/apps/ui-library/public/r/dropzone-tanstack.json +++ b/apps/ui-library/public/r/dropzone-tanstack.json @@ -26,18 +26,18 @@ }, { "path": "registry/default/clients/tanstack/lib/supabase/client.ts", - "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/tanstack/lib/supabase/server.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { getCookies, setCookie } from '@tanstack/react-start/server'\n\nexport function createClient() {\n return createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return Object.entries(getCookies()).map(\n ([name, value]) =>\n ({\n name,\n value,\n }) as { name: string; value: string }\n )\n },\n setAll(cookies) {\n cookies.forEach((cookie) => {\n setCookie(cookie.name, cookie.value)\n })\n },\n },\n }\n )\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { getCookies, setCookie } from '@tanstack/react-start/server'\n\nexport function createClient() {\n return createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return Object.entries(getCookies()).map(\n ([name, value]) =>\n ({\n name,\n value,\n }) as { name: string; value: string }\n )\n },\n setAll(cookies) {\n cookies.forEach((cookie) => {\n setCookie(cookie.name, cookie.value)\n })\n },\n },\n }\n )\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/dropzone-vue.json b/apps/ui-library/public/r/dropzone-vue.json index 1c5e1947b62..79232d83dfe 100644 --- a/apps/ui-library/public/r/dropzone-vue.json +++ b/apps/ui-library/public/r/dropzone-vue.json @@ -33,7 +33,7 @@ }, { "path": "registry/default/dropzone/vue/composables/useSupabaseUpload.ts", - "content": "import { ref, computed, watch, onUnmounted } from 'vue'\nimport { useDropZone } from '@vueuse/core'\n// @ts-ignore\nimport { createClient } from \"@/lib/supabase/client\"\n\nconst supabase = createClient()\n\nexport interface FileWithPreview extends File {\n preview?: string\n errors: { code: string; message: string }[]\n}\n\nexport type UseSupabaseUploadOptions = {\n bucketName: string\n path?: string\n allowedMimeTypes?: string[]\n maxFileSize?: number\n maxFiles?: number\n cacheControl?: number\n upsert?: boolean\n}\n\nfunction validateFileType(file: File, allowedTypes: string[]) {\n if (!allowedTypes.length) return []\n const isValid = allowedTypes.some(t =>\n t.endsWith('/*')\n ? file.type.startsWith(t.replace('/*', ''))\n : file.type === t\n )\n return isValid\n ? []\n : [{ code: 'invalid-type', message: 'Invalid file type' }]\n}\n\nfunction validateFileSize(file: File, maxSize: number) {\n return file.size > maxSize\n ? [{ code: 'file-too-large', message: `File is larger than allowed size` }]\n : []\n}\n\nexport function useSupabaseUpload(options: UseSupabaseUploadOptions) {\n const {\n bucketName,\n path,\n allowedMimeTypes = [],\n maxFileSize = Number.POSITIVE_INFINITY,\n maxFiles = 1,\n cacheControl = 3600,\n upsert = false,\n } = options\n\n const files = ref([])\n const loading = ref(false)\n const errors = ref<{ name: string; message: string }[]>([])\n const successes = ref([])\n\n const isSuccess = computed(() => {\n if (!errors.value.length && !successes.value.length) return false\n return !errors.value.length && successes.value.length === files.value.length\n })\n\n const dropZoneRef = ref(null)\n\n const { isOverDropZone } = useDropZone(dropZoneRef, {\n onDrop(droppedFiles: File[] | null) {\n if (!droppedFiles) return\n\n const newFiles: FileWithPreview[] = droppedFiles.map(file => ({\n ...(file as FileWithPreview),\n preview: URL.createObjectURL(file),\n errors: [\n ...validateFileType(file, allowedMimeTypes),\n ...validateFileSize(file, maxFileSize),\n ],\n }))\n\n files.value = [...files.value, ...newFiles]\n },\n })\n\n const onUpload = async () => {\n loading.value = true\n\n try {\n const filesWithErrors = errors.value.map(e => e.name)\n\n const filesToUpload =\n filesWithErrors.length > 0\n ? files.value.filter(\n f =>\n filesWithErrors.includes(f.name) ||\n !successes.value.includes(f.name)\n )\n : files.value\n\n const responses = await Promise.all(\n filesToUpload.map(async file => {\n const { error } = await supabase.storage\n .from(bucketName)\n .upload(path ? `${path}/${file.name}` : file.name, file, {\n cacheControl: cacheControl.toString(),\n upsert,\n })\n\n return error\n ? { name: file.name, message: error.message }\n : { name: file.name, message: undefined }\n })\n )\n\n errors.value = responses.filter((r): r is { name: string; message: string } => r.message !== undefined)\n\n const successful = responses\n .filter(r => !r.message)\n .map(r => r.name)\n\n successes.value = Array.from(\n new Set([...successes.value, ...successful])\n )\n } catch (err) {\n console.error('Upload failed unexpectedly:', err)\n\n errors.value.push({\n name: 'upload',\n message: 'An unexpected error occurred during upload.',\n })\n } finally {\n loading.value = false\n }\n }\n\n\n watch(\n () => files.value.length,\n () => {\n if (!files.value.length) {\n errors.value = []\n successes.value = []\n }\n\n if (files.value.length > maxFiles) {\n errors.value.push({\n name: 'files',\n message: `You may upload up to ${maxFiles} files`,\n })\n }\n }\n )\n\n watch(\n files,\n (newFiles, oldFiles) => {\n const newPreviews = new Set(newFiles.map(f => f.preview))\n oldFiles.forEach(file => {\n if (file.preview && !newPreviews.has(file.preview)) {\n URL.revokeObjectURL(file.preview)\n }\n })\n },\n { deep: true }\n )\n\n onUnmounted(() => {\n files.value.forEach(file => {\n if (file.preview) {\n URL.revokeObjectURL(file.preview)\n }\n })\n })\n\n return {\n dropZoneRef,\n isOverDropZone,\n\n files,\n setFiles: (v: FileWithPreview[]) => (files.value = v),\n\n errors,\n setErrors: (v: { name: string; message: string }[]) => (errors.value = v),\n\n successes,\n isSuccess,\n loading,\n onUpload,\n\n maxFileSize,\n maxFiles,\n allowedMimeTypes,\n }\n}\n", + "content": "import { useDropZone } from '@vueuse/core'\nimport { computed, onUnmounted, ref, watch } from 'vue'\n\n// @ts-ignore\nimport { createClient } from '@/lib/supabase/client'\n\nconst supabase = createClient()\n\nexport interface FileWithPreview extends File {\n preview?: string\n errors: { code: string; message: string }[]\n}\n\nexport type UseSupabaseUploadOptions = {\n bucketName: string\n path?: string\n allowedMimeTypes?: string[]\n maxFileSize?: number\n maxFiles?: number\n cacheControl?: number\n upsert?: boolean\n}\n\nfunction validateFileType(file: File, allowedTypes: string[]) {\n if (!allowedTypes.length) return []\n const isValid = allowedTypes.some((t) =>\n t.endsWith('/*') ? file.type.startsWith(t.replace('/*', '')) : file.type === t\n )\n return isValid ? [] : [{ code: 'invalid-type', message: 'Invalid file type' }]\n}\n\nfunction validateFileSize(file: File, maxSize: number) {\n return file.size > maxSize\n ? [{ code: 'file-too-large', message: `File is larger than allowed size` }]\n : []\n}\n\nexport function useSupabaseUpload(options: UseSupabaseUploadOptions) {\n const {\n bucketName,\n path,\n allowedMimeTypes = [],\n maxFileSize = Number.POSITIVE_INFINITY,\n maxFiles = 1,\n cacheControl = 3600,\n upsert = false,\n } = options\n\n const files = ref([])\n const loading = ref(false)\n const errors = ref<{ name: string; message: string }[]>([])\n const successes = ref([])\n\n const isSuccess = computed(() => {\n if (!errors.value.length && !successes.value.length) return false\n return !errors.value.length && successes.value.length === files.value.length\n })\n\n const dropZoneRef = ref(null)\n\n const { isOverDropZone } = useDropZone(dropZoneRef, {\n onDrop(droppedFiles: File[] | null) {\n if (!droppedFiles) return\n\n const newFiles: FileWithPreview[] = droppedFiles.map((file) => ({\n ...(file as FileWithPreview),\n preview: URL.createObjectURL(file),\n errors: [\n ...validateFileType(file, allowedMimeTypes),\n ...validateFileSize(file, maxFileSize),\n ],\n }))\n\n files.value = [...files.value, ...newFiles]\n },\n })\n\n const onUpload = async () => {\n loading.value = true\n\n try {\n const filesWithErrors = errors.value.map((e) => e.name)\n\n const filesToUpload =\n filesWithErrors.length > 0\n ? files.value.filter(\n (f) => filesWithErrors.includes(f.name) || !successes.value.includes(f.name)\n )\n : files.value\n\n const responses = await Promise.all(\n filesToUpload.map(async (file) => {\n const { error } = await supabase.storage\n .from(bucketName)\n .upload(path ? `${path}/${file.name}` : file.name, file, {\n cacheControl: cacheControl.toString(),\n upsert,\n })\n\n return error\n ? { name: file.name, message: error.message }\n : { name: file.name, message: undefined }\n })\n )\n\n errors.value = responses.filter(\n (r): r is { name: string; message: string } => r.message !== undefined\n )\n\n const successful = responses.filter((r) => !r.message).map((r) => r.name)\n\n successes.value = Array.from(new Set([...successes.value, ...successful]))\n } catch (err) {\n console.error('Upload failed unexpectedly:', err)\n\n errors.value.push({\n name: 'upload',\n message: 'An unexpected error occurred during upload.',\n })\n } finally {\n loading.value = false\n }\n }\n\n watch(\n () => files.value.length,\n () => {\n if (!files.value.length) {\n errors.value = []\n successes.value = []\n }\n\n if (files.value.length > maxFiles) {\n errors.value.push({\n name: 'files',\n message: `You may upload up to ${maxFiles} files`,\n })\n }\n }\n )\n\n watch(\n files,\n (newFiles, oldFiles) => {\n const newPreviews = new Set(newFiles.map((f) => f.preview))\n oldFiles.forEach((file) => {\n if (file.preview && !newPreviews.has(file.preview)) {\n URL.revokeObjectURL(file.preview)\n }\n })\n },\n { deep: true }\n )\n\n onUnmounted(() => {\n files.value.forEach((file) => {\n if (file.preview) {\n URL.revokeObjectURL(file.preview)\n }\n })\n })\n\n return {\n dropZoneRef,\n isOverDropZone,\n\n files,\n setFiles: (v: FileWithPreview[]) => (files.value = v),\n\n errors,\n setErrors: (v: { name: string; message: string }[]) => (errors.value = v),\n\n successes,\n isSuccess,\n loading,\n onUpload,\n\n maxFileSize,\n maxFiles,\n allowedMimeTypes,\n }\n}\n", "type": "registry:component", "target": "composables/useSupabaseUpload.ts" } diff --git a/apps/ui-library/public/r/password-based-auth-nextjs.json b/apps/ui-library/public/r/password-based-auth-nextjs.json index 8e983697f48..787fc6ed2f0 100644 --- a/apps/ui-library/public/r/password-based-auth-nextjs.json +++ b/apps/ui-library/public/r/password-based-auth-nextjs.json @@ -96,23 +96,23 @@ }, { "path": "registry/default/clients/nextjs/lib/supabase/client.ts", - "content": "import { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "import { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/nextjs/lib/supabase/middleware.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { NextResponse, type NextRequest } from 'next/server'\n\nexport async function updateSession(request: NextRequest) {\n let supabaseResponse = NextResponse.next({\n request,\n })\n\n // With Fluid compute, don't put this client in a global environment\n // variable. Always create a new one on each request.\n const supabase = createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return request.cookies.getAll()\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value))\n supabaseResponse = NextResponse.next({\n request,\n })\n cookiesToSet.forEach(({ name, value, options }) =>\n supabaseResponse.cookies.set(name, value, options)\n )\n },\n },\n }\n )\n\n // Do not run code between createServerClient and\n // supabase.auth.getClaims(). A simple mistake could make it very hard to debug\n // issues with users being randomly logged out.\n\n // IMPORTANT: If you remove getClaims() and you use server-side rendering\n // with the Supabase client, your users may be randomly logged out.\n const { data } = await supabase.auth.getClaims()\n const user = data?.claims\n\n if (\n !user &&\n !request.nextUrl.pathname.startsWith('/login') &&\n !request.nextUrl.pathname.startsWith('/auth')\n ) {\n // no user, potentially respond by redirecting the user to the login page\n const url = request.nextUrl.clone()\n url.pathname = '/auth/login'\n return NextResponse.redirect(url)\n }\n\n // IMPORTANT: You *must* return the supabaseResponse object as it is.\n // If you're creating a new response object with NextResponse.next() make sure to:\n // 1. Pass the request in it, like so:\n // const myNewResponse = NextResponse.next({ request })\n // 2. Copy over the cookies, like so:\n // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())\n // 3. Change the myNewResponse object to fit your needs, but avoid changing\n // the cookies!\n // 4. Finally:\n // return myNewResponse\n // If this is not done, you may be causing the browser and server to go out\n // of sync and terminate the user's session prematurely!\n\n return supabaseResponse\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { NextResponse, type NextRequest } from 'next/server'\n\nexport async function updateSession(request: NextRequest) {\n let supabaseResponse = NextResponse.next({\n request,\n })\n\n // With Fluid compute, don't put this client in a global environment\n // variable. Always create a new one on each request.\n const supabase = createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return request.cookies.getAll()\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value))\n supabaseResponse = NextResponse.next({\n request,\n })\n cookiesToSet.forEach(({ name, value, options }) =>\n supabaseResponse.cookies.set(name, value, options)\n )\n },\n },\n }\n )\n\n // Do not run code between createServerClient and\n // supabase.auth.getClaims(). A simple mistake could make it very hard to debug\n // issues with users being randomly logged out.\n\n // IMPORTANT: If you remove getClaims() and you use server-side rendering\n // with the Supabase client, your users may be randomly logged out.\n const { data } = await supabase.auth.getClaims()\n const user = data?.claims\n\n if (\n !user &&\n !request.nextUrl.pathname.startsWith('/login') &&\n !request.nextUrl.pathname.startsWith('/auth')\n ) {\n // no user, potentially respond by redirecting the user to the login page\n const url = request.nextUrl.clone()\n url.pathname = '/auth/login'\n return NextResponse.redirect(url)\n }\n\n // IMPORTANT: You *must* return the supabaseResponse object as it is.\n // If you're creating a new response object with NextResponse.next() make sure to:\n // 1. Pass the request in it, like so:\n // const myNewResponse = NextResponse.next({ request })\n // 2. Copy over the cookies, like so:\n // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())\n // 3. Change the myNewResponse object to fit your needs, but avoid changing\n // the cookies!\n // 4. Finally:\n // return myNewResponse\n // If this is not done, you may be causing the browser and server to go out\n // of sync and terminate the user's session prematurely!\n\n return supabaseResponse\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/nextjs/lib/supabase/server.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { cookies } from 'next/headers'\n\n/**\n * If using Fluid compute: Don't put this client in a global variable. Always create a new client within each\n * function when using it.\n */\nexport async function createClient() {\n const cookieStore = await cookies()\n\n return createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return cookieStore.getAll()\n },\n setAll(cookiesToSet) {\n try {\n cookiesToSet.forEach(({ name, value, options }) =>\n cookieStore.set(name, value, options)\n )\n } catch {\n // The `setAll` method was called from a Server Component.\n // This can be ignored if you have middleware refreshing\n // user sessions.\n }\n },\n },\n }\n )\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { cookies } from 'next/headers'\n\n/**\n * If using Fluid compute: Don't put this client in a global variable. Always create a new client within each\n * function when using it.\n */\nexport async function createClient() {\n const cookieStore = await cookies()\n\n return createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return cookieStore.getAll()\n },\n setAll(cookiesToSet) {\n try {\n cookiesToSet.forEach(({ name, value, options }) =>\n cookieStore.set(name, value, options)\n )\n } catch {\n // The `setAll` method was called from a Server Component.\n // This can be ignored if you have middleware refreshing\n // user sessions.\n }\n },\n },\n }\n )\n}\n", "type": "registry:lib" } ], "envVars": { "NEXT_PUBLIC_SUPABASE_URL": "", - "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/password-based-auth-nuxtjs.json b/apps/ui-library/public/r/password-based-auth-nuxtjs.json index b0ea37e7631..099e598b349 100644 --- a/apps/ui-library/public/r/password-based-auth-nuxtjs.json +++ b/apps/ui-library/public/r/password-based-auth-nuxtjs.json @@ -83,7 +83,7 @@ }, { "path": "registry/default/password-based-auth/nuxtjs/server/routes/auth/confirm.get.ts", - "content": "import { getQuery, defineEventHandler, sendRedirect } from 'h3'\nimport type { EmailOtpType } from '@supabase/supabase-js'\nimport { createSupabaseServerClient } from '@/registry/default/clients/nuxtjs/server/supabase/client'\n\nexport default defineEventHandler(async (event) => {\n const query = getQuery(event)\n const token_hash = query.token_hash as string | null\n const type = query.type as EmailOtpType | null\n const _next = query.next as string | undefined\n const next = _next?.startsWith('/') ? _next : '/'\n\n if (token_hash && type) {\n const supabase = createSupabaseServerClient(event)\n\n const { error } = await supabase.auth.verifyOtp({\n type,\n token_hash,\n })\n\n if (!error) {\n return sendRedirect(event, next)\n } else {\n return sendRedirect(event, `/auth/error?error=${encodeURIComponent(error.message)}`)\n }\n }\n\n return sendRedirect(event, `/auth/error?error=${encodeURIComponent('No token hash or type')}`)\n})\n", + "content": "import type { EmailOtpType } from '@supabase/supabase-js'\nimport { defineEventHandler, getQuery, sendRedirect } from 'h3'\n\nimport { createSupabaseServerClient } from '@/registry/default/clients/nuxtjs/server/supabase/client'\n\nexport default defineEventHandler(async (event) => {\n const query = getQuery(event)\n const token_hash = query.token_hash as string | null\n const type = query.type as EmailOtpType | null\n const _next = query.next as string | undefined\n const next = _next?.startsWith('/') ? _next : '/'\n\n if (token_hash && type) {\n const supabase = createSupabaseServerClient(event)\n\n const { error } = await supabase.auth.verifyOtp({\n type,\n token_hash,\n })\n\n if (!error) {\n return sendRedirect(event, next)\n } else {\n return sendRedirect(event, `/auth/error?error=${encodeURIComponent(error.message)}`)\n }\n }\n\n return sendRedirect(event, `/auth/error?error=${encodeURIComponent('No token hash or type')}`)\n})\n", "type": "registry:file", "target": "server/routes/auth/confirm.get.ts" } diff --git a/apps/ui-library/public/r/password-based-auth-react-router.json b/apps/ui-library/public/r/password-based-auth-react-router.json index 5210579243b..0b3e87063b1 100644 --- a/apps/ui-library/public/r/password-based-auth-react-router.json +++ b/apps/ui-library/public/r/password-based-auth-react-router.json @@ -73,18 +73,18 @@ }, { "path": "registry/default/clients/react-router/lib/supabase/client.ts", - "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/react-router/lib/supabase/server.ts", - "content": "import { createServerClient, parseCookieHeader, serializeCookieHeader } from '@supabase/ssr'\n\nexport function createClient(request: Request) {\n const headers = new Headers()\n\n const supabase = createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return parseCookieHeader(request.headers.get('Cookie') ?? '') as {\n name: string\n value: string\n }[]\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value, options }) =>\n headers.append('Set-Cookie', serializeCookieHeader(name, value, options))\n )\n },\n },\n }\n )\n\n return { supabase, headers }\n}\n", + "content": "import { createServerClient, parseCookieHeader, serializeCookieHeader } from '@supabase/ssr'\n\nexport function createClient(request: Request) {\n const headers = new Headers()\n\n const supabase = createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return parseCookieHeader(request.headers.get('Cookie') ?? '') as {\n name: string\n value: string\n }[]\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value, options }) =>\n headers.append('Set-Cookie', serializeCookieHeader(name, value, options))\n )\n },\n },\n }\n )\n\n return { supabase, headers }\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/password-based-auth-react.json b/apps/ui-library/public/r/password-based-auth-react.json index 423ec5b625d..e9cfb105d24 100644 --- a/apps/ui-library/public/r/password-based-auth-react.json +++ b/apps/ui-library/public/r/password-based-auth-react.json @@ -36,13 +36,13 @@ }, { "path": "registry/default/clients/react/lib/supabase/client.ts", - "content": "import { createClient as createSupabaseClient } from '@supabase/supabase-js'\n\nexport function createClient() {\n return createSupabaseClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "import { createClient as createSupabaseClient } from '@supabase/supabase-js'\n\nexport function createClient() {\n return createSupabaseClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/password-based-auth-tanstack.json b/apps/ui-library/public/r/password-based-auth-tanstack.json index b9678a4dd5a..3866d119328 100644 --- a/apps/ui-library/public/r/password-based-auth-tanstack.json +++ b/apps/ui-library/public/r/password-based-auth-tanstack.json @@ -96,18 +96,18 @@ }, { "path": "registry/default/clients/tanstack/lib/supabase/client.ts", - "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/tanstack/lib/supabase/server.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { getCookies, setCookie } from '@tanstack/react-start/server'\n\nexport function createClient() {\n return createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return Object.entries(getCookies()).map(\n ([name, value]) =>\n ({\n name,\n value,\n }) as { name: string; value: string }\n )\n },\n setAll(cookies) {\n cookies.forEach((cookie) => {\n setCookie(cookie.name, cookie.value)\n })\n },\n },\n }\n )\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { getCookies, setCookie } from '@tanstack/react-start/server'\n\nexport function createClient() {\n return createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return Object.entries(getCookies()).map(\n ([name, value]) =>\n ({\n name,\n value,\n }) as { name: string; value: string }\n )\n },\n setAll(cookies) {\n cookies.forEach((cookie) => {\n setCookie(cookie.name, cookie.value)\n })\n },\n },\n }\n )\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/realtime-avatar-stack-nextjs.json b/apps/ui-library/public/r/realtime-avatar-stack-nextjs.json index 7d18cec045e..3d325494cbe 100644 --- a/apps/ui-library/public/r/realtime-avatar-stack-nextjs.json +++ b/apps/ui-library/public/r/realtime-avatar-stack-nextjs.json @@ -40,23 +40,23 @@ }, { "path": "registry/default/clients/nextjs/lib/supabase/client.ts", - "content": "import { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "import { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/nextjs/lib/supabase/middleware.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { NextResponse, type NextRequest } from 'next/server'\n\nexport async function updateSession(request: NextRequest) {\n let supabaseResponse = NextResponse.next({\n request,\n })\n\n // With Fluid compute, don't put this client in a global environment\n // variable. Always create a new one on each request.\n const supabase = createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return request.cookies.getAll()\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value))\n supabaseResponse = NextResponse.next({\n request,\n })\n cookiesToSet.forEach(({ name, value, options }) =>\n supabaseResponse.cookies.set(name, value, options)\n )\n },\n },\n }\n )\n\n // Do not run code between createServerClient and\n // supabase.auth.getClaims(). A simple mistake could make it very hard to debug\n // issues with users being randomly logged out.\n\n // IMPORTANT: If you remove getClaims() and you use server-side rendering\n // with the Supabase client, your users may be randomly logged out.\n const { data } = await supabase.auth.getClaims()\n const user = data?.claims\n\n if (\n !user &&\n !request.nextUrl.pathname.startsWith('/login') &&\n !request.nextUrl.pathname.startsWith('/auth')\n ) {\n // no user, potentially respond by redirecting the user to the login page\n const url = request.nextUrl.clone()\n url.pathname = '/auth/login'\n return NextResponse.redirect(url)\n }\n\n // IMPORTANT: You *must* return the supabaseResponse object as it is.\n // If you're creating a new response object with NextResponse.next() make sure to:\n // 1. Pass the request in it, like so:\n // const myNewResponse = NextResponse.next({ request })\n // 2. Copy over the cookies, like so:\n // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())\n // 3. Change the myNewResponse object to fit your needs, but avoid changing\n // the cookies!\n // 4. Finally:\n // return myNewResponse\n // If this is not done, you may be causing the browser and server to go out\n // of sync and terminate the user's session prematurely!\n\n return supabaseResponse\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { NextResponse, type NextRequest } from 'next/server'\n\nexport async function updateSession(request: NextRequest) {\n let supabaseResponse = NextResponse.next({\n request,\n })\n\n // With Fluid compute, don't put this client in a global environment\n // variable. Always create a new one on each request.\n const supabase = createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return request.cookies.getAll()\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value))\n supabaseResponse = NextResponse.next({\n request,\n })\n cookiesToSet.forEach(({ name, value, options }) =>\n supabaseResponse.cookies.set(name, value, options)\n )\n },\n },\n }\n )\n\n // Do not run code between createServerClient and\n // supabase.auth.getClaims(). A simple mistake could make it very hard to debug\n // issues with users being randomly logged out.\n\n // IMPORTANT: If you remove getClaims() and you use server-side rendering\n // with the Supabase client, your users may be randomly logged out.\n const { data } = await supabase.auth.getClaims()\n const user = data?.claims\n\n if (\n !user &&\n !request.nextUrl.pathname.startsWith('/login') &&\n !request.nextUrl.pathname.startsWith('/auth')\n ) {\n // no user, potentially respond by redirecting the user to the login page\n const url = request.nextUrl.clone()\n url.pathname = '/auth/login'\n return NextResponse.redirect(url)\n }\n\n // IMPORTANT: You *must* return the supabaseResponse object as it is.\n // If you're creating a new response object with NextResponse.next() make sure to:\n // 1. Pass the request in it, like so:\n // const myNewResponse = NextResponse.next({ request })\n // 2. Copy over the cookies, like so:\n // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())\n // 3. Change the myNewResponse object to fit your needs, but avoid changing\n // the cookies!\n // 4. Finally:\n // return myNewResponse\n // If this is not done, you may be causing the browser and server to go out\n // of sync and terminate the user's session prematurely!\n\n return supabaseResponse\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/nextjs/lib/supabase/server.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { cookies } from 'next/headers'\n\n/**\n * If using Fluid compute: Don't put this client in a global variable. Always create a new client within each\n * function when using it.\n */\nexport async function createClient() {\n const cookieStore = await cookies()\n\n return createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return cookieStore.getAll()\n },\n setAll(cookiesToSet) {\n try {\n cookiesToSet.forEach(({ name, value, options }) =>\n cookieStore.set(name, value, options)\n )\n } catch {\n // The `setAll` method was called from a Server Component.\n // This can be ignored if you have middleware refreshing\n // user sessions.\n }\n },\n },\n }\n )\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { cookies } from 'next/headers'\n\n/**\n * If using Fluid compute: Don't put this client in a global variable. Always create a new client within each\n * function when using it.\n */\nexport async function createClient() {\n const cookieStore = await cookies()\n\n return createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return cookieStore.getAll()\n },\n setAll(cookiesToSet) {\n try {\n cookiesToSet.forEach(({ name, value, options }) =>\n cookieStore.set(name, value, options)\n )\n } catch {\n // The `setAll` method was called from a Server Component.\n // This can be ignored if you have middleware refreshing\n // user sessions.\n }\n },\n },\n }\n )\n}\n", "type": "registry:lib" } ], "envVars": { "NEXT_PUBLIC_SUPABASE_URL": "", - "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/realtime-avatar-stack-react-router.json b/apps/ui-library/public/r/realtime-avatar-stack-react-router.json index d015da3493c..d1fbd6e3a97 100644 --- a/apps/ui-library/public/r/realtime-avatar-stack-react-router.json +++ b/apps/ui-library/public/r/realtime-avatar-stack-react-router.json @@ -40,18 +40,18 @@ }, { "path": "registry/default/clients/react-router/lib/supabase/client.ts", - "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/react-router/lib/supabase/server.ts", - "content": "import { createServerClient, parseCookieHeader, serializeCookieHeader } from '@supabase/ssr'\n\nexport function createClient(request: Request) {\n const headers = new Headers()\n\n const supabase = createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return parseCookieHeader(request.headers.get('Cookie') ?? '') as {\n name: string\n value: string\n }[]\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value, options }) =>\n headers.append('Set-Cookie', serializeCookieHeader(name, value, options))\n )\n },\n },\n }\n )\n\n return { supabase, headers }\n}\n", + "content": "import { createServerClient, parseCookieHeader, serializeCookieHeader } from '@supabase/ssr'\n\nexport function createClient(request: Request) {\n const headers = new Headers()\n\n const supabase = createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return parseCookieHeader(request.headers.get('Cookie') ?? '') as {\n name: string\n value: string\n }[]\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value, options }) =>\n headers.append('Set-Cookie', serializeCookieHeader(name, value, options))\n )\n },\n },\n }\n )\n\n return { supabase, headers }\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/realtime-avatar-stack-react.json b/apps/ui-library/public/r/realtime-avatar-stack-react.json index 3cf5a8621f9..f11d14a29f1 100644 --- a/apps/ui-library/public/r/realtime-avatar-stack-react.json +++ b/apps/ui-library/public/r/realtime-avatar-stack-react.json @@ -39,13 +39,13 @@ }, { "path": "registry/default/clients/react/lib/supabase/client.ts", - "content": "import { createClient as createSupabaseClient } from '@supabase/supabase-js'\n\nexport function createClient() {\n return createSupabaseClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "import { createClient as createSupabaseClient } from '@supabase/supabase-js'\n\nexport function createClient() {\n return createSupabaseClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/realtime-avatar-stack-tanstack.json b/apps/ui-library/public/r/realtime-avatar-stack-tanstack.json index 4a675bb6c18..8062b076798 100644 --- a/apps/ui-library/public/r/realtime-avatar-stack-tanstack.json +++ b/apps/ui-library/public/r/realtime-avatar-stack-tanstack.json @@ -40,18 +40,18 @@ }, { "path": "registry/default/clients/tanstack/lib/supabase/client.ts", - "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/tanstack/lib/supabase/server.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { getCookies, setCookie } from '@tanstack/react-start/server'\n\nexport function createClient() {\n return createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return Object.entries(getCookies()).map(\n ([name, value]) =>\n ({\n name,\n value,\n }) as { name: string; value: string }\n )\n },\n setAll(cookies) {\n cookies.forEach((cookie) => {\n setCookie(cookie.name, cookie.value)\n })\n },\n },\n }\n )\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { getCookies, setCookie } from '@tanstack/react-start/server'\n\nexport function createClient() {\n return createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return Object.entries(getCookies()).map(\n ([name, value]) =>\n ({\n name,\n value,\n }) as { name: string; value: string }\n )\n },\n setAll(cookies) {\n cookies.forEach((cookie) => {\n setCookie(cookie.name, cookie.value)\n })\n },\n },\n }\n )\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/realtime-chat-nextjs.json b/apps/ui-library/public/r/realtime-chat-nextjs.json index d3d7fd12c77..72385d8c17f 100644 --- a/apps/ui-library/public/r/realtime-chat-nextjs.json +++ b/apps/ui-library/public/r/realtime-chat-nextjs.json @@ -36,23 +36,23 @@ }, { "path": "registry/default/clients/nextjs/lib/supabase/client.ts", - "content": "import { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "import { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/nextjs/lib/supabase/middleware.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { NextResponse, type NextRequest } from 'next/server'\n\nexport async function updateSession(request: NextRequest) {\n let supabaseResponse = NextResponse.next({\n request,\n })\n\n // With Fluid compute, don't put this client in a global environment\n // variable. Always create a new one on each request.\n const supabase = createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return request.cookies.getAll()\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value))\n supabaseResponse = NextResponse.next({\n request,\n })\n cookiesToSet.forEach(({ name, value, options }) =>\n supabaseResponse.cookies.set(name, value, options)\n )\n },\n },\n }\n )\n\n // Do not run code between createServerClient and\n // supabase.auth.getClaims(). A simple mistake could make it very hard to debug\n // issues with users being randomly logged out.\n\n // IMPORTANT: If you remove getClaims() and you use server-side rendering\n // with the Supabase client, your users may be randomly logged out.\n const { data } = await supabase.auth.getClaims()\n const user = data?.claims\n\n if (\n !user &&\n !request.nextUrl.pathname.startsWith('/login') &&\n !request.nextUrl.pathname.startsWith('/auth')\n ) {\n // no user, potentially respond by redirecting the user to the login page\n const url = request.nextUrl.clone()\n url.pathname = '/auth/login'\n return NextResponse.redirect(url)\n }\n\n // IMPORTANT: You *must* return the supabaseResponse object as it is.\n // If you're creating a new response object with NextResponse.next() make sure to:\n // 1. Pass the request in it, like so:\n // const myNewResponse = NextResponse.next({ request })\n // 2. Copy over the cookies, like so:\n // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())\n // 3. Change the myNewResponse object to fit your needs, but avoid changing\n // the cookies!\n // 4. Finally:\n // return myNewResponse\n // If this is not done, you may be causing the browser and server to go out\n // of sync and terminate the user's session prematurely!\n\n return supabaseResponse\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { NextResponse, type NextRequest } from 'next/server'\n\nexport async function updateSession(request: NextRequest) {\n let supabaseResponse = NextResponse.next({\n request,\n })\n\n // With Fluid compute, don't put this client in a global environment\n // variable. Always create a new one on each request.\n const supabase = createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return request.cookies.getAll()\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value))\n supabaseResponse = NextResponse.next({\n request,\n })\n cookiesToSet.forEach(({ name, value, options }) =>\n supabaseResponse.cookies.set(name, value, options)\n )\n },\n },\n }\n )\n\n // Do not run code between createServerClient and\n // supabase.auth.getClaims(). A simple mistake could make it very hard to debug\n // issues with users being randomly logged out.\n\n // IMPORTANT: If you remove getClaims() and you use server-side rendering\n // with the Supabase client, your users may be randomly logged out.\n const { data } = await supabase.auth.getClaims()\n const user = data?.claims\n\n if (\n !user &&\n !request.nextUrl.pathname.startsWith('/login') &&\n !request.nextUrl.pathname.startsWith('/auth')\n ) {\n // no user, potentially respond by redirecting the user to the login page\n const url = request.nextUrl.clone()\n url.pathname = '/auth/login'\n return NextResponse.redirect(url)\n }\n\n // IMPORTANT: You *must* return the supabaseResponse object as it is.\n // If you're creating a new response object with NextResponse.next() make sure to:\n // 1. Pass the request in it, like so:\n // const myNewResponse = NextResponse.next({ request })\n // 2. Copy over the cookies, like so:\n // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())\n // 3. Change the myNewResponse object to fit your needs, but avoid changing\n // the cookies!\n // 4. Finally:\n // return myNewResponse\n // If this is not done, you may be causing the browser and server to go out\n // of sync and terminate the user's session prematurely!\n\n return supabaseResponse\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/nextjs/lib/supabase/server.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { cookies } from 'next/headers'\n\n/**\n * If using Fluid compute: Don't put this client in a global variable. Always create a new client within each\n * function when using it.\n */\nexport async function createClient() {\n const cookieStore = await cookies()\n\n return createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return cookieStore.getAll()\n },\n setAll(cookiesToSet) {\n try {\n cookiesToSet.forEach(({ name, value, options }) =>\n cookieStore.set(name, value, options)\n )\n } catch {\n // The `setAll` method was called from a Server Component.\n // This can be ignored if you have middleware refreshing\n // user sessions.\n }\n },\n },\n }\n )\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { cookies } from 'next/headers'\n\n/**\n * If using Fluid compute: Don't put this client in a global variable. Always create a new client within each\n * function when using it.\n */\nexport async function createClient() {\n const cookieStore = await cookies()\n\n return createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return cookieStore.getAll()\n },\n setAll(cookiesToSet) {\n try {\n cookiesToSet.forEach(({ name, value, options }) =>\n cookieStore.set(name, value, options)\n )\n } catch {\n // The `setAll` method was called from a Server Component.\n // This can be ignored if you have middleware refreshing\n // user sessions.\n }\n },\n },\n }\n )\n}\n", "type": "registry:lib" } ], "envVars": { "NEXT_PUBLIC_SUPABASE_URL": "", - "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/realtime-chat-react-router.json b/apps/ui-library/public/r/realtime-chat-react-router.json index 52bfef06c03..03d6f440570 100644 --- a/apps/ui-library/public/r/realtime-chat-react-router.json +++ b/apps/ui-library/public/r/realtime-chat-react-router.json @@ -36,18 +36,18 @@ }, { "path": "registry/default/clients/react-router/lib/supabase/client.ts", - "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/react-router/lib/supabase/server.ts", - "content": "import { createServerClient, parseCookieHeader, serializeCookieHeader } from '@supabase/ssr'\n\nexport function createClient(request: Request) {\n const headers = new Headers()\n\n const supabase = createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return parseCookieHeader(request.headers.get('Cookie') ?? '') as {\n name: string\n value: string\n }[]\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value, options }) =>\n headers.append('Set-Cookie', serializeCookieHeader(name, value, options))\n )\n },\n },\n }\n )\n\n return { supabase, headers }\n}\n", + "content": "import { createServerClient, parseCookieHeader, serializeCookieHeader } from '@supabase/ssr'\n\nexport function createClient(request: Request) {\n const headers = new Headers()\n\n const supabase = createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return parseCookieHeader(request.headers.get('Cookie') ?? '') as {\n name: string\n value: string\n }[]\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value, options }) =>\n headers.append('Set-Cookie', serializeCookieHeader(name, value, options))\n )\n },\n },\n }\n )\n\n return { supabase, headers }\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/realtime-chat-react.json b/apps/ui-library/public/r/realtime-chat-react.json index 5d111fe2ca9..48d4257d0ed 100644 --- a/apps/ui-library/public/r/realtime-chat-react.json +++ b/apps/ui-library/public/r/realtime-chat-react.json @@ -35,13 +35,13 @@ }, { "path": "registry/default/clients/react/lib/supabase/client.ts", - "content": "import { createClient as createSupabaseClient } from '@supabase/supabase-js'\n\nexport function createClient() {\n return createSupabaseClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "import { createClient as createSupabaseClient } from '@supabase/supabase-js'\n\nexport function createClient() {\n return createSupabaseClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/realtime-chat-tanstack.json b/apps/ui-library/public/r/realtime-chat-tanstack.json index f6b689b4a22..081050218e3 100644 --- a/apps/ui-library/public/r/realtime-chat-tanstack.json +++ b/apps/ui-library/public/r/realtime-chat-tanstack.json @@ -36,18 +36,18 @@ }, { "path": "registry/default/clients/tanstack/lib/supabase/client.ts", - "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/tanstack/lib/supabase/server.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { getCookies, setCookie } from '@tanstack/react-start/server'\n\nexport function createClient() {\n return createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return Object.entries(getCookies()).map(\n ([name, value]) =>\n ({\n name,\n value,\n }) as { name: string; value: string }\n )\n },\n setAll(cookies) {\n cookies.forEach((cookie) => {\n setCookie(cookie.name, cookie.value)\n })\n },\n },\n }\n )\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { getCookies, setCookie } from '@tanstack/react-start/server'\n\nexport function createClient() {\n return createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return Object.entries(getCookies()).map(\n ([name, value]) =>\n ({\n name,\n value,\n }) as { name: string; value: string }\n )\n },\n setAll(cookies) {\n cookies.forEach((cookie) => {\n setCookie(cookie.name, cookie.value)\n })\n },\n },\n }\n )\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/realtime-cursor-nextjs.json b/apps/ui-library/public/r/realtime-cursor-nextjs.json index 6e048da2094..e3913166575 100644 --- a/apps/ui-library/public/r/realtime-cursor-nextjs.json +++ b/apps/ui-library/public/r/realtime-cursor-nextjs.json @@ -28,23 +28,23 @@ }, { "path": "registry/default/clients/nextjs/lib/supabase/client.ts", - "content": "import { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "import { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/nextjs/lib/supabase/middleware.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { NextResponse, type NextRequest } from 'next/server'\n\nexport async function updateSession(request: NextRequest) {\n let supabaseResponse = NextResponse.next({\n request,\n })\n\n // With Fluid compute, don't put this client in a global environment\n // variable. Always create a new one on each request.\n const supabase = createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return request.cookies.getAll()\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value))\n supabaseResponse = NextResponse.next({\n request,\n })\n cookiesToSet.forEach(({ name, value, options }) =>\n supabaseResponse.cookies.set(name, value, options)\n )\n },\n },\n }\n )\n\n // Do not run code between createServerClient and\n // supabase.auth.getClaims(). A simple mistake could make it very hard to debug\n // issues with users being randomly logged out.\n\n // IMPORTANT: If you remove getClaims() and you use server-side rendering\n // with the Supabase client, your users may be randomly logged out.\n const { data } = await supabase.auth.getClaims()\n const user = data?.claims\n\n if (\n !user &&\n !request.nextUrl.pathname.startsWith('/login') &&\n !request.nextUrl.pathname.startsWith('/auth')\n ) {\n // no user, potentially respond by redirecting the user to the login page\n const url = request.nextUrl.clone()\n url.pathname = '/auth/login'\n return NextResponse.redirect(url)\n }\n\n // IMPORTANT: You *must* return the supabaseResponse object as it is.\n // If you're creating a new response object with NextResponse.next() make sure to:\n // 1. Pass the request in it, like so:\n // const myNewResponse = NextResponse.next({ request })\n // 2. Copy over the cookies, like so:\n // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())\n // 3. Change the myNewResponse object to fit your needs, but avoid changing\n // the cookies!\n // 4. Finally:\n // return myNewResponse\n // If this is not done, you may be causing the browser and server to go out\n // of sync and terminate the user's session prematurely!\n\n return supabaseResponse\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { NextResponse, type NextRequest } from 'next/server'\n\nexport async function updateSession(request: NextRequest) {\n let supabaseResponse = NextResponse.next({\n request,\n })\n\n // With Fluid compute, don't put this client in a global environment\n // variable. Always create a new one on each request.\n const supabase = createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return request.cookies.getAll()\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value))\n supabaseResponse = NextResponse.next({\n request,\n })\n cookiesToSet.forEach(({ name, value, options }) =>\n supabaseResponse.cookies.set(name, value, options)\n )\n },\n },\n }\n )\n\n // Do not run code between createServerClient and\n // supabase.auth.getClaims(). A simple mistake could make it very hard to debug\n // issues with users being randomly logged out.\n\n // IMPORTANT: If you remove getClaims() and you use server-side rendering\n // with the Supabase client, your users may be randomly logged out.\n const { data } = await supabase.auth.getClaims()\n const user = data?.claims\n\n if (\n !user &&\n !request.nextUrl.pathname.startsWith('/login') &&\n !request.nextUrl.pathname.startsWith('/auth')\n ) {\n // no user, potentially respond by redirecting the user to the login page\n const url = request.nextUrl.clone()\n url.pathname = '/auth/login'\n return NextResponse.redirect(url)\n }\n\n // IMPORTANT: You *must* return the supabaseResponse object as it is.\n // If you're creating a new response object with NextResponse.next() make sure to:\n // 1. Pass the request in it, like so:\n // const myNewResponse = NextResponse.next({ request })\n // 2. Copy over the cookies, like so:\n // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())\n // 3. Change the myNewResponse object to fit your needs, but avoid changing\n // the cookies!\n // 4. Finally:\n // return myNewResponse\n // If this is not done, you may be causing the browser and server to go out\n // of sync and terminate the user's session prematurely!\n\n return supabaseResponse\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/nextjs/lib/supabase/server.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { cookies } from 'next/headers'\n\n/**\n * If using Fluid compute: Don't put this client in a global variable. Always create a new client within each\n * function when using it.\n */\nexport async function createClient() {\n const cookieStore = await cookies()\n\n return createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return cookieStore.getAll()\n },\n setAll(cookiesToSet) {\n try {\n cookiesToSet.forEach(({ name, value, options }) =>\n cookieStore.set(name, value, options)\n )\n } catch {\n // The `setAll` method was called from a Server Component.\n // This can be ignored if you have middleware refreshing\n // user sessions.\n }\n },\n },\n }\n )\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { cookies } from 'next/headers'\n\n/**\n * If using Fluid compute: Don't put this client in a global variable. Always create a new client within each\n * function when using it.\n */\nexport async function createClient() {\n const cookieStore = await cookies()\n\n return createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return cookieStore.getAll()\n },\n setAll(cookiesToSet) {\n try {\n cookiesToSet.forEach(({ name, value, options }) =>\n cookieStore.set(name, value, options)\n )\n } catch {\n // The `setAll` method was called from a Server Component.\n // This can be ignored if you have middleware refreshing\n // user sessions.\n }\n },\n },\n }\n )\n}\n", "type": "registry:lib" } ], "envVars": { "NEXT_PUBLIC_SUPABASE_URL": "", - "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/realtime-cursor-nuxtjs.json b/apps/ui-library/public/r/realtime-cursor-nuxtjs.json index f392f2c2c64..77c6a12e85d 100644 --- a/apps/ui-library/public/r/realtime-cursor-nuxtjs.json +++ b/apps/ui-library/public/r/realtime-cursor-nuxtjs.json @@ -24,7 +24,7 @@ }, { "path": "registry/default/realtime-cursor/nuxtjs/app/composables/useRealtimeCursors.ts", - "content": "import { ref, reactive, onMounted, onUnmounted } from 'vue'\nimport { REALTIME_SUBSCRIBE_STATES, type RealtimeChannel } from '@supabase/supabase-js'\n// @ts-ignore\nimport { createClient } from '@/lib/supabase/client'\n\n/**\n * Throttle a callback to a certain delay.\n * It will only call the callback if the delay has passed,\n * using the arguments from the last call.\n */\nfunction useThrottleCallback(\n callback: (...args: Params) => void,\n delay: number\n) {\n let lastCall = 0\n let timeout: ReturnType | null = null\n\n const run = (...args: Params) => {\n const now = Date.now()\n const remainingTime = delay - (now - lastCall)\n\n if (remainingTime <= 0) {\n if (timeout) {\n clearTimeout(timeout)\n timeout = null\n }\n lastCall = now\n callback(...args)\n } else if (!timeout) {\n timeout = setTimeout(() => {\n lastCall = Date.now()\n timeout = null\n callback(...args)\n }, remainingTime)\n }\n }\n\n const cancel = () => {\n if (timeout) {\n clearTimeout(timeout)\n timeout = null\n }\n }\n\n return { run, cancel }\n}\n\nconst supabase = createClient()\n\nconst generateRandomColor = () =>\n `hsl(${Math.floor(Math.random() * 360)}, 100%, 70%)`\n\nconst generateRandomNumber = () =>\n Math.floor(Math.random() * 100)\n\nconst EVENT_NAME = 'realtime-cursor-move'\n\nexport type CursorEventPayload = {\n position: { x: number; y: number }\n user: { id: number; name: string }\n color: string\n timestamp: number\n}\n\nexport function useRealtimeCursors({\n roomName,\n username,\n throttleMs,\n}: {\n roomName: string\n username: string\n throttleMs: number\n}) {\n const color = generateRandomColor()\n const userId = generateRandomNumber()\n\n const cursors = reactive>({})\n const cursorPayload = ref(null)\n const channelRef = ref(null)\n\n const sendCursor = (event: MouseEvent) => {\n const payload: CursorEventPayload = {\n position: {\n x: event.clientX,\n y: event.clientY,\n },\n user: {\n id: userId,\n name: username,\n },\n color,\n timestamp: Date.now(),\n }\n\n cursorPayload.value = payload\n\n channelRef.value?.send({\n type: 'broadcast',\n event: EVENT_NAME,\n payload,\n })\n }\n\n const { run: handleMouseMove, cancel: cancelThrottle } =\n useThrottleCallback(sendCursor, throttleMs)\n\n onMounted(() => {\n const channel = supabase.channel(roomName)\n\n channel\n .on('system', {}, (payload: CursorEventPayload) => {\n console.error('Realtime system error:', payload)\n\n // Defensive cleanup\n Object.keys(cursors).forEach((k) => delete cursors[k])\n channelRef.value = null\n })\n .on('presence', { event: 'leave' }, ({ leftPresences }: { leftPresences: Array<{ key: string }> }) => {\n leftPresences.forEach(({ key }) => {\n delete cursors[key]\n })\n })\n .on('presence', { event: 'join' }, () => {\n if (!cursorPayload.value) return\n\n channelRef.value?.send({\n type: 'broadcast',\n event: EVENT_NAME,\n payload: cursorPayload.value,\n })\n })\n .on('broadcast', { event: EVENT_NAME }, ({ payload }: { payload: CursorEventPayload }) => {\n if (payload.user.id === userId) return\n\n cursors[payload.user.id] = payload\n })\n .subscribe(async (status: REALTIME_SUBSCRIBE_STATES) => {\n if (status === REALTIME_SUBSCRIBE_STATES.SUBSCRIBED) {\n try {\n await channel.track({ key: userId })\n channelRef.value = channel\n } catch (err) {\n console.error('Failed to track presence for current user:', err)\n channelRef.value = null\n }\n } else {\n Object.keys(cursors).forEach((k) => delete cursors[k])\n channelRef.value = null\n }\n })\n\n window.addEventListener('mousemove', handleMouseMove)\n })\n\n onUnmounted(() => {\n window.removeEventListener('mousemove', handleMouseMove)\n\n cancelThrottle()\n\n if (channelRef.value) {\n channelRef.value.unsubscribe()\n channelRef.value = null\n }\n\n Object.keys(cursors).forEach((k) => delete cursors[k])\n })\n\n return { cursors }\n}\n", + "content": "import { REALTIME_SUBSCRIBE_STATES, type RealtimeChannel } from '@supabase/supabase-js'\nimport { onMounted, onUnmounted, reactive, ref } from 'vue'\n\n// @ts-ignore\nimport { createClient } from '@/lib/supabase/client'\n\n/**\n * Throttle a callback to a certain delay.\n * It will only call the callback if the delay has passed,\n * using the arguments from the last call.\n */\nfunction useThrottleCallback(\n callback: (...args: Params) => void,\n delay: number\n) {\n let lastCall = 0\n let timeout: ReturnType | null = null\n\n const run = (...args: Params) => {\n const now = Date.now()\n const remainingTime = delay - (now - lastCall)\n\n if (remainingTime <= 0) {\n if (timeout) {\n clearTimeout(timeout)\n timeout = null\n }\n lastCall = now\n callback(...args)\n } else if (!timeout) {\n timeout = setTimeout(() => {\n lastCall = Date.now()\n timeout = null\n callback(...args)\n }, remainingTime)\n }\n }\n\n const cancel = () => {\n if (timeout) {\n clearTimeout(timeout)\n timeout = null\n }\n }\n\n return { run, cancel }\n}\n\nconst supabase = createClient()\n\nconst generateRandomColor = () => `hsl(${Math.floor(Math.random() * 360)}, 100%, 70%)`\n\nconst generateRandomNumber = () => Math.floor(Math.random() * 100)\n\nconst EVENT_NAME = 'realtime-cursor-move'\n\nexport type CursorEventPayload = {\n position: { x: number; y: number }\n user: { id: number; name: string }\n color: string\n timestamp: number\n}\n\nexport function useRealtimeCursors({\n roomName,\n username,\n throttleMs,\n}: {\n roomName: string\n username: string\n throttleMs: number\n}) {\n const color = generateRandomColor()\n const userId = generateRandomNumber()\n\n const cursors = reactive>({})\n const cursorPayload = ref(null)\n const channelRef = ref(null)\n\n const sendCursor = (event: MouseEvent) => {\n const payload: CursorEventPayload = {\n position: {\n x: event.clientX,\n y: event.clientY,\n },\n user: {\n id: userId,\n name: username,\n },\n color,\n timestamp: Date.now(),\n }\n\n cursorPayload.value = payload\n\n channelRef.value?.send({\n type: 'broadcast',\n event: EVENT_NAME,\n payload,\n })\n }\n\n const { run: handleMouseMove, cancel: cancelThrottle } = useThrottleCallback(\n sendCursor,\n throttleMs\n )\n\n onMounted(() => {\n const channel = supabase.channel(roomName)\n\n channel\n .on('system', {}, (payload: CursorEventPayload) => {\n console.error('Realtime system error:', payload)\n\n // Defensive cleanup\n Object.keys(cursors).forEach((k) => delete cursors[k])\n channelRef.value = null\n })\n .on(\n 'presence',\n { event: 'leave' },\n ({ leftPresences }: { leftPresences: Array<{ key: string }> }) => {\n leftPresences.forEach(({ key }) => {\n delete cursors[key]\n })\n }\n )\n .on('presence', { event: 'join' }, () => {\n if (!cursorPayload.value) return\n\n channelRef.value?.send({\n type: 'broadcast',\n event: EVENT_NAME,\n payload: cursorPayload.value,\n })\n })\n .on('broadcast', { event: EVENT_NAME }, ({ payload }: { payload: CursorEventPayload }) => {\n if (payload.user.id === userId) return\n\n cursors[payload.user.id] = payload\n })\n .subscribe(async (status: REALTIME_SUBSCRIBE_STATES) => {\n if (status === REALTIME_SUBSCRIBE_STATES.SUBSCRIBED) {\n try {\n await channel.track({ key: userId })\n channelRef.value = channel\n } catch (err) {\n console.error('Failed to track presence for current user:', err)\n channelRef.value = null\n }\n } else {\n Object.keys(cursors).forEach((k) => delete cursors[k])\n channelRef.value = null\n }\n })\n\n window.addEventListener('mousemove', handleMouseMove)\n })\n\n onUnmounted(() => {\n window.removeEventListener('mousemove', handleMouseMove)\n\n cancelThrottle()\n\n if (channelRef.value) {\n channelRef.value.unsubscribe()\n channelRef.value = null\n }\n\n Object.keys(cursors).forEach((k) => delete cursors[k])\n })\n\n return { cursors }\n}\n", "type": "registry:component", "target": "app/composables/useRealtimeCursors.ts" } diff --git a/apps/ui-library/public/r/realtime-cursor-react-router.json b/apps/ui-library/public/r/realtime-cursor-react-router.json index 8a97b0e1119..9585ad66f3f 100644 --- a/apps/ui-library/public/r/realtime-cursor-react-router.json +++ b/apps/ui-library/public/r/realtime-cursor-react-router.json @@ -28,18 +28,18 @@ }, { "path": "registry/default/clients/react-router/lib/supabase/client.ts", - "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/react-router/lib/supabase/server.ts", - "content": "import { createServerClient, parseCookieHeader, serializeCookieHeader } from '@supabase/ssr'\n\nexport function createClient(request: Request) {\n const headers = new Headers()\n\n const supabase = createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return parseCookieHeader(request.headers.get('Cookie') ?? '') as {\n name: string\n value: string\n }[]\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value, options }) =>\n headers.append('Set-Cookie', serializeCookieHeader(name, value, options))\n )\n },\n },\n }\n )\n\n return { supabase, headers }\n}\n", + "content": "import { createServerClient, parseCookieHeader, serializeCookieHeader } from '@supabase/ssr'\n\nexport function createClient(request: Request) {\n const headers = new Headers()\n\n const supabase = createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return parseCookieHeader(request.headers.get('Cookie') ?? '') as {\n name: string\n value: string\n }[]\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value, options }) =>\n headers.append('Set-Cookie', serializeCookieHeader(name, value, options))\n )\n },\n },\n }\n )\n\n return { supabase, headers }\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/realtime-cursor-react.json b/apps/ui-library/public/r/realtime-cursor-react.json index 51a176d6549..52b98fe284a 100644 --- a/apps/ui-library/public/r/realtime-cursor-react.json +++ b/apps/ui-library/public/r/realtime-cursor-react.json @@ -27,13 +27,13 @@ }, { "path": "registry/default/clients/react/lib/supabase/client.ts", - "content": "import { createClient as createSupabaseClient } from '@supabase/supabase-js'\n\nexport function createClient() {\n return createSupabaseClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "import { createClient as createSupabaseClient } from '@supabase/supabase-js'\n\nexport function createClient() {\n return createSupabaseClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/realtime-cursor-tanstack.json b/apps/ui-library/public/r/realtime-cursor-tanstack.json index 0c310bcf90b..8d092101aa5 100644 --- a/apps/ui-library/public/r/realtime-cursor-tanstack.json +++ b/apps/ui-library/public/r/realtime-cursor-tanstack.json @@ -28,18 +28,18 @@ }, { "path": "registry/default/clients/tanstack/lib/supabase/client.ts", - "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/tanstack/lib/supabase/server.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { getCookies, setCookie } from '@tanstack/react-start/server'\n\nexport function createClient() {\n return createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return Object.entries(getCookies()).map(\n ([name, value]) =>\n ({\n name,\n value,\n }) as { name: string; value: string }\n )\n },\n setAll(cookies) {\n cookies.forEach((cookie) => {\n setCookie(cookie.name, cookie.value)\n })\n },\n },\n }\n )\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { getCookies, setCookie } from '@tanstack/react-start/server'\n\nexport function createClient() {\n return createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return Object.entries(getCookies()).map(\n ([name, value]) =>\n ({\n name,\n value,\n }) as { name: string; value: string }\n )\n },\n setAll(cookies) {\n cookies.forEach((cookie) => {\n setCookie(cookie.name, cookie.value)\n })\n },\n },\n }\n )\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/realtime-cursor-vue.json b/apps/ui-library/public/r/realtime-cursor-vue.json index dca9a2af3c1..62a7ee1b61f 100644 --- a/apps/ui-library/public/r/realtime-cursor-vue.json +++ b/apps/ui-library/public/r/realtime-cursor-vue.json @@ -24,7 +24,7 @@ }, { "path": "registry/default/realtime-cursor/vue/composables/useRealtimeCursors.ts", - "content": "import { ref, reactive, onMounted, onUnmounted } from 'vue'\nimport { REALTIME_SUBSCRIBE_STATES, type RealtimeChannel } from '@supabase/supabase-js'\n// @ts-ignore\nimport { createClient } from '@/lib/supabase/client'\n\n/**\n * Throttle a callback to a certain delay.\n * It will only call the callback if the delay has passed,\n * using the arguments from the last call.\n */\nfunction useThrottleCallback(\n callback: (...args: Params) => void,\n delay: number\n) {\n let lastCall = 0\n let timeout: ReturnType | null = null\n\n const run = (...args: Params) => {\n const now = Date.now()\n const remainingTime = delay - (now - lastCall)\n\n if (remainingTime <= 0) {\n if (timeout) {\n clearTimeout(timeout)\n timeout = null\n }\n lastCall = now\n callback(...args)\n } else if (!timeout) {\n timeout = setTimeout(() => {\n lastCall = Date.now()\n timeout = null\n callback(...args)\n }, remainingTime)\n }\n }\n\n const cancel = () => {\n if (timeout) {\n clearTimeout(timeout)\n timeout = null\n }\n }\n\n return { run, cancel }\n}\n\nconst supabase = createClient()\n\nconst generateRandomColor = () =>\n `hsl(${Math.floor(Math.random() * 360)}, 100%, 70%)`\n\nconst generateRandomNumber = () =>\n Math.floor(Math.random() * 100)\n\nconst EVENT_NAME = 'realtime-cursor-move'\n\nexport type CursorEventPayload = {\n position: { x: number; y: number }\n user: { id: number; name: string }\n color: string\n timestamp: number\n}\n\nexport function useRealtimeCursors({\n roomName,\n username,\n throttleMs,\n}: {\n roomName: string\n username: string\n throttleMs: number\n}) {\n const color = generateRandomColor()\n const userId = generateRandomNumber()\n\n const cursors = reactive>({})\n const cursorPayload = ref(null)\n const channelRef = ref(null)\n\n const sendCursor = (event: MouseEvent) => {\n const payload: CursorEventPayload = {\n position: {\n x: event.clientX,\n y: event.clientY,\n },\n user: {\n id: userId,\n name: username,\n },\n color,\n timestamp: Date.now(),\n }\n\n cursorPayload.value = payload\n\n channelRef.value?.send({\n type: 'broadcast',\n event: EVENT_NAME,\n payload,\n })\n }\n\n const { run: handleMouseMove, cancel: cancelThrottle } =\n useThrottleCallback(sendCursor, throttleMs)\n\n onMounted(() => {\n const channel = supabase.channel(roomName)\n\n channel\n .on('system', {}, (payload: CursorEventPayload) => {\n console.error('Realtime system error:', payload)\n\n // Defensive cleanup\n Object.keys(cursors).forEach((k) => delete cursors[k])\n channelRef.value = null\n })\n .on('presence', { event: 'leave' }, ({ leftPresences }: { leftPresences: Array<{ key: string }> }) => {\n leftPresences.forEach(({ key }) => {\n delete cursors[key]\n })\n })\n .on('presence', { event: 'join' }, () => {\n if (!cursorPayload.value) return\n\n channelRef.value?.send({\n type: 'broadcast',\n event: EVENT_NAME,\n payload: cursorPayload.value,\n })\n })\n .on('broadcast', { event: EVENT_NAME }, ({ payload }: { payload: CursorEventPayload }) => {\n if (payload.user.id === userId) return\n\n cursors[payload.user.id] = payload\n })\n .subscribe(async (status: REALTIME_SUBSCRIBE_STATES) => {\n if (status === REALTIME_SUBSCRIBE_STATES.SUBSCRIBED) {\n try {\n await channel.track({ key: userId })\n channelRef.value = channel\n } catch (err) {\n console.error('Failed to track presence for current user:', err)\n channelRef.value = null\n }\n } else {\n Object.keys(cursors).forEach((k) => delete cursors[k])\n channelRef.value = null\n }\n })\n\n window.addEventListener('mousemove', handleMouseMove)\n })\n\n onUnmounted(() => {\n window.removeEventListener('mousemove', handleMouseMove)\n\n cancelThrottle()\n\n if (channelRef.value) {\n channelRef.value.unsubscribe()\n channelRef.value = null\n }\n\n Object.keys(cursors).forEach((k) => delete cursors[k])\n })\n\n return { cursors }\n}\n", + "content": "import { REALTIME_SUBSCRIBE_STATES, type RealtimeChannel } from '@supabase/supabase-js'\nimport { onMounted, onUnmounted, reactive, ref } from 'vue'\n\n// @ts-ignore\nimport { createClient } from '@/lib/supabase/client'\n\n/**\n * Throttle a callback to a certain delay.\n * It will only call the callback if the delay has passed,\n * using the arguments from the last call.\n */\nfunction useThrottleCallback(\n callback: (...args: Params) => void,\n delay: number\n) {\n let lastCall = 0\n let timeout: ReturnType | null = null\n\n const run = (...args: Params) => {\n const now = Date.now()\n const remainingTime = delay - (now - lastCall)\n\n if (remainingTime <= 0) {\n if (timeout) {\n clearTimeout(timeout)\n timeout = null\n }\n lastCall = now\n callback(...args)\n } else if (!timeout) {\n timeout = setTimeout(() => {\n lastCall = Date.now()\n timeout = null\n callback(...args)\n }, remainingTime)\n }\n }\n\n const cancel = () => {\n if (timeout) {\n clearTimeout(timeout)\n timeout = null\n }\n }\n\n return { run, cancel }\n}\n\nconst supabase = createClient()\n\nconst generateRandomColor = () => `hsl(${Math.floor(Math.random() * 360)}, 100%, 70%)`\n\nconst generateRandomNumber = () => Math.floor(Math.random() * 100)\n\nconst EVENT_NAME = 'realtime-cursor-move'\n\nexport type CursorEventPayload = {\n position: { x: number; y: number }\n user: { id: number; name: string }\n color: string\n timestamp: number\n}\n\nexport function useRealtimeCursors({\n roomName,\n username,\n throttleMs,\n}: {\n roomName: string\n username: string\n throttleMs: number\n}) {\n const color = generateRandomColor()\n const userId = generateRandomNumber()\n\n const cursors = reactive>({})\n const cursorPayload = ref(null)\n const channelRef = ref(null)\n\n const sendCursor = (event: MouseEvent) => {\n const payload: CursorEventPayload = {\n position: {\n x: event.clientX,\n y: event.clientY,\n },\n user: {\n id: userId,\n name: username,\n },\n color,\n timestamp: Date.now(),\n }\n\n cursorPayload.value = payload\n\n channelRef.value?.send({\n type: 'broadcast',\n event: EVENT_NAME,\n payload,\n })\n }\n\n const { run: handleMouseMove, cancel: cancelThrottle } = useThrottleCallback(\n sendCursor,\n throttleMs\n )\n\n onMounted(() => {\n const channel = supabase.channel(roomName)\n\n channel\n .on('system', {}, (payload: CursorEventPayload) => {\n console.error('Realtime system error:', payload)\n\n // Defensive cleanup\n Object.keys(cursors).forEach((k) => delete cursors[k])\n channelRef.value = null\n })\n .on(\n 'presence',\n { event: 'leave' },\n ({ leftPresences }: { leftPresences: Array<{ key: string }> }) => {\n leftPresences.forEach(({ key }) => {\n delete cursors[key]\n })\n }\n )\n .on('presence', { event: 'join' }, () => {\n if (!cursorPayload.value) return\n\n channelRef.value?.send({\n type: 'broadcast',\n event: EVENT_NAME,\n payload: cursorPayload.value,\n })\n })\n .on('broadcast', { event: EVENT_NAME }, ({ payload }: { payload: CursorEventPayload }) => {\n if (payload.user.id === userId) return\n\n cursors[payload.user.id] = payload\n })\n .subscribe(async (status: REALTIME_SUBSCRIBE_STATES) => {\n if (status === REALTIME_SUBSCRIBE_STATES.SUBSCRIBED) {\n try {\n await channel.track({ key: userId })\n channelRef.value = channel\n } catch (err) {\n console.error('Failed to track presence for current user:', err)\n channelRef.value = null\n }\n } else {\n Object.keys(cursors).forEach((k) => delete cursors[k])\n channelRef.value = null\n }\n })\n\n window.addEventListener('mousemove', handleMouseMove)\n })\n\n onUnmounted(() => {\n window.removeEventListener('mousemove', handleMouseMove)\n\n cancelThrottle()\n\n if (channelRef.value) {\n channelRef.value.unsubscribe()\n channelRef.value = null\n }\n\n Object.keys(cursors).forEach((k) => delete cursors[k])\n })\n\n return { cursors }\n}\n", "type": "registry:component", "target": "composables/useRealtimeCursors.ts" } diff --git a/apps/ui-library/public/r/registry.json b/apps/ui-library/public/r/registry.json index 41edf2c6e6e..a757ca0ae49 100644 --- a/apps/ui-library/public/r/registry.json +++ b/apps/ui-library/public/r/registry.json @@ -97,10 +97,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "NEXT_PUBLIC_SUPABASE_URL": "", - "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -139,10 +139,10 @@ "dependencies": [ "@supabase/supabase-js@latest" ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -217,10 +217,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -313,10 +313,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -379,10 +379,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "NEXT_PUBLIC_SUPABASE_URL": "", - "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -407,10 +407,10 @@ "dependencies": [ "@supabase/supabase-js@latest" ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -468,10 +468,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -530,10 +530,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -573,10 +573,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "NEXT_PUBLIC_SUPABASE_URL": "", - "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -607,10 +607,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -646,10 +646,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -685,10 +685,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -729,10 +729,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "NEXT_PUBLIC_SUPABASE_URL": "", - "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -764,10 +764,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -804,10 +804,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -844,10 +844,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -889,10 +889,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "NEXT_PUBLIC_SUPABASE_URL": "", - "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -925,10 +925,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -966,10 +966,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -1007,10 +1007,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -1061,10 +1061,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "NEXT_PUBLIC_SUPABASE_URL": "", - "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -1106,10 +1106,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -1156,10 +1156,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -1206,10 +1206,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -1257,10 +1257,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "NEXT_PUBLIC_SUPABASE_URL": "", - "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -1299,10 +1299,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -1346,10 +1346,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -1393,10 +1393,10 @@ "type": "registry:lib" } ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" } }, { @@ -1428,10 +1428,10 @@ "@supabase/ssr@latest", "@supabase/supabase-js@latest" ], - "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "NEXT_PUBLIC_SUPABASE_URL": "", - "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": "" }, "files": [ { @@ -1458,10 +1458,10 @@ "dependencies": [ "@supabase/supabase-js@latest" ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, "files": [ { @@ -1481,10 +1481,10 @@ "@supabase/ssr@latest", "@supabase/supabase-js@latest" ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, "files": [ { @@ -1508,10 +1508,10 @@ "@supabase/ssr@latest", "@supabase/supabase-js@latest" ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, "files": [ { @@ -1712,10 +1712,10 @@ "@supabase/ssr@latest", "@supabase/supabase-js@latest" ], - "docs": "You'll need to set the following environment variables in your project: `NUXT_PUBLIC_SUPABASE_URL` and `NUXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `NUXT_PUBLIC_SUPABASE_URL` and `NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "NUXT_PUBLIC_SUPABASE_URL": "", - "NUXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": "" }, "files": [ { @@ -1749,10 +1749,10 @@ "dependencies": [ "@supabase/supabase-js@latest" ], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, "files": [ { diff --git a/apps/ui-library/public/r/social-auth-nextjs.json b/apps/ui-library/public/r/social-auth-nextjs.json index 5a40cb2ab60..6463dd1b85e 100644 --- a/apps/ui-library/public/r/social-auth-nextjs.json +++ b/apps/ui-library/public/r/social-auth-nextjs.json @@ -55,23 +55,23 @@ }, { "path": "registry/default/clients/nextjs/lib/supabase/client.ts", - "content": "import { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "import { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/nextjs/lib/supabase/middleware.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { NextResponse, type NextRequest } from 'next/server'\n\nexport async function updateSession(request: NextRequest) {\n let supabaseResponse = NextResponse.next({\n request,\n })\n\n // With Fluid compute, don't put this client in a global environment\n // variable. Always create a new one on each request.\n const supabase = createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return request.cookies.getAll()\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value))\n supabaseResponse = NextResponse.next({\n request,\n })\n cookiesToSet.forEach(({ name, value, options }) =>\n supabaseResponse.cookies.set(name, value, options)\n )\n },\n },\n }\n )\n\n // Do not run code between createServerClient and\n // supabase.auth.getClaims(). A simple mistake could make it very hard to debug\n // issues with users being randomly logged out.\n\n // IMPORTANT: If you remove getClaims() and you use server-side rendering\n // with the Supabase client, your users may be randomly logged out.\n const { data } = await supabase.auth.getClaims()\n const user = data?.claims\n\n if (\n !user &&\n !request.nextUrl.pathname.startsWith('/login') &&\n !request.nextUrl.pathname.startsWith('/auth')\n ) {\n // no user, potentially respond by redirecting the user to the login page\n const url = request.nextUrl.clone()\n url.pathname = '/auth/login'\n return NextResponse.redirect(url)\n }\n\n // IMPORTANT: You *must* return the supabaseResponse object as it is.\n // If you're creating a new response object with NextResponse.next() make sure to:\n // 1. Pass the request in it, like so:\n // const myNewResponse = NextResponse.next({ request })\n // 2. Copy over the cookies, like so:\n // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())\n // 3. Change the myNewResponse object to fit your needs, but avoid changing\n // the cookies!\n // 4. Finally:\n // return myNewResponse\n // If this is not done, you may be causing the browser and server to go out\n // of sync and terminate the user's session prematurely!\n\n return supabaseResponse\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { NextResponse, type NextRequest } from 'next/server'\n\nexport async function updateSession(request: NextRequest) {\n let supabaseResponse = NextResponse.next({\n request,\n })\n\n // With Fluid compute, don't put this client in a global environment\n // variable. Always create a new one on each request.\n const supabase = createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return request.cookies.getAll()\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value))\n supabaseResponse = NextResponse.next({\n request,\n })\n cookiesToSet.forEach(({ name, value, options }) =>\n supabaseResponse.cookies.set(name, value, options)\n )\n },\n },\n }\n )\n\n // Do not run code between createServerClient and\n // supabase.auth.getClaims(). A simple mistake could make it very hard to debug\n // issues with users being randomly logged out.\n\n // IMPORTANT: If you remove getClaims() and you use server-side rendering\n // with the Supabase client, your users may be randomly logged out.\n const { data } = await supabase.auth.getClaims()\n const user = data?.claims\n\n if (\n !user &&\n !request.nextUrl.pathname.startsWith('/login') &&\n !request.nextUrl.pathname.startsWith('/auth')\n ) {\n // no user, potentially respond by redirecting the user to the login page\n const url = request.nextUrl.clone()\n url.pathname = '/auth/login'\n return NextResponse.redirect(url)\n }\n\n // IMPORTANT: You *must* return the supabaseResponse object as it is.\n // If you're creating a new response object with NextResponse.next() make sure to:\n // 1. Pass the request in it, like so:\n // const myNewResponse = NextResponse.next({ request })\n // 2. Copy over the cookies, like so:\n // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())\n // 3. Change the myNewResponse object to fit your needs, but avoid changing\n // the cookies!\n // 4. Finally:\n // return myNewResponse\n // If this is not done, you may be causing the browser and server to go out\n // of sync and terminate the user's session prematurely!\n\n return supabaseResponse\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/nextjs/lib/supabase/server.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { cookies } from 'next/headers'\n\n/**\n * If using Fluid compute: Don't put this client in a global variable. Always create a new client within each\n * function when using it.\n */\nexport async function createClient() {\n const cookieStore = await cookies()\n\n return createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return cookieStore.getAll()\n },\n setAll(cookiesToSet) {\n try {\n cookiesToSet.forEach(({ name, value, options }) =>\n cookieStore.set(name, value, options)\n )\n } catch {\n // The `setAll` method was called from a Server Component.\n // This can be ignored if you have middleware refreshing\n // user sessions.\n }\n },\n },\n }\n )\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { cookies } from 'next/headers'\n\n/**\n * If using Fluid compute: Don't put this client in a global variable. Always create a new client within each\n * function when using it.\n */\nexport async function createClient() {\n const cookieStore = await cookies()\n\n return createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return cookieStore.getAll()\n },\n setAll(cookiesToSet) {\n try {\n cookiesToSet.forEach(({ name, value, options }) =>\n cookieStore.set(name, value, options)\n )\n } catch {\n // The `setAll` method was called from a Server Component.\n // This can be ignored if you have middleware refreshing\n // user sessions.\n }\n },\n },\n }\n )\n}\n", "type": "registry:lib" } ], "envVars": { "NEXT_PUBLIC_SUPABASE_URL": "", - "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/social-auth-nuxtjs.json b/apps/ui-library/public/r/social-auth-nuxtjs.json index 64639fe3b99..1d42467b723 100644 --- a/apps/ui-library/public/r/social-auth-nuxtjs.json +++ b/apps/ui-library/public/r/social-auth-nuxtjs.json @@ -47,13 +47,13 @@ }, { "path": "registry/default/social-auth/nuxtjs/server/middleware/auth.ts", - "content": "import { defineEventHandler, sendRedirect } from 'h3'\nimport { createSupabaseServerClient } from '@/registry/default/clients/nuxtjs/server/supabase/client'\n\nexport default defineEventHandler(async (event) => {\n const supabase = createSupabaseServerClient(event)\n\n // Get user claims\n const { data } = await supabase.auth.getClaims()\n const user = data?.claims\n\n const pathname = event.node.req.url || '/'\n\n // Redirect if no user and not already on login/auth route\n if (\n !user &&\n !pathname.startsWith('/login') &&\n !pathname.startsWith('/auth')\n ) {\n return sendRedirect(event, '/auth/login')\n }\n\n // Return event as-is (you could return any object if needed)\n return { user }\n})\n", + "content": "import { defineEventHandler, sendRedirect } from 'h3'\n\nimport { createSupabaseServerClient } from '@/registry/default/clients/nuxtjs/server/supabase/client'\n\nexport default defineEventHandler(async (event) => {\n const supabase = createSupabaseServerClient(event)\n\n // Get user claims\n const { data } = await supabase.auth.getClaims()\n const user = data?.claims\n\n const pathname = event.node.req.url || '/'\n\n // Redirect if no user and not already on login/auth route\n if (!user && !pathname.startsWith('/login') && !pathname.startsWith('/auth')) {\n return sendRedirect(event, '/auth/login')\n }\n\n // Return event as-is (you could return any object if needed)\n return { user }\n})\n", "type": "registry:file", "target": "server/middleware/auth.ts" }, { "path": "registry/default/social-auth/nuxtjs/server/routes/auth/oauth.ts", - "content": "import { createSupabaseServerClient } from '@/registry/default/clients/nuxtjs/server/supabase/client'\nimport { defineEventHandler, getQuery, sendRedirect, getRequestURL } from \"h3\"\n\nexport default defineEventHandler(async (event) => {\n const url = getRequestURL(event) // URL object of the current request\n const query = getQuery(event)\n\n const code = query.code as string | undefined\n let next = (query.next as string | undefined) ?? \"/\"\n\n if (!next.startsWith(\"/\")) {\n next = \"/\"\n }\n\n if (code) {\n const supabase = createSupabaseServerClient(event)\n const { error } = await supabase.auth.exchangeCodeForSession(code)\n\n if (!error) {\n // Determine origin\n const forwardedHost = event.node.req.headers[\"x-forwarded-host\"] as string | undefined\n const isLocalEnv = process.env.NODE_ENV === \"development\"\n const origin = `${url.protocol}//${url.host}`\n\n if (isLocalEnv) {\n return sendRedirect(event, `${origin}${next}`)\n } else if (forwardedHost) {\n return sendRedirect(event, `https://${forwardedHost}${next}`)\n } else {\n return sendRedirect(event, `${origin}${next}`)\n }\n }\n }\n\n // fallback to error page\n const origin = `${url.protocol}//${url.host}`\n return sendRedirect(event, `${origin}/auth/error`)\n})\n", + "content": "import { defineEventHandler, getQuery, getRequestURL, sendRedirect } from 'h3'\n\nimport { createSupabaseServerClient } from '@/registry/default/clients/nuxtjs/server/supabase/client'\n\nexport default defineEventHandler(async (event) => {\n const url = getRequestURL(event) // URL object of the current request\n const query = getQuery(event)\n\n const code = query.code as string | undefined\n let next = (query.next as string | undefined) ?? '/'\n\n if (!next.startsWith('/')) {\n next = '/'\n }\n\n if (code) {\n const supabase = createSupabaseServerClient(event)\n const { error } = await supabase.auth.exchangeCodeForSession(code)\n\n if (!error) {\n // Determine origin\n const forwardedHost = event.node.req.headers['x-forwarded-host'] as string | undefined\n const isLocalEnv = process.env.NODE_ENV === 'development'\n const origin = `${url.protocol}//${url.host}`\n\n if (isLocalEnv) {\n return sendRedirect(event, `${origin}${next}`)\n } else if (forwardedHost) {\n return sendRedirect(event, `https://${forwardedHost}${next}`)\n } else {\n return sendRedirect(event, `${origin}${next}`)\n }\n }\n }\n\n // fallback to error page\n const origin = `${url.protocol}//${url.host}`\n return sendRedirect(event, `${origin}/auth/error`)\n})\n", "type": "registry:file", "target": "server/routes/auth/oauth.ts" } diff --git a/apps/ui-library/public/r/social-auth-react-router.json b/apps/ui-library/public/r/social-auth-react-router.json index f51750595e3..b6d80cfa459 100644 --- a/apps/ui-library/public/r/social-auth-react-router.json +++ b/apps/ui-library/public/r/social-auth-react-router.json @@ -53,18 +53,18 @@ }, { "path": "registry/default/clients/react-router/lib/supabase/client.ts", - "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/react-router/lib/supabase/server.ts", - "content": "import { createServerClient, parseCookieHeader, serializeCookieHeader } from '@supabase/ssr'\n\nexport function createClient(request: Request) {\n const headers = new Headers()\n\n const supabase = createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return parseCookieHeader(request.headers.get('Cookie') ?? '') as {\n name: string\n value: string\n }[]\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value, options }) =>\n headers.append('Set-Cookie', serializeCookieHeader(name, value, options))\n )\n },\n },\n }\n )\n\n return { supabase, headers }\n}\n", + "content": "import { createServerClient, parseCookieHeader, serializeCookieHeader } from '@supabase/ssr'\n\nexport function createClient(request: Request) {\n const headers = new Headers()\n\n const supabase = createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return parseCookieHeader(request.headers.get('Cookie') ?? '') as {\n name: string\n value: string\n }[]\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value, options }) =>\n headers.append('Set-Cookie', serializeCookieHeader(name, value, options))\n )\n },\n },\n }\n )\n\n return { supabase, headers }\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/social-auth-react.json b/apps/ui-library/public/r/social-auth-react.json index 21b7e55a999..c2d0283d20b 100644 --- a/apps/ui-library/public/r/social-auth-react.json +++ b/apps/ui-library/public/r/social-auth-react.json @@ -19,13 +19,13 @@ }, { "path": "registry/default/clients/react/lib/supabase/client.ts", - "content": "import { createClient as createSupabaseClient } from '@supabase/supabase-js'\n\nexport function createClient() {\n return createSupabaseClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "import { createClient as createSupabaseClient } from '@supabase/supabase-js'\n\nexport function createClient() {\n return createSupabaseClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/social-auth-tanstack.json b/apps/ui-library/public/r/social-auth-tanstack.json index 8dbcf95c310..4dddd3c7469 100644 --- a/apps/ui-library/public/r/social-auth-tanstack.json +++ b/apps/ui-library/public/r/social-auth-tanstack.json @@ -55,18 +55,18 @@ }, { "path": "registry/default/clients/tanstack/lib/supabase/client.ts", - "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/tanstack/lib/supabase/server.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { getCookies, setCookie } from '@tanstack/react-start/server'\n\nexport function createClient() {\n return createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return Object.entries(getCookies()).map(\n ([name, value]) =>\n ({\n name,\n value,\n }) as { name: string; value: string }\n )\n },\n setAll(cookies) {\n cookies.forEach((cookie) => {\n setCookie(cookie.name, cookie.value)\n })\n },\n },\n }\n )\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { getCookies, setCookie } from '@tanstack/react-start/server'\n\nexport function createClient() {\n return createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return Object.entries(getCookies()).map(\n ([name, value]) =>\n ({\n name,\n value,\n }) as { name: string; value: string }\n )\n },\n setAll(cookies) {\n cookies.forEach((cookie) => {\n setCookie(cookie.name, cookie.value)\n })\n },\n },\n }\n )\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/supabase-client-nextjs.json b/apps/ui-library/public/r/supabase-client-nextjs.json index 79aecf0b75b..c7925d9f8d7 100644 --- a/apps/ui-library/public/r/supabase-client-nextjs.json +++ b/apps/ui-library/public/r/supabase-client-nextjs.json @@ -12,23 +12,23 @@ "files": [ { "path": "registry/default/clients/nextjs/lib/supabase/client.ts", - "content": "import { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "import { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/nextjs/lib/supabase/middleware.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { NextResponse, type NextRequest } from 'next/server'\n\nexport async function updateSession(request: NextRequest) {\n let supabaseResponse = NextResponse.next({\n request,\n })\n\n // With Fluid compute, don't put this client in a global environment\n // variable. Always create a new one on each request.\n const supabase = createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return request.cookies.getAll()\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value))\n supabaseResponse = NextResponse.next({\n request,\n })\n cookiesToSet.forEach(({ name, value, options }) =>\n supabaseResponse.cookies.set(name, value, options)\n )\n },\n },\n }\n )\n\n // Do not run code between createServerClient and\n // supabase.auth.getClaims(). A simple mistake could make it very hard to debug\n // issues with users being randomly logged out.\n\n // IMPORTANT: If you remove getClaims() and you use server-side rendering\n // with the Supabase client, your users may be randomly logged out.\n const { data } = await supabase.auth.getClaims()\n const user = data?.claims\n\n if (\n !user &&\n !request.nextUrl.pathname.startsWith('/login') &&\n !request.nextUrl.pathname.startsWith('/auth')\n ) {\n // no user, potentially respond by redirecting the user to the login page\n const url = request.nextUrl.clone()\n url.pathname = '/auth/login'\n return NextResponse.redirect(url)\n }\n\n // IMPORTANT: You *must* return the supabaseResponse object as it is.\n // If you're creating a new response object with NextResponse.next() make sure to:\n // 1. Pass the request in it, like so:\n // const myNewResponse = NextResponse.next({ request })\n // 2. Copy over the cookies, like so:\n // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())\n // 3. Change the myNewResponse object to fit your needs, but avoid changing\n // the cookies!\n // 4. Finally:\n // return myNewResponse\n // If this is not done, you may be causing the browser and server to go out\n // of sync and terminate the user's session prematurely!\n\n return supabaseResponse\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { NextResponse, type NextRequest } from 'next/server'\n\nexport async function updateSession(request: NextRequest) {\n let supabaseResponse = NextResponse.next({\n request,\n })\n\n // With Fluid compute, don't put this client in a global environment\n // variable. Always create a new one on each request.\n const supabase = createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return request.cookies.getAll()\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value))\n supabaseResponse = NextResponse.next({\n request,\n })\n cookiesToSet.forEach(({ name, value, options }) =>\n supabaseResponse.cookies.set(name, value, options)\n )\n },\n },\n }\n )\n\n // Do not run code between createServerClient and\n // supabase.auth.getClaims(). A simple mistake could make it very hard to debug\n // issues with users being randomly logged out.\n\n // IMPORTANT: If you remove getClaims() and you use server-side rendering\n // with the Supabase client, your users may be randomly logged out.\n const { data } = await supabase.auth.getClaims()\n const user = data?.claims\n\n if (\n !user &&\n !request.nextUrl.pathname.startsWith('/login') &&\n !request.nextUrl.pathname.startsWith('/auth')\n ) {\n // no user, potentially respond by redirecting the user to the login page\n const url = request.nextUrl.clone()\n url.pathname = '/auth/login'\n return NextResponse.redirect(url)\n }\n\n // IMPORTANT: You *must* return the supabaseResponse object as it is.\n // If you're creating a new response object with NextResponse.next() make sure to:\n // 1. Pass the request in it, like so:\n // const myNewResponse = NextResponse.next({ request })\n // 2. Copy over the cookies, like so:\n // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())\n // 3. Change the myNewResponse object to fit your needs, but avoid changing\n // the cookies!\n // 4. Finally:\n // return myNewResponse\n // If this is not done, you may be causing the browser and server to go out\n // of sync and terminate the user's session prematurely!\n\n return supabaseResponse\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/nextjs/lib/supabase/server.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { cookies } from 'next/headers'\n\n/**\n * If using Fluid compute: Don't put this client in a global variable. Always create a new client within each\n * function when using it.\n */\nexport async function createClient() {\n const cookieStore = await cookies()\n\n return createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return cookieStore.getAll()\n },\n setAll(cookiesToSet) {\n try {\n cookiesToSet.forEach(({ name, value, options }) =>\n cookieStore.set(name, value, options)\n )\n } catch {\n // The `setAll` method was called from a Server Component.\n // This can be ignored if you have middleware refreshing\n // user sessions.\n }\n },\n },\n }\n )\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { cookies } from 'next/headers'\n\n/**\n * If using Fluid compute: Don't put this client in a global variable. Always create a new client within each\n * function when using it.\n */\nexport async function createClient() {\n const cookieStore = await cookies()\n\n return createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return cookieStore.getAll()\n },\n setAll(cookiesToSet) {\n try {\n cookiesToSet.forEach(({ name, value, options }) =>\n cookieStore.set(name, value, options)\n )\n } catch {\n // The `setAll` method was called from a Server Component.\n // This can be ignored if you have middleware refreshing\n // user sessions.\n }\n },\n },\n }\n )\n}\n", "type": "registry:lib" } ], "envVars": { "NEXT_PUBLIC_SUPABASE_URL": "", - "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/supabase-client-nuxtjs.json b/apps/ui-library/public/r/supabase-client-nuxtjs.json index 6aa1f242d47..ba80599e34c 100644 --- a/apps/ui-library/public/r/supabase-client-nuxtjs.json +++ b/apps/ui-library/public/r/supabase-client-nuxtjs.json @@ -12,31 +12,31 @@ "files": [ { "path": "registry/default/clients/nuxtjs/lib/supabase/client.ts", - "content": "import { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n process.env.NUXT_PUBLIC_SUPABASE_URL!,\n process.env.NUXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "import { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n process.env.NUXT_PUBLIC_SUPABASE_URL!,\n process.env.NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/nuxtjs/server/middleware/is-authenticated.ts", - "content": "import { defineNuxtRouteMiddleware, navigateTo, useRequestEvent } from 'nuxt/app'\nimport { createSupabaseServerClient } from '../supabase/client'\n\nexport default defineNuxtRouteMiddleware(async (to) => {\n const event = useRequestEvent()\n\n // create Supabase SSR client directly here\n const supabase = createSupabaseServerClient(event);\n\n // check current user\n const { data: { user } } = await supabase.auth.getUser()\n\n if (!user && to.path !== '/login') {\n return navigateTo('/login')\n }\n})\n", + "content": "import { defineNuxtRouteMiddleware, navigateTo, useRequestEvent } from 'nuxt/app'\n\nimport { createSupabaseServerClient } from '../supabase/client'\n\nexport default defineNuxtRouteMiddleware(async (to) => {\n const event = useRequestEvent()\n\n // create Supabase SSR client directly here\n const supabase = createSupabaseServerClient(event)\n\n // check current user\n const {\n data: { user },\n } = await supabase.auth.getUser()\n\n if (!user && to.path !== '/login') {\n return navigateTo('/login')\n }\n})\n", "type": "registry:file", "target": "server/middleware/is-authenticated.ts" }, { "path": "registry/default/clients/nuxtjs/server/api/profile.get.ts", - "content": "import { createError, defineEventHandler } from 'h3';\nimport { createSupabaseServerClient } from '../supabase/client';\n\nexport default defineEventHandler(async (event) => {\n // Create Supabase SSR client\n const supabase = createSupabaseServerClient(event)\n\n // Example: get user session\n const {\n data: { user },\n } = await supabase.auth.getUser();\n\n if (!user) {\n return { error: 'Not authenticated' };\n }\n\n // Fetch profile row\n const { data, error } = await supabase\n .from('profiles')\n .select('*')\n .eq('id', user.id)\n .single();\n\n if (error) {\n throw createError({ statusCode: 500, statusMessage: error.message });\n }\n\n return { profile: data };\n});\n", + "content": "import { createError, defineEventHandler } from 'h3'\n\nimport { createSupabaseServerClient } from '../supabase/client'\n\nexport default defineEventHandler(async (event) => {\n // Create Supabase SSR client\n const supabase = createSupabaseServerClient(event)\n\n // Example: get user session\n const {\n data: { user },\n } = await supabase.auth.getUser()\n\n if (!user) {\n return { error: 'Not authenticated' }\n }\n\n // Fetch profile row\n const { data, error } = await supabase.from('profiles').select('*').eq('id', user.id).single()\n\n if (error) {\n throw createError({ statusCode: 500, statusMessage: error.message })\n }\n\n return { profile: data }\n})\n", "type": "registry:file", "target": "server/api/profile.get.ts" }, { "path": "registry/default/clients/nuxtjs/server/supabase/client.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { getCookie, setCookie, deleteCookie, H3Event, EventHandlerRequest } from 'h3'\n\nexport const createSupabaseServerClient = (event: H3Event | undefined) => {\n return createServerClient(\n process.env.NUXT_PUBLIC_SUPABASE_URL!,\n process.env.NUXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n get: (key) => getCookie(event!, key),\n set: (key, value, options) => setCookie(event!, key, value, options),\n remove: (key, options) => deleteCookie(event!, key, options),\n },\n }\n )\n}", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { deleteCookie, EventHandlerRequest, getCookie, H3Event, setCookie } from 'h3'\n\nexport const createSupabaseServerClient = (event: H3Event | undefined) => {\n return createServerClient(\n process.env.NUXT_PUBLIC_SUPABASE_URL!,\n process.env.NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n get: (key) => getCookie(event!, key),\n set: (key, value, options) => setCookie(event!, key, value, options),\n remove: (key, options) => deleteCookie(event!, key, options),\n },\n }\n )\n}\n", "type": "registry:file", "target": "server/supabase/client.ts" } ], "envVars": { "NUXT_PUBLIC_SUPABASE_URL": "", - "NUXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `NUXT_PUBLIC_SUPABASE_URL` and `NUXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `NUXT_PUBLIC_SUPABASE_URL` and `NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/supabase-client-react-router.json b/apps/ui-library/public/r/supabase-client-react-router.json index f8f716f37f6..f2aeaae96ff 100644 --- a/apps/ui-library/public/r/supabase-client-react-router.json +++ b/apps/ui-library/public/r/supabase-client-react-router.json @@ -12,18 +12,18 @@ "files": [ { "path": "registry/default/clients/react-router/lib/supabase/client.ts", - "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/react-router/lib/supabase/server.ts", - "content": "import { createServerClient, parseCookieHeader, serializeCookieHeader } from '@supabase/ssr'\n\nexport function createClient(request: Request) {\n const headers = new Headers()\n\n const supabase = createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return parseCookieHeader(request.headers.get('Cookie') ?? '') as {\n name: string\n value: string\n }[]\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value, options }) =>\n headers.append('Set-Cookie', serializeCookieHeader(name, value, options))\n )\n },\n },\n }\n )\n\n return { supabase, headers }\n}\n", + "content": "import { createServerClient, parseCookieHeader, serializeCookieHeader } from '@supabase/ssr'\n\nexport function createClient(request: Request) {\n const headers = new Headers()\n\n const supabase = createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return parseCookieHeader(request.headers.get('Cookie') ?? '') as {\n name: string\n value: string\n }[]\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value, options }) =>\n headers.append('Set-Cookie', serializeCookieHeader(name, value, options))\n )\n },\n },\n }\n )\n\n return { supabase, headers }\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/supabase-client-react.json b/apps/ui-library/public/r/supabase-client-react.json index 992f3105f73..6787d3e699f 100644 --- a/apps/ui-library/public/r/supabase-client-react.json +++ b/apps/ui-library/public/r/supabase-client-react.json @@ -11,13 +11,13 @@ "files": [ { "path": "registry/default/clients/react/lib/supabase/client.ts", - "content": "import { createClient as createSupabaseClient } from '@supabase/supabase-js'\n\nexport function createClient() {\n return createSupabaseClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "import { createClient as createSupabaseClient } from '@supabase/supabase-js'\n\nexport function createClient() {\n return createSupabaseClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/supabase-client-tanstack.json b/apps/ui-library/public/r/supabase-client-tanstack.json index dcac7a273b2..ceb6837199d 100644 --- a/apps/ui-library/public/r/supabase-client-tanstack.json +++ b/apps/ui-library/public/r/supabase-client-tanstack.json @@ -12,18 +12,18 @@ "files": [ { "path": "registry/default/clients/tanstack/lib/supabase/client.ts", - "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "/// \nimport { createBrowserClient } from '@supabase/ssr'\n\nexport function createClient() {\n return createBrowserClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" }, { "path": "registry/default/clients/tanstack/lib/supabase/server.ts", - "content": "import { createServerClient } from '@supabase/ssr'\nimport { getCookies, setCookie } from '@tanstack/react-start/server'\n\nexport function createClient() {\n return createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return Object.entries(getCookies()).map(\n ([name, value]) =>\n ({\n name,\n value,\n }) as { name: string; value: string }\n )\n },\n setAll(cookies) {\n cookies.forEach((cookie) => {\n setCookie(cookie.name, cookie.value)\n })\n },\n },\n }\n )\n}\n", + "content": "import { createServerClient } from '@supabase/ssr'\nimport { getCookies, setCookie } from '@tanstack/react-start/server'\n\nexport function createClient() {\n return createServerClient(\n process.env.VITE_SUPABASE_URL!,\n process.env.VITE_SUPABASE_PUBLISHABLE_KEY!,\n {\n cookies: {\n getAll() {\n return Object.entries(getCookies()).map(\n ([name, value]) =>\n ({\n name,\n value,\n }) as { name: string; value: string }\n )\n },\n setAll(cookies) {\n cookies.forEach((cookie) => {\n setCookie(cookie.name, cookie.value)\n })\n },\n },\n }\n )\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/public/r/supabase-client-vue.json b/apps/ui-library/public/r/supabase-client-vue.json index 18c9f129fa2..72943f4a08b 100644 --- a/apps/ui-library/public/r/supabase-client-vue.json +++ b/apps/ui-library/public/r/supabase-client-vue.json @@ -11,13 +11,13 @@ "files": [ { "path": "registry/default/clients/vue/lib/supabase/client.ts", - "content": "/// \nimport { createClient as createSupabaseClient } from '@supabase/supabase-js'\n\nexport function createClient() {\n return createSupabaseClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!\n )\n}\n", + "content": "/// \nimport { createClient as createSupabaseClient } from '@supabase/supabase-js'\n\nexport function createClient() {\n return createSupabaseClient(\n import.meta.env.VITE_SUPABASE_URL!,\n import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY!\n )\n}\n", "type": "registry:lib" } ], "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`." } \ No newline at end of file diff --git a/apps/ui-library/registry/default/ai-editor-rules/writing-supabase-edge-functions.mdc b/apps/ui-library/registry/default/ai-editor-rules/writing-supabase-edge-functions.mdc index aea3f09db38..d81d46826f4 100644 --- a/apps/ui-library/registry/default/ai-editor-rules/writing-supabase-edge-functions.mdc +++ b/apps/ui-library/registry/default/ai-editor-rules/writing-supabase-edge-functions.mdc @@ -18,7 +18,7 @@ You're an expert in writing TypeScript and Deno JavaScript runtime. Generate **h 7. Do NOT use `import { serve } from "https://deno.land/std@0.168.0/http/server.ts"`. Instead use the built-in `Deno.serve`. 8. Following environment variables (ie. secrets) are pre-populated in both local and hosted Supabase environments. Users don't need to manually set them: - SUPABASE_URL - - SUPABASE_PUBLISHABLE_OR_ANON_KEY + - SUPABASE_PUBLISHABLE_KEY - SUPABASE_SERVICE_ROLE_KEY - SUPABASE_DB_URL 9. To set other environment variables (ie. secrets) users can put them in a env file and run the `supabase secrets set --env-file path/to/env-file` diff --git a/apps/ui-library/registry/default/clients/nextjs/lib/supabase/client.ts b/apps/ui-library/registry/default/clients/nextjs/lib/supabase/client.ts index ccc8cf2e900..f5e76471762 100644 --- a/apps/ui-library/registry/default/clients/nextjs/lib/supabase/client.ts +++ b/apps/ui-library/registry/default/clients/nextjs/lib/supabase/client.ts @@ -3,6 +3,6 @@ import { createBrowserClient } from '@supabase/ssr' export function createClient() { return createBrowserClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY! + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY! ) } diff --git a/apps/ui-library/registry/default/clients/nextjs/lib/supabase/middleware.ts b/apps/ui-library/registry/default/clients/nextjs/lib/supabase/middleware.ts index 7a07f440f7c..a022ea53f68 100644 --- a/apps/ui-library/registry/default/clients/nextjs/lib/supabase/middleware.ts +++ b/apps/ui-library/registry/default/clients/nextjs/lib/supabase/middleware.ts @@ -10,7 +10,7 @@ export async function updateSession(request: NextRequest) { // variable. Always create a new one on each request. const supabase = createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { getAll() { diff --git a/apps/ui-library/registry/default/clients/nextjs/lib/supabase/server.ts b/apps/ui-library/registry/default/clients/nextjs/lib/supabase/server.ts index 3d42f5f99e2..31d476ea056 100644 --- a/apps/ui-library/registry/default/clients/nextjs/lib/supabase/server.ts +++ b/apps/ui-library/registry/default/clients/nextjs/lib/supabase/server.ts @@ -10,7 +10,7 @@ export async function createClient() { return createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!, + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { getAll() { diff --git a/apps/ui-library/registry/default/clients/nextjs/registry-item.json b/apps/ui-library/registry/default/clients/nextjs/registry-item.json index 95d2fe595d4..14af3620e5a 100644 --- a/apps/ui-library/registry/default/clients/nextjs/registry-item.json +++ b/apps/ui-library/registry/default/clients/nextjs/registry-item.json @@ -6,10 +6,10 @@ "description": "", "registryDependencies": [], "dependencies": ["@supabase/ssr@latest", "@supabase/supabase-js@latest"], - "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "NEXT_PUBLIC_SUPABASE_URL": "", - "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": "" }, "files": [ { diff --git a/apps/ui-library/registry/default/clients/react-router/lib/supabase/client.ts b/apps/ui-library/registry/default/clients/react-router/lib/supabase/client.ts index 2377b970a8b..3f34921e9f6 100644 --- a/apps/ui-library/registry/default/clients/react-router/lib/supabase/client.ts +++ b/apps/ui-library/registry/default/clients/react-router/lib/supabase/client.ts @@ -4,6 +4,6 @@ import { createBrowserClient } from '@supabase/ssr' export function createClient() { return createBrowserClient( import.meta.env.VITE_SUPABASE_URL!, - import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY! + import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY! ) } diff --git a/apps/ui-library/registry/default/clients/react-router/lib/supabase/server.ts b/apps/ui-library/registry/default/clients/react-router/lib/supabase/server.ts index 28985885f37..2b62bb8de83 100644 --- a/apps/ui-library/registry/default/clients/react-router/lib/supabase/server.ts +++ b/apps/ui-library/registry/default/clients/react-router/lib/supabase/server.ts @@ -5,7 +5,7 @@ export function createClient(request: Request) { const supabase = createServerClient( process.env.VITE_SUPABASE_URL!, - process.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!, + process.env.VITE_SUPABASE_PUBLISHABLE_KEY!, { cookies: { getAll() { diff --git a/apps/ui-library/registry/default/clients/react-router/registry-item.json b/apps/ui-library/registry/default/clients/react-router/registry-item.json index fdb7f8f60b9..e6ad7f7c26d 100644 --- a/apps/ui-library/registry/default/clients/react-router/registry-item.json +++ b/apps/ui-library/registry/default/clients/react-router/registry-item.json @@ -6,10 +6,10 @@ "description": "", "registryDependencies": [], "dependencies": ["@supabase/ssr@latest", "@supabase/supabase-js@latest"], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, "files": [ { diff --git a/apps/ui-library/registry/default/clients/react/lib/supabase/client.ts b/apps/ui-library/registry/default/clients/react/lib/supabase/client.ts index c4ea49d065b..d8791b2bd1a 100644 --- a/apps/ui-library/registry/default/clients/react/lib/supabase/client.ts +++ b/apps/ui-library/registry/default/clients/react/lib/supabase/client.ts @@ -3,6 +3,6 @@ import { createClient as createSupabaseClient } from '@supabase/supabase-js' export function createClient() { return createSupabaseClient( import.meta.env.VITE_SUPABASE_URL!, - import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY! + import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY! ) } diff --git a/apps/ui-library/registry/default/clients/react/registry-item.json b/apps/ui-library/registry/default/clients/react/registry-item.json index 0e85cea12bf..7b1a5206b4f 100644 --- a/apps/ui-library/registry/default/clients/react/registry-item.json +++ b/apps/ui-library/registry/default/clients/react/registry-item.json @@ -6,10 +6,10 @@ "description": "", "registryDependencies": [], "dependencies": ["@supabase/supabase-js@latest"], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, "files": [ { diff --git a/apps/ui-library/registry/default/clients/tanstack/lib/supabase/client.ts b/apps/ui-library/registry/default/clients/tanstack/lib/supabase/client.ts index 2377b970a8b..3f34921e9f6 100644 --- a/apps/ui-library/registry/default/clients/tanstack/lib/supabase/client.ts +++ b/apps/ui-library/registry/default/clients/tanstack/lib/supabase/client.ts @@ -4,6 +4,6 @@ import { createBrowserClient } from '@supabase/ssr' export function createClient() { return createBrowserClient( import.meta.env.VITE_SUPABASE_URL!, - import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY! + import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY! ) } diff --git a/apps/ui-library/registry/default/clients/tanstack/lib/supabase/server.ts b/apps/ui-library/registry/default/clients/tanstack/lib/supabase/server.ts index 57d3618959a..5ed0ab2989f 100644 --- a/apps/ui-library/registry/default/clients/tanstack/lib/supabase/server.ts +++ b/apps/ui-library/registry/default/clients/tanstack/lib/supabase/server.ts @@ -4,7 +4,7 @@ import { getCookies, setCookie } from '@tanstack/react-start/server' export function createClient() { return createServerClient( process.env.VITE_SUPABASE_URL!, - process.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY!, + process.env.VITE_SUPABASE_PUBLISHABLE_KEY!, { cookies: { getAll() { diff --git a/apps/ui-library/registry/default/clients/tanstack/registry-item.json b/apps/ui-library/registry/default/clients/tanstack/registry-item.json index c2b4cd25725..19e879b8adb 100644 --- a/apps/ui-library/registry/default/clients/tanstack/registry-item.json +++ b/apps/ui-library/registry/default/clients/tanstack/registry-item.json @@ -6,10 +6,10 @@ "description": "", "registryDependencies": [], "dependencies": ["@supabase/ssr@latest", "@supabase/supabase-js@latest"], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, "files": [ { diff --git a/apps/ui-library/registry/default/fixtures/lib/supabase/client.ts b/apps/ui-library/registry/default/fixtures/lib/supabase/client.ts index 2b27a35bd12..6fca173f0c0 100644 --- a/apps/ui-library/registry/default/fixtures/lib/supabase/client.ts +++ b/apps/ui-library/registry/default/fixtures/lib/supabase/client.ts @@ -6,6 +6,6 @@ import { Database } from '../../database.types' export function createClient() { return createBrowserClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY! + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY! ) } diff --git a/blocks/vue/__registry__/index.tsx b/blocks/vue/__registry__/index.tsx deleted file mode 100644 index 06dc12b2921..00000000000 --- a/blocks/vue/__registry__/index.tsx +++ /dev/null @@ -1,33 +0,0 @@ - -// @ts-nocheck -// This file is autogenerated by scripts/build-registry.ts -// Do not edit this file directly. -import * as React from "react" - -export const Index: Record = { - "default": { - - "supabase-client-nuxtjs": { - name: "supabase-client-nuxtjs", - type: "registry:lib", - registryDependencies: [], - source: "", - files: ["registry/default/clients/nuxtjs/lib/supabase/client.ts","registry/default/clients/nuxtjs/lib/supabase/middleware.ts","registry/default/clients/nuxtjs/lib/supabase/server.ts"], - category: "undefined", - subcategory: "undefined", - chunks: [] - } - , - "supabase-client-vue": { - name: "supabase-client-vue", - type: "registry:lib", - registryDependencies: [], - source: "", - files: ["registry/default/clients/vue/lib/supabase/client.ts"], - category: "undefined", - subcategory: "undefined", - chunks: [] - } - - }, -} diff --git a/blocks/vue/lib/process-registry.ts b/blocks/vue/lib/process-registry.ts deleted file mode 100644 index 3d8bd3d04bf..00000000000 --- a/blocks/vue/lib/process-registry.ts +++ /dev/null @@ -1,86 +0,0 @@ -import * as fs from 'fs' - -export interface RegistryNode { - name: string - path: string - originalPath: string - type: 'directory' | 'file' - children?: RegistryNode[] - content?: string -} - -interface RegistryFile { - path: string - target?: string - type: string - content: string -} - -const DEFAULT_PATHS = { - component: '/components', - hook: '/hooks', - util: '/lib', -} as const - -/** - * Converts a flat registry array into a hierarchical file tree structure - */ -export function generateRegistryTree(registryPath: string): RegistryNode[] { - const registry = JSON.parse(fs.readFileSync(registryPath, 'utf-8')) as { files: RegistryFile[] } - const tree: RegistryNode[] = [] - - const sortedRegistry = [...registry.files].sort((a, b) => a.path.localeCompare(b.path)) - - for (const file of sortedRegistry) { - const itemPath = file.target || getDefaultPath(file) - const pathParts = itemPath.split('/').filter(Boolean) - let currentLevel = tree - - for (let i = 0; i < pathParts.length; i++) { - const part = pathParts[i] - const isLast = i === pathParts.length - 1 - const path = '/' + pathParts.slice(0, i + 1).join('/') - - let node = currentLevel.find((n) => n.name === part) - - // Remove any paths in the file content that point to the block directory. - const content = file.content - .replaceAll(/@\/registry\/default\/blocks\/.+?\//gi, '@/') - .replaceAll(/@\/registry\/default\/fixtures\//gi, '@/') - .replaceAll(/@\/registry\/default\//gi, '@/') - .replaceAll(/@\/clients\/.+?\//gi, '@/') - - if (!node) { - node = { - name: part, - path, - originalPath: file.path, - type: isLast ? 'file' : 'directory', - ...(isLast ? { content } : { children: [] }), - } - currentLevel.push(node) - } - - if (!isLast) { - node.children = node.children || [] - currentLevel = node.children - } - } - } - - return tree -} - -/** - * Determines the default path for an item based on its type - */ -function getDefaultPath(item: RegistryFile): string { - const type = item.type.toLowerCase() || '' - const basePath = DEFAULT_PATHS[type as keyof typeof DEFAULT_PATHS] || '' - // clean all paths that start with paths specific to this repo organization - const filePath = item.path - .replace(/registry\/default\/blocks\/.+?\//, '') - .replace(/registry\/default\/clients\/.+?\//, '') - - return `${basePath}/${filePath}` -} diff --git a/blocks/vue/package.json b/blocks/vue/package.json index 1eea69f6a69..a2fc561f19e 100644 --- a/blocks/vue/package.json +++ b/blocks/vue/package.json @@ -23,7 +23,8 @@ "vue-router": "^4.5.1" }, "devDependencies": { - "shadcn": "^3.0.0", + "@supabase/ssr": "workspace:*", + "shadcn": "^3.3.1", "tsconfig": "workspace:*", "vite": "catalog:" } diff --git a/blocks/vue/public/r/password-based-auth-nuxtjs.json b/blocks/vue/public/r/password-based-auth-nuxtjs.json deleted file mode 100644 index ee53a2e435b..00000000000 --- a/blocks/vue/public/r/password-based-auth-nuxtjs.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "$schema": "https://ui.shadcn.com/schema/registry-item.json", - "name": "password-based-auth-nuxtjs", - "type": "registry:lib", - "title": "Password Based Auth flow for Nuxt.js and Supabase", - "description": "", - "dependencies": [ - "@supabase/ssr@latest", - "@supabase/supabase-js@latest" - ], - "registryDependencies": [ - "button", - "card", - "input", - "label" - ], - "files": [ - { - "path": "registry/default/password-based-auth/nuxtjs/app/components/login-form.vue", - "content": "\n\n\n", - "type": "registry:file", - "target": "app/components/login-form.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/app/components/sign-up-form.vue", - "content": "\n\n\n", - "type": "registry:file", - "target": "app/components/sign-up-form.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/app/components/forgot-password-form.vue", - "content": "\n\n\n", - "type": "registry:file", - "target": "app/components/forgot-password-form.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/app/components/update-password-form.vue", - "content": "\n\n\n", - "type": "registry:file", - "target": "app/components/update-password-form.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/app/pages/auth/login.vue", - "content": "\n\n", - "type": "registry:file", - "target": "app/pages/auth/login.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/app/pages/auth/sign-up.vue", - "content": "\n\n\n", - "type": "registry:file", - "target": "app/pages/auth/sign-up.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/app/pages/auth/forgot-password.vue", - "content": "\n\n\n", - "type": "registry:file", - "target": "app/pages/auth/forgot-password.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/app/pages/auth/update-password.vue", - "content": "\n\n\n", - "type": "registry:file", - "target": "app/pages/auth/update-password.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/app/pages/auth/error.vue", - "content": "\n\n", - "type": "registry:file", - "target": "app/pages/auth/error.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/app/pages/auth/sign-up-success.vue", - "content": "\n\n\n", - "type": "registry:file", - "target": "app/pages/auth/sign-up-success.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/app/pages/protected/index.vue", - "content": "\n\n\n", - "type": "registry:file", - "target": "app/pages/protected/index.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/server/routes/auth/confirm.get.ts", - "content": "import { createSupabaseServerClient } from '../../supabase/client'\nimport { getQuery, defineEventHandler, sendRedirect } from 'h3';\nimport type { EmailOtpType } from \"@supabase/supabase-js\"\n\nexport default defineEventHandler(async (event) => {\n const query = getQuery(event)\n const token_hash = query.token_hash as string | null\n const type = query.type as EmailOtpType | null\n const _next = query.next as string | undefined\n const next = _next?.startsWith(\"/\") ? _next : \"/\"\n\n if (token_hash && type) {\n const supabase = createSupabaseServerClient(event)\n\n const { error } = await supabase.auth.verifyOtp({\n type,\n token_hash,\n })\n\n if (!error) {\n return sendRedirect(event, next)\n } else {\n return sendRedirect(\n event,\n `/auth/error?error=${encodeURIComponent(error.message)}`\n )\n }\n }\n\n return sendRedirect(\n event,\n `/auth/error?error=${encodeURIComponent(\"No token hash or type\")}`\n )\n})", - "type": "registry:file", - "target": "server/routes/auth/confirm.get.ts" - } - ], - "envVars": { - "NUXT_PUBLIC_SUPABASE_URL": "", - "NUXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" - }, - "docs": "You'll need to set the following environment variables in your project: `NUXT_PUBLIC_SUPABASE_URL` and `NUXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`." -} \ No newline at end of file diff --git a/blocks/vue/public/r/password-based-auth-vue.json b/blocks/vue/public/r/password-based-auth-vue.json deleted file mode 100644 index 7a54f1ff83c..00000000000 --- a/blocks/vue/public/r/password-based-auth-vue.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "$schema": "https://ui.shadcn.com/schema/registry-item.json", - "name": "password-based-auth-vue", - "type": "registry:block", - "title": "Password Based Auth flow for Vue and Supabase", - "description": "Password Based Auth flow for Vue and Supabase", - "dependencies": [ - "@supabase/supabase-js@latest" - ], - "registryDependencies": [ - "button", - "card", - "input", - "label" - ], - "files": [ - { - "path": "registry/default/password-based-auth/vue/components/login-form.vue", - "content": "\n\n\n", - "type": "registry:file", - "target": "components/login-form.vue" - }, - { - "path": "registry/default/password-based-auth/vue/components/sign-up-form.vue", - "content": "\n\n\n", - "type": "registry:file", - "target": "components/sign-up-form.vue" - }, - { - "path": "registry/default/password-based-auth/vue/components/forgot-password-form.vue", - "content": "\n\n\n", - "type": "registry:file", - "target": "components/forgot-password-form.vue" - }, - { - "path": "registry/default/password-based-auth/vue/components/update-password-form.vue", - "content": "\n\n\n", - "type": "registry:file", - "target": "components/update-password-form.vue" - } - ] -} \ No newline at end of file diff --git a/blocks/vue/registry.json b/blocks/vue/registry.json deleted file mode 100644 index 7b719fbc10e..00000000000 --- a/blocks/vue/registry.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "$schema": "https://ui.shadcn.com/schema/registry.json", - "name": "Supabase UI Library", - "homepage": "https://supabase.com/ui", - "items": [ - { - "$schema": "https://ui.shadcn.com/schema/registry-item.json", - "name": "supabase-client-nuxtjs", - "type": "registry:lib", - "title": "Supabase Client for Nuxt.js", - "description": "", - "registryDependencies": [], - "dependencies": ["@supabase/ssr@latest", "@supabase/supabase-js@latest"], - "docs": "You'll need to set the following environment variables in your project: `NUXT_PUBLIC_SUPABASE_URL` and `NUXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", - "envVars": { - "NUXT_PUBLIC_SUPABASE_URL": "", - "NUXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" - }, - "files": [ - { - "path": "registry/default/clients/nuxtjs/lib/supabase/client.ts", - "type": "registry:lib" - }, - { - "path": "registry/default/clients/nuxtjs/server/middleware/is-authenticated.ts", - "type": "registry:file", - "target": "server/middleware/is-authenticated.ts" - }, - { - "path": "registry/default/clients/nuxtjs/server/api/profile.get.ts", - "type": "registry:file", - "target": "server/api/profile.get.ts" - }, - { - "path": "registry/default/clients/nuxtjs/server/supabase/client.ts", - "type": "registry:file", - "target": "server/supabase/client.ts" - } - ] - }, - { - "$schema": "https://ui.shadcn.com/schema/registry-item.json", - "name": "supabase-client-vue", - "type": "registry:lib", - "title": "Supabase Client for Vue", - "description": "", - "registryDependencies": [], - "dependencies": ["@supabase/supabase-js@latest"], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", - "envVars": { - "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" - }, - "files": [ - { - "path": "registry/default/clients/vue/lib/supabase/client.ts", - "type": "registry:lib" - } - ] - }, - { - "name": "password-based-auth-vue", - "type": "registry:block", - "title": "Password Based Auth flow for Vue and Supabase", - "description": "Password Based Auth flow for Vue and Supabase", - "registryDependencies": ["button", "card", "input", "label"], - "files": [ - { - "path": "registry/default/password-based-auth/vue/components/login-form.vue", - "type": "registry:file", - "target": "components/login-form.vue" - }, - { - "path": "registry/default/password-based-auth/vue/components/sign-up-form.vue", - "type": "registry:file", - "target": "components/sign-up-form.vue" - }, - { - "path": "registry/default/password-based-auth/vue/components/forgot-password-form.vue", - "type": "registry:file", - "target": "components/forgot-password-form.vue" - }, - { - "path": "registry/default/password-based-auth/vue/components/update-password-form.vue", - "type": "registry:file", - "target": "components/update-password-form.vue" - } - ], - "dependencies": ["@supabase/supabase-js@latest"] - }, - { - "$schema": "https://ui.shadcn.com/schema/registry-item.json", - "name": "password-based-auth-nuxtjs", - "type": "registry:lib", - "title": "Password Based Auth flow for Nuxt.js and Supabase", - "description": "", - "registryDependencies": ["button", "card", "input", "label"], - "dependencies": ["@supabase/ssr@latest", "@supabase/supabase-js@latest"], - "docs": "You'll need to set the following environment variables in your project: `NUXT_PUBLIC_SUPABASE_URL` and `NUXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", - "envVars": { - "NUXT_PUBLIC_SUPABASE_URL": "", - "NUXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" - }, - "files": [ - { - "path": "registry/default/password-based-auth/nuxtjs/app/components/login-form.vue", - "type": "registry:file", - "target": "app/components/login-form.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/app/components/sign-up-form.vue", - "type": "registry:file", - "target": "app/components/sign-up-form.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/app/components/forgot-password-form.vue", - "type": "registry:file", - "target": "app/components/forgot-password-form.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/app/components/update-password-form.vue", - "type": "registry:file", - "target": "app/components/update-password-form.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/app/pages/auth/login.vue", - "type": "registry:file", - "target": "app/pages/auth/login.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/app/pages/auth/sign-up.vue", - "type": "registry:file", - "target": "app/pages/auth/sign-up.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/app/pages/auth/forgot-password.vue", - "type": "registry:file", - "target": "app/pages/auth/forgot-password.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/app/pages/auth/update-password.vue", - "type": "registry:file", - "target": "app/pages/auth/update-password.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/app/pages/auth/error.vue", - "type": "registry:file", - "target": "app/pages/auth/error.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/app/pages/auth/sign-up-success.vue", - "type": "registry:file", - "target": "app/pages/auth/sign-up-success.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/app/pages/protected/index.vue", - "type": "registry:file", - "target": "app/pages/protected/index.vue" - }, - { - "path": "registry/default/password-based-auth/nuxtjs/server/routes/auth/confirm.get.ts", - "type": "registry:file", - "target": "server/routes/auth/confirm.get.ts" - } - ] - } - ] -} diff --git a/blocks/vue/registry/default/clients/nuxtjs/lib/supabase/client.ts b/blocks/vue/registry/default/clients/nuxtjs/lib/supabase/client.ts index 727df157302..5c313eadc01 100644 --- a/blocks/vue/registry/default/clients/nuxtjs/lib/supabase/client.ts +++ b/blocks/vue/registry/default/clients/nuxtjs/lib/supabase/client.ts @@ -3,6 +3,6 @@ import { createBrowserClient } from '@supabase/ssr' export function createClient() { return createBrowserClient( process.env.NUXT_PUBLIC_SUPABASE_URL!, - process.env.NUXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY! + process.env.NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY! ) } diff --git a/blocks/vue/registry/default/clients/nuxtjs/registry-item.json b/blocks/vue/registry/default/clients/nuxtjs/registry-item.json index 7a12eb7cf38..17d1e4b15a5 100644 --- a/blocks/vue/registry/default/clients/nuxtjs/registry-item.json +++ b/blocks/vue/registry/default/clients/nuxtjs/registry-item.json @@ -6,10 +6,10 @@ "description": "", "registryDependencies": [], "dependencies": ["@supabase/ssr@latest", "@supabase/supabase-js@latest"], - "docs": "You'll need to set the following environment variables in your project: `NUXT_PUBLIC_SUPABASE_URL` and `NUXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `NUXT_PUBLIC_SUPABASE_URL` and `NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "NUXT_PUBLIC_SUPABASE_URL": "", - "NUXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY": "" }, "files": [ { diff --git a/blocks/vue/registry/default/clients/nuxtjs/server/api/profile.get.ts b/blocks/vue/registry/default/clients/nuxtjs/server/api/profile.get.ts index bddd10a7d3e..f97a2ff0fec 100644 --- a/blocks/vue/registry/default/clients/nuxtjs/server/api/profile.get.ts +++ b/blocks/vue/registry/default/clients/nuxtjs/server/api/profile.get.ts @@ -1,5 +1,6 @@ -import { createError, defineEventHandler } from 'h3'; -import { createSupabaseServerClient } from '../supabase/client'; +import { createError, defineEventHandler } from 'h3' + +import { createSupabaseServerClient } from '../supabase/client' export default defineEventHandler(async (event) => { // Create Supabase SSR client @@ -8,22 +9,18 @@ export default defineEventHandler(async (event) => { // Example: get user session const { data: { user }, - } = await supabase.auth.getUser(); + } = await supabase.auth.getUser() if (!user) { - return { error: 'Not authenticated' }; + return { error: 'Not authenticated' } } // Fetch profile row - const { data, error } = await supabase - .from('profiles') - .select('*') - .eq('id', user.id) - .single(); + const { data, error } = await supabase.from('profiles').select('*').eq('id', user.id).single() if (error) { - throw createError({ statusCode: 500, statusMessage: error.message }); + throw createError({ statusCode: 500, statusMessage: error.message }) } - return { profile: data }; -}); + return { profile: data } +}) diff --git a/blocks/vue/registry/default/clients/nuxtjs/server/middleware/is-authenticated.ts b/blocks/vue/registry/default/clients/nuxtjs/server/middleware/is-authenticated.ts index f95070dd6ce..96a360c7dc7 100644 --- a/blocks/vue/registry/default/clients/nuxtjs/server/middleware/is-authenticated.ts +++ b/blocks/vue/registry/default/clients/nuxtjs/server/middleware/is-authenticated.ts @@ -1,14 +1,17 @@ import { defineNuxtRouteMiddleware, navigateTo, useRequestEvent } from 'nuxt/app' + import { createSupabaseServerClient } from '../supabase/client' export default defineNuxtRouteMiddleware(async (to) => { const event = useRequestEvent() // create Supabase SSR client directly here - const supabase = createSupabaseServerClient(event); + const supabase = createSupabaseServerClient(event) // check current user - const { data: { user } } = await supabase.auth.getUser() + const { + data: { user }, + } = await supabase.auth.getUser() if (!user && to.path !== '/login') { return navigateTo('/login') diff --git a/blocks/vue/registry/default/clients/nuxtjs/server/supabase/client.ts b/blocks/vue/registry/default/clients/nuxtjs/server/supabase/client.ts index abbffcc2d1e..50254e89b84 100644 --- a/blocks/vue/registry/default/clients/nuxtjs/server/supabase/client.ts +++ b/blocks/vue/registry/default/clients/nuxtjs/server/supabase/client.ts @@ -1,10 +1,10 @@ import { createServerClient } from '@supabase/ssr' -import { getCookie, setCookie, deleteCookie, H3Event, EventHandlerRequest } from 'h3' +import { deleteCookie, EventHandlerRequest, getCookie, H3Event, setCookie } from 'h3' export const createSupabaseServerClient = (event: H3Event | undefined) => { return createServerClient( process.env.NUXT_PUBLIC_SUPABASE_URL!, - process.env.NUXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY!, + process.env.NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY!, { cookies: { get: (key) => getCookie(event!, key), @@ -13,4 +13,4 @@ export const createSupabaseServerClient = (event: H3Event | }, } ) -} \ No newline at end of file +} diff --git a/blocks/vue/registry/default/clients/vue/lib/supabase/client.ts b/blocks/vue/registry/default/clients/vue/lib/supabase/client.ts index cd4773bfcad..4601d63f73f 100644 --- a/blocks/vue/registry/default/clients/vue/lib/supabase/client.ts +++ b/blocks/vue/registry/default/clients/vue/lib/supabase/client.ts @@ -4,6 +4,6 @@ import { createClient as createSupabaseClient } from '@supabase/supabase-js' export function createClient() { return createSupabaseClient( import.meta.env.VITE_SUPABASE_URL!, - import.meta.env.VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY! + import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY! ) } diff --git a/blocks/vue/registry/default/clients/vue/registry-item.json b/blocks/vue/registry/default/clients/vue/registry-item.json index 438879c0a04..60d252587ba 100644 --- a/blocks/vue/registry/default/clients/vue/registry-item.json +++ b/blocks/vue/registry/default/clients/vue/registry-item.json @@ -6,10 +6,10 @@ "description": "", "registryDependencies": [], "dependencies": ["@supabase/supabase-js@latest"], - "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY`.", + "docs": "You'll need to set the following environment variables in your project: `VITE_SUPABASE_URL` and `VITE_SUPABASE_PUBLISHABLE_KEY`.", "envVars": { "VITE_SUPABASE_URL": "", - "VITE_SUPABASE_PUBLISHABLE_OR_ANON_KEY": "" + "VITE_SUPABASE_PUBLISHABLE_KEY": "" }, "files": [ { diff --git a/blocks/vue/registry/default/dropzone/nuxtjs/app/composables/useSupabaseUpload.ts b/blocks/vue/registry/default/dropzone/nuxtjs/app/composables/useSupabaseUpload.ts index b057c6ef7cf..e1c93d67a1d 100644 --- a/blocks/vue/registry/default/dropzone/nuxtjs/app/composables/useSupabaseUpload.ts +++ b/blocks/vue/registry/default/dropzone/nuxtjs/app/composables/useSupabaseUpload.ts @@ -1,7 +1,8 @@ -import { ref, computed, watch, onUnmounted } from 'vue' import { useDropZone } from '@vueuse/core' +import { computed, onUnmounted, ref, watch } from 'vue' + // @ts-ignore -import { createClient } from "@/lib/supabase/client" +import { createClient } from '@/lib/supabase/client' const supabase = createClient() @@ -22,14 +23,10 @@ export type UseSupabaseUploadOptions = { function validateFileType(file: File, allowedTypes: string[]) { if (!allowedTypes.length) return [] - const isValid = allowedTypes.some(t => - t.endsWith('/*') - ? file.type.startsWith(t.replace('/*', '')) - : file.type === t + const isValid = allowedTypes.some((t) => + t.endsWith('/*') ? file.type.startsWith(t.replace('/*', '')) : file.type === t ) - return isValid - ? [] - : [{ code: 'invalid-type', message: 'Invalid file type' }] + return isValid ? [] : [{ code: 'invalid-type', message: 'Invalid file type' }] } function validateFileSize(file: File, maxSize: number) { @@ -65,7 +62,7 @@ export function useSupabaseUpload(options: UseSupabaseUploadOptions) { onDrop(droppedFiles: File[] | null) { if (!droppedFiles) return - const newFiles: FileWithPreview[] = droppedFiles.map(file => ({ + const newFiles: FileWithPreview[] = droppedFiles.map((file) => ({ ...(file as FileWithPreview), preview: URL.createObjectURL(file), errors: [ @@ -82,19 +79,17 @@ export function useSupabaseUpload(options: UseSupabaseUploadOptions) { loading.value = true try { - const filesWithErrors = errors.value.map(e => e.name) + const filesWithErrors = errors.value.map((e) => e.name) const filesToUpload = filesWithErrors.length > 0 ? files.value.filter( - f => - filesWithErrors.includes(f.name) || - !successes.value.includes(f.name) + (f) => filesWithErrors.includes(f.name) || !successes.value.includes(f.name) ) : files.value const responses = await Promise.all( - filesToUpload.map(async file => { + filesToUpload.map(async (file) => { const { error } = await supabase.storage .from(bucketName) .upload(path ? `${path}/${file.name}` : file.name, file, { @@ -108,15 +103,13 @@ export function useSupabaseUpload(options: UseSupabaseUploadOptions) { }) ) - errors.value = responses.filter((r): r is { name: string; message: string } => r.message !== undefined) - - const successful = responses - .filter(r => !r.message) - .map(r => r.name) - - successes.value = Array.from( - new Set([...successes.value, ...successful]) + errors.value = responses.filter( + (r): r is { name: string; message: string } => r.message !== undefined ) + + const successful = responses.filter((r) => !r.message).map((r) => r.name) + + successes.value = Array.from(new Set([...successes.value, ...successful])) } catch (err) { console.error('Upload failed unexpectedly:', err) @@ -129,7 +122,6 @@ export function useSupabaseUpload(options: UseSupabaseUploadOptions) { } } - watch( () => files.value.length, () => { @@ -150,8 +142,8 @@ export function useSupabaseUpload(options: UseSupabaseUploadOptions) { watch( files, (newFiles, oldFiles) => { - const newPreviews = new Set(newFiles.map(f => f.preview)) - oldFiles.forEach(file => { + const newPreviews = new Set(newFiles.map((f) => f.preview)) + oldFiles.forEach((file) => { if (file.preview && !newPreviews.has(file.preview)) { URL.revokeObjectURL(file.preview) } @@ -161,7 +153,7 @@ export function useSupabaseUpload(options: UseSupabaseUploadOptions) { ) onUnmounted(() => { - files.value.forEach(file => { + files.value.forEach((file) => { if (file.preview) { URL.revokeObjectURL(file.preview) } diff --git a/blocks/vue/registry/default/dropzone/nuxtjs/registry-item.json b/blocks/vue/registry/default/dropzone/nuxtjs/registry-item.json index e4be40a8c6c..2a098cb785a 100644 --- a/blocks/vue/registry/default/dropzone/nuxtjs/registry-item.json +++ b/blocks/vue/registry/default/dropzone/nuxtjs/registry-item.json @@ -27,4 +27,4 @@ } ], "dependencies": ["@supabase/supabase-js@latest", "@vueuse/core", "lucide-vue-next"] -} \ No newline at end of file +} diff --git a/blocks/vue/registry/default/dropzone/vue/composables/useSupabaseUpload.ts b/blocks/vue/registry/default/dropzone/vue/composables/useSupabaseUpload.ts index b057c6ef7cf..e1c93d67a1d 100644 --- a/blocks/vue/registry/default/dropzone/vue/composables/useSupabaseUpload.ts +++ b/blocks/vue/registry/default/dropzone/vue/composables/useSupabaseUpload.ts @@ -1,7 +1,8 @@ -import { ref, computed, watch, onUnmounted } from 'vue' import { useDropZone } from '@vueuse/core' +import { computed, onUnmounted, ref, watch } from 'vue' + // @ts-ignore -import { createClient } from "@/lib/supabase/client" +import { createClient } from '@/lib/supabase/client' const supabase = createClient() @@ -22,14 +23,10 @@ export type UseSupabaseUploadOptions = { function validateFileType(file: File, allowedTypes: string[]) { if (!allowedTypes.length) return [] - const isValid = allowedTypes.some(t => - t.endsWith('/*') - ? file.type.startsWith(t.replace('/*', '')) - : file.type === t + const isValid = allowedTypes.some((t) => + t.endsWith('/*') ? file.type.startsWith(t.replace('/*', '')) : file.type === t ) - return isValid - ? [] - : [{ code: 'invalid-type', message: 'Invalid file type' }] + return isValid ? [] : [{ code: 'invalid-type', message: 'Invalid file type' }] } function validateFileSize(file: File, maxSize: number) { @@ -65,7 +62,7 @@ export function useSupabaseUpload(options: UseSupabaseUploadOptions) { onDrop(droppedFiles: File[] | null) { if (!droppedFiles) return - const newFiles: FileWithPreview[] = droppedFiles.map(file => ({ + const newFiles: FileWithPreview[] = droppedFiles.map((file) => ({ ...(file as FileWithPreview), preview: URL.createObjectURL(file), errors: [ @@ -82,19 +79,17 @@ export function useSupabaseUpload(options: UseSupabaseUploadOptions) { loading.value = true try { - const filesWithErrors = errors.value.map(e => e.name) + const filesWithErrors = errors.value.map((e) => e.name) const filesToUpload = filesWithErrors.length > 0 ? files.value.filter( - f => - filesWithErrors.includes(f.name) || - !successes.value.includes(f.name) + (f) => filesWithErrors.includes(f.name) || !successes.value.includes(f.name) ) : files.value const responses = await Promise.all( - filesToUpload.map(async file => { + filesToUpload.map(async (file) => { const { error } = await supabase.storage .from(bucketName) .upload(path ? `${path}/${file.name}` : file.name, file, { @@ -108,15 +103,13 @@ export function useSupabaseUpload(options: UseSupabaseUploadOptions) { }) ) - errors.value = responses.filter((r): r is { name: string; message: string } => r.message !== undefined) - - const successful = responses - .filter(r => !r.message) - .map(r => r.name) - - successes.value = Array.from( - new Set([...successes.value, ...successful]) + errors.value = responses.filter( + (r): r is { name: string; message: string } => r.message !== undefined ) + + const successful = responses.filter((r) => !r.message).map((r) => r.name) + + successes.value = Array.from(new Set([...successes.value, ...successful])) } catch (err) { console.error('Upload failed unexpectedly:', err) @@ -129,7 +122,6 @@ export function useSupabaseUpload(options: UseSupabaseUploadOptions) { } } - watch( () => files.value.length, () => { @@ -150,8 +142,8 @@ export function useSupabaseUpload(options: UseSupabaseUploadOptions) { watch( files, (newFiles, oldFiles) => { - const newPreviews = new Set(newFiles.map(f => f.preview)) - oldFiles.forEach(file => { + const newPreviews = new Set(newFiles.map((f) => f.preview)) + oldFiles.forEach((file) => { if (file.preview && !newPreviews.has(file.preview)) { URL.revokeObjectURL(file.preview) } @@ -161,7 +153,7 @@ export function useSupabaseUpload(options: UseSupabaseUploadOptions) { ) onUnmounted(() => { - files.value.forEach(file => { + files.value.forEach((file) => { if (file.preview) { URL.revokeObjectURL(file.preview) } diff --git a/blocks/vue/registry/default/dropzone/vue/registry-item.json b/blocks/vue/registry/default/dropzone/vue/registry-item.json index 03578ca5cce..483c302eea7 100644 --- a/blocks/vue/registry/default/dropzone/vue/registry-item.json +++ b/blocks/vue/registry/default/dropzone/vue/registry-item.json @@ -27,4 +27,4 @@ } ], "dependencies": ["@supabase/supabase-js@latest", "@vueuse/core", "lucide-vue-next"] -} \ No newline at end of file +} diff --git a/blocks/vue/registry/default/lib/utils.ts b/blocks/vue/registry/default/lib/utils.ts index 951433cb3b3..abba253f04c 100644 --- a/blocks/vue/registry/default/lib/utils.ts +++ b/blocks/vue/registry/default/lib/utils.ts @@ -1,7 +1,7 @@ -import type { ClassValue } from "clsx" -import { clsx } from "clsx" -import { twMerge } from "tailwind-merge" +import type { ClassValue } from 'clsx' +import { clsx } from 'clsx' +import { twMerge } from 'tailwind-merge' export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)) -} \ No newline at end of file +} diff --git a/blocks/vue/registry/default/password-based-auth/nuxtjs/server/routes/auth/confirm.get.ts b/blocks/vue/registry/default/password-based-auth/nuxtjs/server/routes/auth/confirm.get.ts index c6f18dfecad..018b4fe2ce1 100644 --- a/blocks/vue/registry/default/password-based-auth/nuxtjs/server/routes/auth/confirm.get.ts +++ b/blocks/vue/registry/default/password-based-auth/nuxtjs/server/routes/auth/confirm.get.ts @@ -1,5 +1,6 @@ -import { getQuery, defineEventHandler, sendRedirect } from 'h3' import type { EmailOtpType } from '@supabase/supabase-js' +import { defineEventHandler, getQuery, sendRedirect } from 'h3' + import { createSupabaseServerClient } from '@/registry/default/clients/nuxtjs/server/supabase/client' export default defineEventHandler(async (event) => { diff --git a/blocks/vue/registry/default/realtime-cursor/nuxtjs/app/composables/useRealtimeCursors.ts b/blocks/vue/registry/default/realtime-cursor/nuxtjs/app/composables/useRealtimeCursors.ts index 7fccf11e5c6..108e33313eb 100644 --- a/blocks/vue/registry/default/realtime-cursor/nuxtjs/app/composables/useRealtimeCursors.ts +++ b/blocks/vue/registry/default/realtime-cursor/nuxtjs/app/composables/useRealtimeCursors.ts @@ -1,5 +1,6 @@ -import { ref, reactive, onMounted, onUnmounted } from 'vue' import { REALTIME_SUBSCRIBE_STATES, type RealtimeChannel } from '@supabase/supabase-js' +import { onMounted, onUnmounted, reactive, ref } from 'vue' + // @ts-ignore import { createClient } from '@/lib/supabase/client' @@ -47,11 +48,9 @@ function useThrottleCallback( const supabase = createClient() -const generateRandomColor = () => - `hsl(${Math.floor(Math.random() * 360)}, 100%, 70%)` +const generateRandomColor = () => `hsl(${Math.floor(Math.random() * 360)}, 100%, 70%)` -const generateRandomNumber = () => - Math.floor(Math.random() * 100) +const generateRandomNumber = () => Math.floor(Math.random() * 100) const EVENT_NAME = 'realtime-cursor-move' @@ -101,8 +100,10 @@ export function useRealtimeCursors({ }) } - const { run: handleMouseMove, cancel: cancelThrottle } = - useThrottleCallback(sendCursor, throttleMs) + const { run: handleMouseMove, cancel: cancelThrottle } = useThrottleCallback( + sendCursor, + throttleMs + ) onMounted(() => { const channel = supabase.channel(roomName) @@ -115,11 +116,15 @@ export function useRealtimeCursors({ Object.keys(cursors).forEach((k) => delete cursors[k]) channelRef.value = null }) - .on('presence', { event: 'leave' }, ({ leftPresences }: { leftPresences: Array<{ key: string }> }) => { - leftPresences.forEach(({ key }) => { - delete cursors[key] - }) - }) + .on( + 'presence', + { event: 'leave' }, + ({ leftPresences }: { leftPresences: Array<{ key: string }> }) => { + leftPresences.forEach(({ key }) => { + delete cursors[key] + }) + } + ) .on('presence', { event: 'join' }, () => { if (!cursorPayload.value) return diff --git a/blocks/vue/registry/default/realtime-cursor/nuxtjs/registry-item.json b/blocks/vue/registry/default/realtime-cursor/nuxtjs/registry-item.json index 3a2adc71263..f39cf9a5fc4 100644 --- a/blocks/vue/registry/default/realtime-cursor/nuxtjs/registry-item.json +++ b/blocks/vue/registry/default/realtime-cursor/nuxtjs/registry-item.json @@ -21,4 +21,4 @@ } ], "dependencies": ["@supabase/supabase-js@latest", "@vueuse/core", "lucide-vue-next"] -} \ No newline at end of file +} diff --git a/blocks/vue/registry/default/realtime-cursor/vue/composables/useRealtimeCursors.ts b/blocks/vue/registry/default/realtime-cursor/vue/composables/useRealtimeCursors.ts index 7fccf11e5c6..108e33313eb 100644 --- a/blocks/vue/registry/default/realtime-cursor/vue/composables/useRealtimeCursors.ts +++ b/blocks/vue/registry/default/realtime-cursor/vue/composables/useRealtimeCursors.ts @@ -1,5 +1,6 @@ -import { ref, reactive, onMounted, onUnmounted } from 'vue' import { REALTIME_SUBSCRIBE_STATES, type RealtimeChannel } from '@supabase/supabase-js' +import { onMounted, onUnmounted, reactive, ref } from 'vue' + // @ts-ignore import { createClient } from '@/lib/supabase/client' @@ -47,11 +48,9 @@ function useThrottleCallback( const supabase = createClient() -const generateRandomColor = () => - `hsl(${Math.floor(Math.random() * 360)}, 100%, 70%)` +const generateRandomColor = () => `hsl(${Math.floor(Math.random() * 360)}, 100%, 70%)` -const generateRandomNumber = () => - Math.floor(Math.random() * 100) +const generateRandomNumber = () => Math.floor(Math.random() * 100) const EVENT_NAME = 'realtime-cursor-move' @@ -101,8 +100,10 @@ export function useRealtimeCursors({ }) } - const { run: handleMouseMove, cancel: cancelThrottle } = - useThrottleCallback(sendCursor, throttleMs) + const { run: handleMouseMove, cancel: cancelThrottle } = useThrottleCallback( + sendCursor, + throttleMs + ) onMounted(() => { const channel = supabase.channel(roomName) @@ -115,11 +116,15 @@ export function useRealtimeCursors({ Object.keys(cursors).forEach((k) => delete cursors[k]) channelRef.value = null }) - .on('presence', { event: 'leave' }, ({ leftPresences }: { leftPresences: Array<{ key: string }> }) => { - leftPresences.forEach(({ key }) => { - delete cursors[key] - }) - }) + .on( + 'presence', + { event: 'leave' }, + ({ leftPresences }: { leftPresences: Array<{ key: string }> }) => { + leftPresences.forEach(({ key }) => { + delete cursors[key] + }) + } + ) .on('presence', { event: 'join' }, () => { if (!cursorPayload.value) return diff --git a/blocks/vue/registry/default/realtime-cursor/vue/registry-item.json b/blocks/vue/registry/default/realtime-cursor/vue/registry-item.json index 728f0007f76..6c91266a459 100644 --- a/blocks/vue/registry/default/realtime-cursor/vue/registry-item.json +++ b/blocks/vue/registry/default/realtime-cursor/vue/registry-item.json @@ -3,7 +3,7 @@ "type": "registry:component", "title": "Realtime Cursor for Vue and Supabase", "description": "Component which renders realtime cursors from other users in a room.", - "files": [ + "files": [ { "path": "registry/default/realtime-cursor/vue/components/cursor.vue", "type": "registry:component", diff --git a/blocks/vue/registry/default/social-auth/nuxtjs/server/middleware/auth.ts b/blocks/vue/registry/default/social-auth/nuxtjs/server/middleware/auth.ts index e87ca43ea0e..c5cec1be2ff 100644 --- a/blocks/vue/registry/default/social-auth/nuxtjs/server/middleware/auth.ts +++ b/blocks/vue/registry/default/social-auth/nuxtjs/server/middleware/auth.ts @@ -1,4 +1,5 @@ import { defineEventHandler, sendRedirect } from 'h3' + import { createSupabaseServerClient } from '@/registry/default/clients/nuxtjs/server/supabase/client' export default defineEventHandler(async (event) => { @@ -11,11 +12,7 @@ export default defineEventHandler(async (event) => { const pathname = event.node.req.url || '/' // Redirect if no user and not already on login/auth route - if ( - !user && - !pathname.startsWith('/login') && - !pathname.startsWith('/auth') - ) { + if (!user && !pathname.startsWith('/login') && !pathname.startsWith('/auth')) { return sendRedirect(event, '/auth/login') } diff --git a/blocks/vue/registry/default/social-auth/nuxtjs/server/routes/auth/oauth.ts b/blocks/vue/registry/default/social-auth/nuxtjs/server/routes/auth/oauth.ts index 16994eb83d5..303b8817ed7 100644 --- a/blocks/vue/registry/default/social-auth/nuxtjs/server/routes/auth/oauth.ts +++ b/blocks/vue/registry/default/social-auth/nuxtjs/server/routes/auth/oauth.ts @@ -1,15 +1,16 @@ +import { defineEventHandler, getQuery, getRequestURL, sendRedirect } from 'h3' + import { createSupabaseServerClient } from '@/registry/default/clients/nuxtjs/server/supabase/client' -import { defineEventHandler, getQuery, sendRedirect, getRequestURL } from "h3" export default defineEventHandler(async (event) => { const url = getRequestURL(event) // URL object of the current request const query = getQuery(event) const code = query.code as string | undefined - let next = (query.next as string | undefined) ?? "/" + let next = (query.next as string | undefined) ?? '/' - if (!next.startsWith("/")) { - next = "/" + if (!next.startsWith('/')) { + next = '/' } if (code) { @@ -18,8 +19,8 @@ export default defineEventHandler(async (event) => { if (!error) { // Determine origin - const forwardedHost = event.node.req.headers["x-forwarded-host"] as string | undefined - const isLocalEnv = process.env.NODE_ENV === "development" + const forwardedHost = event.node.req.headers['x-forwarded-host'] as string | undefined + const isLocalEnv = process.env.NODE_ENV === 'development' const origin = `${url.protocol}//${url.host}` if (isLocalEnv) { diff --git a/blocks/vue/registry/password-based-auth.ts b/blocks/vue/registry/password-based-auth.ts index 065b2843fd0..c84c0fd5627 100644 --- a/blocks/vue/registry/password-based-auth.ts +++ b/blocks/vue/registry/password-based-auth.ts @@ -1,4 +1,5 @@ import { type Registry } from 'shadcn/schema' + import nuxtjs from './default/password-based-auth/nuxtjs/registry-item.json' with { type: 'json' } import vue from './default/password-based-auth/vue/registry-item.json' with { type: 'json' } diff --git a/blocks/vue/registry/social-auth.ts b/blocks/vue/registry/social-auth.ts index 8d7a0cabff6..a18671fb868 100644 --- a/blocks/vue/registry/social-auth.ts +++ b/blocks/vue/registry/social-auth.ts @@ -1,5 +1,6 @@ import { type Registry } from 'shadcn/schema' -import vue from './default/social-auth/vue/registry-item.json' with { type: 'json' } + import nuxt from './default/social-auth/nuxtjs/registry-item.json' with { type: 'json' } +import vue from './default/social-auth/vue/registry-item.json' with { type: 'json' } export const socialAuth = [vue, nuxt] as Registry['items'] diff --git a/blocks/vue/tsconfig.base.json b/blocks/vue/tsconfig.base.json deleted file mode 100644 index d72a9f3a278..00000000000 --- a/blocks/vue/tsconfig.base.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/tsconfig", - "display": "Default", - "compilerOptions": { - "composite": false, - "declaration": true, - "declarationMap": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "inlineSources": false, - "isolatedModules": true, - "moduleResolution": "node", - "noUnusedLocals": false, - "noUnusedParameters": false, - "preserveWatchOutput": true, - "skipLibCheck": true, - "strict": true - }, - "exclude": ["node_modules"] -} diff --git a/blocks/vue/tsconfig.json b/blocks/vue/tsconfig.json index 7d0123109ec..6ac505703e9 100644 --- a/blocks/vue/tsconfig.json +++ b/blocks/vue/tsconfig.json @@ -1,30 +1,31 @@ { "$schema": "https://json.schemastore.org/tsconfig", - "extends": "tsconfig/base.json", "compilerOptions": { + "composite": false, + "declaration": true, + "declarationMap": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "inlineSources": false, + "isolatedModules": true, + "moduleResolution": "bundler", + "noUnusedLocals": false, + "noUnusedParameters": false, + "preserveWatchOutput": true, + "skipLibCheck": true, + "strict": true, "target": "es5", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, - "skipLibCheck": true, - "strict": true, - "forceConsistentCasingInFileNames": true, "noEmit": true, "incremental": true, - "esModuleInterop": true, "module": "esnext", - "moduleResolution": "bundler", "resolveJsonModule": true, - "isolatedModules": true, "jsx": "preserve", "paths": { "@/*": ["./*"] - }, - "plugins": [ - { - "name": "next" - } - ] + } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], - "exclude": ["node_modules", "./scripts/build-registry.mts"] + "include": ["**/*.ts", "**/*.tsx", "**/*.vue"], + "exclude": ["node_modules"] } diff --git a/blocks/vue/tsconfig.scripts.json b/blocks/vue/tsconfig.scripts.json deleted file mode 100644 index 7d81d8fcb5f..00000000000 --- a/blocks/vue/tsconfig.scripts.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/tsconfig", - "extends": "./tsconfig.json", - "compilerOptions": { - "target": "es6", - "module": "ESNext", - "moduleResolution": "node", - "esModuleInterop": true, - "isolatedModules": false - }, - "include": [".contentlayer/generated", "scripts/**/*.ts"], - "exclude": ["node_modules"] -} diff --git a/package.json b/package.json index 927c83a6059..82556d44d35 100644 --- a/package.json +++ b/package.json @@ -22,8 +22,8 @@ "dev:design-system": "turbo run dev --filter=design-system --parallel", "lint": "turbo run lint", "typecheck": "turbo --continue typecheck", - "test:prettier": "SORT_IMPORTS=false prettier --cache --check '{apps,packages}/**/*.{js,jsx,ts,tsx,css,md,json}'", - "format": "SORT_IMPORTS=false prettier --cache --write '{apps,packages}/**/*.{js,jsx,ts,tsx,css,md,mdx,json}'", + "test:prettier": "SORT_IMPORTS=false prettier --cache --check '{apps,packages,blocks}/**/*.{js,jsx,ts,tsx,css,md,json}'", + "format": "SORT_IMPORTS=false prettier --cache --write '{apps,packages,blocks}/**/*.{js,jsx,ts,tsx,css,md,mdx,json}'", "test:docs": "turbo run test --filter=docs", "test:ui": "turbo run test --filter=ui", "test:ui-patterns": "turbo run test --filter=ui-patterns", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1c1aeb52d94..47f14406581 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1993,7 +1993,7 @@ importers: version: 4.5.1(vue@3.5.21(typescript@5.9.2)) devDependencies: shadcn: - specifier: ^3.0.0 + specifier: ^3.3.1 version: 3.3.1(@types/node@22.13.14)(babel-plugin-macros@3.1.0)(supports-color@8.1.1)(typescript@5.9.2) tsconfig: specifier: workspace:* @@ -12978,12 +12978,12 @@ packages: glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} - deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me + deprecated: Glob versions prior to v9 are no longer supported glob@8.1.0: resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} engines: {node: '>=12'} - deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me + deprecated: Glob versions prior to v9 are no longer supported glob@9.3.5: resolution: {integrity: sha512-e1LleDykUz2Iu+MTYdkSsuWX8lvAjAcs0Xef0lNIu0S2wOAzuTxCJtcd9S3cijlwYF18EsU3rzb8jPVobxDh9Q==}