@uipath/uipath-typescript 1.3.5 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/assets/index.cjs +204 -2
- package/dist/assets/index.d.ts +112 -13
- package/dist/assets/index.mjs +204 -2
- package/dist/attachments/index.cjs +3 -2
- package/dist/attachments/index.d.ts +7 -0
- package/dist/attachments/index.mjs +3 -2
- package/dist/buckets/index.cjs +172 -2
- package/dist/buckets/index.d.ts +56 -12
- package/dist/buckets/index.mjs +172 -2
- package/dist/cases/index.cjs +3 -2
- package/dist/cases/index.d.ts +7 -0
- package/dist/cases/index.mjs +3 -2
- package/dist/conversational-agent/index.cjs +196 -81
- package/dist/conversational-agent/index.d.ts +326 -80
- package/dist/conversational-agent/index.mjs +195 -80
- package/dist/core/index.cjs +44 -7
- package/dist/core/index.d.ts +11 -1
- package/dist/core/index.mjs +44 -7
- package/dist/entities/index.cjs +35 -6
- package/dist/entities/index.d.ts +101 -11
- package/dist/entities/index.mjs +36 -7
- package/dist/feedback/index.cjs +40 -5
- package/dist/feedback/index.d.ts +59 -1
- package/dist/feedback/index.mjs +40 -5
- package/dist/index.cjs +312 -14
- package/dist/index.d.ts +515 -32
- package/dist/index.mjs +313 -15
- package/dist/index.umd.js +312 -14
- package/dist/jobs/index.cjs +172 -2
- package/dist/jobs/index.d.ts +67 -23
- package/dist/jobs/index.mjs +172 -2
- package/dist/maestro-processes/index.cjs +3 -2
- package/dist/maestro-processes/index.d.ts +7 -0
- package/dist/maestro-processes/index.mjs +3 -2
- package/dist/processes/index.cjs +240 -3
- package/dist/processes/index.d.ts +124 -2
- package/dist/processes/index.mjs +240 -3
- package/dist/queues/index.cjs +172 -2
- package/dist/queues/index.d.ts +56 -12
- package/dist/queues/index.mjs +172 -2
- package/dist/tasks/index.cjs +3 -2
- package/dist/tasks/index.d.ts +7 -0
- package/dist/tasks/index.mjs +3 -2
- package/package.json +1 -1
package/dist/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';
|
|
@@ -1419,8 +1421,9 @@ class BaseService {
|
|
|
1419
1421
|
constructor(instance, headers) {
|
|
1420
1422
|
// Private field - not visible via Object.keys() or any reflection
|
|
1421
1423
|
_BaseService_apiClient.set(this, void 0);
|
|
1422
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
1424
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
1423
1425
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
1426
|
+
this.config = { folderKey };
|
|
1424
1427
|
}
|
|
1425
1428
|
/**
|
|
1426
1429
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -1617,6 +1620,111 @@ class BaseService {
|
|
|
1617
1620
|
}
|
|
1618
1621
|
_BaseService_apiClient = new WeakMap();
|
|
1619
1622
|
|
|
1623
|
+
/**
|
|
1624
|
+
* Validates the `name` argument passed to a `getByName(name, ...)` method.
|
|
1625
|
+
* Trims whitespace and rejects empty/whitespace-only names.
|
|
1626
|
+
*
|
|
1627
|
+
* @param resourceType - Resource label used in error messages (e.g. 'Asset', 'Process')
|
|
1628
|
+
* @param name - Resource name to validate
|
|
1629
|
+
* @returns The trimmed name
|
|
1630
|
+
* @throws ValidationError when `name` is missing or empty after trimming
|
|
1631
|
+
*/
|
|
1632
|
+
function validateName(resourceType, name) {
|
|
1633
|
+
if (!name) {
|
|
1634
|
+
throw new ValidationError({
|
|
1635
|
+
message: `${resourceType} name is required and cannot be empty.`,
|
|
1636
|
+
});
|
|
1637
|
+
}
|
|
1638
|
+
const trimmed = name.trim();
|
|
1639
|
+
if (!trimmed) {
|
|
1640
|
+
throw new ValidationError({
|
|
1641
|
+
message: `${resourceType} name is required and cannot be empty.`,
|
|
1642
|
+
});
|
|
1643
|
+
}
|
|
1644
|
+
return trimmed;
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
/**
|
|
1648
|
+
* Encodes a folder path for the `X-UIPATH-FolderPath-Encoded` header.
|
|
1649
|
+
*
|
|
1650
|
+
* Orchestrator decodes this header as **base64-encoded UTF-16 LE bytes**
|
|
1651
|
+
* (see `HttpHeadersProviderExtensions.GetDecoded` + `OrganizationUnitProvider`
|
|
1652
|
+
* in the Orchestrator repo, which call `Encoding.Unicode.GetString(...)`).
|
|
1653
|
+
* URL-encoding is NOT what the server expects — it must be base64-of-UTF-16-LE
|
|
1654
|
+
* bytes.
|
|
1655
|
+
*
|
|
1656
|
+
* @param folderPath - The folder path (e.g. 'Shared/Finance')
|
|
1657
|
+
* @returns Base64 string suitable for the `X-UIPATH-FolderPath-Encoded` header
|
|
1658
|
+
*/
|
|
1659
|
+
function encodeFolderPathHeader(folderPath) {
|
|
1660
|
+
// Force little-endian regardless of host byte order. `Uint16Array` viewed
|
|
1661
|
+
// as `Uint8Array` would use the host's native order — correct on LE hosts
|
|
1662
|
+
// (x86/ARM-LE) but wrong on BE hosts. `DataView.setUint16(..., true)`
|
|
1663
|
+
// pins LE.
|
|
1664
|
+
const buf = new ArrayBuffer(folderPath.length * 2);
|
|
1665
|
+
const view = new DataView(buf);
|
|
1666
|
+
for (let i = 0; i < folderPath.length; i++) {
|
|
1667
|
+
view.setUint16(i * 2, folderPath.charCodeAt(i), true);
|
|
1668
|
+
}
|
|
1669
|
+
const bytes = new Uint8Array(buf);
|
|
1670
|
+
let binary = '';
|
|
1671
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
1672
|
+
binary += String.fromCharCode(bytes[i]);
|
|
1673
|
+
}
|
|
1674
|
+
// btoa is browser-native; Node 16+ also has it as a global
|
|
1675
|
+
return btoa(binary);
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
/**
|
|
1679
|
+
* Resolves folder context into the appropriate Orchestrator folder headers.
|
|
1680
|
+
*
|
|
1681
|
+
* Centralized so all folder-scoped methods (e.g. `assets.getByName`,
|
|
1682
|
+
* `processes.getByName`, future Queues/Buckets/Jobs) share one implementation.
|
|
1683
|
+
*
|
|
1684
|
+
* Each input field maps directly to its header — no auto-detection or type
|
|
1685
|
+
* coercion. When multiple fields are supplied, all corresponding headers
|
|
1686
|
+
* are forwarded and the server resolves precedence.
|
|
1687
|
+
*
|
|
1688
|
+
* Routing:
|
|
1689
|
+
* - `folderId` → `X-UIPATH-OrganizationUnitId`
|
|
1690
|
+
* - `folderKey` → `X-UIPATH-FolderKey`
|
|
1691
|
+
* - `folderPath` → `X-UIPATH-FolderPath-Encoded`
|
|
1692
|
+
* - none set + `fallbackFolderKey` → fallback used as `X-UIPATH-FolderKey`
|
|
1693
|
+
* - none set + no fallback → `ValidationError`
|
|
1694
|
+
*
|
|
1695
|
+
* @throws ValidationError when no folder context can be resolved.
|
|
1696
|
+
*/
|
|
1697
|
+
function resolveFolderHeaders(input) {
|
|
1698
|
+
const { folderId, folderKey, folderPath, resourceType, fallbackFolderKey } = input;
|
|
1699
|
+
const trimmedKey = folderKey?.trim();
|
|
1700
|
+
const trimmedPath = folderPath?.trim();
|
|
1701
|
+
const headers = {};
|
|
1702
|
+
if (folderId !== undefined) {
|
|
1703
|
+
headers[FOLDER_ID] = folderId;
|
|
1704
|
+
}
|
|
1705
|
+
if (trimmedKey) {
|
|
1706
|
+
headers[FOLDER_KEY] = trimmedKey;
|
|
1707
|
+
}
|
|
1708
|
+
if (trimmedPath) {
|
|
1709
|
+
headers[FOLDER_PATH_ENCODED] = encodeFolderPathHeader(trimmedPath);
|
|
1710
|
+
}
|
|
1711
|
+
// No explicit folder context → meta-tag fallback or error.
|
|
1712
|
+
if (Object.keys(headers).length === 0) {
|
|
1713
|
+
if (!fallbackFolderKey) {
|
|
1714
|
+
throw new ValidationError({
|
|
1715
|
+
message: `${resourceType} requires folder context: pass \`folderId\`, \`folderKey\`, or \`folderPath\`, or initialize the SDK with a folder context.`,
|
|
1716
|
+
});
|
|
1717
|
+
}
|
|
1718
|
+
headers[FOLDER_KEY] = fallbackFolderKey;
|
|
1719
|
+
}
|
|
1720
|
+
return createHeaders(headers);
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
/**
|
|
1724
|
+
* Matches single-quote characters in OData string literals — escaped to `''`
|
|
1725
|
+
* inside the `$filter=Name eq '…'` clause built by `getByNameLookup`.
|
|
1726
|
+
*/
|
|
1727
|
+
const SINGLE_QUOTE_RE = /'/g;
|
|
1620
1728
|
/**
|
|
1621
1729
|
* Base service for services that need folder-specific functionality.
|
|
1622
1730
|
*
|
|
@@ -1650,6 +1758,68 @@ class FolderScopedService extends BaseService {
|
|
|
1650
1758
|
}
|
|
1651
1759
|
return response.data?.value;
|
|
1652
1760
|
}
|
|
1761
|
+
/**
|
|
1762
|
+
* Look up a single resource by name on a folder-scoped OData collection.
|
|
1763
|
+
*
|
|
1764
|
+
* Shared by `getByName` implementations across services (Assets, Processes, etc).
|
|
1765
|
+
* Handles:
|
|
1766
|
+
* - Name validation via `validateName`
|
|
1767
|
+
* - Folder header resolution via `resolveFolderHeaders` (folderId → ID/key
|
|
1768
|
+
* header by type, folderPath → encoded path header, falls back to
|
|
1769
|
+
* init-time `config.folderKey` from the `uipath:folder-key` meta tag)
|
|
1770
|
+
* - OData `$filter=Name eq '…'` with single-quote escaping + `$top=1`
|
|
1771
|
+
* - Empty-result → `NotFoundError` with folder context in the message
|
|
1772
|
+
*
|
|
1773
|
+
* The transform step is caller-provided because each resource has its own
|
|
1774
|
+
* PascalCase → camelCase field mapping.
|
|
1775
|
+
*
|
|
1776
|
+
* @param resourceType - Resource label used in validation + error messages (e.g. 'Asset', 'Process')
|
|
1777
|
+
* @param endpoint - Folder-scoped OData collection endpoint
|
|
1778
|
+
* @param name - Resource name to search for
|
|
1779
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) + OData query options (`expand`, `select`)
|
|
1780
|
+
* @param transform - Maps a raw OData item to the typed response (e.g. PascalCase → camelCase via field map)
|
|
1781
|
+
* @throws ValidationError when inputs are malformed; NotFoundError when no match
|
|
1782
|
+
*/
|
|
1783
|
+
async getByNameLookup(resourceType, endpoint, name, options, transform) {
|
|
1784
|
+
const validatedName = validateName(resourceType, name);
|
|
1785
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
1786
|
+
const headers = resolveFolderHeaders({
|
|
1787
|
+
folderId,
|
|
1788
|
+
folderKey,
|
|
1789
|
+
folderPath,
|
|
1790
|
+
resourceType: `${resourceType}.getByName`,
|
|
1791
|
+
fallbackFolderKey: this.config.folderKey,
|
|
1792
|
+
});
|
|
1793
|
+
const apiOptions = {
|
|
1794
|
+
...addPrefixToKeys(queryOptions, ODATA_PREFIX, Object.keys(queryOptions)),
|
|
1795
|
+
'$filter': `Name eq '${validatedName.replace(SINGLE_QUOTE_RE, "''")}'`,
|
|
1796
|
+
'$top': '1',
|
|
1797
|
+
};
|
|
1798
|
+
const response = await this.get(endpoint, {
|
|
1799
|
+
headers,
|
|
1800
|
+
params: apiOptions,
|
|
1801
|
+
});
|
|
1802
|
+
const items = response.data?.value;
|
|
1803
|
+
if (!items?.length) {
|
|
1804
|
+
const folderHint = describeFolderForError(folderId, folderKey, folderPath);
|
|
1805
|
+
throw new NotFoundError({
|
|
1806
|
+
message: `${resourceType} '${validatedName}' not found${folderHint}.`,
|
|
1807
|
+
});
|
|
1808
|
+
}
|
|
1809
|
+
return transform(items[0]);
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
/** Renders the supplied folder for a NotFoundError message. */
|
|
1813
|
+
function describeFolderForError(folderId, folderKey, folderPath) {
|
|
1814
|
+
const path = folderPath?.trim();
|
|
1815
|
+
if (path)
|
|
1816
|
+
return ` in folder '${path}'`;
|
|
1817
|
+
const key = folderKey?.trim();
|
|
1818
|
+
if (key)
|
|
1819
|
+
return ` in folder (key: ${key})`;
|
|
1820
|
+
if (typeof folderId === 'number')
|
|
1821
|
+
return ` in folder (id: ${folderId})`;
|
|
1822
|
+
return '';
|
|
1653
1823
|
}
|
|
1654
1824
|
|
|
1655
1825
|
/**
|
|
@@ -1684,7 +1854,7 @@ const QueueMap = {
|
|
|
1684
1854
|
// Connection string placeholder that will be replaced during build
|
|
1685
1855
|
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
1856
|
// SDK Version placeholder
|
|
1687
|
-
const SDK_VERSION = "1.3.
|
|
1857
|
+
const SDK_VERSION = "1.3.7";
|
|
1688
1858
|
const VERSION = "Version";
|
|
1689
1859
|
const SERVICE = "Service";
|
|
1690
1860
|
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.7";
|
|
282
282
|
const VERSION = "Version";
|
|
283
283
|
const SERVICE = "Service";
|
|
284
284
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -2026,8 +2026,9 @@ class BaseService {
|
|
|
2026
2026
|
constructor(instance, headers) {
|
|
2027
2027
|
// Private field - not visible via Object.keys() or any reflection
|
|
2028
2028
|
_BaseService_apiClient.set(this, void 0);
|
|
2029
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
2029
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
2030
2030
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
2031
|
+
this.config = { folderKey };
|
|
2031
2032
|
}
|
|
2032
2033
|
/**
|
|
2033
2034
|
* Gets a valid authentication token, refreshing if necessary.
|
package/dist/tasks/index.d.ts
CHANGED
|
@@ -816,6 +816,13 @@ interface ApiResponse<T> {
|
|
|
816
816
|
*/
|
|
817
817
|
declare class BaseService {
|
|
818
818
|
#private;
|
|
819
|
+
/**
|
|
820
|
+
* SDK configuration (read-only). Available to subclasses so they can
|
|
821
|
+
* fall back to init-time defaults like `folderKey`.
|
|
822
|
+
*/
|
|
823
|
+
protected readonly config: {
|
|
824
|
+
folderKey?: string;
|
|
825
|
+
};
|
|
819
826
|
/**
|
|
820
827
|
* Creates a base service instance with dependency injection.
|
|
821
828
|
*
|
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.7";
|
|
280
280
|
const VERSION = "Version";
|
|
281
281
|
const SERVICE = "Service";
|
|
282
282
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -2024,8 +2024,9 @@ class BaseService {
|
|
|
2024
2024
|
constructor(instance, headers) {
|
|
2025
2025
|
// Private field - not visible via Object.keys() or any reflection
|
|
2026
2026
|
_BaseService_apiClient.set(this, void 0);
|
|
2027
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
2027
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
2028
2028
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
2029
|
+
this.config = { folderKey };
|
|
2029
2030
|
}
|
|
2030
2031
|
/**
|
|
2031
2032
|
* Gets a valid authentication token, refreshing if necessary.
|