@classic-homes/offline-core 0.1.4 → 0.1.5
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/cache/index.js +4 -4
- package/dist/{chunk-XHMX3BYT.js → chunk-DIXYWY34.js} +19 -3
- package/dist/{chunk-IIG4QLLN.js → chunk-EWMN3Y7N.js} +1 -1
- package/dist/{chunk-IDRYBB6Z.js → chunk-J2ZYJDJX.js} +110 -36
- package/dist/{chunk-ZDXEYCDZ.js → chunk-PEQVHD6Q.js} +5 -8
- package/dist/{chunk-4QWZX3LM.js → chunk-WWKATW37.js} +15 -9
- package/dist/drafts/index.js +2 -2
- package/dist/index.js +5 -5
- package/dist/storage/index.d.ts +4 -0
- package/dist/storage/index.js +1 -1
- package/dist/sync/index.js +2 -2
- package/package.json +1 -1
package/dist/cache/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { CACHE_PREFIX, CacheService, createCacheService, getCacheKey, getOriginalKey, invalidateAllCache, invalidateCacheByTag } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { CACHE_PREFIX, CacheService, createCacheService, getCacheKey, getOriginalKey, invalidateAllCache, invalidateCacheByTag } from '../chunk-PEQVHD6Q.js';
|
|
2
|
+
import '../chunk-J2ZYJDJX.js';
|
|
3
3
|
import '../chunk-U27TKOYZ.js';
|
|
4
|
-
import '../chunk-
|
|
5
|
-
import '../chunk-
|
|
4
|
+
import '../chunk-EWMN3Y7N.js';
|
|
5
|
+
import '../chunk-WWKATW37.js';
|
|
6
6
|
import '../chunk-ZC7F2HDV.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { generateDraftId, DraftManagerService } from './chunk-
|
|
1
|
+
import { generateDraftId, DraftManagerService } from './chunk-WWKATW37.js';
|
|
2
2
|
|
|
3
3
|
// src/sync/types.ts
|
|
4
4
|
var SyncConflictError = class extends Error {
|
|
@@ -577,7 +577,7 @@ var SyncService = class {
|
|
|
577
577
|
this.connectivity = createConnectivityMonitor();
|
|
578
578
|
this.queue = createSyncQueue(adapter);
|
|
579
579
|
this.connectivityUnsubscribe = this.connectivity.subscribe((online) => {
|
|
580
|
-
this.emit("online", online);
|
|
580
|
+
this.emit(online ? "online" : "offline", online);
|
|
581
581
|
this.onOnlineStatusChange?.(online);
|
|
582
582
|
if (online && this.config.autoSyncOnReconnect) {
|
|
583
583
|
void this.syncAll();
|
|
@@ -650,7 +650,11 @@ var SyncService = class {
|
|
|
650
650
|
const result = await this.performSync();
|
|
651
651
|
this.lastSyncResult = result;
|
|
652
652
|
if (result.conflicts.length > 0) {
|
|
653
|
-
this.conflicts
|
|
653
|
+
const byId = new Map(this.conflicts.map((c) => [c.localDraftId, c]));
|
|
654
|
+
for (const conflict of result.conflicts) {
|
|
655
|
+
byId.set(conflict.localDraftId, conflict);
|
|
656
|
+
}
|
|
657
|
+
this.conflicts = [...byId.values()];
|
|
654
658
|
await this.saveConflicts();
|
|
655
659
|
this.emit("sync:conflict", result.conflicts);
|
|
656
660
|
this.onConflictDetected?.(result.conflicts);
|
|
@@ -675,9 +679,13 @@ var SyncService = class {
|
|
|
675
679
|
* Sync a specific draft
|
|
676
680
|
*/
|
|
677
681
|
async syncDraft(draftId) {
|
|
682
|
+
if (this.isSyncing) {
|
|
683
|
+
return this.createErrorResult("Sync already in progress");
|
|
684
|
+
}
|
|
678
685
|
if (!this.isOnline) {
|
|
679
686
|
return this.createErrorResult("Device is offline");
|
|
680
687
|
}
|
|
688
|
+
this.isSyncing = true;
|
|
681
689
|
const startTime = Date.now();
|
|
682
690
|
try {
|
|
683
691
|
const draft = await this.draftManager.getDraft(draftId);
|
|
@@ -700,6 +708,8 @@ var SyncService = class {
|
|
|
700
708
|
error instanceof Error ? error.message : "Unknown error",
|
|
701
709
|
startTime
|
|
702
710
|
);
|
|
711
|
+
} finally {
|
|
712
|
+
this.isSyncing = false;
|
|
703
713
|
}
|
|
704
714
|
}
|
|
705
715
|
/**
|
|
@@ -894,6 +904,7 @@ var SyncService = class {
|
|
|
894
904
|
if (!remoteMap.has(metadata.remoteId)) {
|
|
895
905
|
await this.draftManager.deleteDraft(metadata.id);
|
|
896
906
|
deletedLocal++;
|
|
907
|
+
this.emit("draft:deleted", { draftId: metadata.id, remoteId: metadata.remoteId });
|
|
897
908
|
}
|
|
898
909
|
}
|
|
899
910
|
return {
|
|
@@ -919,6 +930,10 @@ var SyncService = class {
|
|
|
919
930
|
syncStatus: "synced",
|
|
920
931
|
lastSyncedAt: Date.now()
|
|
921
932
|
});
|
|
933
|
+
this.emit("draft:uploaded", {
|
|
934
|
+
draftId: draft.metadata.id,
|
|
935
|
+
remoteId: draft.metadata.remoteId
|
|
936
|
+
});
|
|
922
937
|
return { uploaded: true, downloaded: false, conflict: null };
|
|
923
938
|
} else {
|
|
924
939
|
const remote = await this.syncAdapter.createDraft(payload);
|
|
@@ -927,6 +942,7 @@ var SyncService = class {
|
|
|
927
942
|
syncStatus: "synced",
|
|
928
943
|
lastSyncedAt: Date.now()
|
|
929
944
|
});
|
|
945
|
+
this.emit("draft:uploaded", { draftId: draft.metadata.id, remoteId: remote.id });
|
|
930
946
|
return { uploaded: true, downloaded: false, conflict: null };
|
|
931
947
|
}
|
|
932
948
|
} catch (error) {
|
|
@@ -608,6 +608,23 @@ function createIndexedDBAdapter(options) {
|
|
|
608
608
|
return new IndexedDBAdapter(options);
|
|
609
609
|
}
|
|
610
610
|
|
|
611
|
+
// src/storage/opfs-keys.ts
|
|
612
|
+
function encodeOpfsKey(key) {
|
|
613
|
+
return encodeURIComponent(key).replace(/_/g, "%5F").replace(/%/g, "_");
|
|
614
|
+
}
|
|
615
|
+
function decodeOpfsKey(filename) {
|
|
616
|
+
try {
|
|
617
|
+
return decodeURIComponent(filename.replace(/_/g, "%"));
|
|
618
|
+
} catch {
|
|
619
|
+
return filename;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
function legacyOpfsFilename(key) {
|
|
623
|
+
const legacy = encodeURIComponent(key).replace(/%/g, "_");
|
|
624
|
+
if (legacy === encodeOpfsKey(key)) return null;
|
|
625
|
+
return decodeOpfsKey(legacy) === key ? legacy : null;
|
|
626
|
+
}
|
|
627
|
+
|
|
611
628
|
// src/worker/opfs-worker.ts
|
|
612
629
|
var ROOT_DIR = "classic-offline";
|
|
613
630
|
var BLOBS_DIR = "blobs";
|
|
@@ -622,10 +639,20 @@ async function initDirectories() {
|
|
|
622
639
|
metadataHandle = await rootHandle.getDirectoryHandle(METADATA_DIR, { create: true });
|
|
623
640
|
}
|
|
624
641
|
function encodeKey(key) {
|
|
625
|
-
return
|
|
642
|
+
return encodeOpfsKey(key);
|
|
626
643
|
}
|
|
627
644
|
function decodeKey(filename) {
|
|
628
|
-
return
|
|
645
|
+
return decodeOpfsKey(filename);
|
|
646
|
+
}
|
|
647
|
+
async function removeFiles(name) {
|
|
648
|
+
try {
|
|
649
|
+
await blobsHandle.removeEntry(name);
|
|
650
|
+
} catch {
|
|
651
|
+
}
|
|
652
|
+
try {
|
|
653
|
+
await metadataHandle.removeEntry(`${name}.json`);
|
|
654
|
+
} catch {
|
|
655
|
+
}
|
|
629
656
|
}
|
|
630
657
|
async function storeBlob(key, blob, metadata) {
|
|
631
658
|
if (!blobsHandle || !metadataHandle) {
|
|
@@ -646,14 +673,24 @@ async function storeBlob(key, blob, metadata) {
|
|
|
646
673
|
const metaWritable = await metaFileHandle.createWritable();
|
|
647
674
|
await metaWritable.write(JSON.stringify(fullMetadata));
|
|
648
675
|
await metaWritable.close();
|
|
676
|
+
const legacy = legacyOpfsFilename(key);
|
|
677
|
+
if (legacy) await removeFiles(legacy);
|
|
649
678
|
}
|
|
650
679
|
async function getBlob(key) {
|
|
651
680
|
if (!blobsHandle || !metadataHandle) {
|
|
652
681
|
throw new Error("Storage not initialized");
|
|
653
682
|
}
|
|
654
|
-
|
|
683
|
+
let encodedKey = encodeKey(key);
|
|
655
684
|
try {
|
|
656
|
-
|
|
685
|
+
let blobFileHandle;
|
|
686
|
+
try {
|
|
687
|
+
blobFileHandle = await blobsHandle.getFileHandle(encodedKey);
|
|
688
|
+
} catch (error) {
|
|
689
|
+
const legacy = legacyOpfsFilename(key);
|
|
690
|
+
if (!legacy) throw error;
|
|
691
|
+
blobFileHandle = await blobsHandle.getFileHandle(legacy);
|
|
692
|
+
encodedKey = legacy;
|
|
693
|
+
}
|
|
657
694
|
const blobFile = await blobFileHandle.getFile();
|
|
658
695
|
let metadata = {};
|
|
659
696
|
try {
|
|
@@ -676,15 +713,9 @@ async function deleteBlob(key) {
|
|
|
676
713
|
if (!blobsHandle || !metadataHandle) {
|
|
677
714
|
throw new Error("Storage not initialized");
|
|
678
715
|
}
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
} catch {
|
|
683
|
-
}
|
|
684
|
-
try {
|
|
685
|
-
await metadataHandle.removeEntry(`${encodedKey}.json`);
|
|
686
|
-
} catch {
|
|
687
|
-
}
|
|
716
|
+
await removeFiles(encodeKey(key));
|
|
717
|
+
const legacy = legacyOpfsFilename(key);
|
|
718
|
+
if (legacy) await removeFiles(legacy);
|
|
688
719
|
}
|
|
689
720
|
async function listBlobs(prefix) {
|
|
690
721
|
if (!blobsHandle) {
|
|
@@ -694,7 +725,7 @@ async function listBlobs(prefix) {
|
|
|
694
725
|
for await (const entry of blobsHandle.values()) {
|
|
695
726
|
if (entry.kind === "file") {
|
|
696
727
|
const key = decodeKey(entry.name);
|
|
697
|
-
if (!prefix || key.startsWith(prefix)) {
|
|
728
|
+
if ((!prefix || key.startsWith(prefix)) && !keys.includes(key)) {
|
|
698
729
|
keys.push(key);
|
|
699
730
|
}
|
|
700
731
|
}
|
|
@@ -832,12 +863,28 @@ let rootHandle = null;
|
|
|
832
863
|
let blobsHandle = null;
|
|
833
864
|
let metadataHandle = null;
|
|
834
865
|
|
|
866
|
+
// Keep in sync with storage/opfs-keys.ts
|
|
835
867
|
function encodeKey(key) {
|
|
836
|
-
return encodeURIComponent(key).replace(/%/g, '_');
|
|
868
|
+
return encodeURIComponent(key).replace(/_/g, '%5F').replace(/%/g, '_');
|
|
837
869
|
}
|
|
838
870
|
|
|
839
871
|
function decodeKey(filename) {
|
|
840
|
-
|
|
872
|
+
try {
|
|
873
|
+
return decodeURIComponent(filename.replace(/_/g, '%'));
|
|
874
|
+
} catch {
|
|
875
|
+
return filename;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
function legacyFilename(key) {
|
|
880
|
+
const legacy = encodeURIComponent(key).replace(/%/g, '_');
|
|
881
|
+
if (legacy === encodeKey(key)) return null;
|
|
882
|
+
return decodeKey(legacy) === key ? legacy : null;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
async function removeFiles(name) {
|
|
886
|
+
try { await blobsHandle.removeEntry(name); } catch {}
|
|
887
|
+
try { await metadataHandle.removeEntry(name + '.json'); } catch {}
|
|
841
888
|
}
|
|
842
889
|
|
|
843
890
|
async function initDirectories() {
|
|
@@ -864,13 +911,23 @@ async function storeBlob(key, blob, metadata) {
|
|
|
864
911
|
const metaWritable = await metaFileHandle.createWritable();
|
|
865
912
|
await metaWritable.write(JSON.stringify(fullMetadata));
|
|
866
913
|
await metaWritable.close();
|
|
914
|
+
const legacy = legacyFilename(key);
|
|
915
|
+
if (legacy) await removeFiles(legacy);
|
|
867
916
|
}
|
|
868
917
|
|
|
869
918
|
async function getBlob(key) {
|
|
870
919
|
if (!blobsHandle || !metadataHandle) throw new Error('Storage not initialized');
|
|
871
|
-
|
|
920
|
+
let encodedKey = encodeKey(key);
|
|
872
921
|
try {
|
|
873
|
-
|
|
922
|
+
let blobFileHandle;
|
|
923
|
+
try {
|
|
924
|
+
blobFileHandle = await blobsHandle.getFileHandle(encodedKey);
|
|
925
|
+
} catch (error) {
|
|
926
|
+
const legacy = legacyFilename(key);
|
|
927
|
+
if (!legacy) throw error;
|
|
928
|
+
blobFileHandle = await blobsHandle.getFileHandle(legacy);
|
|
929
|
+
encodedKey = legacy;
|
|
930
|
+
}
|
|
874
931
|
const blobFile = await blobFileHandle.getFile();
|
|
875
932
|
let metadata = {};
|
|
876
933
|
try {
|
|
@@ -891,9 +948,9 @@ async function getBlob(key) {
|
|
|
891
948
|
|
|
892
949
|
async function deleteBlob(key) {
|
|
893
950
|
if (!blobsHandle || !metadataHandle) throw new Error('Storage not initialized');
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
951
|
+
await removeFiles(encodeKey(key));
|
|
952
|
+
const legacy = legacyFilename(key);
|
|
953
|
+
if (legacy) await removeFiles(legacy);
|
|
897
954
|
}
|
|
898
955
|
|
|
899
956
|
async function listBlobs(prefix) {
|
|
@@ -902,7 +959,7 @@ async function listBlobs(prefix) {
|
|
|
902
959
|
for await (const entry of blobsHandle.values()) {
|
|
903
960
|
if (entry.kind === 'file') {
|
|
904
961
|
const key = decodeKey(entry.name);
|
|
905
|
-
if (!prefix || key.startsWith(prefix)) keys.push(key);
|
|
962
|
+
if ((!prefix || key.startsWith(prefix)) && !keys.includes(key)) keys.push(key);
|
|
906
963
|
}
|
|
907
964
|
}
|
|
908
965
|
return keys;
|
|
@@ -1059,13 +1116,26 @@ var OPFSAdapter = class {
|
|
|
1059
1116
|
* Encode key to safe filename
|
|
1060
1117
|
*/
|
|
1061
1118
|
encodeKey(key) {
|
|
1062
|
-
return
|
|
1119
|
+
return encodeOpfsKey(key);
|
|
1063
1120
|
}
|
|
1064
1121
|
/**
|
|
1065
1122
|
* Decode filename back to key
|
|
1066
1123
|
*/
|
|
1067
1124
|
decodeKey(filename) {
|
|
1068
|
-
return
|
|
1125
|
+
return decodeOpfsKey(filename);
|
|
1126
|
+
}
|
|
1127
|
+
/**
|
|
1128
|
+
* Remove a blob file and its metadata file, ignoring missing ones
|
|
1129
|
+
*/
|
|
1130
|
+
async removeFiles(name) {
|
|
1131
|
+
try {
|
|
1132
|
+
await this.blobsHandle.removeEntry(name);
|
|
1133
|
+
} catch {
|
|
1134
|
+
}
|
|
1135
|
+
try {
|
|
1136
|
+
await this.metadataHandle.removeEntry(`${name}.json`);
|
|
1137
|
+
} catch {
|
|
1138
|
+
}
|
|
1069
1139
|
}
|
|
1070
1140
|
// ===== Binary Storage =====
|
|
1071
1141
|
async storeBlob(key, blob, metadata) {
|
|
@@ -1102,6 +1172,8 @@ var OPFSAdapter = class {
|
|
|
1102
1172
|
const metaWritable = await metaFileHandle.createWritable();
|
|
1103
1173
|
await metaWritable.write(JSON.stringify(fullMetadata));
|
|
1104
1174
|
await metaWritable.close();
|
|
1175
|
+
const legacy = legacyOpfsFilename(key);
|
|
1176
|
+
if (legacy) await this.removeFiles(legacy);
|
|
1105
1177
|
} catch (error) {
|
|
1106
1178
|
throw OfflineStorageError.opfsError("Failed to store blob", error);
|
|
1107
1179
|
}
|
|
@@ -1122,9 +1194,17 @@ var OPFSAdapter = class {
|
|
|
1122
1194
|
if (!this.blobsHandle || !this.metadataHandle) {
|
|
1123
1195
|
throw OfflineStorageError.notInitialized();
|
|
1124
1196
|
}
|
|
1125
|
-
|
|
1197
|
+
let encodedKey = this.encodeKey(key);
|
|
1126
1198
|
try {
|
|
1127
|
-
|
|
1199
|
+
let blobFileHandle;
|
|
1200
|
+
try {
|
|
1201
|
+
blobFileHandle = await this.blobsHandle.getFileHandle(encodedKey);
|
|
1202
|
+
} catch (error) {
|
|
1203
|
+
const legacy = legacyOpfsFilename(key);
|
|
1204
|
+
if (!legacy) throw error;
|
|
1205
|
+
blobFileHandle = await this.blobsHandle.getFileHandle(legacy);
|
|
1206
|
+
encodedKey = legacy;
|
|
1207
|
+
}
|
|
1128
1208
|
const blobFile = await blobFileHandle.getFile();
|
|
1129
1209
|
let metadata = {};
|
|
1130
1210
|
try {
|
|
@@ -1156,15 +1236,9 @@ var OPFSAdapter = class {
|
|
|
1156
1236
|
if (!this.blobsHandle || !this.metadataHandle) {
|
|
1157
1237
|
throw OfflineStorageError.notInitialized();
|
|
1158
1238
|
}
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
} catch {
|
|
1163
|
-
}
|
|
1164
|
-
try {
|
|
1165
|
-
await this.metadataHandle.removeEntry(`${encodedKey}.json`);
|
|
1166
|
-
} catch {
|
|
1167
|
-
}
|
|
1239
|
+
await this.removeFiles(this.encodeKey(key));
|
|
1240
|
+
const legacy = legacyOpfsFilename(key);
|
|
1241
|
+
if (legacy) await this.removeFiles(legacy);
|
|
1168
1242
|
}
|
|
1169
1243
|
async listBlobs(prefix) {
|
|
1170
1244
|
if (this.useWorker) {
|
|
@@ -1186,7 +1260,7 @@ var OPFSAdapter = class {
|
|
|
1186
1260
|
for await (const entry of this.blobsHandle.values()) {
|
|
1187
1261
|
if (entry.kind === "file") {
|
|
1188
1262
|
const key = this.decodeKey(entry.name);
|
|
1189
|
-
if (!prefix || key.startsWith(prefix)) {
|
|
1263
|
+
if ((!prefix || key.startsWith(prefix)) && !keys.includes(key)) {
|
|
1190
1264
|
keys.push(key);
|
|
1191
1265
|
}
|
|
1192
1266
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createAdapter, OfflineStorageError } from './chunk-
|
|
1
|
+
import { createAdapter, OfflineStorageError, detectAvailableAdapters } from './chunk-J2ZYJDJX.js';
|
|
2
2
|
import { createFileStorageService } from './chunk-U27TKOYZ.js';
|
|
3
|
-
import { createDraftStorageService } from './chunk-
|
|
4
|
-
import { createDraftManagerService } from './chunk-
|
|
3
|
+
import { createDraftStorageService } from './chunk-EWMN3Y7N.js';
|
|
4
|
+
import { createDraftManagerService } from './chunk-WWKATW37.js';
|
|
5
5
|
import { DEFAULT_EXPIRATIONS, CleanupScheduler } from './chunk-ZC7F2HDV.js';
|
|
6
6
|
|
|
7
7
|
// src/cache/types.ts
|
|
@@ -385,13 +385,10 @@ async function resetOfflineStorage() {
|
|
|
385
385
|
initPromise = null;
|
|
386
386
|
}
|
|
387
387
|
async function detectStorageAdapter(preferredAdapters) {
|
|
388
|
-
const { adapterName
|
|
388
|
+
const { adapterName } = await createAdapter({
|
|
389
389
|
preferredAdapters
|
|
390
390
|
});
|
|
391
|
-
const available =
|
|
392
|
-
if (!unavailable.includes("opfs")) available.push("opfs");
|
|
393
|
-
if (!unavailable.includes("indexeddb")) available.push("indexeddb");
|
|
394
|
-
available.push("memory");
|
|
391
|
+
const { available, unavailable } = await detectAvailableAdapters();
|
|
395
392
|
return { adapterName, available, unavailable };
|
|
396
393
|
}
|
|
397
394
|
|
|
@@ -21,7 +21,7 @@ function parseDraftV2Key(key) {
|
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
23
|
const rest = key.slice(DRAFT_V2_PREFIX.length);
|
|
24
|
-
const colonIndex = rest.
|
|
24
|
+
const colonIndex = rest.lastIndexOf(":");
|
|
25
25
|
if (colonIndex === -1) {
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
@@ -40,17 +40,23 @@ function generateDraftId() {
|
|
|
40
40
|
return v.toString(16);
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
+
var sessionDeviceId;
|
|
43
44
|
function getOrCreateDeviceId() {
|
|
44
45
|
const DEVICE_ID_KEY = "classic-offline-device-id";
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
try {
|
|
47
|
+
if (typeof localStorage === "undefined") {
|
|
48
|
+
return generateDraftId();
|
|
49
|
+
}
|
|
50
|
+
let deviceId = localStorage.getItem(DEVICE_ID_KEY);
|
|
51
|
+
if (!deviceId) {
|
|
52
|
+
deviceId = generateDraftId();
|
|
53
|
+
localStorage.setItem(DEVICE_ID_KEY, deviceId);
|
|
54
|
+
}
|
|
55
|
+
return deviceId;
|
|
56
|
+
} catch {
|
|
57
|
+
sessionDeviceId ?? (sessionDeviceId = generateDraftId());
|
|
58
|
+
return sessionDeviceId;
|
|
52
59
|
}
|
|
53
|
-
return deviceId;
|
|
54
60
|
}
|
|
55
61
|
function isLegacyDraftKey(key) {
|
|
56
62
|
return key.startsWith(DRAFT_PREFIX) && !key.startsWith(DRAFT_V2_PREFIX);
|
package/dist/drafts/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { DraftStorageService, createDraftStorageService } from '../chunk-
|
|
2
|
-
export { CURRENT_DRAFT_PREFIX, DRAFT_PREFIX, DRAFT_V2_PREFIX, DraftManagerService, createDraftManagerService, generateDraftId, getCurrentDraftKey, getDraftKey, getDraftV2Key, getFormKeyFromDraftKey, getOrCreateDeviceId, isDraftV2Key, isLegacyDraftKey, parseDraftV2Key } from '../chunk-
|
|
1
|
+
export { DraftStorageService, createDraftStorageService } from '../chunk-EWMN3Y7N.js';
|
|
2
|
+
export { CURRENT_DRAFT_PREFIX, DRAFT_PREFIX, DRAFT_V2_PREFIX, DraftManagerService, createDraftManagerService, generateDraftId, getCurrentDraftKey, getDraftKey, getDraftV2Key, getFormKeyFromDraftKey, getOrCreateDeviceId, isDraftV2Key, isLegacyDraftKey, parseDraftV2Key } from '../chunk-WWKATW37.js';
|
|
3
3
|
import '../chunk-ZC7F2HDV.js';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { CACHE_PREFIX, CacheService, createCacheService, detectStorageAdapter, getOfflineStorage, getOfflineStorageOrNull, initOfflineStorage, invalidateAllCache, invalidateCacheByTag, isOfflineStorageInitialized, resetOfflineStorage } from './chunk-
|
|
2
|
-
export { OfflineStorageError, createAdapter, detectAvailableAdapters, detectBrowser, isBrowser, isSSR, isWorker, supportsIndexedDB, supportsLocalStorage, supportsOPFS } from './chunk-
|
|
1
|
+
export { CACHE_PREFIX, CacheService, createCacheService, detectStorageAdapter, getOfflineStorage, getOfflineStorageOrNull, initOfflineStorage, invalidateAllCache, invalidateCacheByTag, isOfflineStorageInitialized, resetOfflineStorage } from './chunk-PEQVHD6Q.js';
|
|
2
|
+
export { OfflineStorageError, createAdapter, detectAvailableAdapters, detectBrowser, isBrowser, isSSR, isWorker, supportsIndexedDB, supportsLocalStorage, supportsOPFS } from './chunk-J2ZYJDJX.js';
|
|
3
3
|
export { FileStorageService, createFileStorageService } from './chunk-U27TKOYZ.js';
|
|
4
|
-
export { DraftStorageService, createDraftStorageService } from './chunk-
|
|
5
|
-
export { ConnectivityMonitor, SyncQueue, SyncService, applyResolution, compareDrafts, createConnectivityMonitor, createSyncQueue, createSyncService, detectConflict } from './chunk-
|
|
6
|
-
export { DRAFT_PREFIX, DRAFT_V2_PREFIX, DraftManagerService, createDraftManagerService, generateDraftId, getOrCreateDeviceId } from './chunk-
|
|
4
|
+
export { DraftStorageService, createDraftStorageService } from './chunk-EWMN3Y7N.js';
|
|
5
|
+
export { ConnectivityMonitor, SyncQueue, SyncService, applyResolution, compareDrafts, createConnectivityMonitor, createSyncQueue, createSyncService, detectConflict } from './chunk-DIXYWY34.js';
|
|
6
|
+
export { DRAFT_PREFIX, DRAFT_V2_PREFIX, DraftManagerService, createDraftManagerService, generateDraftId, getOrCreateDeviceId } from './chunk-WWKATW37.js';
|
|
7
7
|
export { CleanupScheduler, DEFAULT_EXPIRATIONS, calculateExpiration, isExpired } from './chunk-ZC7F2HDV.js';
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -124,6 +124,10 @@ declare class OPFSAdapter implements StorageAdapter {
|
|
|
124
124
|
* Decode filename back to key
|
|
125
125
|
*/
|
|
126
126
|
private decodeKey;
|
|
127
|
+
/**
|
|
128
|
+
* Remove a blob file and its metadata file, ignoring missing ones
|
|
129
|
+
*/
|
|
130
|
+
private removeFiles;
|
|
127
131
|
storeBlob(key: string, blob: Blob, metadata?: BlobMetadata): Promise<void>;
|
|
128
132
|
getBlob(key: string): Promise<BlobWithMetadata | null>;
|
|
129
133
|
deleteBlob(key: string): Promise<void>;
|
package/dist/storage/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { IndexedDBAdapter, MemoryAdapter, OPFSAdapter, createAdapter, createIndexedDBAdapter, createMemoryAdapter, createOPFSAdapter, detectAvailableAdapters } from '../chunk-
|
|
1
|
+
export { IndexedDBAdapter, MemoryAdapter, OPFSAdapter, createAdapter, createIndexedDBAdapter, createMemoryAdapter, createOPFSAdapter, detectAvailableAdapters } from '../chunk-J2ZYJDJX.js';
|
|
2
2
|
import '../chunk-ZC7F2HDV.js';
|
package/dist/sync/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ConnectivityMonitor, SyncConflictError, SyncQueue, SyncService, applyResolution, compareDrafts, createConflict, createConnectivityMonitor, createSyncQueue, createSyncService, detectConflict, isSyncConflictError, resolveKeepLocal, resolveKeepRemote, resolveMerge } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { ConnectivityMonitor, SyncConflictError, SyncQueue, SyncService, applyResolution, compareDrafts, createConflict, createConnectivityMonitor, createSyncQueue, createSyncService, detectConflict, isSyncConflictError, resolveKeepLocal, resolveKeepRemote, resolveMerge } from '../chunk-DIXYWY34.js';
|
|
2
|
+
import '../chunk-WWKATW37.js';
|
|
3
3
|
import '../chunk-ZC7F2HDV.js';
|