modulejolt-sdk
jolt-sdk: the TypeScript SDK for building applications on the Jolt network.
Layers, top to bottom:
- Client (
createJoltClient): domain-shaped operations with tolerant reads. What applications program against. - Operations: one typed function per stable daemon endpoint, for the rare call the client does not wrap.
- Transports: how requests reach the daemon. Import one from
jolt-sdk/transport-http or jolt-sdk/transport-tauri, or the fake from jolt-sdk/testing.
Quick start (browser or Node.js):
import { createJoltClient } from "jolt-sdk";
import { HttpTransport } from "jolt-sdk/transport-http";
let token = "";
const jolt = createJoltClient({
transport: new HttpTransport({ daemonUrl: "http://127.0.0.1:9862" }),
getSessionToken: () => token,
});
const request = await jolt.requestSession({
appId: "myapp.local",
appName: "My App",
appOrigin: "http://127.0.0.1:5173",
identity: (await jolt.getStatus()).identity_address,
capabilities: ["publish:/myapp/*", "resolve:public", "fetch:public"],
});
// ...poll jolt.getSessionRequestStatus(request.request_id) until it
// carries a session_token (the user approves in Jolt Console), then:
await jolt.publishJson("/myapp/hello", { hello: "world" });
References
Namespaces
namespaceoperations
Typed daemon operations over a JoltTransport.
One function per daemon endpoint the application contract declares stable. These are the lowest app-facing layer: wire DTOs in and out, no domain marshalling. Most applications should use the client from createJoltClient instead and drop to operations only for endpoints the client does not wrap (e.g. binary publish).
typeSessionRequest
type SessionRequest = { ... }
What an app declares when opening a Jolt session.
| Property | Type | Description |
|---|
appId | string | |
appName | string | |
appOrigin | string | |
capabilities | readonly string[] | Requested capability strings, e.g. publish:/myapp/*. |
identity | string | null | The identity whose authority the session requests, or null for local identity discovery. |
functionappendPublishJson
function appendPublishJson(transport: JoltTransport, token: string, path: string, body: object, options?: CallOptions): Promise<PublishResponse>
Publish a coexisting device-writer append record at path. Append records never overwrite each other, so concurrent writers are safe; read them back with enumerate, never with resolve.
functiondecryptEncryptedTarget
function decryptEncryptedTarget(transport: JoltTransport, token: string, target: string, options?: CallOptions): Promise<DecryptedEncryptedObject>
Resolve + decrypt an encrypted publication addressed to this session's identity.
functiondeleteLocalRecord
function deleteLocalRecord(transport: JoltTransport, token: string, path: string, revision: string, mutationId: string, observedRevisions: undefined | readonly string[], options?: CallOptions): Promise<LocalRecordDeleteResponse>
Compare-and-set one local stable record to a Tombstone.
| Parameter | Type | Notes |
|---|
transport | JoltTransport | |
token | string | |
path | string | |
revision | string | |
mutationId | string | |
observedRevisions | undefined | readonly string[] | |
options | CallOptions | optional |
functionenumerate
function enumerate(transport: JoltTransport, token: string, identity: string, pathPrefix: string, options?: CallOptions): Promise<AppendRecordInfo[]>
List an identity's append records under a path prefix.
functionfetchTarget
function fetchTarget(transport: JoltTransport, token: string, target: string, options?: CallOptions): Promise<FetchResult>
Fetch raw bytes by content id or address.
functiongetDataSubscriptionView
function getDataSubscriptionView(transport: JoltTransport, token: string, subscriptionId: string, options?: CallOptions): Promise<DataSubscriptionViewResponse>
Perform a bounded refresh and read one subscription's Last Verified View.
functionlistPendingIngress
function listPendingIngress(transport: JoltTransport, token: string, options?: CallOptions): Promise<IngressRecord[]>
Pending ingress envelopes awaiting review.
functionnextDataSubscriptionChange
function nextDataSubscriptionChange(transport: JoltTransport, token: string, subscriptionId: string, cursor?: string, options?: CallOptions): Promise<DataSubscriptionChangeResponse>
Wait for one bounded local Materialized View event after cursor.
functionopenEncryptedTarget
function openEncryptedTarget(transport: JoltTransport, token: string, target: string, path?: string, options?: CallOptions): Promise<OpenedEncryptedObject>
Open encrypted content, preserving ciphertext when this identity cannot decrypt it.
functionopenIngress
function openIngress(transport: JoltTransport, token: string, ingressId: string, options?: CallOptions): Promise<DecryptedIngress>
Decrypt a pending ingress envelope without deciding it.
functionpinHomeRelay
function pinHomeRelay(transport: JoltTransport, token: string, contentId: string, path?: string, options?: CallOptions): Promise<HomeRelayPinResponse>
Ask the configured home relay to retain one of this app's own publications.
functionpublishBytes
function publishBytes(transport: JoltTransport, token: string, path: string, bytes: Uint8Array<ArrayBufferLike>, meta: { fileName: string; mimeType: string }, options?: CallOptions): Promise<PublishResponse>
Publish raw bytes (images, media) at a signed path.
| Parameter | Type | Notes |
|---|
transport | JoltTransport | |
token | string | |
path | string | |
bytes | Uint8Array<ArrayBufferLike> | |
meta | { fileName: string; mimeType: string } | |
options | CallOptions | optional |
functionpublishEncryptedBytes
function publishEncryptedBytes(transport: JoltTransport, token: string, path: string, plaintext: Uint8Array<ArrayBufferLike>, meta: { mimeType: string; recipients: string[] }, options?: CallOptions): Promise<EncryptedPublishResponse>
Publish raw bytes encrypted to recipients.
| Parameter | Type | Notes |
|---|
transport | JoltTransport | |
token | string | |
path | string | |
plaintext | Uint8Array<ArrayBufferLike> | |
meta | { mimeType: string; recipients: string[] } | |
options | CallOptions | optional |
functionpublishEncryptedJson
function publishEncryptedJson(transport: JoltTransport, token: string, path: string, body: object, recipients: string[], options?: CallOptions): Promise<EncryptedPublishResponse>
Publish a JSON object encrypted to recipients (identity addresses).
functionpublishJson
function publishJson(transport: JoltTransport, token: string, path: string, body: object, options?: CallOptions): Promise<PublishResponse>
Publish a JSON object at a signed path (last-writer-wins update log).
functionresolveAddress
function resolveAddress(transport: JoltTransport, token: string, address: string, options?: CallOptions): Promise<ResolveResponse>
Resolve a .jolt address (identity + path) to its current content id.
functionrestoreLocalRecord
function restoreLocalRecord(transport: JoltTransport, token: string, path: string, body: object, revision: string, mutationId: string, observedRevisions: undefined | readonly string[], options?: CallOptions): Promise<LocalRecordRestoreResponse>
Compare-and-set one local Tombstone to new immutable content.
| Parameter | Type | Notes |
|---|
transport | JoltTransport | |
token | string | |
path | string | |
body | object | |
revision | string | |
mutationId | string | |
observedRevisions | undefined | readonly string[] | |
options | CallOptions | optional |
functionsendIngress
function sendIngress(transport: JoltTransport, token: string, req: { encryptedObject: number[]; expiresAt?: number; recipient: string }, options?: CallOptions): Promise<IngressRecord>
Deliver an already-encrypted object to a recipient's daemon (/app/v1/ingress/send). Most apps should use the client's sendObject, which also publishes the sender's own encrypted copy.
| Parameter | Type | Notes |
|---|
transport | JoltTransport | |
token | string | |
req | { encryptedObject: number[]; expiresAt?: number; recipient: string } | |
options | CallOptions | optional |
functionupdateLocalRecord
function updateLocalRecord(transport: JoltTransport, token: string, path: string, body: object, revision: string, mutationId: string, observedRevisions: undefined | readonly string[], options?: CallOptions): Promise<LocalRecordUpdateResponse>
Compare-and-set one local stable record against an observed revision.
| Parameter | Type | Notes |
|---|
transport | JoltTransport | |
token | string | |
path | string | |
body | object | |
revision | string | |
mutationId | string | |
observedRevisions | undefined | readonly string[] | |
options | CallOptions | optional |
Classes
classJoltApiError
The daemon (or its dev proxy) answered with a non-success status.
The daemon's JSON error body, when present, is preserved on body and its error field becomes the message.
new JoltApiError
new JoltApiError(message: string, options?: { body?: unknown; code?: string; status?: number }): JoltApiError
| Parameter | Type | Notes |
|---|
message | string | |
options | { body?: unknown; code?: string; status?: number } | defaults to {} |
| Property | Type | Description |
|---|
readonly body? | unknown | The raw parsed error body, for callers that need more than the message. |
| Property | Type | Description |
|---|
cause? | unknown | |
| Property | Type | Description |
|---|
readonly code? | string | Machine-readable error code from the daemon body (e.g. app_session_unauthorized), when present. |
| Property | Type | Description |
|---|
message | string | |
| Property | Type | Description |
|---|
name | string | |
| Property | Type | Description |
|---|
stack? | string | |
| Property | Type | Description |
|---|
readonly status? | number | HTTP status code of the response, when the transport had one. |
classJoltTransportError
The daemon could not be reached at all: connection refused, DNS failure, aborted request, or timeout. The cause carries the underlying error.
new JoltTransportError
new JoltTransportError(message: string, options?: { cause?: unknown }): JoltTransportError
| Parameter | Type | Notes |
|---|
message | string | |
options | { cause?: unknown } | defaults to {} |
| Property | Type | Description |
|---|
cause? | unknown | |
| Property | Type | Description |
|---|
message | string | |
| Property | Type | Description |
|---|
name | string | |
| Property | Type | Description |
|---|
stack? | string | |
Interfaces
interfaceJoltAppendSdk
Coexisting append records and their enumeration.
enumerate
enumerate(identity: string, pathPrefix: string, options?: CallOptions): Promise<EnumeratedRecord[]>
List an identity's append records under a path prefix.
| Parameter | Type | Notes |
|---|
identity | string | |
pathPrefix | string | |
options | CallOptions | optional |
publishAppend
publishAppend(path: string, body: object, options?: CallOptions): Promise<PublishResult>
Publish a coexisting device-writer append record at path.
| Parameter | Type | Notes |
|---|
path | string | |
body | object | |
options | CallOptions | optional |
interfaceJoltAvailabilitySdk
Explicit application-owned requests for delegated content availability.
pinHomeRelay
pinHomeRelay(contentId: string, path?: string, options?: CallOptions): Promise<HomeRelayPinResult>
Ask the configured home relay to retain one of this app's own publications.
| Parameter | Type | Notes |
|---|
contentId | string | |
path | string | optional |
options | CallOptions | optional |
interfaceJoltEncryptedSdk
Encrypted publish and tolerant encrypted reads.
listPublished
listPublished(options?: CallOptions): Promise<PublishedContent[]>
The local node's published inventory.
openEncrypted
openEncrypted(target: string, path?: string, options?: CallOptions): Promise<OpenEncryptedResult>
Open encrypted content without hiding a ciphertext-only result.
| Parameter | Type | Notes |
|---|
target | string | |
path | string | optional |
options | CallOptions | optional |
publishEncryptedJson
publishEncryptedJson(path: string, body: object, recipients: string[], options?: CallOptions): Promise<PublishResult>
Publish a JSON body encrypted to recipients (identity addresses). Use [self] for an encrypt-to-self publication; the publisher can always decrypt its own publications, so readEncrypted reads them back.
| Parameter | Type | Notes |
|---|
path | string | |
body | object | |
recipients | string[] | |
options | CallOptions | optional |
readEncrypted
readEncrypted<T>(ref: Reference, decode: Decoder<T>, options?: CallOptions): Promise<null | Versioned<T>>
Resolve + decrypt + parse + decode; null on any failing step.
interfaceJoltIngressSdk
The recipient-controlled ingress door: deliver identified objects to another identity's daemon and review what arrives at yours. Transport-level vocabulary only; classifying payloads is the app's job.
acceptIngress
acceptIngress(ingressId: string, options?: CallOptions): Promise<void>
| Parameter | Type | Notes |
|---|
ingressId | string | |
options | CallOptions | optional |
listPendingIngress
listPendingIngress(options?: CallOptions): Promise<IngressRecord[]>
openIngress
openIngress(ingressId: string, options?: CallOptions): Promise<unknown>
Decrypt a pending envelope and return its parsed JSON, or null.
| Parameter | Type | Notes |
|---|
ingressId | string | |
options | CallOptions | optional |
rejectIngress
rejectIngress(ingressId: string, options?: CallOptions): Promise<void>
| Parameter | Type | Notes |
|---|
ingressId | string | |
options | CallOptions | optional |
sendObject
sendObject(recipient: string, path: string, body: object, options?: CallOptions): Promise<PublishResult>
Encrypt-publish the object at path (the sender's own copy) and deliver it to recipient's daemon. Returns the publish result so the sender can version its own copy.
| Parameter | Type | Notes |
|---|
recipient | string | |
path | string | |
body | object | |
options | CallOptions | optional |
interfaceJoltSdk
Public publish and tolerant versioned reads.
deleteRecord
deleteRecord(ref: Reference, mutation: RecordMutationContext, options?: CallOptions): Promise<RecordDeletedResult>
Compare-and-set one present local stable record to a Tombstone.
publishJson
publishJson(path: string, body: object, options?: CallOptions): Promise<PublishResult>
Publish a JSON object at a signed path (last-writer-wins).
| Parameter | Type | Notes |
|---|
path | string | |
body | object | |
options | CallOptions | optional |
read
read<T>(ref: Reference, decode: Decoder<T>, options?: CallOptions): Promise<null | Versioned<T>>
Resolve, fetch, parse, and decode a publication. Returns null when the reference is missing/unreachable or the bytes do not decode to T.
readContent
readContent<T>(contentId: string, ref: Reference, latestSequence: number, decode: Decoder<T>, options?: CallOptions): Promise<null | Versioned<T>>
Fetch a known content id (from an enumerated append record), then parse and decode it against the supplied logical reference.
readRecord
readRecord(ref: Reference, options?: CallOptions): Promise<RecordReadResult>
Read authoritative local record state without collapsing failures into absence.
resolve
resolve(ref: Reference, options?: CallOptions): Promise<ResolvedReference>
Resolve a reference strictly, preserving daemon errors such as Tombstones.
restoreRecord
restoreRecord(ref: Reference, body: object, mutation: RecordMutationContext, options?: CallOptions): Promise<RecordPresentResult>
Compare-and-set one local Tombstone to new immutable content.
updateRecord
updateRecord(ref: Reference, body: object, mutation: RecordMutationContext, options?: CallOptions): Promise<RecordPresentResult>
Compare-and-set one local stable record against an observed revision.
interfaceJoltSessionSdk
Session bootstrap and daemon status, bound to the client's transport.
getCurrentSession
getCurrentSession(options?: CallOptions): Promise<CurrentAppSession>
The session behind the current token, as the daemon sees it.
getSessionRequestStatus
getSessionRequestStatus(requestId: string, options?: CallOptions): Promise<AppSessionStatusResponse>
Poll a session request until it carries a token.
| Parameter | Type | Notes |
|---|
requestId | string | |
options | CallOptions | optional |
getStatus
getStatus(options?: CallOptions): Promise<NodeStatus>
Local daemon status (no session required).
requestSession
requestSession(req: SessionRequest, options?: CallOptions): Promise<AppSessionRequestResponse>
Ask the daemon for a scoped session; the user approves it in Console.
interfaceJoltTransport
The single interface a transport implements.
Implementations must throw JoltApiError for non-success daemon responses and JoltTransportError for network-level failures, so application error handling is uniform across runtimes.
request
request<T>(base: ApiBase, path: string, req?: TransportRequest): Promise<T>
Send a JSON request to base + path and parse the JSON response.
upload
upload<T>(base: ApiBase, path: string, req: TransportUpload): Promise<T>
Send a multipart file upload to base + path and parse the JSON response.
Type Aliases
typeApiBase
type ApiBase = "app" | "daemon"
Which daemon API surface a request targets.
typeAppApiFeatureManifest
type AppApiFeatureManifest = { ... }
Generic App API behavior available through the connected daemon.
| Property | Type | Description |
|---|
appApi | number | |
discovery | "advertised" | "legacy" | |
features | Readonly<Record<string, number>> | |
typeAppApiFeatureManifestResponse
type AppApiFeatureManifestResponse = { ... }
/app/v1/features: generic behavior implemented by this App API.
| Property | Type | Description |
|---|
app_api | number | |
features | Record<string, number> | |
typeAppCompatibilityDeclaration
type AppCompatibilityDeclaration = { ... }
App-owned runtime requirements, independent of daemon release versions.
| Property | Type | Description |
|---|
appApi | number | |
optionalFeatures? | Readonly<Record<string, number>> | |
requiredFeatures? | Readonly<Record<string, number>> | |
typeAppCompatibilityDeclarationWire
type AppCompatibilityDeclarationWire = { ... }
JSON representation embedded in signed application update manifests.
| Property | Type | Description |
|---|
app_api | number | |
optional_features | Readonly<Record<string, number>> | |
required_features | Readonly<Record<string, number>> | |
typeAppCompatibilityResult
type AppCompatibilityResult = { ... }
Complete compatibility result; applications own optional fallback choices.
typeAppendRecordInfo
type AppendRecordInfo = { ... }
One device-writer append record as enumeration returns it (/app/v1/enumerate).
| Property | Type | Description |
|---|
content_id | string | |
created_at | number | |
device_id | string | |
device_sequence | number | |
entry_hash | string | |
path | string | |
typeAppSessionRequestResponse
type AppSessionRequestResponse = { ... }
Response to a session request (/app/v1/sessions/request).
typeAppSessionStatus
type AppSessionStatus = "pending" | "active" | "rejected" | "revoked" | "expired"
Lifecycle states of an app session.
typeAppSessionStatusResponse
type AppSessionStatusResponse = { ... }
Polled session request status (/app/v1/sessions/{request_id}).
| Property | Type | Description |
|---|
capabilities | string[] | |
expires_at? | number | null | |
identity? | string | null | |
request_id | string | |
session_id? | string | null | |
session_token? | string | null | |
status | AppSessionStatus | |
typeCallOptions
type CallOptions = { ... }
Options accepted by every SDK operation.
signal aborts the request; timeoutMs fails it with a JoltTransportError after the given time. Both may be combined.
| Property | Type | Description |
|---|
signal? | AbortSignal | |
timeoutMs? | number | |
typeCompatibilityCheckOptions
type CompatibilityCheckOptions = CallOptions & { ... }
Compatibility call controls; refresh after daemon reconnection.
| Property | Type | Description |
|---|
refresh? | boolean | |
typeContractLevelCheck
type ContractLevelCheck = { ... }
One comparison between an application requirement and daemon support.
| Property | Type | Description |
|---|
availableLevel | number | null | |
requiredLevel | number | |
supported | boolean | |
typeCurrentAppSession
type CurrentAppSession = { ... }
The current session, as seen by the daemon (/app/v1/session).
| Property | Type | Description |
|---|
app_id | string | |
app_name | string | |
expires_at? | number | null | |
granted_capabilities | string[] | |
identity? | string | null | |
last_used_at? | number | null | |
request_id | string | |
session_id? | string | null | |
status | AppSessionStatus | |
typeDataSubscriptionChangeResponse
type DataSubscriptionChangeResponse = { cursor: string; identity: string; records: MaterializedRecordInfo[]; state: DataSubscriptionRefreshResponse; type: "snapshot" } | { cursor: string; identity: string; records: MaterializedRecordInfo[]; removed: string[]; type: "changed" } | { cursor: string; state: DataSubscriptionRefreshResponse; type: "state" } | { cursor: string; type: "timeout" } | { type: "resync_required" } | { type: "cancelled" } | { type: "revoked" }
One bounded local Materialized View event returned by a Change Stream poll.
typeDataSubscriptionRecordResponse
type DataSubscriptionRecordResponse = { ... }
Persisted Data Subscription metadata owned by the current app session.
typeDataSubscriptionRefreshResponse
type DataSubscriptionRefreshResponse = { status: "loading" } | { last_verified_at?: number; status: "updating" } | { last_verified_at: number; status: "ready" } | { last_verified_at: number; reason: "networkUnavailable" | "verificationFailed" | "overloaded"; status: "stale" } | { reason: "networkUnavailable" | "verificationFailed" | "overloaded"; status: "unavailable" }
One Data Subscription's last bounded refresh state.
typeDataSubscriptionViewResponse
type DataSubscriptionViewResponse = { ... }
Last verified records plus the outcome of this subscription refresh.
typeDecoder
type Decoder<T> = (value: unknown) => T | null
A decoder is the app's schema-level reader: it validates an already-parsed JSON value into a canonical type, or returns null to reject it. Decoders never see bytes or transport concerns.
typeDecryptedEncryptedObject
type DecryptedEncryptedObject = { ... }
Decrypted encrypted publication (/app/v1/encrypted/decrypt).
| Property | Type | Description |
|---|
content_id | string | |
content_type | string | |
path | string | |
plaintext | number[] | |
size | number | |
typeDecryptedIngress
type DecryptedIngress = { ... }
Decrypted ingress payload (/app/v1/ingress/{id}/open).
| Property | Type | Description |
|---|
content_type | string | |
plaintext | number[] | |
size | number | |
typeEncryptedPublishResponse
type EncryptedPublishResponse = PublishResponse & { ... }
Result of an encrypted publish (/app/v1/encrypted/publish).
| Property | Type | Description |
|---|
recipient_count | number | |
typeEnumeratedRecord
type EnumeratedRecord = { ... }
One append record, marshalled into domain shape.
| Property | Type | Description |
|---|
contentId | string | |
createdAt | number | |
deviceId | string | |
deviceSequence | number | |
entryHash | string | |
identity | string | |
path | string | |
typeFetchResult
type FetchResult = { ... }
Raw bytes fetched by content id (/app/v1/fetch).
| Property | Type | Description |
|---|
content_id | string | |
data | number[] | |
size | number | |
typeHomeRelayPinResponse
type HomeRelayPinResponse = { ... }
Result of requesting availability from the configured home relay.
| Property | Type | Description |
|---|
content_id | string | |
latest_sequence | number | |
owner | string | |
relay | string | |
size | number | |
status | string | |
typeHomeRelayPinResult
type HomeRelayPinResult = { ... }
Confirmation that a home relay accepted an availability request.
| Property | Type | Description |
|---|
contentId | string | |
latestSequence | number | |
owner | string | |
relay | string | |
size | number | |
status | string | |
typeIngressRecord
type IngressRecord = { ... }
One recipient-controlled ingress envelope awaiting (or past) review.
| Property | Type | Description |
|---|
accepted_at? | number | null | |
expires_at? | number | null | |
ingress_id | string | |
received_at | number | |
receiver_id | string | |
recipient_identity | string | |
rejected_at? | number | null | |
schema_hint? | string | null | |
sender_identity | string | |
size | number | |
status | "pending" | "accepted" | "rejected" | |
typeJoltClientOptions
type JoltClientOptions = { ... }
Configuration for createJoltClient.
| Property | Type | Description |
|---|
getSessionToken | () => string | Where the client finds the current session token. Called per request so token rotation needs no client rebuild. |
transport | JoltTransport | |
typeLocalRecordDeleteResponse
type LocalRecordDeleteResponse = { ... }
Successful compare-and-set deletion of one local stable record.
| Property | Type | Description |
|---|
path | string | |
revision | string | |
typeLocalRecordHeadResponse
type LocalRecordHeadResponse = { revision: string; state: "deleted" } | { content_id: string; data: number[]; revision: string; state: "present" }
One current or common-base head in a local record conflict.
typeLocalRecordRestoreResponse
type LocalRecordRestoreResponse = LocalRecordUpdateResponse
Successful compare-and-set restoration of one local stable record.
typeLocalRecordUpdateResponse
type LocalRecordUpdateResponse = { ... }
Successful compare-and-set write of one local stable record.
| Property | Type | Description |
|---|
content_id | string | |
data | number[] | |
path | string | |
revision | string | |
typeMaterializedRecordInfo
type MaterializedRecordInfo = { ... }
One current non-deleted logical record in a Materialized View.
| Property | Type | Description |
|---|
content_id | string | |
created_at | number | |
path | string | |
revision | string | |
typeNodeStatus
type NodeStatus = { ... }
/api/v1/status: the local daemon's identity and connectivity summary.
| Property | Type | Description |
|---|
active_relays | number | |
bootstrap_relay | boolean | |
bootstrap_state | string | |
cached_count | number | |
configured_bootstrap_relay_count | number | |
configured_bootstrap_relays | string[] | |
connected_bootstrap_peers | number | |
connected_peers | number | |
daemon_version | string | |
direct_peers | number | |
effective_bootstrap_relay_count | number | |
effective_bootstrap_relays | string[] | |
home_relay | null | { api_url?: string | null; capability: "unknown" | "discovery_only" | "pinning"; multiaddr: string; peer_id: string } | |
identity_address | string | |
known_relay_count | number | |
last_bootstrap_error | string | null | |
listen_addresses | string[] | |
local_device_id | string | |
nat_type | string | |
peer_id | string | |
published_count | number | |
relay_record? | unknown | null | |
relayed_peers | number | |
uptime_secs | number | |
typeOpenedEncryptedObject
type OpenedEncryptedObject = { ... }
Encrypted bytes opened with plaintext when this identity can decrypt them.
| Property | Type | Description |
|---|
access_status | "available" | "needs_rewrap" | "not_accessible" | |
ciphertext? | number[] | null | |
content_id | string | |
content_type? | string | null | |
decrypt_error? | string | null | |
path | string | |
plaintext? | number[] | null | |
size | number | |
status | "decrypted" | "ciphertext" | |
typeOpenEncryptedResult
type OpenEncryptedResult = { ... }
Encrypted content plus the daemon's honest decrypt/access state.
| Property | Type | Description |
|---|
accessStatus | "available" | "needs_rewrap" | "not_accessible" | |
bytes | number[] | |
contentId | string | |
contentType | string | null | |
decryptError | string | null | |
path | string | |
size | number | |
status | "decrypted" | "ciphertext" | |
typePublishedContent
type PublishedContent = { ... }
One locally published item (/app/v1/published).
| Property | Type | Description |
|---|
address? | string | null | |
content_id | string | |
local_sequence? | number | null | |
path? | string | null | |
pin_state | string | |
pinned_content_id? | string | null | |
pinned_sequence? | number | null | |
relay? | null | { api_url?: string | null; multiaddr: string; peer_id: string } | |
size | number | |
typePublishResponse
type PublishResponse = { ... }
Result of a public publish (/app/v1/publish).
| Property | Type | Description |
|---|
address? | string | null | |
content_id | string | |
latest_sequence? | number | null | |
path? | string | null | |
revision? | string | null | |
size | number | |
typePublishResult
type PublishResult = { ... }
Result of any publish, in domain (camelCase) shape.
| Property | Type | Description |
|---|
address | string | null | |
contentId | string | |
latestSequence | number | |
path | string | |
revision? | string | Opaque stable-record revision when the daemon bound a singleton path. |
typeRecordConflictResult
type RecordConflictResult = { ... }
Every current local record head, plus an unambiguous common base when known.
typeRecordDeletedResult
type RecordDeletedResult = { ... }
One authoritative local stable record whose current state is a Tombstone.
| Property | Type | Description |
|---|
ref | Reference | |
revision | string | |
state | "deleted" | |
typeRecordMissingResult
type RecordMissingResult = { ... }
One authoritative local stable record reference that has no current value.
| Property | Type | Description |
|---|
ref | Reference | |
state | "missing" | |
typeRecordMutationContext
type RecordMutationContext = { ... }
Opaque compare-and-set context used by advanced record mutations.
| Property | Type | Description |
|---|
readonly mutationId | string | |
readonly observedRevisions? | readonly string[] | Every current conflict head in daemon canonical order. Omitted for ordinary CAS. |
readonly revision | string | |
typeRecordPresentResult
type RecordPresentResult = { ... }
One present authoritative local stable record.
| Property | Type | Description |
|---|
bytes | number[] | |
contentId | string | |
ref | Reference | |
revision | string | |
state | "present" | |
typeReference
type Reference = { ... }
The stable identity of a publication: (identity, path).
| Property | Type | Description |
|---|
identity | string | |
path | string | |
typeRemoveDataSubscriptionResponse
type RemoveDataSubscriptionResponse = { ... }
Terminal result of explicitly removing a Data Subscription.
| Property | Type | Description |
|---|
status | "cancelled" | |
subscription_id | string | |
typeResolvedReference
type ResolvedReference = { ... }
Strict resolution metadata for one logical reference, before content fetch.
| Property | Type | Description |
|---|
contentId | string | |
latestSequence | number | |
ref | Reference | |
typeResolveResponse
type ResolveResponse = { ... }
Result of resolving a .jolt address (/app/v1/resolve).
| Property | Type | Description |
|---|
address | string | |
content_id | string | |
identity | string | |
latest_sequence | number | |
path | string | |
reachability_hints | unknown[] | |
source | string | |
typeTransportRequest
type TransportRequest = CallOptions & { ... }
A JSON (or empty-body) request.
| Property | Type | Description |
|---|
json? | unknown | JSON body; omitted for GET. |
method? | "GET" | "POST" | "DELETE" | |
token? | string | null | Bearer session token, when the endpoint needs one. |
typeTransportUpload
type TransportUpload = CallOptions & { ... }
A multipart upload request (public publish and append).
| Property | Type | Description |
|---|
bytes | Uint8Array | |
fileName | string | |
mimeType | string | |
path | string | The logical Jolt path form field. |
token | string | |
typeVersioned
type Versioned<T> = { ... }
A versioned, decoded publication: what a read hands back to the app.
| Property | Type | Description |
|---|
contentId | string | |
latestSequence | number | |
ref | Reference | |
value | T | |
Functions
functionapiErrorMessage
function apiErrorMessage(error: unknown): string
Map any error thrown by the SDK to a short human-readable message suitable for an app's error banner. Never throws.
| Parameter | Type | Notes |
|---|
error | unknown | |
functioncreateDataClient
function createDataClient(options: JoltClientOptions): JoltClient & JoltDataSubscriptionSdk
Build the advanced transport required by an already-authorized Data SDK host.
functiondecodeAppCompatibilityDeclaration
function decodeAppCompatibilityDeclaration(value: unknown): AppCompatibilityDeclaration
Decode signed update metadata into the transport-independent SDK shape.
| Parameter | Type | Notes |
|---|
value | unknown | |
functionisContentUnavailableError
function isContentUnavailableError(error: unknown): boolean
Whether a reachable daemon reported that referenced content cannot be fetched.
| Parameter | Type | Notes |
|---|
error | unknown | |
functionisJoltUnavailableError
function isJoltUnavailableError(error: unknown): boolean
Whether a failed Jolt operation should be presented as unavailable.
Typed transport failures mean the daemon could not be reached. Unstructured HTTP 500 and 502 responses also cover browser development proxies that could not complete the request. A machine-readable API error code proves that the daemon answered and must not be weakened into host unavailability. This classifies the attempt, not the availability of content requested through a reachable daemon.
| Parameter | Type | Notes |
|---|
error | unknown | |
functionmakeId
function makeId(prefix: string): string
Generate a collision-resistant id with an app-chosen prefix.
| Parameter | Type | Notes |
|---|
prefix | string | |
functionreferenceKey
function referenceKey(ref: Reference): string
A stable string key for a Reference, for maps and stores.
functionreferenceTarget
function referenceTarget(ref: Reference): string
The .jolt address a Reference resolves through.
modulejolt-sdk/data
Classes
classAccessRevokedError
The App Session no longer authorizes connected Data SDK operations.
new AccessRevokedError
new AccessRevokedError(options?: ErrorOptions): AccessRevokedError
| Parameter | Type | Notes |
|---|
options | ErrorOptions | optional |
| Property | Type | Description |
|---|
cause? | unknown | |
| Property | Type | Description |
|---|
message | string | |
| Property | Type | Description |
|---|
name | string | |
| Property | Type | Description |
|---|
stack? | string | |
classAppIncompatibleError
The connected Jolt node cannot provide the behavior declared by this App.
new AppIncompatibleError
new AppIncompatibleError(compatibility: AppCompatibilityResult): AppIncompatibleError
| Property | Type | Description |
|---|
cause? | unknown | |
| Property | Type | Description |
|---|
message | string | |
| Property | Type | Description |
|---|
name | string | |
| Property | Type | Description |
|---|
stack? | string | |
classAppSessionRejectedError
The person using Jolt did not approve the App's derived access request.
new AppSessionRejectedError
new AppSessionRejectedError(status: AppSessionStatus): AppSessionRejectedError
| Property | Type | Description |
|---|
cause? | unknown | |
| Property | Type | Description |
|---|
message | string | |
| Property | Type | Description |
|---|
name | string | |
| Property | Type | Description |
|---|
stack? | string | |
classChangeType
Symbol-backed event kinds emitted by a Materialized View Change Stream.
| Property | Type | Description |
|---|
readonly Cancelled | query | |
| Property | Type | Description |
|---|
readonly Changed | query | |
| Property | Type | Description |
|---|
readonly ResyncRequired | query | |
| Property | Type | Description |
|---|
readonly Revoked | query | |
| Property | Type | Description |
|---|
readonly Snapshot | query | |
| Property | Type | Description |
|---|
readonly State | query | |
classConflictError
A mutation observed an older Item revision than the record currently has.
new ConflictError
new ConflictError(ref: Pick<Ref<object>, "path" | "identity">): ConflictError
| Parameter | Type | Notes |
|---|
ref | Pick<Ref<object>, "path" | "identity"> | |
| Property | Type | Description |
|---|
cause? | unknown | |
| Property | Type | Description |
|---|
message | string | |
| Property | Type | Description |
|---|
name | string | |
| Property | Type | Description |
|---|
readonly ref | Pick<Ref<object>, "path" | "identity"> | |
| Property | Type | Description |
|---|
stack? | string | |
classDeletedError
Creation was refused because the logical Item is explicitly deleted.
new DeletedError
new DeletedError(ref: Pick<Ref<object>, "path" | "identity">): DeletedError
| Parameter | Type | Notes |
|---|
ref | Pick<Ref<object>, "path" | "identity"> | |
| Property | Type | Description |
|---|
cause? | unknown | |
| Property | Type | Description |
|---|
message | string | |
| Property | Type | Description |
|---|
name | string | |
| Property | Type | Description |
|---|
readonly ref | Pick<Ref<object>, "path" | "identity"> | |
| Property | Type | Description |
|---|
stack? | string | |
classDeviceRevokedError
This installation's local device no longer has authority to mutate data.
new DeviceRevokedError
new DeviceRevokedError(options?: ErrorOptions): DeviceRevokedError
| Parameter | Type | Notes |
|---|
options | ErrorOptions | optional |
| Property | Type | Description |
|---|
cause? | unknown | |
| Property | Type | Description |
|---|
message | string | |
| Property | Type | Description |
|---|
name | string | |
| Property | Type | Description |
|---|
stack? | string | |
classDeviceSigningKeyMismatchError
This installation's persisted device identity conflicts with its authority record.
new DeviceSigningKeyMismatchError
new DeviceSigningKeyMismatchError(options?: ErrorOptions): DeviceSigningKeyMismatchError
| Parameter | Type | Notes |
|---|
options | ErrorOptions | optional |
| Property | Type | Description |
|---|
cause? | unknown | |
| Property | Type | Description |
|---|
message | string | |
| Property | Type | Description |
|---|
name | string | |
| Property | Type | Description |
|---|
stack? | string | |
classItemUnavailableError
A mutation could not safely proceed because the Item's state is unknown.
new ItemUnavailableError
new ItemUnavailableError(ref: Pick<Ref<object>, "path" | "identity">): ItemUnavailableError
| Parameter | Type | Notes |
|---|
ref | Pick<Ref<object>, "path" | "identity"> | |
| Property | Type | Description |
|---|
cause? | unknown | |
| Property | Type | Description |
|---|
message | string | |
| Property | Type | Description |
|---|
name | string | |
| Property | Type | Description |
|---|
readonly ref | Pick<Ref<object>, "path" | "identity"> | |
| Property | Type | Description |
|---|
stack? | string | |
classResourceKind
Symbol-backed kinds used when inspecting a derived App access plan. The class preserves unique-symbol types for direct equality narrowing.
| Property | Type | Description |
|---|
readonly Collection | query | |
| Property | Type | Description |
|---|
readonly Document | query | |
classSchemaMigrationError
An older stored value could not be migrated into the current Schema Class.
new SchemaMigrationError
new SchemaMigrationError(fromVersion: number, toVersion: number, message: string, options?: ErrorOptions): SchemaMigrationError
| Parameter | Type | Notes |
|---|
fromVersion | number | |
toVersion | number | |
message | string | |
options | ErrorOptions | optional |
| Property | Type | Description |
|---|
cause? | unknown | |
| Property | Type | Description |
|---|
readonly fromVersion | number | |
| Property | Type | Description |
|---|
message | string | |
| Property | Type | Description |
|---|
name | string | |
| Property | Type | Description |
|---|
stack? | string | |
| Property | Type | Description |
|---|
readonly toVersion | number | |
classSchemaValidationError
A value failed validation against a Schema Class.
new SchemaValidationError
new SchemaValidationError(field: string, message: string): SchemaValidationError
| Parameter | Type | Notes |
|---|
field | string | |
message | string | |
| Property | Type | Description |
|---|
cause? | unknown | |
| Property | Type | Description |
|---|
readonly field | string | |
| Property | Type | Description |
|---|
message | string | |
| Property | Type | Description |
|---|
name | string | |
| Property | Type | Description |
|---|
stack? | string | |
classState
Symbol-backed states for immutable Item snapshots. The class keeps every static Symbol's unique-symbol type so direct equality checks narrow Items.
| Property | Type | Description |
|---|
readonly Conflicted | query | |
| Property | Type | Description |
|---|
readonly Deleted | query | |
| Property | Type | Description |
|---|
readonly Missing | query | |
| Property | Type | Description |
|---|
readonly Present | query | |
| Property | Type | Description |
|---|
readonly Unavailable | query | |
classSubscriptionCapacityError
The node could not admit another durable Data Subscription.
new SubscriptionCapacityError
new SubscriptionCapacityError(options?: ErrorOptions): SubscriptionCapacityError
| Parameter | Type | Notes |
|---|
options | ErrorOptions | optional |
| Property | Type | Description |
|---|
cause? | unknown | |
| Property | Type | Description |
|---|
message | string | |
| Property | Type | Description |
|---|
name | string | |
| Property | Type | Description |
|---|
stack? | string | |
classSubscriptionFailure
Symbol-backed explanation for a failed bounded subscription refresh.
| Property | Type | Description |
|---|
readonly NetworkUnavailable | query | |
| Property | Type | Description |
|---|
readonly Overloaded | query | |
| Property | Type | Description |
|---|
readonly VerificationFailed | query | |
classSubscriptionState
Symbol-backed freshness and terminal states for a Data Subscription.
| Property | Type | Description |
|---|
readonly Cancelled | query | |
| Property | Type | Description |
|---|
readonly Loading | query | |
| Property | Type | Description |
|---|
readonly Ready | query | |
| Property | Type | Description |
|---|
readonly Revoked | query | |
| Property | Type | Description |
|---|
readonly Stale | query | |
| Property | Type | Description |
|---|
readonly Unavailable | query | |
| Property | Type | Description |
|---|
readonly Updating | query | |
classUnexpectedDataMutationError
Wraps an unrecognized Error thrown by a custom Data SDK client.
new UnexpectedDataMutationError
new UnexpectedDataMutationError(options?: ErrorOptions): UnexpectedDataMutationError
| Parameter | Type | Notes |
|---|
options | ErrorOptions | optional |
| Property | Type | Description |
|---|
cause? | unknown | |
| Property | Type | Description |
|---|
message | string | |
| Property | Type | Description |
|---|
name | string | |
| Property | Type | Description |
|---|
stack? | string | |
Interfaces
interfaceMigrationPlan
A chain of migrations, keyed by the version each step produces.
to
to(version: number, define: MigrationDefinition): this
Type Aliases
typeAppAccessPlan
type AppAccessPlan = { ... }
Inspectable connection input derived from an App's Resource declarations. Requirements and Grants are index-aligned in declared Resource order.
typeAppConnectOptions
type AppConnectOptions = { ... }
Advanced connection seam for an already-authorized Jolt client. It keeps host bootstrap separate from typed Resource behavior.
typeAppDefinition
type AppDefinition<TData> = { ... }
A complete application definition with canonically bound Resources.
typeAppInstance
type AppInstance<TData> = mapped & { ... }
The local identity and direct named Resources returned by App.test or App.connect.
| Property | Type | Description |
|---|
readonly identity | Identity | |
typeAppResource
type AppResource<TDefinition> = conditional
The connected Resource surface generated from one Resource definition.
typeAppTestOptions
type AppTestOptions = { ... }
Options for one fresh deterministic App test instance.
| Property | Type | Description |
|---|
readonly identity? | Identity | |
typeAppTestWorld
type AppTestWorld<TData> = { ... }
Shared deterministic state that can expose several identity-bound App views.
| Property | Type | Description |
|---|
as | (identity: string) => AppInstance<TData> | Returns a view over the world's immediately shared application state. |
device | (identity: string, deviceId: string) => AppInstance<TData> | Creates one isolated device replica for deterministic offline-branch tests. After synchronization, each Resource applies its declared update and delete conflict policies without relying on device wall clocks. |
sync | () => Promise<void> | Exchanges known histories so every device observes the same branches. |
typeAutomaticResourceConflicts
type AutomaticResourceConflicts = { ... }
Automatic conflict behavior used when a Resource declares no override.
| Property | Type | Description |
|---|
readonly delete | query | |
readonly update | query | |
typeBoundAppData
type BoundAppData<TData> = mapped
App data definitions after canonical paths have been derived.
typeBoundCollectionDefinition
type BoundCollectionDefinition<T, TAccess, TConflicts> = CollectionDefinition<T, TAccess, TConflicts> & { ... }
A Collection definition bound to its canonical App path prefix.
| Property | Type | Description |
|---|
readonly path | string | |
typeBoundDocumentDefinition
type BoundDocumentDefinition<T, TAccess, TConflicts> = DocumentDefinition<T, TAccess, TConflicts> & { ... }
A Document definition bound to its one canonical App path.
| Property | Type | Description |
|---|
readonly path | string | |
typeBulkMutationResult
type BulkMutationResult<TItem> = { ... }
Indexed partial-success result from independent itemwise mutations.
| Property | Type | Description |
|---|
readonly failed | readonly { error: DataMutationError; index: number }[] | |
readonly succeeded | readonly { index: number; item: TItem }[] | |
typeCollectionBulkDeleter
type CollectionBulkDeleter<T, TAccess, TConflicts> = { ... }
Itemwise Collection deletions exposed only when declared in Resource access.
typeCollectionBulkRestorer
type CollectionBulkRestorer<T, TAccess, TConflicts> = { ... }
Itemwise Collection restores exposed only when declared in Resource access.
typeCollectionBulkUpdater
type CollectionBulkUpdater<T, TAccess, TConflicts> = { ... }
Itemwise Collection updates exposed only when declared in Resource access.
typeCollectionCreator
type CollectionCreator<T, TAccess, TConflicts> = { ... }
Collection creation exposed only when declared in Resource access.
typeCollectionDefinition
type CollectionDefinition<T, TAccess, TConflicts> = ResourceDefinition<T, TAccess, query, TConflicts>
An unbound Collection definition created before it belongs to an App.
typeCollectionReader
type CollectionReader<T, TAccess, TConflicts> = { ... }
Read operations shared by every connected Collection surface.
| Property | Type | Description |
|---|
get | (ref: Ref<T>) => Promise<Item<T, TAccess, TConflicts>> | |
typeCollectionRemoteReader
type CollectionRemoteReader<T, TConflicts> = { ... }
Remote Collection reads exposed only for AnyIdentity access.
typeCollectionResource
type CollectionResource<T, TAccess, TConflicts> = CollectionReader<T, TAccess, TConflicts> & conditional & conditional & conditional & conditional & conditional
A connected Collection surface derived from its access declaration.
typeConflictItem
type ConflictItem<T, TAccess, TConflicts> = conditional & conditional & { ... }
An immutable unresolved state exposed only by a Resource using Manual policy.
| Property | Type | Description |
|---|
readonly alternatives | readonly ConflictAlternative<T>[] | |
readonly ref | Ref<T> | |
readonly state | query | |
isConflicted | () => predicate | |
isDeleted | () => predicate | |
isPresent | () => predicate | |
typeDataChangeStream
type DataChangeStream<T, TConflicts> = AsyncIterable<DataSubscriptionChange<T, TConflicts>> & { ... }
A cancellable async sequence of local Materialized View changes.
| Property | Type | Description |
|---|
readonly cursor? | string | |
cancel | () => Promise<void> | |
typeDataSdkClient
type DataSdkClient = Pick<JoltSdk, "publishJson" | "read" | "readContent" | "readRecord" | "resolve" | "updateRecord" | "deleteRecord" | "restoreRecord"> & Pick<JoltDataSubscriptionSdk, "createDataSubscription" | "getDataSubscriptionView" | "nextDataSubscriptionChange" | "removeDataSubscription">
Low-level authorized client operations used by the Data SDK connection seam.
typeDataSubscription
type DataSubscription<T, TConflicts> = { ... }
A typed, refreshable view of one remote Collection.
typeDataSubscriptionChange
type DataSubscriptionChange<T, TConflicts> = { cursor: string; items: readonly SubscribedItem<T, TConflicts>[]; lastVerifiedAt?: number; reason?: SubscriptionFailureValue; state: SubscriptionStateValue; type: query } | { cursor: string; items: readonly SubscribedItem<T, TConflicts>[]; removed: readonly Ref<T>[]; type: query } | { cursor: string; lastVerifiedAt?: number; reason?: SubscriptionFailureValue; state: SubscriptionStateValue; type: query } | { type: query } | { type: query } | { type: query }
One typed event from a local Materialized View Change Stream.
typeDeletedConflictAlternative
type DeletedConflictAlternative<T> = { ... }
One deleted alternative in a Manual conflict.
| Property | Type | Description |
|---|
readonly ref | Ref<T> | |
readonly state | query | |
isDeleted | () => predicate | |
isPresent | () => predicate | |
typeDeletedItem
type DeletedItem<T, TAccess, TConflicts> = ItemSnapshot<T, query, TAccess, TConflicts> & conditional
An immutable Item snapshot whose current state is a Tombstone.
typeDocumentCreator
type DocumentCreator<T, TAccess, TConflicts> = { ... }
Document creation exposed only when declared in Resource access.
| Property | Type | Description |
|---|
getOrCreate | (value: T) => Promise<PresentItem<T, TAccess, TConflicts>> | |
typeDocumentDefinition
type DocumentDefinition<T, TAccess, TConflicts> = ResourceDefinition<T, TAccess, query, TConflicts>
An unbound Document definition created before it belongs to an App.
typeDocumentReader
type DocumentReader<T, TAccess, TConflicts> = { ... }
Read operations shared by every connected Document surface.
| Property | Type | Description |
|---|
get | () => Promise<Item<T, TAccess, TConflicts>> | |
typeDocumentRemoteReader
type DocumentRemoteReader<T, TConflicts> = { ... }
Remote Document reads exposed only for AnyIdentity access.
| Property | Type | Description |
|---|
for | (identity: string) => RemoteDocument<T, TConflicts> | |
typeDocumentResource
type DocumentResource<T, TAccess, TConflicts> = DocumentReader<T, TAccess, TConflicts> & conditional & conditional
A connected Document surface derived from its access declaration.
typeFieldOptions
type FieldOptions = { ... }
Options shared by Schema Class field decorators.
| Property | Type | Description |
|---|
readonly optional? | boolean | |
typeIdentity
type Identity = string
A Jolt identity address such as alice.jolt.
typeImmutableValue
type ImmutableValue<T> = conditional
A schema value whose nested object properties and arrays cannot be mutated.
typeItem
type Item<T, TAccess, TConflicts> = PresentItem<T, TAccess, TConflicts> | DeletedItem<T, TAccess, TConflicts> | MissingItem<T, TAccess, TConflicts> | UnavailableItem<T, TAccess, TConflicts> | conditional
Any current immutable state of one logical Item.
typeItemSnapshot
type ItemSnapshot<T, TState, TAccess, TConflicts> = conditional & { ... }
Shared immutable state and narrowing behavior for an Item snapshot.
| Property | Type | Description |
|---|
readonly ref | Ref<T> | |
readonly state | TState | |
isDeleted | () => predicate | |
isPresent | () => predicate | |
typeMigrationDefinition
type MigrationDefinition = (value: MigrationValue) => unknown
One deterministic, side-effect-free migration into its declared version.
typeMigrationRenames
type MigrationRenames = Readonly<Record<string, string>>
Source fields mapped to their new field names for a migration.
typeMigrationValue
type MigrationValue = Readonly<Record<string, unknown>>
The immutable object supplied to a migration step.
typeMissingItem
type MissingItem<T, TAccess, TConflicts> = ItemSnapshot<T, query, TAccess, TConflicts>
An immutable Item snapshot for a logical reference with no observed record.
typePresentConflictAlternative
type PresentConflictAlternative<T> = { ... }
One content-bearing alternative in a Manual conflict.
| Property | Type | Description |
|---|
readonly ref | Ref<T> | |
readonly state | query | |
readonly value | ImmutableValue<T> | |
isDeleted | () => predicate | |
isPresent | () => predicate | |
typePresentItem
type PresentItem<T, TAccess, TConflicts> = ItemSnapshot<T, query, TAccess, TConflicts> & conditional & conditional & { ... }
An immutable Item snapshot containing a current schema-valid value.
typeRef
type Ref<T> = { ... }
A stable logical reference to one typed Item.
| Property | Type | Description |
|---|
readonly [referenceType]? | (value: T) => T | |
readonly identity | Identity | |
readonly path | string | |
typeRemoteCollection
type RemoteCollection<T, TConflicts> = CollectionReader<T, { read: query }, TConflicts> & { ... }
A read-only Collection view bound to another identity.
| Property | Type | Description |
|---|
readonly [subscriptionTarget] | SubscriptionTarget<T, TConflicts> | |
typeRemoteDocument
type RemoteDocument<T, TConflicts> = DocumentReader<T, { read: query }, TConflicts>
A read-only Document view bound to another identity.
typeResolvedResourceConflicts
type ResolvedResourceConflicts<TOverrides> = { ... }
Complete literal conflict behavior derived from a Resource's overrides.
| Property | Type | Description |
|---|
readonly delete | conditional | |
readonly update | conditional | |
typeResourceAccess
type ResourceAccess = { ... }
Operations an application requests for one Resource.
| Property | Type | Description |
|---|
readonly create? | true | |
readonly delete? | true | |
readonly read | indexedAccess | |
readonly restore? | true | |
readonly update? | true | |
typeResourceConflictOverrides
type ResourceConflictOverrides = { ... }
Optional advanced overrides for a Resource's automatic conflict behavior.
| Property | Type | Description |
|---|
readonly delete? | indexedAccess | |
readonly update? | indexedAccess | |
typeResourceConflicts
type ResourceConflicts = { ... }
Complete conflict behavior resolved for one Resource definition.
| Property | Type | Description |
|---|
readonly delete | indexedAccess | |
readonly update | indexedAccess | |
typeResourceDefinition
type ResourceDefinition<T, TAccess, TKind, TConflicts> = { ... }
Shared metadata and migration behavior for an unbound Resource.
| Property | Type | Description |
|---|
readonly [resourceDefinition] | TKind | |
readonly access | TAccess | |
readonly conflicts | TConflicts | |
readonly migrate | (stored: StoredSchemaValue) => T | |
readonly schema | SchemaClass<T> | |
typeResourceGrantPlan
type ResourceGrantPlan = { ... }
High-level authority requested for one canonically scoped Resource.
| Property | Type | Description |
|---|
readonly access | Readonly<ResourceAccess> | |
readonly path | string | |
readonly resource | string | |
typeResourceKindValue
type ResourceKindValue = query | query
One Collection or Document discriminant used throughout Resource definitions.
typeResourceOptions
type ResourceOptions<TAccess, TOverrides> = { ... }
Developer-facing access and conflict declarations for one Resource.
| Property | Type | Description |
|---|
readonly access | TAccess | |
readonly conflicts? | TOverrides | |
typeResourceRequirement
type ResourceRequirement = { ... }
High-level node behavior required by one declared Resource.
typeResourceSubscriptionPlan
type ResourceSubscriptionPlan = { ... }
One Collection prefix eligible for remote Data Subscriptions.
| Property | Type | Description |
|---|
readonly path | string | |
readonly resource | string | |
typeSchemaClass
type SchemaClass<T> = () => T
A decorated application value class used as both runtime schema and TypeScript type.
typeSchemaFieldDecorator
type SchemaFieldDecorator = PropertyDecorator
A property decorator produced by one of the typed Field helpers.
typeSchemaFieldFactory
type SchemaFieldFactory = (options?: FieldOptions) => SchemaFieldDecorator
A primitive field helper that can also describe an Array's item type.
typeSchemaOptions
type SchemaOptions = { ... }
Options for a Schema Class. Versions are positive and start at one.
| Property | Type | Description |
|---|
readonly migrations? | MigrationPlan | |
readonly version | number | |
typeShallowPatch
type ShallowPatch<T> = mapped
A shallow update: omitted fields remain and supplied fields replace whole values.
typeStoredSchemaValue
type StoredSchemaValue = { ... }
One stored schema version and its opaque value.
| Property | Type | Description |
|---|
readonly value | unknown | |
readonly version | number | |
typeSubscriptionFailureValue
type SubscriptionFailureValue = indexedAccess
typeSubscriptionStateValue
type SubscriptionStateValue = indexedAccess
typeUnavailableItem
type UnavailableItem<T, TAccess, TConflicts> = ItemSnapshot<T, query, TAccess, TConflicts>
An immutable Item snapshot whose current state cannot be determined.
Variables
constApp
const App: { ... }
Composes Resource definitions into one application definition.
| Property | Type | Description |
|---|
readonly create | (options: { data: TData; id: string; name: string; namespace: string }) => AppDefinition<TData> | |
constCollection
const Collection: { ... }
Defines an unbound typed Collection. App.create derives its path.
constDeleteConflict
const DeleteConflict: { ... }
Conflict policies for a concurrent deletion and update.
| Property | Type | Description |
|---|
readonly DeleteWins | Readonly<{ [policyKind]: "delete-conflict:delete-wins" }> | |
readonly Manual | Readonly<{ [policyKind]: "delete-conflict:manual" }> | |
readonly UpdateWins | Readonly<{ [policyKind]: "delete-conflict:update-wins" }> | |
constDocument
const Document: { ... }
Defines an unbound typed Document. App.create derives its path.
constField
const Field: { ... }
Typed field decorators for Schema Classes.
constMigrations
const Migrations: { ... }
Builds migrations and provides pure helpers for a current Schema Class.
| Property | Type | Description |
|---|
readonly create | () => MigrationPlan | |
readonly rename | (value: Readonly<Record<string, unknown>>, renames: Readonly<Record<string, string>>) => Record<string, unknown> | |
constRead
const Read: { ... }
Read scopes available to a Resource access declaration.
| Property | Type | Description |
|---|
readonly AnyIdentity | Readonly<{ [policyKind]: "read:any-identity" }> | |
readonly OwnIdentity | Readonly<{ [policyKind]: "read:own-identity" }> | |
constSubscription
const Subscription: { ... }
Creates a typed Data Subscription from a remote Collection view.
constUpdateConflict
const UpdateConflict: { ... }
Conflict policies for concurrent updates to the same field.
| Property | Type | Description |
|---|
readonly LastWriteWins | Readonly<{ [policyKind]: "update-conflict:last-write-wins" }> | |
readonly Manual | Readonly<{ [policyKind]: "update-conflict:manual" }> | |
Functions