nuxt-users 1.6.3 → 1.6.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/cli.mjs +3 -4
  3. package/dist/module.d.mts +114 -1
  4. package/dist/module.d.ts +114 -1
  5. package/dist/module.json +1 -1
  6. package/dist/module.mjs +10 -1
  7. package/dist/runtime/middleware/auth.client.d.ts +2 -0
  8. package/dist/runtime/middleware/auth.client.js +20 -0
  9. package/dist/runtime/plugin.js +2 -47
  10. package/dist/runtime/server/api/auth/reset-password.post.js +0 -3
  11. package/dist/runtime/server/api/login.post.js +1 -1
  12. package/dist/runtime/server/api/logout.get.js +1 -1
  13. package/dist/runtime/server/api/profile.get.d.ts +1 -10
  14. package/dist/runtime/server/api/profile.get.js +2 -3
  15. package/dist/runtime/server/api/update-password.post.js +3 -2
  16. package/dist/runtime/server/middleware/auth.server.d.ts +2 -0
  17. package/dist/runtime/server/middleware/auth.server.js +31 -0
  18. package/dist/runtime/server/services/password.js +1 -1
  19. package/dist/runtime/server/utils/create-migrations-table.d.ts +2 -0
  20. package/dist/runtime/server/utils/create-migrations-table.js +35 -0
  21. package/dist/runtime/server/utils/create-password-reset-tokens-table.d.ts +2 -0
  22. package/dist/runtime/server/utils/create-password-reset-tokens-table.js +40 -0
  23. package/dist/runtime/server/utils/create-personal-access-tokens-table.d.ts +2 -0
  24. package/dist/runtime/server/utils/create-personal-access-tokens-table.js +56 -0
  25. package/dist/runtime/server/utils/create-user.d.ts +1 -0
  26. package/dist/runtime/server/utils/create-user.js +1 -0
  27. package/dist/runtime/server/utils/create-users-table.d.ts +2 -0
  28. package/dist/runtime/server/utils/create-users-table.js +47 -0
  29. package/dist/runtime/server/utils/db.d.ts +4 -0
  30. package/dist/runtime/server/utils/db.js +46 -0
  31. package/dist/runtime/server/utils/index.d.ts +7 -0
  32. package/dist/runtime/server/utils/index.js +7 -0
  33. package/dist/runtime/server/utils/migrate.d.ts +4 -0
  34. package/dist/runtime/server/utils/migrate.js +63 -0
  35. package/dist/runtime/server/utils/user.d.ts +27 -0
  36. package/dist/runtime/server/utils/user.js +99 -0
  37. package/dist/utils.d.mts +1 -42
  38. package/dist/utils.d.ts +1 -42
  39. package/dist/utils.mjs +162 -3
  40. package/package.json +2 -1
  41. package/dist/shared/nuxt-users.CMEtv_Mw.d.mts +0 -124
  42. package/dist/shared/nuxt-users.CMEtv_Mw.d.ts +0 -124
  43. package/dist/shared/nuxt-users.C_UkhLJ9.mjs +0 -531
@@ -1,124 +0,0 @@
1
- type DatabaseType = 'sqlite' | 'mysql' | 'postgresql';
2
- type DatabaseConfig = {
3
- path?: string;
4
- host?: string;
5
- port?: number;
6
- user?: string;
7
- password?: string;
8
- database?: string;
9
- };
10
- interface RuntimeModuleOptions {
11
- connector?: {
12
- name: DatabaseType;
13
- options: DatabaseConfig;
14
- };
15
- tables?: {
16
- migrations?: string;
17
- users?: string;
18
- personalAccessTokens?: string;
19
- passwordResetTokens?: string;
20
- };
21
- /**
22
- * Mailer configuration options for sending emails (e.g., password resets)
23
- * Uses nodemailer
24
- */
25
- mailer?: MailerOptions;
26
- /**
27
- * Base URL for password reset links
28
- * @default 'http://localhost:3000' // Example, will be set in module defaults
29
- */
30
- passwordResetBaseUrl?: string;
31
- /**
32
- * Skip database checks during module setup to prevent hanging
33
- * @default false
34
- */
35
- auth?: {
36
- /**
37
- * Whitelisted routes that do not require authentication
38
- * @default ['/login']
39
- * @example ['/login', '/register']
40
- */
41
- whitelist?: string[];
42
- };
43
- /**
44
- * Password validation configuration
45
- */
46
- passwordValidation?: {
47
- /**
48
- * Minimum password length
49
- * @default 8
50
- */
51
- minLength?: number;
52
- /**
53
- * Require uppercase letters
54
- * @default true
55
- */
56
- requireUppercase?: boolean;
57
- /**
58
- * Require lowercase letters
59
- * @default true
60
- */
61
- requireLowercase?: boolean;
62
- /**
63
- * Require numbers
64
- * @default true
65
- */
66
- requireNumbers?: boolean;
67
- /**
68
- * Require special characters
69
- * @default true
70
- */
71
- requireSpecialChars?: boolean;
72
- /**
73
- * Prevent common passwords
74
- * @default true
75
- */
76
- preventCommonPasswords?: boolean;
77
- };
78
- }
79
- interface ModuleOptions extends Omit<RuntimeModuleOptions, 'tables' | 'auth' | 'passwordValidation'> {
80
- connector: {
81
- name: DatabaseType;
82
- options: DatabaseConfig;
83
- };
84
- tables: {
85
- migrations: string;
86
- users: string;
87
- personalAccessTokens: string;
88
- passwordResetTokens: string;
89
- };
90
- auth: {
91
- whitelist: string[];
92
- };
93
- passwordValidation: {
94
- minLength: number;
95
- requireUppercase: boolean;
96
- requireLowercase: boolean;
97
- requireNumbers: boolean;
98
- requireSpecialChars: boolean;
99
- preventCommonPasswords: boolean;
100
- };
101
- }
102
- interface MailerOptions {
103
- host: string;
104
- port: number;
105
- secure?: boolean;
106
- auth: {
107
- user: string;
108
- pass: string;
109
- };
110
- defaults?: {
111
- from: string;
112
- };
113
- }
114
- interface User {
115
- id: number;
116
- email: string;
117
- name: string;
118
- password: string;
119
- role: string;
120
- created_at: string;
121
- updated_at: string;
122
- }
123
-
124
- export type { ModuleOptions as M, User as U };
@@ -1,124 +0,0 @@
1
- type DatabaseType = 'sqlite' | 'mysql' | 'postgresql';
2
- type DatabaseConfig = {
3
- path?: string;
4
- host?: string;
5
- port?: number;
6
- user?: string;
7
- password?: string;
8
- database?: string;
9
- };
10
- interface RuntimeModuleOptions {
11
- connector?: {
12
- name: DatabaseType;
13
- options: DatabaseConfig;
14
- };
15
- tables?: {
16
- migrations?: string;
17
- users?: string;
18
- personalAccessTokens?: string;
19
- passwordResetTokens?: string;
20
- };
21
- /**
22
- * Mailer configuration options for sending emails (e.g., password resets)
23
- * Uses nodemailer
24
- */
25
- mailer?: MailerOptions;
26
- /**
27
- * Base URL for password reset links
28
- * @default 'http://localhost:3000' // Example, will be set in module defaults
29
- */
30
- passwordResetBaseUrl?: string;
31
- /**
32
- * Skip database checks during module setup to prevent hanging
33
- * @default false
34
- */
35
- auth?: {
36
- /**
37
- * Whitelisted routes that do not require authentication
38
- * @default ['/login']
39
- * @example ['/login', '/register']
40
- */
41
- whitelist?: string[];
42
- };
43
- /**
44
- * Password validation configuration
45
- */
46
- passwordValidation?: {
47
- /**
48
- * Minimum password length
49
- * @default 8
50
- */
51
- minLength?: number;
52
- /**
53
- * Require uppercase letters
54
- * @default true
55
- */
56
- requireUppercase?: boolean;
57
- /**
58
- * Require lowercase letters
59
- * @default true
60
- */
61
- requireLowercase?: boolean;
62
- /**
63
- * Require numbers
64
- * @default true
65
- */
66
- requireNumbers?: boolean;
67
- /**
68
- * Require special characters
69
- * @default true
70
- */
71
- requireSpecialChars?: boolean;
72
- /**
73
- * Prevent common passwords
74
- * @default true
75
- */
76
- preventCommonPasswords?: boolean;
77
- };
78
- }
79
- interface ModuleOptions extends Omit<RuntimeModuleOptions, 'tables' | 'auth' | 'passwordValidation'> {
80
- connector: {
81
- name: DatabaseType;
82
- options: DatabaseConfig;
83
- };
84
- tables: {
85
- migrations: string;
86
- users: string;
87
- personalAccessTokens: string;
88
- passwordResetTokens: string;
89
- };
90
- auth: {
91
- whitelist: string[];
92
- };
93
- passwordValidation: {
94
- minLength: number;
95
- requireUppercase: boolean;
96
- requireLowercase: boolean;
97
- requireNumbers: boolean;
98
- requireSpecialChars: boolean;
99
- preventCommonPasswords: boolean;
100
- };
101
- }
102
- interface MailerOptions {
103
- host: string;
104
- port: number;
105
- secure?: boolean;
106
- auth: {
107
- user: string;
108
- pass: string;
109
- };
110
- defaults?: {
111
- from: string;
112
- };
113
- }
114
- interface User {
115
- id: number;
116
- email: string;
117
- name: string;
118
- password: string;
119
- role: string;
120
- created_at: string;
121
- updated_at: string;
122
- }
123
-
124
- export type { ModuleOptions as M, User as U };