Interfaces
AbstractStreamingSyncImplementationOptions
Internal
Extends
Properties
Property | Type | Description | Inherited from |
---|
adapter | BucketStorageAdapter | - | - |
crudUploadThrottleMs? | number | Backend Connector CRUD operations are throttled to occur at most every crudUploadThrottleMs milliseconds. | AdditionalConnectionOptions .crudUploadThrottleMs |
identifier? | string | An identifier for which PowerSync DB this sync implementation is linked to. Most commonly DB name, but not restricted to DB name. | - |
logger? | ILogger | - | - |
remote | AbstractRemote | - | - |
retryDelayMs? | number | Delay for retrying sync streaming operations from the PowerSync backend after an error occurs. | AdditionalConnectionOptions .retryDelayMs |
uploadCrud | () => Promise <void > | - | - |
AdditionalConnectionOptions
Internal
Extended by
Properties
Property | Type | Description |
---|
crudUploadThrottleMs? | number | Backend Connector CRUD operations are throttled to occur at most every crudUploadThrottleMs milliseconds. |
retryDelayMs? | number | Delay for retrying sync streaming operations from the PowerSync backend after an error occurs. |
BaseConnectionOptions
Internal
Extended by
Properties
Property | Type | Description |
---|
connectionMethod? | SyncStreamConnectionMethod | The connection method to use when streaming updates from the PowerSync backend instance. Defaults to a HTTP streaming connection. |
fetchStrategy? | FetchStrategy | The fetch strategy to use when streaming updates from the PowerSync backend instance. |
params? | Record <string , JSONValue > | These parameters are passed to the sync rules, and will be available under theuser_parameters object. |
BaseObserverInterface<T>
Extended by
Type Parameters
Methods
registerListener()
registerListener(listener): () => void
Parameters
Parameter | Type |
---|
listener | Partial <T > |
Returns
Function
Returns
void
BasePowerSyncDatabaseOptions
Internal
Extends
Extended by
Properties
Property | Type | Description | Inherited from |
---|
crudUploadThrottleMs? | number | Backend Connector CRUD operations are throttled to occur at most every crudUploadThrottleMs milliseconds. | AdditionalConnectionOptions .crudUploadThrottleMs |
logger? | ILogger | - | - |
retryDelay? | number | Deprecated Use retryDelayMs instead as this will be removed in future releases. | - |
retryDelayMs? | number | Delay for retrying sync streaming operations from the PowerSync backend after an error occurs. | AdditionalConnectionOptions .retryDelayMs |
schema | Schema | Schema used for the local database. | - |
BatchedUpdateNotification
Properties
BucketChecksum
Properties
Property | Type | Description |
---|
bucket | string | - |
checksum | number | 32-bit unsigned hash. |
count? | number | Count of operations - informational only. |
priority? | number | - |
BucketDescription
Properties
Property | Type |
---|
name | string |
priority | number |
BucketRequest
Properties
Property | Type | Description |
---|
after | string | Base-10 number. Sync all data from this bucket with op_id > after. |
name | string | - |
BucketState
Properties
Property | Type |
---|
bucket | string |
op_id | string |
BucketStorageAdapter
Extends
Properties
Methods
autoCompact()
autoCompact(): Promise<void>
Exposed for tests only.
Returns
Promise
<void
>
forceCompact()
forceCompact(): Promise<void>
Exposed for tests only.
Returns
Promise
<void
>
getBucketStates()
getBucketStates(): Promise<BucketState[]>
Returns
Promise
<BucketState
[]>
getClientId()
getClientId(): Promise<string>
Get an unique client id.
Returns
Promise
<string
>
getCrudBatch()
getCrudBatch(limit?): Promise<null | CrudBatch>
Parameters
Parameter | Type |
---|
limit ? | number |
Returns
Promise
<null
| CrudBatch
>
getMaxOpId()
Returns
string
hasCompletedSync()
hasCompletedSync(): Promise<boolean>
Returns
Promise
<boolean
>
hasCrud()
hasCrud(): Promise<boolean>
Returns
Promise
<boolean
>
init()
Returns
Promise
<void
>
iterateAsyncListeners()
iterateAsyncListeners(cb): Promise<void>
Parameters
Parameter | Type |
---|
cb | (listener ) => Promise <any > |
Returns
Promise
<void
>
Inherited from
BaseObserver
.iterateAsyncListeners
iterateListeners()
iterateListeners(cb): void
Parameters
Parameter | Type |
---|
cb | (listener ) => any |
Returns
void
Inherited from
BaseObserver
.iterateListeners
nextCrudItem()
nextCrudItem(): Promise<undefined | CrudEntry>
Returns
Promise
<undefined
| CrudEntry
>
registerListener()
registerListener(listener): () => void
Register a listener for updates to the PowerSync client.
Parameters
Returns
Function
Returns
void
Inherited from
BaseObserver
.registerListener
removeBuckets()
removeBuckets(buckets): Promise<void>
Parameters
Parameter | Type |
---|
buckets | string [] |
Returns
Promise
<void
>
saveSyncData()
saveSyncData(batch): Promise<void>
Parameters
Returns
Promise
<void
>
setTargetCheckpoint()
setTargetCheckpoint(checkpoint): Promise<void>
Parameters
Returns
Promise
<void
>
startSession()
Returns
void
syncLocalDatabase()
syncLocalDatabase(checkpoint, priority?): Promise<{
checkpointValid: boolean;
failures: any[];
ready: boolean;
}>
Parameters
Returns
Promise
<{
checkpointValid
: boolean
;
failures
: any
[];
ready
: boolean
;
}>
updateLocalTarget()
updateLocalTarget(cb): Promise<boolean>
Parameters
Parameter | Type |
---|
cb | () => Promise <string > |
Returns
Promise
<boolean
>
BucketStorageListener
Extends
Indexable
[key: string]: undefined | (...event) => any
Properties
Property | Type |
---|
crudUpdate | () => void |
Checkpoint
Properties
Property | Type |
---|
buckets | BucketChecksum [] |
last_op_id | string |
write_checkpoint? | string |
ChecksumCache
Properties
Property | Type |
---|
checksums | Map <string , { checksum : BucketChecksum ; last_op_id : string ; }> |
lastOpId | string |
ColumnOptions
Properties
CompilableQuery<T>
Type Parameters
Methods
compile()
Returns
CompiledQuery
execute()
Returns
Promise
<T
[]>
CompilableQueryWatchHandler<T>
Type Parameters
Properties
Property | Type |
---|
onError? | (error : Error ) => void |
onResult | (results : T []) => void |
CompiledQuery
Properties
Property | Modifier | Type |
---|
parameters | readonly | readonly unknown [] |
sql | readonly | string |
ContinueCheckpointRequest
For sync2.json
Properties
Property | Type | Description |
---|
buckets | BucketRequest [] | Existing bucket states. Only these buckets are synchronized. |
checkpoint_token | string | - |
limit? | number | - |
CrudRequest
For crud.json
Properties
CrudResponse
Properties
Property | Type | Description |
---|
checkpoint? | string | A sync response with a checkpoint >= this checkpoint would contain all the changes in this request. Any earlier checkpoint may or may not contain these changes. May be empty when the request contains no ops. |
DataStreamListener<Data>
Extends
Type Parameters
Type Parameter | Default type |
---|
Data extends any | any |
Indexable
[key: string]: undefined | (...event) => any
Properties
Property | Type |
---|
closed | () => void |
data | (data : Data ) => Promise <void > |
error | (error : Error ) => void |
highWater | () => Promise <void > |
lowWater | () => Promise <void > |
DBAdapter
Extends
Properties
Property | Type | Description |
---|
close | () => void | Promise <void > | - |
execute | (query : string , params ?: any []) => Promise <QueryResult > | - |
executeBatch | (query : string , params ?: any [][]) => Promise <QueryResult > | - |
name | string | - |
readLock | <T >(fn : (tx ) => Promise <T >, options ?: DBLockOptions ) => Promise <T > | - |
readTransaction | <T >(fn : (tx ) => Promise <T >, options ?: DBLockOptions ) => Promise <T > | - |
refreshSchema | () => Promise <void > | This method refreshes the schema information across all connections. This is for advanced use cases, and should generally not be needed. |
writeLock | <T >(fn : (tx ) => Promise <T >, options ?: DBLockOptions ) => Promise <T > | - |
writeTransaction | <T >(fn : (tx ) => Promise <T >, options ?: DBLockOptions ) => Promise <T > | - |
Methods
get()
get<T>(sql, parameters?): Promise<T>
Execute a read-only query and return the first result, error if the ResultSet is empty.
Type Parameters
Parameters
Parameter | Type |
---|
sql | string |
parameters ? | any [] |
Returns
Promise
<T
>
Inherited from
DBGetUtils
.get
getAll()
getAll<T>(sql, parameters?): Promise<T[]>
Execute a read-only query and return results.
Type Parameters
Parameters
Parameter | Type |
---|
sql | string |
parameters ? | any [] |
Returns
Promise
<T
[]>
Inherited from
DBGetUtils
.getAll
getOptional()
getOptional<T>(sql, parameters?): Promise<null | T>
Execute a read-only query and return the first result, or null if the ResultSet is empty.
Type Parameters
Parameters
Parameter | Type |
---|
sql | string |
parameters ? | any [] |
Returns
Promise
<null
| T
>
Inherited from
DBGetUtils
.getOptional
registerListener()
registerListener(listener): () => void
Parameters
Returns
Function
Returns
void
Inherited from
BaseObserverInterface
.registerListener
DBAdapterListener
Extends
Indexable
[key: string]: undefined | (...event) => any
Properties
Property | Type | Description |
---|
tablesUpdated | (updateNotification : | UpdateNotification | BatchedUpdateNotification ) => void | Listener for table updates. Allows for single table updates in order to maintain API compatibility without the need for a major version bump The DB adapter can also batch update notifications if supported. |
DBGetUtils
Extended by
Methods
get()
get<T>(sql, parameters?): Promise<T>
Execute a read-only query and return the first result, error if the ResultSet is empty.
Type Parameters
Parameters
Parameter | Type |
---|
sql | string |
parameters ? | any [] |
Returns
Promise
<T
>
getAll()
getAll<T>(sql, parameters?): Promise<T[]>
Execute a read-only query and return results.
Type Parameters
Parameters
Parameter | Type |
---|
sql | string |
parameters ? | any [] |
Returns
Promise
<T
[]>
getOptional()
getOptional<T>(sql, parameters?): Promise<null | T>
Execute a read-only query and return the first result, or null if the ResultSet is empty.
Type Parameters
Parameters
Parameter | Type |
---|
sql | string |
parameters ? | any [] |
Returns
Promise
<null
| T
>
DBLockOptions
Properties
Property | Type |
---|
timeoutMs? | number |
DisconnectAndClearOptions
Properties
Property | Type | Description |
---|
clearLocal? | boolean | When set to false, data in local-only tables is preserved. |
Disposable
Extended by
Properties
Property | Type |
---|
dispose | () => Promise <void > |
IndexColumnOptions
Properties
Property | Type |
---|
ascending? | boolean |
name | string |
IndexOptions
Properties
LockContext
Extends
Extended by
Properties
Property | Type | Description |
---|
execute | (query : string , params ?: any []) => Promise <QueryResult > | Execute a single write statement. |
Methods
get()
get<T>(sql, parameters?): Promise<T>
Execute a read-only query and return the first result, error if the ResultSet is empty.
Type Parameters
Parameters
Parameter | Type |
---|
sql | string |
parameters ? | any [] |
Returns
Promise
<T
>
Inherited from
DBGetUtils
.get
getAll()
getAll<T>(sql, parameters?): Promise<T[]>
Execute a read-only query and return results.
Type Parameters
Parameters
Parameter | Type |
---|
sql | string |
parameters ? | any [] |
Returns
Promise
<T
[]>
Inherited from
DBGetUtils
.getAll
getOptional()
getOptional<T>(sql, parameters?): Promise<null | T>
Execute a read-only query and return the first result, or null if the ResultSet is empty.
Type Parameters
Parameters
Parameter | Type |
---|
sql | string |
parameters ? | any [] |
Returns
Promise
<null
| T
>
Inherited from
DBGetUtils
.getOptional
LockOptions<T>
Abstract Lock to be implemented by various JS environments
Type Parameters
Properties
Property | Type |
---|
callback | () => Promise <T > |
signal? | AbortSignal |
type | LockType |
OplogEntryJSON
Properties
Property | Type |
---|
checksum | number |
data? | string |
object_id? | string |
object_type? | string |
op | string |
op_id | string |
subkey? | string | object |
ParsedQuery
Properties
Property | Type |
---|
parameters | any [] |
sqlStatement | string |
PowerSyncBackendConnector
Properties
Property | Type | Description |
---|
fetchCredentials | () => Promise <null | PowerSyncCredentials > | Allows the PowerSync client to retrieve an authentication token from your backend which is used to authenticate against the PowerSync service. This should always fetch a fresh set of credentials - don't use cached values. Return null if the user is not signed in. Throw an error if credentials cannot be fetched due to a network error or other temporary error. This token is kept for the duration of a sync connection. |
uploadData | (database : AbstractPowerSyncDatabase ) => Promise <void > | Upload local changes to the app backend. Use AbstractPowerSyncDatabase.getCrudBatch to get a batch of changes to upload. Any thrown errors will result in a retry after the configured wait period (default: 5 seconds). |
PowerSyncCloseOptions
Properties
Property | Type | Description |
---|
disconnect? | boolean | Disconnect the sync stream client if connected. This is usually true, but can be false for Web when using multiple tabs and a shared sync provider. |
PowerSyncConnectionOptions
Configurable options to be used when connecting to the PowerSync
backend instance.
Extends
Properties
PowerSyncCredentials
Properties
Property | Type |
---|
endpoint | string |
expiresAt? | Date |
token | string |
PowerSyncDatabaseOptions
Internal
Extends
Properties
PowerSyncDatabaseOptionsWithDBAdapter
Internal
Extends
Properties
PowerSyncDatabaseOptionsWithOpenFactory
Internal
Extends
Properties
PowerSyncDatabaseOptionsWithSettings
Internal
Extends
Properties
PowerSyncDBListener
Extends
Indexable
[key: string]: undefined | (...event) => any
Properties
PowerSyncOpenFactoryOptions
Extends
Properties
Property | Type | Description | Overrides | Inherited from |
---|
crudUploadThrottleMs? | number | Backend Connector CRUD operations are throttled to occur at most every crudUploadThrottleMs milliseconds. | - | Partial.crudUploadThrottleMs |
database? | | DBAdapter | SQLOpenOptions | SQLOpenFactory | Source for a SQLite database connection. This can be either: - A DBAdapter if providing an instantiated SQLite connection - A SQLOpenFactory which will be used to open a SQLite connection - SQLOpenOptions for opening a SQLite connection with a default SQLOpenFactory | - | Partial.database |
dbFilename | string | Filename for the database. | - | SQLOpenOptions .dbFilename |
dbLocation? | string | Directory where the database file is located. | - | SQLOpenOptions .dbLocation |
debugMode? | boolean | Enable debugMode to log queries to the performance timeline. Defaults to false. To enable in development builds, use: debugMode: process.env.NODE_ENV !== 'production' | - | SQLOpenOptions .debugMode |
logger? | ILogger | - | - | Partial.logger |
retryDelay? | number | Deprecated Use retryDelayMs instead as this will be removed in future releases. | - | Partial.retryDelay |
retryDelayMs? | number | Delay for retrying sync streaming operations from the PowerSync backend after an error occurs. | - | Partial.retryDelayMs |
schema | Schema | Schema used for the local database. | Partial.schema | - |
SQLOpenFactory
Methods
openDB()
Opens a connection adapter to a SQLite DB
Returns
DBAdapter
SQLOpenOptions
Extended by
Properties
Property | Type | Description |
---|
dbFilename | string | Filename for the database. |
dbLocation? | string | Directory where the database file is located. |
debugMode? | boolean | Enable debugMode to log queries to the performance timeline. Defaults to false. To enable in development builds, use: debugMode: process.env.NODE_ENV !== 'production' |
SQLWatchOptions
Properties
Property | Type | Description |
---|
rawTableNames? | boolean | Deprecated All tables specified in tables will be watched, including PowerSync tables with prefixes. Allows for watching any SQL table by not removing PowerSync table name prefixes |
signal? | AbortSignal | - |
tables? | string [] | - |
throttleMs? | number | The minimum interval between queries. |
StreamingSyncCheckpoint
Properties
StreamingSyncCheckpointComplete
Properties
Property | Type |
---|
checkpoint_complete | { last_op_id : string ; } |
checkpoint_complete.last_op_id | string |
StreamingSyncCheckpointDiff
Properties
Property | Type |
---|
checkpoint_diff | { last_op_id : string ; removed_buckets : string []; updated_buckets : BucketChecksum []; write_checkpoint : string ; } |
checkpoint_diff.last_op_id | string |
checkpoint_diff.removed_buckets | string [] |
checkpoint_diff.updated_buckets | BucketChecksum [] |
checkpoint_diff.write_checkpoint | string |
StreamingSyncCheckpointPartiallyComplete
Properties
Property | Type |
---|
partial_checkpoint_complete | { last_op_id : string ; priority : number ; } |
partial_checkpoint_complete.last_op_id | string |
partial_checkpoint_complete.priority | number |
StreamingSyncDataJSON
Properties
StreamingSyncImplementation
Extends
Properties
Property | Type | Inherited from |
---|
dispose | () => Promise <void > | Disposable .dispose |
getWriteCheckpoint | () => Promise <string > | - |
hasCompletedSync | () => Promise <boolean > | - |
isConnected | boolean | - |
lastSyncedAt? | Date | - |
syncStatus | SyncStatus | - |
triggerCrudUpload | () => void | - |
Methods
connect()
connect(options?): Promise<void>
Connects to the sync service
Parameters
Returns
Promise
<void
>
disconnect()
disconnect(): Promise<void>
Disconnects from the sync services.
Returns
Promise
<void
>
Throws
if not connected or if abort is not controlled internally
iterateAsyncListeners()
iterateAsyncListeners(cb): Promise<void>
Parameters
Parameter | Type |
---|
cb | (listener ) => Promise <any > |
Returns
Promise
<void
>
Inherited from
BaseObserver
.iterateAsyncListeners
iterateListeners()
iterateListeners(cb): void
Parameters
Parameter | Type |
---|
cb | (listener ) => any |
Returns
void
Inherited from
BaseObserver
.iterateListeners
registerListener()
registerListener(listener): () => void
Register a listener for updates to the PowerSync client.
Parameters
Returns
Function
Returns
void
Inherited from
BaseObserver
.registerListener
waitForReady()
waitForReady(): Promise<void>
Returns
Promise
<void
>
waitForStatus()
waitForStatus(status): Promise<void>
Parameters
Returns
Promise
<void
>
waitUntilStatusMatches()
waitUntilStatusMatches(predicate): Promise<void>
Parameters
Parameter | Type |
---|
predicate | (status ) => boolean |
Returns
Promise
<void
>
StreamingSyncImplementationListener
Extends
Extended by
Indexable
[key: string]: undefined | (...event) => any
Properties
Property | Type | Description |
---|
statusChanged? | (status : SyncStatus ) => void | Triggers whenever the status' members have changed in value |
statusUpdated? | (statusUpdate : SyncStatusOptions ) => void | Triggered whenever a status update has been attempted to be made or refreshed. |
StreamingSyncKeepalive
Properties
Property | Type | Description |
---|
token_expires_in | number | If specified, token expires in this many seconds. |
StreamingSyncRequest
Properties
Property | Type | Description |
---|
buckets? | BucketRequest [] | Existing bucket states. |
client_id? | string | - |
include_checksum | boolean | Whether or not to compute a checksum for each checkpoint |
only? | string [] | If specified, limit the response to only include these buckets. |
parameters? | Record <string , JSONValue > | Client parameters to be passed to the sync rules. |
raw_data | boolean | Changes the response to stringified data in each OplogEntry |
SyncLocalDatabaseResult
Properties
Property | Type |
---|
checkpointFailures? | string [] |
checkpointValid | boolean |
ready | boolean |
SyncNewCheckpointRequest
Properties
Property | Type | Description |
---|
buckets? | BucketRequest [] | Existing bucket states. Used if include_data is specified. |
limit? | number | - |
request_checkpoint | { include_checksum : boolean ; include_data : boolean ; } | - |
request_checkpoint.include_checksum | boolean | Whether or not to compute a checksum. |
request_checkpoint.include_data | boolean | Whether or not to include an initial data request. |
SyncPriorityStatus
Properties
Property | Type |
---|
hasSynced? | boolean |
lastSyncedAt? | Date |
priority | number |
SyncResponse
Properties
Property | Type | Description |
---|
checkpoint? | Checkpoint | - |
checkpoint_token? | string | - |
data? | SyncDataBucketJSON [] | Data for the buckets returned. May not have an an entry for each bucket in the request. |
has_more | boolean | True if the response limit has been reached, and another request must be made. |
TableOptions
Properties
Property | Type | Description |
---|
columns | Column [] | - |
indexes? | Index [] | - |
insertOnly? | boolean | - |
localOnly? | boolean | - |
name | string | The synced table name, matching sync rules |
viewName? | string | - |
TableUpdateOperation
Extended by
Properties
TableV2Options
Properties
Property | Type |
---|
indexes? | IndexShorthand |
insertOnly? | boolean |
localOnly? | boolean |
viewName? | string |
Transaction
Extends
Properties
Property | Type | Description | Inherited from |
---|
commit | () => Promise <QueryResult > | Commit multiple changes to the local DB using the Transaction context. | - |
execute | (query : string , params ?: any []) => Promise <QueryResult > | Execute a single write statement. | LockContext .execute |
rollback | () => Promise <QueryResult > | Roll back multiple attempted changes using the Transaction context. | - |
Methods
get()
get<T>(sql, parameters?): Promise<T>
Execute a read-only query and return the first result, error if the ResultSet is empty.
Type Parameters
Parameters
Parameter | Type |
---|
sql | string |
parameters ? | any [] |
Returns
Promise
<T
>
Inherited from
LockContext
.get
getAll()
getAll<T>(sql, parameters?): Promise<T[]>
Execute a read-only query and return results.
Type Parameters
Parameters
Parameter | Type |
---|
sql | string |
parameters ? | any [] |
Returns
Promise
<T
[]>
Inherited from
LockContext
.getAll
getOptional()
getOptional<T>(sql, parameters?): Promise<null | T>
Execute a read-only query and return the first result, or null if the ResultSet is empty.
Type Parameters
Parameters
Parameter | Type |
---|
sql | string |
parameters ? | any [] |
Returns
Promise
<null
| T
>
Inherited from
LockContext
.getOptional
UpdateNotification
Notification of an update to one or more tables, for the purpose of realtime change notifications.
Extends
Properties
WatchHandler
Properties
Property | Type |
---|
onError? | (error : Error ) => void |
onResult | (results : QueryResult ) => void |
WatchOnChangeEvent
Properties
Property | Type |
---|
changedTables | string [] |
WatchOnChangeHandler
Properties
Property | Type |
---|
onChange | (event : WatchOnChangeEvent ) => void | Promise <void > |
onError? | (error : Error ) => void |
Type Aliases
AbstractRemoteOptions
type AbstractRemoteOptions = {
fetchImplementation: | FetchImplementation
| FetchImplementationProvider;
socketUrlTransformer: (url) => string;
};
Type declaration
Name | Type | Description |
---|
fetchImplementation | | FetchImplementation | FetchImplementationProvider | Optionally provide the fetch implementation to use. Note that this usually needs to be bound to the global scope. Binding should be done before passing here. |
socketUrlTransformer | (url ) => string | Transforms the PowerSync base URL which might contain http(s):// to the corresponding WebSocket variant e.g. ws(s):// |
BaseColumnType<T>
type BaseColumnType<T> = {
type: ColumnType;
};
Type Parameters
Type Parameter |
---|
T extends number | string | null |
Type declaration
BaseListener
Index Signature
[key: string]: undefined | (...event) => any
BSONImplementation
type BSONImplementation = typeof BSON;
ColumnsType
type ColumnsType = Record<string, BaseColumnType<any>>;
DataStreamCallback()<Data>
type DataStreamCallback<Data> = (data) => Promise<void>;
Type Parameters
Type Parameter | Default type |
---|
Data extends any | any |
Parameters
Returns
Promise
<void
>
DataStreamOptions
type DataStreamOptions = {
closeOnError: boolean;
logger: ILogger;
pressure: {
highWaterMark: number;
lowWaterMark: number;
};
};
Type declaration
Name | Type | Description |
---|
closeOnError ? | boolean | Close the stream if any consumer throws an error |
logger ? | ILogger | - |
pressure ? | { highWaterMark : number ; lowWaterMark : number ; } | - |
pressure.highWaterMark ? | number | - |
pressure.lowWaterMark ? | number | - |
ExtractColumnValueType<T>
type ExtractColumnValueType<T> = T extends BaseColumnType<infer R> ? R : unknown;
Type Parameters
FetchImplementation
type FetchImplementation = typeof fetch;
IndexShorthand
type IndexShorthand = Record<string, string[]>;
OpId
64-bit unsigned integer stored as a string in base-10.
Not sortable as a string.
OpTypeJSON
type OpTypeJSON = string;
QueryResult
type QueryResult = {
insertId: number;
rows: {
_array: any[];
item: (idx) => any;
length: number;
};
rowsAffected: number;
};
Object returned by SQL Query executions.
Type declaration
Name | Type | Description |
---|
insertId ? | number | Represents the auto-generated row id if applicable. |
rows ? | { _array : any []; item : (idx ) => any ; length : number ; } | if status is undefined or 0 this object will contain the query results |
rows._array | any [] | Raw array with all dataset |
rows.item | (idx ) => any | A convenience function to acess the index based the row object |
rows.length | number | The length of the dataset |
rowsAffected | number | Number of affected rows if result of a update query. |
RemoteConnector
type RemoteConnector = {
fetchCredentials: () => Promise<PowerSyncCredentials | null>;
};
Type declaration
RequiredAdditionalConnectionOptions
type RequiredAdditionalConnectionOptions = Required<AdditionalConnectionOptions>;
Internal
RequiredPowerSyncConnectionOptions
type RequiredPowerSyncConnectionOptions = Required<BaseConnectionOptions>;
RowType<T>
type RowType<T> = { [K in keyof T["columnMap"]]: ExtractColumnValueType<T["columnMap"][K]> } & {
id: string;
};
Type declaration
Type Parameters
Type Parameter |
---|
T extends TableV2 <any > |
SchemaTableType<S>
type SchemaTableType<S> = { [K in keyof S]: RowType<S[K]> };
Type Parameters
Type Parameter |
---|
S extends SchemaType |
SocketSyncStreamOptions
type SocketSyncStreamOptions = SyncStreamOptions & {
fetchStrategy: FetchStrategy;
};
Type declaration
StreamingSyncLine
type StreamingSyncLine =
| StreamingSyncDataJSON
| StreamingSyncCheckpoint
| StreamingSyncCheckpointDiff
| StreamingSyncCheckpointComplete
| StreamingSyncCheckpointPartiallyComplete
| StreamingSyncKeepalive;
StreamingSyncRequestParameterType
type StreamingSyncRequestParameterType = JSONValue;
SyncDataBucketJSON
type SyncDataBucketJSON = {
after: string;
bucket: string;
data: OplogEntryJSON[];
has_more: boolean;
next_after: string;
};
Type declaration
Name | Type |
---|
after ? | string |
bucket | string |
data | OplogEntryJSON [] |
has_more ? | boolean |
next_after ? | string |
SyncDataFlowStatus
type SyncDataFlowStatus = Partial<{
downloading: boolean;
uploading: boolean;
}>;
SyncRequest
type SyncRequest =
| ContinueCheckpointRequest
| SyncNewCheckpointRequest;
SyncStatusOptions
type SyncStatusOptions = {
connected: boolean;
connecting: boolean;
dataFlow: SyncDataFlowStatus;
hasSynced: boolean;
lastSyncedAt: Date;
priorityStatusEntries: SyncPriorityStatus[];
};
Type declaration
SyncStreamOptions
type SyncStreamOptions = {
abortSignal: AbortSignal;
data: StreamingSyncRequest;
fetchOptions: Request;
headers: Record<string, string>;
path: string;
};
Type declaration
Name | Type |
---|
abortSignal ? | AbortSignal |
data | StreamingSyncRequest |
fetchOptions ? | Request |
headers ? | Record <string , string > |
path | string |
Variables
column
const column: {
integer: BaseColumnType<number | null>;
real: BaseColumnType<number | null>;
text: BaseColumnType<string | null>;
};
Type declaration
DEFAULT_CRUD_BATCH_LIMIT
const DEFAULT_CRUD_BATCH_LIMIT: 100 = 100;
DEFAULT_CRUD_UPLOAD_THROTTLE_MS
const DEFAULT_CRUD_UPLOAD_THROTTLE_MS: 1000 = 1000;
DEFAULT_INDEX_COLUMN_OPTIONS
const DEFAULT_INDEX_COLUMN_OPTIONS: Partial<IndexColumnOptions>;
DEFAULT_INDEX_OPTIONS
const DEFAULT_INDEX_OPTIONS: Partial<IndexOptions>;
DEFAULT_LOCK_TIMEOUT_MS
const DEFAULT_LOCK_TIMEOUT_MS: 120000 = 120000;
Requesting nested or recursive locks can block the application in some circumstances.
This default lock timeout will act as a failsafe to throw an error if a lock cannot
be obtained.
DEFAULT_POWERSYNC_CLOSE_OPTIONS
const DEFAULT_POWERSYNC_CLOSE_OPTIONS: PowerSyncCloseOptions;
DEFAULT_POWERSYNC_DB_OPTIONS
const DEFAULT_POWERSYNC_DB_OPTIONS: {
crudUploadThrottleMs: number;
logger: Logger.ILogger;
retryDelayMs: number;
};
Type declaration
Name | Type |
---|
crudUploadThrottleMs | number |
logger | Logger.ILogger |
retryDelayMs | number |
DEFAULT_PRESSURE_LIMITS
const DEFAULT_PRESSURE_LIMITS: {
highWater: number;
lowWater: number;
};
Type declaration
Name | Type |
---|
highWater | number |
lowWater | number |
DEFAULT_REMOTE_LOGGER
const DEFAULT_REMOTE_LOGGER: Logger.ILogger;
DEFAULT_REMOTE_OPTIONS
const DEFAULT_REMOTE_OPTIONS: AbstractRemoteOptions;
DEFAULT_RETRY_DELAY_MS
const DEFAULT_RETRY_DELAY_MS: 5000 = 5000;
DEFAULT_STREAM_CONNECTION_OPTIONS
const DEFAULT_STREAM_CONNECTION_OPTIONS: RequiredPowerSyncConnectionOptions;
DEFAULT_STREAMING_SYNC_OPTIONS
const DEFAULT_STREAMING_SYNC_OPTIONS: {
crudUploadThrottleMs: number;
logger: Logger.ILogger;
retryDelayMs: number;
};
Type declaration
Name | Type |
---|
crudUploadThrottleMs | number |
logger | Logger.ILogger |
retryDelayMs | number |
DEFAULT_TABLE_OPTIONS
const DEFAULT_TABLE_OPTIONS: {
indexes: never[];
insertOnly: boolean;
localOnly: boolean;
};
Type declaration
Name | Type |
---|
indexes | never [] |
insertOnly | boolean |
localOnly | boolean |
DEFAULT_WATCH_THROTTLE_MS
const DEFAULT_WATCH_THROTTLE_MS: 30 = 30;
InvalidSQLCharacters
const InvalidSQLCharacters: RegExp;
MAX_AMOUNT_OF_COLUMNS
const MAX_AMOUNT_OF_COLUMNS: 1999 = 1999;
MAX_OP_ID
const MAX_OP_ID: "9223372036854775807" = "9223372036854775807";
Enumerations
Classes
Functions