@@ -167,6 +167,8 @@ export function resultWrapper(result) {
167167 result . entry = Result ( result . entry ) ;
168168 } else if ( result && typeof result . asset !== 'undefined' ) {
169169 result . asset = Result ( result . asset ) ;
170+ } else if ( result && typeof result . items !== 'undefined' ) {
171+ result . items = Result ( result . items ) . toJSON ( ) ;
170172 }
171173
172174 return result ;
@@ -182,11 +184,13 @@ export function spreadResult(result) {
182184 if ( typeof result . count !== 'undefined' ) _results . push ( result . count ) ;
183185 if ( typeof result . entry !== 'undefined' ) _results = result . entry ;
184186 if ( typeof result . asset !== 'undefined' ) _results = result . asset ;
187+ if ( typeof result . items !== 'undefined' ) _results . push ( result ) ;
185188 }
186189 return _results ;
187190} ;
188191
189192export function sendRequest ( queryObject ) {
193+
190194 let env_uid = queryObject . environment_uid ;
191195 if ( env_uid ) {
192196 queryObject . _query . environment_uid = env_uid ;
@@ -240,6 +244,7 @@ export function sendRequest(queryObject) {
240244 try {
241245 self . entry_uid = self . asset_uid = self . tojson = self . queryCachePolicy = undefined ;
242246 let entries = { } ;
247+ let syncstack = { } ;
243248 if ( queryObject . singleEntry ) {
244249 queryObject . singleEntry = false ;
245250 if ( data . schema ) entries . schema = data . schema ;
@@ -259,9 +264,18 @@ export function sendRequest(queryObject) {
259264 }
260265 return ;
261266 }
267+ }
268+ else if ( data . items ) {
269+ syncstack = {
270+ items : data . items ,
271+ pagination_token : data . pagination_token ,
272+ sync_token : data . sync_token ,
273+ total_count : data . total_count
274+ }
262275 } else {
263276 entries = data ;
264277 }
278+
265279 if ( cachePolicy !== - 1 ) {
266280 self . provider . set ( hashQuery , entries , function ( err ) {
267281 try {
@@ -273,10 +287,16 @@ export function sendRequest(queryObject) {
273287 }
274288 } ) ;
275289 return resolve ( spreadResult ( entries ) ) ;
276- } else {
277- if ( ! tojson ) entries = resultWrapper ( entries ) ;
278- return resolve ( spreadResult ( entries ) ) ;
290+ }
291+
292+ if ( Object . keys ( syncstack ) . length ) {
293+ return resolve ( syncstack ) ;
279294 }
295+
296+ if ( ! tojson )
297+ entries = resultWrapper ( entries ) ;
298+ return resolve ( spreadResult ( entries ) ) ;
299+
280300 } catch ( e ) {
281301 return reject ( {
282302 message : e . message
0 commit comments