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;var reachable: Bool { get }val reachable: BooleanReturns: 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;var lease: LeaseState? { get }val 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[]>;func drafts() async throws -> [Draft]suspend fun drafts(): List<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[] }>;func saveDrafts(choose: @escaping (Draft, Int) async throws -> DraftChoice) async throws -> SaveDraftsResult
struct SaveDraftsResult { let saved: [Saved] let kept: [Draft]}suspend fun saveDrafts(choose: suspend (Draft, Int) -> DraftChoice): SaveDraftsResult
data class SaveDraftsResult(val saved: List<Saved>, val kept: List<Draft>)| Parameter | Type | Description |
|---|---|---|
choose | a function from a Draft and the object’s current version to a DraftChoice | Called 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>;func discardDraft(_ draftId: String) async throwssuspend fun discardDraft(draftId: String)| Parameter | Type | Description |
|---|---|---|
draftId | string | The 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[]>;func waiting() async throws -> [BackfillWaiting]suspend fun waiting(): List<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;}struct LeaseState { let expiresAt: Date let objects: Int let grantedAt: Date}data class LeaseState( val expiresAt: Instant, val objects: Int, val grantedAt: Instant,)| Field | Type | Description |
|---|---|---|
expiresAt | date | When the offline lease expires unless the SDK renews it. |
objects | number | How many objects the offline lease covers. |
grantedAt | date | When the offline lease was granted. |
Draft
interface Draft { draftId: string; locator?: Locator; folder?: Locator; baseVersion?: number; madeAt: Date; name: string;}struct Draft { let draftId: String let locator: Locator? let folder: Locator? let baseVersion: Int? let madeAt: Date let name: String}data class Draft( val draftId: String, val locator: Locator?, val folder: Locator?, val baseVersion: Int?, val madeAt: Instant, val name: String,)| Field | Type | Description |
|---|---|---|
draftId | string | Identifies the draft. Use it to discard the draft or match it to its saved outcome. |
locator | Locator, optional | Set when the draft is the next version of an existing object. Absent for a new object. |
folder | Locator, optional | For a new object, the folder it was created in. |
baseVersion | number, optional | The version the edit was made from, where the draft is a new version. |
madeAt | date | When the draft was made. |
name | string | The object’s name, as saved into the draft. |
DraftChoice
type DraftChoice = 'save-anyway' | 'keep';enum DraftChoice { case saveAnyway, keep }enum class DraftChoice { SAVE_ANYWAY, KEEP }| Value | Meaning |
|---|---|
save-anyway | Save the draft as the next version anyway. |
keep | Leave the draft as a draft. |
BackfillWaiting
interface BackfillWaiting { kind: 'domain' | 'record'; locator: Locator; dataset: string; since: Date; canComplete: Person[];}struct BackfillWaiting { let kind: Kind let locator: Locator let dataset: String let since: Date let canComplete: [Person]
enum Kind { case domain, record }}data class BackfillWaiting( val kind: Kind, val locator: Locator, val dataset: String, val since: Instant, val canComplete: List<Person>,) { enum class Kind { DOMAIN, RECORD }}| Field | Type | Description |
|---|---|---|
kind | "domain" or "record" | Whether a whole key domain or one record is waiting. |
locator | Locator | The key domain or record that waits. |
dataset | string | The dataset it belongs to. |
since | date | When this device started waiting on it. |
canComplete | Person[] | The people whose devices can give this device access. Tell the person whom to ask. |