@uipath/uipath-typescript 1.4.0 → 1.4.2
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/document-understanding/index.cjs +84 -84
- package/dist/document-understanding/index.d.ts +2 -1
- package/dist/document-understanding/index.mjs +1 -1
- 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/buckets/index.mjs
CHANGED
|
@@ -1299,12 +1299,18 @@ class PaginationHelpers {
|
|
|
1299
1299
|
* @returns Promise resolving to a paginated result
|
|
1300
1300
|
*/
|
|
1301
1301
|
static async getAllPaginated(params) {
|
|
1302
|
-
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1302
|
+
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1303
1303
|
const endpoint = getEndpoint(folderId);
|
|
1304
1304
|
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
1305
|
+
// On POST, the caller's options go in the body; queryParams stays in the URL.
|
|
1306
|
+
// On GET, everything is URL — queryParams merges with additionalParams.
|
|
1307
|
+
const isPost = method === HTTP_METHODS.POST;
|
|
1308
|
+
const requestSpec = isPost
|
|
1309
|
+
? { body: additionalParams, params: queryParams }
|
|
1310
|
+
: { params: { ...additionalParams, ...queryParams } };
|
|
1305
1311
|
const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
|
|
1306
1312
|
headers,
|
|
1307
|
-
|
|
1313
|
+
...requestSpec,
|
|
1308
1314
|
pagination: {
|
|
1309
1315
|
paginationType: options.paginationType || PaginationType.OFFSET,
|
|
1310
1316
|
itemsField: options.itemsField || DEFAULT_ITEMS_FIELD,
|
|
@@ -1329,7 +1335,7 @@ class PaginationHelpers {
|
|
|
1329
1335
|
* @returns Promise resolving to an object with data and totalCount
|
|
1330
1336
|
*/
|
|
1331
1337
|
static async getAllNonPaginated(params) {
|
|
1332
|
-
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1338
|
+
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1333
1339
|
// Set default field names
|
|
1334
1340
|
const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
|
|
1335
1341
|
const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
|
|
@@ -1339,11 +1345,11 @@ class PaginationHelpers {
|
|
|
1339
1345
|
// Make the API call based on method
|
|
1340
1346
|
let response;
|
|
1341
1347
|
if (method === HTTP_METHODS.POST) {
|
|
1342
|
-
response = await serviceAccess.post(endpoint, additionalParams, { headers });
|
|
1348
|
+
response = await serviceAccess.post(endpoint, additionalParams, { headers, params: queryParams });
|
|
1343
1349
|
}
|
|
1344
1350
|
else {
|
|
1345
1351
|
response = await serviceAccess.get(endpoint, {
|
|
1346
|
-
params: additionalParams,
|
|
1352
|
+
params: { ...additionalParams, ...queryParams },
|
|
1347
1353
|
headers
|
|
1348
1354
|
});
|
|
1349
1355
|
}
|
|
@@ -1398,6 +1404,7 @@ class PaginationHelpers {
|
|
|
1398
1404
|
headers: config.headers,
|
|
1399
1405
|
paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
|
|
1400
1406
|
additionalParams: prefixedOptions,
|
|
1407
|
+
queryParams: config.queryParams,
|
|
1401
1408
|
transformFn: config.transformFn,
|
|
1402
1409
|
method: config.method,
|
|
1403
1410
|
options: {
|
|
@@ -1415,6 +1422,7 @@ class PaginationHelpers {
|
|
|
1415
1422
|
folderId,
|
|
1416
1423
|
headers: config.headers,
|
|
1417
1424
|
additionalParams: prefixedOptions,
|
|
1425
|
+
queryParams: config.queryParams,
|
|
1418
1426
|
transformFn: config.transformFn,
|
|
1419
1427
|
method: config.method,
|
|
1420
1428
|
options: {
|
|
@@ -1606,18 +1614,17 @@ class BaseService {
|
|
|
1606
1614
|
const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
|
|
1607
1615
|
// Prepare request parameters based on pagination type
|
|
1608
1616
|
const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
|
|
1609
|
-
//
|
|
1617
|
+
// Route pagination state to wherever the API expects it (body for POST, URL for GET).
|
|
1618
|
+
// Caller-supplied options.body / options.params are respected as-is — the api-client
|
|
1619
|
+
// already handles params (URL) and body (request body) independently for every method.
|
|
1610
1620
|
if (method.toUpperCase() === 'POST') {
|
|
1611
1621
|
const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
|
|
1612
1622
|
options.body = {
|
|
1613
1623
|
...existingBody,
|
|
1614
|
-
...options.params,
|
|
1615
1624
|
...requestParams
|
|
1616
1625
|
};
|
|
1617
|
-
options.params = undefined;
|
|
1618
1626
|
}
|
|
1619
1627
|
else {
|
|
1620
|
-
// Merge pagination parameters with existing parameters
|
|
1621
1628
|
options.params = {
|
|
1622
1629
|
...options.params,
|
|
1623
1630
|
...requestParams
|
|
@@ -2130,48 +2137,32 @@ class BucketService extends FolderScopedService {
|
|
|
2130
2137
|
}
|
|
2131
2138
|
}, options);
|
|
2132
2139
|
}
|
|
2133
|
-
|
|
2134
|
-
* Gets metadata for files in a bucket with optional filtering and pagination
|
|
2135
|
-
*
|
|
2136
|
-
* The method returns either:
|
|
2137
|
-
* - A NonPaginatedResponse with items array (when no pagination parameters are provided)
|
|
2138
|
-
* - A PaginatedResponse with navigation cursors (when any pagination parameter is provided)
|
|
2139
|
-
*
|
|
2140
|
-
* @param bucketId - The ID of the bucket to get file metadata from
|
|
2141
|
-
* @param folderId - Required folder ID for organization unit context
|
|
2142
|
-
* @param options - Optional parameters for filtering, pagination and access URL generation
|
|
2143
|
-
* @returns Promise resolving to the list of file metadata in the bucket or paginated result
|
|
2144
|
-
*
|
|
2145
|
-
* @example
|
|
2146
|
-
* ```typescript
|
|
2147
|
-
* import { Buckets } from '@uipath/uipath-typescript/buckets';
|
|
2148
|
-
*
|
|
2149
|
-
* const buckets = new Buckets(sdk);
|
|
2150
|
-
*
|
|
2151
|
-
* // Get metadata for all files in a bucket
|
|
2152
|
-
* const fileMetadata = await buckets.getFileMetaData(123, 456);
|
|
2153
|
-
*
|
|
2154
|
-
* // Get file metadata with a specific prefix
|
|
2155
|
-
* const fileMetadata = await buckets.getFileMetaData(123, 456, {
|
|
2156
|
-
* prefix: '/folder1'
|
|
2157
|
-
* });
|
|
2158
|
-
*
|
|
2159
|
-
* // First page with pagination
|
|
2160
|
-
* const page1 = await buckets.getFileMetaData(123, 456, { pageSize: 10 });
|
|
2161
|
-
*
|
|
2162
|
-
* // Navigate using cursor
|
|
2163
|
-
* if (page1.hasNextPage) {
|
|
2164
|
-
* const page2 = await buckets.getFileMetaData(123, 456, { cursor: page1.nextCursor });
|
|
2165
|
-
* }
|
|
2166
|
-
* ```
|
|
2167
|
-
*/
|
|
2168
|
-
async getFileMetaData(bucketId, folderId, options) {
|
|
2140
|
+
async getFileMetaData(bucketId, optionsOrFolderId, legacyOptions) {
|
|
2169
2141
|
if (!bucketId) {
|
|
2170
2142
|
throw new ValidationError({ message: 'bucketId is required for getFileMetaData' });
|
|
2171
2143
|
}
|
|
2172
|
-
|
|
2173
|
-
|
|
2144
|
+
// Normalize the two overload forms into a single internal shape.
|
|
2145
|
+
let folderId;
|
|
2146
|
+
let folderKey;
|
|
2147
|
+
let folderPath;
|
|
2148
|
+
let restOptions;
|
|
2149
|
+
if (typeof optionsOrFolderId === 'number') {
|
|
2150
|
+
// Deprecated positional form: getFileMetaData(bucketId, folderId, options?)
|
|
2151
|
+
folderId = optionsOrFolderId;
|
|
2152
|
+
restOptions = (legacyOptions ?? {});
|
|
2153
|
+
}
|
|
2154
|
+
else {
|
|
2155
|
+
// Preferred form: getFileMetaData(bucketId, options?)
|
|
2156
|
+
const opts = optionsOrFolderId ?? {};
|
|
2157
|
+
({ folderId, folderKey, folderPath, ...restOptions } = opts);
|
|
2174
2158
|
}
|
|
2159
|
+
const headers = resolveFolderHeaders({
|
|
2160
|
+
folderId,
|
|
2161
|
+
folderKey,
|
|
2162
|
+
folderPath,
|
|
2163
|
+
resourceType: 'Buckets.getFileMetaData',
|
|
2164
|
+
fallbackFolderKey: this.config.folderKey,
|
|
2165
|
+
});
|
|
2175
2166
|
// Transformation function for blob items
|
|
2176
2167
|
const transformBlobItem = (item) => transformData(item, BucketMap);
|
|
2177
2168
|
return PaginationHelpers.getAll({
|
|
@@ -2187,93 +2178,97 @@ class BucketService extends FolderScopedService {
|
|
|
2187
2178
|
tokenParam: BUCKET_TOKEN_PARAMS.TOKEN_PARAM
|
|
2188
2179
|
}
|
|
2189
2180
|
},
|
|
2190
|
-
excludeFromPrefix: ['prefix'] // Bucket-specific param, not OData
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
* // In Node env with Buffer
|
|
2215
|
-
* const buffer = Buffer.from('file content');
|
|
2216
|
-
* const result = await buckets.uploadFile({
|
|
2217
|
-
* bucketId: 123,
|
|
2218
|
-
* folderId: 456,
|
|
2219
|
-
* path: '/folder/example.txt',
|
|
2220
|
-
* content: buffer
|
|
2221
|
-
* });
|
|
2222
|
-
* ```
|
|
2223
|
-
*/
|
|
2224
|
-
async uploadFile(options) {
|
|
2225
|
-
const { bucketId, folderId, path, content } = options;
|
|
2181
|
+
excludeFromPrefix: ['prefix'], // Bucket-specific param, not OData
|
|
2182
|
+
headers,
|
|
2183
|
+
}, restOptions);
|
|
2184
|
+
}
|
|
2185
|
+
async uploadFile(bucketIdOrOptions, path, content, options) {
|
|
2186
|
+
// Normalize the two overload forms into a single internal shape.
|
|
2187
|
+
let bucketId;
|
|
2188
|
+
let resolvedPath;
|
|
2189
|
+
let resolvedContent;
|
|
2190
|
+
let folderId;
|
|
2191
|
+
let folderKey;
|
|
2192
|
+
let folderPath;
|
|
2193
|
+
if (bucketIdOrOptions !== null && typeof bucketIdOrOptions === 'object') {
|
|
2194
|
+
// Deprecated options-only form: uploadFile({ bucketId, path, content, ... })
|
|
2195
|
+
({ bucketId, path: resolvedPath, content: resolvedContent, folderId, folderKey, folderPath } = bucketIdOrOptions);
|
|
2196
|
+
}
|
|
2197
|
+
else {
|
|
2198
|
+
// Preferred positional form: uploadFile(bucketId, path, content, options?)
|
|
2199
|
+
bucketId = bucketIdOrOptions;
|
|
2200
|
+
resolvedPath = path;
|
|
2201
|
+
resolvedContent = content;
|
|
2202
|
+
const opts = options ?? {};
|
|
2203
|
+
({ folderId, folderKey, folderPath } = opts);
|
|
2204
|
+
}
|
|
2226
2205
|
if (!bucketId) {
|
|
2227
2206
|
throw new ValidationError({ message: 'bucketId is required for uploadFile' });
|
|
2228
2207
|
}
|
|
2229
|
-
if (!
|
|
2230
|
-
throw new ValidationError({ message: 'folderId is required for uploadFile' });
|
|
2231
|
-
}
|
|
2232
|
-
if (!path) {
|
|
2208
|
+
if (!resolvedPath) {
|
|
2233
2209
|
throw new ValidationError({ message: 'path is required for uploadFile' });
|
|
2234
2210
|
}
|
|
2235
|
-
if (!
|
|
2211
|
+
if (!resolvedContent) {
|
|
2236
2212
|
throw new ValidationError({ message: 'content is required for uploadFile' });
|
|
2237
2213
|
}
|
|
2214
|
+
const headers = resolveFolderHeaders({
|
|
2215
|
+
folderId,
|
|
2216
|
+
folderKey,
|
|
2217
|
+
folderPath,
|
|
2218
|
+
resourceType: 'Buckets.uploadFile',
|
|
2219
|
+
fallbackFolderKey: this.config.folderKey,
|
|
2220
|
+
});
|
|
2238
2221
|
const uriResponse = await this._getWriteUri({
|
|
2239
2222
|
bucketId,
|
|
2240
|
-
|
|
2241
|
-
|
|
2223
|
+
path: resolvedPath,
|
|
2224
|
+
headers,
|
|
2242
2225
|
});
|
|
2243
2226
|
// Upload file to the provided URI
|
|
2244
|
-
const response = await this._uploadToUri(uriResponse,
|
|
2227
|
+
const response = await this._uploadToUri(uriResponse, resolvedContent);
|
|
2245
2228
|
return {
|
|
2246
2229
|
success: response.status >= 200 && response.status < 300,
|
|
2247
2230
|
statusCode: response.status
|
|
2248
2231
|
};
|
|
2249
2232
|
}
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2233
|
+
async getReadUri(bucketIdOrOptions, path, options) {
|
|
2234
|
+
// Normalize the two overload forms into a single internal shape.
|
|
2235
|
+
let bucketId;
|
|
2236
|
+
let resolvedPath;
|
|
2237
|
+
let folderId;
|
|
2238
|
+
let folderKey;
|
|
2239
|
+
let folderPath;
|
|
2240
|
+
let expiryInMinutes;
|
|
2241
|
+
let restOptions;
|
|
2242
|
+
if (bucketIdOrOptions !== null && typeof bucketIdOrOptions === 'object') {
|
|
2243
|
+
// Deprecated options-only form: getReadUri({ bucketId, path, ... })
|
|
2244
|
+
const { bucketId: bid, path: p, expiryInMinutes: e, folderId: fid, folderKey: fkey, folderPath: fpath, ...rest } = bucketIdOrOptions;
|
|
2245
|
+
bucketId = bid;
|
|
2246
|
+
resolvedPath = p;
|
|
2247
|
+
expiryInMinutes = e;
|
|
2248
|
+
folderId = fid;
|
|
2249
|
+
folderKey = fkey;
|
|
2250
|
+
folderPath = fpath;
|
|
2251
|
+
restOptions = rest;
|
|
2252
|
+
}
|
|
2253
|
+
else {
|
|
2254
|
+
// Preferred positional form: getReadUri(bucketId, path, options?)
|
|
2255
|
+
bucketId = bucketIdOrOptions;
|
|
2256
|
+
resolvedPath = path;
|
|
2257
|
+
const opts = options ?? {};
|
|
2258
|
+
({ expiryInMinutes, folderId, folderKey, folderPath, ...restOptions } = opts);
|
|
2259
|
+
}
|
|
2260
|
+
const headers = resolveFolderHeaders({
|
|
2261
|
+
folderId,
|
|
2262
|
+
folderKey,
|
|
2263
|
+
folderPath,
|
|
2264
|
+
resourceType: 'Buckets.getReadUri',
|
|
2265
|
+
fallbackFolderKey: this.config.folderKey,
|
|
2266
|
+
});
|
|
2272
2267
|
const queryOptions = {
|
|
2273
2268
|
expiryInMinutes,
|
|
2274
2269
|
...addPrefixToKeys(restOptions, ODATA_PREFIX, Object.keys(restOptions))
|
|
2275
2270
|
};
|
|
2276
|
-
return this._getUri(BUCKET_ENDPOINTS.GET_READ_URI(bucketId), bucketId,
|
|
2271
|
+
return this._getUri(BUCKET_ENDPOINTS.GET_READ_URI(bucketId), bucketId, resolvedPath, headers, queryOptions);
|
|
2277
2272
|
}
|
|
2278
2273
|
/**
|
|
2279
2274
|
* Uploads content to the provided URI
|
|
@@ -2303,23 +2298,18 @@ class BucketService extends FolderScopedService {
|
|
|
2303
2298
|
* Private method to handle common URI request logic
|
|
2304
2299
|
* @param endpoint - The API endpoint to call
|
|
2305
2300
|
* @param bucketId - The bucket ID
|
|
2306
|
-
* @param folderId - The folder ID
|
|
2307
2301
|
* @param path - The file path
|
|
2302
|
+
* @param headers - Pre-built folder-context headers (built via `resolveFolderHeaders`)
|
|
2308
2303
|
* @param queryOptions - Additional query parameters
|
|
2309
2304
|
* @returns Promise resolving to blob file access information
|
|
2310
2305
|
*/
|
|
2311
|
-
async _getUri(endpoint, bucketId,
|
|
2306
|
+
async _getUri(endpoint, bucketId, path, headers, queryOptions = {}) {
|
|
2312
2307
|
if (!bucketId) {
|
|
2313
2308
|
throw new ValidationError({ message: 'bucketId is required for getUri' });
|
|
2314
2309
|
}
|
|
2315
|
-
if (!folderId) {
|
|
2316
|
-
throw new ValidationError({ message: 'folderId is required for getUri' });
|
|
2317
|
-
}
|
|
2318
2310
|
if (!path) {
|
|
2319
2311
|
throw new ValidationError({ message: 'path is required for getUri' });
|
|
2320
2312
|
}
|
|
2321
|
-
// Create headers with required folder ID
|
|
2322
|
-
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
2323
2313
|
// Filter out undefined values and build query params
|
|
2324
2314
|
const queryParams = filterUndefined({
|
|
2325
2315
|
path,
|
|
@@ -2454,16 +2444,16 @@ class BucketService extends FolderScopedService {
|
|
|
2454
2444
|
/**
|
|
2455
2445
|
* Gets a direct upload URL for a file in the bucket
|
|
2456
2446
|
*
|
|
2457
|
-
* @param options - Contains bucketId,
|
|
2447
|
+
* @param options - Contains bucketId, file path, optional expiry time, and pre-built folder-context headers
|
|
2458
2448
|
* @returns Promise resolving to blob file access information
|
|
2459
2449
|
*/
|
|
2460
2450
|
async _getWriteUri(options) {
|
|
2461
|
-
const { bucketId,
|
|
2451
|
+
const { bucketId, path, expiryInMinutes, headers, ...restOptions } = options;
|
|
2462
2452
|
const queryOptions = {
|
|
2463
2453
|
expiryInMinutes,
|
|
2464
2454
|
...addPrefixToKeys(restOptions, ODATA_PREFIX, Object.keys(restOptions))
|
|
2465
2455
|
};
|
|
2466
|
-
return this._getUri(BUCKET_ENDPOINTS.GET_WRITE_URI(bucketId), bucketId,
|
|
2456
|
+
return this._getUri(BUCKET_ENDPOINTS.GET_WRITE_URI(bucketId), bucketId, path, headers, queryOptions);
|
|
2467
2457
|
}
|
|
2468
2458
|
}
|
|
2469
2459
|
__decorate([
|
package/dist/cases/index.cjs
CHANGED
|
@@ -1623,12 +1623,18 @@ class PaginationHelpers {
|
|
|
1623
1623
|
* @returns Promise resolving to a paginated result
|
|
1624
1624
|
*/
|
|
1625
1625
|
static async getAllPaginated(params) {
|
|
1626
|
-
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1626
|
+
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1627
1627
|
const endpoint = getEndpoint(folderId);
|
|
1628
1628
|
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
1629
|
+
// On POST, the caller's options go in the body; queryParams stays in the URL.
|
|
1630
|
+
// On GET, everything is URL — queryParams merges with additionalParams.
|
|
1631
|
+
const isPost = method === HTTP_METHODS.POST;
|
|
1632
|
+
const requestSpec = isPost
|
|
1633
|
+
? { body: additionalParams, params: queryParams }
|
|
1634
|
+
: { params: { ...additionalParams, ...queryParams } };
|
|
1629
1635
|
const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
|
|
1630
1636
|
headers,
|
|
1631
|
-
|
|
1637
|
+
...requestSpec,
|
|
1632
1638
|
pagination: {
|
|
1633
1639
|
paginationType: options.paginationType || PaginationType.OFFSET,
|
|
1634
1640
|
itemsField: options.itemsField || DEFAULT_ITEMS_FIELD,
|
|
@@ -1653,7 +1659,7 @@ class PaginationHelpers {
|
|
|
1653
1659
|
* @returns Promise resolving to an object with data and totalCount
|
|
1654
1660
|
*/
|
|
1655
1661
|
static async getAllNonPaginated(params) {
|
|
1656
|
-
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1662
|
+
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1657
1663
|
// Set default field names
|
|
1658
1664
|
const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
|
|
1659
1665
|
const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
|
|
@@ -1663,11 +1669,11 @@ class PaginationHelpers {
|
|
|
1663
1669
|
// Make the API call based on method
|
|
1664
1670
|
let response;
|
|
1665
1671
|
if (method === HTTP_METHODS.POST) {
|
|
1666
|
-
response = await serviceAccess.post(endpoint, additionalParams, { headers });
|
|
1672
|
+
response = await serviceAccess.post(endpoint, additionalParams, { headers, params: queryParams });
|
|
1667
1673
|
}
|
|
1668
1674
|
else {
|
|
1669
1675
|
response = await serviceAccess.get(endpoint, {
|
|
1670
|
-
params: additionalParams,
|
|
1676
|
+
params: { ...additionalParams, ...queryParams },
|
|
1671
1677
|
headers
|
|
1672
1678
|
});
|
|
1673
1679
|
}
|
|
@@ -1722,6 +1728,7 @@ class PaginationHelpers {
|
|
|
1722
1728
|
headers: config.headers,
|
|
1723
1729
|
paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
|
|
1724
1730
|
additionalParams: prefixedOptions,
|
|
1731
|
+
queryParams: config.queryParams,
|
|
1725
1732
|
transformFn: config.transformFn,
|
|
1726
1733
|
method: config.method,
|
|
1727
1734
|
options: {
|
|
@@ -1739,6 +1746,7 @@ class PaginationHelpers {
|
|
|
1739
1746
|
folderId,
|
|
1740
1747
|
headers: config.headers,
|
|
1741
1748
|
additionalParams: prefixedOptions,
|
|
1749
|
+
queryParams: config.queryParams,
|
|
1742
1750
|
transformFn: config.transformFn,
|
|
1743
1751
|
method: config.method,
|
|
1744
1752
|
options: {
|
|
@@ -1930,18 +1938,17 @@ class BaseService {
|
|
|
1930
1938
|
const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
|
|
1931
1939
|
// Prepare request parameters based on pagination type
|
|
1932
1940
|
const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
|
|
1933
|
-
//
|
|
1941
|
+
// Route pagination state to wherever the API expects it (body for POST, URL for GET).
|
|
1942
|
+
// Caller-supplied options.body / options.params are respected as-is — the api-client
|
|
1943
|
+
// already handles params (URL) and body (request body) independently for every method.
|
|
1934
1944
|
if (method.toUpperCase() === 'POST') {
|
|
1935
1945
|
const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
|
|
1936
1946
|
options.body = {
|
|
1937
1947
|
...existingBody,
|
|
1938
|
-
...options.params,
|
|
1939
1948
|
...requestParams
|
|
1940
1949
|
};
|
|
1941
|
-
options.params = undefined;
|
|
1942
1950
|
}
|
|
1943
1951
|
else {
|
|
1944
|
-
// Merge pagination parameters with existing parameters
|
|
1945
1952
|
options.params = {
|
|
1946
1953
|
...options.params,
|
|
1947
1954
|
...requestParams
|
|
@@ -2828,6 +2835,24 @@ var TaskActivityType;
|
|
|
2828
2835
|
TaskActivityType["BulkCompleted"] = "BulkCompleted";
|
|
2829
2836
|
TaskActivityType["FirstOpened"] = "FirstOpened";
|
|
2830
2837
|
})(TaskActivityType || (TaskActivityType = {}));
|
|
2838
|
+
/**
|
|
2839
|
+
* Defines how a task assignment is distributed.
|
|
2840
|
+
*
|
|
2841
|
+
* Defaults to {@link TaskAssignmentCriteria.SingleUser} (a direct single-user
|
|
2842
|
+
* assignment) when not specified. The group-based criteria tell Action Center
|
|
2843
|
+
* how to distribute the task across the members of a directory group.
|
|
2844
|
+
*/
|
|
2845
|
+
var TaskAssignmentCriteria;
|
|
2846
|
+
(function (TaskAssignmentCriteria) {
|
|
2847
|
+
/** Assigned to a single user, like a direct assignment. */
|
|
2848
|
+
TaskAssignmentCriteria["SingleUser"] = "SingleUser";
|
|
2849
|
+
/** Assigned to the group member with the fewest pending tasks. */
|
|
2850
|
+
TaskAssignmentCriteria["Workload"] = "Workload";
|
|
2851
|
+
/** Assigned to all users in the group. */
|
|
2852
|
+
TaskAssignmentCriteria["AllUsers"] = "AllUsers";
|
|
2853
|
+
/** Assigned in a round-robin manner across the group's members. */
|
|
2854
|
+
TaskAssignmentCriteria["RoundRobin"] = "RoundRobin";
|
|
2855
|
+
})(TaskAssignmentCriteria || (TaskAssignmentCriteria = {}));
|
|
2831
2856
|
|
|
2832
2857
|
/**
|
|
2833
2858
|
* Maps numeric TaskStatus values (from API) to TaskStatus enum values.
|
|
@@ -2877,17 +2902,19 @@ function createTaskMethods(taskData, service) {
|
|
|
2877
2902
|
async assign(options) {
|
|
2878
2903
|
if (!taskData.id)
|
|
2879
2904
|
throw new Error('Task ID is undefined');
|
|
2905
|
+
const criteria = options.assignmentCriteria !== undefined ? { assignmentCriteria: options.assignmentCriteria } : {};
|
|
2880
2906
|
const assignmentOptions = 'userId' in options && options.userId !== undefined
|
|
2881
|
-
? { taskId: taskData.id, userId: options.userId }
|
|
2882
|
-
: { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail };
|
|
2907
|
+
? { taskId: taskData.id, userId: options.userId, ...criteria }
|
|
2908
|
+
: { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail, ...criteria };
|
|
2883
2909
|
return service.assign(assignmentOptions);
|
|
2884
2910
|
},
|
|
2885
2911
|
async reassign(options) {
|
|
2886
2912
|
if (!taskData.id)
|
|
2887
2913
|
throw new Error('Task ID is undefined');
|
|
2914
|
+
const criteria = options.assignmentCriteria !== undefined ? { assignmentCriteria: options.assignmentCriteria } : {};
|
|
2888
2915
|
const assignmentOptions = 'userId' in options && options.userId !== undefined
|
|
2889
|
-
? { taskId: taskData.id, userId: options.userId }
|
|
2890
|
-
: { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail };
|
|
2916
|
+
? { taskId: taskData.id, userId: options.userId, ...criteria }
|
|
2917
|
+
: { taskId: taskData.id, userNameOrEmail: options.userNameOrEmail, ...criteria };
|
|
2891
2918
|
return service.reassign(assignmentOptions);
|
|
2892
2919
|
},
|
|
2893
2920
|
async unassign() {
|
|
@@ -3200,6 +3227,26 @@ class TaskService extends BaseService {
|
|
|
3200
3227
|
* }
|
|
3201
3228
|
* ]);
|
|
3202
3229
|
* ```
|
|
3230
|
+
*
|
|
3231
|
+
* @example Group assignment
|
|
3232
|
+
* ```typescript
|
|
3233
|
+
* import { TaskAssignmentCriteria } from '@uipath/uipath-typescript/tasks';
|
|
3234
|
+
*
|
|
3235
|
+
* // Assign to a directory group by userId + criteria — Action Center
|
|
3236
|
+
* // distributes the task across the group's members based on the criteria
|
|
3237
|
+
* const result = await tasks.assign({
|
|
3238
|
+
* taskId: 123,
|
|
3239
|
+
* userId: 456, // a DirectoryGroup id from tasks.getUsers()
|
|
3240
|
+
* assignmentCriteria: TaskAssignmentCriteria.AllUsers
|
|
3241
|
+
* });
|
|
3242
|
+
*
|
|
3243
|
+
* // ...or identify the group by name instead of id
|
|
3244
|
+
* const result2 = await tasks.assign({
|
|
3245
|
+
* taskId: 123,
|
|
3246
|
+
* userNameOrEmail: "My Group",
|
|
3247
|
+
* assignmentCriteria: TaskAssignmentCriteria.AllUsers
|
|
3248
|
+
* });
|
|
3249
|
+
* ```
|
|
3203
3250
|
*/
|
|
3204
3251
|
async assign(taskAssignments) {
|
|
3205
3252
|
// Normalize input to array
|
|
@@ -3251,6 +3298,25 @@ class TaskService extends BaseService {
|
|
|
3251
3298
|
* }
|
|
3252
3299
|
* ]);
|
|
3253
3300
|
* ```
|
|
3301
|
+
*
|
|
3302
|
+
* @example Group reassignment
|
|
3303
|
+
* ```typescript
|
|
3304
|
+
* import { TaskAssignmentCriteria } from '@uipath/uipath-typescript/tasks';
|
|
3305
|
+
*
|
|
3306
|
+
* // Reassign to a directory group by userId + criteria
|
|
3307
|
+
* const result = await tasks.reassign({
|
|
3308
|
+
* taskId: 123,
|
|
3309
|
+
* userId: 456, // a DirectoryGroup id from tasks.getUsers()
|
|
3310
|
+
* assignmentCriteria: TaskAssignmentCriteria.AllUsers
|
|
3311
|
+
* });
|
|
3312
|
+
*
|
|
3313
|
+
* // ...or identify the group by name instead of id
|
|
3314
|
+
* const result2 = await tasks.reassign({
|
|
3315
|
+
* taskId: 123,
|
|
3316
|
+
* userNameOrEmail: "My Group",
|
|
3317
|
+
* assignmentCriteria: TaskAssignmentCriteria.AllUsers
|
|
3318
|
+
* });
|
|
3319
|
+
* ```
|
|
3254
3320
|
*/
|
|
3255
3321
|
async reassign(taskAssignments) {
|
|
3256
3322
|
// Normalize input to array
|
package/dist/cases/index.d.ts
CHANGED
|
@@ -1090,22 +1090,49 @@ interface RawTaskGetResponse extends TaskBaseResponse {
|
|
|
1090
1090
|
actionLabel?: string | null;
|
|
1091
1091
|
taskSlaDetails?: TaskSlaDetail[] | null;
|
|
1092
1092
|
completedByUser?: UserLoginInfo | null;
|
|
1093
|
-
taskAssignmentCriteria?:
|
|
1093
|
+
taskAssignmentCriteria?: TaskAssignmentCriteria;
|
|
1094
1094
|
taskAssignees?: UserLoginInfo[] | null;
|
|
1095
1095
|
taskSource?: TaskSource | null;
|
|
1096
1096
|
processingTime?: number | null;
|
|
1097
1097
|
data?: Record<string, unknown> | null;
|
|
1098
1098
|
}
|
|
1099
|
+
/**
|
|
1100
|
+
* Defines how a task assignment is distributed.
|
|
1101
|
+
*
|
|
1102
|
+
* Defaults to {@link TaskAssignmentCriteria.SingleUser} (a direct single-user
|
|
1103
|
+
* assignment) when not specified. The group-based criteria tell Action Center
|
|
1104
|
+
* how to distribute the task across the members of a directory group.
|
|
1105
|
+
*/
|
|
1106
|
+
declare enum TaskAssignmentCriteria {
|
|
1107
|
+
/** Assigned to a single user, like a direct assignment. */
|
|
1108
|
+
SingleUser = "SingleUser",
|
|
1109
|
+
/** Assigned to the group member with the fewest pending tasks. */
|
|
1110
|
+
Workload = "Workload",
|
|
1111
|
+
/** Assigned to all users in the group. */
|
|
1112
|
+
AllUsers = "AllUsers",
|
|
1113
|
+
/** Assigned in a round-robin manner across the group's members. */
|
|
1114
|
+
RoundRobin = "RoundRobin"
|
|
1115
|
+
}
|
|
1099
1116
|
/**
|
|
1100
1117
|
* Options for task assignment operations when called from a task instance
|
|
1101
|
-
* Requires either userId or userNameOrEmail, but not both
|
|
1118
|
+
* Requires either userId or userNameOrEmail, but not both. Optionally accepts
|
|
1119
|
+
* an assignment criteria; defaults to a single-user assignment, set a group
|
|
1120
|
+
* criteria (e.g. {@link TaskAssignmentCriteria.AllUsers}) for a directory group.
|
|
1102
1121
|
*/
|
|
1103
|
-
type TaskAssignOptions = {
|
|
1122
|
+
type TaskAssignOptions = ({
|
|
1104
1123
|
userId: number;
|
|
1105
1124
|
userNameOrEmail?: never;
|
|
1106
1125
|
} | {
|
|
1107
1126
|
userId?: never;
|
|
1108
1127
|
userNameOrEmail: string;
|
|
1128
|
+
}) & {
|
|
1129
|
+
/**
|
|
1130
|
+
* How the assignment is distributed. Optional — defaults to
|
|
1131
|
+
* {@link TaskAssignmentCriteria.SingleUser} (a direct single-user assignment).
|
|
1132
|
+
* Set a group criteria (e.g. {@link TaskAssignmentCriteria.AllUsers}) to
|
|
1133
|
+
* distribute the task across a directory group's members.
|
|
1134
|
+
*/
|
|
1135
|
+
assignmentCriteria?: TaskAssignmentCriteria;
|
|
1109
1136
|
};
|
|
1110
1137
|
/**
|
|
1111
1138
|
* Options for task assignment operations when called from the service
|