@uipath/uipath-typescript 1.2.2 → 1.3.1

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.
Files changed (41) hide show
  1. package/dist/assets/index.cjs +5 -8
  2. package/dist/assets/index.d.ts +3 -1
  3. package/dist/assets/index.mjs +5 -8
  4. package/dist/attachments/index.cjs +5 -8
  5. package/dist/attachments/index.d.ts +3 -1
  6. package/dist/attachments/index.mjs +5 -8
  7. package/dist/buckets/index.cjs +5 -8
  8. package/dist/buckets/index.d.ts +3 -1
  9. package/dist/buckets/index.mjs +5 -8
  10. package/dist/cases/index.cjs +5 -8
  11. package/dist/cases/index.d.ts +3 -1
  12. package/dist/cases/index.mjs +5 -8
  13. package/dist/conversational-agent/index.cjs +38 -16
  14. package/dist/conversational-agent/index.d.ts +26 -4
  15. package/dist/conversational-agent/index.mjs +38 -16
  16. package/dist/core/index.cjs +2 -2
  17. package/dist/core/index.d.ts +2 -2
  18. package/dist/core/index.mjs +2 -2
  19. package/dist/entities/index.cjs +697 -317
  20. package/dist/entities/index.d.ts +572 -58
  21. package/dist/entities/index.mjs +698 -318
  22. package/dist/index.cjs +727 -161
  23. package/dist/index.d.ts +697 -69
  24. package/dist/index.mjs +727 -162
  25. package/dist/index.umd.js +727 -161
  26. package/dist/jobs/index.cjs +278 -20
  27. package/dist/jobs/index.d.ts +214 -19
  28. package/dist/jobs/index.mjs +278 -21
  29. package/dist/maestro-processes/index.cjs +5 -8
  30. package/dist/maestro-processes/index.d.ts +3 -1
  31. package/dist/maestro-processes/index.mjs +5 -8
  32. package/dist/processes/index.cjs +5 -8
  33. package/dist/processes/index.d.ts +3 -1
  34. package/dist/processes/index.mjs +5 -8
  35. package/dist/queues/index.cjs +5 -8
  36. package/dist/queues/index.d.ts +3 -1
  37. package/dist/queues/index.mjs +5 -8
  38. package/dist/tasks/index.cjs +5 -8
  39. package/dist/tasks/index.d.ts +3 -1
  40. package/dist/tasks/index.mjs +5 -8
  41. package/package.json +1 -1
@@ -524,15 +524,11 @@ const RESPONSE_TYPES = {
524
524
 
525
525
  class ApiClient {
526
526
  constructor(config, executionContext, tokenManager, clientConfig = {}) {
527
- this.defaultHeaders = {};
528
527
  this.config = config;
529
528
  this.executionContext = executionContext;
530
529
  this.clientConfig = clientConfig;
531
530
  this.tokenManager = tokenManager;
532
531
  }
533
- setDefaultHeaders(headers) {
534
- this.defaultHeaders = { ...this.defaultHeaders, ...headers };
535
- }
536
532
  /**
537
533
  * Gets a valid authentication token, refreshing if necessary.
538
534
  * Used internally for API requests and exposed for services that need manual auth headers.
@@ -548,7 +544,6 @@ class ApiClient {
548
544
  return {
549
545
  'Authorization': `Bearer ${token}`,
550
546
  'Content-Type': CONTENT_TYPES.JSON,
551
- ...this.defaultHeaders,
552
547
  ...this.clientConfig.headers
553
548
  };
554
549
  }
@@ -1388,6 +1383,8 @@ class BaseService {
1388
1383
  *
1389
1384
  * @param instance - UiPath SDK instance providing authentication and configuration.
1390
1385
  * Services receive this via dependency injection in the modular pattern.
1386
+ * @param headers - Optional default headers to include in every request (e.g. `x-uipath-external-user-id` for
1387
+ * CAS external-app auth)
1391
1388
  *
1392
1389
  * @example
1393
1390
  * ```typescript
@@ -1407,11 +1404,11 @@ class BaseService {
1407
1404
  * const entities = new Entities(sdk);
1408
1405
  * ```
1409
1406
  */
1410
- constructor(instance) {
1407
+ constructor(instance, headers) {
1411
1408
  // Private field - not visible via Object.keys() or any reflection
1412
1409
  _BaseService_apiClient.set(this, void 0);
1413
1410
  const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
1414
- __classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager), "f");
1411
+ __classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
1415
1412
  }
1416
1413
  /**
1417
1414
  * Gets a valid authentication token, refreshing if necessary.
@@ -1642,6 +1639,36 @@ class FolderScopedService extends BaseService {
1642
1639
  }
1643
1640
  }
1644
1641
 
1642
+ /**
1643
+ * Creates methods for a job response object.
1644
+ *
1645
+ * @param jobData - The raw job data from API
1646
+ * @param service - The job service instance
1647
+ * @returns Object containing job methods
1648
+ */
1649
+ function createJobMethods(jobData, service) {
1650
+ return {
1651
+ async getOutput() {
1652
+ if (!jobData.key)
1653
+ throw new Error('Job key is undefined');
1654
+ if (!jobData.folderId)
1655
+ throw new Error('Job folderId is undefined');
1656
+ return service.getOutput(jobData.key, jobData.folderId);
1657
+ },
1658
+ };
1659
+ }
1660
+ /**
1661
+ * Creates a job response with bound methods.
1662
+ *
1663
+ * @param jobData - The raw job data from API
1664
+ * @param service - The job service instance
1665
+ * @returns A job object with added methods
1666
+ */
1667
+ function createJobWithMethods(jobData, service) {
1668
+ const methods = createJobMethods(jobData, service);
1669
+ return Object.assign({}, jobData, methods);
1670
+ }
1671
+
1645
1672
  /**
1646
1673
  * Base path constants for different services
1647
1674
  */
@@ -1655,6 +1682,13 @@ const ORCHESTRATOR_BASE = 'orchestrator_';
1655
1682
  */
1656
1683
  const JOB_ENDPOINTS = {
1657
1684
  GET_ALL: `${ORCHESTRATOR_BASE}/odata/Jobs`,
1685
+ GET_BY_KEY: (identifier) => `${ORCHESTRATOR_BASE}/odata/Jobs/UiPath.Server.Configuration.OData.GetByKey(identifier=${identifier})`,
1686
+ };
1687
+ /**
1688
+ * Orchestrator Attachment Service Endpoints
1689
+ */
1690
+ const ORCHESTRATOR_ATTACHMENT_ENDPOINTS = {
1691
+ GET_BY_ID: (id) => `${ORCHESTRATOR_BASE}/odata/Attachments(${id})`,
1658
1692
  };
1659
1693
 
1660
1694
  /**
@@ -1678,7 +1712,7 @@ const JobMap = {
1678
1712
  // Connection string placeholder that will be replaced during build
1679
1713
  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";
1680
1714
  // SDK Version placeholder
1681
- const SDK_VERSION = "1.2.2";
1715
+ const SDK_VERSION = "1.3.1";
1682
1716
  const VERSION = "Version";
1683
1717
  const SERVICE = "Service";
1684
1718
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -1904,8 +1938,9 @@ function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, op
1904
1938
  // Track the event if enabled
1905
1939
  if (shouldTrack) {
1906
1940
  // Use the full name provided in the decorator (e.g., "Queue.GetAll")
1907
- const serviceMethod = nameOrOptions
1908
- ;
1941
+ const serviceMethod = typeof nameOrOptions === 'string'
1942
+ ? nameOrOptions
1943
+ : fallbackName;
1909
1944
  // Use 'Sdk.Run' as the name and serviceMethod as the service
1910
1945
  telemetryClient.track(serviceMethod, SDK_RUN_EVENT, opts.attributes);
1911
1946
  }
@@ -1934,7 +1969,7 @@ function createTrackedFunction(originalFunction, nameOrOptions, fallbackName, op
1934
1969
  */
1935
1970
  function track(nameOrOptions, options) {
1936
1971
  return function decorator(_target, propertyKey, descriptor) {
1937
- const opts = {};
1972
+ const opts = typeof nameOrOptions === 'object' ? nameOrOptions : {};
1938
1973
  if (descriptor && typeof descriptor.value === 'function') {
1939
1974
  // Method decorator
1940
1975
  descriptor.value = createTrackedFunction(descriptor.value, nameOrOptions, propertyKey || 'unknown_method', opts);
@@ -1945,27 +1980,90 @@ function track(nameOrOptions, options) {
1945
1980
  };
1946
1981
  }
1947
1982
 
1983
+ /**
1984
+ * Maps fields for Attachment entities to ensure consistent naming
1985
+ */
1986
+ const AttachmentsMap = {
1987
+ creationTime: 'createdTime',
1988
+ lastModificationTime: 'lastModifiedTime'
1989
+ };
1990
+
1991
+ /**
1992
+ * Maps fields for Bucket entities to ensure consistent naming
1993
+ */
1994
+ const BucketMap = {
1995
+ fullPath: 'path',
1996
+ items: 'blobItems',
1997
+ verb: 'httpMethod'
1998
+ };
1999
+
2000
+ class AttachmentService extends BaseService {
2001
+ /**
2002
+ * Gets an attachment by ID
2003
+ * @param id - The UUID of the attachment to retrieve
2004
+ * @param options - Optional query parameters (expand, select)
2005
+ * @returns Promise resolving to the attachment
2006
+ *
2007
+ * @example
2008
+ * ```typescript
2009
+ * import { Attachments } from '@uipath/uipath-typescript/attachments';
2010
+ *
2011
+ * const attachments = new Attachments(sdk);
2012
+ * const attachment = await attachments.getById('12345678-1234-1234-1234-123456789abc');
2013
+ * ```
2014
+ */
2015
+ async getById(id, options = {}) {
2016
+ if (!id) {
2017
+ throw new ValidationError({ message: 'id is required for getById' });
2018
+ }
2019
+ // Prefix all keys in options with $ for OData
2020
+ const keysToPrefix = Object.keys(options);
2021
+ const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
2022
+ const response = await this.get(ORCHESTRATOR_ATTACHMENT_ENDPOINTS.GET_BY_ID(id), {
2023
+ params: apiOptions,
2024
+ });
2025
+ // Transform response from PascalCase to camelCase, then apply field maps
2026
+ const camelCased = pascalToCamelCaseKeys(response.data);
2027
+ camelCased.blobFileAccess = transformData(camelCased.blobFileAccess, BucketMap);
2028
+ return transformData(camelCased, AttachmentsMap);
2029
+ }
2030
+ }
2031
+ __decorate([
2032
+ track('Attachments.GetById')
2033
+ ], AttachmentService.prototype, "getById", null);
2034
+
1948
2035
  /**
1949
2036
  * Service for interacting with UiPath Orchestrator Jobs API
1950
2037
  */
1951
2038
  class JobService extends FolderScopedService {
1952
2039
  /**
1953
- * Gets all jobs across folders with optional filtering
2040
+ * Creates an instance of the Jobs service.
2041
+ *
2042
+ * @param instance - UiPath SDK instance providing authentication and configuration
2043
+ */
2044
+ constructor(instance) {
2045
+ super(instance);
2046
+ this.attachmentService = new AttachmentService(instance);
2047
+ }
2048
+ /**
2049
+ * Gets all jobs across folders with optional filtering and pagination.
2050
+ *
2051
+ * Returns jobs with full details including state, timing, and input/output arguments.
2052
+ * Pass `folderId` to scope the query to a specific folder.
1954
2053
  *
1955
- * @param options - Query options including optional folderId and pagination options
1956
- * @returns Promise resolving to array of jobs or paginated response
2054
+ * !!! info "Input and output fields are not included in `getAll` responses"
2055
+ * The `inputArguments`, `inputFile`, `outputArguments`, and `outputFile` fields will always be `null` in the `getAll` response. To retrieve a job's output, use the {@link getOutput} method with the job's `key` and `folderId`.
1957
2056
  *
2057
+ * @param options - Query options including optional folderId, filtering, and pagination options
2058
+ * @returns Promise resolving to either an array of jobs {@link NonPaginatedResponse}<{@link JobGetResponse}> or a {@link PaginatedResponse}<{@link JobGetResponse}> when pagination options are used.
2059
+ * {@link JobGetResponse}
1958
2060
  * @example
1959
2061
  * ```typescript
1960
- * import { Jobs } from '@uipath/uipath-typescript/jobs';
1961
- *
1962
- * const jobs = new Jobs(sdk);
1963
- *
1964
2062
  * // Get all jobs
1965
2063
  * const allJobs = await jobs.getAll();
1966
2064
  *
1967
2065
  * // Get all jobs in a specific folder
1968
- * const folderJobs = await jobs.getAll({ folderId: 123 });
2066
+ * const folderJobs = await jobs.getAll({ folderId: <folderId> });
1969
2067
  *
1970
2068
  * // With filtering
1971
2069
  * const runningJobs = await jobs.getAll({
@@ -1979,10 +2077,19 @@ class JobService extends FolderScopedService {
1979
2077
  * if (page1.hasNextPage) {
1980
2078
  * const page2 = await jobs.getAll({ cursor: page1.nextCursor });
1981
2079
  * }
2080
+ *
2081
+ * // Jump to specific page
2082
+ * const page5 = await jobs.getAll({
2083
+ * jumpToPage: 5,
2084
+ * pageSize: 10
2085
+ * });
1982
2086
  * ```
1983
2087
  */
1984
2088
  async getAll(options) {
1985
- const transformJobResponse = (job) => transformData(pascalToCamelCaseKeys(job), JobMap);
2089
+ const transformJobResponse = (job) => {
2090
+ const rawJob = transformData(pascalToCamelCaseKeys(job), JobMap);
2091
+ return createJobWithMethods(rawJob, this);
2092
+ };
1986
2093
  return PaginationHelpers.getAll({
1987
2094
  serviceAccess: this.createPaginationServiceAccess(),
1988
2095
  getEndpoint: () => JOB_ENDPOINTS.GET_ALL,
@@ -2000,10 +2107,144 @@ class JobService extends FolderScopedService {
2000
2107
  },
2001
2108
  }, options);
2002
2109
  }
2110
+ /**
2111
+ * Gets a job by its unique key (GUID).
2112
+ *
2113
+ * Returns the full job details including state, timing, input/output arguments, and error information.
2114
+ * Use `expand` to include related entities like `robot`, or `machine`.
2115
+ *
2116
+ * @param id - The unique key (GUID) of the job to retrieve
2117
+ * @param folderId - The folder ID where the job resides
2118
+ * @param options - Optional query options for expanding or selecting fields
2119
+ * @returns Promise resolving to a {@link JobGetResponse} with full job details and bound methods
2120
+ *
2121
+ * @example
2122
+ * ```typescript
2123
+ * // Get a job by key
2124
+ * const job = await jobs.getById(<id>, <folderId>);
2125
+ * console.log(job.state, job.processName);
2126
+ * ```
2127
+ *
2128
+ * @example
2129
+ * ```typescript
2130
+ * // With expanded related entities
2131
+ * const job = await jobs.getById(<id>, <folderId>, {
2132
+ * expand: 'robot,machine'
2133
+ * });
2134
+ * console.log(job.robot?.name, job.machine?.name);
2135
+ * ```
2136
+ */
2137
+ async getById(id, folderId, options) {
2138
+ if (!id) {
2139
+ throw new ValidationError({ message: 'id is required for getById' });
2140
+ }
2141
+ if (!folderId) {
2142
+ throw new ValidationError({ message: 'folderId is required for getById' });
2143
+ }
2144
+ const headers = createHeaders({ [FOLDER_ID]: folderId });
2145
+ const keysToPrefix = Object.keys(options ?? {});
2146
+ const apiOptions = options ? addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix) : {};
2147
+ const response = await this.get(JOB_ENDPOINTS.GET_BY_KEY(id), {
2148
+ params: apiOptions,
2149
+ headers,
2150
+ });
2151
+ const rawJob = transformData(pascalToCamelCaseKeys(response.data), JobMap);
2152
+ return createJobWithMethods(rawJob, this);
2153
+ }
2154
+ /**
2155
+ * Gets the output of a completed job.
2156
+ *
2157
+ * Retrieves the job's output arguments, handling both inline output (stored directly on the job
2158
+ * as a JSON string in `outputArguments`) and file-based output (stored as a blob attachment for
2159
+ * large outputs). Returns the parsed JSON output or `null` if the job has no output.
2160
+ *
2161
+ * @param jobKey - The unique key (GUID) of the job to retrieve output from
2162
+ * @param folderId - The folder ID where the job resides
2163
+ * @returns Promise resolving to the parsed output as `Record<string, unknown>`, or `null` if no output exists
2164
+ *
2165
+ * @example
2166
+ * ```typescript
2167
+ * // Get output from a completed job
2168
+ * const output = await jobs.getOutput(<jobKey>, <folderId>);
2169
+ *
2170
+ * if (output) {
2171
+ * console.log('Job output:', output);
2172
+ * }
2173
+ * ```
2174
+ *
2175
+ * @example
2176
+ * ```typescript
2177
+ * // Get output using bound method (jobKey and folderId are taken from the job object)
2178
+ * const allJobs = await jobs.getAll();
2179
+ * const completedJob = allJobs.items.find(j => j.state === JobState.Successful);
2180
+ *
2181
+ * if (completedJob) {
2182
+ * const output = await completedJob.getOutput();
2183
+ * }
2184
+ * ```
2185
+ */
2186
+ async getOutput(jobKey, folderId) {
2187
+ if (!jobKey) {
2188
+ throw new ValidationError({ message: 'jobKey is required for getOutput' });
2189
+ }
2190
+ const job = await this.getById(jobKey, folderId, { select: 'outputArguments,outputFile' });
2191
+ if (job.outputArguments) {
2192
+ try {
2193
+ return JSON.parse(job.outputArguments);
2194
+ }
2195
+ catch {
2196
+ throw new ServerError({ message: 'Failed to parse job output arguments as JSON' });
2197
+ }
2198
+ }
2199
+ if (job.outputFile) {
2200
+ return this.downloadOutputFile(job.outputFile);
2201
+ }
2202
+ return null;
2203
+ }
2204
+ /**
2205
+ * Downloads the output file content via the Attachments API.
2206
+ * 1. Fetches blob access info from the attachment using AttachmentService
2207
+ * 2. Downloads content from the presigned blob URI
2208
+ * 3. Parses and returns the JSON content
2209
+ */
2210
+ async downloadOutputFile(outputFileKey) {
2211
+ const attachment = await this.attachmentService.getById(outputFileKey);
2212
+ const blobAccess = attachment.blobFileAccess;
2213
+ if (!blobAccess?.uri) {
2214
+ return null;
2215
+ }
2216
+ const blobHeaders = { ...blobAccess.headers };
2217
+ // Add auth header if the blob URI requires authenticated access
2218
+ if (blobAccess.requiresAuth) {
2219
+ const token = await this.getValidAuthToken();
2220
+ blobHeaders['Authorization'] = `Bearer ${token}`;
2221
+ }
2222
+ const blobResponse = await fetch(blobAccess.uri, {
2223
+ method: 'GET',
2224
+ headers: blobHeaders,
2225
+ });
2226
+ if (!blobResponse.ok) {
2227
+ const errorInfo = await errorResponseParser.parse(blobResponse);
2228
+ throw ErrorFactory.createFromHttpStatus(blobResponse.status, errorInfo);
2229
+ }
2230
+ const content = await blobResponse.text();
2231
+ try {
2232
+ return JSON.parse(content);
2233
+ }
2234
+ catch {
2235
+ throw new ServerError({ message: 'Failed to parse job output file as JSON' });
2236
+ }
2237
+ }
2003
2238
  }
2004
2239
  __decorate([
2005
2240
  track('Jobs.GetAll')
2006
2241
  ], JobService.prototype, "getAll", null);
2242
+ __decorate([
2243
+ track('Jobs.GetById')
2244
+ ], JobService.prototype, "getById", null);
2245
+ __decorate([
2246
+ track('Jobs.GetOutput')
2247
+ ], JobService.prototype, "getOutput", null);
2007
2248
 
2008
2249
  /**
2009
2250
  * Enum for job sub-state
@@ -2030,4 +2271,20 @@ var ServerlessJobType;
2030
2271
  ServerlessJobType["PythonAgent"] = "PythonAgent";
2031
2272
  })(ServerlessJobType || (ServerlessJobType = {}));
2032
2273
 
2033
- export { JobService, JobSubState, JobService as Jobs, ServerlessJobType };
2274
+ /**
2275
+ * Common enum for job state used across services
2276
+ */
2277
+ var JobState;
2278
+ (function (JobState) {
2279
+ JobState["Pending"] = "Pending";
2280
+ JobState["Running"] = "Running";
2281
+ JobState["Stopping"] = "Stopping";
2282
+ JobState["Terminating"] = "Terminating";
2283
+ JobState["Faulted"] = "Faulted";
2284
+ JobState["Successful"] = "Successful";
2285
+ JobState["Stopped"] = "Stopped";
2286
+ JobState["Suspended"] = "Suspended";
2287
+ JobState["Resumed"] = "Resumed";
2288
+ })(JobState || (JobState = {}));
2289
+
2290
+ export { JobService, JobState, JobSubState, JobService as Jobs, ServerlessJobType, createJobWithMethods };
@@ -527,15 +527,11 @@ const RESPONSE_TYPES = {
527
527
 
528
528
  class ApiClient {
529
529
  constructor(config, executionContext, tokenManager, clientConfig = {}) {
530
- this.defaultHeaders = {};
531
530
  this.config = config;
532
531
  this.executionContext = executionContext;
533
532
  this.clientConfig = clientConfig;
534
533
  this.tokenManager = tokenManager;
535
534
  }
536
- setDefaultHeaders(headers) {
537
- this.defaultHeaders = { ...this.defaultHeaders, ...headers };
538
- }
539
535
  /**
540
536
  * Gets a valid authentication token, refreshing if necessary.
541
537
  * Used internally for API requests and exposed for services that need manual auth headers.
@@ -551,7 +547,6 @@ class ApiClient {
551
547
  return {
552
548
  'Authorization': `Bearer ${token}`,
553
549
  'Content-Type': CONTENT_TYPES.JSON,
554
- ...this.defaultHeaders,
555
550
  ...this.clientConfig.headers
556
551
  };
557
552
  }
@@ -1320,6 +1315,8 @@ class BaseService {
1320
1315
  *
1321
1316
  * @param instance - UiPath SDK instance providing authentication and configuration.
1322
1317
  * Services receive this via dependency injection in the modular pattern.
1318
+ * @param headers - Optional default headers to include in every request (e.g. `x-uipath-external-user-id` for
1319
+ * CAS external-app auth)
1323
1320
  *
1324
1321
  * @example
1325
1322
  * ```typescript
@@ -1339,11 +1336,11 @@ class BaseService {
1339
1336
  * const entities = new Entities(sdk);
1340
1337
  * ```
1341
1338
  */
1342
- constructor(instance) {
1339
+ constructor(instance, headers) {
1343
1340
  // Private field - not visible via Object.keys() or any reflection
1344
1341
  _BaseService_apiClient.set(this, void 0);
1345
1342
  const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
1346
- __classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager), "f");
1343
+ __classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
1347
1344
  }
1348
1345
  /**
1349
1346
  * Gets a valid authentication token, refreshing if necessary.
@@ -1732,7 +1729,7 @@ class BpmnHelpers {
1732
1729
  // Connection string placeholder that will be replaced during build
1733
1730
  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";
1734
1731
  // SDK Version placeholder
1735
- const SDK_VERSION = "1.2.2";
1732
+ const SDK_VERSION = "1.3.1";
1736
1733
  const VERSION = "Version";
1737
1734
  const SERVICE = "Service";
1738
1735
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -871,6 +871,8 @@ declare class BaseService {
871
871
  *
872
872
  * @param instance - UiPath SDK instance providing authentication and configuration.
873
873
  * Services receive this via dependency injection in the modular pattern.
874
+ * @param headers - Optional default headers to include in every request (e.g. `x-uipath-external-user-id` for
875
+ * CAS external-app auth)
874
876
  *
875
877
  * @example
876
878
  * ```typescript
@@ -890,7 +892,7 @@ declare class BaseService {
890
892
  * const entities = new Entities(sdk);
891
893
  * ```
892
894
  */
893
- constructor(instance: IUiPath);
895
+ constructor(instance: IUiPath, headers?: Record<string, string>);
894
896
  /**
895
897
  * Gets a valid authentication token, refreshing if necessary.
896
898
  * Use this when you need to manually add Authorization headers (e.g., direct uploads).
@@ -525,15 +525,11 @@ const RESPONSE_TYPES = {
525
525
 
526
526
  class ApiClient {
527
527
  constructor(config, executionContext, tokenManager, clientConfig = {}) {
528
- this.defaultHeaders = {};
529
528
  this.config = config;
530
529
  this.executionContext = executionContext;
531
530
  this.clientConfig = clientConfig;
532
531
  this.tokenManager = tokenManager;
533
532
  }
534
- setDefaultHeaders(headers) {
535
- this.defaultHeaders = { ...this.defaultHeaders, ...headers };
536
- }
537
533
  /**
538
534
  * Gets a valid authentication token, refreshing if necessary.
539
535
  * Used internally for API requests and exposed for services that need manual auth headers.
@@ -549,7 +545,6 @@ class ApiClient {
549
545
  return {
550
546
  'Authorization': `Bearer ${token}`,
551
547
  'Content-Type': CONTENT_TYPES.JSON,
552
- ...this.defaultHeaders,
553
548
  ...this.clientConfig.headers
554
549
  };
555
550
  }
@@ -1318,6 +1313,8 @@ class BaseService {
1318
1313
  *
1319
1314
  * @param instance - UiPath SDK instance providing authentication and configuration.
1320
1315
  * Services receive this via dependency injection in the modular pattern.
1316
+ * @param headers - Optional default headers to include in every request (e.g. `x-uipath-external-user-id` for
1317
+ * CAS external-app auth)
1321
1318
  *
1322
1319
  * @example
1323
1320
  * ```typescript
@@ -1337,11 +1334,11 @@ class BaseService {
1337
1334
  * const entities = new Entities(sdk);
1338
1335
  * ```
1339
1336
  */
1340
- constructor(instance) {
1337
+ constructor(instance, headers) {
1341
1338
  // Private field - not visible via Object.keys() or any reflection
1342
1339
  _BaseService_apiClient.set(this, void 0);
1343
1340
  const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
1344
- __classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager), "f");
1341
+ __classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
1345
1342
  }
1346
1343
  /**
1347
1344
  * Gets a valid authentication token, refreshing if necessary.
@@ -1730,7 +1727,7 @@ class BpmnHelpers {
1730
1727
  // Connection string placeholder that will be replaced during build
1731
1728
  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";
1732
1729
  // SDK Version placeholder
1733
- const SDK_VERSION = "1.2.2";
1730
+ const SDK_VERSION = "1.3.1";
1734
1731
  const VERSION = "Version";
1735
1732
  const SERVICE = "Service";
1736
1733
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -526,15 +526,11 @@ const RESPONSE_TYPES = {
526
526
 
527
527
  class ApiClient {
528
528
  constructor(config, executionContext, tokenManager, clientConfig = {}) {
529
- this.defaultHeaders = {};
530
529
  this.config = config;
531
530
  this.executionContext = executionContext;
532
531
  this.clientConfig = clientConfig;
533
532
  this.tokenManager = tokenManager;
534
533
  }
535
- setDefaultHeaders(headers) {
536
- this.defaultHeaders = { ...this.defaultHeaders, ...headers };
537
- }
538
534
  /**
539
535
  * Gets a valid authentication token, refreshing if necessary.
540
536
  * Used internally for API requests and exposed for services that need manual auth headers.
@@ -550,7 +546,6 @@ class ApiClient {
550
546
  return {
551
547
  'Authorization': `Bearer ${token}`,
552
548
  'Content-Type': CONTENT_TYPES.JSON,
553
- ...this.defaultHeaders,
554
549
  ...this.clientConfig.headers
555
550
  };
556
551
  }
@@ -1453,6 +1448,8 @@ class BaseService {
1453
1448
  *
1454
1449
  * @param instance - UiPath SDK instance providing authentication and configuration.
1455
1450
  * Services receive this via dependency injection in the modular pattern.
1451
+ * @param headers - Optional default headers to include in every request (e.g. `x-uipath-external-user-id` for
1452
+ * CAS external-app auth)
1456
1453
  *
1457
1454
  * @example
1458
1455
  * ```typescript
@@ -1472,11 +1469,11 @@ class BaseService {
1472
1469
  * const entities = new Entities(sdk);
1473
1470
  * ```
1474
1471
  */
1475
- constructor(instance) {
1472
+ constructor(instance, headers) {
1476
1473
  // Private field - not visible via Object.keys() or any reflection
1477
1474
  _BaseService_apiClient.set(this, void 0);
1478
1475
  const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
1479
- __classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager), "f");
1476
+ __classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
1480
1477
  }
1481
1478
  /**
1482
1479
  * Gets a valid authentication token, refreshing if necessary.
@@ -1712,7 +1709,7 @@ const PROCESS_ENDPOINTS = {
1712
1709
  // Connection string placeholder that will be replaced during build
1713
1710
  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
1711
  // SDK Version placeholder
1715
- const SDK_VERSION = "1.2.2";
1712
+ const SDK_VERSION = "1.3.1";
1716
1713
  const VERSION = "Version";
1717
1714
  const SERVICE = "Service";
1718
1715
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -227,6 +227,8 @@ declare class BaseService {
227
227
  *
228
228
  * @param instance - UiPath SDK instance providing authentication and configuration.
229
229
  * Services receive this via dependency injection in the modular pattern.
230
+ * @param headers - Optional default headers to include in every request (e.g. `x-uipath-external-user-id` for
231
+ * CAS external-app auth)
230
232
  *
231
233
  * @example
232
234
  * ```typescript
@@ -246,7 +248,7 @@ declare class BaseService {
246
248
  * const entities = new Entities(sdk);
247
249
  * ```
248
250
  */
249
- constructor(instance: IUiPath);
251
+ constructor(instance: IUiPath, headers?: Record<string, string>);
250
252
  /**
251
253
  * Gets a valid authentication token, refreshing if necessary.
252
254
  * Use this when you need to manually add Authorization headers (e.g., direct uploads).
@@ -524,15 +524,11 @@ const RESPONSE_TYPES = {
524
524
 
525
525
  class ApiClient {
526
526
  constructor(config, executionContext, tokenManager, clientConfig = {}) {
527
- this.defaultHeaders = {};
528
527
  this.config = config;
529
528
  this.executionContext = executionContext;
530
529
  this.clientConfig = clientConfig;
531
530
  this.tokenManager = tokenManager;
532
531
  }
533
- setDefaultHeaders(headers) {
534
- this.defaultHeaders = { ...this.defaultHeaders, ...headers };
535
- }
536
532
  /**
537
533
  * Gets a valid authentication token, refreshing if necessary.
538
534
  * Used internally for API requests and exposed for services that need manual auth headers.
@@ -548,7 +544,6 @@ class ApiClient {
548
544
  return {
549
545
  'Authorization': `Bearer ${token}`,
550
546
  'Content-Type': CONTENT_TYPES.JSON,
551
- ...this.defaultHeaders,
552
547
  ...this.clientConfig.headers
553
548
  };
554
549
  }
@@ -1451,6 +1446,8 @@ class BaseService {
1451
1446
  *
1452
1447
  * @param instance - UiPath SDK instance providing authentication and configuration.
1453
1448
  * Services receive this via dependency injection in the modular pattern.
1449
+ * @param headers - Optional default headers to include in every request (e.g. `x-uipath-external-user-id` for
1450
+ * CAS external-app auth)
1454
1451
  *
1455
1452
  * @example
1456
1453
  * ```typescript
@@ -1470,11 +1467,11 @@ class BaseService {
1470
1467
  * const entities = new Entities(sdk);
1471
1468
  * ```
1472
1469
  */
1473
- constructor(instance) {
1470
+ constructor(instance, headers) {
1474
1471
  // Private field - not visible via Object.keys() or any reflection
1475
1472
  _BaseService_apiClient.set(this, void 0);
1476
1473
  const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
1477
- __classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager), "f");
1474
+ __classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
1478
1475
  }
1479
1476
  /**
1480
1477
  * Gets a valid authentication token, refreshing if necessary.
@@ -1710,7 +1707,7 @@ const PROCESS_ENDPOINTS = {
1710
1707
  // Connection string placeholder that will be replaced during build
1711
1708
  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";
1712
1709
  // SDK Version placeholder
1713
- const SDK_VERSION = "1.2.2";
1710
+ const SDK_VERSION = "1.3.1";
1714
1711
  const VERSION = "Version";
1715
1712
  const SERVICE = "Service";
1716
1713
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";