@omegup/msync 0.1.0 → 0.1.1
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 +2 -2
- package/index.esm.js +5 -5
- package/index.js +5 -5
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -526,7 +526,7 @@ interface SnapshotStreamHKT extends HKT<O2> {
|
|
|
526
526
|
interface DeltaHKT extends HKT<O3> {
|
|
527
527
|
readonly out: DeltaStages<I<O3, this>[0], I<O3, this>[1], I<O3, this>[2]>;
|
|
528
528
|
}
|
|
529
|
-
declare const staging: <V extends Model, KK extends StrKey<V>>(view: View<V, Allowed$1<KK>>, streamName: string, skip?: boolean, after?: () => Promise<void
|
|
529
|
+
declare const staging: <V extends Model, KK extends StrKey<V>>(view: View<V, Allowed$1<KK>>, streamName: string, skip?: boolean, after?: () => Promise<void>, allowEmtpies?: readonly KK[]) => DeltaPipe<AllowedPick$1<V, KK>, AllowedPick$1<V, KK>, SnapshotStreamHKT, DeltaHKT>;
|
|
530
530
|
|
|
531
531
|
type Allowed<K> = Exclude<K, 'deletedAt' | '_id'>;
|
|
532
532
|
type AllowedPick<V extends Model, K extends StrKey<V>> = OPickD<V, Allowed<K>>;
|
|
@@ -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
|
@@ -1630,7 +1630,7 @@ const getFirstStages = (view) => {
|
|
|
1630
1630
|
};
|
|
1631
1631
|
|
|
1632
1632
|
const streamNames = {};
|
|
1633
|
-
const executes$2 = (view, input, streamName, skip = false, after) => {
|
|
1633
|
+
const executes$2 = (view, input, streamName, skip = false, after, allowEmtpies) => {
|
|
1634
1634
|
const { collection, projection, match } = view;
|
|
1635
1635
|
const { firstStages, hardMatch } = getFirstStages(view);
|
|
1636
1636
|
const db = collection.s.db, coll = collection.collectionName;
|
|
@@ -1819,9 +1819,9 @@ const executes$2 = (view, input, streamName, skip = false, after) => {
|
|
|
1819
1819
|
out: run,
|
|
1820
1820
|
};
|
|
1821
1821
|
};
|
|
1822
|
-
const staging = (view, streamName, skip = false, after) => pipe(input => executes$2(view, input, streamName, skip, after), emptyDelta(), concatDelta, emptyDelta);
|
|
1822
|
+
const staging = (view, streamName, skip = false, after, allowEmtpies) => pipe(input => executes$2(view, input, streamName, skip, after), emptyDelta(), concatDelta, emptyDelta);
|
|
1823
1823
|
|
|
1824
|
-
const executes$1 = (view, input, streamName) => {
|
|
1824
|
+
const executes$1 = (view, input, streamName, allowEmtpies) => {
|
|
1825
1825
|
const hash = crypto$1
|
|
1826
1826
|
.createHash('md5')
|
|
1827
1827
|
.update(new Error().stack + '')
|
|
@@ -1831,7 +1831,7 @@ const executes$1 = (view, input, streamName) => {
|
|
|
1831
1831
|
else if (streamNames[streamName] != hash)
|
|
1832
1832
|
throw new Error('streamName already used');
|
|
1833
1833
|
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));
|
|
1834
|
+
const removeNotYetSynchronizedFields = projection && Object.values(mapExactToObject(projection, (_, k) => k.startsWith('_') && !allowEmtpies?.includes(k) ? root().of(k).has($exists(true)) : null));
|
|
1835
1835
|
const hardMatch = removeNotYetSynchronizedFields ? $and(pre, ...removeNotYetSynchronizedFields) : pre;
|
|
1836
1836
|
const job = {};
|
|
1837
1837
|
const db = collection.s.db, coll = collection.collectionName;
|
|
@@ -1942,7 +1942,7 @@ const executes$1 = (view, input, streamName) => {
|
|
|
1942
1942
|
};
|
|
1943
1943
|
};
|
|
1944
1944
|
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);
|
|
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);
|
|
1946
1946
|
|
|
1947
1947
|
const executes = (view, input) => {
|
|
1948
1948
|
const { firstStages } = getFirstStages(view);
|
package/index.js
CHANGED
|
@@ -1632,7 +1632,7 @@ const getFirstStages = (view) => {
|
|
|
1632
1632
|
};
|
|
1633
1633
|
|
|
1634
1634
|
const streamNames = {};
|
|
1635
|
-
const executes$2 = (view, input, streamName, skip = false, after) => {
|
|
1635
|
+
const executes$2 = (view, input, streamName, skip = false, after, allowEmtpies) => {
|
|
1636
1636
|
const { collection, projection, match } = view;
|
|
1637
1637
|
const { firstStages, hardMatch } = getFirstStages(view);
|
|
1638
1638
|
const db = collection.s.db, coll = collection.collectionName;
|
|
@@ -1821,9 +1821,9 @@ const executes$2 = (view, input, streamName, skip = false, after) => {
|
|
|
1821
1821
|
out: run,
|
|
1822
1822
|
};
|
|
1823
1823
|
};
|
|
1824
|
-
const staging = (view, streamName, skip = false, after) => pipe(input => executes$2(view, input, streamName, skip, after), emptyDelta(), concatDelta, emptyDelta);
|
|
1824
|
+
const staging = (view, streamName, skip = false, after, allowEmtpies) => pipe(input => executes$2(view, input, streamName, skip, after), emptyDelta(), concatDelta, emptyDelta);
|
|
1825
1825
|
|
|
1826
|
-
const executes$1 = (view, input, streamName) => {
|
|
1826
|
+
const executes$1 = (view, input, streamName, allowEmtpies) => {
|
|
1827
1827
|
const hash = crypto$1
|
|
1828
1828
|
.createHash('md5')
|
|
1829
1829
|
.update(new Error().stack + '')
|
|
@@ -1833,7 +1833,7 @@ const executes$1 = (view, input, streamName) => {
|
|
|
1833
1833
|
else if (streamNames[streamName] != hash)
|
|
1834
1834
|
throw new Error('streamName already used');
|
|
1835
1835
|
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));
|
|
1836
|
+
const removeNotYetSynchronizedFields = projection && Object.values(mapExactToObject(projection, (_, k) => k.startsWith('_') && !allowEmtpies?.includes(k) ? root().of(k).has($exists(true)) : null));
|
|
1837
1837
|
const hardMatch = removeNotYetSynchronizedFields ? $and(pre, ...removeNotYetSynchronizedFields) : pre;
|
|
1838
1838
|
const job = {};
|
|
1839
1839
|
const db = collection.s.db, coll = collection.collectionName;
|
|
@@ -1944,7 +1944,7 @@ const executes$1 = (view, input, streamName) => {
|
|
|
1944
1944
|
};
|
|
1945
1945
|
};
|
|
1946
1946
|
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);
|
|
1947
|
+
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
1948
|
|
|
1949
1949
|
const executes = (view, input) => {
|
|
1950
1950
|
const { firstStages } = getFirstStages(view);
|