@omegup/msync 0.0.55 → 0.0.57
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 +29 -30
- package/index.esm.js +14 -13
- package/index.js +14 -13
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -449,31 +449,6 @@ declare const $groupMerge: <T extends O, Grp extends notArr, V extends O, GG ext
|
|
|
449
449
|
declare const $groupId: <T extends O, V extends O, EE = {}, Out extends Loose<string, V, "_id"> = Loose<string, V, "_id">>(id: Expr<string, T>, args: DeltaAccumulators<T, O & Omit<V, Denied>>, out: RWCollection<Replace<Out, Strict<string, V, "_id", EE>>, Out>, extra: ExprsExact<Omit<EE, IdAndTsKeys | keyof Omit<V, IdAndTsKeys>>, doc & Omit<V, IdAndTsKeys>>) => StreamRunnerParam<Delta<T>, "out">;
|
|
450
450
|
declare const $group: <T extends O, Grp extends notArr, V extends O, EE = {}, Out extends Loose<Grp, V, "_grp"> = Loose<Grp, V, "_grp">>(id: Expr<Grp, T>, args: DeltaAccumulators<T, O & Omit<V, Denied<"_grp">>>, out: RWCollection<Strict<Grp, V, "_grp", EE>, Out>, extra: ExprsExact<Omit<EE, IdAndTsKeys | "_grp" | keyof Omit<V, IdAndTsKeys | "_grp">>, Rec<"_grp", Grp> & Omit<V, IdAndTsKeys | "_grp">>, idPrefix?: string) => StreamRunnerParam<Delta<T>, "out">;
|
|
451
451
|
|
|
452
|
-
declare const size: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<number, D, C>;
|
|
453
|
-
declare const filterDefined: <T, D, C = unknown>(expr: Expr<Arr<T | N>, D, C>) => Expr<Arr<T>, D, C>;
|
|
454
|
-
declare const filter: <T, D, K extends string, C = unknown>({ as, cond, expr, limit, }: {
|
|
455
|
-
expr: Expr<Arr<T>, D, C>;
|
|
456
|
-
as: K;
|
|
457
|
-
cond: Expr<unknown, D, C & RORec<K, T>>;
|
|
458
|
-
limit?: Expr<number, D, C>;
|
|
459
|
-
}) => Expr<Arr<T>, D, C>;
|
|
460
|
-
declare const sortArray: <T, D, C, K extends keyof T>({ sortBy, expr, order, }: {
|
|
461
|
-
expr: Expr<Arr<T>, D, C>;
|
|
462
|
-
sortBy: K;
|
|
463
|
-
order?: 1 | -1;
|
|
464
|
-
}) => Expr<Arr<T>, D, C>;
|
|
465
|
-
declare const isArray: <T extends notArr, D, C, F extends HKT<T | Arr<T>>>(expr: Expr<T | Arr<T>, D & (App<F, T> | App<F, Arr<T>>), C>) => BoolExpr<D & App<F, Arr<T>>, D & App<F, T>, C>;
|
|
466
|
-
declare const array: <T, D, C = unknown>(...exprs: Expr<T, D, C>[]) => Expr<Arr<T>, D, C>;
|
|
467
|
-
declare const concatArray: <T, D, C>(...exprs: Expr<Arr<T>, D, C>[]) => Expr<Arr<T>, D, C>;
|
|
468
|
-
declare const first: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T | null, D, C>;
|
|
469
|
-
declare const firstSure: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T, D, C>;
|
|
470
|
-
declare const last: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T | null, D, C>;
|
|
471
|
-
type NullToOBJ<N extends null> = N extends null ? O : N;
|
|
472
|
-
declare const mergeObjects: <T1, T2, D, C = unknown, N extends null = never>(exprs_0: Expr<T1 | N, D, C>, exprs_1: Expr<T2, D, C>) => Expr<(T1 | NullToOBJ<N>) & T2, D, C>;
|
|
473
|
-
declare const inArray: <T, D, C = unknown>(exprs_0: Expr<T, D, C>, exprs_1: Expr<Arr<T>, D, C>) => Expr<boolean, D, C>;
|
|
474
|
-
declare const slice: <T, D, C>(array: Expr<Arr<T>, D, C>, start: Expr<number, D, C>, end: Expr<number, D, C>) => Expr<Arr<T>, D, C>;
|
|
475
|
-
declare const except: <T, D, C>(a: Expr<Arr<T>, D, C>, b: Expr<Arr<T>, D, C>) => Expr<Arr<T>, D, C>;
|
|
476
|
-
|
|
477
452
|
type Params<As extends string, LQ extends O, RQ extends O, RE extends RQ, S extends notArr> = {
|
|
478
453
|
localField: Field<LQ, S>;
|
|
479
454
|
foreignField: Field<RQ, S>;
|
|
@@ -481,10 +456,9 @@ type Params<As extends string, LQ extends O, RQ extends O, RE extends RQ, S exte
|
|
|
481
456
|
as: AsLiteral<As>;
|
|
482
457
|
};
|
|
483
458
|
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>>;
|
|
484
|
-
declare const $outerLookup: <As extends string, LQ extends doc, RQ extends O, RE extends RQ & doc, S extends notArr,
|
|
485
|
-
left?:
|
|
486
|
-
|
|
487
|
-
}) => <LE extends LQ>(l: SnapshotStream<LQ, LE>) => SnapshotStream<LQ | NullToOBJ<RNull>, (LE | NullToOBJ<RNull>) & RORec<As, RE | LNull>>;
|
|
459
|
+
declare const $outerLookup: <As extends string, LQ extends doc, RQ extends O, RE extends RQ & doc, S extends notArr, Null extends null = never>(p: Params<As, LQ, RQ, RE, S>, outer?: {
|
|
460
|
+
left?: Null;
|
|
461
|
+
}) => <LE extends LQ>(l: SnapshotStream<LQ, LE>) => SnapshotStream<LQ, LE & RORec<As, RE | Null>>;
|
|
488
462
|
|
|
489
463
|
declare const $matchDelta: <T extends doc>(query: Expr<boolean, T>) => RawStages<unknown, Delta<T>, Delta<T>, unknown, number>;
|
|
490
464
|
|
|
@@ -539,7 +513,7 @@ interface SnapshotStreamHKT extends HKT<O2> {
|
|
|
539
513
|
interface DeltaHKT extends HKT<O3> {
|
|
540
514
|
readonly out: DeltaStages<I<O3, this>[0], I<O3, this>[1], I<O3, this>[2]>;
|
|
541
515
|
}
|
|
542
|
-
declare const staging: <V extends Model, KK extends StrKey<V>>(view: View<V, Allowed$1<KK>>, streamName: string) => DeltaPipe<AllowedPick$1<V, KK>, AllowedPick$1<V, KK>, SnapshotStreamHKT, DeltaHKT>;
|
|
516
|
+
declare const staging: <V extends Model, KK extends StrKey<V>>(view: View<V, Allowed$1<KK>>, streamName: string, skip?: boolean) => DeltaPipe<AllowedPick$1<V, KK>, AllowedPick$1<V, KK>, SnapshotStreamHKT, DeltaHKT>;
|
|
543
517
|
|
|
544
518
|
type Allowed<K> = Exclude<K, 'deletedAt' | '_id'>;
|
|
545
519
|
type AllowedPick<V extends Model, K extends StrKey<V>> = OPickD<V, Allowed<K>>;
|
|
@@ -576,6 +550,31 @@ declare function floor<D, C>(expr: Expr<Num, D, C>): Expr<Num, D, C>;
|
|
|
576
550
|
declare function ceil<D, C>(expr: Expr<number, D, C>): Expr<number, D, C>;
|
|
577
551
|
declare function ceil<D, C>(expr: Expr<Num, D, C>): Expr<Num, D, C>;
|
|
578
552
|
|
|
553
|
+
declare const size: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<number, D, C>;
|
|
554
|
+
declare const filterDefined: <T, D, C = unknown>(expr: Expr<Arr<T | N>, D, C>) => Expr<Arr<T>, D, C>;
|
|
555
|
+
declare const filter: <T, D, K extends string, C = unknown>({ as, cond, expr, limit, }: {
|
|
556
|
+
expr: Expr<Arr<T>, D, C>;
|
|
557
|
+
as: K;
|
|
558
|
+
cond: Expr<unknown, D, C & RORec<K, T>>;
|
|
559
|
+
limit?: Expr<number, D, C>;
|
|
560
|
+
}) => Expr<Arr<T>, D, C>;
|
|
561
|
+
declare const sortArray: <T, D, C, K extends keyof T>({ sortBy, expr, order, }: {
|
|
562
|
+
expr: Expr<Arr<T>, D, C>;
|
|
563
|
+
sortBy: K;
|
|
564
|
+
order?: 1 | -1;
|
|
565
|
+
}) => Expr<Arr<T>, D, C>;
|
|
566
|
+
declare const isArray: <T extends notArr, D, C, F extends HKT<T | Arr<T>>>(expr: Expr<T | Arr<T>, D & (App<F, T> | App<F, Arr<T>>), C>) => BoolExpr<D & App<F, Arr<T>>, D & App<F, T>, C>;
|
|
567
|
+
declare const array: <T, D, C = unknown>(...exprs: Expr<T, D, C>[]) => Expr<Arr<T>, D, C>;
|
|
568
|
+
declare const concatArray: <T, D, C>(...exprs: Expr<Arr<T>, D, C>[]) => Expr<Arr<T>, D, C>;
|
|
569
|
+
declare const first: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T | null, D, C>;
|
|
570
|
+
declare const firstSure: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T, D, C>;
|
|
571
|
+
declare const last: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T | null, D, C>;
|
|
572
|
+
type NullToOBJ<N extends null> = N extends null ? O : N;
|
|
573
|
+
declare const mergeObjects: <T1, T2, D, C = unknown, N extends null = never>(exprs_0: Expr<T1 | N, D, C>, exprs_1: Expr<T2, D, C>) => Expr<(T1 | NullToOBJ<N>) & T2, D, C>;
|
|
574
|
+
declare const inArray: <T, D, C = unknown>(exprs_0: Expr<T, D, C>, exprs_1: Expr<Arr<T>, D, C>) => Expr<boolean, D, C>;
|
|
575
|
+
declare const slice: <T, D, C>(array: Expr<Arr<T>, D, C>, start: Expr<number, D, C>, end: Expr<number, D, C>) => Expr<Arr<T>, D, C>;
|
|
576
|
+
declare const except: <T, D, C>(a: Expr<Arr<T>, D, C>, b: Expr<Arr<T>, D, C>) => Expr<Arr<T>, D, C>;
|
|
577
|
+
|
|
579
578
|
declare const dayAndMonthPart: <D, C>(date: Expr<Date, D, C>) => Expr<string, D, C>;
|
|
580
579
|
declare const now: <D, C>() => Expr<Date, D, C>;
|
|
581
580
|
declare const monthPart: <D, C>(date: Expr<Date, D, C>) => Expr<string, D, C>;
|
package/index.esm.js
CHANGED
|
@@ -468,7 +468,7 @@ const $replaceWith1 = (expr) => f => {
|
|
|
468
468
|
const $unwind1 = (k, includeNull) => f => {
|
|
469
469
|
const path = `$${f().of(k).str()}`;
|
|
470
470
|
return asStages([
|
|
471
|
-
{ $unwind: path },
|
|
471
|
+
{ $unwind: includeNull === null ? { path, preserveNullAndEmptyArrays: true } : path },
|
|
472
472
|
]);
|
|
473
473
|
};
|
|
474
474
|
const $group1 = (id, args) => (f) => asStages([
|
|
@@ -501,7 +501,7 @@ const $simpleLookup1 = (args) => f => {
|
|
|
501
501
|
const $match_ = (query) => $match1(query)(root);
|
|
502
502
|
const $set_ = (updater) => $set1(updater)(root);
|
|
503
503
|
const $replaceWith_ = (expr) => $replaceWith1(expr)(root);
|
|
504
|
-
const $unwind_ = (k, includeNull) => $unwind1(k)(root);
|
|
504
|
+
const $unwind_ = (k, includeNull) => $unwind1(k, includeNull)(root);
|
|
505
505
|
const $group_ = () => (id, args) => $group1(id, args)(root);
|
|
506
506
|
const $project_ = $project1;
|
|
507
507
|
const $simpleLookup_ = (args) => $simpleLookup1(args)(root);
|
|
@@ -1086,9 +1086,8 @@ const $lookupDelta = ({ field1, field2 }, { coll, exec, input }, k1, k2, k, incl
|
|
|
1086
1086
|
})).with($unwindDelta(k1, k2, k, includeNull)).stages;
|
|
1087
1087
|
};
|
|
1088
1088
|
|
|
1089
|
-
const $lookupRaw = ({ field1, field2 }, { coll, exec, input }, k2, k) => (f) => {
|
|
1089
|
+
const $lookupRaw = ({ field1, field2 }, { coll, exec, input }, k2, k, includeNull) => (f) => {
|
|
1090
1090
|
root().of('_id').expr();
|
|
1091
|
-
root().of(k2).of('_id').expr();
|
|
1092
1091
|
return link()
|
|
1093
1092
|
.with($simpleLookup1({
|
|
1094
1093
|
coll,
|
|
@@ -1100,7 +1099,7 @@ const $lookupRaw = ({ field1, field2 }, { coll, exec, input }, k2, k) => (f) =>
|
|
|
1100
1099
|
.with(exec)
|
|
1101
1100
|
.with($replaceWith_(root().of('before').expr())).stages,
|
|
1102
1101
|
})(f))
|
|
1103
|
-
.with($unwind1(k2)(f))
|
|
1102
|
+
.with($unwind1(k2, includeNull)(f))
|
|
1104
1103
|
.with(link().stages
|
|
1105
1104
|
).stages;
|
|
1106
1105
|
};
|
|
@@ -1235,12 +1234,12 @@ const runCont = async (it, cb) => {
|
|
|
1235
1234
|
};
|
|
1236
1235
|
|
|
1237
1236
|
const merge = ({ lsource: L, rsource: R, }) => mergeIterators({ sources: { L, R } });
|
|
1238
|
-
const join = ({ lField, rField, left, right, as }, leftSnapshot, rightSnapshot, stagesUntilNextLookup, outerLeft
|
|
1237
|
+
const join = ({ lField, rField, left, right, as }, leftSnapshot, rightSnapshot, stagesUntilNextLookup, outerLeft) => {
|
|
1239
1238
|
createIndex(leftSnapshot.coll, { [`before.${lField.str()}`]: 1 }).catch(e => e.code == 86 || Promise.reject(e));
|
|
1240
1239
|
createIndex(rightSnapshot.coll, { [`before.${rField.str()}`]: 1 }).catch(e => e.code == 86 || Promise.reject(e));
|
|
1241
1240
|
const rightJoinField = { field1: lField, field2: rField };
|
|
1242
1241
|
const joinId = 'left';
|
|
1243
|
-
const joinR_Snapshot = asBefore($lookupRaw(rightJoinField, rightSnapshot, as));
|
|
1242
|
+
const joinR_Snapshot = asBefore($lookupRaw(rightJoinField, rightSnapshot, as, joinId, outerLeft));
|
|
1244
1243
|
const resultingSnapshot = concatTStages(leftSnapshot, joinR_Snapshot);
|
|
1245
1244
|
const dict = { [as]: 'a' };
|
|
1246
1245
|
const idB = { _id: 'b' };
|
|
@@ -1249,7 +1248,7 @@ const join = ({ lField, rField, left, right, as }, leftSnapshot, rightSnapshot,
|
|
|
1249
1248
|
stages: consume => consume(concatTStages(resultingSnapshot, asBefore(stagesUntilNextLookup.raw))),
|
|
1250
1249
|
out: (finalInput) => {
|
|
1251
1250
|
const leftJoinField = { field1: rField, field2: lField };
|
|
1252
|
-
const joinL_Delta = $lookupDelta(leftJoinField, leftSnapshot, 'right', 'left', joinId
|
|
1251
|
+
const joinL_Delta = $lookupDelta(leftJoinField, leftSnapshot, 'right', 'left', joinId);
|
|
1253
1252
|
const joinR_Delta = $lookupDelta(rightJoinField, rightSnapshot, 'left', 'right', joinId, outerLeft);
|
|
1254
1253
|
const mergeForeignIntoDoc = concatStages($replaceWithDelta(mergeObjects(root().of('left').expr(), fieldM({ a: root().of('right').expr(), b: root().of('_id').expr() }, dictId))), stagesUntilNextLookup.delta);
|
|
1255
1254
|
const lRunnerInput = concatStages(joinR_Delta, mergeForeignIntoDoc);
|
|
@@ -1264,7 +1263,7 @@ const join = ({ lField, rField, left, right, as }, leftSnapshot, rightSnapshot,
|
|
|
1264
1263
|
},
|
|
1265
1264
|
};
|
|
1266
1265
|
};
|
|
1267
|
-
const $lookup1 = (p,
|
|
1266
|
+
const $lookup1 = (p, outerLeft) => (input) => p.left.stages((lStages) => p.right.stages((rStages) => join(p, lStages, rStages, input, outerLeft)));
|
|
1268
1267
|
const $lookup = (p) => (l) => $lookup1({
|
|
1269
1268
|
right: p.from,
|
|
1270
1269
|
as: p.as,
|
|
@@ -1278,7 +1277,7 @@ const $outerLookup = (p, outer) => (l) => $lookup1({
|
|
|
1278
1277
|
lField: p.localField,
|
|
1279
1278
|
rField: p.foreignField,
|
|
1280
1279
|
left: l(emptyDelta()),
|
|
1281
|
-
}, outer);
|
|
1280
|
+
}, outer?.left);
|
|
1282
1281
|
|
|
1283
1282
|
const filterUndefined = (applyOperator) => {
|
|
1284
1283
|
return (op, args) => applyOperator(op, args.filter(defined));
|
|
@@ -1482,7 +1481,7 @@ const actions = {
|
|
|
1482
1481
|
],
|
|
1483
1482
|
};
|
|
1484
1483
|
const streamNames = {};
|
|
1485
|
-
const executes$1 = (view, input, streamName) => {
|
|
1484
|
+
const executes$1 = (view, input, streamName, skip = false) => {
|
|
1486
1485
|
const hash = crypto$1
|
|
1487
1486
|
.createHash('md5')
|
|
1488
1487
|
.update(new Error().stack + '')
|
|
@@ -1662,7 +1661,9 @@ const executes$1 = (view, input, streamName) => {
|
|
|
1662
1661
|
})
|
|
1663
1662
|
.then(doc => (doc ? next(step3({ _id: streamName, ts: l.ts }), 'restart') : step8(l))), 'wait for change');
|
|
1664
1663
|
};
|
|
1665
|
-
return
|
|
1664
|
+
return skip
|
|
1665
|
+
? withStop(() => SynchronousPromise.resolve(next(step3(null), 'clone into new collection')))
|
|
1666
|
+
: stop;
|
|
1666
1667
|
};
|
|
1667
1668
|
const hasBefore = root().of('before').has($ne(null));
|
|
1668
1669
|
return {
|
|
@@ -1674,7 +1675,7 @@ const executes$1 = (view, input, streamName) => {
|
|
|
1674
1675
|
out: run,
|
|
1675
1676
|
};
|
|
1676
1677
|
};
|
|
1677
|
-
const staging = (view, streamName) => pipe(input => executes$1(view, input, streamName), emptyDelta(), concatDelta, emptyDelta);
|
|
1678
|
+
const staging = (view, streamName, skip = false) => pipe(input => executes$1(view, input, streamName, skip), emptyDelta(), concatDelta, emptyDelta);
|
|
1678
1679
|
|
|
1679
1680
|
const executes = (view, input, streamName) => {
|
|
1680
1681
|
const hash = crypto$1
|
package/index.js
CHANGED
|
@@ -470,7 +470,7 @@ const $replaceWith1 = (expr) => f => {
|
|
|
470
470
|
const $unwind1 = (k, includeNull) => f => {
|
|
471
471
|
const path = `$${f().of(k).str()}`;
|
|
472
472
|
return asStages([
|
|
473
|
-
{ $unwind: path },
|
|
473
|
+
{ $unwind: includeNull === null ? { path, preserveNullAndEmptyArrays: true } : path },
|
|
474
474
|
]);
|
|
475
475
|
};
|
|
476
476
|
const $group1 = (id, args) => (f) => asStages([
|
|
@@ -503,7 +503,7 @@ const $simpleLookup1 = (args) => f => {
|
|
|
503
503
|
const $match_ = (query) => $match1(query)(root);
|
|
504
504
|
const $set_ = (updater) => $set1(updater)(root);
|
|
505
505
|
const $replaceWith_ = (expr) => $replaceWith1(expr)(root);
|
|
506
|
-
const $unwind_ = (k, includeNull) => $unwind1(k)(root);
|
|
506
|
+
const $unwind_ = (k, includeNull) => $unwind1(k, includeNull)(root);
|
|
507
507
|
const $group_ = () => (id, args) => $group1(id, args)(root);
|
|
508
508
|
const $project_ = $project1;
|
|
509
509
|
const $simpleLookup_ = (args) => $simpleLookup1(args)(root);
|
|
@@ -1088,9 +1088,8 @@ const $lookupDelta = ({ field1, field2 }, { coll, exec, input }, k1, k2, k, incl
|
|
|
1088
1088
|
})).with($unwindDelta(k1, k2, k, includeNull)).stages;
|
|
1089
1089
|
};
|
|
1090
1090
|
|
|
1091
|
-
const $lookupRaw = ({ field1, field2 }, { coll, exec, input }, k2, k) => (f) => {
|
|
1091
|
+
const $lookupRaw = ({ field1, field2 }, { coll, exec, input }, k2, k, includeNull) => (f) => {
|
|
1092
1092
|
root().of('_id').expr();
|
|
1093
|
-
root().of(k2).of('_id').expr();
|
|
1094
1093
|
return link()
|
|
1095
1094
|
.with($simpleLookup1({
|
|
1096
1095
|
coll,
|
|
@@ -1102,7 +1101,7 @@ const $lookupRaw = ({ field1, field2 }, { coll, exec, input }, k2, k) => (f) =>
|
|
|
1102
1101
|
.with(exec)
|
|
1103
1102
|
.with($replaceWith_(root().of('before').expr())).stages,
|
|
1104
1103
|
})(f))
|
|
1105
|
-
.with($unwind1(k2)(f))
|
|
1104
|
+
.with($unwind1(k2, includeNull)(f))
|
|
1106
1105
|
.with(link().stages
|
|
1107
1106
|
).stages;
|
|
1108
1107
|
};
|
|
@@ -1237,12 +1236,12 @@ const runCont = async (it, cb) => {
|
|
|
1237
1236
|
};
|
|
1238
1237
|
|
|
1239
1238
|
const merge = ({ lsource: L, rsource: R, }) => mergeIterators({ sources: { L, R } });
|
|
1240
|
-
const join = ({ lField, rField, left, right, as }, leftSnapshot, rightSnapshot, stagesUntilNextLookup, outerLeft
|
|
1239
|
+
const join = ({ lField, rField, left, right, as }, leftSnapshot, rightSnapshot, stagesUntilNextLookup, outerLeft) => {
|
|
1241
1240
|
createIndex(leftSnapshot.coll, { [`before.${lField.str()}`]: 1 }).catch(e => e.code == 86 || Promise.reject(e));
|
|
1242
1241
|
createIndex(rightSnapshot.coll, { [`before.${rField.str()}`]: 1 }).catch(e => e.code == 86 || Promise.reject(e));
|
|
1243
1242
|
const rightJoinField = { field1: lField, field2: rField };
|
|
1244
1243
|
const joinId = 'left';
|
|
1245
|
-
const joinR_Snapshot = asBefore($lookupRaw(rightJoinField, rightSnapshot, as));
|
|
1244
|
+
const joinR_Snapshot = asBefore($lookupRaw(rightJoinField, rightSnapshot, as, joinId, outerLeft));
|
|
1246
1245
|
const resultingSnapshot = concatTStages(leftSnapshot, joinR_Snapshot);
|
|
1247
1246
|
const dict = { [as]: 'a' };
|
|
1248
1247
|
const idB = { _id: 'b' };
|
|
@@ -1251,7 +1250,7 @@ const join = ({ lField, rField, left, right, as }, leftSnapshot, rightSnapshot,
|
|
|
1251
1250
|
stages: consume => consume(concatTStages(resultingSnapshot, asBefore(stagesUntilNextLookup.raw))),
|
|
1252
1251
|
out: (finalInput) => {
|
|
1253
1252
|
const leftJoinField = { field1: rField, field2: lField };
|
|
1254
|
-
const joinL_Delta = $lookupDelta(leftJoinField, leftSnapshot, 'right', 'left', joinId
|
|
1253
|
+
const joinL_Delta = $lookupDelta(leftJoinField, leftSnapshot, 'right', 'left', joinId);
|
|
1255
1254
|
const joinR_Delta = $lookupDelta(rightJoinField, rightSnapshot, 'left', 'right', joinId, outerLeft);
|
|
1256
1255
|
const mergeForeignIntoDoc = concatStages($replaceWithDelta(mergeObjects(root().of('left').expr(), fieldM({ a: root().of('right').expr(), b: root().of('_id').expr() }, dictId))), stagesUntilNextLookup.delta);
|
|
1257
1256
|
const lRunnerInput = concatStages(joinR_Delta, mergeForeignIntoDoc);
|
|
@@ -1266,7 +1265,7 @@ const join = ({ lField, rField, left, right, as }, leftSnapshot, rightSnapshot,
|
|
|
1266
1265
|
},
|
|
1267
1266
|
};
|
|
1268
1267
|
};
|
|
1269
|
-
const $lookup1 = (p,
|
|
1268
|
+
const $lookup1 = (p, outerLeft) => (input) => p.left.stages((lStages) => p.right.stages((rStages) => join(p, lStages, rStages, input, outerLeft)));
|
|
1270
1269
|
const $lookup = (p) => (l) => $lookup1({
|
|
1271
1270
|
right: p.from,
|
|
1272
1271
|
as: p.as,
|
|
@@ -1280,7 +1279,7 @@ const $outerLookup = (p, outer) => (l) => $lookup1({
|
|
|
1280
1279
|
lField: p.localField,
|
|
1281
1280
|
rField: p.foreignField,
|
|
1282
1281
|
left: l(emptyDelta()),
|
|
1283
|
-
}, outer);
|
|
1282
|
+
}, outer?.left);
|
|
1284
1283
|
|
|
1285
1284
|
const filterUndefined = (applyOperator) => {
|
|
1286
1285
|
return (op, args) => applyOperator(op, args.filter(defined));
|
|
@@ -1484,7 +1483,7 @@ const actions = {
|
|
|
1484
1483
|
],
|
|
1485
1484
|
};
|
|
1486
1485
|
const streamNames = {};
|
|
1487
|
-
const executes$1 = (view, input, streamName) => {
|
|
1486
|
+
const executes$1 = (view, input, streamName, skip = false) => {
|
|
1488
1487
|
const hash = crypto$1
|
|
1489
1488
|
.createHash('md5')
|
|
1490
1489
|
.update(new Error().stack + '')
|
|
@@ -1664,7 +1663,9 @@ const executes$1 = (view, input, streamName) => {
|
|
|
1664
1663
|
})
|
|
1665
1664
|
.then(doc => (doc ? next(step3({ _id: streamName, ts: l.ts }), 'restart') : step8(l))), 'wait for change');
|
|
1666
1665
|
};
|
|
1667
|
-
return
|
|
1666
|
+
return skip
|
|
1667
|
+
? withStop(() => synchronousPromise.SynchronousPromise.resolve(next(step3(null), 'clone into new collection')))
|
|
1668
|
+
: stop;
|
|
1668
1669
|
};
|
|
1669
1670
|
const hasBefore = root().of('before').has($ne(null));
|
|
1670
1671
|
return {
|
|
@@ -1676,7 +1677,7 @@ const executes$1 = (view, input, streamName) => {
|
|
|
1676
1677
|
out: run,
|
|
1677
1678
|
};
|
|
1678
1679
|
};
|
|
1679
|
-
const staging = (view, streamName) => pipe(input => executes$1(view, input, streamName), emptyDelta(), concatDelta, emptyDelta);
|
|
1680
|
+
const staging = (view, streamName, skip = false) => pipe(input => executes$1(view, input, streamName, skip), emptyDelta(), concatDelta, emptyDelta);
|
|
1680
1681
|
|
|
1681
1682
|
const executes = (view, input, streamName) => {
|
|
1682
1683
|
const hash = crypto$1
|