mnfst 0.5.295 → 0.5.296
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.appwrite.data.js +1 -1
- package/lib/manifest.d.ts +3 -3
- package/lib/manifest.data.js +39 -10
- package/lib/manifest.integrity.json +3 -3
- package/lib/manifest.sw.js +1 -1
- package/package.json +1 -1
package/lib/manifest.d.ts
CHANGED
|
@@ -194,13 +194,13 @@ export interface ManifestAppwriteBucketOps {
|
|
|
194
194
|
$remove(fileId: string): Promise<void>;
|
|
195
195
|
$delete(fileId: string | string[]): Promise<unknown>;
|
|
196
196
|
$duplicate(fileId: string, options?: { newName?: string; newFileId?: string }): Promise<ManifestFile>;
|
|
197
|
-
$filesFor(
|
|
197
|
+
$filesFor(tableName: string, entryId: string, fileIdsColumn?: string): Promise<ManifestFile[]>;
|
|
198
198
|
$first(limit?: number): Promise<ManifestCursorPage<ManifestFile>>;
|
|
199
199
|
$next(cursor: string, limit?: number): Promise<ManifestCursorPage<ManifestFile>>;
|
|
200
200
|
$prev(cursor: string, limit?: number): Promise<ManifestCursorPage<ManifestFile>>;
|
|
201
201
|
$page(page: number, limit?: number): Promise<ManifestOffsetPage<ManifestFile>>;
|
|
202
|
-
$unlinkFrom(
|
|
203
|
-
$removeFrom(
|
|
202
|
+
$unlinkFrom(tableName: string, entryId: string, file: string | { $id: string }, fileIdsColumn?: string): Promise<void>;
|
|
203
|
+
$removeFrom(tableName: string, entryId: string, file: string | { $id: string }, fileIdsColumn?: string): Promise<ManifestFile[] | null>;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
/**
|
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.296';
|
|
6
6
|
|
|
7
7
|
/* Manifest Data Sources - Configuration */
|
|
8
8
|
|
|
@@ -7518,11 +7518,16 @@ function queueEntryFileWrite(tableName, entryId, fileIdsColumn, write) {
|
|
|
7518
7518
|
|
|
7519
7519
|
// Link a file to a table entry by adding the file ID to the entry's fileIds array
|
|
7520
7520
|
// Generic function - works with any table and any scope
|
|
7521
|
-
|
|
7522
|
-
|
|
7521
|
+
// The table's generation is captured at the call, so a queued write never lands for a later identity
|
|
7522
|
+
function linkFileToEntry(tableName, entryId, fileId, fileIdsColumn = 'fileIds', options = {}) {
|
|
7523
|
+
const isCurrent = identityGuard(tableName, options.isCurrent);
|
|
7524
|
+
return queueEntryFileWrite(tableName, entryId, fileIdsColumn, () => writeFileLink(tableName, entryId, fileId, fileIdsColumn, { ...options, isCurrent }));
|
|
7523
7525
|
}
|
|
7524
7526
|
|
|
7525
|
-
|
|
7527
|
+
// options.isCurrent: false once the identity that started the write is gone
|
|
7528
|
+
async function writeFileLink(tableName, entryId, fileId, fileIdsColumn, options = {}) {
|
|
7529
|
+
const stale = () => !!options.isCurrent && !options.isCurrent();
|
|
7530
|
+
if (stale()) return false;
|
|
7526
7531
|
const manifest = await window.ManifestDataConfig.ensureManifest();
|
|
7527
7532
|
const tableDataSource = manifest?.data?.[tableName];
|
|
7528
7533
|
|
|
@@ -7544,6 +7549,8 @@ async function writeFileLink(tableName, entryId, fileId, fileIdsColumn) {
|
|
|
7544
7549
|
entryId
|
|
7545
7550
|
);
|
|
7546
7551
|
|
|
7552
|
+
if (stale()) return false;
|
|
7553
|
+
|
|
7547
7554
|
if (!entry) {
|
|
7548
7555
|
throw new Error(`[Manifest Data] Entry "${entryId}" not found in table "${tableName}"`);
|
|
7549
7556
|
}
|
|
@@ -7748,10 +7755,13 @@ function fileIdOf(id) {
|
|
|
7748
7755
|
return id && typeof id === 'object' ? id.$id : id;
|
|
7749
7756
|
}
|
|
7750
7757
|
|
|
7751
|
-
// True while the source's generation (bumped on sign-out / account switch) and the caller's guard hold
|
|
7758
|
+
// True while the identity epoch and the source's generation (both bumped on sign-out / account switch) and the caller's guard hold
|
|
7752
7759
|
function identityGuard(dataSourceName, outer) {
|
|
7760
|
+
const epoch = window.ManifestDataMain?.identityEpoch?.() ?? 0;
|
|
7753
7761
|
const generation = window.ManifestDataStore?.sourceGeneration?.(dataSourceName);
|
|
7754
|
-
return () => (!outer || outer())
|
|
7762
|
+
return () => (!outer || outer())
|
|
7763
|
+
&& (window.ManifestDataMain?.identityEpoch?.() ?? 0) === epoch
|
|
7764
|
+
&& window.ManifestDataStore?.sourceGeneration?.(dataSourceName) === generation;
|
|
7755
7765
|
}
|
|
7756
7766
|
|
|
7757
7767
|
// options.isCurrent: false once the identity that started the write is gone
|
|
@@ -8315,6 +8325,11 @@ function createAppwriteMethodsHandler(dataSourceName, reloadDataSource) {
|
|
|
8315
8325
|
} else if (method === '$duplicate') {
|
|
8316
8326
|
const [entryId, options = {}] = args;
|
|
8317
8327
|
const { files = 'same', newRowId, ...overrides } = options;
|
|
8328
|
+
// The copy (and its file links) lands only for the identity that read the original
|
|
8329
|
+
const isCurrent = window.ManifestDataProxiesFiles?.identityGuard?.(dataSourceName) || (() => true);
|
|
8330
|
+
const stopIfStale = () => {
|
|
8331
|
+
if (!isCurrent()) throw new Error('[Manifest Data] $duplicate stopped: the signed-in user changed');
|
|
8332
|
+
};
|
|
8318
8333
|
|
|
8319
8334
|
// Get the original entry
|
|
8320
8335
|
const originalEntry = await window.ManifestDataAppwrite.getTableRow(
|
|
@@ -8384,6 +8399,7 @@ function createAppwriteMethodsHandler(dataSourceName, reloadDataSource) {
|
|
|
8384
8399
|
// Duplicate each file
|
|
8385
8400
|
const newFileIds = [];
|
|
8386
8401
|
for (const file of originalFiles) {
|
|
8402
|
+
stopIfStale();
|
|
8387
8403
|
try {
|
|
8388
8404
|
// Download file content
|
|
8389
8405
|
const fileBlob = await window.ManifestDataAppwrite.getFileContentAsBlob(bucketId, file.$id);
|
|
@@ -8423,6 +8439,7 @@ function createAppwriteMethodsHandler(dataSourceName, reloadDataSource) {
|
|
|
8423
8439
|
}
|
|
8424
8440
|
|
|
8425
8441
|
// Create the duplicate entry using existing $create logic
|
|
8442
|
+
stopIfStale();
|
|
8426
8443
|
return await handleMethod('$create', duplicateData, newRowId);
|
|
8427
8444
|
} else if (method === '$query') {
|
|
8428
8445
|
let [queries] = args;
|
|
@@ -8566,6 +8583,8 @@ function createAppwriteMethodsHandler(dataSourceName, reloadDataSource) {
|
|
|
8566
8583
|
|
|
8567
8584
|
if (method === '$create') {
|
|
8568
8585
|
let [fileId, file, permissions, onProgress] = args;
|
|
8586
|
+
// The entry link lands only for the identity that started the upload
|
|
8587
|
+
const linkCurrent = window.ManifestDataProxiesFiles?.identityGuard?.(dataSourceName, onProgress?.isCurrent) || (() => true);
|
|
8569
8588
|
|
|
8570
8589
|
// Appwrite requires fileId to be provided - it doesn't auto-generate
|
|
8571
8590
|
// If fileId is not provided or is a File object (first arg is file), generate one
|
|
@@ -8847,7 +8866,7 @@ function createAppwriteMethodsHandler(dataSourceName, reloadDataSource) {
|
|
|
8847
8866
|
try {
|
|
8848
8867
|
const linkFileToEntry = window.ManifestDataProxiesFiles?.linkFileToEntry;
|
|
8849
8868
|
if (linkFileToEntry) {
|
|
8850
|
-
await linkFileToEntry(tableName, entryId, result.$id, fileIdsColumn);
|
|
8869
|
+
await linkFileToEntry(tableName, entryId, result.$id, fileIdsColumn, { isCurrent: linkCurrent });
|
|
8851
8870
|
}
|
|
8852
8871
|
} catch (linkError) {
|
|
8853
8872
|
// Check if error is about missing column
|
|
@@ -9387,6 +9406,8 @@ window.ManifestDataProxiesMagic.createFilesMethod = createFilesMethod;
|
|
|
9387
9406
|
|
|
9388
9407
|
function createUploadMethod(dataSourceName, reloadDataSource) {
|
|
9389
9408
|
return async function (entryId, fileOrEvent, bucketName) {
|
|
9409
|
+
// Links land only for the identity that started the upload
|
|
9410
|
+
const isCurrent = window.ManifestDataProxiesFiles?.identityGuard?.(dataSourceName);
|
|
9390
9411
|
const manifest = await window.ManifestDataConfig.ensureManifest();
|
|
9391
9412
|
if (!manifest?.data) {
|
|
9392
9413
|
throw new Error('[Manifest Data] Manifest not available');
|
|
@@ -9490,7 +9511,8 @@ function createUploadMethod(dataSourceName, reloadDataSource) {
|
|
|
9490
9511
|
entryId: entryId,
|
|
9491
9512
|
table: dataSourceName,
|
|
9492
9513
|
fileIdsColumn: resolvedColumnName,
|
|
9493
|
-
sourceUnloaded
|
|
9514
|
+
sourceUnloaded,
|
|
9515
|
+
isCurrent
|
|
9494
9516
|
}).then(result => {
|
|
9495
9517
|
// Clear uploading state for this file
|
|
9496
9518
|
if (clearUploadingFile) {
|
|
@@ -11434,6 +11456,8 @@ function registerFilesDirective() {
|
|
|
11434
11456
|
|
|
11435
11457
|
// Set new timeout for debouncing
|
|
11436
11458
|
loadTimeout = setTimeout(async () => {
|
|
11459
|
+
// The fileIds sync writes only for the identity that read them
|
|
11460
|
+
const isCurrent = window.ManifestDataProxiesFiles?.identityGuard?.('projects') || (() => true);
|
|
11437
11461
|
// Double-check project still exists before making API call using projectId
|
|
11438
11462
|
const store = Alpine.store('data');
|
|
11439
11463
|
const projects = store?.projects;
|
|
@@ -11586,7 +11610,7 @@ function registerFilesDirective() {
|
|
|
11586
11610
|
const databaseFileIdsJson = JSON.stringify(databaseFileIdsArray);
|
|
11587
11611
|
const databaseIsStale = databaseFileIds && databaseFileIdsJson !== lastFileIds;
|
|
11588
11612
|
|
|
11589
|
-
if (storeIsStale || databaseIsStale) {
|
|
11613
|
+
if ((storeIsStale || databaseIsStale) && isCurrent()) {
|
|
11590
11614
|
console.warn('[Manifest Data] Store/Database fileIds is STALE - cleaning up:', {
|
|
11591
11615
|
directiveInstanceId,
|
|
11592
11616
|
projectId: currentProjectId,
|
|
@@ -11617,7 +11641,7 @@ function registerFilesDirective() {
|
|
|
11617
11641
|
const tableId = window.ManifestDataConfig.getAppwriteTableId(tableDataSource);
|
|
11618
11642
|
const appwriteConfig = await window.ManifestDataConfig.getAppwriteConfig(tableDataSource);
|
|
11619
11643
|
|
|
11620
|
-
if (appwriteConfig && window.ManifestDataAppwrite?.updateRow) {
|
|
11644
|
+
if (appwriteConfig && window.ManifestDataAppwrite?.updateRow && isCurrent()) {
|
|
11621
11645
|
await window.ManifestDataAppwrite.updateRow(
|
|
11622
11646
|
appwriteConfig.databaseId,
|
|
11623
11647
|
tableId,
|
|
@@ -12012,6 +12036,9 @@ function confirmedIdentity() {
|
|
|
12012
12036
|
return auth.isAuthenticated === true ? (authUserId(auth) || '') : '';
|
|
12013
12037
|
}
|
|
12014
12038
|
|
|
12039
|
+
// Bumped synchronously when an identity ends (sign-out, account switch), before any source reset; covers never-loaded sources
|
|
12040
|
+
let identityEpoch = 0;
|
|
12041
|
+
|
|
12015
12042
|
// Identity change (sign-in, sign-out, account switch): identity-bound sources reload for the new identity.
|
|
12016
12043
|
// A previous user's rows drop at once; rows read signed out stay live until the reload lands.
|
|
12017
12044
|
function setupAuthResetListener() {
|
|
@@ -12058,6 +12085,7 @@ function setupAuthResetListener() {
|
|
|
12058
12085
|
return;
|
|
12059
12086
|
}
|
|
12060
12087
|
// An identity switch (A to B) starts clean with the defaults; a first sign-in keeps the $query
|
|
12088
|
+
if (prev !== '') identityEpoch++;
|
|
12061
12089
|
reset(prev !== '', prev === '' && next !== '');
|
|
12062
12090
|
};
|
|
12063
12091
|
['manifest:auth:logout', 'manifest:auth:session-cleared', 'manifest:auth:login', 'manifest:auth:anonymous', 'manifest:auth:initialized']
|
|
@@ -13594,6 +13622,7 @@ async function initializeDataSourcesPlugin() {
|
|
|
13594
13622
|
noteQueryIntent: (dataSourceName, queries) => queryIntents.set(dataSourceName, queries),
|
|
13595
13623
|
dropQueryIntent: (dataSourceName, queries) => { if (queryIntents.get(dataSourceName) === queries) queryIntents.delete(dataSourceName); },
|
|
13596
13624
|
withRetry,
|
|
13625
|
+
identityEpoch: () => identityEpoch,
|
|
13597
13626
|
pagingSpec,
|
|
13598
13627
|
fetchPagedRows,
|
|
13599
13628
|
pagedWant,
|
|
@@ -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-vdb9hvvueWGiqC3UvTLSPbDbAsBLJQrsw7DPYNSEPQaBUsQWj6JeFDYgGcomjmOo",
|
|
4
4
|
"manifest.appwrite.presences.js": "sha384-LINPhIPTCK+rA8zd+HPUzMSEgH6Sl2vQMEyItT97bnEE2FYGYKqjXX+CWdt6nl9z",
|
|
5
5
|
"manifest.bindings.js": "sha384-lPtMf8Ykaic9gNVZKq8Scia1881ZeMAyxer3WCIkUNwwrgzGBWto1OXADUwjvORF",
|
|
6
6
|
"manifest.charts.js": "sha384-cf1N+ssSR5IL2qufv8noB5QOJrSvL7J0sLKgbJmyTDl1HodQ/Bkyf/QntO6Iynvi",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"manifest.combobox.js": "sha384-/lJo6vaxKjgnBSRs/dzkhK1dzGk3GBw8FISoNJZB70mwAVwu1k5veZyBXjOb4keS",
|
|
12
12
|
"manifest.components.js": "sha384-7lu4Nw2GqpAUn63c3gYEvgfM58PYsdoPv3wzqPQfZ5bravqOY/lfE8HFKHsKflQj",
|
|
13
13
|
"manifest.computed.js": "sha384-GYML/e81gQfN+iDbqhPUgny8bINCyL+SrbTofoGk4hlCnLLjv51mCv42JMqq+ku5",
|
|
14
|
-
"manifest.data.js": "sha384-
|
|
14
|
+
"manifest.data.js": "sha384-DQak77AJpDsrzpFYz5RhzM6xlKu7GvqVqd1BDjlEjc5V3zC3OzNE9y1u/R34AY09",
|
|
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-Ycob/D+vbscUJxYPlrhHm/E/Ig4h16w074LlBskWgWYJB0WwHA8G8yEkrTXQMPSX",
|
|
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.296';
|
|
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)
|