@omegup/msync 0.0.38 → 0.0.40

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
@@ -1139,8 +1139,8 @@ const race = (sources) => {
1139
1139
  const nextWinner = (previousWinner, previousWinnerNextFrame, sources, interrupt) => {
1140
1140
  const { frame: previousFrame, key } = previousWinner;
1141
1141
  if (!interrupt?.(key) && previousFrame.info.job) {
1142
- return previousWinnerNextFrame.then((previousFrameSuccessor) => {
1143
- if (previousFrameSuccessor.info.job) {
1142
+ return previousWinnerNextFrame.then(previousFrameSuccessor => {
1143
+ if (previousFrame.info.job === previousFrameSuccessor.info.job) {
1144
1144
  return { frame: previousFrameSuccessor, key };
1145
1145
  }
1146
1146
  return race(sources);
@@ -1206,7 +1206,7 @@ class Machine {
1206
1206
  return runCont(run, cb);
1207
1207
  }
1208
1208
  }
1209
- const wrap = (root) => root;
1209
+ const wrap = (root) => new Machine(root.runner());
1210
1210
  const runCont = async (it, cb) => {
1211
1211
  const { next, stop, clear } = it();
1212
1212
  const res = await next.then(next => ({ ok: true, next }), err => ({ ok: false, err }));
@@ -1624,7 +1624,10 @@ const executes$1 = (view, input, streamName) => {
1624
1624
  return step8(l);
1625
1625
  };
1626
1626
  const step8 = (l) => {
1627
- return nextData(l.aggResult.cursor.firstBatch)(() => l.stream.tryNext().then(doc => (doc ? next(step2, 'restart') : step8(l))), 'wait for change');
1627
+ return nextData(l.aggResult.cursor.firstBatch)(() => l.stream
1628
+ .tryNext()
1629
+ .catch(err => { log('restarting', err); return 1; })
1630
+ .then(doc => (doc ? next(step2, 'restart') : step8(l))), 'wait for change');
1628
1631
  };
1629
1632
  return stop;
1630
1633
  };
package/index.js CHANGED
@@ -1141,8 +1141,8 @@ const race = (sources) => {
1141
1141
  const nextWinner = (previousWinner, previousWinnerNextFrame, sources, interrupt) => {
1142
1142
  const { frame: previousFrame, key } = previousWinner;
1143
1143
  if (!interrupt?.(key) && previousFrame.info.job) {
1144
- return previousWinnerNextFrame.then((previousFrameSuccessor) => {
1145
- if (previousFrameSuccessor.info.job) {
1144
+ return previousWinnerNextFrame.then(previousFrameSuccessor => {
1145
+ if (previousFrame.info.job === previousFrameSuccessor.info.job) {
1146
1146
  return { frame: previousFrameSuccessor, key };
1147
1147
  }
1148
1148
  return race(sources);
@@ -1208,7 +1208,7 @@ class Machine {
1208
1208
  return runCont(run, cb);
1209
1209
  }
1210
1210
  }
1211
- const wrap = (root) => root;
1211
+ const wrap = (root) => new Machine(root.runner());
1212
1212
  const runCont = async (it, cb) => {
1213
1213
  const { next, stop, clear } = it();
1214
1214
  const res = await next.then(next => ({ ok: true, next }), err => ({ ok: false, err }));
@@ -1626,7 +1626,10 @@ const executes$1 = (view, input, streamName) => {
1626
1626
  return step8(l);
1627
1627
  };
1628
1628
  const step8 = (l) => {
1629
- return nextData(l.aggResult.cursor.firstBatch)(() => l.stream.tryNext().then(doc => (doc ? next(step2, 'restart') : step8(l))), 'wait for change');
1629
+ return nextData(l.aggResult.cursor.firstBatch)(() => l.stream
1630
+ .tryNext()
1631
+ .catch(err => { log('restarting', err); return 1; })
1632
+ .then(doc => (doc ? next(step2, 'restart') : step8(l))), 'wait for change');
1630
1633
  };
1631
1634
  return stop;
1632
1635
  };
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.38",
6
+ "version": "0.0.40",
7
7
  "dependencies": {
8
8
  "dayjs": "^1.11.9",
9
9
  "dotenv": "^16.3.1",