@powerhousedao/connect 6.0.0-dev.227 → 6.0.0-dev.229
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/{AddDriveModal-CBbXwG8S.js → AddDriveModal-B9BPORvo.js} +1 -1
- package/dist/{AddDriveModal-CBbXwG8S.js.map → AddDriveModal-B9BPORvo.js.map} +1 -1
- package/dist/{ClearStorageModal-DwiCY6Lt.js → ClearStorageModal-K1H6NgT6.js} +2 -2
- package/dist/{ClearStorageModal-DwiCY6Lt.js.map → ClearStorageModal-K1H6NgT6.js.map} +1 -1
- package/dist/{CookiesPolicyModal-CTXUu4-8.js → CookiesPolicyModal-CnVx2R_8.js} +1 -1
- package/dist/{CookiesPolicyModal-CTXUu4-8.js.map → CookiesPolicyModal-CnVx2R_8.js.map} +1 -1
- package/dist/{CreateDocumentModal-CAld-5pv.js → CreateDocumentModal-TtG7E62x.js} +1 -1
- package/dist/{CreateDocumentModal-CAld-5pv.js.map → CreateDocumentModal-TtG7E62x.js.map} +1 -1
- package/dist/{DebugSettingsModal-DeZ-x8H3.js → DebugSettingsModal-uCUG8557.js} +39 -9
- package/dist/DebugSettingsModal-uCUG8557.js.map +1 -0
- package/dist/{DeleteDriveModal-B7T2CVIX.js → DeleteDriveModal-Cb43NeNu.js} +1 -1
- package/dist/{DeleteDriveModal-B7T2CVIX.js.map → DeleteDriveModal-Cb43NeNu.js.map} +1 -1
- package/dist/{DeleteItemModal-DJv71YQG.js → DeleteItemModal-Brq4QKdd.js} +1 -1
- package/dist/{DeleteItemModal-DJv71YQG.js.map → DeleteItemModal-Brq4QKdd.js.map} +1 -1
- package/dist/{DisclaimerModal-Co13N7HH.js → DisclaimerModal-Dk6PpkZU.js} +1 -1
- package/dist/{DisclaimerModal-Co13N7HH.js.map → DisclaimerModal-Dk6PpkZU.js.map} +1 -1
- package/dist/{DriveSettingsModal-DmsUU0g3.js → DriveSettingsModal-BdcjrRh9.js} +1 -1
- package/dist/{DriveSettingsModal-DmsUU0g3.js.map → DriveSettingsModal-BdcjrRh9.js.map} +1 -1
- package/dist/{ExportDocumentWithErrorsModal-DOV_UVlM.js → ExportDocumentWithErrorsModal-DNRr3cjI.js} +1 -1
- package/dist/{ExportDocumentWithErrorsModal-DOV_UVlM.js.map → ExportDocumentWithErrorsModal-DNRr3cjI.js.map} +1 -1
- package/dist/{InspectorModal-raPDjejR.js → InspectorModal-EDrjiXPs.js} +4 -4
- package/dist/{InspectorModal-raPDjejR.js.map → InspectorModal-EDrjiXPs.js.map} +1 -1
- package/dist/{MissingPackageModal-Df154H9n.js → MissingPackageModal-BfblPbd8.js} +1 -1
- package/dist/{MissingPackageModal-Df154H9n.js.map → MissingPackageModal-BfblPbd8.js.map} +1 -1
- package/dist/{SettingsModal-BxESumFX.js → SettingsModal-ChpKp2ux.js} +43 -10
- package/dist/SettingsModal-ChpKp2ux.js.map +1 -0
- package/dist/{UpgradeDriveModal-BH4ecdCU.js → UpgradeDriveModal-CBLALaaQ.js} +1 -1
- package/dist/{UpgradeDriveModal-BH4ecdCU.js.map → UpgradeDriveModal-CBLALaaQ.js.map} +1 -1
- package/dist/build-info-BlcE3aZj.js +12 -0
- package/dist/build-info-BlcE3aZj.js.map +1 -0
- package/dist/{load-Cjv3zqrW.js → load-BNeNFbNv.js} +5 -5
- package/dist/{load-Cjv3zqrW.js.map → load-BNeNFbNv.js.map} +1 -1
- package/dist/main.js +1 -1
- package/dist/{package-Cp56x1gD.js → package-BO-kwGUs.js} +2 -2
- package/dist/package-BO-kwGUs.js.map +1 -0
- package/dist/{pglite-runtime-BS9wpAs9.js → pglite-runtime-C1g-4Jxl.js} +1 -1
- package/dist/{pglite-runtime-BS9wpAs9.js.map → pglite-runtime-C1g-4Jxl.js.map} +1 -1
- package/dist/{pglite-seed-VlhY0n-A.js → pglite-seed-BtXWFpHf.js} +2 -2
- package/dist/{pglite-seed-VlhY0n-A.js.map → pglite-seed-BtXWFpHf.js.map} +1 -1
- package/dist/{reactor-D1P2nU-G.js → reactor-Nm3jOev1.js} +2 -2
- package/dist/{reactor-D1P2nU-G.js.map → reactor-Nm3jOev1.js.map} +1 -1
- package/dist/{registerServiceWorker-1maoTQNT.js → registerServiceWorker-LI8_JXt3.js} +1 -1
- package/dist/{registerServiceWorker-1maoTQNT.js.map → registerServiceWorker-LI8_JXt3.js.map} +1 -1
- package/dist/{sidebar-Dvy8JReG.js → sidebar-BmQGY_wQ.js} +18 -18
- package/dist/{sidebar-Dvy8JReG.js.map → sidebar-BmQGY_wQ.js.map} +1 -1
- package/dist/start-connect.js +1 -1
- package/dist/style.css +6 -0
- package/package.json +9 -9
- package/dist/DebugSettingsModal-DeZ-x8H3.js.map +0 -1
- package/dist/SettingsModal-BxESumFX.js.map +0 -1
- package/dist/package-Cp56x1gD.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddDriveModal-
|
|
1
|
+
{"version":3,"file":"AddDriveModal-B9BPORvo.js","names":["ConnectAddLocalDriveModal"],"sources":["../src/components/modal/modals/AddDriveModal.tsx"],"sourcesContent":["import { toast } from \"@powerhousedao/connect/services\";\nimport type {\n AddRemoteDriveInput,\n AppOptions,\n} from \"@powerhousedao/design-system/connect\";\nimport { AddDriveModal as ConnectAddLocalDriveModal } from \"@powerhousedao/design-system/connect\";\nimport {\n addDrive,\n addRemoteDrive,\n closePHModal,\n setSelectedDrive,\n useAppModules,\n usePHModal,\n useRenown,\n useUser,\n} from \"@powerhousedao/reactor-browser\";\nimport { t } from \"i18next\";\n\nasync function requestPublicDriveFromReactor(\n url: string,\n headers?: Record<string, string>,\n): Promise<{ id: string; name: string }> {\n const response = await fetch(url, { headers: headers ?? {} });\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}`);\n }\n return (await response.json()) as { id: string; name: string };\n}\n\nexport function AddDriveModal() {\n const phModal = usePHModal();\n const open = phModal?.type === \"addDrive\";\n const user = useUser();\n const renown = useRenown();\n const appModules = useAppModules();\n const onAddLocalDrive = async (data: AppOptions) => {\n try {\n const app = appModules?.find((a) => a.config.id === data.id);\n const newDrive = await addDrive(\n {\n id: \"\",\n slug: \"\",\n global: {\n name: data.name,\n icon: null,\n },\n local: {\n availableOffline: data.availableOffline,\n sharingType: data.sharingType.toLowerCase(),\n listeners: [],\n triggers: [],\n },\n },\n app?.config.id,\n );\n\n toast(t(\"notifications.addDriveSuccess\"), {\n type: \"connect-success\",\n });\n\n if (!newDrive) {\n return;\n }\n\n setSelectedDrive(newDrive);\n } catch (e) {\n console.error(e);\n }\n };\n\n const onAddRemoteDrive = async (data: AddRemoteDriveInput) => {\n try {\n const driveId = await addRemoteDrive(data.url, data.id);\n\n toast(t(\"notifications.addDriveSuccess\"), {\n type: \"connect-success\",\n });\n\n setSelectedDrive(driveId);\n } catch (e) {\n console.error(e);\n }\n };\n async function onAddLocalDriveSubmit(data: AppOptions) {\n await onAddLocalDrive(data);\n closePHModal();\n }\n\n async function onAddRemoteDriveSubmit(data: AddRemoteDriveInput) {\n await onAddRemoteDrive(data);\n closePHModal();\n }\n\n const ready = !!appModules?.length;\n\n return (\n <ConnectAddLocalDriveModal\n open={open && ready}\n onAddLocalDrive={onAddLocalDriveSubmit}\n onAddRemoteDrive={onAddRemoteDriveSubmit}\n requestPublicDrive={async (url: string) => {\n try {\n if (user) {\n const authToken = await renown?.getBearerToken?.({\n expiresIn: 10,\n aud: url,\n });\n return requestPublicDriveFromReactor(url, {\n Authorization: `Bearer ${authToken}`,\n });\n }\n return requestPublicDriveFromReactor(url);\n } catch (error) {\n console.error(error);\n return requestPublicDriveFromReactor(url);\n }\n }}\n onOpenChange={(status) => {\n if (!status) return closePHModal();\n }}\n appOptions={\n appModules?.map((pkg) => ({\n id: pkg.config.id,\n name: pkg.config.name,\n sharingType: \"LOCAL\",\n availableOffline: false,\n })) || []\n }\n />\n );\n}\n"],"mappings":";;;;;;AAkBA,eAAe,8BACb,KACA,SACuC;CACvC,MAAM,WAAW,MAAM,MAAM,KAAK,EAAE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,QAAgB;AACzC,OAAI;AACF,QAAI,KAKF,QAAO,8BAA8B,KAAK,EACxC,eAAe,UALC,MAAM,QAAQ,iBAAiB;KAC/C,WAAW;KACX,KAAK;KACN,CAAC,IAGD,CAAC;AAEJ,WAAO,8BAA8B,IAAI;YAClC,OAAO;AACd,YAAQ,MAAM,MAAM;AACpB,WAAO,8BAA8B,IAAI;;;EAG7C,eAAe,WAAW;AACxB,OAAI,CAAC,OAAQ,QAAO,cAAc;;EAEpC,YACE,YAAY,KAAK,SAAS;GACxB,IAAI,IAAI,OAAO;GACf,MAAM,IAAI,OAAO;GACjB,aAAa;GACb,kBAAkB;GACnB,EAAE,IAAI,EAAE;EAEX,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as clearReactorStorage } from "./reactor-
|
|
1
|
+
import { t as clearReactorStorage } from "./reactor-Nm3jOev1.js";
|
|
2
2
|
import { closePHModal, setSelectedDrive, setSelectedNode, showPHModal, usePHModal } from "@powerhousedao/reactor-browser";
|
|
3
3
|
import { childLogger } from "document-model";
|
|
4
4
|
import { useState } from "react";
|
|
@@ -41,4 +41,4 @@ function ClearStorageModal() {
|
|
|
41
41
|
//#endregion
|
|
42
42
|
export { ClearStorageModal };
|
|
43
43
|
|
|
44
|
-
//# sourceMappingURL=ClearStorageModal-
|
|
44
|
+
//# sourceMappingURL=ClearStorageModal-K1H6NgT6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClearStorageModal-
|
|
1
|
+
{"version":3,"file":"ClearStorageModal-K1H6NgT6.js","names":["logger"],"sources":["../src/components/modal/modals/ClearStorageModal.tsx"],"sourcesContent":["import { clearReactorStorage } from \"@powerhousedao/connect/store\";\nimport { ConnectConfirmationModal } from \"@powerhousedao/design-system/connect\";\nimport {\n closePHModal,\n setSelectedDrive,\n setSelectedNode,\n showPHModal,\n usePHModal,\n} from \"@powerhousedao/reactor-browser\";\nimport { childLogger } from \"document-model\";\nimport { useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\nconst logger = childLogger([\"ClearStorage\"]);\n\nexport function ClearStorageModal() {\n const phModal = usePHModal();\n const open = phModal?.type === \"clearStorage\";\n const { t } = useTranslation();\n const [loading, setLoading] = useState(false);\n\n function clearStorage() {\n setLoading(true);\n clearReactorStorage()\n .then(() => {\n logger.info(\"Storage cleared\");\n setSelectedDrive(undefined);\n setSelectedNode(undefined);\n window.location.reload();\n })\n .catch((error) => {\n logger.error(\"Error clearing storage: @error\", error);\n setLoading(false);\n });\n }\n\n return (\n <ConnectConfirmationModal\n open={open}\n header={t(\"modals.connectSettings.clearStorage.confirmation.title\")}\n title={t(\"modals.connectSettings.clearStorage.confirmation.title\")}\n body={t(\"modals.connectSettings.clearStorage.confirmation.body\")}\n cancelLabel={t(\"common.cancel\")}\n continueLabel={t(\n \"modals.connectSettings.clearStorage.confirmation.clearButton\",\n )}\n onCancel={() => showPHModal({ type: \"settings\" })}\n onContinue={clearStorage}\n onOpenChange={(status: boolean) => {\n if (!status) return closePHModal();\n }}\n continueButtonProps={{\n disabled: loading,\n }}\n />\n );\n}\n"],"mappings":";;;;;;;;AAaA,MAAMA,WAAS,YAAY,CAAC,eAAe,CAAC;AAE5C,SAAgB,oBAAoB;CAElC,MAAM,OADU,YAAY,EACN,SAAS;CAC/B,MAAM,EAAE,MAAM,gBAAgB;CAC9B,MAAM,CAAC,SAAS,cAAc,SAAS,MAAM;CAE7C,SAAS,eAAe;AACtB,aAAW,KAAK;AAChB,uBAAqB,CAClB,WAAW;AACV,YAAO,KAAK,kBAAkB;AAC9B,oBAAiB,KAAA,EAAU;AAC3B,mBAAgB,KAAA,EAAU;AAC1B,UAAO,SAAS,QAAQ;IACxB,CACD,OAAO,UAAU;AAChB,YAAO,MAAM,kCAAkC,MAAM;AACrD,cAAW,MAAM;IACjB;;AAGN,QACE,oBAAC,0BAAD;EACQ;EACN,QAAQ,EAAE,yDAAyD;EACnE,OAAO,EAAE,yDAAyD;EAClE,MAAM,EAAE,wDAAwD;EAChE,aAAa,EAAE,gBAAgB;EAC/B,eAAe,EACb,+DACD;EACD,gBAAgB,YAAY,EAAE,MAAM,YAAY,CAAC;EACjD,YAAY;EACZ,eAAe,WAAoB;AACjC,OAAI,CAAC,OAAQ,QAAO,cAAc;;EAEpC,qBAAqB,EACnB,UAAU,SACX;EACD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CookiesPolicyModal-
|
|
1
|
+
{"version":3,"file":"CookiesPolicyModal-CnVx2R_8.js","names":[],"sources":["../src/components/modal/modals/CookiesPolicyModal.tsx"],"sourcesContent":["import { ReadRequiredModal } from \"@powerhousedao/design-system/connect\";\nimport { closePHModal, usePHModal } from \"@powerhousedao/reactor-browser\";\nimport { Trans, useTranslation } from \"react-i18next\";\n\nexport const CookiesPolicyModal: React.FC = () => {\n const phModal = usePHModal();\n const open = phModal?.type === \"cookiesPolicy\";\n const { t } = useTranslation();\n\n return (\n <ReadRequiredModal\n open={open}\n header={t(\"modals.cookiesPolicy.title\")}\n body={\n <Trans\n i18nKey=\"modals.cookiesPolicy.body\"\n components={{\n subtitle: <h2 className=\"mb-4 text-lg font-bold\" />,\n p: <p className=\"mb-2\" />,\n list: <ul className=\"mb-4 list-disc pl-6\" />,\n bullet: <li />,\n }}\n />\n }\n bodyProps={{ className: \"text-left\" }}\n closeLabel=\"Close\"\n onContinue={() => closePHModal()}\n overlayProps={{ style: { zIndex: 10000 } }}\n />\n );\n};\n"],"mappings":";;;;;AAIA,MAAa,2BAAqC;CAEhD,MAAM,OADU,YAAY,EACN,SAAS;CAC/B,MAAM,EAAE,MAAM,gBAAgB;AAE9B,QACE,oBAAC,mBAAD;EACQ;EACN,QAAQ,EAAE,6BAA6B;EACvC,MACE,oBAAC,OAAD;GACE,SAAQ;GACR,YAAY;IACV,UAAU,oBAAC,MAAD,EAAI,WAAU,0BAA2B,CAAA;IACnD,GAAG,oBAAC,KAAD,EAAG,WAAU,QAAS,CAAA;IACzB,MAAM,oBAAC,MAAD,EAAI,WAAU,uBAAwB,CAAA;IAC5C,QAAQ,oBAAC,MAAD,EAAM,CAAA;IACf;GACD,CAAA;EAEJ,WAAW,EAAE,WAAW,aAAa;EACrC,YAAW;EACX,kBAAkB,cAAc;EAChC,cAAc,EAAE,OAAO,EAAE,QAAQ,KAAO,EAAE;EAC1C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateDocumentModal-
|
|
1
|
+
{"version":3,"file":"CreateDocumentModal-TtG7E62x.js","names":["ConnectCreateDocumentModal"],"sources":["../src/components/modal/modals/CreateDocumentModal.tsx"],"sourcesContent":["import { CreateDocumentModal as ConnectCreateDocumentModal } from \"@powerhousedao/design-system/connect\";\nimport {\n addDocument,\n closePHModal,\n setSelectedNode,\n useDocumentModelModuleById,\n useParentFolderForSelectedNode,\n usePHModal,\n useSelectedDriveSafe,\n useSelectedFolder,\n} from \"@powerhousedao/reactor-browser\";\n\nexport const CreateDocumentModal: React.FC = () => {\n const phModal = usePHModal();\n const open = phModal?.type === \"createDocument\";\n const documentType = open ? phModal.documentType : undefined;\n const documentModel = useDocumentModelModuleById(documentType);\n const [selectedDrive] = useSelectedDriveSafe();\n const selectedFolder = useSelectedFolder();\n const parentFolder = useParentFolderForSelectedNode();\n\n const onCreateDocument = async (documentName: string) => {\n closePHModal();\n if (!selectedDrive || !documentModel) return;\n\n const node = await addDocument(\n selectedDrive.header.id,\n documentName || `New ${documentModel.documentModel.global.name}`,\n documentModel.documentModel.global.id,\n selectedFolder?.id ?? parentFolder?.id,\n );\n setSelectedNode(node);\n };\n\n return (\n <ConnectCreateDocumentModal\n open={open}\n onContinue={onCreateDocument}\n onOpenChange={(status: boolean) => {\n if (!status) return closePHModal();\n }}\n />\n );\n};\n"],"mappings":";;;;AAYA,MAAa,4BAAsC;CACjD,MAAM,UAAU,YAAY;CAC5B,MAAM,OAAO,SAAS,SAAS;CAE/B,MAAM,gBAAgB,2BADD,OAAO,QAAQ,eAAe,KAAA,EACW;CAC9D,MAAM,CAAC,iBAAiB,sBAAsB;CAC9C,MAAM,iBAAiB,mBAAmB;CAC1C,MAAM,eAAe,gCAAgC;CAErD,MAAM,mBAAmB,OAAO,iBAAyB;AACvD,gBAAc;AACd,MAAI,CAAC,iBAAiB,CAAC,cAAe;AAQtC,kBANa,MAAM,YACjB,cAAc,OAAO,IACrB,gBAAgB,OAAO,cAAc,cAAc,OAAO,QAC1D,cAAc,cAAc,OAAO,IACnC,gBAAgB,MAAM,cAAc,GACrC,CACoB;;AAGvB,QACE,oBAACA,uBAAD;EACQ;EACN,YAAY;EACZ,eAAe,WAAoB;AACjC,OAAI,CAAC,OAAQ,QAAO,cAAc;;EAEpC,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { t as connectConfig } from "./connect.config-Cuh0hj_Q.js";
|
|
2
|
-
import { t as
|
|
2
|
+
import { n as getGitUrl, r as shortGitSha, t as getGitSha } from "./build-info-BlcE3aZj.js";
|
|
3
|
+
import { t as serviceWorkerManager } from "./registerServiceWorker-LI8_JXt3.js";
|
|
3
4
|
import { closePHModal, usePHModal } from "@powerhousedao/reactor-browser";
|
|
4
5
|
import { useEffect, useState } from "react";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -41,13 +42,42 @@ const DebugSettingsModal = () => {
|
|
|
41
42
|
}),
|
|
42
43
|
/* @__PURE__ */ jsxs("div", {
|
|
43
44
|
className: "flex text-sm font-bold",
|
|
44
|
-
children: [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
47
|
+
name: "Ring",
|
|
48
|
+
size: 22
|
|
49
|
+
}),
|
|
50
|
+
/* @__PURE__ */ jsxs("span", {
|
|
51
|
+
className: "ml-2",
|
|
52
|
+
children: ["App Version: ", connectConfig.appVersion]
|
|
53
|
+
}),
|
|
54
|
+
(() => {
|
|
55
|
+
const sha = getGitSha();
|
|
56
|
+
if (sha === "unknown") return null;
|
|
57
|
+
const url = getGitUrl();
|
|
58
|
+
const label = shortGitSha(sha);
|
|
59
|
+
return url ? /* @__PURE__ */ jsxs("a", {
|
|
60
|
+
className: "ml-2 font-mono text-xs font-normal text-blue-600 hover:underline",
|
|
61
|
+
href: url,
|
|
62
|
+
target: "_blank",
|
|
63
|
+
rel: "noreferrer noopener",
|
|
64
|
+
title: sha,
|
|
65
|
+
children: [
|
|
66
|
+
"(",
|
|
67
|
+
label,
|
|
68
|
+
")"
|
|
69
|
+
]
|
|
70
|
+
}) : /* @__PURE__ */ jsxs("span", {
|
|
71
|
+
className: "ml-2 font-mono text-xs font-normal text-gray-500",
|
|
72
|
+
title: sha,
|
|
73
|
+
children: [
|
|
74
|
+
"(",
|
|
75
|
+
label,
|
|
76
|
+
")"
|
|
77
|
+
]
|
|
78
|
+
});
|
|
79
|
+
})()
|
|
80
|
+
]
|
|
51
81
|
}),
|
|
52
82
|
/* @__PURE__ */ jsxs("div", {
|
|
53
83
|
className: "mt-4 flex text-sm font-bold",
|
|
@@ -136,4 +166,4 @@ const DebugSettingsModal = () => {
|
|
|
136
166
|
//#endregion
|
|
137
167
|
export { DebugSettingsModal };
|
|
138
168
|
|
|
139
|
-
//# sourceMappingURL=DebugSettingsModal-
|
|
169
|
+
//# sourceMappingURL=DebugSettingsModal-uCUG8557.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DebugSettingsModal-uCUG8557.js","names":[],"sources":["../src/components/modal/modals/DebugSettingsModal.tsx"],"sourcesContent":["import { connectConfig } from \"@powerhousedao/connect/config\";\nimport {\n getGitSha,\n getGitUrl,\n serviceWorkerManager,\n shortGitSha,\n} from \"@powerhousedao/connect/utils\";\nimport { Icon, Modal, PowerhouseButton } from \"@powerhousedao/design-system\";\nimport { Combobox, FormInput } from \"@powerhousedao/design-system/connect\";\nimport { closePHModal, usePHModal } from \"@powerhousedao/reactor-browser\";\nimport { useEffect, useState } from \"react\";\n\nexport const DebugSettingsModal: React.FC = () => {\n const phModal = usePHModal();\n const open = phModal?.type === \"debugSettings\";\n\n const [appVersion, setAppVersion] = useState(connectConfig.appVersion);\n const [serviceWorkerDebugMode, setServiceWorkerDebugMode] = useState({\n label: serviceWorkerManager.debug ? \"Enabled\" : \"Disabled\",\n value: serviceWorkerManager.debug,\n });\n\n useEffect(() => {\n serviceWorkerManager.setDebug(serviceWorkerDebugMode.value);\n }, [serviceWorkerDebugMode]);\n\n return (\n <Modal\n open={open}\n onOpenChange={(status) => {\n if (!status) return closePHModal();\n }}\n contentProps={{\n className: \"rounded-2xl\",\n }}\n >\n <div className=\"w-[700px] rounded-2xl p-6\">\n <div className=\"mb-6 flex justify-between\">\n <div className=\"text-xl font-bold\">Debug Tools</div>\n <button id=\"close-modal\" onClick={() => closePHModal()}>\n <Icon name=\"Xmark\" size={28} />\n </button>\n </div>\n <div className=\"flex text-sm font-bold\">\n <Icon name=\"Ring\" size={22} />\n <span className=\"ml-2\">App Version: {connectConfig.appVersion}</span>\n {(() => {\n const sha = getGitSha();\n if (sha === \"unknown\") return null;\n const url = getGitUrl();\n const label = shortGitSha(sha);\n return url ? (\n <a\n className=\"ml-2 font-mono text-xs font-normal text-blue-600 hover:underline\"\n href={url}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n title={sha}\n >\n ({label})\n </a>\n ) : (\n <span\n className=\"ml-2 font-mono text-xs font-normal text-gray-500\"\n title={sha}\n >\n ({label})\n </span>\n );\n })()}\n </div>\n <div className=\"mt-4 flex text-sm font-bold\">\n <Icon name=\"Hdd\" size={22} />\n <span className=\"ml-2\">Drive Tools:</span>\n </div>\n\n <div className=\"mt-4 flex text-sm font-bold\">\n <Icon name=\"Gear\" size={22} />\n <span className=\"ml-2\">Service Worker Tools:</span>\n </div>\n <div className=\"mt-2 flex items-end justify-between pl-4\">\n <div className=\"w-[400px]\">\n <label htmlFor=\"serviceWorkerDebugMode\" className=\"text-xs\">\n Service Worker Debug Mode:\n </label>\n <Combobox\n id=\"serviceWorkerDebugMode\"\n onChange={(value) => {\n setServiceWorkerDebugMode(\n value as typeof serviceWorkerDebugMode,\n );\n }}\n value={serviceWorkerDebugMode}\n options={[\n { label: \"Enabled\", value: true },\n { label: \"Disabled\", value: false },\n ]}\n />\n </div>\n </div>\n <div className=\"mt-2 flex items-end justify-between pl-4\">\n <div className=\"w-[400px]\">\n <label htmlFor=\"appVersion\" className=\"text-xs\">\n Set invalid app version:\n </label>\n <FormInput\n containerClassName=\"p-1 bg-white border border-gray-200 rounded-md text-sm\"\n inputClassName=\"text-xs font-normal\"\n id=\"appVersion\"\n icon={\n <div className=\"flex h-full items-center text-xs\">Version:</div>\n }\n value={appVersion}\n onChange={(element) => setAppVersion(element.target.value)}\n />\n </div>\n <div className=\"mb-1 flex items-center justify-center\">\n <PowerhouseButton\n color={appVersion === \"\" ? \"light\" : \"red\"}\n size=\"small\"\n disabled={appVersion === \"\"}\n onClick={() => {\n // @ts-expect-error todo add send message method to service worker manager class\n serviceWorkerManager.sendMessage({\n type: \"SET_APP_VERSION\",\n version: appVersion,\n });\n setAppVersion(\"\");\n }}\n >\n Add Invalid App Version\n </PowerhouseButton>\n </div>\n </div>\n </div>\n </Modal>\n );\n};\n"],"mappings":";;;;;;;;;AAYA,MAAa,2BAAqC;CAEhD,MAAM,OADU,YAAY,EACN,SAAS;CAE/B,MAAM,CAAC,YAAY,iBAAiB,SAAS,cAAc,WAAW;CACtE,MAAM,CAAC,wBAAwB,6BAA6B,SAAS;EACnE,OAAO,qBAAqB,QAAQ,YAAY;EAChD,OAAO,qBAAqB;EAC7B,CAAC;AAEF,iBAAgB;AACd,uBAAqB,SAAS,uBAAuB,MAAM;IAC1D,CAAC,uBAAuB,CAAC;AAE5B,QACE,oBAAC,OAAD;EACQ;EACN,eAAe,WAAW;AACxB,OAAI,CAAC,OAAQ,QAAO,cAAc;;EAEpC,cAAc,EACZ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,MACD;;OAEH,OAAO;OACP,SAAS,CACP;QAAE,OAAO;QAAW,OAAO;QAAM,EACjC;QAAE,OAAO;QAAY,OAAO;QAAO,CACpC;OACD,CAAA,CACE;;KACF,CAAA;IACN,qBAAC,OAAD;KAAK,WAAU;eAAf,CACE,qBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,oBAAC,SAAD;OAAO,SAAQ;OAAa,WAAU;iBAAU;OAExC,CAAA,EACR,oBAAC,WAAD;OACE,oBAAmB;OACnB,gBAAe;OACf,IAAG;OACH,MACE,oBAAC,OAAD;QAAK,WAAU;kBAAmC;QAAc,CAAA;OAElE,OAAO;OACP,WAAW,YAAY,cAAc,QAAQ,OAAO,MAAM;OAC1D,CAAA,CACE;SACN,oBAAC,OAAD;MAAK,WAAU;gBACb,oBAAC,kBAAD;OACE,OAAO,eAAe,KAAK,UAAU;OACrC,MAAK;OACL,UAAU,eAAe;OACzB,eAAe;AAEb,6BAAqB,YAAY;SAC/B,MAAM;SACN,SAAS;SACV,CAAC;AACF,sBAAc,GAAG;;iBAEpB;OAEkB,CAAA;MACf,CAAA,CACF;;IACF;;EACA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteDriveModal-
|
|
1
|
+
{"version":3,"file":"DeleteDriveModal-Cb43NeNu.js","names":[],"sources":["../src/components/modal/modals/DeleteDriveModal.tsx"],"sourcesContent":["import { toast } from \"@powerhousedao/connect/services\";\nimport { ConnectDeleteDriveModal } from \"@powerhousedao/design-system/connect\";\nimport {\n closePHModal,\n deleteDrive,\n setSelectedDrive,\n useDriveById,\n useDrives,\n usePHModal,\n} from \"@powerhousedao/reactor-browser\";\nimport { useTranslation } from \"react-i18next\";\n\nexport const DeleteDriveModal: React.FC = () => {\n const phModal = usePHModal();\n const open = phModal?.type === \"deleteDrive\";\n const driveId = open ? phModal.driveId : undefined;\n const [drive] = useDriveById(driveId);\n const drives = useDrives();\n if (!drive) {\n return null;\n }\n async function onDeleteDrive() {\n if (!driveId) {\n return;\n }\n await deleteDrive(driveId);\n\n setSelectedDrive(drives?.[0]);\n closePHModal();\n\n toast(t(\"notifications.deleteDriveSuccess\"), {\n type: \"connect-deleted\",\n });\n }\n\n const { t } = useTranslation();\n\n return (\n <ConnectDeleteDriveModal\n open={open}\n driveName={drive.header.name}\n onCancel={closePHModal}\n header={t(\"modals.deleteDrive.title\", { label: drive.header.name })}\n body={t(\"modals.deleteDrive.body\")}\n inputPlaceholder={t(\"modals.deleteDrive.inputPlaceholder\")}\n cancelLabel={t(\"common.cancel\")}\n continueLabel={t(\"common.delete\")}\n onContinue={() => onDeleteDrive()}\n onOpenChange={(status: boolean) => {\n if (!status) return closePHModal();\n }}\n />\n );\n};\n"],"mappings":";;;;;;AAYA,MAAa,yBAAmC;CAC9C,MAAM,UAAU,YAAY;CAC5B,MAAM,OAAO,SAAS,SAAS;CAC/B,MAAM,UAAU,OAAO,QAAQ,UAAU,KAAA;CACzC,MAAM,CAAC,SAAS,aAAa,QAAQ;CACrC,MAAM,SAAS,WAAW;AAC1B,KAAI,CAAC,MACH,QAAO;CAET,eAAe,gBAAgB;AAC7B,MAAI,CAAC,QACH;AAEF,QAAM,YAAY,QAAQ;AAE1B,mBAAiB,SAAS,GAAG;AAC7B,gBAAc;AAEd,QAAM,EAAE,mCAAmC,EAAE,EAC3C,MAAM,mBACP,CAAC;;CAGJ,MAAM,EAAE,MAAM,gBAAgB;AAE9B,QACE,oBAAC,yBAAD;EACQ;EACN,WAAW,MAAM,OAAO;EACxB,UAAU;EACV,QAAQ,EAAE,4BAA4B,EAAE,OAAO,MAAM,OAAO,MAAM,CAAC;EACnE,MAAM,EAAE,0BAA0B;EAClC,kBAAkB,EAAE,sCAAsC;EAC1D,aAAa,EAAE,gBAAgB;EAC/B,eAAe,EAAE,gBAAgB;EACjC,kBAAkB,eAAe;EACjC,eAAe,WAAoB;AACjC,OAAI,CAAC,OAAQ,QAAO,cAAc;;EAEpC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteItemModal-
|
|
1
|
+
{"version":3,"file":"DeleteItemModal-Brq4QKdd.js","names":[],"sources":["../src/components/modal/modals/DeleteItemModal.tsx"],"sourcesContent":["import { toast } from \"@powerhousedao/connect/services\";\nimport { ConnectDeleteItemModal } from \"@powerhousedao/design-system/connect\";\nimport {\n closePHModal,\n deleteNode,\n setSelectedNode,\n useNodeById,\n useNodeParentFolderById,\n usePHModal,\n useSelectedDriveId,\n} from \"@powerhousedao/reactor-browser\";\nimport React from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\nexport const DeleteItemModal: React.FC = () => {\n const phModal = usePHModal();\n const open = phModal?.type === \"deleteItem\";\n const id = open ? phModal.id : undefined;\n const { t } = useTranslation();\n const node = useNodeById(id);\n const name = node?.name;\n const kind = node?.kind;\n const selectedDriveId = useSelectedDriveId();\n const nodeParentFolder = useNodeParentFolderById(node?.parentFolder);\n async function onDelete() {\n if (!selectedDriveId || !id) {\n return;\n }\n closePHModal();\n\n const i18nKey =\n kind === \"FOLDER\"\n ? \"notifications.deleteFolderSuccess\"\n : \"notifications.fileDeleteSuccess\";\n\n await deleteNode(selectedDriveId, id);\n\n setSelectedNode(nodeParentFolder);\n\n toast(t(i18nKey), { type: \"connect-deleted\" });\n }\n\n return (\n <ConnectDeleteItemModal\n open={open}\n onDelete={() => onDelete()}\n onCancel={() => closePHModal()}\n header={t(`modals.deleteItem.${kind?.toLowerCase()}.header`, {\n item: name,\n })}\n body={t(`modals.deleteItem.${kind?.toLowerCase()}.body`)}\n cancelLabel={t(\"common.cancel\")}\n deleteLabel={t(\"common.delete\")}\n />\n );\n};\n"],"mappings":";;;;;;;AAcA,MAAa,wBAAkC;CAC7C,MAAM,UAAU,YAAY;CAC5B,MAAM,OAAO,SAAS,SAAS;CAC/B,MAAM,KAAK,OAAO,QAAQ,KAAK,KAAA;CAC/B,MAAM,EAAE,MAAM,gBAAgB;CAC9B,MAAM,OAAO,YAAY,GAAG;CAC5B,MAAM,OAAO,MAAM;CACnB,MAAM,OAAO,MAAM;CACnB,MAAM,kBAAkB,oBAAoB;CAC5C,MAAM,mBAAmB,wBAAwB,MAAM,aAAa;CACpE,eAAe,WAAW;AACxB,MAAI,CAAC,mBAAmB,CAAC,GACvB;AAEF,gBAAc;EAEd,MAAM,UACJ,SAAS,WACL,sCACA;AAEN,QAAM,WAAW,iBAAiB,GAAG;AAErC,kBAAgB,iBAAiB;AAEjC,QAAM,EAAE,QAAQ,EAAE,EAAE,MAAM,mBAAmB,CAAC;;AAGhD,QACE,oBAAC,wBAAD;EACQ;EACN,gBAAgB,UAAU;EAC1B,gBAAgB,cAAc;EAC9B,QAAQ,EAAE,qBAAqB,MAAM,aAAa,CAAC,UAAU,EAC3D,MAAM,MACP,CAAC;EACF,MAAM,EAAE,qBAAqB,MAAM,aAAa,CAAC,OAAO;EACxD,aAAa,EAAE,gBAAgB;EAC/B,aAAa,EAAE,gBAAgB;EAC/B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DisclaimerModal-
|
|
1
|
+
{"version":3,"file":"DisclaimerModal-Dk6PpkZU.js","names":[],"sources":["../src/components/modal/modals/DisclaimerModal.tsx"],"sourcesContent":["import { ReadRequiredModal } from \"@powerhousedao/design-system/connect\";\nimport { closePHModal, usePHModal } from \"@powerhousedao/reactor-browser\";\nimport React from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\nexport const DisclaimerModal: React.FC = () => {\n const phModal = usePHModal();\n const open = phModal?.type === \"disclaimer\";\n\n const { t } = useTranslation();\n\n return (\n <ReadRequiredModal\n open={open}\n header={t(\"modals.disclaimer.title\")}\n body={t(\"modals.disclaimer.body\")}\n closeLabel=\"Close\"\n onContinue={() => closePHModal()}\n />\n );\n};\n"],"mappings":";;;;;;AAKA,MAAa,wBAAkC;CAE7C,MAAM,OADU,YAAY,EACN,SAAS;CAE/B,MAAM,EAAE,MAAM,gBAAgB;AAE9B,QACE,oBAAC,mBAAD;EACQ;EACN,QAAQ,EAAE,0BAA0B;EACpC,MAAM,EAAE,yBAAyB;EACjC,YAAW;EACX,kBAAkB,cAAc;EAChC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DriveSettingsModal-
|
|
1
|
+
{"version":3,"file":"DriveSettingsModal-BdcjrRh9.js","names":["ConnectDriveSettingsModal"],"sources":["../src/components/modal/modals/DriveSettingsModal.tsx"],"sourcesContent":["import { DriveSettingsModal as ConnectDriveSettingsModal } from \"@powerhousedao/design-system/connect\";\nimport {\n closePHModal,\n driveCollectionId,\n renameDrive,\n setDriveAvailableOffline,\n setDriveSharingType,\n showPHModal,\n useDriveById,\n useDriveSystemInfo,\n usePHModal,\n useSyncList,\n} from \"@powerhousedao/reactor-browser\";\nimport type { DocumentDriveDocument } from \"@powerhousedao/shared/document-drive\";\nimport type { SharingType } from \"@powerhousedao/shared/document-drive\";\nimport { useMemo } from \"react\";\n\nexport function DriveSettingsModal() {\n const phModal = usePHModal();\n const open = phModal?.type === \"driveSettings\";\n const driveId = open ? phModal.driveId : undefined;\n const [drive] = useDriveById(driveId);\n const remotes = useSyncList();\n\n const isRemoteDrive = useMemo(() => {\n if (!drive) return false;\n return remotes.some(\n (remote) =>\n remote.collectionId === driveCollectionId(\"main\", drive.header.id),\n );\n }, [remotes, drive]);\n\n const systemInfo = useDriveSystemInfo(drive);\n\n if (!driveId || !drive) {\n return null;\n }\n\n async function onRenameDrive(drive: DocumentDriveDocument, newName: string) {\n await renameDrive(drive.header.id, newName);\n }\n\n async function onChangeSharingType(\n drive: DocumentDriveDocument,\n newSharingType: SharingType,\n ) {\n await setDriveSharingType(drive.header.id, newSharingType);\n }\n\n async function onChangeAvailableOffline(\n drive: DocumentDriveDocument,\n newAvailableOffline: boolean,\n ) {\n await setDriveAvailableOffline(drive.header.id, newAvailableOffline);\n }\n\n return (\n <ConnectDriveSettingsModal\n drive={drive}\n sharingType={isRemoteDrive ? \"PUBLIC\" : \"LOCAL\"}\n availableOffline={!isRemoteDrive}\n systemInfo={systemInfo}\n open={open}\n onRenameDrive={onRenameDrive}\n onDeleteDrive={() => showPHModal({ type: \"deleteDrive\", driveId })}\n onChangeAvailableOffline={onChangeAvailableOffline}\n onChangeSharingType={onChangeSharingType}\n onOpenChange={(status) => {\n if (!status) return closePHModal();\n }}\n />\n );\n}\n"],"mappings":";;;;;AAiBA,SAAgB,qBAAqB;CACnC,MAAM,UAAU,YAAY;CAC5B,MAAM,OAAO,SAAS,SAAS;CAC/B,MAAM,UAAU,OAAO,QAAQ,UAAU,KAAA;CACzC,MAAM,CAAC,SAAS,aAAa,QAAQ;CACrC,MAAM,UAAU,aAAa;CAE7B,MAAM,gBAAgB,cAAc;AAClC,MAAI,CAAC,MAAO,QAAO;AACnB,SAAO,QAAQ,MACZ,WACC,OAAO,iBAAiB,kBAAkB,QAAQ,MAAM,OAAO,GAAG,CACrE;IACA,CAAC,SAAS,MAAM,CAAC;CAEpB,MAAM,aAAa,mBAAmB,MAAM;AAE5C,KAAI,CAAC,WAAW,CAAC,MACf,QAAO;CAGT,eAAe,cAAc,OAA8B,SAAiB;AAC1E,QAAM,YAAY,MAAM,OAAO,IAAI,QAAQ;;CAG7C,eAAe,oBACb,OACA,gBACA;AACA,QAAM,oBAAoB,MAAM,OAAO,IAAI,eAAe;;CAG5D,eAAe,yBACb,OACA,qBACA;AACA,QAAM,yBAAyB,MAAM,OAAO,IAAI,oBAAoB;;AAGtE,QACE,oBAACA,sBAAD;EACS;EACP,aAAa,gBAAgB,WAAW;EACxC,kBAAkB,CAAC;EACP;EACN;EACS;EACf,qBAAqB,YAAY;GAAE,MAAM;GAAe;GAAS,CAAC;EACxC;EACL;EACrB,eAAe,WAAW;AACxB,OAAI,CAAC,OAAQ,QAAO,cAAc;;EAEpC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExportDocumentWithErrorsModal-
|
|
1
|
+
{"version":3,"file":"ExportDocumentWithErrorsModal-DNRr3cjI.js","names":[],"sources":["../src/components/modal/modals/ExportDocumentWithErrorsModal.tsx"],"sourcesContent":["import { ConnectConfirmationModal } from \"@powerhousedao/design-system/connect\";\nimport {\n closePHModal,\n exportFile,\n useDocumentById,\n usePHModal,\n validateDocument,\n} from \"@powerhousedao/reactor-browser\";\nimport { useTranslation } from \"react-i18next\";\nexport function ExportDocumentWithErrorsModal() {\n const phModal = usePHModal();\n const open = phModal?.type === \"exportDocumentWithErrors\";\n const documentId = open ? phModal.documentId : undefined;\n const [document] = useDocumentById(documentId);\n const { t } = useTranslation();\n\n if (!document) {\n return null;\n }\n\n const validationErrors = validateDocument(document);\n return (\n <ConnectConfirmationModal\n header={t(\"modals.exportDocumentWithErrors.title\")}\n title={t(\"modals.exportDocumentWithErrors.title\")}\n body={\n <div>\n <p>{t(\"modals.exportDocumentWithErrors.body\")}</p>\n <ul className=\"mt-4 flex list-disc flex-col items-start px-4 text-xs\">\n {validationErrors.map((error, index) => (\n <li key={index}>{error.message}</li>\n ))}\n </ul>\n </div>\n }\n cancelLabel={t(\"common.cancel\")}\n continueLabel={t(\"common.export\")}\n onCancel={() => closePHModal()}\n onContinue={async () => {\n try {\n await exportFile(document);\n } catch (error) {\n console.error(error);\n } finally {\n closePHModal();\n }\n }}\n open={open}\n onOpenChange={(status: boolean) => {\n if (!status) return closePHModal();\n }}\n />\n );\n}\n"],"mappings":";;;;;AASA,SAAgB,gCAAgC;CAC9C,MAAM,UAAU,YAAY;CAC5B,MAAM,OAAO,SAAS,SAAS;CAE/B,MAAM,CAAC,YAAY,gBADA,OAAO,QAAQ,aAAa,KAAA,EACD;CAC9C,MAAM,EAAE,MAAM,gBAAgB;AAE9B,KAAI,CAAC,SACH,QAAO;CAGT,MAAM,mBAAmB,iBAAiB,SAAS;AACnD,QACE,oBAAC,0BAAD;EACE,QAAQ,EAAE,wCAAwC;EAClD,OAAO,EAAE,wCAAwC;EACjD,MACE,qBAAC,OAAD,EAAA,UAAA,CACE,oBAAC,KAAD,EAAA,UAAI,EAAE,uCAAuC,EAAK,CAAA,EAClD,oBAAC,MAAD;GAAI,WAAU;aACX,iBAAiB,KAAK,OAAO,UAC5B,oBAAC,MAAD,EAAA,UAAiB,MAAM,SAAa,EAA3B,MAA2B,CACpC;GACC,CAAA,CACD,EAAA,CAAA;EAER,aAAa,EAAE,gBAAgB;EAC/B,eAAe,EAAE,gBAAgB;EACjC,gBAAgB,cAAc;EAC9B,YAAY,YAAY;AACtB,OAAI;AACF,UAAM,WAAW,SAAS;YACnB,OAAO;AACd,YAAQ,MAAM,MAAM;aACZ;AACR,kBAAc;;;EAGZ;EACN,eAAe,WAAoB;AACjC,OAAI,CAAC,OAAQ,QAAO,cAAc;;EAEpC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as subscribeReactorPgMajor, o as loadPgDump, r as getCachedReactorPgMajor, s as resolvePgMajorForRuntime } from "./pglite-runtime-
|
|
2
|
-
import { t as PENDING_PG_SEED_KEY } from "./pglite-seed-
|
|
3
|
-
import { t as clearReactorStorage } from "./reactor-
|
|
1
|
+
import { c as subscribeReactorPgMajor, o as loadPgDump, r as getCachedReactorPgMajor, s as resolvePgMajorForRuntime } from "./pglite-runtime-C1g-4Jxl.js";
|
|
2
|
+
import { t as PENDING_PG_SEED_KEY } from "./pglite-seed-BtXWFpHf.js";
|
|
3
|
+
import { t as clearReactorStorage } from "./reactor-Nm3jOev1.js";
|
|
4
4
|
import { DocumentIntegrityService, InMemoryQueue, PollBehavior, REACTOR_SCHEMA, addRemoteDrive, closePHModal, useConnectionStates, useDatabase, usePGlite, usePHModal, useReactorClientModule, useSync } from "@powerhousedao/reactor-browser";
|
|
5
5
|
import { useCallback, useMemo, useSyncExternalStore } from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -369,4 +369,4 @@ const InspectorModal = () => {
|
|
|
369
369
|
//#endregion
|
|
370
370
|
export { InspectorModal };
|
|
371
371
|
|
|
372
|
-
//# sourceMappingURL=InspectorModal-
|
|
372
|
+
//# sourceMappingURL=InspectorModal-EDrjiXPs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InspectorModal-raPDjejR.js","names":["ConnectInspectorModal"],"sources":["../src/components/modal/modals/InspectorModal/useDbExplorer.ts","../src/components/modal/modals/InspectorModal/useDebugInspector.ts","../src/components/modal/modals/InspectorModal/useIntegrityInspector.ts","../src/components/modal/modals/InspectorModal/useProcessorsInspector.ts","../src/components/modal/modals/InspectorModal/useQueueInspector.ts","../src/components/modal/modals/InspectorModal/useRemotesInspector.ts","../src/components/modal/modals/InspectorModal/InspectorModal.tsx"],"sourcesContent":["import {\n getCachedReactorPgMajor,\n loadPgDump,\n resolvePgMajorForRuntime,\n} from \"@powerhousedao/connect/utils\";\nimport type {\n FilterGroup,\n SortOptions,\n} from \"@powerhousedao/design-system/connect\";\nimport {\n REACTOR_SCHEMA,\n useDatabase,\n usePGlite,\n useReactorClientModule,\n type IQueue,\n} from \"@powerhousedao/reactor-browser\";\nimport { sql } from \"kysely\";\nimport { useCallback } from \"react\";\n\nasync function quiesceQueue(queue: IQueue): Promise<void> {\n await new Promise<void>((resolve) => queue.block(() => resolve()));\n}\n\n// The reactor runs with `relaxedDurability: true`, which makes PGlite's\n// `syncToFs()` fire the IDBFS→IndexedDB write and return without awaiting\n// Emscripten's syncfs callback. `close()` also doesn't flush. Calling\n// `FS.syncfs(false, cb)` directly gives us a callback that fires from the\n// IDBFS transaction's `oncomplete` — i.e. after IDB has actually committed.\nasync function syncPgliteToIdb(pglite: {\n readonly Module: {\n readonly FS: {\n syncfs(populate: boolean, cb: (err: Error | null) => void): void;\n };\n };\n}): Promise<void> {\n await new Promise<void>((resolve, reject) => {\n pglite.Module.FS.syncfs(false, (err) => (err ? reject(err) : resolve()));\n });\n}\n\ntype ColumnInfo = {\n readonly name: string;\n readonly dataType: string;\n readonly isNullable: boolean;\n};\n\ntype TableInfo = {\n readonly name: string;\n readonly columns: ColumnInfo[];\n};\n\ntype ColumnRow = {\n table_name: string;\n column_name: string;\n data_type: string;\n is_nullable: string;\n};\n\ntype GetTableRowsOptions = {\n readonly schema?: string;\n readonly limit: number;\n readonly offset: number;\n readonly sort?: SortOptions;\n readonly filters?: FilterGroup;\n};\n\ntype TablePage = {\n readonly columns: string[];\n readonly rows: Record<string, unknown>[];\n readonly total: number | null;\n};\n\nconst PRIORITY_COLUMNS = [\n \"documentType\",\n \"documentId\",\n \"scope\",\n \"branch\",\n \"index\",\n \"skip\",\n] as const;\n\nexport function useDbExplorer() {\n const database = useDatabase();\n const pglite = usePGlite();\n const reactorClientModule = useReactorClientModule();\n const reactor = reactorClientModule?.reactorModule?.reactor;\n const queue = reactorClientModule?.reactorModule?.queue;\n\n const getTables = useCallback(async (): Promise<TableInfo[]> => {\n if (!database) return [];\n\n const result = await sql<ColumnRow>`\n SELECT\n c.table_name,\n c.column_name,\n c.data_type,\n c.is_nullable\n FROM information_schema.columns c\n INNER JOIN information_schema.tables t\n ON c.table_name = t.table_name\n AND c.table_schema = t.table_schema\n WHERE c.table_schema = ${REACTOR_SCHEMA}\n AND t.table_type = 'BASE TABLE'\n ORDER BY c.table_name, c.ordinal_position\n `.execute(database);\n\n const tableMap = new Map<string, ColumnInfo[]>();\n for (const row of result.rows) {\n if (!tableMap.has(row.table_name)) {\n tableMap.set(row.table_name, []);\n }\n tableMap.get(row.table_name)!.push({\n name: row.column_name,\n dataType: row.data_type,\n isNullable: row.is_nullable === \"YES\",\n });\n }\n\n return Array.from(tableMap).map(([name, columns]) => {\n const columnNames = columns.map((col) => col.name);\n const orderedColumns = [\n ...PRIORITY_COLUMNS.filter((col) => columnNames.includes(col)).map(\n (col) => columns.find((c) => c.name === col)!,\n ),\n ...columns.filter(\n (col) =>\n !PRIORITY_COLUMNS.includes(\n col.name as (typeof PRIORITY_COLUMNS)[number],\n ),\n ),\n ];\n return {\n name,\n columns: orderedColumns,\n };\n });\n }, [database]);\n\n const getTableRows = useCallback(\n async (table: string, options: GetTableRowsOptions): Promise<TablePage> => {\n if (!database) {\n return { columns: [], rows: [], total: null };\n }\n\n const limit = options.limit;\n const offset = options.offset;\n const sort = options.sort;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const filters = options.filters;\n const tableRef = sql.raw(`${REACTOR_SCHEMA}.\"${table}\"`);\n\n // Build WHERE clause from filters\n let whereClause = sql``;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (filters?.clauses && filters.clauses.length > 0) {\n const conditions: ReturnType<typeof sql>[] = [];\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n for (let i = 0; i < filters.clauses.length; i++) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment\n const clause = filters.clauses[i];\n if (!clause) continue;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const columnRef = sql.raw(`\"${clause.column}\"`);\n\n let condition: ReturnType<typeof sql>;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (clause.operator === \"IS NULL\") {\n condition = sql`${columnRef} IS NULL`;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n } else if (clause.operator === \"IS NOT NULL\") {\n condition = sql`${columnRef} IS NOT NULL`;\n } else if (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n clause.operator === \"LIKE\" ||\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n clause.operator === \"ILIKE\"\n ) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment\n const value = clause.value;\n const operator =\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n clause.operator === \"LIKE\" ? sql`LIKE` : sql`ILIKE`;\n condition = sql`${columnRef} ${operator} ${value}`;\n } else {\n // For =, !=, >, <, >=, <=\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument\n const operator = sql.raw(clause.operator);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment\n const value = clause.value;\n\n // Try to parse as number if it looks like a number\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n let parsedValue: string | number = value;\n if (\n value !== \"\" &&\n !isNaN(Number(value)) &&\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n value.trim() !== \"\"\n ) {\n parsedValue = Number(value);\n }\n\n condition = sql`${columnRef} ${operator} ${parsedValue}`;\n }\n\n conditions.push(condition);\n\n // Add connector if not the last clause\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (i < filters.clauses.length - 1) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment\n const connector = filters.connectors?.[i] ?? \"AND\";\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n conditions.push(sql.raw(connector));\n }\n }\n\n // Combine all conditions\n if (conditions.length > 0) {\n whereClause = sql`WHERE ${sql.join(conditions, sql` `)}`;\n }\n }\n\n // Build main query\n let query;\n if (sort) {\n const columnRef = sql.raw(`\"${sort.column}\"`);\n const direction = sort.direction === \"desc\" ? sql`DESC` : sql`ASC`;\n query = sql<Record<string, unknown>>`\n SELECT * FROM ${tableRef}\n ${whereClause}\n ORDER BY ${columnRef} ${direction}\n LIMIT ${limit} OFFSET ${offset}\n `;\n } else {\n query = sql<Record<string, unknown>>`\n SELECT * FROM ${tableRef}\n ${whereClause}\n LIMIT ${limit} OFFSET ${offset}\n `;\n }\n\n const result = await query.execute(database);\n\n // Build count query with same filters\n const countQuery = sql<{ count: string }>`\n SELECT COUNT(*) as count FROM ${tableRef}\n ${whereClause}\n `;\n const countResult = await countQuery.execute(database);\n const total = countResult.rows[0]\n ? parseInt(countResult.rows[0].count, 10)\n : null;\n\n const rawColumns =\n result.rows.length > 0 ? Object.keys(result.rows[0]) : [];\n const columns = [\n ...PRIORITY_COLUMNS.filter((col) => rawColumns.includes(col)),\n ...rawColumns.filter(\n (col) =>\n !PRIORITY_COLUMNS.includes(\n col as (typeof PRIORITY_COLUMNS)[number],\n ),\n ),\n ];\n\n return {\n columns,\n rows: result.rows,\n total,\n };\n },\n [database],\n );\n\n const onExportDb = useCallback(async () => {\n if (!pglite) return;\n\n if (queue) await quiesceQueue(queue);\n\n try {\n const major = resolvePgMajorForRuntime(getCachedReactorPgMajor() ?? null);\n const pgDump = await loadPgDump(major);\n const dump = await pgDump({ pg: pglite });\n const sqlContent = await dump.text();\n\n const blob = new Blob([sqlContent], { type: \"text/sql\" });\n const url = URL.createObjectURL(blob);\n const a = document.createElement(\"a\");\n a.href = url;\n a.download = `database-export-${Date.now()}.sql`;\n a.click();\n URL.revokeObjectURL(url);\n } finally {\n queue?.unblock();\n }\n }, [pglite, queue]);\n\n const onImportDb = useCallback(\n async (sqlContent: string) => {\n if (!pglite) return;\n\n if (queue) await quiesceQueue(queue);\n\n if (reactor) {\n const status = reactor.kill();\n await status.completed;\n }\n\n // Drop every user-created schema before restoring. Processors may own\n // schemas beyond `reactor`, so dropping only that one leaves orphans\n // whose tables collide with whatever the dump recreates. The dump\n // itself emits `CREATE SCHEMA ...;` statements, so we don't pre-create.\n // `standard_conforming_strings=off` matches pg_dump's escape-string\n // literals so doubled backslashes in JSONB collapse correctly.\n await pglite.transaction(async (tx) => {\n const schemas = await tx.query<{ nspname: string }>(\n `SELECT nspname FROM pg_namespace\n WHERE nspname NOT IN ('pg_catalog', 'pg_toast', 'information_schema', 'public')\n AND nspname NOT LIKE 'pg_temp_%'\n AND nspname NOT LIKE 'pg_toast_temp_%'`,\n );\n for (const { nspname } of schemas.rows) {\n await tx.exec(`DROP SCHEMA IF EXISTS \"${nspname}\" CASCADE`);\n }\n try {\n await tx.exec(\"SET standard_conforming_strings = off;\");\n } catch {\n // PG17 still accepts this but log if it ever fails.\n }\n await tx.exec(sqlContent);\n await tx.exec(`SET search_path TO ${REACTOR_SCHEMA}`);\n });\n\n // Flush IDBFS → IndexedDB synchronously. PGlite's own syncToFs is\n // fire-and-forget under relaxedDurability, and close() doesn't run\n // a final sync, so we drive Emscripten's syncfs directly — its\n // callback fires from the IDB transaction's oncomplete, guaranteeing\n // the writes have committed before we reload.\n await syncPgliteToIdb(pglite);\n\n window.location.reload();\n // reload() is asynchronous; without blocking here the DBExplorer caller\n // would continue and call loadTables() against an in-flight shutdown.\n await new Promise(() => {});\n },\n [pglite, queue, reactor],\n );\n\n const getDefaultSort = useCallback(\n (table: string): SortOptions | undefined => {\n if (table === \"Operation\") {\n return { column: \"timestampUtcMs\", direction: \"desc\" };\n }\n return undefined;\n },\n [],\n );\n\n return {\n getTables,\n getTableRows,\n getDefaultSort,\n onExportDb,\n onImportDb,\n };\n}\n","import { clearReactorStorage } from \"@powerhousedao/connect/store\";\nimport {\n getCachedReactorPgMajor,\n PENDING_PG_SEED_KEY,\n subscribeReactorPgMajor,\n} from \"@powerhousedao/connect/utils\";\nimport { useCallback, useSyncExternalStore } from \"react\";\n\nconst SUPPORTED_PG_VERSIONS = [16, 17] as const;\n\nexport function useDebugInspector() {\n const currentPgVersion = useSyncExternalStore(\n subscribeReactorPgMajor,\n getCachedReactorPgMajor,\n () => undefined,\n );\n\n const onResetToPgVersion = useCallback(async (major: number) => {\n console.info(`[debug-inspector] Reset requested: PG${major}`);\n try {\n localStorage.setItem(PENDING_PG_SEED_KEY, String(major));\n console.info(`[debug-inspector] Clearing reactor storage...`);\n await clearReactorStorage();\n console.info(`[debug-inspector] Storage cleared. Reloading...`);\n window.location.reload();\n } catch (err) {\n console.error(\"[debug-inspector] Reset failed:\", err);\n localStorage.removeItem(PENDING_PG_SEED_KEY);\n throw err;\n }\n }, []);\n\n return {\n supportedPgVersions: SUPPORTED_PG_VERSIONS,\n currentPgVersion: currentPgVersion ?? null,\n onResetToPgVersion,\n };\n}\n","import type { IntegrityInspectorProps } from \"@powerhousedao/design-system/connect\";\nimport {\n DocumentIntegrityService,\n useReactorClientModule,\n} from \"@powerhousedao/reactor-browser\";\nimport { useCallback, useMemo } from \"react\";\n\nexport function useIntegrityInspector(): IntegrityInspectorProps | undefined {\n const reactorClientModule = useReactorClientModule();\n const reactorModule = reactorClientModule?.reactorModule;\n\n const service = useMemo(() => {\n if (!reactorModule) return undefined;\n\n return new DocumentIntegrityService(\n reactorModule.keyframeStore,\n reactorModule.operationStore,\n reactorModule.writeCache,\n reactorModule.documentView,\n reactorModule.documentModelRegistry,\n );\n }, [reactorModule]);\n\n const onValidate = useCallback(\n async (documentId: string, branch?: string) => {\n if (!service) {\n throw new Error(\"Reactor module not available\");\n }\n return service.validateDocument(documentId, branch);\n },\n [service],\n );\n\n const onRebuildKeyframes = useCallback(\n async (documentId: string, branch?: string) => {\n if (!service) {\n throw new Error(\"Reactor module not available\");\n }\n return service.rebuildKeyframes(documentId, branch);\n },\n [service],\n );\n\n const onRebuildSnapshots = useCallback(\n async (documentId: string, branch?: string) => {\n if (!service) {\n throw new Error(\"Reactor module not available\");\n }\n return service.rebuildSnapshots(documentId, branch);\n },\n [service],\n );\n\n if (!service) {\n return undefined;\n }\n\n return {\n onValidate,\n onRebuildKeyframes,\n onRebuildSnapshots,\n };\n}\n","import type { ProcessorsInspectorProps } from \"@powerhousedao/design-system/connect\";\nimport { useReactorClientModule } from \"@powerhousedao/reactor-browser\";\nimport { useCallback, useMemo } from \"react\";\n\nexport function useProcessorsInspector(): ProcessorsInspectorProps | undefined {\n const reactorClientModule = useReactorClientModule();\n const processorManager = reactorClientModule?.reactorModule?.processorManager;\n\n const hasProcessorManager = useMemo(\n () => processorManager != null,\n [processorManager],\n );\n\n const getProcessors = useCallback(async () => {\n if (!processorManager) {\n return [];\n }\n\n return processorManager.getAll().map((tracked) => ({\n processorId: tracked.processorId,\n factoryId: tracked.factoryId,\n driveId: tracked.driveId,\n processorIndex: tracked.processorIndex,\n lastOrdinal: tracked.lastOrdinal,\n status: tracked.status,\n lastError: tracked.lastError,\n lastErrorTimestamp: tracked.lastErrorTimestamp,\n }));\n }, [processorManager]);\n\n const onRetry = useCallback(\n async (processorId: string) => {\n if (!processorManager) return;\n const tracked = processorManager.get(processorId);\n if (tracked) {\n await tracked.retry();\n }\n },\n [processorManager],\n );\n\n if (!hasProcessorManager) {\n return undefined;\n }\n\n return {\n getProcessors,\n onRetry,\n };\n}\n","import type {\n QueueInspectorProps,\n QueueState,\n} from \"@powerhousedao/design-system/connect\";\nimport {\n InMemoryQueue,\n useReactorClientModule,\n type Job,\n} from \"@powerhousedao/reactor-browser\";\nimport { useCallback, useMemo } from \"react\";\n\nexport function useQueueInspector(): QueueInspectorProps | undefined {\n const reactorClientModule = useReactorClientModule();\n const queue = reactorClientModule?.reactorModule?.queue;\n\n const inMemoryQueue = useMemo(() => {\n if (queue instanceof InMemoryQueue) {\n return queue;\n }\n return undefined;\n }, [queue]);\n\n const getQueueState = useCallback(async (): Promise<QueueState> => {\n if (!inMemoryQueue) {\n return {\n isPaused: false,\n pendingJobs: [],\n executingJobs: [],\n totalPending: 0,\n totalExecuting: 0,\n };\n }\n\n const pendingJobs = inMemoryQueue.getPendingJobs();\n const executingJobIds = inMemoryQueue.getExecutingJobIds();\n\n const executingJobs: Job[] = [];\n for (const jobIdSet of executingJobIds.values()) {\n for (const jobId of jobIdSet) {\n const job = inMemoryQueue.getJob(jobId);\n if (job) {\n executingJobs.push(job);\n }\n }\n }\n\n return {\n isPaused: inMemoryQueue.paused,\n pendingJobs,\n executingJobs,\n totalPending: pendingJobs.length,\n totalExecuting: executingJobs.length,\n };\n }, [inMemoryQueue]);\n\n const onPause = useCallback(async (): Promise<void> => {\n if (inMemoryQueue) {\n inMemoryQueue.pause();\n }\n }, [inMemoryQueue]);\n\n const onResume = useCallback(async (): Promise<void> => {\n if (inMemoryQueue) {\n await inMemoryQueue.resume();\n }\n }, [inMemoryQueue]);\n\n if (!inMemoryQueue) {\n return undefined;\n }\n\n return {\n getQueueState,\n onPause,\n onResume,\n };\n}\n","import type {\n ConnectionStateSnapshot,\n Remote,\n} from \"@powerhousedao/reactor-browser\";\nimport {\n addRemoteDrive,\n PollBehavior,\n useConnectionStates,\n useSync,\n} from \"@powerhousedao/reactor-browser\";\nimport { useCallback } from \"react\";\n\nexport function useRemotesInspector(): {\n getRemotes: () => Promise<Remote[]>;\n removeRemote: (name: string) => Promise<void>;\n addRemoteManual: (url: string) => Promise<void>;\n triggerPull: (name: string) => void;\n connectionStates: ReadonlyMap<string, ConnectionStateSnapshot>;\n} {\n const syncManager = useSync();\n if (!syncManager) {\n throw new Error(\"Sync manager not found\");\n }\n\n const connectionStates = useConnectionStates();\n\n const getRemotes = useCallback(() => {\n return Promise.resolve(syncManager.list());\n }, [syncManager]);\n\n const removeRemote = useCallback(\n (name: string) => syncManager.remove(name),\n [syncManager],\n );\n\n const addRemoteManual = useCallback(async (url: string) => {\n await addRemoteDrive(url, undefined, {\n pollBehavior: PollBehavior.Manual,\n });\n }, []);\n\n const triggerPull = useCallback(\n (name: string) => syncManager.triggerPull(name),\n [syncManager],\n );\n\n return {\n getRemotes,\n removeRemote,\n addRemoteManual,\n triggerPull,\n connectionStates,\n };\n}\n","import { InspectorModal as ConnectInspectorModal } from \"@powerhousedao/design-system/connect\";\nimport { REACTOR_SCHEMA } from \"@powerhousedao/reactor-browser\";\nimport { closePHModal, usePHModal } from \"@powerhousedao/reactor-browser\";\nimport { useDbExplorer } from \"./useDbExplorer.js\";\nimport { useDebugInspector } from \"./useDebugInspector.js\";\nimport { useIntegrityInspector } from \"./useIntegrityInspector.js\";\nimport { useProcessorsInspector } from \"./useProcessorsInspector.js\";\nimport { useQueueInspector } from \"./useQueueInspector.js\";\nimport { useRemotesInspector } from \"./useRemotesInspector.js\";\n\nconst DEFAULT_PAGE_SIZE = 25;\n\nexport const InspectorModal: React.FC = () => {\n const phModal = usePHModal();\n const open = phModal?.type === \"inspector\";\n\n const { getTables, getTableRows, getDefaultSort, onExportDb, onImportDb } =\n useDbExplorer();\n const {\n getRemotes,\n removeRemote,\n addRemoteManual,\n triggerPull,\n connectionStates,\n } = useRemotesInspector();\n const queueInspectorProps = useQueueInspector();\n const processorsInspectorProps = useProcessorsInspector();\n const integrityInspectorProps = useIntegrityInspector();\n const { currentPgVersion, supportedPgVersions, onResetToPgVersion } =\n useDebugInspector();\n\n return (\n <ConnectInspectorModal\n open={open}\n onOpenChange={(status) => {\n if (!status) closePHModal();\n }}\n dbExplorerProps={{\n schema: REACTOR_SCHEMA,\n getTables,\n getTableRows,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n getDefaultSort,\n pageSize: DEFAULT_PAGE_SIZE,\n onExportDb,\n onImportDb,\n pgVersionControl: {\n currentPgVersion,\n supportedPgVersions,\n onResetToPgVersion,\n },\n }}\n remotesInspectorProps={{\n getRemotes,\n removeRemote,\n addRemoteManual,\n triggerPull,\n connectionStates,\n }}\n queueInspectorProps={queueInspectorProps}\n processorsInspectorProps={processorsInspectorProps}\n integrityInspectorProps={integrityInspectorProps}\n />\n );\n};\n"],"mappings":";;;;;;;;;AAmBA,eAAe,aAAa,OAA8B;AACxD,OAAM,IAAI,SAAe,YAAY,MAAM,YAAY,SAAS,CAAC,CAAC;;AAQpE,eAAe,gBAAgB,QAMb;AAChB,OAAM,IAAI,SAAe,SAAS,WAAW;AAC3C,SAAO,OAAO,GAAG,OAAO,QAAQ,QAAS,MAAM,OAAO,IAAI,GAAG,SAAS,CAAE;GACxE;;AAmCJ,MAAM,mBAAmB;CACvB;CACA;CACA;CACA;CACA;CACA;CACD;AAED,SAAgB,gBAAgB;CAC9B,MAAM,WAAW,aAAa;CAC9B,MAAM,SAAS,WAAW;CAC1B,MAAM,sBAAsB,wBAAwB;CACpD,MAAM,UAAU,qBAAqB,eAAe;CACpD,MAAM,QAAQ,qBAAqB,eAAe;CAElD,MAAM,YAAY,YAAY,YAAkC;AAC9D,MAAI,CAAC,SAAU,QAAO,EAAE;EAExB,MAAM,SAAS,MAAM,GAAc;;;;;;;;;;+BAUR,eAAe;;;MAGxC,QAAQ,SAAS;EAEnB,MAAM,2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MAAM,EAAE,WAAW,cAAc,gBAAgB,YAAY,eAC3D,eAAe;CACjB,MAAM,EACJ,YACA,cACA,iBACA,aACA,qBACE,qBAAqB;CACzB,MAAM,sBAAsB,mBAAmB;CAC/C,MAAM,2BAA2B,wBAAwB;CACzD,MAAM,0BAA0B,uBAAuB;CACvD,MAAM,EAAE,kBAAkB,qBAAqB,uBAC7C,mBAAmB;AAErB,QACE,oBAACA,kBAAD;EACQ;EACN,eAAe,WAAW;AACxB,OAAI,CAAC,OAAQ,eAAc;;EAE7B,iBAAiB;GACf,QAAQ;GACR;GACA;GAEA;GACA,UAAU;GACV;GACA;GACA,kBAAkB;IAChB;IACA;IACA;IACD;GACF;EACD,uBAAuB;GACrB;GACA;GACA;GACA;GACA;GACD;EACoB;EACK;EACD;EACzB,CAAA"}
|
|
1
|
+
{"version":3,"file":"InspectorModal-EDrjiXPs.js","names":["ConnectInspectorModal"],"sources":["../src/components/modal/modals/InspectorModal/useDbExplorer.ts","../src/components/modal/modals/InspectorModal/useDebugInspector.ts","../src/components/modal/modals/InspectorModal/useIntegrityInspector.ts","../src/components/modal/modals/InspectorModal/useProcessorsInspector.ts","../src/components/modal/modals/InspectorModal/useQueueInspector.ts","../src/components/modal/modals/InspectorModal/useRemotesInspector.ts","../src/components/modal/modals/InspectorModal/InspectorModal.tsx"],"sourcesContent":["import {\n getCachedReactorPgMajor,\n loadPgDump,\n resolvePgMajorForRuntime,\n} from \"@powerhousedao/connect/utils\";\nimport type {\n FilterGroup,\n SortOptions,\n} from \"@powerhousedao/design-system/connect\";\nimport {\n REACTOR_SCHEMA,\n useDatabase,\n usePGlite,\n useReactorClientModule,\n type IQueue,\n} from \"@powerhousedao/reactor-browser\";\nimport { sql } from \"kysely\";\nimport { useCallback } from \"react\";\n\nasync function quiesceQueue(queue: IQueue): Promise<void> {\n await new Promise<void>((resolve) => queue.block(() => resolve()));\n}\n\n// The reactor runs with `relaxedDurability: true`, which makes PGlite's\n// `syncToFs()` fire the IDBFS→IndexedDB write and return without awaiting\n// Emscripten's syncfs callback. `close()` also doesn't flush. Calling\n// `FS.syncfs(false, cb)` directly gives us a callback that fires from the\n// IDBFS transaction's `oncomplete` — i.e. after IDB has actually committed.\nasync function syncPgliteToIdb(pglite: {\n readonly Module: {\n readonly FS: {\n syncfs(populate: boolean, cb: (err: Error | null) => void): void;\n };\n };\n}): Promise<void> {\n await new Promise<void>((resolve, reject) => {\n pglite.Module.FS.syncfs(false, (err) => (err ? reject(err) : resolve()));\n });\n}\n\ntype ColumnInfo = {\n readonly name: string;\n readonly dataType: string;\n readonly isNullable: boolean;\n};\n\ntype TableInfo = {\n readonly name: string;\n readonly columns: ColumnInfo[];\n};\n\ntype ColumnRow = {\n table_name: string;\n column_name: string;\n data_type: string;\n is_nullable: string;\n};\n\ntype GetTableRowsOptions = {\n readonly schema?: string;\n readonly limit: number;\n readonly offset: number;\n readonly sort?: SortOptions;\n readonly filters?: FilterGroup;\n};\n\ntype TablePage = {\n readonly columns: string[];\n readonly rows: Record<string, unknown>[];\n readonly total: number | null;\n};\n\nconst PRIORITY_COLUMNS = [\n \"documentType\",\n \"documentId\",\n \"scope\",\n \"branch\",\n \"index\",\n \"skip\",\n] as const;\n\nexport function useDbExplorer() {\n const database = useDatabase();\n const pglite = usePGlite();\n const reactorClientModule = useReactorClientModule();\n const reactor = reactorClientModule?.reactorModule?.reactor;\n const queue = reactorClientModule?.reactorModule?.queue;\n\n const getTables = useCallback(async (): Promise<TableInfo[]> => {\n if (!database) return [];\n\n const result = await sql<ColumnRow>`\n SELECT\n c.table_name,\n c.column_name,\n c.data_type,\n c.is_nullable\n FROM information_schema.columns c\n INNER JOIN information_schema.tables t\n ON c.table_name = t.table_name\n AND c.table_schema = t.table_schema\n WHERE c.table_schema = ${REACTOR_SCHEMA}\n AND t.table_type = 'BASE TABLE'\n ORDER BY c.table_name, c.ordinal_position\n `.execute(database);\n\n const tableMap = new Map<string, ColumnInfo[]>();\n for (const row of result.rows) {\n if (!tableMap.has(row.table_name)) {\n tableMap.set(row.table_name, []);\n }\n tableMap.get(row.table_name)!.push({\n name: row.column_name,\n dataType: row.data_type,\n isNullable: row.is_nullable === \"YES\",\n });\n }\n\n return Array.from(tableMap).map(([name, columns]) => {\n const columnNames = columns.map((col) => col.name);\n const orderedColumns = [\n ...PRIORITY_COLUMNS.filter((col) => columnNames.includes(col)).map(\n (col) => columns.find((c) => c.name === col)!,\n ),\n ...columns.filter(\n (col) =>\n !PRIORITY_COLUMNS.includes(\n col.name as (typeof PRIORITY_COLUMNS)[number],\n ),\n ),\n ];\n return {\n name,\n columns: orderedColumns,\n };\n });\n }, [database]);\n\n const getTableRows = useCallback(\n async (table: string, options: GetTableRowsOptions): Promise<TablePage> => {\n if (!database) {\n return { columns: [], rows: [], total: null };\n }\n\n const limit = options.limit;\n const offset = options.offset;\n const sort = options.sort;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const filters = options.filters;\n const tableRef = sql.raw(`${REACTOR_SCHEMA}.\"${table}\"`);\n\n // Build WHERE clause from filters\n let whereClause = sql``;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (filters?.clauses && filters.clauses.length > 0) {\n const conditions: ReturnType<typeof sql>[] = [];\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n for (let i = 0; i < filters.clauses.length; i++) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment\n const clause = filters.clauses[i];\n if (!clause) continue;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const columnRef = sql.raw(`\"${clause.column}\"`);\n\n let condition: ReturnType<typeof sql>;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (clause.operator === \"IS NULL\") {\n condition = sql`${columnRef} IS NULL`;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n } else if (clause.operator === \"IS NOT NULL\") {\n condition = sql`${columnRef} IS NOT NULL`;\n } else if (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n clause.operator === \"LIKE\" ||\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n clause.operator === \"ILIKE\"\n ) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment\n const value = clause.value;\n const operator =\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n clause.operator === \"LIKE\" ? sql`LIKE` : sql`ILIKE`;\n condition = sql`${columnRef} ${operator} ${value}`;\n } else {\n // For =, !=, >, <, >=, <=\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument\n const operator = sql.raw(clause.operator);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment\n const value = clause.value;\n\n // Try to parse as number if it looks like a number\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n let parsedValue: string | number = value;\n if (\n value !== \"\" &&\n !isNaN(Number(value)) &&\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n value.trim() !== \"\"\n ) {\n parsedValue = Number(value);\n }\n\n condition = sql`${columnRef} ${operator} ${parsedValue}`;\n }\n\n conditions.push(condition);\n\n // Add connector if not the last clause\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (i < filters.clauses.length - 1) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment\n const connector = filters.connectors?.[i] ?? \"AND\";\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n conditions.push(sql.raw(connector));\n }\n }\n\n // Combine all conditions\n if (conditions.length > 0) {\n whereClause = sql`WHERE ${sql.join(conditions, sql` `)}`;\n }\n }\n\n // Build main query\n let query;\n if (sort) {\n const columnRef = sql.raw(`\"${sort.column}\"`);\n const direction = sort.direction === \"desc\" ? sql`DESC` : sql`ASC`;\n query = sql<Record<string, unknown>>`\n SELECT * FROM ${tableRef}\n ${whereClause}\n ORDER BY ${columnRef} ${direction}\n LIMIT ${limit} OFFSET ${offset}\n `;\n } else {\n query = sql<Record<string, unknown>>`\n SELECT * FROM ${tableRef}\n ${whereClause}\n LIMIT ${limit} OFFSET ${offset}\n `;\n }\n\n const result = await query.execute(database);\n\n // Build count query with same filters\n const countQuery = sql<{ count: string }>`\n SELECT COUNT(*) as count FROM ${tableRef}\n ${whereClause}\n `;\n const countResult = await countQuery.execute(database);\n const total = countResult.rows[0]\n ? parseInt(countResult.rows[0].count, 10)\n : null;\n\n const rawColumns =\n result.rows.length > 0 ? Object.keys(result.rows[0]) : [];\n const columns = [\n ...PRIORITY_COLUMNS.filter((col) => rawColumns.includes(col)),\n ...rawColumns.filter(\n (col) =>\n !PRIORITY_COLUMNS.includes(\n col as (typeof PRIORITY_COLUMNS)[number],\n ),\n ),\n ];\n\n return {\n columns,\n rows: result.rows,\n total,\n };\n },\n [database],\n );\n\n const onExportDb = useCallback(async () => {\n if (!pglite) return;\n\n if (queue) await quiesceQueue(queue);\n\n try {\n const major = resolvePgMajorForRuntime(getCachedReactorPgMajor() ?? null);\n const pgDump = await loadPgDump(major);\n const dump = await pgDump({ pg: pglite });\n const sqlContent = await dump.text();\n\n const blob = new Blob([sqlContent], { type: \"text/sql\" });\n const url = URL.createObjectURL(blob);\n const a = document.createElement(\"a\");\n a.href = url;\n a.download = `database-export-${Date.now()}.sql`;\n a.click();\n URL.revokeObjectURL(url);\n } finally {\n queue?.unblock();\n }\n }, [pglite, queue]);\n\n const onImportDb = useCallback(\n async (sqlContent: string) => {\n if (!pglite) return;\n\n if (queue) await quiesceQueue(queue);\n\n if (reactor) {\n const status = reactor.kill();\n await status.completed;\n }\n\n // Drop every user-created schema before restoring. Processors may own\n // schemas beyond `reactor`, so dropping only that one leaves orphans\n // whose tables collide with whatever the dump recreates. The dump\n // itself emits `CREATE SCHEMA ...;` statements, so we don't pre-create.\n // `standard_conforming_strings=off` matches pg_dump's escape-string\n // literals so doubled backslashes in JSONB collapse correctly.\n await pglite.transaction(async (tx) => {\n const schemas = await tx.query<{ nspname: string }>(\n `SELECT nspname FROM pg_namespace\n WHERE nspname NOT IN ('pg_catalog', 'pg_toast', 'information_schema', 'public')\n AND nspname NOT LIKE 'pg_temp_%'\n AND nspname NOT LIKE 'pg_toast_temp_%'`,\n );\n for (const { nspname } of schemas.rows) {\n await tx.exec(`DROP SCHEMA IF EXISTS \"${nspname}\" CASCADE`);\n }\n try {\n await tx.exec(\"SET standard_conforming_strings = off;\");\n } catch {\n // PG17 still accepts this but log if it ever fails.\n }\n await tx.exec(sqlContent);\n await tx.exec(`SET search_path TO ${REACTOR_SCHEMA}`);\n });\n\n // Flush IDBFS → IndexedDB synchronously. PGlite's own syncToFs is\n // fire-and-forget under relaxedDurability, and close() doesn't run\n // a final sync, so we drive Emscripten's syncfs directly — its\n // callback fires from the IDB transaction's oncomplete, guaranteeing\n // the writes have committed before we reload.\n await syncPgliteToIdb(pglite);\n\n window.location.reload();\n // reload() is asynchronous; without blocking here the DBExplorer caller\n // would continue and call loadTables() against an in-flight shutdown.\n await new Promise(() => {});\n },\n [pglite, queue, reactor],\n );\n\n const getDefaultSort = useCallback(\n (table: string): SortOptions | undefined => {\n if (table === \"Operation\") {\n return { column: \"timestampUtcMs\", direction: \"desc\" };\n }\n return undefined;\n },\n [],\n );\n\n return {\n getTables,\n getTableRows,\n getDefaultSort,\n onExportDb,\n onImportDb,\n };\n}\n","import { clearReactorStorage } from \"@powerhousedao/connect/store\";\nimport {\n getCachedReactorPgMajor,\n PENDING_PG_SEED_KEY,\n subscribeReactorPgMajor,\n} from \"@powerhousedao/connect/utils\";\nimport { useCallback, useSyncExternalStore } from \"react\";\n\nconst SUPPORTED_PG_VERSIONS = [16, 17] as const;\n\nexport function useDebugInspector() {\n const currentPgVersion = useSyncExternalStore(\n subscribeReactorPgMajor,\n getCachedReactorPgMajor,\n () => undefined,\n );\n\n const onResetToPgVersion = useCallback(async (major: number) => {\n console.info(`[debug-inspector] Reset requested: PG${major}`);\n try {\n localStorage.setItem(PENDING_PG_SEED_KEY, String(major));\n console.info(`[debug-inspector] Clearing reactor storage...`);\n await clearReactorStorage();\n console.info(`[debug-inspector] Storage cleared. Reloading...`);\n window.location.reload();\n } catch (err) {\n console.error(\"[debug-inspector] Reset failed:\", err);\n localStorage.removeItem(PENDING_PG_SEED_KEY);\n throw err;\n }\n }, []);\n\n return {\n supportedPgVersions: SUPPORTED_PG_VERSIONS,\n currentPgVersion: currentPgVersion ?? null,\n onResetToPgVersion,\n };\n}\n","import type { IntegrityInspectorProps } from \"@powerhousedao/design-system/connect\";\nimport {\n DocumentIntegrityService,\n useReactorClientModule,\n} from \"@powerhousedao/reactor-browser\";\nimport { useCallback, useMemo } from \"react\";\n\nexport function useIntegrityInspector(): IntegrityInspectorProps | undefined {\n const reactorClientModule = useReactorClientModule();\n const reactorModule = reactorClientModule?.reactorModule;\n\n const service = useMemo(() => {\n if (!reactorModule) return undefined;\n\n return new DocumentIntegrityService(\n reactorModule.keyframeStore,\n reactorModule.operationStore,\n reactorModule.writeCache,\n reactorModule.documentView,\n reactorModule.documentModelRegistry,\n );\n }, [reactorModule]);\n\n const onValidate = useCallback(\n async (documentId: string, branch?: string) => {\n if (!service) {\n throw new Error(\"Reactor module not available\");\n }\n return service.validateDocument(documentId, branch);\n },\n [service],\n );\n\n const onRebuildKeyframes = useCallback(\n async (documentId: string, branch?: string) => {\n if (!service) {\n throw new Error(\"Reactor module not available\");\n }\n return service.rebuildKeyframes(documentId, branch);\n },\n [service],\n );\n\n const onRebuildSnapshots = useCallback(\n async (documentId: string, branch?: string) => {\n if (!service) {\n throw new Error(\"Reactor module not available\");\n }\n return service.rebuildSnapshots(documentId, branch);\n },\n [service],\n );\n\n if (!service) {\n return undefined;\n }\n\n return {\n onValidate,\n onRebuildKeyframes,\n onRebuildSnapshots,\n };\n}\n","import type { ProcessorsInspectorProps } from \"@powerhousedao/design-system/connect\";\nimport { useReactorClientModule } from \"@powerhousedao/reactor-browser\";\nimport { useCallback, useMemo } from \"react\";\n\nexport function useProcessorsInspector(): ProcessorsInspectorProps | undefined {\n const reactorClientModule = useReactorClientModule();\n const processorManager = reactorClientModule?.reactorModule?.processorManager;\n\n const hasProcessorManager = useMemo(\n () => processorManager != null,\n [processorManager],\n );\n\n const getProcessors = useCallback(async () => {\n if (!processorManager) {\n return [];\n }\n\n return processorManager.getAll().map((tracked) => ({\n processorId: tracked.processorId,\n factoryId: tracked.factoryId,\n driveId: tracked.driveId,\n processorIndex: tracked.processorIndex,\n lastOrdinal: tracked.lastOrdinal,\n status: tracked.status,\n lastError: tracked.lastError,\n lastErrorTimestamp: tracked.lastErrorTimestamp,\n }));\n }, [processorManager]);\n\n const onRetry = useCallback(\n async (processorId: string) => {\n if (!processorManager) return;\n const tracked = processorManager.get(processorId);\n if (tracked) {\n await tracked.retry();\n }\n },\n [processorManager],\n );\n\n if (!hasProcessorManager) {\n return undefined;\n }\n\n return {\n getProcessors,\n onRetry,\n };\n}\n","import type {\n QueueInspectorProps,\n QueueState,\n} from \"@powerhousedao/design-system/connect\";\nimport {\n InMemoryQueue,\n useReactorClientModule,\n type Job,\n} from \"@powerhousedao/reactor-browser\";\nimport { useCallback, useMemo } from \"react\";\n\nexport function useQueueInspector(): QueueInspectorProps | undefined {\n const reactorClientModule = useReactorClientModule();\n const queue = reactorClientModule?.reactorModule?.queue;\n\n const inMemoryQueue = useMemo(() => {\n if (queue instanceof InMemoryQueue) {\n return queue;\n }\n return undefined;\n }, [queue]);\n\n const getQueueState = useCallback(async (): Promise<QueueState> => {\n if (!inMemoryQueue) {\n return {\n isPaused: false,\n pendingJobs: [],\n executingJobs: [],\n totalPending: 0,\n totalExecuting: 0,\n };\n }\n\n const pendingJobs = inMemoryQueue.getPendingJobs();\n const executingJobIds = inMemoryQueue.getExecutingJobIds();\n\n const executingJobs: Job[] = [];\n for (const jobIdSet of executingJobIds.values()) {\n for (const jobId of jobIdSet) {\n const job = inMemoryQueue.getJob(jobId);\n if (job) {\n executingJobs.push(job);\n }\n }\n }\n\n return {\n isPaused: inMemoryQueue.paused,\n pendingJobs,\n executingJobs,\n totalPending: pendingJobs.length,\n totalExecuting: executingJobs.length,\n };\n }, [inMemoryQueue]);\n\n const onPause = useCallback(async (): Promise<void> => {\n if (inMemoryQueue) {\n inMemoryQueue.pause();\n }\n }, [inMemoryQueue]);\n\n const onResume = useCallback(async (): Promise<void> => {\n if (inMemoryQueue) {\n await inMemoryQueue.resume();\n }\n }, [inMemoryQueue]);\n\n if (!inMemoryQueue) {\n return undefined;\n }\n\n return {\n getQueueState,\n onPause,\n onResume,\n };\n}\n","import type {\n ConnectionStateSnapshot,\n Remote,\n} from \"@powerhousedao/reactor-browser\";\nimport {\n addRemoteDrive,\n PollBehavior,\n useConnectionStates,\n useSync,\n} from \"@powerhousedao/reactor-browser\";\nimport { useCallback } from \"react\";\n\nexport function useRemotesInspector(): {\n getRemotes: () => Promise<Remote[]>;\n removeRemote: (name: string) => Promise<void>;\n addRemoteManual: (url: string) => Promise<void>;\n triggerPull: (name: string) => void;\n connectionStates: ReadonlyMap<string, ConnectionStateSnapshot>;\n} {\n const syncManager = useSync();\n if (!syncManager) {\n throw new Error(\"Sync manager not found\");\n }\n\n const connectionStates = useConnectionStates();\n\n const getRemotes = useCallback(() => {\n return Promise.resolve(syncManager.list());\n }, [syncManager]);\n\n const removeRemote = useCallback(\n (name: string) => syncManager.remove(name),\n [syncManager],\n );\n\n const addRemoteManual = useCallback(async (url: string) => {\n await addRemoteDrive(url, undefined, {\n pollBehavior: PollBehavior.Manual,\n });\n }, []);\n\n const triggerPull = useCallback(\n (name: string) => syncManager.triggerPull(name),\n [syncManager],\n );\n\n return {\n getRemotes,\n removeRemote,\n addRemoteManual,\n triggerPull,\n connectionStates,\n };\n}\n","import { InspectorModal as ConnectInspectorModal } from \"@powerhousedao/design-system/connect\";\nimport { REACTOR_SCHEMA } from \"@powerhousedao/reactor-browser\";\nimport { closePHModal, usePHModal } from \"@powerhousedao/reactor-browser\";\nimport { useDbExplorer } from \"./useDbExplorer.js\";\nimport { useDebugInspector } from \"./useDebugInspector.js\";\nimport { useIntegrityInspector } from \"./useIntegrityInspector.js\";\nimport { useProcessorsInspector } from \"./useProcessorsInspector.js\";\nimport { useQueueInspector } from \"./useQueueInspector.js\";\nimport { useRemotesInspector } from \"./useRemotesInspector.js\";\n\nconst DEFAULT_PAGE_SIZE = 25;\n\nexport const InspectorModal: React.FC = () => {\n const phModal = usePHModal();\n const open = phModal?.type === \"inspector\";\n\n const { getTables, getTableRows, getDefaultSort, onExportDb, onImportDb } =\n useDbExplorer();\n const {\n getRemotes,\n removeRemote,\n addRemoteManual,\n triggerPull,\n connectionStates,\n } = useRemotesInspector();\n const queueInspectorProps = useQueueInspector();\n const processorsInspectorProps = useProcessorsInspector();\n const integrityInspectorProps = useIntegrityInspector();\n const { currentPgVersion, supportedPgVersions, onResetToPgVersion } =\n useDebugInspector();\n\n return (\n <ConnectInspectorModal\n open={open}\n onOpenChange={(status) => {\n if (!status) closePHModal();\n }}\n dbExplorerProps={{\n schema: REACTOR_SCHEMA,\n getTables,\n getTableRows,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n getDefaultSort,\n pageSize: DEFAULT_PAGE_SIZE,\n onExportDb,\n onImportDb,\n pgVersionControl: {\n currentPgVersion,\n supportedPgVersions,\n onResetToPgVersion,\n },\n }}\n remotesInspectorProps={{\n getRemotes,\n removeRemote,\n addRemoteManual,\n triggerPull,\n connectionStates,\n }}\n queueInspectorProps={queueInspectorProps}\n processorsInspectorProps={processorsInspectorProps}\n integrityInspectorProps={integrityInspectorProps}\n />\n );\n};\n"],"mappings":";;;;;;;;;AAmBA,eAAe,aAAa,OAA8B;AACxD,OAAM,IAAI,SAAe,YAAY,MAAM,YAAY,SAAS,CAAC,CAAC;;AAQpE,eAAe,gBAAgB,QAMb;AAChB,OAAM,IAAI,SAAe,SAAS,WAAW;AAC3C,SAAO,OAAO,GAAG,OAAO,QAAQ,QAAS,MAAM,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,UAAO,QAAQ,QAAQ,YAAY,MAAM,CAAC;KACzC,CAAC,YAAY,CAAC;EAoBf,cAlBmB,aAClB,SAAiB,YAAY,OAAO,KAAK,EAC1C,CAAC,YAAY,CACd;EAgBC,iBAdsB,YAAY,OAAO,QAAgB;AACzD,SAAM,eAAe,KAAK,KAAA,GAAW,EACnC,cAAc,aAAa,QAC5B,CAAC;KACD,EAAE,CAAC;EAWJ,aATkB,aACjB,SAAiB,YAAY,YAAY,KAAK,EAC/C,CAAC,YAAY,CACd;EAOC;EACD;;;;AC1CH,MAAM,oBAAoB;AAE1B,MAAa,uBAAiC;CAE5C,MAAM,OADU,YAAY,EACN,SAAS;CAE/B,MAAM,EAAE,WAAW,cAAc,gBAAgB,YAAY,eAC3D,eAAe;CACjB,MAAM,EACJ,YACA,cACA,iBACA,aACA,qBACE,qBAAqB;CACzB,MAAM,sBAAsB,mBAAmB;CAC/C,MAAM,2BAA2B,wBAAwB;CACzD,MAAM,0BAA0B,uBAAuB;CACvD,MAAM,EAAE,kBAAkB,qBAAqB,uBAC7C,mBAAmB;AAErB,QACE,oBAACA,kBAAD;EACQ;EACN,eAAe,WAAW;AACxB,OAAI,CAAC,OAAQ,eAAc;;EAE7B,iBAAiB;GACf,QAAQ;GACR;GACA;GAEA;GACA,UAAU;GACV;GACA;GACA,kBAAkB;IAChB;IACA;IACA;IACD;GACF;EACD,uBAAuB;GACrB;GACA;GACA;GACA;GACA;GACD;EACoB;EACK;EACD;EACzB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MissingPackageModal-
|
|
1
|
+
{"version":3,"file":"MissingPackageModal-BfblPbd8.js","names":[],"sources":["../src/components/modal/modals/MissingPackageModal.tsx"],"sourcesContent":["import { useRegistryPackages } from \"@powerhousedao/connect/hooks\";\nimport {\n PackageInstallModal,\n type PendingPackageInstallation,\n} from \"@powerhousedao/design-system/connect/index\";\nimport {\n closePHModal,\n usePHModal,\n useVetraPackageManager,\n} from \"@powerhousedao/reactor-browser\";\n\nexport function ConnectMissingPackageModal() {\n const phModal = usePHModal();\n const { registryPackageList, updateRegistryPackageStatus } =\n useRegistryPackages();\n const packageManager = useVetraPackageManager();\n const open = phModal?.type === \"missingPackage\";\n\n const documentType = open ? phModal.documentType : undefined;\n\n if (!packageManager || !documentType) return null;\n\n const pendingInstallations: PendingPackageInstallation[] = registryPackageList\n .filter((rp) => rp.documentTypes.includes(documentType))\n .map((rp) => ({\n documentType,\n packageName: rp.name,\n }));\n\n async function onInstall(packageName: string) {\n const result = await packageManager?.addPackage(packageName);\n if (result?.type === \"success\") {\n updateRegistryPackageStatus(packageName, \"registry-install\");\n }\n }\n\n function onDismiss(packageName: string) {\n updateRegistryPackageStatus(packageName, \"dismissed\");\n }\n\n return (\n <PackageInstallModal\n pendingInstallations={pendingInstallations}\n onInstall={onInstall}\n onDismiss={onDismiss}\n onOpenChange={(status: boolean) => {\n if (!status) return closePHModal();\n }}\n />\n );\n}\n"],"mappings":";;;;;AAWA,SAAgB,6BAA6B;CAC3C,MAAM,UAAU,YAAY;CAC5B,MAAM,EAAE,qBAAqB,gCAC3B,qBAAqB;CACvB,MAAM,iBAAiB,wBAAwB;CAG/C,MAAM,eAFO,SAAS,SAAS,mBAEH,QAAQ,eAAe,KAAA;AAEnD,KAAI,CAAC,kBAAkB,CAAC,aAAc,QAAO;CAE7C,MAAM,uBAAqD,oBACxD,QAAQ,OAAO,GAAG,cAAc,SAAS,aAAa,CAAC,CACvD,KAAK,QAAQ;EACZ;EACA,aAAa,GAAG;EACjB,EAAE;CAEL,eAAe,UAAU,aAAqB;AAE5C,OADe,MAAM,gBAAgB,WAAW,YAAY,GAChD,SAAS,UACnB,6BAA4B,aAAa,mBAAmB;;CAIhE,SAAS,UAAU,aAAqB;AACtC,8BAA4B,aAAa,YAAY;;AAGvD,QACE,oBAAC,qBAAD;EACwB;EACX;EACA;EACX,eAAe,WAAoB;AACjC,OAAI,CAAC,OAAQ,QAAO,cAAc;;EAEpC,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { t as connectConfig } from "./connect.config-Cuh0hj_Q.js";
|
|
2
2
|
import { n as toast } from "./toast-DnODOv28.js";
|
|
3
3
|
import { t as useRegistryPackages } from "./useRegistryPackages-BOX4NMAb.js";
|
|
4
|
-
import { t as package_default } from "./package-
|
|
4
|
+
import { t as package_default } from "./package-BO-kwGUs.js";
|
|
5
|
+
import { n as getGitUrl, r as shortGitSha, t as getGitSha } from "./build-info-BlcE3aZj.js";
|
|
5
6
|
import { closePHModal, deleteDrive, driveCollectionId, setSelectedDrive, showPHModal, useDriveSystemInfo, useDrives, usePHModal, useSyncList, useVetraPackageManager } from "@powerhousedao/reactor-browser";
|
|
6
7
|
import { useCallback, useMemo, useState } from "react";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -19,6 +20,7 @@ const About$1 = () => {
|
|
|
19
20
|
packageJson: package_default,
|
|
20
21
|
phCliVersion: typeof connectConfig.phCliVersion === "string" ? connectConfig.phCliVersion : void 0
|
|
21
22
|
}),
|
|
23
|
+
/* @__PURE__ */ jsx(AppGitHash, {}),
|
|
22
24
|
/* @__PURE__ */ jsx(ConnectedDrives, {}),
|
|
23
25
|
/* @__PURE__ */ jsxs("div", {
|
|
24
26
|
className: "bg-white p-3",
|
|
@@ -44,6 +46,30 @@ const About$1 = () => {
|
|
|
44
46
|
})
|
|
45
47
|
] });
|
|
46
48
|
};
|
|
49
|
+
function AppGitHash() {
|
|
50
|
+
const sha = getGitSha();
|
|
51
|
+
if (sha === "unknown") return null;
|
|
52
|
+
const url = getGitUrl();
|
|
53
|
+
const label = shortGitSha(sha);
|
|
54
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
55
|
+
className: "bg-white p-3 text-sm",
|
|
56
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
57
|
+
className: "font-semibold",
|
|
58
|
+
children: "Git hash: "
|
|
59
|
+
}), url ? /* @__PURE__ */ jsx("a", {
|
|
60
|
+
className: "font-mono underline",
|
|
61
|
+
href: url,
|
|
62
|
+
target: "_blank",
|
|
63
|
+
rel: "noreferrer noopener",
|
|
64
|
+
title: sha,
|
|
65
|
+
children: label
|
|
66
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
67
|
+
className: "font-mono",
|
|
68
|
+
title: sha,
|
|
69
|
+
children: label
|
|
70
|
+
})]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
47
73
|
function ConnectedDrives() {
|
|
48
74
|
const drives = useDrives() ?? [];
|
|
49
75
|
const remotes = useSyncList();
|
|
@@ -94,14 +120,21 @@ function DriveAboutEntry({ drive }) {
|
|
|
94
120
|
}),
|
|
95
121
|
" ",
|
|
96
122
|
info.version
|
|
97
|
-
] }), /* @__PURE__ */ jsxs("div", { children: [
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
123
|
+
] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
|
|
124
|
+
className: "font-medium",
|
|
125
|
+
children: "Git hash: "
|
|
126
|
+
}), info.gitUrl ? /* @__PURE__ */ jsx("a", {
|
|
127
|
+
className: "font-mono hover:underline",
|
|
128
|
+
href: info.gitUrl,
|
|
129
|
+
target: "_blank",
|
|
130
|
+
rel: "noreferrer noopener",
|
|
131
|
+
title: info.gitHash,
|
|
132
|
+
children: shortGitSha(info.gitHash)
|
|
133
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
134
|
+
className: "font-mono",
|
|
135
|
+
title: info.gitHash,
|
|
136
|
+
children: shortGitSha(info.gitHash)
|
|
137
|
+
})] })]
|
|
105
138
|
}),
|
|
106
139
|
info.status === "local" && /* @__PURE__ */ jsx("div", {
|
|
107
140
|
className: "mt-1 text-xs text-gray-400",
|
|
@@ -258,4 +291,4 @@ const SettingsModal = () => {
|
|
|
258
291
|
//#endregion
|
|
259
292
|
export { SettingsModal };
|
|
260
293
|
|
|
261
|
-
//# sourceMappingURL=SettingsModal-
|
|
294
|
+
//# sourceMappingURL=SettingsModal-ChpKp2ux.js.map
|