diff --git a/components/configcat/configcat.app.mjs b/components/configcat/configcat.app.mjs index ddfa3c08253b0..c2bdde50cc859 100644 --- a/components/configcat/configcat.app.mjs +++ b/components/configcat/configcat.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/dart/actions/create-doc/create-doc.mjs b/components/dart/actions/create-doc/create-doc.mjs new file mode 100644 index 0000000000000..1d76af456e1d2 --- /dev/null +++ b/components/dart/actions/create-doc/create-doc.mjs @@ -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; + }, +}; diff --git a/components/dart/actions/create-task/create-task.mjs b/components/dart/actions/create-task/create-task.mjs index 7a80232be6ea1..4183eea3300bc 100644 --- a/components/dart/actions/create-task/create-task.mjs +++ b/components/dart/actions/create-task/create-task.mjs @@ -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.4", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/dart/actions/delete-doc/delete-doc.mjs b/components/dart/actions/delete-doc/delete-doc.mjs new file mode 100644 index 0000000000000..0731ad8bc0b7c --- /dev/null +++ b/components/dart/actions/delete-doc/delete-doc.mjs @@ -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; + }, +}; diff --git a/components/dart/actions/find-or-create-task/find-or-create-task.mjs b/components/dart/actions/find-or-create-task/find-or-create-task.mjs index d0fd9591561b1..eb73a52ad33d7 100644 --- a/components/dart/actions/find-or-create-task/find-or-create-task.mjs +++ b/components/dart/actions/find-or-create-task/find-or-create-task.mjs @@ -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.4", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/dart/actions/update-doc/update-doc.mjs b/components/dart/actions/update-doc/update-doc.mjs new file mode 100644 index 0000000000000..bd0cdb9a808ab --- /dev/null +++ b/components/dart/actions/update-doc/update-doc.mjs @@ -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; + }, +}; diff --git a/components/dart/actions/update-task/update-task.mjs b/components/dart/actions/update-task/update-task.mjs index 166ca6cad5f98..00eafd854f9b1 100644 --- a/components/dart/actions/update-task/update-task.mjs +++ b/components/dart/actions/update-task/update-task.mjs @@ -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.4", annotations: { destructiveHint: true, openWorldHint: true, diff --git a/components/dart/dart.app.mjs b/components/dart/dart.app.mjs index 29a16be4fcddc..c1f5eee7fe8d9 100644 --- a/components/dart/dart.app.mjs +++ b/components/dart/dart.app.mjs @@ -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", @@ -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"; }, _makeRequest(opts = {}) { const { @@ -133,7 +169,30 @@ export default { createTransaction(opts = {}) { return this._makeRequest({ method: "POST", - path: "/transactions/create", + path: "/public/transactions/create", + ...opts, + }); + }, + createDoc(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/public/docs", + ...opts, + }); + }, + updateDoc(opts = {}) { + return this._makeRequest({ + method: "PUT", + path: `/public/docs/${opts.data.item.id}`, + ...opts, + }); + }, + deleteDoc({ + docId, ...opts + }) { + return this._makeRequest({ + method: "DELETE", + path: `/public/docs/${docId}`, ...opts, }); }, diff --git a/components/dart/package.json b/components/dart/package.json index b02d530bfb443..70909549cef60 100644 --- a/components/dart/package.json +++ b/components/dart/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/dart", - "version": "0.1.0", + "version": "0.2.0", "description": "Pipedream Dart Components", "main": "dart.app.mjs", "keywords": [ @@ -13,6 +13,6 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^3.0.0" + "@pipedream/platform": "^3.1.0" } } diff --git a/components/dart/sources/new-doc-created/new-doc-created.mjs b/components/dart/sources/new-doc-created/new-doc-created.mjs index bcacba8bf790d..d8bd7575d0ba4 100644 --- a/components/dart/sources/new-doc-created/new-doc-created.mjs +++ b/components/dart/sources/new-doc-created/new-doc-created.mjs @@ -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.3", type: "source", dedupe: "unique", methods: { diff --git a/components/dart/sources/new-doc-updated/new-doc-updated.mjs b/components/dart/sources/new-doc-updated/new-doc-updated.mjs index 2dc323e68d576..c7c0a670c5068 100644 --- a/components/dart/sources/new-doc-updated/new-doc-updated.mjs +++ b/components/dart/sources/new-doc-updated/new-doc-updated.mjs @@ -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.3", dedupe: "unique", methods: { ...common.methods, diff --git a/components/dart/sources/new-task-created/new-task-created.mjs b/components/dart/sources/new-task-created/new-task-created.mjs index 16341d15be391..2ed8de6d4f89d 100644 --- a/components/dart/sources/new-task-created/new-task-created.mjs +++ b/components/dart/sources/new-task-created/new-task-created.mjs @@ -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.3", type: "source", dedupe: "unique", methods: { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e5556454fe422..acfaff969ca3f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3311,8 +3311,7 @@ importers: specifier: ^1.5.1 version: 1.6.6 - components/copicake: - specifiers: {} + components/copicake: {} components/copper: dependencies: @@ -3590,8 +3589,8 @@ importers: components/dart: dependencies: '@pipedream/platform': - specifier: ^3.0.0 - version: 3.0.3 + specifier: ^3.1.0 + version: 3.1.0 components/darwinbox: {} @@ -14807,8 +14806,7 @@ importers: specifier: ^0.1.4 version: 0.1.6 - components/topdesk: - specifiers: {} + components/topdesk: {} components/topmessage: dependencies: