@superdurable/connector-notion 0.1.0 → 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.
@@ -3,7 +3,9 @@ import { z } from "zod";
3
3
  import { SecretString } from "@superdurable/connectors-sdk";
4
4
  var ConfigSchema = z.object({
5
5
  "endpoint": z.string().optional(),
6
- "maxResponseBytes": z.number().int().optional()
6
+ "maxResponseBytes": z.number().int().optional(),
7
+ "pollIntervalMs": z.number().int().optional(),
8
+ "pollPageSize": z.number().int().optional()
7
9
  });
8
10
  function decodeCredentials(value) {
9
11
  if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("credential fields are invalid");
@@ -260,7 +262,9 @@ var CreatePageDefinition = {
260
262
  { id: "invalidResponse", description: "Notion returned an invalid or oversized database while the connector resolved its data source; nothing was created.", optional: true },
261
263
  { id: "defect", description: "Local input, credential authorization, or connector definition is invalid, including a database ID whose database holds several data sources.", optional: true }
262
264
  ],
263
- stepDefaults: { executeMethodTimeoutMs: 12e4, executeDurability: "sync", executeRetry: { initialIntervalMs: 1e3, backoffCoefficient: 2, maximumIntervalMs: 6e4, maximumAttempts: 6, totalDurationMs: 3e5 } }
265
+ stepDefaults: { executeMethodTimeoutMs: 12e4, executeDurability: "sync", executeRetry: { initialIntervalMs: 1e3, backoffCoefficient: 2, maximumIntervalMs: 6e4, maximumAttempts: 6, totalDurationMs: 3e5 } },
266
+ repeatOnUnknown: "limited",
267
+ maxSends: 3
264
268
  };
265
269
  var CreatePageMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
266
270
  var UpdatePagePropertiesBranch = {
@@ -284,7 +288,8 @@ var UpdatePagePropertiesDefinition = {
284
288
  { id: "invalidResponse", description: "Notion applied the update but returned an invalid or oversized page.", optional: true },
285
289
  { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
286
290
  ],
287
- stepDefaults: { executeMethodTimeoutMs: 9e4, executeDurability: "async" }
291
+ stepDefaults: { executeMethodTimeoutMs: 9e4, executeDurability: "async" },
292
+ repeatOnUnknown: "safe"
288
293
  };
289
294
  var UpdatePagePropertiesMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
290
295
 
@@ -7,11 +7,17 @@ interface Config {
7
7
  endpoint?: string;
8
8
  /** Maximum complete Notion API response in bytes. Leave blank to keep the displayed safety limit; enter a positive integer only to change it. An oversized read selects invalidResponse, and an oversized response to an accepted createPage selects uncertain. */
9
9
  maxResponseBytes?: number;
10
+ /** Wait between two Notion data source queries of the databaseRowChanged Trigger, as a Go duration of at least 5s such as 15s or 2m. Leave blank to keep the displayed interval; shorten it only when Flows must start sooner, because every poll spends the connection's Notion query rate limit of about three requests per second, shared with the Flows' own Steps. Runtime value in milliseconds. */
11
+ pollIntervalMs?: number;
12
+ /** Rows one databaseRowChanged poll asks Notion for per query page, a whole number from 1 up to Notion's maximum query page size, which the displayed default already uses. Leave blank to keep the displayed size; lower it only when pages of wide rows exceed maxResponseBytes, because smaller pages need more requests to catch up after a burst of edits. */
13
+ pollPageSize?: number;
10
14
  }
11
15
  /** Runtime schema for manifest configuration. */
12
16
  declare const ConfigSchema: z.ZodObject<{
13
17
  endpoint: z.ZodOptional<z.ZodString>;
14
18
  maxResponseBytes: z.ZodOptional<z.ZodNumber>;
19
+ pollIntervalMs: z.ZodOptional<z.ZodNumber>;
20
+ pollPageSize: z.ZodOptional<z.ZodNumber>;
15
21
  }, z.core.$strip>;
16
22
  /** Private connector credentials resolved by the host. */
17
23
  interface Credentials {
package/dist/index.d.ts CHANGED
@@ -1,11 +1,12 @@
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, O as Operations, g as Config, h as Credentials } from './connection-CFdIOEsZ.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 Page, 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-CFdIOEsZ.js';
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
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, CredentialProvider, ReceiptDraft, Failure } 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
5
  import { StepTarget } from '@superdurable/dex';
6
6
  import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
7
7
  import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
8
- import 'zod';
8
+ import { CursorStore, Runner } from '@superdurable/connectors-sdk/pollingtrigger';
9
+ import { z } from 'zod';
9
10
 
10
11
  /** Stable connector identity. */
11
12
  declare const ConnectorID = "notion";
@@ -253,9 +254,6 @@ interface UpdatePagePropertiesStepConfig<StepInput, OperationInput = UpdatePageP
253
254
  /** Build the updatePageProperties Step from a named connection. */
254
255
  declare function newUpdatePagePropertiesStep<StepInput, OperationInput = UpdatePagePropertiesInput, OperationOutput = UpdatePagePropertiesOutput>(configuration: UpdatePagePropertiesStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
255
256
 
256
- /** Open one static Notion connection declared in a Dex project. */
257
- declare function newProjectConnection(project: LoadedProject, connectionName: string): Connection<Operations>;
258
-
259
257
  /** Search shared pages and data sources by title. */
260
258
  declare class SearchOperation implements Query<SearchInput, SearchOutput> {
261
259
  private readonly client;
@@ -284,7 +282,7 @@ declare class GetPageOperation implements Query<GetPageInput, GetPageOutput> {
284
282
  declare class CreatePageOperation implements Mutation<CreatePageInput, CreatePageOutput> {
285
283
  private readonly client;
286
284
  /** Bind one Notion client. */ constructor(client: NotionClient);
287
- /** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
285
+ /** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.MutationDefinition;
288
286
  /** Record the stable call identity without sending it to Notion. */ idempotencyKey(callId: string): string;
289
287
  /** Never repeat a write that may have reached Notion. */
290
288
  invoke(call: Call, input: CreatePageInput): Promise<MutationAttempt<CreatePageOutput>>;
@@ -294,7 +292,7 @@ declare class CreatePageOperation implements Mutation<CreatePageInput, CreatePag
294
292
  declare class UpdatePagePropertiesOperation implements Mutation<UpdatePagePropertiesInput, UpdatePagePropertiesOutput> {
295
293
  private readonly client;
296
294
  /** Bind one Notion client. */ constructor(client: NotionClient);
297
- /** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
295
+ /** Return the manifest definition. */ definition(): _superdurable_connectors_sdk.MutationDefinition;
298
296
  /** Repeating absolute values converges on the same page state. */ idempotencyKey(callId: string): string;
299
297
  /** Validate and send one repeat-safe update. */
300
298
  invoke(call: Call, input: UpdatePagePropertiesInput): Promise<MutationAttempt<UpdatePagePropertiesOutput>>;
@@ -313,6 +311,7 @@ type NotionExchange = {
313
311
  receipt: ReceiptDraft;
314
312
  providerId?: string;
315
313
  isProvablyNotSent?: boolean;
314
+ providerErrorCode?: string;
316
315
  };
317
316
  /** A classified exchange before any successful response. */
318
317
  type NotionExchangeFailure = Extract<NotionExchange, {
@@ -322,12 +321,25 @@ type NotionExchangeFailure = Extract<NotionExchange, {
322
321
  interface NotionClientOptions {
323
322
  /** Bounded provider request sender. */ send?: (request: ProviderRequest) => Promise<ProviderResponse>;
324
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;
325
330
  }
326
- /** Notion API client with call-time credential resolution. */
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
+ */
327
336
  declare class NotionClient {
328
337
  private readonly credentials;
329
338
  readonly endpoint: string;
330
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;
331
343
  private readonly send;
332
344
  private readonly now;
333
345
  /** Validate the endpoint and required credential source without contacting Notion. */
@@ -349,4 +361,170 @@ declare class NotionClient {
349
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>;
350
362
  }
351
363
 
352
- export { Config, Connection, ConnectorID, CreatePageBranch, CreatePageBranchCreated, CreatePageBranchDefect, CreatePageBranchInvalidResponse, CreatePageBranchNotFound, CreatePageBranchProviderRejected, CreatePageBranchUncertain, CreatePageDefinition, CreatePageInput, CreatePageMetadata, CreatePageOperation, CreatePageOutput, type CreatePageStepConfig, Credentials, GetPageBranch, GetPageBranchDefect, GetPageBranchFound, GetPageBranchInvalidResponse, GetPageBranchNotFound, GetPageBranchProviderRejected, GetPageDefinition, GetPageInput, GetPageMetadata, GetPageOperation, GetPageOutput, type GetPageStepConfig, NotionClient, type NotionClientOptions, type NotionRequestSender, 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, UpdatePagePropertiesBranch, UpdatePagePropertiesBranchDefect, UpdatePagePropertiesBranchInvalidResponse, UpdatePagePropertiesBranchNotFound, UpdatePagePropertiesBranchProviderRejected, UpdatePagePropertiesBranchUpdated, UpdatePagePropertiesDefinition, UpdatePagePropertiesInput, UpdatePagePropertiesMetadata, UpdatePagePropertiesOperation, UpdatePagePropertiesOutput, type UpdatePagePropertiesStepConfig, newCreatePageStep, newGetPageStep, newProjectConnection, newQueryDatabaseStep, newSearchStep, newUpdatePagePropertiesStep };
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 };