@powerhousedao/reactor-browser 6.2.3-dev.76 → 6.2.3-dev.77

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.
Files changed (39) hide show
  1. package/dist/{attachment-service-BsOmg2-v.d.ts → attachment-service-D-CKdGUb.d.ts} +152 -11
  2. package/dist/attachment-service-D-CKdGUb.d.ts.map +1 -0
  3. package/dist/{client-CXDpILj6.js → client-CI-3xGMZ.js} +2 -2
  4. package/dist/{client-CXDpILj6.js.map → client-CI-3xGMZ.js.map} +1 -1
  5. package/dist/{client-BnGewICj.d.ts → client-Ca_CA8VC.d.ts} +2 -2
  6. package/dist/client-Ca_CA8VC.d.ts.map +1 -0
  7. package/dist/{dispatch-BEI1Ai2b.js → dispatch-qujH7vLW.js} +13 -7
  8. package/dist/dispatch-qujH7vLW.js.map +1 -0
  9. package/dist/{document-by-id-bHT2FDHM.js → document-by-id-D1wsYWhq.js} +2 -2
  10. package/dist/{document-by-id-bHT2FDHM.js.map → document-by-id-D1wsYWhq.js.map} +1 -1
  11. package/dist/{document-model-modules-DAx3VAm3.js → document-model-modules-DmLQhKvh.js} +2 -2
  12. package/dist/{document-model-modules-DAx3VAm3.js.map → document-model-modules-DmLQhKvh.js.map} +1 -1
  13. package/dist/{document-operations-zQKFs_xu.js → document-operations-C4-irgHD.js} +528 -42
  14. package/dist/document-operations-C4-irgHD.js.map +1 -0
  15. package/dist/{global-DY0jZmcO.d.ts → global-CgzlPBc3.d.ts} +32 -6
  16. package/dist/global-CgzlPBc3.d.ts.map +1 -0
  17. package/dist/{index-DlZsXHpT.d.ts → index-CrVfRJO1.d.ts} +2 -2
  18. package/dist/{index-DlZsXHpT.d.ts.map → index-CrVfRJO1.d.ts.map} +1 -1
  19. package/dist/index.d.ts +12 -12
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +17 -17
  22. package/dist/index.js.map +1 -1
  23. package/dist/src/ai/index.js +2 -2
  24. package/dist/src/analytics/index.js +1 -1
  25. package/dist/src/graphql/client.d.ts +2 -2
  26. package/dist/src/graphql/client.js +1 -1
  27. package/dist/src/graphql-client/entry.d.ts +4 -4
  28. package/dist/src/graphql-client/entry.js +4 -4
  29. package/dist/src/renown/index.d.ts +1 -1
  30. package/dist/{switchboard-G3aKXjNx.js → switchboard-0yDJ-f9X.js} +4 -4
  31. package/dist/{switchboard-G3aKXjNx.js.map → switchboard-0yDJ-f9X.js.map} +1 -1
  32. package/dist/{types-0Fh1tNjy.d.ts → types-DOY-eHEk.d.ts} +2 -2
  33. package/dist/{types-0Fh1tNjy.d.ts.map → types-DOY-eHEk.d.ts.map} +1 -1
  34. package/package.json +9 -9
  35. package/dist/attachment-service-BsOmg2-v.d.ts.map +0 -1
  36. package/dist/client-BnGewICj.d.ts.map +0 -1
  37. package/dist/dispatch-BEI1Ai2b.js.map +0 -1
  38. package/dist/document-operations-zQKFs_xu.js.map +0 -1
  39. package/dist/global-DY0jZmcO.d.ts.map +0 -1
@@ -1,8 +1,8 @@
1
1
  import { c as getPHStore, f as usePHStore, t as makePHEventFunctions } from "./make-ph-event-functions-B5GU5xcR.js";
2
- import { D as uploadOperations, E as queueOperations, M as UnsupportedDocumentTypeError, O as DocumentModelNotFoundError, T as queueActions, _ as isOperationCache, f as DocumentCache, i as setDocumentCache, m as IDLE_OPERATIONS_ENTRY, o as useDocumentCache, r as addDocumentCacheEventHandler, y as DOCUMENT_CHANGE_TYPE } from "./dispatch-BEI1Ai2b.js";
3
- import { A as addDrivesEventHandler, L as ambientRenownTokenProvider, R as makeAuthMiddleware, a as setVetraPackageManager, c as addSelectedDriveIdEventHandler, f as setSelectedDriveId, h as useSelectedDriveId, r as addVetraPackageManagerEventHandler, u as selectDrive, v as addResetSelectedNodeEventHandler, w as setSelectedNodeId, y as addSelectedNodeIdEventHandler } from "./document-model-modules-DAx3VAm3.js";
2
+ import { D as uploadOperations, E as queueOperations, M as UnsupportedDocumentTypeError, O as DocumentModelNotFoundError, T as queueActions, _ as isOperationCache, f as DocumentCache, i as setDocumentCache, m as IDLE_OPERATIONS_ENTRY, o as useDocumentCache, r as addDocumentCacheEventHandler, y as DOCUMENT_CHANGE_TYPE } from "./dispatch-qujH7vLW.js";
3
+ import { A as addDrivesEventHandler, L as ambientRenownTokenProvider, R as makeAuthMiddleware, a as setVetraPackageManager, c as addSelectedDriveIdEventHandler, f as setSelectedDriveId, h as useSelectedDriveId, r as addVetraPackageManagerEventHandler, u as selectDrive, v as addResetSelectedNodeEventHandler, w as setSelectedNodeId, y as addSelectedNodeIdEventHandler } from "./document-model-modules-DmLQhKvh.js";
4
4
  import { A as extractNodeIdFromSlug, N as findDriveBySlug, O as extractDriveSlugFromPath, S as setBrowserOpenSync, c as getCurrentPathname, d as hasHostNavigation, h as openTargetWith, j as extractNodeSlugFromPath, l as getPHNavigation, m as openTarget, v as recordToSearch, w as targetPathname, x as searchToRecord } from "./navigation-BqphkrOB.js";
5
- import { i as PhDocumentFieldsFragmentDoc, n as DocumentChangesDocument, t as createClient$1 } from "./client-CXDpILj6.js";
5
+ import { a as PhDocumentFieldsFragmentDoc, i as JobChangesDocument, n as DocumentChangesDocument, t as createClient$1 } from "./client-CI-3xGMZ.js";
6
6
  import { f as addLoadingEventHandler, t as addRenownEventHandler } from "./renown-BxkZYzbQ.js";
7
7
  import { useCallback, useEffect, useMemo, useState, useSyncExternalStore } from "react";
8
8
  import { Fragment, jsx } from "react/jsx-runtime";
@@ -197,6 +197,7 @@ function showDeleteNodeModal(nodeOrId) {
197
197
  //#region src/hooks/reactor.ts
198
198
  const reactorClientModuleEventFunctions = makePHEventFunctions("reactorClientModule");
199
199
  const reactorClientEventFunctions = makePHEventFunctions("reactorClient");
200
+ const reactorHalvesEventFunctions = makePHEventFunctions("reactor");
200
201
  const fullReactorClientEventFunctions = makePHEventFunctions("fullReactorClient");
201
202
  /** Returns the reactor client module (in-process or worker-backed) */
202
203
  const useReactorClientModule = reactorClientModuleEventFunctions.useValue;
@@ -206,8 +207,26 @@ const setReactorClientModule = reactorClientModuleEventFunctions.setValue;
206
207
  const addReactorClientModuleEventHandler = reactorClientModuleEventFunctions.addEventHandler;
207
208
  /** Returns the reactor client */
208
209
  const useReactorClient = reactorClientEventFunctions.useValue;
209
- /** Sets the reactor client */
210
- const setReactorClient = reactorClientEventFunctions.setValue;
210
+ /**
211
+ * Sets the reactor client, and `window.ph.reactor` to its read and write
212
+ * halves. A client without halves leaves `reactor` unset.
213
+ */
214
+ const setReactorClient = (client) => {
215
+ reactorClientEventFunctions.setValue(client);
216
+ reactorHalvesEventFunctions.setValue(halvesOf(client));
217
+ };
218
+ /** Returns the reactor client's read and write halves */
219
+ const useReactorHalves = reactorHalvesEventFunctions.useValue;
220
+ /** Adds an event handler for the reactor client's halves */
221
+ const addReactorHalvesEventHandler = reactorHalvesEventFunctions.addEventHandler;
222
+ function halvesOf(client) {
223
+ const read = client?.read;
224
+ const write = client?.write;
225
+ return read && write ? {
226
+ read,
227
+ write
228
+ } : void 0;
229
+ }
211
230
  /** Adds an event handler for the reactor client */
212
231
  const addReactorClientEventHandler = reactorClientEventFunctions.addEventHandler;
213
232
  /** Sets the client full-client actions use instead of the module's */
@@ -320,7 +339,7 @@ async function getDocumentExtension(document) {
320
339
  else {
321
340
  const reactorClient = getFullReactorClient();
322
341
  if (reactorClient) {
323
- const { results: documentModelModules } = await reactorClient.getDocumentModelModules();
342
+ const { results: documentModelModules } = await reactorClient.read.getDocumentModelModules();
324
343
  rawExtension = documentModelModules.find((m) => m.documentModel.global.id === documentType)?.utils.fileExtension;
325
344
  }
326
345
  }
@@ -424,7 +443,7 @@ function boundary(upgrade, scope, ops) {
424
443
  async function exportFile(document, suggestedName) {
425
444
  const reactorClient = getPHStore()?.reactorClient;
426
445
  if (!reactorClient) throw new Error("ReactorClient not initialized");
427
- const operations = await fetchDocumentOperations(reactorClient, document);
446
+ const operations = await fetchDocumentOperations(reactorClient.read, document);
428
447
  const initialState = extractInitialState(operations["document"] ?? []);
429
448
  const documentWithOps = {
430
449
  ...document,
@@ -453,7 +472,7 @@ async function loadFile(path) {
453
472
  const reactorClient = getFullReactorClient();
454
473
  if (!reactorClient) throw new Error("ReactorClient not initialized");
455
474
  const documentType = baseDocument.header.documentType;
456
- const { results: documentModelModules } = await reactorClient.getDocumentModelModules();
475
+ const { results: documentModelModules } = await reactorClient.read.getDocumentModelModules();
457
476
  const modulesForType = documentModelModules.filter((module) => module.documentModel.global.id === documentType);
458
477
  if (modulesForType.length === 0) throw new DocumentModelNotFoundError(documentType);
459
478
  const reducers = {};
@@ -475,12 +494,12 @@ async function addDocument(driveId, name, documentType, parentFolder, document,
475
494
  if (!reactorClient) throw new Error("ReactorClient not initialized");
476
495
  let documentModelModule;
477
496
  if (documentModelVersion !== void 0) {
478
- const { results: documentModelModules } = await reactorClient.getDocumentModelModules();
497
+ const { results: documentModelModules } = await reactorClient.read.getDocumentModelModules();
479
498
  const module = documentModelModules.find((m) => m.documentModel.global.id === documentType && (m.version ?? 1) === documentModelVersion);
480
499
  if (!module) throw new Error(`Document model not found for type: ${documentType} with version: ${documentModelVersion}`);
481
500
  documentModelModule = module;
482
- } else documentModelModule = await reactorClient.getDocumentModelModule(documentType);
483
- const newDocument = document ?? withSignaturePolicy(documentModelModule.utils.createDocument(), await reactorClient.getCreateSignaturePolicy());
501
+ } else documentModelModule = await reactorClient.read.getDocumentModelModule(documentType);
502
+ const newDocument = document ?? withSignaturePolicy(documentModelModule.utils.createDocument(), await reactorClient.read.getCreateSignaturePolicy());
484
503
  if (!document) newDocument.state.document.version = documentModelModule.version ?? 1;
485
504
  newDocument.header.name = name;
486
505
  if (preferredEditor) newDocument.header.meta = {
@@ -489,7 +508,7 @@ async function addDocument(driveId, name, documentType, parentFolder, document,
489
508
  };
490
509
  let newDoc;
491
510
  try {
492
- newDoc = await reactorClient.drives.addFile(driveId, newDocument, parentFolder);
511
+ newDoc = await (await reactorClient.write.drives.addFile(driveId, newDocument, parentFolder)).document();
493
512
  } catch (e) {
494
513
  logger.error("Error adding document: @error", e);
495
514
  throw new Error("There was an error adding document", { cause: e });
@@ -527,9 +546,9 @@ function isDocumentAlreadyExists(error) {
527
546
  * under the same id and is resolved by minting another one. A create that
528
547
  * fails leaves the drive untouched, so a retry has nothing to clean up.
529
548
  */
530
- async function createImportedDocument(reactor, document, driveId, name, parentFolder) {
549
+ async function createImportedDocument(write, document, driveId, name, parentFolder) {
531
550
  const v2Required = signaturePolicyOf(document.header) === "v2-required";
532
- const keepsId = (!v2Required || hasDerivedDocumentId(document.header)) && !await reactor.isDocumentIdTaken(document.header.id);
551
+ const keepsId = (!v2Required || hasDerivedDocumentId(document.header)) && !await write.isDocumentIdTaken(document.header.id);
533
552
  let documentId = keepsId ? document.header.id : generateId();
534
553
  for (let attempt = 1;; attempt++) {
535
554
  let header;
@@ -622,7 +641,7 @@ async function addFileWithProgress(file, driveId, name, parentFolder, onProgress
622
641
  }
623
642
  throw loadError;
624
643
  }
625
- const duplicateCheck = await isDocumentInLocation(reactor, document, driveId, parentFolder);
644
+ const duplicateCheck = await isDocumentInLocation(reactor.read, document, driveId, parentFolder);
626
645
  if (duplicateCheck.isDuplicate && !resolveConflict) {
627
646
  onProgress?.({
628
647
  stage: "conflict",
@@ -649,19 +668,19 @@ async function addFileWithProgress(file, driveId, name, parentFolder, onProgress
649
668
  });
650
669
  throw new UnsupportedDocumentTypeError(document.header.documentType);
651
670
  }
652
- await reactor.getDocumentModelModule(document.header.documentType);
671
+ await reactor.read.getDocumentModelModule(document.header.documentType);
653
672
  onProgress?.({
654
673
  stage: "initializing",
655
674
  progress: 10
656
675
  });
657
- const created = await createImportedDocument(reactor, document, driveId, name, parentFolder);
676
+ const created = await createImportedDocument(reactor.write, document, driveId, name, parentFolder);
658
677
  const documentId = created.documentId;
659
678
  const fileNode = created.fileNode;
660
679
  onProgress?.({
661
680
  stage: "initializing",
662
681
  progress: 20
663
682
  });
664
- await reactor.get(documentId);
683
+ await reactor.read.get(documentId);
665
684
  console.log("Document created, starting upload of operations");
666
685
  const segments = splitAtUpgradeBoundaries(document.operations);
667
686
  const totalOperations = segments.reduce((total, segment) => total + countOperations(segment.operations), 0);
@@ -718,13 +737,13 @@ async function addFolder$1(driveId, name, parentFolder) {
718
737
  if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to create folders");
719
738
  const reactorClient = getPHStore()?.reactorClient;
720
739
  if (!reactorClient) throw new Error("ReactorClient not initialized");
721
- await reactorClient.get(driveId);
740
+ await reactorClient.read.get(driveId);
722
741
  const folderId = generateId();
723
- const node = (await reactorClient.execute(driveId, "main", [addFolder({
742
+ const node = (await (await reactorClient.write.execute(driveId, "main", [addFolder({
724
743
  id: folderId,
725
744
  name,
726
745
  parentFolder
727
- })])).state.global.nodes.find((node) => node.id === folderId);
746
+ })])).document()).state.global.nodes.find((node) => node.id === folderId);
728
747
  if (!node || !isFolderNode(node)) throw new Error("There was an error adding folder");
729
748
  return node;
730
749
  }
@@ -733,18 +752,18 @@ async function deleteNode(driveId, nodeId) {
733
752
  if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to delete documents");
734
753
  const reactorClient = getFullReactorClient();
735
754
  if (!reactorClient) throw new Error("ReactorClient not initialized");
736
- await reactorClient.drives.removeNode(driveId, nodeId);
755
+ await (await reactorClient.write.drives.removeNode(driveId, nodeId)).readable;
737
756
  }
738
757
  async function renameNode(driveId, nodeId, name) {
739
758
  const { isAllowedToCreateDocuments } = getUserPermissions();
740
759
  if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to rename documents");
741
760
  const reactorClient = getPHStore()?.reactorClient;
742
761
  if (!reactorClient) throw new Error("ReactorClient not initialized");
743
- if ((await reactorClient.execute(nodeId, "main", [setName({ name })])).header.name !== name) throw new Error("There was an error renaming the node");
744
- const node = (await reactorClient.execute(driveId, "main", [updateNode({
762
+ if ((await (await reactorClient.write.execute(nodeId, "main", [setName({ name })])).document()).header.name !== name) throw new Error("There was an error renaming the node");
763
+ const node = (await (await reactorClient.write.execute(driveId, "main", [updateNode({
745
764
  id: nodeId,
746
765
  name
747
- })])).state.global.nodes.find((n) => n.id === nodeId);
766
+ })])).document()).state.global.nodes.find((n) => n.id === nodeId);
748
767
  if (!node) throw new Error("There was an error renaming node in the drive");
749
768
  return node;
750
769
  }
@@ -753,19 +772,18 @@ async function renameDriveNode(driveId, nodeId, name) {
753
772
  if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to rename documents");
754
773
  const reactorClient = getPHStore()?.reactorClient;
755
774
  if (!reactorClient) throw new Error("ReactorClient not initialized");
756
- if ((await reactorClient.execute(nodeId, "main", [setName({ name })])).header.name !== name) throw new Error("There was an error renaming the node");
757
- await reactorClient.execute(driveId, "main", [updateNode({
775
+ if ((await (await reactorClient.write.execute(nodeId, "main", [setName({ name })])).document()).header.name !== name) throw new Error("There was an error renaming the node");
776
+ return (await (await reactorClient.write.execute(driveId, "main", [updateNode({
758
777
  id: nodeId,
759
778
  name
760
- })]);
761
- return (await reactorClient.get(driveId)).state.global.nodes.find((n) => n.id === nodeId);
779
+ })])).document()).state.global.nodes.find((n) => n.id === nodeId);
762
780
  }
763
781
  async function setPreferredEditorOnNode(nodeId, preferredEditor) {
764
782
  const { isAllowedToCreateDocuments } = getUserPermissions();
765
783
  if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to modify documents");
766
784
  const reactorClient = getPHStore()?.reactorClient;
767
785
  if (!reactorClient) throw new Error("ReactorClient not initialized");
768
- return reactorClient.execute(nodeId, "main", [setPreferredEditor(preferredEditor)]);
786
+ return (await reactorClient.write.execute(nodeId, "main", [setPreferredEditor(preferredEditor)])).document();
769
787
  }
770
788
  async function moveNodeById(args) {
771
789
  const { driveId, srcId, targetId } = args;
@@ -776,20 +794,20 @@ async function moveNodeById(args) {
776
794
  if (!reactorClient) throw new Error("ReactorClient not initialized");
777
795
  const targetParentFolder = conditional(targetId, [isNot(isDefined), constant(void 0)], [isStrictEqual(driveId), constant(void 0)], constant(targetId));
778
796
  if (isStrictEqual(targetParentFolder, srcId)) return;
779
- return await reactorClient.execute(driveId, "main", [moveNode({
797
+ return (await reactorClient.write.execute(driveId, "main", [moveNode({
780
798
  srcFolder: srcId,
781
799
  targetParentFolder
782
- })]);
800
+ })])).document();
783
801
  }
784
802
  async function moveNode$1(driveId, src, target) {
785
803
  const { isAllowedToCreateDocuments } = getUserPermissions();
786
804
  if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to move documents");
787
805
  const reactorClient = getPHStore()?.reactorClient;
788
806
  if (!reactorClient) throw new Error("ReactorClient not initialized");
789
- return await reactorClient.execute(driveId, "main", [moveNode({
807
+ return (await reactorClient.write.execute(driveId, "main", [moveNode({
790
808
  srcFolder: src.id,
791
809
  targetParentFolder: target?.id
792
- })]);
810
+ })])).document();
793
811
  }
794
812
  /**
795
813
  * Duplicates a document under a new id using version-aware replay.
@@ -828,7 +846,7 @@ async function copyNode$1(driveId, src, target) {
828
846
  if (!reactor) return;
829
847
  const { isAllowedToCreateDocuments } = getUserPermissions();
830
848
  if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to copy documents");
831
- const drive = await reactor.get(driveId);
849
+ const drive = await reactor.read.get(driveId);
832
850
  const copyNodesInput = generateNodesCopy({
833
851
  srcId: src.id,
834
852
  targetParentFolder: target?.id,
@@ -852,11 +870,12 @@ async function copyNode$1(driveId, src, target) {
852
870
  return node !== void 0 && isFileNode(node);
853
871
  });
854
872
  for (const fileNodeToCopy of fileNodesToCopy) try {
855
- const duplicatedDocument = await _duplicateDocument(reactor, await reactor.get(fileNodeToCopy.srcId), fileNodeToCopy.targetId, driveId);
873
+ const document = await reactor.read.get(fileNodeToCopy.srcId);
874
+ const duplicatedDocument = await _duplicateDocument(reactor.read, document, fileNodeToCopy.targetId, driveId);
856
875
  const resolvedName = resolvedNamesMap.get(fileNodeToCopy.targetId);
857
876
  if (resolvedName) duplicatedDocument.header.name = resolvedName;
858
877
  fileNodeToCopy.targetId = duplicatedDocument.header.id;
859
- await reactor.drives.addFile(driveId, duplicatedDocument, target?.id);
878
+ await (await reactor.write.drives.addFile(driveId, duplicatedDocument, target?.id)).readable;
860
879
  } catch (e) {
861
880
  logger.error(`Error copying document ${fileNodeToCopy.srcId}: ${String(e)}`);
862
881
  }
@@ -870,7 +889,7 @@ async function copyNode$1(driveId, src, target) {
870
889
  async function upgradeDocument(documentId, toVersion) {
871
890
  const reactorClient = getFullReactorClient();
872
891
  if (!reactorClient) throw new Error("ReactorClient not initialized");
873
- return reactorClient.upgradeDocument(documentId, toVersion);
892
+ return (await reactorClient.write.upgradeDocument(documentId, toVersion)).document();
874
893
  }
875
894
  //#endregion
876
895
  //#region src/constants.ts
@@ -1100,6 +1119,23 @@ var BatchJobFailedError = class extends Error {
1100
1119
  return Error.isError(error) && error.name === "BatchJobFailedError" && typeof error.key === "string" && typeof error.jobs === "object";
1101
1120
  }
1102
1121
  };
1122
+ /**
1123
+ * The reactor's `JobFailedError`, rebuilt from a job the Switchboard reported
1124
+ * FAILED; this entry imports the reactor for types only. A write handle's
1125
+ * stage rejects with it. The message is the job error's message, as the
1126
+ * reactor's is.
1127
+ */
1128
+ var JobFailedError = class extends Error {
1129
+ name = "JobFailedError";
1130
+ job;
1131
+ constructor(job) {
1132
+ super(job.error?.message);
1133
+ this.job = job;
1134
+ }
1135
+ static isError(error) {
1136
+ return Error.isError(error) && error.name === "JobFailedError" && typeof error.job === "object";
1137
+ }
1138
+ };
1103
1139
  //#endregion
1104
1140
  //#region src/graphql-client/operations.ts
1105
1141
  /**
@@ -1189,6 +1225,27 @@ const MutateDocumentWithOperationsDocument = gql`
1189
1225
  ${PhDocumentFieldsFragmentDoc}
1190
1226
  ${ReactorOperationFieldsFragmentDoc}
1191
1227
  `;
1228
+ /**
1229
+ * `document`, bounded by a consistency token: the read waits until the
1230
+ * Switchboard's read models hold every operation the token names. The
1231
+ * `consistency` argument is additive on the Switchboard; one without it refuses
1232
+ * this document, and the client falls back to the plain `GetDocument`.
1233
+ */
1234
+ const GetDocumentAtConsistencyDocument = gql`
1235
+ query GetDocumentAtConsistency(
1236
+ $identifier: String!
1237
+ $view: ViewFilterInput
1238
+ $consistency: ConsistencyTokenInput
1239
+ ) {
1240
+ document(identifier: $identifier, view: $view, consistency: $consistency) {
1241
+ document {
1242
+ ...PHDocumentFields
1243
+ }
1244
+ childIds
1245
+ }
1246
+ }
1247
+ ${PhDocumentFieldsFragmentDoc}
1248
+ `;
1192
1249
  //#endregion
1193
1250
  //#region src/graphql-client/signing.ts
1194
1251
  /**
@@ -1620,6 +1677,45 @@ function startDocumentChangesSubscription(options) {
1620
1677
  };
1621
1678
  }
1622
1679
  /**
1680
+ * Opens the socket write handles wait on. `graphql-ws` multiplexes every
1681
+ * watched job over it and closes it once the last watch stops.
1682
+ */
1683
+ function createJobChangesSocket(options) {
1684
+ let client;
1685
+ const clientOf = () => client ??= createClient({
1686
+ url: options.wsUrl,
1687
+ connectionParams: options.connectionParams,
1688
+ shouldRetry: (errOrCloseEvent) => isLikeCloseEvent(errOrCloseEvent) && !isAuthRefusalClose(errOrCloseEvent)
1689
+ });
1690
+ return {
1691
+ watch(jobId, onEvent, onError) {
1692
+ const unsubscribe = clientOf().subscribe({
1693
+ operationName: "JobChanges",
1694
+ query: print(JobChangesDocument),
1695
+ variables: { jobId }
1696
+ }, {
1697
+ next: (result) => {
1698
+ const event = result.data?.jobChanges;
1699
+ if (event) onEvent(event);
1700
+ },
1701
+ error: (error) => onError(error),
1702
+ complete: () => void 0
1703
+ });
1704
+ let stopped = false;
1705
+ return () => {
1706
+ if (stopped) return;
1707
+ stopped = true;
1708
+ unsubscribe();
1709
+ };
1710
+ },
1711
+ dispose() {
1712
+ const current = client;
1713
+ client = void 0;
1714
+ current?.dispose();
1715
+ }
1716
+ };
1717
+ }
1718
+ /**
1623
1719
  * Derives the websocket endpoint from the GraphQL http endpoint.
1624
1720
  *
1625
1721
  * `http://host/graphql` becomes `ws://host/graphql/subscriptions`, which is
@@ -1645,6 +1741,141 @@ function makeAuthConnectionParams(tokenProvider) {
1645
1741
  };
1646
1742
  }
1647
1743
  //#endregion
1744
+ //#region src/graphql-client/write-handles.ts
1745
+ /** Whether a job status has reached a stage, FAILED counting as settled. */
1746
+ function settlesGraphQLJobStage(status, stage) {
1747
+ const value = status;
1748
+ if (value === "FAILED" || value === "READ_READY") return true;
1749
+ return stage === "written" && value === "WRITE_READY";
1750
+ }
1751
+ function emptyToken() {
1752
+ return {
1753
+ version: 1,
1754
+ createdAtUtcIso: (/* @__PURE__ */ new Date()).toISOString(),
1755
+ coordinates: []
1756
+ };
1757
+ }
1758
+ function abortError(signal) {
1759
+ const reason = signal.reason;
1760
+ return reason instanceof Error ? reason : new Error(String(reason));
1761
+ }
1762
+ /** `promise`, rejected early when `signal` aborts. */
1763
+ function bounded(promise, signal) {
1764
+ if (!signal) return promise;
1765
+ if (signal.aborted) return Promise.reject(abortError(signal));
1766
+ return new Promise((resolve, reject) => {
1767
+ const onAbort = () => reject(abortError(signal));
1768
+ signal.addEventListener("abort", onAbort, { once: true });
1769
+ promise.then((value) => {
1770
+ signal.removeEventListener("abort", onAbort);
1771
+ resolve(value);
1772
+ }, (error) => {
1773
+ signal.removeEventListener("abort", onAbort);
1774
+ reject(error instanceof Error ? error : new Error(String(error)));
1775
+ });
1776
+ });
1777
+ }
1778
+ /**
1779
+ * A write handle over a job the Switchboard accepted (`executeAsync`).
1780
+ *
1781
+ * Each stage is the waiter's: `jobStatus`, woken early by the `jobChanges`
1782
+ * subscription when the client has realtime. Stage promises are created on
1783
+ * first access, so a fire-and-forget caller never owns a rejection. A FAILED
1784
+ * job rejects a stage with {@link JobFailedError}.
1785
+ *
1786
+ * `document()` with no view is read once and shared, so the client's own
1787
+ * change announcement and the caller's read-back cost one request.
1788
+ */
1789
+ var GraphQLJobWriteHandle = class {
1790
+ jobId;
1791
+ documentId;
1792
+ branch;
1793
+ wait;
1794
+ reader;
1795
+ signal;
1796
+ writtenReceipt;
1797
+ readableReceipt;
1798
+ defaultDocument;
1799
+ constructor(job, documentId, branch, wait, reader, signal) {
1800
+ this.jobId = job.id;
1801
+ this.documentId = documentId;
1802
+ this.branch = branch;
1803
+ this.wait = wait;
1804
+ this.reader = reader;
1805
+ this.signal = signal;
1806
+ }
1807
+ get written() {
1808
+ this.writtenReceipt ??= this.receiptAt("written");
1809
+ return this.writtenReceipt;
1810
+ }
1811
+ get readable() {
1812
+ this.readableReceipt ??= this.receiptAt("readable");
1813
+ return this.readableReceipt;
1814
+ }
1815
+ async document(view, signal) {
1816
+ if (view !== void 0) {
1817
+ const receipt = await bounded(this.readable, signal);
1818
+ return this.reader(receipt, view, signal);
1819
+ }
1820
+ this.defaultDocument ??= this.readable.then((receipt) => this.reader(receipt, void 0, void 0));
1821
+ return bounded(this.defaultDocument, signal);
1822
+ }
1823
+ async receiptAt(stage) {
1824
+ const job = await this.wait(this.jobId, stage, this.signal);
1825
+ if (job.status === "FAILED") throw new JobFailedError(job);
1826
+ return {
1827
+ job,
1828
+ token: job.consistencyToken,
1829
+ documentId: this.documentId,
1830
+ branch: this.branch
1831
+ };
1832
+ }
1833
+ };
1834
+ /**
1835
+ * A write handle for a write the Switchboard applied before answering: the
1836
+ * synchronous `createDocument` and `deleteDocument` mutations name no job. Both
1837
+ * stages are settled; `jobId` is empty and the receipt's job is a READ_READY
1838
+ * placeholder with an empty token, as the reactor's own settled handle has.
1839
+ */
1840
+ var GraphQLSettledWriteHandle = class {
1841
+ jobId = "";
1842
+ documentId;
1843
+ branch;
1844
+ receipt;
1845
+ reader;
1846
+ constructor(documentId, branch, reader) {
1847
+ this.documentId = documentId;
1848
+ this.branch = branch;
1849
+ this.reader = reader;
1850
+ const token = emptyToken();
1851
+ this.receipt = {
1852
+ job: {
1853
+ id: "",
1854
+ documentId,
1855
+ status: "READ_READY",
1856
+ createdAtUtcIso: token.createdAtUtcIso,
1857
+ consistencyToken: token,
1858
+ meta: {
1859
+ batchId: "",
1860
+ batchJobIds: []
1861
+ }
1862
+ },
1863
+ token,
1864
+ documentId,
1865
+ branch
1866
+ };
1867
+ }
1868
+ get written() {
1869
+ return Promise.resolve(this.receipt);
1870
+ }
1871
+ get readable() {
1872
+ return Promise.resolve(this.receipt);
1873
+ }
1874
+ document(view, signal) {
1875
+ return this.reader(this.receipt, view, signal);
1876
+ }
1877
+ };
1878
+ //#endregion
1648
1879
  //#region src/graphql-client/graphql-reactor-client.ts
1649
1880
  /** Paging defaults, matching the reactor's own client. */
1650
1881
  const defaultPaging = {
@@ -1652,6 +1883,14 @@ const defaultPaging = {
1652
1883
  limit: 100
1653
1884
  };
1654
1885
  const JOB_POLL_INTERVAL_MS = 250;
1886
+ /** The first `jobStatus` poll of a write handle's stage wait, doubling from here. */
1887
+ const STAGE_POLL_START_MS = 25;
1888
+ /**
1889
+ * The longest a stage wait sleeps between `jobStatus` polls while the
1890
+ * `jobChanges` subscription is up: the subscription wakes it early, and the
1891
+ * poll is the safety net for an event that raced the subscription.
1892
+ */
1893
+ const STAGE_POLL_REALTIME_MAX_MS = 1e3;
1655
1894
  /**
1656
1895
  * The marker {@link isGraphQLReactorClient} looks for.
1657
1896
  *
@@ -1685,6 +1924,26 @@ var GraphQLReactorClient = class {
1685
1924
  realtimeErrorLogged = false;
1686
1925
  /** Whether the last socket died because the Switchboard refused its credentials. */
1687
1926
  realtimeRefusedCredentials = false;
1927
+ /** The socket write handles wait on; opened by the first stage wait. */
1928
+ jobSocket;
1929
+ /** Set once the `jobChanges` subscription failed; stage waits then only poll. */
1930
+ jobRealtimeBroken = false;
1931
+ /** Set once the Switchboard refused the `document` query's `consistency` argument. */
1932
+ consistencyUnsupported = false;
1933
+ /**
1934
+ * The read half: the reads the hooks make. Every method is this client's
1935
+ * own; nothing that writes is reachable from it.
1936
+ */
1937
+ read;
1938
+ /**
1939
+ * The write half. `execute` submits through `executeAsync` and hands back a
1940
+ * handle whose `written` and `readable` resolve from `jobStatus`, woken by
1941
+ * the `jobChanges` subscription when realtime is on, and whose `document()`
1942
+ * runs the `document` query bounded by the receipt's token. `create` and
1943
+ * `deleteDocument` have no asynchronous mutation: they run the synchronous
1944
+ * ones and hand back a settled handle.
1945
+ */
1946
+ write;
1688
1947
  constructor(options) {
1689
1948
  this.tokenProvider = options.tokenProvider ?? ambientRenownTokenProvider;
1690
1949
  const models = options.documentModels;
@@ -1699,16 +1958,32 @@ var GraphQLReactorClient = class {
1699
1958
  const middleware = withWrongBackendErrors(makeAuthMiddleware(this.tokenProvider));
1700
1959
  this.sdk = options.graphqlClient ?? createClient$1(options.url, middleware);
1701
1960
  this.subgraphs = new SubgraphSdkRegistry(options.url, middleware);
1961
+ this.read = new GraphQLReadHalf(this);
1962
+ this.write = {
1963
+ execute: (documentIdentifier, branch, actions, signal) => this.submitExecute(documentIdentifier, branch, actions, signal),
1964
+ create: (document, parentIdentifier, signal) => this.submitCreate(document, parentIdentifier, signal),
1965
+ deleteDocument: (identifier, propagate, signal) => this.submitDeleteDocument(identifier, propagate, signal)
1966
+ };
1702
1967
  }
1703
- async get(identifier, view, signal) {
1968
+ /**
1969
+ * Reads a document. With a consistency token that names any coordinate, the
1970
+ * Switchboard waits until its read models hold them; one without the
1971
+ * `document` query's `consistency` argument is read without it, which after
1972
+ * a write's `readable` stage still sees the write on a single node.
1973
+ */
1974
+ async get(identifier, view, signal, consistencyToken) {
1704
1975
  const viewInput = viewFilterInputFromViewFilter(view);
1705
- const document = (await this.sdk.GetDocument({
1976
+ const document = (consistencyToken && consistencyToken.coordinates.length > 0 ? await this.getDocumentAtConsistency(identifier, viewInput, consistencyToken, signal) : await this.sdk.GetDocument({
1706
1977
  identifier,
1707
1978
  view: viewInput
1708
1979
  }, void 0, signal)).document;
1709
1980
  if (!document) throw new Error(`Document not found: ${identifier}`);
1710
1981
  return phDocumentFromGetDocument(document.document, view?.branch);
1711
1982
  }
1983
+ /** Reads documents by id, in the order given; throws if any is missing. */
1984
+ async getMany(documentIds, view, signal, consistencyToken) {
1985
+ return Promise.all(documentIds.map((id) => this.get(id, view, signal, consistencyToken)));
1986
+ }
1712
1987
  /**
1713
1988
  * Whether the Switchboard would serve the document to this client's caller,
1714
1989
  * from its `documentServed` query: the same read gate `find` passes. Absent
@@ -1954,6 +2229,12 @@ var GraphQLReactorClient = class {
1954
2229
  const result = await this.sdk.GetJobStatus({ jobId }, void 0, signal);
1955
2230
  return result.jobStatus ? jobInfoFromGql(result.jobStatus) : void 0;
1956
2231
  }
2232
+ /** The job as `jobStatus` reports it now; throws when it reports none. */
2233
+ async getJobStatus(jobId, signal) {
2234
+ const job = await this.getJob(jobId, signal);
2235
+ if (!job) throw new Error(`Job not found: ${jobId}`);
2236
+ return job;
2237
+ }
1957
2238
  /** Polls `jobStatus` until the job is READ_READY or FAILED. */
1958
2239
  async waitForJob(jobOrId, signal) {
1959
2240
  if (typeof jobOrId !== "string" && isSettled(jobOrId)) return jobOrId;
@@ -2177,6 +2458,8 @@ var GraphQLReactorClient = class {
2177
2458
  */
2178
2459
  dispose() {
2179
2460
  this.teardownRealtime();
2461
+ this.jobSocket?.dispose();
2462
+ this.jobSocket = void 0;
2180
2463
  }
2181
2464
  /**
2182
2465
  * Binds a project's generated SDK to this client's transport and auth.
@@ -2244,6 +2527,137 @@ var GraphQLReactorClient = class {
2244
2527
  };
2245
2528
  }
2246
2529
  /**
2530
+ * The write half's `execute`: signs as the facade's `execute` does, submits
2531
+ * through `executeAsync` and returns once the job is accepted. When anyone
2532
+ * subscribes, the document is read back once the job is readable and
2533
+ * announced as `Updated`, as the facade's `execute` announces it; the handle
2534
+ * shares that read with its own `document()`.
2535
+ */
2536
+ async submitExecute(documentIdentifier, branch, actions, signal) {
2537
+ const document = await this.get(documentIdentifier, { branch }, signal);
2538
+ const preparedActions = await prepareActionsForPush(actions, document, this.documentModels(), this.signer, signal);
2539
+ const handle = new GraphQLJobWriteHandle(jobInfoFromGql((await this.sdk.MutateDocumentAsync({
2540
+ documentIdentifier,
2541
+ actions: preparedActions.map(toTransportAction),
2542
+ branch
2543
+ }, this.driveIdHeaders({
2544
+ method: "execute",
2545
+ documentId: documentIdentifier
2546
+ }, isDrive(document) ? document.header.id : void 0), signal)).mutateDocumentAsync), document.header.id, branch, (jobId, stage, stageSignal) => this.waitForStage(jobId, stage, stageSignal), this.handleReader(document.header.id), signal);
2547
+ if (this.listeners.length > 0) this.announceWrite(handle);
2548
+ return handle;
2549
+ }
2550
+ /** The write half's `create`: the synchronous mutation, a settled handle. */
2551
+ async submitCreate(document, parentIdentifier, signal) {
2552
+ const created = await this.create(document, parentIdentifier, signal);
2553
+ return new GraphQLSettledWriteHandle(created.header.id, created.header.branch || "main", this.handleReader(created.header.id));
2554
+ }
2555
+ /** The write half's `deleteDocument`: the synchronous mutation, a settled handle. */
2556
+ async submitDeleteDocument(identifier, propagate, signal) {
2557
+ await this.deleteDocument(identifier, propagate, signal);
2558
+ return new GraphQLSettledWriteHandle(identifier, "main", this.handleReader(identifier));
2559
+ }
2560
+ /** Reads a write's document back, bounded by its receipt's token. */
2561
+ handleReader(documentId) {
2562
+ return (receipt, view, signal) => this.get(documentId, {
2563
+ ...view,
2564
+ branch: receipt.branch
2565
+ }, signal, receipt.token);
2566
+ }
2567
+ /** Announces a write's document as `Updated` once it is readable. */
2568
+ async announceWrite(handle) {
2569
+ let document;
2570
+ try {
2571
+ document = await handle.document();
2572
+ } catch (error) {
2573
+ logger.warn("GraphQLReactorClient: could not read @documentId back to announce a write: @error", handle.documentId, error);
2574
+ return;
2575
+ }
2576
+ this.emitChange({
2577
+ type: DOCUMENT_CHANGE_TYPE.Updated,
2578
+ documents: [document]
2579
+ });
2580
+ }
2581
+ /**
2582
+ * Waits for a job to settle a stage, resolving with a FAILED job too. Polls
2583
+ * `jobStatus` with a doubling interval; with realtime on, a `jobChanges`
2584
+ * event for the job wakes the wait early and the interval is only a safety
2585
+ * net. A failed subscription is logged once and the wait keeps polling.
2586
+ */
2587
+ async waitForStage(jobId, stage, signal) {
2588
+ const wakers = /* @__PURE__ */ new Set();
2589
+ const stopWatching = this.watchJob(jobId, () => {
2590
+ for (const wake of [...wakers]) wake();
2591
+ });
2592
+ try {
2593
+ let interval = STAGE_POLL_START_MS;
2594
+ for (;;) {
2595
+ const job = await this.getJobStatus(jobId, signal);
2596
+ if (settlesGraphQLJobStage(job.status, stage)) return job;
2597
+ await sleepUntilWoken(interval, wakers, signal);
2598
+ const max = stopWatching && !this.jobRealtimeBroken ? STAGE_POLL_REALTIME_MAX_MS : JOB_POLL_INTERVAL_MS;
2599
+ interval = Math.min(interval * 2, max);
2600
+ }
2601
+ } finally {
2602
+ stopWatching?.();
2603
+ }
2604
+ }
2605
+ /**
2606
+ * Subscribes to one job's `jobChanges` when realtime is on and the
2607
+ * subscription has not failed before. Returns the stop function, or
2608
+ * undefined when nothing was subscribed.
2609
+ */
2610
+ watchJob(jobId, onChange) {
2611
+ if (!this.subscriptionsUrl || this.jobRealtimeBroken) return;
2612
+ this.jobSocket ??= createJobChangesSocket({
2613
+ wsUrl: this.subscriptionsUrl,
2614
+ connectionParams: makeAuthConnectionParams(this.tokenProvider)
2615
+ });
2616
+ return this.jobSocket.watch(jobId, () => onChange(), (error) => {
2617
+ if (this.jobRealtimeBroken) return;
2618
+ this.jobRealtimeBroken = true;
2619
+ logger.warn("GraphQLReactorClient: realtime job changes are unavailable, write handles fall back to polling jobStatus", error);
2620
+ });
2621
+ }
2622
+ /**
2623
+ * The `document` query with the `consistency` argument, or without it once
2624
+ * the Switchboard has refused the argument.
2625
+ */
2626
+ async getDocumentAtConsistency(identifier, view, token, signal) {
2627
+ if (!this.consistencyUnsupported) {
2628
+ const variables = {
2629
+ identifier,
2630
+ view,
2631
+ consistency: {
2632
+ version: token.version,
2633
+ createdAtUtcIso: token.createdAtUtcIso,
2634
+ coordinates: token.coordinates.map((coordinate) => ({
2635
+ documentId: coordinate.documentId,
2636
+ scope: coordinate.scope,
2637
+ branch: coordinate.branch,
2638
+ operationIndex: coordinate.operationIndex
2639
+ }))
2640
+ }
2641
+ };
2642
+ try {
2643
+ return await this.sdk.RunDocument({
2644
+ operationName: "GetDocumentAtConsistency",
2645
+ operationType: "query",
2646
+ document: GetDocumentAtConsistencyDocument,
2647
+ variables,
2648
+ signal
2649
+ });
2650
+ } catch (error) {
2651
+ if (!refusesConsistencyArgument(error)) throw error;
2652
+ this.consistencyUnsupported = true;
2653
+ }
2654
+ }
2655
+ return this.sdk.GetDocument({
2656
+ identifier,
2657
+ view
2658
+ }, void 0, signal);
2659
+ }
2660
+ /**
2247
2661
  * Opens the realtime socket on the first subscriber.
2248
2662
  *
2249
2663
  * The subscription is a firehose - no `search` argument - and this client
@@ -2362,6 +2776,77 @@ var GraphQLReactorClient = class {
2362
2776
  }
2363
2777
  };
2364
2778
  /**
2779
+ * The read half of {@link GraphQLReactorClient}: every read is the client's
2780
+ * own, and nothing that writes is reachable from it.
2781
+ */
2782
+ var GraphQLReadHalf = class {
2783
+ client;
2784
+ constructor(client) {
2785
+ this.client = client;
2786
+ }
2787
+ get(identifier, view, signal, consistencyToken) {
2788
+ return this.client.get(identifier, view, signal, consistencyToken);
2789
+ }
2790
+ getMany(documentIds, view, signal, consistencyToken) {
2791
+ return this.client.getMany(documentIds, view, signal, consistencyToken);
2792
+ }
2793
+ find(search, view, paging, signal) {
2794
+ return this.client.find(search, view, paging, signal);
2795
+ }
2796
+ getOperations(documentIdentifier, view, filter, paging, signal) {
2797
+ return this.client.getOperations(documentIdentifier, view, filter, paging, signal);
2798
+ }
2799
+ subscribe(search, callback, view) {
2800
+ return this.client.subscribe(search, callback, view);
2801
+ }
2802
+ waitForJob(jobId, signal) {
2803
+ return this.client.waitForJob(jobId, signal);
2804
+ }
2805
+ getJobStatus(jobId, signal) {
2806
+ return this.client.getJobStatus(jobId, signal);
2807
+ }
2808
+ };
2809
+ /**
2810
+ * Sleeps for `ms`, or less when a waker in `wakers` fires first. Each sleep
2811
+ * adds its own waker and removes it when it ends.
2812
+ */
2813
+ function sleepUntilWoken(ms, wakers, signal) {
2814
+ return new Promise((resolve, reject) => {
2815
+ if (signal?.aborted) {
2816
+ reject(abortReason(signal));
2817
+ return;
2818
+ }
2819
+ const finish = () => {
2820
+ clearTimeout(timer);
2821
+ wakers.delete(finish);
2822
+ signal?.removeEventListener("abort", onAbort);
2823
+ };
2824
+ const wake = () => {
2825
+ finish();
2826
+ resolve();
2827
+ };
2828
+ const onAbort = () => {
2829
+ finish();
2830
+ if (signal) reject(abortReason(signal));
2831
+ };
2832
+ const timer = setTimeout(wake, ms);
2833
+ wakers.add(wake);
2834
+ signal?.addEventListener("abort", onAbort, { once: true });
2835
+ });
2836
+ }
2837
+ /**
2838
+ * Whether a request failed because the Switchboard's `document` query has no
2839
+ * `consistency` argument, or its schema no `ConsistencyTokenInput`.
2840
+ */
2841
+ function refusesConsistencyArgument(error) {
2842
+ const errors = error?.response?.errors;
2843
+ if (!Array.isArray(errors)) return false;
2844
+ return errors.some((entry) => {
2845
+ const message = entry?.message;
2846
+ return typeof message === "string" && (message.includes("\"consistency\"") || message.includes("\"ConsistencyTokenInput\""));
2847
+ });
2848
+ }
2849
+ /**
2365
2850
  * Whether a value is a {@link GraphQLReactorClient}, including one built by
2366
2851
  * another copy of this module.
2367
2852
  *
@@ -3166,6 +3651,7 @@ const phGlobalEventHandlerRegisterFunctions = {
3166
3651
  ...commonGlobalEventHandlerFunctions,
3167
3652
  reactorClientModule: addReactorClientModuleEventHandler,
3168
3653
  reactorClient: addReactorClientEventHandler,
3654
+ reactor: addReactorHalvesEventHandler,
3169
3655
  fullReactorClient: addFullReactorClientEventHandler,
3170
3656
  attachmentService: addAttachmentServiceEventHandler,
3171
3657
  features: addFeaturesEventHandler,
@@ -3409,6 +3895,6 @@ function useDocumentOperations(documentId, scope, options = {}) {
3409
3895
  return legacy ? legacyResult : primary;
3410
3896
  }
3411
3897
  //#endregion
3412
- export { addIsAnalyticsExternalProcessorsEnabledEventHandler as $, isRoutedModal as $i, useIsEditorDebugModeEnabled as $n, signStampedAction as $r, setIsDeleteLocalDrivesEnabled as $t, useDropTarget as A, renameDriveNode as Ai, useAnalyticsDatabaseName as An, phDocumentEditorConfigHooks as Ar, addVersionEventHandler as At, addCliVersionEventHandler as B, setFullReactorClient as Bi, useIsAddDriveEnabled as Bn, isGraphQLReactorClient as Br, setDrivesPreserveStrategy as Bt, usePackageDiscoveryService as C, deleteNode as Ci, setSentryRelease as Cn, useWarnOutdatedApp as Cr, addRouterBasenameEventHandler as Ct, addDraggingNodeEventHandler as D, getDocumentExtension as Di, setVersionCheckInterval as Dn, isExternalControlsEnabledEventFunctions as Dr, addStudioModeEventHandler as Dt, useGraphQLReactorClient as E, fetchDocumentOperations as Ei, setVersion as En, addIsExternalControlsEnabledEventHandler as Er, addSentryReleaseEventHandler as Et, setAttachmentService as F, isDocumentTypeSupported as Fi, useDrivesPreserveStrategy as Fn, useAllowedDocumentTypes as Fr, setAnalyticsDatabaseName as Ft, addFileUploadOperationsChunkSizeEventHandler as G, usePGlite as Gi, useIsAnalyticsExternalProcessorsEnabled as Gn, subscriptionsUrlFromGraphqlUrl as Gr, setIsAddDriveEnabled as Gt, addDisabledEditorsEventHandler as H, setReactorClientModule as Hi, useIsAddPublicDrivesEnabled as Hn, isAuthRefusalClose as Hr, setFileUploadOperationsChunkSize as Ht, useAttachmentService as I, addFullReactorClientEventHandler as Ii, useEnabledEditors as In, useIsDragAndDropEnabled as Ir, setBasePath as It, addIsAddDriveEnabledEventHandler as J, useSync as Ji, useIsDeleteLocalDrivesEnabled as Jn, subgraphUrlFromGraphqlUrl as Jr, setIsAnalyticsDatabaseWorkerEnabled as Jt, addGaTrackingIdEventHandler as K, useReactorClient as Ki, useIsCloudDrivesEnabled as Kn, SubgraphSdkRegistry as Kr, setIsAddLocalDrivesEnabled as Kt, addAllowListEventHandler as L, addReactorClientEventHandler as Li, useFileUploadOperationsChunkSize as Ln, useIsExternalControlsEnabled as Lr, setCliVersion as Lt, setFeatures as M, setPreferredEditorOnNode as Mi, useCliVersion as Mn, setAllowedDocumentTypes as Mr, phGlobalConfigHooks as Mt, useFeatures as N, upgradeDocument as Ni, useDefaultDrivesUrl as Nn, setIsDragAndDropEnabled as Nr, phGlobalConfigSetters as Nt, useDragNode as O, loadFile as Oi, setWarnOutdatedApp as On, phAppConfigHooks as Or, addSwitchboardUrlEventHandler as Ot, addAttachmentServiceEventHandler as P, getUserPermissions as Pi, useDisabledEditors as Pn, setIsExternalControlsEnabled as Pr, setAllowList as Pt, addIsAnalyticsEnabledEventHandler as Q, closePHModal as Qi, useIsDriveAnalyticsEnabled as Qn, prepareSignedActions as Qr, setIsDeleteCloudDrivesEnabled as Qt, addAnalyticsDatabaseNameEventHandler as R, addReactorClientModuleEventHandler as Ri, useGaTrackingId as Rn, GraphQLReactorClient as Rr, setDefaultDrivesUrl as Rt, setPackageDiscoveryService as S, copyNode$1 as Si, setSentryEnv as Sn, useVersionCheckInterval as Sr, addRequiresHardRefreshEventHandler as St, setGraphQLReactorClient as T, extractInitialState as Ti, setSwitchboardUrl as Tn, addIsDragAndDropEnabledEventHandler as Tr, addSentryEnvEventHandler as Tt, addDrivesPreserveStrategyEventHandler as U, useDatabase as Ui, useIsAnalyticsDatabaseWorkerEnabled as Un, makeAuthConnectionParams as Ur, setGaTrackingId as Ut, addDefaultDrivesUrlEventHandler as V, setReactorClient as Vi, useIsAddLocalDrivesEnabled as Vn, viewFilterInputFromViewFilter as Vr, setEnabledEditors as Vt, addEnabledEditorsEventHandler as W, useModelRegistry as Wi, useIsAnalyticsEnabled as Wn, startDocumentChangesSubscription as Wr, setIsAddCloudDrivesEnabled as Wt, addIsAddPublicDrivesEnabledEventHandler as X, MODAL_SEARCH_PARAM as Xi, useIsDiffAnalyticsEnabled as Xn, packageFromDocumentModels as Xr, setIsAnalyticsExternalProcessorsEnabled as Xt, addIsAddLocalDrivesEnabledEventHandler as Y, useSyncList as Yi, useIsDeletePublicDrivesEnabled as Yn, StaticPackageManager as Yr, setIsAnalyticsEnabled as Yt, addIsAnalyticsDatabaseWorkerEnabledEventHandler as Z, addModalEventHandler as Zi, useIsDocumentModelSelectionSettingsEnabled as Zn, resolveDocumentModelModule as Zr, setIsCloudDrivesEnabled as Zt, addSetSelectedDriveOnPopStateEventHandler as _, DEFAULT_DRIVE_EDITOR_ID as _i, setRenownNetworkId as _n, useSentryEnv as _r, addLogLevelEventHandler as _t, addPHEventHandlers as a, showDeleteNodeModal as aa, GraphQLWrongBackendError as ai, setIsEditorReadModeEnabled as an, useIsPublicDrivesEnabled as ar, addIsDocumentModelSelectionSettingsEnabledEventHandler as at, syncSelectionFromPath as b, addFileWithProgress as bi, setRouterBasename as bn, useSwitchboardUrl as br, addRenownNetworkIdEventHandler as bt, addToastEventHandler as c, usePHModal as ca, phDocumentFromMutation as ci, setIsExternalRelationalProcessorsEnabled as cn, useLocalDrivesEnabled as cr, addIsEditorReadModeEnabledEventHandler as ct, addSelectedTimelineRevisionEventHandler as d, useLinkProps as da, buildPulledDocument as di, setIsRelationalProcessorsEnabled as dn, useRenownChainId as dr, addIsExternalRelationalProcessorsEnabledEventHandler as dt, modalFromSearch as ea, stampAction as ei, setIsDeletePublicDrivesEnabled as en, useIsEditorReadModeEnabled as er, addIsCloudDrivesEnabledEventHandler as et, setSelectedTimelineRevision as f, usePHNavigation as fa, convertRemoteOperations as fi, setIsSentryTracingEnabled as fn, useRenownNetworkId as fr, addIsLocalDrivesEnabledEventHandler as ft, useSelectedTimelineItem as g, COMMON_PACKAGE_ID as gi, setRenownChainId as gn, useSentryDsn as gr, addLocalDrivesEnabledEventHandler as gt, setSelectedTimelineItem as h, screamingSnakeToCamel as hi, setRenownAdapters as hn, useRouterBasename as hr, addIsSentryTracingEnabledEventHandler as ht, useSwitchboardClient as i, showCreateDocumentModal as ia, GraphQLOperationNotSupportedError as ii, setIsEditorDebugModeEnabled as in, useIsLocalDrivesEnabled as ir, addIsDiffAnalyticsEnabledEventHandler as it, addFeaturesEventHandler as j, renameNode as ji, useBasePath as jn, phDocumentEditorConfigSetters as jr, addWarnOutdatedAppEventHandler as jt, useDropNode as k, moveNode$1 as ki, useAllowList as kn, phAppConfigSetters as kr, addVersionCheckIntervalEventHandler as kt, setPHToast as l, withoutModalSearch as la, revisionMapFromRevisionsList as li, setIsLocalDrivesEnabled as ln, useLogLevel as lr, addIsExternalPackagesEnabledEventHandler as lt, addSelectedTimelineItemEventHandler as m, useSetSearchParams as ma, hasRevisionConflict as mi, setLogLevel as mn, useRequiresHardRefresh as mr, addIsRelationalProcessorsEnabledEventHandler as mt, GraphQLReactorProvider as n, modalSearch as na, ReactorOperationFieldsFragmentDoc as ni, setIsDocumentModelSelectionSettingsEnabled as nn, useIsExternalProcessorsEnabled as nr, addIsDeleteLocalDrivesEnabledEventHandler as nt, callEventHandlerRegisterFunctions as o, showPHModal as oa, isoStringFromDateTime as oi, setIsExternalPackagesEnabled as on, useIsRelationalProcessorsEnabled as or, addIsDriveAnalyticsEnabledEventHandler as ot, useSelectedTimelineRevision as p, useSearchParams as pa, extractRevisionMap as pi, setLocalDrivesEnabled as pn, useRenownUrl as pr, addIsPublicDrivesEnabledEventHandler as pt, addIsAddCloudDrivesEnabledEventHandler as q, useReactorClientModule as qi, useIsDeleteCloudDrivesEnabled as qn, describeGraphQLDocument as qr, setIsAddPublicDrivesEnabled as qt, ensurePHEventHandlers as r, setPHModal as ra, BatchJobFailedError as ri, setIsDriveAnalyticsEnabled as rn, useIsExternalRelationalProcessorsEnabled as rr, addIsDeletePublicDrivesEnabledEventHandler as rt, commonGlobalEventHandlerFunctions as s, useModalLinkProps as sa, phDocumentFromGetDocument as si, setIsExternalProcessorsEnabled as sn, useIsSentryTracingEnabled as sr, addIsEditorDebugModeEnabledEventHandler as st, useDocumentOperations as t, modalHref as ta, MutateDocumentWithOperationsDocument as ti, setIsDiffAnalyticsEnabled as tn, useIsExternalPackagesEnabled as tr, addIsDeleteCloudDrivesEnabledEventHandler as tt, usePHToast as u, isPlainClick as ua, ConflictError as ui, setIsPublicDrivesEnabled as un, useRenownAdapters as ur, addIsExternalProcessorsEnabledEventHandler as ut, addSetSelectedNodeOnPopStateEventHandler as v, DRIVE_DOCUMENT_TYPES as vi, setRenownUrl as vn, useSentryRelease as vr, addRenownAdaptersEventHandler as vt, addGraphQLReactorClientEventHandler as w, exportFile as wi, setStudioMode as wn, addAllowedDocumentTypesEventHandler as wr, addSentryDsnEventHandler as wt, addPackageDiscoveryServiceEventHandler as x, addFolder$1 as xi, setSentryDsn as xn, useVersion as xr, addRenownUrlEventHandler as xt, addSyncSelectionOnPopStateEventHandler as y, addDocument as yi, setRequiresHardRefresh as yn, useStudioMode as yr, addRenownChainIdEventHandler as yt, addBasePathEventHandler as z, getFullReactorClient as zi, useIsAddCloudDrivesEnabled as zn, findIsServableOverGraphQL as zr, setDisabledEditors as zt };
3898
+ export { addIsAnalyticsExternalProcessorsEnabledEventHandler as $, useSync as $i, useIsEditorDebugModeEnabled as $n, prepareSignedActions as $r, setIsDeleteLocalDrivesEnabled as $t, useDropTarget as A, getDocumentExtension as Ai, useAnalyticsDatabaseName as An, phDocumentEditorConfigHooks as Ar, addVersionEventHandler as At, addCliVersionEventHandler as B, addReactorClientEventHandler as Bi, useIsAddDriveEnabled as Bn, isGraphQLReactorClient as Br, setDrivesPreserveStrategy as Bt, usePackageDiscoveryService as C, addFileWithProgress as Ci, setSentryRelease as Cn, useWarnOutdatedApp as Cr, addRouterBasenameEventHandler as Ct, addDraggingNodeEventHandler as D, exportFile as Di, setVersionCheckInterval as Dn, isExternalControlsEnabledEventFunctions as Dr, addStudioModeEventHandler as Dt, useGraphQLReactorClient as E, deleteNode as Ei, setVersion as En, addIsExternalControlsEnabledEventHandler as Er, addSentryReleaseEventHandler as Et, setAttachmentService as F, setPreferredEditorOnNode as Fi, useDrivesPreserveStrategy as Fn, useAllowedDocumentTypes as Fr, setAnalyticsDatabaseName as Ft, addFileUploadOperationsChunkSizeEventHandler as G, setReactorClient as Gi, useIsAnalyticsExternalProcessorsEnabled as Gn, startDocumentChangesSubscription as Gr, setIsAddDriveEnabled as Gt, addDisabledEditorsEventHandler as H, addReactorHalvesEventHandler as Hi, useIsAddPublicDrivesEnabled as Hn, createJobChangesSocket as Hr, setFileUploadOperationsChunkSize as Ht, useAttachmentService as I, upgradeDocument as Ii, useEnabledEditors as In, useIsDragAndDropEnabled as Ir, setBasePath as It, addIsAddDriveEnabledEventHandler as J, useModelRegistry as Ji, useIsDeleteLocalDrivesEnabled as Jn, describeGraphQLDocument as Jr, setIsAnalyticsDatabaseWorkerEnabled as Jt, addGaTrackingIdEventHandler as K, setReactorClientModule as Ki, useIsCloudDrivesEnabled as Kn, subscriptionsUrlFromGraphqlUrl as Kr, setIsAddLocalDrivesEnabled as Kt, addAllowListEventHandler as L, getUserPermissions as Li, useFileUploadOperationsChunkSize as Ln, useIsExternalControlsEnabled as Lr, setCliVersion as Lt, setFeatures as M, moveNode$1 as Mi, useCliVersion as Mn, setAllowedDocumentTypes as Mr, phGlobalConfigHooks as Mt, useFeatures as N, renameDriveNode as Ni, useDefaultDrivesUrl as Nn, setIsDragAndDropEnabled as Nr, phGlobalConfigSetters as Nt, useDragNode as O, extractInitialState as Oi, setWarnOutdatedApp as On, phAppConfigHooks as Or, addSwitchboardUrlEventHandler as Ot, addAttachmentServiceEventHandler as P, renameNode as Pi, useDisabledEditors as Pn, setIsExternalControlsEnabled as Pr, setAllowList as Pt, addIsAnalyticsEnabledEventHandler as Q, useReactorHalves as Qi, useIsDriveAnalyticsEnabled as Qn, resolveDocumentModelModule as Qr, setIsDeleteCloudDrivesEnabled as Qt, addAnalyticsDatabaseNameEventHandler as R, isDocumentTypeSupported as Ri, useGaTrackingId as Rn, GraphQLReactorClient as Rr, setDefaultDrivesUrl as Rt, setPackageDiscoveryService as S, addDocument as Si, setSentryEnv as Sn, useVersionCheckInterval as Sr, addRequiresHardRefreshEventHandler as St, setGraphQLReactorClient as T, copyNode$1 as Ti, setSwitchboardUrl as Tn, addIsDragAndDropEnabledEventHandler as Tr, addSentryEnvEventHandler as Tt, addDrivesPreserveStrategyEventHandler as U, getFullReactorClient as Ui, useIsAnalyticsDatabaseWorkerEnabled as Un, isAuthRefusalClose as Ur, setGaTrackingId as Ut, addDefaultDrivesUrlEventHandler as V, addReactorClientModuleEventHandler as Vi, useIsAddLocalDrivesEnabled as Vn, viewFilterInputFromViewFilter as Vr, setEnabledEditors as Vt, addEnabledEditorsEventHandler as W, setFullReactorClient as Wi, useIsAnalyticsEnabled as Wn, makeAuthConnectionParams as Wr, setIsAddCloudDrivesEnabled as Wt, addIsAddPublicDrivesEnabledEventHandler as X, useReactorClient as Xi, useIsDiffAnalyticsEnabled as Xn, StaticPackageManager as Xr, setIsAnalyticsExternalProcessorsEnabled as Xt, addIsAddLocalDrivesEnabledEventHandler as Y, usePGlite as Yi, useIsDeletePublicDrivesEnabled as Yn, subgraphUrlFromGraphqlUrl as Yr, setIsAnalyticsEnabled as Yt, addIsAnalyticsDatabaseWorkerEnabledEventHandler as Z, useReactorClientModule as Zi, useIsDocumentModelSelectionSettingsEnabled as Zn, packageFromDocumentModels as Zr, setIsCloudDrivesEnabled as Zt, addSetSelectedDriveOnPopStateEventHandler as _, usePHNavigation as _a, hasRevisionConflict as _i, setRenownNetworkId as _n, useSentryEnv as _r, addLogLevelEventHandler as _t, addPHEventHandlers as a, modalFromSearch as aa, BatchJobFailedError as ai, setIsEditorReadModeEnabled as an, useIsPublicDrivesEnabled as ar, addIsDocumentModelSelectionSettingsEnabledEventHandler as at, syncSelectionFromPath as b, DEFAULT_DRIVE_EDITOR_ID as bi, setRouterBasename as bn, useSwitchboardUrl as br, addRenownNetworkIdEventHandler as bt, addToastEventHandler as c, setPHModal as ca, JobFailedError as ci, setIsExternalRelationalProcessorsEnabled as cn, useLocalDrivesEnabled as cr, addIsEditorReadModeEnabledEventHandler as ct, addSelectedTimelineRevisionEventHandler as d, showPHModal as da, phDocumentFromMutation as di, setIsRelationalProcessorsEnabled as dn, useRenownChainId as dr, addIsExternalRelationalProcessorsEnabledEventHandler as dt, useSyncList as ea, signStampedAction as ei, setIsDeletePublicDrivesEnabled as en, useIsEditorReadModeEnabled as er, addIsCloudDrivesEnabledEventHandler as et, setSelectedTimelineRevision as f, useModalLinkProps as fa, revisionMapFromRevisionsList as fi, setIsSentryTracingEnabled as fn, useRenownNetworkId as fr, addIsLocalDrivesEnabledEventHandler as ft, useSelectedTimelineItem as g, useLinkProps as ga, extractRevisionMap as gi, setRenownChainId as gn, useSentryDsn as gr, addLocalDrivesEnabledEventHandler as gt, setSelectedTimelineItem as h, isPlainClick as ha, convertRemoteOperations as hi, setRenownAdapters as hn, useRouterBasename as hr, addIsSentryTracingEnabledEventHandler as ht, useSwitchboardClient as i, isRoutedModal as ia, ReactorOperationFieldsFragmentDoc as ii, setIsEditorDebugModeEnabled as in, useIsLocalDrivesEnabled as ir, addIsDiffAnalyticsEnabledEventHandler as it, addFeaturesEventHandler as j, loadFile as ji, useBasePath as jn, phDocumentEditorConfigSetters as jr, addWarnOutdatedAppEventHandler as jt, useDropNode as k, fetchDocumentOperations as ki, useAllowList as kn, phAppConfigSetters as kr, addVersionCheckIntervalEventHandler as kt, setPHToast as l, showCreateDocumentModal as la, isoStringFromDateTime as li, setIsLocalDrivesEnabled as ln, useLogLevel as lr, addIsExternalPackagesEnabledEventHandler as lt, addSelectedTimelineItemEventHandler as m, withoutModalSearch as ma, buildPulledDocument as mi, setLogLevel as mn, useRequiresHardRefresh as mr, addIsRelationalProcessorsEnabledEventHandler as mt, GraphQLReactorProvider as n, addModalEventHandler as na, GetDocumentAtConsistencyDocument as ni, setIsDocumentModelSelectionSettingsEnabled as nn, useIsExternalProcessorsEnabled as nr, addIsDeleteLocalDrivesEnabledEventHandler as nt, callEventHandlerRegisterFunctions as o, modalHref as oa, GraphQLOperationNotSupportedError as oi, setIsExternalPackagesEnabled as on, useIsRelationalProcessorsEnabled as or, addIsDriveAnalyticsEnabledEventHandler as ot, useSelectedTimelineRevision as p, usePHModal as pa, ConflictError as pi, setLocalDrivesEnabled as pn, useRenownUrl as pr, addIsPublicDrivesEnabledEventHandler as pt, addIsAddCloudDrivesEnabledEventHandler as q, useDatabase as qi, useIsDeleteCloudDrivesEnabled as qn, SubgraphSdkRegistry as qr, setIsAddPublicDrivesEnabled as qt, ensurePHEventHandlers as r, closePHModal as ra, MutateDocumentWithOperationsDocument as ri, setIsDriveAnalyticsEnabled as rn, useIsExternalRelationalProcessorsEnabled as rr, addIsDeletePublicDrivesEnabledEventHandler as rt, commonGlobalEventHandlerFunctions as s, modalSearch as sa, GraphQLWrongBackendError as si, setIsExternalProcessorsEnabled as sn, useIsSentryTracingEnabled as sr, addIsEditorDebugModeEnabledEventHandler as st, useDocumentOperations as t, MODAL_SEARCH_PARAM as ta, stampAction as ti, setIsDiffAnalyticsEnabled as tn, useIsExternalPackagesEnabled as tr, addIsDeleteCloudDrivesEnabledEventHandler as tt, usePHToast as u, showDeleteNodeModal as ua, phDocumentFromGetDocument as ui, setIsPublicDrivesEnabled as un, useRenownAdapters as ur, addIsExternalProcessorsEnabledEventHandler as ut, addSetSelectedNodeOnPopStateEventHandler as v, useSearchParams as va, screamingSnakeToCamel as vi, setRenownUrl as vn, useSentryRelease as vr, addRenownAdaptersEventHandler as vt, addGraphQLReactorClientEventHandler as w, addFolder$1 as wi, setStudioMode as wn, addAllowedDocumentTypesEventHandler as wr, addSentryDsnEventHandler as wt, addPackageDiscoveryServiceEventHandler as x, DRIVE_DOCUMENT_TYPES as xi, setSentryDsn as xn, useVersion as xr, addRenownUrlEventHandler as xt, addSyncSelectionOnPopStateEventHandler as y, useSetSearchParams as ya, COMMON_PACKAGE_ID as yi, setRequiresHardRefresh as yn, useStudioMode as yr, addRenownChainIdEventHandler as yt, addBasePathEventHandler as z, addFullReactorClientEventHandler as zi, useIsAddCloudDrivesEnabled as zn, findIsServableOverGraphQL as zr, setDisabledEditors as zt };
3413
3899
 
3414
- //# sourceMappingURL=document-operations-zQKFs_xu.js.map
3900
+ //# sourceMappingURL=document-operations-C4-irgHD.js.map