@powerhousedao/reactor-browser 6.2.3-dev.8 → 6.2.3-staging.0
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-But1Xljo.d.ts} +169 -59
- package/dist/attachment-service-But1Xljo.d.ts.map +1 -0
- package/dist/{client-DjK30EQ-.js → client-BiJAJ9dW.js} +1 -1
- package/dist/{client-DjK30EQ-.js.map → client-BiJAJ9dW.js.map} +1 -1
- package/dist/{client-BIHN_UyR.d.ts → client-CngU4mtn.d.ts} +3 -3
- package/dist/client-CngU4mtn.d.ts.map +1 -0
- package/dist/{client-D66jVnot.js → client-VV9M73s_.js} +126 -18
- package/dist/client-VV9M73s_.js.map +1 -0
- package/dist/{document-by-id-B4FIzG1w.js → dispatch-qRXS70fh.js} +389 -54
- package/dist/dispatch-qRXS70fh.js.map +1 -0
- package/dist/document-by-id-B_8DA4yZ.js +16 -0
- package/dist/document-by-id-B_8DA4yZ.js.map +1 -0
- package/dist/{document-model-modules-bTP87nyr.js → document-model-modules-D6I-UUXq.js} +32 -65
- package/dist/document-model-modules-D6I-UUXq.js.map +1 -0
- package/dist/{document-operations-WeE6wIDt.js → document-operations-Bt-1-ThH.js} +147 -120
- package/dist/document-operations-Bt-1-ThH.js.map +1 -0
- package/dist/{global-OuINvEGT.d.ts → global-fql2bmb0.d.ts} +50 -13
- package/dist/global-fql2bmb0.d.ts.map +1 -0
- package/dist/{index-B33TKEqp.d.ts → index-BABMK8cO.d.ts} +19 -98
- package/dist/index-BABMK8cO.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 +379 -364
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +111 -39
- package/dist/index.js.map +1 -1
- package/dist/{inspector-proxy-6h5VKAwt.d.ts → inspector-proxy-DCowaeeH.d.ts} +11 -4
- package/dist/inspector-proxy-DCowaeeH.d.ts.map +1 -0
- package/dist/{make-ph-event-functions-DBq3iWYn.js → make-ph-event-functions-FzpvQtj6.js} +1 -1
- package/dist/{make-ph-event-functions-DBq3iWYn.js.map → make-ph-event-functions-FzpvQtj6.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-ChC_AWAK.js} +3 -2
- package/dist/{relational-D1RB45sA.js.map → relational-ChC_AWAK.js.map} +1 -1
- package/dist/{renown-rqK8sokh.js → renown-C9pYZRqf.js} +7 -8
- package/dist/{renown-rqK8sokh.js.map → renown-C9pYZRqf.js.map} +1 -1
- package/dist/{renown-BHxwP7xU.js → renown-Def5iO8k.js} +2 -2
- package/dist/{renown-BHxwP7xU.js.map → renown-Def5iO8k.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 +8 -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 +52 -32
- package/dist/src/rpc/index.d.ts.map +1 -1
- package/dist/src/rpc/index.js +58 -9
- 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-CFyD_5_e.js} +58 -6
- package/dist/switchboard-CFyD_5_e.js.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/dist/{types-Dcv1ZLoW.d.ts → types-B7-_l_wE.d.ts} +86 -16
- package/dist/types-B7-_l_wE.d.ts.map +1 -0
- package/package.json +15 -16
- 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/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.map +0 -1
- package/dist/pglite-CntadC_p-9NDG14dS.d.ts.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.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { t as RegistryClient } from "../../client-
|
|
1
|
+
import { t as RegistryClient } from "../../client-BiJAJ9dW.js";
|
|
2
|
+
import { DriveCollectionId, ReactorEventTypes, SyncEventTypes, createPeerAgreement } from "@powerhousedao/reactor";
|
|
2
3
|
import { normalizeDocumentModelVersion } from "@powerhousedao/shared/document-model";
|
|
3
|
-
import {
|
|
4
|
+
import { rewritePackageSource } from "@powerhousedao/shared/connect";
|
|
4
5
|
//#region src/rpc/listeners.ts
|
|
5
6
|
var KeyedListeners = class {
|
|
6
7
|
map = /* @__PURE__ */ new Map();
|
|
@@ -80,7 +81,7 @@ function createWorkerAdminClient(router) {
|
|
|
80
81
|
}
|
|
81
82
|
//#endregion
|
|
82
83
|
//#region src/rpc/error-info.ts
|
|
83
|
-
const MAX_STACK_LENGTH =
|
|
84
|
+
const MAX_STACK_LENGTH = 8192;
|
|
84
85
|
const MAX_CAUSE_DEPTH = 8;
|
|
85
86
|
function toErrorInfo(err, depth = 0) {
|
|
86
87
|
if (depth > MAX_CAUSE_DEPTH) return {
|
|
@@ -318,6 +319,8 @@ function createInspectorProxy(router) {
|
|
|
318
319
|
resumeQueue: () => ops.callVoid("queue.resume"),
|
|
319
320
|
getProcessors: () => ops.call("processors.getAll"),
|
|
320
321
|
retryProcessor: (processorId) => ops.callVoid("processors.retry", [processorId]),
|
|
322
|
+
getCatchUpStatus: () => ops.call("catchUp.status"),
|
|
323
|
+
sweepCatchUp: () => ops.call("catchUp.sweepNow"),
|
|
321
324
|
validateDocument: (documentId, branch) => ops.call("integrity.validate", [documentId, branch]),
|
|
322
325
|
rebuildKeyframes: (documentId, branch) => ops.call("integrity.rebuildKeyframes", [documentId, branch]),
|
|
323
326
|
rebuildSnapshots: (documentId, branch) => ops.call("integrity.rebuildSnapshots", [documentId, branch]),
|
|
@@ -470,7 +473,8 @@ function rehydrateMeta(wire) {
|
|
|
470
473
|
collectionId: DriveCollectionId.forDrive(wire.collectionId.driveId, wire.collectionId.branch),
|
|
471
474
|
channelConfig: wire.channelConfig,
|
|
472
475
|
filter: wire.filter,
|
|
473
|
-
options: wire.options
|
|
476
|
+
options: wire.options,
|
|
477
|
+
peer: wire.peer
|
|
474
478
|
};
|
|
475
479
|
}
|
|
476
480
|
function channelUrl(meta) {
|
|
@@ -484,6 +488,7 @@ var SyncManagerProxy = class {
|
|
|
484
488
|
syncStatuses = /* @__PURE__ */ new Map();
|
|
485
489
|
syncStatusListeners = new Listeners();
|
|
486
490
|
remotes = [];
|
|
491
|
+
basis;
|
|
487
492
|
seedPromise = null;
|
|
488
493
|
constructor(router, busProxy) {
|
|
489
494
|
this.ops = opChannel(router, "sync-op");
|
|
@@ -506,7 +511,7 @@ var SyncManagerProxy = class {
|
|
|
506
511
|
return;
|
|
507
512
|
} catch (error) {
|
|
508
513
|
lastError = error;
|
|
509
|
-
if (attempt <
|
|
514
|
+
if (attempt < 2) await new Promise((resolve) => setTimeout(resolve, SEED_RETRY_DELAY_MS));
|
|
510
515
|
}
|
|
511
516
|
throw lastError;
|
|
512
517
|
}
|
|
@@ -537,6 +542,24 @@ var SyncManagerProxy = class {
|
|
|
537
542
|
await this.refreshRemotes();
|
|
538
543
|
return this.getByName(name);
|
|
539
544
|
}
|
|
545
|
+
async setPeerManifest(id, manifest) {
|
|
546
|
+
await this.callSyncOp("setPeerManifest", [id, manifest]);
|
|
547
|
+
await this.refreshRemotes();
|
|
548
|
+
}
|
|
549
|
+
/** Fetched once; the worker's flags do not change at runtime. */
|
|
550
|
+
localManifest() {
|
|
551
|
+
return this.agreementBasis().local;
|
|
552
|
+
}
|
|
553
|
+
async listHolds(filter) {
|
|
554
|
+
return await this.callSyncOp("listHolds", [filter]);
|
|
555
|
+
}
|
|
556
|
+
agreement() {
|
|
557
|
+
return createPeerAgreement(this.agreementBasis(), this.remotes.map((remote) => remote.meta));
|
|
558
|
+
}
|
|
559
|
+
agreementBasis() {
|
|
560
|
+
if (!this.basis) throw new Error("Peer agreement has not been fetched from the worker yet");
|
|
561
|
+
return this.basis;
|
|
562
|
+
}
|
|
540
563
|
async bindRemote(id, boundAddress) {
|
|
541
564
|
await this.callSyncOp("bindRemote", [id, boundAddress]);
|
|
542
565
|
await this.refreshRemotes();
|
|
@@ -591,6 +614,8 @@ var SyncManagerProxy = class {
|
|
|
591
614
|
},
|
|
592
615
|
notePoll: () => {},
|
|
593
616
|
lastHolderPollUtcMs: () => void 0,
|
|
617
|
+
setLocalManifest: () => {},
|
|
618
|
+
onPeerManifest: () => () => {},
|
|
594
619
|
config: { url }
|
|
595
620
|
};
|
|
596
621
|
}
|
|
@@ -610,6 +635,9 @@ var SyncManagerProxy = class {
|
|
|
610
635
|
this.notifyConnection();
|
|
611
636
|
}
|
|
612
637
|
ensureSeeded() {
|
|
638
|
+
if (!this.basis) this.callSyncOp("peerAgreementBasis", []).then((basis) => {
|
|
639
|
+
this.basis = basis;
|
|
640
|
+
}).catch(() => {});
|
|
613
641
|
if (!this.seedPromise) {
|
|
614
642
|
const pending = this.refreshRemotes();
|
|
615
643
|
this.seedPromise = pending;
|
|
@@ -844,6 +872,7 @@ var ReactorHost = class {
|
|
|
844
872
|
disposers = /* @__PURE__ */ new Set();
|
|
845
873
|
clients = /* @__PURE__ */ new Set();
|
|
846
874
|
clientPromise = null;
|
|
875
|
+
buildFailure = null;
|
|
847
876
|
baseline = null;
|
|
848
877
|
ownerId;
|
|
849
878
|
bootedAtMs;
|
|
@@ -1010,14 +1039,22 @@ var ReactorHost = class {
|
|
|
1010
1039
|
if (!build) return Promise.reject(/* @__PURE__ */ new Error("ReactorHost has no client or builder"));
|
|
1011
1040
|
const pending = build(construct);
|
|
1012
1041
|
this.clientPromise = pending;
|
|
1013
|
-
|
|
1014
|
-
|
|
1042
|
+
this.buildFailure = null;
|
|
1043
|
+
pending.catch((error) => {
|
|
1044
|
+
if (this.clientPromise === pending) {
|
|
1045
|
+
this.clientPromise = null;
|
|
1046
|
+
this.buildFailure = { error };
|
|
1047
|
+
}
|
|
1015
1048
|
});
|
|
1016
1049
|
}
|
|
1017
1050
|
return this.clientPromise;
|
|
1018
1051
|
}
|
|
1019
1052
|
async awaitClientReady() {
|
|
1020
|
-
if (this.clientPromise)
|
|
1053
|
+
if (this.clientPromise) {
|
|
1054
|
+
await this.clientPromise;
|
|
1055
|
+
return;
|
|
1056
|
+
}
|
|
1057
|
+
if (this.buildFailure) throw this.buildFailure.error;
|
|
1021
1058
|
}
|
|
1022
1059
|
requireHandler(handler, message, reply, label) {
|
|
1023
1060
|
if (handler) return true;
|
|
@@ -1102,12 +1139,16 @@ var WorkerPackageLoader = class {
|
|
|
1102
1139
|
cdnUrl;
|
|
1103
1140
|
importPackage;
|
|
1104
1141
|
resolvePackages;
|
|
1142
|
+
sharedImports;
|
|
1143
|
+
importSource;
|
|
1105
1144
|
modulesByKey = /* @__PURE__ */ new Map();
|
|
1106
1145
|
loadedSpecs = /* @__PURE__ */ new Set();
|
|
1107
1146
|
failures = [];
|
|
1108
1147
|
constructor(options) {
|
|
1109
1148
|
this.cdnUrl = options.cdnUrl.replace(/\/$/, "");
|
|
1110
1149
|
this.importPackage = options.importPackage;
|
|
1150
|
+
this.sharedImports = options.sharedImports;
|
|
1151
|
+
this.importSource = options.importSource;
|
|
1111
1152
|
const registryClient = new RegistryClient(options.cdnUrl);
|
|
1112
1153
|
this.resolvePackages = options.resolvePackages ?? ((documentType) => registryClient.getPackagesByDocumentType(documentType));
|
|
1113
1154
|
}
|
|
@@ -1151,7 +1192,13 @@ var WorkerPackageLoader = class {
|
|
|
1151
1192
|
const name = packageName(spec);
|
|
1152
1193
|
const url = `${this.cdnUrl}/${name}/browser/document-models/index.js`;
|
|
1153
1194
|
try {
|
|
1154
|
-
const
|
|
1195
|
+
const source = this.sharedImports !== void 0 && Object.keys(this.sharedImports).length > 0 ? await (await fetch(url)).text() : void 0;
|
|
1196
|
+
const rewritten = source !== void 0 ? rewritePackageSource(source, url, this.sharedImports) : source;
|
|
1197
|
+
let namespace;
|
|
1198
|
+
if (rewritten !== void 0 && rewritten !== source) {
|
|
1199
|
+
if (!this.importSource) throw new Error("importSource is required to load a package that imports shared deps");
|
|
1200
|
+
namespace = await this.importSource(rewritten);
|
|
1201
|
+
} else namespace = await this.importPackage(url);
|
|
1155
1202
|
for (const value of Object.values(namespace)) if (isDocumentModelModule(value)) this.modulesByKey.set(moduleKey(value), value);
|
|
1156
1203
|
this.loadedSpecs.add(spec);
|
|
1157
1204
|
} catch (error) {
|
|
@@ -1170,6 +1217,8 @@ var WorkerPackageLoader = class {
|
|
|
1170
1217
|
* res/err settlement, and per-request timeout/transform/cleanup.
|
|
1171
1218
|
*/
|
|
1172
1219
|
var RpcCorrelator = class {
|
|
1220
|
+
poster;
|
|
1221
|
+
prefix;
|
|
1173
1222
|
counter = 0;
|
|
1174
1223
|
pending = /* @__PURE__ */ new Map();
|
|
1175
1224
|
constructor(poster, prefix = "r") {
|