@uipath/uipath-typescript 1.4.2 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/agent-memory/index.d.ts +4 -1
  2. package/dist/agents/index.cjs +341 -6
  3. package/dist/agents/index.d.ts +717 -16
  4. package/dist/agents/index.mjs +342 -7
  5. package/dist/assets/index.cjs +25 -9
  6. package/dist/assets/index.mjs +25 -9
  7. package/dist/attachments/index.cjs +25 -9
  8. package/dist/attachments/index.mjs +25 -9
  9. package/dist/buckets/index.cjs +25 -9
  10. package/dist/buckets/index.mjs +25 -9
  11. package/dist/cases/index.cjs +621 -524
  12. package/dist/cases/index.d.ts +186 -43
  13. package/dist/cases/index.mjs +621 -524
  14. package/dist/conversational-agent/index.cjs +25 -9
  15. package/dist/conversational-agent/index.mjs +25 -9
  16. package/dist/core/index.cjs +1 -1
  17. package/dist/core/index.mjs +1 -1
  18. package/dist/entities/index.cjs +25 -9
  19. package/dist/entities/index.mjs +25 -9
  20. package/dist/feedback/index.cjs +25 -9
  21. package/dist/feedback/index.mjs +25 -9
  22. package/dist/index.cjs +332 -62
  23. package/dist/index.d.ts +827 -89
  24. package/dist/index.mjs +333 -63
  25. package/dist/index.umd.js +332 -62
  26. package/dist/jobs/index.cjs +129 -14
  27. package/dist/jobs/index.d.ts +10 -5
  28. package/dist/jobs/index.mjs +129 -14
  29. package/dist/maestro-processes/index.cjs +198 -100
  30. package/dist/maestro-processes/index.d.ts +188 -43
  31. package/dist/maestro-processes/index.mjs +198 -100
  32. package/dist/processes/index.cjs +25 -9
  33. package/dist/processes/index.d.ts +6 -1
  34. package/dist/processes/index.mjs +25 -9
  35. package/dist/queues/index.cjs +25 -9
  36. package/dist/queues/index.mjs +25 -9
  37. package/dist/tasks/index.cjs +25 -9
  38. package/dist/tasks/index.d.ts +4 -1
  39. package/dist/tasks/index.mjs +25 -9
  40. package/dist/traces/index.cjs +2 -2
  41. package/dist/traces/index.d.ts +3 -3
  42. package/dist/traces/index.mjs +2 -2
  43. package/package.json +1 -1
@@ -329,7 +329,10 @@ interface AgentMemoryGetCallsTimelineOptions extends AgentMemoryFilterOptions {
329
329
  * Options for retrieving the top memory spaces.
330
330
  */
331
331
  interface AgentMemoryGetTopSpacesOptions extends AgentMemoryFilterOptions {
332
- /** Maximum number of memory spaces to return, ranked by memory count. Defaults to 5 when omitted. */
332
+ /**
333
+ * Maximum number of memory spaces to return, ranked by memory count.
334
+ * @default 5
335
+ */
333
336
  limit?: number;
334
337
  }
335
338
  /**
@@ -1604,6 +1604,25 @@ class BaseService {
1604
1604
  }
1605
1605
  _BaseService_apiClient = new WeakMap();
1606
1606
 
1607
+ /**
1608
+ * Common enum for job state used across services
1609
+ */
1610
+ var JobState;
1611
+ (function (JobState) {
1612
+ JobState["Pending"] = "Pending";
1613
+ JobState["Running"] = "Running";
1614
+ JobState["Stopping"] = "Stopping";
1615
+ JobState["Terminating"] = "Terminating";
1616
+ JobState["Faulted"] = "Faulted";
1617
+ JobState["Successful"] = "Successful";
1618
+ JobState["Stopped"] = "Stopped";
1619
+ JobState["Suspended"] = "Suspended";
1620
+ JobState["Resumed"] = "Resumed";
1621
+ JobState["Cancelled"] = "Cancelled";
1622
+ /** Server-side fallback for an unrecognized or missing job state. */
1623
+ JobState["Unknown"] = "Unknown";
1624
+ })(JobState || (JobState = {}));
1625
+
1607
1626
  /**
1608
1627
  * Base path constants for different services
1609
1628
  */
@@ -1619,10 +1638,20 @@ const AGENTS_ENDPOINTS = {
1619
1638
  GET_INCIDENTS: `${INSIGHTS_RTM_BASE}/Agents/incidents`,
1620
1639
  /** Time-series of error counts grouped by agent over the requested window. */
1621
1640
  GET_ERRORS_TIMELINE: `${INSIGHTS_RTM_BASE}/Agents/errors`,
1622
- /** Time-series of AGU consumption over the requested window. */
1641
+ /** Time-series of Agent Units consumption over the requested window. */
1623
1642
  GET_CONSUMPTION_TIMELINE: `${INSIGHTS_RTM_BASE}/Agents/consumptionTimeline`,
1624
1643
  /** Time-series of agent latency (per-percentile) over the requested window. */
1625
1644
  GET_LATENCY_TIMELINE: `${INSIGHTS_RTM_BASE}/Agents/latencyTimeline`,
1645
+ /** Top-N agents by error count over the requested window. */
1646
+ GET_TOP_ERROR_COUNT: `${INSIGHTS_RTM_BASE}/Agents/topErroredAgents`,
1647
+ /** Top-N agents by unit consumption over the requested window. */
1648
+ GET_TOP_CONSUMPTION: `${INSIGHTS_RTM_BASE}/Agents/consumption`,
1649
+ /** Distribution of incidents across types (errors, escalations, policy). */
1650
+ GET_INCIDENT_DISTRIBUTION: `${INSIGHTS_RTM_BASE}/Agents/incidentDistribution`,
1651
+ /** Aggregate per-agent and overall job/success/duration summary over the requested window. */
1652
+ GET_SUMMARY: `${INSIGHTS_RTM_BASE}/Agents/summary`,
1653
+ /** Aggregate Agent Units and Platform Units consumption per agent over the requested window. */
1654
+ GET_UNIT_CONSUMPTION_SUMMARY: `${INSIGHTS_RTM_BASE}/Agents/summary/unit-consumption`,
1626
1655
  };
1627
1656
 
1628
1657
  /**
@@ -1654,6 +1683,33 @@ const sdkClient = coreTelemetry.getOrCreateClient(CLOUD_ROLE_NAME);
1654
1683
  const track = coreTelemetry.createTrack(sdkClient);
1655
1684
  coreTelemetry.createTrackEvent(sdkClient);
1656
1685
 
1686
+ const JOB_STATUS_ALIASES = {
1687
+ Success: JobState.Successful,
1688
+ };
1689
+ const VALID_JOB_STATES = new Set(Object.values(JobState));
1690
+ /**
1691
+ * Permissively maps a raw `lastJobStatus` string to a {@link JobState}. Known
1692
+ * aliases are translated first, canonical values pass through, and anything
1693
+ * unrecognized falls back to {@link JobState.Unknown} rather than throwing.
1694
+ */
1695
+ function toJobState(raw) {
1696
+ if (Object.prototype.hasOwnProperty.call(JOB_STATUS_ALIASES, raw))
1697
+ return JOB_STATUS_ALIASES[raw];
1698
+ if (VALID_JOB_STATES.has(raw))
1699
+ return raw;
1700
+ return JobState.Unknown;
1701
+ }
1702
+ /**
1703
+ * Transforms a raw summary period into the public shape, normalizing every
1704
+ * agent's raw `lastJobStatus` string to a {@link JobState}. Tolerates a missing
1705
+ * `agents` array (treated as empty).
1706
+ */
1707
+ function normalizeSummaryPeriod(period) {
1708
+ return {
1709
+ ...period,
1710
+ agents: (period.agents ?? []).map((agent) => ({ ...agent, lastJobStatus: toJobState(agent.lastJobStatus) })),
1711
+ };
1712
+ }
1657
1713
  /**
1658
1714
  * Service for interacting with the UiPath Agents API.
1659
1715
  */
@@ -1835,7 +1891,7 @@ class AgentService extends BaseService {
1835
1891
  return response.data.data;
1836
1892
  }
1837
1893
  /**
1838
- * Retrieves a time-series of AGU (Agent Units) consumption over the requested window.
1894
+ * Retrieves a time-series of Agent Units consumption over the requested window.
1839
1895
  *
1840
1896
  * @param startTime - Inclusive lower bound for the query window
1841
1897
  * @param endTime - Exclusive upper bound for the query window
@@ -1847,13 +1903,13 @@ class AgentService extends BaseService {
1847
1903
  *
1848
1904
  * const agents = new Agents(sdk);
1849
1905
  *
1850
- * // AGU consumption timeline in May 2025
1906
+ * // Agent Units consumption timeline in May 2025
1851
1907
  * const result = await agents.getConsumptionTimeline(
1852
1908
  * new Date('2025-05-01T00:00:00Z'),
1853
1909
  * new Date('2025-06-01T00:00:00Z'),
1854
1910
  * );
1855
1911
  * result.forEach((point) => {
1856
- * console.log(`${point.timeSlice}: ${point.aguConsumption} AGU`);
1912
+ * console.log(`${point.timeSlice}: ${point.aguConsumption} Agent Units`);
1857
1913
  * });
1858
1914
  * ```
1859
1915
  * @example
@@ -1915,6 +1971,246 @@ class AgentService extends BaseService {
1915
1971
  const response = await this.post(AGENTS_ENDPOINTS.GET_LATENCY_TIMELINE, body);
1916
1972
  return response.data.data;
1917
1973
  }
1974
+ /**
1975
+ * Retrieves the top-N agents ranked by error count over the requested window.
1976
+ *
1977
+ * @param startTime - Inclusive lower bound for the query window
1978
+ * @param endTime - Exclusive upper bound for the query window
1979
+ * @param options - Optional filters
1980
+ * @returns Promise resolving to {@link AgentGetTopErrorCountResponse}
1981
+ * @example
1982
+ * ```typescript
1983
+ * import { Agents } from '@uipath/uipath-typescript/agents';
1984
+ *
1985
+ * const agents = new Agents(sdk);
1986
+ *
1987
+ * // Top agents by error count in May 2025
1988
+ * const result = await agents.getTopErrorCount(
1989
+ * new Date('2025-05-01T00:00:00Z'),
1990
+ * new Date('2025-06-01T00:00:00Z'),
1991
+ * );
1992
+ * result.data.forEach((agent) => {
1993
+ * console.log(`${agent.name}: ${agent.count} errors`);
1994
+ * });
1995
+ * ```
1996
+ * @example
1997
+ * ```typescript
1998
+ * // Scope to specific folders and top 5 agents
1999
+ * const result = await agents.getTopErrorCount(
2000
+ * new Date('2025-05-01T00:00:00Z'),
2001
+ * new Date('2025-06-01T00:00:00Z'),
2002
+ * {
2003
+ * folderKeys: ['<folderKey1>'],
2004
+ * limit: 5,
2005
+ * },
2006
+ * );
2007
+ * ```
2008
+ */
2009
+ async getTopErrorCount(startTime, endTime, options) {
2010
+ const body = this.buildAgentFilterBody(startTime, endTime, options);
2011
+ const response = await this.post(AGENTS_ENDPOINTS.GET_TOP_ERROR_COUNT, body);
2012
+ return response.data;
2013
+ }
2014
+ /**
2015
+ * Retrieves the top-N agents ranked by unit consumption over the requested window.
2016
+ *
2017
+ * @param startTime - Inclusive lower bound for the query window
2018
+ * @param endTime - Exclusive upper bound for the query window
2019
+ * @param options - Optional filters
2020
+ * @returns Promise resolving to {@link AgentGetTopConsumptionResponse}
2021
+ * @example
2022
+ * ```typescript
2023
+ * import { Agents } from '@uipath/uipath-typescript/agents';
2024
+ *
2025
+ * const agents = new Agents(sdk);
2026
+ *
2027
+ * // Top agents by consumption in May 2025
2028
+ * const result = await agents.getTopConsumption(
2029
+ * new Date('2025-05-01T00:00:00Z'),
2030
+ * new Date('2025-06-01T00:00:00Z'),
2031
+ * );
2032
+ * console.log(`Total consumed: ${result.totalConsumed}`);
2033
+ * result.agents.forEach((agent) => {
2034
+ * console.log(`${agent.agentName}: ${agent.consumedQuantity}`);
2035
+ * });
2036
+ * ```
2037
+ * @example
2038
+ * ```typescript
2039
+ * import { Agents, AgentType } from '@uipath/uipath-typescript/agents';
2040
+ *
2041
+ * const agents = new Agents(sdk);
2042
+ *
2043
+ * // Top 5 healthy autonomous agents by consumption
2044
+ * const result = await agents.getTopConsumption(
2045
+ * new Date('2025-05-01T00:00:00Z'),
2046
+ * new Date('2025-06-01T00:00:00Z'),
2047
+ * {
2048
+ * limit: 5,
2049
+ * healthy: true,
2050
+ * agentTypes: [AgentType.Autonomous],
2051
+ * },
2052
+ * );
2053
+ * ```
2054
+ */
2055
+ async getTopConsumption(startTime, endTime, options) {
2056
+ const body = this.buildAgentFilterBody(startTime, endTime, options);
2057
+ if (options?.healthy !== undefined)
2058
+ body.healthy = options.healthy;
2059
+ if (options?.healthThreshold !== undefined)
2060
+ body.healthThreshold = options.healthThreshold;
2061
+ if (options?.agentTypes?.length)
2062
+ body.agentTypes = options.agentTypes.join(',');
2063
+ const response = await this.post(AGENTS_ENDPOINTS.GET_TOP_CONSUMPTION, body);
2064
+ return response.data.data;
2065
+ }
2066
+ /**
2067
+ * Retrieves breakdown of agent incidents count — errors, escalations,
2068
+ * and policy violations over a requested window.
2069
+ *
2070
+ * @param startTime - Inclusive lower bound for the query window
2071
+ * @param endTime - Exclusive upper bound for the query window
2072
+ * @param options - Optional filters
2073
+ * @returns Promise resolving to {@link AgentGetIncidentDistributionResponse}
2074
+ * @example
2075
+ * ```typescript
2076
+ * import { Agents } from '@uipath/uipath-typescript/agents';
2077
+ *
2078
+ * const agents = new Agents(sdk);
2079
+ *
2080
+ * // Incident distribution in May 2025
2081
+ * const result = await agents.getIncidentDistribution(
2082
+ * new Date('2025-05-01T00:00:00Z'),
2083
+ * new Date('2025-06-01T00:00:00Z'),
2084
+ * );
2085
+ * console.log(`Errors: ${result.errorCount}, Escalations: ${result.escalationCount}, Policy: ${result.policyCount}`);
2086
+ * ```
2087
+ * @example
2088
+ * ```typescript
2089
+ * // Scope to specific folders
2090
+ * const result = await agents.getIncidentDistribution(
2091
+ * new Date('2025-05-01T00:00:00Z'),
2092
+ * new Date('2025-06-01T00:00:00Z'),
2093
+ * {
2094
+ * folderKeys: ['<folderKey1>'],
2095
+ * },
2096
+ * );
2097
+ * ```
2098
+ */
2099
+ async getIncidentDistribution(startTime, endTime, options) {
2100
+ const body = this.buildAgentFilterBody(startTime, endTime, options);
2101
+ const response = await this.post(AGENTS_ENDPOINTS.GET_INCIDENT_DISTRIBUTION, body);
2102
+ return response.data.data;
2103
+ }
2104
+ /**
2105
+ * Retrieves a job-execution summary for the requested window: overall totals
2106
+ * (total jobs, successful jobs, success rate, average duration) alongside a
2107
+ * per-agent breakdown. When `lookbackPeriodAnalysis` is enabled, a comparable
2108
+ * summary for the preceding window of equal length is included too.
2109
+ *
2110
+ * @param startTime - Inclusive lower bound for the query window
2111
+ * @param endTime - Exclusive upper bound for the query window
2112
+ * @param options - Optional filters
2113
+ * @returns Promise resolving to {@link AgentGetSummaryResponse}
2114
+ * @example
2115
+ * ```typescript
2116
+ * import { Agents } from '@uipath/uipath-typescript/agents';
2117
+ *
2118
+ * const agents = new Agents(sdk);
2119
+ *
2120
+ * // Summary for May 2025
2121
+ * const result = await agents.getSummary(
2122
+ * new Date('2025-05-01T00:00:00Z'),
2123
+ * new Date('2025-06-01T00:00:00Z'),
2124
+ * );
2125
+ * console.log(`Success rate: ${result.currentPeriodSummary.successRate}%`);
2126
+ * ```
2127
+ * @example
2128
+ * ```typescript
2129
+ * import { Agents, AgentExecutionType } from '@uipath/uipath-typescript/agents';
2130
+ *
2131
+ * const agents = new Agents(sdk);
2132
+ *
2133
+ * // Runtime-only summary with lookback comparison
2134
+ * const result = await agents.getSummary(
2135
+ * new Date('2025-05-01T00:00:00Z'),
2136
+ * new Date('2025-06-01T00:00:00Z'),
2137
+ * {
2138
+ * lookbackPeriodAnalysis: true,
2139
+ * executionType: AgentExecutionType.Runtime,
2140
+ * },
2141
+ * );
2142
+ * ```
2143
+ */
2144
+ async getSummary(startTime, endTime, options) {
2145
+ const body = this.buildAgentFilterBody(startTime, endTime, options);
2146
+ if (options?.lookbackPeriodAnalysis !== undefined)
2147
+ body.lookbackPeriodAnalysis = options.lookbackPeriodAnalysis;
2148
+ if (options?.processKey !== undefined)
2149
+ body.processKey = options.processKey;
2150
+ if (options?.folderKey !== undefined)
2151
+ body.folderKey = options.folderKey;
2152
+ if (options?.executionType !== undefined)
2153
+ body.executionType = options.executionType;
2154
+ const response = await this.post(AGENTS_ENDPOINTS.GET_SUMMARY, body);
2155
+ const summary = response.data.data;
2156
+ return {
2157
+ currentPeriodSummary: normalizeSummaryPeriod(summary.currentPeriodSummary),
2158
+ lookbackPeriodSummary: summary.lookbackPeriodSummary
2159
+ ? normalizeSummaryPeriod(summary.lookbackPeriodSummary)
2160
+ : undefined,
2161
+ };
2162
+ }
2163
+ /**
2164
+ * Retrieves an aggregate Agent Units and Platform Units consumption summary per agent over the
2165
+ * requested window.
2166
+ *
2167
+ * @param startTime - Inclusive lower bound for the query window
2168
+ * @param endTime - Exclusive upper bound for the query window
2169
+ * @param options - Optional filters
2170
+ * @returns Promise resolving to {@link AgentGetUnitConsumptionSummaryResponse}
2171
+ * @example
2172
+ * ```typescript
2173
+ * import { Agents } from '@uipath/uipath-typescript/agents';
2174
+ *
2175
+ * const agents = new Agents(sdk);
2176
+ *
2177
+ * // Unit consumption summary for May 2025
2178
+ * const result = await agents.getUnitConsumptionSummary(
2179
+ * new Date('2025-05-01T00:00:00Z'),
2180
+ * new Date('2025-06-01T00:00:00Z'),
2181
+ * );
2182
+ * console.log(`Agent Units complete jobs: ${result.currentPeriodSummary.totalAgentUnitConsumption.completeJobs}`);
2183
+ * ```
2184
+ * @example
2185
+ * ```typescript
2186
+ * import { Agents, AgentExecutionType } from '@uipath/uipath-typescript/agents';
2187
+ *
2188
+ * const agents = new Agents(sdk);
2189
+ *
2190
+ * // Runtime-only summary with lookback comparison
2191
+ * const result = await agents.getUnitConsumptionSummary(
2192
+ * new Date('2025-05-01T00:00:00Z'),
2193
+ * new Date('2025-06-01T00:00:00Z'),
2194
+ * {
2195
+ * lookbackPeriodAnalysis: true,
2196
+ * executionType: AgentExecutionType.Runtime,
2197
+ * },
2198
+ * );
2199
+ * ```
2200
+ */
2201
+ async getUnitConsumptionSummary(startTime, endTime, options) {
2202
+ const body = this.buildAgentFilterBody(startTime, endTime, options);
2203
+ if (options?.lookbackPeriodAnalysis !== undefined)
2204
+ body.lookbackPeriodAnalysis = options.lookbackPeriodAnalysis;
2205
+ if (options?.processKey !== undefined)
2206
+ body.processKey = options.processKey;
2207
+ if (options?.folderKey !== undefined)
2208
+ body.folderKey = options.folderKey;
2209
+ if (options?.executionType !== undefined)
2210
+ body.executionType = options.executionType;
2211
+ const response = await this.post(AGENTS_ENDPOINTS.GET_UNIT_CONSUMPTION_SUMMARY, body);
2212
+ return response.data.data;
2213
+ }
1918
2214
  /**
1919
2215
  * Builds the common POST request body shared by the agent filter endpoints —
1920
2216
  * the required time window plus any optional folder/agent/project/process
@@ -1955,6 +2251,21 @@ __decorate([
1955
2251
  __decorate([
1956
2252
  track('Agents.GetLatencyTimeline')
1957
2253
  ], AgentService.prototype, "getLatencyTimeline", null);
2254
+ __decorate([
2255
+ track('Agents.GetTopErrorCount')
2256
+ ], AgentService.prototype, "getTopErrorCount", null);
2257
+ __decorate([
2258
+ track('Agents.GetTopConsumption')
2259
+ ], AgentService.prototype, "getTopConsumption", null);
2260
+ __decorate([
2261
+ track('Agents.GetIncidentDistribution')
2262
+ ], AgentService.prototype, "getIncidentDistribution", null);
2263
+ __decorate([
2264
+ track('Agents.GetSummary')
2265
+ ], AgentService.prototype, "getSummary", null);
2266
+ __decorate([
2267
+ track('Agents.GetUnitConsumptionSummary')
2268
+ ], AgentService.prototype, "getUnitConsumptionSummary", null);
1958
2269
 
1959
2270
  /**
1960
2271
  * Columns available for ordering results.
@@ -1967,9 +2278,9 @@ exports.AgentListSortColumn = void 0;
1967
2278
  AgentListSortColumn["HealthScore"] = "HealthScore";
1968
2279
  AgentListSortColumn["LastIncident"] = "LastIncident";
1969
2280
  AgentListSortColumn["FolderName"] = "FolderName";
1970
- /** Quantity of AGU (Agent Units) consumed */
2281
+ /** Quantity of Agent Units consumed */
1971
2282
  AgentListSortColumn["QuantityAGU"] = "QuantityAGU";
1972
- /** Quantity of PLTU (Platform Units) consumed */
2283
+ /** Quantity of Platform Units consumed */
1973
2284
  AgentListSortColumn["QuantityPLTU"] = "QuantityPLTU";
1974
2285
  AgentListSortColumn["FolderPath"] = "FolderPath";
1975
2286
  })(exports.AgentListSortColumn || (exports.AgentListSortColumn = {}));
@@ -1991,5 +2302,29 @@ exports.AgentErrorSortColumn = void 0;
1991
2302
  AgentErrorSortColumn["LastSeenFolderName"] = "LastSeenFolderName";
1992
2303
  AgentErrorSortColumn["LastSeenFolderPath"] = "LastSeenFolderPath";
1993
2304
  })(exports.AgentErrorSortColumn || (exports.AgentErrorSortColumn = {}));
2305
+ /**
2306
+ * Agent type, used to filter consumption results.
2307
+ *
2308
+ * Wire format is the string name, per the API's `StringEnumConverter` serialization.
2309
+ */
2310
+ exports.AgentType = void 0;
2311
+ (function (AgentType) {
2312
+ AgentType["Autonomous"] = "Autonomous";
2313
+ AgentType["Conversational"] = "Conversational";
2314
+ AgentType["Coded"] = "Coded";
2315
+ })(exports.AgentType || (exports.AgentType = {}));
2316
+ /**
2317
+ * Job execution mode filter accepted by the summary endpoints.
2318
+ *
2319
+ * Wire format is the string name (`"Debug"` / `"Runtime"`), per the API's
2320
+ * `StringEnumConverter` serialization.
2321
+ */
2322
+ exports.AgentExecutionType = void 0;
2323
+ (function (AgentExecutionType) {
2324
+ /** Test runs */
2325
+ AgentExecutionType["Debug"] = "Debug";
2326
+ /** Production runs */
2327
+ AgentExecutionType["Runtime"] = "Runtime";
2328
+ })(exports.AgentExecutionType || (exports.AgentExecutionType = {}));
1994
2329
 
1995
2330
  exports.Agents = AgentService;