@uipath/uipath-typescript 1.5.0 → 1.5.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/README.md +7 -1
- package/dist/assets/index.cjs +107 -6
- package/dist/assets/index.d.ts +12 -1
- package/dist/assets/index.mjs +107 -6
- package/dist/attachments/index.cjs +95 -3
- package/dist/attachments/index.mjs +95 -3
- package/dist/buckets/index.cjs +111 -6
- package/dist/buckets/index.d.ts +12 -1
- package/dist/buckets/index.mjs +111 -6
- package/dist/cases/index.cjs +434 -266
- package/dist/cases/index.d.ts +140 -3
- package/dist/cases/index.mjs +434 -266
- package/dist/conversational-agent/index.cjs +23 -1
- package/dist/conversational-agent/index.d.ts +117 -6
- package/dist/conversational-agent/index.mjs +23 -1
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.mjs +1 -1
- package/dist/entities/index.cjs +423 -0
- package/dist/entities/index.d.ts +441 -1
- package/dist/entities/index.mjs +422 -1
- package/dist/index.cjs +974 -293
- package/dist/index.d.ts +1150 -43
- package/dist/index.mjs +975 -294
- package/dist/index.umd.js +974 -293
- package/dist/jobs/index.cjs +12 -5
- package/dist/jobs/index.d.ts +12 -1
- package/dist/jobs/index.mjs +12 -5
- package/dist/maestro-processes/index.cjs +344 -243
- package/dist/maestro-processes/index.d.ts +189 -5
- package/dist/maestro-processes/index.mjs +344 -243
- package/dist/notifications/index.cjs +2012 -0
- package/dist/notifications/index.d.ts +615 -0
- package/dist/notifications/index.mjs +2010 -0
- package/dist/processes/index.cjs +93 -9
- package/dist/processes/index.d.ts +12 -1
- package/dist/processes/index.mjs +93 -9
- package/dist/queues/index.cjs +106 -5
- package/dist/queues/index.d.ts +12 -1
- package/dist/queues/index.mjs +106 -5
- package/dist/tasks/index.cjs +100 -4
- package/dist/tasks/index.mjs +100 -4
- package/dist/traces/index.cjs +218 -4
- package/dist/traces/index.d.ts +357 -22
- package/dist/traces/index.mjs +219 -5
- package/package.json +14 -4
package/dist/buckets/index.cjs
CHANGED
|
@@ -1128,6 +1128,97 @@ function addPrefixToKeys(obj, prefix, keys) {
|
|
|
1128
1128
|
}
|
|
1129
1129
|
return result;
|
|
1130
1130
|
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Creates a new map with the keys and values reversed
|
|
1133
|
+
* @param map The original map to reverse
|
|
1134
|
+
* @returns A new map with keys and values swapped
|
|
1135
|
+
*
|
|
1136
|
+
* @example
|
|
1137
|
+
* ```typescript
|
|
1138
|
+
* const original = { key1: 'value1', key2: 'value2' };
|
|
1139
|
+
* const reversed = reverseMap(original);
|
|
1140
|
+
* // reversed = { value1: 'key1', value2: 'key2' }
|
|
1141
|
+
* ```
|
|
1142
|
+
*/
|
|
1143
|
+
function reverseMap(map) {
|
|
1144
|
+
return Object.entries(map).reduce((acc, [key, value]) => {
|
|
1145
|
+
acc[value] = key;
|
|
1146
|
+
return acc;
|
|
1147
|
+
}, {});
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* OData query-string keys whose values may contain field identifiers that
|
|
1151
|
+
* need rewriting from SDK names → API names.
|
|
1152
|
+
*/
|
|
1153
|
+
const ODATA_FIELD_PARAM_KEYS = ['filter', 'orderby', 'select', 'expand'];
|
|
1154
|
+
/**
|
|
1155
|
+
* Matches one token at a time in an OData expression:
|
|
1156
|
+
* 1. A single-quoted string literal, allowing the `''` escape sequence —
|
|
1157
|
+
* consumed atomically so identifiers inside the literal can't match.
|
|
1158
|
+
* 2. An OData identifier (`[A-Za-z_][A-Za-z0-9_]*`).
|
|
1159
|
+
* Anything else (whitespace, operators, parens, commas) is left alone by
|
|
1160
|
+
* `String.prototype.replace`, which only substitutes matched substrings.
|
|
1161
|
+
*/
|
|
1162
|
+
const ODATA_TOKEN_RE = /'(?:[^']|'')*'|[A-Za-z_][A-Za-z0-9_]*/g;
|
|
1163
|
+
/**
|
|
1164
|
+
* Rewrites SDK field identifiers to API field identifiers inside an OData
|
|
1165
|
+
* expression string (`$filter`, `$orderby`, `$select`, `$expand`).
|
|
1166
|
+
*
|
|
1167
|
+
* Field maps (e.g. `JobMap`) rename API fields → SDK fields on responses, so
|
|
1168
|
+
* SDK consumers see the renamed names. Without this rewrite, the same name
|
|
1169
|
+
* in a `filter` string would be forwarded verbatim and the API (which still
|
|
1170
|
+
* uses the original name) would reject it.
|
|
1171
|
+
*
|
|
1172
|
+
* Quoted string literals (with the OData `''` escape) are preserved exactly:
|
|
1173
|
+
* the token regex consumes them whole, so identifiers inside literals never
|
|
1174
|
+
* match. Identifier tokens are looked up in the reversed field map.
|
|
1175
|
+
*
|
|
1176
|
+
* @example
|
|
1177
|
+
* ```typescript
|
|
1178
|
+
* const requestMap = { processName: 'releaseName' };
|
|
1179
|
+
* rewriteODataIdentifiers("processName eq 'processName'", requestMap);
|
|
1180
|
+
* // "releaseName eq 'processName'" — identifier rewritten, literal preserved
|
|
1181
|
+
* ```
|
|
1182
|
+
*/
|
|
1183
|
+
function rewriteODataIdentifiers(expression, requestMap) {
|
|
1184
|
+
if (!expression)
|
|
1185
|
+
return expression;
|
|
1186
|
+
return expression.replace(ODATA_TOKEN_RE, (match) => match.startsWith("'") ? match : (requestMap[match] ?? match));
|
|
1187
|
+
}
|
|
1188
|
+
/**
|
|
1189
|
+
* Symmetric counterpart of {@link transformRequest} for OData query options:
|
|
1190
|
+
* rewrites SDK field identifiers inside the recognized OData string params
|
|
1191
|
+
* (`filter`, `orderby`, `select`, `expand`) to their API names using the
|
|
1192
|
+
* reversed form of a response field map. Returns a shallow copy with the
|
|
1193
|
+
* relevant values rewritten; other keys pass through unchanged.
|
|
1194
|
+
*
|
|
1195
|
+
* Use at the OData edge so SDK consumers can refer to renamed fields by
|
|
1196
|
+
* their SDK name throughout — for reading the response and for filtering /
|
|
1197
|
+
* sorting / projecting / expanding.
|
|
1198
|
+
*
|
|
1199
|
+
* @param options The OData query options as authored with SDK field names
|
|
1200
|
+
* @param responseMap The response field map (API → SDK); reversed internally
|
|
1201
|
+
*
|
|
1202
|
+
* @example
|
|
1203
|
+
* ```typescript
|
|
1204
|
+
* // JobMap renames releaseName → processName on responses.
|
|
1205
|
+
* transformOptions({ filter: "processName eq 'X'" }, JobMap);
|
|
1206
|
+
* // { filter: "releaseName eq 'X'" }
|
|
1207
|
+
* ```
|
|
1208
|
+
*/
|
|
1209
|
+
function transformOptions(options, responseMap) {
|
|
1210
|
+
const requestMap = reverseMap(responseMap);
|
|
1211
|
+
if (Object.keys(requestMap).length === 0)
|
|
1212
|
+
return options;
|
|
1213
|
+
const result = { ...options };
|
|
1214
|
+
for (const key of ODATA_FIELD_PARAM_KEYS) {
|
|
1215
|
+
const value = result[key];
|
|
1216
|
+
if (typeof value === 'string') {
|
|
1217
|
+
result[key] = rewriteODataIdentifiers(value, requestMap);
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
return result;
|
|
1221
|
+
}
|
|
1131
1222
|
/**
|
|
1132
1223
|
* Transforms an array-based dictionary with separate keys and values arrays
|
|
1133
1224
|
* into a standard JavaScript object/record
|
|
@@ -1925,9 +2016,12 @@ class FolderScopedService extends BaseService {
|
|
|
1925
2016
|
* @param name - Resource name to search for
|
|
1926
2017
|
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) + OData query options (`expand`, `select`)
|
|
1927
2018
|
* @param transform - Maps a raw OData item to the typed response (e.g. PascalCase → camelCase via field map)
|
|
2019
|
+
* @param responseFieldMap - Optional response field map (API → SDK), reversed internally by
|
|
2020
|
+
* `transformOptions` to rewrite SDK field names back to API names in user-supplied
|
|
2021
|
+
* `expand` / `select` (symmetric counterpart to `transform`)
|
|
1928
2022
|
* @throws ValidationError when inputs are malformed; NotFoundError when no match
|
|
1929
2023
|
*/
|
|
1930
|
-
async getByNameLookup(resourceType, endpoint, name, options, transform) {
|
|
2024
|
+
async getByNameLookup(resourceType, endpoint, name, options, transform, responseFieldMap) {
|
|
1931
2025
|
const validatedName = validateName(resourceType, name);
|
|
1932
2026
|
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
1933
2027
|
const headers = resolveFolderHeaders({
|
|
@@ -1937,8 +2031,11 @@ class FolderScopedService extends BaseService {
|
|
|
1937
2031
|
resourceType: `${resourceType}.getByName`,
|
|
1938
2032
|
fallbackFolderKey: this.config.folderKey,
|
|
1939
2033
|
});
|
|
2034
|
+
const apiFieldOptions = responseFieldMap
|
|
2035
|
+
? transformOptions(queryOptions, responseFieldMap)
|
|
2036
|
+
: queryOptions;
|
|
1940
2037
|
const apiOptions = {
|
|
1941
|
-
...addPrefixToKeys(
|
|
2038
|
+
...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
|
|
1942
2039
|
'$filter': `Name eq '${validatedName.replace(SINGLE_QUOTE_RE, "''")}'`,
|
|
1943
2040
|
'$top': '1',
|
|
1944
2041
|
};
|
|
@@ -2183,6 +2280,9 @@ class BucketService extends FolderScopedService {
|
|
|
2183
2280
|
});
|
|
2184
2281
|
// Transformation function for blob items
|
|
2185
2282
|
const transformBlobItem = (item) => transformData(item, BucketMap);
|
|
2283
|
+
// Rewrite renamed SDK field names → API names inside OData strings
|
|
2284
|
+
// before delegating.
|
|
2285
|
+
const apiRestOptions = transformOptions(restOptions, BucketMap);
|
|
2186
2286
|
return PaginationHelpers.getAll({
|
|
2187
2287
|
serviceAccess: this.createPaginationServiceAccess(),
|
|
2188
2288
|
getEndpoint: () => BUCKET_ENDPOINTS.GET_FILE_META_DATA(bucketId),
|
|
@@ -2198,7 +2298,7 @@ class BucketService extends FolderScopedService {
|
|
|
2198
2298
|
},
|
|
2199
2299
|
excludeFromPrefix: ['prefix'], // Bucket-specific param, not OData
|
|
2200
2300
|
headers,
|
|
2201
|
-
},
|
|
2301
|
+
}, apiRestOptions);
|
|
2202
2302
|
}
|
|
2203
2303
|
async uploadFile(bucketIdOrOptions, path, content, options) {
|
|
2204
2304
|
// Normalize the two overload forms into a single internal shape.
|
|
@@ -2282,9 +2382,10 @@ class BucketService extends FolderScopedService {
|
|
|
2282
2382
|
resourceType: 'Buckets.getReadUri',
|
|
2283
2383
|
fallbackFolderKey: this.config.folderKey,
|
|
2284
2384
|
});
|
|
2385
|
+
const apiRestOptions = transformOptions(restOptions, BucketMap);
|
|
2285
2386
|
const queryOptions = {
|
|
2286
2387
|
expiryInMinutes,
|
|
2287
|
-
...addPrefixToKeys(
|
|
2388
|
+
...addPrefixToKeys(apiRestOptions, ODATA_PREFIX, Object.keys(apiRestOptions))
|
|
2288
2389
|
};
|
|
2289
2390
|
return this._getUri(BUCKET_ENDPOINTS.GET_READ_URI(bucketId), bucketId, resolvedPath, headers, queryOptions);
|
|
2290
2391
|
}
|
|
@@ -2404,6 +2505,9 @@ class BucketService extends FolderScopedService {
|
|
|
2404
2505
|
fallbackFolderKey: this.config.folderKey,
|
|
2405
2506
|
});
|
|
2406
2507
|
const transformBucketFile = (file) => transformData(pascalToCamelCaseKeys(file), BucketMap);
|
|
2508
|
+
// Rewrite renamed SDK field names → API names inside OData strings
|
|
2509
|
+
// before delegating.
|
|
2510
|
+
const apiRestOptions = transformOptions(restOptions, BucketMap);
|
|
2407
2511
|
return PaginationHelpers.getAll({
|
|
2408
2512
|
serviceAccess: this.createPaginationServiceAccess(),
|
|
2409
2513
|
getEndpoint: () => BUCKET_ENDPOINTS.GET_FILES(bucketId),
|
|
@@ -2420,7 +2524,7 @@ class BucketService extends FolderScopedService {
|
|
|
2420
2524
|
},
|
|
2421
2525
|
excludeFromPrefix: ['directory', 'recursive', 'fileNameRegex'],
|
|
2422
2526
|
headers,
|
|
2423
|
-
}, { ...
|
|
2527
|
+
}, { ...apiRestOptions, directory: '/', recursive: true });
|
|
2424
2528
|
}
|
|
2425
2529
|
/**
|
|
2426
2530
|
* Deletes a file from a bucket
|
|
@@ -2467,9 +2571,10 @@ class BucketService extends FolderScopedService {
|
|
|
2467
2571
|
*/
|
|
2468
2572
|
async _getWriteUri(options) {
|
|
2469
2573
|
const { bucketId, path, expiryInMinutes, headers, ...restOptions } = options;
|
|
2574
|
+
const apiRestOptions = transformOptions(restOptions, BucketMap);
|
|
2470
2575
|
const queryOptions = {
|
|
2471
2576
|
expiryInMinutes,
|
|
2472
|
-
...addPrefixToKeys(
|
|
2577
|
+
...addPrefixToKeys(apiRestOptions, ODATA_PREFIX, Object.keys(apiRestOptions))
|
|
2473
2578
|
};
|
|
2474
2579
|
return this._getUri(BUCKET_ENDPOINTS.GET_WRITE_URI(bucketId), bucketId, path, headers, queryOptions);
|
|
2475
2580
|
}
|
package/dist/buckets/index.d.ts
CHANGED
|
@@ -326,6 +326,14 @@ interface FolderScopedOptions extends BaseOptions {
|
|
|
326
326
|
folderPath?: string;
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
+
/**
|
|
330
|
+
* Type for field mapping configuration
|
|
331
|
+
* Maps source field names to target field names
|
|
332
|
+
*/
|
|
333
|
+
type FieldMapping = {
|
|
334
|
+
[sourceField: string]: string;
|
|
335
|
+
};
|
|
336
|
+
|
|
329
337
|
/**
|
|
330
338
|
* Base service for services that need folder-specific functionality.
|
|
331
339
|
*
|
|
@@ -367,9 +375,12 @@ declare class FolderScopedService extends BaseService {
|
|
|
367
375
|
* @param name - Resource name to search for
|
|
368
376
|
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) + OData query options (`expand`, `select`)
|
|
369
377
|
* @param transform - Maps a raw OData item to the typed response (e.g. PascalCase → camelCase via field map)
|
|
378
|
+
* @param responseFieldMap - Optional response field map (API → SDK), reversed internally by
|
|
379
|
+
* `transformOptions` to rewrite SDK field names back to API names in user-supplied
|
|
380
|
+
* `expand` / `select` (symmetric counterpart to `transform`)
|
|
370
381
|
* @throws ValidationError when inputs are malformed; NotFoundError when no match
|
|
371
382
|
*/
|
|
372
|
-
protected getByNameLookup<TRaw extends object, T>(resourceType: string, endpoint: string, name: string, options: FolderScopedOptions, transform: (raw: TRaw) => T): Promise<T>;
|
|
383
|
+
protected getByNameLookup<TRaw extends object, T>(resourceType: string, endpoint: string, name: string, options: FolderScopedOptions, transform: (raw: TRaw) => T, responseFieldMap?: FieldMapping): Promise<T>;
|
|
373
384
|
}
|
|
374
385
|
|
|
375
386
|
declare enum BucketOptions {
|
package/dist/buckets/index.mjs
CHANGED
|
@@ -1126,6 +1126,97 @@ function addPrefixToKeys(obj, prefix, keys) {
|
|
|
1126
1126
|
}
|
|
1127
1127
|
return result;
|
|
1128
1128
|
}
|
|
1129
|
+
/**
|
|
1130
|
+
* Creates a new map with the keys and values reversed
|
|
1131
|
+
* @param map The original map to reverse
|
|
1132
|
+
* @returns A new map with keys and values swapped
|
|
1133
|
+
*
|
|
1134
|
+
* @example
|
|
1135
|
+
* ```typescript
|
|
1136
|
+
* const original = { key1: 'value1', key2: 'value2' };
|
|
1137
|
+
* const reversed = reverseMap(original);
|
|
1138
|
+
* // reversed = { value1: 'key1', value2: 'key2' }
|
|
1139
|
+
* ```
|
|
1140
|
+
*/
|
|
1141
|
+
function reverseMap(map) {
|
|
1142
|
+
return Object.entries(map).reduce((acc, [key, value]) => {
|
|
1143
|
+
acc[value] = key;
|
|
1144
|
+
return acc;
|
|
1145
|
+
}, {});
|
|
1146
|
+
}
|
|
1147
|
+
/**
|
|
1148
|
+
* OData query-string keys whose values may contain field identifiers that
|
|
1149
|
+
* need rewriting from SDK names → API names.
|
|
1150
|
+
*/
|
|
1151
|
+
const ODATA_FIELD_PARAM_KEYS = ['filter', 'orderby', 'select', 'expand'];
|
|
1152
|
+
/**
|
|
1153
|
+
* Matches one token at a time in an OData expression:
|
|
1154
|
+
* 1. A single-quoted string literal, allowing the `''` escape sequence —
|
|
1155
|
+
* consumed atomically so identifiers inside the literal can't match.
|
|
1156
|
+
* 2. An OData identifier (`[A-Za-z_][A-Za-z0-9_]*`).
|
|
1157
|
+
* Anything else (whitespace, operators, parens, commas) is left alone by
|
|
1158
|
+
* `String.prototype.replace`, which only substitutes matched substrings.
|
|
1159
|
+
*/
|
|
1160
|
+
const ODATA_TOKEN_RE = /'(?:[^']|'')*'|[A-Za-z_][A-Za-z0-9_]*/g;
|
|
1161
|
+
/**
|
|
1162
|
+
* Rewrites SDK field identifiers to API field identifiers inside an OData
|
|
1163
|
+
* expression string (`$filter`, `$orderby`, `$select`, `$expand`).
|
|
1164
|
+
*
|
|
1165
|
+
* Field maps (e.g. `JobMap`) rename API fields → SDK fields on responses, so
|
|
1166
|
+
* SDK consumers see the renamed names. Without this rewrite, the same name
|
|
1167
|
+
* in a `filter` string would be forwarded verbatim and the API (which still
|
|
1168
|
+
* uses the original name) would reject it.
|
|
1169
|
+
*
|
|
1170
|
+
* Quoted string literals (with the OData `''` escape) are preserved exactly:
|
|
1171
|
+
* the token regex consumes them whole, so identifiers inside literals never
|
|
1172
|
+
* match. Identifier tokens are looked up in the reversed field map.
|
|
1173
|
+
*
|
|
1174
|
+
* @example
|
|
1175
|
+
* ```typescript
|
|
1176
|
+
* const requestMap = { processName: 'releaseName' };
|
|
1177
|
+
* rewriteODataIdentifiers("processName eq 'processName'", requestMap);
|
|
1178
|
+
* // "releaseName eq 'processName'" — identifier rewritten, literal preserved
|
|
1179
|
+
* ```
|
|
1180
|
+
*/
|
|
1181
|
+
function rewriteODataIdentifiers(expression, requestMap) {
|
|
1182
|
+
if (!expression)
|
|
1183
|
+
return expression;
|
|
1184
|
+
return expression.replace(ODATA_TOKEN_RE, (match) => match.startsWith("'") ? match : (requestMap[match] ?? match));
|
|
1185
|
+
}
|
|
1186
|
+
/**
|
|
1187
|
+
* Symmetric counterpart of {@link transformRequest} for OData query options:
|
|
1188
|
+
* rewrites SDK field identifiers inside the recognized OData string params
|
|
1189
|
+
* (`filter`, `orderby`, `select`, `expand`) to their API names using the
|
|
1190
|
+
* reversed form of a response field map. Returns a shallow copy with the
|
|
1191
|
+
* relevant values rewritten; other keys pass through unchanged.
|
|
1192
|
+
*
|
|
1193
|
+
* Use at the OData edge so SDK consumers can refer to renamed fields by
|
|
1194
|
+
* their SDK name throughout — for reading the response and for filtering /
|
|
1195
|
+
* sorting / projecting / expanding.
|
|
1196
|
+
*
|
|
1197
|
+
* @param options The OData query options as authored with SDK field names
|
|
1198
|
+
* @param responseMap The response field map (API → SDK); reversed internally
|
|
1199
|
+
*
|
|
1200
|
+
* @example
|
|
1201
|
+
* ```typescript
|
|
1202
|
+
* // JobMap renames releaseName → processName on responses.
|
|
1203
|
+
* transformOptions({ filter: "processName eq 'X'" }, JobMap);
|
|
1204
|
+
* // { filter: "releaseName eq 'X'" }
|
|
1205
|
+
* ```
|
|
1206
|
+
*/
|
|
1207
|
+
function transformOptions(options, responseMap) {
|
|
1208
|
+
const requestMap = reverseMap(responseMap);
|
|
1209
|
+
if (Object.keys(requestMap).length === 0)
|
|
1210
|
+
return options;
|
|
1211
|
+
const result = { ...options };
|
|
1212
|
+
for (const key of ODATA_FIELD_PARAM_KEYS) {
|
|
1213
|
+
const value = result[key];
|
|
1214
|
+
if (typeof value === 'string') {
|
|
1215
|
+
result[key] = rewriteODataIdentifiers(value, requestMap);
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
return result;
|
|
1219
|
+
}
|
|
1129
1220
|
/**
|
|
1130
1221
|
* Transforms an array-based dictionary with separate keys and values arrays
|
|
1131
1222
|
* into a standard JavaScript object/record
|
|
@@ -1923,9 +2014,12 @@ class FolderScopedService extends BaseService {
|
|
|
1923
2014
|
* @param name - Resource name to search for
|
|
1924
2015
|
* @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) + OData query options (`expand`, `select`)
|
|
1925
2016
|
* @param transform - Maps a raw OData item to the typed response (e.g. PascalCase → camelCase via field map)
|
|
2017
|
+
* @param responseFieldMap - Optional response field map (API → SDK), reversed internally by
|
|
2018
|
+
* `transformOptions` to rewrite SDK field names back to API names in user-supplied
|
|
2019
|
+
* `expand` / `select` (symmetric counterpart to `transform`)
|
|
1926
2020
|
* @throws ValidationError when inputs are malformed; NotFoundError when no match
|
|
1927
2021
|
*/
|
|
1928
|
-
async getByNameLookup(resourceType, endpoint, name, options, transform) {
|
|
2022
|
+
async getByNameLookup(resourceType, endpoint, name, options, transform, responseFieldMap) {
|
|
1929
2023
|
const validatedName = validateName(resourceType, name);
|
|
1930
2024
|
const { folderId, folderKey, folderPath, ...queryOptions } = options;
|
|
1931
2025
|
const headers = resolveFolderHeaders({
|
|
@@ -1935,8 +2029,11 @@ class FolderScopedService extends BaseService {
|
|
|
1935
2029
|
resourceType: `${resourceType}.getByName`,
|
|
1936
2030
|
fallbackFolderKey: this.config.folderKey,
|
|
1937
2031
|
});
|
|
2032
|
+
const apiFieldOptions = responseFieldMap
|
|
2033
|
+
? transformOptions(queryOptions, responseFieldMap)
|
|
2034
|
+
: queryOptions;
|
|
1938
2035
|
const apiOptions = {
|
|
1939
|
-
...addPrefixToKeys(
|
|
2036
|
+
...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
|
|
1940
2037
|
'$filter': `Name eq '${validatedName.replace(SINGLE_QUOTE_RE, "''")}'`,
|
|
1941
2038
|
'$top': '1',
|
|
1942
2039
|
};
|
|
@@ -2181,6 +2278,9 @@ class BucketService extends FolderScopedService {
|
|
|
2181
2278
|
});
|
|
2182
2279
|
// Transformation function for blob items
|
|
2183
2280
|
const transformBlobItem = (item) => transformData(item, BucketMap);
|
|
2281
|
+
// Rewrite renamed SDK field names → API names inside OData strings
|
|
2282
|
+
// before delegating.
|
|
2283
|
+
const apiRestOptions = transformOptions(restOptions, BucketMap);
|
|
2184
2284
|
return PaginationHelpers.getAll({
|
|
2185
2285
|
serviceAccess: this.createPaginationServiceAccess(),
|
|
2186
2286
|
getEndpoint: () => BUCKET_ENDPOINTS.GET_FILE_META_DATA(bucketId),
|
|
@@ -2196,7 +2296,7 @@ class BucketService extends FolderScopedService {
|
|
|
2196
2296
|
},
|
|
2197
2297
|
excludeFromPrefix: ['prefix'], // Bucket-specific param, not OData
|
|
2198
2298
|
headers,
|
|
2199
|
-
},
|
|
2299
|
+
}, apiRestOptions);
|
|
2200
2300
|
}
|
|
2201
2301
|
async uploadFile(bucketIdOrOptions, path, content, options) {
|
|
2202
2302
|
// Normalize the two overload forms into a single internal shape.
|
|
@@ -2280,9 +2380,10 @@ class BucketService extends FolderScopedService {
|
|
|
2280
2380
|
resourceType: 'Buckets.getReadUri',
|
|
2281
2381
|
fallbackFolderKey: this.config.folderKey,
|
|
2282
2382
|
});
|
|
2383
|
+
const apiRestOptions = transformOptions(restOptions, BucketMap);
|
|
2283
2384
|
const queryOptions = {
|
|
2284
2385
|
expiryInMinutes,
|
|
2285
|
-
...addPrefixToKeys(
|
|
2386
|
+
...addPrefixToKeys(apiRestOptions, ODATA_PREFIX, Object.keys(apiRestOptions))
|
|
2286
2387
|
};
|
|
2287
2388
|
return this._getUri(BUCKET_ENDPOINTS.GET_READ_URI(bucketId), bucketId, resolvedPath, headers, queryOptions);
|
|
2288
2389
|
}
|
|
@@ -2402,6 +2503,9 @@ class BucketService extends FolderScopedService {
|
|
|
2402
2503
|
fallbackFolderKey: this.config.folderKey,
|
|
2403
2504
|
});
|
|
2404
2505
|
const transformBucketFile = (file) => transformData(pascalToCamelCaseKeys(file), BucketMap);
|
|
2506
|
+
// Rewrite renamed SDK field names → API names inside OData strings
|
|
2507
|
+
// before delegating.
|
|
2508
|
+
const apiRestOptions = transformOptions(restOptions, BucketMap);
|
|
2405
2509
|
return PaginationHelpers.getAll({
|
|
2406
2510
|
serviceAccess: this.createPaginationServiceAccess(),
|
|
2407
2511
|
getEndpoint: () => BUCKET_ENDPOINTS.GET_FILES(bucketId),
|
|
@@ -2418,7 +2522,7 @@ class BucketService extends FolderScopedService {
|
|
|
2418
2522
|
},
|
|
2419
2523
|
excludeFromPrefix: ['directory', 'recursive', 'fileNameRegex'],
|
|
2420
2524
|
headers,
|
|
2421
|
-
}, { ...
|
|
2525
|
+
}, { ...apiRestOptions, directory: '/', recursive: true });
|
|
2422
2526
|
}
|
|
2423
2527
|
/**
|
|
2424
2528
|
* Deletes a file from a bucket
|
|
@@ -2465,9 +2569,10 @@ class BucketService extends FolderScopedService {
|
|
|
2465
2569
|
*/
|
|
2466
2570
|
async _getWriteUri(options) {
|
|
2467
2571
|
const { bucketId, path, expiryInMinutes, headers, ...restOptions } = options;
|
|
2572
|
+
const apiRestOptions = transformOptions(restOptions, BucketMap);
|
|
2468
2573
|
const queryOptions = {
|
|
2469
2574
|
expiryInMinutes,
|
|
2470
|
-
...addPrefixToKeys(
|
|
2575
|
+
...addPrefixToKeys(apiRestOptions, ODATA_PREFIX, Object.keys(apiRestOptions))
|
|
2471
2576
|
};
|
|
2472
2577
|
return this._getUri(BUCKET_ENDPOINTS.GET_WRITE_URI(bucketId), bucketId, path, headers, queryOptions);
|
|
2473
2578
|
}
|