@objectstack/plugin-auth 3.0.1 → 3.0.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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +8 -0
- package/dist/index.d.mts +22 -22
- package/dist/index.d.ts +22 -22
- package/dist/index.js +33 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -33
- package/dist/index.mjs.map +1 -1
- package/objectstack.config.ts +24 -0
- package/package.json +9 -5
- package/src/objects/auth-account.object.ts +24 -24
- package/src/objects/auth-session.object.ts +15 -15
- package/src/objects/auth-user.object.ts +8 -8
- package/src/objects/auth-verification.object.ts +8 -8
|
@@ -7,13 +7,13 @@ import { ObjectSchema, Field } from '@objectstack/spec/data';
|
|
|
7
7
|
*
|
|
8
8
|
* Uses better-auth's native schema for seamless migration:
|
|
9
9
|
* - id: string
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
13
|
-
* -
|
|
10
|
+
* - created_at: Date
|
|
11
|
+
* - updated_at: Date
|
|
12
|
+
* - user_id: string
|
|
13
|
+
* - expires_at: Date
|
|
14
14
|
* - token: string
|
|
15
|
-
* -
|
|
16
|
-
* -
|
|
15
|
+
* - ip_address: string | null
|
|
16
|
+
* - user_agent: string | null
|
|
17
17
|
*/
|
|
18
18
|
export const AuthSession = ObjectSchema.create({
|
|
19
19
|
name: 'session',
|
|
@@ -22,7 +22,7 @@ export const AuthSession = ObjectSchema.create({
|
|
|
22
22
|
icon: 'key',
|
|
23
23
|
description: 'Active user sessions',
|
|
24
24
|
titleFormat: 'Session {token}',
|
|
25
|
-
compactLayout: ['
|
|
25
|
+
compactLayout: ['user_id', 'expires_at', 'ip_address'],
|
|
26
26
|
|
|
27
27
|
fields: {
|
|
28
28
|
id: Field.text({
|
|
@@ -31,24 +31,24 @@ export const AuthSession = ObjectSchema.create({
|
|
|
31
31
|
readonly: true,
|
|
32
32
|
}),
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
created_at: Field.datetime({
|
|
35
35
|
label: 'Created At',
|
|
36
36
|
defaultValue: 'NOW()',
|
|
37
37
|
readonly: true,
|
|
38
38
|
}),
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
updated_at: Field.datetime({
|
|
41
41
|
label: 'Updated At',
|
|
42
42
|
defaultValue: 'NOW()',
|
|
43
43
|
readonly: true,
|
|
44
44
|
}),
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
user_id: Field.text({
|
|
47
47
|
label: 'User ID',
|
|
48
48
|
required: true,
|
|
49
49
|
}),
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
expires_at: Field.datetime({
|
|
52
52
|
label: 'Expires At',
|
|
53
53
|
required: true,
|
|
54
54
|
}),
|
|
@@ -58,13 +58,13 @@ export const AuthSession = ObjectSchema.create({
|
|
|
58
58
|
required: true,
|
|
59
59
|
}),
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
ip_address: Field.text({
|
|
62
62
|
label: 'IP Address',
|
|
63
63
|
required: false,
|
|
64
64
|
maxLength: 45, // Support IPv6
|
|
65
65
|
}),
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
user_agent: Field.textarea({
|
|
68
68
|
label: 'User Agent',
|
|
69
69
|
required: false,
|
|
70
70
|
}),
|
|
@@ -73,8 +73,8 @@ export const AuthSession = ObjectSchema.create({
|
|
|
73
73
|
// Database indexes for performance
|
|
74
74
|
indexes: [
|
|
75
75
|
{ fields: ['token'], unique: true },
|
|
76
|
-
{ fields: ['
|
|
77
|
-
{ fields: ['
|
|
76
|
+
{ fields: ['user_id'], unique: false },
|
|
77
|
+
{ fields: ['expires_at'], unique: false },
|
|
78
78
|
],
|
|
79
79
|
|
|
80
80
|
// Enable features
|
|
@@ -7,10 +7,10 @@ import { ObjectSchema, Field } from '@objectstack/spec/data';
|
|
|
7
7
|
*
|
|
8
8
|
* Uses better-auth's native schema for seamless migration:
|
|
9
9
|
* - id: string
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
10
|
+
* - created_at: Date
|
|
11
|
+
* - updated_at: Date
|
|
12
12
|
* - email: string (unique, lowercase)
|
|
13
|
-
* -
|
|
13
|
+
* - email_verified: boolean
|
|
14
14
|
* - name: string
|
|
15
15
|
* - image: string | null
|
|
16
16
|
*/
|
|
@@ -21,7 +21,7 @@ export const AuthUser = ObjectSchema.create({
|
|
|
21
21
|
icon: 'user',
|
|
22
22
|
description: 'User accounts for authentication',
|
|
23
23
|
titleFormat: '{name} ({email})',
|
|
24
|
-
compactLayout: ['name', 'email', '
|
|
24
|
+
compactLayout: ['name', 'email', 'email_verified'],
|
|
25
25
|
|
|
26
26
|
fields: {
|
|
27
27
|
// ID is auto-generated by ObjectQL
|
|
@@ -31,13 +31,13 @@ export const AuthUser = ObjectSchema.create({
|
|
|
31
31
|
readonly: true,
|
|
32
32
|
}),
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
created_at: Field.datetime({
|
|
35
35
|
label: 'Created At',
|
|
36
36
|
defaultValue: 'NOW()',
|
|
37
37
|
readonly: true,
|
|
38
38
|
}),
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
updated_at: Field.datetime({
|
|
41
41
|
label: 'Updated At',
|
|
42
42
|
defaultValue: 'NOW()',
|
|
43
43
|
readonly: true,
|
|
@@ -49,7 +49,7 @@ export const AuthUser = ObjectSchema.create({
|
|
|
49
49
|
searchable: true,
|
|
50
50
|
}),
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
email_verified: Field.boolean({
|
|
53
53
|
label: 'Email Verified',
|
|
54
54
|
defaultValue: false,
|
|
55
55
|
}),
|
|
@@ -70,7 +70,7 @@ export const AuthUser = ObjectSchema.create({
|
|
|
70
70
|
// Database indexes for performance
|
|
71
71
|
indexes: [
|
|
72
72
|
{ fields: ['email'], unique: true },
|
|
73
|
-
{ fields: ['
|
|
73
|
+
{ fields: ['created_at'], unique: false },
|
|
74
74
|
],
|
|
75
75
|
|
|
76
76
|
// Enable features
|
|
@@ -7,10 +7,10 @@ import { ObjectSchema, Field } from '@objectstack/spec/data';
|
|
|
7
7
|
*
|
|
8
8
|
* Uses better-auth's native schema for seamless migration:
|
|
9
9
|
* - id: string
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
10
|
+
* - created_at: Date
|
|
11
|
+
* - updated_at: Date
|
|
12
12
|
* - value: string (verification token/code)
|
|
13
|
-
* -
|
|
13
|
+
* - expires_at: Date
|
|
14
14
|
* - identifier: string (email or phone number)
|
|
15
15
|
*/
|
|
16
16
|
export const AuthVerification = ObjectSchema.create({
|
|
@@ -20,7 +20,7 @@ export const AuthVerification = ObjectSchema.create({
|
|
|
20
20
|
icon: 'shield-check',
|
|
21
21
|
description: 'Email and phone verification tokens',
|
|
22
22
|
titleFormat: 'Verification for {identifier}',
|
|
23
|
-
compactLayout: ['identifier', '
|
|
23
|
+
compactLayout: ['identifier', 'expires_at', 'created_at'],
|
|
24
24
|
|
|
25
25
|
fields: {
|
|
26
26
|
id: Field.text({
|
|
@@ -29,13 +29,13 @@ export const AuthVerification = ObjectSchema.create({
|
|
|
29
29
|
readonly: true,
|
|
30
30
|
}),
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
created_at: Field.datetime({
|
|
33
33
|
label: 'Created At',
|
|
34
34
|
defaultValue: 'NOW()',
|
|
35
35
|
readonly: true,
|
|
36
36
|
}),
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
updated_at: Field.datetime({
|
|
39
39
|
label: 'Updated At',
|
|
40
40
|
defaultValue: 'NOW()',
|
|
41
41
|
readonly: true,
|
|
@@ -47,7 +47,7 @@ export const AuthVerification = ObjectSchema.create({
|
|
|
47
47
|
description: 'Token or code for verification',
|
|
48
48
|
}),
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
expires_at: Field.datetime({
|
|
51
51
|
label: 'Expires At',
|
|
52
52
|
required: true,
|
|
53
53
|
}),
|
|
@@ -63,7 +63,7 @@ export const AuthVerification = ObjectSchema.create({
|
|
|
63
63
|
indexes: [
|
|
64
64
|
{ fields: ['value'], unique: true },
|
|
65
65
|
{ fields: ['identifier'], unique: false },
|
|
66
|
-
{ fields: ['
|
|
66
|
+
{ fields: ['expires_at'], unique: false },
|
|
67
67
|
],
|
|
68
68
|
|
|
69
69
|
// Enable features
|