@verevoir/aigency-work 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,47 @@
1
+ import type { CardSource, CardSink, ListResult } from './board.js';
2
+ /** The API version this board was built and tested against. */
3
+ export declare const NOTION_VERSION = "2022-06-28";
4
+ /** The reason given for any write that supplies `expectedRevision`. */
5
+ export declare const EXPECTED_REVISION_UNSUPPORTED_REASON = "expectedRevision is not supported by NotionBoard: Notion has no compare-and-set primitive, and checking last_edited_time first would not be atomic";
6
+ /** The shape of `fetch` this board needs — just enough to avoid depending on DOM lib types. */
7
+ export interface NotionFetchResponse {
8
+ readonly status: number;
9
+ readonly ok: boolean;
10
+ readonly headers: {
11
+ get(name: string): string | null;
12
+ };
13
+ json(): Promise<unknown>;
14
+ }
15
+ export interface NotionFetchInit {
16
+ readonly method: 'GET' | 'POST' | 'PATCH';
17
+ readonly headers: Readonly<Record<string, string>>;
18
+ readonly body?: string;
19
+ }
20
+ export type NotionFetch = (url: string, init: NotionFetchInit) => Promise<NotionFetchResponse>;
21
+ export interface NotionBoardConfig {
22
+ /** The Notion database id this board is scoped to. */
23
+ readonly databaseId: string;
24
+ /** Resolves the bearer token on every call. Never read from the environment, never logged. */
25
+ readonly getToken: () => Promise<string>;
26
+ /** The property that carries the card's state. Defaults to "Status". */
27
+ readonly statusProperty?: string;
28
+ /** The property that carries the card's title. Defaults to "Name". */
29
+ readonly titleProperty?: string;
30
+ /** Injected for tests; defaults to the platform's global `fetch`. */
31
+ readonly fetch?: NotionFetch;
32
+ /** Injected for tests; defaults to a real timer-backed delay. */
33
+ readonly sleep?: (ms: number) => Promise<void>;
34
+ /** Bounded retry budget for 409/429 responses. Defaults to 4 attempts; clamped to at least 1. */
35
+ readonly maxAttempts?: number;
36
+ /** Backoff base, doubled per attempt when `Retry-After` is absent. */
37
+ readonly baseDelayMs?: number;
38
+ }
39
+ export interface NotionBoard extends CardSource, CardSink {
40
+ /**
41
+ * Lists the database's pages, following `has_more`/`next_cursor` until
42
+ * exhausted. `filter` is passed through to Notion's query body
43
+ * unchanged — this board does not interpret it.
44
+ */
45
+ list(filter?: Record<string, unknown>): Promise<ListResult>;
46
+ }
47
+ export declare function createNotionBoard(config: NotionBoardConfig): NotionBoard;