@omegup/msync 0.1.40 → 0.1.41

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 CHANGED
@@ -358,6 +358,16 @@ declare const $pushDict: <D extends O, V, C = unknown>(key: Expr<string, D, C>,
358
358
  declare const $keys: <D extends O, C = unknown>(expr: Expr<Rec<string, number>, D, C>) => Expr<Arr<string>, D, C>;
359
359
  declare const $entries: <D extends O, V, C = unknown>(expr: Expr<Rec<string, Rec<"1" | "0", Arr<V>>>, D, C>) => Expr<Arr<Rec<"k", string> & Rec<"v", V>>, D, C>;
360
360
 
361
+ type DeltaPipe<Q extends O, T extends Q, F extends HKT<O2>, G extends HKT<O3>> = {
362
+ with: <Q2 extends O, V extends Q2>(map: (a: Stream<Q, T, F, G>) => Stream<Q | Q2, V, F, G>) => DeltaPipe<Q | Q2, V, F, G>;
363
+ then: <Q2 extends O, V extends Q2>(next: App<G, [Q2 | T, T, V]>) => DeltaPipe<Q | Q2, V, F, G>;
364
+ get: () => App<F, [Q, T]>;
365
+ };
366
+ declare const emptyDelta: <T extends O>() => {
367
+ delta: RawStages<Delta<T>, Delta<T>, Delta<T>, unknown, number>;
368
+ raw: <F extends HKT<O>>() => RawStages<App<F, T>, App<F, T>, App<F, T>, unknown, number>;
369
+ };
370
+
361
371
  type MergeInto<T extends O, Out extends O, E = unknown> = {
362
372
  whenNotMatched: 'insert';
363
373
  into: RWCollection<T, Out> & E;
@@ -507,12 +517,6 @@ declare const map1: <K extends string, Im>(k: AsLiteral<K>, to: Im) => { readonl
507
517
 
508
518
  declare const $group_: <V extends O>() => <ID, T extends O, C = unknown>(id: Expr<ID, T, C>, args: Accumulators<T, V, C>) => RawStages<O, T, Rec<"_id", ID> & V, C, 1>;
509
519
 
510
- type DeltaPipe<Q extends O, T extends Q, F extends HKT<O2>, G extends HKT<O3>> = {
511
- with: <Q2 extends O, V extends Q2>(map: (a: Stream<Q, T, F, G>) => Stream<Q | Q2, V, F, G>) => DeltaPipe<Q | Q2, V, F, G>;
512
- then: <Q2 extends O, V extends Q2>(next: App<G, [Q2 | T, T, V]>) => DeltaPipe<Q | Q2, V, F, G>;
513
- get: () => App<F, [Q, T]>;
514
- };
515
-
516
520
  type AllowedPick$1<V extends Model, K extends StrKey<V>> = OPickD<V, Allowed$1<K>>;
517
521
  type Allowed$1<K> = Exclude<K, 'deletedAt' | '_id'>;
518
522
 
@@ -674,7 +678,7 @@ declare const $gte: <T extends Numeric>(operand: rawItem & number) => Predicate<
674
678
  declare const $lte: <T extends Numeric>(operand: rawItem & number) => Predicate<number>;
675
679
  type MongoTypes = {
676
680
  number: number;
677
- array: readonly rawItem[];
681
+ array: Arr<rawItem>;
678
682
  string: string;
679
683
  object: RawObj;
680
684
  [i: number]: unknown;
@@ -701,5 +705,5 @@ declare const enablePreAndPostImages: <T extends doc>(coll: Collection<T>) => Pr
701
705
  declare const prepare: (testName?: string) => Promise<MongoClient$1>;
702
706
  declare const makeCol: <T extends ID>(docs: readonly OptionalUnlessRequiredId<T>[], database: Db, name?: string) => Promise<Collection<T>>;
703
707
 
704
- export { $accumulator, $and, $countDict, $countDictArray, $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 };
708
+ export { $accumulator, $and, $countDict, $countDictArray, $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, emptyDelta, 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 };
705
709
  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
@@ -313,7 +313,35 @@ const $entries = (expr) => func(function (obj) {
313
313
  return Object.entries({ ...obj }).flatMap(([k, v]) => v[0].map(v => ({ k, v })));
314
314
  }, expr);
315
315
 
316
- const concat$1 = (...expr) => asExpr({
316
+ const asStages = (x) => x;
317
+ const concatStages = (part1, part2) => asStages([...part1, ...part2]);
318
+ const concatDelta = (part1, part2) => ({
319
+ delta: concatStages(part1.delta, part2.delta),
320
+ raw: f => concatStages(part1.raw(f), part2.raw(f)),
321
+ });
322
+ const pipe = (stream, s, concat, empty) => {
323
+ const acc = {
324
+ with: (map) => pipe(map(i => stream(concat(s, i))), empty(), concat, empty),
325
+ then: (next) => pipe(stream, concat(s, next), concat, empty),
326
+ get: () => stream(s),
327
+ };
328
+ return acc;
329
+ };
330
+ const concat$1 = (stages) => ({
331
+ with: extra => concat$1(concatStages(stages, extra)),
332
+ stages,
333
+ });
334
+ const link = () => ({
335
+ with: extra => concat$1(extra),
336
+ stages: asStages([]),
337
+ });
338
+ const emptyDelta = () => ({
339
+ delta: link().stages,
340
+ raw: () => link().stages,
341
+ });
342
+ const concatTStages = ({ coll, exec, input }, stages) => ({ coll, input, exec: concatStages(exec, stages) });
343
+
344
+ const concat = (...expr) => asExpr({
317
345
  raw: f => asExprRaw({ $concat: expr.map(e => e.raw(f).get()) }),
318
346
  });
319
347
  const $substr = (expr, start, length) => asExpr({
@@ -374,34 +402,6 @@ const omitRORec = () => assertEqual();
374
402
  const omitPick = () => assertEqual();
375
403
  const translateOmit = () => assertEqual();
376
404
 
377
- const asStages = (x) => x;
378
- const concatStages = (part1, part2) => asStages([...part1, ...part2]);
379
- const concatDelta = (part1, part2) => ({
380
- delta: concatStages(part1.delta, part2.delta),
381
- raw: f => concatStages(part1.raw(f), part2.raw(f)),
382
- });
383
- const pipe = (stream, s, concat, empty) => {
384
- const acc = {
385
- with: (map) => pipe(map(i => stream(concat(s, i))), empty(), concat, empty),
386
- then: (next) => pipe(stream, concat(s, next), concat, empty),
387
- get: () => stream(s),
388
- };
389
- return acc;
390
- };
391
- const concat = (stages) => ({
392
- with: extra => concat(concatStages(stages, extra)),
393
- stages,
394
- });
395
- const link = () => ({
396
- with: extra => concat(extra),
397
- stages: asStages([]),
398
- });
399
- const emptyDelta = () => ({
400
- delta: link().stages,
401
- raw: () => link().stages,
402
- });
403
- const concatTStages = ({ coll, exec, input }, stages) => ({ coll, input, exec: concatStages(exec, stages) });
404
-
405
405
  const size = (expr) => asExpr({
406
406
  raw: f => asExprRaw({ $size: expr.raw(f).get() }),
407
407
  });
@@ -958,7 +958,7 @@ const subMerge = (args, out, gid, extra, idPrefix, first) => {
958
958
  const gidPath = root().of(gid).expr();
959
959
  const mapId = (k, v) => map1(k, v);
960
960
  const F1 = {
961
- _id: ['_id', to(idPrefix ? concat$1(val(idPrefix), $rand) : $rand)],
961
+ _id: ['_id', to(idPrefix ? concat(val(idPrefix), $rand) : $rand)],
962
962
  touchedAt: ['touchedAt', to(current)],
963
963
  };
964
964
  const F2 = mapId(gid, to(gidPath));
@@ -2297,4 +2297,4 @@ const executes = (view, input, needs) => {
2297
2297
  };
2298
2298
  const single = (view, needs = {}) => pipe(input => executes(view, input, needs), emptyDelta(), concatDelta, emptyDelta);
2299
2299
 
2300
- export { $accumulator, $and, $countDict, $countDictArray, $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 };
2300
+ export { $accumulator, $and, $countDict, $countDictArray, $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, concatArray, createIndex, ctx, current, dateAdd, dateDiff, dateLt, datePart, dayAndMonthPart, divide, emptyDelta, 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
@@ -315,7 +315,35 @@ const $entries = (expr) => func(function (obj) {
315
315
  return Object.entries({ ...obj }).flatMap(([k, v]) => v[0].map(v => ({ k, v })));
316
316
  }, expr);
317
317
 
318
- const concat$1 = (...expr) => asExpr({
318
+ const asStages = (x) => x;
319
+ const concatStages = (part1, part2) => asStages([...part1, ...part2]);
320
+ const concatDelta = (part1, part2) => ({
321
+ delta: concatStages(part1.delta, part2.delta),
322
+ raw: f => concatStages(part1.raw(f), part2.raw(f)),
323
+ });
324
+ const pipe = (stream, s, concat, empty) => {
325
+ const acc = {
326
+ with: (map) => pipe(map(i => stream(concat(s, i))), empty(), concat, empty),
327
+ then: (next) => pipe(stream, concat(s, next), concat, empty),
328
+ get: () => stream(s),
329
+ };
330
+ return acc;
331
+ };
332
+ const concat$1 = (stages) => ({
333
+ with: extra => concat$1(concatStages(stages, extra)),
334
+ stages,
335
+ });
336
+ const link = () => ({
337
+ with: extra => concat$1(extra),
338
+ stages: asStages([]),
339
+ });
340
+ const emptyDelta = () => ({
341
+ delta: link().stages,
342
+ raw: () => link().stages,
343
+ });
344
+ const concatTStages = ({ coll, exec, input }, stages) => ({ coll, input, exec: concatStages(exec, stages) });
345
+
346
+ const concat = (...expr) => asExpr({
319
347
  raw: f => asExprRaw({ $concat: expr.map(e => e.raw(f).get()) }),
320
348
  });
321
349
  const $substr = (expr, start, length) => asExpr({
@@ -376,34 +404,6 @@ const omitRORec = () => assertEqual();
376
404
  const omitPick = () => assertEqual();
377
405
  const translateOmit = () => assertEqual();
378
406
 
379
- const asStages = (x) => x;
380
- const concatStages = (part1, part2) => asStages([...part1, ...part2]);
381
- const concatDelta = (part1, part2) => ({
382
- delta: concatStages(part1.delta, part2.delta),
383
- raw: f => concatStages(part1.raw(f), part2.raw(f)),
384
- });
385
- const pipe = (stream, s, concat, empty) => {
386
- const acc = {
387
- with: (map) => pipe(map(i => stream(concat(s, i))), empty(), concat, empty),
388
- then: (next) => pipe(stream, concat(s, next), concat, empty),
389
- get: () => stream(s),
390
- };
391
- return acc;
392
- };
393
- const concat = (stages) => ({
394
- with: extra => concat(concatStages(stages, extra)),
395
- stages,
396
- });
397
- const link = () => ({
398
- with: extra => concat(extra),
399
- stages: asStages([]),
400
- });
401
- const emptyDelta = () => ({
402
- delta: link().stages,
403
- raw: () => link().stages,
404
- });
405
- const concatTStages = ({ coll, exec, input }, stages) => ({ coll, input, exec: concatStages(exec, stages) });
406
-
407
407
  const size = (expr) => asExpr({
408
408
  raw: f => asExprRaw({ $size: expr.raw(f).get() }),
409
409
  });
@@ -960,7 +960,7 @@ const subMerge = (args, out, gid, extra, idPrefix, first) => {
960
960
  const gidPath = root().of(gid).expr();
961
961
  const mapId = (k, v) => map1(k, v);
962
962
  const F1 = {
963
- _id: ['_id', to(idPrefix ? concat$1(val(idPrefix), $rand) : $rand)],
963
+ _id: ['_id', to(idPrefix ? concat(val(idPrefix), $rand) : $rand)],
964
964
  touchedAt: ['touchedAt', to(current)],
965
965
  };
966
966
  const F2 = mapId(gid, to(gidPath));
@@ -2362,7 +2362,7 @@ exports.anyElementTrue = anyElementTrue;
2362
2362
  exports.array = array;
2363
2363
  exports.ceil = ceil;
2364
2364
  exports.comp = comp;
2365
- exports.concat = concat$1;
2365
+ exports.concat = concat;
2366
2366
  exports.concatArray = concatArray;
2367
2367
  exports.createIndex = createIndex;
2368
2368
  exports.ctx = ctx;
@@ -2373,6 +2373,7 @@ exports.dateLt = dateLt;
2373
2373
  exports.datePart = datePart;
2374
2374
  exports.dayAndMonthPart = dayAndMonthPart;
2375
2375
  exports.divide = divide;
2376
+ exports.emptyDelta = emptyDelta;
2376
2377
  exports.enablePreAndPostImages = enablePreAndPostImages;
2377
2378
  exports.eq = eq;
2378
2379
  exports.eqTyped = eqTyped;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "module": "index.esm.js",
4
4
  "typings": "index.d.ts",
5
5
  "name": "@omegup/msync",
6
- "version": "0.1.40",
6
+ "version": "0.1.41",
7
7
  "dependencies": {
8
8
  "dayjs": "^1.11.9",
9
9
  "dotenv": "^16.3.1",