@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.umd.js
CHANGED
|
@@ -5028,6 +5028,7 @@
|
|
|
5028
5028
|
const GUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
5029
5029
|
class AuthService {
|
|
5030
5030
|
constructor(config, executionContext) {
|
|
5031
|
+
this.skipAcrValues = false;
|
|
5031
5032
|
// Only use stored OAuth context when completing an active callback (URL has ?code=).
|
|
5032
5033
|
// If stored context exists but we're NOT in a callback, it's stale from a
|
|
5033
5034
|
// failed/abandoned flow (e.g. scope mismatch, invalid redirect URI) and must
|
|
@@ -5119,6 +5120,14 @@
|
|
|
5119
5120
|
getTokenManager() {
|
|
5120
5121
|
return this.tokenManager;
|
|
5121
5122
|
}
|
|
5123
|
+
/**
|
|
5124
|
+
* Enables the UiPath login picker during OAuth sign-in.
|
|
5125
|
+
*
|
|
5126
|
+
* @internal
|
|
5127
|
+
*/
|
|
5128
|
+
setMultiLogin() {
|
|
5129
|
+
this.skipAcrValues = true;
|
|
5130
|
+
}
|
|
5122
5131
|
/**
|
|
5123
5132
|
* Authenticates the user based on the provided SDK configuration.
|
|
5124
5133
|
* This method handles OAuth 2.0 authentication flow only.
|
|
@@ -5320,7 +5329,10 @@
|
|
|
5320
5329
|
scope: params.scope + ' offline_access',
|
|
5321
5330
|
state: params.state || this.generateCodeVerifier().slice(0, 16)
|
|
5322
5331
|
});
|
|
5323
|
-
|
|
5332
|
+
const authorizeUrl = `${this.config.baseUrl}/${IDENTITY_ENDPOINTS.AUTHORIZE}?${queryParams.toString()}`;
|
|
5333
|
+
return this.skipAcrValues
|
|
5334
|
+
? authorizeUrl
|
|
5335
|
+
: `${authorizeUrl}&acr_values=${acrValues}`;
|
|
5324
5336
|
}
|
|
5325
5337
|
/**
|
|
5326
5338
|
* Exchanges the authorization code for an access token and automatically updates the current token
|
|
@@ -9209,7 +9221,7 @@
|
|
|
9209
9221
|
// Connection string placeholder that will be replaced during build
|
|
9210
9222
|
const CONNECTION_STRING = "InstrumentationKey=a6efa11d-1feb-4508-9738-e13e12dcae5e;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=7c58eb1c-9581-4ba6-839e-11725848a037";
|
|
9211
9223
|
// SDK Version placeholder
|
|
9212
|
-
const SDK_VERSION = "1.3.
|
|
9224
|
+
const SDK_VERSION = "1.3.7";
|
|
9213
9225
|
const VERSION = "Version";
|
|
9214
9226
|
const SERVICE = "Service";
|
|
9215
9227
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -9556,6 +9568,8 @@
|
|
|
9556
9568
|
// Asset resolution and routing
|
|
9557
9569
|
UiPathMetaTags["CDN_BASE"] = "uipath:cdn-base";
|
|
9558
9570
|
UiPathMetaTags["APP_BASE"] = "uipath:app-base";
|
|
9571
|
+
// Folder context (injected during coded-app deployment)
|
|
9572
|
+
UiPathMetaTags["FOLDER_KEY"] = "uipath:folder-key";
|
|
9559
9573
|
})(exports.UiPathMetaTags || (exports.UiPathMetaTags = {}));
|
|
9560
9574
|
|
|
9561
9575
|
/**
|
|
@@ -9584,12 +9598,13 @@
|
|
|
9584
9598
|
tenantName: getMetaTagContent(exports.UiPathMetaTags.TENANT_NAME),
|
|
9585
9599
|
baseUrl: getMetaTagContent(exports.UiPathMetaTags.BASE_URL),
|
|
9586
9600
|
redirectUri: getMetaTagContent(exports.UiPathMetaTags.REDIRECT_URI),
|
|
9601
|
+
folderKey: getMetaTagContent(exports.UiPathMetaTags.FOLDER_KEY),
|
|
9587
9602
|
};
|
|
9588
9603
|
const hasAnyValue = Object.values(config).some(Boolean);
|
|
9589
9604
|
return hasAnyValue ? config : null;
|
|
9590
9605
|
}
|
|
9591
9606
|
|
|
9592
|
-
var _UiPath_instances, _UiPath_config, _UiPath_authService, _UiPath_initialized, _UiPath_partialConfig, _UiPath_initializeWithConfig, _UiPath_loadConfig;
|
|
9607
|
+
var _UiPath_instances, _UiPath_config, _UiPath_authService, _UiPath_initialized, _UiPath_partialConfig, _UiPath_multiLogin, _UiPath_metaFolderKey, _UiPath_initializeWithConfig, _UiPath_loadConfig;
|
|
9593
9608
|
/**
|
|
9594
9609
|
* UiPath - Core SDK class for authentication and configuration management.
|
|
9595
9610
|
*
|
|
@@ -9629,8 +9644,14 @@
|
|
|
9629
9644
|
_UiPath_authService.set(this, void 0);
|
|
9630
9645
|
_UiPath_initialized.set(this, false);
|
|
9631
9646
|
_UiPath_partialConfig.set(this, void 0);
|
|
9647
|
+
_UiPath_multiLogin.set(this, false);
|
|
9648
|
+
// Folder key sourced only from `<meta name="uipath:folder-key">` (coded-app
|
|
9649
|
+
// deployments). Not accepted via the public constructor; lives here so the
|
|
9650
|
+
// SDK can flow it through to BaseService.config without polluting BaseConfig.
|
|
9651
|
+
_UiPath_metaFolderKey.set(this, void 0);
|
|
9632
9652
|
// Load configuration from meta tags
|
|
9633
9653
|
const configFromMetaTags = loadFromMetaTags();
|
|
9654
|
+
__classPrivateFieldSet(this, _UiPath_metaFolderKey, configFromMetaTags?.folderKey, "f");
|
|
9634
9655
|
// Merge configuration: constructor config overrides meta tags
|
|
9635
9656
|
const mergedConfig = config ? { ...configFromMetaTags, ...config } : configFromMetaTags;
|
|
9636
9657
|
if (mergedConfig && isCompleteConfig(mergedConfig)) {
|
|
@@ -9679,6 +9700,15 @@
|
|
|
9679
9700
|
throw new Error(`Failed to initialize UiPath SDK: ${errorMessage}`);
|
|
9680
9701
|
}
|
|
9681
9702
|
}
|
|
9703
|
+
/**
|
|
9704
|
+
* Enables the UiPath login picker during OAuth sign-in.
|
|
9705
|
+
*
|
|
9706
|
+
* @internal
|
|
9707
|
+
*/
|
|
9708
|
+
setMultiLogin() {
|
|
9709
|
+
__classPrivateFieldSet(this, _UiPath_multiLogin, true, "f");
|
|
9710
|
+
__classPrivateFieldGet(this, _UiPath_authService, "f")?.setMultiLogin();
|
|
9711
|
+
}
|
|
9682
9712
|
/**
|
|
9683
9713
|
* Check if the SDK has been initialized
|
|
9684
9714
|
*/
|
|
@@ -9750,7 +9780,7 @@
|
|
|
9750
9780
|
__classPrivateFieldGet(this, _UiPath_authService, "f")?.updateToken(tokenInfo);
|
|
9751
9781
|
}
|
|
9752
9782
|
};
|
|
9753
|
-
_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) {
|
|
9783
|
+
_UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_initialized = new WeakMap(), _UiPath_partialConfig = new WeakMap(), _UiPath_multiLogin = new WeakMap(), _UiPath_metaFolderKey = new WeakMap(), _UiPath_instances = new WeakSet(), _UiPath_initializeWithConfig = function _UiPath_initializeWithConfig(config) {
|
|
9754
9784
|
// Validate and normalize the configuration
|
|
9755
9785
|
validateConfig(config);
|
|
9756
9786
|
const hasSecretAuth = hasSecretConfig(config);
|
|
@@ -9763,16 +9793,22 @@
|
|
|
9763
9793
|
secret: hasSecretAuth ? config.secret : undefined,
|
|
9764
9794
|
clientId: hasOAuthAuth ? config.clientId : undefined,
|
|
9765
9795
|
redirectUri: hasOAuthAuth ? config.redirectUri : undefined,
|
|
9766
|
-
scope: hasOAuthAuth ? config.scope : undefined
|
|
9796
|
+
scope: hasOAuthAuth ? config.scope : undefined,
|
|
9767
9797
|
});
|
|
9768
9798
|
const executionContext = new ExecutionContext();
|
|
9769
9799
|
__classPrivateFieldSet(this, _UiPath_authService, new AuthService(internalConfig, executionContext), "f");
|
|
9800
|
+
if (__classPrivateFieldGet(this, _UiPath_multiLogin, "f")) {
|
|
9801
|
+
__classPrivateFieldGet(this, _UiPath_authService, "f").setMultiLogin();
|
|
9802
|
+
}
|
|
9770
9803
|
__classPrivateFieldSet(this, _UiPath_config, internalConfig, "f");
|
|
9771
|
-
// Store internals in SDKInternalsRegistry (not visible on instance)
|
|
9804
|
+
// Store internals in SDKInternalsRegistry (not visible on instance).
|
|
9805
|
+
// `folderKey` is meta-tag-only — kept off `UiPathConfig` (which mirrors
|
|
9806
|
+
// user-passed values) and lives here on the runtime registry instead.
|
|
9772
9807
|
SDKInternalsRegistry.set(this, {
|
|
9773
9808
|
config: internalConfig,
|
|
9774
9809
|
context: executionContext,
|
|
9775
|
-
tokenManager: __classPrivateFieldGet(this, _UiPath_authService, "f").getTokenManager()
|
|
9810
|
+
tokenManager: __classPrivateFieldGet(this, _UiPath_authService, "f").getTokenManager(),
|
|
9811
|
+
folderKey: __classPrivateFieldGet(this, _UiPath_metaFolderKey, "f"),
|
|
9776
9812
|
});
|
|
9777
9813
|
// Expose read-only config for user convenience
|
|
9778
9814
|
this.config = {
|
|
@@ -9800,6 +9836,7 @@
|
|
|
9800
9836
|
}, _UiPath_loadConfig = function _UiPath_loadConfig() {
|
|
9801
9837
|
// Load from meta tags
|
|
9802
9838
|
const metaConfig = loadFromMetaTags();
|
|
9839
|
+
__classPrivateFieldSet(this, _UiPath_metaFolderKey, metaConfig?.folderKey, "f");
|
|
9803
9840
|
// Merge with any partial config from constructor (constructor overrides meta tags)
|
|
9804
9841
|
const merged = { ...metaConfig, ...__classPrivateFieldGet(this, _UiPath_partialConfig, "f") };
|
|
9805
9842
|
if (!isCompleteConfig(merged)) {
|
|
@@ -10043,6 +10080,7 @@
|
|
|
10043
10080
|
}
|
|
10044
10081
|
|
|
10045
10082
|
const FOLDER_KEY = 'X-UIPATH-FolderKey';
|
|
10083
|
+
const FOLDER_PATH_ENCODED = 'X-UIPATH-FolderPath-Encoded';
|
|
10046
10084
|
const FOLDER_ID = 'X-UIPATH-OrganizationUnitId';
|
|
10047
10085
|
const TRACEPARENT = 'traceparent';
|
|
10048
10086
|
const UIPATH_TRACEPARENT_ID = 'x-uipath-traceparent-id';
|
|
@@ -11175,8 +11213,9 @@
|
|
|
11175
11213
|
constructor(instance, headers) {
|
|
11176
11214
|
// Private field - not visible via Object.keys() or any reflection
|
|
11177
11215
|
_BaseService_apiClient.set(this, void 0);
|
|
11178
|
-
const { config, context, tokenManager } = SDKInternalsRegistry.get(instance);
|
|
11216
|
+
const { config, context, tokenManager, folderKey } = SDKInternalsRegistry.get(instance);
|
|
11179
11217
|
__classPrivateFieldSet(this, _BaseService_apiClient, new ApiClient(config, context, tokenManager, headers ? { headers } : {}), "f");
|
|
11218
|
+
this.config = { folderKey };
|
|
11180
11219
|
}
|
|
11181
11220
|
/**
|
|
11182
11221
|
* Gets a valid authentication token, refreshing if necessary.
|
|
@@ -11538,6 +11577,17 @@
|
|
|
11538
11577
|
QueryFilterOperator["In"] = "in";
|
|
11539
11578
|
QueryFilterOperator["NotIn"] = "not in";
|
|
11540
11579
|
})(exports.QueryFilterOperator || (exports.QueryFilterOperator = {}));
|
|
11580
|
+
/**
|
|
11581
|
+
* Aggregate functions supported by the Data Fabric query API.
|
|
11582
|
+
*/
|
|
11583
|
+
exports.EntityAggregateFunction = void 0;
|
|
11584
|
+
(function (EntityAggregateFunction) {
|
|
11585
|
+
EntityAggregateFunction["Count"] = "COUNT";
|
|
11586
|
+
EntityAggregateFunction["Sum"] = "SUM";
|
|
11587
|
+
EntityAggregateFunction["Avg"] = "AVG";
|
|
11588
|
+
EntityAggregateFunction["Min"] = "MIN";
|
|
11589
|
+
EntityAggregateFunction["Max"] = "MAX";
|
|
11590
|
+
})(exports.EntityAggregateFunction || (exports.EntityAggregateFunction = {}));
|
|
11541
11591
|
/**
|
|
11542
11592
|
* Entity type enum
|
|
11543
11593
|
*/
|
|
@@ -12127,16 +12177,16 @@
|
|
|
12127
12177
|
return entities;
|
|
12128
12178
|
}
|
|
12129
12179
|
/**
|
|
12130
|
-
* Queries entity records with filters, sorting, and pagination
|
|
12180
|
+
* Queries entity records with filters, sorting, aggregates, and pagination
|
|
12131
12181
|
*
|
|
12132
12182
|
* @param id - UUID of the entity
|
|
12133
|
-
* @param options - Query options including filterGroup, selectedFields, sortOptions, and pagination
|
|
12183
|
+
* @param options - Query options including filterGroup, selectedFields, sortOptions, aggregates, groupBy, and pagination
|
|
12134
12184
|
* @returns Promise resolving to {@link NonPaginatedResponse} without pagination options,
|
|
12135
12185
|
* or {@link PaginatedResponse} when `pageSize`, `cursor`, or `jumpToPage` are provided
|
|
12136
12186
|
*
|
|
12137
12187
|
* @example
|
|
12138
12188
|
* ```typescript
|
|
12139
|
-
* import { Entities, LogicalOperator, QueryFilterOperator } from '@uipath/uipath-typescript/entities';
|
|
12189
|
+
* import { Entities, LogicalOperator, QueryFilterOperator, EntityAggregateFunction } from '@uipath/uipath-typescript/entities';
|
|
12140
12190
|
*
|
|
12141
12191
|
* const entities = new Entities(sdk);
|
|
12142
12192
|
*
|
|
@@ -12160,6 +12210,23 @@
|
|
|
12160
12210
|
* if (page1.hasNextPage) {
|
|
12161
12211
|
* const page2 = await entities.queryRecordsById("<entityId>", { cursor: page1.nextCursor });
|
|
12162
12212
|
* }
|
|
12213
|
+
*
|
|
12214
|
+
* // Aggregate: count of records per status
|
|
12215
|
+
* await entities.queryRecordsById("<entityId>", {
|
|
12216
|
+
* selectedFields: ["status"],
|
|
12217
|
+
* groupBy: ["status"],
|
|
12218
|
+
* aggregates: [
|
|
12219
|
+
* { function: EntityAggregateFunction.Count, field: "Id", alias: "total" },
|
|
12220
|
+
* ],
|
|
12221
|
+
* });
|
|
12222
|
+
*
|
|
12223
|
+
* // Aggregate: total sum and average across all records (no grouping)
|
|
12224
|
+
* await entities.queryRecordsById("<entityId>", {
|
|
12225
|
+
* aggregates: [
|
|
12226
|
+
* { function: EntityAggregateFunction.Sum, field: "amount", alias: "totalAmount" },
|
|
12227
|
+
* { function: EntityAggregateFunction.Avg, field: "amount", alias: "avgAmount" },
|
|
12228
|
+
* ],
|
|
12229
|
+
* });
|
|
12163
12230
|
* ```
|
|
12164
12231
|
*/
|
|
12165
12232
|
async queryRecordsById(id, options) {
|
|
@@ -12177,7 +12244,7 @@
|
|
|
12177
12244
|
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
12178
12245
|
}
|
|
12179
12246
|
},
|
|
12180
|
-
excludeFromPrefix: ['expansionLevel', 'filterGroup', 'selectedFields', 'sortOptions']
|
|
12247
|
+
excludeFromPrefix: ['expansionLevel', 'filterGroup', 'selectedFields', 'sortOptions', 'aggregates', 'groupBy']
|
|
12181
12248
|
}, options);
|
|
12182
12249
|
}
|
|
12183
12250
|
/**
|
|
@@ -14871,6 +14938,111 @@
|
|
|
14871
14938
|
track('CaseInstances.GetActionTasks')
|
|
14872
14939
|
], CaseInstancesService.prototype, "getActionTasks", null);
|
|
14873
14940
|
|
|
14941
|
+
/**
|
|
14942
|
+
* Validates the `name` argument passed to a `getByName(name, ...)` method.
|
|
14943
|
+
* Trims whitespace and rejects empty/whitespace-only names.
|
|
14944
|
+
*
|
|
14945
|
+
* @param resourceType - Resource label used in error messages (e.g. 'Asset', 'Process')
|
|
14946
|
+
* @param name - Resource name to validate
|
|
14947
|
+
* @returns The trimmed name
|
|
14948
|
+
* @throws ValidationError when `name` is missing or empty after trimming
|
|
14949
|
+
*/
|
|
14950
|
+
function validateName(resourceType, name) {
|
|
14951
|
+
if (!name) {
|
|
14952
|
+
throw new ValidationError({
|
|
14953
|
+
message: `${resourceType} name is required and cannot be empty.`,
|
|
14954
|
+
});
|
|
14955
|
+
}
|
|
14956
|
+
const trimmed = name.trim();
|
|
14957
|
+
if (!trimmed) {
|
|
14958
|
+
throw new ValidationError({
|
|
14959
|
+
message: `${resourceType} name is required and cannot be empty.`,
|
|
14960
|
+
});
|
|
14961
|
+
}
|
|
14962
|
+
return trimmed;
|
|
14963
|
+
}
|
|
14964
|
+
|
|
14965
|
+
/**
|
|
14966
|
+
* Encodes a folder path for the `X-UIPATH-FolderPath-Encoded` header.
|
|
14967
|
+
*
|
|
14968
|
+
* Orchestrator decodes this header as **base64-encoded UTF-16 LE bytes**
|
|
14969
|
+
* (see `HttpHeadersProviderExtensions.GetDecoded` + `OrganizationUnitProvider`
|
|
14970
|
+
* in the Orchestrator repo, which call `Encoding.Unicode.GetString(...)`).
|
|
14971
|
+
* URL-encoding is NOT what the server expects — it must be base64-of-UTF-16-LE
|
|
14972
|
+
* bytes.
|
|
14973
|
+
*
|
|
14974
|
+
* @param folderPath - The folder path (e.g. 'Shared/Finance')
|
|
14975
|
+
* @returns Base64 string suitable for the `X-UIPATH-FolderPath-Encoded` header
|
|
14976
|
+
*/
|
|
14977
|
+
function encodeFolderPathHeader(folderPath) {
|
|
14978
|
+
// Force little-endian regardless of host byte order. `Uint16Array` viewed
|
|
14979
|
+
// as `Uint8Array` would use the host's native order — correct on LE hosts
|
|
14980
|
+
// (x86/ARM-LE) but wrong on BE hosts. `DataView.setUint16(..., true)`
|
|
14981
|
+
// pins LE.
|
|
14982
|
+
const buf = new ArrayBuffer(folderPath.length * 2);
|
|
14983
|
+
const view = new DataView(buf);
|
|
14984
|
+
for (let i = 0; i < folderPath.length; i++) {
|
|
14985
|
+
view.setUint16(i * 2, folderPath.charCodeAt(i), true);
|
|
14986
|
+
}
|
|
14987
|
+
const bytes = new Uint8Array(buf);
|
|
14988
|
+
let binary = '';
|
|
14989
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
14990
|
+
binary += String.fromCharCode(bytes[i]);
|
|
14991
|
+
}
|
|
14992
|
+
// btoa is browser-native; Node 16+ also has it as a global
|
|
14993
|
+
return btoa(binary);
|
|
14994
|
+
}
|
|
14995
|
+
|
|
14996
|
+
/**
|
|
14997
|
+
* Resolves folder context into the appropriate Orchestrator folder headers.
|
|
14998
|
+
*
|
|
14999
|
+
* Centralized so all folder-scoped methods (e.g. `assets.getByName`,
|
|
15000
|
+
* `processes.getByName`, future Queues/Buckets/Jobs) share one implementation.
|
|
15001
|
+
*
|
|
15002
|
+
* Each input field maps directly to its header — no auto-detection or type
|
|
15003
|
+
* coercion. When multiple fields are supplied, all corresponding headers
|
|
15004
|
+
* are forwarded and the server resolves precedence.
|
|
15005
|
+
*
|
|
15006
|
+
* Routing:
|
|
15007
|
+
* - `folderId` → `X-UIPATH-OrganizationUnitId`
|
|
15008
|
+
* - `folderKey` → `X-UIPATH-FolderKey`
|
|
15009
|
+
* - `folderPath` → `X-UIPATH-FolderPath-Encoded`
|
|
15010
|
+
* - none set + `fallbackFolderKey` → fallback used as `X-UIPATH-FolderKey`
|
|
15011
|
+
* - none set + no fallback → `ValidationError`
|
|
15012
|
+
*
|
|
15013
|
+
* @throws ValidationError when no folder context can be resolved.
|
|
15014
|
+
*/
|
|
15015
|
+
function resolveFolderHeaders(input) {
|
|
15016
|
+
const { folderId, folderKey, folderPath, resourceType, fallbackFolderKey } = input;
|
|
15017
|
+
const trimmedKey = folderKey?.trim();
|
|
15018
|
+
const trimmedPath = folderPath?.trim();
|
|
15019
|
+
const headers = {};
|
|
15020
|
+
if (folderId !== undefined) {
|
|
15021
|
+
headers[FOLDER_ID] = folderId;
|
|
15022
|
+
}
|
|
15023
|
+
if (trimmedKey) {
|
|
15024
|
+
headers[FOLDER_KEY] = trimmedKey;
|
|
15025
|
+
}
|
|
15026
|
+
if (trimmedPath) {
|
|
15027
|
+
headers[FOLDER_PATH_ENCODED] = encodeFolderPathHeader(trimmedPath);
|
|
15028
|
+
}
|
|
15029
|
+
// No explicit folder context → meta-tag fallback or error.
|
|
15030
|
+
if (Object.keys(headers).length === 0) {
|
|
15031
|
+
if (!fallbackFolderKey) {
|
|
15032
|
+
throw new ValidationError({
|
|
15033
|
+
message: `${resourceType} requires folder context: pass \`folderId\`, \`folderKey\`, or \`folderPath\`, or initialize the SDK with a folder context.`,
|
|
15034
|
+
});
|
|
15035
|
+
}
|
|
15036
|
+
headers[FOLDER_KEY] = fallbackFolderKey;
|
|
15037
|
+
}
|
|
15038
|
+
return createHeaders(headers);
|
|
15039
|
+
}
|
|
15040
|
+
|
|
15041
|
+
/**
|
|
15042
|
+
* Matches single-quote characters in OData string literals — escaped to `''`
|
|
15043
|
+
* inside the `$filter=Name eq '…'` clause built by `getByNameLookup`.
|
|
15044
|
+
*/
|
|
15045
|
+
const SINGLE_QUOTE_RE = /'/g;
|
|
14874
15046
|
/**
|
|
14875
15047
|
* Base service for services that need folder-specific functionality.
|
|
14876
15048
|
*
|
|
@@ -14904,6 +15076,68 @@
|
|
|
14904
15076
|
}
|
|
14905
15077
|
return response.data?.value;
|
|
14906
15078
|
}
|
|
15079
|
+
/**
|
|
15080
|
+
* Look up a single resource by name on a folder-scoped OData collection.
|
|
15081
|
+
*
|
|
15082
|
+
* Shared by `getByName` implementations across services (Assets, Processes, etc).
|
|
15083
|
+
* Handles:
|
|
15084
|
+
* - Name validation via `validateName`
|
|
15085
|
+
* - Folder header resolution via `resolveFolderHeaders` (folderId → ID/key
|
|
15086
|
+
* header by type, folderPath → encoded path header, falls back to
|
|
15087
|
+
* init-time `config.folderKey` from the `uipath:folder-key` meta tag)
|
|
15088
|
+
* - OData `$filter=Name eq '…'` with single-quote escaping + `$top=1`
|
|
15089
|
+
* - Empty-result → `NotFoundError` with folder context in the message
|
|
15090
|
+
*
|
|
15091
|
+
* The transform step is caller-provided because each resource has its own
|
|
15092
|
+
* PascalCase → camelCase field mapping.
|
|
15093
|
+
*
|
|
15094
|
+
* @param resourceType - Resource label used in validation + error messages (e.g. 'Asset', 'Process')
|
|
15095
|
+
* @param endpoint - Folder-scoped OData collection endpoint
|
|
15096
|
+
* @param name - Resource name to search for
|
|
15097
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) + OData query options (`expand`, `select`)
|
|
15098
|
+
* @param transform - Maps a raw OData item to the typed response (e.g. PascalCase → camelCase via field map)
|
|
15099
|
+
* @throws ValidationError when inputs are malformed; NotFoundError when no match
|
|
15100
|
+
*/
|
|
15101
|
+
async getByNameLookup(resourceType, endpoint, name, options, transform) {
|
|
15102
|
+
const validatedName = validateName(resourceType, name);
|
|
15103
|
+
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
15104
|
+
const headers = resolveFolderHeaders({
|
|
15105
|
+
folderId,
|
|
15106
|
+
folderKey,
|
|
15107
|
+
folderPath,
|
|
15108
|
+
resourceType: `${resourceType}.getByName`,
|
|
15109
|
+
fallbackFolderKey: this.config.folderKey,
|
|
15110
|
+
});
|
|
15111
|
+
const apiOptions = {
|
|
15112
|
+
...addPrefixToKeys(queryOptions, ODATA_PREFIX, Object.keys(queryOptions)),
|
|
15113
|
+
'$filter': `Name eq '${validatedName.replace(SINGLE_QUOTE_RE, "''")}'`,
|
|
15114
|
+
'$top': '1',
|
|
15115
|
+
};
|
|
15116
|
+
const response = await this.get(endpoint, {
|
|
15117
|
+
headers,
|
|
15118
|
+
params: apiOptions,
|
|
15119
|
+
});
|
|
15120
|
+
const items = response.data?.value;
|
|
15121
|
+
if (!items?.length) {
|
|
15122
|
+
const folderHint = describeFolderForError(folderId, folderKey, folderPath);
|
|
15123
|
+
throw new NotFoundError({
|
|
15124
|
+
message: `${resourceType} '${validatedName}' not found${folderHint}.`,
|
|
15125
|
+
});
|
|
15126
|
+
}
|
|
15127
|
+
return transform(items[0]);
|
|
15128
|
+
}
|
|
15129
|
+
}
|
|
15130
|
+
/** Renders the supplied folder for a NotFoundError message. */
|
|
15131
|
+
function describeFolderForError(folderId, folderKey, folderPath) {
|
|
15132
|
+
const path = folderPath?.trim();
|
|
15133
|
+
if (path)
|
|
15134
|
+
return ` in folder '${path}'`;
|
|
15135
|
+
const key = folderKey?.trim();
|
|
15136
|
+
if (key)
|
|
15137
|
+
return ` in folder (key: ${key})`;
|
|
15138
|
+
if (typeof folderId === 'number')
|
|
15139
|
+
return ` in folder (id: ${folderId})`;
|
|
15140
|
+
return '';
|
|
14907
15141
|
}
|
|
14908
15142
|
|
|
14909
15143
|
/**
|
|
@@ -15001,6 +15235,35 @@
|
|
|
15001
15235
|
const transformedAsset = transformData(pascalToCamelCaseKeys(response.data), AssetMap);
|
|
15002
15236
|
return transformedAsset;
|
|
15003
15237
|
}
|
|
15238
|
+
/**
|
|
15239
|
+
* Retrieves a single asset by name.
|
|
15240
|
+
*
|
|
15241
|
+
* @param name - Asset name to search for
|
|
15242
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
|
|
15243
|
+
* @returns Promise resolving to a single asset
|
|
15244
|
+
* {@link AssetGetResponse}
|
|
15245
|
+
* @example
|
|
15246
|
+
* ```typescript
|
|
15247
|
+
* import { Assets } from '@uipath/uipath-typescript/assets';
|
|
15248
|
+
*
|
|
15249
|
+
* const assets = new Assets(sdk);
|
|
15250
|
+
*
|
|
15251
|
+
* // By folder ID
|
|
15252
|
+
* await assets.getByName('ApiKey', { folderId: 123 });
|
|
15253
|
+
*
|
|
15254
|
+
* // By folder key (GUID)
|
|
15255
|
+
* await assets.getByName('ApiKey', { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
|
|
15256
|
+
*
|
|
15257
|
+
* // By folder path
|
|
15258
|
+
* await assets.getByName('ApiKey', { folderPath: 'Shared/Finance' });
|
|
15259
|
+
*
|
|
15260
|
+
* // With expand
|
|
15261
|
+
* await assets.getByName('ApiKey', { folderPath: 'Shared/Finance', expand: 'keyValueList' });
|
|
15262
|
+
* ```
|
|
15263
|
+
*/
|
|
15264
|
+
async getByName(name, options = {}) {
|
|
15265
|
+
return this.getByNameLookup('Asset', ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap));
|
|
15266
|
+
}
|
|
15004
15267
|
}
|
|
15005
15268
|
__decorate([
|
|
15006
15269
|
track('Assets.GetAll')
|
|
@@ -15008,6 +15271,9 @@
|
|
|
15008
15271
|
__decorate([
|
|
15009
15272
|
track('Assets.GetById')
|
|
15010
15273
|
], AssetService.prototype, "getById", null);
|
|
15274
|
+
__decorate([
|
|
15275
|
+
track('Assets.GetByName')
|
|
15276
|
+
], AssetService.prototype, "getByName", null);
|
|
15011
15277
|
|
|
15012
15278
|
/**
|
|
15013
15279
|
* Enum for Asset Value Scope
|
|
@@ -16111,7 +16377,7 @@
|
|
|
16111
16377
|
/**
|
|
16112
16378
|
* Service for interacting with UiPath Orchestrator Processes API
|
|
16113
16379
|
*/
|
|
16114
|
-
class ProcessService extends
|
|
16380
|
+
class ProcessService extends FolderScopedService {
|
|
16115
16381
|
/**
|
|
16116
16382
|
* Gets all processes across folders with optional filtering and folder scoping
|
|
16117
16383
|
*
|
|
@@ -16248,6 +16514,35 @@
|
|
|
16248
16514
|
const transformedProcess = transformData(pascalToCamelCaseKeys(response.data), ProcessMap);
|
|
16249
16515
|
return transformedProcess;
|
|
16250
16516
|
}
|
|
16517
|
+
/**
|
|
16518
|
+
* Retrieves a single process by name.
|
|
16519
|
+
*
|
|
16520
|
+
* @param name - Process name to search for
|
|
16521
|
+
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional query parameters (`expand`, `select`)
|
|
16522
|
+
* @returns Promise resolving to a single process
|
|
16523
|
+
* {@link ProcessGetResponse}
|
|
16524
|
+
* @example
|
|
16525
|
+
* ```typescript
|
|
16526
|
+
* import { Processes } from '@uipath/uipath-typescript/processes';
|
|
16527
|
+
*
|
|
16528
|
+
* const processes = new Processes(sdk);
|
|
16529
|
+
*
|
|
16530
|
+
* // By folder ID
|
|
16531
|
+
* await processes.getByName('MyProcess', { folderId: 123 });
|
|
16532
|
+
*
|
|
16533
|
+
* // By folder key (GUID)
|
|
16534
|
+
* await processes.getByName('MyProcess', { folderKey: '5f6dadf1-3677-49dc-8aca-c2999dd4b3ba' });
|
|
16535
|
+
*
|
|
16536
|
+
* // By folder path
|
|
16537
|
+
* await processes.getByName('MyProcess', { folderPath: 'Shared/Finance' });
|
|
16538
|
+
*
|
|
16539
|
+
* // With expand
|
|
16540
|
+
* await processes.getByName('MyProcess', { folderPath: 'Shared/Finance', expand: 'entryPoints' });
|
|
16541
|
+
* ```
|
|
16542
|
+
*/
|
|
16543
|
+
async getByName(name, options = {}) {
|
|
16544
|
+
return this.getByNameLookup('Process', PROCESS_ENDPOINTS.GET_ALL, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), ProcessMap));
|
|
16545
|
+
}
|
|
16251
16546
|
}
|
|
16252
16547
|
__decorate([
|
|
16253
16548
|
track('Processes.GetAll')
|
|
@@ -16258,6 +16553,9 @@
|
|
|
16258
16553
|
__decorate([
|
|
16259
16554
|
track('Processes.GetById')
|
|
16260
16555
|
], ProcessService.prototype, "getById", null);
|
|
16556
|
+
__decorate([
|
|
16557
|
+
track('Processes.GetByName')
|
|
16558
|
+
], ProcessService.prototype, "getByName", null);
|
|
16261
16559
|
|
|
16262
16560
|
/**
|
|
16263
16561
|
* Maps fields for Queue entities to ensure consistent naming
|
|
@@ -16735,7 +17033,7 @@
|
|
|
16735
17033
|
};
|
|
16736
17034
|
|
|
16737
17035
|
/**
|
|
16738
|
-
* Constants for User Service
|
|
17036
|
+
* Constants for User Settings Service
|
|
16739
17037
|
*/
|
|
16740
17038
|
/**
|
|
16741
17039
|
* Maps fields for User Settings entities to ensure consistent SDK naming
|