API reference / @evolu/common / Evolu/Internal
Evolu/Internal
🛠️
Example
import { Evolu } from "@evolu/common/evolu";
Interfaces
Interface | Description |
---|---|
AppState | - |
ClientStorage | Common interface for both client and relay SQLite storages. |
ClientStorageDep | - |
Config | - |
ConfigDep | - |
CreateAppStateDep | - |
CreateDbWorkerDep | - |
CreateSyncDep | - |
DbSnapshot | - |
Evolu | - |
EvoluConfigWithInitialData | - |
EvoluForInitialData | - |
FlushSyncDep | - |
MutationOptions | - |
NetworkError | - |
OwnerRowRefDep | - |
PaymentRequiredError | - |
QueryPatches | - |
QueryRowsCache | - |
Relay | - |
RelayConfig | - |
ReplaceAllPatch | - |
ReplaceAtPatch | - |
Row | - |
ServerError | - |
SubscribedQueries | - |
Sync | - |
SyncConfig | - |
SyncDep | - |
SyncStateInitial | The initial synchronization state when the app starts. In this state, the app needs to determine whether the data is synced. |
SyncStateIsNotSynced | - |
SyncStateIsSynced | - |
SyncStateIsSyncing | - |
TimestampConfig | - |
TimestampConfigDep | - |
TimestampCounterOverflowError | - |
TimestampDriftError | - |
TimestampDuplicateNodeError | - |
TimestampTimeOutOfRangeError | - |
ValidMutationSizeError | - |
Type Aliases
Type Alias | Description |
---|---|
BinaryTimestamp | BinaryTimestamp is a binary and sortable version of Timestamp for DB. |
Counter | - |
CreateAppState | - |
CreateDbWorker | - |
CreateQuery | - |
CreateSync | - |
DbIndex | - |
DbIndexesBuilder | - |
DbSchema | - |
DbTable | - |
DbWorker | - |
DbWorkerInput | - |
DbWorkerOutput | - |
DbWorkerPlatformDeps | - |
DefaultColumns | - |
EvoluDeps | - |
EvoluError | Represent errors that can occur in Evolu. |
EvoluSchema | Defines the schema of an Evolu database. |
FlushSync | FlushSync is for libraries like React to flush updates synchronously inside the provided callback to ensure the DOM is updated immediately. |
InferColumnErrors | - |
InferEvoluSchemaError | - |
InferMutationTypeErrors | - |
InferRow | - |
Insertable | - |
InsertableProps | - |
Millis | - |
Mutation | - |
MutationKind | - |
MutationMapping | - |
NodeId | - |
Patch | - |
Queries | - |
QueriesToQueryRows | - |
QueriesToQueryRowsPromises | - |
Query | A type-safe SQL query. |
QueryRows | Rows returned by a query. |
QueryRowsMap | - |
RelaySqliteStorageDeps | - |
SchemaValidationError | Schema validation error that shows clear, readable messages |
SyncState | The possible states of a synchronization process. The SyncState can be one of the following: |
Timestamp | - |
TimestampError | - |
TimestampString | TimestampString is a sortable string version of Timestamp. |
Updateable | - |
UpdateableProps | - |
Upsertable | - |
UpsertableProps | - |
ValidateColumnTypes | - |
ValidateIdColumnType | - |
ValidateNoDefaultColumns | - |
ValidateSchema | Validates an EvoluSchema at compile time, returning the first error found as a readable string literal type. This approach provides much clearer and more actionable TypeScript errors than the default, which are often hard to read. |
ValidateSchemaHasId | - |
ValidMutationSize | - |
Variables
Variable | Description |
---|---|
binaryTimestampLength | - |
Counter | - |
createWebSocketSync | - |
DbIndex | - |
DbSchema | - |
DbTable | - |
DefaultColumns | Default columns automatically added to all tables. |
defaultConfig | - |
emptyRows | - |
eqTimestamp | Equality function for comparing Timestamp. |
formatValidMutationSizeError | - |
initialSyncState | - |
kysely | - |
kyselyJsonIdentifier | A unique identifier prepended to JSON-encoded strings. This allows safe detection and parsing of only those columns that require JSON.parse. |
maxCounter | - |
maxMillis | - |
maxMutationSize | Evolu has to limit the maximum mutation size. Otherwise, sync couldn't use the maxProtocolMessageRangesSize. The max size is 640KB in bytes, measured via MessagePack. Evolu Protocol DbChange will be smaller thanks to various optimizations. |
maxNodeId | - |
Millis | Millis is a timestamp in milliseconds, like Date.now() , but limited to the maximum value representable in 6 bytes (281474976710655) minus 1 (reserved for infinity). This enables more efficient binary serialization, saving 2 bytes compared to the typical 8-byte (64-bit) timestamp representation. |
minCounter | - |
minMillis | - |
minNodeId | - |
NodeId | A NodeId uniquely identifies an owner's device. Generated once per device using cryptographic randomness. |
orderBinaryTimestamp | - |
Timestamp | Hybrid Logical Clock timestamp. |
Functions
Function | Description |
---|---|
applyMessageToTimestampAndHistoryTables | - |
applyPatches | - |
binaryTimestampToTimestamp | - |
createAppTable | - |
createDbWorkerForPlatform | - |
createEvolu | Creates an Evolu instance configured with the specified EvoluSchema and optional configuration. |
createIndexes | - |
createInitialTimestamp | - |
createNamespaceName | - |
createQueryRowsCache | - |
createRelayStorage | - |
createSubscribedQueries | - |
createTimestamp | - |
deserializeQuery | - |
evoluSchemaToDbSchema | - |
getDbSchema | Get the current database schema by reading SQLite metadata. |
getDbSnapshot | - |
insertable | Type Factory to create insertable Type. It makes nullable Types optional, omits Id, and ensures the maxMutationSize. |
makePatches | We detect only changes in the whole result and in-place edits. In the future, we will add more heuristics. We will probably not implement the Myers diff algorithm because it's faster to rerender all than to compute many detailed patches. We will only implement logic a developer would implement manually, if necessary. |
parseSqliteJsonArray | - |
receiveTimestamp | - |
sendTimestamp | - |
serializeQuery | Evolu serializes SqliteQuery into a string to be easily used as a key and for comparison. |
timestampStringToTimestamp | - |
timestampToBinaryTimestamp | - |
timestampToTimestampString | - |
updateable | Type Factory to create updateable Type. It makes everything except for the id column partial (i.e. optional) and ensures the maxMutationSize. |
upsertable | Type Factory to create upsertable Type. It makes nullable Types optional, includes optional default columns (createdAt, isDeleted), and ensures the maxMutationSize. |
applyProtocolMessageAsClient
Re-exports applyProtocolMessageAsClient
ApplyProtocolMessageAsClientOptions
Re-exports ApplyProtocolMessageAsClientOptions
applyProtocolMessageAsRelay
Re-exports applyProtocolMessageAsRelay
ApplyProtocolMessageAsRelayOptions
Re-exports ApplyProtocolMessageAsRelayOptions
AppOwner
Re-exports AppOwner
Base64Url256
Re-exports Base64Url256
base64Url256ToBytes
Re-exports base64Url256ToBytes
Base64Url256Variant
Re-exports Base64Url256Variant
BinaryId
Re-exports BinaryId
binaryIdLength
Re-exports binaryIdLength
binaryIdToId
Re-exports binaryIdToId
BinaryOwnerId
Re-exports BinaryOwnerId
binaryOwnerIdToOwnerId
Re-exports binaryOwnerIdToOwnerId
binaryTimestampToFingerprint
Re-exports binaryTimestampToFingerprint
CrdtMessage
Re-exports CrdtMessage
createAppOwner
Re-exports createAppOwner
createOwner
Re-exports createOwner
createOwnerRow
Re-exports createOwnerRow
createProtocolMessageBuffer
Re-exports createProtocolMessageBuffer
createProtocolMessageForSync
Re-exports createProtocolMessageForSync
createProtocolMessageForWriteKeyRotation
Re-exports createProtocolMessageForWriteKeyRotation
createProtocolMessageFromCrdtMessages
Re-exports createProtocolMessageFromCrdtMessages
createShardOwner
Re-exports createShardOwner
createSharedOwner
Re-exports createSharedOwner
createSharedReadonlyOwner
Re-exports createSharedReadonlyOwner
createSqliteStorageBase
Re-exports createSqliteStorageBase
CreateSqliteStorageBaseOptions
Re-exports CreateSqliteStorageBaseOptions
createTimestampsBuffer
Re-exports createTimestampsBuffer
createWriteKey
Re-exports createWriteKey
DbChange
Re-exports DbChange
decodeBase64Url256
Re-exports decodeBase64Url256
decodeBase64Url256WithLength
Re-exports decodeBase64Url256WithLength
decodeLength
Re-exports decodeLength
decodeNodeId
Re-exports decodeNodeId
decodeNonNegativeInt
Re-exports decodeNonNegativeInt
decodeNumber
Re-exports decodeNumber
decodeProtocolMessageToJson
Re-exports decodeProtocolMessageToJson
decodeSqliteValue
Re-exports decodeSqliteValue
decodeString
Re-exports decodeString
decryptAndDecodeDbChange
Re-exports decryptAndDecodeDbChange
encodeAndEncryptDbChange
Re-exports encodeAndEncryptDbChange
encodeBase64Url256
Re-exports encodeBase64Url256
encodeLength
Re-exports encodeLength
encodeNodeId
Re-exports encodeNodeId
encodeNonNegativeInt
Re-exports encodeNonNegativeInt
encodeNumber
Re-exports encodeNumber
encodeSqliteValue
Re-exports encodeSqliteValue
encodeString
Re-exports encodeString
EncryptedCrdtMessage
Re-exports EncryptedCrdtMessage
EncryptedDbChange
Re-exports EncryptedDbChange
Fingerprint
Re-exports Fingerprint
FingerprintRange
Re-exports FingerprintRange
fingerprintSize
Re-exports fingerprintSize
getTimestampByIndex
Re-exports getTimestampByIndex
idToBinaryId
Re-exports idToBinaryId
InfiniteUpperBound
Re-exports InfiniteUpperBound
maxProtocolMessageRangesSize
Re-exports maxProtocolMessageRangesSize
maxProtocolMessageSize
Re-exports maxProtocolMessageSize
Owner
Re-exports Owner
OwnerId
Re-exports OwnerId
ownerIdToBinaryOwnerId
Re-exports ownerIdToBinaryOwnerId
OwnerRow
Re-exports OwnerRow
OwnerWithWriteAccess
Re-exports OwnerWithWriteAccess
ProtocolError
Re-exports ProtocolError
ProtocolErrorBase
Re-exports ProtocolErrorBase
ProtocolErrorCode
Re-exports ProtocolErrorCode
ProtocolInvalidDataError
Re-exports ProtocolInvalidDataError
ProtocolMessage
Re-exports ProtocolMessage
ProtocolMessageBuffer
Re-exports ProtocolMessageBuffer
ProtocolSyncError
Re-exports ProtocolSyncError
ProtocolTimestampMismatchError
Re-exports ProtocolTimestampMismatchError
ProtocolUnsupportedVersionError
Re-exports ProtocolUnsupportedVersionError
ProtocolValueType
Re-exports ProtocolValueType
protocolVersion
Re-exports protocolVersion
ProtocolWriteError
Re-exports ProtocolWriteError
ProtocolWriteKeyError
Re-exports ProtocolWriteKeyError
Range
Re-exports Range
RangeType
Re-exports RangeType
RangeUpperBound
Re-exports RangeUpperBound
rotateWriteKey
Re-exports rotateWriteKey
ShardOwner
Re-exports ShardOwner
SharedOwner
Re-exports SharedOwner
SharedReadonlyOwner
Re-exports SharedReadonlyOwner
SkipRange
Re-exports SkipRange
SqliteStorageBase
Re-exports SqliteStorageBase
SqliteStorageBaseDep
Re-exports SqliteStorageBaseDep
SqliteStorageDeps
Re-exports SqliteStorageDeps
Storage
Re-exports Storage
StorageDep
Re-exports StorageDep
TimestampsBuffer
Re-exports TimestampsBuffer
TimestampsRange
Re-exports TimestampsRange
TimestampsRangeWithTimestampsBuffer
Re-exports TimestampsRangeWithTimestampsBuffer
WriteKey
Re-exports WriteKey
writeKeyLength
Re-exports writeKeyLength
WriteKeyMode
Re-exports WriteKeyMode
zeroFingerprint
Re-exports zeroFingerprint