@omegup/msync 0.1.1 → 0.1.2

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
@@ -526,7 +526,7 @@ interface SnapshotStreamHKT extends HKT<O2> {
526
526
  interface DeltaHKT extends HKT<O3> {
527
527
  readonly out: DeltaStages<I<O3, this>[0], I<O3, this>[1], I<O3, this>[2]>;
528
528
  }
529
- declare const staging: <V extends Model, KK extends StrKey<V>>(view: View<V, Allowed$1<KK>>, streamName: string, skip?: boolean, after?: () => Promise<void>, allowEmtpies?: readonly KK[]) => DeltaPipe<AllowedPick$1<V, KK>, AllowedPick$1<V, KK>, SnapshotStreamHKT, DeltaHKT>;
529
+ declare const staging: <V extends Model, KK extends StrKey<V>>(view: View<V, Allowed$1<KK>>, streamName: string, skip?: boolean, after?: () => Promise<void>) => DeltaPipe<AllowedPick$1<V, KK>, AllowedPick$1<V, KK>, SnapshotStreamHKT, DeltaHKT>;
530
530
 
531
531
  type Allowed<K> = Exclude<K, 'deletedAt' | '_id'>;
532
532
  type AllowedPick<V extends Model, K extends StrKey<V>> = OPickD<V, Allowed<K>>;
package/index.esm.js CHANGED
@@ -1384,14 +1384,12 @@ const $mergeX = (out, keys, f, map, whenNotMatched = 'fail', ext) => {
1384
1384
  whenMatched: asStages([
1385
1385
  {
1386
1386
  $replaceWith: {
1387
- old: setDeleted
1388
- ? { $mergeObjects: ['$$ROOT', { deletedAt: '$deletedAt' }] }
1389
- : '$$ROOT',
1387
+ old: '$$ROOT',
1390
1388
  merged: {
1391
1389
  $mergeObjects: [
1392
1390
  '$$ROOT',
1393
1391
  '$$new',
1394
- ...(setDeleted ? [{ deletedAt: '$deletedAt' }] : []),
1392
+ ...(setDeleted ? [{ deletedAt: { $ifNull: ['$deletedAt', null] } }] : []),
1395
1393
  ],
1396
1394
  },
1397
1395
  },
@@ -1401,7 +1399,7 @@ const $mergeX = (out, keys, f, map, whenNotMatched = 'fail', ext) => {
1401
1399
  $cond: {
1402
1400
  if: {
1403
1401
  $eq: [
1404
- '$old',
1402
+ { $mergeObjects: ['$old', { deletedAt: { $ifNull: ['$old.deletedAt', null] } }] },
1405
1403
  { $mergeObjects: ['$merged', { touchedAt: '$old.touchedAt' }] },
1406
1404
  ],
1407
1405
  },
@@ -1630,7 +1628,7 @@ const getFirstStages = (view) => {
1630
1628
  };
1631
1629
 
1632
1630
  const streamNames = {};
1633
- const executes$2 = (view, input, streamName, skip = false, after, allowEmtpies) => {
1631
+ const executes$2 = (view, input, streamName, skip = false, after) => {
1634
1632
  const { collection, projection, match } = view;
1635
1633
  const { firstStages, hardMatch } = getFirstStages(view);
1636
1634
  const db = collection.s.db, coll = collection.collectionName;
@@ -1819,7 +1817,7 @@ const executes$2 = (view, input, streamName, skip = false, after, allowEmtpies)
1819
1817
  out: run,
1820
1818
  };
1821
1819
  };
1822
- const staging = (view, streamName, skip = false, after, allowEmtpies) => pipe(input => executes$2(view, input, streamName, skip, after), emptyDelta(), concatDelta, emptyDelta);
1820
+ const staging = (view, streamName, skip = false, after) => pipe(input => executes$2(view, input, streamName, skip, after), emptyDelta(), concatDelta, emptyDelta);
1823
1821
 
1824
1822
  const executes$1 = (view, input, streamName, allowEmtpies) => {
1825
1823
  const hash = crypto$1
package/index.js CHANGED
@@ -1386,14 +1386,12 @@ const $mergeX = (out, keys, f, map, whenNotMatched = 'fail', ext) => {
1386
1386
  whenMatched: asStages([
1387
1387
  {
1388
1388
  $replaceWith: {
1389
- old: setDeleted
1390
- ? { $mergeObjects: ['$$ROOT', { deletedAt: '$deletedAt' }] }
1391
- : '$$ROOT',
1389
+ old: '$$ROOT',
1392
1390
  merged: {
1393
1391
  $mergeObjects: [
1394
1392
  '$$ROOT',
1395
1393
  '$$new',
1396
- ...(setDeleted ? [{ deletedAt: '$deletedAt' }] : []),
1394
+ ...(setDeleted ? [{ deletedAt: { $ifNull: ['$deletedAt', null] } }] : []),
1397
1395
  ],
1398
1396
  },
1399
1397
  },
@@ -1403,7 +1401,7 @@ const $mergeX = (out, keys, f, map, whenNotMatched = 'fail', ext) => {
1403
1401
  $cond: {
1404
1402
  if: {
1405
1403
  $eq: [
1406
- '$old',
1404
+ { $mergeObjects: ['$old', { deletedAt: { $ifNull: ['$old.deletedAt', null] } }] },
1407
1405
  { $mergeObjects: ['$merged', { touchedAt: '$old.touchedAt' }] },
1408
1406
  ],
1409
1407
  },
@@ -1632,7 +1630,7 @@ const getFirstStages = (view) => {
1632
1630
  };
1633
1631
 
1634
1632
  const streamNames = {};
1635
- const executes$2 = (view, input, streamName, skip = false, after, allowEmtpies) => {
1633
+ const executes$2 = (view, input, streamName, skip = false, after) => {
1636
1634
  const { collection, projection, match } = view;
1637
1635
  const { firstStages, hardMatch } = getFirstStages(view);
1638
1636
  const db = collection.s.db, coll = collection.collectionName;
@@ -1821,7 +1819,7 @@ const executes$2 = (view, input, streamName, skip = false, after, allowEmtpies)
1821
1819
  out: run,
1822
1820
  };
1823
1821
  };
1824
- const staging = (view, streamName, skip = false, after, allowEmtpies) => pipe(input => executes$2(view, input, streamName, skip, after), emptyDelta(), concatDelta, emptyDelta);
1822
+ const staging = (view, streamName, skip = false, after) => pipe(input => executes$2(view, input, streamName, skip, after), emptyDelta(), concatDelta, emptyDelta);
1825
1823
 
1826
1824
  const executes$1 = (view, input, streamName, allowEmtpies) => {
1827
1825
  const hash = crypto$1
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.1.1",
6
+ "version": "0.1.2",
7
7
  "dependencies": {
8
8
  "dayjs": "^1.11.9",
9
9
  "dotenv": "^16.3.1",