Skip to content

CreateSyncServerOptions

Defined in: packages/server/src/index.ts:69

TRegistry extends SyncTableRegistry

TDb extends PgAsyncDatabase<PgQueryResultHKT, RegistryRelations<TRegistry>> = PgAsyncDatabase<PgQueryResultHKT, RegistryRelations<TRegistry>>

optional allowedOrigins?: string[]

Defined in: packages/server/src/index.ts:97


optional applyFunctionGrantExecuteTo?: readonly string[]

Defined in: packages/server/src/index.ts:143

The roles the INSTALLED apply function was generated with (pgxsinkit-generate --grant-execute-to <role>, ADR-0054). Default [] — owner-only, the default the CLI generates.

It is not a grant this server performs; it is how the server reproduces the artifact’s ADR-0018 fingerprint, which hashes the ACL along with the rest of the body. Generate with a grant and leave this unset and every write fails PXS01 (stale artifact) — so the two lists must stay identical.


optional applyFunctionSchema?: string

Defined in: packages/server/src/index.ts:156

The schema the INSTALLED apply function lives in (pgxsinkit-generate --function-schema <schema>). Default: unset — the artifact is generated unqualified and resolved through the connection’s search_path.

It does two things at once, which is why one option drives both: the schema is part of the fingerprinted body (the function names itself in its own self-check), AND it is how this server QUALIFIES the call. Generate with --function-schema and leave this unset and the call goes out unqualified — which either finds nothing (42883) or, worse, finds a same-named function elsewhere on the search_path that then fails PXS01 against a fingerprint it does not carry. The two must name the same schema.


db: TDb

Defined in: packages/server/src/index.ts:77


optional deployment?: DeploymentProfile

Defined in: packages/server/src/index.ts:105

The startup query posture (ADR-0030). The apply function now verifies its own ADR-0018 fingerprint in-body on every call (SQLSTATE PXS01 on drift), so there is no startup drift check to configure; this governs only the RLS auth-helper verify and the operations-log presence resolution. Defaults are the safe degradation posture (ADR-0030). See DeploymentProfile.


optional electricUrl?: string

Defined in: packages/server/src/index.ts:84

When set, the server serves a read-path Electric shape proxy that shares the single resolveAuthClaims adapter with the write path (ADR-0003). Without it, no shape proxy is registered.


optional eventGate?: EventGate

Defined in: packages/server/src/index.ts:112

The Event lane’s consent/entitlement gate (ADR-0053 decision 1): the lane’s one function, and so an option here rather than a registry field (the registry stays declarative data only). Called once per event, after its payload validated and its identity resolved, and before anything is enqueued; a refusal is a per-event refused verdict. Absent → every well-formed event is allowed. See EventGate.


optional eventQueue?: EventQueue

Defined in: packages/server/src/index.ts:127

The Event lane’s queue backend. Defaults to the shipped pgmq backend over this server’s own db (createPgmqEventQueue), which is what makes an enqueue join the endpoint’s transaction. Override it to run the lane on another backend, or to substitute a fake in tests.


optional healthCheck?: boolean | { path: string; }

Defined in: packages/server/src/index.ts:93

Health check endpoint. Enabled by default at /health; false disables it, { path } relocates it.


optional host?: string

Defined in: packages/server/src/index.ts:95


optional idleTimeoutSeconds?: number

Defined in: packages/server/src/index.ts:96


optional logTimings?: boolean

Defined in: packages/server/src/index.ts:134

Opt-in per-request timing log (default false). When on, each mutation and shape-proxy request emits one compact [pgxsinkit-timing] line with an ISO-8601(ms, UTC) timestamp and phase durations, for attributing wall-clock latency against the client’s syncDebug lines. Off by default — a pure diagnostic surface that adds no standing query or latency when unset.


optional onEventsEnqueued?: EventsEnqueuedHook

Defined in: packages/server/src/index.ts:121

Fired after an ingest request ENQUEUED at least one sub-batch (ADR-0053 amendment, 2026-08-02): the deployment-agnostic seam a SERVERLESS deployment uses to nudge whatever endpoint runs the consumer’s drainOnce(), so an interactive append drains in milliseconds instead of waiting for the next scheduled tick. Fire-and-forget — it is called after the commit, its throw is caught and warn-logged, and the scheduled sweep (not the nudge) is the delivery guarantee. Absent → nothing is nudged, which is right for a deployment hosting the long-lived runner. See EventsEnqueuedHook.


optional onStatusChange?: (status) => void

Defined in: packages/server/src/index.ts:98

SyncRuntimeStatus

void


optional operationsLog?: object

Defined in: packages/server/src/index.ts:89

optional enabled?: boolean


optional port?: number

Defined in: packages/server/src/index.ts:94


registry: TRegistry

Defined in: packages/server/src/index.ts:76


optional resolveAuthClaims?: (request) => {[key: string]: unknown; app_metadata?: {[key: string]: unknown; roles?: string[]; }; sub?: string; } | Promise<{[key: string]: unknown; app_metadata?: {[key: string]: unknown; roles?: string[]; }; sub?: string; } | null> | null

Defined in: packages/server/src/index.ts:78

Request

{[key: string]: unknown; app_metadata?: {[key: string]: unknown; roles?: string[]; }; sub?: string; } | Promise<{[key: string]: unknown; app_metadata?: {[key: string]: unknown; roles?: string[]; }; sub?: string; } | null> | null


optional resolveShapeParams?: (request) => Record<string, unknown> | undefined

Defined in: packages/server/src/index.ts:88

Optional per-request extra params passed to customWhere/shared filters.

Request

Record<string, unknown> | undefined


optional shapeProxyPath?: string

Defined in: packages/server/src/index.ts:86

Path for the shape proxy route. Defaults to /api/shape.