@uipath/data-fabric-tool 1.206.0-preview.303 → 1.207.0-preview.305

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.
@@ -0,0 +1,173 @@
1
+ import {
2
+ RESULTS,
3
+ OutputFormatter,
4
+ validateChoiceValueName,
5
+ validateChoiceValueDisplayName
6
+ } from "./packager-tool-skeew4e3.js";
7
+ import {
8
+ catchError
9
+ } from "./packager-tool-0whbpj17.js";
10
+ import"./packager-tool-zwqkr7z9.js";
11
+ import"./packager-tool-34pcyhns.js";
12
+ import {
13
+ InlineChoiceSetError,
14
+ inlineChoiceSetCreateAsync,
15
+ inlineChoiceSetListAsync,
16
+ inlineChoiceSetGetAsync,
17
+ inlineChoiceSetDeleteAsync,
18
+ inlineChoiceSetValueAddAsync,
19
+ inlineChoiceSetValuesRemoveAsync
20
+ } from "./packager-tool-kt0mxbv8.js";
21
+ import {
22
+ failInvalidArgument,
23
+ failWithCode,
24
+ refusalErrorCode,
25
+ requireDestructiveConfirmation
26
+ } from "./packager-tool-yxv0qfms.js";
27
+
28
+ // src/utils/choice-set-messages.ts
29
+ var CHOICE_SET_VALUE_DELETE_WARNING = "A choice set that is already deployed keeps a deleted value: an upgrade adds values by name and removes none. To remove it there too, delete it on the tenant: 'uip df choice-set-values delete <choice-set-id> --ids <value-id> --folder-key <folder-key>'.";
30
+
31
+ // src/local/choice-sets-inline.ts
32
+ function failFromService(error) {
33
+ if (error instanceof InlineChoiceSetError) {
34
+ failWithCode(error.message, error.instructions, refusalErrorCode(error.code), error.code);
35
+ return;
36
+ }
37
+ throw error;
38
+ }
39
+ var LOCAL_AUTHORING_AVAILABLE = true;
40
+ async function runLocalChoiceSetCreate(name, options) {
41
+ const [error, created] = await catchError(inlineChoiceSetCreateAsync(name, {
42
+ ...options.displayName !== undefined && {
43
+ displayName: options.displayName
44
+ },
45
+ ...options.description !== undefined && {
46
+ description: options.description
47
+ }
48
+ }));
49
+ if (error)
50
+ return failFromService(error);
51
+ OutputFormatter.success({
52
+ Result: RESULTS.Success,
53
+ Code: "InlineChoiceSetCreated",
54
+ Data: {
55
+ Name: created?.name,
56
+ DisplayName: created?.displayName,
57
+ ResourceFile: created?.resourceFile
58
+ }
59
+ });
60
+ }
61
+ async function runLocalChoiceSetList() {
62
+ const [error, sets] = await catchError(inlineChoiceSetListAsync());
63
+ if (error)
64
+ return failFromService(error);
65
+ OutputFormatter.success({
66
+ Result: RESULTS.Success,
67
+ Code: "InlineChoiceSetList",
68
+ Data: (sets ?? []).map((set) => ({
69
+ Name: set.name,
70
+ DisplayName: set.displayName,
71
+ ValueCount: set.values.length,
72
+ ResourceFile: set.resourceFile,
73
+ ...set.problem !== undefined && { Problem: set.problem }
74
+ }))
75
+ });
76
+ }
77
+ async function runLocalChoiceSetValues(name) {
78
+ const [error, set] = await catchError(inlineChoiceSetGetAsync(name));
79
+ if (error)
80
+ return failFromService(error);
81
+ OutputFormatter.success({
82
+ Result: RESULTS.Success,
83
+ Code: "InlineChoiceSetValues",
84
+ Data: {
85
+ Name: set?.name,
86
+ ResourceFile: set?.resourceFile,
87
+ Values: set?.values.map((value) => ({
88
+ Name: value.name,
89
+ DisplayName: value.displayName,
90
+ ...value.numberId !== undefined && {
91
+ NumberId: value.numberId
92
+ }
93
+ }))
94
+ }
95
+ });
96
+ }
97
+ async function runLocalChoiceSetDelete(name, options) {
98
+ const confirmed = requireDestructiveConfirmation({ ...options, reason: "local" }, `delete the choice set '${name}' from the solution on disk`, "Pass --yes to confirm. The choice set's resource file is removed.");
99
+ if (confirmed === null)
100
+ return;
101
+ const [error, removed] = await catchError(inlineChoiceSetDeleteAsync(name));
102
+ if (error)
103
+ return failFromService(error);
104
+ OutputFormatter.success({
105
+ Result: RESULTS.Success,
106
+ Code: "InlineChoiceSetDeleted",
107
+ Data: { Name: removed?.name, ResourceFile: removed?.resourceFile }
108
+ });
109
+ }
110
+ async function runLocalValueCreate(choiceSet, name, options) {
111
+ const nameErr = validateChoiceValueName(name);
112
+ if (nameErr) {
113
+ return failInvalidArgument(nameErr.message, nameErr.instructions);
114
+ }
115
+ if (options.displayName !== undefined) {
116
+ const displayErr = validateChoiceValueDisplayName(options.displayName);
117
+ if (displayErr) {
118
+ return failInvalidArgument(displayErr.message, displayErr.instructions);
119
+ }
120
+ }
121
+ const [error, updated] = await catchError(inlineChoiceSetValueAddAsync(choiceSet, {
122
+ name,
123
+ ...options.displayName !== undefined && {
124
+ displayName: options.displayName
125
+ }
126
+ }));
127
+ if (error)
128
+ return failFromService(error);
129
+ const added = updated?.values.find((value) => value.name.toLowerCase() === name.toLowerCase());
130
+ OutputFormatter.success({
131
+ Result: RESULTS.Success,
132
+ Code: "InlineChoiceSetValueCreated",
133
+ Data: {
134
+ ChoiceSet: updated?.name,
135
+ Name: added?.name,
136
+ DisplayName: added?.displayName,
137
+ ResourceFile: updated?.resourceFile
138
+ }
139
+ });
140
+ }
141
+ async function runLocalValuesDelete(choiceSet, options) {
142
+ const names = (options.names ?? []).flatMap((entry) => entry.split(",")).map((entry) => entry.trim()).filter((entry) => entry.length > 0);
143
+ if (names.length === 0) {
144
+ return failInvalidArgument("No value names provided", "Pass --names <name> [name...] (or a comma-separated list) with at least one value name to delete.");
145
+ }
146
+ const confirmed = requireDestructiveConfirmation({ ...options, reason: "local" }, `delete ${names.length} value(s) from the choice set '${choiceSet}' on disk`, "Pass --yes to confirm. The values are removed from the choice set's resource file.");
147
+ if (confirmed === null)
148
+ return;
149
+ const [error, updated] = await catchError(inlineChoiceSetValuesRemoveAsync(choiceSet, names));
150
+ if (error)
151
+ return failFromService(error);
152
+ OutputFormatter.success({
153
+ Result: RESULTS.Success,
154
+ Code: "InlineChoiceSetValuesDeleted",
155
+ Warning: CHOICE_SET_VALUE_DELETE_WARNING,
156
+ Data: {
157
+ ChoiceSet: updated?.name,
158
+ DeletedNames: names,
159
+ ResourceFile: updated?.resourceFile
160
+ }
161
+ });
162
+ }
163
+ export {
164
+ LOCAL_AUTHORING_AVAILABLE,
165
+ runLocalChoiceSetCreate,
166
+ runLocalChoiceSetDelete,
167
+ runLocalChoiceSetList,
168
+ runLocalChoiceSetValues,
169
+ runLocalValueCreate,
170
+ runLocalValuesDelete
171
+ };
172
+
173
+ //# debugId=AD42325848661E3664756E2164756E21