@uipath/uipath-typescript 1.3.1 → 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.
@@ -600,7 +600,11 @@ class ApiClient {
600
600
  const text = await response.text();
601
601
  return text;
602
602
  }
603
- return response.json();
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
@@ -1232,8 +1236,9 @@ class PaginationHelpers {
1232
1236
  });
1233
1237
  }
1234
1238
  // Extract and transform items from response
1235
- const rawItems = response.data?.[itemsField];
1236
- const totalCount = response.data?.[totalCountField];
1239
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1240
+ const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
1241
+ const totalCount = Array.isArray(response.data) ? undefined : response.data?.[totalCountField];
1237
1242
  // Parse items - automatically handle JSON string responses
1238
1243
  const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
1239
1244
  const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
@@ -1484,7 +1489,7 @@ class BaseService {
1484
1489
  const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
1485
1490
  // Prepare request parameters based on pagination type
1486
1491
  const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
1487
- // For POST requests, merge pagination params into body; for GET, use query params
1492
+ // For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
1488
1493
  if (method.toUpperCase() === 'POST') {
1489
1494
  const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
1490
1495
  options.body = {
@@ -1492,6 +1497,7 @@ class BaseService {
1492
1497
  ...options.params,
1493
1498
  ...requestParams
1494
1499
  };
1500
+ options.params = undefined;
1495
1501
  }
1496
1502
  else {
1497
1503
  // Merge pagination parameters with existing parameters
@@ -1532,7 +1538,6 @@ class BaseService {
1532
1538
  if (params.pageNumber && params.pageNumber > 1) {
1533
1539
  requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
1534
1540
  }
1535
- // Include total count for ODATA APIs
1536
1541
  {
1537
1542
  requestParams[countParam] = true;
1538
1543
  }
@@ -1560,8 +1565,9 @@ class BaseService {
1560
1565
  const totalCountField = fields.totalCountField || 'totalRecordCount';
1561
1566
  const continuationTokenField = fields.continuationTokenField || 'continuationToken';
1562
1567
  // Extract items and metadata
1563
- const items = response.data[itemsField] || [];
1564
- const totalCount = response.data[totalCountField];
1568
+ // Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
1569
+ const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
1570
+ const totalCount = Array.isArray(response.data) ? undefined : response.data[totalCountField];
1565
1571
  const continuationToken = response.data[continuationTokenField];
1566
1572
  // Determine if there are more pages
1567
1573
  const hasMore = this.determineHasMorePages(paginationType, {
@@ -1657,6 +1663,20 @@ function createJobMethods(jobData, service) {
1657
1663
  throw new Error('Job folderId is undefined');
1658
1664
  return service.getOutput(jobData.key, jobData.folderId);
1659
1665
  },
1666
+ async stop(options) {
1667
+ if (!jobData.key)
1668
+ throw new Error('Job key is undefined');
1669
+ if (!jobData.folderId)
1670
+ throw new Error('Job folderId is undefined');
1671
+ return service.stop([jobData.key], jobData.folderId, options);
1672
+ },
1673
+ async resume(options) {
1674
+ if (!jobData.key)
1675
+ throw new Error('Job key is undefined');
1676
+ if (!jobData.folderId)
1677
+ throw new Error('Job folderId is undefined');
1678
+ return service.resume(jobData.key, jobData.folderId, options);
1679
+ },
1660
1680
  };
1661
1681
  }
1662
1682
  /**
@@ -1685,6 +1705,8 @@ const ORCHESTRATOR_BASE = 'orchestrator_';
1685
1705
  const JOB_ENDPOINTS = {
1686
1706
  GET_ALL: `${ORCHESTRATOR_BASE}/odata/Jobs`,
1687
1707
  GET_BY_KEY: (identifier) => `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.GetByKey(identifier=${identifier})`,
1708
+ STOP: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.StopJobs`,
1709
+ RESUME: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.ResumeJob`,
1688
1710
  };
1689
1711
  /**
1690
1712
  * Orchestrator Attachment Service Endpoints
@@ -1693,6 +1715,8 @@ const ORCHESTRATOR_ATTACHMENT_ENDPOINTS = {
1693
1715
  GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Attachments(${id})`,
1694
1716
  };
1695
1717
 
1718
+ /** Maximum number of job keys to resolve in a single OData filter query */
1719
+ const JOB_KEY_RESOLUTION_CHUNK_SIZE = 50;
1696
1720
  /**
1697
1721
  * Maps fields for Job entities to ensure consistent naming
1698
1722
  * Semantic renames only — case conversion handled by pascalToCamelCaseKeys()
@@ -1714,7 +1738,7 @@ const JobMap = {
1714
1738
  // Connection string placeholder that will be replaced during build
1715
1739
  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";
1716
1740
  // SDK Version placeholder
1717
- const SDK_VERSION = "1.3.1";
1741
+ const SDK_VERSION = "1.3.3";
1718
1742
  const VERSION = "Version";
1719
1743
  const SERVICE = "Service";
1720
1744
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -2034,6 +2058,182 @@ __decorate([
2034
2058
  track('Attachments.GetById')
2035
2059
  ], AttachmentService.prototype, "getById", null);
2036
2060
 
2061
+ /**
2062
+ * Enum for package types
2063
+ */
2064
+ var PackageType;
2065
+ (function (PackageType) {
2066
+ PackageType["Undefined"] = "Undefined";
2067
+ PackageType["Process"] = "Process";
2068
+ PackageType["ProcessOrchestration"] = "ProcessOrchestration";
2069
+ PackageType["WebApp"] = "WebApp";
2070
+ PackageType["Agent"] = "Agent";
2071
+ PackageType["TestAutomationProcess"] = "TestAutomationProcess";
2072
+ PackageType["Api"] = "Api";
2073
+ PackageType["MCPServer"] = "MCPServer";
2074
+ PackageType["BusinessRules"] = "BusinessRules";
2075
+ PackageType["CaseManagement"] = "CaseManagement";
2076
+ PackageType["Flow"] = "Flow";
2077
+ PackageType["Function"] = "Function";
2078
+ })(PackageType || (PackageType = {}));
2079
+ /**
2080
+ * Enum for job priority
2081
+ */
2082
+ var JobPriority;
2083
+ (function (JobPriority) {
2084
+ JobPriority["Low"] = "Low";
2085
+ JobPriority["Normal"] = "Normal";
2086
+ JobPriority["High"] = "High";
2087
+ })(JobPriority || (JobPriority = {}));
2088
+ /**
2089
+ * Enum for target framework
2090
+ */
2091
+ var TargetFramework;
2092
+ (function (TargetFramework) {
2093
+ TargetFramework["Legacy"] = "Legacy";
2094
+ TargetFramework["Windows"] = "Windows";
2095
+ TargetFramework["Portable"] = "Portable";
2096
+ })(TargetFramework || (TargetFramework = {}));
2097
+ /**
2098
+ * Enum for robot size
2099
+ */
2100
+ var RobotSize;
2101
+ (function (RobotSize) {
2102
+ RobotSize["Small"] = "Small";
2103
+ RobotSize["Standard"] = "Standard";
2104
+ RobotSize["Medium"] = "Medium";
2105
+ RobotSize["Large"] = "Large";
2106
+ })(RobotSize || (RobotSize = {}));
2107
+ /**
2108
+ * Enum for remote control access
2109
+ */
2110
+ var RemoteControlAccess;
2111
+ (function (RemoteControlAccess) {
2112
+ RemoteControlAccess["None"] = "None";
2113
+ RemoteControlAccess["ReadOnly"] = "ReadOnly";
2114
+ RemoteControlAccess["Full"] = "Full";
2115
+ })(RemoteControlAccess || (RemoteControlAccess = {}));
2116
+ /**
2117
+ * Enum for process start strategy
2118
+ */
2119
+ var StartStrategy;
2120
+ (function (StartStrategy) {
2121
+ StartStrategy["All"] = "All";
2122
+ StartStrategy["Specific"] = "Specific";
2123
+ StartStrategy["RobotCount"] = "RobotCount";
2124
+ StartStrategy["JobsCount"] = "JobsCount";
2125
+ StartStrategy["ModernJobsCount"] = "ModernJobsCount";
2126
+ })(StartStrategy || (StartStrategy = {}));
2127
+ /**
2128
+ * Enum for package source type
2129
+ */
2130
+ var PackageSourceType;
2131
+ (function (PackageSourceType) {
2132
+ PackageSourceType["Manual"] = "Manual";
2133
+ PackageSourceType["Schedule"] = "Schedule";
2134
+ PackageSourceType["Queue"] = "Queue";
2135
+ PackageSourceType["StudioWeb"] = "StudioWeb";
2136
+ PackageSourceType["IntegrationTrigger"] = "IntegrationTrigger";
2137
+ PackageSourceType["StudioDesktop"] = "StudioDesktop";
2138
+ PackageSourceType["AutomationOpsPipelines"] = "AutomationOpsPipelines";
2139
+ PackageSourceType["Apps"] = "Apps";
2140
+ PackageSourceType["SAP"] = "SAP";
2141
+ PackageSourceType["HttpTrigger"] = "HttpTrigger";
2142
+ PackageSourceType["HttpTriggerWithCallback"] = "HttpTriggerWithCallback";
2143
+ PackageSourceType["RobotAPI"] = "RobotAPI";
2144
+ PackageSourceType["Assistant"] = "Assistant";
2145
+ PackageSourceType["CommandLine"] = "CommandLine";
2146
+ PackageSourceType["RobotNetAPI"] = "RobotNetAPI";
2147
+ PackageSourceType["Autopilot"] = "Autopilot";
2148
+ PackageSourceType["TestManager"] = "TestManager";
2149
+ PackageSourceType["AgentService"] = "AgentService";
2150
+ PackageSourceType["ProcessOrchestration"] = "ProcessOrchestration";
2151
+ PackageSourceType["PluginEcosystem"] = "PluginEcosystem";
2152
+ PackageSourceType["PerformanceTesting"] = "PerformanceTesting";
2153
+ PackageSourceType["AgentHub"] = "AgentHub";
2154
+ PackageSourceType["ApiWorkflow"] = "ApiWorkflow";
2155
+ })(PackageSourceType || (PackageSourceType = {}));
2156
+ /**
2157
+ * Enum for job source type
2158
+ */
2159
+ var JobSourceType;
2160
+ (function (JobSourceType) {
2161
+ JobSourceType["Manual"] = "Manual";
2162
+ JobSourceType["Schedule"] = "Schedule";
2163
+ JobSourceType["Agent"] = "Agent";
2164
+ JobSourceType["Queue"] = "Queue";
2165
+ JobSourceType["StudioWeb"] = "StudioWeb";
2166
+ JobSourceType["IntegrationTrigger"] = "IntegrationTrigger";
2167
+ JobSourceType["StudioDesktop"] = "StudioDesktop";
2168
+ JobSourceType["AutomationOpsPipelines"] = "AutomationOpsPipelines";
2169
+ JobSourceType["Apps"] = "Apps";
2170
+ JobSourceType["SAP"] = "SAP";
2171
+ JobSourceType["HttpTrigger"] = "HttpTrigger";
2172
+ JobSourceType["HttpTriggerCallback"] = "HttpTriggerCallback";
2173
+ JobSourceType["RobotAPI"] = "RobotAPI";
2174
+ JobSourceType["CommandLine"] = "CommandLine";
2175
+ JobSourceType["RobotNetAPI"] = "RobotNetAPI";
2176
+ JobSourceType["Autopilot"] = "Autopilot";
2177
+ JobSourceType["TestManager"] = "TestManager";
2178
+ JobSourceType["AgentService"] = "AgentService";
2179
+ JobSourceType["ProcessOrchestration"] = "ProcessOrchestration";
2180
+ JobSourceType["PluginEcosystem"] = "PluginEcosystem";
2181
+ JobSourceType["PerformanceTesting"] = "PerformanceTesting";
2182
+ JobSourceType["AgentHub"] = "AgentHub";
2183
+ JobSourceType["ApiWorkflow"] = "ApiWorkflow";
2184
+ JobSourceType["CaseManagement"] = "CaseManagement";
2185
+ })(JobSourceType || (JobSourceType = {}));
2186
+ /**
2187
+ * Enum for stop strategy
2188
+ */
2189
+ exports.StopStrategy = void 0;
2190
+ (function (StopStrategy) {
2191
+ StopStrategy["SoftStop"] = "SoftStop";
2192
+ StopStrategy["Kill"] = "Kill";
2193
+ })(exports.StopStrategy || (exports.StopStrategy = {}));
2194
+ /**
2195
+ * Enum for runtime type
2196
+ */
2197
+ var RuntimeType;
2198
+ (function (RuntimeType) {
2199
+ RuntimeType["NonProduction"] = "NonProduction";
2200
+ RuntimeType["Attended"] = "Attended";
2201
+ RuntimeType["Unattended"] = "Unattended";
2202
+ RuntimeType["Development"] = "Development";
2203
+ RuntimeType["Studio"] = "Studio";
2204
+ RuntimeType["RpaDeveloper"] = "RpaDeveloper";
2205
+ RuntimeType["StudioX"] = "StudioX";
2206
+ RuntimeType["CitizenDeveloper"] = "CitizenDeveloper";
2207
+ RuntimeType["Headless"] = "Headless";
2208
+ RuntimeType["StudioPro"] = "StudioPro";
2209
+ RuntimeType["RpaDeveloperPro"] = "RpaDeveloperPro";
2210
+ RuntimeType["TestAutomation"] = "TestAutomation";
2211
+ RuntimeType["AutomationCloud"] = "AutomationCloud";
2212
+ RuntimeType["Serverless"] = "Serverless";
2213
+ RuntimeType["AutomationKit"] = "AutomationKit";
2214
+ RuntimeType["ServerlessTestAutomation"] = "ServerlessTestAutomation";
2215
+ RuntimeType["AutomationCloudTestAutomation"] = "AutomationCloudTestAutomation";
2216
+ RuntimeType["AttendedStudioWeb"] = "AttendedStudioWeb";
2217
+ RuntimeType["Hosting"] = "Hosting";
2218
+ RuntimeType["AssistantWeb"] = "AssistantWeb";
2219
+ RuntimeType["ProcessOrchestration"] = "ProcessOrchestration";
2220
+ RuntimeType["AgentService"] = "AgentService";
2221
+ RuntimeType["AppTest"] = "AppTest";
2222
+ RuntimeType["PerformanceTest"] = "PerformanceTest";
2223
+ RuntimeType["BusinessRule"] = "BusinessRule";
2224
+ RuntimeType["CaseManagement"] = "CaseManagement";
2225
+ RuntimeType["Flow"] = "Flow";
2226
+ })(RuntimeType || (RuntimeType = {}));
2227
+ /**
2228
+ * Enum for job type
2229
+ */
2230
+ var JobType;
2231
+ (function (JobType) {
2232
+ JobType["Unattended"] = "Unattended";
2233
+ JobType["Attended"] = "Attended";
2234
+ JobType["ServerlessGeneric"] = "ServerlessGeneric";
2235
+ })(JobType || (JobType = {}));
2236
+
2037
2237
  /**
2038
2238
  * Service for interacting with UiPath Orchestrator Jobs API
2039
2239
  */
@@ -2203,6 +2403,86 @@ class JobService extends FolderScopedService {
2203
2403
  }
2204
2404
  return null;
2205
2405
  }
2406
+ /**
2407
+ * Stops one or more jobs by their UUID keys.
2408
+ *
2409
+ * Sends a stop request for the specified jobs to the Orchestrator. Throws if any keys cannot be resolved.
2410
+ *
2411
+ * @param jobKeys - Array of job UUID keys to stop (e.g., from {@link JobGetResponse}.key)
2412
+ * @param folderId - The folder ID where the jobs reside (required)
2413
+ * @param options - Optional {@link JobStopOptions} including stop strategy
2414
+ * @returns Promise that resolves when the jobs are stopped successfully, or rejects on failure
2415
+ *
2416
+ * @example
2417
+ * ```typescript
2418
+ * // Stop a single job with default soft stop
2419
+ * await jobs.stop([<jobKey>], <folderId>);
2420
+ * ```
2421
+ *
2422
+ * @example
2423
+ * ```typescript
2424
+ * import { StopStrategy } from '@uipath/uipath-typescript/jobs';
2425
+ *
2426
+ * // Force-kill multiple jobs
2427
+ * await jobs.stop(
2428
+ * [<jobKey1>, <jobKey2>],
2429
+ * <folderId>,
2430
+ * { strategy: StopStrategy.Kill }
2431
+ * );
2432
+ * ```
2433
+ */
2434
+ async stop(jobKeys, folderId, options) {
2435
+ if (jobKeys.length === 0) {
2436
+ return;
2437
+ }
2438
+ if (!folderId) {
2439
+ throw new ValidationError({ message: 'folderId is required for stop' });
2440
+ }
2441
+ const headers = createHeaders({ [FOLDER_ID]: folderId });
2442
+ const strategy = options?.strategy ?? exports.StopStrategy.SoftStop;
2443
+ const jobIds = await this.resolveJobKeys(jobKeys, folderId);
2444
+ await this.stopJobsByIds(jobIds, strategy, headers);
2445
+ }
2446
+ /**
2447
+ * Resumes a suspended job.
2448
+ *
2449
+ * Sends a resume request to a job that is currently in the `Suspended` state.
2450
+ * The job transitions to `Resumed` and then to `Running` as it continues execution. Optionally pass
2451
+ * input arguments to provide data for the resumed workflow.
2452
+ *
2453
+ * @param jobKey - The unique key (GUID) of the suspended job to resume
2454
+ * @param folderId - The folder ID where the job resides
2455
+ * @param options - Optional parameters including input arguments
2456
+ * @returns Promise that resolves when the job is resumed successfully, or rejects on failure
2457
+ *
2458
+ * @example
2459
+ * ```typescript
2460
+ * // Resume a suspended job
2461
+ * await jobs.resume(<jobKey>, <folderId>);
2462
+ * ```
2463
+ *
2464
+ * @example
2465
+ * ```typescript
2466
+ * // Resume with input arguments
2467
+ * await jobs.resume(<jobKey>, <folderId>, {
2468
+ * inputArguments: { approved: true }
2469
+ * });
2470
+ * ```
2471
+ */
2472
+ async resume(jobKey, folderId, options) {
2473
+ if (!jobKey) {
2474
+ throw new ValidationError({ message: 'jobKey is required for resume' });
2475
+ }
2476
+ if (!folderId) {
2477
+ throw new ValidationError({ message: 'folderId is required for resume' });
2478
+ }
2479
+ const headers = createHeaders({ [FOLDER_ID]: folderId });
2480
+ const body = { jobKey };
2481
+ if (options?.inputArguments) {
2482
+ body.inputArguments = JSON.stringify(options.inputArguments);
2483
+ }
2484
+ await this.post(JOB_ENDPOINTS.RESUME, body, { headers });
2485
+ }
2206
2486
  /**
2207
2487
  * Downloads the output file content via the Attachments API.
2208
2488
  * 1. Fetches blob access info from the attachment using AttachmentService
@@ -2237,6 +2517,43 @@ class JobService extends FolderScopedService {
2237
2517
  throw new ServerError({ message: 'Failed to parse job output file as JSON' });
2238
2518
  }
2239
2519
  }
2520
+ /**
2521
+ * Resolves job UUID keys to integer IDs via the getAll method.
2522
+ * Chunks keys into batches to avoid URL length limits.
2523
+ */
2524
+ async resolveJobKeys(jobKeys, folderId) {
2525
+ const uniqueKeys = [...new Set(jobKeys)];
2526
+ const keyToIdMap = new Map();
2527
+ const chunks = [];
2528
+ for (let i = 0; i < uniqueKeys.length; i += JOB_KEY_RESOLUTION_CHUNK_SIZE) {
2529
+ chunks.push(uniqueKeys.slice(i, i + JOB_KEY_RESOLUTION_CHUNK_SIZE));
2530
+ }
2531
+ const results = await Promise.all(chunks.map((chunk) => {
2532
+ const filterValues = chunk.map((key) => `'${key}'`).join(',');
2533
+ return this.getAll({
2534
+ folderId,
2535
+ filter: `key in (${filterValues})`,
2536
+ select: 'id,key',
2537
+ pageSize: chunk.length,
2538
+ });
2539
+ }));
2540
+ for (const response of results) {
2541
+ for (const job of response.items) {
2542
+ keyToIdMap.set(job.key, job.id);
2543
+ }
2544
+ }
2545
+ const missingKeys = uniqueKeys.filter((key) => !keyToIdMap.has(key));
2546
+ if (missingKeys.length > 0) {
2547
+ throw new ValidationError({ message: `Jobs not found for keys: ${missingKeys.join(', ')}` });
2548
+ }
2549
+ return uniqueKeys.map((key) => keyToIdMap.get(key));
2550
+ }
2551
+ /**
2552
+ * Calls the StopJobs OData action with resolved integer IDs.
2553
+ */
2554
+ async stopJobsByIds(jobIds, strategy, headers) {
2555
+ await this.post(JOB_ENDPOINTS.STOP, { jobIds, strategy }, { headers });
2556
+ }
2240
2557
  }
2241
2558
  __decorate([
2242
2559
  track('Jobs.GetAll')
@@ -2247,6 +2564,12 @@ __decorate([
2247
2564
  __decorate([
2248
2565
  track('Jobs.GetOutput')
2249
2566
  ], JobService.prototype, "getOutput", null);
2567
+ __decorate([
2568
+ track('Jobs.Stop')
2569
+ ], JobService.prototype, "stop", null);
2570
+ __decorate([
2571
+ track('Jobs.Resume')
2572
+ ], JobService.prototype, "resume", null);
2250
2573
 
2251
2574
  /**
2252
2575
  * Enum for job sub-state
@@ -621,6 +621,13 @@ interface RawJobGetResponse extends FolderProperties {
621
621
  /** Error details for the job, or null if the job has no errors */
622
622
  jobError: JobError | null;
623
623
  }
624
+ /**
625
+ * Options for resuming a suspended job
626
+ */
627
+ interface JobResumeOptions {
628
+ /** Input arguments to pass to the resumed job */
629
+ inputArguments?: Record<string, unknown>;
630
+ }
624
631
  /**
625
632
  * Options for getting all jobs
626
633
  */
@@ -635,6 +642,18 @@ type JobGetAllOptions = RequestOptions & PaginationOptions & {
635
642
  */
636
643
  interface JobGetByIdOptions extends BaseOptions {
637
644
  }
645
+ /**
646
+ * Options for stopping jobs
647
+ */
648
+ interface JobStopOptions {
649
+ /**
650
+ * The stop strategy to use.
651
+ * - `SoftStop` — requests graceful cancellation; the job completes its current activity before stopping
652
+ * - `Kill` — requests immediate termination of the job
653
+ * @default StopStrategy.SoftStop
654
+ */
655
+ strategy?: StopStrategy;
656
+ }
638
657
 
639
658
  /** Combined response type for job data with bound methods. */
640
659
  type JobGetResponse = RawJobGetResponse & JobMethods;
@@ -757,6 +776,62 @@ interface JobServiceModel {
757
776
  * ```
758
777
  */
759
778
  getOutput(jobKey: string, folderId: number): Promise<Record<string, unknown> | null>;
779
+ /**
780
+ * Stops one or more jobs by their UUID keys.
781
+ *
782
+ * Sends a stop request for the specified jobs to the Orchestrator. Throws if any keys cannot be resolved.
783
+ *
784
+ * @param jobKeys - Array of job UUID keys to stop (e.g., from {@link JobGetResponse}.key)
785
+ * @param folderId - The folder ID where the jobs reside (required)
786
+ * @param options - Optional {@link JobStopOptions} including stop strategy
787
+ * @returns Promise that resolves when the jobs are stopped successfully, or rejects on failure
788
+ *
789
+ * @example
790
+ * ```typescript
791
+ * // Stop a single job with default soft stop
792
+ * await jobs.stop([<jobKey>], <folderId>);
793
+ * ```
794
+ *
795
+ * @example
796
+ * ```typescript
797
+ * import { StopStrategy } from '@uipath/uipath-typescript/jobs';
798
+ *
799
+ * // Force-kill multiple jobs
800
+ * await jobs.stop(
801
+ * [<jobKey1>, <jobKey2>],
802
+ * <folderId>,
803
+ * { strategy: StopStrategy.Kill }
804
+ * );
805
+ * ```
806
+ */
807
+ stop(jobKeys: string[], folderId: number, options?: JobStopOptions): Promise<void>;
808
+ /**
809
+ * Resumes a suspended job.
810
+ *
811
+ * Sends a resume request to a job that is currently in the `Suspended` state.
812
+ * The job transitions to `Resumed` and then to `Running` as it continues execution. Optionally pass
813
+ * input arguments to provide data for the resumed workflow.
814
+ *
815
+ * @param jobKey - The unique key (GUID) of the suspended job to resume
816
+ * @param folderId - The folder ID where the job resides
817
+ * @param options - Optional parameters including input arguments
818
+ * @returns Promise that resolves when the job is resumed successfully, or rejects on failure
819
+ *
820
+ * @example
821
+ * ```typescript
822
+ * // Resume a suspended job
823
+ * await jobs.resume(<jobKey>, <folderId>);
824
+ * ```
825
+ *
826
+ * @example
827
+ * ```typescript
828
+ * // Resume with input arguments
829
+ * await jobs.resume(<jobKey>, <folderId>, {
830
+ * inputArguments: { approved: true }
831
+ * });
832
+ * ```
833
+ */
834
+ resume(jobKey: string, folderId: number, options?: JobResumeOptions): Promise<void>;
760
835
  }
761
836
  /**
762
837
  * Methods available on job response objects.
@@ -783,6 +858,32 @@ interface JobMethods {
783
858
  * ```
784
859
  */
785
860
  getOutput(): Promise<Record<string, unknown> | null>;
861
+ /**
862
+ * Stops this job.
863
+ *
864
+ * Sends a stop request for this job to the Orchestrator.
865
+ *
866
+ * @param options - Optional {@link JobStopOptions} including stop strategy (defaults to SoftStop)
867
+ * @returns Promise that resolves when the jobs are stopped successfully, or rejects on failure
868
+ *
869
+ * @example
870
+ * ```typescript
871
+ * const allJobs = await jobs.getAll({ folderId: <folderId> });
872
+ * const runningJob = allJobs.items.find(j => j.state === JobState.Running);
873
+ *
874
+ * if (runningJob) {
875
+ * await runningJob.stop();
876
+ * }
877
+ * ```
878
+ */
879
+ stop(options?: JobStopOptions): Promise<void>;
880
+ /**
881
+ * Resumes this suspended job.
882
+ *
883
+ * @param options - Optional parameters including input arguments
884
+ * @returns Promise that resolves when the job is resumed successfully, or rejects on failure
885
+ */
886
+ resume(options?: JobResumeOptions): Promise<void>;
786
887
  }
787
888
  /**
788
889
  * Creates a job response with bound methods.
@@ -906,6 +1007,62 @@ declare class JobService extends FolderScopedService implements JobServiceModel
906
1007
  * ```
907
1008
  */
908
1009
  getOutput(jobKey: string, folderId: number): Promise<Record<string, unknown> | null>;
1010
+ /**
1011
+ * Stops one or more jobs by their UUID keys.
1012
+ *
1013
+ * Sends a stop request for the specified jobs to the Orchestrator. Throws if any keys cannot be resolved.
1014
+ *
1015
+ * @param jobKeys - Array of job UUID keys to stop (e.g., from {@link JobGetResponse}.key)
1016
+ * @param folderId - The folder ID where the jobs reside (required)
1017
+ * @param options - Optional {@link JobStopOptions} including stop strategy
1018
+ * @returns Promise that resolves when the jobs are stopped successfully, or rejects on failure
1019
+ *
1020
+ * @example
1021
+ * ```typescript
1022
+ * // Stop a single job with default soft stop
1023
+ * await jobs.stop([<jobKey>], <folderId>);
1024
+ * ```
1025
+ *
1026
+ * @example
1027
+ * ```typescript
1028
+ * import { StopStrategy } from '@uipath/uipath-typescript/jobs';
1029
+ *
1030
+ * // Force-kill multiple jobs
1031
+ * await jobs.stop(
1032
+ * [<jobKey1>, <jobKey2>],
1033
+ * <folderId>,
1034
+ * { strategy: StopStrategy.Kill }
1035
+ * );
1036
+ * ```
1037
+ */
1038
+ stop(jobKeys: string[], folderId: number, options?: JobStopOptions): Promise<void>;
1039
+ /**
1040
+ * Resumes a suspended job.
1041
+ *
1042
+ * Sends a resume request to a job that is currently in the `Suspended` state.
1043
+ * The job transitions to `Resumed` and then to `Running` as it continues execution. Optionally pass
1044
+ * input arguments to provide data for the resumed workflow.
1045
+ *
1046
+ * @param jobKey - The unique key (GUID) of the suspended job to resume
1047
+ * @param folderId - The folder ID where the job resides
1048
+ * @param options - Optional parameters including input arguments
1049
+ * @returns Promise that resolves when the job is resumed successfully, or rejects on failure
1050
+ *
1051
+ * @example
1052
+ * ```typescript
1053
+ * // Resume a suspended job
1054
+ * await jobs.resume(<jobKey>, <folderId>);
1055
+ * ```
1056
+ *
1057
+ * @example
1058
+ * ```typescript
1059
+ * // Resume with input arguments
1060
+ * await jobs.resume(<jobKey>, <folderId>, {
1061
+ * inputArguments: { approved: true }
1062
+ * });
1063
+ * ```
1064
+ */
1065
+ resume(jobKey: string, folderId: number, options?: JobResumeOptions): Promise<void>;
909
1066
  /**
910
1067
  * Downloads the output file content via the Attachments API.
911
1068
  * 1. Fetches blob access info from the attachment using AttachmentService
@@ -913,7 +1070,16 @@ declare class JobService extends FolderScopedService implements JobServiceModel
913
1070
  * 3. Parses and returns the JSON content
914
1071
  */
915
1072
  private downloadOutputFile;
1073
+ /**
1074
+ * Resolves job UUID keys to integer IDs via the getAll method.
1075
+ * Chunks keys into batches to avoid URL length limits.
1076
+ */
1077
+ private resolveJobKeys;
1078
+ /**
1079
+ * Calls the StopJobs OData action with resolved integer IDs.
1080
+ */
1081
+ private stopJobsByIds;
916
1082
  }
917
1083
 
918
- export { JobService, JobState, JobSubState, JobService as Jobs, ServerlessJobType, createJobWithMethods };
919
- export type { JobGetAllOptions, JobGetByIdOptions, JobGetResponse, JobMethods, JobServiceModel, ProcessMetadata, RawJobGetResponse };
1084
+ export { JobService, JobState, JobSubState, JobService as Jobs, ServerlessJobType, StopStrategy, createJobWithMethods };
1085
+ export type { JobGetAllOptions, JobGetByIdOptions, JobGetResponse, JobMethods, JobResumeOptions, JobServiceModel, JobStopOptions, ProcessMetadata, RawJobGetResponse };