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

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 (43) hide show
  1. package/dist/{attachment-service-D-CKdGUb.d.ts → attachment-service-BoLudaH0.d.ts} +128 -30
  2. package/dist/attachment-service-BoLudaH0.d.ts.map +1 -0
  3. package/dist/{client-CI-3xGMZ.js → client-BUpynoY6.js} +114 -2
  4. package/dist/client-BUpynoY6.js.map +1 -0
  5. package/dist/{client-Ca_CA8VC.d.ts → client-XPGQrO4a.d.ts} +2 -2
  6. package/dist/client-XPGQrO4a.d.ts.map +1 -0
  7. package/dist/{dispatch-qujH7vLW.js → dispatch-C8J9jQ-o.js} +77 -9
  8. package/dist/dispatch-C8J9jQ-o.js.map +1 -0
  9. package/dist/{document-by-id-D1wsYWhq.js → document-by-id-Dpp76ZNE.js} +2 -2
  10. package/dist/{document-by-id-D1wsYWhq.js.map → document-by-id-Dpp76ZNE.js.map} +1 -1
  11. package/dist/{document-model-modules-DmLQhKvh.js → document-model-modules-XrYfGXt8.js} +254 -9
  12. package/dist/document-model-modules-XrYfGXt8.js.map +1 -0
  13. package/dist/{document-operations-C4-irgHD.js → document-operations-B0GZilXW.js} +452 -171
  14. package/dist/document-operations-B0GZilXW.js.map +1 -0
  15. package/dist/{global-CgzlPBc3.d.ts → global-BlOVLagj.d.ts} +140 -54
  16. package/dist/global-BlOVLagj.d.ts.map +1 -0
  17. package/dist/{index-CrVfRJO1.d.ts → index-Ck5Q0beA.d.ts} +2 -2
  18. package/dist/{index-CrVfRJO1.d.ts.map → index-Ck5Q0beA.d.ts.map} +1 -1
  19. package/dist/index.d.ts +69 -61
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +304 -87
  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-0yDJ-f9X.js → switchboard-CYTCYt4Z.js} +10 -48
  31. package/dist/switchboard-CYTCYt4Z.js.map +1 -0
  32. package/dist/{types-DOY-eHEk.d.ts → types-BNVqRNli.d.ts} +79 -2
  33. package/dist/types-BNVqRNli.d.ts.map +1 -0
  34. package/package.json +9 -9
  35. package/dist/attachment-service-D-CKdGUb.d.ts.map +0 -1
  36. package/dist/client-CI-3xGMZ.js.map +0 -1
  37. package/dist/client-Ca_CA8VC.d.ts.map +0 -1
  38. package/dist/dispatch-qujH7vLW.js.map +0 -1
  39. package/dist/document-model-modules-DmLQhKvh.js.map +0 -1
  40. package/dist/document-operations-C4-irgHD.js.map +0 -1
  41. package/dist/global-CgzlPBc3.d.ts.map +0 -1
  42. package/dist/switchboard-0yDJ-f9X.js.map +0 -1
  43. package/dist/types-DOY-eHEk.d.ts.map +0 -1
@@ -1,18 +1,18 @@
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-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";
2
+ import { D as queueOperations, E as queueActions, N as UnsupportedDocumentTypeError, O as uploadOperations, b as DOCUMENT_CHANGE_TYPE, f as DocumentCache, h as IDLE_OPERATIONS_ENTRY, i as setDocumentCache, k as DocumentModelNotFoundError, o as useDocumentCache, r as addDocumentCacheEventHandler, v as isOperationCache } from "./dispatch-C8J9jQ-o.js";
3
+ import { $ as makeAuthMiddleware, A as addDrivesEventHandler, B as invalidateDriveNodes, H as markLocalDriveWrite, L as addDriveNodesEventHandler, Q as ambientRenownTokenProvider, R as dropDriveNode, X as listAllDriveNodes, 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, z as getDriveNode } from "./document-model-modules-XrYfGXt8.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 { a as PhDocumentFieldsFragmentDoc, i as JobChangesDocument, n as DocumentChangesDocument, t as createClient$1 } from "./client-CI-3xGMZ.js";
5
+ import { a as PhDocumentFieldsFragmentDoc, i as JobChangesDocument, n as DocumentChangesDocument, t as createClient$1 } from "./client-BUpynoY6.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";
9
9
  import { logger } from "document-model";
10
- import { UnsupportedDocumentModelVersionError, actionSignerIdentity, actionSigningTarget, actions, assertAuthPreservedOnDuplicate, baseLoadFromInput, baseLoadFromInputVersioned, baseSaveToFileHandle, createCopyHeader, createPresignedHeader, createZip, deserializeSignature, documentModelDocumentType, generateId, hasDerivedDocumentId, hashDocumentStateForScope, isSignaturePolicy, normalizeDocumentModelVersion, replayDocumentVersioned, setName, setPreferredEditor, signaturePolicyOf, toTransportAction, withSignaturePolicy } from "@powerhousedao/shared/document-model";
11
- import { addFolder, copyNode, generateNodesCopy, handleTargetNameCollisions, isFileNode, isFolderNode, moveNode, updateNode } from "@powerhousedao/shared/document-drive";
10
+ import { PEER_CAPABILITIES, UnsupportedDocumentModelVersionError, actionSignerIdentity, actionSigningTarget, actions, assertAuthPreservedOnDuplicate, baseLoadFromInput, baseLoadFromInputVersioned, baseSaveToFileHandle, capSelection, createCopyHeader, createPresignedHeader, createZip, creationState, deserializeSignature, documentModelDocumentType, generateId, hasDerivedDocumentId, hashDocumentStateForScope, headNewDocument, isSignaturePolicy, localSupports, normalizeDocumentModelVersion, replayDocumentVersioned, selectDocumentModelModule, setName, setPreferredEditor, signaturePolicyOf, toTransportAction, withSignaturePolicy } from "@powerhousedao/shared/document-model";
11
+ import { addFolder, copyNode, driveDocumentModelModule, generateNodesCopy, handleTargetNameCollisions, isFileNode, isFolderNode, moveNode, updateNode } from "@powerhousedao/shared/document-drive";
12
12
  import { allPass, conditional, constant, forEachObj, funnel, isDefined, isNot, isStrictEqual, isString, isTruthy, once } from "remeda";
13
- import { GraphQLClient } from "graphql-request";
14
13
  import { gql } from "graphql-tag";
15
14
  import { Kind, print } from "graphql";
15
+ import { GraphQLClient } from "graphql-request";
16
16
  import { createClient } from "graphql-ws/client";
17
17
  //#region src/hooks/url-state.ts
18
18
  /** The nearest store's navigation, else the bound store's, else the browser's.
@@ -283,16 +283,26 @@ function getUserPermissions() {
283
283
  //#endregion
284
284
  //#region src/actions/document.ts
285
285
  const NON_DOMAIN_SCOPES = /* @__PURE__ */ new Set(["auth", "document"]);
286
+ /** Puts a node this tab just wrote into its drive's cache, so hooks show it
287
+ * before the drive change that follows the write is processed. Best effort:
288
+ * a client without a node reader is left to that change. */
289
+ async function rememberDriveNode(driveId, nodeId) {
290
+ try {
291
+ await getDriveNode(driveId, nodeId, { refresh: true });
292
+ } catch (error) {
293
+ logger.verbose("Caching the written node @id failed: @error", nodeId, error);
294
+ }
295
+ }
286
296
  /** An unreadable drive cannot be shown to hold no duplicate, so reads throw. */
287
297
  async function isDocumentInLocation(reactorClient, document, driveId, parentFolder) {
288
- const drive = await reactorClient.get(driveId);
289
- const nodeById = drive.state.global.nodes.find((node) => node.id === document.header.id);
290
- if (nodeById && nodeById.parentFolder === (parentFolder ?? null)) return {
298
+ const siblings = await listAllDriveNodes(reactorClient.drives, driveId, { parentFolder: parentFolder ?? null });
299
+ const nodeById = siblings.find((node) => node.id === document.header.id);
300
+ if (nodeById) return {
291
301
  isDuplicate: true,
292
302
  duplicateType: "id",
293
303
  nodeId: nodeById.id
294
304
  };
295
- const nodeByNameAndType = drive.state.global.nodes.find((node) => isFileNode(node) && node.name === document.header.name && node.documentType === document.header.documentType && node.parentFolder === (parentFolder ?? null));
305
+ const nodeByNameAndType = siblings.find((node) => isFileNode(node) && node.name === document.header.name && node.documentType === document.header.documentType);
296
306
  if (nodeByNameAndType) return {
297
307
  isDuplicate: true,
298
308
  duplicateType: "name",
@@ -369,12 +379,9 @@ async function fetchDocumentOperations(reactorClient, document, pageSize = 100)
369
379
  return operations;
370
380
  }
371
381
  function extractInitialState(documentScopeOps) {
372
- const upgradeOp = documentScopeOps.find((op) => op.action.type === "UPGRADE_DOCUMENT");
373
- if (!upgradeOp) throw new Error("No UPGRADE_DOCUMENT operation found — document is invalid");
374
- const input = upgradeOp.action.input;
375
- const initialState = input.initialState ?? input.state;
376
- if (!initialState) throw new Error("UPGRADE_DOCUMENT operation has no initialState — document is invalid");
377
- return initialState;
382
+ const initialState = creationState(documentScopeOps);
383
+ if (initialState) return initialState;
384
+ throw new Error(documentScopeOps.some((op) => op.action.type === "UPGRADE_DOCUMENT") ? "UPGRADE_DOCUMENT operation has no initialState — document is invalid" : "No UPGRADE_DOCUMENT operation found — document is invalid");
378
385
  }
379
386
  function filterDomainOperations(operations) {
380
387
  return Object.fromEntries(Object.entries(operations).filter(([scope]) => !NON_DOMAIN_SCOPES.has(scope)));
@@ -492,20 +499,16 @@ async function addDocument(driveId, name, documentType, parentFolder, document,
492
499
  if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to create documents");
493
500
  const reactorClient = getFullReactorClient();
494
501
  if (!reactorClient) throw new Error("ReactorClient not initialized");
495
- let documentModelModule;
496
- if (documentModelVersion !== void 0) {
497
- const { results: documentModelModules } = await reactorClient.read.getDocumentModelModules();
498
- const module = documentModelModules.find((m) => m.documentModel.global.id === documentType && (m.version ?? 1) === documentModelVersion);
499
- if (!module) throw new Error(`Document model not found for type: ${documentType} with version: ${documentModelVersion}`);
500
- documentModelModule = module;
501
- } else documentModelModule = await reactorClient.read.getDocumentModelModule(documentType);
502
- const newDocument = document ?? withSignaturePolicy(documentModelModule.utils.createDocument(), await reactorClient.read.getCreateSignaturePolicy());
503
- if (!document) newDocument.state.document.version = documentModelModule.version ?? 1;
502
+ const newDocument = document ?? await reactorClient.read.newDocument(documentType, {
503
+ parentIdentifier: driveId,
504
+ documentModelVersion
505
+ });
504
506
  newDocument.header.name = name;
505
507
  if (preferredEditor) newDocument.header.meta = {
506
508
  ...newDocument.header.meta,
507
509
  preferredEditor
508
510
  };
511
+ markLocalDriveWrite(driveId);
509
512
  let newDoc;
510
513
  try {
511
514
  newDoc = await (await reactorClient.write.drives.addFile(driveId, newDocument, parentFolder)).document();
@@ -513,6 +516,8 @@ async function addDocument(driveId, name, documentType, parentFolder, document,
513
516
  logger.error("Error adding document: @error", e);
514
517
  throw new Error("There was an error adding document", { cause: e });
515
518
  }
519
+ await rememberDriveNode(driveId, newDoc.header.id);
520
+ await getDriveNode(driveId, newDoc.header.id, { refresh: true }).catch(() => void 0);
516
521
  return {
517
522
  id: newDoc.header.id,
518
523
  name: newDoc.header.name,
@@ -552,7 +557,7 @@ async function createImportedDocument(write, document, driveId, name, parentFold
552
557
  let documentId = keepsId ? document.header.id : generateId();
553
558
  for (let attempt = 1;; attempt++) {
554
559
  let header;
555
- if (!v2Required) header = createPresignedHeader(documentId, document.header.documentType);
560
+ if (!v2Required) header = createPresignedHeader(documentId, document.header.documentType, document.header.protocolVersions);
556
561
  else if (keepsId && attempt === 1) {
557
562
  header = createPresignedHeader(documentId, document.header.documentType);
558
563
  header.createdAtUtcIso = document.header.createdAtUtcIso;
@@ -673,9 +678,11 @@ async function addFileWithProgress(file, driveId, name, parentFolder, onProgress
673
678
  stage: "initializing",
674
679
  progress: 10
675
680
  });
681
+ markLocalDriveWrite(driveId);
676
682
  const created = await createImportedDocument(reactor.write, document, driveId, name, parentFolder);
677
683
  const documentId = created.documentId;
678
684
  const fileNode = created.fileNode;
685
+ await rememberDriveNode(driveId, documentId);
679
686
  onProgress?.({
680
687
  stage: "initializing",
681
688
  progress: 20
@@ -739,11 +746,13 @@ async function addFolder$1(driveId, name, parentFolder) {
739
746
  if (!reactorClient) throw new Error("ReactorClient not initialized");
740
747
  await reactorClient.read.get(driveId);
741
748
  const folderId = generateId();
742
- const node = (await (await reactorClient.write.execute(driveId, "main", [addFolder({
749
+ markLocalDriveWrite(driveId);
750
+ await (await reactorClient.write.execute(driveId, "main", [addFolder({
743
751
  id: folderId,
744
752
  name,
745
753
  parentFolder
746
- })])).document()).state.global.nodes.find((node) => node.id === folderId);
754
+ })])).readable;
755
+ const node = await getDriveNode(driveId, folderId, { refresh: true });
747
756
  if (!node || !isFolderNode(node)) throw new Error("There was an error adding folder");
748
757
  return node;
749
758
  }
@@ -752,7 +761,9 @@ async function deleteNode(driveId, nodeId) {
752
761
  if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to delete documents");
753
762
  const reactorClient = getFullReactorClient();
754
763
  if (!reactorClient) throw new Error("ReactorClient not initialized");
764
+ markLocalDriveWrite(driveId);
755
765
  await (await reactorClient.write.drives.removeNode(driveId, nodeId)).readable;
766
+ dropDriveNode(driveId, nodeId);
756
767
  }
757
768
  async function renameNode(driveId, nodeId, name) {
758
769
  const { isAllowedToCreateDocuments } = getUserPermissions();
@@ -760,10 +771,12 @@ async function renameNode(driveId, nodeId, name) {
760
771
  const reactorClient = getPHStore()?.reactorClient;
761
772
  if (!reactorClient) throw new Error("ReactorClient not initialized");
762
773
  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({
774
+ markLocalDriveWrite(driveId);
775
+ await (await reactorClient.write.execute(driveId, "main", [updateNode({
764
776
  id: nodeId,
765
777
  name
766
- })])).document()).state.global.nodes.find((n) => n.id === nodeId);
778
+ })])).readable;
779
+ const node = await getDriveNode(driveId, nodeId, { refresh: true });
767
780
  if (!node) throw new Error("There was an error renaming node in the drive");
768
781
  return node;
769
782
  }
@@ -773,10 +786,12 @@ async function renameDriveNode(driveId, nodeId, name) {
773
786
  const reactorClient = getPHStore()?.reactorClient;
774
787
  if (!reactorClient) throw new Error("ReactorClient not initialized");
775
788
  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({
789
+ markLocalDriveWrite(driveId);
790
+ await (await reactorClient.write.execute(driveId, "main", [updateNode({
777
791
  id: nodeId,
778
792
  name
779
- })])).document()).state.global.nodes.find((n) => n.id === nodeId);
793
+ })])).readable;
794
+ return getDriveNode(driveId, nodeId, { refresh: true });
780
795
  }
781
796
  async function setPreferredEditorOnNode(nodeId, preferredEditor) {
782
797
  const { isAllowedToCreateDocuments } = getUserPermissions();
@@ -794,20 +809,26 @@ async function moveNodeById(args) {
794
809
  if (!reactorClient) throw new Error("ReactorClient not initialized");
795
810
  const targetParentFolder = conditional(targetId, [isNot(isDefined), constant(void 0)], [isStrictEqual(driveId), constant(void 0)], constant(targetId));
796
811
  if (isStrictEqual(targetParentFolder, srcId)) return;
797
- return (await reactorClient.write.execute(driveId, "main", [moveNode({
812
+ markLocalDriveWrite(driveId);
813
+ const moved = await (await reactorClient.write.execute(driveId, "main", [moveNode({
798
814
  srcFolder: srcId,
799
815
  targetParentFolder
800
816
  })])).document();
817
+ await rememberDriveNode(driveId, srcId);
818
+ return moved;
801
819
  }
802
820
  async function moveNode$1(driveId, src, target) {
803
821
  const { isAllowedToCreateDocuments } = getUserPermissions();
804
822
  if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to move documents");
805
823
  const reactorClient = getPHStore()?.reactorClient;
806
824
  if (!reactorClient) throw new Error("ReactorClient not initialized");
807
- return (await reactorClient.write.execute(driveId, "main", [moveNode({
825
+ markLocalDriveWrite(driveId);
826
+ const moved = await (await reactorClient.write.execute(driveId, "main", [moveNode({
808
827
  srcFolder: src.id,
809
828
  targetParentFolder: target?.id
810
829
  })])).document();
830
+ await rememberDriveNode(driveId, src.id);
831
+ return moved;
811
832
  }
812
833
  /**
813
834
  * Duplicates a document under a new id using version-aware replay.
@@ -829,7 +850,10 @@ async function _duplicateDocument(reactor, document, newId = generateId(), drive
829
850
  reducers,
830
851
  upgradeManifest
831
852
  };
832
- const selected = await reactor.getCreateProtocolVersions(driveId);
853
+ const selected = await reactor.getCreateProtocolVersions({
854
+ documentType: document.header.documentType,
855
+ parentIdentifier: driveId
856
+ });
833
857
  const header = createCopyHeader({
834
858
  documentType: document.header.documentType,
835
859
  protocolVersions: document.header.protocolVersions ? {
@@ -847,17 +871,18 @@ async function copyNode$1(driveId, src, target) {
847
871
  const { isAllowedToCreateDocuments } = getUserPermissions();
848
872
  if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to copy documents");
849
873
  const drive = await reactor.read.get(driveId);
874
+ const driveNodes = await listAllDriveNodes(reactor.read.drives, driveId);
850
875
  const copyNodesInput = generateNodesCopy({
851
876
  srcId: src.id,
852
877
  targetParentFolder: target?.id,
853
878
  targetName: src.name
854
- }, () => generateId(), drive.state.global.nodes);
879
+ }, () => generateId(), driveNodes);
855
880
  const resolvedNamesMap = /* @__PURE__ */ new Map();
856
881
  for (const copyNodeInput of copyNodesInput) {
857
- const node = drive.state.global.nodes.find((n) => n.id === copyNodeInput.srcId);
882
+ const node = driveNodes.find((n) => n.id === copyNodeInput.srcId);
858
883
  if (node) {
859
884
  const resolvedName = handleTargetNameCollisions({
860
- nodes: drive.state.global.nodes,
885
+ nodes: driveNodes,
861
886
  srcName: copyNodeInput.targetName || node.name,
862
887
  srcKind: isFileNode(node) ? "file" : "folder",
863
888
  targetParentFolder: copyNodeInput.targetParentFolder || null
@@ -866,9 +891,10 @@ async function copyNode$1(driveId, src, target) {
866
891
  }
867
892
  }
868
893
  const fileNodesToCopy = copyNodesInput.filter((copyNodeInput) => {
869
- const node = drive.state.global.nodes.find((node) => node.id === copyNodeInput.srcId);
894
+ const node = driveNodes.find((node) => node.id === copyNodeInput.srcId);
870
895
  return node !== void 0 && isFileNode(node);
871
896
  });
897
+ markLocalDriveWrite(driveId);
872
898
  for (const fileNodeToCopy of fileNodesToCopy) try {
873
899
  const document = await reactor.read.get(fileNodeToCopy.srcId);
874
900
  const duplicatedDocument = await _duplicateDocument(reactor.read, document, fileNodeToCopy.targetId, driveId);
@@ -880,7 +906,10 @@ async function copyNode$1(driveId, src, target) {
880
906
  logger.error(`Error copying document ${fileNodeToCopy.srcId}: ${String(e)}`);
881
907
  }
882
908
  const copyActions = copyNodesInput.map((copyNodeInput) => copyNode(copyNodeInput));
883
- return await queueActions(drive, copyActions);
909
+ markLocalDriveWrite(driveId);
910
+ const copied = await queueActions(drive, copyActions);
911
+ invalidateDriveNodes(driveId);
912
+ return copied;
884
913
  }
885
914
  /**
886
915
  * Upgrades a document to a newer document model version. Defaults to the
@@ -892,6 +921,91 @@ async function upgradeDocument(documentId, toVersion) {
892
921
  return (await reactorClient.write.upgradeDocument(documentId, toVersion)).document();
893
922
  }
894
923
  //#endregion
924
+ //#region src/graphql-client/errors.ts
925
+ /** A call the Switchboard GraphQL surface cannot express. */
926
+ var GraphQLOperationNotSupportedError = class extends Error {
927
+ name = "GraphQLOperationNotSupportedError";
928
+ operation;
929
+ constructor(operation, reason) {
930
+ super(`GraphQLReactorClient.${operation} is not supported: ${reason}`);
931
+ this.operation = operation;
932
+ }
933
+ static isError(error) {
934
+ return Error.isError(error) && error.name === "GraphQLOperationNotSupportedError";
935
+ }
936
+ };
937
+ /**
938
+ * The Switchboard refused a request with 421 Misdirected Request: the
939
+ * `Drive-Id` it carried names a drive that Switchboard does not own.
940
+ */
941
+ var GraphQLWrongBackendError = class extends Error {
942
+ name = "GraphQLWrongBackendError";
943
+ status = 421;
944
+ /** The drive the Switchboard refused, or `""` when its answer names none. */
945
+ driveId;
946
+ /** The response body, parsed when it is JSON. */
947
+ payload;
948
+ constructor(driveId, payload, options) {
949
+ super(`The Switchboard does not serve drive ${driveId === "" ? "(unnamed)" : driveId}: 421 Misdirected Request`, options);
950
+ this.driveId = driveId;
951
+ this.payload = payload;
952
+ }
953
+ static isError(error) {
954
+ return Error.isError(error) && error.name === "GraphQLWrongBackendError" && typeof error.driveId === "string";
955
+ }
956
+ };
957
+ /**
958
+ * The reactor's `BatchJobFailedError`, rebuilt from a batch result; this entry
959
+ * imports the reactor for types only. The shared name lets either `isError`
960
+ * recognise it.
961
+ */
962
+ var BatchJobFailedError = class extends Error {
963
+ name = "BatchJobFailedError";
964
+ key;
965
+ jobs;
966
+ constructor(key, jobs) {
967
+ const failure = jobs[key].error;
968
+ const cause = new Error(failure?.message ?? "Job failed");
969
+ cause.name = failure?.name ?? "Error";
970
+ super(failure?.message ?? "Job failed", { cause });
971
+ this.key = key;
972
+ this.jobs = jobs;
973
+ }
974
+ static isError(error) {
975
+ return Error.isError(error) && error.name === "BatchJobFailedError" && typeof error.key === "string" && typeof error.jobs === "object";
976
+ }
977
+ };
978
+ /** A validation error naming root field `field` unknown: a host from before it. */
979
+ function queriesUnknownField(error, field) {
980
+ return hasErrorStarting(error, `Cannot query field "${field}" on type "`);
981
+ }
982
+ /** A validation error naming `argument` unknown: a host from before it. */
983
+ function queriesUnknownArgument(error, argument) {
984
+ return hasErrorStarting(error, `Unknown argument "${argument}" on field "`);
985
+ }
986
+ function hasErrorStarting(error, prefix) {
987
+ const errors = error?.response?.errors;
988
+ if (!Array.isArray(errors)) return false;
989
+ return errors.some((entry) => typeof entry?.message === "string" && entry.message.startsWith(prefix));
990
+ }
991
+ /**
992
+ * The reactor's `JobFailedError`, rebuilt from a job the Switchboard reported
993
+ * FAILED; this entry imports the reactor for types only. A write handle's
994
+ * stage rejects with it. The message is the job error's message, as the
995
+ * reactor's is.
996
+ */
997
+ var JobFailedError = class extends Error {
998
+ name = "JobFailedError";
999
+ job;
1000
+ constructor(job) {
1001
+ super(job.error?.message);
1002
+ this.job = job;
1003
+ }
1004
+ static isError(error) {
1005
+ return Error.isError(error) && error.name === "JobFailedError" && typeof error.job === "object";
1006
+ }
1007
+ };
1008
+ //#endregion
895
1009
  //#region src/constants.ts
896
1010
  const DEFAULT_DRIVE_EDITOR_ID = "powerhouse/generic-drive-explorer";
897
1011
  const COMMON_PACKAGE_ID = "powerhouse/common";
@@ -949,7 +1063,11 @@ function convertRemoteOperations(operationsByScope) {
949
1063
  for (const [scope, remoteOps] of Object.entries(operationsByScope)) operations[scope] = remoteOps.map((op) => remoteOperationToLocal(op));
950
1064
  return operations;
951
1065
  }
952
- /** Reconstruct a PHDocument from remote document data and operations. */
1066
+ /**
1067
+ * Reconstruct a PHDocument from remote document data and operations; the
1068
+ * header carries the remote protocol versions. `initialDoc` supplies the rest
1069
+ * of the header, and the initial state when the operations do not record one.
1070
+ */
953
1071
  function buildPulledDocument(remoteDoc, operations, initialDoc, branch) {
954
1072
  return {
955
1073
  header: {
@@ -961,14 +1079,34 @@ function buildPulledDocument(remoteDoc, operations, initialDoc, branch) {
961
1079
  createdAtUtcIso: typeof remoteDoc.createdAtUtcIso === "string" ? remoteDoc.createdAtUtcIso : remoteDoc.createdAtUtcIso.toISOString(),
962
1080
  lastModifiedAtUtcIso: typeof remoteDoc.lastModifiedAtUtcIso === "string" ? remoteDoc.lastModifiedAtUtcIso : remoteDoc.lastModifiedAtUtcIso.toISOString(),
963
1081
  revision: Object.fromEntries(remoteDoc.revisionsList.map((r) => [r.scope, r.revision])),
964
- branch
1082
+ branch,
1083
+ ...remoteDoc.protocolVersions != null ? { protocolVersions: remoteDoc.protocolVersions } : {}
965
1084
  },
966
1085
  state: remoteDoc.state,
967
- initialState: initialDoc.initialState,
1086
+ initialState: creationState(operations.document ?? []) ?? initialDoc.initialState,
968
1087
  operations,
969
1088
  clipboard: []
970
1089
  };
971
1090
  }
1091
+ /** `document` as created: its header and initial state, without scope operations. */
1092
+ function uncreatedDocument(document) {
1093
+ const { header, initialState } = structuredClone({
1094
+ header: document.header,
1095
+ initialState: document.initialState
1096
+ });
1097
+ return {
1098
+ header,
1099
+ state: initialState,
1100
+ initialState,
1101
+ operations: {},
1102
+ clipboard: []
1103
+ };
1104
+ }
1105
+ /** An uncreated `document` under `policy`; a legacy one keeps its id. */
1106
+ function underSignaturePolicy(document, policy) {
1107
+ if (signaturePolicyOf(document.header) === policy) return document;
1108
+ return withSignaturePolicy(document, policy, { id: document.header.id });
1109
+ }
972
1110
  /** Extract revision map from a remote document's revisionsList. */
973
1111
  function extractRevisionMap(revisionsList) {
974
1112
  return Object.fromEntries(revisionsList.map((r) => [r.scope, r.revision]));
@@ -1065,77 +1203,184 @@ function isoStringFromDateTime(value) {
1065
1203
  return value instanceof Date ? value.toISOString() : value;
1066
1204
  }
1067
1205
  //#endregion
1068
- //#region src/graphql-client/errors.ts
1069
- /** A call the Switchboard GraphQL surface cannot express. */
1070
- var GraphQLOperationNotSupportedError = class extends Error {
1071
- name = "GraphQLOperationNotSupportedError";
1072
- operation;
1073
- constructor(operation, reason) {
1074
- super(`GraphQLReactorClient.${operation} is not supported: ${reason}`);
1075
- this.operation = operation;
1076
- }
1077
- static isError(error) {
1078
- return Error.isError(error) && error.name === "GraphQLOperationNotSupportedError";
1079
- }
1080
- };
1206
+ //#region src/graphql-client/drive-nodes.ts
1207
+ /** Page size {@link GraphQLDriveNodeSource.listAll} reads a drive in. */
1208
+ const LIST_ALL_PAGE_LIMIT = 1e3;
1209
+ const DEFAULT_LIMIT$1 = 100;
1081
1210
  /**
1082
- * The Switchboard refused a request with 421 Misdirected Request: the
1083
- * `Drive-Id` it carried names a drive that Switchboard does not own.
1211
+ * The reactor subgraph's type-neutral node queries (`driveNodes`, `driveNode`,
1212
+ * `driveDescendants`) as an {@link IDriveNodeSource}, so a browser reads a
1213
+ * legacy drive and a reactor-drive alike. The Switchboard serves only the
1214
+ * nodes the caller may read. Drive ids must be canonical ids, not slugs.
1084
1215
  */
1085
- var GraphQLWrongBackendError = class extends Error {
1086
- name = "GraphQLWrongBackendError";
1087
- status = 421;
1088
- /** The drive the Switchboard refused, or `""` when its answer names none. */
1089
- driveId;
1090
- /** The response body, parsed when it is JSON. */
1091
- payload;
1092
- constructor(driveId, payload, options) {
1093
- super(`The Switchboard does not serve drive ${driveId === "" ? "(unnamed)" : driveId}: 421 Misdirected Request`, options);
1094
- this.driveId = driveId;
1095
- this.payload = payload;
1216
+ var GraphQLDriveNodeSource = class {
1217
+ queries;
1218
+ headersFor;
1219
+ constructor(queries, headersFor = () => void 0) {
1220
+ this.queries = queries;
1221
+ this.headersFor = headersFor;
1096
1222
  }
1097
- static isError(error) {
1098
- return Error.isError(error) && error.name === "GraphQLWrongBackendError" && typeof error.driveId === "string";
1223
+ async getNode(driveId, nodeId, signal) {
1224
+ const result = await this.queries.GetDriveNode({
1225
+ driveId,
1226
+ id: nodeId
1227
+ }, this.headersFor(driveId), signal);
1228
+ return result.driveNode ? toRecord(result.driveNode) : void 0;
1099
1229
  }
1100
- };
1101
- /**
1102
- * The reactor's `BatchJobFailedError`, rebuilt from a batch result; this entry
1103
- * imports the reactor for types only. The shared name lets either `isError`
1104
- * recognise it.
1105
- */
1106
- var BatchJobFailedError = class extends Error {
1107
- name = "BatchJobFailedError";
1108
- key;
1109
- jobs;
1110
- constructor(key, jobs) {
1111
- const failure = jobs[key].error;
1112
- const cause = new Error(failure?.message ?? "Job failed");
1113
- cause.name = failure?.name ?? "Error";
1114
- super(failure?.message ?? "Job failed", { cause });
1115
- this.key = key;
1116
- this.jobs = jobs;
1230
+ async listChildren(driveId, parentFolder, paging, signal, kind) {
1231
+ const cursor = startCursor(paging?.cursor);
1232
+ const page = (await this.queries.GetDriveNodes({
1233
+ driveId,
1234
+ ...parentFolder === void 0 ? {} : { parentFolder },
1235
+ paging: paging ? {
1236
+ cursor,
1237
+ limit: paging.limit
1238
+ } : void 0,
1239
+ kind: kind === void 0 ? void 0 : kind === "file" ? "FILE" : "FOLDER"
1240
+ }, this.headersFor(driveId), signal)).driveNodes;
1241
+ const nextCursor = page.hasMore ? page.nextCursor ?? void 0 : void 0;
1242
+ return {
1243
+ results: page.results.map(toRecord),
1244
+ options: {
1245
+ cursor,
1246
+ limit: paging?.limit ?? DEFAULT_LIMIT$1
1247
+ },
1248
+ ...nextCursor !== void 0 ? { nextCursor } : {}
1249
+ };
1117
1250
  }
1118
- static isError(error) {
1119
- return Error.isError(error) && error.name === "BatchJobFailedError" && typeof error.key === "string" && typeof error.jobs === "object";
1251
+ async getDescendants(driveId, root, signal) {
1252
+ return (await this.queries.GetDriveDescendants({
1253
+ driveId,
1254
+ root
1255
+ }, this.headersFor(driveId), signal)).driveDescendants.map(toRecord);
1256
+ }
1257
+ async listAll(driveId, signal) {
1258
+ const nodes = [];
1259
+ let cursor = "";
1260
+ for (;;) {
1261
+ const page = await this.listChildren(driveId, void 0, {
1262
+ cursor,
1263
+ limit: LIST_ALL_PAGE_LIMIT
1264
+ }, signal);
1265
+ nodes.push(...page.results);
1266
+ if (page.nextCursor === void 0 || page.nextCursor === cursor) return nodes;
1267
+ cursor = page.nextCursor;
1268
+ }
1120
1269
  }
1121
1270
  };
1122
1271
  /**
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.
1272
+ * `read.drives` over a node source: the reactor's {@link IDriveReadClient},
1273
+ * answering in the legacy `Node` shape for every drive type.
1127
1274
  */
1128
- var JobFailedError = class extends Error {
1129
- name = "JobFailedError";
1130
- job;
1131
- constructor(job) {
1132
- super(job.error?.message);
1133
- this.job = job;
1275
+ var GraphQLDriveReadClient = class {
1276
+ nodes;
1277
+ constructor(nodes) {
1278
+ this.nodes = nodes;
1134
1279
  }
1135
- static isError(error) {
1136
- return Error.isError(error) && error.name === "JobFailedError" && typeof error.job === "object";
1280
+ async getNode(driveIdentifier, nodeId, signal) {
1281
+ const record = await this.nodes.getNode(driveIdentifier, nodeId, signal);
1282
+ if (!record) throw new Error(`Node ${nodeId} not found in drive ${driveIdentifier}`);
1283
+ return toLegacyNode(record);
1284
+ }
1285
+ async listNodes(driveIdentifier, parentFolder, paging, signal) {
1286
+ const page = await this.nodes.listChildren(driveIdentifier, parentFolder, paging, signal);
1287
+ const nextCursor = page.nextCursor;
1288
+ return {
1289
+ results: page.results.map(toLegacyNode),
1290
+ options: page.options,
1291
+ ...nextCursor !== void 0 ? {
1292
+ nextCursor,
1293
+ next: () => this.listNodes(driveIdentifier, parentFolder, {
1294
+ cursor: nextCursor,
1295
+ limit: page.options.limit
1296
+ }, signal)
1297
+ } : {}
1298
+ };
1137
1299
  }
1138
1300
  };
1301
+ /** A node record in the legacy `Node` shape. */
1302
+ function toLegacyNode(node) {
1303
+ if (node.kind === "file") return {
1304
+ id: node.id,
1305
+ kind: "file",
1306
+ name: node.name,
1307
+ parentFolder: node.parentFolder,
1308
+ documentType: node.documentType ?? ""
1309
+ };
1310
+ return {
1311
+ id: node.id,
1312
+ kind: "folder",
1313
+ name: node.name,
1314
+ parentFolder: node.parentFolder
1315
+ };
1316
+ }
1317
+ function toRecord(node) {
1318
+ const base = {
1319
+ id: node.id,
1320
+ driveId: node.driveId,
1321
+ name: node.name,
1322
+ parentFolder: node.parentFolder ?? null
1323
+ };
1324
+ return "documentType" in node ? {
1325
+ ...base,
1326
+ kind: "file",
1327
+ documentType: node.documentType
1328
+ } : {
1329
+ ...base,
1330
+ kind: "folder"
1331
+ };
1332
+ }
1333
+ /** The offset-style "0" other listings start from means the first page here too. */
1334
+ function startCursor(cursor) {
1335
+ return cursor === void 0 || cursor === "0" ? "" : cursor;
1336
+ }
1337
+ //#endregion
1338
+ //#region src/graphql-client/create-defaults.ts
1339
+ /** The host's policy for a new document; a host without `createDefaults` is refused, as a guess could under-sign. */
1340
+ async function readCreateSignaturePolicy(sdk, signal) {
1341
+ const defaults = await readCreateDefaults(sdk, void 0, signal);
1342
+ if (defaults === void 0) throw new GraphQLOperationNotSupportedError("getCreateSignaturePolicy", "the Switchboard predates the createDefaults query");
1343
+ const { signaturePolicy } = defaults;
1344
+ if (!isSignaturePolicy(signaturePolicy)) throw new Error(`The Switchboard answered an unknown create signature policy: ${signaturePolicy}`);
1345
+ return signaturePolicy;
1346
+ }
1347
+ /** The host's per-type selection, capped at what this build runs and fitted to `modules`; baseline from an old host. */
1348
+ async function readCreateProtocolVersions(sdk, { documentType, parentIdentifier }, modules, signal) {
1349
+ const host = await hostCreateProtocolVersions(sdk, documentType, parentIdentifier, signal);
1350
+ return capSelection(host, PEER_CAPABILITIES, localSupports(PEER_CAPABILITIES, {}));
1351
+ }
1352
+ /** The Switchboard's selection; undefined from a host without `createDefaults`. */
1353
+ async function hostCreateProtocolVersions(sdk, documentType, parentIdentifier, signal) {
1354
+ if (documentType !== void 0) try {
1355
+ return protocolVersionsFrom((await sdk.GetCreateProtocolVersions({
1356
+ documentType,
1357
+ parentIdOrSlug: parentIdentifier
1358
+ }, void 0, signal)).createDefaults.protocolVersions);
1359
+ } catch (error) {
1360
+ if (queriesUnknownField(error, "createDefaults")) return void 0;
1361
+ if (!queriesUnknownArgument(error, "documentType")) throw error;
1362
+ }
1363
+ const defaults = await readCreateDefaults(sdk, parentIdentifier, signal);
1364
+ return defaults && protocolVersionsFrom(defaults.protocolVersions);
1365
+ }
1366
+ /** The reactor-wide `createDefaults`; undefined from a host without the query. */
1367
+ async function readCreateDefaults(sdk, parentIdentifier, signal) {
1368
+ try {
1369
+ return (await sdk.GetCreateDefaults({ parentIdOrSlug: parentIdentifier }, void 0, signal)).createDefaults;
1370
+ } catch (error) {
1371
+ if (queriesUnknownField(error, "createDefaults")) return;
1372
+ throw error;
1373
+ }
1374
+ }
1375
+ function protocolVersionsFrom(value) {
1376
+ if (typeof value !== "object" || value === null || Array.isArray(value)) throw new Error("The Switchboard answered malformed create protocol versions");
1377
+ const versions = {};
1378
+ for (const [protocol, version] of Object.entries(value)) {
1379
+ if (typeof version !== "number" || !Number.isInteger(version)) throw new Error(`The Switchboard answered a malformed version for protocol ${protocol}`);
1380
+ versions[protocol] = version;
1381
+ }
1382
+ return versions;
1383
+ }
1139
1384
  //#endregion
1140
1385
  //#region src/graphql-client/operations.ts
1141
1386
  /**
@@ -1877,6 +2122,7 @@ var GraphQLSettledWriteHandle = class {
1877
2122
  };
1878
2123
  //#endregion
1879
2124
  //#region src/graphql-client/graphql-reactor-client.ts
2125
+ const BUILT_IN_MODELS = [driveDocumentModelModule];
1880
2126
  /** Paging defaults, matching the reactor's own client. */
1881
2127
  const defaultPaging = {
1882
2128
  cursor: "0",
@@ -1930,6 +2176,7 @@ var GraphQLReactorClient = class {
1930
2176
  jobRealtimeBroken = false;
1931
2177
  /** Set once the Switchboard refused the `document` query's `consistency` argument. */
1932
2178
  consistencyUnsupported = false;
2179
+ driveNodes;
1933
2180
  /**
1934
2181
  * The read half: the reads the hooks make. Every method is this client's
1935
2182
  * own; nothing that writes is reachable from it.
@@ -1958,7 +2205,8 @@ var GraphQLReactorClient = class {
1958
2205
  const middleware = withWrongBackendErrors(makeAuthMiddleware(this.tokenProvider));
1959
2206
  this.sdk = options.graphqlClient ?? createClient$1(options.url, middleware);
1960
2207
  this.subgraphs = new SubgraphSdkRegistry(options.url, middleware);
1961
- this.read = new GraphQLReadHalf(this);
2208
+ this.driveNodes = new GraphQLDriveNodeSource(this.sdk, driveIdHeaders);
2209
+ this.read = new GraphQLReadHalf(this, this.driveNodes);
1962
2210
  this.write = {
1963
2211
  execute: (documentIdentifier, branch, actions, signal) => this.submitExecute(documentIdentifier, branch, actions, signal),
1964
2212
  create: (document, parentIdentifier, signal) => this.submitCreate(document, parentIdentifier, signal),
@@ -1966,6 +2214,13 @@ var GraphQLReactorClient = class {
1966
2214
  };
1967
2215
  }
1968
2216
  /**
2217
+ * The Switchboard's drive node queries as a node source, for every drive
2218
+ * type. `read.drives` answers from it.
2219
+ */
2220
+ nodeSource() {
2221
+ return this.driveNodes;
2222
+ }
2223
+ /**
1969
2224
  * Reads a document. With a consistency token that names any coordinate, the
1970
2225
  * Switchboard waits until its read models hold them; one without the
1971
2226
  * `document` query's `consistency` argument is read without it, which after
@@ -1980,9 +2235,60 @@ var GraphQLReactorClient = class {
1980
2235
  if (!document) throw new Error(`Document not found: ${identifier}`);
1981
2236
  return phDocumentFromGetDocument(document.document, view?.branch);
1982
2237
  }
1983
- /** Reads documents by id, in the order given; throws if any is missing. */
2238
+ /**
2239
+ * Reads documents by id, in the order given; throws if any is missing. Each
2240
+ * chunk of {@link GET_MANY_CHUNK_SIZE} ids is one request holding an aliased
2241
+ * `document` field per id, with the selection and arguments `get` sends.
2242
+ */
1984
2243
  async getMany(documentIds, view, signal, consistencyToken) {
1985
- return Promise.all(documentIds.map((id) => this.get(id, view, signal, consistencyToken)));
2244
+ const viewInput = viewFilterInputFromViewFilter(view);
2245
+ const token = consistencyToken && consistencyToken.coordinates.length > 0 ? consistencyToken : void 0;
2246
+ const chunks = [];
2247
+ for (let i = 0; i < documentIds.length; i += GET_MANY_CHUNK_SIZE) chunks.push(documentIds.slice(i, i + GET_MANY_CHUNK_SIZE));
2248
+ return (await Promise.all(chunks.map((chunk) => this.getDocumentChunk(chunk, viewInput, token, signal)))).flat().map((document) => phDocumentFromGetDocument(document, view?.branch));
2249
+ }
2250
+ /** One chunk of `getMany`, with the `consistency` argument while the Switchboard accepts it. */
2251
+ async getDocumentChunk(identifiers, view, token, signal) {
2252
+ if (token && !this.consistencyUnsupported) try {
2253
+ return await this.runGetDocuments(identifiers, view, consistencyInputFromToken(token), signal);
2254
+ } catch (error) {
2255
+ if (!refusesConsistencyArgument(error)) throw error;
2256
+ this.consistencyUnsupported = true;
2257
+ }
2258
+ return this.runGetDocuments(identifiers, view, void 0, signal);
2259
+ }
2260
+ async runGetDocuments(identifiers, view, consistency, signal) {
2261
+ const variables = { view };
2262
+ const definitions = ["$view: ViewFilterInput"];
2263
+ let consistencyArgument = "";
2264
+ if (consistency) {
2265
+ variables.consistency = consistency;
2266
+ definitions.push("$consistency: ConsistencyTokenInput");
2267
+ consistencyArgument = ", consistency: $consistency";
2268
+ }
2269
+ const fields = identifiers.map((identifier, i) => {
2270
+ variables[`id${i}`] = identifier;
2271
+ definitions.push(`$id${i}: String!`);
2272
+ return `d${i}: document(identifier: $id${i}, view: $view${consistencyArgument}) { document { ...PHDocumentFields } childIds }`;
2273
+ });
2274
+ const query = [
2275
+ `query GetDocuments(${definitions.join(", ")}) {`,
2276
+ ...fields,
2277
+ "}",
2278
+ PH_DOCUMENT_FIELDS_SOURCE
2279
+ ].join("\n");
2280
+ const data = await this.sdk.RunDocument({
2281
+ operationName: "GetDocuments",
2282
+ operationType: "query",
2283
+ document: query,
2284
+ variables,
2285
+ signal
2286
+ });
2287
+ return identifiers.map((identifier, i) => {
2288
+ const result = data[`d${i}`];
2289
+ if (!result) throw new Error(`Document not found: ${identifier}`);
2290
+ return result.document;
2291
+ });
1986
2292
  }
1987
2293
  /**
1988
2294
  * Whether the Switchboard would serve the document to this client's caller,
@@ -2247,39 +2553,22 @@ var GraphQLReactorClient = class {
2247
2553
  await delay(JOB_POLL_INTERVAL_MS, signal);
2248
2554
  }
2249
2555
  }
2250
- /**
2251
- * The policy the Switchboard gives a new document, read from its
2252
- * `createDefaults` query. A Switchboard without that query is refused with
2253
- * {@link GraphQLOperationNotSupportedError}: a guessed default would
2254
- * under-sign on a stricter host.
2255
- */
2256
- async getCreateSignaturePolicy() {
2257
- return (await this.createDefaults("getCreateSignaturePolicy")).signaturePolicy;
2556
+ /** See {@link readCreateSignaturePolicy}. */
2557
+ getCreateSignaturePolicy() {
2558
+ return readCreateSignaturePolicy(this.sdk);
2258
2559
  }
2259
- /**
2260
- * The protocol versions the Switchboard selects for a new document under
2261
- * `parentIdentifier`, read from its `createDefaults` query. A parent the
2262
- * caller may not read is refused by the server, never answered as if none
2263
- * was named; a Switchboard without the query is refused with
2264
- * {@link GraphQLOperationNotSupportedError}.
2265
- */
2266
- async getCreateProtocolVersions(parentIdentifier, signal) {
2267
- return (await this.createDefaults("getCreateProtocolVersions", parentIdentifier, signal)).protocolVersions;
2560
+ /** See {@link readCreateProtocolVersions}; fitted to `documentModels`. */
2561
+ getCreateProtocolVersions(options, signal) {
2562
+ return readCreateProtocolVersions(this.sdk, options, this.documentModels(), signal);
2268
2563
  }
2269
- async createDefaults(operation, parentIdOrSlug, signal) {
2270
- let result;
2271
- try {
2272
- result = await this.sdk.GetCreateDefaults({ parentIdOrSlug }, void 0, signal);
2273
- } catch (error) {
2274
- if (queriesUnknownField(error, "createDefaults")) throw new GraphQLOperationNotSupportedError(operation, "the Switchboard predates the createDefaults query");
2275
- throw error;
2276
- }
2277
- const { signaturePolicy, protocolVersions } = result.createDefaults;
2278
- if (!isSignaturePolicy(signaturePolicy)) throw new Error(`The Switchboard answered an unknown create signature policy: ${signaturePolicy}`);
2279
- return {
2280
- signaturePolicy,
2281
- protocolVersions: protocolVersionsFrom(protocolVersions)
2282
- };
2564
+ /** See {@link IReactorClient.newDocument}; the module comes from `documentModels`. */
2565
+ async newDocument(documentType, options, signal) {
2566
+ const module = selectDocumentModelModule([...this.documentModels(), ...BUILT_IN_MODELS], documentType, options?.documentModelVersion);
2567
+ const [policy, versions] = await Promise.all([options?.signaturePolicy ?? this.getCreateSignaturePolicy(), this.getCreateProtocolVersions({
2568
+ documentType,
2569
+ parentIdentifier: options?.parentIdentifier
2570
+ }, signal)]);
2571
+ return headNewDocument(module, options, policy, versions);
2283
2572
  }
2284
2573
  /**
2285
2574
  * Sets or, with `null`, clears the preferred editor as a client-signed
@@ -2628,16 +2917,7 @@ var GraphQLReactorClient = class {
2628
2917
  const variables = {
2629
2918
  identifier,
2630
2919
  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
- }
2920
+ consistency: consistencyInputFromToken(token)
2641
2921
  };
2642
2922
  try {
2643
2923
  return await this.sdk.RunDocument({
@@ -2781,8 +3061,10 @@ var GraphQLReactorClient = class {
2781
3061
  */
2782
3062
  var GraphQLReadHalf = class {
2783
3063
  client;
2784
- constructor(client) {
3064
+ drives;
3065
+ constructor(client, nodes) {
2785
3066
  this.client = client;
3067
+ this.drives = new GraphQLDriveReadClient(nodes);
2786
3068
  }
2787
3069
  get(identifier, view, signal, consistencyToken) {
2788
3070
  return this.client.get(identifier, view, signal, consistencyToken);
@@ -2838,6 +3120,21 @@ function sleepUntilWoken(ms, wakers, signal) {
2838
3120
  * Whether a request failed because the Switchboard's `document` query has no
2839
3121
  * `consistency` argument, or its schema no `ConsistencyTokenInput`.
2840
3122
  */
3123
+ /** The most ids one `getMany` request reads. */
3124
+ const GET_MANY_CHUNK_SIZE = 50;
3125
+ const PH_DOCUMENT_FIELDS_SOURCE = print(PhDocumentFieldsFragmentDoc);
3126
+ function consistencyInputFromToken(token) {
3127
+ return {
3128
+ version: token.version,
3129
+ createdAtUtcIso: token.createdAtUtcIso,
3130
+ coordinates: token.coordinates.map((coordinate) => ({
3131
+ documentId: coordinate.documentId,
3132
+ scope: coordinate.scope,
3133
+ branch: coordinate.branch,
3134
+ operationIndex: coordinate.operationIndex
3135
+ }))
3136
+ };
3137
+ }
2841
3138
  function refusesConsistencyArgument(error) {
2842
3139
  const errors = error?.response?.errors;
2843
3140
  if (!Array.isArray(errors)) return false;
@@ -2846,6 +3143,10 @@ function refusesConsistencyArgument(error) {
2846
3143
  return typeof message === "string" && (message.includes("\"consistency\"") || message.includes("\"ConsistencyTokenInput\""));
2847
3144
  });
2848
3145
  }
3146
+ /** {@link GraphQLReactorClient.nodeSource}, as a function. */
3147
+ function createGraphQLDriveNodeSource(client) {
3148
+ return client.nodeSource();
3149
+ }
2849
3150
  /**
2850
3151
  * Whether a value is a {@link GraphQLReactorClient}, including one built by
2851
3152
  * another copy of this module.
@@ -3054,17 +3355,6 @@ function jobInfoFromGql(job) {
3054
3355
  return info;
3055
3356
  }
3056
3357
  /**
3057
- * Whether a request failed because the server's schema has no such root field:
3058
- * a Switchboard older than the field. graphql-js validation words this the same
3059
- * under every gateway the Switchboard can run.
3060
- */
3061
- function queriesUnknownField(error, field) {
3062
- const errors = error?.response?.errors;
3063
- if (!Array.isArray(errors)) return false;
3064
- const prefix = `Cannot query field "${field}" on type "`;
3065
- return errors.some((entry) => typeof entry?.message === "string" && entry.message.startsWith(prefix));
3066
- }
3067
- /**
3068
3358
  * The header a Switchboard's drive middleware and load balancer key on. A
3069
3359
  * request carries it only when it is known to belong to that one drive: the
3070
3360
  * server answers any drive it does not own with 421.
@@ -3099,16 +3389,6 @@ function wrongBackendErrorOf(error) {
3099
3389
  const driveId = payload?.driveId;
3100
3390
  return new GraphQLWrongBackendError(typeof driveId === "string" ? driveId : "", payload, { cause: error });
3101
3391
  }
3102
- /** Protocol versions as the server sent them; anything but a version map throws. */
3103
- function protocolVersionsFrom(value) {
3104
- if (!isPlainObject(value)) throw new Error("The Switchboard answered malformed create protocol versions");
3105
- const versions = {};
3106
- for (const [protocol, version] of Object.entries(value)) {
3107
- if (typeof version !== "number" || !Number.isInteger(version)) throw new Error(`The Switchboard answered a malformed version for protocol ${protocol}`);
3108
- versions[protocol] = version;
3109
- }
3110
- return versions;
3111
- }
3112
3392
  function isSettled(job) {
3113
3393
  const status = job.status;
3114
3394
  return status === "READ_READY" || status === "FAILED";
@@ -3183,7 +3463,7 @@ const allowedDocumentTypesEventFunctions = makePHEventFunctions("allowedDocument
3183
3463
  const setAllowedDocumentTypes = allowedDocumentTypesEventFunctions.setValue;
3184
3464
  /** Defines the document types a drive supports.
3185
3465
  *
3186
- * Defaults to all of the document types registered in the reactor.
3466
+ * Unset or empty, it means every document type registered in the reactor.
3187
3467
  */
3188
3468
  function useAllowedDocumentTypes() {
3189
3469
  return allowedDocumentTypesEventFunctions.useValue();
@@ -3635,6 +3915,7 @@ const addToastEventHandler = toastEventFunctions.addEventHandler;
3635
3915
  const commonGlobalEventHandlerFunctions = {
3636
3916
  loading: addLoadingEventHandler,
3637
3917
  drives: addDrivesEventHandler,
3918
+ driveNodes: addDriveNodesEventHandler,
3638
3919
  selectedDriveId: () => {
3639
3920
  addSelectedDriveIdEventHandler();
3640
3921
  addSyncSelectionOnPopStateEventHandler();
@@ -3895,6 +4176,6 @@ function useDocumentOperations(documentId, scope, options = {}) {
3895
4176
  return legacy ? legacyResult : primary;
3896
4177
  }
3897
4178
  //#endregion
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 };
4179
+ export { addIsAnalyticsExternalProcessorsEnabledEventHandler as $, getFullReactorClient as $i, useIsEditorDebugModeEnabled as $n, resolveDocumentModelModule as $r, setIsDeleteLocalDrivesEnabled as $t, useDropTarget as A, queriesUnknownArgument as Ai, useAnalyticsDatabaseName as An, phDocumentEditorConfigHooks as Ar, addVersionEventHandler as At, addCliVersionEventHandler as B, getDocumentExtension as Bi, useIsAddDriveEnabled as Bn, findIsServableOverGraphQL as Br, setDrivesPreserveStrategy as Bt, usePackageDiscoveryService as C, usePHModal as Ca, COMMON_PACKAGE_ID as Ci, setSentryRelease as Cn, useWarnOutdatedApp as Cr, addRouterBasenameEventHandler as Ct, addDraggingNodeEventHandler as D, usePHNavigation as Da, GraphQLOperationNotSupportedError as Di, setVersionCheckInterval as Dn, isExternalControlsEnabledEventFunctions as Dr, addStudioModeEventHandler as Dt, useGraphQLReactorClient as E, useLinkProps as Ea, BatchJobFailedError as Ei, setVersion as En, addIsExternalControlsEnabledEventHandler as Er, addSentryReleaseEventHandler as Et, setAttachmentService as F, copyNode$1 as Fi, useDrivesPreserveStrategy as Fn, useAllowedDocumentTypes as Fr, setAnalyticsDatabaseName as Ft, addFileUploadOperationsChunkSizeEventHandler as G, setPreferredEditorOnNode as Gi, useIsAnalyticsExternalProcessorsEnabled as Gn, makeAuthConnectionParams as Gr, setIsAddDriveEnabled as Gt, addDisabledEditorsEventHandler as H, moveNode$1 as Hi, useIsAddPublicDrivesEnabled as Hn, viewFilterInputFromViewFilter as Hr, setFileUploadOperationsChunkSize as Ht, useAttachmentService as I, deleteNode as Ii, useEnabledEditors as In, useIsDragAndDropEnabled as Ir, setBasePath as It, addIsAddDriveEnabledEventHandler as J, isDocumentTypeSupported as Ji, useIsDeleteLocalDrivesEnabled as Jn, SubgraphSdkRegistry as Jr, setIsAnalyticsDatabaseWorkerEnabled as Jt, addGaTrackingIdEventHandler as K, upgradeDocument as Ki, useIsCloudDrivesEnabled as Kn, startDocumentChangesSubscription as Kr, setIsAddLocalDrivesEnabled as Kt, addAllowListEventHandler as L, exportFile as Li, useFileUploadOperationsChunkSize as Ln, useIsExternalControlsEnabled as Lr, setCliVersion as Lt, setFeatures as M, addDocument as Mi, useCliVersion as Mn, setAllowedDocumentTypes as Mr, phGlobalConfigHooks as Mt, useFeatures as N, addFileWithProgress as Ni, useDefaultDrivesUrl as Nn, setIsDragAndDropEnabled as Nr, phGlobalConfigSetters as Nt, useDragNode as O, useSearchParams as Oa, GraphQLWrongBackendError as Oi, setWarnOutdatedApp as On, phAppConfigHooks as Or, addSwitchboardUrlEventHandler as Ot, addAttachmentServiceEventHandler as P, addFolder$1 as Pi, useDisabledEditors as Pn, setIsExternalControlsEnabled as Pr, setAllowList as Pt, addIsAnalyticsEnabledEventHandler as Q, addReactorHalvesEventHandler as Qi, useIsDriveAnalyticsEnabled as Qn, packageFromDocumentModels as Qr, setIsDeleteCloudDrivesEnabled as Qt, addAnalyticsDatabaseNameEventHandler as R, extractInitialState as Ri, useGaTrackingId as Rn, GraphQLReactorClient as Rr, setDefaultDrivesUrl as Rt, setPackageDiscoveryService as S, useModalLinkProps as Sa, underSignaturePolicy as Si, setSentryEnv as Sn, useVersionCheckInterval as Sr, addRequiresHardRefreshEventHandler as St, setGraphQLReactorClient as T, isPlainClick as Ta, DRIVE_DOCUMENT_TYPES as Ti, setSwitchboardUrl as Tn, addIsDragAndDropEnabledEventHandler as Tr, addSentryEnvEventHandler as Tt, addDrivesPreserveStrategyEventHandler as U, renameDriveNode as Ui, useIsAnalyticsDatabaseWorkerEnabled as Un, createJobChangesSocket as Ur, setGaTrackingId as Ut, addDefaultDrivesUrlEventHandler as V, loadFile as Vi, useIsAddLocalDrivesEnabled as Vn, isGraphQLReactorClient as Vr, setEnabledEditors as Vt, addEnabledEditorsEventHandler as W, renameNode as Wi, useIsAnalyticsEnabled as Wn, isAuthRefusalClose as Wr, setIsAddCloudDrivesEnabled as Wt, addIsAddPublicDrivesEnabledEventHandler as X, addReactorClientEventHandler as Xi, useIsDiffAnalyticsEnabled as Xn, subgraphUrlFromGraphqlUrl as Xr, setIsAnalyticsExternalProcessorsEnabled as Xt, addIsAddLocalDrivesEnabledEventHandler as Y, addFullReactorClientEventHandler as Yi, useIsDeletePublicDrivesEnabled as Yn, describeGraphQLDocument as Yr, setIsAnalyticsEnabled as Yt, addIsAnalyticsDatabaseWorkerEnabledEventHandler as Z, addReactorClientModuleEventHandler as Zi, useIsDocumentModelSelectionSettingsEnabled as Zn, StaticPackageManager as Zr, setIsCloudDrivesEnabled as Zt, addSetSelectedDriveOnPopStateEventHandler as _, modalSearch as _a, convertRemoteOperations as _i, setRenownNetworkId as _n, useSentryEnv as _r, addLogLevelEventHandler as _t, addPHEventHandlers as a, usePGlite as aa, ReactorOperationFieldsFragmentDoc as ai, setIsEditorReadModeEnabled as an, useIsPublicDrivesEnabled as ar, addIsDocumentModelSelectionSettingsEnabledEventHandler as at, syncSelectionFromPath as b, showDeleteNodeModal as ba, screamingSnakeToCamel as bi, setRouterBasename as bn, useSwitchboardUrl as br, addRenownNetworkIdEventHandler as bt, addToastEventHandler as c, useReactorHalves as ca, GraphQLDriveNodeSource as ci, setIsExternalRelationalProcessorsEnabled as cn, useLocalDrivesEnabled as cr, addIsEditorReadModeEnabledEventHandler as ct, addSelectedTimelineRevisionEventHandler as d, MODAL_SEARCH_PARAM as da, isoStringFromDateTime as di, setIsRelationalProcessorsEnabled as dn, useRenownChainId as dr, addIsExternalRelationalProcessorsEnabledEventHandler as dt, setFullReactorClient as ea, prepareSignedActions as ei, setIsDeletePublicDrivesEnabled as en, useIsEditorReadModeEnabled as er, addIsCloudDrivesEnabledEventHandler as et, setSelectedTimelineRevision as f, addModalEventHandler as fa, phDocumentFromGetDocument as fi, setIsSentryTracingEnabled as fn, useRenownNetworkId as fr, addIsLocalDrivesEnabledEventHandler as ft, useSelectedTimelineItem as g, modalHref as ga, buildPulledDocument as gi, setRenownChainId as gn, useSentryDsn as gr, addLocalDrivesEnabledEventHandler as gt, setSelectedTimelineItem as h, modalFromSearch as ha, ConflictError as hi, setRenownAdapters as hn, useRouterBasename as hr, addIsSentryTracingEnabledEventHandler as ht, useSwitchboardClient as i, useModelRegistry as ia, MutateDocumentWithOperationsDocument as ii, setIsEditorDebugModeEnabled as in, useIsLocalDrivesEnabled as ir, addIsDiffAnalyticsEnabledEventHandler as it, addFeaturesEventHandler as j, queriesUnknownField as ji, useBasePath as jn, phDocumentEditorConfigSetters as jr, addWarnOutdatedAppEventHandler as jt, useDropNode as k, useSetSearchParams as ka, JobFailedError as ki, useAllowList as kn, phAppConfigSetters as kr, addVersionCheckIntervalEventHandler as kt, setPHToast as l, useSync as la, GraphQLDriveReadClient as li, setIsLocalDrivesEnabled as ln, useLogLevel as lr, addIsExternalPackagesEnabledEventHandler as lt, addSelectedTimelineItemEventHandler as m, isRoutedModal as ma, revisionMapFromRevisionsList as mi, setLogLevel as mn, useRequiresHardRefresh as mr, addIsRelationalProcessorsEnabledEventHandler as mt, GraphQLReactorProvider as n, setReactorClientModule as na, stampAction as ni, setIsDocumentModelSelectionSettingsEnabled as nn, useIsExternalProcessorsEnabled as nr, addIsDeleteLocalDrivesEnabledEventHandler as nt, callEventHandlerRegisterFunctions as o, useReactorClient as oa, readCreateProtocolVersions as oi, setIsExternalPackagesEnabled as on, useIsRelationalProcessorsEnabled as or, addIsDriveAnalyticsEnabledEventHandler as ot, useSelectedTimelineRevision as p, closePHModal as pa, phDocumentFromMutation as pi, setLocalDrivesEnabled as pn, useRenownUrl as pr, addIsPublicDrivesEnabledEventHandler as pt, addIsAddCloudDrivesEnabledEventHandler as q, getUserPermissions as qi, useIsDeleteCloudDrivesEnabled as qn, subscriptionsUrlFromGraphqlUrl as qr, setIsAddPublicDrivesEnabled as qt, ensurePHEventHandlers as r, useDatabase as ra, GetDocumentAtConsistencyDocument as ri, setIsDriveAnalyticsEnabled as rn, useIsExternalRelationalProcessorsEnabled as rr, addIsDeletePublicDrivesEnabledEventHandler as rt, commonGlobalEventHandlerFunctions as s, useReactorClientModule as sa, readCreateSignaturePolicy as si, setIsExternalProcessorsEnabled as sn, useIsSentryTracingEnabled as sr, addIsEditorDebugModeEnabledEventHandler as st, useDocumentOperations as t, setReactorClient as ta, signStampedAction as ti, setIsDiffAnalyticsEnabled as tn, useIsExternalPackagesEnabled as tr, addIsDeleteCloudDrivesEnabledEventHandler as tt, usePHToast as u, useSyncList as ua, toLegacyNode as ui, setIsPublicDrivesEnabled as un, useRenownAdapters as ur, addIsExternalProcessorsEnabledEventHandler as ut, addSetSelectedNodeOnPopStateEventHandler as v, setPHModal as va, extractRevisionMap as vi, setRenownUrl as vn, useSentryRelease as vr, addRenownAdaptersEventHandler as vt, addGraphQLReactorClientEventHandler as w, withoutModalSearch as wa, DEFAULT_DRIVE_EDITOR_ID as wi, setStudioMode as wn, addAllowedDocumentTypesEventHandler as wr, addSentryDsnEventHandler as wt, addPackageDiscoveryServiceEventHandler as x, showPHModal as xa, uncreatedDocument as xi, setSentryDsn as xn, useVersion as xr, addRenownUrlEventHandler as xt, addSyncSelectionOnPopStateEventHandler as y, showCreateDocumentModal as ya, hasRevisionConflict as yi, setRequiresHardRefresh as yn, useStudioMode as yr, addRenownChainIdEventHandler as yt, addBasePathEventHandler as z, fetchDocumentOperations as zi, useIsAddCloudDrivesEnabled as zn, createGraphQLDriveNodeSource as zr, setDisabledEditors as zt };
3899
4180
 
3900
- //# sourceMappingURL=document-operations-C4-irgHD.js.map
4181
+ //# sourceMappingURL=document-operations-B0GZilXW.js.map