@omegup/msync 0.0.6 → 0.0.7
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 +44 -36
- package/index.js +44 -36
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -715,45 +715,53 @@ const $unwindDelta = (k1, k2, k) => {
|
|
|
715
715
|
.with(asStages([
|
|
716
716
|
{
|
|
717
717
|
$replaceWith: {
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
718
|
+
$let: {
|
|
719
|
+
vars: {
|
|
720
|
+
beforeId: {
|
|
721
|
+
$concat: k
|
|
722
|
+
? `$${k}.before._id`
|
|
723
|
+
: [
|
|
724
|
+
`$${[k1, k2].sort()[0]}.before._id`,
|
|
725
|
+
'.',
|
|
726
|
+
`$${[k1, k2].sort()[1]}.before._id`,
|
|
727
|
+
],
|
|
728
|
+
},
|
|
729
|
+
afterId: {
|
|
730
|
+
$concat: k
|
|
731
|
+
? `$${k}.after._id`
|
|
732
|
+
: [
|
|
733
|
+
`$${[k1, k2].sort()[0]}.after._id`,
|
|
734
|
+
'.',
|
|
735
|
+
`$${[k1, k2].sort()[1]}.after._id`,
|
|
736
|
+
],
|
|
735
737
|
},
|
|
736
738
|
},
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
:
|
|
747
|
-
|
|
748
|
-
'.',
|
|
749
|
-
`$${[k1, k2].sort()[1]}.after._id`,
|
|
750
|
-
],
|
|
739
|
+
in: {
|
|
740
|
+
_id: { $ifNull: ['$$afterId', '$$beforeId'] },
|
|
741
|
+
before: {
|
|
742
|
+
$cond: {
|
|
743
|
+
if: { $or: [{ $eq: [`$${k1}.before`, null] }, { $eq: [`$${k2}.before`, null] }] },
|
|
744
|
+
then: null,
|
|
745
|
+
else: {
|
|
746
|
+
_id: '$$beforeId',
|
|
747
|
+
[k1]: `$${k1}.before`,
|
|
748
|
+
[k2]: `$${k2}.before`,
|
|
749
|
+
},
|
|
751
750
|
},
|
|
752
|
-
[k1]: `$${k1}.after`,
|
|
753
|
-
[k2]: `$${k2}.after`,
|
|
754
751
|
},
|
|
755
|
-
|
|
756
|
-
|
|
752
|
+
after: {
|
|
753
|
+
$cond: {
|
|
754
|
+
if: { $or: [{ $eq: [`$${k1}.after`, null] }, { $eq: [`$${k2}.after`, null] }] },
|
|
755
|
+
then: null,
|
|
756
|
+
else: {
|
|
757
|
+
_id: '$$afterId',
|
|
758
|
+
[k1]: `$${k1}.after`,
|
|
759
|
+
[k2]: `$${k2}.after`,
|
|
760
|
+
},
|
|
761
|
+
},
|
|
762
|
+
},
|
|
763
|
+
}
|
|
764
|
+
}
|
|
757
765
|
},
|
|
758
766
|
},
|
|
759
767
|
])).stages;
|
|
@@ -1088,7 +1096,7 @@ const addTeardown = (it, tr) => {
|
|
|
1088
1096
|
const changeKeys = ['fullDocument', 'fullDocumentBeforeChange'];
|
|
1089
1097
|
const subQ = (a, f) => ({ raw: g => a.raw(g.with(f)) });
|
|
1090
1098
|
const makeWatchStream = (db, { collection, projection: p, hardMatch: m }, startAt) => {
|
|
1091
|
-
const projection = mapExactToObject(p, v => v);
|
|
1099
|
+
const projection = { ...mapExactToObject(p, v => v), deletedAt: 1 };
|
|
1092
1100
|
const pipeline = [];
|
|
1093
1101
|
if (m) {
|
|
1094
1102
|
const q = $or(...changeKeys.map((k) => subQ(m, root().of(k))));
|
package/index.js
CHANGED
|
@@ -717,45 +717,53 @@ const $unwindDelta = (k1, k2, k) => {
|
|
|
717
717
|
.with(asStages([
|
|
718
718
|
{
|
|
719
719
|
$replaceWith: {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
720
|
+
$let: {
|
|
721
|
+
vars: {
|
|
722
|
+
beforeId: {
|
|
723
|
+
$concat: k
|
|
724
|
+
? `$${k}.before._id`
|
|
725
|
+
: [
|
|
726
|
+
`$${[k1, k2].sort()[0]}.before._id`,
|
|
727
|
+
'.',
|
|
728
|
+
`$${[k1, k2].sort()[1]}.before._id`,
|
|
729
|
+
],
|
|
730
|
+
},
|
|
731
|
+
afterId: {
|
|
732
|
+
$concat: k
|
|
733
|
+
? `$${k}.after._id`
|
|
734
|
+
: [
|
|
735
|
+
`$${[k1, k2].sort()[0]}.after._id`,
|
|
736
|
+
'.',
|
|
737
|
+
`$${[k1, k2].sort()[1]}.after._id`,
|
|
738
|
+
],
|
|
737
739
|
},
|
|
738
740
|
},
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
:
|
|
749
|
-
|
|
750
|
-
'.',
|
|
751
|
-
`$${[k1, k2].sort()[1]}.after._id`,
|
|
752
|
-
],
|
|
741
|
+
in: {
|
|
742
|
+
_id: { $ifNull: ['$$afterId', '$$beforeId'] },
|
|
743
|
+
before: {
|
|
744
|
+
$cond: {
|
|
745
|
+
if: { $or: [{ $eq: [`$${k1}.before`, null] }, { $eq: [`$${k2}.before`, null] }] },
|
|
746
|
+
then: null,
|
|
747
|
+
else: {
|
|
748
|
+
_id: '$$beforeId',
|
|
749
|
+
[k1]: `$${k1}.before`,
|
|
750
|
+
[k2]: `$${k2}.before`,
|
|
751
|
+
},
|
|
753
752
|
},
|
|
754
|
-
[k1]: `$${k1}.after`,
|
|
755
|
-
[k2]: `$${k2}.after`,
|
|
756
753
|
},
|
|
757
|
-
|
|
758
|
-
|
|
754
|
+
after: {
|
|
755
|
+
$cond: {
|
|
756
|
+
if: { $or: [{ $eq: [`$${k1}.after`, null] }, { $eq: [`$${k2}.after`, null] }] },
|
|
757
|
+
then: null,
|
|
758
|
+
else: {
|
|
759
|
+
_id: '$$afterId',
|
|
760
|
+
[k1]: `$${k1}.after`,
|
|
761
|
+
[k2]: `$${k2}.after`,
|
|
762
|
+
},
|
|
763
|
+
},
|
|
764
|
+
},
|
|
765
|
+
}
|
|
766
|
+
}
|
|
759
767
|
},
|
|
760
768
|
},
|
|
761
769
|
])).stages;
|
|
@@ -1090,7 +1098,7 @@ const addTeardown = (it, tr) => {
|
|
|
1090
1098
|
const changeKeys = ['fullDocument', 'fullDocumentBeforeChange'];
|
|
1091
1099
|
const subQ = (a, f) => ({ raw: g => a.raw(g.with(f)) });
|
|
1092
1100
|
const makeWatchStream = (db, { collection, projection: p, hardMatch: m }, startAt) => {
|
|
1093
|
-
const projection = mapExactToObject(p, v => v);
|
|
1101
|
+
const projection = { ...mapExactToObject(p, v => v), deletedAt: 1 };
|
|
1094
1102
|
const pipeline = [];
|
|
1095
1103
|
if (m) {
|
|
1096
1104
|
const q = $or(...changeKeys.map((k) => subQ(m, root().of(k))));
|