Compare commits

...

6 Commits

Author SHA1 Message Date
Rahul Padigela 5c7d74c761 fix console log 2018-09-25 18:47:18 -04:00
Rahul Padigela 00d0da31ca log less 2018-09-25 18:47:18 -04:00
Rahul Padigela af31b17248 console log more logs 2018-09-25 18:47:18 -04:00
Rahul Padigela 899bb4caf0 console log skip 2018-09-25 18:47:18 -04:00
Rahul Padigela 61e0b44b75 console log i 2018-09-25 18:47:18 -04:00
Rahul Padigela a732061d0b log skipped entry 2018-09-25 18:47:18 -04:00
1 changed files with 10 additions and 4 deletions

View File

@ -13,6 +13,9 @@ class ListRecordStream extends stream.Transform {
}
_transform(itemObj, encoding, callback) {
if (itemObj && itemObj.o && itemObj.o._id) {
console.log('ITEM OBJ', itemObj.o._id);
}
// always update to most recent uniqID
this._lastUniqID = itemObj.h.toString();
@ -27,21 +30,22 @@ class ListRecordStream extends stream.Transform {
if (!this._lastEndID || this._lastEndID === itemObj.h.toString()) {
this._unpublishedListing = true;
}
console.log('SKIPPING EARLY');
return callback();
}
const dbName = itemObj.ns.split('.');
let entry;
if (itemObj.op === 'i' &&
itemObj.o && itemObj.o._id) {
if (itemObj.op === 'i' && itemObj.o && itemObj.o._id) {
console.log('PROCESSING I');
entry = {
type: 'put',
key: itemObj.o._id,
// value is given as-is for inserts
value: JSON.stringify(itemObj.o.value),
};
} else if (itemObj.op === 'u' &&
itemObj.o && itemObj.o2 && itemObj.o2._id) {
} else if (itemObj.op === 'u' && itemObj.o && itemObj.o2 && itemObj.o2._id) {
console.log('PROCESSING U');
entry = {
type: 'put', // updates overwrite the whole metadata,
// so they are considered as puts
@ -54,12 +58,14 @@ class ListRecordStream extends stream.Transform {
};
} else if (itemObj.op === 'd' &&
itemObj.o && itemObj.o._id) {
console.log('PROCESSING D');
entry = {
type: 'delete',
key: itemObj.o._id,
// deletion yields no value
};
} else {
console.log('SKIPPED ENTRY');
// skip other entry types as we don't need them for now
// ('c', ...?)
return callback();