@uipath/uipath-typescript 1.3.2 → 1.3.3
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 +14 -8
- package/dist/assets/index.mjs +14 -8
- package/dist/attachments/index.cjs +14 -8
- package/dist/attachments/index.mjs +14 -8
- package/dist/buckets/index.cjs +14 -8
- package/dist/buckets/index.mjs +14 -8
- package/dist/cases/index.cjs +34 -13
- package/dist/cases/index.d.ts +15 -0
- package/dist/cases/index.mjs +34 -13
- package/dist/conversational-agent/index.cjs +32 -8
- package/dist/conversational-agent/index.d.ts +26 -0
- package/dist/conversational-agent/index.mjs +32 -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 +14 -8
- package/dist/entities/index.mjs +14 -8
- package/dist/feedback/index.cjs +1904 -0
- package/dist/feedback/index.d.ts +475 -0
- package/dist/feedback/index.mjs +1902 -0
- package/dist/index.cjs +364 -189
- package/dist/index.d.ts +277 -12
- package/dist/index.mjs +365 -190
- package/dist/index.umd.js +364 -189
- package/dist/jobs/index.cjs +331 -8
- package/dist/jobs/index.d.ts +168 -2
- package/dist/jobs/index.mjs +332 -9
- package/dist/maestro-processes/index.cjs +14 -8
- package/dist/maestro-processes/index.mjs +14 -8
- package/dist/processes/index.cjs +14 -8
- package/dist/processes/index.mjs +14 -8
- package/dist/queues/index.cjs +14 -8
- package/dist/queues/index.mjs +14 -8
- package/dist/tasks/index.cjs +34 -13
- package/dist/tasks/index.d.ts +25 -10
- package/dist/tasks/index.mjs +35 -14
- package/package.json +12 -1
package/dist/jobs/index.mjs
CHANGED
|
@@ -598,7 +598,11 @@ class ApiClient {
|
|
|
598
598
|
const text = await response.text();
|
|
599
599
|
return text;
|
|
600
600
|
}
|
|
601
|
-
|
|
601
|
+
const text = await response.text();
|
|
602
|
+
if (!text) {
|
|
603
|
+
return undefined;
|
|
604
|
+
}
|
|
605
|
+
return JSON.parse(text);
|
|
602
606
|
}
|
|
603
607
|
catch (error) {
|
|
604
608
|
// If it's already one of our errors, re-throw it
|
|
@@ -1230,8 +1234,9 @@ class PaginationHelpers {
|
|
|
1230
1234
|
});
|
|
1231
1235
|
}
|
|
1232
1236
|
// Extract and transform items from response
|
|
1233
|
-
|
|
1234
|
-
const
|
|
1237
|
+
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1238
|
+
const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
|
|
1239
|
+
const totalCount = Array.isArray(response.data) ? undefined : response.data?.[totalCountField];
|
|
1235
1240
|
// Parse items - automatically handle JSON string responses
|
|
1236
1241
|
const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
|
|
1237
1242
|
const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
|
|
@@ -1482,7 +1487,7 @@ class BaseService {
|
|
|
1482
1487
|
const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
|
|
1483
1488
|
// Prepare request parameters based on pagination type
|
|
1484
1489
|
const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
|
|
1485
|
-
// For POST requests, merge pagination params into body; for GET, use query params
|
|
1490
|
+
// For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
|
|
1486
1491
|
if (method.toUpperCase() === 'POST') {
|
|
1487
1492
|
const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
|
|
1488
1493
|
options.body = {
|
|
@@ -1490,6 +1495,7 @@ class BaseService {
|
|
|
1490
1495
|
...options.params,
|
|
1491
1496
|
...requestParams
|
|
1492
1497
|
};
|
|
1498
|
+
options.params = undefined;
|
|
1493
1499
|
}
|
|
1494
1500
|
else {
|
|
1495
1501
|
// Merge pagination parameters with existing parameters
|
|
@@ -1530,7 +1536,6 @@ class BaseService {
|
|
|
1530
1536
|
if (params.pageNumber && params.pageNumber > 1) {
|
|
1531
1537
|
requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
|
|
1532
1538
|
}
|
|
1533
|
-
// Include total count for ODATA APIs
|
|
1534
1539
|
{
|
|
1535
1540
|
requestParams[countParam] = true;
|
|
1536
1541
|
}
|
|
@@ -1558,8 +1563,9 @@ class BaseService {
|
|
|
1558
1563
|
const totalCountField = fields.totalCountField || 'totalRecordCount';
|
|
1559
1564
|
const continuationTokenField = fields.continuationTokenField || 'continuationToken';
|
|
1560
1565
|
// Extract items and metadata
|
|
1561
|
-
|
|
1562
|
-
const
|
|
1566
|
+
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1567
|
+
const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
|
|
1568
|
+
const totalCount = Array.isArray(response.data) ? undefined : response.data[totalCountField];
|
|
1563
1569
|
const continuationToken = response.data[continuationTokenField];
|
|
1564
1570
|
// Determine if there are more pages
|
|
1565
1571
|
const hasMore = this.determineHasMorePages(paginationType, {
|
|
@@ -1655,6 +1661,20 @@ function createJobMethods(jobData, service) {
|
|
|
1655
1661
|
throw new Error('Job folderId is undefined');
|
|
1656
1662
|
return service.getOutput(jobData.key, jobData.folderId);
|
|
1657
1663
|
},
|
|
1664
|
+
async stop(options) {
|
|
1665
|
+
if (!jobData.key)
|
|
1666
|
+
throw new Error('Job key is undefined');
|
|
1667
|
+
if (!jobData.folderId)
|
|
1668
|
+
throw new Error('Job folderId is undefined');
|
|
1669
|
+
return service.stop([jobData.key], jobData.folderId, options);
|
|
1670
|
+
},
|
|
1671
|
+
async resume(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.resume(jobData.key, jobData.folderId, options);
|
|
1677
|
+
},
|
|
1658
1678
|
};
|
|
1659
1679
|
}
|
|
1660
1680
|
/**
|
|
@@ -1683,6 +1703,8 @@ const ORCHESTRATOR_BASE = 'orchestrator_';
|
|
|
1683
1703
|
const JOB_ENDPOINTS = {
|
|
1684
1704
|
GET_ALL: `${ORCHESTRATOR_BASE}/odata/Jobs`,
|
|
1685
1705
|
GET_BY_KEY: (identifier) => `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.GetByKey(identifier=${identifier})`,
|
|
1706
|
+
STOP: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.StopJobs`,
|
|
1707
|
+
RESUME: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.ResumeJob`,
|
|
1686
1708
|
};
|
|
1687
1709
|
/**
|
|
1688
1710
|
* Orchestrator Attachment Service Endpoints
|
|
@@ -1691,6 +1713,8 @@ const ORCHESTRATOR_ATTACHMENT_ENDPOINTS = {
|
|
|
1691
1713
|
GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Attachments(${id})`,
|
|
1692
1714
|
};
|
|
1693
1715
|
|
|
1716
|
+
/** Maximum number of job keys to resolve in a single OData filter query */
|
|
1717
|
+
const JOB_KEY_RESOLUTION_CHUNK_SIZE = 50;
|
|
1694
1718
|
/**
|
|
1695
1719
|
* Maps fields for Job entities to ensure consistent naming
|
|
1696
1720
|
* Semantic renames only — case conversion handled by pascalToCamelCaseKeys()
|
|
@@ -1712,7 +1736,7 @@ const JobMap = {
|
|
|
1712
1736
|
// Connection string placeholder that will be replaced during build
|
|
1713
1737
|
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
1738
|
// SDK Version placeholder
|
|
1715
|
-
const SDK_VERSION = "1.3.
|
|
1739
|
+
const SDK_VERSION = "1.3.3";
|
|
1716
1740
|
const VERSION = "Version";
|
|
1717
1741
|
const SERVICE = "Service";
|
|
1718
1742
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -2032,6 +2056,182 @@ __decorate([
|
|
|
2032
2056
|
track('Attachments.GetById')
|
|
2033
2057
|
], AttachmentService.prototype, "getById", null);
|
|
2034
2058
|
|
|
2059
|
+
/**
|
|
2060
|
+
* Enum for package types
|
|
2061
|
+
*/
|
|
2062
|
+
var PackageType;
|
|
2063
|
+
(function (PackageType) {
|
|
2064
|
+
PackageType["Undefined"] = "Undefined";
|
|
2065
|
+
PackageType["Process"] = "Process";
|
|
2066
|
+
PackageType["ProcessOrchestration"] = "ProcessOrchestration";
|
|
2067
|
+
PackageType["WebApp"] = "WebApp";
|
|
2068
|
+
PackageType["Agent"] = "Agent";
|
|
2069
|
+
PackageType["TestAutomationProcess"] = "TestAutomationProcess";
|
|
2070
|
+
PackageType["Api"] = "Api";
|
|
2071
|
+
PackageType["MCPServer"] = "MCPServer";
|
|
2072
|
+
PackageType["BusinessRules"] = "BusinessRules";
|
|
2073
|
+
PackageType["CaseManagement"] = "CaseManagement";
|
|
2074
|
+
PackageType["Flow"] = "Flow";
|
|
2075
|
+
PackageType["Function"] = "Function";
|
|
2076
|
+
})(PackageType || (PackageType = {}));
|
|
2077
|
+
/**
|
|
2078
|
+
* Enum for job priority
|
|
2079
|
+
*/
|
|
2080
|
+
var JobPriority;
|
|
2081
|
+
(function (JobPriority) {
|
|
2082
|
+
JobPriority["Low"] = "Low";
|
|
2083
|
+
JobPriority["Normal"] = "Normal";
|
|
2084
|
+
JobPriority["High"] = "High";
|
|
2085
|
+
})(JobPriority || (JobPriority = {}));
|
|
2086
|
+
/**
|
|
2087
|
+
* Enum for target framework
|
|
2088
|
+
*/
|
|
2089
|
+
var TargetFramework;
|
|
2090
|
+
(function (TargetFramework) {
|
|
2091
|
+
TargetFramework["Legacy"] = "Legacy";
|
|
2092
|
+
TargetFramework["Windows"] = "Windows";
|
|
2093
|
+
TargetFramework["Portable"] = "Portable";
|
|
2094
|
+
})(TargetFramework || (TargetFramework = {}));
|
|
2095
|
+
/**
|
|
2096
|
+
* Enum for robot size
|
|
2097
|
+
*/
|
|
2098
|
+
var RobotSize;
|
|
2099
|
+
(function (RobotSize) {
|
|
2100
|
+
RobotSize["Small"] = "Small";
|
|
2101
|
+
RobotSize["Standard"] = "Standard";
|
|
2102
|
+
RobotSize["Medium"] = "Medium";
|
|
2103
|
+
RobotSize["Large"] = "Large";
|
|
2104
|
+
})(RobotSize || (RobotSize = {}));
|
|
2105
|
+
/**
|
|
2106
|
+
* Enum for remote control access
|
|
2107
|
+
*/
|
|
2108
|
+
var RemoteControlAccess;
|
|
2109
|
+
(function (RemoteControlAccess) {
|
|
2110
|
+
RemoteControlAccess["None"] = "None";
|
|
2111
|
+
RemoteControlAccess["ReadOnly"] = "ReadOnly";
|
|
2112
|
+
RemoteControlAccess["Full"] = "Full";
|
|
2113
|
+
})(RemoteControlAccess || (RemoteControlAccess = {}));
|
|
2114
|
+
/**
|
|
2115
|
+
* Enum for process start strategy
|
|
2116
|
+
*/
|
|
2117
|
+
var StartStrategy;
|
|
2118
|
+
(function (StartStrategy) {
|
|
2119
|
+
StartStrategy["All"] = "All";
|
|
2120
|
+
StartStrategy["Specific"] = "Specific";
|
|
2121
|
+
StartStrategy["RobotCount"] = "RobotCount";
|
|
2122
|
+
StartStrategy["JobsCount"] = "JobsCount";
|
|
2123
|
+
StartStrategy["ModernJobsCount"] = "ModernJobsCount";
|
|
2124
|
+
})(StartStrategy || (StartStrategy = {}));
|
|
2125
|
+
/**
|
|
2126
|
+
* Enum for package source type
|
|
2127
|
+
*/
|
|
2128
|
+
var PackageSourceType;
|
|
2129
|
+
(function (PackageSourceType) {
|
|
2130
|
+
PackageSourceType["Manual"] = "Manual";
|
|
2131
|
+
PackageSourceType["Schedule"] = "Schedule";
|
|
2132
|
+
PackageSourceType["Queue"] = "Queue";
|
|
2133
|
+
PackageSourceType["StudioWeb"] = "StudioWeb";
|
|
2134
|
+
PackageSourceType["IntegrationTrigger"] = "IntegrationTrigger";
|
|
2135
|
+
PackageSourceType["StudioDesktop"] = "StudioDesktop";
|
|
2136
|
+
PackageSourceType["AutomationOpsPipelines"] = "AutomationOpsPipelines";
|
|
2137
|
+
PackageSourceType["Apps"] = "Apps";
|
|
2138
|
+
PackageSourceType["SAP"] = "SAP";
|
|
2139
|
+
PackageSourceType["HttpTrigger"] = "HttpTrigger";
|
|
2140
|
+
PackageSourceType["HttpTriggerWithCallback"] = "HttpTriggerWithCallback";
|
|
2141
|
+
PackageSourceType["RobotAPI"] = "RobotAPI";
|
|
2142
|
+
PackageSourceType["Assistant"] = "Assistant";
|
|
2143
|
+
PackageSourceType["CommandLine"] = "CommandLine";
|
|
2144
|
+
PackageSourceType["RobotNetAPI"] = "RobotNetAPI";
|
|
2145
|
+
PackageSourceType["Autopilot"] = "Autopilot";
|
|
2146
|
+
PackageSourceType["TestManager"] = "TestManager";
|
|
2147
|
+
PackageSourceType["AgentService"] = "AgentService";
|
|
2148
|
+
PackageSourceType["ProcessOrchestration"] = "ProcessOrchestration";
|
|
2149
|
+
PackageSourceType["PluginEcosystem"] = "PluginEcosystem";
|
|
2150
|
+
PackageSourceType["PerformanceTesting"] = "PerformanceTesting";
|
|
2151
|
+
PackageSourceType["AgentHub"] = "AgentHub";
|
|
2152
|
+
PackageSourceType["ApiWorkflow"] = "ApiWorkflow";
|
|
2153
|
+
})(PackageSourceType || (PackageSourceType = {}));
|
|
2154
|
+
/**
|
|
2155
|
+
* Enum for job source type
|
|
2156
|
+
*/
|
|
2157
|
+
var JobSourceType;
|
|
2158
|
+
(function (JobSourceType) {
|
|
2159
|
+
JobSourceType["Manual"] = "Manual";
|
|
2160
|
+
JobSourceType["Schedule"] = "Schedule";
|
|
2161
|
+
JobSourceType["Agent"] = "Agent";
|
|
2162
|
+
JobSourceType["Queue"] = "Queue";
|
|
2163
|
+
JobSourceType["StudioWeb"] = "StudioWeb";
|
|
2164
|
+
JobSourceType["IntegrationTrigger"] = "IntegrationTrigger";
|
|
2165
|
+
JobSourceType["StudioDesktop"] = "StudioDesktop";
|
|
2166
|
+
JobSourceType["AutomationOpsPipelines"] = "AutomationOpsPipelines";
|
|
2167
|
+
JobSourceType["Apps"] = "Apps";
|
|
2168
|
+
JobSourceType["SAP"] = "SAP";
|
|
2169
|
+
JobSourceType["HttpTrigger"] = "HttpTrigger";
|
|
2170
|
+
JobSourceType["HttpTriggerCallback"] = "HttpTriggerCallback";
|
|
2171
|
+
JobSourceType["RobotAPI"] = "RobotAPI";
|
|
2172
|
+
JobSourceType["CommandLine"] = "CommandLine";
|
|
2173
|
+
JobSourceType["RobotNetAPI"] = "RobotNetAPI";
|
|
2174
|
+
JobSourceType["Autopilot"] = "Autopilot";
|
|
2175
|
+
JobSourceType["TestManager"] = "TestManager";
|
|
2176
|
+
JobSourceType["AgentService"] = "AgentService";
|
|
2177
|
+
JobSourceType["ProcessOrchestration"] = "ProcessOrchestration";
|
|
2178
|
+
JobSourceType["PluginEcosystem"] = "PluginEcosystem";
|
|
2179
|
+
JobSourceType["PerformanceTesting"] = "PerformanceTesting";
|
|
2180
|
+
JobSourceType["AgentHub"] = "AgentHub";
|
|
2181
|
+
JobSourceType["ApiWorkflow"] = "ApiWorkflow";
|
|
2182
|
+
JobSourceType["CaseManagement"] = "CaseManagement";
|
|
2183
|
+
})(JobSourceType || (JobSourceType = {}));
|
|
2184
|
+
/**
|
|
2185
|
+
* Enum for stop strategy
|
|
2186
|
+
*/
|
|
2187
|
+
var StopStrategy;
|
|
2188
|
+
(function (StopStrategy) {
|
|
2189
|
+
StopStrategy["SoftStop"] = "SoftStop";
|
|
2190
|
+
StopStrategy["Kill"] = "Kill";
|
|
2191
|
+
})(StopStrategy || (StopStrategy = {}));
|
|
2192
|
+
/**
|
|
2193
|
+
* Enum for runtime type
|
|
2194
|
+
*/
|
|
2195
|
+
var RuntimeType;
|
|
2196
|
+
(function (RuntimeType) {
|
|
2197
|
+
RuntimeType["NonProduction"] = "NonProduction";
|
|
2198
|
+
RuntimeType["Attended"] = "Attended";
|
|
2199
|
+
RuntimeType["Unattended"] = "Unattended";
|
|
2200
|
+
RuntimeType["Development"] = "Development";
|
|
2201
|
+
RuntimeType["Studio"] = "Studio";
|
|
2202
|
+
RuntimeType["RpaDeveloper"] = "RpaDeveloper";
|
|
2203
|
+
RuntimeType["StudioX"] = "StudioX";
|
|
2204
|
+
RuntimeType["CitizenDeveloper"] = "CitizenDeveloper";
|
|
2205
|
+
RuntimeType["Headless"] = "Headless";
|
|
2206
|
+
RuntimeType["StudioPro"] = "StudioPro";
|
|
2207
|
+
RuntimeType["RpaDeveloperPro"] = "RpaDeveloperPro";
|
|
2208
|
+
RuntimeType["TestAutomation"] = "TestAutomation";
|
|
2209
|
+
RuntimeType["AutomationCloud"] = "AutomationCloud";
|
|
2210
|
+
RuntimeType["Serverless"] = "Serverless";
|
|
2211
|
+
RuntimeType["AutomationKit"] = "AutomationKit";
|
|
2212
|
+
RuntimeType["ServerlessTestAutomation"] = "ServerlessTestAutomation";
|
|
2213
|
+
RuntimeType["AutomationCloudTestAutomation"] = "AutomationCloudTestAutomation";
|
|
2214
|
+
RuntimeType["AttendedStudioWeb"] = "AttendedStudioWeb";
|
|
2215
|
+
RuntimeType["Hosting"] = "Hosting";
|
|
2216
|
+
RuntimeType["AssistantWeb"] = "AssistantWeb";
|
|
2217
|
+
RuntimeType["ProcessOrchestration"] = "ProcessOrchestration";
|
|
2218
|
+
RuntimeType["AgentService"] = "AgentService";
|
|
2219
|
+
RuntimeType["AppTest"] = "AppTest";
|
|
2220
|
+
RuntimeType["PerformanceTest"] = "PerformanceTest";
|
|
2221
|
+
RuntimeType["BusinessRule"] = "BusinessRule";
|
|
2222
|
+
RuntimeType["CaseManagement"] = "CaseManagement";
|
|
2223
|
+
RuntimeType["Flow"] = "Flow";
|
|
2224
|
+
})(RuntimeType || (RuntimeType = {}));
|
|
2225
|
+
/**
|
|
2226
|
+
* Enum for job type
|
|
2227
|
+
*/
|
|
2228
|
+
var JobType;
|
|
2229
|
+
(function (JobType) {
|
|
2230
|
+
JobType["Unattended"] = "Unattended";
|
|
2231
|
+
JobType["Attended"] = "Attended";
|
|
2232
|
+
JobType["ServerlessGeneric"] = "ServerlessGeneric";
|
|
2233
|
+
})(JobType || (JobType = {}));
|
|
2234
|
+
|
|
2035
2235
|
/**
|
|
2036
2236
|
* Service for interacting with UiPath Orchestrator Jobs API
|
|
2037
2237
|
*/
|
|
@@ -2201,6 +2401,86 @@ class JobService extends FolderScopedService {
|
|
|
2201
2401
|
}
|
|
2202
2402
|
return null;
|
|
2203
2403
|
}
|
|
2404
|
+
/**
|
|
2405
|
+
* Stops one or more jobs by their UUID keys.
|
|
2406
|
+
*
|
|
2407
|
+
* Sends a stop request for the specified jobs to the Orchestrator. Throws if any keys cannot be resolved.
|
|
2408
|
+
*
|
|
2409
|
+
* @param jobKeys - Array of job UUID keys to stop (e.g., from {@link JobGetResponse}.key)
|
|
2410
|
+
* @param folderId - The folder ID where the jobs reside (required)
|
|
2411
|
+
* @param options - Optional {@link JobStopOptions} including stop strategy
|
|
2412
|
+
* @returns Promise that resolves when the jobs are stopped successfully, or rejects on failure
|
|
2413
|
+
*
|
|
2414
|
+
* @example
|
|
2415
|
+
* ```typescript
|
|
2416
|
+
* // Stop a single job with default soft stop
|
|
2417
|
+
* await jobs.stop([<jobKey>], <folderId>);
|
|
2418
|
+
* ```
|
|
2419
|
+
*
|
|
2420
|
+
* @example
|
|
2421
|
+
* ```typescript
|
|
2422
|
+
* import { StopStrategy } from '@uipath/uipath-typescript/jobs';
|
|
2423
|
+
*
|
|
2424
|
+
* // Force-kill multiple jobs
|
|
2425
|
+
* await jobs.stop(
|
|
2426
|
+
* [<jobKey1>, <jobKey2>],
|
|
2427
|
+
* <folderId>,
|
|
2428
|
+
* { strategy: StopStrategy.Kill }
|
|
2429
|
+
* );
|
|
2430
|
+
* ```
|
|
2431
|
+
*/
|
|
2432
|
+
async stop(jobKeys, folderId, options) {
|
|
2433
|
+
if (jobKeys.length === 0) {
|
|
2434
|
+
return;
|
|
2435
|
+
}
|
|
2436
|
+
if (!folderId) {
|
|
2437
|
+
throw new ValidationError({ message: 'folderId is required for stop' });
|
|
2438
|
+
}
|
|
2439
|
+
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
2440
|
+
const strategy = options?.strategy ?? StopStrategy.SoftStop;
|
|
2441
|
+
const jobIds = await this.resolveJobKeys(jobKeys, folderId);
|
|
2442
|
+
await this.stopJobsByIds(jobIds, strategy, headers);
|
|
2443
|
+
}
|
|
2444
|
+
/**
|
|
2445
|
+
* Resumes a suspended job.
|
|
2446
|
+
*
|
|
2447
|
+
* Sends a resume request to a job that is currently in the `Suspended` state.
|
|
2448
|
+
* The job transitions to `Resumed` and then to `Running` as it continues execution. Optionally pass
|
|
2449
|
+
* input arguments to provide data for the resumed workflow.
|
|
2450
|
+
*
|
|
2451
|
+
* @param jobKey - The unique key (GUID) of the suspended job to resume
|
|
2452
|
+
* @param folderId - The folder ID where the job resides
|
|
2453
|
+
* @param options - Optional parameters including input arguments
|
|
2454
|
+
* @returns Promise that resolves when the job is resumed successfully, or rejects on failure
|
|
2455
|
+
*
|
|
2456
|
+
* @example
|
|
2457
|
+
* ```typescript
|
|
2458
|
+
* // Resume a suspended job
|
|
2459
|
+
* await jobs.resume(<jobKey>, <folderId>);
|
|
2460
|
+
* ```
|
|
2461
|
+
*
|
|
2462
|
+
* @example
|
|
2463
|
+
* ```typescript
|
|
2464
|
+
* // Resume with input arguments
|
|
2465
|
+
* await jobs.resume(<jobKey>, <folderId>, {
|
|
2466
|
+
* inputArguments: { approved: true }
|
|
2467
|
+
* });
|
|
2468
|
+
* ```
|
|
2469
|
+
*/
|
|
2470
|
+
async resume(jobKey, folderId, options) {
|
|
2471
|
+
if (!jobKey) {
|
|
2472
|
+
throw new ValidationError({ message: 'jobKey is required for resume' });
|
|
2473
|
+
}
|
|
2474
|
+
if (!folderId) {
|
|
2475
|
+
throw new ValidationError({ message: 'folderId is required for resume' });
|
|
2476
|
+
}
|
|
2477
|
+
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
2478
|
+
const body = { jobKey };
|
|
2479
|
+
if (options?.inputArguments) {
|
|
2480
|
+
body.inputArguments = JSON.stringify(options.inputArguments);
|
|
2481
|
+
}
|
|
2482
|
+
await this.post(JOB_ENDPOINTS.RESUME, body, { headers });
|
|
2483
|
+
}
|
|
2204
2484
|
/**
|
|
2205
2485
|
* Downloads the output file content via the Attachments API.
|
|
2206
2486
|
* 1. Fetches blob access info from the attachment using AttachmentService
|
|
@@ -2235,6 +2515,43 @@ class JobService extends FolderScopedService {
|
|
|
2235
2515
|
throw new ServerError({ message: 'Failed to parse job output file as JSON' });
|
|
2236
2516
|
}
|
|
2237
2517
|
}
|
|
2518
|
+
/**
|
|
2519
|
+
* Resolves job UUID keys to integer IDs via the getAll method.
|
|
2520
|
+
* Chunks keys into batches to avoid URL length limits.
|
|
2521
|
+
*/
|
|
2522
|
+
async resolveJobKeys(jobKeys, folderId) {
|
|
2523
|
+
const uniqueKeys = [...new Set(jobKeys)];
|
|
2524
|
+
const keyToIdMap = new Map();
|
|
2525
|
+
const chunks = [];
|
|
2526
|
+
for (let i = 0; i < uniqueKeys.length; i += JOB_KEY_RESOLUTION_CHUNK_SIZE) {
|
|
2527
|
+
chunks.push(uniqueKeys.slice(i, i + JOB_KEY_RESOLUTION_CHUNK_SIZE));
|
|
2528
|
+
}
|
|
2529
|
+
const results = await Promise.all(chunks.map((chunk) => {
|
|
2530
|
+
const filterValues = chunk.map((key) => `'${key}'`).join(',');
|
|
2531
|
+
return this.getAll({
|
|
2532
|
+
folderId,
|
|
2533
|
+
filter: `key in (${filterValues})`,
|
|
2534
|
+
select: 'id,key',
|
|
2535
|
+
pageSize: chunk.length,
|
|
2536
|
+
});
|
|
2537
|
+
}));
|
|
2538
|
+
for (const response of results) {
|
|
2539
|
+
for (const job of response.items) {
|
|
2540
|
+
keyToIdMap.set(job.key, job.id);
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
const missingKeys = uniqueKeys.filter((key) => !keyToIdMap.has(key));
|
|
2544
|
+
if (missingKeys.length > 0) {
|
|
2545
|
+
throw new ValidationError({ message: `Jobs not found for keys: ${missingKeys.join(', ')}` });
|
|
2546
|
+
}
|
|
2547
|
+
return uniqueKeys.map((key) => keyToIdMap.get(key));
|
|
2548
|
+
}
|
|
2549
|
+
/**
|
|
2550
|
+
* Calls the StopJobs OData action with resolved integer IDs.
|
|
2551
|
+
*/
|
|
2552
|
+
async stopJobsByIds(jobIds, strategy, headers) {
|
|
2553
|
+
await this.post(JOB_ENDPOINTS.STOP, { jobIds, strategy }, { headers });
|
|
2554
|
+
}
|
|
2238
2555
|
}
|
|
2239
2556
|
__decorate([
|
|
2240
2557
|
track('Jobs.GetAll')
|
|
@@ -2245,6 +2562,12 @@ __decorate([
|
|
|
2245
2562
|
__decorate([
|
|
2246
2563
|
track('Jobs.GetOutput')
|
|
2247
2564
|
], JobService.prototype, "getOutput", null);
|
|
2565
|
+
__decorate([
|
|
2566
|
+
track('Jobs.Stop')
|
|
2567
|
+
], JobService.prototype, "stop", null);
|
|
2568
|
+
__decorate([
|
|
2569
|
+
track('Jobs.Resume')
|
|
2570
|
+
], JobService.prototype, "resume", null);
|
|
2248
2571
|
|
|
2249
2572
|
/**
|
|
2250
2573
|
* Enum for job sub-state
|
|
@@ -2287,4 +2610,4 @@ var JobState;
|
|
|
2287
2610
|
JobState["Resumed"] = "Resumed";
|
|
2288
2611
|
})(JobState || (JobState = {}));
|
|
2289
2612
|
|
|
2290
|
-
export { JobService, JobState, JobSubState, JobService as Jobs, ServerlessJobType, createJobWithMethods };
|
|
2613
|
+
export { JobService, JobState, JobSubState, JobService as Jobs, ServerlessJobType, StopStrategy, createJobWithMethods };
|
|
@@ -601,7 +601,11 @@ class ApiClient {
|
|
|
601
601
|
const text = await response.text();
|
|
602
602
|
return text;
|
|
603
603
|
}
|
|
604
|
-
|
|
604
|
+
const text = await response.text();
|
|
605
|
+
if (!text) {
|
|
606
|
+
return undefined;
|
|
607
|
+
}
|
|
608
|
+
return JSON.parse(text);
|
|
605
609
|
}
|
|
606
610
|
catch (error) {
|
|
607
611
|
// If it's already one of our errors, re-throw it
|
|
@@ -1162,8 +1166,9 @@ class PaginationHelpers {
|
|
|
1162
1166
|
});
|
|
1163
1167
|
}
|
|
1164
1168
|
// Extract and transform items from response
|
|
1165
|
-
|
|
1166
|
-
const
|
|
1169
|
+
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1170
|
+
const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
|
|
1171
|
+
const totalCount = Array.isArray(response.data) ? undefined : response.data?.[totalCountField];
|
|
1167
1172
|
// Parse items - automatically handle JSON string responses
|
|
1168
1173
|
const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
|
|
1169
1174
|
const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
|
|
@@ -1414,7 +1419,7 @@ class BaseService {
|
|
|
1414
1419
|
const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
|
|
1415
1420
|
// Prepare request parameters based on pagination type
|
|
1416
1421
|
const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
|
|
1417
|
-
// For POST requests, merge pagination params into body; for GET, use query params
|
|
1422
|
+
// For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
|
|
1418
1423
|
if (method.toUpperCase() === 'POST') {
|
|
1419
1424
|
const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
|
|
1420
1425
|
options.body = {
|
|
@@ -1422,6 +1427,7 @@ class BaseService {
|
|
|
1422
1427
|
...options.params,
|
|
1423
1428
|
...requestParams
|
|
1424
1429
|
};
|
|
1430
|
+
options.params = undefined;
|
|
1425
1431
|
}
|
|
1426
1432
|
else {
|
|
1427
1433
|
// Merge pagination parameters with existing parameters
|
|
@@ -1462,7 +1468,6 @@ class BaseService {
|
|
|
1462
1468
|
if (params.pageNumber && params.pageNumber > 1) {
|
|
1463
1469
|
requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
|
|
1464
1470
|
}
|
|
1465
|
-
// Include total count for ODATA APIs
|
|
1466
1471
|
{
|
|
1467
1472
|
requestParams[countParam] = true;
|
|
1468
1473
|
}
|
|
@@ -1490,8 +1495,9 @@ class BaseService {
|
|
|
1490
1495
|
const totalCountField = fields.totalCountField || 'totalRecordCount';
|
|
1491
1496
|
const continuationTokenField = fields.continuationTokenField || 'continuationToken';
|
|
1492
1497
|
// Extract items and metadata
|
|
1493
|
-
|
|
1494
|
-
const
|
|
1498
|
+
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1499
|
+
const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
|
|
1500
|
+
const totalCount = Array.isArray(response.data) ? undefined : response.data[totalCountField];
|
|
1495
1501
|
const continuationToken = response.data[continuationTokenField];
|
|
1496
1502
|
// Determine if there are more pages
|
|
1497
1503
|
const hasMore = this.determineHasMorePages(paginationType, {
|
|
@@ -1729,7 +1735,7 @@ class BpmnHelpers {
|
|
|
1729
1735
|
// Connection string placeholder that will be replaced during build
|
|
1730
1736
|
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
1737
|
// SDK Version placeholder
|
|
1732
|
-
const SDK_VERSION = "1.3.
|
|
1738
|
+
const SDK_VERSION = "1.3.3";
|
|
1733
1739
|
const VERSION = "Version";
|
|
1734
1740
|
const SERVICE = "Service";
|
|
1735
1741
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -599,7 +599,11 @@ class ApiClient {
|
|
|
599
599
|
const text = await response.text();
|
|
600
600
|
return text;
|
|
601
601
|
}
|
|
602
|
-
|
|
602
|
+
const text = await response.text();
|
|
603
|
+
if (!text) {
|
|
604
|
+
return undefined;
|
|
605
|
+
}
|
|
606
|
+
return JSON.parse(text);
|
|
603
607
|
}
|
|
604
608
|
catch (error) {
|
|
605
609
|
// If it's already one of our errors, re-throw it
|
|
@@ -1160,8 +1164,9 @@ class PaginationHelpers {
|
|
|
1160
1164
|
});
|
|
1161
1165
|
}
|
|
1162
1166
|
// Extract and transform items from response
|
|
1163
|
-
|
|
1164
|
-
const
|
|
1167
|
+
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1168
|
+
const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
|
|
1169
|
+
const totalCount = Array.isArray(response.data) ? undefined : response.data?.[totalCountField];
|
|
1165
1170
|
// Parse items - automatically handle JSON string responses
|
|
1166
1171
|
const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
|
|
1167
1172
|
const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
|
|
@@ -1412,7 +1417,7 @@ class BaseService {
|
|
|
1412
1417
|
const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
|
|
1413
1418
|
// Prepare request parameters based on pagination type
|
|
1414
1419
|
const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
|
|
1415
|
-
// For POST requests, merge pagination params into body; for GET, use query params
|
|
1420
|
+
// For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
|
|
1416
1421
|
if (method.toUpperCase() === 'POST') {
|
|
1417
1422
|
const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
|
|
1418
1423
|
options.body = {
|
|
@@ -1420,6 +1425,7 @@ class BaseService {
|
|
|
1420
1425
|
...options.params,
|
|
1421
1426
|
...requestParams
|
|
1422
1427
|
};
|
|
1428
|
+
options.params = undefined;
|
|
1423
1429
|
}
|
|
1424
1430
|
else {
|
|
1425
1431
|
// Merge pagination parameters with existing parameters
|
|
@@ -1460,7 +1466,6 @@ class BaseService {
|
|
|
1460
1466
|
if (params.pageNumber && params.pageNumber > 1) {
|
|
1461
1467
|
requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
|
|
1462
1468
|
}
|
|
1463
|
-
// Include total count for ODATA APIs
|
|
1464
1469
|
{
|
|
1465
1470
|
requestParams[countParam] = true;
|
|
1466
1471
|
}
|
|
@@ -1488,8 +1493,9 @@ class BaseService {
|
|
|
1488
1493
|
const totalCountField = fields.totalCountField || 'totalRecordCount';
|
|
1489
1494
|
const continuationTokenField = fields.continuationTokenField || 'continuationToken';
|
|
1490
1495
|
// Extract items and metadata
|
|
1491
|
-
|
|
1492
|
-
const
|
|
1496
|
+
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1497
|
+
const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
|
|
1498
|
+
const totalCount = Array.isArray(response.data) ? undefined : response.data[totalCountField];
|
|
1493
1499
|
const continuationToken = response.data[continuationTokenField];
|
|
1494
1500
|
// Determine if there are more pages
|
|
1495
1501
|
const hasMore = this.determineHasMorePages(paginationType, {
|
|
@@ -1727,7 +1733,7 @@ class BpmnHelpers {
|
|
|
1727
1733
|
// Connection string placeholder that will be replaced during build
|
|
1728
1734
|
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";
|
|
1729
1735
|
// SDK Version placeholder
|
|
1730
|
-
const SDK_VERSION = "1.3.
|
|
1736
|
+
const SDK_VERSION = "1.3.3";
|
|
1731
1737
|
const VERSION = "Version";
|
|
1732
1738
|
const SERVICE = "Service";
|
|
1733
1739
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
package/dist/processes/index.cjs
CHANGED
|
@@ -600,7 +600,11 @@ class ApiClient {
|
|
|
600
600
|
const text = await response.text();
|
|
601
601
|
return text;
|
|
602
602
|
}
|
|
603
|
-
|
|
603
|
+
const text = await response.text();
|
|
604
|
+
if (!text) {
|
|
605
|
+
return undefined;
|
|
606
|
+
}
|
|
607
|
+
return JSON.parse(text);
|
|
604
608
|
}
|
|
605
609
|
catch (error) {
|
|
606
610
|
// If it's already one of our errors, re-throw it
|
|
@@ -1295,8 +1299,9 @@ class PaginationHelpers {
|
|
|
1295
1299
|
});
|
|
1296
1300
|
}
|
|
1297
1301
|
// Extract and transform items from response
|
|
1298
|
-
|
|
1299
|
-
const
|
|
1302
|
+
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1303
|
+
const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
|
|
1304
|
+
const totalCount = Array.isArray(response.data) ? undefined : response.data?.[totalCountField];
|
|
1300
1305
|
// Parse items - automatically handle JSON string responses
|
|
1301
1306
|
const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
|
|
1302
1307
|
const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
|
|
@@ -1547,7 +1552,7 @@ class BaseService {
|
|
|
1547
1552
|
const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
|
|
1548
1553
|
// Prepare request parameters based on pagination type
|
|
1549
1554
|
const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
|
|
1550
|
-
// For POST requests, merge pagination params into body; for GET, use query params
|
|
1555
|
+
// For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
|
|
1551
1556
|
if (method.toUpperCase() === 'POST') {
|
|
1552
1557
|
const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
|
|
1553
1558
|
options.body = {
|
|
@@ -1555,6 +1560,7 @@ class BaseService {
|
|
|
1555
1560
|
...options.params,
|
|
1556
1561
|
...requestParams
|
|
1557
1562
|
};
|
|
1563
|
+
options.params = undefined;
|
|
1558
1564
|
}
|
|
1559
1565
|
else {
|
|
1560
1566
|
// Merge pagination parameters with existing parameters
|
|
@@ -1595,7 +1601,6 @@ class BaseService {
|
|
|
1595
1601
|
if (params.pageNumber && params.pageNumber > 1) {
|
|
1596
1602
|
requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
|
|
1597
1603
|
}
|
|
1598
|
-
// Include total count for ODATA APIs
|
|
1599
1604
|
{
|
|
1600
1605
|
requestParams[countParam] = true;
|
|
1601
1606
|
}
|
|
@@ -1623,8 +1628,9 @@ class BaseService {
|
|
|
1623
1628
|
const totalCountField = fields.totalCountField || 'totalRecordCount';
|
|
1624
1629
|
const continuationTokenField = fields.continuationTokenField || 'continuationToken';
|
|
1625
1630
|
// Extract items and metadata
|
|
1626
|
-
|
|
1627
|
-
const
|
|
1631
|
+
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1632
|
+
const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
|
|
1633
|
+
const totalCount = Array.isArray(response.data) ? undefined : response.data[totalCountField];
|
|
1628
1634
|
const continuationToken = response.data[continuationTokenField];
|
|
1629
1635
|
// Determine if there are more pages
|
|
1630
1636
|
const hasMore = this.determineHasMorePages(paginationType, {
|
|
@@ -1709,7 +1715,7 @@ const PROCESS_ENDPOINTS = {
|
|
|
1709
1715
|
// Connection string placeholder that will be replaced during build
|
|
1710
1716
|
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";
|
|
1711
1717
|
// SDK Version placeholder
|
|
1712
|
-
const SDK_VERSION = "1.3.
|
|
1718
|
+
const SDK_VERSION = "1.3.3";
|
|
1713
1719
|
const VERSION = "Version";
|
|
1714
1720
|
const SERVICE = "Service";
|
|
1715
1721
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|