@powerhousedao/reactor-browser 6.2.3-dev.5 → 6.2.3-dev.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{attachment-service-D3EhiAJ7.d.ts → attachment-service-B-nLR114.d.ts} +299 -60
- package/dist/attachment-service-B-nLR114.d.ts.map +1 -0
- package/dist/{client-BIHN_UyR.d.ts → client-C-tRLfRN.d.ts} +3 -3
- package/dist/client-C-tRLfRN.d.ts.map +1 -0
- package/dist/{client-D66jVnot.js → client-CZyHv02L.js} +197 -32
- package/dist/client-CZyHv02L.js.map +1 -0
- package/dist/{client-DjK30EQ-.js → client-Cq5avLW5.js} +35 -22
- package/dist/client-Cq5avLW5.js.map +1 -0
- package/dist/{document-by-id-B4FIzG1w.js → dispatch-C1VVTn5S.js} +393 -54
- package/dist/dispatch-C1VVTn5S.js.map +1 -0
- package/dist/document-by-id-BRDkvmpn.js +16 -0
- package/dist/document-by-id-BRDkvmpn.js.map +1 -0
- package/dist/{document-model-modules-bTP87nyr.js → document-model-modules-Gsh1Xr7j.js} +60 -68
- package/dist/document-model-modules-Gsh1Xr7j.js.map +1 -0
- package/dist/{document-operations-WeE6wIDt.js → document-operations-CpzMebZ3.js} +595 -126
- package/dist/document-operations-CpzMebZ3.js.map +1 -0
- package/dist/{global-OuINvEGT.d.ts → global-BvawOKrQ.d.ts} +57 -13
- package/dist/global-BvawOKrQ.d.ts.map +1 -0
- package/dist/{index-B33TKEqp.d.ts → index-Cjf5TGen.d.ts} +19 -98
- package/dist/index-Cjf5TGen.d.ts.map +1 -0
- package/dist/{index-BIVDXw3K.d.ts → index-rtDmzViP.d.ts} +3 -3
- package/dist/index-rtDmzViP.d.ts.map +1 -0
- package/dist/index.d.ts +395 -371
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +114 -39
- package/dist/index.js.map +1 -1
- package/dist/inspector-proxy-DKOjxSGE.d.ts +32 -0
- package/dist/inspector-proxy-DKOjxSGE.d.ts.map +1 -0
- package/dist/{make-ph-event-functions-DBq3iWYn.js → make-ph-event-functions-CdsvEl5t.js} +4 -2
- package/dist/{make-ph-event-functions-DBq3iWYn.js.map → make-ph-event-functions-CdsvEl5t.js.map} +1 -1
- package/dist/{pglite-CntadC_p-9NDG14dS.d.ts → pglite-CntadC_p-DTkdF8sr.d.ts} +11 -33
- package/dist/pglite-CntadC_p-DTkdF8sr.d.ts.map +1 -0
- package/dist/{relational-D1RB45sA.js → relational-DxHuX41f.js} +66 -5
- package/dist/relational-DxHuX41f.js.map +1 -0
- package/dist/{renown-rqK8sokh.js → renown-CPAeJt5L.js} +7 -8
- package/dist/{renown-rqK8sokh.js.map → renown-CPAeJt5L.js.map} +1 -1
- package/dist/{renown-BHxwP7xU.js → renown-D05wkobG.js} +2 -2
- package/dist/{renown-BHxwP7xU.js.map → renown-D05wkobG.js.map} +1 -1
- package/dist/src/ai/index.d.ts +51 -62
- package/dist/src/ai/index.d.ts.map +1 -1
- package/dist/src/ai/index.js +5 -8
- package/dist/src/ai/index.js.map +1 -1
- package/dist/src/analytics/index.d.ts +36 -44
- package/dist/src/analytics/index.d.ts.map +1 -1
- package/dist/src/analytics/index.js +2 -2
- package/dist/src/analytics/index.js.map +1 -1
- package/dist/src/document-model.d.ts +3 -4
- package/dist/src/document-model.d.ts.map +1 -1
- package/dist/src/document-model.js.map +1 -1
- package/dist/src/graphql/client.d.ts +4 -3
- package/dist/src/graphql/client.js +1 -1
- package/dist/src/graphql-client/entry.d.ts +5 -4
- package/dist/src/graphql-client/entry.js +4 -4
- package/dist/src/relational/index.d.ts +15 -9
- package/dist/src/relational/index.d.ts.map +1 -1
- package/dist/src/relational/index.js +1 -1
- package/dist/src/renown/index.d.ts +3 -2
- package/dist/src/renown/index.js +2 -2
- package/dist/src/rpc/index.d.ts +94 -110
- package/dist/src/rpc/index.d.ts.map +1 -1
- package/dist/src/rpc/index.js +264 -607
- package/dist/src/rpc/index.js.map +1 -1
- package/dist/{store-BJYcr_FL.js → store-DInXcjal.js} +1 -1
- package/dist/{store-BJYcr_FL.js.map → store-DInXcjal.js.map} +1 -1
- package/dist/{switchboard-CaXQ4-5Q.js → switchboard-3vHbIV5W.js} +58 -6
- package/dist/switchboard-3vHbIV5W.js.map +1 -0
- package/dist/{types-6vDzbRRS.d.ts → types-520nWrB3.d.ts} +2 -2
- package/dist/types-520nWrB3.d.ts.map +1 -0
- package/dist/{types-Dcv1ZLoW.d.ts → types-D0ugg0E1.d.ts} +224 -17
- package/dist/types-D0ugg0E1.d.ts.map +1 -0
- package/package.json +19 -20
- package/dist/attachment-service-D3EhiAJ7.d.ts.map +0 -1
- package/dist/client-BIHN_UyR.d.ts.map +0 -1
- package/dist/client-D66jVnot.js.map +0 -1
- package/dist/client-DjK30EQ-.js.map +0 -1
- package/dist/document-by-id-B4FIzG1w.js.map +0 -1
- package/dist/document-model-modules-bTP87nyr.js.map +0 -1
- package/dist/document-operations-WeE6wIDt.js.map +0 -1
- package/dist/global-OuINvEGT.d.ts.map +0 -1
- package/dist/index-B33TKEqp.d.ts.map +0 -1
- package/dist/index-BIVDXw3K.d.ts.map +0 -1
- package/dist/inspector-proxy-6h5VKAwt.d.ts +0 -257
- package/dist/inspector-proxy-6h5VKAwt.d.ts.map +0 -1
- package/dist/pglite-CntadC_p-9NDG14dS.d.ts.map +0 -1
- package/dist/relational-D1RB45sA.js.map +0 -1
- package/dist/switchboard-CaXQ4-5Q.js.map +0 -1
- package/dist/types-6vDzbRRS.d.ts.map +0 -1
- package/dist/types-Dcv1ZLoW.d.ts.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { S as
|
|
2
|
-
import {
|
|
3
|
-
import { t as makePHEventFunctions } from "./make-ph-event-functions-
|
|
4
|
-
import {
|
|
5
|
-
import { f as addLoadingEventHandler, t as addRenownEventHandler } from "./renown-
|
|
1
|
+
import { C as queueOperations, S as queueActions, a as useDocumentCache, d as DocumentCache, f as IDLE_OPERATIONS_ENTRY, g as DOCUMENT_CHANGE_TYPE, m as isOperationCache, n as addDocumentCacheEventHandler, r as setDocumentCache, w as uploadOperations } from "./dispatch-C1VVTn5S.js";
|
|
2
|
+
import { B as ambientRenownTokenProvider, I as DocumentModelNotFoundError, V as makeAuthMiddleware, _ as addSetSelectedNodeOnPopStateEventHandler, a as setVetraPackageManager, b as addDrivesEventHandler, c as addSelectedDriveIdEventHandler, g as addSelectedNodeIdEventHandler, h as addResetSelectedNodeEventHandler, l as addSetSelectedDriveOnPopStateEventHandler, p as useSelectedDriveId, r as addVetraPackageManagerEventHandler, z as UnsupportedDocumentTypeError } from "./document-model-modules-Gsh1Xr7j.js";
|
|
3
|
+
import { t as makePHEventFunctions } from "./make-ph-event-functions-CdsvEl5t.js";
|
|
4
|
+
import { i as PhDocumentFieldsFragmentDoc, n as DocumentChangesDocument, t as createClient$1 } from "./client-CZyHv02L.js";
|
|
5
|
+
import { f as addLoadingEventHandler, t as addRenownEventHandler } from "./renown-D05wkobG.js";
|
|
6
6
|
import { logger } from "document-model";
|
|
7
|
-
import { UnsupportedDocumentModelVersionError, assertAuthPreservedOnDuplicate, baseLoadFromInput, baseLoadFromInputVersioned, baseSaveToFileHandle, createPresignedHeader, createZip, deserializeSignature, documentModelDocumentType, generateId, hashDocumentStateForScope, normalizeDocumentModelVersion, replayDocumentVersioned, setName, setPreferredEditor, toTransportAction } from "@powerhousedao/shared/document-model";
|
|
8
7
|
import { addFolder, copyNode, generateNodesCopy, handleTargetNameCollisions, isFileNode, isFolderNode, moveNode, updateNode } from "@powerhousedao/shared/document-drive";
|
|
8
|
+
import { UnsupportedDocumentModelVersionError, actionSignerIdentity, actionSigningTarget, actions, assertAuthPreservedOnDuplicate, baseLoadFromInput, baseLoadFromInputVersioned, baseSaveToFileHandle, createCopyHeader, createPresignedHeader, createZip, deserializeSignature, documentModelDocumentType, generateId, hasDerivedDocumentId, hashDocumentStateForScope, normalizeDocumentModelVersion, replayDocumentVersioned, setName, setPreferredEditor, signaturePolicyOf, toTransportAction, withSignaturePolicy } from "@powerhousedao/shared/document-model";
|
|
9
9
|
import { allPass, conditional, constant, forEachObj, funnel, isDefined, isNot, isStrictEqual, isString, isTruthy, once } from "remeda";
|
|
10
|
-
import { useCallback, useEffect,
|
|
10
|
+
import { useCallback, useEffect, useMemo, useState, useSyncExternalStore } from "react";
|
|
11
11
|
import { GraphQLClient } from "graphql-request";
|
|
12
12
|
import { gql } from "graphql-tag";
|
|
13
13
|
import { Kind, print } from "graphql";
|
|
@@ -39,9 +39,10 @@ function showCreateDocumentModal(documentType, documentModelVersion) {
|
|
|
39
39
|
}
|
|
40
40
|
/** Shows the delete node modal */
|
|
41
41
|
function showDeleteNodeModal(nodeOrId) {
|
|
42
|
+
const id = typeof nodeOrId === "string" ? nodeOrId : nodeOrId.id;
|
|
42
43
|
setPHModal({
|
|
43
44
|
type: "deleteItem",
|
|
44
|
-
id
|
|
45
|
+
id
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
48
|
//#endregion
|
|
@@ -76,7 +77,7 @@ function getUserPermissions() {
|
|
|
76
77
|
}
|
|
77
78
|
//#endregion
|
|
78
79
|
//#region src/actions/document.ts
|
|
79
|
-
const NON_DOMAIN_SCOPES = new Set(["auth", "document"]);
|
|
80
|
+
const NON_DOMAIN_SCOPES = /* @__PURE__ */ new Set(["auth", "document"]);
|
|
80
81
|
/** An unreadable drive cannot be shown to hold no duplicate, so reads throw. */
|
|
81
82
|
async function isDocumentInLocation(reactorClient, document, driveId, parentFolder) {
|
|
82
83
|
const drive = await reactorClient.get(driveId);
|
|
@@ -293,7 +294,7 @@ async function addDocument(driveId, name, documentType, parentFolder, document,
|
|
|
293
294
|
if (!module) throw new Error(`Document model not found for type: ${documentType} with version: ${documentModelVersion}`);
|
|
294
295
|
documentModelModule = module;
|
|
295
296
|
} else documentModelModule = await reactorClient.getDocumentModelModule(documentType);
|
|
296
|
-
const newDocument = document ?? documentModelModule.utils.createDocument();
|
|
297
|
+
const newDocument = document ?? withSignaturePolicy(documentModelModule.utils.createDocument(), await reactorClient.getCreateSignaturePolicy());
|
|
297
298
|
if (!document) newDocument.state.document.version = documentModelModule.version ?? 1;
|
|
298
299
|
newDocument.header.name = name;
|
|
299
300
|
if (preferredEditor) newDocument.header.meta = {
|
|
@@ -341,9 +342,24 @@ function isDocumentAlreadyExists(error) {
|
|
|
341
342
|
* fails leaves the drive untouched, so a retry has nothing to clean up.
|
|
342
343
|
*/
|
|
343
344
|
async function createImportedDocument(reactor, document, driveId, name, parentFolder) {
|
|
344
|
-
|
|
345
|
+
const v2Required = signaturePolicyOf(document.header) === "v2-required";
|
|
346
|
+
const keepsId = (!v2Required || hasDerivedDocumentId(document.header)) && !await reactor.isDocumentIdTaken(document.header.id);
|
|
347
|
+
let documentId = keepsId ? document.header.id : generateId();
|
|
345
348
|
for (let attempt = 1;; attempt++) {
|
|
346
|
-
|
|
349
|
+
let header;
|
|
350
|
+
if (!v2Required) header = createPresignedHeader(documentId, document.header.documentType);
|
|
351
|
+
else if (keepsId && attempt === 1) {
|
|
352
|
+
header = createPresignedHeader(documentId, document.header.documentType);
|
|
353
|
+
header.createdAtUtcIso = document.header.createdAtUtcIso;
|
|
354
|
+
header.sig = {
|
|
355
|
+
...header.sig,
|
|
356
|
+
nonce: document.header.sig.nonce
|
|
357
|
+
};
|
|
358
|
+
header.protocolVersions = { ...document.header.protocolVersions };
|
|
359
|
+
} else {
|
|
360
|
+
header = createCopyHeader(document.header);
|
|
361
|
+
documentId = header.id;
|
|
362
|
+
}
|
|
347
363
|
header.lastModifiedAtUtcIso = document.header.createdAtUtcIso;
|
|
348
364
|
header.meta = document.header.meta;
|
|
349
365
|
header.name = name || document.header.name;
|
|
@@ -593,7 +609,7 @@ async function moveNode$1(driveId, src, target) {
|
|
|
593
609
|
* Duplicates a document under a new id using version-aware replay.
|
|
594
610
|
* Falls back gracefully when no upgrade manifest is registered for the document type.
|
|
595
611
|
*/
|
|
596
|
-
async function _duplicateDocument(reactor, document, newId = generateId()) {
|
|
612
|
+
async function _duplicateDocument(reactor, document, newId = generateId(), driveId) {
|
|
597
613
|
const documentType = document.header.documentType;
|
|
598
614
|
const { results: allModules } = await reactor.getDocumentModelModules();
|
|
599
615
|
const modulesForType = allModules.filter((m) => m.documentModel.global.id === documentType);
|
|
@@ -609,7 +625,14 @@ async function _duplicateDocument(reactor, document, newId = generateId()) {
|
|
|
609
625
|
reducers,
|
|
610
626
|
upgradeManifest
|
|
611
627
|
};
|
|
612
|
-
const
|
|
628
|
+
const selected = await reactor.getCreateProtocolVersions(driveId);
|
|
629
|
+
const header = createCopyHeader({
|
|
630
|
+
documentType: document.header.documentType,
|
|
631
|
+
protocolVersions: document.header.protocolVersions ? {
|
|
632
|
+
...selected,
|
|
633
|
+
...document.header.protocolVersions
|
|
634
|
+
} : void 0
|
|
635
|
+
}, newId, await reactor.getCreateSignaturePolicy());
|
|
613
636
|
const duplicated = replayDocumentVersioned(document.initialState, document.operations, config, header);
|
|
614
637
|
assertAuthPreservedOnDuplicate(document.header.id, document.state.auth, duplicated.state.auth);
|
|
615
638
|
return duplicated;
|
|
@@ -643,14 +666,16 @@ async function copyNode$1(driveId, src, target) {
|
|
|
643
666
|
return node !== void 0 && isFileNode(node);
|
|
644
667
|
});
|
|
645
668
|
for (const fileNodeToCopy of fileNodesToCopy) try {
|
|
646
|
-
const duplicatedDocument = await _duplicateDocument(reactor, await reactor.get(fileNodeToCopy.srcId), fileNodeToCopy.targetId);
|
|
669
|
+
const duplicatedDocument = await _duplicateDocument(reactor, await reactor.get(fileNodeToCopy.srcId), fileNodeToCopy.targetId, driveId);
|
|
647
670
|
const resolvedName = resolvedNamesMap.get(fileNodeToCopy.targetId);
|
|
648
671
|
if (resolvedName) duplicatedDocument.header.name = resolvedName;
|
|
672
|
+
fileNodeToCopy.targetId = duplicatedDocument.header.id;
|
|
649
673
|
await reactor.drives.addFile(driveId, duplicatedDocument, target?.id);
|
|
650
674
|
} catch (e) {
|
|
651
675
|
logger.error(`Error copying document ${fileNodeToCopy.srcId}: ${String(e)}`);
|
|
652
676
|
}
|
|
653
|
-
|
|
677
|
+
const copyActions = copyNodesInput.map((copyNodeInput) => copyNode(copyNodeInput));
|
|
678
|
+
return await queueActions(drive, copyActions);
|
|
654
679
|
}
|
|
655
680
|
/**
|
|
656
681
|
* Upgrades a document to a newer document model version. Defaults to the
|
|
@@ -669,6 +694,7 @@ function screamingSnakeToCamel(s) {
|
|
|
669
694
|
}
|
|
670
695
|
/** Error thrown when a push conflict is detected with the "reject" strategy. */
|
|
671
696
|
var ConflictError = class extends Error {
|
|
697
|
+
conflict;
|
|
672
698
|
constructor(conflict) {
|
|
673
699
|
super("Push conflict: remote has new operations since last pull");
|
|
674
700
|
this.conflict = conflict;
|
|
@@ -814,7 +840,9 @@ function phDocumentHeaderFromGetDocument(document, branch) {
|
|
|
814
840
|
name: document.name,
|
|
815
841
|
branch: branch ?? defaultBranch,
|
|
816
842
|
revision: revisionMapFromRevisionsList(document.revisionsList),
|
|
817
|
-
lastModifiedAtUtcIso: isoStringFromDateTime(document.lastModifiedAtUtcIso)
|
|
843
|
+
lastModifiedAtUtcIso: isoStringFromDateTime(document.lastModifiedAtUtcIso),
|
|
844
|
+
...document.meta != null ? { meta: document.meta } : {},
|
|
845
|
+
...document.protocolVersions != null ? { protocolVersions: document.protocolVersions } : {}
|
|
818
846
|
};
|
|
819
847
|
}
|
|
820
848
|
function emptyOperationsForScopes(revisionsList) {
|
|
@@ -825,6 +853,41 @@ function isoStringFromDateTime(value) {
|
|
|
825
853
|
return value instanceof Date ? value.toISOString() : value;
|
|
826
854
|
}
|
|
827
855
|
//#endregion
|
|
856
|
+
//#region src/graphql-client/errors.ts
|
|
857
|
+
/** A call the Switchboard GraphQL surface cannot express. */
|
|
858
|
+
var GraphQLOperationNotSupportedError = class extends Error {
|
|
859
|
+
name = "GraphQLOperationNotSupportedError";
|
|
860
|
+
operation;
|
|
861
|
+
constructor(operation, reason) {
|
|
862
|
+
super(`GraphQLReactorClient.${operation} is not supported: ${reason}`);
|
|
863
|
+
this.operation = operation;
|
|
864
|
+
}
|
|
865
|
+
static isError(error) {
|
|
866
|
+
return Error.isError(error) && error.name === "GraphQLOperationNotSupportedError";
|
|
867
|
+
}
|
|
868
|
+
};
|
|
869
|
+
/**
|
|
870
|
+
* The reactor's `BatchJobFailedError`, rebuilt from a batch result; this entry
|
|
871
|
+
* imports the reactor for types only. The shared name lets either `isError`
|
|
872
|
+
* recognise it.
|
|
873
|
+
*/
|
|
874
|
+
var BatchJobFailedError = class extends Error {
|
|
875
|
+
name = "BatchJobFailedError";
|
|
876
|
+
key;
|
|
877
|
+
jobs;
|
|
878
|
+
constructor(key, jobs) {
|
|
879
|
+
const failure = jobs[key].error;
|
|
880
|
+
const cause = new Error(failure?.message ?? "Job failed");
|
|
881
|
+
cause.name = failure?.name ?? "Error";
|
|
882
|
+
super(failure?.message ?? "Job failed", { cause });
|
|
883
|
+
this.key = key;
|
|
884
|
+
this.jobs = jobs;
|
|
885
|
+
}
|
|
886
|
+
static isError(error) {
|
|
887
|
+
return Error.isError(error) && error.name === "BatchJobFailedError" && typeof error.key === "string" && typeof error.jobs === "object";
|
|
888
|
+
}
|
|
889
|
+
};
|
|
890
|
+
//#endregion
|
|
828
891
|
//#region src/graphql-client/operations.ts
|
|
829
892
|
/**
|
|
830
893
|
* The operation selection of `GetDocumentOperations`, lifted into a fragment so
|
|
@@ -941,43 +1004,42 @@ function stampAction(action, document, revision = document.header.revision[actio
|
|
|
941
1004
|
};
|
|
942
1005
|
}
|
|
943
1006
|
/**
|
|
944
|
-
* Signs a stamped action
|
|
945
|
-
*
|
|
946
|
-
*
|
|
947
|
-
*
|
|
1007
|
+
* Signs a stamped action for `target`, keeping any signatures it already
|
|
1008
|
+
* carries. The signer reads `context.prevOpHash`, so this runs after
|
|
1009
|
+
* {@link stampAction}. A v2 tuple covers the signer's identity, so the context
|
|
1010
|
+
* takes the signer's user and app even when the action named others.
|
|
948
1011
|
*/
|
|
949
|
-
async function signStampedAction(action, signer, signal) {
|
|
950
|
-
|
|
951
|
-
const
|
|
952
|
-
const app = actionSigner?.app ?? signer.app;
|
|
953
|
-
if (!user || !app) throw new Error("cannot sign an action: the signer has no user or app identity");
|
|
954
|
-
const signature = await signer.signAction(action, signal);
|
|
1012
|
+
async function signStampedAction(action, signer, target, signal) {
|
|
1013
|
+
if (!signer.user || !signer.app) throw new Error("cannot sign an action: the signer has no user or app identity");
|
|
1014
|
+
const signature = await signer.signAction(action, target, signal);
|
|
955
1015
|
return {
|
|
956
1016
|
...action,
|
|
957
1017
|
context: {
|
|
958
1018
|
...action.context,
|
|
959
1019
|
signer: {
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
signatures: [...actionSigner?.signatures ?? [], signature]
|
|
1020
|
+
...actionSignerIdentity(signer),
|
|
1021
|
+
signatures: [...action.context?.signer?.signatures ?? [], signature]
|
|
963
1022
|
}
|
|
964
1023
|
}
|
|
965
1024
|
};
|
|
966
1025
|
}
|
|
1026
|
+
/** The log a snapshot's action is written to; the snapshot names the branch read. */
|
|
1027
|
+
function snapshotTarget(action, snapshot) {
|
|
1028
|
+
return actionSigningTarget(action, snapshot.header.id, snapshot.header.branch || "main");
|
|
1029
|
+
}
|
|
967
1030
|
/**
|
|
968
1031
|
* Actions a snapshot batch cannot predict the next state for.
|
|
969
1032
|
*
|
|
970
|
-
* `UNDO
|
|
971
|
-
*
|
|
1033
|
+
* `UNDO` and `REDO` rewrite history the light read path never fetched (and
|
|
1034
|
+
* the reducer appends no operation for them); `NOOP` is only ever produced
|
|
972
1035
|
* by an undo chain; the document-scope actions run through the reactor's
|
|
973
1036
|
* document-action handler rather than a document-model reducer
|
|
974
1037
|
* (`DOCUMENT_SCOPE_ACTIONS` in packages/reactor/src/executor/util.ts) and
|
|
975
1038
|
* `UPGRADE_DOCUMENT` changes which reducer applies mid-batch.
|
|
976
1039
|
*/
|
|
977
|
-
const unsupportedBatchActions = new Set([
|
|
1040
|
+
const unsupportedBatchActions = /* @__PURE__ */ new Set([
|
|
978
1041
|
"UNDO",
|
|
979
1042
|
"REDO",
|
|
980
|
-
"PRUNE",
|
|
981
1043
|
"NOOP",
|
|
982
1044
|
"CREATE_DOCUMENT",
|
|
983
1045
|
"DELETE_DOCUMENT",
|
|
@@ -991,9 +1053,9 @@ const unsupportedBatchActions = new Set([
|
|
|
991
1053
|
* carries none.
|
|
992
1054
|
*
|
|
993
1055
|
* `baseReducer` reads `baseReducerVersion(document.header)` for every action and
|
|
994
|
-
* throws when the header has no `protocolVersions
|
|
995
|
-
* {@link phDocumentFromGetDocument}
|
|
996
|
-
*
|
|
1056
|
+
* throws when the header has no `protocolVersions`, which a header built by
|
|
1057
|
+
* {@link phDocumentFromGetDocument} lacks when the server sends none. The
|
|
1058
|
+
* version only selects between the v1
|
|
997
1059
|
* and v2 UNDO/NOOP branches, and every action reaching the prediction loop is an
|
|
998
1060
|
* ordinary append-only one, so it cannot change the predicted state here; it is
|
|
999
1061
|
* passed purely so the lookup does not throw.
|
|
@@ -1020,7 +1082,7 @@ const predictionProtocolVersion = 2;
|
|
|
1020
1082
|
*/
|
|
1021
1083
|
async function prepareSignedActions(actions, snapshot, signer, module, signal) {
|
|
1022
1084
|
if (actions.length === 0) return [];
|
|
1023
|
-
if (actions.length === 1) return [await signStampedAction(stampAction(actions[0], snapshot), signer, signal)];
|
|
1085
|
+
if (actions.length === 1) return [await signStampedAction(stampAction(actions[0], snapshot), signer, snapshotTarget(actions[0], snapshot), signal)];
|
|
1024
1086
|
const scope = sharedScope(actions);
|
|
1025
1087
|
assertSupportedBatch(actions);
|
|
1026
1088
|
if (!module) throw new Error(`cannot sign ${actions.length} actions: no document model module for ${snapshot.header.documentType} was supplied, so the batch state cannot be predicted`);
|
|
@@ -1035,7 +1097,8 @@ async function prepareSignedActions(actions, snapshot, signer, module, signal) {
|
|
|
1035
1097
|
const signed = [];
|
|
1036
1098
|
for (const [index, action] of actions.entries()) {
|
|
1037
1099
|
throwIfAborted(signal, index);
|
|
1038
|
-
const
|
|
1100
|
+
const stamped = stampAction(action, working, revision);
|
|
1101
|
+
const signedAction = await signStampedAction(stamped, signer, snapshotTarget(stamped, snapshot), signal);
|
|
1039
1102
|
signed.push(signedAction);
|
|
1040
1103
|
const before = scopeOperationCount(working, scope);
|
|
1041
1104
|
let next;
|
|
@@ -1375,6 +1438,7 @@ const defaultPaging = {
|
|
|
1375
1438
|
cursor: "0",
|
|
1376
1439
|
limit: 100
|
|
1377
1440
|
};
|
|
1441
|
+
const JOB_POLL_INTERVAL_MS = 250;
|
|
1378
1442
|
/**
|
|
1379
1443
|
* The marker {@link isGraphQLReactorClient} looks for.
|
|
1380
1444
|
*
|
|
@@ -1446,13 +1510,93 @@ var GraphQLReactorClient = class {
|
|
|
1446
1510
|
results: page.items.map((item) => remoteOperationToLocal(item)),
|
|
1447
1511
|
options: effectivePaging,
|
|
1448
1512
|
nextCursor,
|
|
1449
|
-
totalCount: page.totalCount,
|
|
1450
1513
|
next: nextCursor ? () => this.getOperations(documentIdentifier, view, filter, {
|
|
1451
1514
|
cursor: nextCursor,
|
|
1452
1515
|
limit: effectivePaging.limit
|
|
1453
1516
|
}, signal) : void 0
|
|
1454
1517
|
};
|
|
1455
1518
|
}
|
|
1519
|
+
/**
|
|
1520
|
+
* Filters documents by criteria over the Switchboard's `findDocuments` query.
|
|
1521
|
+
*
|
|
1522
|
+
* The query filters by `type` and `parentId` only, at head. A search naming
|
|
1523
|
+
* `ids` or `slugs` (present, whatever its length) and a point-in-time view are
|
|
1524
|
+
* each by-contract limitations the query cannot express -- running it anyway
|
|
1525
|
+
* would return every document instead of the named ones, or head instead of
|
|
1526
|
+
* the asked-for revision, a silently wrong answer. {@link findIsServableOverGraphQL}
|
|
1527
|
+
* is the single predicate that decides this, and an unservable `find` throws
|
|
1528
|
+
* {@link GraphQLOperationNotSupportedError}. Drive enumeration itself filters
|
|
1529
|
+
* by `type` at head, which is served.
|
|
1530
|
+
*/
|
|
1531
|
+
async find(search, view, paging, signal) {
|
|
1532
|
+
if (!findIsServableOverGraphQL(search, view)) throw new GraphQLOperationNotSupportedError("find", searchNamesIdentifiers(search) ? "it cannot filter by ids or slugs: the Switchboard findDocuments query filters only by type and parentId" : "point-in-time views are not supported by GraphQLReactorClient");
|
|
1533
|
+
const viewInput = viewFilterInputFromViewFilter(view);
|
|
1534
|
+
const effectivePaging = paging ?? defaultPaging;
|
|
1535
|
+
const result = await this.sdk.FindDocuments({
|
|
1536
|
+
search: {
|
|
1537
|
+
type: search.type,
|
|
1538
|
+
parentId: search.parentId
|
|
1539
|
+
},
|
|
1540
|
+
view: viewInput,
|
|
1541
|
+
paging: pagingInputFromPaging(effectivePaging)
|
|
1542
|
+
}, void 0, signal);
|
|
1543
|
+
return this.toDocumentResults(result.findDocuments, effectivePaging, view?.branch, (cursor, limit) => this.find(search, view, {
|
|
1544
|
+
cursor,
|
|
1545
|
+
limit
|
|
1546
|
+
}, signal));
|
|
1547
|
+
}
|
|
1548
|
+
async getOutgoingRelationships(sourceIdentifier, relationshipType, view, paging, signal) {
|
|
1549
|
+
const viewInput = viewFilterInputFromViewFilter(view);
|
|
1550
|
+
const result = await this.sdk.GetDocumentOutgoingRelationships({
|
|
1551
|
+
sourceIdentifier,
|
|
1552
|
+
relationshipType,
|
|
1553
|
+
view: viewInput,
|
|
1554
|
+
paging: pagingInputFromPaging(paging)
|
|
1555
|
+
}, void 0, signal);
|
|
1556
|
+
return this.toDocumentResults(result.documentOutgoingRelationships, paging ?? defaultPaging, view?.branch, (cursor, limit) => this.getOutgoingRelationships(sourceIdentifier, relationshipType, view, {
|
|
1557
|
+
cursor,
|
|
1558
|
+
limit
|
|
1559
|
+
}, signal));
|
|
1560
|
+
}
|
|
1561
|
+
async getIncomingRelationships(targetIdentifier, relationshipType, view, paging, signal) {
|
|
1562
|
+
const viewInput = viewFilterInputFromViewFilter(view);
|
|
1563
|
+
const result = await this.sdk.GetDocumentIncomingRelationships({
|
|
1564
|
+
targetIdentifier,
|
|
1565
|
+
relationshipType,
|
|
1566
|
+
view: viewInput,
|
|
1567
|
+
paging: pagingInputFromPaging(paging)
|
|
1568
|
+
}, void 0, signal);
|
|
1569
|
+
return this.toDocumentResults(result.documentIncomingRelationships, paging ?? defaultPaging, view?.branch, (cursor, limit) => this.getIncomingRelationships(targetIdentifier, relationshipType, view, {
|
|
1570
|
+
cursor,
|
|
1571
|
+
limit
|
|
1572
|
+
}, signal));
|
|
1573
|
+
}
|
|
1574
|
+
async getOutgoingRelationshipEdges(sourceIdentifier, relationshipType, view, paging, signal) {
|
|
1575
|
+
const viewInput = viewFilterInputFromViewFilter(view);
|
|
1576
|
+
const result = await this.sdk.GetDocumentOutgoingRelationshipEdges({
|
|
1577
|
+
sourceIdentifier,
|
|
1578
|
+
relationshipType,
|
|
1579
|
+
view: viewInput,
|
|
1580
|
+
paging: pagingInputFromPaging(paging)
|
|
1581
|
+
}, void 0, signal);
|
|
1582
|
+
return this.toRelationshipResults(result.documentOutgoingRelationshipEdges, paging ?? defaultPaging, (cursor, limit) => this.getOutgoingRelationshipEdges(sourceIdentifier, relationshipType, view, {
|
|
1583
|
+
cursor,
|
|
1584
|
+
limit
|
|
1585
|
+
}, signal));
|
|
1586
|
+
}
|
|
1587
|
+
async getIncomingRelationshipEdges(targetIdentifier, relationshipType, view, paging, signal) {
|
|
1588
|
+
const viewInput = viewFilterInputFromViewFilter(view);
|
|
1589
|
+
const result = await this.sdk.GetDocumentIncomingRelationshipEdges({
|
|
1590
|
+
targetIdentifier,
|
|
1591
|
+
relationshipType,
|
|
1592
|
+
view: viewInput,
|
|
1593
|
+
paging: pagingInputFromPaging(paging)
|
|
1594
|
+
}, void 0, signal);
|
|
1595
|
+
return this.toRelationshipResults(result.documentIncomingRelationshipEdges, paging ?? defaultPaging, (cursor, limit) => this.getIncomingRelationshipEdges(targetIdentifier, relationshipType, view, {
|
|
1596
|
+
cursor,
|
|
1597
|
+
limit
|
|
1598
|
+
}, signal));
|
|
1599
|
+
}
|
|
1456
1600
|
async create(document, parentIdentifier, signal) {
|
|
1457
1601
|
const created = phDocumentFromGetDocument((await this.sdk.CreateDocument({
|
|
1458
1602
|
document,
|
|
@@ -1505,6 +1649,174 @@ var GraphQLReactorClient = class {
|
|
|
1505
1649
|
return updated;
|
|
1506
1650
|
}
|
|
1507
1651
|
/**
|
|
1652
|
+
* Runs multiple mutation jobs in dependency order over the Switchboard's
|
|
1653
|
+
* `executeBatch` mutation and waits for all to settle, returning the result
|
|
1654
|
+
* shaped like `IReactor.executeBatch`'s so the reference `DriveClient`
|
|
1655
|
+
* consumes it unchanged.
|
|
1656
|
+
*
|
|
1657
|
+
* Not atomic: each job commits on its own and a failed job still releases
|
|
1658
|
+
* its dependents. A FAILED job throws {@link BatchJobFailedError}, naming the
|
|
1659
|
+
* first failed plan key and carrying every job's final state.
|
|
1660
|
+
*
|
|
1661
|
+
* Each job's actions are signed independently for the job's own
|
|
1662
|
+
* `(documentId, branch)` target -- the per-action signing the reactor's own
|
|
1663
|
+
* `signActions` does, not the batch state-prediction `execute` uses for a
|
|
1664
|
+
* multi-action push. A drive job such as `addFile`'s is `CREATE_DOCUMENT` +
|
|
1665
|
+
* `UPGRADE_DOCUMENT` + `ADD_RELATIONSHIP`, which the prediction path rejects
|
|
1666
|
+
* outright and which has no fetchable baseline to stamp against. The reactor
|
|
1667
|
+
* records but does not verify the stamped previous-state head, so signing
|
|
1668
|
+
* each action bare is exactly what the in-process `DriveClient` relies on.
|
|
1669
|
+
*
|
|
1670
|
+
* The mutation is synchronous server-side: a job it returns is already
|
|
1671
|
+
* settled, so {@link waitForJob} resolves from it without polling.
|
|
1672
|
+
*/
|
|
1673
|
+
async executeBatch(request, signal) {
|
|
1674
|
+
const signer = this.signer ?? resolveAmbientSigner();
|
|
1675
|
+
const jobInputs = await Promise.all(request.jobs.map(async (job, index) => {
|
|
1676
|
+
const documentId = await this.batchWriteTarget(job, request.jobs.slice(0, index), signer, signal);
|
|
1677
|
+
const actions = await this.signBatchJobActions({
|
|
1678
|
+
...job,
|
|
1679
|
+
documentId
|
|
1680
|
+
}, signer, signal);
|
|
1681
|
+
return {
|
|
1682
|
+
key: job.key,
|
|
1683
|
+
documentIdOrSlug: documentId,
|
|
1684
|
+
scope: job.scope,
|
|
1685
|
+
branch: job.branch,
|
|
1686
|
+
actions: actions.map(toTransportAction),
|
|
1687
|
+
dependsOn: job.dependsOn
|
|
1688
|
+
};
|
|
1689
|
+
}));
|
|
1690
|
+
const result = await this.sdk.ExecuteBatch({ jobs: jobInputs }, void 0, signal);
|
|
1691
|
+
const jobs = {};
|
|
1692
|
+
for (const entry of result.executeBatch.jobs) jobs[entry.key] = jobInfoFromGql(entry.job);
|
|
1693
|
+
await this.announceBatch(request, jobs, signal);
|
|
1694
|
+
const failed = request.jobs.find((job) => jobs[job.key]?.status === "FAILED");
|
|
1695
|
+
if (failed) throw new BatchJobFailedError(failed.key, jobs);
|
|
1696
|
+
return { jobs };
|
|
1697
|
+
}
|
|
1698
|
+
/** Polls `jobStatus` until the job is READ_READY or FAILED. */
|
|
1699
|
+
async waitForJob(jobOrId, signal) {
|
|
1700
|
+
if (typeof jobOrId !== "string" && isSettled(jobOrId)) return jobOrId;
|
|
1701
|
+
const jobId = typeof jobOrId === "string" ? jobOrId : jobOrId.id;
|
|
1702
|
+
for (;;) {
|
|
1703
|
+
const result = await this.sdk.GetJobStatus({ jobId }, void 0, signal);
|
|
1704
|
+
if (!result.jobStatus) throw new Error(`Job not found: ${jobId}`);
|
|
1705
|
+
const job = jobInfoFromGql(result.jobStatus);
|
|
1706
|
+
if (isSettled(job)) return job;
|
|
1707
|
+
await delay(JOB_POLL_INTERVAL_MS, signal);
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
/**
|
|
1711
|
+
* Not served: the Switchboard has no query for the policy it gives new
|
|
1712
|
+
* documents, and a guessed default would under-sign on a stricter host.
|
|
1713
|
+
*/
|
|
1714
|
+
getCreateSignaturePolicy() {
|
|
1715
|
+
return Promise.reject(new GraphQLOperationNotSupportedError("getCreateSignaturePolicy", "the Switchboard exposes no create signature policy"));
|
|
1716
|
+
}
|
|
1717
|
+
/**
|
|
1718
|
+
* Not served: the versions a new document takes come from the host's peer
|
|
1719
|
+
* agreement, which the Switchboard does not expose. A parent's own versions
|
|
1720
|
+
* are not that answer.
|
|
1721
|
+
*/
|
|
1722
|
+
getCreateProtocolVersions(_parentIdentifier, _signal) {
|
|
1723
|
+
return Promise.reject(new GraphQLOperationNotSupportedError("getCreateProtocolVersions", "the Switchboard exposes no create protocol versions"));
|
|
1724
|
+
}
|
|
1725
|
+
/**
|
|
1726
|
+
* Sets or, with `null`, clears the preferred editor as a client-signed
|
|
1727
|
+
* action, as the in-process client does.
|
|
1728
|
+
*/
|
|
1729
|
+
setPreferredEditor(documentIdentifier, preferredEditor, branch = "main", signal) {
|
|
1730
|
+
return this.execute(documentIdentifier, branch, [actions.setPreferredEditor(preferredEditor)], signal);
|
|
1731
|
+
}
|
|
1732
|
+
/**
|
|
1733
|
+
* Emits the changes the batch's settled jobs made, as `create` and `execute`
|
|
1734
|
+
* do, so a cache is invalidated without a realtime socket. The documents a
|
|
1735
|
+
* job wrote to are its own and those its consistency token names.
|
|
1736
|
+
*/
|
|
1737
|
+
async announceBatch(request, jobs, signal) {
|
|
1738
|
+
if (this.listeners.length === 0) return;
|
|
1739
|
+
const deleted = /* @__PURE__ */ new Set();
|
|
1740
|
+
const created = /* @__PURE__ */ new Map();
|
|
1741
|
+
const touched = /* @__PURE__ */ new Map();
|
|
1742
|
+
const keyOf = (written) => `${written.branch}\u0000${written.documentId}`;
|
|
1743
|
+
for (const job of request.jobs) {
|
|
1744
|
+
const info = jobs[job.key];
|
|
1745
|
+
if (!info || info.status !== "READ_READY") continue;
|
|
1746
|
+
const types = new Set(job.actions.map((action) => action.type));
|
|
1747
|
+
if (types.has("DELETE_DOCUMENT")) {
|
|
1748
|
+
deleted.add(info.documentId);
|
|
1749
|
+
continue;
|
|
1750
|
+
}
|
|
1751
|
+
const own = {
|
|
1752
|
+
documentId: info.documentId,
|
|
1753
|
+
branch: job.branch
|
|
1754
|
+
};
|
|
1755
|
+
if (types.has("CREATE_DOCUMENT")) created.set(keyOf(own), own);
|
|
1756
|
+
touched.set(keyOf(own), own);
|
|
1757
|
+
for (const { documentId, branch } of info.consistencyToken.coordinates) touched.set(keyOf({
|
|
1758
|
+
documentId,
|
|
1759
|
+
branch
|
|
1760
|
+
}), {
|
|
1761
|
+
documentId,
|
|
1762
|
+
branch
|
|
1763
|
+
});
|
|
1764
|
+
}
|
|
1765
|
+
for (const documentId of deleted) this.emitChange({
|
|
1766
|
+
type: DOCUMENT_CHANGE_TYPE.Deleted,
|
|
1767
|
+
documents: [],
|
|
1768
|
+
context: { childId: documentId }
|
|
1769
|
+
});
|
|
1770
|
+
const read = async ({ documentId, branch }) => {
|
|
1771
|
+
try {
|
|
1772
|
+
return await this.get(documentId, { branch }, signal);
|
|
1773
|
+
} catch (error) {
|
|
1774
|
+
logger.warn("GraphQLReactorClient: could not read @documentId on @branch to announce a batch change: @error", documentId, branch, error);
|
|
1775
|
+
return;
|
|
1776
|
+
}
|
|
1777
|
+
};
|
|
1778
|
+
const readAll = async (written) => (await Promise.all(written.map(read))).filter((document) => document !== void 0);
|
|
1779
|
+
const [createdDocuments, updatedDocuments] = await Promise.all([readAll([...created.values()].filter((w) => !deleted.has(w.documentId))), readAll([...touched.entries()].filter(([key, w]) => !deleted.has(w.documentId) && !created.has(key)).map(([, w]) => w))]);
|
|
1780
|
+
if (createdDocuments.length > 0) this.emitChange({
|
|
1781
|
+
type: DOCUMENT_CHANGE_TYPE.Created,
|
|
1782
|
+
documents: createdDocuments
|
|
1783
|
+
});
|
|
1784
|
+
if (updatedDocuments.length > 0) this.emitChange({
|
|
1785
|
+
type: DOCUMENT_CHANGE_TYPE.Updated,
|
|
1786
|
+
documents: updatedDocuments
|
|
1787
|
+
});
|
|
1788
|
+
}
|
|
1789
|
+
/**
|
|
1790
|
+
* The id a job's actions are signed for: a signature covers the document id,
|
|
1791
|
+
* and the server resolves a slug before verifying. A document created by this
|
|
1792
|
+
* job or an earlier one is named by its id. When the server has no such
|
|
1793
|
+
* document the identifier is used as given, and the server decides; any
|
|
1794
|
+
* other failure to read it throws, so nothing is signed for a slug.
|
|
1795
|
+
*/
|
|
1796
|
+
async batchWriteTarget(job, earlier, signer, signal) {
|
|
1797
|
+
const creates = (plan) => plan.documentId === job.documentId && plan.actions.some((action) => action.type === "CREATE_DOCUMENT");
|
|
1798
|
+
if (!signer || job.actions.every(isActionSigned) || creates(job) || earlier.some(creates)) return job.documentId;
|
|
1799
|
+
return (await this.sdk.GetDocument({
|
|
1800
|
+
identifier: job.documentId,
|
|
1801
|
+
view: viewFilterInputFromViewFilter({ branch: job.branch })
|
|
1802
|
+
}, void 0, signal)).document?.document.id ?? job.documentId;
|
|
1803
|
+
}
|
|
1804
|
+
/**
|
|
1805
|
+
* Signs one batch job's actions for the job's own log.
|
|
1806
|
+
*
|
|
1807
|
+
* Each action is signed on its own for `(documentId, branch)`, the same
|
|
1808
|
+
* per-action signing the reactor's `signActions` does: no state prediction
|
|
1809
|
+
* across the job, so a job carrying a `CREATE_DOCUMENT` the push-prediction
|
|
1810
|
+
* path rejects still signs. An action already signed under a key is left
|
|
1811
|
+
* as it is: the reference `DriveClient` signs its jobs before handing them
|
|
1812
|
+
* here. With no signer the actions pass through unsigned, matching
|
|
1813
|
+
* {@link execute}.
|
|
1814
|
+
*/
|
|
1815
|
+
async signBatchJobActions(job, signer, signal) {
|
|
1816
|
+
if (!signer) return job.actions;
|
|
1817
|
+
return Promise.all(job.actions.map((action) => isActionSigned(action) ? Promise.resolve(action) : signStampedAction(action, signer, actionSigningTarget(action, job.documentId, job.branch), signal)));
|
|
1818
|
+
}
|
|
1819
|
+
/**
|
|
1508
1820
|
* Deletes a document and announces it as a `Deleted` event.
|
|
1509
1821
|
*
|
|
1510
1822
|
* Pass a document id. The server resolves a slug just as happily, but
|
|
@@ -1613,6 +1925,35 @@ var GraphQLReactorClient = class {
|
|
|
1613
1925
|
});
|
|
1614
1926
|
}
|
|
1615
1927
|
/**
|
|
1928
|
+
* Shapes a document result page into the reactor's {@link PagedResults}.
|
|
1929
|
+
*
|
|
1930
|
+
* The items carry the same `PHDocumentFields` fragment as `get`, so the same
|
|
1931
|
+
* adapter rebuilds each one. `hasNextPage` gates the cursor exactly as
|
|
1932
|
+
* `getOperations` does: no cursor means no `next`.
|
|
1933
|
+
*/
|
|
1934
|
+
toDocumentResults(page, effectivePaging, branch, next) {
|
|
1935
|
+
const nextCursor = page.hasNextPage ? page.cursor ?? void 0 : void 0;
|
|
1936
|
+
return {
|
|
1937
|
+
results: page.items.map((item) => phDocumentFromGetDocument(item, branch)),
|
|
1938
|
+
options: effectivePaging,
|
|
1939
|
+
nextCursor,
|
|
1940
|
+
next: nextCursor ? () => next(nextCursor, effectivePaging.limit) : void 0
|
|
1941
|
+
};
|
|
1942
|
+
}
|
|
1943
|
+
/**
|
|
1944
|
+
* Shapes a relationship-edge result page into the reactor's
|
|
1945
|
+
* {@link PagedResults}, restoring each edge's `Date` fields.
|
|
1946
|
+
*/
|
|
1947
|
+
toRelationshipResults(page, effectivePaging, next) {
|
|
1948
|
+
const nextCursor = page.hasNextPage ? page.cursor ?? void 0 : void 0;
|
|
1949
|
+
return {
|
|
1950
|
+
results: page.items.map((edge) => documentRelationshipFromEdge(edge)),
|
|
1951
|
+
options: effectivePaging,
|
|
1952
|
+
nextCursor,
|
|
1953
|
+
next: nextCursor ? () => next(nextCursor, effectivePaging.limit) : void 0
|
|
1954
|
+
};
|
|
1955
|
+
}
|
|
1956
|
+
/**
|
|
1616
1957
|
* Opens the realtime socket on the first subscriber.
|
|
1617
1958
|
*
|
|
1618
1959
|
* The subscription is a firehose - no `search` argument - and this client
|
|
@@ -1743,13 +2084,13 @@ function isGraphQLReactorClient(client) {
|
|
|
1743
2084
|
}
|
|
1744
2085
|
/** The schema's change types, mapped onto the reactor's. */
|
|
1745
2086
|
const documentChangeTypes = {
|
|
1746
|
-
[
|
|
1747
|
-
[
|
|
1748
|
-
[
|
|
1749
|
-
[
|
|
1750
|
-
[
|
|
1751
|
-
[
|
|
1752
|
-
[
|
|
2087
|
+
["CREATED"]: DOCUMENT_CHANGE_TYPE.Created,
|
|
2088
|
+
["DELETED"]: DOCUMENT_CHANGE_TYPE.Deleted,
|
|
2089
|
+
["UPDATED"]: DOCUMENT_CHANGE_TYPE.Updated,
|
|
2090
|
+
["PARENT_ADDED"]: DOCUMENT_CHANGE_TYPE.ParentAdded,
|
|
2091
|
+
["PARENT_REMOVED"]: DOCUMENT_CHANGE_TYPE.ParentRemoved,
|
|
2092
|
+
["CHILD_ADDED"]: DOCUMENT_CHANGE_TYPE.ChildAdded,
|
|
2093
|
+
["CHILD_REMOVED"]: DOCUMENT_CHANGE_TYPE.ChildRemoved
|
|
1753
2094
|
};
|
|
1754
2095
|
/**
|
|
1755
2096
|
* Decides whether an event reaches a subscriber.
|
|
@@ -1784,7 +2125,7 @@ function eventMatchesSearch(event, search) {
|
|
|
1784
2125
|
*/
|
|
1785
2126
|
function viewFilterInputFromViewFilter(view) {
|
|
1786
2127
|
if (!view) return;
|
|
1787
|
-
if (view
|
|
2128
|
+
if (viewIsPointInTime(view)) throw new GraphQLOperationNotSupportedError("view", "point-in-time views are not supported by GraphQLReactorClient");
|
|
1788
2129
|
if (view.branch === void 0 && view.scopes === void 0) return;
|
|
1789
2130
|
return {
|
|
1790
2131
|
branch: view.branch,
|
|
@@ -1799,13 +2140,78 @@ function pagingInputFromPaging(paging) {
|
|
|
1799
2140
|
};
|
|
1800
2141
|
}
|
|
1801
2142
|
/**
|
|
2143
|
+
* Whether a search names `ids` or `slugs`, which the Switchboard `findDocuments`
|
|
2144
|
+
* query cannot honour (it filters by `type` and `parentId`).
|
|
2145
|
+
*
|
|
2146
|
+
* The test is PRESENCE, not length: the reactor `find` contract
|
|
2147
|
+
* (`packages/reactor/src/core/reactor.ts`) dispatches on `search.ids` /
|
|
2148
|
+
* `search.slugs` being present, so `find({ ids: [] })` is an identifier search
|
|
2149
|
+
* that must yield the empty set -- not a plain type query over every document.
|
|
2150
|
+
* The GraphQL surface cannot express an identifier search at all, so a present
|
|
2151
|
+
* (even empty) `ids`/`slugs` is refused rather than served as the wrong query.
|
|
2152
|
+
*/
|
|
2153
|
+
function searchNamesIdentifiers(search) {
|
|
2154
|
+
return search.ids !== void 0 || search.slugs !== void 0;
|
|
2155
|
+
}
|
|
2156
|
+
/** Whether a view asks for a point-in-time read the GraphQL surface cannot express. */
|
|
2157
|
+
function viewIsPointInTime(view) {
|
|
2158
|
+
return view?.revision !== void 0;
|
|
2159
|
+
}
|
|
2160
|
+
/**
|
|
2161
|
+
* The single source of truth for whether the Switchboard `findDocuments` query
|
|
2162
|
+
* can serve a `find`. It is servable iff the search names neither `ids` nor
|
|
2163
|
+
* `slugs` (present, regardless of length) AND the view is not point-in-time:
|
|
2164
|
+
* each is a by-contract limitation of a surface that filters only by
|
|
2165
|
+
* `type`/`parentId` at head. Exported so a caller can route around an
|
|
2166
|
+
* unservable search instead of catching the error `find` throws for it.
|
|
2167
|
+
*/
|
|
2168
|
+
function findIsServableOverGraphQL(search, view) {
|
|
2169
|
+
return !searchNamesIdentifiers(search) && !viewIsPointInTime(view);
|
|
2170
|
+
}
|
|
2171
|
+
/** Rebuilds a relationship edge from its GraphQL fields. */
|
|
2172
|
+
function documentRelationshipFromEdge(edge) {
|
|
2173
|
+
const relationship = {
|
|
2174
|
+
sourceId: edge.sourceId,
|
|
2175
|
+
targetId: edge.targetId,
|
|
2176
|
+
relationshipType: edge.relationshipType,
|
|
2177
|
+
createdAt: dateFromDateTime(edge.createdAt),
|
|
2178
|
+
updatedAt: dateFromDateTime(edge.updatedAt)
|
|
2179
|
+
};
|
|
2180
|
+
const metadata = edge.metadata;
|
|
2181
|
+
if (isPlainObject(metadata)) relationship.metadata = metadata;
|
|
2182
|
+
return relationship;
|
|
2183
|
+
}
|
|
2184
|
+
/**
|
|
2185
|
+
* Restores a `Date` from the `DateTime` scalar, which deserializes as either an
|
|
2186
|
+
* ISO string or a `Date`, reusing the get-path's {@link isoStringFromDateTime}.
|
|
2187
|
+
*
|
|
2188
|
+
* A null, absent or unparseable value is a malformed timestamp from the server,
|
|
2189
|
+
* not something to coerce to the epoch or an `Invalid Date`: it throws, so the
|
|
2190
|
+
* malformed edge surfaces as a genuine failure rather than a silently-wrong
|
|
2191
|
+
* `DocumentRelationship`.
|
|
2192
|
+
*/
|
|
2193
|
+
function dateFromDateTime(value) {
|
|
2194
|
+
if (value === null || value === void 0) throw new Error("relationship edge is missing a required DateTime timestamp");
|
|
2195
|
+
const date = new Date(isoStringFromDateTime(value));
|
|
2196
|
+
if (Number.isNaN(date.getTime())) throw new Error(`relationship edge carries an unparseable DateTime timestamp: ${String(value)}`);
|
|
2197
|
+
return date;
|
|
2198
|
+
}
|
|
2199
|
+
/**
|
|
2200
|
+
* Whether a JSON value is a plain object, so relationship `metadata` is assigned
|
|
2201
|
+
* only when it is one. A non-object JSON scalar (string, number, array, null)
|
|
2202
|
+
* is dropped exactly as a null is, rather than cast to `Record` and trusted.
|
|
2203
|
+
*/
|
|
2204
|
+
function isPlainObject(value) {
|
|
2205
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2206
|
+
}
|
|
2207
|
+
/**
|
|
1802
2208
|
* The reactor and the GraphQL schema disagree on the enum: the reactor's
|
|
1803
2209
|
* `None` is the schema's `ORPHAN`. This is the inverse of the server's
|
|
1804
2210
|
* `toReactorPropagationMode`.
|
|
1805
2211
|
*/
|
|
1806
2212
|
const propagationModeInputs = {
|
|
1807
|
-
cascade:
|
|
1808
|
-
none:
|
|
2213
|
+
cascade: "CASCADE",
|
|
2214
|
+
none: "ORPHAN"
|
|
1809
2215
|
};
|
|
1810
2216
|
function propagationModeInput(propagate) {
|
|
1811
2217
|
return propagate === void 0 ? void 0 : propagationModeInputs[propagate];
|
|
@@ -1841,6 +2247,67 @@ function documentModelVersion(document) {
|
|
|
1841
2247
|
const documentScope = document.state.document;
|
|
1842
2248
|
return normalizeDocumentModelVersion(documentScope?.version);
|
|
1843
2249
|
}
|
|
2250
|
+
/**
|
|
2251
|
+
* Rebuilds a reactor {@link JobInfo} from what the server reported. An unknown
|
|
2252
|
+
* job arrives as the reactor's own: FAILED with an empty `documentId`.
|
|
2253
|
+
*/
|
|
2254
|
+
function jobInfoFromGql(job) {
|
|
2255
|
+
const token = job.consistencyToken;
|
|
2256
|
+
if (token.version !== 1) throw new Error(`Job ${job.id} carries consistency token version ${token.version}, which this client cannot read`);
|
|
2257
|
+
const info = {
|
|
2258
|
+
id: job.id,
|
|
2259
|
+
documentId: job.documentId,
|
|
2260
|
+
status: job.status,
|
|
2261
|
+
createdAtUtcIso: isoStringFromDateTime(job.createdAt),
|
|
2262
|
+
consistencyToken: {
|
|
2263
|
+
version: 1,
|
|
2264
|
+
createdAtUtcIso: token.createdAtUtcIso,
|
|
2265
|
+
coordinates: token.coordinates.map((coordinate) => ({ ...coordinate }))
|
|
2266
|
+
},
|
|
2267
|
+
meta: {
|
|
2268
|
+
batchId: job.meta.batchId,
|
|
2269
|
+
batchJobIds: [...job.meta.batchJobIds]
|
|
2270
|
+
}
|
|
2271
|
+
};
|
|
2272
|
+
if (job.completedAt != null) info.completedAtUtcIso = isoStringFromDateTime(job.completedAt);
|
|
2273
|
+
if (job.result != null) info.result = job.result;
|
|
2274
|
+
if (job.error != null) info.error = {
|
|
2275
|
+
name: job.errorName ?? "Error",
|
|
2276
|
+
message: job.error,
|
|
2277
|
+
stack: ""
|
|
2278
|
+
};
|
|
2279
|
+
return info;
|
|
2280
|
+
}
|
|
2281
|
+
function isSettled(job) {
|
|
2282
|
+
const status = job.status;
|
|
2283
|
+
return status === "READ_READY" || status === "FAILED";
|
|
2284
|
+
}
|
|
2285
|
+
function abortReason(signal) {
|
|
2286
|
+
const reason = signal.reason;
|
|
2287
|
+
return reason instanceof Error ? reason : new Error(String(reason));
|
|
2288
|
+
}
|
|
2289
|
+
function delay(ms, signal) {
|
|
2290
|
+
return new Promise((resolve, reject) => {
|
|
2291
|
+
if (signal?.aborted) {
|
|
2292
|
+
reject(abortReason(signal));
|
|
2293
|
+
return;
|
|
2294
|
+
}
|
|
2295
|
+
const onAbort = () => {
|
|
2296
|
+
clearTimeout(timer);
|
|
2297
|
+
if (signal) reject(abortReason(signal));
|
|
2298
|
+
};
|
|
2299
|
+
const timer = setTimeout(() => {
|
|
2300
|
+
signal?.removeEventListener("abort", onAbort);
|
|
2301
|
+
resolve();
|
|
2302
|
+
}, ms);
|
|
2303
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
2304
|
+
});
|
|
2305
|
+
}
|
|
2306
|
+
/** As the reactor's `signAction` reads it: the last tuple names a key. */
|
|
2307
|
+
function isActionSigned(action) {
|
|
2308
|
+
const signer = action.context?.signer;
|
|
2309
|
+
return Boolean(signer?.app?.key && signer.signatures.at(-1)?.[1]);
|
|
2310
|
+
}
|
|
1844
2311
|
/** Resolves the signer of the logged-in user, if there is one. */
|
|
1845
2312
|
function resolveAmbientSigner() {
|
|
1846
2313
|
if (typeof window === "undefined") return;
|
|
@@ -2515,89 +2982,91 @@ function useSwitchboardClient() {
|
|
|
2515
2982
|
}
|
|
2516
2983
|
//#endregion
|
|
2517
2984
|
//#region src/hooks/document-operations.ts
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
const
|
|
2527
|
-
const
|
|
2528
|
-
const
|
|
2529
|
-
globalOperations: [],
|
|
2530
|
-
localOperations: [],
|
|
2531
|
-
isLoading: !!documentId,
|
|
2532
|
-
error: void 0
|
|
2533
|
-
}));
|
|
2534
|
-
const fetchOperations = useCallback(async (retryCount = 0) => {
|
|
2535
|
-
const MAX_RETRIES = 5;
|
|
2536
|
-
const RETRY_DELAY_MS = 500;
|
|
2537
|
-
if (!documentId || !reactorClient) {
|
|
2538
|
-
setState({
|
|
2539
|
-
globalOperations: [],
|
|
2540
|
-
localOperations: [],
|
|
2541
|
-
isLoading: false,
|
|
2542
|
-
error: void 0
|
|
2543
|
-
});
|
|
2544
|
-
return;
|
|
2545
|
-
}
|
|
2546
|
-
setState((prev) => ({
|
|
2547
|
-
...prev,
|
|
2548
|
-
isLoading: true,
|
|
2549
|
-
error: void 0
|
|
2550
|
-
}));
|
|
2551
|
-
let globalOps = [];
|
|
2552
|
-
let localOps = [];
|
|
2553
|
-
let fetchError;
|
|
2554
|
-
try {
|
|
2555
|
-
globalOps = (await reactorClient.getOperations(documentId, { scopes: ["global"] })).results;
|
|
2556
|
-
} catch (err) {
|
|
2557
|
-
fetchError = err instanceof Error ? err : new Error(String(err));
|
|
2558
|
-
}
|
|
2559
|
-
if (!fetchError) try {
|
|
2560
|
-
localOps = (await reactorClient.getOperations(documentId, { scopes: ["local"] })).results;
|
|
2561
|
-
} catch (err) {
|
|
2562
|
-
fetchError = err instanceof Error ? err : new Error(String(err));
|
|
2563
|
-
}
|
|
2564
|
-
if (!fetchError && globalOps.length === 0 && localOps.length === 0 && retryCount < MAX_RETRIES) {
|
|
2565
|
-
await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY_MS));
|
|
2566
|
-
return fetchOperations(retryCount + 1);
|
|
2567
|
-
}
|
|
2568
|
-
setState({
|
|
2569
|
-
globalOperations: globalOps,
|
|
2570
|
-
localOperations: localOps,
|
|
2571
|
-
isLoading: false,
|
|
2572
|
-
error: fetchError
|
|
2573
|
-
});
|
|
2574
|
-
hasFetchedRef.current = true;
|
|
2575
|
-
}, [documentId, reactorClient]);
|
|
2985
|
+
const DEFAULT_LIMIT = 100;
|
|
2986
|
+
function toError(reason) {
|
|
2987
|
+
return reason instanceof Error ? reason : new Error(String(reason));
|
|
2988
|
+
}
|
|
2989
|
+
const EMPTY_OPERATIONS = [];
|
|
2990
|
+
function useScopeOperations(documentId, scope, options = {}) {
|
|
2991
|
+
const { limit = DEFAULT_LIMIT, enabled = true } = options;
|
|
2992
|
+
const documentCache = useDocumentCache();
|
|
2993
|
+
const cache = documentCache && isOperationCache(documentCache) ? documentCache : void 0;
|
|
2994
|
+
const activeId = enabled && cache && documentId ? documentId : void 0;
|
|
2995
|
+
const entry = useSyncExternalStore((onChange) => activeId && cache ? cache.subscribeOperations(activeId, onChange) : () => {}, () => activeId && cache ? cache.getOperationsState(activeId, scope) : IDLE_OPERATIONS_ENTRY);
|
|
2576
2996
|
useEffect(() => {
|
|
2577
|
-
if (
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2997
|
+
if (activeId && cache && entry.status === "idle") cache.loadOperations(activeId, scope, limit);
|
|
2998
|
+
}, [
|
|
2999
|
+
activeId,
|
|
3000
|
+
cache,
|
|
3001
|
+
scope,
|
|
3002
|
+
limit,
|
|
3003
|
+
entry.status
|
|
3004
|
+
]);
|
|
3005
|
+
const fetchNextPage = useCallback(() => {
|
|
3006
|
+
if (activeId && cache) cache.loadMoreOperations(activeId, scope);
|
|
2587
3007
|
}, [
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
3008
|
+
activeId,
|
|
3009
|
+
cache,
|
|
3010
|
+
scope
|
|
2591
3011
|
]);
|
|
2592
3012
|
const refetch = useCallback(() => {
|
|
2593
|
-
|
|
2594
|
-
}, [
|
|
3013
|
+
if (activeId && cache) cache.invalidateOperations(activeId);
|
|
3014
|
+
}, [activeId, cache]);
|
|
3015
|
+
const error = useMemo(() => entry.status === "error" ? toError(entry.error) : void 0, [entry.status, entry.error]);
|
|
2595
3016
|
return {
|
|
2596
|
-
|
|
3017
|
+
operations: entry.operations,
|
|
3018
|
+
isLoading: entry.status === "pending" || !!activeId && entry.status === "idle",
|
|
3019
|
+
error,
|
|
3020
|
+
hasNextPage: entry.hasNextPage,
|
|
3021
|
+
fetchNextPage,
|
|
2597
3022
|
refetch
|
|
2598
3023
|
};
|
|
2599
3024
|
}
|
|
3025
|
+
/** Keeps paging `result` to completion while `enabled` is true. */
|
|
3026
|
+
function useLoadAllPages(result, enabled) {
|
|
3027
|
+
useEffect(() => {
|
|
3028
|
+
if (!enabled || !result.hasNextPage || result.isLoading) return;
|
|
3029
|
+
const handle = window.setTimeout(result.fetchNextPage, 0);
|
|
3030
|
+
return () => window.clearTimeout(handle);
|
|
3031
|
+
}, [
|
|
3032
|
+
enabled,
|
|
3033
|
+
result.hasNextPage,
|
|
3034
|
+
result.isLoading,
|
|
3035
|
+
result.fetchNextPage
|
|
3036
|
+
]);
|
|
3037
|
+
}
|
|
3038
|
+
function useDocumentOperations(documentId, scope, options = {}) {
|
|
3039
|
+
const legacy = scope === void 0;
|
|
3040
|
+
const primary = useScopeOperations(documentId, legacy ? "global" : scope, legacy ? {} : options);
|
|
3041
|
+
const local = useScopeOperations(documentId, "local", { enabled: legacy });
|
|
3042
|
+
useLoadAllPages(primary, legacy);
|
|
3043
|
+
useLoadAllPages(local, legacy);
|
|
3044
|
+
const globalOperations = useMemo(() => legacy ? [...primary.operations] : EMPTY_OPERATIONS, [legacy, primary.operations]);
|
|
3045
|
+
const localOperations = useMemo(() => legacy ? [...local.operations] : EMPTY_OPERATIONS, [legacy, local.operations]);
|
|
3046
|
+
const refetch = useCallback(() => {
|
|
3047
|
+
primary.refetch();
|
|
3048
|
+
local.refetch();
|
|
3049
|
+
}, [primary.refetch, local.refetch]);
|
|
3050
|
+
const error = primary.error ?? local.error;
|
|
3051
|
+
const legacyResult = useMemo(() => ({
|
|
3052
|
+
globalOperations,
|
|
3053
|
+
localOperations,
|
|
3054
|
+
isLoading: !error && (primary.isLoading || local.isLoading || primary.hasNextPage || local.hasNextPage),
|
|
3055
|
+
error,
|
|
3056
|
+
refetch
|
|
3057
|
+
}), [
|
|
3058
|
+
globalOperations,
|
|
3059
|
+
localOperations,
|
|
3060
|
+
error,
|
|
3061
|
+
primary.isLoading,
|
|
3062
|
+
local.isLoading,
|
|
3063
|
+
primary.hasNextPage,
|
|
3064
|
+
local.hasNextPage,
|
|
3065
|
+
refetch
|
|
3066
|
+
]);
|
|
3067
|
+
return legacy ? legacyResult : primary;
|
|
3068
|
+
}
|
|
2600
3069
|
//#endregion
|
|
2601
|
-
export { addDefaultDrivesUrlEventHandler as $, useIsAddLocalDrivesEnabled as $n,
|
|
3070
|
+
export { addDefaultDrivesUrlEventHandler as $, useIsAddLocalDrivesEnabled as $n, viewFilterInputFromViewFilter as $r, setEnabledEditors as $t, useReactorClientModule as A, copyNode$1 as Ai, setRenownUrl as An, useSentryRelease as Ar, addRenownAdaptersEventHandler as At, useDragNode as B, setPreferredEditorOnNode as Bi, setWarnOutdatedApp as Bn, phAppConfigHooks as Br, addSwitchboardUrlEventHandler as Bt, addReactorClientModuleEventHandler as C, convertRemoteOperations as Ci, setIsRelationalProcessorsEnabled as Cn, useRenownChainId as Cr, addIsExternalRelationalProcessorsEnabledEventHandler as Ct, useModelRegistry as D, addDocument as Di, setRenownAdapters as Dn, useRouterBasename as Dr, addIsSentryTracingEnabledEventHandler as Dt, useDatabase as E, screamingSnakeToCamel as Ei, setLogLevel as En, useRequiresHardRefresh as Er, addIsRelationalProcessorsEnabledEventHandler as Et, usePackageDiscoveryService as F, getDocumentExtension as Fi, setSentryRelease as Fn, useWarnOutdatedApp as Fr, addRouterBasenameEventHandler as Ft, useFeatures as G, closePHModal as Gi, useDefaultDrivesUrl as Gn, setIsDragAndDropEnabled as Gr, phGlobalConfigSetters as Gt, useDropTarget as H, getUserPermissions as Hi, useAnalyticsDatabaseName as Hn, phDocumentEditorConfigHooks as Hr, addVersionEventHandler as Ht, addGraphQLReactorClientEventHandler as I, loadFile as Ii, setStudioMode as In, addAllowedDocumentTypesEventHandler as Ir, addSentryDsnEventHandler as It, useAttachmentService as J, showDeleteNodeModal as Ji, useEnabledEditors as Jn, useIsDragAndDropEnabled as Jr, setBasePath as Jt, addAttachmentServiceEventHandler as K, setPHModal as Ki, useDisabledEditors as Kn, setIsExternalControlsEnabled as Kr, setAllowList as Kt, setGraphQLReactorClient as L, moveNode$1 as Li, setSwitchboardUrl as Ln, addIsDragAndDropEnabledEventHandler as Lr, addSentryEnvEventHandler as Lt, useSyncList as M, exportFile as Mi, setRouterBasename as Mn, useSwitchboardUrl as Mr, addRenownNetworkIdEventHandler as Mt, addPackageDiscoveryServiceEventHandler as N, extractInitialState as Ni, setSentryDsn as Nn, useVersion as Nr, addRenownUrlEventHandler as Nt, usePGlite as O, addFileWithProgress as Oi, setRenownChainId as On, useSentryDsn as Or, addLocalDrivesEnabledEventHandler as Ot, setPackageDiscoveryService as P, fetchDocumentOperations as Pi, setSentryEnv as Pn, useVersionCheckInterval as Pr, addRequiresHardRefreshEventHandler as Pt, addCliVersionEventHandler as Q, useIsAddDriveEnabled as Qn, isGraphQLReactorClient as Qr, setDrivesPreserveStrategy as Qt, useGraphQLReactorClient as R, renameDriveNode as Ri, setVersion as Rn, addIsExternalControlsEnabledEventHandler as Rr, addSentryReleaseEventHandler as Rt, addReactorClientEventHandler as S, buildPulledDocument as Si, setIsPublicDrivesEnabled as Sn, useRenownAdapters as Sr, addIsExternalProcessorsEnabledEventHandler as St, setReactorClientModule as T, hasRevisionConflict as Ti, setLocalDrivesEnabled as Tn, useRenownUrl as Tr, addIsPublicDrivesEnabledEventHandler as Tt, addFeaturesEventHandler as U, isDocumentTypeSupported as Ui, useBasePath as Un, phDocumentEditorConfigSetters as Ur, addWarnOutdatedAppEventHandler as Ut, useDropNode as V, upgradeDocument as Vi, useAllowList as Vn, phAppConfigSetters as Vr, addVersionCheckIntervalEventHandler as Vt, setFeatures as W, addModalEventHandler as Wi, useCliVersion as Wn, setAllowedDocumentTypes as Wr, phGlobalConfigHooks as Wt, addAnalyticsDatabaseNameEventHandler as X, usePHModal as Xi, useGaTrackingId as Xn, GraphQLReactorClient as Xr, setDefaultDrivesUrl as Xt, addAllowListEventHandler as Y, showPHModal as Yi, useFileUploadOperationsChunkSize as Yn, useIsExternalControlsEnabled as Yr, setCliVersion as Yt, addBasePathEventHandler as Z, useIsAddCloudDrivesEnabled as Zn, findIsServableOverGraphQL as Zr, setDisabledEditors as Zt, addRevisionHistoryVisibleEventHandler as _, isoStringFromDateTime as _i, setIsEditorReadModeEnabled as _n, useIsPublicDrivesEnabled as _r, addIsDocumentModelSelectionSettingsEnabledEventHandler as _t, addPHEventHandlers as a, describeGraphQLDocument as ai, setIsAddPublicDrivesEnabled as an, useIsDeleteCloudDrivesEnabled as ar, addIsAddCloudDrivesEnabledEventHandler as at, showRevisionHistory as b, revisionMapFromRevisionsList as bi, setIsExternalRelationalProcessorsEnabled as bn, useLocalDrivesEnabled as br, addIsEditorReadModeEnabledEventHandler as bt, addToastEventHandler as c, packageFromDocumentModels as ci, setIsAnalyticsExternalProcessorsEnabled as cn, useIsDiffAnalyticsEnabled as cr, addIsAddPublicDrivesEnabledEventHandler as ct, addSelectedTimelineRevisionEventHandler as d, signStampedAction as di, setIsDeleteLocalDrivesEnabled as dn, useIsEditorDebugModeEnabled as dr, addIsAnalyticsExternalProcessorsEnabledEventHandler as dt, isAuthRefusalClose as ei, setFileUploadOperationsChunkSize as en, useIsAddPublicDrivesEnabled as er, addDisabledEditorsEventHandler as et, setSelectedTimelineRevision as f, stampAction as fi, setIsDeletePublicDrivesEnabled as fn, useIsEditorReadModeEnabled as fr, addIsCloudDrivesEnabledEventHandler as ft, useSelectedTimelineItem as g, GraphQLOperationNotSupportedError as gi, setIsEditorDebugModeEnabled as gn, useIsLocalDrivesEnabled as gr, addIsDiffAnalyticsEnabledEventHandler as gt, setSelectedTimelineItem as h, BatchJobFailedError as hi, setIsDriveAnalyticsEnabled as hn, useIsExternalRelationalProcessorsEnabled as hr, addIsDeletePublicDrivesEnabledEventHandler as ht, useSwitchboardClient as i, SubgraphSdkRegistry as ii, setIsAddLocalDrivesEnabled as in, useIsCloudDrivesEnabled as ir, addGaTrackingIdEventHandler as it, useSync as j, deleteNode as ji, setRequiresHardRefresh as jn, useStudioMode as jr, addRenownChainIdEventHandler as jt, useReactorClient as k, addFolder$1 as ki, setRenownNetworkId as kn, useSentryEnv as kr, addLogLevelEventHandler as kt, setPHToast as l, resolveDocumentModelModule as li, setIsCloudDrivesEnabled as ln, useIsDocumentModelSelectionSettingsEnabled as lr, addIsAnalyticsDatabaseWorkerEnabledEventHandler as lt, addSelectedTimelineItemEventHandler as m, ReactorOperationFieldsFragmentDoc as mi, setIsDocumentModelSelectionSettingsEnabled as mn, useIsExternalProcessorsEnabled as mr, addIsDeleteLocalDrivesEnabledEventHandler as mt, GraphQLReactorProvider as n, startDocumentChangesSubscription as ni, setIsAddCloudDrivesEnabled as nn, useIsAnalyticsEnabled as nr, addEnabledEditorsEventHandler as nt, callEventHandlerRegisterFunctions as o, subgraphUrlFromGraphqlUrl as oi, setIsAnalyticsDatabaseWorkerEnabled as on, useIsDeleteLocalDrivesEnabled as or, addIsAddDriveEnabledEventHandler as ot, useSelectedTimelineRevision as p, MutateDocumentWithOperationsDocument as pi, setIsDiffAnalyticsEnabled as pn, useIsExternalPackagesEnabled as pr, addIsDeleteCloudDrivesEnabledEventHandler as pt, setAttachmentService as q, showCreateDocumentModal as qi, useDrivesPreserveStrategy as qn, useAllowedDocumentTypes as qr, setAnalyticsDatabaseName as qt, ensurePHEventHandlers as r, subscriptionsUrlFromGraphqlUrl as ri, setIsAddDriveEnabled as rn, useIsAnalyticsExternalProcessorsEnabled as rr, addFileUploadOperationsChunkSizeEventHandler as rt, commonGlobalEventHandlerFunctions as s, StaticPackageManager as si, setIsAnalyticsEnabled as sn, useIsDeletePublicDrivesEnabled as sr, addIsAddLocalDrivesEnabledEventHandler as st, useDocumentOperations as t, makeAuthConnectionParams as ti, setGaTrackingId as tn, useIsAnalyticsDatabaseWorkerEnabled as tr, addDrivesPreserveStrategyEventHandler as tt, usePHToast as u, prepareSignedActions as ui, setIsDeleteCloudDrivesEnabled as un, useIsDriveAnalyticsEnabled as ur, addIsAnalyticsEnabledEventHandler as ut, hideRevisionHistory as v, phDocumentFromGetDocument as vi, setIsExternalPackagesEnabled as vn, useIsRelationalProcessorsEnabled as vr, addIsDriveAnalyticsEnabledEventHandler as vt, setReactorClient as w, extractRevisionMap as wi, setIsSentryTracingEnabled as wn, useRenownNetworkId as wr, addIsLocalDrivesEnabledEventHandler as wt, useRevisionHistoryVisible as x, ConflictError as xi, setIsLocalDrivesEnabled as xn, useLogLevel as xr, addIsExternalPackagesEnabledEventHandler as xt, setRevisionHistoryVisible as y, phDocumentFromMutation as yi, setIsExternalProcessorsEnabled as yn, useIsSentryTracingEnabled as yr, addIsEditorDebugModeEnabledEventHandler as yt, addDraggingNodeEventHandler as z, renameNode as zi, setVersionCheckInterval as zn, isExternalControlsEnabledEventFunctions as zr, addStudioModeEventHandler as zt };
|
|
2602
3071
|
|
|
2603
|
-
//# sourceMappingURL=document-operations-
|
|
3072
|
+
//# sourceMappingURL=document-operations-CpzMebZ3.js.map
|