@uipath/uipath-typescript 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-memory/index.cjs +16 -9
- package/dist/agent-memory/index.mjs +16 -9
- package/dist/agents/index.cjs +278 -9
- package/dist/agents/index.d.ts +465 -6
- package/dist/agents/index.mjs +279 -10
- package/dist/assets/index.cjs +16 -9
- package/dist/assets/index.mjs +16 -9
- package/dist/attachments/index.cjs +16 -9
- package/dist/attachments/index.mjs +16 -9
- package/dist/buckets/index.cjs +114 -124
- package/dist/buckets/index.d.ts +197 -84
- package/dist/buckets/index.mjs +114 -124
- package/dist/cases/index.cjs +79 -13
- package/dist/cases/index.d.ts +30 -3
- package/dist/cases/index.mjs +79 -13
- package/dist/conversational-agent/index.cjs +16 -9
- package/dist/conversational-agent/index.mjs +16 -9
- package/dist/core/index.cjs +35 -6
- package/dist/core/index.mjs +35 -6
- package/dist/entities/index.cjs +253 -69
- package/dist/entities/index.d.ts +343 -116
- package/dist/entities/index.mjs +253 -69
- package/dist/feedback/index.cjs +16 -9
- package/dist/feedback/index.mjs +16 -9
- package/dist/governance/index.cjs +16 -9
- package/dist/governance/index.mjs +16 -9
- package/dist/index.cjs +529 -193
- package/dist/index.d.ts +2141 -750
- package/dist/index.mjs +529 -194
- package/dist/index.umd.js +529 -193
- package/dist/jobs/index.cjs +16 -9
- package/dist/jobs/index.mjs +16 -9
- package/dist/maestro-processes/index.cjs +16 -9
- package/dist/maestro-processes/index.mjs +16 -9
- package/dist/orchestrator-du-module/index.cjs +1788 -0
- package/dist/orchestrator-du-module/index.d.ts +757 -0
- package/dist/orchestrator-du-module/index.mjs +1785 -0
- package/dist/processes/index.cjs +16 -9
- package/dist/processes/index.mjs +16 -9
- package/dist/queues/index.cjs +16 -9
- package/dist/queues/index.mjs +16 -9
- package/dist/tasks/index.cjs +79 -13
- package/dist/tasks/index.d.ts +109 -4
- package/dist/tasks/index.mjs +80 -14
- package/dist/traces/index.cjs +303 -9
- package/dist/traces/index.d.ts +482 -2
- package/dist/traces/index.mjs +302 -10
- package/package.json +11 -1
package/dist/index.cjs
CHANGED
|
@@ -4498,6 +4498,24 @@ exports.TaskActivityType = void 0;
|
|
|
4498
4498
|
TaskActivityType["BulkCompleted"] = "BulkCompleted";
|
|
4499
4499
|
TaskActivityType["FirstOpened"] = "FirstOpened";
|
|
4500
4500
|
})(exports.TaskActivityType || (exports.TaskActivityType = {}));
|
|
4501
|
+
/**
|
|
4502
|
+
* Defines how a task assignment is distributed.
|
|
4503
|
+
*
|
|
4504
|
+
* Defaults to {@link TaskAssignmentCriteria.SingleUser} (a direct single-user
|
|
4505
|
+
* assignment) when not specified. The group-based criteria tell Action Center
|
|
4506
|
+
* how to distribute the task across the members of a directory group.
|
|
4507
|
+
*/
|
|
4508
|
+
exports.TaskAssignmentCriteria = void 0;
|
|
4509
|
+
(function (TaskAssignmentCriteria) {
|
|
4510
|
+
/** Assigned to a single user, like a direct assignment. */
|
|
4511
|
+
TaskAssignmentCriteria["SingleUser"] = "SingleUser";
|
|
4512
|
+
/** Assigned to the group member with the fewest pending tasks. */
|
|
4513
|
+
TaskAssignmentCriteria["Workload"] = "Workload";
|
|
4514
|
+
/** Assigned to all users in the group. */
|
|
4515
|
+
TaskAssignmentCriteria["AllUsers"] = "AllUsers";
|
|
4516
|
+
/** Assigned in a round-robin manner across the group's members. */
|
|
4517
|
+
TaskAssignmentCriteria["RoundRobin"] = "RoundRobin";
|
|
4518
|
+
})(exports.TaskAssignmentCriteria || (exports.TaskAssignmentCriteria = {}));
|
|
4501
4519
|
|
|
4502
4520
|
/**
|
|
4503
4521
|
* Base path constants for different services
|
|
@@ -4654,6 +4672,9 @@ const DATA_FABRIC_TENANT_FOLDER_ID = '00000000-0000-0000-0000-000000000000';
|
|
|
4654
4672
|
const DATA_FABRIC_ENDPOINTS = {
|
|
4655
4673
|
ENTITY: {
|
|
4656
4674
|
GET_ALL: `${DATAFABRIC_BASE}/api/Entity`,
|
|
4675
|
+
// Lists tenant-level and folder-level entities together.
|
|
4676
|
+
// Used by getAll when includeFolderEntities is true.
|
|
4677
|
+
GET_ALL_V2: `${DATAFABRIC_BASE}/api/v2/Entity`,
|
|
4657
4678
|
GET_ENTITY_RECORDS: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/read`,
|
|
4658
4679
|
GET_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/Entity/${entityId}`,
|
|
4659
4680
|
GET_RECORD_BY_ID: (entityId, recordId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/read/${recordId}`,
|
|
@@ -4737,6 +4758,15 @@ function isTokenExpired(tokenInfo) {
|
|
|
4737
4758
|
return true;
|
|
4738
4759
|
return new Date() >= tokenInfo.expiresAt;
|
|
4739
4760
|
}
|
|
4761
|
+
/**
|
|
4762
|
+
* The validated host origin when the app is running as a trusted, generic
|
|
4763
|
+
* host-embedded app (`?host=embed&basedomain=<origin>` with an allowlisted
|
|
4764
|
+
* UiPath origin); otherwise null. Shared by TokenManager (to create the
|
|
4765
|
+
* EmbeddedTokenManager) and UiPath init (to seed an empty token so getValidToken
|
|
4766
|
+
* can bootstrap the postMessage token flow), which previously duplicated this
|
|
4767
|
+
* condition inline.
|
|
4768
|
+
*/
|
|
4769
|
+
const trustedEmbeddingOrigin = isHostEmbedded && embeddingOrigin && isValidHostOrigin(embeddingOrigin) ? embeddingOrigin : null;
|
|
4740
4770
|
/**
|
|
4741
4771
|
* Waits for the next window message that satisfies `filter`.
|
|
4742
4772
|
* Rejects if the AbortSignal fires before a matching message arrives.
|
|
@@ -4983,7 +5013,7 @@ class EmbeddedTokenManager {
|
|
|
4983
5013
|
* SDK's public API.
|
|
4984
5014
|
*/
|
|
4985
5015
|
/** SDK version placeholder — patched by the SDK publish workflow. */
|
|
4986
|
-
const SDK_VERSION = '1.4.
|
|
5016
|
+
const SDK_VERSION = '1.4.1';
|
|
4987
5017
|
const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
|
|
4988
5018
|
const SDK_SERVICE_NAME = 'UiPath.TypeScript.Sdk';
|
|
4989
5019
|
const SDK_LOGGER_NAME = 'uipath-ts-sdk-telemetry';
|
|
@@ -5163,8 +5193,8 @@ class TokenManager {
|
|
|
5163
5193
|
this.actionCenterTokenManager = new ActionCenterTokenManager(config, (tokenInfo) => this.setToken(tokenInfo));
|
|
5164
5194
|
this.isOAuth = false;
|
|
5165
5195
|
}
|
|
5166
|
-
else if (
|
|
5167
|
-
this.embeddedTokenManager = new EmbeddedTokenManager(
|
|
5196
|
+
else if (trustedEmbeddingOrigin) {
|
|
5197
|
+
this.embeddedTokenManager = new EmbeddedTokenManager(trustedEmbeddingOrigin, config, tokenInfo => this.setToken(tokenInfo));
|
|
5168
5198
|
this.isOAuth = false;
|
|
5169
5199
|
}
|
|
5170
5200
|
}
|
|
@@ -6223,10 +6253,12 @@ _UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_ini
|
|
|
6223
6253
|
});
|
|
6224
6254
|
// Track SDK initialization
|
|
6225
6255
|
trackEvent('Sdk.Auth');
|
|
6226
|
-
/** Auto-initialize for secret-based auth
|
|
6227
|
-
* When viewed in Action Center
|
|
6256
|
+
/** Auto-initialize for secret-based auth, Action Center, and generic host-embedded apps.
|
|
6257
|
+
* When viewed in Action Center or embedded in a UiPath host frame via the UIP protocol,
|
|
6258
|
+
* initialize tokenInfo with an empty token so getValidToken() can bootstrap via postMessage.
|
|
6259
|
+
* When an sdk call is made, the host passes the token to the sdk.
|
|
6228
6260
|
*/
|
|
6229
|
-
if (hasSecretAuth || isInActionCenter) {
|
|
6261
|
+
if (hasSecretAuth || isInActionCenter || trustedEmbeddingOrigin) {
|
|
6230
6262
|
__classPrivateFieldGet(this, _UiPath_authService, "f").authenticateWithSecret(config.secret ?? '');
|
|
6231
6263
|
__classPrivateFieldSet(this, _UiPath_initialized, true, "f");
|
|
6232
6264
|
}
|
|
@@ -7452,12 +7484,18 @@ class PaginationHelpers {
|
|
|
7452
7484
|
* @returns Promise resolving to a paginated result
|
|
7453
7485
|
*/
|
|
7454
7486
|
static async getAllPaginated(params) {
|
|
7455
|
-
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
7487
|
+
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
7456
7488
|
const endpoint = getEndpoint(folderId);
|
|
7457
7489
|
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
7490
|
+
// On POST, the caller's options go in the body; queryParams stays in the URL.
|
|
7491
|
+
// On GET, everything is URL — queryParams merges with additionalParams.
|
|
7492
|
+
const isPost = method === HTTP_METHODS.POST;
|
|
7493
|
+
const requestSpec = isPost
|
|
7494
|
+
? { body: additionalParams, params: queryParams }
|
|
7495
|
+
: { params: { ...additionalParams, ...queryParams } };
|
|
7458
7496
|
const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
|
|
7459
7497
|
headers,
|
|
7460
|
-
|
|
7498
|
+
...requestSpec,
|
|
7461
7499
|
pagination: {
|
|
7462
7500
|
paginationType: options.paginationType || PaginationType.OFFSET,
|
|
7463
7501
|
itemsField: options.itemsField || DEFAULT_ITEMS_FIELD,
|
|
@@ -7482,7 +7520,7 @@ class PaginationHelpers {
|
|
|
7482
7520
|
* @returns Promise resolving to an object with data and totalCount
|
|
7483
7521
|
*/
|
|
7484
7522
|
static async getAllNonPaginated(params) {
|
|
7485
|
-
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
7523
|
+
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
7486
7524
|
// Set default field names
|
|
7487
7525
|
const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
|
|
7488
7526
|
const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
|
|
@@ -7492,11 +7530,11 @@ class PaginationHelpers {
|
|
|
7492
7530
|
// Make the API call based on method
|
|
7493
7531
|
let response;
|
|
7494
7532
|
if (method === HTTP_METHODS.POST) {
|
|
7495
|
-
response = await serviceAccess.post(endpoint, additionalParams, { headers });
|
|
7533
|
+
response = await serviceAccess.post(endpoint, additionalParams, { headers, params: queryParams });
|
|
7496
7534
|
}
|
|
7497
7535
|
else {
|
|
7498
7536
|
response = await serviceAccess.get(endpoint, {
|
|
7499
|
-
params: additionalParams,
|
|
7537
|
+
params: { ...additionalParams, ...queryParams },
|
|
7500
7538
|
headers
|
|
7501
7539
|
});
|
|
7502
7540
|
}
|
|
@@ -7551,6 +7589,7 @@ class PaginationHelpers {
|
|
|
7551
7589
|
headers: config.headers,
|
|
7552
7590
|
paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
|
|
7553
7591
|
additionalParams: prefixedOptions,
|
|
7592
|
+
queryParams: config.queryParams,
|
|
7554
7593
|
transformFn: config.transformFn,
|
|
7555
7594
|
method: config.method,
|
|
7556
7595
|
options: {
|
|
@@ -7568,6 +7607,7 @@ class PaginationHelpers {
|
|
|
7568
7607
|
folderId,
|
|
7569
7608
|
headers: config.headers,
|
|
7570
7609
|
additionalParams: prefixedOptions,
|
|
7610
|
+
queryParams: config.queryParams,
|
|
7571
7611
|
transformFn: config.transformFn,
|
|
7572
7612
|
method: config.method,
|
|
7573
7613
|
options: {
|
|
@@ -7704,18 +7744,17 @@ class BaseService {
|
|
|
7704
7744
|
const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
|
|
7705
7745
|
// Prepare request parameters based on pagination type
|
|
7706
7746
|
const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
|
|
7707
|
-
//
|
|
7747
|
+
// Route pagination state to wherever the API expects it (body for POST, URL for GET).
|
|
7748
|
+
// Caller-supplied options.body / options.params are respected as-is — the api-client
|
|
7749
|
+
// already handles params (URL) and body (request body) independently for every method.
|
|
7708
7750
|
if (method.toUpperCase() === 'POST') {
|
|
7709
7751
|
const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
|
|
7710
7752
|
options.body = {
|
|
7711
7753
|
...existingBody,
|
|
7712
|
-
...options.params,
|
|
7713
7754
|
...requestParams
|
|
7714
7755
|
};
|
|
7715
|
-
options.params = undefined;
|
|
7716
7756
|
}
|
|
7717
7757
|
else {
|
|
7718
|
-
// Merge pagination parameters with existing parameters
|
|
7719
7758
|
options.params = {
|
|
7720
7759
|
...options.params,
|
|
7721
7760
|
...requestParams
|
|
@@ -8129,6 +8168,14 @@ var SqlFieldType;
|
|
|
8129
8168
|
SqlFieldType["MULTILINE"] = "MULTILINE";
|
|
8130
8169
|
})(SqlFieldType || (SqlFieldType = {}));
|
|
8131
8170
|
|
|
8171
|
+
/**
|
|
8172
|
+
* Numeric type IDs that pair with {@link EntityType} on reference payloads
|
|
8173
|
+
* (entityType + entityTypeId travel together in `referenceEntity` /
|
|
8174
|
+
* `referenceChoiceSet` bodies on cross-folder schema upserts).
|
|
8175
|
+
*/
|
|
8176
|
+
const ENTITY_TYPE_IDS = {
|
|
8177
|
+
[exports.EntityType.ChoiceSet]: 1,
|
|
8178
|
+
};
|
|
8132
8179
|
/**
|
|
8133
8180
|
* Maps fields for Entities
|
|
8134
8181
|
*/
|
|
@@ -8262,7 +8309,7 @@ class EntityService extends BaseService {
|
|
|
8262
8309
|
* Gets entity metadata by entity ID with attached operation methods
|
|
8263
8310
|
*
|
|
8264
8311
|
* @param id - UUID of the entity
|
|
8265
|
-
* @param options - Optional {@link EntityGetByIdOptions} (e.g. `folderKey` for folder-scoped entities)
|
|
8312
|
+
* @param options - Optional {@link EntityGetByIdOptions} (e.g. `folderKey` for folder-scoped entities) The `folderKey` property is **experimental**.
|
|
8266
8313
|
* @returns Promise resolving to entity metadata with schema information and operation methods
|
|
8267
8314
|
*
|
|
8268
8315
|
* @example
|
|
@@ -8302,7 +8349,7 @@ class EntityService extends BaseService {
|
|
|
8302
8349
|
* Gets entity records by entity ID
|
|
8303
8350
|
*
|
|
8304
8351
|
* @param entityId - UUID of the entity
|
|
8305
|
-
* @param options - Query options including expansionLevel and pagination options
|
|
8352
|
+
* @param options - Query options including expansionLevel and pagination options The `folderKey` property is **experimental**.
|
|
8306
8353
|
* @returns Promise resolving to an array of entity records or paginated response
|
|
8307
8354
|
*
|
|
8308
8355
|
* @example
|
|
@@ -8330,6 +8377,9 @@ class EntityService extends BaseService {
|
|
|
8330
8377
|
* cursor: paginatedResponse.nextCursor,
|
|
8331
8378
|
* expansionLevel: 1
|
|
8332
8379
|
* });
|
|
8380
|
+
*
|
|
8381
|
+
* // Folder-scoped entity: pass the entity's folder key
|
|
8382
|
+
* const records = await entities.getAllRecords("<entityId>", { folderKey: "<folderKey>" });
|
|
8333
8383
|
* ```
|
|
8334
8384
|
*/
|
|
8335
8385
|
async getAllRecords(entityId, options) {
|
|
@@ -8359,7 +8409,7 @@ class EntityService extends BaseService {
|
|
|
8359
8409
|
*
|
|
8360
8410
|
* @param entityId - UUID of the entity
|
|
8361
8411
|
* @param recordId - UUID of the record
|
|
8362
|
-
* @param options - Query options including expansionLevel
|
|
8412
|
+
* @param options - Query options including `expansionLevel` and `folderKey` The `folderKey` property is **experimental**.
|
|
8363
8413
|
* @returns Promise resolving to the entity record
|
|
8364
8414
|
*
|
|
8365
8415
|
* @example
|
|
@@ -8371,6 +8421,11 @@ class EntityService extends BaseService {
|
|
|
8371
8421
|
* const record = await sdk.entities.getRecordById(<entityId>, <recordId>, {
|
|
8372
8422
|
* expansionLevel: 1
|
|
8373
8423
|
* });
|
|
8424
|
+
*
|
|
8425
|
+
* // Folder-scoped entity: pass the entity's folder key
|
|
8426
|
+
* const record = await sdk.entities.getRecordById(<entityId>, <recordId>, {
|
|
8427
|
+
* folderKey: "<folderKey>"
|
|
8428
|
+
* });
|
|
8374
8429
|
* ```
|
|
8375
8430
|
*/
|
|
8376
8431
|
async getRecordById(entityId, recordId, options = {}) {
|
|
@@ -8385,7 +8440,7 @@ class EntityService extends BaseService {
|
|
|
8385
8440
|
*
|
|
8386
8441
|
* @param entityId - UUID of the entity
|
|
8387
8442
|
* @param data - Record to insert
|
|
8388
|
-
* @param options - Insert options
|
|
8443
|
+
* @param options - Insert options The `folderKey` property is **experimental**.
|
|
8389
8444
|
* @returns Promise resolving to the inserted record with generated record ID
|
|
8390
8445
|
*
|
|
8391
8446
|
* @example
|
|
@@ -8401,6 +8456,11 @@ class EntityService extends BaseService {
|
|
|
8401
8456
|
* const result = await entities.insertRecordById("<entityId>", { name: "John", age: 30 }, {
|
|
8402
8457
|
* expansionLevel: 1
|
|
8403
8458
|
* });
|
|
8459
|
+
*
|
|
8460
|
+
* // Folder-scoped entity: pass the entity's folder key
|
|
8461
|
+
* await entities.insertRecordById("<entityId>", { name: "John", age: 30 }, {
|
|
8462
|
+
* folderKey: "<folderKey>"
|
|
8463
|
+
* });
|
|
8404
8464
|
* ```
|
|
8405
8465
|
*/
|
|
8406
8466
|
async insertRecordById(id, data, options = {}) {
|
|
@@ -8418,7 +8478,7 @@ class EntityService extends BaseService {
|
|
|
8418
8478
|
*
|
|
8419
8479
|
* @param entityId - UUID of the entity
|
|
8420
8480
|
* @param data - Array of records to insert
|
|
8421
|
-
* @param options - Insert options
|
|
8481
|
+
* @param options - Insert options The `folderKey` property is **experimental**.
|
|
8422
8482
|
* @returns Promise resolving to insert response
|
|
8423
8483
|
*
|
|
8424
8484
|
* @example
|
|
@@ -8441,6 +8501,12 @@ class EntityService extends BaseService {
|
|
|
8441
8501
|
* expansionLevel: 1,
|
|
8442
8502
|
* failOnFirst: true
|
|
8443
8503
|
* });
|
|
8504
|
+
*
|
|
8505
|
+
* // Folder-scoped entity: pass the entity's folder key
|
|
8506
|
+
* await entities.insertRecordsById("<entityId>", [
|
|
8507
|
+
* { name: "John", age: 30 },
|
|
8508
|
+
* { name: "Jane", age: 25 }
|
|
8509
|
+
* ], { folderKey: "<folderKey>" });
|
|
8444
8510
|
* ```
|
|
8445
8511
|
*/
|
|
8446
8512
|
async insertRecordsById(id, data, options = {}) {
|
|
@@ -8460,7 +8526,7 @@ class EntityService extends BaseService {
|
|
|
8460
8526
|
* @param entityId - UUID of the entity
|
|
8461
8527
|
* @param recordId - UUID of the record to update
|
|
8462
8528
|
* @param data - Key-value pairs of fields to update
|
|
8463
|
-
* @param options - Update options
|
|
8529
|
+
* @param options - Update options The `folderKey` property is **experimental**.
|
|
8464
8530
|
* @returns Promise resolving to the updated record
|
|
8465
8531
|
*
|
|
8466
8532
|
* @example
|
|
@@ -8476,6 +8542,11 @@ class EntityService extends BaseService {
|
|
|
8476
8542
|
* const result = await entities.updateRecordById("<entityId>", "<recordId>", { name: "John Updated", age: 31 }, {
|
|
8477
8543
|
* expansionLevel: 1
|
|
8478
8544
|
* });
|
|
8545
|
+
*
|
|
8546
|
+
* // Folder-scoped entity: pass the entity's folder key
|
|
8547
|
+
* await entities.updateRecordById("<entityId>", "<recordId>", { name: "John Updated" }, {
|
|
8548
|
+
* folderKey: "<folderKey>"
|
|
8549
|
+
* });
|
|
8479
8550
|
* ```
|
|
8480
8551
|
*/
|
|
8481
8552
|
async updateRecordById(entityId, recordId, data, options = {}) {
|
|
@@ -8494,7 +8565,7 @@ class EntityService extends BaseService {
|
|
|
8494
8565
|
* @param entityId - UUID of the entity
|
|
8495
8566
|
* @param data - Array of records to update. Each record MUST contain the record Id,
|
|
8496
8567
|
* otherwise the update will fail.
|
|
8497
|
-
* @param options - Update options
|
|
8568
|
+
* @param options - Update options The `folderKey` property is **experimental**.
|
|
8498
8569
|
* @returns Promise resolving to update response
|
|
8499
8570
|
*
|
|
8500
8571
|
* @example
|
|
@@ -8517,6 +8588,11 @@ class EntityService extends BaseService {
|
|
|
8517
8588
|
* expansionLevel: 1,
|
|
8518
8589
|
* failOnFirst: true
|
|
8519
8590
|
* });
|
|
8591
|
+
*
|
|
8592
|
+
* // Folder-scoped entity: pass the entity's folder key
|
|
8593
|
+
* await entities.updateRecordsById("<entityId>", [
|
|
8594
|
+
* { Id: "123", name: "John Updated" }
|
|
8595
|
+
* ], { folderKey: "<folderKey>" });
|
|
8520
8596
|
* ```
|
|
8521
8597
|
*/
|
|
8522
8598
|
async updateRecordsById(id, data, options = {}) {
|
|
@@ -8537,7 +8613,7 @@ class EntityService extends BaseService {
|
|
|
8537
8613
|
*
|
|
8538
8614
|
* @param entityId - UUID of the entity
|
|
8539
8615
|
* @param recordIds - Array of record UUIDs to delete
|
|
8540
|
-
* @param options - Delete options
|
|
8616
|
+
* @param options - Delete options The `folderKey` property is **experimental**.
|
|
8541
8617
|
* @returns Promise resolving to delete response
|
|
8542
8618
|
*
|
|
8543
8619
|
* @example
|
|
@@ -8550,6 +8626,11 @@ class EntityService extends BaseService {
|
|
|
8550
8626
|
* const result = await entities.deleteRecordsById("<entityId>", [
|
|
8551
8627
|
* "<recordId-1>", "<recordId-2>"
|
|
8552
8628
|
* ]);
|
|
8629
|
+
*
|
|
8630
|
+
* // Folder-scoped entity: pass the entity's folder key
|
|
8631
|
+
* await entities.deleteRecordsById("<entityId>", [
|
|
8632
|
+
* "<recordId-1>", "<recordId-2>"
|
|
8633
|
+
* ], { folderKey: "<folderKey>" });
|
|
8553
8634
|
* ```
|
|
8554
8635
|
*/
|
|
8555
8636
|
async deleteRecordsById(id, recordIds, options = {}) {
|
|
@@ -8570,7 +8651,7 @@ class EntityService extends BaseService {
|
|
|
8570
8651
|
*
|
|
8571
8652
|
* @param entityId - UUID of the entity
|
|
8572
8653
|
* @param recordId - UUID of the record to delete
|
|
8573
|
-
* @param options - Optional {@link EntityDeleteRecordByIdOptions} (e.g. `folderKey` for folder-scoped entities)
|
|
8654
|
+
* @param options - Optional {@link EntityDeleteRecordByIdOptions} (e.g. `folderKey` for folder-scoped entities) The `folderKey` property is **experimental**.
|
|
8574
8655
|
* @returns Promise resolving to void on success
|
|
8575
8656
|
* @example
|
|
8576
8657
|
* ```typescript
|
|
@@ -8588,8 +8669,14 @@ class EntityService extends BaseService {
|
|
|
8588
8669
|
await this.delete(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_RECORD_BY_ID(entityId, recordId), { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
|
|
8589
8670
|
}
|
|
8590
8671
|
/**
|
|
8591
|
-
* Gets
|
|
8672
|
+
* Gets entities in the tenant.
|
|
8673
|
+
*
|
|
8674
|
+
* Three call modes:
|
|
8675
|
+
* - `getAll()` — default. Returns only tenant-level entities.
|
|
8676
|
+
* - `getAll({ folderKey: "<uuid>" })` — preferred for folder-scoped data. Returns only entities in that folder.
|
|
8677
|
+
* - `getAll({ includeFolderEntities: true })` — returns tenant-level **and** folder-level entities together. `folderKey` is preferred over `includeFolderEntities` when both are set.
|
|
8592
8678
|
*
|
|
8679
|
+
* @param options - Optional {@link EntityGetAllOptions} (`folderKey` to list a single folder's entities — preferred when scoping to a folder; `includeFolderEntities: true` to list tenant + folder entities together) The `folderKey` property is **experimental**.
|
|
8593
8680
|
* @returns Promise resolving to an array of entity metadata
|
|
8594
8681
|
*
|
|
8595
8682
|
* @example
|
|
@@ -8598,15 +8685,29 @@ class EntityService extends BaseService {
|
|
|
8598
8685
|
*
|
|
8599
8686
|
* const entities = new Entities(sdk);
|
|
8600
8687
|
*
|
|
8601
|
-
* //
|
|
8602
|
-
* const
|
|
8688
|
+
* // Tenant-only (default)
|
|
8689
|
+
* const tenantEntities = await entities.getAll();
|
|
8690
|
+
*
|
|
8691
|
+
* // A single folder's entities (preferred when targeting a specific folder)
|
|
8692
|
+
* const folderEntities = await entities.getAll({ folderKey: "<folderKey>" });
|
|
8693
|
+
*
|
|
8694
|
+
* // Tenant + folder entities together
|
|
8695
|
+
* const allEntities = await entities.getAll({ includeFolderEntities: true });
|
|
8603
8696
|
*
|
|
8604
8697
|
* // Call operations on an entity
|
|
8605
|
-
* const records = await
|
|
8698
|
+
* const records = await tenantEntities[0].getAllRecords();
|
|
8606
8699
|
* ```
|
|
8607
8700
|
*/
|
|
8608
|
-
async getAll() {
|
|
8609
|
-
|
|
8701
|
+
async getAll(options) {
|
|
8702
|
+
// folderKey is preferred over includeFolderEntities: when present, scope to that folder
|
|
8703
|
+
// via the v1 endpoint + header. Only when no folderKey is given AND includeFolderEntities
|
|
8704
|
+
// is explicitly true does the SDK switch to the v2 endpoint (returns tenant + folder
|
|
8705
|
+
// entities together). Default (no options or includeFolderEntities omitted) stays on
|
|
8706
|
+
// the v1 endpoint = tenant only.
|
|
8707
|
+
const endpoint = !options?.folderKey && options?.includeFolderEntities
|
|
8708
|
+
? DATA_FABRIC_ENDPOINTS.ENTITY.GET_ALL_V2
|
|
8709
|
+
: DATA_FABRIC_ENDPOINTS.ENTITY.GET_ALL;
|
|
8710
|
+
const response = await this.get(endpoint, { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
|
|
8610
8711
|
// Apply transformations
|
|
8611
8712
|
const entities = response.data.map(entity => {
|
|
8612
8713
|
// Transform each entity
|
|
@@ -8621,7 +8722,7 @@ class EntityService extends BaseService {
|
|
|
8621
8722
|
* Queries entity records with filters, sorting, aggregates, and pagination
|
|
8622
8723
|
*
|
|
8623
8724
|
* @param id - UUID of the entity
|
|
8624
|
-
* @param options - Query options including filterGroup, selectedFields, sortOptions, aggregates, groupBy, and pagination
|
|
8725
|
+
* @param options - Query options including filterGroup, selectedFields, sortOptions, aggregates, groupBy, and pagination The `folderKey` property is **experimental**.
|
|
8625
8726
|
* @returns Promise resolving to {@link NonPaginatedResponse} without pagination options,
|
|
8626
8727
|
* or {@link PaginatedResponse} when `pageSize`, `cursor`, or `jumpToPage` are provided
|
|
8627
8728
|
*
|
|
@@ -8668,18 +8769,24 @@ class EntityService extends BaseService {
|
|
|
8668
8769
|
* { function: EntityAggregateFunction.Avg, field: "amount", alias: "avgAmount" },
|
|
8669
8770
|
* ],
|
|
8670
8771
|
* });
|
|
8772
|
+
*
|
|
8773
|
+
* // Folder-scoped entity: pass the entity's folder key
|
|
8774
|
+
* await entities.queryRecordsById("<entityId>", {
|
|
8775
|
+
* filterGroup: { queryFilters: [{ fieldName: "status", operator: QueryFilterOperator.Equals, value: "active" }] },
|
|
8776
|
+
* folderKey: "<folderKey>",
|
|
8777
|
+
* });
|
|
8671
8778
|
* ```
|
|
8672
8779
|
*/
|
|
8673
8780
|
async queryRecordsById(id, options) {
|
|
8674
|
-
// folderKey is header-only
|
|
8675
|
-
|
|
8676
|
-
const { folderKey, ...rest } = options ?? {};
|
|
8781
|
+
// folderKey is header-only; expansionLevel must be sent as a query param by PaginationHelpers.
|
|
8782
|
+
const { folderKey, expansionLevel, ...rest } = options ?? {};
|
|
8677
8783
|
const downstreamOptions = options === undefined ? undefined : rest;
|
|
8678
8784
|
return PaginationHelpers.getAll({
|
|
8679
8785
|
serviceAccess: this.createPaginationServiceAccess(),
|
|
8680
8786
|
getEndpoint: () => DATA_FABRIC_ENDPOINTS.ENTITY.QUERY_BY_ID(id),
|
|
8681
8787
|
method: HTTP_METHODS.POST,
|
|
8682
8788
|
headers: createHeaders({ [FOLDER_KEY]: folderKey }),
|
|
8789
|
+
queryParams: createParams({ expansionLevel }),
|
|
8683
8790
|
pagination: {
|
|
8684
8791
|
paginationType: PaginationType.OFFSET,
|
|
8685
8792
|
itemsField: ENTITY_PAGINATION.ITEMS_FIELD,
|
|
@@ -8690,7 +8797,7 @@ class EntityService extends BaseService {
|
|
|
8690
8797
|
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
8691
8798
|
}
|
|
8692
8799
|
},
|
|
8693
|
-
excludeFromPrefix: ['
|
|
8800
|
+
excludeFromPrefix: ['filterGroup', 'selectedFields', 'sortOptions', 'aggregates', 'groupBy']
|
|
8694
8801
|
}, downstreamOptions);
|
|
8695
8802
|
}
|
|
8696
8803
|
/**
|
|
@@ -8698,7 +8805,7 @@ class EntityService extends BaseService {
|
|
|
8698
8805
|
*
|
|
8699
8806
|
* @param id - UUID of the entity
|
|
8700
8807
|
* @param file - CSV file to import (Blob, File, or Uint8Array)
|
|
8701
|
-
* @param options - Optional {@link EntityImportRecordsByIdOptions} (e.g. `folderKey` for folder-scoped entities)
|
|
8808
|
+
* @param options - Optional {@link EntityImportRecordsByIdOptions} (e.g. `folderKey` for folder-scoped entities) The `folderKey` property is **experimental**.
|
|
8702
8809
|
* @returns Promise resolving to import result with record counts
|
|
8703
8810
|
*
|
|
8704
8811
|
* @example
|
|
@@ -8741,7 +8848,7 @@ class EntityService extends BaseService {
|
|
|
8741
8848
|
* @param entityId - UUID of the entity
|
|
8742
8849
|
* @param recordId - UUID of the record containing the attachment
|
|
8743
8850
|
* @param fieldName - Name of the File-type field containing the attachment
|
|
8744
|
-
* @param options - Optional {@link EntityDownloadAttachmentOptions} (e.g. `folderKey` for folder-scoped entities)
|
|
8851
|
+
* @param options - Optional {@link EntityDownloadAttachmentOptions} (e.g. `folderKey` for folder-scoped entities) The `folderKey` property is **experimental**.
|
|
8745
8852
|
* @returns Promise resolving to Blob containing the file content
|
|
8746
8853
|
*
|
|
8747
8854
|
* @example
|
|
@@ -8779,7 +8886,7 @@ class EntityService extends BaseService {
|
|
|
8779
8886
|
* @param recordId - UUID of the record to upload the attachment to
|
|
8780
8887
|
* @param fieldName - Name of the File-type field
|
|
8781
8888
|
* @param file - File to upload (Blob, File, or Uint8Array)
|
|
8782
|
-
* @param options - Optional {@link EntityUploadAttachmentOptions} (e.g. `expansionLevel`, `folderKey` for folder-scoped entities)
|
|
8889
|
+
* @param options - Optional {@link EntityUploadAttachmentOptions} (e.g. `expansionLevel`, `folderKey` for folder-scoped entities) The `folderKey` property is **experimental**.
|
|
8783
8890
|
* @returns Promise resolving to {@link EntityUploadAttachmentResponse}
|
|
8784
8891
|
*
|
|
8785
8892
|
* @example
|
|
@@ -8824,7 +8931,7 @@ class EntityService extends BaseService {
|
|
|
8824
8931
|
* @param entityId - UUID of the entity
|
|
8825
8932
|
* @param recordId - UUID of the record containing the attachment
|
|
8826
8933
|
* @param fieldName - Name of the File-type field containing the attachment
|
|
8827
|
-
* @param options - Optional {@link EntityDeleteAttachmentOptions} (e.g. `folderKey` for folder-scoped entities)
|
|
8934
|
+
* @param options - Optional {@link EntityDeleteAttachmentOptions} (e.g. `folderKey` for folder-scoped entities) The `folderKey` property is **experimental**.
|
|
8828
8935
|
* @returns Promise resolving to {@link EntityDeleteAttachmentResponse}
|
|
8829
8936
|
*
|
|
8830
8937
|
* @example
|
|
@@ -8879,7 +8986,7 @@ class EntityService extends BaseService {
|
|
|
8879
8986
|
* @param name - Entity name — must start with a letter and contain
|
|
8880
8987
|
* only letters, numbers, and underscores (e.g., `"productCatalog"`).
|
|
8881
8988
|
* @param fields - Array of field definitions
|
|
8882
|
-
* @param options - Optional entity-level settings ({@link EntityCreateOptions})
|
|
8989
|
+
* @param options - Optional entity-level settings ({@link EntityCreateOptions}) The `folderKey` property is **experimental**.
|
|
8883
8990
|
* @returns Promise resolving to the ID of the created entity
|
|
8884
8991
|
*
|
|
8885
8992
|
* @example
|
|
@@ -8895,17 +9002,36 @@ class EntityService extends BaseService {
|
|
|
8895
9002
|
* { fieldName: "price", type: EntityFieldDataType.DECIMAL, decimalPrecision: 4, maxValue: 999999, minValue: 0 },
|
|
8896
9003
|
* { fieldName: "quantity", type: EntityFieldDataType.INTEGER, maxValue: 10000, minValue: 1, defaultValue: "0" },
|
|
8897
9004
|
* ]);
|
|
9005
|
+
*
|
|
9006
|
+
* // Cross-folder references — link a folder-scoped entity to entities and
|
|
9007
|
+
* // system choice sets that live in another folder or at the tenant level.
|
|
9008
|
+
* await entities.create("orderLine", [
|
|
9009
|
+
* {
|
|
9010
|
+
* fieldName: "order",
|
|
9011
|
+
* type: EntityFieldDataType.RELATIONSHIP,
|
|
9012
|
+
* referenceEntityId: "<orderEntityId>",
|
|
9013
|
+
* referenceFieldId: "<orderEntityPkId>",
|
|
9014
|
+
* referenceFolderKey: "<otherFolderKey>", // target lives in a different folder
|
|
9015
|
+
* },
|
|
9016
|
+
* {
|
|
9017
|
+
* fieldName: "userType",
|
|
9018
|
+
* type: EntityFieldDataType.CHOICE_SET_SINGLE,
|
|
9019
|
+
* choiceSetId: "<systemUserTypeChoiceSetId>", // tenant-level system choice set
|
|
9020
|
+
* // referenceFolderKey omitted → SDK looks up the target at tenant scope
|
|
9021
|
+
* },
|
|
9022
|
+
* ], { folderKey: "<sourceFolderKey>" });
|
|
8898
9023
|
* ```
|
|
8899
9024
|
* @internal
|
|
8900
9025
|
*/
|
|
8901
9026
|
async create(name, fields, options) {
|
|
8902
9027
|
const opts = options ?? {};
|
|
9028
|
+
const fieldPayloads = await this.buildFieldsWithReferenceMeta(fields);
|
|
8903
9029
|
const payload = {
|
|
8904
9030
|
...(opts.description !== undefined && { description: opts.description }),
|
|
8905
9031
|
displayName: opts.displayName ?? name,
|
|
8906
9032
|
entityDefinition: {
|
|
8907
9033
|
name,
|
|
8908
|
-
fields:
|
|
9034
|
+
fields: fieldPayloads,
|
|
8909
9035
|
folderId: opts.folderKey ?? DATA_FABRIC_TENANT_FOLDER_ID,
|
|
8910
9036
|
isRbacEnabled: opts.isRbacEnabled ?? false,
|
|
8911
9037
|
isInsightsEnabled: opts.isAnalyticsEnabled ?? false,
|
|
@@ -8919,7 +9045,7 @@ class EntityService extends BaseService {
|
|
|
8919
9045
|
* Deletes a Data Fabric entity and all its records
|
|
8920
9046
|
*
|
|
8921
9047
|
* @param id - UUID of the entity to delete
|
|
8922
|
-
* @param options - Optional {@link EntityDeleteByIdOptions} (e.g. `folderKey` for folder-scoped entities)
|
|
9048
|
+
* @param options - Optional {@link EntityDeleteByIdOptions} (e.g. `folderKey` for folder-scoped entities) The `folderKey` property is **experimental**.
|
|
8923
9049
|
* @returns Promise resolving when the entity is deleted
|
|
8924
9050
|
*
|
|
8925
9051
|
* @example
|
|
@@ -8946,7 +9072,7 @@ class EntityService extends BaseService {
|
|
|
8946
9072
|
* overwrite each other's changes.
|
|
8947
9073
|
*
|
|
8948
9074
|
* @param id - UUID of the entity to update
|
|
8949
|
-
* @param options - Changes to apply ({@link EntityUpdateByIdOptions})
|
|
9075
|
+
* @param options - Changes to apply ({@link EntityUpdateByIdOptions}) The `folderKey` property is **experimental**.
|
|
8950
9076
|
* @returns Promise resolving when the update is complete
|
|
8951
9077
|
*
|
|
8952
9078
|
* @example
|
|
@@ -9058,10 +9184,9 @@ class EntityService extends BaseService {
|
|
|
9058
9184
|
};
|
|
9059
9185
|
});
|
|
9060
9186
|
}
|
|
9061
|
-
// Build and append new fields
|
|
9062
9187
|
const newFields = [];
|
|
9063
9188
|
if (options.addFields?.length) {
|
|
9064
|
-
newFields.push(...
|
|
9189
|
+
newFields.push(...await this.buildFieldsWithReferenceMeta(options.addFields));
|
|
9065
9190
|
}
|
|
9066
9191
|
await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPSERT, {
|
|
9067
9192
|
displayName: raw.displayName,
|
|
@@ -9159,8 +9284,39 @@ class EntityService extends BaseService {
|
|
|
9159
9284
|
return externalSource;
|
|
9160
9285
|
});
|
|
9161
9286
|
}
|
|
9287
|
+
async buildFieldsWithReferenceMeta(fields) {
|
|
9288
|
+
const metas = await Promise.all(fields.map(f => this.buildReferenceMeta(f)));
|
|
9289
|
+
return fields.map((f, i) => this.buildSchemaFieldPayload(f, metas[i]));
|
|
9290
|
+
}
|
|
9291
|
+
// Choice-set targets resolve server-side by NAME (the API rejects cross-folder
|
|
9292
|
+
// refs with empty target name even when folderId is supplied), so the SDK
|
|
9293
|
+
// fetches the name once for each cross-folder choice-set field. Relationship
|
|
9294
|
+
// targets resolve by folderId — no lookup needed.
|
|
9295
|
+
async buildReferenceMeta(field) {
|
|
9296
|
+
if (field.referenceFolderKey === undefined)
|
|
9297
|
+
return undefined;
|
|
9298
|
+
if (field.referenceEntityId === undefined && field.choiceSetId === undefined)
|
|
9299
|
+
return undefined;
|
|
9300
|
+
const folderId = field.referenceFolderKey;
|
|
9301
|
+
const meta = {};
|
|
9302
|
+
if (field.referenceEntityId !== undefined) {
|
|
9303
|
+
meta.referenceEntity = { id: field.referenceEntityId, folderId };
|
|
9304
|
+
}
|
|
9305
|
+
if (field.choiceSetId !== undefined) {
|
|
9306
|
+
const lookupFolderKey = folderId === DATA_FABRIC_TENANT_FOLDER_ID ? undefined : folderId;
|
|
9307
|
+
const target = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.GET_BY_ID(field.choiceSetId), { headers: createHeaders({ [FOLDER_KEY]: lookupFolderKey }) });
|
|
9308
|
+
meta.referenceChoiceSet = {
|
|
9309
|
+
id: field.choiceSetId,
|
|
9310
|
+
name: target.data.name,
|
|
9311
|
+
folderId,
|
|
9312
|
+
entityType: exports.EntityType.ChoiceSet,
|
|
9313
|
+
entityTypeId: ENTITY_TYPE_IDS[exports.EntityType.ChoiceSet],
|
|
9314
|
+
};
|
|
9315
|
+
}
|
|
9316
|
+
return meta;
|
|
9317
|
+
}
|
|
9162
9318
|
/** Converts a user-facing EntityCreateFieldOptions to the raw API field payload */
|
|
9163
|
-
buildSchemaFieldPayload(field) {
|
|
9319
|
+
buildSchemaFieldPayload(field, refMeta) {
|
|
9164
9320
|
const fieldType = field.type ?? exports.EntityFieldDataType.STRING;
|
|
9165
9321
|
this.validateFieldConstraints(fieldType, field, field.fieldName);
|
|
9166
9322
|
const isRelationship = fieldType === exports.EntityFieldDataType.RELATIONSHIP;
|
|
@@ -9171,6 +9327,10 @@ class EntityService extends BaseService {
|
|
|
9171
9327
|
});
|
|
9172
9328
|
}
|
|
9173
9329
|
const mapping = EntitySchemaFieldTypeMap[fieldType];
|
|
9330
|
+
// Prefer the resolved {id, name, folderId} body so cross-folder targets resolve
|
|
9331
|
+
// server-side; fall back to a bare {id} when no meta was fetched.
|
|
9332
|
+
const referenceEntityBody = refMeta?.referenceEntity ?? (field.referenceEntityId === undefined ? undefined : { id: field.referenceEntityId });
|
|
9333
|
+
const referenceChoiceSetBody = refMeta?.referenceChoiceSet;
|
|
9174
9334
|
return {
|
|
9175
9335
|
name: field.fieldName,
|
|
9176
9336
|
displayName: field.displayName ?? field.fieldName,
|
|
@@ -9189,7 +9349,8 @@ class EntityService extends BaseService {
|
|
|
9189
9349
|
...(field.choiceSetId !== undefined && { choiceSetId: field.choiceSetId }),
|
|
9190
9350
|
...((isRelationship || isFile) && { isForeignKey: true }),
|
|
9191
9351
|
...(isRelationship && { referenceType: exports.ReferenceType.ManyToOne }),
|
|
9192
|
-
...(
|
|
9352
|
+
...(referenceEntityBody !== undefined && { referenceEntity: referenceEntityBody }),
|
|
9353
|
+
...(referenceChoiceSetBody !== undefined && { referenceChoiceSet: referenceChoiceSetBody }),
|
|
9193
9354
|
...(field.referenceFieldId !== undefined && { referenceField: { id: field.referenceFieldId } }),
|
|
9194
9355
|
};
|
|
9195
9356
|
}
|
|
@@ -9352,8 +9513,14 @@ __decorate([
|
|
|
9352
9513
|
|
|
9353
9514
|
class ChoiceSetService extends BaseService {
|
|
9354
9515
|
/**
|
|
9355
|
-
* Gets
|
|
9516
|
+
* Gets choice sets in the tenant.
|
|
9517
|
+
*
|
|
9518
|
+
* Three call modes:
|
|
9519
|
+
* - `getAll()` — default. Returns only tenant-level choice sets.
|
|
9520
|
+
* - `getAll({ folderKey: "<uuid>" })` — preferred for folder-scoped data. Returns only choice sets in that folder.
|
|
9521
|
+
* - `getAll({ includeFolderChoiceSets: true })` — returns tenant-level **and** folder-level choice sets together. `folderKey` is preferred over `includeFolderChoiceSets` when both are set.
|
|
9356
9522
|
*
|
|
9523
|
+
* @param options - Optional {@link ChoiceSetGetAllOptions} (`folderKey` to list a single folder's choice sets — preferred when scoping to a folder; `includeFolderChoiceSets: true` to list tenant + folder choice sets together) The `folderKey` property is **experimental**.
|
|
9357
9524
|
* @returns Promise resolving to an array of choice set metadata
|
|
9358
9525
|
*
|
|
9359
9526
|
* @example
|
|
@@ -9362,18 +9529,33 @@ class ChoiceSetService extends BaseService {
|
|
|
9362
9529
|
*
|
|
9363
9530
|
* const choiceSets = new ChoiceSets(sdk);
|
|
9364
9531
|
*
|
|
9365
|
-
* //
|
|
9366
|
-
* const
|
|
9532
|
+
* // Tenant-only (default)
|
|
9533
|
+
* const tenantChoiceSets = await choiceSets.getAll();
|
|
9367
9534
|
*
|
|
9368
|
-
* //
|
|
9369
|
-
*
|
|
9370
|
-
*
|
|
9371
|
-
*
|
|
9372
|
-
* });
|
|
9535
|
+
* // A single folder's choice sets (preferred when targeting a specific folder)
|
|
9536
|
+
* const folderChoiceSets = await choiceSets.getAll({ folderKey: "<folderKey>" });
|
|
9537
|
+
*
|
|
9538
|
+
* // Tenant + folder choice sets together
|
|
9539
|
+
* const allChoiceSets = await choiceSets.getAll({ includeFolderChoiceSets: true });
|
|
9373
9540
|
* ```
|
|
9374
9541
|
*/
|
|
9375
|
-
async getAll() {
|
|
9376
|
-
|
|
9542
|
+
async getAll(options) {
|
|
9543
|
+
return this.fetchAllChoiceSets(options);
|
|
9544
|
+
}
|
|
9545
|
+
/**
|
|
9546
|
+
* Internal helper that performs the choice-set fetch. Kept separate from the
|
|
9547
|
+
* public `getAll()` so that internal callers (e.g. `resolveChoiceSetName`)
|
|
9548
|
+
* can reuse it without triggering double `@track` telemetry.
|
|
9549
|
+
*/
|
|
9550
|
+
async fetchAllChoiceSets(options) {
|
|
9551
|
+
// The choice-set endpoint returns cross-scope results when called without
|
|
9552
|
+
// a folder header. To stay tenant-only by default, send the tenant-marker
|
|
9553
|
+
// UUID as the folder key unless the caller explicitly opts into cross-scope
|
|
9554
|
+
// via includeFolderChoiceSets: true. folderKey is preferred over
|
|
9555
|
+
// includeFolderChoiceSets when both are set.
|
|
9556
|
+
const folderKey = options?.folderKey
|
|
9557
|
+
?? (options?.includeFolderChoiceSets ? undefined : DATA_FABRIC_TENANT_FOLDER_ID);
|
|
9558
|
+
const rawResponse = await this.get(DATA_FABRIC_ENDPOINTS.CHOICESETS.GET_ALL, { headers: createHeaders({ [FOLDER_KEY]: folderKey }) });
|
|
9377
9559
|
// Transform field names
|
|
9378
9560
|
const data = rawResponse.data || [];
|
|
9379
9561
|
return data.map(choiceSet => transformData(choiceSet, EntityMap));
|
|
@@ -9386,7 +9568,7 @@ class ChoiceSetService extends BaseService {
|
|
|
9386
9568
|
* - A PaginatedResponse with navigation cursors (when any pagination parameter is provided)
|
|
9387
9569
|
*
|
|
9388
9570
|
* @param choiceSetId - UUID of the choice set
|
|
9389
|
-
* @param options - Pagination options
|
|
9571
|
+
* @param options - Pagination options and optional `folderKey` for folder-scoped choice sets The `folderKey` property is **experimental**.
|
|
9390
9572
|
* @returns Promise resolving to choice set values or paginated result
|
|
9391
9573
|
*
|
|
9392
9574
|
* @example
|
|
@@ -9415,6 +9597,9 @@ class ChoiceSetService extends BaseService {
|
|
|
9415
9597
|
* if (page1.hasNextPage) {
|
|
9416
9598
|
* const page2 = await choiceSets.getById(choiceSetId, { cursor: page1.nextCursor });
|
|
9417
9599
|
* }
|
|
9600
|
+
*
|
|
9601
|
+
* // Folder-scoped choice set
|
|
9602
|
+
* const folderValues = await choiceSets.getById(choiceSetId, { folderKey: "<folderKey>" });
|
|
9418
9603
|
* ```
|
|
9419
9604
|
*/
|
|
9420
9605
|
async getById(choiceSetId, options) {
|
|
@@ -9423,11 +9608,16 @@ class ChoiceSetService extends BaseService {
|
|
|
9423
9608
|
const camelCased = pascalToCamelCaseKeys(item);
|
|
9424
9609
|
return transformData(camelCased, EntityMap);
|
|
9425
9610
|
};
|
|
9611
|
+
// folderKey is header-only — destructure it out so PaginationHelpers doesn't
|
|
9612
|
+
// include it in the POST body alongside pagination params.
|
|
9613
|
+
const { folderKey, ...rest } = options ?? {};
|
|
9614
|
+
const downstreamOptions = options === undefined ? undefined : rest;
|
|
9426
9615
|
return PaginationHelpers.getAll({
|
|
9427
9616
|
serviceAccess: this.createPaginationServiceAccess(),
|
|
9428
9617
|
getEndpoint: () => DATA_FABRIC_ENDPOINTS.CHOICESETS.GET_BY_ID(choiceSetId),
|
|
9429
9618
|
transformFn,
|
|
9430
9619
|
method: HTTP_METHODS.POST,
|
|
9620
|
+
headers: createHeaders({ [FOLDER_KEY]: folderKey }),
|
|
9431
9621
|
pagination: {
|
|
9432
9622
|
paginationType: PaginationType.OFFSET,
|
|
9433
9623
|
itemsField: CHOICESET_VALUES_PAGINATION.ITEMS_FIELD,
|
|
@@ -9438,7 +9628,7 @@ class ChoiceSetService extends BaseService {
|
|
|
9438
9628
|
countParam: ENTITY_OFFSET_PARAMS.COUNT_PARAM
|
|
9439
9629
|
}
|
|
9440
9630
|
}
|
|
9441
|
-
},
|
|
9631
|
+
}, downstreamOptions);
|
|
9442
9632
|
}
|
|
9443
9633
|
/**
|
|
9444
9634
|
* Creates a new Data Fabric choice set
|
|
@@ -9446,7 +9636,7 @@ class ChoiceSetService extends BaseService {
|
|
|
9446
9636
|
* @param name - Choice set name. Must start with a
|
|
9447
9637
|
* letter, may contain only letters, numbers, and underscores, length
|
|
9448
9638
|
* 3–100 characters (e.g., `"expenseTypes"`).
|
|
9449
|
-
* @param options - Optional choice-set-level settings ({@link ChoiceSetCreateOptions})
|
|
9639
|
+
* @param options - Optional choice-set-level settings ({@link ChoiceSetCreateOptions}) The `folderKey` property is **experimental**.
|
|
9450
9640
|
* @returns Promise resolving to the UUID of the created choice set
|
|
9451
9641
|
*
|
|
9452
9642
|
* @example
|
|
@@ -9477,7 +9667,7 @@ class ChoiceSetService extends BaseService {
|
|
|
9477
9667
|
folderId: opts.folderKey ?? DATA_FABRIC_TENANT_FOLDER_ID,
|
|
9478
9668
|
},
|
|
9479
9669
|
};
|
|
9480
|
-
const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.CREATE, payload);
|
|
9670
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.CREATE, payload, { headers: createHeaders({ [FOLDER_KEY]: opts.folderKey }) });
|
|
9481
9671
|
return response.data;
|
|
9482
9672
|
}
|
|
9483
9673
|
/**
|
|
@@ -9487,7 +9677,7 @@ class ChoiceSetService extends BaseService {
|
|
|
9487
9677
|
* the call throws `ValidationError` if both are omitted.
|
|
9488
9678
|
*
|
|
9489
9679
|
* @param choiceSetId - UUID of the choice set to update
|
|
9490
|
-
* @param options - Metadata fields to change ({@link ChoiceSetUpdateOptions})
|
|
9680
|
+
* @param options - Metadata fields to change ({@link ChoiceSetUpdateOptions}) The `folderKey` property is **experimental**.
|
|
9491
9681
|
* @returns Promise resolving when the update is complete
|
|
9492
9682
|
*
|
|
9493
9683
|
* @example
|
|
@@ -9512,12 +9702,13 @@ class ChoiceSetService extends BaseService {
|
|
|
9512
9702
|
await this.patch(DATA_FABRIC_ENDPOINTS.CHOICESETS.UPDATE(choiceSetId), {
|
|
9513
9703
|
...(options.displayName !== undefined && { displayName: options.displayName }),
|
|
9514
9704
|
...(options.description !== undefined && { description: options.description }),
|
|
9515
|
-
});
|
|
9705
|
+
}, { headers: createHeaders({ [FOLDER_KEY]: options.folderKey }) });
|
|
9516
9706
|
}
|
|
9517
9707
|
/**
|
|
9518
9708
|
* Deletes a Data Fabric choice set and all its values.
|
|
9519
9709
|
*
|
|
9520
9710
|
* @param choiceSetId - UUID of the choice set to delete
|
|
9711
|
+
* @param options - Optional {@link ChoiceSetDeleteByIdOptions} (e.g. `folderKey` for folder-scoped choice sets) The `folderKey` property is **experimental**.
|
|
9521
9712
|
* @returns Promise resolving when the choice set is deleted
|
|
9522
9713
|
*
|
|
9523
9714
|
* @example
|
|
@@ -9527,18 +9718,21 @@ class ChoiceSetService extends BaseService {
|
|
|
9527
9718
|
* const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
|
|
9528
9719
|
*
|
|
9529
9720
|
* await choicesets.deleteById(expenseTypes.id);
|
|
9721
|
+
*
|
|
9722
|
+
* // Folder-scoped choice set
|
|
9723
|
+
* await choicesets.deleteById(expenseTypes.id, { folderKey: "<folderKey>" });
|
|
9530
9724
|
* ```
|
|
9531
9725
|
* @internal
|
|
9532
9726
|
*/
|
|
9533
|
-
async deleteById(choiceSetId) {
|
|
9534
|
-
await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE(choiceSetId), {});
|
|
9727
|
+
async deleteById(choiceSetId, options) {
|
|
9728
|
+
await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE(choiceSetId), {}, { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
|
|
9535
9729
|
}
|
|
9536
9730
|
/**
|
|
9537
9731
|
* Inserts a single value into a choice set.
|
|
9538
9732
|
*
|
|
9539
9733
|
* @param choiceSetId - UUID of the parent choice set
|
|
9540
9734
|
* @param name - Identifier name of the new value (e.g., `"TRAVEL"`)
|
|
9541
|
-
* @param options - Optional fields ({@link ChoiceSetValueInsertOptions})
|
|
9735
|
+
* @param options - Optional fields ({@link ChoiceSetValueInsertOptions}) The `folderKey` property is **experimental**.
|
|
9542
9736
|
* @returns Promise resolving to the inserted value ({@link ChoiceSetValueInsertResponse})
|
|
9543
9737
|
*
|
|
9544
9738
|
* @example
|
|
@@ -9551,16 +9745,22 @@ class ChoiceSetService extends BaseService {
|
|
|
9551
9745
|
* displayName: 'Travel',
|
|
9552
9746
|
* });
|
|
9553
9747
|
* console.log(inserted.id);
|
|
9748
|
+
*
|
|
9749
|
+
* // Folder-scoped choice set: folderKey is required on the wire
|
|
9750
|
+
* await choicesets.insertValueById(expenseTypes.id, 'TRAVEL', {
|
|
9751
|
+
* displayName: 'Travel',
|
|
9752
|
+
* folderKey: "<folderKey>",
|
|
9753
|
+
* });
|
|
9554
9754
|
* ```
|
|
9555
9755
|
* @internal
|
|
9556
9756
|
*/
|
|
9557
9757
|
async insertValueById(choiceSetId, name, options) {
|
|
9558
|
-
const choiceSetName = await this.resolveChoiceSetName(choiceSetId);
|
|
9758
|
+
const choiceSetName = await this.resolveChoiceSetName(choiceSetId, options?.folderKey);
|
|
9559
9759
|
const payload = {
|
|
9560
9760
|
Name: name,
|
|
9561
9761
|
...(options?.displayName !== undefined && { DisplayName: options.displayName }),
|
|
9562
9762
|
};
|
|
9563
|
-
const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.INSERT_BY_NAME(choiceSetName), payload);
|
|
9763
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.INSERT_BY_NAME(choiceSetName), payload, { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
|
|
9564
9764
|
const camelCased = pascalToCamelCaseKeys(response.data);
|
|
9565
9765
|
return transformData(camelCased, EntityMap);
|
|
9566
9766
|
}
|
|
@@ -9573,6 +9773,7 @@ class ChoiceSetService extends BaseService {
|
|
|
9573
9773
|
* @param choiceSetId - UUID of the parent choice set
|
|
9574
9774
|
* @param valueId - UUID of the value to update
|
|
9575
9775
|
* @param displayName - New human-readable display name for the value
|
|
9776
|
+
* @param options - Optional {@link ChoiceSetValueUpdateOptions} — pass `folderKey` for folder-scoped choice sets; omit for tenant-level. The `folderKey` property is **experimental**.
|
|
9576
9777
|
* @returns Promise resolving to the updated value ({@link ChoiceSetValueUpdateResponse})
|
|
9577
9778
|
*
|
|
9578
9779
|
* @example
|
|
@@ -9584,13 +9785,18 @@ class ChoiceSetService extends BaseService {
|
|
|
9584
9785
|
* const travel = values.items.find(v => v.name === 'TRAVEL');
|
|
9585
9786
|
*
|
|
9586
9787
|
* await choicesets.updateValueById(expenseTypes.id, travel.id, 'Business Travel');
|
|
9788
|
+
*
|
|
9789
|
+
* // Folder-scoped choice set: folderKey is required on the wire
|
|
9790
|
+
* await choicesets.updateValueById(expenseTypes.id, travel.id, 'Business Travel', {
|
|
9791
|
+
* folderKey: "<folderKey>",
|
|
9792
|
+
* });
|
|
9587
9793
|
* ```
|
|
9588
9794
|
* @internal
|
|
9589
9795
|
*/
|
|
9590
|
-
async updateValueById(choiceSetId, valueId, displayName) {
|
|
9591
|
-
const choiceSetName = await this.resolveChoiceSetName(choiceSetId);
|
|
9796
|
+
async updateValueById(choiceSetId, valueId, displayName, options) {
|
|
9797
|
+
const choiceSetName = await this.resolveChoiceSetName(choiceSetId, options?.folderKey);
|
|
9592
9798
|
const payload = { DisplayName: displayName };
|
|
9593
|
-
const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.UPDATE_BY_NAME(choiceSetName, valueId), payload);
|
|
9799
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.UPDATE_BY_NAME(choiceSetName, valueId), payload, { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
|
|
9594
9800
|
const camelCased = pascalToCamelCaseKeys(response.data);
|
|
9595
9801
|
return transformData(camelCased, EntityMap);
|
|
9596
9802
|
}
|
|
@@ -9599,6 +9805,7 @@ class ChoiceSetService extends BaseService {
|
|
|
9599
9805
|
*
|
|
9600
9806
|
* @param choiceSetId - UUID of the parent choice set
|
|
9601
9807
|
* @param valueIds - Array of value UUIDs to delete
|
|
9808
|
+
* @param options - Optional {@link ChoiceSetValueDeleteOptions} (e.g. `folderKey` for folder-scoped choice sets) The `folderKey` property is **experimental**.
|
|
9602
9809
|
* @returns Promise resolving when the values are deleted
|
|
9603
9810
|
*
|
|
9604
9811
|
* @example
|
|
@@ -9608,14 +9815,20 @@ class ChoiceSetService extends BaseService {
|
|
|
9608
9815
|
* const idsToDelete = values.items.slice(0, 2).map(v => v.id);
|
|
9609
9816
|
*
|
|
9610
9817
|
* await choicesets.deleteValuesById('<choiceSetId>', idsToDelete);
|
|
9818
|
+
*
|
|
9819
|
+
* // Folder-scoped choice set
|
|
9820
|
+
* await choicesets.deleteValuesById('<choiceSetId>', idsToDelete, { folderKey: "<folderKey>" });
|
|
9611
9821
|
* ```
|
|
9612
9822
|
* @internal
|
|
9613
9823
|
*/
|
|
9614
|
-
async deleteValuesById(choiceSetId, valueIds) {
|
|
9615
|
-
await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE_BY_ID(choiceSetId), valueIds);
|
|
9824
|
+
async deleteValuesById(choiceSetId, valueIds, options) {
|
|
9825
|
+
await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE_BY_ID(choiceSetId), valueIds, { headers: createHeaders({ [FOLDER_KEY]: options?.folderKey }) });
|
|
9616
9826
|
}
|
|
9617
|
-
async resolveChoiceSetName(choiceSetId) {
|
|
9618
|
-
|
|
9827
|
+
async resolveChoiceSetName(choiceSetId, folderKey) {
|
|
9828
|
+
// Use the un-tracked helper directly so we don't fire a duplicate
|
|
9829
|
+
// `Choicesets.GetAll` telemetry event for every insertValueById /
|
|
9830
|
+
// updateValueById call.
|
|
9831
|
+
const all = await this.fetchAllChoiceSets(folderKey === undefined ? undefined : { folderKey });
|
|
9619
9832
|
const match = all.find(cs => cs.id === choiceSetId);
|
|
9620
9833
|
if (!match) {
|
|
9621
9834
|
throw new NotFoundError({ message: `Choice set with id '${choiceSetId}' not found.` });
|
|
@@ -11384,17 +11597,19 @@ function createTaskMethods(taskData, service) {
|
|
|
11384
11597
|
async assign(options) {
|
|
11385
11598
|
if (!taskData.id)
|
|
11386
11599
|
throw new Error('Task ID is undefined');
|
|
11600
|
+
const criteria = options.assignmentCriteria !== undefined ? { assignmentCriteria: options.assignmentCriteria } : {};
|
|
11387
11601
|
const assignmentOptions = 'userId' in options && options.userId !== undefined
|
|
11388
|
-
? { taskId: taskData.id, userId: options.userId }
|
|
11389
|
-
: { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail };
|
|
11602
|
+
? { taskId: taskData.id, userId: options.userId, ...criteria }
|
|
11603
|
+
: { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail, ...criteria };
|
|
11390
11604
|
return service.assign(assignmentOptions);
|
|
11391
11605
|
},
|
|
11392
11606
|
async reassign(options) {
|
|
11393
11607
|
if (!taskData.id)
|
|
11394
11608
|
throw new Error('Task ID is undefined');
|
|
11609
|
+
const criteria = options.assignmentCriteria !== undefined ? { assignmentCriteria: options.assignmentCriteria } : {};
|
|
11395
11610
|
const assignmentOptions = 'userId' in options && options.userId !== undefined
|
|
11396
|
-
? { taskId: taskData.id, userId: options.userId }
|
|
11397
|
-
: { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail };
|
|
11611
|
+
? { taskId: taskData.id, userId: options.userId, ...criteria }
|
|
11612
|
+
: { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail, ...criteria };
|
|
11398
11613
|
return service.reassign(assignmentOptions);
|
|
11399
11614
|
},
|
|
11400
11615
|
async unassign() {
|
|
@@ -11707,6 +11922,26 @@ class TaskService extends BaseService {
|
|
|
11707
11922
|
* }
|
|
11708
11923
|
* ]);
|
|
11709
11924
|
* ```
|
|
11925
|
+
*
|
|
11926
|
+
* @example Group assignment
|
|
11927
|
+
* ```typescript
|
|
11928
|
+
* import { TaskAssignmentCriteria } from '@uipath/uipath-typescript/tasks';
|
|
11929
|
+
*
|
|
11930
|
+
* // Assign to a directory group by userId + criteria — Action Center
|
|
11931
|
+
* // distributes the task across the group's members based on the criteria
|
|
11932
|
+
* const result = await tasks.assign({
|
|
11933
|
+
* taskId: 123,
|
|
11934
|
+
* userId: 456, // a DirectoryGroup id from tasks.getUsers()
|
|
11935
|
+
* assignmentCriteria: TaskAssignmentCriteria.AllUsers
|
|
11936
|
+
* });
|
|
11937
|
+
*
|
|
11938
|
+
* // ...or identify the group by name instead of id
|
|
11939
|
+
* const result2 = await tasks.assign({
|
|
11940
|
+
* taskId: 123,
|
|
11941
|
+
* userNameOrEmail: "My Group",
|
|
11942
|
+
* assignmentCriteria: TaskAssignmentCriteria.AllUsers
|
|
11943
|
+
* });
|
|
11944
|
+
* ```
|
|
11710
11945
|
*/
|
|
11711
11946
|
async assign(taskAssignments) {
|
|
11712
11947
|
// Normalize input to array
|
|
@@ -11758,6 +11993,25 @@ class TaskService extends BaseService {
|
|
|
11758
11993
|
* }
|
|
11759
11994
|
* ]);
|
|
11760
11995
|
* ```
|
|
11996
|
+
*
|
|
11997
|
+
* @example Group reassignment
|
|
11998
|
+
* ```typescript
|
|
11999
|
+
* import { TaskAssignmentCriteria } from '@uipath/uipath-typescript/tasks';
|
|
12000
|
+
*
|
|
12001
|
+
* // Reassign to a directory group by userId + criteria
|
|
12002
|
+
* const result = await tasks.reassign({
|
|
12003
|
+
* taskId: 123,
|
|
12004
|
+
* userId: 456, // a DirectoryGroup id from tasks.getUsers()
|
|
12005
|
+
* assignmentCriteria: TaskAssignmentCriteria.AllUsers
|
|
12006
|
+
* });
|
|
12007
|
+
*
|
|
12008
|
+
* // ...or identify the group by name instead of id
|
|
12009
|
+
* const result2 = await tasks.reassign({
|
|
12010
|
+
* taskId: 123,
|
|
12011
|
+
* userNameOrEmail: "My Group",
|
|
12012
|
+
* assignmentCriteria: TaskAssignmentCriteria.AllUsers
|
|
12013
|
+
* });
|
|
12014
|
+
* ```
|
|
11761
12015
|
*/
|
|
11762
12016
|
async reassign(taskAssignments) {
|
|
11763
12017
|
// Normalize input to array
|
|
@@ -13043,48 +13297,32 @@ class BucketService extends FolderScopedService {
|
|
|
13043
13297
|
}
|
|
13044
13298
|
}, options);
|
|
13045
13299
|
}
|
|
13046
|
-
|
|
13047
|
-
* Gets metadata for files in a bucket with optional filtering and pagination
|
|
13048
|
-
*
|
|
13049
|
-
* The method returns either:
|
|
13050
|
-
* - A NonPaginatedResponse with items array (when no pagination parameters are provided)
|
|
13051
|
-
* - A PaginatedResponse with navigation cursors (when any pagination parameter is provided)
|
|
13052
|
-
*
|
|
13053
|
-
* @param bucketId - The ID of the bucket to get file metadata from
|
|
13054
|
-
* @param folderId - Required folder ID for organization unit context
|
|
13055
|
-
* @param options - Optional parameters for filtering, pagination and access URL generation
|
|
13056
|
-
* @returns Promise resolving to the list of file metadata in the bucket or paginated result
|
|
13057
|
-
*
|
|
13058
|
-
* @example
|
|
13059
|
-
* ```typescript
|
|
13060
|
-
* import { Buckets } from '@uipath/uipath-typescript/buckets';
|
|
13061
|
-
*
|
|
13062
|
-
* const buckets = new Buckets(sdk);
|
|
13063
|
-
*
|
|
13064
|
-
* // Get metadata for all files in a bucket
|
|
13065
|
-
* const fileMetadata = await buckets.getFileMetaData(123, 456);
|
|
13066
|
-
*
|
|
13067
|
-
* // Get file metadata with a specific prefix
|
|
13068
|
-
* const fileMetadata = await buckets.getFileMetaData(123, 456, {
|
|
13069
|
-
* prefix: '/folder1'
|
|
13070
|
-
* });
|
|
13071
|
-
*
|
|
13072
|
-
* // First page with pagination
|
|
13073
|
-
* const page1 = await buckets.getFileMetaData(123, 456, { pageSize: 10 });
|
|
13074
|
-
*
|
|
13075
|
-
* // Navigate using cursor
|
|
13076
|
-
* if (page1.hasNextPage) {
|
|
13077
|
-
* const page2 = await buckets.getFileMetaData(123, 456, { cursor: page1.nextCursor });
|
|
13078
|
-
* }
|
|
13079
|
-
* ```
|
|
13080
|
-
*/
|
|
13081
|
-
async getFileMetaData(bucketId, folderId, options) {
|
|
13300
|
+
async getFileMetaData(bucketId, optionsOrFolderId, legacyOptions) {
|
|
13082
13301
|
if (!bucketId) {
|
|
13083
13302
|
throw new ValidationError({ message: 'bucketId is required for getFileMetaData' });
|
|
13084
13303
|
}
|
|
13085
|
-
|
|
13086
|
-
|
|
13304
|
+
// Normalize the two overload forms into a single internal shape.
|
|
13305
|
+
let folderId;
|
|
13306
|
+
let folderKey;
|
|
13307
|
+
let folderPath;
|
|
13308
|
+
let restOptions;
|
|
13309
|
+
if (typeof optionsOrFolderId === 'number') {
|
|
13310
|
+
// Deprecated positional form: getFileMetaData(bucketId, folderId, options?)
|
|
13311
|
+
folderId = optionsOrFolderId;
|
|
13312
|
+
restOptions = (legacyOptions ?? {});
|
|
13087
13313
|
}
|
|
13314
|
+
else {
|
|
13315
|
+
// Preferred form: getFileMetaData(bucketId, options?)
|
|
13316
|
+
const opts = optionsOrFolderId ?? {};
|
|
13317
|
+
({ folderId, folderKey, folderPath, ...restOptions } = opts);
|
|
13318
|
+
}
|
|
13319
|
+
const headers = resolveFolderHeaders({
|
|
13320
|
+
folderId,
|
|
13321
|
+
folderKey,
|
|
13322
|
+
folderPath,
|
|
13323
|
+
resourceType: 'Buckets.getFileMetaData',
|
|
13324
|
+
fallbackFolderKey: this.config.folderKey,
|
|
13325
|
+
});
|
|
13088
13326
|
// Transformation function for blob items
|
|
13089
13327
|
const transformBlobItem = (item) => transformData(item, BucketMap);
|
|
13090
13328
|
return PaginationHelpers.getAll({
|
|
@@ -13100,93 +13338,97 @@ class BucketService extends FolderScopedService {
|
|
|
13100
13338
|
tokenParam: BUCKET_TOKEN_PARAMS.TOKEN_PARAM
|
|
13101
13339
|
}
|
|
13102
13340
|
},
|
|
13103
|
-
excludeFromPrefix: ['prefix'] // Bucket-specific param, not OData
|
|
13104
|
-
|
|
13341
|
+
excludeFromPrefix: ['prefix'], // Bucket-specific param, not OData
|
|
13342
|
+
headers,
|
|
13343
|
+
}, restOptions);
|
|
13105
13344
|
}
|
|
13106
|
-
|
|
13107
|
-
|
|
13108
|
-
|
|
13109
|
-
|
|
13110
|
-
|
|
13111
|
-
|
|
13112
|
-
|
|
13113
|
-
|
|
13114
|
-
|
|
13115
|
-
|
|
13116
|
-
|
|
13117
|
-
|
|
13118
|
-
|
|
13119
|
-
|
|
13120
|
-
|
|
13121
|
-
|
|
13122
|
-
|
|
13123
|
-
|
|
13124
|
-
|
|
13125
|
-
|
|
13126
|
-
*
|
|
13127
|
-
* // In Node env with Buffer
|
|
13128
|
-
* const buffer = Buffer.from('file content');
|
|
13129
|
-
* const result = await buckets.uploadFile({
|
|
13130
|
-
* bucketId: 123,
|
|
13131
|
-
* folderId: 456,
|
|
13132
|
-
* path: '/folder/example.txt',
|
|
13133
|
-
* content: buffer
|
|
13134
|
-
* });
|
|
13135
|
-
* ```
|
|
13136
|
-
*/
|
|
13137
|
-
async uploadFile(options) {
|
|
13138
|
-
const { bucketId, folderId, path, content } = options;
|
|
13345
|
+
async uploadFile(bucketIdOrOptions, path, content, options) {
|
|
13346
|
+
// Normalize the two overload forms into a single internal shape.
|
|
13347
|
+
let bucketId;
|
|
13348
|
+
let resolvedPath;
|
|
13349
|
+
let resolvedContent;
|
|
13350
|
+
let folderId;
|
|
13351
|
+
let folderKey;
|
|
13352
|
+
let folderPath;
|
|
13353
|
+
if (bucketIdOrOptions !== null && typeof bucketIdOrOptions === 'object') {
|
|
13354
|
+
// Deprecated options-only form: uploadFile({ bucketId, path, content, ... })
|
|
13355
|
+
({ bucketId, path: resolvedPath, content: resolvedContent, folderId, folderKey, folderPath } = bucketIdOrOptions);
|
|
13356
|
+
}
|
|
13357
|
+
else {
|
|
13358
|
+
// Preferred positional form: uploadFile(bucketId, path, content, options?)
|
|
13359
|
+
bucketId = bucketIdOrOptions;
|
|
13360
|
+
resolvedPath = path;
|
|
13361
|
+
resolvedContent = content;
|
|
13362
|
+
const opts = options ?? {};
|
|
13363
|
+
({ folderId, folderKey, folderPath } = opts);
|
|
13364
|
+
}
|
|
13139
13365
|
if (!bucketId) {
|
|
13140
13366
|
throw new ValidationError({ message: 'bucketId is required for uploadFile' });
|
|
13141
13367
|
}
|
|
13142
|
-
if (!
|
|
13143
|
-
throw new ValidationError({ message: 'folderId is required for uploadFile' });
|
|
13144
|
-
}
|
|
13145
|
-
if (!path) {
|
|
13368
|
+
if (!resolvedPath) {
|
|
13146
13369
|
throw new ValidationError({ message: 'path is required for uploadFile' });
|
|
13147
13370
|
}
|
|
13148
|
-
if (!
|
|
13371
|
+
if (!resolvedContent) {
|
|
13149
13372
|
throw new ValidationError({ message: 'content is required for uploadFile' });
|
|
13150
13373
|
}
|
|
13374
|
+
const headers = resolveFolderHeaders({
|
|
13375
|
+
folderId,
|
|
13376
|
+
folderKey,
|
|
13377
|
+
folderPath,
|
|
13378
|
+
resourceType: 'Buckets.uploadFile',
|
|
13379
|
+
fallbackFolderKey: this.config.folderKey,
|
|
13380
|
+
});
|
|
13151
13381
|
const uriResponse = await this._getWriteUri({
|
|
13152
13382
|
bucketId,
|
|
13153
|
-
|
|
13154
|
-
|
|
13383
|
+
path: resolvedPath,
|
|
13384
|
+
headers,
|
|
13155
13385
|
});
|
|
13156
13386
|
// Upload file to the provided URI
|
|
13157
|
-
const response = await this._uploadToUri(uriResponse,
|
|
13387
|
+
const response = await this._uploadToUri(uriResponse, resolvedContent);
|
|
13158
13388
|
return {
|
|
13159
13389
|
success: response.status >= 200 && response.status < 300,
|
|
13160
13390
|
statusCode: response.status
|
|
13161
13391
|
};
|
|
13162
13392
|
}
|
|
13163
|
-
|
|
13164
|
-
|
|
13165
|
-
|
|
13166
|
-
|
|
13167
|
-
|
|
13168
|
-
|
|
13169
|
-
|
|
13170
|
-
|
|
13171
|
-
|
|
13172
|
-
|
|
13173
|
-
|
|
13174
|
-
|
|
13175
|
-
|
|
13176
|
-
|
|
13177
|
-
|
|
13178
|
-
|
|
13179
|
-
|
|
13180
|
-
|
|
13181
|
-
|
|
13182
|
-
|
|
13183
|
-
|
|
13184
|
-
|
|
13393
|
+
async getReadUri(bucketIdOrOptions, path, options) {
|
|
13394
|
+
// Normalize the two overload forms into a single internal shape.
|
|
13395
|
+
let bucketId;
|
|
13396
|
+
let resolvedPath;
|
|
13397
|
+
let folderId;
|
|
13398
|
+
let folderKey;
|
|
13399
|
+
let folderPath;
|
|
13400
|
+
let expiryInMinutes;
|
|
13401
|
+
let restOptions;
|
|
13402
|
+
if (bucketIdOrOptions !== null && typeof bucketIdOrOptions === 'object') {
|
|
13403
|
+
// Deprecated options-only form: getReadUri({ bucketId, path, ... })
|
|
13404
|
+
const { bucketId: bid, path: p, expiryInMinutes: e, folderId: fid, folderKey: fkey, folderPath: fpath, ...rest } = bucketIdOrOptions;
|
|
13405
|
+
bucketId = bid;
|
|
13406
|
+
resolvedPath = p;
|
|
13407
|
+
expiryInMinutes = e;
|
|
13408
|
+
folderId = fid;
|
|
13409
|
+
folderKey = fkey;
|
|
13410
|
+
folderPath = fpath;
|
|
13411
|
+
restOptions = rest;
|
|
13412
|
+
}
|
|
13413
|
+
else {
|
|
13414
|
+
// Preferred positional form: getReadUri(bucketId, path, options?)
|
|
13415
|
+
bucketId = bucketIdOrOptions;
|
|
13416
|
+
resolvedPath = path;
|
|
13417
|
+
const opts = options ?? {};
|
|
13418
|
+
({ expiryInMinutes, folderId, folderKey, folderPath, ...restOptions } = opts);
|
|
13419
|
+
}
|
|
13420
|
+
const headers = resolveFolderHeaders({
|
|
13421
|
+
folderId,
|
|
13422
|
+
folderKey,
|
|
13423
|
+
folderPath,
|
|
13424
|
+
resourceType: 'Buckets.getReadUri',
|
|
13425
|
+
fallbackFolderKey: this.config.folderKey,
|
|
13426
|
+
});
|
|
13185
13427
|
const queryOptions = {
|
|
13186
13428
|
expiryInMinutes,
|
|
13187
13429
|
...addPrefixToKeys(restOptions, ODATA_PREFIX, Object.keys(restOptions))
|
|
13188
13430
|
};
|
|
13189
|
-
return this._getUri(BUCKET_ENDPOINTS.GET_READ_URI(bucketId), bucketId,
|
|
13431
|
+
return this._getUri(BUCKET_ENDPOINTS.GET_READ_URI(bucketId), bucketId, resolvedPath, headers, queryOptions);
|
|
13190
13432
|
}
|
|
13191
13433
|
/**
|
|
13192
13434
|
* Uploads content to the provided URI
|
|
@@ -13216,23 +13458,18 @@ class BucketService extends FolderScopedService {
|
|
|
13216
13458
|
* Private method to handle common URI request logic
|
|
13217
13459
|
* @param endpoint - The API endpoint to call
|
|
13218
13460
|
* @param bucketId - The bucket ID
|
|
13219
|
-
* @param folderId - The folder ID
|
|
13220
13461
|
* @param path - The file path
|
|
13462
|
+
* @param headers - Pre-built folder-context headers (built via `resolveFolderHeaders`)
|
|
13221
13463
|
* @param queryOptions - Additional query parameters
|
|
13222
13464
|
* @returns Promise resolving to blob file access information
|
|
13223
13465
|
*/
|
|
13224
|
-
async _getUri(endpoint, bucketId,
|
|
13466
|
+
async _getUri(endpoint, bucketId, path, headers, queryOptions = {}) {
|
|
13225
13467
|
if (!bucketId) {
|
|
13226
13468
|
throw new ValidationError({ message: 'bucketId is required for getUri' });
|
|
13227
13469
|
}
|
|
13228
|
-
if (!folderId) {
|
|
13229
|
-
throw new ValidationError({ message: 'folderId is required for getUri' });
|
|
13230
|
-
}
|
|
13231
13470
|
if (!path) {
|
|
13232
13471
|
throw new ValidationError({ message: 'path is required for getUri' });
|
|
13233
13472
|
}
|
|
13234
|
-
// Create headers with required folder ID
|
|
13235
|
-
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
13236
13473
|
// Filter out undefined values and build query params
|
|
13237
13474
|
const queryParams = filterUndefined({
|
|
13238
13475
|
path,
|
|
@@ -13367,16 +13604,16 @@ class BucketService extends FolderScopedService {
|
|
|
13367
13604
|
/**
|
|
13368
13605
|
* Gets a direct upload URL for a file in the bucket
|
|
13369
13606
|
*
|
|
13370
|
-
* @param options - Contains bucketId,
|
|
13607
|
+
* @param options - Contains bucketId, file path, optional expiry time, and pre-built folder-context headers
|
|
13371
13608
|
* @returns Promise resolving to blob file access information
|
|
13372
13609
|
*/
|
|
13373
13610
|
async _getWriteUri(options) {
|
|
13374
|
-
const { bucketId,
|
|
13611
|
+
const { bucketId, path, expiryInMinutes, headers, ...restOptions } = options;
|
|
13375
13612
|
const queryOptions = {
|
|
13376
13613
|
expiryInMinutes,
|
|
13377
13614
|
...addPrefixToKeys(restOptions, ODATA_PREFIX, Object.keys(restOptions))
|
|
13378
13615
|
};
|
|
13379
|
-
return this._getUri(BUCKET_ENDPOINTS.GET_WRITE_URI(bucketId), bucketId,
|
|
13616
|
+
return this._getUri(BUCKET_ENDPOINTS.GET_WRITE_URI(bucketId), bucketId, path, headers, queryOptions);
|
|
13380
13617
|
}
|
|
13381
13618
|
}
|
|
13382
13619
|
__decorate([
|
|
@@ -14840,6 +15077,24 @@ exports.AgentListSortColumn = void 0;
|
|
|
14840
15077
|
AgentListSortColumn["QuantityPLTU"] = "QuantityPLTU";
|
|
14841
15078
|
AgentListSortColumn["FolderPath"] = "FolderPath";
|
|
14842
15079
|
})(exports.AgentListSortColumn || (exports.AgentListSortColumn = {}));
|
|
15080
|
+
/**
|
|
15081
|
+
* Columns available for ordering / grouping the agent errors list.
|
|
15082
|
+
*/
|
|
15083
|
+
exports.AgentErrorSortColumn = void 0;
|
|
15084
|
+
(function (AgentErrorSortColumn) {
|
|
15085
|
+
AgentErrorSortColumn["AgentId"] = "AgentId";
|
|
15086
|
+
AgentErrorSortColumn["AgentName"] = "AgentName";
|
|
15087
|
+
AgentErrorSortColumn["ParentProcessName"] = "ParentProcessName";
|
|
15088
|
+
AgentErrorSortColumn["ErrorTitle"] = "ErrorTitle";
|
|
15089
|
+
AgentErrorSortColumn["FirstSeenStartTime"] = "FirstSeenStartTime";
|
|
15090
|
+
AgentErrorSortColumn["ExecutionCount"] = "ExecutionCount";
|
|
15091
|
+
AgentErrorSortColumn["Type"] = "Type";
|
|
15092
|
+
AgentErrorSortColumn["FirstSeenFolderName"] = "FirstSeenFolderName";
|
|
15093
|
+
AgentErrorSortColumn["FirstSeenFolderPath"] = "FirstSeenFolderPath";
|
|
15094
|
+
AgentErrorSortColumn["LastSeenStartTime"] = "LastSeenStartTime";
|
|
15095
|
+
AgentErrorSortColumn["LastSeenFolderName"] = "LastSeenFolderName";
|
|
15096
|
+
AgentErrorSortColumn["LastSeenFolderPath"] = "LastSeenFolderPath";
|
|
15097
|
+
})(exports.AgentErrorSortColumn || (exports.AgentErrorSortColumn = {}));
|
|
14843
15098
|
|
|
14844
15099
|
/**
|
|
14845
15100
|
* Types for the Agent Memory metrics service.
|
|
@@ -15144,6 +15399,86 @@ exports.PolicyEvaluationResult = void 0;
|
|
|
15144
15399
|
PolicyEvaluationResult["SimulatedDeny"] = "SimulatedDeny";
|
|
15145
15400
|
})(exports.PolicyEvaluationResult || (exports.PolicyEvaluationResult = {}));
|
|
15146
15401
|
|
|
15402
|
+
/** Status of a span: whether it completed successfully, with an error, or was not set. */
|
|
15403
|
+
exports.SpanStatus = void 0;
|
|
15404
|
+
(function (SpanStatus) {
|
|
15405
|
+
SpanStatus["Unset"] = "Unset";
|
|
15406
|
+
SpanStatus["Ok"] = "Ok";
|
|
15407
|
+
SpanStatus["Error"] = "Error";
|
|
15408
|
+
/** Span is still in progress. */
|
|
15409
|
+
SpanStatus["Running"] = "Running";
|
|
15410
|
+
/** Span data is hidden from the caller due to tenant/folder permission rules. */
|
|
15411
|
+
SpanStatus["Restricted"] = "Restricted";
|
|
15412
|
+
/** Span was cancelled before completion. */
|
|
15413
|
+
SpanStatus["Cancelled"] = "Cancelled";
|
|
15414
|
+
})(exports.SpanStatus || (exports.SpanStatus = {}));
|
|
15415
|
+
/** Platform source that produced the span. */
|
|
15416
|
+
exports.SpanSource = void 0;
|
|
15417
|
+
(function (SpanSource) {
|
|
15418
|
+
SpanSource["Testing"] = "Testing";
|
|
15419
|
+
SpanSource["Agents"] = "Agents";
|
|
15420
|
+
SpanSource["ProcessOrchestration"] = "ProcessOrchestration";
|
|
15421
|
+
SpanSource["ApiWorkflows"] = "ApiWorkflows";
|
|
15422
|
+
SpanSource["Robots"] = "Robots";
|
|
15423
|
+
SpanSource["ConversationalAgentsService"] = "ConversationalAgentsService";
|
|
15424
|
+
SpanSource["IntegrationServiceTrigger"] = "IntegrationServiceTrigger";
|
|
15425
|
+
SpanSource["Playground"] = "Playground";
|
|
15426
|
+
SpanSource["Governance"] = "Governance";
|
|
15427
|
+
/** Intelligent Experience Platform — unstructured and complex document processing source. */
|
|
15428
|
+
SpanSource["IXPUnstructuredAndComplexDocuments"] = "IXPUnstructuredAndComplexDocuments";
|
|
15429
|
+
/** Agents authored in code (as opposed to visual/no-code designers). */
|
|
15430
|
+
SpanSource["CodedAgents"] = "CodedAgents";
|
|
15431
|
+
/** Intelligent Experience Platform — communications mining source. */
|
|
15432
|
+
SpanSource["IXPCommunicationsMining"] = "IXPCommunicationsMining";
|
|
15433
|
+
/** UiPath Context Grounding — span produced by the Enterprise Context Service for RAG/knowledge-base operations. */
|
|
15434
|
+
SpanSource["EnterpriseContextService"] = "EnterpriseContextService";
|
|
15435
|
+
/** Model Context Protocol — span produced by an MCP server integration. */
|
|
15436
|
+
SpanSource["MCP"] = "MCP";
|
|
15437
|
+
/** Agent-to-Agent — span produced by an A2A protocol call between agents. */
|
|
15438
|
+
SpanSource["A2A"] = "A2A";
|
|
15439
|
+
/** Serverless — span produced by a serverless function execution. */
|
|
15440
|
+
SpanSource["Serverless"] = "Serverless";
|
|
15441
|
+
})(exports.SpanSource || (exports.SpanSource = {}));
|
|
15442
|
+
/** Minimum severity level of events captured in the span. */
|
|
15443
|
+
exports.SpanVerbosityLevel = void 0;
|
|
15444
|
+
(function (SpanVerbosityLevel) {
|
|
15445
|
+
SpanVerbosityLevel["Verbose"] = "Verbose";
|
|
15446
|
+
SpanVerbosityLevel["Trace"] = "Trace";
|
|
15447
|
+
SpanVerbosityLevel["Information"] = "Information";
|
|
15448
|
+
SpanVerbosityLevel["Warning"] = "Warning";
|
|
15449
|
+
SpanVerbosityLevel["Error"] = "Error";
|
|
15450
|
+
SpanVerbosityLevel["Critical"] = "Critical";
|
|
15451
|
+
SpanVerbosityLevel["Off"] = "Off";
|
|
15452
|
+
})(exports.SpanVerbosityLevel || (exports.SpanVerbosityLevel = {}));
|
|
15453
|
+
/** Whether the span was produced during a debug or production runtime. */
|
|
15454
|
+
exports.SpanExecutionType = void 0;
|
|
15455
|
+
(function (SpanExecutionType) {
|
|
15456
|
+
SpanExecutionType["Debug"] = "Debug";
|
|
15457
|
+
SpanExecutionType["Runtime"] = "Runtime";
|
|
15458
|
+
})(exports.SpanExecutionType || (exports.SpanExecutionType = {}));
|
|
15459
|
+
/** Whether the caller has permission to read this span's data. */
|
|
15460
|
+
exports.SpanPermissionStatus = void 0;
|
|
15461
|
+
(function (SpanPermissionStatus) {
|
|
15462
|
+
SpanPermissionStatus["Allow"] = "Allow";
|
|
15463
|
+
/** Some span fields are redacted due to permission constraints (e.g. attributes visible but payload hidden). */
|
|
15464
|
+
SpanPermissionStatus["PartialBlock"] = "PartialBlock";
|
|
15465
|
+
SpanPermissionStatus["Block"] = "Block";
|
|
15466
|
+
})(exports.SpanPermissionStatus || (exports.SpanPermissionStatus = {}));
|
|
15467
|
+
/** Storage provider that created or manages the attachment. */
|
|
15468
|
+
exports.SpanAttachmentProvider = void 0;
|
|
15469
|
+
(function (SpanAttachmentProvider) {
|
|
15470
|
+
SpanAttachmentProvider["Orchestrator"] = "Orchestrator";
|
|
15471
|
+
/** Span attachment stored by the observability platform. */
|
|
15472
|
+
SpanAttachmentProvider["LLMOps"] = "LLMOps";
|
|
15473
|
+
})(exports.SpanAttachmentProvider || (exports.SpanAttachmentProvider = {}));
|
|
15474
|
+
/** Whether the attachment is an input, output, or neither. */
|
|
15475
|
+
exports.SpanAttachmentDirection = void 0;
|
|
15476
|
+
(function (SpanAttachmentDirection) {
|
|
15477
|
+
SpanAttachmentDirection["None"] = "None";
|
|
15478
|
+
SpanAttachmentDirection["In"] = "In";
|
|
15479
|
+
SpanAttachmentDirection["Out"] = "Out";
|
|
15480
|
+
})(exports.SpanAttachmentDirection || (exports.SpanAttachmentDirection = {}));
|
|
15481
|
+
|
|
15147
15482
|
/**
|
|
15148
15483
|
* Asset resolution utilities for UiPath Coded Apps
|
|
15149
15484
|
*
|
|
@@ -15220,6 +15555,7 @@ function getAppBase() {
|
|
|
15220
15555
|
}
|
|
15221
15556
|
|
|
15222
15557
|
exports.AgentMap = AgentMap;
|
|
15558
|
+
exports.AgentTraceExecutionType = exports.SpanExecutionType;
|
|
15223
15559
|
exports.AuthenticationError = AuthenticationError;
|
|
15224
15560
|
exports.AuthorizationError = AuthorizationError;
|
|
15225
15561
|
exports.ConversationGetAllFilterMap = ConversationGetAllFilterMap;
|