@omegup/msync 0.0.8 → 0.0.10
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 +3 -2
- package/index.esm.js +8 -2
- package/index.js +8 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -469,7 +469,8 @@ declare const $unwind: <T extends doc, K extends s, U extends doc>(k: AsLiteral<
|
|
|
469
469
|
type OutInputE<T, E, A = T | null> = ID & Rec<'after', A> & E;
|
|
470
470
|
type Allowed$2<K extends string> = Exclude<K, keyof (TS & ID)>;
|
|
471
471
|
type Patch<V, KK extends StrKey<V>> = ((OPick<V, Allowed$2<KK>> & ID) | (Rec<Allowed$2<KK>, N> & ID)) & TS;
|
|
472
|
-
declare const $
|
|
472
|
+
declare const $simpleMerge: <V extends Model & ID>() => <KK extends StrKey<V>, Out extends doc>(out: RWCollection<Out | Replace<Out, Patch<V, KK>>, Out>, keys: ExactKeys<Allowed$2<KK>>) => RawStages<unknown, OutInputE<OPick<V, Allowed$2<KK>> & ID, unknown>, "out">;
|
|
473
|
+
declare const $merge: <V extends Model & ID>() => <KK extends StrKey<V>, Out extends doc>(out: RWCollection<Out | Replace<Out, Patch<V, KK>>, Out>, keys: ExactKeys<Allowed$2<KK>>) => RawStages<unknown, Delta<OPick<V, Allowed$2<KK>> & ID>, "out">;
|
|
473
474
|
|
|
474
475
|
type ND = {
|
|
475
476
|
readonly deletedAt?: null;
|
|
@@ -641,4 +642,4 @@ declare const enablePreAndPostImages: <T extends doc>(coll: Collection<T>) => Pr
|
|
|
641
642
|
declare const prepare: (testName?: string) => Promise<MongoClient$1>;
|
|
642
643
|
declare const makeCol: <T extends ID>(docs: readonly OptionalUnlessRequiredId<T>[], database: Db, name?: string) => Promise<Collection<T>>;
|
|
643
644
|
|
|
644
|
-
export { $accumulator, $and, $countDict, $entries, $eq, $expr, $getField, $group, $groupId, $groupMerge, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $keys, $let, $lookup, $lt, $lte, $map, $map1, $match, $matchDelta, $merge, $merge_, $ne, $nin, $nor, $or, $pushDict, $rand, $replaceWith, $set, $sum, $unwind, $unwindDelta, $upsert, 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 N, type NoRaw, 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, 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, type notArr, notNull, now, or, pair, prepare, rand, range, root, set, setField, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, weekPart, wrap };
|
|
645
|
+
export { $accumulator, $and, $countDict, $entries, $eq, $expr, $getField, $group, $groupId, $groupMerge, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $keys, $let, $lookup, $lt, $lte, $map, $map1, $match, $matchDelta, $merge, $merge_, $ne, $nin, $nor, $or, $pushDict, $rand, $replaceWith, $set, $simpleMerge, $sum, $unwind, $unwindDelta, $upsert, 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 N, type NoRaw, 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, 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, type notArr, notNull, now, or, pair, prepare, rand, range, root, set, setField, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, weekPart, wrap };
|
package/index.esm.js
CHANGED
|
@@ -1010,7 +1010,7 @@ const $replaceWith = (expr) => ({
|
|
|
1010
1010
|
lin: $replaceWith_(expr),
|
|
1011
1011
|
});
|
|
1012
1012
|
|
|
1013
|
-
const $
|
|
1013
|
+
const $mergeId = () => (out, keys, id) => {
|
|
1014
1014
|
const omRORec = omitRORec();
|
|
1015
1015
|
const patch = mapExactToObject(keys, (_, k) => [k, root().of('after').of(k).expr()]);
|
|
1016
1016
|
const replacer = ite(eqTyped(root().of('after').expr(), nil), field(omRORec.backward(spread(mapExact(keys, () => nil), {
|
|
@@ -1029,6 +1029,12 @@ const $merge = () => (out, keys, id) => {
|
|
|
1029
1029
|
whenMatched: 'merge',
|
|
1030
1030
|
})).stages;
|
|
1031
1031
|
};
|
|
1032
|
+
const $simpleMerge = () => (out, keys) => $mergeId()(out, keys, root().of('_id').expr());
|
|
1033
|
+
const $merge = () => (out, keys) => $mergeId()(out, keys, assertNotNull(root()
|
|
1034
|
+
.of('before')
|
|
1035
|
+
.of('_id')
|
|
1036
|
+
.expr()));
|
|
1037
|
+
const assertNotNull = (expr) => expr;
|
|
1032
1038
|
|
|
1033
1039
|
const $upsert = (out) => {
|
|
1034
1040
|
const replacer = ite(eqTyped(root().of('after').expr(), nil), field({
|
|
@@ -1615,4 +1621,4 @@ const makeCol = async (docs, database, name) => {
|
|
|
1615
1621
|
}
|
|
1616
1622
|
};
|
|
1617
1623
|
|
|
1618
|
-
export { $accumulator, $and, $countDict, $entries, $eq, $expr, $getField, $group, $groupId, $groupMerge, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $keys, $let, $lookup, $lt, $lte, $map, $map1, $match, $matchDelta, $merge, $merge_, $ne, $nin, $nor, $or, $pushDict, $rand, $replaceWith, $set, $sum, $unwind, $unwindDelta, $upsert, Field, Machine, add, and, 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, notNull, now, or, pair, prepare, rand, range, root, set, setField, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, weekPart, wrap };
|
|
1624
|
+
export { $accumulator, $and, $countDict, $entries, $eq, $expr, $getField, $group, $groupId, $groupMerge, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $keys, $let, $lookup, $lt, $lte, $map, $map1, $match, $matchDelta, $merge, $merge_, $ne, $nin, $nor, $or, $pushDict, $rand, $replaceWith, $set, $simpleMerge, $sum, $unwind, $unwindDelta, $upsert, Field, Machine, add, and, 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, notNull, now, or, pair, prepare, rand, range, root, set, setField, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, weekPart, wrap };
|
package/index.js
CHANGED
|
@@ -1012,7 +1012,7 @@ const $replaceWith = (expr) => ({
|
|
|
1012
1012
|
lin: $replaceWith_(expr),
|
|
1013
1013
|
});
|
|
1014
1014
|
|
|
1015
|
-
const $
|
|
1015
|
+
const $mergeId = () => (out, keys, id) => {
|
|
1016
1016
|
const omRORec = omitRORec();
|
|
1017
1017
|
const patch = mapExactToObject(keys, (_, k) => [k, root().of('after').of(k).expr()]);
|
|
1018
1018
|
const replacer = ite(eqTyped(root().of('after').expr(), nil), field(omRORec.backward(spread(mapExact(keys, () => nil), {
|
|
@@ -1031,6 +1031,12 @@ const $merge = () => (out, keys, id) => {
|
|
|
1031
1031
|
whenMatched: 'merge',
|
|
1032
1032
|
})).stages;
|
|
1033
1033
|
};
|
|
1034
|
+
const $simpleMerge = () => (out, keys) => $mergeId()(out, keys, root().of('_id').expr());
|
|
1035
|
+
const $merge = () => (out, keys) => $mergeId()(out, keys, assertNotNull(root()
|
|
1036
|
+
.of('before')
|
|
1037
|
+
.of('_id')
|
|
1038
|
+
.expr()));
|
|
1039
|
+
const assertNotNull = (expr) => expr;
|
|
1034
1040
|
|
|
1035
1041
|
const $upsert = (out) => {
|
|
1036
1042
|
const replacer = ite(eqTyped(root().of('after').expr(), nil), field({
|
|
@@ -1652,6 +1658,7 @@ exports.$pushDict = $pushDict;
|
|
|
1652
1658
|
exports.$rand = $rand;
|
|
1653
1659
|
exports.$replaceWith = $replaceWith;
|
|
1654
1660
|
exports.$set = $set;
|
|
1661
|
+
exports.$simpleMerge = $simpleMerge;
|
|
1655
1662
|
exports.$sum = $sum;
|
|
1656
1663
|
exports.$unwind = $unwind;
|
|
1657
1664
|
exports.$unwindDelta = $unwindDelta;
|