From fc001dd7502e4c48e8971cc0f0027675da9b366a Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 13 Nov 2024 18:15:48 -0300 Subject: [PATCH 01/18] Description/prop updates --- .../airtable_oauth/actions/common/common.mjs | 5 +++++ .../actions/list-records/list-records.mjs | 4 ++-- .../airtable_oauth/airtable_oauth.app.mjs | 18 +++++++++--------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/components/airtable_oauth/actions/common/common.mjs b/components/airtable_oauth/actions/common/common.mjs index 706036784002f..d1feef0608286 100644 --- a/components/airtable_oauth/actions/common/common.mjs +++ b/components/airtable_oauth/actions/common/common.mjs @@ -10,6 +10,11 @@ export default { ], withLabel: true, }, + warningAlert: { + type: "alert", + alertType: "warning", + content: "**Note:** if using a custom expression to specify the `Base` (e.g. `{{steps.mydata.$return_value}}`) you should also use a custom expression for the `Table`, and any other props that depend on it.", + }, tableId: { propDefinition: [ airtable, diff --git a/components/airtable_oauth/actions/list-records/list-records.mjs b/components/airtable_oauth/actions/list-records/list-records.mjs index 31be61fb83e5c..0148d02542fbf 100644 --- a/components/airtable_oauth/actions/list-records/list-records.mjs +++ b/components/airtable_oauth/actions/list-records/list-records.mjs @@ -4,9 +4,9 @@ import commonList from "../common/common-list.mjs"; export default { key: "airtable_oauth-list-records", name: "List Records", - description: "Retrieve records from a table with automatic pagination. Optionally sort and filter results.", + description: "Retrieve records from a table, optionally sorting and filtering results. [See the documentation](https://airtable.com/developers/web/api/list-records)", type: "action", - version: "0.0.6", + version: "0.1.0", ...commonList, props: { ...common.props, diff --git a/components/airtable_oauth/airtable_oauth.app.mjs b/components/airtable_oauth/airtable_oauth.app.mjs index 0121f7915944a..27a28cf8fa273 100644 --- a/components/airtable_oauth/airtable_oauth.app.mjs +++ b/components/airtable_oauth/airtable_oauth.app.mjs @@ -18,7 +18,7 @@ export default { baseId: { type: "string", label: "Base", - description: "The base ID", + description: "The Base ID.", async options({ prevContext }) { const params = {}; if (prevContext?.newOffset) { @@ -44,7 +44,7 @@ export default { tableId: { type: "string", label: "Table", - description: "The table ID. If referencing a **Base** dynamically using data from another step (e.g., `{{steps.trigger.event.metadata.baseId}}`), you will not be able to select from the list of Tables, and automatic table options will not work when configuring this step. Please enter a custom expression to specify the **Table**.", + description: "The Table ID.", async options({ baseId }) { let tables; try { @@ -63,7 +63,7 @@ export default { viewId: { type: "string", label: "View", - description: "The view ID. If referencing a **Table** dynamically using data from another step (e.g., `{{steps.trigger.event.metadata.tableId}}`), you will not be able to select from the list of Views for this step. Please enter a custom expression to specify the **View**.", + description: "The View ID.", async options({ baseId, tableId, }) { @@ -85,8 +85,8 @@ export default { }, sortFieldId: { type: "string", - label: "Sort: Field", - description: "Optionally select a field to sort results. To sort by multiple fields, use the **Filter by Forumla** field. If referencing a **Table** dynamically using data from another step (e.g., `{{steps.mydata.$return_value}}`), automatic field options won't work when configuring this step. Please enter a custom expression to specify the **Sort: Field**.", + label: "Sort by Field", + description: "Optionally select a field to sort results by. To sort by multiple fields, use the **Filter by Formula** field.", optional: true, async options({ baseId, tableId, @@ -181,13 +181,13 @@ export default { returnFieldsByFieldId: { type: "boolean", label: "Return Fields By Field ID", - description: "An optional boolean value that lets you return field objects where the key is the field id. This defaults to `false`, which returns field objects where the key is the field name.", + description: "If set to `true`, the returned field objects will have the field ID as the key, instead of the field name (default behavior).", optional: true, }, sortDirection: { type: "string", label: "Sort: Direction", - description: "This field will be ignored if you don't select a field to sort by.", + description: "If sorting by a field, which direction to sort by.", options: SORT_DIRECTION_OPTIONS, default: "desc", optional: true, @@ -195,13 +195,13 @@ export default { maxRecords: { type: "integer", label: "Max Records", - description: "Optionally limit the maximum number of records to return. Leave blank to retrieve all records.", + description: "The maximum number of records to return. Leave blank to retrieve all records.", optional: true, }, filterByFormula: { type: "string", label: "Filter by Formula", - description: "Optionally provide a [formula](https://support.airtable.com/hc/en-us/articles/203255215-Formula-Field-Reference) used to filter records. The formula will be evaluated for each record, and if the result is not `0`, `false`, `\"\"`, `NaN`, `[]`, or `#Error!` the record will be included in the response. For example, to only include records where `Name` isn't empty, pass `NOT({Name} = '')`.", + description: "Optionally provide a [formula (see the documentation)](https://support.airtable.com/hc/en-us/articles/203255215-Formula-Field-Reference) used to filter records. The formula will be evaluated for each record, and if the result is not `0`, `false`, `\"\"`, `NaN`, `[]`, or `#Error!` the record will be included in the response. For example, to only include records where `Name` isn't empty, use `NOT({Name} = '')`.", optional: true, }, records: { From 8b4532083bb060f7fca078577038557160e235ea Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 13 Nov 2024 19:18:01 -0300 Subject: [PATCH 02/18] Improvements --- .../create-single-record/create-single-record.mjs | 3 +-- components/airtable_oauth/airtable_oauth.app.mjs | 15 +++++++++++---- components/airtable_oauth/common/actions.mjs | 1 + 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/components/airtable_oauth/actions/create-single-record/create-single-record.mjs b/components/airtable_oauth/actions/create-single-record/create-single-record.mjs index 13630c1438881..8dfe34f6a7aea 100644 --- a/components/airtable_oauth/actions/create-single-record/create-single-record.mjs +++ b/components/airtable_oauth/actions/create-single-record/create-single-record.mjs @@ -5,12 +5,11 @@ import common from "../common/common.mjs"; export default { key: "airtable_oauth-create-single-record", name: "Create Single Record", - description: "Adds a record to a table.", + description: "Adds a record to a table. [See the documentation](https://airtable.com/developers/web/api/create-records)", version: "0.0.7", type: "action", props: { ...common.props, - // eslint-disable-next-line pipedream/props-label,pipedream/props-description tableId: { ...common.props.tableId, reloadProps: true, diff --git a/components/airtable_oauth/airtable_oauth.app.mjs b/components/airtable_oauth/airtable_oauth.app.mjs index 27a28cf8fa273..c18352a3c6001 100644 --- a/components/airtable_oauth/airtable_oauth.app.mjs +++ b/components/airtable_oauth/airtable_oauth.app.mjs @@ -180,8 +180,8 @@ export default { }, returnFieldsByFieldId: { type: "boolean", - label: "Return Fields By Field ID", - description: "If set to `true`, the returned field objects will have the field ID as the key, instead of the field name (default behavior).", + label: "Return Fields By ID", + description: "If set to `true`, the returned field objects will have the field ID as the key, instead of the field name.", optional: true, }, sortDirection: { @@ -212,13 +212,20 @@ export default { typecast: { type: "boolean", label: "Typecast", - description: "The Airtable API will perform best-effort automatic data conversion from string values if the typecast parameter is `True`. Automatic conversion is disabled by default to ensure data integrity, but it may be helpful for integrating with 3rd party data sources.", + description: "The Airtable API will perform best-effort automatic data conversion from string values if the typecast parameter is `True`. This is disabled by default to ensure data integrity, but it may be helpful for integrating with 3rd party data sources.", optional: true, }, record: { type: "object", label: "Record", - description: "Enter the column name for the key and the corresponding column value. You can include all, some, or none of the field values. You may also pass a JSON object as a custom expression with key/value pairs representing columns and values (e.g., `{{ {\"foo\":\"bar\",\"id\":123} }}`). A common pattern is to reference an object exported by a previous step (e.g., `{{steps.foo.$return_value}}`).", + description: "Enter the column name for the key and the corresponding column value. You can include all, some, or none of the field values. You may also use a custom expression.", + }, + customExpressionInfo: { + type: "alert", + alertType: "info", + content: `A custom expression can be a JSON object with key/value pairs representing columns and values, e.g. \`{{ { "foo": "bar", "id": 123 } }}\`. +\\\\ +You can also reference an object exported by a previous step, e.g. \`{{steps.foo.$return_value}}\`.`, }, }, methods: { diff --git a/components/airtable_oauth/common/actions.mjs b/components/airtable_oauth/common/actions.mjs index 4680b3adcab87..cac8ad905e6f6 100644 --- a/components/airtable_oauth/common/actions.mjs +++ b/components/airtable_oauth/common/actions.mjs @@ -23,6 +23,7 @@ export default { // Use record propDefinition directly to workaround lack of support // for propDefinition in additionalProps record: airtable.propDefinitions.record, + customExpressionInfo: airtable.propDefinitions.customExpressionInfo, }; } throw new ConfigurationError("Could not find a table for the specified base ID and table ID. Please adjust the action configuration to continue."); From 6fa6f05ed063153d3f2d88ccfa60256ca4d924e6 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 13 Nov 2024 19:30:31 -0300 Subject: [PATCH 03/18] Adding fallback field description to additionalProps --- components/airtable_oauth/common/utils.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/airtable_oauth/common/utils.mjs b/components/airtable_oauth/common/utils.mjs index 534de05c41bba..0b88b26536e5f 100644 --- a/components/airtable_oauth/common/utils.mjs +++ b/components/airtable_oauth/common/utils.mjs @@ -70,7 +70,7 @@ function fieldToProp(field) { return { type: fieldTypeToPropType(field.type), label: field.name, - description: field.description, + description: field.description ?? `Field type: \`${field.type}\`. Field ID: \`${field.id}\``, optional: true, options: field.options?.choices?.map((choice) => ({ label: choice.name || choice.id, From 4dfe1c3f31cce6f7a1813ba78ff1d834839e0651 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 13 Nov 2024 20:05:45 -0300 Subject: [PATCH 04/18] More improvements --- .../create-multiple-records.mjs | 29 +++++++++++++++---- .../airtable_oauth/airtable_oauth.app.mjs | 6 ++-- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/components/airtable_oauth/actions/create-multiple-records/create-multiple-records.mjs b/components/airtable_oauth/actions/create-multiple-records/create-multiple-records.mjs index 68b6a6182d2ef..d8a317c21b968 100644 --- a/components/airtable_oauth/actions/create-multiple-records/create-multiple-records.mjs +++ b/components/airtable_oauth/actions/create-multiple-records/create-multiple-records.mjs @@ -1,14 +1,15 @@ import chunk from "lodash.chunk"; import airtable from "../../airtable_oauth.app.mjs"; import common from "../common/common.mjs"; +import { ConfigurationError } from "@pipedream/platform"; const BATCH_SIZE = 10; // The Airtable API allows us to update up to 10 rows per request. export default { key: "airtable_oauth-create-multiple-records", name: "Create Multiple Records", - description: "Create one or more records in a table by passing an array of objects containing field names and values as key/value pairs. [See the documentation](https://airtable.com/developers/web/api/create-records)", - version: "0.0.6", + description: "Create one or more records in a table in a single operation with an array. [See the documentation](https://airtable.com/developers/web/api/create-records)", + version: "0.1.{{ts}}", type: "action", props: { ...common.props, @@ -18,6 +19,15 @@ export default { "records", ], }, + customExpressionInfo: { + type: "alert", + alertType: "info", + content: `You can use a custom expression that evaluates to an object for each entry in the array, e.g. \`{{ { "foo": "bar", "id": 123 } }}\`. +\\ +You can also reference an object exported by a previous step, e.g. \`{{steps.foo.$return_value}}\`. +\\ +If desired, you can use a custom expression in the same fashion for the entire array instead of providing individual values.`, + }, typecast: { propDefinition: [ airtable, @@ -39,9 +49,18 @@ export default { if (!Array.isArray(data)) { data = JSON.parse(data); } - data = data.map((fields) => ({ - fields, - })); + data = data.map((fields, index) => { + if (typeof fields === "string") { + try { + fields = JSON.parse(fields); + } catch (err) { + throw new ConfigurationError(`Error parsing record (index ${index}) as JSON: ${err.message}`); + } + } + return { + fields, + }; + }); if (!data.length) { throw new Error("No Airtable record data passed to step. Please pass at least one record"); } diff --git a/components/airtable_oauth/airtable_oauth.app.mjs b/components/airtable_oauth/airtable_oauth.app.mjs index c18352a3c6001..28d52d2a59dec 100644 --- a/components/airtable_oauth/airtable_oauth.app.mjs +++ b/components/airtable_oauth/airtable_oauth.app.mjs @@ -205,9 +205,9 @@ export default { optional: true, }, records: { - type: "string", + type: "string[]", label: "Records", - description: "Provide an array of objects. Each object should represent a new record with the column name as the key and the data to insert as the corresponding value (e.g., passing `[{\"foo\":\"bar\",\"id\":123},{\"foo\":\"baz\",\"id\":456}]` will create two records and with values added to the fields `foo` and `id`). The most common pattern is to reference an array of objects exported by a previous step (e.g., `{{steps.foo.$return_value}}`). You may also enter or construct a string that will `JSON.parse()` to an array of objects.", + description: "Each item in the array should be an object in JSON format, representing a new record. The keys are the column names and the corresponding values are the data to insert.", }, typecast: { type: "boolean", @@ -224,7 +224,7 @@ export default { type: "alert", alertType: "info", content: `A custom expression can be a JSON object with key/value pairs representing columns and values, e.g. \`{{ { "foo": "bar", "id": 123 } }}\`. -\\\\ +\\ You can also reference an object exported by a previous step, e.g. \`{{steps.foo.$return_value}}\`.`, }, }, From 93e361b07d46abc155a2efa4ef6d2905d635611f Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 13 Nov 2024 23:49:49 -0300 Subject: [PATCH 05/18] Adjustments --- .../create-or-update-record.mjs | 9 +++-- .../create-single-record.mjs | 36 ------------------- 2 files changed, 4 insertions(+), 41 deletions(-) delete mode 100644 components/airtable_oauth/actions/create-single-record/create-single-record.mjs diff --git a/components/airtable_oauth/actions/create-or-update-record/create-or-update-record.mjs b/components/airtable_oauth/actions/create-or-update-record/create-or-update-record.mjs index 3ff95139c545a..fd6862653af4c 100644 --- a/components/airtable_oauth/actions/create-or-update-record/create-or-update-record.mjs +++ b/components/airtable_oauth/actions/create-or-update-record/create-or-update-record.mjs @@ -4,13 +4,12 @@ import commonActions from "../../common/actions.mjs"; export default { key: "airtable_oauth-create-or-update-record", - name: "Create Single Record Or Update", - description: "Updates a record if `recordId` is provided or adds a record to a table.", - version: "0.0.7", + name: "Create or Update Record", + description: "Create a new record or update an existing one. [See the documentation](https://airtable.com/developers/web/api/create-records)", + version: "0.1.0", type: "action", props: { ...common.props, - // eslint-disable-next-line pipedream/props-label,pipedream/props-description tableId: { ...common.props.tableId, reloadProps: true, @@ -27,7 +26,7 @@ export default { }), ], optional: true, - description: "Enter a [record ID](https://support.airtable.com/hc/en-us/articles/360051564873-Record-ID) if you want to update an existing record. Leave blank to create a new record.", + description: "To update an existing record, select it from the list or provide its [Record ID](https://support.airtable.com/hc/en-us/articles/360051564873-Record-ID). If left blank, a new record will be created.", }, typecast: { propDefinition: [ diff --git a/components/airtable_oauth/actions/create-single-record/create-single-record.mjs b/components/airtable_oauth/actions/create-single-record/create-single-record.mjs deleted file mode 100644 index 8dfe34f6a7aea..0000000000000 --- a/components/airtable_oauth/actions/create-single-record/create-single-record.mjs +++ /dev/null @@ -1,36 +0,0 @@ -import commonActions from "../../common/actions.mjs"; -import airtable from "../../airtable_oauth.app.mjs"; -import common from "../common/common.mjs"; - -export default { - key: "airtable_oauth-create-single-record", - name: "Create Single Record", - description: "Adds a record to a table. [See the documentation](https://airtable.com/developers/web/api/create-records)", - version: "0.0.7", - type: "action", - props: { - ...common.props, - tableId: { - ...common.props.tableId, - reloadProps: true, - }, - typecast: { - propDefinition: [ - airtable, - "typecast", - ], - }, - returnFieldsByFieldId: { - propDefinition: [ - airtable, - "returnFieldsByFieldId", - ], - }, - }, - async additionalProps() { - return commonActions.additionalProps(this); - }, - async run({ $ }) { - return commonActions.createRecord(this, $); - }, -}; From 143305e49faadb68990d8aef4855c6a0faca3824 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 14 Nov 2024 01:22:26 -0300 Subject: [PATCH 06/18] Adjustments --- .../get-record-or-create.mjs | 5 +-- .../actions/get-record/get-record.mjs | 4 +- .../actions/update-record/update-record.mjs | 43 ------------------- 3 files changed, 4 insertions(+), 48 deletions(-) delete mode 100644 components/airtable_oauth/actions/update-record/update-record.mjs diff --git a/components/airtable_oauth/actions/get-record-or-create/get-record-or-create.mjs b/components/airtable_oauth/actions/get-record-or-create/get-record-or-create.mjs index 435a996f95c7b..f5cd65de081ca 100644 --- a/components/airtable_oauth/actions/get-record-or-create/get-record-or-create.mjs +++ b/components/airtable_oauth/actions/get-record-or-create/get-record-or-create.mjs @@ -5,12 +5,11 @@ import commonActions from "../../common/actions.mjs"; export default { key: "airtable_oauth-get-record-or-create", name: "Get Record Or Create", - description: "Get a record from a table by record ID or create a new register.", - version: "0.0.7", + description: "Get a specific record, or create one if it doesn't exist. [See the documentation](https://airtable.com/developers/web/api/create-records)", + version: "0.0.8", type: "action", props: { ...common.props, - // eslint-disable-next-line pipedream/props-label,pipedream/props-description tableId: { ...common.props.tableId, reloadProps: true, diff --git a/components/airtable_oauth/actions/get-record/get-record.mjs b/components/airtable_oauth/actions/get-record/get-record.mjs index 92713bcbcc37c..ba0bcd6d9b21e 100644 --- a/components/airtable_oauth/actions/get-record/get-record.mjs +++ b/components/airtable_oauth/actions/get-record/get-record.mjs @@ -5,8 +5,8 @@ import commonActions from "../../common/actions.mjs"; export default { key: "airtable_oauth-get-record", name: "Get Record", - description: "Get a record from a table by record ID. [See the documentation](https://airtable.com/developers/web/api/get-record)", - version: "0.0.7", + description: "Get data of a selected record from a table. [See the documentation](https://airtable.com/developers/web/api/get-record)", + version: "0.0.8", type: "action", props: { ...common.props, diff --git a/components/airtable_oauth/actions/update-record/update-record.mjs b/components/airtable_oauth/actions/update-record/update-record.mjs deleted file mode 100644 index 5a450fa0d4832..0000000000000 --- a/components/airtable_oauth/actions/update-record/update-record.mjs +++ /dev/null @@ -1,43 +0,0 @@ -import airtable from "../../airtable_oauth.app.mjs"; -import common from "../common/common.mjs"; -import commonActions from "../../common/actions.mjs"; - -export default { - key: "airtable_oauth-update-record", - name: "Update Record", - description: "Update a single record in a table by Record ID. [See the documentation](https://airtable.com/developers/web/api/update-record)", - version: "0.0.7", - type: "action", - props: { - ...common.props, - // eslint-disable-next-line pipedream/props-label,pipedream/props-description - tableId: { - ...common.props.tableId, - reloadProps: true, - }, - recordId: { - propDefinition: [ - airtable, - "recordId", - ({ - baseId, tableId, - }) => ({ - baseId: baseId.value, - tableId: tableId.value, - }), - ], - }, - returnFieldsByFieldId: { - propDefinition: [ - airtable, - "returnFieldsByFieldId", - ], - }, - }, - async additionalProps() { - return commonActions.additionalProps(this); - }, - async run({ $ }) { - return commonActions.updateRecord(this, $); - }, -}; From aeeeb0b9f4be9bda40b5c02c44c499bbdf69a0f0 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 14 Nov 2024 02:07:36 -0300 Subject: [PATCH 07/18] More improvements --- .../airtable_oauth/actions/create-table/create-table.mjs | 6 +++--- .../actions/list-records-in-view/list-records-in-view.mjs | 7 ++++++- .../actions/search-records/search-records.mjs | 2 +- .../airtable_oauth/actions/update-table/update-table.mjs | 6 +++--- components/airtable_oauth/airtable_oauth.app.mjs | 2 +- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/components/airtable_oauth/actions/create-table/create-table.mjs b/components/airtable_oauth/actions/create-table/create-table.mjs index 93e2b39d1f891..cd200a85bdbda 100644 --- a/components/airtable_oauth/actions/create-table/create-table.mjs +++ b/components/airtable_oauth/actions/create-table/create-table.mjs @@ -17,18 +17,18 @@ export default { name: { type: "string", label: "Name", - description: "The name for the table", + description: "The name of the table", }, description: { type: "string", label: "Description", - description: "The description for the table", + description: "The description of the table", optional: true, }, fields: { type: "string[]", label: "Fields", - description: "A list of JSON objects representing the fields in the table. Refer to [field types](https://airtable.com/developers/web/api/model/field-type) for supported field types, the write format for field options, and other specifics for certain field types.", + description: "A list of JSON objects representing the fields in the table. [See the documentation](https://airtable.com/developers/web/api/model/field-type) for supported field types, the write format for field options, and other specifics for certain field types.", }, }, async run({ $ }) { diff --git a/components/airtable_oauth/actions/list-records-in-view/list-records-in-view.mjs b/components/airtable_oauth/actions/list-records-in-view/list-records-in-view.mjs index 0db3726a60c1a..378c831585953 100644 --- a/components/airtable_oauth/actions/list-records-in-view/list-records-in-view.mjs +++ b/components/airtable_oauth/actions/list-records-in-view/list-records-in-view.mjs @@ -4,11 +4,16 @@ import commonList from "../common/common-list.mjs"; export default { key: "airtable_oauth-list-records-in-view", name: "List Records in View", - description: "Retrieve records in a view with automatic pagination. Optionally sort and filter results. Only available for Enterprise accounts.", + description: "Retrieve records from a view, optionally sorting and filtering results. [See the documentation](https://airtable.com/developers/web/api/list-views)", type: "action", version: "0.0.6", ...commonList, props: { + accountTierAlert: { + type: "alert", + alertType: "info", + content: "Note: views are only available for Airtable Enterprise accounts. [See the documentation](https://airtable.com/developers/web/api/list-views) for more information.", + }, ...common.props, viewId: { propDefinition: [ diff --git a/components/airtable_oauth/actions/search-records/search-records.mjs b/components/airtable_oauth/actions/search-records/search-records.mjs index 11bb92adbcfef..c1ac35a551dae 100644 --- a/components/airtable_oauth/actions/search-records/search-records.mjs +++ b/components/airtable_oauth/actions/search-records/search-records.mjs @@ -32,7 +32,7 @@ export default { props.searchFormula = { type: "string", label: "Search Formula", - description: "Use an Airtable search formula to find records. For example, if you want to find records with `Tags` includes `test-1`, use `FIND('test-1', {Tags})`. Learn more on [Airtable's website](https://support.airtable.com/docs/formula-field-reference)", + description: "Use an [Airtable search formula (see info on the documentation)](https://support.airtable.com/docs/formula-field-reference) to find records. For example, if you want to find records with `Tags` including `test-1`, use `FIND('test-1', {Tags})`.", optional: true, }; } diff --git a/components/airtable_oauth/actions/update-table/update-table.mjs b/components/airtable_oauth/actions/update-table/update-table.mjs index f29f7874d81ca..5f8da7f118013 100644 --- a/components/airtable_oauth/actions/update-table/update-table.mjs +++ b/components/airtable_oauth/actions/update-table/update-table.mjs @@ -3,7 +3,7 @@ import common from "../common/common.mjs"; export default { key: "airtable_oauth-update-table", name: "Update Table", - description: "Updates an existing table. [See the documentation](https://airtable.com/developers/web/api/update-table)", + description: "Update an existing table. [See the documentation](https://airtable.com/developers/web/api/update-table)", version: "0.0.6", type: "action", props: { @@ -11,13 +11,13 @@ export default { name: { type: "string", label: "Name", - description: "The name for the table", + description: "The updated name of the table", optional: true, }, description: { type: "string", label: "Description", - description: "The description for the table", + description: "The updated description of the table", optional: true, }, }, diff --git a/components/airtable_oauth/airtable_oauth.app.mjs b/components/airtable_oauth/airtable_oauth.app.mjs index 28d52d2a59dec..5d588c6572b59 100644 --- a/components/airtable_oauth/airtable_oauth.app.mjs +++ b/components/airtable_oauth/airtable_oauth.app.mjs @@ -201,7 +201,7 @@ export default { filterByFormula: { type: "string", label: "Filter by Formula", - description: "Optionally provide a [formula (see the documentation)](https://support.airtable.com/hc/en-us/articles/203255215-Formula-Field-Reference) used to filter records. The formula will be evaluated for each record, and if the result is not `0`, `false`, `\"\"`, `NaN`, `[]`, or `#Error!` the record will be included in the response. For example, to only include records where `Name` isn't empty, use `NOT({Name} = '')`.", + description: "Optionally provide a [formula (see info on the documentation)](https://support.airtable.com/hc/en-us/articles/203255215-Formula-Field-Reference) used to filter records. The formula will be evaluated for each record, and if the result is not `0`, `false`, `\"\"`, `NaN`, `[]`, or `#Error!` the record will be included in the response. For example, to only include records where `Name` isn't empty, use `NOT({Name} = '')`.", optional: true, }, records: { From c8b45546d384606a2d9d73c4a5b1f85d073f001e Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 14 Nov 2024 02:13:02 -0300 Subject: [PATCH 08/18] Text adjustments --- .../actions/create-comment/create-comment.mjs | 6 +++--- .../actions/create-field/create-field.mjs | 4 ++-- .../create-multiple-records.mjs | 2 +- .../actions/delete-record/delete-record.mjs | 4 ++-- .../list-records-in-view/list-records-in-view.mjs | 2 +- .../actions/list-records/list-records.mjs | 2 +- .../actions/search-records/search-records.mjs | 2 +- .../actions/update-comment/update-comment.mjs | 4 ++-- .../actions/update-field/update-field.mjs | 10 +++++----- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/components/airtable_oauth/actions/create-comment/create-comment.mjs b/components/airtable_oauth/actions/create-comment/create-comment.mjs index 3f4b324746d38..6021ad3f2eab8 100644 --- a/components/airtable_oauth/actions/create-comment/create-comment.mjs +++ b/components/airtable_oauth/actions/create-comment/create-comment.mjs @@ -3,8 +3,8 @@ import common from "../common/common.mjs"; export default { key: "airtable_oauth-create-comment", name: "Create Comment", - description: "Create a new comment on a record. [See the documentation](https://airtable.com/developers/web/api/create-comment)", - version: "0.0.6", + description: "Create a comment on a selected record. [See the documentation](https://airtable.com/developers/web/api/create-comment)", + version: "0.0.7", type: "action", props: { ...common.props, @@ -23,7 +23,7 @@ export default { comment: { type: "string", label: "Comment", - description: "The text comment", + description: "The text comment to create", }, }, async run({ $ }) { diff --git a/components/airtable_oauth/actions/create-field/create-field.mjs b/components/airtable_oauth/actions/create-field/create-field.mjs index 1db1affcc9e7a..600b9f9c34bfe 100644 --- a/components/airtable_oauth/actions/create-field/create-field.mjs +++ b/components/airtable_oauth/actions/create-field/create-field.mjs @@ -4,14 +4,14 @@ export default { key: "airtable_oauth-create-field", name: "Create Field", description: "Create a new field in a table. [See the documentation](https://airtable.com/developers/web/api/create-field)", - version: "0.0.6", + version: "0.0.7", type: "action", props: { ...common.props, field: { type: "string", label: "Field", - description: "A JSON object representing the field. Refer to [field types](https://airtable.com/developers/web/api/model/field-type) for supported field types, the write format for field options, and other specifics for certain field types.", + description: "A JSON object representing the field. [See the documentation](https://airtable.com/developers/web/api/model/field-type) for supported field types, the write format for field options, and other specifics for certain field types.", }, }, async run({ $ }) { diff --git a/components/airtable_oauth/actions/create-multiple-records/create-multiple-records.mjs b/components/airtable_oauth/actions/create-multiple-records/create-multiple-records.mjs index d8a317c21b968..ada1d282a3207 100644 --- a/components/airtable_oauth/actions/create-multiple-records/create-multiple-records.mjs +++ b/components/airtable_oauth/actions/create-multiple-records/create-multiple-records.mjs @@ -9,7 +9,7 @@ export default { key: "airtable_oauth-create-multiple-records", name: "Create Multiple Records", description: "Create one or more records in a table in a single operation with an array. [See the documentation](https://airtable.com/developers/web/api/create-records)", - version: "0.1.{{ts}}", + version: "0.0.7", type: "action", props: { ...common.props, diff --git a/components/airtable_oauth/actions/delete-record/delete-record.mjs b/components/airtable_oauth/actions/delete-record/delete-record.mjs index b7c49541704d3..9748b28a0ab9a 100644 --- a/components/airtable_oauth/actions/delete-record/delete-record.mjs +++ b/components/airtable_oauth/actions/delete-record/delete-record.mjs @@ -4,8 +4,8 @@ import common from "../common/common.mjs"; export default { key: "airtable_oauth-delete-record", name: "Delete Record", - description: "Delete a record from a table by record ID. [See the documentation](https://airtable.com/developers/web/api/delete-record)", - version: "0.0.6", + description: "Delete a selected record from a table. [See the documentation](https://airtable.com/developers/web/api/delete-record)", + version: "0.0.8", type: "action", props: { ...common.props, diff --git a/components/airtable_oauth/actions/list-records-in-view/list-records-in-view.mjs b/components/airtable_oauth/actions/list-records-in-view/list-records-in-view.mjs index 378c831585953..5259c3cc8b205 100644 --- a/components/airtable_oauth/actions/list-records-in-view/list-records-in-view.mjs +++ b/components/airtable_oauth/actions/list-records-in-view/list-records-in-view.mjs @@ -6,7 +6,7 @@ export default { name: "List Records in View", description: "Retrieve records from a view, optionally sorting and filtering results. [See the documentation](https://airtable.com/developers/web/api/list-views)", type: "action", - version: "0.0.6", + version: "0.0.7", ...commonList, props: { accountTierAlert: { diff --git a/components/airtable_oauth/actions/list-records/list-records.mjs b/components/airtable_oauth/actions/list-records/list-records.mjs index 0148d02542fbf..c8dcf06f0a013 100644 --- a/components/airtable_oauth/actions/list-records/list-records.mjs +++ b/components/airtable_oauth/actions/list-records/list-records.mjs @@ -6,7 +6,7 @@ export default { name: "List Records", description: "Retrieve records from a table, optionally sorting and filtering results. [See the documentation](https://airtable.com/developers/web/api/list-records)", type: "action", - version: "0.1.0", + version: "0.0.8", ...commonList, props: { ...common.props, diff --git a/components/airtable_oauth/actions/search-records/search-records.mjs b/components/airtable_oauth/actions/search-records/search-records.mjs index c1ac35a551dae..4ed6b82a44d2a 100644 --- a/components/airtable_oauth/actions/search-records/search-records.mjs +++ b/components/airtable_oauth/actions/search-records/search-records.mjs @@ -4,7 +4,7 @@ import { fieldTypeToPropType } from "../../common/utils.mjs"; export default { key: "airtable_oauth-search-records", name: "Search Records", - description: "Searches for a record by formula or by field value. [See the documentation](https://airtable.com/developers/web/api/list-records)", + description: "Search for a record by formula or by field value. [See the documentation](https://airtable.com/developers/web/api/list-records)", version: "0.0.8", type: "action", props: { diff --git a/components/airtable_oauth/actions/update-comment/update-comment.mjs b/components/airtable_oauth/actions/update-comment/update-comment.mjs index 9bb91e67a4fda..a45b3642e9e15 100644 --- a/components/airtable_oauth/actions/update-comment/update-comment.mjs +++ b/components/airtable_oauth/actions/update-comment/update-comment.mjs @@ -3,7 +3,7 @@ import common from "../common/common.mjs"; export default { key: "airtable_oauth-update-comment", name: "Update Comment", - description: "Updates an existing comment on a record. [See the documentation](https://airtable.com/developers/web/api/update-comment)", + description: "Update an existing comment on a selected record. [See the documentation](https://airtable.com/developers/web/api/update-comment)", version: "0.0.6", type: "action", props: { @@ -36,7 +36,7 @@ export default { comment: { type: "string", label: "Comment", - description: "The text comment", + description: "The new content of the comment", }, }, async run({ $ }) { diff --git a/components/airtable_oauth/actions/update-field/update-field.mjs b/components/airtable_oauth/actions/update-field/update-field.mjs index 564a9e9fc0f5d..f49c0fb6760f7 100644 --- a/components/airtable_oauth/actions/update-field/update-field.mjs +++ b/components/airtable_oauth/actions/update-field/update-field.mjs @@ -4,8 +4,8 @@ import { ConfigurationError } from "@pipedream/platform"; export default { key: "airtable_oauth-update-field", name: "Update Field", - description: "Updates an existing field in a table. [See the documentation](https://airtable.com/developers/web/api/update-field)", - version: "0.0.6", + description: "Update an existing field in a table. [See the documentation](https://airtable.com/developers/web/api/update-field)", + version: "0.0.7", type: "action", props: { ...common.props, @@ -27,19 +27,19 @@ export default { name: { type: "string", label: "Name", - description: "The name of the field", + description: "The new name of the field", optional: true, }, description: { type: "string", label: "Description", - description: "The description for the field", + description: "The new description of the field", optional: true, }, }, async run({ $ }) { if (!this.name && !this.description) { - throw new ConfigurationError("At least one of `name` or `description` must be provided."); + throw new ConfigurationError("At least one of `Name` or `Description` must be provided."); } const data = {}; From cce4029478bca35aa45c8d74a0f69e32ba843f96 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 19 Nov 2024 17:57:00 -0300 Subject: [PATCH 09/18] Create Field improvements --- .../actions/create-field/create-field.mjs | 43 ++++++++++++++----- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/components/airtable_oauth/actions/create-field/create-field.mjs b/components/airtable_oauth/actions/create-field/create-field.mjs index 600b9f9c34bfe..0c0a917a9550b 100644 --- a/components/airtable_oauth/actions/create-field/create-field.mjs +++ b/components/airtable_oauth/actions/create-field/create-field.mjs @@ -1,3 +1,4 @@ +import constants from "../../sources/common/constants.mjs"; import common from "../common/common.mjs"; export default { @@ -8,23 +9,45 @@ export default { type: "action", props: { ...common.props, - field: { + name: { type: "string", - label: "Field", - description: "A JSON object representing the field. [See the documentation](https://airtable.com/developers/web/api/model/field-type) for supported field types, the write format for field options, and other specifics for certain field types.", + label: "Field Name", + description: "The name of the field", + }, + type: { + type: "string", + label: "Field Type", + description: "The field type. [See the documentation](https://airtable.com/developers/web/api/model/field-type) for more information.", + options: constants.FIELD_TYPES, + }, + description: { + type: "string", + label: "Field Description", + description: "The description of the field", + optional: true, + }, + options: { + type: "object", + label: "Field Options", + description: "The options for the field as a JSON object, e.g. `{ \"color\": \"greenBright\" }`. Each type has a specific set of options - [see the documentation](https://airtable.com/developers/web/api/field-model) for more information.", + optional: true, }, }, async run({ $ }) { - const field = typeof this.field === "object" - ? this.field - : JSON.parse(this.field); - const data = { - ...field, - }; + const { + description, name, options, type, + } = this; const response = await this.airtable.createField({ baseId: this.baseId.value, tableId: this.tableId.value, - data, + data: { + name, + type, + description, + options: typeof options === "string" + ? JSON.parse(options) + : options, + }, $, }); From 796dae125ad08f9614e6def5608e2a2345e6d8f3 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 19 Nov 2024 18:04:25 -0300 Subject: [PATCH 10/18] Minor adjustments --- .../sources/common/constants.mjs | 44 ++++++++++++++++++- .../sources/new-field/new-field.mjs | 17 +++---- 2 files changed, 51 insertions(+), 10 deletions(-) diff --git a/components/airtable_oauth/sources/common/constants.mjs b/components/airtable_oauth/sources/common/constants.mjs index 230e6497e8d96..9e5df8dab56e1 100644 --- a/components/airtable_oauth/sources/common/constants.mjs +++ b/components/airtable_oauth/sources/common/constants.mjs @@ -34,7 +34,8 @@ const FROM_SOURCES = [ }, { value: "formPageSubmission", - label: "Changes generated when an interface form builder page, form layout page, or record creation button page is submitted", + label: + "Changes generated when an interface form builder page, form layout page, or record creation button page is submitted", }, { value: "automation", @@ -42,7 +43,8 @@ const FROM_SOURCES = [ }, { value: "system", - label: "Changes generated by system events, such as processing time function formulas", + label: + "Changes generated by system events, such as processing time function formulas", }, { value: "sync", @@ -58,8 +60,46 @@ const FROM_SOURCES = [ }, ]; +const FIELD_TYPES = [ + "singleLineText", + "email", + "url", + "multilineText", + "number", + "percent", + "currency", + "singleSelect", + "multipleSelects", + "singleCollaborator", + "multipleCollaborators", + "multipleRecordLinks", + "date", + "dateTime", + "phoneNumber", + "multipleAttachments", + "checkbox", + "formula", + "createdTime", + "rollup", + "count", + "lookup", + "multipleLookupValues", + "autoNumber", + "barcode", + "rating", + "richText", + "duration", + "lastModifiedTime", + "button", + "createdBy", + "lastModifiedBy", + "externalSyncSource", + "aiText", +]; + export default { DATA_TYPES, CHANGE_TYPES, FROM_SOURCES, + FIELD_TYPES, }; diff --git a/components/airtable_oauth/sources/new-field/new-field.mjs b/components/airtable_oauth/sources/new-field/new-field.mjs index b527098e94cd3..9dc9be46c43bb 100644 --- a/components/airtable_oauth/sources/new-field/new-field.mjs +++ b/components/airtable_oauth/sources/new-field/new-field.mjs @@ -1,10 +1,10 @@ import common from "../common/common.mjs"; export default { - name: "New Field", - description: "Emit new event for each new field created in a table", + name: "New Field Created", + description: "Emit new event for each new field created in a table. [See the documentation](https://airtable.com/developers/web/api/get-base-schema)", key: "airtable_oauth-new-field", - version: "0.0.6", + version: "0.0.7", type: "source", props: { ...common.props, @@ -16,7 +16,7 @@ export default { baseId, }), ], - description: "The table ID to watch for changes.", + description: "Select a table to watch for new fields, or provide a table ID.", }, }, methods: { @@ -36,13 +36,14 @@ export default { const { fields } = tables.find(({ id }) => id === this.tableId); for (const field of fields) { - if (fieldIds.includes(field.id)) { + const { id } = field; + if (fieldIds.includes(id)) { continue; } - fieldIds.push(field.id); + fieldIds.push(id); this.$emit(field, { - id: field.id, - summary: field.name, + id, + summary: `New field: '${field.name}'`, ts: Date.now(), }); } From 567602a2a729fdf01020a207ea20cc374e9be34d Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 20 Nov 2024 00:06:28 -0300 Subject: [PATCH 11/18] Improvements on sources --- .../sources/new-field/new-field.mjs | 2 +- .../new-records-in-view.mjs | 21 ++++++++++--------- .../sources/new-records/new-records.mjs | 19 +++++++++-------- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/components/airtable_oauth/sources/new-field/new-field.mjs b/components/airtable_oauth/sources/new-field/new-field.mjs index 9dc9be46c43bb..0703d9e4e33e1 100644 --- a/components/airtable_oauth/sources/new-field/new-field.mjs +++ b/components/airtable_oauth/sources/new-field/new-field.mjs @@ -2,7 +2,7 @@ import common from "../common/common.mjs"; export default { name: "New Field Created", - description: "Emit new event for each new field created in a table. [See the documentation](https://airtable.com/developers/web/api/get-base-schema)", + description: "Emit new event when a field is created in the selected table. [See the documentation](https://airtable.com/developers/web/api/get-base-schema)", key: "airtable_oauth-new-field", version: "0.0.7", type: "source", diff --git a/components/airtable_oauth/sources/new-records-in-view/new-records-in-view.mjs b/components/airtable_oauth/sources/new-records-in-view/new-records-in-view.mjs index bb4d186bb73c4..c1ed80d95b605 100644 --- a/components/airtable_oauth/sources/new-records-in-view/new-records-in-view.mjs +++ b/components/airtable_oauth/sources/new-records-in-view/new-records-in-view.mjs @@ -1,12 +1,11 @@ import base from "../common/common.mjs"; -import moment from "moment"; export default { ...base, - name: "New Records in View", - description: "Emit new event for each new record in a view", + name: "New Record(s) Created (in View)", + description: "Emit new event when a record is created in the selected view. [See the documentation](https://airtable.com/developers/web/api/list-records)", key: "airtable_oauth-new-records-in-view", - version: "0.0.6", + version: "0.0.7", type: "source", props: { ...base.props, @@ -18,7 +17,7 @@ export default { baseId, }), ], - description: "The table ID to watch for changes.", + description: "Select a table to watch for new records, or provide a table ID.", }, viewId: { propDefinition: [ @@ -31,7 +30,7 @@ export default { tableId, }), ], - description: "The view ID to watch for changes.", + description: "Select a view to watch for new records, or provide a view ID.", }, returnFieldsByFieldId: { propDefinition: [ @@ -75,13 +74,15 @@ export default { let recordCount = 0; for (const record of records) { record.metadata = metadata; + const ts = Date.parse(record.createdTime).valueOf(); + const id = record.id; this.$emit(record, { - ts: moment(record.createdTime).valueOf(), - summary: JSON.stringify(record.fields), - id: record.id, + ts, + summary: `New record: ID ${id}`, + id, }); - if (!maxTimestamp || moment(record.createdTime).valueOf() > moment(maxTimestamp).valueOf()) { + if (!maxTimestamp || ts > Date.parse(maxTimestamp).valueOf()) { maxTimestamp = record.createdTime; } recordCount++; diff --git a/components/airtable_oauth/sources/new-records/new-records.mjs b/components/airtable_oauth/sources/new-records/new-records.mjs index 0bd968d630d87..d683e719169b3 100644 --- a/components/airtable_oauth/sources/new-records/new-records.mjs +++ b/components/airtable_oauth/sources/new-records/new-records.mjs @@ -1,12 +1,11 @@ import base from "../common/common.mjs"; -import moment from "moment"; export default { ...base, - name: "New Records", - description: "Emit new event for each new record in a table", + name: "New Record(s) Created (in Table)", + description: "Emit new event when a record is created in the selected table. [See the documentation](https://airtable.com/developers/web/api/list-records)", key: "airtable_oauth-new-records", - version: "0.0.6", + version: "0.0.7", type: "source", props: { ...base.props, @@ -18,7 +17,7 @@ export default { baseId, }), ], - description: "The table ID to watch for changes.", + description: "Select a table to watch for new records, or provide a table ID.", }, returnFieldsByFieldId: { propDefinition: [ @@ -61,13 +60,15 @@ export default { let recordCount = 0; for (const record of records) { record.metadata = metadata; + const ts = Date.parse(record.createdTime).valueOf(); + const id = record.id; this.$emit(record, { - ts: moment(record.createdTime).valueOf(), - summary: JSON.stringify(record.fields), - id: record.id, + ts, + summary: `New record: ID ${id}`, + id, }); - if (!maxTimestamp || moment(record.createdTime).valueOf() > moment(maxTimestamp).valueOf()) { + if (!maxTimestamp || ts > Date.parse(maxTimestamp).valueOf()) { maxTimestamp = record.createdTime; } recordCount++; From 7b0d38d9b88db3ea33176dbef7f92c328e9824c9 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 20 Nov 2024 00:16:00 -0300 Subject: [PATCH 12/18] More source improvements --- .../new-or-modified-records-in-view.mjs | 19 +++++++++++-------- .../new-or-modified-records.mjs | 18 ++++++++++-------- .../new-records-in-view.mjs | 2 +- .../sources/new-records/new-records.mjs | 2 +- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/components/airtable_oauth/sources/new-or-modified-records-in-view/new-or-modified-records-in-view.mjs b/components/airtable_oauth/sources/new-or-modified-records-in-view/new-or-modified-records-in-view.mjs index be69e185cc9e5..afb54477c7c05 100644 --- a/components/airtable_oauth/sources/new-or-modified-records-in-view/new-or-modified-records-in-view.mjs +++ b/components/airtable_oauth/sources/new-or-modified-records-in-view/new-or-modified-records-in-view.mjs @@ -1,10 +1,9 @@ import base from "../common/common.mjs"; -import moment from "moment"; export default { ...base, - name: "New or Modified Records in View", - description: "Emit new event for each new or modified record in a view", + name: "New or Modified Record(s) In View", + description: "Emit new event when a record is created or updated in the selected view. [See the documentation](https://airtable.com/developers/web/api/list-records)", key: "airtable_oauth-new-or-modified-records-in-view", version: "0.0.6", type: "source", @@ -18,7 +17,7 @@ export default { baseId, }), ], - description: "The table ID to watch for changes.", + description: "Select a table to watch for records, or provide a table ID.", }, viewId: { propDefinition: [ @@ -31,7 +30,7 @@ export default { tableId, }), ], - description: "The view ID to watch for changes.", + description: "Select a view to watch for records, or provide a view ID.", }, returnFieldsByFieldId: { propDefinition: [ @@ -73,7 +72,7 @@ export default { let newRecords = 0, modifiedRecords = 0; for (const record of records) { - if (!lastTimestamp || moment(record.createdTime) > moment(lastTimestamp)) { + if (!lastTimestamp || Date.parse(record.createdTime) > Date.parse(lastTimestamp)) { record.type = "new_record"; newRecords++; } else { @@ -83,9 +82,13 @@ export default { record.metadata = metadata; + const id = record.id; this.$emit(record, { - summary: `${record.type}: ${JSON.stringify(record.fields)}`, - id: record.id, + summary: `${record.type === "new_record" + ? "New" + : "Updated"} record: ${id}`, + id, + ts: Date.now(), }); } console.log(`Emitted ${newRecords} new records(s) and ${modifiedRecords} modified record(s).`); diff --git a/components/airtable_oauth/sources/new-or-modified-records/new-or-modified-records.mjs b/components/airtable_oauth/sources/new-or-modified-records/new-or-modified-records.mjs index 1814893d29cb3..a57c06ac3bd22 100644 --- a/components/airtable_oauth/sources/new-or-modified-records/new-or-modified-records.mjs +++ b/components/airtable_oauth/sources/new-or-modified-records/new-or-modified-records.mjs @@ -1,12 +1,11 @@ import base from "../common/common.mjs"; import sampleEmit from "./test-event.mjs"; -import moment from "moment"; export default { ...base, - name: "New or Modified Records", + name: "New or Modified Record(s) In Table", key: "airtable_oauth-new-or-modified-records", - description: "Emit new event for each new or modified record in a table", + description: "Emit new event when a record is created in the selected table. [See the documentation](https://airtable.com/developers/web/api/list-records)", version: "0.0.8", type: "source", props: { @@ -19,7 +18,7 @@ export default { baseId, }), ], - description: "The table ID to watch for changes.", + description: "Select a table to watch for records, or provide a table ID.", }, fieldIds: { propDefinition: [ @@ -34,7 +33,7 @@ export default { ], type: "string[]", label: "Field IDs", - description: "Identifiers of spedific fields/columns to watch for updates", + description: "Select which fields/columns to watch for updates.", withLabel: true, }, returnFieldsByFieldId: { @@ -124,7 +123,7 @@ export default { if (this.fieldIds) { newFieldValues = this.updateFieldValues(newFieldValues, record); } - if (!lastTimestamp || moment(record.createdTime) > moment(lastTimestamp)) { + if (!lastTimestamp || Date.parse(record.createdTime) > Date.parse(lastTimestamp)) { record.type = "new_record"; newRecords++; } else { @@ -139,9 +138,12 @@ export default { record.metadata = metadata; + const id = record.id; this.$emit(record, { - summary: `${record.type}: ${JSON.stringify(record.fields)}`, - id: record.id, + summary: `${record.type === "new_record" + ? "New" + : "Updated"} record: ${id}`, + id, ts: Date.now(), }); } diff --git a/components/airtable_oauth/sources/new-records-in-view/new-records-in-view.mjs b/components/airtable_oauth/sources/new-records-in-view/new-records-in-view.mjs index c1ed80d95b605..cb4b96d354dc1 100644 --- a/components/airtable_oauth/sources/new-records-in-view/new-records-in-view.mjs +++ b/components/airtable_oauth/sources/new-records-in-view/new-records-in-view.mjs @@ -2,7 +2,7 @@ import base from "../common/common.mjs"; export default { ...base, - name: "New Record(s) Created (in View)", + name: "New Record(s) Created In View", description: "Emit new event when a record is created in the selected view. [See the documentation](https://airtable.com/developers/web/api/list-records)", key: "airtable_oauth-new-records-in-view", version: "0.0.7", diff --git a/components/airtable_oauth/sources/new-records/new-records.mjs b/components/airtable_oauth/sources/new-records/new-records.mjs index d683e719169b3..6f23aefb2308b 100644 --- a/components/airtable_oauth/sources/new-records/new-records.mjs +++ b/components/airtable_oauth/sources/new-records/new-records.mjs @@ -2,7 +2,7 @@ import base from "../common/common.mjs"; export default { ...base, - name: "New Record(s) Created (in Table)", + name: "New Record(s) Created In Table", description: "Emit new event when a record is created in the selected table. [See the documentation](https://airtable.com/developers/web/api/list-records)", key: "airtable_oauth-new-records", version: "0.0.7", From 2648237653fe06ee9806f2f52529bbcdeaf9fb19 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 20 Nov 2024 00:42:50 -0300 Subject: [PATCH 13/18] Large update to webhook source, deprecating timer sources --- ...ew-modified-or-deleted-records-instant.mjs | 48 +++--- .../new-modified-or-deleted-records.mjs | 128 -------------- .../new-or-modified-field.mjs | 6 +- .../new-or-modified-records-in-view.mjs | 99 ----------- .../new-or-modified-records.mjs | 157 ------------------ .../new-or-modified-records/test-event.mjs | 27 --- .../new-records-in-view.mjs | 93 ----------- .../sources/new-records/new-records.mjs | 79 --------- 8 files changed, 32 insertions(+), 605 deletions(-) delete mode 100644 components/airtable_oauth/sources/new-modified-or-deleted-records/new-modified-or-deleted-records.mjs delete mode 100644 components/airtable_oauth/sources/new-or-modified-records-in-view/new-or-modified-records-in-view.mjs delete mode 100644 components/airtable_oauth/sources/new-or-modified-records/new-or-modified-records.mjs delete mode 100644 components/airtable_oauth/sources/new-or-modified-records/test-event.mjs delete mode 100644 components/airtable_oauth/sources/new-records-in-view/new-records-in-view.mjs delete mode 100644 components/airtable_oauth/sources/new-records/new-records.mjs diff --git a/components/airtable_oauth/sources/new-modified-or-deleted-records-instant/new-modified-or-deleted-records-instant.mjs b/components/airtable_oauth/sources/new-modified-or-deleted-records-instant/new-modified-or-deleted-records-instant.mjs index 054694a797d14..6b3e1404ccc4c 100644 --- a/components/airtable_oauth/sources/new-modified-or-deleted-records-instant/new-modified-or-deleted-records-instant.mjs +++ b/components/airtable_oauth/sources/new-modified-or-deleted-records-instant/new-modified-or-deleted-records-instant.mjs @@ -3,10 +3,10 @@ import constants from "../common/constants.mjs"; import sampleEmit from "./test-event.mjs"; export default { - name: "New Modified or Deleted Records (Instant)", - description: "Emit new event each time a record is added, updated, or deleted in an Airtable table. [See the documentation](https://airtable.com/developers/web/api/create-a-webhook)", + name: "New Record Created, Updated or Deleted (Instant)", + description: "Emit new event when a record is added, updated, or deleted in a table or selected view. [See the documentation](https://airtable.com/developers/web/api/create-a-webhook)", key: "airtable_oauth-new-modified-or-deleted-records-instant", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", props: { @@ -25,9 +25,26 @@ export default { dataTypes: { type: "string[]", label: "Data Types", - description: "Only generate payloads that contain changes affecting objects of these types", + description: "Select the object types that should emit events when updated.", options: constants.DATA_TYPES, }, + infoBox1: { + type: "alert", + alertType: "info", + content: "You can select which types of activity to emit events for, using the `Update Types` prop below - otherwise, all record updates will emit events.", + }, + changeTypes: { + type: "string[]", + label: "Update Types", + description: "Select the types of record updates that should emit events. If not specified, all updates will emit events.", + options: constants.CHANGE_TYPES, + optional: true, + }, + infoBox2: { + type: "alert", + alertType: "info", + content: "You can also select a table or a specific view to get updates from. Further levels of customization are also available in the other optional props below.", + }, tableId: { propDefinition: [ airtable, @@ -36,7 +53,7 @@ export default { baseId: c.baseId, }), ], - description: "Only generate payloads for changes in the specified TableId", + description: "Only emit events for updates in the specified Table Id", optional: true, }, viewId: { @@ -48,20 +65,13 @@ export default { tableId: c.tableId, }), ], - description: "Only generate payloads for changes in the specified ViewId", - optional: true, - }, - changeTypes: { - type: "string[]", - label: "Change Types", - description: "Only generate payloads that contain changes of these types", - options: constants.CHANGE_TYPES, + description: "Only emit events for updates in the specified View Id", optional: true, }, fromSouces: { type: "string[]", label: "From Sources", - description: "Only generate payloads for changes from these sources. If omitted, changes from all sources are reported", + description: "Only emit events for updates from these sources. If omitted, updates from all sources are reported", options: constants.FROM_SOURCES, optional: true, }, @@ -76,7 +86,7 @@ export default { ], type: "string[]", label: "Watch Data In Field Ids", - description: "Only generate payloads for changes that modify values in cells in these fields. If omitted, all fields within the table/view/base are watched", + description: "Only emit events for updates that modify values in cells in these fields. If omitted, all fields within the table/view/base are watched", }, watchSchemasOfFieldIds: { propDefinition: [ @@ -89,7 +99,7 @@ export default { ], type: "string[]", label: "Watch Schemas of Field Ids", - description: "Only generate payloads for changes that modify the schemas of these fields. If omitted, schemas of all fields within the table/view/base are watched", + description: "Only emit events for updates that modify the schemas of these fields. If omitted, schemas of all fields within the table/view/base are watched", }, includeCellValuesInFieldIds: { propDefinition: [ @@ -102,18 +112,18 @@ export default { ], type: "string[]", label: "Include Cell Values in Field Ids", - description: "A list of fields to include in the payload regardless of whether or not they changed", + description: "Fields to include in the event payload, regardless of whether or not they changed", }, includePreviousCellValues: { type: "boolean", label: "Include Previous Cell Values", - description: "If true, include the previous cell value in the payload", + description: "If true, include the previous cell value in the event payload", optional: true, }, includePreviousFieldDefinitions: { type: "boolean", label: "Include Previous Field Definitions", - description: "If true, include the previous field definition in the payload", + description: "If true, include the previous field definition in the event payload", optional: true, }, }, diff --git a/components/airtable_oauth/sources/new-modified-or-deleted-records/new-modified-or-deleted-records.mjs b/components/airtable_oauth/sources/new-modified-or-deleted-records/new-modified-or-deleted-records.mjs deleted file mode 100644 index 3ca29a927249b..0000000000000 --- a/components/airtable_oauth/sources/new-modified-or-deleted-records/new-modified-or-deleted-records.mjs +++ /dev/null @@ -1,128 +0,0 @@ -import base from "../common/common.mjs"; -import moment from "moment"; - -export default { - ...base, - name: "New, Modified or Deleted Records", - key: "airtable_oauth-new-modified-or-deleted-records", - version: "0.0.6", - type: "source", - description: "Emit new event each time a record is added, updated, or deleted in an Airtable table. Supports tables up to 10,000 records", - props: { - ...base.props, - tableId: { - propDefinition: [ - base.props.airtable, - "tableId", - ({ baseId }) => ({ - baseId, - }), - ], - description: "The table ID to watch for changes.", - }, - returnFieldsByFieldId: { - propDefinition: [ - base.props.airtable, - "returnFieldsByFieldId", - ], - }, - }, - methods: { - ...base.methods, - _getPrevAllRecordIds() { - return this.db.get("prevAllRecordIds"); - }, - _setPrevAllRecordIds(prevAllRecordIds) { - this.db.set("prevAllRecordIds", prevAllRecordIds); - }, - }, - async run(event) { - const { - baseId, - tableId, - viewId, - } = this; - - const metadata = { - baseId, - tableId, - viewId, - }; - - const prevAllRecordIds = this._getPrevAllRecordIds(); - - const lastTimestamp = this._getLastTimestamp(); - const params = { - filterByFormula: `LAST_MODIFIED_TIME() > "${lastTimestamp}"`, - returnFieldsByFieldId: this.returnFieldsByFieldId || false, - }; - - const records = await this.airtable.listRecords({ - baseId, - tableId, - params, - }); - - let allRecordIds = [], - newRecordsCount = 0, - modifiedRecordsCount = 0, - deletedRecordsCount = 0; - - if (records) { - for (const record of records) { - if (!lastTimestamp || moment(record.createdTime) > moment(lastTimestamp)) { - record.type = "new_record"; - newRecordsCount++; - } else { - record.type = "record_modified"; - modifiedRecordsCount++; - } - - record.metadata = metadata; - - this.$emit(record, { - summary: `${record.type}: ${JSON.stringify(record.fields)}`, - id: record.id, - }); - } - } - - delete params.filterByFormula; - - const data = await this.airtable.listRecords({ - baseId, - tableId, - params, - }); - if (!data.length || data.length === 0) return; - allRecordIds = [ - ...data.map((record) => record.id), - ]; - - if (prevAllRecordIds) { - const deletedRecordIds = prevAllRecordIds.filter( - (prevRecord) => !allRecordIds.includes(prevRecord), - ); - for (const recordID of deletedRecordIds) { - deletedRecordsCount++; - const deletedRecordObj = { - metadata, - type: "record_deleted", - id: recordID, - }; - this.$emit(deletedRecordObj, { - summary: "record_deleted", - id: recordID, - }); - } - } - - console.log( - `Emitted ${newRecordsCount} new records(s) and ${modifiedRecordsCount} modified record(s) and ${deletedRecordsCount} deleted records.`, - ); - this._setPrevAllRecordIds(allRecordIds); - - // We keep track of the timestamp of the current invocation - this.updateLastTimestamp(event); - }, -}; diff --git a/components/airtable_oauth/sources/new-or-modified-field/new-or-modified-field.mjs b/components/airtable_oauth/sources/new-or-modified-field/new-or-modified-field.mjs index 6a91741cf3343..1941894fdb21a 100644 --- a/components/airtable_oauth/sources/new-or-modified-field/new-or-modified-field.mjs +++ b/components/airtable_oauth/sources/new-or-modified-field/new-or-modified-field.mjs @@ -2,9 +2,9 @@ import common from "../common/common.mjs"; export default { name: "New or Modified Field", - description: "Emit new event for each new or modified field in a table", + description: "Emit new event when a field is created or updated in the selected table. [See the documentation](https://airtable.com/developers/web/api/get-base-schema)", key: "airtable_oauth-new-or-modified-field", - version: "0.0.6", + version: "0.0.7", type: "source", props: { ...common.props, @@ -16,7 +16,7 @@ export default { baseId, }), ], - description: "The table ID to watch for changes.", + description: "Select a table to watch for field updates, or provide a table ID.", }, }, methods: { diff --git a/components/airtable_oauth/sources/new-or-modified-records-in-view/new-or-modified-records-in-view.mjs b/components/airtable_oauth/sources/new-or-modified-records-in-view/new-or-modified-records-in-view.mjs deleted file mode 100644 index afb54477c7c05..0000000000000 --- a/components/airtable_oauth/sources/new-or-modified-records-in-view/new-or-modified-records-in-view.mjs +++ /dev/null @@ -1,99 +0,0 @@ -import base from "../common/common.mjs"; - -export default { - ...base, - name: "New or Modified Record(s) In View", - description: "Emit new event when a record is created or updated in the selected view. [See the documentation](https://airtable.com/developers/web/api/list-records)", - key: "airtable_oauth-new-or-modified-records-in-view", - version: "0.0.6", - type: "source", - props: { - ...base.props, - tableId: { - propDefinition: [ - base.props.airtable, - "tableId", - ({ baseId }) => ({ - baseId, - }), - ], - description: "Select a table to watch for records, or provide a table ID.", - }, - viewId: { - propDefinition: [ - base.props.airtable, - "viewId", - ({ - baseId, tableId, - }) => ({ - baseId, - tableId, - }), - ], - description: "Select a view to watch for records, or provide a view ID.", - }, - returnFieldsByFieldId: { - propDefinition: [ - base.props.airtable, - "returnFieldsByFieldId", - ], - }, - }, - async run(event) { - const { - baseId, - tableId, - viewId, - } = this; - - const lastTimestamp = this._getLastTimestamp(); - const params = { - view: viewId, - filterByFormula: `LAST_MODIFIED_TIME() > "${lastTimestamp}"`, - returnFieldsByFieldId: this.returnFieldsByFieldId || false, - }; - - const records = await this.airtable.listRecords({ - baseId, - tableId, - params, - }); - - if (!records.length) { - console.log("No new or modified records."); - return; - } - - const metadata = { - baseId, - tableId, - viewId, - }; - - let newRecords = 0, modifiedRecords = 0; - for (const record of records) { - if (!lastTimestamp || Date.parse(record.createdTime) > Date.parse(lastTimestamp)) { - record.type = "new_record"; - newRecords++; - } else { - record.type = "record_modified"; - modifiedRecords++; - } - - record.metadata = metadata; - - const id = record.id; - this.$emit(record, { - summary: `${record.type === "new_record" - ? "New" - : "Updated"} record: ${id}`, - id, - ts: Date.now(), - }); - } - console.log(`Emitted ${newRecords} new records(s) and ${modifiedRecords} modified record(s).`); - - // We keep track of the timestamp of the current invocation - this.updateLastTimestamp(event); - }, -}; diff --git a/components/airtable_oauth/sources/new-or-modified-records/new-or-modified-records.mjs b/components/airtable_oauth/sources/new-or-modified-records/new-or-modified-records.mjs deleted file mode 100644 index a57c06ac3bd22..0000000000000 --- a/components/airtable_oauth/sources/new-or-modified-records/new-or-modified-records.mjs +++ /dev/null @@ -1,157 +0,0 @@ -import base from "../common/common.mjs"; -import sampleEmit from "./test-event.mjs"; - -export default { - ...base, - name: "New or Modified Record(s) In Table", - key: "airtable_oauth-new-or-modified-records", - description: "Emit new event when a record is created in the selected table. [See the documentation](https://airtable.com/developers/web/api/list-records)", - version: "0.0.8", - type: "source", - props: { - ...base.props, - tableId: { - propDefinition: [ - base.props.airtable, - "tableId", - ({ baseId }) => ({ - baseId, - }), - ], - description: "Select a table to watch for records, or provide a table ID.", - }, - fieldIds: { - propDefinition: [ - base.props.airtable, - "sortFieldId", - ({ - baseId, tableId, - }) => ({ - baseId, - tableId, - }), - ], - type: "string[]", - label: "Field IDs", - description: "Select which fields/columns to watch for updates.", - withLabel: true, - }, - returnFieldsByFieldId: { - propDefinition: [ - base.props.airtable, - "returnFieldsByFieldId", - ], - }, - }, - methods: { - ...base.methods, - _getFieldValues() { - return this.db.get("fieldValues") || {}; - }, - _setFieldValues(fieldValues) { - this.db.set("fieldValues", fieldValues); - }, - updateFieldValues(newFieldValues, record) { - const fieldKey = this.returnFieldsByFieldId - ? "value" - : "label"; - for (const fieldId of this.fieldIds) { - newFieldValues[record.id] = { - ...newFieldValues[record.id], - [fieldId.value]: record.fields[fieldId[fieldKey]] || null, - }; - } - return newFieldValues; - }, - isUpdated(fieldValues, fieldIds, record) { - const fieldKey = this.returnFieldsByFieldId - ? "value" - : "label"; - for (const fieldId of fieldIds) { - if (!record.fields[fieldId[fieldKey]]) { - record.fields[fieldId[fieldKey]] = null; - } - if (fieldValues[record.id] - && fieldValues[record.id][fieldId.value] !== undefined - && record.fields[fieldId[fieldKey]] !== fieldValues[record.id][fieldId.value] - ) { - return true; - } - } - return false; - }, - }, - async run(event) { - const { - baseId, - tableId, - viewId, - } = this; - - const lastTimestamp = this._getLastTimestamp(); - const fieldValues = this._getFieldValues(); - const isFirstRunWithFields = this.fieldIds && Object.keys(fieldValues).length === 0; - const params = { - returnFieldsByFieldId: this.returnFieldsByFieldId || false, - }; - if (!isFirstRunWithFields) { - params.filterByFormula = `LAST_MODIFIED_TIME() > "${lastTimestamp}"`; - } - - const records = await this.airtable.listRecords({ - baseId, - tableId, - params, - }); - - if (!records.length) { - console.log("No new or modified records."); - return; - } - - const metadata = { - baseId, - tableId, - viewId, - }; - - let newRecords = 0, modifiedRecords = 0; - let newFieldValues = { - ...fieldValues, - }; - for (const record of records) { - if (this.fieldIds) { - newFieldValues = this.updateFieldValues(newFieldValues, record); - } - if (!lastTimestamp || Date.parse(record.createdTime) > Date.parse(lastTimestamp)) { - record.type = "new_record"; - newRecords++; - } else { - if (this.fieldIds - && (!this.isUpdated(fieldValues, this.fieldIds, record) || isFirstRunWithFields) - ) { - continue; - } - record.type = "record_modified"; - modifiedRecords++; - } - - record.metadata = metadata; - - const id = record.id; - this.$emit(record, { - summary: `${record.type === "new_record" - ? "New" - : "Updated"} record: ${id}`, - id, - ts: Date.now(), - }); - } - this._setFieldValues(newFieldValues); - console.log(`Emitted ${newRecords} new records(s) and ${modifiedRecords} modified record(s).`); - - // We keep track of the timestamp of the current invocation - this.updateLastTimestamp(event); - }, - sampleEmit, -}; diff --git a/components/airtable_oauth/sources/new-or-modified-records/test-event.mjs b/components/airtable_oauth/sources/new-or-modified-records/test-event.mjs deleted file mode 100644 index d33e5d1a470a7..0000000000000 --- a/components/airtable_oauth/sources/new-or-modified-records/test-event.mjs +++ /dev/null @@ -1,27 +0,0 @@ -export default { - "id": "recslHzC7AUjXDw", - "createdTime": "2023-07-31T04:29:26.000Z", - "fields": { - "Status": "In progress", - "ID": 27, - "Concat Calculation": "In progress-Medium", - "Record ID": "recslHzC7AUjXDw", - "Last Modified By": { - "id": "usrBLNP11LGUDJNTJ", - "email": "test@test.com", - "name": "Test User" - }, - "Created By": { - "id": "usrBLNP11LGUDJNTJ", - "email": "test@test.com", - "name": "Test User" - }, - "Name": "Pipedream 1129 Kanban", - "Priority": "Medium" - }, - "type": "record_modified", - "metadata": { - "baseId": "appeSZQLVSAD2cz", - "tableId": "tblPay0M5s9" - } - } \ No newline at end of file diff --git a/components/airtable_oauth/sources/new-records-in-view/new-records-in-view.mjs b/components/airtable_oauth/sources/new-records-in-view/new-records-in-view.mjs deleted file mode 100644 index cb4b96d354dc1..0000000000000 --- a/components/airtable_oauth/sources/new-records-in-view/new-records-in-view.mjs +++ /dev/null @@ -1,93 +0,0 @@ -import base from "../common/common.mjs"; - -export default { - ...base, - name: "New Record(s) Created In View", - description: "Emit new event when a record is created in the selected view. [See the documentation](https://airtable.com/developers/web/api/list-records)", - key: "airtable_oauth-new-records-in-view", - version: "0.0.7", - type: "source", - props: { - ...base.props, - tableId: { - propDefinition: [ - base.props.airtable, - "tableId", - ({ baseId }) => ({ - baseId, - }), - ], - description: "Select a table to watch for new records, or provide a table ID.", - }, - viewId: { - propDefinition: [ - base.props.airtable, - "viewId", - ({ - baseId, tableId, - }) => ({ - baseId, - tableId, - }), - ], - description: "Select a view to watch for new records, or provide a view ID.", - }, - returnFieldsByFieldId: { - propDefinition: [ - base.props.airtable, - "returnFieldsByFieldId", - ], - }, - }, - async run() { - const { - baseId, - tableId, - viewId, - } = this; - - const lastTimestamp = this._getLastTimestamp(); - const params = { - view: viewId, - filterByFormula: `CREATED_TIME() > "${lastTimestamp}"`, - returnFieldsByFieldId: this.returnFieldsByFieldId || false, - }; - - const records = await this.airtable.listRecords({ - baseId, - tableId, - params, - }); - - if (!records.length) { - console.log("No new records."); - return; - } - - const metadata = { - baseId, - tableId, - viewId, - }; - - let maxTimestamp; - let recordCount = 0; - for (const record of records) { - record.metadata = metadata; - const ts = Date.parse(record.createdTime).valueOf(); - const id = record.id; - - this.$emit(record, { - ts, - summary: `New record: ID ${id}`, - id, - }); - if (!maxTimestamp || ts > Date.parse(maxTimestamp).valueOf()) { - maxTimestamp = record.createdTime; - } - recordCount++; - } - console.log(`Emitted ${recordCount} new records(s).`); - this._setLastTimestamp(maxTimestamp); - }, -}; diff --git a/components/airtable_oauth/sources/new-records/new-records.mjs b/components/airtable_oauth/sources/new-records/new-records.mjs deleted file mode 100644 index 6f23aefb2308b..0000000000000 --- a/components/airtable_oauth/sources/new-records/new-records.mjs +++ /dev/null @@ -1,79 +0,0 @@ -import base from "../common/common.mjs"; - -export default { - ...base, - name: "New Record(s) Created In Table", - description: "Emit new event when a record is created in the selected table. [See the documentation](https://airtable.com/developers/web/api/list-records)", - key: "airtable_oauth-new-records", - version: "0.0.7", - type: "source", - props: { - ...base.props, - tableId: { - propDefinition: [ - base.props.airtable, - "tableId", - ({ baseId }) => ({ - baseId, - }), - ], - description: "Select a table to watch for new records, or provide a table ID.", - }, - returnFieldsByFieldId: { - propDefinition: [ - base.props.airtable, - "returnFieldsByFieldId", - ], - }, - }, - async run() { - const { - baseId, - tableId, - viewId, - } = this; - - const lastTimestamp = this._getLastTimestamp(); - const params = { - filterByFormula: `CREATED_TIME() > "${lastTimestamp}"`, - returnFieldsByFieldId: this.returnFieldsByFieldId || false, - }; - - const records = await this.airtable.listRecords({ - baseId, - tableId, - params, - }); - - if (!records.length) { - console.log("No new records."); - return; - } - - const metadata = { - baseId, - tableId, - viewId, - }; - - let maxTimestamp; - let recordCount = 0; - for (const record of records) { - record.metadata = metadata; - const ts = Date.parse(record.createdTime).valueOf(); - const id = record.id; - - this.$emit(record, { - ts, - summary: `New record: ID ${id}`, - id, - }); - if (!maxTimestamp || ts > Date.parse(maxTimestamp).valueOf()) { - maxTimestamp = record.createdTime; - } - recordCount++; - } - console.log(`Emitted ${recordCount} new records(s).`); - this._setLastTimestamp(maxTimestamp); - }, -}; From 7acdbad66544ec282631c13d00c1d7f9a8833f06 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 20 Nov 2024 00:45:51 -0300 Subject: [PATCH 14/18] Options improvements --- .../airtable_oauth/sources/common/constants.mjs | 15 ++++++++++++--- .../new-modified-or-deleted-records-instant.mjs | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/components/airtable_oauth/sources/common/constants.mjs b/components/airtable_oauth/sources/common/constants.mjs index 9e5df8dab56e1..dcabb1533a205 100644 --- a/components/airtable_oauth/sources/common/constants.mjs +++ b/components/airtable_oauth/sources/common/constants.mjs @@ -14,9 +14,18 @@ const DATA_TYPES = [ ]; const CHANGE_TYPES = [ - "add", - "remove", - "update", + { + label: "Created", + value: "add", + }, + { + label: "Deleted", + value: "remove", + }, + { + label: "Updated/Modified", + value: "update", + }, ]; const FROM_SOURCES = [ diff --git a/components/airtable_oauth/sources/new-modified-or-deleted-records-instant/new-modified-or-deleted-records-instant.mjs b/components/airtable_oauth/sources/new-modified-or-deleted-records-instant/new-modified-or-deleted-records-instant.mjs index 6b3e1404ccc4c..a3485fc860df9 100644 --- a/components/airtable_oauth/sources/new-modified-or-deleted-records-instant/new-modified-or-deleted-records-instant.mjs +++ b/components/airtable_oauth/sources/new-modified-or-deleted-records-instant/new-modified-or-deleted-records-instant.mjs @@ -6,7 +6,7 @@ export default { name: "New Record Created, Updated or Deleted (Instant)", description: "Emit new event when a record is added, updated, or deleted in a table or selected view. [See the documentation](https://airtable.com/developers/web/api/create-a-webhook)", key: "airtable_oauth-new-modified-or-deleted-records-instant", - version: "0.0.2", + version: "0.1.0", type: "source", dedupe: "unique", props: { From a660587522425ecfbb6044fe40800c1c3fead540 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 20 Nov 2024 12:36:22 -0300 Subject: [PATCH 15/18] Package version bump --- components/airtable_oauth/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/airtable_oauth/package.json b/components/airtable_oauth/package.json index b42f40486604c..71176813f2845 100644 --- a/components/airtable_oauth/package.json +++ b/components/airtable_oauth/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/airtable_oauth", - "version": "0.3.0", + "version": "0.4.0", "description": "Pipedream Airtable (OAuth) Components", "main": "airtable_oauth.app.mjs", "keywords": [ @@ -19,6 +19,5 @@ "lodash": "^4.17.21", "lodash.chunk": "^4.2.0", "lodash.isempty": "^4.4.0", - "moment": "^2.30.1" } } From 38f205392aef82af21fe8c71df472778b98bce46 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 20 Nov 2024 12:37:16 -0300 Subject: [PATCH 16/18] Removing lodash --- components/airtable_oauth/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/airtable_oauth/package.json b/components/airtable_oauth/package.json index 71176813f2845..ca847dfc8e881 100644 --- a/components/airtable_oauth/package.json +++ b/components/airtable_oauth/package.json @@ -16,8 +16,7 @@ "@pipedream/platform": "^1.6.0", "airtable": "^0.11.1", "bottleneck": "^2.19.5", - "lodash": "^4.17.21", "lodash.chunk": "^4.2.0", - "lodash.isempty": "^4.4.0", + "lodash.isempty": "^4.4.0" } } From e887696fb312f0e83a305aeee1363a6e4d073114 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 20 Nov 2024 12:41:05 -0300 Subject: [PATCH 17/18] pnpm --- pnpm-lock.yaml | 106 ++++++++++++++++++++++++------------------------- 1 file changed, 51 insertions(+), 55 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f7315a9f70c3f..bf73bc56261a4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -422,18 +422,14 @@ importers: '@pipedream/platform': ^1.6.0 airtable: ^0.11.1 bottleneck: ^2.19.5 - lodash: ^4.17.21 lodash.chunk: ^4.2.0 lodash.isempty: ^4.4.0 - moment: ^2.30.1 dependencies: '@pipedream/platform': 1.6.0 airtable: 0.11.6 bottleneck: 2.19.5 - lodash: 4.17.21 lodash.chunk: 4.2.0 lodash.isempty: 4.4.0 - moment: 2.30.1 components/aitable_ai: specifiers: @@ -13380,6 +13376,55 @@ 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'} @@ -13615,7 +13660,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 + '@aws-sdk/client-sso-oidc': 3.600.0_tdq3komn4zwyd65w7klbptsu34 '@aws-sdk/core': 3.598.0 '@aws-sdk/credential-provider-node': 3.600.0_f7n47caigsrjd2lr2szmwfuee4 '@aws-sdk/middleware-host-header': 3.598.0 @@ -13657,55 +13702,6 @@ 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'} @@ -18049,7 +18045,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_dseaa2p5u2yk67qiepewcq3hkq + '@aws-sdk/client-sts': 3.600.0 '@aws-sdk/s3-request-presigner': 3.609.0 '@pipedream/helper_functions': 0.3.12 '@pipedream/platform': 1.6.6 From f455463439666b6f2ee558fcee9fb871b8bc85f2 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 20 Nov 2024 12:47:37 -0300 Subject: [PATCH 18/18] Version bumps --- components/airtable_oauth/actions/create-table/create-table.mjs | 2 +- .../airtable_oauth/actions/search-records/search-records.mjs | 2 +- .../airtable_oauth/actions/update-comment/update-comment.mjs | 2 +- components/airtable_oauth/actions/update-table/update-table.mjs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/airtable_oauth/actions/create-table/create-table.mjs b/components/airtable_oauth/actions/create-table/create-table.mjs index cd200a85bdbda..e371a4a1542d6 100644 --- a/components/airtable_oauth/actions/create-table/create-table.mjs +++ b/components/airtable_oauth/actions/create-table/create-table.mjs @@ -4,7 +4,7 @@ export default { key: "airtable_oauth-create-table", name: "Create Table", description: "Create a new table. [See the documentation](https://airtable.com/developers/web/api/create-table)", - version: "0.0.6", + version: "0.0.7", type: "action", props: { airtable, diff --git a/components/airtable_oauth/actions/search-records/search-records.mjs b/components/airtable_oauth/actions/search-records/search-records.mjs index 4ed6b82a44d2a..a9b85c863ac97 100644 --- a/components/airtable_oauth/actions/search-records/search-records.mjs +++ b/components/airtable_oauth/actions/search-records/search-records.mjs @@ -5,7 +5,7 @@ export default { key: "airtable_oauth-search-records", name: "Search Records", description: "Search for a record by formula or by field value. [See the documentation](https://airtable.com/developers/web/api/list-records)", - version: "0.0.8", + version: "0.0.9", type: "action", props: { ...common.props, diff --git a/components/airtable_oauth/actions/update-comment/update-comment.mjs b/components/airtable_oauth/actions/update-comment/update-comment.mjs index a45b3642e9e15..e6711e077ba19 100644 --- a/components/airtable_oauth/actions/update-comment/update-comment.mjs +++ b/components/airtable_oauth/actions/update-comment/update-comment.mjs @@ -4,7 +4,7 @@ export default { key: "airtable_oauth-update-comment", name: "Update Comment", description: "Update an existing comment on a selected record. [See the documentation](https://airtable.com/developers/web/api/update-comment)", - version: "0.0.6", + version: "0.0.7", type: "action", props: { ...common.props, diff --git a/components/airtable_oauth/actions/update-table/update-table.mjs b/components/airtable_oauth/actions/update-table/update-table.mjs index 5f8da7f118013..d43dc6c777d9d 100644 --- a/components/airtable_oauth/actions/update-table/update-table.mjs +++ b/components/airtable_oauth/actions/update-table/update-table.mjs @@ -4,7 +4,7 @@ export default { key: "airtable_oauth-update-table", name: "Update Table", description: "Update an existing table. [See the documentation](https://airtable.com/developers/web/api/update-table)", - version: "0.0.6", + version: "0.0.7", type: "action", props: { ...common.props,