@delali/sirannon-db 0.3.4-next.62 → 0.3.4
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 +79 -56
- package/dist/backup/index.d.ts +44 -45
- package/dist/backup/index.mjs +7 -7
- package/dist/backup-scheduler/index.d.ts +42 -41
- package/dist/backup-scheduler/index.mjs +4 -4
- package/dist/baseline-Co3iIsN_.d.ts +19 -0
- package/dist/change-tracker-DqCdeEyx.d.ts +128 -0
- package/dist/{chunk-VOSJBZ6Q.mjs → chunk-2ES3DT4A.mjs} +71 -33
- package/dist/{chunk-6CMCO7S4.mjs → chunk-2O3PP4CF.mjs} +1 -1
- package/dist/{chunk-E7Q7HE46.mjs → chunk-3BZLZ47R.mjs} +26 -26
- package/dist/chunk-4KASJKKK.mjs +2501 -0
- package/dist/{chunk-MYNI2WFS.mjs → chunk-52XW3Z76.mjs} +40 -8
- package/dist/chunk-55YRLSM2.mjs +57 -0
- package/dist/{chunk-KDAHYFW7.mjs → chunk-6AOJCNRU.mjs} +5 -5
- package/dist/{chunk-KXTYR2OQ.mjs → chunk-A3PHCO6W.mjs} +39 -111
- package/dist/chunk-ADNWEHGZ.mjs +299 -0
- package/dist/{chunk-2QLXDHAP.mjs → chunk-BLMRNSUG.mjs} +11 -2
- package/dist/chunk-BVMZJOVM.mjs +5 -0
- package/dist/{chunk-IWGIYDMZ.mjs → chunk-BZWDPF4G.mjs} +1 -1
- package/dist/{chunk-YVF2ZJTE.mjs → chunk-CZL4D3BM.mjs} +1 -1
- package/dist/{chunk-7SC2TZAS.mjs → chunk-DX4WGJL7.mjs} +2 -2
- package/dist/{chunk-45MKELYA.mjs → chunk-ESTZZPT5.mjs} +132 -13
- package/dist/{chunk-QP5L5DFJ.mjs → chunk-FJPR2CJX.mjs} +3 -3
- package/dist/chunk-HR7K3GZW.mjs +36 -0
- package/dist/{chunk-LXCGPZPA.mjs → chunk-IEKIYO4V.mjs} +1 -1
- package/dist/{chunk-TUD5CJ76.mjs → chunk-KB4OLJAD.mjs} +26 -19
- package/dist/{chunk-PBRXXISQ.mjs → chunk-KINDFBQP.mjs} +3 -2
- package/dist/{chunk-E6IMX7RS.mjs → chunk-KJLNYOOL.mjs} +2 -2
- package/dist/{chunk-BTTFW4Z4.mjs → chunk-KU32OT4H.mjs} +2 -10
- package/dist/{chunk-JQWGHSEH.mjs → chunk-NVSQ2T5Q.mjs} +71 -70
- package/dist/{chunk-W4EUTJNT.mjs → chunk-NZGSDALX.mjs} +94 -96
- package/dist/{chunk-U445A3C4.mjs → chunk-QGVRRKB2.mjs} +1 -1
- package/dist/{chunk-GYCEJNU4.mjs → chunk-R7GBXNTO.mjs} +1 -1
- package/dist/{chunk-7C36BCSN.mjs → chunk-VDN6FHU4.mjs} +1 -1
- package/dist/{chunk-6IYS4WLH.mjs → chunk-VO3ZWA2G.mjs} +142 -115
- package/dist/chunk-WOMADPM4.mjs +12 -0
- package/dist/{chunk-OUSWVNWT.mjs → chunk-YCMB6GR4.mjs} +1 -1
- package/dist/{chunk-YNTDOFTN.mjs → chunk-YW7IKQ7T.mjs} +1 -1
- package/dist/{chunk-M2BEAH5I.mjs → chunk-ZN4HI5FK.mjs} +126 -72
- package/dist/{chunk-SBL6GN43.mjs → chunk-ZYWI45EN.mjs} +1 -1
- package/dist/client/index.d.ts +135 -137
- package/dist/client/index.mjs +177 -82
- package/dist/client/topology.d.ts +31 -31
- package/dist/client/topology.mjs +42 -23
- package/dist/client-base-BxTocU1x.d.ts +398 -0
- package/dist/client-streams-YKANXMWO.mjs +112 -0
- package/dist/codegen/cli.mjs +4 -4
- package/dist/codegen/index.d.ts +36 -29
- package/dist/codegen/index.mjs +4 -4
- package/dist/core/index.d.ts +130 -115
- package/dist/core/index.mjs +387 -297
- package/dist/core/writer-worker.mjs +3 -3
- package/dist/database-CGDsXW1K.d.ts +959 -0
- package/dist/database-backup-DcLhxoa1.d.ts +143 -0
- package/dist/driver/better-sqlite3.d.ts +11 -10
- package/dist/driver/better-sqlite3.mjs +11 -11
- package/dist/driver/bun.d.ts +9 -8
- package/dist/driver/expo.d.ts +6 -7
- package/dist/driver/node.d.ts +11 -10
- package/dist/driver/node.mjs +13 -11
- package/dist/driver/wa-sqlite.d.ts +6 -6
- package/dist/errors-CJUkQ-KL.d.ts +199 -0
- package/dist/file-migrations/index.d.ts +20 -18
- package/dist/file-migrations/index.mjs +3 -3
- package/dist/forward-rpc-VRWFZXHN.mjs +44 -0
- package/dist/operation-registry-CGhNT-Sn.d.ts +96 -0
- package/dist/primary-wins-CHNOYuN7.d.ts +81 -0
- package/dist/protocol-DFpNNsIT.d.ts +153 -0
- package/dist/query-types-5B02ixH0.d.ts +129 -0
- package/dist/react/index.d.ts +22 -22
- package/dist/replication/coordinator/etcd.d.ts +37 -31
- package/dist/replication/coordinator/etcd.mjs +296 -131
- package/dist/replication/index.d.ts +201 -161
- package/dist/replication/index.mjs +630 -529
- package/dist/restore-options-CH8mE-Tb.d.ts +84 -0
- package/dist/server/index.d.ts +201 -191
- package/dist/server/index.mjs +736 -619
- package/dist/server-options-aYtCkefX.d.ts +317 -0
- package/dist/server-streams-24XL4T43.mjs +254 -0
- package/dist/sirannon-J3EgPVD7.d.ts +179 -0
- package/dist/transport/grpc.d.ts +37 -24
- package/dist/transport/grpc.mjs +83 -3199
- package/dist/transport/memory.d.ts +25 -26
- package/dist/transport/memory.mjs +18 -9
- package/dist/types-BrAiDGOb.d.ts +505 -0
- package/dist/types-CEJG0eFS.d.ts +88 -0
- package/dist/types-Dc8oWlxj.d.ts +1580 -0
- package/dist/types-DqODKeOq.d.ts +123 -0
- package/dist/types-guEKSzMr.d.ts +367 -0
- package/package.json +7 -7
- package/dist/baseline-D93hcIEE.d.ts +0 -17
- package/dist/change-tracker-CjRFuZdB.d.ts +0 -144
- package/dist/client-base-Cmd9EVme.d.ts +0 -397
- package/dist/database-BLQvqjsw.d.ts +0 -917
- package/dist/database-backup-B7oszQ2n.d.ts +0 -141
- package/dist/errors-Dei4GdBb.d.ts +0 -196
- package/dist/operation-registry-oiPuSYI6.d.ts +0 -94
- package/dist/primary-wins-B0np8JS3.d.ts +0 -85
- package/dist/protocol-HI-nY8DD.d.ts +0 -152
- package/dist/query-types-p1liOP-b.d.ts +0 -127
- package/dist/restore-options-CksYsH1l.d.ts +0 -83
- package/dist/server-options-Bj5iJnjx.d.ts +0 -292
- package/dist/sirannon-BPxC5tC2.d.ts +0 -178
- package/dist/types-B0EhgDbr.d.ts +0 -340
- package/dist/types-CbjfRwrK.d.ts +0 -499
- package/dist/types-CjhxcjhA.d.ts +0 -123
- package/dist/types-DPSmjU54.d.ts +0 -1518
- package/dist/types-DTO4CYhW.d.ts +0 -88
package/dist/react/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { L as LiveQueryOptions, a as LiveQuery, b as LiveQueryState } from '../types-
|
|
2
|
-
import { O as OperationRef } from '../operation-registry-
|
|
3
|
-
import { P as Params } from '../query-types-
|
|
1
|
+
import { L as LiveQueryOptions, a as LiveQuery, b as LiveQueryState } from '../types-CEJG0eFS.js';
|
|
2
|
+
import { O as OperationRef } from '../operation-registry-CGhNT-Sn.js';
|
|
3
|
+
import { P as Params } from '../query-types-5B02ixH0.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* The one method
|
|
7
|
-
* `Database` and a `RemoteDatabase`
|
|
6
|
+
* The one database method that `useLiveQuery` calls, which both a local
|
|
7
|
+
* `Database` and a `RemoteDatabase` provide.
|
|
8
8
|
*
|
|
9
9
|
* @public
|
|
10
10
|
*/
|
|
@@ -18,31 +18,31 @@ interface LiveDatabase {
|
|
|
18
18
|
* @public
|
|
19
19
|
*/
|
|
20
20
|
interface UseLiveQueryOptions extends LiveQueryOptions {
|
|
21
|
-
/** Set false to
|
|
21
|
+
/** Set it to `false` to keep the query closed, for example while the query's arguments depend on data that the component is still loading. */
|
|
22
22
|
enabled?: boolean;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Returns the state of a live query for a registered read, and re-renders the component each time the rows change.
|
|
26
26
|
*
|
|
27
|
-
* The
|
|
27
|
+
* The hook closes the query when the component unmounts.
|
|
28
28
|
*
|
|
29
|
-
* @param database -
|
|
30
|
-
* @param operation -
|
|
31
|
-
* @param args -
|
|
32
|
-
* @param options -
|
|
33
|
-
* @returns
|
|
29
|
+
* @param database - The database on which Sirannon runs the read.
|
|
30
|
+
* @param operation - The name of the registered read.
|
|
31
|
+
* @param args - The arguments for the read.
|
|
32
|
+
* @param options - The `enabled` flag and the live-query settings.
|
|
33
|
+
* @returns The query state, which is pending, ready with rows, or an error.
|
|
34
34
|
*
|
|
35
35
|
* @public
|
|
36
36
|
*/
|
|
37
37
|
declare function useLiveQuery<Row = Record<string, unknown>>(database: LiveDatabase, operation: string, args?: Params, options?: UseLiveQueryOptions): LiveQueryState<Row>;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* Returns the state of a live query for a registered read, and re-renders the component each time the rows change.
|
|
40
40
|
*
|
|
41
|
-
* @param database -
|
|
42
|
-
* @param operation -
|
|
43
|
-
* @param args -
|
|
44
|
-
* @param options -
|
|
45
|
-
* @returns
|
|
41
|
+
* @param database - The database on which Sirannon runs the read.
|
|
42
|
+
* @param operation - A reference to the registered read, with its argument and row types.
|
|
43
|
+
* @param args - The arguments for the read.
|
|
44
|
+
* @param options - The `enabled` flag and the live-query settings.
|
|
45
|
+
* @returns The query state, which is pending, ready with rows, or an error.
|
|
46
46
|
*
|
|
47
47
|
* @public
|
|
48
48
|
*/
|
|
@@ -50,8 +50,8 @@ declare function useLiveQuery<Args, Row>(database: LiveDatabase, operation: Oper
|
|
|
50
50
|
/**
|
|
51
51
|
* Returns a stable callback that runs a registered write.
|
|
52
52
|
*
|
|
53
|
-
* @param database -
|
|
54
|
-
* @param command -
|
|
53
|
+
* @param database - The database on which Sirannon runs the write.
|
|
54
|
+
* @param command - A reference to the registered write, with its argument type.
|
|
55
55
|
* @returns A callback that takes the write's arguments and resolves with its result.
|
|
56
56
|
*
|
|
57
57
|
* @public
|
|
@@ -62,7 +62,7 @@ declare function useCommand<Args, Result>(database: {
|
|
|
62
62
|
/**
|
|
63
63
|
* Returns a stable callback that runs a statement or a registered write by name.
|
|
64
64
|
*
|
|
65
|
-
* @param database -
|
|
65
|
+
* @param database - The database on which Sirannon runs the write.
|
|
66
66
|
* @param command - The statement to run, or the name of a registered write.
|
|
67
67
|
* @returns A callback that takes the parameters and resolves with the result.
|
|
68
68
|
*
|
|
@@ -1,46 +1,49 @@
|
|
|
1
1
|
import { IOptions } from 'etcd3';
|
|
2
|
-
import { C as ClusterCoordinator, A as AcquireControllerLeaseInput, a as AcquireControllerLeaseResult, R as RegisterNodeSessionInput,
|
|
2
|
+
import { C as ClusterCoordinator, A as AcquireControllerLeaseInput, a as AcquireControllerLeaseResult, b as ControllerLeaseWatcher, c as CoordinatorWatchDisposer, R as RegisterNodeSessionInput, d as CoordinatorNodeSession, N as NodeSessionWatcher, S as SetReplicationGroupStateInput, e as ReplicationGroupState, f as ReplicationGroupWatcher, g as CompareAndAdvancePrimaryTermInput, h as CompareAndAdvancePrimaryTermResult, U as UpdateInSyncSetInput, i as AdmitNodeToInSyncSetInput, j as UpdateNodeMaintenanceInput, P as PromoteEligibleReplicaInput } from '../../types-guEKSzMr.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Sets the etcd endpoints that the etcd coordinator connects to, the key prefix that it stores group state under, and
|
|
6
|
+
* how it authenticates.
|
|
6
7
|
*
|
|
7
8
|
* @public
|
|
8
9
|
*/
|
|
9
10
|
interface EtcdClusterCoordinatorOptions {
|
|
10
11
|
/**
|
|
11
|
-
* etcd endpoints to connect to.
|
|
12
|
+
* Lists the etcd endpoints to connect to. The coordinator accepts only https endpoints unless `allowInsecure` is true.
|
|
12
13
|
*/
|
|
13
14
|
hosts: string | string[];
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
+
* Sets the prefix that this coordinator puts in front of every key that it writes, so that several deployments can
|
|
17
|
+
* share one etcd.
|
|
16
18
|
*/
|
|
17
19
|
keyPrefix: string;
|
|
18
20
|
/**
|
|
19
|
-
* TLS material, which
|
|
21
|
+
* Holds the TLS material, which the coordinator requires unless `allowInsecure` is true.
|
|
20
22
|
*/
|
|
21
23
|
credentials?: IOptions['credentials'];
|
|
22
24
|
/**
|
|
23
|
-
*
|
|
25
|
+
* Holds a username and password, which the coordinator accepts in place of a client certificate.
|
|
24
26
|
*/
|
|
25
27
|
auth?: IOptions['auth'];
|
|
26
28
|
/**
|
|
27
|
-
*
|
|
29
|
+
* Holds options that the coordinator passes unchanged to the underlying gRPC channel.
|
|
28
30
|
*/
|
|
29
31
|
grpcOptions?: IOptions['grpcOptions'];
|
|
30
32
|
/**
|
|
31
|
-
*
|
|
33
|
+
* Sets how many milliseconds the client waits to connect to etcd.
|
|
32
34
|
*/
|
|
33
35
|
dialTimeoutMs?: number;
|
|
34
36
|
/**
|
|
35
|
-
*
|
|
37
|
+
* Sets how many milliseconds a single etcd call can take before its deadline expires.
|
|
36
38
|
*/
|
|
37
39
|
defaultCallTimeoutMs?: number;
|
|
38
40
|
/**
|
|
39
|
-
*
|
|
41
|
+
* Lets the coordinator connect to plain http endpoints without credentials. Use it only in tests.
|
|
40
42
|
*/
|
|
41
43
|
allowInsecure?: boolean;
|
|
42
44
|
/**
|
|
43
|
-
*
|
|
45
|
+
* Receives each error that an etcd watch reports or that a watch callback throws, and each lost lease, so that you
|
|
46
|
+
* can log it or raise an alert.
|
|
44
47
|
*/
|
|
45
48
|
onWatcherError?: (error: Error) => void;
|
|
46
49
|
}
|
|
@@ -48,55 +51,58 @@ interface EtcdClusterCoordinatorOptions {
|
|
|
48
51
|
/**
|
|
49
52
|
* Stores primary authority, node sessions, group state, and the in-sync set in etcd.
|
|
50
53
|
*
|
|
51
|
-
* Build one with {@link createEtcdCoordinator}.
|
|
54
|
+
* Build one with {@link createEtcdCoordinator}. The coordinator loads the `etcd3` package the first time that one of its methods connects to etcd. When this process cannot load that package, the call fails with a `SirannonError` whose code is `COORDINATOR_DEPENDENCY_MISSING`.
|
|
52
55
|
*
|
|
53
56
|
* @public
|
|
54
57
|
*/
|
|
55
58
|
declare class EtcdClusterCoordinator implements ClusterCoordinator {
|
|
56
|
-
private readonly
|
|
57
|
-
private
|
|
59
|
+
private readonly options;
|
|
60
|
+
private connection;
|
|
58
61
|
private readonly onWatcherError;
|
|
59
62
|
private readonly leases;
|
|
60
63
|
private readonly grantedNodeSessionLeaseIds;
|
|
61
64
|
private readonly watchers;
|
|
62
|
-
private readonly groups;
|
|
63
65
|
constructor(options: EtcdClusterCoordinatorOptions);
|
|
64
|
-
/**
|
|
66
|
+
/** Tries to acquire the controller lease, and returns whether it succeeded along with the current lease. */
|
|
65
67
|
tryAcquireControllerLease(input: AcquireControllerLeaseInput): Promise<AcquireControllerLeaseResult>;
|
|
66
|
-
/**
|
|
68
|
+
/** Calls `watcher` with the current controller lease when the watch starts and after each change, and returns a function that stops the watch. */
|
|
69
|
+
watchControllerLease(clusterId: string, watcher: ControllerLeaseWatcher): Promise<CoordinatorWatchDisposer>;
|
|
70
|
+
/** Extends a lease, and returns false for a lease that is expired or unknown to this coordinator. */
|
|
67
71
|
renewLease(leaseId: string, ttlMs: number): Promise<boolean>;
|
|
68
|
-
/**
|
|
72
|
+
/** Deletes a lease's key if the key still refers to that lease, then revokes the lease, and returns whether the delete succeeded. */
|
|
69
73
|
releaseLease(leaseId: string): Promise<boolean>;
|
|
70
74
|
/** Records one node as a live member of the cluster. */
|
|
71
75
|
registerNodeSession(input: RegisterNodeSessionInput): Promise<CoordinatorNodeSession>;
|
|
72
|
-
/**
|
|
76
|
+
/** Returns one node's session, or null once its lease expires. */
|
|
73
77
|
getLiveNodeSession(clusterId: string, nodeId: string): Promise<CoordinatorNodeSession | null>;
|
|
74
|
-
/**
|
|
78
|
+
/** Calls `watcher` with the IDs of every node that holds a live session, and returns a function that stops the watch. */
|
|
79
|
+
watchNodeSessions(clusterId: string, watcher: NodeSessionWatcher): Promise<CoordinatorWatchDisposer>;
|
|
80
|
+
/** Ends one node's session at once by releasing its leases. */
|
|
75
81
|
deregisterNodeSession(clusterId: string, nodeId: string): Promise<void>;
|
|
76
|
-
/** Writes the group's state, which
|
|
82
|
+
/** Writes the group's state, which creates a new group or replaces an existing one. */
|
|
77
83
|
setReplicationGroupState(input: SetReplicationGroupStateInput): Promise<ReplicationGroupState>;
|
|
78
|
-
/**
|
|
84
|
+
/** Returns the group's state, or null when etcd has no state for the group. */
|
|
79
85
|
getReplicationGroupState(clusterId: string, groupId: string): Promise<ReplicationGroupState | null>;
|
|
80
|
-
/** Calls
|
|
86
|
+
/** Calls `watcher` with the new state after each change to the group, and returns a function that stops the watch. */
|
|
81
87
|
watchReplicationGroup(clusterId: string, groupId: string, watcher: ReplicationGroupWatcher): Promise<CoordinatorWatchDisposer>;
|
|
82
|
-
/**
|
|
88
|
+
/** Makes a node primary and advances the term, but only while the group is still at the term that the caller expects. */
|
|
83
89
|
compareAndAdvancePrimaryTerm(input: CompareAndAdvancePrimaryTermInput): Promise<CompareAndAdvancePrimaryTermResult>;
|
|
84
|
-
/** Replaces the group's in-sync set, and
|
|
90
|
+
/** Replaces the group's in-sync set with a subset of it, and can advance the durability point. */
|
|
85
91
|
updateInSyncSet(input: UpdateInSyncSetInput): Promise<ReplicationGroupState | null>;
|
|
86
92
|
/** Adds one caught-up node to the in-sync set. */
|
|
87
93
|
admitNodeToInSyncSet(input: AdmitNodeToInSyncSetInput): Promise<ReplicationGroupState | null>;
|
|
88
|
-
/**
|
|
94
|
+
/** Sets or clears one node's draining, repairing, and faulted flags. */
|
|
89
95
|
updateNodeMaintenance(input: UpdateNodeMaintenanceInput): Promise<ReplicationGroupState | null>;
|
|
90
|
-
/** Promotes
|
|
96
|
+
/** Promotes an eligible in-sync replica, and throws a `NoSafePrimaryError` when no replica qualifies. */
|
|
91
97
|
promoteEligibleReplica(input: PromoteEligibleReplicaInput): Promise<ReplicationGroupState>;
|
|
92
|
-
/**
|
|
98
|
+
/** Stops every watch, revokes every lease that this coordinator granted, and closes the etcd client. */
|
|
93
99
|
close(): Promise<void>;
|
|
94
|
-
private
|
|
100
|
+
private connect;
|
|
95
101
|
}
|
|
96
102
|
/**
|
|
97
|
-
*
|
|
103
|
+
* Returns a new coordinator that stores its state in etcd.
|
|
98
104
|
*
|
|
99
|
-
* @param options - etcd endpoints, key prefix, credentials, and timeouts.
|
|
105
|
+
* @param options - The etcd endpoints, key prefix, credentials, and timeouts.
|
|
100
106
|
* @returns The coordinator, ready to pass to a replication engine.
|
|
101
107
|
*
|
|
102
108
|
* @public
|