@omegup/msync 0.0.26 → 0.0.28
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 +11 -5
- package/index.js +11 -5
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -1185,7 +1185,7 @@ const makeWatchStream = (db, { collection, projection: p, hardMatch: m }, startA
|
|
|
1185
1185
|
};
|
|
1186
1186
|
|
|
1187
1187
|
const actions = {
|
|
1188
|
-
updateMany: (c, args) => c.updateMany(...args),
|
|
1188
|
+
updateMany: (c, args) => [c.updateMany(...args), [`db['${c.collectionName}'].updateMany(`, ...args, ')']],
|
|
1189
1189
|
};
|
|
1190
1190
|
const streamNames = {};
|
|
1191
1191
|
const executes$1 = (view, input, streamName) => {
|
|
@@ -1232,7 +1232,7 @@ const executes$1 = (view, input, streamName) => {
|
|
|
1232
1232
|
const next = (next, debug, tr) => ({
|
|
1233
1233
|
cont: withStop(next, tr),
|
|
1234
1234
|
data: [],
|
|
1235
|
-
info: { job, debug },
|
|
1235
|
+
info: { job, debug: `${streamName} on ${collection.collectionName}: ${debug}` },
|
|
1236
1236
|
});
|
|
1237
1237
|
const data = {
|
|
1238
1238
|
input: input.delta,
|
|
@@ -1253,7 +1253,7 @@ const executes$1 = (view, input, streamName) => {
|
|
|
1253
1253
|
const step2 = () => Promise.all([
|
|
1254
1254
|
last.findOne({ _id: streamName, data }),
|
|
1255
1255
|
last.findOne({ _id: streamName }),
|
|
1256
|
-
]).then(ts => next(step2_5(ts), 'handle teardown'));
|
|
1256
|
+
]).then(ts => next(step2_5(ts), ts[0] ? `no teardown to handle, starting at ${ts[0].ts}` : ts[1] ? 'handle teardown' : 'start fresh'));
|
|
1257
1257
|
const step2_5 = ([same, exists]) => async () => {
|
|
1258
1258
|
const handleTeardown = async (last) => {
|
|
1259
1259
|
if (!last.data)
|
|
@@ -1264,7 +1264,10 @@ const executes$1 = (view, input, streamName) => {
|
|
|
1264
1264
|
method: m,
|
|
1265
1265
|
params: p,
|
|
1266
1266
|
};
|
|
1267
|
-
|
|
1267
|
+
const [action, out] = actions[method](collection, params);
|
|
1268
|
+
log('teardown', `db.['${snapshotCollection.collectionName}'].drop()`, ...out);
|
|
1269
|
+
await Promise.all([snapshotCollection.drop(), action]);
|
|
1270
|
+
log('teardown done', `db.['${snapshotCollection.collectionName}'].drop()`, ...out);
|
|
1268
1271
|
};
|
|
1269
1272
|
if (exists && !same)
|
|
1270
1273
|
await handleTeardown(exists);
|
|
@@ -1420,7 +1423,10 @@ const executes = (view, input, streamName) => {
|
|
|
1420
1423
|
method: m,
|
|
1421
1424
|
params: p,
|
|
1422
1425
|
};
|
|
1423
|
-
|
|
1426
|
+
const [action, out] = actions[method](collection, params);
|
|
1427
|
+
log('teardown', ...out);
|
|
1428
|
+
await action;
|
|
1429
|
+
log('teardown done', ...out);
|
|
1424
1430
|
};
|
|
1425
1431
|
if (exists && !same)
|
|
1426
1432
|
await handleTeardown(exists);
|
package/index.js
CHANGED
|
@@ -1187,7 +1187,7 @@ const makeWatchStream = (db, { collection, projection: p, hardMatch: m }, startA
|
|
|
1187
1187
|
};
|
|
1188
1188
|
|
|
1189
1189
|
const actions = {
|
|
1190
|
-
updateMany: (c, args) => c.updateMany(...args),
|
|
1190
|
+
updateMany: (c, args) => [c.updateMany(...args), [`db['${c.collectionName}'].updateMany(`, ...args, ')']],
|
|
1191
1191
|
};
|
|
1192
1192
|
const streamNames = {};
|
|
1193
1193
|
const executes$1 = (view, input, streamName) => {
|
|
@@ -1234,7 +1234,7 @@ const executes$1 = (view, input, streamName) => {
|
|
|
1234
1234
|
const next = (next, debug, tr) => ({
|
|
1235
1235
|
cont: withStop(next, tr),
|
|
1236
1236
|
data: [],
|
|
1237
|
-
info: { job, debug },
|
|
1237
|
+
info: { job, debug: `${streamName} on ${collection.collectionName}: ${debug}` },
|
|
1238
1238
|
});
|
|
1239
1239
|
const data = {
|
|
1240
1240
|
input: input.delta,
|
|
@@ -1255,7 +1255,7 @@ const executes$1 = (view, input, streamName) => {
|
|
|
1255
1255
|
const step2 = () => Promise.all([
|
|
1256
1256
|
last.findOne({ _id: streamName, data }),
|
|
1257
1257
|
last.findOne({ _id: streamName }),
|
|
1258
|
-
]).then(ts => next(step2_5(ts), 'handle teardown'));
|
|
1258
|
+
]).then(ts => next(step2_5(ts), ts[0] ? `no teardown to handle, starting at ${ts[0].ts}` : ts[1] ? 'handle teardown' : 'start fresh'));
|
|
1259
1259
|
const step2_5 = ([same, exists]) => async () => {
|
|
1260
1260
|
const handleTeardown = async (last) => {
|
|
1261
1261
|
if (!last.data)
|
|
@@ -1266,7 +1266,10 @@ const executes$1 = (view, input, streamName) => {
|
|
|
1266
1266
|
method: m,
|
|
1267
1267
|
params: p,
|
|
1268
1268
|
};
|
|
1269
|
-
|
|
1269
|
+
const [action, out] = actions[method](collection, params);
|
|
1270
|
+
log('teardown', `db.['${snapshotCollection.collectionName}'].drop()`, ...out);
|
|
1271
|
+
await Promise.all([snapshotCollection.drop(), action]);
|
|
1272
|
+
log('teardown done', `db.['${snapshotCollection.collectionName}'].drop()`, ...out);
|
|
1270
1273
|
};
|
|
1271
1274
|
if (exists && !same)
|
|
1272
1275
|
await handleTeardown(exists);
|
|
@@ -1422,7 +1425,10 @@ const executes = (view, input, streamName) => {
|
|
|
1422
1425
|
method: m,
|
|
1423
1426
|
params: p,
|
|
1424
1427
|
};
|
|
1425
|
-
|
|
1428
|
+
const [action, out] = actions[method](collection, params);
|
|
1429
|
+
log('teardown', ...out);
|
|
1430
|
+
await action;
|
|
1431
|
+
log('teardown done', ...out);
|
|
1426
1432
|
};
|
|
1427
1433
|
if (exists && !same)
|
|
1428
1434
|
await handleTeardown(exists);
|