@omegup/msync 0.1.18 → 0.1.19

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.
Files changed (3) hide show
  1. package/index.esm.js +6 -12
  2. package/index.js +6 -12
  3. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -1648,6 +1648,7 @@ const getFirstStages = (view, needs) => {
1648
1648
  return { firstStages, hardMatch };
1649
1649
  };
1650
1650
 
1651
+ const tryNext$1 = (stream) => stream.tryNext().catch(() => ({}));
1651
1652
  const streamNames = {};
1652
1653
  const executes$2 = (view, input, streamName, skip = false, after, needs = {}) => {
1653
1654
  const { collection, projection, match } = view;
@@ -1784,7 +1785,7 @@ const executes$2 = (view, input, streamName, skip = false, after, needs = {}) =>
1784
1785
  .with(stages).stages,
1785
1786
  }), false, start);
1786
1787
  const stream = makeStream(result.cursor.atClusterTime);
1787
- const nextRes = stream.tryNext();
1788
+ const nextRes = tryNext$1(stream);
1788
1789
  const intoColl = stages.at(-1).$merge.into.coll;
1789
1790
  const startx = Date.now();
1790
1791
  await db
@@ -1824,13 +1825,9 @@ const executes$2 = (view, input, streamName, skip = false, after, needs = {}) =>
1824
1825
  };
1825
1826
  const step8 = (l) => {
1826
1827
  return nextData(l.aggResult.cursor.firstBatch)(() => l.nextRes
1827
- .catch((err) => {
1828
- log('restarting', err);
1829
- return { ts: null };
1830
- })
1831
1828
  .then(doc => doc
1832
1829
  ? next(step3({ _id: streamName, ts: l.ts }), 'restart')
1833
- : step8({ ...l, nextRes: l.stream.tryNext() })), 'wait for change');
1830
+ : step8({ ...l, nextRes: tryNext$1(l.stream) })), 'wait for change');
1834
1831
  };
1835
1832
  return skip
1836
1833
  ? withStop(() => SynchronousPromise.resolve(next(step3(null), 'clone into new collection')))
@@ -1848,6 +1845,7 @@ const executes$2 = (view, input, streamName, skip = false, after, needs = {}) =>
1848
1845
  };
1849
1846
  const staging = (view, streamName, skip = false, after) => pipe(input => executes$2(view, input, streamName, skip, after, view.needs), emptyDelta(), concatDelta, emptyDelta);
1850
1847
 
1848
+ const tryNext = (stream) => stream.tryNext().catch(() => ({}));
1851
1849
  const executes$1 = (view, input, streamName, needs) => {
1852
1850
  const hash = crypto$1
1853
1851
  .createHash('md5')
@@ -1947,7 +1945,7 @@ const executes$1 = (view, input, streamName, needs) => {
1947
1945
  input: raw,
1948
1946
  }));
1949
1947
  const stream = makeStream(aggResult.cursor.atClusterTime);
1950
- const nextRes = stream.tryNext();
1948
+ const nextRes = tryNext(stream);
1951
1949
  return next(step7({ aggResult, ts: aggResult.cursor.atClusterTime, stream, nextRes }), 'update __last', () => stream.close());
1952
1950
  };
1953
1951
  const step7 = (l) => async () => {
@@ -1959,13 +1957,9 @@ const executes$1 = (view, input, streamName, needs) => {
1959
1957
  data: l.aggResult.cursor.firstBatch,
1960
1958
  info: { job: undefined, debug: 'wait for change' },
1961
1959
  cont: withStop(() => l.nextRes
1962
- .catch((err) => {
1963
- log('restarting', err);
1964
- return { ts: null };
1965
- })
1966
1960
  .then(doc => doc
1967
1961
  ? next(step4({ _id: streamName, ts: l.ts }), 'restart')
1968
- : step8({ ...l, nextRes: l.stream.tryNext() }))),
1962
+ : step8({ ...l, nextRes: tryNext(l.stream) }))),
1969
1963
  };
1970
1964
  };
1971
1965
  return stop;
package/index.js CHANGED
@@ -1650,6 +1650,7 @@ const getFirstStages = (view, needs) => {
1650
1650
  return { firstStages, hardMatch };
1651
1651
  };
1652
1652
 
1653
+ const tryNext$1 = (stream) => stream.tryNext().catch(() => ({}));
1653
1654
  const streamNames = {};
1654
1655
  const executes$2 = (view, input, streamName, skip = false, after, needs = {}) => {
1655
1656
  const { collection, projection, match } = view;
@@ -1786,7 +1787,7 @@ const executes$2 = (view, input, streamName, skip = false, after, needs = {}) =>
1786
1787
  .with(stages).stages,
1787
1788
  }), false, start);
1788
1789
  const stream = makeStream(result.cursor.atClusterTime);
1789
- const nextRes = stream.tryNext();
1790
+ const nextRes = tryNext$1(stream);
1790
1791
  const intoColl = stages.at(-1).$merge.into.coll;
1791
1792
  const startx = Date.now();
1792
1793
  await db
@@ -1826,13 +1827,9 @@ const executes$2 = (view, input, streamName, skip = false, after, needs = {}) =>
1826
1827
  };
1827
1828
  const step8 = (l) => {
1828
1829
  return nextData(l.aggResult.cursor.firstBatch)(() => l.nextRes
1829
- .catch((err) => {
1830
- log('restarting', err);
1831
- return { ts: null };
1832
- })
1833
1830
  .then(doc => doc
1834
1831
  ? next(step3({ _id: streamName, ts: l.ts }), 'restart')
1835
- : step8({ ...l, nextRes: l.stream.tryNext() })), 'wait for change');
1832
+ : step8({ ...l, nextRes: tryNext$1(l.stream) })), 'wait for change');
1836
1833
  };
1837
1834
  return skip
1838
1835
  ? withStop(() => synchronousPromise.SynchronousPromise.resolve(next(step3(null), 'clone into new collection')))
@@ -1850,6 +1847,7 @@ const executes$2 = (view, input, streamName, skip = false, after, needs = {}) =>
1850
1847
  };
1851
1848
  const staging = (view, streamName, skip = false, after) => pipe(input => executes$2(view, input, streamName, skip, after, view.needs), emptyDelta(), concatDelta, emptyDelta);
1852
1849
 
1850
+ const tryNext = (stream) => stream.tryNext().catch(() => ({}));
1853
1851
  const executes$1 = (view, input, streamName, needs) => {
1854
1852
  const hash = crypto$1
1855
1853
  .createHash('md5')
@@ -1949,7 +1947,7 @@ const executes$1 = (view, input, streamName, needs) => {
1949
1947
  input: raw,
1950
1948
  }));
1951
1949
  const stream = makeStream(aggResult.cursor.atClusterTime);
1952
- const nextRes = stream.tryNext();
1950
+ const nextRes = tryNext(stream);
1953
1951
  return next(step7({ aggResult, ts: aggResult.cursor.atClusterTime, stream, nextRes }), 'update __last', () => stream.close());
1954
1952
  };
1955
1953
  const step7 = (l) => async () => {
@@ -1961,13 +1959,9 @@ const executes$1 = (view, input, streamName, needs) => {
1961
1959
  data: l.aggResult.cursor.firstBatch,
1962
1960
  info: { job: undefined, debug: 'wait for change' },
1963
1961
  cont: withStop(() => l.nextRes
1964
- .catch((err) => {
1965
- log('restarting', err);
1966
- return { ts: null };
1967
- })
1968
1962
  .then(doc => doc
1969
1963
  ? next(step4({ _id: streamName, ts: l.ts }), 'restart')
1970
- : step8({ ...l, nextRes: l.stream.tryNext() }))),
1964
+ : step8({ ...l, nextRes: tryNext(l.stream) }))),
1971
1965
  };
1972
1966
  };
1973
1967
  return stop;
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.18",
6
+ "version": "0.1.19",
7
7
  "dependencies": {
8
8
  "dayjs": "^1.11.9",
9
9
  "dotenv": "^16.3.1",