@omegup/msync 0.0.51 → 0.0.53
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 +7 -6
- package/index.js +7 -6
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -1193,6 +1193,11 @@ const firstWorksMerge = (iters) => {
|
|
|
1193
1193
|
return iterator;
|
|
1194
1194
|
};
|
|
1195
1195
|
|
|
1196
|
+
const T = (s) => `Timestamp(${parseInt(`${BigInt(s) / 2n ** 32n}`)}, ${parseInt(`${BigInt(s) % 2n ** 32n}`)})`;
|
|
1197
|
+
const replace = (s) => s.replace(/\{"\$timestamp":"(\d+)"\}/g, (_, d) => T(d));
|
|
1198
|
+
const json = (a) => replace(JSON.stringify(a));
|
|
1199
|
+
const log = (...args) => console.log(new Date(), ...args.map(a => (typeof a === 'function' ? a(replace) : a && typeof a === 'object' ? json(a) : a)));
|
|
1200
|
+
|
|
1196
1201
|
class Machine {
|
|
1197
1202
|
sources;
|
|
1198
1203
|
constructor(root) {
|
|
@@ -1218,6 +1223,7 @@ const runCont = async (it, cb) => {
|
|
|
1218
1223
|
const { next, stop, clear } = it();
|
|
1219
1224
|
const res = await next.then(next => ({ ok: true, next }), err => ({ ok: false, err }));
|
|
1220
1225
|
if (!res.ok) {
|
|
1226
|
+
log('error', res.err);
|
|
1221
1227
|
return runCont(stop, cb);
|
|
1222
1228
|
}
|
|
1223
1229
|
const { cont, info } = res.next;
|
|
@@ -1377,11 +1383,6 @@ const $insert = (out) => $insertX(out, assertNotNull(root().of('after').expr()),
|
|
|
1377
1383
|
}), x));
|
|
1378
1384
|
const assertNotNull = (expr) => expr;
|
|
1379
1385
|
|
|
1380
|
-
const T = (s) => `Timestamp(${parseInt(`${BigInt(s) / 2n ** 32n}`)}, ${parseInt(`${BigInt(s) % 2n ** 32n}`)})`;
|
|
1381
|
-
const replace = (s) => s.replace(/\{"\$timestamp":"(\d+)"\}/g, (_, d) => T(d));
|
|
1382
|
-
const json = (a) => replace(JSON.stringify(a));
|
|
1383
|
-
const log = (...args) => console.log(new Date(), ...args.map(a => (typeof a === 'function' ? a(replace) : a && typeof a === 'object' ? json(a) : a)));
|
|
1384
|
-
|
|
1385
1386
|
const aggregate = (streamName, input, snapshot = true, start = Date.now()) => input(({ coll, input }) => {
|
|
1386
1387
|
const req = {
|
|
1387
1388
|
aggregate: coll.collectionName,
|
|
@@ -1444,7 +1445,7 @@ const makeWatchStream = (db, { collection, projection: p, hardMatch: m }, startA
|
|
|
1444
1445
|
});
|
|
1445
1446
|
pipeline.push({
|
|
1446
1447
|
$replaceWith: {
|
|
1447
|
-
_id:
|
|
1448
|
+
_id: "$_id",
|
|
1448
1449
|
ts: {
|
|
1449
1450
|
$cond: {
|
|
1450
1451
|
if: {
|
package/index.js
CHANGED
|
@@ -1195,6 +1195,11 @@ const firstWorksMerge = (iters) => {
|
|
|
1195
1195
|
return iterator;
|
|
1196
1196
|
};
|
|
1197
1197
|
|
|
1198
|
+
const T = (s) => `Timestamp(${parseInt(`${BigInt(s) / 2n ** 32n}`)}, ${parseInt(`${BigInt(s) % 2n ** 32n}`)})`;
|
|
1199
|
+
const replace = (s) => s.replace(/\{"\$timestamp":"(\d+)"\}/g, (_, d) => T(d));
|
|
1200
|
+
const json = (a) => replace(JSON.stringify(a));
|
|
1201
|
+
const log = (...args) => console.log(new Date(), ...args.map(a => (typeof a === 'function' ? a(replace) : a && typeof a === 'object' ? json(a) : a)));
|
|
1202
|
+
|
|
1198
1203
|
class Machine {
|
|
1199
1204
|
sources;
|
|
1200
1205
|
constructor(root) {
|
|
@@ -1220,6 +1225,7 @@ const runCont = async (it, cb) => {
|
|
|
1220
1225
|
const { next, stop, clear } = it();
|
|
1221
1226
|
const res = await next.then(next => ({ ok: true, next }), err => ({ ok: false, err }));
|
|
1222
1227
|
if (!res.ok) {
|
|
1228
|
+
log('error', res.err);
|
|
1223
1229
|
return runCont(stop, cb);
|
|
1224
1230
|
}
|
|
1225
1231
|
const { cont, info } = res.next;
|
|
@@ -1379,11 +1385,6 @@ const $insert = (out) => $insertX(out, assertNotNull(root().of('after').expr()),
|
|
|
1379
1385
|
}), x));
|
|
1380
1386
|
const assertNotNull = (expr) => expr;
|
|
1381
1387
|
|
|
1382
|
-
const T = (s) => `Timestamp(${parseInt(`${BigInt(s) / 2n ** 32n}`)}, ${parseInt(`${BigInt(s) % 2n ** 32n}`)})`;
|
|
1383
|
-
const replace = (s) => s.replace(/\{"\$timestamp":"(\d+)"\}/g, (_, d) => T(d));
|
|
1384
|
-
const json = (a) => replace(JSON.stringify(a));
|
|
1385
|
-
const log = (...args) => console.log(new Date(), ...args.map(a => (typeof a === 'function' ? a(replace) : a && typeof a === 'object' ? json(a) : a)));
|
|
1386
|
-
|
|
1387
1388
|
const aggregate = (streamName, input, snapshot = true, start = Date.now()) => input(({ coll, input }) => {
|
|
1388
1389
|
const req = {
|
|
1389
1390
|
aggregate: coll.collectionName,
|
|
@@ -1446,7 +1447,7 @@ const makeWatchStream = (db, { collection, projection: p, hardMatch: m }, startA
|
|
|
1446
1447
|
});
|
|
1447
1448
|
pipeline.push({
|
|
1448
1449
|
$replaceWith: {
|
|
1449
|
-
_id:
|
|
1450
|
+
_id: "$_id",
|
|
1450
1451
|
ts: {
|
|
1451
1452
|
$cond: {
|
|
1452
1453
|
if: {
|