Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions components/dart/actions/create-doc/create-doc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import dart from "../../dart.app.mjs";

export default {
key: "dart-create-doc",
name: "Create Doc",
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)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
type: "action",
props: {
dart,
title: {
propDefinition: [
dart,
"title",
],
},
folder: {
propDefinition: [
dart,
"folder",
],
},
text: {
propDefinition: [
dart,
"text",
],
},
},
async run({ $ }) {
const response = await this.dart.createDoc({
$,
data: {
item: {
title: this.title,
folder: this.folder,
text: this.text,
},
},
});

$.export("$summary", `New doc successfully created with ID: ${response.item.id}`);
return response;
},
};
2 changes: 1 addition & 1 deletion components/dart/actions/create-task/create-task.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "dart-create-task",
name: "Create Task",
description: "Creates a new task within a dartboard. [See the documentation](https://app.itsdart.com/api/v0/docs/)",
version: "0.0.2",
version: "0.0.3",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
32 changes: 32 additions & 0 deletions components/dart/actions/delete-doc/delete-doc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import dart from "../../dart.app.mjs";

export default {
key: "dart-delete-doc",
name: "Delete Doc",
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)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
type: "action",
props: {
dart,
docId: {
propDefinition: [
dart,
"docId",
],
},
},
async run({ $ }) {
const response = await this.dart.deleteDoc({
$,
docId: this.docId,
});

$.export("$summary", `Successfully deleted doc with ID: ${this.docId}`);
return response;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "dart-find-or-create-task",
name: "Find or Create Task",
description: "Checks for an existing task within a dartboard using the 'task-name'. If it doesn't exist, a new task is created. [See the documentation](https://app.itsdart.com/api/v0/docs/)",
version: "0.0.2",
version: "0.0.3",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
58 changes: 58 additions & 0 deletions components/dart/actions/update-doc/update-doc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import dart from "../../dart.app.mjs";

export default {
key: "dart-update-doc",
name: "Update Doc",
description: "Update certain properties of an existing doc. This will save the doc in Dart for later access, search, etc. Any properties that are not specified will not be changed. [See the documentation](https://app.dartai.com/api/v0/public/docs/#/Doc/updateDoc)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: false,
},
type: "action",
props: {
dart,
docId: {
propDefinition: [
dart,
"docId",
],
},
title: {
propDefinition: [
dart,
"title",
],
optional: true,
},
folder: {
propDefinition: [
dart,
"folder",
],
},
text: {
propDefinition: [
dart,
"text",
],
},
},
async run({ $ }) {
const response = await this.dart.updateDoc({
$,
data: {
item: {
id: this.docId,
title: this.title,
folder: this.folder,
text: this.text,
},
},
});

$.export("$summary", `Successfully updated doc with ID: ${this.docId}`);
return response;
},
};
2 changes: 1 addition & 1 deletion components/dart/actions/update-task/update-task.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "dart-update-task",
name: "Update Task",
description: "Updates an existing task within a dartboard. [See the documentation](https://app.itsdart.com/api/v0/docs/)",
version: "0.0.2",
version: "0.0.3",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
63 changes: 61 additions & 2 deletions components/dart/dart.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,25 @@ export default {
})) || [];
},
},
docId: {
type: "string",
label: "Doc ID",
description: "The ID of the doc",
async options({ page }) {
const { results } = await this.listDocs({
params: {
limit: constants.DEFAULT_LIMIT,
offset: page * constants.DEFAULT_LIMIT,
},
});
return results?.map(({
id: value, title: label,
}) => ({
value,
label,
})) || [];
},
},
Comment on lines +66 to +84
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify the field name inconsistency between docs and tasks.

The docId propDefinition uses the id field (line 78), while taskId uses the duid field (line 59). If this reflects actual API response differences, this is correct. However, please verify that the Dart API returns id for docs and duid for tasks to ensure this inconsistency is intentional.


🏁 Script executed:

#!/bin/bash
# Description: Verify the field names returned by the API for docs vs tasks

# Check API documentation or example responses
rg -nP --type=js -C5 'listDocs|listTasks' | rg -P '(id|duid).*:'

Length of output: 0


Let me search more directly for the implementations of these methods to understand the field naming:


---

🏁 Script executed:

```shell
#!/bin/bash
# Find listDocs and listTasks method definitions and see what fields they use/return

echo "=== Searching for listDocs implementation ==="
rg -nA20 'listDocs\s*\(' components/dart/dart.app.mjs | head -40

echo ""
echo "=== Searching for listTasks implementation ==="
rg -nA20 'listTasks\s*\(' components/dart/dart.app.mjs | head -40

echo ""
echo "=== Checking taskId destructuring (line 59 context) ==="
sed -n '47,65p' components/dart/dart.app.mjs

echo ""
echo "=== Checking docId destructuring (line 66-84 context) ==="
sed -n '66,84p' components/dart/dart.app.mjs

Length of output: 3211


Let me check if there's any API documentation or references in the codebase that confirm these field names:


---

🏁 Script executed:

```shell
#!/bin/bash
# Look for Dart API documentation, examples, or configuration that might explain the field names

echo "=== Searching for Dart API references/docs ==="
find . -type f \( -name "*.md" -o -name "*.json" -o -name "*config*" \) 2>/dev/null | head -20

echo ""
echo "=== Checking for comments about API structure ==="
rg -n 'duid|dartId' components/dart/ -B2 -A2

echo ""
echo "=== Checking README or docs in dart directory ==="
ls -la components/dart/ | grep -E '\.(md|txt|json)$'

Length of output: 9034


Correct the field name in docId propDefinition from id to duid.

The test data and source handlers confirm that both docs and tasks use the duid field in API responses. The docId propDefinition currently destructures id: value (line 78), but should destructure duid: value to match the actual API response and match the pattern used for taskId.

return results?.map(({
-  id: value, title: label,
+  duid: value, title: label,
}) => ({
  value,
  label,
})) || [];
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
docId: {
type: "string",
label: "Doc ID",
description: "The ID of the doc",
async options({ page }) {
const { results } = await this.listDocs({
params: {
limit: constants.DEFAULT_LIMIT,
offset: page * constants.DEFAULT_LIMIT,
},
});
return results?.map(({
id: value, title: label,
}) => ({
value,
label,
})) || [];
},
},
docId: {
type: "string",
label: "Doc ID",
description: "The ID of the doc",
async options({ page }) {
const { results } = await this.listDocs({
params: {
limit: constants.DEFAULT_LIMIT,
offset: page * constants.DEFAULT_LIMIT,
},
});
return results?.map(({
duid: value, title: label,
}) => ({
value,
label,
})) || [];
},
},
🤖 Prompt for AI Agents
In components/dart/dart.app.mjs around lines 66 to 84, the docId propDefinition
destructures the API response using id: value but the API returns duid; change
the destructuring to use duid: value (keeping title as label) so results map to
{ value, label } correctly; ensure the fallback to [] remains unchanged.

taskName: {
type: "string",
label: "Task Name",
Expand All @@ -87,10 +106,27 @@ export default {
optional: true,
options: constants.TASK_PRIORITIES,
},
title: {
type: "string",
label: "Title",
description: "The title, which is a short description of the doc",
},
folder: {
type: "string",
label: "Folder",
description: "The full title of the folder, which is a project or list of docs",
optional: true,
},
text: {
type: "string",
label: "Text",
description: "The full content of the doc, which can include markdown formatting",
optional: true,
},
},
methods: {
_baseUrl() {
return "https://app.itsdart.com/api/v0";
return "https://app.dartai.com/api/v0/public";
},
_makeRequest(opts = {}) {
const {
Expand All @@ -108,7 +144,7 @@ export default {
},
listDocs(opts = {}) {
return this._makeRequest({
path: "/docs",
path: "/docs/list",
...opts,
});
},
Expand Down Expand Up @@ -137,6 +173,29 @@ export default {
...opts,
});
},
createDoc(opts = {}) {
return this._makeRequest({
method: "POST",
path: "/docs",
...opts,
});
},
updateDoc(opts = {}) {
return this._makeRequest({
method: "PUT",
path: `/docs/${opts.data.item.id}`,
...opts,
});
},
deleteDoc({
docId, ...opts
}) {
return this._makeRequest({
method: "DELETE",
path: `/docs/${docId}`,
...opts,
});
},
async *paginate({
resourceFn, params, max,
}) {
Expand Down
4 changes: 2 additions & 2 deletions components/dart/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/dart",
"version": "0.1.0",
"version": "0.2.0",
"description": "Pipedream Dart Components",
"main": "dart.app.mjs",
"keywords": [
Expand All @@ -13,6 +13,6 @@
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.0"
"@pipedream/platform": "^3.1.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "dart-new-doc-created",
name: "New Document Created",
description: "Emit new event when a new document is created in Dart.",
version: "0.0.1",
version: "0.0.2",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "dart-new-doc-updated",
name: "New Document Updated",
description: "Emit new event when any document is updated.",
version: "0.0.1",
version: "0.0.2",
dedupe: "unique",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "dart-new-task-created",
name: "New Task Created",
description: "Emit new event when a task is created.",
version: "0.0.1",
version: "0.0.2",
type: "source",
dedupe: "unique",
methods: {
Expand Down
Loading
Loading