Skip to content

Commit c80d2a9

Browse files
committed
feat(data-fabric): add roles and directory services
1 parent 616d6d3 commit c80d2a9

26 files changed

Lines changed: 1367 additions & 11 deletions

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ The SDK provides access to the following services through modular imports:
265265
- `CaseInstances` from `@uipath/uipath-typescript/cases` - Manage maestro case executions
266266
- `Tasks` from `@uipath/uipath-typescript/tasks` - Create and manage tasks
267267
- `Entities` from `@uipath/uipath-typescript/entities` - Data Fabric entity operations
268+
- `ChoiceSets` from `@uipath/uipath-typescript/entities` - Data Fabric choice set operations
269+
- `DataFabricRoles` from `@uipath/uipath-typescript/entities` - List Data Fabric access roles
270+
- `DataFabricDirectory` from `@uipath/uipath-typescript/entities` - List directory principals and assign Data Fabric roles
268271
- `Processes` from `@uipath/uipath-typescript/processes` - Manage Orchestrator processes
269272
- `Buckets` from `@uipath/uipath-typescript/buckets` - Manage storage buckets in Orchestrator
270273
- `Queues` from `@uipath/uipath-typescript/queues` - Manage Orchestrator queues
@@ -281,7 +284,12 @@ import { Cases, CaseInstances } from '@uipath/uipath-typescript/cases';
281284
import { Tasks, TaskType } from '@uipath/uipath-typescript/tasks';
282285
import { Processes } from '@uipath/uipath-typescript/processes';
283286
import { Buckets } from '@uipath/uipath-typescript/buckets';
284-
import { Entities } from '@uipath/uipath-typescript/entities';
287+
import {
288+
ChoiceSets,
289+
DataFabricDirectory,
290+
DataFabricRoles,
291+
Entities,
292+
} from '@uipath/uipath-typescript/entities';
285293

286294
// Initialize SDK
287295
const sdk = new UiPath({ /* config */ });
@@ -295,6 +303,9 @@ const tasks = new Tasks(sdk);
295303
const processes = new Processes(sdk);
296304
const buckets = new Buckets(sdk);
297305
const entities = new Entities(sdk);
306+
const choiceSets = new ChoiceSets(sdk);
307+
const dataFabricRoles = new DataFabricRoles(sdk);
308+
const dataFabricDirectory = new DataFabricDirectory(sdk);
298309

299310
// Maestro - Get processes and their instances
300311
const allProcesses = await maestroProcesses.getAll();
@@ -367,6 +378,7 @@ const records = await entities.getAllRecords('entity-uuid', {
367378
pageSize: 100,
368379
expansionLevel: 1
369380
});
381+
const allChoiceSets = await choiceSets.getAll();
370382

371383
// Insert records
372384
await entities.insertRecordsById('entity-uuid', [
@@ -381,6 +393,18 @@ await entities.updateRecordsById('entity-uuid', [
381393

382394
// Delete records
383395
await entities.deleteRecordsById('entity-uuid', ['record-id-1', 'record-id-2']);
396+
397+
// Data Fabric Roles and Directory Access - list and assign access
398+
const roles = await dataFabricRoles.getAll();
399+
const dataWriter = roles.find(role => role.name === 'DataWriter');
400+
401+
if (dataWriter) {
402+
await dataFabricDirectory.assignRoles(
403+
'<identity-group-id>',
404+
'Group',
405+
[dataWriter.id]
406+
);
407+
}
384408
```
385409

386410
</details>

docs/oauth-scopes.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ This page lists the specific OAuth scopes required in external app for each SDK
6767
| `getAll()` | `DataFabric.Schema.Read` |
6868
| `getById()` | `DataFabric.Data.Read` |
6969

70+
## Data Fabric Roles
71+
72+
| Method | OAuth Scope |
73+
|--------|-------------|
74+
| `getAll()` | `DataFabric.Data.Read` |
75+
76+
## Data Fabric Directory
77+
78+
| Method | OAuth Scope |
79+
|--------|-------------|
80+
| `list()` | `DataFabric.Data.Read` |
81+
| `getAll()` | `DataFabric.Data.Read` |
82+
| `assignRoles()` | `DataFabric.Data.Write` |
83+
7084
## Maestro Processes
7185

7286
| Method | OAuth Scope |

docs/pagination.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,19 @@ console.log(`Retrieved ${allAssets.items.length} assets`);
111111
console.log(`Total count: ${allAssets.totalCount}`);
112112
```
113113

114+
### Service-specific Offset Pagination
115+
116+
Some endpoints expose product-native offset parameters instead of the shared cursor/jump wrapper. Data Fabric Directory uses `list({ skip, top })` for a single page, and `getAll({ pageSize })` to fetch every page.
117+
118+
```typescript
119+
import { DataFabricDirectory } from '@uipath/uipath-typescript/entities';
120+
121+
const directory = new DataFabricDirectory(sdk);
122+
123+
const firstPage = await directory.list({ skip: 0, top: 50 });
124+
const allPrincipals = await directory.getAll({ pageSize: 100 });
125+
```
126+
114127
## Quick Reference Table
115128

116129
| Service | Method | Supports `jumpToPage`? |
@@ -122,6 +135,8 @@ console.log(`Total count: ${allAssets.totalCount}`);
122135
| Entities | `getAll()` | ✅ Yes |
123136
| Entities | `getAllRecords()` | ✅ Yes |
124137
| Entities | `queryRecordsById()` | ✅ Yes |
138+
| DataFabricDirectory | `list()` | ❌ No |
139+
| DataFabricDirectory | `getAll()` | ❌ No |
125140
| Processes | `getAll()` | ✅ Yes |
126141
| ProcessInstances | `getAll()` | ❌ No |
127142
| CaseInstances | `getAll()` | ❌ No |
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import {
2+
DataFabricDirectoryEntityType,
3+
DataFabricDirectoryEntry,
4+
} from './directory.types';
5+
6+
export interface DataFabricDirectoryAssignPayload {
7+
directoryEntities: Array<{
8+
externalId: string;
9+
type: DataFabricDirectoryEntityType;
10+
resolved: true;
11+
}>;
12+
roles: string[];
13+
isUIEnabled: boolean;
14+
}
15+
16+
export interface RawDataFabricDirectoryListResponse {
17+
totalCount?: number;
18+
TotalCount?: number;
19+
results?: DataFabricDirectoryEntry[];
20+
Results?: DataFabricDirectoryEntry[];
21+
value?: DataFabricDirectoryEntry[];
22+
Value?: DataFabricDirectoryEntry[];
23+
data?: DataFabricDirectoryEntry[];
24+
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
import {
2+
DataFabricDirectoryAssignOptions,
3+
DataFabricDirectoryAssignmentResult,
4+
DataFabricDirectoryEntityTypeInput,
5+
DataFabricDirectoryEntry,
6+
DataFabricDirectoryGetAllOptions,
7+
DataFabricDirectoryListOptions,
8+
DataFabricDirectoryListResponse,
9+
} from './directory.types';
10+
11+
export interface DataFabricDirectoryServiceModel {
12+
/**
13+
* Lists one page of Data Fabric directory principals and their current roles.
14+
*
15+
* Returns directory entries with external IDs, principal metadata, and
16+
* assigned Data Fabric roles.
17+
*
18+
* @param options - Optional offset paging options
19+
* @returns Promise resolving to {@link DataFabricDirectoryListResponse}
20+
*
21+
* @example
22+
* ```typescript
23+
* import { DataFabricDirectory } from '@uipath/uipath-typescript/entities';
24+
*
25+
* const directory = new DataFabricDirectory(sdk);
26+
* const page = await directory.list({ skip: 0, top: 50 });
27+
* const firstPrincipal = page.results[0];
28+
* ```
29+
*/
30+
list(options?: DataFabricDirectoryListOptions): Promise<DataFabricDirectoryListResponse>;
31+
32+
/**
33+
* Lists all Data Fabric directory principals and their current roles.
34+
*
35+
* Follows the Data Fabric directory top/skip pagination and returns
36+
* normalized entries. Entries without assigned roles include an empty
37+
* `roles` array.
38+
*
39+
* @param options - Optional page-size options
40+
* @returns Promise resolving to an array of {@link DataFabricDirectoryEntry}
41+
*
42+
* @example
43+
* ```typescript
44+
* import { DataFabricDirectory } from '@uipath/uipath-typescript/entities';
45+
*
46+
* const directory = new DataFabricDirectory(sdk);
47+
* const principals = await directory.getAll({ pageSize: 100 });
48+
* ```
49+
*/
50+
getAll(options?: DataFabricDirectoryGetAllOptions): Promise<DataFabricDirectoryEntry[]>;
51+
52+
/**
53+
* Assigns Data Fabric roles to one or more principals.
54+
*
55+
* The Data Fabric API replaces the role set for each principal, so this
56+
* method preserves existing roles by default and posts the union of current
57+
* and requested role IDs.
58+
*
59+
* Role IDs can be discovered with `DataFabricRoles.getAll()`. Set
60+
* `preserveExisting: false` only when intentionally replacing a principal's
61+
* Data Fabric role set.
62+
*
63+
* @param principalIds - Principal external ID or IDs
64+
* @param principalType - Principal type
65+
* @param roleIds - Data Fabric role IDs to assign
66+
* @param options - Optional assignment behavior
67+
* @returns Promise resolving to assignment results per principal
68+
*
69+
* @example
70+
* ```typescript
71+
* import { DataFabricDirectory, DataFabricRoles } from '@uipath/uipath-typescript/entities';
72+
*
73+
* const roles = new DataFabricRoles(sdk);
74+
* const directory = new DataFabricDirectory(sdk);
75+
*
76+
* const dataWriter = (await roles.getAll()).find(role => role.name === 'DataWriter');
77+
* if (!dataWriter) {
78+
* throw new Error('DataWriter role not found');
79+
* }
80+
*
81+
* await directory.assignRoles('<identity-group-id>', 'Group', [dataWriter.id]);
82+
* ```
83+
*
84+
* @example
85+
* ```typescript
86+
* await directory.assignRoles('<identity-user-id>', 'User', ['<role-id>'], {
87+
* preserveExisting: false,
88+
* });
89+
* ```
90+
*/
91+
assignRoles(
92+
principalIds: string | string[],
93+
principalType: DataFabricDirectoryEntityTypeInput,
94+
roleIds: string[],
95+
options?: DataFabricDirectoryAssignOptions
96+
): Promise<DataFabricDirectoryAssignmentResult[]>;
97+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
export enum DataFabricDirectoryEntityType {
2+
/** Identity user, robot user, or directory robot principal. */
3+
User = 0,
4+
/** Identity group principal. */
5+
Group = 1,
6+
/** External application principal. */
7+
Application = 2,
8+
}
9+
10+
export type DataFabricDirectoryEntityTypeInput =
11+
| DataFabricDirectoryEntityType
12+
| 'User'
13+
| 'user'
14+
| 'Group'
15+
| 'group'
16+
| 'DirectoryGroup'
17+
| 'directoryGroup'
18+
| 'Application'
19+
| 'application'
20+
| 'ExternalApplication'
21+
| 'externalApplication'
22+
| 'DirectoryExternalApplication'
23+
| 'directoryExternalApplication'
24+
| 'Robot'
25+
| 'robot'
26+
| 'DirectoryRobot'
27+
| 'directoryRobot'
28+
| 'DirectoryRobotUser'
29+
| 'directoryRobotUser';
30+
31+
export interface DataFabricDirectoryRole {
32+
id: string;
33+
name?: string;
34+
[key: string]: unknown;
35+
}
36+
37+
export interface DataFabricDirectoryEntry {
38+
externalId: string;
39+
name?: string;
40+
email?: string;
41+
type?: string | number;
42+
roles: DataFabricDirectoryRole[];
43+
objectType?: string;
44+
isUIEnabled?: boolean;
45+
[key: string]: unknown;
46+
}
47+
48+
export interface DataFabricDirectoryListOptions {
49+
skip?: number;
50+
top?: number;
51+
}
52+
53+
export interface DataFabricDirectoryGetAllOptions {
54+
pageSize?: number;
55+
}
56+
57+
export interface DataFabricDirectoryListResponse {
58+
totalCount?: number;
59+
results: DataFabricDirectoryEntry[];
60+
}
61+
62+
export interface DataFabricDirectoryAssignOptions {
63+
/**
64+
* Preserve the principal's current Data Fabric roles.
65+
*
66+
* Defaults to true because the Data Fabric role assignment endpoint replaces
67+
* the role set for each principal.
68+
*/
69+
preserveExisting?: boolean;
70+
/**
71+
* Enables Data Fabric UI access for the assigned principal.
72+
*
73+
* Defaults to true.
74+
*/
75+
uiEnabled?: boolean;
76+
}
77+
78+
export interface DataFabricDirectoryAssignmentResult {
79+
principalId: string;
80+
roleIds: string[];
81+
}

src/models/data-fabric/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
export * from './entities.types';
22
export * from './entities.models';
33
export * from './choicesets.types';
4-
export * from './choicesets.models';
4+
export * from './choicesets.models';
5+
export * from './roles.types';
6+
export * from './roles.models';
7+
export * from './directory.types';
8+
export * from './directory.models';
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { DataFabricRole } from './roles.types';
2+
3+
export interface RawDataFabricRoleListResponse {
4+
results?: DataFabricRole[];
5+
Results?: DataFabricRole[];
6+
value?: DataFabricRole[];
7+
Value?: DataFabricRole[];
8+
data?: DataFabricRole[];
9+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { DataFabricRole, DataFabricRoleGetAllOptions } from './roles.types';
2+
3+
export interface DataFabricRoleServiceModel {
4+
/**
5+
* Lists Data Fabric access roles.
6+
*
7+
* Returns tenant Data Fabric roles such as Admin, Designer, DataWriter, and
8+
* DataReader. Role IDs from this method can be passed to
9+
* `DataFabricDirectory.assignRoles()`.
10+
*
11+
* @param options - Optional query options
12+
* @returns Promise resolving to an array of {@link DataFabricRole}
13+
*
14+
* @example
15+
* ```typescript
16+
* import { DataFabricRoles } from '@uipath/uipath-typescript/entities';
17+
*
18+
* const roles = new DataFabricRoles(sdk);
19+
* const allRoles = await roles.getAll();
20+
* const dataWriter = allRoles.find(role => role.name === 'DataWriter');
21+
* ```
22+
*
23+
* @example
24+
* ```typescript
25+
* const rolesWithoutStats = await roles.getAll({ stats: false });
26+
* ```
27+
*/
28+
getAll(options?: DataFabricRoleGetAllOptions): Promise<DataFabricRole[]>;
29+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
export interface DataFabricRole {
2+
id: string;
3+
name: string;
4+
displayName?: string;
5+
description?: string;
6+
isSystem?: boolean;
7+
[key: string]: unknown;
8+
}
9+
10+
export interface DataFabricRoleGetAllOptions {
11+
/**
12+
* Include role statistics in the response.
13+
*
14+
* Defaults to true to match the Data Fabric UI and CLI role-list flow.
15+
*/
16+
stats?: boolean;
17+
}

0 commit comments

Comments
 (0)