Skip to content

Commit

Permalink
chore: upgrade notion client to latest (#4218)
Browse files Browse the repository at this point in the history
Co-authored-by: Henry Fontanier <[email protected]>
  • Loading branch information
fontanierh and Henry Fontanier authored Mar 8, 2024
1 parent e82cf43 commit 3b6120d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
6 changes: 3 additions & 3 deletions connectors/package-lock.json

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

29 changes: 22 additions & 7 deletions connectors/src/connectors/notion/lib/notion_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 3b6120d

Please sign in to comment.