@omegup/msync 0.0.43 → 0.0.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -1122,6 +1122,7 @@ const createIndex = async (collection, indexSpec, options) => {
1122
1122
  await new Promise(res => setTimeout(res, 300));
1123
1123
  continue;
1124
1124
  }
1125
+ console.error('Error creating index', e);
1125
1126
  throw e;
1126
1127
  }
1127
1128
  break;
@@ -1419,7 +1420,7 @@ const addTeardown = (it, tr) => {
1419
1420
 
1420
1421
  const changeKeys = ['fullDocument', 'fullDocumentBeforeChange'];
1421
1422
  const subQ = (a, f) => ({ raw: g => a.raw(g.with(f)) });
1422
- const makeWatchStream = (db, { collection, projection: p, hardMatch: m }, startAt) => {
1423
+ const makeWatchStream = (db, { collection, projection: p, hardMatch: m }, startAt, streamName) => {
1423
1424
  const projection = { ...mapExactToObject(p, v => v), deletedAt: 1 };
1424
1425
  const pipeline = [];
1425
1426
  if (m) {
@@ -1461,7 +1462,7 @@ const makeWatchStream = (db, { collection, projection: p, hardMatch: m }, startA
1461
1462
  if (doc)
1462
1463
  await new Promise(resolve => setTimeout(resolve, 100));
1463
1464
  if (doc)
1464
- log$1('detected', collection.collectionName, doc);
1465
+ log$1('detected', streamName, collection.collectionName, doc);
1465
1466
  return doc;
1466
1467
  };
1467
1468
  return { tryNext, close: () => stream.close() };
@@ -1589,7 +1590,7 @@ const executes$1 = (view, input, streamName) => {
1589
1590
  await snapshotCollection.deleteMany({ updated: true, after: null, before: null });
1590
1591
  return next(step4({ result: r, ts: lastTS?.ts }), 'run the aggregation');
1591
1592
  };
1592
- const makeStream = (startAt) => makeWatchStream(db, view, startAt);
1593
+ const makeStream = (startAt) => makeWatchStream(db, view, startAt, streamName);
1593
1594
  const step4 = ({ result, ts }) => async () => {
1594
1595
  const start = Date.now();
1595
1596
  await snapshotCollection.updateMany({ before: null }, { $set: { before: null } });
@@ -1724,7 +1725,7 @@ const executes = (view, input, streamName) => {
1724
1725
  await handleTeardown(exists);
1725
1726
  return next(step4(same), 'clone into new collection');
1726
1727
  };
1727
- const makeStream = (startAt) => makeWatchStream(db, view, startAt);
1728
+ const makeStream = (startAt) => makeWatchStream(db, view, startAt, streamName);
1728
1729
  const step4 = (lastTS) => async () => {
1729
1730
  const hardQuery = $and(lastTS && root().of('touchedAt').has($gteTs(lastTS.ts)), hardMatch, notDeleted, match && $expr(match));
1730
1731
  const aggResult = await aggregate(c => c({
package/index.js CHANGED
@@ -1124,6 +1124,7 @@ const createIndex = async (collection, indexSpec, options) => {
1124
1124
  await new Promise(res => setTimeout(res, 300));
1125
1125
  continue;
1126
1126
  }
1127
+ console.error('Error creating index', e);
1127
1128
  throw e;
1128
1129
  }
1129
1130
  break;
@@ -1421,7 +1422,7 @@ const addTeardown = (it, tr) => {
1421
1422
 
1422
1423
  const changeKeys = ['fullDocument', 'fullDocumentBeforeChange'];
1423
1424
  const subQ = (a, f) => ({ raw: g => a.raw(g.with(f)) });
1424
- const makeWatchStream = (db, { collection, projection: p, hardMatch: m }, startAt) => {
1425
+ const makeWatchStream = (db, { collection, projection: p, hardMatch: m }, startAt, streamName) => {
1425
1426
  const projection = { ...mapExactToObject(p, v => v), deletedAt: 1 };
1426
1427
  const pipeline = [];
1427
1428
  if (m) {
@@ -1463,7 +1464,7 @@ const makeWatchStream = (db, { collection, projection: p, hardMatch: m }, startA
1463
1464
  if (doc)
1464
1465
  await new Promise(resolve => setTimeout(resolve, 100));
1465
1466
  if (doc)
1466
- console$1.log('detected', collection.collectionName, doc);
1467
+ console$1.log('detected', streamName, collection.collectionName, doc);
1467
1468
  return doc;
1468
1469
  };
1469
1470
  return { tryNext, close: () => stream.close() };
@@ -1591,7 +1592,7 @@ const executes$1 = (view, input, streamName) => {
1591
1592
  await snapshotCollection.deleteMany({ updated: true, after: null, before: null });
1592
1593
  return next(step4({ result: r, ts: lastTS?.ts }), 'run the aggregation');
1593
1594
  };
1594
- const makeStream = (startAt) => makeWatchStream(db, view, startAt);
1595
+ const makeStream = (startAt) => makeWatchStream(db, view, startAt, streamName);
1595
1596
  const step4 = ({ result, ts }) => async () => {
1596
1597
  const start = Date.now();
1597
1598
  await snapshotCollection.updateMany({ before: null }, { $set: { before: null } });
@@ -1726,7 +1727,7 @@ const executes = (view, input, streamName) => {
1726
1727
  await handleTeardown(exists);
1727
1728
  return next(step4(same), 'clone into new collection');
1728
1729
  };
1729
- const makeStream = (startAt) => makeWatchStream(db, view, startAt);
1730
+ const makeStream = (startAt) => makeWatchStream(db, view, startAt, streamName);
1730
1731
  const step4 = (lastTS) => async () => {
1731
1732
  const hardQuery = $and(lastTS && root().of('touchedAt').has($gteTs(lastTS.ts)), hardMatch, notDeleted, match && $expr(match));
1732
1733
  const aggResult = await aggregate(c => c({
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "module": "index.esm.js",
4
4
  "typings": "index.d.ts",
5
5
  "name": "@omegup/msync",
6
- "version": "0.0.43",
6
+ "version": "0.0.45",
7
7
  "dependencies": {
8
8
  "dayjs": "^1.11.9",
9
9
  "dotenv": "^16.3.1",