@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/queues/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
|
/**
|
package/dist/queues/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
|
/**
|
|
@@ -1684,7 +1889,7 @@ const QueueMap = {
|
|
|
1684
1889
|
// Connection string placeholder that will be replaced during build
|
|
1685
1890
|
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";
|
|
1686
1891
|
// SDK Version placeholder
|
|
1687
|
-
const SDK_VERSION = "1.3.
|
|
1892
|
+
const SDK_VERSION = "1.3.8";
|
|
1688
1893
|
const VERSION = "Version";
|
|
1689
1894
|
const SERVICE = "Service";
|
|
1690
1895
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
package/dist/tasks/index.cjs
CHANGED
|
@@ -278,7 +278,7 @@ class NetworkError extends UiPathError {
|
|
|
278
278
|
// Connection string placeholder that will be replaced during build
|
|
279
279
|
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";
|
|
280
280
|
// SDK Version placeholder
|
|
281
|
-
const SDK_VERSION = "1.3.
|
|
281
|
+
const SDK_VERSION = "1.3.8";
|
|
282
282
|
const VERSION = "Version";
|
|
283
283
|
const SERVICE = "Service";
|
|
284
284
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -858,6 +858,27 @@ function createHeaders(headersObj) {
|
|
|
858
858
|
/**
|
|
859
859
|
* Collection of utility functions for working with objects
|
|
860
860
|
*/
|
|
861
|
+
/**
|
|
862
|
+
* Resolves a field value from an object, supporting both direct keys (e.g., '@odata.count')
|
|
863
|
+
* and dot-separated nested paths (e.g., 'pagination.totalCount').
|
|
864
|
+
* Direct key match takes priority over nested traversal.
|
|
865
|
+
*/
|
|
866
|
+
function resolveNestedField(data, fieldPath) {
|
|
867
|
+
if (!data) {
|
|
868
|
+
return undefined;
|
|
869
|
+
}
|
|
870
|
+
if (fieldPath in data) {
|
|
871
|
+
return data[fieldPath];
|
|
872
|
+
}
|
|
873
|
+
if (!fieldPath.includes('.')) {
|
|
874
|
+
return undefined;
|
|
875
|
+
}
|
|
876
|
+
let value = data;
|
|
877
|
+
for (const part of fieldPath.split('.')) {
|
|
878
|
+
value = value?.[part];
|
|
879
|
+
}
|
|
880
|
+
return value;
|
|
881
|
+
}
|
|
861
882
|
/**
|
|
862
883
|
* Filters out undefined values from an object
|
|
863
884
|
* @param obj The source object
|
|
@@ -914,6 +935,10 @@ var PaginationType;
|
|
|
914
935
|
PaginationType["TOKEN"] = "token";
|
|
915
936
|
})(PaginationType || (PaginationType = {}));
|
|
916
937
|
|
|
938
|
+
/**
|
|
939
|
+
* Converts a UTC timestamp string (e.g., "5/8/2026 11:20:17 AM") to ISO 8601 UTC format.
|
|
940
|
+
* Returns the original value if parsing fails.
|
|
941
|
+
*/
|
|
917
942
|
/**
|
|
918
943
|
* Transforms data by mapping fields according to the provided field mapping
|
|
919
944
|
* @param data The source data to transform
|
|
@@ -1430,7 +1455,8 @@ class PaginationHelpers {
|
|
|
1430
1455
|
// Extract and transform items from response
|
|
1431
1456
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1432
1457
|
const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
|
|
1433
|
-
const
|
|
1458
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1459
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1434
1460
|
// Parse items - automatically handle JSON string responses
|
|
1435
1461
|
const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
|
|
1436
1462
|
const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
|
|
@@ -2026,8 +2052,9 @@ class BaseService {
|
|
|
2026
2052
|
constructor(instance, headers) {
|
|
2027
2053
|
// Private field - not visible via Object.keys() or any reflection
|
|
2028
2054
|
_BaseService_apiClient.set(this, void 0);
|
|
2029
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
2055
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
2030
2056
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
2057
|
+
this.config = { folderKey };
|
|
2031
2058
|
}
|
|
2032
2059
|
/**
|
|
2033
2060
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -2146,9 +2173,17 @@ class BaseService {
|
|
|
2146
2173
|
const pageSizeParam = paginationParams?.pageSizeParam || ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM;
|
|
2147
2174
|
const offsetParam = paginationParams?.offsetParam || ODATA_OFFSET_PARAMS.OFFSET_PARAM;
|
|
2148
2175
|
const countParam = paginationParams?.countParam || ODATA_OFFSET_PARAMS.COUNT_PARAM;
|
|
2176
|
+
// When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
|
|
2177
|
+
// When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
|
|
2178
|
+
const convertToSkip = paginationParams?.convertToSkip ?? true;
|
|
2149
2179
|
requestParams[pageSizeParam] = limitedPageSize;
|
|
2150
|
-
if (
|
|
2151
|
-
|
|
2180
|
+
if (convertToSkip) {
|
|
2181
|
+
if (params.pageNumber && params.pageNumber > 1) {
|
|
2182
|
+
requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
else {
|
|
2186
|
+
requestParams[offsetParam] = params.pageNumber || 1;
|
|
2152
2187
|
}
|
|
2153
2188
|
{
|
|
2154
2189
|
requestParams[countParam] = true;
|
|
@@ -2179,7 +2214,8 @@ class BaseService {
|
|
|
2179
2214
|
// Extract items and metadata
|
|
2180
2215
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
2181
2216
|
const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
|
|
2182
|
-
const
|
|
2217
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
2218
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
2183
2219
|
const continuationToken = response.data[continuationTokenField];
|
|
2184
2220
|
// Determine if there are more pages
|
|
2185
2221
|
const hasMore = this.determineHasMorePages(paginationType, {
|
package/dist/tasks/index.d.ts
CHANGED
|
@@ -704,6 +704,7 @@ interface RequestWithPaginationOptions extends RequestSpec {
|
|
|
704
704
|
offsetParam?: string;
|
|
705
705
|
tokenParam?: string;
|
|
706
706
|
countParam?: string;
|
|
707
|
+
convertToSkip?: boolean;
|
|
707
708
|
};
|
|
708
709
|
};
|
|
709
710
|
}
|
|
@@ -816,6 +817,13 @@ interface ApiResponse<T> {
|
|
|
816
817
|
*/
|
|
817
818
|
declare class BaseService {
|
|
818
819
|
#private;
|
|
820
|
+
/**
|
|
821
|
+
* SDK configuration (read-only). Available to subclasses so they can
|
|
822
|
+
* fall back to init-time defaults like `folderKey`.
|
|
823
|
+
*/
|
|
824
|
+
protected readonly config: {
|
|
825
|
+
folderKey?: string;
|
|
826
|
+
};
|
|
819
827
|
/**
|
|
820
828
|
* Creates a base service instance with dependency injection.
|
|
821
829
|
*
|
package/dist/tasks/index.mjs
CHANGED
|
@@ -276,7 +276,7 @@ class NetworkError extends UiPathError {
|
|
|
276
276
|
// Connection string placeholder that will be replaced during build
|
|
277
277
|
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";
|
|
278
278
|
// SDK Version placeholder
|
|
279
|
-
const SDK_VERSION = "1.3.
|
|
279
|
+
const SDK_VERSION = "1.3.8";
|
|
280
280
|
const VERSION = "Version";
|
|
281
281
|
const SERVICE = "Service";
|
|
282
282
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -856,6 +856,27 @@ function createHeaders(headersObj) {
|
|
|
856
856
|
/**
|
|
857
857
|
* Collection of utility functions for working with objects
|
|
858
858
|
*/
|
|
859
|
+
/**
|
|
860
|
+
* Resolves a field value from an object, supporting both direct keys (e.g., '@odata.count')
|
|
861
|
+
* and dot-separated nested paths (e.g., 'pagination.totalCount').
|
|
862
|
+
* Direct key match takes priority over nested traversal.
|
|
863
|
+
*/
|
|
864
|
+
function resolveNestedField(data, fieldPath) {
|
|
865
|
+
if (!data) {
|
|
866
|
+
return undefined;
|
|
867
|
+
}
|
|
868
|
+
if (fieldPath in data) {
|
|
869
|
+
return data[fieldPath];
|
|
870
|
+
}
|
|
871
|
+
if (!fieldPath.includes('.')) {
|
|
872
|
+
return undefined;
|
|
873
|
+
}
|
|
874
|
+
let value = data;
|
|
875
|
+
for (const part of fieldPath.split('.')) {
|
|
876
|
+
value = value?.[part];
|
|
877
|
+
}
|
|
878
|
+
return value;
|
|
879
|
+
}
|
|
859
880
|
/**
|
|
860
881
|
* Filters out undefined values from an object
|
|
861
882
|
* @param obj The source object
|
|
@@ -912,6 +933,10 @@ var PaginationType;
|
|
|
912
933
|
PaginationType["TOKEN"] = "token";
|
|
913
934
|
})(PaginationType || (PaginationType = {}));
|
|
914
935
|
|
|
936
|
+
/**
|
|
937
|
+
* Converts a UTC timestamp string (e.g., "5/8/2026 11:20:17 AM") to ISO 8601 UTC format.
|
|
938
|
+
* Returns the original value if parsing fails.
|
|
939
|
+
*/
|
|
915
940
|
/**
|
|
916
941
|
* Transforms data by mapping fields according to the provided field mapping
|
|
917
942
|
* @param data The source data to transform
|
|
@@ -1428,7 +1453,8 @@ class PaginationHelpers {
|
|
|
1428
1453
|
// Extract and transform items from response
|
|
1429
1454
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1430
1455
|
const rawItems = Array.isArray(response.data) ? response.data : response.data?.[itemsField];
|
|
1431
|
-
const
|
|
1456
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1457
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1432
1458
|
// Parse items - automatically handle JSON string responses
|
|
1433
1459
|
const parsedItems = typeof rawItems === 'string' ? JSON.parse(rawItems) : (rawItems || []);
|
|
1434
1460
|
const items = transformFn ? parsedItems.map(transformFn) : parsedItems;
|
|
@@ -2024,8 +2050,9 @@ class BaseService {
|
|
|
2024
2050
|
constructor(instance, headers) {
|
|
2025
2051
|
// Private field - not visible via Object.keys() or any reflection
|
|
2026
2052
|
_BaseService_apiClient.set(this, void 0);
|
|
2027
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
2053
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
2028
2054
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
2055
|
+
this.config = { folderKey };
|
|
2029
2056
|
}
|
|
2030
2057
|
/**
|
|
2031
2058
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -2144,9 +2171,17 @@ class BaseService {
|
|
|
2144
2171
|
const pageSizeParam = paginationParams?.pageSizeParam || ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM;
|
|
2145
2172
|
const offsetParam = paginationParams?.offsetParam || ODATA_OFFSET_PARAMS.OFFSET_PARAM;
|
|
2146
2173
|
const countParam = paginationParams?.countParam || ODATA_OFFSET_PARAMS.COUNT_PARAM;
|
|
2174
|
+
// When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
|
|
2175
|
+
// When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
|
|
2176
|
+
const convertToSkip = paginationParams?.convertToSkip ?? true;
|
|
2147
2177
|
requestParams[pageSizeParam] = limitedPageSize;
|
|
2148
|
-
if (
|
|
2149
|
-
|
|
2178
|
+
if (convertToSkip) {
|
|
2179
|
+
if (params.pageNumber && params.pageNumber > 1) {
|
|
2180
|
+
requestParams[offsetParam] = (params.pageNumber - 1) * limitedPageSize;
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
else {
|
|
2184
|
+
requestParams[offsetParam] = params.pageNumber || 1;
|
|
2150
2185
|
}
|
|
2151
2186
|
{
|
|
2152
2187
|
requestParams[countParam] = true;
|
|
@@ -2177,7 +2212,8 @@ class BaseService {
|
|
|
2177
2212
|
// Extract items and metadata
|
|
2178
2213
|
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
2179
2214
|
const items = Array.isArray(response.data) ? response.data : (response.data[itemsField] || []);
|
|
2180
|
-
const
|
|
2215
|
+
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
2216
|
+
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
2181
2217
|
const continuationToken = response.data[continuationTokenField];
|
|
2182
2218
|
// Determine if there are more pages
|
|
2183
2219
|
const hasMore = this.determineHasMorePages(paginationType, {
|