@@ -67,16 +67,16 @@ export interface QueryOptions {
6767 useIndex ?: string ;
6868}
6969
70- // TODO: exception to the rule of returning a Result shape.
71- // TODO: This will change to be just a regular result in a major version
72- export type HyperGetResult < Type extends Obj = Obj > = Type | NotOkResult ;
70+ export type HyperGetDocResult < Type extends Obj = Obj > =
71+ | ( OkResult & { doc : Type } )
72+ | NotOkResult ;
7373
7474export type HyperDocsResult < Type extends Obj = Obj > =
7575 | ( OkResult & { docs : Type [ ] } )
7676 | NotOkResult ;
7777export interface HyperData {
7878 add : < Type extends Obj = Obj > ( doc : Type ) => Promise < IdResult > ;
79- get : < Type extends Obj = Obj > ( id : string ) => Promise < HyperGetResult < Type > > ;
79+ get : < Type extends Obj = Obj > ( id : string ) => Promise < HyperGetDocResult < Type > > ;
8080 list : < Type extends Obj = Obj > (
8181 options ?: ListOptions ,
8282 ) => Promise < HyperDocsResult < Type > > ;
@@ -100,7 +100,9 @@ export interface HyperCache {
100100 value : Type ,
101101 ttl ?: string ,
102102 ) => Promise < Result > ;
103- get : < Type extends Obj = Obj > ( key : string ) => Promise < HyperGetResult < Type > > ;
103+ get : < Type extends Obj = Obj > (
104+ key : string ,
105+ ) => Promise < HyperGetDocResult < Type > > ;
104106 remove : ( key : string ) => Promise < Result > ;
105107 set : < Type extends Obj = Obj > (
106108 key : string ,
@@ -123,7 +125,9 @@ export type HyperSearchLoadResult<Type extends Obj = Obj> =
123125export interface HyperSearch {
124126 add : < Type extends Obj = Obj > ( key : string , doc : Type ) => Promise < Result > ;
125127 remove : ( key : string ) => Promise < Result > ;
126- get : < Type extends Obj = Obj > ( key : string ) => Promise < HyperGetResult < Type > > ;
128+ get : < Type extends Obj = Obj > (
129+ key : string ,
130+ ) => Promise < ( OkResult & { key : string ; doc : Type } ) | NotOkResult > ;
127131 update : < Type extends Obj = Obj > ( key : string , doc : Type ) => Promise < Result > ;
128132 query : < Type extends Obj = Obj > (
129133 query : string ,
0 commit comments