@witchcraft/nuxt-auth 0.2.1 → 0.3.0
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.json +1 -1
- package/dist/module.mjs +5 -11
- package/dist/runtime/components/LoginProviderButtons.client.d.vue.ts +2 -2
- package/dist/runtime/components/LoginProviderButtons.client.vue.d.ts +2 -2
- package/dist/runtime/components/SessionStatus.d.vue.ts +4 -4
- package/dist/runtime/components/SessionStatus.vue.d.ts +4 -4
- package/dist/runtime/components/UserRegistration.d.vue.ts +6 -6
- package/dist/runtime/components/UserRegistration.vue +4 -4
- package/dist/runtime/components/UserRegistration.vue.d.ts +6 -6
- package/dist/runtime/middleware/authGlobal.js +5 -4
- package/package.json +104 -105
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -2,13 +2,7 @@ import { crop } from '@alanscodelog/utils/crop';
|
|
|
2
2
|
import { defineNuxtModule, useLogger, createResolver, addComponentsDir, addImportsDir, addServerScanDir, addServerImportsDir, addServerImports, addTemplate, addRouteMiddleware } from '@nuxt/kit';
|
|
3
3
|
import { defu } from 'defu';
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
"@witchcraft/ui": "^0.3.5",
|
|
7
|
-
"nuxt-security": "^2.4.0"};
|
|
8
|
-
const pkg = {
|
|
9
|
-
dependencies: dependencies};
|
|
10
|
-
|
|
11
|
-
const module = defineNuxtModule({
|
|
5
|
+
const module$1 = defineNuxtModule({
|
|
12
6
|
meta: {
|
|
13
7
|
name: "auth",
|
|
14
8
|
configKey: "auth"
|
|
@@ -57,11 +51,11 @@ const module = defineNuxtModule({
|
|
|
57
51
|
},
|
|
58
52
|
moduleDependencies: {
|
|
59
53
|
"@witchcraft/ui": {
|
|
60
|
-
version:
|
|
54
|
+
version: "^0.3.5",
|
|
61
55
|
optional: true
|
|
62
56
|
},
|
|
63
57
|
"nuxt-security": {
|
|
64
|
-
version:
|
|
58
|
+
version: "^2.4.0",
|
|
65
59
|
optional: true
|
|
66
60
|
}
|
|
67
61
|
},
|
|
@@ -85,7 +79,7 @@ const module = defineNuxtModule({
|
|
|
85
79
|
options
|
|
86
80
|
);
|
|
87
81
|
delete nuxt.options.runtimeConfig.public.auth.useGlobalMiddleware;
|
|
88
|
-
nuxt.options.alias["#auth"] = resolve("runtime");
|
|
82
|
+
nuxt.options.alias["#witchcraft-nuxt-auth"] = resolve("runtime");
|
|
89
83
|
addImportsDir(resolve("runtime/composables"));
|
|
90
84
|
addImportsDir(resolve("runtime/utils"));
|
|
91
85
|
addServerScanDir(resolve("runtime/server"));
|
|
@@ -140,4 +134,4 @@ const module = defineNuxtModule({
|
|
|
140
134
|
}
|
|
141
135
|
});
|
|
142
136
|
|
|
143
|
-
export { module as default };
|
|
137
|
+
export { module$1 as default };
|
|
@@ -5,12 +5,12 @@ type __VLS_Props = {
|
|
|
5
5
|
useAuthOptions?: UseAuthComposableOptions;
|
|
6
6
|
loginOptions?: Parameters<ReturnType<typeof useAuth>["login"]>[1];
|
|
7
7
|
};
|
|
8
|
-
declare var
|
|
8
|
+
declare var __VLS_20: {
|
|
9
9
|
class: string;
|
|
10
10
|
iconClass: string;
|
|
11
11
|
};
|
|
12
12
|
type __VLS_Slots = {} & {
|
|
13
|
-
extra?: (props: typeof
|
|
13
|
+
extra?: (props: typeof __VLS_20) => any;
|
|
14
14
|
};
|
|
15
15
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
16
16
|
providerStyles: Record<ProviderNames, Partial<ProviderStyle>>;
|
|
@@ -5,12 +5,12 @@ type __VLS_Props = {
|
|
|
5
5
|
useAuthOptions?: UseAuthComposableOptions;
|
|
6
6
|
loginOptions?: Parameters<ReturnType<typeof useAuth>["login"]>[1];
|
|
7
7
|
};
|
|
8
|
-
declare var
|
|
8
|
+
declare var __VLS_20: {
|
|
9
9
|
class: string;
|
|
10
10
|
iconClass: string;
|
|
11
11
|
};
|
|
12
12
|
type __VLS_Slots = {} & {
|
|
13
|
-
extra?: (props: typeof
|
|
13
|
+
extra?: (props: typeof __VLS_20) => any;
|
|
14
14
|
};
|
|
15
15
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
16
16
|
providerStyles: Record<ProviderNames, Partial<ProviderStyle>>;
|
|
@@ -8,10 +8,10 @@ declare var __VLS_1: {
|
|
|
8
8
|
authRoutes: any;
|
|
9
9
|
}, __VLS_3: {
|
|
10
10
|
user: any;
|
|
11
|
-
},
|
|
11
|
+
}, __VLS_19: {
|
|
12
12
|
user: any;
|
|
13
13
|
authRoutes: any;
|
|
14
|
-
},
|
|
14
|
+
}, __VLS_35: {
|
|
15
15
|
authRoutes: any;
|
|
16
16
|
};
|
|
17
17
|
type __VLS_Slots = {} & {
|
|
@@ -19,9 +19,9 @@ type __VLS_Slots = {} & {
|
|
|
19
19
|
} & {
|
|
20
20
|
user?: (props: typeof __VLS_3) => any;
|
|
21
21
|
} & {
|
|
22
|
-
'authenticated-unregistered'?: (props: typeof
|
|
22
|
+
'authenticated-unregistered'?: (props: typeof __VLS_19) => any;
|
|
23
23
|
} & {
|
|
24
|
-
unauthenticated?: (props: typeof
|
|
24
|
+
unauthenticated?: (props: typeof __VLS_35) => any;
|
|
25
25
|
};
|
|
26
26
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
27
27
|
usernameLink: (user: AuthUser) => string;
|
|
@@ -8,10 +8,10 @@ declare var __VLS_1: {
|
|
|
8
8
|
authRoutes: any;
|
|
9
9
|
}, __VLS_3: {
|
|
10
10
|
user: any;
|
|
11
|
-
},
|
|
11
|
+
}, __VLS_19: {
|
|
12
12
|
user: any;
|
|
13
13
|
authRoutes: any;
|
|
14
|
-
},
|
|
14
|
+
}, __VLS_35: {
|
|
15
15
|
authRoutes: any;
|
|
16
16
|
};
|
|
17
17
|
type __VLS_Slots = {} & {
|
|
@@ -19,9 +19,9 @@ type __VLS_Slots = {} & {
|
|
|
19
19
|
} & {
|
|
20
20
|
user?: (props: typeof __VLS_3) => any;
|
|
21
21
|
} & {
|
|
22
|
-
'authenticated-unregistered'?: (props: typeof
|
|
22
|
+
'authenticated-unregistered'?: (props: typeof __VLS_19) => any;
|
|
23
23
|
} & {
|
|
24
|
-
unauthenticated?: (props: typeof
|
|
24
|
+
unauthenticated?: (props: typeof __VLS_35) => any;
|
|
25
25
|
};
|
|
26
26
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
27
27
|
usernameLink: (user: AuthUser) => string;
|
|
@@ -6,20 +6,20 @@ type __VLS_Props = {
|
|
|
6
6
|
onSubmitRegistration?: (event: Event, username: string, error: Ref<string>, redirectUrl: string, deeplink?: string) => void;
|
|
7
7
|
id?: string;
|
|
8
8
|
};
|
|
9
|
-
declare var
|
|
9
|
+
declare var __VLS_20: {}, __VLS_27: {}, __VLS_34: {}, __VLS_41: {}, __VLS_49: {
|
|
10
10
|
error: any;
|
|
11
11
|
registrationError: any;
|
|
12
12
|
};
|
|
13
13
|
type __VLS_Slots = {} & {
|
|
14
|
-
'username-icon-loading'?: (props: typeof
|
|
14
|
+
'username-icon-loading'?: (props: typeof __VLS_20) => any;
|
|
15
15
|
} & {
|
|
16
|
-
'username-icon-valid'?: (props: typeof
|
|
16
|
+
'username-icon-valid'?: (props: typeof __VLS_27) => any;
|
|
17
17
|
} & {
|
|
18
|
-
'username-icon-invalid'?: (props: typeof
|
|
18
|
+
'username-icon-invalid'?: (props: typeof __VLS_34) => any;
|
|
19
19
|
} & {
|
|
20
|
-
default?: (props: typeof
|
|
20
|
+
default?: (props: typeof __VLS_41) => any;
|
|
21
21
|
} & {
|
|
22
|
-
error?: (props: typeof
|
|
22
|
+
error?: (props: typeof __VLS_49) => any;
|
|
23
23
|
};
|
|
24
24
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
25
25
|
debounce: number;
|
|
@@ -116,15 +116,15 @@ const props = defineProps({
|
|
|
116
116
|
body: {
|
|
117
117
|
username: username2
|
|
118
118
|
}
|
|
119
|
-
}).catch((e) => {
|
|
119
|
+
}).catch(async (e) => {
|
|
120
|
+
error2.value = `Registration Error: ${e.data.message}`;
|
|
120
121
|
if (e?.data?.code === AUTH_ERROR.USER_ALREADY_REGISTERED) {
|
|
121
122
|
useAuth().setFetchUserOnNavigation(true);
|
|
122
|
-
navigateTo(redirectUrl, { external: true });
|
|
123
|
+
await navigateTo(redirectUrl, { external: true });
|
|
123
124
|
}
|
|
124
|
-
error2.value = `Registration Error: ${e.data.message}`;
|
|
125
125
|
});
|
|
126
126
|
if (typeof res === "object" && res.redirectUrl) {
|
|
127
|
-
navigateTo(res.redirectUrl, { external: true });
|
|
127
|
+
await navigateTo(res.redirectUrl, { external: true });
|
|
128
128
|
}
|
|
129
129
|
} },
|
|
130
130
|
id: { type: String, required: false }
|
|
@@ -6,20 +6,20 @@ type __VLS_Props = {
|
|
|
6
6
|
onSubmitRegistration?: (event: Event, username: string, error: Ref<string>, redirectUrl: string, deeplink?: string) => void;
|
|
7
7
|
id?: string;
|
|
8
8
|
};
|
|
9
|
-
declare var
|
|
9
|
+
declare var __VLS_20: {}, __VLS_27: {}, __VLS_34: {}, __VLS_41: {}, __VLS_49: {
|
|
10
10
|
error: any;
|
|
11
11
|
registrationError: any;
|
|
12
12
|
};
|
|
13
13
|
type __VLS_Slots = {} & {
|
|
14
|
-
'username-icon-loading'?: (props: typeof
|
|
14
|
+
'username-icon-loading'?: (props: typeof __VLS_20) => any;
|
|
15
15
|
} & {
|
|
16
|
-
'username-icon-valid'?: (props: typeof
|
|
16
|
+
'username-icon-valid'?: (props: typeof __VLS_27) => any;
|
|
17
17
|
} & {
|
|
18
|
-
'username-icon-invalid'?: (props: typeof
|
|
18
|
+
'username-icon-invalid'?: (props: typeof __VLS_34) => any;
|
|
19
19
|
} & {
|
|
20
|
-
default?: (props: typeof
|
|
20
|
+
default?: (props: typeof __VLS_41) => any;
|
|
21
21
|
} & {
|
|
22
|
-
error?: (props: typeof
|
|
22
|
+
error?: (props: typeof __VLS_49) => any;
|
|
23
23
|
};
|
|
24
24
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
25
25
|
debounce: number;
|
|
@@ -13,10 +13,11 @@ export default defineNuxtRouteMiddleware(async (_to, _from) => {
|
|
|
13
13
|
if (import.meta.client && import.meta.dev) {
|
|
14
14
|
console.log({ ns: "auth:middleware:authGlobal", doFetch: doFetch.value, userData: userData.value });
|
|
15
15
|
}
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
if (doFetch.value) {
|
|
17
|
+
const res = await useFetch(getAuthApiRoute(useRuntimeConfig().public, "usersInfo"));
|
|
18
|
+
doFetch.value = false;
|
|
19
|
+
userData.value = res.data.value;
|
|
20
|
+
}
|
|
20
21
|
if (import.meta.client && !userData.value) {
|
|
21
22
|
const user = jsonSafeParse(localStorage.getItem("auth:user") ?? "null");
|
|
22
23
|
if (user.isOk && user.value) {
|
package/package.json
CHANGED
|
@@ -1,106 +1,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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
2
|
+
"name": "@witchcraft/nuxt-auth",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Nuxt module for logging.",
|
|
5
|
+
"repository": "witchcraftjs/nuxt-auth",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"//exports": {
|
|
10
|
+
"require in ./*": "Temporary for drizzle."
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/types.d.mts",
|
|
15
|
+
"import": "./dist/module.mjs"
|
|
16
|
+
},
|
|
17
|
+
"./*": {
|
|
18
|
+
"types": "./dist/runtime/*.d.ts",
|
|
19
|
+
"import": "./dist/runtime/*.js",
|
|
20
|
+
"require": "./dist/runtime/*.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"drizzle-orm": "^0.44.6"
|
|
28
|
+
},
|
|
29
|
+
"@comments": {
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@witchcraft/nuxt-logger": "This is only for some types for the logger, but is otherwise unused."
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@alanscodelog/tsconfigs": "^6.2.0",
|
|
36
|
+
"@alanscodelog/utils": "^6.0.2",
|
|
37
|
+
"@iconify/json": "^2.2.393",
|
|
38
|
+
"@nuxt/kit": "^4.1.3",
|
|
39
|
+
"@oslojs/crypto": "^1.0.1",
|
|
40
|
+
"@oslojs/encoding": "^1.1.0",
|
|
41
|
+
"@types/jsonwebtoken": "^9.0.10",
|
|
42
|
+
"@vueuse/core": "^13.9.0",
|
|
43
|
+
"@witchcraft/nuxt-logger": "^0.0.9",
|
|
44
|
+
"@witchcraft/ui": "^0.3.7",
|
|
45
|
+
"arctic": "^3.7.0",
|
|
46
|
+
"cookie-es": "^2.0.0",
|
|
47
|
+
"defu": "^6.1.4",
|
|
48
|
+
"h3": "1.15.4",
|
|
49
|
+
"jsonwebtoken": "^9.0.2",
|
|
50
|
+
"ms": "^2.1.3",
|
|
51
|
+
"nuxt-security": "^2.4.0",
|
|
52
|
+
"unplugin-icons": "^22.4.2",
|
|
53
|
+
"unplugin-vue-components": "^29.1.0",
|
|
54
|
+
"zod": "^4.1.12"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@alanscodelog/eslint-config": "^6.3.1",
|
|
58
|
+
"@alanscodelog/semantic-release-config": "^6.0.0",
|
|
59
|
+
"@commitlint/cli": "^20.1.0",
|
|
60
|
+
"@nuxt/eslint-config": "^1.9.0",
|
|
61
|
+
"@nuxt/module-builder": "^1.0.2",
|
|
62
|
+
"@nuxt/schema": "^4.1.3",
|
|
63
|
+
"@nuxt/test-utils": "^3.19.2",
|
|
64
|
+
"@tailwindcss/cli": "^4.1.14",
|
|
65
|
+
"@types/node": "latest",
|
|
66
|
+
"changelogen": "^0.6.2",
|
|
67
|
+
"cross-env": "^10.1.0",
|
|
68
|
+
"drizzle-orm": "^0.44.6",
|
|
69
|
+
"electron": "^38.2.2",
|
|
70
|
+
"eslint": "^9.37.0",
|
|
71
|
+
"husky": "^9.1.7",
|
|
72
|
+
"nuxt": "^4.2.1",
|
|
73
|
+
"reka-ui": "^2.5.1",
|
|
74
|
+
"tailwindcss": "^4.1.14",
|
|
75
|
+
"typescript": "^5.9.3",
|
|
76
|
+
"vitest": "^3.2.4",
|
|
77
|
+
"vue-tsc": "^3.1.1"
|
|
78
|
+
},
|
|
79
|
+
"release": {
|
|
80
|
+
"extends": [
|
|
81
|
+
"@alanscodelog/semantic-release-config"
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
"commitlint": {
|
|
85
|
+
"extends": [
|
|
86
|
+
"@alanscodelog"
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
"publishConfig": {
|
|
90
|
+
"access": "public"
|
|
91
|
+
},
|
|
92
|
+
"scripts": {
|
|
93
|
+
"build": "cross-env-shell DISABLE_POSTGRES_ENSURE_ENV=true 'nuxt-module-build prepare && nuxt-module-build build && pnpm nuxi build playground'",
|
|
94
|
+
"build:only": "nuxt-module-build build",
|
|
95
|
+
"//": "drizzle requires we run from playground",
|
|
96
|
+
"dev:playground": "cd playground && pnpm dev",
|
|
97
|
+
"dev:prepare": "cross-env-shell DISABLE_POSTGRES_ENSURE_ENV=true 'pnpm nuxt-module-build build --stub && pnpm nuxt-module-build prepare && pnpm nuxi prepare playground'",
|
|
98
|
+
"lint": "pnpm lint:eslint && pnpm lint:types && pnpm lint:commits",
|
|
99
|
+
"lint:eslint": "eslint \"{src,test,playground/app}/**/*.{ts,vue}\" \"*.{js,cjs,mjs,ts}\"",
|
|
100
|
+
"lint:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
|
|
101
|
+
"lint:commits": "commitlint --from-last-tag --to HEAD --verbose",
|
|
102
|
+
"test": "echo no tests and not working yet vitest run --exclude .direnv",
|
|
103
|
+
"test:watch": "vitest watch --exclude .direnv"
|
|
104
|
+
}
|
|
105
|
+
}
|