@omegup/msync 0.0.83 → 0.0.85

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
@@ -497,9 +497,9 @@ type ND = {
497
497
  };
498
498
  type SafeE<E> = Omit<E, `$${string}` | keyof ID>;
499
499
  type Merge<T extends doc, E> = Omit<SafeE<E>, keyof (ND & TS)> & ((T & ND & TS) | Del);
500
- declare const $insertX: <T extends doc, D extends O, EEE>(out: RWCollection<Merge<T, EEE>>, expr: Expr<T, D>, map: (x: Expr<T & ND & TS & Omit<SafeE<EEE>, keyof (ND & TS)>, D>) => Expr<Merge<T, EEE>, D>, ext: ExprsExact<Omit<SafeE<EEE>, keyof (ND & TS)>, unknown>) => StreamRunnerParam<D, "out">;
500
+ declare const $insertX: <T extends doc, D extends O, EEE extends RORec<string, rawItem>>(out: RWCollection<Merge<T, EEE>>, expr: Expr<T, D>, map: (x: Expr<T & ND & TS & Omit<SafeE<EEE>, keyof (ND & TS)>, D>) => Expr<Merge<T, EEE>, D>, ext: Exact<Omit<SafeE<EEE>, keyof (ND & TS)>, IdHKT>) => StreamRunnerParam<D, "out">;
501
501
  declare const $simpleInsert: <T extends doc>(out: RWCollection<Merge<T, {}>>) => StreamRunnerParam<T, "out">;
502
- declare const $insertPart: <T extends doc, EEE>(out: RWCollection<Merge<T, EEE>>, ext: ExprsExact<Omit<SafeE<EEE>, keyof (ND & TS)>, unknown>) => StreamRunnerParam<Delta<T>, "out">;
502
+ declare const $insertPart: <T extends doc, EEE extends RORec<string, rawItem>>(out: RWCollection<Merge<T, EEE>>, ext: ExprsExact<Omit<SafeE<EEE>, keyof (ND & TS)>, unknown>) => StreamRunnerParam<Delta<T>, "out">;
503
503
  declare const $insert: <T extends doc>(out: RWCollection<Merge<T, {}>>) => StreamRunnerParam<Delta<T>, "out">;
504
504
 
505
505
  declare const $group_: <V extends O>() => <ID, T extends O, C = unknown>(id: Expr<ID, T, C>, args: Accumulators<T, V, C>) => RawStages<O, T, Rec<"_id", ID> & V, C, 1>;
package/index.esm.js CHANGED
@@ -258,8 +258,10 @@ const $pushDict = (key, value) => $accumulator(function () {
258
258
  ], function (ra, k, v, old) {
259
259
  let a = { ...ra };
260
260
  const equal = (a, b) => {
261
- if ([a, b].some(a => !a || typeof a != 'object'))
261
+ if (!a || !b)
262
262
  return a === b;
263
+ if ([a, b].some(a => Object.getPrototypeOf(a) != Object.prototype))
264
+ return a.valueOf() === b.valueOf();
263
265
  const keys = Object.keys(a);
264
266
  return keys.length === Object.keys(b).length && keys.every(k => equal(a[k], b[k]));
265
267
  };
@@ -1402,6 +1404,7 @@ const $merge = () => (out, keys) => $mergeId()(out, keys, assertNotNull$1(root()
1402
1404
  const assertNotNull$1 = (expr) => expr;
1403
1405
 
1404
1406
  const $insertX = (out, expr, map, ext) => {
1407
+ const extExpr = mapExact(ext, (v) => val(v));
1405
1408
  const filter = mapExactToObject(ext, v => ({ $eq: v }));
1406
1409
  return {
1407
1410
  teardown: c => c({
@@ -1413,7 +1416,7 @@ const $insertX = (out, expr, map, ext) => {
1413
1416
  ],
1414
1417
  }),
1415
1418
  raw: () => {
1416
- const replacer = map(mergeObjects(expr, field(mergeExpr(ext, {
1419
+ const replacer = map(mergeObjects(expr, field(mergeExpr(extExpr, {
1417
1420
  deletedAt: ['deletedAt', nil],
1418
1421
  touchedAt: ['touchedAt', current],
1419
1422
  }))));
package/index.js CHANGED
@@ -260,8 +260,10 @@ const $pushDict = (key, value) => $accumulator(function () {
260
260
  ], function (ra, k, v, old) {
261
261
  let a = { ...ra };
262
262
  const equal = (a, b) => {
263
- if ([a, b].some(a => !a || typeof a != 'object'))
263
+ if (!a || !b)
264
264
  return a === b;
265
+ if ([a, b].some(a => Object.getPrototypeOf(a) != Object.prototype))
266
+ return a.valueOf() === b.valueOf();
265
267
  const keys = Object.keys(a);
266
268
  return keys.length === Object.keys(b).length && keys.every(k => equal(a[k], b[k]));
267
269
  };
@@ -1404,6 +1406,7 @@ const $merge = () => (out, keys) => $mergeId()(out, keys, assertNotNull$1(root()
1404
1406
  const assertNotNull$1 = (expr) => expr;
1405
1407
 
1406
1408
  const $insertX = (out, expr, map, ext) => {
1409
+ const extExpr = mapExact(ext, (v) => val(v));
1407
1410
  const filter = mapExactToObject(ext, v => ({ $eq: v }));
1408
1411
  return {
1409
1412
  teardown: c => c({
@@ -1415,7 +1418,7 @@ const $insertX = (out, expr, map, ext) => {
1415
1418
  ],
1416
1419
  }),
1417
1420
  raw: () => {
1418
- const replacer = map(mergeObjects(expr, field(mergeExpr(ext, {
1421
+ const replacer = map(mergeObjects(expr, field(mergeExpr(extExpr, {
1419
1422
  deletedAt: ['deletedAt', nil],
1420
1423
  touchedAt: ['touchedAt', current],
1421
1424
  }))));
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.83",
6
+ "version": "0.0.85",
7
7
  "dependencies": {
8
8
  "dayjs": "^1.11.9",
9
9
  "dotenv": "^16.3.1",