@uipath/uipath-typescript 1.3.11 → 1.4.1
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 +1772 -0
- package/dist/agent-memory/index.d.ts +588 -0
- package/dist/agent-memory/index.mjs +1770 -0
- package/dist/agents/index.cjs +1995 -0
- package/dist/agents/index.d.ts +961 -0
- package/dist/agents/index.mjs +1993 -0
- package/dist/assets/index.cjs +171 -39
- package/dist/assets/index.d.ts +84 -5
- package/dist/assets/index.mjs +171 -39
- package/dist/attachments/index.cjs +53 -15
- package/dist/attachments/index.d.ts +1 -0
- package/dist/attachments/index.mjs +53 -15
- package/dist/buckets/index.cjs +151 -130
- package/dist/buckets/index.d.ts +198 -84
- package/dist/buckets/index.mjs +151 -130
- package/dist/cases/index.cjs +220 -23
- package/dist/cases/index.d.ts +148 -10
- package/dist/cases/index.mjs +220 -24
- package/dist/conversational-agent/index.cjs +140 -66
- package/dist/conversational-agent/index.d.ts +190 -122
- package/dist/conversational-agent/index.mjs +140 -66
- package/dist/core/index.cjs +445 -108
- package/dist/core/index.d.ts +15 -0
- package/dist/core/index.mjs +445 -108
- package/dist/entities/index.cjs +365 -102
- package/dist/entities/index.d.ts +446 -114
- package/dist/entities/index.mjs +365 -102
- package/dist/feedback/index.cjs +53 -15
- package/dist/feedback/index.d.ts +1 -0
- package/dist/feedback/index.mjs +53 -15
- package/dist/governance/index.cjs +1789 -0
- package/dist/governance/index.d.ts +598 -0
- package/dist/governance/index.mjs +1787 -0
- package/dist/index.cjs +1453 -444
- package/dist/index.d.ts +4150 -1742
- package/dist/index.mjs +1452 -445
- package/dist/index.umd.js +5035 -4009
- package/dist/jobs/index.cjs +53 -15
- package/dist/jobs/index.d.ts +1 -0
- package/dist/jobs/index.mjs +53 -15
- package/dist/maestro-processes/index.cjs +189 -27
- package/dist/maestro-processes/index.d.ts +131 -9
- package/dist/maestro-processes/index.mjs +189 -27
- package/dist/orchestrator-du-module/index.cjs +1788 -0
- package/dist/orchestrator-du-module/index.d.ts +757 -0
- package/dist/orchestrator-du-module/index.mjs +1785 -0
- package/dist/processes/index.cjs +53 -15
- package/dist/processes/index.d.ts +1 -0
- package/dist/processes/index.mjs +53 -15
- package/dist/queues/index.cjs +53 -15
- package/dist/queues/index.d.ts +1 -0
- package/dist/queues/index.mjs +53 -15
- package/dist/tasks/index.cjs +116 -19
- package/dist/tasks/index.d.ts +110 -4
- package/dist/tasks/index.mjs +117 -20
- package/dist/traces/index.cjs +340 -15
- package/dist/traces/index.d.ts +483 -2
- package/dist/traces/index.mjs +339 -16
- package/package.json +42 -2
|
@@ -48,6 +48,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
48
48
|
* Base path constants for different services
|
|
49
49
|
*/
|
|
50
50
|
const PIMS_BASE = 'pims_';
|
|
51
|
+
const LLMOPS_BASE = 'llmopstenant_';
|
|
51
52
|
const INSIGHTS_RTM_BASE = 'insightsrtm_';
|
|
52
53
|
|
|
53
54
|
/**
|
|
@@ -62,7 +63,7 @@ const MAESTRO_ENDPOINTS = {
|
|
|
62
63
|
INSTANCES: {
|
|
63
64
|
GET_ALL: `${PIMS_BASE}/api/v1/instances`,
|
|
64
65
|
GET_BY_ID: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}`,
|
|
65
|
-
|
|
66
|
+
GET_ELEMENT_EXECUTIONS: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/element-executions`,
|
|
66
67
|
GET_BPMN: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/bpmn`,
|
|
67
68
|
GET_VARIABLES: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/variables`,
|
|
68
69
|
CANCEL: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/cancel`,
|
|
@@ -74,6 +75,9 @@ const MAESTRO_ENDPOINTS = {
|
|
|
74
75
|
GET_BY_PROCESS: (processKey) => `${PIMS_BASE}/api/v1/incidents/process/${processKey}`,
|
|
75
76
|
GET_BY_INSTANCE: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/incidents`,
|
|
76
77
|
},
|
|
78
|
+
TRACES: {
|
|
79
|
+
GET_SPANS: (traceId) => `${LLMOPS_BASE}/api/Traces/spans?traceId=${traceId}`,
|
|
80
|
+
},
|
|
77
81
|
INSIGHTS: {
|
|
78
82
|
/** Top processes ranked by run count */
|
|
79
83
|
TOP_PROCESSES_BY_RUN_COUNT: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByRunCount`,
|
|
@@ -85,6 +89,8 @@ const MAESTRO_ENDPOINTS = {
|
|
|
85
89
|
INSTANCE_STATUS_BY_DATE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceStatusByDate`,
|
|
86
90
|
/** Top processes ranked by total duration */
|
|
87
91
|
TOP_PROCESSES_BY_DURATION: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByDuration`,
|
|
92
|
+
/** Element count by status for agentic instances (process and case) */
|
|
93
|
+
ELEMENT_COUNT_BY_STATUS: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/ElementCountByStatus`,
|
|
88
94
|
},
|
|
89
95
|
};
|
|
90
96
|
|
|
@@ -107,6 +113,13 @@ function createProcessMethods(processData, service) {
|
|
|
107
113
|
if (!processData.folderKey)
|
|
108
114
|
throw new Error('Folder key is undefined');
|
|
109
115
|
return service.getIncidents(processData.processKey, processData.folderKey);
|
|
116
|
+
},
|
|
117
|
+
getElementStats(startTime, endTime, packageVersion) {
|
|
118
|
+
if (!processData.processKey)
|
|
119
|
+
throw new Error('Process key is undefined');
|
|
120
|
+
if (!processData.packageId)
|
|
121
|
+
throw new Error('Package ID is undefined');
|
|
122
|
+
return service.getElementStats(processData.processKey, processData.packageId, startTime, endTime, packageVersion);
|
|
110
123
|
}
|
|
111
124
|
};
|
|
112
125
|
}
|
|
@@ -168,6 +181,28 @@ async function fetchInstanceStatusTimeline(postFn, startTime, endTime, isCaseMan
|
|
|
168
181
|
});
|
|
169
182
|
return response.data ?? [];
|
|
170
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* Builds the request body for the ElementCountByStatus endpoint.
|
|
186
|
+
*
|
|
187
|
+
* @param processKey - Process key to filter by
|
|
188
|
+
* @param packageId - Package identifier
|
|
189
|
+
* @param startTime - Start of the time range to query
|
|
190
|
+
* @param endTime - End of the time range to query
|
|
191
|
+
* @param packageVersion - Package version to filter by
|
|
192
|
+
* @returns Request body for the ElementCountByStatus endpoint
|
|
193
|
+
* @internal
|
|
194
|
+
*/
|
|
195
|
+
function buildElementCountByStatusBody(processKey, packageId, startTime, endTime, packageVersion) {
|
|
196
|
+
return {
|
|
197
|
+
commonParams: {
|
|
198
|
+
processKey,
|
|
199
|
+
packageId,
|
|
200
|
+
startTime: startTime.getTime(),
|
|
201
|
+
endTime: endTime.getTime(),
|
|
202
|
+
version: packageVersion
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
}
|
|
171
206
|
|
|
172
207
|
/**
|
|
173
208
|
* Common constants used across the SDK
|
|
@@ -1160,6 +1195,32 @@ function filterUndefined(obj) {
|
|
|
1160
1195
|
*/
|
|
1161
1196
|
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
1162
1197
|
isBrowser && window.self != window.top && window.location.href.includes('source=ActionCenter');
|
|
1198
|
+
const _params = isBrowser ? new URLSearchParams(window.location.search) : null;
|
|
1199
|
+
/**
|
|
1200
|
+
* True when the coded app has been loaded inside a host frame that explicitly
|
|
1201
|
+
* opted into token delegation by adding `?host=embed` to the iframe src URL.
|
|
1202
|
+
*/
|
|
1203
|
+
const isHostEmbedded = isBrowser && window.self !== window.top && _params?.get('host') === 'embed';
|
|
1204
|
+
/**
|
|
1205
|
+
* The validated parent origin, read from the `?basedomain=` query param set
|
|
1206
|
+
* by the embedding host in the iframe src URL.
|
|
1207
|
+
* Mirrors the same mechanism used by ActionCenterTokenManager.
|
|
1208
|
+
* Non-null only when `?host=embed` is present and `?basedomain=` is a valid URL.
|
|
1209
|
+
*/
|
|
1210
|
+
(() => {
|
|
1211
|
+
if (!isHostEmbedded)
|
|
1212
|
+
return null;
|
|
1213
|
+
const basedomain = _params?.get('basedomain');
|
|
1214
|
+
if (!basedomain)
|
|
1215
|
+
return null;
|
|
1216
|
+
try {
|
|
1217
|
+
return new URL(basedomain).origin;
|
|
1218
|
+
}
|
|
1219
|
+
catch {
|
|
1220
|
+
console.warn('embeddingOrigin: basedomain query param is not a valid URL', basedomain);
|
|
1221
|
+
return null;
|
|
1222
|
+
}
|
|
1223
|
+
})();
|
|
1163
1224
|
|
|
1164
1225
|
/**
|
|
1165
1226
|
* Base64 encoding/decoding
|
|
@@ -1437,12 +1498,18 @@ class PaginationHelpers {
|
|
|
1437
1498
|
* @returns Promise resolving to a paginated result
|
|
1438
1499
|
*/
|
|
1439
1500
|
static async getAllPaginated(params) {
|
|
1440
|
-
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1501
|
+
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1441
1502
|
const endpoint = getEndpoint(folderId);
|
|
1442
1503
|
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
1504
|
+
// On POST, the caller's options go in the body; queryParams stays in the URL.
|
|
1505
|
+
// On GET, everything is URL — queryParams merges with additionalParams.
|
|
1506
|
+
const isPost = method === HTTP_METHODS.POST;
|
|
1507
|
+
const requestSpec = isPost
|
|
1508
|
+
? { body: additionalParams, params: queryParams }
|
|
1509
|
+
: { params: { ...additionalParams, ...queryParams } };
|
|
1443
1510
|
const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
|
|
1444
1511
|
headers,
|
|
1445
|
-
|
|
1512
|
+
...requestSpec,
|
|
1446
1513
|
pagination: {
|
|
1447
1514
|
paginationType: options.paginationType || PaginationType.OFFSET,
|
|
1448
1515
|
itemsField: options.itemsField || DEFAULT_ITEMS_FIELD,
|
|
@@ -1467,7 +1534,7 @@ class PaginationHelpers {
|
|
|
1467
1534
|
* @returns Promise resolving to an object with data and totalCount
|
|
1468
1535
|
*/
|
|
1469
1536
|
static async getAllNonPaginated(params) {
|
|
1470
|
-
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1537
|
+
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1471
1538
|
// Set default field names
|
|
1472
1539
|
const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
|
|
1473
1540
|
const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
|
|
@@ -1477,17 +1544,18 @@ class PaginationHelpers {
|
|
|
1477
1544
|
// Make the API call based on method
|
|
1478
1545
|
let response;
|
|
1479
1546
|
if (method === HTTP_METHODS.POST) {
|
|
1480
|
-
response = await serviceAccess.post(endpoint, additionalParams, { headers });
|
|
1547
|
+
response = await serviceAccess.post(endpoint, additionalParams, { headers, params: queryParams });
|
|
1481
1548
|
}
|
|
1482
1549
|
else {
|
|
1483
1550
|
response = await serviceAccess.get(endpoint, {
|
|
1484
|
-
params: additionalParams,
|
|
1551
|
+
params: { ...additionalParams, ...queryParams },
|
|
1485
1552
|
headers
|
|
1486
1553
|
});
|
|
1487
1554
|
}
|
|
1488
1555
|
// Extract and transform items from response
|
|
1489
|
-
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1490
|
-
|
|
1556
|
+
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
|
|
1557
|
+
// itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
|
|
1558
|
+
const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
|
|
1491
1559
|
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1492
1560
|
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1493
1561
|
// Parse items - automatically handle JSON string responses
|
|
@@ -1533,8 +1601,9 @@ class PaginationHelpers {
|
|
|
1533
1601
|
getEndpoint: config.getEndpoint,
|
|
1534
1602
|
folderId,
|
|
1535
1603
|
headers: config.headers,
|
|
1536
|
-
paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
|
|
1604
|
+
paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
|
|
1537
1605
|
additionalParams: prefixedOptions,
|
|
1606
|
+
queryParams: config.queryParams,
|
|
1538
1607
|
transformFn: config.transformFn,
|
|
1539
1608
|
method: config.method,
|
|
1540
1609
|
options: {
|
|
@@ -1552,6 +1621,7 @@ class PaginationHelpers {
|
|
|
1552
1621
|
folderId,
|
|
1553
1622
|
headers: config.headers,
|
|
1554
1623
|
additionalParams: prefixedOptions,
|
|
1624
|
+
queryParams: config.queryParams,
|
|
1555
1625
|
transformFn: config.transformFn,
|
|
1556
1626
|
method: config.method,
|
|
1557
1627
|
options: {
|
|
@@ -1743,18 +1813,17 @@ class BaseService {
|
|
|
1743
1813
|
const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
|
|
1744
1814
|
// Prepare request parameters based on pagination type
|
|
1745
1815
|
const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
|
|
1746
|
-
//
|
|
1816
|
+
// Route pagination state to wherever the API expects it (body for POST, URL for GET).
|
|
1817
|
+
// Caller-supplied options.body / options.params are respected as-is — the api-client
|
|
1818
|
+
// already handles params (URL) and body (request body) independently for every method.
|
|
1747
1819
|
if (method.toUpperCase() === 'POST') {
|
|
1748
1820
|
const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
|
|
1749
1821
|
options.body = {
|
|
1750
1822
|
...existingBody,
|
|
1751
|
-
...options.params,
|
|
1752
1823
|
...requestParams
|
|
1753
1824
|
};
|
|
1754
|
-
options.params = undefined;
|
|
1755
1825
|
}
|
|
1756
1826
|
else {
|
|
1757
|
-
// Merge pagination parameters with existing parameters
|
|
1758
1827
|
options.params = {
|
|
1759
1828
|
...options.params,
|
|
1760
1829
|
...requestParams
|
|
@@ -1791,6 +1860,8 @@ class BaseService {
|
|
|
1791
1860
|
// When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
|
|
1792
1861
|
// When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
|
|
1793
1862
|
const convertToSkip = paginationParams?.convertToSkip ?? true;
|
|
1863
|
+
// When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
|
|
1864
|
+
const zeroBased = paginationParams?.zeroBased ?? false;
|
|
1794
1865
|
requestParams[pageSizeParam] = limitedPageSize;
|
|
1795
1866
|
if (convertToSkip) {
|
|
1796
1867
|
if (params.pageNumber && params.pageNumber > 1) {
|
|
@@ -1798,7 +1869,8 @@ class BaseService {
|
|
|
1798
1869
|
}
|
|
1799
1870
|
}
|
|
1800
1871
|
else {
|
|
1801
|
-
|
|
1872
|
+
const sdkPageNumber = params.pageNumber || 1;
|
|
1873
|
+
requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
|
|
1802
1874
|
}
|
|
1803
1875
|
{
|
|
1804
1876
|
requestParams[countParam] = true;
|
|
@@ -1827,8 +1899,9 @@ class BaseService {
|
|
|
1827
1899
|
const totalCountField = fields.totalCountField || 'totalRecordCount';
|
|
1828
1900
|
const continuationTokenField = fields.continuationTokenField || 'continuationToken';
|
|
1829
1901
|
// Extract items and metadata
|
|
1830
|
-
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1831
|
-
|
|
1902
|
+
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
|
|
1903
|
+
// itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
|
|
1904
|
+
const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
|
|
1832
1905
|
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1833
1906
|
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1834
1907
|
const continuationToken = response.data[continuationTokenField];
|
|
@@ -1915,7 +1988,9 @@ function createProcessInstanceMethods(instanceData, service) {
|
|
|
1915
1988
|
async getExecutionHistory() {
|
|
1916
1989
|
if (!instanceData.instanceId)
|
|
1917
1990
|
throw new Error('Process instance ID is undefined');
|
|
1918
|
-
|
|
1991
|
+
if (!instanceData.folderKey)
|
|
1992
|
+
throw new Error('Process instance folder key is undefined');
|
|
1993
|
+
return service.getExecutionHistory(instanceData.instanceId, instanceData.folderKey);
|
|
1919
1994
|
},
|
|
1920
1995
|
async getBpmn() {
|
|
1921
1996
|
if (!instanceData.instanceId)
|
|
@@ -2112,12 +2187,6 @@ const ProcessInstanceMap = {
|
|
|
2112
2187
|
createdAt: 'createdTime',
|
|
2113
2188
|
updatedAt: 'updatedTime'
|
|
2114
2189
|
};
|
|
2115
|
-
/**
|
|
2116
|
-
* Maps fields for Process Instance Execution History to ensure consistent naming
|
|
2117
|
-
*/
|
|
2118
|
-
const ProcessInstanceExecutionHistoryMap = {
|
|
2119
|
-
startTime: 'startedTime'
|
|
2120
|
-
};
|
|
2121
2190
|
|
|
2122
2191
|
class ProcessInstancesService extends BaseService {
|
|
2123
2192
|
/**
|
|
@@ -2198,11 +2267,66 @@ class ProcessInstancesService extends BaseService {
|
|
|
2198
2267
|
/**
|
|
2199
2268
|
* Get execution history (spans) for a process instance
|
|
2200
2269
|
* @param instanceId The ID of the instance to get history for
|
|
2201
|
-
* @
|
|
2270
|
+
* @param folderKey The folder key for authorization
|
|
2271
|
+
* @returns Promise resolving to execution history
|
|
2272
|
+
* {@link ProcessInstanceExecutionHistoryResponse}
|
|
2273
|
+
* @example
|
|
2274
|
+
* ```typescript
|
|
2275
|
+
* // Get execution history for a process instance
|
|
2276
|
+
* const history = await processInstances.getExecutionHistory(
|
|
2277
|
+
* <instanceId>,
|
|
2278
|
+
* <folderKey>
|
|
2279
|
+
* );
|
|
2280
|
+
*
|
|
2281
|
+
* // Analyze execution timeline
|
|
2282
|
+
* history.forEach(span => {
|
|
2283
|
+
* console.log(`Activity: ${span.name}`);
|
|
2284
|
+
* console.log(`Start: ${span.startedTime}`);
|
|
2285
|
+
* console.log(`End: ${span.endTime}`);
|
|
2286
|
+
* });
|
|
2287
|
+
* ```
|
|
2202
2288
|
*/
|
|
2203
|
-
async getExecutionHistory(instanceId) {
|
|
2204
|
-
const
|
|
2205
|
-
|
|
2289
|
+
async getExecutionHistory(instanceId, folderKey) {
|
|
2290
|
+
const headers = createHeaders({ [FOLDER_KEY]: folderKey });
|
|
2291
|
+
const elementExecResponse = await this.get(MAESTRO_ENDPOINTS.INSTANCES.GET_ELEMENT_EXECUTIONS(instanceId), { headers });
|
|
2292
|
+
const traceId = elementExecResponse.data.traceId;
|
|
2293
|
+
const spansResponse = await this.get(MAESTRO_ENDPOINTS.TRACES.GET_SPANS(traceId), { headers });
|
|
2294
|
+
// Build span lookup keyed by elementRunId extracted from Attributes JSON
|
|
2295
|
+
const spanMap = new Map();
|
|
2296
|
+
for (const span of spansResponse.data) {
|
|
2297
|
+
try {
|
|
2298
|
+
const attrs = span.Attributes ? JSON.parse(span.Attributes) : null;
|
|
2299
|
+
if (attrs?.elementRunId) {
|
|
2300
|
+
spanMap.set(attrs.elementRunId, span);
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
catch {
|
|
2304
|
+
// skip spans with unparseable Attributes — they won't match any elementRunId
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
const results = [];
|
|
2308
|
+
for (const elementExec of elementExecResponse.data.elementExecutions) {
|
|
2309
|
+
for (const run of elementExec.elementRuns) {
|
|
2310
|
+
const span = spanMap.get(run.elementRunId);
|
|
2311
|
+
if (span) {
|
|
2312
|
+
results.push(this.mapSpanToHistory(span));
|
|
2313
|
+
}
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
return results;
|
|
2317
|
+
}
|
|
2318
|
+
mapSpanToHistory(span) {
|
|
2319
|
+
return {
|
|
2320
|
+
id: span.Id,
|
|
2321
|
+
traceId: span.TraceId,
|
|
2322
|
+
parentId: span.ParentId,
|
|
2323
|
+
name: span.Name,
|
|
2324
|
+
startedTime: span.StartTime,
|
|
2325
|
+
endTime: span.EndTime,
|
|
2326
|
+
attributes: span.Attributes,
|
|
2327
|
+
updatedTime: span.UpdatedAt,
|
|
2328
|
+
expiredTime: span.ExpiryTimeUtc,
|
|
2329
|
+
};
|
|
2206
2330
|
}
|
|
2207
2331
|
/**
|
|
2208
2332
|
* Get BPMN XML file for a process instance
|
|
@@ -2694,6 +2818,41 @@ class MaestroProcessesService extends BaseService {
|
|
|
2694
2818
|
const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_DURATION, buildInsightsTopBody(startTime, endTime, false, options));
|
|
2695
2819
|
return (data ?? []).map(process => ({ ...process, name: process.packageId }));
|
|
2696
2820
|
}
|
|
2821
|
+
/**
|
|
2822
|
+
* Get element stats for process instances
|
|
2823
|
+
*
|
|
2824
|
+
* Returns per-element execution counts (success, fail, terminated, paused, in-progress) and
|
|
2825
|
+
* duration percentile metrics (min, max, avg, p50, p95, p99) for BPMN elements within a process.
|
|
2826
|
+
*
|
|
2827
|
+
* @param processKey - Process key to filter by
|
|
2828
|
+
* @param packageId - Package identifier
|
|
2829
|
+
* @param startTime - Start of the time range to query
|
|
2830
|
+
* @param endTime - End of the time range to query
|
|
2831
|
+
* @param packageVersion - Package version to filter by
|
|
2832
|
+
* @returns Promise resolving to an array of {@link ElementStats}
|
|
2833
|
+
* @example
|
|
2834
|
+
* ```typescript
|
|
2835
|
+
* // Get element metrics for a process
|
|
2836
|
+
* const elements = await maestroProcesses.getElementStats(
|
|
2837
|
+
* '<processKey>',
|
|
2838
|
+
* '<packageId>',
|
|
2839
|
+
* new Date('2026-04-01'),
|
|
2840
|
+
* new Date(),
|
|
2841
|
+
* '1.0.1'
|
|
2842
|
+
* );
|
|
2843
|
+
*
|
|
2844
|
+
* // Analyze element performance
|
|
2845
|
+
* for (const element of elements) {
|
|
2846
|
+
* console.log(`Element: ${element.elementId}`);
|
|
2847
|
+
* console.log(` Success: ${element.successCount}, Failed: ${element.failCount}`);
|
|
2848
|
+
* console.log(` Avg duration: ${element.avgDurationMs}ms, P95: ${element.p95DurationMs}ms`);
|
|
2849
|
+
* }
|
|
2850
|
+
* ```
|
|
2851
|
+
*/
|
|
2852
|
+
async getElementStats(processKey, packageId, startTime, endTime, packageVersion) {
|
|
2853
|
+
const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.ELEMENT_COUNT_BY_STATUS, buildElementCountByStatusBody(processKey, packageId, startTime, endTime, packageVersion));
|
|
2854
|
+
return data ?? [];
|
|
2855
|
+
}
|
|
2697
2856
|
}
|
|
2698
2857
|
__decorate([
|
|
2699
2858
|
track('MaestroProcesses.GetAll')
|
|
@@ -2716,6 +2875,9 @@ __decorate([
|
|
|
2716
2875
|
__decorate([
|
|
2717
2876
|
track('MaestroProcesses.GetTopExecutionDuration')
|
|
2718
2877
|
], MaestroProcessesService.prototype, "getTopExecutionDuration", null);
|
|
2878
|
+
__decorate([
|
|
2879
|
+
track('MaestroProcesses.GetElementStats')
|
|
2880
|
+
], MaestroProcessesService.prototype, "getElementStats", null);
|
|
2719
2881
|
|
|
2720
2882
|
/**
|
|
2721
2883
|
* Service class for Maestro Process Incidents
|
|
@@ -109,6 +109,35 @@ interface GetTopDurationResponse extends GetTopBaseResponse {
|
|
|
109
109
|
/** Total execution duration in milliseconds */
|
|
110
110
|
duration: number;
|
|
111
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Element count by status for a BPMN element within a process or case
|
|
114
|
+
*/
|
|
115
|
+
interface ElementStats {
|
|
116
|
+
/** BPMN element identifier */
|
|
117
|
+
elementId: string;
|
|
118
|
+
/** Number of successful executions */
|
|
119
|
+
successCount: number;
|
|
120
|
+
/** Number of failed executions */
|
|
121
|
+
failCount: number;
|
|
122
|
+
/** Number of terminated executions */
|
|
123
|
+
terminatedCount: number;
|
|
124
|
+
/** Number of paused executions */
|
|
125
|
+
pausedCount: number;
|
|
126
|
+
/** Number of in-progress executions */
|
|
127
|
+
inProgressCount: number;
|
|
128
|
+
/** Minimum duration in milliseconds */
|
|
129
|
+
minDurationMs: number;
|
|
130
|
+
/** Maximum duration in milliseconds */
|
|
131
|
+
maxDurationMs: number;
|
|
132
|
+
/** Average duration in milliseconds */
|
|
133
|
+
avgDurationMs: number;
|
|
134
|
+
/** 50th percentile (median) duration in milliseconds */
|
|
135
|
+
p50DurationMs: number;
|
|
136
|
+
/** 95th percentile duration in milliseconds */
|
|
137
|
+
p95DurationMs: number;
|
|
138
|
+
/** 99th percentile duration in milliseconds */
|
|
139
|
+
p99DurationMs: number;
|
|
140
|
+
}
|
|
112
141
|
|
|
113
142
|
/**
|
|
114
143
|
* Maestro Process Types
|
|
@@ -495,6 +524,38 @@ interface MaestroProcessesServiceModel {
|
|
|
495
524
|
* ```
|
|
496
525
|
*/
|
|
497
526
|
getTopExecutionDuration(startTime: Date, endTime: Date, options?: TopQueryOptions): Promise<ProcessGetTopDurationResponse[]>;
|
|
527
|
+
/**
|
|
528
|
+
* Get element stats for process instances
|
|
529
|
+
*
|
|
530
|
+
* Returns per-element execution counts (success, fail, terminated, paused, in-progress) and
|
|
531
|
+
* duration percentile metrics (min, max, avg, p50, p95, p99) for BPMN elements within a process.
|
|
532
|
+
*
|
|
533
|
+
* @param processKey - Process key to filter by
|
|
534
|
+
* @param packageId - Package identifier
|
|
535
|
+
* @param startTime - Start of the time range to query
|
|
536
|
+
* @param endTime - End of the time range to query
|
|
537
|
+
* @param packageVersion - Package version to filter by
|
|
538
|
+
* @returns Promise resolving to an array of {@link ElementStats}
|
|
539
|
+
* @example
|
|
540
|
+
* ```typescript
|
|
541
|
+
* // Get element metrics for a process
|
|
542
|
+
* const elements = await maestroProcesses.getElementStats(
|
|
543
|
+
* '<processKey>',
|
|
544
|
+
* '<packageId>',
|
|
545
|
+
* new Date('2026-04-01'),
|
|
546
|
+
* new Date(),
|
|
547
|
+
* '1.0.1'
|
|
548
|
+
* );
|
|
549
|
+
*
|
|
550
|
+
* // Analyze element performance
|
|
551
|
+
* for (const element of elements) {
|
|
552
|
+
* console.log(`Element: ${element.elementId}`);
|
|
553
|
+
* console.log(` Success: ${element.successCount}, Failed: ${element.failCount}`);
|
|
554
|
+
* console.log(` Avg duration: ${element.avgDurationMs}ms, P95: ${element.p95DurationMs}ms`);
|
|
555
|
+
* }
|
|
556
|
+
* ```
|
|
557
|
+
*/
|
|
558
|
+
getElementStats(processKey: string, packageId: string, startTime: Date, endTime: Date, packageVersion: string): Promise<ElementStats[]>;
|
|
498
559
|
}
|
|
499
560
|
interface ProcessMethods {
|
|
500
561
|
/**
|
|
@@ -503,6 +564,15 @@ interface ProcessMethods {
|
|
|
503
564
|
* @returns Promise resolving to array of process incidents
|
|
504
565
|
*/
|
|
505
566
|
getIncidents(): Promise<ProcessIncidentGetResponse[]>;
|
|
567
|
+
/**
|
|
568
|
+
* Get element stats for this process
|
|
569
|
+
*
|
|
570
|
+
* @param startTime - Start of the time range to query
|
|
571
|
+
* @param endTime - End of the time range to query
|
|
572
|
+
* @param packageVersion - Package version to filter by
|
|
573
|
+
* @returns Promise resolving to an array of {@link ElementStats}
|
|
574
|
+
*/
|
|
575
|
+
getElementStats(startTime: Date, endTime: Date, packageVersion: string): Promise<ElementStats[]>;
|
|
506
576
|
}
|
|
507
577
|
type MaestroProcessGetAllResponse = RawMaestroProcessGetAllResponse & ProcessMethods;
|
|
508
578
|
/**
|
|
@@ -645,8 +715,7 @@ interface ProcessInstanceExecutionHistoryResponse {
|
|
|
645
715
|
startedTime: string;
|
|
646
716
|
endTime: string | null;
|
|
647
717
|
attributes: string | null;
|
|
648
|
-
|
|
649
|
-
updatedTime?: string;
|
|
718
|
+
updatedTime: string;
|
|
650
719
|
expiredTime: string | null;
|
|
651
720
|
}
|
|
652
721
|
/**
|
|
@@ -793,24 +862,26 @@ interface ProcessInstancesServiceModel {
|
|
|
793
862
|
/**
|
|
794
863
|
* Get execution history (spans) for a process instance
|
|
795
864
|
* @param instanceId The ID of the instance to get history for
|
|
865
|
+
* @param folderKey The folder key for authorization
|
|
796
866
|
* @returns Promise resolving to execution history
|
|
797
867
|
* {@link ProcessInstanceExecutionHistoryResponse}
|
|
798
868
|
* @example
|
|
799
869
|
* ```typescript
|
|
800
870
|
* // Get execution history for a process instance
|
|
801
871
|
* const history = await processInstances.getExecutionHistory(
|
|
802
|
-
* <instanceId
|
|
872
|
+
* <instanceId>,
|
|
873
|
+
* <folderKey>
|
|
803
874
|
* );
|
|
804
875
|
*
|
|
805
876
|
* // Analyze execution timeline
|
|
806
877
|
* history.forEach(span => {
|
|
807
878
|
* console.log(`Activity: ${span.name}`);
|
|
808
|
-
* console.log(`Start: ${span.
|
|
809
|
-
* console.log(`
|
|
879
|
+
* console.log(`Start: ${span.startedTime}`);
|
|
880
|
+
* console.log(`End: ${span.endTime}`);
|
|
810
881
|
* });
|
|
811
882
|
* ```
|
|
812
883
|
*/
|
|
813
|
-
getExecutionHistory(instanceId: string): Promise<ProcessInstanceExecutionHistoryResponse[]>;
|
|
884
|
+
getExecutionHistory(instanceId: string, folderKey: string): Promise<ProcessInstanceExecutionHistoryResponse[]>;
|
|
814
885
|
/**
|
|
815
886
|
* Get BPMN XML file for a process instance
|
|
816
887
|
* @param instanceId The ID of the instance to get BPMN for
|
|
@@ -1076,6 +1147,7 @@ interface RequestWithPaginationOptions extends RequestSpec {
|
|
|
1076
1147
|
tokenParam?: string;
|
|
1077
1148
|
countParam?: string;
|
|
1078
1149
|
convertToSkip?: boolean;
|
|
1150
|
+
zeroBased?: boolean;
|
|
1079
1151
|
};
|
|
1080
1152
|
};
|
|
1081
1153
|
}
|
|
@@ -1496,6 +1568,38 @@ declare class MaestroProcessesService extends BaseService implements MaestroProc
|
|
|
1496
1568
|
* ```
|
|
1497
1569
|
*/
|
|
1498
1570
|
getTopExecutionDuration(startTime: Date, endTime: Date, options?: TopQueryOptions): Promise<ProcessGetTopDurationResponse[]>;
|
|
1571
|
+
/**
|
|
1572
|
+
* Get element stats for process instances
|
|
1573
|
+
*
|
|
1574
|
+
* Returns per-element execution counts (success, fail, terminated, paused, in-progress) and
|
|
1575
|
+
* duration percentile metrics (min, max, avg, p50, p95, p99) for BPMN elements within a process.
|
|
1576
|
+
*
|
|
1577
|
+
* @param processKey - Process key to filter by
|
|
1578
|
+
* @param packageId - Package identifier
|
|
1579
|
+
* @param startTime - Start of the time range to query
|
|
1580
|
+
* @param endTime - End of the time range to query
|
|
1581
|
+
* @param packageVersion - Package version to filter by
|
|
1582
|
+
* @returns Promise resolving to an array of {@link ElementStats}
|
|
1583
|
+
* @example
|
|
1584
|
+
* ```typescript
|
|
1585
|
+
* // Get element metrics for a process
|
|
1586
|
+
* const elements = await maestroProcesses.getElementStats(
|
|
1587
|
+
* '<processKey>',
|
|
1588
|
+
* '<packageId>',
|
|
1589
|
+
* new Date('2026-04-01'),
|
|
1590
|
+
* new Date(),
|
|
1591
|
+
* '1.0.1'
|
|
1592
|
+
* );
|
|
1593
|
+
*
|
|
1594
|
+
* // Analyze element performance
|
|
1595
|
+
* for (const element of elements) {
|
|
1596
|
+
* console.log(`Element: ${element.elementId}`);
|
|
1597
|
+
* console.log(` Success: ${element.successCount}, Failed: ${element.failCount}`);
|
|
1598
|
+
* console.log(` Avg duration: ${element.avgDurationMs}ms, P95: ${element.p95DurationMs}ms`);
|
|
1599
|
+
* }
|
|
1600
|
+
* ```
|
|
1601
|
+
*/
|
|
1602
|
+
getElementStats(processKey: string, packageId: string, startTime: Date, endTime: Date, packageVersion: string): Promise<ElementStats[]>;
|
|
1499
1603
|
}
|
|
1500
1604
|
|
|
1501
1605
|
declare class ProcessInstancesService extends BaseService implements ProcessInstancesServiceModel {
|
|
@@ -1550,9 +1654,27 @@ declare class ProcessInstancesService extends BaseService implements ProcessInst
|
|
|
1550
1654
|
/**
|
|
1551
1655
|
* Get execution history (spans) for a process instance
|
|
1552
1656
|
* @param instanceId The ID of the instance to get history for
|
|
1553
|
-
* @
|
|
1657
|
+
* @param folderKey The folder key for authorization
|
|
1658
|
+
* @returns Promise resolving to execution history
|
|
1659
|
+
* {@link ProcessInstanceExecutionHistoryResponse}
|
|
1660
|
+
* @example
|
|
1661
|
+
* ```typescript
|
|
1662
|
+
* // Get execution history for a process instance
|
|
1663
|
+
* const history = await processInstances.getExecutionHistory(
|
|
1664
|
+
* <instanceId>,
|
|
1665
|
+
* <folderKey>
|
|
1666
|
+
* );
|
|
1667
|
+
*
|
|
1668
|
+
* // Analyze execution timeline
|
|
1669
|
+
* history.forEach(span => {
|
|
1670
|
+
* console.log(`Activity: ${span.name}`);
|
|
1671
|
+
* console.log(`Start: ${span.startedTime}`);
|
|
1672
|
+
* console.log(`End: ${span.endTime}`);
|
|
1673
|
+
* });
|
|
1674
|
+
* ```
|
|
1554
1675
|
*/
|
|
1555
|
-
getExecutionHistory(instanceId: string): Promise<ProcessInstanceExecutionHistoryResponse[]>;
|
|
1676
|
+
getExecutionHistory(instanceId: string, folderKey: string): Promise<ProcessInstanceExecutionHistoryResponse[]>;
|
|
1677
|
+
private mapSpanToHistory;
|
|
1556
1678
|
/**
|
|
1557
1679
|
* Get BPMN XML file for a process instance
|
|
1558
1680
|
* @param instanceId The ID of the instance to get BPMN for
|
|
@@ -1652,4 +1774,4 @@ declare class ProcessIncidentsService extends BaseService implements ProcessInci
|
|
|
1652
1774
|
}
|
|
1653
1775
|
|
|
1654
1776
|
export { DebugMode, InstanceFinalStatus, MaestroProcessesService as MaestroProcesses, MaestroProcessesService, ProcessIncidentSeverity, ProcessIncidentStatus, ProcessIncidentType, ProcessIncidentsService as ProcessIncidents, ProcessIncidentsService, ProcessInstancesService as ProcessInstances, ProcessInstancesService, TimeInterval, createProcessInstanceWithMethods, createProcessWithMethods };
|
|
1655
|
-
export type { BpmnXmlString, ElementGetTopFailedCountResponse, ElementMetaData, GetTopBaseResponse, GetTopDurationResponse, GetTopFaultedCountResponse, GetTopRunCountResponse, GlobalVariableMetaData, InstanceStatusTimelineResponse, MaestroProcessGetAllResponse, MaestroProcessesServiceModel, ProcessGetTopDurationResponse, ProcessGetTopFaultedCountResponse, ProcessGetTopRunCountResponse, ProcessIncidentGetAllResponse, ProcessIncidentGetResponse, ProcessIncidentsServiceModel, ProcessInstanceExecutionHistoryResponse, ProcessInstanceGetAllOptions, ProcessInstanceGetAllWithPaginationOptions, ProcessInstanceGetResponse, ProcessInstanceGetVariablesOptions, ProcessInstanceGetVariablesResponse, ProcessInstanceMethods, ProcessInstanceOperationOptions, ProcessInstanceOperationResponse, ProcessInstanceRun, ProcessInstancesServiceModel, ProcessMethods, RawMaestroProcessGetAllResponse, RawProcessInstanceGetResponse, TimelineOptions, TopQueryOptions };
|
|
1777
|
+
export type { BpmnXmlString, ElementGetTopFailedCountResponse, ElementMetaData, ElementStats, GetTopBaseResponse, GetTopDurationResponse, GetTopFaultedCountResponse, GetTopRunCountResponse, GlobalVariableMetaData, InstanceStatusTimelineResponse, MaestroProcessGetAllResponse, MaestroProcessesServiceModel, ProcessGetTopDurationResponse, ProcessGetTopFaultedCountResponse, ProcessGetTopRunCountResponse, ProcessIncidentGetAllResponse, ProcessIncidentGetResponse, ProcessIncidentsServiceModel, ProcessInstanceExecutionHistoryResponse, ProcessInstanceGetAllOptions, ProcessInstanceGetAllWithPaginationOptions, ProcessInstanceGetResponse, ProcessInstanceGetVariablesOptions, ProcessInstanceGetVariablesResponse, ProcessInstanceMethods, ProcessInstanceOperationOptions, ProcessInstanceOperationResponse, ProcessInstanceRun, ProcessInstancesServiceModel, ProcessMethods, RawMaestroProcessGetAllResponse, RawProcessInstanceGetResponse, TimelineOptions, TopQueryOptions };
|