@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
|
@@ -1297,12 +1297,18 @@ class PaginationHelpers {
|
|
|
1297
1297
|
* @returns Promise resolving to a paginated result
|
|
1298
1298
|
*/
|
|
1299
1299
|
static async getAllPaginated(params) {
|
|
1300
|
-
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1300
|
+
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1301
1301
|
const endpoint = getEndpoint(folderId);
|
|
1302
1302
|
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
1303
|
+
// On POST, the caller's options go in the body; queryParams stays in the URL.
|
|
1304
|
+
// On GET, everything is URL — queryParams merges with additionalParams.
|
|
1305
|
+
const isPost = method === HTTP_METHODS.POST;
|
|
1306
|
+
const requestSpec = isPost
|
|
1307
|
+
? { body: additionalParams, params: queryParams }
|
|
1308
|
+
: { params: { ...additionalParams, ...queryParams } };
|
|
1303
1309
|
const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
|
|
1304
1310
|
headers,
|
|
1305
|
-
|
|
1311
|
+
...requestSpec,
|
|
1306
1312
|
pagination: {
|
|
1307
1313
|
paginationType: options.paginationType || PaginationType.OFFSET,
|
|
1308
1314
|
itemsField: options.itemsField || DEFAULT_ITEMS_FIELD,
|
|
@@ -1327,7 +1333,7 @@ class PaginationHelpers {
|
|
|
1327
1333
|
* @returns Promise resolving to an object with data and totalCount
|
|
1328
1334
|
*/
|
|
1329
1335
|
static async getAllNonPaginated(params) {
|
|
1330
|
-
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1336
|
+
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1331
1337
|
// Set default field names
|
|
1332
1338
|
const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
|
|
1333
1339
|
const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
|
|
@@ -1337,11 +1343,11 @@ class PaginationHelpers {
|
|
|
1337
1343
|
// Make the API call based on method
|
|
1338
1344
|
let response;
|
|
1339
1345
|
if (method === HTTP_METHODS.POST) {
|
|
1340
|
-
response = await serviceAccess.post(endpoint, additionalParams, { headers });
|
|
1346
|
+
response = await serviceAccess.post(endpoint, additionalParams, { headers, params: queryParams });
|
|
1341
1347
|
}
|
|
1342
1348
|
else {
|
|
1343
1349
|
response = await serviceAccess.get(endpoint, {
|
|
1344
|
-
params: additionalParams,
|
|
1350
|
+
params: { ...additionalParams, ...queryParams },
|
|
1345
1351
|
headers
|
|
1346
1352
|
});
|
|
1347
1353
|
}
|
|
@@ -1396,6 +1402,7 @@ class PaginationHelpers {
|
|
|
1396
1402
|
headers: config.headers,
|
|
1397
1403
|
paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
|
|
1398
1404
|
additionalParams: prefixedOptions,
|
|
1405
|
+
queryParams: config.queryParams,
|
|
1399
1406
|
transformFn: config.transformFn,
|
|
1400
1407
|
method: config.method,
|
|
1401
1408
|
options: {
|
|
@@ -1413,6 +1420,7 @@ class PaginationHelpers {
|
|
|
1413
1420
|
folderId,
|
|
1414
1421
|
headers: config.headers,
|
|
1415
1422
|
additionalParams: prefixedOptions,
|
|
1423
|
+
queryParams: config.queryParams,
|
|
1416
1424
|
transformFn: config.transformFn,
|
|
1417
1425
|
method: config.method,
|
|
1418
1426
|
options: {
|
|
@@ -1604,18 +1612,17 @@ class BaseService {
|
|
|
1604
1612
|
const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
|
|
1605
1613
|
// Prepare request parameters based on pagination type
|
|
1606
1614
|
const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
|
|
1607
|
-
//
|
|
1615
|
+
// Route pagination state to wherever the API expects it (body for POST, URL for GET).
|
|
1616
|
+
// Caller-supplied options.body / options.params are respected as-is — the api-client
|
|
1617
|
+
// already handles params (URL) and body (request body) independently for every method.
|
|
1608
1618
|
if (method.toUpperCase() === 'POST') {
|
|
1609
1619
|
const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
|
|
1610
1620
|
options.body = {
|
|
1611
1621
|
...existingBody,
|
|
1612
|
-
...options.params,
|
|
1613
1622
|
...requestParams
|
|
1614
1623
|
};
|
|
1615
|
-
options.params = undefined;
|
|
1616
1624
|
}
|
|
1617
1625
|
else {
|
|
1618
|
-
// Merge pagination parameters with existing parameters
|
|
1619
1626
|
options.params = {
|
|
1620
1627
|
...options.params,
|
|
1621
1628
|
...requestParams
|
package/dist/buckets/index.cjs
CHANGED
|
@@ -1301,12 +1301,18 @@ class PaginationHelpers {
|
|
|
1301
1301
|
* @returns Promise resolving to a paginated result
|
|
1302
1302
|
*/
|
|
1303
1303
|
static async getAllPaginated(params) {
|
|
1304
|
-
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1304
|
+
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1305
1305
|
const endpoint = getEndpoint(folderId);
|
|
1306
1306
|
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
1307
|
+
// On POST, the caller's options go in the body; queryParams stays in the URL.
|
|
1308
|
+
// On GET, everything is URL — queryParams merges with additionalParams.
|
|
1309
|
+
const isPost = method === HTTP_METHODS.POST;
|
|
1310
|
+
const requestSpec = isPost
|
|
1311
|
+
? { body: additionalParams, params: queryParams }
|
|
1312
|
+
: { params: { ...additionalParams, ...queryParams } };
|
|
1307
1313
|
const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
|
|
1308
1314
|
headers,
|
|
1309
|
-
|
|
1315
|
+
...requestSpec,
|
|
1310
1316
|
pagination: {
|
|
1311
1317
|
paginationType: options.paginationType || PaginationType.OFFSET,
|
|
1312
1318
|
itemsField: options.itemsField || DEFAULT_ITEMS_FIELD,
|
|
@@ -1331,7 +1337,7 @@ class PaginationHelpers {
|
|
|
1331
1337
|
* @returns Promise resolving to an object with data and totalCount
|
|
1332
1338
|
*/
|
|
1333
1339
|
static async getAllNonPaginated(params) {
|
|
1334
|
-
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1340
|
+
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1335
1341
|
// Set default field names
|
|
1336
1342
|
const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
|
|
1337
1343
|
const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
|
|
@@ -1341,11 +1347,11 @@ class PaginationHelpers {
|
|
|
1341
1347
|
// Make the API call based on method
|
|
1342
1348
|
let response;
|
|
1343
1349
|
if (method === HTTP_METHODS.POST) {
|
|
1344
|
-
response = await serviceAccess.post(endpoint, additionalParams, { headers });
|
|
1350
|
+
response = await serviceAccess.post(endpoint, additionalParams, { headers, params: queryParams });
|
|
1345
1351
|
}
|
|
1346
1352
|
else {
|
|
1347
1353
|
response = await serviceAccess.get(endpoint, {
|
|
1348
|
-
params: additionalParams,
|
|
1354
|
+
params: { ...additionalParams, ...queryParams },
|
|
1349
1355
|
headers
|
|
1350
1356
|
});
|
|
1351
1357
|
}
|
|
@@ -1400,6 +1406,7 @@ class PaginationHelpers {
|
|
|
1400
1406
|
headers: config.headers,
|
|
1401
1407
|
paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
|
|
1402
1408
|
additionalParams: prefixedOptions,
|
|
1409
|
+
queryParams: config.queryParams,
|
|
1403
1410
|
transformFn: config.transformFn,
|
|
1404
1411
|
method: config.method,
|
|
1405
1412
|
options: {
|
|
@@ -1417,6 +1424,7 @@ class PaginationHelpers {
|
|
|
1417
1424
|
folderId,
|
|
1418
1425
|
headers: config.headers,
|
|
1419
1426
|
additionalParams: prefixedOptions,
|
|
1427
|
+
queryParams: config.queryParams,
|
|
1420
1428
|
transformFn: config.transformFn,
|
|
1421
1429
|
method: config.method,
|
|
1422
1430
|
options: {
|
|
@@ -1608,18 +1616,17 @@ class BaseService {
|
|
|
1608
1616
|
const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
|
|
1609
1617
|
// Prepare request parameters based on pagination type
|
|
1610
1618
|
const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
|
|
1611
|
-
//
|
|
1619
|
+
// Route pagination state to wherever the API expects it (body for POST, URL for GET).
|
|
1620
|
+
// Caller-supplied options.body / options.params are respected as-is — the api-client
|
|
1621
|
+
// already handles params (URL) and body (request body) independently for every method.
|
|
1612
1622
|
if (method.toUpperCase() === 'POST') {
|
|
1613
1623
|
const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
|
|
1614
1624
|
options.body = {
|
|
1615
1625
|
...existingBody,
|
|
1616
|
-
...options.params,
|
|
1617
1626
|
...requestParams
|
|
1618
1627
|
};
|
|
1619
|
-
options.params = undefined;
|
|
1620
1628
|
}
|
|
1621
1629
|
else {
|
|
1622
|
-
// Merge pagination parameters with existing parameters
|
|
1623
1630
|
options.params = {
|
|
1624
1631
|
...options.params,
|
|
1625
1632
|
...requestParams
|
|
@@ -2132,48 +2139,32 @@ class BucketService extends FolderScopedService {
|
|
|
2132
2139
|
}
|
|
2133
2140
|
}, options);
|
|
2134
2141
|
}
|
|
2135
|
-
|
|
2136
|
-
* Gets metadata for files in a bucket with optional filtering and pagination
|
|
2137
|
-
*
|
|
2138
|
-
* The method returns either:
|
|
2139
|
-
* - A NonPaginatedResponse with items array (when no pagination parameters are provided)
|
|
2140
|
-
* - A PaginatedResponse with navigation cursors (when any pagination parameter is provided)
|
|
2141
|
-
*
|
|
2142
|
-
* @param bucketId - The ID of the bucket to get file metadata from
|
|
2143
|
-
* @param folderId - Required folder ID for organization unit context
|
|
2144
|
-
* @param options - Optional parameters for filtering, pagination and access URL generation
|
|
2145
|
-
* @returns Promise resolving to the list of file metadata in the bucket or paginated result
|
|
2146
|
-
*
|
|
2147
|
-
* @example
|
|
2148
|
-
* ```typescript
|
|
2149
|
-
* import { Buckets } from '@uipath/uipath-typescript/buckets';
|
|
2150
|
-
*
|
|
2151
|
-
* const buckets = new Buckets(sdk);
|
|
2152
|
-
*
|
|
2153
|
-
* // Get metadata for all files in a bucket
|
|
2154
|
-
* const fileMetadata = await buckets.getFileMetaData(123, 456);
|
|
2155
|
-
*
|
|
2156
|
-
* // Get file metadata with a specific prefix
|
|
2157
|
-
* const fileMetadata = await buckets.getFileMetaData(123, 456, {
|
|
2158
|
-
* prefix: '/folder1'
|
|
2159
|
-
* });
|
|
2160
|
-
*
|
|
2161
|
-
* // First page with pagination
|
|
2162
|
-
* const page1 = await buckets.getFileMetaData(123, 456, { pageSize: 10 });
|
|
2163
|
-
*
|
|
2164
|
-
* // Navigate using cursor
|
|
2165
|
-
* if (page1.hasNextPage) {
|
|
2166
|
-
* const page2 = await buckets.getFileMetaData(123, 456, { cursor: page1.nextCursor });
|
|
2167
|
-
* }
|
|
2168
|
-
* ```
|
|
2169
|
-
*/
|
|
2170
|
-
async getFileMetaData(bucketId, folderId, options) {
|
|
2142
|
+
async getFileMetaData(bucketId, optionsOrFolderId, legacyOptions) {
|
|
2171
2143
|
if (!bucketId) {
|
|
2172
2144
|
throw new ValidationError({ message: 'bucketId is required for getFileMetaData' });
|
|
2173
2145
|
}
|
|
2174
|
-
|
|
2175
|
-
|
|
2146
|
+
// Normalize the two overload forms into a single internal shape.
|
|
2147
|
+
let folderId;
|
|
2148
|
+
let folderKey;
|
|
2149
|
+
let folderPath;
|
|
2150
|
+
let restOptions;
|
|
2151
|
+
if (typeof optionsOrFolderId === 'number') {
|
|
2152
|
+
// Deprecated positional form: getFileMetaData(bucketId, folderId, options?)
|
|
2153
|
+
folderId = optionsOrFolderId;
|
|
2154
|
+
restOptions = (legacyOptions ?? {});
|
|
2155
|
+
}
|
|
2156
|
+
else {
|
|
2157
|
+
// Preferred form: getFileMetaData(bucketId, options?)
|
|
2158
|
+
const opts = optionsOrFolderId ?? {};
|
|
2159
|
+
({ folderId, folderKey, folderPath, ...restOptions } = opts);
|
|
2176
2160
|
}
|
|
2161
|
+
const headers = resolveFolderHeaders({
|
|
2162
|
+
folderId,
|
|
2163
|
+
folderKey,
|
|
2164
|
+
folderPath,
|
|
2165
|
+
resourceType: 'Buckets.getFileMetaData',
|
|
2166
|
+
fallbackFolderKey: this.config.folderKey,
|
|
2167
|
+
});
|
|
2177
2168
|
// Transformation function for blob items
|
|
2178
2169
|
const transformBlobItem = (item) => transformData(item, BucketMap);
|
|
2179
2170
|
return PaginationHelpers.getAll({
|
|
@@ -2189,93 +2180,97 @@ class BucketService extends FolderScopedService {
|
|
|
2189
2180
|
tokenParam: BUCKET_TOKEN_PARAMS.TOKEN_PARAM
|
|
2190
2181
|
}
|
|
2191
2182
|
},
|
|
2192
|
-
excludeFromPrefix: ['prefix'] // Bucket-specific param, not OData
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
* // In Node env with Buffer
|
|
2217
|
-
* const buffer = Buffer.from('file content');
|
|
2218
|
-
* const result = await buckets.uploadFile({
|
|
2219
|
-
* bucketId: 123,
|
|
2220
|
-
* folderId: 456,
|
|
2221
|
-
* path: '/folder/example.txt',
|
|
2222
|
-
* content: buffer
|
|
2223
|
-
* });
|
|
2224
|
-
* ```
|
|
2225
|
-
*/
|
|
2226
|
-
async uploadFile(options) {
|
|
2227
|
-
const { bucketId, folderId, path, content } = options;
|
|
2183
|
+
excludeFromPrefix: ['prefix'], // Bucket-specific param, not OData
|
|
2184
|
+
headers,
|
|
2185
|
+
}, restOptions);
|
|
2186
|
+
}
|
|
2187
|
+
async uploadFile(bucketIdOrOptions, path, content, options) {
|
|
2188
|
+
// Normalize the two overload forms into a single internal shape.
|
|
2189
|
+
let bucketId;
|
|
2190
|
+
let resolvedPath;
|
|
2191
|
+
let resolvedContent;
|
|
2192
|
+
let folderId;
|
|
2193
|
+
let folderKey;
|
|
2194
|
+
let folderPath;
|
|
2195
|
+
if (bucketIdOrOptions !== null && typeof bucketIdOrOptions === 'object') {
|
|
2196
|
+
// Deprecated options-only form: uploadFile({ bucketId, path, content, ... })
|
|
2197
|
+
({ bucketId, path: resolvedPath, content: resolvedContent, folderId, folderKey, folderPath } = bucketIdOrOptions);
|
|
2198
|
+
}
|
|
2199
|
+
else {
|
|
2200
|
+
// Preferred positional form: uploadFile(bucketId, path, content, options?)
|
|
2201
|
+
bucketId = bucketIdOrOptions;
|
|
2202
|
+
resolvedPath = path;
|
|
2203
|
+
resolvedContent = content;
|
|
2204
|
+
const opts = options ?? {};
|
|
2205
|
+
({ folderId, folderKey, folderPath } = opts);
|
|
2206
|
+
}
|
|
2228
2207
|
if (!bucketId) {
|
|
2229
2208
|
throw new ValidationError({ message: 'bucketId is required for uploadFile' });
|
|
2230
2209
|
}
|
|
2231
|
-
if (!
|
|
2232
|
-
throw new ValidationError({ message: 'folderId is required for uploadFile' });
|
|
2233
|
-
}
|
|
2234
|
-
if (!path) {
|
|
2210
|
+
if (!resolvedPath) {
|
|
2235
2211
|
throw new ValidationError({ message: 'path is required for uploadFile' });
|
|
2236
2212
|
}
|
|
2237
|
-
if (!
|
|
2213
|
+
if (!resolvedContent) {
|
|
2238
2214
|
throw new ValidationError({ message: 'content is required for uploadFile' });
|
|
2239
2215
|
}
|
|
2216
|
+
const headers = resolveFolderHeaders({
|
|
2217
|
+
folderId,
|
|
2218
|
+
folderKey,
|
|
2219
|
+
folderPath,
|
|
2220
|
+
resourceType: 'Buckets.uploadFile',
|
|
2221
|
+
fallbackFolderKey: this.config.folderKey,
|
|
2222
|
+
});
|
|
2240
2223
|
const uriResponse = await this._getWriteUri({
|
|
2241
2224
|
bucketId,
|
|
2242
|
-
|
|
2243
|
-
|
|
2225
|
+
path: resolvedPath,
|
|
2226
|
+
headers,
|
|
2244
2227
|
});
|
|
2245
2228
|
// Upload file to the provided URI
|
|
2246
|
-
const response = await this._uploadToUri(uriResponse,
|
|
2229
|
+
const response = await this._uploadToUri(uriResponse, resolvedContent);
|
|
2247
2230
|
return {
|
|
2248
2231
|
success: response.status >= 200 && response.status < 300,
|
|
2249
2232
|
statusCode: response.status
|
|
2250
2233
|
};
|
|
2251
2234
|
}
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2235
|
+
async getReadUri(bucketIdOrOptions, path, options) {
|
|
2236
|
+
// Normalize the two overload forms into a single internal shape.
|
|
2237
|
+
let bucketId;
|
|
2238
|
+
let resolvedPath;
|
|
2239
|
+
let folderId;
|
|
2240
|
+
let folderKey;
|
|
2241
|
+
let folderPath;
|
|
2242
|
+
let expiryInMinutes;
|
|
2243
|
+
let restOptions;
|
|
2244
|
+
if (bucketIdOrOptions !== null && typeof bucketIdOrOptions === 'object') {
|
|
2245
|
+
// Deprecated options-only form: getReadUri({ bucketId, path, ... })
|
|
2246
|
+
const { bucketId: bid, path: p, expiryInMinutes: e, folderId: fid, folderKey: fkey, folderPath: fpath, ...rest } = bucketIdOrOptions;
|
|
2247
|
+
bucketId = bid;
|
|
2248
|
+
resolvedPath = p;
|
|
2249
|
+
expiryInMinutes = e;
|
|
2250
|
+
folderId = fid;
|
|
2251
|
+
folderKey = fkey;
|
|
2252
|
+
folderPath = fpath;
|
|
2253
|
+
restOptions = rest;
|
|
2254
|
+
}
|
|
2255
|
+
else {
|
|
2256
|
+
// Preferred positional form: getReadUri(bucketId, path, options?)
|
|
2257
|
+
bucketId = bucketIdOrOptions;
|
|
2258
|
+
resolvedPath = path;
|
|
2259
|
+
const opts = options ?? {};
|
|
2260
|
+
({ expiryInMinutes, folderId, folderKey, folderPath, ...restOptions } = opts);
|
|
2261
|
+
}
|
|
2262
|
+
const headers = resolveFolderHeaders({
|
|
2263
|
+
folderId,
|
|
2264
|
+
folderKey,
|
|
2265
|
+
folderPath,
|
|
2266
|
+
resourceType: 'Buckets.getReadUri',
|
|
2267
|
+
fallbackFolderKey: this.config.folderKey,
|
|
2268
|
+
});
|
|
2274
2269
|
const queryOptions = {
|
|
2275
2270
|
expiryInMinutes,
|
|
2276
2271
|
...addPrefixToKeys(restOptions, ODATA_PREFIX, Object.keys(restOptions))
|
|
2277
2272
|
};
|
|
2278
|
-
return this._getUri(BUCKET_ENDPOINTS.GET_READ_URI(bucketId), bucketId,
|
|
2273
|
+
return this._getUri(BUCKET_ENDPOINTS.GET_READ_URI(bucketId), bucketId, resolvedPath, headers, queryOptions);
|
|
2279
2274
|
}
|
|
2280
2275
|
/**
|
|
2281
2276
|
* Uploads content to the provided URI
|
|
@@ -2305,23 +2300,18 @@ class BucketService extends FolderScopedService {
|
|
|
2305
2300
|
* Private method to handle common URI request logic
|
|
2306
2301
|
* @param endpoint - The API endpoint to call
|
|
2307
2302
|
* @param bucketId - The bucket ID
|
|
2308
|
-
* @param folderId - The folder ID
|
|
2309
2303
|
* @param path - The file path
|
|
2304
|
+
* @param headers - Pre-built folder-context headers (built via `resolveFolderHeaders`)
|
|
2310
2305
|
* @param queryOptions - Additional query parameters
|
|
2311
2306
|
* @returns Promise resolving to blob file access information
|
|
2312
2307
|
*/
|
|
2313
|
-
async _getUri(endpoint, bucketId,
|
|
2308
|
+
async _getUri(endpoint, bucketId, path, headers, queryOptions = {}) {
|
|
2314
2309
|
if (!bucketId) {
|
|
2315
2310
|
throw new ValidationError({ message: 'bucketId is required for getUri' });
|
|
2316
2311
|
}
|
|
2317
|
-
if (!folderId) {
|
|
2318
|
-
throw new ValidationError({ message: 'folderId is required for getUri' });
|
|
2319
|
-
}
|
|
2320
2312
|
if (!path) {
|
|
2321
2313
|
throw new ValidationError({ message: 'path is required for getUri' });
|
|
2322
2314
|
}
|
|
2323
|
-
// Create headers with required folder ID
|
|
2324
|
-
const headers = createHeaders({ [FOLDER_ID]: folderId });
|
|
2325
2315
|
// Filter out undefined values and build query params
|
|
2326
2316
|
const queryParams = filterUndefined({
|
|
2327
2317
|
path,
|
|
@@ -2456,16 +2446,16 @@ class BucketService extends FolderScopedService {
|
|
|
2456
2446
|
/**
|
|
2457
2447
|
* Gets a direct upload URL for a file in the bucket
|
|
2458
2448
|
*
|
|
2459
|
-
* @param options - Contains bucketId,
|
|
2449
|
+
* @param options - Contains bucketId, file path, optional expiry time, and pre-built folder-context headers
|
|
2460
2450
|
* @returns Promise resolving to blob file access information
|
|
2461
2451
|
*/
|
|
2462
2452
|
async _getWriteUri(options) {
|
|
2463
|
-
const { bucketId,
|
|
2453
|
+
const { bucketId, path, expiryInMinutes, headers, ...restOptions } = options;
|
|
2464
2454
|
const queryOptions = {
|
|
2465
2455
|
expiryInMinutes,
|
|
2466
2456
|
...addPrefixToKeys(restOptions, ODATA_PREFIX, Object.keys(restOptions))
|
|
2467
2457
|
};
|
|
2468
|
-
return this._getUri(BUCKET_ENDPOINTS.GET_WRITE_URI(bucketId), bucketId,
|
|
2458
|
+
return this._getUri(BUCKET_ENDPOINTS.GET_WRITE_URI(bucketId), bucketId, path, headers, queryOptions);
|
|
2469
2459
|
}
|
|
2470
2460
|
}
|
|
2471
2461
|
__decorate([
|