import { IUiPath } from '../core/index'; declare enum ComparisonOperator { Equals = "Equals", NotEquals = "NotEquals", Greater = "Greater", Less = "Less", GreaterOrEqual = "GreaterOrEqual", LessOrEqual = "LessOrEqual" } declare enum Criticality { Must = "Must", Should = "Should" } declare enum FieldType { Text = "Text", Number = "Number", Date = "Date", Name = "Name", Address = "Address", Keyword = "Keyword", Set = "Set", Boolean = "Boolean", Table = "Table", Internal = "Internal", FieldGroup = "FieldGroup", MonetaryQuantity = "MonetaryQuantity" } declare enum LogicalOperator { AND = "AND", OR = "OR" } declare enum RuleType { Mandatory = "Mandatory", PossibleValues = "PossibleValues", Regex = "Regex", StartsWith = "StartsWith", EndsWith = "EndsWith", FixedLength = "FixedLength", IsNumeric = "IsNumeric", IsDate = "IsDate", IsEmail = "IsEmail", Contains = "Contains", Expression = "Expression", TableExpression = "TableExpression", IsEmpty = "IsEmpty" } interface DataSource { ResourceId?: string | null; ElementFieldId?: string | null; } interface DocumentGroup { Name?: string | null; Categories?: string[] | null; } interface DocumentTaxonomy { DataContractVersion?: string | null; DocumentTypes?: DocumentTypeEntity[] | null; Groups?: DocumentGroup[] | null; SupportedLanguages?: LanguageInfo[] | null; ReportAsExceptionSettings?: ReportAsExceptionSettings; } interface DocumentTypeEntity { DocumentTypeId?: string | null; Group?: string | null; Category?: string | null; Name?: string | null; OptionalUniqueIdentifier?: string | null; TypeField?: TypeField; Fields?: Field[] | null; Metadata?: MetadataEntry[] | null; } interface ExceptionReasonOption { ExceptionReason?: string | null; } interface Field { FieldId?: string | null; FieldName?: string | null; IsMultiValue?: boolean; Type?: FieldType; DeriveFieldsFormat?: string | null; Components?: Field[] | null; SetValues?: string[] | null; Metadata?: MetadataEntry[] | null; RuleSet?: RuleSet; DefaultValue?: string | null; DataSource?: DataSource; } interface LanguageInfo { Name?: string | null; Code?: string | null; } interface MetadataEntry { Key?: string | null; Value?: string | null; } interface ReportAsExceptionSettings { ExceptionReasonOptions?: ExceptionReasonOption[] | null; } interface Rule { Name?: string | null; Type?: RuleType; LogicalOperator?: LogicalOperator; ComparisonOperator?: ComparisonOperator; Expression?: string | null; SetValues?: string[] | null; } interface RuleSet { Criticality?: Criticality; Rules?: Rule[] | null; } interface TypeField { FieldId?: string | null; FieldName?: string | null; } interface FieldValue { Value?: string | null; DerivedValue?: string | null; } interface FieldValueResult { Value?: FieldValue; IsValid?: boolean; Rules?: RuleResult[] | null; } interface RuleResult { Rule?: Rule; IsValid?: boolean; } interface RuleSetResult { FieldId?: string | null; FieldType?: FieldType; Criticality?: Criticality; IsValid?: boolean; Results?: FieldValueResult[] | null; BrokenRules?: Rule[] | null; RowIndex?: number | null; TableFieldId?: string | null; } declare enum TextType { Unknown = "Unknown", Text = "Text", Checkbox = "Checkbox", Handwriting = "Handwriting", Barcode = "Barcode", QRcode = "QRcode", Stamp = "Stamp", Logo = "Logo", Circle = "Circle", Underline = "Underline", Cut = "Cut" } declare enum ResultsDataSource { Automatic = "Automatic", Manual = "Manual", ManuallyChanged = "ManuallyChanged", Defaulted = "Defaulted", External = "External" } interface ExtractionResult { DocumentId?: string | null; ResultsVersion?: number; ResultsDocument?: ResultsDocument; ExtractorPayloads?: ExtractorPayload[] | null; BusinessRulesResults?: RuleSetResult[] | null; } interface ExtractorPayload { Id?: string | null; Payload?: string | null; SavedPayloadId?: string | null; TaxonomySchemaMapping?: string | null; } interface ResultsContentReference { TextStartIndex?: number; TextLength?: number; Tokens?: ResultsValueTokens[] | null; } interface ResultsDataPoint { FieldId?: string | null; FieldName?: string | null; FieldType?: FieldType; IsMissing?: boolean; DataSource?: ResultsDataSource; Values?: ResultsValue[] | null; DataVersion?: number; OperatorConfirmed?: boolean; ValidatorNotes?: string | null; ValidatorNotesInfo?: string | null; } interface ResultsDerivedField { FieldId?: string | null; Value?: string | null; } interface ResultsDocument { Bounds?: ResultsDocumentBounds; Language?: string | null; DocumentGroup?: string | null; DocumentCategory?: string | null; DocumentTypeId?: string | null; DocumentTypeName?: string | null; DocumentTypeDataVersion?: number; DataVersion?: number; DocumentTypeSource?: ResultsDataSource; DocumentTypeField?: ResultsValue; Fields?: ResultsDataPoint[] | null; Tables?: ResultsTable[] | null; } interface ResultsDocumentBounds { PageCount?: number; PageRange?: string | null; } interface ResultsTable { FieldId?: string | null; FieldName?: string | null; IsMissing?: boolean; DataSource?: ResultsDataSource; DataVersion?: number; OperatorConfirmed?: boolean; Values?: ResultsTableValue[] | null; ValidatorNotes?: string | null; ValidatorNotesInfo?: string | null; } interface ResultsTableCell { RowIndex?: number; ColumnIndex?: number; IsHeader?: boolean; IsMissing?: boolean; OperatorConfirmed?: boolean; DataSource?: ResultsDataSource; DataVersion?: number; Values?: ResultsValue[] | null; } interface ResultsTableColumnInfo { FieldId?: string | null; FieldName?: string | null; FieldType?: FieldType; } interface ResultsTableValue { OperatorConfirmed?: boolean; Confidence?: number; OcrConfidence?: number; Cells?: ResultsTableCell[] | null; ColumnInfo?: ResultsTableColumnInfo[] | null; NumberOfRows?: number; ValidatorNotes?: string | null; ValidatorNotesInfo?: string | null; } interface ResultsValue { Components?: ResultsDataPoint[] | null; Value?: string | null; UnformattedValue?: string | null; Reference?: ResultsContentReference; DerivedFields?: ResultsDerivedField[] | null; Confidence?: number; OperatorConfirmed?: boolean; OcrConfidence?: number; TextType?: TextType; ValidatorNotes?: string | null; ValidatorNotesInfo?: string | null; } interface ResultsValueTokens { TextStartIndex?: number; TextLength?: number; Page?: number; PageWidth?: number; PageHeight?: number; Boxes?: number[][] | null; } interface BaseOptions { expand?: string; select?: string; } /** * Options that scope a name-based lookup (e.g. `getByName`) to a folder. * Provide one of `folderId`, `folderKey`, or `folderPath`. When more than * one is supplied, all are forwarded; the server applies precedence * `folderPath` > `folderKey` > `folderId`. */ interface FolderScopedOptions extends BaseOptions { /** Numeric folder ID. */ folderId?: number; /** Folder key (GUID-formatted string). */ folderKey?: string; /** Slash-delimited folder path, e.g. `'Shared/Finance'`. */ folderPath?: string; } /** * Echoed payload returned alongside an exception-report submission. */ interface ExceptionReportSubmitResult { /** Document identifier the exception was reported against. */ DocumentId: string | null; /** Reason captured for the exception. */ Reason: string | null; } /** * Response returned by `submitExceptionReport()`. */ interface SubmitExceptionReportResponse { /** Echo of the submitted exception report. */ SubmitResult?: ExceptionReportSubmitResult; /** Whether the submission was accepted by the server. */ IsSuccessful: boolean; /** Server-supplied error message when {@link SubmitExceptionReportResponse.IsSuccessful} is `false`; empty string on success. */ ErrorMessage: string | null; } /** * Options for `submitExceptionReport()`. */ interface SubmitExceptionReportOptions extends FolderScopedOptions { } /** * Request body for processing extracted document data against a taxonomy. * * Combines the automatic extraction output with any validator-supplied edits so the * server can compute the merged extraction result. */ interface ProcessExtractedDataRequest { /** Extraction result produced by the automatic extractor. */ AutomaticExtractedResults: ExtractionResult; /** Extraction result after human validation/edits. */ ValidatedExtractedResults: ExtractionResult; /** Document taxonomy describing the schema both results conform to. */ Taxonomy: DocumentTaxonomy; } /** * Options for `processExtractedData()`. */ interface ProcessExtractedDataOptions extends FolderScopedOptions { } /** * Service for the Orchestrator Document Understanding module. * * Exposes the validation-flow endpoints used by Document Understanding apps to * submit exception reports against a task and to process extracted data against * a taxonomy. [UiPath Document Understanding Guide](https://docs.uipath.com/document-understanding/automation-cloud/latest) * * ### Usage * * Prerequisites: Initialize the SDK first - see [Getting Started](/uipath-typescript/getting-started/#import-initialize) * * ```typescript * import { OrchestratorDuModule } from '@uipath/uipath-typescript/orchestrator-du-module'; * * const orchestratorDuModule = new OrchestratorDuModule(sdk); * ``` */ interface OrchestratorDuModuleServiceModel { /** * Submits an exception report for a Document Understanding validation task. * * Records that the document under validation cannot be processed normally and captures * a reason. The server echoes the submitted payload and signals acceptance via * {@link SubmitExceptionReportResponse.IsSuccessful}. * * @param taskId - Identifier of the validation task the exception applies to. * @param documentId - Identifier of the document the exception applies to. * @param reason - Free-text reason the document is being reported as an exception. * @returns Promise resolving to a {@link SubmitExceptionReportResponse} containing the echoed payload and success status. * * @example * ```typescript * import { Tasks, TaskType } from '@uipath/uipath-typescript/tasks'; * * const tasks = new Tasks(sdk); * * // Fetch the Document Validation task to get its documentId * const dvTask = await tasks.getById(, { taskType: TaskType.DocumentValidation }, ); * const documentId = dvTask.data?.documentId as string; * * // Submit an exception report for the validation task * const result = await orchestratorDuModule.submitExceptionReport(, documentId, ''); * * if (result.IsSuccessful) { * console.log('Exception recorded for', result.SubmitResult?.DocumentId); * } * ``` * @internal */ submitExceptionReport(taskId: number, documentId: string, reason: string, options: SubmitExceptionReportOptions): Promise; /** * Processes automatically extracted data against validator-edited data and a taxonomy. * * Sends the automatic extraction result, the validated extraction result, and the * document taxonomy to the server, which merges and normalizes the inputs and returns * the resulting {@link ExtractionResult}. * * @param request - Automatic and validated extraction results plus the document taxonomy. * @returns Promise resolving to the merged {@link ExtractionResult}. * * @example * ```typescript * // Merge automatic and validator-edited extraction results against a taxonomy * const result = await orchestratorDuModule.processExtractedData({ * AutomaticExtractedResults: , * ValidatedExtractedResults: , * Taxonomy: , * }); * * console.log(result.DocumentId, result.ResultsDocument?.DocumentTypeName); * ``` * @internal */ processExtractedData(request: ProcessExtractedDataRequest, options: ProcessExtractedDataOptions): Promise; } /** * Simplified universal pagination cursor * Used to fetch next/previous pages */ interface PaginationCursor { /** Opaque string containing all information needed to fetch next page */ value: string; } /** * Discriminated union for pagination methods - ensures cursor and jumpToPage are mutually exclusive */ type PaginationMethodUnion = { cursor?: PaginationCursor; jumpToPage?: never; } | { cursor?: never; jumpToPage?: number; } | { cursor?: never; jumpToPage?: never; }; /** * Pagination options. Users cannot specify both cursor and jumpToPage. */ type PaginationOptions = { /** Size of the page to fetch (items per page) */ pageSize?: number; } & PaginationMethodUnion; /** * Paginated response containing items and navigation information */ interface PaginatedResponse { /** The items in the current page */ items: T[]; /** Total count of items across all pages (if available) */ totalCount?: number; /** Whether more pages are available */ hasNextPage: boolean; /** Cursor to fetch the next page (if available) */ nextCursor?: PaginationCursor; /** Cursor to fetch the previous page (if available) */ previousCursor?: PaginationCursor; /** Current page number (1-based, if available) */ currentPage?: number; /** Total number of pages (if available) */ totalPages?: number; /** Whether this pagination type supports jumping to arbitrary pages */ supportsPageJump: boolean; } /** * Pagination types supported by the SDK */ declare enum PaginationType { OFFSET = "offset", TOKEN = "token" } /** * Interface for service access methods needed by pagination helpers */ interface PaginationServiceAccess { get(path: string, options?: any): Promise<{ data: T; }>; post(path: string, body?: any, options?: any): Promise<{ data: T; }>; requestWithPagination(method: string, path: string, paginationOptions: PaginationOptions, options: RequestWithPaginationOptions): Promise>; } /** * Field names for extracting data from paginated responses. */ interface PaginationFieldNames { itemsField?: string; totalCountField?: string; continuationTokenField?: string; } /** * Options for the requestWithPagination method in BaseService. */ interface RequestWithPaginationOptions extends RequestSpec { pagination: PaginationFieldNames & { paginationType: PaginationType; paginationParams?: { pageSizeParam?: string; offsetParam?: string; tokenParam?: string; countParam?: string; convertToSkip?: boolean; zeroBased?: boolean; }; }; } /** * HTTP methods supported by the API client */ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS'; /** * Supported response types for API requests */ type ResponseType = 'json' | 'text' | 'blob' | 'arraybuffer' | 'stream'; /** * Query parameters type with support for arrays and nested objects */ type QueryParams = Record | null | undefined>; /** * Standard HTTP headers type */ type Headers = Record; /** * Options for request retries */ interface RetryOptions { /** Maximum number of retry attempts */ maxRetries?: number; /** Base delay between retries in milliseconds */ retryDelay?: number; /** Whether to use exponential backoff */ useExponentialBackoff?: boolean; /** Status codes that should trigger a retry */ retryableStatusCodes?: number[]; } /** * Options for request timeouts */ interface TimeoutOptions { /** Request timeout in milliseconds */ timeout?: number; /** Whether to abort the request on timeout */ abortOnTimeout?: boolean; } /** * Options for request body transformation */ interface BodyOptions { /** Whether to stringify the body */ stringify?: boolean; /** Content type override */ contentType?: string; } /** * Pagination metadata for API requests */ interface PaginationMetadata { /** Type of pagination used by the API endpoint */ paginationType: PaginationType; /** Response field containing items array (defaults to 'value') */ itemsField?: string; /** Response field containing total count (defaults to '@odata.count') */ totalCountField?: string; /** Response field containing continuation token (defaults to 'continuationToken') */ continuationTokenField?: string; } /** * Base interface for all API requests */ interface RequestSpec { /** HTTP method for the request */ method?: HttpMethod; /** URL endpoint for the request */ url?: string; /** Query parameters to be appended to the URL */ params?: QueryParams; /** HTTP headers to include with the request */ headers?: Headers; /** Raw body content (takes precedence over data) */ body?: unknown; /** Expected response type */ responseType?: ResponseType; /** Request timeout options */ timeoutOptions?: TimeoutOptions; /** Retry behavior options */ retryOptions?: RetryOptions; /** Body transformation options */ bodyOptions?: BodyOptions; /** AbortSignal for cancelling the request */ signal?: AbortSignal; /** Pagination metadata for the request */ pagination?: PaginationMetadata; } interface ApiResponse { data: T; } /** * Base class for all UiPath SDK services. * * Provides common functionality for authentication, configuration, and API communication. * All service classes extend this base to inherit dependency injection and HTTP client access. * * This class implements the dependency injection pattern where services receive a configured * UiPath instance. The ApiClient is created internally and handles all HTTP operations * including authentication token management. * * @remarks * Service classes should extend this base and call `super(uiPath)` in their constructor. * Protected HTTP methods (get, post, put, patch, delete) are available to all subclasses. * */ declare class BaseService { #private; /** * SDK configuration (read-only). Available to subclasses so they can * fall back to init-time defaults like `folderKey`. */ protected readonly config: { folderKey?: string; }; /** * Creates a base service instance with dependency injection. * * Extracts configuration, execution context, and token manager from the UiPath instance * to initialize an authenticated API client. The ApiClient handles all HTTP operations * and token management internally. * * @param instance - UiPath SDK instance providing authentication and configuration. * Services receive this via dependency injection in the modular pattern. * @param headers - Optional default headers to include in every request (e.g. `x-uipath-external-user-id` for * CAS external-app auth) * * @example * ```typescript * // Services automatically call this via super() * export class EntityService extends BaseService { * constructor(instance: IUiPath) { * super(instance); // Initializes the internal ApiClient * } * } * * // Usage in modular pattern * import { UiPath } from '@uipath/uipath-typescript/core'; * import { Entities } from '@uipath/uipath-typescript/entities'; * * const sdk = new UiPath(config); * await sdk.initialize(); * const entities = new Entities(sdk); * ``` */ constructor(instance: IUiPath, headers?: Record); /** * Gets a valid authentication token, refreshing if necessary. * Use this when you need to manually add Authorization headers (e.g., direct uploads). * * @returns Promise resolving to a valid access token string * @throws AuthenticationError if no token is available or refresh fails */ protected getValidAuthToken(): Promise; /** * Creates a service accessor for pagination helpers * This allows pagination helpers to access protected methods without making them public */ protected createPaginationServiceAccess(): PaginationServiceAccess; protected request(method: string, path: string, options?: RequestSpec): Promise>; protected requestWithSpec(spec: RequestSpec): Promise>; protected get(path: string, options?: RequestSpec): Promise>; protected post(path: string, data?: unknown, options?: RequestSpec): Promise>; protected put(path: string, data?: unknown, options?: RequestSpec): Promise>; protected patch(path: string, data?: unknown, options?: RequestSpec): Promise>; protected delete(path: string, options?: RequestSpec): Promise>; /** * Execute a request with cursor-based pagination */ protected requestWithPagination(method: string, path: string, paginationOptions: PaginationOptions, options: RequestWithPaginationOptions): Promise>; /** * Validates and prepares pagination parameters from options */ private validateAndPreparePaginationParams; /** * Prepares request parameters for pagination based on pagination type */ private preparePaginationRequestParams; /** * Creates a paginated response from API response */ private createPaginatedResponseFromResponse; /** * Determines if there are more pages based on pagination type and metadata */ private determineHasMorePages; } /** * Service for the Orchestrator Document Understanding module. */ declare class OrchestratorDuModuleService extends BaseService implements OrchestratorDuModuleServiceModel { submitExceptionReport(taskId: number, documentId: string, reason: string, options: SubmitExceptionReportOptions): Promise; processExtractedData(request: ProcessExtractedDataRequest, options: ProcessExtractedDataOptions): Promise; } export { OrchestratorDuModuleService as OrchestratorDuModule, OrchestratorDuModuleService }; export type { ExceptionReportSubmitResult, OrchestratorDuModuleServiceModel, ProcessExtractedDataOptions, ProcessExtractedDataRequest, SubmitExceptionReportOptions, SubmitExceptionReportResponse };