Skip to content

feat(shared): add TigrisStorage and TigrisIAM class-based clients - #219

Draft
designcode wants to merge 1 commit into
mainfrom
feat/tigris-storage-iam-classes
Draft

feat(shared): add TigrisStorage and TigrisIAM class-based clients#219
designcode wants to merge 1 commit into
mainfrom
feat/tigris-storage-iam-classes

Conversation

@designcode

Copy link
Copy Markdown
Collaborator

Summary

  • Adds TigrisStorage and TigrisIAM, 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 — config is built once from the constructor's 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) every time.
  • Every method on both classes is generated from each package's own public bare-function exports via a generic runtime binder (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.
  • 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.

No changeset included yet — holding off for now.

Test plan

  • pnpm build across all workspace packages
  • pnpm test across all workspace packages (shared: 42, iam: 7, storage: 217 passed/9 skipped pre-existing live-gateway tests)
  • pnpm biome check clean across the repo
  • Standalone .d.ts consumer type-checks confirming get's full overload set, per-call bucket overrides, and handleClientUpload's bare-config signature all resolve correctly
  • Review

Assisted-by: Sonnet 5 via Claude Code

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant