Skip to content

Commit bfee91a

Browse files
tyler-daneCopilotvictor-enogwedependabot[bot]Copilot
authored
refactor(backend): remove global googleapis (#1396)
* Initial plan * Refactor: Replace googleapis with @googleapis/calendar and gaxios Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com> * Fix GaxiosError mock objects for compatibility with gaxios library Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com> * Address code review: Add code property to GaxiosError instances Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com> * ➖ chore(dependencies): remove unused express-validator and express-winston packages (#1339) * build(deps): bump validator from 13.15.20 to 13.15.23 Bumps [validator](https://github.com/validatorjs/validator.js) from 13.15.20 to 13.15.23. - [Release notes](https://github.com/validatorjs/validator.js/releases) - [Changelog](https://github.com/validatorjs/validator.js/blob/master/CHANGELOG.md) - [Commits](validatorjs/validator.js@13.15.20...13.15.23) --- updated-dependencies: - dependency-name: validator dependency-version: 13.15.23 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * ➖ chore(dependencies): remove unused express-validator and express-winston packages --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Dane <tyler@switchback.tech> Co-authored-by: Victor Enogwe <23452630+victor-enogwe@users.noreply.github.com> * :sparkles feat(day-view): show preview for new events (#1371) * :sparkles feat(day-view): show preview for new events - Added `useOpenAgendaEventPreview` and `useOpenEventContextMenu` hooks to manage event previews and context menus. - Created tests for both hooks to ensure correct functionality when interacting with events. - Refactored event form handling in `useOpenEventForm` to streamline event creation and editing. - Introduced `useCloseEventForm` hook to handle closing event forms and resetting drafts. - Updated `useSaveEventForm` to integrate with the new close event form logic. - Enhanced utility functions for event handling and focus management. - Removed unnecessary context providers from `DayViewContent` for cleaner component structure. - add a re-resizable package * :sparkles feat: refactor event handling and improve test setups * fix: update existing event check to return false instead of null * Update packages/web/src/components/DND/Resizable.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * :bug fix: ensure element scrolls into view before focusing in focusElement function --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * docs: replace discord links in README (#1383) * Update issue template and command palette links to reflect GitHub Discussions instead of Discord. This change enhances community engagement by directing users to the appropriate platform for questions and feedback. * Update README.md to reflect new project description and community engagement links. Changed project description to emphasize its role as a minimal task manager for engineers and updated contact links to direct users to GitHub Discussions instead of Discord. * Update .github/ISSUE_TEMPLATE/config.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update packages/web/src/common/constants/more.cmd.constants.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update .github/ISSUE_TEMPLATE/config.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * feat: add a11y skills agent (#1387) * feat(accessibility): add Accessibility Change Audit guideline document - Introduced a new SKILL.md file outlining the Accessibility Change Audit process. - The document provides an overview, usage scenarios, a checklist for auditing UI changes, and minimal fix patterns to enhance accessibility in UI components. - Aimed at improving semantic structure, catching accessibility regressions, and increasing test reliability. * refactor(accessibility): update Accessibility Change Audit guidelines - Enhanced the description to include accessibility audits and flaky UI tests. - Clarified prerequisites and instructions for conducting audits. - Introduced a diff-first approach for evaluating UI changes. - Expanded the audit checklist and output format for better clarity and usability. * feat(accessibility): introduce new a11y-audit skills and update existing guidelines - Added new SKILL.md files for `claude-a11y-audit` and `codex-a11y-audit`, providing detailed descriptions for accessibility audits. - Updated the existing `accessibility-change-audit` SKILL.md to rename it to `a11y-audit` for consistency and clarity. - Adjusted .gitignore to exclude specific settings files. * feat(a11y): add codex-a11y-audit skill documentation - Introduced a new SKILL.md file for `codex-a11y-audit`, detailing its use for reviewing UI diffs, accessibility audits, and identifying a11y regressions. - The document includes a link to the canonical skill for consistency in accessibility auditing practices. * feat(a11y): update a11y-audit skill documentation and introduce new file - Updated the SKILL.md files for `claude-a11y-audit` and `codex-a11y-audit` to link to the new `a11y-audit` documentation. - Introduced a comprehensive SKILL.md file for `a11y-audit`, detailing its purpose, prerequisites, instructions, and a checklist for conducting accessibility audits. - Enhanced the document to provide clear guidelines for identifying accessibility regressions and proposing minimal fixes. * :sparkles feat(agenda-event resize): support resizable agenda event preview * Initial plan * Implement resizable event preview with top and bottom handles Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com> * Address code review feedback: improve resize logic and reduce duplication Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com> * :sparkles feat(agenda-event resize): support resizable agenda event preview :package deps(rxjs-state-management): introduce rxjs state @ngneat/elf library - Updated EventContextMenu and related components to utilize activeEvent$ observable for managing active events. - Replaced setDraft with resetDraft and resetActiveEvent in event form hooks to improve state management. - Refactored tests to mock new event store structure and ensure proper event handling. - Introduced utility functions for calculating event height and rounding minutes to nearest fifteen. - Updated yarn.lock to include new dependencies for @ngneat/elf-entities and @ngneat/use-observable. * :bugfix fix(resize-agenda-event): improve event handling and add tests * Update packages/web/src/common/hooks/useEventResizeActions.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * feat(resize-agenda-event): add bounds parameter to useEventResizeActions for improved resizing logic * refactor(useEventResizeActions): remove debug log from resizing function * feat(useEventResizeActions): enhance resizing logic with bounds clamping and update tests --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * :bug fix(agenda-loading): fix AgendaSkeleton displaying on every event reload (#1390) * Initial plan * Add LoadingProgressLine component and update TimedAgendaEvents to use it Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com> * Add tests for LoadingProgressLine and update Agenda tests Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com> * Update LoadingProgressLine component comment for clarity Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com> * Move LoadingProgressLine inside mainGrid with absolute positioning Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com> * Move LoadingProgressLine to top of ID_GRID_EVENTS_TIMED (timedEvents div) Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com> * :bug fix(agenda-loading): make loading animation subtle * refactor(tests): remove absolute positioning test for LoadingProgressLine * feat(hooks): add useHasLoadedOnce hook for tracking initial load state refactor(agenda): integrate useHasLoadedOnce in Agenda and TimedAgendaEvents components * test(agenda): improve loading state handling and progress line rendering * test(hooks): add tests for useHasLoadedOnce hook functionality --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com> * :sparkles feat(agenda-events): select surface to create timed events (#1392) chore: update dev dependencies add jest-canvas-mock * :sparkles feat(agenda-events): add event shortcuts (n, m) to Day view command palette (#1389) * Initial plan * Add Create event [n] and Edit event [m] to DayCmdPalette with tests Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com> * Fix test mocks and pass all tests with linting Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com> * Remove unnecessary onEventTargetVisibility wrapper from event shortcuts Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com> * :bug fix(DayCmdPalette): update event handlers to use queueMicrotask to stagger open and keep focus on open --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com> * :sparkles feat(agenda-events): fix event form context menu visibility (#1393) * :sparkles feat(agenda-events): improve z-index mgmt within event form add event context menu delete and duplicate functionalities * fix(context-menu): do not close form if delete is not confirmed * fix(context-menu): delete draft events on confirmation * update yarn.lock * refactor(auth, user, error handling): improve error messages and handling in authentication and user services - Updated error messages in `google.auth.service.ts` to clarify authentication client initialization issues. - Enhanced error handling in `user.controller.ts` to catch and respond to `BaseError` instances appropriately. - Added logging in `error.express.handler.ts` for better debugging of errors. - Improved user profile retrieval error message in `user.service.ts` for clarity. - Adjusted user profile loading logic in `UserProvider.tsx` to prevent unnecessary re-renders. - Updated API response handling in `compass.api.ts` to redirect users to onboarding on profile not found errors. * refactor(user.controller): enhance error handling for user metadata retrieval - Wrapped user metadata fetching logic in try-catch blocks to handle potential errors. - Improved response handling for `BaseError` instances, ensuring appropriate status codes are returned. - Maintained existing functionality while increasing robustness against errors during user metadata operations. * refactor(user.service, StorageInfoModal): remove debug log and simplify text - Removed console log statement from `user.service.ts` to clean up the code. - Simplified the explanatory text in `StorageInfoModal.tsx` for better clarity and conciseness. * refactor(error.express.handler): remove debug log for cleaner error handling - Removed console log statement from `error.express.handler.ts` to streamline error handling and improve code clarity. * refactor(mock.events.init, error mocks): streamline error handling and improve mock structure - Removed unused type imports and simplified the event simulation function in `mock.events.init.ts`. - Enhanced error mock structures in `error.google.invalidGrant.ts`, `error.google.invalidValue.ts`, and `error.invalidSyncToken.ts` by using `Headers` and `URL` objects for better clarity and consistency. - Updated error handling to include more detailed response structures, improving the robustness of the mocks. * refactor(gcal.factory, google.auth.service, error.express.handler, gcal.service, gcal.utils): enhance mock responses and error handling - Introduced a `createMockGaxiosResponse` function in `gcal.factory.ts` to standardize mock responses for Google Calendar API interactions. - Updated error handling in `google.auth.service.ts` to provide more detailed GaxiosError structures. - Improved URL handling in `error.express.handler.ts` for better email extraction from error configurations. - Modified response validation in `gcal.service.ts` to accommodate new response structures. - Enhanced error checking in `gcal.utils.ts` to ensure proper handling of error codes. * chore: add return to user.controller --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent b03703c commit bfee91a

20 files changed

Lines changed: 618 additions & 305 deletions

File tree

packages/backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
"main": "build/src/app.js",
77
"dependencies": {
88
"@compass/core": "1.0.0",
9+
"@googleapis/calendar": "^14.1.0",
910
"chalk": "4.1.2",
1011
"cors": "^2.8.5",
1112
"dotenv": "^16.0.0",
1213
"exponential-backoff": "^3.1.2",
1314
"express": "^4.17.1",
14-
"googleapis": "^112.0.0",
1515
"helmet": "^7.0.0",
1616
"lodash.mergewith": "^4.6.2",
1717
"mongodb": "6.3",

packages/backend/src/__tests__/helpers/mock.events.init.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import type { GaxiosPromise } from "gaxios";
2-
import { calendar_v3, google } from "googleapis";
31
import { ObjectId, WithoutId } from "mongodb";
42
import { Options } from "rrule";
3+
import { calendar } from "@googleapis/calendar";
54
import { Origin } from "@core/constants/core.constants";
65
import { MapEvent } from "@core/mappers/map.event";
76
import { Schema_Event, WithCompassId } from "@core/types/event.types";
@@ -34,8 +33,8 @@ export interface State_AfterGcalImport {
3433
*/
3534
export const simulateGoogleCalendarEventCreation = async (
3635
event: gSchema$Event,
37-
): GaxiosPromise<calendar_v3.Schema$Event> => {
38-
return google.calendar("v3").events.insert({ requestBody: event });
36+
) => {
37+
return calendar({ version: "v3" }).events.insert({ requestBody: event });
3938
};
4039

4140
/**

packages/backend/src/__tests__/helpers/mock.setup.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Handler, NextFunction, Response } from "express";
2-
import { GoogleApis } from "googleapis";
32
import mergeWith from "lodash.mergewith";
43
import { randomUUID } from "node:crypto";
54
import { SessionRequest } from "supertokens-node/framework/express";
@@ -44,16 +43,15 @@ export function compassTestState(): CompassTestState {
4443
}
4544

4645
function mockGoogleapis() {
47-
mockModule("googleapis", (googleapis: { google: GoogleApis }) => {
48-
return {
49-
google: {
50-
...googleapis.google,
51-
calendar: mockGcal({
52-
googleapis: googleapis.google,
53-
}),
54-
},
55-
};
56-
});
46+
mockModule(
47+
"@googleapis/calendar",
48+
(calendarModule: typeof import("@googleapis/calendar")) => {
49+
return {
50+
...calendarModule,
51+
calendar: mockGcal({}),
52+
};
53+
},
54+
);
5755
}
5856

5957
function mockSuperTokens() {
Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,62 @@
1-
import { GaxiosError } from "googleapis-common";
1+
import { GaxiosError } from "gaxios";
22

3-
export const invalidGrant400Error = new GaxiosError(
3+
const error = new GaxiosError(
44
"invalid_grant",
5-
{},
5+
{
6+
headers: new Headers(),
7+
url: new URL("https://oauth2.googleapis.com/token"),
8+
method: "POST",
9+
responseType: "json",
10+
data: "refresh_token=1%2F%2F01F_IBIEZx2TUCgYIARAAGAESNgF-L9IrE_2hx29jFovRvv0eIB_pNYnQsFy8QqSlmsq6nzCENaKrnItvDp72Qg9tF3OtDZrdwAZ&client_id=111711111111-mqq17c111hgpgn907j79kgnse1o0lchk.apps.googleusercontent.com&client_secret=Z8o&grant_type=refresh_token",
11+
},
612
{
713
config: {
814
method: "POST",
9-
body: "'refresh_token=1%2F%2F01F_IBIEZx2TUCgYIARAAGAESNgF-L9IrE_2hx29jFovRvv0eIB_pNYnQsFy8QqSlmsq6nzCENaKrnItvDp72Qg9tF3OtDZrdwAZ&client_id=111711111111-mqq17c111hgpgn907j79kgnse1o0lchk.apps.googleusercontent.com&client_secret=Z8o&grant_type=refresh_token'",
15+
body: "refresh_token=1%2F%2F01F_IBIEZx2TUCgYIARAAGAESNgF-L9IrE_2hx29jFovRvv0eIB_pNYnQsFy8QqSlmsq6nzCENaKrnItvDp72Qg9tF3OtDZrdwAZ&client_id=111711111111-mqq17c111hgpgn907j79kgnse1o0lchk.apps.googleusercontent.com&client_secret=Z8o&grant_type=refresh_token",
1016
data: "refresh_token=1%2F%2F01F_IBIEZx2TUCgYIARAAGAESNgF-L9IrE_2hx29jFovRvv0eIB_pNYnQsFy8QqSlmsq6nzCENaKrnItvDp72Qg9tF3OtDZrdwAZ&client_id=111711111111-mqq17c111hgpgn907j79kgnse1o0lchk.apps.googleusercontent.com&client_secret=Z8o&grant_type=refresh_token",
11-
url: "https://oauth2.googleapis.com/token",
17+
url: new URL("https://oauth2.googleapis.com/token"),
1218
responseType: "json",
19+
headers: new Headers(),
1320
},
1421
data: {
1522
error: "invalid_grant",
1623
error_description: "Bad Request",
1724
},
1825
status: 400,
1926
statusText: "Bad Request",
20-
headers: {},
21-
request: {
22-
responseURL: "",
27+
headers: new Headers(),
28+
ok: false,
29+
redirected: false,
30+
type: "error" as ResponseType,
31+
url: "https://oauth2.googleapis.com/token",
32+
body: null,
33+
bodyUsed: false,
34+
clone: () => {
35+
throw new Error("Not implemented");
36+
},
37+
arrayBuffer: async () => {
38+
throw new Error("Not implemented");
39+
},
40+
blob: async () => {
41+
throw new Error("Not implemented");
42+
},
43+
formData: async () => {
44+
throw new Error("Not implemented");
45+
},
46+
json: async () => ({
47+
error: "invalid_grant",
48+
error_description: "Bad Request",
49+
}),
50+
text: async () => {
51+
throw new Error("Not implemented");
52+
},
53+
bytes: async () => {
54+
throw new Error("Not implemented");
2355
},
2456
},
2557
);
58+
59+
// Set the code property to match the HTTP status
60+
error.code = "400";
61+
62+
export const invalidGrant400Error = error;
Lines changed: 84 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,47 @@
1-
import { GaxiosError } from "googleapis-common";
1+
import { GaxiosError } from "gaxios";
22

3-
export const invalidValueError = new GaxiosError(
3+
const requestHeaders = new Headers();
4+
requestHeaders.set(
5+
"x-goog-api-client",
6+
"gdcl/6.0.4 gl-node/16.17.0 auth/8.7.0",
7+
);
8+
requestHeaders.set("Accept-Encoding", "gzip");
9+
requestHeaders.set("User-Agent", "google-api-nodejs-client/6.0.4 (gzip)");
10+
requestHeaders.set(
11+
"Authorization",
12+
"Bearer ya29.a0AVvZVsr4Nv76zYXg0JPCTWTEc37yn0qUyDu35T6AGiv9ucvLsbMZWQ_zk5eKa2bBqiiOCHp4go1Wkml1-paDG0Aayaf-4XeQd8nm78STjMYNk7cEXL8K5jlHTO3Um1VJtPm4yW-ful6ytXn22ULPzzxlahwQaCgYKAZISARASFQGbdwaIn48X7svG7sifNvemifZazw0163",
13+
);
14+
requestHeaders.set("Content-Type", "application/json");
15+
requestHeaders.set("Accept", "application/json");
16+
17+
const responseHeaders = new Headers();
18+
responseHeaders.set(
19+
"alt-svc",
20+
'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000',
21+
);
22+
responseHeaders.set(
23+
"cache-control",
24+
"no-cache, no-store, max-age=0, must-revalidate",
25+
);
26+
responseHeaders.set("connection", "close");
27+
responseHeaders.set("content-encoding", "gzip");
28+
responseHeaders.set("content-type", "application/json; charset=UTF-8");
29+
responseHeaders.set("date", "Thu, 09 Feb 2023 16:42:21 GMT");
30+
responseHeaders.set("expires", "Mon, 01 Jan 1990 00:00:00 GMT");
31+
responseHeaders.set("pragma", "no-cache");
32+
responseHeaders.set("server", "ESF");
33+
responseHeaders.set("transfer-encoding", "chunked");
34+
responseHeaders.set("vary", "Origin, X-Origin, Referer");
35+
responseHeaders.set("x-content-type-options", "nosniff");
36+
responseHeaders.set("x-frame-options", "SAMEORIGIN");
37+
responseHeaders.set("x-xss-protection", "0");
38+
39+
const error = new GaxiosError(
440
"Invalid Value",
541
{
6-
url: "https://www.googleapis.com/calendar/v3/calendars/foo%40gmail.com/events/watch?syncToken=x",
42+
url: new URL(
43+
"https://www.googleapis.com/calendar/v3/calendars/foo%40gmail.com/events/watch?syncToken=x",
44+
),
745
method: "POST",
846
data: {
947
address: "https://foo.yourdomain.app/api/sync/gcal/notifications",
@@ -12,15 +50,7 @@ export const invalidValueError = new GaxiosError(
1250
token: "secret",
1351
type: "web_hook",
1452
},
15-
headers: {
16-
"x-goog-api-client": "gdcl/6.0.4 gl-node/16.17.0 auth/8.7.0",
17-
"Accept-Encoding": "gzip",
18-
"User-Agent": "google-api-nodejs-client/6.0.4 (gzip)",
19-
Authorization:
20-
"Bearer ya29.a0AVvZVsr4Nv76zYXg0JPCTWTEc37yn0qUyDu35T6AGiv9ucvLsbMZWQ_zk5eKa2bBqiiOCHp4go1Wkml1-paDG0Aayaf-4XeQd8nm78STjMYNk7cEXL8K5jlHTO3Um1VJtPm4yW-ful6ytXn22ULPzzxlahwQaCgYKAZISARASFQGbdwaIn48X7svG7sifNvemifZazw0163",
21-
"Content-Type": "application/json",
22-
Accept: "application/json",
23-
},
53+
headers: requestHeaders,
2454
params: { syncToken: "x" },
2555
retry: true,
2656
body: '{"address":"https://foo.yourdomain.app/api/sync/gcal/notifications","expiration":"1675961300771","id":"b69deec8-8526-4504-b376-db83295df0f0","token":"secret","type":"web_hook"}',
@@ -39,7 +69,9 @@ export const invalidValueError = new GaxiosError(
3969
},
4070
{
4171
config: {
42-
url: "https://www.googleapis.com/calendar/v3/calendars/foo%40gmail.com/events/watch?syncToken=x",
72+
url: new URL(
73+
"https://www.googleapis.com/calendar/v3/calendars/foo%40gmail.com/events/watch?syncToken=x",
74+
),
4375
method: "POST",
4476
data: {
4577
address: "https://foo.yourdomain.app/api/sync/gcal/notifications",
@@ -48,15 +80,7 @@ export const invalidValueError = new GaxiosError(
4880
token: "secret",
4981
type: "web_hook",
5082
},
51-
headers: {
52-
"x-goog-api-client": "gdcl/6.0.4 gl-node/16.17.0 auth/8.7.0",
53-
"Accept-Encoding": "gzip",
54-
"User-Agent": "google-api-nodejs-client/6.0.4 (gzip)",
55-
Authorization:
56-
"Bearer ya29.a0AVvZVsr4Nv76zYXg0JPCTWTEc37yn0qUyDu35T6AGiv9ucvLsbMZWQ_zk5eKa2bBqiiOCHp4go1Wkml1-paDG0Aayaf-4XeQd8nm78STjMYNk7cEXL8K5jlHTO3Um1VJtPm4yW-ful6ytXn22ULPzzxlahwQaCgYKAZISARASFQGbdwaIn48X7svG7sifNvemifZazw0163",
57-
"Content-Type": "application/json",
58-
Accept: "application/json",
59-
},
83+
headers: requestHeaders,
6084
params: { syncToken: "x" },
6185
retry: true,
6286
body: '{"address":"https://foo.yourdomain.app/api/sync/gcal/notifications","expiration":"1675961300771","id":"b69deec8-8526-4504-b376-db83295df0f0","token":"secret","type":"web_hook"}',
@@ -82,27 +106,46 @@ export const invalidValueError = new GaxiosError(
82106
message: "Invalid Value",
83107
},
84108
},
85-
headers: {
86-
"alt-svc": 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000',
87-
"cache-control": "no-cache, no-store, max-age=0, must-revalidate",
88-
connection: "close",
89-
"content-encoding": "gzip",
90-
"content-type": "application/json; charset=UTF-8",
91-
date: "Thu, 09 Feb 2023 16:42:21 GMT",
92-
expires: "Mon, 01 Jan 1990 00:00:00 GMT",
93-
pragma: "no-cache",
94-
server: "ESF",
95-
"transfer-encoding": "chunked",
96-
vary: "Origin, X-Origin, Referer",
97-
"x-content-type-options": "nosniff",
98-
"x-frame-options": "SAMEORIGIN",
99-
"x-xss-protection": "0",
100-
},
109+
headers: responseHeaders,
101110
status: 400,
102111
statusText: "Bad Request",
103-
request: {
104-
responseURL:
105-
"https://www.googleapis.com/calendar/v3/calendars/foo%40gmail.com/events/watch?syncToken=x",
112+
ok: false,
113+
redirected: false,
114+
type: "error" as ResponseType,
115+
url: "https://www.googleapis.com/calendar/v3/calendars/foo%40gmail.com/events/watch?syncToken=x",
116+
body: null,
117+
bodyUsed: false,
118+
clone: () => {
119+
throw new Error("Not implemented");
120+
},
121+
arrayBuffer: async () => {
122+
throw new Error("Not implemented");
123+
},
124+
blob: async () => {
125+
throw new Error("Not implemented");
126+
},
127+
formData: async () => {
128+
throw new Error("Not implemented");
129+
},
130+
json: async () => ({
131+
error: {
132+
errors: [
133+
{ domain: "global", reason: "invalid", message: "Invalid Value" },
134+
],
135+
code: 400,
136+
message: "Invalid Value",
137+
},
138+
}),
139+
text: async () => {
140+
throw new Error("Not implemented");
141+
},
142+
bytes: async () => {
143+
throw new Error("Not implemented");
106144
},
107145
},
108146
);
147+
148+
// Set the code property to match the HTTP status
149+
error.code = "400";
150+
151+
export const invalidValueError = error;

0 commit comments

Comments
 (0)