Skip to main content

Replicache

Classes#

Interfaces#

Type aliases#

HTTPRequestInfo#

Ƭ HTTPRequestInfo: Object

Type declaration#

NameType
errorMessagestring
httpStatusCodenumber

JSONObject#

Ƭ JSONObject: Partial<Object>

A JSON object. We allow undefined values because in TypeScript there is no way to express optional missing properties vs properties with the value undefined.


JSONValue#

Ƭ JSONValue: null | string | boolean | number | JSONValue[] | JSONObject

The values that can be represented in JSON


KeyTypeForScanOptions#

Ƭ KeyTypeForScanOptions<O>: O extends { indexName: string } ? [secondary: string, primary: string] : string

If the options contains an indexName then the key type is a tuple of secondary and primary.

Type parameters#

NameType
Oextends ScanOptions

LogLevel#

Ƭ LogLevel: "error" | "info" | "debug"

The different log levels. This is used to determine how much logging to do. 'error' > 'info' > 'debug'... meaning 'error' has highest priority and 'debug' lowest.


MaybePromise#

Ƭ MaybePromise<T>: T | Promise<T>

Type parameters#

Name
T

MutatorDefs#

Ƭ MutatorDefs: Object

The type used to describe the mutator definitions passed into Replicache constructor as part of the ReplicacheOptions.

See ReplicacheOptions mutators for more info.

Index signature#

▪ [key: string]: (tx: WriteTransaction, args?: any) => MaybePromise<JSONValue | void>


PatchOperation#

Ƭ PatchOperation: { key: string ; op: "put" ; value: JSONValue } | { key: string ; op: "del" } | { op: "clear" }

This type describes the patch field in a PullResponse and it is used to describe how to update the Replicache key-value store.


PullResponse#

Ƭ PullResponse: Object

PullResponse defines the shape and type of the response of a pull. This is the JSON you should return from your pull server endpoint.

Type declaration#

NameType
cookie?ReadonlyJSONValue
lastMutationIDnumber
patchPatchOperation[]

Puller#

Ƭ Puller: (request: Request) => Promise<PullerResult>

Type declaration#

▸ (request): Promise<PullerResult>

Puller is the function type used to do the fetch part of a pull.

Parameters#
NameType
requestRequest
Returns#

Promise<PullerResult>


PullerResult#

Ƭ PullerResult: Object

Type declaration#

NameType
httpRequestInfoHTTPRequestInfo
response?PullResponse

Pusher#

Ƭ Pusher: (request: Request) => Promise<HTTPRequestInfo>

Type declaration#

▸ (request): Promise<HTTPRequestInfo>

Pusher is the function type used to do the fetch part of a push.

Parameters#
NameType
requestRequest
Returns#

Promise<HTTPRequestInfo>


ReadonlyJSONObject#

Ƭ ReadonlyJSONObject: Partial<Object>

Like JSONObject but deeply readonly


ReadonlyJSONValue#

Ƭ ReadonlyJSONValue: null | string | boolean | number | ReadonlyArray<ReadonlyJSONValue> | ReadonlyJSONObject

Like JSONValue but deeply readonly


ScanIndexOptions#

Ƭ ScanIndexOptions: Object

Options for scan when scanning over an index. When scanning over and index you need to provide the indexName and the start key is now a tuple consisting of secondar and primary key

Type declaration#

NameTypeDescription
indexNamestringDo a scan over a named index. The indexName is the name of an index previously created with createIndex.
limit?numberOnly include up to limit results.
prefix?stringOnly include results starting with the secondary keys starting with prefix.
start?ObjectWhen provided the scan starts at this key.
start.exclusive?booleanWhether the key is exclusive or inclusive.
start.keyScanOptionIndexedStartKey-

ScanNoIndexOptions#

Ƭ ScanNoIndexOptions: Object

Options for scan when scanning over the entire key space.

Type declaration#

NameTypeDescription
limit?numberOnly include up to limit results.
prefix?stringOnly include keys starting with prefix.
start?ObjectWhen provided the scan starts at this key.
start.exclusive?booleanWhether the key is exclusive or inclusive.
start.keystring-

ScanOptionIndexedStartKey#

Ƭ ScanOptionIndexedStartKey: [secondary: string, primary?: string] | string

The key to start scanning at.

If you are scanning the primary index (i.e., you did not specify indexName), then pass a single string for this field, which is the key in the primary index to scan at.

If you are scanning a secondary index (i.e., you specified indexName), then use the tuple form. In that case, secondary is the secondary key to start scanning at, and primary (if any) is the primary key to start scanning at.


ScanOptions#

Ƭ ScanOptions: ScanIndexOptions | ScanNoIndexOptions

Options for scan