@omegup/msync 0.1.65 → 0.1.67

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.js CHANGED
@@ -97,7 +97,7 @@ const $let = (vars, inExpr) => asExpr({ raw: (f) => asExprRaw({ $let: {
97
97
  } }) });
98
98
  const nil = val(null);
99
99
  const $getField = (expr, field) => asExpr({ raw: (f) => asExprRaw({ $getField: {
100
- field,
100
+ field: typeof field === "string" ? field : field.raw(f).get(),
101
101
  input: expr.raw(f).get()
102
102
  } }) });
103
103
  const func = (f, ...args) => asExpr({ raw: (field) => asExprRaw({ $function: {
@@ -682,7 +682,7 @@ const $mergeX = (out, keys, f, map, ext, update) => {
682
682
  _id: ["_id", f.of("_id").expr()],
683
683
  touchedAt: ["touchedAt", current]
684
684
  })));
685
- const sss = setDeleted ? link().with($set_(set()({ deletedAt: ["deletedAt", to(current)] }))).with($merge_({
685
+ const sss = setDeleted ? link().with($set_(set()({ deletedAt: ["deletedAt", to(now())] }))).with($merge_({
686
686
  into: out.coll,
687
687
  on: root().of("_id"),
688
688
  whenNotMatched: "insert",
@@ -766,7 +766,7 @@ const subMerge = (args, out, gid, extra, idPrefix, first) => {
766
766
  })).stages;
767
767
  }
768
768
  if (out.whenNotMatched === "discard") {
769
- const discardMarker = $set_(set()({ deletedAt: ["deletedAt", to(current)] }));
769
+ const discardMarker = $set_(set()({ deletedAt: ["deletedAt", to(now())] }));
770
770
  return stages.with(discardMarker).with($merge_({
771
771
  into: out.into,
772
772
  whenNotMatched: "insert",
@@ -1453,7 +1453,7 @@ const $simpleInsert = (out, ext) => {
1453
1453
  const $insertPart = (out, ext) => {
1454
1454
  const extExpr = mapExact(ext, (v) => val(v));
1455
1455
  return $insertX(out, assertNotNull(root().of("after").expr()), (x) => ite(eq(root().of("after").expr())(nil), field(mergeExpr(extExpr, {
1456
- deletedAt: ["deletedAt", current],
1456
+ deletedAt: ["deletedAt", now()],
1457
1457
  _id: ["_id", assertNotNull(root().of("before").of("_id").expr())],
1458
1458
  touchedAt: ["touchedAt", current]
1459
1459
  })), x), ext, extExpr);