feat(sdk): re-export policy enums from barrel for convenient imports#928
feat(sdk): re-export policy enums from barrel for convenient imports#928marythought merged 1 commit intomainfrom
Conversation
Re-export SubjectMappingOperatorEnum, ConditionBooleanTypeEnum, AttributeRuleTypeEnum, and ActiveStateEnum from the main @opentdf/sdk entry point so users can import them directly instead of reaching into generated proto paths. Companion to opentdf/platform#3408 (Go SDK) and opentdf/java-sdk#357 (Java SDK). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe module's public API is extended by re-exporting four enums: Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request re-exports several policy-related enums, including AttributeRuleTypeEnum, ConditionBooleanTypeEnum, SubjectMappingOperatorEnum, and ActiveStateEnum, from the platform protobuf definitions in the main index file. It also adds a unit test suite to verify that these enums are correctly exported with their expected numeric values. I have no feedback to provide.
|
Nice! Originally we didn't export much from the generated protos stubs because we really didn't know what consumers might need. |
## Summary - Update Go SDK code samples to use the new shorthand enum constants (`policy.OperatorIn`, `policy.BooleanAnd`, `policy.RuleAnyOf`) instead of verbose proto enum names - Update JS SDK imports to use barrel exports from `@opentdf/sdk` instead of deep proto paths (`@opentdf/sdk/platform/policy/objects_pb.js`) - Update JS SDK examples to use enum values (`ConditionBooleanTypeEnum.AND`) instead of string literals (`'CONDITION_BOOLEAN_TYPE_ENUM_AND'`) - Update Java SDK inline examples in policy.mdx to use `PolicyEnums` shorthand constants - Add `SdkVersion` badges with `NEXT` placeholders — replace with actual versions once SDK releases ship ### Companion PRs | SDK | PR | Status | |---|---|---| | Go | opentdf/platform#3408 | Open | | Java | opentdf/java-sdk#357 | Open | | JavaScript | opentdf/web-sdk#928 | Open | ### Note on Java code samples The `code_samples/java/` files are pulled from the java-sdk repo at build time via `docusaurus-plugin-remote-content`. They will update automatically once `javaSdkVersion` is bumped in `docusaurus.config.ts` after the java-sdk release containing opentdf/java-sdk#357. ## Test plan - [x] `npm run build` passes - [ ] Surge preview renders correctly - [ ] Replace `NEXT` version placeholders after SDK releases 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Updated policy and quickstart code examples for Go, Java, and JavaScript to use simplified SDK enum constants for clearer, more idiomatic samples. * Switched JavaScript examples to use package entry-point imports instead of generated-module paths. * Added SDK version markers to code samples to show explicit language/version context and improve consistency. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Mary Dickson <mary.dickson@virtru.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
SubjectMappingOperatorEnum,ConditionBooleanTypeEnum,AttributeRuleTypeEnum, andActiveStateEnumfrom the main@opentdf/sdkentry pointBefore / After
Usage is the same either way — the TS enum names are already short:
Test plan
npx tsc --noEmitpassesnpm run buildsucceedsnpx mocha 'dist/web/tests/mocha/unit/policy-enums.spec.js'— 4 tests, all passnpm run format— no changes needed🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
AttributeRuleTypeEnum,ConditionBooleanTypeEnum,SubjectMappingOperatorEnum, andActiveStateEnumfor policy and state management configuration.Tests