import { CoID, RawCoValue } from "../coValue.js"; import { AvailableCoValueCore, DecryptedTransaction } from "../coValueCore/coValueCore.js"; import { AgentID, RawCoID, TransactionID } from "../ids.js"; import { JsonObject, JsonValue } from "../jsonValue.js"; import { RawAccountID } from "./account.js"; import type { RawGroup } from "./group.js"; import { CoValueFrontier } from "../knownState.js"; type MapOp = { txID: TransactionID; madeAt: number; changeIdx: number; change: MapOpPayload; trusting?: boolean; }; export type MapOpPayload = { op: "set"; key: K; value: V; } | { op: "del"; key: K; }; export declare class RawCoMap implements RawCoValue { /** @category 6. Meta */ id: CoID; /** @category 6. Meta */ type: "comap"; /** @category 6. Meta */ core: AvailableCoValueCore; /** @internal */ get latestTxMadeAt(): number; /** @internal */ get earliestTxMadeAt(): number; /** The internal state of the RawCoMap */ ops: { [Key in keyof Shape & string]?: MapOp[]; }; latest: { [Key in keyof Shape & string]?: MapOp; }; knownTransactions: Record; totalValidTransactions: number; version: number; protected resetInternalState(): void; /** @internal */ ignorePrivateTransactions: boolean; /** @internal */ atTimeFilter?: number; /** @internal */ atFrontierFilter?: CoValueFrontier; /** @category 6. Meta */ readonly _shape: Shape; /** @internal */ constructor(core: AvailableCoValueCore, options?: { ignorePrivateTransactions: boolean; }); processNewTransactions(): void; handleNewTransaction(transaction: DecryptedTransaction): void; rebuildFromCore(): void; isTimeTravelEntity(): boolean; /** @category 6. Meta */ get headerMeta(): Meta; /** @category 6. Meta */ get group(): RawGroup; /** @category 4. Time travel */ atTime(time: number): this; /** @category 4. Time travel */ atFrontier(frontier: CoValueFrontier): this; /** * Get all keys currently in the map. * * @category 1. Reading */ keys(): K[]; getRaw(key: K): ({ [Key in keyof Shape & string]?: MapOp | undefined; }[K] & {}) | undefined; /** * Returns the current value for the given key. * * @category 1. Reading **/ get(key: K): Shape[K] | undefined; /** @category 1. Reading */ asObject(): { [K in keyof Shape & string]: Shape[K]; }; /** @category 1. Reading */ toJSON(): { [K in keyof Shape & string]: Shape[K]; }; /** @category 5. Edit history */ nthEditAt(key: K, n: number): { by: `sealer_z${string}/signer_z${string}` | RawAccountID; tx: TransactionID; at: Date; value: Shape[K] | undefined; } | undefined; /** @category 5. Edit history */ lastEditAt(key: K): { by: RawAccountID | AgentID; tx: TransactionID; at: Date; value?: Shape[K]; } | undefined; /** @category 5. Edit history */ editsAt(key: K): Generator<{ by: `sealer_z${string}/signer_z${string}` | RawAccountID; tx: TransactionID; at: Date; value: Shape[K] | undefined; }, void, unknown>; /** @category 3. Subscription */ subscribe(listener: (coMap: this) => void): () => void; /** Set a new value for the given key. * * If `privacy` is `"private"` **(default)**, both `key` and `value` are encrypted in the transaction, only readable by other members of the group this `CoMap` belongs to. Not even sync servers can see the content in plaintext. * * If `privacy` is `"trusting"`, both `key` and `value` are stored in plaintext in the transaction, visible to everyone who gets a hold of it, including sync servers. * * @category 2. Editing **/ set(key: K, value: Shape[K], privacy?: "private" | "trusting"): void; assign(entries: Partial, privacy?: "private" | "trusting", meta?: JsonObject): void; /** Delete the given key (setting it to undefined). * * If `privacy` is `"private"` **(default)**, `key` is encrypted in the transaction, only readable by other members of the group this `CoMap` belongs to. Not even sync servers can see the content in plaintext. * * If `privacy` is `"trusting"`, `key` is stored in plaintext in the transaction, visible to everyone who gets a hold of it, including sync servers. * * @category 2. Editing **/ delete(key: keyof Shape & string, privacy?: "private" | "trusting"): void; } export declare function operationToEditEntry(op: MapOp): { by: `sealer_z${string}/signer_z${string}` | RawAccountID; tx: TransactionID; at: Date; value: V | undefined; }; export {}; //# sourceMappingURL=coMap.d.ts.map