@omegup/msync 0.0.72 → 0.0.74
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 +18 -17
- package/index.js +18 -17
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -1217,11 +1217,6 @@ const firstWorksMerge = (iters) => {
|
|
|
1217
1217
|
return iterator;
|
|
1218
1218
|
};
|
|
1219
1219
|
|
|
1220
|
-
const T = (s) => `Timestamp(${parseInt(`${BigInt(s) / 2n ** 32n}`)}, ${parseInt(`${BigInt(s) % 2n ** 32n}`)})`;
|
|
1221
|
-
const replace = (s) => s.replace(/\{"\$timestamp":"(\d+)"\}/g, (_, d) => T(d));
|
|
1222
|
-
const json = (a) => replace(JSON.stringify(a));
|
|
1223
|
-
const log = (...args) => console.log(new Date(), ...args.map(a => (typeof a === 'function' ? a(replace) : a && typeof a === 'object' ? json(a) : a)));
|
|
1224
|
-
|
|
1225
1220
|
class Machine {
|
|
1226
1221
|
sources;
|
|
1227
1222
|
constructor(root) {
|
|
@@ -1244,19 +1239,20 @@ class Machine {
|
|
|
1244
1239
|
}
|
|
1245
1240
|
const wrap = (root) => root;
|
|
1246
1241
|
const runCont = async (it, cb) => {
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1242
|
+
while (true) {
|
|
1243
|
+
const { next, clear } = it();
|
|
1244
|
+
const res = await next.then(next => ({ ok: true, next }), err => ({ ok: false, err }));
|
|
1245
|
+
if (!res.ok) {
|
|
1246
|
+
console.error(res.err);
|
|
1247
|
+
process.exit(1);
|
|
1248
|
+
}
|
|
1249
|
+
const { cont, info } = res.next;
|
|
1250
|
+
if (cb?.(info)) {
|
|
1251
|
+
await clear();
|
|
1252
|
+
throw new Error('Machine stopped');
|
|
1253
|
+
}
|
|
1254
|
+
it = cont;
|
|
1258
1255
|
}
|
|
1259
|
-
return runCont(cont, cb);
|
|
1260
1256
|
};
|
|
1261
1257
|
|
|
1262
1258
|
const merge = ({ lsource: L, rsource: R, }) => mergeIterators({ sources: { L, R } });
|
|
@@ -1408,6 +1404,11 @@ const $insert = (out) => $insertX(out, assertNotNull(root().of('after').expr()),
|
|
|
1408
1404
|
}), x));
|
|
1409
1405
|
const assertNotNull = (expr) => expr;
|
|
1410
1406
|
|
|
1407
|
+
const T = (s) => `Timestamp(${parseInt(`${BigInt(s) / 2n ** 32n}`)}, ${parseInt(`${BigInt(s) % 2n ** 32n}`)})`;
|
|
1408
|
+
const replace = (s) => s.replace(/\{"\$timestamp":"(\d+)"\}/g, (_, d) => T(d));
|
|
1409
|
+
const json = (a) => replace(JSON.stringify(a));
|
|
1410
|
+
const log = (...args) => console.log(new Date(), ...args.map(a => (typeof a === 'function' ? a(replace) : a && typeof a === 'object' ? json(a) : a)));
|
|
1411
|
+
|
|
1411
1412
|
const aggregate = (streamName, input, snapshot = true, start = Date.now()) => input(({ coll, input }) => {
|
|
1412
1413
|
const req = {
|
|
1413
1414
|
aggregate: coll.collectionName,
|
package/index.js
CHANGED
|
@@ -1219,11 +1219,6 @@ const firstWorksMerge = (iters) => {
|
|
|
1219
1219
|
return iterator;
|
|
1220
1220
|
};
|
|
1221
1221
|
|
|
1222
|
-
const T = (s) => `Timestamp(${parseInt(`${BigInt(s) / 2n ** 32n}`)}, ${parseInt(`${BigInt(s) % 2n ** 32n}`)})`;
|
|
1223
|
-
const replace = (s) => s.replace(/\{"\$timestamp":"(\d+)"\}/g, (_, d) => T(d));
|
|
1224
|
-
const json = (a) => replace(JSON.stringify(a));
|
|
1225
|
-
const log = (...args) => console.log(new Date(), ...args.map(a => (typeof a === 'function' ? a(replace) : a && typeof a === 'object' ? json(a) : a)));
|
|
1226
|
-
|
|
1227
1222
|
class Machine {
|
|
1228
1223
|
sources;
|
|
1229
1224
|
constructor(root) {
|
|
@@ -1246,19 +1241,20 @@ class Machine {
|
|
|
1246
1241
|
}
|
|
1247
1242
|
const wrap = (root) => root;
|
|
1248
1243
|
const runCont = async (it, cb) => {
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1244
|
+
while (true) {
|
|
1245
|
+
const { next, clear } = it();
|
|
1246
|
+
const res = await next.then(next => ({ ok: true, next }), err => ({ ok: false, err }));
|
|
1247
|
+
if (!res.ok) {
|
|
1248
|
+
console.error(res.err);
|
|
1249
|
+
process.exit(1);
|
|
1250
|
+
}
|
|
1251
|
+
const { cont, info } = res.next;
|
|
1252
|
+
if (cb?.(info)) {
|
|
1253
|
+
await clear();
|
|
1254
|
+
throw new Error('Machine stopped');
|
|
1255
|
+
}
|
|
1256
|
+
it = cont;
|
|
1260
1257
|
}
|
|
1261
|
-
return runCont(cont, cb);
|
|
1262
1258
|
};
|
|
1263
1259
|
|
|
1264
1260
|
const merge = ({ lsource: L, rsource: R, }) => mergeIterators({ sources: { L, R } });
|
|
@@ -1410,6 +1406,11 @@ const $insert = (out) => $insertX(out, assertNotNull(root().of('after').expr()),
|
|
|
1410
1406
|
}), x));
|
|
1411
1407
|
const assertNotNull = (expr) => expr;
|
|
1412
1408
|
|
|
1409
|
+
const T = (s) => `Timestamp(${parseInt(`${BigInt(s) / 2n ** 32n}`)}, ${parseInt(`${BigInt(s) % 2n ** 32n}`)})`;
|
|
1410
|
+
const replace = (s) => s.replace(/\{"\$timestamp":"(\d+)"\}/g, (_, d) => T(d));
|
|
1411
|
+
const json = (a) => replace(JSON.stringify(a));
|
|
1412
|
+
const log = (...args) => console.log(new Date(), ...args.map(a => (typeof a === 'function' ? a(replace) : a && typeof a === 'object' ? json(a) : a)));
|
|
1413
|
+
|
|
1413
1414
|
const aggregate = (streamName, input, snapshot = true, start = Date.now()) => input(({ coll, input }) => {
|
|
1414
1415
|
const req = {
|
|
1415
1416
|
aggregate: coll.collectionName,
|