Skip to content

Commit d43919c

Browse files
marythoughtclaude
andauthored
feat(sdk): re-export policy enums from barrel for convenient imports (#928)
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). Signed-off-by: Mary Dickson <mary.dickson@virtru.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 037e43e commit d43919c

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

lib/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ export {
1919
type ExternalJwtTokenProviderOptions,
2020
} from './auth/token-providers.js';
2121
export { attributeFQNsAsValues } from './policy/api.js';
22+
export {
23+
AttributeRuleTypeEnum,
24+
ConditionBooleanTypeEnum,
25+
SubjectMappingOperatorEnum,
26+
} from './platform/policy/objects_pb.js';
27+
export { ActiveStateEnum } from './platform/common/common_pb.js';
2228
export * as EntityIdentifiers from './platform/authorization/entity-identifiers.js';
2329
export * as Resources from './platform/authorization/resources.js';
2430
/** @deprecated Use `EntityIdentifiers.forEmail()` instead. Will be removed in a future release. */
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { expect } from 'chai';
2+
import {
3+
ActiveStateEnum,
4+
AttributeRuleTypeEnum,
5+
ConditionBooleanTypeEnum,
6+
SubjectMappingOperatorEnum,
7+
} from '../../../src/index.js';
8+
9+
describe('Policy enum re-exports', () => {
10+
it('exports SubjectMappingOperatorEnum with expected values', () => {
11+
expect(SubjectMappingOperatorEnum.IN).to.equal(1);
12+
expect(SubjectMappingOperatorEnum.NOT_IN).to.equal(2);
13+
expect(SubjectMappingOperatorEnum.IN_CONTAINS).to.equal(3);
14+
});
15+
16+
it('exports ConditionBooleanTypeEnum with expected values', () => {
17+
expect(ConditionBooleanTypeEnum.AND).to.equal(1);
18+
expect(ConditionBooleanTypeEnum.OR).to.equal(2);
19+
});
20+
21+
it('exports AttributeRuleTypeEnum with expected values', () => {
22+
expect(AttributeRuleTypeEnum.ALL_OF).to.equal(1);
23+
expect(AttributeRuleTypeEnum.ANY_OF).to.equal(2);
24+
expect(AttributeRuleTypeEnum.HIERARCHY).to.equal(3);
25+
});
26+
27+
it('exports ActiveStateEnum with expected values', () => {
28+
expect(ActiveStateEnum.ACTIVE).to.equal(1);
29+
expect(ActiveStateEnum.INACTIVE).to.equal(2);
30+
expect(ActiveStateEnum.ANY).to.equal(3);
31+
});
32+
});

0 commit comments

Comments
 (0)