@powerhousedao/reactor-browser 6.2.3-dev.44 → 6.2.3-dev.45

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.
@@ -1,264 +0,0 @@
1
- //#region src/rpc/protocol.d.ts
2
- type CorrelationId = string;
3
- type ErrorInfo = {
4
- name: string;
5
- message: string;
6
- stack?: string;
7
- cause?: ErrorInfo;
8
- };
9
- type RpcRequest = {
10
- k: "req";
11
- id: CorrelationId;
12
- method: string;
13
- args: unknown[];
14
- abortAt?: number;
15
- };
16
- type RpcResponse = {
17
- k: "res";
18
- id: CorrelationId;
19
- value: unknown;
20
- };
21
- type RpcError = {
22
- k: "err";
23
- id: CorrelationId;
24
- error: ErrorInfo;
25
- };
26
- /** Failed document subscribe; routed to the change-subscription registry. */
27
- type RpcSubError = {
28
- k: "sub-err";
29
- id: CorrelationId;
30
- error: ErrorInfo;
31
- };
32
- /** Failed live query; routed to the live-query registry. */
33
- type RpcLiveError = {
34
- k: "live-err";
35
- id: CorrelationId;
36
- error: ErrorInfo;
37
- };
38
- type RpcAbort = {
39
- k: "abort";
40
- targetId: CorrelationId;
41
- };
42
- type RpcSubscribe = {
43
- k: "sub";
44
- id: CorrelationId;
45
- search: unknown;
46
- view?: unknown;
47
- };
48
- type RpcEvent = {
49
- k: "event";
50
- id: CorrelationId;
51
- change: unknown;
52
- };
53
- type RpcUnsub = {
54
- k: "unsub";
55
- id: CorrelationId;
56
- };
57
- type RpcNextPage = {
58
- k: "page";
59
- id: CorrelationId;
60
- token: string;
61
- };
62
- declare const RPC_PROTOCOL_VERSION = 2;
63
- type VersionFingerprint = {
64
- appBuildId: string;
65
- rpcProtocolVersion: number;
66
- models: {
67
- id: string;
68
- version: number;
69
- }[];
70
- featureFlags?: string;
71
- };
72
- type RpcHello = {
73
- k: "hello";
74
- id: CorrelationId;
75
- version: VersionFingerprint;
76
- construct?: unknown;
77
- packages?: string[];
78
- };
79
- type RpcRegisterPackages = {
80
- k: "register-packages";
81
- id: CorrelationId;
82
- specs: string[];
83
- };
84
- type RpcUnregisterPackages = {
85
- k: "unregister-packages";
86
- id: CorrelationId;
87
- names: string[];
88
- };
89
- type RpcReload = {
90
- k: "reload";
91
- reason: string;
92
- workerGen?: string;
93
- };
94
- type RpcAdmin = {
95
- k: "admin";
96
- id: CorrelationId;
97
- method: "info" | "restart" | "clearStorage" | "migrate";
98
- };
99
- type WorkerMigrationState = {
100
- status: "idle" | "needed" | "migrating" | "failed";
101
- legacyMajor?: number;
102
- phase?: "clone" | "dump" | "restore";
103
- error?: string;
104
- };
105
- type RpcMigration = {
106
- k: "migration";
107
- state: WorkerMigrationState;
108
- };
109
- type WorkerInspectorInfo = {
110
- namespace: string;
111
- ownerId: string;
112
- bootedAtMs: number;
113
- connectedClients: number;
114
- appBuildId: string;
115
- rpcProtocolVersion: number;
116
- /** Flags this worker is enforcing, from the fingerprint that built it. */
117
- featureFlags?: string;
118
- };
119
- type ReactorIdentity = {
120
- address: string;
121
- chainId: number;
122
- networkId: string;
123
- };
124
- type RpcIdentity = {
125
- k: "identity";
126
- user: ReactorIdentity | null;
127
- };
128
- type RpcBusEvent = {
129
- k: "bus-event";
130
- eventType: number;
131
- event: unknown;
132
- };
133
- type OpKind = "sync-op" | "db-op" | "inspector-op";
134
- type MethodCallMessage<K extends OpKind> = {
135
- k: K;
136
- id: CorrelationId;
137
- method: string;
138
- args: unknown[];
139
- };
140
- type RpcSyncOp = MethodCallMessage<"sync-op">;
141
- type RpcDbOp = MethodCallMessage<"db-op">;
142
- type RpcInspectorOp = MethodCallMessage<"inspector-op">;
143
- type RpcLiveSubscribe = {
144
- k: "sub-live";
145
- id: CorrelationId;
146
- sql: string;
147
- params: unknown[];
148
- };
149
- type RpcLiveEvent = {
150
- k: "event-live";
151
- id: CorrelationId;
152
- results: unknown;
153
- };
154
- type RpcLiveUnsub = {
155
- k: "unsub-live";
156
- id: CorrelationId;
157
- };
158
- type RpcPing = {
159
- k: "ping";
160
- id: CorrelationId;
161
- };
162
- type RpcPong = {
163
- k: "pong";
164
- id: CorrelationId;
165
- ownerId: string;
166
- bootedAtMs: number;
167
- };
168
- type ClientMessage = RpcRequest | RpcAbort | RpcSubscribe | RpcUnsub | RpcNextPage | RpcHello | RpcRegisterPackages | RpcUnregisterPackages | RpcIdentity | RpcAdmin | RpcSyncOp | RpcDbOp | RpcInspectorOp | RpcLiveSubscribe | RpcLiveUnsub | RpcPing;
169
- type OwnerMessage = RpcResponse | RpcError | RpcSubError | RpcLiveError | RpcEvent | RpcReload | RpcBusEvent | RpcLiveEvent | RpcMigration | RpcPong;
170
- type RpcMessage = ClientMessage | OwnerMessage;
171
- //#endregion
172
- //#region src/rpc/rpc-correlator.d.ts
173
- type RpcRequestOptions = {
174
- /** Reject if no response arrives within this many ms; omit for no timeout. */
175
- timeoutMs?: number;
176
- /** Maps a successful response value (e.g. paged-result rehydration). */
177
- transform?: (value: unknown) => unknown;
178
- /** Runs after the post; may return a cleanup invoked when the request settles. */
179
- setup?: (id: CorrelationId) => (() => void) | void;
180
- };
181
- /** Anything that can send a client message (the router). */
182
- type RpcPoster = {
183
- post(message: ClientMessage): void;
184
- };
185
- /**
186
- * Request/response correlation shared by every RPC proxy: one pending map,
187
- * res/err settlement, and per-request timeout/transform/cleanup.
188
- */
189
- declare class RpcCorrelator {
190
- private readonly poster;
191
- private readonly prefix;
192
- private counter;
193
- private readonly pending;
194
- constructor(poster: RpcPoster, prefix?: string);
195
- nextId(): CorrelationId;
196
- /** Settle the pending request a res/err refers to; a missing id is a no-op. */
197
- handleMessage(message: OwnerMessage): void;
198
- /** Send a request, resolving on its res/err. `build` stamps the generated id. */
199
- request(build: (id: CorrelationId) => ClientMessage, options?: RpcRequestOptions): Promise<unknown>;
200
- }
201
- //#endregion
202
- //#region src/rpc/transport.d.ts
203
- interface IRpcTransport {
204
- post(message: RpcMessage): void;
205
- onMessage(listener: (message: RpcMessage) => void): () => void;
206
- close(): void;
207
- }
208
- declare function createPortTransport(port: MessagePort): IRpcTransport;
209
- //#endregion
210
- //#region src/rpc/message-router.d.ts
211
- type OwnerKind = OwnerMessage["k"];
212
- /**
213
- * Owns the single transport.onMessage and dispatches each message to the one
214
- * consumer that owns its kind. Composes the shared RpcCorrelator (res/err) and
215
- * exposes request/nextId; attach/detach swap the transport for reconnect.
216
- */
217
- declare class MessageRouter {
218
- private readonly handlers;
219
- private readonly correlator;
220
- private transport;
221
- private detachTransport;
222
- constructor(prefix?: string);
223
- attach(transport: IRpcTransport): void;
224
- detach(): void;
225
- post(message: ClientMessage): void;
226
- /** Register the sole owner of a message kind; throws on a duplicate. */
227
- on<K extends OwnerKind>(kind: K, handler: (message: Extract<OwnerMessage, {
228
- k: K;
229
- }>) => void): () => void;
230
- request(build: (id: CorrelationId) => ClientMessage, options?: RpcRequestOptions): Promise<unknown>;
231
- nextId(): CorrelationId;
232
- }
233
- //#endregion
234
- //#region src/rpc/admin-client.d.ts
235
- interface IWorkerAdminClient {
236
- info(): Promise<WorkerInspectorInfo>;
237
- restart(): Promise<void>;
238
- clearStorage(): Promise<void>;
239
- migrate(): Promise<void>;
240
- getMigrationState(): WorkerMigrationState;
241
- subscribeMigration(callback: () => void): () => void;
242
- }
243
- /** Worker lifecycle channel (info/restart/clearStorage/migrate) over the shared router. */
244
- declare function createWorkerAdminClient(router: MessageRouter): IWorkerAdminClient;
245
- //#endregion
246
- //#region src/rpc/inspector-proxy.d.ts
247
- interface IInspectorProxy {
248
- getQueueState(): Promise<unknown>;
249
- pauseQueue(): Promise<void>;
250
- resumeQueue(): Promise<void>;
251
- getProcessors(): Promise<unknown>;
252
- retryProcessor(processorId: string): Promise<void>;
253
- getCatchUpStatus(): Promise<unknown>;
254
- sweepCatchUp(): Promise<unknown>;
255
- validateDocument(documentId: string, branch?: string): Promise<unknown>;
256
- rebuildKeyframes(documentId: string, branch?: string): Promise<unknown>;
257
- rebuildSnapshots(documentId: string, branch?: string): Promise<unknown>;
258
- queryReactorDb(sql: string, params?: unknown[]): Promise<unknown>;
259
- }
260
- declare function createInspectorProxy(router: MessageRouter): IInspectorProxy;
261
- //#endregion
262
- export { RpcMessage as C, WorkerMigrationState as E, RpcLiveUnsub as S, WorkerInspectorInfo as T, RPC_PROTOCOL_VERSION as _, MessageRouter as a, RpcLiveEvent as b, RpcCorrelator as c, ClientMessage as d, CorrelationId as f, OwnerMessage as g, OpKind as h, createWorkerAdminClient as i, RpcPoster as l, MethodCallMessage as m, createInspectorProxy as n, IRpcTransport as o, ErrorInfo as p, IWorkerAdminClient as r, createPortTransport as s, IInspectorProxy as t, RpcRequestOptions as u, ReactorIdentity as v, VersionFingerprint as w, RpcLiveSubscribe as x, RpcDbOp as y };
263
- export {};
264
- //# sourceMappingURL=inspector-proxy-DCowaeeH.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inspector-proxy-DCowaeeH.d.ts","names":[],"sources":["../src/rpc/protocol.ts","../src/rpc/rpc-correlator.ts","../src/rpc/transport.ts","../src/rpc/message-router.ts","../src/rpc/admin-client.ts","../src/rpc/inspector-proxy.ts"],"mappings":";KAAY;KAEA;EACV;EACA;EACA;EACA,QAAQ;;KAGE;EACV;EACA,IAAI;EACJ;EACA;EACA;;KAGU;EAAgB;EAAU,IAAI;EAAe;;KAE7C;EAAa;EAAU,IAAI;EAAe,OAAO;;;KAGjD;EAAgB;EAAc,IAAI;EAAe,OAAO;;;KAGxD;EACV;EACA,IAAI;EACJ,OAAO;;KAGG;EAAa;EAAY,UAAU;;KAEnC;EACV;EACA,IAAI;EACJ;EACA;;KAGU;EAAa;EAAY,IAAI;EAAe;;KAE5C;EAAa;EAAY,IAAI;;KAE7B;EAAgB;EAAW,IAAI;EAAe;;cAI7C;KAED;EACV;EACA;EACA;IAAU;IAAY;;EAGtB;;KAGU;EACV;EACA,IAAI;EACJ,SAAS;EACT;EACA;;KAGU;EACV;EACA,IAAI;EACJ;;KAGU;EACV;EACA,IAAI;EACJ;;KAKU;EAAc;EAAa;EAAgB;;KAG3C;EAC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