Interface: SyncTransport
Defined in: contract.ts:56
What the engine needs from a server. Implementations must translate their own
errors into RasdError with the codes in docs/10 §1.4 so the retry classifier
can act on them.
Extended by
Properties
kind
readonly kind: "rsp" | "openrosa" | string & object;
Defined in: contract.ts:57
Methods
probe()?
optional probe(opts?): Promise<boolean>;
Defined in: contract.ts:82
Optional: is the real server reachable right now?
navigator.onLine answers "is there a network interface", which on the
connection that matters most — hotel, office and airport wifi behind a
captive portal — is true while nothing can actually reach the API. The
engine calls this before it will push, so a portal parks the queue instead
of feeding it to a login page.
Resolve false rather than throwing for an unreachable server; throwing is
reserved for a probe that could not be attempted at all. A transport that
omits this keeps the old behaviour (trust navigator.onLine), so a
third-party transport does not break by not implementing it.
Parameters
| Parameter | Type |
|---|---|
opts? | { signal?: AbortSignal; } |
opts.signal? | AbortSignal |
Returns
Promise<boolean>
pullDataset()
pullDataset(name, opts): Promise<DatasetPage>;
Defined in: contract.ts:65
Parameters
| Parameter | Type |
|---|---|
name | string |
opts | { signal?: AbortSignal; since?: string; } |
opts.signal? | AbortSignal |
opts.since? | string |
Returns
Promise<DatasetPage>
pullForms()
pullForms(opts): Promise<FormsPage>;
Defined in: contract.ts:64
Parameters
| Parameter | Type |
|---|---|
opts | { signal?: AbortSignal; since?: string; } |
opts.signal? | AbortSignal |
opts.since? | string |
Returns
Promise<FormsPage>
pushSubmissions()
pushSubmissions(batch, opts): Promise<SubmissionAck[]>;
Defined in: contract.ts:58
Parameters
| Parameter | Type |
|---|---|
batch | Submission[] |
opts | { idempotencyKey: string; signal?: AbortSignal; } |
opts.idempotencyKey | string |
opts.signal? | AbortSignal |
Returns
Promise<SubmissionAck[]>
registerDevice()?
optional registerDevice(info): Promise<{
policy?: Partial<SyncPolicy>;
}>;
Defined in: contract.ts:67
Optional: register the device and read back server policy.
Parameters
| Parameter | Type |
|---|---|
info | { appVersion?: string; deviceId: string; platform: string; } |
info.appVersion? | string |
info.deviceId | string |
info.platform | string |
Returns
Promise<{
policy?: Partial<SyncPolicy>;
}>
uploadAttachment()
uploadAttachment(upload, opts): Promise<{
remoteId: string;
}>;
Defined in: contract.ts:60
Resumable; onProgress reports bytes sent so far for this attachment.
Parameters
| Parameter | Type |
|---|---|
upload | AttachmentUpload |
opts | { onProgress?: (sentBytes) => void; signal?: AbortSignal; } |
opts.onProgress? | (sentBytes) => void |
opts.signal? | AbortSignal |
Returns
Promise<{
remoteId: string;
}>