@@ -113,24 +113,37 @@ export interface Visit {
113
113
creating ?: boolean ;
114
114
}
115
115
116
+ /** Used in denormalize. Lookup to find an entity in the store table */
117
+ export interface EntityPath {
118
+ key : string ;
119
+ pk : string ;
120
+ }
121
+
122
+ export type IndexPath = [ key : string , index : string , value : string ] ;
123
+ export type EntitiesPath = [ key : string ] ;
124
+
116
125
/** Returns true if a circular reference is found */
117
126
export interface CheckLoop {
118
127
( entityKey : string , pk : string , input : object ) : boolean ;
119
128
}
120
129
121
- /** Get Array of entities with map function applied */
130
+ /** Get all normalized entities of one type from store */
131
+ export interface GetEntities {
132
+ ( key : string ) : { readonly [ pk : string ] : any } | undefined ;
133
+ }
134
+ /** Get normalized Entity from store */
122
135
export interface GetEntity {
123
- ( entityKey : string | symbol ) : { readonly [ pk : string ] : any } | undefined ;
124
- ( entityKey : string | symbol , pk : string | number ) : any ;
136
+ ( key : string , pk : string ) : any ;
125
137
}
126
138
/** Get PK using an Entity Index */
127
139
export interface GetIndex {
128
140
/** getIndex('User', 'username', 'ntucker') */
129
- ( entityKey : string , field : string , value : string ) : string | undefined ;
141
+ ( ... path : IndexPath ) : string | undefined ;
130
142
}
131
143
132
144
/** Accessors to the currently processing state while building query */
133
145
export interface IQueryDelegate {
146
+ getEntities : GetEntities ;
134
147
getEntity : GetEntity ;
135
148
getIndex : GetIndex ;
136
149
/** Return to consider results invalid */
@@ -141,6 +154,8 @@ export interface IQueryDelegate {
141
154
export interface INormalizeDelegate {
142
155
/** Action meta-data for this normalize call */
143
156
readonly meta : { fetchedAt : number ; date : number ; expiresAt : number } ;
157
+ /** Get all normalized entities of one type from store */
158
+ getEntities : GetEntities ;
144
159
/** Gets any previously normalized entity from store */
145
160
getEntity : GetEntity ;
146
161
/** Updates an entity using merge lifecycles when it has previously been set */
0 commit comments