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
3 changes: 0 additions & 3 deletions components/gmail_custom_oauth/.gitignore

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* eslint-disable pipedream/required-properties-name */
/* eslint-disable pipedream/required-properties-description */
/* eslint-disable pipedream/required-properties-version */
/* eslint-disable pipedream/required-properties-type */
import base from "../../../gmail/actions/add-label-to-email/add-label-to-email.mjs";
import overrideApp from "../../common/override-app.mjs";

overrideApp(base);

export default {
...base,
key: "gmail_custom_oauth-add-label-to-email",
};
13 changes: 13 additions & 0 deletions components/gmail_custom_oauth/actions/send-email/send-email.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* eslint-disable pipedream/required-properties-name */
/* eslint-disable pipedream/required-properties-description */
/* eslint-disable pipedream/required-properties-version */
/* eslint-disable pipedream/required-properties-type */
import base from "../../../gmail/actions/send-email/send-email.mjs";
import overrideApp from "../../common/override-app.mjs";

overrideApp(base);

export default {
...base,
key: "gmail_custom_oauth-send-email",
};
13 changes: 0 additions & 13 deletions components/gmail_custom_oauth/app/gmail_custom_oauth.app.ts

This file was deleted.

23 changes: 23 additions & 0 deletions components/gmail_custom_oauth/common/override-app.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import app from "../gmail_custom_oauth.app.mjs";
const appName = "gmail";

/**
* This function substitutes the app so that $auth and propDefinitions correspond to the correct app
* This is done to avoid duplicating code because all component props and methods are shared between
* gorgias_oauth and gorgias (api_key) apps
* @param {*} base app to inject - in this case, gorgias_oauth
*/
function overrideApp(base) {
base.props[appName] = app;

Object.keys(base.props)
.filter((prop) => prop != appName)
.forEach((prop) => {
const { propDefinition } = base.props[prop];
if (propDefinition?.length > 0) {
propDefinition[0] = app;
}
});
}

export default overrideApp;
23 changes: 23 additions & 0 deletions components/gmail_custom_oauth/gmail_custom_oauth.app.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import base from "../gmail/gmail.app.mjs";
import gmail from "@googleapis/gmail";

export default {
...base,
type: "app",
app: "gmail_custom_oauth",
methods: {
_accessToken(){
return this.$auth.oauth_access_token;
},
_client() {
const auth = new gmail.auth.OAuth2();
auth.setCredentials({
access_token: this._accessToken(),
});
return gmail.gmail({
version: "v1",
auth,
});
},
},
};
9 changes: 7 additions & 2 deletions components/gmail_custom_oauth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@
"pipedream",
"gmail_custom_oauth"
],
"files": ["dist"],
"homepage": "https://pipedream.com/apps/gmail_custom_oauth",
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@googleapis/gmail": "^0.3.4",
"@pipedream/platform": "^1.1.1",
"html-to-text": "^8.2.1",
"nodemailer": "^6.7.8"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* eslint-disable pipedream/required-properties-name */
/* eslint-disable pipedream/required-properties-description */
/* eslint-disable pipedream/required-properties-version */
/* eslint-disable pipedream/required-properties-type */
import base from "../../../gmail/sources/new-attachment/new-attachment.mjs";
import overrideApp from "../../common/override-app.mjs";

overrideApp(base);

export default {
...base,
key: "gmail_custom_oauth-new-attachment",
};
13 changes: 13 additions & 0 deletions components/gmail_custom_oauth/sources/new-email/new-email.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* eslint-disable pipedream/required-properties-name */
/* eslint-disable pipedream/required-properties-description */
/* eslint-disable pipedream/required-properties-version */
/* eslint-disable pipedream/required-properties-type */
import base from "../../../gmail/sources/new-email/new-email.mjs";
import overrideApp from "../../common/override-app.mjs";

overrideApp(base);

export default {
...base,
key: "gmail_custom_oauth-new-email",
};
18 changes: 18 additions & 0 deletions pnpm-lock.yaml

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