@uipath/uipath-typescript 1.3.6 → 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/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 +18 -6
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.mjs +18 -6
- 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 +3 -2
- package/dist/feedback/index.d.ts +7 -0
- package/dist/feedback/index.mjs +3 -2
- package/dist/index.cjs +286 -13
- package/dist/index.d.ts +475 -32
- package/dist/index.mjs +287 -14
- package/dist/index.umd.js +286 -13
- 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/index.umd.js
CHANGED
|
@@ -9221,7 +9221,7 @@
|
|
|
9221
9221
|
// Connection string placeholder that will be replaced during build
|
|
9222
9222
|
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";
|
|
9223
9223
|
// SDK Version placeholder
|
|
9224
|
-
const SDK_VERSION = "1.3.
|
|
9224
|
+
const SDK_VERSION = "1.3.7";
|
|
9225
9225
|
const VERSION = "Version";
|
|
9226
9226
|
const SERVICE = "Service";
|
|
9227
9227
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -9568,6 +9568,8 @@
|
|
|
9568
9568
|
// Asset resolution and routing
|
|
9569
9569
|
UiPathMetaTags["CDN_BASE"] = "uipath:cdn-base";
|
|
9570
9570
|
UiPathMetaTags["APP_BASE"] = "uipath:app-base";
|
|
9571
|
+
// Folder context (injected during coded-app deployment)
|
|
9572
|
+
UiPathMetaTags["FOLDER_KEY"] = "uipath:folder-key";
|
|
9571
9573
|
})(exports.UiPathMetaTags || (exports.UiPathMetaTags = {}));
|
|
9572
9574
|
|
|
9573
9575
|
/**
|
|
@@ -9596,12 +9598,13 @@
|
|
|
9596
9598
|
tenantName: getMetaTagContent(exports.UiPathMetaTags.TENANT_NAME),
|
|
9597
9599
|
baseUrl: getMetaTagContent(exports.UiPathMetaTags.BASE_URL),
|
|
9598
9600
|
redirectUri: getMetaTagContent(exports.UiPathMetaTags.REDIRECT_URI),
|
|
9601
|
+
folderKey: getMetaTagContent(exports.UiPathMetaTags.FOLDER_KEY),
|
|
9599
9602
|
};
|
|
9600
9603
|
const hasAnyValue = Object.values(config).some(Boolean);
|
|
9601
9604
|
return hasAnyValue ? config : null;
|
|
9602
9605
|
}
|
|
9603
9606
|
|
|
9604
|
-
var _UiPath_instances, _UiPath_config, _UiPath_authService, _UiPath_initialized, _UiPath_partialConfig, _UiPath_multiLogin, _UiPath_initializeWithConfig, _UiPath_loadConfig;
|
|
9607
|
+
var _UiPath_instances, _UiPath_config, _UiPath_authService, _UiPath_initialized, _UiPath_partialConfig, _UiPath_multiLogin, _UiPath_metaFolderKey, _UiPath_initializeWithConfig, _UiPath_loadConfig;
|
|
9605
9608
|
/**
|
|
9606
9609
|
* UiPath - Core SDK class for authentication and configuration management.
|
|
9607
9610
|
*
|
|
@@ -9642,8 +9645,13 @@
|
|
|
9642
9645
|
_UiPath_initialized.set(this, false);
|
|
9643
9646
|
_UiPath_partialConfig.set(this, void 0);
|
|
9644
9647
|
_UiPath_multiLogin.set(this, false);
|
|
9648
|
+
// Folder key sourced only from `<meta name="uipath:folder-key">` (coded-app
|
|
9649
|
+
// deployments). Not accepted via the public constructor; lives here so the
|
|
9650
|
+
// SDK can flow it through to BaseService.config without polluting BaseConfig.
|
|
9651
|
+
_UiPath_metaFolderKey.set(this, void 0);
|
|
9645
9652
|
// Load configuration from meta tags
|
|
9646
9653
|
const configFromMetaTags = loadFromMetaTags();
|
|
9654
|
+
__classPrivateFieldSet(this, _UiPath_metaFolderKey, configFromMetaTags?.folderKey, "f");
|
|
9647
9655
|
// Merge configuration: constructor config overrides meta tags
|
|
9648
9656
|
const mergedConfig = config ? { ...configFromMetaTags, ...config } : configFromMetaTags;
|
|
9649
9657
|
if (mergedConfig && isCompleteConfig(mergedConfig)) {
|
|
@@ -9772,7 +9780,7 @@
|
|
|
9772
9780
|
__classPrivateFieldGet(this, _UiPath_authService, "f")?.updateToken(tokenInfo);
|
|
9773
9781
|
}
|
|
9774
9782
|
};
|
|
9775
|
-
_UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_initialized = new WeakMap(), _UiPath_partialConfig = new WeakMap(), _UiPath_multiLogin = new WeakMap(), _UiPath_instances = new WeakSet(), _UiPath_initializeWithConfig = function _UiPath_initializeWithConfig(config) {
|
|
9783
|
+
_UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_initialized = new WeakMap(), _UiPath_partialConfig = new WeakMap(), _UiPath_multiLogin = new WeakMap(), _UiPath_metaFolderKey = new WeakMap(), _UiPath_instances = new WeakSet(), _UiPath_initializeWithConfig = function _UiPath_initializeWithConfig(config) {
|
|
9776
9784
|
// Validate and normalize the configuration
|
|
9777
9785
|
validateConfig(config);
|
|
9778
9786
|
const hasSecretAuth = hasSecretConfig(config);
|
|
@@ -9785,7 +9793,7 @@
|
|
|
9785
9793
|
secret: hasSecretAuth ? config.secret : undefined,
|
|
9786
9794
|
clientId: hasOAuthAuth ? config.clientId : undefined,
|
|
9787
9795
|
redirectUri: hasOAuthAuth ? config.redirectUri : undefined,
|
|
9788
|
-
scope: hasOAuthAuth ? config.scope : undefined
|
|
9796
|
+
scope: hasOAuthAuth ? config.scope : undefined,
|
|
9789
9797
|
});
|
|
9790
9798
|
const executionContext = new ExecutionContext();
|
|
9791
9799
|
__classPrivateFieldSet(this, _UiPath_authService, new AuthService(internalConfig, executionContext), "f");
|
|
@@ -9793,11 +9801,14 @@
|
|
|
9793
9801
|
__classPrivateFieldGet(this, _UiPath_authService, "f").setMultiLogin();
|
|
9794
9802
|
}
|
|
9795
9803
|
__classPrivateFieldSet(this, _UiPath_config, internalConfig, "f");
|
|
9796
|
-
// Store internals in SDKInternalsRegistry (not visible on instance)
|
|
9804
|
+
// Store internals in SDKInternalsRegistry (not visible on instance).
|
|
9805
|
+
// `folderKey` is meta-tag-only — kept off `UiPathConfig` (which mirrors
|
|
9806
|
+
// user-passed values) and lives here on the runtime registry instead.
|
|
9797
9807
|
SDKInternalsRegistry.set(this, {
|
|
9798
9808
|
config: internalConfig,
|
|
9799
9809
|
context: executionContext,
|
|
9800
|
-
tokenManager: __classPrivateFieldGet(this, _UiPath_authService, "f").getTokenManager()
|
|
9810
|
+
tokenManager: __classPrivateFieldGet(this, _UiPath_authService, "f").getTokenManager(),
|
|
9811
|
+
folderKey: __classPrivateFieldGet(this, _UiPath_metaFolderKey, "f"),
|
|
9801
9812
|
});
|
|
9802
9813
|
// Expose read-only config for user convenience
|
|
9803
9814
|
this.config = {
|
|
@@ -9825,6 +9836,7 @@
|
|
|
9825
9836
|
}, _UiPath_loadConfig = function _UiPath_loadConfig() {
|
|
9826
9837
|
// Load from meta tags
|
|
9827
9838
|
const metaConfig = loadFromMetaTags();
|
|
9839
|
+
__classPrivateFieldSet(this, _UiPath_metaFolderKey, metaConfig?.folderKey, "f");
|
|
9828
9840
|
// Merge with any partial config from constructor (constructor overrides meta tags)
|
|
9829
9841
|
const merged = { ...metaConfig, ...__classPrivateFieldGet(this, _UiPath_partialConfig, "f") };
|
|
9830
9842
|
if (!isCompleteConfig(merged)) {
|
|
@@ -10068,6 +10080,7 @@
|
|
|
10068
10080
|
}
|
|
10069
10081
|
|
|
10070
10082
|
const FOLDER_KEY = 'X-UIPATH-FolderKey';
|
|
10083
|
+
const FOLDER_PATH_ENCODED = 'X-UIPATH-FolderPath-Encoded';
|
|
10071
10084
|
const FOLDER_ID = 'X-UIPATH-OrganizationUnitId';
|
|
10072
10085
|
const TRACEPARENT = 'traceparent';
|
|
10073
10086
|
const UIPATH_TRACEPARENT_ID = 'x-uipath-traceparent-id';
|
|
@@ -11200,8 +11213,9 @@
|
|
|
11200
11213
|
constructor(instance, headers) {
|
|
11201
11214
|
// Private field - not visible via Object.keys() or any reflection
|
|
11202
11215
|
_BaseService_apiClient.set(this, void 0);
|
|
11203
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
11216
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
11204
11217
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
11218
|
+
this.config = { folderKey };
|
|
11205
11219
|
}
|
|
11206
11220
|
/**
|
|
11207
11221
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -11563,6 +11577,17 @@
|
|
|
11563
11577
|
QueryFilterOperator["In"] = "in";
|
|
11564
11578
|
QueryFilterOperator["NotIn"] = "not in";
|
|
11565
11579
|
})(exports.QueryFilterOperator || (exports.QueryFilterOperator = {}));
|
|
11580
|
+
/**
|
|
11581
|
+
* Aggregate functions supported by the Data Fabric query API.
|
|
11582
|
+
*/
|
|
11583
|
+
exports.EntityAggregateFunction = void 0;
|
|
11584
|
+
(function (EntityAggregateFunction) {
|
|
11585
|
+
EntityAggregateFunction["Count"] = "COUNT";
|
|
11586
|
+
EntityAggregateFunction["Sum"] = "SUM";
|
|
11587
|
+
EntityAggregateFunction["Avg"] = "AVG";
|
|
11588
|
+
EntityAggregateFunction["Min"] = "MIN";
|
|
11589
|
+
EntityAggregateFunction["Max"] = "MAX";
|
|
11590
|
+
})(exports.EntityAggregateFunction || (exports.EntityAggregateFunction = {}));
|
|
11566
11591
|
/**
|
|
11567
11592
|
* Entity type enum
|
|
11568
11593
|
*/
|
|
@@ -12152,16 +12177,16 @@
|
|
|
12152
12177
|
return entities;
|
|
12153
12178
|
}
|
|
12154
12179
|
/**
|
|
12155
|
-
* Queries entity records with filters, sorting, and pagination
|
|
12180
|
+
* Queries entity records with filters, sorting, aggregates, and pagination
|
|
12156
12181
|
*
|
|
12157
12182
|
* @param id - UUID of the entity
|
|
12158
|
-
* @param options - Query options including filterGroup, selectedFields, sortOptions, and pagination
|
|
12183
|
+
* @param options - Query options including filterGroup, selectedFields, sortOptions, aggregates, groupBy, and pagination
|
|
12159
12184
|
* @returns Promise resolving to {@link NonPaginatedResponse} without pagination options,
|
|
12160
12185
|
* or {@link PaginatedResponse} when `pageSize`, `cursor`, or `jumpToPage` are provided
|
|
12161
12186
|
*
|
|
12162
12187
|
* @example
|
|
12163
12188
|
* ```typescript
|
|
12164
|
-
* import { Entities, LogicalOperator, QueryFilterOperator } from '@uipath/uipath-typescript/entities';
|
|
12189
|
+
* import { Entities, LogicalOperator, QueryFilterOperator, EntityAggregateFunction } from '@uipath/uipath-typescript/entities';
|
|
12165
12190
|
*
|
|
12166
12191
|
* const entities = new Entities(sdk);
|
|
12167
12192
|
*
|
|
@@ -12185,6 +12210,23 @@
|
|
|
12185
12210
|
* if (page1.hasNextPage) {
|
|
12186
12211
|
* const page2 = await entities.queryRecordsById("<entityId>", { cursor: page1.nextCursor });
|
|
12187
12212
|
* }
|
|
12213
|
+
*
|
|
12214
|
+
* // Aggregate: count of records per status
|
|
12215
|
+
* await entities.queryRecordsById("<entityId>", {
|
|
12216
|
+
* selectedFields: ["status"],
|
|
12217
|
+
* groupBy: ["status"],
|
|
12218
|
+
* aggregates: [
|
|
12219
|
+
* { function: EntityAggregateFunction.Count, field: "Id", alias: "total" },
|
|
12220
|
+
* ],
|
|
12221
|
+
* });
|
|
12222
|
+
*
|
|
12223
|
+
* // Aggregate: total sum and average across all records (no grouping)
|
|
12224
|
+
* await entities.queryRecordsById("<entityId>", {
|
|
12225
|
+
* aggregates: [
|
|
12226
|
+
* { function: EntityAggregateFunction.Sum, field: "amount", alias: "totalAmount" },
|
|
12227
|
+
* { function: EntityAggregateFunction.Avg, field: "amount", alias: "avgAmount" },
|
|
12228
|
+
* ],
|
|
12229
|
+
* });
|
|
12188
12230
|
* ```
|
|
12189
12231
|
*/
|
|
12190
12232
|
async queryRecordsById(id, options) {
|
|
@@ -12202,7 +12244,7 @@
|
|
|
12202
12244
|
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
12203
12245
|
}
|
|
12204
12246
|
},
|
|
12205
|
-
excludeFromPrefix: ['expansionLevel', 'filterGroup', 'selectedFields', 'sortOptions']
|
|
12247
|
+
excludeFromPrefix: ['expansionLevel', 'filterGroup', 'selectedFields', 'sortOptions', 'aggregates', 'groupBy']
|
|
12206
12248
|
}, options);
|
|
12207
12249
|
}
|
|
12208
12250
|
/**
|
|
@@ -14896,6 +14938,111 @@
|
|
|
14896
14938
|
track('CaseInstances.GetActionTasks')
|
|
14897
14939
|
], CaseInstancesService.prototype, "getActionTasks", null);
|
|
14898
14940
|
|
|
14941
|
+
/**
|
|
14942
|
+
* Validates the `name` argument passed to a `getByName(name, ...)` method.
|
|
14943
|
+
* Trims whitespace and rejects empty/whitespace-only names.
|
|
14944
|
+
*
|
|
14945
|
+
* @param resourceType - Resource label used in error messages (e.g. 'Asset', 'Process')
|
|
14946
|
+
* @param name - Resource name to validate
|
|
14947
|
+
* @returns The trimmed name
|
|
14948
|
+
* @throws ValidationError when `name` is missing or empty after trimming
|
|
14949
|
+
*/
|
|
14950
|
+
function validateName(resourceType, name) {
|
|
14951
|
+
if (!name) {
|
|
14952
|
+
throw new ValidationError({
|
|
14953
|
+
message: `${resourceType} name is required and cannot be empty.`,
|
|
14954
|
+
});
|
|
14955
|
+
}
|
|
14956
|
+
const trimmed = name.trim();
|
|
14957
|
+
if (!trimmed) {
|
|
14958
|
+
throw new ValidationError({
|
|
14959
|
+
message: `${resourceType} name is required and cannot be empty.`,
|
|
14960
|
+
});
|
|
14961
|
+
}
|
|
14962
|
+
return trimmed;
|
|
14963
|
+
}
|
|
14964
|
+
|
|
14965
|
+
/**
|
|
14966
|
+
* Encodes a folder path for the `X-UIPATH-FolderPath-Encoded` header.
|
|
14967
|
+
*
|
|
14968
|
+
* Orchestrator decodes this header as **base64-encoded UTF-16 LE bytes**
|
|
14969
|
+
* (see `HttpHeadersProviderExtensions.GetDecoded` + `OrganizationUnitProvider`
|
|
14970
|
+
* in the Orchestrator repo, which call `Encoding.Unicode.GetString(...)`).
|
|
14971
|
+
* URL-encoding is NOT what the server expects — it must be base64-of-UTF-16-LE
|
|
14972
|
+
* bytes.
|
|
14973
|
+
*
|
|
14974
|
+
* @param folderPath - The folder path (e.g. 'Shared/Finance')
|
|
14975
|
+
* @returns Base64 string suitable for the `X-UIPATH-FolderPath-Encoded` header
|
|
14976
|
+
*/
|
|
14977
|
+
function encodeFolderPathHeader(folderPath) {
|
|
14978
|
+
// Force little-endian regardless of host byte order. `Uint16Array` viewed
|
|
14979
|
+
// as `Uint8Array` would use the host's native order — correct on LE hosts
|
|
14980
|
+
// (x86/ARM-LE) but wrong on BE hosts. `DataView.setUint16(..., true)`
|
|
14981
|
+
// pins LE.
|
|
14982
|
+
const buf = new ArrayBuffer(folderPath.length * 2);
|
|
14983
|
+
const view = new DataView(buf);
|
|
14984
|
+
for (let i = 0; i < folderPath.length; i++) {
|
|
14985
|
+
view.setUint16(i * 2, folderPath.charCodeAt(i), true);
|
|
14986
|
+
}
|
|
14987
|
+
const bytes = new Uint8Array(buf);
|
|
14988
|
+
let binary = '';
|
|
14989
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
14990
|
+
binary += String.fromCharCode(bytes[i]);
|
|
14991
|
+
}
|
|
14992
|
+
// btoa is browser-native; Node 16+ also has it as a global
|
|
14993
|
+
return btoa(binary);
|
|
14994
|
+
}
|
|
14995
|
+
|
|
14996
|
+
/**
|
|
14997
|
+
* Resolves folder context into the appropriate Orchestrator folder headers.
|
|
14998
|
+
*
|
|
14999
|
+
* Centralized so all folder-scoped methods (e.g. `assets.getByName`,
|
|
15000
|
+
* `processes.getByName`, future Queues/Buckets/Jobs) share one implementation.
|
|
15001
|
+
*
|
|
15002
|
+
* Each input field maps directly to its header — no auto-detection or type
|
|
15003
|
+
* coercion. When multiple fields are supplied, all corresponding headers
|
|
15004
|
+
* are forwarded and the server resolves precedence.
|
|
15005
|
+
*
|
|
15006
|
+
* Routing:
|
|
15007
|
+
* - `folderId` → `X-UIPATH-OrganizationUnitId`
|
|
15008
|
+
* - `folderKey` → `X-UIPATH-FolderKey`
|
|
15009
|
+
* - `folderPath` → `X-UIPATH-FolderPath-Encoded`
|
|
15010
|
+
* - none set + `fallbackFolderKey` → fallback used as `X-UIPATH-FolderKey`
|
|
15011
|
+
* - none set + no fallback → `ValidationError`
|
|
15012
|
+
*
|
|
15013
|
+
* @throws ValidationError when no folder context can be resolved.
|
|
15014
|
+
*/
|
|
15015
|
+
function resolveFolderHeaders(input) {
|
|
15016
|
+
const { folderId, folderKey, folderPath, resourceType, fallbackFolderKey } = input;
|
|
15017
|
+
const trimmedKey = folderKey?.trim();
|
|
15018
|
+
const trimmedPath = folderPath?.trim();
|
|
15019
|
+
const headers = {};
|
|
15020
|
+
if (folderId !== undefined) {
|
|
15021
|
+
headers[FOLDER_ID] = folderId;
|
|
15022
|
+
}
|
|
15023
|
+
if (trimmedKey) {
|
|
15024
|
+
headers[FOLDER_KEY] = trimmedKey;
|
|
15025
|
+
}
|
|
15026
|
+
if (trimmedPath) {
|
|
15027
|
+
headers[FOLDER_PATH_ENCODED] = encodeFolderPathHeader(trimmedPath);
|
|
15028
|
+
}
|
|
15029
|
+
// No explicit folder context → meta-tag fallback or error.
|
|
15030
|
+
if (Object.keys(headers).length === 0) {
|
|
15031
|
+
if (!fallbackFolderKey) {
|
|
15032
|
+
throw new ValidationError({
|
|
15033
|
+
message: `${resourceType} requires folder context: pass \`folderId\`, \`folderKey\`, or \`folderPath\`, or initialize the SDK with a folder context.`,
|
|
15034
|
+
});
|
|
15035
|
+
}
|
|
15036
|
+
headers[FOLDER_KEY] = fallbackFolderKey;
|
|
15037
|
+
}
|
|
15038
|
+
return createHeaders(headers);
|
|
15039
|
+
}
|
|
15040
|
+
|
|
15041
|
+
/**
|
|
15042
|
+
* Matches single-quote characters in OData string literals — escaped to `''`
|
|
15043
|
+
* inside the `$filter=Name eq '…'` clause built by `getByNameLookup`.
|
|
15044
|
+
*/
|
|
15045
|
+
const SINGLE_QUOTE_RE = /'/g;
|
|
14899
15046
|
/**
|
|
14900
15047
|
* Base service for services that need folder-specific functionality.
|
|
14901
15048
|
*
|
|
@@ -14929,6 +15076,68 @@
|
|
|
14929
15076
|
}
|
|
14930
15077
|
return response.data?.value;
|
|
14931
15078
|
}
|
|
15079
|
+
/**
|
|
15080
|
+
* Look up a single resource by name on a folder-scoped OData collection.
|
|
15081
|
+
*
|
|
15082
|
+
* Shared by `getByName` implementations across services (Assets, Processes, etc).
|
|
15083
|
+
* Handles:
|
|
15084
|
+
* - Name validation via `validateName`
|
|
15085
|
+
* - Folder header resolution via `resolveFolderHeaders` (folderId → ID/key
|
|
15086
|
+
* header by type, folderPath → encoded path header, falls back to
|
|
15087
|
+
* init-time `config.folderKey` from the `uipath:folder-key` meta tag)
|
|
15088
|
+
* - OData `$filter=Name eq '…'` with single-quote escaping + `$top=1`
|
|
15089
|
+
* - Empty-result → `NotFoundError` with folder context in the message
|
|
15090
|
+
*
|
|
15091
|
+
* The transform step is caller-provided because each resource has its own
|
|
15092
|
+
* PascalCase → camelCase field mapping.
|
|
15093
|
+
*
|
|
15094
|
+
* @param resourceType - Resource label used in validation + error messages (e.g. 'Asset', 'Process')
|
|
15095
|
+
* @param endpoint - Folder-scoped OData collection endpoint
|
|
15096
|
+
* @param name - Resource name to search for
|
|
15097
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) + OData query options (`expand`, `select`)
|
|
15098
|
+
* @param transform - Maps a raw OData item to the typed response (e.g. PascalCase → camelCase via field map)
|
|
15099
|
+
* @throws ValidationError when inputs are malformed; NotFoundError when no match
|
|
15100
|
+
*/
|
|
15101
|
+
async getByNameLookup(resourceType, endpoint, name, options, transform) {
|
|
15102
|
+
const validatedName = validateName(resourceType, name);
|
|
15103
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
15104
|
+
const headers = resolveFolderHeaders({
|
|
15105
|
+
folderId,
|
|
15106
|
+
folderKey,
|
|
15107
|
+
folderPath,
|
|
15108
|
+
resourceType: `${resourceType}.getByName`,
|
|
15109
|
+
fallbackFolderKey: this.config.folderKey,
|
|
15110
|
+
});
|
|
15111
|
+
const apiOptions = {
|
|
15112
|
+
...addPrefixToKeys(queryOptions, ODATA_PREFIX, Object.keys(queryOptions)),
|
|
15113
|
+
'$filter': `Name eq '${validatedName.replace(SINGLE_QUOTE_RE, "''")}'`,
|
|
15114
|
+
'$top': '1',
|
|
15115
|
+
};
|
|
15116
|
+
const response = await this.get(endpoint, {
|
|
15117
|
+
headers,
|
|
15118
|
+
params: apiOptions,
|
|
15119
|
+
});
|
|
15120
|
+
const items = response.data?.value;
|
|
15121
|
+
if (!items?.length) {
|
|
15122
|
+
const folderHint = describeFolderForError(folderId, folderKey, folderPath);
|
|
15123
|
+
throw new NotFoundError({
|
|
15124
|
+
message: `${resourceType} '${validatedName}' not found${folderHint}.`,
|
|
15125
|
+
});
|
|
15126
|
+
}
|
|
15127
|
+
return transform(items[0]);
|
|
15128
|
+
}
|
|
15129
|
+
}
|
|
15130
|
+
/** Renders the supplied folder for a NotFoundError message. */
|
|
15131
|
+
function describeFolderForError(folderId, folderKey, folderPath) {
|
|
15132
|
+
const path = folderPath?.trim();
|
|
15133
|
+
if (path)
|
|
15134
|
+
return ` in folder '${path}'`;
|
|
15135
|
+
const key = folderKey?.trim();
|
|
15136
|
+
if (key)
|
|
15137
|
+
return ` in folder (key: ${key})`;
|
|
15138
|
+
if (typeof folderId === 'number')
|
|
15139
|
+
return ` in folder (id: ${folderId})`;
|
|
15140
|
+
return '';
|
|
14932
15141
|
}
|
|
14933
15142
|
|
|
14934
15143
|
/**
|
|
@@ -15026,6 +15235,35 @@
|
|
|
15026
15235
|
const transformedAsset = transformData(pascalToCamelCaseKeys(response.data), AssetMap);
|
|
15027
15236
|
return transformedAsset;
|
|
15028
15237
|
}
|
|
15238
|
+
/**
|
|
15239
|
+
* Retrieves a single asset by name.
|
|
15240
|
+
*
|
|
15241
|
+
* @param name - Asset name to search for
|
|
15242
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
|
|
15243
|
+
* @returns Promise resolving to a single asset
|
|
15244
|
+
* {@link AssetGetResponse}
|
|
15245
|
+
* @example
|
|
15246
|
+
* ```typescript
|
|
15247
|
+
* import { Assets } from '@uipath/uipath-typescript/assets';
|
|
15248
|
+
*
|
|
15249
|
+
* const assets = new Assets(sdk);
|
|
15250
|
+
*
|
|
15251
|
+
* // By folder ID
|
|
15252
|
+
* await assets.getByName('ApiKey', { folderId: 123 });
|
|
15253
|
+
*
|
|
15254
|
+
* // By folder key (GUID)
|
|
15255
|
+
* await assets.getByName('ApiKey', { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
|
|
15256
|
+
*
|
|
15257
|
+
* // By folder path
|
|
15258
|
+
* await assets.getByName('ApiKey', { folderPath: 'Shared/Finance' });
|
|
15259
|
+
*
|
|
15260
|
+
* // With expand
|
|
15261
|
+
* await assets.getByName('ApiKey', { folderPath: 'Shared/Finance', expand: 'keyValueList' });
|
|
15262
|
+
* ```
|
|
15263
|
+
*/
|
|
15264
|
+
async getByName(name, options = {}) {
|
|
15265
|
+
return this.getByNameLookup('Asset', ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap));
|
|
15266
|
+
}
|
|
15029
15267
|
}
|
|
15030
15268
|
__decorate([
|
|
15031
15269
|
track('Assets.GetAll')
|
|
@@ -15033,6 +15271,9 @@
|
|
|
15033
15271
|
__decorate([
|
|
15034
15272
|
track('Assets.GetById')
|
|
15035
15273
|
], AssetService.prototype, "getById", null);
|
|
15274
|
+
__decorate([
|
|
15275
|
+
track('Assets.GetByName')
|
|
15276
|
+
], AssetService.prototype, "getByName", null);
|
|
15036
15277
|
|
|
15037
15278
|
/**
|
|
15038
15279
|
* Enum for Asset Value Scope
|
|
@@ -16136,7 +16377,7 @@
|
|
|
16136
16377
|
/**
|
|
16137
16378
|
* Service for interacting with UiPath Orchestrator Processes API
|
|
16138
16379
|
*/
|
|
16139
|
-
class ProcessService extends
|
|
16380
|
+
class ProcessService extends FolderScopedService {
|
|
16140
16381
|
/**
|
|
16141
16382
|
* Gets all processes across folders with optional filtering and folder scoping
|
|
16142
16383
|
*
|
|
@@ -16273,6 +16514,35 @@
|
|
|
16273
16514
|
const transformedProcess = transformData(pascalToCamelCaseKeys(response.data), ProcessMap);
|
|
16274
16515
|
return transformedProcess;
|
|
16275
16516
|
}
|
|
16517
|
+
/**
|
|
16518
|
+
* Retrieves a single process by name.
|
|
16519
|
+
*
|
|
16520
|
+
* @param name - Process name to search for
|
|
16521
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
|
|
16522
|
+
* @returns Promise resolving to a single process
|
|
16523
|
+
* {@link ProcessGetResponse}
|
|
16524
|
+
* @example
|
|
16525
|
+
* ```typescript
|
|
16526
|
+
* import { Processes } from '@uipath/uipath-typescript/processes';
|
|
16527
|
+
*
|
|
16528
|
+
* const processes = new Processes(sdk);
|
|
16529
|
+
*
|
|
16530
|
+
* // By folder ID
|
|
16531
|
+
* await processes.getByName('MyProcess', { folderId: 123 });
|
|
16532
|
+
*
|
|
16533
|
+
* // By folder key (GUID)
|
|
16534
|
+
* await processes.getByName('MyProcess', { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
|
|
16535
|
+
*
|
|
16536
|
+
* // By folder path
|
|
16537
|
+
* await processes.getByName('MyProcess', { folderPath: 'Shared/Finance' });
|
|
16538
|
+
*
|
|
16539
|
+
* // With expand
|
|
16540
|
+
* await processes.getByName('MyProcess', { folderPath: 'Shared/Finance', expand: 'entryPoints' });
|
|
16541
|
+
* ```
|
|
16542
|
+
*/
|
|
16543
|
+
async getByName(name, options = {}) {
|
|
16544
|
+
return this.getByNameLookup('Process', PROCESS_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), ProcessMap));
|
|
16545
|
+
}
|
|
16276
16546
|
}
|
|
16277
16547
|
__decorate([
|
|
16278
16548
|
track('Processes.GetAll')
|
|
@@ -16283,6 +16553,9 @@
|
|
|
16283
16553
|
__decorate([
|
|
16284
16554
|
track('Processes.GetById')
|
|
16285
16555
|
], ProcessService.prototype, "getById", null);
|
|
16556
|
+
__decorate([
|
|
16557
|
+
track('Processes.GetByName')
|
|
16558
|
+
], ProcessService.prototype, "getByName", null);
|
|
16286
16559
|
|
|
16287
16560
|
/**
|
|
16288
16561
|
* Maps fields for Queue entities to ensure consistent naming
|
|
@@ -16760,7 +17033,7 @@
|
|
|
16760
17033
|
};
|
|
16761
17034
|
|
|
16762
17035
|
/**
|
|
16763
|
-
* Constants for User Service
|
|
17036
|
+
* Constants for User Settings Service
|
|
16764
17037
|
*/
|
|
16765
17038
|
/**
|
|
16766
17039
|
* Maps fields for User Settings entities to ensure consistent SDK naming
|
package/dist/jobs/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';
|
|
@@ -1421,8 +1423,9 @@ class BaseService {
|
|
|
1421
1423
|
constructor(instance, headers) {
|
|
1422
1424
|
// Private field - not visible via Object.keys() or any reflection
|
|
1423
1425
|
_BaseService_apiClient.set(this, void 0);
|
|
1424
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
1426
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
1425
1427
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
1428
|
+
this.config = { folderKey };
|
|
1426
1429
|
}
|
|
1427
1430
|
/**
|
|
1428
1431
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -1619,6 +1622,111 @@ class BaseService {
|
|
|
1619
1622
|
}
|
|
1620
1623
|
_BaseService_apiClient = new WeakMap();
|
|
1621
1624
|
|
|
1625
|
+
/**
|
|
1626
|
+
* Validates the `name` argument passed to a `getByName(name, ...)` method.
|
|
1627
|
+
* Trims whitespace and rejects empty/whitespace-only names.
|
|
1628
|
+
*
|
|
1629
|
+
* @param resourceType - Resource label used in error messages (e.g. 'Asset', 'Process')
|
|
1630
|
+
* @param name - Resource name to validate
|
|
1631
|
+
* @returns The trimmed name
|
|
1632
|
+
* @throws ValidationError when `name` is missing or empty after trimming
|
|
1633
|
+
*/
|
|
1634
|
+
function validateName(resourceType, name) {
|
|
1635
|
+
if (!name) {
|
|
1636
|
+
throw new ValidationError({
|
|
1637
|
+
message: `${resourceType} name is required and cannot be empty.`,
|
|
1638
|
+
});
|
|
1639
|
+
}
|
|
1640
|
+
const trimmed = name.trim();
|
|
1641
|
+
if (!trimmed) {
|
|
1642
|
+
throw new ValidationError({
|
|
1643
|
+
message: `${resourceType} name is required and cannot be empty.`,
|
|
1644
|
+
});
|
|
1645
|
+
}
|
|
1646
|
+
return trimmed;
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
/**
|
|
1650
|
+
* Encodes a folder path for the `X-UIPATH-FolderPath-Encoded` header.
|
|
1651
|
+
*
|
|
1652
|
+
* Orchestrator decodes this header as **base64-encoded UTF-16 LE bytes**
|
|
1653
|
+
* (see `HttpHeadersProviderExtensions.GetDecoded` + `OrganizationUnitProvider`
|
|
1654
|
+
* in the Orchestrator repo, which call `Encoding.Unicode.GetString(...)`).
|
|
1655
|
+
* URL-encoding is NOT what the server expects — it must be base64-of-UTF-16-LE
|
|
1656
|
+
* bytes.
|
|
1657
|
+
*
|
|
1658
|
+
* @param folderPath - The folder path (e.g. 'Shared/Finance')
|
|
1659
|
+
* @returns Base64 string suitable for the `X-UIPATH-FolderPath-Encoded` header
|
|
1660
|
+
*/
|
|
1661
|
+
function encodeFolderPathHeader(folderPath) {
|
|
1662
|
+
// Force little-endian regardless of host byte order. `Uint16Array` viewed
|
|
1663
|
+
// as `Uint8Array` would use the host's native order — correct on LE hosts
|
|
1664
|
+
// (x86/ARM-LE) but wrong on BE hosts. `DataView.setUint16(..., true)`
|
|
1665
|
+
// pins LE.
|
|
1666
|
+
const buf = new ArrayBuffer(folderPath.length * 2);
|
|
1667
|
+
const view = new DataView(buf);
|
|
1668
|
+
for (let i = 0; i < folderPath.length; i++) {
|
|
1669
|
+
view.setUint16(i * 2, folderPath.charCodeAt(i), true);
|
|
1670
|
+
}
|
|
1671
|
+
const bytes = new Uint8Array(buf);
|
|
1672
|
+
let binary = '';
|
|
1673
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
1674
|
+
binary += String.fromCharCode(bytes[i]);
|
|
1675
|
+
}
|
|
1676
|
+
// btoa is browser-native; Node 16+ also has it as a global
|
|
1677
|
+
return btoa(binary);
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
/**
|
|
1681
|
+
* Resolves folder context into the appropriate Orchestrator folder headers.
|
|
1682
|
+
*
|
|
1683
|
+
* Centralized so all folder-scoped methods (e.g. `assets.getByName`,
|
|
1684
|
+
* `processes.getByName`, future Queues/Buckets/Jobs) share one implementation.
|
|
1685
|
+
*
|
|
1686
|
+
* Each input field maps directly to its header — no auto-detection or type
|
|
1687
|
+
* coercion. When multiple fields are supplied, all corresponding headers
|
|
1688
|
+
* are forwarded and the server resolves precedence.
|
|
1689
|
+
*
|
|
1690
|
+
* Routing:
|
|
1691
|
+
* - `folderId` → `X-UIPATH-OrganizationUnitId`
|
|
1692
|
+
* - `folderKey` → `X-UIPATH-FolderKey`
|
|
1693
|
+
* - `folderPath` → `X-UIPATH-FolderPath-Encoded`
|
|
1694
|
+
* - none set + `fallbackFolderKey` → fallback used as `X-UIPATH-FolderKey`
|
|
1695
|
+
* - none set + no fallback → `ValidationError`
|
|
1696
|
+
*
|
|
1697
|
+
* @throws ValidationError when no folder context can be resolved.
|
|
1698
|
+
*/
|
|
1699
|
+
function resolveFolderHeaders(input) {
|
|
1700
|
+
const { folderId, folderKey, folderPath, resourceType, fallbackFolderKey } = input;
|
|
1701
|
+
const trimmedKey = folderKey?.trim();
|
|
1702
|
+
const trimmedPath = folderPath?.trim();
|
|
1703
|
+
const headers = {};
|
|
1704
|
+
if (folderId !== undefined) {
|
|
1705
|
+
headers[FOLDER_ID] = folderId;
|
|
1706
|
+
}
|
|
1707
|
+
if (trimmedKey) {
|
|
1708
|
+
headers[FOLDER_KEY] = trimmedKey;
|
|
1709
|
+
}
|
|
1710
|
+
if (trimmedPath) {
|
|
1711
|
+
headers[FOLDER_PATH_ENCODED] = encodeFolderPathHeader(trimmedPath);
|
|
1712
|
+
}
|
|
1713
|
+
// No explicit folder context → meta-tag fallback or error.
|
|
1714
|
+
if (Object.keys(headers).length === 0) {
|
|
1715
|
+
if (!fallbackFolderKey) {
|
|
1716
|
+
throw new ValidationError({
|
|
1717
|
+
message: `${resourceType} requires folder context: pass \`folderId\`, \`folderKey\`, or \`folderPath\`, or initialize the SDK with a folder context.`,
|
|
1718
|
+
});
|
|
1719
|
+
}
|
|
1720
|
+
headers[FOLDER_KEY] = fallbackFolderKey;
|
|
1721
|
+
}
|
|
1722
|
+
return createHeaders(headers);
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
/**
|
|
1726
|
+
* Matches single-quote characters in OData string literals — escaped to `''`
|
|
1727
|
+
* inside the `$filter=Name eq '…'` clause built by `getByNameLookup`.
|
|
1728
|
+
*/
|
|
1729
|
+
const SINGLE_QUOTE_RE = /'/g;
|
|
1622
1730
|
/**
|
|
1623
1731
|
* Base service for services that need folder-specific functionality.
|
|
1624
1732
|
*
|
|
@@ -1652,6 +1760,68 @@ class FolderScopedService extends BaseService {
|
|
|
1652
1760
|
}
|
|
1653
1761
|
return response.data?.value;
|
|
1654
1762
|
}
|
|
1763
|
+
/**
|
|
1764
|
+
* Look up a single resource by name on a folder-scoped OData collection.
|
|
1765
|
+
*
|
|
1766
|
+
* Shared by `getByName` implementations across services (Assets, Processes, etc).
|
|
1767
|
+
* Handles:
|
|
1768
|
+
* - Name validation via `validateName`
|
|
1769
|
+
* - Folder header resolution via `resolveFolderHeaders` (folderId → ID/key
|
|
1770
|
+
* header by type, folderPath → encoded path header, falls back to
|
|
1771
|
+
* init-time `config.folderKey` from the `uipath:folder-key` meta tag)
|
|
1772
|
+
* - OData `$filter=Name eq '…'` with single-quote escaping + `$top=1`
|
|
1773
|
+
* - Empty-result → `NotFoundError` with folder context in the message
|
|
1774
|
+
*
|
|
1775
|
+
* The transform step is caller-provided because each resource has its own
|
|
1776
|
+
* PascalCase → camelCase field mapping.
|
|
1777
|
+
*
|
|
1778
|
+
* @param resourceType - Resource label used in validation + error messages (e.g. 'Asset', 'Process')
|
|
1779
|
+
* @param endpoint - Folder-scoped OData collection endpoint
|
|
1780
|
+
* @param name - Resource name to search for
|
|
1781
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) + OData query options (`expand`, `select`)
|
|
1782
|
+
* @param transform - Maps a raw OData item to the typed response (e.g. PascalCase → camelCase via field map)
|
|
1783
|
+
* @throws ValidationError when inputs are malformed; NotFoundError when no match
|
|
1784
|
+
*/
|
|
1785
|
+
async getByNameLookup(resourceType, endpoint, name, options, transform) {
|
|
1786
|
+
const validatedName = validateName(resourceType, name);
|
|
1787
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
1788
|
+
const headers = resolveFolderHeaders({
|
|
1789
|
+
folderId,
|
|
1790
|
+
folderKey,
|
|
1791
|
+
folderPath,
|
|
1792
|
+
resourceType: `${resourceType}.getByName`,
|
|
1793
|
+
fallbackFolderKey: this.config.folderKey,
|
|
1794
|
+
});
|
|
1795
|
+
const apiOptions = {
|
|
1796
|
+
...addPrefixToKeys(queryOptions, ODATA_PREFIX, Object.keys(queryOptions)),
|
|
1797
|
+
'$filter': `Name eq '${validatedName.replace(SINGLE_QUOTE_RE, "''")}'`,
|
|
1798
|
+
'$top': '1',
|
|
1799
|
+
};
|
|
1800
|
+
const response = await this.get(endpoint, {
|
|
1801
|
+
headers,
|
|
1802
|
+
params: apiOptions,
|
|
1803
|
+
});
|
|
1804
|
+
const items = response.data?.value;
|
|
1805
|
+
if (!items?.length) {
|
|
1806
|
+
const folderHint = describeFolderForError(folderId, folderKey, folderPath);
|
|
1807
|
+
throw new NotFoundError({
|
|
1808
|
+
message: `${resourceType} '${validatedName}' not found${folderHint}.`,
|
|
1809
|
+
});
|
|
1810
|
+
}
|
|
1811
|
+
return transform(items[0]);
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
/** Renders the supplied folder for a NotFoundError message. */
|
|
1815
|
+
function describeFolderForError(folderId, folderKey, folderPath) {
|
|
1816
|
+
const path = folderPath?.trim();
|
|
1817
|
+
if (path)
|
|
1818
|
+
return ` in folder '${path}'`;
|
|
1819
|
+
const key = folderKey?.trim();
|
|
1820
|
+
if (key)
|
|
1821
|
+
return ` in folder (key: ${key})`;
|
|
1822
|
+
if (typeof folderId === 'number')
|
|
1823
|
+
return ` in folder (id: ${folderId})`;
|
|
1824
|
+
return '';
|
|
1655
1825
|
}
|
|
1656
1826
|
|
|
1657
1827
|
/**
|
|
@@ -1753,7 +1923,7 @@ const JobMap = {
|
|
|
1753
1923
|
// Connection string placeholder that will be replaced during build
|
|
1754
1924
|
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";
|
|
1755
1925
|
// SDK Version placeholder
|
|
1756
|
-
const SDK_VERSION = "1.3.
|
|
1926
|
+
const SDK_VERSION = "1.3.7";
|
|
1757
1927
|
const VERSION = "Version";
|
|
1758
1928
|
const SERVICE = "Service";
|
|
1759
1929
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|