@bygghammar/cms-platform 0.3.0 → 0.3.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/README.md +5 -0
- package/package.json +1 -1
- package/src/backup/browser-media.ts +18 -1
package/README.md
CHANGED
|
@@ -43,6 +43,11 @@ versions. Keep the dynamic import behind an `import.meta.env.SSR` guard in SSR
|
|
|
43
43
|
applications so the browser-only ZIP code cannot enter the optimized server
|
|
44
44
|
chunk graph.
|
|
45
45
|
|
|
46
|
+
Individual media downloads are retried before an export is stopped. Public
|
|
47
|
+
media-bucket adapters should also fall back to the object's public URL when an
|
|
48
|
+
authenticated Storage download fails, so one transient large-file request
|
|
49
|
+
cannot discard an otherwise valid archive.
|
|
50
|
+
|
|
46
51
|
The consuming site remains responsible for its dataset groups, table import
|
|
47
52
|
order, Supabase clients, superadmin authorization, HTTP routes, audit records
|
|
48
53
|
and database migrations. The package never contains site data or credentials.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bygghammar/cms-platform",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Shared CMS platform: blocks, block types, i18n core, UI primitives and design-token contract used by every Bygghammar/Voyara site.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -41,6 +41,23 @@ export type BrowserMediaExportOptions = {
|
|
|
41
41
|
onProgress?: (progress: MediaExportProgress) => void;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
const MEDIA_DOWNLOAD_ATTEMPTS = 3;
|
|
45
|
+
|
|
46
|
+
async function downloadWithRetry(storage: BrowserBackupStorage, path: string): Promise<Uint8Array> {
|
|
47
|
+
let lastError: unknown;
|
|
48
|
+
for (let attempt = 1; attempt <= MEDIA_DOWNLOAD_ATTEMPTS; attempt += 1) {
|
|
49
|
+
try {
|
|
50
|
+
return await storage.download(path);
|
|
51
|
+
} catch (error) {
|
|
52
|
+
lastError = error;
|
|
53
|
+
if (attempt < MEDIA_DOWNLOAD_ATTEMPTS) {
|
|
54
|
+
await new Promise((resolve) => setTimeout(resolve, attempt * 250));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
throw lastError;
|
|
59
|
+
}
|
|
60
|
+
|
|
44
61
|
function readManifest<M extends BackupArchiveManifest>(
|
|
45
62
|
files: Record<string, Uint8Array>,
|
|
46
63
|
expectedFormat: number | string,
|
|
@@ -149,7 +166,7 @@ export async function buildBrowserMediaArchive<M extends BackupArchiveManifest>(
|
|
|
149
166
|
for (const file of candidates) {
|
|
150
167
|
let data: Uint8Array;
|
|
151
168
|
try {
|
|
152
|
-
data = await storage
|
|
169
|
+
data = await downloadWithRetry(storage, file.name);
|
|
153
170
|
} catch (error) {
|
|
154
171
|
throw new Error(
|
|
155
172
|
`Could not download media file “${file.name}”: ${
|