From 594fd1ab8e988bf6ae36b48945d2ecea40929878 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Tue, 8 Oct 2024 10:24:04 -0400 Subject: [PATCH 1/4] wip --- .../attio/actions/create-note/create-note.mjs | 57 +++++++ .../create-update-record.mjs | 34 +++++ .../delete-list-entry/delete-list-entry.mjs | 36 +++++ components/attio/attio.app.mjs | 141 +++++++++++++++++- components/attio/package.json | 7 +- components/attio/sources/common/base.mjs | 0 .../new-list-entry-instant.mjs | 0 .../new-record-created-instant.mjs | 0 .../record-updated-instant.mjs | 0 9 files changed, 269 insertions(+), 6 deletions(-) create mode 100644 components/attio/actions/create-note/create-note.mjs create mode 100644 components/attio/actions/create-update-record/create-update-record.mjs create mode 100644 components/attio/actions/delete-list-entry/delete-list-entry.mjs create mode 100644 components/attio/sources/common/base.mjs create mode 100644 components/attio/sources/new-list-entry-instant/new-list-entry-instant.mjs create mode 100644 components/attio/sources/new-record-created-instant/new-record-created-instant.mjs create mode 100644 components/attio/sources/record-updated-instant/record-updated-instant.mjs diff --git a/components/attio/actions/create-note/create-note.mjs b/components/attio/actions/create-note/create-note.mjs new file mode 100644 index 0000000000000..1d03f993ec082 --- /dev/null +++ b/components/attio/actions/create-note/create-note.mjs @@ -0,0 +1,57 @@ +import attio from "../../attio.app.mjs"; + +export default { + key: "attio-create-note", + name: "Create Note", + description: "Creates a new note for a given record. The note will be linked to the specified record. [See the documentation](https://developers.attio.com/reference/post_v2-notes)", + version: "0.0.{{ts}}", + type: "action", + props: { + attio, + parentObject: { + propDefinition: [ + attio, + "objectId", + ], + label: "Parent Object ID", + description: "The ID of the parent object the note belongs to", + }, + parentRecordId: { + propDefinition: [ + attio, + "recordId", + (c) => ({ + objectId: c.parentObject, + }), + ], + label: "Parent Record ID", + description: "The ID of the parent record the note belongs to", + }, + title: { + type: "string", + label: "Title", + description: "The note title", + }, + content: { + type: "string", + label: "Content", + description: "The content of the note", + }, + }, + async run({ $ }) { + const response = await this.attio.createNote({ + $, + data: { + data: { + parent_object: this.parentObject, + parent_record_id: this.parentRecordId, + title: this.title, + format: "plaintext", + content: this.content, + }, + }, + }); + $.export("$summary", `Successfully created note with ID: ${response.data.id.note_id}`); + return response; + }, +}; diff --git a/components/attio/actions/create-update-record/create-update-record.mjs b/components/attio/actions/create-update-record/create-update-record.mjs new file mode 100644 index 0000000000000..c3d1c3cc8295b --- /dev/null +++ b/components/attio/actions/create-update-record/create-update-record.mjs @@ -0,0 +1,34 @@ +import attio from "../../attio.app.mjs"; + +export default { + key: "attio-create-update-record", + name: "Create or Update Record", + description: "Creates or updates a specific record such as a person or a deal. If the record already exists, it's updated. Otherwise, a new record is created. [See the documentation](https://developers.attio.com/reference/put_v2-objects-object-records)", + version: "0.0.{{ts}}", + type: "action", + props: { + attio, + objectId: { + propDefinition: [ + attio, + "objectId", + ], + }, + parentRecordId: { + propDefinition: [ + attio, + "recordId", + (c) => ({ + objectId: c.objectId, + }), + ], + }, + }, + async run({ $ }) { + const response = await this.upsertRecord({ + $, + data: {}, + }); + return response; + }, +}; diff --git a/components/attio/actions/delete-list-entry/delete-list-entry.mjs b/components/attio/actions/delete-list-entry/delete-list-entry.mjs new file mode 100644 index 0000000000000..e7578e43f1731 --- /dev/null +++ b/components/attio/actions/delete-list-entry/delete-list-entry.mjs @@ -0,0 +1,36 @@ +import attio from "../../attio.app.mjs"; + +export default { + key: "attio-delete-list-entry", + name: "Delete List Entry", + description: "Deletes an existing entry from a specific list. [See the documentation](https://developers.attio.com/reference/delete_v2-lists-list-entries-entry-id)", + version: "0.0.{{ts}}", + type: "action", + props: { + attio, + listId: { + propDefinition: [ + attio, + "listId", + ], + }, + entryId: { + propDefinition: [ + attio, + "entryId", + (c) => ({ + listId: c.listId, + }), + ], + }, + }, + async run({ $ }) { + const response = await this.attio.deleteListEntry({ + $, + listId: this.listId, + entryId: this.entryId, + }); + $.export("$summary", `Successfully deleted list entry with ID: ${this.entryId}`); + return response; + }, +}; diff --git a/components/attio/attio.app.mjs b/components/attio/attio.app.mjs index 9e44e58cffbb5..488ecac8ef45c 100644 --- a/components/attio/attio.app.mjs +++ b/components/attio/attio.app.mjs @@ -1,11 +1,144 @@ +import { axios } from "@pipedream/platform"; +const DEFAULT_LIMIT = 20; + export default { type: "app", app: "attio", - propDefinitions: {}, + propDefinitions: { + listId: { + type: "string", + label: "List ID", + description: "The identifier of a list", + async options() { + const { data } = await this.listLists(); + return data?.map(({ + id, name: label, + }) => ({ + value: id.list_id, + label, + })) || []; + }, + }, + entryId: { + type: "string", + label: "Entry ID", + description: "The identifier of a list entry", + async options({ + listId, page, + }) { + const { data } = await this.listEntries({ + listId, + params: { + limit: DEFAULT_LIMIT, + offset: page * DEFAULT_LIMIT, + }, + }); + return data?.map(({ id }) => id.entry_id) || []; + }, + }, + objectId: { + type: "string", + label: "Object ID", + description: "The identifier of an object", + async options() { + const { data } = await this.listObjects(); + return data?.map(({ + id, singular_noun: label, + }) => ({ + value: id.object_id, + label, + })) || []; + }, + }, + recordId: { + type: "string", + label: "Record ID", + description: "Identifier of a record", + async options({ + objectId, page, + }) { + const { data } = await this.listRecords({ + objectId, + params: { + limit: DEFAULT_LIMIT, + offset: page * DEFAULT_LIMIT, + }, + }); + return data?.map(({ id }) => id.record_id) || []; + }, + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return "https://api.attio.com/v2"; + }, + _makeRequest({ + $ = this, + path, + ...opts + }) { + return axios($, { + url: `${this._baseUrl()}${path}`, + headers: { + Authorization: `Bearer ${this.$auth.oauth_access_token}`, + }, + ...opts, + }); + }, + listLists(opts = {}) { + return this._makeRequest({ + path: "/lists", + ...opts, + }); + }, + listEntries({ + listId, ...opts + }) { + return this._makeRequest({ + method: "POST", + path: `/lists/${listId}/entries/query`, + ...opts, + }); + }, + listObjects(opts = {}) { + return this._makeRequest({ + path: "/objects", + ...opts, + }); + }, + listRecords({ + objectId, ...opts + }) { + return this._makeRequest({ + method: "POST", + path: `/objects/${objectId}/records/query`, + ...opts, + }); + }, + createNote(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/notes", + ...opts, + }); + }, + upsertRecord({ + objectType, ...opts + }) { + return this._makeRequest({ + method: "PUT", + path: `/objects/${objectType}/records`, + ...opts, + }); + }, + deleteListEntry({ + listId, entryId, ...opts + }) { + return this._makeRequest({ + method: "DELETE", + path: `/lists/${listId}/entries/${entryId}`, + ...opts, + }); }, }, }; diff --git a/components/attio/package.json b/components/attio/package.json index fa5ed6c80166f..247666fdb730f 100644 --- a/components/attio/package.json +++ b/components/attio/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/attio", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream Attio Components", "main": "attio.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.3" } -} \ No newline at end of file +} diff --git a/components/attio/sources/common/base.mjs b/components/attio/sources/common/base.mjs new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/components/attio/sources/new-list-entry-instant/new-list-entry-instant.mjs b/components/attio/sources/new-list-entry-instant/new-list-entry-instant.mjs new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/components/attio/sources/new-record-created-instant/new-record-created-instant.mjs b/components/attio/sources/new-record-created-instant/new-record-created-instant.mjs new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/components/attio/sources/record-updated-instant/record-updated-instant.mjs b/components/attio/sources/record-updated-instant/record-updated-instant.mjs new file mode 100644 index 0000000000000..e69de29bb2d1d From b2257032756ccde78a6dcb2c280aa420dd2c8dae Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Tue, 8 Oct 2024 15:56:36 -0400 Subject: [PATCH 2/4] new components --- .../attio/actions/create-note/create-note.mjs | 2 +- .../create-update-record.mjs | 60 ++++++++++++++++-- .../delete-list-entry/delete-list-entry.mjs | 2 +- components/attio/attio.app.mjs | 52 +++++++++++++++- components/attio/common/utils.mjs | 62 +++++++++++++++++++ components/attio/sources/common/base.mjs | 62 +++++++++++++++++++ .../new-list-entry-instant.mjs | 46 ++++++++++++++ .../new-list-entry-instant/test-event.mjs | 14 +++++ .../new-record-created-instant.mjs | 46 ++++++++++++++ .../new-record-created-instant/test-event.mjs | 12 ++++ .../record-updated-instant.mjs | 47 ++++++++++++++ .../record-updated-instant/test-event.mjs | 13 ++++ 12 files changed, 409 insertions(+), 9 deletions(-) create mode 100644 components/attio/common/utils.mjs create mode 100644 components/attio/sources/new-list-entry-instant/test-event.mjs create mode 100644 components/attio/sources/new-record-created-instant/test-event.mjs create mode 100644 components/attio/sources/record-updated-instant/test-event.mjs diff --git a/components/attio/actions/create-note/create-note.mjs b/components/attio/actions/create-note/create-note.mjs index 1d03f993ec082..6811657df129e 100644 --- a/components/attio/actions/create-note/create-note.mjs +++ b/components/attio/actions/create-note/create-note.mjs @@ -4,7 +4,7 @@ export default { key: "attio-create-note", name: "Create Note", description: "Creates a new note for a given record. The note will be linked to the specified record. [See the documentation](https://developers.attio.com/reference/post_v2-notes)", - version: "0.0.{{ts}}", + version: "0.0.1", type: "action", props: { attio, diff --git a/components/attio/actions/create-update-record/create-update-record.mjs b/components/attio/actions/create-update-record/create-update-record.mjs index c3d1c3cc8295b..648a2c8b96c87 100644 --- a/components/attio/actions/create-update-record/create-update-record.mjs +++ b/components/attio/actions/create-update-record/create-update-record.mjs @@ -1,10 +1,11 @@ import attio from "../../attio.app.mjs"; +import utils from "../../common/utils.mjs"; export default { key: "attio-create-update-record", name: "Create or Update Record", description: "Creates or updates a specific record such as a person or a deal. If the record already exists, it's updated. Otherwise, a new record is created. [See the documentation](https://developers.attio.com/reference/put_v2-objects-object-records)", - version: "0.0.{{ts}}", + version: "0.0.1", type: "action", props: { attio, @@ -14,21 +15,70 @@ export default { "objectId", ], }, - parentRecordId: { + attributeId: { propDefinition: [ attio, - "recordId", + "attributeId", (c) => ({ objectId: c.objectId, }), ], + reloadProps: true, + }, + }, + async additionalProps() { + const props = {}; + if (!this.attributeId) { + return props; + } + const attributes = await this.getRelevantAttributes(); + for (const attribute of attributes) { + props[attribute.id.attribute_id] = { + type: attribute.is_multiselect + ? "string[]" + : "string", + label: attribute.title, + optional: attribute.id.attribute_id !== this.attributeId && !attribute.is_required, + }; + } + return props; + }, + methods: { + async getRelevantAttributes() { + const stream = utils.paginate({ + fn: this.attio.listAttributes, + args: { + objectId: this.objectId, + }, + }); + const attributes = await utils.streamIterator(stream); + return attributes.filter((a) => a.is_writable || a.id.attribute_id === this.attributeId); }, }, async run({ $ }) { - const response = await this.upsertRecord({ + const { + attio, + getRelevantAttributes, + objectId, + attributeId, + ...values + } = this; + + const attributes = await getRelevantAttributes(); + + const response = await attio.upsertRecord({ $, - data: {}, + objectId, + params: { + matching_attribute: attributeId, + }, + data: { + data: { + values: utils.parseValues(attributes, values), + }, + }, }); + $.export("$summary", "Successfully created or updated record"); return response; }, }; diff --git a/components/attio/actions/delete-list-entry/delete-list-entry.mjs b/components/attio/actions/delete-list-entry/delete-list-entry.mjs index e7578e43f1731..5c866be65fade 100644 --- a/components/attio/actions/delete-list-entry/delete-list-entry.mjs +++ b/components/attio/actions/delete-list-entry/delete-list-entry.mjs @@ -4,7 +4,7 @@ export default { key: "attio-delete-list-entry", name: "Delete List Entry", description: "Deletes an existing entry from a specific list. [See the documentation](https://developers.attio.com/reference/delete_v2-lists-list-entries-entry-id)", - version: "0.0.{{ts}}", + version: "0.0.1", type: "action", props: { attio, diff --git a/components/attio/attio.app.mjs b/components/attio/attio.app.mjs index 488ecac8ef45c..ecd1af069dacc 100644 --- a/components/attio/attio.app.mjs +++ b/components/attio/attio.app.mjs @@ -67,6 +67,30 @@ export default { return data?.map(({ id }) => id.record_id) || []; }, }, + attributeId: { + type: "string", + label: "Attribute ID", + description: "The ID or slug of the attribute to use to check if a record already exists. The attribute must be unique.", + async options({ + objectId, page, + }) { + const { data } = await this.listAttributes({ + objectId, + params: { + limit: DEFAULT_LIMIT, + offset: page * DEFAULT_LIMIT, + }, + }); + return data + ?.filter((attribute) => attribute.is_unique) + ?.map(({ + id, title: label, + }) => ({ + value: id.attribute_id, + label, + })) || []; + }, + }, }, methods: { _baseUrl() { @@ -85,6 +109,22 @@ export default { ...opts, }); }, + createWebhook(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/webhooks", + ...opts, + }); + }, + deleteWebhook({ + hookId, ...opts + }) { + return this._makeRequest({ + method: "DELETE", + path: `/webhooks/${hookId}`, + ...opts, + }); + }, listLists(opts = {}) { return this._makeRequest({ path: "/lists", @@ -115,6 +155,14 @@ export default { ...opts, }); }, + listAttributes({ + objectId, ...opts + }) { + return this._makeRequest({ + path: `/objects/${objectId}/attributes`, + ...opts, + }); + }, createNote(opts = {}) { return this._makeRequest({ method: "POST", @@ -123,11 +171,11 @@ export default { }); }, upsertRecord({ - objectType, ...opts + objectId, ...opts }) { return this._makeRequest({ method: "PUT", - path: `/objects/${objectType}/records`, + path: `/objects/${objectId}/records`, ...opts, }); }, diff --git a/components/attio/common/utils.mjs b/components/attio/common/utils.mjs new file mode 100644 index 0000000000000..2c45758d9ca43 --- /dev/null +++ b/components/attio/common/utils.mjs @@ -0,0 +1,62 @@ +async function streamIterator(stream) { + let resources = []; + for await (const resource of stream) { + resources.push(resource); + } + return resources; +} + +async function *paginate({ + fn, + args, + max, +}) { + args = { + ...args, + params: { + ...args.params, + limit: 500, + offset: 0, + }, + }; + let total, count = 0; + do { + const { data } = await fn(args); + for (const item of data) { + yield item; + if (max && ++count >= max) { + return; + } + } + total = data?.length; + args.params.offset += args.params.limit; + } while (total === args.params.limit); +} + +function parseValues(attributes, values) { console.log(attributes); + for (const [ + key, + value, + ] of Object.entries(values)) { + const { + type, is_multiselect: isMultiselect, + } = attributes.find(({ id }) => id.attribute_id === key); + if (type === "checkbox") { + values[key] = isMultiselect + ? value.map((v) => !(v === "false" || v === "0")) + : !(value === "false" || value === "0"); + } + if (type === "number" || type === "rating") { + values[key] = isMultiselect + ? value.map((v) => +v) + : +value; + } + } + return values; +} + +export default { + streamIterator, + paginate, + parseValues, +}; diff --git a/components/attio/sources/common/base.mjs b/components/attio/sources/common/base.mjs index e69de29bb2d1d..967d7b8428bce 100644 --- a/components/attio/sources/common/base.mjs +++ b/components/attio/sources/common/base.mjs @@ -0,0 +1,62 @@ +import attio from "../../attio.app.mjs"; + +export default { + props: { + attio, + db: "$.service.db", + http: "$.interface.http", + }, + hooks: { + async activate() { + const { data: { id: { webhook_id: hookId } } } = await this.attio.createWebhook({ + data: { + data: { + target_url: this.http.endpoint, + subscriptions: [ + { + event_type: this.getEventType(), + filter: this.getFilter(), + }, + ], + }, + }, + }); + this._setHookId(hookId); + }, + async deactivate() { + const hookId = this._getHookId(); + if (hookId) { + await this.attio.deleteWebhook({ + hookId, + }); + } + }, + }, + methods: { + _getHookId() { + return this.db.get("hookId"); + }, + _setHookId(hookId) { + this.db.set("hookId", hookId); + }, + getFilter() { + return null; + }, + getEventType() { + throw new Error("getEventType is not implemented"); + }, + generateMeta() { + throw new Error("generateMeta is not implemented"); + }, + }, + async run(event) { + const { body: { events } } = event; + if (!events?.length) { + return; + } + events.forEach((item) => { + const meta = this.generateMeta(item); + this.$emit(item, meta); + }); + }, +}; diff --git a/components/attio/sources/new-list-entry-instant/new-list-entry-instant.mjs b/components/attio/sources/new-list-entry-instant/new-list-entry-instant.mjs index e69de29bb2d1d..a4b010871ebf5 100644 --- a/components/attio/sources/new-list-entry-instant/new-list-entry-instant.mjs +++ b/components/attio/sources/new-list-entry-instant/new-list-entry-instant.mjs @@ -0,0 +1,46 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event"; + +export default { + ...common, + key: "attio-new-list-entry-instant", + name: "New List Entry (Instant)", + description: "Emit new event when a record, such as person, company, or deal, is added to a list", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + listId: { + propDefinition: [ + common.props.attio, + "listId", + ], + }, + }, + methods: { + ...common.methods, + getEventType() { + return "list-entry.created"; + }, + getFilter() { + return { + "$and": [ + { + field: "id.list_id", + operator: "equals", + value: this.listId, + }, + ], + }; + }, + generateMeta(entry) { + return { + id: entry.id.entry_id, + summary: `New Entry with ID: ${entry.id.entry_id}`, + ts: Date.now(), + }; + }, + }, + sampleEmit, +}; diff --git a/components/attio/sources/new-list-entry-instant/test-event.mjs b/components/attio/sources/new-list-entry-instant/test-event.mjs new file mode 100644 index 0000000000000..8a57ba4e4f789 --- /dev/null +++ b/components/attio/sources/new-list-entry-instant/test-event.mjs @@ -0,0 +1,14 @@ +export default { + "event_type": "list-entry.created", + "id": { + "workspace_id": "14beef7a-99f7-4534-a87e-70b564330a4c", + "list_id": "33ebdbe9-e529-47c9-b894-0ba25e9c15c0", + "entry_id": "2e6e29ea-c4e0-4f44-842d-78a891f8c156" + }, + "parent_object_id": "97052eb9-e65e-443f-a297-f2d9a4a7f795", + "parent_record_id": "bf071e1f-6035-429d-b874-d83ea64ea13b", + "actor": { + "type": "workspace-member", + "id": "50cf242c-7fa3-4cad-87d0-75b1af71c57b" + } +} \ No newline at end of file diff --git a/components/attio/sources/new-record-created-instant/new-record-created-instant.mjs b/components/attio/sources/new-record-created-instant/new-record-created-instant.mjs index e69de29bb2d1d..9e374d218e0c4 100644 --- a/components/attio/sources/new-record-created-instant/new-record-created-instant.mjs +++ b/components/attio/sources/new-record-created-instant/new-record-created-instant.mjs @@ -0,0 +1,46 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "attio-new-record-created-instant", + name: "New Record Created (Instant)", + description: "Emit new event when new record, such as person, company or deal gets created", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + objectId: { + propDefinition: [ + common.props.attio, + "objectId", + ], + }, + }, + methods: { + ...common.methods, + getEventType() { + return "record.created"; + }, + getFilter() { + return { + "$and": [ + { + field: "id.object_id", + operator: "equals", + value: this.objectId, + }, + ], + }; + }, + generateMeta(record) { + return { + id: record.id.record_id, + summary: `New Record with ID: ${record.id.record_id}`, + ts: Date.now(), + }; + }, + }, + sampleEmit, +}; diff --git a/components/attio/sources/new-record-created-instant/test-event.mjs b/components/attio/sources/new-record-created-instant/test-event.mjs new file mode 100644 index 0000000000000..14e2dac6d638d --- /dev/null +++ b/components/attio/sources/new-record-created-instant/test-event.mjs @@ -0,0 +1,12 @@ +export default { + "event_type": "record.created", + "id": { + "workspace_id": "14beef7a-99f7-4534-a87e-70b564330a4c", + "object_id": "97052eb9-e65e-443f-a297-f2d9a4a7f795", + "record_id": "bf071e1f-6035-429d-b874-d83ea64ea13b" + }, + "actor": { + "type": "workspace-member", + "id": "50cf242c-7fa3-4cad-87d0-75b1af71c57b" + } +} \ No newline at end of file diff --git a/components/attio/sources/record-updated-instant/record-updated-instant.mjs b/components/attio/sources/record-updated-instant/record-updated-instant.mjs index e69de29bb2d1d..e94b7b17efce7 100644 --- a/components/attio/sources/record-updated-instant/record-updated-instant.mjs +++ b/components/attio/sources/record-updated-instant/record-updated-instant.mjs @@ -0,0 +1,47 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "attio-record-updated-instant", + name: "Record Updated (Instant)", + description: "Emit new event when values on a record, such as person, company or deal, are updated", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + objectId: { + propDefinition: [ + common.props.attio, + "objectId", + ], + }, + }, + methods: { + ...common.methods, + getEventType() { + return "record.updated"; + }, + getFilter() { + return { + "$and": [ + { + field: "id.object_id", + operator: "equals", + value: this.objectId, + }, + ], + }; + }, + generateMeta(record) { + const ts = Date.now(); + return { + id: `${record.id.record_id}-${ts}`, + summary: `New Record with ID: ${record.id.record_id}`, + ts, + }; + }, + }, + sampleEmit, +}; diff --git a/components/attio/sources/record-updated-instant/test-event.mjs b/components/attio/sources/record-updated-instant/test-event.mjs new file mode 100644 index 0000000000000..ec4bff3c11864 --- /dev/null +++ b/components/attio/sources/record-updated-instant/test-event.mjs @@ -0,0 +1,13 @@ +export default { + "event_type": "record.updated", + "id": { + "workspace_id": "14beef7a-99f7-4534-a87e-70b564330a4c", + "object_id": "97052eb9-e65e-443f-a297-f2d9a4a7f795", + "record_id": "bf071e1f-6035-429d-b874-d83ea64ea13b", + "attribute_id": "41252299-f8c7-4b5e-99c9-4ff8321d2f96" + }, + "actor": { + "type": "workspace-member", + "id": "50cf242c-7fa3-4cad-87d0-75b1af71c57b" + } +} \ No newline at end of file From 42a483b2c374788194d9d442664604c9a1cc95a2 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Tue, 8 Oct 2024 15:58:32 -0400 Subject: [PATCH 3/4] pnpm-lock.yaml --- pnpm-lock.yaml | 107 +++++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 52 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 863b9b55b7643..dc3821f07c149 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -781,7 +781,10 @@ importers: '@pipedream/platform': 1.6.0 components/attio: - specifiers: {} + specifiers: + '@pipedream/platform': ^3.0.3 + dependencies: + '@pipedream/platform': 3.0.3 components/autobound: specifiers: {} @@ -12912,55 +12915,6 @@ packages: - aws-crt dev: false - /@aws-sdk/client-sso-oidc/3.600.0_tdq3komn4zwyd65w7klbptsu34: - resolution: {integrity: sha512-7+I8RWURGfzvChyNQSyj5/tKrqRbzRl7H+BnTOf/4Vsw1nFOi5ROhlhD4X/Y0QCTacxnaoNcIrqnY7uGGvVRzw==} - engines: {node: '>=16.0.0'} - dependencies: - '@aws-crypto/sha256-browser': 5.2.0 - '@aws-crypto/sha256-js': 5.2.0 - '@aws-sdk/client-sts': 3.600.0 - '@aws-sdk/core': 3.598.0 - '@aws-sdk/credential-provider-node': 3.600.0_f7n47caigsrjd2lr2szmwfuee4 - '@aws-sdk/middleware-host-header': 3.598.0 - '@aws-sdk/middleware-logger': 3.598.0 - '@aws-sdk/middleware-recursion-detection': 3.598.0 - '@aws-sdk/middleware-user-agent': 3.598.0 - '@aws-sdk/region-config-resolver': 3.598.0 - '@aws-sdk/types': 3.598.0 - '@aws-sdk/util-endpoints': 3.598.0 - '@aws-sdk/util-user-agent-browser': 3.598.0 - '@aws-sdk/util-user-agent-node': 3.598.0 - '@smithy/config-resolver': 3.0.3 - '@smithy/core': 2.2.3 - '@smithy/fetch-http-handler': 3.2.1 - '@smithy/hash-node': 3.0.2 - '@smithy/invalid-dependency': 3.0.2 - '@smithy/middleware-content-length': 3.0.2 - '@smithy/middleware-endpoint': 3.0.4 - '@smithy/middleware-retry': 3.0.6 - '@smithy/middleware-serde': 3.0.3 - '@smithy/middleware-stack': 3.0.3 - '@smithy/node-config-provider': 3.1.3 - '@smithy/node-http-handler': 3.1.2 - '@smithy/protocol-http': 4.0.3 - '@smithy/smithy-client': 3.1.6 - '@smithy/types': 3.3.0 - '@smithy/url-parser': 3.0.3 - '@smithy/util-base64': 3.0.0 - '@smithy/util-body-length-browser': 3.0.0 - '@smithy/util-body-length-node': 3.0.0 - '@smithy/util-defaults-mode-browser': 3.0.6 - '@smithy/util-defaults-mode-node': 3.0.6 - '@smithy/util-endpoints': 2.0.3 - '@smithy/util-middleware': 3.0.3 - '@smithy/util-retry': 3.0.2 - '@smithy/util-utf8': 3.0.0 - tslib: 2.6.3 - transitivePeerDependencies: - - '@aws-sdk/client-sts' - - aws-crt - dev: false - /@aws-sdk/client-sso/3.423.0: resolution: {integrity: sha512-znIufHkwhCIePgaYciIs3x/+BpzR57CZzbCKHR9+oOvGyufEPPpUT5bFLvbwTgfiVkTjuk6sG/ES3U5Bc+xtrA==} engines: {node: '>=14.0.0'} @@ -13196,7 +13150,7 @@ packages: dependencies: '@aws-crypto/sha256-browser': 5.2.0 '@aws-crypto/sha256-js': 5.2.0 - '@aws-sdk/client-sso-oidc': 3.600.0_tdq3komn4zwyd65w7klbptsu34 + '@aws-sdk/client-sso-oidc': 3.600.0 '@aws-sdk/core': 3.598.0 '@aws-sdk/credential-provider-node': 3.600.0_f7n47caigsrjd2lr2szmwfuee4 '@aws-sdk/middleware-host-header': 3.598.0 @@ -13238,6 +13192,55 @@ packages: - aws-crt dev: false + /@aws-sdk/client-sts/3.600.0_dseaa2p5u2yk67qiepewcq3hkq: + resolution: {integrity: sha512-KQG97B7LvTtTiGmjlrG1LRAY8wUvCQzrmZVV5bjrJ/1oXAU7DITYwVbSJeX9NWg6hDuSk0VE3MFwIXS2SvfLIA==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-crypto/sha256-browser': 5.2.0 + '@aws-crypto/sha256-js': 5.2.0 + '@aws-sdk/client-sso-oidc': 3.600.0 + '@aws-sdk/core': 3.598.0 + '@aws-sdk/credential-provider-node': 3.600.0_f7n47caigsrjd2lr2szmwfuee4 + '@aws-sdk/middleware-host-header': 3.598.0 + '@aws-sdk/middleware-logger': 3.598.0 + '@aws-sdk/middleware-recursion-detection': 3.598.0 + '@aws-sdk/middleware-user-agent': 3.598.0 + '@aws-sdk/region-config-resolver': 3.598.0 + '@aws-sdk/types': 3.598.0 + '@aws-sdk/util-endpoints': 3.598.0 + '@aws-sdk/util-user-agent-browser': 3.598.0 + '@aws-sdk/util-user-agent-node': 3.598.0 + '@smithy/config-resolver': 3.0.3 + '@smithy/core': 2.2.3 + '@smithy/fetch-http-handler': 3.2.1 + '@smithy/hash-node': 3.0.2 + '@smithy/invalid-dependency': 3.0.2 + '@smithy/middleware-content-length': 3.0.2 + '@smithy/middleware-endpoint': 3.0.4 + '@smithy/middleware-retry': 3.0.6 + '@smithy/middleware-serde': 3.0.3 + '@smithy/middleware-stack': 3.0.3 + '@smithy/node-config-provider': 3.1.3 + '@smithy/node-http-handler': 3.1.2 + '@smithy/protocol-http': 4.0.3 + '@smithy/smithy-client': 3.1.6 + '@smithy/types': 3.3.0 + '@smithy/url-parser': 3.0.3 + '@smithy/util-base64': 3.0.0 + '@smithy/util-body-length-browser': 3.0.0 + '@smithy/util-body-length-node': 3.0.0 + '@smithy/util-defaults-mode-browser': 3.0.6 + '@smithy/util-defaults-mode-node': 3.0.6 + '@smithy/util-endpoints': 2.0.3 + '@smithy/util-middleware': 3.0.3 + '@smithy/util-retry': 3.0.2 + '@smithy/util-utf8': 3.0.0 + tslib: 2.6.3 + transitivePeerDependencies: + - '@aws-sdk/client-sso-oidc' + - aws-crt + dev: false + /@aws-sdk/core/3.556.0: resolution: {integrity: sha512-vJaSaHw2kPQlo11j/Rzuz0gk1tEaKdz+2ser0f0qZ5vwFlANjt08m/frU17ctnVKC1s58bxpctO/1P894fHLrA==} engines: {node: '>=14.0.0'} @@ -17564,7 +17567,7 @@ packages: '@aws-sdk/client-sns': 3.423.0 '@aws-sdk/client-sqs': 3.423.0 '@aws-sdk/client-ssm': 3.423.0 - '@aws-sdk/client-sts': 3.600.0 + '@aws-sdk/client-sts': 3.600.0_dseaa2p5u2yk67qiepewcq3hkq '@aws-sdk/s3-request-presigner': 3.609.0 '@pipedream/helper_functions': 0.3.12 '@pipedream/platform': 1.6.6 From 46eb22aaeb252606f9ff106c7b61f67e5fb58f8b Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Tue, 8 Oct 2024 16:17:22 -0400 Subject: [PATCH 4/4] updates --- components/attio/common/utils.mjs | 4 ++-- .../sources/new-list-entry-instant/new-list-entry-instant.mjs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/attio/common/utils.mjs b/components/attio/common/utils.mjs index 2c45758d9ca43..240f1978403cd 100644 --- a/components/attio/common/utils.mjs +++ b/components/attio/common/utils.mjs @@ -14,7 +14,7 @@ async function *paginate({ args = { ...args, params: { - ...args.params, + ...args.params ?? {}, limit: 500, offset: 0, }, @@ -33,7 +33,7 @@ async function *paginate({ } while (total === args.params.limit); } -function parseValues(attributes, values) { console.log(attributes); +function parseValues(attributes, values) { for (const [ key, value, diff --git a/components/attio/sources/new-list-entry-instant/new-list-entry-instant.mjs b/components/attio/sources/new-list-entry-instant/new-list-entry-instant.mjs index a4b010871ebf5..ebb0c2409497d 100644 --- a/components/attio/sources/new-list-entry-instant/new-list-entry-instant.mjs +++ b/components/attio/sources/new-list-entry-instant/new-list-entry-instant.mjs @@ -1,5 +1,5 @@ import common from "../common/base.mjs"; -import sampleEmit from "./test-event"; +import sampleEmit from "./test-event.mjs"; export default { ...common,