@uipath/uipath-typescript 1.3.2 → 1.3.4
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 +21 -8
- package/dist/assets/index.mjs +21 -8
- package/dist/attachments/index.cjs +21 -8
- package/dist/attachments/index.mjs +21 -8
- package/dist/buckets/index.cjs +21 -8
- package/dist/buckets/index.mjs +21 -8
- package/dist/cases/index.cjs +41 -13
- package/dist/cases/index.d.ts +15 -0
- package/dist/cases/index.mjs +41 -13
- package/dist/conversational-agent/index.cjs +39 -8
- package/dist/conversational-agent/index.d.ts +55 -2
- package/dist/conversational-agent/index.mjs +39 -8
- package/dist/core/index.cjs +16 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.mjs +16 -1
- package/dist/entities/index.cjs +55 -8
- package/dist/entities/index.d.ts +54 -0
- package/dist/entities/index.mjs +55 -8
- package/dist/feedback/index.cjs +1911 -0
- package/dist/feedback/index.d.ts +475 -0
- package/dist/feedback/index.mjs +1909 -0
- package/dist/index.cjs +451 -189
- package/dist/index.d.ts +388 -13
- package/dist/index.mjs +452 -190
- package/dist/index.umd.js +451 -189
- package/dist/jobs/index.cjs +384 -8
- package/dist/jobs/index.d.ts +220 -2
- package/dist/jobs/index.mjs +385 -9
- package/dist/maestro-processes/index.cjs +21 -8
- package/dist/maestro-processes/index.mjs +21 -8
- package/dist/processes/index.cjs +21 -8
- package/dist/processes/index.mjs +21 -8
- package/dist/queues/index.cjs +21 -8
- package/dist/queues/index.mjs +21 -8
- package/dist/tasks/index.cjs +41 -13
- package/dist/tasks/index.d.ts +25 -10
- package/dist/tasks/index.mjs +42 -14
- package/package.json +13 -2
package/dist/jobs/index.mjs
CHANGED
|
@@ -504,6 +504,8 @@ class ErrorFactory {
|
|
|
504
504
|
}
|
|
505
505
|
|
|
506
506
|
const FOLDER_ID = 'X-UIPATH-OrganizationUnitId';
|
|
507
|
+
const TRACEPARENT = 'traceparent';
|
|
508
|
+
const UIPATH_TRACEPARENT_ID = 'x-uipath-traceparent-id';
|
|
507
509
|
/**
|
|
508
510
|
* Content type constants for HTTP requests/responses
|
|
509
511
|
*/
|
|
@@ -557,8 +559,13 @@ class ApiClient {
|
|
|
557
559
|
if (isFormData) {
|
|
558
560
|
delete defaultHeaders['Content-Type'];
|
|
559
561
|
}
|
|
562
|
+
const traceId = crypto.randomUUID().replace(/-/g, '');
|
|
563
|
+
const spanId = crypto.randomUUID().replace(/-/g, '').slice(0, 16);
|
|
564
|
+
const traceparentValue = `00-${traceId}-${spanId}-01`;
|
|
560
565
|
const headers = {
|
|
561
566
|
...defaultHeaders,
|
|
567
|
+
[TRACEPARENT]: traceparentValue,
|
|
568
|
+
[UIPATH_TRACEPARENT_ID]: traceparentValue,
|
|
562
569
|
...options.headers
|
|
563
570
|
};
|
|
564
571
|
// Convert params to URLSearchParams
|
|
@@ -598,7 +605,11 @@ class ApiClient {
|
|
|
598
605
|
const text = await response.text();
|
|
599
606
|
return text;
|
|
600
607
|
}
|
|
601
|
-
|
|
608
|
+
const text = await response.text();
|
|
609
|
+
if (!text) {
|
|
610
|
+
return undefined;
|
|
611
|
+
}
|
|
612
|
+
return JSON.parse(text);
|
|
602
613
|
}
|
|
603
614
|
catch (error) {
|
|
604
615
|
// If it's already one of our errors, re-throw it
|
|
@@ -1230,8 +1241,9 @@ class PaginationHelpers {
|
|
|
1230
1241
|
});
|
|
1231
1242
|
}
|
|
1232
1243
|
// Extract and transform items from response
|
|
1233
|
-
|
|
1234
|
-
const
|
|
1244
|
+
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1245
|
+
const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
|
|
1246
|
+
const totalCount = Array.isArray(response.data) ? undefined : response.data?.[totalCountField];
|
|
1235
1247
|
// Parse items - automatically handle JSON string responses
|
|
1236
1248
|
const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
|
|
1237
1249
|
const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
|
|
@@ -1482,7 +1494,7 @@ class BaseService {
|
|
|
1482
1494
|
const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
|
|
1483
1495
|
// Prepare request parameters based on pagination type
|
|
1484
1496
|
const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
|
|
1485
|
-
// For POST requests, merge pagination params into body; for GET, use query params
|
|
1497
|
+
// For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
|
|
1486
1498
|
if (method.toUpperCase() === 'POST') {
|
|
1487
1499
|
const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
|
|
1488
1500
|
options.body = {
|
|
@@ -1490,6 +1502,7 @@ class BaseService {
|
|
|
1490
1502
|
...options.params,
|
|
1491
1503
|
...requestParams
|
|
1492
1504
|
};
|
|
1505
|
+
options.params = undefined;
|
|
1493
1506
|
}
|
|
1494
1507
|
else {
|
|
1495
1508
|
// Merge pagination parameters with existing parameters
|
|
@@ -1530,7 +1543,6 @@ class BaseService {
|
|
|
1530
1543
|
if (params.pageNumber && params.pageNumber > 1) {
|
|
1531
1544
|
requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
|
|
1532
1545
|
}
|
|
1533
|
-
// Include total count for ODATA APIs
|
|
1534
1546
|
{
|
|
1535
1547
|
requestParams[countParam] = true;
|
|
1536
1548
|
}
|
|
@@ -1558,8 +1570,9 @@ class BaseService {
|
|
|
1558
1570
|
const totalCountField = fields.totalCountField || 'totalRecordCount';
|
|
1559
1571
|
const continuationTokenField = fields.continuationTokenField || 'continuationToken';
|
|
1560
1572
|
// Extract items and metadata
|
|
1561
|
-
|
|
1562
|
-
const
|
|
1573
|
+
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1574
|
+
const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
|
|
1575
|
+
const totalCount = Array.isArray(response.data) ? undefined : response.data[totalCountField];
|
|
1563
1576
|
const continuationToken = response.data[continuationTokenField];
|
|
1564
1577
|
// Determine if there are more pages
|
|
1565
1578
|
const hasMore = this.determineHasMorePages(paginationType, {
|
|
@@ -1655,6 +1668,27 @@ function createJobMethods(jobData, service) {
|
|
|
1655
1668
|
throw new Error('Job folderId is undefined');
|
|
1656
1669
|
return service.getOutput(jobData.key, jobData.folderId);
|
|
1657
1670
|
},
|
|
1671
|
+
async stop(options) {
|
|
1672
|
+
if (!jobData.key)
|
|
1673
|
+
throw new Error('Job key is undefined');
|
|
1674
|
+
if (!jobData.folderId)
|
|
1675
|
+
throw new Error('Job folderId is undefined');
|
|
1676
|
+
return service.stop([jobData.key], jobData.folderId, options);
|
|
1677
|
+
},
|
|
1678
|
+
async resume(options) {
|
|
1679
|
+
if (!jobData.key)
|
|
1680
|
+
throw new Error('Job key is undefined');
|
|
1681
|
+
if (!jobData.folderId)
|
|
1682
|
+
throw new Error('Job folderId is undefined');
|
|
1683
|
+
return service.resume(jobData.key, jobData.folderId, options);
|
|
1684
|
+
},
|
|
1685
|
+
async restart() {
|
|
1686
|
+
if (!jobData.key)
|
|
1687
|
+
throw new Error('Job key is undefined');
|
|
1688
|
+
if (!jobData.folderId)
|
|
1689
|
+
throw new Error('Job folderId is undefined');
|
|
1690
|
+
return service.restart(jobData.key, jobData.folderId);
|
|
1691
|
+
},
|
|
1658
1692
|
};
|
|
1659
1693
|
}
|
|
1660
1694
|
/**
|
|
@@ -1683,6 +1717,9 @@ const ORCHESTRATOR_BASE = 'orchestrator_';
|
|
|
1683
1717
|
const JOB_ENDPOINTS = {
|
|
1684
1718
|
GET_ALL: `${ORCHESTRATOR_BASE}/odata/Jobs`,
|
|
1685
1719
|
GET_BY_KEY: (identifier) => `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.GetByKey(identifier=${identifier})`,
|
|
1720
|
+
STOP: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.StopJobs`,
|
|
1721
|
+
RESUME: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.ResumeJob`,
|
|
1722
|
+
RESTART: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.RestartJob`,
|
|
1686
1723
|
};
|
|
1687
1724
|
/**
|
|
1688
1725
|
* Orchestrator Attachment Service Endpoints
|
|
@@ -1691,6 +1728,8 @@ const ORCHESTRATOR_ATTACHMENT_ENDPOINTS = {
|
|
|
1691
1728
|
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Attachments(${id})`,
|
|
1692
1729
|
};
|
|
1693
1730
|
|
|
1731
|
+
/** Maximum number of job keys to resolve in a single OData filter query */
|
|
1732
|
+
const JOB_KEY_RESOLUTION_CHUNK_SIZE = 50;
|
|
1694
1733
|
/**
|
|
1695
1734
|
* Maps fields for Job entities to ensure consistent naming
|
|
1696
1735
|
* Semantic renames only — case conversion handled by pascalToCamelCaseKeys()
|
|
@@ -1712,7 +1751,7 @@ const JobMap = {
|
|
|
1712
1751
|
// Connection string placeholder that will be replaced during build
|
|
1713
1752
|
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";
|
|
1714
1753
|
// SDK Version placeholder
|
|
1715
|
-
const SDK_VERSION = "1.3.
|
|
1754
|
+
const SDK_VERSION = "1.3.4";
|
|
1716
1755
|
const VERSION = "Version";
|
|
1717
1756
|
const SERVICE = "Service";
|
|
1718
1757
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -2032,6 +2071,182 @@ __decorate([
|
|
|
2032
2071
|
track('Attachments.GetById')
|
|
2033
2072
|
], AttachmentService.prototype, "getById", null);
|
|
2034
2073
|
|
|
2074
|
+
/**
|
|
2075
|
+
* Enum for package types
|
|
2076
|
+
*/
|
|
2077
|
+
var PackageType;
|
|
2078
|
+
(function (PackageType) {
|
|
2079
|
+
PackageType["Undefined"] = "Undefined";
|
|
2080
|
+
PackageType["Process"] = "Process";
|
|
2081
|
+
PackageType["ProcessOrchestration"] = "ProcessOrchestration";
|
|
2082
|
+
PackageType["WebApp"] = "WebApp";
|
|
2083
|
+
PackageType["Agent"] = "Agent";
|
|
2084
|
+
PackageType["TestAutomationProcess"] = "TestAutomationProcess";
|
|
2085
|
+
PackageType["Api"] = "Api";
|
|
2086
|
+
PackageType["MCPServer"] = "MCPServer";
|
|
2087
|
+
PackageType["BusinessRules"] = "BusinessRules";
|
|
2088
|
+
PackageType["CaseManagement"] = "CaseManagement";
|
|
2089
|
+
PackageType["Flow"] = "Flow";
|
|
2090
|
+
PackageType["Function"] = "Function";
|
|
2091
|
+
})(PackageType || (PackageType = {}));
|
|
2092
|
+
/**
|
|
2093
|
+
* Enum for job priority
|
|
2094
|
+
*/
|
|
2095
|
+
var JobPriority;
|
|
2096
|
+
(function (JobPriority) {
|
|
2097
|
+
JobPriority["Low"] = "Low";
|
|
2098
|
+
JobPriority["Normal"] = "Normal";
|
|
2099
|
+
JobPriority["High"] = "High";
|
|
2100
|
+
})(JobPriority || (JobPriority = {}));
|
|
2101
|
+
/**
|
|
2102
|
+
* Enum for target framework
|
|
2103
|
+
*/
|
|
2104
|
+
var TargetFramework;
|
|
2105
|
+
(function (TargetFramework) {
|
|
2106
|
+
TargetFramework["Legacy"] = "Legacy";
|
|
2107
|
+
TargetFramework["Windows"] = "Windows";
|
|
2108
|
+
TargetFramework["Portable"] = "Portable";
|
|
2109
|
+
})(TargetFramework || (TargetFramework = {}));
|
|
2110
|
+
/**
|
|
2111
|
+
* Enum for robot size
|
|
2112
|
+
*/
|
|
2113
|
+
var RobotSize;
|
|
2114
|
+
(function (RobotSize) {
|
|
2115
|
+
RobotSize["Small"] = "Small";
|
|
2116
|
+
RobotSize["Standard"] = "Standard";
|
|
2117
|
+
RobotSize["Medium"] = "Medium";
|
|
2118
|
+
RobotSize["Large"] = "Large";
|
|
2119
|
+
})(RobotSize || (RobotSize = {}));
|
|
2120
|
+
/**
|
|
2121
|
+
* Enum for remote control access
|
|
2122
|
+
*/
|
|
2123
|
+
var RemoteControlAccess;
|
|
2124
|
+
(function (RemoteControlAccess) {
|
|
2125
|
+
RemoteControlAccess["None"] = "None";
|
|
2126
|
+
RemoteControlAccess["ReadOnly"] = "ReadOnly";
|
|
2127
|
+
RemoteControlAccess["Full"] = "Full";
|
|
2128
|
+
})(RemoteControlAccess || (RemoteControlAccess = {}));
|
|
2129
|
+
/**
|
|
2130
|
+
* Enum for process start strategy
|
|
2131
|
+
*/
|
|
2132
|
+
var StartStrategy;
|
|
2133
|
+
(function (StartStrategy) {
|
|
2134
|
+
StartStrategy["All"] = "All";
|
|
2135
|
+
StartStrategy["Specific"] = "Specific";
|
|
2136
|
+
StartStrategy["RobotCount"] = "RobotCount";
|
|
2137
|
+
StartStrategy["JobsCount"] = "JobsCount";
|
|
2138
|
+
StartStrategy["ModernJobsCount"] = "ModernJobsCount";
|
|
2139
|
+
})(StartStrategy || (StartStrategy = {}));
|
|
2140
|
+
/**
|
|
2141
|
+
* Enum for package source type
|
|
2142
|
+
*/
|
|
2143
|
+
var PackageSourceType;
|
|
2144
|
+
(function (PackageSourceType) {
|
|
2145
|
+
PackageSourceType["Manual"] = "Manual";
|
|
2146
|
+
PackageSourceType["Schedule"] = "Schedule";
|
|
2147
|
+
PackageSourceType["Queue"] = "Queue";
|
|
2148
|
+
PackageSourceType["StudioWeb"] = "StudioWeb";
|
|
2149
|
+
PackageSourceType["IntegrationTrigger"] = "IntegrationTrigger";
|
|
2150
|
+
PackageSourceType["StudioDesktop"] = "StudioDesktop";
|
|
2151
|
+
PackageSourceType["AutomationOpsPipelines"] = "AutomationOpsPipelines";
|
|
2152
|
+
PackageSourceType["Apps"] = "Apps";
|
|
2153
|
+
PackageSourceType["SAP"] = "SAP";
|
|
2154
|
+
PackageSourceType["HttpTrigger"] = "HttpTrigger";
|
|
2155
|
+
PackageSourceType["HttpTriggerWithCallback"] = "HttpTriggerWithCallback";
|
|
2156
|
+
PackageSourceType["RobotAPI"] = "RobotAPI";
|
|
2157
|
+
PackageSourceType["Assistant"] = "Assistant";
|
|
2158
|
+
PackageSourceType["CommandLine"] = "CommandLine";
|
|
2159
|
+
PackageSourceType["RobotNetAPI"] = "RobotNetAPI";
|
|
2160
|
+
PackageSourceType["Autopilot"] = "Autopilot";
|
|
2161
|
+
PackageSourceType["TestManager"] = "TestManager";
|
|
2162
|
+
PackageSourceType["AgentService"] = "AgentService";
|
|
2163
|
+
PackageSourceType["ProcessOrchestration"] = "ProcessOrchestration";
|
|
2164
|
+
PackageSourceType["PluginEcosystem"] = "PluginEcosystem";
|
|
2165
|
+
PackageSourceType["PerformanceTesting"] = "PerformanceTesting";
|
|
2166
|
+
PackageSourceType["AgentHub"] = "AgentHub";
|
|
2167
|
+
PackageSourceType["ApiWorkflow"] = "ApiWorkflow";
|
|
2168
|
+
})(PackageSourceType || (PackageSourceType = {}));
|
|
2169
|
+
/**
|
|
2170
|
+
* Enum for job source type
|
|
2171
|
+
*/
|
|
2172
|
+
var JobSourceType;
|
|
2173
|
+
(function (JobSourceType) {
|
|
2174
|
+
JobSourceType["Manual"] = "Manual";
|
|
2175
|
+
JobSourceType["Schedule"] = "Schedule";
|
|
2176
|
+
JobSourceType["Agent"] = "Agent";
|
|
2177
|
+
JobSourceType["Queue"] = "Queue";
|
|
2178
|
+
JobSourceType["StudioWeb"] = "StudioWeb";
|
|
2179
|
+
JobSourceType["IntegrationTrigger"] = "IntegrationTrigger";
|
|
2180
|
+
JobSourceType["StudioDesktop"] = "StudioDesktop";
|
|
2181
|
+
JobSourceType["AutomationOpsPipelines"] = "AutomationOpsPipelines";
|
|
2182
|
+
JobSourceType["Apps"] = "Apps";
|
|
2183
|
+
JobSourceType["SAP"] = "SAP";
|
|
2184
|
+
JobSourceType["HttpTrigger"] = "HttpTrigger";
|
|
2185
|
+
JobSourceType["HttpTriggerCallback"] = "HttpTriggerCallback";
|
|
2186
|
+
JobSourceType["RobotAPI"] = "RobotAPI";
|
|
2187
|
+
JobSourceType["CommandLine"] = "CommandLine";
|
|
2188
|
+
JobSourceType["RobotNetAPI"] = "RobotNetAPI";
|
|
2189
|
+
JobSourceType["Autopilot"] = "Autopilot";
|
|
2190
|
+
JobSourceType["TestManager"] = "TestManager";
|
|
2191
|
+
JobSourceType["AgentService"] = "AgentService";
|
|
2192
|
+
JobSourceType["ProcessOrchestration"] = "ProcessOrchestration";
|
|
2193
|
+
JobSourceType["PluginEcosystem"] = "PluginEcosystem";
|
|
2194
|
+
JobSourceType["PerformanceTesting"] = "PerformanceTesting";
|
|
2195
|
+
JobSourceType["AgentHub"] = "AgentHub";
|
|
2196
|
+
JobSourceType["ApiWorkflow"] = "ApiWorkflow";
|
|
2197
|
+
JobSourceType["CaseManagement"] = "CaseManagement";
|
|
2198
|
+
})(JobSourceType || (JobSourceType = {}));
|
|
2199
|
+
/**
|
|
2200
|
+
* Enum for stop strategy
|
|
2201
|
+
*/
|
|
2202
|
+
var StopStrategy;
|
|
2203
|
+
(function (StopStrategy) {
|
|
2204
|
+
StopStrategy["SoftStop"] = "SoftStop";
|
|
2205
|
+
StopStrategy["Kill"] = "Kill";
|
|
2206
|
+
})(StopStrategy || (StopStrategy = {}));
|
|
2207
|
+
/**
|
|
2208
|
+
* Enum for runtime type
|
|
2209
|
+
*/
|
|
2210
|
+
var RuntimeType;
|
|
2211
|
+
(function (RuntimeType) {
|
|
2212
|
+
RuntimeType["NonProduction"] = "NonProduction";
|
|
2213
|
+
RuntimeType["Attended"] = "Attended";
|
|
2214
|
+
RuntimeType["Unattended"] = "Unattended";
|
|
2215
|
+
RuntimeType["Development"] = "Development";
|
|
2216
|
+
RuntimeType["Studio"] = "Studio";
|
|
2217
|
+
RuntimeType["RpaDeveloper"] = "RpaDeveloper";
|
|
2218
|
+
RuntimeType["StudioX"] = "StudioX";
|
|
2219
|
+
RuntimeType["CitizenDeveloper"] = "CitizenDeveloper";
|
|
2220
|
+
RuntimeType["Headless"] = "Headless";
|
|
2221
|
+
RuntimeType["StudioPro"] = "StudioPro";
|
|
2222
|
+
RuntimeType["RpaDeveloperPro"] = "RpaDeveloperPro";
|
|
2223
|
+
RuntimeType["TestAutomation"] = "TestAutomation";
|
|
2224
|
+
RuntimeType["AutomationCloud"] = "AutomationCloud";
|
|
2225
|
+
RuntimeType["Serverless"] = "Serverless";
|
|
2226
|
+
RuntimeType["AutomationKit"] = "AutomationKit";
|
|
2227
|
+
RuntimeType["ServerlessTestAutomation"] = "ServerlessTestAutomation";
|
|
2228
|
+
RuntimeType["AutomationCloudTestAutomation"] = "AutomationCloudTestAutomation";
|
|
2229
|
+
RuntimeType["AttendedStudioWeb"] = "AttendedStudioWeb";
|
|
2230
|
+
RuntimeType["Hosting"] = "Hosting";
|
|
2231
|
+
RuntimeType["AssistantWeb"] = "AssistantWeb";
|
|
2232
|
+
RuntimeType["ProcessOrchestration"] = "ProcessOrchestration";
|
|
2233
|
+
RuntimeType["AgentService"] = "AgentService";
|
|
2234
|
+
RuntimeType["AppTest"] = "AppTest";
|
|
2235
|
+
RuntimeType["PerformanceTest"] = "PerformanceTest";
|
|
2236
|
+
RuntimeType["BusinessRule"] = "BusinessRule";
|
|
2237
|
+
RuntimeType["CaseManagement"] = "CaseManagement";
|
|
2238
|
+
RuntimeType["Flow"] = "Flow";
|
|
2239
|
+
})(RuntimeType || (RuntimeType = {}));
|
|
2240
|
+
/**
|
|
2241
|
+
* Enum for job type
|
|
2242
|
+
*/
|
|
2243
|
+
var JobType;
|
|
2244
|
+
(function (JobType) {
|
|
2245
|
+
JobType["Unattended"] = "Unattended";
|
|
2246
|
+
JobType["Attended"] = "Attended";
|
|
2247
|
+
JobType["ServerlessGeneric"] = "ServerlessGeneric";
|
|
2248
|
+
})(JobType || (JobType = {}));
|
|
2249
|
+
|
|
2035
2250
|
/**
|
|
2036
2251
|
* Service for interacting with UiPath Orchestrator Jobs API
|
|
2037
2252
|
*/
|
|
@@ -2201,6 +2416,121 @@ class JobService extends FolderScopedService {
|
|
|
2201
2416
|
}
|
|
2202
2417
|
return null;
|
|
2203
2418
|
}
|
|
2419
|
+
/**
|
|
2420
|
+
* Stops one or more jobs by their UUID keys.
|
|
2421
|
+
*
|
|
2422
|
+
* Sends a stop request for the specified jobs to the Orchestrator. Throws if any keys cannot be resolved.
|
|
2423
|
+
*
|
|
2424
|
+
* @param jobKeys - Array of job UUID keys to stop (e.g., from {@link JobGetResponse}.key)
|
|
2425
|
+
* @param folderId - The folder ID where the jobs reside (required)
|
|
2426
|
+
* @param options - Optional {@link JobStopOptions} including stop strategy
|
|
2427
|
+
* @returns Promise that resolves when the jobs are stopped successfully, or rejects on failure
|
|
2428
|
+
*
|
|
2429
|
+
* @example
|
|
2430
|
+
* ```typescript
|
|
2431
|
+
* // Stop a single job with default soft stop
|
|
2432
|
+
* await jobs.stop([<jobKey>], <folderId>);
|
|
2433
|
+
* ```
|
|
2434
|
+
*
|
|
2435
|
+
* @example
|
|
2436
|
+
* ```typescript
|
|
2437
|
+
* import { StopStrategy } from '@uipath/uipath-typescript/jobs';
|
|
2438
|
+
*
|
|
2439
|
+
* // Force-kill multiple jobs
|
|
2440
|
+
* await jobs.stop(
|
|
2441
|
+
* [<jobKey1>, <jobKey2>],
|
|
2442
|
+
* <folderId>,
|
|
2443
|
+
* { strategy: StopStrategy.Kill }
|
|
2444
|
+
* );
|
|
2445
|
+
* ```
|
|
2446
|
+
*/
|
|
2447
|
+
async stop(jobKeys, folderId, options) {
|
|
2448
|
+
if (jobKeys.length === 0) {
|
|
2449
|
+
return;
|
|
2450
|
+
}
|
|
2451
|
+
if (!folderId) {
|
|
2452
|
+
throw new ValidationError({ message: 'folderId is required for stop' });
|
|
2453
|
+
}
|
|
2454
|
+
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
2455
|
+
const strategy = options?.strategy ?? StopStrategy.SoftStop;
|
|
2456
|
+
const jobIds = await this.resolveJobKeys(jobKeys, folderId);
|
|
2457
|
+
await this.stopJobsByIds(jobIds, strategy, headers);
|
|
2458
|
+
}
|
|
2459
|
+
/**
|
|
2460
|
+
* Resumes a suspended job.
|
|
2461
|
+
*
|
|
2462
|
+
* Sends a resume request to a job that is currently in the `Suspended` state.
|
|
2463
|
+
* The job transitions to `Resumed` and then to `Running` as it continues execution. Optionally pass
|
|
2464
|
+
* input arguments to provide data for the resumed workflow.
|
|
2465
|
+
*
|
|
2466
|
+
* @param jobKey - The unique key (GUID) of the suspended job to resume
|
|
2467
|
+
* @param folderId - The folder ID where the job resides
|
|
2468
|
+
* @param options - Optional parameters including input arguments
|
|
2469
|
+
* @returns Promise that resolves when the job is resumed successfully, or rejects on failure
|
|
2470
|
+
*
|
|
2471
|
+
* @example
|
|
2472
|
+
* ```typescript
|
|
2473
|
+
* // Resume a suspended job
|
|
2474
|
+
* await jobs.resume(<jobKey>, <folderId>);
|
|
2475
|
+
* ```
|
|
2476
|
+
*
|
|
2477
|
+
* @example
|
|
2478
|
+
* ```typescript
|
|
2479
|
+
* // Resume with input arguments
|
|
2480
|
+
* await jobs.resume(<jobKey>, <folderId>, {
|
|
2481
|
+
* inputArguments: { approved: true }
|
|
2482
|
+
* });
|
|
2483
|
+
* ```
|
|
2484
|
+
*/
|
|
2485
|
+
async resume(jobKey, folderId, options) {
|
|
2486
|
+
if (!jobKey) {
|
|
2487
|
+
throw new ValidationError({ message: 'jobKey is required for resume' });
|
|
2488
|
+
}
|
|
2489
|
+
if (!folderId) {
|
|
2490
|
+
throw new ValidationError({ message: 'folderId is required for resume' });
|
|
2491
|
+
}
|
|
2492
|
+
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
2493
|
+
const body = { jobKey };
|
|
2494
|
+
if (options?.inputArguments) {
|
|
2495
|
+
body.inputArguments = JSON.stringify(options.inputArguments);
|
|
2496
|
+
}
|
|
2497
|
+
await this.post(JOB_ENDPOINTS.RESUME, body, { headers });
|
|
2498
|
+
}
|
|
2499
|
+
/**
|
|
2500
|
+
* Restarts a job in a final state (Successful, Faulted, or Stopped).
|
|
2501
|
+
*
|
|
2502
|
+
* Creates a **new** job execution from a previously successful, faulted, or stopped job.
|
|
2503
|
+
* The new job has its own unique `key`, starts in `Pending` state, and uses
|
|
2504
|
+
* the same process and input arguments as the original job.
|
|
2505
|
+
*
|
|
2506
|
+
* To monitor the new job's progress, poll with {@link getById}
|
|
2507
|
+
* using the returned job's key until the state reaches a final value.
|
|
2508
|
+
*
|
|
2509
|
+
* @param jobKey - The unique key (GUID) of the job to restart
|
|
2510
|
+
* @param folderId - The folder ID where the job resides
|
|
2511
|
+
* @returns Promise resolving to the new {@link JobGetResponse} with full job details
|
|
2512
|
+
*
|
|
2513
|
+
* @example
|
|
2514
|
+
* ```typescript
|
|
2515
|
+
* // Restart a faulted job
|
|
2516
|
+
* const newJob = await jobs.restart(<jobKey>, <folderId>);
|
|
2517
|
+
* console.log(newJob.state); // 'Pending'
|
|
2518
|
+
* console.log(newJob.key); // new job key (different from original)
|
|
2519
|
+
* ```
|
|
2520
|
+
*/
|
|
2521
|
+
async restart(jobKey, folderId) {
|
|
2522
|
+
if (!jobKey) {
|
|
2523
|
+
throw new ValidationError({ message: 'jobKey is required for restart' });
|
|
2524
|
+
}
|
|
2525
|
+
if (!folderId) {
|
|
2526
|
+
throw new ValidationError({ message: 'folderId is required for restart' });
|
|
2527
|
+
}
|
|
2528
|
+
const [jobId] = await this.resolveJobKeys([jobKey], folderId);
|
|
2529
|
+
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
2530
|
+
const response = await this.post(JOB_ENDPOINTS.RESTART, { jobId }, { headers });
|
|
2531
|
+
const rawJob = transformData(pascalToCamelCaseKeys(response.data), JobMap);
|
|
2532
|
+
return createJobWithMethods(rawJob, this);
|
|
2533
|
+
}
|
|
2204
2534
|
/**
|
|
2205
2535
|
* Downloads the output file content via the Attachments API.
|
|
2206
2536
|
* 1. Fetches blob access info from the attachment using AttachmentService
|
|
@@ -2235,6 +2565,43 @@ class JobService extends FolderScopedService {
|
|
|
2235
2565
|
throw new ServerError({ message: 'Failed to parse job output file as JSON' });
|
|
2236
2566
|
}
|
|
2237
2567
|
}
|
|
2568
|
+
/**
|
|
2569
|
+
* Resolves job UUID keys to integer IDs via the getAll method.
|
|
2570
|
+
* Chunks keys into batches to avoid URL length limits.
|
|
2571
|
+
*/
|
|
2572
|
+
async resolveJobKeys(jobKeys, folderId) {
|
|
2573
|
+
const uniqueKeys = [...new Set(jobKeys)];
|
|
2574
|
+
const keyToIdMap = new Map();
|
|
2575
|
+
const chunks = [];
|
|
2576
|
+
for (let i = 0; i < uniqueKeys.length; i += JOB_KEY_RESOLUTION_CHUNK_SIZE) {
|
|
2577
|
+
chunks.push(uniqueKeys.slice(i, i + JOB_KEY_RESOLUTION_CHUNK_SIZE));
|
|
2578
|
+
}
|
|
2579
|
+
const results = await Promise.all(chunks.map((chunk) => {
|
|
2580
|
+
const filterValues = chunk.map((key) => `'${key}'`).join(',');
|
|
2581
|
+
return this.getAll({
|
|
2582
|
+
folderId,
|
|
2583
|
+
filter: `key in (${filterValues})`,
|
|
2584
|
+
select: 'id,key',
|
|
2585
|
+
pageSize: chunk.length,
|
|
2586
|
+
});
|
|
2587
|
+
}));
|
|
2588
|
+
for (const response of results) {
|
|
2589
|
+
for (const job of response.items) {
|
|
2590
|
+
keyToIdMap.set(job.key, job.id);
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
const missingKeys = uniqueKeys.filter((key) => !keyToIdMap.has(key));
|
|
2594
|
+
if (missingKeys.length > 0) {
|
|
2595
|
+
throw new ValidationError({ message: `Jobs not found for keys: ${missingKeys.join(', ')}` });
|
|
2596
|
+
}
|
|
2597
|
+
return uniqueKeys.map((key) => keyToIdMap.get(key));
|
|
2598
|
+
}
|
|
2599
|
+
/**
|
|
2600
|
+
* Calls the StopJobs OData action with resolved integer IDs.
|
|
2601
|
+
*/
|
|
2602
|
+
async stopJobsByIds(jobIds, strategy, headers) {
|
|
2603
|
+
await this.post(JOB_ENDPOINTS.STOP, { jobIds, strategy }, { headers });
|
|
2604
|
+
}
|
|
2238
2605
|
}
|
|
2239
2606
|
__decorate([
|
|
2240
2607
|
track('Jobs.GetAll')
|
|
@@ -2245,6 +2612,15 @@ __decorate([
|
|
|
2245
2612
|
__decorate([
|
|
2246
2613
|
track('Jobs.GetOutput')
|
|
2247
2614
|
], JobService.prototype, "getOutput", null);
|
|
2615
|
+
__decorate([
|
|
2616
|
+
track('Jobs.Stop')
|
|
2617
|
+
], JobService.prototype, "stop", null);
|
|
2618
|
+
__decorate([
|
|
2619
|
+
track('Jobs.Resume')
|
|
2620
|
+
], JobService.prototype, "resume", null);
|
|
2621
|
+
__decorate([
|
|
2622
|
+
track('Jobs.Restart')
|
|
2623
|
+
], JobService.prototype, "restart", null);
|
|
2248
2624
|
|
|
2249
2625
|
/**
|
|
2250
2626
|
* Enum for job sub-state
|
|
@@ -2287,4 +2663,4 @@ var JobState;
|
|
|
2287
2663
|
JobState["Resumed"] = "Resumed";
|
|
2288
2664
|
})(JobState || (JobState = {}));
|
|
2289
2665
|
|
|
2290
|
-
export { JobService, JobState, JobSubState, JobService as Jobs, ServerlessJobType, createJobWithMethods };
|
|
2666
|
+
export { JobService, JobState, JobSubState, JobService as Jobs, ServerlessJobType, StopStrategy, createJobWithMethods };
|
|
@@ -507,6 +507,8 @@ class ErrorFactory {
|
|
|
507
507
|
|
|
508
508
|
const FOLDER_KEY = 'X-UIPATH-FolderKey';
|
|
509
509
|
const FOLDER_ID = 'X-UIPATH-OrganizationUnitId';
|
|
510
|
+
const TRACEPARENT = 'traceparent';
|
|
511
|
+
const UIPATH_TRACEPARENT_ID = 'x-uipath-traceparent-id';
|
|
510
512
|
/**
|
|
511
513
|
* Content type constants for HTTP requests/responses
|
|
512
514
|
*/
|
|
@@ -560,8 +562,13 @@ class ApiClient {
|
|
|
560
562
|
if (isFormData) {
|
|
561
563
|
delete defaultHeaders['Content-Type'];
|
|
562
564
|
}
|
|
565
|
+
const traceId = crypto.randomUUID().replace(/-/g, '');
|
|
566
|
+
const spanId = crypto.randomUUID().replace(/-/g, '').slice(0, 16);
|
|
567
|
+
const traceparentValue = `00-${traceId}-${spanId}-01`;
|
|
563
568
|
const headers = {
|
|
564
569
|
...defaultHeaders,
|
|
570
|
+
[TRACEPARENT]: traceparentValue,
|
|
571
|
+
[UIPATH_TRACEPARENT_ID]: traceparentValue,
|
|
565
572
|
...options.headers
|
|
566
573
|
};
|
|
567
574
|
// Convert params to URLSearchParams
|
|
@@ -601,7 +608,11 @@ class ApiClient {
|
|
|
601
608
|
const text = await response.text();
|
|
602
609
|
return text;
|
|
603
610
|
}
|
|
604
|
-
|
|
611
|
+
const text = await response.text();
|
|
612
|
+
if (!text) {
|
|
613
|
+
return undefined;
|
|
614
|
+
}
|
|
615
|
+
return JSON.parse(text);
|
|
605
616
|
}
|
|
606
617
|
catch (error) {
|
|
607
618
|
// If it's already one of our errors, re-throw it
|
|
@@ -1162,8 +1173,9 @@ class PaginationHelpers {
|
|
|
1162
1173
|
});
|
|
1163
1174
|
}
|
|
1164
1175
|
// Extract and transform items from response
|
|
1165
|
-
|
|
1166
|
-
const
|
|
1176
|
+
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1177
|
+
const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
|
|
1178
|
+
const totalCount = Array.isArray(response.data) ? undefined : response.data?.[totalCountField];
|
|
1167
1179
|
// Parse items - automatically handle JSON string responses
|
|
1168
1180
|
const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
|
|
1169
1181
|
const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
|
|
@@ -1414,7 +1426,7 @@ class BaseService {
|
|
|
1414
1426
|
const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
|
|
1415
1427
|
// Prepare request parameters based on pagination type
|
|
1416
1428
|
const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
|
|
1417
|
-
// For POST requests, merge pagination params into body; for GET, use query params
|
|
1429
|
+
// For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
|
|
1418
1430
|
if (method.toUpperCase() === 'POST') {
|
|
1419
1431
|
const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
|
|
1420
1432
|
options.body = {
|
|
@@ -1422,6 +1434,7 @@ class BaseService {
|
|
|
1422
1434
|
...options.params,
|
|
1423
1435
|
...requestParams
|
|
1424
1436
|
};
|
|
1437
|
+
options.params = undefined;
|
|
1425
1438
|
}
|
|
1426
1439
|
else {
|
|
1427
1440
|
// Merge pagination parameters with existing parameters
|
|
@@ -1462,7 +1475,6 @@ class BaseService {
|
|
|
1462
1475
|
if (params.pageNumber && params.pageNumber > 1) {
|
|
1463
1476
|
requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
|
|
1464
1477
|
}
|
|
1465
|
-
// Include total count for ODATA APIs
|
|
1466
1478
|
{
|
|
1467
1479
|
requestParams[countParam] = true;
|
|
1468
1480
|
}
|
|
@@ -1490,8 +1502,9 @@ class BaseService {
|
|
|
1490
1502
|
const totalCountField = fields.totalCountField || 'totalRecordCount';
|
|
1491
1503
|
const continuationTokenField = fields.continuationTokenField || 'continuationToken';
|
|
1492
1504
|
// Extract items and metadata
|
|
1493
|
-
|
|
1494
|
-
const
|
|
1505
|
+
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1506
|
+
const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
|
|
1507
|
+
const totalCount = Array.isArray(response.data) ? undefined : response.data[totalCountField];
|
|
1495
1508
|
const continuationToken = response.data[continuationTokenField];
|
|
1496
1509
|
// Determine if there are more pages
|
|
1497
1510
|
const hasMore = this.determineHasMorePages(paginationType, {
|
|
@@ -1729,7 +1742,7 @@ class BpmnHelpers {
|
|
|
1729
1742
|
// Connection string placeholder that will be replaced during build
|
|
1730
1743
|
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";
|
|
1731
1744
|
// SDK Version placeholder
|
|
1732
|
-
const SDK_VERSION = "1.3.
|
|
1745
|
+
const SDK_VERSION = "1.3.4";
|
|
1733
1746
|
const VERSION = "Version";
|
|
1734
1747
|
const SERVICE = "Service";
|
|
1735
1748
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|