@orbit/records
Version:
A flexible data access and synchronization layer.
31 lines (30 loc) • 968 B
TypeScript
import { Dict } from '@orbit/utils';
import { InitializedRecord, UninitializedRecord } from './record';
/**
* Maintains a map between records' ids and keys.
*/
export declare class RecordKeyMap {
private _idsToKeys;
private _keysToIds;
constructor();
/**
* Resets the contents of the key map.
*/
reset(): void;
/**
* Return a key value given a model type, key name, and id.
*/
idToKey(type: string, keyName: string, idValue: string): string | undefined;
/**
* Return an id value given a model type, key name, and key value.
*/
keyToId(type: string, keyName: string, keyValue: string): string | undefined;
/**
* Store the id and key values of a record in this key map.
*/
pushRecord(record: InitializedRecord | UninitializedRecord): void;
/**
* Given a record, find the cached id if it exists.
*/
idFromKeys(type: string, keys: Dict<string>): string | undefined;
}