import type { ConnectorProxy } from './connector-proxy.js'; import type { IntegrationEndpointMethod, JsonValue, TriggerKeySnapshot } from '../browser/project-change.js'; export declare const maximumIntegrationBodyBytes: number; export declare const maximumIntegrationDeliveryPages = 5; export type IntegrationReceiveResult = { readonly checkpoint?: JsonValue; readonly continue?: boolean; readonly dedupeKey?: string; readonly outcome: 'event'; readonly payload: Readonly>; } | { readonly checkpoint?: JsonValue; readonly continue?: boolean; readonly outcome: 'ignored'; readonly reason: string; } | { readonly body: string; readonly contentType: string; readonly headers?: Readonly>; readonly outcome: 'respond'; readonly status: number; }; export interface IntegrationStateContext { readonly checkpoint: JsonValue; readonly subscription: Readonly>; readonly saveCheckpoint: (checkpoint: JsonValue) => Promise; readonly saveSubscription: (subscription: Readonly>, reconcileAt: Date) => Promise; } export interface IntegrationReceiveContext { readonly admit: boolean; readonly allow?: () => Promise; readonly bindingId: string; readonly callbackSecret: string; readonly config: Readonly>; readonly connector: ConnectorProxy; readonly current: boolean; readonly header: (name: string) => string | undefined; readonly method: IntegrationEndpointMethod; readonly now: Date; readonly payload: JsonValue; readonly query: (name: string) => string | undefined; readonly state?: IntegrationStateContext; } export interface IntegrationReconcileContext { readonly active: boolean; readonly callbackSecret: string; readonly config: Readonly>; readonly connector: ConnectorProxy; readonly endpointUrl: string; readonly now: Date; readonly signal?: AbortSignal; readonly state?: IntegrationStateContext; } export interface IntegrationReconcileResult { readonly outcome: 'pending' | 'ready'; } export interface IntegrationDefinition { readonly initialState?: { readonly checkpoint: JsonValue; readonly subscription: Readonly>; }; readonly receive: (context: IntegrationReceiveContext) => IntegrationReceiveResult | Promise; readonly reconcile: (context: IntegrationReconcileContext) => Promise; readonly snapshot: TriggerKeySnapshot & { readonly type: 'integration'; }; } export declare class IntegrationConnectionError extends Error { readonly name = "IntegrationConnectionError"; } export declare class PermanentIntegrationError extends Error { readonly name = "PermanentIntegrationError"; } export declare class TransientIntegrationError extends Error { readonly name = "TransientIntegrationError"; } export declare function integrationEndpointId(url: URL): string | undefined; export declare function integrationCallbackSecret(callbackKey: string | undefined, endpointId: string): Promise; export declare function integrationOccurrenceId(bindingId: string, runtimeVersion: number, definitionKey: string, dedupeKey: string | null): Promise; export interface IntegrationConformanceFixture { readonly config: Readonly>; readonly connectionId: string; readonly definition: Pick; readonly publishedAt: string; } export interface IntegrationConformanceState { readonly checkpoint: JsonValue | null; readonly health: 'healthy' | 'initializing'; readonly payloads: readonly JsonValue[]; readonly receiveCalls: number; readonly reconcileCalls: number; readonly runtimeVersion: number; readonly subscription: Readonly> | null; } export interface IntegrationConformanceHarness { readonly callbackSecret: string; readonly endpointUrl: string; dispose(): Promise; reconcile(at: string): Promise; republish(at: string): Promise; request(request: Request): Promise; restart(): Promise; retire(at: string): Promise; state(): Promise; } export interface IntegrationConformanceCase { readonly fixture: IntegrationConformanceFixture; readonly name: string; verify(harness: IntegrationConformanceHarness): Promise; } export declare const integrationConformanceCases: readonly IntegrationConformanceCase[];