@uipath/data-fabric-tool 1.195.0 → 1.197.0-preview.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -0
- package/dist/tool.js +6037 -6015
- package/package.json +2 -2
- package/src/commands/choice-sets.spec.ts +262 -13
- package/src/commands/choice-sets.ts +126 -8
- package/src/commands/entities.spec.ts +302 -14
- package/src/commands/entities.ts +111 -9
- package/src/commands/files.spec.ts +108 -3
- package/src/commands/files.ts +45 -2
- package/src/commands/records.spec.ts +323 -0
- package/src/commands/records.ts +120 -18
- package/src/utils/input.spec.ts +127 -0
- package/src/utils/input.ts +30 -1
- package/src/utils/output.spec.ts +22 -9
- package/src/utils/output.ts +27 -9
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/data-fabric-tool",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.197.0-preview.59",
|
|
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": "
|
|
17
|
+
"gitHead": "df0e2b8140cced13f463b487214927c82bc0f85b"
|
|
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(
|
|
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",
|
|
@@ -557,7 +560,7 @@ describe("choice-sets delete", () => {
|
|
|
557
560
|
);
|
|
558
561
|
});
|
|
559
562
|
|
|
560
|
-
it("should require --confirm", async () => {
|
|
563
|
+
it("should require confirmation (no --yes/--confirm): exit 1, SDK not called", async () => {
|
|
561
564
|
const sdk = mockSdk();
|
|
562
565
|
const program = buildProgram();
|
|
563
566
|
await program.parseAsync([
|
|
@@ -570,13 +573,33 @@ describe("choice-sets delete", () => {
|
|
|
570
573
|
"cleanup",
|
|
571
574
|
]);
|
|
572
575
|
expect(sdk.entities.choicesets.deleteById).not.toHaveBeenCalled();
|
|
573
|
-
expect(OutputFormatter.
|
|
576
|
+
expect(OutputFormatter.success).not.toHaveBeenCalled();
|
|
577
|
+
expect(process.exitCode).toBe(1);
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
it("should accept --yes (canonical confirmation flag)", async () => {
|
|
581
|
+
const sdk = mockSdk();
|
|
582
|
+
const program = buildProgram();
|
|
583
|
+
await program.parseAsync([
|
|
584
|
+
"node",
|
|
585
|
+
"test",
|
|
586
|
+
"choice-sets",
|
|
587
|
+
"delete",
|
|
588
|
+
"cs-1",
|
|
589
|
+
"--yes",
|
|
590
|
+
"--reason",
|
|
591
|
+
"cleanup",
|
|
592
|
+
]);
|
|
593
|
+
expect(sdk.entities.choicesets.deleteById).toHaveBeenCalledWith(
|
|
594
|
+
"cs-1",
|
|
595
|
+
undefined,
|
|
596
|
+
);
|
|
597
|
+
expect(OutputFormatter.success).toHaveBeenCalledWith(
|
|
574
598
|
expect.objectContaining({
|
|
575
|
-
Result: "
|
|
576
|
-
|
|
599
|
+
Result: "Success",
|
|
600
|
+
Code: "ChoiceSetDeleted",
|
|
577
601
|
}),
|
|
578
602
|
);
|
|
579
|
-
expect(process.exitCode).toBe(1);
|
|
580
603
|
});
|
|
581
604
|
|
|
582
605
|
it("should require --reason", async () => {
|
|
@@ -708,6 +731,7 @@ describe("choice-set-values", () => {
|
|
|
708
731
|
"cs-1",
|
|
709
732
|
"v-1",
|
|
710
733
|
"Business Travel",
|
|
734
|
+
undefined,
|
|
711
735
|
);
|
|
712
736
|
expect(OutputFormatter.success).toHaveBeenCalledWith(
|
|
713
737
|
expect.objectContaining({
|
|
@@ -763,6 +787,7 @@ describe("choice-set-values", () => {
|
|
|
763
787
|
expect(sdk.entities.choicesets.deleteValuesById).toHaveBeenCalledWith(
|
|
764
788
|
"cs-1",
|
|
765
789
|
["v-1", "v-2", "v-3"],
|
|
790
|
+
undefined,
|
|
766
791
|
);
|
|
767
792
|
expect(OutputFormatter.success).toHaveBeenCalledWith(
|
|
768
793
|
expect.objectContaining({
|
|
@@ -800,7 +825,7 @@ describe("choice-set-values", () => {
|
|
|
800
825
|
expect(process.exitCode).toBe(1);
|
|
801
826
|
});
|
|
802
827
|
|
|
803
|
-
it("should require
|
|
828
|
+
it("should require confirmation for value delete: exit 1, SDK not called", async () => {
|
|
804
829
|
const sdk = mockSdk();
|
|
805
830
|
const program = buildValuesProgram();
|
|
806
831
|
await program.parseAsync([
|
|
@@ -815,15 +840,31 @@ describe("choice-set-values", () => {
|
|
|
815
840
|
"cleanup",
|
|
816
841
|
]);
|
|
817
842
|
expect(sdk.entities.choicesets.deleteValuesById).not.toHaveBeenCalled();
|
|
818
|
-
expect(OutputFormatter.
|
|
819
|
-
expect.objectContaining({
|
|
820
|
-
Result: "Failure",
|
|
821
|
-
Message: "Confirmation required for destructive operation",
|
|
822
|
-
}),
|
|
823
|
-
);
|
|
843
|
+
expect(OutputFormatter.success).not.toHaveBeenCalled();
|
|
824
844
|
expect(process.exitCode).toBe(1);
|
|
825
845
|
});
|
|
826
846
|
|
|
847
|
+
it("should accept --yes for value delete (canonical flag)", async () => {
|
|
848
|
+
const sdk = mockSdk();
|
|
849
|
+
const program = buildValuesProgram();
|
|
850
|
+
await program.parseAsync([
|
|
851
|
+
"node",
|
|
852
|
+
"test",
|
|
853
|
+
"choice-set-values",
|
|
854
|
+
"delete",
|
|
855
|
+
"cs-1",
|
|
856
|
+
"--ids",
|
|
857
|
+
"v-1",
|
|
858
|
+
"--yes",
|
|
859
|
+
"--reason",
|
|
860
|
+
"cleanup",
|
|
861
|
+
]);
|
|
862
|
+
expect(sdk.entities.choicesets.deleteValuesById).toHaveBeenCalled();
|
|
863
|
+
expect(OutputFormatter.success).toHaveBeenCalledWith(
|
|
864
|
+
expect.objectContaining({ Result: "Success" }),
|
|
865
|
+
);
|
|
866
|
+
});
|
|
867
|
+
|
|
827
868
|
it("should require --reason for value delete", async () => {
|
|
828
869
|
const sdk = mockSdk();
|
|
829
870
|
const program = buildValuesProgram();
|
|
@@ -847,3 +888,211 @@ describe("choice-set-values", () => {
|
|
|
847
888
|
expect(process.exitCode).toBe(1);
|
|
848
889
|
});
|
|
849
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,11 +9,16 @@ 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
|
-
import type
|
|
21
|
+
import { type Command, Option } from "commander";
|
|
17
22
|
import { fail, requireDestructiveConfirmation } from "../utils/output";
|
|
18
23
|
import { connectOrFail } from "../utils/sdk-client";
|
|
19
24
|
|
|
@@ -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,34 +58,42 @@ 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 {
|
|
56
65
|
tenant?: string;
|
|
66
|
+
yes?: boolean;
|
|
57
67
|
confirm?: boolean;
|
|
58
68
|
reason?: string;
|
|
69
|
+
folderKey?: string;
|
|
59
70
|
}
|
|
60
71
|
|
|
61
72
|
interface ValueCreateOptions {
|
|
62
73
|
tenant?: string;
|
|
63
74
|
displayName?: string;
|
|
75
|
+
folderKey?: string;
|
|
64
76
|
}
|
|
65
77
|
|
|
66
78
|
interface ValueUpdateOptions {
|
|
67
79
|
tenant?: string;
|
|
80
|
+
folderKey?: string;
|
|
68
81
|
}
|
|
69
82
|
|
|
70
83
|
interface ValueDeleteOptions {
|
|
71
84
|
tenant?: string;
|
|
72
85
|
ids?: string;
|
|
86
|
+
yes?: boolean;
|
|
73
87
|
confirm?: boolean;
|
|
74
88
|
reason?: string;
|
|
89
|
+
folderKey?: string;
|
|
75
90
|
}
|
|
76
91
|
|
|
77
92
|
const CHOICE_SETS_LIST_EXAMPLES: CommandExample[] = [
|
|
78
93
|
{
|
|
79
94
|
Description:
|
|
80
|
-
"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.",
|
|
81
97
|
Command: "uip df choice-sets list",
|
|
82
98
|
Output: {
|
|
83
99
|
Code: OUTPUT_CODES.ChoiceSetList,
|
|
@@ -184,13 +200,42 @@ export const registerChoiceSetsCommand = (program: Command) => {
|
|
|
184
200
|
.addOption(
|
|
185
201
|
createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>"),
|
|
186
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
|
+
)
|
|
187
211
|
.examples(CHOICE_SETS_LIST_EXAMPLES)
|
|
188
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
|
+
|
|
189
223
|
const sdk = await connectOrFail(options.tenant);
|
|
190
224
|
if (!sdk) return;
|
|
191
225
|
|
|
226
|
+
const listOpts: ChoiceSetGetAllOptions = {
|
|
227
|
+
...(options.folderKey !== undefined && {
|
|
228
|
+
folderKey: options.folderKey,
|
|
229
|
+
}),
|
|
230
|
+
...(options.includeFolders === true && {
|
|
231
|
+
includeFolderChoiceSets: true,
|
|
232
|
+
}),
|
|
233
|
+
};
|
|
234
|
+
|
|
192
235
|
const [listError, result] = await catchError(
|
|
193
|
-
sdk.entities.choicesets.getAll(
|
|
236
|
+
sdk.entities.choicesets.getAll(
|
|
237
|
+
Object.keys(listOpts).length > 0 ? listOpts : undefined,
|
|
238
|
+
),
|
|
194
239
|
);
|
|
195
240
|
|
|
196
241
|
if (listError) {
|
|
@@ -227,6 +272,10 @@ export const registerChoiceSetsCommand = (program: Command) => {
|
|
|
227
272
|
"--cursor <cursor>",
|
|
228
273
|
"Pagination cursor from a previous response to fetch the next page",
|
|
229
274
|
)
|
|
275
|
+
.option(
|
|
276
|
+
"--folder-key <key>",
|
|
277
|
+
"Folder key (GUID) of the folder containing the choice set (for folder-scoped choice sets)",
|
|
278
|
+
)
|
|
230
279
|
.examples(CHOICE_SETS_GET_EXAMPLES)
|
|
231
280
|
.trackedAction(
|
|
232
281
|
processContext,
|
|
@@ -264,12 +313,15 @@ export const registerChoiceSetsCommand = (program: Command) => {
|
|
|
264
313
|
const sdk = await connectOrFail(options.tenant);
|
|
265
314
|
if (!sdk) return;
|
|
266
315
|
|
|
267
|
-
const paginationOptions =
|
|
316
|
+
const paginationOptions: ChoiceSetGetByIdOptions =
|
|
268
317
|
options.cursor !== undefined
|
|
269
318
|
? { pageSize, cursor: { value: options.cursor } }
|
|
270
319
|
: jumpToPage !== undefined
|
|
271
320
|
? { pageSize, jumpToPage }
|
|
272
321
|
: { pageSize };
|
|
322
|
+
if (options.folderKey !== undefined) {
|
|
323
|
+
paginationOptions.folderKey = options.folderKey;
|
|
324
|
+
}
|
|
273
325
|
|
|
274
326
|
const [getError, result] = await catchError(
|
|
275
327
|
sdk.entities.choicesets.getById(
|
|
@@ -363,6 +415,10 @@ export const registerChoiceSetsCommand = (program: Command) => {
|
|
|
363
415
|
)
|
|
364
416
|
.option("--display-name <name>", "New display name")
|
|
365
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
|
+
)
|
|
366
422
|
.examples(CHOICE_SETS_UPDATE_EXAMPLES)
|
|
367
423
|
.trackedAction(
|
|
368
424
|
processContext,
|
|
@@ -387,6 +443,9 @@ export const registerChoiceSetsCommand = (program: Command) => {
|
|
|
387
443
|
...(options.description !== undefined && {
|
|
388
444
|
description: options.description,
|
|
389
445
|
}),
|
|
446
|
+
...(options.folderKey !== undefined && {
|
|
447
|
+
folderKey: options.folderKey,
|
|
448
|
+
}),
|
|
390
449
|
};
|
|
391
450
|
|
|
392
451
|
const choiceSetService: ChoiceSetServiceModel =
|
|
@@ -417,17 +476,25 @@ export const registerChoiceSetsCommand = (program: Command) => {
|
|
|
417
476
|
.addOption(
|
|
418
477
|
createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>"),
|
|
419
478
|
)
|
|
420
|
-
.option("--
|
|
479
|
+
.option("-y, --yes", "Acknowledge this is an irreversible operation")
|
|
480
|
+
.addOption(
|
|
481
|
+
new Option("--confirm", "Deprecated alias for --yes").hideHelp(),
|
|
482
|
+
)
|
|
421
483
|
.option(
|
|
422
484
|
"--reason <reason>",
|
|
423
485
|
"Reason for the deletion — echoed back in the response so the caller can log it",
|
|
424
486
|
)
|
|
487
|
+
.option(
|
|
488
|
+
"--folder-key <key>",
|
|
489
|
+
"Folder key (GUID) of the folder containing the choice set (for folder-scoped choice sets)",
|
|
490
|
+
)
|
|
425
491
|
.examples(CHOICE_SETS_DELETE_EXAMPLES)
|
|
426
492
|
.trackedAction(
|
|
427
493
|
processContext,
|
|
428
494
|
async (choiceSetId: string, options: DeleteOptions) => {
|
|
429
495
|
const reason = requireDestructiveConfirmation(
|
|
430
496
|
options,
|
|
497
|
+
`delete choice set '${choiceSetId}'`,
|
|
431
498
|
'Pass --reason "<text>" to record why the choice set is being deleted.',
|
|
432
499
|
);
|
|
433
500
|
if (reason === null) return;
|
|
@@ -435,10 +502,21 @@ export const registerChoiceSetsCommand = (program: Command) => {
|
|
|
435
502
|
const sdk = await connectOrFail(options.tenant);
|
|
436
503
|
if (!sdk) return;
|
|
437
504
|
|
|
505
|
+
const deleteOpts: ChoiceSetDeleteByIdOptions = {
|
|
506
|
+
...(options.folderKey !== undefined && {
|
|
507
|
+
folderKey: options.folderKey,
|
|
508
|
+
}),
|
|
509
|
+
};
|
|
510
|
+
|
|
438
511
|
const choiceSetService: ChoiceSetServiceModel =
|
|
439
512
|
sdk.entities.choicesets;
|
|
440
513
|
const [deleteError] = await catchError(
|
|
441
|
-
choiceSetService.deleteById(
|
|
514
|
+
choiceSetService.deleteById(
|
|
515
|
+
choiceSetId,
|
|
516
|
+
Object.keys(deleteOpts).length > 0
|
|
517
|
+
? deleteOpts
|
|
518
|
+
: undefined,
|
|
519
|
+
),
|
|
442
520
|
);
|
|
443
521
|
|
|
444
522
|
if (deleteError) {
|
|
@@ -533,6 +611,10 @@ export const registerChoiceSetValuesCommand = (program: Command) => {
|
|
|
533
611
|
createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>"),
|
|
534
612
|
)
|
|
535
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
|
+
)
|
|
536
618
|
.examples(CHOICE_SET_VALUES_CREATE_EXAMPLES)
|
|
537
619
|
.trackedAction(
|
|
538
620
|
processContext,
|
|
@@ -548,6 +630,9 @@ export const registerChoiceSetValuesCommand = (program: Command) => {
|
|
|
548
630
|
...(options.displayName !== undefined && {
|
|
549
631
|
displayName: options.displayName,
|
|
550
632
|
}),
|
|
633
|
+
...(options.folderKey !== undefined && {
|
|
634
|
+
folderKey: options.folderKey,
|
|
635
|
+
}),
|
|
551
636
|
};
|
|
552
637
|
|
|
553
638
|
const choiceSetService: ChoiceSetServiceModel =
|
|
@@ -586,6 +671,10 @@ export const registerChoiceSetValuesCommand = (program: Command) => {
|
|
|
586
671
|
.addOption(
|
|
587
672
|
createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>"),
|
|
588
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
|
+
)
|
|
589
678
|
.examples(CHOICE_SET_VALUES_UPDATE_EXAMPLES)
|
|
590
679
|
.trackedAction(
|
|
591
680
|
processContext,
|
|
@@ -598,6 +687,12 @@ export const registerChoiceSetValuesCommand = (program: Command) => {
|
|
|
598
687
|
const sdk = await connectOrFail(options.tenant);
|
|
599
688
|
if (!sdk) return;
|
|
600
689
|
|
|
690
|
+
const updateOpts: ChoiceSetValueUpdateOptions = {
|
|
691
|
+
...(options.folderKey !== undefined && {
|
|
692
|
+
folderKey: options.folderKey,
|
|
693
|
+
}),
|
|
694
|
+
};
|
|
695
|
+
|
|
601
696
|
const choiceSetService: ChoiceSetServiceModel =
|
|
602
697
|
sdk.entities.choicesets;
|
|
603
698
|
const [updateError, result] = await catchError(
|
|
@@ -605,6 +700,9 @@ export const registerChoiceSetValuesCommand = (program: Command) => {
|
|
|
605
700
|
choiceSetId,
|
|
606
701
|
valueId,
|
|
607
702
|
displayName,
|
|
703
|
+
Object.keys(updateOpts).length > 0
|
|
704
|
+
? updateOpts
|
|
705
|
+
: undefined,
|
|
608
706
|
),
|
|
609
707
|
);
|
|
610
708
|
|
|
@@ -633,11 +731,18 @@ export const registerChoiceSetValuesCommand = (program: Command) => {
|
|
|
633
731
|
createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>"),
|
|
634
732
|
)
|
|
635
733
|
.option("--ids <ids>", "Comma-separated list of value IDs to delete")
|
|
636
|
-
.option("--
|
|
734
|
+
.option("-y, --yes", "Acknowledge this is an irreversible operation")
|
|
735
|
+
.addOption(
|
|
736
|
+
new Option("--confirm", "Deprecated alias for --yes").hideHelp(),
|
|
737
|
+
)
|
|
637
738
|
.option(
|
|
638
739
|
"--reason <reason>",
|
|
639
740
|
"Reason for the deletion — echoed back in the response so the caller can log it",
|
|
640
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
|
+
)
|
|
641
746
|
.examples(CHOICE_SET_VALUES_DELETE_EXAMPLES)
|
|
642
747
|
.trackedAction(
|
|
643
748
|
processContext,
|
|
@@ -656,6 +761,7 @@ export const registerChoiceSetValuesCommand = (program: Command) => {
|
|
|
656
761
|
|
|
657
762
|
const reason = requireDestructiveConfirmation(
|
|
658
763
|
options,
|
|
764
|
+
`delete ${valueIds.length} value(s) from choice set '${choiceSetId}'`,
|
|
659
765
|
'Pass --reason "<text>" to record why the values are being deleted.',
|
|
660
766
|
);
|
|
661
767
|
if (reason === null) return;
|
|
@@ -663,10 +769,22 @@ export const registerChoiceSetValuesCommand = (program: Command) => {
|
|
|
663
769
|
const sdk = await connectOrFail(options.tenant);
|
|
664
770
|
if (!sdk) return;
|
|
665
771
|
|
|
772
|
+
const deleteOpts: ChoiceSetValueDeleteOptions = {
|
|
773
|
+
...(options.folderKey !== undefined && {
|
|
774
|
+
folderKey: options.folderKey,
|
|
775
|
+
}),
|
|
776
|
+
};
|
|
777
|
+
|
|
666
778
|
const choiceSetService: ChoiceSetServiceModel =
|
|
667
779
|
sdk.entities.choicesets;
|
|
668
780
|
const [deleteError] = await catchError(
|
|
669
|
-
choiceSetService.deleteValuesById(
|
|
781
|
+
choiceSetService.deleteValuesById(
|
|
782
|
+
choiceSetId,
|
|
783
|
+
valueIds,
|
|
784
|
+
Object.keys(deleteOpts).length > 0
|
|
785
|
+
? deleteOpts
|
|
786
|
+
: undefined,
|
|
787
|
+
),
|
|
670
788
|
);
|
|
671
789
|
|
|
672
790
|
if (deleteError) {
|