@salesforce/core
Version:
Core libraries to interact with SFDX projects, orgs, and APIs.
25 lines (24 loc) • 1.1 kB
TypeScript
import { LWWRegister } from './lwwRegister';
import { ConfigContents, Key } from './configStackTypes';
export declare const SYMBOL_FOR_DELETED: "UNIQUE_IDENTIFIER_FOR_DELETED";
export type LWWState<P> = {
[Property in keyof P]: LWWRegister<P[Property] | typeof SYMBOL_FOR_DELETED>['state'];
};
/**
* @param contents object aligning with ConfigContents
* @param timestamp a bigInt that sets the timestamp. Defaults to the current time
* construct a LWWState from an object
* @param keysToCheckForDeletion if a key is in this array, AND not in the contents, it will be marked as deleted
* */
export declare const stateFromContents: <P extends ConfigContents>(contents: P, timestamp?: bigint) => LWWState<P>;
export declare class LWWMap<P extends ConfigContents> {
#private;
constructor(state?: LWWState<P>);
get value(): P;
get state(): LWWState<P>;
merge(state: LWWState<P>): LWWState<P>;
set<K extends Key<P>>(key: K, value: P[K]): void;
get<K extends Key<P>>(key: K): P[K] | undefined;
delete<K extends Key<P>>(key: K): void;
has(key: string): boolean;
}