feat: Granola integration (#14906)

* wip

* fix: Address review feedback on Granola integration

- Limit the size of Granola API responses
- Load the team when authorizing notes into personal collections
- Add the user's connection from granola.list to the integrations store

* feat: Connect Granola from a dialog

* fix: Accept Granola webhook test events

* Copy pass

* Copy pass
This commit is contained in:
Tom Moor authored and GitHub committed 2026-12-05 14:59:12 -05:00
1 parent e23a9566fb
commit ba2d9888cc
28 files changed
+2287 -31

No files matched your search

+40 -1
View File
@@ -1,3 +1,4 @@
import crypto from "node:crypto";
import { IntegrationService, IntegrationType } from "@shared/types";
import { Integration } from "@server/models";
import {
@@ -8,8 +9,9 @@ import {
buildUser,
buildViewer,
} from "@server/test/factories";
import { getTestServer } from "@server/test/support";
import { getTestServer, mockTaskSchedule } from "@server/test/support";
import { GitHub, InstallationAccess } from "../github";
import env from "../env";
import { SetupAction } from "./schema";
const server = getTestServer();
@@ -200,3 +202,40 @@ describe("#integrations.list", () => {
expect(body.data[0].settings).toEqual({ url: "https://example.com" });
});
});
describe("#github.webhooks", () => {
const schedule = mockTaskSchedule();
// Spaces and non-ASCII text are not kept when the parsed body is stringified again.
const body = '{ "action": "opened", "title": "Caf\\u00e9 ☕" }';
const deliver = (signedBody: string) =>
server.post("/api/github.webhooks", {
body,
headers: {
"content-type": "application/json",
"x-hub-signature-256": `sha256=${crypto
.createHmac("sha256", env.GITHUB_WEBHOOK_SECRET!)
.update(signedBody)
.digest("hex")}`,
},
});
it("accepts a signature of the raw body", async () => {
const res = await deliver(body);
expect(res.status).toEqual(202);
expect(schedule).toHaveBeenCalledWith(
expect.objectContaining({
payload: { action: "opened", title: "Café ☕" },
})
);
});
it("rejects a signature of the parsed body", async () => {
const res = await deliver(JSON.stringify(JSON.parse(body)));
expect(res.status).toEqual(401);
expect(schedule).not.toHaveBeenCalled();
});
});