Skip to main content

Interface: FaultyTransport

Defined in: packages/testing/src/transport.ts:106

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.

Extends

Properties

calls

readonly calls: readonly TransportCall[];

Defined in: packages/testing/src/transport.ts:108

Every call so far, in order.


kind

readonly kind: "rsp" | "openrosa" | string & object;

Defined in: packages/sync/dist/contract.d.ts:62

Inherited from

SyncTransport.kind

Methods

callsTo()

callsTo(op): readonly TransportCall[];

Defined in: packages/testing/src/transport.ts:110

Calls to one operation.

Parameters

ParameterType
opTransportOp

Returns

readonly TransportCall[]


goOffline()

goOffline(): void;

Defined in: packages/testing/src/transport.ts:111

Returns

void


goOnline()

goOnline(): void;

Defined in: packages/testing/src/transport.ts:112

Returns

void


probe()?

optional probe(opts?): Promise<boolean>;

Defined in: packages/sync/dist/contract.d.ts:104

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

ParameterType
opts?{ signal?: AbortSignal; }
opts.signal?AbortSignal

Returns

Promise<boolean>

Inherited from

SyncTransport.probe


pullDataset()

pullDataset(name, opts): Promise<DatasetPage>;

Defined in: packages/sync/dist/contract.d.ts:78

Parameters

ParameterType
namestring
opts{ signal?: AbortSignal; since?: string; }
opts.signal?AbortSignal
opts.since?string

Returns

Promise<DatasetPage>

Inherited from

SyncTransport.pullDataset


pullForms()

pullForms(opts): Promise<FormsPage>;

Defined in: packages/sync/dist/contract.d.ts:74

Parameters

ParameterType
opts{ signal?: AbortSignal; since?: string; }
opts.signal?AbortSignal
opts.since?string

Returns

Promise<FormsPage>

Inherited from

SyncTransport.pullForms


pushSubmissions()

pushSubmissions(batch, opts): Promise<SubmissionAck[]>;

Defined in: packages/sync/dist/contract.d.ts:63

Parameters

ParameterType
batchSubmission[]
opts{ idempotencyKey: string; signal?: AbortSignal; }
opts.idempotencyKeystring
opts.signal?AbortSignal

Returns

Promise<SubmissionAck[]>

Inherited from

SyncTransport.pushSubmissions


registerDevice()?

optional registerDevice(info): Promise<{
policy?: Partial<SyncPolicy>;
}>;

Defined in: packages/sync/dist/contract.d.ts:83

Optional: register the device and read back server policy.

Parameters

ParameterType
info{ appVersion?: string; deviceId: string; platform: string; }
info.appVersion?string
info.deviceIdstring
info.platformstring

Returns

Promise<{ policy?: Partial<SyncPolicy>; }>

Inherited from

SyncTransport.registerDevice


reset()

reset(): void;

Defined in: packages/testing/src/transport.ts:114

Forget recorded calls and reset fault counters (the seed restarts too).

Returns

void


uploadAttachment()

uploadAttachment(upload, opts): Promise<{
remoteId: string;
}>;

Defined in: packages/sync/dist/contract.d.ts:68

Resumable; onProgress reports bytes sent so far for this attachment.

Parameters

ParameterType
uploadAttachmentUpload
opts{ onProgress?: (sentBytes) => void; signal?: AbortSignal; }
opts.onProgress?(sentBytes) => void
opts.signal?AbortSignal

Returns

Promise<{ remoteId: string; }>

Inherited from

SyncTransport.uploadAttachment