Skip to content

Commit ca39807

Browse files
13401 components dart (#18813)
* Implement CRUD operations for documents in Dart, including create, update, and delete functionalities. Add new properties for document management and update package version to 0.2.0. Enhance existing actions for task management with version updates. * pnpm update * Update API paths in Dart component and increment version numbers for task actions and document sources * Refactor Dart component to enhance task management features - Renamed and updated prop definitions for better clarity, including changing `dartboardId` to `dartboard`. - Introduced new optional properties: `tags`, `priority`, `size`, `status`, `type`, and `customProperties` to support enhanced task attributes. - Updated task creation and update methods to reflect new property structure and improved API paths. - Added utility function `parseObject` for better handling of input data formats. - Incremented version numbers for task-related actions to reflect changes. * Update components/dart/actions/create-task/create-task.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update components/dart/actions/find-or-create-task/find-or-create-task.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 7f79f75 commit ca39807

File tree

14 files changed

+597
-161
lines changed

14 files changed

+597
-161
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import dart from "../../dart.app.mjs";
2+
3+
export default {
4+
key: "dart-create-doc",
5+
name: "Create Doc",
6+
description: "Record a new doc that the user intends to write down. This will save the doc in Dart for later access, search, etc. By default the created doc will be in the Docs folder. More information can be included in the text. [See the documentation](https://app.dartai.com/api/v0/public/docs/#/Doc/createDoc)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: false,
12+
},
13+
type: "action",
14+
props: {
15+
dart,
16+
title: {
17+
propDefinition: [
18+
dart,
19+
"title",
20+
],
21+
},
22+
folder: {
23+
propDefinition: [
24+
dart,
25+
"folder",
26+
],
27+
},
28+
text: {
29+
propDefinition: [
30+
dart,
31+
"text",
32+
],
33+
},
34+
},
35+
async run({ $ }) {
36+
const response = await this.dart.createDoc({
37+
$,
38+
data: {
39+
item: {
40+
title: this.title,
41+
folder: this.folder,
42+
text: this.text,
43+
},
44+
},
45+
});
46+
47+
$.export("$summary", `New doc successfully created with ID: ${response.item.id}`);
48+
return response;
49+
},
50+
};
Lines changed: 91 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import { parseObject } from "../../common/utils.mjs";
12
import dart from "../../dart.app.mjs";
23

34
export default {
45
key: "dart-create-task",
56
name: "Create Task",
6-
description: "Creates a new task within a dartboard. [See the documentation](https://app.itsdart.com/api/v0/docs/)",
7-
version: "0.0.2",
7+
description: "Creates a new task within a dartboard. [See the documentation](https://app.dartai.com/api/v0/public/docs/#/Task/createTask)",
8+
version: "1.0.0",
89
annotations: {
910
destructiveHint: false,
1011
openWorldHint: true,
@@ -13,77 +14,128 @@ export default {
1314
type: "action",
1415
props: {
1516
dart,
16-
dartboardId: {
17+
title: {
1718
propDefinition: [
1819
dart,
19-
"dartboardId",
20+
"title",
2021
],
2122
},
22-
duid: {
23-
type: "string",
24-
label: "Task DUID",
25-
description: "A unique identifier for the task. Must contain at least 12 characters.",
23+
parentId: {
24+
propDefinition: [
25+
dart,
26+
"taskId",
27+
],
28+
label: "Parent Task ID",
29+
description: "The universal, unique ID of the parent task. These tasks have a parent-child relationship where the current task is the child and this task ID corresponds to the parent. Subtasks inherit context from their parent and are typically smaller units of work",
2630
},
27-
title: {
31+
dartboard: {
2832
propDefinition: [
2933
dart,
30-
"taskName",
34+
"dartboard",
3135
],
36+
label: "Dartboard",
37+
description: "The full title of the dartboard, which is a project or list of tasks",
3238
},
33-
description: {
39+
type: {
3440
propDefinition: [
3541
dart,
36-
"taskDescription",
42+
"type",
3743
],
3844
},
39-
dueAt: {
45+
status: {
4046
propDefinition: [
4147
dart,
42-
"dueAt",
48+
"status",
49+
],
50+
label: "Status",
51+
description: "The status from the list of available statuses",
52+
},
53+
description: {
54+
type: "string",
55+
label: "Description",
56+
description: "A longer description of the task, which can include markdown formatting",
57+
},
58+
assignees: {
59+
propDefinition: [
60+
dart,
61+
"assigneeIds",
4362
],
63+
label: "Assignees",
64+
description: "The names or emails of the users that the task is assigned to. Either this or assignee must be included, depending on whether the workspaces allows multiple assignees or not",
4465
},
45-
assigneeIds: {
66+
assignee: {
4667
propDefinition: [
4768
dart,
4869
"assigneeIds",
4970
],
71+
type: "string",
72+
label: "Assignee",
73+
description: "The name or email of the user that the task is assigned to. Either this or assignees must be included, depending on whether the workspaces allows multiple assignees or not",
74+
},
75+
tags: {
76+
propDefinition: [
77+
dart,
78+
"tags",
79+
],
80+
label: "Tags",
81+
description: "Any tags that should be applied to the task, which can be used to filter and search for tasks. Tags are also known as labels or components and are strings that can be anything, but should be short and descriptive",
5082
},
5183
priority: {
5284
propDefinition: [
5385
dart,
5486
"priority",
5587
],
88+
label: "Priority",
89+
description: "The priority, which is a string that can be one of the specified options. This is used to sort tasks and determine which tasks should be done first",
90+
},
91+
startAt: {
92+
propDefinition: [
93+
dart,
94+
"startAt",
95+
],
96+
},
97+
dueAt: {
98+
propDefinition: [
99+
dart,
100+
"dueAt",
101+
],
102+
},
103+
size: {
104+
propDefinition: [
105+
dart,
106+
"size",
107+
],
108+
},
109+
customProperties: {
110+
propDefinition: [
111+
dart,
112+
"customProperties",
113+
],
56114
},
57115
},
58116
async run({ $ }) {
59-
const response = await this.dart.createTransaction({
117+
const { item: response } = await this.dart.createTask({
60118
$,
61119
data: {
62-
clientDuid: this.duid,
63-
items: [
64-
{
65-
duid: this.duid,
66-
operations: [
67-
{
68-
model: "task",
69-
kind: "create",
70-
data: {
71-
duid: this.duid,
72-
dartboardDuid: this.dartboardId,
73-
title: this.title,
74-
description: this.description,
75-
dueAt: this.dueAt,
76-
assigneeDuids: this.assigneeIds,
77-
priority: this.priority,
78-
},
79-
},
80-
],
81-
kind: "task_create",
82-
},
83-
],
120+
item: {
121+
title: this.title,
122+
parentId: this.parentId,
123+
dartboard: this.dartboard,
124+
type: this.type,
125+
status: this.status,
126+
description: this.description,
127+
assignees: parseObject(this.assignees),
128+
assignee: this.assignee,
129+
tags: parseObject(this.tags),
130+
priority: this.priority,
131+
startAt: this.startAt,
132+
dueAt: this.dueAt,
133+
size: this.size,
134+
customProperties: parseObject(this.customProperties),
135+
},
84136
},
85137
});
86-
$.export("$summary", `Created task "${this.title}"`);
138+
$.export("$summary", `Successfully created task with ID: ${response.id}`);
87139
return response;
88140
},
89141
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import dart from "../../dart.app.mjs";
2+
3+
export default {
4+
key: "dart-delete-doc",
5+
name: "Delete Doc",
6+
description: "Move an existing doc to the trash, where it can be recovered if needed. Nothing else about the doc will be changed. [See the documentation](https://app.dartai.com/api/v0/public/docs/#/Doc/deleteDoc)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: false,
12+
},
13+
type: "action",
14+
props: {
15+
dart,
16+
docId: {
17+
propDefinition: [
18+
dart,
19+
"docId",
20+
],
21+
},
22+
},
23+
async run({ $ }) {
24+
const response = await this.dart.deleteDoc({
25+
$,
26+
docId: this.docId,
27+
});
28+
29+
$.export("$summary", `Successfully deleted doc with ID: ${this.docId}`);
30+
return response;
31+
},
32+
};

0 commit comments

Comments
 (0)