@floatingpixels/supabase-nuxt 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # Supabase Nuxt
2
2
 
3
- ![NPM Version](https://img.shields.io/npm/v/%40floatingpixels%2Fsupabase-nuxt?color=28CF8D)
4
- ![NPM Downloads](https://img.shields.io/npm/dt/%40floatingpixels%2Fsupabase-nuxt)
3
+ <p>
4
+ <a href="https://www.npmjs.com/package/@floatingpixels/supabase-nuxt"><img src="https://img.shields.io/npm/v/%40floatingpixels%2Fsupabase-nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="Version"></a>
5
+ <a href="https://www.npmjs.com/package/@floatingpixels/supabase-nuxt"><img src="https://img.shields.io/npm/dt/%40floatingpixels%2Fsupabase-nuxt.svg?style=flat&colorA=18181B&colorB=28CF8Dt" alt="Downloads"></a>
6
+ </p>
5
7
 
6
8
  ## Features
7
9
 
@@ -125,7 +127,7 @@ const signInWithOtp = async () => {
125
127
  const { error } = await supabase.auth.signInWithOtp({
126
128
  email: email.value,
127
129
  options: {
128
- emailRedirectTo: 'http://localhost:3000/confirm',
130
+ emailRedirectTo: 'http://localhost:3000/welcome',
129
131
  },
130
132
  })
131
133
  if (error) console.log(error)
@@ -148,22 +150,22 @@ Once the authorization flow is triggered using the `auth` wrapper of the `useSup
148
150
 
149
151
  ### E-Mail Authentication
150
152
 
151
- When using e-mail authentication, a confirmation e-mail is sent to new users, and an e-mail containing a magic link is sent to existing users. For those links to work with your application, you need to adjust the e-mail templates in your Supabase settings under `Authentication -> Email Templates`. The generated links must contain a `token_hash` and `type` URL parameter, and point to the confirmation URL of your app, which is `/supabase/auth/confirm` by default. In addition you can set the URL parameter `next` to determine the route users will be forwarded to in your app when authorization is successful. If `next` is omitted, it will route to `/`. An example template looks like this:
153
+ When using e-mail authentication, a confirmation e-mail is sent to new users, and an e-mail containing a magic link is sent to existing users. For those links to work with your application, you need to adjust the e-mail templates in your Supabase settings under `Authentication -> Email Templates`. The generated links must contain a `token_hash` and `type` URL parameter, and point to the confirmation URL of your app, which is `/auth/confirm` by default. In addition you can set the URL parameter `redirect_to` to determine the route users will be forwarded to in your app when authorization is successful. If `redirect_to` is omitted, it will route to `/`. An example template looks like this:
152
154
 
153
155
  ```html
154
156
  <h2>Confirm your signup</h2>
155
157
 
158
+ <p>Hello {{ .Data.first_name }}</p>
156
159
  <p>Follow this link to confirm your user:</p>
157
160
  <p>
158
- <a href="{{ .SiteURL }}/supabase/auth/confirm?token_hash={{ .TokenHash }}&type=email&next=/path-to-your-page"
159
- >Confirm your email</a
161
+ <a href="{{ .SiteURL }}/supabase/auth/confirm?token_hash={{ .TokenHash }}&type=email&redirect_to={{ .RedirectTo }}>Confirm your email</a
160
162
  >
161
163
  </p>
162
164
  ```
163
165
 
164
- The confirmation route on your server is provided by this module, so you don't need to implement it yourself. It's available at `/supabase/auth/confirm`. It will automatically confirm the user and re-direct to the `next` route.
166
+ The confirmation route on your server is provided by this module, so you don't need to implement it yourself. It's available at `/auth/confirm`. It will automatically confirm the user and re-direct to the `redirect_to` route.
165
167
 
166
- If you want to customize the confirmation route, you can do so by creating a server route to handle the request, and point to it in your Supabase e-mail template. Your custom route will receive the `token_hash` and `type` URL parameters, and the `next` URL parameter if provided. You can use the `useSupabaseClient` composable to confirm the user and re-direct to the `next` route:
168
+ If you want to customize the confirmation route, you can do so by creating a server route to handle the request, and point to it in your Supabase e-mail template. Your custom route will receive the `token_hash` and `type` URL parameters, and the `redirect_to` URL parameter if provided. You can use the `useSupabaseClient` composable to confirm the user and re-direct to the `next` route:
167
169
 
168
170
  > ⚠️ You can use the provided confirm route at `/supabase/confirm`, the implementation of a custom route is optional!
169
171
 
@@ -175,7 +177,7 @@ export default defineEventHandler(async event => {
175
177
  const query = getQuery(event)
176
178
  const token_hash = query.token_hash as string
177
179
  const type = query.type as EmailOtpType | null
178
- const next = (query.next as string) ?? '/'
180
+ const redirect_to = (query.redirect_to as string) ?? '/'
179
181
 
180
182
  if (!token_hash || !type) {
181
183
  throw createError({ statusMessage: 'Invalid token' })
@@ -188,20 +190,20 @@ export default defineEventHandler(async event => {
188
190
  throw createError({ statusMessage: error.message })
189
191
  }
190
192
 
191
- await sendRedirect(event, next, 302)
193
+ await sendRedirect(event, redirect_to, 302)
192
194
  })
193
195
  ```
194
196
 
195
197
  ### OAuth Authentication
196
198
 
197
- When using OAuth authentication, you need to configure the OAuth provider in your Supabase settings under `Authentication -> Providers`. You can then use the `signInWithOAuth` method of the `auth` wrapper of the `useSupabaseClient` composable to initiate the authorization flow. This module provides a default callback under `/supabase/auth/callback` that you can provide to the authentication function:
199
+ When using OAuth authentication, you need to configure the OAuth provider in your Supabase settings under `Authentication -> Providers`. You can then use the `signInWithOAuth` method of the `auth` wrapper of the `useSupabaseClient` composable to initiate the authorization flow. This module provides a default callback under `/auth/callback` that you can provide to the authentication function:
198
200
 
199
201
  ```ts [pages/login.vue]
200
202
  const signInWithOAuth = async () => {
201
203
  const { error } = await supabase.auth.signInWithOAuth({
202
204
  provider: 'github',
203
205
  options: {
204
- redirectTo: 'http://<your-site-url>/supabase/auth/callback',
206
+ redirectTo: 'http://<your-site-url>/auth/callback',
205
207
  },
206
208
  })
207
209
  if (error) console.log(error)
@@ -210,7 +212,7 @@ const signInWithOAuth = async () => {
210
212
 
211
213
  You can customize the callback by creating your own server route, and point to it when calling `signInWithOAuth`. The callback route will receive a code, that needs to be exchanged for a session. Here is an example:
212
214
 
213
- > ⚠️ You can use the provided callback route at `/supabase/auth/callback`, the implementation of a custom callback is optional!
215
+ > ⚠️ You can use the provided callback route at `/auth/callback`, the implementation of a custom callback is optional!
214
216
 
215
217
  ```ts [server/api/callback.ts]
216
218
  import { supabaseServerClient } from '#supabase/server'
@@ -218,7 +220,7 @@ import { supabaseServerClient } from '#supabase/server'
218
220
  export default defineEventHandler(async event => {
219
221
  const query = getQuery(event)
220
222
  const code = query.code as string
221
- const next = (query.next as string) ?? '/'
223
+ const redirect_to = (query.redirect_to as string) ?? '/'
222
224
 
223
225
  if (!code) {
224
226
  throw createError({ statusMessage: 'No code provided' })
@@ -231,7 +233,7 @@ export default defineEventHandler(async event => {
231
233
  throw createError({ statusMessage: error.message })
232
234
  }
233
235
 
234
- await sendRedirect(event, next, 302)
236
+ await sendRedirect(event, redirect_to, 302)
235
237
  })
236
238
  ```
237
239
 
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">3.0.0"
6
6
  },
7
- "version": "0.4.0",
7
+ "version": "0.4.2",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -3,7 +3,7 @@ import { supabaseServerClient } from "#supabase/server";
3
3
  export default defineEventHandler(async (event) => {
4
4
  const query = getQuery(event);
5
5
  const code = query.code;
6
- const next = query.next ?? "/";
6
+ const redirect_to = query.redirect_to ?? "/";
7
7
  if (!code) {
8
8
  throw createError({ statusMessage: "No code provided" });
9
9
  }
@@ -12,5 +12,5 @@ export default defineEventHandler(async (event) => {
12
12
  if (error) {
13
13
  throw createError({ statusMessage: error.message });
14
14
  }
15
- await sendRedirect(event, next, 302);
15
+ await sendRedirect(event, redirect_to, 302);
16
16
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floatingpixels/supabase-nuxt",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Supabase module for Nuxt",
5
5
  "repository": "floatingpixels/supabase-nuxt",
6
6
  "license": "MIT",
@@ -56,38 +56,46 @@
56
56
  "db:seed": "npx tsx seed.ts",
57
57
  "db:sync": "npx @snaplet/seed sync",
58
58
  "db:fullseed": "(npx @snaplet/seed sync) -and (npx tsx seed.ts)",
59
- "db:dump": "pg_dump -a -h localhost -U postgres -p 54322 -f ./supabase/seed.sql --schema=public --schema=auth --inserts"
59
+ "db:dump": "pg_dump -a -h localhost -U postgres -p 54322 -f ./supabase/seed.sql --schema=public --schema=auth --inserts",
60
+ "cleanup": "pnpm nuxi cleanup && rm -rf node_modules pnpm-lock.yaml && pnpm i"
60
61
  },
61
62
  "dependencies": {
62
63
  "@supabase/ssr": "^0.5.2",
63
- "@supabase/supabase-js": "^2.48.1"
64
+ "@supabase/supabase-js": "^2.49.1"
64
65
  },
65
66
  "devDependencies": {
66
- "@nuxt/devtools": "^1.7.0",
67
- "@nuxt/eslint-config": "^1.0.0",
67
+ "@nuxt/devtools": "^2.1.0",
68
+ "@nuxt/eslint-config": "^1.1.0",
68
69
  "@nuxt/kit": "^3.15.4",
69
70
  "@nuxt/module-builder": "^0.8.4",
70
71
  "@nuxt/schema": "^3.15.4",
71
- "@nuxt/test-utils": "3.15.4",
72
+ "@nuxt/test-utils": "3.17.0",
72
73
  "@playwright/test": "^1.50.1",
73
74
  "@snaplet/copycat": "^6.0.0",
74
75
  "@snaplet/seed": "^0.98.0",
75
76
  "@types/eslint-config-prettier": "^6.11.3",
76
- "@types/node": "^22.13.1",
77
- "@vitest/coverage-v8": "2.1.8",
77
+ "@types/node": "^22.13.5",
78
+ "@vitest/coverage-v8": "3.0.6",
78
79
  "@vue/test-utils": "^2.4.6",
79
80
  "changelogen": "^0.5.7",
80
- "eslint": "^9.19.0",
81
+ "eslint": "^9.21.0",
81
82
  "eslint-config-prettier": "^10.0.1",
82
- "happy-dom": "^16.8.1",
83
+ "happy-dom": "^17.1.4",
83
84
  "nuxt": "^3.15.4",
84
85
  "playwright-core": "^1.50.1",
85
86
  "postgres": "^3.4.5",
86
- "prettier": "^3.4.2",
87
+ "prettier": "^3.5.2",
87
88
  "release-it": "^18.1.2",
88
- "supabase": "^2.9.6",
89
+ "supabase": "^2.12.1",
89
90
  "typescript": "5.7.3",
90
- "vitest": "^2.1.9",
91
- "vue-tsc": "^2.2.0"
91
+ "vitest": "^3.0.6",
92
+ "vue-tsc": "^2.2.4"
93
+ },
94
+ "pnpm": {
95
+ "onlyBuiltDependencies": [
96
+ "@snaplet/seed",
97
+ "esbuild",
98
+ "supabase"
99
+ ]
92
100
  }
93
101
  }