@omegup/msync 0.0.62 → 0.0.64
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.d.ts +2 -3
- package/index.esm.js +28 -17
- package/index.js +28 -17
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -84,6 +84,7 @@ type TStages<in out S, out Q, in out B extends Q, out R extends Q, M extends num
|
|
|
84
84
|
type Stages<out Q, out R extends Q, out SDom> = <E>(consume: <S extends SDom, B extends Q>(value: TStages<S, Q, B, R>) => E) => E;
|
|
85
85
|
type Actions<W> = {
|
|
86
86
|
updateMany: [Filter<W>, UpdateFilter<W> | BSON.Document[]];
|
|
87
|
+
deleteMany: [Filter<W>];
|
|
87
88
|
};
|
|
88
89
|
type TeardownRecord<W, M extends keyof Actions<W>> = {
|
|
89
90
|
collection: WriteonlyCollection<W>;
|
|
@@ -457,9 +458,7 @@ type Params<As extends string, LQ extends O, RQ extends O, RE extends RQ, S exte
|
|
|
457
458
|
as: AsLiteral<As>;
|
|
458
459
|
};
|
|
459
460
|
declare const $lookup: <As extends string, LQ extends doc, RQ extends O, RE extends RQ & doc, S extends notArr>(p: Params<As, LQ, RQ, RE, S>) => <LE extends LQ>(l: SnapshotStream<LQ, LE>) => SnapshotStream<LQ, LE & RORec<As, RE>>;
|
|
460
|
-
declare const $outerLookup: <As extends string, LQ extends doc, RQ extends O, RE extends RQ & doc, S extends notArr
|
|
461
|
-
left?: Null;
|
|
462
|
-
}) => <LE extends LQ>(l: SnapshotStream<LQ, LE>) => SnapshotStream<LQ, LE & RORec<As, RE | Null>>;
|
|
461
|
+
declare const $outerLookup: <As extends string, LQ extends doc, RQ extends O, RE extends RQ & doc, S extends notArr>(p: Params<As, LQ, RQ, RE, S>) => <LE extends LQ>(l: SnapshotStream<LQ, LE>) => SnapshotStream<LQ, LE & RORec<As, RE | null>>;
|
|
463
462
|
|
|
464
463
|
declare const $matchDelta: <T extends doc>(query: Expr<boolean, T>) => RawStages<unknown, Delta<T>, Delta<T>, unknown, number>;
|
|
465
464
|
|
package/index.esm.js
CHANGED
|
@@ -613,21 +613,27 @@ const $groupMerge = (id, args, out, gid, extra, idPrefix = '') => ({
|
|
|
613
613
|
raw: (first) => link()
|
|
614
614
|
.with(subGroup(id, args, addGrp(gid)))
|
|
615
615
|
.with(subMerge(args, out, gid, extra, idPrefix, first)).stages,
|
|
616
|
-
teardown: c => c(
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
{},
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
616
|
+
teardown: c => c(out.whenNotMatched === 'insert'
|
|
617
|
+
? {
|
|
618
|
+
collection: out.into,
|
|
619
|
+
method: 'deleteMany',
|
|
620
|
+
params: [{}],
|
|
621
|
+
}
|
|
622
|
+
: {
|
|
623
|
+
collection: out.into,
|
|
624
|
+
method: 'updateMany',
|
|
625
|
+
params: [
|
|
626
|
+
{},
|
|
627
|
+
[
|
|
628
|
+
{
|
|
629
|
+
$unset: Object.keys({
|
|
630
|
+
...mapExactToObject(extra, () => 1),
|
|
631
|
+
...mapExactToObject(args, () => 1),
|
|
632
|
+
}),
|
|
633
|
+
},
|
|
634
|
+
],
|
|
628
635
|
],
|
|
629
|
-
|
|
630
|
-
}),
|
|
636
|
+
}),
|
|
631
637
|
});
|
|
632
638
|
const $groupId = (id, args, out, extra) => $groupMerge(id, args, { into: out, whenNotMatched: 'fail' }, '_id', extra);
|
|
633
639
|
const $group = (id, args, out, extra, idPrefix = '') => $groupMerge(id, args, { into: out, whenNotMatched: 'insert' }, '_grp', extra, idPrefix);
|
|
@@ -1287,13 +1293,13 @@ const $lookup = (p) => (l) => $lookup1({
|
|
|
1287
1293
|
rField: p.foreignField,
|
|
1288
1294
|
left: l(emptyDelta()),
|
|
1289
1295
|
});
|
|
1290
|
-
const $outerLookup = (p
|
|
1296
|
+
const $outerLookup = (p) => (l) => $lookup1({
|
|
1291
1297
|
right: p.from,
|
|
1292
1298
|
as: p.as,
|
|
1293
1299
|
lField: p.localField,
|
|
1294
1300
|
rField: p.foreignField,
|
|
1295
1301
|
left: l(emptyDelta()),
|
|
1296
|
-
},
|
|
1302
|
+
}, null);
|
|
1297
1303
|
|
|
1298
1304
|
const filterUndefined = (applyOperator) => {
|
|
1299
1305
|
return (op, args) => applyOperator(op, args.filter(defined));
|
|
@@ -1495,9 +1501,13 @@ const actions = {
|
|
|
1495
1501
|
c.updateMany(...args),
|
|
1496
1502
|
[`db['${c.collectionName}'].updateMany(...`, args, ')'],
|
|
1497
1503
|
],
|
|
1504
|
+
deleteMany: (c, args) => [
|
|
1505
|
+
c.deleteMany(...args),
|
|
1506
|
+
[`db['${c.collectionName}'].deleteMany(...`, args, ')'],
|
|
1507
|
+
],
|
|
1498
1508
|
};
|
|
1499
1509
|
const streamNames = {};
|
|
1500
|
-
const executes$1 = (view, input, streamName, skip = false) => {
|
|
1510
|
+
const executes$1 = (view, input, streamName, skip = false, after) => {
|
|
1501
1511
|
const hash = crypto$1
|
|
1502
1512
|
.createHash('md5')
|
|
1503
1513
|
.update(new Error().stack + '')
|
|
@@ -1590,6 +1600,7 @@ const executes$1 = (view, input, streamName, skip = false) => {
|
|
|
1590
1600
|
if (exists && !same) {
|
|
1591
1601
|
await handleTeardown(exists);
|
|
1592
1602
|
}
|
|
1603
|
+
await after?.();
|
|
1593
1604
|
return nextData([])(async () => {
|
|
1594
1605
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1595
1606
|
return step3(same)();
|
package/index.js
CHANGED
|
@@ -615,21 +615,27 @@ const $groupMerge = (id, args, out, gid, extra, idPrefix = '') => ({
|
|
|
615
615
|
raw: (first) => link()
|
|
616
616
|
.with(subGroup(id, args, addGrp(gid)))
|
|
617
617
|
.with(subMerge(args, out, gid, extra, idPrefix, first)).stages,
|
|
618
|
-
teardown: c => c(
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
{},
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
618
|
+
teardown: c => c(out.whenNotMatched === 'insert'
|
|
619
|
+
? {
|
|
620
|
+
collection: out.into,
|
|
621
|
+
method: 'deleteMany',
|
|
622
|
+
params: [{}],
|
|
623
|
+
}
|
|
624
|
+
: {
|
|
625
|
+
collection: out.into,
|
|
626
|
+
method: 'updateMany',
|
|
627
|
+
params: [
|
|
628
|
+
{},
|
|
629
|
+
[
|
|
630
|
+
{
|
|
631
|
+
$unset: Object.keys({
|
|
632
|
+
...mapExactToObject(extra, () => 1),
|
|
633
|
+
...mapExactToObject(args, () => 1),
|
|
634
|
+
}),
|
|
635
|
+
},
|
|
636
|
+
],
|
|
630
637
|
],
|
|
631
|
-
|
|
632
|
-
}),
|
|
638
|
+
}),
|
|
633
639
|
});
|
|
634
640
|
const $groupId = (id, args, out, extra) => $groupMerge(id, args, { into: out, whenNotMatched: 'fail' }, '_id', extra);
|
|
635
641
|
const $group = (id, args, out, extra, idPrefix = '') => $groupMerge(id, args, { into: out, whenNotMatched: 'insert' }, '_grp', extra, idPrefix);
|
|
@@ -1289,13 +1295,13 @@ const $lookup = (p) => (l) => $lookup1({
|
|
|
1289
1295
|
rField: p.foreignField,
|
|
1290
1296
|
left: l(emptyDelta()),
|
|
1291
1297
|
});
|
|
1292
|
-
const $outerLookup = (p
|
|
1298
|
+
const $outerLookup = (p) => (l) => $lookup1({
|
|
1293
1299
|
right: p.from,
|
|
1294
1300
|
as: p.as,
|
|
1295
1301
|
lField: p.localField,
|
|
1296
1302
|
rField: p.foreignField,
|
|
1297
1303
|
left: l(emptyDelta()),
|
|
1298
|
-
},
|
|
1304
|
+
}, null);
|
|
1299
1305
|
|
|
1300
1306
|
const filterUndefined = (applyOperator) => {
|
|
1301
1307
|
return (op, args) => applyOperator(op, args.filter(defined));
|
|
@@ -1497,9 +1503,13 @@ const actions = {
|
|
|
1497
1503
|
c.updateMany(...args),
|
|
1498
1504
|
[`db['${c.collectionName}'].updateMany(...`, args, ')'],
|
|
1499
1505
|
],
|
|
1506
|
+
deleteMany: (c, args) => [
|
|
1507
|
+
c.deleteMany(...args),
|
|
1508
|
+
[`db['${c.collectionName}'].deleteMany(...`, args, ')'],
|
|
1509
|
+
],
|
|
1500
1510
|
};
|
|
1501
1511
|
const streamNames = {};
|
|
1502
|
-
const executes$1 = (view, input, streamName, skip = false) => {
|
|
1512
|
+
const executes$1 = (view, input, streamName, skip = false, after) => {
|
|
1503
1513
|
const hash = crypto$1
|
|
1504
1514
|
.createHash('md5')
|
|
1505
1515
|
.update(new Error().stack + '')
|
|
@@ -1592,6 +1602,7 @@ const executes$1 = (view, input, streamName, skip = false) => {
|
|
|
1592
1602
|
if (exists && !same) {
|
|
1593
1603
|
await handleTeardown(exists);
|
|
1594
1604
|
}
|
|
1605
|
+
await after?.();
|
|
1595
1606
|
return nextData([])(async () => {
|
|
1596
1607
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1597
1608
|
return step3(same)();
|