@uipath/data-fabric-tool 1.196.0 → 1.197.0-preview.60

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/data-fabric-tool",
3
3
  "license": "MIT",
4
- "version": "1.196.0",
4
+ "version": "1.197.0-preview.60",
5
5
  "description": "Manage Data Fabric entities and records.",
6
6
  "type": "module",
7
7
  "main": "./dist/tool.js",
@@ -14,5 +14,5 @@
14
14
  "publishConfig": {
15
15
  "registry": "https://registry.npmjs.org/"
16
16
  },
17
- "gitHead": "94d71f9c52214980a1f0ae62b3f5372095788553"
17
+ "gitHead": "e80b8345e8f629192faeb29202cba3b3de258b50"
18
18
  }
@@ -547,7 +547,10 @@ describe("choice-sets delete", () => {
547
547
  "--reason",
548
548
  "cleanup",
549
549
  ]);
550
- expect(sdk.entities.choicesets.deleteById).toHaveBeenCalledWith("cs-1");
550
+ expect(sdk.entities.choicesets.deleteById).toHaveBeenCalledWith(
551
+ "cs-1",
552
+ undefined,
553
+ );
551
554
  expect(OutputFormatter.success).toHaveBeenCalledWith(
552
555
  expect.objectContaining({
553
556
  Result: "Success",
@@ -587,7 +590,10 @@ describe("choice-sets delete", () => {
587
590
  "--reason",
588
591
  "cleanup",
589
592
  ]);
590
- expect(sdk.entities.choicesets.deleteById).toHaveBeenCalledWith("cs-1");
593
+ expect(sdk.entities.choicesets.deleteById).toHaveBeenCalledWith(
594
+ "cs-1",
595
+ undefined,
596
+ );
591
597
  expect(OutputFormatter.success).toHaveBeenCalledWith(
592
598
  expect.objectContaining({
593
599
  Result: "Success",
@@ -725,6 +731,7 @@ describe("choice-set-values", () => {
725
731
  "cs-1",
726
732
  "v-1",
727
733
  "Business Travel",
734
+ undefined,
728
735
  );
729
736
  expect(OutputFormatter.success).toHaveBeenCalledWith(
730
737
  expect.objectContaining({
@@ -780,6 +787,7 @@ describe("choice-set-values", () => {
780
787
  expect(sdk.entities.choicesets.deleteValuesById).toHaveBeenCalledWith(
781
788
  "cs-1",
782
789
  ["v-1", "v-2", "v-3"],
790
+ undefined,
783
791
  );
784
792
  expect(OutputFormatter.success).toHaveBeenCalledWith(
785
793
  expect.objectContaining({
@@ -880,3 +888,211 @@ describe("choice-set-values", () => {
880
888
  expect(process.exitCode).toBe(1);
881
889
  });
882
890
  });
891
+
892
+ describe("choice-sets list --include-folders", () => {
893
+ beforeEach(() => {
894
+ vi.resetAllMocks();
895
+ process.exitCode = undefined;
896
+ });
897
+
898
+ it("should call getAll with no options when neither flag is passed", async () => {
899
+ const sdk = mockSdk();
900
+ const program = buildProgram();
901
+ await program.parseAsync(["node", "test", "choice-sets", "list"]);
902
+ expect(sdk.entities.choicesets.getAll).toHaveBeenCalledWith(undefined);
903
+ });
904
+
905
+ it("should forward --include-folders as includeFolderChoiceSets: true", async () => {
906
+ const sdk = mockSdk();
907
+ const program = buildProgram();
908
+ await program.parseAsync([
909
+ "node",
910
+ "test",
911
+ "choice-sets",
912
+ "list",
913
+ "--include-folders",
914
+ ]);
915
+ expect(sdk.entities.choicesets.getAll).toHaveBeenCalledWith({
916
+ includeFolderChoiceSets: true,
917
+ });
918
+ });
919
+
920
+ it("should forward --folder-key as folderKey to getAll", async () => {
921
+ const sdk = mockSdk();
922
+ const program = buildProgram();
923
+ await program.parseAsync([
924
+ "node",
925
+ "test",
926
+ "choice-sets",
927
+ "list",
928
+ "--folder-key",
929
+ "folder-1",
930
+ ]);
931
+ expect(sdk.entities.choicesets.getAll).toHaveBeenCalledWith({
932
+ folderKey: "folder-1",
933
+ });
934
+ });
935
+
936
+ it("should reject --folder-key combined with --include-folders", async () => {
937
+ const sdk = mockSdk();
938
+ const program = buildProgram();
939
+ await program.parseAsync([
940
+ "node",
941
+ "test",
942
+ "choice-sets",
943
+ "list",
944
+ "--folder-key",
945
+ "folder-1",
946
+ "--include-folders",
947
+ ]);
948
+ expect(sdk.entities.choicesets.getAll).not.toHaveBeenCalled();
949
+ expect(process.exitCode).toBe(1);
950
+ });
951
+ });
952
+
953
+ describe("choice-sets --folder-key forwarding", () => {
954
+ beforeEach(() => {
955
+ vi.resetAllMocks();
956
+ process.exitCode = undefined;
957
+ });
958
+
959
+ it("should forward --folder-key to getById", async () => {
960
+ const sdk = mockSdk();
961
+ const program = buildProgram();
962
+ await program.parseAsync([
963
+ "node",
964
+ "test",
965
+ "choice-sets",
966
+ "list-values",
967
+ "cs-1",
968
+ "--folder-key",
969
+ "folder-1",
970
+ ]);
971
+ expect(sdk.entities.choicesets.getById).toHaveBeenCalledWith("cs-1", {
972
+ pageSize: 50,
973
+ folderKey: "folder-1",
974
+ });
975
+ });
976
+
977
+ it("should forward --folder-key into update options", async () => {
978
+ const sdk = mockSdk();
979
+ const program = buildProgram();
980
+ await program.parseAsync([
981
+ "node",
982
+ "test",
983
+ "choice-sets",
984
+ "update",
985
+ "cs-1",
986
+ "--display-name",
987
+ "New",
988
+ "--folder-key",
989
+ "folder-2",
990
+ ]);
991
+ expect(sdk.entities.choicesets.updateById).toHaveBeenCalledWith(
992
+ "cs-1",
993
+ {
994
+ displayName: "New",
995
+ folderKey: "folder-2",
996
+ },
997
+ );
998
+ });
999
+
1000
+ it("should forward --folder-key to deleteById", async () => {
1001
+ const sdk = mockSdk();
1002
+ const program = buildProgram();
1003
+ await program.parseAsync([
1004
+ "node",
1005
+ "test",
1006
+ "choice-sets",
1007
+ "delete",
1008
+ "cs-1",
1009
+ "--yes",
1010
+ "--reason",
1011
+ "cleanup",
1012
+ "--folder-key",
1013
+ "folder-3",
1014
+ ]);
1015
+ expect(sdk.entities.choicesets.deleteById).toHaveBeenCalledWith(
1016
+ "cs-1",
1017
+ { folderKey: "folder-3" },
1018
+ );
1019
+ });
1020
+ });
1021
+
1022
+ describe("choice-set-values --folder-key forwarding", () => {
1023
+ beforeEach(() => {
1024
+ vi.resetAllMocks();
1025
+ process.exitCode = undefined;
1026
+ });
1027
+
1028
+ it("should forward --folder-key into insertValueById options", async () => {
1029
+ const sdk = mockSdk();
1030
+ const program = buildValuesProgram();
1031
+ await program.parseAsync([
1032
+ "node",
1033
+ "test",
1034
+ "choice-set-values",
1035
+ "create",
1036
+ "cs-1",
1037
+ "travel",
1038
+ "--display-name",
1039
+ "Travel",
1040
+ "--folder-key",
1041
+ "folder-4",
1042
+ ]);
1043
+ expect(sdk.entities.choicesets.insertValueById).toHaveBeenCalledWith(
1044
+ "cs-1",
1045
+ "travel",
1046
+ {
1047
+ displayName: "Travel",
1048
+ folderKey: "folder-4",
1049
+ },
1050
+ );
1051
+ });
1052
+
1053
+ it("should forward --folder-key to updateValueById", async () => {
1054
+ const sdk = mockSdk();
1055
+ const program = buildValuesProgram();
1056
+ await program.parseAsync([
1057
+ "node",
1058
+ "test",
1059
+ "choice-set-values",
1060
+ "update",
1061
+ "cs-1",
1062
+ "v-1",
1063
+ "Business Travel",
1064
+ "--folder-key",
1065
+ "folder-5",
1066
+ ]);
1067
+ expect(sdk.entities.choicesets.updateValueById).toHaveBeenCalledWith(
1068
+ "cs-1",
1069
+ "v-1",
1070
+ "Business Travel",
1071
+ { folderKey: "folder-5" },
1072
+ );
1073
+ });
1074
+
1075
+ it("should forward --folder-key to deleteValuesById", async () => {
1076
+ const sdk = mockSdk();
1077
+ const program = buildValuesProgram();
1078
+ await program.parseAsync([
1079
+ "node",
1080
+ "test",
1081
+ "choice-set-values",
1082
+ "delete",
1083
+ "cs-1",
1084
+ "--ids",
1085
+ "v-1,v-2",
1086
+ "--yes",
1087
+ "--reason",
1088
+ "cleanup",
1089
+ "--folder-key",
1090
+ "folder-6",
1091
+ ]);
1092
+ expect(sdk.entities.choicesets.deleteValuesById).toHaveBeenCalledWith(
1093
+ "cs-1",
1094
+ ["v-1", "v-2"],
1095
+ { folderKey: "folder-6" },
1096
+ );
1097
+ });
1098
+ });
@@ -9,9 +9,14 @@ import {
9
9
  } from "@uipath/common";
10
10
  import type {
11
11
  ChoiceSetCreateOptions,
12
+ ChoiceSetDeleteByIdOptions,
13
+ ChoiceSetGetAllOptions,
14
+ ChoiceSetGetByIdOptions,
12
15
  ChoiceSetServiceModel,
13
16
  ChoiceSetUpdateOptions,
17
+ ChoiceSetValueDeleteOptions,
14
18
  ChoiceSetValueInsertOptions,
19
+ ChoiceSetValueUpdateOptions,
15
20
  } from "@uipath/uipath-typescript";
16
21
  import { type Command, Option } from "commander";
17
22
  import { fail, requireDestructiveConfirmation } from "../utils/output";
@@ -30,6 +35,8 @@ const OUTPUT_CODES = {
30
35
 
31
36
  interface ListOptions {
32
37
  tenant?: string;
38
+ folderKey?: string;
39
+ includeFolders?: boolean;
33
40
  }
34
41
 
35
42
  interface GetOptions {
@@ -37,6 +44,7 @@ interface GetOptions {
37
44
  limit?: string;
38
45
  offset?: string;
39
46
  cursor?: string;
47
+ folderKey?: string;
40
48
  }
41
49
 
42
50
  interface CreateOptions {
@@ -50,6 +58,7 @@ interface UpdateOptions {
50
58
  tenant?: string;
51
59
  displayName?: string;
52
60
  description?: string;
61
+ folderKey?: string;
53
62
  }
54
63
 
55
64
  interface DeleteOptions {
@@ -57,15 +66,18 @@ interface DeleteOptions {
57
66
  yes?: boolean;
58
67
  confirm?: boolean;
59
68
  reason?: string;
69
+ folderKey?: string;
60
70
  }
61
71
 
62
72
  interface ValueCreateOptions {
63
73
  tenant?: string;
64
74
  displayName?: string;
75
+ folderKey?: string;
65
76
  }
66
77
 
67
78
  interface ValueUpdateOptions {
68
79
  tenant?: string;
80
+ folderKey?: string;
69
81
  }
70
82
 
71
83
  interface ValueDeleteOptions {
@@ -74,12 +86,14 @@ interface ValueDeleteOptions {
74
86
  yes?: boolean;
75
87
  confirm?: boolean;
76
88
  reason?: string;
89
+ folderKey?: string;
77
90
  }
78
91
 
79
92
  const CHOICE_SETS_LIST_EXAMPLES: CommandExample[] = [
80
93
  {
81
94
  Description:
82
- "List all Data Fabric choice sets. The returned 'id' is the value to pass as 'choiceSetId' on a CHOICE_SET_SINGLE/CHOICE_SET_MULTIPLE entity field, or to 'df choice-sets list-values <id>'.",
95
+ "List all Data Fabric choice sets. The returned 'id' is the value to pass as 'choiceSetId' on a CHOICE_SET_SINGLE/CHOICE_SET_MULTIPLE entity field, or to 'df choice-sets list-values <id>'. " +
96
+ "Scope modes: omit both flags to see only tenant-level choice sets (the default); pass '--folder-key <uuid>' to see only that folder's choice sets; pass '--include-folders' to see tenant + folder choice sets together. '--folder-key' and '--include-folders' are mutually exclusive.",
83
97
  Command: "uip df choice-sets list",
84
98
  Output: {
85
99
  Code: OUTPUT_CODES.ChoiceSetList,
@@ -186,13 +200,42 @@ export const registerChoiceSetsCommand = (program: Command) => {
186
200
  .addOption(
187
201
  createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>"),
188
202
  )
203
+ .option(
204
+ "--folder-key <key>",
205
+ "Folder key (GUID) to scope the listing to a specific folder",
206
+ )
207
+ .option(
208
+ "--include-folders",
209
+ "List tenant-level choice sets together with choice sets from every folder you can see. Mutually exclusive with --folder-key.",
210
+ )
189
211
  .examples(CHOICE_SETS_LIST_EXAMPLES)
190
212
  .trackedAction(processContext, async (options: ListOptions) => {
213
+ if (
214
+ options.folderKey !== undefined &&
215
+ options.includeFolders === true
216
+ ) {
217
+ return fail(
218
+ "--folder-key and --include-folders are mutually exclusive",
219
+ "Use --folder-key to list a single folder, or --include-folders to list tenant + folder choice sets together.",
220
+ );
221
+ }
222
+
191
223
  const sdk = await connectOrFail(options.tenant);
192
224
  if (!sdk) return;
193
225
 
226
+ const listOpts: ChoiceSetGetAllOptions = {
227
+ ...(options.folderKey !== undefined && {
228
+ folderKey: options.folderKey,
229
+ }),
230
+ ...(options.includeFolders === true && {
231
+ includeFolderChoiceSets: true,
232
+ }),
233
+ };
234
+
194
235
  const [listError, result] = await catchError(
195
- sdk.entities.choicesets.getAll(),
236
+ sdk.entities.choicesets.getAll(
237
+ Object.keys(listOpts).length > 0 ? listOpts : undefined,
238
+ ),
196
239
  );
197
240
 
198
241
  if (listError) {
@@ -229,6 +272,10 @@ export const registerChoiceSetsCommand = (program: Command) => {
229
272
  "--cursor <cursor>",
230
273
  "Pagination cursor from a previous response to fetch the next page",
231
274
  )
275
+ .option(
276
+ "--folder-key <key>",
277
+ "Folder key (GUID) of the folder containing the choice set (for folder-scoped choice sets)",
278
+ )
232
279
  .examples(CHOICE_SETS_GET_EXAMPLES)
233
280
  .trackedAction(
234
281
  processContext,
@@ -266,12 +313,15 @@ export const registerChoiceSetsCommand = (program: Command) => {
266
313
  const sdk = await connectOrFail(options.tenant);
267
314
  if (!sdk) return;
268
315
 
269
- const paginationOptions =
316
+ const paginationOptions: ChoiceSetGetByIdOptions =
270
317
  options.cursor !== undefined
271
318
  ? { pageSize, cursor: { value: options.cursor } }
272
319
  : jumpToPage !== undefined
273
320
  ? { pageSize, jumpToPage }
274
321
  : { pageSize };
322
+ if (options.folderKey !== undefined) {
323
+ paginationOptions.folderKey = options.folderKey;
324
+ }
275
325
 
276
326
  const [getError, result] = await catchError(
277
327
  sdk.entities.choicesets.getById(
@@ -365,6 +415,10 @@ export const registerChoiceSetsCommand = (program: Command) => {
365
415
  )
366
416
  .option("--display-name <name>", "New display name")
367
417
  .option("--description <text>", "New description")
418
+ .option(
419
+ "--folder-key <key>",
420
+ "Folder key (GUID) of the folder containing the choice set (for folder-scoped choice sets)",
421
+ )
368
422
  .examples(CHOICE_SETS_UPDATE_EXAMPLES)
369
423
  .trackedAction(
370
424
  processContext,
@@ -389,6 +443,9 @@ export const registerChoiceSetsCommand = (program: Command) => {
389
443
  ...(options.description !== undefined && {
390
444
  description: options.description,
391
445
  }),
446
+ ...(options.folderKey !== undefined && {
447
+ folderKey: options.folderKey,
448
+ }),
392
449
  };
393
450
 
394
451
  const choiceSetService: ChoiceSetServiceModel =
@@ -427,6 +484,10 @@ export const registerChoiceSetsCommand = (program: Command) => {
427
484
  "--reason <reason>",
428
485
  "Reason for the deletion — echoed back in the response so the caller can log it",
429
486
  )
487
+ .option(
488
+ "--folder-key <key>",
489
+ "Folder key (GUID) of the folder containing the choice set (for folder-scoped choice sets)",
490
+ )
430
491
  .examples(CHOICE_SETS_DELETE_EXAMPLES)
431
492
  .trackedAction(
432
493
  processContext,
@@ -441,10 +502,21 @@ export const registerChoiceSetsCommand = (program: Command) => {
441
502
  const sdk = await connectOrFail(options.tenant);
442
503
  if (!sdk) return;
443
504
 
505
+ const deleteOpts: ChoiceSetDeleteByIdOptions = {
506
+ ...(options.folderKey !== undefined && {
507
+ folderKey: options.folderKey,
508
+ }),
509
+ };
510
+
444
511
  const choiceSetService: ChoiceSetServiceModel =
445
512
  sdk.entities.choicesets;
446
513
  const [deleteError] = await catchError(
447
- choiceSetService.deleteById(choiceSetId),
514
+ choiceSetService.deleteById(
515
+ choiceSetId,
516
+ Object.keys(deleteOpts).length > 0
517
+ ? deleteOpts
518
+ : undefined,
519
+ ),
448
520
  );
449
521
 
450
522
  if (deleteError) {
@@ -539,6 +611,10 @@ export const registerChoiceSetValuesCommand = (program: Command) => {
539
611
  createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>"),
540
612
  )
541
613
  .option("--display-name <name>", "Human-readable display name")
614
+ .option(
615
+ "--folder-key <key>",
616
+ "Folder key (GUID) of the folder containing the choice set (required for folder-scoped choice sets)",
617
+ )
542
618
  .examples(CHOICE_SET_VALUES_CREATE_EXAMPLES)
543
619
  .trackedAction(
544
620
  processContext,
@@ -554,6 +630,9 @@ export const registerChoiceSetValuesCommand = (program: Command) => {
554
630
  ...(options.displayName !== undefined && {
555
631
  displayName: options.displayName,
556
632
  }),
633
+ ...(options.folderKey !== undefined && {
634
+ folderKey: options.folderKey,
635
+ }),
557
636
  };
558
637
 
559
638
  const choiceSetService: ChoiceSetServiceModel =
@@ -592,6 +671,10 @@ export const registerChoiceSetValuesCommand = (program: Command) => {
592
671
  .addOption(
593
672
  createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>"),
594
673
  )
674
+ .option(
675
+ "--folder-key <key>",
676
+ "Folder key (GUID) of the folder containing the choice set (required for folder-scoped choice sets)",
677
+ )
595
678
  .examples(CHOICE_SET_VALUES_UPDATE_EXAMPLES)
596
679
  .trackedAction(
597
680
  processContext,
@@ -604,6 +687,12 @@ export const registerChoiceSetValuesCommand = (program: Command) => {
604
687
  const sdk = await connectOrFail(options.tenant);
605
688
  if (!sdk) return;
606
689
 
690
+ const updateOpts: ChoiceSetValueUpdateOptions = {
691
+ ...(options.folderKey !== undefined && {
692
+ folderKey: options.folderKey,
693
+ }),
694
+ };
695
+
607
696
  const choiceSetService: ChoiceSetServiceModel =
608
697
  sdk.entities.choicesets;
609
698
  const [updateError, result] = await catchError(
@@ -611,6 +700,9 @@ export const registerChoiceSetValuesCommand = (program: Command) => {
611
700
  choiceSetId,
612
701
  valueId,
613
702
  displayName,
703
+ Object.keys(updateOpts).length > 0
704
+ ? updateOpts
705
+ : undefined,
614
706
  ),
615
707
  );
616
708
 
@@ -647,6 +739,10 @@ export const registerChoiceSetValuesCommand = (program: Command) => {
647
739
  "--reason <reason>",
648
740
  "Reason for the deletion — echoed back in the response so the caller can log it",
649
741
  )
742
+ .option(
743
+ "--folder-key <key>",
744
+ "Folder key (GUID) of the folder containing the choice set (required for folder-scoped choice sets)",
745
+ )
650
746
  .examples(CHOICE_SET_VALUES_DELETE_EXAMPLES)
651
747
  .trackedAction(
652
748
  processContext,
@@ -673,10 +769,22 @@ export const registerChoiceSetValuesCommand = (program: Command) => {
673
769
  const sdk = await connectOrFail(options.tenant);
674
770
  if (!sdk) return;
675
771
 
772
+ const deleteOpts: ChoiceSetValueDeleteOptions = {
773
+ ...(options.folderKey !== undefined && {
774
+ folderKey: options.folderKey,
775
+ }),
776
+ };
777
+
676
778
  const choiceSetService: ChoiceSetServiceModel =
677
779
  sdk.entities.choicesets;
678
780
  const [deleteError] = await catchError(
679
- choiceSetService.deleteValuesById(choiceSetId, valueIds),
781
+ choiceSetService.deleteValuesById(
782
+ choiceSetId,
783
+ valueIds,
784
+ Object.keys(deleteOpts).length > 0
785
+ ? deleteOpts
786
+ : undefined,
787
+ ),
680
788
  );
681
789
 
682
790
  if (deleteError) {