@powerhousedao/reactor-browser 6.2.3-dev.6 → 6.2.3-dev.60
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 +176 -138
- package/dist/src/rpc/index.d.ts.map +1 -1
- package/dist/src/rpc/index.js +421 -618
- 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,110 @@ 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;
|
|
90
|
+
private broadcastRemotes;
|
|
170
91
|
private handleLiveSubscribe;
|
|
171
92
|
}
|
|
172
93
|
//#endregion
|
|
94
|
+
//#region src/rpc/local-sync-peer-handlers.d.ts
|
|
95
|
+
/** The host's adopt/remove handlers over the reactor's local peer registry. */
|
|
96
|
+
export declare function localSyncPeerHandlers(syncManager: LocalPeerSyncManager, registry: LocalChannelPortRegistry): Required<Pick<ReactorHostOptions, "onAdoptSyncPeer" | "onRemoveSyncPeer">>;
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/rpc/inspector-ops.d.ts
|
|
99
|
+
type InspectorOpTargets = {
|
|
100
|
+
inspector: IInspector & Partial<IInspectorAdmin>;
|
|
101
|
+
dbQuery?: IReactorDbQuery;
|
|
102
|
+
};
|
|
103
|
+
/** Host side of `inspector-op`; refuses tiers `access` does not grant. */
|
|
104
|
+
export declare function dispatchInspectorOp(targets: InspectorOpTargets, access: InspectorAccess, method: string, args: unknown[]): Promise<unknown>;
|
|
105
|
+
type SyncInspectionOpTargets = {
|
|
106
|
+
inspector?: ISyncInspector;
|
|
107
|
+
admin?: ISyncAdmin;
|
|
108
|
+
};
|
|
109
|
+
/** Whether `method` is one of the `sync-op` rows `dispatchSyncInspectionOp` serves. */
|
|
110
|
+
export declare function isSyncInspectionOp(method: string): boolean;
|
|
111
|
+
/** Host side of the inspection and repair rows of `sync-op`. */
|
|
112
|
+
export declare function dispatchSyncInspectionOp(targets: SyncInspectionOpTargets, access: InspectorAccess, method: string, args: unknown[]): Promise<unknown>;
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/rpc/op-channel.d.ts
|
|
115
|
+
export declare const RPC_DEFAULT_TIMEOUT_MS = 30000;
|
|
116
|
+
export declare function toVoid(promise: Promise<unknown>): Promise<void>;
|
|
117
|
+
interface IOpChannel {
|
|
118
|
+
call(method: string, args?: unknown[]): Promise<unknown>;
|
|
119
|
+
callVoid(method: string, args?: unknown[]): Promise<void>;
|
|
120
|
+
}
|
|
121
|
+
export declare function opChannel(router: MessageRouter$1, kind: OpKind$1, timeoutMs?: number): IOpChannel;
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/rpc/live-query-proxy.d.ts
|
|
124
|
+
type LiveQueryResultsCallback = (results: unknown) => void;
|
|
125
|
+
type LiveQueryErrorCallback = (error: unknown) => void;
|
|
126
|
+
interface ILiveQueryProxy {
|
|
127
|
+
query(sql: string, params: unknown[], onResults: LiveQueryResultsCallback, onError?: LiveQueryErrorCallback): () => void;
|
|
128
|
+
}
|
|
129
|
+
export declare function createLiveQueryProxy(router: MessageRouter$1): ILiveQueryProxy;
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/rpc/relational-db-proxy.d.ts
|
|
132
|
+
export declare function createRelationalPgliteProxy(router: MessageRouter$1): PGliteWithLive;
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/rpc/event-bus-proxy.d.ts
|
|
135
|
+
/** Tab-side IEventBus over bus-event; emit() is unsupported (the worker emits). */
|
|
136
|
+
export declare class ReactorEventBusProxy implements IEventBus {
|
|
137
|
+
private readonly forwardedTypes;
|
|
138
|
+
private readonly subscribers;
|
|
139
|
+
constructor(router: MessageRouter$1);
|
|
140
|
+
subscribe<K>(type: number, subscriber: (type: number, event: K) => void | Promise<void>): Unsubscribe;
|
|
141
|
+
emit(): Promise<void>;
|
|
142
|
+
}
|
|
143
|
+
export declare function createReactorEventBusProxy(router: MessageRouter$1): IEventBus;
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/rpc/forwarded-events.d.ts
|
|
146
|
+
export declare const FORWARDED_EVENT_TYPES: (10008 | 20001 | 20002 | 20003 | 20004 | 20005)[];
|
|
147
|
+
export declare const FORWARDED_BUS_EVENT_TYPES: number[];
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/rpc/connect-reactor.d.ts
|
|
150
|
+
type ReactorHello = {
|
|
151
|
+
version: VersionFingerprint$1;
|
|
152
|
+
construct?: unknown;
|
|
153
|
+
packages?: string[];
|
|
154
|
+
};
|
|
155
|
+
export declare function connectReactorClient(router: MessageRouter$1, hello: ReactorHello, onReload?: (reason: string, workerGen?: string) => void, registry?: IDocumentModelRegistry): IReactorClient;
|
|
156
|
+
export declare function postReactorIdentity(router: MessageRouter$1, user: ReactorIdentity$1 | null): void;
|
|
157
|
+
//#endregion
|
|
173
158
|
//#region src/rpc/sync-manager-proxy.d.ts
|
|
174
|
-
declare const SYNC_STATUS_CHANGED_EVENT = 90001;
|
|
159
|
+
export declare const SYNC_STATUS_CHANGED_EVENT = 90001;
|
|
175
160
|
type SyncStatusChangedBusEvent = {
|
|
176
161
|
documentId: string;
|
|
177
162
|
status: SyncStatus;
|
|
178
163
|
};
|
|
179
|
-
declare class SyncManagerProxy implements ISyncManager {
|
|
164
|
+
export declare class SyncManagerProxy implements ISyncManager, ISyncInspector, ISyncAdmin {
|
|
180
165
|
private readonly ops;
|
|
181
166
|
private readonly connectionStates;
|
|
182
167
|
private readonly connectionListeners;
|
|
183
168
|
private readonly syncStatuses;
|
|
184
169
|
private readonly syncStatusListeners;
|
|
185
170
|
private remotes;
|
|
171
|
+
private basis;
|
|
186
172
|
private seedPromise;
|
|
187
|
-
constructor(router: MessageRouter, busProxy: IEventBus);
|
|
188
|
-
|
|
173
|
+
constructor(router: MessageRouter$1, busProxy: IEventBus);
|
|
174
|
+
/** Attempts that fail while `isWaiting()` (the worker waits on a store lock) are not counted. */
|
|
175
|
+
startup({ isWaiting }?: {
|
|
176
|
+
isWaiting?: () => boolean;
|
|
177
|
+
}): Promise<void>;
|
|
189
178
|
shutdown(): ShutdownStatus;
|
|
190
179
|
getByName(name: string): Remote;
|
|
191
180
|
getById(id: string): Remote;
|
|
192
181
|
add(name: string, collectionId: DriveCollectionId, channelConfig: ChannelConfig, filter?: RemoteFilter, options?: RemoteOptions): Promise<Remote>;
|
|
182
|
+
setPeerManifest(id: string, manifest: PeerManifest | null): Promise<void>;
|
|
183
|
+
/** Fetched once; the worker's flags do not change at runtime. */
|
|
184
|
+
localManifest(): PeerManifest;
|
|
185
|
+
listHolds(filter?: {
|
|
186
|
+
remoteName?: string;
|
|
187
|
+
documentId?: string;
|
|
188
|
+
}): Promise<SyncHold[]>;
|
|
189
|
+
agreement(): IPeerAgreement;
|
|
190
|
+
private agreementBasis;
|
|
193
191
|
bindRemote(id: string, boundAddress: string): Promise<void>;
|
|
194
192
|
triggerPull(name: string): void;
|
|
195
193
|
remove(name: string): Promise<void>;
|
|
@@ -197,13 +195,21 @@ declare class SyncManagerProxy implements ISyncManager {
|
|
|
197
195
|
waitForSync(): Promise<never>;
|
|
198
196
|
getSyncStatus(documentId: string): SyncStatus | undefined;
|
|
199
197
|
onSyncStatusChange(callback: SyncStatusChangeCallback): () => void;
|
|
198
|
+
inspectRemote(remoteName: string): Promise<RemoteSyncInspection>;
|
|
199
|
+
inspectRemotes(): Promise<RemoteSyncInspection[]>;
|
|
200
|
+
listDeadLetters(remoteName: string, cursor?: string, limit?: number): Promise<DeadLetterPage>;
|
|
201
|
+
resetChannel(remoteName: string): Promise<void>;
|
|
202
|
+
requeueDeadLetter(remoteName: string, id: string): Promise<void>;
|
|
203
|
+
clearDeadLetter(remoteName: string, id: string): Promise<void>;
|
|
204
|
+
private tableOp;
|
|
200
205
|
private callSyncOp;
|
|
201
206
|
private notifyConnection;
|
|
202
207
|
private makeChannel;
|
|
203
208
|
private refreshRemotes;
|
|
209
|
+
private applyRemotes;
|
|
204
210
|
private ensureSeeded;
|
|
205
211
|
}
|
|
206
|
-
declare function createSyncManagerProxy(router: MessageRouter, busProxy: IEventBus): ISyncManager;
|
|
212
|
+
export declare function createSyncManagerProxy(router: MessageRouter$1, busProxy: IEventBus): ISyncManager;
|
|
207
213
|
//#endregion
|
|
208
214
|
//#region src/rpc/worker-package-loader.d.ts
|
|
209
215
|
type PackageImporter = (url: string) => Promise<Record<string, unknown>>;
|
|
@@ -211,33 +217,65 @@ type WorkerPackageLoaderOptions = {
|
|
|
211
217
|
cdnUrl: string;
|
|
212
218
|
importPackage: PackageImporter;
|
|
213
219
|
resolvePackages?: (documentType: string) => Promise<string[]>;
|
|
220
|
+
/** Absolute-URL import map for shared deps (worker import maps don't
|
|
221
|
+
* exist, so the source is rewritten to these URLs and blob-imported). */
|
|
222
|
+
sharedImports?: Record<string, string>;
|
|
223
|
+
/** Import a rewritten source string (blob URL). Only called when a
|
|
224
|
+
* rewrite happened; omit to disable shared-deps loading in a worker. */
|
|
225
|
+
importSource?: (source: string) => Promise<Record<string, unknown>>;
|
|
214
226
|
};
|
|
215
227
|
type PackageLoadFailure = {
|
|
216
228
|
name: string;
|
|
217
229
|
url: string;
|
|
218
230
|
error: unknown;
|
|
219
231
|
};
|
|
220
|
-
|
|
232
|
+
type AnyUpgradeManifest = UpgradeManifest<readonly number[]>;
|
|
233
|
+
export declare class WorkerPackageLoader implements IDocumentModelLoader {
|
|
221
234
|
private readonly cdnUrl;
|
|
222
235
|
private readonly importPackage;
|
|
223
236
|
private readonly resolvePackages;
|
|
237
|
+
private readonly sharedImports?;
|
|
238
|
+
private readonly importSource?;
|
|
224
239
|
private readonly modulesByKey;
|
|
240
|
+
private readonly manifestsByType;
|
|
241
|
+
private readonly keysBySource;
|
|
242
|
+
private readonly manifestTypesBySource;
|
|
225
243
|
private readonly loadedSpecs;
|
|
226
244
|
private readonly failures;
|
|
245
|
+
private readonly pendingLoads;
|
|
246
|
+
private readonly generationBySource;
|
|
247
|
+
private generation;
|
|
227
248
|
constructor(options: WorkerPackageLoaderOptions);
|
|
228
249
|
loadPackages(specs: string[]): Promise<DocumentModelModule[]>;
|
|
250
|
+
/** Loads URL-addressed packages (local project packages). Idempotent. */
|
|
251
|
+
loadSources(sources: WorkerPackageSource$1[]): Promise<void>;
|
|
252
|
+
/**
|
|
253
|
+
* Replaces previously loaded sources with freshly imported ones (a vetra
|
|
254
|
+
* watch rebuild re-sends the same source under a cache-busted URL). Returns
|
|
255
|
+
* every document type touched - removed, re-added, or new - so the caller
|
|
256
|
+
* can replace the registry's version families. A source whose import fails
|
|
257
|
+
* keeps its previous modules and is reported in `failures`; one superseded
|
|
258
|
+
* by a newer reload of the same source contributes nothing.
|
|
259
|
+
*/
|
|
260
|
+
reloadSources(sources: WorkerPackageSource$1[]): Promise<{
|
|
261
|
+
types: string[];
|
|
262
|
+
failures: PackageLoadFailure[];
|
|
263
|
+
}>;
|
|
229
264
|
load(documentType: string): Promise<DocumentModelModule>;
|
|
230
265
|
get models(): DocumentModelModule[];
|
|
266
|
+
get upgradeManifests(): AnyUpgradeManifest[];
|
|
231
267
|
get loadFailures(): PackageLoadFailure[];
|
|
232
268
|
/** The highest registered version for a type, which is what a bare load resolves to. */
|
|
233
269
|
private latestForType;
|
|
234
270
|
private notLoadedError;
|
|
235
271
|
private loadPackage;
|
|
272
|
+
private loadFromUrl;
|
|
273
|
+
private replaceSource;
|
|
274
|
+
private importNamespace;
|
|
275
|
+
/** Registers a namespace as the key's whole contribution; returns its module types. */
|
|
276
|
+
private registerNamespace;
|
|
236
277
|
}
|
|
237
278
|
//#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 };
|
|
279
|
+
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 };
|
|
280
|
+
export {};
|
|
243
281
|
//# 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":";;;;;;KAIY;EACV;EACA;;EAEA;EACA;EACA,QAAQ;;KAGE;EACV;EACA;EACA;;;wBAIc,kBACd,QAAQ,iBACR,QAAQ,qBACR,MAAM,cACL;;wBAmBa,mBACd,QAAQ,iBACR,QAAQ,uBACP;;;KCQS;EACV,SAAS;EACT,SAAS,uBAAuB,QAAQ;EACxC,oBACE,iBACA,UAAU,4BACP;EACL,sBAAsB,oBAAoB;EAC1C,cAAc,MAAM;EACpB,YAAY,gBAAgB,oBAAoB;EAChD,UAAU,gBAAgB,oBAAoB;EAC9C,iBAAiB,gBAAgB,oBAAoB;;EAErD,mBACE,QAAQ,qBACR,MAAM,gBACH;EACL,oBAAoB,QAAQ,yBAAyB;EACrD,eACE,aACA,mBACA,YAAY,8BACT;EAEL;EACA;EACA;EACA;EACA;EACA,4BAA4B;EAC5B,uBAAuB;;EAEvB,YAAY,mBAAmB;;EAE/B,0BAA0B;;;wBA0BZ,4BAA4B;qBA2B/B;qBAMA;mBACM;mBACA;mBACA;UACT;UAEA;UACA;mBACS;mBACA;UACT;UACA;UACA;EAER,YAAY,SAAS;EASrB,QAAQ,WAAW;EAkInB,YAAY,MAAM;EAKlB,kBAAkB,mBAAmB;EAOrC,gBAAgB,gBAAgB;EAQhC,gBAAgB,gBAAgB;UAalB;UAaN;UAMA;EAOR,kBAAkB,OAAO;MAOrB;MAIA;UAII;UAgDM;UAUN;UAmCM;UAUN;UAcM;UA8BA;UASA;UASA;;UAsBA;UAkCA;UAoBA;UAYA;;;;;wBCpmBA,sBACd,aAAa,sBACb,UAAU,2BACT,SAAS,KAAK;;;KCJL;EACV,WAAW,aAAa,QAAQ;EAChC,UAAU;;;wBAII,oBACd,SAAS,oBACT,QAAQ,iBACR,gBACA,kBACC;KAaS;EACV,YAAY;EACZ,QAAQ;;;wBAIM,mBAAmB;;wBAKnB,yBACd,SAAS,yBACT,QAAQ,iBACR,gBACA,kBACC;;;qBChDU;wBAEG,OAAO,SAAS,mBAAmB;UAIlC;EACf,KAAK,gBAAgB,mBAAmB;EACxC,SAAS,gBAAgB,mBAAmB;;wBAG9B,UACd,QAAQ,iBACR,MAAM,UACN,qBACC;;;KCfS,4BAA4B;KAC5B,0BAA0B;UAErB;EACf,MACE,aACA,mBACA,WAAW,0BACX,UAAU;;wBASE,qBAAqB,QAAQ,kBAAgB;;;wBClB7C,4BACd,QAAQ,kBACP;;;;qBCAU,gCAAgC;mBAC1B;mBACA;EAKjB,YAAY,QAAQ;EAMpB,UAAU,GACR,cACA,aAAa,cAAc,OAAO,aAAa,gBAC9C;EAaH,QAAQ;;wBASM,2BAA2B,QAAQ,kBAAgB;;;qBCvCtD;qBASA;;;KCJD;EACV,SAAS;EACT;EACA;;wBAGc,qBACd,QAAQ,iBACR,OAAO,cACP,YAAY,gBAAgB,6BAC5B,WAAW,yBACV;wBAaa,oBACd,QAAQ,iBACR,MAAM;;;qBCGK;KAID;EACV;EACA,QAAQ;;qBAqFG,4BACA,cAAc,gBAAgB;mBAExB;mBACA;mBAIA;mBACA;mBACA;UACT;UACA;UACA;EAER,YAAY,QAAQ,iBAAe,UAAU;;EA0BvC,UACJ;IACG;MAAmC;EAgBxC,YAAY;EAIZ,UAAU,eAAe;EAQzB,QAAQ,aAAa;EAQf,IACJ,cACA,cAAc,mBACd,eAAe,eACf,SAAS,cACT,UAAU,gBACT,QAAQ;EAYL,gBACJ,YACA,UAAU,sBACT;;EAMH,iBAAiB;EAIX,UAAU;IACd;IACA;MACE,QAAQ;EAIZ,aAAa;UAOL;EASF,WAAW,YAAY,uBAAuB;EAKpD,YAAY;EAMN,OAAO,eAAe;EAK5B,QAAQ;EAIR,eAAe;EAMf,cAAc,qBAAqB;EAInC,mBAAmB,UAAU;EAIvB,cAAc,qBAAqB,QAAQ;EAM3C,kBAAkB,QAAQ;EAI1B,gBACJ,oBACA,iBACA,iBACC,QAAQ;EAQL,aAAa,qBAAqB;EAIlC,kBAAkB,oBAAoB,aAAa;EAInD,gBAAgB,oBAAoB,aAAa;UAI/C;UAIA;UAIA;UAQA;UAgCM;UAIN;UAmBA;;wBAsBM,uBACd,QAAQ,iBACR,UAAU,YACT;;;KCnaS,mBAAmB,gBAAgB,QAAQ;KAE3C;EACV;EACA,eAAe;EACf,mBAAmB,yBAAyB;;;EAG5C,gBAAgB;;;EAGhB,gBAAgB,mBAAmB,QAAQ;;KAGjC;EACV;EACA;EACA;;KAsCG,qBAAqB;qBAgCb,+BAA+B;mBACzB;mBACA;mBACA;mBACA;mBACA;mBAKA;mBAEA;mBAEA;mBACA;mBACA;mBACA;mBACA;mBACA;UACT;EAER,YAAY,SAAS;EAYf,aAAa,kBAAkB,QAAQ;;EAQvC,YAAY,SAAS,0BAAwB;;;;;;;;;EAc7C,cACJ,SAAS,0BACR;IAAU;IAAiB,UAAU;;EAmBlC,KAAK,uBAAuB,QAAQ;MAqBtC,UAAU;MAIV,oBAAoB;MAIpB,gBAAgB;;UAKZ;UAaA;UAuBM;UAQN;UAgBM;UAoCA;;UA2BN"}
|