@omegup/msync 0.0.59 → 0.0.61

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
@@ -572,7 +572,7 @@ declare const firstSure: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T, D, C>;
572
572
  declare const last: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T | null, D, C>;
573
573
  type NullToOBJ<N extends null> = N extends null ? O : N;
574
574
  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>;
575
- 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 anyElementTrue: <T, D, C = unknown>(expr: Expr<Arr<boolean>, D, C>) => Expr<boolean, D, C>;
576
576
  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>;
577
577
  declare const except: <T, D, C>(a: Expr<Arr<T>, D, C>, b: Expr<Arr<T>, D, C>) => Expr<Arr<T>, D, C>;
578
578
 
@@ -614,6 +614,11 @@ declare const setField: <K extends string, T, V, D, C>({ field, input, value, }:
614
614
  }) => Expr<T & Record<K, V>, D, C>;
615
615
 
616
616
  declare const range: <D, C>(start: Expr<number, D, C>, end: Expr<number, D, C>, step?: Expr<number, D, C>) => Expr<Arr<number>, D, C>;
617
+ declare const $map0: <K extends string, T, R, D, C>({ as, expr, input, }: {
618
+ input: Expr<Arr<T>, D, C>;
619
+ as: K;
620
+ expr: Expr<R, D, RORec<K, T> & C>;
621
+ }) => Expr<Arr<R>, D, C>;
617
622
  declare const $map1: <T, R, D, C>(ex: Expr<Arr<T>, D, C>, map: (i: Field<unknown, T, RORec<"item", T>>) => Expr<R, D, RORec<"item", T> & C>) => Expr<Arr<R>, D, C>;
618
623
  declare const $map: <T, R, D, C = unknown>(ex: Expr<Arr<T>, D, C>, map: (i: Expr<T, D, RORec<"item", T>>) => Expr<R, D, RORec<"item", T> & C>) => Expr<Arr<R>, D, C>;
619
624
 
@@ -677,4 +682,4 @@ declare const enablePreAndPostImages: <T extends doc>(coll: Collection<T>) => Pr
677
682
  declare const prepare: (testName?: string) => Promise<MongoClient$1>;
678
683
  declare const makeCol: <T extends ID>(docs: readonly OptionalUnlessRequiredId<T>[], database: Db, name?: string) => Promise<Collection<T>>;
679
684
 
680
- export { $accumulator, $and, $countDict, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $insert, $insertX, $keys, $let, $lookup, $lt, $lte, $map, $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, 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, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, weekPart, wrap, year };
685
+ export { $accumulator, $and, $countDict, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $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, 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, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, weekPart, wrap, year };
package/index.esm.js CHANGED
@@ -408,8 +408,8 @@ const last = (expr) => asExpr({
408
408
  const mergeObjects = (...exprs) => asExpr({
409
409
  raw: f => asExprRaw({ $mergeObjects: exprs.map(x => x.raw(f).get()) }),
410
410
  });
411
- const inArray = (...exprs) => asExpr({
412
- raw: f => asExprRaw({ $in: exprs.map(x => x.raw(f).get()) }),
411
+ const anyElementTrue = (expr) => asExpr({
412
+ raw: f => asExprRaw({ $anyElementTrue: expr.raw(f).get() }),
413
413
  });
414
414
  const reduce = (input, initialValue, inExpr) => asExpr({
415
415
  raw: f => asExprRaw({
@@ -882,15 +882,16 @@ const dateDiff = ({ end, unit, start, }) => asExpr({
882
882
  const range = (start, end, step) => asExpr({
883
883
  raw: f => asExprRaw({ $range: [start.raw(f).get(), end.raw(f).get(), step?.raw(f).get() ?? 1] }),
884
884
  });
885
- const $map1 = (ex, map) => asExpr({
885
+ const $map0 = ({ as, expr, input, }) => asExpr({
886
886
  raw: f => asExprRaw({
887
887
  $map: {
888
- input: ex.raw(f).get(),
889
- as: 'item',
890
- in: map(ctx()('item')).raw(f).get(),
888
+ input: input.raw(f).get(),
889
+ as,
890
+ in: expr.raw(f).get(),
891
891
  },
892
892
  }),
893
893
  });
894
+ const $map1 = (ex, map) => $map0({ input: ex, as: 'item', expr: map(ctx()('item')) });
894
895
  const $map = (ex, map) => $map1(ex, i => map(i.expr()));
895
896
 
896
897
  const operator = () => (op) => (operand) => {
@@ -1850,4 +1851,4 @@ const makeCol = async (docs, database, name) => {
1850
1851
  }
1851
1852
  };
1852
1853
 
1853
- export { $accumulator, $and, $countDict, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $insert, $insertX, $keys, $let, $lookup, $lt, $lte, $map, $map1, $match, $matchDelta, $merge, $merge_, $ne, $nin, $nor, $or, $outerLookup, $pushDict, $rand, $replaceWith, $set, $simpleInsert, $simpleMerge, $sum, $type, $unwind, $unwindDelta, 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, not, notNull, now, or, pair, prepare, rand, range, regex, root, set, setField, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, weekPart, wrap, year };
1854
+ export { $accumulator, $and, $countDict, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $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, 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, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, weekPart, wrap, year };
package/index.js CHANGED
@@ -410,8 +410,8 @@ const last = (expr) => asExpr({
410
410
  const mergeObjects = (...exprs) => asExpr({
411
411
  raw: f => asExprRaw({ $mergeObjects: exprs.map(x => x.raw(f).get()) }),
412
412
  });
413
- const inArray = (...exprs) => asExpr({
414
- raw: f => asExprRaw({ $in: exprs.map(x => x.raw(f).get()) }),
413
+ const anyElementTrue = (expr) => asExpr({
414
+ raw: f => asExprRaw({ $anyElementTrue: expr.raw(f).get() }),
415
415
  });
416
416
  const reduce = (input, initialValue, inExpr) => asExpr({
417
417
  raw: f => asExprRaw({
@@ -884,15 +884,16 @@ const dateDiff = ({ end, unit, start, }) => asExpr({
884
884
  const range = (start, end, step) => asExpr({
885
885
  raw: f => asExprRaw({ $range: [start.raw(f).get(), end.raw(f).get(), step?.raw(f).get() ?? 1] }),
886
886
  });
887
- const $map1 = (ex, map) => asExpr({
887
+ const $map0 = ({ as, expr, input, }) => asExpr({
888
888
  raw: f => asExprRaw({
889
889
  $map: {
890
- input: ex.raw(f).get(),
891
- as: 'item',
892
- in: map(ctx()('item')).raw(f).get(),
890
+ input: input.raw(f).get(),
891
+ as,
892
+ in: expr.raw(f).get(),
893
893
  },
894
894
  }),
895
895
  });
896
+ const $map1 = (ex, map) => $map0({ input: ex, as: 'item', expr: map(ctx()('item')) });
896
897
  const $map = (ex, map) => $map1(ex, i => map(i.expr()));
897
898
 
898
899
  const operator = () => (op) => (operand) => {
@@ -1877,6 +1878,7 @@ exports.$lookup = $lookup;
1877
1878
  exports.$lt = $lt;
1878
1879
  exports.$lte = $lte;
1879
1880
  exports.$map = $map;
1881
+ exports.$map0 = $map0;
1880
1882
  exports.$map1 = $map1;
1881
1883
  exports.$match = $match;
1882
1884
  exports.$matchDelta = $matchDelta;
@@ -1901,6 +1903,7 @@ exports.Field = Field;
1901
1903
  exports.Machine = Machine;
1902
1904
  exports.add = add;
1903
1905
  exports.and = and;
1906
+ exports.anyElementTrue = anyElementTrue;
1904
1907
  exports.array = array;
1905
1908
  exports.ceil = ceil;
1906
1909
  exports.comp = comp;
@@ -1932,7 +1935,6 @@ exports.from = from;
1932
1935
  exports.func = func;
1933
1936
  exports.gt = gt;
1934
1937
  exports.gte = gte;
1935
- exports.inArray = inArray;
1936
1938
  exports.isArray = isArray;
1937
1939
  exports.ite = ite;
1938
1940
  exports.last = last;
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.59",
6
+ "version": "0.0.61",
7
7
  "dependencies": {
8
8
  "dayjs": "^1.11.9",
9
9
  "dotenv": "^16.3.1",