@uipath/uipath-typescript 1.3.10 → 1.4.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.
- package/dist/agent-memory/index.cjs +1765 -0
- package/dist/agent-memory/index.d.ts +588 -0
- package/dist/agent-memory/index.mjs +1763 -0
- package/dist/agents/index.cjs +1726 -0
- package/dist/agents/index.d.ts +502 -0
- package/dist/agents/index.mjs +1724 -0
- package/dist/assets/index.cjs +155 -30
- package/dist/assets/index.d.ts +84 -5
- package/dist/assets/index.mjs +155 -30
- package/dist/attachments/index.cjs +37 -6
- package/dist/attachments/index.d.ts +1 -0
- package/dist/attachments/index.mjs +37 -6
- package/dist/buckets/index.cjs +37 -6
- package/dist/buckets/index.d.ts +1 -0
- package/dist/buckets/index.mjs +37 -6
- package/dist/cases/index.cjs +192 -10
- package/dist/cases/index.d.ts +208 -7
- package/dist/cases/index.mjs +192 -11
- package/dist/conversational-agent/index.cjs +124 -57
- package/dist/conversational-agent/index.d.ts +190 -122
- package/dist/conversational-agent/index.mjs +124 -57
- package/dist/core/index.cjs +413 -105
- package/dist/core/index.d.ts +15 -0
- package/dist/core/index.mjs +413 -105
- package/dist/entities/index.cjs +135 -70
- package/dist/entities/index.d.ts +146 -45
- package/dist/entities/index.mjs +135 -70
- package/dist/feedback/index.cjs +37 -6
- package/dist/feedback/index.d.ts +1 -0
- package/dist/feedback/index.mjs +37 -6
- package/dist/governance/index.cjs +1782 -0
- package/dist/governance/index.d.ts +598 -0
- package/dist/governance/index.mjs +1780 -0
- package/dist/index.cjs +1050 -291
- package/dist/index.d.ts +1313 -134
- package/dist/index.mjs +1050 -292
- package/dist/index.umd.js +4546 -3770
- package/dist/jobs/index.cjs +37 -6
- package/dist/jobs/index.d.ts +1 -0
- package/dist/jobs/index.mjs +37 -6
- package/dist/maestro-processes/index.cjs +224 -18
- package/dist/maestro-processes/index.d.ts +221 -9
- package/dist/maestro-processes/index.mjs +224 -18
- package/dist/processes/index.cjs +37 -6
- package/dist/processes/index.d.ts +1 -0
- package/dist/processes/index.mjs +37 -6
- package/dist/queues/index.cjs +37 -6
- package/dist/queues/index.d.ts +1 -0
- package/dist/queues/index.mjs +37 -6
- package/dist/tasks/index.cjs +37 -6
- package/dist/tasks/index.d.ts +1 -0
- package/dist/tasks/index.mjs +37 -6
- package/dist/traces/index.cjs +1933 -0
- package/dist/traces/index.d.ts +566 -0
- package/dist/traces/index.mjs +1931 -0
- package/package.json +42 -2
package/dist/cases/index.mjs
CHANGED
|
@@ -59,6 +59,7 @@ var ProcessType;
|
|
|
59
59
|
*/
|
|
60
60
|
const ORCHESTRATOR_BASE = 'orchestrator_';
|
|
61
61
|
const PIMS_BASE = 'pims_';
|
|
62
|
+
const LLMOPS_BASE = 'llmopstenant_';
|
|
62
63
|
const INSIGHTS_RTM_BASE = 'insightsrtm_';
|
|
63
64
|
|
|
64
65
|
/**
|
|
@@ -98,7 +99,7 @@ const MAESTRO_ENDPOINTS = {
|
|
|
98
99
|
INSTANCES: {
|
|
99
100
|
GET_ALL: `${PIMS_BASE}/api/v1/instances`,
|
|
100
101
|
GET_BY_ID: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}`,
|
|
101
|
-
|
|
102
|
+
GET_ELEMENT_EXECUTIONS: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/element-executions`,
|
|
102
103
|
GET_BPMN: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/bpmn`,
|
|
103
104
|
GET_VARIABLES: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/variables`,
|
|
104
105
|
CANCEL: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/cancel`,
|
|
@@ -110,6 +111,9 @@ const MAESTRO_ENDPOINTS = {
|
|
|
110
111
|
GET_BY_PROCESS: (processKey) => `${PIMS_BASE}/api/v1/incidents/process/${processKey}`,
|
|
111
112
|
GET_BY_INSTANCE: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/incidents`,
|
|
112
113
|
},
|
|
114
|
+
TRACES: {
|
|
115
|
+
GET_SPANS: (traceId) => `${LLMOPS_BASE}/api/Traces/spans?traceId=${traceId}`,
|
|
116
|
+
},
|
|
113
117
|
CASES: {
|
|
114
118
|
GET_CASE_JSON: (instanceId) => `${PIMS_BASE}/api/v1/cases/${instanceId}/case-json`,
|
|
115
119
|
GET_ELEMENT_EXECUTIONS: (instanceId) => `${PIMS_BASE}/api/v1/element-executions/case-instances/${instanceId}`,
|
|
@@ -124,13 +128,51 @@ const MAESTRO_ENDPOINTS = {
|
|
|
124
128
|
TOP_PROCESSES_BY_RUN_COUNT: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByRunCount`,
|
|
125
129
|
/** Top processes ranked by failure count */
|
|
126
130
|
TOP_PROCESSES_WITH_FAILURE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcesseswithFailure`,
|
|
131
|
+
/** Top elements ranked by failure count */
|
|
132
|
+
TOP_ELEMENTS_WITH_FAILURE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopElementswithFailure`,
|
|
127
133
|
/** Instance status aggregated by date for time-series charts */
|
|
128
134
|
INSTANCE_STATUS_BY_DATE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceStatusByDate`,
|
|
129
135
|
/** Top processes ranked by total duration */
|
|
130
136
|
TOP_PROCESSES_BY_DURATION: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByDuration`,
|
|
137
|
+
/** Element count by status for agentic instances (process and case) */
|
|
138
|
+
ELEMENT_COUNT_BY_STATUS: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/ElementCountByStatus`,
|
|
131
139
|
},
|
|
132
140
|
};
|
|
133
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Maestro Cases Models
|
|
144
|
+
* Model classes for Maestro cases
|
|
145
|
+
*/
|
|
146
|
+
/**
|
|
147
|
+
* Creates methods for a case object
|
|
148
|
+
*
|
|
149
|
+
* @param caseData - The case data (response from API)
|
|
150
|
+
* @param service - The cases service instance
|
|
151
|
+
* @returns Object containing case methods
|
|
152
|
+
*/
|
|
153
|
+
function createCaseMethods(caseData, service) {
|
|
154
|
+
return {
|
|
155
|
+
getElementStats(startTime, endTime, packageVersion) {
|
|
156
|
+
if (!caseData.processKey)
|
|
157
|
+
throw new Error('Process key is undefined');
|
|
158
|
+
if (!caseData.packageId)
|
|
159
|
+
throw new Error('Package ID is undefined');
|
|
160
|
+
return service.getElementStats(caseData.processKey, caseData.packageId, startTime, endTime, packageVersion);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Creates an actionable case by combining API case data with operational methods.
|
|
166
|
+
*
|
|
167
|
+
* @param caseData - The case data from API
|
|
168
|
+
* @param service - The cases service instance
|
|
169
|
+
* @returns A case object with added methods
|
|
170
|
+
*/
|
|
171
|
+
function createCaseWithMethods(caseData, service) {
|
|
172
|
+
const methods = createCaseMethods(caseData, service);
|
|
173
|
+
return Object.assign({}, caseData, methods);
|
|
174
|
+
}
|
|
175
|
+
|
|
134
176
|
/**
|
|
135
177
|
* Builds the request body for Insights RTM "top" endpoints.
|
|
136
178
|
*
|
|
@@ -177,6 +219,28 @@ async function fetchInstanceStatusTimeline(postFn, startTime, endTime, isCaseMan
|
|
|
177
219
|
});
|
|
178
220
|
return response.data ?? [];
|
|
179
221
|
}
|
|
222
|
+
/**
|
|
223
|
+
* Builds the request body for the ElementCountByStatus endpoint.
|
|
224
|
+
*
|
|
225
|
+
* @param processKey - Process key to filter by
|
|
226
|
+
* @param packageId - Package identifier
|
|
227
|
+
* @param startTime - Start of the time range to query
|
|
228
|
+
* @param endTime - End of the time range to query
|
|
229
|
+
* @param packageVersion - Package version to filter by
|
|
230
|
+
* @returns Request body for the ElementCountByStatus endpoint
|
|
231
|
+
* @internal
|
|
232
|
+
*/
|
|
233
|
+
function buildElementCountByStatusBody(processKey, packageId, startTime, endTime, packageVersion) {
|
|
234
|
+
return {
|
|
235
|
+
commonParams: {
|
|
236
|
+
processKey,
|
|
237
|
+
packageId,
|
|
238
|
+
startTime: startTime.getTime(),
|
|
239
|
+
endTime: endTime.getTime(),
|
|
240
|
+
version: packageVersion
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
}
|
|
180
244
|
|
|
181
245
|
/**
|
|
182
246
|
* Type guards for error response types
|
|
@@ -873,6 +937,32 @@ function processODataArrayResponse(oDataResponse, successData) {
|
|
|
873
937
|
*/
|
|
874
938
|
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
875
939
|
isBrowser && window.self != window.top && window.location.href.includes('source=ActionCenter');
|
|
940
|
+
const _params = isBrowser ? new URLSearchParams(window.location.search) : null;
|
|
941
|
+
/**
|
|
942
|
+
* True when the coded app has been loaded inside a host frame that explicitly
|
|
943
|
+
* opted into token delegation by adding `?host=embed` to the iframe src URL.
|
|
944
|
+
*/
|
|
945
|
+
const isHostEmbedded = isBrowser && window.self !== window.top && _params?.get('host') === 'embed';
|
|
946
|
+
/**
|
|
947
|
+
* The validated parent origin, read from the `?basedomain=` query param set
|
|
948
|
+
* by the embedding host in the iframe src URL.
|
|
949
|
+
* Mirrors the same mechanism used by ActionCenterTokenManager.
|
|
950
|
+
* Non-null only when `?host=embed` is present and `?basedomain=` is a valid URL.
|
|
951
|
+
*/
|
|
952
|
+
(() => {
|
|
953
|
+
if (!isHostEmbedded)
|
|
954
|
+
return null;
|
|
955
|
+
const basedomain = _params?.get('basedomain');
|
|
956
|
+
if (!basedomain)
|
|
957
|
+
return null;
|
|
958
|
+
try {
|
|
959
|
+
return new URL(basedomain).origin;
|
|
960
|
+
}
|
|
961
|
+
catch {
|
|
962
|
+
console.warn('embeddingOrigin: basedomain query param is not a valid URL', basedomain);
|
|
963
|
+
return null;
|
|
964
|
+
}
|
|
965
|
+
})();
|
|
876
966
|
|
|
877
967
|
/**
|
|
878
968
|
* Base64 encoding/decoding
|
|
@@ -1580,8 +1670,9 @@ class PaginationHelpers {
|
|
|
1580
1670
|
});
|
|
1581
1671
|
}
|
|
1582
1672
|
// Extract and transform items from response
|
|
1583
|
-
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1584
|
-
|
|
1673
|
+
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
|
|
1674
|
+
// itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
|
|
1675
|
+
const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
|
|
1585
1676
|
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1586
1677
|
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1587
1678
|
// Parse items - automatically handle JSON string responses
|
|
@@ -1627,7 +1718,7 @@ class PaginationHelpers {
|
|
|
1627
1718
|
getEndpoint: config.getEndpoint,
|
|
1628
1719
|
folderId,
|
|
1629
1720
|
headers: config.headers,
|
|
1630
|
-
paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
|
|
1721
|
+
paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
|
|
1631
1722
|
additionalParams: prefixedOptions,
|
|
1632
1723
|
transformFn: config.transformFn,
|
|
1633
1724
|
method: config.method,
|
|
@@ -1885,6 +1976,8 @@ class BaseService {
|
|
|
1885
1976
|
// When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
|
|
1886
1977
|
// When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
|
|
1887
1978
|
const convertToSkip = paginationParams?.convertToSkip ?? true;
|
|
1979
|
+
// When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
|
|
1980
|
+
const zeroBased = paginationParams?.zeroBased ?? false;
|
|
1888
1981
|
requestParams[pageSizeParam] = limitedPageSize;
|
|
1889
1982
|
if (convertToSkip) {
|
|
1890
1983
|
if (params.pageNumber && params.pageNumber > 1) {
|
|
@@ -1892,7 +1985,8 @@ class BaseService {
|
|
|
1892
1985
|
}
|
|
1893
1986
|
}
|
|
1894
1987
|
else {
|
|
1895
|
-
|
|
1988
|
+
const sdkPageNumber = params.pageNumber || 1;
|
|
1989
|
+
requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
|
|
1896
1990
|
}
|
|
1897
1991
|
{
|
|
1898
1992
|
requestParams[countParam] = true;
|
|
@@ -1921,8 +2015,9 @@ class BaseService {
|
|
|
1921
2015
|
const totalCountField = fields.totalCountField || 'totalRecordCount';
|
|
1922
2016
|
const continuationTokenField = fields.continuationTokenField || 'continuationToken';
|
|
1923
2017
|
// Extract items and metadata
|
|
1924
|
-
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1925
|
-
|
|
2018
|
+
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
|
|
2019
|
+
// itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
|
|
2020
|
+
const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
|
|
1926
2021
|
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1927
2022
|
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1928
2023
|
const continuationToken = response.data[continuationTokenField];
|
|
@@ -2039,7 +2134,7 @@ function createParams(paramsObj = {}) {
|
|
|
2039
2134
|
class CasesService extends BaseService {
|
|
2040
2135
|
/**
|
|
2041
2136
|
* Get all case management processes with their instance statistics
|
|
2042
|
-
* @returns Promise resolving to array of
|
|
2137
|
+
* @returns Promise resolving to an array of {@link CaseGetAllWithMethodsResponse}
|
|
2043
2138
|
*
|
|
2044
2139
|
* @example
|
|
2045
2140
|
* ```typescript
|
|
@@ -2063,10 +2158,10 @@ class CasesService extends BaseService {
|
|
|
2063
2158
|
const response = await this.get(MAESTRO_ENDPOINTS.PROCESSES.GET_ALL, { params });
|
|
2064
2159
|
// Extract processes array from response data and add name field
|
|
2065
2160
|
const cases = response.data?.processes || [];
|
|
2066
|
-
return cases.map(caseItem => ({
|
|
2161
|
+
return cases.map(caseItem => createCaseWithMethods({
|
|
2067
2162
|
...caseItem,
|
|
2068
2163
|
name: this.extractCaseName(caseItem.packageId)
|
|
2069
|
-
}));
|
|
2164
|
+
}, this));
|
|
2070
2165
|
}
|
|
2071
2166
|
/**
|
|
2072
2167
|
* Get the top 5 case processes ranked by run count within a time range.
|
|
@@ -2109,6 +2204,52 @@ class CasesService extends BaseService {
|
|
|
2109
2204
|
const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_RUN_COUNT, buildInsightsTopBody(startTime, endTime, true, options));
|
|
2110
2205
|
return (data ?? []).map(process => ({ ...process, name: this.extractCaseName(process.packageId) }));
|
|
2111
2206
|
}
|
|
2207
|
+
/**
|
|
2208
|
+
* Get the top 10 BPMN elements ranked by failure count within a time range.
|
|
2209
|
+
*
|
|
2210
|
+
* Returns an array of up to 10 elements sorted by how many times they failed,
|
|
2211
|
+
* useful for identifying the most error-prone activities in case processes.
|
|
2212
|
+
*
|
|
2213
|
+
* @param startTime - Start of the time range to query
|
|
2214
|
+
* @param endTime - End of the time range to query
|
|
2215
|
+
* @param options - Optional filters (packageId, processKey, version)
|
|
2216
|
+
* @returns Promise resolving to an array of {@link ElementGetTopFailedCountResponse}
|
|
2217
|
+
* @example
|
|
2218
|
+
* ```typescript
|
|
2219
|
+
* import { Cases } from '@uipath/uipath-typescript/cases';
|
|
2220
|
+
*
|
|
2221
|
+
* const cases = new Cases(sdk);
|
|
2222
|
+
*
|
|
2223
|
+
* // Get top failing elements for the last 7 days
|
|
2224
|
+
* const topFailing = await cases.getTopElementFailedCount(
|
|
2225
|
+
* new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
|
|
2226
|
+
* new Date()
|
|
2227
|
+
* );
|
|
2228
|
+
*
|
|
2229
|
+
* for (const element of topFailing) {
|
|
2230
|
+
* console.log(`${element.elementName} (${element.elementType}): ${element.failedCount} failures`);
|
|
2231
|
+
* }
|
|
2232
|
+
* ```
|
|
2233
|
+
*
|
|
2234
|
+
* @example
|
|
2235
|
+
* ```typescript
|
|
2236
|
+
* // Get top failing elements for a specific process
|
|
2237
|
+
* const filtered = await cases.getTopElementFailedCount(
|
|
2238
|
+
* new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
|
|
2239
|
+
* new Date(),
|
|
2240
|
+
* { processKey: '<processKey>' }
|
|
2241
|
+
* );
|
|
2242
|
+
* ```
|
|
2243
|
+
*/
|
|
2244
|
+
async getTopElementFailedCount(startTime, endTime, options) {
|
|
2245
|
+
const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_ELEMENTS_WITH_FAILURE, buildInsightsTopBody(startTime, endTime, true, options));
|
|
2246
|
+
return (data ?? []).map(item => ({
|
|
2247
|
+
elementName: item.elementName,
|
|
2248
|
+
elementType: item.elementType,
|
|
2249
|
+
processKey: item.processKey,
|
|
2250
|
+
failedCount: item.count,
|
|
2251
|
+
}));
|
|
2252
|
+
}
|
|
2112
2253
|
/**
|
|
2113
2254
|
* Get all instances status counts aggregated by date for case management processes.
|
|
2114
2255
|
*
|
|
@@ -2239,6 +2380,40 @@ class CasesService extends BaseService {
|
|
|
2239
2380
|
const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_DURATION, buildInsightsTopBody(startTime, endTime, true, options));
|
|
2240
2381
|
return (data ?? []).map(process => ({ ...process, name: this.extractCaseName(process.packageId) }));
|
|
2241
2382
|
}
|
|
2383
|
+
/**
|
|
2384
|
+
* Get element stats for case instances
|
|
2385
|
+
*
|
|
2386
|
+
* Returns per-element execution counts (success, fail, terminated, paused, in-progress) and
|
|
2387
|
+
* duration percentile metrics (min, max, avg, p50, p95, p99) for BPMN elements within a case.
|
|
2388
|
+
*
|
|
2389
|
+
* @param processKey - Process key to filter by
|
|
2390
|
+
* @param packageId - Package identifier
|
|
2391
|
+
* @param startTime - Start of the time range to query
|
|
2392
|
+
* @param endTime - End of the time range to query
|
|
2393
|
+
* @param packageVersion - Package version to filter by
|
|
2394
|
+
* @returns Promise resolving to an array of {@link ElementStats}
|
|
2395
|
+
* @example
|
|
2396
|
+
* ```typescript
|
|
2397
|
+
* // Get element metrics for a case
|
|
2398
|
+
* const elements = await cases.getElementStats(
|
|
2399
|
+
* '<processKey>',
|
|
2400
|
+
* '<packageId>',
|
|
2401
|
+
* new Date('2026-04-01'),
|
|
2402
|
+
* new Date(),
|
|
2403
|
+
* '1.0.1'
|
|
2404
|
+
* );
|
|
2405
|
+
*
|
|
2406
|
+
* // Find elements with failures
|
|
2407
|
+
* const failedElements = elements.filter(e => e.failCount > 0);
|
|
2408
|
+
* for (const element of failedElements) {
|
|
2409
|
+
* console.log(`Failed element: ${element.elementId}, failures: ${element.failCount}`);
|
|
2410
|
+
* }
|
|
2411
|
+
* ```
|
|
2412
|
+
*/
|
|
2413
|
+
async getElementStats(processKey, packageId, startTime, endTime, packageVersion) {
|
|
2414
|
+
const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.ELEMENT_COUNT_BY_STATUS, buildElementCountByStatusBody(processKey, packageId, startTime, endTime, packageVersion));
|
|
2415
|
+
return data ?? [];
|
|
2416
|
+
}
|
|
2242
2417
|
/**
|
|
2243
2418
|
* Extract a readable case name from the packageId
|
|
2244
2419
|
* @param packageId - The full package identifier
|
|
@@ -2264,6 +2439,9 @@ __decorate([
|
|
|
2264
2439
|
__decorate([
|
|
2265
2440
|
track('Cases.GetTopRunCount')
|
|
2266
2441
|
], CasesService.prototype, "getTopRunCount", null);
|
|
2442
|
+
__decorate([
|
|
2443
|
+
track('Cases.GetTopElementFailedCount')
|
|
2444
|
+
], CasesService.prototype, "getTopElementFailedCount", null);
|
|
2267
2445
|
__decorate([
|
|
2268
2446
|
track('Cases.GetInstanceStatusTimeline')
|
|
2269
2447
|
], CasesService.prototype, "getInstanceStatusTimeline", null);
|
|
@@ -2273,6 +2451,9 @@ __decorate([
|
|
|
2273
2451
|
__decorate([
|
|
2274
2452
|
track('Cases.GetTopExecutionDuration')
|
|
2275
2453
|
], CasesService.prototype, "getTopExecutionDuration", null);
|
|
2454
|
+
__decorate([
|
|
2455
|
+
track('Cases.GetElementStats')
|
|
2456
|
+
], CasesService.prototype, "getElementStats", null);
|
|
2276
2457
|
|
|
2277
2458
|
/**
|
|
2278
2459
|
* Process Incident Status
|
|
@@ -3794,4 +3975,4 @@ __decorate([
|
|
|
3794
3975
|
track('CaseInstances.GetStagesSlaSummary')
|
|
3795
3976
|
], CaseInstancesService.prototype, "getStagesSlaSummary", null);
|
|
3796
3977
|
|
|
3797
|
-
export { CaseInstancesService as CaseInstances, CaseInstancesService, CasesService as Cases, CasesService, EscalationActionType, EscalationRecipientScope, EscalationTriggerType, InstanceFinalStatus, InstanceStatus, SLADurationUnit, SlaSummaryStatus, StageTaskType, TimeInterval, createCaseInstanceWithMethods };
|
|
3978
|
+
export { CaseInstancesService as CaseInstances, CaseInstancesService, CasesService as Cases, CasesService, EscalationActionType, EscalationRecipientScope, EscalationTriggerType, InstanceFinalStatus, InstanceStatus, SLADurationUnit, SlaSummaryStatus, StageTaskType, TimeInterval, createCaseInstanceWithMethods, createCaseWithMethods };
|
|
@@ -779,6 +779,32 @@ function filterUndefined(obj) {
|
|
|
779
779
|
*/
|
|
780
780
|
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
781
781
|
isBrowser && window.self != window.top && window.location.href.includes('source=ActionCenter');
|
|
782
|
+
const _params = isBrowser ? new URLSearchParams(window.location.search) : null;
|
|
783
|
+
/**
|
|
784
|
+
* True when the coded app has been loaded inside a host frame that explicitly
|
|
785
|
+
* opted into token delegation by adding `?host=embed` to the iframe src URL.
|
|
786
|
+
*/
|
|
787
|
+
const isHostEmbedded = isBrowser && window.self !== window.top && _params?.get('host') === 'embed';
|
|
788
|
+
/**
|
|
789
|
+
* The validated parent origin, read from the `?basedomain=` query param set
|
|
790
|
+
* by the embedding host in the iframe src URL.
|
|
791
|
+
* Mirrors the same mechanism used by ActionCenterTokenManager.
|
|
792
|
+
* Non-null only when `?host=embed` is present and `?basedomain=` is a valid URL.
|
|
793
|
+
*/
|
|
794
|
+
(() => {
|
|
795
|
+
if (!isHostEmbedded)
|
|
796
|
+
return null;
|
|
797
|
+
const basedomain = _params?.get('basedomain');
|
|
798
|
+
if (!basedomain)
|
|
799
|
+
return null;
|
|
800
|
+
try {
|
|
801
|
+
return new URL(basedomain).origin;
|
|
802
|
+
}
|
|
803
|
+
catch {
|
|
804
|
+
console.warn('embeddingOrigin: basedomain query param is not a valid URL', basedomain);
|
|
805
|
+
return null;
|
|
806
|
+
}
|
|
807
|
+
})();
|
|
782
808
|
|
|
783
809
|
/**
|
|
784
810
|
* Base64 encoding/decoding
|
|
@@ -1363,8 +1389,9 @@ class PaginationHelpers {
|
|
|
1363
1389
|
});
|
|
1364
1390
|
}
|
|
1365
1391
|
// Extract and transform items from response
|
|
1366
|
-
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1367
|
-
|
|
1392
|
+
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
|
|
1393
|
+
// itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
|
|
1394
|
+
const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
|
|
1368
1395
|
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1369
1396
|
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1370
1397
|
// Parse items - automatically handle JSON string responses
|
|
@@ -1410,7 +1437,7 @@ class PaginationHelpers {
|
|
|
1410
1437
|
getEndpoint: config.getEndpoint,
|
|
1411
1438
|
folderId,
|
|
1412
1439
|
headers: config.headers,
|
|
1413
|
-
paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
|
|
1440
|
+
paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
|
|
1414
1441
|
additionalParams: prefixedOptions,
|
|
1415
1442
|
transformFn: config.transformFn,
|
|
1416
1443
|
method: config.method,
|
|
@@ -1668,6 +1695,8 @@ class BaseService {
|
|
|
1668
1695
|
// When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
|
|
1669
1696
|
// When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
|
|
1670
1697
|
const convertToSkip = paginationParams?.convertToSkip ?? true;
|
|
1698
|
+
// When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
|
|
1699
|
+
const zeroBased = paginationParams?.zeroBased ?? false;
|
|
1671
1700
|
requestParams[pageSizeParam] = limitedPageSize;
|
|
1672
1701
|
if (convertToSkip) {
|
|
1673
1702
|
if (params.pageNumber && params.pageNumber > 1) {
|
|
@@ -1675,7 +1704,8 @@ class BaseService {
|
|
|
1675
1704
|
}
|
|
1676
1705
|
}
|
|
1677
1706
|
else {
|
|
1678
|
-
|
|
1707
|
+
const sdkPageNumber = params.pageNumber || 1;
|
|
1708
|
+
requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
|
|
1679
1709
|
}
|
|
1680
1710
|
{
|
|
1681
1711
|
requestParams[countParam] = true;
|
|
@@ -1704,8 +1734,9 @@ class BaseService {
|
|
|
1704
1734
|
const totalCountField = fields.totalCountField || 'totalRecordCount';
|
|
1705
1735
|
const continuationTokenField = fields.continuationTokenField || 'continuationToken';
|
|
1706
1736
|
// Extract items and metadata
|
|
1707
|
-
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1708
|
-
|
|
1737
|
+
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
|
|
1738
|
+
// itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
|
|
1739
|
+
const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
|
|
1709
1740
|
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1710
1741
|
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1711
1742
|
const continuationToken = response.data[continuationTokenField];
|
|
@@ -4947,37 +4978,58 @@ class ExchangeService extends BaseService {
|
|
|
4947
4978
|
super(instance, buildConversationalAgentHeaders(options));
|
|
4948
4979
|
}
|
|
4949
4980
|
/**
|
|
4950
|
-
* Gets
|
|
4981
|
+
* Gets exchanges for a conversation with pagination and optional sort parameters
|
|
4951
4982
|
*
|
|
4952
|
-
*
|
|
4953
|
-
*
|
|
4954
|
-
*
|
|
4983
|
+
* Returns a paginated response. When called without `pageSize`/`cursor`, the
|
|
4984
|
+
* backend applies its default page size — inspect `hasNextPage`/`nextCursor`
|
|
4985
|
+
* to navigate further pages.
|
|
4955
4986
|
*
|
|
4956
4987
|
* @param conversationId - The conversation ID to get exchanges for
|
|
4957
4988
|
* @param options - Options for querying exchanges including optional pagination parameters
|
|
4958
|
-
* @returns Promise resolving to
|
|
4989
|
+
* @returns Promise resolving to a {@link PaginatedResponse}<{@link ExchangeGetResponse}>
|
|
4959
4990
|
*
|
|
4960
|
-
* @example
|
|
4991
|
+
* @example Basic usage - default page size and sort order
|
|
4961
4992
|
* ```typescript
|
|
4962
|
-
* //
|
|
4963
|
-
* const
|
|
4964
|
-
*
|
|
4965
|
-
* // First page with pagination
|
|
4966
|
-
* const firstPageOfExchanges = await exchanges.getAll(conversationId, { pageSize: 10 });
|
|
4993
|
+
* // First page
|
|
4994
|
+
* const firstPage = await exchanges.getAll(conversationId);
|
|
4967
4995
|
*
|
|
4968
4996
|
* // Navigate using cursor
|
|
4969
|
-
* if (
|
|
4970
|
-
* const
|
|
4997
|
+
* if (firstPage.hasNextPage) {
|
|
4998
|
+
* const nextPage = await exchanges.getAll(conversationId, { cursor: firstPage.nextCursor });
|
|
4999
|
+
* }
|
|
5000
|
+
* ```
|
|
5001
|
+
*
|
|
5002
|
+
* @example With explicit page size and exchange/message sort orders
|
|
5003
|
+
* ```typescript
|
|
5004
|
+
* import { SortOrder } from '@uipath/uipath-typescript/conversational-agent';
|
|
5005
|
+
*
|
|
5006
|
+
* const firstPage = await exchanges.getAll(conversationId, {
|
|
5007
|
+
* pageSize: 10,
|
|
5008
|
+
* exchangeSort: SortOrder.Descending,
|
|
5009
|
+
* messageSort: SortOrder.Ascending
|
|
5010
|
+
* });
|
|
5011
|
+
*
|
|
5012
|
+
* // Navigate using cursor and same parameters
|
|
5013
|
+
* if (firstPage.hasNextPage) {
|
|
5014
|
+
* const nextPage = await exchanges.getAll(conversationId, {
|
|
5015
|
+
* pageSize: 10,
|
|
5016
|
+
* exchangeSort: SortOrder.Descending,
|
|
5017
|
+
* messageSort: SortOrder.Ascending,
|
|
5018
|
+
* cursor: firstPage.nextCursor
|
|
5019
|
+
* });
|
|
4971
5020
|
* }
|
|
4972
5021
|
* ```
|
|
4973
5022
|
*/
|
|
4974
5023
|
async getAll(conversationId, options) {
|
|
4975
|
-
const
|
|
4976
|
-
|
|
5024
|
+
const { pageSize, cursor, jumpToPage, ...additionalParams } = options ?? {};
|
|
5025
|
+
const paginationParams = cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize };
|
|
5026
|
+
return PaginationHelpers.getAllPaginated({
|
|
4977
5027
|
serviceAccess: this.createPaginationServiceAccess(),
|
|
4978
5028
|
getEndpoint: () => EXCHANGE_ENDPOINTS.LIST(conversationId),
|
|
4979
|
-
|
|
4980
|
-
|
|
5029
|
+
paginationParams,
|
|
5030
|
+
additionalParams,
|
|
5031
|
+
transformFn: transformExchange,
|
|
5032
|
+
options: {
|
|
4981
5033
|
paginationType: PaginationType.TOKEN,
|
|
4982
5034
|
itemsField: CONVERSATIONAL_PAGINATION.ITEMS_FIELD,
|
|
4983
5035
|
continuationTokenField: CONVERSATIONAL_PAGINATION.CONTINUATION_TOKEN_FIELD,
|
|
@@ -4985,9 +5037,8 @@ class ExchangeService extends BaseService {
|
|
|
4985
5037
|
pageSizeParam: CONVERSATIONAL_TOKEN_PARAMS.PAGE_SIZE_PARAM,
|
|
4986
5038
|
tokenParam: CONVERSATIONAL_TOKEN_PARAMS.TOKEN_PARAM
|
|
4987
5039
|
}
|
|
4988
|
-
}
|
|
4989
|
-
|
|
4990
|
-
}, options);
|
|
5040
|
+
}
|
|
5041
|
+
});
|
|
4991
5042
|
}
|
|
4992
5043
|
/**
|
|
4993
5044
|
* Gets an exchange by ID with its messages
|
|
@@ -5969,28 +6020,23 @@ class ConversationService extends BaseService {
|
|
|
5969
6020
|
return createConversationWithMethods(transformedData, this, this, this._exchangeService);
|
|
5970
6021
|
}
|
|
5971
6022
|
/**
|
|
5972
|
-
* Gets
|
|
6023
|
+
* Gets conversations with pagination and optional sort/filter parameters
|
|
5973
6024
|
*
|
|
5974
|
-
*
|
|
5975
|
-
*
|
|
5976
|
-
*
|
|
6025
|
+
* Returns a paginated response. When called without `pageSize`/`cursor`, a
|
|
6026
|
+
* default page size is applied - inspect `hasNextPage`/`nextCursor`
|
|
6027
|
+
* to navigate further pages.
|
|
5977
6028
|
*
|
|
5978
|
-
* @param options - Options for querying conversations
|
|
5979
|
-
* @returns Promise resolving to
|
|
6029
|
+
* @param options - Options for querying conversations
|
|
6030
|
+
* @returns Promise resolving to a {@link PaginatedResponse}<{@link ConversationGetResponse}>
|
|
5980
6031
|
*
|
|
5981
|
-
* @example Basic usage -
|
|
6032
|
+
* @example Basic usage - default sort, pagination, and without filtering
|
|
5982
6033
|
* ```typescript
|
|
5983
|
-
*
|
|
6034
|
+
* // First page
|
|
6035
|
+
* const firstPage = await conversationalAgent.conversations.getAll();
|
|
5984
6036
|
*
|
|
5985
|
-
* for (const conversation of
|
|
6037
|
+
* for (const conversation of firstPage.items) {
|
|
5986
6038
|
* console.log(`${conversation.label} - created: ${conversation.createdTime}`);
|
|
5987
6039
|
* }
|
|
5988
|
-
* ```
|
|
5989
|
-
*
|
|
5990
|
-
* @example With pagination
|
|
5991
|
-
* ```typescript
|
|
5992
|
-
* // First page
|
|
5993
|
-
* const firstPage = await conversationalAgent.conversations.getAll({ pageSize: 10 });
|
|
5994
6040
|
*
|
|
5995
6041
|
* // Navigate using cursor
|
|
5996
6042
|
* if (firstPage.hasNextPage) {
|
|
@@ -6000,37 +6046,59 @@ class ConversationService extends BaseService {
|
|
|
6000
6046
|
* }
|
|
6001
6047
|
* ```
|
|
6002
6048
|
*
|
|
6003
|
-
* @example
|
|
6049
|
+
* @example With explicit page size and sort order (by last-activity timestamp)
|
|
6004
6050
|
* ```typescript
|
|
6005
|
-
*
|
|
6006
|
-
*
|
|
6007
|
-
*
|
|
6051
|
+
* import { SortOrder } from '@uipath/uipath-typescript/conversational-agent';
|
|
6052
|
+
*
|
|
6053
|
+
* // First page
|
|
6054
|
+
* const firstPage = await conversationalAgent.conversations.getAll({
|
|
6055
|
+
* pageSize: 10,
|
|
6056
|
+
* sort: SortOrder.Descending
|
|
6008
6057
|
* });
|
|
6058
|
+
*
|
|
6059
|
+
* // Navigate using cursor and same parameters
|
|
6060
|
+
* if (firstPage.hasNextPage) {
|
|
6061
|
+
* const nextPage = await conversationalAgent.conversations.getAll({
|
|
6062
|
+
* pageSize: 10,
|
|
6063
|
+
* sort: SortOrder.Descending,
|
|
6064
|
+
* cursor: firstPage.nextCursor
|
|
6065
|
+
* });
|
|
6066
|
+
* }
|
|
6009
6067
|
* ```
|
|
6010
6068
|
*
|
|
6011
|
-
* @example
|
|
6069
|
+
* @example With agent-filter and label-search
|
|
6012
6070
|
* ```typescript
|
|
6013
|
-
* const
|
|
6071
|
+
* const firstPage = await conversationalAgent.conversations.getAll({
|
|
6014
6072
|
* agentId: <agentId>,
|
|
6015
6073
|
* label: 'budget'
|
|
6016
6074
|
* });
|
|
6075
|
+
*
|
|
6076
|
+
* // Navigate using cursor and same parameters
|
|
6077
|
+
* if (firstPage.hasNextPage) {
|
|
6078
|
+
* const nextPage = await conversationalAgent.conversations.getAll({
|
|
6079
|
+
* agentId: <agentId>,
|
|
6080
|
+
* label: 'budget',
|
|
6081
|
+
* cursor: firstPage.nextCursor
|
|
6082
|
+
* });
|
|
6083
|
+
* }
|
|
6017
6084
|
* ```
|
|
6018
6085
|
*/
|
|
6019
6086
|
async getAll(options) {
|
|
6020
|
-
// Transform function to convert API timestamps to SDK naming convention and add methods
|
|
6021
6087
|
const transformFn = (conversation) => {
|
|
6022
6088
|
const transformedData = transformData(conversation, ConversationMap);
|
|
6023
6089
|
return createConversationWithMethods(transformedData, this, this, this._exchangeService);
|
|
6024
6090
|
};
|
|
6091
|
+
const { pageSize, cursor, jumpToPage, ...filterOptions } = options ?? {};
|
|
6025
6092
|
// Translate SDK filter names (agentKey/agentId/label) to backend names before forwarding
|
|
6026
|
-
const
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
return PaginationHelpers.getAll({
|
|
6093
|
+
const additionalParams = transformRequest(filterOptions, ConversationGetAllFilterMap);
|
|
6094
|
+
const paginationParams = cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize };
|
|
6095
|
+
return PaginationHelpers.getAllPaginated({
|
|
6030
6096
|
serviceAccess: this.createPaginationServiceAccess(),
|
|
6031
6097
|
getEndpoint: () => CONVERSATION_ENDPOINTS.LIST,
|
|
6098
|
+
paginationParams,
|
|
6099
|
+
additionalParams,
|
|
6032
6100
|
transformFn,
|
|
6033
|
-
|
|
6101
|
+
options: {
|
|
6034
6102
|
paginationType: PaginationType.TOKEN,
|
|
6035
6103
|
itemsField: CONVERSATIONAL_PAGINATION.ITEMS_FIELD,
|
|
6036
6104
|
continuationTokenField: CONVERSATIONAL_PAGINATION.CONTINUATION_TOKEN_FIELD,
|
|
@@ -6038,9 +6106,8 @@ class ConversationService extends BaseService {
|
|
|
6038
6106
|
pageSizeParam: CONVERSATIONAL_TOKEN_PARAMS.PAGE_SIZE_PARAM,
|
|
6039
6107
|
tokenParam: CONVERSATIONAL_TOKEN_PARAMS.TOKEN_PARAM
|
|
6040
6108
|
}
|
|
6041
|
-
}
|
|
6042
|
-
|
|
6043
|
-
}, apiOptions);
|
|
6109
|
+
}
|
|
6110
|
+
});
|
|
6044
6111
|
}
|
|
6045
6112
|
/**
|
|
6046
6113
|
* Updates a conversation by ID
|
|
@@ -6074,7 +6141,7 @@ class ConversationService extends BaseService {
|
|
|
6074
6141
|
*/
|
|
6075
6142
|
async deleteById(id) {
|
|
6076
6143
|
const response = await this.delete(CONVERSATION_ENDPOINTS.DELETE(id));
|
|
6077
|
-
return response.data;
|
|
6144
|
+
return transformData(response.data, ConversationMap);
|
|
6078
6145
|
}
|
|
6079
6146
|
// ==================== Attachments ====================
|
|
6080
6147
|
/**
|