Skip to content

feat(sdk): namespace EntityIdentifier helpers under EntityIdentifiers#916

Merged
marythought merged 3 commits intomainfrom
refactor/namespace-entity-identifiers
Apr 10, 2026
Merged

feat(sdk): namespace EntityIdentifier helpers under EntityIdentifiers#916
marythought merged 3 commits intomainfrom
refactor/namespace-entity-identifiers

Conversation

@marythought
Copy link
Copy Markdown
Contributor

@marythought marythought commented Apr 10, 2026

Summary

  • Export EntityIdentifier convenience constructors under a namespaced EntityIdentifiers object, using the existing export * as pattern (same as AuthProviders)
  • Bare named exports (forEmail, forClientId, etc.) are preserved with @deprecated JSDoc tags for backwards compatibility
  • Aligns with the Java SDK's EntityIdentifiers.forEmail(...) pattern
  • Avoids top-level name collisions with future SDK features (e.g. TDF recipient helpers)

Migration

// Old (still works, but deprecated)
import { forEmail } from '@opentdf/sdk';
forEmail('alice@example.com');

// New (recommended)
import { EntityIdentifiers } from '@opentdf/sdk';
EntityIdentifiers.forEmail('alice@example.com');

Closes #915

Test plan

  • All 9 EntityIdentifier unit tests pass with namespaced imports
  • CI passes

🤖 Generated with Claude Code

@marythought marythought requested a review from a team as a code owner April 10, 2026 21:10
marythought added a commit to opentdf/docs that referenced this pull request Apr 10, 2026
Update JS examples to use `EntityIdentifiers.forEmail(...)` instead of
bare `forEmail(...)` to match opentdf/web-sdk#916.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…iers

Export helpers as `EntityIdentifiers.forEmail(...)` instead of bare
`forEmail(...)` to avoid top-level name collisions (e.g. with future
TDF recipient helpers) and align with the Java SDK pattern.

Closes #915

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the export of entity identifiers by grouping them under a namespaced EntityIdentifiers object instead of individual exports. The changes are reflected in the library's main entry point and the unit tests. Feedback indicates that JSDoc examples in the source file still demonstrate the old non-namespaced usage and should be updated to reflect this breaking change.

@marythought marythought force-pushed the refactor/namespace-entity-identifiers branch from 2269d1b to 3f83aec Compare April 10, 2026 21:15
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

X-Test Failure Report

opentdf-ctl
opentdf-sdk-lib

@github-actions
Copy link
Copy Markdown

X-Test Failure Report

opentdf-ctl
opentdf-sdk-lib

@marythought
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Keep the bare named exports (forEmail, forClientId, etc.) with
@deprecated JSDoc tags so existing consumers don't break. The
namespaced EntityIdentifiers export is the recommended path forward.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@marythought marythought changed the title feat(sdk)!: namespace EntityIdentifier helpers under EntityIdentifiers feat(sdk): namespace EntityIdentifier helpers under EntityIdentifiers Apr 10, 2026
@opentdf opentdf deleted a comment from coderabbitai bot Apr 10, 2026
@github-actions
Copy link
Copy Markdown

marythought added a commit to opentdf/docs that referenced this pull request Apr 10, 2026
Update JS examples to use `EntityIdentifiers.forEmail(...)` instead of
bare `forEmail(...)` to match opentdf/web-sdk#916.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@eugenioenko eugenioenko left a comment

Choose a reason for hiding this comment

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

Code changes look great!

@github-actions
Copy link
Copy Markdown

@marythought marythought merged commit d0ab115 into main Apr 10, 2026
23 checks passed
@marythought marythought deleted the refactor/namespace-entity-identifiers branch April 10, 2026 23:16
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.

Namespace EntityIdentifier helper exports

2 participants