@floatingpixels/supabase-nuxt 0.4.4 → 0.4.5
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/dist/module.d.mts +2 -1
- package/dist/module.json +3 -3
- package/dist/runtime/plugins/supabase.server.js +16 -8
- package/dist/runtime/server/services/supabaseServerClient.js +16 -8
- package/dist/runtime/server/services/supabaseServiceRole.js +16 -8
- package/dist/types.d.mts +3 -1
- package/package.json +22 -22
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -84
- package/dist/types.d.ts +0 -1
package/dist/module.d.mts
CHANGED
|
@@ -81,4 +81,5 @@ interface ModuleOptions {
|
|
|
81
81
|
|
|
82
82
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
83
83
|
|
|
84
|
-
export {
|
|
84
|
+
export { _default as default };
|
|
85
|
+
export type { ModuleOptions, RedirectOptions };
|
package/dist/module.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineNuxtPlugin, useRuntimeConfig, useRequestEvent } from "nuxt/app";
|
|
2
|
-
import { createServerClient
|
|
3
|
-
import { setCookie,
|
|
2
|
+
import { createServerClient } from "@supabase/ssr";
|
|
3
|
+
import { setCookie, parseCookies } from "h3";
|
|
4
4
|
export default defineNuxtPlugin({
|
|
5
5
|
name: "supabase",
|
|
6
6
|
enforce: "pre",
|
|
@@ -12,13 +12,21 @@ export default defineNuxtPlugin({
|
|
|
12
12
|
}
|
|
13
13
|
const supabaseServerClient = createServerClient(url, anonKey, {
|
|
14
14
|
cookies: {
|
|
15
|
-
getAll:
|
|
16
|
-
|
|
15
|
+
getAll: () => {
|
|
16
|
+
const cookie_records = parseCookies(event);
|
|
17
|
+
return Object.entries(cookie_records).map(([name, value]) => ({
|
|
18
|
+
name,
|
|
19
|
+
value
|
|
20
|
+
}));
|
|
17
21
|
},
|
|
18
|
-
setAll
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
setAll(cookiesToSet) {
|
|
23
|
+
try {
|
|
24
|
+
cookiesToSet.forEach(({ name, value, options }) => {
|
|
25
|
+
setCookie(event, name, value, options);
|
|
26
|
+
});
|
|
27
|
+
} catch {
|
|
28
|
+
console.error("Error setting cookies", cookiesToSet);
|
|
29
|
+
}
|
|
22
30
|
}
|
|
23
31
|
}
|
|
24
32
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createServerClient
|
|
2
|
-
import { setCookie,
|
|
1
|
+
import { createServerClient } from "@supabase/ssr";
|
|
2
|
+
import { setCookie, parseCookies } from "h3";
|
|
3
3
|
import { useRuntimeConfig } from "#imports";
|
|
4
4
|
export const supabaseServerClient = async (event) => {
|
|
5
5
|
const {
|
|
@@ -9,13 +9,21 @@ export const supabaseServerClient = async (event) => {
|
|
|
9
9
|
if (!supabaseClient) {
|
|
10
10
|
supabaseClient = createServerClient(url, anonKey, {
|
|
11
11
|
cookies: {
|
|
12
|
-
getAll:
|
|
13
|
-
|
|
12
|
+
getAll: () => {
|
|
13
|
+
const cookie_records = parseCookies(event);
|
|
14
|
+
return Object.entries(cookie_records).map(([name, value]) => ({
|
|
15
|
+
name,
|
|
16
|
+
value
|
|
17
|
+
}));
|
|
14
18
|
},
|
|
15
|
-
setAll
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
setAll(cookiesToSet) {
|
|
20
|
+
try {
|
|
21
|
+
cookiesToSet.forEach(({ name, value, options }) => {
|
|
22
|
+
setCookie(event, name, value, options);
|
|
23
|
+
});
|
|
24
|
+
} catch {
|
|
25
|
+
console.error("Error setting cookies", cookiesToSet);
|
|
26
|
+
}
|
|
19
27
|
}
|
|
20
28
|
}
|
|
21
29
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createServerClient
|
|
2
|
-
import { setCookie,
|
|
1
|
+
import { createServerClient } from "@supabase/ssr";
|
|
2
|
+
import { setCookie, parseCookies } from "h3";
|
|
3
3
|
import { useRuntimeConfig } from "#imports";
|
|
4
4
|
export const supabaseServiceRole = async (event) => {
|
|
5
5
|
const {
|
|
@@ -15,13 +15,21 @@ export const supabaseServiceRole = async (event) => {
|
|
|
15
15
|
if (!supabaseClient) {
|
|
16
16
|
supabaseClient = createServerClient(url, serviceRoleKey, {
|
|
17
17
|
cookies: {
|
|
18
|
-
getAll:
|
|
19
|
-
|
|
18
|
+
getAll: () => {
|
|
19
|
+
const cookie_records = parseCookies(event);
|
|
20
|
+
return Object.entries(cookie_records).map(([name, value]) => ({
|
|
21
|
+
name,
|
|
22
|
+
value
|
|
23
|
+
}));
|
|
20
24
|
},
|
|
21
|
-
setAll
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
setAll(cookiesToSet) {
|
|
26
|
+
try {
|
|
27
|
+
cookiesToSet.forEach(({ name, value, options }) => {
|
|
28
|
+
setCookie(event, name, value, options);
|
|
29
|
+
});
|
|
30
|
+
} catch {
|
|
31
|
+
console.error("Error setting cookies", cookiesToSet);
|
|
32
|
+
}
|
|
25
33
|
}
|
|
26
34
|
}
|
|
27
35
|
});
|
package/dist/types.d.mts
CHANGED
package/package.json
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@floatingpixels/supabase-nuxt",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "Supabase module for Nuxt",
|
|
5
5
|
"repository": "floatingpixels/supabase-nuxt",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"types": "./dist/types.d.
|
|
11
|
-
"import": "./dist/module.mjs"
|
|
12
|
-
"require": "./dist/module.cjs"
|
|
10
|
+
"types": "./dist/types.d.mts",
|
|
11
|
+
"import": "./dist/module.mjs"
|
|
13
12
|
}
|
|
14
13
|
},
|
|
15
|
-
"main": "./dist/module.
|
|
16
|
-
"types": "./dist/types.d.ts",
|
|
14
|
+
"main": "./dist/module.mjs",
|
|
17
15
|
"files": [
|
|
18
16
|
"dist"
|
|
19
17
|
],
|
|
@@ -60,39 +58,41 @@
|
|
|
60
58
|
"cleanup": "pnpm nuxi cleanup && rm -rf node_modules pnpm-lock.yaml && pnpm i"
|
|
61
59
|
},
|
|
62
60
|
"dependencies": {
|
|
63
|
-
"@supabase/ssr": "^0.
|
|
64
|
-
"@supabase/supabase-js": "^2.49.
|
|
61
|
+
"@supabase/ssr": "^0.6.1",
|
|
62
|
+
"@supabase/supabase-js": "^2.49.4"
|
|
65
63
|
},
|
|
66
64
|
"devDependencies": {
|
|
67
|
-
"@nuxt/devtools": "^2.2
|
|
68
|
-
"@nuxt/eslint-config": "^1.
|
|
69
|
-
"@nuxt/kit": "^3.16.
|
|
70
|
-
"@nuxt/module-builder": "^0.
|
|
71
|
-
"@nuxt/schema": "^3.16.
|
|
65
|
+
"@nuxt/devtools": "^2.3.2",
|
|
66
|
+
"@nuxt/eslint-config": "^1.3.0",
|
|
67
|
+
"@nuxt/kit": "^3.16.2",
|
|
68
|
+
"@nuxt/module-builder": "^1.0.1",
|
|
69
|
+
"@nuxt/schema": "^3.16.2",
|
|
72
70
|
"@nuxt/test-utils": "3.17.2",
|
|
73
|
-
"@playwright/test": "^1.51.
|
|
71
|
+
"@playwright/test": "^1.51.1",
|
|
74
72
|
"@snaplet/copycat": "^6.0.0",
|
|
75
73
|
"@snaplet/seed": "^0.98.0",
|
|
76
74
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
77
|
-
"@types/node": "^22.
|
|
78
|
-
"@vitest/coverage-v8": "3.
|
|
75
|
+
"@types/node": "^22.14.0",
|
|
76
|
+
"@vitest/coverage-v8": "3.1.1",
|
|
79
77
|
"@vue/test-utils": "^2.4.6",
|
|
80
78
|
"changelogen": "^0.6.1",
|
|
81
|
-
"eslint": "^9.
|
|
79
|
+
"eslint": "^9.24.0",
|
|
82
80
|
"eslint-config-prettier": "^10.1.1",
|
|
83
81
|
"happy-dom": "^17.4.4",
|
|
84
|
-
"nuxt": "^3.16.
|
|
85
|
-
"playwright-core": "^1.51.
|
|
82
|
+
"nuxt": "^3.16.2",
|
|
83
|
+
"playwright-core": "^1.51.1",
|
|
86
84
|
"postgres": "^3.4.5",
|
|
87
85
|
"prettier": "^3.5.3",
|
|
88
86
|
"release-it": "^18.1.2",
|
|
89
|
-
"supabase": "^2.
|
|
90
|
-
"typescript": "5.8.
|
|
91
|
-
"vitest": "^3.
|
|
87
|
+
"supabase": "^2.20.12",
|
|
88
|
+
"typescript": "5.8.3",
|
|
89
|
+
"vitest": "^3.1.1",
|
|
92
90
|
"vue-tsc": "^2.2.8"
|
|
93
91
|
},
|
|
94
92
|
"pnpm": {
|
|
95
93
|
"onlyBuiltDependencies": [
|
|
94
|
+
"@parcel/watcher",
|
|
95
|
+
"@prisma/engines",
|
|
96
96
|
"@snaplet/seed",
|
|
97
97
|
"esbuild",
|
|
98
98
|
"supabase"
|
package/dist/module.cjs
DELETED
package/dist/module.d.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { SupabaseClientOptions } from '@supabase/supabase-js';
|
|
3
|
-
|
|
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
|
-
};
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
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[];
|
|
28
|
-
}
|
|
29
|
-
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>;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
83
|
-
|
|
84
|
-
export { type ModuleOptions, type RedirectOptions, _default as default };
|
package/dist/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { type ModuleOptions, type RedirectOptions, default } from './module'
|