@powerhousedao/connect 6.0.0-dev.17 → 6.0.0-dev.171
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/.env +1 -1
- package/dist/AddDriveModal-CBK9gEWg.js +89 -0
- package/dist/AddDriveModal-CBK9gEWg.js.map +1 -0
- package/dist/ClearStorageModal-Cnkx_Zib.js +44 -0
- package/dist/ClearStorageModal-Cnkx_Zib.js.map +1 -0
- package/dist/CookiesPolicyModal-Gae1QuhA.js +30 -0
- package/dist/CookiesPolicyModal-Gae1QuhA.js.map +1 -0
- package/dist/CreateDocumentModal-5i6rmv3C.js +28 -0
- package/dist/CreateDocumentModal-5i6rmv3C.js.map +1 -0
- package/dist/DebugSettingsModal-ZNWhlMQN.js +139 -0
- package/dist/DebugSettingsModal-ZNWhlMQN.js.map +1 -0
- package/dist/DeleteDriveModal-BbAx_yXt.js +40 -0
- package/dist/DeleteDriveModal-BbAx_yXt.js.map +1 -0
- package/dist/DeleteItemModal-CkWegLlh.js +39 -0
- package/dist/DeleteItemModal-CkWegLlh.js.map +1 -0
- package/dist/DisclaimerModal-CCnvwoB5.js +21 -0
- package/dist/DisclaimerModal-CCnvwoB5.js.map +1 -0
- package/dist/DriveSettingsModal-DxMjOsLg.js +45 -0
- package/dist/DriveSettingsModal-DxMjOsLg.js.map +1 -0
- package/dist/ExportDocumentWithErrorsModal-hgliF8Gy.js +41 -0
- package/dist/ExportDocumentWithErrorsModal-hgliF8Gy.js.map +1 -0
- package/dist/InspectorModal-C4rE0Y5E.js +302 -0
- package/dist/InspectorModal-C4rE0Y5E.js.map +1 -0
- package/dist/MissingPackageModal-cr5tZDVw.js +34 -0
- package/dist/MissingPackageModal-cr5tZDVw.js.map +1 -0
- package/dist/SettingsModal-BWv4qBkA.js +153 -0
- package/dist/SettingsModal-BWv4qBkA.js.map +1 -0
- package/dist/UpgradeDriveModal-DldcNCaT.js +31 -0
- package/dist/UpgradeDriveModal-DldcNCaT.js.map +1 -0
- package/dist/connect.config-DDu1QWU1.js +140 -0
- package/dist/connect.config-DDu1QWU1.js.map +1 -0
- package/dist/i18n-Ch408v5-.js +125 -0
- package/dist/i18n-Ch408v5-.js.map +1 -0
- package/dist/load-y1TEmGbv.js +105 -0
- package/dist/load-y1TEmGbv.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +9 -0
- package/dist/main.js.map +1 -0
- package/dist/package-AkcEoXtb.js +111 -0
- package/dist/package-AkcEoXtb.js.map +1 -0
- package/dist/pglite.worker.d.ts +1 -0
- package/dist/pglite.worker.js +15 -0
- package/dist/pglite.worker.js.map +1 -0
- package/dist/reactor-DOl6niiA.js +714 -0
- package/dist/reactor-DOl6niiA.js.map +1 -0
- package/dist/registerServiceWorker-19nMRUMW.js +76 -0
- package/dist/registerServiceWorker-19nMRUMW.js.map +1 -0
- package/dist/sidebar-DYMh6f3u.js +1209 -0
- package/dist/sidebar-DYMh6f3u.js.map +1 -0
- package/dist/start-connect.d.ts +13 -0
- package/dist/start-connect.d.ts.map +1 -0
- package/dist/start-connect.js +16 -0
- package/dist/start-connect.js.map +1 -0
- package/{lib → dist}/style.css +2099 -434
- package/dist/toast-iD-70hL8.js +16 -0
- package/dist/toast-iD-70hL8.js.map +1 -0
- package/dist/useRegistryPackages-DSzf8iPN.js +87 -0
- package/dist/useRegistryPackages-DSzf8iPN.js.map +1 -0
- package/package.json +55 -122
- package/public/ph-packages.json +3 -0
- package/dist/assets/AddDriveModal-Dqn9Co_0.js +0 -1
- package/dist/assets/ClearStorageModal-Dk7N14wC.js +0 -1
- package/dist/assets/CookiesPolicyModal-465KDLP0.js +0 -1
- package/dist/assets/CreateDocumentModal-C5jLPcYQ.js +0 -1
- package/dist/assets/DebugSettingsModal-W_Vm2gQy.js +0 -1
- package/dist/assets/DeleteDriveModal-BhFCY7SQ.js +0 -1
- package/dist/assets/DeleteItemModal-DEdTqFnT.js +0 -1
- package/dist/assets/DisclaimerModal-U1k5HcV1.js +0 -1
- package/dist/assets/DriveSettingsModal-B1mhCsvH.js +0 -1
- package/dist/assets/ExportDocumentWithErrorsModal-C41gIUKY.js +0 -1
- package/dist/assets/SettingsModal-D9MF9l88.js +0 -1
- package/dist/assets/UpgradeDriveModal-C2rmKIxX.js +0 -1
- package/dist/assets/_virtual_ph_external-packages-CM1tCR4L.js +0 -1
- package/dist/assets/config-CU-aFfVJ.js +0 -1
- package/dist/assets/connect-loader-CvOC68Ih.mp4 +0 -0
- package/dist/assets/design_system-DCj2tmXv.js +0 -45
- package/dist/assets/design_system_connect-D_xz4EWZ.js +0 -47
- package/dist/assets/design_system_ui-CQGjBWi6.js +0 -1
- package/dist/assets/document_drive-Bubv8iix.js +0 -316
- package/dist/assets/document_engineering-CIFVB950.js +0 -1
- package/dist/assets/document_model-_oCbt5YE.js +0 -230
- package/dist/assets/document_model_editor-zVEvY7cY.js +0 -25
- package/dist/assets/drive_explorer-iBqFmekh.js +0 -2
- package/dist/assets/graphql-AKTCpY7l.js +0 -75
- package/dist/assets/graphql-editor-BRxT7Nzk.js +0 -73
- package/dist/assets/graphql_request-BJtmW2JS.js +0 -3
- package/dist/assets/hmr-LMNkvzP7.js +0 -1
- package/dist/assets/home-bg-BEhF9NuW.png +0 -0
- package/dist/assets/home-bg-BRYzhkhi.avif +0 -0
- package/dist/assets/hooks-D6Z1Dfxy.js +0 -12
- package/dist/assets/index-Bh65PeM1.js +0 -28
- package/dist/assets/index-CLZqok5P.js +0 -18
- package/dist/assets/index-DYdiZMfn.css +0 -1
- package/dist/assets/json-editor-DmgOw94P.js +0 -1
- package/dist/assets/nodefs-BmsxYpi6.js +0 -1
- package/dist/assets/opfs-ahp-Bj-Yp0Fk.js +0 -3
- package/dist/assets/pg_dump-CW0pN9tG.wasm +0 -0
- package/dist/assets/postgres-CkP7QCDB.data +0 -0
- package/dist/assets/postgres-CyuUVpXN.wasm +0 -0
- package/dist/assets/powerhouse-rounded-CeKGGUG4.png +0 -0
- package/dist/assets/react/jsx-runtime-DldvXD6N.js +0 -1
- package/dist/assets/react-DQSxOgtG.js +0 -1
- package/dist/assets/react-dom/client-BVPiT_FE.js +0 -9
- package/dist/assets/react-dom-D6zQJsh6.js +0 -1
- package/dist/assets/reactor_browser-D3Dc09P6.js +0 -129
- package/dist/assets/renown-short-hover-BiSLBV7L.png +0 -0
- package/dist/assets/rwa-report-Bb0W5-ac.png +0 -0
- package/dist/assets/sentry_browser-B4YoBIIG.js +0 -498
- package/dist/assets/sentry_react-cODD7zWc.js +0 -3
- package/dist/assets/state-schemas-yBYnV2ER.js +0 -2
- package/dist/assets/tailwind_merge-Dr4f9Rms.js +0 -1
- package/dist/assets/zod-9j67vCAu.js +0 -39
- package/dist/icon.ico +0 -0
- package/dist/index.html +0 -51
- package/dist/robots.txt +0 -3
- package/dist/settings.png +0 -0
- package/heroku/Dockerfile +0 -101
- package/heroku/Procfile +0 -1
- package/heroku/config/nginx.conf.template +0 -77
- package/heroku/heroku-entrypoint.sh +0 -38
- package/lib/cypress/e2e/navigation.cy.d.ts +0 -2
- package/lib/cypress/e2e/navigation.cy.d.ts.map +0 -1
- package/lib/cypress/e2e/navigation.cy.js +0 -221
- package/lib/cypress/e2e/navigation.cy.js.map +0 -1
- package/lib/cypress/e2e/utils/index.d.ts +0 -15
- package/lib/cypress/e2e/utils/index.d.ts.map +0 -1
- package/lib/cypress/e2e/utils/index.js +0 -121
- package/lib/cypress/e2e/utils/index.js.map +0 -1
- package/lib/cypress/support/commands.d.ts +0 -2
- package/lib/cypress/support/commands.d.ts.map +0 -1
- package/lib/cypress/support/commands.js +0 -29
- package/lib/cypress/support/commands.js.map +0 -1
- package/lib/cypress/support/e2e.d.ts +0 -2
- package/lib/cypress/support/e2e.d.ts.map +0 -1
- package/lib/cypress/support/e2e.js +0 -19
- package/lib/cypress/support/e2e.js.map +0 -1
- package/lib/cypress.config.d.ts +0 -3
- package/lib/cypress.config.d.ts.map +0 -1
- package/lib/cypress.config.js +0 -15
- package/lib/cypress.config.js.map +0 -1
- package/lib/package.copy.json +0 -177
- package/lib/scripts/render-skeleton.d.ts +0 -2
- package/lib/scripts/render-skeleton.d.ts.map +0 -1
- package/lib/scripts/render-skeleton.js +0 -11
- package/lib/scripts/render-skeleton.js.map +0 -1
- package/lib/src/components/analytics.d.ts +0 -8
- package/lib/src/components/analytics.d.ts.map +0 -1
- package/lib/src/components/analytics.js +0 -30
- package/lib/src/components/analytics.js.map +0 -1
- package/lib/src/components/app-loader.d.ts +0 -3
- package/lib/src/components/app-loader.d.ts.map +0 -1
- package/lib/src/components/app-loader.js +0 -20
- package/lib/src/components/app-loader.js.map +0 -1
- package/lib/src/components/app-skeleton.d.ts +0 -3
- package/lib/src/components/app-skeleton.d.ts.map +0 -1
- package/lib/src/components/app-skeleton.js +0 -38
- package/lib/src/components/app-skeleton.js.map +0 -1
- package/lib/src/components/app.d.ts +0 -2
- package/lib/src/components/app.d.ts.map +0 -1
- package/lib/src/components/app.js +0 -29
- package/lib/src/components/app.js.map +0 -1
- package/lib/src/components/button.d.ts +0 -3
- package/lib/src/components/button.d.ts.map +0 -1
- package/lib/src/components/button.js +0 -7
- package/lib/src/components/button.js.map +0 -1
- package/lib/src/components/cookie-banner.d.ts +0 -2
- package/lib/src/components/cookie-banner.d.ts.map +0 -1
- package/lib/src/components/cookie-banner.js +0 -48
- package/lib/src/components/cookie-banner.js.map +0 -1
- package/lib/src/components/document-editor-container.d.ts +0 -2
- package/lib/src/components/document-editor-container.d.ts.map +0 -1
- package/lib/src/components/document-editor-container.js +0 -65
- package/lib/src/components/document-editor-container.js.map +0 -1
- package/lib/src/components/dots-loader.d.ts +0 -2
- package/lib/src/components/dots-loader.d.ts.map +0 -1
- package/lib/src/components/dots-loader.js +0 -15
- package/lib/src/components/dots-loader.js.map +0 -1
- package/lib/src/components/drive-editor-container.d.ts +0 -2
- package/lib/src/components/drive-editor-container.d.ts.map +0 -1
- package/lib/src/components/drive-editor-container.js +0 -22
- package/lib/src/components/drive-editor-container.js.map +0 -1
- package/lib/src/components/drive-icon.d.ts +0 -5
- package/lib/src/components/drive-icon.d.ts.map +0 -1
- package/lib/src/components/drive-icon.js +0 -15
- package/lib/src/components/drive-icon.js.map +0 -1
- package/lib/src/components/editor-loader.d.ts +0 -9
- package/lib/src/components/editor-loader.d.ts.map +0 -1
- package/lib/src/components/editor-loader.js +0 -19
- package/lib/src/components/editor-loader.js.map +0 -1
- package/lib/src/components/editors.d.ts +0 -10
- package/lib/src/components/editors.d.ts.map +0 -1
- package/lib/src/components/editors.js +0 -87
- package/lib/src/components/editors.js.map +0 -1
- package/lib/src/components/error-boundary.d.ts +0 -103
- package/lib/src/components/error-boundary.d.ts.map +0 -1
- package/lib/src/components/error-boundary.js +0 -104
- package/lib/src/components/error-boundary.js.map +0 -1
- package/lib/src/components/footer.d.ts +0 -2
- package/lib/src/components/footer.d.ts.map +0 -1
- package/lib/src/components/footer.js +0 -16
- package/lib/src/components/footer.js.map +0 -1
- package/lib/src/components/index.d.ts +0 -22
- package/lib/src/components/index.d.ts.map +0 -1
- package/lib/src/components/index.js +0 -22
- package/lib/src/components/index.js.map +0 -1
- package/lib/src/components/login.d.ts +0 -2
- package/lib/src/components/login.d.ts.map +0 -1
- package/lib/src/components/login.js +0 -12
- package/lib/src/components/login.js.map +0 -1
- package/lib/src/components/modal/index.d.ts +0 -18
- package/lib/src/components/modal/index.d.ts.map +0 -1
- package/lib/src/components/modal/index.js +0 -18
- package/lib/src/components/modal/index.js.map +0 -1
- package/lib/src/components/modal/modals/AddDriveModal.d.ts +0 -2
- package/lib/src/components/modal/modals/AddDriveModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/AddDriveModal.js +0 -121
- package/lib/src/components/modal/modals/AddDriveModal.js.map +0 -1
- package/lib/src/components/modal/modals/ClearStorageModal.d.ts +0 -2
- package/lib/src/components/modal/modals/ClearStorageModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/ClearStorageModal.js +0 -35
- package/lib/src/components/modal/modals/ClearStorageModal.js.map +0 -1
- package/lib/src/components/modal/modals/CookiesPolicyModal.d.ts +0 -2
- package/lib/src/components/modal/modals/CookiesPolicyModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/CookiesPolicyModal.js +0 -16
- package/lib/src/components/modal/modals/CookiesPolicyModal.js.map +0 -1
- package/lib/src/components/modal/modals/CreateDocumentModal.d.ts +0 -2
- package/lib/src/components/modal/modals/CreateDocumentModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/CreateDocumentModal.js +0 -24
- package/lib/src/components/modal/modals/CreateDocumentModal.js.map +0 -1
- package/lib/src/components/modal/modals/DebugSettingsModal.d.ts +0 -2
- package/lib/src/components/modal/modals/DebugSettingsModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/DebugSettingsModal.js +0 -108
- package/lib/src/components/modal/modals/DebugSettingsModal.js.map +0 -1
- package/lib/src/components/modal/modals/DeleteDriveModal.d.ts +0 -2
- package/lib/src/components/modal/modals/DeleteDriveModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/DeleteDriveModal.js +0 -32
- package/lib/src/components/modal/modals/DeleteDriveModal.js.map +0 -1
- package/lib/src/components/modal/modals/DeleteItemModal.d.ts +0 -3
- package/lib/src/components/modal/modals/DeleteItemModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/DeleteItemModal.js +0 -33
- package/lib/src/components/modal/modals/DeleteItemModal.js.map +0 -1
- package/lib/src/components/modal/modals/DisclaimerModal.d.ts +0 -3
- package/lib/src/components/modal/modals/DisclaimerModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/DisclaimerModal.js +0 -12
- package/lib/src/components/modal/modals/DisclaimerModal.js.map +0 -1
- package/lib/src/components/modal/modals/DriveSettingsModal.d.ts +0 -2
- package/lib/src/components/modal/modals/DriveSettingsModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/DriveSettingsModal.js +0 -28
- package/lib/src/components/modal/modals/DriveSettingsModal.js.map +0 -1
- package/lib/src/components/modal/modals/ExportDocumentWithErrorsModal.d.ts +0 -2
- package/lib/src/components/modal/modals/ExportDocumentWithErrorsModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/ExportDocumentWithErrorsModal.js +0 -30
- package/lib/src/components/modal/modals/ExportDocumentWithErrorsModal.js.map +0 -1
- package/lib/src/components/modal/modals/InspectorModal/InspectorModal.d.ts +0 -2
- package/lib/src/components/modal/modals/InspectorModal/InspectorModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/InspectorModal/InspectorModal.js +0 -29
- package/lib/src/components/modal/modals/InspectorModal/InspectorModal.js.map +0 -1
- package/lib/src/components/modal/modals/InspectorModal/index.d.ts +0 -2
- package/lib/src/components/modal/modals/InspectorModal/index.d.ts.map +0 -1
- package/lib/src/components/modal/modals/InspectorModal/index.js +0 -2
- package/lib/src/components/modal/modals/InspectorModal/index.js.map +0 -1
- package/lib/src/components/modal/modals/InspectorModal/useDbExplorer.d.ts +0 -31
- package/lib/src/components/modal/modals/InspectorModal/useDbExplorer.d.ts.map +0 -1
- package/lib/src/components/modal/modals/InspectorModal/useDbExplorer.js +0 -211
- package/lib/src/components/modal/modals/InspectorModal/useDbExplorer.js.map +0 -1
- package/lib/src/components/modal/modals/InspectorModal/useRemotesInspector.d.ts +0 -4
- package/lib/src/components/modal/modals/InspectorModal/useRemotesInspector.d.ts.map +0 -1
- package/lib/src/components/modal/modals/InspectorModal/useRemotesInspector.js +0 -12
- package/lib/src/components/modal/modals/InspectorModal/useRemotesInspector.js.map +0 -1
- package/lib/src/components/modal/modals/SettingsModal.d.ts +0 -3
- package/lib/src/components/modal/modals/SettingsModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/SettingsModal.js +0 -45
- package/lib/src/components/modal/modals/SettingsModal.js.map +0 -1
- package/lib/src/components/modal/modals/UpgradeDriveModal.d.ts +0 -3
- package/lib/src/components/modal/modals/UpgradeDriveModal.d.ts.map +0 -1
- package/lib/src/components/modal/modals/UpgradeDriveModal.js +0 -21
- package/lib/src/components/modal/modals/UpgradeDriveModal.js.map +0 -1
- package/lib/src/components/modal/modals/settings/about.d.ts +0 -2
- package/lib/src/components/modal/modals/settings/about.d.ts.map +0 -1
- package/lib/src/components/modal/modals/settings/about.js +0 -10
- package/lib/src/components/modal/modals/settings/about.js.map +0 -1
- package/lib/src/components/modal/modals/settings/danger-zone.d.ts +0 -2
- package/lib/src/components/modal/modals/settings/danger-zone.d.ts.map +0 -1
- package/lib/src/components/modal/modals/settings/danger-zone.js +0 -15
- package/lib/src/components/modal/modals/settings/danger-zone.js.map +0 -1
- package/lib/src/components/modal/modals/settings/default-editor.d.ts +0 -2
- package/lib/src/components/modal/modals/settings/default-editor.d.ts.map +0 -1
- package/lib/src/components/modal/modals/settings/default-editor.js +0 -18
- package/lib/src/components/modal/modals/settings/default-editor.js.map +0 -1
- package/lib/src/components/modal/modals/settings/package-manager.d.ts +0 -3
- package/lib/src/components/modal/modals/settings/package-manager.d.ts.map +0 -1
- package/lib/src/components/modal/modals/settings/package-manager.js +0 -87
- package/lib/src/components/modal/modals/settings/package-manager.js.map +0 -1
- package/lib/src/components/modal/modals-container.d.ts +0 -2
- package/lib/src/components/modal/modals-container.d.ts.map +0 -1
- package/lib/src/components/modal/modals-container.js +0 -66
- package/lib/src/components/modal/modals-container.js.map +0 -1
- package/lib/src/components/ph-logo.d.ts +0 -2
- package/lib/src/components/ph-logo.d.ts.map +0 -1
- package/lib/src/components/ph-logo.js +0 -7
- package/lib/src/components/ph-logo.js.map +0 -1
- package/lib/src/components/reload-connect-toast.d.ts +0 -2
- package/lib/src/components/reload-connect-toast.d.ts.map +0 -1
- package/lib/src/components/reload-connect-toast.js +0 -7
- package/lib/src/components/reload-connect-toast.js.map +0 -1
- package/lib/src/components/root.d.ts +0 -2
- package/lib/src/components/root.d.ts.map +0 -1
- package/lib/src/components/root.js +0 -8
- package/lib/src/components/root.js.map +0 -1
- package/lib/src/components/router.d.ts +0 -2
- package/lib/src/components/router.d.ts.map +0 -1
- package/lib/src/components/router.js +0 -41
- package/lib/src/components/router.js.map +0 -1
- package/lib/src/components/search-bar.d.ts +0 -2
- package/lib/src/components/search-bar.d.ts.map +0 -1
- package/lib/src/components/search-bar.js +0 -36
- package/lib/src/components/search-bar.js.map +0 -1
- package/lib/src/components/sidebar.d.ts +0 -2
- package/lib/src/components/sidebar.d.ts.map +0 -1
- package/lib/src/components/sidebar.js +0 -28
- package/lib/src/components/sidebar.js.map +0 -1
- package/lib/src/connect.config.d.ts +0 -115
- package/lib/src/connect.config.d.ts.map +0 -1
- package/lib/src/connect.config.js +0 -148
- package/lib/src/connect.config.js.map +0 -1
- package/lib/src/context/index.d.ts +0 -4
- package/lib/src/context/index.d.ts.map +0 -1
- package/lib/src/context/index.js +0 -4
- package/lib/src/context/index.js.map +0 -1
- package/lib/src/context/processor-manager.d.ts +0 -3
- package/lib/src/context/processor-manager.d.ts.map +0 -1
- package/lib/src/context/processor-manager.js +0 -189
- package/lib/src/context/processor-manager.js.map +0 -1
- package/lib/src/context/read-mode.d.ts +0 -2
- package/lib/src/context/read-mode.d.ts.map +0 -1
- package/lib/src/context/read-mode.js +0 -219
- package/lib/src/context/read-mode.js.map +0 -1
- package/lib/src/context/sentry-provider.d.ts +0 -6
- package/lib/src/context/sentry-provider.d.ts.map +0 -1
- package/lib/src/context/sentry-provider.js +0 -6
- package/lib/src/context/sentry-provider.js.map +0 -1
- package/lib/src/feature-flags.d.ts +0 -53
- package/lib/src/feature-flags.d.ts.map +0 -1
- package/lib/src/feature-flags.js +0 -186
- package/lib/src/feature-flags.js.map +0 -1
- package/lib/src/globals.d.ts +0 -9
- package/lib/src/globals.d.ts.map +0 -1
- package/lib/src/globals.js +0 -2
- package/lib/src/globals.js.map +0 -1
- package/lib/src/hmr.d.ts +0 -3
- package/lib/src/hmr.d.ts.map +0 -1
- package/lib/src/hmr.js +0 -2
- package/lib/src/hmr.js.map +0 -1
- package/lib/src/hooks/index.d.ts +0 -10
- package/lib/src/hooks/index.d.ts.map +0 -1
- package/lib/src/hooks/index.js +0 -10
- package/lib/src/hooks/index.js.map +0 -1
- package/lib/src/hooks/useAcceptedCookies.d.ts +0 -9
- package/lib/src/hooks/useAcceptedCookies.d.ts.map +0 -1
- package/lib/src/hooks/useAcceptedCookies.js +0 -34
- package/lib/src/hooks/useAcceptedCookies.js.map +0 -1
- package/lib/src/hooks/useCheckLatestVersion.d.ts +0 -2
- package/lib/src/hooks/useCheckLatestVersion.d.ts.map +0 -1
- package/lib/src/hooks/useCheckLatestVersion.js +0 -33
- package/lib/src/hooks/useCheckLatestVersion.js.map +0 -1
- package/lib/src/hooks/useClientErrorHandler.d.ts +0 -6
- package/lib/src/hooks/useClientErrorHandler.d.ts.map +0 -1
- package/lib/src/hooks/useClientErrorHandler.js +0 -131
- package/lib/src/hooks/useClientErrorHandler.js.map +0 -1
- package/lib/src/hooks/useCookieBanner.d.ts +0 -5
- package/lib/src/hooks/useCookieBanner.d.ts.map +0 -1
- package/lib/src/hooks/useCookieBanner.js +0 -32
- package/lib/src/hooks/useCookieBanner.js.map +0 -1
- package/lib/src/hooks/useInitSentry.d.ts +0 -2
- package/lib/src/hooks/useInitSentry.d.ts.map +0 -1
- package/lib/src/hooks/useInitSentry.js +0 -80
- package/lib/src/hooks/useInitSentry.js.map +0 -1
- package/lib/src/hooks/useNodeActions.d.ts +0 -6
- package/lib/src/hooks/useNodeActions.d.ts.map +0 -1
- package/lib/src/hooks/useNodeActions.js +0 -35
- package/lib/src/hooks/useNodeActions.js.map +0 -1
- package/lib/src/hooks/useUndoRedoShortcuts.d.ts +0 -8
- package/lib/src/hooks/useUndoRedoShortcuts.d.ts.map +0 -1
- package/lib/src/hooks/useUndoRedoShortcuts.js +0 -26
- package/lib/src/hooks/useUndoRedoShortcuts.js.map +0 -1
- package/lib/src/hooks/useWindowSize.d.ts +0 -5
- package/lib/src/hooks/useWindowSize.d.ts.map +0 -1
- package/lib/src/hooks/useWindowSize.js +0 -21
- package/lib/src/hooks/useWindowSize.js.map +0 -1
- package/lib/src/hooks/utils.d.ts +0 -7
- package/lib/src/hooks/utils.d.ts.map +0 -1
- package/lib/src/hooks/utils.js +0 -46
- package/lib/src/hooks/utils.js.map +0 -1
- package/lib/src/i18n/index.d.ts +0 -4
- package/lib/src/i18n/index.d.ts.map +0 -1
- package/lib/src/i18n/index.js +0 -26
- package/lib/src/i18n/index.js.map +0 -1
- package/lib/src/i18n/locales/en.json +0 -114
- package/lib/src/index.d.ts +0 -2
- package/lib/src/index.d.ts.map +0 -1
- package/lib/src/index.js +0 -2
- package/lib/src/index.js.map +0 -1
- package/lib/src/main.d.ts +0 -2
- package/lib/src/main.d.ts.map +0 -1
- package/lib/src/main.js +0 -5
- package/lib/src/main.js.map +0 -1
- package/lib/src/pages/content.d.ts +0 -2
- package/lib/src/pages/content.d.ts.map +0 -1
- package/lib/src/pages/content.js +0 -39
- package/lib/src/pages/content.js.map +0 -1
- package/lib/src/pages/demo/atlas-import.d.ts +0 -2
- package/lib/src/pages/demo/atlas-import.d.ts.map +0 -1
- package/lib/src/pages/demo/atlas-import.js +0 -122
- package/lib/src/pages/demo/atlas-import.js.map +0 -1
- package/lib/src/pages/index.d.ts +0 -4
- package/lib/src/pages/index.d.ts.map +0 -1
- package/lib/src/pages/index.js +0 -4
- package/lib/src/pages/index.js.map +0 -1
- package/lib/src/pages/settings.d.ts +0 -4
- package/lib/src/pages/settings.d.ts.map +0 -1
- package/lib/src/pages/settings.js +0 -9
- package/lib/src/pages/settings.js.map +0 -1
- package/lib/src/service-worker.d.ts +0 -2
- package/lib/src/service-worker.d.ts.map +0 -1
- package/lib/src/service-worker.js +0 -58
- package/lib/src/service-worker.js.map +0 -1
- package/lib/src/services/hmr.d.ts +0 -13
- package/lib/src/services/hmr.d.ts.map +0 -1
- package/lib/src/services/hmr.js +0 -85
- package/lib/src/services/hmr.js.map +0 -1
- package/lib/src/services/index.d.ts +0 -10
- package/lib/src/services/index.d.ts.map +0 -1
- package/lib/src/services/index.js +0 -9
- package/lib/src/services/index.js.map +0 -1
- package/lib/src/services/logger.d.ts +0 -2
- package/lib/src/services/logger.d.ts.map +0 -1
- package/lib/src/services/logger.js +0 -28
- package/lib/src/services/logger.js.map +0 -1
- package/lib/src/services/renown/browser.d.ts +0 -2
- package/lib/src/services/renown/browser.d.ts.map +0 -1
- package/lib/src/services/renown/browser.js +0 -6
- package/lib/src/services/renown/browser.js.map +0 -1
- package/lib/src/services/renown/constants.d.ts +0 -130
- package/lib/src/services/renown/constants.d.ts.map +0 -1
- package/lib/src/services/renown/constants.js +0 -41
- package/lib/src/services/renown/constants.js.map +0 -1
- package/lib/src/services/renown/utils.d.ts +0 -7
- package/lib/src/services/renown/utils.d.ts.map +0 -1
- package/lib/src/services/renown/utils.js +0 -20
- package/lib/src/services/renown/utils.js.map +0 -1
- package/lib/src/services/storage/base-storage.d.ts +0 -9
- package/lib/src/services/storage/base-storage.d.ts.map +0 -1
- package/lib/src/services/storage/base-storage.js +0 -21
- package/lib/src/services/storage/base-storage.js.map +0 -1
- package/lib/src/services/storage/browser.d.ts +0 -5
- package/lib/src/services/storage/browser.d.ts.map +0 -1
- package/lib/src/services/storage/browser.js +0 -25
- package/lib/src/services/storage/browser.js.map +0 -1
- package/lib/src/services/storage/types.d.ts +0 -6
- package/lib/src/services/storage/types.d.ts.map +0 -1
- package/lib/src/services/storage/types.js +0 -2
- package/lib/src/services/storage/types.js.map +0 -1
- package/lib/src/services/toast.d.ts +0 -8
- package/lib/src/services/toast.d.ts.map +0 -1
- package/lib/src/services/toast.js +0 -11
- package/lib/src/services/toast.js.map +0 -1
- package/lib/src/store/document-model.d.ts +0 -3
- package/lib/src/store/document-model.d.ts.map +0 -1
- package/lib/src/store/document-model.js +0 -80
- package/lib/src/store/document-model.js.map +0 -1
- package/lib/src/store/editor.d.ts +0 -5
- package/lib/src/store/editor.d.ts.map +0 -1
- package/lib/src/store/editor.js +0 -31
- package/lib/src/store/editor.js.map +0 -1
- package/lib/src/store/external-packages.d.ts +0 -4
- package/lib/src/store/external-packages.d.ts.map +0 -1
- package/lib/src/store/external-packages.js +0 -36
- package/lib/src/store/external-packages.js.map +0 -1
- package/lib/src/store/index.d.ts +0 -7
- package/lib/src/store/index.d.ts.map +0 -1
- package/lib/src/store/index.js +0 -7
- package/lib/src/store/index.js.map +0 -1
- package/lib/src/store/reactor.d.ts +0 -3
- package/lib/src/store/reactor.d.ts.map +0 -1
- package/lib/src/store/reactor.js +0 -272
- package/lib/src/store/reactor.js.map +0 -1
- package/lib/src/store/user.d.ts +0 -2
- package/lib/src/store/user.d.ts.map +0 -1
- package/lib/src/store/user.js +0 -16
- package/lib/src/store/user.js.map +0 -1
- package/lib/src/store/utils.d.ts +0 -2
- package/lib/src/store/utils.d.ts.map +0 -1
- package/lib/src/store/utils.js +0 -59
- package/lib/src/store/utils.js.map +0 -1
- package/lib/src/utils/browser.d.ts +0 -2
- package/lib/src/utils/browser.d.ts.map +0 -1
- package/lib/src/utils/browser.js +0 -9
- package/lib/src/utils/browser.js.map +0 -1
- package/lib/src/utils/document-editor-debug-tools.d.ts +0 -17
- package/lib/src/utils/document-editor-debug-tools.d.ts.map +0 -1
- package/lib/src/utils/document-editor-debug-tools.js +0 -55
- package/lib/src/utils/document-editor-debug-tools.js.map +0 -1
- package/lib/src/utils/drive-preservation.d.ts +0 -19
- package/lib/src/utils/drive-preservation.d.ts.map +0 -1
- package/lib/src/utils/drive-preservation.js +0 -51
- package/lib/src/utils/drive-preservation.js.map +0 -1
- package/lib/src/utils/drive-sections.d.ts +0 -31
- package/lib/src/utils/drive-sections.d.ts.map +0 -1
- package/lib/src/utils/drive-sections.js +0 -63
- package/lib/src/utils/drive-sections.js.map +0 -1
- package/lib/src/utils/index.d.ts +0 -12
- package/lib/src/utils/index.d.ts.map +0 -1
- package/lib/src/utils/index.js +0 -12
- package/lib/src/utils/index.js.map +0 -1
- package/lib/src/utils/join.d.ts +0 -2
- package/lib/src/utils/join.d.ts.map +0 -1
- package/lib/src/utils/join.js +0 -11
- package/lib/src/utils/join.js.map +0 -1
- package/lib/src/utils/openUrl.d.ts +0 -2
- package/lib/src/utils/openUrl.d.ts.map +0 -1
- package/lib/src/utils/openUrl.js +0 -3
- package/lib/src/utils/openUrl.js.map +0 -1
- package/lib/src/utils/path.d.ts +0 -4
- package/lib/src/utils/path.d.ts.map +0 -1
- package/lib/src/utils/path.js +0 -17
- package/lib/src/utils/path.js.map +0 -1
- package/lib/src/utils/reactor.d.ts +0 -26
- package/lib/src/utils/reactor.d.ts.map +0 -1
- package/lib/src/utils/reactor.js +0 -115
- package/lib/src/utils/reactor.js.map +0 -1
- package/lib/src/utils/registerServiceWorker.d.ts +0 -12
- package/lib/src/utils/registerServiceWorker.d.ts.map +0 -1
- package/lib/src/utils/registerServiceWorker.js +0 -97
- package/lib/src/utils/registerServiceWorker.js.map +0 -1
- package/lib/src/utils/signature.d.ts +0 -4
- package/lib/src/utils/signature.d.ts.map +0 -1
- package/lib/src/utils/signature.js +0 -36
- package/lib/src/utils/signature.js.map +0 -1
- package/lib/src/utils/slug.d.ts +0 -2
- package/lib/src/utils/slug.d.ts.map +0 -1
- package/lib/src/utils/slug.js +0 -4
- package/lib/src/utils/slug.js.map +0 -1
- package/lib/src/workers/pglite-worker.d.ts +0 -2
- package/lib/src/workers/pglite-worker.d.ts.map +0 -1
- package/lib/src/workers/pglite-worker.js +0 -32
- package/lib/src/workers/pglite-worker.js.map +0 -1
- package/lib/test/utils/signer.test.d.ts +0 -2
- package/lib/test/utils/signer.test.d.ts.map +0 -1
- package/lib/test/utils/signer.test.js +0 -330
- package/lib/test/utils/signer.test.js.map +0 -1
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/lib/vite.config.d.ts +0 -3
- package/lib/vite.config.d.ts.map +0 -1
- package/lib/vite.config.js +0 -59
- package/lib/vite.config.js.map +0 -1
- package/lib/vitest.config.d.ts +0 -3
- package/lib/vitest.config.d.ts.map +0 -1
- package/lib/vitest.config.js +0 -8
- package/lib/vitest.config.js.map +0 -1
- package/nginx.conf +0 -77
- package/package.copy.json +0 -177
- package/src/index.css +0 -5
|
@@ -0,0 +1,714 @@
|
|
|
1
|
+
import { i as phGlobalConfigFromEnv, t as connectConfig } from "./connect.config-DDu1QWU1.js";
|
|
2
|
+
import { t as toast } from "./toast-iD-70hL8.js";
|
|
3
|
+
import { BrowserLocalStorage, ChannelScheme, DocumentCache, DocumentChangeType, ReactorBuilder, ReactorClientBuilder, RegistryClient, addPHEventHandlers, addRemoteDrive, createAnalyticsStore, extractDriveSlugFromPath, extractNodeSlugFromPath, getDrives, login, refreshReactorDataClient, setDefaultPHGlobalConfig, setDocumentCache, setDrives, setFeatures, setPHToast, setPackageDiscoveryService, setReactorClient, setReactorClientModule, setRenown, setSelectedDrive, setSelectedNode, setVetraPackageManager } from "@powerhousedao/reactor-browser";
|
|
4
|
+
import { ConsoleLogger, logger, setLogLevel as setLogLevel$1 } from "document-model";
|
|
5
|
+
import { PGlite } from "@electric-sql/pglite";
|
|
6
|
+
import { BrowserKeyStorage, RenownBuilder, RenownCryptoBuilder, createSignatureVerifier } from "@renown/sdk";
|
|
7
|
+
import { Kysely } from "kysely";
|
|
8
|
+
import { PGliteDialect } from "kysely-pglite-dialect";
|
|
9
|
+
import { live } from "@electric-sql/pglite/live";
|
|
10
|
+
import { PGliteWorker } from "@electric-sql/pglite/worker";
|
|
11
|
+
import { createRelationalDb } from "@powerhousedao/shared/processors";
|
|
12
|
+
import { OpenFeature } from "@openfeature/web-sdk";
|
|
13
|
+
import * as common from "@powerhousedao/powerhouse-vetra-packages";
|
|
14
|
+
import * as vetra from "@powerhousedao/vetra";
|
|
15
|
+
//#region src/utils/reactor.ts
|
|
16
|
+
/**
|
|
17
|
+
* Creates a Reactor that plugs into legacy storage but syncs through the new
|
|
18
|
+
* Reactor GQL API.
|
|
19
|
+
*/
|
|
20
|
+
async function createBrowserReactor(documentModelModules, upgradeManifests, renown, documentModelLoader) {
|
|
21
|
+
const signerConfig = {
|
|
22
|
+
signer: renown.signer,
|
|
23
|
+
verifier: createSignatureVerifier()
|
|
24
|
+
};
|
|
25
|
+
const jwtHandler = async (url) => {
|
|
26
|
+
if (!renown.user) return;
|
|
27
|
+
return renown.getBearerToken({
|
|
28
|
+
expiresIn: 10,
|
|
29
|
+
aud: url
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
const pg = new PGlite("idb://reactor", { relaxedDurability: true });
|
|
33
|
+
const logger = new ConsoleLogger(["reactor-client"]);
|
|
34
|
+
const builder = new ReactorClientBuilder().withLogger(logger).withSigner(signerConfig).withReactorBuilder(new ReactorBuilder().withDocumentModels(documentModelModules).withUpgradeManifests(upgradeManifests).withChannelScheme(ChannelScheme.CONNECT).withJwtHandler(jwtHandler).withKysely(new Kysely({ dialect: new PGliteDialect(pg) })));
|
|
35
|
+
if (documentModelLoader) builder.withDocumentModelLoader(documentModelLoader);
|
|
36
|
+
return {
|
|
37
|
+
...await builder.buildModule(),
|
|
38
|
+
pg
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Parse default drives from environment variable.
|
|
43
|
+
* Returns an array of drive REST endpoint URLs (e.g., "https://example.com/d/powerhouse").
|
|
44
|
+
*/
|
|
45
|
+
function getDefaultDrivesFromEnv() {
|
|
46
|
+
const envValue = import.meta.env.PH_CONNECT_DEFAULT_DRIVES_URL;
|
|
47
|
+
if (!envValue) return [];
|
|
48
|
+
return envValue.split(",").filter((url) => url.trim().length > 0);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Add default drives for the new reactor via sync manager.
|
|
52
|
+
* @param defaultDriveUrls - Array of drive REST endpoint URLs (e.g., "https://example.com/d/powerhouse")
|
|
53
|
+
*/
|
|
54
|
+
async function addDefaultDrivesForNewReactor(defaultDriveUrls) {
|
|
55
|
+
for (const url of defaultDriveUrls) try {
|
|
56
|
+
await addRemoteDrive(url);
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.error(`Failed to add default drive ${url}:`, error);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/feature-flags.ts
|
|
63
|
+
/**
|
|
64
|
+
* QueryParamProvider reads feature flags from URL query parameters.
|
|
65
|
+
*
|
|
66
|
+
* Usage:
|
|
67
|
+
* const params = new URLSearchParams(window.location.search);
|
|
68
|
+
* const provider = new QueryParamProvider(params);
|
|
69
|
+
* await OpenFeature.setProviderAndWait(provider);
|
|
70
|
+
*
|
|
71
|
+
* Query parameter format:
|
|
72
|
+
* ?FEATURE_DUAL_ACTION_CREATE_ENABLED=true&FEATURE_FOO=false
|
|
73
|
+
*/
|
|
74
|
+
var QueryParamProvider = class {
|
|
75
|
+
runsOn = "client";
|
|
76
|
+
metadata = { name: "QueryParamProvider" };
|
|
77
|
+
flags;
|
|
78
|
+
constructor(searchParams) {
|
|
79
|
+
this.flags = /* @__PURE__ */ new Map();
|
|
80
|
+
for (const [key, value] of searchParams.entries()) this.flags.set(key, value);
|
|
81
|
+
}
|
|
82
|
+
resolveBooleanEvaluation(flagKey, defaultValue) {
|
|
83
|
+
const value = this.flags.get(flagKey);
|
|
84
|
+
if (value === void 0) return {
|
|
85
|
+
value: defaultValue,
|
|
86
|
+
reason: "DEFAULT"
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
value: value.toLowerCase() === "true" || value === "1",
|
|
90
|
+
reason: "STATIC",
|
|
91
|
+
variant: value
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
resolveStringEvaluation(flagKey, defaultValue) {
|
|
95
|
+
const value = this.flags.get(flagKey);
|
|
96
|
+
if (value === void 0) return {
|
|
97
|
+
value: defaultValue,
|
|
98
|
+
reason: "DEFAULT"
|
|
99
|
+
};
|
|
100
|
+
return {
|
|
101
|
+
value,
|
|
102
|
+
reason: "STATIC",
|
|
103
|
+
variant: value
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
resolveNumberEvaluation(flagKey, defaultValue) {
|
|
107
|
+
const value = this.flags.get(flagKey);
|
|
108
|
+
if (value === void 0) return {
|
|
109
|
+
value: defaultValue,
|
|
110
|
+
reason: "DEFAULT"
|
|
111
|
+
};
|
|
112
|
+
const numValue = Number(value);
|
|
113
|
+
if (isNaN(numValue)) return {
|
|
114
|
+
value: defaultValue,
|
|
115
|
+
reason: "ERROR",
|
|
116
|
+
errorCode: "PARSE_ERROR",
|
|
117
|
+
errorMessage: `Failed to parse "${value}" as a number`
|
|
118
|
+
};
|
|
119
|
+
return {
|
|
120
|
+
value: numValue,
|
|
121
|
+
reason: "STATIC",
|
|
122
|
+
variant: value
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
resolveObjectEvaluation(flagKey, defaultValue) {
|
|
126
|
+
const value = this.flags.get(flagKey);
|
|
127
|
+
if (value === void 0) return {
|
|
128
|
+
value: defaultValue,
|
|
129
|
+
reason: "DEFAULT"
|
|
130
|
+
};
|
|
131
|
+
try {
|
|
132
|
+
return {
|
|
133
|
+
value: JSON.parse(value),
|
|
134
|
+
reason: "STATIC",
|
|
135
|
+
variant: value
|
|
136
|
+
};
|
|
137
|
+
} catch (error) {
|
|
138
|
+
return {
|
|
139
|
+
value: defaultValue,
|
|
140
|
+
reason: "ERROR",
|
|
141
|
+
errorCode: "PARSE_ERROR",
|
|
142
|
+
errorMessage: `Failed to parse JSON: ${error instanceof Error ? error.message : String(error)}`
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Initialize OpenFeature with the QueryParamProvider.
|
|
149
|
+
* Reads feature flags from query parameters.
|
|
150
|
+
*/
|
|
151
|
+
async function initFeatureFlags(searchParams) {
|
|
152
|
+
const params = searchParams ?? (typeof window !== "undefined" ? new URLSearchParams(window.location.search) : new URLSearchParams());
|
|
153
|
+
const provider = new QueryParamProvider(params);
|
|
154
|
+
await OpenFeature.setProviderAndWait(provider);
|
|
155
|
+
const features = /* @__PURE__ */ new Map();
|
|
156
|
+
const client = OpenFeature.getClient();
|
|
157
|
+
const inspectorEnabled = params.has(FEATURE_INSPECTOR_ENABLED) ? client.getBooleanValue(FEATURE_INSPECTOR_ENABLED, FEATURE_INSPECTOR_ENABLED_DEFAULT) : connectConfig.content.inspectorEnabled;
|
|
158
|
+
features.set(FEATURE_INSPECTOR_ENABLED, inspectorEnabled);
|
|
159
|
+
const logLevelParam = params.get("LOG_LEVEL");
|
|
160
|
+
if (logLevelParam) {
|
|
161
|
+
const validLogLevels = [
|
|
162
|
+
"verbose",
|
|
163
|
+
"debug",
|
|
164
|
+
"info",
|
|
165
|
+
"warn",
|
|
166
|
+
"error"
|
|
167
|
+
];
|
|
168
|
+
if (validLogLevels.includes(logLevelParam.toLowerCase())) {
|
|
169
|
+
setLogLevel$1(logLevelParam.toLowerCase());
|
|
170
|
+
logger.info("Log level set to @level via query param", logLevelParam.toLowerCase());
|
|
171
|
+
} else logger.warn("Invalid LOG_LEVEL query param: @param. Valid values: @validLevels", logLevelParam, validLogLevels.join(", "));
|
|
172
|
+
}
|
|
173
|
+
return features;
|
|
174
|
+
}
|
|
175
|
+
const FEATURE_INSPECTOR_ENABLED = "FEATURE_INSPECTOR_ENABLED";
|
|
176
|
+
const FEATURE_INSPECTOR_ENABLED_DEFAULT = false;
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/package-discovery.ts
|
|
179
|
+
var PackageDiscoveryService = class {
|
|
180
|
+
#packageManager;
|
|
181
|
+
#registryClient;
|
|
182
|
+
#mode;
|
|
183
|
+
#deferred = /* @__PURE__ */ new Map();
|
|
184
|
+
#pending = /* @__PURE__ */ new Map();
|
|
185
|
+
#pendingMemo = [];
|
|
186
|
+
#pendingSubscribers = /* @__PURE__ */ new Set();
|
|
187
|
+
#eventSubscribers = /* @__PURE__ */ new Set();
|
|
188
|
+
#dismissedStorage;
|
|
189
|
+
#discoveredTypes = /* @__PURE__ */ new Map();
|
|
190
|
+
constructor(packageManager, registryClient, options) {
|
|
191
|
+
this.#packageManager = packageManager;
|
|
192
|
+
this.#registryClient = registryClient;
|
|
193
|
+
this.#mode = options.mode;
|
|
194
|
+
this.#dismissedStorage = new BrowserLocalStorage(options.storageKey + ":PH_DISMISSED_TYPES");
|
|
195
|
+
}
|
|
196
|
+
load(documentType) {
|
|
197
|
+
const existing = this.#findModuleInLoadedPackages(documentType);
|
|
198
|
+
if (existing) return Promise.resolve(existing);
|
|
199
|
+
if (this.#dismissedStorage.has(documentType)) return Promise.reject(/* @__PURE__ */ new Error(`Document type "${documentType}" was dismissed`));
|
|
200
|
+
const tracked = this.#deferred.get(documentType);
|
|
201
|
+
if (tracked) return tracked.promise;
|
|
202
|
+
return this.#discover(documentType);
|
|
203
|
+
}
|
|
204
|
+
promptInstallation(documentType) {
|
|
205
|
+
const packageNames = this.#discoveredTypes.get(documentType);
|
|
206
|
+
if (!packageNames) return;
|
|
207
|
+
if (this.#pending.has(documentType)) return;
|
|
208
|
+
this.#discoveredTypes.delete(documentType);
|
|
209
|
+
this.#addToPending(documentType, packageNames);
|
|
210
|
+
}
|
|
211
|
+
async approveInstallation(packageName) {
|
|
212
|
+
const affectedTypes = this.#findTypesByPackage(packageName);
|
|
213
|
+
if (affectedTypes.length === 0) return;
|
|
214
|
+
const result = await this.#packageManager.addPackage(packageName);
|
|
215
|
+
if (result.type === "error") {
|
|
216
|
+
this.#emitEvent({
|
|
217
|
+
type: "installation-failed",
|
|
218
|
+
packageName,
|
|
219
|
+
error: result.error
|
|
220
|
+
});
|
|
221
|
+
for (const documentType of affectedTypes) {
|
|
222
|
+
const entry = this.#deferred.get(documentType);
|
|
223
|
+
if (entry) {
|
|
224
|
+
entry.reject(result.error);
|
|
225
|
+
this.#deferred.delete(documentType);
|
|
226
|
+
this.#pending.delete(documentType);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
this.#notifyPendingChanged();
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
this.#emitEvent({
|
|
233
|
+
type: "installation-approved",
|
|
234
|
+
packageName,
|
|
235
|
+
documentTypes: affectedTypes
|
|
236
|
+
});
|
|
237
|
+
for (const documentType of affectedTypes) {
|
|
238
|
+
const entry = this.#deferred.get(documentType);
|
|
239
|
+
if (!entry) continue;
|
|
240
|
+
const module = this.#findModuleInLoadedPackages(documentType);
|
|
241
|
+
if (module) entry.resolve(module);
|
|
242
|
+
else entry.reject(/* @__PURE__ */ new Error(`Package "${packageName}" installed but module for "${documentType}" not found`));
|
|
243
|
+
this.#deferred.delete(documentType);
|
|
244
|
+
this.#pending.delete(documentType);
|
|
245
|
+
}
|
|
246
|
+
this.#notifyPendingChanged();
|
|
247
|
+
}
|
|
248
|
+
dismissInstallation(packageName) {
|
|
249
|
+
const affectedTypes = this.#findTypesByPackage(packageName);
|
|
250
|
+
if (affectedTypes.length === 0) return;
|
|
251
|
+
for (const documentType of affectedTypes) {
|
|
252
|
+
this.#dismissedStorage.set(documentType, true);
|
|
253
|
+
const entry = this.#deferred.get(documentType);
|
|
254
|
+
if (entry) entry.reject(/* @__PURE__ */ new Error(`Document type "${documentType}" was dismissed`));
|
|
255
|
+
this.#deferred.delete(documentType);
|
|
256
|
+
this.#pending.delete(documentType);
|
|
257
|
+
this.#discoveredTypes.delete(documentType);
|
|
258
|
+
}
|
|
259
|
+
this.#emitEvent({
|
|
260
|
+
type: "installation-dismissed",
|
|
261
|
+
packageName,
|
|
262
|
+
documentTypes: affectedTypes
|
|
263
|
+
});
|
|
264
|
+
this.#notifyPendingChanged();
|
|
265
|
+
}
|
|
266
|
+
getPendingInstallations() {
|
|
267
|
+
return this.#pendingMemo;
|
|
268
|
+
}
|
|
269
|
+
subscribePending(listener) {
|
|
270
|
+
this.#pendingSubscribers.add(listener);
|
|
271
|
+
return () => {
|
|
272
|
+
this.#pendingSubscribers.delete(listener);
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
subscribeEvents(listener) {
|
|
276
|
+
this.#eventSubscribers.add(listener);
|
|
277
|
+
return () => {
|
|
278
|
+
this.#eventSubscribers.delete(listener);
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
async #discover(documentType) {
|
|
282
|
+
let packageNames;
|
|
283
|
+
try {
|
|
284
|
+
packageNames = await this.#registryClient.getPackagesByDocumentType(documentType);
|
|
285
|
+
} catch (error) {
|
|
286
|
+
this.#emitEvent({
|
|
287
|
+
type: "registry-query-failed",
|
|
288
|
+
documentType,
|
|
289
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
290
|
+
});
|
|
291
|
+
return Promise.reject(error instanceof Error ? error : new Error(String(error)));
|
|
292
|
+
}
|
|
293
|
+
if (packageNames.length === 0) return Promise.reject(/* @__PURE__ */ new Error(`No packages found for document type "${documentType}"`));
|
|
294
|
+
const entry = this.#createDeferredEntry(documentType, packageNames);
|
|
295
|
+
this.#emitEvent({
|
|
296
|
+
type: "type-discovered",
|
|
297
|
+
documentType,
|
|
298
|
+
packageNames
|
|
299
|
+
});
|
|
300
|
+
if (this.#mode === "immediate") this.#addToPending(documentType, packageNames);
|
|
301
|
+
else this.#discoveredTypes.set(documentType, packageNames);
|
|
302
|
+
return entry.promise;
|
|
303
|
+
}
|
|
304
|
+
#createDeferredEntry(documentType, packageNames) {
|
|
305
|
+
let resolve;
|
|
306
|
+
let reject;
|
|
307
|
+
const promise = new Promise((res, rej) => {
|
|
308
|
+
resolve = res;
|
|
309
|
+
reject = rej;
|
|
310
|
+
});
|
|
311
|
+
const entry = {
|
|
312
|
+
packageNames,
|
|
313
|
+
resolve,
|
|
314
|
+
reject,
|
|
315
|
+
promise
|
|
316
|
+
};
|
|
317
|
+
this.#deferred.set(documentType, entry);
|
|
318
|
+
return entry;
|
|
319
|
+
}
|
|
320
|
+
#addToPending(documentType, packageNames) {
|
|
321
|
+
const installation = {
|
|
322
|
+
documentType,
|
|
323
|
+
packageNames
|
|
324
|
+
};
|
|
325
|
+
this.#pending.set(documentType, installation);
|
|
326
|
+
this.#emitEvent({
|
|
327
|
+
type: "installation-prompted",
|
|
328
|
+
documentType,
|
|
329
|
+
packageNames
|
|
330
|
+
});
|
|
331
|
+
this.#notifyPendingChanged();
|
|
332
|
+
}
|
|
333
|
+
#findModuleInLoadedPackages(documentType) {
|
|
334
|
+
return this.#packageManager.packages.flatMap((p) => p.documentModels).find((m) => m.documentModel.global.id === documentType);
|
|
335
|
+
}
|
|
336
|
+
#findTypesByPackage(packageName) {
|
|
337
|
+
const types = [];
|
|
338
|
+
for (const [documentType, entry] of this.#deferred) if (entry.packageNames.includes(packageName)) types.push(documentType);
|
|
339
|
+
return types;
|
|
340
|
+
}
|
|
341
|
+
#notifyPendingChanged() {
|
|
342
|
+
this.#pendingMemo = Array.from(this.#pending.values());
|
|
343
|
+
for (const listener of this.#pendingSubscribers) listener();
|
|
344
|
+
}
|
|
345
|
+
#emitEvent(event) {
|
|
346
|
+
for (const listener of this.#eventSubscribers) listener(event);
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region src/package-manager.ts
|
|
351
|
+
const LOCAL_PACKAGE_NAME = "Local";
|
|
352
|
+
const LOCAL_PACKAGES = [
|
|
353
|
+
LOCAL_PACKAGE_NAME,
|
|
354
|
+
"Common",
|
|
355
|
+
"@powerhousedao/vetra"
|
|
356
|
+
];
|
|
357
|
+
var BrowserPackageManager = class {
|
|
358
|
+
registryUrl;
|
|
359
|
+
#storage;
|
|
360
|
+
#packages = /* @__PURE__ */ new Map();
|
|
361
|
+
#subscribers = /* @__PURE__ */ new Set();
|
|
362
|
+
#packagesMemo = [];
|
|
363
|
+
#stylesheets = /* @__PURE__ */ new Map();
|
|
364
|
+
#localPackage;
|
|
365
|
+
#cdnUrl;
|
|
366
|
+
constructor(namespace, registryUrl) {
|
|
367
|
+
this.#storage = new BrowserLocalStorage(namespace + ":PH_PACKAGES");
|
|
368
|
+
this.registryUrl = registryUrl;
|
|
369
|
+
this.#cdnUrl = registryUrl !== null ? this.#toCdnUrl(registryUrl) : null;
|
|
370
|
+
}
|
|
371
|
+
#toCdnUrl(baseUrl) {
|
|
372
|
+
if (baseUrl.includes("/-/cdn")) return baseUrl;
|
|
373
|
+
return `${baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl}/-/cdn`;
|
|
374
|
+
}
|
|
375
|
+
async init(localPackage) {
|
|
376
|
+
const commonPackageWithMeta = this.#loadCommonPackage();
|
|
377
|
+
this.#registerPackage(commonPackageWithMeta);
|
|
378
|
+
const vetraPackageWithMeta = this.#loadVetraPackage();
|
|
379
|
+
this.#registerPackage(vetraPackageWithMeta);
|
|
380
|
+
if (localPackage) this.updateLocalPackage(localPackage);
|
|
381
|
+
for (const packageName of this.#storage.keys()) await this.addPackage(packageName);
|
|
382
|
+
}
|
|
383
|
+
updateLocalPackage(pkg) {
|
|
384
|
+
console.debug("Updating local package:", pkg);
|
|
385
|
+
this.#localPackage = pkg;
|
|
386
|
+
this.#registerPackage({
|
|
387
|
+
name: LOCAL_PACKAGE_NAME,
|
|
388
|
+
stylesheetUrl: null,
|
|
389
|
+
importUrl: null,
|
|
390
|
+
loadedPackage: pkg
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
get packages() {
|
|
394
|
+
return this.#packagesMemo;
|
|
395
|
+
}
|
|
396
|
+
get cdnUrl() {
|
|
397
|
+
return this.#cdnUrl;
|
|
398
|
+
}
|
|
399
|
+
getPackageSource(packageName) {
|
|
400
|
+
if (LOCAL_PACKAGES.includes(packageName)) return "common";
|
|
401
|
+
if (packageName === this.#localPackage?.manifest.name) return "project";
|
|
402
|
+
const packageMeta = this.#storage.get(packageName);
|
|
403
|
+
if (!packageMeta) return null;
|
|
404
|
+
if (packageMeta.importUrl === `/node_modules/${packageName}`) return "local-install";
|
|
405
|
+
return "registry-install";
|
|
406
|
+
}
|
|
407
|
+
async addPackage(packageName) {
|
|
408
|
+
const existingPackage = this.#packages.get(packageName);
|
|
409
|
+
if (existingPackage) return {
|
|
410
|
+
type: "success",
|
|
411
|
+
package: existingPackage
|
|
412
|
+
};
|
|
413
|
+
try {
|
|
414
|
+
const packageWithMeta = await this.#loadPackage(packageName);
|
|
415
|
+
this.#registerPackage(packageWithMeta);
|
|
416
|
+
return {
|
|
417
|
+
type: "success",
|
|
418
|
+
package: packageWithMeta.loadedPackage
|
|
419
|
+
};
|
|
420
|
+
} catch (error) {
|
|
421
|
+
return {
|
|
422
|
+
type: "error",
|
|
423
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
async addPackages(packageNames) {
|
|
428
|
+
const results = [];
|
|
429
|
+
for (const packageName of packageNames) {
|
|
430
|
+
const result = await this.addPackage(packageName);
|
|
431
|
+
results.push(result);
|
|
432
|
+
}
|
|
433
|
+
return results;
|
|
434
|
+
}
|
|
435
|
+
removePackage(name) {
|
|
436
|
+
this.#packages.delete(name);
|
|
437
|
+
this.#storage.delete(name);
|
|
438
|
+
this.#unmountStylesheet(name);
|
|
439
|
+
this.#notifyPackagesChanged();
|
|
440
|
+
}
|
|
441
|
+
subscribe(handler) {
|
|
442
|
+
this.#subscribers.add(handler);
|
|
443
|
+
return () => {
|
|
444
|
+
this.#subscribers.delete(handler);
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
load(documentType) {
|
|
448
|
+
const documentModelModule = Array.from(this.#packages.values().flatMap((p) => p.documentModels)).find((m) => m.documentModel.global.id === documentType);
|
|
449
|
+
if (documentModelModule) return Promise.resolve(documentModelModule);
|
|
450
|
+
return Promise.reject(/* @__PURE__ */ new Error("Model not available"));
|
|
451
|
+
}
|
|
452
|
+
#loadCommonPackage() {
|
|
453
|
+
return {
|
|
454
|
+
name: common.manifest.name,
|
|
455
|
+
importUrl: null,
|
|
456
|
+
stylesheetUrl: null,
|
|
457
|
+
loadedPackage: common
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
#loadVetraPackage() {
|
|
461
|
+
return {
|
|
462
|
+
name: vetra.manifest.name,
|
|
463
|
+
importUrl: null,
|
|
464
|
+
stylesheetUrl: null,
|
|
465
|
+
loadedPackage: vetra
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
async #loadPackageFromNodeModules(name) {
|
|
469
|
+
const importUrl = `/node_modules/${name}/browser/index.js`;
|
|
470
|
+
const stylesheetUrl = `/node_modules/${name}/style.css`;
|
|
471
|
+
return await this.#importPackage({
|
|
472
|
+
name,
|
|
473
|
+
importUrl,
|
|
474
|
+
stylesheetUrl
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
async #loadPackageFromRegistry(name) {
|
|
478
|
+
const importUrl = `${this.#cdnUrl}/${name}/browser/index.js`;
|
|
479
|
+
const stylesheetUrl = `${this.#cdnUrl}/${name}/style.css`;
|
|
480
|
+
return await this.#importPackage({
|
|
481
|
+
name,
|
|
482
|
+
importUrl,
|
|
483
|
+
stylesheetUrl
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
async #importPackage(packageMeta) {
|
|
487
|
+
const { name, importUrl, stylesheetUrl } = packageMeta;
|
|
488
|
+
if (!importUrl) throw new Error(`Import url not defined for package "${name}".`);
|
|
489
|
+
return {
|
|
490
|
+
name,
|
|
491
|
+
loadedPackage: await import(
|
|
492
|
+
/* @vite-ignore */
|
|
493
|
+
importUrl
|
|
494
|
+
),
|
|
495
|
+
importUrl,
|
|
496
|
+
stylesheetUrl
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
async #loadPackage(packageName) {
|
|
500
|
+
if (LOCAL_PACKAGES.includes(packageName)) throw new Error(`Package "${packageName}" is a local package and cannot be loaded dynamically.`);
|
|
501
|
+
if (!import.meta.env.PROD) try {
|
|
502
|
+
return await this.#loadPackageFromNodeModules(packageName);
|
|
503
|
+
} catch (error) {
|
|
504
|
+
console.warn(`Failed to load package "${packageName}" from node_modules:`, error);
|
|
505
|
+
}
|
|
506
|
+
if (!this.registryUrl) throw new Error("Registry url not defined.");
|
|
507
|
+
return await this.#loadPackageFromRegistry(packageName);
|
|
508
|
+
}
|
|
509
|
+
#registerPackage(packageWithMeta) {
|
|
510
|
+
const { name, loadedPackage, importUrl, stylesheetUrl } = packageWithMeta;
|
|
511
|
+
if (stylesheetUrl !== null) this.#mountStylesheet(name, stylesheetUrl);
|
|
512
|
+
this.#packages.set(name, loadedPackage);
|
|
513
|
+
this.#storage.set(name, {
|
|
514
|
+
name,
|
|
515
|
+
importUrl,
|
|
516
|
+
stylesheetUrl
|
|
517
|
+
});
|
|
518
|
+
this.#notifyPackagesChanged();
|
|
519
|
+
}
|
|
520
|
+
#mountStylesheet(name, href) {
|
|
521
|
+
const existing = this.#stylesheets.get(name);
|
|
522
|
+
if (existing) return existing;
|
|
523
|
+
const link = document.createElement("link");
|
|
524
|
+
link.rel = "stylesheet";
|
|
525
|
+
link.href = href;
|
|
526
|
+
document.head.appendChild(link);
|
|
527
|
+
this.#stylesheets.set(name, link);
|
|
528
|
+
}
|
|
529
|
+
#unmountStylesheet(name) {
|
|
530
|
+
const link = this.#stylesheets.get(name);
|
|
531
|
+
if (!link) return;
|
|
532
|
+
link.remove();
|
|
533
|
+
this.#stylesheets.delete(name);
|
|
534
|
+
}
|
|
535
|
+
#notifyPackagesChanged() {
|
|
536
|
+
this.#packagesMemo = Array.from(this.#packages.values());
|
|
537
|
+
const packages = this.packages;
|
|
538
|
+
this.#subscribers.forEach((handler) => {
|
|
539
|
+
handler({ packages });
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
//#endregion
|
|
544
|
+
//#region src/packages.config.ts
|
|
545
|
+
function assertPackagesConfig(value) {
|
|
546
|
+
if (typeof value !== "object" || value === null) throw new Error("ph-packages.json must be a JSON object");
|
|
547
|
+
const obj = value;
|
|
548
|
+
if (!Array.isArray(obj.packages)) throw new Error("ph-packages.json: 'packages' must be an array");
|
|
549
|
+
if (!obj.packages.every((item) => typeof item === "string")) throw new Error("ph-packages.json: 'packages' must be an array of strings");
|
|
550
|
+
}
|
|
551
|
+
let cached;
|
|
552
|
+
async function loadPackagesConfig() {
|
|
553
|
+
if (cached) return cached;
|
|
554
|
+
const url = `${import.meta.env.BASE_URL ?? "/"}ph-packages.json`;
|
|
555
|
+
const json = await (await fetch(url)).json();
|
|
556
|
+
assertPackagesConfig(json);
|
|
557
|
+
cached = json;
|
|
558
|
+
return cached;
|
|
559
|
+
}
|
|
560
|
+
//#endregion
|
|
561
|
+
//#region src/pglite.db.ts
|
|
562
|
+
async function getDb() {
|
|
563
|
+
const worker = new Worker(new URL("./pglite.worker.js", import.meta.url), { type: "module" });
|
|
564
|
+
const pgLite = await PGliteWorker.create(worker, { extensions: { live } });
|
|
565
|
+
return {
|
|
566
|
+
pgLite,
|
|
567
|
+
relationalDb: createRelationalDb(new Kysely({ dialect: new PGliteDialect(pgLite) }))
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
//#endregion
|
|
571
|
+
//#region src/store/processor-host-module.ts
|
|
572
|
+
async function createProcessorHostModule(reactorClient, readModels) {
|
|
573
|
+
try {
|
|
574
|
+
const { pgLite, relationalDb } = await getDb();
|
|
575
|
+
const { store: analyticsStore } = await createAnalyticsStore({ pgLite });
|
|
576
|
+
return {
|
|
577
|
+
relationalDb,
|
|
578
|
+
analyticsStore,
|
|
579
|
+
processorApp: "connect",
|
|
580
|
+
dispatch: { async execute(docId, branch, actions, signal) {
|
|
581
|
+
const jobInfo = await reactorClient.executeAsync(docId, branch, actions, signal);
|
|
582
|
+
return {
|
|
583
|
+
id: jobInfo.id,
|
|
584
|
+
status: jobInfo.status
|
|
585
|
+
};
|
|
586
|
+
} },
|
|
587
|
+
getReadModel(name) {
|
|
588
|
+
const model = readModels.find((m) => m.name === name);
|
|
589
|
+
if (!model) throw new Error(`Read model "${name}" not found`);
|
|
590
|
+
return model;
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
} catch (error) {
|
|
594
|
+
console.error(`Failed to initialize processor host module:`);
|
|
595
|
+
console.error(error);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
//#endregion
|
|
599
|
+
//#region src/store/reactor.ts
|
|
600
|
+
async function clearReactorStorage() {
|
|
601
|
+
await window.ph?.reactorClientModule?.pg?.close();
|
|
602
|
+
const targets = (await indexedDB.databases()).map((d) => d.name).filter((n) => !!n && /pglite|reactor/i.test(n));
|
|
603
|
+
await Promise.all(targets.map((name) => new Promise((resolve) => {
|
|
604
|
+
const req = indexedDB.deleteDatabase(name);
|
|
605
|
+
req.onsuccess = req.onerror = req.onblocked = () => resolve();
|
|
606
|
+
})));
|
|
607
|
+
}
|
|
608
|
+
async function createReactor(localPackage) {
|
|
609
|
+
if (!window.ph) window.ph = {};
|
|
610
|
+
if (window.ph.loading) return;
|
|
611
|
+
window.ph.loading = true;
|
|
612
|
+
addPHEventHandlers();
|
|
613
|
+
setPHToast(toast);
|
|
614
|
+
const features = await initFeatureFlags();
|
|
615
|
+
logger.info("Features: @features", JSON.stringify(Object.fromEntries(features), null, 2));
|
|
616
|
+
const keyPairStorage = await BrowserKeyStorage.create();
|
|
617
|
+
const renownCrypto = await new RenownCryptoBuilder().withKeyPairStorage(keyPairStorage).build();
|
|
618
|
+
const renown = await new RenownBuilder("connect", {
|
|
619
|
+
basename: phGlobalConfigFromEnv.routerBasename,
|
|
620
|
+
baseUrl: phGlobalConfigFromEnv.renownUrl
|
|
621
|
+
}).withCrypto(renownCrypto).build();
|
|
622
|
+
const packagesConfig = await loadPackagesConfig();
|
|
623
|
+
const packageManager = new BrowserPackageManager(phGlobalConfigFromEnv.routerBasename ?? "", PH_PACKAGE_REGISTRY_URL);
|
|
624
|
+
setVetraPackageManager(packageManager);
|
|
625
|
+
await packageManager.init(localPackage);
|
|
626
|
+
(await packageManager.addPackages(packagesConfig.packages)).map((r) => {
|
|
627
|
+
if (r.type === "error") console.error(r.error);
|
|
628
|
+
});
|
|
629
|
+
const documentModelModules = packageManager.packages.flatMap((pkg) => pkg.documentModels).filter((module, index, modules) => modules.findIndex((m) => m.documentModel.global.id === module.documentModel.global.id && m.version === module.version) === index);
|
|
630
|
+
const upgradeManifests = packageManager.packages.flatMap((pkg) => pkg.upgradeManifests).filter((manifest, index, manifests) => manifest !== void 0 && manifests.findIndex((m) => m && m.documentType === manifest.documentType) === index);
|
|
631
|
+
const discoveryService = packageManager.cdnUrl !== null ? new PackageDiscoveryService(packageManager, new RegistryClient(packageManager.cdnUrl), {
|
|
632
|
+
mode: "immediate",
|
|
633
|
+
storageKey: phGlobalConfigFromEnv.routerBasename ?? ""
|
|
634
|
+
}) : void 0;
|
|
635
|
+
if (discoveryService) setPackageDiscoveryService(discoveryService);
|
|
636
|
+
const reactorClientModule = await createBrowserReactor(documentModelModules, upgradeManifests, renown, discoveryService);
|
|
637
|
+
const drives = await getDrives(reactorClientModule.client);
|
|
638
|
+
const path = window.location.pathname;
|
|
639
|
+
const driveSlug = extractDriveSlugFromPath(path);
|
|
640
|
+
const nodeSlug = extractNodeSlugFromPath(path);
|
|
641
|
+
await login(getDidFromUrl(), renown);
|
|
642
|
+
const documentCache = new DocumentCache(reactorClientModule.client);
|
|
643
|
+
setDefaultPHGlobalConfig(phGlobalConfigFromEnv);
|
|
644
|
+
setReactorClientModule(reactorClientModule);
|
|
645
|
+
setReactorClient(reactorClientModule.client);
|
|
646
|
+
setDocumentCache(documentCache);
|
|
647
|
+
setRenown(renown);
|
|
648
|
+
setDrives(drives);
|
|
649
|
+
setSelectedDrive(driveSlug);
|
|
650
|
+
setSelectedNode(nodeSlug);
|
|
651
|
+
setFeatures(features);
|
|
652
|
+
const defaultDrivesConfig = getDefaultDrivesFromEnv();
|
|
653
|
+
if (defaultDrivesConfig.length > 0) await addDefaultDrivesForNewReactor(defaultDrivesConfig);
|
|
654
|
+
const remoteUrl = getDriveUrl();
|
|
655
|
+
if (remoteUrl) try {
|
|
656
|
+
await addRemoteDrive(remoteUrl);
|
|
657
|
+
} catch (error) {
|
|
658
|
+
console.error(`Failed to add remote drive from ${remoteUrl}:`, error);
|
|
659
|
+
}
|
|
660
|
+
const reactorClient = reactorClientModule.client;
|
|
661
|
+
reactorClient.subscribe({ type: "powerhouse/document-drive" }, (event) => {
|
|
662
|
+
logger.verbose("ReactorClient subscription event: @event", event);
|
|
663
|
+
refreshReactorDataClient(reactorClientModule.client).catch((e) => logger.error("@error", e));
|
|
664
|
+
});
|
|
665
|
+
reactorClient.subscribe({}, (event) => {
|
|
666
|
+
if (event.type !== DocumentChangeType.Deleted) return;
|
|
667
|
+
const deletedId = event.context?.childId;
|
|
668
|
+
if (!deletedId) return;
|
|
669
|
+
const selectedDriveId = window.ph?.selectedDriveId;
|
|
670
|
+
const selectedNodeId = window.ph?.selectedNodeId;
|
|
671
|
+
if (selectedDriveId && deletedId === selectedDriveId) {
|
|
672
|
+
setSelectedDrive(void 0);
|
|
673
|
+
toast("The drive you were viewing has been deleted");
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
if (selectedNodeId && deletedId === selectedNodeId) {
|
|
677
|
+
setSelectedNode(void 0);
|
|
678
|
+
toast("The document you were editing has been deleted");
|
|
679
|
+
}
|
|
680
|
+
});
|
|
681
|
+
await refreshReactorDataClient(reactorClientModule.client);
|
|
682
|
+
const packagesWithProcessorFactories = packageManager.packages.filter((pkg) => pkg.processorFactory !== void 0);
|
|
683
|
+
if (packagesWithProcessorFactories.length > 0) {
|
|
684
|
+
const readModels = reactorClientModule.reactorModule?.readModelCoordinator?.readModels ?? [];
|
|
685
|
+
const processorHostModule = await createProcessorHostModule(reactorClientModule.client, readModels);
|
|
686
|
+
if (processorHostModule !== void 0) await Promise.all(packagesWithProcessorFactories.map(async (pkg) => {
|
|
687
|
+
const { manifest, processorFactory } = pkg;
|
|
688
|
+
const name = manifest.name;
|
|
689
|
+
const id = manifest.name;
|
|
690
|
+
logger.info("Loading processor factory: @name", name);
|
|
691
|
+
try {
|
|
692
|
+
const factory = await processorFactory?.(processorHostModule);
|
|
693
|
+
if (!factory) return;
|
|
694
|
+
await reactorClientModule.reactorModule?.processorManager.registerFactory(id, factory);
|
|
695
|
+
} catch (error) {
|
|
696
|
+
logger.error(`Error registering processor: @name`, name);
|
|
697
|
+
logger.error("@error", error);
|
|
698
|
+
}
|
|
699
|
+
}));
|
|
700
|
+
}
|
|
701
|
+
window.ph.loading = false;
|
|
702
|
+
}
|
|
703
|
+
function getDidFromUrl() {
|
|
704
|
+
const didComponent = new URLSearchParams(window.location.search).get("user");
|
|
705
|
+
return didComponent ? decodeURIComponent(didComponent) : void 0;
|
|
706
|
+
}
|
|
707
|
+
function getDriveUrl() {
|
|
708
|
+
const driveUrl = new URLSearchParams(window.location.search).get("driveUrl");
|
|
709
|
+
return driveUrl ? decodeURIComponent(driveUrl) : void 0;
|
|
710
|
+
}
|
|
711
|
+
//#endregion
|
|
712
|
+
export { createReactor as n, clearReactorStorage as t };
|
|
713
|
+
|
|
714
|
+
//# sourceMappingURL=reactor-DOl6niiA.js.map
|