Skip to content

Commit a036e56

Browse files
committed
add eventName filter
1 parent 8b02c21 commit a036e56

File tree

6 files changed

+28
-12
lines changed

6 files changed

+28
-12
lines changed

components/google_workspace/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/google_workspace",
3-
"version": "0.0.7",
3+
"version": "0.0.8",
44
"description": "Pipedream Google Workspace Admin Components",
55
"main": "dist/app/google_workspace.app.mjs",
66
"keywords": [
@@ -17,7 +17,7 @@
1717
},
1818
"dependencies": {
1919
"@googleapis/admin": "^6.0.2",
20-
"@pipedream/platform": "^1.2.0",
20+
"@pipedream/platform": "^3.1.0",
2121
"googleapis": "^108.0.0",
2222
"uuidv4": "^6.2.13"
2323
},

components/google_workspace/sources/common.ts renamed to components/google_workspace/sources/common/common.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import {
44
ConfigurationError,
55
DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
66
} from "@pipedream/platform";
7-
import googleWorkspace from "../app/google_workspace.app";
8-
import constants from "../common/constants";
7+
import googleWorkspace from "../../app/google_workspace.app";
8+
import constants from "../../common/constants";
99

1010
export default {
1111
props: {
@@ -19,6 +19,12 @@ export default {
1919
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
2020
},
2121
},
22+
eventName: {
23+
propDefinition: [
24+
googleWorkspace,
25+
"eventName",
26+
],
27+
},
2228
},
2329
hooks: {
2430
async activate() {
@@ -115,6 +121,12 @@ export default {
115121
getMetadata() {
116122
throw new Error("getMetadata not implemented!");
117123
},
124+
isCorrectEventType(data) {
125+
if (this.eventName) {
126+
return data.events.find((event) => event.name === this.eventName);
127+
}
128+
return true;
129+
},
118130
},
119131
async run(event) {
120132
const {
@@ -144,6 +156,10 @@ export default {
144156
} = body;
145157

146158
events.forEach((event) => {
159+
if (!this.isCorrectEventType(event)) {
160+
return;
161+
}
162+
147163
const data = {
148164
...otherProps,
149165
...event,

components/google_workspace/sources/new-admin-activity-by-app-name/new-admin-activity-by-app-name.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { defineSource } from "@pipedream/types";
2-
import common from "../common";
2+
import common from "../common/common";
33

44
export default defineSource({
55
...common,
66
key: "google_workspace-new-admin-activity-by-app-name",
77
name: "New Admin Activity By Application Name",
88
description: "Emit new admin activities by selected user",
9-
version: "0.0.4",
9+
version: "0.0.5",
1010
type: "source",
1111
dedupe: "unique",
1212
props: {

components/google_workspace/sources/new-admin-activity-by-user-and-app-name/new-admin-activity-by-user-and-app-name.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { defineSource } from "@pipedream/types";
2-
import common from "../common";
2+
import common from "../common/common";
33

44
export default defineSource({
55
...common,
66
key: "google_workspace-new-admin-activity-by-user-and-app-name",
77
name: "New Admin Activity By User And Application Name",
88
description: "Emit new admin activities by selected user and application name",
9-
version: "0.0.4",
9+
version: "0.0.5",
1010
type: "source",
1111
dedupe: "unique",
1212
props: {

components/google_workspace/sources/new-admin-activity-by-user/new-admin-activity-by-user.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { defineSource } from "@pipedream/types";
2-
import common from "../common";
2+
import common from "../common/common";
33

44
export default defineSource({
55
...common,
66
key: "google_workspace-new-admin-activity-by-user",
77
name: "New Admin Activity By User",
88
description: "Emit new admin activities by selected user",
9-
version: "0.0.4",
9+
version: "0.0.5",
1010
type: "source",
1111
dedupe: "unique",
1212
props: {

components/google_workspace/sources/new-admin-activity/new-admin-activity.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { defineSource } from "@pipedream/types";
2-
import common from "../common";
2+
import common from "../common/common";
33

44
export default defineSource({
55
...common,
66
key: "google_workspace-new-admin-activity",
77
name: "New Admin Activity",
88
description: "Emit new admin activities",
9-
version: "0.0.4",
9+
version: "0.0.5",
1010
type: "source",
1111
dedupe: "unique",
1212
methods: {

0 commit comments

Comments
 (0)