@powerhousedao/powerhouse-vetra-packages 6.2.0-dev.3 → 6.2.0-dev.30
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/browser/assets/{entry-Bzani6_n.js → entry-BzMQu_A8.js} +2 -2
- package/dist/browser/assets/{projection-entry-Bpu-8SnI.js → projection-entry-CQb9a2Bz.js} +2 -2
- package/dist/browser/{connect-ZnLjvmRt.js → connect-CdR7HnG_.js} +104 -104
- package/dist/browser/connect-CdR7HnG_.js.map +1 -0
- package/dist/browser/{dist-DLFI75Zd.js → dist-DXM8ccKa.js} +46 -7
- package/dist/browser/dist-DXM8ccKa.js.map +1 -0
- package/dist/browser/{dist-C1nRM9t2.js → dist-HgA907mh.js} +95 -61
- package/dist/browser/dist-HgA907mh.js.map +1 -0
- package/dist/browser/{document-drive-oqv68jDU.js → document-drive-sTKoi6L4.js} +314 -9
- package/dist/browser/document-drive-sTKoi6L4.js.map +1 -0
- package/dist/browser/document-models/index.js +1 -1
- package/dist/browser/{editor-DC3bigBu.js → editor-Bzkc8cBh.js} +5 -5
- package/dist/browser/{editor-DC3bigBu.js.map → editor-Bzkc8cBh.js.map} +1 -1
- package/dist/browser/{editor-CoTq6fqT.js → editor-CwLkXRMi.js} +21 -21
- package/dist/browser/editor-CwLkXRMi.js.map +1 -0
- package/dist/browser/editors/document-model-editor/module.js +1 -1
- package/dist/browser/editors/generic-drive-explorer/index.js +5 -5
- package/dist/browser/editors/generic-drive-explorer/index.js.map +1 -1
- package/dist/browser/editors/generic-drive-explorer/module.js +1 -1
- package/dist/browser/{folder-view-DmYBf2pP.js → folder-view-SEF40UJw.js} +7 -7
- package/dist/browser/folder-view-SEF40UJw.js.map +1 -0
- package/dist/browser/{graphql-editor-CiGd_Li7.js → graphql-editor-DMG1SdS3.js} +3 -3
- package/dist/browser/{graphql-editor-CiGd_Li7.js.map → graphql-editor-DMG1SdS3.js.map} +1 -1
- package/dist/browser/index.js +2 -2
- package/dist/browser/{json-editor-sEqd5piI.js → json-editor-C9wagvps.js} +3 -3
- package/dist/browser/{json-editor-sEqd5piI.js.map → json-editor-C9wagvps.js.map} +1 -1
- package/dist/browser/{state-schemas-DJmzG_M8.js → state-schemas-CDE7-WSq.js} +12 -12
- package/dist/browser/state-schemas-CDE7-WSq.js.map +1 -0
- package/dist/node/{connect-BLC4PXD9.mjs → connect-C5Fwy1TV.mjs} +93 -93
- package/dist/node/connect-C5Fwy1TV.mjs.map +1 -0
- package/dist/node/{dist-Bm05eoTg.mjs → dist-BCpGdShB.mjs} +95 -61
- package/dist/node/dist-BCpGdShB.mjs.map +1 -0
- package/dist/node/{dist-Cn3iExnV.mjs → dist-C88eUERe.mjs} +46 -7
- package/dist/node/dist-C88eUERe.mjs.map +1 -0
- package/dist/node/{document-drive-sM33juXr.mjs → document-drive-DjL9iikf.mjs} +314 -9
- package/dist/node/document-drive-DjL9iikf.mjs.map +1 -0
- package/dist/node/document-models/index.mjs +1 -1
- package/dist/node/{editor-BrS98lEH.mjs → editor-CIR848q-.mjs} +5 -5
- package/dist/node/{editor-BrS98lEH.mjs.map → editor-CIR848q-.mjs.map} +1 -1
- package/dist/node/{editor-BFBa9nsO.mjs → editor-DmB3aE4K.mjs} +21 -21
- package/dist/node/editor-DmB3aE4K.mjs.map +1 -0
- package/dist/node/editors/document-model-editor/module.mjs +1 -1
- package/dist/node/editors/generic-drive-explorer/index.mjs +5 -5
- package/dist/node/editors/generic-drive-explorer/index.mjs.map +1 -1
- package/dist/node/editors/generic-drive-explorer/module.mjs +1 -1
- package/dist/node/{folder-view-DHph3Yuu.mjs → folder-view-OzKx5KyJ.mjs} +7 -7
- package/dist/node/folder-view-OzKx5KyJ.mjs.map +1 -0
- package/dist/node/{graphql-editor-CPq7oIbf.mjs → graphql-editor-CG9Wyp7N.mjs} +3 -3
- package/dist/node/{graphql-editor-CPq7oIbf.mjs.map → graphql-editor-CG9Wyp7N.mjs.map} +1 -1
- package/dist/node/index.mjs +2 -2
- package/dist/node/{json-editor-L32CP7TS.mjs → json-editor-CfA5q_6F.mjs} +3 -3
- package/dist/node/{json-editor-L32CP7TS.mjs.map → json-editor-CfA5q_6F.mjs.map} +1 -1
- package/dist/node/{state-schemas-XTTjQZOe.mjs → state-schemas-DVr0xm_W.mjs} +12 -12
- package/dist/node/state-schemas-DVr0xm_W.mjs.map +1 -0
- package/package.json +6 -6
- package/dist/browser/connect-ZnLjvmRt.js.map +0 -1
- package/dist/browser/dist-C1nRM9t2.js.map +0 -1
- package/dist/browser/dist-DLFI75Zd.js.map +0 -1
- package/dist/browser/document-drive-oqv68jDU.js.map +0 -1
- package/dist/browser/editor-CoTq6fqT.js.map +0 -1
- package/dist/browser/folder-view-DmYBf2pP.js.map +0 -1
- package/dist/browser/state-schemas-DJmzG_M8.js.map +0 -1
- package/dist/node/connect-BLC4PXD9.mjs.map +0 -1
- package/dist/node/dist-Bm05eoTg.mjs.map +0 -1
- package/dist/node/dist-Cn3iExnV.mjs.map +0 -1
- package/dist/node/document-drive-sM33juXr.mjs.map +0 -1
- package/dist/node/editor-BFBa9nsO.mjs.map +0 -1
- package/dist/node/folder-view-DHph3Yuu.mjs.map +0 -1
- package/dist/node/state-schemas-XTTjQZOe.mjs.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { E as __commonJSMin, k as __toESM, t as capitalCase } from "./dist-CXoKspdx.js";
|
|
2
|
-
import {
|
|
3
|
-
import { c as
|
|
4
|
-
import { Children, cloneElement, forwardRef, isValidElement, use, useEffect, useMemo, useState, useSyncExternalStore } from "react";
|
|
2
|
+
import { B as setName, C as createZip, J as validateModules, X as generateId, Y as validateStateSchemaName, _ as baseLoadFromInputVersioned, a as handleTargetNameCollisions, b as createPresignedHeader, c as moveNode, d as logger, g as baseLoadFromInput, i as generateNodesCopy, j as replayDocumentVersioned, l as updateNode, n as copyNode, o as isFileNode, q as validateInitialState, r as driveDocumentModelModule, s as isFolderNode, t as addFolder$1, u as documentModelDocumentModelModule, v as baseSaveToFileHandle, y as buildSignedAction } from "./document-drive-sTKoi6L4.js";
|
|
3
|
+
import { c as ModuleNotFoundError, n as gql, o as SyncStatus, s as DriveCollectionId, t as reactorDriveDocumentModelModule } from "./dist-DXM8ccKa.js";
|
|
4
|
+
import { Children, cloneElement, forwardRef, isValidElement, use, useCallback, useEffect, useMemo, useState, useSyncExternalStore } from "react";
|
|
5
5
|
import "react/jsx-runtime";
|
|
6
|
-
//#region ../reactor-browser/dist/make-ph-event-functions-
|
|
6
|
+
//#region ../reactor-browser/dist/make-ph-event-functions-BHoLPif5.js
|
|
7
7
|
const isServer$1 = typeof window === "undefined";
|
|
8
8
|
function makePHEventFunctions(key) {
|
|
9
9
|
const setEventName = `ph:set${capitalCase(key)}`;
|
|
@@ -51,7 +51,7 @@ function makePHEventFunctions(key) {
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
//#endregion
|
|
54
|
-
//#region ../reactor-browser/dist/document-by-id-
|
|
54
|
+
//#region ../reactor-browser/dist/document-by-id-dLYFX-xz.js
|
|
55
55
|
async function queueActions(document, actionOrActions) {
|
|
56
56
|
if (!document) throw new Error("No document provided");
|
|
57
57
|
if (!actionOrActions) throw new Error("No actions provided");
|
|
@@ -196,6 +196,18 @@ function useDocument(id) {
|
|
|
196
196
|
const document = useSyncExternalStore((cb) => id && documentCache ? documentCache.subscribe(id, cb) : () => {}, () => id ? documentCache?.get(id) : void 0);
|
|
197
197
|
return document ? use(document) : void 0;
|
|
198
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* Returns a function to retrieve a document from the cache.
|
|
201
|
+
* The returned function fetches and returns a document by ID.
|
|
202
|
+
* @returns A function that takes a document ID and returns a Promise of the document
|
|
203
|
+
*/
|
|
204
|
+
function useGetDocument() {
|
|
205
|
+
const documentCache = useDocumentCache();
|
|
206
|
+
return useCallback((id) => {
|
|
207
|
+
if (!documentCache) return Promise.reject(/* @__PURE__ */ new Error("Document cache not initialized"));
|
|
208
|
+
return documentCache.get(id);
|
|
209
|
+
}, [documentCache]);
|
|
210
|
+
}
|
|
199
211
|
function useDispatch(document) {
|
|
200
212
|
/**
|
|
201
213
|
* Dispatches actions to the document.
|
|
@@ -214,7 +226,7 @@ function useDocumentById(id) {
|
|
|
214
226
|
return [document, dispatch];
|
|
215
227
|
}
|
|
216
228
|
//#endregion
|
|
217
|
-
//#region ../reactor-browser/dist/client-
|
|
229
|
+
//#region ../reactor-browser/dist/client-_Gh2Uf0E.js
|
|
218
230
|
const PhDocumentFieldsFragmentDoc = gql`
|
|
219
231
|
fragment PHDocumentFields on PHDocument {
|
|
220
232
|
id
|
|
@@ -282,13 +294,6 @@ const GetDocumentWithOperationsDocument = gql`
|
|
|
282
294
|
timestampUtcMs
|
|
283
295
|
input
|
|
284
296
|
scope
|
|
285
|
-
attachments {
|
|
286
|
-
data
|
|
287
|
-
mimeType
|
|
288
|
-
hash
|
|
289
|
-
extension
|
|
290
|
-
fileName
|
|
291
|
-
}
|
|
292
297
|
context {
|
|
293
298
|
signer {
|
|
294
299
|
user {
|
|
@@ -401,13 +406,6 @@ const GetDocumentOperationsDocument = gql`
|
|
|
401
406
|
timestampUtcMs
|
|
402
407
|
input
|
|
403
408
|
scope
|
|
404
|
-
attachments {
|
|
405
|
-
data
|
|
406
|
-
mimeType
|
|
407
|
-
hash
|
|
408
|
-
extension
|
|
409
|
-
fileName
|
|
410
|
-
}
|
|
411
409
|
context {
|
|
412
410
|
signer {
|
|
413
411
|
user {
|
|
@@ -658,13 +656,6 @@ gql`
|
|
|
658
656
|
timestampUtcMs
|
|
659
657
|
input
|
|
660
658
|
scope
|
|
661
|
-
attachments {
|
|
662
|
-
data
|
|
663
|
-
mimeType
|
|
664
|
-
hash
|
|
665
|
-
extension
|
|
666
|
-
fileName
|
|
667
|
-
}
|
|
668
659
|
context {
|
|
669
660
|
signer {
|
|
670
661
|
user {
|
|
@@ -746,7 +737,7 @@ function extractQueryParts(doc, fallbackBody) {
|
|
|
746
737
|
extractSelectionSet(GetDocumentOperationsDocument, "documentOperations", "{ items { index } }");
|
|
747
738
|
extractQueryParts(GetDocumentDocument, "document(identifier: $identifier) { document { id name documentType state revisionsList { scope revision } createdAtUtcIso lastModifiedAtUtcIso } childIds }");
|
|
748
739
|
//#endregion
|
|
749
|
-
//#region ../reactor-browser/dist/renown-
|
|
740
|
+
//#region ../reactor-browser/dist/renown-D-1c_Bvx.js
|
|
750
741
|
const { useValue: useLoading, setValue: setLoading, addEventHandler: addLoadingEventHandler } = makePHEventFunctions("loading");
|
|
751
742
|
const renownEventFunctions = makePHEventFunctions("renown");
|
|
752
743
|
renownEventFunctions.addEventHandler;
|
|
@@ -2509,14 +2500,30 @@ async function exportFile(document, suggestedName) {
|
|
|
2509
2500
|
if (!(e instanceof DOMException && e.name === "AbortError")) throw e;
|
|
2510
2501
|
}
|
|
2511
2502
|
}
|
|
2503
|
+
/**
|
|
2504
|
+
* Loads a document file and replays it with version-aware reducers from the registry.
|
|
2505
|
+
* Falls back to single-version legacy replay when no upgrade manifest is registered for
|
|
2506
|
+
* the document type.
|
|
2507
|
+
*/
|
|
2512
2508
|
async function loadFile(path) {
|
|
2513
2509
|
const baseDocument = await baseLoadFromInput(path, (state) => state, { checkHashes: true });
|
|
2514
2510
|
const reactorClient = window.ph?.reactorClient;
|
|
2515
2511
|
if (!reactorClient) throw new Error("ReactorClient not initialized");
|
|
2512
|
+
const documentType = baseDocument.header.documentType;
|
|
2516
2513
|
const { results: documentModelModules } = await reactorClient.getDocumentModelModules();
|
|
2517
|
-
const
|
|
2518
|
-
if (
|
|
2519
|
-
|
|
2514
|
+
const modulesForType = documentModelModules.filter((module) => module.documentModel.global.id === documentType);
|
|
2515
|
+
if (modulesForType.length === 0) throw new DocumentModelNotFoundError(documentType);
|
|
2516
|
+
const reducers = {};
|
|
2517
|
+
for (const module of modulesForType) reducers[module.version ?? 1] = module.reducer;
|
|
2518
|
+
const registry = window.ph?.reactorClientModule?.reactorModule?.documentModelRegistry;
|
|
2519
|
+
let upgradeManifest;
|
|
2520
|
+
if (registry) try {
|
|
2521
|
+
upgradeManifest = registry.getUpgradeManifest(documentType);
|
|
2522
|
+
} catch {}
|
|
2523
|
+
return baseLoadFromInputVersioned(path, {
|
|
2524
|
+
reducers,
|
|
2525
|
+
upgradeManifest
|
|
2526
|
+
});
|
|
2520
2527
|
}
|
|
2521
2528
|
async function addDocument(driveId, name, documentType, parentFolder, document, id, preferredEditor) {
|
|
2522
2529
|
const { isAllowedToCreateDocuments } = getUserPermissions();
|
|
@@ -2638,9 +2645,28 @@ async function moveNode$1(driveId, src, target) {
|
|
|
2638
2645
|
targetParentFolder: target?.id
|
|
2639
2646
|
})]);
|
|
2640
2647
|
}
|
|
2648
|
+
/**
|
|
2649
|
+
* Duplicates a document under a new id using version-aware replay.
|
|
2650
|
+
* Falls back gracefully when no upgrade manifest is registered for the document type.
|
|
2651
|
+
*/
|
|
2641
2652
|
async function _duplicateDocument(reactor, document, newId = generateId()) {
|
|
2642
|
-
const
|
|
2643
|
-
|
|
2653
|
+
const documentType = document.header.documentType;
|
|
2654
|
+
const { results: allModules } = await reactor.getDocumentModelModules();
|
|
2655
|
+
const modulesForType = allModules.filter((m) => m.documentModel.global.id === documentType);
|
|
2656
|
+
const reducers = {};
|
|
2657
|
+
for (const m of modulesForType) reducers[m.version ?? 1] = m.reducer;
|
|
2658
|
+
if (Object.keys(reducers).length === 0) throw new Error(`Document model module not found for type: ${documentType}`);
|
|
2659
|
+
const registry = window.ph?.reactorClientModule?.reactorModule?.documentModelRegistry;
|
|
2660
|
+
let upgradeManifest;
|
|
2661
|
+
if (registry) try {
|
|
2662
|
+
upgradeManifest = registry.getUpgradeManifest(documentType);
|
|
2663
|
+
} catch {}
|
|
2664
|
+
const config = {
|
|
2665
|
+
reducers,
|
|
2666
|
+
upgradeManifest
|
|
2667
|
+
};
|
|
2668
|
+
const header = createPresignedHeader(newId, documentType);
|
|
2669
|
+
return replayDocumentVersioned(document.initialState, document.operations, config, header);
|
|
2644
2670
|
}
|
|
2645
2671
|
async function copyNode$1(driveId, src, target) {
|
|
2646
2672
|
const reactor = window.ph?.reactorClient;
|
|
@@ -2680,6 +2706,29 @@ async function copyNode$1(driveId, src, target) {
|
|
|
2680
2706
|
}
|
|
2681
2707
|
return await queueActions(drive, copyNodesInput.map((copyNodeInput) => copyNode(copyNodeInput)));
|
|
2682
2708
|
}
|
|
2709
|
+
const modalEventFunctions = makePHEventFunctions("modal");
|
|
2710
|
+
modalEventFunctions.useValue;
|
|
2711
|
+
/** Sets the current modal */
|
|
2712
|
+
const setPHModal = modalEventFunctions.setValue;
|
|
2713
|
+
modalEventFunctions.addEventHandler;
|
|
2714
|
+
/** Shows a modal */
|
|
2715
|
+
function showPHModal(modal) {
|
|
2716
|
+
setPHModal(modal);
|
|
2717
|
+
}
|
|
2718
|
+
/** Shows the create document modal */
|
|
2719
|
+
function showCreateDocumentModal(documentType) {
|
|
2720
|
+
setPHModal({
|
|
2721
|
+
type: "createDocument",
|
|
2722
|
+
documentType
|
|
2723
|
+
});
|
|
2724
|
+
}
|
|
2725
|
+
/** Shows the delete node modal */
|
|
2726
|
+
function showDeleteNodeModal(nodeOrId) {
|
|
2727
|
+
setPHModal({
|
|
2728
|
+
type: "deleteItem",
|
|
2729
|
+
id: typeof nodeOrId === "string" ? nodeOrId : nodeOrId.id
|
|
2730
|
+
});
|
|
2731
|
+
}
|
|
2683
2732
|
const baseDocumentModelsMap = {
|
|
2684
2733
|
DocumentModel: documentModelDocumentModelModule,
|
|
2685
2734
|
DocumentDrive: driveDocumentModelModule,
|
|
@@ -3204,29 +3253,6 @@ const graphQLReactorClientEventFunctions = makePHEventFunctions("reactorGraphQLC
|
|
|
3204
3253
|
graphQLReactorClientEventFunctions.useValue;
|
|
3205
3254
|
graphQLReactorClientEventFunctions.setValue;
|
|
3206
3255
|
graphQLReactorClientEventFunctions.addEventHandler;
|
|
3207
|
-
const modalEventFunctions = makePHEventFunctions("modal");
|
|
3208
|
-
modalEventFunctions.useValue;
|
|
3209
|
-
/** Sets the current modal */
|
|
3210
|
-
const setPHModal = modalEventFunctions.setValue;
|
|
3211
|
-
modalEventFunctions.addEventHandler;
|
|
3212
|
-
/** Shows a modal */
|
|
3213
|
-
function showPHModal(modal) {
|
|
3214
|
-
setPHModal(modal);
|
|
3215
|
-
}
|
|
3216
|
-
/** Shows the create document modal */
|
|
3217
|
-
function showCreateDocumentModal(documentType) {
|
|
3218
|
-
setPHModal({
|
|
3219
|
-
type: "createDocument",
|
|
3220
|
-
documentType
|
|
3221
|
-
});
|
|
3222
|
-
}
|
|
3223
|
-
/** Shows the delete node modal */
|
|
3224
|
-
function showDeleteNodeModal(nodeOrId) {
|
|
3225
|
-
setPHModal({
|
|
3226
|
-
type: "deleteItem",
|
|
3227
|
-
id: typeof nodeOrId === "string" ? nodeOrId : nodeOrId.id
|
|
3228
|
-
});
|
|
3229
|
-
}
|
|
3230
3256
|
const packageDiscoveryFunctions = makePHEventFunctions("packageDiscoveryService");
|
|
3231
3257
|
packageDiscoveryFunctions.useValue;
|
|
3232
3258
|
packageDiscoveryFunctions.setValue;
|
|
@@ -3431,9 +3457,17 @@ function downloadDocument(document, handleError = defaultHandleError) {
|
|
|
3431
3457
|
exportFile(document).catch((error) => handleError(normalizeException(error)));
|
|
3432
3458
|
}
|
|
3433
3459
|
function useDownloadDocument(id) {
|
|
3434
|
-
const
|
|
3460
|
+
const getDocument = useGetDocument();
|
|
3435
3461
|
const toast = usePHToast();
|
|
3436
|
-
return
|
|
3462
|
+
return async () => {
|
|
3463
|
+
if (!id) return;
|
|
3464
|
+
const handleError = (error) => toast?.(`Failed to export document: ${error.message}`);
|
|
3465
|
+
try {
|
|
3466
|
+
downloadDocument(await getDocument(id), handleError);
|
|
3467
|
+
} catch (error) {
|
|
3468
|
+
handleError(error);
|
|
3469
|
+
}
|
|
3470
|
+
};
|
|
3437
3471
|
}
|
|
3438
3472
|
function useFolderById(id) {
|
|
3439
3473
|
return useFolderNodesInSelectedDrive()?.find((n) => n.id === id);
|
|
@@ -3669,12 +3703,12 @@ function useGetSwitchboardLink(document) {
|
|
|
3669
3703
|
const remotes = useSyncList();
|
|
3670
3704
|
const isRemoteDrive = useMemo(() => {
|
|
3671
3705
|
if (!e$4(drive)) return false;
|
|
3672
|
-
return remotes.some((remote) => remote.collectionId
|
|
3706
|
+
return remotes.some((remote) => remote.collectionId.equals(DriveCollectionId.forDrive(drive.header.id)));
|
|
3673
3707
|
}, [remotes, drive]);
|
|
3674
3708
|
const remoteUrl = useMemo(() => {
|
|
3675
3709
|
if (!e$4(drive)) return null;
|
|
3676
3710
|
try {
|
|
3677
|
-
const channelUrl = (remotes.find((remote) => remote.collectionId
|
|
3711
|
+
const channelUrl = (remotes.find((remote) => remote.collectionId.equals(DriveCollectionId.forDrive(drive.header.id)))?.channel)?.config.url;
|
|
3678
3712
|
if (typeof channelUrl === "string") return channelUrl;
|
|
3679
3713
|
return null;
|
|
3680
3714
|
} catch (error) {
|
|
@@ -3765,4 +3799,4 @@ createDebouncedRefreshReactorDataClient();
|
|
|
3765
3799
|
//#endregion
|
|
3766
3800
|
export { e$4 as A, useSelectedDriveSafe as C, useTheme as D, useSetPHDocumentEditorConfig as E, t$5 as M, useDocumentById as N, useUserPermissions as O, useSelectedDriveId as S, useSetPHAppConfig as T, useNodeParentFolderById as _, setSelectedDrive as a, useSelectedDocumentOfType as b, showDeleteNodeModal as c, useDownloadDocument as d, useDragNode as f, useNodeById as g, useNodeActions as h, isFolderNodeKind as i, t$2 as j, e$1 as k, showRevisionHistory as l, useGetSwitchboardLink as m, getSyncStatusSync as n, setSelectedNode as o, useDropNode as p, isFileNodeKind as r, showCreateDocumentModal as s, addFolder as t, useDocumentModelModules as u, useNodesInSelectedDriveOrFolder as v, useSelectedNodePath as w, useSelectedDocumentSafe as x, usePHToast as y };
|
|
3767
3801
|
|
|
3768
|
-
//# sourceMappingURL=dist-
|
|
3802
|
+
//# sourceMappingURL=dist-HgA907mh.js.map
|