@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/index.cjs
CHANGED
|
@@ -5026,6 +5026,7 @@ class TokenManager {
|
|
|
5026
5026
|
const GUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
5027
5027
|
class AuthService {
|
|
5028
5028
|
constructor(config, executionContext) {
|
|
5029
|
+
this.skipAcrValues = false;
|
|
5029
5030
|
// Only use stored OAuth context when completing an active callback (URL has ?code=).
|
|
5030
5031
|
// If stored context exists but we're NOT in a callback, it's stale from a
|
|
5031
5032
|
// failed/abandoned flow (e.g. scope mismatch, invalid redirect URI) and must
|
|
@@ -5117,6 +5118,14 @@ class AuthService {
|
|
|
5117
5118
|
getTokenManager() {
|
|
5118
5119
|
return this.tokenManager;
|
|
5119
5120
|
}
|
|
5121
|
+
/**
|
|
5122
|
+
* Enables the UiPath login picker during OAuth sign-in.
|
|
5123
|
+
*
|
|
5124
|
+
* @internal
|
|
5125
|
+
*/
|
|
5126
|
+
setMultiLogin() {
|
|
5127
|
+
this.skipAcrValues = true;
|
|
5128
|
+
}
|
|
5120
5129
|
/**
|
|
5121
5130
|
* Authenticates the user based on the provided SDK configuration.
|
|
5122
5131
|
* This method handles OAuth 2.0 authentication flow only.
|
|
@@ -5318,7 +5327,10 @@ class AuthService {
|
|
|
5318
5327
|
scope: params.scope + ' offline_access',
|
|
5319
5328
|
state: params.state || this.generateCodeVerifier().slice(0, 16)
|
|
5320
5329
|
});
|
|
5321
|
-
|
|
5330
|
+
const authorizeUrl = `${this.config.baseUrl}/${IDENTITY_ENDPOINTS.AUTHORIZE}?${queryParams.toString()}`;
|
|
5331
|
+
return this.skipAcrValues
|
|
5332
|
+
? authorizeUrl
|
|
5333
|
+
: `${authorizeUrl}&acr_values=${acrValues}`;
|
|
5322
5334
|
}
|
|
5323
5335
|
/**
|
|
5324
5336
|
* Exchanges the authorization code for an access token and automatically updates the current token
|
|
@@ -5452,7 +5464,7 @@ function normalizeBaseUrl(url) {
|
|
|
5452
5464
|
// Connection string placeholder that will be replaced during build
|
|
5453
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";
|
|
5454
5466
|
// SDK Version placeholder
|
|
5455
|
-
const SDK_VERSION = "1.3.
|
|
5467
|
+
const SDK_VERSION = "1.3.7";
|
|
5456
5468
|
const VERSION = "Version";
|
|
5457
5469
|
const SERVICE = "Service";
|
|
5458
5470
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -5799,6 +5811,8 @@ exports.UiPathMetaTags = void 0;
|
|
|
5799
5811
|
// Asset resolution and routing
|
|
5800
5812
|
UiPathMetaTags["CDN_BASE"] = "uipath:cdn-base";
|
|
5801
5813
|
UiPathMetaTags["APP_BASE"] = "uipath:app-base";
|
|
5814
|
+
// Folder context (injected during coded-app deployment)
|
|
5815
|
+
UiPathMetaTags["FOLDER_KEY"] = "uipath:folder-key";
|
|
5802
5816
|
})(exports.UiPathMetaTags || (exports.UiPathMetaTags = {}));
|
|
5803
5817
|
|
|
5804
5818
|
/**
|
|
@@ -5827,12 +5841,13 @@ function loadFromMetaTags() {
|
|
|
5827
5841
|
tenantName: getMetaTagContent(exports.UiPathMetaTags.TENANT_NAME),
|
|
5828
5842
|
baseUrl: getMetaTagContent(exports.UiPathMetaTags.BASE_URL),
|
|
5829
5843
|
redirectUri: getMetaTagContent(exports.UiPathMetaTags.REDIRECT_URI),
|
|
5844
|
+
folderKey: getMetaTagContent(exports.UiPathMetaTags.FOLDER_KEY),
|
|
5830
5845
|
};
|
|
5831
5846
|
const hasAnyValue = Object.values(config).some(Boolean);
|
|
5832
5847
|
return hasAnyValue ? config : null;
|
|
5833
5848
|
}
|
|
5834
5849
|
|
|
5835
|
-
var _UiPath_instances, _UiPath_config, _UiPath_authService, _UiPath_initialized, _UiPath_partialConfig, _UiPath_initializeWithConfig, _UiPath_loadConfig;
|
|
5850
|
+
var _UiPath_instances, _UiPath_config, _UiPath_authService, _UiPath_initialized, _UiPath_partialConfig, _UiPath_multiLogin, _UiPath_metaFolderKey, _UiPath_initializeWithConfig, _UiPath_loadConfig;
|
|
5836
5851
|
/**
|
|
5837
5852
|
* UiPath - Core SDK class for authentication and configuration management.
|
|
5838
5853
|
*
|
|
@@ -5872,8 +5887,14 @@ let UiPath$1 = class UiPath {
|
|
|
5872
5887
|
_UiPath_authService.set(this, void 0);
|
|
5873
5888
|
_UiPath_initialized.set(this, false);
|
|
5874
5889
|
_UiPath_partialConfig.set(this, void 0);
|
|
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);
|
|
5875
5895
|
// Load configuration from meta tags
|
|
5876
5896
|
const configFromMetaTags = loadFromMetaTags();
|
|
5897
|
+
__classPrivateFieldSet(this, _UiPath_metaFolderKey, configFromMetaTags?.folderKey, "f");
|
|
5877
5898
|
// Merge configuration: constructor config overrides meta tags
|
|
5878
5899
|
const mergedConfig = config ? { ...configFromMetaTags, ...config } : configFromMetaTags;
|
|
5879
5900
|
if (mergedConfig && isCompleteConfig(mergedConfig)) {
|
|
@@ -5922,6 +5943,15 @@ let UiPath$1 = class UiPath {
|
|
|
5922
5943
|
throw new Error(`Failed to initialize UiPath SDK: ${errorMessage}`);
|
|
5923
5944
|
}
|
|
5924
5945
|
}
|
|
5946
|
+
/**
|
|
5947
|
+
* Enables the UiPath login picker during OAuth sign-in.
|
|
5948
|
+
*
|
|
5949
|
+
* @internal
|
|
5950
|
+
*/
|
|
5951
|
+
setMultiLogin() {
|
|
5952
|
+
__classPrivateFieldSet(this, _UiPath_multiLogin, true, "f");
|
|
5953
|
+
__classPrivateFieldGet(this, _UiPath_authService, "f")?.setMultiLogin();
|
|
5954
|
+
}
|
|
5925
5955
|
/**
|
|
5926
5956
|
* Check if the SDK has been initialized
|
|
5927
5957
|
*/
|
|
@@ -5993,7 +6023,7 @@ let UiPath$1 = class UiPath {
|
|
|
5993
6023
|
__classPrivateFieldGet(this, _UiPath_authService, "f")?.updateToken(tokenInfo);
|
|
5994
6024
|
}
|
|
5995
6025
|
};
|
|
5996
|
-
_UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_initialized = new WeakMap(), _UiPath_partialConfig = 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) {
|
|
5997
6027
|
// Validate and normalize the configuration
|
|
5998
6028
|
validateConfig(config);
|
|
5999
6029
|
const hasSecretAuth = hasSecretConfig(config);
|
|
@@ -6006,16 +6036,22 @@ _UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_ini
|
|
|
6006
6036
|
secret: hasSecretAuth ? config.secret : undefined,
|
|
6007
6037
|
clientId: hasOAuthAuth ? config.clientId : undefined,
|
|
6008
6038
|
redirectUri: hasOAuthAuth ? config.redirectUri : undefined,
|
|
6009
|
-
scope: hasOAuthAuth ? config.scope : undefined
|
|
6039
|
+
scope: hasOAuthAuth ? config.scope : undefined,
|
|
6010
6040
|
});
|
|
6011
6041
|
const executionContext = new ExecutionContext();
|
|
6012
6042
|
__classPrivateFieldSet(this, _UiPath_authService, new AuthService(internalConfig, executionContext), "f");
|
|
6043
|
+
if (__classPrivateFieldGet(this, _UiPath_multiLogin, "f")) {
|
|
6044
|
+
__classPrivateFieldGet(this, _UiPath_authService, "f").setMultiLogin();
|
|
6045
|
+
}
|
|
6013
6046
|
__classPrivateFieldSet(this, _UiPath_config, internalConfig, "f");
|
|
6014
|
-
// 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.
|
|
6015
6050
|
SDKInternalsRegistry.set(this, {
|
|
6016
6051
|
config: internalConfig,
|
|
6017
6052
|
context: executionContext,
|
|
6018
|
-
tokenManager: __classPrivateFieldGet(this, _UiPath_authService, "f").getTokenManager()
|
|
6053
|
+
tokenManager: __classPrivateFieldGet(this, _UiPath_authService, "f").getTokenManager(),
|
|
6054
|
+
folderKey: __classPrivateFieldGet(this, _UiPath_metaFolderKey, "f"),
|
|
6019
6055
|
});
|
|
6020
6056
|
// Expose read-only config for user convenience
|
|
6021
6057
|
this.config = {
|
|
@@ -6043,6 +6079,7 @@ _UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_ini
|
|
|
6043
6079
|
}, _UiPath_loadConfig = function _UiPath_loadConfig() {
|
|
6044
6080
|
// Load from meta tags
|
|
6045
6081
|
const metaConfig = loadFromMetaTags();
|
|
6082
|
+
__classPrivateFieldSet(this, _UiPath_metaFolderKey, metaConfig?.folderKey, "f");
|
|
6046
6083
|
// Merge with any partial config from constructor (constructor overrides meta tags)
|
|
6047
6084
|
const merged = { ...metaConfig, ...__classPrivateFieldGet(this, _UiPath_partialConfig, "f") };
|
|
6048
6085
|
if (!isCompleteConfig(merged)) {
|
|
@@ -6286,6 +6323,7 @@ class ErrorFactory {
|
|
|
6286
6323
|
}
|
|
6287
6324
|
|
|
6288
6325
|
const FOLDER_KEY = 'X-UIPATH-FolderKey';
|
|
6326
|
+
const FOLDER_PATH_ENCODED = 'X-UIPATH-FolderPath-Encoded';
|
|
6289
6327
|
const FOLDER_ID = 'X-UIPATH-OrganizationUnitId';
|
|
6290
6328
|
const TRACEPARENT = 'traceparent';
|
|
6291
6329
|
const UIPATH_TRACEPARENT_ID = 'x-uipath-traceparent-id';
|
|
@@ -7418,8 +7456,9 @@ class BaseService {
|
|
|
7418
7456
|
constructor(instance, headers) {
|
|
7419
7457
|
// Private field - not visible via Object.keys() or any reflection
|
|
7420
7458
|
_BaseService_apiClient.set(this, void 0);
|
|
7421
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
7459
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
7422
7460
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
7461
|
+
this.config = { folderKey };
|
|
7423
7462
|
}
|
|
7424
7463
|
/**
|
|
7425
7464
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -7781,6 +7820,17 @@ exports.QueryFilterOperator = void 0;
|
|
|
7781
7820
|
QueryFilterOperator["In"] = "in";
|
|
7782
7821
|
QueryFilterOperator["NotIn"] = "not in";
|
|
7783
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 = {}));
|
|
7784
7834
|
/**
|
|
7785
7835
|
* Entity type enum
|
|
7786
7836
|
*/
|
|
@@ -8370,16 +8420,16 @@ class EntityService extends BaseService {
|
|
|
8370
8420
|
return entities;
|
|
8371
8421
|
}
|
|
8372
8422
|
/**
|
|
8373
|
-
* Queries entity records with filters, sorting, and pagination
|
|
8423
|
+
* Queries entity records with filters, sorting, aggregates, and pagination
|
|
8374
8424
|
*
|
|
8375
8425
|
* @param id - UUID of the entity
|
|
8376
|
-
* @param options - Query options including filterGroup, selectedFields, sortOptions, and pagination
|
|
8426
|
+
* @param options - Query options including filterGroup, selectedFields, sortOptions, aggregates, groupBy, and pagination
|
|
8377
8427
|
* @returns Promise resolving to {@link NonPaginatedResponse} without pagination options,
|
|
8378
8428
|
* or {@link PaginatedResponse} when `pageSize`, `cursor`, or `jumpToPage` are provided
|
|
8379
8429
|
*
|
|
8380
8430
|
* @example
|
|
8381
8431
|
* ```typescript
|
|
8382
|
-
* import { Entities, LogicalOperator, QueryFilterOperator } from '@uipath/uipath-typescript/entities';
|
|
8432
|
+
* import { Entities, LogicalOperator, QueryFilterOperator, EntityAggregateFunction } from '@uipath/uipath-typescript/entities';
|
|
8383
8433
|
*
|
|
8384
8434
|
* const entities = new Entities(sdk);
|
|
8385
8435
|
*
|
|
@@ -8403,6 +8453,23 @@ class EntityService extends BaseService {
|
|
|
8403
8453
|
* if (page1.hasNextPage) {
|
|
8404
8454
|
* const page2 = await entities.queryRecordsById("<entityId>", { cursor: page1.nextCursor });
|
|
8405
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
|
+
* });
|
|
8406
8473
|
* ```
|
|
8407
8474
|
*/
|
|
8408
8475
|
async queryRecordsById(id, options) {
|
|
@@ -8420,7 +8487,7 @@ class EntityService extends BaseService {
|
|
|
8420
8487
|
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
8421
8488
|
}
|
|
8422
8489
|
},
|
|
8423
|
-
excludeFromPrefix: ['expansionLevel', 'filterGroup', 'selectedFields', 'sortOptions']
|
|
8490
|
+
excludeFromPrefix: ['expansionLevel', 'filterGroup', 'selectedFields', 'sortOptions', 'aggregates', 'groupBy']
|
|
8424
8491
|
}, options);
|
|
8425
8492
|
}
|
|
8426
8493
|
/**
|
|
@@ -11114,6 +11181,111 @@ __decorate([
|
|
|
11114
11181
|
track('CaseInstances.GetActionTasks')
|
|
11115
11182
|
], CaseInstancesService.prototype, "getActionTasks", null);
|
|
11116
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;
|
|
11117
11289
|
/**
|
|
11118
11290
|
* Base service for services that need folder-specific functionality.
|
|
11119
11291
|
*
|
|
@@ -11147,6 +11319,68 @@ class FolderScopedService extends BaseService {
|
|
|
11147
11319
|
}
|
|
11148
11320
|
return response.data?.value;
|
|
11149
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 '';
|
|
11150
11384
|
}
|
|
11151
11385
|
|
|
11152
11386
|
/**
|
|
@@ -11244,6 +11478,35 @@ class AssetService extends FolderScopedService {
|
|
|
11244
11478
|
const transformedAsset = transformData(pascalToCamelCaseKeys(response.data), AssetMap);
|
|
11245
11479
|
return transformedAsset;
|
|
11246
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
|
+
}
|
|
11247
11510
|
}
|
|
11248
11511
|
__decorate([
|
|
11249
11512
|
track('Assets.GetAll')
|
|
@@ -11251,6 +11514,9 @@ __decorate([
|
|
|
11251
11514
|
__decorate([
|
|
11252
11515
|
track('Assets.GetById')
|
|
11253
11516
|
], AssetService.prototype, "getById", null);
|
|
11517
|
+
__decorate([
|
|
11518
|
+
track('Assets.GetByName')
|
|
11519
|
+
], AssetService.prototype, "getByName", null);
|
|
11254
11520
|
|
|
11255
11521
|
/**
|
|
11256
11522
|
* Enum for Asset Value Scope
|
|
@@ -12354,7 +12620,7 @@ const ProcessMap = {
|
|
|
12354
12620
|
/**
|
|
12355
12621
|
* Service for interacting with UiPath Orchestrator Processes API
|
|
12356
12622
|
*/
|
|
12357
|
-
class ProcessService extends
|
|
12623
|
+
class ProcessService extends FolderScopedService {
|
|
12358
12624
|
/**
|
|
12359
12625
|
* Gets all processes across folders with optional filtering and folder scoping
|
|
12360
12626
|
*
|
|
@@ -12491,6 +12757,35 @@ class ProcessService extends BaseService {
|
|
|
12491
12757
|
const transformedProcess = transformData(pascalToCamelCaseKeys(response.data), ProcessMap);
|
|
12492
12758
|
return transformedProcess;
|
|
12493
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
|
+
}
|
|
12494
12789
|
}
|
|
12495
12790
|
__decorate([
|
|
12496
12791
|
track('Processes.GetAll')
|
|
@@ -12501,6 +12796,9 @@ __decorate([
|
|
|
12501
12796
|
__decorate([
|
|
12502
12797
|
track('Processes.GetById')
|
|
12503
12798
|
], ProcessService.prototype, "getById", null);
|
|
12799
|
+
__decorate([
|
|
12800
|
+
track('Processes.GetByName')
|
|
12801
|
+
], ProcessService.prototype, "getByName", null);
|
|
12504
12802
|
|
|
12505
12803
|
/**
|
|
12506
12804
|
* Maps fields for Queue entities to ensure consistent naming
|
|
@@ -12978,7 +13276,7 @@ const AgentMap = {
|
|
|
12978
13276
|
};
|
|
12979
13277
|
|
|
12980
13278
|
/**
|
|
12981
|
-
* Constants for User Service
|
|
13279
|
+
* Constants for User Settings Service
|
|
12982
13280
|
*/
|
|
12983
13281
|
/**
|
|
12984
13282
|
* Maps fields for User Settings entities to ensure consistent SDK naming
|