feat(presigned-url): add per-bucket mutation entry points on root Mutation type#1071
Merged
Merged
Conversation
…ation type
Adds mutation fields for each @storageBuckets-tagged codec on the root
Mutation type (e.g., appBucket(key: "public"): AppBucket). This allows
upload operations (requestUploadUrl, requestBulkUploadUrls) to be accessed
as proper GraphQL mutations instead of queries.
Each mutation entry point resolves a bucket by key (and ownerId for
entity-scoped buckets) and returns the bucket type, so existing upload
fields on the bucket type work as sub-selections:
mutation {
appBucket(key: "public") {
requestUploadUrl(contentHash: "...", contentType: "...", size: 123) {
uploadUrl fileId key deduplicated expiresAt
}
}
}
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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
Adds per-bucket mutation fields on the root GraphQL Mutation type so that upload operations (
requestUploadUrl,requestBulkUploadUrls) can be accessed as proper mutations instead of queries. Previously, these were only reachable via query fields on bucket types.For each
@storageBuckets-tagged codec, the plugin now adds a mutation field named after the bucket type (e.g.,appBucket,dataRoomBucket):Entity-scoped buckets automatically include a required
ownerIdargument. The mutation resolves the bucket row viagetBucketConfigand returns anObjectStepwithaccess()steps for each codec attribute, so existing sub-field plans (which call$parent.get('column')) continue to work.Review & Testing Checklist for Human
object()step, NOT aPgSelectSingleStep. PostGraphile's generated attribute field plans call$parent.get('column')— verify thatObjectStep.get()behaves identically toPgSelectSingleStep.get()for sub-field resolution. This is the highest-risk area and has not been integration-tested.getBucketConfigreturns only 8 fields (id,key,type,is_public,owner_id,allowed_mime_types,max_file_size,allow_custom_keys), but theobject()step is built fromObject.keys(codec.attributes)which may include additional columns (e.g.,created_at). Selecting those columns through the mutation entry point will returnundefined. Verify this is acceptable or ifSELECT *should be used instead.minio-multi-scopeintegration test in constructive-db with amutation { appBucket(...) { requestUploadUrl(...) { ... } } }query to confirm the full plan chain resolves correctly at runtime.Notes
@pgpmjs/loggertype errors in the build output are pre-existing onmain(verified by building before and after changes). The workspace-levelpnpm buildpasses cleanly.ownerIdusesGraphQLStringrather than the PostGraphileUUIDscalar — works but is less type-precise.Link to Devin session: https://app.devin.ai/sessions/7903d2a3e7a34c6daa605e12d6b80d9e
Requested by: @pyramation