@omegup/msync 0.0.90 → 0.0.92

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 -9
  2. package/index.js +10 -9
  3. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -1546,19 +1546,19 @@ 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
  },
1553
1560
  });
1554
- pipeline.push({
1555
- $project: {
1556
- _id: 1,
1557
- },
1558
- });
1559
- const stream = db
1560
- .collection(collection.collectionName)
1561
- .watch(pipeline, {
1561
+ const stream = db.collection(collection.collectionName).watch(pipeline, {
1562
1562
  fullDocument: 'required',
1563
1563
  fullDocumentBeforeChange: 'required',
1564
1564
  startAtOperationTime: startAt,
@@ -1694,6 +1694,7 @@ const executes$2 = (view, input, streamName, skip = false, after) => {
1694
1694
  log('teardown done', `db['${snapshotCollection.collectionName}'].drop()`, ...out);
1695
1695
  };
1696
1696
  if (!same) {
1697
+ log('not same, new data', data);
1697
1698
  await handleTeardown(exists ?? { data });
1698
1699
  }
1699
1700
  await after?.();
package/index.js CHANGED
@@ -1548,19 +1548,19 @@ 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
  },
1555
1562
  });
1556
- pipeline.push({
1557
- $project: {
1558
- _id: 1,
1559
- },
1560
- });
1561
- const stream = db
1562
- .collection(collection.collectionName)
1563
- .watch(pipeline, {
1563
+ const stream = db.collection(collection.collectionName).watch(pipeline, {
1564
1564
  fullDocument: 'required',
1565
1565
  fullDocumentBeforeChange: 'required',
1566
1566
  startAtOperationTime: startAt,
@@ -1696,6 +1696,7 @@ const executes$2 = (view, input, streamName, skip = false, after) => {
1696
1696
  log('teardown done', `db['${snapshotCollection.collectionName}'].drop()`, ...out);
1697
1697
  };
1698
1698
  if (!same) {
1699
+ log('not same, new data', data);
1699
1700
  await handleTeardown(exists ?? { data });
1700
1701
  }
1701
1702
  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.92",
7
7
  "dependencies": {
8
8
  "dayjs": "^1.11.9",
9
9
  "dotenv": "^16.3.1",