feat(shared): add TigrisStorage and TigrisIAM class-based clients - #219
Draft
designcode wants to merge 1 commit into
Draft
feat(shared): add TigrisStorage and TigrisIAM class-based clients#219designcode wants to merge 1 commit into
designcode wants to merge 1 commit into
Conversation
Add `new TigrisStorage({ auth, bucket?, endpoints? })` and
`new TigrisIAM({ auth, endpoints? })` alongside the existing
bare-function API. Construct once and every operation is available as
a method, with `config` built once from the constructor's auth/endpoint
options instead of threaded through every call.
`auth` accepts static credentials, a static session, or an async
resolver cached with proactive refresh, so a dynamic session is
resolved once and reused across calls instead of re-resolving (and
rebuilding a client) on every one.
Every method on both classes is generated from the same public
bare-function exports each package already ships, via a generic
runtime binder plus a mapped type derived from those exports — a
future bare function becomes a class method automatically, with no
changes needed to the class files. Four TS-overloaded storage exports
(get, listForks, createBucketSnapshot, listBucketSnapshots) needed
hand-written signatures since TypeScript's `infer` only sees the last
overload of a function type; their runtime binding is unaffected and
stays automatic.
The bare-function API and its types are unchanged — this is purely
additive.
Assisted-by: Sonnet 5 via Claude Code
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
TigrisStorageandTigrisIAM, class-based clients alongside the existing bare-function API. Construct once with{ auth, bucket?, endpoints? }/{ auth, endpoints? }and every operation is available as a method —configis built once from the constructor's options instead of threaded through every call.authaccepts static credentials, a static session, or an async resolver cached with proactive refresh, so a dynamic session is resolved once and reused across calls instead of re-resolving (and rebuilding a client) every time.shared/client/bind-operations.ts) plus a mapped type derived from those exports — a future bare function becomes a class method automatically, with no changes to the class files.get,listForks,createBucketSnapshot,listBucketSnapshots) needed hand-written signatures, since TypeScript'sinferonly sees the last overload of a function type. Their runtime binding is unaffected and stays automatic.No changeset included yet — holding off for now.
Test plan
pnpm buildacross all workspace packagespnpm testacross all workspace packages (shared: 42, iam: 7, storage: 217 passed/9 skipped pre-existing live-gateway tests)pnpm biome checkclean across the repo.d.tsconsumer type-checks confirmingget's full overload set, per-callbucketoverrides, andhandleClientUpload's bare-config signature all resolve correctlyAssisted-by: Sonnet 5 via Claude Code