@objectstack/plugin-auth 4.0.3 → 4.0.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 (40) hide show
  1. package/README.md +4 -1
  2. package/dist/index.d.mts +345 -19928
  3. package/dist/index.d.ts +345 -19928
  4. package/dist/index.js +411 -857
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +415 -837
  7. package/dist/index.mjs.map +1 -1
  8. package/package.json +35 -12
  9. package/.turbo/turbo-build.log +0 -78
  10. package/ARCHITECTURE.md +0 -176
  11. package/CHANGELOG.md +0 -325
  12. package/IMPLEMENTATION_SUMMARY.md +0 -192
  13. package/examples/basic-usage.ts +0 -107
  14. package/objectstack.config.ts +0 -24
  15. package/src/auth-manager.test.ts +0 -758
  16. package/src/auth-manager.ts +0 -338
  17. package/src/auth-plugin.test.ts +0 -443
  18. package/src/auth-plugin.ts +0 -292
  19. package/src/auth-schema-config.ts +0 -339
  20. package/src/index.ts +0 -16
  21. package/src/objectql-adapter.test.ts +0 -281
  22. package/src/objectql-adapter.ts +0 -279
  23. package/src/objects/auth-account.object.ts +0 -7
  24. package/src/objects/auth-session.object.ts +0 -7
  25. package/src/objects/auth-user.object.ts +0 -7
  26. package/src/objects/auth-verification.object.ts +0 -7
  27. package/src/objects/index.ts +0 -40
  28. package/src/objects/sys-account.object.ts +0 -111
  29. package/src/objects/sys-api-key.object.ts +0 -104
  30. package/src/objects/sys-invitation.object.ts +0 -93
  31. package/src/objects/sys-member.object.ts +0 -68
  32. package/src/objects/sys-organization.object.ts +0 -82
  33. package/src/objects/sys-session.object.ts +0 -84
  34. package/src/objects/sys-team-member.object.ts +0 -61
  35. package/src/objects/sys-team.object.ts +0 -69
  36. package/src/objects/sys-two-factor.object.ts +0 -73
  37. package/src/objects/sys-user-preference.object.ts +0 -82
  38. package/src/objects/sys-user.object.ts +0 -91
  39. package/src/objects/sys-verification.object.ts +0 -75
  40. package/tsconfig.json +0 -18
@@ -1,73 +0,0 @@
1
- // Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
2
-
3
- import { ObjectSchema, Field } from '@objectstack/spec/data';
4
-
5
- /**
6
- * sys_two_factor — System Two-Factor Object
7
- *
8
- * Two-factor authentication credentials (TOTP, backup codes).
9
- * Backed by better-auth's two-factor plugin.
10
- *
11
- * @namespace sys
12
- */
13
- export const SysTwoFactor = ObjectSchema.create({
14
- namespace: 'sys',
15
- name: 'two_factor',
16
- label: 'Two Factor',
17
- pluralLabel: 'Two Factor Credentials',
18
- icon: 'smartphone',
19
- isSystem: true,
20
- description: 'Two-factor authentication credentials',
21
- titleFormat: 'Two-factor for {user_id}',
22
- compactLayout: ['user_id', 'created_at'],
23
-
24
- fields: {
25
- id: Field.text({
26
- label: 'Two Factor ID',
27
- required: true,
28
- readonly: true,
29
- }),
30
-
31
- created_at: Field.datetime({
32
- label: 'Created At',
33
- defaultValue: 'NOW()',
34
- readonly: true,
35
- }),
36
-
37
- updated_at: Field.datetime({
38
- label: 'Updated At',
39
- defaultValue: 'NOW()',
40
- readonly: true,
41
- }),
42
-
43
- user_id: Field.text({
44
- label: 'User ID',
45
- required: true,
46
- }),
47
-
48
- secret: Field.text({
49
- label: 'Secret',
50
- required: true,
51
- description: 'TOTP secret key',
52
- }),
53
-
54
- backup_codes: Field.textarea({
55
- label: 'Backup Codes',
56
- required: false,
57
- description: 'JSON-serialized backup recovery codes',
58
- }),
59
- },
60
-
61
- indexes: [
62
- { fields: ['user_id'], unique: true },
63
- ],
64
-
65
- enable: {
66
- trackHistory: false,
67
- searchable: false,
68
- apiEnabled: true,
69
- apiMethods: ['get', 'create', 'update', 'delete'],
70
- trash: false,
71
- mru: false,
72
- },
73
- });
@@ -1,82 +0,0 @@
1
- // Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
2
-
3
- import { ObjectSchema, Field } from '@objectstack/spec/data';
4
-
5
- /**
6
- * sys_user_preference — System User Preference Object
7
- *
8
- * Per-user key-value preferences for storing UI state, settings, and personalization.
9
- * Supports the User Preferences layer in the Config Resolution hierarchy
10
- * (Runtime > User Preferences > Tenant > Env).
11
- *
12
- * Common use cases:
13
- * - UI preferences: theme, locale, timezone, sidebar state
14
- * - Feature flags: plugin.ai.auto_save, plugin.dev.debug_mode
15
- * - User-specific settings: default_view, notifications_enabled
16
- *
17
- * @namespace sys
18
- */
19
- export const SysUserPreference = ObjectSchema.create({
20
- namespace: 'sys',
21
- name: 'user_preference',
22
- label: 'User Preference',
23
- pluralLabel: 'User Preferences',
24
- icon: 'settings',
25
- isSystem: true,
26
- description: 'Per-user key-value preferences (theme, locale, etc.)',
27
- titleFormat: '{key}',
28
- compactLayout: ['user_id', 'key'],
29
-
30
- fields: {
31
- id: Field.text({
32
- label: 'Preference ID',
33
- required: true,
34
- readonly: true,
35
- }),
36
-
37
- created_at: Field.datetime({
38
- label: 'Created At',
39
- defaultValue: 'NOW()',
40
- readonly: true,
41
- }),
42
-
43
- updated_at: Field.datetime({
44
- label: 'Updated At',
45
- defaultValue: 'NOW()',
46
- readonly: true,
47
- }),
48
-
49
- user_id: Field.text({
50
- label: 'User ID',
51
- required: true,
52
- maxLength: 255,
53
- description: 'Owner user of this preference',
54
- }),
55
-
56
- key: Field.text({
57
- label: 'Key',
58
- required: true,
59
- maxLength: 255,
60
- description: 'Preference key (e.g., theme, locale, plugin.ai.auto_save)',
61
- }),
62
-
63
- value: Field.json({
64
- label: 'Value',
65
- description: 'Preference value (any JSON-serializable type)',
66
- }),
67
- },
68
-
69
- indexes: [
70
- { fields: ['user_id', 'key'], unique: true },
71
- { fields: ['user_id'], unique: false },
72
- ],
73
-
74
- enable: {
75
- trackHistory: false,
76
- searchable: false,
77
- apiEnabled: true,
78
- apiMethods: ['get', 'list', 'create', 'update', 'delete'],
79
- trash: false,
80
- mru: false,
81
- },
82
- });
@@ -1,91 +0,0 @@
1
- // Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
2
-
3
- import { ObjectSchema, Field } from '@objectstack/spec/data';
4
-
5
- /**
6
- * sys_user — System User Object
7
- *
8
- * Canonical user identity record for the ObjectStack platform.
9
- * Backed by better-auth's `user` model with ObjectStack field conventions.
10
- *
11
- * @namespace sys
12
- */
13
- export const SysUser = ObjectSchema.create({
14
- namespace: 'sys',
15
- name: 'user',
16
- label: 'User',
17
- pluralLabel: 'Users',
18
- icon: 'user',
19
- isSystem: true,
20
- description: 'User accounts for authentication',
21
- titleFormat: '{name} ({email})',
22
- compactLayout: ['name', 'email', 'email_verified'],
23
-
24
- fields: {
25
- id: Field.text({
26
- label: 'User ID',
27
- required: true,
28
- readonly: true,
29
- }),
30
-
31
- created_at: Field.datetime({
32
- label: 'Created At',
33
- defaultValue: 'NOW()',
34
- readonly: true,
35
- }),
36
-
37
- updated_at: Field.datetime({
38
- label: 'Updated At',
39
- defaultValue: 'NOW()',
40
- readonly: true,
41
- }),
42
-
43
- email: Field.email({
44
- label: 'Email',
45
- required: true,
46
- searchable: true,
47
- }),
48
-
49
- email_verified: Field.boolean({
50
- label: 'Email Verified',
51
- defaultValue: false,
52
- }),
53
-
54
- name: Field.text({
55
- label: 'Name',
56
- required: true,
57
- searchable: true,
58
- maxLength: 255,
59
- }),
60
-
61
- image: Field.url({
62
- label: 'Profile Image',
63
- required: false,
64
- }),
65
- },
66
-
67
- indexes: [
68
- { fields: ['email'], unique: true },
69
- { fields: ['created_at'], unique: false },
70
- ],
71
-
72
- enable: {
73
- trackHistory: true,
74
- searchable: true,
75
- apiEnabled: true,
76
- apiMethods: ['get', 'list', 'create', 'update', 'delete'],
77
- trash: true,
78
- mru: true,
79
- },
80
-
81
- validations: [
82
- {
83
- name: 'email_unique',
84
- type: 'unique',
85
- severity: 'error',
86
- message: 'Email must be unique',
87
- fields: ['email'],
88
- caseSensitive: false,
89
- },
90
- ],
91
- });
@@ -1,75 +0,0 @@
1
- // Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
2
-
3
- import { ObjectSchema, Field } from '@objectstack/spec/data';
4
-
5
- /**
6
- * sys_verification — System Verification Object
7
- *
8
- * Email and phone verification token record.
9
- * Backed by better-auth's `verification` model with ObjectStack field conventions.
10
- *
11
- * @namespace sys
12
- */
13
- export const SysVerification = ObjectSchema.create({
14
- namespace: 'sys',
15
- name: 'verification',
16
- label: 'Verification',
17
- pluralLabel: 'Verifications',
18
- icon: 'shield-check',
19
- isSystem: true,
20
- description: 'Email and phone verification tokens',
21
- titleFormat: 'Verification for {identifier}',
22
- compactLayout: ['identifier', 'expires_at', 'created_at'],
23
-
24
- fields: {
25
- id: Field.text({
26
- label: 'Verification ID',
27
- required: true,
28
- readonly: true,
29
- }),
30
-
31
- created_at: Field.datetime({
32
- label: 'Created At',
33
- defaultValue: 'NOW()',
34
- readonly: true,
35
- }),
36
-
37
- updated_at: Field.datetime({
38
- label: 'Updated At',
39
- defaultValue: 'NOW()',
40
- readonly: true,
41
- }),
42
-
43
- value: Field.text({
44
- label: 'Verification Token',
45
- required: true,
46
- description: 'Token or code for verification',
47
- }),
48
-
49
- expires_at: Field.datetime({
50
- label: 'Expires At',
51
- required: true,
52
- }),
53
-
54
- identifier: Field.text({
55
- label: 'Identifier',
56
- required: true,
57
- description: 'Email address or phone number',
58
- }),
59
- },
60
-
61
- indexes: [
62
- { fields: ['value'], unique: true },
63
- { fields: ['identifier'], unique: false },
64
- { fields: ['expires_at'], unique: false },
65
- ],
66
-
67
- enable: {
68
- trackHistory: false,
69
- searchable: false,
70
- apiEnabled: true,
71
- apiMethods: ['get', 'create', 'delete'],
72
- trash: false,
73
- mru: false,
74
- },
75
- });
package/tsconfig.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "extends": "../../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./dist",
5
- "rootDir": "./src",
6
- "types": [
7
- "node"
8
- ]
9
- },
10
- "include": [
11
- "src/**/*"
12
- ],
13
- "exclude": [
14
- "dist",
15
- "node_modules",
16
- "**/*.test.ts"
17
- ]
18
- }