@delali/sirannon-db 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/backup-scheduler/index.d.ts +2 -2
- package/dist/{change-tracker-DDmXB754.d.ts → change-tracker-C2Z8UbI0.d.ts} +2 -2
- package/dist/client/index.d.ts +8 -8
- package/dist/client/topology.d.ts +6 -6
- package/dist/{client-base-CmZO0v3m.d.ts → client-base-CqTMYzQP.d.ts} +14 -5
- package/dist/codegen/index.d.ts +2 -2
- package/dist/core/index.d.ts +11 -11
- package/dist/{database-B5Qv1-cU.d.ts → database-DvSvONb-.d.ts} +3 -3
- package/dist/driver/better-sqlite3.d.ts +2 -2
- package/dist/driver/bun.d.ts +2 -2
- package/dist/driver/expo.d.ts +2 -2
- package/dist/driver/node.d.ts +2 -2
- package/dist/driver/wa-sqlite.d.ts +2 -2
- package/dist/file-migrations/index.d.ts +2 -2
- package/dist/{operation-registry-hlbhqu7q.d.ts → operation-registry-6qErmUT2.d.ts} +1 -1
- package/dist/{protocol-rqANt-9Q.d.ts → protocol-CEBVo1tO.d.ts} +2 -2
- package/dist/{query-types-DL3LtPvY.d.ts → query-types-BvkzxKQv.d.ts} +10 -1
- package/dist/react/index.d.ts +2 -2
- package/dist/replication/index.d.ts +8 -8
- package/dist/server/index.d.ts +25 -8
- package/dist/server/index.mjs +117 -11
- package/dist/{server-options-Dab_Jvd_.d.ts → server-options-BVAFmguz.d.ts} +5 -3
- package/dist/{sirannon-CMhiJa5Y.d.ts → sirannon-DVYfrNiq.d.ts} +2 -2
- package/dist/transport/grpc.d.ts +4 -4
- package/dist/transport/memory.d.ts +4 -4
- package/dist/{types-rVZKnKN-.d.ts → types-CXoPBeDM.d.ts} +1 -1
- package/dist/{types-DyrCiWuc.d.ts → types-DtUwSmAQ.d.ts} +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
Build a networked SQLite service with connection pooling, change data capture, live queries, migrations, backups, device sync, and a client SDK. Applications reach Sirannon over HTTP or WebSocket, and Sirannon nodes replicate primary-owned changes over gRPC.
|
|
10
10
|
|
|
11
|
-
**Read the full documentation at [sirannon.sondelali.com/docs](https://sirannon.sondelali.com/docs).** This page gets you running, and the [guides](#documentation) hold the reference depth.
|
|
11
|
+
**Read the full documentation at [sirannon.sondelali.com/docs](https://sirannon.sondelali.com/docs).** This page gets you running, and the [guides](#documentation) hold the reference depth. The suite that measures Sirannon against Postgres 17 is a Python project under [`benchmarks/server`](../../benchmarks/server), and the write-up generator rewrites [BENCHMARKS.md](../../BENCHMARKS.md) from the latest committed run.
|
|
12
12
|
|
|
13
13
|
The core engine, server, client, and primary-replica replication are stable. Coordinator-backed failover, device sync, and the Bun and Expo drivers are experimental.
|
|
14
14
|
|
|
@@ -108,6 +108,8 @@ const subscription = db
|
|
|
108
108
|
.subscribe(event => console.log(event.type, event.table, event.row, event.oldRow, event.seq))
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
+
A filter reports membership of the set it describes. An order whose `status` changes from `pending` to `shipped` arrives as an insert, because the row enters the filter, and one that changes away from `shipped` arrives as a delete carrying the old row. Read `event.type` as the row's arrival or departure, since a real insert and a row entering the filter look the same.
|
|
112
|
+
|
|
111
113
|
A live query reports the current answer, updating the rows it holds from those same events:
|
|
112
114
|
|
|
113
115
|
```ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as SQLiteConnection, f as BackupScheduleOptions } from '../types-
|
|
2
|
-
import '../query-types-
|
|
1
|
+
import { e as SQLiteConnection, f as BackupScheduleOptions } from '../types-CXoPBeDM.js';
|
|
2
|
+
import '../query-types-BvkzxKQv.js';
|
|
3
3
|
|
|
4
4
|
declare class BackupManager {
|
|
5
5
|
backup(conn: SQLiteConnection, destPath: string): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { e as SQLiteConnection } from './types-
|
|
2
|
-
import { C as ChangeEvent } from './query-types-
|
|
1
|
+
import { e as SQLiteConnection } from './types-CXoPBeDM.js';
|
|
2
|
+
import { C as ChangeEvent } from './query-types-BvkzxKQv.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* How long a change tracker keeps changes, and how much it reads at a time.
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export { F as FieldMergeResolver, L as LWWResolver, P as PrimaryWinsResolver } from '../primary-wins-B0np8JS3.js';
|
|
2
2
|
import { C as ConflictResolver, R as ReplicationBatch } from '../types-CjhxcjhA.js';
|
|
3
3
|
export { a as ConflictContext, b as ConflictResolution } from '../types-CjhxcjhA.js';
|
|
4
|
-
import { C as ClientOptions, B as BulkLoadDurability } from '../server-options-
|
|
5
|
-
import { D as DatabaseClient, T as Transport, L as LiveHandlers, R as RemoteSubscription, a as RemoteSubscriptionBuilder, S as SubscribeOptions, b as RegistryDigestSource } from '../client-base-
|
|
6
|
-
export { c as LoadAllOptions, d as RemoteDatabase, e as RemoteError, f as SQL_REFUSED_MESSAGE, g as ServerCapabilities, h as ServerCapabilityCheck } from '../client-base-
|
|
4
|
+
import { C as ClientOptions, B as BulkLoadDurability } from '../server-options-BVAFmguz.js';
|
|
5
|
+
import { D as DatabaseClient, T as Transport, L as LiveHandlers, R as RemoteSubscription, a as RemoteSubscriptionBuilder, S as SubscribeOptions, b as RegistryDigestSource } from '../client-base-CqTMYzQP.js';
|
|
6
|
+
export { c as LoadAllOptions, d as RemoteDatabase, e as RemoteError, f as SQL_REFUSED_MESSAGE, g as ServerCapabilities, h as ServerCapabilityCheck } from '../client-base-CqTMYzQP.js';
|
|
7
7
|
import { a as LiveQuery, b as LiveQueryState, c as LiveUpdate } from '../types-BCejqzNA.js';
|
|
8
|
-
import { e as DeviceSyncPort, D as Database } from '../database-
|
|
9
|
-
import { C as ChangeEvent, P as Params, R as ReadConcern, W as WriteConcern } from '../query-types-
|
|
10
|
-
import { Q as QueryResponse, E as ExecuteResponse, a as TransactionResponse, B as BatchResponse, L as LoadResponse, A as AckResponse } from '../protocol-
|
|
11
|
-
import '../operation-registry-
|
|
12
|
-
import '../types-
|
|
8
|
+
import { e as DeviceSyncPort, D as Database } from '../database-DvSvONb-.js';
|
|
9
|
+
import { C as ChangeEvent, P as Params, R as ReadConcern, W as WriteConcern } from '../query-types-BvkzxKQv.js';
|
|
10
|
+
import { Q as QueryResponse, E as ExecuteResponse, a as TransactionResponse, B as BatchResponse, L as LoadResponse, A as AckResponse } from '../protocol-CEBVo1tO.js';
|
|
11
|
+
import '../operation-registry-6qErmUT2.js';
|
|
12
|
+
import '../types-CXoPBeDM.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @public
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { a as ReadConcernLevel } from '../query-types-
|
|
2
|
-
import { C as ClientOptions } from '../server-options-
|
|
3
|
-
import { T as Transport, D as DatabaseClient } from '../client-base-
|
|
4
|
-
import '../operation-registry-
|
|
1
|
+
import { a as ReadConcernLevel } from '../query-types-BvkzxKQv.js';
|
|
2
|
+
import { C as ClientOptions } from '../server-options-BVAFmguz.js';
|
|
3
|
+
import { T as Transport, D as DatabaseClient } from '../client-base-CqTMYzQP.js';
|
|
4
|
+
import '../operation-registry-6qErmUT2.js';
|
|
5
5
|
import '../types-CjhxcjhA.js';
|
|
6
|
-
import '../types-
|
|
6
|
+
import '../types-CXoPBeDM.js';
|
|
7
7
|
import '../types-BCejqzNA.js';
|
|
8
|
-
import '../protocol-
|
|
8
|
+
import '../protocol-CEBVo1tO.js';
|
|
9
9
|
|
|
10
10
|
interface TopologyRouting {
|
|
11
11
|
_getReadEndpoint(databaseId?: string, readConcern?: ReadConcernLevel): Promise<string>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { B as BulkLoadDurability, a as BulkLoadResult, C as ClientOptions } from './server-options-
|
|
1
|
+
import { B as BulkLoadDurability, a as BulkLoadResult, C as ClientOptions } from './server-options-BVAFmguz.js';
|
|
2
2
|
import { R as ResultOp, a as LiveQuery } from './types-BCejqzNA.js';
|
|
3
|
-
import { O as OperationRef, b as OperationArguments } from './operation-registry-
|
|
4
|
-
import { P as Params, R as ReadConcern, W as WriteConcern, C as ChangeEvent, Q as QueryOptions } from './query-types-
|
|
5
|
-
import { Q as QueryResponse, E as ExecuteResponse, a as TransactionResponse, B as BatchResponse, L as LoadResponse } from './protocol-
|
|
3
|
+
import { O as OperationRef, b as OperationArguments } from './operation-registry-6qErmUT2.js';
|
|
4
|
+
import { P as Params, R as ReadConcern, W as WriteConcern, C as ChangeEvent, Q as QueryOptions } from './query-types-BvkzxKQv.js';
|
|
5
|
+
import { Q as QueryResponse, E as ExecuteResponse, a as TransactionResponse, B as BatchResponse, L as LoadResponse } from './protocol-CEBVo1tO.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Message a client raises when the server accepts no SQL over the network.
|
|
@@ -138,7 +138,16 @@ interface RemoteSubscription {
|
|
|
138
138
|
* @public
|
|
139
139
|
*/
|
|
140
140
|
interface RemoteSubscriptionBuilder {
|
|
141
|
-
/**
|
|
141
|
+
/**
|
|
142
|
+
* Narrows the subscription to rows whose columns equal the given values.
|
|
143
|
+
*
|
|
144
|
+
* The filter reports membership of the matching set, so an update that moves a row
|
|
145
|
+
* into the set arrives as an insert carrying no `oldRow`, and one that moves a row
|
|
146
|
+
* out arrives as a delete carrying the old row and an empty `row`. An update that
|
|
147
|
+
* leaves the row in the set arrives unchanged, and one that never touches the set
|
|
148
|
+
* is not delivered. A synthesised event is indistinguishable from a real insert or
|
|
149
|
+
* delete, so read `type` as the row's arrival or departure from the filter.
|
|
150
|
+
*/
|
|
142
151
|
filter(conditions: Record<string, unknown>): RemoteSubscriptionBuilder;
|
|
143
152
|
/** Starts the subscription and calls back on each change. */
|
|
144
153
|
subscribe(callback: (event: ChangeEvent) => void, options?: SubscribeOptions): Promise<RemoteSubscription>;
|
package/dist/codegen/index.d.ts
CHANGED
package/dist/core/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { e as SQLiteConnection, n as SynchronousLevel, a as SQLiteDriver, W as WorkerHostOptions, D as DatabaseOptions, L as LifecycleConfig, M as Migration, m as MigrationResult, R as RollbackResult } from '../types-
|
|
2
|
-
export { A as AfterQueryHook, o as AppliedMigration, p as AppliedMigrationEntry, f as BackupScheduleOptions, q as BatchSummary, b as BeforeConnectHook, B as BeforeQueryHook, h as BeforeSubscribeHook, l as CDCMetrics, r as ClusterReadEndpointInfo, C as ClusterStatusInfo, g as ConnectionHookContext, k as ConnectionMetrics, d as DatabaseCloseHook, c as DatabaseOpenHook, s as DriverCapabilities, t as DriverWorkerEntry, H as HookConfig, u as MIGRATION_NAME_RE, i as MetricsConfig, v as MigrationBaseline, w as MigrationSource, N as NodeHealth, x as NodeHealthReason, y as NodeHealthState, O as OpenOptions, Q as QueryHookContext, j as QueryMetrics, z as RunResult, E as SQLiteStatement, S as SirannonOptions, T as Transaction, F as WriterWorkerOptions } from '../types-
|
|
3
|
-
import { B as BulkLoadDurability, a as BulkLoadResult } from '../server-options-
|
|
4
|
-
export { c as AuthenticateHook, b as BulkLoadOptions, C as ClientOptions, d as ClusterStatusAuthorizer, e as CorsOptions, R as ReplicationStatusInfo, f as RequestContext, g as ServerExecutionTarget, h as ServerExecutionTargetResolver, S as ServerOptions, W as WSHandlerOptions } from '../server-options-
|
|
5
|
-
export { C as ChangeTracker, a as ChangeTrackerOptions } from '../change-tracker-
|
|
6
|
-
import { D as Database } from '../database-
|
|
7
|
-
export { H as HookDispose, a as HookEvent, b as HookEventContextMap, c as HookHandler, d as HookRegistry, M as MetricsCollector, S as SubscribeHookContext } from '../database-
|
|
1
|
+
import { e as SQLiteConnection, n as SynchronousLevel, a as SQLiteDriver, W as WorkerHostOptions, D as DatabaseOptions, L as LifecycleConfig, M as Migration, m as MigrationResult, R as RollbackResult } from '../types-CXoPBeDM.js';
|
|
2
|
+
export { A as AfterQueryHook, o as AppliedMigration, p as AppliedMigrationEntry, f as BackupScheduleOptions, q as BatchSummary, b as BeforeConnectHook, B as BeforeQueryHook, h as BeforeSubscribeHook, l as CDCMetrics, r as ClusterReadEndpointInfo, C as ClusterStatusInfo, g as ConnectionHookContext, k as ConnectionMetrics, d as DatabaseCloseHook, c as DatabaseOpenHook, s as DriverCapabilities, t as DriverWorkerEntry, H as HookConfig, u as MIGRATION_NAME_RE, i as MetricsConfig, v as MigrationBaseline, w as MigrationSource, N as NodeHealth, x as NodeHealthReason, y as NodeHealthState, O as OpenOptions, Q as QueryHookContext, j as QueryMetrics, z as RunResult, E as SQLiteStatement, S as SirannonOptions, T as Transaction, F as WriterWorkerOptions } from '../types-CXoPBeDM.js';
|
|
3
|
+
import { B as BulkLoadDurability, a as BulkLoadResult } from '../server-options-BVAFmguz.js';
|
|
4
|
+
export { c as AuthenticateHook, b as BulkLoadOptions, C as ClientOptions, d as ClusterStatusAuthorizer, e as CorsOptions, R as ReplicationStatusInfo, f as RequestContext, g as ServerExecutionTarget, h as ServerExecutionTargetResolver, S as ServerOptions, W as WSHandlerOptions } from '../server-options-BVAFmguz.js';
|
|
5
|
+
export { C as ChangeTracker, a as ChangeTrackerOptions } from '../change-tracker-C2Z8UbI0.js';
|
|
6
|
+
import { D as Database } from '../database-DvSvONb-.js';
|
|
7
|
+
export { H as HookDispose, a as HookEvent, b as HookEventContextMap, c as HookHandler, d as HookRegistry, M as MetricsCollector, S as SubscribeHookContext } from '../database-DvSvONb-.js';
|
|
8
8
|
export { B as BackupError, C as CDCError, a as ConnectionPoolError, D as DatabaseAlreadyExistsError, b as DatabaseNotFoundError, E as ExtensionError, F as ForbiddenSqlError, H as HookDeniedError, M as MaxDatabasesError, c as MigrationError, Q as QueryError, R as ReadOnlyError, d as RequestDeniedError, S as SirannonError, T as TransactionError, W as WriteOverloadError } from '../errors-Dei4GdBb.js';
|
|
9
9
|
export { a as LiveQuery, L as LiveQueryOptions, b as LiveQueryState, c as LiveUpdate, R as ResultOp } from '../types-BCejqzNA.js';
|
|
10
10
|
import { B as BaselineFileOption } from '../baseline-D93hcIEE.js';
|
|
11
|
-
import { P as Params, E as ExecuteResult } from '../query-types-
|
|
12
|
-
export { C as ChangeEvent, b as ChangeOperation, Q as QueryOptions, R as ReadConcern, a as ReadConcernLevel, c as Subscription, S as SubscriptionBuilder, W as WriteConcern, d as WriteConcernLevel } from '../query-types-
|
|
13
|
-
export { S as Sirannon } from '../sirannon-
|
|
14
|
-
export { D as DatabaseOperations, b as OperationArguments, O as OperationRef, a as OperationRegistry, c as OperationStatement, R as ReadOperation, W as WriteOperation, o as operationName, d as operationRef } from '../operation-registry-
|
|
11
|
+
import { P as Params, E as ExecuteResult } from '../query-types-BvkzxKQv.js';
|
|
12
|
+
export { C as ChangeEvent, b as ChangeOperation, Q as QueryOptions, R as ReadConcern, a as ReadConcernLevel, c as Subscription, S as SubscriptionBuilder, W as WriteConcern, d as WriteConcernLevel } from '../query-types-BvkzxKQv.js';
|
|
13
|
+
export { S as Sirannon } from '../sirannon-DVYfrNiq.js';
|
|
14
|
+
export { D as DatabaseOperations, b as OperationArguments, O as OperationRef, a as OperationRegistry, c as OperationStatement, R as ReadOperation, W as WriteOperation, o as operationName, d as operationRef } from '../operation-registry-6qErmUT2.js';
|
|
15
15
|
import '../types-CjhxcjhA.js';
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Q as QueryHookContext, g as ConnectionHookContext, h as BeforeSubscribeHook, H as HookConfig, i as MetricsConfig, j as QueryMetrics, k as ConnectionMetrics, l as CDCMetrics, a as SQLiteDriver, D as DatabaseOptions, T as Transaction, e as SQLiteConnection, M as Migration, m as MigrationResult, R as RollbackResult, f as BackupScheduleOptions, B as BeforeQueryHook, A as AfterQueryHook } from './types-
|
|
1
|
+
import { Q as QueryHookContext, g as ConnectionHookContext, h as BeforeSubscribeHook, H as HookConfig, i as MetricsConfig, j as QueryMetrics, k as ConnectionMetrics, l as CDCMetrics, a as SQLiteDriver, D as DatabaseOptions, T as Transaction, e as SQLiteConnection, M as Migration, m as MigrationResult, R as RollbackResult, f as BackupScheduleOptions, B as BeforeQueryHook, A as AfterQueryHook } from './types-CXoPBeDM.js';
|
|
2
2
|
import { c as ReplicationChange, C as ConflictResolver, A as ApplyResult, R as ReplicationBatch } from './types-CjhxcjhA.js';
|
|
3
|
-
import { C as ChangeEvent, P as Params, Q as QueryOptions, E as ExecuteResult, S as SubscriptionBuilder } from './query-types-
|
|
4
|
-
import { A as AppliedMigrationRow, b as BulkLoadOptions, a as BulkLoadResult } from './server-options-
|
|
3
|
+
import { C as ChangeEvent, P as Params, Q as QueryOptions, E as ExecuteResult, S as SubscriptionBuilder } from './query-types-BvkzxKQv.js';
|
|
4
|
+
import { A as AppliedMigrationRow, b as BulkLoadOptions, a as BulkLoadResult } from './server-options-BVAFmguz.js';
|
|
5
5
|
import { L as LiveQueryOptions, a as LiveQuery } from './types-BCejqzNA.js';
|
|
6
6
|
|
|
7
7
|
/**
|
package/dist/driver/bun.d.ts
CHANGED
package/dist/driver/expo.d.ts
CHANGED
package/dist/driver/node.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { B as BaselineFileOption } from '../baseline-D93hcIEE.js';
|
|
2
|
-
import { M as Migration } from '../types-
|
|
3
|
-
import '../query-types-
|
|
2
|
+
import { M as Migration } from '../types-CXoPBeDM.js';
|
|
3
|
+
import '../query-types-BvkzxKQv.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @public
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as WriteConcern, R as ReadConcern, E as ExecuteResult } from './query-types-
|
|
2
|
-
import { B as BulkLoadDurability, a as BulkLoadResult } from './server-options-
|
|
1
|
+
import { W as WriteConcern, R as ReadConcern, E as ExecuteResult } from './query-types-BvkzxKQv.js';
|
|
2
|
+
import { B as BulkLoadDurability, a as BulkLoadResult } from './server-options-BVAFmguz.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Body of `POST /db/{id}/query`.
|
|
@@ -79,7 +79,16 @@ interface ChangeEvent<T = Record<string, unknown>> {
|
|
|
79
79
|
* @public
|
|
80
80
|
*/
|
|
81
81
|
interface SubscriptionBuilder {
|
|
82
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Narrows the subscription to rows whose columns equal the given values.
|
|
84
|
+
*
|
|
85
|
+
* The filter reports membership of the matching set, so an update that moves a row
|
|
86
|
+
* into the set arrives as an insert carrying no `oldRow`, and one that moves a row
|
|
87
|
+
* out arrives as a delete carrying the old row and an empty `row`. An update that
|
|
88
|
+
* leaves the row in the set arrives unchanged, and one that never touches the set
|
|
89
|
+
* is not delivered. A synthesised event is indistinguishable from a real insert or
|
|
90
|
+
* delete, so read `type` as the row's arrival or departure from the filter.
|
|
91
|
+
*/
|
|
83
92
|
filter(conditions: Record<string, unknown>): SubscriptionBuilder;
|
|
84
93
|
/** Starts the subscription and calls back on each change. */
|
|
85
94
|
subscribe(callback: (event: ChangeEvent) => void): Subscription;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { L as LiveQueryOptions, a as LiveQuery, b as LiveQueryState } from '../types-BCejqzNA.js';
|
|
2
|
-
import { O as OperationRef } from '../operation-registry-
|
|
3
|
-
import { P as Params } from '../query-types-
|
|
2
|
+
import { O as OperationRef } from '../operation-registry-6qErmUT2.js';
|
|
3
|
+
import { P as Params } from '../query-types-BvkzxKQv.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The one method these hooks need from a database, so both a local
|
|
@@ -4,15 +4,15 @@ export { a as ConflictContext, b as ConflictResolution, c as ReplicationChange }
|
|
|
4
4
|
import { c as ReplicationGroupState, e as CoordinatorWatchDisposer } from '../types-CMBcFPhb.js';
|
|
5
5
|
export { A as AcquireControllerLeaseInput, a as AcquireControllerLeaseResult, h as AdmitNodeToInSyncSetInput, C as ClusterCoordinator, f as CompareAndAdvancePrimaryTermInput, g as CompareAndAdvancePrimaryTermResult, j as CoordinatorCompatibilityMetadata, k as CoordinatorLease, b as CoordinatorNodeSession, l as CoordinatorPrimary, P as PromoteEligibleReplicaInput, R as RegisterNodeSessionInput, d as ReplicationGroupWatcher, S as SetReplicationGroupStateInput, U as UpdateInSyncSetInput, i as UpdateNodeMaintenanceInput } from '../types-CMBcFPhb.js';
|
|
6
6
|
import { EventEmitter } from 'node:events';
|
|
7
|
-
import { C as ChangeTracker } from '../change-tracker-
|
|
8
|
-
import { D as Database } from '../database-
|
|
9
|
-
import { e as SQLiteConnection, T as Transaction } from '../types-
|
|
10
|
-
import { P as Params, Q as QueryOptions, E as ExecuteResult } from '../query-types-
|
|
11
|
-
import { g as SyncPhase, I as InFlightBatch, P as PeerState, a as ForwardedTransactionResult, b as SyncBatch, c as SyncComplete, d as SyncAck, S as SyncRequest, h as ReplicationConfig, i as SyncState, j as ReplicationStatus, k as ReplicationErrorEvent, R as ReplicationAck, l as Topology, f as TopologyRole } from '../types-
|
|
12
|
-
export { F as ForwardedTransaction, N as NodeInfo, e as ReplicationTransport, T as TransportConfig } from '../types-
|
|
7
|
+
import { C as ChangeTracker } from '../change-tracker-C2Z8UbI0.js';
|
|
8
|
+
import { D as Database } from '../database-DvSvONb-.js';
|
|
9
|
+
import { e as SQLiteConnection, T as Transaction } from '../types-CXoPBeDM.js';
|
|
10
|
+
import { P as Params, Q as QueryOptions, E as ExecuteResult } from '../query-types-BvkzxKQv.js';
|
|
11
|
+
import { g as SyncPhase, I as InFlightBatch, P as PeerState, a as ForwardedTransactionResult, b as SyncBatch, c as SyncComplete, d as SyncAck, S as SyncRequest, h as ReplicationConfig, i as SyncState, j as ReplicationStatus, k as ReplicationErrorEvent, R as ReplicationAck, l as Topology, f as TopologyRole } from '../types-DtUwSmAQ.js';
|
|
12
|
+
export { F as ForwardedTransaction, N as NodeInfo, e as ReplicationTransport, T as TransportConfig } from '../types-DtUwSmAQ.js';
|
|
13
13
|
import { S as SirannonError } from '../errors-Dei4GdBb.js';
|
|
14
|
-
import '../server-options-
|
|
15
|
-
import '../operation-registry-
|
|
14
|
+
import '../server-options-BVAFmguz.js';
|
|
15
|
+
import '../operation-registry-6qErmUT2.js';
|
|
16
16
|
import '../types-BCejqzNA.js';
|
|
17
17
|
|
|
18
18
|
/**
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { T as TransactionStatement, Q as QueryResponse, E as ExecuteResponse, a as TransactionResponse, B as BatchResponse, L as LoadResponse, A as AckResponse } from '../protocol-
|
|
2
|
-
export { b as BatchRequest, c as ErrorResponse, d as ExecuteRequest, e as LoadRequest, f as QueryRequest, g as TransactionRequest, t as toExecuteResponse } from '../protocol-
|
|
3
|
-
import { S as Sirannon } from '../sirannon-
|
|
4
|
-
import { B as BulkLoadDurability, S as ServerOptions, W as WSHandlerOptions } from '../server-options-
|
|
5
|
-
import { W as WriteConcern, R as ReadConcern } from '../query-types-
|
|
6
|
-
import '../database-
|
|
7
|
-
import '../types-
|
|
1
|
+
import { T as TransactionStatement, Q as QueryResponse, E as ExecuteResponse, a as TransactionResponse, B as BatchResponse, L as LoadResponse, A as AckResponse } from '../protocol-CEBVo1tO.js';
|
|
2
|
+
export { b as BatchRequest, c as ErrorResponse, d as ExecuteRequest, e as LoadRequest, f as QueryRequest, g as TransactionRequest, t as toExecuteResponse } from '../protocol-CEBVo1tO.js';
|
|
3
|
+
import { S as Sirannon } from '../sirannon-DVYfrNiq.js';
|
|
4
|
+
import { B as BulkLoadDurability, S as ServerOptions, W as WSHandlerOptions } from '../server-options-BVAFmguz.js';
|
|
5
|
+
import { W as WriteConcern, R as ReadConcern } from '../query-types-BvkzxKQv.js';
|
|
6
|
+
import '../database-DvSvONb-.js';
|
|
7
|
+
import '../types-CXoPBeDM.js';
|
|
8
8
|
import '../types-CjhxcjhA.js';
|
|
9
9
|
import '../types-BCejqzNA.js';
|
|
10
|
-
import '../operation-registry-
|
|
10
|
+
import '../operation-registry-6qErmUT2.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Every message a client sends over the WebSocket. Each carries a `type` and a
|
|
@@ -439,6 +439,22 @@ interface WSConnection {
|
|
|
439
439
|
* Sends one frame and reports whether it went out, was buffered, or was dropped.
|
|
440
440
|
*/
|
|
441
441
|
send(data: string): WSSendOutcome;
|
|
442
|
+
/**
|
|
443
|
+
* Reports how many bytes the socket still holds unsent.
|
|
444
|
+
*
|
|
445
|
+
* A `buffered` outcome promises no later drain notification, because a send that
|
|
446
|
+
* queues only the tail of a frame can flush that tail without the socket ever
|
|
447
|
+
* becoming writable again. A sender that paused itself reads this to find out
|
|
448
|
+
* whether it is still waiting on anything.
|
|
449
|
+
*/
|
|
450
|
+
bufferedAmount(): number;
|
|
451
|
+
/**
|
|
452
|
+
* Writes a control frame so the socket flushes what it is holding.
|
|
453
|
+
*
|
|
454
|
+
* uWebSockets keeps a partial write queued until the next write on that socket,
|
|
455
|
+
* so a sender with nothing left to send calls this to move the remainder.
|
|
456
|
+
*/
|
|
457
|
+
flush(): void;
|
|
442
458
|
/**
|
|
443
459
|
* Closes the connection with a code and reason.
|
|
444
460
|
*/
|
|
@@ -457,6 +473,7 @@ declare class WSHandler<Identity = unknown> {
|
|
|
457
473
|
private readonly connections;
|
|
458
474
|
private readonly cdc;
|
|
459
475
|
private readonly maxUnacknowledgedChanges;
|
|
476
|
+
private readonly socketResumeBytes;
|
|
460
477
|
private readonly acceptSql;
|
|
461
478
|
private readonly operations;
|
|
462
479
|
private closed;
|
package/dist/server/index.mjs
CHANGED
|
@@ -326,7 +326,7 @@ var SQL_QUERY_CAPABILITY = "query.sql";
|
|
|
326
326
|
function buildCapabilitiesResponse(options) {
|
|
327
327
|
const capabilities = [...SERVER_CAPABILITIES];
|
|
328
328
|
if (options?.registryDigest !== void 0) capabilities.push(NAMED_QUERY_CAPABILITY);
|
|
329
|
-
if (options?.acceptSql
|
|
329
|
+
if (options?.acceptSql === true) capabilities.push(SQL_QUERY_CAPABILITY);
|
|
330
330
|
const response = { capabilities };
|
|
331
331
|
if (options?.registryDigest !== void 0) response.registry = { digest: options.registryDigest };
|
|
332
332
|
return response;
|
|
@@ -1594,7 +1594,8 @@ function worstOutcome(a, b) {
|
|
|
1594
1594
|
|
|
1595
1595
|
// src/server/ws-device-stream.ts
|
|
1596
1596
|
var DEFAULT_MAX_UNACKNOWLEDGED_CHANGES = 1e3;
|
|
1597
|
-
var
|
|
1597
|
+
var MAX_CATCHUP_READ_BATCH = 1e3;
|
|
1598
|
+
var MIN_CATCHUP_READ_BATCH = 32;
|
|
1598
1599
|
var DeviceChangeStream = class {
|
|
1599
1600
|
constructor(deps, baselineSeq, startMode) {
|
|
1600
1601
|
this.deps = deps;
|
|
@@ -1614,8 +1615,11 @@ var DeviceChangeStream = class {
|
|
|
1614
1615
|
lastQueuedTxId;
|
|
1615
1616
|
midTransaction = false;
|
|
1616
1617
|
draining = false;
|
|
1618
|
+
wakeRequested = false;
|
|
1617
1619
|
socketWait = false;
|
|
1618
1620
|
halted = false;
|
|
1621
|
+
lastBuffered = 0;
|
|
1622
|
+
catchupBatch = MAX_CATCHUP_READ_BATCH;
|
|
1619
1623
|
get deviceId() {
|
|
1620
1624
|
return this.deps.deviceId;
|
|
1621
1625
|
}
|
|
@@ -1627,7 +1631,7 @@ var DeviceChangeStream = class {
|
|
|
1627
1631
|
}
|
|
1628
1632
|
start() {
|
|
1629
1633
|
if (this.mode === "catchup") {
|
|
1630
|
-
|
|
1634
|
+
this.requestDrain();
|
|
1631
1635
|
}
|
|
1632
1636
|
}
|
|
1633
1637
|
receiveLive(event) {
|
|
@@ -1635,7 +1639,12 @@ var DeviceChangeStream = class {
|
|
|
1635
1639
|
this.ensureGrouper().receive(event);
|
|
1636
1640
|
}
|
|
1637
1641
|
onBatchEnd(atTxBoundary) {
|
|
1638
|
-
if (this.halted
|
|
1642
|
+
if (this.halted) return;
|
|
1643
|
+
this.nudgeStalledSocket();
|
|
1644
|
+
if (this.socketWait && !this.deps.socketCongested()) {
|
|
1645
|
+
this.onSocketDrain();
|
|
1646
|
+
}
|
|
1647
|
+
if (this.mode !== "live") return;
|
|
1639
1648
|
if (this.grouper !== null && !this.grouper.flush(atTxBoundary)) return;
|
|
1640
1649
|
this.settleFrame(this.deps.packer?.flush() ?? "queued");
|
|
1641
1650
|
}
|
|
@@ -1645,14 +1654,14 @@ var DeviceChangeStream = class {
|
|
|
1645
1654
|
this.ackedSeq = seq;
|
|
1646
1655
|
}
|
|
1647
1656
|
if (this.mode === "catchup") {
|
|
1648
|
-
|
|
1657
|
+
this.requestDrain();
|
|
1649
1658
|
}
|
|
1650
1659
|
}
|
|
1651
1660
|
onSocketDrain() {
|
|
1652
1661
|
if (this.halted) return;
|
|
1653
1662
|
this.socketWait = false;
|
|
1654
1663
|
if (this.mode === "catchup") {
|
|
1655
|
-
|
|
1664
|
+
this.requestDrain();
|
|
1656
1665
|
}
|
|
1657
1666
|
}
|
|
1658
1667
|
stop() {
|
|
@@ -1660,6 +1669,23 @@ var DeviceChangeStream = class {
|
|
|
1660
1669
|
this.grouper = null;
|
|
1661
1670
|
this.deps.packer?.clear();
|
|
1662
1671
|
}
|
|
1672
|
+
/**
|
|
1673
|
+
* Moves a socket that stopped writing on its own. uWebSockets holds the
|
|
1674
|
+
* remainder of a partial write until the next write on that socket and
|
|
1675
|
+
* reports no drain in the meantime, so a stream that has queued everything
|
|
1676
|
+
* it has would leave the last changes sitting there. A small buffered count
|
|
1677
|
+
* that has not moved since the previous poll is that state, and a control
|
|
1678
|
+
* frame carries the remainder out. A socket holding enough to count as
|
|
1679
|
+
* congested is draining under its own flow control and takes nothing extra,
|
|
1680
|
+
* because another frame there would cross the backpressure limit.
|
|
1681
|
+
*/
|
|
1682
|
+
nudgeStalledSocket() {
|
|
1683
|
+
const buffered = this.deps.socketBuffered();
|
|
1684
|
+
if (buffered > 0 && buffered === this.lastBuffered && !this.deps.socketCongested()) {
|
|
1685
|
+
this.deps.flushSocket();
|
|
1686
|
+
}
|
|
1687
|
+
this.lastBuffered = buffered;
|
|
1688
|
+
}
|
|
1663
1689
|
ensureGrouper() {
|
|
1664
1690
|
this.grouper ??= new TransactionGrouper((event) => this.deliver(event));
|
|
1665
1691
|
return this.grouper;
|
|
@@ -1689,12 +1715,24 @@ var DeviceChangeStream = class {
|
|
|
1689
1715
|
}
|
|
1690
1716
|
this.midTransaction = event.txEnd !== true && event.txId !== void 0;
|
|
1691
1717
|
if (outcome === "buffered") {
|
|
1692
|
-
this.
|
|
1718
|
+
this.parkOnSocket();
|
|
1693
1719
|
this.enterCatchup();
|
|
1694
1720
|
return false;
|
|
1695
1721
|
}
|
|
1696
1722
|
return true;
|
|
1697
1723
|
}
|
|
1724
|
+
/**
|
|
1725
|
+
* Waits for the socket only while it holds enough to be worth waiting for.
|
|
1726
|
+
* uWebSockets reports `buffered` for a send it could not finish in one go,
|
|
1727
|
+
* including one that queued a few hundred bytes of a frame it otherwise
|
|
1728
|
+
* sent, and it notifies a drain only when the socket becomes writable
|
|
1729
|
+
* again. A stream that parked on the outcome alone would wait on a small
|
|
1730
|
+
* remainder that the next send would have flushed, and the wake-up would
|
|
1731
|
+
* never come.
|
|
1732
|
+
*/
|
|
1733
|
+
parkOnSocket() {
|
|
1734
|
+
this.socketWait = this.deps.socketCongested();
|
|
1735
|
+
}
|
|
1698
1736
|
/**
|
|
1699
1737
|
* Abandons the in-flight stream state and falls back to the change log.
|
|
1700
1738
|
* The grouper's held event was never queued and its seq is above both
|
|
@@ -1712,12 +1750,28 @@ var DeviceChangeStream = class {
|
|
|
1712
1750
|
return;
|
|
1713
1751
|
}
|
|
1714
1752
|
if (flushed === "buffered") {
|
|
1715
|
-
this.
|
|
1753
|
+
this.parkOnSocket();
|
|
1716
1754
|
}
|
|
1717
1755
|
this.mode = "catchup";
|
|
1718
1756
|
this.grouper = null;
|
|
1719
1757
|
this.heldSeq = null;
|
|
1720
1758
|
this.catchupFrom = this.processedSeq > this.highestQueuedSeq ? this.processedSeq : this.highestQueuedSeq;
|
|
1759
|
+
if (!this.socketWait) {
|
|
1760
|
+
this.requestDrain();
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
/**
|
|
1764
|
+
* Starts the catch-up read, or records that one is owed when a read is
|
|
1765
|
+
* already running. A read that hands back the stream mid-pass, because the
|
|
1766
|
+
* socket reported backpressure it no longer holds, would otherwise leave
|
|
1767
|
+
* the stream in catch-up with nothing scheduled to resume it.
|
|
1768
|
+
*/
|
|
1769
|
+
requestDrain() {
|
|
1770
|
+
if (this.draining) {
|
|
1771
|
+
this.wakeRequested = true;
|
|
1772
|
+
return;
|
|
1773
|
+
}
|
|
1774
|
+
void this.drain();
|
|
1721
1775
|
}
|
|
1722
1776
|
/**
|
|
1723
1777
|
* A closed window stops the catch-up read only where the window may pace
|
|
@@ -1731,11 +1785,28 @@ var DeviceChangeStream = class {
|
|
|
1731
1785
|
if (!this.windowClosed()) return false;
|
|
1732
1786
|
return this.deps.pacing === "perEvent" || !this.midTransaction;
|
|
1733
1787
|
}
|
|
1788
|
+
/**
|
|
1789
|
+
* Sizes the next catch-up read from what the socket accepted this time.
|
|
1790
|
+
* A read that ends at a full socket discards everything past the event
|
|
1791
|
+
* that stopped it, so a device on a congested link would otherwise decode
|
|
1792
|
+
* the same rows on every pause. Doubling the accepted count keeps a
|
|
1793
|
+
* caught-up device reading whole batches while a paced one reads close to
|
|
1794
|
+
* what it can send.
|
|
1795
|
+
*/
|
|
1796
|
+
resizeCatchupBatch(accepted) {
|
|
1797
|
+
const doubled = accepted * 2;
|
|
1798
|
+
if (doubled < MIN_CATCHUP_READ_BATCH) {
|
|
1799
|
+
this.catchupBatch = MIN_CATCHUP_READ_BATCH;
|
|
1800
|
+
return;
|
|
1801
|
+
}
|
|
1802
|
+
this.catchupBatch = doubled > MAX_CATCHUP_READ_BATCH ? MAX_CATCHUP_READ_BATCH : doubled;
|
|
1803
|
+
}
|
|
1734
1804
|
async drain() {
|
|
1735
1805
|
if (this.draining || this.halted) return;
|
|
1736
1806
|
this.draining = true;
|
|
1737
1807
|
try {
|
|
1738
1808
|
while (!this.halted && this.mode === "catchup") {
|
|
1809
|
+
this.wakeRequested = false;
|
|
1739
1810
|
if (this.socketWait || this.readGateClosed()) return;
|
|
1740
1811
|
const upTo = this.deps.logCursor();
|
|
1741
1812
|
if (this.catchupFrom >= upTo) {
|
|
@@ -1744,7 +1815,7 @@ var DeviceChangeStream = class {
|
|
|
1744
1815
|
}
|
|
1745
1816
|
let events;
|
|
1746
1817
|
try {
|
|
1747
|
-
events = await this.deps.readLog(this.catchupFrom, upTo,
|
|
1818
|
+
events = await this.deps.readLog(this.catchupFrom, upTo, this.catchupBatch);
|
|
1748
1819
|
} catch (err) {
|
|
1749
1820
|
this.halted = true;
|
|
1750
1821
|
this.deps.onFault(err);
|
|
@@ -1757,8 +1828,11 @@ var DeviceChangeStream = class {
|
|
|
1757
1828
|
return;
|
|
1758
1829
|
}
|
|
1759
1830
|
const grouper = this.ensureGrouper();
|
|
1831
|
+
let offered = 0;
|
|
1832
|
+
let stopped = false;
|
|
1760
1833
|
for (const event of events) {
|
|
1761
1834
|
this.catchupFrom = event.seq;
|
|
1835
|
+
offered += 1;
|
|
1762
1836
|
const delivered = this.deps.transform(event);
|
|
1763
1837
|
if (delivered === null) {
|
|
1764
1838
|
if (this.heldSeq === null && event.seq > this.processedSeq) {
|
|
@@ -1766,16 +1840,27 @@ var DeviceChangeStream = class {
|
|
|
1766
1840
|
}
|
|
1767
1841
|
continue;
|
|
1768
1842
|
}
|
|
1769
|
-
if (!grouper.receive(delivered))
|
|
1843
|
+
if (!grouper.receive(delivered)) {
|
|
1844
|
+
this.resizeCatchupBatch(offered);
|
|
1845
|
+
stopped = true;
|
|
1846
|
+
break;
|
|
1847
|
+
}
|
|
1770
1848
|
const settledBefore = event.seq - 1n;
|
|
1771
1849
|
if (settledBefore > this.processedSeq) {
|
|
1772
1850
|
this.processedSeq = settledBefore;
|
|
1773
1851
|
}
|
|
1774
1852
|
this.heldSeq = delivered.txId === void 0 ? null : event.seq;
|
|
1775
1853
|
}
|
|
1854
|
+
if (!stopped) {
|
|
1855
|
+
this.resizeCatchupBatch(this.catchupBatch);
|
|
1856
|
+
}
|
|
1776
1857
|
}
|
|
1777
1858
|
} finally {
|
|
1778
1859
|
this.draining = false;
|
|
1860
|
+
if (this.wakeRequested) {
|
|
1861
|
+
this.wakeRequested = false;
|
|
1862
|
+
void this.drain();
|
|
1863
|
+
}
|
|
1779
1864
|
}
|
|
1780
1865
|
}
|
|
1781
1866
|
/**
|
|
@@ -1803,7 +1888,7 @@ var DeviceChangeStream = class {
|
|
|
1803
1888
|
return;
|
|
1804
1889
|
}
|
|
1805
1890
|
if (outcome === "buffered") {
|
|
1806
|
-
this.
|
|
1891
|
+
this.parkOnSocket();
|
|
1807
1892
|
if (this.mode === "live") {
|
|
1808
1893
|
this.enterCatchup();
|
|
1809
1894
|
}
|
|
@@ -2214,6 +2299,9 @@ async function subscribeDevice(deps, conn, state, request) {
|
|
|
2214
2299
|
pacing: stagedStream ? "perEvent" : "perTransaction",
|
|
2215
2300
|
packer: stagedStream ? new DeviceFramePacker(id, (data) => deps.sendText(conn, data)) : null,
|
|
2216
2301
|
sendEvent: (event) => deps.sendChange(conn, id, event),
|
|
2302
|
+
socketBuffered: () => conn.bufferedAmount(),
|
|
2303
|
+
socketCongested: () => conn.bufferedAmount() >= deps.socketResumeBytes,
|
|
2304
|
+
flushSocket: () => conn.flush(),
|
|
2217
2305
|
onOverload: () => deps.handleOverload(conn),
|
|
2218
2306
|
onFault: () => deps.closeFaulted(conn),
|
|
2219
2307
|
readLog: (afterSeq, upToSeq, limit) => ctx.tracker.readSinceTables(ctx.cdcConn, tables, afterSeq, upToSeq, limit),
|
|
@@ -2457,6 +2545,7 @@ async function subscribeResuming(deps, conn, state, id, table, filter, sinceSeq,
|
|
|
2457
2545
|
|
|
2458
2546
|
// src/server/ws-handler.ts
|
|
2459
2547
|
var DEFAULT_MAX_PAYLOAD_LENGTH = 1048576;
|
|
2548
|
+
var DEFAULT_MAX_BACKPRESSURE_BYTES = 16 * 1048576;
|
|
2460
2549
|
var SQL_MESSAGE_TYPES = /* @__PURE__ */ new Set(["query", "execute", "transaction", "batch", "load"]);
|
|
2461
2550
|
var NAMED_MESSAGE_TYPES = /* @__PURE__ */ new Set(["query", "execute", "subscribe"]);
|
|
2462
2551
|
var WSHandler = class {
|
|
@@ -2466,6 +2555,7 @@ var WSHandler = class {
|
|
|
2466
2555
|
connections = /* @__PURE__ */ new Map();
|
|
2467
2556
|
cdc;
|
|
2468
2557
|
maxUnacknowledgedChanges;
|
|
2558
|
+
socketResumeBytes;
|
|
2469
2559
|
acceptSql;
|
|
2470
2560
|
operations;
|
|
2471
2561
|
closed = false;
|
|
@@ -2475,6 +2565,7 @@ var WSHandler = class {
|
|
|
2475
2565
|
this.operations = createOperationSource(options?.operations);
|
|
2476
2566
|
this.maxPayloadLength = options?.maxPayloadLength ?? DEFAULT_MAX_PAYLOAD_LENGTH;
|
|
2477
2567
|
this.maxUnacknowledgedChanges = options?.maxUnacknowledgedChanges ?? DEFAULT_MAX_UNACKNOWLEDGED_CHANGES;
|
|
2568
|
+
this.socketResumeBytes = Math.ceil((options?.maxBackpressureBytes ?? DEFAULT_MAX_BACKPRESSURE_BYTES) / 2);
|
|
2478
2569
|
this.resolveExecutionTarget = options?.resolveExecutionTarget;
|
|
2479
2570
|
this.cdc = new CdcContextRegistry(sirannon, options?.cdcRetentionMs, options?.deviceCursorRetentionMs);
|
|
2480
2571
|
}
|
|
@@ -2660,6 +2751,7 @@ var WSHandler = class {
|
|
|
2660
2751
|
return {
|
|
2661
2752
|
cdc: this.cdc,
|
|
2662
2753
|
maxUnacknowledgedChanges: this.maxUnacknowledgedChanges,
|
|
2754
|
+
socketResumeBytes: this.socketResumeBytes,
|
|
2663
2755
|
sendSubscribed: (conn, id, seq, epoch, resync, maxUnacknowledgedChanges) => this.send(conn, {
|
|
2664
2756
|
type: "subscribed",
|
|
2665
2757
|
id,
|
|
@@ -2811,6 +2903,19 @@ function registerWebSocketRoute(options) {
|
|
|
2811
2903
|
return "dropped";
|
|
2812
2904
|
}
|
|
2813
2905
|
},
|
|
2906
|
+
bufferedAmount() {
|
|
2907
|
+
try {
|
|
2908
|
+
return ws.getBufferedAmount();
|
|
2909
|
+
} catch {
|
|
2910
|
+
return 0;
|
|
2911
|
+
}
|
|
2912
|
+
},
|
|
2913
|
+
flush() {
|
|
2914
|
+
try {
|
|
2915
|
+
ws.ping();
|
|
2916
|
+
} catch {
|
|
2917
|
+
}
|
|
2918
|
+
},
|
|
2814
2919
|
close(code, reason) {
|
|
2815
2920
|
try {
|
|
2816
2921
|
ws.end(code, reason);
|
|
@@ -2890,6 +2995,7 @@ var SirannonServer = class {
|
|
|
2890
2995
|
this.wsHandler = new WSHandler(sirannon, {
|
|
2891
2996
|
resolveExecutionTarget: this.resolveExecutionTarget,
|
|
2892
2997
|
maxPayloadLength: this.maxBodyBytes,
|
|
2998
|
+
maxBackpressureBytes: this.maxWsBackpressureBytes,
|
|
2893
2999
|
cdcRetentionMs: options?.cdcRetentionMs,
|
|
2894
3000
|
deviceCursorRetentionMs: options?.deviceCursorRetentionMs,
|
|
2895
3001
|
maxUnacknowledgedChanges: options?.maxUnacknowledgedChanges,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as OperationRegistry } from './operation-registry-
|
|
1
|
+
import { a as OperationRegistry } from './operation-registry-6qErmUT2.js';
|
|
2
2
|
import { R as ReplicationBatch, C as ConflictResolver, A as ApplyResult } from './types-CjhxcjhA.js';
|
|
3
|
-
import { N as NodeHealth, T as Transaction, C as ClusterStatusInfo } from './types-
|
|
4
|
-
import { P as Params, Q as QueryOptions, E as ExecuteResult } from './query-types-
|
|
3
|
+
import { N as NodeHealth, T as Transaction, C as ClusterStatusInfo } from './types-CXoPBeDM.js';
|
|
4
|
+
import { P as Params, Q as QueryOptions, E as ExecuteResult } from './query-types-BvkzxKQv.js';
|
|
5
5
|
|
|
6
6
|
interface AppliedMigrationRow {
|
|
7
7
|
version: number;
|
|
@@ -229,6 +229,8 @@ interface CorsOptions {
|
|
|
229
229
|
interface WSHandlerOptions<Identity = unknown> {
|
|
230
230
|
/** Maximum message size in bytes. Default: 1_048_576 (1 MB). */
|
|
231
231
|
maxPayloadLength?: number;
|
|
232
|
+
/** Outbound bytes a socket may hold before a device stream pauses itself. Default: 16 MB. */
|
|
233
|
+
maxBackpressureBytes?: number;
|
|
232
234
|
/** Change-log retention for CDC subscriptions in milliseconds. Default: 3_600_000. */
|
|
233
235
|
cdcRetentionMs?: number;
|
|
234
236
|
deviceCursorRetentionMs?: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as Database } from './database-
|
|
2
|
-
import { S as SirannonOptions, a as SQLiteDriver, D as DatabaseOptions, M as Migration, B as BeforeQueryHook, A as AfterQueryHook, b as BeforeConnectHook, c as DatabaseOpenHook, d as DatabaseCloseHook } from './types-
|
|
1
|
+
import { D as Database } from './database-DvSvONb-.js';
|
|
2
|
+
import { S as SirannonOptions, a as SQLiteDriver, D as DatabaseOptions, M as Migration, B as BeforeQueryHook, A as AfterQueryHook, b as BeforeConnectHook, c as DatabaseOpenHook, d as DatabaseCloseHook } from './types-CXoPBeDM.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* A registry of open SQLite databases, keyed by identifier.
|
package/dist/transport/grpc.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { BinaryWriter, BinaryReader } from '@bufbuild/protobuf/wire';
|
|
2
2
|
import { Client, ClientDuplexStream, CallOptions, Metadata, ServiceError, ClientUnaryCall, ChannelCredentials, ClientOptions, ServerDuplexStream, Server } from '@grpc/grpc-js';
|
|
3
3
|
import { HealthImplementation } from 'grpc-health-check';
|
|
4
|
-
import { R as ReplicationAck, F as ForwardedTransaction, a as ForwardedTransactionResult, N as NodeInfo, S as SyncRequest, b as SyncBatch, c as SyncComplete, d as SyncAck, e as ReplicationTransport, f as TopologyRole, T as TransportConfig } from '../types-
|
|
4
|
+
import { R as ReplicationAck, F as ForwardedTransaction, a as ForwardedTransactionResult, N as NodeInfo, S as SyncRequest, b as SyncBatch, c as SyncComplete, d as SyncAck, e as ReplicationTransport, f as TopologyRole, T as TransportConfig } from '../types-DtUwSmAQ.js';
|
|
5
5
|
import { R as ReplicationBatch } from '../types-CjhxcjhA.js';
|
|
6
|
-
import '../change-tracker-
|
|
7
|
-
import '../types-
|
|
8
|
-
import '../query-types-
|
|
6
|
+
import '../change-tracker-C2Z8UbI0.js';
|
|
7
|
+
import '../types-CXoPBeDM.js';
|
|
8
|
+
import '../query-types-BvkzxKQv.js';
|
|
9
9
|
import '../types-CMBcFPhb.js';
|
|
10
10
|
|
|
11
11
|
interface ColumnValue {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { R as ReplicationAck, F as ForwardedTransaction, a as ForwardedTransactionResult, S as SyncRequest, b as SyncBatch, c as SyncComplete, d as SyncAck, N as NodeInfo, e as ReplicationTransport, T as TransportConfig } from '../types-
|
|
1
|
+
import { R as ReplicationAck, F as ForwardedTransaction, a as ForwardedTransactionResult, S as SyncRequest, b as SyncBatch, c as SyncComplete, d as SyncAck, N as NodeInfo, e as ReplicationTransport, T as TransportConfig } from '../types-DtUwSmAQ.js';
|
|
2
2
|
import { R as ReplicationBatch } from '../types-CjhxcjhA.js';
|
|
3
|
-
import '../change-tracker-
|
|
4
|
-
import '../types-
|
|
5
|
-
import '../query-types-
|
|
3
|
+
import '../change-tracker-C2Z8UbI0.js';
|
|
4
|
+
import '../types-CXoPBeDM.js';
|
|
5
|
+
import '../query-types-BvkzxKQv.js';
|
|
6
6
|
import '../types-CMBcFPhb.js';
|
|
7
7
|
|
|
8
8
|
type BatchHandler = (batch: ReplicationBatch, fromPeerId: string) => Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as Params, W as WriteConcern, R as ReadConcern, b as ChangeOperation, E as ExecuteResult, a as ReadConcernLevel } from './query-types-
|
|
1
|
+
import { P as Params, W as WriteConcern, R as ReadConcern, b as ChangeOperation, E as ExecuteResult, a as ReadConcernLevel } from './query-types-BvkzxKQv.js';
|
|
2
2
|
|
|
3
3
|
/** Context passed to query hooks.
|
|
4
4
|
* @public
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ChangeTracker } from './change-tracker-
|
|
2
|
-
import { e as SQLiteConnection, N as NodeHealth } from './types-
|
|
1
|
+
import { C as ChangeTracker } from './change-tracker-C2Z8UbI0.js';
|
|
2
|
+
import { e as SQLiteConnection, N as NodeHealth } from './types-CXoPBeDM.js';
|
|
3
3
|
import { S as SyncTableManifest, R as ReplicationBatch, C as ConflictResolver } from './types-CjhxcjhA.js';
|
|
4
4
|
import { C as ClusterCoordinator, j as CoordinatorCompatibilityMetadata, c as ReplicationGroupState } from './types-CMBcFPhb.js';
|
|
5
5
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delali/sirannon-db",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2",
|
|
5
5
|
"description": "A production-grade library that turns SQLite databases into a networked data layer with real-time subscriptions.",
|
|
6
6
|
"author": "Delali (https://sondelali.com)",
|
|
7
7
|
"license": "Apache-2.0",
|