mnfst 0.5.289 → 0.5.290
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/lib/manifest.data.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
(function () {
|
|
4
4
|
|
|
5
|
-
const MANIFEST_BUILD_VERSION = '0.5.
|
|
5
|
+
const MANIFEST_BUILD_VERSION = '0.5.290';
|
|
6
6
|
|
|
7
7
|
/* Manifest Data Sources - Configuration */
|
|
8
8
|
|
|
@@ -7702,6 +7702,9 @@ async function unlinkFileFromAllEntries(fileId, options = {}) {
|
|
|
7702
7702
|
|
|
7703
7703
|
const columns = fileLinkColumns(manifest, tableName, tableConfig, options.bucketId);
|
|
7704
7704
|
const affected = new Set();
|
|
7705
|
+
const generation = window.ManifestDataStore?.sourceGeneration?.(tableName);
|
|
7706
|
+
const isCurrent = () => (!options.isCurrent || options.isCurrent())
|
|
7707
|
+
&& window.ManifestDataStore?.sourceGeneration?.(tableName) === generation;
|
|
7705
7708
|
|
|
7706
7709
|
for (const entry of entries) {
|
|
7707
7710
|
for (const column of columns) {
|
|
@@ -7711,7 +7714,7 @@ async function unlinkFileFromAllEntries(fileId, options = {}) {
|
|
|
7711
7714
|
if (!linked.includes(id)) continue;
|
|
7712
7715
|
affected.add(entry.$id);
|
|
7713
7716
|
unlinkPromises.push(
|
|
7714
|
-
unlinkFileFromEntry(tableName, entry.$id, id, column).catch(error => {
|
|
7717
|
+
unlinkFileFromEntry(tableName, entry.$id, id, column, { isCurrent }).catch(error => {
|
|
7715
7718
|
console.warn('[Manifest Data] Could not unlink from', tableName, 'entry', entry.$id, ':', error.message);
|
|
7716
7719
|
})
|
|
7717
7720
|
);
|
|
@@ -7734,11 +7737,14 @@ async function unlinkFileFromAllEntries(fileId, options = {}) {
|
|
|
7734
7737
|
|
|
7735
7738
|
// Unlink a file from a table entry by removing the file ID from the entry's fileIds array
|
|
7736
7739
|
// Generic function - works with any table and any scope
|
|
7737
|
-
function unlinkFileFromEntry(tableName, entryId, fileId, fileIdsColumn = 'fileIds') {
|
|
7738
|
-
return queueEntryFileWrite(tableName, entryId, fileIdsColumn, () => writeFileUnlink(tableName, entryId, fileId, fileIdsColumn));
|
|
7740
|
+
function unlinkFileFromEntry(tableName, entryId, fileId, fileIdsColumn = 'fileIds', options = {}) {
|
|
7741
|
+
return queueEntryFileWrite(tableName, entryId, fileIdsColumn, () => writeFileUnlink(tableName, entryId, fileId, fileIdsColumn, options));
|
|
7739
7742
|
}
|
|
7740
7743
|
|
|
7741
|
-
|
|
7744
|
+
// options.isCurrent: false once the identity that started the write is gone
|
|
7745
|
+
async function writeFileUnlink(tableName, entryId, fileId, fileIdsColumn, options = {}) {
|
|
7746
|
+
const stale = () => !!options.isCurrent && !options.isCurrent();
|
|
7747
|
+
if (stale()) return false;
|
|
7742
7748
|
const manifest = await window.ManifestDataConfig.ensureManifest();
|
|
7743
7749
|
const tableDataSource = manifest?.data?.[tableName];
|
|
7744
7750
|
|
|
@@ -7760,6 +7766,8 @@ async function writeFileUnlink(tableName, entryId, fileId, fileIdsColumn) {
|
|
|
7760
7766
|
entryId
|
|
7761
7767
|
);
|
|
7762
7768
|
|
|
7769
|
+
if (stale()) return false;
|
|
7770
|
+
|
|
7763
7771
|
if (!entry) {
|
|
7764
7772
|
throw new Error(`[Manifest Data] Entry "${entryId}" not found in table "${tableName}"`);
|
|
7765
7773
|
}
|
|
@@ -8477,7 +8485,7 @@ function createAppwriteMethodsHandler(dataSourceName, reloadDataSource) {
|
|
|
8477
8485
|
if (bucketId) {
|
|
8478
8486
|
// $delete / $remove: delete each file, land successes locally, then unlink them
|
|
8479
8487
|
const deleteBucketFiles = async (fileId) => {
|
|
8480
|
-
const ids = (Array.isArray(fileId) ? fileId : [fileId]).map(id => id
|
|
8488
|
+
const ids = (Array.isArray(fileId) ? fileId : [fileId]).map(id => id && typeof id === 'object' ? id.$id : id);
|
|
8481
8489
|
if (Array.isArray(fileId) && !ids.length) return [];
|
|
8482
8490
|
if (ids.some(id => !id)) {
|
|
8483
8491
|
throw new Error(`[Manifest Data] ${method} requires file ID`);
|
|
@@ -8503,11 +8511,12 @@ function createAppwriteMethodsHandler(dataSourceName, reloadDataSource) {
|
|
|
8503
8511
|
await ds.landRemove(dataSourceName, deleted, { generation });
|
|
8504
8512
|
}
|
|
8505
8513
|
|
|
8506
|
-
// Unlink only what the server deleted
|
|
8514
|
+
// Unlink only what the server deleted, and only for the identity that deleted it
|
|
8515
|
+
const isCurrent = () => !ds?.sourceGeneration || ds.sourceGeneration(dataSourceName) === generation;
|
|
8507
8516
|
const unlink = window.ManifestDataProxiesFiles?.unlinkFileFromAllEntries;
|
|
8508
8517
|
const affected = await Promise.all(deleted.map(async id => {
|
|
8509
8518
|
try {
|
|
8510
|
-
return unlink ? await unlink(id, { bucketId }) || {} : {};
|
|
8519
|
+
return unlink && isCurrent() ? await unlink(id, { bucketId, isCurrent }) || {} : {};
|
|
8511
8520
|
} catch (unlinkError) {
|
|
8512
8521
|
console.warn('[Manifest Data] Failed to unlink deleted file from entries:', unlinkError);
|
|
8513
8522
|
return {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest.appwrite.auth.js": "sha384-gWLSeVPqCLMiUZB8MU7GqMg3x2yULFUsp8nTTZrPp/9Dlkix42rBn9yIimvwrHqZ",
|
|
3
|
-
"manifest.appwrite.data.js": "sha384-
|
|
3
|
+
"manifest.appwrite.data.js": "sha384-oKXa/eOSr9HiqTJ8reClBVzcsSwQOuU7+rSR5Al5XSAiTBkBw2G+SIonE0cquTWY",
|
|
4
4
|
"manifest.appwrite.presences.js": "sha384-LINPhIPTCK+rA8zd+HPUzMSEgH6Sl2vQMEyItT97bnEE2FYGYKqjXX+CWdt6nl9z",
|
|
5
5
|
"manifest.bindings.js": "sha384-lPtMf8Ykaic9gNVZKq8Scia1881ZeMAyxer3WCIkUNwwrgzGBWto1OXADUwjvORF",
|
|
6
6
|
"manifest.charts.js": "sha384-AFbP7mQnigy7DU1s+YE30yKTeQAKfgNazhbfSNbfd9ZpLgeulZKaPi/fAq3gJHDO",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"manifest.combobox.js": "sha384-/lJo6vaxKjgnBSRs/dzkhK1dzGk3GBw8FISoNJZB70mwAVwu1k5veZyBXjOb4keS",
|
|
12
12
|
"manifest.components.js": "sha384-1el5WMdgmzu/2ocaYN21OjLi/lfjllvA8aju1J3knYuOizw+XFfJU1+rvGqYW7qk",
|
|
13
13
|
"manifest.computed.js": "sha384-GYML/e81gQfN+iDbqhPUgny8bINCyL+SrbTofoGk4hlCnLLjv51mCv42JMqq+ku5",
|
|
14
|
-
"manifest.data.js": "sha384-
|
|
14
|
+
"manifest.data.js": "sha384-iCwaub0nFyUnvFnACpTYH08Rx6pDOay4n7HZvoyTpE6fHeJnN/mz/7gf3gFf8kCe",
|
|
15
15
|
"manifest.datepicker.js": "sha384-EzlMwvIxlla/0BuyhAEqxN0M8TGcWIWgEIg840V0akKQQK1uY648wPWMkobvtq/o",
|
|
16
16
|
"manifest.defer.js": "sha384-PRp7+dCZHnnl55rX2xrHutLrQnszHo7o5o9Tq28M/yjLZPuXDzcwQNxCdvbtCYSz",
|
|
17
17
|
"manifest.device.js": "sha384-YeQaS56L8IILqrQNBSeAOLwIh5DuAOrE60cYLK1+46qJtUrXlAvqGe2j5mbV4Vq7",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"manifest.status.js": "sha384-ofu7nBnVIGZ1U1o2R9d2H3V8aEMPUCVbl5FO3gIToXqi0oa36fTviEdh5UU7Kitw",
|
|
30
30
|
"manifest.submissions.js": "sha384-v9eS47ytAfTGIKAyVnbd0QWegucVS7yduvigqfsxxoqXmbaEoy0M2y+BiI4xeZBd",
|
|
31
31
|
"manifest.svg.js": "sha384-qr/8H9+2cIhSXNbRWRtIdrDlTOxKlNJqwEefHvCYoiBNW/kKhPTFa109Orv/EBnb",
|
|
32
|
-
"manifest.sw.js": "sha384-
|
|
32
|
+
"manifest.sw.js": "sha384-NSBCg4zw2wNVHYPWBpc5b58ryQ+2+jU/U/0EXMjEjTbUa1P3ebNTzV64c+bDBg7J",
|
|
33
33
|
"manifest.tabs.js": "sha384-otU09H7jnawVKQdLAYpMCd3jx00tgyPVr42D2hLIBzN5dG4se505YesavdnMqEi1",
|
|
34
34
|
"manifest.tailwind.js": "sha384-yuP3LEvWU+QVjxjkZ0YhErtC9RrGmhOmHjjFjhS9obqZbp5/KTIEnSR0CXDvHE0B",
|
|
35
35
|
"manifest.toasts.js": "sha384-UpOz9fAdGeGUhL0NamBg5iPepEfIy73p9HYdcxfOQC5b7CVsl7Our0skdZzaLNcC",
|
package/lib/manifest.sw.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
// Build stamps the published version here; unstamped (dev) falls back to the
|
|
18
18
|
// registration URL's `v`, then 'dev'.
|
|
19
|
-
const BUILD_VERSION = '0.5.
|
|
19
|
+
const BUILD_VERSION = '0.5.290';
|
|
20
20
|
const CACHE_PREFIX = 'mnfst-sw:';
|
|
21
21
|
const META_CACHE = CACHE_PREFIX + 'meta';
|
|
22
22
|
// Sized to hold a full precache.json warm-up (PRECACHE_MAX_ENTRIES server-side)
|