selfstore 1.8.15 → 1.8.17

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.
@@ -1,12 +1,12 @@
1
- import { B as BackupTarget } from './store-CiLoRJmy.js';
2
- export { A as AuthExpiredError, a as BuiltinTargetKind, E as EncodeOptions, H as Header, K as KdfParams, L as LocalStore, b as LocalStoreOptions, c as LocalStoreState, M as MirrorState, d as Mode, e as PasswordCheck, f as PasswordPolicy, g as PasswordRequirement, P as PeerSource, h as PeerState, R as RESERVED_COLLECTION_PREFIX, i as RESERVED_STORE_MODES, j as RecipientStanza, k as ReplicaState, l as SelfstoreError, m as SelfstoreErrorCode, n as Severity, o as Snapshot, p as SnapshotFile, q as StatusAction, r as StatusDescriptor, s as StatusInput, t as StorageState, S as StoreError, u as StoreGroupConfig, v as SyncJournalEntry, w as SyncSource, T as TargetKind, x as checkPasswordPolicy, y as createLocalStore, z as deriveStatus, C as errorLabelKey, D as isAuthExpired, F as isReservedStoreMode, G as isSelfstoreError } from './store-CiLoRJmy.js';
1
+ import { B as BackupTarget } from './store-CCe8b5Eg.js';
2
+ export { A as AuthExpiredError, a as BuiltinTargetKind, E as EncodeOptions, H as Header, K as KdfParams, L as LocalStore, b as LocalStoreOptions, c as LocalStoreState, M as MirrorState, d as Mode, e as PasswordCheck, f as PasswordPolicy, g as PasswordRequirement, P as PeerSource, h as PeerState, R as RESERVED_COLLECTION_PREFIX, i as RESERVED_STORE_MODES, j as RecipientStanza, k as ReplicaState, l as SelfstoreError, m as SelfstoreErrorCode, n as Severity, o as Snapshot, p as SnapshotFile, q as StatusAction, r as StatusDescriptor, s as StatusInput, t as StorageState, S as StoreError, u as StoreGroupConfig, v as SyncJournalEntry, w as SyncSource, T as TargetKind, x as checkPasswordPolicy, y as createLocalStore, z as deriveStatus, C as errorLabelKey, D as isAuthExpired, F as isReservedStoreMode, G as isSelfstoreError } from './store-CCe8b5Eg.js';
3
3
  import { K as KV } from './cache-ilsK3Tki.js';
4
4
  export { C as CachedFile, L as LocalCache, e as LockableCache, i as indexedDbCache, f as isLockableCache, m as memoryCache } from './cache-ilsK3Tki.js';
5
- export { G as GisDriveAuthOptions, a as GisTokenPersistence, d as datedName, e as exportSnapshot, g as gisDriveAuth, i as importSnapshot, b as inspect, c as isEncrypted, p as pickFromDisk, s as saveToDisk } from './local-CldSa9EY.js';
6
- import { c as connect$2, f as fromSession$2, a as connect$3, b as fromSession$3, p as peer } from './s3-DgyTwMRc.js';
7
- export { S as S3Config, d as S3ConnectOptions, W as WebdavConfig, e as WebdavConnectOptions, g as WebdavPeerOptions } from './s3-DgyTwMRc.js';
8
- import { c as connect$1, f as fromSession$1, p as preview, b as adopt, d as findOrCreateOwnFile, l as listBackups, e as createBackup, g as deleteBackup, r as renameBackup, h as account } from './drive-B2fm71qD.js';
9
- export { i as DriveAccount, a as DriveAuth, j as DriveBackupInfo, D as DriveOptions } from './drive-B2fm71qD.js';
5
+ export { G as GisDriveAuthOptions, a as GisTokenPersistence, d as datedName, e as exportSnapshot, g as gisDriveAuth, i as importSnapshot, b as inspect, c as isEncrypted, p as pickFromDisk, s as saveToDisk } from './local-Dt1hYNG4.js';
6
+ import { c as connect$2, f as fromSession$2, a as connect$3, b as fromSession$3, p as peer } from './s3-CCE6lc_U.js';
7
+ export { S as S3Config, d as S3ConnectOptions, W as WebdavConfig, e as WebdavConnectOptions, g as WebdavPeerOptions } from './s3-CCE6lc_U.js';
8
+ import { c as connect$1, f as fromSession$1, p as preview, b as adopt, d as findOrCreateOwnFile, l as listBackups, e as createBackup, g as deleteBackup, r as renameBackup, h as account } from './drive-BUPsPaIu.js';
9
+ export { i as DriveAccount, a as DriveAuth, j as DriveBackupInfo, D as DriveOptions } from './drive-BUPsPaIu.js';
10
10
  import './sync.js';
11
11
 
12
12
  /**
package/dist/advanced.js CHANGED
@@ -1,4 +1,4 @@
1
- export { RESERVED_STORE_MODES, createLocalStore, deriveStatus, gisDriveAuth, indexedDbCache, isLockableCache, isReservedStoreMode, memoryCache } from './chunk-TXAMWBG5.js';
1
+ export { RESERVED_STORE_MODES, createLocalStore, deriveStatus, gisDriveAuth, indexedDbCache, isLockableCache, isReservedStoreMode, memoryCache } from './chunk-3BPGPSPX.js';
2
2
  import './chunk-SKWHKM25.js';
3
3
  export { datedName, pickFromDisk, saveToDisk } from './chunk-DCEXWSM6.js';
4
4
  import { openExisting, isOpenSupported, isSupported, fromSession as fromSession$1, connect as connect$1, fromSession3, connect3, peer, fromSession2, connect2 } from './chunk-TKWU52LK.js';
package/dist/backups.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { B as BackupsHost } from './manager-BqzTVaep.js';
2
- export { a as BackupFileInfo, b as BackupOwner, c as BackupRow, d as BackupsErrorCode, e as BackupsKeys, f as BackupsManager, g as BackupsNaming, h as BackupsSnapshot, K as KnownBackups, i as createBackupsManager } from './manager-BqzTVaep.js';
3
- import { D as DriveOptions } from './drive-B2fm71qD.js';
1
+ import { B as BackupsHost } from './manager-CaMd6T1T.js';
2
+ export { a as BackupFileInfo, b as BackupOwner, c as BackupRow, d as BackupsErrorCode, e as BackupsKeys, f as BackupsManager, g as BackupsNaming, h as BackupsSnapshot, K as KnownBackups, i as createBackupsManager } from './manager-CaMd6T1T.js';
3
+ import { D as DriveOptions } from './drive-BUPsPaIu.js';
4
4
  import './cache-ilsK3Tki.js';
5
- import './store-CiLoRJmy.js';
5
+ import './store-CCe8b5Eg.js';
6
6
  import './sync.js';
7
7
  import './machine-ALMkT3mk.js';
8
8
 
@@ -68,6 +68,10 @@ var KEY = {
68
68
  version: "version",
69
69
  syncMeta: "syncMeta",
70
70
  lastSavedAt: "lastSavedAt",
71
+ // When a portable copy was last written, and whether anything has been
72
+ // entered since. See the state fields of the same name.
73
+ copyAt: "copyAt",
74
+ copyStale: "copyStale",
71
75
  enc: "enc",
72
76
  targetKind: "targetKind",
73
77
  remoteVersion: "remoteVersion",
@@ -149,6 +153,8 @@ function createLocalStore(opts) {
149
153
  let lastError = null;
150
154
  let pendingDownload = false;
151
155
  let lastSavedAt = null;
156
+ let lastCopyAt = null;
157
+ let copyIsStale = false;
152
158
  let ready = false;
153
159
  let saving = false;
154
160
  let lastSavedContentHash = null;
@@ -439,6 +445,8 @@ function createLocalStore(opts) {
439
445
  meta = await kv.get(KEY.syncMeta) ?? createMeta();
440
446
  baseMeta = await kv.get(KEY.baseMeta) ?? null;
441
447
  lastSavedAt = await kv.get(KEY.lastSavedAt) ?? null;
448
+ lastCopyAt = await kv.get(KEY.copyAt) ?? null;
449
+ copyIsStale = await kv.get(KEY.copyStale) ?? false;
442
450
  remoteVersion = await kv.get(KEY.remoteVersion) ?? null;
443
451
  lastSavedContentHash = await kv.get(KEY.savedHash) ?? null;
444
452
  if (durable) {
@@ -614,6 +622,10 @@ function createLocalStore(opts) {
614
622
  notify();
615
623
  try {
616
624
  await persistLocal();
625
+ if (lastCopyAt !== null && !copyIsStale) {
626
+ copyIsStale = true;
627
+ kvSetSafe(KEY.copyStale, true, "copyStale");
628
+ }
617
629
  if (editSeq === seq) pendingEdit = false;
618
630
  if (targetKind === "file-manual") {
619
631
  lastSavedContentHash = digest;
@@ -947,6 +959,8 @@ function createLocalStore(opts) {
947
959
  locked: locked(),
948
960
  saving,
949
961
  lastSavedAt,
962
+ lastCopyAt,
963
+ copyIsStale,
950
964
  status: deriveStatus({
951
965
  persistent: mode === "persistent",
952
966
  targetKind,
@@ -1005,6 +1019,8 @@ function createLocalStore(opts) {
1005
1019
  apply(migrated(snap, storedV));
1006
1020
  }
1007
1021
  lastSavedAt = await kv.get(KEY.lastSavedAt) ?? null;
1022
+ lastCopyAt = await kv.get(KEY.copyAt) ?? null;
1023
+ copyIsStale = await kv.get(KEY.copyStale) ?? false;
1008
1024
  lastSavedContentHash = await kv.get(KEY.savedHash) ?? null;
1009
1025
  meta = await kv.get(KEY.syncMeta) ?? createMeta();
1010
1026
  await kv.set(KEY.syncMeta, meta);
@@ -1372,6 +1388,10 @@ function createLocalStore(opts) {
1372
1388
  },
1373
1389
  markDownloaded() {
1374
1390
  pendingDownload = false;
1391
+ lastCopyAt = Date.now();
1392
+ copyIsStale = false;
1393
+ kvSetSafe(KEY.copyAt, lastCopyAt, "copyAt");
1394
+ kvSetSafe(KEY.copyStale, false, "copyStale");
1375
1395
  lastSavedAt = Date.now();
1376
1396
  void kv.set(KEY.lastSavedAt, lastSavedAt).catch(() => void 0);
1377
1397
  notify();
@@ -2110,5 +2130,5 @@ function gisDriveAuth(opts) {
2110
2130
  }
2111
2131
 
2112
2132
  export { RESERVED_STORE_MODES, createLocalStore, deriveStatus, gisDriveAuth, indexedDbCache, isLockableCache, isReservedStoreMode, memoryCache };
2113
- //# sourceMappingURL=chunk-TXAMWBG5.js.map
2114
- //# sourceMappingURL=chunk-TXAMWBG5.js.map
2133
+ //# sourceMappingURL=chunk-3BPGPSPX.js.map
2134
+ //# sourceMappingURL=chunk-3BPGPSPX.js.map