routier-collection / plugins/replication/src / HttpPluginOptions
Interface: HttpPluginOptions
Defined in: plugins/replication/src/HttpDbPlugin.ts:45
Plugin configuration.
Extended by
Properties
getUrl()
getUrl: (
collectionName) =>string
Defined in: plugins/replication/src/HttpDbPlugin.ts:46
Parameters
collectionName
string
Returns
string
databaseName?
optionaldatabaseName:string
Defined in: plugins/replication/src/HttpDbPlugin.ts:56
See IDbPlugin.databaseName. getUrl is a caller-supplied function of collection name, so there is no origin this plugin can read without inventing a collection to ask about — hence a plain option with a shared default.
Set it whenever an application talks to more than one HTTP backend over the same schema: leaving both on the default makes them one database as far as subscriptions are concerned, and each would be notified of the other's writes.
getHeaders()?
optionalgetHeaders: () =>Record<string,string> |Promise<Record<string,string>>
Defined in: plugins/replication/src/HttpDbPlugin.ts:58
Headers for every request (e.g. Authorization). Can be async. Re-evaluated per retry attempt.
Returns
Record<string, string> | Promise<Record<string, string>>
ignoreQueryForCollections?
optionalignoreQueryForCollections:string[]
Defined in: plugins/replication/src/HttpDbPlugin.ts:63
Collection names for which to ignore the query and select everything. No filter, sort, skip, or take is sent; server returns full allowed set.
queryRetryBaseDelayMs?
optionalqueryRetryBaseDelayMs:number
Defined in: plugins/replication/src/HttpDbPlugin.ts:69
Base delay (ms) for exponential backoff on query retry. When 0 or omitted, no retries (single attempt). 401/403 never retried (except once after a successful re-auth); other failures retry with jittered delay capped at queryRetryMaxDelayMs, honoring Retry-After.
queryRetryMaxDelayMs?
optionalqueryRetryMaxDelayMs:number
Defined in: plugins/replication/src/HttpDbPlugin.ts:71
Max delay (ms) between query retries. Ignored when queryRetryBaseDelayMs is 0.
queryRetryMaxAttempts?
optionalqueryRetryMaxAttempts:number
Defined in: plugins/replication/src/HttpDbPlugin.ts:73
Max number of query attempts (including initial). Default 10. 401/403 stop immediately.
requestTimeoutMs?
optionalrequestTimeoutMs:number
Defined in: plugins/replication/src/HttpDbPlugin.ts:75
Per-request timeout (ms); a hung connection fails instead of stalling forever. Default 30_000; 0 disables.
minRequestIntervalMs?
optionalminRequestIntervalMs:number
Defined in: plugins/replication/src/HttpDbPlugin.ts:84
Minimum gap between requests to the same URL (reads) or collection (writes). Default 100.
This plugin is the only place HTTP actually leaves the process, so pacing lives here: a composing plugin cannot leak past it, and an app using this plugin directly gets the same protection. Concurrent GETs for one URL collapse into a single request. 0 removes the gap; calls for one key still never overlap.
writeBatchDelayMs?
optionalwriteBatchDelayMs:number
Defined in: plugins/replication/src/HttpDbPlugin.ts:92
Quiet window (ms) used to batch writes to the same URL. Default 25.
Every POST accepted during the window contributes its adds/updates/removes (and opIds) to one request. The timer restarts when another write arrives, so a burst of ten saves becomes one POST rather than ten serialized POSTs. Set to 0 to disable batching.
onAuthError?
optionalonAuthError:AuthErrorHandler
Defined in: plugins/replication/src/HttpDbPlugin.ts:98
Called when the remote returns 401 or 403 (query and bulkPersist; use event.context to distinguish). Return/resolve true to signal re-auth succeeded — the failed operation then retries once with fresh headers.
translateRemoteResponse()?
optionaltranslateRemoteResponse: (schema,data) =>unknown
Defined in: plugins/replication/src/HttpDbPlugin.ts:100
Parameters
schema
CompiledSchema<UnknownRecord>
data
unknown
Returns
unknown