Compare commits

..

No commits in common. "5c7d74c7617594ea5f527dba8267b64afd9eadef" and "0d4bf3c17fd9f00e6dedcb7fa486e850624de978" have entirely different histories.

1 changed files with 4 additions and 10 deletions

View File

@ -13,9 +13,6 @@ 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();
@ -30,22 +27,21 @@ 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) {
console.log('PROCESSING I');
if (itemObj.op === 'i' &&
itemObj.o && itemObj.o._id) {
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) {
console.log('PROCESSING U');
} else if (itemObj.op === 'u' &&
itemObj.o && itemObj.o2 && itemObj.o2._id) {
entry = {
type: 'put', // updates overwrite the whole metadata,
// so they are considered as puts
@ -58,14 +54,12 @@ 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();