@omegup/msync 0.1.3 → 0.1.4
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 +8 -2
- package/index.esm.js +9 -3
- package/index.js +10 -2
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -187,7 +187,10 @@ type DeltaAccumulator<in out Doc, in out T, in out Ctx = unknown> = {
|
|
|
187
187
|
merge: <D, C = Ctx>(a: Expr<T | N, D, C>, b: Expr<T, D, C>) => Expr<T, D, C>;
|
|
188
188
|
};
|
|
189
189
|
|
|
190
|
-
declare const concat:
|
|
190
|
+
declare const concat: {
|
|
191
|
+
<D, C>(...expr: Expr<string, D, C>[]): Expr<string, D, C>;
|
|
192
|
+
<D, C>(...expr: Expr<string | N, D, C>[]): Expr<string | N, D, C>;
|
|
193
|
+
};
|
|
191
194
|
declare const regex: <D, C>(expr: Expr<string, D, C>, regex: Expr<string, D, C>, options?: Expr<string, D, C>) => Expr<boolean, D, C>;
|
|
192
195
|
declare const str: <D, C>(expr: Expr<unknown, D, C>) => Expr<string, D, C>;
|
|
193
196
|
declare const toInt: <D, C>(expr: Expr<unknown, D, C>) => Expr<number, D, C>;
|
|
@@ -489,6 +492,7 @@ type s = string;
|
|
|
489
492
|
type TOf<TT, K extends string> = doc & Omit<TT, K>;
|
|
490
493
|
declare const $unwind: <TT extends O, K extends s, U extends doc>(k: AsLiteral<K>, dict: RORec<K, "key"> & RORec<"_id", "id">, middle?: string) => DeltaStages<O, TOf<TT, K> & Rec<K, Arr<U>>, TOf<TT, K> & Rec<K, U>>;
|
|
491
494
|
|
|
495
|
+
type OutInputE<T, E, A = T | null> = ID & Rec<'after', A> & E;
|
|
492
496
|
type Allowed$2<K extends string> = Exclude<K, keyof (TS & ID)>;
|
|
493
497
|
type Patch<V, KK extends StrKey<V> = StrKey<V>> = ((OPick<V, Allowed$2<KK>> & ID) | (Rec<Allowed$2<KK>, N> & ID)) & TS;
|
|
494
498
|
type TakeDoc<V, E = ID, KK extends StrKey<V> = StrKey<V>> = OPick<V, Allowed$2<KK>> & E;
|
|
@@ -496,8 +500,10 @@ type ND$1 = {
|
|
|
496
500
|
readonly deletedAt?: null;
|
|
497
501
|
};
|
|
498
502
|
type SafeE$1<E> = Omit<E, `$${string}` | keyof ID>;
|
|
503
|
+
declare const $mergeId: <V extends O>() => <SourcePart extends doc, Out extends doc, E = unknown, EEE extends RORec<string, rawItem> = {}>(out: RWCollection<Out | Replace<Out, Patch<V>>, Out>, keys: ExprsExact<TakeDoc<V, unknown>, SourcePart>, id: Expr<string, OutInputE<TakeDoc<V>, E, null>>, ext: Exact<Omit<SafeE$1<EEE>, keyof (ND$1 & TS)>, IdHKT>, whenNotMatched: "fail" | "discard") => StreamRunnerParam<OutInputE<SourcePart, E>, "out">;
|
|
499
504
|
declare const $simpleMergePart: <V extends O>() => <Source extends doc, Out extends doc, EEE extends RORec<string, rawItem>>(out: RWCollection<Out | Replace<Out, Patch<V>>, Out>, keys: ExprsExact<TakeDoc<V, unknown>, Source>, whenNotMatched: "fail" | "discard", ext: Exact<Omit<SafeE$1<EEE>, keyof (ND$1 & TS)>, IdHKT>) => StreamRunnerParam<Source, "out">;
|
|
500
505
|
declare const $simpleMerge: <V extends O>() => <Source extends doc, Out extends doc>(out: RWCollection<Out | Replace<Out, Patch<V>>, Out>, keys: ExprsExact<TakeDoc<V, unknown>, Source>, whenNotMatched?: "fail" | "discard") => StreamRunnerParam<Source, "out">;
|
|
506
|
+
declare const $mergePart: <V extends O>() => <Out extends doc, SourcePart extends doc, EEE extends RORec<string, rawItem>>(out: RWCollection<Out | Replace<Out, Patch<V>>, Out>, keys: ExprsExact<TakeDoc<V, unknown>, SourcePart>, ext: Exact<Omit<SafeE$1<EEE>, keyof (ND$1 & TS)>, IdHKT>, whenNotMatched?: "fail" | "discard") => StreamRunnerParam<Delta<SourcePart>, "out">;
|
|
501
507
|
declare const $merge: <V extends O>() => <Out extends doc, SourcePart extends doc>(out: RWCollection<Out | Replace<Out, Patch<V>>, Out>, keys: ExprsExact<TakeDoc<V, unknown>, SourcePart>, whenNotMatched?: "fail" | "discard") => StreamRunnerParam<Delta<SourcePart>, "out">;
|
|
502
508
|
|
|
503
509
|
type ND = {
|
|
@@ -704,4 +710,4 @@ declare const enablePreAndPostImages: <T extends doc>(coll: Collection<T>) => Pr
|
|
|
704
710
|
declare const prepare: (testName?: string) => Promise<MongoClient$1>;
|
|
705
711
|
declare const makeCol: <T extends ID>(docs: readonly OptionalUnlessRequiredId<T>[], database: Db, name?: string) => Promise<Collection<T>>;
|
|
706
712
|
|
|
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 };
|
|
713
|
+
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, $mergeId, $mergePart, $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
|
@@ -1400,7 +1400,12 @@ const $mergeX = (out, keys, f, map, whenNotMatched = 'fail', ext) => {
|
|
|
1400
1400
|
$cond: {
|
|
1401
1401
|
if: {
|
|
1402
1402
|
$eq: [
|
|
1403
|
-
{
|
|
1403
|
+
{
|
|
1404
|
+
$mergeObjects: [
|
|
1405
|
+
'$old',
|
|
1406
|
+
{ deletedAt: { $ifNull: ['$old.deletedAt', null] } },
|
|
1407
|
+
],
|
|
1408
|
+
},
|
|
1404
1409
|
{ $mergeObjects: ['$merged', { touchedAt: '$old.touchedAt' }] },
|
|
1405
1410
|
],
|
|
1406
1411
|
},
|
|
@@ -1436,7 +1441,8 @@ const $mergeId = () => (out, keys, id, ext, whenNotMatched) => {
|
|
|
1436
1441
|
};
|
|
1437
1442
|
const $simpleMergePart = () => (out, keys, whenNotMatched, ext) => $mergeX(out, keys, root(), id$1, whenNotMatched, ext);
|
|
1438
1443
|
const $simpleMerge = () => (out, keys, whenNotMatched = 'fail') => $mergeX(out, keys, root(), id$1, whenNotMatched, {});
|
|
1439
|
-
const $
|
|
1444
|
+
const $mergePart = () => (out, keys, ext, whenNotMatched = 'fail') => $mergeId()(out, keys, assertNotNull$1(root().of('before').of('_id').expr()), ext, whenNotMatched);
|
|
1445
|
+
const $merge = () => (out, keys, whenNotMatched = 'fail') => $mergePart()(out, keys, {}, whenNotMatched);
|
|
1440
1446
|
const assertNotNull$1 = (expr) => expr;
|
|
1441
1447
|
|
|
1442
1448
|
const $insertX = (out, expr, map, ext, extExpr) => {
|
|
@@ -2001,4 +2007,4 @@ const makeCol = async (docs, database, name) => {
|
|
|
2001
2007
|
}
|
|
2002
2008
|
};
|
|
2003
2009
|
|
|
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 };
|
|
2010
|
+
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, $mergeId, $mergePart, $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
|
@@ -1402,7 +1402,12 @@ const $mergeX = (out, keys, f, map, whenNotMatched = 'fail', ext) => {
|
|
|
1402
1402
|
$cond: {
|
|
1403
1403
|
if: {
|
|
1404
1404
|
$eq: [
|
|
1405
|
-
{
|
|
1405
|
+
{
|
|
1406
|
+
$mergeObjects: [
|
|
1407
|
+
'$old',
|
|
1408
|
+
{ deletedAt: { $ifNull: ['$old.deletedAt', null] } },
|
|
1409
|
+
],
|
|
1410
|
+
},
|
|
1406
1411
|
{ $mergeObjects: ['$merged', { touchedAt: '$old.touchedAt' }] },
|
|
1407
1412
|
],
|
|
1408
1413
|
},
|
|
@@ -1438,7 +1443,8 @@ const $mergeId = () => (out, keys, id, ext, whenNotMatched) => {
|
|
|
1438
1443
|
};
|
|
1439
1444
|
const $simpleMergePart = () => (out, keys, whenNotMatched, ext) => $mergeX(out, keys, root(), id$1, whenNotMatched, ext);
|
|
1440
1445
|
const $simpleMerge = () => (out, keys, whenNotMatched = 'fail') => $mergeX(out, keys, root(), id$1, whenNotMatched, {});
|
|
1441
|
-
const $
|
|
1446
|
+
const $mergePart = () => (out, keys, ext, whenNotMatched = 'fail') => $mergeId()(out, keys, assertNotNull$1(root().of('before').of('_id').expr()), ext, whenNotMatched);
|
|
1447
|
+
const $merge = () => (out, keys, whenNotMatched = 'fail') => $mergePart()(out, keys, {}, whenNotMatched);
|
|
1442
1448
|
const assertNotNull$1 = (expr) => expr;
|
|
1443
1449
|
|
|
1444
1450
|
const $insertX = (out, expr, map, ext, extExpr) => {
|
|
@@ -2036,6 +2042,8 @@ exports.$match = $match;
|
|
|
2036
2042
|
exports.$matchDelta = $matchDelta;
|
|
2037
2043
|
exports.$merge = $merge;
|
|
2038
2044
|
exports.$merge2 = $merge2;
|
|
2045
|
+
exports.$mergeId = $mergeId;
|
|
2046
|
+
exports.$mergePart = $mergePart;
|
|
2039
2047
|
exports.$merge_ = $merge_;
|
|
2040
2048
|
exports.$ne = $ne;
|
|
2041
2049
|
exports.$nin = $nin;
|