Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ coverage-integration/
logs/
*.log

# Local smoke and scratch files
.tmp/

# Optional npm cache directory
.npm

Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ The SDK provides access to the following services through modular imports:
- `CaseInstances` from `@uipath/uipath-typescript/cases` - Manage maestro case executions
- `Tasks` from `@uipath/uipath-typescript/tasks` - Create and manage tasks
- `Entities` from `@uipath/uipath-typescript/entities` - Data Fabric entity operations
- `ChoiceSets` from `@uipath/uipath-typescript/entities` - Data Fabric choice set operations
- `Processes` from `@uipath/uipath-typescript/processes` - Manage Orchestrator processes
- `Buckets` from `@uipath/uipath-typescript/buckets` - Manage storage buckets in Orchestrator
- `Queues` from `@uipath/uipath-typescript/queues` - Manage Orchestrator queues
Expand All @@ -281,7 +282,7 @@ import { Cases, CaseInstances } from '@uipath/uipath-typescript/cases';
import { Tasks, TaskType } from '@uipath/uipath-typescript/tasks';
import { Processes } from '@uipath/uipath-typescript/processes';
import { Buckets } from '@uipath/uipath-typescript/buckets';
import { Entities } from '@uipath/uipath-typescript/entities';
import { ChoiceSets, Entities } from '@uipath/uipath-typescript/entities';

// Initialize SDK
const sdk = new UiPath({ /* config */ });
Expand All @@ -295,6 +296,7 @@ const tasks = new Tasks(sdk);
const processes = new Processes(sdk);
const buckets = new Buckets(sdk);
const entities = new Entities(sdk);
const choiceSets = new ChoiceSets(sdk);

// Maestro - Get processes and their instances
const allProcesses = await maestroProcesses.getAll();
Expand Down Expand Up @@ -367,6 +369,7 @@ const records = await entities.getAllRecords('entity-uuid', {
pageSize: 100,
expansionLevel: 1
});
const allChoiceSets = await choiceSets.getAll();

// Insert records
await entities.insertRecordsById('entity-uuid', [
Expand Down
38 changes: 38 additions & 0 deletions src/models/data-fabric/directory.internal-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {
DataFabricDirectoryEntityType,
DataFabricDirectoryEntityTypeName,
} from './directory.types';

export interface DataFabricDirectoryAssignPayload {
directoryEntities: Array<{
externalId: string;
type: DataFabricDirectoryEntityType;
resolved: true;
}>;
roles: string[];
isUIEnabled: boolean;
}

export interface DataFabricDirectoryRevokePayload {
externalIds: string[];
}

export interface RawDataFabricDirectoryRole {
id: string;
name: string;
}

export interface RawDataFabricDirectoryEntry {
externalId: string;
name: string;
email?: string | null;
type: DataFabricDirectoryEntityTypeName;
roles?: RawDataFabricDirectoryRole[] | null;
objectType?: string | null;
isUIEnabled: boolean;
}

export interface RawDataFabricDirectoryListResponse {
totalCount: number;
results: RawDataFabricDirectoryEntry[];
}
137 changes: 137 additions & 0 deletions src/models/data-fabric/directory.models.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
import {
DataFabricDirectoryAssignOptions,
DataFabricDirectoryAssignmentResult,
DataFabricDirectoryEntityTypeInput,
DataFabricDirectoryEntry,
DataFabricDirectoryGetAllOptions,
DataFabricDirectoryListOptions,
DataFabricDirectoryListResponse,
} from './directory.types';

/**
* @internal
*/
export interface DataFabricDirectoryServiceModel {
/**
* Lists one page of Data Fabric directory principals and their current roles.
*
* Returns directory entries with external IDs, principal metadata, and
* assigned Data Fabric roles.
*
* @param options - Optional offset paging options
* @returns Promise resolving to {@link DataFabricDirectoryListResponse}
*
* @example
* ```typescript
* import { DataFabricDirectoryService } from '@uipath/uipath-typescript/entities';
*
* const directory = new DataFabricDirectoryService(sdk);
* const page = await directory.list({ skip: 0, top: 50 });
* const firstPrincipal = page.results[0];
* ```
*
* @internal
*/
list(options?: DataFabricDirectoryListOptions): Promise<DataFabricDirectoryListResponse>;

/**
* Lists all Data Fabric directory principals and their current roles.
*
* Follows the Data Fabric directory top/skip pagination and returns
* normalized entries. Entries without assigned roles include an empty
* `roles` array.
*
* @param options - Optional page-size options
* @returns Promise resolving to an array of {@link DataFabricDirectoryEntry}
*
* @example
* ```typescript
* import { DataFabricDirectoryService } from '@uipath/uipath-typescript/entities';
*
* const directory = new DataFabricDirectoryService(sdk);
* const principals = await directory.getAll({ pageSize: 100 });
* ```
*
* @internal
*/
getAll(options?: DataFabricDirectoryGetAllOptions): Promise<DataFabricDirectoryEntry[]>;

/**
* Assigns Data Fabric roles to one or more principals.
*
* The Data Fabric API replaces the role set for each principal, so this
* method preserves existing roles by default and posts the union of current
* and requested role IDs.
*
* Role IDs can be discovered with `DataFabricRoleService.getAll()`. Set
* `preserveExisting: false` only when intentionally replacing a principal's
* Data Fabric role set.
*
* @param principalIds - Principal external ID or IDs
* @param principalType - Principal type
* @param roleIds - Data Fabric role IDs to assign
* @param options - Optional assignment behavior
* @returns Promise resolving to an array of {@link DataFabricDirectoryAssignmentResult}
*
* @example
* ```typescript
* import { DataFabricDirectoryEntityTypeName, DataFabricDirectoryService, DataFabricRoleService } from '@uipath/uipath-typescript/entities';
*
* const roles = new DataFabricRoleService(sdk);
* const directory = new DataFabricDirectoryService(sdk);
*
* const dataWriter = (await roles.getAll()).find(role => role.name === 'DataWriter');
* if (!dataWriter) {
* throw new Error('DataWriter role not found');
* }
*
* await directory.assignRoles('<identity-group-id>', DataFabricDirectoryEntityTypeName.Group, [dataWriter.id]);
* ```
*
* @example
* ```typescript
* await directory.assignRoles('<identity-user-id>', DataFabricDirectoryEntityTypeName.User, ['<role-id>'], {
* preserveExisting: false,
* });
* ```
*
* @internal
*/
assignRoles(
principalIds: string | string[],
principalType: DataFabricDirectoryEntityTypeInput,
roleIds: string[],
options?: DataFabricDirectoryAssignOptions
): Promise<DataFabricDirectoryAssignmentResult[]>;

/**
* Revokes all direct Data Fabric roles from one or more principals.
*
* The Data Fabric API removes all role assignments for each supplied external
* ID. Use this when a principal should no longer have direct Data Fabric
* access. Inherited access through groups is not changed.
*
* @param principalIds - Principal external ID or IDs
* @returns Promise resolving when the roles are revoked
*
* @example
* ```typescript
* import { DataFabricDirectoryService } from '@uipath/uipath-typescript/entities';
*
* const directory = new DataFabricDirectoryService(sdk);
*
* await directory.revokeRoles('<identity-user-id>');
* ```
*
* @example
* ```typescript
* await directory.revokeRoles([
* '<identity-user-id>',
* '<identity-group-id>',
* ]);
* ```
*
* @internal
*/
revokeRoles(principalIds: string | string[]): Promise<void>;
}
98 changes: 98 additions & 0 deletions src/models/data-fabric/directory.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/**
* @internal
*/
export enum DataFabricDirectoryEntityType {
/** Identity user, robot user, or directory robot principal. */
User = 0,
/** Identity group principal. */
Group = 1,
/** External application principal. */
Application = 2,
}

/**
* @internal
*/
export enum DataFabricDirectoryEntityTypeName {
User = 'User',
Group = 'Group',
Application = 'Application',
}

/**
* @internal
*/
export type DataFabricDirectoryEntityTypeInput =
| DataFabricDirectoryEntityType
| DataFabricDirectoryEntityTypeName;

/**
* @internal
*/
export interface DataFabricDirectoryRole {
id: string;
name: string;
}

/**
* @internal
*/
export interface DataFabricDirectoryEntry {
externalId: string;
name: string;
email?: string | null;
type: DataFabricDirectoryEntityTypeName;
roles: DataFabricDirectoryRole[];
objectType?: string | null;
isUIEnabled: boolean;
}

/**
* @internal
*/
export interface DataFabricDirectoryListOptions {
skip?: number;
top?: number;
}

/**
* @internal
*/
export interface DataFabricDirectoryGetAllOptions {
pageSize?: number;
}

/**
* @internal
*/
export interface DataFabricDirectoryListResponse {
totalCount: number;
results: DataFabricDirectoryEntry[];
}

/**
* @internal
*/
export interface DataFabricDirectoryAssignOptions {
/**
* Preserve the principal's current Data Fabric roles.
*
* Defaults to true because the Data Fabric role assignment endpoint replaces
* the role set for each principal.
*/
preserveExisting?: boolean;
/**
* Enables Data Fabric UI access for the assigned principal.
*
* Defaults to true.
*/
uiEnabled?: boolean;
}

/**
* @internal
*/
export interface DataFabricDirectoryAssignmentResult {
principalId: string;
roleIds: string[];
}
2 changes: 1 addition & 1 deletion src/models/data-fabric/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './entities.types';
export * from './entities.models';
export * from './choicesets.types';
export * from './choicesets.models';
export * from './choicesets.models';
39 changes: 39 additions & 0 deletions src/models/data-fabric/roles.models.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { DataFabricRole, DataFabricRoleGetAllOptions } from './roles.types';

/**
* @internal
*/
export interface DataFabricRoleServiceModel {
/**
* Lists Data Fabric access roles.
*
* Returns tenant Data Fabric roles such as Admin, Designer, DataWriter, and
* DataReader. Role IDs from this method can be passed to
* `DataFabricDirectoryService.assignRoles()`.
*
* @param options - Optional query options
* @returns Promise resolving to an array of {@link DataFabricRole}
*
* @example
* ```typescript
* import { DataFabricRoleService } from '@uipath/uipath-typescript/entities';
*
* const roles = new DataFabricRoleService(sdk);
* const allRoles = await roles.getAll();
* const dataWriter = allRoles.find(role => role.name === 'DataWriter');
* ```
*
* @example
* ```typescript
* const rolesWithoutStats = await roles.getAll({ stats: false });
* ```
*
* @example
* ```typescript
* const folderRoles = await roles.getAll({ folderKey: '<folder-key>' });
Comment thread
dsuresh-ap marked this conversation as resolved.
* ```
*
* @internal
*/
getAll(options?: DataFabricRoleGetAllOptions): Promise<DataFabricRole[]>;
Comment thread
dsuresh-ap marked this conversation as resolved.
}
Loading
Loading