@omegup/msync 0.0.90 → 0.0.91

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.
Files changed (3) hide show
  1. package/index.esm.js +10 -4
  2. package/index.js +10 -4
  3. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -1546,7 +1546,14 @@ const makeWatchStream = (db, { collection, projection: p, hardMatch: m }, startA
1546
1546
  pipeline.push({
1547
1547
  $match: {
1548
1548
  $or: [
1549
- { $expr: { $ne: ['$fullDocument', '$fullDocumentBeforeChange'] } },
1549
+ {
1550
+ $expr: {
1551
+ $ne: [
1552
+ { $mergeObjects: ['$fullDocument', { touchedAt: null }] },
1553
+ { $mergeObjects: ['$fullDocumentBeforeChange', { touchedAt: null }] },
1554
+ ],
1555
+ },
1556
+ },
1550
1557
  Object.fromEntries(changeKeys.map(k => [k, null])),
1551
1558
  ],
1552
1559
  },
@@ -1556,9 +1563,7 @@ const makeWatchStream = (db, { collection, projection: p, hardMatch: m }, startA
1556
1563
  _id: 1,
1557
1564
  },
1558
1565
  });
1559
- const stream = db
1560
- .collection(collection.collectionName)
1561
- .watch(pipeline, {
1566
+ const stream = db.collection(collection.collectionName).watch(pipeline, {
1562
1567
  fullDocument: 'required',
1563
1568
  fullDocumentBeforeChange: 'required',
1564
1569
  startAtOperationTime: startAt,
@@ -1694,6 +1699,7 @@ const executes$2 = (view, input, streamName, skip = false, after) => {
1694
1699
  log('teardown done', `db['${snapshotCollection.collectionName}'].drop()`, ...out);
1695
1700
  };
1696
1701
  if (!same) {
1702
+ log('not same, new data', data);
1697
1703
  await handleTeardown(exists ?? { data });
1698
1704
  }
1699
1705
  await after?.();
package/index.js CHANGED
@@ -1548,7 +1548,14 @@ const makeWatchStream = (db, { collection, projection: p, hardMatch: m }, startA
1548
1548
  pipeline.push({
1549
1549
  $match: {
1550
1550
  $or: [
1551
- { $expr: { $ne: ['$fullDocument', '$fullDocumentBeforeChange'] } },
1551
+ {
1552
+ $expr: {
1553
+ $ne: [
1554
+ { $mergeObjects: ['$fullDocument', { touchedAt: null }] },
1555
+ { $mergeObjects: ['$fullDocumentBeforeChange', { touchedAt: null }] },
1556
+ ],
1557
+ },
1558
+ },
1552
1559
  Object.fromEntries(changeKeys.map(k => [k, null])),
1553
1560
  ],
1554
1561
  },
@@ -1558,9 +1565,7 @@ const makeWatchStream = (db, { collection, projection: p, hardMatch: m }, startA
1558
1565
  _id: 1,
1559
1566
  },
1560
1567
  });
1561
- const stream = db
1562
- .collection(collection.collectionName)
1563
- .watch(pipeline, {
1568
+ const stream = db.collection(collection.collectionName).watch(pipeline, {
1564
1569
  fullDocument: 'required',
1565
1570
  fullDocumentBeforeChange: 'required',
1566
1571
  startAtOperationTime: startAt,
@@ -1696,6 +1701,7 @@ const executes$2 = (view, input, streamName, skip = false, after) => {
1696
1701
  log('teardown done', `db['${snapshotCollection.collectionName}'].drop()`, ...out);
1697
1702
  };
1698
1703
  if (!same) {
1704
+ log('not same, new data', data);
1699
1705
  await handleTeardown(exists ?? { data });
1700
1706
  }
1701
1707
  await after?.();
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.90",
6
+ "version": "0.0.91",
7
7
  "dependencies": {
8
8
  "dayjs": "^1.11.9",
9
9
  "dotenv": "^16.3.1",