@powerhousedao/reactor-browser 6.2.3-dev.66 → 6.2.3-dev.67
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-CQ3JygJd.d.ts → attachment-service-BHS3EJAr.d.ts} +2 -2
- package/dist/{attachment-service-CQ3JygJd.d.ts.map → attachment-service-BHS3EJAr.d.ts.map} +1 -1
- package/dist/{client-Bwiji4R6.js → client-BFnMV-EO.js} +3 -3
- package/dist/client-BFnMV-EO.js.map +1 -0
- package/dist/{document-model-modules-Wjh92XAb.js → document-model-modules-BwnWiVeC.js} +2 -2
- package/dist/{document-model-modules-Wjh92XAb.js.map → document-model-modules-BwnWiVeC.js.map} +1 -1
- package/dist/{document-operations--Z0AOyyy.js → document-operations-DciiZwkC.js} +94 -25
- package/dist/document-operations-DciiZwkC.js.map +1 -0
- package/dist/{global-CPJA8ePb.d.ts → global-Cgi-GJpN.d.ts} +1 -5
- package/dist/global-Cgi-GJpN.d.ts.map +1 -0
- package/dist/{index-DRCTps7m.d.ts → index-B8MXPz3f.d.ts} +2 -2
- package/dist/{index-DRCTps7m.d.ts.map → index-B8MXPz3f.d.ts.map} +1 -1
- package/dist/index.d.ts +42 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +57 -7
- package/dist/index.js.map +1 -1
- package/dist/{navigation-B4fHR-Tm.js → navigation-BUPIObES.js} +7 -3
- package/dist/navigation-BUPIObES.js.map +1 -0
- package/dist/{renown-DlkS61Dp.js → renown-Dem71OWZ.js} +2 -2
- package/dist/{renown-DlkS61Dp.js.map → renown-Dem71OWZ.js.map} +1 -1
- package/dist/src/ai/index.js +2 -2
- package/dist/src/graphql-client/entry.d.ts +2 -2
- package/dist/src/graphql-client/entry.js +2 -2
- package/dist/src/renown/index.d.ts +1 -1
- package/dist/src/renown/index.js +1 -1
- package/dist/src/rpc/index.js +1 -1
- package/dist/{switchboard-DAvOdf_g.js → switchboard-CiYrfAcM.js} +2 -2
- package/dist/{switchboard-DAvOdf_g.js.map → switchboard-CiYrfAcM.js.map} +1 -1
- package/package.json +9 -9
- package/dist/client-Bwiji4R6.js.map +0 -1
- package/dist/document-operations--Z0AOyyy.js.map +0 -1
- package/dist/global-CPJA8ePb.d.ts.map +0 -1
- package/dist/navigation-B4fHR-Tm.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as IPackageManager, E as IPackageListerUnsubscribe, O as IPackagesListener, _ as SetPHGlobalValue$1, _t as OperationsCacheEntry, dt as IReactorBrowserClient$1, gt as IOperationCache, ht as IDocumentCache, k as PackageManagerInstallResult, o as PHGlobal$1, pt as DocumentRefetchState, vt as PromiseState, y as UsePHGlobalValue$1, yt as PromiseWithState } from "./global-
|
|
1
|
+
import { D as IPackageManager, E as IPackageListerUnsubscribe, O as IPackagesListener, _ as SetPHGlobalValue$1, _t as OperationsCacheEntry, dt as IReactorBrowserClient$1, gt as IOperationCache, ht as IDocumentCache, k as PackageManagerInstallResult, o as PHGlobal$1, pt as DocumentRefetchState, vt as PromiseState, y as UsePHGlobalValue$1, yt as PromiseWithState } from "./global-Cgi-GJpN.js";
|
|
2
2
|
import { t as PGlite } from "./pglite-CntadC_p-DTkdF8sr.js";
|
|
3
3
|
import { A as ViewFilterInput, C as GetDocumentQuery, D as PropagationMode$1, E as PhDocumentFieldsFragment, O as Scalars, S as GetDocumentOperationsQuery, b as DocumentChangesSubscription, c as ReactorGraphQLClient, g as ActionInput, k as SdkFunctionWrapper } from "./types-0Fh1tNjy.js";
|
|
4
4
|
import { ReactNode } from "react";
|
|
@@ -1392,4 +1392,4 @@ declare const addAttachmentServiceEventHandler: AddPHGlobalEventHandler;
|
|
|
1392
1392
|
//#endregion
|
|
1393
1393
|
export { GraphQLReactorProvider as $, useDocumentCache as A, DocumentChangeListener as At, makeAuthConnectionParams as B, RemoteDocumentChangeEvent as Bt, useReactorClient as C, RevisionsListSelection as Ct, addDocumentCacheEventHandler as D, revisionMapFromRevisionsList as Dt, useSyncList as E, phDocumentFromMutation as Et, useGetDocuments as F, IRemoteController as Ft, resolveDocumentModelModule as G, TrackedAction as Gt, subscriptionsUrlFromGraphqlUrl as H, RemoteOperation as Ht, ConnectionParams as I, MergeHandler as It, stampAction as J, addPromiseState as Jt, prepareSignedActions as K, DocumentCache as Kt, DocumentChangesEventPayload as L, PushResult as Lt, useDocuments as M, GetDocumentWithOperationsResult as Mt, useGetDocument as N, GetOperationsResult as Nt, setDocumentCache as O, ConflictInfo as Ot, useGetDocumentAsync as P, IRemoteClient as Pt, ReactorOperationFieldsFragmentDoc as Q, DocumentChangesSubscriptionOptions as R, RemoteControllerGraphQLClient as Rt, usePGlite as S, GetDocumentQueryResult as St, useSync as T, phDocumentFromGetDocument as Tt, StaticPackageManager as U, RemoteOperationResultPage as Ut, startDocumentChangesSubscription as V, RemoteDocumentData as Vt, packageFromDocumentModels as W, SyncStatus$1 as Wt, MutateDocumentWithOperationsResult as X, readPromiseState as Xt, MutateDocumentWithOperationsDocument as Y, isOperationCache as Yt, MutateDocumentWithOperationsVariables as Z, IDLE_REFETCH_STATE as Zt, setFullReactorClient as _, GraphQLWrongBackendError as _t, DocumentOperationsState as a, GraphQLReactorClientOptions as at, useDatabase as b, makeAuthMiddleware as bt, useDocumentModelModuleById as c, viewFilterInputFromViewFilter as ct, UseDispatchResult as d, SubgraphSdkRegistry as dt, GraphQLReactorProviderProps as et, useDispatch as f, TypedGraphQLDocument as ft, getFullReactorClient as g, GraphQLOperationNotSupportedError as gt, addReactorClientModuleEventHandler as h, BatchJobFailedError as ht, DocumentOperationsResult as i, GraphQLReactorClient as it, useDocumentSafe as j, GetDocumentResult as jt, useDocument as k, ConflictStrategy as kt, useDocumentModelModules as l, GraphQLRequestOptions as lt, addReactorClientEventHandler as m, subgraphUrlFromGraphqlUrl as mt, setAttachmentService as n, useSwitchboardClient as nt, UseDocumentOperationsOptions as o, findIsServableOverGraphQL as ot, addFullReactorClientEventHandler as p, describeGraphQLDocument as pt, signStampedAction as q, IDLE_OPERATIONS_ENTRY as qt, useAttachmentService as r, DriveIdCall as rt, useDocumentOperations as s, isGraphQLReactorClient as st, addAttachmentServiceEventHandler as t, ensurePHEventHandlers as tt, DispatchFn as u, SubgraphSdkFactory as ut, setReactorClient as v, BearerTokenProvider as vt, useReactorClientModule as w, isoStringFromDateTime as wt, useModelRegistry as x, GetDocumentQueryFields as xt, setReactorClientModule as y, ambientRenownTokenProvider as yt, isAuthRefusalClose as z, RemoteControllerOptions as zt };
|
|
1394
1394
|
export {};
|
|
1395
|
-
//# sourceMappingURL=attachment-service-
|
|
1395
|
+
//# sourceMappingURL=attachment-service-BHS3EJAr.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-service-
|
|
1
|
+
{"version":3,"file":"attachment-service-BHS3EJAr.d.ts","names":[],"sources":["../src/document-refetcher.ts","../src/document-cache.ts","../src/remote-controller/types.ts","../src/graphql-client/adapter.ts","../src/graphql-client/auth.ts","../src/graphql-client/errors.ts","../src/graphql-client/subgraph.ts","../src/graphql-client/graphql-reactor-client.ts","../src/graphql-client/graphql-reactor-provider.tsx","../src/graphql-client/operations.ts","../src/graphql-client/signing.ts","../src/graphql-client/static-package-manager.ts","../src/graphql-client/subscriptions.ts","../src/hooks/document-cache.ts","../src/hooks/reactor.ts","../src/hooks/dispatch.ts","../src/hooks/document-model-modules.ts","../src/hooks/document-operations.ts","../src/hooks/attachment-service.ts"],"mappings":";;;;;;;;;;;;;;;cASa,oBAAoB;;;iBCUjB,gBAAgB,GAAG,SAAS,QAAQ,KAAK,iBAAiB;iBAwB1D,iBAAiB,GAC/B,SAAS,QAAQ,KAAK,iBAAiB,KACtC,aAAa;;cA4BH,uBAAuB;;iBAQpB,iBAAiB,iBAAiB,SAAS;;;;;;;;;cAiD9C,yBAAyB,gBAAgB;UAuChC;UAtCZ;UACA;UAIA;UAEA;;;;;;;;UAkBA;;UAGA;;UAKA;UACA;UAEA;EAER,YAAoB,Q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mCAAgC;;;;;;iBAsB7C,mBAAc,eAIf,QAAA;;;;;;iBAeC,oBAAe,kBAIb,QAAA;;;;;;;;;;;;;;iBAuBF,oBAAoB;WAItB;;;;;;;;WA1ME;;;;;;;;WAOA;;;;;;;;WAOA;;;;;;;;;;;cC3BH,wBAAwB,iBACnC,6BAA6B;;cAIlB,wBAAwB,iBACnC,6BAA6B;;cAIlB,oCAAoC;;cAIpC,kBAAkB,iBAAiB;;cAInC,kBAAkB,iBAAiB;;cAInC,8BAA8B;;cAI9B,sBAAsB,iBAAiB;;cAIvC,kCAAkC;;iBAI/B,wBAAwB;cAQ3B,eAAc;cAGd,oDAAW;cAKX,wBAAuB;cAGvB,mBAAkB,OAAO;cAOzB,iBAAgB;;;;;;;;;KC7EjB,WAAW,YACrB,iBAAiB,YAAY,qBAC7B,YAAY,QAAQ,kBACpB,aAAa,QAAQ;KAGX,kBAAkB,WAAW,qBACvC,uBACA,WAAW;iBAGG,YAAY,YAAY,cAAY,UAAU,UAC5D,UAAU,wBACT,kBAAkB,WAAW;;;iBCpBhB,2BAA2B;;;;;;;;;iBAuB3B,2BACd,+BACA,mBACC;;;KCvBS;;;;;;EAMV;;EAEA;;;KAIU;;EAEV,qBAAqB;;EAErB;;EAEA,OAAO;;EAEP;;EAEA;;EAEA;;;;;;KAaU;EACV,kBAAkB;EAClB,iBAAiB;EACjB;EACA,OAAO;EACP;;;iBAsFc,sBACd,wCACC;;;;;;;;;;;;;;;;;iBAiBa,sBACd,uCACA,eACA,UAAU,+BACT;;;;cCjJU,sBAAsB,iBAAiB;;cAIvC,sBAAsB,iBAAiB;;cAIvC,kCAAkC"}
|
|
@@ -47,8 +47,8 @@ async function getPackagePage(registryUrl, params) {
|
|
|
47
47
|
return await getJson(`${trimTrailingSlash(registryUrl)}/packages?${query.toString()}`);
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
* Full package info for every package exposing a given document type
|
|
51
|
-
*
|
|
50
|
+
* Full package info for every package exposing a given document type, to offer
|
|
51
|
+
* installs without loading the whole listing.
|
|
52
52
|
*/
|
|
53
53
|
async function getPackagesForDocumentType(registryUrl, documentType) {
|
|
54
54
|
return queryAllPackages(registryUrl, { documentType });
|
|
@@ -104,4 +104,4 @@ var RegistryClient = class {
|
|
|
104
104
|
//#endregion
|
|
105
105
|
export { getPackagesByDocumentType as a, trimTrailingSlash as c, getPackages as i, SYNC_REMOTES_CHANGED_EVENT as l, getPackageInfo as n, getPackagesForDocumentType as o, getPackagePage as r, searchPackages as s, RegistryClient as t, SYNC_STATUS_CHANGED_EVENT as u };
|
|
106
106
|
|
|
107
|
-
//# sourceMappingURL=client-
|
|
107
|
+
//# sourceMappingURL=client-BFnMV-EO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-BFnMV-EO.js","names":[],"sources":["../src/rpc/bus-event-ids.ts","../src/registry/fetchers.ts","../src/registry/client.ts"],"sourcesContent":["// Dependency-free, so the root entry can listen without the RPC graph.\n\n// Synthetic bus channel id for sync-status deltas (not a reactor IEventBus type).\nexport const SYNC_STATUS_CHANGED_EVENT = 90001;\n// Carries the worker's remotes after a local peer is adopted or removed.\nexport const SYNC_REMOTES_CHANGED_EVENT = 90002;\n","import type { PackageInfo, PackagePage } from \"@powerhousedao/shared/registry\";\n\n// Strip a trailing \"/\" so we don't emit `http://host//packages` when a user\n// writes `packageRegistryUrl: \"http://host/\"`. Verdaccio's own web backend\n// 404s on the doubled slash, which cascades into an empty registry list and\n// masks the real install flow.\nexport function trimTrailingSlash(url: string): string {\n return url.endsWith(\"/\") ? url.slice(0, -1) : url;\n}\n\n// The registry's largest page; the cap bounds a registry that never ends\nconst PAGE_SIZE = 50;\nconst MAX_PAGES = 200;\n\nasync function getJson(url: string): Promise<unknown> {\n const res = await fetch(url);\n if (!res.ok) throw new Error(`Registry error: HTTP ${res.status}`);\n return res.json();\n}\n\n// Every package matching `query`, in full detail, paged `PAGE_SIZE` at a time.\nasync function queryAllPackages(\n registryUrl: string,\n query: Record<string, string>,\n): Promise<PackageInfo[]> {\n const packages: PackageInfo[] = [];\n for (let n = 0; n < MAX_PAGES; n++) {\n const params = new URLSearchParams({\n ...query,\n detail: \"full\",\n limit: String(PAGE_SIZE),\n offset: String(packages.length),\n });\n const page = (await getJson(\n `${trimTrailingSlash(registryUrl)}/packages?${params.toString()}`,\n )) as PackagePage<PackageInfo>;\n packages.push(...page.items);\n if (!page.hasMore || page.items.length === 0) break;\n }\n return packages;\n}\n\nexport async function getPackages(registryUrl: string) {\n return queryAllPackages(registryUrl, {});\n}\n\n// Packages whose name, description, publisher or module names match `search`.\nexport async function searchPackages(\n registryUrl: string,\n search: string,\n): Promise<PackageInfo[]> {\n return queryAllPackages(registryUrl, { search });\n}\n\n/**\n * One page of the registry listing (trimmed items). Used by the Package\n * Manager's Available tab for infinite scroll + server-side search.\n */\nexport async function getPackagePage(\n registryUrl: string,\n params: { limit: number; offset: number; search?: string },\n): Promise<PackagePage> {\n const query = new URLSearchParams({\n limit: String(params.limit),\n offset: String(params.offset),\n });\n if (params.search) query.set(\"search\", params.search);\n return (await getJson(\n `${trimTrailingSlash(registryUrl)}/packages?${query.toString()}`,\n )) as PackagePage;\n}\n\n/**\n * Full package info for every package exposing a given document type, to offer\n * installs without loading the whole listing.\n */\nexport async function getPackagesForDocumentType(\n registryUrl: string,\n documentType: string,\n): Promise<PackageInfo[]> {\n return queryAllPackages(registryUrl, { documentType });\n}\n\nexport async function getPackagesByDocumentType(\n registryUrl: string,\n documentType: string,\n): Promise<string[]> {\n const encodedType = encodeURIComponent(documentType);\n const res = await fetch(\n `${trimTrailingSlash(registryUrl)}/packages/by-document-type?type=${encodedType}`,\n );\n if (!res.ok) throw new Error(`Registry error: HTTP ${res.status}`);\n return (await res.json()) as string[];\n}\n\n/**\n * Fetch full metadata (versions + dist-tags) for one package from the\n * single-package endpoint. Returns null when the package no longer exists\n * upstream.\n */\nexport async function getPackageInfo(\n registryUrl: string,\n name: string,\n): Promise<PackageInfo | null> {\n const encodedName = encodeURIComponent(name);\n const res = await fetch(\n `${trimTrailingSlash(registryUrl)}/packages/${encodedName}`,\n );\n if (res.status === 404) return null;\n if (!res.ok) throw new Error(`Registry error: HTTP ${res.status}`);\n return (await res.json()) as PackageInfo;\n}\n","import type { PackageInfo } from \"@powerhousedao/shared/registry\";\nimport {\n getPackages,\n getPackagesByDocumentType,\n searchPackages,\n} from \"./fetchers.js\";\nimport type { PublishEvent } from \"./types.js\";\n\nfunction cdnUrlToApiUrl(cdnUrl: string): string {\n return cdnUrl.replace(/\\/-\\/cdn\\/?$/, \"\");\n}\nexport class RegistryClient {\n readonly apiUrl: string;\n\n constructor(cdnUrl: string) {\n this.apiUrl = cdnUrlToApiUrl(cdnUrl);\n }\n\n async getPackages(): Promise<PackageInfo[]> {\n const data = await getPackages(this.apiUrl);\n return data;\n }\n\n async getPackagesByDocumentType(documentType: string): Promise<string[]> {\n return await getPackagesByDocumentType(this.apiUrl, documentType);\n }\n\n async searchPackages(query: string): Promise<PackageInfo[]> {\n if (!query) return this.getPackages();\n return await searchPackages(this.apiUrl, query);\n }\n\n onPublish(callback: (event: PublishEvent) => void): () => void {\n const eventSource = new EventSource(`${this.apiUrl}/-/events`);\n\n eventSource.addEventListener(\"publish\", (e: MessageEvent<string>) => {\n const data = JSON.parse(e.data) as PublishEvent;\n callback(data);\n });\n\n return () => {\n eventSource.close();\n };\n }\n}\n"],"mappings":";AAGA,MAAa,4BAA4B;AAEzC,MAAa,6BAA6B;;;ACC1C,SAAgB,kBAAkB,KAAqB;CACrD,OAAO,IAAI,SAAS,GAAG,IAAI,IAAI,MAAM,GAAG,EAAE,IAAI;AAChD;AAGA,MAAM,YAAY;AAClB,MAAM,YAAY;AAElB,eAAe,QAAQ,KAA+B;CACpD,MAAM,MAAM,MAAM,MAAM,GAAG;CAC3B,IAAI,CAAC,IAAI,IAAI,MAAM,IAAI,MAAM,wBAAwB,IAAI,QAAQ;CACjE,OAAO,IAAI,KAAK;AAClB;AAGA,e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B,IAAI;CAC3C,MAAM,MAAM,MAAM,MAChB,GAAG,kBAAkB,WAAW,EAAE,YAAY,aAChD;CACA,IAAI,IAAI,WAAW,KAAK,OAAO;CAC/B,IAAI,CAAC,IAAI,IAAI,MAAM,IAAI,MAAM,wBAAwB,IAAI,QAAQ;CACjE,OAAQ,MAAM,IAAI,KAAK;AACzB;;;ACvGA,SAAS,eAAe,QAAwB;CAC9C,OAAO,OAAO,QAAQ,gBAAgB,EAAE;AAC1C;AACA,IAAa,iBAAb,MAA4B;CAC1B;CAEA,YAAY,QAAgB;EAC1B,KAAK,SAAS,eAAe,MAAM;CACrC;CAEA,MAAM,cAAsC;EAE1C,OAAO,MADY,YAAY,KAAK,MAAM;CAE5C;CAEA,MAAM,0BAA0B,cAAyC;EACvE,OAAO,MAAM,0BAA0B,KAAK,QAAQ,YAAY;CAClE;CAEA,MAAM,eAAe,OAAuC;EAC1D,IAAI,CAAC,OAAO,OAAO,KAAK,YAAY;EACpC,OAAO,MAAM,eAAe,KAAK,QAAQ,KAAK;CAChD;CAEA,UAAU,UAAqD;EAC7D,MAAM,cAAc,IAAI,YAAY,GAAG,KAAK,OAAO,UAAU;EAE7D,YAAY,iBAAiB,YAAY,MAA4B;GAEnE,SADa,KAAK,MAAM,EAAE,IACd,CAAC;EACf,CAAC;EAED,aAAa;GACX,YAAY,MAAM;EACpB;CACF;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { f as isScopedPHStore, g as warnGlobalSetterInScope, h as usePHStore, n as subscribeToPHValue, t as makePHEventFunctions, u as getPHStore } from "./make-ph-event-functions-C1JTfEw1.js";
|
|
2
2
|
import { _ as isDuplicateManifestError, t as useDispatch, v as isDuplicateModuleError } from "./dispatch-BmdzdTwb.js";
|
|
3
|
-
import {
|
|
3
|
+
import { L as makeDriveSlug, M as extractNodeSlugFromPath, P as findDriveBySlug, c as getCurrentPathname, f as hasHostNavigation, g as openTargetWith, h as openTarget, j as extractNodeIdFromSlug, k as extractDriveSlugFromPath, v as preloadTarget, z as makeNodeSlug } from "./navigation-BUPIObES.js";
|
|
4
4
|
import { useCallback, useSyncExternalStore } from "react";
|
|
5
5
|
//#region src/graphql-client/auth.ts
|
|
6
6
|
/** Lifetime requested for an ambient Renown token, in seconds. */
|
|
@@ -443,4 +443,4 @@ function useDocumentModelModuleById(id, version) {
|
|
|
443
443
|
//#endregion
|
|
444
444
|
export { useSetSelectedNode as A, ambientRenownTokenProvider as B, selectNode as C, useOpenNode as D, setSelectedNodeId as E, listSyncRemotes as F, DocumentModelNotFoundError as I, DocumentTypeMismatchError as L, setDrives as M, useDrives as N, usePreloadNode as O, isInitialSyncInFlight as P, NoSelectedDocumentError as R, preloadNode as S, setSelectedNode as T, makeAuthMiddleware as V, useSetSelectedDrive as _, setVetraPackageManager as a, getNodeTarget as b, addSelectedDriveIdEventHandler as c, setSelectedDrive as d, setSelectedDriveId as f, useSelectedDriveSafe as g, useSelectedDriveId as h, onVetraPackageManager as i, addDrivesEventHandler as j, useSelectedNodeId as k, preloadDrive as l, useSelectedDrive as m, useDocumentModelModules as n, useVetraPackageManager as o, usePreloadDrive as p, addVetraPackageManagerEventHandler as r, useVetraPackages as s, useDocumentModelModuleById as t, selectDrive as u, addResetSelectedNodeEventHandler as v, selectNodeIn as w, getNodeTargetIn as x, addSelectedNodeIdEventHandler as y, UnsupportedDocumentTypeError as z };
|
|
445
445
|
|
|
446
|
-
//# sourceMappingURL=document-model-modules-
|
|
446
|
+
//# sourceMappingURL=document-model-modules-BwnWiVeC.js.map
|
package/dist/{document-model-modules-Wjh92XAb.js.map → document-model-modules-BwnWiVeC.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-model-modules-Wjh92XAb.js","names":[],"sources":["../src/graphql-client/auth.ts","../src/errors.ts","../src/routing/initial-sync.ts","../src/hooks/drives.ts","../src/hooks/set-selected-node.ts","../src/hooks/selected-drive.ts","../src/hooks/vetra-packages.ts","../src/hooks/document-model-modules.ts"],"sourcesContent":["import { getPHStore } from \"../hooks/ph-store.js\";\nimport type { SdkFunctionWrapper } from \"../graphql/gen/schema.js\";\n\n/**\n * Resolves the bearer token to send with a request.\n *\n * Returning `undefined` (or an empty string) means \"send this request\n * anonymously\": open Switchboards must keep serving reads to logged-out users.\n */\nexport type BearerTokenProvider = () => Promise<string | undefined>;\n\n/** Lifetime requested for an ambient Renown token, in seconds. */\nconst ambientTokenExpiresInSeconds = 600;\n\n/**\n * The default token provider: the token of the currently logged-in Renown user.\n *\n * It is deliberately resolved from `window.ph` on every call rather than\n * captured at construction time, so a client built before login starts sending\n * the token as soon as there is one.\n *\n * The token is requested WITHOUT an `aud` claim - the Switchboard verifier\n * rejects tokens that carry an audience.\n */\nexport async function ambientRenownTokenProvider(): Promise<\n string | undefined\n> {\n if (typeof window === \"undefined\") {\n return undefined;\n }\n\n const renown = getPHStore()?.renown;\n if (!renown?.user) {\n return undefined;\n }\n\n return renown.getBearerToken({ expiresIn: ambientTokenExpiresInSeconds });\n}\n\n/**\n * Builds the SDK middleware that authenticates every request.\n *\n * The token is resolved per request and never cached, so a login, a logout or\n * an expiry between two calls is picked up by the next one. When no token is\n * available the request goes out unauthenticated.\n */\nexport function makeAuthMiddleware(\n tokenProvider: BearerTokenProvider,\n): SdkFunctionWrapper {\n return async (action) => {\n const token = await tokenProvider();\n if (!token) {\n return action();\n }\n\n return action({ authorization: `Bearer ${token}` });\n };\n}\n","export class UnsupportedDocumentTypeError extends Error {\n constructor(documentType: string) {\n super(`Document type ${documentType} is not supported`);\n this.name = \"UnsupportedDocumentTypeError\";\n }\n\n static isError(error: unknown): error is UnsupportedDocumentTypeError {\n return (\n Error.isError(error) && error.name === \"UnsupportedDocumentTypeError\"\n );\n }\n}\n\nexport class DocumentModelNotFoundError extends Error {\n readonly documentType: string;\n readonly name = \"DocumentModelNotFoundError\";\n\n constructor(documentType: string) {\n super(`Document model module for type ${documentType} not found`);\n this.documentType = documentType;\n }\n\n static isError(error: unknown): error is DocumentModelNotFoundError {\n return Error.isError(error) && error.name === \"DocumentModelNotFoundError\";\n }\n}\n\nexport class DocumentTypeMismatchError extends Error {\n constructor(documentId: string, expectedType: string, actualType: string) {\n super(\n `Document ${documentId} is not of type ${expectedType}. Actual type: ${actualType}`,\n );\n }\n}\n\nexport class NoSelectedDocumentError extends Error {\n constructor() {\n super(\n \"There is no selected document. Did you mean to call 'useSelectedDocumentSafe' instead?\",\n );\n }\n}\n","import type { Remote } from \"@powerhousedao/reactor\";\nimport type { PHStore } from \"../hooks/ph-store.js\";\n\n/** The store's sync remotes; none before the reactor is ready. */\nexport function listSyncRemotes(store: PHStore | undefined): Remote[] {\n try {\n return (\n store?.reactorClientModule?.reactorModule?.syncModule?.syncManager?.list() ??\n []\n );\n } catch {\n return [];\n }\n}\n\n// Only a first pull in flight may still bring drives. A connected remote that\n// never polled is paused or answer-only; one failed or failing to reconnect won't soon.\nfunction isFirstPullInFlight(remote: Remote) {\n try {\n const { state, receivingPages, lastSuccessUtcMs, failureCount } =\n remote.channel.getConnectionState();\n if (state === \"connected\") return receivingPages;\n if (state === \"reconnecting\") return !lastSuccessUtcMs && !failureCount;\n return state === \"connecting\" && (receivingPages || !lastSuccessUtcMs);\n } catch {\n return false;\n }\n}\n\n/** Whether a remote, or one syncing `driveId` when given, is in its first pull. */\nexport function isInitialSyncInFlight(\n store: PHStore | undefined,\n driveId?: string,\n) {\n return listSyncRemotes(store).some(\n (remote) =>\n (driveId === undefined || remote.meta.collectionId.driveId === driveId) &&\n isFirstPullInFlight(remote),\n );\n}\n","import type { DocumentDriveDocument } from \"@powerhousedao/shared/document-drive\";\nimport type { SetPHGlobalValue, UsePHGlobalValue } from \"../types/global.js\";\nimport { makePHEventFunctions } from \"./make-ph-event-functions.js\";\n\nconst drivesEventFunctions = makePHEventFunctions(\"drives\");\n\n/** Returns all of the drives in the reactor */\nexport const useDrives: UsePHGlobalValue<DocumentDriveDocument[]> =\n drivesEventFunctions.useValue;\n\n/** Sets the drives in the reactor */\nexport const setDrives: SetPHGlobalValue<DocumentDriveDocument[]> =\n drivesEventFunctions.setValue;\n\n/** Adds an event handler for the drives */\nexport const addDrivesEventHandler = drivesEventFunctions.addEventHandler;\n","import type {\n PHNavigateOptions,\n PHNavigationTarget,\n} from \"@powerhousedao/reactor-browser\";\nimport type { Node } from \"@powerhousedao/shared/document-drive\";\nimport {\n extractDriveSlugFromPath,\n extractNodeIdFromSlug,\n makeDriveSlug,\n makeNodeSlug,\n} from \"../utils/url.js\";\nimport {\n makePHEventFunctions,\n subscribeToPHValue,\n} from \"./make-ph-event-functions.js\";\nimport { useCallback } from \"react\";\nimport {\n getCurrentPathname,\n hasHostNavigation,\n openTarget,\n openTargetWith,\n preloadTarget,\n} from \"./navigation.js\";\nimport type { PHStore } from \"./ph-store.js\";\nimport {\n getPHStore,\n isScopedPHStore,\n usePHStore,\n warnGlobalSetterInScope,\n} from \"./ph-store.js\";\n\nconst selectedNodeIdEventFunctions = makePHEventFunctions(\"selectedNodeId\");\nexport const useSelectedNodeId = selectedNodeIdEventFunctions.useValue;\n/** Sets the selected node id without touching the URL. */\nexport const setSelectedNodeId = selectedNodeIdEventFunctions.setValue;\n/** @deprecated `ph:setSelectedNodeId` bypasses the URL; use `setSelectedNode`. */\nexport const addSelectedNodeIdEventHandler =\n selectedNodeIdEventFunctions.addEventHandler;\n\nfunction decodeSlug(slug: string) {\n try {\n return decodeURIComponent(slug);\n } catch {\n return slug;\n }\n}\n\n// The selected drive's slug, else the path's: a pending navigation's path\n// already names its destination, not the drive still shown.\nfunction openDriveSlug(store: PHStore | undefined, pathname: string) {\n const selected = store?.drives?.find(\n (d) => d.header.id === store.selectedDriveId,\n );\n if (selected) return makeDriveSlug(selected);\n const driveSlug = extractDriveSlugFromPath(pathname);\n return driveSlug ? decodeSlug(driveSlug) : undefined;\n}\n\n// The node in the app's open drive.\nfunction nodeTarget(nodeSlug: string): PHNavigationTarget | undefined {\n const driveSlug = openDriveSlug(getPHStore(), getCurrentPathname());\n if (!driveSlug) return undefined;\n return { driveSlug, nodeSlug: nodeSlug || undefined };\n}\n\ntype NodeRef = Node | string | undefined;\n\nconst toSlug = (node: NodeRef) =>\n typeof node === \"string\" ? node : makeNodeSlug(node);\n\n// The node in a scope's open drive.\nfunction scopedNodeTarget(store: PHStore, nodeSlug: string) {\n const pathname = store.navigation?.location().pathname ?? \"\";\n const driveSlug = openDriveSlug(store, pathname);\n if (!driveSlug) return undefined;\n return { driveSlug, nodeSlug: nodeSlug || undefined };\n}\n\n/** Selects a node in the app's store, without the scope warning. */\nexport function selectNode(node: NodeRef, options?: PHNavigateOptions) {\n const nodeSlug = toSlug(node);\n // A host router resolves the node and writes the selection itself.\n if (!hasHostNavigation()) {\n setSelectedNodeId(extractNodeIdFromSlug(nodeSlug));\n }\n const target = nodeTarget(nodeSlug);\n if (target) openTarget(target, options);\n}\n\n/** Selects a node in `store`: a scope's own selection, else the app's. */\nexport function selectNodeIn(\n store: PHStore | undefined,\n node: NodeRef,\n options?: PHNavigateOptions,\n) {\n if (!store || !isScopedPHStore(store)) {\n selectNode(node, options);\n return;\n }\n const nodeSlug = toSlug(node);\n const navigation = store.navigation;\n if (!navigation) {\n store.selectedNodeId =\n typeof node === \"object\" ? node.id : extractNodeIdFromSlug(nodeSlug);\n return;\n }\n const target = scopedNodeTarget(store, nodeSlug);\n if (target) openTargetWith(navigation, target, options);\n}\n\n/** Sets the selected node (file or folder) of the app's store; `search` sets\n * the params it opens with. Inside a scoped store, use `useSetSelectedNode`. */\nexport function setSelectedNode(node: NodeRef, options?: PHNavigateOptions) {\n warnGlobalSetterInScope(\"setSelectedNode\", \"useSetSelectedNode\");\n selectNode(node, options);\n}\n\n/** `setSelectedNode` for the store in context, e.g. a scoped editor's. */\nexport function useSetSelectedNode() {\n const store = usePHStore();\n return useCallback(\n (node: NodeRef, options?: PHNavigateOptions) =>\n selectNodeIn(store, node, options),\n [store],\n );\n}\n\n/** Opens a node, or with `undefined` its drive, in the store in context. */\nexport const useOpenNode: () => (\n node: Node | undefined,\n options?: PHNavigateOptions,\n) => void = useSetSelectedNode;\n\n/** Where a node of `store`'s open drive navigates to. */\nexport function getNodeTargetIn(store: PHStore | undefined, node: Node) {\n const nodeSlug = makeNodeSlug(node);\n return store && isScopedPHStore(store)\n ? scopedNodeTarget(store, nodeSlug)\n : nodeTarget(nodeSlug);\n}\n\n/** Where a node of the open drive navigates to. */\nexport function getNodeTarget(node: Node | undefined) {\n return nodeTarget(makeNodeSlug(node));\n}\n\nfunction preloadNodeIn(store: PHStore | undefined, node: Node | undefined) {\n if (!node) return;\n if (!store || !isScopedPHStore(store)) {\n const target = nodeTarget(makeNodeSlug(node));\n if (target) preloadTarget(target);\n return;\n }\n const target = scopedNodeTarget(store, makeNodeSlug(node));\n if (target) store.navigation?.preload?.(target);\n}\n\n/** Warms a node's view before it is opened, e.g. on hover. */\nexport function preloadNode(node: Node | undefined) {\n warnGlobalSetterInScope(\"preloadNode\", \"usePreloadNode\");\n preloadNodeIn(undefined, node);\n}\n\n/** `preloadNode` for the store in context. */\nexport function usePreloadNode() {\n const store = usePHStore();\n return useCallback(\n (node: Node | undefined) => preloadNodeIn(store, node),\n [store],\n );\n}\n\nexport function addResetSelectedNodeEventHandler() {\n subscribeToPHValue(\"selectedDriveId\", () => {\n setSelectedNodeId(undefined);\n });\n}\n","import type { PHStore } from \"./ph-store.js\";\nimport {\n getPHStore,\n isScopedPHStore,\n usePHStore,\n warnGlobalSetterInScope,\n} from \"./ph-store.js\";\nimport { useCallback } from \"react\";\nimport type { DocumentDispatch } from \"@powerhousedao/reactor-browser\";\nimport type {\n DocumentDriveAction,\n DocumentDriveDocument,\n} from \"@powerhousedao/shared/document-drive\";\nimport {\n extractDriveSlugFromPath,\n extractNodeSlugFromPath,\n findDriveBySlug,\n makeDriveSlug,\n} from \"../utils/url.js\";\nimport { isInitialSyncInFlight } from \"../routing/initial-sync.js\";\nimport { useDispatch } from \"./dispatch.js\";\nimport { useDrives } from \"./drives.js\";\nimport {\n makePHEventFunctions,\n subscribeToPHValue,\n} from \"./make-ph-event-functions.js\";\nimport {\n getCurrentPathname,\n hasHostNavigation,\n openTarget,\n openTargetWith,\n preloadTarget,\n} from \"./navigation.js\";\nimport { selectNode } from \"./set-selected-node.js\";\n\nconst selectedDriveIdEventFunctions = makePHEventFunctions(\"selectedDriveId\");\n\n/** Returns the selected drive id */\nexport const useSelectedDriveId = selectedDriveIdEventFunctions.useValue;\n\n/** Sets the selected drive id */\nexport const setSelectedDriveId = selectedDriveIdEventFunctions.setValue;\n\n/** Adds an event handler for the selected drive id\n * @deprecated `ph:setSelectedDriveId` bypasses the URL; use `setSelectedDrive`. */\nexport const addSelectedDriveIdEventHandler =\n selectedDriveIdEventFunctions.addEventHandler;\n\n/** Returns the selected drive */\nexport function useSelectedDrive() {\n const drive = useSelectedDriveSafe();\n if (!drive[0]) {\n throw new Error(\n \"There is no drive selected. Did you mean to call 'useSelectedDriveSafe'?\",\n );\n }\n\n return drive;\n}\n\n/** Returns the selected drive, or undefined if no drive is selected */\nexport function useSelectedDriveSafe() {\n const selectedDriveId = useSelectedDriveId();\n const drives = useDrives();\n const selectedDrive = drives?.find(\n (drive) => drive.header.id === selectedDriveId,\n );\n\n const [drive, dispatch] = useDispatch(selectedDrive);\n if (!selectedDrive) {\n return [undefined, undefined] as const;\n }\n return [drive, dispatch] as [\n DocumentDriveDocument,\n DocumentDispatch<DocumentDriveAction>,\n ];\n}\n\ntype DriveRef = string | DocumentDriveDocument | undefined;\n\n/** Selects a drive in the app's store; inside a scoped store, use\n * `useSetSelectedDrive`. */\nexport function setSelectedDrive(driveOrDriveSlug: DriveRef) {\n warnGlobalSetterInScope(\"setSelectedDrive\", \"useSetSelectedDrive\");\n selectDrive(driveOrDriveSlug);\n}\n\n/** Selects a drive in `store`: a scope's own selection, else the app's. */\nexport function selectDriveIn(\n store: PHStore | undefined,\n driveOrDriveSlug: DriveRef,\n) {\n if (!store || !isScopedPHStore(store)) {\n selectDrive(driveOrDriveSlug);\n return;\n }\n const driveSlug =\n typeof driveOrDriveSlug === \"string\"\n ? driveOrDriveSlug\n : driveOrDriveSlug && makeDriveSlug(driveOrDriveSlug);\n if (store.navigation) {\n openTargetWith(store.navigation, driveSlug ? { driveSlug } : undefined);\n return;\n }\n const drive =\n typeof driveOrDriveSlug === \"object\"\n ? driveOrDriveSlug\n : findDriveBySlug(store.drives, driveSlug);\n store.selectedDriveId = drive?.header.id;\n store.selectedNodeId = undefined;\n}\n\n/** `setSelectedDrive` for the store in context, e.g. a scoped editor's. */\nexport function useSetSelectedDrive() {\n const store = usePHStore();\n return useCallback((drive: DriveRef) => selectDriveIn(store, drive), [store]);\n}\n\n/** Selects a drive in the app's store, without the scope warning. */\nexport function selectDrive(driveOrDriveSlug: DriveRef) {\n const driveSlug =\n typeof driveOrDriveSlug === \"string\"\n ? driveOrDriveSlug\n : driveOrDriveSlug && makeDriveSlug(driveOrDriveSlug);\n\n // A host router resolves the drive and writes the selection itself.\n if (hasHostNavigation()) {\n cancelPendingDriveSelection();\n openTarget(driveSlug ? { driveSlug } : undefined);\n return;\n }\n\n // A full drive document is selected directly — a just-created drive\n // navigates before the collection refresh. Slugs go through the lookup.\n const drives = getPHStore()?.drives;\n const drive =\n typeof driveOrDriveSlug === \"object\" && driveOrDriveSlug !== null\n ? driveOrDriveSlug\n : findDriveBySlug(drives, driveSlug);\n const driveId = drive?.header.id;\n\n // Deprecated: hosts without a navigation only; route loaders wait for drives.\n // A deep link may predate remote drive registration, so defer the lookup.\n if (\n !driveId &&\n driveSlug &&\n extractDriveSlugFromPath(getCurrentPathname()) === driveSlug\n ) {\n // Clear the previous selection so a stale drive doesn't render against\n // the new URL; the selected node resets with it, the URL is untouched.\n if (getPHStore()?.selectedDriveId) {\n setSelectedDriveId(undefined);\n }\n deferDriveSelection(driveSlug);\n return;\n }\n\n // Any resolved selection supersedes a pending deferred lookup.\n cancelPendingDriveSelection();\n\n setSelectedDriveId(driveId);\n openTarget(driveId && driveSlug ? { driveSlug } : undefined);\n}\n\n/** Warms a drive's view before it is opened, e.g. on hover. */\nexport function preloadDrive(drive: DocumentDriveDocument | undefined) {\n warnGlobalSetterInScope(\"preloadDrive\", \"usePreloadDrive\");\n if (drive) preloadTarget({ driveSlug: makeDriveSlug(drive) });\n}\n\n/** `preloadDrive` for the store in context. */\nexport function usePreloadDrive() {\n const store = usePHStore();\n return useCallback(\n (drive: DocumentDriveDocument | undefined) => {\n if (!drive) return;\n if (!isScopedPHStore(store)) {\n preloadTarget({ driveSlug: makeDriveSlug(drive) });\n return;\n }\n store?.navigation?.preload?.({ driveSlug: makeDriveSlug(drive) });\n },\n [store],\n );\n}\n\n// Tick between unresolved-slug checks; re-armed while a sync is in flight.\nconst DEFERRED_DRIVE_TICK_MS = 2_000;\n// Hard cap so a wedged remote can't pin the deep link forever.\nconst DEFERRED_DRIVE_MAX_WAIT_MS = 15_000;\n\nlet unsubscribePending: (() => void) | undefined;\nlet pendingTimeout: ReturnType<typeof setTimeout> | undefined;\n\nfunction cancelPendingDriveSelection() {\n if (unsubscribePending) {\n unsubscribePending();\n unsubscribePending = undefined;\n }\n if (pendingTimeout) {\n clearTimeout(pendingTimeout);\n pendingTimeout = undefined;\n }\n}\n\n// Deprecated with the no-navigation path: re-runs the slug lookup on drives\n// updates, restores the pinned node, and redirects home once syncs settle.\nfunction deferDriveSelection(driveSlug: string) {\n cancelPendingDriveSelection();\n\n // Capture the node pinned in the deep link before setSelectedDrive\n // rewrites the URL to /d/<driveSlug>, dropping the node segment.\n const nodeSlug = extractNodeSlugFromPath(getCurrentPathname());\n const handler = () => {\n const drive = findDriveBySlug(getPHStore()?.drives, driveSlug);\n if (!drive) {\n return;\n }\n cancelPendingDriveSelection();\n selectDrive(driveSlug);\n selectNode(nodeSlug);\n };\n unsubscribePending = subscribeToPHValue(\"drives\", handler);\n\n const deadline = Date.now() + DEFERRED_DRIVE_MAX_WAIT_MS;\n const scheduleTick = () => {\n pendingTimeout = setTimeout(() => {\n if (Date.now() < deadline && isInitialSyncInFlight(getPHStore())) {\n scheduleTick();\n return;\n }\n cancelPendingDriveSelection();\n openTarget(undefined);\n }, DEFERRED_DRIVE_TICK_MS);\n };\n scheduleTick();\n}\n","import { getPHStore } from \"./ph-store.js\";\nimport type { DocumentModelLib } from \"document-model\";\nimport { useSyncExternalStore } from \"react\";\nimport {\n isDuplicateManifestError,\n isDuplicateModuleError,\n} from \"../reactor-interop.js\";\nimport type { IPackageManager } from \"../types/vetra.js\";\nimport { makePHEventFunctions } from \"./make-ph-event-functions.js\";\n\nconst vetraPackageManagerFunctions = makePHEventFunctions(\n \"vetraPackageManager\",\n);\n\nexport const useVetraPackageManager = vetraPackageManagerFunctions.useValue;\n\nconst EMPTY_VETRA_PACKAGES: DocumentModelLib[] = [];\nconst noPackageManagerUnsubscribe = () => {};\n\n/**\n * Returns all of the Vetra packages loaded by the Connect instance.\n *\n * The snapshot and subscription must keep stable identity while no package\n * manager is registered: `useSyncExternalStore` loops when the snapshot\n * changes on every read, which a fresh `[]` does.\n */\nexport const useVetraPackages = () => {\n const packageManager = useVetraPackageManager();\n const getPackages = () => packageManager?.packages ?? EMPTY_VETRA_PACKAGES;\n\n return useSyncExternalStore(\n (cb) =>\n packageManager\n ? packageManager.subscribe(cb)\n : noPackageManagerUnsubscribe,\n getPackages,\n getPackages,\n );\n};\n\n/** Adds the Vetra package manager event handler */\nexport const addVetraPackageManagerEventHandler =\n vetraPackageManagerFunctions.addEventHandler;\n\n/**\n * Non-react access to the Vetra package manager: calls `callback` once a\n * manager is available - immediately when already set, otherwise when\n * `setVetraPackageManager` publishes one. Returns an unsubscribe. The worker\n * wiring uses this to forward package updates from plain boot code.\n */\nexport function onVetraPackageManager(\n callback: (packageManager: IPackageManager) => void,\n): () => void {\n let delivered: IPackageManager | undefined;\n const deliver = () => {\n const packageManager = vetraPackageManagerFunctions.getSnapshot();\n if (!packageManager || packageManager === delivered) return;\n delivered = packageManager;\n callback(packageManager);\n };\n const unsubscribe = vetraPackageManagerFunctions.subscribeToValue(deliver);\n deliver();\n return unsubscribe;\n}\n\n/** Sets the Vetra package manager and registers its packages */\nexport function setVetraPackageManager(packageManager: IPackageManager) {\n vetraPackageManagerFunctions.setValue(packageManager);\n updateReactorClientDocumentModels(packageManager.packages);\n updateReactorClientUpgradeManifests(packageManager.packages);\n packageManager.subscribe(({ packages }) => {\n updateReactorClientDocumentModels(packages);\n updateReactorClientUpgradeManifests(packages);\n });\n}\n\nfunction updateReactorClientDocumentModels(packages: DocumentModelLib[]) {\n const documentModelModules = packages\n .flatMap((pkg) => pkg.documentModels)\n .filter(\n (module, index, modules) =>\n // dedupe by documentType and version\n modules.findIndex(\n (m) =>\n m.documentModel.global.id === module.documentModel.global.id &&\n (m.version ?? 1) === (module.version ?? 1),\n ) === index,\n );\n\n const registry =\n getPHStore()?.reactorClientModule?.reactorModule?.documentModelRegistry;\n if (!registry || documentModelModules.length === 0) return;\n\n const results = registry.registerModules(...documentModelModules);\n const duplicateTypes = new Set<string>();\n for (const result of results) {\n if (result.status === \"error\") {\n if (isDuplicateModuleError(result.error)) {\n duplicateTypes.add(result.item.documentModel.global.id);\n } else {\n console.error(\n \"Failed to register document model module:\",\n result.error,\n );\n }\n }\n }\n if (duplicateTypes.size > 0) {\n // unregisterModules is type-scoped, so replace the whole version family\n // with the incoming package's modules: re-registering only the duplicated\n // items would purge any new version that registered successfully above.\n registry.unregisterModules(...duplicateTypes);\n registry.registerModules(\n ...documentModelModules.filter((module) =>\n duplicateTypes.has(module.documentModel.global.id),\n ),\n );\n }\n}\n\nfunction updateReactorClientUpgradeManifests(packages: DocumentModelLib[]) {\n const upgradeManifests = packages\n .flatMap((pkg) => pkg.upgradeManifests)\n .filter((u) => u !== undefined);\n\n const registry =\n getPHStore()?.reactorClientModule?.reactorModule?.documentModelRegistry;\n if (!registry || upgradeManifests.length === 0) return;\n\n const results = registry.registerUpgradeManifests(...upgradeManifests);\n const duplicates = [];\n for (const result of results) {\n if (result.status === \"error\") {\n if (isDuplicateManifestError(result.error)) {\n duplicates.push(result);\n } else {\n console.error(\"Failed to register upgrade manifest:\", result.error);\n }\n }\n }\n if (duplicates.length > 0) {\n const duplicateTypes = duplicates\n .map((r) => r.item.documentType)\n .filter((t): t is string => !!t);\n registry.unregisterUpgradeManifests(...duplicateTypes);\n registry.registerUpgradeManifests(...duplicates.map((r) => r.item));\n }\n}\n","import type { DocumentModelModule } from \"document-model\";\nimport { useVetraPackages } from \"./vetra-packages.js\";\n\nexport function useDocumentModelModules(): DocumentModelModule[] | undefined {\n const vetraPackages = useVetraPackages();\n return vetraPackages\n .flatMap((pkg) => pkg.documentModels)\n .filter(\n (module, index, modules) =>\n // deduplicate by documentType and version\n modules.findIndex(\n (m) =>\n m.documentModel.global.id === module.documentModel.global.id &&\n m.version === module.version,\n ) === index,\n );\n}\n\n/**\n * Resolves a document model module by document type, mirroring the registry's\n * semantics (`IDocumentModelRegistry.getModule`): with `version` omitted the\n * LATEST version of the type wins (`version ?? 1` as each module's default),\n * with `version` given only an exact match is returned. The reactor resolves\n * modules the same way when a document is created, so metadata read through\n * this hook and the version a creation actually uses cannot disagree.\n */\nexport function useDocumentModelModuleById(\n id: string | null | undefined,\n version?: number,\n): DocumentModelModule | undefined {\n const documentModelModules = useDocumentModelModules();\n if (!id || !documentModelModules) return undefined;\n\n let latestModule: DocumentModelModule | undefined;\n let latestVersion = -1;\n for (const module of documentModelModules) {\n if (module.documentModel.global.id !== id) continue;\n const moduleVersion = module.version ?? 1;\n if (version !== undefined) {\n if (moduleVersion === version) return module;\n continue;\n }\n if (moduleVersion > latestVersion) {\n latestVersion = moduleVersion;\n latestModule = module;\n }\n }\n return latestModule;\n}\n"],"mappings":";;;;;;AAYA,MAAM,+BAA+B;;;;;;;;;;;AAYrC,eAAsB,6BAEpB;CACA,IAAI,OAAO,WAAW,aACpB;CAGF,MAAM,SAAS,WAAW,CAAC,EAAE;CAC7B,IAAI,CAAC,QAAQ,MACX;CAGF,OAAO,OAAO,eAAe,EAAE,WAAW,6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AAiB,WAAW,GAAG;CAEhD,MAAM,UAAU,SAAS,yBAAyB,GAAG,gBAAgB;CACrE,MAAM,aAAa,CAAC;CACpB,KAAK,MAAM,UAAU,SACnB,IAAI,OAAO,WAAW,SAAS;EAC7B,IAAI,yBAAyB,OAAO,KAAK,GACvC,WAAW,KAAK,MAAM;OAEtB,QAAQ,MAAM,wCAAwC,OAAO,KAAK;CAEtE;CAEF,IAAI,WAAW,SAAS,GAAG;EACzB,MAAM,iBAAiB,WACpB,KAAK,MAAM,EAAE,KAAK,YAAY,CAAC,CAC/B,QAAQ,MAAmB,CAAC,CAAC,CAAC;EACjC,SAAS,2BAA2B,GAAG,cAAc;EACrD,SAAS,yBAAyB,GAAG,WAAW,KAAK,MAAM,EAAE,IAAI,CAAC;CACpE;AACF;;;AChJA,SAAgB,0BAA6D;CAE3E,OADsB,iBACH,CAAC,CACjB,SAAS,QAAQ,IAAI,cAAc,CAAC,CACpC,QACE,QAAQ,OAAO,YAEd,QAAQ,WACL,MACC,EAAE,cAAc,OAAO,OAAO,OAAO,cAAc,OAAO,MAC1D,EAAE,YAAY,OAAO,OACzB,MAAM,KACV;AACJ;;;;;;;;;AAUA,SAAgB,2BACd,IACA,SACiC;CACjC,MAAM,uBAAuB,wBAAwB;CACrD,IAAI,CAAC,MAAM,CAAC,sBAAsB,OAAO,KAAA;CAEzC,IAAI;CACJ,IAAI,gBAAgB;CACpB,KAAK,MAAM,UAAU,sBAAsB;EACzC,IAAI,OAAO,cAAc,OAAO,OAAO,IAAI;EAC3C,MAAM,gBAAgB,OAAO,WAAW;EACxC,IAAI,YAAY,KAAA,GAAW;GACzB,IAAI,kBAAkB,SAAS,OAAO;GACtC;EACF;EACA,IAAI,gBAAgB,eAAe;GACjC,gBAAgB;GAChB,eAAe;EACjB;CACF;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"document-model-modules-BwnWiVeC.js","names":[],"sources":["../src/graphql-client/auth.ts","../src/errors.ts","../src/routing/initial-sync.ts","../src/hooks/drives.ts","../src/hooks/set-selected-node.ts","../src/hooks/selected-drive.ts","../src/hooks/vetra-packages.ts","../src/hooks/document-model-modules.ts"],"sourcesContent":["import { getPHStore } from \"../hooks/ph-store.js\";\nimport type { SdkFunctionWrapper } from \"../graphql/gen/schema.js\";\n\n/**\n * Resolves the bearer token to send with a request.\n *\n * Returning `undefined` (or an empty string) means \"send this request\n * anonymously\": open Switchboards must keep serving reads to logged-out users.\n */\nexport type BearerTokenProvider = () => Promise<string | undefined>;\n\n/** Lifetime requested for an ambient Renown token, in seconds. */\nconst ambientTokenExpiresInSeconds = 600;\n\n/**\n * The default token provider: the token of the currently logged-in Renown user.\n *\n * It is deliberately resolved from `window.ph` on every call rather than\n * captured at construction time, so a client built before login starts sending\n * the token as soon as there is one.\n *\n * The token is requested WITHOUT an `aud` claim - the Switchboard verifier\n * rejects tokens that carry an audience.\n */\nexport async function ambientRenownTokenProvider(): Promise<\n string | undefined\n> {\n if (typeof window === \"undefined\") {\n return undefined;\n }\n\n const renown = getPHStore()?.renown;\n if (!renown?.user) {\n return undefined;\n }\n\n return renown.getBearerToken({ expiresIn: ambientTokenExpiresInSeconds });\n}\n\n/**\n * Builds the SDK middleware that authenticates every request.\n *\n * The token is resolved per request and never cached, so a login, a logout or\n * an expiry between two calls is picked up by the next one. When no token is\n * available the request goes out unauthenticated.\n */\nexport function makeAuthMiddleware(\n tokenProvider: BearerTokenProvider,\n): SdkFunctionWrapper {\n return async (action) => {\n const token = await tokenProvider();\n if (!token) {\n return action();\n }\n\n return action({ authorization: `Bearer ${token}` });\n };\n}\n","export class UnsupportedDocumentTypeError extends Error {\n constructor(documentType: string) {\n super(`Document type ${documentType} is not supported`);\n this.name = \"UnsupportedDocumentTypeError\";\n }\n\n static isError(error: unknown): error is UnsupportedDocumentTypeError {\n return (\n Error.isError(error) && error.name === \"UnsupportedDocumentTypeError\"\n );\n }\n}\n\nexport class DocumentModelNotFoundError extends Error {\n readonly documentType: string;\n readonly name = \"DocumentModelNotFoundError\";\n\n constructor(documentType: string) {\n super(`Document model module for type ${documentType} not found`);\n this.documentType = documentType;\n }\n\n static isError(error: unknown): error is DocumentModelNotFoundError {\n return Error.isError(error) && error.name === \"DocumentModelNotFoundError\";\n }\n}\n\nexport class DocumentTypeMismatchError extends Error {\n constructor(documentId: string, expectedType: string, actualType: string) {\n super(\n `Document ${documentId} is not of type ${expectedType}. Actual type: ${actualType}`,\n );\n }\n}\n\nexport class NoSelectedDocumentError extends Error {\n constructor() {\n super(\n \"There is no selected document. Did you mean to call 'useSelectedDocumentSafe' instead?\",\n );\n }\n}\n","import type { Remote } from \"@powerhousedao/reactor\";\nimport type { PHStore } from \"../hooks/ph-store.js\";\n\n/** The store's sync remotes; none before the reactor is ready. */\nexport function listSyncRemotes(store: PHStore | undefined): Remote[] {\n try {\n return (\n store?.reactorClientModule?.reactorModule?.syncModule?.syncManager?.list() ??\n []\n );\n } catch {\n return [];\n }\n}\n\n// Only a first pull in flight may still bring drives. A connected remote that\n// never polled is paused or answer-only; one failed or failing to reconnect won't soon.\nfunction isFirstPullInFlight(remote: Remote) {\n try {\n const { state, receivingPages, lastSuccessUtcMs, failureCount } =\n remote.channel.getConnectionState();\n if (state === \"connected\") return receivingPages;\n if (state === \"reconnecting\") return !lastSuccessUtcMs && !failureCount;\n return state === \"connecting\" && (receivingPages || !lastSuccessUtcMs);\n } catch {\n return false;\n }\n}\n\n/** Whether a remote, or one syncing `driveId` when given, is in its first pull. */\nexport function isInitialSyncInFlight(\n store: PHStore | undefined,\n driveId?: string,\n) {\n return listSyncRemotes(store).some(\n (remote) =>\n (driveId === undefined || remote.meta.collectionId.driveId === driveId) &&\n isFirstPullInFlight(remote),\n );\n}\n","import type { DocumentDriveDocument } from \"@powerhousedao/shared/document-drive\";\nimport type { SetPHGlobalValue, UsePHGlobalValue } from \"../types/global.js\";\nimport { makePHEventFunctions } from \"./make-ph-event-functions.js\";\n\nconst drivesEventFunctions = makePHEventFunctions(\"drives\");\n\n/** Returns all of the drives in the reactor */\nexport const useDrives: UsePHGlobalValue<DocumentDriveDocument[]> =\n drivesEventFunctions.useValue;\n\n/** Sets the drives in the reactor */\nexport const setDrives: SetPHGlobalValue<DocumentDriveDocument[]> =\n drivesEventFunctions.setValue;\n\n/** Adds an event handler for the drives */\nexport const addDrivesEventHandler = drivesEventFunctions.addEventHandler;\n","import type {\n PHNavigateOptions,\n PHNavigationTarget,\n} from \"@powerhousedao/reactor-browser\";\nimport type { Node } from \"@powerhousedao/shared/document-drive\";\nimport {\n extractDriveSlugFromPath,\n extractNodeIdFromSlug,\n makeDriveSlug,\n makeNodeSlug,\n} from \"../utils/url.js\";\nimport {\n makePHEventFunctions,\n subscribeToPHValue,\n} from \"./make-ph-event-functions.js\";\nimport { useCallback } from \"react\";\nimport {\n getCurrentPathname,\n hasHostNavigation,\n openTarget,\n openTargetWith,\n preloadTarget,\n} from \"./navigation.js\";\nimport type { PHStore } from \"./ph-store.js\";\nimport {\n getPHStore,\n isScopedPHStore,\n usePHStore,\n warnGlobalSetterInScope,\n} from \"./ph-store.js\";\n\nconst selectedNodeIdEventFunctions = makePHEventFunctions(\"selectedNodeId\");\nexport const useSelectedNodeId = selectedNodeIdEventFunctions.useValue;\n/** Sets the selected node id without touching the URL. */\nexport const setSelectedNodeId = selectedNodeIdEventFunctions.setValue;\n/** @deprecated `ph:setSelectedNodeId` bypasses the URL; use `setSelectedNode`. */\nexport const addSelectedNodeIdEventHandler =\n selectedNodeIdEventFunctions.addEventHandler;\n\nfunction decodeSlug(slug: string) {\n try {\n return decodeURIComponent(slug);\n } catch {\n return slug;\n }\n}\n\n// The selected drive's slug, else the path's: a pending navigation's path\n// already names its destination, not the drive still shown.\nfunction openDriveSlug(store: PHStore | undefined, pathname: string) {\n const selected = store?.drives?.find(\n (d) => d.header.id === store.selectedDriveId,\n );\n if (selected) return makeDriveSlug(selected);\n const driveSlug = extractDriveSlugFromPath(pathname);\n return driveSlug ? decodeSlug(driveSlug) : undefined;\n}\n\n// The node in the app's open drive.\nfunction nodeTarget(nodeSlug: string): PHNavigationTarget | undefined {\n const driveSlug = openDriveSlug(getPHStore(), getCurrentPathname());\n if (!driveSlug) return undefined;\n return { driveSlug, nodeSlug: nodeSlug || undefined };\n}\n\ntype NodeRef = Node | string | undefined;\n\nconst toSlug = (node: NodeRef) =>\n typeof node === \"string\" ? node : makeNodeSlug(node);\n\n// The node in a scope's open drive.\nfunction scopedNodeTarget(store: PHStore, nodeSlug: string) {\n const pathname = store.navigation?.location().pathname ?? \"\";\n const driveSlug = openDriveSlug(store, pathname);\n if (!driveSlug) return undefined;\n return { driveSlug, nodeSlug: nodeSlug || undefined };\n}\n\n/** Selects a node in the app's store, without the scope warning. */\nexport function selectNode(node: NodeRef, options?: PHNavigateOptions) {\n const nodeSlug = toSlug(node);\n // A host router resolves the node and writes the selection itself.\n if (!hasHostNavigation()) {\n setSelectedNodeId(extractNodeIdFromSlug(nodeSlug));\n }\n const target = nodeTarget(nodeSlug);\n if (target) openTarget(target, options);\n}\n\n/** Selects a node in `store`: a scope's own selection, else the app's. */\nexport function selectNodeIn(\n store: PHStore | undefined,\n node: NodeRef,\n options?: PHNavigateOptions,\n) {\n if (!store || !isScopedPHStore(store)) {\n selectNode(node, options);\n return;\n }\n const nodeSlug = toSlug(node);\n const navigation = store.navigation;\n if (!navigation) {\n store.selectedNodeId =\n typeof node === \"object\" ? node.id : extractNodeIdFromSlug(nodeSlug);\n return;\n }\n const target = scopedNodeTarget(store, nodeSlug);\n if (target) openTargetWith(navigation, target, options);\n}\n\n/** Sets the selected node (file or folder) of the app's store; `search` sets\n * the params it opens with. Inside a scoped store, use `useSetSelectedNode`. */\nexport function setSelectedNode(node: NodeRef, options?: PHNavigateOptions) {\n warnGlobalSetterInScope(\"setSelectedNode\", \"useSetSelectedNode\");\n selectNode(node, options);\n}\n\n/** `setSelectedNode` for the store in context, e.g. a scoped editor's. */\nexport function useSetSelectedNode() {\n const store = usePHStore();\n return useCallback(\n (node: NodeRef, options?: PHNavigateOptions) =>\n selectNodeIn(store, node, options),\n [store],\n );\n}\n\n/** Opens a node, or with `undefined` its drive, in the store in context. */\nexport const useOpenNode: () => (\n node: Node | undefined,\n options?: PHNavigateOptions,\n) => void = useSetSelectedNode;\n\n/** Where a node of `store`'s open drive navigates to. */\nexport function getNodeTargetIn(store: PHStore | undefined, node: Node) {\n const nodeSlug = makeNodeSlug(node);\n return store && isScopedPHStore(store)\n ? scopedNodeTarget(store, nodeSlug)\n : nodeTarget(nodeSlug);\n}\n\n/** Where a node of the open drive navigates to. */\nexport function getNodeTarget(node: Node | undefined) {\n return nodeTarget(makeNodeSlug(node));\n}\n\nfunction preloadNodeIn(store: PHStore | undefined, node: Node | undefined) {\n if (!node) return;\n if (!store || !isScopedPHStore(store)) {\n const target = nodeTarget(makeNodeSlug(node));\n if (target) preloadTarget(target);\n return;\n }\n const target = scopedNodeTarget(store, makeNodeSlug(node));\n if (target) store.navigation?.preload?.(target);\n}\n\n/** Warms a node's view before it is opened, e.g. on hover. */\nexport function preloadNode(node: Node | undefined) {\n warnGlobalSetterInScope(\"preloadNode\", \"usePreloadNode\");\n preloadNodeIn(undefined, node);\n}\n\n/** `preloadNode` for the store in context. */\nexport function usePreloadNode() {\n const store = usePHStore();\n return useCallback(\n (node: Node | undefined) => preloadNodeIn(store, node),\n [store],\n );\n}\n\nexport function addResetSelectedNodeEventHandler() {\n subscribeToPHValue(\"selectedDriveId\", () => {\n setSelectedNodeId(undefined);\n });\n}\n","import type { PHStore } from \"./ph-store.js\";\nimport {\n getPHStore,\n isScopedPHStore,\n usePHStore,\n warnGlobalSetterInScope,\n} from \"./ph-store.js\";\nimport { useCallback } from \"react\";\nimport type { DocumentDispatch } from \"@powerhousedao/reactor-browser\";\nimport type {\n DocumentDriveAction,\n DocumentDriveDocument,\n} from \"@powerhousedao/shared/document-drive\";\nimport {\n extractDriveSlugFromPath,\n extractNodeSlugFromPath,\n findDriveBySlug,\n makeDriveSlug,\n} from \"../utils/url.js\";\nimport { isInitialSyncInFlight } from \"../routing/initial-sync.js\";\nimport { useDispatch } from \"./dispatch.js\";\nimport { useDrives } from \"./drives.js\";\nimport {\n makePHEventFunctions,\n subscribeToPHValue,\n} from \"./make-ph-event-functions.js\";\nimport {\n getCurrentPathname,\n hasHostNavigation,\n openTarget,\n openTargetWith,\n preloadTarget,\n} from \"./navigation.js\";\nimport { selectNode } from \"./set-selected-node.js\";\n\nconst selectedDriveIdEventFunctions = makePHEventFunctions(\"selectedDriveId\");\n\n/** Returns the selected drive id */\nexport const useSelectedDriveId = selectedDriveIdEventFunctions.useValue;\n\n/** Sets the selected drive id */\nexport const setSelectedDriveId = selectedDriveIdEventFunctions.setValue;\n\n/** Adds an event handler for the selected drive id\n * @deprecated `ph:setSelectedDriveId` bypasses the URL; use `setSelectedDrive`. */\nexport const addSelectedDriveIdEventHandler =\n selectedDriveIdEventFunctions.addEventHandler;\n\n/** Returns the selected drive */\nexport function useSelectedDrive() {\n const drive = useSelectedDriveSafe();\n if (!drive[0]) {\n throw new Error(\n \"There is no drive selected. Did you mean to call 'useSelectedDriveSafe'?\",\n );\n }\n\n return drive;\n}\n\n/** Returns the selected drive, or undefined if no drive is selected */\nexport function useSelectedDriveSafe() {\n const selectedDriveId = useSelectedDriveId();\n const drives = useDrives();\n const selectedDrive = drives?.find(\n (drive) => drive.header.id === selectedDriveId,\n );\n\n const [drive, dispatch] = useDispatch(selectedDrive);\n if (!selectedDrive) {\n return [undefined, undefined] as const;\n }\n return [drive, dispatch] as [\n DocumentDriveDocument,\n DocumentDispatch<DocumentDriveAction>,\n ];\n}\n\ntype DriveRef = string | DocumentDriveDocument | undefined;\n\n/** Selects a drive in the app's store; inside a scoped store, use\n * `useSetSelectedDrive`. */\nexport function setSelectedDrive(driveOrDriveSlug: DriveRef) {\n warnGlobalSetterInScope(\"setSelectedDrive\", \"useSetSelectedDrive\");\n selectDrive(driveOrDriveSlug);\n}\n\n/** Selects a drive in `store`: a scope's own selection, else the app's. */\nexport function selectDriveIn(\n store: PHStore | undefined,\n driveOrDriveSlug: DriveRef,\n) {\n if (!store || !isScopedPHStore(store)) {\n selectDrive(driveOrDriveSlug);\n return;\n }\n const driveSlug =\n typeof driveOrDriveSlug === \"string\"\n ? driveOrDriveSlug\n : driveOrDriveSlug && makeDriveSlug(driveOrDriveSlug);\n if (store.navigation) {\n openTargetWith(store.navigation, driveSlug ? { driveSlug } : undefined);\n return;\n }\n const drive =\n typeof driveOrDriveSlug === \"object\"\n ? driveOrDriveSlug\n : findDriveBySlug(store.drives, driveSlug);\n store.selectedDriveId = drive?.header.id;\n store.selectedNodeId = undefined;\n}\n\n/** `setSelectedDrive` for the store in context, e.g. a scoped editor's. */\nexport function useSetSelectedDrive() {\n const store = usePHStore();\n return useCallback((drive: DriveRef) => selectDriveIn(store, drive), [store]);\n}\n\n/** Selects a drive in the app's store, without the scope warning. */\nexport function selectDrive(driveOrDriveSlug: DriveRef) {\n const driveSlug =\n typeof driveOrDriveSlug === \"string\"\n ? driveOrDriveSlug\n : driveOrDriveSlug && makeDriveSlug(driveOrDriveSlug);\n\n // A host router resolves the drive and writes the selection itself.\n if (hasHostNavigation()) {\n cancelPendingDriveSelection();\n openTarget(driveSlug ? { driveSlug } : undefined);\n return;\n }\n\n // A full drive document is selected directly — a just-created drive\n // navigates before the collection refresh. Slugs go through the lookup.\n const drives = getPHStore()?.drives;\n const drive =\n typeof driveOrDriveSlug === \"object\" && driveOrDriveSlug !== null\n ? driveOrDriveSlug\n : findDriveBySlug(drives, driveSlug);\n const driveId = drive?.header.id;\n\n // Deprecated: hosts without a navigation only; route loaders wait for drives.\n // A deep link may predate remote drive registration, so defer the lookup.\n if (\n !driveId &&\n driveSlug &&\n extractDriveSlugFromPath(getCurrentPathname()) === driveSlug\n ) {\n // Clear the previous selection so a stale drive doesn't render against\n // the new URL; the selected node resets with it, the URL is untouched.\n if (getPHStore()?.selectedDriveId) {\n setSelectedDriveId(undefined);\n }\n deferDriveSelection(driveSlug);\n return;\n }\n\n // Any resolved selection supersedes a pending deferred lookup.\n cancelPendingDriveSelection();\n\n setSelectedDriveId(driveId);\n openTarget(driveId && driveSlug ? { driveSlug } : undefined);\n}\n\n/** Warms a drive's view before it is opened, e.g. on hover. */\nexport function preloadDrive(drive: DocumentDriveDocument | undefined) {\n warnGlobalSetterInScope(\"preloadDrive\", \"usePreloadDrive\");\n if (drive) preloadTarget({ driveSlug: makeDriveSlug(drive) });\n}\n\n/** `preloadDrive` for the store in context. */\nexport function usePreloadDrive() {\n const store = usePHStore();\n return useCallback(\n (drive: DocumentDriveDocument | undefined) => {\n if (!drive) return;\n if (!isScopedPHStore(store)) {\n preloadTarget({ driveSlug: makeDriveSlug(drive) });\n return;\n }\n store?.navigation?.preload?.({ driveSlug: makeDriveSlug(drive) });\n },\n [store],\n );\n}\n\n// Tick between unresolved-slug checks; re-armed while a sync is in flight.\nconst DEFERRED_DRIVE_TICK_MS = 2_000;\n// Hard cap so a wedged remote can't pin the deep link forever.\nconst DEFERRED_DRIVE_MAX_WAIT_MS = 15_000;\n\nlet unsubscribePending: (() => void) | undefined;\nlet pendingTimeout: ReturnType<typeof setTimeout> | undefined;\n\nfunction cancelPendingDriveSelection() {\n if (unsubscribePending) {\n unsubscribePending();\n unsubscribePending = undefined;\n }\n if (pendingTimeout) {\n clearTimeout(pendingTimeout);\n pendingTimeout = undefined;\n }\n}\n\n// Deprecated with the no-navigation path: re-runs the slug lookup on drives\n// updates, restores the pinned node, and redirects home once syncs settle.\nfunction deferDriveSelection(driveSlug: string) {\n cancelPendingDriveSelection();\n\n // Capture the node pinned in the deep link before setSelectedDrive\n // rewrites the URL to /d/<driveSlug>, dropping the node segment.\n const nodeSlug = extractNodeSlugFromPath(getCurrentPathname());\n const handler = () => {\n const drive = findDriveBySlug(getPHStore()?.drives, driveSlug);\n if (!drive) {\n return;\n }\n cancelPendingDriveSelection();\n selectDrive(driveSlug);\n selectNode(nodeSlug);\n };\n unsubscribePending = subscribeToPHValue(\"drives\", handler);\n\n const deadline = Date.now() + DEFERRED_DRIVE_MAX_WAIT_MS;\n const scheduleTick = () => {\n pendingTimeout = setTimeout(() => {\n if (Date.now() < deadline && isInitialSyncInFlight(getPHStore())) {\n scheduleTick();\n return;\n }\n cancelPendingDriveSelection();\n openTarget(undefined);\n }, DEFERRED_DRIVE_TICK_MS);\n };\n scheduleTick();\n}\n","import { getPHStore } from \"./ph-store.js\";\nimport type { DocumentModelLib } from \"document-model\";\nimport { useSyncExternalStore } from \"react\";\nimport {\n isDuplicateManifestError,\n isDuplicateModuleError,\n} from \"../reactor-interop.js\";\nimport type { IPackageManager } from \"../types/vetra.js\";\nimport { makePHEventFunctions } from \"./make-ph-event-functions.js\";\n\nconst vetraPackageManagerFunctions = makePHEventFunctions(\n \"vetraPackageManager\",\n);\n\nexport const useVetraPackageManager = vetraPackageManagerFunctions.useValue;\n\nconst EMPTY_VETRA_PACKAGES: DocumentModelLib[] = [];\nconst noPackageManagerUnsubscribe = () => {};\n\n/**\n * Returns all of the Vetra packages loaded by the Connect instance.\n *\n * The snapshot and subscription must keep stable identity while no package\n * manager is registered: `useSyncExternalStore` loops when the snapshot\n * changes on every read, which a fresh `[]` does.\n */\nexport const useVetraPackages = () => {\n const packageManager = useVetraPackageManager();\n const getPackages = () => packageManager?.packages ?? EMPTY_VETRA_PACKAGES;\n\n return useSyncExternalStore(\n (cb) =>\n packageManager\n ? packageManager.subscribe(cb)\n : noPackageManagerUnsubscribe,\n getPackages,\n getPackages,\n );\n};\n\n/** Adds the Vetra package manager event handler */\nexport const addVetraPackageManagerEventHandler =\n vetraPackageManagerFunctions.addEventHandler;\n\n/**\n * Non-react access to the Vetra package manager: calls `callback` once a\n * manager is available - immediately when already set, otherwise when\n * `setVetraPackageManager` publishes one. Returns an unsubscribe. The worker\n * wiring uses this to forward package updates from plain boot code.\n */\nexport function onVetraPackageManager(\n callback: (packageManager: IPackageManager) => void,\n): () => void {\n let delivered: IPackageManager | undefined;\n const deliver = () => {\n const packageManager = vetraPackageManagerFunctions.getSnapshot();\n if (!packageManager || packageManager === delivered) return;\n delivered = packageManager;\n callback(packageManager);\n };\n const unsubscribe = vetraPackageManagerFunctions.subscribeToValue(deliver);\n deliver();\n return unsubscribe;\n}\n\n/** Sets the Vetra package manager and registers its packages */\nexport function setVetraPackageManager(packageManager: IPackageManager) {\n vetraPackageManagerFunctions.setValue(packageManager);\n updateReactorClientDocumentModels(packageManager.packages);\n updateReactorClientUpgradeManifests(packageManager.packages);\n packageManager.subscribe(({ packages }) => {\n updateReactorClientDocumentModels(packages);\n updateReactorClientUpgradeManifests(packages);\n });\n}\n\nfunction updateReactorClientDocumentModels(packages: DocumentModelLib[]) {\n const documentModelModules = packages\n .flatMap((pkg) => pkg.documentModels)\n .filter(\n (module, index, modules) =>\n // dedupe by documentType and version\n modules.findIndex(\n (m) =>\n m.documentModel.global.id === module.documentModel.global.id &&\n (m.version ?? 1) === (module.version ?? 1),\n ) === index,\n );\n\n const registry =\n getPHStore()?.reactorClientModule?.reactorModule?.documentModelRegistry;\n if (!registry || documentModelModules.length === 0) return;\n\n const results = registry.registerModules(...documentModelModules);\n const duplicateTypes = new Set<string>();\n for (const result of results) {\n if (result.status === \"error\") {\n if (isDuplicateModuleError(result.error)) {\n duplicateTypes.add(result.item.documentModel.global.id);\n } else {\n console.error(\n \"Failed to register document model module:\",\n result.error,\n );\n }\n }\n }\n if (duplicateTypes.size > 0) {\n // unregisterModules is type-scoped, so replace the whole version family\n // with the incoming package's modules: re-registering only the duplicated\n // items would purge any new version that registered successfully above.\n registry.unregisterModules(...duplicateTypes);\n registry.registerModules(\n ...documentModelModules.filter((module) =>\n duplicateTypes.has(module.documentModel.global.id),\n ),\n );\n }\n}\n\nfunction updateReactorClientUpgradeManifests(packages: DocumentModelLib[]) {\n const upgradeManifests = packages\n .flatMap((pkg) => pkg.upgradeManifests)\n .filter((u) => u !== undefined);\n\n const registry =\n getPHStore()?.reactorClientModule?.reactorModule?.documentModelRegistry;\n if (!registry || upgradeManifests.length === 0) return;\n\n const results = registry.registerUpgradeManifests(...upgradeManifests);\n const duplicates = [];\n for (const result of results) {\n if (result.status === \"error\") {\n if (isDuplicateManifestError(result.error)) {\n duplicates.push(result);\n } else {\n console.error(\"Failed to register upgrade manifest:\", result.error);\n }\n }\n }\n if (duplicates.length > 0) {\n const duplicateTypes = duplicates\n .map((r) => r.item.documentType)\n .filter((t): t is string => !!t);\n registry.unregisterUpgradeManifests(...duplicateTypes);\n registry.registerUpgradeManifests(...duplicates.map((r) => r.item));\n }\n}\n","import type { DocumentModelModule } from \"document-model\";\nimport { useVetraPackages } from \"./vetra-packages.js\";\n\nexport function useDocumentModelModules(): DocumentModelModule[] | undefined {\n const vetraPackages = useVetraPackages();\n return vetraPackages\n .flatMap((pkg) => pkg.documentModels)\n .filter(\n (module, index, modules) =>\n // deduplicate by documentType and version\n modules.findIndex(\n (m) =>\n m.documentModel.global.id === module.documentModel.global.id &&\n m.version === module.version,\n ) === index,\n );\n}\n\n/**\n * Resolves a document model module by document type, mirroring the registry's\n * semantics (`IDocumentModelRegistry.getModule`): with `version` omitted the\n * LATEST version of the type wins (`version ?? 1` as each module's default),\n * with `version` given only an exact match is returned. The reactor resolves\n * modules the same way when a document is created, so metadata read through\n * this hook and the version a creation actually uses cannot disagree.\n */\nexport function useDocumentModelModuleById(\n id: string | null | undefined,\n version?: number,\n): DocumentModelModule | undefined {\n const documentModelModules = useDocumentModelModules();\n if (!id || !documentModelModules) return undefined;\n\n let latestModule: DocumentModelModule | undefined;\n let latestVersion = -1;\n for (const module of documentModelModules) {\n if (module.documentModel.global.id !== id) continue;\n const moduleVersion = module.version ?? 1;\n if (version !== undefined) {\n if (moduleVersion === version) return module;\n continue;\n }\n if (moduleVersion > latestVersion) {\n latestVersion = moduleVersion;\n latestModule = module;\n }\n }\n return latestModule;\n}\n"],"mappings":";;;;;;AAYA,MAAM,+BAA+B;;;;;;;;;;;AAYrC,eAAsB,6BAEpB;CACA,IAAI,OAAO,WAAW,aACpB;CAGF,MAAM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,7 +1,7 @@
|
|
|
1
1
|
import { t as makePHEventFunctions, u as getPHStore } from "./make-ph-event-functions-C1JTfEw1.js";
|
|
2
2
|
import { C as queueOperations, S as queueActions, a as useDocumentCache, d as DocumentCache, f as IDLE_OPERATIONS_ENTRY, g as DOCUMENT_CHANGE_TYPE, m as isOperationCache, n as addDocumentCacheEventHandler, r as setDocumentCache, w as uploadOperations } from "./dispatch-BmdzdTwb.js";
|
|
3
|
-
import { B as ambientRenownTokenProvider, E as setSelectedNodeId, I as DocumentModelNotFoundError, V as makeAuthMiddleware, a as setVetraPackageManager, c as addSelectedDriveIdEventHandler, f as setSelectedDriveId, h as useSelectedDriveId, j as addDrivesEventHandler, r as addVetraPackageManagerEventHandler, u as selectDrive, v as addResetSelectedNodeEventHandler, y as addSelectedNodeIdEventHandler, z as UnsupportedDocumentTypeError } from "./document-model-modules-
|
|
4
|
-
import {
|
|
3
|
+
import { B as ambientRenownTokenProvider, E as setSelectedNodeId, I as DocumentModelNotFoundError, V as makeAuthMiddleware, a as setVetraPackageManager, c as addSelectedDriveIdEventHandler, f as setSelectedDriveId, h as useSelectedDriveId, j as addDrivesEventHandler, r as addVetraPackageManagerEventHandler, u as selectDrive, v as addResetSelectedNodeEventHandler, y as addSelectedNodeIdEventHandler, z as UnsupportedDocumentTypeError } from "./document-model-modules-BwnWiVeC.js";
|
|
4
|
+
import { C as setBrowserOpenSync, M as extractNodeSlugFromPath, P as findDriveBySlug, S as searchToRecord, c as getCurrentPathname, f as hasHostNavigation, h as openTarget, j as extractNodeIdFromSlug, k as extractDriveSlugFromPath, u as getPHNavigation, y as recordToSearch } from "./navigation-BUPIObES.js";
|
|
5
5
|
import { i as PhDocumentFieldsFragmentDoc, n as DocumentChangesDocument, t as createClient$1 } from "./client-CXDpILj6.js";
|
|
6
6
|
import { f as addLoadingEventHandler, t as addRenownEventHandler } from "./renown-CGQYQsvH.js";
|
|
7
7
|
import { useCallback, useEffect, useMemo, useState, useSyncExternalStore } from "react";
|
|
@@ -22,21 +22,108 @@ const usePHModal = modalEventFunctions.useValue;
|
|
|
22
22
|
const setPHModal = modalEventFunctions.setValue;
|
|
23
23
|
/** Adds an event handler for the modal */
|
|
24
24
|
const addModalEventHandler = modalEventFunctions.addEventHandler;
|
|
25
|
-
/**
|
|
25
|
+
/** The query param that names a routed modal. */
|
|
26
|
+
const MODAL_SEARCH_PARAM = "modal";
|
|
27
|
+
const MODAL_ROUTES = {
|
|
28
|
+
createDocument: {
|
|
29
|
+
id: "create-document",
|
|
30
|
+
toSearch: ({ documentType, documentModelVersion }) => ({
|
|
31
|
+
documentType,
|
|
32
|
+
...documentModelVersion !== void 0 && { documentModelVersion: String(documentModelVersion) }
|
|
33
|
+
}),
|
|
34
|
+
fromSearch: (search) => ({
|
|
35
|
+
documentType: search.documentType ?? "",
|
|
36
|
+
...search.documentModelVersion && { documentModelVersion: Number(search.documentModelVersion) }
|
|
37
|
+
})
|
|
38
|
+
},
|
|
39
|
+
login: { id: "login" },
|
|
40
|
+
addDrive: { id: "add-drive" },
|
|
41
|
+
driveSettings: {
|
|
42
|
+
id: "drive-settings",
|
|
43
|
+
toSearch: ({ driveId }) => ({ driveId }),
|
|
44
|
+
fromSearch: (search) => ({ driveId: search.driveId ?? "" })
|
|
45
|
+
},
|
|
46
|
+
debugSettings: { id: "debug-settings" },
|
|
47
|
+
inspector: { id: "inspector" },
|
|
48
|
+
disclaimer: { id: "disclaimer" },
|
|
49
|
+
cookiesPolicy: { id: "cookies-policy" }
|
|
50
|
+
};
|
|
51
|
+
const routeOf = (type) => MODAL_ROUTES[type];
|
|
52
|
+
/** Whether `modal` lives in the URL rather than the store. */
|
|
53
|
+
function isRoutedModal(modal) {
|
|
54
|
+
return !!modal && !!routeOf(modal.type);
|
|
55
|
+
}
|
|
56
|
+
/** The query params that open `modal`; undefined for one the store holds. */
|
|
57
|
+
function modalSearch(modal) {
|
|
58
|
+
const route = routeOf(modal.type);
|
|
59
|
+
if (!route) return void 0;
|
|
60
|
+
return {
|
|
61
|
+
[MODAL_SEARCH_PARAM]: route.id,
|
|
62
|
+
...route.toSearch?.(modal)
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/** The routed modal `search` opens, if any. */
|
|
66
|
+
function modalFromSearch(search) {
|
|
67
|
+
const id = search[MODAL_SEARCH_PARAM];
|
|
68
|
+
if (typeof id !== "string") return void 0;
|
|
69
|
+
const strings = Object.fromEntries(Object.entries(search).map(([key, value]) => [key, String(value)]));
|
|
70
|
+
for (const [type, route] of Object.entries(MODAL_ROUTES)) {
|
|
71
|
+
if (route.id !== id) continue;
|
|
72
|
+
return {
|
|
73
|
+
type,
|
|
74
|
+
...route.fromSearch?.(strings)
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/** `search` without a routed modal's params. */
|
|
79
|
+
function withoutModalSearch(search) {
|
|
80
|
+
const modal = modalFromSearch(search);
|
|
81
|
+
const own = modal ? Object.keys(modalSearch(modal) ?? {}) : [];
|
|
82
|
+
return Object.fromEntries(Object.entries(search).filter(([key]) => !own.includes(key)));
|
|
83
|
+
}
|
|
84
|
+
/** Shows a modal. With a host navigation, a routed one opens in the URL, in
|
|
85
|
+
* place of the current entry, and "settings" opens the settings page. */
|
|
26
86
|
function showPHModal(modal) {
|
|
27
87
|
if (modal.type === "settings" && hasHostNavigation()) {
|
|
28
88
|
openTarget({ settings: true });
|
|
29
89
|
return;
|
|
30
90
|
}
|
|
91
|
+
const search = modalSearch(modal);
|
|
92
|
+
if (search && hasHostNavigation()) {
|
|
93
|
+
if (!isRoutedModal(modalEventFunctions.getSnapshot())) setPHModal(void 0);
|
|
94
|
+
getPHNavigation().setSearch((prev) => ({
|
|
95
|
+
...withoutModalSearch(prev),
|
|
96
|
+
...search
|
|
97
|
+
}), { replace: true });
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
31
100
|
setPHModal(modal);
|
|
32
101
|
}
|
|
33
|
-
/** Closes the current modal
|
|
102
|
+
/** Closes the current modal; a routed one leaves the URL in place of the entry,
|
|
103
|
+
* and a confirmation opened over it closes with it. */
|
|
34
104
|
function closePHModal() {
|
|
105
|
+
if (hasHostNavigation()) {
|
|
106
|
+
const navigation = getPHNavigation();
|
|
107
|
+
if (modalFromSearch(searchToRecord(navigation.location().search))) {
|
|
108
|
+
navigation.setSearch((prev) => withoutModalSearch(prev), { replace: true });
|
|
109
|
+
if (!isRoutedModal(modalEventFunctions.getSnapshot())) setPHModal(void 0);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
35
113
|
setPHModal(void 0);
|
|
36
114
|
}
|
|
115
|
+
/** The href that opens `modal` over the current page. */
|
|
116
|
+
function modalHref(modal) {
|
|
117
|
+
const { pathname, search } = getPHNavigation().location();
|
|
118
|
+
const next = {
|
|
119
|
+
...withoutModalSearch(searchToRecord(search)),
|
|
120
|
+
...modalSearch(modal)
|
|
121
|
+
};
|
|
122
|
+
return `${pathname}${recordToSearch(next)}`;
|
|
123
|
+
}
|
|
37
124
|
/** Shows the create document modal */
|
|
38
125
|
function showCreateDocumentModal(documentType, documentModelVersion) {
|
|
39
|
-
|
|
126
|
+
showPHModal({
|
|
40
127
|
type: "createDocument",
|
|
41
128
|
documentType,
|
|
42
129
|
...documentModelVersion !== void 0 && { documentModelVersion }
|
|
@@ -2934,23 +3021,6 @@ const usePackageDiscoveryService = packageDiscoveryFunctions.useValue;
|
|
|
2934
3021
|
const setPackageDiscoveryService = packageDiscoveryFunctions.setValue;
|
|
2935
3022
|
const addPackageDiscoveryServiceEventHandler = packageDiscoveryFunctions.addEventHandler;
|
|
2936
3023
|
//#endregion
|
|
2937
|
-
//#region src/hooks/revision-history.ts
|
|
2938
|
-
const revisionHistoryEventFunctions = makePHEventFunctions("revisionHistoryVisible");
|
|
2939
|
-
/** Returns whether revision history is visible */
|
|
2940
|
-
const useRevisionHistoryVisible = revisionHistoryEventFunctions.useValue;
|
|
2941
|
-
/** Sets revision history visibility */
|
|
2942
|
-
const setRevisionHistoryVisible = revisionHistoryEventFunctions.setValue;
|
|
2943
|
-
/** Adds event handler for revision history visibility */
|
|
2944
|
-
const addRevisionHistoryVisibleEventHandler = revisionHistoryEventFunctions.addEventHandler;
|
|
2945
|
-
/** Shows the revision history */
|
|
2946
|
-
function showRevisionHistory() {
|
|
2947
|
-
setRevisionHistoryVisible(true);
|
|
2948
|
-
}
|
|
2949
|
-
/** Hides the revision history */
|
|
2950
|
-
function hideRevisionHistory() {
|
|
2951
|
-
setRevisionHistoryVisible(false);
|
|
2952
|
-
}
|
|
2953
|
-
//#endregion
|
|
2954
3024
|
//#region src/hooks/sync-selection.ts
|
|
2955
3025
|
/** Applies a path's selection without writing the URL; idempotent.
|
|
2956
3026
|
* @deprecated Set the store's `navigation`; its route loaders write the selection. */
|
|
@@ -3047,7 +3117,6 @@ const phGlobalEventHandlerRegisterFunctions = {
|
|
|
3047
3117
|
vetraPackageManager: addVetraPackageManagerEventHandler,
|
|
3048
3118
|
packageDiscoveryService: addPackageDiscoveryServiceEventHandler,
|
|
3049
3119
|
selectedTimelineRevision: addSelectedTimelineRevisionEventHandler,
|
|
3050
|
-
revisionHistoryVisible: addRevisionHistoryVisibleEventHandler,
|
|
3051
3120
|
selectedTimelineItem: addSelectedTimelineItemEventHandler,
|
|
3052
3121
|
routerBasename: addRouterBasenameEventHandler,
|
|
3053
3122
|
version: addVersionEventHandler,
|
|
@@ -3283,6 +3352,6 @@ function useDocumentOperations(documentId, scope, options = {}) {
|
|
|
3283
3352
|
return legacy ? legacyResult : primary;
|
|
3284
3353
|
}
|
|
3285
3354
|
//#endregion
|
|
3286
|
-
export {
|
|
3355
|
+
export { addIsAnalyticsExternalProcessorsEnabledEventHandler as $, isRoutedModal as $i, useIsEditorDebugModeEnabled as $n, signStampedAction as $r, setIsDeleteLocalDrivesEnabled as $t, useDropTarget as A, renameDriveNode as Ai, useAnalyticsDatabaseName as An, phDocumentEditorConfigHooks as Ar, addVersionEventHandler as At, addCliVersionEventHandler as B, setFullReactorClient as Bi, useIsAddDriveEnabled as Bn, isGraphQLReactorClient as Br, setDrivesPreserveStrategy as Bt, usePackageDiscoveryService as C, deleteNode as Ci, setSentryRelease as Cn, useWarnOutdatedApp as Cr, addRouterBasenameEventHandler as Ct, addDraggingNodeEventHandler as D, getDocumentExtension as Di, setVersionCheckInterval as Dn, isExternalControlsEnabledEventFunctions as Dr, addStudioModeEventHandler as Dt, useGraphQLReactorClient as E, fetchDocumentOperations as Ei, setVersion as En, addIsExternalControlsEnabledEventHandler as Er, addSentryReleaseEventHandler as Et, setAttachmentService as F, isDocumentTypeSupported as Fi, useDrivesPreserveStrategy as Fn, useAllowedDocumentTypes as Fr, setAnalyticsDatabaseName as Ft, addFileUploadOperationsChunkSizeEventHandler as G, usePGlite as Gi, useIsAnalyticsExternalProcessorsEnabled as Gn, subscriptionsUrlFromGraphqlUrl as Gr, setIsAddDriveEnabled as Gt, addDisabledEditorsEventHandler as H, setReactorClientModule as Hi, useIsAddPublicDrivesEnabled as Hn, isAuthRefusalClose as Hr, setFileUploadOperationsChunkSize as Ht, useAttachmentService as I, addFullReactorClientEventHandler as Ii, useEnabledEditors as In, useIsDragAndDropEnabled as Ir, setBasePath as It, addIsAddDriveEnabledEventHandler as J, useSync as Ji, useIsDeleteLocalDrivesEnabled as Jn, subgraphUrlFromGraphqlUrl as Jr, setIsAnalyticsDatabaseWorkerEnabled as Jt, addGaTrackingIdEventHandler as K, useReactorClient as Ki, useIsCloudDrivesEnabled as Kn, SubgraphSdkRegistry as Kr, setIsAddLocalDrivesEnabled as Kt, addAllowListEventHandler as L, addReactorClientEventHandler as Li, useFileUploadOperationsChunkSize as Ln, useIsExternalControlsEnabled as Lr, setCliVersion as Lt, setFeatures as M, setPreferredEditorOnNode as Mi, useCliVersion as Mn, setAllowedDocumentTypes as Mr, phGlobalConfigHooks as Mt, useFeatures as N, upgradeDocument as Ni, useDefaultDrivesUrl as Nn, setIsDragAndDropEnabled as Nr, phGlobalConfigSetters as Nt, useDragNode as O, loadFile as Oi, setWarnOutdatedApp as On, phAppConfigHooks as Or, addSwitchboardUrlEventHandler as Ot, addAttachmentServiceEventHandler as P, getUserPermissions as Pi, useDisabledEditors as Pn, setIsExternalControlsEnabled as Pr, setAllowList as Pt, addIsAnalyticsEnabledEventHandler as Q, closePHModal as Qi, useIsDriveAnalyticsEnabled as Qn, prepareSignedActions as Qr, setIsDeleteCloudDrivesEnabled as Qt, addAnalyticsDatabaseNameEventHandler as R, addReactorClientModuleEventHandler as Ri, useGaTrackingId as Rn, GraphQLReactorClient as Rr, setDefaultDrivesUrl as Rt, setPackageDiscoveryService as S, copyNode$1 as Si, setSentryEnv as Sn, useVersionCheckInterval as Sr, addRequiresHardRefreshEventHandler as St, setGraphQLReactorClient as T, extractInitialState as Ti, setSwitchboardUrl as Tn, addIsDragAndDropEnabledEventHandler as Tr, addSentryEnvEventHandler as Tt, addDrivesPreserveStrategyEventHandler as U, useDatabase as Ui, useIsAnalyticsDatabaseWorkerEnabled as Un, makeAuthConnectionParams as Ur, setGaTrackingId as Ut, addDefaultDrivesUrlEventHandler as V, setReactorClient as Vi, useIsAddLocalDrivesEnabled as Vn, viewFilterInputFromViewFilter as Vr, setEnabledEditors as Vt, addEnabledEditorsEventHandler as W, useModelRegistry as Wi, useIsAnalyticsEnabled as Wn, startDocumentChangesSubscription as Wr, setIsAddCloudDrivesEnabled as Wt, addIsAddPublicDrivesEnabledEventHandler as X, MODAL_SEARCH_PARAM as Xi, useIsDiffAnalyticsEnabled as Xn, packageFromDocumentModels as Xr, setIsAnalyticsExternalProcessorsEnabled as Xt, addIsAddLocalDrivesEnabledEventHandler as Y, useSyncList as Yi, useIsDeletePublicDrivesEnabled as Yn, StaticPackageManager as Yr, setIsAnalyticsEnabled as Yt, addIsAnalyticsDatabaseWorkerEnabledEventHandler as Z, addModalEventHandler as Zi, useIsDocumentModelSelectionSettingsEnabled as Zn, resolveDocumentModelModule as Zr, setIsCloudDrivesEnabled as Zt, addSetSelectedDriveOnPopStateEventHandler as _, DEFAULT_DRIVE_EDITOR_ID as _i, setRenownNetworkId as _n, useSentryEnv as _r, addLogLevelEventHandler as _t, addPHEventHandlers as a, showDeleteNodeModal as aa, GraphQLWrongBackendError as ai, setIsEditorReadModeEnabled as an, useIsPublicDrivesEnabled as ar, addIsDocumentModelSelectionSettingsEnabledEventHandler as at, syncSelectionFromPath as b, addFileWithProgress as bi, setRouterBasename as bn, useSwitchboardUrl as br, addRenownNetworkIdEventHandler as bt, addToastEventHandler as c, withoutModalSearch as ca, phDocumentFromMutation as ci, setIsExternalRelationalProcessorsEnabled as cn, useLocalDrivesEnabled as cr, addIsEditorReadModeEnabledEventHandler as ct, addSelectedTimelineRevisionEventHandler as d, buildPulledDocument as di, setIsRelationalProcessorsEnabled as dn, useRenownChainId as dr, addIsExternalRelationalProcessorsEnabledEventHandler as dt, modalFromSearch as ea, stampAction as ei, setIsDeletePublicDrivesEnabled as en, useIsEditorReadModeEnabled as er, addIsCloudDrivesEnabledEventHandler as et, setSelectedTimelineRevision as f, convertRemoteOperations as fi, setIsSentryTracingEnabled as fn, useRenownNetworkId as fr, addIsLocalDrivesEnabledEventHandler as ft, useSelectedTimelineItem as g, COMMON_PACKAGE_ID as gi, setRenownChainId as gn, useSentryDsn as gr, addLocalDrivesEnabledEventHandler as gt, setSelectedTimelineItem as h, screamingSnakeToCamel as hi, setRenownAdapters as hn, useRouterBasename as hr, addIsSentryTracingEnabledEventHandler as ht, useSwitchboardClient as i, showCreateDocumentModal as ia, GraphQLOperationNotSupportedError as ii, setIsEditorDebugModeEnabled as in, useIsLocalDrivesEnabled as ir, addIsDiffAnalyticsEnabledEventHandler as it, addFeaturesEventHandler as j, renameNode as ji, useBasePath as jn, phDocumentEditorConfigSetters as jr, addWarnOutdatedAppEventHandler as jt, useDropNode as k, moveNode$1 as ki, useAllowList as kn, phAppConfigSetters as kr, addVersionCheckIntervalEventHandler as kt, setPHToast as l, revisionMapFromRevisionsList as li, setIsLocalDrivesEnabled as ln, useLogLevel as lr, addIsExternalPackagesEnabledEventHandler as lt, addSelectedTimelineItemEventHandler as m, hasRevisionConflict as mi, setLogLevel as mn, useRequiresHardRefresh as mr, addIsRelationalProcessorsEnabledEventHandler as mt, GraphQLReactorProvider as n, modalSearch as na, ReactorOperationFieldsFragmentDoc as ni, setIsDocumentModelSelectionSettingsEnabled as nn, useIsExternalProcessorsEnabled as nr, addIsDeleteLocalDrivesEnabledEventHandler as nt, callEventHandlerRegisterFunctions as o, showPHModal as oa, isoStringFromDateTime as oi, setIsExternalPackagesEnabled as on, useIsRelationalProcessorsEnabled as or, addIsDriveAnalyticsEnabledEventHandler as ot, useSelectedTimelineRevision as p, extractRevisionMap as pi, setLocalDrivesEnabled as pn, useRenownUrl as pr, addIsPublicDrivesEnabledEventHandler as pt, addIsAddCloudDrivesEnabledEventHandler as q, useReactorClientModule as qi, useIsDeleteCloudDrivesEnabled as qn, describeGraphQLDocument as qr, setIsAddPublicDrivesEnabled as qt, ensurePHEventHandlers as r, setPHModal as ra, BatchJobFailedError as ri, setIsDriveAnalyticsEnabled as rn, useIsExternalRelationalProcessorsEnabled as rr, addIsDeletePublicDrivesEnabledEventHandler as rt, commonGlobalEventHandlerFunctions as s, usePHModal as sa, phDocumentFromGetDocument as si, setIsExternalProcessorsEnabled as sn, useIsSentryTracingEnabled as sr, addIsEditorDebugModeEnabledEventHandler as st, useDocumentOperations as t, modalHref as ta, MutateDocumentWithOperationsDocument as ti, setIsDiffAnalyticsEnabled as tn, useIsExternalPackagesEnabled as tr, addIsDeleteCloudDrivesEnabledEventHandler as tt, usePHToast as u, ConflictError as ui, setIsPublicDrivesEnabled as un, useRenownAdapters as ur, addIsExternalProcessorsEnabledEventHandler as ut, addSetSelectedNodeOnPopStateEventHandler as v, DRIVE_DOCUMENT_TYPES as vi, setRenownUrl as vn, useSentryRelease as vr, addRenownAdaptersEventHandler as vt, addGraphQLReactorClientEventHandler as w, exportFile as wi, setStudioMode as wn, addAllowedDocumentTypesEventHandler as wr, addSentryDsnEventHandler as wt, addPackageDiscoveryServiceEventHandler as x, addFolder$1 as xi, setSentryDsn as xn, useVersion as xr, addRenownUrlEventHandler as xt, addSyncSelectionOnPopStateEventHandler as y, addDocument as yi, setRequiresHardRefresh as yn, useStudioMode as yr, addRenownChainIdEventHandler as yt, addBasePathEventHandler as z, getFullReactorClient as zi, useIsAddCloudDrivesEnabled as zn, findIsServableOverGraphQL as zr, setDisabledEditors as zt };
|
|
3287
3356
|
|
|
3288
|
-
//# sourceMappingURL=document-operations
|
|
3357
|
+
//# sourceMappingURL=document-operations-DciiZwkC.js.map
|