@floatingpixels/supabase-nuxt 0.5.0 → 0.5.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
@@ -33,11 +33,11 @@ export default defineNuxtConfig({
33
33
  })
34
34
  ```
35
35
 
36
- Add `SUPABASE_URL` and `SUPABASE_ANON_KEY` to `.env`:
36
+ Add `SUPABASE_URL` and `SUPABASE_PUBLISHABLE_KEY` to `.env`:
37
37
 
38
38
  ```zsh
39
39
  NUXT_PUBLIC_SUPABASE_URL="https://example.supabase.co"
40
- NUXT_PUBLIC_SUPABASE_ANON_KEY=""
40
+ NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=""
41
41
  ```
42
42
 
43
43
  When dynamically setting the variables during in an environment, make sure to prefix the environment variables with `NUXT_PUBLIC_` in order to use `runtimeConfig`.
@@ -63,17 +63,17 @@ Default: `process.env.NUXT_PUBLIC_SUPABASE_URL` (e.g.: `https://example.supabase
63
63
 
64
64
  The unique Supabase URL which is supplied when you create a new project in your project dashboard.
65
65
 
66
- ### `key`
66
+ ### `publishableKey`
67
67
 
68
- Default: `process.env.NUXT_PUBLIC_SUPABASE_ANON_KEY`
68
+ Default: `process.env.NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`
69
69
 
70
- Supabase 'anon key', used to bypass the Supabase API gateway and interact with your Supabase database making use of user JWT to apply RLS Policies.
70
+ Supabase 'publishable key', used to access the Supabase API gateway and interact with your Supabase database making use of user JWT to apply RLS Policies.
71
71
 
72
- ### `serviceKey`
72
+ ### `secretKey`
73
73
 
74
74
  Default: `process.env.NUXT_SUPABASE_SERVICE_ROLE_KEY`
75
75
 
76
- Supabase 'service role key', has super admin rights and can bypass your Row Level Security.
76
+ Supabase 'service role key', has super admin rights and can bypass your Row Level Security. This can be any secret key configured in your Supabase project.
77
77
 
78
78
  ### `redirect`
79
79
 
package/dist/module.d.mts CHANGED
@@ -2,84 +2,96 @@ import * as _nuxt_schema from '@nuxt/schema';
2
2
  import { SupabaseClientOptions } from '@supabase/supabase-js';
3
3
 
4
4
  declare module '@nuxt/schema' {
5
- interface PublicRuntimeConfig {
6
- supabase: {
7
- url: string;
8
- anonKey: string;
9
- redirect: boolean;
10
- redirectOptions: RedirectOptions;
11
- clientOptions: SupabaseClientOptions<string>;
12
- };
5
+ interface RuntimeConfig {
6
+ supabase: {
7
+ serviceRoleKey?: string
13
8
  }
9
+ }
10
+
11
+ interface PublicRuntimeConfig {
12
+ supabase: {
13
+ url: string
14
+ publishableKey: string
15
+ redirect: boolean
16
+ redirectOptions: RedirectOptions
17
+ clientOptions: SupabaseClientOptions<string>
18
+ }
19
+ }
14
20
  }
21
+
15
22
  interface RedirectOptions {
16
- /**
17
- * Login route
18
- * @default '/login'
19
- * @type string
20
- */
21
- login?: string;
22
- /**
23
- * Routes to exclude from redirection
24
- * @default []
25
- * @type string[]
26
- */
27
- exclude?: string[];
23
+ /**
24
+ * Login route
25
+ * @default '/login'
26
+ * @type string
27
+ */
28
+ login?: string
29
+ /**
30
+ * Routes to exclude from redirection
31
+ * @default []
32
+ * @type string[]
33
+ */
34
+ exclude?: string[]
28
35
  }
36
+
29
37
  interface ModuleOptions {
30
- /**
31
- * Supabase API URL
32
- * @example 'https://*.supabase.co'
33
- * @type string
34
- * @docs https://supabase.com/docs/reference/javascript/initializing#parameters
35
- */
36
- url?: string;
37
- /**
38
- * Supabase Client API Key
39
- * @example '123456789'
40
- * @type string
41
- * @docs https://supabase.com/docs/reference/javascript/initializing#parameters
42
- */
43
- anonKey?: string;
44
- /**
45
- * Supabase Service key
46
- * @example '123456789'
47
- * @type string
48
- * @docs https://supabase.com/docs/reference/javascript/initializing#parameters
49
- */
50
- serviceRoleKey?: string;
51
- /**
52
- * Redirect automatically to login page if user is not authenticated
53
- * @default `false`
54
- * @type boolean
55
- */
56
- redirect?: boolean;
57
- /**
58
- * Redirection options, set routes for login and specify pages to exclude from redirection
59
- * @default
60
- * {
61
- login: '/login',
62
- exclude: [],
63
- }
64
- * @type RedirectOptions
65
- */
66
- redirectOptions?: RedirectOptions;
67
- /**
68
- * Supabase Client options
69
- * @default {
70
- auth: {
71
- flowType: 'pkce',
72
- detectSessionInUrl: true,
73
- persistSession: true,
74
- },
75
- }
76
- * @type object
77
- *@docs https://supabase.com/docs/reference/javascript/initializing#parameters
78
- */
79
- clientOptions?: SupabaseClientOptions<string>;
38
+ /**
39
+ * Supabase API URL
40
+ * @example 'https://*.supabase.co'
41
+ * @type string
42
+ * @docs https://supabase.com/docs/reference/javascript/initializing#parameters
43
+ */
44
+ url?: string
45
+
46
+ /**
47
+ * Supabase Publishable Client API Key
48
+ * @example '123456789'
49
+ * @type string
50
+ * @docs https://supabase.com/docs/reference/javascript/initializing#parameters
51
+ */
52
+ publishableKey?: string
53
+
54
+ /**
55
+ * Supabase Secret Service Role key
56
+ * @example '123456789'
57
+ * @type string
58
+ * @docs https://supabase.com/docs/reference/javascript/initializing#parameters
59
+ */
60
+ secretKey?: string
61
+
62
+ /**
63
+ * Redirect automatically to login page if user is not authenticated
64
+ * @default `false`
65
+ * @type boolean
66
+ */
67
+ redirect?: boolean
68
+
69
+ /**
70
+ * Redirection options, set routes for login and specify pages to exclude from redirection
71
+ * @default
72
+ * {
73
+ login: '/login',
74
+ exclude: [],
75
+ }
76
+ * @type RedirectOptions
77
+ */
78
+ redirectOptions?: RedirectOptions
79
+
80
+ /**
81
+ * Supabase Client options
82
+ * @default {
83
+ auth: {
84
+ flowType: 'pkce',
85
+ detectSessionInUrl: true,
86
+ persistSession: true,
87
+ },
88
+ }
89
+ * @type object
90
+ *@docs https://supabase.com/docs/reference/javascript/initializing#parameters
91
+ */
92
+ clientOptions?: SupabaseClientOptions<string>
80
93
  }
81
94
 
82
95
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
83
96
 
84
97
  export { _default as default };
85
- export type { ModuleOptions, RedirectOptions };
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">3.0.0"
6
6
  },
7
- "version": "0.5.0",
7
+ "version": "0.5.2",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.0"
package/dist/module.mjs CHANGED
@@ -10,8 +10,8 @@ const module = defineNuxtModule({
10
10
  },
11
11
  defaults: {
12
12
  url: void 0,
13
- anonKey: void 0,
14
- serviceRoleKey: void 0,
13
+ publishableKey: void 0,
14
+ secretKey: void 0,
15
15
  redirect: false,
16
16
  redirectOptions: {
17
17
  login: "/login",
@@ -31,18 +31,24 @@ const module = defineNuxtModule({
31
31
  if (!process.env.NUXT_PUBLIC_SUPABASE_URL && !options.url) {
32
32
  console.warn("Missing `NUXT_PUBLIC_SUPABASE_URL` in environment or `url` in module options");
33
33
  }
34
- if (!process.env.NUXT_PUBLIC_SUPABASE_ANON_KEY && !options.anonKey) {
35
- console.warn("Missing `NUXT_PUBLIC_SUPABASE_ANON_KEY` in environment or `anonKey` in module options");
34
+ if (!process.env.NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY && !options.publishableKey) {
35
+ console.warn(
36
+ "Missing `NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY` in environment or `publishableKey` in module options"
37
+ );
36
38
  }
37
39
  nuxt.options.runtimeConfig.public.supabase = {
38
40
  url: options.url,
39
- anonKey: options.anonKey,
41
+ publishableKey: options.publishableKey,
40
42
  redirect: options.redirect,
41
43
  redirectOptions: options.redirectOptions,
42
44
  clientOptions: options.clientOptions
43
45
  };
44
46
  nuxt.options.runtimeConfig.supabase = {
45
- serviceRoleKey: options.serviceRoleKey
47
+ serviceRoleKey: options.secretKey
48
+ };
49
+ nuxt.options.alias = {
50
+ ...nuxt.options.alias,
51
+ "#supabase/server": resolve("./runtime/server/services")
46
52
  };
47
53
  addServerHandler({
48
54
  route: "/auth/confirm",
@@ -4,9 +4,8 @@ export default defineNuxtPlugin({
4
4
  name: "supabase",
5
5
  enforce: "pre",
6
6
  async setup() {
7
- const config = useRuntimeConfig().public.supabase;
8
- const { url, anonKey } = config;
9
- const supabaseBrowserClient = createBrowserClient(url, anonKey);
7
+ const { url, publishableKey } = useRuntimeConfig().public.supabase;
8
+ const supabaseBrowserClient = createBrowserClient(url, publishableKey);
10
9
  return {
11
10
  provide: {
12
11
  supabase: {
@@ -5,12 +5,12 @@ export default defineNuxtPlugin({
5
5
  name: "supabase",
6
6
  enforce: "pre",
7
7
  async setup() {
8
- const { url, anonKey } = useRuntimeConfig().public.supabase;
8
+ const { url, publishableKey } = useRuntimeConfig().public.supabase;
9
9
  const event = useRequestEvent();
10
10
  if (!event) {
11
11
  throw new Error("No request event found");
12
12
  }
13
- const supabaseServerClient = createServerClient(url, anonKey, {
13
+ const supabaseServerClient = createServerClient(url, publishableKey, {
14
14
  cookies: {
15
15
  getAll: () => {
16
16
  const cookie_records = parseCookies(event);
@@ -3,11 +3,11 @@ import { setCookie, parseCookies } from "h3";
3
3
  import { useRuntimeConfig } from "#imports";
4
4
  export const supabaseServerClient = async (event) => {
5
5
  const {
6
- supabase: { url, anonKey }
6
+ supabase: { url, publishableKey }
7
7
  } = useRuntimeConfig().public;
8
8
  let supabaseClient = event.context._supabaseClient;
9
9
  if (!supabaseClient) {
10
- supabaseClient = createServerClient(url, anonKey, {
10
+ supabaseClient = createServerClient(url, publishableKey, {
11
11
  cookies: {
12
12
  getAll: () => {
13
13
  const cookie_records = parseCookies(event);
package/dist/types.d.mts CHANGED
@@ -1,3 +1,7 @@
1
- export { default } from './module.mjs'
1
+ import type { NuxtModule } from '@nuxt/schema'
2
+
3
+ import type { default as Module } from './module.mjs'
2
4
 
3
- export { type ModuleOptions, type RedirectOptions } from './module.mjs'
5
+ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
6
+
7
+ export { default } from './module.mjs'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floatingpixels/supabase-nuxt",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Supabase module for Nuxt",
5
5
  "repository": "floatingpixels/supabase-nuxt",
6
6
  "license": "MIT",
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "dependencies": {
61
61
  "@supabase/ssr": "^0.6.1",
62
- "@supabase/supabase-js": "^2.54.0",
62
+ "@supabase/supabase-js": "^2.55.0",
63
63
  "cookie": "^1.0.2"
64
64
  },
65
65
  "devDependencies": {
@@ -85,7 +85,7 @@
85
85
  "postgres": "^3.4.7",
86
86
  "prettier": "^3.6.2",
87
87
  "release-it": "^19.0.4",
88
- "supabase": "^2.33.9",
88
+ "supabase": "^2.34.3",
89
89
  "typescript": "5.9.2",
90
90
  "vitest": "^3.2.4",
91
91
  "vue-tsc": "^3.0.5"