import { IUiPath } from '../core/index'; /** * Insights Types * Shared types for Maestro insights analytics endpoints */ /** * Optional filters for Insights "top" endpoint queries. * All fields are optional — pass any combination to narrow results. */ interface TopQueryOptions { /** Filter by package identifier */ packageId?: string; /** Filter by process key */ processKey?: string; /** Filter by package version */ version?: string; } /** * Common fields returned by all Insights "top" endpoints */ interface GetTopBaseResponse { /** The package identifier */ packageId: string; /** The unique process key */ processKey: string; } /** * Response for the top run count Insights endpoint */ interface GetTopRunCountResponse extends GetTopBaseResponse { /** Number of times the process was run in the given time range */ runCount: number; } /** * Response for the top failure count Insights endpoint */ interface GetTopFaultedCountResponse extends GetTopBaseResponse { /** Number of faulted instances in the given time range */ faultedCount: number; } /** * SDK response for top elements with failure. * Shared by both MaestroProcesses and Cases — no service-specific enrichment. */ interface ElementGetTopFailedCountResponse { /** BPMN element name (falls back to element ID if name is empty) */ elementName: string; /** BPMN element type (e.g. ServiceTask, ReceiveTask, IntermediateCatchEvent) */ elementType: string; /** The unique process key this element belongs to */ processKey: string; /** Number of failed executions of this element in the given time range */ failedCount: number; } /** * Time bucketing granularity for insights time-series queries. * * Controls how data points are grouped on the time axis. */ declare enum TimeInterval { /** Group data points by hour */ Hour = "HOUR", /** Group data points by day */ Day = "DAY", /** Group data points by week */ Week = "WEEK" } /** * Options for insights time-series queries. */ interface TimelineOptions { /** * How to group data points on the time axis. * @default TimeInterval.Day */ groupBy?: TimeInterval; /** Filter by package identifier */ packageId?: string; /** Filter by package version */ version?: string; /** Filter by one or more process keys. Pass `['']` for a single process. */ processKeys?: string[]; } /** * Final instance statuses returned by the instance status timeline endpoint. * * Only includes statuses where the instance has finished execution — Completed, Faulted, or Cancelled. * Active statuses like Running or Paused are not included. */ declare enum InstanceFinalStatus { /** Instance completed successfully */ Completed = "Completed", /** Instance encountered an error */ Faulted = "Faulted", /** Instance was cancelled */ Cancelled = "Cancelled" } /** * Instance count for a process with a given status * within a specific time bucket. */ interface InstanceStatusTimelineResponse { /** Start of the time bucket in local timezone (e.g. `"5/8/2026 12:00:00 AM"`) */ startTime: string; /** Instance status */ status: InstanceFinalStatus; /** Number of instances with this status in the time bucket */ count: number; } /** * Incident count within a specific time bucket. */ interface IncidentTimelineResponse { /** Start of the time bucket in local timezone (ISO 8601, e.g. `"2026-05-04T00:00:00"`) */ startTime: string; /** End of the time bucket in local timezone (ISO 8601, e.g. `"2026-05-11T00:00:00"`) */ endTime: string; /** Number of incidents that occurred within this time bucket */ count: number; } /** * Response for the top duration Insights endpoint */ interface GetTopDurationResponse extends GetTopBaseResponse { /** Total execution duration in milliseconds */ duration: number; } /** * Duration percentile stats shared by Insights aggregate endpoints (per-element and per-process/case). * * For instance-level stats, durations are computed over terminal instances only * (Completed, Cancelled, Deleted) and default to `0` when no terminal instances exist. */ interface DurationStats { /** Minimum duration in milliseconds */ minDurationMs: number; /** Maximum duration in milliseconds */ maxDurationMs: number; /** Average duration in milliseconds */ avgDurationMs: number; /** 50th percentile (median) duration in milliseconds */ p50DurationMs: number; /** 95th percentile duration in milliseconds */ p95DurationMs: number; /** 99th percentile duration in milliseconds */ p99DurationMs: number; } /** * Instance count and duration stats aggregated by status for a process or case within a time range. * * Duration fields are computed over terminal instances only (Completed, Cancelled, Deleted) * and default to `0` when no terminal instances exist in the time range. */ interface InstanceStats extends DurationStats { /** Total number of instances across all statuses */ totalCount: number; /** Number of currently running instances */ runningCount: number; /** Number of instances in transitioning state */ transitioningCount: number; /** Number of paused instances */ pausedCount: number; /** Number of faulted instances */ faultedCount: number; /** Number of completed instances */ completedCount: number; /** Number of cancelled instances */ cancelledCount: number; /** Number of deleted instances */ deletedCount: number; } /** * Required request parameters for process-scoped insights stats endpoints * (`getElementStats`, `getInstanceStats`). * * Identifies a single process+package+version and the time range to aggregate over. */ interface MaestroProcessStatsRequest { /** Process key to filter by */ processKey: string; /** Package identifier */ packageId: string; /** Package version to filter by */ packageVersion: string; /** Start of the time range to query */ startTime: Date; /** End of the time range to query */ endTime: Date; } /** * Per-element execution counts and duration percentiles for a BPMN element within a process or case. */ interface ElementStats extends DurationStats { /** BPMN element identifier */ elementId: string; /** Number of successful executions */ successCount: number; /** Number of failed executions */ failCount: number; /** Number of terminated executions */ terminatedCount: number; /** Number of paused executions */ pausedCount: number; /** Number of in-progress executions */ inProgressCount: number; } /** * 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; } /** * Response for non-paginated calls that includes both data and total count */ interface NonPaginatedResponse { items: T[]; totalCount?: number; } /** * Helper type for defining paginated method overloads * Creates a union type of all ways pagination can be triggered */ type HasPaginationOptions = (T & { pageSize: number; }) | (T & { cursor: PaginationCursor; }) | (T & { jumpToPage: number; }); /** * Standardized result interface for all operation methods (pause, cancel, complete, update, upload, etc.) * Success responses include data from the request context or API response */ interface OperationResponse { /** * Whether the operation was successful */ success: boolean; /** * Response data (can contain error details in case of failure) */ data: TData; } interface BaseOptions { expand?: string; select?: string; } /** * Common request options interface used across services for querying data */ interface RequestOptions extends BaseOptions { filter?: string; orderby?: string; } /** * Maestro Cases Types * Types and interfaces for Maestro case management */ /** * Optional filters for {@link CasesServiceModel.getAll}. * All fields are optional — pass any combination to narrow the returned case processes. */ interface CaseGetAllOptions { /** Filter by case process key */ processKey?: string; /** Filter by package identifier */ packageId?: string; /** Only include case processes with instances started at or after this time */ startTime?: Date; /** Only include case processes with instances started at or before this time */ endTime?: Date; } /** * Case information with instance statistics */ interface CaseGetAllResponse { /** Unique key identifying the case process */ processKey: string; /** Package identifier */ packageId: string; /** Case name */ name: string; /** Folder key of the folder where case process is located */ folderKey: string; /** Name of the folder where case process is located */ folderName: string; /** Available package versions */ packageVersions: string[]; /** Total number of versions */ versionCount: number; /** Case instance count - pending */ pendingCount: number; /** Case instance count - running */ runningCount: number; /** Case instance count - completed */ completedCount: number; /** Case instance count - paused */ pausedCount: number; /** Case instance count - cancelled */ cancelledCount: number; /** Case instance count - faulted */ faultedCount: number; /** Case instance count - retrying */ retryingCount: number; /** Case instance count - resuming */ resumingCount: number; /** Case instance count - pausing */ pausingCount: number; /** Case instance count - canceling */ cancelingCount: number; } /** * Response for a single entry in top cases by run count */ interface CaseGetTopRunCountResponse extends GetTopRunCountResponse { /** Human-readable case name */ name: string; } /** * Response for a single entry in top cases by failure count */ interface CaseGetTopFaultedCountResponse extends GetTopFaultedCountResponse { /** Human-readable case name */ name: string; } /** * Response for a single entry in top cases by duration */ interface CaseGetTopDurationResponse extends GetTopDurationResponse { /** Human-readable case name */ name: string; } /** * Maestro Cases Models * Model classes for Maestro cases */ /** * Service for managing UiPath Maestro Cases * * UiPath Maestro Case Management describes solutions that help manage and automate the full flow of complex E2E scenarios. * * ### Usage * * Prerequisites: Initialize the SDK first - see [Getting Started](/uipath-typescript/getting-started/#import-initialize) * * ```typescript * import { Cases } from '@uipath/uipath-typescript/cases'; * * const cases = new Cases(sdk); * const allCases = await cases.getAll(); * ``` */ interface CasesServiceModel { /** * Get all case management processes with their instance statistics. * * Returns every case process with aggregated instance counts by status. Pass `options` * to narrow the results by process key, package, or the time range their instances started in. * * @param options - Optional filters (processKey, packageId, startTime, endTime) * @returns Promise resolving to an array of {@link CaseGetAllWithMethodsResponse} * @example * ```typescript * // Get all case management processes * const allCases = await cases.getAll(); * * // Access case information * for (const caseProcess of allCases) { * console.log(`Case Process: ${caseProcess.processKey}`); * console.log(`Running instances: ${caseProcess.runningCount}`); * console.log(`Completed instances: ${caseProcess.completedCount}`); * } * ``` * * @example * ```typescript * // Filter by package and the time range instances started in * const filtered = await cases.getAll({ * packageId: '', * startTime: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000), * endTime: new Date(), * }); * ``` */ getAll(options?: CaseGetAllOptions): Promise; /** * Get the top 5 case processes ranked by run count within a time range. * * Returns an array of up to 5 case processes sorted by how many times they were executed, * useful for identifying the most active case processes in a given period. * * @param startTime - Start of the time range to query * @param endTime - End of the time range to query * @param options - Optional filters (packageId, processKey, version) * @returns Promise resolving to an array of {@link CaseGetTopRunCountResponse} * @example * ```typescript * import { Cases } from '@uipath/uipath-typescript/cases'; * * const cases = new Cases(sdk); * * // Get top case processes by run count for the last 7 days * const topProcesses = await cases.getTopRunCount( * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000), * new Date() * ); * * for (const process of topProcesses) { * console.log(`${process.packageId}: ${process.runCount} runs`); * } * ``` * * @example * ```typescript * // Get top case processes by run count for a specific package * const filtered = await cases.getTopRunCount( * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000), * new Date(), * { packageId: '' } * ); * ``` */ getTopRunCount(startTime: Date, endTime: Date, options?: TopQueryOptions): Promise; /** * Get the top 10 case processes ranked by failure count within a time range. * * Returns an array of up to 10 case processes sorted by how many instances faulted, * useful for identifying the most error-prone case processes in a given period. * * @param startTime - Start of the time range to query * @param endTime - End of the time range to query * @param options - Optional filters (packageId, processKey, version) * @returns Promise resolving to an array of {@link CaseGetTopFaultedCountResponse} * @example * ```typescript * import { Cases } from '@uipath/uipath-typescript/cases'; * * const cases = new Cases(sdk); * * // Get top case processes by faulted count for the last 7 days * const topFailing = await cases.getTopFaultedCount( * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000), * new Date() * ); * * for (const process of topFailing) { * console.log(`${process.packageId}: ${process.faultedCount} failures`); * } * ``` * * @example * ```typescript * // Get top case processes by faulted count for a specific package * const filtered = await cases.getTopFaultedCount( * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000), * new Date(), * { packageId: '' } * ); * ``` */ getTopFaultedCount(startTime: Date, endTime: Date, options?: TopQueryOptions): Promise; /** * Get the top 10 BPMN elements ranked by failure count within a time range. * * Returns an array of up to 10 elements sorted by how many times they failed, * useful for identifying the most error-prone activities in case processes. * * @param startTime - Start of the time range to query * @param endTime - End of the time range to query * @param options - Optional filters (packageId, processKey, version) * @returns Promise resolving to an array of {@link ElementGetTopFailedCountResponse} * @example * ```typescript * import { Cases } from '@uipath/uipath-typescript/cases'; * * const cases = new Cases(sdk); * * // Get top failing elements for the last 7 days * const topFailing = await cases.getTopElementFailedCount( * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000), * new Date() * ); * * for (const element of topFailing) { * console.log(`${element.elementName} (${element.elementType}): ${element.failedCount} failures`); * } * ``` * * @example * ```typescript * // Get top failing elements for a specific process * const filtered = await cases.getTopElementFailedCount( * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000), * new Date(), * { processKey: '' } * ); * ``` */ getTopElementFailedCount(startTime: Date, endTime: Date, options?: TopQueryOptions): Promise; /** * Get all instances status counts aggregated by date for case management processes. * * Returns time-grouped counts of case instances grouped by status (Completed, Faulted, Cancelled), * useful for rendering time-series charts. Use `groupBy` to control the time bucket size * (hour, day, or week) — defaults to day if not provided. * * @param startTime - Start of the time range to query * @param endTime - End of the time range to query * @param options - Optional settings for filtering and time bucket granularity * @returns Promise resolving to an array of {@link InstanceStatusTimelineResponse} * * @example * ```typescript * // Get daily instance status for the last 7 days * const now = new Date(); * const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000); * const statuses = await cases.getInstanceStatusTimeline(sevenDaysAgo, now); * * for (const entry of statuses) { * console.log(`${entry.startTime} — ${entry.status}: ${entry.count}`); * } * ``` * * @example * ```typescript * import { TimeInterval } from '@uipath/uipath-typescript/cases'; * * // Get weekly breakdown * const statuses = await cases.getInstanceStatusTimeline(startTime, endTime, { * groupBy: TimeInterval.Week, * }); * ``` * * @example * ```typescript * // Filter to a specific case process * const filtered = await cases.getInstanceStatusTimeline(startTime, endTime, { * processKeys: [''], * }); * ``` * * @example * ```typescript * // Get all-time data (from Unix epoch to now) * const allTime = await cases.getInstanceStatusTimeline(new Date(0), new Date()); * ``` */ getInstanceStatusTimeline(startTime: Date, endTime: Date, options?: TimelineOptions): Promise; /** * Get incident counts aggregated by time bucket for case management processes. * * Returns time-grouped counts of incidents that occurred within each bucket, * useful for rendering incident time-series charts. Use `groupBy` to control * the time bucket size (hour, day, or week) — defaults to day if not provided. * * @param startTime - Start of the time range to query * @param endTime - End of the time range to query * @param options - Optional settings for filtering and time bucket granularity * @returns Promise resolving to an array of {@link IncidentTimelineResponse} * * @example * ```typescript * // Get daily incident counts for the last 7 days * const now = new Date(); * const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000); * const incidents = await cases.getIncidentsTimeline(sevenDaysAgo, now); * * for (const incident of incidents) { * console.log(`${incident.startTime} → ${incident.endTime}: ${incident.count} incidents`); * } * ``` * * @example * ```typescript * import { TimeInterval } from '@uipath/uipath-typescript/cases'; * * // Get weekly breakdown * const incidents = await cases.getIncidentsTimeline(startTime, endTime, { * groupBy: TimeInterval.Week, * }); * ``` * * @example * ```typescript * // Filter to a specific case process * const filtered = await cases.getIncidentsTimeline(startTime, endTime, { * processKeys: [''], * }); * ``` */ getIncidentsTimeline(startTime: Date, endTime: Date, options?: TimelineOptions): Promise; /** * Get the top 5 case processes ranked by total duration within a time range. * * Returns an array of up to 5 case processes sorted by their total execution time, * useful for identifying the longest-running case processes in a given period. * * @param startTime - Start of the time range to query * @param endTime - End of the time range to query * @param options - Optional filters (packageId, processKey, version) * @returns Promise resolving to an array of {@link CaseGetTopDurationResponse} * @example * ```typescript * import { Cases } from '@uipath/uipath-typescript/cases'; * * const cases = new Cases(sdk); * * // Get top case processes by duration for the last 7 days * const topProcesses = await cases.getTopExecutionDuration( * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000), * new Date() * ); * * for (const process of topProcesses) { * console.log(`${process.packageId}: ${process.duration}ms total`); * } * ``` * * @example * ```typescript * // Get top case processes by duration for a specific package * const filtered = await cases.getTopExecutionDuration( * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000), * new Date(), * { packageId: '' } * ); * ``` */ getTopExecutionDuration(startTime: Date, endTime: Date, options?: TopQueryOptions): Promise; /** * Get element stats for case instances * * Returns per-element execution counts (success, fail, terminated, paused, in-progress) and * duration percentile metrics (min, max, avg, p50, p95, p99) for BPMN elements within a case. * * @param request - Process scope + time range to aggregate over * @returns Promise resolving to an array of {@link ElementStats} * @example * ```typescript * // First, list cases to find the processKey, packageId, and available versions * const allCases = await cases.getAll(); * const caseItem = allCases[0]; * * // Get element metrics for that case * const elements = await cases.getElementStats({ * processKey: caseItem.processKey, * packageId: caseItem.packageId, * packageVersion: caseItem.packageVersions[0], * startTime: new Date('2026-04-01'), * endTime: new Date(), * }); * * // Find elements with failures * const failedElements = elements.filter(e => e.failCount > 0); * for (const element of failedElements) { * console.log(`Failed element: ${element.elementId}, failures: ${element.failCount}`); * } * * // Using bound method on a case — auto-fills processKey and packageId * const boundElements = await caseItem.getElementStats( * new Date('2026-04-01'), * new Date(), * caseItem.packageVersions[0] * ); * ``` */ getElementStats(request: MaestroProcessStatsRequest): Promise; /** * Get instance stats for a case. * * Returns total instance counts broken down by status (running, completed, faulted, etc.) * and the average execution duration for all instances of a case within a time range. * * @param request - Process scope + time range to aggregate over * @returns Promise resolving to {@link InstanceStats} * @example * ```typescript * // First, list cases to find the processKey, packageId, and available versions * const allCases = await cases.getAll(); * const caseItem = allCases[0]; * * // Get instance status breakdown for that case * const counts = await cases.getInstanceStats({ * processKey: caseItem.processKey, * packageId: caseItem.packageId, * packageVersion: caseItem.packageVersions[0], * startTime: new Date('2026-04-01'), * endTime: new Date(), * }); * * console.log(`Total: ${counts.totalCount}`); * console.log(`Completed: ${counts.completedCount}, Faulted: ${counts.faultedCount}`); * * // Using bound method on a case — auto-fills processKey and packageId * const boundCounts = await caseItem.getInstanceStats( * new Date('2026-04-01'), * new Date(), * caseItem.packageVersions[0] * ); * ``` */ getInstanceStats(request: MaestroProcessStatsRequest): Promise; } interface CaseMethods { /** * Get element stats for this case * * @param startTime - Start of the time range to query * @param endTime - End of the time range to query * @param packageVersion - Package version to filter by * @returns Promise resolving to an array of {@link ElementStats} */ getElementStats(startTime: Date, endTime: Date, packageVersion: string): Promise; /** * Get instance stats for this case * * @param startTime - Start of the time range to query * @param endTime - End of the time range to query * @param packageVersion - Package version to filter by * @returns Promise resolving to {@link InstanceStats} */ getInstanceStats(startTime: Date, endTime: Date, packageVersion: string): Promise; /** * Get instance status counts aggregated by date for this case process. * * @param startTime - Start of the time range to query * @param endTime - End of the time range to query * @param options - Optional settings for filtering and time bucket granularity (processKey is auto-captured from this case) * @returns Promise resolving to an array of {@link InstanceStatusTimelineResponse} */ getInstanceStatusTimeline(startTime: Date, endTime: Date, options?: Omit): Promise; /** * Get incident counts aggregated by time bucket for this case process. * * @param startTime - Start of the time range to query * @param endTime - End of the time range to query * @param options - Optional settings for filtering and time bucket granularity (processKey is auto-captured from this case) * @returns Promise resolving to an array of {@link IncidentTimelineResponse} */ getIncidentsTimeline(startTime: Date, endTime: Date, options?: Omit): Promise; } type CaseGetAllWithMethodsResponse = CaseGetAllResponse & CaseMethods; /** * Creates an actionable case by combining API case data with operational methods. * * @param caseData - The case data from API * @param service - The cases service instance * @returns A case object with added methods */ declare function createCaseWithMethods(caseData: CaseGetAllResponse, service: CasesServiceModel): CaseGetAllWithMethodsResponse; /** * Case Instance Types * Types and interfaces for Maestro case instance management */ /** * Response for getting a single case instance */ interface RawCaseInstanceGetResponse { instanceId: string; packageKey: string; packageId: string; packageVersion: string; latestRunId: string; latestRunStatus: string; processKey: string; folderKey: string; userId: number; instanceDisplayName: string; startedByUser: string; source: string; creatorUserKey: string; startedTime: string; completedTime: string; instanceRuns: CaseInstanceRun[]; caseAppConfig?: CaseAppConfig; caseType?: string; caseTitle?: string; } /** * Case instance run information */ interface CaseInstanceRun { runId: string; status: string; startedTime: string; completedTime: string; } /** * Query options for getting case instances */ interface CaseInstanceGetAllOptions { packageId?: string; packageVersion?: string; processKey?: string; errorCode?: string; } /** * Query options for getting case instances with pagination support */ type CaseInstanceGetAllWithPaginationOptions = CaseInstanceGetAllOptions & PaginationOptions; /** * Request for case instance operations (close, pause, resume) */ interface CaseInstanceOperationOptions { comment?: string; } /** * Response for case instance operations (close, pause, resume) */ interface CaseInstanceOperationResponse { instanceId: string; status: string; } /** * Options for reopening a case instance. */ interface CaseInstanceReopenOptions extends CaseInstanceOperationOptions { /** * The stage ID from which the case instance should be reopened. */ stageId: string; } /** * Well-known message names understood by running case instances. */ declare enum CaseInstanceMessageName { /** Selects the next stage when the case instance is waiting for a user to choose one */ UserSelectStage = "UserSelectStage", /** Starts a manually-triggered (ad-hoc) case task */ UserAdhocTrigger = "UserAdhocTrigger" } /** * Options for sending a message to a case instance. */ interface CaseInstanceSendMessageOptions { /** * Data payload delivered with the message — e.g. `{ stageName: 'Review' }` for * `UserSelectStage`, or `{ taskNames: ['Approve Invoice'] }` for `UserAdhocTrigger`. */ itemData?: Record; /** * Message reference identifying the target wait point. Defaults to the case * instance itself, which is correct for most messages. */ reference?: string; } /** * Case App Configuration Overview */ interface CaseAppOverview { title: string; details: string; } /** * Case App Configuration from case JSON */ interface CaseAppConfig { caseSummary?: string; overview?: CaseAppOverview[]; } /** * SLA status for a case instance */ declare enum SlaSummaryStatus { /** Case is within SLA deadline */ ON_TRACK = "On Track", /** Case is approaching SLA deadline based on at-risk percentage threshold */ AT_RISK = "At Risk", /** Case has exceeded SLA deadline */ OVERDUE = "Overdue", /** Case instance has completed */ COMPLETED = "Completed", /** SLA status cannot be determined (no SLA deadline defined) */ UNKNOWN = "Unknown" } /** * Instance status values for case instances and process instances */ declare enum InstanceStatus { /** Instance status not yet populated by the backend */ UNKNOWN = "", CANCELLED = "Cancelled", CANCELING = "Canceling", COMPLETED = "Completed", FAULTED = "Faulted", PAUSED = "Paused", PAUSING = "Pausing", PENDING = "Pending", RESUMING = "Resuming", RETRYING = "Retrying", RUNNING = "Running", UPGRADING = "Upgrading" } /** * SLA summary response for a single case instance */ interface SlaSummaryResponse { /** Unique identifier of the case instance */ caseInstanceId: string; /** Folder key that the case instance belongs to */ folderKey: string; /** Display name of the SLA rule */ name: string; /** Human-readable reference number for a case instance */ externalId: string; /** Summary text for the case instance — may be empty */ caseSummary: string; /** Unique key of the process associated with the case instance */ processKey: string; /** SLA deadline timestamp in UTC (ISO 8601 format) */ slaDueTime: string; /** Current SLA status indicating whether the deadline is met, at risk, or breached */ slaStatus: SlaSummaryStatus; /** Index of the escalation rule currently applied to the SLA */ escalationRuleIndex: string; escalationRuleType: EscalationTriggerType; /** Current status of the case instance */ instanceStatus: InstanceStatus; /** Last modification timestamp in UTC (ISO 8601 format) */ lastModifiedTime: string; } /** * Options for querying SLA summary */ type CaseInstanceSlaSummaryOptions = PaginationOptions & { /** Filter to a specific case instance */ caseInstanceId?: string; /** Filter by event start time in UTC */ startTimeUtc?: Date; /** Filter by event end time in UTC */ endTimeUtc?: Date; }; /** * Stage SLA summary for a single stage within a case instance (from Insights RTM) */ interface CaseInstanceStageSLAStage { /** Stage element identifier */ elementId: string; /** Stage display name */ name: string; /** Current execution status of the stage */ latestStatus: string; /** SLA deadline timestamp in UTC (e.g. `"9/17/2025 8:35:38 PM"`) or empty string if no SLA is configured */ slaDueTime: string; /** SLA status for this stage */ slaStatus: SlaSummaryStatus; /** Index of the current escalation rule */ escalationRuleIndex: string; /** Type of the current escalation rule */ escalationRuleType: EscalationTriggerType; } /** * Stages SLA summary for a single case instance (from Insights RTM) */ interface CaseInstanceStageSLAResponse { /** Case instance identifier */ caseInstanceId: string; /** Stages within this case instance */ stages: CaseInstanceStageSLAStage[]; } /** * Options for querying stages SLA summary */ interface CaseInstanceStageSLAOptions { /** Filter to a specific case instance */ caseInstanceId?: string; } /** * Case stage task type */ declare enum StageTaskType { EXTERNAL_AGENT = "external-agent", RPA = "rpa", AGENTIC_PROCESS = "process", AGENT = "agent", ACTION = "action", API_WORKFLOW = "api-workflow" } /** * Stage task information */ interface StageTask { id: string; name: string; completedTime: string; startedTime: string; status: string; type: StageTaskType; } /** * Escalation recipient scope */ declare enum EscalationRecipientScope { USER = "user", USER_GROUP = "usergroup" } /** * Escalation rule recipient information */ interface EscalationRecipient { /** Type of recipient (user or usergroup) */ scope: EscalationRecipientScope; /** Identifier for a user/usergroup */ target: string; /** The email id of the user/usergroup */ value: string; } /** * Escalation action type */ declare enum EscalationActionType { NOTIFICATION = "notification" } /** * Escalation rule action configuration */ interface EscalationAction { type: EscalationActionType; recipients: EscalationRecipient[]; } /** * Escalation rule trigger type */ declare enum EscalationTriggerType { SLA_BREACHED = "sla-breached", AT_RISK = "at-risk", /** Default value when no escalation rule is defined */ NONE = "None" } /** * Escalation rule trigger metadata */ interface EscalationTriggerMetadata { type?: EscalationTriggerType; atRiskPercentage?: number; } /** * Escalation rule configuration */ interface EscalationRule { triggerInfo: EscalationTriggerMetadata; action?: EscalationAction; } /** * SLA duration unit */ declare enum SLADurationUnit { HOURS = "h", DAYS = "d", WEEKS = "w", MONTHS = "m" } /** * SLA configuration for stages */ interface StageSLA { length?: number; duration?: SLADurationUnit; escalationRule?: EscalationRule[]; } /** * Stage information from case instances */ interface CaseGetStageResponse { id: string; name: string; sla?: StageSLA; status: string; tasks: StageTask[][]; } /** * Case element execution metadata */ interface ElementExecutionMetadata { completedTime: string | null; elementId: string; elementName: string; parentElementId: string | null; startedTime: string; /** Element status (e.g., "Completed", "Faulted", "Running") */ status: string; processKey: string; /** External reference link, eg link to the HITL task in Action Center */ externalLink: string; /** List of element runs for the element */ elementRuns: ElementRunMetadata[]; } /** * Response for getting case instance element executions */ interface CaseInstanceExecutionHistoryResponse { creationUserKey: string | null; folderKey: string; instanceDisplayName: string; instanceId: string; packageId: string; packageKey: string; packageVersion: string; processKey: string; source: string; /** Element status (e.g., "Completed", "Faulted", "Running", "Pausing", "Canceling") */ status: string; startedTime: string; completedTime: string | null; elementExecutions: ElementExecutionMetadata[]; } /** * Element run metadata */ interface ElementRunMetadata { status: string; startedTime: string; completedTime: string | null; elementRunId: string; parentElementRunId: string | null; } declare enum TaskUserType { /** A user of this type is supposed to be used by a human. */ User = "User", /** A user of this type is automatically created when adding a robot, is associated with Robot role and it is used by a robot when communicating with Orchestrator. */ Robot = "Robot", /** A user of type Directory User */ DirectoryUser = "DirectoryUser", /** A user of type Directory Group */ DirectoryGroup = "DirectoryGroup", /** A user of type Directory Robot Account */ DirectoryRobot = "DirectoryRobot", /** A user of type Directory External Application */ DirectoryExternalApplication = "DirectoryExternalApplication" } interface UserLoginInfo { name: string; surname: string; userName: string; emailAddress: string; displayName: string; id: number; type: TaskUserType; } /** * Types of tasks available in Action Center. * Each type determines the task's behavior, UI rendering, and completion requirements. */ declare enum TaskType { /** A form-based task that renders a UiPath form layout for user input */ Form = "FormTask", /** An externally managed task handled outside of Action Center */ External = "ExternalTask", /** A task powered by a UiPath App */ App = "AppTask", /** A document validation task for reviewing and correcting extracted document data */ DocumentValidation = "DocumentValidationTask", /** A document classification task for categorizing documents */ DocumentClassification = "DocumentClassificationTask", /** A data labeling task for annotating training data */ DataLabeling = "DataLabelingTask" } declare enum TaskPriority { Low = "Low", Medium = "Medium", High = "High", Critical = "Critical" } declare enum TaskStatus { Unassigned = "Unassigned", Pending = "Pending", Completed = "Completed" } declare enum TaskSlaCriteria { TaskCreated = "TaskCreated", TaskAssigned = "TaskAssigned", TaskCompleted = "TaskCompleted" } declare enum TaskSlaStatus { OverdueLater = "OverdueLater", OverdueSoon = "OverdueSoon", Overdue = "Overdue", CompletedInTime = "CompletedInTime" } declare enum TaskSourceName { Agent = "Agent", Workflow = "Workflow", Maestro = "Maestro", Default = "Default" } interface TaskSource { sourceName: TaskSourceName; sourceId: string; taskSourceMetadata: Record; } /** * Task activity types */ declare enum TaskActivityType { Created = "Created", Assigned = "Assigned", Reassigned = "Reassigned", Unassigned = "Unassigned", Saved = "Saved", Forwarded = "Forwarded", Completed = "Completed", Commented = "Commented", Deleted = "Deleted", BulkSaved = "BulkSaved", BulkCompleted = "BulkCompleted", FirstOpened = "FirstOpened" } /** * Tag information for tasks */ interface Tag { name: string; displayName: string; displayValue: string; } /** * Task activity information */ interface TaskActivity { task?: RawTaskGetResponse; organizationUnitId: number; taskId: number; taskKey: string; activityType: TaskActivityType; creatorUserId: number; targetUserId: number | null; createdTime: string; } interface TaskSlaDetail { expiryTime?: string; startCriteria?: TaskSlaCriteria; endCriteria?: TaskSlaCriteria; status?: TaskSlaStatus; } interface TaskAssignment { assignee?: UserLoginInfo; task?: RawTaskGetResponse; id?: number; } /** * Base interface containing common fields shared across all task response types */ interface TaskBaseResponse { status: TaskStatus; title: string; type: TaskType; priority: TaskPriority; folderId: number; key: string; isDeleted: boolean; createdTime: string; id: number; action: string | null; externalTag: string | null; lastAssignedTime: string | null; completedTime: string | null; parentOperationId: string | null; deleterUserId: number | null; deletedTime: string | null; lastModifiedTime: string | null; } interface RawTaskGetResponse extends TaskBaseResponse { isCompleted: boolean; encrypted: boolean; bulkFormLayoutId: number | null; formLayoutId: number | null; taskSlaDetail: TaskSlaDetail | null; taskAssigneeName: string | null; lastModifierUserId: number | null; assignedToUser: UserLoginInfo | null; creatorUser?: UserLoginInfo; lastModifierUser?: UserLoginInfo; taskAssignments?: TaskAssignment[]; activities?: TaskActivity[]; tags?: Tag[]; formLayout?: Record; actionLabel?: string | null; taskSlaDetails?: TaskSlaDetail[] | null; completedByUser?: UserLoginInfo | null; taskAssignmentCriteria?: TaskAssignmentCriteria; taskAssignees?: UserLoginInfo[] | null; taskSource?: TaskSource | null; processingTime?: number | null; data?: Record | null; } /** * Defines how a task assignment is distributed. * * Defaults to {@link TaskAssignmentCriteria.SingleUser} (a direct single-user * assignment) when not specified. The group-based criteria tell Action Center * how to distribute the task across the members of a directory group. */ declare enum TaskAssignmentCriteria { /** Assigned to a single user, like a direct assignment. */ SingleUser = "SingleUser", /** Assigned to the group member with the fewest pending tasks. */ Workload = "Workload", /** Assigned to all users in the group. */ AllUsers = "AllUsers", /** Assigned in a round-robin manner across the group's members. */ RoundRobin = "RoundRobin" } /** * Options for task assignment operations when called from a task instance * Requires either userId or userNameOrEmail, but not both. Optionally accepts * an assignment criteria; defaults to a single-user assignment, set a group * criteria (e.g. {@link TaskAssignmentCriteria.AllUsers}) for a directory group. */ type TaskAssignOptions = ({ userId: number; userNameOrEmail?: never; } | { userId?: never; userNameOrEmail: string; }) & { /** * How the assignment is distributed. Optional — defaults to * {@link TaskAssignmentCriteria.SingleUser} (a direct single-user assignment). * Set a group criteria (e.g. {@link TaskAssignmentCriteria.AllUsers}) to * distribute the task across a directory group's members. */ assignmentCriteria?: TaskAssignmentCriteria; }; /** * Options for task assignment operations when called from the service * Extends TaskAssignOptions with the required taskId field */ type TaskAssignmentOptions = { taskId: number; } & TaskAssignOptions; interface TaskAssignmentResponse { taskId?: number; userId?: number; errorCode?: number; errorMessage?: string; userNameOrEmail?: string; } /** * Options for completing a task */ type TaskCompleteOptions = { type: TaskType.External; data?: any; action?: string; } | { type: TaskType.DocumentValidation; data?: any; action?: string; } | { type: TaskType.DocumentClassification; data?: any; action?: string; } | { type: TaskType.DataLabeling; data?: any; action?: string; } | { type: TaskType.Form; data: any; action: string; } | { type: TaskType.App; data: any; action: string; }; /** * Options for completing a task when called from the service * Extends TaskCompleteOptions with the required taskId field */ type TaskCompletionOptions = TaskCompleteOptions & { taskId: number; }; /** * Options for getting tasks across folders */ type TaskGetAllOptions = RequestOptions & PaginationOptions & { /** * Optional folder ID to filter tasks by folder */ folderId?: number; /** * Optional flag to fetch tasks using admin permissions * When true, fetches tasks across folders * where the user has at least Task.View, Task.Edit and TaskAssignment.Create permissions * When false or omitted, fetches tasks across folders * where the user has at least Task.View and Task.Edit permissions */ asTaskAdmin?: boolean; }; interface TaskMethods { /** * Assigns this task to a user or users * * @param options - Assignment options (requires at least one of: userId, userNameOrEmail) * @returns Promise resolving to task assignment results */ assign(options: TaskAssignOptions): Promise>; /** * Reassigns this task to a new user * * @param options - Assignment options (requires at least one of: userId, userNameOrEmail) * @returns Promise resolving to task assignment results */ reassign(options: TaskAssignOptions): Promise>; /** * Unassigns this task (removes current assignee) * * @returns Promise resolving to task assignment results */ unassign(): Promise>; /** * Completes this task with optional data and action * * @param options - Completion options * @returns Promise resolving to completion result */ complete(options: TaskCompleteOptions): Promise>; } type TaskGetResponse = RawTaskGetResponse & TaskMethods; /** * Service model for managing Maestro Case Instances * * Maestro case instances are the running instances of Maestro cases. * * ### Usage * * Prerequisites: Initialize the SDK first - see [Getting Started](/uipath-typescript/getting-started/#import-initialize) * * ```typescript * import { CaseInstances } from '@uipath/uipath-typescript/cases'; * * const caseInstances = new CaseInstances(sdk); * const allInstances = await caseInstances.getAll(); * ``` * * !!! note * Methods that rely on the Insights Real-Time Monitoring service (`getSlaSummary`, `getStagesSlaSummary`) * may have up to ~1 minute latency before reflecting the latest updates. See * [Real-Time Monitoring Overview](https://docs.uipath.com/insights/automation-cloud/latest/user-guide/real-time-monitoring-overview) for details. */ interface CaseInstancesServiceModel { /** * Get all case instances with optional filtering and pagination * * @param options Query parameters for filtering instances and pagination * @returns Promise resolving to either an array of case instances NonPaginatedResponse or a PaginatedResponse when pagination options are used. * {@link CaseInstanceGetResponse} * @example * ```typescript * // Get all case instances (non-paginated) * const instances = await caseInstances.getAll(); * * // Cancel/Close faulted instances using methods directly on instances * for (const instance of instances.items) { * if (instance.latestRunStatus === 'Faulted') { * await instance.close({ comment: 'Closing faulted case instance' }); * } * } * * // With filtering * const filteredInstances = await caseInstances.getAll({ * processKey: 'MyCaseProcess' * }); * * // First page with pagination * const page1 = await caseInstances.getAll({ pageSize: 10 }); * * // Navigate using cursor * if (page1.hasNextPage) { * const page2 = await caseInstances.getAll({ cursor: page1.nextCursor }); * } * ``` */ getAll(options?: T): Promise ? PaginatedResponse : NonPaginatedResponse>; /** * Get a specific case instance by ID * @param instanceId - The case instance ID * @param folderKey - Required folder key * @returns Promise resolving to case instance with methods * {@link CaseInstanceGetResponse} * @example * ```typescript * // Get a specific case instance * const instance = await caseInstances.getById( * , * * ); * * // Access instance properties * console.log(`Status: ${instance.latestRunStatus}`); * ``` */ getById(instanceId: string, folderKey: string): Promise; /** * Close/Cancel a case instance * @param instanceId - The ID of the instance to cancel * @param folderKey - Required folder key * @param options - Optional close options with comment * @returns Promise resolving to operation result with instance data * @example * ```typescript * // Close a case instance * const result = await caseInstances.close( * , * * ); * * // Or using instance method * const instance = await caseInstances.getById( * , * * ); * const result = await instance.close(); * * console.log(`Closed: ${result.success}`); * * // Close with a comment * const resultWithComment = await instance.close({ * comment: 'Closing due to invalid input data' * }); * * if (resultWithComment.success) { * console.log(`Instance ${resultWithComment.data.instanceId} status: ${resultWithComment.data.status}`); * } * ``` */ close(instanceId: string, folderKey: string, options?: CaseInstanceOperationOptions): Promise>; /** * Pause a case instance * @param instanceId - The ID of the instance to pause * @param folderKey - Required folder key * @param options - Optional pause options with comment * @returns Promise resolving to operation result with instance data */ pause(instanceId: string, folderKey: string, options?: CaseInstanceOperationOptions): Promise>; /** * Reopen a case instance from a specified element * @param instanceId - The ID of the case instance * @param folderKey - Required folder key * @param options - Reopen options containing stageId (the stage ID to resume from) and an optional comment * @returns Promise resolving to operation result with instance data * {@link CaseInstanceOperationResponse} * @example * ```typescript * import { CaseInstances } from '@uipath/uipath-typescript/cases'; * * const caseInstances = new CaseInstances(sdk); * * // First, get the available stages for the case instance * const stages = await caseInstances.getStages('', ''); * const stageId = stages[0].id; // Select the stage to reopen from * * // Reopen a case instance from a specific stage * const result = await caseInstances.reopen( * '', * '', * { stageId } * ); * * // Reopen with a comment * const result = await caseInstances.reopen( * '', * '', * { stageId, comment: 'Reopening to retry failed stage' } * ); * * // Or using instance method * const instance = await caseInstances.getById('', ''); * const stages = await instance.getStages(); * const result = await instance.reopen({ stageId: stages[0].id }); * ``` */ reopen(instanceId: string, folderKey: string, options: CaseInstanceReopenOptions): Promise>; /** * Resume a case instance * @param instanceId - The ID of the instance to resume * @param folderKey - Required folder key * @param options - Optional resume options with comment * @returns Promise resolving to operation result with instance data */ resume(instanceId: string, folderKey: string, options?: CaseInstanceOperationOptions): Promise>; /** * Send a message to a running case instance * * Messages resolve wait points in the case — selecting the next stage when the case * is waiting for a user to choose one, or starting a manually-triggered (ad-hoc) case task. * * @param instanceId - The ID of the case instance to send the message to * @param folderKey - Required folder key * @param name - The message name — a well-known `CaseInstanceMessageName` or a custom message name defined in the case model * @param options - Optional message options with itemData payload and reference override * @returns Promise that resolves when the message is accepted * @example * ```typescript * import { CaseInstances, CaseInstanceMessageName } from '@uipath/uipath-typescript/cases'; * * const caseInstances = new CaseInstances(sdk); * * // Select the next stage when the case is waiting for a user to choose one * await caseInstances.sendMessage( * '', * '', * CaseInstanceMessageName.UserSelectStage, * { itemData: { stageName: 'Review' } } * ); * * // Start a manually-triggered (ad-hoc) case task * await caseInstances.sendMessage( * '', * '', * CaseInstanceMessageName.UserAdhocTrigger, * { itemData: { taskNames: ['Approve Invoice'] } } * ); * * // Or using instance method * const instance = await caseInstances.getById('', ''); * await instance.sendMessage( * CaseInstanceMessageName.UserAdhocTrigger, * { itemData: { taskNames: ['Approve Invoice'] } } * ); * ``` */ sendMessage(instanceId: string, folderKey: string, name: string, options?: CaseInstanceSendMessageOptions): Promise; /** * Get execution history for a case instance * @param instanceId - The ID of the case instance * @param folderKey - Required folder key * @returns Promise resolving to instance execution history * {@link CaseInstanceExecutionHistoryResponse} * @example * ```typescript * // Get execution history for a case instance * const history = await caseInstances.getExecutionHistory( * , * * ); * * // Access element executions * if (history.elementExecutions) { * for (const execution of history.elementExecutions) { * console.log(`Element: ${execution.elementName} - Status: ${execution.status}`); * } * } * ``` */ getExecutionHistory(instanceId: string, folderKey: string): Promise; /** * Get stages and its associated tasks information for a case instance * @param caseInstanceId - The ID of the case instance * @param folderKey - Required folder key * @returns Promise resolving to an array of case stages with their tasks and status * @example * ```typescript * // Get stages for a case instance * const stages = await caseInstances.getStages( * , * * ); * * // Iterate through stages * for (const stage of stages) { * console.log(`Stage: ${stage.name} - Status: ${stage.status}`); * * // Check tasks in the stage * for (const taskGroup of stage.tasks) { * for (const task of taskGroup) { * console.log(` Task: ${task.name} - Status: ${task.status}`); * } * } * } * ``` */ getStages(caseInstanceId: string, folderKey: string): Promise; /** * Get human in the loop tasks associated with a case instance * * The method returns either: * - An array of tasks (when no pagination parameters are provided) * - A paginated result with navigation cursors (when any pagination parameter is provided) * * @param caseInstanceId - The ID of the case instance * @param options - Optional filtering and pagination options * @returns Promise resolving to human in the loop tasks associated with the case instance * @example * ```typescript * // Get all tasks for a case instance (non-paginated) * const actionTasks = await caseInstances.getActionTasks( * , * ); * * // First page with pagination * const page1 = await caseInstances.getActionTasks( * , * { pageSize: 10 } * ); * // Iterate through tasks * for (const task of page1.items) { * console.log(`Task: ${task.title}`); * console.log(`Task: ${task.status}`); * } * * // Jump to specific page * const page5 = await caseInstances.getActionTasks( * , * { * jumpToPage: 5, * pageSize: 10 * } * ); * ``` */ getActionTasks(caseInstanceId: string, options?: T): Promise ? PaginatedResponse : NonPaginatedResponse>; /** * Get SLA summary for all case instances across folders. * * Returns SLA status, due times, escalation info, and instance metadata for each case instance. * The default page size is 50, so only the top 50 items are returned when no pagination options are provided. * * @param options - Optional filtering and pagination options * @returns Promise resolving to {@link SlaSummaryResponse}, paginated or non-paginated based on options * @example * ```typescript * // Non-paginated (returns top 50 items by default) * const summary = await caseInstances.getSlaSummary(); * console.log(`Found ${summary.totalCount} cases`); * * // Filter by case instance ID * const filtered = await caseInstances.getSlaSummary({ * caseInstanceId: '' * }); * * // Filter by time range * const timeFiltered = await caseInstances.getSlaSummary({ * startTimeUtc: new Date('2026-01-01'), * endTimeUtc: new Date('2026-01-31') * }); * * // With pagination * const page1 = await caseInstances.getSlaSummary({ pageSize: 25 }); * if (page1.hasNextPage) { * const page2 = await caseInstances.getSlaSummary({ cursor: page1.nextCursor }); * } * * // Jump to specific page * const page3 = await caseInstances.getSlaSummary({ jumpToPage: 3, pageSize: 25 }); * ``` */ getSlaSummary(options?: T): Promise ? PaginatedResponse : NonPaginatedResponse>; /** * Get stages SLA summary for case instances across folders. * * Returns stage-level SLA status and escalation information for each case instance, aggregated from Insights Real-Time Monitoring. * * @param options - Optional filtering options * @returns Promise resolving to an array of {@link CaseInstanceStageSLAResponse} * @example * ```typescript * // Get stages SLA summary for all case instances * const stagesSla = await caseInstances.getStagesSlaSummary(); * for (const item of stagesSla) { * console.log(`Instance: ${item.caseInstanceId}`); * for (const stage of item.stages) { * console.log(` Stage: ${stage.name} - SLA Status: ${stage.slaStatus}, Due: ${stage.slaDueTime}`); * } * } * * // Filter by case instance ID * const filtered = await caseInstances.getStagesSlaSummary({ * caseInstanceId: '' * }); * * // Using bound method on a case instance * const instance = await caseInstances.getById('', ''); * const stagesSla = await instance.getStagesSlaSummary(); * ``` */ getStagesSlaSummary(options?: CaseInstanceStageSLAOptions): Promise; } interface CaseInstanceMethods { /** * Closes/cancels this case instance * * @param options - Optional close options with comment * @returns Promise resolving to operation result */ close(options?: CaseInstanceOperationOptions): Promise>; /** * Pauses this case instance * * @param options - Optional pause options with comment * @returns Promise resolving to operation result */ pause(options?: CaseInstanceOperationOptions): Promise>; /** * Reopens this case instance from a specified element * * @param options - Reopen options containing stageId (the stage ID to resume from) and an optional comment * @returns Promise resolving to operation result */ reopen(options: CaseInstanceReopenOptions): Promise>; /** * Resumes this case instance * * @param options - Optional resume options with comment * @returns Promise resolving to operation result */ resume(options?: CaseInstanceOperationOptions): Promise>; /** * Sends a message to this case instance * * @param name - The message name — a well-known `CaseInstanceMessageName` or a custom message name defined in the case model * @param options - Optional message options with itemData payload and reference override * @returns Promise that resolves when the message is accepted */ sendMessage(name: string, options?: CaseInstanceSendMessageOptions): Promise; /** * Gets execution history for this case instance * * @returns Promise resolving to instance execution history */ getExecutionHistory(): Promise; /** * Gets stages and their associated tasks for this case instance * * @returns Promise resolving to an array of case stages with their tasks and status */ getStages(): Promise; /** * Gets human in the loop tasks associated with this case instance * * @param options - Optional filtering and pagination options * @returns Promise resolving to human in the loop tasks associated with the case instance */ getActionTasks(options?: T): Promise ? PaginatedResponse : NonPaginatedResponse>; /** * Gets the SLA summary for this case instance. * The default page size is 50, so only the top 50 items are returned when no pagination options are provided. * * @param options - Optional time range filtering and pagination options * @returns Promise resolving to SLA summary items for this case instance */ getSlaSummary = Omit>(options?: T): Promise ? PaginatedResponse : NonPaginatedResponse>; /** * Gets the stages SLA summary for this case instance. * * @returns Promise resolving to an array of stage SLA summary items for this case instance */ getStagesSlaSummary(): Promise; } type CaseInstanceGetResponse = RawCaseInstanceGetResponse & CaseInstanceMethods; /** * Creates an actionable case instance by combining API case instance data with operational methods. * * @param instanceData - The case instance data from API * @param service - The case instance service instance * @returns A case instance object with added methods */ declare function createCaseInstanceWithMethods(instanceData: RawCaseInstanceGetResponse, service: CaseInstancesServiceModel): CaseInstanceGetResponse; /** * 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 interacting with UiPath Maestro Cases */ declare class CasesService extends BaseService implements CasesServiceModel { getAll(options?: CaseGetAllOptions): Promise; getTopRunCount(startTime: Date, endTime: Date, options?: TopQueryOptions): Promise; getTopElementFailedCount(startTime: Date, endTime: Date, options?: TopQueryOptions): Promise; getInstanceStatusTimeline(startTime: Date, endTime: Date, options?: TimelineOptions): Promise; getIncidentsTimeline(startTime: Date, endTime: Date, options?: TimelineOptions): Promise; getTopFaultedCount(startTime: Date, endTime: Date, options?: TopQueryOptions): Promise; getTopExecutionDuration(startTime: Date, endTime: Date, options?: TopQueryOptions): Promise; getElementStats(request: MaestroProcessStatsRequest): Promise; getInstanceStats(request: MaestroProcessStatsRequest): Promise; /** * Extract a readable case name from the packageId * @param packageId - The full package identifier * @returns A human-readable case name * @private */ private extractCaseName; } declare class CaseInstancesService extends BaseService implements CaseInstancesServiceModel { private taskService; /** * Creates an instance of the Case Instances service. * * @param instance - UiPath SDK instance providing authentication and configuration */ constructor(instance: IUiPath); getAll(options?: T): Promise ? PaginatedResponse : NonPaginatedResponse>; getById(instanceId: string, folderKey: string): Promise; /** * Enhance a single case instance with case JSON data * @param instance - The case instance to enhance * @returns Promise resolving to enhanced instance * @private */ private enhanceInstanceWithCaseJson; /** * Enhance multiple case instances with case JSON data * @param instances - Array of case instances to enhance * @returns Promise resolving to array of enhanced instances * @private */ private enhanceInstancesWithCaseJson; /** * Get case JSON for a specific instance * @param instanceId - The case instance ID * @param folderKey - Required folder key * @returns Promise resolving to case JSON data * @private */ private getCaseJson; close(instanceId: string, folderKey: string, options?: CaseInstanceOperationOptions): Promise>; pause(instanceId: string, folderKey: string, options?: CaseInstanceOperationOptions): Promise>; reopen(instanceId: string, folderKey: string, options: CaseInstanceReopenOptions): Promise>; resume(instanceId: string, folderKey: string, options?: CaseInstanceOperationOptions): Promise>; sendMessage(instanceId: string, folderKey: string, name: string, options?: CaseInstanceSendMessageOptions): Promise; getExecutionHistory(instanceId: string, folderKey: string): Promise; getStages(caseInstanceId: string, folderKey: string): Promise; /** * Create a map of element ID to execution data * @param executionHistory - The execution history response * @returns Map of elementId to execution metadata * @private */ private createExecutionMap; /** * Create a map of binding IDs to their values * @param caseJsonResponse - The case JSON response * @returns Map of binding ID to binding object * @private */ private createBindingsMap; /** * Resolve binding values from binding expressions * @param value - The value that may contain binding references * @param bindingsMap - Map of binding IDs to binding objects * @returns Resolved value * @private */ private resolveBinding; /** * Process tasks for a stage node * @param node - The stage node containing tasks * @param executionMap - Map of element IDs to execution data * @param bindingsMap - Map of binding IDs to binding objects * @returns Processed tasks array * @private */ private processTasks; /** * Create a stage from a case node * @param node - The case node to process * @param executionMap - Map of element IDs to execution data * @param bindingsMap - Map of binding IDs to binding objects * @returns CaseGetStageResponse object * @private */ private createStageFromNode; getActionTasks(caseInstanceId: string, options?: T): Promise ? PaginatedResponse : NonPaginatedResponse>; getSlaSummary(options?: T): Promise ? PaginatedResponse : NonPaginatedResponse>; getStagesSlaSummary(options?: CaseInstanceStageSLAOptions): Promise; } export { CaseInstanceMessageName, CaseInstancesService as CaseInstances, CaseInstancesService, CasesService as Cases, CasesService, EscalationActionType, EscalationRecipientScope, EscalationTriggerType, InstanceFinalStatus, InstanceStatus, SLADurationUnit, SlaSummaryStatus, StageTaskType, TimeInterval, createCaseInstanceWithMethods, createCaseWithMethods }; export type { CaseAppConfig, CaseAppOverview, CaseGetAllOptions, CaseGetAllResponse, CaseGetAllWithMethodsResponse, CaseGetStageResponse, CaseGetTopDurationResponse, CaseGetTopFaultedCountResponse, CaseGetTopRunCountResponse, CaseInstanceExecutionHistoryResponse, CaseInstanceGetAllOptions, CaseInstanceGetAllWithPaginationOptions, CaseInstanceGetResponse, CaseInstanceMethods, CaseInstanceOperationOptions, CaseInstanceOperationResponse, CaseInstanceReopenOptions, CaseInstanceRun, CaseInstanceSendMessageOptions, CaseInstanceSlaSummaryOptions, CaseInstanceStageSLAOptions, CaseInstanceStageSLAResponse, CaseInstanceStageSLAStage, CaseInstancesServiceModel, CaseMethods, CasesServiceModel, DurationStats, ElementExecutionMetadata, ElementGetTopFailedCountResponse, ElementRunMetadata, ElementStats, EscalationAction, EscalationRecipient, EscalationRule, EscalationTriggerMetadata, GetTopBaseResponse, GetTopDurationResponse, GetTopFaultedCountResponse, GetTopRunCountResponse, IncidentTimelineResponse, InstanceStats, InstanceStatusTimelineResponse, MaestroProcessStatsRequest, RawCaseInstanceGetResponse, SlaSummaryResponse, StageSLA, StageTask, TimelineOptions, TopQueryOptions };