@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.cjs
CHANGED
|
@@ -5464,7 +5464,7 @@ function normalizeBaseUrl(url) {
|
|
|
5464
5464
|
// Connection string placeholder that will be replaced during build
|
|
5465
5465
|
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";
|
|
5466
5466
|
// SDK Version placeholder
|
|
5467
|
-
const SDK_VERSION = "1.3.
|
|
5467
|
+
const SDK_VERSION = "1.3.7";
|
|
5468
5468
|
const VERSION = "Version";
|
|
5469
5469
|
const SERVICE = "Service";
|
|
5470
5470
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -5811,6 +5811,8 @@ exports.UiPathMetaTags = void 0;
|
|
|
5811
5811
|
// Asset resolution and routing
|
|
5812
5812
|
UiPathMetaTags["CDN_BASE"] = "uipath:cdn-base";
|
|
5813
5813
|
UiPathMetaTags["APP_BASE"] = "uipath:app-base";
|
|
5814
|
+
// Folder context (injected during coded-app deployment)
|
|
5815
|
+
UiPathMetaTags["FOLDER_KEY"] = "uipath:folder-key";
|
|
5814
5816
|
})(exports.UiPathMetaTags || (exports.UiPathMetaTags = {}));
|
|
5815
5817
|
|
|
5816
5818
|
/**
|
|
@@ -5839,12 +5841,13 @@ function loadFromMetaTags() {
|
|
|
5839
5841
|
tenantName: getMetaTagContent(exports.UiPathMetaTags.TENANT_NAME),
|
|
5840
5842
|
baseUrl: getMetaTagContent(exports.UiPathMetaTags.BASE_URL),
|
|
5841
5843
|
redirectUri: getMetaTagContent(exports.UiPathMetaTags.REDIRECT_URI),
|
|
5844
|
+
folderKey: getMetaTagContent(exports.UiPathMetaTags.FOLDER_KEY),
|
|
5842
5845
|
};
|
|
5843
5846
|
const hasAnyValue = Object.values(config).some(Boolean);
|
|
5844
5847
|
return hasAnyValue ? config : null;
|
|
5845
5848
|
}
|
|
5846
5849
|
|
|
5847
|
-
var _UiPath_instances, _UiPath_config, _UiPath_authService, _UiPath_initialized, _UiPath_partialConfig, _UiPath_multiLogin, _UiPath_initializeWithConfig, _UiPath_loadConfig;
|
|
5850
|
+
var _UiPath_instances, _UiPath_config, _UiPath_authService, _UiPath_initialized, _UiPath_partialConfig, _UiPath_multiLogin, _UiPath_metaFolderKey, _UiPath_initializeWithConfig, _UiPath_loadConfig;
|
|
5848
5851
|
/**
|
|
5849
5852
|
* UiPath - Core SDK class for authentication and configuration management.
|
|
5850
5853
|
*
|
|
@@ -5885,8 +5888,13 @@ let UiPath$1 = class UiPath {
|
|
|
5885
5888
|
_UiPath_initialized.set(this, false);
|
|
5886
5889
|
_UiPath_partialConfig.set(this, void 0);
|
|
5887
5890
|
_UiPath_multiLogin.set(this, false);
|
|
5891
|
+
// Folder key sourced only from `<meta name="uipath:folder-key">` (coded-app
|
|
5892
|
+
// deployments). Not accepted via the public constructor; lives here so the
|
|
5893
|
+
// SDK can flow it through to BaseService.config without polluting BaseConfig.
|
|
5894
|
+
_UiPath_metaFolderKey.set(this, void 0);
|
|
5888
5895
|
// Load configuration from meta tags
|
|
5889
5896
|
const configFromMetaTags = loadFromMetaTags();
|
|
5897
|
+
__classPrivateFieldSet(this, _UiPath_metaFolderKey, configFromMetaTags?.folderKey, "f");
|
|
5890
5898
|
// Merge configuration: constructor config overrides meta tags
|
|
5891
5899
|
const mergedConfig = config ? { ...configFromMetaTags, ...config } : configFromMetaTags;
|
|
5892
5900
|
if (mergedConfig && isCompleteConfig(mergedConfig)) {
|
|
@@ -6015,7 +6023,7 @@ let UiPath$1 = class UiPath {
|
|
|
6015
6023
|
__classPrivateFieldGet(this, _UiPath_authService, "f")?.updateToken(tokenInfo);
|
|
6016
6024
|
}
|
|
6017
6025
|
};
|
|
6018
|
-
_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) {
|
|
6026
|
+
_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) {
|
|
6019
6027
|
// Validate and normalize the configuration
|
|
6020
6028
|
validateConfig(config);
|
|
6021
6029
|
const hasSecretAuth = hasSecretConfig(config);
|
|
@@ -6028,7 +6036,7 @@ _UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_ini
|
|
|
6028
6036
|
secret: hasSecretAuth ? config.secret : undefined,
|
|
6029
6037
|
clientId: hasOAuthAuth ? config.clientId : undefined,
|
|
6030
6038
|
redirectUri: hasOAuthAuth ? config.redirectUri : undefined,
|
|
6031
|
-
scope: hasOAuthAuth ? config.scope : undefined
|
|
6039
|
+
scope: hasOAuthAuth ? config.scope : undefined,
|
|
6032
6040
|
});
|
|
6033
6041
|
const executionContext = new ExecutionContext();
|
|
6034
6042
|
__classPrivateFieldSet(this, _UiPath_authService, new AuthService(internalConfig, executionContext), "f");
|
|
@@ -6036,11 +6044,14 @@ _UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_ini
|
|
|
6036
6044
|
__classPrivateFieldGet(this, _UiPath_authService, "f").setMultiLogin();
|
|
6037
6045
|
}
|
|
6038
6046
|
__classPrivateFieldSet(this, _UiPath_config, internalConfig, "f");
|
|
6039
|
-
// Store internals in SDKInternalsRegistry (not visible on instance)
|
|
6047
|
+
// Store internals in SDKInternalsRegistry (not visible on instance).
|
|
6048
|
+
// `folderKey` is meta-tag-only — kept off `UiPathConfig` (which mirrors
|
|
6049
|
+
// user-passed values) and lives here on the runtime registry instead.
|
|
6040
6050
|
SDKInternalsRegistry.set(this, {
|
|
6041
6051
|
config: internalConfig,
|
|
6042
6052
|
context: executionContext,
|
|
6043
|
-
tokenManager: __classPrivateFieldGet(this, _UiPath_authService, "f").getTokenManager()
|
|
6053
|
+
tokenManager: __classPrivateFieldGet(this, _UiPath_authService, "f").getTokenManager(),
|
|
6054
|
+
folderKey: __classPrivateFieldGet(this, _UiPath_metaFolderKey, "f"),
|
|
6044
6055
|
});
|
|
6045
6056
|
// Expose read-only config for user convenience
|
|
6046
6057
|
this.config = {
|
|
@@ -6068,6 +6079,7 @@ _UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_ini
|
|
|
6068
6079
|
}, _UiPath_loadConfig = function _UiPath_loadConfig() {
|
|
6069
6080
|
// Load from meta tags
|
|
6070
6081
|
const metaConfig = loadFromMetaTags();
|
|
6082
|
+
__classPrivateFieldSet(this, _UiPath_metaFolderKey, metaConfig?.folderKey, "f");
|
|
6071
6083
|
// Merge with any partial config from constructor (constructor overrides meta tags)
|
|
6072
6084
|
const merged = { ...metaConfig, ...__classPrivateFieldGet(this, _UiPath_partialConfig, "f") };
|
|
6073
6085
|
if (!isCompleteConfig(merged)) {
|
|
@@ -6311,6 +6323,7 @@ class ErrorFactory {
|
|
|
6311
6323
|
}
|
|
6312
6324
|
|
|
6313
6325
|
const FOLDER_KEY = 'X-UIPATH-FolderKey';
|
|
6326
|
+
const FOLDER_PATH_ENCODED = 'X-UIPATH-FolderPath-Encoded';
|
|
6314
6327
|
const FOLDER_ID = 'X-UIPATH-OrganizationUnitId';
|
|
6315
6328
|
const TRACEPARENT = 'traceparent';
|
|
6316
6329
|
const UIPATH_TRACEPARENT_ID = 'x-uipath-traceparent-id';
|
|
@@ -7443,8 +7456,9 @@ class BaseService {
|
|
|
7443
7456
|
constructor(instance, headers) {
|
|
7444
7457
|
// Private field - not visible via Object.keys() or any reflection
|
|
7445
7458
|
_BaseService_apiClient.set(this, void 0);
|
|
7446
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
7459
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
7447
7460
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
7461
|
+
this.config = { folderKey };
|
|
7448
7462
|
}
|
|
7449
7463
|
/**
|
|
7450
7464
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -7806,6 +7820,17 @@ exports.QueryFilterOperator = void 0;
|
|
|
7806
7820
|
QueryFilterOperator["In"] = "in";
|
|
7807
7821
|
QueryFilterOperator["NotIn"] = "not in";
|
|
7808
7822
|
})(exports.QueryFilterOperator || (exports.QueryFilterOperator = {}));
|
|
7823
|
+
/**
|
|
7824
|
+
* Aggregate functions supported by the Data Fabric query API.
|
|
7825
|
+
*/
|
|
7826
|
+
exports.EntityAggregateFunction = void 0;
|
|
7827
|
+
(function (EntityAggregateFunction) {
|
|
7828
|
+
EntityAggregateFunction["Count"] = "COUNT";
|
|
7829
|
+
EntityAggregateFunction["Sum"] = "SUM";
|
|
7830
|
+
EntityAggregateFunction["Avg"] = "AVG";
|
|
7831
|
+
EntityAggregateFunction["Min"] = "MIN";
|
|
7832
|
+
EntityAggregateFunction["Max"] = "MAX";
|
|
7833
|
+
})(exports.EntityAggregateFunction || (exports.EntityAggregateFunction = {}));
|
|
7809
7834
|
/**
|
|
7810
7835
|
* Entity type enum
|
|
7811
7836
|
*/
|
|
@@ -8395,16 +8420,16 @@ class EntityService extends BaseService {
|
|
|
8395
8420
|
return entities;
|
|
8396
8421
|
}
|
|
8397
8422
|
/**
|
|
8398
|
-
* Queries entity records with filters, sorting, and pagination
|
|
8423
|
+
* Queries entity records with filters, sorting, aggregates, and pagination
|
|
8399
8424
|
*
|
|
8400
8425
|
* @param id - UUID of the entity
|
|
8401
|
-
* @param options - Query options including filterGroup, selectedFields, sortOptions, and pagination
|
|
8426
|
+
* @param options - Query options including filterGroup, selectedFields, sortOptions, aggregates, groupBy, and pagination
|
|
8402
8427
|
* @returns Promise resolving to {@link NonPaginatedResponse} without pagination options,
|
|
8403
8428
|
* or {@link PaginatedResponse} when `pageSize`, `cursor`, or `jumpToPage` are provided
|
|
8404
8429
|
*
|
|
8405
8430
|
* @example
|
|
8406
8431
|
* ```typescript
|
|
8407
|
-
* import { Entities, LogicalOperator, QueryFilterOperator } from '@uipath/uipath-typescript/entities';
|
|
8432
|
+
* import { Entities, LogicalOperator, QueryFilterOperator, EntityAggregateFunction } from '@uipath/uipath-typescript/entities';
|
|
8408
8433
|
*
|
|
8409
8434
|
* const entities = new Entities(sdk);
|
|
8410
8435
|
*
|
|
@@ -8428,6 +8453,23 @@ class EntityService extends BaseService {
|
|
|
8428
8453
|
* if (page1.hasNextPage) {
|
|
8429
8454
|
* const page2 = await entities.queryRecordsById("<entityId>", { cursor: page1.nextCursor });
|
|
8430
8455
|
* }
|
|
8456
|
+
*
|
|
8457
|
+
* // Aggregate: count of records per status
|
|
8458
|
+
* await entities.queryRecordsById("<entityId>", {
|
|
8459
|
+
* selectedFields: ["status"],
|
|
8460
|
+
* groupBy: ["status"],
|
|
8461
|
+
* aggregates: [
|
|
8462
|
+
* { function: EntityAggregateFunction.Count, field: "Id", alias: "total" },
|
|
8463
|
+
* ],
|
|
8464
|
+
* });
|
|
8465
|
+
*
|
|
8466
|
+
* // Aggregate: total sum and average across all records (no grouping)
|
|
8467
|
+
* await entities.queryRecordsById("<entityId>", {
|
|
8468
|
+
* aggregates: [
|
|
8469
|
+
* { function: EntityAggregateFunction.Sum, field: "amount", alias: "totalAmount" },
|
|
8470
|
+
* { function: EntityAggregateFunction.Avg, field: "amount", alias: "avgAmount" },
|
|
8471
|
+
* ],
|
|
8472
|
+
* });
|
|
8431
8473
|
* ```
|
|
8432
8474
|
*/
|
|
8433
8475
|
async queryRecordsById(id, options) {
|
|
@@ -8445,7 +8487,7 @@ class EntityService extends BaseService {
|
|
|
8445
8487
|
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
8446
8488
|
}
|
|
8447
8489
|
},
|
|
8448
|
-
excludeFromPrefix: ['expansionLevel', 'filterGroup', 'selectedFields', 'sortOptions']
|
|
8490
|
+
excludeFromPrefix: ['expansionLevel', 'filterGroup', 'selectedFields', 'sortOptions', 'aggregates', 'groupBy']
|
|
8449
8491
|
}, options);
|
|
8450
8492
|
}
|
|
8451
8493
|
/**
|
|
@@ -11139,6 +11181,111 @@ __decorate([
|
|
|
11139
11181
|
track('CaseInstances.GetActionTasks')
|
|
11140
11182
|
], CaseInstancesService.prototype, "getActionTasks", null);
|
|
11141
11183
|
|
|
11184
|
+
/**
|
|
11185
|
+
* Validates the `name` argument passed to a `getByName(name, ...)` method.
|
|
11186
|
+
* Trims whitespace and rejects empty/whitespace-only names.
|
|
11187
|
+
*
|
|
11188
|
+
* @param resourceType - Resource label used in error messages (e.g. 'Asset', 'Process')
|
|
11189
|
+
* @param name - Resource name to validate
|
|
11190
|
+
* @returns The trimmed name
|
|
11191
|
+
* @throws ValidationError when `name` is missing or empty after trimming
|
|
11192
|
+
*/
|
|
11193
|
+
function validateName(resourceType, name) {
|
|
11194
|
+
if (!name) {
|
|
11195
|
+
throw new ValidationError({
|
|
11196
|
+
message: `${resourceType} name is required and cannot be empty.`,
|
|
11197
|
+
});
|
|
11198
|
+
}
|
|
11199
|
+
const trimmed = name.trim();
|
|
11200
|
+
if (!trimmed) {
|
|
11201
|
+
throw new ValidationError({
|
|
11202
|
+
message: `${resourceType} name is required and cannot be empty.`,
|
|
11203
|
+
});
|
|
11204
|
+
}
|
|
11205
|
+
return trimmed;
|
|
11206
|
+
}
|
|
11207
|
+
|
|
11208
|
+
/**
|
|
11209
|
+
* Encodes a folder path for the `X-UIPATH-FolderPath-Encoded` header.
|
|
11210
|
+
*
|
|
11211
|
+
* Orchestrator decodes this header as **base64-encoded UTF-16 LE bytes**
|
|
11212
|
+
* (see `HttpHeadersProviderExtensions.GetDecoded` + `OrganizationUnitProvider`
|
|
11213
|
+
* in the Orchestrator repo, which call `Encoding.Unicode.GetString(...)`).
|
|
11214
|
+
* URL-encoding is NOT what the server expects — it must be base64-of-UTF-16-LE
|
|
11215
|
+
* bytes.
|
|
11216
|
+
*
|
|
11217
|
+
* @param folderPath - The folder path (e.g. 'Shared/Finance')
|
|
11218
|
+
* @returns Base64 string suitable for the `X-UIPATH-FolderPath-Encoded` header
|
|
11219
|
+
*/
|
|
11220
|
+
function encodeFolderPathHeader(folderPath) {
|
|
11221
|
+
// Force little-endian regardless of host byte order. `Uint16Array` viewed
|
|
11222
|
+
// as `Uint8Array` would use the host's native order — correct on LE hosts
|
|
11223
|
+
// (x86/ARM-LE) but wrong on BE hosts. `DataView.setUint16(..., true)`
|
|
11224
|
+
// pins LE.
|
|
11225
|
+
const buf = new ArrayBuffer(folderPath.length * 2);
|
|
11226
|
+
const view = new DataView(buf);
|
|
11227
|
+
for (let i = 0; i < folderPath.length; i++) {
|
|
11228
|
+
view.setUint16(i * 2, folderPath.charCodeAt(i), true);
|
|
11229
|
+
}
|
|
11230
|
+
const bytes = new Uint8Array(buf);
|
|
11231
|
+
let binary = '';
|
|
11232
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
11233
|
+
binary += String.fromCharCode(bytes[i]);
|
|
11234
|
+
}
|
|
11235
|
+
// btoa is browser-native; Node 16+ also has it as a global
|
|
11236
|
+
return btoa(binary);
|
|
11237
|
+
}
|
|
11238
|
+
|
|
11239
|
+
/**
|
|
11240
|
+
* Resolves folder context into the appropriate Orchestrator folder headers.
|
|
11241
|
+
*
|
|
11242
|
+
* Centralized so all folder-scoped methods (e.g. `assets.getByName`,
|
|
11243
|
+
* `processes.getByName`, future Queues/Buckets/Jobs) share one implementation.
|
|
11244
|
+
*
|
|
11245
|
+
* Each input field maps directly to its header — no auto-detection or type
|
|
11246
|
+
* coercion. When multiple fields are supplied, all corresponding headers
|
|
11247
|
+
* are forwarded and the server resolves precedence.
|
|
11248
|
+
*
|
|
11249
|
+
* Routing:
|
|
11250
|
+
* - `folderId` → `X-UIPATH-OrganizationUnitId`
|
|
11251
|
+
* - `folderKey` → `X-UIPATH-FolderKey`
|
|
11252
|
+
* - `folderPath` → `X-UIPATH-FolderPath-Encoded`
|
|
11253
|
+
* - none set + `fallbackFolderKey` → fallback used as `X-UIPATH-FolderKey`
|
|
11254
|
+
* - none set + no fallback → `ValidationError`
|
|
11255
|
+
*
|
|
11256
|
+
* @throws ValidationError when no folder context can be resolved.
|
|
11257
|
+
*/
|
|
11258
|
+
function resolveFolderHeaders(input) {
|
|
11259
|
+
const { folderId, folderKey, folderPath, resourceType, fallbackFolderKey } = input;
|
|
11260
|
+
const trimmedKey = folderKey?.trim();
|
|
11261
|
+
const trimmedPath = folderPath?.trim();
|
|
11262
|
+
const headers = {};
|
|
11263
|
+
if (folderId !== undefined) {
|
|
11264
|
+
headers[FOLDER_ID] = folderId;
|
|
11265
|
+
}
|
|
11266
|
+
if (trimmedKey) {
|
|
11267
|
+
headers[FOLDER_KEY] = trimmedKey;
|
|
11268
|
+
}
|
|
11269
|
+
if (trimmedPath) {
|
|
11270
|
+
headers[FOLDER_PATH_ENCODED] = encodeFolderPathHeader(trimmedPath);
|
|
11271
|
+
}
|
|
11272
|
+
// No explicit folder context → meta-tag fallback or error.
|
|
11273
|
+
if (Object.keys(headers).length === 0) {
|
|
11274
|
+
if (!fallbackFolderKey) {
|
|
11275
|
+
throw new ValidationError({
|
|
11276
|
+
message: `${resourceType} requires folder context: pass \`folderId\`, \`folderKey\`, or \`folderPath\`, or initialize the SDK with a folder context.`,
|
|
11277
|
+
});
|
|
11278
|
+
}
|
|
11279
|
+
headers[FOLDER_KEY] = fallbackFolderKey;
|
|
11280
|
+
}
|
|
11281
|
+
return createHeaders(headers);
|
|
11282
|
+
}
|
|
11283
|
+
|
|
11284
|
+
/**
|
|
11285
|
+
* Matches single-quote characters in OData string literals — escaped to `''`
|
|
11286
|
+
* inside the `$filter=Name eq '…'` clause built by `getByNameLookup`.
|
|
11287
|
+
*/
|
|
11288
|
+
const SINGLE_QUOTE_RE = /'/g;
|
|
11142
11289
|
/**
|
|
11143
11290
|
* Base service for services that need folder-specific functionality.
|
|
11144
11291
|
*
|
|
@@ -11172,6 +11319,68 @@ class FolderScopedService extends BaseService {
|
|
|
11172
11319
|
}
|
|
11173
11320
|
return response.data?.value;
|
|
11174
11321
|
}
|
|
11322
|
+
/**
|
|
11323
|
+
* Look up a single resource by name on a folder-scoped OData collection.
|
|
11324
|
+
*
|
|
11325
|
+
* Shared by `getByName` implementations across services (Assets, Processes, etc).
|
|
11326
|
+
* Handles:
|
|
11327
|
+
* - Name validation via `validateName`
|
|
11328
|
+
* - Folder header resolution via `resolveFolderHeaders` (folderId → ID/key
|
|
11329
|
+
* header by type, folderPath → encoded path header, falls back to
|
|
11330
|
+
* init-time `config.folderKey` from the `uipath:folder-key` meta tag)
|
|
11331
|
+
* - OData `$filter=Name eq '…'` with single-quote escaping + `$top=1`
|
|
11332
|
+
* - Empty-result → `NotFoundError` with folder context in the message
|
|
11333
|
+
*
|
|
11334
|
+
* The transform step is caller-provided because each resource has its own
|
|
11335
|
+
* PascalCase → camelCase field mapping.
|
|
11336
|
+
*
|
|
11337
|
+
* @param resourceType - Resource label used in validation + error messages (e.g. 'Asset', 'Process')
|
|
11338
|
+
* @param endpoint - Folder-scoped OData collection endpoint
|
|
11339
|
+
* @param name - Resource name to search for
|
|
11340
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) + OData query options (`expand`, `select`)
|
|
11341
|
+
* @param transform - Maps a raw OData item to the typed response (e.g. PascalCase → camelCase via field map)
|
|
11342
|
+
* @throws ValidationError when inputs are malformed; NotFoundError when no match
|
|
11343
|
+
*/
|
|
11344
|
+
async getByNameLookup(resourceType, endpoint, name, options, transform) {
|
|
11345
|
+
const validatedName = validateName(resourceType, name);
|
|
11346
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
11347
|
+
const headers = resolveFolderHeaders({
|
|
11348
|
+
folderId,
|
|
11349
|
+
folderKey,
|
|
11350
|
+
folderPath,
|
|
11351
|
+
resourceType: `${resourceType}.getByName`,
|
|
11352
|
+
fallbackFolderKey: this.config.folderKey,
|
|
11353
|
+
});
|
|
11354
|
+
const apiOptions = {
|
|
11355
|
+
...addPrefixToKeys(queryOptions, ODATA_PREFIX, Object.keys(queryOptions)),
|
|
11356
|
+
'$filter': `Name eq '${validatedName.replace(SINGLE_QUOTE_RE, "''")}'`,
|
|
11357
|
+
'$top': '1',
|
|
11358
|
+
};
|
|
11359
|
+
const response = await this.get(endpoint, {
|
|
11360
|
+
headers,
|
|
11361
|
+
params: apiOptions,
|
|
11362
|
+
});
|
|
11363
|
+
const items = response.data?.value;
|
|
11364
|
+
if (!items?.length) {
|
|
11365
|
+
const folderHint = describeFolderForError(folderId, folderKey, folderPath);
|
|
11366
|
+
throw new NotFoundError({
|
|
11367
|
+
message: `${resourceType} '${validatedName}' not found${folderHint}.`,
|
|
11368
|
+
});
|
|
11369
|
+
}
|
|
11370
|
+
return transform(items[0]);
|
|
11371
|
+
}
|
|
11372
|
+
}
|
|
11373
|
+
/** Renders the supplied folder for a NotFoundError message. */
|
|
11374
|
+
function describeFolderForError(folderId, folderKey, folderPath) {
|
|
11375
|
+
const path = folderPath?.trim();
|
|
11376
|
+
if (path)
|
|
11377
|
+
return ` in folder '${path}'`;
|
|
11378
|
+
const key = folderKey?.trim();
|
|
11379
|
+
if (key)
|
|
11380
|
+
return ` in folder (key: ${key})`;
|
|
11381
|
+
if (typeof folderId === 'number')
|
|
11382
|
+
return ` in folder (id: ${folderId})`;
|
|
11383
|
+
return '';
|
|
11175
11384
|
}
|
|
11176
11385
|
|
|
11177
11386
|
/**
|
|
@@ -11269,6 +11478,35 @@ class AssetService extends FolderScopedService {
|
|
|
11269
11478
|
const transformedAsset = transformData(pascalToCamelCaseKeys(response.data), AssetMap);
|
|
11270
11479
|
return transformedAsset;
|
|
11271
11480
|
}
|
|
11481
|
+
/**
|
|
11482
|
+
* Retrieves a single asset by name.
|
|
11483
|
+
*
|
|
11484
|
+
* @param name - Asset name to search for
|
|
11485
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
|
|
11486
|
+
* @returns Promise resolving to a single asset
|
|
11487
|
+
* {@link AssetGetResponse}
|
|
11488
|
+
* @example
|
|
11489
|
+
* ```typescript
|
|
11490
|
+
* import { Assets } from '@uipath/uipath-typescript/assets';
|
|
11491
|
+
*
|
|
11492
|
+
* const assets = new Assets(sdk);
|
|
11493
|
+
*
|
|
11494
|
+
* // By folder ID
|
|
11495
|
+
* await assets.getByName('ApiKey', { folderId: 123 });
|
|
11496
|
+
*
|
|
11497
|
+
* // By folder key (GUID)
|
|
11498
|
+
* await assets.getByName('ApiKey', { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
|
|
11499
|
+
*
|
|
11500
|
+
* // By folder path
|
|
11501
|
+
* await assets.getByName('ApiKey', { folderPath: 'Shared/Finance' });
|
|
11502
|
+
*
|
|
11503
|
+
* // With expand
|
|
11504
|
+
* await assets.getByName('ApiKey', { folderPath: 'Shared/Finance', expand: 'keyValueList' });
|
|
11505
|
+
* ```
|
|
11506
|
+
*/
|
|
11507
|
+
async getByName(name, options = {}) {
|
|
11508
|
+
return this.getByNameLookup('Asset', ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap));
|
|
11509
|
+
}
|
|
11272
11510
|
}
|
|
11273
11511
|
__decorate([
|
|
11274
11512
|
track('Assets.GetAll')
|
|
@@ -11276,6 +11514,9 @@ __decorate([
|
|
|
11276
11514
|
__decorate([
|
|
11277
11515
|
track('Assets.GetById')
|
|
11278
11516
|
], AssetService.prototype, "getById", null);
|
|
11517
|
+
__decorate([
|
|
11518
|
+
track('Assets.GetByName')
|
|
11519
|
+
], AssetService.prototype, "getByName", null);
|
|
11279
11520
|
|
|
11280
11521
|
/**
|
|
11281
11522
|
* Enum for Asset Value Scope
|
|
@@ -12379,7 +12620,7 @@ const ProcessMap = {
|
|
|
12379
12620
|
/**
|
|
12380
12621
|
* Service for interacting with UiPath Orchestrator Processes API
|
|
12381
12622
|
*/
|
|
12382
|
-
class ProcessService extends
|
|
12623
|
+
class ProcessService extends FolderScopedService {
|
|
12383
12624
|
/**
|
|
12384
12625
|
* Gets all processes across folders with optional filtering and folder scoping
|
|
12385
12626
|
*
|
|
@@ -12516,6 +12757,35 @@ class ProcessService extends BaseService {
|
|
|
12516
12757
|
const transformedProcess = transformData(pascalToCamelCaseKeys(response.data), ProcessMap);
|
|
12517
12758
|
return transformedProcess;
|
|
12518
12759
|
}
|
|
12760
|
+
/**
|
|
12761
|
+
* Retrieves a single process by name.
|
|
12762
|
+
*
|
|
12763
|
+
* @param name - Process name to search for
|
|
12764
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
|
|
12765
|
+
* @returns Promise resolving to a single process
|
|
12766
|
+
* {@link ProcessGetResponse}
|
|
12767
|
+
* @example
|
|
12768
|
+
* ```typescript
|
|
12769
|
+
* import { Processes } from '@uipath/uipath-typescript/processes';
|
|
12770
|
+
*
|
|
12771
|
+
* const processes = new Processes(sdk);
|
|
12772
|
+
*
|
|
12773
|
+
* // By folder ID
|
|
12774
|
+
* await processes.getByName('MyProcess', { folderId: 123 });
|
|
12775
|
+
*
|
|
12776
|
+
* // By folder key (GUID)
|
|
12777
|
+
* await processes.getByName('MyProcess', { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
|
|
12778
|
+
*
|
|
12779
|
+
* // By folder path
|
|
12780
|
+
* await processes.getByName('MyProcess', { folderPath: 'Shared/Finance' });
|
|
12781
|
+
*
|
|
12782
|
+
* // With expand
|
|
12783
|
+
* await processes.getByName('MyProcess', { folderPath: 'Shared/Finance', expand: 'entryPoints' });
|
|
12784
|
+
* ```
|
|
12785
|
+
*/
|
|
12786
|
+
async getByName(name, options = {}) {
|
|
12787
|
+
return this.getByNameLookup('Process', PROCESS_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), ProcessMap));
|
|
12788
|
+
}
|
|
12519
12789
|
}
|
|
12520
12790
|
__decorate([
|
|
12521
12791
|
track('Processes.GetAll')
|
|
@@ -12526,6 +12796,9 @@ __decorate([
|
|
|
12526
12796
|
__decorate([
|
|
12527
12797
|
track('Processes.GetById')
|
|
12528
12798
|
], ProcessService.prototype, "getById", null);
|
|
12799
|
+
__decorate([
|
|
12800
|
+
track('Processes.GetByName')
|
|
12801
|
+
], ProcessService.prototype, "getByName", null);
|
|
12529
12802
|
|
|
12530
12803
|
/**
|
|
12531
12804
|
* Maps fields for Queue entities to ensure consistent naming
|
|
@@ -13003,7 +13276,7 @@ const AgentMap = {
|
|
|
13003
13276
|
};
|
|
13004
13277
|
|
|
13005
13278
|
/**
|
|
13006
|
-
* Constants for User Service
|
|
13279
|
+
* Constants for User Settings Service
|
|
13007
13280
|
*/
|
|
13008
13281
|
/**
|
|
13009
13282
|
* Maps fields for User Settings entities to ensure consistent SDK naming
|