@omegup/msync 0.0.11 → 0.0.13

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
@@ -556,6 +556,7 @@ declare const dayAndMonthPart: <D, C>(date: Expr<Date, D, C>) => Expr<string, D,
556
556
  declare const now: <D, C>() => Expr<Date, D, C>;
557
557
  declare const monthPart: <D, C>(date: Expr<Date, D, C>) => Expr<string, D, C>;
558
558
  declare const weekPart: <D, C>(date: Expr<Date, D, C>) => Expr<string, D, C>;
559
+ declare const year: <D, C>(date: Expr<Date, D, C>) => Expr<number, D, C>;
559
560
  declare const dateAdd: <D, C>(date: Expr<Date, D, C>, amount: Expr<number, D, C>, unit: Expr<"year" | "week" | "month" | "day" | "hour" | "minute" | "second", D, C>) => Expr<Date, D, C>;
560
561
  declare const maxDate: <D, C>(expr: Expr<Arr<Date>, D, C>) => Expr<Date, D, C>;
561
562
  declare const minDate: <D, C>(expr: Expr<Arr<Date>, D, C>) => Expr<Date, D, C>;
@@ -577,7 +578,7 @@ declare const eq: <T, D, C = unknown>(a: Expr<T, D, C>) => (b: Expr<T, D, C>) =>
577
578
  declare const sub: <T, D, Ctx, P extends O>(a: Expr<T, D, Ctx>, f: Field<P, D, Ctx>) => Expr<T, P, Ctx>;
578
579
  declare const eqTyped: <T1 extends Dom, T2 extends Dom, F extends HKT<Dom>, C = unknown, Dom = unknown>(a: Expr<T1 | T2, App<F, T1 | T2>, C>, b: Expr<T1, App<F, T1 | T2>, C>) => BoolExpr<App<F, T1>, App<F, T2>, C>;
579
580
  declare const ne: <T, K, D, C>(a: Expr<T, D, C>) => (b: Expr<K, D, C>) => Expr<boolean, D, C>;
580
- declare const notNull: <T, K, D, C>(a: Expr<T, D, C>) => Expr<boolean, D, C>;
581
+ declare const notNull: <T, D, C>(a: Expr<T, D, C>) => Expr<boolean, D, C>;
581
582
  declare const $ifNull: <R, D, C>(...expr: [...Expr<R | null | undefined, D, C>[], Expr<R, D, C>]) => Expr<R, D, C>;
582
583
  declare const exprMapVal: <K extends string, T extends Partial<Record<K, rawItem>>, D, C>(expr: Expr<K, D, C>, map: { readonly [P in K]: Expr<T[P], D, C>; }, or?: Expr<T[K], D, C>) => Expr<T[K & keyof T], D, C>;
583
584
  declare const mapVal: <K extends string, T extends Partial<Record<K, rawItem>>, D, C>(expr: Expr<K, D, C>, map: T, or: T[K & keyof T]) => Expr<T[K & keyof T], D, C>;
@@ -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, $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 };
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, year };
package/index.esm.js CHANGED
@@ -618,7 +618,7 @@ const $lookupRaw = ({ field1, field2 }, { coll, exec, input }, k2, k) => (f) =>
618
618
  };
619
619
 
620
620
  const deltaExpr = (expr) => (field) => {
621
- return ite(eqTyped(root().of(field).expr(), nil), nil, expr(field));
621
+ return ite(eqTyped($ifNull(root().of(field).expr()), nil), nil, expr(field));
622
622
  };
623
623
  const $setEach1 = (updater, dict) => {
624
624
  return $set1(set()(mapExact1(dict, updater)));
@@ -1359,6 +1359,9 @@ const monthPart = (date) => asExpr({
1359
1359
  const weekPart = (date) => asExpr({
1360
1360
  raw: f => asExprRaw({ $dateToString: { date: date.raw(f).get(), format: '%Y-%U' } }),
1361
1361
  });
1362
+ const year = (date) => asExpr({
1363
+ raw: f => asExprRaw({ $year: date.raw(f).get() }),
1364
+ });
1362
1365
  const dateAdd = (date, amount, unit) => asExpr({
1363
1366
  raw: f => asExprRaw({
1364
1367
  $dateAdd: {
@@ -1622,4 +1625,4 @@ const makeCol = async (docs, database, name) => {
1622
1625
  }
1623
1626
  };
1624
1627
 
1625
- 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 };
1628
+ 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, year };
package/index.js CHANGED
@@ -620,7 +620,7 @@ const $lookupRaw = ({ field1, field2 }, { coll, exec, input }, k2, k) => (f) =>
620
620
  };
621
621
 
622
622
  const deltaExpr = (expr) => (field) => {
623
- return ite(eqTyped(root().of(field).expr(), nil), nil, expr(field));
623
+ return ite(eqTyped($ifNull(root().of(field).expr()), nil), nil, expr(field));
624
624
  };
625
625
  const $setEach1 = (updater, dict) => {
626
626
  return $set1(set()(mapExact1(dict, updater)));
@@ -1361,6 +1361,9 @@ const monthPart = (date) => asExpr({
1361
1361
  const weekPart = (date) => asExpr({
1362
1362
  raw: f => asExprRaw({ $dateToString: { date: date.raw(f).get(), format: '%Y-%U' } }),
1363
1363
  });
1364
+ const year = (date) => asExpr({
1365
+ raw: f => asExprRaw({ $year: date.raw(f).get() }),
1366
+ });
1364
1367
  const dateAdd = (date, amount, unit) => asExpr({
1365
1368
  raw: f => asExprRaw({
1366
1369
  $dateAdd: {
@@ -1744,3 +1747,4 @@ exports.toInt = toInt;
1744
1747
  exports.val = val;
1745
1748
  exports.weekPart = weekPart;
1746
1749
  exports.wrap = wrap;
1750
+ exports.year = year;
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.11",
6
+ "version": "0.0.13",
7
7
  "dependencies": {
8
8
  "dayjs": "^1.11.9",
9
9
  "dotenv": "^16.3.1",