@delali/sirannon-db 0.3.1 → 0.3.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/dist/backup-scheduler/index.d.ts +2 -2
- package/dist/{chunk-EVA2RWPP.mjs → chunk-6IYS4WLH.mjs} +9 -0
- package/dist/client/index.d.ts +10 -10
- package/dist/client/index.mjs +2 -2
- package/dist/client/topology.d.ts +5 -5
- package/dist/client/topology.mjs +1 -1
- package/dist/{client-base-DrfhyZVo.d.ts → client-base-BQ--zmeh.d.ts} +12 -0
- package/dist/codegen/index.d.ts +20 -20
- package/dist/driver/better-sqlite3.d.ts +4 -4
- package/dist/driver/bun.d.ts +4 -4
- package/dist/driver/expo.d.ts +2 -2
- package/dist/driver/node.d.ts +4 -4
- package/dist/driver/wa-sqlite.d.ts +4 -4
- package/dist/file-migrations/index.d.ts +10 -10
- package/dist/replication/coordinator/etcd.d.ts +6 -6
- package/dist/replication/index.d.ts +20 -20
- package/dist/server/index.d.ts +4 -4
- package/dist/transport/grpc.d.ts +4 -4
- package/package.json +7 -7
|
@@ -1466,6 +1466,12 @@ var DatabaseClient = class {
|
|
|
1466
1466
|
constructor(options) {
|
|
1467
1467
|
this.settings = resolveTransportSettings(options);
|
|
1468
1468
|
}
|
|
1469
|
+
/**
|
|
1470
|
+
* Returns the handle a caller queries and writes one database through, opening it on the first call for that identifier.
|
|
1471
|
+
*
|
|
1472
|
+
* @param id - Identifier the server registered the database under.
|
|
1473
|
+
* @returns The database handle, which stays open until the caller closes it.
|
|
1474
|
+
*/
|
|
1469
1475
|
database(id) {
|
|
1470
1476
|
if (this.closed) {
|
|
1471
1477
|
throw new Error("Client is closed");
|
|
@@ -1488,6 +1494,9 @@ var DatabaseClient = class {
|
|
|
1488
1494
|
timeout !== void 0 && timeout > 0 ? timeout : DEFAULT_HTTP_REQUEST_TIMEOUT_MS
|
|
1489
1495
|
);
|
|
1490
1496
|
}
|
|
1497
|
+
/**
|
|
1498
|
+
* Closes every database this client opened, which ends their transports and stops their subscriptions.
|
|
1499
|
+
*/
|
|
1491
1500
|
close() {
|
|
1492
1501
|
this.closed = true;
|
|
1493
1502
|
const openDatabases = [...this.databases.values()];
|
package/dist/client/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ export { F as FieldMergeResolver, L as LWWResolver, P as PrimaryWinsResolver } f
|
|
|
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
4
|
import { C as ClientOptions, B as BulkLoadDurability } from '../server-options-C3KHEL8z.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-
|
|
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-
|
|
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-BQ--zmeh.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-BQ--zmeh.js';
|
|
7
7
|
import { a as LiveQuery, b as LiveQueryState, c as LiveUpdate } from '../types-qohUrQx6.js';
|
|
8
8
|
import { l as DeviceSyncPort, D as Database } from '../database-DHxMvGza.js';
|
|
9
9
|
import { C as ChangeEvent, P as Params, R as ReadConcern, W as WriteConcern } from '../query-types-p1liOP-b.js';
|
|
@@ -14,9 +14,9 @@ import '../database-backup-CAuL6aA-.js';
|
|
|
14
14
|
import '../change-tracker-BY8_k6lS.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* @public
|
|
18
|
-
*
|
|
19
17
|
* Connects to one sirannon-db server and hands out a {@link RemoteDatabase} per database.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
20
|
*/
|
|
21
21
|
declare class SirannonClient extends DatabaseClient {
|
|
22
22
|
private readonly baseUrl;
|
|
@@ -37,9 +37,9 @@ declare class SirannonClient extends DatabaseClient {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
* @public
|
|
41
|
-
*
|
|
42
40
|
* A live query running against a remote server, which keeps its rows current as the tables behind it change.
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
43
|
*/
|
|
44
44
|
declare class RemoteLiveQuery<T> implements LiveQuery<T> {
|
|
45
45
|
private state;
|
|
@@ -125,13 +125,13 @@ interface SnapshotDownloadResult {
|
|
|
125
125
|
loadedRows: number;
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
|
-
* @public
|
|
129
|
-
*
|
|
130
128
|
* Copies a database from a server into a local one, replacing what the local database holds.
|
|
131
129
|
*
|
|
132
130
|
* @param port - The local database the snapshot is written into.
|
|
133
131
|
* @param options - Where the snapshot comes from and how it is read.
|
|
134
132
|
* @returns The change-log position and sequence space to resume from, the tables copied, and the rows written.
|
|
133
|
+
*
|
|
134
|
+
* @public
|
|
135
135
|
*/
|
|
136
136
|
declare function downloadDatabaseSnapshot(port: DeviceSyncPort, options: SnapshotDownloadOptions): Promise<SnapshotDownloadResult>;
|
|
137
137
|
|
|
@@ -269,9 +269,9 @@ interface SyncStatus {
|
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
/**
|
|
272
|
-
* @public
|
|
273
|
-
*
|
|
274
272
|
* Keeps one device's local database in step with a server: it pushes local changes, pulls the server's, and downloads a fresh snapshot when the device falls too far behind.
|
|
273
|
+
*
|
|
274
|
+
* @public
|
|
275
275
|
*/
|
|
276
276
|
declare class SyncController {
|
|
277
277
|
private readonly db;
|
package/dist/client/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DatabaseClient, createEndpointTransport, toBaseUrl, DEFAULT_HTTP_REQUEST_TIMEOUT_MS, postJson, decodeTaggedValues, RemoteError, invokeCallerCallback, encodeTaggedValues, assertWebSocketCredentials, STAGED_STREAM_CAPABILITY, verifyDeviceSyncCapabilities, unrefTimer, toWsUrl, WebSocketTransport } from '../chunk-
|
|
2
|
-
export { HttpTransport, RemoteDatabase, RemoteError, RemoteLiveQuery, RemoteSubscriptionBuilderImpl, SQL_REFUSED_MESSAGE, ServerCapabilities, WebSocketTransport } from '../chunk-
|
|
1
|
+
import { DatabaseClient, createEndpointTransport, toBaseUrl, DEFAULT_HTTP_REQUEST_TIMEOUT_MS, postJson, decodeTaggedValues, RemoteError, invokeCallerCallback, encodeTaggedValues, assertWebSocketCredentials, STAGED_STREAM_CAPABILITY, verifyDeviceSyncCapabilities, unrefTimer, toWsUrl, WebSocketTransport } from '../chunk-6IYS4WLH.mjs';
|
|
2
|
+
export { HttpTransport, RemoteDatabase, RemoteError, RemoteLiveQuery, RemoteSubscriptionBuilderImpl, SQL_REFUSED_MESSAGE, ServerCapabilities, WebSocketTransport } from '../chunk-6IYS4WLH.mjs';
|
|
3
3
|
|
|
4
4
|
// src/core/sync/canonicalise.ts
|
|
5
5
|
function canonicaliseForChecksum(value) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as ReadConcernLevel } from '../query-types-p1liOP-b.js';
|
|
2
2
|
import { C as ClientOptions } from '../server-options-C3KHEL8z.js';
|
|
3
|
-
import { T as Transport, D as DatabaseClient } from '../client-base-
|
|
3
|
+
import { T as Transport, D as DatabaseClient } from '../client-base-BQ--zmeh.js';
|
|
4
4
|
import { H as ClusterStatusInfo } from '../types-_k29or0d.js';
|
|
5
5
|
import '../operation-registry-oiPuSYI6.js';
|
|
6
6
|
import '../types-CjhxcjhA.js';
|
|
@@ -36,9 +36,9 @@ interface TopologyRouting {
|
|
|
36
36
|
declare function parseClusterStatus(data: unknown, databaseId: string): ClusterStatusInfo;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* @public
|
|
40
|
-
*
|
|
41
39
|
* Which nodes the client holds, how it finds the rest, and where it sends each read.
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
42
|
*/
|
|
43
43
|
interface TopologyAwareClientOptions extends ClientOptions {
|
|
44
44
|
/**
|
|
@@ -67,9 +67,9 @@ interface TopologyAwareClientOptions extends ClientOptions {
|
|
|
67
67
|
readConcern?: ReadConcernLevel;
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
* @public
|
|
71
|
-
*
|
|
72
70
|
* Connects to a replication group rather than one server: it routes each read to a node that meets its read concern, and each write to the primary.
|
|
71
|
+
*
|
|
72
|
+
* @public
|
|
73
73
|
*/
|
|
74
74
|
declare class TopologyAwareClient extends DatabaseClient implements TopologyRouting {
|
|
75
75
|
private readonly baseUrl;
|
package/dist/client/topology.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DatabaseClient, toBaseUrl, createEndpointTransport, RemoteError, toServerBaseUrl, unrefTimer } from '../chunk-
|
|
1
|
+
import { DatabaseClient, toBaseUrl, createEndpointTransport, RemoteError, toServerBaseUrl, unrefTimer } from '../chunk-6IYS4WLH.mjs';
|
|
2
2
|
import '../chunk-3LXXH3RA.mjs';
|
|
3
3
|
|
|
4
4
|
// src/client/cluster-routing.ts
|
|
@@ -370,13 +370,25 @@ interface TransportSettings {
|
|
|
370
370
|
reconnectInterval: number;
|
|
371
371
|
requestTimeout: number | undefined;
|
|
372
372
|
}
|
|
373
|
+
/**
|
|
374
|
+
* Opens one database handle per identifier and keeps it, so a later call for the same identifier returns the handle already open.
|
|
375
|
+
*/
|
|
373
376
|
declare abstract class DatabaseClient {
|
|
374
377
|
protected readonly settings: TransportSettings;
|
|
375
378
|
private readonly databases;
|
|
376
379
|
private closed;
|
|
377
380
|
constructor(options?: ClientOptions);
|
|
381
|
+
/**
|
|
382
|
+
* Returns the handle a caller queries and writes one database through, opening it on the first call for that identifier.
|
|
383
|
+
*
|
|
384
|
+
* @param id - Identifier the server registered the database under.
|
|
385
|
+
* @returns The database handle, which stays open until the caller closes it.
|
|
386
|
+
*/
|
|
378
387
|
database(id: string): RemoteDatabase;
|
|
379
388
|
protected createCapabilities(databaseId: string): ServerCapabilities;
|
|
389
|
+
/**
|
|
390
|
+
* Closes every database this client opened, which ends their transports and stops their subscriptions.
|
|
391
|
+
*/
|
|
380
392
|
close(): void;
|
|
381
393
|
protected abstract createTransport(databaseId: string): Transport;
|
|
382
394
|
protected abstract resolveServerUrl(databaseId: string): string | Promise<string>;
|
package/dist/codegen/index.d.ts
CHANGED
|
@@ -2,15 +2,15 @@ import { a as OperationRegistry } from '../operation-registry-oiPuSYI6.js';
|
|
|
2
2
|
import '../query-types-p1liOP-b.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @public
|
|
6
|
-
*
|
|
7
5
|
* Version of the manifest format the generator writes.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
8
|
*/
|
|
9
9
|
declare const OPERATION_MANIFEST_VERSION = 1;
|
|
10
10
|
/**
|
|
11
|
-
* @public
|
|
12
|
-
*
|
|
13
11
|
* The arguments and columns of one registered operation, as code generation reads them.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
14
|
*/
|
|
15
15
|
interface OperationShape {
|
|
16
16
|
/**
|
|
@@ -27,9 +27,9 @@ interface OperationShape {
|
|
|
27
27
|
columns: string[] | null;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* @public
|
|
31
|
-
*
|
|
32
30
|
* The reads and writes one database exposes by name.
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
33
|
*/
|
|
34
34
|
interface DatabaseManifest {
|
|
35
35
|
/**
|
|
@@ -42,9 +42,9 @@ interface DatabaseManifest {
|
|
|
42
42
|
writes: Record<string, OperationShape>;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* @public
|
|
46
|
-
*
|
|
47
45
|
* Every database's registered operations, in the form code generation reads.
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
48
|
*/
|
|
49
49
|
interface OperationManifest {
|
|
50
50
|
/**
|
|
@@ -61,28 +61,28 @@ interface OperationManifest {
|
|
|
61
61
|
databases: Record<string, DatabaseManifest>;
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
|
-
* @public
|
|
65
|
-
*
|
|
66
64
|
* Reads a registry and describes each operation's arguments and columns.
|
|
67
65
|
*
|
|
68
66
|
* @param registry - The registered operations to describe.
|
|
69
67
|
* @returns The manifest code generation renders types from.
|
|
68
|
+
*
|
|
69
|
+
* @public
|
|
70
70
|
*/
|
|
71
71
|
declare function buildOperationManifest<I>(registry: OperationRegistry<I>): OperationManifest;
|
|
72
72
|
/**
|
|
73
|
-
* @public
|
|
74
|
-
*
|
|
75
73
|
* Reads the column names a SELECT statement produces.
|
|
76
74
|
*
|
|
77
75
|
* @param sql - The statement to inspect.
|
|
78
76
|
* @returns The column names, or null when the statement's columns cannot be read from its text.
|
|
77
|
+
*
|
|
78
|
+
* @public
|
|
79
79
|
*/
|
|
80
80
|
declare function selectColumns(sql: string): string[] | null;
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
|
-
* @public
|
|
84
|
-
*
|
|
85
83
|
* How the generated TypeScript is written.
|
|
84
|
+
*
|
|
85
|
+
* @public
|
|
86
86
|
*/
|
|
87
87
|
interface RenderOptions {
|
|
88
88
|
/**
|
|
@@ -91,29 +91,29 @@ interface RenderOptions {
|
|
|
91
91
|
packageName?: string;
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
|
-
* @public
|
|
95
|
-
*
|
|
96
94
|
* Renders typed references for every operation in a manifest.
|
|
97
95
|
*
|
|
98
96
|
* @param manifest - The operations to render.
|
|
99
97
|
* @param options - The package the generated file imports from.
|
|
100
98
|
* @returns The TypeScript source to write.
|
|
99
|
+
*
|
|
100
|
+
* @public
|
|
101
101
|
*/
|
|
102
102
|
declare function renderOperationTypes(manifest: OperationManifest, options?: RenderOptions): string;
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
|
-
* @public
|
|
106
|
-
*
|
|
107
105
|
* Usage text the code generator prints when its arguments do not parse.
|
|
106
|
+
*
|
|
107
|
+
* @public
|
|
108
108
|
*/
|
|
109
109
|
declare const CODEGEN_USAGE = "sirannon-codegen --registry <module> --out <file> [--manifest <file>] [--export <name>] [--package <name>]\n\nReads the operation registry a server is built from and writes the typed\nreferences a client calls it through. The registry module is imported, so run\nit under a loader that reads your source format when it is not JavaScript.";
|
|
110
110
|
/**
|
|
111
|
-
* @public
|
|
112
|
-
*
|
|
113
111
|
* Runs the code generator: it loads a registry module, builds the manifest, and writes the typed references.
|
|
114
112
|
*
|
|
115
113
|
* @param argv - Command-line arguments, without the executable and script names.
|
|
116
114
|
* @throws When an argument is missing or the registry module cannot be loaded.
|
|
115
|
+
*
|
|
116
|
+
* @public
|
|
117
117
|
*/
|
|
118
118
|
declare function runCodegen(argv: readonly string[]): Promise<void>;
|
|
119
119
|
|
|
@@ -2,9 +2,9 @@ import { S as SQLiteDriver } from '../types-_k29or0d.js';
|
|
|
2
2
|
import '../query-types-p1liOP-b.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @public
|
|
6
|
-
*
|
|
7
5
|
* Settings for the better-sqlite3 driver.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
8
|
*/
|
|
9
9
|
interface BetterSqlite3Options {
|
|
10
10
|
/**
|
|
@@ -20,12 +20,12 @@ interface BetterSqlite3Options {
|
|
|
20
20
|
vfsExtensionPath?: string;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* @public
|
|
24
|
-
*
|
|
25
23
|
* Builds a driver on better-sqlite3, which is the fastest option on Node.
|
|
26
24
|
*
|
|
27
25
|
* @param driverOptions - How long a statement waits for the write lock.
|
|
28
26
|
* @returns The driver, ready to pass to a `Sirannon` registry.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
29
|
*/
|
|
30
30
|
declare function betterSqlite3(driverOptions?: BetterSqlite3Options): SQLiteDriver;
|
|
31
31
|
|
package/dist/driver/bun.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { S as SQLiteDriver } from '../types-_k29or0d.js';
|
|
|
2
2
|
import '../query-types-p1liOP-b.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @public
|
|
6
|
-
*
|
|
7
5
|
* Settings for the driver built on Bun's built-in SQLite.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
8
|
*/
|
|
9
9
|
interface BunSqliteOptions {
|
|
10
10
|
/**
|
|
@@ -13,8 +13,6 @@ interface BunSqliteOptions {
|
|
|
13
13
|
busyTimeout?: number;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* @public
|
|
17
|
-
*
|
|
18
16
|
* Builds a driver that runs SQLite through `bun:sqlite`, which is built into the Bun runtime.
|
|
19
17
|
*
|
|
20
18
|
* It reads every integer as a BigInt and narrows the safe ones back, so a
|
|
@@ -22,6 +20,8 @@ interface BunSqliteOptions {
|
|
|
22
20
|
*
|
|
23
21
|
* @param driverOptions - How long a statement waits for the write lock.
|
|
24
22
|
* @returns The driver, ready to pass to a `Sirannon` registry running under Bun.
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
25
|
*/
|
|
26
26
|
declare function bunSqlite(driverOptions?: BunSqliteOptions): SQLiteDriver;
|
|
27
27
|
|
package/dist/driver/expo.d.ts
CHANGED
|
@@ -2,8 +2,6 @@ import { S as SQLiteDriver } from '../types-_k29or0d.js';
|
|
|
2
2
|
import '../query-types-p1liOP-b.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @public
|
|
6
|
-
*
|
|
7
5
|
* Builds a driver that runs SQLite on a device through `expo-sqlite`.
|
|
8
6
|
*
|
|
9
7
|
* Expo opens one connection per database, so this driver reports no support
|
|
@@ -11,6 +9,8 @@ import '../query-types-p1liOP-b.js';
|
|
|
11
9
|
* single connection.
|
|
12
10
|
*
|
|
13
11
|
* @returns The driver, ready to pass to a `Sirannon` registry in a React Native app.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
14
|
*/
|
|
15
15
|
declare function expoSqlite(): SQLiteDriver;
|
|
16
16
|
|
package/dist/driver/node.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { S as SQLiteDriver } from '../types-_k29or0d.js';
|
|
|
2
2
|
import '../query-types-p1liOP-b.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @public
|
|
6
|
-
*
|
|
7
5
|
* Settings for the driver built on Node's own SQLite module.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
8
|
*/
|
|
9
9
|
interface NodeSqliteOptions {
|
|
10
10
|
/**
|
|
@@ -20,12 +20,12 @@ interface NodeSqliteOptions {
|
|
|
20
20
|
vfsExtensionPath?: string;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* @public
|
|
24
|
-
*
|
|
25
23
|
* Builds a driver on Node's own SQLite module, which needs no native dependency.
|
|
26
24
|
*
|
|
27
25
|
* @param driverOptions - How long a statement waits for the write lock.
|
|
28
26
|
* @returns The driver, ready to pass to a `Sirannon` registry.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
29
|
*/
|
|
30
30
|
declare function nodeSqlite(driverOptions?: NodeSqliteOptions): SQLiteDriver;
|
|
31
31
|
|
|
@@ -2,9 +2,9 @@ import { S as SQLiteDriver } from '../types-_k29or0d.js';
|
|
|
2
2
|
import '../query-types-p1liOP-b.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @public
|
|
6
|
-
*
|
|
7
5
|
* Settings for the browser driver built on wa-sqlite.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
8
|
*/
|
|
9
9
|
interface WaSqliteOptions {
|
|
10
10
|
/**
|
|
@@ -13,12 +13,12 @@ interface WaSqliteOptions {
|
|
|
13
13
|
vfs?: 'IDBBatchAtomicVFS' | 'AccessHandlePoolVFS';
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* @public
|
|
17
|
-
*
|
|
18
16
|
* Builds a driver that runs SQLite in the browser through WebAssembly.
|
|
19
17
|
*
|
|
20
18
|
* @param driverOptions - Where the browser stores the database.
|
|
21
19
|
* @returns The driver, ready to pass to a `Sirannon` registry.
|
|
20
|
+
*
|
|
21
|
+
* @public
|
|
22
22
|
*/
|
|
23
23
|
declare function waSqlite(driverOptions?: WaSqliteOptions): SQLiteDriver;
|
|
24
24
|
|
|
@@ -3,9 +3,9 @@ import { M as Migration } from '../types-_k29or0d.js';
|
|
|
3
3
|
import '../query-types-p1liOP-b.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* @public
|
|
7
|
-
*
|
|
8
6
|
* How a directory of migration files is turned into migrations.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
9
|
*/
|
|
10
10
|
interface LoadMigrationsOptions {
|
|
11
11
|
/**
|
|
@@ -14,9 +14,9 @@ interface LoadMigrationsOptions {
|
|
|
14
14
|
baseline?: BaselineFileOption;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* @public
|
|
18
|
-
*
|
|
19
17
|
* One migration found on disk, with the paths of its up and down files.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
20
|
*/
|
|
21
21
|
interface ScannedMigration {
|
|
22
22
|
/**
|
|
@@ -37,32 +37,32 @@ interface ScannedMigration {
|
|
|
37
37
|
downPath: string | null;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
* @public
|
|
41
|
-
*
|
|
42
40
|
* Lists the migration files in a directory, in ascending version order.
|
|
43
41
|
*
|
|
44
42
|
* @param dirPath - Directory holding the migration files.
|
|
45
43
|
* @returns One entry per migration, with the paths of its up and down files.
|
|
46
44
|
* @throws When the path is unsafe or a file name does not parse.
|
|
45
|
+
*
|
|
46
|
+
* @public
|
|
47
47
|
*/
|
|
48
48
|
declare function scanDirectory(dirPath: string): ScannedMigration[];
|
|
49
49
|
/**
|
|
50
|
-
* @public
|
|
51
|
-
*
|
|
52
50
|
* Reads the up files of scanned migrations, leaving each down file to be read only if a rollback needs it.
|
|
53
51
|
*
|
|
54
52
|
* @param scanned - Migrations found by {@link scanDirectory}.
|
|
55
53
|
* @returns The migrations, in ascending version order.
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
56
|
*/
|
|
57
57
|
declare function readUpMigrations(scanned: ScannedMigration[]): Migration[];
|
|
58
58
|
/**
|
|
59
|
-
* @public
|
|
60
|
-
*
|
|
61
59
|
* Reads a directory of migration files and returns the migrations to apply.
|
|
62
60
|
*
|
|
63
61
|
* @param dirPath - Directory holding the migration files.
|
|
64
62
|
* @param options - The baseline to apply, when an existing database starts from one.
|
|
65
63
|
* @returns The migrations, in ascending version order.
|
|
64
|
+
*
|
|
65
|
+
* @public
|
|
66
66
|
*/
|
|
67
67
|
declare function loadMigrations(dirPath: string, options?: LoadMigrationsOptions): Migration[];
|
|
68
68
|
|
|
@@ -2,9 +2,9 @@ import { IOptions } from 'etcd3';
|
|
|
2
2
|
import { C as ClusterCoordinator, A as AcquireControllerLeaseInput, a as AcquireControllerLeaseResult, R as RegisterNodeSessionInput, b as CoordinatorNodeSession, S as SetReplicationGroupStateInput, c as ReplicationGroupState, d as ReplicationGroupWatcher, e as CoordinatorWatchDisposer, f as CompareAndAdvancePrimaryTermInput, g as CompareAndAdvancePrimaryTermResult, U as UpdateInSyncSetInput, h as AdmitNodeToInSyncSetInput, i as UpdateNodeMaintenanceInput, P as PromoteEligibleReplicaInput } from '../../types-CMBcFPhb.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @public
|
|
6
|
-
*
|
|
7
5
|
* Where the etcd coordinator connects, under which key prefix it stores group state, and how it authenticates.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
8
|
*/
|
|
9
9
|
interface EtcdClusterCoordinatorOptions {
|
|
10
10
|
/**
|
|
@@ -46,11 +46,11 @@ interface EtcdClusterCoordinatorOptions {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
* @public
|
|
50
|
-
*
|
|
51
49
|
* Stores primary authority, node sessions, group state, and the in-sync set in etcd.
|
|
52
50
|
*
|
|
53
51
|
* Build one with {@link createEtcdCoordinator}.
|
|
52
|
+
*
|
|
53
|
+
* @public
|
|
54
54
|
*/
|
|
55
55
|
declare class EtcdClusterCoordinator implements ClusterCoordinator {
|
|
56
56
|
private readonly client;
|
|
@@ -94,12 +94,12 @@ declare class EtcdClusterCoordinator implements ClusterCoordinator {
|
|
|
94
94
|
private getLeaseFromKey;
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
|
-
* @public
|
|
98
|
-
*
|
|
99
97
|
* Builds a coordinator backed by etcd.
|
|
100
98
|
*
|
|
101
99
|
* @param options - etcd endpoints, key prefix, credentials, and timeouts.
|
|
102
100
|
* @returns The coordinator, ready to pass to a replication engine.
|
|
101
|
+
*
|
|
102
|
+
* @public
|
|
103
103
|
*/
|
|
104
104
|
declare function createEtcdCoordinator(options: EtcdClusterCoordinatorOptions): EtcdClusterCoordinator;
|
|
105
105
|
|
|
@@ -545,9 +545,9 @@ declare class WriteConcernError extends ReplicationError {
|
|
|
545
545
|
constructor(message: string);
|
|
546
546
|
}
|
|
547
547
|
/**
|
|
548
|
-
* @public
|
|
549
|
-
*
|
|
550
548
|
* Thrown when a node cannot prove a read is as current as the caller required.
|
|
549
|
+
*
|
|
550
|
+
* @public
|
|
551
551
|
*/
|
|
552
552
|
declare class ReadConcernError extends ReplicationError {
|
|
553
553
|
constructor(message: string, details?: Record<string, unknown>);
|
|
@@ -559,73 +559,73 @@ declare class TopologyError extends ReplicationError {
|
|
|
559
559
|
constructor(message: string);
|
|
560
560
|
}
|
|
561
561
|
/**
|
|
562
|
-
* @public
|
|
563
|
-
*
|
|
564
562
|
* Thrown when a node cannot reach its cluster coordinator.
|
|
563
|
+
*
|
|
564
|
+
* @public
|
|
565
565
|
*/
|
|
566
566
|
declare class CoordinatorError extends ReplicationError {
|
|
567
567
|
constructor(message: string, details?: Record<string, unknown>);
|
|
568
568
|
}
|
|
569
569
|
/**
|
|
570
|
-
* @public
|
|
571
|
-
*
|
|
572
570
|
* Thrown when a node cannot prove it holds write authority for the current term.
|
|
571
|
+
*
|
|
572
|
+
* @public
|
|
573
573
|
*/
|
|
574
574
|
declare class AuthorityError extends ReplicationError {
|
|
575
575
|
constructor(message: string, code?: string, details?: Record<string, unknown>);
|
|
576
576
|
}
|
|
577
577
|
/**
|
|
578
|
-
* @public
|
|
579
|
-
*
|
|
580
578
|
* Thrown when a node believing itself primary finds the group has moved to a later term.
|
|
579
|
+
*
|
|
580
|
+
* @public
|
|
581
581
|
*/
|
|
582
582
|
declare class StalePrimaryError extends AuthorityError {
|
|
583
583
|
constructor(message: string, details?: Record<string, unknown>);
|
|
584
584
|
}
|
|
585
585
|
/**
|
|
586
|
-
* @public
|
|
587
|
-
*
|
|
588
586
|
* Thrown when failover cannot complete safely.
|
|
587
|
+
*
|
|
588
|
+
* @public
|
|
589
589
|
*/
|
|
590
590
|
declare class FailoverError extends ReplicationError {
|
|
591
591
|
constructor(message: string, code?: string, details?: Record<string, unknown>);
|
|
592
592
|
}
|
|
593
593
|
/**
|
|
594
|
-
* @public
|
|
595
|
-
*
|
|
596
594
|
* Thrown when no replica is in sync enough to take over as primary, so writes stay unavailable rather than risking loss.
|
|
595
|
+
*
|
|
596
|
+
* @public
|
|
597
597
|
*/
|
|
598
598
|
declare class NoSafePrimaryError extends FailoverError {
|
|
599
599
|
constructor(message: string, details?: Record<string, unknown>);
|
|
600
600
|
}
|
|
601
601
|
/**
|
|
602
|
-
* @public
|
|
603
|
-
*
|
|
604
602
|
* Thrown when a node cannot meet a read concern because the group does not count it as in sync.
|
|
603
|
+
*
|
|
604
|
+
* @public
|
|
605
605
|
*/
|
|
606
606
|
declare class NodeNotInSyncError extends ReplicationError {
|
|
607
607
|
constructor(message: string, details?: Record<string, unknown>);
|
|
608
608
|
}
|
|
609
609
|
/**
|
|
610
|
-
* @public
|
|
611
|
-
*
|
|
612
610
|
* Thrown when a node is being taken out of service and refuses new work.
|
|
611
|
+
*
|
|
612
|
+
* @public
|
|
613
613
|
*/
|
|
614
614
|
declare class NodeDrainingError extends ReplicationError {
|
|
615
615
|
constructor(message: string, details?: Record<string, unknown>);
|
|
616
616
|
}
|
|
617
617
|
/**
|
|
618
|
-
* @public
|
|
619
|
-
*
|
|
620
618
|
* Thrown when a peer speaks a replication protocol version this node cannot work with.
|
|
619
|
+
*
|
|
620
|
+
* @public
|
|
621
621
|
*/
|
|
622
622
|
declare class ProtocolVersionMismatchError extends ReplicationError {
|
|
623
623
|
constructor(message: string, details?: Record<string, unknown>);
|
|
624
624
|
}
|
|
625
625
|
/**
|
|
626
|
-
* @public
|
|
627
|
-
*
|
|
628
626
|
* Thrown when recovery would lose acknowledged writes, so an operator must rebuild or restore the node first.
|
|
627
|
+
*
|
|
628
|
+
* @public
|
|
629
629
|
*/
|
|
630
630
|
declare class UnsafeRecoveryRequiredError extends FailoverError {
|
|
631
631
|
constructor(message: string, details?: Record<string, unknown>);
|
package/dist/server/index.d.ts
CHANGED
|
@@ -453,11 +453,11 @@ interface WSErrorMessage {
|
|
|
453
453
|
}
|
|
454
454
|
|
|
455
455
|
/**
|
|
456
|
-
* @public
|
|
457
|
-
*
|
|
458
456
|
* Serves a `Sirannon` database registry over HTTP and WebSocket.
|
|
459
457
|
*
|
|
460
458
|
* Build one with {@link createServer}, then call {@link SirannonServer.listen}.
|
|
459
|
+
*
|
|
460
|
+
* @public
|
|
461
461
|
*/
|
|
462
462
|
declare class SirannonServer<Identity = unknown> {
|
|
463
463
|
private app;
|
|
@@ -503,13 +503,13 @@ declare class SirannonServer<Identity = unknown> {
|
|
|
503
503
|
private wrapDbGetRoute;
|
|
504
504
|
}
|
|
505
505
|
/**
|
|
506
|
-
* @public
|
|
507
|
-
*
|
|
508
506
|
* Builds a server over a database registry.
|
|
509
507
|
*
|
|
510
508
|
* @param sirannon - The registry whose databases the server exposes.
|
|
511
509
|
* @param options - Address, cross-origin rules, size limits, authentication, registered operations, and whether the server accepts SQL.
|
|
512
510
|
* @returns The server, ready to listen.
|
|
511
|
+
*
|
|
512
|
+
* @public
|
|
513
513
|
*/
|
|
514
514
|
declare function createServer<Identity = unknown>(sirannon: Sirannon, options?: ServerOptions<Identity>): SirannonServer<Identity>;
|
|
515
515
|
|
package/dist/transport/grpc.d.ts
CHANGED
|
@@ -238,9 +238,9 @@ declare function toColumnValue(value: unknown): ColumnValue;
|
|
|
238
238
|
declare function fromColumnValue(cv: ColumnValue): unknown;
|
|
239
239
|
|
|
240
240
|
/**
|
|
241
|
-
* @public
|
|
242
|
-
*
|
|
243
241
|
* Where the gRPC transport listens, and the certificates it presents and trusts.
|
|
242
|
+
*
|
|
243
|
+
* @public
|
|
244
244
|
*/
|
|
245
245
|
interface GrpcReplicationOptions {
|
|
246
246
|
/**
|
|
@@ -293,9 +293,9 @@ type SyncCompleteHandler = (complete: SyncComplete, fromPeerId: string) => Promi
|
|
|
293
293
|
type SyncAckHandler = (ack: SyncAck, fromPeerId: string) => void;
|
|
294
294
|
|
|
295
295
|
/**
|
|
296
|
-
* @public
|
|
297
|
-
*
|
|
298
296
|
* Replicates between nodes over gRPC with mutual TLS, which is the transport production clusters use.
|
|
297
|
+
*
|
|
298
|
+
* @public
|
|
299
299
|
*/
|
|
300
300
|
declare class GrpcReplicationTransport implements ReplicationTransport {
|
|
301
301
|
/** @internal */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delali/sirannon-db",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.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",
|
|
@@ -210,11 +210,11 @@
|
|
|
210
210
|
"vitest": "4.0.18"
|
|
211
211
|
},
|
|
212
212
|
"optionalDependencies": {
|
|
213
|
-
"@delali/sirannon-vfs-darwin-arm64": "0.3.
|
|
214
|
-
"@delali/sirannon-vfs-darwin-x64": "0.3.
|
|
215
|
-
"@delali/sirannon-vfs-linux-arm64": "0.3.
|
|
216
|
-
"@delali/sirannon-vfs-linux-x64": "0.3.
|
|
217
|
-
"@delali/sirannon-vfs-win32-arm64": "0.3.
|
|
218
|
-
"@delali/sirannon-vfs-win32-x64": "0.3.
|
|
213
|
+
"@delali/sirannon-vfs-darwin-arm64": "0.3.2",
|
|
214
|
+
"@delali/sirannon-vfs-darwin-x64": "0.3.2",
|
|
215
|
+
"@delali/sirannon-vfs-linux-arm64": "0.3.2",
|
|
216
|
+
"@delali/sirannon-vfs-linux-x64": "0.3.2",
|
|
217
|
+
"@delali/sirannon-vfs-win32-arm64": "0.3.2",
|
|
218
|
+
"@delali/sirannon-vfs-win32-x64": "0.3.2"
|
|
219
219
|
}
|
|
220
220
|
}
|