Interface LoginStorage<T> interface LoginStorage < T > { create : ( < TType > ( type : TType ,
value : CreateTypeObject < T [ TType ] > ) => Promise < TypeObject < T [ TType ] > > ) ; createIndex : ( < TType > ( type : TType ,
key : StringKey < T [ TType ] > ) => Promise < void > ) ; defineType : ( < TType > ( type : TType ,
description : T [ TType ] ,
isLogin : boolean ) => Promise < void > ) ; delete : ( < TType > ( type : TType ,
id : string ) => Promise < void > ) ; entries : ( < TType > ( type : TType ) => AsyncIterableIterator < TypeObject < T [ TType ] > > ) ; find : ( < TType > ( type : TType ,
query : { [ K in string | number | symbol ] ?: ValueType < T [ TType ] [ K ] > | ( T [ TType ] [ K ] extends ` id: ${ U } ` ? { [ K in string | number | symbol ] ?: ( ValueType<T[U][K]> | (T[U][K] extends `id:${infer U}` ? { [K in "id" | keyof T[U]]?: ValueType<T[U][K]> | (T[U][K] extends `id:${infer U}` ? { [K in "id" | keyof T[U]]?: ValueType<...> | ... 1 more ... | undefined; } : never) | undefined; } : never) | undefined
) } : never ) } ) => Promise < TypeObject < T [ TType ] > [] > ) ; findIds : ( < TType > ( type : TType ,
query : { [ K in string | number | symbol ] ?: ValueType < T [ TType ] [ K ] > | ( T [ TType ] [ K ] extends ` id: ${ U } ` ? { [ K in string | number | symbol ] ?: ( ValueType<T[U][K]> | (T[U][K] extends `id:${infer U}` ? { [K in "id" | keyof T[U]]?: ValueType<T[U][K]> | (T[U][K] extends `id:${infer U}` ? { [K in "id" | keyof T[U]]?: ValueType<...> | ... 1 more ... | undefined; } : never) | undefined; } : never) | undefined
) } : never ) } ) => Promise < string [] > ) ; get : ( < TType > ( type : TType ,
id : string ) => Promise < undefined | TypeObject < T [ TType ] > > ) ; has : ( < TType > ( type : TType ,
id : string ) => Promise < boolean > ) ; set : ( < TType > ( type : TType ,
value : TypeObject < T [ TType ] > ) => Promise < void > ) ; setField : ( < TType , TKey > ( type : TType ,
id : string ,
key : TKey ,
value : ValueType < T [ TType ] [ TKey ] > ) => Promise < void > ) ; } Propertiescreate Index Type declaration < TType > ( type , key ) : Promise < void > Returns Promise < void > define Type define Type : ( < TType > ( type : TType ,
description : T [ TType ] ,
isLogin : boolean ) => Promise < void > ) Type declaration < TType > ( type , description , isLogin ) : Promise < void > Returns Promise < void > delete delete : ( < TType > ( type : TType ,
id : string ) => Promise < void > ) Type declaration < TType > ( type , id ) : Promise < void > Returns Promise < void > find find : ( < TType > ( type : TType ,
query : { [ K in string | number | symbol ] ?: ValueType < T [ TType ] [ K ] > | ( T [ TType ] [ K ] extends ` id: ${ U } ` ? { [ K in string | number | symbol ] ?: ( ValueType<T[U][K]> | (T[U][K] extends `id:${infer U}` ? { [K in "id" | keyof T[U]]?: ValueType<T[U][K]> | (T[U][K] extends `id:${infer U}` ? { [K in "id" | keyof T[U]]?: ValueType<...> | ... 1 more ... | undefined; } : never) | undefined; } : never) | undefined
) } : never ) } ) => Promise < TypeObject < T [ TType ] > [] > ) find Ids find Ids : ( < TType > ( type : TType ,
query : { [ K in string | number | symbol ] ?: ValueType < T [ TType ] [ K ] > | ( T [ TType ] [ K ] extends ` id: ${ U } ` ? { [ K in string | number | symbol ] ?: ( ValueType<T[U][K]> | (T[U][K] extends `id:${infer U}` ? { [K in "id" | keyof T[U]]?: ValueType<T[U][K]> | (T[U][K] extends `id:${infer U}` ? { [K in "id" | keyof T[U]]?: ValueType<...> | ... 1 more ... | undefined; } : never) | undefined; } : never) | undefined
) } : never ) } ) => Promise < string [] > ) has has : ( < TType > ( type : TType ,
id : string ) => Promise < boolean > ) set Type declaration < TType > ( type , value ) : Promise < void > Returns Promise < void > set Field Type declaration < TType , TKey > ( type , id , key , value ) : Promise < void > Type Parameters TType extends string TKey extends string Returns Promise < void >
A IndexedStorage where the
defineType
function takes an extra parameter to indicate if the type corresponds to a login method. This is useful for storages that want to add extra requirements based on the data being edited.In practice, we use this because we want to require accounts to have at least 1 login method.