Skip to content

craft-hub / AccountSyncService

Class: AccountSyncService ​

Defined in: packages/craft-hub/src/account-sync.ts:57

Synchronize portable account state with optimistic concurrency and recoverable conflict snapshots.

Constructors ​

Constructor ​

new AccountSyncService(runtime, provider?): AccountSyncService

Defined in: packages/craft-hub/src/account-sync.ts:61

Parameters ​

runtime ​

CraftHubRuntime

provider? ​

AccountSyncProvider

Returns ​

AccountSyncService

Properties ​

status ​

status: AccountSyncStatus

Defined in: packages/craft-hub/src/account-sync.ts:58

Methods ​

accept() ​

accept(accountId, input, expectedRevision): Promise<AccountSyncEnvelope>

Defined in: packages/craft-hub/src/account-sync.ts:101

Serialize cloud mutations and reject stale devices before changing any configuration.

Parameters ​

accountId ​

string

input ​

unknown

expectedRevision ​

string

Returns ​

Promise<AccountSyncEnvelope>


conflict() ​

conflict(): Promise<unknown>

Defined in: packages/craft-hub/src/account-sync.ts:150

Export the saved conflict without exposing authentication material.

Returns ​

Promise<unknown>


envelope() ​

envelope(accountId): Promise<AccountSyncEnvelope>

Defined in: packages/craft-hub/src/account-sync.ts:95

Return a content revision suitable for compare-and-swap cloud writes.

Parameters ​

accountId ​

string

Returns ​

Promise<AccountSyncEnvelope>


recover() ​

recover(): Promise<void>

Defined in: packages/craft-hub/src/account-sync.ts:67

Recover an interrupted multi-file application before serving configuration requests.

Returns ​

Promise<void>


snapshot() ​

snapshot(): Promise<{ schemaVersion: 1; scopes: object[]; subscriptions: object[]; }>

Defined in: packages/craft-hub/src/account-sync.ts:85

Export only allowlisted portable data, including multiple Team identities.

Returns ​

Promise<{ schemaVersion: 1; scopes: object[]; subscriptions: object[]; }>


synchronize() ​

synchronize(resolution?): Promise<AccountSyncStatus>

Defined in: packages/craft-hub/src/account-sync.ts:113

Automatically merge disjoint changes; preserve both versions and stop on overlapping edits.

Parameters ​

resolution? ​

"use-local" | "use-cloud"

Returns ​

Promise<AccountSyncStatus>

Released under the MIT License.