@powerhousedao/connect 6.2.1-dev.0 → 6.2.1
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-D-nbV40j.js → AddDriveModal-vA-eqqPS.js} +24 -10
- package/dist/AddDriveModal-vA-eqqPS.js.map +1 -0
- package/dist/{ClearStorageModal-BoHhAIcb.js → ClearStorageModal-Dm00WyUu.js} +4 -4
- package/dist/{ClearStorageModal-BoHhAIcb.js.map → ClearStorageModal-Dm00WyUu.js.map} +1 -1
- package/dist/{CookiesPolicyModal-CkcUKPLb.js → CookiesPolicyModal-1nOh6oN3.js} +3 -3
- package/dist/{CookiesPolicyModal-CkcUKPLb.js.map → CookiesPolicyModal-1nOh6oN3.js.map} +1 -1
- package/dist/{CreateDocumentModal-CvsTh0HM.js → CreateDocumentModal-nQbLVDq3.js} +3 -3
- package/dist/{CreateDocumentModal-CvsTh0HM.js.map → CreateDocumentModal-nQbLVDq3.js.map} +1 -1
- package/dist/{DebugSettingsModal-BVerP6Sp.js → DebugSettingsModal-CWZkbU7v.js} +6 -6
- package/dist/{DebugSettingsModal-BVerP6Sp.js.map → DebugSettingsModal-CWZkbU7v.js.map} +1 -1
- package/dist/{DeleteDriveModal-DSTK8FYk.js → DeleteDriveModal-6P0T1QgD.js} +4 -4
- package/dist/{DeleteDriveModal-DSTK8FYk.js.map → DeleteDriveModal-6P0T1QgD.js.map} +1 -1
- package/dist/{DeleteItemModal-B2nJmjsP.js → DeleteItemModal-BmV1aQyZ.js} +4 -4
- package/dist/{DeleteItemModal-B2nJmjsP.js.map → DeleteItemModal-BmV1aQyZ.js.map} +1 -1
- package/dist/{DisclaimerModal-D5FO34u9.js → DisclaimerModal-CVTFfN0_.js} +3 -3
- package/dist/{DisclaimerModal-D5FO34u9.js.map → DisclaimerModal-CVTFfN0_.js.map} +1 -1
- package/dist/{DownloadDocumentWithErrorsModal-tEr3bbtN.js → DownloadDocumentWithErrorsModal-CXeFUtaz.js} +3 -3
- package/dist/{DownloadDocumentWithErrorsModal-tEr3bbtN.js.map → DownloadDocumentWithErrorsModal-CXeFUtaz.js.map} +1 -1
- package/dist/{DriveAuthRequiredModal-BA2vS3oF.js → DriveAuthRequiredModal-DDlfeXD_.js} +3 -3
- package/dist/{DriveAuthRequiredModal-BA2vS3oF.js.map → DriveAuthRequiredModal-DDlfeXD_.js.map} +1 -1
- package/dist/{DriveSettingsModal-kR3hQnh4.js → DriveSettingsModal-CsNFEJ9E.js} +4 -4
- package/dist/DriveSettingsModal-CsNFEJ9E.js.map +1 -0
- package/dist/{InspectorModal-YtFXHkxp.js → InspectorModal-wChBJ6R5.js} +35 -84
- package/dist/InspectorModal-wChBJ6R5.js.map +1 -0
- package/dist/{MissingPackageModal-BQcCQbOn.js → MissingPackageModal-Bn036mWQ.js} +4 -4
- package/dist/{MissingPackageModal-BQcCQbOn.js.map → MissingPackageModal-Bn036mWQ.js.map} +1 -1
- package/dist/{SettingsModal-Cs-Wu3Rm.js → SettingsModal-1i3Dr5eT.js} +9 -9
- package/dist/SettingsModal-1i3Dr5eT.js.map +1 -0
- package/dist/{UpgradeDriveModal-BZGSE9_r.js → UpgradeDriveModal-C7lV4rAX.js} +3 -3
- package/dist/{UpgradeDriveModal-BZGSE9_r.js.map → UpgradeDriveModal-C7lV4rAX.js.map} +1 -1
- package/dist/{app-loader-CJrQEUby.js → app-loader-C5IWlQ7x.js} +258 -193
- package/dist/app-loader-C5IWlQ7x.js.map +1 -0
- package/dist/app-loader-DYpRh5ax.js +4 -0
- package/dist/{build-info-DtsaVWhi.js → build-info-zGvEjLMy.js} +5 -8
- package/dist/{build-info-DtsaVWhi.js.map → build-info-zGvEjLMy.js.map} +1 -1
- package/dist/components-CiPNtuf_.js +5 -0
- package/dist/{connect.config-p8UTNojR.js → connect.config-BDYNejx3.js} +3 -3
- package/dist/{connect.config-p8UTNojR.js.map → connect.config-BDYNejx3.js.map} +1 -1
- package/dist/{load-HWRrVQ7W.js → load-Bt4B0U-v.js} +11 -11
- package/dist/{load-HWRrVQ7W.js.map → load-Bt4B0U-v.js.map} +1 -1
- package/dist/main.js +1 -1
- package/dist/{package-CSEQB3Fe.js → package-CNJ1Q-58.js} +4 -5
- package/dist/package-CNJ1Q-58.js.map +1 -0
- package/dist/{pglite-major-B39aOEiE.js → pglite-runtime-CHa5UyCw.js} +47 -8
- package/dist/pglite-runtime-CHa5UyCw.js.map +1 -0
- package/dist/{pglite-seed-OvaK2kRv.js → pglite-seed-CvnZdEbx.js} +4 -4
- package/dist/{pglite-seed-OvaK2kRv.js.map → pglite-seed-CvnZdEbx.js.map} +1 -1
- package/dist/{reactor-CGjsDjJC.js → reactor-DWY9_ifj.js} +17 -229
- package/dist/reactor-DWY9_ifj.js.map +1 -0
- package/dist/{registerServiceWorker-BGIXpgGV.js → registerServiceWorker-Dc4QY0Sd.js} +4 -4
- package/dist/{registerServiceWorker-BGIXpgGV.js.map → registerServiceWorker-Dc4QY0Sd.js.map} +1 -1
- package/dist/{reload-connect-toast-D1Iqw9E_.js → reload-connect-toast-DIFQ9FCX.js} +3 -3
- package/dist/{reload-connect-toast-D1Iqw9E_.js.map → reload-connect-toast-DIFQ9FCX.js.map} +1 -1
- package/dist/start-connect.js +1 -1
- package/dist/{toast-4t-VimvD.js → toast-BEy42aYx.js} +3 -3
- package/dist/{toast-4t-VimvD.js.map → toast-BEy42aYx.js.map} +1 -1
- package/dist/{useRegistryPackages-BaYtekjQ.js → useRegistryPackages-B-gFECmd.js} +3 -3
- package/dist/{useRegistryPackages-BaYtekjQ.js.map → useRegistryPackages-B-gFECmd.js.map} +1 -1
- package/package.json +10 -11
- package/dist/AddDriveModal-D-nbV40j.js.map +0 -1
- package/dist/DriveSettingsModal-kR3hQnh4.js.map +0 -1
- package/dist/InspectorModal-YtFXHkxp.js.map +0 -1
- package/dist/SettingsModal-Cs-Wu3Rm.js.map +0 -1
- package/dist/app-loader-CJrQEUby.js.map +0 -1
- package/dist/app-loader-Da5NyqEp.js +0 -4
- package/dist/components-CYms4mPU.js +0 -5
- package/dist/connection-state-B7b2E8-L.js +0 -123
- package/dist/connection-state-B7b2E8-L.js.map +0 -1
- package/dist/package-CSEQB3Fe.js.map +0 -1
- package/dist/pglite-major-B39aOEiE.js.map +0 -1
- package/dist/pglite-migrate-core-Boxqqx-c.js +0 -143
- package/dist/pglite-migrate-core-Boxqqx-c.js.map +0 -1
- package/dist/reactor-CGjsDjJC.js.map +0 -1
- package/dist/reactor.worker.d.ts +0 -1
- package/dist/reactor.worker.js +0 -316
- package/dist/reactor.worker.js.map +0 -1
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e953dc08-9a65-58dd-8382-5a31beb3ed26")}catch(e){}}();
|
|
3
3
|
import { n as getRuntimeConfig } from "./runtime-config-DL3QjcfM.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { n as serviceWorkerManager, r as subscribeServiceWorkerUpdate, t as getServiceWorkerUpdateAvailable } from "./registerServiceWorker-BGIXpgGV.js";
|
|
10
|
-
import { n as toast, t as ToastContainer } from "./toast-4t-VimvD.js";
|
|
4
|
+
import { i as i18n, n as setSentryModule } from "./reload-connect-toast-DIFQ9FCX.js";
|
|
5
|
+
import { a as defaultPHDocumentEditorConfig, i as defaultPHAppConfig, r as connectConfig } from "./connect.config-BDYNejx3.js";
|
|
6
|
+
import { c as IDB_STORE_NAME, d as idbError, f as openIdb, l as PRIMARY_IDB_NAMES, n as getCachedReactorPgMajor, p as readPgVersionFile, s as subscribeReactorPgMajor, u as createFileDataStore } from "./pglite-runtime-CHa5UyCw.js";
|
|
7
|
+
import { n as serviceWorkerManager, r as subscribeServiceWorkerUpdate, t as getServiceWorkerUpdateAvailable } from "./registerServiceWorker-Dc4QY0Sd.js";
|
|
8
|
+
import { n as toast, t as ToastContainer } from "./toast-BEy42aYx.js";
|
|
11
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { PGlite } from "@electric-sql/pglite";
|
|
12
11
|
import { Trans, useTranslation } from "react-i18next";
|
|
13
12
|
import React, { StrictMode, Suspense, lazy, useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
14
13
|
import { DriveCollectionId, getRevisionFromDate, initTheme, logout, openRenown, setPHAppConfig, setPHDocumentEditorConfig, setRevisionHistoryVisible, setSelectedDrive, setSelectedNode, showPHModal, useAppModuleById, useConnectionStates, useDefaultAppModule, useDocumentById, useDocumentModelModuleById, useDocumentOperations, useDrives, useEditorModuleById, useEditorPreloader, useFallbackEditorModule, useIsAddDriveEnabled, useNodeParentFolderById, usePHModal, usePackageDiscoveryService, useReactorClientModule, useRevisionHistoryVisible, useSelectedDocument, useSelectedDocumentId, useSelectedDriveSafe, useSelectedFolder, useSelectedTimelineItem, useSyncList, useTheme, useUser, useVetraPackageManager, useVetraPackages } from "@powerhousedao/reactor-browser";
|
|
@@ -77,18 +76,18 @@ var DocumentEditorDebugTools = class {
|
|
|
77
76
|
//#endregion
|
|
78
77
|
//#region src/components/migration-status.ts
|
|
79
78
|
let current = null;
|
|
80
|
-
const listeners$
|
|
79
|
+
const listeners$3 = /* @__PURE__ */ new Set();
|
|
81
80
|
function setMigrationStatus(status) {
|
|
82
81
|
current = status;
|
|
83
|
-
for (const l of listeners$
|
|
82
|
+
for (const l of listeners$3) l();
|
|
84
83
|
}
|
|
85
84
|
function getMigrationStatus() {
|
|
86
85
|
return current;
|
|
87
86
|
}
|
|
88
87
|
function subscribeMigrationStatus(cb) {
|
|
89
|
-
listeners$
|
|
88
|
+
listeners$3.add(cb);
|
|
90
89
|
return () => {
|
|
91
|
-
listeners$
|
|
90
|
+
listeners$3.delete(cb);
|
|
92
91
|
};
|
|
93
92
|
}
|
|
94
93
|
//#endregion
|
|
@@ -96,6 +95,18 @@ function subscribeMigrationStatus(cb) {
|
|
|
96
95
|
const BACKUP_PREFIX = "ph-pglite-backup::";
|
|
97
96
|
const BACKUP_INDEX_KEY = "ph:pglite-backups";
|
|
98
97
|
const BACKUP_RETENTION_MS = 720 * 60 * 60 * 1e3;
|
|
98
|
+
const LEGACY_DUMPERS = { 16: async () => {
|
|
99
|
+
const [{ PGlite: LegacyPGlite }, { pgDump }] = await Promise.all([import("pglite-legacy-02"), import("pglite-tools-legacy-02/pg_dump")]);
|
|
100
|
+
return async (idbName) => {
|
|
101
|
+
const pg = new LegacyPGlite(`idb://${idbName.replace(/^\/pglite\//, "")}`);
|
|
102
|
+
try {
|
|
103
|
+
await pg.waitReady;
|
|
104
|
+
return await (await pgDump({ pg })).text();
|
|
105
|
+
} finally {
|
|
106
|
+
await pg.close();
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
} };
|
|
99
110
|
function deleteIdb(name, timeoutMs = 15e3) {
|
|
100
111
|
return new Promise((resolve, reject) => {
|
|
101
112
|
const req = indexedDB.deleteDatabase(name);
|
|
@@ -116,6 +127,56 @@ function deleteIdb(name, timeoutMs = 15e3) {
|
|
|
116
127
|
});
|
|
117
128
|
});
|
|
118
129
|
}
|
|
130
|
+
async function clearFileData(name) {
|
|
131
|
+
const db = await openIdb(name, 21, createFileDataStore);
|
|
132
|
+
try {
|
|
133
|
+
await new Promise((resolve, reject) => {
|
|
134
|
+
const tx = db.transaction(IDB_STORE_NAME, "readwrite");
|
|
135
|
+
tx.oncomplete = () => resolve();
|
|
136
|
+
tx.onerror = () => reject(idbError(tx, `FILE_DATA clear failed for ${name}`));
|
|
137
|
+
tx.onabort = () => reject(idbError(tx, `FILE_DATA clear aborted for ${name}`));
|
|
138
|
+
tx.objectStore(IDB_STORE_NAME).clear();
|
|
139
|
+
});
|
|
140
|
+
} finally {
|
|
141
|
+
db.close();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
async function cloneFileData(sourceName, destName) {
|
|
145
|
+
const source = await openIdb(sourceName, 21, createFileDataStore);
|
|
146
|
+
try {
|
|
147
|
+
const dest = await openIdb(destName, 21, createFileDataStore);
|
|
148
|
+
try {
|
|
149
|
+
const readStore = source.transaction(IDB_STORE_NAME, "readonly").objectStore(IDB_STORE_NAME);
|
|
150
|
+
const entries = await new Promise((resolve, reject) => {
|
|
151
|
+
const out = [];
|
|
152
|
+
const req = readStore.openCursor();
|
|
153
|
+
req.onerror = () => reject(idbError(req, `FILE_DATA read cursor failed for ${sourceName}`));
|
|
154
|
+
req.onsuccess = () => {
|
|
155
|
+
const cursor = req.result;
|
|
156
|
+
if (!cursor) return resolve(out);
|
|
157
|
+
out.push({
|
|
158
|
+
key: cursor.key,
|
|
159
|
+
value: cursor.value
|
|
160
|
+
});
|
|
161
|
+
cursor.continue();
|
|
162
|
+
};
|
|
163
|
+
});
|
|
164
|
+
await new Promise((resolve, reject) => {
|
|
165
|
+
const writeTx = dest.transaction(IDB_STORE_NAME, "readwrite");
|
|
166
|
+
writeTx.oncomplete = () => resolve();
|
|
167
|
+
writeTx.onerror = () => reject(idbError(writeTx, `FILE_DATA write failed for ${destName}`));
|
|
168
|
+
writeTx.onabort = () => reject(idbError(writeTx, `FILE_DATA write aborted for ${destName}`));
|
|
169
|
+
const writeStore = writeTx.objectStore(IDB_STORE_NAME);
|
|
170
|
+
writeStore.clear();
|
|
171
|
+
for (const { key, value } of entries) writeStore.put(value, key);
|
|
172
|
+
});
|
|
173
|
+
} finally {
|
|
174
|
+
dest.close();
|
|
175
|
+
}
|
|
176
|
+
} finally {
|
|
177
|
+
source.close();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
119
180
|
function readBackupIndex() {
|
|
120
181
|
try {
|
|
121
182
|
const raw = localStorage.getItem(BACKUP_INDEX_KEY);
|
|
@@ -154,47 +215,101 @@ async function janitor() {
|
|
|
154
215
|
}
|
|
155
216
|
writeBackupIndex(keep);
|
|
156
217
|
}
|
|
157
|
-
function
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
218
|
+
function publishPhase(idbName, phase) {
|
|
219
|
+
setMigrationStatus({
|
|
220
|
+
idbName,
|
|
221
|
+
phase
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
async function migrateIdbIfNeeded(idbName) {
|
|
225
|
+
const major = await readPgVersionFile(idbName);
|
|
226
|
+
if (major === null || major === 17) return;
|
|
227
|
+
const loader = LEGACY_DUMPERS[major];
|
|
228
|
+
if (!loader) throw new Error(`Unsupported legacy PGlite data dir: PG_VERSION=${major} for ${idbName}`);
|
|
229
|
+
const backupName = `${BACKUP_PREFIX}${idbName}::${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
230
|
+
const backupRec = {
|
|
231
|
+
name: backupName,
|
|
232
|
+
idbName,
|
|
233
|
+
createdAt: Date.now()
|
|
234
|
+
};
|
|
235
|
+
publishPhase(idbName, "clone");
|
|
236
|
+
await cloneFileData(idbName, backupName);
|
|
237
|
+
registerBackup(backupRec);
|
|
238
|
+
let sql;
|
|
239
|
+
try {
|
|
240
|
+
publishPhase(idbName, "dump");
|
|
241
|
+
sql = await (await loader())(idbName);
|
|
242
|
+
} catch (err) {
|
|
243
|
+
await deleteIdb(backupName).catch(() => {});
|
|
244
|
+
forgetBackup(backupName);
|
|
245
|
+
throw err;
|
|
246
|
+
}
|
|
247
|
+
try {
|
|
248
|
+
await clearFileData(idbName);
|
|
249
|
+
publishPhase(idbName, "restore");
|
|
250
|
+
const pg = new PGlite(`idb://${idbName.replace(/^\/pglite\//, "")}`, { relaxedDurability: false });
|
|
251
|
+
try {
|
|
252
|
+
await pg.waitReady;
|
|
253
|
+
console.info(`[pglite-migration] Dump preamble (first 500 chars):\n${sql.slice(0, 500)}`);
|
|
171
254
|
try {
|
|
172
|
-
await
|
|
173
|
-
} catch (
|
|
174
|
-
console.
|
|
175
|
-
return;
|
|
255
|
+
await pg.exec("SET standard_conforming_strings = off;");
|
|
256
|
+
} catch (gucErr) {
|
|
257
|
+
console.warn("[pglite-migration] Could not force standard_conforming_strings=off", gucErr);
|
|
176
258
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
259
|
+
try {
|
|
260
|
+
await pg.exec(sql);
|
|
261
|
+
} catch (execErr) {
|
|
262
|
+
logRestoreFailure(idbName, sql, execErr);
|
|
263
|
+
throw execErr;
|
|
264
|
+
}
|
|
265
|
+
} finally {
|
|
266
|
+
await pg.close();
|
|
267
|
+
}
|
|
268
|
+
} catch (err) {
|
|
269
|
+
await rollbackFromBackup(idbName, backupName, err);
|
|
270
|
+
throw err;
|
|
271
|
+
}
|
|
187
272
|
}
|
|
188
|
-
|
|
189
|
-
const
|
|
273
|
+
function logRestoreFailure(idbName, sql, err) {
|
|
274
|
+
const errObj = err;
|
|
275
|
+
const position = typeof errObj.position === "string" ? parseInt(errObj.position, 10) : typeof errObj.position === "number" ? errObj.position : NaN;
|
|
276
|
+
console.error(`[pglite-migration] Restore failed for ${idbName}`, {
|
|
277
|
+
message: errObj.message,
|
|
278
|
+
code: errObj.code,
|
|
279
|
+
severity: errObj.severity,
|
|
280
|
+
detail: errObj.detail,
|
|
281
|
+
where: errObj.where,
|
|
282
|
+
position: errObj.position,
|
|
283
|
+
sqlLength: sql.length
|
|
284
|
+
});
|
|
285
|
+
if (Number.isFinite(position) && position > 0) {
|
|
286
|
+
const zeroBased = position - 1;
|
|
287
|
+
const start = Math.max(0, zeroBased - 200);
|
|
288
|
+
const end = Math.min(sql.length, zeroBased + 200);
|
|
289
|
+
const before = sql.slice(start, zeroBased);
|
|
290
|
+
const at = sql.slice(zeroBased, zeroBased + 1);
|
|
291
|
+
const after = sql.slice(zeroBased + 1, end);
|
|
292
|
+
console.error(`[pglite-migration] SQL context around position ${position}:\n${before}»${at}«${after}`);
|
|
293
|
+
const lineStart = sql.lastIndexOf("\n", zeroBased) + 1;
|
|
294
|
+
const lineEnd = sql.indexOf("\n", zeroBased);
|
|
295
|
+
const line = sql.slice(lineStart, lineEnd === -1 ? sql.length : lineEnd);
|
|
296
|
+
console.error(`[pglite-migration] Failing line (truncated to 500 chars):\n${line.slice(0, 500)}`);
|
|
297
|
+
} else console.error(`[pglite-migration] No position info. First 2000 chars of dump:\n${sql.slice(0, 2e3)}`);
|
|
298
|
+
}
|
|
299
|
+
async function rollbackFromBackup(idbName, backupName, originalError) {
|
|
190
300
|
try {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
setMigrationStatus(null);
|
|
301
|
+
await clearFileData(idbName).catch(() => {});
|
|
302
|
+
await cloneFileData(backupName, idbName);
|
|
303
|
+
} catch (rollbackErr) {
|
|
304
|
+
console.error(`PGlite migration failed AND rollback failed for ${idbName}. Primary error:`, originalError, "Rollback error:", rollbackErr);
|
|
305
|
+
return;
|
|
197
306
|
}
|
|
307
|
+
await deleteIdb(backupName).catch(() => {});
|
|
308
|
+
forgetBackup(backupName);
|
|
309
|
+
}
|
|
310
|
+
async function migrateAllLocked() {
|
|
311
|
+
for (const idbName of PRIMARY_IDB_NAMES) await migrateIdbIfNeeded(idbName);
|
|
312
|
+
setMigrationStatus(null);
|
|
198
313
|
}
|
|
199
314
|
async function migrateAllIfNeeded() {
|
|
200
315
|
janitor().catch((err) => console.warn("PGlite backup janitor failed", err));
|
|
@@ -209,7 +324,7 @@ async function migrateAllIfNeeded() {
|
|
|
209
324
|
//#endregion
|
|
210
325
|
//#region src/hooks/useAcceptedCookies.ts
|
|
211
326
|
const ACCEPTED_COOKIES_KEY_STORAGE = `${connectConfig.routerBasename}:acceptedCookies`;
|
|
212
|
-
const listeners$
|
|
327
|
+
const listeners$2 = /* @__PURE__ */ new Set();
|
|
213
328
|
let cookies = getInitial$1();
|
|
214
329
|
function getInitial$1() {
|
|
215
330
|
try {
|
|
@@ -233,11 +348,11 @@ function getCookies() {
|
|
|
233
348
|
function setCookies(setter) {
|
|
234
349
|
cookies = setter(cookies);
|
|
235
350
|
localStorage.setItem(ACCEPTED_COOKIES_KEY_STORAGE, JSON.stringify(cookies));
|
|
236
|
-
listeners$
|
|
351
|
+
listeners$2.forEach((fn) => fn());
|
|
237
352
|
}
|
|
238
353
|
function subscribe$1(fn) {
|
|
239
|
-
listeners$
|
|
240
|
-
return () => listeners$
|
|
354
|
+
listeners$2.add(fn);
|
|
355
|
+
return () => listeners$2.delete(fn);
|
|
241
356
|
}
|
|
242
357
|
const useAcceptedCookies = () => {
|
|
243
358
|
return [useSyncExternalStore(subscribe$1, getCookies, getCookies), setCookies];
|
|
@@ -487,7 +602,7 @@ function useIsEmbedded() {
|
|
|
487
602
|
return getIsEmbedded();
|
|
488
603
|
}
|
|
489
604
|
const COOKIE_BANNER_KEY_STORAGE = `${connectConfig.routerBasename}:display-cookie-banner`;
|
|
490
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
605
|
+
const listeners$1 = /* @__PURE__ */ new Set();
|
|
491
606
|
let bannerShown = getInitial();
|
|
492
607
|
function getInitial() {
|
|
493
608
|
if (getIsEmbedded()) return false;
|
|
@@ -506,8 +621,8 @@ function setCookieBannerState(state) {
|
|
|
506
621
|
localStorage.setItem(COOKIE_BANNER_KEY_STORAGE, JSON.stringify(state));
|
|
507
622
|
}
|
|
508
623
|
function subscribe(fn) {
|
|
509
|
-
listeners.add(fn);
|
|
510
|
-
return () => listeners.delete(fn);
|
|
624
|
+
listeners$1.add(fn);
|
|
625
|
+
return () => listeners$1.delete(fn);
|
|
511
626
|
}
|
|
512
627
|
const useCookieBanner = () => {
|
|
513
628
|
return [useSyncExternalStore(subscribe, getCookieBannerState, getCookieBannerState), setCookieBannerState];
|
|
@@ -959,8 +1074,7 @@ function buildIdentifyPayload(user) {
|
|
|
959
1074
|
function OpenPanel() {
|
|
960
1075
|
const [{ analytics }] = useAcceptedCookies();
|
|
961
1076
|
const user = useUser();
|
|
962
|
-
const
|
|
963
|
-
const reactorClientModule = module?.kind === "browser" ? module : void 0;
|
|
1077
|
+
const reactorClientModule = useReactorClientModule();
|
|
964
1078
|
const [client, setClient] = useState();
|
|
965
1079
|
/**
|
|
966
1080
|
* Tracks the previous `user` value so we can detect the two transitions:
|
|
@@ -1331,7 +1445,7 @@ function DriveIcon({ drive }) {
|
|
|
1331
1445
|
const remotes = useSyncList();
|
|
1332
1446
|
const isRemoteDrive = useMemo(() => {
|
|
1333
1447
|
if (!drive) return false;
|
|
1334
|
-
return remotes.some((remote) => remote.
|
|
1448
|
+
return remotes.some((remote) => remote.collectionId.equals(DriveCollectionId.forDrive(drive.header.id)));
|
|
1335
1449
|
}, [remotes, drive]);
|
|
1336
1450
|
const driveIconSrc = drive?.state.global.icon;
|
|
1337
1451
|
if (driveIconSrc) return /* @__PURE__ */ jsx("img", {
|
|
@@ -1655,99 +1769,28 @@ function Sidebar() {
|
|
|
1655
1769
|
}) });
|
|
1656
1770
|
}
|
|
1657
1771
|
//#endregion
|
|
1658
|
-
//#region src/components/connection-banner.tsx
|
|
1659
|
-
const CONNECTED = "connected";
|
|
1660
|
-
const ConnectionBanner = () => {
|
|
1661
|
-
if (useSyncExternalStore(subscribeWorkerConnection, getWorkerConnectionStatus, () => CONNECTED) !== "lost") return null;
|
|
1662
|
-
return /* @__PURE__ */ jsx("div", {
|
|
1663
|
-
className: "absolute inset-x-0 top-0 z-30 flex justify-center p-3",
|
|
1664
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
1665
|
-
className: "flex max-w-3xl items-center gap-3 rounded-lg border border-destructive bg-warning px-4 py-3 text-sm text-warning-foreground shadow-lg",
|
|
1666
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
1667
|
-
className: "flex-1",
|
|
1668
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
1669
|
-
className: "font-semibold",
|
|
1670
|
-
children: "Lost connection to the reactor"
|
|
1671
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
1672
|
-
className: "text-foreground",
|
|
1673
|
-
children: "The background worker stopped responding. Reload to reconnect."
|
|
1674
|
-
})]
|
|
1675
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
1676
|
-
type: "button",
|
|
1677
|
-
onClick: () => window.location.reload(),
|
|
1678
|
-
className: "rounded-sm bg-primary px-3 py-1 text-sm font-medium text-primary-foreground hover:hover-effect",
|
|
1679
|
-
children: "Reload"
|
|
1680
|
-
})]
|
|
1681
|
-
})
|
|
1682
|
-
});
|
|
1683
|
-
};
|
|
1684
|
-
//#endregion
|
|
1685
1772
|
//#region src/components/migration-banner.tsx
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
className: "flex max-w-3xl items-center gap-3 rounded-lg border border-warning bg-warning px-4 py-3 text-sm text-warning-foreground shadow-lg",
|
|
1691
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
1692
|
-
className: "flex-1",
|
|
1693
|
-
children: [
|
|
1694
|
-
/* @__PURE__ */ jsx("div", {
|
|
1695
|
-
className: "font-semibold",
|
|
1696
|
-
children: title
|
|
1697
|
-
}),
|
|
1698
|
-
/* @__PURE__ */ jsx("div", {
|
|
1699
|
-
className: "text-foreground",
|
|
1700
|
-
children: body
|
|
1701
|
-
}),
|
|
1702
|
-
error && /* @__PURE__ */ jsxs("div", {
|
|
1703
|
-
className: "mt-2 font-medium text-destructive",
|
|
1704
|
-
children: ["Migration failed: ", error]
|
|
1705
|
-
})
|
|
1706
|
-
]
|
|
1707
|
-
}), children]
|
|
1708
|
-
})
|
|
1709
|
-
});
|
|
1773
|
+
let dismissed = false;
|
|
1774
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
1775
|
+
function notify() {
|
|
1776
|
+
for (const l of listeners) l();
|
|
1710
1777
|
}
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
function
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
if (state.status === "idle") return null;
|
|
1720
|
-
if (state.status === "needed" && dismissed) return null;
|
|
1721
|
-
const migrating = state.status === "migrating";
|
|
1722
|
-
const handleMigrate = () => {
|
|
1723
|
-
setError(null);
|
|
1724
|
-
adminClient.migrate().catch((err) => {
|
|
1725
|
-
setError(err instanceof Error ? err.message : String(err));
|
|
1726
|
-
});
|
|
1778
|
+
function dismiss() {
|
|
1779
|
+
dismissed = true;
|
|
1780
|
+
notify();
|
|
1781
|
+
}
|
|
1782
|
+
function subscribeDismissed(cb) {
|
|
1783
|
+
listeners.add(cb);
|
|
1784
|
+
return () => {
|
|
1785
|
+
listeners.delete(cb);
|
|
1727
1786
|
};
|
|
1728
|
-
return /* @__PURE__ */ jsxs(BannerShell, {
|
|
1729
|
-
title: migrating ? `Migrating to Postgres 17…` : `Your local database uses Postgres ${state.legacyMajor ?? "?"}.`,
|
|
1730
|
-
body: migrating ? `Working (${state.phase ?? "starting"}). Your data is backed up first.` : `Migrate to Postgres 17 to pick up the latest features. Your data will be backed up first.`,
|
|
1731
|
-
error: error ?? (state.status === "failed" ? state.error : null),
|
|
1732
|
-
children: [!migrating && /* @__PURE__ */ jsx("button", {
|
|
1733
|
-
type: "button",
|
|
1734
|
-
onClick: handleMigrate,
|
|
1735
|
-
className: actionButton,
|
|
1736
|
-
children: state.status === "failed" ? "Retry" : "Migrate now"
|
|
1737
|
-
}), state.status === "needed" && /* @__PURE__ */ jsx("button", {
|
|
1738
|
-
type: "button",
|
|
1739
|
-
onClick: () => setDismissed(true),
|
|
1740
|
-
className: dismissButton,
|
|
1741
|
-
children: "Dismiss"
|
|
1742
|
-
})]
|
|
1743
|
-
});
|
|
1744
1787
|
}
|
|
1745
|
-
function
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
const major = useSyncExternalStore(
|
|
1788
|
+
function getDismissed() {
|
|
1789
|
+
return dismissed;
|
|
1790
|
+
}
|
|
1791
|
+
const MigrationBanner = () => {
|
|
1792
|
+
const isDismissed = useSyncExternalStore(subscribeDismissed, getDismissed, () => false);
|
|
1793
|
+
const major = useSyncExternalStore(subscribeReactorPgMajor, getCachedReactorPgMajor, () => void 0);
|
|
1751
1794
|
const [migrating, setMigrating] = useState(false);
|
|
1752
1795
|
const [error, setError] = useState(null);
|
|
1753
1796
|
if (major === void 0 || major === null || major === 17) return null;
|
|
@@ -1755,52 +1798,75 @@ function BrowserMigrationBanner() {
|
|
|
1755
1798
|
const handleMigrate = () => {
|
|
1756
1799
|
setError(null);
|
|
1757
1800
|
setMigrating(true);
|
|
1758
|
-
migrateAllIfNeeded().then(() =>
|
|
1801
|
+
migrateAllIfNeeded().then(() => {
|
|
1802
|
+
window.location.reload();
|
|
1803
|
+
}).catch((err) => {
|
|
1759
1804
|
setError(err instanceof Error ? err.message : String(err));
|
|
1760
1805
|
setMigrating(false);
|
|
1761
1806
|
});
|
|
1762
1807
|
};
|
|
1763
|
-
return /* @__PURE__ */
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1808
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1809
|
+
className: "absolute inset-x-0 top-0 z-30 flex justify-center p-3",
|
|
1810
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1811
|
+
className: "flex max-w-3xl items-center gap-3 rounded-lg border border-warning bg-warning px-4 py-3 text-sm text-warning-foreground shadow-lg",
|
|
1812
|
+
children: [
|
|
1813
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1814
|
+
className: "flex-1",
|
|
1815
|
+
children: [
|
|
1816
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1817
|
+
className: "font-semibold",
|
|
1818
|
+
children: [
|
|
1819
|
+
"Your local database uses Postgres ",
|
|
1820
|
+
major,
|
|
1821
|
+
"."
|
|
1822
|
+
]
|
|
1823
|
+
}),
|
|
1824
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1825
|
+
className: "text-foreground",
|
|
1826
|
+
children: [
|
|
1827
|
+
"Migrate to Postgres ",
|
|
1828
|
+
17,
|
|
1829
|
+
" to pick up the latest features. Your data will be backed up first."
|
|
1830
|
+
]
|
|
1831
|
+
}),
|
|
1832
|
+
error && /* @__PURE__ */ jsxs("div", {
|
|
1833
|
+
className: "mt-2 font-medium text-destructive",
|
|
1834
|
+
children: ["Migration failed: ", error]
|
|
1835
|
+
})
|
|
1836
|
+
]
|
|
1837
|
+
}),
|
|
1838
|
+
/* @__PURE__ */ jsx("button", {
|
|
1839
|
+
type: "button",
|
|
1840
|
+
disabled: migrating,
|
|
1841
|
+
onClick: handleMigrate,
|
|
1842
|
+
className: "rounded-sm bg-primary px-3 py-1 text-sm font-medium text-primary-foreground hover:hover-effect disabled:disabled-effect",
|
|
1843
|
+
children: migrating ? "Migrating…" : "Migrate now"
|
|
1844
|
+
}),
|
|
1845
|
+
/* @__PURE__ */ jsx("button", {
|
|
1846
|
+
type: "button",
|
|
1847
|
+
disabled: migrating,
|
|
1848
|
+
onClick: dismiss,
|
|
1849
|
+
className: "rounded-sm border border-foreground bg-transparent px-3 py-1 text-sm font-medium text-foreground hover:hover-effect disabled:disabled-effect",
|
|
1850
|
+
children: "Dismiss"
|
|
1851
|
+
})
|
|
1852
|
+
]
|
|
1853
|
+
})
|
|
1783
1854
|
});
|
|
1784
|
-
}
|
|
1785
|
-
const MigrationBanner = () => {
|
|
1786
|
-
const module = useReactorClientModule();
|
|
1787
|
-
if (module?.kind === "worker") return /* @__PURE__ */ jsx(WorkerMigrationBanner, { adminClient: module.adminClient });
|
|
1788
|
-
return /* @__PURE__ */ jsx(BrowserMigrationBanner, {});
|
|
1789
1855
|
};
|
|
1790
1856
|
//#endregion
|
|
1791
1857
|
//#region src/components/modal/modals-container.tsx
|
|
1792
|
-
const AddDriveModal$1 = lazy(() => import("./AddDriveModal-
|
|
1793
|
-
const ClearStorageModal = lazy(() => import("./ClearStorageModal-
|
|
1794
|
-
const CookiesPolicyModal = lazy(() => import("./CookiesPolicyModal-
|
|
1795
|
-
const CreateDocumentModal$1 = lazy(() => import("./CreateDocumentModal-
|
|
1796
|
-
const DebugSettingsModal = lazy(() => import("./DebugSettingsModal-
|
|
1797
|
-
const DeleteDriveModal = lazy(() => import("./DeleteDriveModal-
|
|
1798
|
-
const DeleteItemModal = lazy(() => import("./DeleteItemModal-
|
|
1799
|
-
const DisclaimerModal = lazy(() => import("./DisclaimerModal-
|
|
1800
|
-
const DriveSettingsModal$1 = lazy(() => import("./DriveSettingsModal-
|
|
1801
|
-
const DownloadDocumentWithErrorsModal = lazy(() => import("./DownloadDocumentWithErrorsModal-
|
|
1802
|
-
const SettingsModal$1 = lazy(() => import("./SettingsModal-
|
|
1803
|
-
const UpgradeDriveModal = lazy(() => import("./UpgradeDriveModal-
|
|
1858
|
+
const AddDriveModal$1 = lazy(() => import("./AddDriveModal-vA-eqqPS.js").then((m) => ({ default: m.AddDriveModal })));
|
|
1859
|
+
const ClearStorageModal = lazy(() => import("./ClearStorageModal-Dm00WyUu.js").then((m) => ({ default: m.ClearStorageModal })));
|
|
1860
|
+
const CookiesPolicyModal = lazy(() => import("./CookiesPolicyModal-1nOh6oN3.js").then((m) => ({ default: m.CookiesPolicyModal })));
|
|
1861
|
+
const CreateDocumentModal$1 = lazy(() => import("./CreateDocumentModal-nQbLVDq3.js").then((m) => ({ default: m.CreateDocumentModal })));
|
|
1862
|
+
const DebugSettingsModal = lazy(() => import("./DebugSettingsModal-CWZkbU7v.js").then((m) => ({ default: m.DebugSettingsModal })));
|
|
1863
|
+
const DeleteDriveModal = lazy(() => import("./DeleteDriveModal-6P0T1QgD.js").then((m) => ({ default: m.DeleteDriveModal })));
|
|
1864
|
+
const DeleteItemModal = lazy(() => import("./DeleteItemModal-BmV1aQyZ.js").then((m) => ({ default: m.DeleteItemModal })));
|
|
1865
|
+
const DisclaimerModal = lazy(() => import("./DisclaimerModal-CVTFfN0_.js").then((m) => ({ default: m.DisclaimerModal })));
|
|
1866
|
+
const DriveSettingsModal$1 = lazy(() => import("./DriveSettingsModal-CsNFEJ9E.js").then((m) => ({ default: m.DriveSettingsModal })));
|
|
1867
|
+
const DownloadDocumentWithErrorsModal = lazy(() => import("./DownloadDocumentWithErrorsModal-CXeFUtaz.js").then((m) => ({ default: m.DownloadDocumentWithErrorsModal })));
|
|
1868
|
+
const SettingsModal$1 = lazy(() => import("./SettingsModal-1i3Dr5eT.js").then((m) => ({ default: m.SettingsModal })));
|
|
1869
|
+
const UpgradeDriveModal = lazy(() => import("./UpgradeDriveModal-C7lV4rAX.js").then((m) => ({ default: m.UpgradeDriveModal })));
|
|
1804
1870
|
const modalComponents = {
|
|
1805
1871
|
addDrive: AddDriveModal$1,
|
|
1806
1872
|
clearStorage: ClearStorageModal,
|
|
@@ -1812,11 +1878,11 @@ const modalComponents = {
|
|
|
1812
1878
|
disclaimer: DisclaimerModal,
|
|
1813
1879
|
driveSettings: DriveSettingsModal$1,
|
|
1814
1880
|
downloadDocumentWithErrors: DownloadDocumentWithErrorsModal,
|
|
1815
|
-
inspector: lazy(() => import("./InspectorModal-
|
|
1881
|
+
inspector: lazy(() => import("./InspectorModal-wChBJ6R5.js").then((m) => ({ default: m.InspectorModal }))),
|
|
1816
1882
|
settings: SettingsModal$1,
|
|
1817
1883
|
upgradeDrive: UpgradeDriveModal,
|
|
1818
|
-
missingPackage: lazy(() => import("./MissingPackageModal-
|
|
1819
|
-
driveAuthRequired: lazy(() => import("./DriveAuthRequiredModal-
|
|
1884
|
+
missingPackage: lazy(() => import("./MissingPackageModal-Bn036mWQ.js").then((m) => ({ default: m.ConnectMissingPackageModal }))),
|
|
1885
|
+
driveAuthRequired: lazy(() => import("./DriveAuthRequiredModal-DDlfeXD_.js").then((m) => ({ default: m.DriveAuthRequiredModal })))
|
|
1820
1886
|
};
|
|
1821
1887
|
const ModalsContainer = lazy(() => {
|
|
1822
1888
|
return Promise.resolve({ default: () => {
|
|
@@ -1856,7 +1922,7 @@ const ServiceWorkerUpdatePrompt = () => {
|
|
|
1856
1922
|
//#endregion
|
|
1857
1923
|
//#region src/components/app-loader.tsx
|
|
1858
1924
|
const AppLoader = (props) => {
|
|
1859
|
-
const Load = lazy(() => import("./load-
|
|
1925
|
+
const Load = lazy(() => import("./load-Bt4B0U-v.js").then((m) => m.loadComponent(props.localPackage)));
|
|
1860
1926
|
return /* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsxs(ErrorBoundary$1, {
|
|
1861
1927
|
fallbackRender: (props) => /* @__PURE__ */ jsx(AppSkeleton, { children: /* @__PURE__ */ jsx(DetailedFallback, { ...props }) }),
|
|
1862
1928
|
resetKeys: [props.localPackage],
|
|
@@ -1879,13 +1945,12 @@ const AppLoader = (props) => {
|
|
|
1879
1945
|
children: /* @__PURE__ */ jsx(ModalsContainer, {})
|
|
1880
1946
|
}),
|
|
1881
1947
|
/* @__PURE__ */ jsx(MigrationBanner, {}),
|
|
1882
|
-
/* @__PURE__ */ jsx(ServiceWorkerUpdatePrompt, {})
|
|
1883
|
-
/* @__PURE__ */ jsx(ConnectionBanner, {})
|
|
1948
|
+
/* @__PURE__ */ jsx(ServiceWorkerUpdatePrompt, {})
|
|
1884
1949
|
]
|
|
1885
1950
|
}) });
|
|
1886
1951
|
};
|
|
1887
1952
|
//#endregion
|
|
1888
1953
|
export { DocumentEditor as a, App as c, DocumentEditorContainer as d, OpenPanel as f, Root as i, AppContainer as l, AppSkeleton as m, Sidebar as n, DriveIcon as o, Analytics as p, Router as r, CookieBanner$1 as s, AppLoader as t, EditorLoader as u };
|
|
1889
1954
|
|
|
1890
|
-
//# sourceMappingURL=app-loader-
|
|
1891
|
-
//# debugId=
|
|
1955
|
+
//# sourceMappingURL=app-loader-C5IWlQ7x.js.map
|
|
1956
|
+
//# debugId=e953dc08-9a65-58dd-8382-5a31beb3ed26
|