@uipath/uipath-typescript 1.3.9 → 1.3.10

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.
@@ -2305,6 +2305,8 @@ declare class EntityService extends BaseService implements EntityServiceModel {
2305
2305
  * Only exposes essential fields to SDK users
2306
2306
  */
2307
2307
  interface ChoiceSetGetAllResponse {
2308
+ /** UUID of the choice set */
2309
+ id: string;
2308
2310
  /** Name identifier of the choice set */
2309
2311
  name: string;
2310
2312
  /** Human-readable display name of the choice set*/
@@ -2349,6 +2351,46 @@ interface ChoiceSetGetResponse {
2349
2351
  * Options for getting choice set values by choice set ID
2350
2352
  */
2351
2353
  type ChoiceSetGetByIdOptions = PaginationOptions;
2354
+ /**
2355
+ * Options for creating a new choice set
2356
+ */
2357
+ interface ChoiceSetCreateOptions {
2358
+ /** Human-readable display name */
2359
+ displayName?: string;
2360
+ /** Optional choice set description */
2361
+ description?: string;
2362
+ /** UUID of the folder to place the choice set in (defaults to the tenant-level folder) */
2363
+ folderKey?: string;
2364
+ }
2365
+ /**
2366
+ * Options for updating an existing choice set's metadata
2367
+ */
2368
+ interface ChoiceSetUpdateOptions {
2369
+ /** New display name for the choice set */
2370
+ displayName?: string;
2371
+ /** New description for the choice set */
2372
+ description?: string;
2373
+ }
2374
+ /**
2375
+ * Optional fields when inserting a single value into a choice set.
2376
+ *
2377
+ * The required `name` identifier is passed as a positional argument to
2378
+ * `insertValueById`.
2379
+ */
2380
+ interface ChoiceSetValueInsertOptions {
2381
+ /** Human-readable display name */
2382
+ displayName?: string;
2383
+ }
2384
+ /**
2385
+ * Response returned after inserting a choice-set value — the full value object.
2386
+ */
2387
+ interface ChoiceSetValueInsertResponse extends ChoiceSetGetResponse {
2388
+ }
2389
+ /**
2390
+ * Response returned after updating a choice-set value — the full value object.
2391
+ */
2392
+ interface ChoiceSetValueUpdateResponse extends ChoiceSetGetResponse {
2393
+ }
2352
2394
 
2353
2395
  /**
2354
2396
  * Service for managing UiPath Data Fabric Choice Sets
@@ -2431,6 +2473,134 @@ interface ChoiceSetServiceModel {
2431
2473
  * ```
2432
2474
  */
2433
2475
  getById<T extends ChoiceSetGetByIdOptions = ChoiceSetGetByIdOptions>(choiceSetId: string, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<ChoiceSetGetResponse> : NonPaginatedResponse<ChoiceSetGetResponse>>;
2476
+ /**
2477
+ * Creates a new Data Fabric choice set
2478
+ *
2479
+ * @param name - Choice set name. Must start with a
2480
+ * letter, may contain only letters, numbers, and underscores, length
2481
+ * 3–100 characters (e.g., `"expenseTypes"`).
2482
+ * @param options - Optional choice-set-level settings ({@link ChoiceSetCreateOptions})
2483
+ * @returns Promise resolving to the UUID of the created choice set
2484
+ *
2485
+ * @example
2486
+ * ```typescript
2487
+ * // Minimal create
2488
+ * const expenseTypesId = await choicesets.create("expense_types");
2489
+ *
2490
+ * // With display name and description
2491
+ * const priorityLevelsId = await choicesets.create("priority_levels", {
2492
+ * displayName: "Priority Levels",
2493
+ * description: "Ticket priority categories",
2494
+ * });
2495
+ * ```
2496
+ * @internal
2497
+ */
2498
+ create(name: string, options?: ChoiceSetCreateOptions): Promise<string>;
2499
+ /**
2500
+ * Updates an existing choice set's metadata (display name and/or description).
2501
+ *
2502
+ * **At least one of `displayName` or `description` must be provided** —
2503
+ * the call throws `ValidationError` if both are omitted.
2504
+ *
2505
+ * @param choiceSetId - UUID of the choice set to update
2506
+ * @param options - Metadata fields to change ({@link ChoiceSetUpdateOptions})
2507
+ * @returns Promise resolving when the update is complete
2508
+ *
2509
+ * @example
2510
+ * ```typescript
2511
+ * // First, get the choice set ID using getAll()
2512
+ * const allChoiceSets = await choicesets.getAll();
2513
+ * const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
2514
+ *
2515
+ * await choicesets.updateById(expenseTypes.id, {
2516
+ * displayName: "Expense Categories",
2517
+ * description: "Updated description",
2518
+ * });
2519
+ * ```
2520
+ * @internal
2521
+ */
2522
+ updateById(choiceSetId: string, options: ChoiceSetUpdateOptions): Promise<void>;
2523
+ /**
2524
+ * Deletes a Data Fabric choice set and all its values.
2525
+ *
2526
+ * @param choiceSetId - UUID of the choice set to delete
2527
+ * @returns Promise resolving when the choice set is deleted
2528
+ *
2529
+ * @example
2530
+ * ```typescript
2531
+ * // First, get the choice set ID using getAll()
2532
+ * const allChoiceSets = await choicesets.getAll();
2533
+ * const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
2534
+ *
2535
+ * await choicesets.deleteById(expenseTypes.id);
2536
+ * ```
2537
+ * @internal
2538
+ */
2539
+ deleteById(choiceSetId: string): Promise<void>;
2540
+ /**
2541
+ * Inserts a single value into a choice set.
2542
+ *
2543
+ * @param choiceSetId - UUID of the parent choice set
2544
+ * @param name - Identifier name of the new value (e.g., `"TRAVEL"`)
2545
+ * @param options - Optional fields ({@link ChoiceSetValueInsertOptions})
2546
+ * @returns Promise resolving to the inserted value ({@link ChoiceSetValueInsertResponse})
2547
+ *
2548
+ * @example
2549
+ * ```typescript
2550
+ * // First, get the choice set ID using getAll()
2551
+ * const allChoiceSets = await choicesets.getAll();
2552
+ * const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
2553
+ *
2554
+ * const inserted = await choicesets.insertValueById(expenseTypes.id, 'TRAVEL', {
2555
+ * displayName: 'Travel',
2556
+ * });
2557
+ * console.log(inserted.id);
2558
+ * ```
2559
+ * @internal
2560
+ */
2561
+ insertValueById(choiceSetId: string, name: string, options?: ChoiceSetValueInsertOptions): Promise<ChoiceSetValueInsertResponse>;
2562
+ /**
2563
+ * Updates an existing choice-set value's display name.
2564
+ *
2565
+ * Only `displayName` is mutable; the value's `name` (identifier) is fixed at
2566
+ * insert time and cannot be changed.
2567
+ *
2568
+ * @param choiceSetId - UUID of the parent choice set
2569
+ * @param valueId - UUID of the value to update
2570
+ * @param displayName - New human-readable display name for the value
2571
+ * @returns Promise resolving to the updated value ({@link ChoiceSetValueUpdateResponse})
2572
+ *
2573
+ * @example
2574
+ * ```typescript
2575
+ * // Get the choice set ID from getAll() and the value ID from getById()
2576
+ * const allChoiceSets = await choicesets.getAll();
2577
+ * const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
2578
+ * const values = await choicesets.getById(expenseTypes.id);
2579
+ * const travel = values.items.find(v => v.name === 'TRAVEL');
2580
+ *
2581
+ * await choicesets.updateValueById(expenseTypes.id, travel.id, 'Business Travel');
2582
+ * ```
2583
+ * @internal
2584
+ */
2585
+ updateValueById(choiceSetId: string, valueId: string, displayName: string): Promise<ChoiceSetValueUpdateResponse>;
2586
+ /**
2587
+ * Deletes one or more values from a choice set.
2588
+ *
2589
+ * @param choiceSetId - UUID of the parent choice set
2590
+ * @param valueIds - Array of value UUIDs to delete
2591
+ * @returns Promise resolving when the values are deleted
2592
+ *
2593
+ * @example
2594
+ * ```typescript
2595
+ * // Get the value IDs from getById()
2596
+ * const values = await choicesets.getById('<choiceSetId>');
2597
+ * const idsToDelete = values.items.slice(0, 2).map(v => v.id);
2598
+ *
2599
+ * await choicesets.deleteValuesById('<choiceSetId>', idsToDelete);
2600
+ * ```
2601
+ * @internal
2602
+ */
2603
+ deleteValuesById(choiceSetId: string, valueIds: string[]): Promise<void>;
2434
2604
  }
2435
2605
 
2436
2606
  declare class ChoiceSetService extends BaseService implements ChoiceSetServiceModel {
@@ -2469,7 +2639,7 @@ declare class ChoiceSetService extends BaseService implements ChoiceSetServiceMo
2469
2639
  *
2470
2640
  * @example
2471
2641
  * ```typescript
2472
- * import { ChoiceSets } from '@uipath/uipath-typescript/choicesets';
2642
+ * import { ChoiceSets } from '@uipath/uipath-typescript/entities';
2473
2643
  *
2474
2644
  * const choiceSets = new ChoiceSets(sdk);
2475
2645
  *
@@ -2496,7 +2666,140 @@ declare class ChoiceSetService extends BaseService implements ChoiceSetServiceMo
2496
2666
  * ```
2497
2667
  */
2498
2668
  getById<T extends ChoiceSetGetByIdOptions = ChoiceSetGetByIdOptions>(choiceSetId: string, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<ChoiceSetGetResponse> : NonPaginatedResponse<ChoiceSetGetResponse>>;
2669
+ /**
2670
+ * Creates a new Data Fabric choice set
2671
+ *
2672
+ * @param name - Choice set name. Must start with a
2673
+ * letter, may contain only letters, numbers, and underscores, length
2674
+ * 3–100 characters (e.g., `"expenseTypes"`).
2675
+ * @param options - Optional choice-set-level settings ({@link ChoiceSetCreateOptions})
2676
+ * @returns Promise resolving to the UUID of the created choice set
2677
+ *
2678
+ * @example
2679
+ * ```typescript
2680
+ * import { ChoiceSets } from '@uipath/uipath-typescript/entities';
2681
+ *
2682
+ * const choicesets = new ChoiceSets(sdk);
2683
+ *
2684
+ * // Minimal create
2685
+ * const expenseTypesId = await choicesets.create("expense_types");
2686
+ *
2687
+ * // With display name and description
2688
+ * const priorityLevelsId = await choicesets.create("priority_levels", {
2689
+ * displayName: "Priority Levels",
2690
+ * description: "Ticket priority categories",
2691
+ * });
2692
+ * ```
2693
+ * @internal
2694
+ */
2695
+ create(name: string, options?: ChoiceSetCreateOptions): Promise<string>;
2696
+ /**
2697
+ * Updates an existing choice set's metadata (display name and/or description).
2698
+ *
2699
+ * **At least one of `displayName` or `description` must be provided** —
2700
+ * the call throws `ValidationError` if both are omitted.
2701
+ *
2702
+ * @param choiceSetId - UUID of the choice set to update
2703
+ * @param options - Metadata fields to change ({@link ChoiceSetUpdateOptions})
2704
+ * @returns Promise resolving when the update is complete
2705
+ *
2706
+ * @example
2707
+ * ```typescript
2708
+ * // First, get the choice set ID using getAll()
2709
+ * const allChoiceSets = await choicesets.getAll();
2710
+ * const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
2711
+ *
2712
+ * await choicesets.updateById(expenseTypes.id, {
2713
+ * displayName: "Expense Categories",
2714
+ * description: "Updated description",
2715
+ * });
2716
+ * ```
2717
+ * @internal
2718
+ */
2719
+ updateById(choiceSetId: string, options: ChoiceSetUpdateOptions): Promise<void>;
2720
+ /**
2721
+ * Deletes a Data Fabric choice set and all its values.
2722
+ *
2723
+ * @param choiceSetId - UUID of the choice set to delete
2724
+ * @returns Promise resolving when the choice set is deleted
2725
+ *
2726
+ * @example
2727
+ * ```typescript
2728
+ * // First, get the choice set ID using getAll()
2729
+ * const allChoiceSets = await choicesets.getAll();
2730
+ * const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
2731
+ *
2732
+ * await choicesets.deleteById(expenseTypes.id);
2733
+ * ```
2734
+ * @internal
2735
+ */
2736
+ deleteById(choiceSetId: string): Promise<void>;
2737
+ /**
2738
+ * Inserts a single value into a choice set.
2739
+ *
2740
+ * @param choiceSetId - UUID of the parent choice set
2741
+ * @param name - Identifier name of the new value (e.g., `"TRAVEL"`)
2742
+ * @param options - Optional fields ({@link ChoiceSetValueInsertOptions})
2743
+ * @returns Promise resolving to the inserted value ({@link ChoiceSetValueInsertResponse})
2744
+ *
2745
+ * @example
2746
+ * ```typescript
2747
+ * // First, get the choice set ID using getAll()
2748
+ * const allChoiceSets = await choicesets.getAll();
2749
+ * const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
2750
+ *
2751
+ * const inserted = await choicesets.insertValueById(expenseTypes.id, 'TRAVEL', {
2752
+ * displayName: 'Travel',
2753
+ * });
2754
+ * console.log(inserted.id);
2755
+ * ```
2756
+ * @internal
2757
+ */
2758
+ insertValueById(choiceSetId: string, name: string, options?: ChoiceSetValueInsertOptions): Promise<ChoiceSetValueInsertResponse>;
2759
+ /**
2760
+ * Updates an existing choice-set value's display name.
2761
+ *
2762
+ * Only `displayName` is mutable; the value's `name` (identifier) is fixed at
2763
+ * insert time and cannot be changed.
2764
+ *
2765
+ * @param choiceSetId - UUID of the parent choice set
2766
+ * @param valueId - UUID of the value to update
2767
+ * @param displayName - New human-readable display name for the value
2768
+ * @returns Promise resolving to the updated value ({@link ChoiceSetValueUpdateResponse})
2769
+ *
2770
+ * @example
2771
+ * ```typescript
2772
+ * // Get the choice set ID from getAll() and the value ID from getById()
2773
+ * const allChoiceSets = await choicesets.getAll();
2774
+ * const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
2775
+ * const values = await choicesets.getById(expenseTypes.id);
2776
+ * const travel = values.items.find(v => v.name === 'TRAVEL');
2777
+ *
2778
+ * await choicesets.updateValueById(expenseTypes.id, travel.id, 'Business Travel');
2779
+ * ```
2780
+ * @internal
2781
+ */
2782
+ updateValueById(choiceSetId: string, valueId: string, displayName: string): Promise<ChoiceSetValueUpdateResponse>;
2783
+ /**
2784
+ * Deletes one or more values from a choice set.
2785
+ *
2786
+ * @param choiceSetId - UUID of the parent choice set
2787
+ * @param valueIds - Array of value UUIDs to delete
2788
+ * @returns Promise resolving when the values are deleted
2789
+ *
2790
+ * @example
2791
+ * ```typescript
2792
+ * // Get the value IDs from getById()
2793
+ * const values = await choicesets.getById('<choiceSetId>');
2794
+ * const idsToDelete = values.items.slice(0, 2).map(v => v.id);
2795
+ *
2796
+ * await choicesets.deleteValuesById('<choiceSetId>', idsToDelete);
2797
+ * ```
2798
+ * @internal
2799
+ */
2800
+ deleteValuesById(choiceSetId: string, valueIds: string[]): Promise<void>;
2801
+ private resolveChoiceSetName;
2499
2802
  }
2500
2803
 
2501
2804
  export { ChoiceSetService, ChoiceSetService as ChoiceSets, DataDirectionType, EntityService as Entities, EntityAggregateFunction, EntityFieldDataType, EntityService, EntityType, FieldDisplayType, JoinType, LogicalOperator, QueryFilterOperator, ReferenceType, createEntityWithMethods };
2502
- export type { ChoiceSetGetAllResponse, ChoiceSetGetByIdOptions, ChoiceSetGetResponse, ChoiceSetServiceModel, EntityAggregate, EntityBatchInsertOptions, EntityBatchInsertResponse, EntityCreateFieldOptions, EntityCreateOptions, EntityDeleteAttachmentResponse, EntityDeleteOptions, EntityDeleteRecordsOptions, EntityDeleteResponse, EntityFieldBase, EntityFieldUpdateOptions, EntityFileType, EntityGetAllRecordsOptions, EntityGetRecordByIdOptions, EntityGetRecordsByIdOptions, EntityGetResponse, EntityImportRecordsResponse, EntityInsertOptions, EntityInsertRecordOptions, EntityInsertRecordsOptions, EntityInsertResponse, EntityMethods, EntityOperationOptions, EntityOperationResponse, EntityQueryFilter, EntityQueryFilterGroup, EntityQueryRecordsOptions, EntityQueryRecordsResponse, EntityQuerySortOption, EntityRecord, EntityRemoveFieldOptions, EntityServiceModel, EntityUpdateByIdOptions, EntityUpdateOptions, EntityUpdateRecordOptions, EntityUpdateRecordResponse, EntityUpdateRecordsOptions, EntityUpdateResponse, EntityUploadAttachmentOptions, EntityUploadAttachmentResponse, ExternalConnection, ExternalField, ExternalFieldMapping, ExternalObject, ExternalSourceFields, FailureRecord, Field, FieldDataType, FieldMetaData, RawEntityGetResponse, SourceJoinCriteria, SqlType };
2805
+ export type { ChoiceSetCreateOptions, ChoiceSetGetAllResponse, ChoiceSetGetByIdOptions, ChoiceSetGetResponse, ChoiceSetServiceModel, ChoiceSetUpdateOptions, ChoiceSetValueInsertOptions, ChoiceSetValueInsertResponse, ChoiceSetValueUpdateResponse, EntityAggregate, EntityBatchInsertOptions, EntityBatchInsertResponse, EntityCreateFieldOptions, EntityCreateOptions, EntityDeleteAttachmentResponse, EntityDeleteOptions, EntityDeleteRecordsOptions, EntityDeleteResponse, EntityFieldBase, EntityFieldUpdateOptions, EntityFileType, EntityGetAllRecordsOptions, EntityGetRecordByIdOptions, EntityGetRecordsByIdOptions, EntityGetResponse, EntityImportRecordsResponse, EntityInsertOptions, EntityInsertRecordOptions, EntityInsertRecordsOptions, EntityInsertResponse, EntityMethods, EntityOperationOptions, EntityOperationResponse, EntityQueryFilter, EntityQueryFilterGroup, EntityQueryRecordsOptions, EntityQueryRecordsResponse, EntityQuerySortOption, EntityRecord, EntityRemoveFieldOptions, EntityServiceModel, EntityUpdateByIdOptions, EntityUpdateOptions, EntityUpdateRecordOptions, EntityUpdateRecordResponse, EntityUpdateRecordsOptions, EntityUpdateResponse, EntityUploadAttachmentOptions, EntityUploadAttachmentResponse, ExternalConnection, ExternalField, ExternalFieldMapping, ExternalObject, ExternalSourceFields, FailureRecord, Field, FieldDataType, FieldMetaData, RawEntityGetResponse, SourceJoinCriteria, SqlType };
@@ -609,14 +609,25 @@ class ApiClient {
609
609
  if (!text) {
610
610
  return undefined;
611
611
  }
612
- return JSON.parse(text);
612
+ try {
613
+ return JSON.parse(text);
614
+ }
615
+ catch (error) {
616
+ if (error instanceof SyntaxError) {
617
+ throw new ServerError({
618
+ message: `Server returned non-JSON response (${response.status} ${response.url}): ${error.message}`,
619
+ statusCode: response.status,
620
+ });
621
+ }
622
+ throw error;
623
+ }
613
624
  }
614
625
  catch (error) {
615
626
  // If it's already one of our errors, re-throw it
616
627
  if (error.type && error.type.includes('Error')) {
617
628
  throw error;
618
629
  }
619
- // Otherwise, it's likely a network error
630
+ // Otherwise, it's a genuine network/fetch failure
620
631
  throw ErrorFactory.createNetworkError(error);
621
632
  }
622
633
  }
@@ -1238,9 +1249,9 @@ class PaginationHelpers {
1238
1249
  * @returns Promise resolving to a paginated result
1239
1250
  */
1240
1251
  static async getAllPaginated(params) {
1241
- const { serviceAccess, getEndpoint, folderId, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1252
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1242
1253
  const endpoint = getEndpoint(folderId);
1243
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
1254
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1244
1255
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
1245
1256
  headers,
1246
1257
  params: additionalParams,
@@ -1268,13 +1279,13 @@ class PaginationHelpers {
1268
1279
  * @returns Promise resolving to an object with data and totalCount
1269
1280
  */
1270
1281
  static async getAllNonPaginated(params) {
1271
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1282
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1272
1283
  // Set default field names
1273
1284
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
1274
1285
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
1275
1286
  // Determine endpoint and headers based on folderId
1276
1287
  const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
1277
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
1288
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1278
1289
  // Make the API call based on method
1279
1290
  let response;
1280
1291
  if (method === HTTP_METHODS.POST) {
@@ -1333,6 +1344,7 @@ class PaginationHelpers {
1333
1344
  serviceAccess: config.serviceAccess,
1334
1345
  getEndpoint: config.getEndpoint,
1335
1346
  folderId,
1347
+ headers: config.headers,
1336
1348
  paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1337
1349
  additionalParams: prefixedOptions,
1338
1350
  transformFn: config.transformFn,
@@ -1350,6 +1362,7 @@ class PaginationHelpers {
1350
1362
  getAllEndpoint: config.getEndpoint(),
1351
1363
  getByFolderEndpoint: byFolderEndpoint,
1352
1364
  folderId,
1365
+ headers: config.headers,
1353
1366
  additionalParams: prefixedOptions,
1354
1367
  transformFn: config.transformFn,
1355
1368
  method: config.method,
@@ -1936,6 +1949,12 @@ const DATA_FABRIC_ENDPOINTS = {
1936
1949
  CHOICESETS: {
1937
1950
  GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
1938
1951
  GET_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/query_expansion`,
1952
+ CREATE: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
1953
+ UPDATE: (choiceSetId) => `${DATAFABRIC_BASE}/api/Entity/${choiceSetId}/metadata`,
1954
+ DELETE: (choiceSetId) => `${DATAFABRIC_BASE}/api/Entity/${choiceSetId}/delete`,
1955
+ INSERT_BY_NAME: (choiceSetName) => `${DATAFABRIC_BASE}/api/EntityService/${choiceSetName}/choiceset/insert`,
1956
+ UPDATE_BY_NAME: (choiceSetName, valueId) => `${DATAFABRIC_BASE}/api/EntityService/${choiceSetName}/choiceset/${valueId}/update`,
1957
+ DELETE_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/choiceset/delete`,
1939
1958
  },
1940
1959
  };
1941
1960
 
@@ -3265,7 +3284,7 @@ class ChoiceSetService extends BaseService {
3265
3284
  *
3266
3285
  * @example
3267
3286
  * ```typescript
3268
- * import { ChoiceSets } from '@uipath/uipath-typescript/choicesets';
3287
+ * import { ChoiceSets } from '@uipath/uipath-typescript/entities';
3269
3288
  *
3270
3289
  * const choiceSets = new ChoiceSets(sdk);
3271
3290
  *
@@ -3314,6 +3333,188 @@ class ChoiceSetService extends BaseService {
3314
3333
  }
3315
3334
  }, options);
3316
3335
  }
3336
+ /**
3337
+ * Creates a new Data Fabric choice set
3338
+ *
3339
+ * @param name - Choice set name. Must start with a
3340
+ * letter, may contain only letters, numbers, and underscores, length
3341
+ * 3–100 characters (e.g., `"expenseTypes"`).
3342
+ * @param options - Optional choice-set-level settings ({@link ChoiceSetCreateOptions})
3343
+ * @returns Promise resolving to the UUID of the created choice set
3344
+ *
3345
+ * @example
3346
+ * ```typescript
3347
+ * import { ChoiceSets } from '@uipath/uipath-typescript/entities';
3348
+ *
3349
+ * const choicesets = new ChoiceSets(sdk);
3350
+ *
3351
+ * // Minimal create
3352
+ * const expenseTypesId = await choicesets.create("expense_types");
3353
+ *
3354
+ * // With display name and description
3355
+ * const priorityLevelsId = await choicesets.create("priority_levels", {
3356
+ * displayName: "Priority Levels",
3357
+ * description: "Ticket priority categories",
3358
+ * });
3359
+ * ```
3360
+ * @internal
3361
+ */
3362
+ async create(name, options) {
3363
+ const opts = options ?? {};
3364
+ const payload = {
3365
+ ...(opts.description !== undefined && { description: opts.description }),
3366
+ ...(opts.displayName !== undefined && { displayName: opts.displayName }),
3367
+ entityDefinition: {
3368
+ name,
3369
+ fields: [],
3370
+ folderId: opts.folderKey ?? DATA_FABRIC_TENANT_FOLDER_ID,
3371
+ },
3372
+ };
3373
+ const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.CREATE, payload);
3374
+ return response.data;
3375
+ }
3376
+ /**
3377
+ * Updates an existing choice set's metadata (display name and/or description).
3378
+ *
3379
+ * **At least one of `displayName` or `description` must be provided** —
3380
+ * the call throws `ValidationError` if both are omitted.
3381
+ *
3382
+ * @param choiceSetId - UUID of the choice set to update
3383
+ * @param options - Metadata fields to change ({@link ChoiceSetUpdateOptions})
3384
+ * @returns Promise resolving when the update is complete
3385
+ *
3386
+ * @example
3387
+ * ```typescript
3388
+ * // First, get the choice set ID using getAll()
3389
+ * const allChoiceSets = await choicesets.getAll();
3390
+ * const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
3391
+ *
3392
+ * await choicesets.updateById(expenseTypes.id, {
3393
+ * displayName: "Expense Categories",
3394
+ * description: "Updated description",
3395
+ * });
3396
+ * ```
3397
+ * @internal
3398
+ */
3399
+ async updateById(choiceSetId, options) {
3400
+ if (options.displayName === undefined && options.description === undefined) {
3401
+ throw new ValidationError({
3402
+ message: 'updateById requires at least one of displayName or description.',
3403
+ });
3404
+ }
3405
+ await this.patch(DATA_FABRIC_ENDPOINTS.CHOICESETS.UPDATE(choiceSetId), {
3406
+ ...(options.displayName !== undefined && { displayName: options.displayName }),
3407
+ ...(options.description !== undefined && { description: options.description }),
3408
+ });
3409
+ }
3410
+ /**
3411
+ * Deletes a Data Fabric choice set and all its values.
3412
+ *
3413
+ * @param choiceSetId - UUID of the choice set to delete
3414
+ * @returns Promise resolving when the choice set is deleted
3415
+ *
3416
+ * @example
3417
+ * ```typescript
3418
+ * // First, get the choice set ID using getAll()
3419
+ * const allChoiceSets = await choicesets.getAll();
3420
+ * const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
3421
+ *
3422
+ * await choicesets.deleteById(expenseTypes.id);
3423
+ * ```
3424
+ * @internal
3425
+ */
3426
+ async deleteById(choiceSetId) {
3427
+ await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE(choiceSetId), {});
3428
+ }
3429
+ /**
3430
+ * Inserts a single value into a choice set.
3431
+ *
3432
+ * @param choiceSetId - UUID of the parent choice set
3433
+ * @param name - Identifier name of the new value (e.g., `"TRAVEL"`)
3434
+ * @param options - Optional fields ({@link ChoiceSetValueInsertOptions})
3435
+ * @returns Promise resolving to the inserted value ({@link ChoiceSetValueInsertResponse})
3436
+ *
3437
+ * @example
3438
+ * ```typescript
3439
+ * // First, get the choice set ID using getAll()
3440
+ * const allChoiceSets = await choicesets.getAll();
3441
+ * const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
3442
+ *
3443
+ * const inserted = await choicesets.insertValueById(expenseTypes.id, 'TRAVEL', {
3444
+ * displayName: 'Travel',
3445
+ * });
3446
+ * console.log(inserted.id);
3447
+ * ```
3448
+ * @internal
3449
+ */
3450
+ async insertValueById(choiceSetId, name, options) {
3451
+ const choiceSetName = await this.resolveChoiceSetName(choiceSetId);
3452
+ const payload = {
3453
+ Name: name,
3454
+ ...(options?.displayName !== undefined && { DisplayName: options.displayName }),
3455
+ };
3456
+ const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.INSERT_BY_NAME(choiceSetName), payload);
3457
+ const camelCased = pascalToCamelCaseKeys(response.data);
3458
+ return transformData(camelCased, EntityMap);
3459
+ }
3460
+ /**
3461
+ * Updates an existing choice-set value's display name.
3462
+ *
3463
+ * Only `displayName` is mutable; the value's `name` (identifier) is fixed at
3464
+ * insert time and cannot be changed.
3465
+ *
3466
+ * @param choiceSetId - UUID of the parent choice set
3467
+ * @param valueId - UUID of the value to update
3468
+ * @param displayName - New human-readable display name for the value
3469
+ * @returns Promise resolving to the updated value ({@link ChoiceSetValueUpdateResponse})
3470
+ *
3471
+ * @example
3472
+ * ```typescript
3473
+ * // Get the choice set ID from getAll() and the value ID from getById()
3474
+ * const allChoiceSets = await choicesets.getAll();
3475
+ * const expenseTypes = allChoiceSets.find(cs => cs.name === 'expense_types');
3476
+ * const values = await choicesets.getById(expenseTypes.id);
3477
+ * const travel = values.items.find(v => v.name === 'TRAVEL');
3478
+ *
3479
+ * await choicesets.updateValueById(expenseTypes.id, travel.id, 'Business Travel');
3480
+ * ```
3481
+ * @internal
3482
+ */
3483
+ async updateValueById(choiceSetId, valueId, displayName) {
3484
+ const choiceSetName = await this.resolveChoiceSetName(choiceSetId);
3485
+ const payload = { DisplayName: displayName };
3486
+ const response = await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.UPDATE_BY_NAME(choiceSetName, valueId), payload);
3487
+ const camelCased = pascalToCamelCaseKeys(response.data);
3488
+ return transformData(camelCased, EntityMap);
3489
+ }
3490
+ /**
3491
+ * Deletes one or more values from a choice set.
3492
+ *
3493
+ * @param choiceSetId - UUID of the parent choice set
3494
+ * @param valueIds - Array of value UUIDs to delete
3495
+ * @returns Promise resolving when the values are deleted
3496
+ *
3497
+ * @example
3498
+ * ```typescript
3499
+ * // Get the value IDs from getById()
3500
+ * const values = await choicesets.getById('<choiceSetId>');
3501
+ * const idsToDelete = values.items.slice(0, 2).map(v => v.id);
3502
+ *
3503
+ * await choicesets.deleteValuesById('<choiceSetId>', idsToDelete);
3504
+ * ```
3505
+ * @internal
3506
+ */
3507
+ async deleteValuesById(choiceSetId, valueIds) {
3508
+ await this.post(DATA_FABRIC_ENDPOINTS.CHOICESETS.DELETE_BY_ID(choiceSetId), valueIds);
3509
+ }
3510
+ async resolveChoiceSetName(choiceSetId) {
3511
+ const all = await this.getAll();
3512
+ const match = all.find(cs => cs.id === choiceSetId);
3513
+ if (!match) {
3514
+ throw new NotFoundError({ message: `Choice set with id '${choiceSetId}' not found.` });
3515
+ }
3516
+ return match.name;
3517
+ }
3317
3518
  }
3318
3519
  __decorate([
3319
3520
  track('Choicesets.GetAll')
@@ -3321,5 +3522,23 @@ __decorate([
3321
3522
  __decorate([
3322
3523
  track('Choicesets.GetById')
3323
3524
  ], ChoiceSetService.prototype, "getById", null);
3525
+ __decorate([
3526
+ track('Choicesets.Create')
3527
+ ], ChoiceSetService.prototype, "create", null);
3528
+ __decorate([
3529
+ track('Choicesets.UpdateById')
3530
+ ], ChoiceSetService.prototype, "updateById", null);
3531
+ __decorate([
3532
+ track('Choicesets.DeleteById')
3533
+ ], ChoiceSetService.prototype, "deleteById", null);
3534
+ __decorate([
3535
+ track('Choicesets.InsertValueById')
3536
+ ], ChoiceSetService.prototype, "insertValueById", null);
3537
+ __decorate([
3538
+ track('Choicesets.UpdateValueById')
3539
+ ], ChoiceSetService.prototype, "updateValueById", null);
3540
+ __decorate([
3541
+ track('Choicesets.DeleteValuesById')
3542
+ ], ChoiceSetService.prototype, "deleteValuesById", null);
3324
3543
 
3325
3544
  export { ChoiceSetService, ChoiceSetService as ChoiceSets, DataDirectionType, EntityService as Entities, EntityAggregateFunction, EntityFieldDataType, EntityService, EntityType, FieldDisplayType, JoinType, LogicalOperator, QueryFilterOperator, ReferenceType, createEntityWithMethods };