UNPKG

ntt-flow

Version:

The sequence of initialization, modification, aggregation, or other processes through which a data entity passes from instantiation to persistence.

19 lines (18 loc) 1.02 kB
declare namespace ntt { type KeyArray = Array<KeyType>; type KeyType = number | string; type EntityModel<T extends FlatObject, K extends keyof T> = Omit<T, K>; type EntityKey<T extends FlatObject, K extends keyof T> = Pick<T, K>; type PropertyType<T extends SimpleObject, K extends keyof T, P extends T[K]> = P; type ComplexPropertyType<T extends SimpleObject, K extends keyof T, P extends FlatObject & T[K]> = P; type ValuePropertyType<T extends SimpleObject, K extends keyof T, P extends ValueType & T[K]> = P; interface IStore<T extends SimpleObject, K extends keyof T> { scope: 'global' | 'individual' | 'network' | 'organization' | 'region'; target: string; create: (model: T) => Promise<boolean>; destroy: (key: Pick<T, K>) => Promise<boolean>; discard: (key: Pick<T, K>) => Promise<boolean>; retrieve: (key: Pick<T, K>) => Promise<T>; update: (model: Partial<T>, key: Pick<T, K>) => Promise<T>; } }