From 385e4a90bd282a712c557859d6ab388780a6d816 Mon Sep 17 00:00:00 2001 From: Henry Fontanier Date: Fri, 8 Mar 2024 11:59:59 +0100 Subject: [PATCH] chore: upgrade notion client to latest --- connectors/package-lock.json | 6 ++-- .../src/connectors/notion/lib/notion_api.ts | 29 ++++++++++++++----- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/connectors/package-lock.json b/connectors/package-lock.json index 5f2ba549bf1f..a820e270cd72 100644 --- a/connectors/package-lock.json +++ b/connectors/package-lock.json @@ -1407,9 +1407,9 @@ } }, "node_modules/@notionhq/client": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/@notionhq/client/-/client-2.2.4.tgz", - "integrity": "sha512-cr5yW6mIJX1cBDThClklNUY5KfQO0iW3rL/CEpx5gU+7Bv458VqeT9YfM9KIbhuGw0D2a8/+qv0UpveDM6rsOw==", + "version": "2.2.14", + "resolved": "https://registry.npmjs.org/@notionhq/client/-/client-2.2.14.tgz", + "integrity": "sha512-oqUefZtCiJPCX+74A1Os9OVTef3fSnVWe2eVQtU1HJSD+nsfxfhwvDKnzJTh2Tw1ZHKLxpieHB/nzGdY+Uo12A==", "dependencies": { "@types/node-fetch": "^2.5.10", "node-fetch": "^2.6.1" diff --git a/connectors/src/connectors/notion/lib/notion_api.ts b/connectors/src/connectors/notion/lib/notion_api.ts index 40a49c920812..fc08ea0c8d37 100644 --- a/connectors/src/connectors/notion/lib/notion_api.ts +++ b/connectors/src/connectors/notion/lib/notion_api.ts @@ -475,6 +475,10 @@ export async function getParsedDatabase( parentId = "workspace"; parentType = "workspace"; break; + case "database_id": + parentId = dbParent.database_id; + parentType = "database"; + break; default: ((dbParent: never) => { logger.warn({ dbParent }, "Unknown page parent type."); @@ -673,6 +677,20 @@ export function parsePropertyText( return d?.start || null; }; + const parseUniqueIdProp = ({ + prefix, + number, + }: { + prefix: string | null; + number: number | null; + }): string | null => { + if (!number) { + return null; + } + + return prefix ? `${prefix}-${number}` : `${number}`; + }; + switch (property.type) { case "number": return property.number?.toString() || null; @@ -740,17 +758,14 @@ export function parsePropertyText( default: assertNever(property.formula); } - } else { - // If the formula is an expression type, return null. - return null; } - break; - } + return null; + } + case "unique_id": + return parseUniqueIdProp(property.unique_id); case "relation": case "rollup": - // @ts-expect-error missing from Notion package - // eslint-disable-next-line no-fallthrough case "verification": return null; default: