@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.mjs
CHANGED
|
@@ -5024,6 +5024,7 @@ class TokenManager {
|
|
|
5024
5024
|
const GUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
5025
5025
|
class AuthService {
|
|
5026
5026
|
constructor(config, executionContext) {
|
|
5027
|
+
this.skipAcrValues = false;
|
|
5027
5028
|
// Only use stored OAuth context when completing an active callback (URL has ?code=).
|
|
5028
5029
|
// If stored context exists but we're NOT in a callback, it's stale from a
|
|
5029
5030
|
// failed/abandoned flow (e.g. scope mismatch, invalid redirect URI) and must
|
|
@@ -5115,6 +5116,14 @@ class AuthService {
|
|
|
5115
5116
|
getTokenManager() {
|
|
5116
5117
|
return this.tokenManager;
|
|
5117
5118
|
}
|
|
5119
|
+
/**
|
|
5120
|
+
* Enables the UiPath login picker during OAuth sign-in.
|
|
5121
|
+
*
|
|
5122
|
+
* @internal
|
|
5123
|
+
*/
|
|
5124
|
+
setMultiLogin() {
|
|
5125
|
+
this.skipAcrValues = true;
|
|
5126
|
+
}
|
|
5118
5127
|
/**
|
|
5119
5128
|
* Authenticates the user based on the provided SDK configuration.
|
|
5120
5129
|
* This method handles OAuth 2.0 authentication flow only.
|
|
@@ -5316,7 +5325,10 @@ class AuthService {
|
|
|
5316
5325
|
scope: params.scope + ' offline_access',
|
|
5317
5326
|
state: params.state || this.generateCodeVerifier().slice(0, 16)
|
|
5318
5327
|
});
|
|
5319
|
-
|
|
5328
|
+
const authorizeUrl = `${this.config.baseUrl}/${IDENTITY_ENDPOINTS.AUTHORIZE}?${queryParams.toString()}`;
|
|
5329
|
+
return this.skipAcrValues
|
|
5330
|
+
? authorizeUrl
|
|
5331
|
+
: `${authorizeUrl}&acr_values=${acrValues}`;
|
|
5320
5332
|
}
|
|
5321
5333
|
/**
|
|
5322
5334
|
* Exchanges the authorization code for an access token and automatically updates the current token
|
|
@@ -5450,7 +5462,7 @@ function normalizeBaseUrl(url) {
|
|
|
5450
5462
|
// Connection string placeholder that will be replaced during build
|
|
5451
5463
|
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";
|
|
5452
5464
|
// SDK Version placeholder
|
|
5453
|
-
const SDK_VERSION = "1.3.
|
|
5465
|
+
const SDK_VERSION = "1.3.7";
|
|
5454
5466
|
const VERSION = "Version";
|
|
5455
5467
|
const SERVICE = "Service";
|
|
5456
5468
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -5797,6 +5809,8 @@ var UiPathMetaTags;
|
|
|
5797
5809
|
// Asset resolution and routing
|
|
5798
5810
|
UiPathMetaTags["CDN_BASE"] = "uipath:cdn-base";
|
|
5799
5811
|
UiPathMetaTags["APP_BASE"] = "uipath:app-base";
|
|
5812
|
+
// Folder context (injected during coded-app deployment)
|
|
5813
|
+
UiPathMetaTags["FOLDER_KEY"] = "uipath:folder-key";
|
|
5800
5814
|
})(UiPathMetaTags || (UiPathMetaTags = {}));
|
|
5801
5815
|
|
|
5802
5816
|
/**
|
|
@@ -5825,12 +5839,13 @@ function loadFromMetaTags() {
|
|
|
5825
5839
|
tenantName: getMetaTagContent(UiPathMetaTags.TENANT_NAME),
|
|
5826
5840
|
baseUrl: getMetaTagContent(UiPathMetaTags.BASE_URL),
|
|
5827
5841
|
redirectUri: getMetaTagContent(UiPathMetaTags.REDIRECT_URI),
|
|
5842
|
+
folderKey: getMetaTagContent(UiPathMetaTags.FOLDER_KEY),
|
|
5828
5843
|
};
|
|
5829
5844
|
const hasAnyValue = Object.values(config).some(Boolean);
|
|
5830
5845
|
return hasAnyValue ? config : null;
|
|
5831
5846
|
}
|
|
5832
5847
|
|
|
5833
|
-
var _UiPath_instances, _UiPath_config, _UiPath_authService, _UiPath_initialized, _UiPath_partialConfig, _UiPath_initializeWithConfig, _UiPath_loadConfig;
|
|
5848
|
+
var _UiPath_instances, _UiPath_config, _UiPath_authService, _UiPath_initialized, _UiPath_partialConfig, _UiPath_multiLogin, _UiPath_metaFolderKey, _UiPath_initializeWithConfig, _UiPath_loadConfig;
|
|
5834
5849
|
/**
|
|
5835
5850
|
* UiPath - Core SDK class for authentication and configuration management.
|
|
5836
5851
|
*
|
|
@@ -5870,8 +5885,14 @@ let UiPath$1 = class UiPath {
|
|
|
5870
5885
|
_UiPath_authService.set(this, void 0);
|
|
5871
5886
|
_UiPath_initialized.set(this, false);
|
|
5872
5887
|
_UiPath_partialConfig.set(this, void 0);
|
|
5888
|
+
_UiPath_multiLogin.set(this, false);
|
|
5889
|
+
// Folder key sourced only from `<meta name="uipath:folder-key">` (coded-app
|
|
5890
|
+
// deployments). Not accepted via the public constructor; lives here so the
|
|
5891
|
+
// SDK can flow it through to BaseService.config without polluting BaseConfig.
|
|
5892
|
+
_UiPath_metaFolderKey.set(this, void 0);
|
|
5873
5893
|
// Load configuration from meta tags
|
|
5874
5894
|
const configFromMetaTags = loadFromMetaTags();
|
|
5895
|
+
__classPrivateFieldSet(this, _UiPath_metaFolderKey, configFromMetaTags?.folderKey, "f");
|
|
5875
5896
|
// Merge configuration: constructor config overrides meta tags
|
|
5876
5897
|
const mergedConfig = config ? { ...configFromMetaTags, ...config } : configFromMetaTags;
|
|
5877
5898
|
if (mergedConfig && isCompleteConfig(mergedConfig)) {
|
|
@@ -5920,6 +5941,15 @@ let UiPath$1 = class UiPath {
|
|
|
5920
5941
|
throw new Error(`Failed to initialize UiPath SDK: ${errorMessage}`);
|
|
5921
5942
|
}
|
|
5922
5943
|
}
|
|
5944
|
+
/**
|
|
5945
|
+
* Enables the UiPath login picker during OAuth sign-in.
|
|
5946
|
+
*
|
|
5947
|
+
* @internal
|
|
5948
|
+
*/
|
|
5949
|
+
setMultiLogin() {
|
|
5950
|
+
__classPrivateFieldSet(this, _UiPath_multiLogin, true, "f");
|
|
5951
|
+
__classPrivateFieldGet(this, _UiPath_authService, "f")?.setMultiLogin();
|
|
5952
|
+
}
|
|
5923
5953
|
/**
|
|
5924
5954
|
* Check if the SDK has been initialized
|
|
5925
5955
|
*/
|
|
@@ -5991,7 +6021,7 @@ let UiPath$1 = class UiPath {
|
|
|
5991
6021
|
__classPrivateFieldGet(this, _UiPath_authService, "f")?.updateToken(tokenInfo);
|
|
5992
6022
|
}
|
|
5993
6023
|
};
|
|
5994
|
-
_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) {
|
|
6024
|
+
_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) {
|
|
5995
6025
|
// Validate and normalize the configuration
|
|
5996
6026
|
validateConfig(config);
|
|
5997
6027
|
const hasSecretAuth = hasSecretConfig(config);
|
|
@@ -6004,16 +6034,22 @@ _UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_ini
|
|
|
6004
6034
|
secret: hasSecretAuth ? config.secret : undefined,
|
|
6005
6035
|
clientId: hasOAuthAuth ? config.clientId : undefined,
|
|
6006
6036
|
redirectUri: hasOAuthAuth ? config.redirectUri : undefined,
|
|
6007
|
-
scope: hasOAuthAuth ? config.scope : undefined
|
|
6037
|
+
scope: hasOAuthAuth ? config.scope : undefined,
|
|
6008
6038
|
});
|
|
6009
6039
|
const executionContext = new ExecutionContext();
|
|
6010
6040
|
__classPrivateFieldSet(this, _UiPath_authService, new AuthService(internalConfig, executionContext), "f");
|
|
6041
|
+
if (__classPrivateFieldGet(this, _UiPath_multiLogin, "f")) {
|
|
6042
|
+
__classPrivateFieldGet(this, _UiPath_authService, "f").setMultiLogin();
|
|
6043
|
+
}
|
|
6011
6044
|
__classPrivateFieldSet(this, _UiPath_config, internalConfig, "f");
|
|
6012
|
-
// Store internals in SDKInternalsRegistry (not visible on instance)
|
|
6045
|
+
// Store internals in SDKInternalsRegistry (not visible on instance).
|
|
6046
|
+
// `folderKey` is meta-tag-only — kept off `UiPathConfig` (which mirrors
|
|
6047
|
+
// user-passed values) and lives here on the runtime registry instead.
|
|
6013
6048
|
SDKInternalsRegistry.set(this, {
|
|
6014
6049
|
config: internalConfig,
|
|
6015
6050
|
context: executionContext,
|
|
6016
|
-
tokenManager: __classPrivateFieldGet(this, _UiPath_authService, "f").getTokenManager()
|
|
6051
|
+
tokenManager: __classPrivateFieldGet(this, _UiPath_authService, "f").getTokenManager(),
|
|
6052
|
+
folderKey: __classPrivateFieldGet(this, _UiPath_metaFolderKey, "f"),
|
|
6017
6053
|
});
|
|
6018
6054
|
// Expose read-only config for user convenience
|
|
6019
6055
|
this.config = {
|
|
@@ -6041,6 +6077,7 @@ _UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_ini
|
|
|
6041
6077
|
}, _UiPath_loadConfig = function _UiPath_loadConfig() {
|
|
6042
6078
|
// Load from meta tags
|
|
6043
6079
|
const metaConfig = loadFromMetaTags();
|
|
6080
|
+
__classPrivateFieldSet(this, _UiPath_metaFolderKey, metaConfig?.folderKey, "f");
|
|
6044
6081
|
// Merge with any partial config from constructor (constructor overrides meta tags)
|
|
6045
6082
|
const merged = { ...metaConfig, ...__classPrivateFieldGet(this, _UiPath_partialConfig, "f") };
|
|
6046
6083
|
if (!isCompleteConfig(merged)) {
|
|
@@ -6284,6 +6321,7 @@ class ErrorFactory {
|
|
|
6284
6321
|
}
|
|
6285
6322
|
|
|
6286
6323
|
const FOLDER_KEY = 'X-UIPATH-FolderKey';
|
|
6324
|
+
const FOLDER_PATH_ENCODED = 'X-UIPATH-FolderPath-Encoded';
|
|
6287
6325
|
const FOLDER_ID = 'X-UIPATH-OrganizationUnitId';
|
|
6288
6326
|
const TRACEPARENT = 'traceparent';
|
|
6289
6327
|
const UIPATH_TRACEPARENT_ID = 'x-uipath-traceparent-id';
|
|
@@ -7416,8 +7454,9 @@ class BaseService {
|
|
|
7416
7454
|
constructor(instance, headers) {
|
|
7417
7455
|
// Private field - not visible via Object.keys() or any reflection
|
|
7418
7456
|
_BaseService_apiClient.set(this, void 0);
|
|
7419
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
7457
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
7420
7458
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
7459
|
+
this.config = { folderKey };
|
|
7421
7460
|
}
|
|
7422
7461
|
/**
|
|
7423
7462
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -7779,6 +7818,17 @@ var QueryFilterOperator;
|
|
|
7779
7818
|
QueryFilterOperator["In"] = "in";
|
|
7780
7819
|
QueryFilterOperator["NotIn"] = "not in";
|
|
7781
7820
|
})(QueryFilterOperator || (QueryFilterOperator = {}));
|
|
7821
|
+
/**
|
|
7822
|
+
* Aggregate functions supported by the Data Fabric query API.
|
|
7823
|
+
*/
|
|
7824
|
+
var EntityAggregateFunction;
|
|
7825
|
+
(function (EntityAggregateFunction) {
|
|
7826
|
+
EntityAggregateFunction["Count"] = "COUNT";
|
|
7827
|
+
EntityAggregateFunction["Sum"] = "SUM";
|
|
7828
|
+
EntityAggregateFunction["Avg"] = "AVG";
|
|
7829
|
+
EntityAggregateFunction["Min"] = "MIN";
|
|
7830
|
+
EntityAggregateFunction["Max"] = "MAX";
|
|
7831
|
+
})(EntityAggregateFunction || (EntityAggregateFunction = {}));
|
|
7782
7832
|
/**
|
|
7783
7833
|
* Entity type enum
|
|
7784
7834
|
*/
|
|
@@ -8368,16 +8418,16 @@ class EntityService extends BaseService {
|
|
|
8368
8418
|
return entities;
|
|
8369
8419
|
}
|
|
8370
8420
|
/**
|
|
8371
|
-
* Queries entity records with filters, sorting, and pagination
|
|
8421
|
+
* Queries entity records with filters, sorting, aggregates, and pagination
|
|
8372
8422
|
*
|
|
8373
8423
|
* @param id - UUID of the entity
|
|
8374
|
-
* @param options - Query options including filterGroup, selectedFields, sortOptions, and pagination
|
|
8424
|
+
* @param options - Query options including filterGroup, selectedFields, sortOptions, aggregates, groupBy, and pagination
|
|
8375
8425
|
* @returns Promise resolving to {@link NonPaginatedResponse} without pagination options,
|
|
8376
8426
|
* or {@link PaginatedResponse} when `pageSize`, `cursor`, or `jumpToPage` are provided
|
|
8377
8427
|
*
|
|
8378
8428
|
* @example
|
|
8379
8429
|
* ```typescript
|
|
8380
|
-
* import { Entities, LogicalOperator, QueryFilterOperator } from '@uipath/uipath-typescript/entities';
|
|
8430
|
+
* import { Entities, LogicalOperator, QueryFilterOperator, EntityAggregateFunction } from '@uipath/uipath-typescript/entities';
|
|
8381
8431
|
*
|
|
8382
8432
|
* const entities = new Entities(sdk);
|
|
8383
8433
|
*
|
|
@@ -8401,6 +8451,23 @@ class EntityService extends BaseService {
|
|
|
8401
8451
|
* if (page1.hasNextPage) {
|
|
8402
8452
|
* const page2 = await entities.queryRecordsById("<entityId>", { cursor: page1.nextCursor });
|
|
8403
8453
|
* }
|
|
8454
|
+
*
|
|
8455
|
+
* // Aggregate: count of records per status
|
|
8456
|
+
* await entities.queryRecordsById("<entityId>", {
|
|
8457
|
+
* selectedFields: ["status"],
|
|
8458
|
+
* groupBy: ["status"],
|
|
8459
|
+
* aggregates: [
|
|
8460
|
+
* { function: EntityAggregateFunction.Count, field: "Id", alias: "total" },
|
|
8461
|
+
* ],
|
|
8462
|
+
* });
|
|
8463
|
+
*
|
|
8464
|
+
* // Aggregate: total sum and average across all records (no grouping)
|
|
8465
|
+
* await entities.queryRecordsById("<entityId>", {
|
|
8466
|
+
* aggregates: [
|
|
8467
|
+
* { function: EntityAggregateFunction.Sum, field: "amount", alias: "totalAmount" },
|
|
8468
|
+
* { function: EntityAggregateFunction.Avg, field: "amount", alias: "avgAmount" },
|
|
8469
|
+
* ],
|
|
8470
|
+
* });
|
|
8404
8471
|
* ```
|
|
8405
8472
|
*/
|
|
8406
8473
|
async queryRecordsById(id, options) {
|
|
@@ -8418,7 +8485,7 @@ class EntityService extends BaseService {
|
|
|
8418
8485
|
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
8419
8486
|
}
|
|
8420
8487
|
},
|
|
8421
|
-
excludeFromPrefix: ['expansionLevel', 'filterGroup', 'selectedFields', 'sortOptions']
|
|
8488
|
+
excludeFromPrefix: ['expansionLevel', 'filterGroup', 'selectedFields', 'sortOptions', 'aggregates', 'groupBy']
|
|
8422
8489
|
}, options);
|
|
8423
8490
|
}
|
|
8424
8491
|
/**
|
|
@@ -11112,6 +11179,111 @@ __decorate([
|
|
|
11112
11179
|
track('CaseInstances.GetActionTasks')
|
|
11113
11180
|
], CaseInstancesService.prototype, "getActionTasks", null);
|
|
11114
11181
|
|
|
11182
|
+
/**
|
|
11183
|
+
* Validates the `name` argument passed to a `getByName(name, ...)` method.
|
|
11184
|
+
* Trims whitespace and rejects empty/whitespace-only names.
|
|
11185
|
+
*
|
|
11186
|
+
* @param resourceType - Resource label used in error messages (e.g. 'Asset', 'Process')
|
|
11187
|
+
* @param name - Resource name to validate
|
|
11188
|
+
* @returns The trimmed name
|
|
11189
|
+
* @throws ValidationError when `name` is missing or empty after trimming
|
|
11190
|
+
*/
|
|
11191
|
+
function validateName(resourceType, name) {
|
|
11192
|
+
if (!name) {
|
|
11193
|
+
throw new ValidationError({
|
|
11194
|
+
message: `${resourceType} name is required and cannot be empty.`,
|
|
11195
|
+
});
|
|
11196
|
+
}
|
|
11197
|
+
const trimmed = name.trim();
|
|
11198
|
+
if (!trimmed) {
|
|
11199
|
+
throw new ValidationError({
|
|
11200
|
+
message: `${resourceType} name is required and cannot be empty.`,
|
|
11201
|
+
});
|
|
11202
|
+
}
|
|
11203
|
+
return trimmed;
|
|
11204
|
+
}
|
|
11205
|
+
|
|
11206
|
+
/**
|
|
11207
|
+
* Encodes a folder path for the `X-UIPATH-FolderPath-Encoded` header.
|
|
11208
|
+
*
|
|
11209
|
+
* Orchestrator decodes this header as **base64-encoded UTF-16 LE bytes**
|
|
11210
|
+
* (see `HttpHeadersProviderExtensions.GetDecoded` + `OrganizationUnitProvider`
|
|
11211
|
+
* in the Orchestrator repo, which call `Encoding.Unicode.GetString(...)`).
|
|
11212
|
+
* URL-encoding is NOT what the server expects — it must be base64-of-UTF-16-LE
|
|
11213
|
+
* bytes.
|
|
11214
|
+
*
|
|
11215
|
+
* @param folderPath - The folder path (e.g. 'Shared/Finance')
|
|
11216
|
+
* @returns Base64 string suitable for the `X-UIPATH-FolderPath-Encoded` header
|
|
11217
|
+
*/
|
|
11218
|
+
function encodeFolderPathHeader(folderPath) {
|
|
11219
|
+
// Force little-endian regardless of host byte order. `Uint16Array` viewed
|
|
11220
|
+
// as `Uint8Array` would use the host's native order — correct on LE hosts
|
|
11221
|
+
// (x86/ARM-LE) but wrong on BE hosts. `DataView.setUint16(..., true)`
|
|
11222
|
+
// pins LE.
|
|
11223
|
+
const buf = new ArrayBuffer(folderPath.length * 2);
|
|
11224
|
+
const view = new DataView(buf);
|
|
11225
|
+
for (let i = 0; i < folderPath.length; i++) {
|
|
11226
|
+
view.setUint16(i * 2, folderPath.charCodeAt(i), true);
|
|
11227
|
+
}
|
|
11228
|
+
const bytes = new Uint8Array(buf);
|
|
11229
|
+
let binary = '';
|
|
11230
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
11231
|
+
binary += String.fromCharCode(bytes[i]);
|
|
11232
|
+
}
|
|
11233
|
+
// btoa is browser-native; Node 16+ also has it as a global
|
|
11234
|
+
return btoa(binary);
|
|
11235
|
+
}
|
|
11236
|
+
|
|
11237
|
+
/**
|
|
11238
|
+
* Resolves folder context into the appropriate Orchestrator folder headers.
|
|
11239
|
+
*
|
|
11240
|
+
* Centralized so all folder-scoped methods (e.g. `assets.getByName`,
|
|
11241
|
+
* `processes.getByName`, future Queues/Buckets/Jobs) share one implementation.
|
|
11242
|
+
*
|
|
11243
|
+
* Each input field maps directly to its header — no auto-detection or type
|
|
11244
|
+
* coercion. When multiple fields are supplied, all corresponding headers
|
|
11245
|
+
* are forwarded and the server resolves precedence.
|
|
11246
|
+
*
|
|
11247
|
+
* Routing:
|
|
11248
|
+
* - `folderId` → `X-UIPATH-OrganizationUnitId`
|
|
11249
|
+
* - `folderKey` → `X-UIPATH-FolderKey`
|
|
11250
|
+
* - `folderPath` → `X-UIPATH-FolderPath-Encoded`
|
|
11251
|
+
* - none set + `fallbackFolderKey` → fallback used as `X-UIPATH-FolderKey`
|
|
11252
|
+
* - none set + no fallback → `ValidationError`
|
|
11253
|
+
*
|
|
11254
|
+
* @throws ValidationError when no folder context can be resolved.
|
|
11255
|
+
*/
|
|
11256
|
+
function resolveFolderHeaders(input) {
|
|
11257
|
+
const { folderId, folderKey, folderPath, resourceType, fallbackFolderKey } = input;
|
|
11258
|
+
const trimmedKey = folderKey?.trim();
|
|
11259
|
+
const trimmedPath = folderPath?.trim();
|
|
11260
|
+
const headers = {};
|
|
11261
|
+
if (folderId !== undefined) {
|
|
11262
|
+
headers[FOLDER_ID] = folderId;
|
|
11263
|
+
}
|
|
11264
|
+
if (trimmedKey) {
|
|
11265
|
+
headers[FOLDER_KEY] = trimmedKey;
|
|
11266
|
+
}
|
|
11267
|
+
if (trimmedPath) {
|
|
11268
|
+
headers[FOLDER_PATH_ENCODED] = encodeFolderPathHeader(trimmedPath);
|
|
11269
|
+
}
|
|
11270
|
+
// No explicit folder context → meta-tag fallback or error.
|
|
11271
|
+
if (Object.keys(headers).length === 0) {
|
|
11272
|
+
if (!fallbackFolderKey) {
|
|
11273
|
+
throw new ValidationError({
|
|
11274
|
+
message: `${resourceType} requires folder context: pass \`folderId\`, \`folderKey\`, or \`folderPath\`, or initialize the SDK with a folder context.`,
|
|
11275
|
+
});
|
|
11276
|
+
}
|
|
11277
|
+
headers[FOLDER_KEY] = fallbackFolderKey;
|
|
11278
|
+
}
|
|
11279
|
+
return createHeaders(headers);
|
|
11280
|
+
}
|
|
11281
|
+
|
|
11282
|
+
/**
|
|
11283
|
+
* Matches single-quote characters in OData string literals — escaped to `''`
|
|
11284
|
+
* inside the `$filter=Name eq '…'` clause built by `getByNameLookup`.
|
|
11285
|
+
*/
|
|
11286
|
+
const SINGLE_QUOTE_RE = /'/g;
|
|
11115
11287
|
/**
|
|
11116
11288
|
* Base service for services that need folder-specific functionality.
|
|
11117
11289
|
*
|
|
@@ -11145,6 +11317,68 @@ class FolderScopedService extends BaseService {
|
|
|
11145
11317
|
}
|
|
11146
11318
|
return response.data?.value;
|
|
11147
11319
|
}
|
|
11320
|
+
/**
|
|
11321
|
+
* Look up a single resource by name on a folder-scoped OData collection.
|
|
11322
|
+
*
|
|
11323
|
+
* Shared by `getByName` implementations across services (Assets, Processes, etc).
|
|
11324
|
+
* Handles:
|
|
11325
|
+
* - Name validation via `validateName`
|
|
11326
|
+
* - Folder header resolution via `resolveFolderHeaders` (folderId → ID/key
|
|
11327
|
+
* header by type, folderPath → encoded path header, falls back to
|
|
11328
|
+
* init-time `config.folderKey` from the `uipath:folder-key` meta tag)
|
|
11329
|
+
* - OData `$filter=Name eq '…'` with single-quote escaping + `$top=1`
|
|
11330
|
+
* - Empty-result → `NotFoundError` with folder context in the message
|
|
11331
|
+
*
|
|
11332
|
+
* The transform step is caller-provided because each resource has its own
|
|
11333
|
+
* PascalCase → camelCase field mapping.
|
|
11334
|
+
*
|
|
11335
|
+
* @param resourceType - Resource label used in validation + error messages (e.g. 'Asset', 'Process')
|
|
11336
|
+
* @param endpoint - Folder-scoped OData collection endpoint
|
|
11337
|
+
* @param name - Resource name to search for
|
|
11338
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) + OData query options (`expand`, `select`)
|
|
11339
|
+
* @param transform - Maps a raw OData item to the typed response (e.g. PascalCase → camelCase via field map)
|
|
11340
|
+
* @throws ValidationError when inputs are malformed; NotFoundError when no match
|
|
11341
|
+
*/
|
|
11342
|
+
async getByNameLookup(resourceType, endpoint, name, options, transform) {
|
|
11343
|
+
const validatedName = validateName(resourceType, name);
|
|
11344
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
11345
|
+
const headers = resolveFolderHeaders({
|
|
11346
|
+
folderId,
|
|
11347
|
+
folderKey,
|
|
11348
|
+
folderPath,
|
|
11349
|
+
resourceType: `${resourceType}.getByName`,
|
|
11350
|
+
fallbackFolderKey: this.config.folderKey,
|
|
11351
|
+
});
|
|
11352
|
+
const apiOptions = {
|
|
11353
|
+
...addPrefixToKeys(queryOptions, ODATA_PREFIX, Object.keys(queryOptions)),
|
|
11354
|
+
'$filter': `Name eq '${validatedName.replace(SINGLE_QUOTE_RE, "''")}'`,
|
|
11355
|
+
'$top': '1',
|
|
11356
|
+
};
|
|
11357
|
+
const response = await this.get(endpoint, {
|
|
11358
|
+
headers,
|
|
11359
|
+
params: apiOptions,
|
|
11360
|
+
});
|
|
11361
|
+
const items = response.data?.value;
|
|
11362
|
+
if (!items?.length) {
|
|
11363
|
+
const folderHint = describeFolderForError(folderId, folderKey, folderPath);
|
|
11364
|
+
throw new NotFoundError({
|
|
11365
|
+
message: `${resourceType} '${validatedName}' not found${folderHint}.`,
|
|
11366
|
+
});
|
|
11367
|
+
}
|
|
11368
|
+
return transform(items[0]);
|
|
11369
|
+
}
|
|
11370
|
+
}
|
|
11371
|
+
/** Renders the supplied folder for a NotFoundError message. */
|
|
11372
|
+
function describeFolderForError(folderId, folderKey, folderPath) {
|
|
11373
|
+
const path = folderPath?.trim();
|
|
11374
|
+
if (path)
|
|
11375
|
+
return ` in folder '${path}'`;
|
|
11376
|
+
const key = folderKey?.trim();
|
|
11377
|
+
if (key)
|
|
11378
|
+
return ` in folder (key: ${key})`;
|
|
11379
|
+
if (typeof folderId === 'number')
|
|
11380
|
+
return ` in folder (id: ${folderId})`;
|
|
11381
|
+
return '';
|
|
11148
11382
|
}
|
|
11149
11383
|
|
|
11150
11384
|
/**
|
|
@@ -11242,6 +11476,35 @@ class AssetService extends FolderScopedService {
|
|
|
11242
11476
|
const transformedAsset = transformData(pascalToCamelCaseKeys(response.data), AssetMap);
|
|
11243
11477
|
return transformedAsset;
|
|
11244
11478
|
}
|
|
11479
|
+
/**
|
|
11480
|
+
* Retrieves a single asset by name.
|
|
11481
|
+
*
|
|
11482
|
+
* @param name - Asset name to search for
|
|
11483
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
|
|
11484
|
+
* @returns Promise resolving to a single asset
|
|
11485
|
+
* {@link AssetGetResponse}
|
|
11486
|
+
* @example
|
|
11487
|
+
* ```typescript
|
|
11488
|
+
* import { Assets } from '@uipath/uipath-typescript/assets';
|
|
11489
|
+
*
|
|
11490
|
+
* const assets = new Assets(sdk);
|
|
11491
|
+
*
|
|
11492
|
+
* // By folder ID
|
|
11493
|
+
* await assets.getByName('ApiKey', { folderId: 123 });
|
|
11494
|
+
*
|
|
11495
|
+
* // By folder key (GUID)
|
|
11496
|
+
* await assets.getByName('ApiKey', { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
|
|
11497
|
+
*
|
|
11498
|
+
* // By folder path
|
|
11499
|
+
* await assets.getByName('ApiKey', { folderPath: 'Shared/Finance' });
|
|
11500
|
+
*
|
|
11501
|
+
* // With expand
|
|
11502
|
+
* await assets.getByName('ApiKey', { folderPath: 'Shared/Finance', expand: 'keyValueList' });
|
|
11503
|
+
* ```
|
|
11504
|
+
*/
|
|
11505
|
+
async getByName(name, options = {}) {
|
|
11506
|
+
return this.getByNameLookup('Asset', ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap));
|
|
11507
|
+
}
|
|
11245
11508
|
}
|
|
11246
11509
|
__decorate([
|
|
11247
11510
|
track('Assets.GetAll')
|
|
@@ -11249,6 +11512,9 @@ __decorate([
|
|
|
11249
11512
|
__decorate([
|
|
11250
11513
|
track('Assets.GetById')
|
|
11251
11514
|
], AssetService.prototype, "getById", null);
|
|
11515
|
+
__decorate([
|
|
11516
|
+
track('Assets.GetByName')
|
|
11517
|
+
], AssetService.prototype, "getByName", null);
|
|
11252
11518
|
|
|
11253
11519
|
/**
|
|
11254
11520
|
* Enum for Asset Value Scope
|
|
@@ -12352,7 +12618,7 @@ const ProcessMap = {
|
|
|
12352
12618
|
/**
|
|
12353
12619
|
* Service for interacting with UiPath Orchestrator Processes API
|
|
12354
12620
|
*/
|
|
12355
|
-
class ProcessService extends
|
|
12621
|
+
class ProcessService extends FolderScopedService {
|
|
12356
12622
|
/**
|
|
12357
12623
|
* Gets all processes across folders with optional filtering and folder scoping
|
|
12358
12624
|
*
|
|
@@ -12489,6 +12755,35 @@ class ProcessService extends BaseService {
|
|
|
12489
12755
|
const transformedProcess = transformData(pascalToCamelCaseKeys(response.data), ProcessMap);
|
|
12490
12756
|
return transformedProcess;
|
|
12491
12757
|
}
|
|
12758
|
+
/**
|
|
12759
|
+
* Retrieves a single process by name.
|
|
12760
|
+
*
|
|
12761
|
+
* @param name - Process name to search for
|
|
12762
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
|
|
12763
|
+
* @returns Promise resolving to a single process
|
|
12764
|
+
* {@link ProcessGetResponse}
|
|
12765
|
+
* @example
|
|
12766
|
+
* ```typescript
|
|
12767
|
+
* import { Processes } from '@uipath/uipath-typescript/processes';
|
|
12768
|
+
*
|
|
12769
|
+
* const processes = new Processes(sdk);
|
|
12770
|
+
*
|
|
12771
|
+
* // By folder ID
|
|
12772
|
+
* await processes.getByName('MyProcess', { folderId: 123 });
|
|
12773
|
+
*
|
|
12774
|
+
* // By folder key (GUID)
|
|
12775
|
+
* await processes.getByName('MyProcess', { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
|
|
12776
|
+
*
|
|
12777
|
+
* // By folder path
|
|
12778
|
+
* await processes.getByName('MyProcess', { folderPath: 'Shared/Finance' });
|
|
12779
|
+
*
|
|
12780
|
+
* // With expand
|
|
12781
|
+
* await processes.getByName('MyProcess', { folderPath: 'Shared/Finance', expand: 'entryPoints' });
|
|
12782
|
+
* ```
|
|
12783
|
+
*/
|
|
12784
|
+
async getByName(name, options = {}) {
|
|
12785
|
+
return this.getByNameLookup('Process', PROCESS_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), ProcessMap));
|
|
12786
|
+
}
|
|
12492
12787
|
}
|
|
12493
12788
|
__decorate([
|
|
12494
12789
|
track('Processes.GetAll')
|
|
@@ -12499,6 +12794,9 @@ __decorate([
|
|
|
12499
12794
|
__decorate([
|
|
12500
12795
|
track('Processes.GetById')
|
|
12501
12796
|
], ProcessService.prototype, "getById", null);
|
|
12797
|
+
__decorate([
|
|
12798
|
+
track('Processes.GetByName')
|
|
12799
|
+
], ProcessService.prototype, "getByName", null);
|
|
12502
12800
|
|
|
12503
12801
|
/**
|
|
12504
12802
|
* Maps fields for Queue entities to ensure consistent naming
|
|
@@ -12976,7 +13274,7 @@ const AgentMap = {
|
|
|
12976
13274
|
};
|
|
12977
13275
|
|
|
12978
13276
|
/**
|
|
12979
|
-
* Constants for User Service
|
|
13277
|
+
* Constants for User Settings Service
|
|
12980
13278
|
*/
|
|
12981
13279
|
/**
|
|
12982
13280
|
* Maps fields for User Settings entities to ensure consistent SDK naming
|
|
@@ -13327,4 +13625,4 @@ function getAppBase() {
|
|
|
13327
13625
|
return getMetaTagContent(UiPathMetaTags.APP_BASE) || '/';
|
|
13328
13626
|
}
|
|
13329
13627
|
|
|
13330
|
-
export { APP_NAME, AgentMap, AssetValueScope, AssetValueType, AuthenticationError, AuthorizationError, BucketOptions, CLOUD_CLIENT_ID, CLOUD_ORGANIZATION_NAME, CLOUD_REDIRECT_URI, CLOUD_ROLE_NAME, CLOUD_TENANT_NAME, CLOUD_URL, CONNECTION_STRING, CitationErrorType, ConversationMap, DEFAULT_ITEMS_FIELD, DEFAULT_PAGE_SIZE, DEFAULT_TOTAL_COUNT_FIELD, DataDirectionType, DebugMode, index as DuFramework, EntityFieldDataType, EntityType, ErrorType, EscalationActionType, EscalationRecipientScope, EscalationTriggerType, ExchangeMap, FeedbackRating, FeedbackStatus, FieldDisplayType, HttpStatus, InputStreamSpeechSensitivity, InterruptType, JobPriority, JobSourceType, JobState, JobSubState, JobType, JoinType, LogicalOperator$1 as LogicalOperator, MAX_PAGE_SIZE, MessageMap, MessageRole, NetworkError, NotFoundError, PackageSourceType, PackageType, ProcessIncidentSeverity, ProcessIncidentStatus, ProcessIncidentType, QueryFilterOperator, RateLimitError, ReferenceType, RemoteControlAccess, RobotSize, RuntimeType, SDK_LOGGER_NAME, SDK_RUN_EVENT, SDK_SERVICE_NAME, SDK_VERSION, SERVICE, SLADurationUnit, ServerError, ServerlessJobType, SortOrder, StageTaskType, StartStrategy, StopStrategy, TargetFramework, TaskActivityType, TaskPriority, TaskSlaCriteria, TaskSlaStatus, TaskSourceName, TaskStatus, TaskType, TaskUserType, UNKNOWN$1 as UNKNOWN, UiPath, UiPathError, UiPathMetaTags, UserSettingsMap, VERSION, ValidationError, createAgentWithMethods, createCaseInstanceWithMethods, createConversationWithMethods, createEntityWithMethods, createJobWithMethods, createProcessInstanceWithMethods, createProcessWithMethods, createTaskWithMethods, getAppBase, getAsset, getErrorDetails, getLimitedPageSize, isAuthenticationError, isAuthorizationError, isNetworkError, isNotFoundError, isRateLimitError, isServerError, isUiPathError, isValidationError, loadFromMetaTags, telemetryClient, track, trackEvent };
|
|
13628
|
+
export { APP_NAME, AgentMap, AssetValueScope, AssetValueType, AuthenticationError, AuthorizationError, BucketOptions, CLOUD_CLIENT_ID, CLOUD_ORGANIZATION_NAME, CLOUD_REDIRECT_URI, CLOUD_ROLE_NAME, CLOUD_TENANT_NAME, CLOUD_URL, CONNECTION_STRING, CitationErrorType, ConversationMap, DEFAULT_ITEMS_FIELD, DEFAULT_PAGE_SIZE, DEFAULT_TOTAL_COUNT_FIELD, DataDirectionType, DebugMode, index as DuFramework, EntityAggregateFunction, EntityFieldDataType, EntityType, ErrorType, EscalationActionType, EscalationRecipientScope, EscalationTriggerType, ExchangeMap, FeedbackRating, FeedbackStatus, FieldDisplayType, HttpStatus, InputStreamSpeechSensitivity, InterruptType, JobPriority, JobSourceType, JobState, JobSubState, JobType, JoinType, LogicalOperator$1 as LogicalOperator, MAX_PAGE_SIZE, MessageMap, MessageRole, NetworkError, NotFoundError, PackageSourceType, PackageType, ProcessIncidentSeverity, ProcessIncidentStatus, ProcessIncidentType, QueryFilterOperator, RateLimitError, ReferenceType, RemoteControlAccess, RobotSize, RuntimeType, SDK_LOGGER_NAME, SDK_RUN_EVENT, SDK_SERVICE_NAME, SDK_VERSION, SERVICE, SLADurationUnit, ServerError, ServerlessJobType, SortOrder, StageTaskType, StartStrategy, StopStrategy, TargetFramework, TaskActivityType, TaskPriority, TaskSlaCriteria, TaskSlaStatus, TaskSourceName, TaskStatus, TaskType, TaskUserType, UNKNOWN$1 as UNKNOWN, UiPath, UiPathError, UiPathMetaTags, UserSettingsMap, VERSION, ValidationError, createAgentWithMethods, createCaseInstanceWithMethods, createConversationWithMethods, createEntityWithMethods, createJobWithMethods, createProcessInstanceWithMethods, createProcessWithMethods, createTaskWithMethods, getAppBase, getAsset, getErrorDetails, getLimitedPageSize, isAuthenticationError, isAuthorizationError, isNetworkError, isNotFoundError, isRateLimitError, isServerError, isUiPathError, isValidationError, loadFromMetaTags, telemetryClient, track, trackEvent };
|