@powerhousedao/reactor-browser 6.2.3-dev.5 → 6.2.3-dev.51
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/{attachment-service-D3EhiAJ7.d.ts → attachment-service-DG6UkyMv.d.ts} +362 -65
- package/dist/attachment-service-DG6UkyMv.d.ts.map +1 -0
- package/dist/{client-BIHN_UyR.d.ts → client-BnGewICj.d.ts} +3 -3
- package/dist/client-BnGewICj.d.ts.map +1 -0
- package/dist/{client-D66jVnot.js → client-CXDpILj6.js} +232 -32
- package/dist/client-CXDpILj6.js.map +1 -0
- package/dist/{client-DjK30EQ-.js → client-Cq5avLW5.js} +35 -22
- package/dist/client-Cq5avLW5.js.map +1 -0
- package/dist/{document-by-id-B4FIzG1w.js → dispatch-C1VVTn5S.js} +393 -54
- package/dist/dispatch-C1VVTn5S.js.map +1 -0
- package/dist/document-by-id-BRDkvmpn.js +16 -0
- package/dist/document-by-id-BRDkvmpn.js.map +1 -0
- package/dist/{document-model-modules-bTP87nyr.js → document-model-modules-Gsh1Xr7j.js} +60 -68
- package/dist/document-model-modules-Gsh1Xr7j.js.map +1 -0
- package/dist/{document-operations-WeE6wIDt.js → document-operations-BSzcF0mu.js} +805 -167
- package/dist/document-operations-BSzcF0mu.js.map +1 -0
- package/dist/{global-OuINvEGT.d.ts → global-BuSwbbY0.d.ts} +59 -13
- package/dist/global-BuSwbbY0.d.ts.map +1 -0
- package/dist/{index-B33TKEqp.d.ts → index-ewIc3pEO.d.ts} +19 -98
- package/dist/index-ewIc3pEO.d.ts.map +1 -0
- package/dist/{index-BIVDXw3K.d.ts → index-rtDmzViP.d.ts} +3 -3
- package/dist/index-rtDmzViP.d.ts.map +1 -0
- package/dist/index.d.ts +395 -371
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +116 -47
- package/dist/index.js.map +1 -1
- package/dist/inspector-proxy-DODqs15F.d.ts +25 -0
- package/dist/inspector-proxy-DODqs15F.d.ts.map +1 -0
- package/dist/{make-ph-event-functions-DBq3iWYn.js → make-ph-event-functions-CdsvEl5t.js} +4 -2
- package/dist/{make-ph-event-functions-DBq3iWYn.js.map → make-ph-event-functions-CdsvEl5t.js.map} +1 -1
- package/dist/{pglite-CntadC_p-9NDG14dS.d.ts → pglite-CntadC_p-DTkdF8sr.d.ts} +11 -33
- package/dist/pglite-CntadC_p-DTkdF8sr.d.ts.map +1 -0
- package/dist/{relational-D1RB45sA.js → relational-DxHuX41f.js} +66 -5
- package/dist/relational-DxHuX41f.js.map +1 -0
- package/dist/{renown-rqK8sokh.js → renown-CPAeJt5L.js} +7 -8
- package/dist/{renown-rqK8sokh.js.map → renown-CPAeJt5L.js.map} +1 -1
- package/dist/{renown-BHxwP7xU.js → renown-D05wkobG.js} +2 -2
- package/dist/{renown-BHxwP7xU.js.map → renown-D05wkobG.js.map} +1 -1
- package/dist/src/ai/index.d.ts +51 -62
- package/dist/src/ai/index.d.ts.map +1 -1
- package/dist/src/ai/index.js +5 -8
- package/dist/src/ai/index.js.map +1 -1
- package/dist/src/analytics/index.d.ts +36 -44
- package/dist/src/analytics/index.d.ts.map +1 -1
- package/dist/src/analytics/index.js +2 -2
- package/dist/src/analytics/index.js.map +1 -1
- package/dist/src/document-model.d.ts +3 -4
- package/dist/src/document-model.d.ts.map +1 -1
- package/dist/src/document-model.js.map +1 -1
- package/dist/src/graphql/client.d.ts +4 -3
- package/dist/src/graphql/client.js +1 -1
- package/dist/src/graphql-client/entry.d.ts +5 -4
- package/dist/src/graphql-client/entry.js +4 -4
- package/dist/src/relational/index.d.ts +15 -9
- package/dist/src/relational/index.d.ts.map +1 -1
- package/dist/src/relational/index.js +1 -1
- package/dist/src/renown/index.d.ts +3 -2
- package/dist/src/renown/index.js +2 -2
- package/dist/src/rpc/index.d.ts +174 -138
- package/dist/src/rpc/index.d.ts.map +1 -1
- package/dist/src/rpc/index.js +398 -616
- package/dist/src/rpc/index.js.map +1 -1
- package/dist/{store-BJYcr_FL.js → store-DInXcjal.js} +1 -1
- package/dist/{store-BJYcr_FL.js.map → store-DInXcjal.js.map} +1 -1
- package/dist/{switchboard-CaXQ4-5Q.js → switchboard-3vHbIV5W.js} +58 -6
- package/dist/switchboard-3vHbIV5W.js.map +1 -0
- package/dist/{types-Dcv1ZLoW.d.ts → types-0Fh1tNjy.d.ts} +242 -17
- package/dist/types-0Fh1tNjy.d.ts.map +1 -0
- package/dist/{types-6vDzbRRS.d.ts → types-520nWrB3.d.ts} +2 -2
- package/dist/types-520nWrB3.d.ts.map +1 -0
- package/package.json +19 -20
- package/dist/attachment-service-D3EhiAJ7.d.ts.map +0 -1
- package/dist/client-BIHN_UyR.d.ts.map +0 -1
- package/dist/client-D66jVnot.js.map +0 -1
- package/dist/client-DjK30EQ-.js.map +0 -1
- package/dist/document-by-id-B4FIzG1w.js.map +0 -1
- package/dist/document-model-modules-bTP87nyr.js.map +0 -1
- package/dist/document-operations-WeE6wIDt.js.map +0 -1
- package/dist/global-OuINvEGT.d.ts.map +0 -1
- package/dist/index-B33TKEqp.d.ts.map +0 -1
- package/dist/index-BIVDXw3K.d.ts.map +0 -1
- package/dist/inspector-proxy-6h5VKAwt.d.ts +0 -257
- package/dist/inspector-proxy-6h5VKAwt.d.ts.map +0 -1
- package/dist/pglite-CntadC_p-9NDG14dS.d.ts.map +0 -1
- package/dist/relational-D1RB45sA.js.map +0 -1
- package/dist/switchboard-CaXQ4-5Q.js.map +0 -1
- package/dist/types-6vDzbRRS.d.ts.map +0 -1
- package/dist/types-Dcv1ZLoW.d.ts.map +0 -1
package/dist/src/rpc/index.d.ts
CHANGED
|
@@ -1,138 +1,40 @@
|
|
|
1
|
-
import { r as PGliteWithLive } from "../../index-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
//#region src/rpc/
|
|
7
|
-
type
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { r as PGliteWithLive } from "../../index-rtDmzViP.js";
|
|
2
|
+
import { i as createWorkerAdminClient, n as createInspectorProxy, r as IWorkerAdminClient, t as IInspectorProxy } from "../../inspector-proxy-DODqs15F.js";
|
|
3
|
+
import { ChannelConfig, DeadLetterPage, DriveCollectionId, IDocumentModelLoader, IDocumentModelRegistry, IEventBus, IInspector, IInspectorAdmin, IPeerAgreement, IReactorClient, IReactorDbQuery, ISyncAdmin, ISyncInspector, ISyncManager, InspectorAccess, LocalChannelPortRegistry, LocalPeerSyncManager, Remote, RemoteFilter, RemoteOptions, RemoteSyncInspection, ShutdownStatus, SyncHold, SyncStatus, SyncStatusChangeCallback, Unsubscribe } from "@powerhousedao/reactor";
|
|
4
|
+
import { DocumentModelModule, PeerManifest, UpgradeManifest } from "@powerhousedao/shared/document-model";
|
|
5
|
+
import { ClientMessage, CorrelationId, ErrorInfo, ICorrelatedSubscriptions, IHostResponder, IRpcTransport, IRpcTransport as IRpcTransport$1, KeyedListeners, Listeners, MessageRouter, MessageRouter as MessageRouter$1, MethodCallMessage, OpKind, OpKind as OpKind$1, OwnerMessage, RPC_PROTOCOL_VERSION, ReactorHostServer, ReactorIdentity, ReactorIdentity as ReactorIdentity$1, RpcAdoptSyncPeer, RpcCorrelator, RpcDbOp, RpcLiveEvent, RpcLiveSubscribe, RpcLiveUnsub, RpcMessage, RpcPoster, RpcRemoveSyncPeer, RpcRequestOptions, SubscriptionStore, VersionFingerprint, VersionFingerprint as VersionFingerprint$1, WorkerInspectorInfo, WorkerMigrationState, WorkerMigrationState as WorkerMigrationState$1, WorkerPackageSource, WorkerPackageSource as WorkerPackageSource$1, createCorrelatedSubscriptions, createPortTransport, createReactorClientProxy, fromErrorInfo, hostResponder, toErrorInfo } from "@powerhousedao/reactor/rpc";
|
|
6
|
+
//#region src/rpc/adopt-sync-peer.d.ts
|
|
7
|
+
type AdoptSyncPeerParams = {
|
|
8
|
+
peerId: string;
|
|
9
|
+
channelName: string;
|
|
10
|
+
/** `DriveCollectionId.key`; the class does not survive structured clone. */
|
|
11
|
+
collectionIdKey: string;
|
|
12
|
+
remoteName: string;
|
|
13
|
+
filter: RemoteFilter;
|
|
10
14
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
declare function toVoid(promise: Promise<unknown>): Promise<void>;
|
|
16
|
-
interface IOpChannel {
|
|
17
|
-
call(method: string, args?: unknown[]): Promise<unknown>;
|
|
18
|
-
callVoid(method: string, args?: unknown[]): Promise<void>;
|
|
19
|
-
}
|
|
20
|
-
declare function opChannel(router: MessageRouter, kind: OpKind, timeoutMs?: number): IOpChannel;
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/rpc/host-reply.d.ts
|
|
23
|
-
interface IHostResponder {
|
|
24
|
-
ok(id: CorrelationId, value?: unknown): void;
|
|
25
|
-
err(id: CorrelationId, error: unknown): void;
|
|
26
|
-
errForKind(message: ClientMessage, error: unknown): void;
|
|
27
|
-
run(id: CorrelationId, body: () => Promise<unknown>, mapOk?: (value: unknown) => unknown): Promise<void>;
|
|
28
|
-
}
|
|
29
|
-
declare function hostResponder(transport: IRpcTransport): IHostResponder;
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region src/rpc/listeners.d.ts
|
|
32
|
-
declare class KeyedListeners<K, A extends unknown[] = []> {
|
|
33
|
-
private readonly map;
|
|
34
|
-
add(key: K, fn: (...a: A) => void): () => void;
|
|
35
|
-
emit(key: K, ...a: A): void;
|
|
36
|
-
emitAll(...a: A): void;
|
|
37
|
-
}
|
|
38
|
-
declare class Listeners<A extends unknown[] = []> {
|
|
39
|
-
private readonly keyed;
|
|
40
|
-
add(fn: (...a: A) => void): () => void;
|
|
41
|
-
emit(...a: A): void;
|
|
42
|
-
}
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/rpc/subscription.d.ts
|
|
45
|
-
declare class SubscriptionStore {
|
|
46
|
-
private readonly map;
|
|
47
|
-
set(id: CorrelationId, unsubscribe: () => void): void;
|
|
48
|
-
get(id: CorrelationId): (() => void) | undefined;
|
|
49
|
-
delete(id: CorrelationId): void;
|
|
50
|
-
end(id: CorrelationId): void;
|
|
51
|
-
drain(): void;
|
|
52
|
-
}
|
|
53
|
-
interface ICorrelatedSubscriptions<Sub> {
|
|
54
|
-
subscribe(sub: Sub, open: (id: CorrelationId) => ClientMessage): () => void;
|
|
55
|
-
}
|
|
56
|
-
interface CorrelatedConfig<Sub, EK extends OwnerMessage["k"], ErrK extends OwnerMessage["k"]> {
|
|
57
|
-
idPrefix: string;
|
|
58
|
-
eventKind: EK;
|
|
59
|
-
errKind: ErrK;
|
|
60
|
-
onEvent: (sub: Sub, message: Extract<OwnerMessage, {
|
|
61
|
-
k: EK;
|
|
62
|
-
}>) => void;
|
|
63
|
-
onError: (sub: Sub, message: Extract<OwnerMessage, {
|
|
64
|
-
k: ErrK;
|
|
65
|
-
}>) => void;
|
|
66
|
-
close: (id: CorrelationId) => ClientMessage;
|
|
67
|
-
}
|
|
68
|
-
declare function createCorrelatedSubscriptions<Sub, EK extends OwnerMessage["k"], ErrK extends OwnerMessage["k"]>(router: MessageRouter, config: CorrelatedConfig<Sub, EK, ErrK>): ICorrelatedSubscriptions<Sub>;
|
|
69
|
-
//#endregion
|
|
70
|
-
//#region src/rpc/live-query-proxy.d.ts
|
|
71
|
-
type LiveQueryResultsCallback = (results: unknown) => void;
|
|
72
|
-
type LiveQueryErrorCallback = (error: unknown) => void;
|
|
73
|
-
interface ILiveQueryProxy {
|
|
74
|
-
query(sql: string, params: unknown[], onResults: LiveQueryResultsCallback, onError?: LiveQueryErrorCallback): () => void;
|
|
75
|
-
}
|
|
76
|
-
declare function createLiveQueryProxy(router: MessageRouter): ILiveQueryProxy;
|
|
77
|
-
//#endregion
|
|
78
|
-
//#region src/rpc/relational-db-proxy.d.ts
|
|
79
|
-
declare function createRelationalPgliteProxy(router: MessageRouter): PGliteWithLive;
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region src/rpc/event-bus-proxy.d.ts
|
|
82
|
-
/** Tab-side IEventBus over bus-event; emit() is unsupported (the worker emits). */
|
|
83
|
-
declare class ReactorEventBusProxy implements IEventBus {
|
|
84
|
-
private readonly forwardedTypes;
|
|
85
|
-
private readonly subscribers;
|
|
86
|
-
constructor(router: MessageRouter);
|
|
87
|
-
subscribe<K>(type: number, subscriber: (type: number, event: K) => void | Promise<void>): Unsubscribe;
|
|
88
|
-
emit(): Promise<void>;
|
|
89
|
-
}
|
|
90
|
-
declare function createReactorEventBusProxy(router: MessageRouter): IEventBus;
|
|
91
|
-
//#endregion
|
|
92
|
-
//#region src/rpc/forwarded-events.d.ts
|
|
93
|
-
declare const FORWARDED_EVENT_TYPES: (20001 | 20002 | 20003 | 20004 | 20005 | 10008)[];
|
|
94
|
-
declare const FORWARDED_BUS_EVENT_TYPES: number[];
|
|
95
|
-
//#endregion
|
|
96
|
-
//#region src/rpc/connect-reactor.d.ts
|
|
97
|
-
type ReactorHello = {
|
|
98
|
-
version: VersionFingerprint;
|
|
99
|
-
construct?: unknown;
|
|
100
|
-
packages?: string[];
|
|
15
|
+
type RemoveSyncPeerParams = {
|
|
16
|
+
peerId: string;
|
|
17
|
+
channelName: string;
|
|
18
|
+
remoteName: string;
|
|
101
19
|
};
|
|
102
|
-
|
|
103
|
-
declare function
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
declare class ReactorHostServer {
|
|
107
|
-
private readonly client;
|
|
108
|
-
private readonly transport;
|
|
109
|
-
private readonly reply;
|
|
110
|
-
private readonly aborters;
|
|
111
|
-
private readonly subscriptions;
|
|
112
|
-
private readonly pages;
|
|
113
|
-
private pageCounter;
|
|
114
|
-
private detach;
|
|
115
|
-
constructor(client: IReactorClient, transport: IRpcTransport);
|
|
116
|
-
start(): void;
|
|
117
|
-
stop(): void;
|
|
118
|
-
handleMessage(message: ClientMessage): Promise<void>;
|
|
119
|
-
private handleRequest;
|
|
120
|
-
private handlePage;
|
|
121
|
-
private handleSubscribe;
|
|
122
|
-
private prepareResult;
|
|
123
|
-
private resolveMethod;
|
|
124
|
-
}
|
|
20
|
+
/** Moves `port` to the host, which adopts the peer as a local remote over it. */
|
|
21
|
+
export declare function sendAdoptSyncPeer(router: MessageRouter$1, params: AdoptSyncPeerParams, port: MessagePort): Promise<void>;
|
|
22
|
+
/** Removes the peer's remote and closes its port in the host's registry. */
|
|
23
|
+
export declare function sendRemoveSyncPeer(router: MessageRouter$1, params: RemoveSyncPeerParams): Promise<void>;
|
|
125
24
|
//#endregion
|
|
126
25
|
//#region src/rpc/reactor-host.d.ts
|
|
127
26
|
type ReactorHostOptions = {
|
|
128
27
|
client?: IReactorClient;
|
|
129
28
|
build?: (construct: unknown) => Promise<IReactorClient>;
|
|
130
|
-
registerPackages?: (specs: string[]) => Promise<void>;
|
|
29
|
+
registerPackages?: (specs: string[], sources?: WorkerPackageSource$1[]) => Promise<void>;
|
|
131
30
|
unregisterPackages?: (names: string[]) => Promise<void>;
|
|
132
|
-
onIdentity?: (user: ReactorIdentity | null) => void;
|
|
31
|
+
onIdentity?: (user: ReactorIdentity$1 | null) => void;
|
|
133
32
|
onSyncOp?: (method: string, args: unknown[]) => Promise<unknown>;
|
|
134
33
|
onDbOp?: (method: string, args: unknown[]) => Promise<unknown>;
|
|
135
34
|
onInspectorOp?: (method: string, args: unknown[]) => Promise<unknown>;
|
|
35
|
+
/** See `localSyncPeerHandlers`, which builds both over the reactor's registry. */
|
|
36
|
+
onAdoptSyncPeer?: (params: AdoptSyncPeerParams, port: MessagePort) => Promise<void>;
|
|
37
|
+
onRemoveSyncPeer?: (params: RemoveSyncPeerParams) => Promise<void>;
|
|
136
38
|
onLiveQuery?: (sql: string, params: unknown[], onResults: (results: unknown) => void) => Promise<() => void>;
|
|
137
39
|
namespace?: string;
|
|
138
40
|
appBuildId?: string;
|
|
@@ -141,22 +43,37 @@ type ReactorHostOptions = {
|
|
|
141
43
|
onAdminRestart?: () => void;
|
|
142
44
|
onAdminClearStorage?: () => Promise<void>;
|
|
143
45
|
onAdminMigrate?: () => Promise<void>;
|
|
46
|
+
/** Stops the reactor and releases its stores once the worker is retired. */
|
|
47
|
+
onRetire?: (reason: string) => Promise<void>;
|
|
48
|
+
/** Bounded; a deploy's reload waits on it while data is already refused. */
|
|
49
|
+
drainBeforeReload?: () => Promise<void>;
|
|
144
50
|
};
|
|
145
|
-
|
|
51
|
+
/** Whether a reload reason comes from a build fingerprint mismatch. */
|
|
52
|
+
export declare function isFingerprintMismatchReload(reason: string): boolean;
|
|
53
|
+
export declare const RETIRED_WORKER_RELOAD_REASON = "worker retired";
|
|
54
|
+
export declare class ReactorHost {
|
|
146
55
|
private readonly options;
|
|
147
56
|
private readonly disposers;
|
|
148
57
|
private readonly clients;
|
|
149
58
|
private clientPromise;
|
|
59
|
+
private buildFailure;
|
|
150
60
|
private baseline;
|
|
151
61
|
private readonly ownerId;
|
|
152
62
|
private readonly bootedAtMs;
|
|
153
63
|
private migrationState;
|
|
64
|
+
private retirement;
|
|
65
|
+
private reloadSent;
|
|
154
66
|
constructor(options: ReactorHostOptions);
|
|
155
|
-
connect(transport: IRpcTransport): () => void;
|
|
67
|
+
connect(transport: IRpcTransport$1): () => void;
|
|
156
68
|
connectPort(port: MessagePort): () => void;
|
|
157
69
|
broadcastBusEvent(eventType: number, event: unknown): void;
|
|
158
70
|
broadcastReload(reason: string, workerGen?: string): void;
|
|
159
|
-
|
|
71
|
+
retireAndReload(reason: string, workerGen: string): void;
|
|
72
|
+
private drainThenReload;
|
|
73
|
+
private sendReload;
|
|
74
|
+
private stopRetired;
|
|
75
|
+
setMigrationState(state: WorkerMigrationState$1): void;
|
|
76
|
+
get retired(): boolean;
|
|
160
77
|
get connectionCount(): number;
|
|
161
78
|
private handleAdmin;
|
|
162
79
|
private handleAdminAsync;
|
|
@@ -167,29 +84,109 @@ declare class ReactorHost {
|
|
|
167
84
|
private handleRegister;
|
|
168
85
|
private handleUnregister;
|
|
169
86
|
private handleOp;
|
|
87
|
+
/** Closes the moved port on every failure; the sender can no longer close it. */
|
|
88
|
+
private handleAdoptSyncPeer;
|
|
89
|
+
private handleRemoveSyncPeer;
|
|
170
90
|
private handleLiveSubscribe;
|
|
171
91
|
}
|
|
172
92
|
//#endregion
|
|
93
|
+
//#region src/rpc/local-sync-peer-handlers.d.ts
|
|
94
|
+
/** The host's adopt/remove handlers over the reactor's local peer registry. */
|
|
95
|
+
export declare function localSyncPeerHandlers(syncManager: LocalPeerSyncManager, registry: LocalChannelPortRegistry): Required<Pick<ReactorHostOptions, "onAdoptSyncPeer" | "onRemoveSyncPeer">>;
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/rpc/inspector-ops.d.ts
|
|
98
|
+
type InspectorOpTargets = {
|
|
99
|
+
inspector: IInspector & Partial<IInspectorAdmin>;
|
|
100
|
+
dbQuery?: IReactorDbQuery;
|
|
101
|
+
};
|
|
102
|
+
/** Host side of `inspector-op`; refuses tiers `access` does not grant. */
|
|
103
|
+
export declare function dispatchInspectorOp(targets: InspectorOpTargets, access: InspectorAccess, method: string, args: unknown[]): Promise<unknown>;
|
|
104
|
+
type SyncInspectionOpTargets = {
|
|
105
|
+
inspector?: ISyncInspector;
|
|
106
|
+
admin?: ISyncAdmin;
|
|
107
|
+
};
|
|
108
|
+
/** Whether `method` is one of the `sync-op` rows `dispatchSyncInspectionOp` serves. */
|
|
109
|
+
export declare function isSyncInspectionOp(method: string): boolean;
|
|
110
|
+
/** Host side of the inspection and repair rows of `sync-op`. */
|
|
111
|
+
export declare function dispatchSyncInspectionOp(targets: SyncInspectionOpTargets, access: InspectorAccess, method: string, args: unknown[]): Promise<unknown>;
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/rpc/op-channel.d.ts
|
|
114
|
+
export declare const RPC_DEFAULT_TIMEOUT_MS = 30000;
|
|
115
|
+
export declare function toVoid(promise: Promise<unknown>): Promise<void>;
|
|
116
|
+
interface IOpChannel {
|
|
117
|
+
call(method: string, args?: unknown[]): Promise<unknown>;
|
|
118
|
+
callVoid(method: string, args?: unknown[]): Promise<void>;
|
|
119
|
+
}
|
|
120
|
+
export declare function opChannel(router: MessageRouter$1, kind: OpKind$1, timeoutMs?: number): IOpChannel;
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/rpc/live-query-proxy.d.ts
|
|
123
|
+
type LiveQueryResultsCallback = (results: unknown) => void;
|
|
124
|
+
type LiveQueryErrorCallback = (error: unknown) => void;
|
|
125
|
+
interface ILiveQueryProxy {
|
|
126
|
+
query(sql: string, params: unknown[], onResults: LiveQueryResultsCallback, onError?: LiveQueryErrorCallback): () => void;
|
|
127
|
+
}
|
|
128
|
+
export declare function createLiveQueryProxy(router: MessageRouter$1): ILiveQueryProxy;
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/rpc/relational-db-proxy.d.ts
|
|
131
|
+
export declare function createRelationalPgliteProxy(router: MessageRouter$1): PGliteWithLive;
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/rpc/event-bus-proxy.d.ts
|
|
134
|
+
/** Tab-side IEventBus over bus-event; emit() is unsupported (the worker emits). */
|
|
135
|
+
export declare class ReactorEventBusProxy implements IEventBus {
|
|
136
|
+
private readonly forwardedTypes;
|
|
137
|
+
private readonly subscribers;
|
|
138
|
+
constructor(router: MessageRouter$1);
|
|
139
|
+
subscribe<K>(type: number, subscriber: (type: number, event: K) => void | Promise<void>): Unsubscribe;
|
|
140
|
+
emit(): Promise<void>;
|
|
141
|
+
}
|
|
142
|
+
export declare function createReactorEventBusProxy(router: MessageRouter$1): IEventBus;
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/rpc/forwarded-events.d.ts
|
|
145
|
+
export declare const FORWARDED_EVENT_TYPES: (10008 | 20001 | 20002 | 20003 | 20004 | 20005)[];
|
|
146
|
+
export declare const FORWARDED_BUS_EVENT_TYPES: number[];
|
|
147
|
+
//#endregion
|
|
148
|
+
//#region src/rpc/connect-reactor.d.ts
|
|
149
|
+
type ReactorHello = {
|
|
150
|
+
version: VersionFingerprint$1;
|
|
151
|
+
construct?: unknown;
|
|
152
|
+
packages?: string[];
|
|
153
|
+
};
|
|
154
|
+
export declare function connectReactorClient(router: MessageRouter$1, hello: ReactorHello, onReload?: (reason: string, workerGen?: string) => void, registry?: IDocumentModelRegistry): IReactorClient;
|
|
155
|
+
export declare function postReactorIdentity(router: MessageRouter$1, user: ReactorIdentity$1 | null): void;
|
|
156
|
+
//#endregion
|
|
173
157
|
//#region src/rpc/sync-manager-proxy.d.ts
|
|
174
|
-
declare const SYNC_STATUS_CHANGED_EVENT = 90001;
|
|
158
|
+
export declare const SYNC_STATUS_CHANGED_EVENT = 90001;
|
|
175
159
|
type SyncStatusChangedBusEvent = {
|
|
176
160
|
documentId: string;
|
|
177
161
|
status: SyncStatus;
|
|
178
162
|
};
|
|
179
|
-
declare class SyncManagerProxy implements ISyncManager {
|
|
163
|
+
export declare class SyncManagerProxy implements ISyncManager, ISyncInspector, ISyncAdmin {
|
|
180
164
|
private readonly ops;
|
|
181
165
|
private readonly connectionStates;
|
|
182
166
|
private readonly connectionListeners;
|
|
183
167
|
private readonly syncStatuses;
|
|
184
168
|
private readonly syncStatusListeners;
|
|
185
169
|
private remotes;
|
|
170
|
+
private basis;
|
|
186
171
|
private seedPromise;
|
|
187
|
-
constructor(router: MessageRouter, busProxy: IEventBus);
|
|
188
|
-
|
|
172
|
+
constructor(router: MessageRouter$1, busProxy: IEventBus);
|
|
173
|
+
/** Attempts that fail while `isWaiting()` (the worker waits on a store lock) are not counted. */
|
|
174
|
+
startup({ isWaiting }?: {
|
|
175
|
+
isWaiting?: () => boolean;
|
|
176
|
+
}): Promise<void>;
|
|
189
177
|
shutdown(): ShutdownStatus;
|
|
190
178
|
getByName(name: string): Remote;
|
|
191
179
|
getById(id: string): Remote;
|
|
192
180
|
add(name: string, collectionId: DriveCollectionId, channelConfig: ChannelConfig, filter?: RemoteFilter, options?: RemoteOptions): Promise<Remote>;
|
|
181
|
+
setPeerManifest(id: string, manifest: PeerManifest | null): Promise<void>;
|
|
182
|
+
/** Fetched once; the worker's flags do not change at runtime. */
|
|
183
|
+
localManifest(): PeerManifest;
|
|
184
|
+
listHolds(filter?: {
|
|
185
|
+
remoteName?: string;
|
|
186
|
+
documentId?: string;
|
|
187
|
+
}): Promise<SyncHold[]>;
|
|
188
|
+
agreement(): IPeerAgreement;
|
|
189
|
+
private agreementBasis;
|
|
193
190
|
bindRemote(id: string, boundAddress: string): Promise<void>;
|
|
194
191
|
triggerPull(name: string): void;
|
|
195
192
|
remove(name: string): Promise<void>;
|
|
@@ -197,13 +194,20 @@ declare class SyncManagerProxy implements ISyncManager {
|
|
|
197
194
|
waitForSync(): Promise<never>;
|
|
198
195
|
getSyncStatus(documentId: string): SyncStatus | undefined;
|
|
199
196
|
onSyncStatusChange(callback: SyncStatusChangeCallback): () => void;
|
|
197
|
+
inspectRemote(remoteName: string): Promise<RemoteSyncInspection>;
|
|
198
|
+
inspectRemotes(): Promise<RemoteSyncInspection[]>;
|
|
199
|
+
listDeadLetters(remoteName: string, cursor?: string, limit?: number): Promise<DeadLetterPage>;
|
|
200
|
+
resetChannel(remoteName: string): Promise<void>;
|
|
201
|
+
requeueDeadLetter(remoteName: string, id: string): Promise<void>;
|
|
202
|
+
clearDeadLetter(remoteName: string, id: string): Promise<void>;
|
|
203
|
+
private tableOp;
|
|
200
204
|
private callSyncOp;
|
|
201
205
|
private notifyConnection;
|
|
202
206
|
private makeChannel;
|
|
203
207
|
private refreshRemotes;
|
|
204
208
|
private ensureSeeded;
|
|
205
209
|
}
|
|
206
|
-
declare function createSyncManagerProxy(router: MessageRouter, busProxy: IEventBus): ISyncManager;
|
|
210
|
+
export declare function createSyncManagerProxy(router: MessageRouter$1, busProxy: IEventBus): ISyncManager;
|
|
207
211
|
//#endregion
|
|
208
212
|
//#region src/rpc/worker-package-loader.d.ts
|
|
209
213
|
type PackageImporter = (url: string) => Promise<Record<string, unknown>>;
|
|
@@ -211,33 +215,65 @@ type WorkerPackageLoaderOptions = {
|
|
|
211
215
|
cdnUrl: string;
|
|
212
216
|
importPackage: PackageImporter;
|
|
213
217
|
resolvePackages?: (documentType: string) => Promise<string[]>;
|
|
218
|
+
/** Absolute-URL import map for shared deps (worker import maps don't
|
|
219
|
+
* exist, so the source is rewritten to these URLs and blob-imported). */
|
|
220
|
+
sharedImports?: Record<string, string>;
|
|
221
|
+
/** Import a rewritten source string (blob URL). Only called when a
|
|
222
|
+
* rewrite happened; omit to disable shared-deps loading in a worker. */
|
|
223
|
+
importSource?: (source: string) => Promise<Record<string, unknown>>;
|
|
214
224
|
};
|
|
215
225
|
type PackageLoadFailure = {
|
|
216
226
|
name: string;
|
|
217
227
|
url: string;
|
|
218
228
|
error: unknown;
|
|
219
229
|
};
|
|
220
|
-
|
|
230
|
+
type AnyUpgradeManifest = UpgradeManifest<readonly number[]>;
|
|
231
|
+
export declare class WorkerPackageLoader implements IDocumentModelLoader {
|
|
221
232
|
private readonly cdnUrl;
|
|
222
233
|
private readonly importPackage;
|
|
223
234
|
private readonly resolvePackages;
|
|
235
|
+
private readonly sharedImports?;
|
|
236
|
+
private readonly importSource?;
|
|
224
237
|
private readonly modulesByKey;
|
|
238
|
+
private readonly manifestsByType;
|
|
239
|
+
private readonly keysBySource;
|
|
240
|
+
private readonly manifestTypesBySource;
|
|
225
241
|
private readonly loadedSpecs;
|
|
226
242
|
private readonly failures;
|
|
243
|
+
private readonly pendingLoads;
|
|
244
|
+
private readonly generationBySource;
|
|
245
|
+
private generation;
|
|
227
246
|
constructor(options: WorkerPackageLoaderOptions);
|
|
228
247
|
loadPackages(specs: string[]): Promise<DocumentModelModule[]>;
|
|
248
|
+
/** Loads URL-addressed packages (local project packages). Idempotent. */
|
|
249
|
+
loadSources(sources: WorkerPackageSource$1[]): Promise<void>;
|
|
250
|
+
/**
|
|
251
|
+
* Replaces previously loaded sources with freshly imported ones (a vetra
|
|
252
|
+
* watch rebuild re-sends the same source under a cache-busted URL). Returns
|
|
253
|
+
* every document type touched - removed, re-added, or new - so the caller
|
|
254
|
+
* can replace the registry's version families. A source whose import fails
|
|
255
|
+
* keeps its previous modules and is reported in `failures`; one superseded
|
|
256
|
+
* by a newer reload of the same source contributes nothing.
|
|
257
|
+
*/
|
|
258
|
+
reloadSources(sources: WorkerPackageSource$1[]): Promise<{
|
|
259
|
+
types: string[];
|
|
260
|
+
failures: PackageLoadFailure[];
|
|
261
|
+
}>;
|
|
229
262
|
load(documentType: string): Promise<DocumentModelModule>;
|
|
230
263
|
get models(): DocumentModelModule[];
|
|
264
|
+
get upgradeManifests(): AnyUpgradeManifest[];
|
|
231
265
|
get loadFailures(): PackageLoadFailure[];
|
|
232
266
|
/** The highest registered version for a type, which is what a bare load resolves to. */
|
|
233
267
|
private latestForType;
|
|
234
268
|
private notLoadedError;
|
|
235
269
|
private loadPackage;
|
|
270
|
+
private loadFromUrl;
|
|
271
|
+
private replaceSource;
|
|
272
|
+
private importNamespace;
|
|
273
|
+
/** Registers a namespace as the key's whole contribution; returns its module types. */
|
|
274
|
+
private registerNamespace;
|
|
236
275
|
}
|
|
237
276
|
//#endregion
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
declare function fromErrorInfo(info: ErrorInfo): Error;
|
|
241
|
-
//#endregion
|
|
242
|
-
export { type ClientMessage, type CorrelationId, type ErrorInfo, FORWARDED_BUS_EVENT_TYPES, FORWARDED_EVENT_TYPES, type ICorrelatedSubscriptions, type IHostResponder, type IInspectorProxy, type ILiveQueryProxy, type IOpChannel, type IRpcTransport, type IWorkerAdminClient, KeyedListeners, Listeners, MessageRouter, type MethodCallMessage, type OpKind, type OwnerMessage, type PackageImporter, RPC_DEFAULT_TIMEOUT_MS, RPC_PROTOCOL_VERSION, ReactorEventBusProxy, type ReactorHello, ReactorHost, ReactorHostServer, type ReactorIdentity, RpcCorrelator, type RpcDbOp, type RpcLiveEvent, type RpcLiveSubscribe, type RpcLiveUnsub, type RpcMessage, type RpcPoster, type RpcRequestOptions, SYNC_STATUS_CHANGED_EVENT, SubscriptionStore, SyncManagerProxy, type SyncStatusChangedBusEvent, type VersionFingerprint, type WorkerInspectorInfo, type WorkerMigrationState, WorkerPackageLoader, type WorkerPackageLoaderOptions, connectReactorClient, createCorrelatedSubscriptions, createInspectorProxy, createLiveQueryProxy, createPortTransport, createReactorClientProxy, createReactorEventBusProxy, createRelationalPgliteProxy, createSyncManagerProxy, createWorkerAdminClient, fromErrorInfo, hostResponder, opChannel, postReactorIdentity, toErrorInfo, toVoid };
|
|
277
|
+
export { type AdoptSyncPeerParams, type ClientMessage, type CorrelationId, type ErrorInfo, type ICorrelatedSubscriptions, type IHostResponder, type IInspectorProxy, type ILiveQueryProxy, type IOpChannel, type IRpcTransport, type IWorkerAdminClient, type InspectorOpTargets, KeyedListeners, Listeners, MessageRouter, type MethodCallMessage, type OpKind, type OwnerMessage, type PackageImporter, type PackageLoadFailure, RPC_PROTOCOL_VERSION, type ReactorHello, ReactorHostServer, type ReactorIdentity, type RemoveSyncPeerParams, type RpcAdoptSyncPeer, RpcCorrelator, type RpcDbOp, type RpcLiveEvent, type RpcLiveSubscribe, type RpcLiveUnsub, type RpcMessage, type RpcPoster, type RpcRemoveSyncPeer, type RpcRequestOptions, SubscriptionStore, type SyncInspectionOpTargets, type SyncStatusChangedBusEvent, type VersionFingerprint, type WorkerInspectorInfo, type WorkerMigrationState, type WorkerPackageLoaderOptions, type WorkerPackageSource, createCorrelatedSubscriptions, createInspectorProxy, createPortTransport, createReactorClientProxy, createWorkerAdminClient, fromErrorInfo, hostResponder, toErrorInfo };
|
|
278
|
+
export {};
|
|
243
279
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/rpc/
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/rpc/adopt-sync-peer.ts","../../../src/rpc/reactor-host.ts","../../../src/rpc/local-sync-peer-handlers.ts","../../../src/rpc/inspector-ops.ts","../../../src/rpc/op-channel.ts","../../../src/rpc/live-query-proxy.ts","../../../src/rpc/relational-db-proxy.ts","../../../src/rpc/event-bus-proxy.ts","../../../src/rpc/forwarded-events.ts","../../../src/rpc/connect-reactor.ts","../../../src/rpc/sync-manager-proxy.ts","../../../src/rpc/worker-package-loader.ts"],"mappings":"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"}
|