Skip to content

Commit 567602a

Browse files
committed
Improvements on sources
1 parent 796dae1 commit 567602a

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import common from "../common/common.mjs";
22

33
export default {
44
name: "New Field Created",
5-
description: "Emit new event for each new field created in a table. [See the documentation](https://airtable.com/developers/web/api/get-base-schema)",
5+
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)",
66
key: "airtable_oauth-new-field",
77
version: "0.0.7",
88
type: "source",

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import base from "../common/common.mjs";
2-
import moment from "moment";
32

43
export default {
54
...base,
6-
name: "New Records in View",
7-
description: "Emit new event for each new record in a view",
5+
name: "New Record(s) Created (in View)",
6+
description: "Emit new event when a record is created in the selected view. [See the documentation](https://airtable.com/developers/web/api/list-records)",
87
key: "airtable_oauth-new-records-in-view",
9-
version: "0.0.6",
8+
version: "0.0.7",
109
type: "source",
1110
props: {
1211
...base.props,
@@ -18,7 +17,7 @@ export default {
1817
baseId,
1918
}),
2019
],
21-
description: "The table ID to watch for changes.",
20+
description: "Select a table to watch for new records, or provide a table ID.",
2221
},
2322
viewId: {
2423
propDefinition: [
@@ -31,7 +30,7 @@ export default {
3130
tableId,
3231
}),
3332
],
34-
description: "The view ID to watch for changes.",
33+
description: "Select a view to watch for new records, or provide a view ID.",
3534
},
3635
returnFieldsByFieldId: {
3736
propDefinition: [
@@ -75,13 +74,15 @@ export default {
7574
let recordCount = 0;
7675
for (const record of records) {
7776
record.metadata = metadata;
77+
const ts = Date.parse(record.createdTime).valueOf();
78+
const id = record.id;
7879

7980
this.$emit(record, {
80-
ts: moment(record.createdTime).valueOf(),
81-
summary: JSON.stringify(record.fields),
82-
id: record.id,
81+
ts,
82+
summary: `New record: ID ${id}`,
83+
id,
8384
});
84-
if (!maxTimestamp || moment(record.createdTime).valueOf() > moment(maxTimestamp).valueOf()) {
85+
if (!maxTimestamp || ts > Date.parse(maxTimestamp).valueOf()) {
8586
maxTimestamp = record.createdTime;
8687
}
8788
recordCount++;

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import base from "../common/common.mjs";
2-
import moment from "moment";
32

43
export default {
54
...base,
6-
name: "New Records",
7-
description: "Emit new event for each new record in a table",
5+
name: "New Record(s) Created (in Table)",
6+
description: "Emit new event when a record is created in the selected table. [See the documentation](https://airtable.com/developers/web/api/list-records)",
87
key: "airtable_oauth-new-records",
9-
version: "0.0.6",
8+
version: "0.0.7",
109
type: "source",
1110
props: {
1211
...base.props,
@@ -18,7 +17,7 @@ export default {
1817
baseId,
1918
}),
2019
],
21-
description: "The table ID to watch for changes.",
20+
description: "Select a table to watch for new records, or provide a table ID.",
2221
},
2322
returnFieldsByFieldId: {
2423
propDefinition: [
@@ -61,13 +60,15 @@ export default {
6160
let recordCount = 0;
6261
for (const record of records) {
6362
record.metadata = metadata;
63+
const ts = Date.parse(record.createdTime).valueOf();
64+
const id = record.id;
6465

6566
this.$emit(record, {
66-
ts: moment(record.createdTime).valueOf(),
67-
summary: JSON.stringify(record.fields),
68-
id: record.id,
67+
ts,
68+
summary: `New record: ID ${id}`,
69+
id,
6970
});
70-
if (!maxTimestamp || moment(record.createdTime).valueOf() > moment(maxTimestamp).valueOf()) {
71+
if (!maxTimestamp || ts > Date.parse(maxTimestamp).valueOf()) {
7172
maxTimestamp = record.createdTime;
7273
}
7374
recordCount++;

0 commit comments

Comments
 (0)