@omegup/msync 0.1.35 → 0.1.37
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 +3 -1
- package/index.esm.js +19 -5
- package/index.js +20 -4
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -236,6 +236,8 @@ declare const concat: {
|
|
|
236
236
|
<D, C>(...expr: Expr<string, D, C>[]): Expr<string, D, C>;
|
|
237
237
|
<D, C>(...expr: Expr<string | N, D, C>[]): Expr<string | N, D, C>;
|
|
238
238
|
};
|
|
239
|
+
declare const $substr: <D, C>(expr: Expr<string, D, C>, start: Expr<number, D, C>, length: Expr<number, D, C>) => Expr<string, D, C>;
|
|
240
|
+
declare const padLeft: <D, C>(expr: Expr<string, D, C>, pad: string) => Expr<string, D, C>;
|
|
239
241
|
declare const regex: <D, C>(expr: Expr<string, D, C>, regex: Expr<string, D, C>, options?: Expr<string, D, C>) => Expr<boolean, D, C>;
|
|
240
242
|
declare const str: <D, C>(expr: Expr<unknown, D, C>) => Expr<string, D, C>;
|
|
241
243
|
declare const toInt: <D, C>(expr: Expr<unknown, D, C>) => Expr<number, D, C>;
|
|
@@ -685,5 +687,5 @@ declare const enablePreAndPostImages: <T extends doc>(coll: Collection<T>) => Pr
|
|
|
685
687
|
declare const prepare: (testName?: string) => Promise<MongoClient$1>;
|
|
686
688
|
declare const makeCol: <T extends ID>(docs: readonly OptionalUnlessRequiredId<T>[], database: Db, name?: string) => Promise<Collection<T>>;
|
|
687
689
|
|
|
688
|
-
export { $accumulator, $and, $countDict, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $group_, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $insert, $insertPart, $insertX, $keys, $let, $lookup, $lt, $lte, $map, $map0, $map1, $match, $matchDelta, $merge, $merge2, $mergeId, $mergePart, $merge_, $ne, $nin, $nor, $or, $outerLookup, $pushDict, $rand, $reduce, $replaceWith, $set, $simpleInsert, $simpleMerge, $simpleMergePart, $sum, $type, $unwind, $unwindDelta, Expr, Field, Machine, Type, add, and, anyElementTrue, array, ceil, comp, concat, concatArray, createIndex, ctx, current, dateAdd, dateDiff, dateLt, datePart, dayAndMonthPart, divide, enablePreAndPostImages, eq, eqTyped, except, exprMapVal, field, fieldF, fieldM, filter, filterDefined, first, firstSure, floor, from, func, getWhenMatched, getWhenMatchedForMerge, gt, gte, inArray, isArray, ite, last, log, lt, lte, makeCol, map1, mapFromPlainDateTime, mapToPlainDateTime, 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, single, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, weekPart, wrap, year };
|
|
690
|
+
export { $accumulator, $and, $countDict, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $group_, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $insert, $insertPart, $insertX, $keys, $let, $lookup, $lt, $lte, $map, $map0, $map1, $match, $matchDelta, $merge, $merge2, $mergeId, $mergePart, $merge_, $ne, $nin, $nor, $or, $outerLookup, $pushDict, $rand, $reduce, $replaceWith, $set, $simpleInsert, $simpleMerge, $simpleMergePart, $substr, $sum, $type, $unwind, $unwindDelta, Expr, Field, Machine, Type, add, and, anyElementTrue, array, ceil, comp, concat, concatArray, createIndex, ctx, current, dateAdd, dateDiff, dateLt, datePart, dayAndMonthPart, divide, enablePreAndPostImages, eq, eqTyped, except, exprMapVal, field, fieldF, fieldM, filter, filterDefined, first, firstSure, floor, from, func, getWhenMatched, getWhenMatchedForMerge, gt, gte, inArray, isArray, ite, last, log, lt, lte, makeCol, map1, mapFromPlainDateTime, mapToPlainDateTime, mapVal, max, maxDate, mergeExact, mergeExact0, mergeExpr, mergeObjects, minDate, monthPart, multiply, ne, nil, noop, not, notNull, now, or, padLeft, pair, prepare, rand, range, regex, root, set, setField, single, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, weekPart, wrap, year };
|
|
689
691
|
export type { Accumulators, Arr, AsLiteral, Delta, DeltaAccumulator, DeltaAccumulators, ExactKeys, ExprHKT, Exprs, ExprsExact, ExprsExactHKT, ExprsPart, ID, Loose, Merge, MergeArgs, MergeInto, MergeMapOArgs, Model, MongoTypeNames, N, NoRaw, NullToOBJ, O, OPick, OPickD, Patch, RONoRaw, RORec, RawStages, Rec, Replace, SnapshotStreamExecutionResult, StrKey, Strict, TS, WriteonlyCollection, doc, jsonPrim, notArr };
|
package/index.esm.js
CHANGED
|
@@ -299,6 +299,23 @@ const $entries = (expr) => func(function (obj) {
|
|
|
299
299
|
const concat$1 = (...expr) => asExpr({
|
|
300
300
|
raw: f => asExprRaw({ $concat: expr.map(e => e.raw(f).get()) }),
|
|
301
301
|
});
|
|
302
|
+
const $substr = (expr, start, length) => asExpr({
|
|
303
|
+
raw: f => asExprRaw({
|
|
304
|
+
$substrCP: [expr.raw(f).get(), start.raw(f).get(), length.raw(f).get()],
|
|
305
|
+
}),
|
|
306
|
+
});
|
|
307
|
+
const padLeft = (expr, pad) => asExpr({
|
|
308
|
+
raw: f => asExprRaw({
|
|
309
|
+
$let: {
|
|
310
|
+
vars: {
|
|
311
|
+
x: {
|
|
312
|
+
$concat: [{ $literal: pad }, expr.raw(f).get()],
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
in: { $substrCP: ['$$x', { $subtract: [{ $strLenCP: '$$x' }, pad.length] }, pad.length] },
|
|
316
|
+
},
|
|
317
|
+
}),
|
|
318
|
+
});
|
|
302
319
|
const regex = (expr, regex, options) => asExpr({
|
|
303
320
|
raw: f => asExprRaw({
|
|
304
321
|
$regexMatch: {
|
|
@@ -315,10 +332,7 @@ const toInt = (expr) => asExpr({
|
|
|
315
332
|
raw: f => asExprRaw({ $toInt: expr.raw(f).get() }),
|
|
316
333
|
});
|
|
317
334
|
const fieldM = (expr, m) => asExpr({
|
|
318
|
-
raw: (f) => asExprRaw(Object.fromEntries(Object.entries(m).flatMap(([dom, ref]) => expr[ref] ? [[
|
|
319
|
-
dom,
|
|
320
|
-
expr[ref].raw(f).get(),
|
|
321
|
-
]] : []))),
|
|
335
|
+
raw: (f) => asExprRaw(Object.fromEntries(Object.entries(m).flatMap(([dom, ref]) => expr[ref] ? [[dom, expr[ref].raw(f).get()]] : []))),
|
|
322
336
|
});
|
|
323
337
|
const mergeExact = (...[exprsExact1, exprsExact2]) => spread(exprsExact1, exprsExact2);
|
|
324
338
|
const mergeExact0 = (...[exprsExact1, exprsExact2]) => spread0(exprsExact1, exprsExact2);
|
|
@@ -2265,4 +2279,4 @@ const executes = (view, input, needs) => {
|
|
|
2265
2279
|
};
|
|
2266
2280
|
const single = (view, needs = {}) => pipe(input => executes(view, input, needs), emptyDelta(), concatDelta, emptyDelta);
|
|
2267
2281
|
|
|
2268
|
-
export { $accumulator, $and, $countDict, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $group_, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $insert, $insertPart, $insertX, $keys, $let, $lookup, $lt, $lte, $map, $map0, $map1, $match, $matchDelta, $merge, $merge2, $mergeId, $mergePart, $merge_, $ne, $nin, $nor, $or, $outerLookup, $pushDict, $rand, $reduce, $replaceWith, $set, $simpleInsert, $simpleMerge, $simpleMergePart, $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, getWhenMatched, getWhenMatchedForMerge, gt, gte, inArray, isArray, ite, last, log, lt, lte, makeCol, map1, mapFromPlainDateTime, mapToPlainDateTime, 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, single, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, weekPart, wrap, year };
|
|
2282
|
+
export { $accumulator, $and, $countDict, $entries, $eq, $exists, $expr, $getField, $group, $groupId, $groupMerge, $group_, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $insert, $insertPart, $insertX, $keys, $let, $lookup, $lt, $lte, $map, $map0, $map1, $match, $matchDelta, $merge, $merge2, $mergeId, $mergePart, $merge_, $ne, $nin, $nor, $or, $outerLookup, $pushDict, $rand, $reduce, $replaceWith, $set, $simpleInsert, $simpleMerge, $simpleMergePart, $substr, $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, getWhenMatched, getWhenMatchedForMerge, gt, gte, inArray, isArray, ite, last, log, lt, lte, makeCol, map1, mapFromPlainDateTime, mapToPlainDateTime, mapVal, max, maxDate, mergeExact, mergeExact0, mergeExpr, mergeObjects, minDate, monthPart, multiply, ne, nil, noop, not, notNull, now, or, padLeft, pair, prepare, rand, range, regex, root, set, setField, single, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, weekPart, wrap, year };
|
package/index.js
CHANGED
|
@@ -301,6 +301,23 @@ const $entries = (expr) => func(function (obj) {
|
|
|
301
301
|
const concat$1 = (...expr) => asExpr({
|
|
302
302
|
raw: f => asExprRaw({ $concat: expr.map(e => e.raw(f).get()) }),
|
|
303
303
|
});
|
|
304
|
+
const $substr = (expr, start, length) => asExpr({
|
|
305
|
+
raw: f => asExprRaw({
|
|
306
|
+
$substrCP: [expr.raw(f).get(), start.raw(f).get(), length.raw(f).get()],
|
|
307
|
+
}),
|
|
308
|
+
});
|
|
309
|
+
const padLeft = (expr, pad) => asExpr({
|
|
310
|
+
raw: f => asExprRaw({
|
|
311
|
+
$let: {
|
|
312
|
+
vars: {
|
|
313
|
+
x: {
|
|
314
|
+
$concat: [{ $literal: pad }, expr.raw(f).get()],
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
in: { $substrCP: ['$$x', { $subtract: [{ $strLenCP: '$$x' }, pad.length] }, pad.length] },
|
|
318
|
+
},
|
|
319
|
+
}),
|
|
320
|
+
});
|
|
304
321
|
const regex = (expr, regex, options) => asExpr({
|
|
305
322
|
raw: f => asExprRaw({
|
|
306
323
|
$regexMatch: {
|
|
@@ -317,10 +334,7 @@ const toInt = (expr) => asExpr({
|
|
|
317
334
|
raw: f => asExprRaw({ $toInt: expr.raw(f).get() }),
|
|
318
335
|
});
|
|
319
336
|
const fieldM = (expr, m) => asExpr({
|
|
320
|
-
raw: (f) => asExprRaw(Object.fromEntries(Object.entries(m).flatMap(([dom, ref]) => expr[ref] ? [[
|
|
321
|
-
dom,
|
|
322
|
-
expr[ref].raw(f).get(),
|
|
323
|
-
]] : []))),
|
|
337
|
+
raw: (f) => asExprRaw(Object.fromEntries(Object.entries(m).flatMap(([dom, ref]) => expr[ref] ? [[dom, expr[ref].raw(f).get()]] : []))),
|
|
324
338
|
});
|
|
325
339
|
const mergeExact = (...[exprsExact1, exprsExact2]) => spread(exprsExact1, exprsExact2);
|
|
326
340
|
const mergeExact0 = (...[exprsExact1, exprsExact2]) => spread0(exprsExact1, exprsExact2);
|
|
@@ -2316,6 +2330,7 @@ exports.$set = $set;
|
|
|
2316
2330
|
exports.$simpleInsert = $simpleInsert;
|
|
2317
2331
|
exports.$simpleMerge = $simpleMerge;
|
|
2318
2332
|
exports.$simpleMergePart = $simpleMergePart;
|
|
2333
|
+
exports.$substr = $substr;
|
|
2319
2334
|
exports.$sum = $sum;
|
|
2320
2335
|
exports.$type = $type;
|
|
2321
2336
|
exports.$unwind = $unwind;
|
|
@@ -2386,6 +2401,7 @@ exports.not = not;
|
|
|
2386
2401
|
exports.notNull = notNull;
|
|
2387
2402
|
exports.now = now;
|
|
2388
2403
|
exports.or = or;
|
|
2404
|
+
exports.padLeft = padLeft;
|
|
2389
2405
|
exports.pair = pair;
|
|
2390
2406
|
exports.prepare = prepare;
|
|
2391
2407
|
exports.rand = rand;
|