@uipath/uipath-typescript 1.3.3 → 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/index.mjs CHANGED
@@ -4536,6 +4536,7 @@ const JOB_ENDPOINTS = {
4536
4536
  GET_BY_KEY: (identifier) => `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.GetByKey(identifier=${identifier})`,
4537
4537
  STOP: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.StopJobs`,
4538
4538
  RESUME: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.ResumeJob`,
4539
+ RESTART: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.RestartJob`,
4539
4540
  };
4540
4541
  /**
4541
4542
  * Orchestrator Asset Service Endpoints
@@ -4607,6 +4608,7 @@ const DATA_FABRIC_ENDPOINTS = {
4607
4608
  BATCH_INSERT_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/insert-batch`,
4608
4609
  UPDATE_RECORD_BY_ID: (entityId, recordId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update/${recordId}`,
4609
4610
  UPDATE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update-batch`,
4611
+ DELETE_RECORD_BY_ID: (entityId, recordId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete/${recordId}`,
4610
4612
  DELETE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete-batch`,
4611
4613
  UPSERT: `${DATAFABRIC_BASE}/api/Entity`,
4612
4614
  DELETE: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}`,
@@ -5448,7 +5450,7 @@ function normalizeBaseUrl(url) {
5448
5450
  // Connection string placeholder that will be replaced during build
5449
5451
  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";
5450
5452
  // SDK Version placeholder
5451
- const SDK_VERSION = "1.3.3";
5453
+ const SDK_VERSION = "1.3.4";
5452
5454
  const VERSION = "Version";
5453
5455
  const SERVICE = "Service";
5454
5456
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -6283,6 +6285,8 @@ class ErrorFactory {
6283
6285
 
6284
6286
  const FOLDER_KEY = 'X-UIPATH-FolderKey';
6285
6287
  const FOLDER_ID = 'X-UIPATH-OrganizationUnitId';
6288
+ const TRACEPARENT = 'traceparent';
6289
+ const UIPATH_TRACEPARENT_ID = 'x-uipath-traceparent-id';
6286
6290
  /**
6287
6291
  * Content type constants for HTTP requests/responses
6288
6292
  */
@@ -6336,8 +6340,13 @@ class ApiClient {
6336
6340
  if (isFormData) {
6337
6341
  delete defaultHeaders['Content-Type'];
6338
6342
  }
6343
+ const traceId = crypto.randomUUID().replace(/-/g, '');
6344
+ const spanId = crypto.randomUUID().replace(/-/g, '').slice(0, 16);
6345
+ const traceparentValue = `00-${traceId}-${spanId}-01`;
6339
6346
  const headers = {
6340
6347
  ...defaultHeaders,
6348
+ [TRACEPARENT]: traceparentValue,
6349
+ [UIPATH_TRACEPARENT_ID]: traceparentValue,
6341
6350
  ...options.headers
6342
6351
  };
6343
6352
  // Convert params to URLSearchParams
@@ -7641,6 +7650,13 @@ function createEntityMethods(entityData, service) {
7641
7650
  throw new Error('Entity ID is undefined');
7642
7651
  return service.deleteRecordsById(entityData.id, recordIds, options);
7643
7652
  },
7653
+ async deleteRecord(recordId) {
7654
+ if (!entityData.id)
7655
+ throw new Error('Entity ID is undefined');
7656
+ if (!recordId)
7657
+ throw new Error('Record ID is undefined');
7658
+ return service.deleteRecordById(entityData.id, recordId);
7659
+ },
7644
7660
  async getAllRecords(options) {
7645
7661
  if (!entityData.id)
7646
7662
  throw new Error('Entity ID is undefined');
@@ -8193,6 +8209,8 @@ class EntityService extends BaseService {
8193
8209
  /**
8194
8210
  * Deletes data from an entity by entity ID
8195
8211
  *
8212
+ * Note: Records deleted using deleteRecordsById will not trigger Data Fabric trigger events. Use {@link deleteRecordById} if you need trigger events to fire for the deleted record.
8213
+ *
8196
8214
  * @param entityId - UUID of the entity
8197
8215
  * @param recordIds - Array of record UUIDs to delete
8198
8216
  * @param options - Delete options
@@ -8220,6 +8238,27 @@ class EntityService extends BaseService {
8220
8238
  });
8221
8239
  return response.data;
8222
8240
  }
8241
+ /**
8242
+ * Deletes a single record from an entity by entity ID and record ID
8243
+ *
8244
+ * Note: Data Fabric supports trigger events only on individual deletes, not on deleting multiple records.
8245
+ * Use this method if you need trigger events to fire for the deleted record.
8246
+ *
8247
+ * @param entityId - UUID of the entity
8248
+ * @param recordId - UUID of the record to delete
8249
+ * @returns Promise resolving to void on success
8250
+ * @example
8251
+ * ```typescript
8252
+ * import { Entities } from '@uipath/uipath-typescript/entities';
8253
+ *
8254
+ * const entities = new Entities(sdk);
8255
+ *
8256
+ * await entities.deleteRecordById("<entityId>", "<recordId>");
8257
+ * ```
8258
+ */
8259
+ async deleteRecordById(entityId, recordId) {
8260
+ await this.delete(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_RECORD_BY_ID(entityId, recordId));
8261
+ }
8223
8262
  /**
8224
8263
  * Gets all entities in the system
8225
8264
  *
@@ -8772,6 +8811,9 @@ __decorate([
8772
8811
  __decorate([
8773
8812
  track('Entities.DeleteRecordsById')
8774
8813
  ], EntityService.prototype, "deleteRecordsById", null);
8814
+ __decorate([
8815
+ track('Entities.DeleteRecordById')
8816
+ ], EntityService.prototype, "deleteRecordById", null);
8775
8817
  __decorate([
8776
8818
  track('Entities.GetAll')
8777
8819
  ], EntityService.prototype, "getAll", null);
@@ -11396,6 +11438,13 @@ function createJobMethods(jobData, service) {
11396
11438
  throw new Error('Job folderId is undefined');
11397
11439
  return service.resume(jobData.key, jobData.folderId, options);
11398
11440
  },
11441
+ async restart() {
11442
+ if (!jobData.key)
11443
+ throw new Error('Job key is undefined');
11444
+ if (!jobData.folderId)
11445
+ throw new Error('Job folderId is undefined');
11446
+ return service.restart(jobData.key, jobData.folderId);
11447
+ },
11399
11448
  };
11400
11449
  }
11401
11450
  /**
@@ -11895,6 +11944,41 @@ class JobService extends FolderScopedService {
11895
11944
  }
11896
11945
  await this.post(JOB_ENDPOINTS.RESUME, body, { headers });
11897
11946
  }
11947
+ /**
11948
+ * Restarts a job in a final state (Successful, Faulted, or Stopped).
11949
+ *
11950
+ * Creates a **new** job execution from a previously successful, faulted, or stopped job.
11951
+ * The new job has its own unique `key`, starts in `Pending` state, and uses
11952
+ * the same process and input arguments as the original job.
11953
+ *
11954
+ * To monitor the new job's progress, poll with {@link getById}
11955
+ * using the returned job's key until the state reaches a final value.
11956
+ *
11957
+ * @param jobKey - The unique key (GUID) of the job to restart
11958
+ * @param folderId - The folder ID where the job resides
11959
+ * @returns Promise resolving to the new {@link JobGetResponse} with full job details
11960
+ *
11961
+ * @example
11962
+ * ```typescript
11963
+ * // Restart a faulted job
11964
+ * const newJob = await jobs.restart(<jobKey>, <folderId>);
11965
+ * console.log(newJob.state); // 'Pending'
11966
+ * console.log(newJob.key); // new job key (different from original)
11967
+ * ```
11968
+ */
11969
+ async restart(jobKey, folderId) {
11970
+ if (!jobKey) {
11971
+ throw new ValidationError({ message: 'jobKey is required for restart' });
11972
+ }
11973
+ if (!folderId) {
11974
+ throw new ValidationError({ message: 'folderId is required for restart' });
11975
+ }
11976
+ const [jobId] = await this.resolveJobKeys([jobKey], folderId);
11977
+ const headers = createHeaders({ [FOLDER_ID]: folderId });
11978
+ const response = await this.post(JOB_ENDPOINTS.RESTART, { jobId }, { headers });
11979
+ const rawJob = transformData(pascalToCamelCaseKeys(response.data), JobMap);
11980
+ return createJobWithMethods(rawJob, this);
11981
+ }
11898
11982
  /**
11899
11983
  * Downloads the output file content via the Attachments API.
11900
11984
  * 1. Fetches blob access info from the attachment using AttachmentService
@@ -11982,6 +12066,9 @@ __decorate([
11982
12066
  __decorate([
11983
12067
  track('Jobs.Resume')
11984
12068
  ], JobService.prototype, "resume", null);
12069
+ __decorate([
12070
+ track('Jobs.Restart')
12071
+ ], JobService.prototype, "restart", null);
11985
12072
 
11986
12073
  /**
11987
12074
  * Enum for job sub-state
package/dist/index.umd.js CHANGED
@@ -4540,6 +4540,7 @@
4540
4540
  GET_BY_KEY: (identifier) => `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.GetByKey(identifier=${identifier})`,
4541
4541
  STOP: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.StopJobs`,
4542
4542
  RESUME: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.ResumeJob`,
4543
+ RESTART: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.RestartJob`,
4543
4544
  };
4544
4545
  /**
4545
4546
  * Orchestrator Asset Service Endpoints
@@ -4611,6 +4612,7 @@
4611
4612
  BATCH_INSERT_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/insert-batch`,
4612
4613
  UPDATE_RECORD_BY_ID: (entityId, recordId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update/${recordId}`,
4613
4614
  UPDATE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update-batch`,
4615
+ DELETE_RECORD_BY_ID: (entityId, recordId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete/${recordId}`,
4614
4616
  DELETE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete-batch`,
4615
4617
  UPSERT: `${DATAFABRIC_BASE}/api/Entity`,
4616
4618
  DELETE: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}`,
@@ -9207,7 +9209,7 @@
9207
9209
  // Connection string placeholder that will be replaced during build
9208
9210
  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";
9209
9211
  // SDK Version placeholder
9210
- const SDK_VERSION = "1.3.3";
9212
+ const SDK_VERSION = "1.3.4";
9211
9213
  const VERSION = "Version";
9212
9214
  const SERVICE = "Service";
9213
9215
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -10042,6 +10044,8 @@
10042
10044
 
10043
10045
  const FOLDER_KEY = 'X-UIPATH-FolderKey';
10044
10046
  const FOLDER_ID = 'X-UIPATH-OrganizationUnitId';
10047
+ const TRACEPARENT = 'traceparent';
10048
+ const UIPATH_TRACEPARENT_ID = 'x-uipath-traceparent-id';
10045
10049
  /**
10046
10050
  * Content type constants for HTTP requests/responses
10047
10051
  */
@@ -10095,8 +10099,13 @@
10095
10099
  if (isFormData) {
10096
10100
  delete defaultHeaders['Content-Type'];
10097
10101
  }
10102
+ const traceId = crypto.randomUUID().replace(/-/g, '');
10103
+ const spanId = crypto.randomUUID().replace(/-/g, '').slice(0, 16);
10104
+ const traceparentValue = `00-${traceId}-${spanId}-01`;
10098
10105
  const headers = {
10099
10106
  ...defaultHeaders,
10107
+ [TRACEPARENT]: traceparentValue,
10108
+ [UIPATH_TRACEPARENT_ID]: traceparentValue,
10100
10109
  ...options.headers
10101
10110
  };
10102
10111
  // Convert params to URLSearchParams
@@ -11400,6 +11409,13 @@
11400
11409
  throw new Error('Entity ID is undefined');
11401
11410
  return service.deleteRecordsById(entityData.id, recordIds, options);
11402
11411
  },
11412
+ async deleteRecord(recordId) {
11413
+ if (!entityData.id)
11414
+ throw new Error('Entity ID is undefined');
11415
+ if (!recordId)
11416
+ throw new Error('Record ID is undefined');
11417
+ return service.deleteRecordById(entityData.id, recordId);
11418
+ },
11403
11419
  async getAllRecords(options) {
11404
11420
  if (!entityData.id)
11405
11421
  throw new Error('Entity ID is undefined');
@@ -11952,6 +11968,8 @@
11952
11968
  /**
11953
11969
  * Deletes data from an entity by entity ID
11954
11970
  *
11971
+ * Note: Records deleted using deleteRecordsById will not trigger Data Fabric trigger events. Use {@link deleteRecordById} if you need trigger events to fire for the deleted record.
11972
+ *
11955
11973
  * @param entityId - UUID of the entity
11956
11974
  * @param recordIds - Array of record UUIDs to delete
11957
11975
  * @param options - Delete options
@@ -11979,6 +11997,27 @@
11979
11997
  });
11980
11998
  return response.data;
11981
11999
  }
12000
+ /**
12001
+ * Deletes a single record from an entity by entity ID and record ID
12002
+ *
12003
+ * Note: Data Fabric supports trigger events only on individual deletes, not on deleting multiple records.
12004
+ * Use this method if you need trigger events to fire for the deleted record.
12005
+ *
12006
+ * @param entityId - UUID of the entity
12007
+ * @param recordId - UUID of the record to delete
12008
+ * @returns Promise resolving to void on success
12009
+ * @example
12010
+ * ```typescript
12011
+ * import { Entities } from '@uipath/uipath-typescript/entities';
12012
+ *
12013
+ * const entities = new Entities(sdk);
12014
+ *
12015
+ * await entities.deleteRecordById("<entityId>", "<recordId>");
12016
+ * ```
12017
+ */
12018
+ async deleteRecordById(entityId, recordId) {
12019
+ await this.delete(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_RECORD_BY_ID(entityId, recordId));
12020
+ }
11982
12021
  /**
11983
12022
  * Gets all entities in the system
11984
12023
  *
@@ -12531,6 +12570,9 @@
12531
12570
  __decorate([
12532
12571
  track('Entities.DeleteRecordsById')
12533
12572
  ], EntityService.prototype, "deleteRecordsById", null);
12573
+ __decorate([
12574
+ track('Entities.DeleteRecordById')
12575
+ ], EntityService.prototype, "deleteRecordById", null);
12534
12576
  __decorate([
12535
12577
  track('Entities.GetAll')
12536
12578
  ], EntityService.prototype, "getAll", null);
@@ -15155,6 +15197,13 @@
15155
15197
  throw new Error('Job folderId is undefined');
15156
15198
  return service.resume(jobData.key, jobData.folderId, options);
15157
15199
  },
15200
+ async restart() {
15201
+ if (!jobData.key)
15202
+ throw new Error('Job key is undefined');
15203
+ if (!jobData.folderId)
15204
+ throw new Error('Job folderId is undefined');
15205
+ return service.restart(jobData.key, jobData.folderId);
15206
+ },
15158
15207
  };
15159
15208
  }
15160
15209
  /**
@@ -15654,6 +15703,41 @@
15654
15703
  }
15655
15704
  await this.post(JOB_ENDPOINTS.RESUME, body, { headers });
15656
15705
  }
15706
+ /**
15707
+ * Restarts a job in a final state (Successful, Faulted, or Stopped).
15708
+ *
15709
+ * Creates a **new** job execution from a previously successful, faulted, or stopped job.
15710
+ * The new job has its own unique `key`, starts in `Pending` state, and uses
15711
+ * the same process and input arguments as the original job.
15712
+ *
15713
+ * To monitor the new job's progress, poll with {@link getById}
15714
+ * using the returned job's key until the state reaches a final value.
15715
+ *
15716
+ * @param jobKey - The unique key (GUID) of the job to restart
15717
+ * @param folderId - The folder ID where the job resides
15718
+ * @returns Promise resolving to the new {@link JobGetResponse} with full job details
15719
+ *
15720
+ * @example
15721
+ * ```typescript
15722
+ * // Restart a faulted job
15723
+ * const newJob = await jobs.restart(<jobKey>, <folderId>);
15724
+ * console.log(newJob.state); // 'Pending'
15725
+ * console.log(newJob.key); // new job key (different from original)
15726
+ * ```
15727
+ */
15728
+ async restart(jobKey, folderId) {
15729
+ if (!jobKey) {
15730
+ throw new ValidationError({ message: 'jobKey is required for restart' });
15731
+ }
15732
+ if (!folderId) {
15733
+ throw new ValidationError({ message: 'folderId is required for restart' });
15734
+ }
15735
+ const [jobId] = await this.resolveJobKeys([jobKey], folderId);
15736
+ const headers = createHeaders({ [FOLDER_ID]: folderId });
15737
+ const response = await this.post(JOB_ENDPOINTS.RESTART, { jobId }, { headers });
15738
+ const rawJob = transformData(pascalToCamelCaseKeys(response.data), JobMap);
15739
+ return createJobWithMethods(rawJob, this);
15740
+ }
15657
15741
  /**
15658
15742
  * Downloads the output file content via the Attachments API.
15659
15743
  * 1. Fetches blob access info from the attachment using AttachmentService
@@ -15741,6 +15825,9 @@
15741
15825
  __decorate([
15742
15826
  track('Jobs.Resume')
15743
15827
  ], JobService.prototype, "resume", null);
15828
+ __decorate([
15829
+ track('Jobs.Restart')
15830
+ ], JobService.prototype, "restart", null);
15744
15831
 
15745
15832
  /**
15746
15833
  * Enum for job sub-state
@@ -506,6 +506,8 @@ class ErrorFactory {
506
506
  }
507
507
 
508
508
  const FOLDER_ID = 'X-UIPATH-OrganizationUnitId';
509
+ const TRACEPARENT = 'traceparent';
510
+ const UIPATH_TRACEPARENT_ID = 'x-uipath-traceparent-id';
509
511
  /**
510
512
  * Content type constants for HTTP requests/responses
511
513
  */
@@ -559,8 +561,13 @@ class ApiClient {
559
561
  if (isFormData) {
560
562
  delete defaultHeaders['Content-Type'];
561
563
  }
564
+ const traceId = crypto.randomUUID().replace(/-/g, '');
565
+ const spanId = crypto.randomUUID().replace(/-/g, '').slice(0, 16);
566
+ const traceparentValue = `00-${traceId}-${spanId}-01`;
562
567
  const headers = {
563
568
  ...defaultHeaders,
569
+ [TRACEPARENT]: traceparentValue,
570
+ [UIPATH_TRACEPARENT_ID]: traceparentValue,
564
571
  ...options.headers
565
572
  };
566
573
  // Convert params to URLSearchParams
@@ -1677,6 +1684,13 @@ function createJobMethods(jobData, service) {
1677
1684
  throw new Error('Job folderId is undefined');
1678
1685
  return service.resume(jobData.key, jobData.folderId, options);
1679
1686
  },
1687
+ async restart() {
1688
+ if (!jobData.key)
1689
+ throw new Error('Job key is undefined');
1690
+ if (!jobData.folderId)
1691
+ throw new Error('Job folderId is undefined');
1692
+ return service.restart(jobData.key, jobData.folderId);
1693
+ },
1680
1694
  };
1681
1695
  }
1682
1696
  /**
@@ -1707,6 +1721,7 @@ const JOB_ENDPOINTS = {
1707
1721
  GET_BY_KEY: (identifier) => `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.GetByKey(identifier=${identifier})`,
1708
1722
  STOP: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.StopJobs`,
1709
1723
  RESUME: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.ResumeJob`,
1724
+ RESTART: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.RestartJob`,
1710
1725
  };
1711
1726
  /**
1712
1727
  * Orchestrator Attachment Service Endpoints
@@ -1738,7 +1753,7 @@ const JobMap = {
1738
1753
  // Connection string placeholder that will be replaced during build
1739
1754
  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";
1740
1755
  // SDK Version placeholder
1741
- const SDK_VERSION = "1.3.3";
1756
+ const SDK_VERSION = "1.3.4";
1742
1757
  const VERSION = "Version";
1743
1758
  const SERVICE = "Service";
1744
1759
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -2483,6 +2498,41 @@ class JobService extends FolderScopedService {
2483
2498
  }
2484
2499
  await this.post(JOB_ENDPOINTS.RESUME, body, { headers });
2485
2500
  }
2501
+ /**
2502
+ * Restarts a job in a final state (Successful, Faulted, or Stopped).
2503
+ *
2504
+ * Creates a **new** job execution from a previously successful, faulted, or stopped job.
2505
+ * The new job has its own unique `key`, starts in `Pending` state, and uses
2506
+ * the same process and input arguments as the original job.
2507
+ *
2508
+ * To monitor the new job's progress, poll with {@link getById}
2509
+ * using the returned job's key until the state reaches a final value.
2510
+ *
2511
+ * @param jobKey - The unique key (GUID) of the job to restart
2512
+ * @param folderId - The folder ID where the job resides
2513
+ * @returns Promise resolving to the new {@link JobGetResponse} with full job details
2514
+ *
2515
+ * @example
2516
+ * ```typescript
2517
+ * // Restart a faulted job
2518
+ * const newJob = await jobs.restart(<jobKey>, <folderId>);
2519
+ * console.log(newJob.state); // 'Pending'
2520
+ * console.log(newJob.key); // new job key (different from original)
2521
+ * ```
2522
+ */
2523
+ async restart(jobKey, folderId) {
2524
+ if (!jobKey) {
2525
+ throw new ValidationError({ message: 'jobKey is required for restart' });
2526
+ }
2527
+ if (!folderId) {
2528
+ throw new ValidationError({ message: 'folderId is required for restart' });
2529
+ }
2530
+ const [jobId] = await this.resolveJobKeys([jobKey], folderId);
2531
+ const headers = createHeaders({ [FOLDER_ID]: folderId });
2532
+ const response = await this.post(JOB_ENDPOINTS.RESTART, { jobId }, { headers });
2533
+ const rawJob = transformData(pascalToCamelCaseKeys(response.data), JobMap);
2534
+ return createJobWithMethods(rawJob, this);
2535
+ }
2486
2536
  /**
2487
2537
  * Downloads the output file content via the Attachments API.
2488
2538
  * 1. Fetches blob access info from the attachment using AttachmentService
@@ -2570,6 +2620,9 @@ __decorate([
2570
2620
  __decorate([
2571
2621
  track('Jobs.Resume')
2572
2622
  ], JobService.prototype, "resume", null);
2623
+ __decorate([
2624
+ track('Jobs.Restart')
2625
+ ], JobService.prototype, "restart", null);
2573
2626
 
2574
2627
  /**
2575
2628
  * Enum for job sub-state
@@ -832,6 +832,29 @@ interface JobServiceModel {
832
832
  * ```
833
833
  */
834
834
  resume(jobKey: string, folderId: number, options?: JobResumeOptions): Promise<void>;
835
+ /**
836
+ * Restarts a job in a final state (Successful, Faulted, or Stopped).
837
+ *
838
+ * Creates a **new** job execution from a previously successful, faulted, or stopped job.
839
+ * The new job has its own unique `key`, starts in `Pending` state, and uses
840
+ * the same process and input arguments as the original job.
841
+ *
842
+ * To monitor the new job's progress, poll with {@link getById}
843
+ * using the returned job's key until the state reaches a final value.
844
+ *
845
+ * @param jobKey - The unique key (GUID) of the job to restart
846
+ * @param folderId - The folder ID where the job resides
847
+ * @returns Promise resolving to the new {@link JobGetResponse} with full job details
848
+ *
849
+ * @example
850
+ * ```typescript
851
+ * // Restart a faulted job
852
+ * const newJob = await jobs.restart(<jobKey>, <folderId>);
853
+ * console.log(newJob.state); // 'Pending'
854
+ * console.log(newJob.key); // new job key (different from original)
855
+ * ```
856
+ */
857
+ restart(jobKey: string, folderId: number): Promise<JobGetResponse>;
835
858
  }
836
859
  /**
837
860
  * Methods available on job response objects.
@@ -884,6 +907,12 @@ interface JobMethods {
884
907
  * @returns Promise that resolves when the job is resumed successfully, or rejects on failure
885
908
  */
886
909
  resume(options?: JobResumeOptions): Promise<void>;
910
+ /**
911
+ * Restarts this job, creating a new execution with a new key.
912
+ *
913
+ * @returns Promise resolving to the new {@link JobGetResponse} with full job details
914
+ */
915
+ restart(): Promise<JobGetResponse>;
887
916
  }
888
917
  /**
889
918
  * Creates a job response with bound methods.
@@ -1063,6 +1092,29 @@ declare class JobService extends FolderScopedService implements JobServiceModel
1063
1092
  * ```
1064
1093
  */
1065
1094
  resume(jobKey: string, folderId: number, options?: JobResumeOptions): Promise<void>;
1095
+ /**
1096
+ * Restarts a job in a final state (Successful, Faulted, or Stopped).
1097
+ *
1098
+ * Creates a **new** job execution from a previously successful, faulted, or stopped job.
1099
+ * The new job has its own unique `key`, starts in `Pending` state, and uses
1100
+ * the same process and input arguments as the original job.
1101
+ *
1102
+ * To monitor the new job's progress, poll with {@link getById}
1103
+ * using the returned job's key until the state reaches a final value.
1104
+ *
1105
+ * @param jobKey - The unique key (GUID) of the job to restart
1106
+ * @param folderId - The folder ID where the job resides
1107
+ * @returns Promise resolving to the new {@link JobGetResponse} with full job details
1108
+ *
1109
+ * @example
1110
+ * ```typescript
1111
+ * // Restart a faulted job
1112
+ * const newJob = await jobs.restart(<jobKey>, <folderId>);
1113
+ * console.log(newJob.state); // 'Pending'
1114
+ * console.log(newJob.key); // new job key (different from original)
1115
+ * ```
1116
+ */
1117
+ restart(jobKey: string, folderId: number): Promise<JobGetResponse>;
1066
1118
  /**
1067
1119
  * Downloads the output file content via the Attachments API.
1068
1120
  * 1. Fetches blob access info from the attachment using AttachmentService
@@ -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
@@ -1675,6 +1682,13 @@ function createJobMethods(jobData, service) {
1675
1682
  throw new Error('Job folderId is undefined');
1676
1683
  return service.resume(jobData.key, jobData.folderId, options);
1677
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
+ },
1678
1692
  };
1679
1693
  }
1680
1694
  /**
@@ -1705,6 +1719,7 @@ const JOB_ENDPOINTS = {
1705
1719
  GET_BY_KEY: (identifier) => `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.GetByKey(identifier=${identifier})`,
1706
1720
  STOP: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.StopJobs`,
1707
1721
  RESUME: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.ResumeJob`,
1722
+ RESTART: `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.RestartJob`,
1708
1723
  };
1709
1724
  /**
1710
1725
  * Orchestrator Attachment Service Endpoints
@@ -1736,7 +1751,7 @@ const JobMap = {
1736
1751
  // Connection string placeholder that will be replaced during build
1737
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";
1738
1753
  // SDK Version placeholder
1739
- const SDK_VERSION = "1.3.3";
1754
+ const SDK_VERSION = "1.3.4";
1740
1755
  const VERSION = "Version";
1741
1756
  const SERVICE = "Service";
1742
1757
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -2481,6 +2496,41 @@ class JobService extends FolderScopedService {
2481
2496
  }
2482
2497
  await this.post(JOB_ENDPOINTS.RESUME, body, { headers });
2483
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
+ }
2484
2534
  /**
2485
2535
  * Downloads the output file content via the Attachments API.
2486
2536
  * 1. Fetches blob access info from the attachment using AttachmentService
@@ -2568,6 +2618,9 @@ __decorate([
2568
2618
  __decorate([
2569
2619
  track('Jobs.Resume')
2570
2620
  ], JobService.prototype, "resume", null);
2621
+ __decorate([
2622
+ track('Jobs.Restart')
2623
+ ], JobService.prototype, "restart", null);
2571
2624
 
2572
2625
  /**
2573
2626
  * Enum for job sub-state
@@ -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
@@ -1735,7 +1742,7 @@ class BpmnHelpers {
1735
1742
  // Connection string placeholder that will be replaced during build
1736
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";
1737
1744
  // SDK Version placeholder
1738
- const SDK_VERSION = "1.3.3";
1745
+ const SDK_VERSION = "1.3.4";
1739
1746
  const VERSION = "Version";
1740
1747
  const SERVICE = "Service";
1741
1748
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";