dexie-cloud-addon 4.3.9 → 4.4.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/dist/modern/DexieCloudAPI.d.ts +17 -0
- package/dist/modern/DexieCloudOptions.d.ts +19 -0
- package/dist/modern/TSON.d.ts +0 -6
- package/dist/modern/db/DexieCloudDB.d.ts +2 -0
- package/dist/modern/db/entities/EntityCommon.d.ts +1 -0
- package/dist/modern/dexie-cloud-addon.js +3776 -2354
- package/dist/modern/dexie-cloud-addon.js.map +1 -1
- package/dist/modern/dexie-cloud-addon.min.js +1 -1
- package/dist/modern/dexie-cloud-addon.min.js.map +1 -1
- package/dist/modern/middlewares/blobResolveMiddleware.d.ts +21 -0
- package/dist/modern/service-worker.js +2195 -773
- package/dist/modern/service-worker.js.map +1 -1
- package/dist/modern/service-worker.min.js +1 -1
- package/dist/modern/service-worker.min.js.map +1 -1
- package/dist/modern/sync/BlobDownloadTracker.d.ts +33 -0
- package/dist/modern/sync/BlobSavingQueue.d.ts +35 -0
- package/dist/modern/sync/blobOffloading.d.ts +38 -0
- package/dist/modern/sync/blobProgress.d.ts +25 -0
- package/dist/modern/sync/blobResolve.d.ts +85 -0
- package/dist/modern/sync/eagerBlobDownloader.d.ts +20 -0
- package/dist/modern/sync/loadCachedAccessToken.d.ts +2 -0
- package/dist/modern/types/DXCAlert.d.ts +6 -0
- package/dist/modern/types/TXExpandos.d.ts +1 -0
- package/dist/umd/dexie-cloud-addon.js +3867 -2445
- package/dist/umd/dexie-cloud-addon.js.map +1 -1
- package/dist/umd/dexie-cloud-addon.min.js +1 -1
- package/dist/umd/dexie-cloud-addon.min.js.map +1 -1
- package/dist/umd/service-worker.js +2330 -908
- package/dist/umd/service-worker.js.map +1 -1
- package/dist/umd/service-worker.min.js +1 -1
- package/dist/umd/service-worker.min.js.map +1 -1
- package/package.json +5 -6
- package/dist/modern/default-ui/AuthProviderButton.d.ts +0 -21
- package/dist/modern/default-ui/ProviderSelectionDialog.d.ts +0 -7
- package/dist/modern/default-ui/SelectDialog.d.ts +0 -10
- package/dist/modern/dexie-cloud-addon.min.js.gz +0 -0
- package/dist/umd/DISABLE_SERVICEWORKER_STRATEGY.d.ts +0 -1
- package/dist/umd/DXCWebSocketStatus.d.ts +0 -1
- package/dist/umd/DexieCloudAPI.d.ts +0 -75
- package/dist/umd/DexieCloudOptions.d.ts +0 -27
- package/dist/umd/DexieCloudSyncOptions.d.ts +0 -4
- package/dist/umd/DexieCloudTable.d.ts +0 -18
- package/dist/umd/InvalidLicenseError.d.ts +0 -5
- package/dist/umd/Invite.d.ts +0 -8
- package/dist/umd/PermissionChecker.d.ts +0 -15
- package/dist/umd/TSON.d.ts +0 -17
- package/dist/umd/WSObservable.d.ts +0 -72
- package/dist/umd/associate.d.ts +0 -1
- package/dist/umd/authentication/AuthPersistedContext.d.ts +0 -9
- package/dist/umd/authentication/TokenErrorResponseError.d.ts +0 -10
- package/dist/umd/authentication/TokenExpiredError.d.ts +0 -3
- package/dist/umd/authentication/UNAUTHORIZED_USER.d.ts +0 -2
- package/dist/umd/authentication/authenticate.d.ts +0 -13
- package/dist/umd/authentication/interactWithUser.d.ts +0 -21
- package/dist/umd/authentication/login.d.ts +0 -3
- package/dist/umd/authentication/logout.d.ts +0 -5
- package/dist/umd/authentication/otpFetchTokenCallback.d.ts +0 -3
- package/dist/umd/authentication/setCurrentUser.d.ts +0 -14
- package/dist/umd/authentication/waitUntil.d.ts +0 -3
- package/dist/umd/computeSyncState.d.ts +0 -4
- package/dist/umd/createSharedValueObservable.d.ts +0 -3
- package/dist/umd/currentUserEmitter.d.ts +0 -3
- package/dist/umd/db/DexieCloudDB.d.ts +0 -61
- package/dist/umd/db/entities/BaseRevisionMapEntry.d.ts +0 -5
- package/dist/umd/db/entities/EntityCommon.d.ts +0 -5
- package/dist/umd/db/entities/GuardedJob.d.ts +0 -5
- package/dist/umd/db/entities/Member.d.ts +0 -19
- package/dist/umd/db/entities/PersistedSyncState.d.ts +0 -22
- package/dist/umd/db/entities/Realm.d.ts +0 -14
- package/dist/umd/db/entities/Role.d.ts +0 -11
- package/dist/umd/db/entities/UserLogin.d.ts +0 -23
- package/dist/umd/default-ui/Dialog.d.ts +0 -5
- package/dist/umd/default-ui/LoginDialog.d.ts +0 -3
- package/dist/umd/default-ui/Styles.d.ts +0 -3
- package/dist/umd/default-ui/index.d.ts +0 -24
- package/dist/umd/define-ydoc-trigger.d.ts +0 -3
- package/dist/umd/dexie-cloud-addon.d.ts +0 -3
- package/dist/umd/dexie-cloud-addon.js.gz +0 -0
- package/dist/umd/dexie-cloud-addon.min.js.gz +0 -0
- package/dist/umd/dexie-cloud-client.d.ts +0 -23
- package/dist/umd/errors/HttpError.d.ts +0 -5
- package/dist/umd/extend-dexie-interface.d.ts +0 -23
- package/dist/umd/getGlobalRolesObservable.d.ts +0 -5
- package/dist/umd/getInternalAccessControlObservable.d.ts +0 -12
- package/dist/umd/getInvitesObservable.d.ts +0 -23
- package/dist/umd/getPermissionsLookupObservable.d.ts +0 -16
- package/dist/umd/getTiedRealmId.d.ts +0 -2
- package/dist/umd/helpers/BroadcastedAndLocalEvent.d.ts +0 -8
- package/dist/umd/helpers/CancelToken.d.ts +0 -4
- package/dist/umd/helpers/IS_SERVICE_WORKER.d.ts +0 -1
- package/dist/umd/helpers/SWBroadcastChannel.d.ts +0 -12
- package/dist/umd/helpers/allSettled.d.ts +0 -1
- package/dist/umd/helpers/bulkUpdate.d.ts +0 -4
- package/dist/umd/helpers/computeRealmSetHash.d.ts +0 -2
- package/dist/umd/helpers/date-constants.d.ts +0 -5
- package/dist/umd/helpers/flatten.d.ts +0 -1
- package/dist/umd/helpers/getMutationTable.d.ts +0 -1
- package/dist/umd/helpers/getSyncableTables.d.ts +0 -4
- package/dist/umd/helpers/getTableFromMutationTable.d.ts +0 -1
- package/dist/umd/helpers/makeArray.d.ts +0 -1
- package/dist/umd/helpers/randomString.d.ts +0 -1
- package/dist/umd/helpers/resolveText.d.ts +0 -16
- package/dist/umd/helpers/throwVersionIncrementNeeded.d.ts +0 -1
- package/dist/umd/helpers/visibilityState.d.ts +0 -1
- package/dist/umd/isEagerSyncDisabled.d.ts +0 -2
- package/dist/umd/isFirefox.d.ts +0 -1
- package/dist/umd/isSafari.d.ts +0 -2
- package/dist/umd/mapValueObservable.d.ts +0 -5
- package/dist/umd/mergePermissions.d.ts +0 -2
- package/dist/umd/middleware-helpers/guardedTable.d.ts +0 -11
- package/dist/umd/middleware-helpers/idGenerationHelpers.d.ts +0 -18
- package/dist/umd/middlewares/createIdGenerationMiddleware.d.ts +0 -3
- package/dist/umd/middlewares/createImplicitPropSetterMiddleware.d.ts +0 -3
- package/dist/umd/middlewares/createMutationTrackingMiddleware.d.ts +0 -17
- package/dist/umd/middlewares/outstandingTransaction.d.ts +0 -4
- package/dist/umd/overrideParseStoresSpec.d.ts +0 -4
- package/dist/umd/performInitialSync.d.ts +0 -4
- package/dist/umd/permissions.d.ts +0 -9
- package/dist/umd/prodLog.d.ts +0 -9
- package/dist/umd/service-worker.d.ts +0 -1
- package/dist/umd/sync/DEXIE_CLOUD_SYNCER_ID.d.ts +0 -1
- package/dist/umd/sync/LocalSyncWorker.d.ts +0 -7
- package/dist/umd/sync/SyncRequiredError.d.ts +0 -3
- package/dist/umd/sync/applyServerChanges.d.ts +0 -3
- package/dist/umd/sync/connectWebSocket.d.ts +0 -2
- package/dist/umd/sync/encodeIdsForServer.d.ts +0 -4
- package/dist/umd/sync/extractRealm.d.ts +0 -2
- package/dist/umd/sync/getLatestRevisionsPerTable.d.ts +0 -6
- package/dist/umd/sync/getTablesToSyncify.d.ts +0 -3
- package/dist/umd/sync/isOnline.d.ts +0 -1
- package/dist/umd/sync/isSyncNeeded.d.ts +0 -2
- package/dist/umd/sync/listClientChanges.d.ts +0 -9
- package/dist/umd/sync/listSyncifiedChanges.d.ts +0 -5
- package/dist/umd/sync/messageConsumerIsReady.d.ts +0 -2
- package/dist/umd/sync/messagesFromServerQueue.d.ts +0 -8
- package/dist/umd/sync/modifyLocalObjectsWithNewUserId.d.ts +0 -4
- package/dist/umd/sync/myId.d.ts +0 -1
- package/dist/umd/sync/numUnsyncedMutations.d.ts +0 -2
- package/dist/umd/sync/old_startSyncingClientChanges.d.ts +0 -39
- package/dist/umd/sync/performGuardedJob.d.ts +0 -2
- package/dist/umd/sync/ratelimit.d.ts +0 -3
- package/dist/umd/sync/registerSyncEvent.d.ts +0 -3
- package/dist/umd/sync/sync.d.ts +0 -15
- package/dist/umd/sync/syncIfPossible.d.ts +0 -5
- package/dist/umd/sync/syncWithServer.d.ts +0 -6
- package/dist/umd/sync/triggerSync.d.ts +0 -2
- package/dist/umd/sync/updateBaseRevs.d.ts +0 -5
- package/dist/umd/types/DXCAlert.d.ts +0 -25
- package/dist/umd/types/DXCInputField.d.ts +0 -11
- package/dist/umd/types/DXCUserInteraction.d.ts +0 -93
- package/dist/umd/types/NewIdOptions.d.ts +0 -3
- package/dist/umd/types/SWMessageEvent.d.ts +0 -3
- package/dist/umd/types/SWSyncEvent.d.ts +0 -4
- package/dist/umd/types/SyncState.d.ts +0 -9
- package/dist/umd/types/TXExpandos.d.ts +0 -11
- package/dist/umd/updateSchemaFromOptions.d.ts +0 -3
- package/dist/umd/userIsActive.d.ts +0 -7
- package/dist/umd/verifyConfig.d.ts +0 -2
- package/dist/umd/verifySchema.d.ts +0 -2
- package/dist/umd/yjs/YDexieCloudSyncState.d.ts +0 -3
- package/dist/umd/yjs/YTable.d.ts +0 -3
- package/dist/umd/yjs/applyYMessages.d.ts +0 -9
- package/dist/umd/yjs/awareness.d.ts +0 -3
- package/dist/umd/yjs/createYClientUpdateObservable.d.ts +0 -4
- package/dist/umd/yjs/createYHandler.d.ts +0 -2
- package/dist/umd/yjs/downloadYDocsFromServer.d.ts +0 -3
- package/dist/umd/yjs/getUpdatesTable.d.ts +0 -3
- package/dist/umd/yjs/listUpdatesSince.d.ts +0 -3
- package/dist/umd/yjs/listYClientMessagesAndStateVector.d.ts +0 -26
- package/dist/umd/yjs/reopenDocSignal.d.ts +0 -10
- package/dist/umd/yjs/updateYSyncStates.d.ts +0 -6
- /package/dist/{umd/authentication/currentUserObservable.d.ts → modern/sync/blobOffloading.test.d.ts} +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { DexieCloudDB } from "../db/DexieCloudDB";
|
|
2
|
+
import { BlobRef } from "./blobResolve";
|
|
3
|
+
/**
|
|
4
|
+
* Deduplicates in-flight blob downloads.
|
|
5
|
+
*
|
|
6
|
+
* Both the blob-resolve middleware and the eager blob downloader may
|
|
7
|
+
* try to fetch the same blob concurrently. This tracker ensures each
|
|
8
|
+
* unique blob ref is only downloaded once — subsequent requests for
|
|
9
|
+
* the same ref piggyback on the existing promise.
|
|
10
|
+
*
|
|
11
|
+
* Instantiate once per DexieCloudDB.
|
|
12
|
+
*/
|
|
13
|
+
export declare class BlobDownloadTracker {
|
|
14
|
+
private inFlight;
|
|
15
|
+
private db;
|
|
16
|
+
constructor(db: DexieCloudDB);
|
|
17
|
+
/**
|
|
18
|
+
* Download a blob, deduplicating concurrent requests for the same ref.
|
|
19
|
+
*
|
|
20
|
+
* @param blobRef - The BlobRef to download
|
|
21
|
+
* @param dbUrl - Base URL for the database (e.g., 'https://mydb.dexie.cloud')
|
|
22
|
+
*/
|
|
23
|
+
download(blobRef: BlobRef, dbUrl: string): Promise<Uint8Array>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Download blob data from server via proxy endpoint.
|
|
27
|
+
* Uses auth header for authentication (same as sync).
|
|
28
|
+
*
|
|
29
|
+
* @param blobRef - The BlobRef to download
|
|
30
|
+
* @param dbUrl - Base URL for the database (e.g., 'https://mydb.dexie.cloud')
|
|
31
|
+
* @param accessToken - Access token for authentication
|
|
32
|
+
*/
|
|
33
|
+
export declare function downloadBlob(blobRef: BlobRef, dbUrl: string, accessToken: string): Promise<Uint8Array>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BlobSavingQueue - Queues resolved blobs for saving back to IndexedDB
|
|
3
|
+
*
|
|
4
|
+
* Uses setTimeout(fn, 0) instead of queueMicrotask to completely isolate
|
|
5
|
+
* from Dexie's Promise.PSD context. This prevents the save operation
|
|
6
|
+
* from inheriting any ongoing transaction.
|
|
7
|
+
*
|
|
8
|
+
* Each blob is saved atomically using downCore transaction with the specific
|
|
9
|
+
* keyPath to avoid race conditions with other property changes.
|
|
10
|
+
*/
|
|
11
|
+
import { ResolvedBlob } from './blobResolve';
|
|
12
|
+
import { DexieCloudDB } from '../db/DexieCloudDB';
|
|
13
|
+
export declare class BlobSavingQueue {
|
|
14
|
+
private queue;
|
|
15
|
+
private isProcessing;
|
|
16
|
+
private db;
|
|
17
|
+
constructor(db: DexieCloudDB);
|
|
18
|
+
/**
|
|
19
|
+
* Queue a resolved blob for saving.
|
|
20
|
+
* Only the specific blob property will be updated atomically.
|
|
21
|
+
*/
|
|
22
|
+
saveBlobs(tableName: string, primaryKey: any, resolvedBlobs: ResolvedBlob[]): void;
|
|
23
|
+
/**
|
|
24
|
+
* Start the consumer if not already processing.
|
|
25
|
+
* Uses setTimeout(fn, 0) to completely break out of any
|
|
26
|
+
* Dexie transaction context (Promise.PSD).
|
|
27
|
+
*/
|
|
28
|
+
private startConsumer;
|
|
29
|
+
/**
|
|
30
|
+
* Process all queued blobs.
|
|
31
|
+
* Runs in a completely isolated context (no inherited transaction).
|
|
32
|
+
* Uses atomic updates to avoid race conditions.
|
|
33
|
+
*/
|
|
34
|
+
private processQueue;
|
|
35
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Blob Offloading for Dexie Cloud
|
|
3
|
+
*
|
|
4
|
+
* Handles uploading large blobs to blob storage before sync,
|
|
5
|
+
* and resolving BlobRefs when reading from the database.
|
|
6
|
+
*/
|
|
7
|
+
import { DBOperationsSet } from 'dexie-cloud-common';
|
|
8
|
+
import { BlobRef, BlobRefOrigType, isBlobRef as isBlobRefFromResolve } from './blobResolve';
|
|
9
|
+
export declare const DEFAULT_MAX_STRING_LENGTH = 32768;
|
|
10
|
+
export type { BlobRef, BlobRefOrigType };
|
|
11
|
+
export declare const isBlobRef: typeof isBlobRefFromResolve;
|
|
12
|
+
/**
|
|
13
|
+
* Check if a value should be offloaded to blob storage
|
|
14
|
+
* Performance-optimized for hot path traversal.
|
|
15
|
+
*/
|
|
16
|
+
export declare function shouldOffloadBlob(value: unknown): value is Blob | ArrayBuffer | ArrayBufferView;
|
|
17
|
+
/**
|
|
18
|
+
* Upload a blob to the blob storage endpoint
|
|
19
|
+
*/
|
|
20
|
+
export declare function uploadBlob(databaseUrl: string, getCachedAccessToken: () => Promise<string | null>, blob: Blob | ArrayBuffer | ArrayBufferView): Promise<BlobRef | null>;
|
|
21
|
+
export declare function offloadBlobsAndMarkDirty(obj: unknown, databaseUrl: string, getCachedAccessToken: () => Promise<string | null>, maxStringLength?: number): Promise<unknown>;
|
|
22
|
+
/**
|
|
23
|
+
* Recursively scan an object for large blobs and upload them
|
|
24
|
+
* Returns a new object with blobs replaced by BlobRefs
|
|
25
|
+
*/
|
|
26
|
+
export declare function offloadBlobs(obj: unknown, databaseUrl: string, getCachedAccessToken: () => Promise<string | null>, maxStringLength?: number, dirtyFlag?: {
|
|
27
|
+
dirty: boolean;
|
|
28
|
+
}, visited?: WeakSet<object>): Promise<unknown>;
|
|
29
|
+
/**
|
|
30
|
+
* Process a DBOperationsSet and offload any large blobs
|
|
31
|
+
* Returns a new DBOperationsSet with blobs replaced by BlobRefs
|
|
32
|
+
*/
|
|
33
|
+
export declare function offloadBlobsInOperations(operations: DBOperationsSet, databaseUrl: string, getCachedAccessToken: () => Promise<string | null>, maxStringLength?: number): Promise<DBOperationsSet>;
|
|
34
|
+
/**
|
|
35
|
+
* Check if there are any large blobs in the operations that need offloading
|
|
36
|
+
* This is a quick check to avoid unnecessary processing
|
|
37
|
+
*/
|
|
38
|
+
export declare function hasLargeBlobsInOperations(operations: DBOperationsSet, maxStringLength?: number): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Blob Progress Tracking
|
|
3
|
+
*
|
|
4
|
+
* Uses liveQuery to reactively track unresolved blob refs.
|
|
5
|
+
* Any change to _hasBlobRefs in any syncable table automatically
|
|
6
|
+
* triggers a re-scan — no manual updateBlobProgress() needed.
|
|
7
|
+
*/
|
|
8
|
+
import { BehaviorSubject, Observable } from 'rxjs';
|
|
9
|
+
import { BlobProgress } from '../DexieCloudAPI';
|
|
10
|
+
import { DexieCloudDB } from '../db/DexieCloudDB';
|
|
11
|
+
/**
|
|
12
|
+
* BehaviorSubject for the isDownloading flag, controlled by eagerBlobDownloader.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createDownloadingState(): BehaviorSubject<boolean>;
|
|
15
|
+
/**
|
|
16
|
+
* Set downloading state.
|
|
17
|
+
*/
|
|
18
|
+
export declare function setDownloadingState(downloading$: BehaviorSubject<boolean>, isDownloading: boolean): void;
|
|
19
|
+
/**
|
|
20
|
+
* Create a liveQuery-based Observable<BlobProgress>.
|
|
21
|
+
*
|
|
22
|
+
* Combines a liveQuery (blobsRemaining, bytesRemaining) with an external
|
|
23
|
+
* isDownloading flag controlled by the eager downloader.
|
|
24
|
+
*/
|
|
25
|
+
export declare function observeBlobProgress(db: DexieCloudDB, downloading$: BehaviorSubject<boolean>): Observable<BlobProgress>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { BlobDownloadTracker } from './BlobDownloadTracker';
|
|
2
|
+
/**
|
|
3
|
+
* BlobRef Resolution for Dexie Cloud
|
|
4
|
+
*
|
|
5
|
+
* Handles lazy resolution of BlobRefs when reading from the database.
|
|
6
|
+
* BlobRefs are symbolic references to blobs stored in blob storage.
|
|
7
|
+
* They get resolved on-demand when the object is read.
|
|
8
|
+
*
|
|
9
|
+
* The server sends offloaded binary data in the format:
|
|
10
|
+
* { _bt: 'Uint8Array', ref: '1:blobId', size: 1234 }
|
|
11
|
+
* { _bt: 'Blob', ref: '1:blobId', size: 1234, ct: 'image/png' }
|
|
12
|
+
*
|
|
13
|
+
* The _bt field preserves the original JavaScript type.
|
|
14
|
+
* The ref format is '{version}:{blobId}' where version identifies
|
|
15
|
+
* the storage backend configuration.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Original type that was offloaded to blob storage.
|
|
19
|
+
* Matches the TSON type names.
|
|
20
|
+
*/
|
|
21
|
+
export type BlobRefOrigType = 'Blob' | 'ArrayBuffer' | 'Uint8Array' | 'Int8Array' | 'Uint8ClampedArray' | 'Int16Array' | 'Uint16Array' | 'Int32Array' | 'Uint32Array' | 'Float32Array' | 'Float64Array' | 'BigInt64Array' | 'BigUint64Array' | 'DataView' | 'string';
|
|
22
|
+
/**
|
|
23
|
+
* BlobRef represents a reference to binary data stored in blob storage.
|
|
24
|
+
* The _bt field contains the original JavaScript type (Uint8Array, Blob, etc.)
|
|
25
|
+
* The presence of 'ref' instead of 'v' indicates this is an offloaded blob.
|
|
26
|
+
*/
|
|
27
|
+
export interface BlobRef {
|
|
28
|
+
_bt: BlobRefOrigType;
|
|
29
|
+
ref: string;
|
|
30
|
+
size: number;
|
|
31
|
+
ct?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Resolved blob with its keyPath for queueing
|
|
35
|
+
*/
|
|
36
|
+
export interface ResolvedBlob {
|
|
37
|
+
keyPath: string;
|
|
38
|
+
data: Blob | ArrayBuffer | ArrayBufferView | string;
|
|
39
|
+
ref: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Check if a value is a BlobRef (offloaded binary data)
|
|
43
|
+
* A BlobRef has _bt (type), ref (blob ID), but no v (inline data)
|
|
44
|
+
*/
|
|
45
|
+
export declare function isBlobRef(value: unknown): value is BlobRef;
|
|
46
|
+
/**
|
|
47
|
+
* Serialized TSONRef shape (after IndexedDB structured clone).
|
|
48
|
+
* The Symbol is lost but properties remain.
|
|
49
|
+
*/
|
|
50
|
+
export interface SerializedTSONRef {
|
|
51
|
+
type: string;
|
|
52
|
+
ref: string;
|
|
53
|
+
size: number;
|
|
54
|
+
contentType?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Check if a value is a serialized TSONRef (after IndexedDB storage)
|
|
58
|
+
* Has 'type' instead of '$t', and no Symbol marker
|
|
59
|
+
*/
|
|
60
|
+
export declare function isSerializedTSONRef(value: unknown): value is SerializedTSONRef;
|
|
61
|
+
/**
|
|
62
|
+
* Recursively check if an object contains any BlobRefs
|
|
63
|
+
*/
|
|
64
|
+
export declare function hasBlobRefs(obj: unknown, visited?: WeakSet<object>): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Convert downloaded Uint8Array to the original type specified in BlobRef
|
|
67
|
+
*/
|
|
68
|
+
export declare function convertToOriginalType(data: Uint8Array, ref: BlobRef): Blob | ArrayBuffer | ArrayBufferView | string;
|
|
69
|
+
/**
|
|
70
|
+
* Recursively resolve all BlobRefs in an object and collect them for queueing.
|
|
71
|
+
* Returns a new object with BlobRefs replaced by their original type data,
|
|
72
|
+
* and populates the resolvedBlobs array with keyPath info for each blob.
|
|
73
|
+
*
|
|
74
|
+
* @param obj - Object to resolve
|
|
75
|
+
* @param dbUrl - Base URL for the database
|
|
76
|
+
* @param accessToken - Access token for blob downloads
|
|
77
|
+
* @param resolvedBlobs - Array to collect resolved blob info
|
|
78
|
+
* @param currentPath - Current property path (for tracking)
|
|
79
|
+
* @param visited - WeakMap for circular reference detection
|
|
80
|
+
*/
|
|
81
|
+
export declare function resolveAllBlobRefs(obj: unknown, dbUrl: string, resolvedBlobs: ResolvedBlob[] | undefined, currentPath: string | undefined, visited: WeakMap<object, any> | undefined, tracker: BlobDownloadTracker): Promise<unknown>;
|
|
82
|
+
/**
|
|
83
|
+
* Check if an object has unresolved BlobRefs
|
|
84
|
+
*/
|
|
85
|
+
export declare function hasUnresolvedBlobRefs(obj: unknown): boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Eager Blob Downloader
|
|
3
|
+
*
|
|
4
|
+
* Downloads unresolved blobs in the background when blobMode='eager'.
|
|
5
|
+
* Called after sync completes to prefetch blobs for offline access.
|
|
6
|
+
*
|
|
7
|
+
* Progress is tracked automatically via liveQuery in blobProgress.ts —
|
|
8
|
+
* no manual progress reporting needed here.
|
|
9
|
+
*/
|
|
10
|
+
import { BehaviorSubject } from 'rxjs';
|
|
11
|
+
import { DexieCloudDB } from '../db/DexieCloudDB';
|
|
12
|
+
/**
|
|
13
|
+
* Download all unresolved blobs in the background.
|
|
14
|
+
*
|
|
15
|
+
* This is called when blobMode='eager' (default) after sync completes.
|
|
16
|
+
* BlobRef URLs are signed (SAS tokens) so no auth header needed.
|
|
17
|
+
*
|
|
18
|
+
* Each blob is saved atomically using Table.update() to avoid race conditions.
|
|
19
|
+
*/
|
|
20
|
+
export declare function downloadUnresolvedBlobs(db: DexieCloudDB, downloading$: BehaviorSubject<boolean>, signal?: AbortSignal): Promise<void>;
|
|
@@ -6,6 +6,8 @@ export interface DXCErrorAlert {
|
|
|
6
6
|
messageParams: {
|
|
7
7
|
[paramName: string]: string;
|
|
8
8
|
};
|
|
9
|
+
/** Optional text that users can copy to clipboard (e.g. a CLI command) */
|
|
10
|
+
copyText?: string;
|
|
9
11
|
}
|
|
10
12
|
export interface DXCWarningAlert {
|
|
11
13
|
type: 'warning';
|
|
@@ -14,6 +16,8 @@ export interface DXCWarningAlert {
|
|
|
14
16
|
messageParams: {
|
|
15
17
|
[paramName: string]: string;
|
|
16
18
|
};
|
|
19
|
+
/** Optional text that users can copy to clipboard (e.g. a CLI command) */
|
|
20
|
+
copyText?: string;
|
|
17
21
|
}
|
|
18
22
|
export interface DXCInfoAlert {
|
|
19
23
|
type: 'info';
|
|
@@ -22,4 +26,6 @@ export interface DXCInfoAlert {
|
|
|
22
26
|
messageParams: {
|
|
23
27
|
[paramName: string]: string;
|
|
24
28
|
};
|
|
29
|
+
/** Optional text that users can copy to clipboard (e.g. a CLI command) */
|
|
30
|
+
copyText?: string;
|
|
25
31
|
}
|