@uipath/tasks-tool 1.202.0-preview.140 → 1.202.0-preview.142

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 (41) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/{tool-4er8cbf1.js → tool-315h4wtj.js} +5 -2
  3. package/dist/tool.js +1 -1
  4. package/package.json +5 -2
  5. package/browser.json +0 -4
  6. package/src/commands/_shared/catalog-options.spec.ts +0 -114
  7. package/src/commands/_shared/catalog-options.ts +0 -122
  8. package/src/commands/_shared/connect.spec.ts +0 -52
  9. package/src/commands/_shared/connect.ts +0 -31
  10. package/src/commands/_shared/constants.ts +0 -1
  11. package/src/commands/_shared/folder-picker-interactive.spec.ts +0 -92
  12. package/src/commands/_shared/folder-picker-interactive.ts +0 -76
  13. package/src/commands/_shared/folder-picker.spec.ts +0 -159
  14. package/src/commands/_shared/folder-picker.ts +0 -113
  15. package/src/commands/_shared/folder-resolver.spec.ts +0 -152
  16. package/src/commands/_shared/folder-resolver.ts +0 -113
  17. package/src/commands/_shared/parse.spec.ts +0 -69
  18. package/src/commands/_shared/parse.ts +0 -43
  19. package/src/commands/catalogs.ts +0 -281
  20. package/src/commands/comments.ts +0 -160
  21. package/src/commands/data.ts +0 -137
  22. package/src/commands/labels.ts +0 -93
  23. package/src/commands/metadata.ts +0 -139
  24. package/src/commands/tasks.spec.ts +0 -2449
  25. package/src/commands/tasks.ts +0 -631
  26. package/src/index.ts +0 -12
  27. package/src/tool.ts +0 -24
  28. package/src/utils/sdk-client.ts +0 -30
  29. package/tests/assign.e2e.test.ts +0 -166
  30. package/tests/assignable-users.e2e.test.ts +0 -167
  31. package/tests/catalogs.e2e.test.ts +0 -418
  32. package/tests/comments.e2e.test.ts +0 -223
  33. package/tests/complete.e2e.test.ts +0 -207
  34. package/tests/data.e2e.test.ts +0 -187
  35. package/tests/get.e2e.test.ts +0 -103
  36. package/tests/labels.e2e.test.ts +0 -184
  37. package/tests/list.e2e.test.ts +0 -234
  38. package/tests/metadata.e2e.test.ts +0 -186
  39. package/tests/performance.e2e.test.ts +0 -32
  40. package/tsconfig.json +0 -9
  41. package/vitest.config.ts +0 -1
@@ -1,139 +0,0 @@
1
- import {
2
- catchError,
3
- extractErrorMessage,
4
- OutputFormatter,
5
- processContext,
6
- RESULTS,
7
- } from "@uipath/common";
8
- import type { TaskEditMetadataOptions } from "@uipath/uipath-typescript";
9
- import { TaskPriority } from "@uipath/uipath-typescript";
10
- import type { Command } from "commander";
11
-
12
- import { connectTasksClient } from "./_shared/connect";
13
- import {
14
- addFolderScopeOptions,
15
- type FolderScopeOptions,
16
- resolveFolderId,
17
- } from "./_shared/folder-picker";
18
- import { parseIntArg } from "./_shared/parse";
19
-
20
- interface MetadataOptions extends FolderScopeOptions {
21
- title?: string;
22
- priority?: string;
23
- catalogId?: string;
24
- unsetCatalog?: boolean;
25
- note?: string;
26
- }
27
-
28
- export const registerMetadataCommand = (program: Command) => {
29
- addFolderScopeOptions(
30
- program
31
- .command("metadata")
32
- .description("Edit a task's metadata")
33
- .argument("<task-id>", "Task ID"),
34
- )
35
- .option("--title <title>", "New title")
36
- .option(
37
- "--priority <priority>",
38
- "New priority (Low, Medium, High, Critical)",
39
- )
40
- .option("--catalog-id <id>", "Associate a task catalog by ID")
41
- .option("--unset-catalog", "Remove the task's catalog association")
42
- .option("--note <text>", "Comment recorded with the edit")
43
- .trackedAction(
44
- processContext,
45
- async (taskId: string, options: MetadataOptions) => {
46
- const sdk = await connectTasksClient();
47
- if (!sdk) return;
48
-
49
- const parsedTaskId = parseIntArg(taskId, "<task-id>");
50
- if (parsedTaskId === null) return;
51
-
52
- if (options.catalogId && options.unsetCatalog) {
53
- OutputFormatter.error({
54
- Result: RESULTS.Failure,
55
- Message:
56
- "--catalog-id and --unset-catalog cannot be used together",
57
- Instructions:
58
- "Pass --catalog-id to associate a catalog, or --unset-catalog to clear it, not both.",
59
- });
60
- processContext.exit(1);
61
- return;
62
- }
63
-
64
- const hasEdit =
65
- options.title !== undefined ||
66
- options.priority !== undefined ||
67
- options.catalogId !== undefined ||
68
- options.unsetCatalog === true ||
69
- options.note !== undefined;
70
- if (!hasEdit) {
71
- OutputFormatter.error({
72
- Result: RESULTS.Failure,
73
- Message: "No metadata changes provided",
74
- Instructions:
75
- "Pass at least one of --title, --priority, --catalog-id, --unset-catalog, or --note.",
76
- });
77
- processContext.exit(1);
78
- return;
79
- }
80
-
81
- const folderId = await resolveFolderId(options);
82
- if (folderId === null) return;
83
-
84
- const editOptions: TaskEditMetadataOptions = { folderId };
85
- if (options.title !== undefined) {
86
- editOptions.title = options.title;
87
- }
88
- if (options.priority !== undefined) {
89
- if (
90
- !Object.values(TaskPriority).includes(
91
- options.priority as TaskPriority,
92
- )
93
- ) {
94
- OutputFormatter.error({
95
- Result: RESULTS.Failure,
96
- Message: `Invalid priority '${options.priority}'`,
97
- Instructions: `Valid priorities: ${Object.values(TaskPriority).join(", ")}`,
98
- });
99
- processContext.exit(1);
100
- return;
101
- }
102
- editOptions.priority = options.priority as TaskPriority;
103
- }
104
- if (options.catalogId !== undefined) {
105
- const parsedCatalogId = parseIntArg(
106
- options.catalogId,
107
- "--catalog-id",
108
- );
109
- if (parsedCatalogId === null) return;
110
- editOptions.taskCatalogId = parsedCatalogId;
111
- }
112
- if (options.unsetCatalog) {
113
- editOptions.unlinkTaskCatalog = true;
114
- }
115
- if (options.note !== undefined) {
116
- editOptions.noteText = options.note;
117
- }
118
-
119
- const [editError] = await catchError(
120
- sdk.tasks.editMetadata(parsedTaskId, editOptions),
121
- );
122
- if (editError) {
123
- OutputFormatter.error({
124
- Result: RESULTS.Failure,
125
- Message: `Error editing metadata on task '${taskId}'`,
126
- Instructions: await extractErrorMessage(editError),
127
- });
128
- processContext.exit(1);
129
- return;
130
- }
131
-
132
- OutputFormatter.success({
133
- Result: RESULTS.Success,
134
- Code: "TaskMetadataEdited",
135
- Data: { taskId: parsedTaskId },
136
- });
137
- },
138
- );
139
- };