@omegup/msync 0.0.70 → 0.0.72
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.d.ts +1 -2
- package/index.esm.js +12 -8
- package/index.js +12 -8
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Timestamp, Filter, UpdateFilter, BSON, Db, Collection, IndexSpecification, CreateIndexesOptions, MongoClient as MongoClient$1, OptionalUnlessRequiredId } from 'mongodb';
|
|
2
2
|
export { Collection, Timestamp } from 'mongodb';
|
|
3
|
-
import * as bson from 'bson';
|
|
4
3
|
|
|
5
4
|
type HasJob = {
|
|
6
5
|
job: object | undefined;
|
|
@@ -687,7 +686,7 @@ declare const map1: <K extends string, Im>(k: AsLiteral<K>, to: Im) => { readonl
|
|
|
687
686
|
readonly [_: string]: [K, Im];
|
|
688
687
|
};
|
|
689
688
|
|
|
690
|
-
declare const enablePreAndPostImages: <T extends doc>(coll: Collection<T>) => Promise<
|
|
689
|
+
declare const enablePreAndPostImages: <T extends doc>(coll: Collection<T>) => Promise<Document>;
|
|
691
690
|
declare const prepare: (testName?: string) => Promise<MongoClient$1>;
|
|
692
691
|
declare const makeCol: <T extends ID>(docs: readonly OptionalUnlessRequiredId<T>[], database: Db, name?: string) => Promise<Collection<T>>;
|
|
693
692
|
|
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UUID, MongoClient } from 'mongodb';
|
|
2
1
|
import { SynchronousPromise } from 'synchronous-promise';
|
|
3
2
|
import crypto$1 from 'crypto';
|
|
3
|
+
import { UUID, MongoClient } from 'mongodb';
|
|
4
4
|
import { writeFile } from 'fs/promises';
|
|
5
5
|
|
|
6
6
|
const asExprRaw = (raw) => ({ get: () => raw });
|
|
@@ -1180,13 +1180,16 @@ const nextWinner = (previousWinner, previousWinnerNextFrame, sources, interrupt)
|
|
|
1180
1180
|
const mergeIterators = (params) => {
|
|
1181
1181
|
const { sources, interrupt, select = race } = params;
|
|
1182
1182
|
const reiterate = (winner) => {
|
|
1183
|
-
const { frame, key } = winner
|
|
1183
|
+
const { frame, key } = winner;
|
|
1184
1184
|
return {
|
|
1185
|
-
cont: () =>
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1185
|
+
cont: () => {
|
|
1186
|
+
const result = frame.cont();
|
|
1187
|
+
return mergeIterators({
|
|
1188
|
+
sources: patch(sources, key, result),
|
|
1189
|
+
interrupt,
|
|
1190
|
+
select: sources => nextWinner(winner, result.next, sources, interrupt),
|
|
1191
|
+
});
|
|
1192
|
+
},
|
|
1190
1193
|
data: frame.data,
|
|
1191
1194
|
info: { key, value: frame.info, job: frame.info.job },
|
|
1192
1195
|
};
|
|
@@ -1245,6 +1248,7 @@ const runCont = async (it, cb) => {
|
|
|
1245
1248
|
const res = await next.then(next => ({ ok: true, next }), err => ({ ok: false, err }));
|
|
1246
1249
|
if (!res.ok) {
|
|
1247
1250
|
log('error', res.err);
|
|
1251
|
+
process.exit(1);
|
|
1248
1252
|
return runCont(stop, cb);
|
|
1249
1253
|
}
|
|
1250
1254
|
const { cont, info } = res.next;
|
|
@@ -1615,7 +1619,7 @@ const executes$2 = (view, input, streamName, skip = false, after) => {
|
|
|
1615
1619
|
await Promise.all([snapshotCollection.drop().catch(noop), action]);
|
|
1616
1620
|
log('teardown done', `db['${snapshotCollection.collectionName}'].drop()`, ...out);
|
|
1617
1621
|
};
|
|
1618
|
-
if (!
|
|
1622
|
+
if (!same) {
|
|
1619
1623
|
await handleTeardown(exists ?? { data });
|
|
1620
1624
|
}
|
|
1621
1625
|
await after?.();
|
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var mongodb = require('mongodb');
|
|
4
3
|
var synchronousPromise = require('synchronous-promise');
|
|
5
4
|
var crypto$1 = require('crypto');
|
|
5
|
+
var mongodb = require('mongodb');
|
|
6
6
|
var promises = require('fs/promises');
|
|
7
7
|
|
|
8
8
|
const asExprRaw = (raw) => ({ get: () => raw });
|
|
@@ -1182,13 +1182,16 @@ const nextWinner = (previousWinner, previousWinnerNextFrame, sources, interrupt)
|
|
|
1182
1182
|
const mergeIterators = (params) => {
|
|
1183
1183
|
const { sources, interrupt, select = race } = params;
|
|
1184
1184
|
const reiterate = (winner) => {
|
|
1185
|
-
const { frame, key } = winner
|
|
1185
|
+
const { frame, key } = winner;
|
|
1186
1186
|
return {
|
|
1187
|
-
cont: () =>
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1187
|
+
cont: () => {
|
|
1188
|
+
const result = frame.cont();
|
|
1189
|
+
return mergeIterators({
|
|
1190
|
+
sources: patch(sources, key, result),
|
|
1191
|
+
interrupt,
|
|
1192
|
+
select: sources => nextWinner(winner, result.next, sources, interrupt),
|
|
1193
|
+
});
|
|
1194
|
+
},
|
|
1192
1195
|
data: frame.data,
|
|
1193
1196
|
info: { key, value: frame.info, job: frame.info.job },
|
|
1194
1197
|
};
|
|
@@ -1247,6 +1250,7 @@ const runCont = async (it, cb) => {
|
|
|
1247
1250
|
const res = await next.then(next => ({ ok: true, next }), err => ({ ok: false, err }));
|
|
1248
1251
|
if (!res.ok) {
|
|
1249
1252
|
log('error', res.err);
|
|
1253
|
+
process.exit(1);
|
|
1250
1254
|
return runCont(stop, cb);
|
|
1251
1255
|
}
|
|
1252
1256
|
const { cont, info } = res.next;
|
|
@@ -1617,7 +1621,7 @@ const executes$2 = (view, input, streamName, skip = false, after) => {
|
|
|
1617
1621
|
await Promise.all([snapshotCollection.drop().catch(noop), action]);
|
|
1618
1622
|
log('teardown done', `db['${snapshotCollection.collectionName}'].drop()`, ...out);
|
|
1619
1623
|
};
|
|
1620
|
-
if (!
|
|
1624
|
+
if (!same) {
|
|
1621
1625
|
await handleTeardown(exists ?? { data });
|
|
1622
1626
|
}
|
|
1623
1627
|
await after?.();
|