feat(server): add Accounts RPC methods#14
Merged
Conversation
Implements JSON-RPC methods for the Accounts API: Identity methods: - me.get: Get the current authenticated identity Organization methods: - org.create: Create a new organization (caller becomes owner) - org.list: List organizations for the current identity - org.get: Get organization by ID - org.update: Update organization name/slug - org.delete: Delete an organization Organization member methods: - org.member.list: List members of an organization - org.member.add: Add a member to an organization - org.member.remove: Remove a member from an organization - org.member.updateRole: Update a member's role Engine methods: - engine.create: Create a new engine for an organization - engine.list: List engines for an organization - engine.get: Get engine by ID - engine.update: Update engine name/status Invitation methods: - invitation.create: Create an invitation to join an organization - invitation.list: List pending invitations for an organization - invitation.revoke: Revoke a pending invitation - invitation.accept: Accept an invitation (adds caller to org) All methods enforce proper authorization: - Membership checks for read operations - Role-based access for admin operations - Owner-only for sensitive operations Includes 49 schema tests for validation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements JSON-RPC methods for the Accounts API (Chunk 6 of server implementation).
Changes
New Files
packages/server/rpc/accounts/types.ts- AccountsRpcContext type and guardspackages/server/rpc/accounts/schemas.ts- Zod schemas for all 18 methodspackages/server/rpc/accounts/schemas.test.ts- 49 schema validation testspackages/server/rpc/accounts/me.ts- Identity methods (me.get)packages/server/rpc/accounts/org.ts- Organization methods (create, list, get, update, delete)packages/server/rpc/accounts/org-member.ts- Member methods (list, add, remove, updateRole)packages/server/rpc/accounts/engine.ts- Engine methods (create, list, get, update)packages/server/rpc/accounts/invitation.ts- Invitation methods (create, list, revoke, accept)Methods Implemented (18 total)
me.getorg.createorg.listorg.getorg.updateorg.deleteorg.member.listorg.member.addorg.member.removeorg.member.updateRoleengine.createengine.listengine.getengine.updateinvitation.createinvitation.listinvitation.revokeinvitation.acceptAuthorization
All methods enforce proper authorization:
ORG_MUST_HAVE_OWNERconstraint properlyTest Results