function postProcessAttachments(results, asBlob) {
  return PouchPromise$1.all(results.map(function (row) {
    if (row.doc && row.doc._attachments) {
      var attNames = Object.keys(row.doc._attachments);
      return PouchPromise$1.all(attNames.map(function (att) {
        var attObj = row.doc._attachments[att];
        if (!('body' in attObj)) { // already processed
          return;
        }
        var body = attObj.body;
        var type = attObj.content_type;
        return new PouchPromise$1(function (resolve) {
          readBlobData(body, type, asBlob, function (data) {
            row.doc._attachments[att] = $inject_Object_assign(
              pick(attObj, ['digest', 'content_type']),
              {data: data}
            );
            resolve();
          });
        });
      }));
    }
  }));
}
// needs to be read outside of the transaction context
needs to be read outside of the transaction context
needs to be read outside of the transaction context
function postProcessAttachments(results, asBlob) {
  return PouchPromise$1.all(results.map(function (row) {
    if (row.doc && row.doc._attachments) {
      var attNames = Object.keys(row.doc._attachments);
      return PouchPromise$1.all(attNames.map(function (att) {
        var attObj = row.doc._attachments[att];
        if (!('body' in attObj)) { 
          return;
        }
        var body = attObj.body;
        var type = attObj.content_type;
        return new PouchPromise$1(function (resolve) {
          readBlobData(body, type, asBlob, function (data) {
            row.doc._attachments[att] = $inject_Object_assign(
              pick(attObj, ['digest', 'content_type']),
              {data: data}
            );
            resolve();
          });
        });
      }));
    }
  }));
}
function postProcessAttachments ( results , asBlob ) { return PouchPromise$1 . all ( results . map ( function ( row ) { if ( row . doc && row . doc . _attachments ) { var attNames = Object . keys ( row . doc . _attachments ) ; return PouchPromise$1 . all ( attNames . map ( function ( att ) { var attObj = row . doc . _attachments [ att ] ; if ( ! ( 'body' in attObj ) ) { return ; } var body = attObj . body ; var type = attObj . content_type ; return new PouchPromise$1 ( function ( resolve ) { readBlobData ( body , type , asBlob , function ( data ) { row . doc . _attachments [ att ] = $inject_Object_assign ( pick ( attObj , [ 'digest' , 'content_type' ] ) , { data : data } ) ; resolve ( ) ; } ) ; } ) ; } ) ) ; } } ) ) ; }
needs to be read outside of the transaction context
needs to be read outside of the transaction context
// already processed