@uipath/uipath-typescript 1.3.5 → 1.3.7
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/README.md +1 -1
- package/dist/assets/index.cjs +204 -2
- package/dist/assets/index.d.ts +112 -13
- package/dist/assets/index.mjs +204 -2
- package/dist/attachments/index.cjs +3 -2
- package/dist/attachments/index.d.ts +7 -0
- package/dist/attachments/index.mjs +3 -2
- package/dist/buckets/index.cjs +172 -2
- package/dist/buckets/index.d.ts +56 -12
- package/dist/buckets/index.mjs +172 -2
- package/dist/cases/index.cjs +3 -2
- package/dist/cases/index.d.ts +7 -0
- package/dist/cases/index.mjs +3 -2
- package/dist/conversational-agent/index.cjs +196 -81
- package/dist/conversational-agent/index.d.ts +326 -80
- package/dist/conversational-agent/index.mjs +195 -80
- package/dist/core/index.cjs +44 -7
- package/dist/core/index.d.ts +11 -1
- package/dist/core/index.mjs +44 -7
- package/dist/entities/index.cjs +35 -6
- package/dist/entities/index.d.ts +101 -11
- package/dist/entities/index.mjs +36 -7
- package/dist/feedback/index.cjs +40 -5
- package/dist/feedback/index.d.ts +59 -1
- package/dist/feedback/index.mjs +40 -5
- package/dist/index.cjs +312 -14
- package/dist/index.d.ts +515 -32
- package/dist/index.mjs +313 -15
- package/dist/index.umd.js +312 -14
- package/dist/jobs/index.cjs +172 -2
- package/dist/jobs/index.d.ts +67 -23
- package/dist/jobs/index.mjs +172 -2
- package/dist/maestro-processes/index.cjs +3 -2
- package/dist/maestro-processes/index.d.ts +7 -0
- package/dist/maestro-processes/index.mjs +3 -2
- package/dist/processes/index.cjs +240 -3
- package/dist/processes/index.d.ts +124 -2
- package/dist/processes/index.mjs +240 -3
- package/dist/queues/index.cjs +172 -2
- package/dist/queues/index.d.ts +56 -12
- package/dist/queues/index.mjs +172 -2
- package/dist/tasks/index.cjs +3 -2
- package/dist/tasks/index.d.ts +7 -0
- package/dist/tasks/index.mjs +3 -2
- 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';
|
|
@@ -1484,8 +1486,9 @@ class BaseService {
|
|
|
1484
1486
|
constructor(instance, headers) {
|
|
1485
1487
|
// Private field - not visible via Object.keys() or any reflection
|
|
1486
1488
|
_BaseService_apiClient.set(this, void 0);
|
|
1487
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
1489
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
1488
1490
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
1491
|
+
this.config = { folderKey };
|
|
1489
1492
|
}
|
|
1490
1493
|
/**
|
|
1491
1494
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -1682,6 +1685,208 @@ class BaseService {
|
|
|
1682
1685
|
}
|
|
1683
1686
|
_BaseService_apiClient = new WeakMap();
|
|
1684
1687
|
|
|
1688
|
+
/**
|
|
1689
|
+
* Validates the `name` argument passed to a `getByName(name, ...)` method.
|
|
1690
|
+
* Trims whitespace and rejects empty/whitespace-only names.
|
|
1691
|
+
*
|
|
1692
|
+
* @param resourceType - Resource label used in error messages (e.g. 'Asset', 'Process')
|
|
1693
|
+
* @param name - Resource name to validate
|
|
1694
|
+
* @returns The trimmed name
|
|
1695
|
+
* @throws ValidationError when `name` is missing or empty after trimming
|
|
1696
|
+
*/
|
|
1697
|
+
function validateName(resourceType, name) {
|
|
1698
|
+
if (!name) {
|
|
1699
|
+
throw new ValidationError({
|
|
1700
|
+
message: `${resourceType} name is required and cannot be empty.`,
|
|
1701
|
+
});
|
|
1702
|
+
}
|
|
1703
|
+
const trimmed = name.trim();
|
|
1704
|
+
if (!trimmed) {
|
|
1705
|
+
throw new ValidationError({
|
|
1706
|
+
message: `${resourceType} name is required and cannot be empty.`,
|
|
1707
|
+
});
|
|
1708
|
+
}
|
|
1709
|
+
return trimmed;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
/**
|
|
1713
|
+
* Encodes a folder path for the `X-UIPATH-FolderPath-Encoded` header.
|
|
1714
|
+
*
|
|
1715
|
+
* Orchestrator decodes this header as **base64-encoded UTF-16 LE bytes**
|
|
1716
|
+
* (see `HttpHeadersProviderExtensions.GetDecoded` + `OrganizationUnitProvider`
|
|
1717
|
+
* in the Orchestrator repo, which call `Encoding.Unicode.GetString(...)`).
|
|
1718
|
+
* URL-encoding is NOT what the server expects — it must be base64-of-UTF-16-LE
|
|
1719
|
+
* bytes.
|
|
1720
|
+
*
|
|
1721
|
+
* @param folderPath - The folder path (e.g. 'Shared/Finance')
|
|
1722
|
+
* @returns Base64 string suitable for the `X-UIPATH-FolderPath-Encoded` header
|
|
1723
|
+
*/
|
|
1724
|
+
function encodeFolderPathHeader(folderPath) {
|
|
1725
|
+
// Force little-endian regardless of host byte order. `Uint16Array` viewed
|
|
1726
|
+
// as `Uint8Array` would use the host's native order — correct on LE hosts
|
|
1727
|
+
// (x86/ARM-LE) but wrong on BE hosts. `DataView.setUint16(..., true)`
|
|
1728
|
+
// pins LE.
|
|
1729
|
+
const buf = new ArrayBuffer(folderPath.length * 2);
|
|
1730
|
+
const view = new DataView(buf);
|
|
1731
|
+
for (let i = 0; i < folderPath.length; i++) {
|
|
1732
|
+
view.setUint16(i * 2, folderPath.charCodeAt(i), true);
|
|
1733
|
+
}
|
|
1734
|
+
const bytes = new Uint8Array(buf);
|
|
1735
|
+
let binary = '';
|
|
1736
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
1737
|
+
binary += String.fromCharCode(bytes[i]);
|
|
1738
|
+
}
|
|
1739
|
+
// btoa is browser-native; Node 16+ also has it as a global
|
|
1740
|
+
return btoa(binary);
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
/**
|
|
1744
|
+
* Resolves folder context into the appropriate Orchestrator folder headers.
|
|
1745
|
+
*
|
|
1746
|
+
* Centralized so all folder-scoped methods (e.g. `assets.getByName`,
|
|
1747
|
+
* `processes.getByName`, future Queues/Buckets/Jobs) share one implementation.
|
|
1748
|
+
*
|
|
1749
|
+
* Each input field maps directly to its header — no auto-detection or type
|
|
1750
|
+
* coercion. When multiple fields are supplied, all corresponding headers
|
|
1751
|
+
* are forwarded and the server resolves precedence.
|
|
1752
|
+
*
|
|
1753
|
+
* Routing:
|
|
1754
|
+
* - `folderId` → `X-UIPATH-OrganizationUnitId`
|
|
1755
|
+
* - `folderKey` → `X-UIPATH-FolderKey`
|
|
1756
|
+
* - `folderPath` → `X-UIPATH-FolderPath-Encoded`
|
|
1757
|
+
* - none set + `fallbackFolderKey` → fallback used as `X-UIPATH-FolderKey`
|
|
1758
|
+
* - none set + no fallback → `ValidationError`
|
|
1759
|
+
*
|
|
1760
|
+
* @throws ValidationError when no folder context can be resolved.
|
|
1761
|
+
*/
|
|
1762
|
+
function resolveFolderHeaders(input) {
|
|
1763
|
+
const { folderId, folderKey, folderPath, resourceType, fallbackFolderKey } = input;
|
|
1764
|
+
const trimmedKey = folderKey?.trim();
|
|
1765
|
+
const trimmedPath = folderPath?.trim();
|
|
1766
|
+
const headers = {};
|
|
1767
|
+
if (folderId !== undefined) {
|
|
1768
|
+
headers[FOLDER_ID] = folderId;
|
|
1769
|
+
}
|
|
1770
|
+
if (trimmedKey) {
|
|
1771
|
+
headers[FOLDER_KEY] = trimmedKey;
|
|
1772
|
+
}
|
|
1773
|
+
if (trimmedPath) {
|
|
1774
|
+
headers[FOLDER_PATH_ENCODED] = encodeFolderPathHeader(trimmedPath);
|
|
1775
|
+
}
|
|
1776
|
+
// No explicit folder context → meta-tag fallback or error.
|
|
1777
|
+
if (Object.keys(headers).length === 0) {
|
|
1778
|
+
if (!fallbackFolderKey) {
|
|
1779
|
+
throw new ValidationError({
|
|
1780
|
+
message: `${resourceType} requires folder context: pass \`folderId\`, \`folderKey\`, or \`folderPath\`, or initialize the SDK with a folder context.`,
|
|
1781
|
+
});
|
|
1782
|
+
}
|
|
1783
|
+
headers[FOLDER_KEY] = fallbackFolderKey;
|
|
1784
|
+
}
|
|
1785
|
+
return createHeaders(headers);
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
/**
|
|
1789
|
+
* Matches single-quote characters in OData string literals — escaped to `''`
|
|
1790
|
+
* inside the `$filter=Name eq '…'` clause built by `getByNameLookup`.
|
|
1791
|
+
*/
|
|
1792
|
+
const SINGLE_QUOTE_RE = /'/g;
|
|
1793
|
+
/**
|
|
1794
|
+
* Base service for services that need folder-specific functionality.
|
|
1795
|
+
*
|
|
1796
|
+
* Extends BaseService with additional methods for working with folder-scoped resources
|
|
1797
|
+
* in UiPath Orchestrator. Services that work with folders (Assets, Queues) extend this class.
|
|
1798
|
+
*
|
|
1799
|
+
* @remarks
|
|
1800
|
+
* This class provides helper methods for making folder-scoped API calls, handling folder IDs
|
|
1801
|
+
* in request headers, and managing cross-folder queries.
|
|
1802
|
+
*/
|
|
1803
|
+
class FolderScopedService extends BaseService {
|
|
1804
|
+
/**
|
|
1805
|
+
* Gets resources in a folder with optional query parameters
|
|
1806
|
+
*
|
|
1807
|
+
* @param endpoint - API endpoint to call
|
|
1808
|
+
* @param folderId - required folder ID
|
|
1809
|
+
* @param options - Query options
|
|
1810
|
+
* @param transformFn - Optional function to transform the response data
|
|
1811
|
+
* @returns Promise resolving to an array of resources
|
|
1812
|
+
*/
|
|
1813
|
+
async _getByFolder(endpoint, folderId, options = {}, transformFn) {
|
|
1814
|
+
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
1815
|
+
const keysToPrefix = Object.keys(options);
|
|
1816
|
+
const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
|
|
1817
|
+
const response = await this.get(endpoint, {
|
|
1818
|
+
params: apiOptions,
|
|
1819
|
+
headers
|
|
1820
|
+
});
|
|
1821
|
+
if (transformFn) {
|
|
1822
|
+
return response.data?.value.map(transformFn);
|
|
1823
|
+
}
|
|
1824
|
+
return response.data?.value;
|
|
1825
|
+
}
|
|
1826
|
+
/**
|
|
1827
|
+
* Look up a single resource by name on a folder-scoped OData collection.
|
|
1828
|
+
*
|
|
1829
|
+
* Shared by `getByName` implementations across services (Assets, Processes, etc).
|
|
1830
|
+
* Handles:
|
|
1831
|
+
* - Name validation via `validateName`
|
|
1832
|
+
* - Folder header resolution via `resolveFolderHeaders` (folderId → ID/key
|
|
1833
|
+
* header by type, folderPath → encoded path header, falls back to
|
|
1834
|
+
* init-time `config.folderKey` from the `uipath:folder-key` meta tag)
|
|
1835
|
+
* - OData `$filter=Name eq '…'` with single-quote escaping + `$top=1`
|
|
1836
|
+
* - Empty-result → `NotFoundError` with folder context in the message
|
|
1837
|
+
*
|
|
1838
|
+
* The transform step is caller-provided because each resource has its own
|
|
1839
|
+
* PascalCase → camelCase field mapping.
|
|
1840
|
+
*
|
|
1841
|
+
* @param resourceType - Resource label used in validation + error messages (e.g. 'Asset', 'Process')
|
|
1842
|
+
* @param endpoint - Folder-scoped OData collection endpoint
|
|
1843
|
+
* @param name - Resource name to search for
|
|
1844
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) + OData query options (`expand`, `select`)
|
|
1845
|
+
* @param transform - Maps a raw OData item to the typed response (e.g. PascalCase → camelCase via field map)
|
|
1846
|
+
* @throws ValidationError when inputs are malformed; NotFoundError when no match
|
|
1847
|
+
*/
|
|
1848
|
+
async getByNameLookup(resourceType, endpoint, name, options, transform) {
|
|
1849
|
+
const validatedName = validateName(resourceType, name);
|
|
1850
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
1851
|
+
const headers = resolveFolderHeaders({
|
|
1852
|
+
folderId,
|
|
1853
|
+
folderKey,
|
|
1854
|
+
folderPath,
|
|
1855
|
+
resourceType: `${resourceType}.getByName`,
|
|
1856
|
+
fallbackFolderKey: this.config.folderKey,
|
|
1857
|
+
});
|
|
1858
|
+
const apiOptions = {
|
|
1859
|
+
...addPrefixToKeys(queryOptions, ODATA_PREFIX, Object.keys(queryOptions)),
|
|
1860
|
+
'$filter': `Name eq '${validatedName.replace(SINGLE_QUOTE_RE, "''")}'`,
|
|
1861
|
+
'$top': '1',
|
|
1862
|
+
};
|
|
1863
|
+
const response = await this.get(endpoint, {
|
|
1864
|
+
headers,
|
|
1865
|
+
params: apiOptions,
|
|
1866
|
+
});
|
|
1867
|
+
const items = response.data?.value;
|
|
1868
|
+
if (!items?.length) {
|
|
1869
|
+
const folderHint = describeFolderForError(folderId, folderKey, folderPath);
|
|
1870
|
+
throw new NotFoundError({
|
|
1871
|
+
message: `${resourceType} '${validatedName}' not found${folderHint}.`,
|
|
1872
|
+
});
|
|
1873
|
+
}
|
|
1874
|
+
return transform(items[0]);
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
/** Renders the supplied folder for a NotFoundError message. */
|
|
1878
|
+
function describeFolderForError(folderId, folderKey, folderPath) {
|
|
1879
|
+
const path = folderPath?.trim();
|
|
1880
|
+
if (path)
|
|
1881
|
+
return ` in folder '${path}'`;
|
|
1882
|
+
const key = folderKey?.trim();
|
|
1883
|
+
if (key)
|
|
1884
|
+
return ` in folder (key: ${key})`;
|
|
1885
|
+
if (typeof folderId === 'number')
|
|
1886
|
+
return ` in folder (id: ${folderId})`;
|
|
1887
|
+
return '';
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1685
1890
|
/**
|
|
1686
1891
|
* Maps fields for Process entities to ensure consistent naming
|
|
1687
1892
|
*/
|
|
@@ -1722,7 +1927,7 @@ const PROCESS_ENDPOINTS = {
|
|
|
1722
1927
|
// Connection string placeholder that will be replaced during build
|
|
1723
1928
|
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
1929
|
// SDK Version placeholder
|
|
1725
|
-
const SDK_VERSION = "1.3.
|
|
1930
|
+
const SDK_VERSION = "1.3.7";
|
|
1726
1931
|
const VERSION = "Version";
|
|
1727
1932
|
const SERVICE = "Service";
|
|
1728
1933
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -1993,7 +2198,7 @@ function track(nameOrOptions, options) {
|
|
|
1993
2198
|
/**
|
|
1994
2199
|
* Service for interacting with UiPath Orchestrator Processes API
|
|
1995
2200
|
*/
|
|
1996
|
-
class ProcessService extends
|
|
2201
|
+
class ProcessService extends FolderScopedService {
|
|
1997
2202
|
/**
|
|
1998
2203
|
* Gets all processes across folders with optional filtering and folder scoping
|
|
1999
2204
|
*
|
|
@@ -2130,6 +2335,35 @@ class ProcessService extends BaseService {
|
|
|
2130
2335
|
const transformedProcess = transformData(pascalToCamelCaseKeys(response.data), ProcessMap);
|
|
2131
2336
|
return transformedProcess;
|
|
2132
2337
|
}
|
|
2338
|
+
/**
|
|
2339
|
+
* Retrieves a single process by name.
|
|
2340
|
+
*
|
|
2341
|
+
* @param name - Process name to search for
|
|
2342
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
|
|
2343
|
+
* @returns Promise resolving to a single process
|
|
2344
|
+
* {@link ProcessGetResponse}
|
|
2345
|
+
* @example
|
|
2346
|
+
* ```typescript
|
|
2347
|
+
* import { Processes } from '@uipath/uipath-typescript/processes';
|
|
2348
|
+
*
|
|
2349
|
+
* const processes = new Processes(sdk);
|
|
2350
|
+
*
|
|
2351
|
+
* // By folder ID
|
|
2352
|
+
* await processes.getByName('MyProcess', { folderId: 123 });
|
|
2353
|
+
*
|
|
2354
|
+
* // By folder key (GUID)
|
|
2355
|
+
* await processes.getByName('MyProcess', { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
|
|
2356
|
+
*
|
|
2357
|
+
* // By folder path
|
|
2358
|
+
* await processes.getByName('MyProcess', { folderPath: 'Shared/Finance' });
|
|
2359
|
+
*
|
|
2360
|
+
* // With expand
|
|
2361
|
+
* await processes.getByName('MyProcess', { folderPath: 'Shared/Finance', expand: 'entryPoints' });
|
|
2362
|
+
* ```
|
|
2363
|
+
*/
|
|
2364
|
+
async getByName(name, options = {}) {
|
|
2365
|
+
return this.getByNameLookup('Process', PROCESS_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), ProcessMap));
|
|
2366
|
+
}
|
|
2133
2367
|
}
|
|
2134
2368
|
__decorate([
|
|
2135
2369
|
track('Processes.GetAll')
|
|
@@ -2140,6 +2374,9 @@ __decorate([
|
|
|
2140
2374
|
__decorate([
|
|
2141
2375
|
track('Processes.GetById')
|
|
2142
2376
|
], ProcessService.prototype, "getById", null);
|
|
2377
|
+
__decorate([
|
|
2378
|
+
track('Processes.GetByName')
|
|
2379
|
+
], ProcessService.prototype, "getByName", null);
|
|
2143
2380
|
|
|
2144
2381
|
/**
|
|
2145
2382
|
* Enum for package types
|
|
@@ -218,6 +218,13 @@ interface ApiResponse<T> {
|
|
|
218
218
|
*/
|
|
219
219
|
declare class BaseService {
|
|
220
220
|
#private;
|
|
221
|
+
/**
|
|
222
|
+
* SDK configuration (read-only). Available to subclasses so they can
|
|
223
|
+
* fall back to init-time defaults like `folderKey`.
|
|
224
|
+
*/
|
|
225
|
+
protected readonly config: {
|
|
226
|
+
folderKey?: string;
|
|
227
|
+
};
|
|
221
228
|
/**
|
|
222
229
|
* Creates a base service instance with dependency injection.
|
|
223
230
|
*
|
|
@@ -316,6 +323,66 @@ interface RequestOptions extends BaseOptions {
|
|
|
316
323
|
filter?: string;
|
|
317
324
|
orderby?: string;
|
|
318
325
|
}
|
|
326
|
+
/**
|
|
327
|
+
* Options that scope a name-based lookup (e.g. `getByName`) to a folder.
|
|
328
|
+
* Provide one of `folderId`, `folderKey`, or `folderPath`. When more than
|
|
329
|
+
* one is supplied, all are forwarded; the server applies precedence
|
|
330
|
+
* `folderPath` > `folderKey` > `folderId`.
|
|
331
|
+
*/
|
|
332
|
+
interface FolderScopedOptions extends BaseOptions {
|
|
333
|
+
/** Numeric folder ID. */
|
|
334
|
+
folderId?: number;
|
|
335
|
+
/** Folder key (GUID-formatted string). */
|
|
336
|
+
folderKey?: string;
|
|
337
|
+
/** Slash-delimited folder path, e.g. `'Shared/Finance'`. */
|
|
338
|
+
folderPath?: string;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Base service for services that need folder-specific functionality.
|
|
343
|
+
*
|
|
344
|
+
* Extends BaseService with additional methods for working with folder-scoped resources
|
|
345
|
+
* in UiPath Orchestrator. Services that work with folders (Assets, Queues) extend this class.
|
|
346
|
+
*
|
|
347
|
+
* @remarks
|
|
348
|
+
* This class provides helper methods for making folder-scoped API calls, handling folder IDs
|
|
349
|
+
* in request headers, and managing cross-folder queries.
|
|
350
|
+
*/
|
|
351
|
+
declare class FolderScopedService extends BaseService {
|
|
352
|
+
/**
|
|
353
|
+
* Gets resources in a folder with optional query parameters
|
|
354
|
+
*
|
|
355
|
+
* @param endpoint - API endpoint to call
|
|
356
|
+
* @param folderId - required folder ID
|
|
357
|
+
* @param options - Query options
|
|
358
|
+
* @param transformFn - Optional function to transform the response data
|
|
359
|
+
* @returns Promise resolving to an array of resources
|
|
360
|
+
*/
|
|
361
|
+
protected _getByFolder<T, R = T>(endpoint: string, folderId: number, options?: Record<string, any>, transformFn?: (item: T) => R): Promise<R[]>;
|
|
362
|
+
/**
|
|
363
|
+
* Look up a single resource by name on a folder-scoped OData collection.
|
|
364
|
+
*
|
|
365
|
+
* Shared by `getByName` implementations across services (Assets, Processes, etc).
|
|
366
|
+
* Handles:
|
|
367
|
+
* - Name validation via `validateName`
|
|
368
|
+
* - Folder header resolution via `resolveFolderHeaders` (folderId → ID/key
|
|
369
|
+
* header by type, folderPath → encoded path header, falls back to
|
|
370
|
+
* init-time `config.folderKey` from the `uipath:folder-key` meta tag)
|
|
371
|
+
* - OData `$filter=Name eq '…'` with single-quote escaping + `$top=1`
|
|
372
|
+
* - Empty-result → `NotFoundError` with folder context in the message
|
|
373
|
+
*
|
|
374
|
+
* The transform step is caller-provided because each resource has its own
|
|
375
|
+
* PascalCase → camelCase field mapping.
|
|
376
|
+
*
|
|
377
|
+
* @param resourceType - Resource label used in validation + error messages (e.g. 'Asset', 'Process')
|
|
378
|
+
* @param endpoint - Folder-scoped OData collection endpoint
|
|
379
|
+
* @param name - Resource name to search for
|
|
380
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) + OData query options (`expand`, `select`)
|
|
381
|
+
* @param transform - Maps a raw OData item to the typed response (e.g. PascalCase → camelCase via field map)
|
|
382
|
+
* @throws ValidationError when inputs are malformed; NotFoundError when no match
|
|
383
|
+
*/
|
|
384
|
+
protected getByNameLookup<TRaw extends object, T>(resourceType: string, endpoint: string, name: string, options: FolderScopedOptions, transform: (raw: TRaw) => T): Promise<T>;
|
|
385
|
+
}
|
|
319
386
|
|
|
320
387
|
/**
|
|
321
388
|
* Enum for package types
|
|
@@ -671,6 +738,11 @@ type ProcessGetAllOptions = RequestOptions & PaginationOptions & {
|
|
|
671
738
|
*/
|
|
672
739
|
interface ProcessGetByIdOptions extends BaseOptions {
|
|
673
740
|
}
|
|
741
|
+
/**
|
|
742
|
+
* Options for getting a single process by name
|
|
743
|
+
*/
|
|
744
|
+
interface ProcessGetByNameOptions extends FolderScopedOptions {
|
|
745
|
+
}
|
|
674
746
|
|
|
675
747
|
/**
|
|
676
748
|
* Service for managing and executing UiPath Automation Processes.
|
|
@@ -743,6 +815,29 @@ interface ProcessServiceModel {
|
|
|
743
815
|
* ```
|
|
744
816
|
*/
|
|
745
817
|
getById(id: number, folderId: number, options?: ProcessGetByIdOptions): Promise<ProcessGetResponse>;
|
|
818
|
+
/**
|
|
819
|
+
* Retrieves a single process by name.
|
|
820
|
+
*
|
|
821
|
+
* @param name - Process name to search for
|
|
822
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
|
|
823
|
+
* @returns Promise resolving to a single process
|
|
824
|
+
* {@link ProcessGetResponse}
|
|
825
|
+
* @example
|
|
826
|
+
* ```typescript
|
|
827
|
+
* // By folder ID
|
|
828
|
+
* await processes.getByName('MyProcess', { folderId: 123 });
|
|
829
|
+
*
|
|
830
|
+
* // By folder key (GUID)
|
|
831
|
+
* await processes.getByName('MyProcess', { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
|
|
832
|
+
*
|
|
833
|
+
* // By folder path
|
|
834
|
+
* await processes.getByName('MyProcess', { folderPath: 'Shared/Finance' });
|
|
835
|
+
*
|
|
836
|
+
* // With expand
|
|
837
|
+
* await processes.getByName('MyProcess', { folderPath: 'Shared/Finance', expand: 'entryPoints' });
|
|
838
|
+
* ```
|
|
839
|
+
*/
|
|
840
|
+
getByName(name: string, options?: ProcessGetByNameOptions): Promise<ProcessGetResponse>;
|
|
746
841
|
/**
|
|
747
842
|
* Starts a process with the specified configuration
|
|
748
843
|
*
|
|
@@ -770,7 +865,7 @@ interface ProcessServiceModel {
|
|
|
770
865
|
/**
|
|
771
866
|
* Service for interacting with UiPath Orchestrator Processes API
|
|
772
867
|
*/
|
|
773
|
-
declare class ProcessService extends
|
|
868
|
+
declare class ProcessService extends FolderScopedService implements ProcessServiceModel {
|
|
774
869
|
/**
|
|
775
870
|
* Gets all processes across folders with optional filtering and folder scoping
|
|
776
871
|
*
|
|
@@ -861,7 +956,34 @@ declare class ProcessService extends BaseService implements ProcessServiceModel
|
|
|
861
956
|
* ```
|
|
862
957
|
*/
|
|
863
958
|
getById(id: number, folderId: number, options?: ProcessGetByIdOptions): Promise<ProcessGetResponse>;
|
|
959
|
+
/**
|
|
960
|
+
* Retrieves a single process by name.
|
|
961
|
+
*
|
|
962
|
+
* @param name - Process name to search for
|
|
963
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
|
|
964
|
+
* @returns Promise resolving to a single process
|
|
965
|
+
* {@link ProcessGetResponse}
|
|
966
|
+
* @example
|
|
967
|
+
* ```typescript
|
|
968
|
+
* import { Processes } from '@uipath/uipath-typescript/processes';
|
|
969
|
+
*
|
|
970
|
+
* const processes = new Processes(sdk);
|
|
971
|
+
*
|
|
972
|
+
* // By folder ID
|
|
973
|
+
* await processes.getByName('MyProcess', { folderId: 123 });
|
|
974
|
+
*
|
|
975
|
+
* // By folder key (GUID)
|
|
976
|
+
* await processes.getByName('MyProcess', { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
|
|
977
|
+
*
|
|
978
|
+
* // By folder path
|
|
979
|
+
* await processes.getByName('MyProcess', { folderPath: 'Shared/Finance' });
|
|
980
|
+
*
|
|
981
|
+
* // With expand
|
|
982
|
+
* await processes.getByName('MyProcess', { folderPath: 'Shared/Finance', expand: 'entryPoints' });
|
|
983
|
+
* ```
|
|
984
|
+
*/
|
|
985
|
+
getByName(name: string, options?: ProcessGetByNameOptions): Promise<ProcessGetResponse>;
|
|
864
986
|
}
|
|
865
987
|
|
|
866
988
|
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 };
|
|
989
|
+
export type { ArgumentMetadata, BaseProcessStartRequest, FolderProperties, JobAttachment, JobError, Machine, ProcessGetAllOptions, ProcessGetByIdOptions, ProcessGetByNameOptions, ProcessGetResponse, ProcessProperties, ProcessServiceModel, ProcessStartRequest, ProcessStartRequestWithKey, ProcessStartRequestWithName, ProcessStartResponse, RobotMetadata };
|