Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚧 WIP: update GCal .watch and .list calls to include eve… #87

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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 packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"express": "^4.17.1",
"express-validator": "^6.12.2",
"express-winston": "^4.2.0",
"googleapis": "^112.0.0",
"googleapis": "^133.0.0",
"helmet": "^7.0.0",
"jsonwebtoken": "^9.0.0",
"mongodb": "6.3",
Expand Down
17 changes: 13 additions & 4 deletions packages/backend/src/common/services/gcal/gcal.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { gSchema$Event, gParamsEventsList, gCalendar } from "@core/types/gcal";
import {
gSchema$Channel,
gSchema$Event,
gParamsEventsList,
gCalendar,
} from "@core/types/gcal";
import { GCAL_NOTIFICATION_ENDPOINT } from "@core/constants/core.constants";
import { Params_WatchEvents } from "@core/types/sync.types";
import { ENV } from "@backend/common/constants/env.constants";
Expand Down Expand Up @@ -26,7 +31,10 @@ class GCalService {
}

async getEvents(gcal: gCalendar, params: gParamsEventsList) {
const response = await gcal.events.list(params);
const response = await gcal.events.list({
...params,
eventTypes: ["default"],
});
return response;
}

Expand Down Expand Up @@ -58,9 +66,10 @@ class GCalService {
watchEvents = async (gcal: gCalendar, params: Params_WatchEvents) => {
const { data } = await gcal.events.watch({
calendarId: params.gCalendarId,
eventTypes: ["default"],
requestBody: {
// reminder: address always needs to be HTTPS
address: (ENV.BASEURL as string) + GCAL_NOTIFICATION_ENDPOINT,
address: ENV.BASEURL + GCAL_NOTIFICATION_ENDPOINT,
expiration: params.expiration,
id: params.channelId,
token: ENV.TOKEN_GCAL_NOTIFICATION,
Expand All @@ -69,7 +78,7 @@ class GCalService {
syncToken: params.nextSyncToken,
});

return { watch: data };
return { watch: data as gSchema$Channel };
};
}

Expand Down
70 changes: 58 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7274,6 +7274,16 @@ gaxios@^5.0.0, gaxios@^5.0.1:
is-stream "^2.0.0"
node-fetch "^2.6.9"

gaxios@^6.0.0, gaxios@^6.0.3, gaxios@^6.1.1:
version "6.3.0"
resolved "https://registry.yarnpkg.com/gaxios/-/gaxios-6.3.0.tgz#5cd858de47c6560caaf0f99bb5d89c5bdfbe9034"
integrity sha512-p+ggrQw3fBwH2F5N/PAI4k/G/y1art5OxKpb2J2chwNNHM4hHuAOtivjPuirMF4KNKwTTUal/lPfL2+7h2mEcg==
dependencies:
extend "^3.0.2"
https-proxy-agent "^7.0.1"
is-stream "^2.0.0"
node-fetch "^2.6.9"

gcp-metadata@^5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/gcp-metadata/-/gcp-metadata-5.3.0.tgz#6f45eb473d0cb47d15001476b48b663744d25408"
Expand All @@ -7282,6 +7292,14 @@ gcp-metadata@^5.3.0:
gaxios "^5.0.0"
json-bigint "^1.0.0"

gcp-metadata@^6.1.0:
version "6.1.0"
resolved "https://registry.yarnpkg.com/gcp-metadata/-/gcp-metadata-6.1.0.tgz#9b0dd2b2445258e7597f2024332d20611cbd6b8c"
integrity sha512-Jh/AIwwgaxan+7ZUUmRLCjtchyDiqh4KjBJ5tW3plBZb5iL/BPcso8A5DlzeD9qlw0duCamnNdpFjxwaT0KyKg==
dependencies:
gaxios "^6.0.0"
json-bigint "^1.0.0"

gensync@^1.0.0-beta.2:
version "1.0.0-beta.2"
resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0"
Expand Down Expand Up @@ -7472,6 +7490,18 @@ google-auth-library@^8.0.2:
jws "^4.0.0"
lru-cache "^6.0.0"

google-auth-library@^9.0.0:
version "9.6.3"
resolved "https://registry.yarnpkg.com/google-auth-library/-/google-auth-library-9.6.3.tgz#add8935bc5b842a8e80f84fef2b5ed9febb41d48"
integrity sha512-4CacM29MLC2eT9Cey5GDVK4Q8t+MMp8+OEdOaqD9MG6b0dOyLORaaeJMPQ7EESVgm/+z5EKYyFLxgzBJlJgyHQ==
dependencies:
base64-js "^1.3.0"
ecdsa-sig-formatter "^1.0.11"
gaxios "^6.1.1"
gcp-metadata "^6.1.0"
gtoken "^7.0.0"
jws "^4.0.0"

google-gax@^3.5.8:
version "3.6.1"
resolved "https://registry.yarnpkg.com/google-gax/-/google-gax-3.6.1.tgz#02c78fc496f5adf86f2ca9145545f4b6575f6118"
Expand Down Expand Up @@ -7500,25 +7530,25 @@ google-p12-pem@^4.0.0:
dependencies:
node-forge "^1.3.1"

googleapis-common@^6.0.0:
version "6.0.4"
resolved "https://registry.yarnpkg.com/googleapis-common/-/googleapis-common-6.0.4.tgz#bd968bef2a478bcd3db51b27655502a11eaf8bf4"
integrity sha512-m4ErxGE8unR1z0VajT6AYk3s6a9gIMM6EkDZfkPnES8joeOlEtFEJeF8IyZkb0tjPXkktUfYrE4b3Li1DNyOwA==
googleapis-common@^7.0.0:
version "7.0.1"
resolved "https://registry.yarnpkg.com/googleapis-common/-/googleapis-common-7.0.1.tgz#c85d0ee605ff0be9f604b963c69dfd27e46f6dec"
integrity sha512-mgt5zsd7zj5t5QXvDanjWguMdHAcJmmDrF9RkInCecNsyV7S7YtGqm5v2IWONNID88osb7zmx5FtrAP12JfD0w==
dependencies:
extend "^3.0.2"
gaxios "^5.0.1"
google-auth-library "^8.0.2"
gaxios "^6.0.3"
google-auth-library "^9.0.0"
qs "^6.7.0"
url-template "^2.0.8"
uuid "^9.0.0"

googleapis@^112.0.0:
version "112.0.0"
resolved "https://registry.yarnpkg.com/googleapis/-/googleapis-112.0.0.tgz#e957811a1df3c408f934c0047e091d5d8f14b7ef"
integrity sha512-WPfXhYZVrbbJRxB+ZZDksjuelmt49Mcl/1mo7w05kvLS1EbynvTELsNTJwh+hNrjsFKdh4izWLAcjTDo0Boycg==
googleapis@^133.0.0:
version "133.0.0"
resolved "https://registry.yarnpkg.com/googleapis/-/googleapis-133.0.0.tgz#e8d2f7128eb60d1c268dde91b6e17f5c5403790a"
integrity sha512-6xyc49j+x7N4smawJs/q1i7mbSkt6SYUWWd9RbsmmDW7gRv+mhwZ4xT+XkPihZcNyo/diF//543WZq4szdS74w==
dependencies:
google-auth-library "^8.0.2"
googleapis-common "^6.0.0"
google-auth-library "^9.0.0"
googleapis-common "^7.0.0"

gopd@^1.0.1:
version "1.0.1"
Expand Down Expand Up @@ -7590,6 +7620,14 @@ gtoken@^6.1.0:
google-p12-pem "^4.0.0"
jws "^4.0.0"

gtoken@^7.0.0:
version "7.1.0"
resolved "https://registry.yarnpkg.com/gtoken/-/gtoken-7.1.0.tgz#d61b4ebd10132222817f7222b1e6064bd463fc26"
integrity sha512-pCcEwRi+TKpMlxAQObHDQ56KawURgyAf6jtIY046fJ5tIv3zDe/LEIubckAO8fj6JnAxLdmWkUfNyulQ2iKdEw==
dependencies:
gaxios "^6.0.0"
jws "^4.0.0"

gzip-size@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-6.0.0.tgz#065367fd50c239c0671cbcbad5be3e2eeb10e462"
Expand Down Expand Up @@ -7920,6 +7958,14 @@ [email protected], https-proxy-agent@^5.0.0, https-proxy-agent@^5.0.1:
agent-base "6"
debug "4"

https-proxy-agent@^7.0.1:
version "7.0.4"
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz#8e97b841a029ad8ddc8731f26595bad868cb4168"
integrity sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==
dependencies:
agent-base "^7.0.2"
debug "4"

https-proxy-agent@^7.0.2:
version "7.0.2"
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.2.tgz#e2645b846b90e96c6e6f347fb5b2e41f1590b09b"
Expand Down
Loading