@omegup/msync 0.1.0 → 0.1.2
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 -1
- package/index.esm.js +6 -8
- package/index.js +6 -8
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -536,7 +536,7 @@ interface StreamRunnerHKT extends HKT<O2> {
|
|
|
536
536
|
interface StagesHKT extends HKT<O3> {
|
|
537
537
|
readonly out: RORec<'lin', RawStages<I<O3, this>[0], I<O3, this>[1], I<O3, this>[2], unknown, 1>>;
|
|
538
538
|
}
|
|
539
|
-
declare const from: <V extends Model, KK extends StrKey<V>>(view: View<V, Allowed<KK>>, streamName: string) => DeltaPipe<AllowedPick<V, KK>, AllowedPick<V, KK>, StreamRunnerHKT, StagesHKT>;
|
|
539
|
+
declare const from: <V extends Model, KK extends StrKey<V>>(view: View<V, Allowed<KK>>, streamName: string, allowEmtpies?: readonly KK[]) => DeltaPipe<AllowedPick<V, KK>, AllowedPick<V, KK>, StreamRunnerHKT, StagesHKT>;
|
|
540
540
|
|
|
541
541
|
type SingleResult<out Result> = <Result2>(finalInput: RawStages<unknown, Result, Result2>) => Stages<unknown, Result2, unknown>;
|
|
542
542
|
interface SnapshotStreamHKT2 extends HKT<O2> {
|
package/index.esm.js
CHANGED
|
@@ -1384,14 +1384,12 @@ const $mergeX = (out, keys, f, map, whenNotMatched = 'fail', ext) => {
|
|
|
1384
1384
|
whenMatched: asStages([
|
|
1385
1385
|
{
|
|
1386
1386
|
$replaceWith: {
|
|
1387
|
-
old:
|
|
1388
|
-
? { $mergeObjects: ['$$ROOT', { deletedAt: '$deletedAt' }] }
|
|
1389
|
-
: '$$ROOT',
|
|
1387
|
+
old: '$$ROOT',
|
|
1390
1388
|
merged: {
|
|
1391
1389
|
$mergeObjects: [
|
|
1392
1390
|
'$$ROOT',
|
|
1393
1391
|
'$$new',
|
|
1394
|
-
...(setDeleted ? [{ deletedAt: '$deletedAt' }] : []),
|
|
1392
|
+
...(setDeleted ? [{ deletedAt: { $ifNull: ['$deletedAt', null] } }] : []),
|
|
1395
1393
|
],
|
|
1396
1394
|
},
|
|
1397
1395
|
},
|
|
@@ -1401,7 +1399,7 @@ const $mergeX = (out, keys, f, map, whenNotMatched = 'fail', ext) => {
|
|
|
1401
1399
|
$cond: {
|
|
1402
1400
|
if: {
|
|
1403
1401
|
$eq: [
|
|
1404
|
-
'$old',
|
|
1402
|
+
{ $mergeObjects: ['$old', { deletedAt: { $ifNull: ['$old.deletedAt', null] } }] },
|
|
1405
1403
|
{ $mergeObjects: ['$merged', { touchedAt: '$old.touchedAt' }] },
|
|
1406
1404
|
],
|
|
1407
1405
|
},
|
|
@@ -1821,7 +1819,7 @@ const executes$2 = (view, input, streamName, skip = false, after) => {
|
|
|
1821
1819
|
};
|
|
1822
1820
|
const staging = (view, streamName, skip = false, after) => pipe(input => executes$2(view, input, streamName, skip, after), emptyDelta(), concatDelta, emptyDelta);
|
|
1823
1821
|
|
|
1824
|
-
const executes$1 = (view, input, streamName) => {
|
|
1822
|
+
const executes$1 = (view, input, streamName, allowEmtpies) => {
|
|
1825
1823
|
const hash = crypto$1
|
|
1826
1824
|
.createHash('md5')
|
|
1827
1825
|
.update(new Error().stack + '')
|
|
@@ -1831,7 +1829,7 @@ const executes$1 = (view, input, streamName) => {
|
|
|
1831
1829
|
else if (streamNames[streamName] != hash)
|
|
1832
1830
|
throw new Error('streamName already used');
|
|
1833
1831
|
const { collection, projection, hardMatch: pre, match } = view;
|
|
1834
|
-
const removeNotYetSynchronizedFields = projection && Object.values(mapExactToObject(projection, (_, k) => k.startsWith('_') ? root().of(k).has($exists(true)) : null));
|
|
1832
|
+
const removeNotYetSynchronizedFields = projection && Object.values(mapExactToObject(projection, (_, k) => k.startsWith('_') && !allowEmtpies?.includes(k) ? root().of(k).has($exists(true)) : null));
|
|
1835
1833
|
const hardMatch = removeNotYetSynchronizedFields ? $and(pre, ...removeNotYetSynchronizedFields) : pre;
|
|
1836
1834
|
const job = {};
|
|
1837
1835
|
const db = collection.s.db, coll = collection.collectionName;
|
|
@@ -1942,7 +1940,7 @@ const executes$1 = (view, input, streamName) => {
|
|
|
1942
1940
|
};
|
|
1943
1941
|
};
|
|
1944
1942
|
const emptyLin = () => ({ lin: link().stages });
|
|
1945
|
-
const from = (view, streamName) => pipe(input => executes$1(view, input.lin, streamName), { lin: link().stages }, ({ lin: a }, { lin: b }) => ({ lin: concatStages(a, b) }), emptyLin);
|
|
1943
|
+
const from = (view, streamName, allowEmtpies) => pipe(input => executes$1(view, input.lin, streamName, allowEmtpies), { lin: link().stages }, ({ lin: a }, { lin: b }) => ({ lin: concatStages(a, b) }), emptyLin);
|
|
1946
1944
|
|
|
1947
1945
|
const executes = (view, input) => {
|
|
1948
1946
|
const { firstStages } = getFirstStages(view);
|
package/index.js
CHANGED
|
@@ -1386,14 +1386,12 @@ const $mergeX = (out, keys, f, map, whenNotMatched = 'fail', ext) => {
|
|
|
1386
1386
|
whenMatched: asStages([
|
|
1387
1387
|
{
|
|
1388
1388
|
$replaceWith: {
|
|
1389
|
-
old:
|
|
1390
|
-
? { $mergeObjects: ['$$ROOT', { deletedAt: '$deletedAt' }] }
|
|
1391
|
-
: '$$ROOT',
|
|
1389
|
+
old: '$$ROOT',
|
|
1392
1390
|
merged: {
|
|
1393
1391
|
$mergeObjects: [
|
|
1394
1392
|
'$$ROOT',
|
|
1395
1393
|
'$$new',
|
|
1396
|
-
...(setDeleted ? [{ deletedAt: '$deletedAt' }] : []),
|
|
1394
|
+
...(setDeleted ? [{ deletedAt: { $ifNull: ['$deletedAt', null] } }] : []),
|
|
1397
1395
|
],
|
|
1398
1396
|
},
|
|
1399
1397
|
},
|
|
@@ -1403,7 +1401,7 @@ const $mergeX = (out, keys, f, map, whenNotMatched = 'fail', ext) => {
|
|
|
1403
1401
|
$cond: {
|
|
1404
1402
|
if: {
|
|
1405
1403
|
$eq: [
|
|
1406
|
-
'$old',
|
|
1404
|
+
{ $mergeObjects: ['$old', { deletedAt: { $ifNull: ['$old.deletedAt', null] } }] },
|
|
1407
1405
|
{ $mergeObjects: ['$merged', { touchedAt: '$old.touchedAt' }] },
|
|
1408
1406
|
],
|
|
1409
1407
|
},
|
|
@@ -1823,7 +1821,7 @@ const executes$2 = (view, input, streamName, skip = false, after) => {
|
|
|
1823
1821
|
};
|
|
1824
1822
|
const staging = (view, streamName, skip = false, after) => pipe(input => executes$2(view, input, streamName, skip, after), emptyDelta(), concatDelta, emptyDelta);
|
|
1825
1823
|
|
|
1826
|
-
const executes$1 = (view, input, streamName) => {
|
|
1824
|
+
const executes$1 = (view, input, streamName, allowEmtpies) => {
|
|
1827
1825
|
const hash = crypto$1
|
|
1828
1826
|
.createHash('md5')
|
|
1829
1827
|
.update(new Error().stack + '')
|
|
@@ -1833,7 +1831,7 @@ const executes$1 = (view, input, streamName) => {
|
|
|
1833
1831
|
else if (streamNames[streamName] != hash)
|
|
1834
1832
|
throw new Error('streamName already used');
|
|
1835
1833
|
const { collection, projection, hardMatch: pre, match } = view;
|
|
1836
|
-
const removeNotYetSynchronizedFields = projection && Object.values(mapExactToObject(projection, (_, k) => k.startsWith('_') ? root().of(k).has($exists(true)) : null));
|
|
1834
|
+
const removeNotYetSynchronizedFields = projection && Object.values(mapExactToObject(projection, (_, k) => k.startsWith('_') && !allowEmtpies?.includes(k) ? root().of(k).has($exists(true)) : null));
|
|
1837
1835
|
const hardMatch = removeNotYetSynchronizedFields ? $and(pre, ...removeNotYetSynchronizedFields) : pre;
|
|
1838
1836
|
const job = {};
|
|
1839
1837
|
const db = collection.s.db, coll = collection.collectionName;
|
|
@@ -1944,7 +1942,7 @@ const executes$1 = (view, input, streamName) => {
|
|
|
1944
1942
|
};
|
|
1945
1943
|
};
|
|
1946
1944
|
const emptyLin = () => ({ lin: link().stages });
|
|
1947
|
-
const from = (view, streamName) => pipe(input => executes$1(view, input.lin, streamName), { lin: link().stages }, ({ lin: a }, { lin: b }) => ({ lin: concatStages(a, b) }), emptyLin);
|
|
1945
|
+
const from = (view, streamName, allowEmtpies) => pipe(input => executes$1(view, input.lin, streamName, allowEmtpies), { lin: link().stages }, ({ lin: a }, { lin: b }) => ({ lin: concatStages(a, b) }), emptyLin);
|
|
1948
1946
|
|
|
1949
1947
|
const executes = (view, input) => {
|
|
1950
1948
|
const { firstStages } = getFirstStages(view);
|