Skip to content

Conversation

@designcode
Copy link
Collaborator

@designcode designcode commented Dec 23, 2025

Note

Introduces a dedicated IAM SDK and consolidates common infra, with breaking changes in storage and Keyv adapter.

  • New @tigrisdata/iam package: listOrganizations and createOrganization using a shared HTTP client and TigrisIAMConfig
  • Extracts shared utilities to shared/: http-client, headers, config (isNode, loadEnv, missingConfigError), and base TigrisResponse
  • Refactors @tigrisdata/storage to use shared TigrisHeaders and per-package config/types; removes storage-level org APIs; updates client creation and config loading
  • Keyv adapter: simplifies constructor to KeyvTigrisOptions and re-exports types
  • Test/build config unification: adds tsconfig.base.json, vitest.config.base.ts, replaces per-package configs via merge; CI workflow runs npm run build and npm run test
  • Release: consolidates to root release.config.cjs; repo package.json adds packages/iam workspace and scripts

Written by Cursor Bugbot for commit eeb9f4a. This will update automatically on new commits. Configure here.

@greptile-apps
Copy link

greptile-apps bot commented Dec 23, 2025

Greptile Summary

Creates new @tigrisdata/iam package by extracting organization management functionality from storage package. Refactors shared code (HTTP client, headers, config utilities, types) into a shared/ directory accessible to all packages.

Key Changes:

  • Extracted HTTP client with caching to shared/http-client.ts for reuse across packages
  • Moved TigrisHeaders enum and TigrisResponse type to shared location
  • Created new IAM package with listOrganizations and createOrganization functions
  • Removed organization functionality and HTTP client from storage package
  • Consolidated build/test commands in CI workflow
  • Added base configs (tsconfig.base.json, vitest.config.base.ts) for consistent tooling

Issues Found:

  • createOrganization blocks users with no orgs from creating orgs via API (line 28-34), contradicting the error message
  • Session token validation happens after client creation in listOrganizations (inefficient ordering)
  • HTTP client error responses lose detail from response body

Confidence Score: 3/5

  • PR has solid refactoring but contains a logical error in createOrganization that blocks intended functionality
  • The refactoring is well-structured with proper code extraction and shared utilities. However, the createOrganization function has a critical logic flaw preventing users without existing orgs from creating orgs via the API, which appears to contradict its intended purpose. The error message suggests going to the console, but this defeats the purpose of having an API function.
  • packages/iam/src/lib/organization/create.ts requires attention for the org creation logic

Important Files Changed

Filename Overview
shared/http-client.ts extracted shared HTTP client from storage package with caching
shared/headers.ts extracted Tigris headers enum to shared location
shared/config.ts extracted shared config utilities for reuse across packages
packages/iam/src/lib/organization/create.ts creates organization after listing existing ones to get org ID
packages/iam/src/lib/organization/list.ts lists organizations via IAM endpoint with session token auth
packages/storage/src/lib/tigris-client.ts removed HTTP client code, now imports TigrisHeaders from shared

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Comments (1)

  1. packages/iam/src/lib/organization/create.ts, line 28-34 (link)

    logic: function prevents creating org when user has no existing orgs, which contradicts error message suggesting first org should be created via console

    is this check intentional to require at least one org exists before creating additional orgs via API?

41 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

@designcode designcode merged commit f51b0aa into main Jan 2, 2026
2 checks passed
@designcode designcode deleted the feat/iam-package branch January 2, 2026 16:10
@github-actions
Copy link

github-actions bot commented Jan 2, 2026

🎉 This PR is included in version 1.1.3 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@github-actions
Copy link

github-actions bot commented Jan 2, 2026

🎉 This PR is included in version 1.0.9 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@github-actions
Copy link

github-actions bot commented Jan 2, 2026

🎉 This PR is included in version 2.10.2 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

@github-actions
Copy link

github-actions bot commented Jan 2, 2026

🎉 This PR is included in version 1.0.0 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants