@omegup/msync 0.0.25 → 0.0.27

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 +19 -13
  2. package/index.js +19 -13
  3. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -551,7 +551,9 @@ const $merge_ = ({ into, on, whenNotMatched, ...notMatched }) => asStages([
551
551
 
552
552
  const subMerge = (args, out, gid, extra, idPrefix, first) => {
553
553
  const doubleReplace = (x) => x;
554
- const mergeAggregates = $set_(set()(mapExact0(args, (v, k) => to(v.merge(root().of(k).expr(), ctx()('new').of(k).expr())))));
554
+ const mergeAggregates = $set_(set()(mapExact0(args, (v, k) => to(first
555
+ ? ctx()('new').of(k).expr()
556
+ : v.merge(root().of(k).expr(), ctx()('new').of(k).expr())))));
555
557
  const gidPath = root().of(gid).expr();
556
558
  const mapId = (k, v) => map1(k, v);
557
559
  const F1 = {
@@ -574,15 +576,13 @@ const subMerge = (args, out, gid, extra, idPrefix, first) => {
574
576
  .with($merge_({
575
577
  ...out,
576
578
  on: root().of(gid),
577
- ...(first
578
- ? { whenMatched: 'merge' }
579
- : {
580
- vars: { new: ['new', root().expr()] },
581
- stages: 'ctx',
582
- whenMatched: link()
583
- .with(mergeAggregates)
584
- .with(doubleReplace($set_(updater))).stages,
585
- }),
579
+ ...{
580
+ vars: { new: ['new', root().expr()] },
581
+ stages: 'ctx',
582
+ whenMatched: link()
583
+ .with(mergeAggregates)
584
+ .with(doubleReplace($set_(updater))).stages,
585
+ },
586
586
  })).stages);
587
587
  };
588
588
 
@@ -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) => {
@@ -1264,7 +1264,10 @@ const executes$1 = (view, input, streamName) => {
1264
1264
  method: m,
1265
1265
  params: p,
1266
1266
  };
1267
- await Promise.all([snapshotCollection.drop(), actions[method](collection, params)]);
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
- await actions[method](collection, params);
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
@@ -553,7 +553,9 @@ const $merge_ = ({ into, on, whenNotMatched, ...notMatched }) => asStages([
553
553
 
554
554
  const subMerge = (args, out, gid, extra, idPrefix, first) => {
555
555
  const doubleReplace = (x) => x;
556
- const mergeAggregates = $set_(set()(mapExact0(args, (v, k) => to(v.merge(root().of(k).expr(), ctx()('new').of(k).expr())))));
556
+ const mergeAggregates = $set_(set()(mapExact0(args, (v, k) => to(first
557
+ ? ctx()('new').of(k).expr()
558
+ : v.merge(root().of(k).expr(), ctx()('new').of(k).expr())))));
557
559
  const gidPath = root().of(gid).expr();
558
560
  const mapId = (k, v) => map1(k, v);
559
561
  const F1 = {
@@ -576,15 +578,13 @@ const subMerge = (args, out, gid, extra, idPrefix, first) => {
576
578
  .with($merge_({
577
579
  ...out,
578
580
  on: root().of(gid),
579
- ...(first
580
- ? { whenMatched: 'merge' }
581
- : {
582
- vars: { new: ['new', root().expr()] },
583
- stages: 'ctx',
584
- whenMatched: link()
585
- .with(mergeAggregates)
586
- .with(doubleReplace($set_(updater))).stages,
587
- }),
581
+ ...{
582
+ vars: { new: ['new', root().expr()] },
583
+ stages: 'ctx',
584
+ whenMatched: link()
585
+ .with(mergeAggregates)
586
+ .with(doubleReplace($set_(updater))).stages,
587
+ },
588
588
  })).stages);
589
589
  };
590
590
 
@@ -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) => {
@@ -1266,7 +1266,10 @@ const executes$1 = (view, input, streamName) => {
1266
1266
  method: m,
1267
1267
  params: p,
1268
1268
  };
1269
- await Promise.all([snapshotCollection.drop(), actions[method](collection, params)]);
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
- await actions[method](collection, params);
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);
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.25",
6
+ "version": "0.0.27",
7
7
  "dependencies": {
8
8
  "dayjs": "^1.11.9",
9
9
  "dotenv": "^16.3.1",