@superdurable/connector-notion 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,530 @@
1
+ import { C as CreatePageInput, a as CreatePageOutput, b as Connection, G as GetPageInput, c as GetPageOutput, Q as QueryDatabaseInput, d as QueryDatabaseOutput, S as SearchInput, e as SearchOutput, U as UpdatePagePropertiesInput, f as UpdatePagePropertiesOutput, g as Config, h as Credentials, O as Operations, P as Page } from './connection-C7B_dh-s.js';
2
+ export { i as ConfigSchema, j as CreatePageInputSchema, k as CreatePageOutputSchema, l as CredentialSource, D as DateRange, m as DateRangeSchema, n as GetPageInputSchema, o as GetPageOutputSchema, p as PageContent, q as PageContentSchema, r as PageProperty, s as PagePropertySchema, t as PageSchema, u as Parent, v as ParentSchema, w as PropertyValue, x as PropertyValueSchema, y as QueryDatabaseInputSchema, z as QueryDatabaseOutputSchema, A as QueryFilter, B as QueryFilterSchema, E as QuerySort, F as QuerySortSchema, H as SearchInputSchema, I as SearchMatch, J as SearchMatchSchema, K as SearchOutputSchema, L as UpdatePagePropertiesInputSchema, M as UpdatePagePropertiesOutputSchema, N as decodeCredentials, R as newConnection, T as newConnectionWithOperations } from './connection-C7B_dh-s.js';
3
+ import * as _superdurable_connectors_sdk from '@superdurable/connectors-sdk';
4
+ import { MutationDefinition, QueryDefinition, MutationStepConfig, Mutation, MutationResult, QueryStepConfig, Query, QueryResult, MutationStep, QueryStep, Call, QueryAttempt, MutationAttempt, TriggerLogger, CredentialProvider, ReceiptDraft, Failure, ConnectorConfigurationUI, TriggerTarget, TriggerDefinition, TriggerBindingDefinition, TriggerRunner } from '@superdurable/connectors-sdk';
5
+ import { StepTarget } from '@superdurable/dex';
6
+ import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
7
+ import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
8
+ import { CursorStore, Runner } from '@superdurable/connectors-sdk/pollingtrigger';
9
+ import { z } from 'zod';
10
+
11
+ /** Stable connector identity. */
12
+ declare const ConnectorID = "notion";
13
+ /** Provider identity for named connections. */
14
+ declare const ProviderID = "notion";
15
+ /** Branch IDs for search. */
16
+ declare const SearchBranch: {
17
+ readonly Searched: "searched";
18
+ readonly NoMatch: "noMatch";
19
+ readonly ProviderRejected: "providerRejected";
20
+ readonly InvalidResponse: "invalidResponse";
21
+ readonly Defect: "defect";
22
+ };
23
+ /** One page of title matches was read; Notion search matches titles only, is not guaranteed to be exhaustive, and indexes new pages with a delay. */
24
+ declare const SearchBranchSearched: "searched";
25
+ /** The first page of results is empty: no shared page or data source title contains the query, or the object was never shared with the connection. */
26
+ declare const SearchBranchNoMatch: "noMatch";
27
+ /** Notion conclusively rejected the search, such as an invalid token, a stale cursor, or a blocked connection. */
28
+ declare const SearchBranchProviderRejected: "providerRejected";
29
+ /** Notion returned an invalid or oversized search page. */
30
+ declare const SearchBranchInvalidResponse: "invalidResponse";
31
+ /** Local input, connection configuration, or connector definition is invalid. */
32
+ declare const SearchBranchDefect: "defect";
33
+ /** Manifest definition for search. */
34
+ declare const SearchDefinition: QueryDefinition;
35
+ /** Manifest metadata for search. */
36
+ declare const SearchMetadata: {
37
+ readonly kind: "query";
38
+ readonly idempotency: "none";
39
+ readonly authorization: "required";
40
+ };
41
+ /** Branch IDs for queryDatabase. */
42
+ declare const QueryDatabaseBranch: {
43
+ readonly Queried: "queried";
44
+ readonly NotFound: "notFound";
45
+ readonly ProviderRejected: "providerRejected";
46
+ readonly InvalidResponse: "invalidResponse";
47
+ readonly Defect: "defect";
48
+ };
49
+ /** One page of matching rows was read; it can be empty. */
50
+ declare const QueryDatabaseBranchQueried: "queried";
51
+ /** The database or data source does not exist or is not shared with the connection. */
52
+ declare const QueryDatabaseBranchNotFound: "notFound";
53
+ /** Notion conclusively rejected the query, such as a filter on a missing property or a type mismatch. */
54
+ declare const QueryDatabaseBranchProviderRejected: "providerRejected";
55
+ /** Notion returned an invalid or oversized query page. */
56
+ declare const QueryDatabaseBranchInvalidResponse: "invalidResponse";
57
+ /** Local input, connection configuration, or connector definition is invalid, including a database ID whose database holds several data sources. */
58
+ declare const QueryDatabaseBranchDefect: "defect";
59
+ /** Manifest definition for queryDatabase. */
60
+ declare const QueryDatabaseDefinition: QueryDefinition;
61
+ /** Manifest metadata for queryDatabase. */
62
+ declare const QueryDatabaseMetadata: {
63
+ readonly kind: "query";
64
+ readonly idempotency: "none";
65
+ readonly authorization: "required";
66
+ };
67
+ /** Branch IDs for getPage. */
68
+ declare const GetPageBranch: {
69
+ readonly Found: "found";
70
+ readonly NotFound: "notFound";
71
+ readonly ProviderRejected: "providerRejected";
72
+ readonly InvalidResponse: "invalidResponse";
73
+ readonly Defect: "defect";
74
+ };
75
+ /** The page and its bounded content were read. */
76
+ declare const GetPageBranchFound: "found";
77
+ /** The page does not exist or is not shared with the connection. */
78
+ declare const GetPageBranchNotFound: "notFound";
79
+ /** Notion conclusively rejected the page read. */
80
+ declare const GetPageBranchProviderRejected: "providerRejected";
81
+ /** Notion returned an invalid or oversized page or block list. */
82
+ declare const GetPageBranchInvalidResponse: "invalidResponse";
83
+ /** Local input, connection configuration, or connector definition is invalid. */
84
+ declare const GetPageBranchDefect: "defect";
85
+ /** Manifest definition for getPage. */
86
+ declare const GetPageDefinition: QueryDefinition;
87
+ /** Manifest metadata for getPage. */
88
+ declare const GetPageMetadata: {
89
+ readonly kind: "query";
90
+ readonly idempotency: "none";
91
+ readonly authorization: "required";
92
+ };
93
+ /** Branch IDs for createPage. */
94
+ declare const CreatePageBranch: {
95
+ readonly Created: "created";
96
+ readonly NotFound: "notFound";
97
+ readonly ProviderRejected: "providerRejected";
98
+ readonly Uncertain: "uncertain";
99
+ readonly InvalidResponse: "invalidResponse";
100
+ readonly Defect: "defect";
101
+ };
102
+ /** Notion created the page and returned or confirmed its ID. */
103
+ declare const CreatePageBranchCreated: "created";
104
+ /** The database or data source does not exist or is not shared with the connection; nothing was created. */
105
+ declare const CreatePageBranchNotFound: "notFound";
106
+ /** Notion conclusively rejected the page, such as a missing property, a value of the wrong type, missing Insert content capability, or a workspace limit; nothing was created. */
107
+ declare const CreatePageBranchProviderRejected: "providerRejected";
108
+ /** The request was dispatched but its outcome cannot be confirmed; Notion has no idempotency key, so the page may exist and must not be created again automatically. */
109
+ declare const CreatePageBranchUncertain: "uncertain";
110
+ /** Notion returned an invalid or oversized database while the connector resolved its data source; nothing was created. */
111
+ declare const CreatePageBranchInvalidResponse: "invalidResponse";
112
+ /** Local input, credential authorization, or connector definition is invalid, including a database ID whose database holds several data sources. */
113
+ declare const CreatePageBranchDefect: "defect";
114
+ /** Manifest definition for createPage. */
115
+ declare const CreatePageDefinition: MutationDefinition;
116
+ /** Manifest metadata for createPage. */
117
+ declare const CreatePageMetadata: {
118
+ readonly kind: "mutation";
119
+ readonly idempotency: "required";
120
+ readonly authorization: "required";
121
+ };
122
+ /** Branch IDs for updatePageProperties. */
123
+ declare const UpdatePagePropertiesBranch: {
124
+ readonly Updated: "updated";
125
+ readonly NotFound: "notFound";
126
+ readonly ProviderRejected: "providerRejected";
127
+ readonly InvalidResponse: "invalidResponse";
128
+ readonly Defect: "defect";
129
+ };
130
+ /** Notion applied the property values and returned the page. */
131
+ declare const UpdatePagePropertiesBranchUpdated: "updated";
132
+ /** The page does not exist or is not shared with the connection; nothing was changed. */
133
+ declare const UpdatePagePropertiesBranchNotFound: "notFound";
134
+ /** Notion conclusively rejected the update, such as a missing property, a value of the wrong type, a locked or archived page, or missing Update content capability. */
135
+ declare const UpdatePagePropertiesBranchProviderRejected: "providerRejected";
136
+ /** Notion applied the update but returned an invalid or oversized page. */
137
+ declare const UpdatePagePropertiesBranchInvalidResponse: "invalidResponse";
138
+ /** Local input, connection configuration, or connector definition is invalid. */
139
+ declare const UpdatePagePropertiesBranchDefect: "defect";
140
+ /** Manifest definition for updatePageProperties. */
141
+ declare const UpdatePagePropertiesDefinition: MutationDefinition;
142
+ /** Manifest metadata for updatePageProperties. */
143
+ declare const UpdatePagePropertiesMetadata: {
144
+ readonly kind: "mutation";
145
+ readonly idempotency: "required";
146
+ readonly authorization: "required";
147
+ };
148
+
149
+ /** Configuration for the search connector Step. */
150
+ interface SearchStepConfig<StepInput, OperationInput = SearchInput, OperationOutput = SearchOutput> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
151
+ /** Named connection supplying this operation. */
152
+ connection: Connection<{
153
+ search(): Query<OperationInput, OperationOutput>;
154
+ }>;
155
+ /** Name matching the bound connection. */
156
+ connectionName: string;
157
+ /** One page of title matches was read; Notion search matches titles only, is not guaranteed to be exhaustive, and indexes new pages with a delay. */
158
+ searched: StepTarget<QueryResult<OperationOutput>>;
159
+ /** The first page of results is empty: no shared page or data source title contains the query, or the object was never shared with the connection. */
160
+ noMatch?: StepTarget<QueryResult<OperationOutput>>;
161
+ /** Notion conclusively rejected the search, such as an invalid token, a stale cursor, or a blocked connection. */
162
+ providerRejected?: StepTarget<QueryResult<OperationOutput>>;
163
+ /** Notion returned an invalid or oversized search page. */
164
+ invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
165
+ /** Local input, connection configuration, or connector definition is invalid. */
166
+ defect?: StepTarget<QueryResult<OperationOutput>>;
167
+ }
168
+ /** Build the search Step from a named connection. */
169
+ declare function newSearchStep<StepInput, OperationInput = SearchInput, OperationOutput = SearchOutput>(configuration: SearchStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
170
+ /** Configuration for the queryDatabase connector Step. */
171
+ interface QueryDatabaseStepConfig<StepInput, OperationInput = QueryDatabaseInput, OperationOutput = QueryDatabaseOutput> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
172
+ /** Named connection supplying this operation. */
173
+ connection: Connection<{
174
+ queryDatabase(): Query<OperationInput, OperationOutput>;
175
+ }>;
176
+ /** Name matching the bound connection. */
177
+ connectionName: string;
178
+ /** One page of matching rows was read; it can be empty. */
179
+ queried: StepTarget<QueryResult<OperationOutput>>;
180
+ /** The database or data source does not exist or is not shared with the connection. */
181
+ notFound?: StepTarget<QueryResult<OperationOutput>>;
182
+ /** Notion conclusively rejected the query, such as a filter on a missing property or a type mismatch. */
183
+ providerRejected?: StepTarget<QueryResult<OperationOutput>>;
184
+ /** Notion returned an invalid or oversized query page. */
185
+ invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
186
+ /** Local input, connection configuration, or connector definition is invalid, including a database ID whose database holds several data sources. */
187
+ defect?: StepTarget<QueryResult<OperationOutput>>;
188
+ }
189
+ /** Build the queryDatabase Step from a named connection. */
190
+ declare function newQueryDatabaseStep<StepInput, OperationInput = QueryDatabaseInput, OperationOutput = QueryDatabaseOutput>(configuration: QueryDatabaseStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
191
+ /** Configuration for the getPage connector Step. */
192
+ interface GetPageStepConfig<StepInput, OperationInput = GetPageInput, OperationOutput = GetPageOutput> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
193
+ /** Named connection supplying this operation. */
194
+ connection: Connection<{
195
+ getPage(): Query<OperationInput, OperationOutput>;
196
+ }>;
197
+ /** Name matching the bound connection. */
198
+ connectionName: string;
199
+ /** The page and its bounded content were read. */
200
+ found: StepTarget<QueryResult<OperationOutput>>;
201
+ /** The page does not exist or is not shared with the connection. */
202
+ notFound?: StepTarget<QueryResult<OperationOutput>>;
203
+ /** Notion conclusively rejected the page read. */
204
+ providerRejected?: StepTarget<QueryResult<OperationOutput>>;
205
+ /** Notion returned an invalid or oversized page or block list. */
206
+ invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
207
+ /** Local input, connection configuration, or connector definition is invalid. */
208
+ defect?: StepTarget<QueryResult<OperationOutput>>;
209
+ }
210
+ /** Build the getPage Step from a named connection. */
211
+ declare function newGetPageStep<StepInput, OperationInput = GetPageInput, OperationOutput = GetPageOutput>(configuration: GetPageStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
212
+ /** Configuration for the createPage connector Step. */
213
+ interface CreatePageStepConfig<StepInput, OperationInput = CreatePageInput, OperationOutput = CreatePageOutput> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
214
+ /** Named connection supplying this operation. */
215
+ connection: Connection<{
216
+ createPage(): Mutation<OperationInput, OperationOutput>;
217
+ }>;
218
+ /** Name matching the bound connection. */
219
+ connectionName: string;
220
+ /** Notion created the page and returned or confirmed its ID. */
221
+ created: StepTarget<MutationResult<OperationOutput>>;
222
+ /** The database or data source does not exist or is not shared with the connection; nothing was created. */
223
+ notFound?: StepTarget<MutationResult<OperationOutput>>;
224
+ /** Notion conclusively rejected the page, such as a missing property, a value of the wrong type, missing Insert content capability, or a workspace limit; nothing was created. */
225
+ providerRejected?: StepTarget<MutationResult<OperationOutput>>;
226
+ /** The request was dispatched but its outcome cannot be confirmed; Notion has no idempotency key, so the page may exist and must not be created again automatically. */
227
+ uncertain?: StepTarget<MutationResult<OperationOutput>>;
228
+ /** Notion returned an invalid or oversized database while the connector resolved its data source; nothing was created. */
229
+ invalidResponse?: StepTarget<MutationResult<OperationOutput>>;
230
+ /** Local input, credential authorization, or connector definition is invalid, including a database ID whose database holds several data sources. */
231
+ defect?: StepTarget<MutationResult<OperationOutput>>;
232
+ }
233
+ /** Build the createPage Step from a named connection. */
234
+ declare function newCreatePageStep<StepInput, OperationInput = CreatePageInput, OperationOutput = CreatePageOutput>(configuration: CreatePageStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
235
+ /** Configuration for the updatePageProperties connector Step. */
236
+ interface UpdatePagePropertiesStepConfig<StepInput, OperationInput = UpdatePagePropertiesInput, OperationOutput = UpdatePagePropertiesOutput> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
237
+ /** Named connection supplying this operation. */
238
+ connection: Connection<{
239
+ updatePageProperties(): Mutation<OperationInput, OperationOutput>;
240
+ }>;
241
+ /** Name matching the bound connection. */
242
+ connectionName: string;
243
+ /** Notion applied the property values and returned the page. */
244
+ updated: StepTarget<MutationResult<OperationOutput>>;
245
+ /** The page does not exist or is not shared with the connection; nothing was changed. */
246
+ notFound?: StepTarget<MutationResult<OperationOutput>>;
247
+ /** Notion conclusively rejected the update, such as a missing property, a value of the wrong type, a locked or archived page, or missing Update content capability. */
248
+ providerRejected?: StepTarget<MutationResult<OperationOutput>>;
249
+ /** Notion applied the update but returned an invalid or oversized page. */
250
+ invalidResponse?: StepTarget<MutationResult<OperationOutput>>;
251
+ /** Local input, connection configuration, or connector definition is invalid. */
252
+ defect?: StepTarget<MutationResult<OperationOutput>>;
253
+ }
254
+ /** Build the updatePageProperties Step from a named connection. */
255
+ declare function newUpdatePagePropertiesStep<StepInput, OperationInput = UpdatePagePropertiesInput, OperationOutput = UpdatePagePropertiesOutput>(configuration: UpdatePagePropertiesStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
256
+
257
+ /** Search shared pages and data sources by title. */
258
+ declare class SearchOperation implements Query<SearchInput, SearchOutput> {
259
+ private readonly client;
260
+ /** Bind one Notion client. */ constructor(client: NotionClient);
261
+ /** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
262
+ /** Validate and search one bounded page. */
263
+ invoke(call: Call, input: SearchInput): Promise<QueryAttempt<SearchOutput>>;
264
+ }
265
+ /** Query one bounded page of database rows. */
266
+ declare class QueryDatabaseOperation implements Query<QueryDatabaseInput, QueryDatabaseOutput> {
267
+ private readonly client;
268
+ /** Bind one Notion client. */ constructor(client: NotionClient);
269
+ /** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
270
+ /** Resolve the data source and query rows. */
271
+ invoke(call: Call, input: QueryDatabaseInput): Promise<QueryAttempt<QueryDatabaseOutput>>;
272
+ }
273
+ /** Read one page with optional bounded top-level content. */
274
+ declare class GetPageOperation implements Query<GetPageInput, GetPageOutput> {
275
+ private readonly client;
276
+ /** Bind one Notion client. */ constructor(client: NotionClient);
277
+ /** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
278
+ /** Read metadata and optionally render block content. */
279
+ invoke(call: Call, input: GetPageInput): Promise<QueryAttempt<GetPageOutput>>;
280
+ }
281
+ /** Create a page through the durable single-dispatch fence. */
282
+ declare class CreatePageOperation implements Mutation<CreatePageInput, CreatePageOutput> {
283
+ private readonly client;
284
+ /** Bind one Notion client. */ constructor(client: NotionClient);
285
+ /** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.MutationDefinition;
286
+ /** Record the stable call identity without sending it to Notion. */ idempotencyKey(callId: string): string;
287
+ /** Never repeat a write that may have reached Notion. */
288
+ invoke(call: Call, input: CreatePageInput): Promise<MutationAttempt<CreatePageOutput>>;
289
+ private confirmPage;
290
+ }
291
+ /** Replace named page properties with absolute values. */
292
+ declare class UpdatePagePropertiesOperation implements Mutation<UpdatePagePropertiesInput, UpdatePagePropertiesOutput> {
293
+ private readonly client;
294
+ /** Bind one Notion client. */ constructor(client: NotionClient);
295
+ /** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.MutationDefinition;
296
+ /** Repeating absolute values converges on the same page state. */ idempotencyKey(callId: string): string;
297
+ /** Validate and send one repeat-safe update. */
298
+ invoke(call: Call, input: UpdatePagePropertiesInput): Promise<MutationAttempt<UpdatePagePropertiesOutput>>;
299
+ }
300
+
301
+ /** Injectable bounded provider sender. */
302
+ type NotionRequestSender = (request: ProviderRequest) => Promise<ProviderResponse>;
303
+ /** One provider exchange, including positive evidence about request dispatch. */
304
+ type NotionExchange = {
305
+ response: ProviderResponse;
306
+ receipt: ReceiptDraft;
307
+ } | {
308
+ failure: Failure;
309
+ disposition: 'retry' | 'notFound' | 'providerRejected' | 'invalidResponse' | 'defect' | 'uncertain' | 'committed';
310
+ retryAfterMs?: number;
311
+ receipt: ReceiptDraft;
312
+ providerId?: string;
313
+ isProvablyNotSent?: boolean;
314
+ providerErrorCode?: string;
315
+ };
316
+ /** A classified exchange before any successful response. */
317
+ type NotionExchangeFailure = Extract<NotionExchange, {
318
+ failure: Failure;
319
+ }>;
320
+ /** Replace the network transport in deterministic provider tests. */
321
+ interface NotionClientOptions {
322
+ /** Bounded provider request sender. */ send?: (request: ProviderRequest) => Promise<ProviderResponse>;
323
+ /** Clock for receipt timestamps and Retry-After. */ now?: () => Date;
324
+ /**
325
+ * Receives the databaseRowChanged Trigger runner's records: seeds, reseeds, failed polls, rate-limit pauses,
326
+ * and the durable inboxes newProjectDatabaseRowTriggerRunner opens. Records carry binding identity, never row
327
+ * contents or the API token. Omitted uses the SDK's default Trigger logger; operation Steps do not log.
328
+ */
329
+ logger?: TriggerLogger;
330
+ }
331
+ /**
332
+ * Notion API client with call-time credential resolution, shared by the operation Steps and the
333
+ * databaseRowChanged Trigger. The constructor throws TypeError for an invalid endpoint, a non-positive
334
+ * maxResponseBytes, a pollIntervalMs under 5000, or a pollPageSize outside 1 to 100.
335
+ */
336
+ declare class NotionClient {
337
+ private readonly credentials;
338
+ readonly endpoint: string;
339
+ readonly maxResponseBytes: number;
340
+ /** Wait between databaseRowChanged polls of one binding, in milliseconds; at least 5000, 30000 by default. */ readonly pollIntervalMs: number;
341
+ /** Rows per databaseRowChanged query page, 1 to 100, 100 by default. */ readonly pollPageSize: number;
342
+ /** The databaseRowChanged Trigger logger from the options, or undefined for the SDK default. */ readonly triggerLogger: TriggerLogger | undefined;
343
+ private readonly send;
344
+ private readonly now;
345
+ /** Validate the endpoint and required credential source without contacting Notion. */
346
+ constructor(config: Config, credentials: CredentialProvider<Credentials>, options?: NotionClientOptions);
347
+ /** Bind title search. */ search(): SearchOperation;
348
+ /** Bind database row query. */ queryDatabase(): QueryDatabaseOperation;
349
+ /** Bind page read. */ getPage(): GetPageOperation;
350
+ /** Bind single-dispatch page creation. */ createPage(): CreatePageOperation;
351
+ /** Bind absolute page property update. */ updatePageProperties(): UpdatePagePropertiesOperation;
352
+ /** Build a secret-safe receipt. */
353
+ receipt(call: Call, response?: ProviderResponse, providerObjectId?: string): ReceiptDraft;
354
+ /** Resolve a credential before a single-dispatch write is claimed. */
355
+ resolveToken(call: Call, operation: string, signal?: AbortSignal): Promise<{
356
+ token: string;
357
+ } | {
358
+ outcome: NotionExchangeFailure;
359
+ }>;
360
+ /** Send one bounded API request and classify its transport and HTTP outcome. */
361
+ exchange(call: Call, operation: string, subject: string, method: string, path: string, body?: unknown, mode?: 'read' | 'repeatableWrite' | 'unkeyedWrite', signal?: AbortSignal, resolvedToken?: string, providerObjectId?: string): Promise<NotionExchange>;
362
+ }
363
+
364
+ /** Open one static Notion connection declared in a Dex project; options reach its NotionClient. */
365
+ declare function newProjectConnection(project: LoadedProject, connectionName: string, options?: NotionClientOptions): Connection<Operations>;
366
+
367
+ /** The derived kinds of one databaseRowChanged delivery, the values of DatabaseRowChangedEvent.changeKind. */
368
+ declare const DatabaseRowChangeKind: {
369
+ /**
370
+ * A row whose last edited time equals its created time: Notion reports no change type, and a row edited within
371
+ * the same minute it was created still reads as created.
372
+ */
373
+ readonly Created: "created";
374
+ /** Any other edit to a row's properties or content. */ readonly Updated: "updated";
375
+ };
376
+ /** One of the two DatabaseRowChangeKind values. */
377
+ type DatabaseRowChangeKind = (typeof DatabaseRowChangeKind)[keyof typeof DatabaseRowChangeKind];
378
+ /**
379
+ * One row created or edited in the watched data source; field names match the Go connector, so Go, Python, and
380
+ * TypeScript replicas share one inbox. Edits of one row that Notion reports with the same last edited time
381
+ * arrive once, and a row moved to the trash is not delivered.
382
+ */
383
+ interface DatabaseRowChangedEvent {
384
+ /** The watched data source. */ dataSourceId: string;
385
+ /** The derived change kind; see DatabaseRowChangeKind. */ changeKind: string;
386
+ /** The row with its property values as the data source query returned it. */ row: Page;
387
+ }
388
+ /**
389
+ * The databaseRowChanged binding configuration that the dataSourcePicker unit saves in Dex Web. Changing the
390
+ * data source of a binding that already polled makes its next poll record a new baseline for the new data source.
391
+ */
392
+ interface DatabaseRowChangedTriggerConfiguration {
393
+ /**
394
+ * The watched data source, a Notion ID such as 2a4d6f80-1b3c-4d5e-8f70-112233445566 or a Notion URL ending in
395
+ * one; the picker resolves it from a database link. It is required.
396
+ */
397
+ dataSourceId?: string | undefined;
398
+ /** The picked data source's name, kept for display only. */ dataSourceName?: string | undefined;
399
+ }
400
+ /** Decodes a stored DatabaseRowChangedEvent written by Go, Python, or TypeScript. */
401
+ declare const DatabaseRowChangedEventSchema: z.ZodObject<{
402
+ dataSourceId: z.ZodString;
403
+ changeKind: z.ZodString;
404
+ row: z.ZodObject<{
405
+ id: z.ZodString;
406
+ url: z.ZodOptional<z.ZodString>;
407
+ title: z.ZodString;
408
+ parent: z.ZodObject<{
409
+ type: z.ZodString;
410
+ id: z.ZodOptional<z.ZodString>;
411
+ databaseId: z.ZodOptional<z.ZodString>;
412
+ }, z.core.$strict>;
413
+ createdTime: z.ZodOptional<z.ZodString>;
414
+ lastEditedTime: z.ZodOptional<z.ZodString>;
415
+ inTrash: z.ZodBoolean;
416
+ archived: z.ZodBoolean;
417
+ properties: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
418
+ id: z.ZodString;
419
+ type: z.ZodString;
420
+ text: z.ZodOptional<z.ZodString>;
421
+ number: z.ZodOptional<z.ZodNumber>;
422
+ checkbox: z.ZodOptional<z.ZodBoolean>;
423
+ option: z.ZodOptional<z.ZodString>;
424
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
425
+ date: z.ZodOptional<z.ZodObject<{
426
+ start: z.ZodString;
427
+ end: z.ZodOptional<z.ZodString>;
428
+ timeZone: z.ZodOptional<z.ZodString>;
429
+ }, z.core.$strict>>;
430
+ url: z.ZodOptional<z.ZodString>;
431
+ email: z.ZodOptional<z.ZodString>;
432
+ phoneNumber: z.ZodOptional<z.ZodString>;
433
+ userIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
434
+ pageIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
435
+ plainText: z.ZodString;
436
+ truncated: z.ZodOptional<z.ZodBoolean>;
437
+ }, z.core.$strict>>>;
438
+ }, z.core.$strict>;
439
+ }, z.core.$strip>;
440
+ /** Decodes a saved binding configuration strictly, as the Go connector does: unknown fields are refused. */
441
+ declare const DatabaseRowChangedTriggerConfigurationSchema: z.ZodObject<{
442
+ dataSourceId: z.ZodOptional<z.ZodString>;
443
+ dataSourceName: z.ZodOptional<z.ZodString>;
444
+ }, z.core.$strict>;
445
+
446
+ /**
447
+ * The databaseRowChanged poll Trigger: each row created or edited in one Notion data source, read by polling the
448
+ * data source query sorted by last edited time, on the Connector SDK's durable poll Trigger kit, at parity with
449
+ * the Go connector. newProjectDatabaseRowTriggerRunner is the durable path.
450
+ */
451
+
452
+ /** How far before the newest last edited time each poll queries again, in milliseconds, so a row Notion indexes late, or stamps with a time rounded down, is still delivered once. */
453
+ declare const DatabaseRowLookbackMs: number;
454
+ /** At most this many row versions inside the lookback are remembered; an evicted one may repeat with the same Trigger event ID, which a Dex Flow target does not start twice. */
455
+ declare const MaximumSeenDatabaseRows = 2000;
456
+ /** The Notion data source picker UI unit, which resolves a database link to the data source it saves. */ declare const UIUnitDataSourcePicker = "dataSourcePicker";
457
+ /** Data source picker output port: the data source ID. */ declare const UIDataSourcePickerPortDataSourceID = "dataSourceId";
458
+ /** Data source picker output port: the data source name. */ declare const UIDataSourcePickerPortDataSourceName = "dataSourceName";
459
+ /** Manifest definition of databaseRowChanged. */
460
+ declare const DatabaseRowChangedTriggerDefinition: TriggerDefinition;
461
+ /** One static application binding of databaseRowChanged. */
462
+ interface DatabaseRowChangedTriggerBindingConfig {
463
+ /** Static connection name. */ connectionName: string;
464
+ /** Static binding name. */ bindingName: string;
465
+ /** Connector Studio configuration units for the binding, such as the dataSourcePicker unit. */ configurationUI?: ConnectorConfigurationUI;
466
+ }
467
+ /** Declare a static databaseRowChanged binding for Flow Definition tooling and Dex Web. */
468
+ declare function defineDatabaseRowChangedTriggerBinding(config: DatabaseRowChangedTriggerBindingConfig): TriggerBindingDefinition;
469
+ /** Throw TypeError unless dataSourceId is a Notion ID or a Notion URL ending in one. */
470
+ declare function validateDatabaseRowChangedTriggerConfiguration(configuration: DatabaseRowChangedTriggerConfiguration): void;
471
+ /** Decode a replayed databaseRowChanged payload from a project Trigger inbox written by Go, Python, or TypeScript. */
472
+ declare function decodeDatabaseRowChangedEventPayload(_payloadJSON: string, payloadBytes: Uint8Array): DatabaseRowChangedEvent;
473
+ /** Binds one databaseRowChanged configuration to its application target and cursor. */
474
+ interface DatabaseRowChangedTriggerRoute {
475
+ /** The stable application binding name, unique within the runner. */ bindingName: string;
476
+ /** Selects the watched data source; its dataSourceId is required. */ configuration: DatabaseRowChangedTriggerConfiguration;
477
+ /** Routes each change; a target from newDurableTriggerTarget records it before the cursor commits past it, any other target consumes it first. */ target: TriggerTarget<DatabaseRowChangedEvent>;
478
+ /** Stores the binding's last-edited-time cursor, such as LoadedProject.pollCursorStore; omitted keeps it in memory, so every start records a new baseline and changes made while stopped are lost. */ cursor?: CursorStore;
479
+ }
480
+ /** Configures every Notion databaseRowChanged binding polled through one connection. */
481
+ interface DatabaseRowTriggerRunnerConfig {
482
+ /** A connection from newConnection with a NotionClient or newProjectConnection. */ connection: Connection;
483
+ /** The databaseRowChanged bindings; at least one is required. */ databaseRowChangedRoutes: readonly DatabaseRowChangedTriggerRoute[];
484
+ }
485
+ /**
486
+ * Create one poll runner for the configured databaseRowChanged bindings. run replays each durable target, records
487
+ * a baseline for a binding without a cursor, then queries every binding's data source each pollInterval with
488
+ * jitter, at most pollPageSize rows per request and ten requests per poll. A 429 rate_limited or 529
489
+ * service_overload pauses every binding of the connection for Notion's Retry-After seconds, or backs off
490
+ * exponentially without it; a stale start cursor restarts the query, a cursor for another data source records a
491
+ * new baseline, and other failures, such as a data source that is no longer shared, back off per binding up to
492
+ * 15 minutes. Delivery is at least once, and each row version keeps one Trigger event ID across refetches. The
493
+ * cursor documents match the Go connector's byte for byte, so Go and TypeScript replicas can share one binding's
494
+ * cursor and inbox. Throws TypeError for a connection without a NotionClient, no routes, a blank binding name, a
495
+ * missing target, or an invalid configuration.
496
+ */
497
+ declare function newDatabaseRowTriggerRunner(config: DatabaseRowTriggerRunnerConfig): Runner;
498
+ /** Selects one databaseRowChanged binding saved in the project configuration. */
499
+ interface ProjectDatabaseRowChangedTriggerRoute {
500
+ /** The saved binding's name. */ bindingName: string;
501
+ /** Routes each change into the application, usually newDexFlowTriggerTarget. */ target: TriggerTarget<DatabaseRowChangedEvent>;
502
+ }
503
+ /** Selects Notion databaseRowChanged bindings saved in the project configuration. */
504
+ interface ProjectDatabaseRowTriggerRunnerConfig {
505
+ /** The databaseRowChanged bindings; at least one is required. */ databaseRowChangedRoutes: readonly ProjectDatabaseRowChangedTriggerRoute[];
506
+ }
507
+ /**
508
+ * Open connectionName from the loaded project, load each binding's saved data source (an unsaved binding is a
509
+ * configuration error), and create a durable runner: each route records changes in its binding's project Trigger
510
+ * inbox before its cursor commits in the binding's project poll cursor, so a restarted or replaced replica neither
511
+ * misses nor repeats a change. The client options' logger also applies to those inboxes. Under dexcli dev the poll
512
+ * cursor stays in process memory; hosted project storage keeps it.
513
+ */
514
+ declare function newProjectDatabaseRowTriggerRunner(project: LoadedProject, connectionName: string, config: ProjectDatabaseRowTriggerRunnerConfig, options?: NotionClientOptions): Runner;
515
+ /** Configuration of one databaseRowChanged Trigger with its cursor in memory. */
516
+ interface DatabaseRowChangedTriggerConfig {
517
+ /** A connection from newConnection with a NotionClient or newProjectConnection. */ connection: Connection;
518
+ /** Static connection name; must equal the connection's name. */ connectionName: string;
519
+ /** Static binding name. */ bindingName: string;
520
+ /** Selects the watched data source. */ configuration: DatabaseRowChangedTriggerConfiguration;
521
+ /** Routes each change into the application. */ target: TriggerTarget<DatabaseRowChangedEvent>;
522
+ }
523
+ /**
524
+ * Create one databaseRowChanged TriggerRunner that keeps its cursor in memory, so every start records a new
525
+ * baseline and changes made while the process is stopped are lost; use it for tests and demonstrations and
526
+ * newProjectDatabaseRowTriggerRunner otherwise. Throws as newDatabaseRowTriggerRunner does.
527
+ */
528
+ declare function newDatabaseRowChangedTrigger(config: DatabaseRowChangedTriggerConfig): TriggerRunner;
529
+
530
+ export { Config, Connection, ConnectorID, CreatePageBranch, CreatePageBranchCreated, CreatePageBranchDefect, CreatePageBranchInvalidResponse, CreatePageBranchNotFound, CreatePageBranchProviderRejected, CreatePageBranchUncertain, CreatePageDefinition, CreatePageInput, CreatePageMetadata, CreatePageOperation, CreatePageOutput, type CreatePageStepConfig, Credentials, DatabaseRowChangeKind, type DatabaseRowChangedEvent, DatabaseRowChangedEventSchema, type DatabaseRowChangedTriggerBindingConfig, type DatabaseRowChangedTriggerConfig, type DatabaseRowChangedTriggerConfiguration, DatabaseRowChangedTriggerConfigurationSchema, DatabaseRowChangedTriggerDefinition, type DatabaseRowChangedTriggerRoute, DatabaseRowLookbackMs, type DatabaseRowTriggerRunnerConfig, GetPageBranch, GetPageBranchDefect, GetPageBranchFound, GetPageBranchInvalidResponse, GetPageBranchNotFound, GetPageBranchProviderRejected, GetPageDefinition, GetPageInput, GetPageMetadata, GetPageOperation, GetPageOutput, type GetPageStepConfig, MaximumSeenDatabaseRows, NotionClient, type NotionClientOptions, type NotionRequestSender, Page, type ProjectDatabaseRowChangedTriggerRoute, type ProjectDatabaseRowTriggerRunnerConfig, ProviderID, QueryDatabaseBranch, QueryDatabaseBranchDefect, QueryDatabaseBranchInvalidResponse, QueryDatabaseBranchNotFound, QueryDatabaseBranchProviderRejected, QueryDatabaseBranchQueried, QueryDatabaseDefinition, QueryDatabaseInput, QueryDatabaseMetadata, QueryDatabaseOperation, QueryDatabaseOutput, type QueryDatabaseStepConfig, SearchBranch, SearchBranchDefect, SearchBranchInvalidResponse, SearchBranchNoMatch, SearchBranchProviderRejected, SearchBranchSearched, SearchDefinition, SearchInput, SearchMetadata, SearchOperation, SearchOutput, type SearchStepConfig, UIDataSourcePickerPortDataSourceID, UIDataSourcePickerPortDataSourceName, UIUnitDataSourcePicker, UpdatePagePropertiesBranch, UpdatePagePropertiesBranchDefect, UpdatePagePropertiesBranchInvalidResponse, UpdatePagePropertiesBranchNotFound, UpdatePagePropertiesBranchProviderRejected, UpdatePagePropertiesBranchUpdated, UpdatePagePropertiesDefinition, UpdatePagePropertiesInput, UpdatePagePropertiesMetadata, UpdatePagePropertiesOperation, UpdatePagePropertiesOutput, type UpdatePagePropertiesStepConfig, decodeDatabaseRowChangedEventPayload, defineDatabaseRowChangedTriggerBinding, newCreatePageStep, newDatabaseRowChangedTrigger, newDatabaseRowTriggerRunner, newGetPageStep, newProjectConnection, newProjectDatabaseRowTriggerRunner, newQueryDatabaseStep, newSearchStep, newUpdatePagePropertiesStep, validateDatabaseRowChangedTriggerConfiguration };