Skip to content

Commit 33b167c

Browse files
dsuresh-apclaude
andcommitted
fix(data-fabric): export roles and directory types from barrels [AGVSOL-3062]
The DataFabricRoleService and DataFabricDirectoryService classes were exported from the /entities subpath, but their option/response types and enums (e.g. DataFabricDirectoryEntityTypeInput) were not re-exported, forcing consumers like the CLI to derive them via Parameters<> from method signatures. Re-export roles/directory types and ServiceModel interfaces through the entities subpath and main barrels. All symbols keep their @internal JSDoc tags, so the generated docs are unchanged. Follow-up to review comments on UiPath/cli#2891. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 621cd48 commit 33b167c

3 files changed

Lines changed: 80 additions & 0 deletions

File tree

src/models/data-fabric/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ export * from './entities.types';
22
export * from './entities.models';
33
export * from './choicesets.types';
44
export * from './choicesets.models';
5+
export * from './roles.types';
6+
export * from './roles.models';
7+
export * from './directory.types';
8+
export * from './directory.models';

src/services/data-fabric/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,7 @@ export { LogicalOperator, QueryFilterOperator } from '../../models/data-fabric/e
3737
export * from '../../models/data-fabric/entities.models';
3838
export * from '../../models/data-fabric/choicesets.types';
3939
export * from '../../models/data-fabric/choicesets.models';
40+
export * from '../../models/data-fabric/roles.types';
41+
export * from '../../models/data-fabric/roles.models';
42+
export * from '../../models/data-fabric/directory.types';
43+
export * from '../../models/data-fabric/directory.models';
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import { describe, it, expect } from 'vitest';
2+
import {
3+
DataFabricDirectoryEntityType,
4+
DataFabricDirectoryEntityTypeName,
5+
DataFabricDirectoryService,
6+
DataFabricRoleService,
7+
DataFabricRoleType,
8+
type DataFabricDirectoryAssignOptions,
9+
type DataFabricDirectoryAssignmentResult,
10+
type DataFabricDirectoryEntityTypeInput,
11+
type DataFabricDirectoryEntry,
12+
type DataFabricDirectoryGetAllOptions,
13+
type DataFabricDirectoryListOptions,
14+
type DataFabricDirectoryListResponse,
15+
type DataFabricDirectoryServiceModel,
16+
type DataFabricRole,
17+
type DataFabricRoleGetAllOptions,
18+
type DataFabricRoleServiceModel,
19+
} from '../../../../src/services/data-fabric';
20+
21+
describe('Data Fabric barrel exports', () => {
22+
it('should export roles and directory runtime values from the entities subpath barrel', () => {
23+
expect(DataFabricDirectoryService).toBeTypeOf('function');
24+
expect(DataFabricRoleService).toBeTypeOf('function');
25+
expect(DataFabricDirectoryEntityType.Group).toBe(1);
26+
expect(DataFabricDirectoryEntityTypeName.Group).toBe('Group');
27+
expect(DataFabricRoleType.System).toBe('System');
28+
});
29+
30+
it('should export roles and directory types usable in consumer signatures', () => {
31+
// Compile-time check: assigning to the exported types verifies they are
32+
// re-exported through the barrel; a removal breaks typecheck, not runtime.
33+
const principalType: DataFabricDirectoryEntityTypeInput =
34+
DataFabricDirectoryEntityTypeName.User;
35+
const assignOptions: DataFabricDirectoryAssignOptions = { preserveExisting: false };
36+
const listOptions: DataFabricDirectoryListOptions = { top: 1 };
37+
const getAllOptions: DataFabricDirectoryGetAllOptions = { pageSize: 1 };
38+
const roleOptions: DataFabricRoleGetAllOptions = { stats: false };
39+
const role: DataFabricRole = {
40+
id: 'role-id',
41+
name: 'DataWriter',
42+
type: DataFabricRoleType.UserDefined,
43+
};
44+
const entry: DataFabricDirectoryEntry = {
45+
externalId: 'external-id',
46+
name: 'Automation Users',
47+
type: DataFabricDirectoryEntityTypeName.Group,
48+
roles: [{ id: role.id, name: role.name }],
49+
isUIEnabled: true,
50+
};
51+
const listResponse: DataFabricDirectoryListResponse = {
52+
totalCount: 1,
53+
results: [entry],
54+
};
55+
const assignmentResult: DataFabricDirectoryAssignmentResult = {
56+
principalId: entry.externalId,
57+
roleIds: [role.id],
58+
};
59+
const directoryModel: DataFabricDirectoryServiceModel | undefined = undefined;
60+
const roleModel: DataFabricRoleServiceModel | undefined = undefined;
61+
62+
expect(principalType).toBe(DataFabricDirectoryEntityTypeName.User);
63+
expect(assignOptions.preserveExisting).toBe(false);
64+
expect(listOptions.top).toBe(1);
65+
expect(getAllOptions.pageSize).toBe(1);
66+
expect(roleOptions.stats).toBe(false);
67+
expect(listResponse.results[0]).toBe(entry);
68+
expect(assignmentResult.roleIds).toEqual([role.id]);
69+
expect(directoryModel).toBeUndefined();
70+
expect(roleModel).toBeUndefined();
71+
});
72+
});

0 commit comments

Comments
 (0)