@riffdb/better-auth 0.0.0-stage → 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.
Files changed (226) hide show
  1. package/DESIGN.md +273 -0
  2. package/LICENSE-APACHE +201 -0
  3. package/LICENSE-MIT +27 -0
  4. package/README.md +323 -2
  5. package/dist/adapter.d.ts +34 -0
  6. package/dist/adapter.d.ts.map +1 -0
  7. package/dist/adapter.js +1600 -0
  8. package/dist/adapter.js.map +1 -0
  9. package/dist/generated/client.d.ts +2166 -0
  10. package/dist/generated/client.d.ts.map +1 -0
  11. package/dist/generated/client.js +2454 -0
  12. package/dist/generated/client.js.map +1 -0
  13. package/dist/index.d.ts +7 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +7 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/plugin-dispatch.d.ts +37 -0
  18. package/dist/plugin-dispatch.d.ts.map +1 -0
  19. package/dist/plugin-dispatch.js +293 -0
  20. package/dist/plugin-dispatch.js.map +1 -0
  21. package/dist/profile-contract.d.ts +63 -0
  22. package/dist/profile-contract.d.ts.map +1 -0
  23. package/dist/profile-contract.js +543 -0
  24. package/dist/profile-contract.js.map +1 -0
  25. package/dist/profile-plan.d.ts +69 -0
  26. package/dist/profile-plan.d.ts.map +1 -0
  27. package/dist/profile-plan.js +180 -0
  28. package/dist/profile-plan.js.map +1 -0
  29. package/dist/profile.d.ts +48 -0
  30. package/dist/profile.d.ts.map +1 -0
  31. package/dist/profile.js +132 -0
  32. package/dist/profile.js.map +1 -0
  33. package/dist/profiles/custom-fields/profile.d.ts +3 -0
  34. package/dist/profiles/custom-fields/profile.d.ts.map +1 -0
  35. package/dist/profiles/custom-fields/profile.js +475 -0
  36. package/dist/profiles/custom-fields/profile.js.map +1 -0
  37. package/dist/profiles/custom-fields/src/generated/client.d.ts +2710 -0
  38. package/dist/profiles/custom-fields/src/generated/client.d.ts.map +1 -0
  39. package/dist/profiles/custom-fields/src/generated/client.js +2663 -0
  40. package/dist/profiles/custom-fields/src/generated/client.js.map +1 -0
  41. package/dist/profiles/runtime/profile.d.ts +3 -0
  42. package/dist/profiles/runtime/profile.d.ts.map +1 -0
  43. package/dist/profiles/runtime/profile.js +1065 -0
  44. package/dist/profiles/runtime/profile.js.map +1 -0
  45. package/dist/profiles/runtime/src/generated/client.d.ts +4274 -0
  46. package/dist/profiles/runtime/src/generated/client.d.ts.map +1 -0
  47. package/dist/profiles/runtime/src/generated/client.js +4607 -0
  48. package/dist/profiles/runtime/src/generated/client.js.map +1 -0
  49. package/dist/runtime-materialize.d.ts +10 -0
  50. package/dist/runtime-materialize.d.ts.map +1 -0
  51. package/dist/runtime-materialize.js +344 -0
  52. package/dist/runtime-materialize.js.map +1 -0
  53. package/dist/runtime-profile.d.ts +34 -0
  54. package/dist/runtime-profile.d.ts.map +1 -0
  55. package/dist/runtime-profile.js +203 -0
  56. package/dist/runtime-profile.js.map +1 -0
  57. package/dist/testing.d.ts +11 -0
  58. package/dist/testing.d.ts.map +1 -0
  59. package/dist/testing.js +12 -0
  60. package/dist/testing.js.map +1 -0
  61. package/generated/go/client.go +2250 -0
  62. package/generated/mcp/tools.json +13922 -0
  63. package/generated/python/client.py +4454 -0
  64. package/generated/riffdb.application.exact.json +1 -0
  65. package/generated/riffdb.contract.bundle +0 -0
  66. package/generated/rust/client.rs +6524 -0
  67. package/package.json +83 -4
  68. package/profiles/custom-fields/generated/go/client.go +2578 -0
  69. package/profiles/custom-fields/generated/mcp/tools.json +15998 -0
  70. package/profiles/custom-fields/generated/python/client.py +5141 -0
  71. package/profiles/custom-fields/generated/riffdb.application.exact.json +1 -0
  72. package/profiles/custom-fields/generated/riffdb.contract.bundle +0 -0
  73. package/profiles/custom-fields/generated/rust/client.rs +7980 -0
  74. package/profiles/custom-fields/profile.ts +474 -0
  75. package/profiles/custom-fields/riffdb/contract.riff +568 -0
  76. package/profiles/custom-fields/riffdb/queries/admin_users_all_email_asc.riffq +24 -0
  77. package/profiles/custom-fields/riffdb/queries/admin_users_contains_asc.riffq +24 -0
  78. package/profiles/custom-fields/riffdb/queries/admin_users_contains_desc.riffq +24 -0
  79. package/profiles/custom-fields/riffdb/queries/admin_users_email_contains_created_desc.riffq +24 -0
  80. package/profiles/custom-fields/riffdb/queries/admin_users_email_contains_image_asc.riffq +24 -0
  81. package/profiles/custom-fields/riffdb/queries/admin_users_ends_with_asc.riffq +24 -0
  82. package/profiles/custom-fields/riffdb/queries/admin_users_ends_with_desc.riffq +24 -0
  83. package/profiles/custom-fields/riffdb/queries/admin_users_starts_with_asc.riffq +24 -0
  84. package/profiles/custom-fields/riffdb/queries/admin_users_starts_with_desc.riffq +24 -0
  85. package/profiles/custom-fields/riffdb/queries/find_account_by_id.riffq +24 -0
  86. package/profiles/custom-fields/riffdb/queries/find_account_by_provider.riffq +26 -0
  87. package/profiles/custom-fields/riffdb/queries/find_accounts_by_user_id.riffq +25 -0
  88. package/profiles/custom-fields/riffdb/queries/find_accounts_by_user_provider.riffq +27 -0
  89. package/profiles/custom-fields/riffdb/queries/find_active_sessions_by_user_id.riffq +23 -0
  90. package/profiles/custom-fields/riffdb/queries/find_credential_account.riffq +25 -0
  91. package/profiles/custom-fields/riffdb/queries/find_expired_verification_ids.riffq +17 -0
  92. package/profiles/custom-fields/riffdb/queries/find_latest_verification.riffq +20 -0
  93. package/profiles/custom-fields/riffdb/queries/find_session_by_id.riffq +20 -0
  94. package/profiles/custom-fields/riffdb/queries/find_session_by_token.riffq +20 -0
  95. package/profiles/custom-fields/riffdb/queries/find_sessions_by_token_set.riffq +20 -0
  96. package/profiles/custom-fields/riffdb/queries/find_sessions_by_user_id.riffq +21 -0
  97. package/profiles/custom-fields/riffdb/queries/find_user_by_email.riffq +16 -0
  98. package/profiles/custom-fields/riffdb/queries/find_user_by_id.riffq +15 -0
  99. package/profiles/custom-fields/riffdb/queries/find_verification_by_id.riffq +19 -0
  100. package/profiles/custom-fields/riffdb/queries/find_verifications_by_identifier.riffq +21 -0
  101. package/profiles/custom-fields/riffdb/queries/profile_account_with_user_by_provider.riffq +31 -0
  102. package/profiles/custom-fields/riffdb/queries/profile_session_with_user_by_id.riffq +14 -0
  103. package/profiles/custom-fields/riffdb/queries/profile_session_with_user_by_token.riffq +14 -0
  104. package/profiles/custom-fields/riffdb/queries/profile_sessions_with_users_by_token_set.riffq +25 -0
  105. package/profiles/custom-fields/riffdb/queries/profile_user_with_accounts_by_email.riffq +19 -0
  106. package/profiles/custom-fields/riffdb/queries/profile_user_with_accounts_by_id.riffq +19 -0
  107. package/profiles/custom-fields/riffdb.application.json +217 -0
  108. package/profiles/custom-fields/riffdb.application.lock.json +1 -0
  109. package/profiles/custom-fields/riffdb.toml +3 -0
  110. package/profiles/custom-fields/src/generated/client.ts +3096 -0
  111. package/profiles/organization-security/materialization.json +51 -0
  112. package/profiles/organization-security/riffdb/contract.riff +778 -0
  113. package/profiles/organization-security/riffdb/queries/find_account_by_id.riffq +18 -0
  114. package/profiles/organization-security/riffdb/queries/find_invitation_by_email.riffq +17 -0
  115. package/profiles/organization-security/riffdb/queries/find_invitation_by_id.riffq +18 -0
  116. package/profiles/organization-security/riffdb/queries/find_invitation_by_organization_id.riffq +17 -0
  117. package/profiles/organization-security/riffdb/queries/find_member_by_id.riffq +18 -0
  118. package/profiles/organization-security/riffdb/queries/find_member_by_user_id.riffq +17 -0
  119. package/profiles/organization-security/riffdb/queries/find_organization_by_id.riffq +16 -0
  120. package/profiles/organization-security/riffdb/queries/find_organization_by_slug.riffq +16 -0
  121. package/profiles/organization-security/riffdb/queries/find_session_by_id.riffq +18 -0
  122. package/profiles/organization-security/riffdb/queries/find_session_by_token.riffq +16 -0
  123. package/profiles/organization-security/riffdb/queries/find_team_by_id.riffq +18 -0
  124. package/profiles/organization-security/riffdb/queries/find_team_member_by_id.riffq +18 -0
  125. package/profiles/organization-security/riffdb/queries/find_team_member_by_membership_key.riffq +16 -0
  126. package/profiles/organization-security/riffdb/queries/find_team_member_by_team_id.riffq +17 -0
  127. package/profiles/organization-security/riffdb/queries/find_two_factor_by_id.riffq +18 -0
  128. package/profiles/organization-security/riffdb/queries/find_two_factor_by_secret.riffq +17 -0
  129. package/profiles/organization-security/riffdb/queries/find_user_by_email.riffq +16 -0
  130. package/profiles/organization-security/riffdb/queries/find_user_by_id.riffq +16 -0
  131. package/profiles/organization-security/riffdb/queries/find_verification_by_id.riffq +16 -0
  132. package/profiles/organization-security/riffdb/queries/find_verification_by_identifier.riffq +17 -0
  133. package/profiles/organization-security/riffdb.application.json +172 -0
  134. package/profiles/organization-security/riffdb.toml +7 -0
  135. package/profiles/organization-security.profile.json +980 -0
  136. package/profiles/runtime/generated/go/client.go +4511 -0
  137. package/profiles/runtime/generated/mcp/tools.json +30004 -0
  138. package/profiles/runtime/generated/python/client.py +9337 -0
  139. package/profiles/runtime/generated/riffdb.application.exact.json +1 -0
  140. package/profiles/runtime/generated/riffdb.contract.bundle +0 -0
  141. package/profiles/runtime/generated/rust/client.rs +13297 -0
  142. package/profiles/runtime/profile.ts +1064 -0
  143. package/profiles/runtime/riffdb/contract.riff +1053 -0
  144. package/profiles/runtime/riffdb/queries/admin_users_all_email_asc.riffq +24 -0
  145. package/profiles/runtime/riffdb/queries/admin_users_contains_asc.riffq +24 -0
  146. package/profiles/runtime/riffdb/queries/admin_users_contains_desc.riffq +24 -0
  147. package/profiles/runtime/riffdb/queries/admin_users_email_contains_created_desc.riffq +24 -0
  148. package/profiles/runtime/riffdb/queries/admin_users_email_contains_image_asc.riffq +24 -0
  149. package/profiles/runtime/riffdb/queries/admin_users_ends_with_asc.riffq +24 -0
  150. package/profiles/runtime/riffdb/queries/admin_users_ends_with_desc.riffq +24 -0
  151. package/profiles/runtime/riffdb/queries/admin_users_starts_with_asc.riffq +24 -0
  152. package/profiles/runtime/riffdb/queries/admin_users_starts_with_desc.riffq +24 -0
  153. package/profiles/runtime/riffdb/queries/find_account_by_id.riffq +24 -0
  154. package/profiles/runtime/riffdb/queries/find_account_by_provider.riffq +26 -0
  155. package/profiles/runtime/riffdb/queries/find_accounts_by_user_id.riffq +25 -0
  156. package/profiles/runtime/riffdb/queries/find_accounts_by_user_provider.riffq +27 -0
  157. package/profiles/runtime/riffdb/queries/find_active_sessions_by_user_id.riffq +23 -0
  158. package/profiles/runtime/riffdb/queries/find_credential_account.riffq +25 -0
  159. package/profiles/runtime/riffdb/queries/find_expired_verification_ids.riffq +17 -0
  160. package/profiles/runtime/riffdb/queries/find_latest_verification.riffq +20 -0
  161. package/profiles/runtime/riffdb/queries/find_session_by_id.riffq +20 -0
  162. package/profiles/runtime/riffdb/queries/find_session_by_token.riffq +20 -0
  163. package/profiles/runtime/riffdb/queries/find_sessions_by_token_set.riffq +20 -0
  164. package/profiles/runtime/riffdb/queries/find_sessions_by_user_id.riffq +21 -0
  165. package/profiles/runtime/riffdb/queries/find_user_by_email.riffq +16 -0
  166. package/profiles/runtime/riffdb/queries/find_user_by_id.riffq +15 -0
  167. package/profiles/runtime/riffdb/queries/find_verification_by_id.riffq +19 -0
  168. package/profiles/runtime/riffdb/queries/find_verifications_by_identifier.riffq +21 -0
  169. package/profiles/runtime/riffdb/queries/profile_account_with_user_by_provider.riffq +31 -0
  170. package/profiles/runtime/riffdb/queries/profile_invitation_by_email.riffq +17 -0
  171. package/profiles/runtime/riffdb/queries/profile_invitation_by_id.riffq +17 -0
  172. package/profiles/runtime/riffdb/queries/profile_invitation_by_organization_email_status.riffq +19 -0
  173. package/profiles/runtime/riffdb/queries/profile_invitation_by_organization_id.riffq +17 -0
  174. package/profiles/runtime/riffdb/queries/profile_invitation_by_organization_status.riffq +18 -0
  175. package/profiles/runtime/riffdb/queries/profile_member_by_id.riffq +27 -0
  176. package/profiles/runtime/riffdb/queries/profile_member_by_organization.riffq +20 -0
  177. package/profiles/runtime/riffdb/queries/profile_member_by_organization_created_at_asc.riffq +20 -0
  178. package/profiles/runtime/riffdb/queries/profile_member_by_organization_created_at_desc.riffq +20 -0
  179. package/profiles/runtime/riffdb/queries/profile_member_by_organization_role_asc.riffq +20 -0
  180. package/profiles/runtime/riffdb/queries/profile_member_by_organization_role_desc.riffq +20 -0
  181. package/profiles/runtime/riffdb/queries/profile_member_by_organization_user.riffq +28 -0
  182. package/profiles/runtime/riffdb/queries/profile_member_by_user.riffq +27 -0
  183. package/profiles/runtime/riffdb/queries/profile_organization_by_id.riffq +27 -0
  184. package/profiles/runtime/riffdb/queries/profile_organization_by_slug.riffq +27 -0
  185. package/profiles/runtime/riffdb/queries/profile_session_with_user_by_id.riffq +14 -0
  186. package/profiles/runtime/riffdb/queries/profile_session_with_user_by_token.riffq +14 -0
  187. package/profiles/runtime/riffdb/queries/profile_sessions_with_users_by_token_set.riffq +25 -0
  188. package/profiles/runtime/riffdb/queries/profile_two_factor_by_id.riffq +17 -0
  189. package/profiles/runtime/riffdb/queries/profile_two_factor_by_user.riffq +17 -0
  190. package/profiles/runtime/riffdb/queries/profile_user_with_accounts_by_email.riffq +19 -0
  191. package/profiles/runtime/riffdb/queries/profile_user_with_accounts_by_id.riffq +19 -0
  192. package/profiles/runtime/riffdb/queries/profile_users_by_id_set.riffq +8 -0
  193. package/profiles/runtime/riffdb.application.json +324 -0
  194. package/profiles/runtime/riffdb.application.lock.json +1 -0
  195. package/profiles/runtime/riffdb.toml +3 -0
  196. package/profiles/runtime/src/generated/client.ts +5186 -0
  197. package/riffdb/contract.riff +547 -0
  198. package/riffdb/queries/admin_users_all_email_asc.riffq +24 -0
  199. package/riffdb/queries/admin_users_contains_asc.riffq +24 -0
  200. package/riffdb/queries/admin_users_contains_desc.riffq +24 -0
  201. package/riffdb/queries/admin_users_email_contains_created_desc.riffq +24 -0
  202. package/riffdb/queries/admin_users_email_contains_image_asc.riffq +24 -0
  203. package/riffdb/queries/admin_users_ends_with_asc.riffq +24 -0
  204. package/riffdb/queries/admin_users_ends_with_desc.riffq +24 -0
  205. package/riffdb/queries/admin_users_starts_with_asc.riffq +24 -0
  206. package/riffdb/queries/admin_users_starts_with_desc.riffq +24 -0
  207. package/riffdb/queries/find_account_by_id.riffq +24 -0
  208. package/riffdb/queries/find_account_by_provider.riffq +26 -0
  209. package/riffdb/queries/find_accounts_by_user_id.riffq +25 -0
  210. package/riffdb/queries/find_accounts_by_user_provider.riffq +27 -0
  211. package/riffdb/queries/find_active_sessions_by_user_id.riffq +23 -0
  212. package/riffdb/queries/find_credential_account.riffq +25 -0
  213. package/riffdb/queries/find_expired_verification_ids.riffq +17 -0
  214. package/riffdb/queries/find_latest_verification.riffq +20 -0
  215. package/riffdb/queries/find_session_by_id.riffq +20 -0
  216. package/riffdb/queries/find_session_by_token.riffq +20 -0
  217. package/riffdb/queries/find_sessions_by_token_set.riffq +20 -0
  218. package/riffdb/queries/find_sessions_by_user_id.riffq +21 -0
  219. package/riffdb/queries/find_user_by_email.riffq +16 -0
  220. package/riffdb/queries/find_user_by_id.riffq +15 -0
  221. package/riffdb/queries/find_verification_by_id.riffq +19 -0
  222. package/riffdb/queries/find_verifications_by_identifier.riffq +21 -0
  223. package/riffdb.application.json +187 -0
  224. package/riffdb.application.lock.json +1 -0
  225. package/scripts/real-riffdb-runner.mjs +333 -0
  226. package/src/generated/client.ts +2746 -0
@@ -0,0 +1,19 @@
1
+ query ProfileInvitationByOrganizationEmailStatus(
2
+ $organization_id: Invitation.organization_id,
3
+ $org_id: Invitation.org_id,
4
+ $email: Invitation.email,
5
+ $status: Invitation.status,
6
+ $after: Cursor?,
7
+ $limit: Limit<100> = 100,
8
+ $offset: u64 = 0
9
+ ) {
10
+ many rows from Invitation
11
+ where organization_id == $organization_id && org_id == $org_id && email == $email && status == $status
12
+ order by invitation_id asc
13
+ take $limit after $after
14
+
15
+ return Found {
16
+ rows: rows { invitation_id created_at email expires_at inviter_id org_id role status revision }
17
+ }
18
+ outcomes Found
19
+ }
@@ -0,0 +1,17 @@
1
+ query ProfileInvitationByOrganizationId(
2
+ $organization_id: Invitation.organization_id,
3
+ $org_id: Invitation.org_id,
4
+ $after: Cursor?,
5
+ $limit: Limit<100> = 100,
6
+ $offset: u64 = 0
7
+ ) {
8
+ many rows from Invitation
9
+ where organization_id == $organization_id && org_id == $org_id
10
+ order by invitation_id asc
11
+ take $limit after $after
12
+
13
+ return Found {
14
+ rows: rows { invitation_id created_at email expires_at inviter_id org_id role status revision }
15
+ }
16
+ outcomes Found
17
+ }
@@ -0,0 +1,18 @@
1
+ query ProfileInvitationByOrganizationStatus(
2
+ $organization_id: Invitation.organization_id,
3
+ $org_id: Invitation.org_id,
4
+ $status: Invitation.status,
5
+ $after: Cursor?,
6
+ $limit: Limit<100> = 100,
7
+ $offset: u64 = 0
8
+ ) {
9
+ many rows from Invitation
10
+ where organization_id == $organization_id && org_id == $org_id && status == $status
11
+ order by invitation_id asc
12
+ take $limit after $after
13
+
14
+ return Found {
15
+ rows: rows { invitation_id created_at email expires_at inviter_id org_id role status revision }
16
+ }
17
+ outcomes Found
18
+ }
@@ -0,0 +1,27 @@
1
+ query ProfileMemberById(
2
+ $organization_id: Member.organization_id,
3
+ $id: Member.member_id,
4
+ $after: Cursor?,
5
+ $limit: Limit<100> = 100,
6
+ $offset: u64 = 0
7
+ ) {
8
+ many rows from Member
9
+ where organization_id == $organization_id && member_id == $id
10
+ order by member_id asc
11
+ take $limit after $after
12
+
13
+ many organizations from Organization
14
+ where organization_id == $organization_id && org_id in distinct(rows.org_id)
15
+ take 100
16
+
17
+ many users from User
18
+ where organization_id == $organization_id && user_id in distinct(rows.user_id)
19
+ take 100
20
+
21
+ return Found {
22
+ rows: rows { member_id created_at org_id role user_id revision }
23
+ organizations: organizations { org_id created_at logo metadata name slug revision }
24
+ users: users { user_id name email email_verified image created_at updated_at revision date_field locale two_factor_enabled }
25
+ }
26
+ outcomes Found
27
+ }
@@ -0,0 +1,20 @@
1
+ query ProfileMemberByOrganization(
2
+ $organization_id: Member.organization_id,
3
+ $org_id: Member.org_id,
4
+ $minimum_role: Member.role = "",
5
+ $limit: Limit<100> = 100,
6
+ $offset: u64 = 0
7
+ ) {
8
+ many rows from Member
9
+ where organization_id == $organization_id && org_id == $org_id && role >= $minimum_role
10
+ order by role asc, member_id asc
11
+ take $limit offset $offset
12
+
13
+ aggregate total from rows { exact_count() as value }
14
+
15
+ return Found {
16
+ rows: rows { member_id created_at org_id role user_id revision }
17
+ total: total { value }
18
+ }
19
+ outcomes Found
20
+ }
@@ -0,0 +1,20 @@
1
+ query ProfileMemberByOrganizationCreatedAtAsc(
2
+ $organization_id: Member.organization_id,
3
+ $org_id: Member.org_id,
4
+ $minimum_role: Member.role = "",
5
+ $limit: Limit<100> = 100,
6
+ $offset: u64 = 0
7
+ ) {
8
+ many rows from Member
9
+ where organization_id == $organization_id && org_id == $org_id && role >= $minimum_role
10
+ order by created_at asc, member_id asc
11
+ take $limit offset $offset
12
+
13
+ aggregate total from rows { exact_count() as value }
14
+
15
+ return Found {
16
+ rows: rows { member_id created_at org_id role user_id revision }
17
+ total: total { value }
18
+ }
19
+ outcomes Found
20
+ }
@@ -0,0 +1,20 @@
1
+ query ProfileMemberByOrganizationCreatedAtDesc(
2
+ $organization_id: Member.organization_id,
3
+ $org_id: Member.org_id,
4
+ $minimum_role: Member.role = "",
5
+ $limit: Limit<100> = 100,
6
+ $offset: u64 = 0
7
+ ) {
8
+ many rows from Member
9
+ where organization_id == $organization_id && org_id == $org_id && role >= $minimum_role
10
+ order by created_at desc, member_id asc
11
+ take $limit offset $offset
12
+
13
+ aggregate total from rows { exact_count() as value }
14
+
15
+ return Found {
16
+ rows: rows { member_id created_at org_id role user_id revision }
17
+ total: total { value }
18
+ }
19
+ outcomes Found
20
+ }
@@ -0,0 +1,20 @@
1
+ query ProfileMemberByOrganizationRoleAsc(
2
+ $organization_id: Member.organization_id,
3
+ $org_id: Member.org_id,
4
+ $minimum_role: Member.role = "",
5
+ $limit: Limit<100> = 100,
6
+ $offset: u64 = 0
7
+ ) {
8
+ many rows from Member
9
+ where organization_id == $organization_id && org_id == $org_id && role >= $minimum_role
10
+ order by role asc, member_id asc
11
+ take $limit offset $offset
12
+
13
+ aggregate total from rows { exact_count() as value }
14
+
15
+ return Found {
16
+ rows: rows { member_id created_at org_id role user_id revision }
17
+ total: total { value }
18
+ }
19
+ outcomes Found
20
+ }
@@ -0,0 +1,20 @@
1
+ query ProfileMemberByOrganizationRoleDesc(
2
+ $organization_id: Member.organization_id,
3
+ $org_id: Member.org_id,
4
+ $minimum_role: Member.role = "",
5
+ $limit: Limit<100> = 100,
6
+ $offset: u64 = 0
7
+ ) {
8
+ many rows from Member
9
+ where organization_id == $organization_id && org_id == $org_id && role >= $minimum_role
10
+ order by role desc, member_id asc
11
+ take $limit offset $offset
12
+
13
+ aggregate total from rows { exact_count() as value }
14
+
15
+ return Found {
16
+ rows: rows { member_id created_at org_id role user_id revision }
17
+ total: total { value }
18
+ }
19
+ outcomes Found
20
+ }
@@ -0,0 +1,28 @@
1
+ query ProfileMemberByOrganizationUser(
2
+ $organization_id: Member.organization_id,
3
+ $org_id: Member.org_id,
4
+ $user_id: Member.user_id,
5
+ $after: Cursor?,
6
+ $limit: Limit<100> = 100,
7
+ $offset: u64 = 0
8
+ ) {
9
+ many rows from Member
10
+ where organization_id == $organization_id && org_id == $org_id && user_id == $user_id
11
+ order by member_id asc
12
+ take $limit after $after
13
+
14
+ many organizations from Organization
15
+ where organization_id == $organization_id && org_id in distinct(rows.org_id)
16
+ take 100
17
+
18
+ many users from User
19
+ where organization_id == $organization_id && user_id in distinct(rows.user_id)
20
+ take 100
21
+
22
+ return Found {
23
+ rows: rows { member_id created_at org_id role user_id revision }
24
+ organizations: organizations { org_id created_at logo metadata name slug revision }
25
+ users: users { user_id name email email_verified image created_at updated_at revision date_field locale two_factor_enabled }
26
+ }
27
+ outcomes Found
28
+ }
@@ -0,0 +1,27 @@
1
+ query ProfileMemberByUser(
2
+ $organization_id: Member.organization_id,
3
+ $user_id: Member.user_id,
4
+ $after: Cursor?,
5
+ $limit: Limit<100> = 100,
6
+ $offset: u64 = 0
7
+ ) {
8
+ many rows from Member
9
+ where organization_id == $organization_id && user_id == $user_id
10
+ order by member_id asc
11
+ take $limit after $after
12
+
13
+ many organizations from Organization
14
+ where organization_id == $organization_id && org_id in distinct(rows.org_id)
15
+ take 100
16
+
17
+ many users from User
18
+ where organization_id == $organization_id && user_id in distinct(rows.user_id)
19
+ take 100
20
+
21
+ return Found {
22
+ rows: rows { member_id created_at org_id role user_id revision }
23
+ organizations: organizations { org_id created_at logo metadata name slug revision }
24
+ users: users { user_id name email email_verified image created_at updated_at revision date_field locale two_factor_enabled }
25
+ }
26
+ outcomes Found
27
+ }
@@ -0,0 +1,27 @@
1
+ query ProfileOrganizationById(
2
+ $organization_id: Organization.organization_id,
3
+ $id: Organization.org_id,
4
+ $limit: Limit<100> = 100,
5
+ $offset: u64 = 0
6
+ ) {
7
+ one record from Organization
8
+ where organization_id == $organization_id && org_id == $id
9
+ else Missing
10
+
11
+ many members from Member
12
+ where organization_id == $organization_id && org_id == record.org_id
13
+ order by member_id asc
14
+ take 100
15
+
16
+ many invitations from Invitation
17
+ where organization_id == $organization_id && org_id == record.org_id
18
+ order by invitation_id asc
19
+ take 100
20
+
21
+ return Found {
22
+ record: record { org_id created_at logo metadata name slug revision }
23
+ members: members { member_id created_at org_id role user_id revision }
24
+ invitations: invitations { invitation_id created_at email expires_at inviter_id org_id role status revision }
25
+ }
26
+ outcomes Found | Missing
27
+ }
@@ -0,0 +1,27 @@
1
+ query ProfileOrganizationBySlug(
2
+ $organization_id: Organization.organization_id,
3
+ $slug: Organization.slug,
4
+ $limit: Limit<100> = 100,
5
+ $offset: u64 = 0
6
+ ) {
7
+ one record from Organization
8
+ where organization_id == $organization_id && slug == $slug
9
+ else Missing
10
+
11
+ many members from Member
12
+ where organization_id == $organization_id && org_id == record.org_id
13
+ order by member_id asc
14
+ take 100
15
+
16
+ many invitations from Invitation
17
+ where organization_id == $organization_id && org_id == record.org_id
18
+ order by invitation_id asc
19
+ take 100
20
+
21
+ return Found {
22
+ record: record { org_id created_at logo metadata name slug revision }
23
+ members: members { member_id created_at org_id role user_id revision }
24
+ invitations: invitations { invitation_id created_at email expires_at inviter_id org_id role status revision }
25
+ }
26
+ outcomes Found | Missing
27
+ }
@@ -0,0 +1,14 @@
1
+ query ProfileSessionWithUserById($organization_id: Session.organization_id, $value: Session.id) {
2
+ one session from Session
3
+ where organization_id == $organization_id && id == $value
4
+ else Missing
5
+ one user from User
6
+ where organization_id == $organization_id && user_id == session.user_id
7
+ else IntegrityFailure
8
+ return Found { session: session {
9
+ id user_id
10
+ token reveals session.token
11
+ expires_at ip_address user_agent created_at updated_at revision
12
+ active_organization_id } user: user { user_id name email email_verified image created_at updated_at revision date_field locale two_factor_enabled } }
13
+ outcomes Found | Missing | IntegrityFailure
14
+ }
@@ -0,0 +1,14 @@
1
+ query ProfileSessionWithUserByToken($organization_id: Session.organization_id, $value: Session.token) {
2
+ one session from Session
3
+ where organization_id == $organization_id && token == $value
4
+ else Missing
5
+ one user from User
6
+ where organization_id == $organization_id && user_id == session.user_id
7
+ else IntegrityFailure
8
+ return Found { session: session {
9
+ id user_id
10
+ token reveals session.token
11
+ expires_at ip_address user_agent created_at updated_at revision
12
+ active_organization_id } user: user { user_id name email email_verified image created_at updated_at revision date_field locale two_factor_enabled } }
13
+ outcomes Found | Missing | IntegrityFailure
14
+ }
@@ -0,0 +1,25 @@
1
+ query ProfileSessionsWithUsersByTokenSet(
2
+ $organization_id: Session.organization_id,
3
+ $tokens: Set<Session.token>,
4
+ ) {
5
+ many sessions from Session
6
+ where organization_id == $organization_id
7
+ && token in $tokens
8
+ order by token asc, user_id asc, id asc
9
+ take 32
10
+
11
+ many users from User
12
+ where organization_id == $organization_id && user_id in distinct(sessions.user_id)
13
+ take 32
14
+
15
+ return Found {
16
+ users: users { user_id name email email_verified image created_at updated_at revision date_field locale two_factor_enabled }
17
+ sessions: sessions {
18
+ id user_id
19
+ token reveals sessions.token
20
+ expires_at ip_address user_agent created_at updated_at revision
21
+ active_organization_id }
22
+ }
23
+
24
+ outcomes Found
25
+ }
@@ -0,0 +1,17 @@
1
+ query ProfileTwoFactorById(
2
+ $organization_id: TwoFactor.organization_id,
3
+ $id: TwoFactor.two_factor_id,
4
+ $after: Cursor?,
5
+ $limit: Limit<100> = 100,
6
+ $offset: u64 = 0
7
+ ) {
8
+ many rows from TwoFactor
9
+ where organization_id == $organization_id && two_factor_id == $id
10
+ order by two_factor_id asc
11
+ take $limit after $after
12
+
13
+ return Found {
14
+ rows: rows { two_factor_id backup_codes reveals rows.backup_codes failed_verification_count reveals rows.failed_verification_count locked_until reveals rows.locked_until secret reveals rows.secret user_id verified revision }
15
+ }
16
+ outcomes Found
17
+ }
@@ -0,0 +1,17 @@
1
+ query ProfileTwoFactorByUser(
2
+ $organization_id: TwoFactor.organization_id,
3
+ $user_id: TwoFactor.user_id,
4
+ $after: Cursor?,
5
+ $limit: Limit<100> = 100,
6
+ $offset: u64 = 0
7
+ ) {
8
+ many rows from TwoFactor
9
+ where organization_id == $organization_id && user_id == $user_id
10
+ order by two_factor_id asc
11
+ take $limit after $after
12
+
13
+ return Found {
14
+ rows: rows { two_factor_id backup_codes reveals rows.backup_codes failed_verification_count reveals rows.failed_verification_count locked_until reveals rows.locked_until secret reveals rows.secret user_id verified revision }
15
+ }
16
+ outcomes Found
17
+ }
@@ -0,0 +1,19 @@
1
+ query ProfileUserWithAccountsByEmail($organization_id: User.organization_id, $value: User.email) {
2
+ one user from User
3
+ where organization_id == $organization_id && email == $value
4
+ else Missing
5
+ many accounts from Account
6
+ where organization_id == $organization_id && user_id == user.user_id
7
+ order by id asc
8
+ take 33
9
+ return Found { user: user { user_id name email email_verified image created_at updated_at revision date_field locale two_factor_enabled } accounts: accounts {
10
+ id user_id account_id provider_id
11
+ access_token reveals accounts.access_token
12
+ refresh_token reveals accounts.refresh_token
13
+ access_token_expires_at refresh_token_expires_at scope
14
+ id_token reveals accounts.id_token
15
+ password reveals accounts.password
16
+ created_at updated_at revision
17
+ } }
18
+ outcomes Found | Missing
19
+ }
@@ -0,0 +1,19 @@
1
+ query ProfileUserWithAccountsById($organization_id: User.organization_id, $value: User.user_id) {
2
+ one user from User
3
+ where organization_id == $organization_id && user_id == $value
4
+ else Missing
5
+ many accounts from Account
6
+ where organization_id == $organization_id && user_id == user.user_id
7
+ order by id asc
8
+ take 33
9
+ return Found { user: user { user_id name email email_verified image created_at updated_at revision date_field locale two_factor_enabled } accounts: accounts {
10
+ id user_id account_id provider_id
11
+ access_token reveals accounts.access_token
12
+ refresh_token reveals accounts.refresh_token
13
+ access_token_expires_at refresh_token_expires_at scope
14
+ id_token reveals accounts.id_token
15
+ password reveals accounts.password
16
+ created_at updated_at revision
17
+ } }
18
+ outcomes Found | Missing
19
+ }
@@ -0,0 +1,8 @@
1
+ query ProfileUsersByIdSet($organization_id: User.organization_id, $ids: Set<User.user_id>) {
2
+ many users from User
3
+ where organization_id == $organization_id && user_id in $ids
4
+ order by user_id asc
5
+ take 100
6
+ return Found { users: users { user_id name email email_verified image created_at updated_at revision date_field locale two_factor_enabled } }
7
+ outcomes Found
8
+ }