@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/assets/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
|
|
@@ -1245,7 +1272,8 @@ class PaginationHelpers {
|
|
|
1245
1272
|
// Extract and transform items from response
|
|
1246
1273
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1247
1274
|
const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
|
|
1248
|
-
const
|
|
1275
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1276
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1249
1277
|
// Parse items - automatically handle JSON string responses
|
|
1250
1278
|
const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
|
|
1251
1279
|
const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
|
|
@@ -1421,8 +1449,9 @@ class BaseService {
|
|
|
1421
1449
|
constructor(instance, headers) {
|
|
1422
1450
|
// Private field - not visible via Object.keys() or any reflection
|
|
1423
1451
|
_BaseService_apiClient.set(this, void 0);
|
|
1424
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
1452
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
1425
1453
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
1454
|
+
this.config = { folderKey };
|
|
1426
1455
|
}
|
|
1427
1456
|
/**
|
|
1428
1457
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -1541,9 +1570,17 @@ class BaseService {
|
|
|
1541
1570
|
const pageSizeParam = paginationParams?.pageSizeParam || ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM;
|
|
1542
1571
|
const offsetParam = paginationParams?.offsetParam || ODATA_OFFSET_PARAMS.OFFSET_PARAM;
|
|
1543
1572
|
const countParam = paginationParams?.countParam || ODATA_OFFSET_PARAMS.COUNT_PARAM;
|
|
1573
|
+
// When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
|
|
1574
|
+
// When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
|
|
1575
|
+
const convertToSkip = paginationParams?.convertToSkip ?? true;
|
|
1544
1576
|
requestParams[pageSizeParam] = limitedPageSize;
|
|
1545
|
-
if (
|
|
1546
|
-
|
|
1577
|
+
if (convertToSkip) {
|
|
1578
|
+
if (params.pageNumber && params.pageNumber > 1) {
|
|
1579
|
+
requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
else {
|
|
1583
|
+
requestParams[offsetParam] = params.pageNumber || 1;
|
|
1547
1584
|
}
|
|
1548
1585
|
{
|
|
1549
1586
|
requestParams[countParam] = true;
|
|
@@ -1574,7 +1611,8 @@ class BaseService {
|
|
|
1574
1611
|
// Extract items and metadata
|
|
1575
1612
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1576
1613
|
const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
|
|
1577
|
-
const
|
|
1614
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1615
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1578
1616
|
const continuationToken = response.data[continuationTokenField];
|
|
1579
1617
|
// Determine if there are more pages
|
|
1580
1618
|
const hasMore = this.determineHasMorePages(paginationType, {
|
|
@@ -1619,6 +1657,111 @@ class BaseService {
|
|
|
1619
1657
|
}
|
|
1620
1658
|
_BaseService_apiClient = new WeakMap();
|
|
1621
1659
|
|
|
1660
|
+
/**
|
|
1661
|
+
* Validates the `name` argument passed to a `getByName(name, ...)` method.
|
|
1662
|
+
* Trims whitespace and rejects empty/whitespace-only names.
|
|
1663
|
+
*
|
|
1664
|
+
* @param resourceType - Resource label used in error messages (e.g. 'Asset', 'Process')
|
|
1665
|
+
* @param name - Resource name to validate
|
|
1666
|
+
* @returns The trimmed name
|
|
1667
|
+
* @throws ValidationError when `name` is missing or empty after trimming
|
|
1668
|
+
*/
|
|
1669
|
+
function validateName(resourceType, name) {
|
|
1670
|
+
if (!name) {
|
|
1671
|
+
throw new ValidationError({
|
|
1672
|
+
message: `${resourceType} name is required and cannot be empty.`,
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
1675
|
+
const trimmed = name.trim();
|
|
1676
|
+
if (!trimmed) {
|
|
1677
|
+
throw new ValidationError({
|
|
1678
|
+
message: `${resourceType} name is required and cannot be empty.`,
|
|
1679
|
+
});
|
|
1680
|
+
}
|
|
1681
|
+
return trimmed;
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
/**
|
|
1685
|
+
* Encodes a folder path for the `X-UIPATH-FolderPath-Encoded` header.
|
|
1686
|
+
*
|
|
1687
|
+
* Orchestrator decodes this header as **base64-encoded UTF-16 LE bytes**
|
|
1688
|
+
* (see `HttpHeadersProviderExtensions.GetDecoded` + `OrganizationUnitProvider`
|
|
1689
|
+
* in the Orchestrator repo, which call `Encoding.Unicode.GetString(...)`).
|
|
1690
|
+
* URL-encoding is NOT what the server expects — it must be base64-of-UTF-16-LE
|
|
1691
|
+
* bytes.
|
|
1692
|
+
*
|
|
1693
|
+
* @param folderPath - The folder path (e.g. 'Shared/Finance')
|
|
1694
|
+
* @returns Base64 string suitable for the `X-UIPATH-FolderPath-Encoded` header
|
|
1695
|
+
*/
|
|
1696
|
+
function encodeFolderPathHeader(folderPath) {
|
|
1697
|
+
// Force little-endian regardless of host byte order. `Uint16Array` viewed
|
|
1698
|
+
// as `Uint8Array` would use the host's native order — correct on LE hosts
|
|
1699
|
+
// (x86/ARM-LE) but wrong on BE hosts. `DataView.setUint16(..., true)`
|
|
1700
|
+
// pins LE.
|
|
1701
|
+
const buf = new ArrayBuffer(folderPath.length * 2);
|
|
1702
|
+
const view = new DataView(buf);
|
|
1703
|
+
for (let i = 0; i < folderPath.length; i++) {
|
|
1704
|
+
view.setUint16(i * 2, folderPath.charCodeAt(i), true);
|
|
1705
|
+
}
|
|
1706
|
+
const bytes = new Uint8Array(buf);
|
|
1707
|
+
let binary = '';
|
|
1708
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
1709
|
+
binary += String.fromCharCode(bytes[i]);
|
|
1710
|
+
}
|
|
1711
|
+
// btoa is browser-native; Node 16+ also has it as a global
|
|
1712
|
+
return btoa(binary);
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
/**
|
|
1716
|
+
* Resolves folder context into the appropriate Orchestrator folder headers.
|
|
1717
|
+
*
|
|
1718
|
+
* Centralized so all folder-scoped methods (e.g. `assets.getByName`,
|
|
1719
|
+
* `processes.getByName`, future Queues/Buckets/Jobs) share one implementation.
|
|
1720
|
+
*
|
|
1721
|
+
* Each input field maps directly to its header — no auto-detection or type
|
|
1722
|
+
* coercion. When multiple fields are supplied, all corresponding headers
|
|
1723
|
+
* are forwarded and the server resolves precedence.
|
|
1724
|
+
*
|
|
1725
|
+
* Routing:
|
|
1726
|
+
* - `folderId` → `X-UIPATH-OrganizationUnitId`
|
|
1727
|
+
* - `folderKey` → `X-UIPATH-FolderKey`
|
|
1728
|
+
* - `folderPath` → `X-UIPATH-FolderPath-Encoded`
|
|
1729
|
+
* - none set + `fallbackFolderKey` → fallback used as `X-UIPATH-FolderKey`
|
|
1730
|
+
* - none set + no fallback → `ValidationError`
|
|
1731
|
+
*
|
|
1732
|
+
* @throws ValidationError when no folder context can be resolved.
|
|
1733
|
+
*/
|
|
1734
|
+
function resolveFolderHeaders(input) {
|
|
1735
|
+
const { folderId, folderKey, folderPath, resourceType, fallbackFolderKey } = input;
|
|
1736
|
+
const trimmedKey = folderKey?.trim();
|
|
1737
|
+
const trimmedPath = folderPath?.trim();
|
|
1738
|
+
const headers = {};
|
|
1739
|
+
if (folderId !== undefined) {
|
|
1740
|
+
headers[FOLDER_ID] = folderId;
|
|
1741
|
+
}
|
|
1742
|
+
if (trimmedKey) {
|
|
1743
|
+
headers[FOLDER_KEY] = trimmedKey;
|
|
1744
|
+
}
|
|
1745
|
+
if (trimmedPath) {
|
|
1746
|
+
headers[FOLDER_PATH_ENCODED] = encodeFolderPathHeader(trimmedPath);
|
|
1747
|
+
}
|
|
1748
|
+
// No explicit folder context → meta-tag fallback or error.
|
|
1749
|
+
if (Object.keys(headers).length === 0) {
|
|
1750
|
+
if (!fallbackFolderKey) {
|
|
1751
|
+
throw new ValidationError({
|
|
1752
|
+
message: `${resourceType} requires folder context: pass \`folderId\`, \`folderKey\`, or \`folderPath\`, or initialize the SDK with a folder context.`,
|
|
1753
|
+
});
|
|
1754
|
+
}
|
|
1755
|
+
headers[FOLDER_KEY] = fallbackFolderKey;
|
|
1756
|
+
}
|
|
1757
|
+
return createHeaders(headers);
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
/**
|
|
1761
|
+
* Matches single-quote characters in OData string literals — escaped to `''`
|
|
1762
|
+
* inside the `$filter=Name eq '…'` clause built by `getByNameLookup`.
|
|
1763
|
+
*/
|
|
1764
|
+
const SINGLE_QUOTE_RE = /'/g;
|
|
1622
1765
|
/**
|
|
1623
1766
|
* Base service for services that need folder-specific functionality.
|
|
1624
1767
|
*
|
|
@@ -1652,6 +1795,68 @@ class FolderScopedService extends BaseService {
|
|
|
1652
1795
|
}
|
|
1653
1796
|
return response.data?.value;
|
|
1654
1797
|
}
|
|
1798
|
+
/**
|
|
1799
|
+
* Look up a single resource by name on a folder-scoped OData collection.
|
|
1800
|
+
*
|
|
1801
|
+
* Shared by `getByName` implementations across services (Assets, Processes, etc).
|
|
1802
|
+
* Handles:
|
|
1803
|
+
* - Name validation via `validateName`
|
|
1804
|
+
* - Folder header resolution via `resolveFolderHeaders` (folderId → ID/key
|
|
1805
|
+
* header by type, folderPath → encoded path header, falls back to
|
|
1806
|
+
* init-time `config.folderKey` from the `uipath:folder-key` meta tag)
|
|
1807
|
+
* - OData `$filter=Name eq '…'` with single-quote escaping + `$top=1`
|
|
1808
|
+
* - Empty-result → `NotFoundError` with folder context in the message
|
|
1809
|
+
*
|
|
1810
|
+
* The transform step is caller-provided because each resource has its own
|
|
1811
|
+
* PascalCase → camelCase field mapping.
|
|
1812
|
+
*
|
|
1813
|
+
* @param resourceType - Resource label used in validation + error messages (e.g. 'Asset', 'Process')
|
|
1814
|
+
* @param endpoint - Folder-scoped OData collection endpoint
|
|
1815
|
+
* @param name - Resource name to search for
|
|
1816
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) + OData query options (`expand`, `select`)
|
|
1817
|
+
* @param transform - Maps a raw OData item to the typed response (e.g. PascalCase → camelCase via field map)
|
|
1818
|
+
* @throws ValidationError when inputs are malformed; NotFoundError when no match
|
|
1819
|
+
*/
|
|
1820
|
+
async getByNameLookup(resourceType, endpoint, name, options, transform) {
|
|
1821
|
+
const validatedName = validateName(resourceType, name);
|
|
1822
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
1823
|
+
const headers = resolveFolderHeaders({
|
|
1824
|
+
folderId,
|
|
1825
|
+
folderKey,
|
|
1826
|
+
folderPath,
|
|
1827
|
+
resourceType: `${resourceType}.getByName`,
|
|
1828
|
+
fallbackFolderKey: this.config.folderKey,
|
|
1829
|
+
});
|
|
1830
|
+
const apiOptions = {
|
|
1831
|
+
...addPrefixToKeys(queryOptions, ODATA_PREFIX, Object.keys(queryOptions)),
|
|
1832
|
+
'$filter': `Name eq '${validatedName.replace(SINGLE_QUOTE_RE, "''")}'`,
|
|
1833
|
+
'$top': '1',
|
|
1834
|
+
};
|
|
1835
|
+
const response = await this.get(endpoint, {
|
|
1836
|
+
headers,
|
|
1837
|
+
params: apiOptions,
|
|
1838
|
+
});
|
|
1839
|
+
const items = response.data?.value;
|
|
1840
|
+
if (!items?.length) {
|
|
1841
|
+
const folderHint = describeFolderForError(folderId, folderKey, folderPath);
|
|
1842
|
+
throw new NotFoundError({
|
|
1843
|
+
message: `${resourceType} '${validatedName}' not found${folderHint}.`,
|
|
1844
|
+
});
|
|
1845
|
+
}
|
|
1846
|
+
return transform(items[0]);
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
/** Renders the supplied folder for a NotFoundError message. */
|
|
1850
|
+
function describeFolderForError(folderId, folderKey, folderPath) {
|
|
1851
|
+
const path = folderPath?.trim();
|
|
1852
|
+
if (path)
|
|
1853
|
+
return ` in folder '${path}'`;
|
|
1854
|
+
const key = folderKey?.trim();
|
|
1855
|
+
if (key)
|
|
1856
|
+
return ` in folder (key: ${key})`;
|
|
1857
|
+
if (typeof folderId === 'number')
|
|
1858
|
+
return ` in folder (id: ${folderId})`;
|
|
1859
|
+
return '';
|
|
1655
1860
|
}
|
|
1656
1861
|
|
|
1657
1862
|
/**
|
|
@@ -1685,7 +1890,7 @@ const AssetMap = {
|
|
|
1685
1890
|
// Connection string placeholder that will be replaced during build
|
|
1686
1891
|
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";
|
|
1687
1892
|
// SDK Version placeholder
|
|
1688
|
-
const SDK_VERSION = "1.3.
|
|
1893
|
+
const SDK_VERSION = "1.3.8";
|
|
1689
1894
|
const VERSION = "Version";
|
|
1690
1895
|
const SERVICE = "Service";
|
|
1691
1896
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -2040,6 +2245,35 @@ class AssetService extends FolderScopedService {
|
|
|
2040
2245
|
const transformedAsset = transformData(pascalToCamelCaseKeys(response.data), AssetMap);
|
|
2041
2246
|
return transformedAsset;
|
|
2042
2247
|
}
|
|
2248
|
+
/**
|
|
2249
|
+
* Retrieves a single asset by name.
|
|
2250
|
+
*
|
|
2251
|
+
* @param name - Asset name to search for
|
|
2252
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
|
|
2253
|
+
* @returns Promise resolving to a single asset
|
|
2254
|
+
* {@link AssetGetResponse}
|
|
2255
|
+
* @example
|
|
2256
|
+
* ```typescript
|
|
2257
|
+
* import { Assets } from '@uipath/uipath-typescript/assets';
|
|
2258
|
+
*
|
|
2259
|
+
* const assets = new Assets(sdk);
|
|
2260
|
+
*
|
|
2261
|
+
* // By folder ID
|
|
2262
|
+
* await assets.getByName('ApiKey', { folderId: 123 });
|
|
2263
|
+
*
|
|
2264
|
+
* // By folder key (GUID)
|
|
2265
|
+
* await assets.getByName('ApiKey', { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
|
|
2266
|
+
*
|
|
2267
|
+
* // By folder path
|
|
2268
|
+
* await assets.getByName('ApiKey', { folderPath: 'Shared/Finance' });
|
|
2269
|
+
*
|
|
2270
|
+
* // With expand
|
|
2271
|
+
* await assets.getByName('ApiKey', { folderPath: 'Shared/Finance', expand: 'keyValueList' });
|
|
2272
|
+
* ```
|
|
2273
|
+
*/
|
|
2274
|
+
async getByName(name, options = {}) {
|
|
2275
|
+
return this.getByNameLookup('Asset', ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap));
|
|
2276
|
+
}
|
|
2043
2277
|
}
|
|
2044
2278
|
__decorate([
|
|
2045
2279
|
track('Assets.GetAll')
|
|
@@ -2047,6 +2281,9 @@ __decorate([
|
|
|
2047
2281
|
__decorate([
|
|
2048
2282
|
track('Assets.GetById')
|
|
2049
2283
|
], AssetService.prototype, "getById", null);
|
|
2284
|
+
__decorate([
|
|
2285
|
+
track('Assets.GetByName')
|
|
2286
|
+
], AssetService.prototype, "getByName", null);
|
|
2050
2287
|
|
|
2051
2288
|
/**
|
|
2052
2289
|
* Enum for Asset Value Scope
|
package/dist/assets/index.d.ts
CHANGED
|
@@ -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
|
*
|
|
@@ -291,6 +299,32 @@ declare class BaseService {
|
|
|
291
299
|
private determineHasMorePages;
|
|
292
300
|
}
|
|
293
301
|
|
|
302
|
+
interface BaseOptions {
|
|
303
|
+
expand?: string;
|
|
304
|
+
select?: string;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Common request options interface used across services for querying data
|
|
308
|
+
*/
|
|
309
|
+
interface RequestOptions extends BaseOptions {
|
|
310
|
+
filter?: string;
|
|
311
|
+
orderby?: string;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Options that scope a name-based lookup (e.g. `getByName`) to a folder.
|
|
315
|
+
* Provide one of `folderId`, `folderKey`, or `folderPath`. When more than
|
|
316
|
+
* one is supplied, all are forwarded; the server applies precedence
|
|
317
|
+
* `folderPath` > `folderKey` > `folderId`.
|
|
318
|
+
*/
|
|
319
|
+
interface FolderScopedOptions extends BaseOptions {
|
|
320
|
+
/** Numeric folder ID. */
|
|
321
|
+
folderId?: number;
|
|
322
|
+
/** Folder key (GUID-formatted string). */
|
|
323
|
+
folderKey?: string;
|
|
324
|
+
/** Slash-delimited folder path, e.g. `'Shared/Finance'`. */
|
|
325
|
+
folderPath?: string;
|
|
326
|
+
}
|
|
327
|
+
|
|
294
328
|
/**
|
|
295
329
|
* Base service for services that need folder-specific functionality.
|
|
296
330
|
*
|
|
@@ -312,18 +346,29 @@ declare class FolderScopedService extends BaseService {
|
|
|
312
346
|
* @returns Promise resolving to an array of resources
|
|
313
347
|
*/
|
|
314
348
|
protected _getByFolder<T, R = T>(endpoint: string, folderId: number, options?: Record<string, any>, transformFn?: (item: T) => R): Promise<R[]>;
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
349
|
+
/**
|
|
350
|
+
* Look up a single resource by name on a folder-scoped OData collection.
|
|
351
|
+
*
|
|
352
|
+
* Shared by `getByName` implementations across services (Assets, Processes, etc).
|
|
353
|
+
* Handles:
|
|
354
|
+
* - Name validation via `validateName`
|
|
355
|
+
* - Folder header resolution via `resolveFolderHeaders` (folderId → ID/key
|
|
356
|
+
* header by type, folderPath → encoded path header, falls back to
|
|
357
|
+
* init-time `config.folderKey` from the `uipath:folder-key` meta tag)
|
|
358
|
+
* - OData `$filter=Name eq '…'` with single-quote escaping + `$top=1`
|
|
359
|
+
* - Empty-result → `NotFoundError` with folder context in the message
|
|
360
|
+
*
|
|
361
|
+
* The transform step is caller-provided because each resource has its own
|
|
362
|
+
* PascalCase → camelCase field mapping.
|
|
363
|
+
*
|
|
364
|
+
* @param resourceType - Resource label used in validation + error messages (e.g. 'Asset', 'Process')
|
|
365
|
+
* @param endpoint - Folder-scoped OData collection endpoint
|
|
366
|
+
* @param name - Resource name to search for
|
|
367
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) + OData query options (`expand`, `select`)
|
|
368
|
+
* @param transform - Maps a raw OData item to the typed response (e.g. PascalCase → camelCase via field map)
|
|
369
|
+
* @throws ValidationError when inputs are malformed; NotFoundError when no match
|
|
370
|
+
*/
|
|
371
|
+
protected getByNameLookup<TRaw extends object, T>(resourceType: string, endpoint: string, name: string, options: FolderScopedOptions, transform: (raw: TRaw) => T): Promise<T>;
|
|
327
372
|
}
|
|
328
373
|
|
|
329
374
|
/**
|
|
@@ -389,6 +434,11 @@ type AssetGetAllOptions = RequestOptions & PaginationOptions & {
|
|
|
389
434
|
*/
|
|
390
435
|
interface AssetGetByIdOptions extends BaseOptions {
|
|
391
436
|
}
|
|
437
|
+
/**
|
|
438
|
+
* Options for getting a single asset by name
|
|
439
|
+
*/
|
|
440
|
+
interface AssetGetByNameOptions extends FolderScopedOptions {
|
|
441
|
+
}
|
|
392
442
|
|
|
393
443
|
/**
|
|
394
444
|
* Service for managing UiPath Assets.
|
|
@@ -450,6 +500,29 @@ interface AssetServiceModel {
|
|
|
450
500
|
* ```
|
|
451
501
|
*/
|
|
452
502
|
getById(id: number, folderId: number, options?: AssetGetByIdOptions): Promise<AssetGetResponse>;
|
|
503
|
+
/**
|
|
504
|
+
* Retrieves a single asset by name.
|
|
505
|
+
*
|
|
506
|
+
* @param name - Asset name to search for
|
|
507
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
|
|
508
|
+
* @returns Promise resolving to a single asset
|
|
509
|
+
* {@link AssetGetResponse}
|
|
510
|
+
* @example
|
|
511
|
+
* ```typescript
|
|
512
|
+
* // By folder ID
|
|
513
|
+
* await assets.getByName('ApiKey', { folderId: 123 });
|
|
514
|
+
*
|
|
515
|
+
* // By folder key (GUID)
|
|
516
|
+
* await assets.getByName('ApiKey', { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
|
|
517
|
+
*
|
|
518
|
+
* // By folder path
|
|
519
|
+
* await assets.getByName('ApiKey', { folderPath: 'Shared/Finance' });
|
|
520
|
+
*
|
|
521
|
+
* // With expand
|
|
522
|
+
* await assets.getByName('ApiKey', { folderPath: 'Shared/Finance', expand: 'keyValueList' });
|
|
523
|
+
* ```
|
|
524
|
+
*/
|
|
525
|
+
getByName(name: string, options?: AssetGetByNameOptions): Promise<AssetGetResponse>;
|
|
453
526
|
}
|
|
454
527
|
|
|
455
528
|
/**
|
|
@@ -510,7 +583,34 @@ declare class AssetService extends FolderScopedService implements AssetServiceMo
|
|
|
510
583
|
* ```
|
|
511
584
|
*/
|
|
512
585
|
getById(id: number, folderId: number, options?: AssetGetByIdOptions): Promise<AssetGetResponse>;
|
|
586
|
+
/**
|
|
587
|
+
* Retrieves a single asset by name.
|
|
588
|
+
*
|
|
589
|
+
* @param name - Asset name to search for
|
|
590
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
|
|
591
|
+
* @returns Promise resolving to a single asset
|
|
592
|
+
* {@link AssetGetResponse}
|
|
593
|
+
* @example
|
|
594
|
+
* ```typescript
|
|
595
|
+
* import { Assets } from '@uipath/uipath-typescript/assets';
|
|
596
|
+
*
|
|
597
|
+
* const assets = new Assets(sdk);
|
|
598
|
+
*
|
|
599
|
+
* // By folder ID
|
|
600
|
+
* await assets.getByName('ApiKey', { folderId: 123 });
|
|
601
|
+
*
|
|
602
|
+
* // By folder key (GUID)
|
|
603
|
+
* await assets.getByName('ApiKey', { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
|
|
604
|
+
*
|
|
605
|
+
* // By folder path
|
|
606
|
+
* await assets.getByName('ApiKey', { folderPath: 'Shared/Finance' });
|
|
607
|
+
*
|
|
608
|
+
* // With expand
|
|
609
|
+
* await assets.getByName('ApiKey', { folderPath: 'Shared/Finance', expand: 'keyValueList' });
|
|
610
|
+
* ```
|
|
611
|
+
*/
|
|
612
|
+
getByName(name: string, options?: AssetGetByNameOptions): Promise<AssetGetResponse>;
|
|
513
613
|
}
|
|
514
614
|
|
|
515
615
|
export { AssetService, AssetValueScope, AssetValueType, AssetService as Assets };
|
|
516
|
-
export type { AssetGetAllOptions, AssetGetByIdOptions, AssetGetResponse, AssetServiceModel, CustomKeyValuePair };
|
|
616
|
+
export type { AssetGetAllOptions, AssetGetByIdOptions, AssetGetByNameOptions, AssetGetResponse, AssetServiceModel, CustomKeyValuePair };
|