@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.mjs
CHANGED
|
@@ -503,6 +503,8 @@ class ErrorFactory {
|
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
505
|
|
|
506
|
+
const FOLDER_KEY = 'X-UIPATH-FolderKey';
|
|
507
|
+
const FOLDER_PATH_ENCODED = 'X-UIPATH-FolderPath-Encoded';
|
|
506
508
|
const FOLDER_ID = 'X-UIPATH-OrganizationUnitId';
|
|
507
509
|
const TRACEPARENT = 'traceparent';
|
|
508
510
|
const UIPATH_TRACEPARENT_ID = 'x-uipath-traceparent-id';
|
|
@@ -649,6 +651,27 @@ var PaginationType;
|
|
|
649
651
|
/**
|
|
650
652
|
* Collection of utility functions for working with objects
|
|
651
653
|
*/
|
|
654
|
+
/**
|
|
655
|
+
* Resolves a field value from an object, supporting both direct keys (e.g., '@odata.count')
|
|
656
|
+
* and dot-separated nested paths (e.g., 'pagination.totalCount').
|
|
657
|
+
* Direct key match takes priority over nested traversal.
|
|
658
|
+
*/
|
|
659
|
+
function resolveNestedField(data, fieldPath) {
|
|
660
|
+
if (!data) {
|
|
661
|
+
return undefined;
|
|
662
|
+
}
|
|
663
|
+
if (fieldPath in data) {
|
|
664
|
+
return data[fieldPath];
|
|
665
|
+
}
|
|
666
|
+
if (!fieldPath.includes('.')) {
|
|
667
|
+
return undefined;
|
|
668
|
+
}
|
|
669
|
+
let value = data;
|
|
670
|
+
for (const part of fieldPath.split('.')) {
|
|
671
|
+
value = value?.[part];
|
|
672
|
+
}
|
|
673
|
+
return value;
|
|
674
|
+
}
|
|
652
675
|
/**
|
|
653
676
|
* Filters out undefined values from an object
|
|
654
677
|
* @param obj The source object
|
|
@@ -889,6 +912,10 @@ const BUCKET_TOKEN_PARAMS = {
|
|
|
889
912
|
TOKEN_PARAM: 'continuationToken'
|
|
890
913
|
};
|
|
891
914
|
|
|
915
|
+
/**
|
|
916
|
+
* Converts a UTC timestamp string (e.g., "5/8/2026 11:20:17 AM") to ISO 8601 UTC format.
|
|
917
|
+
* Returns the original value if parsing fails.
|
|
918
|
+
*/
|
|
892
919
|
/**
|
|
893
920
|
* Transforms data by mapping fields according to the provided field mapping
|
|
894
921
|
* @param data The source data to transform
|
|
@@ -1243,7 +1270,8 @@ class PaginationHelpers {
|
|
|
1243
1270
|
// Extract and transform items from response
|
|
1244
1271
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1245
1272
|
const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
|
|
1246
|
-
const
|
|
1273
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1274
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1247
1275
|
// Parse items - automatically handle JSON string responses
|
|
1248
1276
|
const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
|
|
1249
1277
|
const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
|
|
@@ -1419,8 +1447,9 @@ class BaseService {
|
|
|
1419
1447
|
constructor(instance, headers) {
|
|
1420
1448
|
// Private field - not visible via Object.keys() or any reflection
|
|
1421
1449
|
_BaseService_apiClient.set(this, void 0);
|
|
1422
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
1450
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
1423
1451
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
1452
|
+
this.config = { folderKey };
|
|
1424
1453
|
}
|
|
1425
1454
|
/**
|
|
1426
1455
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -1539,9 +1568,17 @@ class BaseService {
|
|
|
1539
1568
|
const pageSizeParam = paginationParams?.pageSizeParam || ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM;
|
|
1540
1569
|
const offsetParam = paginationParams?.offsetParam || ODATA_OFFSET_PARAMS.OFFSET_PARAM;
|
|
1541
1570
|
const countParam = paginationParams?.countParam || ODATA_OFFSET_PARAMS.COUNT_PARAM;
|
|
1571
|
+
// When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
|
|
1572
|
+
// When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
|
|
1573
|
+
const convertToSkip = paginationParams?.convertToSkip ?? true;
|
|
1542
1574
|
requestParams[pageSizeParam] = limitedPageSize;
|
|
1543
|
-
if (
|
|
1544
|
-
|
|
1575
|
+
if (convertToSkip) {
|
|
1576
|
+
if (params.pageNumber && params.pageNumber > 1) {
|
|
1577
|
+
requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
else {
|
|
1581
|
+
requestParams[offsetParam] = params.pageNumber || 1;
|
|
1545
1582
|
}
|
|
1546
1583
|
{
|
|
1547
1584
|
requestParams[countParam] = true;
|
|
@@ -1572,7 +1609,8 @@ class BaseService {
|
|
|
1572
1609
|
// Extract items and metadata
|
|
1573
1610
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1574
1611
|
const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
|
|
1575
|
-
const
|
|
1612
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1613
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1576
1614
|
const continuationToken = response.data[continuationTokenField];
|
|
1577
1615
|
// Determine if there are more pages
|
|
1578
1616
|
const hasMore = this.determineHasMorePages(paginationType, {
|
|
@@ -1617,6 +1655,111 @@ class BaseService {
|
|
|
1617
1655
|
}
|
|
1618
1656
|
_BaseService_apiClient = new WeakMap();
|
|
1619
1657
|
|
|
1658
|
+
/**
|
|
1659
|
+
* Validates the `name` argument passed to a `getByName(name, ...)` method.
|
|
1660
|
+
* Trims whitespace and rejects empty/whitespace-only names.
|
|
1661
|
+
*
|
|
1662
|
+
* @param resourceType - Resource label used in error messages (e.g. 'Asset', 'Process')
|
|
1663
|
+
* @param name - Resource name to validate
|
|
1664
|
+
* @returns The trimmed name
|
|
1665
|
+
* @throws ValidationError when `name` is missing or empty after trimming
|
|
1666
|
+
*/
|
|
1667
|
+
function validateName(resourceType, name) {
|
|
1668
|
+
if (!name) {
|
|
1669
|
+
throw new ValidationError({
|
|
1670
|
+
message: `${resourceType} name is required and cannot be empty.`,
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1673
|
+
const trimmed = name.trim();
|
|
1674
|
+
if (!trimmed) {
|
|
1675
|
+
throw new ValidationError({
|
|
1676
|
+
message: `${resourceType} name is required and cannot be empty.`,
|
|
1677
|
+
});
|
|
1678
|
+
}
|
|
1679
|
+
return trimmed;
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
/**
|
|
1683
|
+
* Encodes a folder path for the `X-UIPATH-FolderPath-Encoded` header.
|
|
1684
|
+
*
|
|
1685
|
+
* Orchestrator decodes this header as **base64-encoded UTF-16 LE bytes**
|
|
1686
|
+
* (see `HttpHeadersProviderExtensions.GetDecoded` + `OrganizationUnitProvider`
|
|
1687
|
+
* in the Orchestrator repo, which call `Encoding.Unicode.GetString(...)`).
|
|
1688
|
+
* URL-encoding is NOT what the server expects — it must be base64-of-UTF-16-LE
|
|
1689
|
+
* bytes.
|
|
1690
|
+
*
|
|
1691
|
+
* @param folderPath - The folder path (e.g. 'Shared/Finance')
|
|
1692
|
+
* @returns Base64 string suitable for the `X-UIPATH-FolderPath-Encoded` header
|
|
1693
|
+
*/
|
|
1694
|
+
function encodeFolderPathHeader(folderPath) {
|
|
1695
|
+
// Force little-endian regardless of host byte order. `Uint16Array` viewed
|
|
1696
|
+
// as `Uint8Array` would use the host's native order — correct on LE hosts
|
|
1697
|
+
// (x86/ARM-LE) but wrong on BE hosts. `DataView.setUint16(..., true)`
|
|
1698
|
+
// pins LE.
|
|
1699
|
+
const buf = new ArrayBuffer(folderPath.length * 2);
|
|
1700
|
+
const view = new DataView(buf);
|
|
1701
|
+
for (let i = 0; i < folderPath.length; i++) {
|
|
1702
|
+
view.setUint16(i * 2, folderPath.charCodeAt(i), true);
|
|
1703
|
+
}
|
|
1704
|
+
const bytes = new Uint8Array(buf);
|
|
1705
|
+
let binary = '';
|
|
1706
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
1707
|
+
binary += String.fromCharCode(bytes[i]);
|
|
1708
|
+
}
|
|
1709
|
+
// btoa is browser-native; Node 16+ also has it as a global
|
|
1710
|
+
return btoa(binary);
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
/**
|
|
1714
|
+
* Resolves folder context into the appropriate Orchestrator folder headers.
|
|
1715
|
+
*
|
|
1716
|
+
* Centralized so all folder-scoped methods (e.g. `assets.getByName`,
|
|
1717
|
+
* `processes.getByName`, future Queues/Buckets/Jobs) share one implementation.
|
|
1718
|
+
*
|
|
1719
|
+
* Each input field maps directly to its header — no auto-detection or type
|
|
1720
|
+
* coercion. When multiple fields are supplied, all corresponding headers
|
|
1721
|
+
* are forwarded and the server resolves precedence.
|
|
1722
|
+
*
|
|
1723
|
+
* Routing:
|
|
1724
|
+
* - `folderId` → `X-UIPATH-OrganizationUnitId`
|
|
1725
|
+
* - `folderKey` → `X-UIPATH-FolderKey`
|
|
1726
|
+
* - `folderPath` → `X-UIPATH-FolderPath-Encoded`
|
|
1727
|
+
* - none set + `fallbackFolderKey` → fallback used as `X-UIPATH-FolderKey`
|
|
1728
|
+
* - none set + no fallback → `ValidationError`
|
|
1729
|
+
*
|
|
1730
|
+
* @throws ValidationError when no folder context can be resolved.
|
|
1731
|
+
*/
|
|
1732
|
+
function resolveFolderHeaders(input) {
|
|
1733
|
+
const { folderId, folderKey, folderPath, resourceType, fallbackFolderKey } = input;
|
|
1734
|
+
const trimmedKey = folderKey?.trim();
|
|
1735
|
+
const trimmedPath = folderPath?.trim();
|
|
1736
|
+
const headers = {};
|
|
1737
|
+
if (folderId !== undefined) {
|
|
1738
|
+
headers[FOLDER_ID] = folderId;
|
|
1739
|
+
}
|
|
1740
|
+
if (trimmedKey) {
|
|
1741
|
+
headers[FOLDER_KEY] = trimmedKey;
|
|
1742
|
+
}
|
|
1743
|
+
if (trimmedPath) {
|
|
1744
|
+
headers[FOLDER_PATH_ENCODED] = encodeFolderPathHeader(trimmedPath);
|
|
1745
|
+
}
|
|
1746
|
+
// No explicit folder context → meta-tag fallback or error.
|
|
1747
|
+
if (Object.keys(headers).length === 0) {
|
|
1748
|
+
if (!fallbackFolderKey) {
|
|
1749
|
+
throw new ValidationError({
|
|
1750
|
+
message: `${resourceType} requires folder context: pass \`folderId\`, \`folderKey\`, or \`folderPath\`, or initialize the SDK with a folder context.`,
|
|
1751
|
+
});
|
|
1752
|
+
}
|
|
1753
|
+
headers[FOLDER_KEY] = fallbackFolderKey;
|
|
1754
|
+
}
|
|
1755
|
+
return createHeaders(headers);
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
/**
|
|
1759
|
+
* Matches single-quote characters in OData string literals — escaped to `''`
|
|
1760
|
+
* inside the `$filter=Name eq '…'` clause built by `getByNameLookup`.
|
|
1761
|
+
*/
|
|
1762
|
+
const SINGLE_QUOTE_RE = /'/g;
|
|
1620
1763
|
/**
|
|
1621
1764
|
* Base service for services that need folder-specific functionality.
|
|
1622
1765
|
*
|
|
@@ -1650,6 +1793,68 @@ class FolderScopedService extends BaseService {
|
|
|
1650
1793
|
}
|
|
1651
1794
|
return response.data?.value;
|
|
1652
1795
|
}
|
|
1796
|
+
/**
|
|
1797
|
+
* Look up a single resource by name on a folder-scoped OData collection.
|
|
1798
|
+
*
|
|
1799
|
+
* Shared by `getByName` implementations across services (Assets, Processes, etc).
|
|
1800
|
+
* Handles:
|
|
1801
|
+
* - Name validation via `validateName`
|
|
1802
|
+
* - Folder header resolution via `resolveFolderHeaders` (folderId → ID/key
|
|
1803
|
+
* header by type, folderPath → encoded path header, falls back to
|
|
1804
|
+
* init-time `config.folderKey` from the `uipath:folder-key` meta tag)
|
|
1805
|
+
* - OData `$filter=Name eq '…'` with single-quote escaping + `$top=1`
|
|
1806
|
+
* - Empty-result → `NotFoundError` with folder context in the message
|
|
1807
|
+
*
|
|
1808
|
+
* The transform step is caller-provided because each resource has its own
|
|
1809
|
+
* PascalCase → camelCase field mapping.
|
|
1810
|
+
*
|
|
1811
|
+
* @param resourceType - Resource label used in validation + error messages (e.g. 'Asset', 'Process')
|
|
1812
|
+
* @param endpoint - Folder-scoped OData collection endpoint
|
|
1813
|
+
* @param name - Resource name to search for
|
|
1814
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) + OData query options (`expand`, `select`)
|
|
1815
|
+
* @param transform - Maps a raw OData item to the typed response (e.g. PascalCase → camelCase via field map)
|
|
1816
|
+
* @throws ValidationError when inputs are malformed; NotFoundError when no match
|
|
1817
|
+
*/
|
|
1818
|
+
async getByNameLookup(resourceType, endpoint, name, options, transform) {
|
|
1819
|
+
const validatedName = validateName(resourceType, name);
|
|
1820
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
1821
|
+
const headers = resolveFolderHeaders({
|
|
1822
|
+
folderId,
|
|
1823
|
+
folderKey,
|
|
1824
|
+
folderPath,
|
|
1825
|
+
resourceType: `${resourceType}.getByName`,
|
|
1826
|
+
fallbackFolderKey: this.config.folderKey,
|
|
1827
|
+
});
|
|
1828
|
+
const apiOptions = {
|
|
1829
|
+
...addPrefixToKeys(queryOptions, ODATA_PREFIX, Object.keys(queryOptions)),
|
|
1830
|
+
'$filter': `Name eq '${validatedName.replace(SINGLE_QUOTE_RE, "''")}'`,
|
|
1831
|
+
'$top': '1',
|
|
1832
|
+
};
|
|
1833
|
+
const response = await this.get(endpoint, {
|
|
1834
|
+
headers,
|
|
1835
|
+
params: apiOptions,
|
|
1836
|
+
});
|
|
1837
|
+
const items = response.data?.value;
|
|
1838
|
+
if (!items?.length) {
|
|
1839
|
+
const folderHint = describeFolderForError(folderId, folderKey, folderPath);
|
|
1840
|
+
throw new NotFoundError({
|
|
1841
|
+
message: `${resourceType} '${validatedName}' not found${folderHint}.`,
|
|
1842
|
+
});
|
|
1843
|
+
}
|
|
1844
|
+
return transform(items[0]);
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
/** Renders the supplied folder for a NotFoundError message. */
|
|
1848
|
+
function describeFolderForError(folderId, folderKey, folderPath) {
|
|
1849
|
+
const path = folderPath?.trim();
|
|
1850
|
+
if (path)
|
|
1851
|
+
return ` in folder '${path}'`;
|
|
1852
|
+
const key = folderKey?.trim();
|
|
1853
|
+
if (key)
|
|
1854
|
+
return ` in folder (key: ${key})`;
|
|
1855
|
+
if (typeof folderId === 'number')
|
|
1856
|
+
return ` in folder (id: ${folderId})`;
|
|
1857
|
+
return '';
|
|
1653
1858
|
}
|
|
1654
1859
|
|
|
1655
1860
|
/**
|
|
@@ -1683,7 +1888,7 @@ const AssetMap = {
|
|
|
1683
1888
|
// Connection string placeholder that will be replaced during build
|
|
1684
1889
|
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";
|
|
1685
1890
|
// SDK Version placeholder
|
|
1686
|
-
const SDK_VERSION = "1.3.
|
|
1891
|
+
const SDK_VERSION = "1.3.8";
|
|
1687
1892
|
const VERSION = "Version";
|
|
1688
1893
|
const SERVICE = "Service";
|
|
1689
1894
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -2038,6 +2243,35 @@ class AssetService extends FolderScopedService {
|
|
|
2038
2243
|
const transformedAsset = transformData(pascalToCamelCaseKeys(response.data), AssetMap);
|
|
2039
2244
|
return transformedAsset;
|
|
2040
2245
|
}
|
|
2246
|
+
/**
|
|
2247
|
+
* Retrieves a single asset by name.
|
|
2248
|
+
*
|
|
2249
|
+
* @param name - Asset name to search for
|
|
2250
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
|
|
2251
|
+
* @returns Promise resolving to a single asset
|
|
2252
|
+
* {@link AssetGetResponse}
|
|
2253
|
+
* @example
|
|
2254
|
+
* ```typescript
|
|
2255
|
+
* import { Assets } from '@uipath/uipath-typescript/assets';
|
|
2256
|
+
*
|
|
2257
|
+
* const assets = new Assets(sdk);
|
|
2258
|
+
*
|
|
2259
|
+
* // By folder ID
|
|
2260
|
+
* await assets.getByName('ApiKey', { folderId: 123 });
|
|
2261
|
+
*
|
|
2262
|
+
* // By folder key (GUID)
|
|
2263
|
+
* await assets.getByName('ApiKey', { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
|
|
2264
|
+
*
|
|
2265
|
+
* // By folder path
|
|
2266
|
+
* await assets.getByName('ApiKey', { folderPath: 'Shared/Finance' });
|
|
2267
|
+
*
|
|
2268
|
+
* // With expand
|
|
2269
|
+
* await assets.getByName('ApiKey', { folderPath: 'Shared/Finance', expand: 'keyValueList' });
|
|
2270
|
+
* ```
|
|
2271
|
+
*/
|
|
2272
|
+
async getByName(name, options = {}) {
|
|
2273
|
+
return this.getByNameLookup('Asset', ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap));
|
|
2274
|
+
}
|
|
2041
2275
|
}
|
|
2042
2276
|
__decorate([
|
|
2043
2277
|
track('Assets.GetAll')
|
|
@@ -2045,6 +2279,9 @@ __decorate([
|
|
|
2045
2279
|
__decorate([
|
|
2046
2280
|
track('Assets.GetById')
|
|
2047
2281
|
], AssetService.prototype, "getById", null);
|
|
2282
|
+
__decorate([
|
|
2283
|
+
track('Assets.GetByName')
|
|
2284
|
+
], AssetService.prototype, "getByName", null);
|
|
2048
2285
|
|
|
2049
2286
|
/**
|
|
2050
2287
|
* Enum for Asset Value Scope
|
|
@@ -272,6 +272,10 @@ class NetworkError extends UiPathError {
|
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
+
/**
|
|
276
|
+
* Converts a UTC timestamp string (e.g., "5/8/2026 11:20:17 AM") to ISO 8601 UTC format.
|
|
277
|
+
* Returns the original value if parsing fails.
|
|
278
|
+
*/
|
|
275
279
|
/**
|
|
276
280
|
* Transforms data by mapping fields according to the provided field mapping
|
|
277
281
|
* @param data The source data to transform
|
|
@@ -476,7 +480,7 @@ const BUCKET_TOKEN_PARAMS = {
|
|
|
476
480
|
// Connection string placeholder that will be replaced during build
|
|
477
481
|
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";
|
|
478
482
|
// SDK Version placeholder
|
|
479
|
-
const SDK_VERSION = "1.3.
|
|
483
|
+
const SDK_VERSION = "1.3.8";
|
|
480
484
|
const VERSION = "Version";
|
|
481
485
|
const SERVICE = "Service";
|
|
482
486
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -1130,6 +1134,27 @@ var PaginationType;
|
|
|
1130
1134
|
/**
|
|
1131
1135
|
* Collection of utility functions for working with objects
|
|
1132
1136
|
*/
|
|
1137
|
+
/**
|
|
1138
|
+
* Resolves a field value from an object, supporting both direct keys (e.g., '@odata.count')
|
|
1139
|
+
* and dot-separated nested paths (e.g., 'pagination.totalCount').
|
|
1140
|
+
* Direct key match takes priority over nested traversal.
|
|
1141
|
+
*/
|
|
1142
|
+
function resolveNestedField(data, fieldPath) {
|
|
1143
|
+
if (!data) {
|
|
1144
|
+
return undefined;
|
|
1145
|
+
}
|
|
1146
|
+
if (fieldPath in data) {
|
|
1147
|
+
return data[fieldPath];
|
|
1148
|
+
}
|
|
1149
|
+
if (!fieldPath.includes('.')) {
|
|
1150
|
+
return undefined;
|
|
1151
|
+
}
|
|
1152
|
+
let value = data;
|
|
1153
|
+
for (const part of fieldPath.split('.')) {
|
|
1154
|
+
value = value?.[part];
|
|
1155
|
+
}
|
|
1156
|
+
return value;
|
|
1157
|
+
}
|
|
1133
1158
|
/**
|
|
1134
1159
|
* Filters out undefined values from an object
|
|
1135
1160
|
* @param obj The source object
|
|
@@ -1532,7 +1557,8 @@ class PaginationHelpers {
|
|
|
1532
1557
|
// Extract and transform items from response
|
|
1533
1558
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1534
1559
|
const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
|
|
1535
|
-
const
|
|
1560
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1561
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1536
1562
|
// Parse items - automatically handle JSON string responses
|
|
1537
1563
|
const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
|
|
1538
1564
|
const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
|
|
@@ -1708,8 +1734,9 @@ class BaseService {
|
|
|
1708
1734
|
constructor(instance, headers) {
|
|
1709
1735
|
// Private field - not visible via Object.keys() or any reflection
|
|
1710
1736
|
_BaseService_apiClient.set(this, void 0);
|
|
1711
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
1737
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
1712
1738
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
1739
|
+
this.config = { folderKey };
|
|
1713
1740
|
}
|
|
1714
1741
|
/**
|
|
1715
1742
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -1828,9 +1855,17 @@ class BaseService {
|
|
|
1828
1855
|
const pageSizeParam = paginationParams?.pageSizeParam || ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM;
|
|
1829
1856
|
const offsetParam = paginationParams?.offsetParam || ODATA_OFFSET_PARAMS.OFFSET_PARAM;
|
|
1830
1857
|
const countParam = paginationParams?.countParam || ODATA_OFFSET_PARAMS.COUNT_PARAM;
|
|
1858
|
+
// When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
|
|
1859
|
+
// When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
|
|
1860
|
+
const convertToSkip = paginationParams?.convertToSkip ?? true;
|
|
1831
1861
|
requestParams[pageSizeParam] = limitedPageSize;
|
|
1832
|
-
if (
|
|
1833
|
-
|
|
1862
|
+
if (convertToSkip) {
|
|
1863
|
+
if (params.pageNumber && params.pageNumber > 1) {
|
|
1864
|
+
requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
else {
|
|
1868
|
+
requestParams[offsetParam] = params.pageNumber || 1;
|
|
1834
1869
|
}
|
|
1835
1870
|
{
|
|
1836
1871
|
requestParams[countParam] = true;
|
|
@@ -1861,7 +1896,8 @@ class BaseService {
|
|
|
1861
1896
|
// Extract items and metadata
|
|
1862
1897
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1863
1898
|
const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
|
|
1864
|
-
const
|
|
1899
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1900
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1865
1901
|
const continuationToken = response.data[continuationTokenField];
|
|
1866
1902
|
// Determine if there are more pages
|
|
1867
1903
|
const hasMore = this.determineHasMorePages(paginationType, {
|
|
@@ -194,6 +194,7 @@ interface RequestWithPaginationOptions extends RequestSpec {
|
|
|
194
194
|
offsetParam?: string;
|
|
195
195
|
tokenParam?: string;
|
|
196
196
|
countParam?: string;
|
|
197
|
+
convertToSkip?: boolean;
|
|
197
198
|
};
|
|
198
199
|
};
|
|
199
200
|
}
|
|
@@ -306,6 +307,13 @@ interface ApiResponse<T> {
|
|
|
306
307
|
*/
|
|
307
308
|
declare class BaseService {
|
|
308
309
|
#private;
|
|
310
|
+
/**
|
|
311
|
+
* SDK configuration (read-only). Available to subclasses so they can
|
|
312
|
+
* fall back to init-time defaults like `folderKey`.
|
|
313
|
+
*/
|
|
314
|
+
protected readonly config: {
|
|
315
|
+
folderKey?: string;
|
|
316
|
+
};
|
|
309
317
|
/**
|
|
310
318
|
* Creates a base service instance with dependency injection.
|
|
311
319
|
*
|
|
@@ -270,6 +270,10 @@ class NetworkError extends UiPathError {
|
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
+
/**
|
|
274
|
+
* Converts a UTC timestamp string (e.g., "5/8/2026 11:20:17 AM") to ISO 8601 UTC format.
|
|
275
|
+
* Returns the original value if parsing fails.
|
|
276
|
+
*/
|
|
273
277
|
/**
|
|
274
278
|
* Transforms data by mapping fields according to the provided field mapping
|
|
275
279
|
* @param data The source data to transform
|
|
@@ -474,7 +478,7 @@ const BUCKET_TOKEN_PARAMS = {
|
|
|
474
478
|
// Connection string placeholder that will be replaced during build
|
|
475
479
|
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";
|
|
476
480
|
// SDK Version placeholder
|
|
477
|
-
const SDK_VERSION = "1.3.
|
|
481
|
+
const SDK_VERSION = "1.3.8";
|
|
478
482
|
const VERSION = "Version";
|
|
479
483
|
const SERVICE = "Service";
|
|
480
484
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -1128,6 +1132,27 @@ var PaginationType;
|
|
|
1128
1132
|
/**
|
|
1129
1133
|
* Collection of utility functions for working with objects
|
|
1130
1134
|
*/
|
|
1135
|
+
/**
|
|
1136
|
+
* Resolves a field value from an object, supporting both direct keys (e.g., '@odata.count')
|
|
1137
|
+
* and dot-separated nested paths (e.g., 'pagination.totalCount').
|
|
1138
|
+
* Direct key match takes priority over nested traversal.
|
|
1139
|
+
*/
|
|
1140
|
+
function resolveNestedField(data, fieldPath) {
|
|
1141
|
+
if (!data) {
|
|
1142
|
+
return undefined;
|
|
1143
|
+
}
|
|
1144
|
+
if (fieldPath in data) {
|
|
1145
|
+
return data[fieldPath];
|
|
1146
|
+
}
|
|
1147
|
+
if (!fieldPath.includes('.')) {
|
|
1148
|
+
return undefined;
|
|
1149
|
+
}
|
|
1150
|
+
let value = data;
|
|
1151
|
+
for (const part of fieldPath.split('.')) {
|
|
1152
|
+
value = value?.[part];
|
|
1153
|
+
}
|
|
1154
|
+
return value;
|
|
1155
|
+
}
|
|
1131
1156
|
/**
|
|
1132
1157
|
* Filters out undefined values from an object
|
|
1133
1158
|
* @param obj The source object
|
|
@@ -1530,7 +1555,8 @@ class PaginationHelpers {
|
|
|
1530
1555
|
// Extract and transform items from response
|
|
1531
1556
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1532
1557
|
const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
|
|
1533
|
-
const
|
|
1558
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1559
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1534
1560
|
// Parse items - automatically handle JSON string responses
|
|
1535
1561
|
const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
|
|
1536
1562
|
const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
|
|
@@ -1706,8 +1732,9 @@ class BaseService {
|
|
|
1706
1732
|
constructor(instance, headers) {
|
|
1707
1733
|
// Private field - not visible via Object.keys() or any reflection
|
|
1708
1734
|
_BaseService_apiClient.set(this, void 0);
|
|
1709
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
1735
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
1710
1736
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
1737
|
+
this.config = { folderKey };
|
|
1711
1738
|
}
|
|
1712
1739
|
/**
|
|
1713
1740
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -1826,9 +1853,17 @@ class BaseService {
|
|
|
1826
1853
|
const pageSizeParam = paginationParams?.pageSizeParam || ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM;
|
|
1827
1854
|
const offsetParam = paginationParams?.offsetParam || ODATA_OFFSET_PARAMS.OFFSET_PARAM;
|
|
1828
1855
|
const countParam = paginationParams?.countParam || ODATA_OFFSET_PARAMS.COUNT_PARAM;
|
|
1856
|
+
// When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
|
|
1857
|
+
// When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
|
|
1858
|
+
const convertToSkip = paginationParams?.convertToSkip ?? true;
|
|
1829
1859
|
requestParams[pageSizeParam] = limitedPageSize;
|
|
1830
|
-
if (
|
|
1831
|
-
|
|
1860
|
+
if (convertToSkip) {
|
|
1861
|
+
if (params.pageNumber && params.pageNumber > 1) {
|
|
1862
|
+
requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
else {
|
|
1866
|
+
requestParams[offsetParam] = params.pageNumber || 1;
|
|
1832
1867
|
}
|
|
1833
1868
|
{
|
|
1834
1869
|
requestParams[countParam] = true;
|
|
@@ -1859,7 +1894,8 @@ class BaseService {
|
|
|
1859
1894
|
// Extract items and metadata
|
|
1860
1895
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1861
1896
|
const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
|
|
1862
|
-
const
|
|
1897
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1898
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1863
1899
|
const continuationToken = response.data[continuationTokenField];
|
|
1864
1900
|
// Determine if there are more pages
|
|
1865
1901
|
const hasMore = this.determineHasMorePages(paginationType, {
|