@omegup/msync 0.1.1 → 0.1.3
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 +4 -3
- package/index.esm.js +7 -8
- package/index.js +7 -7
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -415,7 +415,7 @@ type MergeInto<T extends O, Out extends O, E = unknown> = {
|
|
|
415
415
|
type MergeArgs<T extends O, Out extends O, Ctx, In extends O> = {
|
|
416
416
|
on: Field<T, jsonItem> & Field<Out, jsonItem>;
|
|
417
417
|
} & MergeInto<T, Out> & (({
|
|
418
|
-
stages?:
|
|
418
|
+
stages?: never;
|
|
419
419
|
} & ({
|
|
420
420
|
whenMatched: 'keepExisting' | 'fail';
|
|
421
421
|
} | {
|
|
@@ -437,6 +437,7 @@ type MergeArgs<T extends O, Out extends O, Ctx, In extends O> = {
|
|
|
437
437
|
whenMatched: RawStages<unknown, Out, In, Ctx>;
|
|
438
438
|
});
|
|
439
439
|
declare const $merge_: <T extends O, Out extends O = T, Ctx = unknown, In extends O = Out>({ into, on, whenNotMatched, ...notMatched }: MergeArgs<T, Out, Ctx, In>) => RawStages<unknown, T, "out", unknown, number>;
|
|
440
|
+
declare const $merge2: <T extends O, Out extends O = T, Ctx = unknown, In extends O = Out>(args: MergeArgs<T, Out, Ctx, In>) => RawStages<unknown, T, "out", unknown, number>;
|
|
440
441
|
|
|
441
442
|
type GI$1<GG> = Exclude<GG, keyof TS>;
|
|
442
443
|
type IdAndTsKeys = keyof (TS & ID);
|
|
@@ -526,7 +527,7 @@ interface SnapshotStreamHKT extends HKT<O2> {
|
|
|
526
527
|
interface DeltaHKT extends HKT<O3> {
|
|
527
528
|
readonly out: DeltaStages<I<O3, this>[0], I<O3, this>[1], I<O3, this>[2]>;
|
|
528
529
|
}
|
|
529
|
-
declare const staging: <V extends Model, KK extends StrKey<V>>(view: View<V, Allowed$1<KK>>, streamName: string, skip?: boolean, after?: () => Promise<void
|
|
530
|
+
declare const staging: <V extends Model, KK extends StrKey<V>>(view: View<V, Allowed$1<KK>>, streamName: string, skip?: boolean, after?: () => Promise<void>) => DeltaPipe<AllowedPick$1<V, KK>, AllowedPick$1<V, KK>, SnapshotStreamHKT, DeltaHKT>;
|
|
530
531
|
|
|
531
532
|
type Allowed<K> = Exclude<K, 'deletedAt' | '_id'>;
|
|
532
533
|
type AllowedPick<V extends Model, K extends StrKey<V>> = OPickD<V, Allowed<K>>;
|
|
@@ -703,4 +704,4 @@ declare const enablePreAndPostImages: <T extends doc>(coll: Collection<T>) => Pr
|
|
|
703
704
|
declare const prepare: (testName?: string) => Promise<MongoClient$1>;
|
|
704
705
|
declare const makeCol: <T extends ID>(docs: readonly OptionalUnlessRequiredId<T>[], database: Db, name?: string) => Promise<Collection<T>>;
|
|
705
706
|
|
|
706
|
-
export { $accumulator, $and, $countDict, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $group_, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $insert, $insertPart, $insertX, $keys, $let, $lookup, $lt, $lte, $map, $map0, $map1, $match, $matchDelta, $merge, $merge_, $ne, $nin, $nor, $or, $outerLookup, $pushDict, $rand, $reduce, $replaceWith, $set, $simpleInsert, $simpleMerge, $simpleMergePart, $sum, $type, $unwind, $unwindDelta, type Accumulators, type Arr, type AsLiteral, type Delta, type DeltaAccumulator, type DeltaAccumulators, Expr, type ExprHKT, type Exprs, type ExprsExact, type ExprsExactHKT, type ExprsPart, Field, type ID, type Loose, Machine, type Merge, type MergeArgs, type MergeInto, type MergeMapOArgs, type Model, type MongoTypeNames, type N, type NoRaw, type NullToOBJ, type O, type OPick, type OPickD, type RONoRaw, type RORec, type RawStages, type Rec, type Replace, type SnapshotStreamExecutionResult, type StrKey, type Strict, type TS, Type, type WriteonlyCollection, add, and, anyElementTrue, array, ceil, comp, concat, concatArray, createIndex, ctx, current, dateAdd, dateDiff, dateLt, datePart, dayAndMonthPart, divide, type doc, enablePreAndPostImages, eq, eqTyped, except, exprMapVal, field, fieldF, fieldM, filter, filterDefined, first, firstSure, floor, from, func, gt, gte, inArray, isArray, ite, last, log, lt, lte, makeCol, map1, mapVal, max, maxDate, mergeExact, mergeExact0, mergeExpr, mergeObjects, minDate, monthPart, multiply, ne, nil, noop, not, type notArr, notNull, now, or, pair, prepare, rand, range, regex, root, set, setField, single, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, weekPart, wrap, year };
|
|
707
|
+
export { $accumulator, $and, $countDict, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $group_, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $insert, $insertPart, $insertX, $keys, $let, $lookup, $lt, $lte, $map, $map0, $map1, $match, $matchDelta, $merge, $merge2, $merge_, $ne, $nin, $nor, $or, $outerLookup, $pushDict, $rand, $reduce, $replaceWith, $set, $simpleInsert, $simpleMerge, $simpleMergePart, $sum, $type, $unwind, $unwindDelta, type Accumulators, type Arr, type AsLiteral, type Delta, type DeltaAccumulator, type DeltaAccumulators, Expr, type ExprHKT, type Exprs, type ExprsExact, type ExprsExactHKT, type ExprsPart, Field, type ID, type Loose, Machine, type Merge, type MergeArgs, type MergeInto, type MergeMapOArgs, type Model, type MongoTypeNames, type N, type NoRaw, type NullToOBJ, type O, type OPick, type OPickD, type RONoRaw, type RORec, type RawStages, type Rec, type Replace, type SnapshotStreamExecutionResult, type StrKey, type Strict, type TS, Type, type WriteonlyCollection, add, and, anyElementTrue, array, ceil, comp, concat, concatArray, createIndex, ctx, current, dateAdd, dateDiff, dateLt, datePart, dayAndMonthPart, divide, type doc, enablePreAndPostImages, eq, eqTyped, except, exprMapVal, field, fieldF, fieldM, filter, filterDefined, first, firstSure, floor, from, func, gt, gte, inArray, isArray, ite, last, log, lt, lte, makeCol, map1, mapVal, max, maxDate, mergeExact, mergeExact0, mergeExpr, mergeObjects, minDate, monthPart, multiply, ne, nil, noop, not, type notArr, notNull, now, or, pair, prepare, rand, range, regex, root, set, setField, single, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, weekPart, wrap, year };
|
package/index.esm.js
CHANGED
|
@@ -573,6 +573,7 @@ const $merge_ = ({ into, on, whenNotMatched, ...notMatched }) => asStages([
|
|
|
573
573
|
},
|
|
574
574
|
},
|
|
575
575
|
]);
|
|
576
|
+
const $merge2 = (args) => $merge_(args);
|
|
576
577
|
|
|
577
578
|
const subMerge = (args, out, gid, extra, idPrefix, first) => {
|
|
578
579
|
const doubleReplace = (x) => x;
|
|
@@ -1384,14 +1385,12 @@ const $mergeX = (out, keys, f, map, whenNotMatched = 'fail', ext) => {
|
|
|
1384
1385
|
whenMatched: asStages([
|
|
1385
1386
|
{
|
|
1386
1387
|
$replaceWith: {
|
|
1387
|
-
old:
|
|
1388
|
-
? { $mergeObjects: ['$$ROOT', { deletedAt: '$deletedAt' }] }
|
|
1389
|
-
: '$$ROOT',
|
|
1388
|
+
old: '$$ROOT',
|
|
1390
1389
|
merged: {
|
|
1391
1390
|
$mergeObjects: [
|
|
1392
1391
|
'$$ROOT',
|
|
1393
1392
|
'$$new',
|
|
1394
|
-
...(setDeleted ? [{ deletedAt: '$deletedAt' }] : []),
|
|
1393
|
+
...(setDeleted ? [{ deletedAt: { $ifNull: ['$deletedAt', null] } }] : []),
|
|
1395
1394
|
],
|
|
1396
1395
|
},
|
|
1397
1396
|
},
|
|
@@ -1401,7 +1400,7 @@ const $mergeX = (out, keys, f, map, whenNotMatched = 'fail', ext) => {
|
|
|
1401
1400
|
$cond: {
|
|
1402
1401
|
if: {
|
|
1403
1402
|
$eq: [
|
|
1404
|
-
'$old',
|
|
1403
|
+
{ $mergeObjects: ['$old', { deletedAt: { $ifNull: ['$old.deletedAt', null] } }] },
|
|
1405
1404
|
{ $mergeObjects: ['$merged', { touchedAt: '$old.touchedAt' }] },
|
|
1406
1405
|
],
|
|
1407
1406
|
},
|
|
@@ -1630,7 +1629,7 @@ const getFirstStages = (view) => {
|
|
|
1630
1629
|
};
|
|
1631
1630
|
|
|
1632
1631
|
const streamNames = {};
|
|
1633
|
-
const executes$2 = (view, input, streamName, skip = false, after
|
|
1632
|
+
const executes$2 = (view, input, streamName, skip = false, after) => {
|
|
1634
1633
|
const { collection, projection, match } = view;
|
|
1635
1634
|
const { firstStages, hardMatch } = getFirstStages(view);
|
|
1636
1635
|
const db = collection.s.db, coll = collection.collectionName;
|
|
@@ -1819,7 +1818,7 @@ const executes$2 = (view, input, streamName, skip = false, after, allowEmtpies)
|
|
|
1819
1818
|
out: run,
|
|
1820
1819
|
};
|
|
1821
1820
|
};
|
|
1822
|
-
const staging = (view, streamName, skip = false, after
|
|
1821
|
+
const staging = (view, streamName, skip = false, after) => pipe(input => executes$2(view, input, streamName, skip, after), emptyDelta(), concatDelta, emptyDelta);
|
|
1823
1822
|
|
|
1824
1823
|
const executes$1 = (view, input, streamName, allowEmtpies) => {
|
|
1825
1824
|
const hash = crypto$1
|
|
@@ -2002,4 +2001,4 @@ const makeCol = async (docs, database, name) => {
|
|
|
2002
2001
|
}
|
|
2003
2002
|
};
|
|
2004
2003
|
|
|
2005
|
-
export { $accumulator, $and, $countDict, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $group_, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $insert, $insertPart, $insertX, $keys, $let, $lookup, $lt, $lte, $map, $map0, $map1, $match, $matchDelta, $merge, $merge_, $ne, $nin, $nor, $or, $outerLookup, $pushDict, $rand, $reduce, $replaceWith, $set, $simpleInsert, $simpleMerge, $simpleMergePart, $sum, $type, $unwind, $unwindDelta, Field, Machine, add, and, anyElementTrue, array, ceil, comp, concat$1 as concat, concatArray, createIndex, ctx, current, dateAdd, dateDiff, dateLt, datePart, dayAndMonthPart, divide, enablePreAndPostImages, eq, eqTyped, except, exprMapVal, field, fieldF, fieldM, filter, filterDefined, first$1 as first, firstSure, floor, from, func, gt, gte, inArray, isArray, ite, last, log, lt, lte, makeCol, map1, mapVal, max, maxDate, mergeExact, mergeExact0, mergeExpr, mergeObjects, minDate, monthPart, multiply, ne, nil, noop, not, notNull, now, or, pair, prepare, rand, range, regex, root, set, setField, single, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, weekPart, wrap, year };
|
|
2004
|
+
export { $accumulator, $and, $countDict, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $group_, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $insert, $insertPart, $insertX, $keys, $let, $lookup, $lt, $lte, $map, $map0, $map1, $match, $matchDelta, $merge, $merge2, $merge_, $ne, $nin, $nor, $or, $outerLookup, $pushDict, $rand, $reduce, $replaceWith, $set, $simpleInsert, $simpleMerge, $simpleMergePart, $sum, $type, $unwind, $unwindDelta, Field, Machine, add, and, anyElementTrue, array, ceil, comp, concat$1 as concat, concatArray, createIndex, ctx, current, dateAdd, dateDiff, dateLt, datePart, dayAndMonthPart, divide, enablePreAndPostImages, eq, eqTyped, except, exprMapVal, field, fieldF, fieldM, filter, filterDefined, first$1 as first, firstSure, floor, from, func, gt, gte, inArray, isArray, ite, last, log, lt, lte, makeCol, map1, mapVal, max, maxDate, mergeExact, mergeExact0, mergeExpr, mergeObjects, minDate, monthPart, multiply, ne, nil, noop, not, notNull, now, or, pair, prepare, rand, range, regex, root, set, setField, single, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, weekPart, wrap, year };
|
package/index.js
CHANGED
|
@@ -575,6 +575,7 @@ const $merge_ = ({ into, on, whenNotMatched, ...notMatched }) => asStages([
|
|
|
575
575
|
},
|
|
576
576
|
},
|
|
577
577
|
]);
|
|
578
|
+
const $merge2 = (args) => $merge_(args);
|
|
578
579
|
|
|
579
580
|
const subMerge = (args, out, gid, extra, idPrefix, first) => {
|
|
580
581
|
const doubleReplace = (x) => x;
|
|
@@ -1386,14 +1387,12 @@ const $mergeX = (out, keys, f, map, whenNotMatched = 'fail', ext) => {
|
|
|
1386
1387
|
whenMatched: asStages([
|
|
1387
1388
|
{
|
|
1388
1389
|
$replaceWith: {
|
|
1389
|
-
old:
|
|
1390
|
-
? { $mergeObjects: ['$$ROOT', { deletedAt: '$deletedAt' }] }
|
|
1391
|
-
: '$$ROOT',
|
|
1390
|
+
old: '$$ROOT',
|
|
1392
1391
|
merged: {
|
|
1393
1392
|
$mergeObjects: [
|
|
1394
1393
|
'$$ROOT',
|
|
1395
1394
|
'$$new',
|
|
1396
|
-
...(setDeleted ? [{ deletedAt: '$deletedAt' }] : []),
|
|
1395
|
+
...(setDeleted ? [{ deletedAt: { $ifNull: ['$deletedAt', null] } }] : []),
|
|
1397
1396
|
],
|
|
1398
1397
|
},
|
|
1399
1398
|
},
|
|
@@ -1403,7 +1402,7 @@ const $mergeX = (out, keys, f, map, whenNotMatched = 'fail', ext) => {
|
|
|
1403
1402
|
$cond: {
|
|
1404
1403
|
if: {
|
|
1405
1404
|
$eq: [
|
|
1406
|
-
'$old',
|
|
1405
|
+
{ $mergeObjects: ['$old', { deletedAt: { $ifNull: ['$old.deletedAt', null] } }] },
|
|
1407
1406
|
{ $mergeObjects: ['$merged', { touchedAt: '$old.touchedAt' }] },
|
|
1408
1407
|
],
|
|
1409
1408
|
},
|
|
@@ -1632,7 +1631,7 @@ const getFirstStages = (view) => {
|
|
|
1632
1631
|
};
|
|
1633
1632
|
|
|
1634
1633
|
const streamNames = {};
|
|
1635
|
-
const executes$2 = (view, input, streamName, skip = false, after
|
|
1634
|
+
const executes$2 = (view, input, streamName, skip = false, after) => {
|
|
1636
1635
|
const { collection, projection, match } = view;
|
|
1637
1636
|
const { firstStages, hardMatch } = getFirstStages(view);
|
|
1638
1637
|
const db = collection.s.db, coll = collection.collectionName;
|
|
@@ -1821,7 +1820,7 @@ const executes$2 = (view, input, streamName, skip = false, after, allowEmtpies)
|
|
|
1821
1820
|
out: run,
|
|
1822
1821
|
};
|
|
1823
1822
|
};
|
|
1824
|
-
const staging = (view, streamName, skip = false, after
|
|
1823
|
+
const staging = (view, streamName, skip = false, after) => pipe(input => executes$2(view, input, streamName, skip, after), emptyDelta(), concatDelta, emptyDelta);
|
|
1825
1824
|
|
|
1826
1825
|
const executes$1 = (view, input, streamName, allowEmtpies) => {
|
|
1827
1826
|
const hash = crypto$1
|
|
@@ -2036,6 +2035,7 @@ exports.$map1 = $map1;
|
|
|
2036
2035
|
exports.$match = $match;
|
|
2037
2036
|
exports.$matchDelta = $matchDelta;
|
|
2038
2037
|
exports.$merge = $merge;
|
|
2038
|
+
exports.$merge2 = $merge2;
|
|
2039
2039
|
exports.$merge_ = $merge_;
|
|
2040
2040
|
exports.$ne = $ne;
|
|
2041
2041
|
exports.$nin = $nin;
|