@uipath/uipath-typescript 1.3.6 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index.cjs +243 -6
- package/dist/assets/index.d.ts +113 -13
- package/dist/assets/index.mjs +243 -6
- package/dist/attachments/index.cjs +42 -6
- package/dist/attachments/index.d.ts +8 -0
- package/dist/attachments/index.mjs +42 -6
- package/dist/buckets/index.cjs +211 -6
- package/dist/buckets/index.d.ts +57 -12
- package/dist/buckets/index.mjs +211 -6
- package/dist/cases/index.cjs +180 -6
- package/dist/cases/index.d.ts +165 -3
- package/dist/cases/index.mjs +181 -7
- package/dist/conversational-agent/index.cjs +235 -85
- package/dist/conversational-agent/index.d.ts +327 -80
- package/dist/conversational-agent/index.mjs +234 -84
- package/dist/core/index.cjs +18 -6
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.mjs +18 -6
- package/dist/entities/index.cjs +74 -10
- package/dist/entities/index.d.ts +102 -11
- package/dist/entities/index.mjs +75 -11
- package/dist/feedback/index.cjs +293 -10
- package/dist/feedback/index.d.ts +425 -12
- package/dist/feedback/index.mjs +293 -10
- package/dist/index.cjs +463 -17
- package/dist/index.d.ts +885 -39
- package/dist/index.mjs +464 -18
- package/dist/index.umd.js +463 -17
- package/dist/jobs/index.cjs +211 -6
- package/dist/jobs/index.d.ts +68 -23
- package/dist/jobs/index.mjs +211 -6
- package/dist/maestro-processes/index.cjs +79 -6
- package/dist/maestro-processes/index.d.ts +8 -0
- package/dist/maestro-processes/index.mjs +79 -6
- package/dist/processes/index.cjs +279 -7
- package/dist/processes/index.d.ts +125 -2
- package/dist/processes/index.mjs +279 -7
- package/dist/queues/index.cjs +211 -6
- package/dist/queues/index.d.ts +57 -12
- package/dist/queues/index.mjs +211 -6
- package/dist/tasks/index.cjs +42 -6
- package/dist/tasks/index.d.ts +8 -0
- package/dist/tasks/index.mjs +42 -6
- package/package.json +1 -1
package/dist/processes/index.cjs
CHANGED
|
@@ -505,6 +505,8 @@ class ErrorFactory {
|
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
507
|
|
|
508
|
+
const FOLDER_KEY = 'X-UIPATH-FolderKey';
|
|
509
|
+
const FOLDER_PATH_ENCODED = 'X-UIPATH-FolderPath-Encoded';
|
|
508
510
|
const FOLDER_ID = 'X-UIPATH-OrganizationUnitId';
|
|
509
511
|
const TRACEPARENT = 'traceparent';
|
|
510
512
|
const UIPATH_TRACEPARENT_ID = 'x-uipath-traceparent-id';
|
|
@@ -651,6 +653,27 @@ var PaginationType;
|
|
|
651
653
|
/**
|
|
652
654
|
* Collection of utility functions for working with objects
|
|
653
655
|
*/
|
|
656
|
+
/**
|
|
657
|
+
* Resolves a field value from an object, supporting both direct keys (e.g., '@odata.count')
|
|
658
|
+
* and dot-separated nested paths (e.g., 'pagination.totalCount').
|
|
659
|
+
* Direct key match takes priority over nested traversal.
|
|
660
|
+
*/
|
|
661
|
+
function resolveNestedField(data, fieldPath) {
|
|
662
|
+
if (!data) {
|
|
663
|
+
return undefined;
|
|
664
|
+
}
|
|
665
|
+
if (fieldPath in data) {
|
|
666
|
+
return data[fieldPath];
|
|
667
|
+
}
|
|
668
|
+
if (!fieldPath.includes('.')) {
|
|
669
|
+
return undefined;
|
|
670
|
+
}
|
|
671
|
+
let value = data;
|
|
672
|
+
for (const part of fieldPath.split('.')) {
|
|
673
|
+
value = value?.[part];
|
|
674
|
+
}
|
|
675
|
+
return value;
|
|
676
|
+
}
|
|
654
677
|
/**
|
|
655
678
|
* Filters out undefined values from an object
|
|
656
679
|
* @param obj The source object
|
|
@@ -891,6 +914,10 @@ const BUCKET_TOKEN_PARAMS = {
|
|
|
891
914
|
TOKEN_PARAM: 'continuationToken'
|
|
892
915
|
};
|
|
893
916
|
|
|
917
|
+
/**
|
|
918
|
+
* Converts a UTC timestamp string (e.g., "5/8/2026 11:20:17 AM") to ISO 8601 UTC format.
|
|
919
|
+
* Returns the original value if parsing fails.
|
|
920
|
+
*/
|
|
894
921
|
/**
|
|
895
922
|
* Transforms data by mapping fields according to the provided field mapping
|
|
896
923
|
* @param data The source data to transform
|
|
@@ -1308,7 +1335,8 @@ class PaginationHelpers {
|
|
|
1308
1335
|
// Extract and transform items from response
|
|
1309
1336
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1310
1337
|
const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
|
|
1311
|
-
const
|
|
1338
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1339
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1312
1340
|
// Parse items - automatically handle JSON string responses
|
|
1313
1341
|
const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
|
|
1314
1342
|
const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
|
|
@@ -1484,8 +1512,9 @@ class BaseService {
|
|
|
1484
1512
|
constructor(instance, headers) {
|
|
1485
1513
|
// Private field - not visible via Object.keys() or any reflection
|
|
1486
1514
|
_BaseService_apiClient.set(this, void 0);
|
|
1487
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
1515
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
1488
1516
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
1517
|
+
this.config = { folderKey };
|
|
1489
1518
|
}
|
|
1490
1519
|
/**
|
|
1491
1520
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -1604,9 +1633,17 @@ class BaseService {
|
|
|
1604
1633
|
const pageSizeParam = paginationParams?.pageSizeParam || ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM;
|
|
1605
1634
|
const offsetParam = paginationParams?.offsetParam || ODATA_OFFSET_PARAMS.OFFSET_PARAM;
|
|
1606
1635
|
const countParam = paginationParams?.countParam || ODATA_OFFSET_PARAMS.COUNT_PARAM;
|
|
1636
|
+
// When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
|
|
1637
|
+
// When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
|
|
1638
|
+
const convertToSkip = paginationParams?.convertToSkip ?? true;
|
|
1607
1639
|
requestParams[pageSizeParam] = limitedPageSize;
|
|
1608
|
-
if (
|
|
1609
|
-
|
|
1640
|
+
if (convertToSkip) {
|
|
1641
|
+
if (params.pageNumber && params.pageNumber > 1) {
|
|
1642
|
+
requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
else {
|
|
1646
|
+
requestParams[offsetParam] = params.pageNumber || 1;
|
|
1610
1647
|
}
|
|
1611
1648
|
{
|
|
1612
1649
|
requestParams[countParam] = true;
|
|
@@ -1637,7 +1674,8 @@ class BaseService {
|
|
|
1637
1674
|
// Extract items and metadata
|
|
1638
1675
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1639
1676
|
const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
|
|
1640
|
-
const
|
|
1677
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1678
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1641
1679
|
const continuationToken = response.data[continuationTokenField];
|
|
1642
1680
|
// Determine if there are more pages
|
|
1643
1681
|
const hasMore = this.determineHasMorePages(paginationType, {
|
|
@@ -1682,6 +1720,208 @@ class BaseService {
|
|
|
1682
1720
|
}
|
|
1683
1721
|
_BaseService_apiClient = new WeakMap();
|
|
1684
1722
|
|
|
1723
|
+
/**
|
|
1724
|
+
* Validates the `name` argument passed to a `getByName(name, ...)` method.
|
|
1725
|
+
* Trims whitespace and rejects empty/whitespace-only names.
|
|
1726
|
+
*
|
|
1727
|
+
* @param resourceType - Resource label used in error messages (e.g. 'Asset', 'Process')
|
|
1728
|
+
* @param name - Resource name to validate
|
|
1729
|
+
* @returns The trimmed name
|
|
1730
|
+
* @throws ValidationError when `name` is missing or empty after trimming
|
|
1731
|
+
*/
|
|
1732
|
+
function validateName(resourceType, name) {
|
|
1733
|
+
if (!name) {
|
|
1734
|
+
throw new ValidationError({
|
|
1735
|
+
message: `${resourceType} name is required and cannot be empty.`,
|
|
1736
|
+
});
|
|
1737
|
+
}
|
|
1738
|
+
const trimmed = name.trim();
|
|
1739
|
+
if (!trimmed) {
|
|
1740
|
+
throw new ValidationError({
|
|
1741
|
+
message: `${resourceType} name is required and cannot be empty.`,
|
|
1742
|
+
});
|
|
1743
|
+
}
|
|
1744
|
+
return trimmed;
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
/**
|
|
1748
|
+
* Encodes a folder path for the `X-UIPATH-FolderPath-Encoded` header.
|
|
1749
|
+
*
|
|
1750
|
+
* Orchestrator decodes this header as **base64-encoded UTF-16 LE bytes**
|
|
1751
|
+
* (see `HttpHeadersProviderExtensions.GetDecoded` + `OrganizationUnitProvider`
|
|
1752
|
+
* in the Orchestrator repo, which call `Encoding.Unicode.GetString(...)`).
|
|
1753
|
+
* URL-encoding is NOT what the server expects — it must be base64-of-UTF-16-LE
|
|
1754
|
+
* bytes.
|
|
1755
|
+
*
|
|
1756
|
+
* @param folderPath - The folder path (e.g. 'Shared/Finance')
|
|
1757
|
+
* @returns Base64 string suitable for the `X-UIPATH-FolderPath-Encoded` header
|
|
1758
|
+
*/
|
|
1759
|
+
function encodeFolderPathHeader(folderPath) {
|
|
1760
|
+
// Force little-endian regardless of host byte order. `Uint16Array` viewed
|
|
1761
|
+
// as `Uint8Array` would use the host's native order — correct on LE hosts
|
|
1762
|
+
// (x86/ARM-LE) but wrong on BE hosts. `DataView.setUint16(..., true)`
|
|
1763
|
+
// pins LE.
|
|
1764
|
+
const buf = new ArrayBuffer(folderPath.length * 2);
|
|
1765
|
+
const view = new DataView(buf);
|
|
1766
|
+
for (let i = 0; i < folderPath.length; i++) {
|
|
1767
|
+
view.setUint16(i * 2, folderPath.charCodeAt(i), true);
|
|
1768
|
+
}
|
|
1769
|
+
const bytes = new Uint8Array(buf);
|
|
1770
|
+
let binary = '';
|
|
1771
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
1772
|
+
binary += String.fromCharCode(bytes[i]);
|
|
1773
|
+
}
|
|
1774
|
+
// btoa is browser-native; Node 16+ also has it as a global
|
|
1775
|
+
return btoa(binary);
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
/**
|
|
1779
|
+
* Resolves folder context into the appropriate Orchestrator folder headers.
|
|
1780
|
+
*
|
|
1781
|
+
* Centralized so all folder-scoped methods (e.g. `assets.getByName`,
|
|
1782
|
+
* `processes.getByName`, future Queues/Buckets/Jobs) share one implementation.
|
|
1783
|
+
*
|
|
1784
|
+
* Each input field maps directly to its header — no auto-detection or type
|
|
1785
|
+
* coercion. When multiple fields are supplied, all corresponding headers
|
|
1786
|
+
* are forwarded and the server resolves precedence.
|
|
1787
|
+
*
|
|
1788
|
+
* Routing:
|
|
1789
|
+
* - `folderId` → `X-UIPATH-OrganizationUnitId`
|
|
1790
|
+
* - `folderKey` → `X-UIPATH-FolderKey`
|
|
1791
|
+
* - `folderPath` → `X-UIPATH-FolderPath-Encoded`
|
|
1792
|
+
* - none set + `fallbackFolderKey` → fallback used as `X-UIPATH-FolderKey`
|
|
1793
|
+
* - none set + no fallback → `ValidationError`
|
|
1794
|
+
*
|
|
1795
|
+
* @throws ValidationError when no folder context can be resolved.
|
|
1796
|
+
*/
|
|
1797
|
+
function resolveFolderHeaders(input) {
|
|
1798
|
+
const { folderId, folderKey, folderPath, resourceType, fallbackFolderKey } = input;
|
|
1799
|
+
const trimmedKey = folderKey?.trim();
|
|
1800
|
+
const trimmedPath = folderPath?.trim();
|
|
1801
|
+
const headers = {};
|
|
1802
|
+
if (folderId !== undefined) {
|
|
1803
|
+
headers[FOLDER_ID] = folderId;
|
|
1804
|
+
}
|
|
1805
|
+
if (trimmedKey) {
|
|
1806
|
+
headers[FOLDER_KEY] = trimmedKey;
|
|
1807
|
+
}
|
|
1808
|
+
if (trimmedPath) {
|
|
1809
|
+
headers[FOLDER_PATH_ENCODED] = encodeFolderPathHeader(trimmedPath);
|
|
1810
|
+
}
|
|
1811
|
+
// No explicit folder context → meta-tag fallback or error.
|
|
1812
|
+
if (Object.keys(headers).length === 0) {
|
|
1813
|
+
if (!fallbackFolderKey) {
|
|
1814
|
+
throw new ValidationError({
|
|
1815
|
+
message: `${resourceType} requires folder context: pass \`folderId\`, \`folderKey\`, or \`folderPath\`, or initialize the SDK with a folder context.`,
|
|
1816
|
+
});
|
|
1817
|
+
}
|
|
1818
|
+
headers[FOLDER_KEY] = fallbackFolderKey;
|
|
1819
|
+
}
|
|
1820
|
+
return createHeaders(headers);
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
/**
|
|
1824
|
+
* Matches single-quote characters in OData string literals — escaped to `''`
|
|
1825
|
+
* inside the `$filter=Name eq '…'` clause built by `getByNameLookup`.
|
|
1826
|
+
*/
|
|
1827
|
+
const SINGLE_QUOTE_RE = /'/g;
|
|
1828
|
+
/**
|
|
1829
|
+
* Base service for services that need folder-specific functionality.
|
|
1830
|
+
*
|
|
1831
|
+
* Extends BaseService with additional methods for working with folder-scoped resources
|
|
1832
|
+
* in UiPath Orchestrator. Services that work with folders (Assets, Queues) extend this class.
|
|
1833
|
+
*
|
|
1834
|
+
* @remarks
|
|
1835
|
+
* This class provides helper methods for making folder-scoped API calls, handling folder IDs
|
|
1836
|
+
* in request headers, and managing cross-folder queries.
|
|
1837
|
+
*/
|
|
1838
|
+
class FolderScopedService extends BaseService {
|
|
1839
|
+
/**
|
|
1840
|
+
* Gets resources in a folder with optional query parameters
|
|
1841
|
+
*
|
|
1842
|
+
* @param endpoint - API endpoint to call
|
|
1843
|
+
* @param folderId - required folder ID
|
|
1844
|
+
* @param options - Query options
|
|
1845
|
+
* @param transformFn - Optional function to transform the response data
|
|
1846
|
+
* @returns Promise resolving to an array of resources
|
|
1847
|
+
*/
|
|
1848
|
+
async _getByFolder(endpoint, folderId, options = {}, transformFn) {
|
|
1849
|
+
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
1850
|
+
const keysToPrefix = Object.keys(options);
|
|
1851
|
+
const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
|
|
1852
|
+
const response = await this.get(endpoint, {
|
|
1853
|
+
params: apiOptions,
|
|
1854
|
+
headers
|
|
1855
|
+
});
|
|
1856
|
+
if (transformFn) {
|
|
1857
|
+
return response.data?.value.map(transformFn);
|
|
1858
|
+
}
|
|
1859
|
+
return response.data?.value;
|
|
1860
|
+
}
|
|
1861
|
+
/**
|
|
1862
|
+
* Look up a single resource by name on a folder-scoped OData collection.
|
|
1863
|
+
*
|
|
1864
|
+
* Shared by `getByName` implementations across services (Assets, Processes, etc).
|
|
1865
|
+
* Handles:
|
|
1866
|
+
* - Name validation via `validateName`
|
|
1867
|
+
* - Folder header resolution via `resolveFolderHeaders` (folderId → ID/key
|
|
1868
|
+
* header by type, folderPath → encoded path header, falls back to
|
|
1869
|
+
* init-time `config.folderKey` from the `uipath:folder-key` meta tag)
|
|
1870
|
+
* - OData `$filter=Name eq '…'` with single-quote escaping + `$top=1`
|
|
1871
|
+
* - Empty-result → `NotFoundError` with folder context in the message
|
|
1872
|
+
*
|
|
1873
|
+
* The transform step is caller-provided because each resource has its own
|
|
1874
|
+
* PascalCase → camelCase field mapping.
|
|
1875
|
+
*
|
|
1876
|
+
* @param resourceType - Resource label used in validation + error messages (e.g. 'Asset', 'Process')
|
|
1877
|
+
* @param endpoint - Folder-scoped OData collection endpoint
|
|
1878
|
+
* @param name - Resource name to search for
|
|
1879
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) + OData query options (`expand`, `select`)
|
|
1880
|
+
* @param transform - Maps a raw OData item to the typed response (e.g. PascalCase → camelCase via field map)
|
|
1881
|
+
* @throws ValidationError when inputs are malformed; NotFoundError when no match
|
|
1882
|
+
*/
|
|
1883
|
+
async getByNameLookup(resourceType, endpoint, name, options, transform) {
|
|
1884
|
+
const validatedName = validateName(resourceType, name);
|
|
1885
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
1886
|
+
const headers = resolveFolderHeaders({
|
|
1887
|
+
folderId,
|
|
1888
|
+
folderKey,
|
|
1889
|
+
folderPath,
|
|
1890
|
+
resourceType: `${resourceType}.getByName`,
|
|
1891
|
+
fallbackFolderKey: this.config.folderKey,
|
|
1892
|
+
});
|
|
1893
|
+
const apiOptions = {
|
|
1894
|
+
...addPrefixToKeys(queryOptions, ODATA_PREFIX, Object.keys(queryOptions)),
|
|
1895
|
+
'$filter': `Name eq '${validatedName.replace(SINGLE_QUOTE_RE, "''")}'`,
|
|
1896
|
+
'$top': '1',
|
|
1897
|
+
};
|
|
1898
|
+
const response = await this.get(endpoint, {
|
|
1899
|
+
headers,
|
|
1900
|
+
params: apiOptions,
|
|
1901
|
+
});
|
|
1902
|
+
const items = response.data?.value;
|
|
1903
|
+
if (!items?.length) {
|
|
1904
|
+
const folderHint = describeFolderForError(folderId, folderKey, folderPath);
|
|
1905
|
+
throw new NotFoundError({
|
|
1906
|
+
message: `${resourceType} '${validatedName}' not found${folderHint}.`,
|
|
1907
|
+
});
|
|
1908
|
+
}
|
|
1909
|
+
return transform(items[0]);
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
/** Renders the supplied folder for a NotFoundError message. */
|
|
1913
|
+
function describeFolderForError(folderId, folderKey, folderPath) {
|
|
1914
|
+
const path = folderPath?.trim();
|
|
1915
|
+
if (path)
|
|
1916
|
+
return ` in folder '${path}'`;
|
|
1917
|
+
const key = folderKey?.trim();
|
|
1918
|
+
if (key)
|
|
1919
|
+
return ` in folder (key: ${key})`;
|
|
1920
|
+
if (typeof folderId === 'number')
|
|
1921
|
+
return ` in folder (id: ${folderId})`;
|
|
1922
|
+
return '';
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1685
1925
|
/**
|
|
1686
1926
|
* Maps fields for Process entities to ensure consistent naming
|
|
1687
1927
|
*/
|
|
@@ -1722,7 +1962,7 @@ const PROCESS_ENDPOINTS = {
|
|
|
1722
1962
|
// Connection string placeholder that will be replaced during build
|
|
1723
1963
|
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";
|
|
1724
1964
|
// SDK Version placeholder
|
|
1725
|
-
const SDK_VERSION = "1.3.
|
|
1965
|
+
const SDK_VERSION = "1.3.8";
|
|
1726
1966
|
const VERSION = "Version";
|
|
1727
1967
|
const SERVICE = "Service";
|
|
1728
1968
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -1993,7 +2233,7 @@ function track(nameOrOptions, options) {
|
|
|
1993
2233
|
/**
|
|
1994
2234
|
* Service for interacting with UiPath Orchestrator Processes API
|
|
1995
2235
|
*/
|
|
1996
|
-
class ProcessService extends
|
|
2236
|
+
class ProcessService extends FolderScopedService {
|
|
1997
2237
|
/**
|
|
1998
2238
|
* Gets all processes across folders with optional filtering and folder scoping
|
|
1999
2239
|
*
|
|
@@ -2130,6 +2370,35 @@ class ProcessService extends BaseService {
|
|
|
2130
2370
|
const transformedProcess = transformData(pascalToCamelCaseKeys(response.data), ProcessMap);
|
|
2131
2371
|
return transformedProcess;
|
|
2132
2372
|
}
|
|
2373
|
+
/**
|
|
2374
|
+
* Retrieves a single process by name.
|
|
2375
|
+
*
|
|
2376
|
+
* @param name - Process name to search for
|
|
2377
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
|
|
2378
|
+
* @returns Promise resolving to a single process
|
|
2379
|
+
* {@link ProcessGetResponse}
|
|
2380
|
+
* @example
|
|
2381
|
+
* ```typescript
|
|
2382
|
+
* import { Processes } from '@uipath/uipath-typescript/processes';
|
|
2383
|
+
*
|
|
2384
|
+
* const processes = new Processes(sdk);
|
|
2385
|
+
*
|
|
2386
|
+
* // By folder ID
|
|
2387
|
+
* await processes.getByName('MyProcess', { folderId: 123 });
|
|
2388
|
+
*
|
|
2389
|
+
* // By folder key (GUID)
|
|
2390
|
+
* await processes.getByName('MyProcess', { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
|
|
2391
|
+
*
|
|
2392
|
+
* // By folder path
|
|
2393
|
+
* await processes.getByName('MyProcess', { folderPath: 'Shared/Finance' });
|
|
2394
|
+
*
|
|
2395
|
+
* // With expand
|
|
2396
|
+
* await processes.getByName('MyProcess', { folderPath: 'Shared/Finance', expand: 'entryPoints' });
|
|
2397
|
+
* ```
|
|
2398
|
+
*/
|
|
2399
|
+
async getByName(name, options = {}) {
|
|
2400
|
+
return this.getByNameLookup('Process', PROCESS_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), ProcessMap));
|
|
2401
|
+
}
|
|
2133
2402
|
}
|
|
2134
2403
|
__decorate([
|
|
2135
2404
|
track('Processes.GetAll')
|
|
@@ -2140,6 +2409,9 @@ __decorate([
|
|
|
2140
2409
|
__decorate([
|
|
2141
2410
|
track('Processes.GetById')
|
|
2142
2411
|
], ProcessService.prototype, "getById", null);
|
|
2412
|
+
__decorate([
|
|
2413
|
+
track('Processes.GetByName')
|
|
2414
|
+
], ProcessService.prototype, "getByName", null);
|
|
2143
2415
|
|
|
2144
2416
|
/**
|
|
2145
2417
|
* Enum for package types
|
|
@@ -106,6 +106,7 @@ interface RequestWithPaginationOptions extends RequestSpec {
|
|
|
106
106
|
offsetParam?: string;
|
|
107
107
|
tokenParam?: string;
|
|
108
108
|
countParam?: string;
|
|
109
|
+
convertToSkip?: boolean;
|
|
109
110
|
};
|
|
110
111
|
};
|
|
111
112
|
}
|
|
@@ -218,6 +219,13 @@ interface ApiResponse<T> {
|
|
|
218
219
|
*/
|
|
219
220
|
declare class BaseService {
|
|
220
221
|
#private;
|
|
222
|
+
/**
|
|
223
|
+
* SDK configuration (read-only). Available to subclasses so they can
|
|
224
|
+
* fall back to init-time defaults like `folderKey`.
|
|
225
|
+
*/
|
|
226
|
+
protected readonly config: {
|
|
227
|
+
folderKey?: string;
|
|
228
|
+
};
|
|
221
229
|
/**
|
|
222
230
|
* Creates a base service instance with dependency injection.
|
|
223
231
|
*
|
|
@@ -316,6 +324,66 @@ interface RequestOptions extends BaseOptions {
|
|
|
316
324
|
filter?: string;
|
|
317
325
|
orderby?: string;
|
|
318
326
|
}
|
|
327
|
+
/**
|
|
328
|
+
* Options that scope a name-based lookup (e.g. `getByName`) to a folder.
|
|
329
|
+
* Provide one of `folderId`, `folderKey`, or `folderPath`. When more than
|
|
330
|
+
* one is supplied, all are forwarded; the server applies precedence
|
|
331
|
+
* `folderPath` > `folderKey` > `folderId`.
|
|
332
|
+
*/
|
|
333
|
+
interface FolderScopedOptions extends BaseOptions {
|
|
334
|
+
/** Numeric folder ID. */
|
|
335
|
+
folderId?: number;
|
|
336
|
+
/** Folder key (GUID-formatted string). */
|
|
337
|
+
folderKey?: string;
|
|
338
|
+
/** Slash-delimited folder path, e.g. `'Shared/Finance'`. */
|
|
339
|
+
folderPath?: string;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Base service for services that need folder-specific functionality.
|
|
344
|
+
*
|
|
345
|
+
* Extends BaseService with additional methods for working with folder-scoped resources
|
|
346
|
+
* in UiPath Orchestrator. Services that work with folders (Assets, Queues) extend this class.
|
|
347
|
+
*
|
|
348
|
+
* @remarks
|
|
349
|
+
* This class provides helper methods for making folder-scoped API calls, handling folder IDs
|
|
350
|
+
* in request headers, and managing cross-folder queries.
|
|
351
|
+
*/
|
|
352
|
+
declare class FolderScopedService extends BaseService {
|
|
353
|
+
/**
|
|
354
|
+
* Gets resources in a folder with optional query parameters
|
|
355
|
+
*
|
|
356
|
+
* @param endpoint - API endpoint to call
|
|
357
|
+
* @param folderId - required folder ID
|
|
358
|
+
* @param options - Query options
|
|
359
|
+
* @param transformFn - Optional function to transform the response data
|
|
360
|
+
* @returns Promise resolving to an array of resources
|
|
361
|
+
*/
|
|
362
|
+
protected _getByFolder<T, R = T>(endpoint: string, folderId: number, options?: Record<string, any>, transformFn?: (item: T) => R): Promise<R[]>;
|
|
363
|
+
/**
|
|
364
|
+
* Look up a single resource by name on a folder-scoped OData collection.
|
|
365
|
+
*
|
|
366
|
+
* Shared by `getByName` implementations across services (Assets, Processes, etc).
|
|
367
|
+
* Handles:
|
|
368
|
+
* - Name validation via `validateName`
|
|
369
|
+
* - Folder header resolution via `resolveFolderHeaders` (folderId → ID/key
|
|
370
|
+
* header by type, folderPath → encoded path header, falls back to
|
|
371
|
+
* init-time `config.folderKey` from the `uipath:folder-key` meta tag)
|
|
372
|
+
* - OData `$filter=Name eq '…'` with single-quote escaping + `$top=1`
|
|
373
|
+
* - Empty-result → `NotFoundError` with folder context in the message
|
|
374
|
+
*
|
|
375
|
+
* The transform step is caller-provided because each resource has its own
|
|
376
|
+
* PascalCase → camelCase field mapping.
|
|
377
|
+
*
|
|
378
|
+
* @param resourceType - Resource label used in validation + error messages (e.g. 'Asset', 'Process')
|
|
379
|
+
* @param endpoint - Folder-scoped OData collection endpoint
|
|
380
|
+
* @param name - Resource name to search for
|
|
381
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) + OData query options (`expand`, `select`)
|
|
382
|
+
* @param transform - Maps a raw OData item to the typed response (e.g. PascalCase → camelCase via field map)
|
|
383
|
+
* @throws ValidationError when inputs are malformed; NotFoundError when no match
|
|
384
|
+
*/
|
|
385
|
+
protected getByNameLookup<TRaw extends object, T>(resourceType: string, endpoint: string, name: string, options: FolderScopedOptions, transform: (raw: TRaw) => T): Promise<T>;
|
|
386
|
+
}
|
|
319
387
|
|
|
320
388
|
/**
|
|
321
389
|
* Enum for package types
|
|
@@ -671,6 +739,11 @@ type ProcessGetAllOptions = RequestOptions & PaginationOptions & {
|
|
|
671
739
|
*/
|
|
672
740
|
interface ProcessGetByIdOptions extends BaseOptions {
|
|
673
741
|
}
|
|
742
|
+
/**
|
|
743
|
+
* Options for getting a single process by name
|
|
744
|
+
*/
|
|
745
|
+
interface ProcessGetByNameOptions extends FolderScopedOptions {
|
|
746
|
+
}
|
|
674
747
|
|
|
675
748
|
/**
|
|
676
749
|
* Service for managing and executing UiPath Automation Processes.
|
|
@@ -743,6 +816,29 @@ interface ProcessServiceModel {
|
|
|
743
816
|
* ```
|
|
744
817
|
*/
|
|
745
818
|
getById(id: number, folderId: number, options?: ProcessGetByIdOptions): Promise<ProcessGetResponse>;
|
|
819
|
+
/**
|
|
820
|
+
* Retrieves a single process by name.
|
|
821
|
+
*
|
|
822
|
+
* @param name - Process name to search for
|
|
823
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
|
|
824
|
+
* @returns Promise resolving to a single process
|
|
825
|
+
* {@link ProcessGetResponse}
|
|
826
|
+
* @example
|
|
827
|
+
* ```typescript
|
|
828
|
+
* // By folder ID
|
|
829
|
+
* await processes.getByName('MyProcess', { folderId: 123 });
|
|
830
|
+
*
|
|
831
|
+
* // By folder key (GUID)
|
|
832
|
+
* await processes.getByName('MyProcess', { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
|
|
833
|
+
*
|
|
834
|
+
* // By folder path
|
|
835
|
+
* await processes.getByName('MyProcess', { folderPath: 'Shared/Finance' });
|
|
836
|
+
*
|
|
837
|
+
* // With expand
|
|
838
|
+
* await processes.getByName('MyProcess', { folderPath: 'Shared/Finance', expand: 'entryPoints' });
|
|
839
|
+
* ```
|
|
840
|
+
*/
|
|
841
|
+
getByName(name: string, options?: ProcessGetByNameOptions): Promise<ProcessGetResponse>;
|
|
746
842
|
/**
|
|
747
843
|
* Starts a process with the specified configuration
|
|
748
844
|
*
|
|
@@ -770,7 +866,7 @@ interface ProcessServiceModel {
|
|
|
770
866
|
/**
|
|
771
867
|
* Service for interacting with UiPath Orchestrator Processes API
|
|
772
868
|
*/
|
|
773
|
-
declare class ProcessService extends
|
|
869
|
+
declare class ProcessService extends FolderScopedService implements ProcessServiceModel {
|
|
774
870
|
/**
|
|
775
871
|
* Gets all processes across folders with optional filtering and folder scoping
|
|
776
872
|
*
|
|
@@ -861,7 +957,34 @@ declare class ProcessService extends BaseService implements ProcessServiceModel
|
|
|
861
957
|
* ```
|
|
862
958
|
*/
|
|
863
959
|
getById(id: number, folderId: number, options?: ProcessGetByIdOptions): Promise<ProcessGetResponse>;
|
|
960
|
+
/**
|
|
961
|
+
* Retrieves a single process by name.
|
|
962
|
+
*
|
|
963
|
+
* @param name - Process name to search for
|
|
964
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
|
|
965
|
+
* @returns Promise resolving to a single process
|
|
966
|
+
* {@link ProcessGetResponse}
|
|
967
|
+
* @example
|
|
968
|
+
* ```typescript
|
|
969
|
+
* import { Processes } from '@uipath/uipath-typescript/processes';
|
|
970
|
+
*
|
|
971
|
+
* const processes = new Processes(sdk);
|
|
972
|
+
*
|
|
973
|
+
* // By folder ID
|
|
974
|
+
* await processes.getByName('MyProcess', { folderId: 123 });
|
|
975
|
+
*
|
|
976
|
+
* // By folder key (GUID)
|
|
977
|
+
* await processes.getByName('MyProcess', { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
|
|
978
|
+
*
|
|
979
|
+
* // By folder path
|
|
980
|
+
* await processes.getByName('MyProcess', { folderPath: 'Shared/Finance' });
|
|
981
|
+
*
|
|
982
|
+
* // With expand
|
|
983
|
+
* await processes.getByName('MyProcess', { folderPath: 'Shared/Finance', expand: 'entryPoints' });
|
|
984
|
+
* ```
|
|
985
|
+
*/
|
|
986
|
+
getByName(name: string, options?: ProcessGetByNameOptions): Promise<ProcessGetResponse>;
|
|
864
987
|
}
|
|
865
988
|
|
|
866
989
|
export { JobPriority, JobSourceType, JobType, PackageSourceType, PackageType, ProcessService, ProcessService as Processes, RemoteControlAccess, RobotSize, RuntimeType, StartStrategy, StopStrategy, TargetFramework };
|
|
867
|
-
export type { ArgumentMetadata, BaseProcessStartRequest, FolderProperties, JobAttachment, JobError, Machine, ProcessGetAllOptions, ProcessGetByIdOptions, ProcessGetResponse, ProcessProperties, ProcessServiceModel, ProcessStartRequest, ProcessStartRequestWithKey, ProcessStartRequestWithName, ProcessStartResponse, RobotMetadata };
|
|
990
|
+
export type { ArgumentMetadata, BaseProcessStartRequest, FolderProperties, JobAttachment, JobError, Machine, ProcessGetAllOptions, ProcessGetByIdOptions, ProcessGetByNameOptions, ProcessGetResponse, ProcessProperties, ProcessServiceModel, ProcessStartRequest, ProcessStartRequestWithKey, ProcessStartRequestWithName, ProcessStartResponse, RobotMetadata };
|