@powerhousedao/reactor-browser 6.2.3-dev.9 → 6.2.3-dev.90
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-10Qn5nIw.d.ts} +766 -108
- package/dist/attachment-service-10Qn5nIw.d.ts.map +1 -0
- package/dist/auth-DzIYxeEJ.d.ts +32 -0
- package/dist/auth-DzIYxeEJ.d.ts.map +1 -0
- package/dist/{client-DjK30EQ-.js → client-BFnMV-EO.js} +39 -22
- package/dist/client-BFnMV-EO.js.map +1 -0
- package/dist/{client-D66jVnot.js → client-BNMyQ_Z2.js} +372 -33
- package/dist/client-BNMyQ_Z2.js.map +1 -0
- package/dist/{client-BIHN_UyR.d.ts → client-C-NgSjoc.d.ts} +4 -3
- package/dist/client-C-NgSjoc.d.ts.map +1 -0
- package/dist/dispatch-Cylwl2Dk.js +1173 -0
- package/dist/dispatch-Cylwl2Dk.js.map +1 -0
- package/dist/document-by-id-DdvqanGR.js +16 -0
- package/dist/document-by-id-DdvqanGR.js.map +1 -0
- package/dist/document-model-modules-ChmfyIxT.js +644 -0
- package/dist/document-model-modules-ChmfyIxT.js.map +1 -0
- package/dist/document-operations-o9cfLoeV.js +4662 -0
- package/dist/document-operations-o9cfLoeV.js.map +1 -0
- package/dist/global-bbfp3_1x.d.ts +649 -0
- package/dist/global-bbfp3_1x.d.ts.map +1 -0
- package/dist/{index-B33TKEqp.d.ts → index-Bfr_cWdi.d.ts} +31 -100
- package/dist/index-Bfr_cWdi.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 +837 -411
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +851 -129
- package/dist/index.js.map +1 -1
- package/dist/inspector-proxy-DODqs15F.d.ts +25 -0
- package/dist/inspector-proxy-DODqs15F.d.ts.map +1 -0
- package/dist/make-ph-event-functions-B5GU5xcR.js +180 -0
- package/dist/make-ph-event-functions-B5GU5xcR.js.map +1 -0
- 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-DZuyKp2y.js} +66 -5
- package/dist/relational-DZuyKp2y.js.map +1 -0
- package/dist/{renown-rqK8sokh.js → renown-B3MUaiq7.js} +61 -31
- package/dist/renown-B3MUaiq7.js.map +1 -0
- package/dist/renown-CBoTdGrg.js +394 -0
- package/dist/renown-CBoTdGrg.js.map +1 -0
- package/dist/{types-Dcv1ZLoW.d.ts → schema-Bn6L3QR1.d.ts} +324 -64
- package/dist/schema-Bn6L3QR1.d.ts.map +1 -0
- package/dist/src/ai/index.d.ts +276 -75
- package/dist/src/ai/index.d.ts.map +1 -1
- package/dist/src/ai/index.js +733 -172
- 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 +4 -4
- 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 +6 -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 +3 -3
- package/dist/src/rpc/index.d.ts +217 -140
- package/dist/src/rpc/index.d.ts.map +1 -1
- package/dist/src/rpc/index.js +600 -623
- 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-B640iT1L.js} +61 -11
- package/dist/switchboard-B640iT1L.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-CT44EMmw.d.ts +59 -0
- package/dist/types-CT44EMmw.d.ts.map +1 -0
- package/package.json +24 -23
- 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 +0 -519
- package/dist/document-by-id-B4FIzG1w.js.map +0 -1
- package/dist/document-model-modules-bTP87nyr.js +0 -419
- package/dist/document-model-modules-bTP87nyr.js.map +0 -1
- package/dist/document-operations-WeE6wIDt.js +0 -2603
- package/dist/document-operations-WeE6wIDt.js.map +0 -1
- package/dist/global-OuINvEGT.d.ts +0 -401
- 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/make-ph-event-functions-DBq3iWYn.js +0 -53
- package/dist/make-ph-event-functions-DBq3iWYn.js.map +0 -1
- package/dist/pglite-CntadC_p-9NDG14dS.d.ts.map +0 -1
- package/dist/relational-D1RB45sA.js.map +0 -1
- package/dist/renown-BHxwP7xU.js +0 -97
- package/dist/renown-BHxwP7xU.js.map +0 -1
- package/dist/renown-rqK8sokh.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
package/dist/index.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { A as
|
|
3
|
-
import { t as
|
|
4
|
-
import { $ as
|
|
5
|
-
import { a as
|
|
1
|
+
import { a as createPHStore, c as getPHStore, d as subscribePHStore, f as usePHStore, i as bindPHStoreToWindow, l as getPHStoreSubscribe, n as subscribeToPHValue, o as ensurePHStore, r as PHStoreProvider, s as getActivePHStore, t as makePHEventFunctions, u as notifyPHStore } from "./make-ph-event-functions-B5GU5xcR.js";
|
|
2
|
+
import { A as DocumentModelNotFoundError, E as dispatchActions, M as NoSelectedDocumentError, N as OperationRejectedError, P as UnsupportedDocumentTypeError, T as IDLE_REFETCH_STATE, _ as isDocumentTypeCache, a as useDocument, b as DOCUMENT_CHANGE_TYPE, c as useDocuments, d as useGetDocuments, f as DocumentCache, g as addPromiseState, h as IDLE_OPERATIONS_ENTRY, i as setDocumentCache, j as DocumentTypeMismatchError, l as useGetDocument, m as IDLE_DOCUMENTS_OF_TYPE_ENTRY, n as useDispatch, o as useDocumentCache, p as GET_MANY_CHUNK_SIZE, r as addDocumentCacheEventHandler, s as useDocumentSafe, t as createDispatch, u as useGetDocumentAsync, v as isOperationCache, w as DocumentRefetcher, y as readPromiseState } from "./dispatch-Cylwl2Dk.js";
|
|
3
|
+
import { $ as makeAuthMiddleware, A as addDrivesEventHandler, B as invalidateDriveNodes, C as setSelectedNode, D as usePreloadNode, E as useOpenNode, F as isInitialSyncInFlight, G as useDriveNode, H as markLocalDriveWrite, I as listSyncRemotes, J as isFileNodeKind, K as useDriveNodes, L as addDriveNodesEventHandler, M as useDrives, N as DriveProvider, P as useDriveContext, Q as ambientRenownTokenProvider, R as dropDriveNode, S as selectNode, T as useNodeTarget, U as peekDriveNode, V as loadDriveNodes, W as takeLocalDriveWrite, X as listAllDriveNodes, Y as isFolderNodeKind, Z as sortNodesByName, _ as useSetSelectedDrive, a as setVetraPackageManager, b as getNodeTarget, c as addSelectedDriveIdEventHandler, d as setSelectedDrive, f as setSelectedDriveId, g as useSelectedDriveSafe, h as useSelectedDriveId, i as onVetraPackageManager, j as setDrives, k as useSetSelectedNode, l as preloadDrive, m as useSelectedDrive, n as useDocumentModelModules, o as useVetraPackageManager, p as usePreloadDrive, q as useDriveNodesCache, r as addVetraPackageManagerEventHandler, s as useVetraPackages, t as useDocumentModelModuleById, u as selectDrive, v as addResetSelectedNodeEventHandler, w as setSelectedNodeId, x as preloadNode, y as addSelectedNodeIdEventHandler, z as getDriveNode } from "./document-model-modules-ChmfyIxT.js";
|
|
4
|
+
import { $ as makeNodeSlug, A as openTargetWith, B as createUrlWithPreservedParams, C as getCurrentPathname, D as isGlobalSearchParam, E as hasHostNavigation, F as searchParamsToString, G as extractNodeIdFromSlug, H as extractDriveIdFromSlug, I as searchToRecord, J as findDriveBySlug, K as extractNodeSlugFromPath, L as setBrowserOpenSync, M as preloadTarget, N as recordToSearch, O as isSettingsTarget, P as resolveSearchUpdate, Q as makeDriveUrlComponent, R as setSearchParams, S as browserNavigation, T as getTargetHref, U as extractDriveSlugFromPath, V as extractDriveIdFromPath, W as extractNodeIdFromPath, X as getPathWithoutBase, Y as findUuid, Z as makeDriveSlug, _ as GLOBAL_SEARCH_PARAMS, a as useRenown, b as SETTINGS_PATH, c as RENOWN_INITIAL_UNKNOWN, d as useRenownInitialUser, et as resolveUrlPathname, f as addLoadingEventHandler, g as FEATURE_FLAG_PARAM_PREFIX, h as useLoading, i as useLoginStatus, j as openedFromIndex, k as openTarget, l as RenownInitialUserProvider, m as setLoading, n as setRenown, o as useUser, p as loading, q as findDerivedId, r as useDid, s as RENOWN_INITIAL_ANONYMOUS, t as addRenownEventHandler, u as useRenownInitialAuth, v as OPENED_FROM_STATE_KEY, w as getPHNavigation, x as applySearchUpdate, y as PH_LOCATION_CHANGE_EVENT, z as targetPathname } from "./renown-CBoTdGrg.js";
|
|
5
|
+
import { $ as addIsAddDriveEnabledEventHandler, $i as copyNode$1, $n as useIsDeleteLocalDrivesEnabled, $r as isGraphQLReactorClient, $t as setIsAnalyticsDatabaseWorkerEnabled, A as setGraphQLReactorClient, Aa as addModalEventHandler, Ai as phDocumentFromGetDocument, An as setSwitchboardUrl, Ar as addIsDragAndDropEnabledEventHandler, At as addSentryEnvEventHandler, B as setAttachmentService, Ba as useModalLinkProps, Bi as underSignaturePolicy, Bn as useDrivesPreserveStrategy, Br as useAllowedDocumentTypes, Bt as setAnalyticsDatabaseName, C as addSetSelectedNodeOnPopStateEventHandler, Ca as usePGlite, Ci as switchboardFetch, Cn as setRenownUrl, Cr as useSentryRelease, Ct as addRenownAdaptersEventHandler, D as setPackageDiscoveryService, Da as useSync, Di as GraphQLDriveReadClient, Dn as setSentryEnv, Dr as useVersionCheckInterval, Dt as addRequiresHardRefreshEventHandler, E as addPackageDiscoveryServiceEventHandler, Ea as useReactorHalves, Ei as GraphQLDriveNodeSource, En as setSentryDsn, Er as useVersion, Et as addRenownUrlEventHandler, F as useDropTarget, Fa as modalSearch, Fi as convertRemoteOperations, Fn as useAnalyticsDatabaseName, Fr as phDocumentEditorConfigHooks, Ft as addVersionEventHandler, G as addCliVersionEventHandler, Ga as usePHNavigation, Gi as GraphQLOperationNotSupportedError, Gn as useIsAddDriveEnabled, Gr as isBackendAuthError, Gt as setDrivesPreserveStrategy, H as addAllowListEventHandler, Ha as withoutModalSearch, Hi as DEFAULT_DRIVE_EDITOR_ID, Hn as useFileUploadOperationsChunkSize, Hr as useIsExternalControlsEnabled, Ht as setCliVersion, I as addFeaturesEventHandler, Ia as setPHModal, Ii as extractRevisionMap, In as useBasePath, Ir as phDocumentEditorConfigSetters, It as addWarnOutdatedAppEventHandler, J as addDrivesPreserveStrategyEventHandler, Ji as queriesUnknownArgument, Jn as useIsAnalyticsDatabaseWorkerEnabled, Jr as useBackendAuth, Jt as setGaTrackingId, K as addDefaultDrivesUrlEventHandler, Ka as useSearchParams, Ki as GraphQLWrongBackendError, Kn as useIsAddLocalDrivesEnabled, Kr as recordBackendAuthError, Kt as setEnabledEditors, L as setFeatures, La as showCreateDocumentModal, Li as hasRevisionConflict, Ln as useCliVersion, Lr as setAllowedDocumentTypes, Lt as phGlobalConfigHooks, M as addDraggingNodeEventHandler, Ma as isRoutedModal, Mi as revisionMapFromRevisionsList, Mn as setVersionCheckInterval, Mr as isExternalControlsEnabledEventFunctions, Mt as addStudioModeEventHandler, N as useDragNode, Na as modalFromSearch, Ni as ConflictError, Nn as setWarnOutdatedApp, Nr as phAppConfigHooks, Nt as addSwitchboardUrlEventHandler, O as usePackageDiscoveryService, Oa as useSyncList, Oi as toLegacyNode, On as setSentryRelease, Or as useWarnOutdatedApp, Ot as addRouterBasenameEventHandler, P as useDropNode, Pa as modalHref, Pi as buildPulledDocument, Pn as useAllowList, Pr as phAppConfigSetters, Pt as addVersionCheckIntervalEventHandler, Q as addIsAddCloudDrivesEnabledEventHandler, Qi as addFolder, Qn as useIsDeleteCloudDrivesEnabled, Qr as findIsServableOverGraphQL, Qt as setIsAddPublicDrivesEnabled, R as useFeatures, Ra as showDeleteNodeModal, Ri as screamingSnakeToCamel, Rn as useDefaultDrivesUrl, Rr as setIsDragAndDropEnabled, Rt as phGlobalConfigSetters, S as addSetSelectedDriveOnPopStateEventHandler, Sa as useModelRegistry, Si as isNodeFetch, Sn as setRenownNetworkId, Sr as useSentryEnv, St as addLogLevelEventHandler, T as syncSelectionFromPath, Ta as useReactorClientModule, Ti as withStreamedBodies, Tn as setRouterBasename, Tr as useSwitchboardUrl, Tt as addRenownNetworkIdEventHandler, U as addAnalyticsDatabaseNameEventHandler, Ua as isPlainClick, Ui as DRIVE_DOCUMENT_TYPES, Un as useGaTrackingId, Ur as addBackendAuthEventHandler, Ut as setDefaultDrivesUrl, V as useAttachmentService, Va as usePHModal, Vi as COMMON_PACKAGE_ID, Vn as useEnabledEditors, Vr as useIsDragAndDropEnabled, Vt as setBasePath, W as addBasePathEventHandler, Wa as useLinkProps, Wi as BatchJobFailedError, Wn as useIsAddCloudDrivesEnabled, Wr as backendAuthStatusOf, Wt as setDisabledEditors, X as addFileUploadOperationsChunkSizeEventHandler, Xi as addDocument, Xn as useIsAnalyticsExternalProcessorsEnabled, Xr as ambientRenownSigner, Xt as setIsAddDriveEnabled, Y as addEnabledEditorsEventHandler, Yi as queriesUnknownField, Yn as useIsAnalyticsEnabled, Yr as GraphQLReactorClient, Yt as setIsAddCloudDrivesEnabled, Z as addGaTrackingIdEventHandler, Zi as addFileWithProgress, Zn as useIsCloudDrivesEnabled, Zr as createGraphQLDriveNodeSource, Zt as setIsAddLocalDrivesEnabled, _ as setSelectedTimelineRevision, _a as getFullReactorClient, _i as ReactorOperationFieldsFragmentDoc, _n as setIsSentryTracingEnabled, _r as useRenownNetworkId, _t as addIsLocalDrivesEnabledEventHandler, a as SwitchboardUnreachableError, aa as loadFile, ai as subscriptionsUrlFromGraphqlUrl, an as setIsDeletePublicDrivesEnabled, ar as useIsEditorReadModeEnabled, at as addIsCloudDrivesEnabledEventHandler, b as setSelectedTimelineItem, ba as setReactorClientModule, bi as globalFetch, bn as setRenownAdapters, br as useRouterBasename, bt as addIsSentryTracingEnabledEventHandler, c as ensurePHEventHandlers, ca as renameNode, ci as subgraphUrlFromGraphqlUrl, cn as setIsDriveAnalyticsEnabled, cr as useIsExternalRelationalProcessorsEnabled, ct as addIsDeletePublicDrivesEnabledEventHandler, d as callEventHandlerRegisterFunctions, da as getUserPermissions, di as resolveDocumentModelModule, dn as setIsExternalPackagesEnabled, dr as useIsRelationalProcessorsEnabled, dt as addIsDriveAnalyticsEnabledEventHandler, ea as deleteNode, ei as viewFilterInputFromViewFilter, en as setIsAnalyticsEnabled, er as useIsDeletePublicDrivesEnabled, et as addIsAddLocalDrivesEnabledEventHandler, f as commonGlobalEventHandlerFunctions, fa as isDocumentTypeSupported, fi as prepareSignedActions, fn as setIsExternalProcessorsEnabled, fr as useIsSentryTracingEnabled, ft as addIsEditorDebugModeEnabledEventHandler, g as addSelectedTimelineRevisionEventHandler, ga as addReactorHalvesEventHandler, gi as MutateDocumentWithOperationsDocument, gn as setIsRelationalProcessorsEnabled, gr as useRenownChainId, gt as addIsExternalRelationalProcessorsEnabledEventHandler, h as usePHToast, ha as addReactorClientModuleEventHandler, hi as GetDocumentAtConsistencyDocument, hn as setIsPublicDrivesEnabled, hr as useRenownAdapters, ht as addIsExternalProcessorsEnabledEventHandler, i as DEFAULT_REQUEST_TIMEOUT_MS, ia as getDocumentExtension, ii as startDocumentChangesSubscription, in as setIsDeleteLocalDrivesEnabled, ir as useIsEditorDebugModeEnabled, it as addIsAnalyticsExternalProcessorsEnabledEventHandler, j as useGraphQLReactorClient, ja as closePHModal, ji as phDocumentFromMutation, jn as setVersion, jr as addIsExternalControlsEnabledEventHandler, jt as addSentryReleaseEventHandler, k as addGraphQLReactorClientEventHandler, ka as MODAL_SEARCH_PARAM, ki as isoStringFromDateTime, kn as setStudioMode, kr as addAllowedDocumentTypesEventHandler, kt as addSentryDsnEventHandler, l as useSwitchboardClient, la as setPreferredEditorOnNode, li as StaticPackageManager, ln as setIsEditorDebugModeEnabled, lr as useIsLocalDrivesEnabled, lt as addIsDiffAnalyticsEnabledEventHandler, m as setPHToast, ma as addReactorClientEventHandler, mi as stampAction, mn as setIsLocalDrivesEnabled, mr as useLogLevel, mt as addIsExternalPackagesEnabledEventHandler, n as DEFAULT_BATCH_REQUEST_TIMEOUT_MS, na as extractInitialState, ni as isAuthRefusalClose, nn as setIsCloudDrivesEnabled, nr as useIsDocumentModelSelectionSettingsEnabled, nt as addIsAnalyticsDatabaseWorkerEnabledEventHandler, o as createSwitchboardBackend, oa as moveNode$1, oi as SubgraphSdkRegistry, on as setIsDiffAnalyticsEnabled, or as useIsExternalPackagesEnabled, ot as addIsDeleteCloudDrivesEnabledEventHandler, p as addToastEventHandler, pa as addFullReactorClientEventHandler, pi as signStampedAction, pn as setIsExternalRelationalProcessorsEnabled, pr as useLocalDrivesEnabled, pt as addIsEditorReadModeEnabledEventHandler, q as addDisabledEditorsEventHandler, qa as useSetSearchParams, qi as JobFailedError, qn as useIsAddPublicDrivesEnabled, qr as setBackendAuth, qt as setFileUploadOperationsChunkSize, r as DEFAULT_BREAKER, ra as fetchDocumentOperations, ri as makeAuthConnectionParams, rn as setIsDeleteCloudDrivesEnabled, rr as useIsDriveAnalyticsEnabled, rt as addIsAnalyticsEnabledEventHandler, s as GraphQLReactorProvider, sa as renameDriveNode, si as describeGraphQLDocument, sn as setIsDocumentModelSelectionSettingsEnabled, sr as useIsExternalProcessorsEnabled, st as addIsDeleteLocalDrivesEnabledEventHandler, t as useDocumentOperations, ta as exportFile, ti as createJobChangesSocket, tn as setIsAnalyticsExternalProcessorsEnabled, tr as useIsDiffAnalyticsEnabled, tt as addIsAddPublicDrivesEnabledEventHandler, u as addPHEventHandlers, ua as upgradeDocument, ui as packageFromDocumentModels, un as setIsEditorReadModeEnabled, ur as useIsPublicDrivesEnabled, ut as addIsDocumentModelSelectionSettingsEnabledEventHandler, v as useSelectedTimelineRevision, va as setFullReactorClient, vi as readCreateProtocolVersions, vn as setLocalDrivesEnabled, vr as useRenownUrl, vt as addIsPublicDrivesEnabledEventHandler, w as addSyncSelectionOnPopStateEventHandler, wa as useReactorClient, wi as withRequestDeadline, wn as setRequiresHardRefresh, wr as useStudioMode, wt as addRenownChainIdEventHandler, x as useSelectedTimelineItem, xa as useDatabase, xi as isDeadlineError, xn as setRenownChainId, xr as useSentryDsn, xt as addLocalDrivesEnabledEventHandler, y as addSelectedTimelineItemEventHandler, ya as setReactorClient, yi as readCreateSignaturePolicy, yn as setLogLevel, yr as useRequiresHardRefresh, yt as addIsRelationalProcessorsEnabledEventHandler, z as addAttachmentServiceEventHandler, za as showPHModal, zi as uncreatedDocument, zn as useDisabledEditors, zr as setIsExternalControlsEnabled, zt as setAllowList } from "./document-operations-o9cfLoeV.js";
|
|
6
|
+
import { a as setGlobal, i as getGlobal, n as getAnalyticsStore, r as clearGlobal, t as createAnalyticsStore } from "./store-DInXcjal.js";
|
|
6
7
|
import { baseDocumentModels, baseDocumentModelsMap } from "./src/document-model.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { A as
|
|
10
|
-
import {
|
|
11
|
-
import { i as setPGliteDB, n as useRelationalQuery, r as useRelationalDb, t as createProcessorQuery } from "./relational-
|
|
12
|
-
import { a as getPackagesByDocumentType, i as getPackages, n as getPackageInfo, o as getPackagesForDocumentType, r as getPackagePage, s as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { allPass, filter, find, forEach, funnel, hasAtLeast, isArray, isDefined, isIncludedIn, isStrictEqual, isTruthy, last, map, mapToObj, once, pipe, prop, split, unique } from "remeda";
|
|
8
|
+
import { o as PropagationMode, r as GetDocumentWithOperationsDocument, t as createClient } from "./client-BNMyQ_Z2.js";
|
|
9
|
+
import { c as useSelectedDocument, d as useSelectedDocumentSafe, f as EditorDocumentProvider, g as useNodeById, h as useSelectedNode, l as useSelectedDocumentId, m as useDocumentOfType, p as useEditorDocumentContext, t as GQL_CHANNEL_SUFFIX, u as useSelectedDocumentOfType } from "./switchboard-B640iT1L.js";
|
|
10
|
+
import { A as CREDENTIAL_TYPES, C as useRenownAuthAsync, D as openRenown, E as logout, F as RENOWN_RETURN_URL_STRIPPED_PARAMS, I as RENOWN_URL, L as VERIFIABLE_CREDENTIAL_EIP712_TYPE, M as ISSUER_TYPE, N as RENOWN_CHAIN_ID, O as CREDENTIAL_SCHEMA_EIP712_TYPE, P as RENOWN_NETWORK_ID, S as useRenownAuth, T as login, _ as CopyIcon, a as RenownProvider, b as SpinnerIcon, c as useRenownInit, d as initConnectCrypto, f as initRenownCrypto, g as ChevronDownIcon, h as RenownLoginButton, i as useRenownLoginMethods, j as DOMAIN_TYPE, k as CREDENTIAL_SUBJECT_TYPE, l as useRenownSessionCookie, m as RenownUserButton, n as decodeDelegation, o as RenownWalletProvider, p as RenownAuthButton, r as useRenownWalletAdapter, s as Renown, t as createDelegation, u as useRenownSessionSynced, v as DisconnectIcon, w as desktopShell, x as UserIcon, y as RenownLogo } from "./renown-B3MUaiq7.js";
|
|
11
|
+
import { n as useDocumentsByIds, t as useDocumentById } from "./document-by-id-DdvqanGR.js";
|
|
12
|
+
import { i as setPGliteDB, n as useRelationalQuery, r as useRelationalDb, t as createProcessorQuery } from "./relational-DZuyKp2y.js";
|
|
13
|
+
import { a as getPackagesByDocumentType, c as trimTrailingSlash, i as getPackages, l as SYNC_REMOTES_CHANGED_EVENT, n as getPackageInfo, o as getPackagesForDocumentType, r as getPackagePage, s as searchPackages, t as RegistryClient } from "./client-BFnMV-EO.js";
|
|
14
|
+
import { use, useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
15
|
+
import { DEFAULT_SIGNATURE_POLICY, actionSignerIdentity, actionSigningTarget, capabilitiesFor, createZip, headNewDocument, isDocumentZip, parseBulkArchive, redo, requestedSignaturePolicy, stateReducerOf, toTransportAction, undo, undoNeedsTargets, undoRedoActions, undoRedoTargetsOf, validateInitialState, validateModules, validateStateSchemaName, zipEntries } from "@powerhousedao/shared/document-model";
|
|
16
|
+
import { AuthEnforcementDisabledError, ChannelScheme, DocumentChangeType, DocumentChangeType as DocumentChangeType$1, DocumentIntegrityService, DriveCollectionId, DriveCollectionId as DriveCollectionId$1, DriveRequestError, GqlRequestChannel, InMemoryQueue, IntervalPollTimer, PollBehavior, PropagationMode as PropagationMode$1, REACTOR_SCHEMA, REACTOR_SCHEMA as REACTOR_SCHEMA$1, ReactorBuilder, ReactorClientBuilder, RelationalDbProcessor, SyncEventTypes, SyncOperationStatus, SyncStatus, driveIdFromUrl, isDriveAuthError, isDriveAuthError as isDriveAuthError$1, parseDriveUrl } from "@powerhousedao/reactor";
|
|
17
17
|
import { pascalCase } from "change-case";
|
|
18
|
-
import {
|
|
18
|
+
import { DriveDocumentSchema, driveDocumentType, getDescendants, getNextCopyNumber, isFileNode, isFolderNode, setAvailableOffline, setDriveIcon, setDriveName, setSharingType } from "@powerhousedao/shared/document-drive";
|
|
19
|
+
import { allPass, filter, find, forEach, funnel, hasAtLeast, isArray, isDefined, isIncludedIn, isStrictEqual, isTruthy, last, map, mapToObj, once, pipe, prop, split, unique } from "remeda";
|
|
19
20
|
import { Kind, parse } from "graphql";
|
|
21
|
+
import { ClientError } from "graphql-request";
|
|
20
22
|
import { z } from "zod";
|
|
21
23
|
import normalizeException from "normalize-exception";
|
|
22
24
|
import lzString from "lz-string";
|
|
@@ -41,8 +43,8 @@ import { createAttachmentClient } from "@powerhousedao/reactor-attachments/clien
|
|
|
41
43
|
* `isDriveAuthError` can tell a refusal from an unreachable host and the
|
|
42
44
|
* caller can prompt for a login instead of reporting a network fault.
|
|
43
45
|
*/
|
|
44
|
-
async function fetchDriveInfo(url) {
|
|
45
|
-
const token = await
|
|
46
|
+
async function fetchDriveInfo(url, tokenProvider = ambientRenownTokenProvider) {
|
|
47
|
+
const token = await tokenProvider();
|
|
46
48
|
const response = await fetch(url, { headers: token ? { Authorization: `Bearer ${token}` } : {} });
|
|
47
49
|
if (!response.ok) throw new DriveRequestError(`Failed to resolve drive info from ${url}: HTTP ${response.status}`, response.status);
|
|
48
50
|
return await response.json();
|
|
@@ -65,9 +67,8 @@ async function expandBulkArchive(file, driveId, targetParent) {
|
|
|
65
67
|
}];
|
|
66
68
|
const entries = await parseBulkArchive(data);
|
|
67
69
|
if (!(await Promise.all(entries.map((entry) => isDocumentZip(entry.data)))).some(Boolean)) throw new Error("Archive contains no Powerhouse documents");
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const knownNodes = [...(await reactorClient.get(driveId)).state.global.nodes];
|
|
70
|
+
if (!getPHStore()?.reactorClient) throw new Error("ReactorClient not initialized");
|
|
71
|
+
const knownNodes = [...await loadDriveNodes(driveId, { refresh: true })];
|
|
71
72
|
const dirToNode = /* @__PURE__ */ new Map();
|
|
72
73
|
const ensureDir = async (dirPath, parent) => {
|
|
73
74
|
const cached = dirToNode.get(dirPath);
|
|
@@ -124,14 +125,14 @@ function segmentsBelow(root, node, allNodes) {
|
|
|
124
125
|
* initialState (see downloadFolderZip).
|
|
125
126
|
*/
|
|
126
127
|
async function buildFolderZip(drive, folderNode, fetchDocument, onProgress) {
|
|
127
|
-
const allNodes = drive.
|
|
128
|
+
const allNodes = await loadDriveNodes(drive.header.id, { refresh: true });
|
|
128
129
|
const topName = sanitize(folderNode?.name ?? (drive.state.global.name || drive.header.name));
|
|
129
130
|
const subtree = folderNode ? [folderNode, ...getDescendants(folderNode, allNodes)] : allNodes;
|
|
130
|
-
const entries = { [topName + "/"]: new Uint8Array(0) };
|
|
131
|
+
const entries = { [topName + "/"]: /* @__PURE__ */ new Uint8Array(0) };
|
|
131
132
|
for (const node of subtree) {
|
|
132
133
|
if (!isFolderNode(node)) continue;
|
|
133
134
|
const dir = [topName, ...segmentsBelow(folderNode, node, allNodes)].join("/");
|
|
134
|
-
entries[dir + "/"] = new Uint8Array(0);
|
|
135
|
+
entries[dir + "/"] = /* @__PURE__ */ new Uint8Array(0);
|
|
135
136
|
}
|
|
136
137
|
const files = subtree.filter(isFileNode);
|
|
137
138
|
const failed = [];
|
|
@@ -176,11 +177,11 @@ async function buildFolderZip(drive, folderNode, fetchDocument, onProgress) {
|
|
|
176
177
|
* showSaveFilePicker (fallback: blob download), mirroring exportFile.
|
|
177
178
|
*/
|
|
178
179
|
async function downloadFolderZip(drive, folderNode, onProgress) {
|
|
179
|
-
const reactorClient =
|
|
180
|
+
const reactorClient = getPHStore()?.reactorClient;
|
|
180
181
|
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
181
182
|
const result = await buildFolderZip(drive, folderNode, async (id) => {
|
|
182
183
|
const doc = await reactorClient.get(id);
|
|
183
|
-
const operations = await fetchDocumentOperations(reactorClient, doc);
|
|
184
|
+
const operations = await fetchDocumentOperations(reactorClient.read, doc);
|
|
184
185
|
const initialState = extractInitialState(operations["document"] ?? []);
|
|
185
186
|
return {
|
|
186
187
|
...doc,
|
|
@@ -257,21 +258,36 @@ async function waitForDocumentReady(reactorClient, documentId, options) {
|
|
|
257
258
|
async function addDrive(input, preferredEditor) {
|
|
258
259
|
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
259
260
|
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to create drives");
|
|
260
|
-
const reactorClient =
|
|
261
|
+
const reactorClient = getPHStore()?.reactorClient;
|
|
261
262
|
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
263
|
+
const options = {
|
|
264
|
+
initialState: { global: {
|
|
265
|
+
name: input.global.name || "",
|
|
266
|
+
icon: input.global.icon ?? null,
|
|
267
|
+
nodes: []
|
|
268
|
+
} },
|
|
269
|
+
signaturePolicy: input.id ? requestedSignaturePolicy(input, "legacy") : input.signaturePolicy,
|
|
270
|
+
id: input.id || void 0,
|
|
271
|
+
protocolVersions: input.protocolVersions
|
|
272
|
+
};
|
|
273
|
+
let driveDoc;
|
|
274
|
+
try {
|
|
275
|
+
driveDoc = await reactorClient.newDocument(driveDocumentType, options);
|
|
276
|
+
} catch (error) {
|
|
277
|
+
if (getFullReactorClient() || !GraphQLOperationNotSupportedError.isError(error)) throw error;
|
|
278
|
+
driveDoc = await reactorClient.newDocument(driveDocumentType, {
|
|
279
|
+
...options,
|
|
280
|
+
signaturePolicy: DEFAULT_SIGNATURE_POLICY
|
|
281
|
+
});
|
|
282
|
+
}
|
|
268
283
|
if (preferredEditor) driveDoc.header.meta = { preferredEditor };
|
|
269
|
-
|
|
284
|
+
if (input.global.name) driveDoc.header.name = input.global.name;
|
|
285
|
+
return await (await reactorClient.write.create(driveDoc)).document();
|
|
270
286
|
}
|
|
271
287
|
async function addRemoteDrive(url, driveId, options) {
|
|
272
|
-
const reactorClient =
|
|
288
|
+
const reactorClient = getFullReactorClient();
|
|
273
289
|
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
274
|
-
const sync =
|
|
290
|
+
const sync = getPHStore()?.reactorClientModule?.reactorModule?.syncModule?.syncManager;
|
|
275
291
|
if (!sync) throw new Error("Sync not initialized");
|
|
276
292
|
let driveInfo;
|
|
277
293
|
try {
|
|
@@ -298,7 +314,7 @@ async function addRemoteDrive(url, driveId, options) {
|
|
|
298
314
|
if (isDriveAuthError$1(error)) showPHModal({ type: "driveAuthRequired" });
|
|
299
315
|
throw error;
|
|
300
316
|
}
|
|
301
|
-
if (options?.awaitInitialSync) await waitForDocumentReady(reactorClient, resolvedDriveId, {
|
|
317
|
+
if (options?.awaitInitialSync) await waitForDocumentReady(reactorClient.read, resolvedDriveId, {
|
|
302
318
|
timeoutMs: options.initialSyncTimeoutMs,
|
|
303
319
|
signal: options.signal
|
|
304
320
|
});
|
|
@@ -307,55 +323,49 @@ async function addRemoteDrive(url, driveId, options) {
|
|
|
307
323
|
async function deleteDrive(driveId) {
|
|
308
324
|
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
309
325
|
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to delete drives");
|
|
310
|
-
const reactorClient =
|
|
326
|
+
const reactorClient = getPHStore()?.reactorClient;
|
|
311
327
|
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
312
|
-
const sync =
|
|
328
|
+
const sync = getPHStore()?.reactorClientModule?.reactorModule?.syncModule?.syncManager;
|
|
313
329
|
if (sync) {
|
|
314
330
|
const collectionId = DriveCollectionId$1.forDrive(driveId);
|
|
315
331
|
const remotes = sync.list().filter((remote) => remote.meta.collectionId.equals(collectionId));
|
|
316
332
|
for (const remote of remotes) await sync.remove(remote.meta.name);
|
|
317
333
|
}
|
|
318
|
-
await reactorClient.deleteDocument(driveId, PropagationMode$1.Cascade);
|
|
334
|
+
await (await reactorClient.write.deleteDocument(driveId, PropagationMode$1.Cascade)).readable;
|
|
319
335
|
}
|
|
320
336
|
async function renameDrive(driveId, name) {
|
|
321
337
|
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
322
338
|
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to rename drives");
|
|
323
|
-
const reactorClient =
|
|
339
|
+
const reactorClient = getFullReactorClient();
|
|
324
340
|
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
325
|
-
return await reactorClient.rename(driveId, name);
|
|
341
|
+
return await (await reactorClient.write.rename(driveId, name)).document();
|
|
326
342
|
}
|
|
327
343
|
async function setDriveAvailableOffline(driveId, availableOffline) {
|
|
328
344
|
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
329
345
|
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to change drive availability");
|
|
330
|
-
const reactorClient =
|
|
346
|
+
const reactorClient = getPHStore()?.reactorClient;
|
|
331
347
|
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
332
|
-
return await reactorClient.execute(driveId, "main", [setAvailableOffline({ availableOffline })]);
|
|
348
|
+
return await (await reactorClient.write.execute(driveId, "main", [setAvailableOffline({ availableOffline })])).document();
|
|
333
349
|
}
|
|
334
350
|
async function setDriveSharingType(driveId, sharingType) {
|
|
335
351
|
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
336
352
|
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to change drive sharing type");
|
|
337
|
-
const reactorClient =
|
|
353
|
+
const reactorClient = getPHStore()?.reactorClient;
|
|
338
354
|
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
339
|
-
return await reactorClient.execute(driveId, "main", [setSharingType({ type: sharingType })]);
|
|
355
|
+
return await (await reactorClient.write.execute(driveId, "main", [setSharingType({ type: sharingType })])).document();
|
|
340
356
|
}
|
|
341
357
|
async function setDriveMetadata(driveId, metadata) {
|
|
342
358
|
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
343
359
|
if (!isAllowedToCreateDocuments) throw new Error("User is not allowed to update drive metadata");
|
|
344
|
-
const reactorClient =
|
|
360
|
+
const reactorClient = getPHStore()?.reactorClient;
|
|
345
361
|
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
346
362
|
const actions = [];
|
|
347
363
|
if (metadata.name) actions.push(setDriveName({ name: metadata.name }));
|
|
348
364
|
if (metadata.icon !== void 0) actions.push(setDriveIcon({ icon: metadata.icon }));
|
|
349
365
|
if (actions.length === 0) return;
|
|
350
|
-
return await reactorClient.execute(driveId, "main", actions);
|
|
366
|
+
return await (await reactorClient.write.execute(driveId, "main", actions)).document();
|
|
351
367
|
}
|
|
352
368
|
//#endregion
|
|
353
|
-
//#region src/constants.ts
|
|
354
|
-
const DEFAULT_DRIVE_EDITOR_ID = "powerhouse/generic-drive-explorer";
|
|
355
|
-
const COMMON_PACKAGE_ID = "powerhouse/common";
|
|
356
|
-
/** Document types that represent a "drive": a container of nodes. */
|
|
357
|
-
const DRIVE_DOCUMENT_TYPES = ["powerhouse/document-drive", "powerhouse/reactor-drive"];
|
|
358
|
-
//#endregion
|
|
359
369
|
//#region src/graphql/adapters.ts
|
|
360
370
|
function phDocumentFromQuery(document, documentSchema) {
|
|
361
371
|
const phDocument = {
|
|
@@ -415,7 +425,7 @@ const graphqlDocumentsEvents = ["DeleteDocuments"];
|
|
|
415
425
|
//#endregion
|
|
416
426
|
//#region src/graphql/fetchers.ts
|
|
417
427
|
async function reactorGraphqlFetchDocument(identifier, documentSchema) {
|
|
418
|
-
const client =
|
|
428
|
+
const client = getPHStore()?.reactorGraphQLClient;
|
|
419
429
|
if (!client) throw new Error("Please call `useInitReactorGraphqlClient` to use its functions");
|
|
420
430
|
try {
|
|
421
431
|
const document = (await client.GetDocument({ identifier })).document?.document;
|
|
@@ -426,7 +436,7 @@ async function reactorGraphqlFetchDocument(identifier, documentSchema) {
|
|
|
426
436
|
}
|
|
427
437
|
}
|
|
428
438
|
async function reactorGraphqlBatchFetchDocuments(identifiers) {
|
|
429
|
-
if (!
|
|
439
|
+
if (!getPHStore()?.reactorGraphQLClient) throw new Error("Please call `useInitReactorGraphqlClient` to use its functions");
|
|
430
440
|
const promises = map(identifiers, (identifier) => reactorGraphqlFetchDocument(identifier));
|
|
431
441
|
return await Promise.all(promises);
|
|
432
442
|
}
|
|
@@ -511,11 +521,34 @@ var DocumentFetcher = class {
|
|
|
511
521
|
};
|
|
512
522
|
//#endregion
|
|
513
523
|
//#region src/graphql/graphql-client-document-cache.ts
|
|
524
|
+
function isMissingDocumentMessage(message) {
|
|
525
|
+
return message.includes("Document not found") || /Document \S+ was purged/.test(message);
|
|
526
|
+
}
|
|
527
|
+
async function fetchDocumentForRefetch(identifier) {
|
|
528
|
+
const client = getPHStore()?.reactorGraphQLClient;
|
|
529
|
+
if (!client) throw new Error("Please call `useInitReactorGraphqlClient` to use its functions");
|
|
530
|
+
const notFound = (cause) => new Error(`Document not found: ${identifier}`, { cause });
|
|
531
|
+
let result;
|
|
532
|
+
try {
|
|
533
|
+
result = await client.GetDocument({ identifier });
|
|
534
|
+
} catch (error) {
|
|
535
|
+
if ((error instanceof ClientError ? (error.response.errors ?? []).map((e) => e.message) : []).some(isMissingDocumentMessage)) throw notFound(error);
|
|
536
|
+
throw error;
|
|
537
|
+
}
|
|
538
|
+
const document = result.document?.document;
|
|
539
|
+
if (!document) throw notFound();
|
|
540
|
+
return phDocumentFromQuery(document);
|
|
541
|
+
}
|
|
514
542
|
var GraphQLClientDocumentCache = class {
|
|
515
543
|
fetcher;
|
|
516
544
|
documents = /* @__PURE__ */ new Map();
|
|
517
545
|
batchPromises = /* @__PURE__ */ new Map();
|
|
518
546
|
listeners = /* @__PURE__ */ new Map();
|
|
547
|
+
refetcher = new DocumentRefetcher({
|
|
548
|
+
documents: this.documents,
|
|
549
|
+
fetch: fetchDocumentForRefetch,
|
|
550
|
+
notify: (id) => this.notify(id)
|
|
551
|
+
});
|
|
519
552
|
constructor() {
|
|
520
553
|
this.fetcher = new DocumentFetcher();
|
|
521
554
|
window.addEventListener("MutateDocument", (event) => {
|
|
@@ -527,10 +560,9 @@ var GraphQLClientDocumentCache = class {
|
|
|
527
560
|
}
|
|
528
561
|
get(id, refetch) {
|
|
529
562
|
const current = this.documents.get(id);
|
|
530
|
-
if (current)
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
}
|
|
563
|
+
if (current && !refetch) return current;
|
|
564
|
+
if (current && current.status !== "rejected") return this.refetcher.refetch(id);
|
|
565
|
+
this.refetcher.forget(id);
|
|
534
566
|
const promise = addPromiseState(this.fetcher.get(id).then((document) => {
|
|
535
567
|
this.invalidateBatchesContaining(id);
|
|
536
568
|
return document;
|
|
@@ -538,6 +570,9 @@ var GraphQLClientDocumentCache = class {
|
|
|
538
570
|
this.documents.set(id, promise);
|
|
539
571
|
return promise;
|
|
540
572
|
}
|
|
573
|
+
getRefetchState(id) {
|
|
574
|
+
return this.refetcher.getState(id);
|
|
575
|
+
}
|
|
541
576
|
getBatch(ids) {
|
|
542
577
|
const key = ids.join(",");
|
|
543
578
|
const cached = this.batchPromises.get(key);
|
|
@@ -590,12 +625,12 @@ var GraphQLClientDocumentCache = class {
|
|
|
590
625
|
for (const listener of listeners) listener();
|
|
591
626
|
}
|
|
592
627
|
async handleDocumentMutated(id) {
|
|
593
|
-
this.
|
|
594
|
-
await this.get(id);
|
|
595
|
-
this.notify(id);
|
|
628
|
+
if (!this.documents.has(id)) return;
|
|
629
|
+
await this.get(id, true);
|
|
596
630
|
}
|
|
597
631
|
handleDocumentDeleted(id) {
|
|
598
632
|
this.documents.delete(id);
|
|
633
|
+
this.refetcher.forget(id);
|
|
599
634
|
this.invalidateBatchesContaining(id);
|
|
600
635
|
this.notify(id);
|
|
601
636
|
}
|
|
@@ -606,7 +641,7 @@ var GraphQLClientDocumentCache = class {
|
|
|
606
641
|
//#endregion
|
|
607
642
|
//#region src/graphql/mutators.ts
|
|
608
643
|
async function reactorGraphqlCreateDocument(document, parentIdentifier = DEFAULT_DRIVE_ID) {
|
|
609
|
-
const client =
|
|
644
|
+
const client = getPHStore()?.reactorGraphQLClient;
|
|
610
645
|
if (!client) throw new Error("Please call `useInitReactorGraphqlClient` to use its functions");
|
|
611
646
|
return await client.CreateDocument({
|
|
612
647
|
document,
|
|
@@ -614,17 +649,17 @@ async function reactorGraphqlCreateDocument(document, parentIdentifier = DEFAULT
|
|
|
614
649
|
});
|
|
615
650
|
}
|
|
616
651
|
async function reactorGraphqlDeleteDocument(identifier) {
|
|
617
|
-
const client =
|
|
652
|
+
const client = getPHStore()?.reactorGraphQLClient;
|
|
618
653
|
if (!client) throw new Error("Please call `useInitReactorGraphqlClient` to use its functions");
|
|
619
654
|
return await client.DeleteDocument({ identifier });
|
|
620
655
|
}
|
|
621
656
|
async function reactorGraphqlDeleteDocuments(identifiers) {
|
|
622
|
-
const client =
|
|
657
|
+
const client = getPHStore()?.reactorGraphQLClient;
|
|
623
658
|
if (!client) throw new Error("Please call `useInitReactorGraphqlClient` to use its functions");
|
|
624
659
|
return await client.DeleteDocuments({ identifiers });
|
|
625
660
|
}
|
|
626
661
|
async function reactorGraphqlMutateDocument(documentIdentifier, ...actions) {
|
|
627
|
-
const client =
|
|
662
|
+
const client = getPHStore()?.reactorGraphQLClient;
|
|
628
663
|
if (!client) throw new Error("Please call `useInitReactorGraphqlClient` to use its functions");
|
|
629
664
|
return await client.MutateDocument({
|
|
630
665
|
documentIdentifier,
|
|
@@ -640,10 +675,38 @@ function useAllowedDocumentModelModules() {
|
|
|
640
675
|
return documentModelModules?.filter((module) => allowedDocumentTypes.includes(module.documentModel.global.id));
|
|
641
676
|
}
|
|
642
677
|
//#endregion
|
|
678
|
+
//#region src/hooks/items-in-selected-drive.ts
|
|
679
|
+
/** Returns the nodes in the selected drive. */
|
|
680
|
+
function useNodesInSelectedDrive() {
|
|
681
|
+
return useDriveNodes(useSelectedDriveId());
|
|
682
|
+
}
|
|
683
|
+
/** Returns the file nodes in the selected drive. */
|
|
684
|
+
function useFileNodesInSelectedDrive() {
|
|
685
|
+
return useNodesInSelectedDrive()?.filter((n) => isFileNodeKind(n));
|
|
686
|
+
}
|
|
687
|
+
/** Returns the folder nodes in the selected drive. */
|
|
688
|
+
function useFolderNodesInSelectedDrive() {
|
|
689
|
+
return useNodesInSelectedDrive()?.filter((n) => isFolderNodeKind(n));
|
|
690
|
+
}
|
|
691
|
+
/** Returns the documents in the selected drive. */
|
|
692
|
+
function useDocumentsInSelectedDrive() {
|
|
693
|
+
const fileNodeIds = useFileNodesInSelectedDrive()?.map((node) => node.id);
|
|
694
|
+
return useDocumentsByIds(fileNodeIds);
|
|
695
|
+
}
|
|
696
|
+
/** Returns the document types supported by the selected drive, as defined by the document model documents present in the drive */
|
|
697
|
+
function useDocumentTypesInSelectedDrive() {
|
|
698
|
+
return (useDocumentsInSelectedDrive()?.filter(isDocumentModelDocument))?.map((doc) => doc.state.global.id);
|
|
699
|
+
}
|
|
700
|
+
function isDocumentModelDocument(document) {
|
|
701
|
+
return document.header.documentType === "powerhouse/document-model";
|
|
702
|
+
}
|
|
703
|
+
//#endregion
|
|
643
704
|
//#region src/hooks/selected-folder.ts
|
|
644
|
-
/** Returns the selected folder. */
|
|
705
|
+
/** Returns the selected folder: the drive app's open folder, else the app's. */
|
|
645
706
|
function useSelectedFolder() {
|
|
707
|
+
const context = useDriveContext();
|
|
646
708
|
const selectedNode = useSelectedNode();
|
|
709
|
+
if (context?.folder) return context.folder;
|
|
647
710
|
if (isFolderNodeKind(selectedNode)) return selectedNode;
|
|
648
711
|
}
|
|
649
712
|
//#endregion
|
|
@@ -816,6 +879,91 @@ function buildSnapshot(syncManager) {
|
|
|
816
879
|
return map;
|
|
817
880
|
}
|
|
818
881
|
//#endregion
|
|
882
|
+
//#region src/hooks/document-link.ts
|
|
883
|
+
/** Where a document opens: the loaded drive that lists it, or undefined while none does. */
|
|
884
|
+
function useDocumentTarget(documentId) {
|
|
885
|
+
const store = usePHStore() ?? getPHStore();
|
|
886
|
+
const drives = useDrives();
|
|
887
|
+
const cache = useDriveNodesCache();
|
|
888
|
+
const driveIds = drives?.map((d) => d.header.id).join("\n") ?? "";
|
|
889
|
+
let target;
|
|
890
|
+
if (documentId && drives) for (const drive of drives) {
|
|
891
|
+
const node = cache?.get(drive.header.id)?.byId.get(documentId);
|
|
892
|
+
if (!isFileNodeKind(node)) continue;
|
|
893
|
+
target = {
|
|
894
|
+
driveSlug: makeDriveSlug(drive),
|
|
895
|
+
nodeSlug: makeNodeSlug(node)
|
|
896
|
+
};
|
|
897
|
+
break;
|
|
898
|
+
}
|
|
899
|
+
const found = target !== void 0;
|
|
900
|
+
useEffect(() => {
|
|
901
|
+
if (!documentId || !driveIds || found) return;
|
|
902
|
+
for (const driveId of driveIds.split("\n")) getDriveNode(driveId, documentId, { store }).catch(() => void 0);
|
|
903
|
+
}, [
|
|
904
|
+
documentId,
|
|
905
|
+
driveIds,
|
|
906
|
+
found,
|
|
907
|
+
store
|
|
908
|
+
]);
|
|
909
|
+
return target;
|
|
910
|
+
}
|
|
911
|
+
/** `useLinkProps` for a document by id, e.g. a `useDocumentsOfType` row;
|
|
912
|
+
* undefined while no loaded drive lists it. */
|
|
913
|
+
function useDocumentLinkProps(documentId) {
|
|
914
|
+
const target = useDocumentTarget(documentId);
|
|
915
|
+
const props = useLinkProps(target);
|
|
916
|
+
return target ? props : void 0;
|
|
917
|
+
}
|
|
918
|
+
//#endregion
|
|
919
|
+
//#region src/hooks/documents-of-type.ts
|
|
920
|
+
const DEFAULT_LIMIT = 25;
|
|
921
|
+
const NO_DOCUMENTS = {
|
|
922
|
+
documents: [],
|
|
923
|
+
invalid: [],
|
|
924
|
+
hasNextPage: false,
|
|
925
|
+
isLoadingNextPage: false,
|
|
926
|
+
loadNextPage: () => void 0,
|
|
927
|
+
error: void 0
|
|
928
|
+
};
|
|
929
|
+
const typeOf = (module) => module.documentModel.global.id;
|
|
930
|
+
function typeCacheOf(cache) {
|
|
931
|
+
if (!cache) return void 0;
|
|
932
|
+
if (!isDocumentTypeCache(cache)) throw new Error("This document cache can't list documents by type.");
|
|
933
|
+
return cache;
|
|
934
|
+
}
|
|
935
|
+
/** The documents of `module`'s type across every drive, a page at a time and
|
|
936
|
+
* checked against its schema; suspends until the first page has loaded. */
|
|
937
|
+
function useDocumentsOfType(module, { limit = DEFAULT_LIMIT } = {}) {
|
|
938
|
+
const cache = typeCacheOf(useDocumentCache());
|
|
939
|
+
const type = typeOf(module);
|
|
940
|
+
const read = () => cache?.getDocumentsOfTypeState(type, limit) ?? IDLE_DOCUMENTS_OF_TYPE_ENTRY;
|
|
941
|
+
const entry = useSyncExternalStore((onChange) => cache ? cache.subscribeDocumentsOfType(type, limit, onChange) : () => {}, read, read);
|
|
942
|
+
if (cache) use(cache.loadDocumentsOfType(type, limit));
|
|
943
|
+
if (entry.status === "error" && entry.ids.length === 0) throw entry.error;
|
|
944
|
+
const loaded = useDocuments(entry.ids);
|
|
945
|
+
const [documents, invalid] = useMemo(() => {
|
|
946
|
+
const valid = [];
|
|
947
|
+
const other = [];
|
|
948
|
+
for (const document of loaded) if (module.utils.isDocumentOfType(document)) valid.push(document);
|
|
949
|
+
else other.push(document);
|
|
950
|
+
return [valid, other];
|
|
951
|
+
}, [loaded, module]);
|
|
952
|
+
if (!cache) return NO_DOCUMENTS;
|
|
953
|
+
return {
|
|
954
|
+
documents,
|
|
955
|
+
invalid,
|
|
956
|
+
hasNextPage: entry.hasNextPage,
|
|
957
|
+
isLoadingNextPage: entry.status === "pending",
|
|
958
|
+
loadNextPage: () => cache.loadMoreDocumentsOfType(type, limit),
|
|
959
|
+
error: entry.status === "error" ? entry.error : void 0
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
/** Loads the first page `useDocumentsOfType` reads, e.g. in a route loader, so it doesn't suspend. */
|
|
963
|
+
async function loadDocumentsOfType(module, { limit = DEFAULT_LIMIT } = {}) {
|
|
964
|
+
await typeCacheOf(getPHStore()?.documentCache)?.loadDocumentsOfType(typeOf(module), limit);
|
|
965
|
+
}
|
|
966
|
+
//#endregion
|
|
819
967
|
//#region src/hooks/supported-document-types.ts
|
|
820
968
|
/** Returns the supported document types for the reactor (derived from the document model modules) */
|
|
821
969
|
function useSupportedDocumentTypesInReactor() {
|
|
@@ -825,13 +973,13 @@ function useSupportedDocumentTypesInReactor() {
|
|
|
825
973
|
//#region src/hooks/document-types.ts
|
|
826
974
|
/** Returns the document types a app supports.
|
|
827
975
|
*
|
|
828
|
-
*
|
|
829
|
-
*
|
|
976
|
+
* Uses the `allowedDocumentTypes` config value when it lists any types.
|
|
977
|
+
* Unset or empty, it means every type, so the reactor's supported types are used.
|
|
830
978
|
*/
|
|
831
979
|
function useDocumentTypes() {
|
|
832
980
|
const allowedDocumentTypes = useAllowedDocumentTypes();
|
|
833
981
|
const supportedDocumentTypes = useSupportedDocumentTypesInReactor();
|
|
834
|
-
return allowedDocumentTypes
|
|
982
|
+
return allowedDocumentTypes?.length ? allowedDocumentTypes : supportedDocumentTypes;
|
|
835
983
|
}
|
|
836
984
|
//#endregion
|
|
837
985
|
//#region src/hooks/document-version-status.ts
|
|
@@ -1013,6 +1161,14 @@ function useEditorModulesForDocumentType(documentType) {
|
|
|
1013
1161
|
if (!documentType) return void 0;
|
|
1014
1162
|
return editorModules?.filter((module) => module.documentTypes.includes(documentType));
|
|
1015
1163
|
}
|
|
1164
|
+
/** The editor for `document`: its preferred editor if that edits its type,
|
|
1165
|
+
* else the first editor for its type. */
|
|
1166
|
+
function useEditorModuleFor(document) {
|
|
1167
|
+
const documentType = document?.header.documentType;
|
|
1168
|
+
const preferred = useEditorModuleById(document?.header.meta?.preferredEditor);
|
|
1169
|
+
const fallback = useFallbackEditorModule(documentType);
|
|
1170
|
+
return !!documentType && !!preferred && (preferred.documentTypes.includes(documentType) || preferred.documentTypes.includes("*")) ? preferred : fallback;
|
|
1171
|
+
}
|
|
1016
1172
|
//#endregion
|
|
1017
1173
|
//#region src/utils/preload-editor.ts
|
|
1018
1174
|
function preloadEditorModule(module) {
|
|
@@ -1142,7 +1298,8 @@ function useDropFile(handleAddFile) {
|
|
|
1142
1298
|
//#endregion
|
|
1143
1299
|
//#region src/hooks/folder-by-id.ts
|
|
1144
1300
|
function useFolderById(id) {
|
|
1145
|
-
|
|
1301
|
+
const node = useNodeById(id);
|
|
1302
|
+
return isFolderNodeKind(node) ? node : void 0;
|
|
1146
1303
|
}
|
|
1147
1304
|
//#endregion
|
|
1148
1305
|
//#region src/graphql/events.ts
|
|
@@ -1174,24 +1331,24 @@ function useInitReactorGraphqlClient(switchboardUrl = DEFAULT_SWITCHBOARD_URL, d
|
|
|
1174
1331
|
return hasInit;
|
|
1175
1332
|
}
|
|
1176
1333
|
async function reactorGraphqlFetchDrive(identifier) {
|
|
1177
|
-
const client =
|
|
1334
|
+
const client = getPHStore()?.reactorGraphQLClient;
|
|
1178
1335
|
if (!client) throw new Error("Please call `useInitReactorGraphqlClient` to use its functions");
|
|
1179
1336
|
const result = await client.GetDocument({ identifier });
|
|
1180
1337
|
if (!result.document?.document) throw new Error("Could not fetch drive with id: " + identifier);
|
|
1181
1338
|
return phDocumentFromQuery(result.document.document, DriveDocumentSchema);
|
|
1182
1339
|
}
|
|
1183
1340
|
async function reactorGraphqlSyncDrive(driveId) {
|
|
1184
|
-
if (!
|
|
1341
|
+
if (!getPHStore()?.reactorGraphQLClient) throw new Error("Please call `useInitReactorGraphqlClient` to use its functions");
|
|
1185
1342
|
const drive = await reactorGraphqlFetchDrive(driveId);
|
|
1186
1343
|
setDrives([drive]);
|
|
1187
|
-
|
|
1344
|
+
selectDrive(drive);
|
|
1188
1345
|
}
|
|
1189
1346
|
async function initGraphQLReactorClientWithDocumentCache(switchboardUrl, driveId) {
|
|
1190
|
-
if (!window.ph) window.ph = {};
|
|
1191
1347
|
callEventHandlerRegisterFunctions(commonGlobalEventHandlerFunctions);
|
|
1192
|
-
|
|
1348
|
+
const client = createClient(switchboardUrl, documentCacheClientMiddleware);
|
|
1349
|
+
setGraphQLReactorClient(client);
|
|
1193
1350
|
await reactorGraphqlSyncDrive(driveId);
|
|
1194
|
-
|
|
1351
|
+
selectNode(void 0);
|
|
1195
1352
|
setDocumentCache(new GraphQLClientDocumentCache());
|
|
1196
1353
|
forEach(graphqlEventsToSyncDrive, (name) => {
|
|
1197
1354
|
window.addEventListener(name, () => {
|
|
@@ -1232,6 +1389,7 @@ function resolveNode(driveId, node) {
|
|
|
1232
1389
|
return node?.id !== driveId ? node : void 0;
|
|
1233
1390
|
}
|
|
1234
1391
|
function useNodeActions() {
|
|
1392
|
+
const setSelectedNode = useSetSelectedNode();
|
|
1235
1393
|
const [selectedDrive] = useSelectedDriveSafe();
|
|
1236
1394
|
const selectedFolder = useSelectedFolder();
|
|
1237
1395
|
const selectedParentFolder = useFolderById(useSelectedNode()?.parentFolder);
|
|
@@ -1239,7 +1397,8 @@ function useNodeActions() {
|
|
|
1239
1397
|
const drives = useDrives();
|
|
1240
1398
|
async function onAddFile(file, parent) {
|
|
1241
1399
|
if (!selectedDriveId) return;
|
|
1242
|
-
|
|
1400
|
+
const fileName = file.name.replace(/\..+/gim, "");
|
|
1401
|
+
return addFileWithProgress(file, selectedDriveId, fileName, resolveNode(selectedDriveId, parent)?.id, void 0, void 0, "duplicate");
|
|
1243
1402
|
}
|
|
1244
1403
|
async function onAddFolder(name, parent) {
|
|
1245
1404
|
if (!selectedDriveId) return;
|
|
@@ -1260,7 +1419,8 @@ function useNodeActions() {
|
|
|
1260
1419
|
console.error(`Node ${src.id} not found`);
|
|
1261
1420
|
return;
|
|
1262
1421
|
}
|
|
1263
|
-
|
|
1422
|
+
const resolvedTarget = resolveNode(selectedDriveId, target);
|
|
1423
|
+
await copyNode$1(selectedDriveId, resolvedSrc, resolvedTarget);
|
|
1264
1424
|
}
|
|
1265
1425
|
async function onMoveNode(src, target) {
|
|
1266
1426
|
if (!selectedDriveId) return;
|
|
@@ -1280,7 +1440,8 @@ function useNodeActions() {
|
|
|
1280
1440
|
console.error(`Node ${src.id} not found`);
|
|
1281
1441
|
return;
|
|
1282
1442
|
}
|
|
1283
|
-
|
|
1443
|
+
const target = resolveNode(selectedDriveId, selectedFolder ?? selectedParentFolder);
|
|
1444
|
+
await copyNode$1(selectedDriveId, resolvedSrc, target);
|
|
1284
1445
|
}
|
|
1285
1446
|
async function onAddAndSelectNewFolder(name) {
|
|
1286
1447
|
if (!name) return;
|
|
@@ -1292,8 +1453,10 @@ function useNodeActions() {
|
|
|
1292
1453
|
}
|
|
1293
1454
|
async function onRenameDriveNodes(newName, nodeId) {
|
|
1294
1455
|
if (!drives) return;
|
|
1295
|
-
const
|
|
1296
|
-
|
|
1456
|
+
const holders = await Promise.all(drives.map(async (drive) => {
|
|
1457
|
+
return await getDriveNode(drive.header.id, nodeId).catch(() => void 0) ? drive.header.id : void 0;
|
|
1458
|
+
}));
|
|
1459
|
+
await Promise.all(holders.filter((driveId) => driveId !== void 0).map((driveId) => renameDriveNode(driveId, nodeId, newName)));
|
|
1297
1460
|
}
|
|
1298
1461
|
return {
|
|
1299
1462
|
onAddFile,
|
|
@@ -1307,12 +1470,6 @@ function useNodeActions() {
|
|
|
1307
1470
|
};
|
|
1308
1471
|
}
|
|
1309
1472
|
//#endregion
|
|
1310
|
-
//#region src/hooks/node-by-id.ts
|
|
1311
|
-
/** Returns a node in the selected drive by id. */
|
|
1312
|
-
function useNodeById(id) {
|
|
1313
|
-
return useNodesInSelectedDrive()?.find((n) => n.id === id);
|
|
1314
|
-
}
|
|
1315
|
-
//#endregion
|
|
1316
1473
|
//#region src/hooks/node-path.ts
|
|
1317
1474
|
/** Returns the path to a node in the selected drive */
|
|
1318
1475
|
function useNodePathById(id) {
|
|
@@ -1340,6 +1497,56 @@ function useParentFolderForSelectedNode() {
|
|
|
1340
1497
|
return useNodeParentFolderById(useSelectedNode()?.id);
|
|
1341
1498
|
}
|
|
1342
1499
|
//#endregion
|
|
1500
|
+
//#region src/hooks/revision-history.ts
|
|
1501
|
+
/** The query param that opens the document's revision history: `?history`. */
|
|
1502
|
+
const REVISION_HISTORY_PARAM = "history";
|
|
1503
|
+
/** The history page shown, from 1 (the newest operations): `?history&historyPage=2`.
|
|
1504
|
+
* Its own name: a drive app or editor may page by `page`. */
|
|
1505
|
+
const REVISION_HISTORY_PAGE_PARAM = "historyPage";
|
|
1506
|
+
/** The page a `page` param names: a positive integer, else the first. */
|
|
1507
|
+
function parseRevisionHistoryPage(value) {
|
|
1508
|
+
const page = Number(value);
|
|
1509
|
+
return Number.isSafeInteger(page) && page > 0 ? page : 1;
|
|
1510
|
+
}
|
|
1511
|
+
/** Whether the URL opens the revision history. */
|
|
1512
|
+
function useRevisionHistoryVisible() {
|
|
1513
|
+
return useSearchParams()[REVISION_HISTORY_PARAM] !== void 0;
|
|
1514
|
+
}
|
|
1515
|
+
/** The revision history page the URL names, from 1. */
|
|
1516
|
+
function useRevisionHistoryPage() {
|
|
1517
|
+
return parseRevisionHistoryPage(useSearchParams()[REVISION_HISTORY_PAGE_PARAM]);
|
|
1518
|
+
}
|
|
1519
|
+
/** Shows the revision history: a new history entry, so Back closes it. */
|
|
1520
|
+
function showRevisionHistory() {
|
|
1521
|
+
setSearchParams((prev) => ({
|
|
1522
|
+
...prev,
|
|
1523
|
+
[REVISION_HISTORY_PARAM]: ""
|
|
1524
|
+
}));
|
|
1525
|
+
}
|
|
1526
|
+
/** Hides the revision history. */
|
|
1527
|
+
function hideRevisionHistory() {
|
|
1528
|
+
setSearchParams((prev) => ({
|
|
1529
|
+
...prev,
|
|
1530
|
+
[REVISION_HISTORY_PARAM]: void 0,
|
|
1531
|
+
[REVISION_HISTORY_PAGE_PARAM]: void 0
|
|
1532
|
+
}));
|
|
1533
|
+
}
|
|
1534
|
+
/** Opens history page `page`, from 1; Back returns to the page before. */
|
|
1535
|
+
function setRevisionHistoryPage(page) {
|
|
1536
|
+
setSearchParams((prev) => ({
|
|
1537
|
+
...prev,
|
|
1538
|
+
[REVISION_HISTORY_PARAM]: "",
|
|
1539
|
+
[REVISION_HISTORY_PAGE_PARAM]: page > 1 ? String(page) : void 0
|
|
1540
|
+
}));
|
|
1541
|
+
}
|
|
1542
|
+
/** Shows or hides the revision history. */
|
|
1543
|
+
function setRevisionHistoryVisible(visible) {
|
|
1544
|
+
if (visible) showRevisionHistory();
|
|
1545
|
+
else hideRevisionHistory();
|
|
1546
|
+
}
|
|
1547
|
+
/** @deprecated The revision history is a URL param now; there is no store value to watch. */
|
|
1548
|
+
function addRevisionHistoryVisibleEventHandler() {}
|
|
1549
|
+
//#endregion
|
|
1343
1550
|
//#region src/hooks/subgraph-modules.ts
|
|
1344
1551
|
function useSubgraphModules() {
|
|
1345
1552
|
return useVetraPackages().flatMap((pkg) => pkg.subgraphs || []);
|
|
@@ -1703,17 +1910,38 @@ const syncStatusToUI = {
|
|
|
1703
1910
|
async function getDrives(reactor) {
|
|
1704
1911
|
return (await Promise.all(DRIVE_DOCUMENT_TYPES.map((type) => reactor.find({ type })))).flatMap((r) => r.results);
|
|
1705
1912
|
}
|
|
1913
|
+
/**
|
|
1914
|
+
* The id of every drive, from a listing that carries headers only: a drive's
|
|
1915
|
+
* node tree can be megabytes (a mail drive with tens of thousands of files),
|
|
1916
|
+
* so membership is learned without it and a new drive is then loaded on its
|
|
1917
|
+
* own.
|
|
1918
|
+
*/
|
|
1919
|
+
async function listDriveIds(reactor) {
|
|
1920
|
+
return (await Promise.all(DRIVE_DOCUMENT_TYPES.map((type) => reactor.find({ type }, { scopes: ["header"] })))).flatMap((r) => r.results.map((d) => d.header.id));
|
|
1921
|
+
}
|
|
1922
|
+
/** One drive in full, or undefined once it is gone. */
|
|
1923
|
+
async function getDrive(reactor, driveId) {
|
|
1924
|
+
try {
|
|
1925
|
+
return await reactor.get(driveId);
|
|
1926
|
+
} catch {
|
|
1927
|
+
return;
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1706
1930
|
function getSyncStatus(documentId, sharingType) {
|
|
1707
1931
|
return Promise.resolve(getSyncStatusSync(documentId, sharingType));
|
|
1708
1932
|
}
|
|
1709
1933
|
function getSyncStatusSync(documentId, sharingType) {
|
|
1710
|
-
if (sharingType === "LOCAL") return;
|
|
1711
|
-
const syncManager =
|
|
1934
|
+
if (sharingType === "LOCAL" || typeof window === "undefined") return;
|
|
1935
|
+
const syncManager = getPHStore()?.reactorClientModule?.reactorModule?.syncModule?.syncManager;
|
|
1712
1936
|
if (!syncManager) return;
|
|
1713
1937
|
const status = syncManager.getSyncStatus(documentId);
|
|
1714
1938
|
if (status === void 0) return;
|
|
1715
1939
|
return syncStatusToUI[status];
|
|
1716
1940
|
}
|
|
1941
|
+
/** A drive's display name: the header's (renames set it), else its creation name. */
|
|
1942
|
+
function getDriveName(drive) {
|
|
1943
|
+
return drive.header.name || drive.state.global.name;
|
|
1944
|
+
}
|
|
1717
1945
|
//#endregion
|
|
1718
1946
|
//#region src/utils/get-revision-from-date.ts
|
|
1719
1947
|
const getRevisionFromDate = (startDate, endDate, operations = []) => {
|
|
@@ -1774,7 +2002,7 @@ function getSwitchboardBaseFromChannelUrl(channelUrl) {
|
|
|
1774
2002
|
}
|
|
1775
2003
|
/**
|
|
1776
2004
|
* The GraphQL name the switchboard exposes a document model under. Mirrors
|
|
1777
|
-
* `getDocumentModelSchemaName` on the server (`
|
|
2005
|
+
* `getDocumentModelSchemaName` on the server (`model-schema-templates.ts`): the root
|
|
1778
2006
|
* query field and the state type names are all derived from the model's
|
|
1779
2007
|
* `global.name`.
|
|
1780
2008
|
*/
|
|
@@ -1783,7 +2011,7 @@ function getDocumentModelSchemaName(model) {
|
|
|
1783
2011
|
}
|
|
1784
2012
|
function buildStateTypeMap(definitions) {
|
|
1785
2013
|
const typeMap = /* @__PURE__ */ new Map();
|
|
1786
|
-
for (const def of definitions) if (def.kind === Kind.OBJECT_TYPE_DEFINITION) typeMap.set(def.name.value, def);
|
|
2014
|
+
for (const def of definitions) if (def.kind === Kind.OBJECT_TYPE_DEFINITION || def.kind === Kind.INTERFACE_TYPE_DEFINITION || def.kind === Kind.UNION_TYPE_DEFINITION) typeMap.set(def.name.value, def);
|
|
1787
2015
|
return typeMap;
|
|
1788
2016
|
}
|
|
1789
2017
|
/**
|
|
@@ -1792,6 +2020,7 @@ function buildStateTypeMap(definitions) {
|
|
|
1792
2020
|
* type); enums, scalars, and built-ins are leaves.
|
|
1793
2021
|
*/
|
|
1794
2022
|
function expandStateFields(typeDef, typeMap) {
|
|
2023
|
+
if (typeDef.kind !== Kind.OBJECT_TYPE_DEFINITION) throw new Error(`Abstract state type requires the generic document query: ${typeDef.name.value}`);
|
|
1795
2024
|
return (typeDef.fields ?? []).map((field) => {
|
|
1796
2025
|
const fieldName = field.name.value;
|
|
1797
2026
|
let typeNode = field.type;
|
|
@@ -1850,7 +2079,7 @@ function getLocalStateSelection(localSchema, documentName) {
|
|
|
1850
2079
|
* Builds a query scoped to a document type's own subgraph root field,
|
|
1851
2080
|
* selecting the document and its full typed state. The shape mirrors what
|
|
1852
2081
|
* the switchboard generates per model (`generateNewApiSchema` in
|
|
1853
|
-
* `
|
|
2082
|
+
* `model-schema-templates.ts`): `<Name> { document(identifier:) { document { ...
|
|
1854
2083
|
* state { auth document global local } } } childIds }`.
|
|
1855
2084
|
*/
|
|
1856
2085
|
function buildModelScopedQuery(model) {
|
|
@@ -1904,7 +2133,7 @@ function buildDocumentSubgraphUrl(channelUrl, documentType, identifier, model, a
|
|
|
1904
2133
|
}
|
|
1905
2134
|
//#endregion
|
|
1906
2135
|
//#region src/utils/upgrade-preview.ts
|
|
1907
|
-
const NON_DOMAIN_SCOPES = new Set(["auth", "document"]);
|
|
2136
|
+
const NON_DOMAIN_SCOPES = /* @__PURE__ */ new Set(["auth", "document"]);
|
|
1908
2137
|
function isPlainObject(value) {
|
|
1909
2138
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1910
2139
|
}
|
|
@@ -1992,7 +2221,7 @@ function getDocumentUpgradePreview(document, registry) {
|
|
|
1992
2221
|
}
|
|
1993
2222
|
const addedFields = [];
|
|
1994
2223
|
const removedFields = [];
|
|
1995
|
-
const scopes = new Set([...Object.keys(document.state), ...Object.keys(upgraded.state)]);
|
|
2224
|
+
const scopes = /* @__PURE__ */ new Set([...Object.keys(document.state), ...Object.keys(upgraded.state)]);
|
|
1996
2225
|
for (const scope of scopes) {
|
|
1997
2226
|
if (NON_DOMAIN_SCOPES.has(scope)) continue;
|
|
1998
2227
|
const beforeScope = document.state[scope];
|
|
@@ -2075,7 +2304,9 @@ const useOnDropFile = (documentTypesOverride) => {
|
|
|
2075
2304
|
console.warn("No selected drive - upload skipped");
|
|
2076
2305
|
return;
|
|
2077
2306
|
}
|
|
2078
|
-
|
|
2307
|
+
const fileName = file.name.replace(/\..+/gim, "");
|
|
2308
|
+
const targetNodeId = targetFolder?.id ?? selectedFolder?.id;
|
|
2309
|
+
return await addFileWithProgress(file, selectedDriveId, fileName, targetNodeId, onProgress, documentTypesOverride ?? documentTypes, resolveConflict);
|
|
2079
2310
|
};
|
|
2080
2311
|
return onDropFile;
|
|
2081
2312
|
};
|
|
@@ -2094,6 +2325,19 @@ function useUserPermissions() {
|
|
|
2094
2325
|
};
|
|
2095
2326
|
}
|
|
2096
2327
|
//#endregion
|
|
2328
|
+
//#region src/hooks/close-node.ts
|
|
2329
|
+
/** Leaves a node's view: back to the entry it was opened from, past entries
|
|
2330
|
+
* pushed inside it; else, e.g. after a deep link, to its parent in place. */
|
|
2331
|
+
function useCloseNode(nodeId) {
|
|
2332
|
+
const navigation = usePHNavigation();
|
|
2333
|
+
const setSelectedNode = useSetSelectedNode();
|
|
2334
|
+
const parentFolder = useNodeParentFolderById(nodeId);
|
|
2335
|
+
return () => {
|
|
2336
|
+
if (navigation.closeOpened?.()) return;
|
|
2337
|
+
setSelectedNode(parentFolder, { replace: true });
|
|
2338
|
+
};
|
|
2339
|
+
}
|
|
2340
|
+
//#endregion
|
|
2097
2341
|
//#region src/hooks/attachment-progress.ts
|
|
2098
2342
|
const IDLE_PROGRESS = {
|
|
2099
2343
|
percent: 0,
|
|
@@ -2189,6 +2433,11 @@ function useAttachments() {
|
|
|
2189
2433
|
const service = useAttachmentService();
|
|
2190
2434
|
return service ? clientFor(service) : void 0;
|
|
2191
2435
|
}
|
|
2436
|
+
/** The client {@link useAttachments} returns, for code outside React. */
|
|
2437
|
+
function getAttachmentClient() {
|
|
2438
|
+
const service = getPHStore()?.attachmentService;
|
|
2439
|
+
return service ? clientFor(service) : void 0;
|
|
2440
|
+
}
|
|
2192
2441
|
const DEFAULT_PREVIEW_RETRIES = 3;
|
|
2193
2442
|
const DEFAULT_PREVIEW_RETRY_DELAY_MS = 3e3;
|
|
2194
2443
|
const IDLE_PREVIEW = {
|
|
@@ -2336,7 +2585,7 @@ function useAttachmentUpload() {
|
|
|
2336
2585
|
};
|
|
2337
2586
|
}, []);
|
|
2338
2587
|
return {
|
|
2339
|
-
preprocess: useCallback(async (file) => {
|
|
2588
|
+
preprocess: useCallback(async (file, options) => {
|
|
2340
2589
|
if (!client) throw new Error("AttachmentClient not available");
|
|
2341
2590
|
const runId = ++runIdRef.current;
|
|
2342
2591
|
setState({
|
|
@@ -2344,7 +2593,7 @@ function useAttachmentUpload() {
|
|
|
2344
2593
|
stage: "hashing"
|
|
2345
2594
|
});
|
|
2346
2595
|
try {
|
|
2347
|
-
return await client.preprocess(file);
|
|
2596
|
+
return await client.preprocess(file, options);
|
|
2348
2597
|
} catch (err) {
|
|
2349
2598
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
2350
2599
|
if (mountedRef.current && runId === runIdRef.current) setState((prev) => ({
|
|
@@ -2444,7 +2693,8 @@ async function dropAllReactorStorage(pg) {
|
|
|
2444
2693
|
const DEFAULT_DEBOUNCE_DELAY_MS = 200;
|
|
2445
2694
|
const DEFAULT_IMMEDIATE_THRESHOLD_MS = 1e3;
|
|
2446
2695
|
async function _refreshReactorData(reactor) {
|
|
2447
|
-
|
|
2696
|
+
const drives = await getDrives(reactor);
|
|
2697
|
+
setDrives(drives);
|
|
2448
2698
|
}
|
|
2449
2699
|
async function _refreshReactorDataClient(reactor) {
|
|
2450
2700
|
if (!reactor) return;
|
|
@@ -2490,6 +2740,331 @@ function createDebouncedRefreshReactorDataClient(debounceDelayMs = DEFAULT_DEBOU
|
|
|
2490
2740
|
}
|
|
2491
2741
|
const refreshReactorData = createDebouncedRefreshReactorData();
|
|
2492
2742
|
const refreshReactorDataClient = createDebouncedRefreshReactorDataClient();
|
|
2743
|
+
/** How often one drive is re-read while it keeps changing (a drive being filled). */
|
|
2744
|
+
const DEFAULT_DRIVE_REFRESH_MIN_INTERVAL_MS = 1e4;
|
|
2745
|
+
function currentDrives() {
|
|
2746
|
+
return getPHStore()?.drives;
|
|
2747
|
+
}
|
|
2748
|
+
/**
|
|
2749
|
+
* Re-reads one drive and replaces it in the drives store. Only that drive
|
|
2750
|
+
* crosses the wire: the list used to be re-fetched whole on any drive change,
|
|
2751
|
+
* every drive's node tree included, which on a large mail drive was ten
|
|
2752
|
+
* megabytes per change. Without a store (before init) the whole list loads.
|
|
2753
|
+
*/
|
|
2754
|
+
async function refreshDrive(reactor, driveId) {
|
|
2755
|
+
const drives = currentDrives();
|
|
2756
|
+
if (!drives) return _refreshReactorDataClient(reactor);
|
|
2757
|
+
const fresh = await getDrive(reactor, driveId);
|
|
2758
|
+
if (!fresh) {
|
|
2759
|
+
setDrives(drives.filter((d) => d.header.id !== driveId));
|
|
2760
|
+
return;
|
|
2761
|
+
}
|
|
2762
|
+
const at = drives.findIndex((d) => d.header.id === driveId);
|
|
2763
|
+
setDrives(at < 0 ? [...drives, fresh] : drives.map((d, i) => i === at ? fresh : d));
|
|
2764
|
+
}
|
|
2765
|
+
/**
|
|
2766
|
+
* Brings the drives store in line with which drives exist: ids come from a
|
|
2767
|
+
* headers-only listing, a drive not held yet is loaded on its own, and a drive
|
|
2768
|
+
* no longer listed is dropped. Drives already held are kept as they are.
|
|
2769
|
+
*/
|
|
2770
|
+
async function refreshDriveMembership(reactor) {
|
|
2771
|
+
const drives = currentDrives();
|
|
2772
|
+
if (!drives) return _refreshReactorDataClient(reactor);
|
|
2773
|
+
const ids = await listDriveIds(reactor);
|
|
2774
|
+
const known = new Map(drives.map((d) => [d.header.id, d]));
|
|
2775
|
+
const added = await Promise.all(ids.filter((id) => !known.has(id)).map((id) => getDrive(reactor, id)));
|
|
2776
|
+
const loaded = new Map(added.filter((d) => d !== void 0).map((d) => [d.header.id, d]));
|
|
2777
|
+
setDrives(ids.map((id) => known.get(id) ?? loaded.get(id)).filter((d) => d !== void 0));
|
|
2778
|
+
}
|
|
2779
|
+
/**
|
|
2780
|
+
* Routes a drive-type document change to the smallest refresh: an update
|
|
2781
|
+
* re-reads that one drive and invalidates its node cache, at most once per
|
|
2782
|
+
* `minIntervalMs` while it keeps changing (at once after a write from this
|
|
2783
|
+
* tab, see `markLocalDriveWrite`); a creation or deletion refreshes the
|
|
2784
|
+
* membership and loads only what is new.
|
|
2785
|
+
*/
|
|
2786
|
+
function createDriveChangeHandler(reactor, options = {}) {
|
|
2787
|
+
const minIntervalMs = options.minIntervalMs ?? DEFAULT_DRIVE_REFRESH_MIN_INTERVAL_MS;
|
|
2788
|
+
const onError = options.onError ?? (() => void 0);
|
|
2789
|
+
const lastAt = /* @__PURE__ */ new Map();
|
|
2790
|
+
const pending = /* @__PURE__ */ new Map();
|
|
2791
|
+
const run = (driveId) => {
|
|
2792
|
+
lastAt.set(driveId, Date.now());
|
|
2793
|
+
const timer = pending.get(driveId);
|
|
2794
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
2795
|
+
pending.delete(driveId);
|
|
2796
|
+
refreshDrive(reactor, driveId).then(() => invalidateDriveNodes(driveId)).catch(onError);
|
|
2797
|
+
};
|
|
2798
|
+
const schedule = (driveId) => {
|
|
2799
|
+
if (takeLocalDriveWrite(driveId)) {
|
|
2800
|
+
run(driveId);
|
|
2801
|
+
return;
|
|
2802
|
+
}
|
|
2803
|
+
if (pending.has(driveId)) return;
|
|
2804
|
+
const wait = (lastAt.get(driveId) ?? 0) + minIntervalMs - Date.now();
|
|
2805
|
+
if (wait <= 0) {
|
|
2806
|
+
run(driveId);
|
|
2807
|
+
return;
|
|
2808
|
+
}
|
|
2809
|
+
pending.set(driveId, setTimeout(() => run(driveId), wait));
|
|
2810
|
+
};
|
|
2811
|
+
return (event) => {
|
|
2812
|
+
if (event.type === DOCUMENT_CHANGE_TYPE.Updated) {
|
|
2813
|
+
for (const document of event.documents) schedule(document.header.id);
|
|
2814
|
+
return;
|
|
2815
|
+
}
|
|
2816
|
+
refreshDriveMembership(reactor).catch(onError);
|
|
2817
|
+
};
|
|
2818
|
+
}
|
|
2819
|
+
//#endregion
|
|
2820
|
+
//#region src/routing/drive-arrivals.ts
|
|
2821
|
+
let pendingAdds = 0;
|
|
2822
|
+
const addListeners = /* @__PURE__ */ new Set();
|
|
2823
|
+
function notifyAdds() {
|
|
2824
|
+
for (const listener of [...addListeners]) listener();
|
|
2825
|
+
}
|
|
2826
|
+
/** Counts a background drive addition as pending until it settles. */
|
|
2827
|
+
function trackDriveArrival(promise) {
|
|
2828
|
+
pendingAdds++;
|
|
2829
|
+
notifyAdds();
|
|
2830
|
+
return promise.finally(() => {
|
|
2831
|
+
pendingAdds--;
|
|
2832
|
+
notifyAdds();
|
|
2833
|
+
});
|
|
2834
|
+
}
|
|
2835
|
+
/** Resolves once `store.drives` lists `driveId`, or after `maxWaitMs`: a
|
|
2836
|
+
* finished first pull does not mean the drive is listed yet. */
|
|
2837
|
+
function untilDriveListed(store, driveId, maxWaitMs = 15e3) {
|
|
2838
|
+
const listed = () => !!store.drives?.some((d) => d.header.id === driveId);
|
|
2839
|
+
if (listed()) return Promise.resolve();
|
|
2840
|
+
return new Promise((resolve) => {
|
|
2841
|
+
const finish = () => {
|
|
2842
|
+
clearTimeout(timer);
|
|
2843
|
+
unsubscribe();
|
|
2844
|
+
resolve();
|
|
2845
|
+
};
|
|
2846
|
+
const timer = setTimeout(finish, maxWaitMs);
|
|
2847
|
+
const unsubscribe = subscribePHStore(store, () => {
|
|
2848
|
+
if (listed()) finish();
|
|
2849
|
+
}, "drives");
|
|
2850
|
+
});
|
|
2851
|
+
}
|
|
2852
|
+
const REMOTE_EVENTS = [SyncEventTypes.CONNECTION_STATE_CHANGED, SYNC_REMOTES_CHANGED_EVENT];
|
|
2853
|
+
/** Drives still on their way into `store`: being added or first syncing. */
|
|
2854
|
+
function createDriveArrivals(store) {
|
|
2855
|
+
return {
|
|
2856
|
+
isPending: () => store.drives === void 0 || pendingAdds > 0 || isInitialSyncInFlight(store),
|
|
2857
|
+
isDrivePending: (driveId) => isInitialSyncInFlight(store, driveId),
|
|
2858
|
+
subscribe(listener) {
|
|
2859
|
+
const watched = /* @__PURE__ */ new Map();
|
|
2860
|
+
const listenToRemotes = () => {
|
|
2861
|
+
const channels = /* @__PURE__ */ new Set();
|
|
2862
|
+
for (const { channel } of listSyncRemotes(store)) {
|
|
2863
|
+
channels.add(channel);
|
|
2864
|
+
if (watched.has(channel)) continue;
|
|
2865
|
+
try {
|
|
2866
|
+
watched.set(channel, channel.onConnectionStateChange(listener));
|
|
2867
|
+
} catch {
|
|
2868
|
+
watched.set(channel, () => {});
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
for (const [channel, unsubscribe] of watched) {
|
|
2872
|
+
if (channels.has(channel)) continue;
|
|
2873
|
+
unsubscribe();
|
|
2874
|
+
watched.delete(channel);
|
|
2875
|
+
}
|
|
2876
|
+
};
|
|
2877
|
+
const onChange = () => {
|
|
2878
|
+
listenToRemotes();
|
|
2879
|
+
listener();
|
|
2880
|
+
};
|
|
2881
|
+
let unsubscribeBus = [];
|
|
2882
|
+
const listenToBus = () => {
|
|
2883
|
+
for (const unsubscribe of unsubscribeBus) unsubscribe();
|
|
2884
|
+
const bus = store.reactorClientModule?.reactorModule?.eventBus;
|
|
2885
|
+
unsubscribeBus = bus ? REMOTE_EVENTS.map((type) => bus.subscribe(type, onChange)) : [];
|
|
2886
|
+
};
|
|
2887
|
+
const onModuleChange = () => {
|
|
2888
|
+
listenToBus();
|
|
2889
|
+
onChange();
|
|
2890
|
+
};
|
|
2891
|
+
listenToRemotes();
|
|
2892
|
+
listenToBus();
|
|
2893
|
+
addListeners.add(onChange);
|
|
2894
|
+
const unsubscribes = [subscribePHStore(store, onChange, "drives"), subscribePHStore(store, onModuleChange, "reactorClientModule")];
|
|
2895
|
+
return () => {
|
|
2896
|
+
addListeners.delete(onChange);
|
|
2897
|
+
for (const unsubscribe of unsubscribes) unsubscribe();
|
|
2898
|
+
for (const unsubscribe of unsubscribeBus) unsubscribe();
|
|
2899
|
+
for (const unsubscribe of watched.values()) unsubscribe();
|
|
2900
|
+
watched.clear();
|
|
2901
|
+
};
|
|
2902
|
+
}
|
|
2903
|
+
};
|
|
2904
|
+
}
|
|
2905
|
+
//#endregion
|
|
2906
|
+
//#region src/routing/resolve-drive-route.ts
|
|
2907
|
+
/** How long a navigation waits for its document and editor before it shows;
|
|
2908
|
+
* past it the view commits and renders them as they load. */
|
|
2909
|
+
const PREFETCH_WAIT_MS = 3e3;
|
|
2910
|
+
const DRIVE_ARRIVAL_MAX_WAIT_MS = 15e3;
|
|
2911
|
+
/** A listed drive by slug, id, or a `<name>-<id>` slug's trailing id. */
|
|
2912
|
+
function findDriveBySlugOrId(store, ref) {
|
|
2913
|
+
return findDriveBySlug(store.drives, ref);
|
|
2914
|
+
}
|
|
2915
|
+
async function findNode(store, driveId, nodeId) {
|
|
2916
|
+
const cached = peekDriveNode(driveId, nodeId, store);
|
|
2917
|
+
if (cached) return cached;
|
|
2918
|
+
try {
|
|
2919
|
+
return await getDriveNode(driveId, nodeId, {
|
|
2920
|
+
store,
|
|
2921
|
+
refresh: true
|
|
2922
|
+
});
|
|
2923
|
+
} catch {
|
|
2924
|
+
return;
|
|
2925
|
+
}
|
|
2926
|
+
}
|
|
2927
|
+
async function findNodeBySlug(store, driveId, slug) {
|
|
2928
|
+
try {
|
|
2929
|
+
return (await loadDriveNodes(driveId, { store })).find((n) => n.id === slug || makeNodeSlug(n) === slug);
|
|
2930
|
+
} catch {
|
|
2931
|
+
return;
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
/** `waitForArrival` for an async read, re-run on each arrival. */
|
|
2935
|
+
function waitForNodeArrival(read, arrivals, signal, maxWaitMs = DRIVE_ARRIVAL_MAX_WAIT_MS) {
|
|
2936
|
+
if (!arrivals?.isPending() || signal.aborted) return Promise.resolve(void 0);
|
|
2937
|
+
return new Promise((resolve) => {
|
|
2938
|
+
let settled = false;
|
|
2939
|
+
let unsubscribe = () => {};
|
|
2940
|
+
const finish = (result) => {
|
|
2941
|
+
if (settled) return;
|
|
2942
|
+
settled = true;
|
|
2943
|
+
clearTimeout(timer);
|
|
2944
|
+
unsubscribe();
|
|
2945
|
+
signal.removeEventListener("abort", onAbort);
|
|
2946
|
+
resolve(result);
|
|
2947
|
+
};
|
|
2948
|
+
const onAbort = () => finish(void 0);
|
|
2949
|
+
const timer = setTimeout(onAbort, maxWaitMs);
|
|
2950
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
2951
|
+
unsubscribe = arrivals.subscribe(() => {
|
|
2952
|
+
read().then((next) => {
|
|
2953
|
+
if (next !== void 0 || !arrivals.isPending()) finish(next);
|
|
2954
|
+
});
|
|
2955
|
+
});
|
|
2956
|
+
});
|
|
2957
|
+
}
|
|
2958
|
+
/** Resolves with `read()` once it is defined, nothing is still arriving, the
|
|
2959
|
+
* signal aborts or the cap passes. */
|
|
2960
|
+
function waitForArrival(read, arrivals, signal, maxWaitMs = DRIVE_ARRIVAL_MAX_WAIT_MS) {
|
|
2961
|
+
const value = read();
|
|
2962
|
+
if (value !== void 0 || !arrivals?.isPending() || signal.aborted) return Promise.resolve(value);
|
|
2963
|
+
return new Promise((resolve) => {
|
|
2964
|
+
let unsubscribe = () => {};
|
|
2965
|
+
const finish = (result) => {
|
|
2966
|
+
clearTimeout(timer);
|
|
2967
|
+
unsubscribe();
|
|
2968
|
+
signal.removeEventListener("abort", onAbort);
|
|
2969
|
+
resolve(result);
|
|
2970
|
+
};
|
|
2971
|
+
const onAbort = () => finish(void 0);
|
|
2972
|
+
const timer = setTimeout(onAbort, maxWaitMs);
|
|
2973
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
2974
|
+
unsubscribe = arrivals.subscribe(() => {
|
|
2975
|
+
const next = read();
|
|
2976
|
+
if (next !== void 0 || !arrivals.isPending()) finish(next);
|
|
2977
|
+
});
|
|
2978
|
+
});
|
|
2979
|
+
}
|
|
2980
|
+
/** Asks the reactor directly: a just-created drive may not be listed yet. */
|
|
2981
|
+
async function fetchDrive(store, ref, signal) {
|
|
2982
|
+
try {
|
|
2983
|
+
const document = await store.reactorClient?.get(ref, void 0, signal);
|
|
2984
|
+
return DRIVE_DOCUMENT_TYPES.includes(document?.header.documentType ?? "") ? document : void 0;
|
|
2985
|
+
} catch {
|
|
2986
|
+
return;
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2989
|
+
function editorModules(store) {
|
|
2990
|
+
return store.vetraPackageManager?.packages.flatMap((pkg) => pkg.editors) ?? [];
|
|
2991
|
+
}
|
|
2992
|
+
async function preloadModule(module) {
|
|
2993
|
+
try {
|
|
2994
|
+
await (module ? preloadEditorModule(module) : void 0);
|
|
2995
|
+
} catch {}
|
|
2996
|
+
}
|
|
2997
|
+
function documentEditor(store, document) {
|
|
2998
|
+
const { documentType, meta } = document.header;
|
|
2999
|
+
const modules = editorModules(store);
|
|
3000
|
+
return modules.find((module) => module.config.id === meta?.preferredEditor) ?? modules.find((module) => module.documentTypes.includes(documentType));
|
|
3001
|
+
}
|
|
3002
|
+
function driveApp(store, drive) {
|
|
3003
|
+
const id = drive.header.meta?.preferredEditor ?? "powerhouse/generic-drive-explorer";
|
|
3004
|
+
return editorModules(store).find((module) => module.config.id === id);
|
|
3005
|
+
}
|
|
3006
|
+
/** Loads a drive's app module so its view renders without suspending;
|
|
3007
|
+
* undefined when it is already loaded, so a warm open waits on nothing. */
|
|
3008
|
+
function preloadDriveApp(store, drive) {
|
|
3009
|
+
const module = driveApp(store, drive);
|
|
3010
|
+
return module && preloadEditorModule(module)?.then(noop, noop);
|
|
3011
|
+
}
|
|
3012
|
+
const noop = () => void 0;
|
|
3013
|
+
/** Warms a file node's document and its editor module. */
|
|
3014
|
+
async function prefetchDocument(store, node) {
|
|
3015
|
+
if (!isFileNode(node)) return;
|
|
3016
|
+
try {
|
|
3017
|
+
const document = await store.documentCache?.get(node.id);
|
|
3018
|
+
if (document) await preloadModule(documentEditor(store, document));
|
|
3019
|
+
} catch {}
|
|
3020
|
+
}
|
|
3021
|
+
/** Resolves once `work` settles, `ms` pass or `signal` aborts. */
|
|
3022
|
+
function settleWithin(work, ms, signal) {
|
|
3023
|
+
if (signal.aborted) return Promise.resolve();
|
|
3024
|
+
return new Promise((resolve) => {
|
|
3025
|
+
const done = () => {
|
|
3026
|
+
clearTimeout(timer);
|
|
3027
|
+
signal.removeEventListener("abort", done);
|
|
3028
|
+
resolve();
|
|
3029
|
+
};
|
|
3030
|
+
const timer = setTimeout(done, ms);
|
|
3031
|
+
signal.addEventListener("abort", done, { once: true });
|
|
3032
|
+
work.then(done, done);
|
|
3033
|
+
});
|
|
3034
|
+
}
|
|
3035
|
+
/** Resolves a drive route's slugs, waiting for drives that are still syncing,
|
|
3036
|
+
* and warms what the resolved view needs. */
|
|
3037
|
+
async function resolveDriveRoute(options) {
|
|
3038
|
+
const { store, driveSlug, nodeSlug, signal } = options;
|
|
3039
|
+
const arrivals = options.preload ? void 0 : options.arrivals;
|
|
3040
|
+
const drive = await waitForArrival(() => findDriveBySlugOrId(store, driveSlug), arrivals, signal) ?? await fetchDrive(store, extractDriveIdFromSlug(driveSlug) ?? driveSlug, signal);
|
|
3041
|
+
if (!drive) return { kind: "drive-not-found" };
|
|
3042
|
+
const driveId = drive.header.id;
|
|
3043
|
+
const appPreload = preloadDriveApp(store, drive);
|
|
3044
|
+
if (!nodeSlug) {
|
|
3045
|
+
if (appPreload) await settleWithin(appPreload, PREFETCH_WAIT_MS, signal);
|
|
3046
|
+
return {
|
|
3047
|
+
kind: "drive",
|
|
3048
|
+
driveId
|
|
3049
|
+
};
|
|
3050
|
+
}
|
|
3051
|
+
const nodeId = extractNodeIdFromSlug(nodeSlug) ?? (await findNodeBySlug(store, driveId, nodeSlug))?.id;
|
|
3052
|
+
const driveArrivals = arrivals && {
|
|
3053
|
+
...arrivals,
|
|
3054
|
+
isPending: () => arrivals.isDrivePending(driveId)
|
|
3055
|
+
};
|
|
3056
|
+
const node = nodeId ? await findNode(store, driveId, nodeId) ?? await waitForNodeArrival(() => findNode(store, driveId, nodeId), driveArrivals, signal) : void 0;
|
|
3057
|
+
if (!node) return {
|
|
3058
|
+
kind: "node-not-found",
|
|
3059
|
+
driveId
|
|
3060
|
+
};
|
|
3061
|
+
await settleWithin(Promise.all([appPreload, prefetchDocument(store, node)]), PREFETCH_WAIT_MS, signal);
|
|
3062
|
+
return {
|
|
3063
|
+
kind: "drive",
|
|
3064
|
+
driveId,
|
|
3065
|
+
nodeId: node.id
|
|
3066
|
+
};
|
|
3067
|
+
}
|
|
2493
3068
|
//#endregion
|
|
2494
3069
|
//#region src/remote-controller/action-tracker.ts
|
|
2495
3070
|
/**
|
|
@@ -2532,6 +3107,7 @@ var ActionTracker = class {
|
|
|
2532
3107
|
*/
|
|
2533
3108
|
const DEFAULT_PAGE_SIZE = 100;
|
|
2534
3109
|
var RemoteClient = class {
|
|
3110
|
+
client;
|
|
2535
3111
|
pageSize;
|
|
2536
3112
|
constructor(client, pageSize) {
|
|
2537
3113
|
this.client = client;
|
|
@@ -2757,7 +3333,13 @@ var RemoteDocumentController = class RemoteDocumentController {
|
|
|
2757
3333
|
tracker = new ActionTracker();
|
|
2758
3334
|
options;
|
|
2759
3335
|
documentId;
|
|
3336
|
+
/** The remote's id for the document; `documentId` may be a slug. */
|
|
3337
|
+
canonicalDocumentId;
|
|
2760
3338
|
remoteRevision = {};
|
|
3339
|
+
/** What the first push creates the remote from, until it has. */
|
|
3340
|
+
uncreated;
|
|
3341
|
+
/** A wrapped new document takes the host's signature policy at its first push. */
|
|
3342
|
+
takesHostPolicy = false;
|
|
2761
3343
|
hasPulled = false;
|
|
2762
3344
|
pushScheduled = false;
|
|
2763
3345
|
pushQueue = Promise.resolve();
|
|
@@ -2766,6 +3348,7 @@ var RemoteDocumentController = class RemoteDocumentController {
|
|
|
2766
3348
|
this.inner = inner;
|
|
2767
3349
|
this.options = options;
|
|
2768
3350
|
this.documentId = options.documentId ?? "";
|
|
3351
|
+
if (this.documentId === "") this.uncreated = uncreatedDocument(inner.document);
|
|
2769
3352
|
this.remoteClient = new RemoteClient(options.client, options.operationsPageSize);
|
|
2770
3353
|
this.setupActionInterceptors();
|
|
2771
3354
|
}
|
|
@@ -2815,6 +3398,7 @@ var RemoteDocumentController = class RemoteDocumentController {
|
|
|
2815
3398
|
try {
|
|
2816
3399
|
await this.ensureRemoteDocument();
|
|
2817
3400
|
if (this.options.onConflict && tracked.length > 0) tracked = await this.handleConflicts(tracked, this.options.onConflict);
|
|
3401
|
+
if (this.options.signer && tracked.length > 0) await this.resolveCanonicalDocumentId();
|
|
2818
3402
|
} catch (error) {
|
|
2819
3403
|
this.tracker.restore(tracked);
|
|
2820
3404
|
throw error;
|
|
@@ -2845,35 +3429,115 @@ var RemoteDocumentController = class RemoteDocumentController {
|
|
|
2845
3429
|
async pull() {
|
|
2846
3430
|
if (this.documentId === "") throw new Error("Cannot pull: no document ID set");
|
|
2847
3431
|
const { remoteDoc, operations } = await this.fetchDocumentAndOperations();
|
|
2848
|
-
|
|
2849
|
-
const
|
|
2850
|
-
this.
|
|
2851
|
-
this.
|
|
3432
|
+
this.canonicalDocumentId = remoteDoc.id;
|
|
3433
|
+
const initialDoc = this.inner.module.utils.createDocument();
|
|
3434
|
+
const pulledDocument = buildPulledDocument(remoteDoc, operations, initialDoc, this.options.branch ?? "main");
|
|
3435
|
+
this.replaceInner(pulledDocument);
|
|
2852
3436
|
this.tracker.clear();
|
|
2853
3437
|
this.remoteRevision = extractRevisionMap(remoteDoc.revisionsList);
|
|
2854
3438
|
this.notifyListeners("pull");
|
|
2855
3439
|
return remoteDoc;
|
|
2856
3440
|
}
|
|
2857
3441
|
/**
|
|
3442
|
+
* Undoes the last `count` operations of `scope`. Below base-reducer 3 (or
|
|
3443
|
+
* with no known version) it applies the model's UNDO, as the action method
|
|
3444
|
+
* did; on 3 it applies a RETRACT per step, each resolved from this
|
|
3445
|
+
* controller's own log, pending actions included.
|
|
3446
|
+
*/
|
|
3447
|
+
undo(count = 1, scope = "global") {
|
|
3448
|
+
return this.undoOrRedo("UNDO", count, scope);
|
|
3449
|
+
}
|
|
3450
|
+
/** Redoes the last `count` undos of `scope`; see {@link undo}. */
|
|
3451
|
+
redo(count = 1, scope = "global") {
|
|
3452
|
+
return this.undoOrRedo("REDO", count, scope);
|
|
3453
|
+
}
|
|
3454
|
+
undoOrRedo(type, count, scope) {
|
|
3455
|
+
const caps = capabilitiesFor(this.inner.header.protocolVersions);
|
|
3456
|
+
if (caps === void 0 || !undoNeedsTargets(caps)) return this.applyAction(type === "UNDO" ? undo(count, scope) : redo(count, scope));
|
|
3457
|
+
if (!Number.isInteger(count) || count < 1) throw new RangeError(`${type} count must be a positive integer on base-reducer 3, got ${count}`);
|
|
3458
|
+
const stateReducer = this.stateReducer();
|
|
3459
|
+
const actions = [];
|
|
3460
|
+
let scratch = this.inner.document;
|
|
3461
|
+
for (let step = 0; step < count; step++) {
|
|
3462
|
+
const targets = undoRedoTargetsOf(scratch, caps, scope, stateReducer);
|
|
3463
|
+
for (const action of undoRedoActions(caps, type, scope, targets)) {
|
|
3464
|
+
scratch = this.inner.module.reducer(scratch, action);
|
|
3465
|
+
actions.push(action);
|
|
3466
|
+
}
|
|
3467
|
+
}
|
|
3468
|
+
for (const action of actions) this.applyAction(action);
|
|
3469
|
+
return this;
|
|
3470
|
+
}
|
|
3471
|
+
stateReducer() {
|
|
3472
|
+
const reducer = stateReducerOf(this.inner.module.reducer);
|
|
3473
|
+
if (reducer === void 0) throw new Error(`Document model ${this.inner.header.documentType} has no state reducer to resolve undo targets with`);
|
|
3474
|
+
return reducer;
|
|
3475
|
+
}
|
|
3476
|
+
/**
|
|
2858
3477
|
* Pull an existing document from remote and create a controller for it.
|
|
2859
3478
|
*/
|
|
2860
3479
|
static async pull(ControllerClass, options) {
|
|
2861
|
-
const
|
|
3480
|
+
const temp = new ControllerClass();
|
|
3481
|
+
const remote = new RemoteDocumentController(temp, options);
|
|
2862
3482
|
if (options.documentId) await remote.pull();
|
|
3483
|
+
else await remote.headNewDocument();
|
|
2863
3484
|
return remote;
|
|
2864
3485
|
}
|
|
2865
3486
|
/**
|
|
2866
3487
|
* Wrap an existing controller instance with remote capabilities.
|
|
2867
3488
|
* Pending local actions on the inner controller are NOT tracked
|
|
2868
3489
|
* (only new actions through the remote controller are tracked).
|
|
3490
|
+
* Without a `documentId`, the first push creates the remote from the
|
|
3491
|
+
* wrapped document's header, under the host's create signature policy.
|
|
2869
3492
|
*/
|
|
2870
3493
|
static from(controller, options) {
|
|
2871
|
-
|
|
3494
|
+
const remote = new RemoteDocumentController(controller, options);
|
|
3495
|
+
remote.takesHostPolicy = remote.documentId === "";
|
|
3496
|
+
return remote;
|
|
3497
|
+
}
|
|
3498
|
+
/** Heads the new document with the host's versions for its type, as `newDocument` does; a host without `createDefaults` creates it with `createEmptyDocument`. */
|
|
3499
|
+
async headNewDocument() {
|
|
3500
|
+
const module = this.inner.module;
|
|
3501
|
+
let policy;
|
|
3502
|
+
let versions;
|
|
3503
|
+
try {
|
|
3504
|
+
[policy, versions] = await Promise.all([readCreateSignaturePolicy(this.options.client), readCreateProtocolVersions(this.options.client, {
|
|
3505
|
+
documentType: this.inner.header.documentType,
|
|
3506
|
+
parentIdentifier: this.options.parentIdentifier
|
|
3507
|
+
}, [module])]);
|
|
3508
|
+
} catch (error) {
|
|
3509
|
+
if (!GraphQLOperationNotSupportedError.isError(error)) throw error;
|
|
3510
|
+
this.uncreated = void 0;
|
|
3511
|
+
return;
|
|
3512
|
+
}
|
|
3513
|
+
const document = headNewDocument(module, void 0, policy, versions);
|
|
3514
|
+
this.uncreated = structuredClone(document);
|
|
3515
|
+
this.replaceInner(document);
|
|
2872
3516
|
}
|
|
2873
|
-
/**
|
|
3517
|
+
/** Creates the remote from the local header, so both run the versions its creator chose. */
|
|
2874
3518
|
async ensureRemoteDocument() {
|
|
2875
3519
|
if (this.documentId !== "") return;
|
|
2876
|
-
|
|
3520
|
+
if (this.takesHostPolicy) {
|
|
3521
|
+
await this.takeHostSignaturePolicy();
|
|
3522
|
+
this.takesHostPolicy = false;
|
|
3523
|
+
}
|
|
3524
|
+
const remoteDoc = this.uncreated === void 0 ? await this.remoteClient.createEmptyDocument(this.inner.header.documentType, this.options.parentIdentifier) : await this.remoteClient.createDocument(this.uncreated, this.options.parentIdentifier);
|
|
3525
|
+
this.documentId = remoteDoc.id;
|
|
3526
|
+
this.canonicalDocumentId = remoteDoc.id;
|
|
3527
|
+
this.uncreated = void 0;
|
|
3528
|
+
}
|
|
3529
|
+
/** Puts the uncreated document under the host's policy; a host without `createDefaults` creates it with `createEmptyDocument`. */
|
|
3530
|
+
async takeHostSignaturePolicy() {
|
|
3531
|
+
if (this.uncreated === void 0) return;
|
|
3532
|
+
let policy;
|
|
3533
|
+
try {
|
|
3534
|
+
policy = await readCreateSignaturePolicy(this.options.client);
|
|
3535
|
+
} catch (error) {
|
|
3536
|
+
if (!GraphQLOperationNotSupportedError.isError(error)) throw error;
|
|
3537
|
+
this.uncreated = void 0;
|
|
3538
|
+
return;
|
|
3539
|
+
}
|
|
3540
|
+
this.uncreated = underSignaturePolicy(this.uncreated, policy);
|
|
2877
3541
|
}
|
|
2878
3542
|
/** Set up interceptors for all action methods on the inner controller. */
|
|
2879
3543
|
setupActionInterceptors() {
|
|
@@ -2881,25 +3545,45 @@ var RemoteDocumentController = class RemoteDocumentController {
|
|
|
2881
3545
|
for (const actionType in module.actions) {
|
|
2882
3546
|
if (actionType in RemoteDocumentController.prototype) continue;
|
|
2883
3547
|
Object.defineProperty(this, actionType, {
|
|
2884
|
-
value: (input) =>
|
|
2885
|
-
const opCountsBefore = {};
|
|
2886
|
-
for (const scope in this.inner.operations) opCountsBefore[scope] = this.inner.operations[scope].length;
|
|
2887
|
-
this.inner[actionType](input);
|
|
2888
|
-
const newOp = this.findNewOperation(opCountsBefore);
|
|
2889
|
-
const prevOp = newOp ? this.getLastOperationInScope(newOp.action.scope, newOp) : void 0;
|
|
2890
|
-
const prevOpHash = prevOp?.hash ?? "";
|
|
2891
|
-
const prevOpIndex = prevOp?.index ?? -1;
|
|
2892
|
-
if (!newOp) return this;
|
|
2893
|
-
this.tracker.track(newOp.action, prevOpHash, prevOpIndex);
|
|
2894
|
-
this.notifyListeners("action");
|
|
2895
|
-
if (this.options.mode === "streaming") this.schedulePush();
|
|
2896
|
-
return this;
|
|
2897
|
-
},
|
|
3548
|
+
value: (input) => this.dispatchModelAction(actionType, input),
|
|
2898
3549
|
enumerable: true,
|
|
2899
3550
|
configurable: true
|
|
2900
3551
|
});
|
|
2901
3552
|
}
|
|
2902
3553
|
}
|
|
3554
|
+
/** Applies the model's `actionType` action method locally and tracks it. */
|
|
3555
|
+
dispatchModelAction(actionType, input) {
|
|
3556
|
+
return this.applyAndTrack(() => {
|
|
3557
|
+
this.inner[actionType](input);
|
|
3558
|
+
});
|
|
3559
|
+
}
|
|
3560
|
+
/** Applies `action` locally through the model's reducer and tracks it. */
|
|
3561
|
+
applyAction(action) {
|
|
3562
|
+
return this.applyAndTrack(() => {
|
|
3563
|
+
this.replaceInner(this.inner.module.reducer(this.inner.document, action));
|
|
3564
|
+
});
|
|
3565
|
+
}
|
|
3566
|
+
/** Runs `apply`, then tracks the operation it added for push. */
|
|
3567
|
+
applyAndTrack(apply) {
|
|
3568
|
+
const opCountsBefore = {};
|
|
3569
|
+
for (const scope in this.inner.operations) opCountsBefore[scope] = this.inner.operations[scope].length;
|
|
3570
|
+
apply();
|
|
3571
|
+
const newOp = this.findNewOperation(opCountsBefore);
|
|
3572
|
+
const prevOp = newOp ? this.getLastOperationInScope(newOp.action.scope, newOp) : void 0;
|
|
3573
|
+
const prevOpHash = prevOp?.hash ?? "";
|
|
3574
|
+
const prevOpIndex = prevOp?.index ?? -1;
|
|
3575
|
+
if (!newOp) return this;
|
|
3576
|
+
this.tracker.track(newOp.action, prevOpHash, prevOpIndex);
|
|
3577
|
+
this.notifyListeners("action");
|
|
3578
|
+
if (this.options.mode === "streaming") this.schedulePush();
|
|
3579
|
+
return this;
|
|
3580
|
+
}
|
|
3581
|
+
/** Recreates the inner controller over `document` and re-intercepts it. */
|
|
3582
|
+
replaceInner(document) {
|
|
3583
|
+
const ControllerClass = this.inner.constructor;
|
|
3584
|
+
this.inner = new ControllerClass(document);
|
|
3585
|
+
this.setupActionInterceptors();
|
|
3586
|
+
}
|
|
2903
3587
|
/**
|
|
2904
3588
|
* Find the new operation added after applying an action,
|
|
2905
3589
|
* by comparing current operation counts against a previous snapshot.
|
|
@@ -2928,6 +3612,7 @@ var RemoteDocumentController = class RemoteDocumentController {
|
|
|
2928
3612
|
async handleConflicts(localTracked, strategy) {
|
|
2929
3613
|
const remoteResult = await this.remoteClient.getDocument(this.documentId, this.options.branch);
|
|
2930
3614
|
if (!remoteResult) throw new Error(`Document "${this.documentId}" not found on remote`);
|
|
3615
|
+
this.canonicalDocumentId ??= remoteResult.document.id;
|
|
2931
3616
|
const currentRevision = extractRevisionMap(remoteResult.document.revisionsList);
|
|
2932
3617
|
const localScopes = new Set(localTracked.map((t) => t.action.scope));
|
|
2933
3618
|
if (!hasRevisionConflict(currentRevision, this.remoteRevision, localScopes)) return localTracked;
|
|
@@ -2952,13 +3637,34 @@ var RemoteDocumentController = class RemoteDocumentController {
|
|
|
2952
3637
|
*/
|
|
2953
3638
|
async pullAndReplay(actions) {
|
|
2954
3639
|
await this.pull();
|
|
3640
|
+
const replayedIds = /* @__PURE__ */ new Map();
|
|
2955
3641
|
for (const action of actions) {
|
|
2956
|
-
const
|
|
2957
|
-
const
|
|
2958
|
-
|
|
3642
|
+
const scopeOps = () => this.inner.operations[action.scope] ?? [];
|
|
3643
|
+
const before = scopeOps().length;
|
|
3644
|
+
this.replayAction(action, replayedIds);
|
|
3645
|
+
const after = scopeOps();
|
|
3646
|
+
if (after.length > before) replayedIds.set(action.id, after[after.length - 1].action.id);
|
|
2959
3647
|
}
|
|
2960
3648
|
return this.tracker.flush();
|
|
2961
3649
|
}
|
|
3650
|
+
replayAction(action, replayedIds) {
|
|
3651
|
+
if (action.type === "RETRACT") {
|
|
3652
|
+
const { target } = action.input;
|
|
3653
|
+
const replayed = replayedIds.get(target);
|
|
3654
|
+
this.applyAction(replayed === void 0 ? action : {
|
|
3655
|
+
...action,
|
|
3656
|
+
input: { target: replayed }
|
|
3657
|
+
});
|
|
3658
|
+
return;
|
|
3659
|
+
}
|
|
3660
|
+
const methodName = screamingSnakeToCamel(action.type);
|
|
3661
|
+
if (methodName === "undo" || methodName === "redo") {
|
|
3662
|
+
this.dispatchModelAction(methodName, action.input);
|
|
3663
|
+
return;
|
|
3664
|
+
}
|
|
3665
|
+
const method = this[methodName];
|
|
3666
|
+
if (typeof method === "function") method.call(this, action.input);
|
|
3667
|
+
}
|
|
2962
3668
|
/** Prepare actions for push, optionally signing them. */
|
|
2963
3669
|
async prepareActionsForPush(tracked) {
|
|
2964
3670
|
const actions = [];
|
|
@@ -2976,18 +3682,34 @@ var RemoteDocumentController = class RemoteDocumentController {
|
|
|
2976
3682
|
}
|
|
2977
3683
|
return actions;
|
|
2978
3684
|
}
|
|
3685
|
+
/**
|
|
3686
|
+
* The remote's id for `documentId`, which may be a slug. A signature binds
|
|
3687
|
+
* the id the remote verifies against, so a slug is never signed.
|
|
3688
|
+
*/
|
|
3689
|
+
async resolveCanonicalDocumentId() {
|
|
3690
|
+
if (this.canonicalDocumentId) return this.canonicalDocumentId;
|
|
3691
|
+
let result;
|
|
3692
|
+
try {
|
|
3693
|
+
result = await this.remoteClient.getDocument(this.documentId, this.options.branch);
|
|
3694
|
+
} catch (error) {
|
|
3695
|
+
throw new Error(`Cannot sign for "${this.documentId}": its document id could not be resolved on the remote`, { cause: error });
|
|
3696
|
+
}
|
|
3697
|
+
if (!result) throw new Error(`Cannot sign for "${this.documentId}": no document with that identifier on the remote`);
|
|
3698
|
+
this.canonicalDocumentId = result.document.id;
|
|
3699
|
+
return result.document.id;
|
|
3700
|
+
}
|
|
2979
3701
|
/** Sign an action using the configured signer, preserving existing signatures. */
|
|
2980
3702
|
async signAction(action) {
|
|
2981
3703
|
const signer = this.options.signer;
|
|
2982
|
-
const
|
|
3704
|
+
const target = actionSigningTarget(action, await this.resolveCanonicalDocumentId(), this.options.branch ?? "main");
|
|
3705
|
+
const signature = await signer.signAction(action, target);
|
|
2983
3706
|
const existingSignatures = action.context?.signer?.signatures ?? [];
|
|
2984
3707
|
return {
|
|
2985
3708
|
...action,
|
|
2986
3709
|
context: {
|
|
2987
3710
|
...action.context,
|
|
2988
3711
|
signer: {
|
|
2989
|
-
|
|
2990
|
-
app: signer.app,
|
|
3712
|
+
...actionSignerIdentity(signer),
|
|
2991
3713
|
signatures: [...existingSignatures, signature]
|
|
2992
3714
|
}
|
|
2993
3715
|
}
|
|
@@ -3136,6 +3858,6 @@ var BrowserLocalStorage = class extends BaseStorage {
|
|
|
3136
3858
|
}
|
|
3137
3859
|
};
|
|
3138
3860
|
//#endregion
|
|
3139
|
-
export { ActionTracker, BaseStorage, BrowserLocalStorage, COMMON_PACKAGE_ID, CREDENTIAL_SCHEMA_EIP712_TYPE, CREDENTIAL_SUBJECT_TYPE, CREDENTIAL_TYPES, ChannelScheme, ChevronDownIcon, ConflictError, CopyIcon, DEFAULT_DRIVE_EDITOR_ID, DEFAULT_DRIVE_ID, DEFAULT_SWITCHBOARD_URL, DOMAIN_TYPE, DRIVE_DOCUMENT_TYPES, DisconnectIcon, DocumentCache, DocumentChangeType, DocumentIntegrityService, DocumentModelNotFoundError, DocumentTypeMismatchError, DriveCollectionId, EDITOR_FILE_DROP_OPT_OUT_ATTR, GqlRequestChannel, GraphQLClientDocumentCache, GraphQLReactorClient, GraphQLReactorProvider, ISSUER_TYPE, InMemoryQueue, IntervalPollTimer, MutateDocumentWithOperationsDocument, NoSelectedDocumentError, PollBehavior, PropagationMode, REACTOR_SCHEMA, RENOWN_CHAIN_ID, RENOWN_INITIAL_ANONYMOUS, RENOWN_INITIAL_UNKNOWN, RENOWN_NETWORK_ID, RENOWN_RETURN_URL_STRIPPED_PARAMS, RENOWN_URL, ReactorBuilder, ReactorClientBuilder, ReactorOperationFieldsFragmentDoc, RegistryClient, RelationalDbProcessor, RemoteClient, RemoteDocumentController, Renown, RenownAuthButton, RenownInitialUserProvider, RenownLoginButton, RenownLogo, RenownProvider, RenownUserButton, RenownWalletProvider, SpinnerIcon, StaticPackageManager, SubgraphSdkRegistry, SyncOperationStatus, UnsupportedDocumentTypeError, UserIcon, VERIFIABLE_CREDENTIAL_EIP712_TYPE, addAllowListEventHandler, addAllowedDocumentTypesEventHandler, addAnalyticsDatabaseNameEventHandler, addAttachmentServiceEventHandler, addBasePathEventHandler, addCliVersionEventHandler, addDefaultDrivesUrlEventHandler, addDisabledEditorsEventHandler, addDocument, addDocumentCacheEventHandler, addDraggingNodeEventHandler, addDrive, addDrivesEventHandler, addDrivesPreserveStrategyEventHandler, addEnabledEditorsEventHandler, addFeaturesEventHandler, addFileUploadOperationsChunkSizeEventHandler, addFileWithProgress, addFolder, addGaTrackingIdEventHandler, addGraphQLReactorClientEventHandler, addIsAddCloudDrivesEnabledEventHandler, addIsAddDriveEnabledEventHandler, addIsAddLocalDrivesEnabledEventHandler, addIsAddPublicDrivesEnabledEventHandler, addIsAnalyticsDatabaseWorkerEnabledEventHandler, addIsAnalyticsEnabledEventHandler, addIsAnalyticsExternalProcessorsEnabledEventHandler, addIsCloudDrivesEnabledEventHandler, addIsDeleteCloudDrivesEnabledEventHandler, addIsDeleteLocalDrivesEnabledEventHandler, addIsDeletePublicDrivesEnabledEventHandler, addIsDiffAnalyticsEnabledEventHandler, addIsDocumentModelSelectionSettingsEnabledEventHandler, addIsDragAndDropEnabledEventHandler, addIsDriveAnalyticsEnabledEventHandler, addIsEditorDebugModeEnabledEventHandler, addIsEditorReadModeEnabledEventHandler, addIsExternalControlsEnabledEventHandler, addIsExternalPackagesEnabledEventHandler, addIsExternalProcessorsEnabledEventHandler, addIsExternalRelationalProcessorsEnabledEventHandler, addIsLocalDrivesEnabledEventHandler, addIsPublicDrivesEnabledEventHandler, addIsRelationalProcessorsEnabledEventHandler, addIsSentryTracingEnabledEventHandler, addLoadingEventHandler, addLocalDrivesEnabledEventHandler, addLogLevelEventHandler, addModalEventHandler, addPHEventHandlers, addPackageDiscoveryServiceEventHandler, addPromiseState, addReactorClientEventHandler, addReactorClientModuleEventHandler, addRemoteDrive, addRenownAdaptersEventHandler, addRenownChainIdEventHandler, addRenownEventHandler, addRenownNetworkIdEventHandler, addRenownUrlEventHandler, addRequiresHardRefreshEventHandler, addResetSelectedNodeEventHandler, addRevisionHistoryVisibleEventHandler, addRouterBasenameEventHandler, addSelectedDriveIdEventHandler, addSelectedNodeIdEventHandler, addSelectedTimelineItemEventHandler, addSelectedTimelineRevisionEventHandler, addSentryDsnEventHandler, addSentryEnvEventHandler, addSentryReleaseEventHandler, addSetSelectedDriveOnPopStateEventHandler, addSetSelectedNodeOnPopStateEventHandler, addStudioModeEventHandler, addSwitchboardUrlEventHandler, addToastEventHandler, addVersionCheckIntervalEventHandler, addVersionEventHandler, addVetraPackageManagerEventHandler, addWarnOutdatedAppEventHandler, ambientRenownTokenProvider, baseDocumentModels, baseDocumentModelsMap, buildDocumentSubgraphQuery, buildDocumentSubgraphUrl, buildFolderZip, callEventHandlerRegisterFunctions, callGlobalSetterForKey, clearGlobal, closePHModal, commonGlobalEventHandlerFunctions, convertRemoteOperations, createAnalyticsStore, createClient, createProcessorQuery, createUrlWithPreservedParams, deleteDrive, deleteNode, deriveSystemUrl, describeGraphQLDocument, diffStateShapes, dispatchActions, downloadDocument, downloadFolderZip, driveIdFromUrl, dropAllReactorStorage, ensurePHEventHandlers, expandBulkArchive, exportFile, extractDriveIdFromPath, extractDriveIdFromSlug, extractDriveSlugFromPath, extractNodeIdFromPath, extractNodeIdFromSlug, extractNodeSlugFromPath, fetchDriveInfo, findUuid, getAnalyticsStore, getDocumentExtension, getDocumentGraphqlQuery, getDocumentStateSelection, getDocumentUpgradePreview, getDocumentVersionStatus, getDriveIdBySlug, getDrives, getGlobal, getPackageInfo, getPackagePage, getPackages, getPackagesByDocumentType, getPackagesForDocumentType, getPathWithoutBase, getRevisionFromDate, getSlugFromDriveUrl, getSwitchboardBaseFromChannelUrl, getSwitchboardGatewayUrlFromDriveUrl, getSyncStatus, getSyncStatusSync, getUserPermissions, graphqlDocumentEvents, graphqlDocumentsEvents, graphqlEventsToSyncDrive, hasPreloadBandwidth, hideRevisionHistory, identifierFromMutateDocumentOperationVariables, initConnectCrypto, initRenownCrypto, initTheme, isAuthRefusalClose, isDocumentTypeSupported, isDriveAuthError, isExternalControlsEnabledEventFunctions, isFileNodeKind, isFolderNodeKind, isGraphQLReactorClient, loadFile, loading, login, logout, makeAuthConnectionParams, makeAuthMiddleware, makeDriveUrlComponent, makeNodeSlug, makePHEventFunctions, openRenown, packageFromDocumentModels, parseDriveUrl, phAppConfigHooks, phAppConfigSetters, phDocumentEditorConfigHooks, phDocumentEditorConfigSetters, phDocumentFromGetDocument, phDocumentFromMutation, phDocumentFromQuery, phDocumentsFromQuery, phGlobalConfigHooks, phGlobalConfigSetters, preloadEditorModule, prepareSignedActions, reactorGraphqlBatchFetchDocuments, reactorGraphqlCreateDocument, reactorGraphqlDeleteDocument, reactorGraphqlDeleteDocuments, reactorGraphqlFetchDocument, reactorGraphqlMutateDocument, readPromiseState, refreshReactorData, refreshReactorDataClient, renameDrive, renameDriveNode, resolveDocumentModelModule, resolveUrlPathname, revisionMapFromRevisionsList, setAllowList, setAllowedDocumentTypes, setAnalyticsDatabaseName, setAttachmentService, setBasePath, setCliVersion, setDefaultDrivesUrl, setDefaultPHGlobalConfig, setDisabledEditors, setDocumentCache, setDriveAvailableOffline, setDriveMetadata, setDriveSharingType, setDrives, setDrivesPreserveStrategy, setEnabledEditors, setFeatures, setFileUploadOperationsChunkSize, setGaTrackingId, setGlobal, setGraphQLReactorClient, setIsAddCloudDrivesEnabled, setIsAddDriveEnabled, setIsAddLocalDrivesEnabled, setIsAddPublicDrivesEnabled, setIsAnalyticsDatabaseWorkerEnabled, setIsAnalyticsEnabled, setIsAnalyticsExternalProcessorsEnabled, setIsCloudDrivesEnabled, setIsDeleteCloudDrivesEnabled, setIsDeleteLocalDrivesEnabled, setIsDeletePublicDrivesEnabled, setIsDiffAnalyticsEnabled, setIsDocumentModelSelectionSettingsEnabled, setIsDragAndDropEnabled, setIsDriveAnalyticsEnabled, setIsEditorDebugModeEnabled, setIsEditorReadModeEnabled, setIsExternalControlsEnabled, setIsExternalPackagesEnabled, setIsExternalProcessorsEnabled, setIsExternalRelationalProcessorsEnabled, setIsLocalDrivesEnabled, setIsPublicDrivesEnabled, setIsRelationalProcessorsEnabled, setIsSentryTracingEnabled, setLoading, setLocalDrivesEnabled, setLogLevel, setPGliteDB, setPHAppConfig, setPHAppConfigByKey, setPHDocumentEditorConfig, setPHDocumentEditorConfigByKey, setPHGlobalConfig, setPHGlobalConfigByKey, setPHModal, setPHToast, setPackageDiscoveryService, setPreferredEditorOnNode, setReactorClient, setReactorClientModule, setRenown, setRenownAdapters, setRenownChainId, setRenownNetworkId, setRenownUrl, setRequiresHardRefresh, setRevisionHistoryVisible, setRouterBasename, setSelectedDrive, setSelectedDriveId, setSelectedNode, setSelectedTimelineItem, setSelectedTimelineRevision, setSentryDsn, setSentryEnv, setSentryRelease, setStudioMode, setSwitchboardUrl, setVersion, setVersionCheckInterval, setVetraPackageManager, setWarnOutdatedApp, showCreateDocumentModal, showDeleteNodeModal, showPHModal, showRevisionHistory, signStampedAction, sortNodesByName, stampAction, startDocumentChangesSubscription, subgraphUrlFromGraphqlUrl, subscriptionsUrlFromGraphqlUrl, trimTrailingSlash, truncateAllTables, upgradeDocument, useAllowList, useAllowedDocumentModelModules, useAllowedDocumentTypes, useAnalyticsDatabaseName, useAppModuleById, useAppModules, useAttachmentPreview, useAttachmentService, useAttachmentUpload, useAttachments, useBasePath, useCanExecute, useCliVersion, useConnectionState, useConnectionStates, useDatabase, useDefaultAppModule, useDefaultDrivesUrl, useDid, useDisabledEditors, useDispatch, useDocument, useDocumentById, useDocumentCache, useDocumentModelModuleById, useDocumentModelModules, useDocumentOfType, useDocumentOperations, useDocumentSafe, useDocumentTypes, useDocumentTypesInSelectedDrive, useDocumentVersionStatus, useDocuments, useDocumentsByIds, useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useDownloadDocument, useDownloadFolder, useDragNode, useDriveById, useDriveSystemInfo, useDrives, useDrivesPreserveStrategy, useDropFile, useDropNode, useEditorFileDrop, useEditorModuleById, useEditorModules, useEditorModulesForDocumentType, useEditorPreloader, useEnabledEditors, useFallbackEditorModule, useFeatures, useFileNodesInSelectedDrive, useFileNodesInSelectedFolder, useFileUploadOperationsChunkSize, useFolderById, useFolderNodesInSelectedDrive, useFolderNodesInSelectedFolder, useGaTrackingId, useGetDocument, useGetDocumentAsync, useGetDocuments, useGetSwitchboardLink, useGraphQLReactorClient, useInitReactorGraphqlClient, useIsAddCloudDrivesEnabled, useIsAddDriveEnabled, useIsAddLocalDrivesEnabled, useIsAddPublicDrivesEnabled, useIsAnalyticsDatabaseWorkerEnabled, useIsAnalyticsEnabled, useIsAnalyticsExternalProcessorsEnabled, useIsCloudDrivesEnabled, useIsDeleteCloudDrivesEnabled, useIsDeleteLocalDrivesEnabled, useIsDeletePublicDrivesEnabled, useIsDiffAnalyticsEnabled, useIsDocumentModelSelectionSettingsEnabled, useIsDragAndDropEnabled, useIsDriveAnalyticsEnabled, useIsEditorDebugModeEnabled, useIsEditorReadModeEnabled, useIsExternalControlsEnabled, useIsExternalPackagesEnabled, useIsExternalProcessorsEnabled, useIsExternalRelationalProcessorsEnabled, useIsLocalDrivesEnabled, useIsPublicDrivesEnabled, useIsRelationalProcessorsEnabled, useIsSentryTracingEnabled, useLoading, useLocalDrivesEnabled, useLogLevel, useLoginStatus, useModelRegistry, useNodeActions, useNodeById, useNodeParentFolderById, useNodePathById, useNodesInSelectedDrive, useNodesInSelectedDriveOrFolder, useNodesInSelectedFolder, useOnDropFile, usePGlite, usePHAppConfigByKey, usePHDocumentEditorConfigByKey, usePHGlobalConfigByKey, usePHModal, usePHToast, usePackageDiscoveryService, useParentFolderForSelectedNode, useReactorClient, useReactorClientModule, useRelationalDb, useRelationalQuery, useRenown, useRenownAdapters, useRenownAuth, useRenownAuthAsync, useRenownChainId, useRenownInit, useRenownInitialAuth, useRenownInitialUser, useRenownLoginMethods, useRenownNetworkId, useRenownSessionCookie, useRenownSessionSynced, useRenownUrl, useRenownWalletAdapter, useRequiresHardRefresh, useResetPHGlobalConfig, useRevisionHistoryVisible, useRouterBasename, useSelectedDocument, useSelectedDocumentId, useSelectedDocumentOfType, useSelectedDocumentSafe, useSelectedDrive, useSelectedDriveId, useSelectedDriveSafe, useSelectedFolder, useSelectedNode, useSelectedNodePath, useSelectedTimelineItem, useSelectedTimelineRevision, useSentryDsn, useSentryEnv, useSentryRelease, useSetDefaultPHGlobalConfig, useSetPHAppConfig, useSetPHDocumentEditorConfig, useSetPHGlobalConfig, useStudioMode, useSubgraphModules, useSupportedDocumentTypesInReactor, useSwitchboardClient, useSwitchboardUrl, useSync, useSyncList, useTheme, useUser, useUserPermissions, useVersion, useVersionCheckInterval, useVetraPackageManager, useVetraPackages, useWarnOutdatedApp, validateDocument, viewFilterInputFromViewFilter, waitForDocumentReady };
|
|
3861
|
+
export { ActionTracker, BaseStorage, BatchJobFailedError, BrowserLocalStorage, COMMON_PACKAGE_ID, CREDENTIAL_SCHEMA_EIP712_TYPE, CREDENTIAL_SUBJECT_TYPE, CREDENTIAL_TYPES, ChannelScheme, ChevronDownIcon, ConflictError, CopyIcon, DEFAULT_BATCH_REQUEST_TIMEOUT_MS, DEFAULT_BREAKER, DEFAULT_DRIVE_EDITOR_ID, DEFAULT_DRIVE_ID, DEFAULT_REQUEST_TIMEOUT_MS, DEFAULT_SWITCHBOARD_URL, DOMAIN_TYPE, DRIVE_ARRIVAL_MAX_WAIT_MS, DRIVE_DOCUMENT_TYPES, DisconnectIcon, DocumentCache, DocumentChangeType, DocumentIntegrityService, DocumentModelNotFoundError, DocumentTypeMismatchError, DriveCollectionId, DriveProvider, EDITOR_FILE_DROP_OPT_OUT_ATTR, EditorDocumentProvider, FEATURE_FLAG_PARAM_PREFIX, GET_MANY_CHUNK_SIZE, GLOBAL_SEARCH_PARAMS, GetDocumentAtConsistencyDocument, GqlRequestChannel, GraphQLClientDocumentCache, GraphQLDriveNodeSource, GraphQLDriveReadClient, GraphQLOperationNotSupportedError, GraphQLReactorClient, GraphQLReactorProvider, GraphQLWrongBackendError, IDLE_DOCUMENTS_OF_TYPE_ENTRY, IDLE_OPERATIONS_ENTRY, IDLE_REFETCH_STATE, ISSUER_TYPE, InMemoryQueue, IntervalPollTimer, JobFailedError, MODAL_SEARCH_PARAM, MutateDocumentWithOperationsDocument, NoSelectedDocumentError, OPENED_FROM_STATE_KEY, OperationRejectedError, PHStoreProvider, PH_LOCATION_CHANGE_EVENT, PREFETCH_WAIT_MS, PollBehavior, PropagationMode, REACTOR_SCHEMA, RENOWN_CHAIN_ID, RENOWN_INITIAL_ANONYMOUS, RENOWN_INITIAL_UNKNOWN, RENOWN_NETWORK_ID, RENOWN_RETURN_URL_STRIPPED_PARAMS, RENOWN_URL, REVISION_HISTORY_PAGE_PARAM, REVISION_HISTORY_PARAM, ReactorBuilder, ReactorClientBuilder, ReactorOperationFieldsFragmentDoc, RegistryClient, RelationalDbProcessor, RemoteClient, RemoteDocumentController, Renown, RenownAuthButton, RenownInitialUserProvider, RenownLoginButton, RenownLogo, RenownProvider, RenownUserButton, RenownWalletProvider, SETTINGS_PATH, SpinnerIcon, StaticPackageManager, SubgraphSdkRegistry, SwitchboardUnreachableError, SyncOperationStatus, UnsupportedDocumentTypeError, UserIcon, VERIFIABLE_CREDENTIAL_EIP712_TYPE, addAllowListEventHandler, addAllowedDocumentTypesEventHandler, addAnalyticsDatabaseNameEventHandler, addAttachmentServiceEventHandler, addBackendAuthEventHandler, addBasePathEventHandler, addCliVersionEventHandler, addDefaultDrivesUrlEventHandler, addDisabledEditorsEventHandler, addDocument, addDocumentCacheEventHandler, addDraggingNodeEventHandler, addDrive, addDriveNodesEventHandler, addDrivesEventHandler, addDrivesPreserveStrategyEventHandler, addEnabledEditorsEventHandler, addFeaturesEventHandler, addFileUploadOperationsChunkSizeEventHandler, addFileWithProgress, addFolder, addFullReactorClientEventHandler, addGaTrackingIdEventHandler, addGraphQLReactorClientEventHandler, addIsAddCloudDrivesEnabledEventHandler, addIsAddDriveEnabledEventHandler, addIsAddLocalDrivesEnabledEventHandler, addIsAddPublicDrivesEnabledEventHandler, addIsAnalyticsDatabaseWorkerEnabledEventHandler, addIsAnalyticsEnabledEventHandler, addIsAnalyticsExternalProcessorsEnabledEventHandler, addIsCloudDrivesEnabledEventHandler, addIsDeleteCloudDrivesEnabledEventHandler, addIsDeleteLocalDrivesEnabledEventHandler, addIsDeletePublicDrivesEnabledEventHandler, addIsDiffAnalyticsEnabledEventHandler, addIsDocumentModelSelectionSettingsEnabledEventHandler, addIsDragAndDropEnabledEventHandler, addIsDriveAnalyticsEnabledEventHandler, addIsEditorDebugModeEnabledEventHandler, addIsEditorReadModeEnabledEventHandler, addIsExternalControlsEnabledEventHandler, addIsExternalPackagesEnabledEventHandler, addIsExternalProcessorsEnabledEventHandler, addIsExternalRelationalProcessorsEnabledEventHandler, addIsLocalDrivesEnabledEventHandler, addIsPublicDrivesEnabledEventHandler, addIsRelationalProcessorsEnabledEventHandler, addIsSentryTracingEnabledEventHandler, addLoadingEventHandler, addLocalDrivesEnabledEventHandler, addLogLevelEventHandler, addModalEventHandler, addPHEventHandlers, addPackageDiscoveryServiceEventHandler, addPromiseState, addReactorClientEventHandler, addReactorClientModuleEventHandler, addReactorHalvesEventHandler, addRemoteDrive, addRenownAdaptersEventHandler, addRenownChainIdEventHandler, addRenownEventHandler, addRenownNetworkIdEventHandler, addRenownUrlEventHandler, addRequiresHardRefreshEventHandler, addResetSelectedNodeEventHandler, addRevisionHistoryVisibleEventHandler, addRouterBasenameEventHandler, addSelectedDriveIdEventHandler, addSelectedNodeIdEventHandler, addSelectedTimelineItemEventHandler, addSelectedTimelineRevisionEventHandler, addSentryDsnEventHandler, addSentryEnvEventHandler, addSentryReleaseEventHandler, addSetSelectedDriveOnPopStateEventHandler, addSetSelectedNodeOnPopStateEventHandler, addStudioModeEventHandler, addSwitchboardUrlEventHandler, addSyncSelectionOnPopStateEventHandler, addToastEventHandler, addVersionCheckIntervalEventHandler, addVersionEventHandler, addVetraPackageManagerEventHandler, addWarnOutdatedAppEventHandler, ambientRenownSigner, ambientRenownTokenProvider, applySearchUpdate, backendAuthStatusOf, baseDocumentModels, baseDocumentModelsMap, bindPHStoreToWindow, browserNavigation, buildDocumentSubgraphQuery, buildDocumentSubgraphUrl, buildFolderZip, callEventHandlerRegisterFunctions, callGlobalSetterForKey, clearGlobal, closePHModal, commonGlobalEventHandlerFunctions, convertRemoteOperations, createAnalyticsStore, createClient, createDelegation, createDispatch, createDriveArrivals, createDriveChangeHandler, createGraphQLDriveNodeSource, createJobChangesSocket, createPHStore, createProcessorQuery, createSwitchboardBackend, createUrlWithPreservedParams, decodeDelegation, deleteDrive, deleteNode, deriveSystemUrl, describeGraphQLDocument, desktopShell, diffStateShapes, dispatchActions, downloadDocument, downloadFolderZip, driveIdFromUrl, dropAllReactorStorage, dropDriveNode, ensurePHEventHandlers, ensurePHStore, expandBulkArchive, exportFile, extractDriveIdFromPath, extractDriveIdFromSlug, extractDriveSlugFromPath, extractNodeIdFromPath, extractNodeIdFromSlug, extractNodeSlugFromPath, fetchDrive, fetchDriveInfo, findDerivedId, findDriveBySlug, findDriveBySlugOrId, findIsServableOverGraphQL, findUuid, getActivePHStore, getAnalyticsStore, getAttachmentClient, getCurrentPathname, getDocumentExtension, getDocumentGraphqlQuery, getDocumentStateSelection, getDocumentUpgradePreview, getDocumentVersionStatus, getDrive, getDriveIdBySlug, getDriveName, getDriveNode, getDrives, getFullReactorClient, getGlobal, getNodeTarget, getPHNavigation, getPHStore, getPHStoreSubscribe, getPackageInfo, getPackagePage, getPackages, getPackagesByDocumentType, getPackagesForDocumentType, getPathWithoutBase, getRevisionFromDate, getSlugFromDriveUrl, getSwitchboardBaseFromChannelUrl, getSwitchboardGatewayUrlFromDriveUrl, getSyncStatus, getSyncStatusSync, getTargetHref, getUserPermissions, globalFetch, graphqlDocumentEvents, graphqlDocumentsEvents, graphqlEventsToSyncDrive, hasHostNavigation, hasPreloadBandwidth, hideRevisionHistory, identifierFromMutateDocumentOperationVariables, initConnectCrypto, initRenownCrypto, initTheme, invalidateDriveNodes, isAuthRefusalClose, isBackendAuthError, isDeadlineError, isDocumentTypeCache, isDocumentTypeSupported, isDriveAuthError, isExternalControlsEnabledEventFunctions, isFileNodeKind, isFolderNodeKind, isGlobalSearchParam, isGraphQLReactorClient, isNodeFetch, isOperationCache, isPlainClick, isRoutedModal, isSettingsTarget, isoStringFromDateTime, listAllDriveNodes, listDriveIds, loadDocumentsOfType, loadDriveNodes, loadFile, loading, login, logout, makeAuthConnectionParams, makeAuthMiddleware, makeDriveSlug, makeDriveUrlComponent, makeNodeSlug, makePHEventFunctions, markLocalDriveWrite, modalFromSearch, modalHref, modalSearch, notifyPHStore, onVetraPackageManager, openRenown, openTarget, openTargetWith, openedFromIndex, packageFromDocumentModels, parseDriveUrl, parseRevisionHistoryPage, peekDriveNode, phAppConfigHooks, phAppConfigSetters, phDocumentEditorConfigHooks, phDocumentEditorConfigSetters, phDocumentFromGetDocument, phDocumentFromMutation, phDocumentFromQuery, phDocumentsFromQuery, phGlobalConfigHooks, phGlobalConfigSetters, prefetchDocument, preloadDrive, preloadDriveApp, preloadEditorModule, preloadNode, preloadTarget, prepareSignedActions, queriesUnknownArgument, queriesUnknownField, reactorGraphqlBatchFetchDocuments, reactorGraphqlCreateDocument, reactorGraphqlDeleteDocument, reactorGraphqlDeleteDocuments, reactorGraphqlFetchDocument, reactorGraphqlMutateDocument, readPromiseState, recordBackendAuthError, recordToSearch, refreshDrive, refreshDriveMembership, refreshReactorData, refreshReactorDataClient, renameDrive, renameDriveNode, resolveDocumentModelModule, resolveDriveRoute, resolveSearchUpdate, resolveUrlPathname, revisionMapFromRevisionsList, searchPackages, searchParamsToString, searchToRecord, setAllowList, setAllowedDocumentTypes, setAnalyticsDatabaseName, setAttachmentService, setBackendAuth, setBasePath, setBrowserOpenSync, setCliVersion, setDefaultDrivesUrl, setDefaultPHGlobalConfig, setDisabledEditors, setDocumentCache, setDriveAvailableOffline, setDriveMetadata, setDriveSharingType, setDrives, setDrivesPreserveStrategy, setEnabledEditors, setFeatures, setFileUploadOperationsChunkSize, setFullReactorClient, setGaTrackingId, setGlobal, setGraphQLReactorClient, setIsAddCloudDrivesEnabled, setIsAddDriveEnabled, setIsAddLocalDrivesEnabled, setIsAddPublicDrivesEnabled, setIsAnalyticsDatabaseWorkerEnabled, setIsAnalyticsEnabled, setIsAnalyticsExternalProcessorsEnabled, setIsCloudDrivesEnabled, setIsDeleteCloudDrivesEnabled, setIsDeleteLocalDrivesEnabled, setIsDeletePublicDrivesEnabled, setIsDiffAnalyticsEnabled, setIsDocumentModelSelectionSettingsEnabled, setIsDragAndDropEnabled, setIsDriveAnalyticsEnabled, setIsEditorDebugModeEnabled, setIsEditorReadModeEnabled, setIsExternalControlsEnabled, setIsExternalPackagesEnabled, setIsExternalProcessorsEnabled, setIsExternalRelationalProcessorsEnabled, setIsLocalDrivesEnabled, setIsPublicDrivesEnabled, setIsRelationalProcessorsEnabled, setIsSentryTracingEnabled, setLoading, setLocalDrivesEnabled, setLogLevel, setPGliteDB, setPHAppConfig, setPHAppConfigByKey, setPHDocumentEditorConfig, setPHDocumentEditorConfigByKey, setPHGlobalConfig, setPHGlobalConfigByKey, setPHModal, setPHToast, setPackageDiscoveryService, setPreferredEditorOnNode, setReactorClient, setReactorClientModule, setRenown, setRenownAdapters, setRenownChainId, setRenownNetworkId, setRenownUrl, setRequiresHardRefresh, setRevisionHistoryPage, setRevisionHistoryVisible, setRouterBasename, setSearchParams, setSelectedDrive, setSelectedDriveId, setSelectedNode, setSelectedNodeId, setSelectedTimelineItem, setSelectedTimelineRevision, setSentryDsn, setSentryEnv, setSentryRelease, setStudioMode, setSwitchboardUrl, setVersion, setVersionCheckInterval, setVetraPackageManager, setWarnOutdatedApp, showCreateDocumentModal, showDeleteNodeModal, showPHModal, showRevisionHistory, signStampedAction, sortNodesByName, stampAction, startDocumentChangesSubscription, subgraphUrlFromGraphqlUrl, subscribePHStore, subscribeToPHValue, subscriptionsUrlFromGraphqlUrl, switchboardFetch, syncSelectionFromPath, takeLocalDriveWrite, targetPathname, toLegacyNode, trackDriveArrival, trimTrailingSlash, truncateAllTables, untilDriveListed, upgradeDocument, useAllowList, useAllowedDocumentModelModules, useAllowedDocumentTypes, useAnalyticsDatabaseName, useAppModuleById, useAppModules, useAttachmentPreview, useAttachmentService, useAttachmentUpload, useAttachments, useBackendAuth, useBasePath, useCanExecute, useCliVersion, useCloseNode, useConnectionState, useConnectionStates, useDatabase, useDefaultAppModule, useDefaultDrivesUrl, useDid, useDisabledEditors, useDispatch, useDocument, useDocumentById, useDocumentCache, useDocumentLinkProps, useDocumentModelModuleById, useDocumentModelModules, useDocumentOfType, useDocumentOperations, useDocumentSafe, useDocumentTarget, useDocumentTypes, useDocumentTypesInSelectedDrive, useDocumentVersionStatus, useDocuments, useDocumentsByIds, useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useDocumentsOfType, useDownloadDocument, useDownloadFolder, useDragNode, useDriveById, useDriveContext, useDriveNode, useDriveNodes, useDriveNodesCache, useDriveSystemInfo, useDrives, useDrivesPreserveStrategy, useDropFile, useDropNode, useEditorDocumentContext, useEditorFileDrop, useEditorModuleById, useEditorModuleFor, useEditorModules, useEditorModulesForDocumentType, useEditorPreloader, useEnabledEditors, useFallbackEditorModule, useFeatures, useFileNodesInSelectedDrive, useFileNodesInSelectedFolder, useFileUploadOperationsChunkSize, useFolderById, useFolderNodesInSelectedDrive, useFolderNodesInSelectedFolder, useGaTrackingId, useGetDocument, useGetDocumentAsync, useGetDocuments, useGetSwitchboardLink, useGraphQLReactorClient, useInitReactorGraphqlClient, useIsAddCloudDrivesEnabled, useIsAddDriveEnabled, useIsAddLocalDrivesEnabled, useIsAddPublicDrivesEnabled, useIsAnalyticsDatabaseWorkerEnabled, useIsAnalyticsEnabled, useIsAnalyticsExternalProcessorsEnabled, useIsCloudDrivesEnabled, useIsDeleteCloudDrivesEnabled, useIsDeleteLocalDrivesEnabled, useIsDeletePublicDrivesEnabled, useIsDiffAnalyticsEnabled, useIsDocumentModelSelectionSettingsEnabled, useIsDragAndDropEnabled, useIsDriveAnalyticsEnabled, useIsEditorDebugModeEnabled, useIsEditorReadModeEnabled, useIsExternalControlsEnabled, useIsExternalPackagesEnabled, useIsExternalProcessorsEnabled, useIsExternalRelationalProcessorsEnabled, useIsLocalDrivesEnabled, useIsPublicDrivesEnabled, useIsRelationalProcessorsEnabled, useIsSentryTracingEnabled, useLinkProps, useLoading, useLocalDrivesEnabled, useLogLevel, useLoginStatus, useModalLinkProps, useModelRegistry, useNodeActions, useNodeById, useNodeParentFolderById, useNodePathById, useNodeTarget, useNodesInSelectedDrive, useNodesInSelectedDriveOrFolder, useNodesInSelectedFolder, useOnDropFile, useOpenNode, usePGlite, usePHAppConfigByKey, usePHDocumentEditorConfigByKey, usePHGlobalConfigByKey, usePHModal, usePHNavigation, usePHStore, usePHToast, usePackageDiscoveryService, useParentFolderForSelectedNode, usePreloadDrive, usePreloadNode, useReactorClient, useReactorClientModule, useReactorHalves, useRelationalDb, useRelationalQuery, useRenown, useRenownAdapters, useRenownAuth, useRenownAuthAsync, useRenownChainId, useRenownInit, useRenownInitialAuth, useRenownInitialUser, useRenownLoginMethods, useRenownNetworkId, useRenownSessionCookie, useRenownSessionSynced, useRenownUrl, useRenownWalletAdapter, useRequiresHardRefresh, useResetPHGlobalConfig, useRevisionHistoryPage, useRevisionHistoryVisible, useRouterBasename, useSearchParams, useSelectedDocument, useSelectedDocumentId, useSelectedDocumentOfType, useSelectedDocumentSafe, useSelectedDrive, useSelectedDriveId, useSelectedDriveSafe, useSelectedFolder, useSelectedNode, useSelectedNodePath, useSelectedTimelineItem, useSelectedTimelineRevision, useSentryDsn, useSentryEnv, useSentryRelease, useSetDefaultPHGlobalConfig, useSetPHAppConfig, useSetPHDocumentEditorConfig, useSetPHGlobalConfig, useSetSearchParams, useSetSelectedDrive, useSetSelectedNode, useStudioMode, useSubgraphModules, useSupportedDocumentTypesInReactor, useSwitchboardClient, useSwitchboardUrl, useSync, useSyncList, useTheme, useUser, useUserPermissions, useVersion, useVersionCheckInterval, useVetraPackageManager, useVetraPackages, useWarnOutdatedApp, validateDocument, viewFilterInputFromViewFilter, waitForArrival, waitForDocumentReady, withRequestDeadline, withStreamedBodies, withoutModalSearch };
|
|
3140
3862
|
|
|
3141
3863
|
//# sourceMappingURL=index.js.map
|