Repository navigation
feat(access): implement client.access.check API and AccessDecision types (closes #495) - #503
Merged
Lakes41 merged 1 commit intoSep 16, 2026
Conversation
…main types (closes Adamantine-guild#495) - Expose strongly typed AccessResource on GuildPassClient under client.access - Introduce AccessCheckRequest and canonical AccessDecision types supporting Stellar accounts - Delegate policy evaluation solely to GuildPass Core via HttpTransport - Represent 403 access denial as a normal decision rather than throwing - Preserve typed SDK errors for network, timeout, and API failures - Add comprehensive Vitest test suite covering allowed, denied, and error scenarios
8 tasks
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.
Description
Implements the strongly typed
client.access.check()operation onGuildPassClientalong with canonicalAccessDecisionandAccessCheckRequestdomain types.Key implementation characteristics:
AccessResourcemounted onGuildPassClient.accessexposing.check(request: AccessCheckRequest): Promise<AccessDecision>.AccessCheckRequestandAccessDecision(allowed: boolean,reason?: string,metadata?: Record<string, unknown>).StellarAccountId.guildId,account,resource,action,context) without duplicating evaluation rules.{ allowed: false, reason: ... }decision objects rather than throwing raw errors.HttpError,NetworkError,TimeoutError).Semver impact: minor
Linked Issue
Closes #495
Type of Change
Changes Made
src/types/access.ts: DefineAccessCheckRequestand canonicalAccessDecisioninterfaces.src/types/index.ts: Re-export access domain types.src/resources/access.ts: ImplementAccessResourcewith.check()logic, request normalization, and denial formatting.src/resources/index.ts: Re-exportAccessResource.src/client/index.ts: MountAccessResourceunderclient.accessusing existingHttpTransportinstance and configured headers.src/index.ts: Exportresourcesmodule.tests/resources/access.test.ts: Added 15 comprehensive unit tests covering allowed, denied, error handling, Stellar ID support, context forwarding, and header propagation.Public API Changes
Test Evidence
Build Evidence
Checklist
tsc --noEmitpassesvitest runpasses — all 680 tests green (15 new tests)tsupbuild succeeds —dist/generated cleanly