@omegup/msync 0.0.79 → 0.0.81
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 +13 -14
- package/index.js +13 -14
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -484,7 +484,7 @@ declare const $unwindDelta: <K1 extends s$1, T extends doc, K2 extends s$1, U ex
|
|
|
484
484
|
|
|
485
485
|
type s = string;
|
|
486
486
|
type TOf<TT, K extends string> = doc & Omit<TT, K>;
|
|
487
|
-
declare const $unwind: <TT extends O, K extends s, U extends doc>(k: AsLiteral<K>, dict: RORec<K, "key">, middle
|
|
487
|
+
declare const $unwind: <TT extends O, K extends s, U extends doc>(k: AsLiteral<K>, dict: RORec<K, "key"> & RORec<"_id", "id">, middle?: string) => DeltaStages<O, TOf<TT, K> & Rec<K, Arr<U>>, TOf<TT, K> & Rec<K, U>>;
|
|
488
488
|
|
|
489
489
|
type Allowed$2<K extends string> = Exclude<K, keyof (TS & ID)>;
|
|
490
490
|
type Patch<V, KK extends StrKey<V> = StrKey<V>> = ((OPick<V, Allowed$2<KK>> & ID) | (Rec<Allowed$2<KK>, N> & ID)) & TS;
|
package/index.esm.js
CHANGED
|
@@ -313,10 +313,10 @@ const toInt = (expr) => asExpr({
|
|
|
313
313
|
raw: f => asExprRaw({ $toInt: expr.raw(f).get() }),
|
|
314
314
|
});
|
|
315
315
|
const fieldM = (expr, m) => asExpr({
|
|
316
|
-
raw: (f) => asExprRaw(Object.fromEntries(Object.entries(m).
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
316
|
+
raw: (f) => asExprRaw(Object.fromEntries(Object.entries(m).flatMap(([dom, ref]) => expr[ref] ? [[
|
|
317
|
+
dom,
|
|
318
|
+
expr[ref].raw(f).get(),
|
|
319
|
+
]] : []))),
|
|
320
320
|
});
|
|
321
321
|
const mergeExact = (...[exprsExact1, exprsExact2]) => spread(exprsExact1, exprsExact2);
|
|
322
322
|
const mergeExact0 = (...[exprsExact1, exprsExact2]) => spread0(exprsExact1, exprsExact2);
|
|
@@ -1059,13 +1059,7 @@ const $unwindDelta = (k1, k2, k, includeNull, middle) => {
|
|
|
1059
1059
|
after: partReplace('after'),
|
|
1060
1060
|
},
|
|
1061
1061
|
},
|
|
1062
|
-
...(!k && middle
|
|
1063
|
-
? [
|
|
1064
|
-
{
|
|
1065
|
-
$set: { _id: { $ifNull: ['$before._id', '$after._id'] } },
|
|
1066
|
-
},
|
|
1067
|
-
]
|
|
1068
|
-
: []),
|
|
1062
|
+
...(!k && middle ? [{ $set: { _id: { $ifNull: ['$before._id', '$after._id'] } } }] : []),
|
|
1069
1063
|
]))
|
|
1070
1064
|
.with($match_($expr(ne(part('before'))(part('after'))))).stages;
|
|
1071
1065
|
return stages;
|
|
@@ -1075,12 +1069,14 @@ const $unwind = (k, dict, middle) => {
|
|
|
1075
1069
|
return {
|
|
1076
1070
|
delta: link()
|
|
1077
1071
|
.with($replaceWithDelta(field({
|
|
1072
|
+
_id: ['_id', root().of('_id').expr()],
|
|
1078
1073
|
left: ['left', root().expr()],
|
|
1079
1074
|
right: ['right', root().of(k).expr()],
|
|
1080
1075
|
})))
|
|
1081
1076
|
.with($unwindDelta('left', 'right', false, undefined, middle))
|
|
1082
1077
|
.with($replaceWithDelta(mergeObjects(root().of('left').expr(), fieldM({
|
|
1083
1078
|
key: root().of('right').expr(),
|
|
1079
|
+
id: root().of('_id').expr(),
|
|
1084
1080
|
}, dict)))).stages,
|
|
1085
1081
|
raw: $unwind1(k),
|
|
1086
1082
|
};
|
|
@@ -1158,7 +1154,10 @@ const createIndex = async (collection, indexSpec, options) => {
|
|
|
1158
1154
|
}
|
|
1159
1155
|
};
|
|
1160
1156
|
|
|
1161
|
-
const patch = (x, k, v) =>
|
|
1157
|
+
const patch = ({ ...x }, k, v) => {
|
|
1158
|
+
delete x[k];
|
|
1159
|
+
return { ...x, [k]: v };
|
|
1160
|
+
};
|
|
1162
1161
|
const restart = (sources) => {
|
|
1163
1162
|
return map(sources, x => x.stop());
|
|
1164
1163
|
};
|
|
@@ -1646,8 +1645,8 @@ const executes$2 = (view, input, streamName, skip = false, after) => {
|
|
|
1646
1645
|
await after?.();
|
|
1647
1646
|
return nextData([])(async () => {
|
|
1648
1647
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1649
|
-
return step3(same)
|
|
1650
|
-
}, 'clone into new collection');
|
|
1648
|
+
return next(step3(same), 'clone into new collection');
|
|
1649
|
+
}, 'wait for clone into new collection');
|
|
1651
1650
|
};
|
|
1652
1651
|
const step3 = (lastTS) => async () => {
|
|
1653
1652
|
const notDeleted = eq($ifNull(root().of('deletedAt').expr(), nil))(nil);
|
package/index.js
CHANGED
|
@@ -315,10 +315,10 @@ const toInt = (expr) => asExpr({
|
|
|
315
315
|
raw: f => asExprRaw({ $toInt: expr.raw(f).get() }),
|
|
316
316
|
});
|
|
317
317
|
const fieldM = (expr, m) => asExpr({
|
|
318
|
-
raw: (f) => asExprRaw(Object.fromEntries(Object.entries(m).
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
318
|
+
raw: (f) => asExprRaw(Object.fromEntries(Object.entries(m).flatMap(([dom, ref]) => expr[ref] ? [[
|
|
319
|
+
dom,
|
|
320
|
+
expr[ref].raw(f).get(),
|
|
321
|
+
]] : []))),
|
|
322
322
|
});
|
|
323
323
|
const mergeExact = (...[exprsExact1, exprsExact2]) => spread(exprsExact1, exprsExact2);
|
|
324
324
|
const mergeExact0 = (...[exprsExact1, exprsExact2]) => spread0(exprsExact1, exprsExact2);
|
|
@@ -1061,13 +1061,7 @@ const $unwindDelta = (k1, k2, k, includeNull, middle) => {
|
|
|
1061
1061
|
after: partReplace('after'),
|
|
1062
1062
|
},
|
|
1063
1063
|
},
|
|
1064
|
-
...(!k && middle
|
|
1065
|
-
? [
|
|
1066
|
-
{
|
|
1067
|
-
$set: { _id: { $ifNull: ['$before._id', '$after._id'] } },
|
|
1068
|
-
},
|
|
1069
|
-
]
|
|
1070
|
-
: []),
|
|
1064
|
+
...(!k && middle ? [{ $set: { _id: { $ifNull: ['$before._id', '$after._id'] } } }] : []),
|
|
1071
1065
|
]))
|
|
1072
1066
|
.with($match_($expr(ne(part('before'))(part('after'))))).stages;
|
|
1073
1067
|
return stages;
|
|
@@ -1077,12 +1071,14 @@ const $unwind = (k, dict, middle) => {
|
|
|
1077
1071
|
return {
|
|
1078
1072
|
delta: link()
|
|
1079
1073
|
.with($replaceWithDelta(field({
|
|
1074
|
+
_id: ['_id', root().of('_id').expr()],
|
|
1080
1075
|
left: ['left', root().expr()],
|
|
1081
1076
|
right: ['right', root().of(k).expr()],
|
|
1082
1077
|
})))
|
|
1083
1078
|
.with($unwindDelta('left', 'right', false, undefined, middle))
|
|
1084
1079
|
.with($replaceWithDelta(mergeObjects(root().of('left').expr(), fieldM({
|
|
1085
1080
|
key: root().of('right').expr(),
|
|
1081
|
+
id: root().of('_id').expr(),
|
|
1086
1082
|
}, dict)))).stages,
|
|
1087
1083
|
raw: $unwind1(k),
|
|
1088
1084
|
};
|
|
@@ -1160,7 +1156,10 @@ const createIndex = async (collection, indexSpec, options) => {
|
|
|
1160
1156
|
}
|
|
1161
1157
|
};
|
|
1162
1158
|
|
|
1163
|
-
const patch = (x, k, v) =>
|
|
1159
|
+
const patch = ({ ...x }, k, v) => {
|
|
1160
|
+
delete x[k];
|
|
1161
|
+
return { ...x, [k]: v };
|
|
1162
|
+
};
|
|
1164
1163
|
const restart = (sources) => {
|
|
1165
1164
|
return map(sources, x => x.stop());
|
|
1166
1165
|
};
|
|
@@ -1648,8 +1647,8 @@ const executes$2 = (view, input, streamName, skip = false, after) => {
|
|
|
1648
1647
|
await after?.();
|
|
1649
1648
|
return nextData([])(async () => {
|
|
1650
1649
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1651
|
-
return step3(same)
|
|
1652
|
-
}, 'clone into new collection');
|
|
1650
|
+
return next(step3(same), 'clone into new collection');
|
|
1651
|
+
}, 'wait for clone into new collection');
|
|
1653
1652
|
};
|
|
1654
1653
|
const step3 = (lastTS) => async () => {
|
|
1655
1654
|
const notDeleted = eq($ifNull(root().of('deletedAt').expr(), nil))(nil);
|