@omegup/msync 0.0.75 → 0.0.76

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 CHANGED
@@ -581,6 +581,8 @@ declare const last: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T | null, D, C>;
581
581
  type NullToOBJ<N extends null> = N extends null ? O : N;
582
582
  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>;
583
583
  declare const anyElementTrue: <D, C = unknown>(expr: Expr<Arr<boolean>, D, C>) => Expr<boolean, D, C>;
584
+ type Reduce<T, V> = RORec<'value', V> & RORec<'this', T>;
585
+ declare const $reduce: <T, V, D, C>(input: Expr<Arr<T>, D, C>, initialValue: Expr<V, D, C>, inExpr: Expr<V, D, C & Reduce<T, V>>) => Expr<V, D, C>;
584
586
  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>;
585
587
  declare const except: <T, D, C>(a: Expr<Arr<T>, D, C>, b: Expr<Arr<T>, D, C>) => Expr<Arr<T>, D, C>;
586
588
 
@@ -690,4 +692,4 @@ declare const enablePreAndPostImages: <T extends doc>(coll: Collection<T>) => Pr
690
692
  declare const prepare: (testName?: string) => Promise<MongoClient$1>;
691
693
  declare const makeCol: <T extends ID>(docs: readonly OptionalUnlessRequiredId<T>[], database: Db, name?: string) => Promise<Collection<T>>;
692
694
 
693
- export { $accumulator, $and, $countDict, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $group_, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $insert, $insertX, $keys, $let, $lookup, $lt, $lte, $map, $map0, $map1, $match, $matchDelta, $merge, $merge_, $ne, $nin, $nor, $or, $outerLookup, $pushDict, $rand, $replaceWith, $set, $simpleInsert, $simpleMerge, $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 };
695
+ export { $accumulator, $and, $countDict, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $group_, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $insert, $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, $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
@@ -414,7 +414,7 @@ const mergeObjects = (...exprs) => asExpr({
414
414
  const anyElementTrue = (expr) => asExpr({
415
415
  raw: f => asExprRaw({ $anyElementTrue: expr.raw(f).get() }),
416
416
  });
417
- const reduce = (input, initialValue, inExpr) => asExpr({
417
+ const $reduce = (input, initialValue, inExpr) => asExpr({
418
418
  raw: f => asExprRaw({
419
419
  $reduce: {
420
420
  input: input.raw(f).get(),
@@ -442,7 +442,7 @@ const except = (a, b) => {
442
442
  return $let({
443
443
  res: [
444
444
  'res',
445
- reduce(a, field({ out: ['out', array()], except: ['except', b] }), $let({
445
+ $reduce(a, field({ out: ['out', array()], except: ['except', b] }), $let({
446
446
  indexInExcept: ['indexInExcept', indexOfArray(except, curr)],
447
447
  }, ite(gte(indexInExcept, val(0)), field({
448
448
  out: ['out', out],
@@ -1899,4 +1899,4 @@ const makeCol = async (docs, database, name) => {
1899
1899
  }
1900
1900
  };
1901
1901
 
1902
- export { $accumulator, $and, $countDict, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $group_, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $insert, $insertX, $keys, $let, $lookup, $lt, $lte, $map, $map0, $map1, $match, $matchDelta, $merge, $merge_, $ne, $nin, $nor, $or, $outerLookup, $pushDict, $rand, $replaceWith, $set, $simpleInsert, $simpleMerge, $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 };
1902
+ export { $accumulator, $and, $countDict, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $group_, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $insert, $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, $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
@@ -416,7 +416,7 @@ const mergeObjects = (...exprs) => asExpr({
416
416
  const anyElementTrue = (expr) => asExpr({
417
417
  raw: f => asExprRaw({ $anyElementTrue: expr.raw(f).get() }),
418
418
  });
419
- const reduce = (input, initialValue, inExpr) => asExpr({
419
+ const $reduce = (input, initialValue, inExpr) => asExpr({
420
420
  raw: f => asExprRaw({
421
421
  $reduce: {
422
422
  input: input.raw(f).get(),
@@ -444,7 +444,7 @@ const except = (a, b) => {
444
444
  return $let({
445
445
  res: [
446
446
  'res',
447
- reduce(a, field({ out: ['out', array()], except: ['except', b] }), $let({
447
+ $reduce(a, field({ out: ['out', array()], except: ['except', b] }), $let({
448
448
  indexInExcept: ['indexInExcept', indexOfArray(except, curr)],
449
449
  }, ite(gte(indexInExcept, val(0)), field({
450
450
  out: ['out', out],
@@ -1940,6 +1940,7 @@ exports.$or = $or;
1940
1940
  exports.$outerLookup = $outerLookup;
1941
1941
  exports.$pushDict = $pushDict;
1942
1942
  exports.$rand = $rand;
1943
+ exports.$reduce = $reduce;
1943
1944
  exports.$replaceWith = $replaceWith;
1944
1945
  exports.$set = $set;
1945
1946
  exports.$simpleInsert = $simpleInsert;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "module": "index.esm.js",
4
4
  "typings": "index.d.ts",
5
5
  "name": "@omegup/msync",
6
- "version": "0.0.75",
6
+ "version": "0.0.76",
7
7
  "dependencies": {
8
8
  "dayjs": "^1.11.9",
9
9
  "dotenv": "^16.3.1",