loro-repo 0.2.0 → 0.3.0
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/{index.d.cts → index-DsCaL9JX.d.cts} +101 -49
- package/dist/{index.d.ts → index-tq65q3qY.d.ts} +102 -50
- package/dist/index.cjs +463 -164
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +453 -158
- package/dist/index.js.map +1 -1
- package/package.json +8 -5
|
@@ -56,10 +56,6 @@ interface LoroRepoOptions<_Meta extends JsonObject = JsonObject> {
|
|
|
56
56
|
* Optional adapter that moves asset payloads while keeping metadata in sync.
|
|
57
57
|
*/
|
|
58
58
|
readonly assetTransportAdapter?: AssetTransportAdapter;
|
|
59
|
-
/**
|
|
60
|
-
* Factory invoked when a document handle needs to be materialised.
|
|
61
|
-
*/
|
|
62
|
-
readonly docFactory?: (docId: string) => Promise<LoroDoc>;
|
|
63
59
|
/**
|
|
64
60
|
* Debounce duration in milliseconds before persisting document frontier metadata
|
|
65
61
|
* after local edits. Defaults to 1000 ms when omitted.
|
|
@@ -168,6 +164,8 @@ interface TransportAdapter {
|
|
|
168
164
|
* Persists metadata, documents, and asset payloads on behalf of the repo.
|
|
169
165
|
*/
|
|
170
166
|
interface StorageAdapter {
|
|
167
|
+
init?(): Promise<void>;
|
|
168
|
+
close?(): void;
|
|
171
169
|
/**
|
|
172
170
|
* Writes document snapshots, queued updates, assets, or meta bundles to durable storage.
|
|
173
171
|
*/
|
|
@@ -220,6 +218,8 @@ interface AssetUploadMetadata {
|
|
|
220
218
|
* Moves binary assets between peers or infrastructure-specific storage.
|
|
221
219
|
*/
|
|
222
220
|
interface AssetTransportAdapter {
|
|
221
|
+
init?(): Promise<void>;
|
|
222
|
+
close?(): void;
|
|
223
223
|
/**
|
|
224
224
|
* Uploads a raw asset payload using transport-managed metadata.
|
|
225
225
|
*/
|
|
@@ -342,47 +342,57 @@ interface RepoDocHandle {
|
|
|
342
342
|
*/
|
|
343
343
|
readonly doc: LoroDoc;
|
|
344
344
|
/**
|
|
345
|
-
*
|
|
345
|
+
* Sync with the transport adaptor once.
|
|
346
346
|
*/
|
|
347
|
-
readonly
|
|
347
|
+
readonly syncOnce: () => Promise<void>;
|
|
348
348
|
/**
|
|
349
|
-
*
|
|
349
|
+
* Join the realtime collaboration room.
|
|
350
350
|
*/
|
|
351
|
-
|
|
351
|
+
readonly joinRoom: (auth?: Uint8Array) => Promise<TransportSubscription>;
|
|
352
352
|
}
|
|
353
|
-
interface UpsertDocMetaOptions {}
|
|
354
353
|
/**
|
|
355
354
|
* Provenance discriminant attached to every repo event.
|
|
356
355
|
*/
|
|
357
356
|
type RepoEventBy = "local" | "sync" | "live";
|
|
358
357
|
/**
|
|
359
|
-
* Unified event envelope emitted by `watch`.
|
|
358
|
+
* Unified event envelope types emitted by `watch`.
|
|
360
359
|
*/
|
|
361
|
-
type
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
360
|
+
type RepoEventType<Meta extends JsonObject = JsonObject> = {
|
|
361
|
+
"doc-metadata": {
|
|
362
|
+
readonly kind: "doc-metadata";
|
|
363
|
+
readonly docId: string;
|
|
364
|
+
readonly patch: Partial<Meta>;
|
|
365
|
+
readonly by: RepoEventBy;
|
|
366
|
+
};
|
|
367
|
+
"doc-frontiers": {
|
|
368
|
+
readonly kind: "doc-frontiers";
|
|
369
|
+
readonly docId: string;
|
|
370
|
+
readonly frontiers: Frontiers;
|
|
371
|
+
readonly by: RepoEventBy;
|
|
372
|
+
};
|
|
373
|
+
"asset-metadata": {
|
|
374
|
+
readonly kind: "asset-metadata";
|
|
375
|
+
readonly asset: AssetDownload;
|
|
376
|
+
readonly by: RepoEventBy;
|
|
377
|
+
};
|
|
378
|
+
"asset-link": {
|
|
379
|
+
readonly kind: "asset-link";
|
|
380
|
+
readonly docId: string;
|
|
381
|
+
readonly assetId: AssetId;
|
|
382
|
+
readonly by: RepoEventBy;
|
|
383
|
+
};
|
|
384
|
+
"asset-unlink": {
|
|
385
|
+
readonly kind: "asset-unlink";
|
|
386
|
+
readonly docId: string;
|
|
387
|
+
readonly assetId: AssetId;
|
|
388
|
+
readonly by: RepoEventBy;
|
|
389
|
+
};
|
|
385
390
|
};
|
|
391
|
+
/**
|
|
392
|
+
* Discriminant union of all possible repo event types.
|
|
393
|
+
*/
|
|
394
|
+
type RepoEventKind = keyof RepoEventType;
|
|
395
|
+
type RepoEvent<Meta extends JsonObject = JsonObject> = RepoEventType<Meta>[keyof RepoEventType<Meta>];
|
|
386
396
|
/**
|
|
387
397
|
* Listener signature for `watch`.
|
|
388
398
|
*/
|
|
@@ -619,40 +629,80 @@ declare class FileSystemStorageAdaptor implements StorageAdapter {
|
|
|
619
629
|
//#region src/index.d.ts
|
|
620
630
|
declare class LoroRepo<Meta extends JsonObject = JsonObject> {
|
|
621
631
|
readonly options: LoroRepoOptions<Meta>;
|
|
632
|
+
private _destroyed;
|
|
622
633
|
private readonly transport?;
|
|
623
634
|
private readonly storage?;
|
|
624
|
-
private readonly docFactory;
|
|
625
635
|
private metaFlock;
|
|
626
636
|
private readonly eventBus;
|
|
627
637
|
private readonly docManager;
|
|
628
638
|
private readonly metadataManager;
|
|
629
639
|
private readonly assetManager;
|
|
640
|
+
private readonly assetTransport?;
|
|
630
641
|
private readonly flockHydrator;
|
|
631
642
|
private readonly state;
|
|
632
643
|
private readonly syncRunner;
|
|
633
|
-
constructor(
|
|
634
|
-
|
|
644
|
+
private constructor();
|
|
645
|
+
static create<Meta extends JsonObject = JsonObject>(options: LoroRepoOptions<Meta>): Promise<LoroRepo<Meta>>;
|
|
646
|
+
/**
|
|
647
|
+
* Load meta from storage.
|
|
648
|
+
*
|
|
649
|
+
* You need to call this before all other operations to make the app functioning correctly.
|
|
650
|
+
* Though we do that implicitly already
|
|
651
|
+
*/
|
|
652
|
+
private ready;
|
|
653
|
+
/**
|
|
654
|
+
* Sync selected data via the transport adaptor
|
|
655
|
+
* @param options
|
|
656
|
+
*/
|
|
635
657
|
sync(options?: RepoSyncOptions): Promise<void>;
|
|
658
|
+
/**
|
|
659
|
+
* Start syncing the metadata (Flock) room. It will establish a realtime connection to the transport adaptor.
|
|
660
|
+
* All changes on the room will be synced to the Flock, and all changes on the Flock will be synced to the room.
|
|
661
|
+
* @param params
|
|
662
|
+
* @returns
|
|
663
|
+
*/
|
|
636
664
|
joinMetaRoom(params?: TransportJoinParams): Promise<TransportSubscription>;
|
|
665
|
+
/**
|
|
666
|
+
* Start syncing the given doc. It will establish a realtime connection to the transport adaptor.
|
|
667
|
+
* All changes on the doc will be synced to the transport, and all changes on the transport will be synced to the doc.
|
|
668
|
+
*
|
|
669
|
+
* All the changes on the room will be reflected on the same doc you get from `repo.openCollaborativeDoc(docId)`
|
|
670
|
+
* @param docId
|
|
671
|
+
* @param params
|
|
672
|
+
* @returns
|
|
673
|
+
*/
|
|
637
674
|
joinDocRoom(docId: string, params?: TransportJoinParams): Promise<TransportSubscription>;
|
|
638
|
-
|
|
639
|
-
|
|
675
|
+
/**
|
|
676
|
+
* Opens a document that is automatically persisted to the configured storage adapter.
|
|
677
|
+
*
|
|
678
|
+
* - Edits are saved to storage (debounced).
|
|
679
|
+
* - Frontiers are synced to the metadata (Flock).
|
|
680
|
+
* - Realtime collaboration is NOT enabled by default; use `joinDocRoom` to connect.
|
|
681
|
+
*/
|
|
682
|
+
openPersistedDoc(docId: string): Promise<RepoDocHandle>;
|
|
683
|
+
upsertDocMeta(docId: string, patch: Partial<Meta>): Promise<void>;
|
|
640
684
|
getDocMeta(docId: string): Promise<Meta | undefined>;
|
|
641
685
|
listDoc(query?: ListDocQuery): Promise<RepoDocMeta<Meta>[]>;
|
|
642
|
-
|
|
686
|
+
getMeta(): Flock;
|
|
643
687
|
watch(listener: RepoEventListener<Meta>, filter?: RepoEventFilter<Meta>): RepoWatchHandle;
|
|
644
688
|
/**
|
|
645
|
-
* Opens
|
|
646
|
-
*
|
|
689
|
+
* Opens a detached `LoroDoc` snapshot.
|
|
690
|
+
*
|
|
691
|
+
* - **No Persistence**: Edits to this document are NOT saved to storage.
|
|
692
|
+
* - **No Sync**: This document does not participate in realtime updates.
|
|
693
|
+
* - **Use Case**: Ideal for read-only history inspection, temporary drafts, or conflict resolution without affecting the main state.
|
|
647
694
|
*/
|
|
648
|
-
|
|
695
|
+
openDetachedDoc(docId: string): Promise<LoroDoc>;
|
|
649
696
|
/**
|
|
650
|
-
*
|
|
651
|
-
*
|
|
697
|
+
* Explicitly unloads a document from memory.
|
|
698
|
+
*
|
|
699
|
+
* - **Persists Immediately**: Forces a save of the document's current state to storage.
|
|
700
|
+
* - **Frees Memory**: Removes the document from the internal cache.
|
|
701
|
+
* - **Note**: If the document is currently being synced (via `joinDocRoom`), you should also unsubscribe from the room to fully release resources.
|
|
652
702
|
*/
|
|
653
|
-
|
|
703
|
+
unloadDoc(docId: string): Promise<void>;
|
|
704
|
+
flush(): Promise<void>;
|
|
654
705
|
uploadAsset(params: UploadAssetOptions): Promise<AssetId>;
|
|
655
|
-
whenDocInSyncWithRemote(docId: string): Promise<void>;
|
|
656
706
|
linkAsset(docId: string, params: LinkAssetOptions): Promise<AssetId>;
|
|
657
707
|
fetchAsset(assetId: AssetId): Promise<AssetDownload>;
|
|
658
708
|
unlinkAsset(docId: string, assetId: AssetId): Promise<void>;
|
|
@@ -660,7 +710,9 @@ declare class LoroRepo<Meta extends JsonObject = JsonObject> {
|
|
|
660
710
|
ensureAsset(assetId: AssetId): Promise<AssetDownload>;
|
|
661
711
|
gcAssets(options?: GarbageCollectionOptions): Promise<number>;
|
|
662
712
|
private persistMeta;
|
|
713
|
+
get destroyed(): boolean;
|
|
714
|
+
destroy(): Promise<void>;
|
|
663
715
|
}
|
|
664
716
|
//#endregion
|
|
665
|
-
export { AssetContent, AssetDownload, AssetId, AssetTransportAdapter, AssetUploadMetadata, BroadcastChannelTransportAdapter, type BroadcastChannelTransportOptions, FileSystemStorageAdaptor, type FileSystemStorageAdaptorOptions, GarbageCollectionOptions, IndexedDBStorageAdaptor, type IndexedDBStorageAdaptorOptions, JsonObject, JsonValue, LinkAssetOptions, ListDocQuery, LoroRepo, LoroRepoOptions, RepoAssetMetadata, RepoDocHandle, RepoDocMeta, RepoEvent, RepoEventBy, RepoEventFilter, RepoEventListener, type RepoSyncOptions, RepoWatchHandle, StorageAdapter, StorageSavePayload, SyncScope, TransportAdapter, type TransportJoinParams, type TransportSubscription, TransportSyncRequest, type TransportSyncResult, UploadAssetOptions,
|
|
666
|
-
//# sourceMappingURL=index.d.cts.map
|
|
717
|
+
export { AssetContent, AssetDownload, AssetId, AssetTransportAdapter, AssetUploadMetadata, BroadcastChannelTransportAdapter, type BroadcastChannelTransportOptions, FileSystemStorageAdaptor, type FileSystemStorageAdaptorOptions, GarbageCollectionOptions, IndexedDBStorageAdaptor, type IndexedDBStorageAdaptorOptions, JsonObject, JsonValue, LinkAssetOptions, ListDocQuery, LoroRepo, LoroRepoOptions, RepoAssetMetadata, RepoDocHandle, RepoDocMeta, RepoEvent, RepoEventBy, RepoEventFilter, RepoEventKind, RepoEventListener, RepoEventType, type RepoSyncOptions, RepoWatchHandle, StorageAdapter, StorageSavePayload, SyncScope, TransportAdapter, type TransportJoinParams, type TransportSubscription, TransportSyncRequest, type TransportSyncResult, UploadAssetOptions, WebSocketTransportAdapter, WebSocketTransportOptions };
|
|
718
|
+
//# sourceMappingURL=index-DsCaL9JX.d.cts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Flock } from "@loro-dev/flock";
|
|
2
|
-
import { Frontiers, LoroDoc } from "loro-crdt";
|
|
3
2
|
import { FlockAdaptor, FlockAdaptorConfig, LoroAdaptor } from "loro-adaptors";
|
|
4
3
|
import { JoinError, JoinResponseOk, RoomId, UpdateError } from "loro-protocol";
|
|
5
4
|
import { LoroWebsocketClientOptions } from "loro-websocket";
|
|
5
|
+
import { Frontiers, LoroDoc } from "loro-crdt";
|
|
6
6
|
|
|
7
7
|
//#region src/types.d.ts
|
|
8
8
|
type GlobalBlob = typeof globalThis extends {
|
|
@@ -56,10 +56,6 @@ interface LoroRepoOptions<_Meta extends JsonObject = JsonObject> {
|
|
|
56
56
|
* Optional adapter that moves asset payloads while keeping metadata in sync.
|
|
57
57
|
*/
|
|
58
58
|
readonly assetTransportAdapter?: AssetTransportAdapter;
|
|
59
|
-
/**
|
|
60
|
-
* Factory invoked when a document handle needs to be materialised.
|
|
61
|
-
*/
|
|
62
|
-
readonly docFactory?: (docId: string) => Promise<LoroDoc>;
|
|
63
59
|
/**
|
|
64
60
|
* Debounce duration in milliseconds before persisting document frontier metadata
|
|
65
61
|
* after local edits. Defaults to 1000 ms when omitted.
|
|
@@ -168,6 +164,8 @@ interface TransportAdapter {
|
|
|
168
164
|
* Persists metadata, documents, and asset payloads on behalf of the repo.
|
|
169
165
|
*/
|
|
170
166
|
interface StorageAdapter {
|
|
167
|
+
init?(): Promise<void>;
|
|
168
|
+
close?(): void;
|
|
171
169
|
/**
|
|
172
170
|
* Writes document snapshots, queued updates, assets, or meta bundles to durable storage.
|
|
173
171
|
*/
|
|
@@ -220,6 +218,8 @@ interface AssetUploadMetadata {
|
|
|
220
218
|
* Moves binary assets between peers or infrastructure-specific storage.
|
|
221
219
|
*/
|
|
222
220
|
interface AssetTransportAdapter {
|
|
221
|
+
init?(): Promise<void>;
|
|
222
|
+
close?(): void;
|
|
223
223
|
/**
|
|
224
224
|
* Uploads a raw asset payload using transport-managed metadata.
|
|
225
225
|
*/
|
|
@@ -342,47 +342,57 @@ interface RepoDocHandle {
|
|
|
342
342
|
*/
|
|
343
343
|
readonly doc: LoroDoc;
|
|
344
344
|
/**
|
|
345
|
-
*
|
|
345
|
+
* Sync with the transport adaptor once.
|
|
346
346
|
*/
|
|
347
|
-
readonly
|
|
347
|
+
readonly syncOnce: () => Promise<void>;
|
|
348
348
|
/**
|
|
349
|
-
*
|
|
349
|
+
* Join the realtime collaboration room.
|
|
350
350
|
*/
|
|
351
|
-
|
|
351
|
+
readonly joinRoom: (auth?: Uint8Array) => Promise<TransportSubscription>;
|
|
352
352
|
}
|
|
353
|
-
interface UpsertDocMetaOptions {}
|
|
354
353
|
/**
|
|
355
354
|
* Provenance discriminant attached to every repo event.
|
|
356
355
|
*/
|
|
357
356
|
type RepoEventBy = "local" | "sync" | "live";
|
|
358
357
|
/**
|
|
359
|
-
* Unified event envelope emitted by `watch`.
|
|
358
|
+
* Unified event envelope types emitted by `watch`.
|
|
360
359
|
*/
|
|
361
|
-
type
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
360
|
+
type RepoEventType<Meta extends JsonObject = JsonObject> = {
|
|
361
|
+
"doc-metadata": {
|
|
362
|
+
readonly kind: "doc-metadata";
|
|
363
|
+
readonly docId: string;
|
|
364
|
+
readonly patch: Partial<Meta>;
|
|
365
|
+
readonly by: RepoEventBy;
|
|
366
|
+
};
|
|
367
|
+
"doc-frontiers": {
|
|
368
|
+
readonly kind: "doc-frontiers";
|
|
369
|
+
readonly docId: string;
|
|
370
|
+
readonly frontiers: Frontiers;
|
|
371
|
+
readonly by: RepoEventBy;
|
|
372
|
+
};
|
|
373
|
+
"asset-metadata": {
|
|
374
|
+
readonly kind: "asset-metadata";
|
|
375
|
+
readonly asset: AssetDownload;
|
|
376
|
+
readonly by: RepoEventBy;
|
|
377
|
+
};
|
|
378
|
+
"asset-link": {
|
|
379
|
+
readonly kind: "asset-link";
|
|
380
|
+
readonly docId: string;
|
|
381
|
+
readonly assetId: AssetId;
|
|
382
|
+
readonly by: RepoEventBy;
|
|
383
|
+
};
|
|
384
|
+
"asset-unlink": {
|
|
385
|
+
readonly kind: "asset-unlink";
|
|
386
|
+
readonly docId: string;
|
|
387
|
+
readonly assetId: AssetId;
|
|
388
|
+
readonly by: RepoEventBy;
|
|
389
|
+
};
|
|
385
390
|
};
|
|
391
|
+
/**
|
|
392
|
+
* Discriminant union of all possible repo event types.
|
|
393
|
+
*/
|
|
394
|
+
type RepoEventKind = keyof RepoEventType;
|
|
395
|
+
type RepoEvent<Meta extends JsonObject = JsonObject> = RepoEventType<Meta>[keyof RepoEventType<Meta>];
|
|
386
396
|
/**
|
|
387
397
|
* Listener signature for `watch`.
|
|
388
398
|
*/
|
|
@@ -619,40 +629,80 @@ declare class FileSystemStorageAdaptor implements StorageAdapter {
|
|
|
619
629
|
//#region src/index.d.ts
|
|
620
630
|
declare class LoroRepo<Meta extends JsonObject = JsonObject> {
|
|
621
631
|
readonly options: LoroRepoOptions<Meta>;
|
|
632
|
+
private _destroyed;
|
|
622
633
|
private readonly transport?;
|
|
623
634
|
private readonly storage?;
|
|
624
|
-
private readonly docFactory;
|
|
625
635
|
private metaFlock;
|
|
626
636
|
private readonly eventBus;
|
|
627
637
|
private readonly docManager;
|
|
628
638
|
private readonly metadataManager;
|
|
629
639
|
private readonly assetManager;
|
|
640
|
+
private readonly assetTransport?;
|
|
630
641
|
private readonly flockHydrator;
|
|
631
642
|
private readonly state;
|
|
632
643
|
private readonly syncRunner;
|
|
633
|
-
constructor(
|
|
634
|
-
|
|
644
|
+
private constructor();
|
|
645
|
+
static create<Meta extends JsonObject = JsonObject>(options: LoroRepoOptions<Meta>): Promise<LoroRepo<Meta>>;
|
|
646
|
+
/**
|
|
647
|
+
* Load meta from storage.
|
|
648
|
+
*
|
|
649
|
+
* You need to call this before all other operations to make the app functioning correctly.
|
|
650
|
+
* Though we do that implicitly already
|
|
651
|
+
*/
|
|
652
|
+
private ready;
|
|
653
|
+
/**
|
|
654
|
+
* Sync selected data via the transport adaptor
|
|
655
|
+
* @param options
|
|
656
|
+
*/
|
|
635
657
|
sync(options?: RepoSyncOptions): Promise<void>;
|
|
658
|
+
/**
|
|
659
|
+
* Start syncing the metadata (Flock) room. It will establish a realtime connection to the transport adaptor.
|
|
660
|
+
* All changes on the room will be synced to the Flock, and all changes on the Flock will be synced to the room.
|
|
661
|
+
* @param params
|
|
662
|
+
* @returns
|
|
663
|
+
*/
|
|
636
664
|
joinMetaRoom(params?: TransportJoinParams): Promise<TransportSubscription>;
|
|
665
|
+
/**
|
|
666
|
+
* Start syncing the given doc. It will establish a realtime connection to the transport adaptor.
|
|
667
|
+
* All changes on the doc will be synced to the transport, and all changes on the transport will be synced to the doc.
|
|
668
|
+
*
|
|
669
|
+
* All the changes on the room will be reflected on the same doc you get from `repo.openCollaborativeDoc(docId)`
|
|
670
|
+
* @param docId
|
|
671
|
+
* @param params
|
|
672
|
+
* @returns
|
|
673
|
+
*/
|
|
637
674
|
joinDocRoom(docId: string, params?: TransportJoinParams): Promise<TransportSubscription>;
|
|
638
|
-
|
|
639
|
-
|
|
675
|
+
/**
|
|
676
|
+
* Opens a document that is automatically persisted to the configured storage adapter.
|
|
677
|
+
*
|
|
678
|
+
* - Edits are saved to storage (debounced).
|
|
679
|
+
* - Frontiers are synced to the metadata (Flock).
|
|
680
|
+
* - Realtime collaboration is NOT enabled by default; use `joinDocRoom` to connect.
|
|
681
|
+
*/
|
|
682
|
+
openPersistedDoc(docId: string): Promise<RepoDocHandle>;
|
|
683
|
+
upsertDocMeta(docId: string, patch: Partial<Meta>): Promise<void>;
|
|
640
684
|
getDocMeta(docId: string): Promise<Meta | undefined>;
|
|
641
685
|
listDoc(query?: ListDocQuery): Promise<RepoDocMeta<Meta>[]>;
|
|
642
|
-
|
|
686
|
+
getMeta(): Flock;
|
|
643
687
|
watch(listener: RepoEventListener<Meta>, filter?: RepoEventFilter<Meta>): RepoWatchHandle;
|
|
644
688
|
/**
|
|
645
|
-
* Opens
|
|
646
|
-
*
|
|
689
|
+
* Opens a detached `LoroDoc` snapshot.
|
|
690
|
+
*
|
|
691
|
+
* - **No Persistence**: Edits to this document are NOT saved to storage.
|
|
692
|
+
* - **No Sync**: This document does not participate in realtime updates.
|
|
693
|
+
* - **Use Case**: Ideal for read-only history inspection, temporary drafts, or conflict resolution without affecting the main state.
|
|
647
694
|
*/
|
|
648
|
-
|
|
695
|
+
openDetachedDoc(docId: string): Promise<LoroDoc>;
|
|
649
696
|
/**
|
|
650
|
-
*
|
|
651
|
-
*
|
|
697
|
+
* Explicitly unloads a document from memory.
|
|
698
|
+
*
|
|
699
|
+
* - **Persists Immediately**: Forces a save of the document's current state to storage.
|
|
700
|
+
* - **Frees Memory**: Removes the document from the internal cache.
|
|
701
|
+
* - **Note**: If the document is currently being synced (via `joinDocRoom`), you should also unsubscribe from the room to fully release resources.
|
|
652
702
|
*/
|
|
653
|
-
|
|
703
|
+
unloadDoc(docId: string): Promise<void>;
|
|
704
|
+
flush(): Promise<void>;
|
|
654
705
|
uploadAsset(params: UploadAssetOptions): Promise<AssetId>;
|
|
655
|
-
whenDocInSyncWithRemote(docId: string): Promise<void>;
|
|
656
706
|
linkAsset(docId: string, params: LinkAssetOptions): Promise<AssetId>;
|
|
657
707
|
fetchAsset(assetId: AssetId): Promise<AssetDownload>;
|
|
658
708
|
unlinkAsset(docId: string, assetId: AssetId): Promise<void>;
|
|
@@ -660,7 +710,9 @@ declare class LoroRepo<Meta extends JsonObject = JsonObject> {
|
|
|
660
710
|
ensureAsset(assetId: AssetId): Promise<AssetDownload>;
|
|
661
711
|
gcAssets(options?: GarbageCollectionOptions): Promise<number>;
|
|
662
712
|
private persistMeta;
|
|
713
|
+
get destroyed(): boolean;
|
|
714
|
+
destroy(): Promise<void>;
|
|
663
715
|
}
|
|
664
716
|
//#endregion
|
|
665
|
-
export { AssetContent, AssetDownload, AssetId, AssetTransportAdapter, AssetUploadMetadata, BroadcastChannelTransportAdapter, type BroadcastChannelTransportOptions, FileSystemStorageAdaptor, type FileSystemStorageAdaptorOptions, GarbageCollectionOptions, IndexedDBStorageAdaptor, type IndexedDBStorageAdaptorOptions, JsonObject, JsonValue, LinkAssetOptions, ListDocQuery, LoroRepo, LoroRepoOptions, RepoAssetMetadata, RepoDocHandle, RepoDocMeta, RepoEvent, RepoEventBy, RepoEventFilter, RepoEventListener, type RepoSyncOptions, RepoWatchHandle, StorageAdapter, StorageSavePayload, SyncScope, TransportAdapter, type TransportJoinParams, type TransportSubscription, TransportSyncRequest, type TransportSyncResult, UploadAssetOptions,
|
|
666
|
-
//# sourceMappingURL=index.d.ts.map
|
|
717
|
+
export { AssetContent, AssetDownload, AssetId, AssetTransportAdapter, AssetUploadMetadata, BroadcastChannelTransportAdapter, type BroadcastChannelTransportOptions, FileSystemStorageAdaptor, type FileSystemStorageAdaptorOptions, GarbageCollectionOptions, IndexedDBStorageAdaptor, type IndexedDBStorageAdaptorOptions, JsonObject, JsonValue, LinkAssetOptions, ListDocQuery, LoroRepo, LoroRepoOptions, RepoAssetMetadata, RepoDocHandle, RepoDocMeta, RepoEvent, RepoEventBy, RepoEventFilter, RepoEventKind, RepoEventListener, RepoEventType, type RepoSyncOptions, RepoWatchHandle, StorageAdapter, StorageSavePayload, SyncScope, TransportAdapter, type TransportJoinParams, type TransportSubscription, TransportSyncRequest, type TransportSyncResult, UploadAssetOptions, WebSocketTransportAdapter, WebSocketTransportOptions };
|
|
718
|
+
//# sourceMappingURL=index-tq65q3qY.d.ts.map
|