nl_tokens: Create a Firebase batch from a syncStack to be passed inside the state param .
pl_tokens: function makeBatchFromSyncstack ( state , getters , Firebase , batchMaxCount ) { if ( batchMaxCount === void 0 ) { batchMaxCount = 500 ; } // get state & getter variables var firestorePath = state . _conf . firestorePath ; var firestorePathComplete = getters . firestorePathComplete ; var dbRef = getters . dbRef ; var collectionMode = getters . collectionMode ; // make batch var batch = Firebase . firestore ( ) . batch ( ) ; var log = { } ; var count = 0 ; // Add 'updates' to batch var updates = grabUntilApiLimit ( 'updates' , count , batchMaxCount , state ) ; log [ 'updates: ' ] = updates ; count = count + updates . length ; // Add to batch updates . forEach ( function ( item ) { var id = item . id ; var docRef = ( collectionMode ) ? dbRef . doc ( id ) : dbRef ; if ( state . _conf . sync . guard . includes ( 'id' ) ) delete item . id ; // @ts-ignore batch . update ( docRef , item ) ; } ) ; // Add 'propDeletions' to batch var propDeletions = grabUntilApiLimit ( 'propDeletions' , count , batchMaxCount , state ) ; log [ 'prop deletions: ' ] = propDeletions ; count = count + propDeletions . length ; // Add to batch propDeletions . forEach ( function ( <mask> ) { var id = item . id ; var docRef = ( collectionMode ) ? dbRef . doc ( id ) : dbRef ; if ( state . _conf . sync . guard . includes ( 'id' ) ) delete item . id ; // @ts-ignore batch . update ( docRef , item ) ; } ) ; // Add 'deletions' to batch var deletions = grabUntilApiLimit ( 'deletions' , count , batchMaxCount , state ) ; log [ 'deletions: ' ] = deletions ; count = count + deletions . length ; // Add to batch deletions . forEach ( function ( id ) { var docRef = dbRef . doc ( id ) ; batch . delete ( docRef ) ; } ) ; // Add 'inserts' to batch var inserts = grabUntilApiLimit ( 'inserts' , count , batchMaxCount , state ) ; log [ 'inserts: ' ] = inserts ; count = count + inserts . length ; // Add to batch inserts . forEach ( function ( item ) { var newRef = dbRef . doc ( item . id ) ; batch . set ( newRef , item ) ; } ) ; // log the batch contents if ( state . _conf . logging ) { console . group ( '[vuex-easy-firestore] api call batch:' ) ; console . log ( "%cFirestore PATH: " + firestorePathComplete + " [" + firestorePath + "]" , 'color: grey' ) ; Object . keys ( log ) . forEach ( function ( key ) { console . log ( key , log [ key ] ) ; } ) ; console . groupEnd ( ) ; } return batch ; }