@riffdb/better-auth 0.0.0-stage → 0.2.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.
Files changed (91) hide show
  1. package/DESIGN.md +197 -0
  2. package/LICENSE-APACHE +201 -0
  3. package/LICENSE-MIT +27 -0
  4. package/README.md +191 -2
  5. package/dist/adapter.d.ts +28 -0
  6. package/dist/adapter.d.ts.map +1 -0
  7. package/dist/adapter.js +1262 -0
  8. package/dist/adapter.js.map +1 -0
  9. package/dist/generated/client.d.ts +1925 -0
  10. package/dist/generated/client.d.ts.map +1 -0
  11. package/dist/generated/client.js +2044 -0
  12. package/dist/generated/client.js.map +1 -0
  13. package/dist/index.d.ts +5 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +5 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/profile-contract.d.ts +60 -0
  18. package/dist/profile-contract.d.ts.map +1 -0
  19. package/dist/profile-contract.js +535 -0
  20. package/dist/profile-contract.js.map +1 -0
  21. package/dist/profile-plan.d.ts +69 -0
  22. package/dist/profile-plan.d.ts.map +1 -0
  23. package/dist/profile-plan.js +180 -0
  24. package/dist/profile-plan.js.map +1 -0
  25. package/dist/profile.d.ts +47 -0
  26. package/dist/profile.d.ts.map +1 -0
  27. package/dist/profile.js +131 -0
  28. package/dist/profile.js.map +1 -0
  29. package/dist/testing.d.ts +11 -0
  30. package/dist/testing.d.ts.map +1 -0
  31. package/dist/testing.js +12 -0
  32. package/dist/testing.js.map +1 -0
  33. package/generated/go/client.go +1996 -0
  34. package/generated/mcp/tools.json +12352 -0
  35. package/generated/python/client.py +3877 -0
  36. package/generated/riffdb.application.exact.json +1 -0
  37. package/generated/riffdb.contract.bundle +0 -0
  38. package/generated/rust/client.rs +6028 -0
  39. package/package.json +62 -4
  40. package/profiles/organization-security/materialization.json +48 -0
  41. package/profiles/organization-security/riffdb/contract.riff +766 -0
  42. package/profiles/organization-security/riffdb/queries/find_account_by_id.riffq +18 -0
  43. package/profiles/organization-security/riffdb/queries/find_invitation_by_email.riffq +17 -0
  44. package/profiles/organization-security/riffdb/queries/find_invitation_by_id.riffq +18 -0
  45. package/profiles/organization-security/riffdb/queries/find_invitation_by_organization_id.riffq +17 -0
  46. package/profiles/organization-security/riffdb/queries/find_member_by_id.riffq +18 -0
  47. package/profiles/organization-security/riffdb/queries/find_member_by_user_id.riffq +17 -0
  48. package/profiles/organization-security/riffdb/queries/find_organization_by_id.riffq +16 -0
  49. package/profiles/organization-security/riffdb/queries/find_organization_by_slug.riffq +16 -0
  50. package/profiles/organization-security/riffdb/queries/find_session_by_id.riffq +18 -0
  51. package/profiles/organization-security/riffdb/queries/find_session_by_token.riffq +16 -0
  52. package/profiles/organization-security/riffdb/queries/find_team_by_id.riffq +18 -0
  53. package/profiles/organization-security/riffdb/queries/find_team_member_by_id.riffq +18 -0
  54. package/profiles/organization-security/riffdb/queries/find_team_member_by_team_id.riffq +17 -0
  55. package/profiles/organization-security/riffdb/queries/find_two_factor_by_id.riffq +18 -0
  56. package/profiles/organization-security/riffdb/queries/find_two_factor_by_secret.riffq +17 -0
  57. package/profiles/organization-security/riffdb/queries/find_user_by_email.riffq +16 -0
  58. package/profiles/organization-security/riffdb/queries/find_user_by_id.riffq +16 -0
  59. package/profiles/organization-security/riffdb/queries/find_verification_by_id.riffq +16 -0
  60. package/profiles/organization-security/riffdb/queries/find_verification_by_identifier.riffq +17 -0
  61. package/profiles/organization-security/riffdb.application.json +167 -0
  62. package/profiles/organization-security/riffdb.toml +7 -0
  63. package/profiles/organization-security.profile.json +954 -0
  64. package/riffdb/contract.riff +489 -0
  65. package/riffdb/queries/admin_users_all_email_asc.riffq +24 -0
  66. package/riffdb/queries/admin_users_contains_asc.riffq +24 -0
  67. package/riffdb/queries/admin_users_contains_desc.riffq +24 -0
  68. package/riffdb/queries/admin_users_email_contains_created_desc.riffq +24 -0
  69. package/riffdb/queries/admin_users_email_contains_image_asc.riffq +24 -0
  70. package/riffdb/queries/admin_users_ends_with_asc.riffq +24 -0
  71. package/riffdb/queries/admin_users_ends_with_desc.riffq +24 -0
  72. package/riffdb/queries/admin_users_starts_with_asc.riffq +24 -0
  73. package/riffdb/queries/admin_users_starts_with_desc.riffq +24 -0
  74. package/riffdb/queries/find_account_by_id.riffq +24 -0
  75. package/riffdb/queries/find_account_by_provider.riffq +26 -0
  76. package/riffdb/queries/find_accounts_by_user_id.riffq +25 -0
  77. package/riffdb/queries/find_accounts_by_user_provider.riffq +27 -0
  78. package/riffdb/queries/find_active_sessions_by_user_id.riffq +23 -0
  79. package/riffdb/queries/find_expired_verification_ids.riffq +17 -0
  80. package/riffdb/queries/find_latest_verification.riffq +20 -0
  81. package/riffdb/queries/find_session_by_id.riffq +20 -0
  82. package/riffdb/queries/find_session_by_token.riffq +20 -0
  83. package/riffdb/queries/find_sessions_by_token_set.riffq +20 -0
  84. package/riffdb/queries/find_sessions_by_user_id.riffq +21 -0
  85. package/riffdb/queries/find_user_by_email.riffq +16 -0
  86. package/riffdb/queries/find_user_by_id.riffq +15 -0
  87. package/riffdb/queries/find_verification_by_id.riffq +19 -0
  88. package/riffdb/queries/find_verifications_by_identifier.riffq +21 -0
  89. package/riffdb.application.json +107 -0
  90. package/riffdb.application.lock.json +1 -0
  91. package/scripts/real-riffdb-runner.mjs +333 -0
@@ -0,0 +1,18 @@
1
+ query FindAccountById(
2
+ $tenant_id: Account.tenant_id,
3
+ $user_id: Account.user_id,
4
+ $account_row_id: Account.account_row_id,
5
+ ) {
6
+ many accounts from Account
7
+ where tenant_id == $tenant_id
8
+ && user_id == $user_id
9
+ && account_row_id == $account_row_id
10
+ order by account_row_id asc
11
+ take 1
12
+
13
+ return Found {
14
+ accounts: accounts { user_id account_row_id access_token reveals accounts.access_token access_token_expires_at reveals accounts.access_token_expires_at account_id created_at id_token reveals accounts.id_token password reveals accounts.password provider_id refresh_token reveals accounts.refresh_token refresh_token_expires_at reveals accounts.refresh_token_expires_at scope updated_at revision }
15
+ }
16
+
17
+ outcomes Found
18
+ }
@@ -0,0 +1,17 @@
1
+ query FindInvitationByEmail(
2
+ $tenant_id: Invitation.tenant_id,
3
+ $email: Invitation.email,
4
+ $after: Cursor?,
5
+ ) {
6
+ many invitations from Invitation
7
+ where tenant_id == $tenant_id
8
+ && email == $email
9
+ order by user_id asc, invitation_id asc
10
+ take 50 after $after
11
+
12
+ return Found {
13
+ invitations: invitations { user_id invitation_id created_at email expires_at organization_id role status team_id revision }
14
+ }
15
+
16
+ outcomes Found
17
+ }
@@ -0,0 +1,18 @@
1
+ query FindInvitationById(
2
+ $tenant_id: Invitation.tenant_id,
3
+ $user_id: Invitation.user_id,
4
+ $invitation_id: Invitation.invitation_id,
5
+ ) {
6
+ many invitations from Invitation
7
+ where tenant_id == $tenant_id
8
+ && user_id == $user_id
9
+ && invitation_id == $invitation_id
10
+ order by invitation_id asc
11
+ take 1
12
+
13
+ return Found {
14
+ invitations: invitations { user_id invitation_id created_at email expires_at organization_id role status team_id revision }
15
+ }
16
+
17
+ outcomes Found
18
+ }
@@ -0,0 +1,17 @@
1
+ query FindInvitationByOrganizationId(
2
+ $tenant_id: Invitation.tenant_id,
3
+ $organization_id: Invitation.organization_id,
4
+ $after: Cursor?,
5
+ ) {
6
+ many invitations from Invitation
7
+ where tenant_id == $tenant_id
8
+ && organization_id == $organization_id
9
+ order by user_id asc, invitation_id asc
10
+ take 50 after $after
11
+
12
+ return Found {
13
+ invitations: invitations { user_id invitation_id created_at email expires_at organization_id role status team_id revision }
14
+ }
15
+
16
+ outcomes Found
17
+ }
@@ -0,0 +1,18 @@
1
+ query FindMemberById(
2
+ $tenant_id: Member.tenant_id,
3
+ $organization_id: Member.organization_id,
4
+ $member_id: Member.member_id,
5
+ ) {
6
+ many members from Member
7
+ where tenant_id == $tenant_id
8
+ && organization_id == $organization_id
9
+ && member_id == $member_id
10
+ order by member_id asc
11
+ take 1
12
+
13
+ return Found {
14
+ members: members { organization_id member_id created_at role user_id revision }
15
+ }
16
+
17
+ outcomes Found
18
+ }
@@ -0,0 +1,17 @@
1
+ query FindMemberByUserId(
2
+ $tenant_id: Member.tenant_id,
3
+ $user_id: Member.user_id,
4
+ $after: Cursor?,
5
+ ) {
6
+ many members from Member
7
+ where tenant_id == $tenant_id
8
+ && user_id == $user_id
9
+ order by organization_id asc, member_id asc
10
+ take 50 after $after
11
+
12
+ return Found {
13
+ members: members { organization_id member_id created_at role user_id revision }
14
+ }
15
+
16
+ outcomes Found
17
+ }
@@ -0,0 +1,16 @@
1
+ query FindOrganizationById(
2
+ $tenant_id: Organization.tenant_id,
3
+ $organization_id: Organization.organization_id,
4
+ ) {
5
+ many organizations from Organization
6
+ where tenant_id == $tenant_id
7
+ && organization_id == $organization_id
8
+ order by organization_id asc
9
+ take 1
10
+
11
+ return Found {
12
+ organizations: organizations { organization_id created_at logo metadata name slug revision }
13
+ }
14
+
15
+ outcomes Found
16
+ }
@@ -0,0 +1,16 @@
1
+ query FindOrganizationBySlug(
2
+ $tenant_id: Organization.tenant_id,
3
+ $slug: Organization.slug,
4
+ ) {
5
+ many organizations from Organization
6
+ where tenant_id == $tenant_id
7
+ && slug == $slug
8
+ order by organization_id asc
9
+ take 1
10
+
11
+ return Found {
12
+ organizations: organizations { organization_id created_at logo metadata name slug revision }
13
+ }
14
+
15
+ outcomes Found
16
+ }
@@ -0,0 +1,18 @@
1
+ query FindSessionById(
2
+ $tenant_id: Session.tenant_id,
3
+ $user_id: Session.user_id,
4
+ $session_id: Session.session_id,
5
+ ) {
6
+ many sessions from Session
7
+ where tenant_id == $tenant_id
8
+ && user_id == $user_id
9
+ && session_id == $session_id
10
+ order by session_id asc
11
+ take 1
12
+
13
+ return Found {
14
+ sessions: sessions { user_id session_id active_organization_id active_team_id created_at expires_at ip_address token reveals sessions.token updated_at user_agent revision }
15
+ }
16
+
17
+ outcomes Found
18
+ }
@@ -0,0 +1,16 @@
1
+ query FindSessionByToken(
2
+ $tenant_id: Session.tenant_id,
3
+ $token: Session.token,
4
+ ) {
5
+ many sessions from Session
6
+ where tenant_id == $tenant_id
7
+ && token == $token
8
+ order by user_id asc, session_id asc
9
+ take 1
10
+
11
+ return Found {
12
+ sessions: sessions { user_id session_id active_organization_id active_team_id created_at expires_at ip_address token reveals sessions.token updated_at user_agent revision }
13
+ }
14
+
15
+ outcomes Found
16
+ }
@@ -0,0 +1,18 @@
1
+ query FindTeamById(
2
+ $tenant_id: Team.tenant_id,
3
+ $organization_id: Team.organization_id,
4
+ $team_id: Team.team_id,
5
+ ) {
6
+ many teams from Team
7
+ where tenant_id == $tenant_id
8
+ && organization_id == $organization_id
9
+ && team_id == $team_id
10
+ order by team_id asc
11
+ take 1
12
+
13
+ return Found {
14
+ teams: teams { organization_id team_id created_at name updated_at revision }
15
+ }
16
+
17
+ outcomes Found
18
+ }
@@ -0,0 +1,18 @@
1
+ query FindTeamMemberById(
2
+ $tenant_id: TeamMember.tenant_id,
3
+ $user_id: TeamMember.user_id,
4
+ $team_member_id: TeamMember.team_member_id,
5
+ ) {
6
+ many team_members from TeamMember
7
+ where tenant_id == $tenant_id
8
+ && user_id == $user_id
9
+ && team_member_id == $team_member_id
10
+ order by team_member_id asc
11
+ take 1
12
+
13
+ return Found {
14
+ team_members: team_members { user_id team_member_id created_at team_id revision }
15
+ }
16
+
17
+ outcomes Found
18
+ }
@@ -0,0 +1,17 @@
1
+ query FindTeamMemberByTeamId(
2
+ $tenant_id: TeamMember.tenant_id,
3
+ $team_id: TeamMember.team_id,
4
+ $after: Cursor?,
5
+ ) {
6
+ many team_members from TeamMember
7
+ where tenant_id == $tenant_id
8
+ && team_id == $team_id
9
+ order by user_id asc, team_member_id asc
10
+ take 50 after $after
11
+
12
+ return Found {
13
+ team_members: team_members { user_id team_member_id created_at team_id revision }
14
+ }
15
+
16
+ outcomes Found
17
+ }
@@ -0,0 +1,18 @@
1
+ query FindTwoFactorById(
2
+ $tenant_id: TwoFactor.tenant_id,
3
+ $user_id: TwoFactor.user_id,
4
+ $two_factor_id: TwoFactor.two_factor_id,
5
+ ) {
6
+ many two_factors from TwoFactor
7
+ where tenant_id == $tenant_id
8
+ && user_id == $user_id
9
+ && two_factor_id == $two_factor_id
10
+ order by two_factor_id asc
11
+ take 1
12
+
13
+ return Found {
14
+ two_factors: two_factors { user_id two_factor_id backup_codes reveals two_factors.backup_codes failed_verification_count reveals two_factors.failed_verification_count locked_until reveals two_factors.locked_until secret reveals two_factors.secret verified revision }
15
+ }
16
+
17
+ outcomes Found
18
+ }
@@ -0,0 +1,17 @@
1
+ query FindTwoFactorBySecret(
2
+ $tenant_id: TwoFactor.tenant_id,
3
+ $secret: TwoFactor.secret,
4
+ $after: Cursor?,
5
+ ) {
6
+ many two_factors from TwoFactor
7
+ where tenant_id == $tenant_id
8
+ && secret == $secret
9
+ order by user_id asc, two_factor_id asc
10
+ take 50 after $after
11
+
12
+ return Found {
13
+ two_factors: two_factors { user_id two_factor_id backup_codes reveals two_factors.backup_codes failed_verification_count reveals two_factors.failed_verification_count locked_until reveals two_factors.locked_until secret reveals two_factors.secret verified revision }
14
+ }
15
+
16
+ outcomes Found
17
+ }
@@ -0,0 +1,16 @@
1
+ query FindUserByEmail(
2
+ $tenant_id: User.tenant_id,
3
+ $email: User.email,
4
+ ) {
5
+ many users from User
6
+ where tenant_id == $tenant_id
7
+ && email == $email
8
+ order by user_id asc
9
+ take 1
10
+
11
+ return Found {
12
+ users: users { user_id created_at email email_verified image locale name two_factor_enabled updated_at revision }
13
+ }
14
+
15
+ outcomes Found
16
+ }
@@ -0,0 +1,16 @@
1
+ query FindUserById(
2
+ $tenant_id: User.tenant_id,
3
+ $user_id: User.user_id,
4
+ ) {
5
+ many users from User
6
+ where tenant_id == $tenant_id
7
+ && user_id == $user_id
8
+ order by user_id asc
9
+ take 1
10
+
11
+ return Found {
12
+ users: users { user_id created_at email email_verified image locale name two_factor_enabled updated_at revision }
13
+ }
14
+
15
+ outcomes Found
16
+ }
@@ -0,0 +1,16 @@
1
+ query FindVerificationById(
2
+ $tenant_id: Verification.tenant_id,
3
+ $verification_id: Verification.verification_id,
4
+ ) {
5
+ many verifications from Verification
6
+ where tenant_id == $tenant_id
7
+ && verification_id == $verification_id
8
+ order by verification_id asc
9
+ take 1
10
+
11
+ return Found {
12
+ verifications: verifications { verification_id created_at expires_at identifier updated_at value reveals verifications.value revision }
13
+ }
14
+
15
+ outcomes Found
16
+ }
@@ -0,0 +1,17 @@
1
+ query FindVerificationByIdentifier(
2
+ $tenant_id: Verification.tenant_id,
3
+ $identifier: Verification.identifier,
4
+ $after: Cursor?,
5
+ ) {
6
+ many verifications from Verification
7
+ where tenant_id == $tenant_id
8
+ && identifier == $identifier
9
+ order by verification_id asc
10
+ take 50 after $after
11
+
12
+ return Found {
13
+ verifications: verifications { verification_id created_at expires_at identifier updated_at value reveals verifications.value revision }
14
+ }
15
+
16
+ outcomes Found
17
+ }
@@ -0,0 +1,167 @@
1
+ {
2
+ "schema": "riffdb.application-source/v6",
3
+ "application": "better-auth-organization-security",
4
+ "contract": {
5
+ "source": "riffdb/contract.riff",
6
+ "lineage": "BetterAuthOrganizationSecurity",
7
+ "version": 1
8
+ },
9
+ "generation": {
10
+ "go": "generated/go/client.go",
11
+ "mcp": "generated/mcp/tools.json",
12
+ "python": "generated/python/client.py",
13
+ "rust": "generated/rust/client.rs",
14
+ "typescript": "src/generated/client.ts"
15
+ },
16
+ "migrations": [],
17
+ "query_modules": [
18
+ {
19
+ "name": "better_auth_organization_security",
20
+ "version": 1,
21
+ "queries": [
22
+ {
23
+ "name": "FindAccountById",
24
+ "source": "riffdb/queries/find_account_by_id.riffq"
25
+ },
26
+ {
27
+ "name": "FindInvitationById",
28
+ "source": "riffdb/queries/find_invitation_by_id.riffq"
29
+ },
30
+ {
31
+ "name": "FindInvitationByEmail",
32
+ "source": "riffdb/queries/find_invitation_by_email.riffq"
33
+ },
34
+ {
35
+ "name": "FindInvitationByOrganizationId",
36
+ "source": "riffdb/queries/find_invitation_by_organization_id.riffq"
37
+ },
38
+ {
39
+ "name": "FindMemberById",
40
+ "source": "riffdb/queries/find_member_by_id.riffq"
41
+ },
42
+ {
43
+ "name": "FindMemberByUserId",
44
+ "source": "riffdb/queries/find_member_by_user_id.riffq"
45
+ },
46
+ {
47
+ "name": "FindOrganizationById",
48
+ "source": "riffdb/queries/find_organization_by_id.riffq"
49
+ },
50
+ {
51
+ "name": "FindOrganizationBySlug",
52
+ "source": "riffdb/queries/find_organization_by_slug.riffq"
53
+ },
54
+ {
55
+ "name": "FindSessionById",
56
+ "source": "riffdb/queries/find_session_by_id.riffq"
57
+ },
58
+ {
59
+ "name": "FindSessionByToken",
60
+ "source": "riffdb/queries/find_session_by_token.riffq"
61
+ },
62
+ {
63
+ "name": "FindTeamById",
64
+ "source": "riffdb/queries/find_team_by_id.riffq"
65
+ },
66
+ {
67
+ "name": "FindTeamMemberById",
68
+ "source": "riffdb/queries/find_team_member_by_id.riffq"
69
+ },
70
+ {
71
+ "name": "FindTeamMemberByTeamId",
72
+ "source": "riffdb/queries/find_team_member_by_team_id.riffq"
73
+ },
74
+ {
75
+ "name": "FindTwoFactorById",
76
+ "source": "riffdb/queries/find_two_factor_by_id.riffq"
77
+ },
78
+ {
79
+ "name": "FindTwoFactorBySecret",
80
+ "source": "riffdb/queries/find_two_factor_by_secret.riffq"
81
+ },
82
+ {
83
+ "name": "FindUserById",
84
+ "source": "riffdb/queries/find_user_by_id.riffq"
85
+ },
86
+ {
87
+ "name": "FindUserByEmail",
88
+ "source": "riffdb/queries/find_user_by_email.riffq"
89
+ },
90
+ {
91
+ "name": "FindVerificationById",
92
+ "source": "riffdb/queries/find_verification_by_id.riffq"
93
+ },
94
+ {
95
+ "name": "FindVerificationByIdentifier",
96
+ "source": "riffdb/queries/find_verification_by_identifier.riffq"
97
+ }
98
+ ]
99
+ }
100
+ ],
101
+ "reactive_modules": [],
102
+ "roles": [
103
+ {
104
+ "name": "BetterAuthServer",
105
+ "environment": "development",
106
+ "tenant_scope": "global",
107
+ "queries": [
108
+ "FindAccountById",
109
+ "FindInvitationById",
110
+ "FindInvitationByEmail",
111
+ "FindInvitationByOrganizationId",
112
+ "FindMemberById",
113
+ "FindMemberByUserId",
114
+ "FindOrganizationById",
115
+ "FindOrganizationBySlug",
116
+ "FindSessionById",
117
+ "FindSessionByToken",
118
+ "FindTeamById",
119
+ "FindTeamMemberById",
120
+ "FindTeamMemberByTeamId",
121
+ "FindTwoFactorById",
122
+ "FindTwoFactorBySecret",
123
+ "FindUserById",
124
+ "FindUserByEmail",
125
+ "FindVerificationById",
126
+ "FindVerificationByIdentifier"
127
+ ],
128
+ "commands": [
129
+ "CreateAccount",
130
+ "UpdateAccount",
131
+ "DeleteAccount",
132
+ "CreateInvitation",
133
+ "UpdateInvitation",
134
+ "DeleteInvitation",
135
+ "CreateMember",
136
+ "UpdateMember",
137
+ "DeleteMember",
138
+ "CreateOrganization",
139
+ "UpdateOrganization",
140
+ "DeleteOrganization",
141
+ "CreateSession",
142
+ "UpdateSession",
143
+ "DeleteSession",
144
+ "CreateTeam",
145
+ "UpdateTeam",
146
+ "DeleteTeam",
147
+ "CreateTeamMember",
148
+ "UpdateTeamMember",
149
+ "DeleteTeamMember",
150
+ "CreateTwoFactor",
151
+ "UpdateTwoFactor",
152
+ "DeleteTwoFactor",
153
+ "CreateUser",
154
+ "UpdateUser",
155
+ "DeleteUser",
156
+ "CreateVerification",
157
+ "UpdateVerification",
158
+ "DeleteVerification"
159
+ ],
160
+ "event_streams": [],
161
+ "watch_queries": [],
162
+ "agent_subscriptions": [],
163
+ "row_policies": []
164
+ }
165
+ ],
166
+ "seed_inputs": []
167
+ }
@@ -0,0 +1,7 @@
1
+ [client]
2
+ endpoint = "http://127.0.0.1:7443"
3
+ database = "better-auth-development"
4
+
5
+ [project]
6
+ schema = "riffdb.application.json"
7
+ generators = []