Skip to content

Commit f0513c3

Browse files
committed
revert updated-page.mjs
1 parent d1651f8 commit f0513c3

File tree

1 file changed

+5
-38
lines changed

1 file changed

+5
-38
lines changed

components/notion/sources/updated-page/updated-page.mjs

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import sampleEmit from "./test-event.mjs";
33
import base from "../common/base.mjs";
44
import constants from "../common/constants.mjs";
55
import zlib from "zlib";
6-
import { ConfigurationError } from "@pipedream/platform";
76

87
export default {
98
...base,
@@ -39,32 +38,16 @@ export default {
3938
description: "Only emit events when one or more of the selected properties have changed",
4039
optional: true,
4140
},
42-
includeChanges: {
43-
type: "boolean",
44-
label: "Include Changes",
45-
description: "If `false`, the emitted event will not include information about the specific property changes. Must be `true` if `property types` is set. Default: `true`",
46-
default: true,
47-
optional: true,
48-
},
4941
alert: {
5042
type: "alert",
5143
alertType: "warning",
52-
content: "Source not saving? Your database might be too large. If deployment takes longer than one minute, an error will occur. Try removing `property types` and setting `includeChanges` to `false`.",
44+
content: "Source not saving? Your database might be too large. If deployment takes longer than one minute, an error will occur.",
5345
},
5446
},
5547
hooks: {
5648
async activate() {
57-
if (!this.includeChanges && this.properties?.length) {
58-
throw new ConfigurationError("`includeChanges` must be `true` if `properties` are set");
59-
}
60-
61-
this._setLastUpdatedTimestamp(Date.now());
62-
63-
if (!this.includeChanges) {
64-
return;
65-
}
66-
6749
console.log("Activating: fetching pages and properties");
50+
this._setLastUpdatedTimestamp(Date.now());
6851
const propertyValues = {};
6952
const propertiesToCheck = await this._getPropertiesToCheck();
7053
const params = this.lastUpdatedSortParam();
@@ -141,15 +124,14 @@ export default {
141124
: this._generateMeta(page, constants.summaries.PAGE_UPDATED);
142125
const event = {
143126
page,
127+
changes,
144128
};
145-
if (this.includeChanges) {
146-
event.changes = changes;
147-
}
148129
this.$emit(event, meta);
149130
},
150131
},
151132
async run() {
152133
const lastCheckedTimestamp = this._getLastUpdatedTimestamp();
134+
const propertyValues = this._getPropertyValues();
153135

154136
if (!lastCheckedTimestamp) {
155137
// recently updated (deactivated / activated), skip execution
@@ -167,23 +149,8 @@ export default {
167149
},
168150
};
169151
let newLastUpdatedTimestamp = lastCheckedTimestamp;
170-
const pagesStream = this.notion.getPages(this.databaseId, params);
171-
172-
if (!this.includeChanges) {
173-
for await (const page of pagesStream) {
174-
newLastUpdatedTimestamp = Math.max(
175-
newLastUpdatedTimestamp,
176-
Date.parse(page.last_edited_time),
177-
);
178-
const isNewPage = page.last_edited_time === page.created_time;
179-
this._emitEvent(page, [], isNewPage);
180-
}
181-
this._setLastUpdatedTimestamp(newLastUpdatedTimestamp);
182-
return;
183-
}
184-
185152
const propertiesToCheck = await this._getPropertiesToCheck();
186-
const propertyValues = this._getPropertyValues();
153+
const pagesStream = this.notion.getPages(this.databaseId, params);
187154

188155
for await (const page of pagesStream) {
189156
const changes = [];

0 commit comments

Comments
 (0)