@omegup/msync 0.0.61 → 0.0.63

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
@@ -457,9 +457,7 @@ type Params<As extends string, LQ extends O, RQ extends O, RE extends RQ, S exte
457
457
  as: AsLiteral<As>;
458
458
  };
459
459
  declare const $lookup: <As extends string, LQ extends doc, RQ extends O, RE extends RQ & doc, S extends notArr>(p: Params<As, LQ, RQ, RE, S>) => <LE extends LQ>(l: SnapshotStream<LQ, LE>) => SnapshotStream<LQ, LE & RORec<As, RE>>;
460
- declare const $outerLookup: <As extends string, LQ extends doc, RQ extends O, RE extends RQ & doc, S extends notArr, Null extends null = never>(p: Params<As, LQ, RQ, RE, S>, outer?: {
461
- left?: Null;
462
- }) => <LE extends LQ>(l: SnapshotStream<LQ, LE>) => SnapshotStream<LQ, LE & RORec<As, RE | Null>>;
460
+ declare const $outerLookup: <As extends string, LQ extends doc, RQ extends O, RE extends RQ & doc, S extends notArr>(p: Params<As, LQ, RQ, RE, S>) => <LE extends LQ>(l: SnapshotStream<LQ, LE>) => SnapshotStream<LQ, LE & RORec<As, RE | null>>;
463
461
 
464
462
  declare const $matchDelta: <T extends doc>(query: Expr<boolean, T>) => RawStages<unknown, Delta<T>, Delta<T>, unknown, number>;
465
463
 
@@ -565,6 +563,7 @@ declare const sortArray: <T, D, C, K extends keyof T>({ sortBy, expr, order, }:
565
563
  order?: 1 | -1;
566
564
  }) => Expr<Arr<T>, D, C>;
567
565
  declare const isArray: <T extends notArr, D, C, F extends HKT<T | Arr<T>>>(expr: Expr<T | Arr<T>, D & (App<F, T> | App<F, Arr<T>>), C>) => BoolExpr<D & App<F, Arr<T>>, D & App<F, T>, C>;
566
+ declare const inArray: <T, D, C>(item: Expr<T, D, C>, expr: Expr<Arr<T>, D, C>) => Expr<boolean, D, C>;
568
567
  declare const array: <T, D, C = unknown>(...exprs: Expr<T, D, C>[]) => Expr<Arr<T>, D, C>;
569
568
  declare const concatArray: <T, D, C>(...exprs: Expr<Arr<T>, D, C>[]) => Expr<Arr<T>, D, C>;
570
569
  declare const first: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T | null, D, C>;
@@ -572,7 +571,7 @@ declare const firstSure: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T, D, C>;
572
571
  declare const last: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T | null, D, C>;
573
572
  type NullToOBJ<N extends null> = N extends null ? O : N;
574
573
  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 anyElementTrue: <T, D, C = unknown>(expr: Expr<Arr<boolean>, D, C>) => Expr<boolean, D, C>;
574
+ declare const anyElementTrue: <D, C = unknown>(expr: Expr<Arr<boolean>, D, C>) => Expr<boolean, D, C>;
576
575
  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
576
  declare const except: <T, D, C>(a: Expr<Arr<T>, D, C>, b: Expr<Arr<T>, D, C>) => Expr<Arr<T>, D, C>;
578
577
 
@@ -682,4 +681,4 @@ declare const enablePreAndPostImages: <T extends doc>(coll: Collection<T>) => Pr
682
681
  declare const prepare: (testName?: string) => Promise<MongoClient$1>;
683
682
  declare const makeCol: <T extends ID>(docs: readonly OptionalUnlessRequiredId<T>[], database: Db, name?: string) => Promise<Collection<T>>;
684
683
 
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 };
684
+ 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, 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 };
package/index.esm.js CHANGED
@@ -392,6 +392,9 @@ const sortArray = ({ sortBy, expr, order, }) => asExpr({
392
392
  const isArray = (expr) => asBoolExpr({
393
393
  raw: f => asExprRaw({ $isArray: expr.raw(f).get() }),
394
394
  });
395
+ const inArray = (item, expr) => asExpr({
396
+ raw: f => asExprRaw({ $in: [item.raw(f).get(), expr.raw(f).get()] }),
397
+ });
395
398
  const array = (...exprs) => asExpr({
396
399
  raw: f => asExprRaw(exprs.map(x => x.raw(f).get())),
397
400
  });
@@ -1284,13 +1287,13 @@ const $lookup = (p) => (l) => $lookup1({
1284
1287
  rField: p.foreignField,
1285
1288
  left: l(emptyDelta()),
1286
1289
  });
1287
- const $outerLookup = (p, outer) => (l) => $lookup1({
1290
+ const $outerLookup = (p) => (l) => $lookup1({
1288
1291
  right: p.from,
1289
1292
  as: p.as,
1290
1293
  lField: p.localField,
1291
1294
  rField: p.foreignField,
1292
1295
  left: l(emptyDelta()),
1293
- }, outer?.left);
1296
+ }, null);
1294
1297
 
1295
1298
  const filterUndefined = (applyOperator) => {
1296
1299
  return (op, args) => applyOperator(op, args.filter(defined));
@@ -1851,4 +1854,4 @@ const makeCol = async (docs, database, name) => {
1851
1854
  }
1852
1855
  };
1853
1856
 
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 };
1857
+ 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, 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 };
package/index.js CHANGED
@@ -394,6 +394,9 @@ const sortArray = ({ sortBy, expr, order, }) => asExpr({
394
394
  const isArray = (expr) => asBoolExpr({
395
395
  raw: f => asExprRaw({ $isArray: expr.raw(f).get() }),
396
396
  });
397
+ const inArray = (item, expr) => asExpr({
398
+ raw: f => asExprRaw({ $in: [item.raw(f).get(), expr.raw(f).get()] }),
399
+ });
397
400
  const array = (...exprs) => asExpr({
398
401
  raw: f => asExprRaw(exprs.map(x => x.raw(f).get())),
399
402
  });
@@ -1286,13 +1289,13 @@ const $lookup = (p) => (l) => $lookup1({
1286
1289
  rField: p.foreignField,
1287
1290
  left: l(emptyDelta()),
1288
1291
  });
1289
- const $outerLookup = (p, outer) => (l) => $lookup1({
1292
+ const $outerLookup = (p) => (l) => $lookup1({
1290
1293
  right: p.from,
1291
1294
  as: p.as,
1292
1295
  lField: p.localField,
1293
1296
  rField: p.foreignField,
1294
1297
  left: l(emptyDelta()),
1295
- }, outer?.left);
1298
+ }, null);
1296
1299
 
1297
1300
  const filterUndefined = (applyOperator) => {
1298
1301
  return (op, args) => applyOperator(op, args.filter(defined));
@@ -1935,6 +1938,7 @@ exports.from = from;
1935
1938
  exports.func = func;
1936
1939
  exports.gt = gt;
1937
1940
  exports.gte = gte;
1941
+ exports.inArray = inArray;
1938
1942
  exports.isArray = isArray;
1939
1943
  exports.ite = ite;
1940
1944
  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.61",
6
+ "version": "0.0.63",
7
7
  "dependencies": {
8
8
  "dayjs": "^1.11.9",
9
9
  "dotenv": "^16.3.1",