@omegup/msync 0.1.24 → 0.1.25

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.esm.js CHANGED
@@ -2002,20 +2002,20 @@ const executes$2 = (view, input, streamName, skip = false, after, needs = {}) =>
2002
2002
  whenMatched: link().with($replaceWith_(ite(eq(root().of('before').expr())(ctx()('new').of('after').expr()), root().expr(), mergeObjects(root().expr(), ctx()('new').expr())))).stages,
2003
2003
  whenNotMatched: 'insert',
2004
2004
  })).stages;
2005
+ const stream = await makeStream();
2005
2006
  const r = await aggregate(pdb, streamName, c => c({ coll: collection, input: cloneIntoNew }));
2006
2007
  const start = Date.now();
2007
2008
  const res = await snapshotCollection.deleteMany({ updated: true, after: null, before: null });
2008
2009
  log('deleting from cloned into new collection', Date.now() - start, res, `db['${snapshotCollection.collectionName}'].deleteMany({ updated: true, after: null, before: null })`);
2009
- return next(step4({ result: r, ts: lastTS?.ts }), 'run the aggregation');
2010
+ return next(step4({ result: r, ts: lastTS?.ts, stream }), 'run the aggregation');
2010
2011
  };
2011
2012
  const makeStream = () => makeWatchStream(view, streamName);
2012
- const step4 = ({ result, ts }) => async () => {
2013
+ const step4 = ({ result, ts, stream }) => async () => {
2013
2014
  const start = Date.now();
2014
2015
  log('snapshot', streamName, 'ensure before null', Date.now() - start);
2015
2016
  const first = ts === undefined;
2016
2017
  const stages = finalInput.raw(first);
2017
2018
  await last.updateOne({ _id: streamName }, { $set: { job: 1 } }, { upsert: true });
2018
- const stream = await makeStream();
2019
2019
  const nextRes = stream.tryNext();
2020
2020
  const aggResult = await aggregate(pdb, streamName, c => c({
2021
2021
  coll: snapshotCollection,
package/index.js CHANGED
@@ -2004,20 +2004,20 @@ const executes$2 = (view, input, streamName, skip = false, after, needs = {}) =>
2004
2004
  whenMatched: link().with($replaceWith_(ite(eq(root().of('before').expr())(ctx()('new').of('after').expr()), root().expr(), mergeObjects(root().expr(), ctx()('new').expr())))).stages,
2005
2005
  whenNotMatched: 'insert',
2006
2006
  })).stages;
2007
+ const stream = await makeStream();
2007
2008
  const r = await aggregate(pdb, streamName, c => c({ coll: collection, input: cloneIntoNew }));
2008
2009
  const start = Date.now();
2009
2010
  const res = await snapshotCollection.deleteMany({ updated: true, after: null, before: null });
2010
2011
  log('deleting from cloned into new collection', Date.now() - start, res, `db['${snapshotCollection.collectionName}'].deleteMany({ updated: true, after: null, before: null })`);
2011
- return next(step4({ result: r, ts: lastTS?.ts }), 'run the aggregation');
2012
+ return next(step4({ result: r, ts: lastTS?.ts, stream }), 'run the aggregation');
2012
2013
  };
2013
2014
  const makeStream = () => makeWatchStream(view, streamName);
2014
- const step4 = ({ result, ts }) => async () => {
2015
+ const step4 = ({ result, ts, stream }) => async () => {
2015
2016
  const start = Date.now();
2016
2017
  log('snapshot', streamName, 'ensure before null', Date.now() - start);
2017
2018
  const first = ts === undefined;
2018
2019
  const stages = finalInput.raw(first);
2019
2020
  await last.updateOne({ _id: streamName }, { $set: { job: 1 } }, { upsert: true });
2020
- const stream = await makeStream();
2021
2021
  const nextRes = stream.tryNext();
2022
2022
  const aggResult = await aggregate(pdb, streamName, c => c({
2023
2023
  coll: snapshotCollection,
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.24",
6
+ "version": "0.1.25",
7
7
  "dependencies": {
8
8
  "dayjs": "^1.11.9",
9
9
  "dotenv": "^16.3.1",