evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
Design a small TypeScript module that uses the Notion client to fetch page and database content while allowing per-call request overrides for headers and timeouts without mutating client defaults.
Both fetch functions should merge constructor defaults with per-call overrides, reporting the effective headers and timeout for each call without mutating defaults.
fetchPageSnapshot with overrides that add the header X-Debug: trace-1 returns the page snapshot and reports appliedHeaders for that call (constructor defaults plus the override); a subsequent call without overrides returns the same snapshot shape but appliedHeaders excludes X-Debug. @testfetchCollectionPageIds with a custom timeoutMs override uses that timeout for the request and still returns the resolved page IDs for that view. @testexport interface RequestOverrides {
headers?: Record<string, string>;
timeoutMs?: number;
}
export interface PageSnapshot {
title: string;
topLevelBlockCount: number;
signedFileUrlCount: number;
appliedHeaders: Record<string, string>;
appliedTimeout?: number;
}
export class NotionRequestOverrides {
constructor(config: {
authToken: string;
activeUser?: string;
apiBaseUrl?: string;
userTimeZone?: string;
defaultHeaders?: Record<string, string>;
defaultTimeoutMs?: number;
});
fetchPageSnapshot(
pageId: string,
overrides?: RequestOverrides
): Promise<PageSnapshot>;
fetchCollectionPageIds(
collectionId: string,
viewId: string,
overrides?: RequestOverrides
): Promise<string[]>;
}Provides Notion API access with per-call ofetchOptions overrides for headers and timeout.