@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.
Files changed (45) hide show
  1. package/README.md +7 -1
  2. package/dist/assets/index.cjs +107 -6
  3. package/dist/assets/index.d.ts +12 -1
  4. package/dist/assets/index.mjs +107 -6
  5. package/dist/attachments/index.cjs +95 -3
  6. package/dist/attachments/index.mjs +95 -3
  7. package/dist/buckets/index.cjs +111 -6
  8. package/dist/buckets/index.d.ts +12 -1
  9. package/dist/buckets/index.mjs +111 -6
  10. package/dist/cases/index.cjs +434 -266
  11. package/dist/cases/index.d.ts +140 -3
  12. package/dist/cases/index.mjs +434 -266
  13. package/dist/conversational-agent/index.cjs +23 -1
  14. package/dist/conversational-agent/index.d.ts +117 -6
  15. package/dist/conversational-agent/index.mjs +23 -1
  16. package/dist/core/index.cjs +1 -1
  17. package/dist/core/index.mjs +1 -1
  18. package/dist/entities/index.cjs +423 -0
  19. package/dist/entities/index.d.ts +441 -1
  20. package/dist/entities/index.mjs +422 -1
  21. package/dist/index.cjs +974 -293
  22. package/dist/index.d.ts +1150 -43
  23. package/dist/index.mjs +975 -294
  24. package/dist/index.umd.js +974 -293
  25. package/dist/jobs/index.cjs +12 -5
  26. package/dist/jobs/index.d.ts +12 -1
  27. package/dist/jobs/index.mjs +12 -5
  28. package/dist/maestro-processes/index.cjs +344 -243
  29. package/dist/maestro-processes/index.d.ts +189 -5
  30. package/dist/maestro-processes/index.mjs +344 -243
  31. package/dist/notifications/index.cjs +2012 -0
  32. package/dist/notifications/index.d.ts +615 -0
  33. package/dist/notifications/index.mjs +2010 -0
  34. package/dist/processes/index.cjs +93 -9
  35. package/dist/processes/index.d.ts +12 -1
  36. package/dist/processes/index.mjs +93 -9
  37. package/dist/queues/index.cjs +106 -5
  38. package/dist/queues/index.d.ts +12 -1
  39. package/dist/queues/index.mjs +106 -5
  40. package/dist/tasks/index.cjs +100 -4
  41. package/dist/tasks/index.mjs +100 -4
  42. package/dist/traces/index.cjs +218 -4
  43. package/dist/traces/index.d.ts +357 -22
  44. package/dist/traces/index.mjs +219 -5
  45. package/package.json +14 -4
package/README.md CHANGED
@@ -265,6 +265,7 @@ The SDK provides access to the following services through modular imports:
265
265
  - `CaseInstances` from `@uipath/uipath-typescript/cases` - Manage maestro case executions
266
266
  - `Tasks` from `@uipath/uipath-typescript/tasks` - Create and manage tasks
267
267
  - `Entities` from `@uipath/uipath-typescript/entities` - Data Fabric entity operations
268
+ - `ChoiceSets` from `@uipath/uipath-typescript/entities` - Data Fabric choice set operations
268
269
  - `Processes` from `@uipath/uipath-typescript/processes` - Manage Orchestrator processes
269
270
  - `Buckets` from `@uipath/uipath-typescript/buckets` - Manage storage buckets in Orchestrator
270
271
  - `Queues` from `@uipath/uipath-typescript/queues` - Manage Orchestrator queues
@@ -281,7 +282,7 @@ import { Cases, CaseInstances } from '@uipath/uipath-typescript/cases';
281
282
  import { Tasks, TaskType } from '@uipath/uipath-typescript/tasks';
282
283
  import { Processes } from '@uipath/uipath-typescript/processes';
283
284
  import { Buckets } from '@uipath/uipath-typescript/buckets';
284
- import { Entities } from '@uipath/uipath-typescript/entities';
285
+ import { ChoiceSets, Entities } from '@uipath/uipath-typescript/entities';
285
286
 
286
287
  // Initialize SDK
287
288
  const sdk = new UiPath({ /* config */ });
@@ -295,6 +296,7 @@ const tasks = new Tasks(sdk);
295
296
  const processes = new Processes(sdk);
296
297
  const buckets = new Buckets(sdk);
297
298
  const entities = new Entities(sdk);
299
+ const choiceSets = new ChoiceSets(sdk);
298
300
 
299
301
  // Maestro - Get processes and their instances
300
302
  const allProcesses = await maestroProcesses.getAll();
@@ -309,6 +311,9 @@ await processInstances.resume(instanceId, 'folder-key');
309
311
  await processInstances.cancel(instanceId, 'folder-key', {
310
312
  comment: 'Cancelled due to error'
311
313
  });
314
+ await processInstances.retry(instanceId, 'folder-key', {
315
+ comment: 'Retrying flaky failure'
316
+ });
312
317
 
313
318
  // Maestro Case Instances
314
319
  const caseInstance = await caseInstances.getById(instanceId, 'folder-key');
@@ -367,6 +372,7 @@ const records = await entities.getAllRecords('entity-uuid', {
367
372
  pageSize: 100,
368
373
  expansionLevel: 1
369
374
  });
375
+ const allChoiceSets = await choiceSets.getAll();
370
376
 
371
377
  // Insert records
372
378
  await entities.insertRecordsById('entity-uuid', [
@@ -1119,6 +1119,97 @@ function addPrefixToKeys(obj, prefix, keys) {
1119
1119
  }
1120
1120
  return result;
1121
1121
  }
1122
+ /**
1123
+ * Creates a new map with the keys and values reversed
1124
+ * @param map The original map to reverse
1125
+ * @returns A new map with keys and values swapped
1126
+ *
1127
+ * @example
1128
+ * ```typescript
1129
+ * const original = { key1: 'value1', key2: 'value2' };
1130
+ * const reversed = reverseMap(original);
1131
+ * // reversed = { value1: 'key1', value2: 'key2' }
1132
+ * ```
1133
+ */
1134
+ function reverseMap(map) {
1135
+ return Object.entries(map).reduce((acc, [key, value]) => {
1136
+ acc[value] = key;
1137
+ return acc;
1138
+ }, {});
1139
+ }
1140
+ /**
1141
+ * OData query-string keys whose values may contain field identifiers that
1142
+ * need rewriting from SDK names → API names.
1143
+ */
1144
+ const ODATA_FIELD_PARAM_KEYS = ['filter', 'orderby', 'select', 'expand'];
1145
+ /**
1146
+ * Matches one token at a time in an OData expression:
1147
+ * 1. A single-quoted string literal, allowing the `''` escape sequence —
1148
+ * consumed atomically so identifiers inside the literal can't match.
1149
+ * 2. An OData identifier (`[A-Za-z_][A-Za-z0-9_]*`).
1150
+ * Anything else (whitespace, operators, parens, commas) is left alone by
1151
+ * `String.prototype.replace`, which only substitutes matched substrings.
1152
+ */
1153
+ const ODATA_TOKEN_RE = /'(?:[^']|'')*'|[A-Za-z_][A-Za-z0-9_]*/g;
1154
+ /**
1155
+ * Rewrites SDK field identifiers to API field identifiers inside an OData
1156
+ * expression string (`$filter`, `$orderby`, `$select`, `$expand`).
1157
+ *
1158
+ * Field maps (e.g. `JobMap`) rename API fields → SDK fields on responses, so
1159
+ * SDK consumers see the renamed names. Without this rewrite, the same name
1160
+ * in a `filter` string would be forwarded verbatim and the API (which still
1161
+ * uses the original name) would reject it.
1162
+ *
1163
+ * Quoted string literals (with the OData `''` escape) are preserved exactly:
1164
+ * the token regex consumes them whole, so identifiers inside literals never
1165
+ * match. Identifier tokens are looked up in the reversed field map.
1166
+ *
1167
+ * @example
1168
+ * ```typescript
1169
+ * const requestMap = { processName: 'releaseName' };
1170
+ * rewriteODataIdentifiers("processName eq 'processName'", requestMap);
1171
+ * // "releaseName eq 'processName'" — identifier rewritten, literal preserved
1172
+ * ```
1173
+ */
1174
+ function rewriteODataIdentifiers(expression, requestMap) {
1175
+ if (!expression)
1176
+ return expression;
1177
+ return expression.replace(ODATA_TOKEN_RE, (match) => match.startsWith("'") ? match : (requestMap[match] ?? match));
1178
+ }
1179
+ /**
1180
+ * Symmetric counterpart of {@link transformRequest} for OData query options:
1181
+ * rewrites SDK field identifiers inside the recognized OData string params
1182
+ * (`filter`, `orderby`, `select`, `expand`) to their API names using the
1183
+ * reversed form of a response field map. Returns a shallow copy with the
1184
+ * relevant values rewritten; other keys pass through unchanged.
1185
+ *
1186
+ * Use at the OData edge so SDK consumers can refer to renamed fields by
1187
+ * their SDK name throughout — for reading the response and for filtering /
1188
+ * sorting / projecting / expanding.
1189
+ *
1190
+ * @param options The OData query options as authored with SDK field names
1191
+ * @param responseMap The response field map (API → SDK); reversed internally
1192
+ *
1193
+ * @example
1194
+ * ```typescript
1195
+ * // JobMap renames releaseName → processName on responses.
1196
+ * transformOptions({ filter: "processName eq 'X'" }, JobMap);
1197
+ * // { filter: "releaseName eq 'X'" }
1198
+ * ```
1199
+ */
1200
+ function transformOptions(options, responseMap) {
1201
+ const requestMap = reverseMap(responseMap);
1202
+ if (Object.keys(requestMap).length === 0)
1203
+ return options;
1204
+ const result = { ...options };
1205
+ for (const key of ODATA_FIELD_PARAM_KEYS) {
1206
+ const value = result[key];
1207
+ if (typeof value === 'string') {
1208
+ result[key] = rewriteODataIdentifiers(value, requestMap);
1209
+ }
1210
+ }
1211
+ return result;
1212
+ }
1122
1213
 
1123
1214
  /**
1124
1215
  * Constants used throughout the pagination system
@@ -1882,9 +1973,12 @@ class FolderScopedService extends BaseService {
1882
1973
  * @param name - Resource name to search for
1883
1974
  * @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) + OData query options (`expand`, `select`)
1884
1975
  * @param transform - Maps a raw OData item to the typed response (e.g. PascalCase → camelCase via field map)
1976
+ * @param responseFieldMap - Optional response field map (API → SDK), reversed internally by
1977
+ * `transformOptions` to rewrite SDK field names back to API names in user-supplied
1978
+ * `expand` / `select` (symmetric counterpart to `transform`)
1885
1979
  * @throws ValidationError when inputs are malformed; NotFoundError when no match
1886
1980
  */
1887
- async getByNameLookup(resourceType, endpoint, name, options, transform) {
1981
+ async getByNameLookup(resourceType, endpoint, name, options, transform, responseFieldMap) {
1888
1982
  const validatedName = validateName(resourceType, name);
1889
1983
  const { folderId, folderKey, folderPath, ...queryOptions } = options;
1890
1984
  const headers = resolveFolderHeaders({
@@ -1894,8 +1988,11 @@ class FolderScopedService extends BaseService {
1894
1988
  resourceType: `${resourceType}.getByName`,
1895
1989
  fallbackFolderKey: this.config.folderKey,
1896
1990
  });
1991
+ const apiFieldOptions = responseFieldMap
1992
+ ? transformOptions(queryOptions, responseFieldMap)
1993
+ : queryOptions;
1897
1994
  const apiOptions = {
1898
- ...addPrefixToKeys(queryOptions, ODATA_PREFIX, Object.keys(queryOptions)),
1995
+ ...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
1899
1996
  '$filter': `Name eq '${validatedName.replace(SINGLE_QUOTE_RE, "''")}'`,
1900
1997
  '$top': '1',
1901
1998
  };
@@ -2041,6 +2138,10 @@ class AssetService extends FolderScopedService {
2041
2138
  async getAll(options) {
2042
2139
  // Transformation function for assets
2043
2140
  const transformAssetResponse = (asset) => transformData(pascalToCamelCaseKeys(asset), AssetMap);
2141
+ // Rewrite renamed SDK field names → API names inside OData strings
2142
+ // before delegating, mirroring the transformRequest pattern used for
2143
+ // request bodies.
2144
+ const apiOptions = options ? transformOptions(options, AssetMap) : options;
2044
2145
  return PaginationHelpers.getAll({
2045
2146
  serviceAccess: this.createPaginationServiceAccess(),
2046
2147
  getEndpoint: (folderId) => folderId ? ASSET_ENDPOINTS.GET_BY_FOLDER : ASSET_ENDPOINTS.GET_ALL,
@@ -2056,7 +2157,7 @@ class AssetService extends FolderScopedService {
2056
2157
  countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM
2057
2158
  }
2058
2159
  }
2059
- }, options);
2160
+ }, apiOptions);
2060
2161
  }
2061
2162
  /**
2062
2163
  * Gets a single asset by ID
@@ -2078,8 +2179,8 @@ class AssetService extends FolderScopedService {
2078
2179
  */
2079
2180
  async getById(id, folderId, options = {}) {
2080
2181
  const headers = createHeaders({ [FOLDER_ID]: folderId });
2081
- const keysToPrefix = Object.keys(options);
2082
- const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
2182
+ const apiFieldOptions = transformOptions(options, AssetMap);
2183
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
2083
2184
  const response = await this.get(ASSET_ENDPOINTS.GET_BY_ID(id), {
2084
2185
  headers,
2085
2186
  params: apiOptions
@@ -2114,7 +2215,7 @@ class AssetService extends FolderScopedService {
2114
2215
  * ```
2115
2216
  */
2116
2217
  async getByName(name, options = {}) {
2117
- return this.getByNameLookup('Asset', ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap));
2218
+ return this.getByNameLookup('Asset', ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap);
2118
2219
  }
2119
2220
  /**
2120
2221
  * Updates the value of an existing asset by ID.
@@ -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
  /**
@@ -1117,6 +1117,97 @@ function addPrefixToKeys(obj, prefix, keys) {
1117
1117
  }
1118
1118
  return result;
1119
1119
  }
1120
+ /**
1121
+ * Creates a new map with the keys and values reversed
1122
+ * @param map The original map to reverse
1123
+ * @returns A new map with keys and values swapped
1124
+ *
1125
+ * @example
1126
+ * ```typescript
1127
+ * const original = { key1: 'value1', key2: 'value2' };
1128
+ * const reversed = reverseMap(original);
1129
+ * // reversed = { value1: 'key1', value2: 'key2' }
1130
+ * ```
1131
+ */
1132
+ function reverseMap(map) {
1133
+ return Object.entries(map).reduce((acc, [key, value]) => {
1134
+ acc[value] = key;
1135
+ return acc;
1136
+ }, {});
1137
+ }
1138
+ /**
1139
+ * OData query-string keys whose values may contain field identifiers that
1140
+ * need rewriting from SDK names → API names.
1141
+ */
1142
+ const ODATA_FIELD_PARAM_KEYS = ['filter', 'orderby', 'select', 'expand'];
1143
+ /**
1144
+ * Matches one token at a time in an OData expression:
1145
+ * 1. A single-quoted string literal, allowing the `''` escape sequence —
1146
+ * consumed atomically so identifiers inside the literal can't match.
1147
+ * 2. An OData identifier (`[A-Za-z_][A-Za-z0-9_]*`).
1148
+ * Anything else (whitespace, operators, parens, commas) is left alone by
1149
+ * `String.prototype.replace`, which only substitutes matched substrings.
1150
+ */
1151
+ const ODATA_TOKEN_RE = /'(?:[^']|'')*'|[A-Za-z_][A-Za-z0-9_]*/g;
1152
+ /**
1153
+ * Rewrites SDK field identifiers to API field identifiers inside an OData
1154
+ * expression string (`$filter`, `$orderby`, `$select`, `$expand`).
1155
+ *
1156
+ * Field maps (e.g. `JobMap`) rename API fields → SDK fields on responses, so
1157
+ * SDK consumers see the renamed names. Without this rewrite, the same name
1158
+ * in a `filter` string would be forwarded verbatim and the API (which still
1159
+ * uses the original name) would reject it.
1160
+ *
1161
+ * Quoted string literals (with the OData `''` escape) are preserved exactly:
1162
+ * the token regex consumes them whole, so identifiers inside literals never
1163
+ * match. Identifier tokens are looked up in the reversed field map.
1164
+ *
1165
+ * @example
1166
+ * ```typescript
1167
+ * const requestMap = { processName: 'releaseName' };
1168
+ * rewriteODataIdentifiers("processName eq 'processName'", requestMap);
1169
+ * // "releaseName eq 'processName'" — identifier rewritten, literal preserved
1170
+ * ```
1171
+ */
1172
+ function rewriteODataIdentifiers(expression, requestMap) {
1173
+ if (!expression)
1174
+ return expression;
1175
+ return expression.replace(ODATA_TOKEN_RE, (match) => match.startsWith("'") ? match : (requestMap[match] ?? match));
1176
+ }
1177
+ /**
1178
+ * Symmetric counterpart of {@link transformRequest} for OData query options:
1179
+ * rewrites SDK field identifiers inside the recognized OData string params
1180
+ * (`filter`, `orderby`, `select`, `expand`) to their API names using the
1181
+ * reversed form of a response field map. Returns a shallow copy with the
1182
+ * relevant values rewritten; other keys pass through unchanged.
1183
+ *
1184
+ * Use at the OData edge so SDK consumers can refer to renamed fields by
1185
+ * their SDK name throughout — for reading the response and for filtering /
1186
+ * sorting / projecting / expanding.
1187
+ *
1188
+ * @param options The OData query options as authored with SDK field names
1189
+ * @param responseMap The response field map (API → SDK); reversed internally
1190
+ *
1191
+ * @example
1192
+ * ```typescript
1193
+ * // JobMap renames releaseName → processName on responses.
1194
+ * transformOptions({ filter: "processName eq 'X'" }, JobMap);
1195
+ * // { filter: "releaseName eq 'X'" }
1196
+ * ```
1197
+ */
1198
+ function transformOptions(options, responseMap) {
1199
+ const requestMap = reverseMap(responseMap);
1200
+ if (Object.keys(requestMap).length === 0)
1201
+ return options;
1202
+ const result = { ...options };
1203
+ for (const key of ODATA_FIELD_PARAM_KEYS) {
1204
+ const value = result[key];
1205
+ if (typeof value === 'string') {
1206
+ result[key] = rewriteODataIdentifiers(value, requestMap);
1207
+ }
1208
+ }
1209
+ return result;
1210
+ }
1120
1211
 
1121
1212
  /**
1122
1213
  * Constants used throughout the pagination system
@@ -1880,9 +1971,12 @@ class FolderScopedService extends BaseService {
1880
1971
  * @param name - Resource name to search for
1881
1972
  * @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) + OData query options (`expand`, `select`)
1882
1973
  * @param transform - Maps a raw OData item to the typed response (e.g. PascalCase → camelCase via field map)
1974
+ * @param responseFieldMap - Optional response field map (API → SDK), reversed internally by
1975
+ * `transformOptions` to rewrite SDK field names back to API names in user-supplied
1976
+ * `expand` / `select` (symmetric counterpart to `transform`)
1883
1977
  * @throws ValidationError when inputs are malformed; NotFoundError when no match
1884
1978
  */
1885
- async getByNameLookup(resourceType, endpoint, name, options, transform) {
1979
+ async getByNameLookup(resourceType, endpoint, name, options, transform, responseFieldMap) {
1886
1980
  const validatedName = validateName(resourceType, name);
1887
1981
  const { folderId, folderKey, folderPath, ...queryOptions } = options;
1888
1982
  const headers = resolveFolderHeaders({
@@ -1892,8 +1986,11 @@ class FolderScopedService extends BaseService {
1892
1986
  resourceType: `${resourceType}.getByName`,
1893
1987
  fallbackFolderKey: this.config.folderKey,
1894
1988
  });
1989
+ const apiFieldOptions = responseFieldMap
1990
+ ? transformOptions(queryOptions, responseFieldMap)
1991
+ : queryOptions;
1895
1992
  const apiOptions = {
1896
- ...addPrefixToKeys(queryOptions, ODATA_PREFIX, Object.keys(queryOptions)),
1993
+ ...addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions)),
1897
1994
  '$filter': `Name eq '${validatedName.replace(SINGLE_QUOTE_RE, "''")}'`,
1898
1995
  '$top': '1',
1899
1996
  };
@@ -2039,6 +2136,10 @@ class AssetService extends FolderScopedService {
2039
2136
  async getAll(options) {
2040
2137
  // Transformation function for assets
2041
2138
  const transformAssetResponse = (asset) => transformData(pascalToCamelCaseKeys(asset), AssetMap);
2139
+ // Rewrite renamed SDK field names → API names inside OData strings
2140
+ // before delegating, mirroring the transformRequest pattern used for
2141
+ // request bodies.
2142
+ const apiOptions = options ? transformOptions(options, AssetMap) : options;
2042
2143
  return PaginationHelpers.getAll({
2043
2144
  serviceAccess: this.createPaginationServiceAccess(),
2044
2145
  getEndpoint: (folderId) => folderId ? ASSET_ENDPOINTS.GET_BY_FOLDER : ASSET_ENDPOINTS.GET_ALL,
@@ -2054,7 +2155,7 @@ class AssetService extends FolderScopedService {
2054
2155
  countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM
2055
2156
  }
2056
2157
  }
2057
- }, options);
2158
+ }, apiOptions);
2058
2159
  }
2059
2160
  /**
2060
2161
  * Gets a single asset by ID
@@ -2076,8 +2177,8 @@ class AssetService extends FolderScopedService {
2076
2177
  */
2077
2178
  async getById(id, folderId, options = {}) {
2078
2179
  const headers = createHeaders({ [FOLDER_ID]: folderId });
2079
- const keysToPrefix = Object.keys(options);
2080
- const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
2180
+ const apiFieldOptions = transformOptions(options, AssetMap);
2181
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
2081
2182
  const response = await this.get(ASSET_ENDPOINTS.GET_BY_ID(id), {
2082
2183
  headers,
2083
2184
  params: apiOptions
@@ -2112,7 +2213,7 @@ class AssetService extends FolderScopedService {
2112
2213
  * ```
2113
2214
  */
2114
2215
  async getByName(name, options = {}) {
2115
- return this.getByNameLookup('Asset', ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap));
2216
+ return this.getByNameLookup('Asset', ASSET_ENDPOINTS.GET_BY_FOLDER, name, options, (raw) => transformData(pascalToCamelCaseKeys(raw), AssetMap), AssetMap);
2116
2217
  }
2117
2218
  /**
2118
2219
  * Updates the value of an existing asset by ID.
@@ -440,6 +440,97 @@ function addPrefixToKeys(obj, prefix, keys) {
440
440
  }
441
441
  return result;
442
442
  }
443
+ /**
444
+ * Creates a new map with the keys and values reversed
445
+ * @param map The original map to reverse
446
+ * @returns A new map with keys and values swapped
447
+ *
448
+ * @example
449
+ * ```typescript
450
+ * const original = { key1: 'value1', key2: 'value2' };
451
+ * const reversed = reverseMap(original);
452
+ * // reversed = { value1: 'key1', value2: 'key2' }
453
+ * ```
454
+ */
455
+ function reverseMap(map) {
456
+ return Object.entries(map).reduce((acc, [key, value]) => {
457
+ acc[value] = key;
458
+ return acc;
459
+ }, {});
460
+ }
461
+ /**
462
+ * OData query-string keys whose values may contain field identifiers that
463
+ * need rewriting from SDK names → API names.
464
+ */
465
+ const ODATA_FIELD_PARAM_KEYS = ['filter', 'orderby', 'select', 'expand'];
466
+ /**
467
+ * Matches one token at a time in an OData expression:
468
+ * 1. A single-quoted string literal, allowing the `''` escape sequence —
469
+ * consumed atomically so identifiers inside the literal can't match.
470
+ * 2. An OData identifier (`[A-Za-z_][A-Za-z0-9_]*`).
471
+ * Anything else (whitespace, operators, parens, commas) is left alone by
472
+ * `String.prototype.replace`, which only substitutes matched substrings.
473
+ */
474
+ const ODATA_TOKEN_RE = /'(?:[^']|'')*'|[A-Za-z_][A-Za-z0-9_]*/g;
475
+ /**
476
+ * Rewrites SDK field identifiers to API field identifiers inside an OData
477
+ * expression string (`$filter`, `$orderby`, `$select`, `$expand`).
478
+ *
479
+ * Field maps (e.g. `JobMap`) rename API fields → SDK fields on responses, so
480
+ * SDK consumers see the renamed names. Without this rewrite, the same name
481
+ * in a `filter` string would be forwarded verbatim and the API (which still
482
+ * uses the original name) would reject it.
483
+ *
484
+ * Quoted string literals (with the OData `''` escape) are preserved exactly:
485
+ * the token regex consumes them whole, so identifiers inside literals never
486
+ * match. Identifier tokens are looked up in the reversed field map.
487
+ *
488
+ * @example
489
+ * ```typescript
490
+ * const requestMap = { processName: 'releaseName' };
491
+ * rewriteODataIdentifiers("processName eq 'processName'", requestMap);
492
+ * // "releaseName eq 'processName'" — identifier rewritten, literal preserved
493
+ * ```
494
+ */
495
+ function rewriteODataIdentifiers(expression, requestMap) {
496
+ if (!expression)
497
+ return expression;
498
+ return expression.replace(ODATA_TOKEN_RE, (match) => match.startsWith("'") ? match : (requestMap[match] ?? match));
499
+ }
500
+ /**
501
+ * Symmetric counterpart of {@link transformRequest} for OData query options:
502
+ * rewrites SDK field identifiers inside the recognized OData string params
503
+ * (`filter`, `orderby`, `select`, `expand`) to their API names using the
504
+ * reversed form of a response field map. Returns a shallow copy with the
505
+ * relevant values rewritten; other keys pass through unchanged.
506
+ *
507
+ * Use at the OData edge so SDK consumers can refer to renamed fields by
508
+ * their SDK name throughout — for reading the response and for filtering /
509
+ * sorting / projecting / expanding.
510
+ *
511
+ * @param options The OData query options as authored with SDK field names
512
+ * @param responseMap The response field map (API → SDK); reversed internally
513
+ *
514
+ * @example
515
+ * ```typescript
516
+ * // JobMap renames releaseName → processName on responses.
517
+ * transformOptions({ filter: "processName eq 'X'" }, JobMap);
518
+ * // { filter: "releaseName eq 'X'" }
519
+ * ```
520
+ */
521
+ function transformOptions(options, responseMap) {
522
+ const requestMap = reverseMap(responseMap);
523
+ if (Object.keys(requestMap).length === 0)
524
+ return options;
525
+ const result = { ...options };
526
+ for (const key of ODATA_FIELD_PARAM_KEYS) {
527
+ const value = result[key];
528
+ if (typeof value === 'string') {
529
+ result[key] = rewriteODataIdentifiers(value, requestMap);
530
+ }
531
+ }
532
+ return result;
533
+ }
443
534
 
444
535
  /**
445
536
  * Base path constants for different services
@@ -1793,9 +1884,10 @@ class AttachmentService extends BaseService {
1793
1884
  if (!id) {
1794
1885
  throw new ValidationError({ message: 'id is required for getById' });
1795
1886
  }
1796
- // Prefix all keys in options with $ for OData
1797
- const keysToPrefix = Object.keys(options);
1798
- const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
1887
+ // Response applies both maps (BucketMap on blobFileAccess, AttachmentsMap on top-level);
1888
+ // merge so SDK names from either are rewritten in one pass.
1889
+ const apiFieldOptions = transformOptions(options, { ...AttachmentsMap, ...BucketMap });
1890
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
1799
1891
  const response = await this.get(ORCHESTRATOR_ATTACHMENT_ENDPOINTS.GET_BY_ID(id), {
1800
1892
  params: apiOptions,
1801
1893
  });
@@ -438,6 +438,97 @@ function addPrefixToKeys(obj, prefix, keys) {
438
438
  }
439
439
  return result;
440
440
  }
441
+ /**
442
+ * Creates a new map with the keys and values reversed
443
+ * @param map The original map to reverse
444
+ * @returns A new map with keys and values swapped
445
+ *
446
+ * @example
447
+ * ```typescript
448
+ * const original = { key1: 'value1', key2: 'value2' };
449
+ * const reversed = reverseMap(original);
450
+ * // reversed = { value1: 'key1', value2: 'key2' }
451
+ * ```
452
+ */
453
+ function reverseMap(map) {
454
+ return Object.entries(map).reduce((acc, [key, value]) => {
455
+ acc[value] = key;
456
+ return acc;
457
+ }, {});
458
+ }
459
+ /**
460
+ * OData query-string keys whose values may contain field identifiers that
461
+ * need rewriting from SDK names → API names.
462
+ */
463
+ const ODATA_FIELD_PARAM_KEYS = ['filter', 'orderby', 'select', 'expand'];
464
+ /**
465
+ * Matches one token at a time in an OData expression:
466
+ * 1. A single-quoted string literal, allowing the `''` escape sequence —
467
+ * consumed atomically so identifiers inside the literal can't match.
468
+ * 2. An OData identifier (`[A-Za-z_][A-Za-z0-9_]*`).
469
+ * Anything else (whitespace, operators, parens, commas) is left alone by
470
+ * `String.prototype.replace`, which only substitutes matched substrings.
471
+ */
472
+ const ODATA_TOKEN_RE = /'(?:[^']|'')*'|[A-Za-z_][A-Za-z0-9_]*/g;
473
+ /**
474
+ * Rewrites SDK field identifiers to API field identifiers inside an OData
475
+ * expression string (`$filter`, `$orderby`, `$select`, `$expand`).
476
+ *
477
+ * Field maps (e.g. `JobMap`) rename API fields → SDK fields on responses, so
478
+ * SDK consumers see the renamed names. Without this rewrite, the same name
479
+ * in a `filter` string would be forwarded verbatim and the API (which still
480
+ * uses the original name) would reject it.
481
+ *
482
+ * Quoted string literals (with the OData `''` escape) are preserved exactly:
483
+ * the token regex consumes them whole, so identifiers inside literals never
484
+ * match. Identifier tokens are looked up in the reversed field map.
485
+ *
486
+ * @example
487
+ * ```typescript
488
+ * const requestMap = { processName: 'releaseName' };
489
+ * rewriteODataIdentifiers("processName eq 'processName'", requestMap);
490
+ * // "releaseName eq 'processName'" — identifier rewritten, literal preserved
491
+ * ```
492
+ */
493
+ function rewriteODataIdentifiers(expression, requestMap) {
494
+ if (!expression)
495
+ return expression;
496
+ return expression.replace(ODATA_TOKEN_RE, (match) => match.startsWith("'") ? match : (requestMap[match] ?? match));
497
+ }
498
+ /**
499
+ * Symmetric counterpart of {@link transformRequest} for OData query options:
500
+ * rewrites SDK field identifiers inside the recognized OData string params
501
+ * (`filter`, `orderby`, `select`, `expand`) to their API names using the
502
+ * reversed form of a response field map. Returns a shallow copy with the
503
+ * relevant values rewritten; other keys pass through unchanged.
504
+ *
505
+ * Use at the OData edge so SDK consumers can refer to renamed fields by
506
+ * their SDK name throughout — for reading the response and for filtering /
507
+ * sorting / projecting / expanding.
508
+ *
509
+ * @param options The OData query options as authored with SDK field names
510
+ * @param responseMap The response field map (API → SDK); reversed internally
511
+ *
512
+ * @example
513
+ * ```typescript
514
+ * // JobMap renames releaseName → processName on responses.
515
+ * transformOptions({ filter: "processName eq 'X'" }, JobMap);
516
+ * // { filter: "releaseName eq 'X'" }
517
+ * ```
518
+ */
519
+ function transformOptions(options, responseMap) {
520
+ const requestMap = reverseMap(responseMap);
521
+ if (Object.keys(requestMap).length === 0)
522
+ return options;
523
+ const result = { ...options };
524
+ for (const key of ODATA_FIELD_PARAM_KEYS) {
525
+ const value = result[key];
526
+ if (typeof value === 'string') {
527
+ result[key] = rewriteODataIdentifiers(value, requestMap);
528
+ }
529
+ }
530
+ return result;
531
+ }
441
532
 
442
533
  /**
443
534
  * Base path constants for different services
@@ -1791,9 +1882,10 @@ class AttachmentService extends BaseService {
1791
1882
  if (!id) {
1792
1883
  throw new ValidationError({ message: 'id is required for getById' });
1793
1884
  }
1794
- // Prefix all keys in options with $ for OData
1795
- const keysToPrefix = Object.keys(options);
1796
- const apiOptions = addPrefixToKeys(options, ODATA_PREFIX, keysToPrefix);
1885
+ // Response applies both maps (BucketMap on blobFileAccess, AttachmentsMap on top-level);
1886
+ // merge so SDK names from either are rewritten in one pass.
1887
+ const apiFieldOptions = transformOptions(options, { ...AttachmentsMap, ...BucketMap });
1888
+ const apiOptions = addPrefixToKeys(apiFieldOptions, ODATA_PREFIX, Object.keys(apiFieldOptions));
1797
1889
  const response = await this.get(ORCHESTRATOR_ATTACHMENT_ENDPOINTS.GET_BY_ID(id), {
1798
1890
  params: apiOptions,
1799
1891
  });