Skip to content

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

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

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

Conversation

@marythought

@marythought marythought commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

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>

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

Copy link
Copy Markdown

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.

Comment thread lib/src/index.ts
@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

coderabbitai Bot commented Apr 10, 2026

Copy link
Copy Markdown
✅ 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>

@eugenioenko eugenioenko left a comment

Copy link
Copy Markdown
Contributor

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
marythought added a commit to opentdf/docs that referenced this pull request Apr 21, 2026
…291)

## Summary
- Add `EntityIdentifiers` helper tables and examples for Java and
JavaScript to the EntityIdentifier reference section (now in language
tabs)
- Update all Java examples to use `EntityIdentifiers.forEmail(...)`
instead of verbose `EntityIdentifier.newBuilder().setEntityChain(...)`
construction
- Update all JavaScript examples to use
`EntityIdentifiers.forEmail(...)` instead of verbose nested object
literals
- Update discovery page JS example to use helpers
- Move verbose construction patterns to collapsible `<details>` blocks
for reference

## Related
- opentdf/web-sdk#916 — namespaces JS helpers under `EntityIdentifiers`
(deprecates opentdf/web-sdk#911)
- opentdf/java-sdk#346 — Java `EntityIdentifiers` convenience
constructors
- opentdf/platform#3232 — Go `EntityIdentifier` helpers

## Test plan
- [x] Verify docs build (`npm run build`) passes
- [ ] Check surge preview for correct rendering of helper tables, code
examples, and details blocks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Unified entity identification docs into language-specific tabs with
examples for Go/Java/JavaScript
* Replaced manual nested identifier examples with SDK helper-based
examples across Java and JavaScript; simplified sample payloads for
entitlements and decision requests
* Added JavaScript support for request-token identifiers; clarified when
manual construction (e.g., UUIDs) is still required
  * Linked discovery guide examples to the new helper-based guidance
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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