Skip to content

Commit 42b5082

Browse files
committed
ESLint + pnpm install
1 parent 1bb08fa commit 42b5082

File tree

9 files changed

+66
-40
lines changed

9 files changed

+66
-40
lines changed

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

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ export default {
1010
];
1111
},
1212
async saveAdditionalData() {
13-
const tableData = await this.airtable.listTables({ baseId: this.baseId });
14-
const filteredData = tableData?.tables?.map(({ id, name, fields}) => ({
13+
const tableData = await this.airtable.listTables({
14+
baseId: this.baseId,
15+
});
16+
const filteredData = tableData?.tables?.map(({
17+
id, name, fields,
18+
}) => ({
1519
id,
1620
name,
1721
fields,
@@ -21,32 +25,43 @@ export default {
2125
}
2226
},
2327
async emitEvent(payload) {
24-
const [tableId, tableData] = Object.entries(payload.changedTablesById)[0];
25-
const [operation, fieldObj] = Object.entries(tableData)[0];
26-
const [fieldId, fieldUpdateInfo] = Object.entries(fieldObj)[0];
28+
const [
29+
tableId,
30+
tableData,
31+
] = Object.entries(payload.changedTablesById)[0];
32+
const [
33+
operation,
34+
fieldObj,
35+
] = Object.entries(tableData)[0];
36+
const [
37+
fieldId,
38+
fieldUpdateInfo,
39+
] = Object.entries(fieldObj)[0];
2740

2841
const timestamp = Date.parse(payload.timestamp);
2942
if (this.isDuplicateEvent(fieldId, timestamp)) return;
3043
this._setLastObjectId(fieldId);
3144
this._setLastTimestamp(timestamp);
3245

33-
const updateType = operation === "createdFieldsById" ? "created" : "updated";
46+
const updateType = operation === "createdFieldsById"
47+
? "created"
48+
: "updated";
3449

3550
let table = {
3651
id: tableId,
37-
}
52+
};
3853
let field = {
3954
id: fieldId,
40-
}
55+
};
4156

4257
const tableSchemas = this.db.get("tableSchemas");
4358
if (tableSchemas) {
44-
table = tableSchemas.find(({ id }) => id === tableId)
59+
table = tableSchemas.find(({ id }) => id === tableId);
4560
field = table?.fields.find(({ id }) => id === fieldId);
4661
delete table.fields;
4762
}
4863

49-
const summary = `Field ${updateType}: ${field.name ?? fieldUpdateInfo?.name ?? field.id}`
64+
const summary = `Field ${updateType}: ${field.name ?? fieldUpdateInfo?.name ?? field.id}`;
5065

5166
this.$emit({
5267
originalPayload: payload,

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

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import common from "./common-webhook.mjs";
32

43
export default {
@@ -11,18 +10,26 @@ export default {
1110
];
1211
},
1312
async emitEvent(payload) {
14-
const [tableId, tableData] = Object.entries(payload.changedTablesById)[0];
15-
let [operation, recordObj] = Object.entries(tableData)[0];
16-
if (operation === 'changedViewsById') {
13+
const [
14+
tableId,
15+
tableData,
16+
] = Object.entries(payload.changedTablesById)[0];
17+
let [
18+
operation,
19+
recordObj,
20+
] = Object.entries(tableData)[0];
21+
if (operation === "changedViewsById") {
1722
const changedRecord = Object.entries(recordObj)[0];
1823
operation = changedRecord[0];
1924
recordObj = changedRecord[1];
2025
}
2126

22-
// for deleted record(s) we'll emit only their ids (no other info is available)
23-
if (operation === 'destroyedRecordIds' && Array.isArray(recordObj)) {
27+
// for deleted record(s) we'll emit only their ids (no other info is available)
28+
if (operation === "destroyedRecordIds" && Array.isArray(recordObj)) {
2429
const { length } = recordObj;
25-
const summary = length === 1 ? `Record deleted: ${recordObj[0]}` : `${length} records deleted`;
30+
const summary = length === 1
31+
? `Record deleted: ${recordObj[0]}`
32+
: `${length} records deleted`;
2633
this.$emit({
2734
originalPayload: payload,
2835
tableId,
@@ -31,19 +38,24 @@ export default {
3138
return;
3239
}
3340

34-
const [recordId, recordUpdateInfo] = Object.entries(recordObj)[0];
41+
const [
42+
recordId,
43+
recordUpdateInfo,
44+
] = Object.entries(recordObj)[0];
3545

3646
const timestamp = Date.parse(payload.timestamp);
3747
if (this.isDuplicateEvent(recordId, timestamp)) return;
3848
this._setLastObjectId(recordId);
3949
this._setLastTimestamp(timestamp);
4050

41-
let updateType = operation === "createdRecordsById" ? 'created' : 'updated';
51+
let updateType = operation === "createdRecordsById"
52+
? "created"
53+
: "updated";
4254

4355
const { fields } = await this.airtable.getRecord({
4456
baseId: this.baseId,
4557
tableId,
46-
recordId
58+
recordId,
4759
});
4860

4961
const summary = `Record ${updateType}: ${fields?.name ?? recordId}`;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export default {
174174
try {
175175
await this.emitEvent(payload);
176176
} catch (err) {
177-
console.log('Error emitting event, defaulting to default emission');
177+
console.log("Error emitting event, defaulting to default emission");
178178
console.log(err);
179179
this.emitDefaultEvent(payload);
180180
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ export default {
1919
description: "Select the types of record updates that should emit events. If not specified, all updates will emit events.",
2020
options: constants.CHANGE_TYPES,
2121
optional: true,
22-
default: ["add", "remove", "update"],
22+
default: [
23+
"add",
24+
"remove",
25+
"update",
26+
],
2327
},
2428
watchDataInFieldIds: {
2529
propDefinition: [

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,4 @@ export default {
126126
// We keep track of the timestamp of the current invocation
127127
this.updateLastTimestamp(event);
128128
},
129-
};
129+
};

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ export default {
3434
description:
3535
"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",
3636
},
37-
}
37+
},
3838
};

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@ export default {
9494
// We keep track of the timestamp of the current invocation
9595
this.updateLastTimestamp(event);
9696
},
97-
};
97+
};

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,4 @@ export default {
9090
console.log(`Emitted ${recordCount} new records(s).`);
9191
this._setLastTimestamp(maxTimestamp);
9292
},
93-
};
93+
};

pnpm-lock.yaml

Lines changed: 9 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)