Skip to content
Merged
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,
})) || [];
},
},
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