import { type RawCoMap } from "cojson"; import { CoValue, Group, ID, RefEncoded, RefsToResolve, RefsToResolveStrict, Resolved, TypeSym, CoValueBase, CoValueJazzApi, CoreSnapshotRefSchema, CoValueClass, ResolveQuery, Account, AnonymousJazzAgent, Settled, ItemsSym, CoValueCursor, Loaded, inspect, CoValueCreateOptions, SchemaPermissions } from "../internal.js"; type SnapshotRefInner = T extends SnapshotRef ? Inner : never; /** * A SnapshotRef captures a point-in-time reference to a CoValue. * * It stores a target CoValue ID and a cursor that together identify * a specific snapshot of the referenced value. This is useful for * creating immutable references to collaborative data at a known state. * * @category CoValues */ export declare class SnapshotRef extends CoValueBase implements CoValue { /** @category Type Helpers */ [TypeSym]: "SnapshotRef"; /** @internal This is only a marker type and doesn't exist at runtime */ [ItemsSym]: Inner; /** * Jazz methods for SnapshotRefs are inside this property. * * This allows SnapshotRefs to be used as plain objects while still having * access to Jazz methods. */ $jazz: SnapshotRefJazzApi; static coValueSchema?: CoreSnapshotRefSchema; /** @internal */ constructor(options: { fromRaw: RawCoMap; operation?: "create" | "load"; }); /** * The referenced value this snapshot reference points to. * * @category Content */ get ref(): Inner; /** * The cursor identifying the specific point-in-time state of the target CoValue. * * @category Content */ get cursor(): CoValueCursor; static load = true>(this: CoValueClass, id: ID, options?: { resolve?: RefsToResolveStrict; loadAs?: Account | AnonymousJazzAgent; skipRetry?: boolean; }): Promise>>; private static createSnapshotUniqueness; private static createRawMap; /** * Create a new `SnapshotRef` pointing to the given CoValue. * * Captures the current state of the value by recording its ID and a cursor. * The SnapshotRef will immediately be persisted and synced to connected peers. * * @category Creation */ static create>>(this: CoValueClass, createInit: { value: Loaded>; cursorResolve?: RefsToResolveStrict, R>; }, permissions: SchemaPermissions, options?: CoValueCreateOptions): Promise>; toJSON(): { $jazz: { id: string; }; ref: Inner; cursor: `cursor_z${string}`; }; [inspect](): { $jazz: { id: string; }; ref: Inner; cursor: `cursor_z${string}`; }; } /** * Contains SnapshotRef Jazz methods that are part of the {@link SnapshotRef.$jazz`} property. */ declare class SnapshotRefJazzApi extends CoValueJazzApi { private snapshotRef; private getRaw; private coreSnapshotRefSchema; private innerDescriptorCached; constructor(snapshotRef: M, getRaw: () => RawCoMap, coreSnapshotRefSchema: CoreSnapshotRefSchema); /** The `Group` that owns this SnapshotRef and controls access. */ get owner(): Group; /** * Given an already loaded `SnapshotRef`, ensure that the specified fields are loaded to the specified depth. * * Works like `SnapshotRef.load()`, but you don't need to pass the ID or the account to load as again. * * @category Subscription & Loading */ ensureLoaded>(this: SnapshotRefJazzApi, options: { resolve: RefsToResolveStrict; }): Promise>; /** * Wait for the `SnapshotRef` to be uploaded to the other peers. * * @category Subscription & Loading */ waitForSync(options?: { timeout?: number; }): Promise; /** @internal */ getDescriptor(key: string): RefEncoded | undefined; /** @internal */ get raw(): RawCoMap<{ [key: string]: import("cojson").JsonValue | undefined; }, import("cojson").JsonObject | null>; } export {}; //# sourceMappingURL=snapshotRef.d.ts.map