Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/notion/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/notion",
"version": "0.1.2",
"version": "0.1.3",
"description": "Pipedream Notion Components",
"main": "notion.app.mjs",
"keywords": [
Expand Down
12 changes: 9 additions & 3 deletions components/notion/sources/updated-page/updated-page.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "notion-updated-page",
name: "Updated Page in Database", /* eslint-disable-line pipedream/source-name */
description: "Emit new event when a page in a database is updated. To select a specific page, use `Updated Page ID` instead",
version: "0.0.7",
version: "0.0.8",
type: "source",
dedupe: "unique",
props: {
Expand All @@ -23,12 +23,13 @@ export default {
async run() {
const params = this.lastUpdatedSortParam();
const lastCheckedTimestamp = this.getLastUpdatedTimestamp();
let newLastUpdatedTimestamp = lastCheckedTimestamp;

const pagesStream = this.notion.getPages(this.databaseId, params);

for await (const page of pagesStream) {
if (!this.isResultNew(page.last_edited_time, lastCheckedTimestamp)) {
break;
continue;
}

const meta = this.generateMeta(
Expand All @@ -41,8 +42,13 @@ export default {

this.$emit(page, meta);

this.setLastUpdatedTimestamp(Date.parse(page?.last_edited_time));
newLastUpdatedTimestamp = Math.max(
newLastUpdatedTimestamp,
Date.parse(page?.last_edited_time),
);
}

this.setLastUpdatedTimestamp(newLastUpdatedTimestamp);
},
sampleEmit,
};
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.