import { IDbRecord, OmittedEntity, IDbRecordBase, IRemovalRecord } from "./entity-types"; export type DeepOmit = { [P in keyof T as P extends K ? never : P]: DeepOmit}.${infer R}` ? R : never>; }; export type DeepKeyOf = { [Key in keyof T & (string | number)]: T[Key] extends object ? `${Key}` | `${Key}.${DeepKeyOf}` : `${Key}`; }[keyof T & (string | number)]; export type DocumentKeySelector = (entity: T) => any; export type KeyOf = keyof T | DocumentKeySelector; export type IdKeys = KeyOf[]; export type IdKey = KeyOf; export type DeepPartial = T extends object ? { [P in keyof T]?: DeepPartial; } : T; export type DbSetActionDictionaryOptional = DbSetActionDictionaryRequired | { add: T; } | { retrieve: T; }; export type DbSetActionDictionaryRequired = { add: T; retrieve: T; }; export type DbSetPickDefaultActionOptional> = DbSetActionDictionaryOptional>>; export type DbSetPickDefaultActionRequired> = DbSetActionDictionaryRequired>>; export type EntitySelector> = (entity: TEntity, index?: number, array?: TEntity[]) => boolean; export interface IQueryParams { documentType?: TDocumentType; index?: string; } export type PouchDbLinkProtocol = "pouchdb://"; export type PouchDbReference = `${PouchDbLinkProtocol}${string}/_id:${string}`; export interface IBulkDocsResponse { ok: boolean; id: string; rev: string; error?: string; } export interface IPurgeResponse { doc_count: number; loss_count: number; } export type DeepReadOnly = { readonly [key in keyof T]: DeepReadOnly; }; export interface IPreviewChanges { add: IDbRecordBase[]; remove: IRemovalRecord[]; update: IDbRecordBase[]; } export interface DocumentReference { databaseName: string; selector: { property: string; value: string; }; }