Skip to content

offline

client.offline reports:

  • the offline lease this device holds
  • drafts made while unreachable
  • what the device still waits on before it can open everything its person may access

reachable

reachable says whether the Seald Healthcare Cloud answers now.

readonly reachable: boolean;

Returns: true while the Seald Healthcare Cloud answers, false while it does not. The SDK updates it and raises the reachable event.

Records: Nothing. Not a decision.

Errors: None.

lease

lease is the offline lease this device holds, where the tenant enabled one for this role and worklist.

readonly lease?: LeaseState;

Returns: The current LeaseState, or nothing where the tenant gives this role and worklist no offline lease. The SDK renews it on its own while reachable.

Records: Lease, each time the SDK renews it. See Audit actions.

Errors: None.

drafts

drafts returns the edits this device made while unreachable that still wait to be saved.

drafts(): Promise<Draft[]>;

Returns: Every Draft this device holds.

Records: Nothing. Not a decision.

Errors: no-session.

saveDrafts

saveDrafts saves every draft through the ordinary save. It runs once the Seald Healthcare Cloud is back and has received the record of what this device opened offline.

saveDrafts(choose: (draft: Draft, currentVersion: number) => Promise<'save-anyway' | 'keep'>): Promise<{ saved: Saved[]; kept: Draft[] }>;
ParameterTypeDescription
choosea function from a Draft and the object’s current version to a DraftChoiceCalled once per draft whose base is no longer current, the same choice a live save offers.

Returns: The drafts saved as Saved, and the drafts the person chose to keep as drafts rather than save.

Records: Save. See Audit actions.

Errors: no-session, unreachable, journal-refused (an Owner must review the record of what this device opened offline), not-found (a draft’s folder or object no longer exists).

discardDraft

discardDraft discards one draft without saving it.

discardDraft(draftId: string): Promise<void>;
ParameterTypeDescription
draftIdstringThe draft to discard.

Returns: Nothing.

Records: Nothing. Not a decision.

Errors: no-session, not-found.

waiting

waiting returns what this device still waits on before it can open everything its person may open.

waiting(): Promise<BackfillWaiting[]>;

Returns: Every BackfillWaiting this device still waits on. A backfill event fires on client once one completes, with what now opens.

Records: Nothing. Not a decision.

Errors: no-session, unreachable.

Types

LeaseState

interface LeaseState {
expiresAt: Date;
objects: number;
grantedAt: Date;
}
FieldTypeDescription
expiresAtdateWhen the offline lease expires unless the SDK renews it.
objectsnumberHow many objects the offline lease covers.
grantedAtdateWhen the offline lease was granted.

Draft

interface Draft {
draftId: string;
locator?: Locator;
folder?: Locator;
baseVersion?: number;
madeAt: Date;
name: string;
}
FieldTypeDescription
draftIdstringIdentifies the draft. Use it to discard the draft or match it to its saved outcome.
locatorLocator, optionalSet when the draft is the next version of an existing object. Absent for a new object.
folderLocator, optionalFor a new object, the folder it was created in.
baseVersionnumber, optionalThe version the edit was made from, where the draft is a new version.
madeAtdateWhen the draft was made.
namestringThe object’s name, as saved into the draft.

DraftChoice

type DraftChoice = 'save-anyway' | 'keep';
ValueMeaning
save-anywaySave the draft as the next version anyway.
keepLeave the draft as a draft.

BackfillWaiting

interface BackfillWaiting {
kind: 'domain' | 'record';
locator: Locator;
dataset: string;
since: Date;
canComplete: Person[];
}
FieldTypeDescription
kind"domain" or "record"Whether a whole key domain or one record is waiting.
locatorLocatorThe key domain or record that waits.
datasetstringThe dataset it belongs to.
sincedateWhen this device started waiting on it.
canCompletePerson[]The people whose devices can give this device access. Tell the person whom to ask.