Skip to content

Commit cab4af5

Browse files
committed
Adding dedupe: unique and always including previous values
1 parent f4f3820 commit cab4af5

File tree

9 files changed

+32
-35
lines changed

9 files changed

+32
-35
lines changed

components/airtable_oauth/sources/common/common-webhook-field.mjs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,9 @@ export default {
2323
}),
2424
],
2525
type: "string[]",
26-
label: "Watch Schemas of Field Ids",
26+
label: "Field Schemas to Watch",
2727
description:
2828
"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",
2929
},
30-
includePreviousFieldDefinitions: {
31-
type: "boolean",
32-
label: "Include Previous Field Definitions",
33-
description:
34-
"If true, include the previous field definition in the event payload",
35-
optional: true,
36-
},
3730
},
3831
};

components/airtable_oauth/sources/common/common-webhook.mjs

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -48,37 +48,29 @@ export default {
4848
},
4949
hooks: {
5050
async activate() {
51-
const filters = {
52-
recordChangeScope: this.viewId
53-
? this.viewId
54-
: this.tableId
55-
? this.tableId
56-
: undefined,
57-
dataTypes: this.getDataTypes(),
58-
changeTypes: this.getChangeTypes(),
59-
fromSources: this.fromSources,
60-
watchDataInFieldIds: this.watchDataInFieldIds,
61-
watchSchemasOfFieldIds: this.watchSchemasOfFieldIds,
62-
};
63-
64-
const includes = {
65-
includeCellValuesInFieldIds: this.includeCellValuesInFieldIds,
66-
includePreviousCellValues: this.includePreviousCellValues,
67-
includePreviousFieldDefinitions: this.includePreviousFieldDefinitions,
68-
};
69-
7051
const { id } = await this.airtable.createWebhook({
7152
baseId: this.baseId,
7253
data: {
7354
notificationUrl: `${this.http.endpoint}/`,
7455
specification: {
7556
options: {
76-
filters: Object.keys(filters).length
77-
? filters
78-
: undefined,
79-
includes: Object.keys(includes).length
80-
? includes
81-
: undefined,
57+
filters: {
58+
recordChangeScope: this.viewId
59+
? this.viewId
60+
: this.tableId
61+
? this.tableId
62+
: undefined,
63+
dataTypes: this.getDataTypes(),
64+
changeTypes: this.getChangeTypes(),
65+
fromSources: this.fromSources,
66+
watchDataInFieldIds: this.watchDataInFieldIds,
67+
watchSchemasOfFieldIds: this.watchSchemasOfFieldIds,
68+
},
69+
includes: {
70+
includeCellValuesInFieldIds: this.includeCellValuesInFieldIds,
71+
includePreviousCellValues: true,
72+
includePreviousFieldDefinitions: true,
73+
},
8274
},
8375
},
8476
},
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import common from "../common/common-webhook-field.mjs";
1+
import common from "../common/common-webhook.mjs";
22

33
export default {
44
...common,
@@ -7,12 +7,18 @@ export default {
77
key: "airtable_oauth-new-field",
88
version: "1.0.0",
99
type: "source",
10+
dedupe: "unique",
1011
methods: {
1112
...common.methods,
1213
getChangeTypes() {
1314
return [
1415
"add",
1516
];
1617
},
18+
getDataTypes() {
19+
return [
20+
"tableFields",
21+
];
22+
},
1723
},
1824
};

components/airtable_oauth/sources/new-modified-or-deleted-records/new-modified-or-deleted-records.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import moment from "moment";
44
export default {
55
...base,
66
name: "New, Modified or Deleted Records",
7+
description: "Emit new event each time a record is added, updated, or deleted in an Airtable table. Supports tables up to 10,000 records",
78
key: "airtable_oauth-new-modified-or-deleted-records",
89
version: "0.0.8",
910
type: "source",
10-
description: "Emit new event each time a record is added, updated, or deleted in an Airtable table. Supports tables up to 10,000 records",
11+
dedupe: "unique",
1112
props: {
1213
...base.props,
1314
tableId: {

components/airtable_oauth/sources/new-or-modified-field/new-or-modified-field.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export default {
77
key: "airtable_oauth-new-or-modified-field",
88
version: "1.0.0",
99
type: "source",
10+
dedupe: "unique",
1011
methods: {
1112
...common.methods,
1213
getChangeTypes() {

components/airtable_oauth/sources/new-or-modified-records-in-view/new-or-modified-records-in-view.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export default {
88
key: "airtable_oauth-new-or-modified-records-in-view",
99
version: "0.0.8",
1010
type: "source",
11+
dedupe: "unique",
1112
props: {
1213
...base.props,
1314
tableId: {

components/airtable_oauth/sources/new-or-modified-records/new-or-modified-records.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export default {
77
description: "Emit new event for each new or modified record in a table or view",
88
version: "1.0.0",
99
type: "source",
10+
dedupe: "unique",
1011
methods: {
1112
...common.methods,
1213
getChangeTypes() {

components/airtable_oauth/sources/new-records-in-view/new-records-in-view.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export default {
88
key: "airtable_oauth-new-records-in-view",
99
version: "0.0.8",
1010
type: "source",
11+
dedupe: "unique",
1112
props: {
1213
...base.props,
1314
tableId: {

components/airtable_oauth/sources/new-records/new-records.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export default {
77
key: "airtable_oauth-new-records",
88
version: "1.0.0",
99
type: "source",
10+
dedupe: "unique",
1011
methods: {
1112
...common.methods,
1213
getChangeTypes() {

0 commit comments

Comments
 (0)