@riffdb/better-auth 0.2.0 → 0.2.1
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/DESIGN.md +90 -14
- package/README.md +157 -25
- package/dist/adapter.d.ts +7 -1
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +385 -47
- package/dist/adapter.js.map +1 -1
- package/dist/generated/client.d.ts +267 -26
- package/dist/generated/client.d.ts.map +1 -1
- package/dist/generated/client.js +479 -69
- package/dist/generated/client.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/plugin-dispatch.d.ts +37 -0
- package/dist/plugin-dispatch.d.ts.map +1 -0
- package/dist/plugin-dispatch.js +293 -0
- package/dist/plugin-dispatch.js.map +1 -0
- package/dist/profile-contract.d.ts +3 -0
- package/dist/profile-contract.d.ts.map +1 -1
- package/dist/profile-contract.js +8 -0
- package/dist/profile-contract.js.map +1 -1
- package/dist/profile-plan.js +1 -1
- package/dist/profile-plan.js.map +1 -1
- package/dist/profile.d.ts +2 -1
- package/dist/profile.d.ts.map +1 -1
- package/dist/profile.js +2 -1
- package/dist/profile.js.map +1 -1
- package/dist/profiles/custom-fields/profile.d.ts +3 -0
- package/dist/profiles/custom-fields/profile.d.ts.map +1 -0
- package/dist/profiles/custom-fields/profile.js +475 -0
- package/dist/profiles/custom-fields/profile.js.map +1 -0
- package/dist/profiles/custom-fields/src/generated/client.d.ts +2710 -0
- package/dist/profiles/custom-fields/src/generated/client.d.ts.map +1 -0
- package/dist/profiles/custom-fields/src/generated/client.js +2663 -0
- package/dist/profiles/custom-fields/src/generated/client.js.map +1 -0
- package/dist/profiles/runtime/profile.d.ts +3 -0
- package/dist/profiles/runtime/profile.d.ts.map +1 -0
- package/dist/profiles/runtime/profile.js +1065 -0
- package/dist/profiles/runtime/profile.js.map +1 -0
- package/dist/profiles/runtime/src/generated/client.d.ts +4274 -0
- package/dist/profiles/runtime/src/generated/client.d.ts.map +1 -0
- package/dist/profiles/runtime/src/generated/client.js +4607 -0
- package/dist/profiles/runtime/src/generated/client.js.map +1 -0
- package/dist/runtime-materialize.d.ts +10 -0
- package/dist/runtime-materialize.d.ts.map +1 -0
- package/dist/runtime-materialize.js +344 -0
- package/dist/runtime-materialize.js.map +1 -0
- package/dist/runtime-profile.d.ts +34 -0
- package/dist/runtime-profile.d.ts.map +1 -0
- package/dist/runtime-profile.js +203 -0
- package/dist/runtime-profile.js.map +1 -0
- package/generated/go/client.go +350 -96
- package/generated/mcp/tools.json +3338 -1768
- package/generated/python/client.py +603 -26
- package/generated/riffdb.application.exact.json +1 -1
- package/generated/riffdb.contract.bundle +0 -0
- package/generated/rust/client.rs +522 -26
- package/package.json +34 -13
- package/profiles/custom-fields/generated/go/client.go +2578 -0
- package/profiles/custom-fields/generated/mcp/tools.json +15998 -0
- package/profiles/custom-fields/generated/python/client.py +5141 -0
- package/profiles/custom-fields/generated/riffdb.application.exact.json +1 -0
- package/profiles/custom-fields/generated/riffdb.contract.bundle +0 -0
- package/profiles/custom-fields/generated/rust/client.rs +7980 -0
- package/profiles/custom-fields/profile.ts +474 -0
- package/profiles/custom-fields/riffdb/contract.riff +568 -0
- package/profiles/custom-fields/riffdb/queries/admin_users_all_email_asc.riffq +24 -0
- package/profiles/custom-fields/riffdb/queries/admin_users_contains_asc.riffq +24 -0
- package/profiles/custom-fields/riffdb/queries/admin_users_contains_desc.riffq +24 -0
- package/profiles/custom-fields/riffdb/queries/admin_users_email_contains_created_desc.riffq +24 -0
- package/profiles/custom-fields/riffdb/queries/admin_users_email_contains_image_asc.riffq +24 -0
- package/profiles/custom-fields/riffdb/queries/admin_users_ends_with_asc.riffq +24 -0
- package/profiles/custom-fields/riffdb/queries/admin_users_ends_with_desc.riffq +24 -0
- package/profiles/custom-fields/riffdb/queries/admin_users_starts_with_asc.riffq +24 -0
- package/profiles/custom-fields/riffdb/queries/admin_users_starts_with_desc.riffq +24 -0
- package/profiles/custom-fields/riffdb/queries/find_account_by_id.riffq +24 -0
- package/profiles/custom-fields/riffdb/queries/find_account_by_provider.riffq +26 -0
- package/profiles/custom-fields/riffdb/queries/find_accounts_by_user_id.riffq +25 -0
- package/profiles/custom-fields/riffdb/queries/find_accounts_by_user_provider.riffq +27 -0
- package/profiles/custom-fields/riffdb/queries/find_active_sessions_by_user_id.riffq +23 -0
- package/profiles/custom-fields/riffdb/queries/find_credential_account.riffq +25 -0
- package/profiles/custom-fields/riffdb/queries/find_expired_verification_ids.riffq +17 -0
- package/profiles/custom-fields/riffdb/queries/find_latest_verification.riffq +20 -0
- package/profiles/custom-fields/riffdb/queries/find_session_by_id.riffq +20 -0
- package/profiles/custom-fields/riffdb/queries/find_session_by_token.riffq +20 -0
- package/profiles/custom-fields/riffdb/queries/find_sessions_by_token_set.riffq +20 -0
- package/profiles/custom-fields/riffdb/queries/find_sessions_by_user_id.riffq +21 -0
- package/profiles/custom-fields/riffdb/queries/find_user_by_email.riffq +16 -0
- package/profiles/custom-fields/riffdb/queries/find_user_by_id.riffq +15 -0
- package/profiles/custom-fields/riffdb/queries/find_verification_by_id.riffq +19 -0
- package/profiles/custom-fields/riffdb/queries/find_verifications_by_identifier.riffq +21 -0
- package/profiles/custom-fields/riffdb/queries/profile_account_with_user_by_provider.riffq +31 -0
- package/profiles/custom-fields/riffdb/queries/profile_session_with_user_by_id.riffq +14 -0
- package/profiles/custom-fields/riffdb/queries/profile_session_with_user_by_token.riffq +14 -0
- package/profiles/custom-fields/riffdb/queries/profile_sessions_with_users_by_token_set.riffq +25 -0
- package/profiles/custom-fields/riffdb/queries/profile_user_with_accounts_by_email.riffq +19 -0
- package/profiles/custom-fields/riffdb/queries/profile_user_with_accounts_by_id.riffq +19 -0
- package/profiles/custom-fields/riffdb.application.json +217 -0
- package/profiles/custom-fields/riffdb.application.lock.json +1 -0
- package/profiles/custom-fields/riffdb.toml +3 -0
- package/profiles/custom-fields/src/generated/client.ts +3096 -0
- package/profiles/organization-security/materialization.json +3 -0
- package/profiles/organization-security/riffdb/contract.riff +12 -0
- package/profiles/organization-security/riffdb/queries/find_team_by_id.riffq +1 -1
- package/profiles/organization-security/riffdb/queries/find_team_member_by_id.riffq +1 -1
- package/profiles/organization-security/riffdb/queries/find_team_member_by_membership_key.riffq +16 -0
- package/profiles/organization-security/riffdb/queries/find_team_member_by_team_id.riffq +1 -1
- package/profiles/organization-security/riffdb.application.json +5 -0
- package/profiles/organization-security.profile.json +27 -1
- package/profiles/runtime/generated/go/client.go +4511 -0
- package/profiles/runtime/generated/mcp/tools.json +30004 -0
- package/profiles/runtime/generated/python/client.py +9337 -0
- package/profiles/runtime/generated/riffdb.application.exact.json +1 -0
- package/profiles/runtime/generated/riffdb.contract.bundle +0 -0
- package/profiles/runtime/generated/rust/client.rs +13297 -0
- package/profiles/runtime/profile.ts +1064 -0
- package/profiles/runtime/riffdb/contract.riff +1053 -0
- package/profiles/runtime/riffdb/queries/admin_users_all_email_asc.riffq +24 -0
- package/profiles/runtime/riffdb/queries/admin_users_contains_asc.riffq +24 -0
- package/profiles/runtime/riffdb/queries/admin_users_contains_desc.riffq +24 -0
- package/profiles/runtime/riffdb/queries/admin_users_email_contains_created_desc.riffq +24 -0
- package/profiles/runtime/riffdb/queries/admin_users_email_contains_image_asc.riffq +24 -0
- package/profiles/runtime/riffdb/queries/admin_users_ends_with_asc.riffq +24 -0
- package/profiles/runtime/riffdb/queries/admin_users_ends_with_desc.riffq +24 -0
- package/profiles/runtime/riffdb/queries/admin_users_starts_with_asc.riffq +24 -0
- package/profiles/runtime/riffdb/queries/admin_users_starts_with_desc.riffq +24 -0
- package/profiles/runtime/riffdb/queries/find_account_by_id.riffq +24 -0
- package/profiles/runtime/riffdb/queries/find_account_by_provider.riffq +26 -0
- package/profiles/runtime/riffdb/queries/find_accounts_by_user_id.riffq +25 -0
- package/profiles/runtime/riffdb/queries/find_accounts_by_user_provider.riffq +27 -0
- package/profiles/runtime/riffdb/queries/find_active_sessions_by_user_id.riffq +23 -0
- package/profiles/runtime/riffdb/queries/find_credential_account.riffq +25 -0
- package/profiles/runtime/riffdb/queries/find_expired_verification_ids.riffq +17 -0
- package/profiles/runtime/riffdb/queries/find_latest_verification.riffq +20 -0
- package/profiles/runtime/riffdb/queries/find_session_by_id.riffq +20 -0
- package/profiles/runtime/riffdb/queries/find_session_by_token.riffq +20 -0
- package/profiles/runtime/riffdb/queries/find_sessions_by_token_set.riffq +20 -0
- package/profiles/runtime/riffdb/queries/find_sessions_by_user_id.riffq +21 -0
- package/profiles/runtime/riffdb/queries/find_user_by_email.riffq +16 -0
- package/profiles/runtime/riffdb/queries/find_user_by_id.riffq +15 -0
- package/profiles/runtime/riffdb/queries/find_verification_by_id.riffq +19 -0
- package/profiles/runtime/riffdb/queries/find_verifications_by_identifier.riffq +21 -0
- package/profiles/runtime/riffdb/queries/profile_account_with_user_by_provider.riffq +31 -0
- package/profiles/runtime/riffdb/queries/profile_invitation_by_email.riffq +17 -0
- package/profiles/runtime/riffdb/queries/profile_invitation_by_id.riffq +17 -0
- package/profiles/runtime/riffdb/queries/profile_invitation_by_organization_email_status.riffq +19 -0
- package/profiles/runtime/riffdb/queries/profile_invitation_by_organization_id.riffq +17 -0
- package/profiles/runtime/riffdb/queries/profile_invitation_by_organization_status.riffq +18 -0
- package/profiles/runtime/riffdb/queries/profile_member_by_id.riffq +27 -0
- package/profiles/runtime/riffdb/queries/profile_member_by_organization.riffq +20 -0
- package/profiles/runtime/riffdb/queries/profile_member_by_organization_created_at_asc.riffq +20 -0
- package/profiles/runtime/riffdb/queries/profile_member_by_organization_created_at_desc.riffq +20 -0
- package/profiles/runtime/riffdb/queries/profile_member_by_organization_role_asc.riffq +20 -0
- package/profiles/runtime/riffdb/queries/profile_member_by_organization_role_desc.riffq +20 -0
- package/profiles/runtime/riffdb/queries/profile_member_by_organization_user.riffq +28 -0
- package/profiles/runtime/riffdb/queries/profile_member_by_user.riffq +27 -0
- package/profiles/runtime/riffdb/queries/profile_organization_by_id.riffq +27 -0
- package/profiles/runtime/riffdb/queries/profile_organization_by_slug.riffq +27 -0
- package/profiles/runtime/riffdb/queries/profile_session_with_user_by_id.riffq +14 -0
- package/profiles/runtime/riffdb/queries/profile_session_with_user_by_token.riffq +14 -0
- package/profiles/runtime/riffdb/queries/profile_sessions_with_users_by_token_set.riffq +25 -0
- package/profiles/runtime/riffdb/queries/profile_two_factor_by_id.riffq +17 -0
- package/profiles/runtime/riffdb/queries/profile_two_factor_by_user.riffq +17 -0
- package/profiles/runtime/riffdb/queries/profile_user_with_accounts_by_email.riffq +19 -0
- package/profiles/runtime/riffdb/queries/profile_user_with_accounts_by_id.riffq +19 -0
- package/profiles/runtime/riffdb/queries/profile_users_by_id_set.riffq +8 -0
- package/profiles/runtime/riffdb.application.json +324 -0
- package/profiles/runtime/riffdb.application.lock.json +1 -0
- package/profiles/runtime/riffdb.toml +3 -0
- package/profiles/runtime/src/generated/client.ts +5186 -0
- package/riffdb/contract.riff +58 -0
- package/riffdb/queries/find_credential_account.riffq +25 -0
- package/riffdb.application.json +106 -26
- package/riffdb.application.lock.json +1 -1
- package/src/generated/client.ts +2746 -0
|
@@ -84,6 +84,7 @@ contract BetterAuthOrganizationSecurity version 1 {
|
|
|
84
84
|
entity Team {
|
|
85
85
|
key (tenant_id: uuid, organization_id: uuid, team_id: uuid)
|
|
86
86
|
field created_at: timestamp
|
|
87
|
+
field secret member_count: i64
|
|
87
88
|
field name: string<2048>
|
|
88
89
|
field updated_at: optional<timestamp>
|
|
89
90
|
field revision: u64
|
|
@@ -95,8 +96,11 @@ contract BetterAuthOrganizationSecurity version 1 {
|
|
|
95
96
|
entity TeamMember {
|
|
96
97
|
key (tenant_id: uuid, user_id: uuid, team_member_id: uuid)
|
|
97
98
|
field created_at: optional<timestamp>
|
|
99
|
+
field secret membership_key: string<2048>
|
|
98
100
|
field team_id: uuid
|
|
99
101
|
field revision: u64
|
|
102
|
+
unique team_member_membership_key (tenant_id, membership_key)
|
|
103
|
+
index by_membership_key (tenant_id, membership_key, user_id, team_member_id)
|
|
100
104
|
index by_team_id (tenant_id, team_id, user_id, team_member_id)
|
|
101
105
|
index by_parent (tenant_id, user_id, team_member_id)
|
|
102
106
|
reference team_member_parent (tenant_id, user_id) -> User(tenant_id, user_id)
|
|
@@ -500,12 +504,14 @@ contract BetterAuthOrganizationSecurity version 1 {
|
|
|
500
504
|
input organization_id: uuid
|
|
501
505
|
input team_id: uuid
|
|
502
506
|
input created_at: timestamp
|
|
507
|
+
input member_count: i64
|
|
503
508
|
input name: string<2048>
|
|
504
509
|
input updated_at: optional<timestamp>
|
|
505
510
|
idempotency_key request_id
|
|
506
511
|
read Organization(tenant_id, organization_id) as organization else TeamParentMissing {}
|
|
507
512
|
create Team(tenant_id, organization_id, team_id) as team else TeamAlreadyExists {}
|
|
508
513
|
set team.created_at = created_at
|
|
514
|
+
set team.member_count = member_count
|
|
509
515
|
set team.name = name
|
|
510
516
|
set team.updated_at = updated_at
|
|
511
517
|
set team.revision = 1
|
|
@@ -519,12 +525,14 @@ contract BetterAuthOrganizationSecurity version 1 {
|
|
|
519
525
|
input team_id: uuid
|
|
520
526
|
input expected_revision: u64
|
|
521
527
|
input created_at: timestamp
|
|
528
|
+
input member_count: i64
|
|
522
529
|
input name: string<2048>
|
|
523
530
|
input updated_at: optional<timestamp>
|
|
524
531
|
idempotency_key request_id
|
|
525
532
|
mutate Team(tenant_id, organization_id, team_id) as team else TeamUpdateMissing {}
|
|
526
533
|
require current_revision: team.revision == expected_revision else TeamUpdateStale {}
|
|
527
534
|
set team.created_at = created_at checked_by current_revision
|
|
535
|
+
set team.member_count = member_count checked_by current_revision
|
|
528
536
|
set team.name = name checked_by current_revision
|
|
529
537
|
set team.updated_at = updated_at checked_by current_revision
|
|
530
538
|
set team.revision = team.revision + 1
|
|
@@ -549,11 +557,13 @@ contract BetterAuthOrganizationSecurity version 1 {
|
|
|
549
557
|
input user_id: uuid
|
|
550
558
|
input team_member_id: uuid
|
|
551
559
|
input created_at: optional<timestamp>
|
|
560
|
+
input membership_key: string<2048>
|
|
552
561
|
input team_id: uuid
|
|
553
562
|
idempotency_key request_id
|
|
554
563
|
read User(tenant_id, user_id) as user else TeamMemberParentMissing {}
|
|
555
564
|
create TeamMember(tenant_id, user_id, team_member_id) as team_member else TeamMemberAlreadyExists {}
|
|
556
565
|
set team_member.created_at = created_at
|
|
566
|
+
set team_member.membership_key = membership_key
|
|
557
567
|
set team_member.team_id = team_id
|
|
558
568
|
set team_member.revision = 1
|
|
559
569
|
return TeamMemberCreated {}
|
|
@@ -566,11 +576,13 @@ contract BetterAuthOrganizationSecurity version 1 {
|
|
|
566
576
|
input team_member_id: uuid
|
|
567
577
|
input expected_revision: u64
|
|
568
578
|
input created_at: optional<timestamp>
|
|
579
|
+
input membership_key: string<2048>
|
|
569
580
|
input team_id: uuid
|
|
570
581
|
idempotency_key request_id
|
|
571
582
|
mutate TeamMember(tenant_id, user_id, team_member_id) as team_member else TeamMemberUpdateMissing {}
|
|
572
583
|
require current_revision: team_member.revision == expected_revision else TeamMemberUpdateStale {}
|
|
573
584
|
set team_member.created_at = created_at checked_by current_revision
|
|
585
|
+
set team_member.membership_key = membership_key checked_by current_revision
|
|
574
586
|
set team_member.team_id = team_id checked_by current_revision
|
|
575
587
|
set team_member.revision = team_member.revision + 1
|
|
576
588
|
return TeamMemberUpdated {}
|
|
@@ -11,7 +11,7 @@ query FindTeamById(
|
|
|
11
11
|
take 1
|
|
12
12
|
|
|
13
13
|
return Found {
|
|
14
|
-
teams: teams { organization_id team_id created_at name updated_at revision }
|
|
14
|
+
teams: teams { organization_id team_id created_at member_count reveals teams.member_count name updated_at revision }
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
outcomes Found
|
|
@@ -11,7 +11,7 @@ query FindTeamMemberById(
|
|
|
11
11
|
take 1
|
|
12
12
|
|
|
13
13
|
return Found {
|
|
14
|
-
team_members: team_members { user_id team_member_id created_at team_id revision }
|
|
14
|
+
team_members: team_members { user_id team_member_id created_at membership_key reveals team_members.membership_key team_id revision }
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
outcomes Found
|
package/profiles/organization-security/riffdb/queries/find_team_member_by_membership_key.riffq
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
query FindTeamMemberByMembershipKey(
|
|
2
|
+
$tenant_id: TeamMember.tenant_id,
|
|
3
|
+
$membership_key: TeamMember.membership_key,
|
|
4
|
+
) {
|
|
5
|
+
many team_members from TeamMember
|
|
6
|
+
where tenant_id == $tenant_id
|
|
7
|
+
&& membership_key == $membership_key
|
|
8
|
+
order by user_id asc, team_member_id asc
|
|
9
|
+
take 1
|
|
10
|
+
|
|
11
|
+
return Found {
|
|
12
|
+
team_members: team_members { user_id team_member_id created_at membership_key reveals team_members.membership_key team_id revision }
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
outcomes Found
|
|
16
|
+
}
|
|
@@ -10,7 +10,7 @@ query FindTeamMemberByTeamId(
|
|
|
10
10
|
take 50 after $after
|
|
11
11
|
|
|
12
12
|
return Found {
|
|
13
|
-
team_members: team_members { user_id team_member_id created_at team_id revision }
|
|
13
|
+
team_members: team_members { user_id team_member_id created_at membership_key reveals team_members.membership_key team_id revision }
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
outcomes Found
|
|
@@ -67,6 +67,10 @@
|
|
|
67
67
|
"name": "FindTeamMemberById",
|
|
68
68
|
"source": "riffdb/queries/find_team_member_by_id.riffq"
|
|
69
69
|
},
|
|
70
|
+
{
|
|
71
|
+
"name": "FindTeamMemberByMembershipKey",
|
|
72
|
+
"source": "riffdb/queries/find_team_member_by_membership_key.riffq"
|
|
73
|
+
},
|
|
70
74
|
{
|
|
71
75
|
"name": "FindTeamMemberByTeamId",
|
|
72
76
|
"source": "riffdb/queries/find_team_member_by_team_id.riffq"
|
|
@@ -117,6 +121,7 @@
|
|
|
117
121
|
"FindSessionByToken",
|
|
118
122
|
"FindTeamById",
|
|
119
123
|
"FindTeamMemberById",
|
|
124
|
+
"FindTeamMemberByMembershipKey",
|
|
120
125
|
"FindTeamMemberByTeamId",
|
|
121
126
|
"FindTwoFactorById",
|
|
122
127
|
"FindTwoFactorBySecret",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "riffdb.better-auth-profile-plan/v1",
|
|
3
|
-
"betterAuthVersion": "1.
|
|
3
|
+
"betterAuthVersion": "1.7.18",
|
|
4
4
|
"idGeneration": "uuid",
|
|
5
5
|
"name": "BetterAuthOrganizationSecurity",
|
|
6
6
|
"contract": {
|
|
@@ -579,6 +579,19 @@
|
|
|
579
579
|
"hasDefault": false,
|
|
580
580
|
"hasOnUpdate": false
|
|
581
581
|
},
|
|
582
|
+
{
|
|
583
|
+
"name": "memberCount",
|
|
584
|
+
"storageName": "memberCount",
|
|
585
|
+
"type": "number",
|
|
586
|
+
"required": true,
|
|
587
|
+
"unique": false,
|
|
588
|
+
"indexed": false,
|
|
589
|
+
"secret": true,
|
|
590
|
+
"input": false,
|
|
591
|
+
"returned": false,
|
|
592
|
+
"hasDefault": true,
|
|
593
|
+
"hasOnUpdate": false
|
|
594
|
+
},
|
|
582
595
|
{
|
|
583
596
|
"name": "name",
|
|
584
597
|
"storageName": "name",
|
|
@@ -641,6 +654,19 @@
|
|
|
641
654
|
"hasDefault": false,
|
|
642
655
|
"hasOnUpdate": false
|
|
643
656
|
},
|
|
657
|
+
{
|
|
658
|
+
"name": "membershipKey",
|
|
659
|
+
"storageName": "membershipKey",
|
|
660
|
+
"type": "string",
|
|
661
|
+
"required": false,
|
|
662
|
+
"unique": true,
|
|
663
|
+
"indexed": false,
|
|
664
|
+
"secret": true,
|
|
665
|
+
"input": false,
|
|
666
|
+
"returned": false,
|
|
667
|
+
"hasDefault": false,
|
|
668
|
+
"hasOnUpdate": false
|
|
669
|
+
},
|
|
644
670
|
{
|
|
645
671
|
"name": "teamId",
|
|
646
672
|
"storageName": "teamId",
|