@omegup/msync 0.0.60 → 0.0.62
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 +8 -2
- package/index.esm.js +9 -5
- package/index.js +10 -4
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -565,6 +565,7 @@ declare const sortArray: <T, D, C, K extends keyof T>({ sortBy, expr, order, }:
|
|
|
565
565
|
order?: 1 | -1;
|
|
566
566
|
}) => Expr<Arr<T>, D, C>;
|
|
567
567
|
declare const isArray: <T extends notArr, D, C, F extends HKT<T | Arr<T>>>(expr: Expr<T | Arr<T>, D & (App<F, T> | App<F, Arr<T>>), C>) => BoolExpr<D & App<F, Arr<T>>, D & App<F, T>, C>;
|
|
568
|
+
declare const inArray: <T, D, C>(item: Expr<T, D, C>, expr: Expr<Arr<T>, D, C>) => Expr<boolean, D, C>;
|
|
568
569
|
declare const array: <T, D, C = unknown>(...exprs: Expr<T, D, C>[]) => Expr<Arr<T>, D, C>;
|
|
569
570
|
declare const concatArray: <T, D, C>(...exprs: Expr<Arr<T>, D, C>[]) => Expr<Arr<T>, D, C>;
|
|
570
571
|
declare const first: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T | null, D, C>;
|
|
@@ -572,7 +573,7 @@ declare const firstSure: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T, D, C>;
|
|
|
572
573
|
declare const last: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T | null, D, C>;
|
|
573
574
|
type NullToOBJ<N extends null> = N extends null ? O : N;
|
|
574
575
|
declare const mergeObjects: <T1, T2, D, C = unknown, N extends null = never>(exprs_0: Expr<T1 | N, D, C>, exprs_1: Expr<T2, D, C>) => Expr<(T1 | NullToOBJ<N>) & T2, D, C>;
|
|
575
|
-
declare const anyElementTrue: <
|
|
576
|
+
declare const anyElementTrue: <D, C = unknown>(expr: Expr<Arr<boolean>, D, C>) => Expr<boolean, D, C>;
|
|
576
577
|
declare const slice: <T, D, C>(array: Expr<Arr<T>, D, C>, start: Expr<number, D, C>, end: Expr<number, D, C>) => Expr<Arr<T>, D, C>;
|
|
577
578
|
declare const except: <T, D, C>(a: Expr<Arr<T>, D, C>, b: Expr<Arr<T>, D, C>) => Expr<Arr<T>, D, C>;
|
|
578
579
|
|
|
@@ -614,6 +615,11 @@ declare const setField: <K extends string, T, V, D, C>({ field, input, value, }:
|
|
|
614
615
|
}) => Expr<T & Record<K, V>, D, C>;
|
|
615
616
|
|
|
616
617
|
declare const range: <D, C>(start: Expr<number, D, C>, end: Expr<number, D, C>, step?: Expr<number, D, C>) => Expr<Arr<number>, D, C>;
|
|
618
|
+
declare const $map0: <K extends string, T, R, D, C>({ as, expr, input, }: {
|
|
619
|
+
input: Expr<Arr<T>, D, C>;
|
|
620
|
+
as: K;
|
|
621
|
+
expr: Expr<R, D, RORec<K, T> & C>;
|
|
622
|
+
}) => Expr<Arr<R>, D, C>;
|
|
617
623
|
declare const $map1: <T, R, D, C>(ex: Expr<Arr<T>, D, C>, map: (i: Field<unknown, T, RORec<"item", T>>) => Expr<R, D, RORec<"item", T> & C>) => Expr<Arr<R>, D, C>;
|
|
618
624
|
declare const $map: <T, R, D, C = unknown>(ex: Expr<Arr<T>, D, C>, map: (i: Expr<T, D, RORec<"item", T>>) => Expr<R, D, RORec<"item", T> & C>) => Expr<Arr<R>, D, C>;
|
|
619
625
|
|
|
@@ -677,4 +683,4 @@ declare const enablePreAndPostImages: <T extends doc>(coll: Collection<T>) => Pr
|
|
|
677
683
|
declare const prepare: (testName?: string) => Promise<MongoClient$1>;
|
|
678
684
|
declare const makeCol: <T extends ID>(docs: readonly OptionalUnlessRequiredId<T>[], database: Db, name?: string) => Promise<Collection<T>>;
|
|
679
685
|
|
|
680
|
-
export { $accumulator, $and, $countDict, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $insert, $insertX, $keys, $let, $lookup, $lt, $lte, $map, $map1, $match, $matchDelta, $merge, $merge_, $ne, $nin, $nor, $or, $outerLookup, $pushDict, $rand, $replaceWith, $set, $simpleInsert, $simpleMerge, $sum, $type, $unwind, $unwindDelta, type Accumulators, type Arr, type AsLiteral, type Delta, type DeltaAccumulator, type DeltaAccumulators, Expr, type ExprHKT, type Exprs, type ExprsExact, type ExprsExactHKT, type ExprsPart, Field, type ID, type Loose, Machine, type Merge, type MergeArgs, type MergeInto, type MergeMapOArgs, type Model, type MongoTypeNames, type N, type NoRaw, type NullToOBJ, type O, type OPick, type OPickD, type RONoRaw, type RORec, type RawStages, type Rec, type Replace, type SnapshotStreamExecutionResult, type StrKey, type Strict, type TS, Type, type WriteonlyCollection, add, and, anyElementTrue, array, ceil, comp, concat, concatArray, createIndex, ctx, current, dateAdd, dateDiff, dateLt, datePart, dayAndMonthPart, divide, type doc, enablePreAndPostImages, eq, eqTyped, except, exprMapVal, field, fieldF, fieldM, filter, filterDefined, first, firstSure, floor, from, func, gt, gte, isArray, ite, last, log, lt, lte, makeCol, map1, mapVal, max, maxDate, mergeExact, mergeExact0, mergeExpr, mergeObjects, minDate, monthPart, multiply, ne, nil, noop, not, type notArr, notNull, now, or, pair, prepare, rand, range, regex, root, set, setField, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, weekPart, wrap, year };
|
|
686
|
+
export { $accumulator, $and, $countDict, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $insert, $insertX, $keys, $let, $lookup, $lt, $lte, $map, $map0, $map1, $match, $matchDelta, $merge, $merge_, $ne, $nin, $nor, $or, $outerLookup, $pushDict, $rand, $replaceWith, $set, $simpleInsert, $simpleMerge, $sum, $type, $unwind, $unwindDelta, type Accumulators, type Arr, type AsLiteral, type Delta, type DeltaAccumulator, type DeltaAccumulators, Expr, type ExprHKT, type Exprs, type ExprsExact, type ExprsExactHKT, type ExprsPart, Field, type ID, type Loose, Machine, type Merge, type MergeArgs, type MergeInto, type MergeMapOArgs, type Model, type MongoTypeNames, type N, type NoRaw, type NullToOBJ, type O, type OPick, type OPickD, type RONoRaw, type RORec, type RawStages, type Rec, type Replace, type SnapshotStreamExecutionResult, type StrKey, type Strict, type TS, Type, type WriteonlyCollection, add, and, anyElementTrue, array, ceil, comp, concat, concatArray, createIndex, ctx, current, dateAdd, dateDiff, dateLt, datePart, dayAndMonthPart, divide, type doc, enablePreAndPostImages, eq, eqTyped, except, exprMapVal, field, fieldF, fieldM, filter, filterDefined, first, firstSure, floor, from, func, gt, gte, inArray, isArray, ite, last, log, lt, lte, makeCol, map1, mapVal, max, maxDate, mergeExact, mergeExact0, mergeExpr, mergeObjects, minDate, monthPart, multiply, ne, nil, noop, not, type notArr, notNull, now, or, pair, prepare, rand, range, regex, root, set, setField, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, weekPart, wrap, year };
|
package/index.esm.js
CHANGED
|
@@ -392,6 +392,9 @@ const sortArray = ({ sortBy, expr, order, }) => asExpr({
|
|
|
392
392
|
const isArray = (expr) => asBoolExpr({
|
|
393
393
|
raw: f => asExprRaw({ $isArray: expr.raw(f).get() }),
|
|
394
394
|
});
|
|
395
|
+
const inArray = (item, expr) => asExpr({
|
|
396
|
+
raw: f => asExprRaw({ $in: [item.raw(f).get(), expr.raw(f).get()] }),
|
|
397
|
+
});
|
|
395
398
|
const array = (...exprs) => asExpr({
|
|
396
399
|
raw: f => asExprRaw(exprs.map(x => x.raw(f).get())),
|
|
397
400
|
});
|
|
@@ -882,15 +885,16 @@ const dateDiff = ({ end, unit, start, }) => asExpr({
|
|
|
882
885
|
const range = (start, end, step) => asExpr({
|
|
883
886
|
raw: f => asExprRaw({ $range: [start.raw(f).get(), end.raw(f).get(), step?.raw(f).get() ?? 1] }),
|
|
884
887
|
});
|
|
885
|
-
const $
|
|
888
|
+
const $map0 = ({ as, expr, input, }) => asExpr({
|
|
886
889
|
raw: f => asExprRaw({
|
|
887
890
|
$map: {
|
|
888
|
-
input:
|
|
889
|
-
as
|
|
890
|
-
in:
|
|
891
|
+
input: input.raw(f).get(),
|
|
892
|
+
as,
|
|
893
|
+
in: expr.raw(f).get(),
|
|
891
894
|
},
|
|
892
895
|
}),
|
|
893
896
|
});
|
|
897
|
+
const $map1 = (ex, map) => $map0({ input: ex, as: 'item', expr: map(ctx()('item')) });
|
|
894
898
|
const $map = (ex, map) => $map1(ex, i => map(i.expr()));
|
|
895
899
|
|
|
896
900
|
const operator = () => (op) => (operand) => {
|
|
@@ -1850,4 +1854,4 @@ const makeCol = async (docs, database, name) => {
|
|
|
1850
1854
|
}
|
|
1851
1855
|
};
|
|
1852
1856
|
|
|
1853
|
-
export { $accumulator, $and, $countDict, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $insert, $insertX, $keys, $let, $lookup, $lt, $lte, $map, $map1, $match, $matchDelta, $merge, $merge_, $ne, $nin, $nor, $or, $outerLookup, $pushDict, $rand, $replaceWith, $set, $simpleInsert, $simpleMerge, $sum, $type, $unwind, $unwindDelta, Field, Machine, add, and, anyElementTrue, array, ceil, comp, concat$1 as concat, concatArray, createIndex, ctx, current, dateAdd, dateDiff, dateLt, datePart, dayAndMonthPart, divide, enablePreAndPostImages, eq, eqTyped, except, exprMapVal, field, fieldF, fieldM, filter, filterDefined, first$1 as first, firstSure, floor, from, func, gt, gte, isArray, ite, last, log, lt, lte, makeCol, map1, mapVal, max, maxDate, mergeExact, mergeExact0, mergeExpr, mergeObjects, minDate, monthPart, multiply, ne, nil, noop, not, notNull, now, or, pair, prepare, rand, range, regex, root, set, setField, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, weekPart, wrap, year };
|
|
1857
|
+
export { $accumulator, $and, $countDict, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $insert, $insertX, $keys, $let, $lookup, $lt, $lte, $map, $map0, $map1, $match, $matchDelta, $merge, $merge_, $ne, $nin, $nor, $or, $outerLookup, $pushDict, $rand, $replaceWith, $set, $simpleInsert, $simpleMerge, $sum, $type, $unwind, $unwindDelta, Field, Machine, add, and, anyElementTrue, array, ceil, comp, concat$1 as concat, concatArray, createIndex, ctx, current, dateAdd, dateDiff, dateLt, datePart, dayAndMonthPart, divide, enablePreAndPostImages, eq, eqTyped, except, exprMapVal, field, fieldF, fieldM, filter, filterDefined, first$1 as first, firstSure, floor, from, func, gt, gte, inArray, isArray, ite, last, log, lt, lte, makeCol, map1, mapVal, max, maxDate, mergeExact, mergeExact0, mergeExpr, mergeObjects, minDate, monthPart, multiply, ne, nil, noop, not, notNull, now, or, pair, prepare, rand, range, regex, root, set, setField, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, weekPart, wrap, year };
|
package/index.js
CHANGED
|
@@ -394,6 +394,9 @@ const sortArray = ({ sortBy, expr, order, }) => asExpr({
|
|
|
394
394
|
const isArray = (expr) => asBoolExpr({
|
|
395
395
|
raw: f => asExprRaw({ $isArray: expr.raw(f).get() }),
|
|
396
396
|
});
|
|
397
|
+
const inArray = (item, expr) => asExpr({
|
|
398
|
+
raw: f => asExprRaw({ $in: [item.raw(f).get(), expr.raw(f).get()] }),
|
|
399
|
+
});
|
|
397
400
|
const array = (...exprs) => asExpr({
|
|
398
401
|
raw: f => asExprRaw(exprs.map(x => x.raw(f).get())),
|
|
399
402
|
});
|
|
@@ -884,15 +887,16 @@ const dateDiff = ({ end, unit, start, }) => asExpr({
|
|
|
884
887
|
const range = (start, end, step) => asExpr({
|
|
885
888
|
raw: f => asExprRaw({ $range: [start.raw(f).get(), end.raw(f).get(), step?.raw(f).get() ?? 1] }),
|
|
886
889
|
});
|
|
887
|
-
const $
|
|
890
|
+
const $map0 = ({ as, expr, input, }) => asExpr({
|
|
888
891
|
raw: f => asExprRaw({
|
|
889
892
|
$map: {
|
|
890
|
-
input:
|
|
891
|
-
as
|
|
892
|
-
in:
|
|
893
|
+
input: input.raw(f).get(),
|
|
894
|
+
as,
|
|
895
|
+
in: expr.raw(f).get(),
|
|
893
896
|
},
|
|
894
897
|
}),
|
|
895
898
|
});
|
|
899
|
+
const $map1 = (ex, map) => $map0({ input: ex, as: 'item', expr: map(ctx()('item')) });
|
|
896
900
|
const $map = (ex, map) => $map1(ex, i => map(i.expr()));
|
|
897
901
|
|
|
898
902
|
const operator = () => (op) => (operand) => {
|
|
@@ -1877,6 +1881,7 @@ exports.$lookup = $lookup;
|
|
|
1877
1881
|
exports.$lt = $lt;
|
|
1878
1882
|
exports.$lte = $lte;
|
|
1879
1883
|
exports.$map = $map;
|
|
1884
|
+
exports.$map0 = $map0;
|
|
1880
1885
|
exports.$map1 = $map1;
|
|
1881
1886
|
exports.$match = $match;
|
|
1882
1887
|
exports.$matchDelta = $matchDelta;
|
|
@@ -1933,6 +1938,7 @@ exports.from = from;
|
|
|
1933
1938
|
exports.func = func;
|
|
1934
1939
|
exports.gt = gt;
|
|
1935
1940
|
exports.gte = gte;
|
|
1941
|
+
exports.inArray = inArray;
|
|
1936
1942
|
exports.isArray = isArray;
|
|
1937
1943
|
exports.ite = ite;
|
|
1938
1944
|
exports.last = last;
|