@uipath/uipath-typescript 1.3.8 → 1.3.9
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/assets/index.cjs +25 -270
- package/dist/assets/index.mjs +25 -270
- package/dist/attachments/index.cjs +23 -267
- package/dist/attachments/index.mjs +23 -267
- package/dist/buckets/index.cjs +54 -270
- package/dist/buckets/index.d.ts +50 -1
- package/dist/buckets/index.mjs +54 -270
- package/dist/cases/index.cjs +408 -337
- package/dist/cases/index.d.ts +534 -2
- package/dist/cases/index.mjs +409 -338
- package/dist/conversational-agent/index.cjs +71 -281
- package/dist/conversational-agent/index.d.ts +62 -12
- package/dist/conversational-agent/index.mjs +71 -282
- package/dist/core/index.cjs +39 -289
- package/dist/core/index.d.ts +9 -98
- package/dist/core/index.mjs +40 -275
- package/dist/document-understanding/index.cjs +18 -1
- package/dist/document-understanding/index.d.ts +636 -610
- package/dist/document-understanding/index.mjs +18 -1
- package/dist/entities/index.cjs +25 -270
- package/dist/entities/index.mjs +25 -270
- package/dist/feedback/index.cjs +23 -268
- package/dist/feedback/index.mjs +23 -268
- package/dist/index.cjs +600 -293
- package/dist/index.d.ts +1603 -722
- package/dist/index.mjs +600 -279
- package/dist/index.umd.js +789 -158
- package/dist/jobs/index.cjs +25 -270
- package/dist/jobs/index.mjs +25 -270
- package/dist/maestro-processes/index.cjs +1751 -1720
- package/dist/maestro-processes/index.d.ts +430 -2
- package/dist/maestro-processes/index.mjs +1752 -1721
- package/dist/processes/index.cjs +25 -270
- package/dist/processes/index.mjs +25 -270
- package/dist/queues/index.cjs +25 -270
- package/dist/queues/index.mjs +25 -270
- package/dist/tasks/index.cjs +25 -270
- package/dist/tasks/index.mjs +25 -270
- package/package.json +8 -10
package/dist/cases/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var coreTelemetry = require('@uipath/core-telemetry');
|
|
4
4
|
|
|
5
5
|
/******************************************************************************
|
|
6
6
|
Copyright (c) Microsoft Corporation.
|
|
@@ -56,6 +56,130 @@ var ProcessType;
|
|
|
56
56
|
ProcessType["CaseManagement"] = "CaseManagement";
|
|
57
57
|
})(ProcessType || (ProcessType = {}));
|
|
58
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Base path constants for different services
|
|
61
|
+
*/
|
|
62
|
+
const ORCHESTRATOR_BASE = 'orchestrator_';
|
|
63
|
+
const PIMS_BASE = 'pims_';
|
|
64
|
+
const INSIGHTS_RTM_BASE = 'insightsrtm_';
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Orchestrator Service Endpoints
|
|
68
|
+
*/
|
|
69
|
+
/**
|
|
70
|
+
* Task Service (Action Center) Endpoints
|
|
71
|
+
*/
|
|
72
|
+
const TASK_ENDPOINTS = {
|
|
73
|
+
CREATE_GENERIC_TASK: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/CreateTask`,
|
|
74
|
+
GET_TASK_USERS: (folderId) => `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.GetTaskUsers(organizationUnitId=${folderId})`,
|
|
75
|
+
GET_TASKS_ACROSS_FOLDERS: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.GetTasksAcrossFolders`,
|
|
76
|
+
GET_TASKS_ACROSS_FOLDERS_ADMIN: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.GetTasksAcrossFoldersForAdmin`,
|
|
77
|
+
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Tasks(${id})`,
|
|
78
|
+
ASSIGN_TASKS: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.AssignTasks`,
|
|
79
|
+
REASSIGN_TASKS: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.ReassignTasks`,
|
|
80
|
+
UNASSIGN_TASKS: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.UnassignTasks`,
|
|
81
|
+
COMPLETE_FORM_TASK: `${ORCHESTRATOR_BASE}/forms/TaskForms/CompleteTask`,
|
|
82
|
+
COMPLETE_APP_TASK: `${ORCHESTRATOR_BASE}/tasks/AppTasks/CompleteAppTask`,
|
|
83
|
+
COMPLETE_GENERIC_TASK: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/CompleteTask`,
|
|
84
|
+
GET_TASK_FORM_BY_ID: `${ORCHESTRATOR_BASE}/forms/TaskForms/GetTaskFormById`,
|
|
85
|
+
GET_GENERIC_TASK_BY_ID: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/GetTaskDataById`,
|
|
86
|
+
GET_APP_TASK_BY_ID: `${ORCHESTRATOR_BASE}/tasks/AppTasks/GetAppTaskById`,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Maestro Service Endpoints
|
|
91
|
+
*/
|
|
92
|
+
/**
|
|
93
|
+
* Maestro Process Service Endpoints
|
|
94
|
+
*/
|
|
95
|
+
const MAESTRO_ENDPOINTS = {
|
|
96
|
+
PROCESSES: {
|
|
97
|
+
GET_ALL: `${PIMS_BASE}/api/v1/processes/summary`,
|
|
98
|
+
GET_SETTINGS: (processKey) => `${PIMS_BASE}/api/v1/processes/${processKey}/settings`,
|
|
99
|
+
},
|
|
100
|
+
INSTANCES: {
|
|
101
|
+
GET_ALL: `${PIMS_BASE}/api/v1/instances`,
|
|
102
|
+
GET_BY_ID: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}`,
|
|
103
|
+
GET_EXECUTION_HISTORY: (instanceId) => `${PIMS_BASE}/api/v1/spans/${instanceId}`,
|
|
104
|
+
GET_BPMN: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/bpmn`,
|
|
105
|
+
GET_VARIABLES: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/variables`,
|
|
106
|
+
CANCEL: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/cancel`,
|
|
107
|
+
PAUSE: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/pause`,
|
|
108
|
+
RESUME: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/resume`,
|
|
109
|
+
},
|
|
110
|
+
INCIDENTS: {
|
|
111
|
+
GET_ALL: `${PIMS_BASE}/api/v1/incidents/summary`,
|
|
112
|
+
GET_BY_PROCESS: (processKey) => `${PIMS_BASE}/api/v1/incidents/process/${processKey}`,
|
|
113
|
+
GET_BY_INSTANCE: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/incidents`,
|
|
114
|
+
},
|
|
115
|
+
CASES: {
|
|
116
|
+
GET_CASE_JSON: (instanceId) => `${PIMS_BASE}/api/v1/cases/${instanceId}/case-json`,
|
|
117
|
+
GET_ELEMENT_EXECUTIONS: (instanceId) => `${PIMS_BASE}/api/v1/element-executions/case-instances/${instanceId}`,
|
|
118
|
+
REOPEN: (instanceId) => `${PIMS_BASE}/api/v1/cases/${instanceId}/reopen`,
|
|
119
|
+
},
|
|
120
|
+
INSIGHTS: {
|
|
121
|
+
/** SLA summary for case instances */
|
|
122
|
+
SLA_SUMMARY: `${INSIGHTS_RTM_BASE}/caseManagement/slaSummary`,
|
|
123
|
+
/** Stages summary for case instances */
|
|
124
|
+
STAGES_SUMMARY: `${INSIGHTS_RTM_BASE}/caseManagement/stages`,
|
|
125
|
+
/** Top processes ranked by run count */
|
|
126
|
+
TOP_PROCESSES_BY_RUN_COUNT: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByRunCount`,
|
|
127
|
+
/** Top processes ranked by failure count */
|
|
128
|
+
TOP_PROCESSES_WITH_FAILURE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcesseswithFailure`,
|
|
129
|
+
/** Instance status aggregated by date for time-series charts */
|
|
130
|
+
INSTANCE_STATUS_BY_DATE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceStatusByDate`,
|
|
131
|
+
/** Top processes ranked by total duration */
|
|
132
|
+
TOP_PROCESSES_BY_DURATION: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByDuration`,
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Builds the request body for Insights RTM "top" endpoints.
|
|
138
|
+
*
|
|
139
|
+
* @param startTime - Start of the time range to query
|
|
140
|
+
* @param endTime - End of the time range to query
|
|
141
|
+
* @param isCaseManagement - Whether to filter for case management processes
|
|
142
|
+
* @param options - Optional filters (packageId, processKey, version)
|
|
143
|
+
* @returns Request body for the Insights RTM endpoint
|
|
144
|
+
* @internal
|
|
145
|
+
*/
|
|
146
|
+
function buildInsightsTopBody(startTime, endTime, isCaseManagement, options) {
|
|
147
|
+
return {
|
|
148
|
+
commonParams: {
|
|
149
|
+
startTime: startTime.getTime(),
|
|
150
|
+
endTime: endTime.getTime(),
|
|
151
|
+
isCaseManagement,
|
|
152
|
+
...(options?.packageId ? { packageId: options.packageId } : {}),
|
|
153
|
+
...(options?.processKey ? { processKey: options.processKey } : {}),
|
|
154
|
+
...(options?.version ? { version: options.version } : {}),
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Fetches instance status timeline from the Insights API.
|
|
160
|
+
* Shared implementation used by both MaestroProcessesService and CasesService.
|
|
161
|
+
*
|
|
162
|
+
* @param postFn - Bound post method from a BaseService subclass
|
|
163
|
+
* @param startTime - Start of the time range to query
|
|
164
|
+
* @param endTime - End of the time range to query
|
|
165
|
+
* @param isCaseManagement - Whether to filter for case management processes
|
|
166
|
+
* @param options - Optional settings for time bucketing granularity
|
|
167
|
+
* @returns Promise resolving to an array of instance status timeline entries
|
|
168
|
+
* @internal
|
|
169
|
+
*/
|
|
170
|
+
async function fetchInstanceStatusTimeline(postFn, startTime, endTime, isCaseManagement, options) {
|
|
171
|
+
const response = await postFn(MAESTRO_ENDPOINTS.INSIGHTS.INSTANCE_STATUS_BY_DATE, {
|
|
172
|
+
commonParams: {
|
|
173
|
+
startTime: startTime.getTime(),
|
|
174
|
+
endTime: endTime.getTime(),
|
|
175
|
+
isCaseManagement,
|
|
176
|
+
},
|
|
177
|
+
timeSliceUnit: options?.groupBy,
|
|
178
|
+
timezoneOffset: new Date().getTimezoneOffset() * -1,
|
|
179
|
+
});
|
|
180
|
+
return response.data ?? [];
|
|
181
|
+
}
|
|
182
|
+
|
|
59
183
|
/**
|
|
60
184
|
* Type guards for error response types
|
|
61
185
|
*/
|
|
@@ -1835,345 +1959,33 @@ class BaseService {
|
|
|
1835
1959
|
_BaseService_apiClient = new WeakMap();
|
|
1836
1960
|
|
|
1837
1961
|
/**
|
|
1838
|
-
*
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
*
|
|
1846
|
-
*/
|
|
1847
|
-
/**
|
|
1848
|
-
|
|
1849
|
-
*/
|
|
1850
|
-
const TASK_ENDPOINTS = {
|
|
1851
|
-
CREATE_GENERIC_TASK: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/CreateTask`,
|
|
1852
|
-
GET_TASK_USERS: (folderId) => `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.GetTaskUsers(organizationUnitId=${folderId})`,
|
|
1853
|
-
GET_TASKS_ACROSS_FOLDERS: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.GetTasksAcrossFolders`,
|
|
1854
|
-
GET_TASKS_ACROSS_FOLDERS_ADMIN: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.GetTasksAcrossFoldersForAdmin`,
|
|
1855
|
-
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Tasks(${id})`,
|
|
1856
|
-
ASSIGN_TASKS: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.AssignTasks`,
|
|
1857
|
-
REASSIGN_TASKS: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.ReassignTasks`,
|
|
1858
|
-
UNASSIGN_TASKS: `${ORCHESTRATOR_BASE}/odata/Tasks/UiPath.Server.Configuration.OData.UnassignTasks`,
|
|
1859
|
-
COMPLETE_FORM_TASK: `${ORCHESTRATOR_BASE}/forms/TaskForms/CompleteTask`,
|
|
1860
|
-
COMPLETE_APP_TASK: `${ORCHESTRATOR_BASE}/tasks/AppTasks/CompleteAppTask`,
|
|
1861
|
-
COMPLETE_GENERIC_TASK: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/CompleteTask`,
|
|
1862
|
-
GET_TASK_FORM_BY_ID: `${ORCHESTRATOR_BASE}/forms/TaskForms/GetTaskFormById`,
|
|
1863
|
-
GET_GENERIC_TASK_BY_ID: `${ORCHESTRATOR_BASE}/tasks/GenericTasks/GetTaskDataById`,
|
|
1864
|
-
GET_APP_TASK_BY_ID: `${ORCHESTRATOR_BASE}/tasks/AppTasks/GetAppTaskById`,
|
|
1865
|
-
};
|
|
1866
|
-
|
|
1867
|
-
/**
|
|
1868
|
-
* Maestro Service Endpoints
|
|
1869
|
-
*/
|
|
1870
|
-
/**
|
|
1871
|
-
* Maestro Process Service Endpoints
|
|
1872
|
-
*/
|
|
1873
|
-
const MAESTRO_ENDPOINTS = {
|
|
1874
|
-
PROCESSES: {
|
|
1875
|
-
GET_ALL: `${PIMS_BASE}/api/v1/processes/summary`,
|
|
1876
|
-
GET_SETTINGS: (processKey) => `${PIMS_BASE}/api/v1/processes/${processKey}/settings`,
|
|
1877
|
-
},
|
|
1878
|
-
INSTANCES: {
|
|
1879
|
-
GET_ALL: `${PIMS_BASE}/api/v1/instances`,
|
|
1880
|
-
GET_BY_ID: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}`,
|
|
1881
|
-
GET_EXECUTION_HISTORY: (instanceId) => `${PIMS_BASE}/api/v1/spans/${instanceId}`,
|
|
1882
|
-
GET_BPMN: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/bpmn`,
|
|
1883
|
-
GET_VARIABLES: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/variables`,
|
|
1884
|
-
CANCEL: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/cancel`,
|
|
1885
|
-
PAUSE: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/pause`,
|
|
1886
|
-
RESUME: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/resume`,
|
|
1887
|
-
},
|
|
1888
|
-
INCIDENTS: {
|
|
1889
|
-
GET_ALL: `${PIMS_BASE}/api/v1/incidents/summary`,
|
|
1890
|
-
GET_BY_PROCESS: (processKey) => `${PIMS_BASE}/api/v1/incidents/process/${processKey}`,
|
|
1891
|
-
GET_BY_INSTANCE: (instanceId) => `${PIMS_BASE}/api/v1/instances/${instanceId}/incidents`,
|
|
1892
|
-
},
|
|
1893
|
-
CASES: {
|
|
1894
|
-
GET_CASE_JSON: (instanceId) => `${PIMS_BASE}/api/v1/cases/${instanceId}/case-json`,
|
|
1895
|
-
GET_ELEMENT_EXECUTIONS: (instanceId) => `${PIMS_BASE}/api/v1/element-executions/case-instances/${instanceId}`,
|
|
1896
|
-
REOPEN: (instanceId) => `${PIMS_BASE}/api/v1/cases/${instanceId}/reopen`,
|
|
1897
|
-
},
|
|
1898
|
-
INSIGHTS: {
|
|
1899
|
-
/** SLA summary for case instances */
|
|
1900
|
-
SLA_SUMMARY: `${INSIGHTS_RTM_BASE}/caseManagement/slaSummary`,
|
|
1901
|
-
},
|
|
1902
|
-
};
|
|
1903
|
-
|
|
1904
|
-
/**
|
|
1905
|
-
* SDK Telemetry constants
|
|
1906
|
-
*/
|
|
1907
|
-
// Connection string placeholder that will be replaced during build
|
|
1908
|
-
const CONNECTION_STRING = "InstrumentationKey=a6efa11d-1feb-4508-9738-e13e12dcae5e;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=7c58eb1c-9581-4ba6-839e-11725848a037";
|
|
1909
|
-
// SDK Version placeholder
|
|
1910
|
-
const SDK_VERSION = "1.3.8";
|
|
1911
|
-
const VERSION = "Version";
|
|
1912
|
-
const SERVICE = "Service";
|
|
1913
|
-
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
1914
|
-
const CLOUD_TENANT_NAME = "CloudTenantName";
|
|
1915
|
-
const CLOUD_URL = "CloudUrl";
|
|
1916
|
-
const CLOUD_CLIENT_ID = "CloudClientId";
|
|
1917
|
-
const CLOUD_REDIRECT_URI = "CloudRedirectUri";
|
|
1918
|
-
const APP_NAME = "ApplicationName";
|
|
1919
|
-
const CLOUD_ROLE_NAME = "uipath-ts-sdk";
|
|
1920
|
-
// Service and logger names
|
|
1921
|
-
const SDK_SERVICE_NAME = "UiPath.TypeScript.Sdk";
|
|
1922
|
-
const SDK_LOGGER_NAME = "uipath-ts-sdk-telemetry";
|
|
1923
|
-
// Event names
|
|
1924
|
-
const SDK_RUN_EVENT = "Sdk.Run";
|
|
1925
|
-
// Default value for unknown/empty attributes
|
|
1926
|
-
const UNKNOWN = "";
|
|
1927
|
-
|
|
1928
|
-
/**
|
|
1929
|
-
* Log exporter that sends ALL logs as Application Insights custom events
|
|
1930
|
-
*/
|
|
1931
|
-
class ApplicationInsightsEventExporter {
|
|
1932
|
-
constructor(connectionString) {
|
|
1933
|
-
this.connectionString = connectionString;
|
|
1934
|
-
}
|
|
1935
|
-
export(logs, resultCallback) {
|
|
1936
|
-
try {
|
|
1937
|
-
logs.forEach(logRecord => {
|
|
1938
|
-
this.sendAsCustomEvent(logRecord);
|
|
1939
|
-
});
|
|
1940
|
-
resultCallback({ code: 0 });
|
|
1941
|
-
}
|
|
1942
|
-
catch (error) {
|
|
1943
|
-
console.debug('Failed to export logs to Application Insights:', error);
|
|
1944
|
-
resultCallback({ code: 2, error });
|
|
1945
|
-
}
|
|
1946
|
-
}
|
|
1947
|
-
shutdown() {
|
|
1948
|
-
return Promise.resolve();
|
|
1949
|
-
}
|
|
1950
|
-
sendAsCustomEvent(logRecord) {
|
|
1951
|
-
// Get event name from body or attributes
|
|
1952
|
-
const eventName = logRecord.body || SDK_RUN_EVENT;
|
|
1953
|
-
const payload = {
|
|
1954
|
-
name: 'Microsoft.ApplicationInsights.Event',
|
|
1955
|
-
time: new Date().toISOString(),
|
|
1956
|
-
iKey: this.extractInstrumentationKey(),
|
|
1957
|
-
data: {
|
|
1958
|
-
baseType: 'EventData',
|
|
1959
|
-
baseData: {
|
|
1960
|
-
ver: 2,
|
|
1961
|
-
name: eventName,
|
|
1962
|
-
properties: this.convertAttributesToProperties(logRecord.attributes || {})
|
|
1963
|
-
}
|
|
1964
|
-
},
|
|
1965
|
-
tags: {
|
|
1966
|
-
'ai.cloud.role': CLOUD_ROLE_NAME,
|
|
1967
|
-
'ai.cloud.roleInstance': SDK_VERSION
|
|
1968
|
-
}
|
|
1969
|
-
};
|
|
1970
|
-
this.sendToApplicationInsights(payload);
|
|
1971
|
-
}
|
|
1972
|
-
extractInstrumentationKey() {
|
|
1973
|
-
const match = this.connectionString.match(/InstrumentationKey=([^;]+)/);
|
|
1974
|
-
return match ? match[1] : '';
|
|
1975
|
-
}
|
|
1976
|
-
convertAttributesToProperties(attributes) {
|
|
1977
|
-
const properties = {};
|
|
1978
|
-
Object.entries(attributes || {}).forEach(([key, value]) => {
|
|
1979
|
-
properties[key] = String(value);
|
|
1980
|
-
});
|
|
1981
|
-
return properties;
|
|
1982
|
-
}
|
|
1983
|
-
async sendToApplicationInsights(payload) {
|
|
1984
|
-
try {
|
|
1985
|
-
const ingestionEndpoint = this.extractIngestionEndpoint();
|
|
1986
|
-
if (!ingestionEndpoint) {
|
|
1987
|
-
console.debug('No ingestion endpoint found in connection string');
|
|
1988
|
-
return;
|
|
1989
|
-
}
|
|
1990
|
-
const url = `${ingestionEndpoint}/v2/track`;
|
|
1991
|
-
const response = await fetch(url, {
|
|
1992
|
-
method: 'POST',
|
|
1993
|
-
headers: {
|
|
1994
|
-
'Content-Type': 'application/json',
|
|
1995
|
-
},
|
|
1996
|
-
body: JSON.stringify(payload)
|
|
1997
|
-
});
|
|
1998
|
-
if (!response.ok) {
|
|
1999
|
-
console.debug(`Failed to send event telemetry: ${response.status} ${response.statusText}`);
|
|
2000
|
-
}
|
|
2001
|
-
}
|
|
2002
|
-
catch (error) {
|
|
2003
|
-
console.debug('Error sending event telemetry to Application Insights:', error);
|
|
2004
|
-
}
|
|
2005
|
-
}
|
|
2006
|
-
extractIngestionEndpoint() {
|
|
2007
|
-
const match = this.connectionString.match(/IngestionEndpoint=([^;]+)/);
|
|
2008
|
-
return match ? match[1] : '';
|
|
2009
|
-
}
|
|
2010
|
-
}
|
|
2011
|
-
/**
|
|
2012
|
-
* Singleton telemetry client
|
|
2013
|
-
*/
|
|
2014
|
-
class TelemetryClient {
|
|
2015
|
-
constructor() {
|
|
2016
|
-
this.isInitialized = false;
|
|
2017
|
-
}
|
|
2018
|
-
static getInstance() {
|
|
2019
|
-
if (!TelemetryClient.instance) {
|
|
2020
|
-
TelemetryClient.instance = new TelemetryClient();
|
|
2021
|
-
}
|
|
2022
|
-
return TelemetryClient.instance;
|
|
2023
|
-
}
|
|
2024
|
-
/**
|
|
2025
|
-
* Initialize telemetry
|
|
2026
|
-
*/
|
|
2027
|
-
initialize(config) {
|
|
2028
|
-
if (this.isInitialized) {
|
|
2029
|
-
return;
|
|
2030
|
-
}
|
|
2031
|
-
this.isInitialized = true;
|
|
2032
|
-
if (config) {
|
|
2033
|
-
this.telemetryContext = config;
|
|
2034
|
-
}
|
|
2035
|
-
try {
|
|
2036
|
-
const connectionString = this.getConnectionString();
|
|
2037
|
-
if (!connectionString) {
|
|
2038
|
-
return;
|
|
2039
|
-
}
|
|
2040
|
-
this.setupTelemetryProvider(connectionString);
|
|
2041
|
-
}
|
|
2042
|
-
catch (error) {
|
|
2043
|
-
// Silent failure - telemetry errors shouldn't break functionality
|
|
2044
|
-
console.debug('Failed to initialize OpenTelemetry:', error);
|
|
2045
|
-
}
|
|
2046
|
-
}
|
|
2047
|
-
getConnectionString() {
|
|
2048
|
-
const connectionString = CONNECTION_STRING;
|
|
2049
|
-
return connectionString;
|
|
2050
|
-
}
|
|
2051
|
-
setupTelemetryProvider(connectionString) {
|
|
2052
|
-
const exporter = new ApplicationInsightsEventExporter(connectionString);
|
|
2053
|
-
const processor = new sdkLogs.BatchLogRecordProcessor(exporter);
|
|
2054
|
-
this.logProvider = new sdkLogs.LoggerProvider({
|
|
2055
|
-
processors: [processor]
|
|
2056
|
-
});
|
|
2057
|
-
this.logger = this.logProvider.getLogger(SDK_LOGGER_NAME);
|
|
2058
|
-
}
|
|
2059
|
-
/**
|
|
2060
|
-
* Track a telemetry event
|
|
2061
|
-
*/
|
|
2062
|
-
track(eventName, name, extraAttributes = {}) {
|
|
2063
|
-
try {
|
|
2064
|
-
// Skip if logger not initialized
|
|
2065
|
-
if (!this.logger) {
|
|
2066
|
-
return;
|
|
2067
|
-
}
|
|
2068
|
-
const finalDisplayName = name || eventName;
|
|
2069
|
-
const attributes = this.getEnrichedAttributes(extraAttributes, eventName);
|
|
2070
|
-
// Emit as log
|
|
2071
|
-
this.logger.emit({
|
|
2072
|
-
body: finalDisplayName,
|
|
2073
|
-
attributes: attributes,
|
|
2074
|
-
timestamp: Date.now(),
|
|
2075
|
-
});
|
|
2076
|
-
}
|
|
2077
|
-
catch (error) {
|
|
2078
|
-
// Silent failure
|
|
2079
|
-
console.debug('Failed to track telemetry event:', error);
|
|
2080
|
-
}
|
|
2081
|
-
}
|
|
2082
|
-
/**
|
|
2083
|
-
* Get enriched attributes for telemetry events
|
|
2084
|
-
*/
|
|
2085
|
-
getEnrichedAttributes(extraAttributes, eventName) {
|
|
2086
|
-
const attributes = {
|
|
2087
|
-
[APP_NAME]: SDK_SERVICE_NAME,
|
|
2088
|
-
[VERSION]: SDK_VERSION,
|
|
2089
|
-
[SERVICE]: eventName,
|
|
2090
|
-
[CLOUD_URL]: this.createCloudUrl(),
|
|
2091
|
-
[CLOUD_ORGANIZATION_NAME]: this.telemetryContext?.orgName || UNKNOWN,
|
|
2092
|
-
[CLOUD_TENANT_NAME]: this.telemetryContext?.tenantName || UNKNOWN,
|
|
2093
|
-
[CLOUD_REDIRECT_URI]: this.telemetryContext?.redirectUri || UNKNOWN,
|
|
2094
|
-
[CLOUD_CLIENT_ID]: this.telemetryContext?.clientId || UNKNOWN,
|
|
2095
|
-
...extraAttributes,
|
|
2096
|
-
};
|
|
2097
|
-
return attributes;
|
|
2098
|
-
}
|
|
2099
|
-
/**
|
|
2100
|
-
* Create cloud URL from base URL, organization ID, and tenant ID
|
|
2101
|
-
*/
|
|
2102
|
-
createCloudUrl() {
|
|
2103
|
-
const baseUrl = this.telemetryContext?.baseUrl;
|
|
2104
|
-
const orgId = this.telemetryContext?.orgName;
|
|
2105
|
-
const tenantId = this.telemetryContext?.tenantName;
|
|
2106
|
-
if (!baseUrl || !orgId || !tenantId) {
|
|
2107
|
-
return UNKNOWN;
|
|
2108
|
-
}
|
|
2109
|
-
return `${baseUrl}/${orgId}/${tenantId}`;
|
|
2110
|
-
}
|
|
2111
|
-
}
|
|
2112
|
-
// Export singleton instance
|
|
2113
|
-
const telemetryClient = TelemetryClient.getInstance();
|
|
1962
|
+
* SDK Telemetry constants.
|
|
1963
|
+
*
|
|
1964
|
+
* Only the SDK's identity (version, service name, role name, …) lives
|
|
1965
|
+
* here. The Application Insights connection string is injected into
|
|
1966
|
+
* `@uipath/core-telemetry` itself at publish time, and the generic attribute
|
|
1967
|
+
* keys (`Version`, `Service`, `CloudOrganizationName`, …) are owned by
|
|
1968
|
+
* `@uipath/core-telemetry` and consumed there — they are not part of the
|
|
1969
|
+
* SDK's public API.
|
|
1970
|
+
*/
|
|
1971
|
+
/** SDK version placeholder — patched by the SDK publish workflow. */
|
|
1972
|
+
const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
|
|
2114
1973
|
|
|
2115
1974
|
/**
|
|
2116
|
-
*
|
|
2117
|
-
*/
|
|
2118
|
-
/**
|
|
2119
|
-
* Common tracking logic shared between method and function decorators
|
|
2120
|
-
*/
|
|
2121
|
-
function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, opts) {
|
|
2122
|
-
return function (...args) {
|
|
2123
|
-
// Determine if we should track this call
|
|
2124
|
-
let shouldTrack = true;
|
|
2125
|
-
if (opts.condition !== undefined) {
|
|
2126
|
-
if (typeof opts.condition === 'function') {
|
|
2127
|
-
shouldTrack = opts.condition.apply(this, args);
|
|
2128
|
-
}
|
|
2129
|
-
else {
|
|
2130
|
-
shouldTrack = opts.condition;
|
|
2131
|
-
}
|
|
2132
|
-
}
|
|
2133
|
-
// Track the event if enabled
|
|
2134
|
-
if (shouldTrack) {
|
|
2135
|
-
// Use the full name provided in the decorator (e.g., "Queue.GetAll")
|
|
2136
|
-
const serviceMethod = typeof nameOrOptions === 'string'
|
|
2137
|
-
? nameOrOptions
|
|
2138
|
-
: fallbackName;
|
|
2139
|
-
// Use 'Sdk.Run' as the name and serviceMethod as the service
|
|
2140
|
-
telemetryClient.track(serviceMethod, SDK_RUN_EVENT, opts.attributes);
|
|
2141
|
-
}
|
|
2142
|
-
// Execute the original function
|
|
2143
|
-
return originalFunction.apply(this, args);
|
|
2144
|
-
};
|
|
2145
|
-
}
|
|
2146
|
-
/**
|
|
2147
|
-
* Track decorator that can be used to automatically track function calls
|
|
1975
|
+
* UiPath TypeScript SDK Telemetry
|
|
2148
1976
|
*
|
|
2149
|
-
*
|
|
2150
|
-
*
|
|
2151
|
-
*
|
|
2152
|
-
*
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
*
|
|
2162
|
-
* @track("Processes.Start", { attributes: { customProp: "value" } })
|
|
2163
|
-
* function myFunction() { ... }
|
|
2164
|
-
*/
|
|
2165
|
-
function track(nameOrOptions, options) {
|
|
2166
|
-
return function decorator(_target, propertyKey, descriptor) {
|
|
2167
|
-
const opts = typeof nameOrOptions === 'object' ? nameOrOptions : {};
|
|
2168
|
-
if (descriptor && typeof descriptor.value === 'function') {
|
|
2169
|
-
// Method decorator
|
|
2170
|
-
descriptor.value = createTrackedFunction(descriptor.value, nameOrOptions, propertyKey || 'unknown_method', opts);
|
|
2171
|
-
return descriptor;
|
|
2172
|
-
}
|
|
2173
|
-
// Function decorator
|
|
2174
|
-
return (originalFunction) => createTrackedFunction(originalFunction, nameOrOptions, originalFunction.name || 'unknown_function', opts);
|
|
2175
|
-
};
|
|
2176
|
-
}
|
|
1977
|
+
* Constructs the SDK's own `TelemetryClient` and binds the SDK-local
|
|
1978
|
+
* `track` / `trackEvent` to it. Each consumer of `@uipath/core-telemetry`
|
|
1979
|
+
* does this independently, so events carry their own consumer's identity
|
|
1980
|
+
* and tenant context.
|
|
1981
|
+
*/
|
|
1982
|
+
// Keyed by `CLOUD_ROLE_NAME` so every SDK subpath bundle resolves to the
|
|
1983
|
+
// same `TelemetryClient` instance at runtime. A single `initialize(...)`
|
|
1984
|
+
// from the `UiPath` constructor therefore wires up `@track` decorators
|
|
1985
|
+
// across every subpath bundle (`assets`, `feedback`, `tasks`, …).
|
|
1986
|
+
const sdkClient = coreTelemetry.getOrCreateClient(CLOUD_ROLE_NAME);
|
|
1987
|
+
const track = coreTelemetry.createTrack(sdkClient);
|
|
1988
|
+
coreTelemetry.createTrackEvent(sdkClient);
|
|
2177
1989
|
|
|
2178
1990
|
/**
|
|
2179
1991
|
* Creates query parameters object from key-value pairs, filtering out undefined values
|
|
@@ -2245,6 +2057,177 @@ class CasesService extends BaseService {
|
|
|
2245
2057
|
name: this.extractCaseName(caseItem.packageId)
|
|
2246
2058
|
}));
|
|
2247
2059
|
}
|
|
2060
|
+
/**
|
|
2061
|
+
* Get the top 5 case processes ranked by run count within a time range.
|
|
2062
|
+
*
|
|
2063
|
+
* Returns an array of up to 5 case processes sorted by how many times they were executed,
|
|
2064
|
+
* useful for identifying the most active case processes in a given period.
|
|
2065
|
+
*
|
|
2066
|
+
* @param startTime - Start of the time range to query
|
|
2067
|
+
* @param endTime - End of the time range to query
|
|
2068
|
+
* @param options - Optional filters (packageId, processKey, version)
|
|
2069
|
+
* @returns Promise resolving to an array of {@link CaseGetTopRunCountResponse}
|
|
2070
|
+
* @example
|
|
2071
|
+
* ```typescript
|
|
2072
|
+
* import { Cases } from '@uipath/uipath-typescript/cases';
|
|
2073
|
+
*
|
|
2074
|
+
* const cases = new Cases(sdk);
|
|
2075
|
+
*
|
|
2076
|
+
* // Get top case processes by run count for the last 7 days
|
|
2077
|
+
* const topProcesses = await cases.getTopRunCount(
|
|
2078
|
+
* new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
|
|
2079
|
+
* new Date()
|
|
2080
|
+
* );
|
|
2081
|
+
*
|
|
2082
|
+
* for (const process of topProcesses) {
|
|
2083
|
+
* console.log(`${process.packageId}: ${process.runCount} runs`);
|
|
2084
|
+
* }
|
|
2085
|
+
* ```
|
|
2086
|
+
*
|
|
2087
|
+
* @example
|
|
2088
|
+
* ```typescript
|
|
2089
|
+
* // Get top case processes by run count for a specific package
|
|
2090
|
+
* const filtered = await cases.getTopRunCount(
|
|
2091
|
+
* new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
|
|
2092
|
+
* new Date(),
|
|
2093
|
+
* { packageId: '<packageId>' }
|
|
2094
|
+
* );
|
|
2095
|
+
* ```
|
|
2096
|
+
*/
|
|
2097
|
+
async getTopRunCount(startTime, endTime, options) {
|
|
2098
|
+
const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_RUN_COUNT, buildInsightsTopBody(startTime, endTime, true, options));
|
|
2099
|
+
return (data ?? []).map(process => ({ ...process, name: this.extractCaseName(process.packageId) }));
|
|
2100
|
+
}
|
|
2101
|
+
/**
|
|
2102
|
+
* Get all instances status counts aggregated by date for case management processes.
|
|
2103
|
+
*
|
|
2104
|
+
* Returns time-grouped counts of case instances grouped by status (Completed, Faulted, Cancelled),
|
|
2105
|
+
* useful for rendering time-series charts. Use `groupBy` to control the time bucket size
|
|
2106
|
+
* (hour, day, or week) — defaults to day if not provided.
|
|
2107
|
+
*
|
|
2108
|
+
* @param startTime - Start of the time range to query
|
|
2109
|
+
* @param endTime - End of the time range to query
|
|
2110
|
+
* @param options - Optional settings for time bucketing granularity
|
|
2111
|
+
* @returns Promise resolving to an array of {@link InstanceStatusTimelineResponse}
|
|
2112
|
+
*
|
|
2113
|
+
* @example
|
|
2114
|
+
* ```typescript
|
|
2115
|
+
* // Get daily instance status for the last 7 days
|
|
2116
|
+
* const now = new Date();
|
|
2117
|
+
* const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
|
|
2118
|
+
* const statuses = await cases.getInstanceStatusTimeline(sevenDaysAgo, now);
|
|
2119
|
+
*
|
|
2120
|
+
* for (const entry of statuses) {
|
|
2121
|
+
* console.log(`${entry.startTime} — ${entry.status}: ${entry.count}`);
|
|
2122
|
+
* }
|
|
2123
|
+
* ```
|
|
2124
|
+
*
|
|
2125
|
+
* @example
|
|
2126
|
+
* ```typescript
|
|
2127
|
+
* import { TimeInterval } from '@uipath/uipath-typescript/cases';
|
|
2128
|
+
*
|
|
2129
|
+
* // Get weekly breakdown
|
|
2130
|
+
* const statuses = await cases.getInstanceStatusTimeline(startTime, endTime, {
|
|
2131
|
+
* groupBy: TimeInterval.Week,
|
|
2132
|
+
* });
|
|
2133
|
+
* ```
|
|
2134
|
+
*
|
|
2135
|
+
* @example
|
|
2136
|
+
* ```typescript
|
|
2137
|
+
* // Get all-time data (from Unix epoch to now)
|
|
2138
|
+
* const allTime = await cases.getInstanceStatusTimeline(new Date(0), new Date());
|
|
2139
|
+
* ```
|
|
2140
|
+
*/
|
|
2141
|
+
async getInstanceStatusTimeline(startTime, endTime, options) {
|
|
2142
|
+
return fetchInstanceStatusTimeline(this.post.bind(this), startTime, endTime, true, options);
|
|
2143
|
+
}
|
|
2144
|
+
/**
|
|
2145
|
+
* Get the top 10 case processes ranked by failure count within a time range.
|
|
2146
|
+
*
|
|
2147
|
+
* Returns an array of up to 10 case processes sorted by how many instances faulted,
|
|
2148
|
+
* useful for identifying the most error-prone case processes in a given period.
|
|
2149
|
+
*
|
|
2150
|
+
* @param startTime - Start of the time range to query
|
|
2151
|
+
* @param endTime - End of the time range to query
|
|
2152
|
+
* @param options - Optional filters (packageId, processKey, version)
|
|
2153
|
+
* @returns Promise resolving to an array of {@link CaseGetTopFaultedCountResponse}
|
|
2154
|
+
* @example
|
|
2155
|
+
* ```typescript
|
|
2156
|
+
* import { Cases } from '@uipath/uipath-typescript/cases';
|
|
2157
|
+
*
|
|
2158
|
+
* const cases = new Cases(sdk);
|
|
2159
|
+
*
|
|
2160
|
+
* // Get top case processes by faulted count for the last 7 days
|
|
2161
|
+
* const topFailing = await cases.getTopFaultedCount(
|
|
2162
|
+
* new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
|
|
2163
|
+
* new Date()
|
|
2164
|
+
* );
|
|
2165
|
+
*
|
|
2166
|
+
* for (const process of topFailing) {
|
|
2167
|
+
* console.log(`${process.packageId}: ${process.faultedCount} failures`);
|
|
2168
|
+
* }
|
|
2169
|
+
* ```
|
|
2170
|
+
*
|
|
2171
|
+
* @example
|
|
2172
|
+
* ```typescript
|
|
2173
|
+
* // Get top case processes by faulted count for a specific package
|
|
2174
|
+
* const filtered = await cases.getTopFaultedCount(
|
|
2175
|
+
* new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
|
|
2176
|
+
* new Date(),
|
|
2177
|
+
* { packageId: '<packageId>' }
|
|
2178
|
+
* );
|
|
2179
|
+
* ```
|
|
2180
|
+
*/
|
|
2181
|
+
async getTopFaultedCount(startTime, endTime, options) {
|
|
2182
|
+
const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_WITH_FAILURE, buildInsightsTopBody(startTime, endTime, true, options));
|
|
2183
|
+
return (data ?? []).map(item => ({
|
|
2184
|
+
packageId: item.packageId,
|
|
2185
|
+
processKey: item.processKey,
|
|
2186
|
+
faultedCount: item.runCount,
|
|
2187
|
+
name: this.extractCaseName(item.packageId),
|
|
2188
|
+
}));
|
|
2189
|
+
}
|
|
2190
|
+
/**
|
|
2191
|
+
* Get the top 5 case processes ranked by total duration within a time range.
|
|
2192
|
+
*
|
|
2193
|
+
* Returns an array of up to 5 case processes sorted by their total execution time,
|
|
2194
|
+
* useful for identifying the longest-running case processes in a given period.
|
|
2195
|
+
*
|
|
2196
|
+
* @param startTime - Start of the time range to query
|
|
2197
|
+
* @param endTime - End of the time range to query
|
|
2198
|
+
* @param options - Optional filters (packageId, processKey, version)
|
|
2199
|
+
* @returns Promise resolving to an array of {@link CaseGetTopDurationResponse}
|
|
2200
|
+
* @example
|
|
2201
|
+
* ```typescript
|
|
2202
|
+
* import { Cases } from '@uipath/uipath-typescript/cases';
|
|
2203
|
+
*
|
|
2204
|
+
* const cases = new Cases(sdk);
|
|
2205
|
+
*
|
|
2206
|
+
* // Get top case processes by duration for the last 7 days
|
|
2207
|
+
* const topProcesses = await cases.getTopExecutionDuration(
|
|
2208
|
+
* new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
|
|
2209
|
+
* new Date()
|
|
2210
|
+
* );
|
|
2211
|
+
*
|
|
2212
|
+
* for (const process of topProcesses) {
|
|
2213
|
+
* console.log(`${process.packageId}: ${process.duration}ms total`);
|
|
2214
|
+
* }
|
|
2215
|
+
* ```
|
|
2216
|
+
*
|
|
2217
|
+
* @example
|
|
2218
|
+
* ```typescript
|
|
2219
|
+
* // Get top case processes by duration for a specific package
|
|
2220
|
+
* const filtered = await cases.getTopExecutionDuration(
|
|
2221
|
+
* new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
|
|
2222
|
+
* new Date(),
|
|
2223
|
+
* { packageId: '<packageId>' }
|
|
2224
|
+
* );
|
|
2225
|
+
* ```
|
|
2226
|
+
*/
|
|
2227
|
+
async getTopExecutionDuration(startTime, endTime, options) {
|
|
2228
|
+
const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_DURATION, buildInsightsTopBody(startTime, endTime, true, options));
|
|
2229
|
+
return (data ?? []).map(process => ({ ...process, name: this.extractCaseName(process.packageId) }));
|
|
2230
|
+
}
|
|
2248
2231
|
/**
|
|
2249
2232
|
* Extract a readable case name from the packageId
|
|
2250
2233
|
* @param packageId - The full package identifier
|
|
@@ -2267,6 +2250,18 @@ class CasesService extends BaseService {
|
|
|
2267
2250
|
__decorate([
|
|
2268
2251
|
track('Cases.GetAll')
|
|
2269
2252
|
], CasesService.prototype, "getAll", null);
|
|
2253
|
+
__decorate([
|
|
2254
|
+
track('Cases.GetTopRunCount')
|
|
2255
|
+
], CasesService.prototype, "getTopRunCount", null);
|
|
2256
|
+
__decorate([
|
|
2257
|
+
track('Cases.GetInstanceStatusTimeline')
|
|
2258
|
+
], CasesService.prototype, "getInstanceStatusTimeline", null);
|
|
2259
|
+
__decorate([
|
|
2260
|
+
track('Cases.GetTopFaultedCount')
|
|
2261
|
+
], CasesService.prototype, "getTopFaultedCount", null);
|
|
2262
|
+
__decorate([
|
|
2263
|
+
track('Cases.GetTopExecutionDuration')
|
|
2264
|
+
], CasesService.prototype, "getTopExecutionDuration", null);
|
|
2270
2265
|
|
|
2271
2266
|
/**
|
|
2272
2267
|
* Process Incident Status
|
|
@@ -2451,6 +2446,11 @@ function createCaseInstanceMethods(instanceData, service) {
|
|
|
2451
2446
|
if (!instanceData.instanceId)
|
|
2452
2447
|
throw new Error('Case instance ID is undefined');
|
|
2453
2448
|
return service.getSlaSummary({ ...options, caseInstanceId: instanceData.instanceId });
|
|
2449
|
+
},
|
|
2450
|
+
async getStagesSlaSummary() {
|
|
2451
|
+
if (!instanceData.instanceId)
|
|
2452
|
+
throw new Error('Case instance ID is undefined');
|
|
2453
|
+
return service.getStagesSlaSummary({ caseInstanceId: instanceData.instanceId });
|
|
2454
2454
|
}
|
|
2455
2455
|
};
|
|
2456
2456
|
}
|
|
@@ -2466,6 +2466,40 @@ function createCaseInstanceWithMethods(instanceData, service) {
|
|
|
2466
2466
|
return Object.assign({}, instanceData, methods);
|
|
2467
2467
|
}
|
|
2468
2468
|
|
|
2469
|
+
/**
|
|
2470
|
+
* Insights Types
|
|
2471
|
+
* Shared types for Maestro insights analytics endpoints
|
|
2472
|
+
*/
|
|
2473
|
+
/**
|
|
2474
|
+
* Time bucketing granularity for insights time-series queries.
|
|
2475
|
+
*
|
|
2476
|
+
* Controls how data points are grouped on the time axis.
|
|
2477
|
+
*/
|
|
2478
|
+
exports.TimeInterval = void 0;
|
|
2479
|
+
(function (TimeInterval) {
|
|
2480
|
+
/** Group data points by hour */
|
|
2481
|
+
TimeInterval["Hour"] = "HOUR";
|
|
2482
|
+
/** Group data points by day */
|
|
2483
|
+
TimeInterval["Day"] = "DAY";
|
|
2484
|
+
/** Group data points by week */
|
|
2485
|
+
TimeInterval["Week"] = "WEEK";
|
|
2486
|
+
})(exports.TimeInterval || (exports.TimeInterval = {}));
|
|
2487
|
+
/**
|
|
2488
|
+
* Final instance statuses returned by the instance status timeline endpoint.
|
|
2489
|
+
*
|
|
2490
|
+
* Only includes statuses where the instance has finished execution — Completed, Faulted, or Cancelled.
|
|
2491
|
+
* Active statuses like Running or Paused are not included.
|
|
2492
|
+
*/
|
|
2493
|
+
exports.InstanceFinalStatus = void 0;
|
|
2494
|
+
(function (InstanceFinalStatus) {
|
|
2495
|
+
/** Instance completed successfully */
|
|
2496
|
+
InstanceFinalStatus["Completed"] = "Completed";
|
|
2497
|
+
/** Instance encountered an error */
|
|
2498
|
+
InstanceFinalStatus["Faulted"] = "Faulted";
|
|
2499
|
+
/** Instance was cancelled */
|
|
2500
|
+
InstanceFinalStatus["Cancelled"] = "Cancelled";
|
|
2501
|
+
})(exports.InstanceFinalStatus || (exports.InstanceFinalStatus = {}));
|
|
2502
|
+
|
|
2469
2503
|
/**
|
|
2470
2504
|
* Maps fields for Case Instance entities to ensure consistent naming
|
|
2471
2505
|
*/
|
|
@@ -3680,6 +3714,40 @@ class CaseInstancesService extends BaseService {
|
|
|
3680
3714
|
}
|
|
3681
3715
|
}, apiOptions);
|
|
3682
3716
|
}
|
|
3717
|
+
/**
|
|
3718
|
+
* Get stages SLA summary for case instances across folders.
|
|
3719
|
+
*
|
|
3720
|
+
* Returns stage-level SLA status and escalation information for each case instance, aggregated from Insights Real-Time Monitoring.
|
|
3721
|
+
*
|
|
3722
|
+
* @param options - Optional filtering options
|
|
3723
|
+
* @returns Promise resolving to an array of {@link CaseInstanceStageSLAResponse}
|
|
3724
|
+
* @example
|
|
3725
|
+
* ```typescript
|
|
3726
|
+
* // Get stages SLA summary for all case instances
|
|
3727
|
+
* const stagesSla = await caseInstances.getStagesSlaSummary();
|
|
3728
|
+
* for (const item of stagesSla) {
|
|
3729
|
+
* console.log(`Instance: ${item.caseInstanceId}`);
|
|
3730
|
+
* for (const stage of item.stages) {
|
|
3731
|
+
* console.log(` Stage: ${stage.name} - SLA Status: ${stage.slaStatus}, Due: ${stage.slaDueTime}`);
|
|
3732
|
+
* }
|
|
3733
|
+
* }
|
|
3734
|
+
*
|
|
3735
|
+
* // Filter by case instance ID
|
|
3736
|
+
* const filtered = await caseInstances.getStagesSlaSummary({
|
|
3737
|
+
* caseInstanceId: '<caseInstanceId>'
|
|
3738
|
+
* });
|
|
3739
|
+
*
|
|
3740
|
+
* // Using bound method on a case instance
|
|
3741
|
+
* const instance = await caseInstances.getById('<instanceId>', '<folderKey>');
|
|
3742
|
+
* const stagesSla = await instance.getStagesSlaSummary();
|
|
3743
|
+
* ```
|
|
3744
|
+
*/
|
|
3745
|
+
async getStagesSlaSummary(options) {
|
|
3746
|
+
const response = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.STAGES_SUMMARY, {
|
|
3747
|
+
caseInstanceId: options?.caseInstanceId,
|
|
3748
|
+
});
|
|
3749
|
+
return response.data ?? [];
|
|
3750
|
+
}
|
|
3683
3751
|
}
|
|
3684
3752
|
__decorate([
|
|
3685
3753
|
track('CaseInstances.GetAll')
|
|
@@ -3711,6 +3779,9 @@ __decorate([
|
|
|
3711
3779
|
__decorate([
|
|
3712
3780
|
track('CaseInstances.GetSlaSummary')
|
|
3713
3781
|
], CaseInstancesService.prototype, "getSlaSummary", null);
|
|
3782
|
+
__decorate([
|
|
3783
|
+
track('CaseInstances.GetStagesSlaSummary')
|
|
3784
|
+
], CaseInstancesService.prototype, "getStagesSlaSummary", null);
|
|
3714
3785
|
|
|
3715
3786
|
exports.CaseInstances = CaseInstancesService;
|
|
3716
3787
|
exports.CaseInstancesService = CaseInstancesService;
|