@omegup/msync 0.0.1 → 0.0.2
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 +38 -3
- package/index.esm.js +20 -9
- package/index.js +36 -9
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Timestamp, BSON, Db, Collection, MongoClient as MongoClient$1 } from 'mongodb';
|
|
1
|
+
import { Timestamp, BSON, Db, Collection, IndexSpecification, CreateIndexesOptions, MongoClient as MongoClient$1 } from 'mongodb';
|
|
2
2
|
export { Collection, Timestamp } from 'mongodb';
|
|
3
3
|
import * as bson from 'bson';
|
|
4
4
|
|
|
@@ -135,6 +135,7 @@ type BoolExpr<in D1, in D2, in Ctx = unknown> = {
|
|
|
135
135
|
};
|
|
136
136
|
};
|
|
137
137
|
|
|
138
|
+
type ExactPart<T, F extends HKT<T[StrKey<T>]>> = MapOPart<T, MappedHKT<T, F>>;
|
|
138
139
|
type ExactKeys<K extends string> = Exact<RORec<K, 1>, IdHKT>;
|
|
139
140
|
type MapO<T, F extends HKT<StrKey<T>>> = MapOPart<T, F> & {
|
|
140
141
|
readonly [P: string]: readonly [StrKey<T>, unknown];
|
|
@@ -146,6 +147,9 @@ type Exact<T, F extends HKT<T[StrKey<T>]>> = MapO<T, MappedHKT<T, F>>;
|
|
|
146
147
|
interface MappedHKT<T, F extends HKT<T[StrKey<T>]>> extends HKT<StrKey<T>> {
|
|
147
148
|
readonly out: App<F, T[I<StrKey<T>, this>]>;
|
|
148
149
|
}
|
|
150
|
+
interface MergeHKT<T, V, F1 extends HKT<StrKey<Omit<T, No>>>, F2 extends HKT<StrKey<V>>, No extends keyof V = never> extends HKT<StrKey<V & Omit<T, No>>> {
|
|
151
|
+
readonly out: I<StrKey<V & Omit<T, No>>, this> extends StrKey<V> ? App<F2, I<StrKey<V>, this>> : App<F1, I<StrKey<Omit<T, No>>, this>>;
|
|
152
|
+
}
|
|
149
153
|
|
|
150
154
|
declare const AccumulatorRaw: unique symbol;
|
|
151
155
|
interface AccumulatorRaw<in Doc, out T, in C = unknown> extends RawObj {
|
|
@@ -172,10 +176,28 @@ type DeltaAccumulator<in out Doc, in out T, in out Ctx = unknown> = {
|
|
|
172
176
|
merge: <D, C = Ctx>(a: Expr<T | N, D, C>, b: Expr<T, D, C>) => Expr<T, D, C>;
|
|
173
177
|
};
|
|
174
178
|
|
|
179
|
+
declare const concat: <D, C>(...expr: Expr<string, D, C>[]) => Expr<string, D, C>;
|
|
180
|
+
declare const str: <D, C>(expr: Expr<unknown, D, C>) => Expr<string, D, C>;
|
|
181
|
+
declare const toInt: <D, C>(expr: Expr<unknown, D, C>) => Expr<number, D, C>;
|
|
182
|
+
declare const fieldM: <M extends RORec<Dom, Ref>, T extends RORec<Ref, unknown>, D, Dom extends string = StrKey<M>, Ref extends string = StrKey<T>, C = unknown>(expr: { readonly [K in Ref]: Expr<T[K], D, C>; }, m: Pick<M, Dom>) => Expr<O<{ readonly [K in Dom]: T[M[K]]; }>, D, C>;
|
|
183
|
+
type Exprs<out T, in D, in C = unknown> = {
|
|
184
|
+
readonly [K in StrKey<T>]: Expr<T[K], D, C>;
|
|
185
|
+
};
|
|
186
|
+
declare const mergeExact: <T1, T2, F extends HKT<T1[StrKey<T1>] | T2[StrKey<T2>]>, E = unknown>(exprsExact1: Exact<Omit<T1, keyof T2>, F>, exprsExact2: Exact<T2, F>) => Exact<T2 & Omit<T1, keyof T2> & Pick<E, symbol & keyof E>, F>;
|
|
187
|
+
type MergeMapOArgs<T1, T2, F1 extends HKT<StrKey<Omit<T1, StrKey<T2>>>>, F2 extends HKT<StrKey<T2>>> = readonly [MapO<Omit<T1, StrKey<T2>>, F1>, MapO<T2, F2>];
|
|
188
|
+
declare const mergeExact0: <T1, T2, F1 extends HKT<StrKey<Omit<T1, StrKey<T2>>>>, F2 extends HKT<StrKey<T2>>, E = unknown>(exprsExact1: MapO<Omit<T1, StrKey<T2>>, F1>, exprsExact2: MapO<T2, F2>) => MapO<T2 & Omit<T1, StrKey<T2>> & Pick<E, symbol & keyof E>, MergeHKT<T1, T2, F1, F2, StrKey<T2>>>;
|
|
189
|
+
declare const mergeExpr: <T1, T2, D, C = unknown, E = unknown>(exprs_0: Exact<Omit<T1, keyof T2>, ExprHKT<D, C, IdHKT<unknown>>>, exprs_1: Exact<T2, ExprHKT<D, C, IdHKT<unknown>>>) => ExprsExact<T2 & Omit<T1, keyof T2> & Pick<E, symbol & keyof E>, D, C>;
|
|
190
|
+
type ExprsPart<T, D, C> = ExactPart<T, ExprHKT<D, C>>;
|
|
175
191
|
interface ExprHKT<D, C = unknown, F extends HKT = IdHKT> extends HKT<unknown> {
|
|
176
192
|
readonly out: Expr<App<F, I<unknown, this>>, D, C>;
|
|
177
193
|
}
|
|
178
194
|
type ExprsExact<T, D, C = unknown, F extends HKT = IdHKT> = Exact<T, ExprHKT<D, C, F>>;
|
|
195
|
+
interface ExprsExactHKT<E, D, C = unknown, F extends HKT = IdHKT> extends HKT {
|
|
196
|
+
readonly out: ExprsExact<E & I<unknown, this>, D, C, F>;
|
|
197
|
+
}
|
|
198
|
+
declare const pair: <T, D, C, P extends StrKey<T>>(k: P, v: Expr<T[P], D, C>) => ExprsExact<T, D, C>[P];
|
|
199
|
+
declare const fieldF: <F extends HKT>() => <T extends object, D, C = unknown>(exprs: ExprsExact<T, D, C, F>) => Expr<O<{ [K in keyof T]: App<F, T[K]>; }>, D, C>;
|
|
200
|
+
declare const field: <T extends object, D, C = unknown>(exprs: ExprsExact<T, D, C>) => Expr<O<T>, D, C>;
|
|
179
201
|
|
|
180
202
|
declare const Type: unique symbol;
|
|
181
203
|
|
|
@@ -432,6 +454,8 @@ interface UpdaterHKT<R, Old, V, C, K extends keyof Old = keyof Old, V2 extends V
|
|
|
432
454
|
readonly out: Updater<R, Get<Old, I<StrKey<V>, this>, K>, V2[I<StrKey<V>, this>], C>;
|
|
433
455
|
}
|
|
434
456
|
type Get<T, P extends string, K extends keyof T = never> = P extends K ? T[P] : P extends keyof T ? T[P] : undefined;
|
|
457
|
+
declare const set: <V>() => <R, Old extends notArr, C = unknown, K extends keyof Old = never>(fields: MapO<V, UpdaterHKT<R, Old, V, C, K>>) => Updater<R, Old, O & Omit<Old, StrKey<V>> & V, C> & Updater<R, Arr<Old>, Arr<Omit<Old, StrKey<V>> & V>, C>;
|
|
458
|
+
declare const to: <R, V, C = unknown, T = unknown>(expr: Expr<V, R, C>) => Updater<R, T, V, C>;
|
|
435
459
|
|
|
436
460
|
declare const $set: <V extends O>() => <R extends O, C = unknown>(fields: MapO<V, UpdaterHKT<R, R, V, C>>) => DeltaStages<O, R, Replace<R, V>, C> & LinStages<O, R, Replace<R, V>, C>;
|
|
437
461
|
declare const $replaceWith: <T extends O, V extends O>(expr: Expr<V, T>) => DeltaStages<O, T, V> & LinStages<O, T, V>;
|
|
@@ -518,7 +542,7 @@ declare const sortArray: <T, D, C, K extends keyof T>({ sortBy, expr, order, }:
|
|
|
518
542
|
}) => Expr<Arr<T>, D, C>;
|
|
519
543
|
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>;
|
|
520
544
|
declare const array: <T, D, C = unknown>(...exprs: Expr<T, D, C>[]) => Expr<Arr<T>, D, C>;
|
|
521
|
-
declare const
|
|
545
|
+
declare const concatArray: <T, D, C>(...exprs: Expr<Arr<T>, D, C>[]) => Expr<Arr<T>, D, C>;
|
|
522
546
|
declare const first: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T | null, D, C>;
|
|
523
547
|
declare const firstSure: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T, D, C>;
|
|
524
548
|
declare const last: <T, D, C>(expr: Expr<Arr<T>, D, C>) => Expr<T | null, D, C>;
|
|
@@ -599,7 +623,18 @@ declare const $and: Combiner;
|
|
|
599
623
|
declare const $nor: Combiner;
|
|
600
624
|
declare const $or: Combiner;
|
|
601
625
|
|
|
626
|
+
declare const log: (...args: unknown[]) => void;
|
|
627
|
+
|
|
628
|
+
declare const createIndex: (collection: {
|
|
629
|
+
readonly createIndex: Collection["createIndex"];
|
|
630
|
+
}, indexSpec: IndexSpecification, options?: CreateIndexesOptions) => Promise<void>;
|
|
631
|
+
|
|
632
|
+
declare const noop: () => void;
|
|
633
|
+
declare const map1: <K extends string, Im>(k: AsLiteral<K>, to: Im) => { readonly [P in K]: [P, Im]; } & {
|
|
634
|
+
readonly [_: string]: [K, Im];
|
|
635
|
+
};
|
|
636
|
+
|
|
602
637
|
declare const enablePreAndPostImages: <T extends doc>(coll: Collection<T>) => Promise<bson.Document>;
|
|
603
638
|
declare const prepare: (testName?: string) => Promise<MongoClient$1>;
|
|
604
639
|
|
|
605
|
-
export { $accumulator, $and, $countDict, $entries, $eq, $expr, $getField, $group, $groupId, $groupMerge, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $keys, $let, $lookup, $lt, $lte, $map, $map1, $match, $matchDelta, $merge, $merge_, $ne, $nin, $nor, $or, $pushDict, $rand, $replaceWith, $set, $sum, $unwind, $unwindDelta, $upsert, type Accumulators, type Arr, type AsLiteral, type Delta, type DeltaAccumulator, type DeltaAccumulators, Expr, Field, type ID, type Loose, Machine, type Merge, type MergeArgs, type MergeInto, type Model, type N, type NoRaw, type O, type OPick, type RONoRaw, type RORec, type RawStages, type Rec, type Replace, type SnapshotStreamExecutionResult, type StrKey, type Strict, type TS, Type, type WriteonlyCollection, add, and, array, ceil, comp, concat, ctx, current, dateAdd, dateDiff, dateLt, datePart, dayAndMonthPart, divide, type doc, enablePreAndPostImages, eq, eqTyped, except, exprMapVal, filter, filterDefined, first, firstSure, floor, from, func, gt, gte, inArray, isArray, ite, last, lt, lte, mapVal, max, maxDate, mergeObjects, minDate, monthPart, multiply, ne, nil, type notArr, notNull, now, prepare, rand, range, root, setField, size, slice, sortArray, staging, startOf, sub, subtract, val, wrap };
|
|
640
|
+
export { $accumulator, $and, $countDict, $entries, $eq, $expr, $getField, $group, $groupId, $groupMerge, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $keys, $let, $lookup, $lt, $lte, $map, $map1, $match, $matchDelta, $merge, $merge_, $ne, $nin, $nor, $or, $pushDict, $rand, $replaceWith, $set, $sum, $unwind, $unwindDelta, $upsert, 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 N, type NoRaw, 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, 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, map1, mapVal, max, maxDate, mergeExact, mergeExact0, mergeExpr, mergeObjects, minDate, monthPart, multiply, ne, nil, noop, type notArr, notNull, now, pair, prepare, rand, range, root, set, setField, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, wrap };
|
package/index.esm.js
CHANGED
|
@@ -54,6 +54,7 @@ function ceil(expr) {
|
|
|
54
54
|
|
|
55
55
|
const id$1 = (x) => x;
|
|
56
56
|
const defined = (x) => x != null;
|
|
57
|
+
const noop = () => { };
|
|
57
58
|
const map1 = (k, to) => {
|
|
58
59
|
const k2 = k;
|
|
59
60
|
return { [k]: [k2, to] };
|
|
@@ -71,6 +72,7 @@ const mapExact1 = (x, f) => mapExactToObject1(x, (v, k) => [k, f(v, k)]);
|
|
|
71
72
|
const mapExactToObject = (x, f) => mapExactToObject0(x, f);
|
|
72
73
|
const mapExact = (x, f) => mapExactToObject(x, (v, k) => [k, f(v, k)]);
|
|
73
74
|
const spread = (a, b) => ({ ...a, ...mapExact(b, id$1) });
|
|
75
|
+
const spread0 = (a, b) => ({ ...a, ...mapExact0(b, id$1) });
|
|
74
76
|
|
|
75
77
|
const val = (val) => asExpr({
|
|
76
78
|
raw: () => asExprRaw((val && typeof val === 'object') || (typeof val === 'string' && val[0] === '$')
|
|
@@ -285,9 +287,15 @@ const $entries = (expr) => func(function (obj) {
|
|
|
285
287
|
return Object.entries({ ...obj }).flatMap(([k, v]) => v[0].map(v => ({ k, v })));
|
|
286
288
|
}, expr);
|
|
287
289
|
|
|
288
|
-
const concat$
|
|
290
|
+
const concat$1 = (...expr) => asExpr({
|
|
289
291
|
raw: f => asExprRaw({ $concat: expr.map(e => e.raw(f).get()) }),
|
|
290
292
|
});
|
|
293
|
+
const str = (expr) => asExpr({
|
|
294
|
+
raw: f => asExprRaw({ $toString: expr.raw(f).get() }),
|
|
295
|
+
});
|
|
296
|
+
const toInt = (expr) => asExpr({
|
|
297
|
+
raw: f => asExprRaw({ $toInt: expr.raw(f).get() }),
|
|
298
|
+
});
|
|
291
299
|
const fieldM = (expr, m) => asExpr({
|
|
292
300
|
raw: (f) => asExprRaw(Object.fromEntries(Object.entries(m).map(([dom, ref]) => [
|
|
293
301
|
dom,
|
|
@@ -295,7 +303,10 @@ const fieldM = (expr, m) => asExpr({
|
|
|
295
303
|
]))),
|
|
296
304
|
});
|
|
297
305
|
const mergeExact = (...[exprsExact1, exprsExact2]) => spread(exprsExact1, exprsExact2);
|
|
306
|
+
const mergeExact0 = (...[exprsExact1, exprsExact2]) => spread0(exprsExact1, exprsExact2);
|
|
298
307
|
const mergeExpr = (...exprs) => mergeExact(...exprs);
|
|
308
|
+
const asIntersect = (x) => x;
|
|
309
|
+
const pair = (k, v) => asIntersect([k, v]);
|
|
299
310
|
const fieldF = () => (exprs) => Object.keys(exprs).length
|
|
300
311
|
? asExpr({
|
|
301
312
|
raw: f => asExprRaw(mapExactToObject(exprs, e => e.raw(f).get())),
|
|
@@ -327,12 +338,12 @@ const pipe = (stream, s, concat, empty) => {
|
|
|
327
338
|
};
|
|
328
339
|
return acc;
|
|
329
340
|
};
|
|
330
|
-
const concat
|
|
331
|
-
with: extra => concat
|
|
341
|
+
const concat = (stages) => ({
|
|
342
|
+
with: extra => concat(concatStages(stages, extra)),
|
|
332
343
|
stages,
|
|
333
344
|
});
|
|
334
345
|
const link = () => ({
|
|
335
|
-
with: extra => concat
|
|
346
|
+
with: extra => concat(extra),
|
|
336
347
|
stages: asStages([]),
|
|
337
348
|
});
|
|
338
349
|
const emptyDelta = () => ({
|
|
@@ -368,7 +379,7 @@ const isArray = (expr) => asBoolExpr({
|
|
|
368
379
|
const array = (...exprs) => asExpr({
|
|
369
380
|
raw: f => asExprRaw(exprs.map(x => x.raw(f).get())),
|
|
370
381
|
});
|
|
371
|
-
const
|
|
382
|
+
const concatArray = (...exprs) => asExpr({
|
|
372
383
|
raw: f => asExprRaw({ $concatArrays: exprs.map(x => x.raw(f).get()) }),
|
|
373
384
|
});
|
|
374
385
|
const first$1 = (expr) => asExpr({
|
|
@@ -418,10 +429,10 @@ const except = (a, b) => {
|
|
|
418
429
|
out: ['out', out],
|
|
419
430
|
except: [
|
|
420
431
|
'except',
|
|
421
|
-
|
|
432
|
+
concatArray(ite(eq(indexInExcept)(val(0)), array(), slice(except, val(0), indexInExcept)), slice(except, add(indexInExcept, val(1)), size(except))),
|
|
422
433
|
],
|
|
423
434
|
}), field({
|
|
424
|
-
out: ['out',
|
|
435
|
+
out: ['out', concatArray(out, array(curr))],
|
|
425
436
|
except: ['except', except],
|
|
426
437
|
})))),
|
|
427
438
|
],
|
|
@@ -541,7 +552,7 @@ const subMerge = (args, out, gid, extra, idPrefix) => {
|
|
|
541
552
|
const gidPath = root().of(gid).expr();
|
|
542
553
|
const mapId = (k, v) => map1(k, v);
|
|
543
554
|
const F1 = {
|
|
544
|
-
_id: ['_id', to(idPrefix ? concat$
|
|
555
|
+
_id: ['_id', to(idPrefix ? concat$1(val(idPrefix), $rand) : $rand)],
|
|
545
556
|
touchedAt: ['touchedAt', to(current)],
|
|
546
557
|
};
|
|
547
558
|
const F2 = mapId(gid, to(gidPath));
|
|
@@ -1580,4 +1591,4 @@ const prepare = async (testName) => {
|
|
|
1580
1591
|
return client;
|
|
1581
1592
|
};
|
|
1582
1593
|
|
|
1583
|
-
export { $accumulator, $and, $countDict, $entries, $eq, $expr, $getField, $group, $groupId, $groupMerge, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $keys, $let, $lookup, $lt, $lte, $map, $map1, $match, $matchDelta, $merge, $merge_, $ne, $nin, $nor, $or, $pushDict, $rand, $replaceWith, $set, $sum, $unwind, $unwindDelta, $upsert, Field, Machine, add, and, array, ceil, comp, concat, ctx, current, dateAdd, dateDiff, dateLt, datePart, dayAndMonthPart, divide, enablePreAndPostImages, eq, eqTyped, except, exprMapVal, filter, filterDefined, first$1 as first, firstSure, floor, from, func, gt, gte, inArray, isArray, ite, last, lt, lte, mapVal, max, maxDate, mergeObjects, minDate, monthPart, multiply, ne, nil, notNull, now, prepare, rand, range, root, setField, size, slice, sortArray, staging, startOf, sub, subtract, val, wrap };
|
|
1594
|
+
export { $accumulator, $and, $countDict, $entries, $eq, $expr, $getField, $group, $groupId, $groupMerge, $gt, $gtTs, $gte, $gteTs, $ifNull, $in, $keys, $let, $lookup, $lt, $lte, $map, $map1, $match, $matchDelta, $merge, $merge_, $ne, $nin, $nor, $or, $pushDict, $rand, $replaceWith, $set, $sum, $unwind, $unwindDelta, $upsert, Field, Machine, add, and, 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, map1, mapVal, max, maxDate, mergeExact, mergeExact0, mergeExpr, mergeObjects, minDate, monthPart, multiply, ne, nil, noop, notNull, now, pair, prepare, rand, range, root, set, setField, size, slice, sortArray, staging, startOf, str, sub, subtract, to, toInt, val, wrap };
|
package/index.js
CHANGED
|
@@ -56,6 +56,7 @@ function ceil(expr) {
|
|
|
56
56
|
|
|
57
57
|
const id$1 = (x) => x;
|
|
58
58
|
const defined = (x) => x != null;
|
|
59
|
+
const noop = () => { };
|
|
59
60
|
const map1 = (k, to) => {
|
|
60
61
|
const k2 = k;
|
|
61
62
|
return { [k]: [k2, to] };
|
|
@@ -73,6 +74,7 @@ const mapExact1 = (x, f) => mapExactToObject1(x, (v, k) => [k, f(v, k)]);
|
|
|
73
74
|
const mapExactToObject = (x, f) => mapExactToObject0(x, f);
|
|
74
75
|
const mapExact = (x, f) => mapExactToObject(x, (v, k) => [k, f(v, k)]);
|
|
75
76
|
const spread = (a, b) => ({ ...a, ...mapExact(b, id$1) });
|
|
77
|
+
const spread0 = (a, b) => ({ ...a, ...mapExact0(b, id$1) });
|
|
76
78
|
|
|
77
79
|
const val = (val) => asExpr({
|
|
78
80
|
raw: () => asExprRaw((val && typeof val === 'object') || (typeof val === 'string' && val[0] === '$')
|
|
@@ -287,9 +289,15 @@ const $entries = (expr) => func(function (obj) {
|
|
|
287
289
|
return Object.entries({ ...obj }).flatMap(([k, v]) => v[0].map(v => ({ k, v })));
|
|
288
290
|
}, expr);
|
|
289
291
|
|
|
290
|
-
const concat$
|
|
292
|
+
const concat$1 = (...expr) => asExpr({
|
|
291
293
|
raw: f => asExprRaw({ $concat: expr.map(e => e.raw(f).get()) }),
|
|
292
294
|
});
|
|
295
|
+
const str = (expr) => asExpr({
|
|
296
|
+
raw: f => asExprRaw({ $toString: expr.raw(f).get() }),
|
|
297
|
+
});
|
|
298
|
+
const toInt = (expr) => asExpr({
|
|
299
|
+
raw: f => asExprRaw({ $toInt: expr.raw(f).get() }),
|
|
300
|
+
});
|
|
293
301
|
const fieldM = (expr, m) => asExpr({
|
|
294
302
|
raw: (f) => asExprRaw(Object.fromEntries(Object.entries(m).map(([dom, ref]) => [
|
|
295
303
|
dom,
|
|
@@ -297,7 +305,10 @@ const fieldM = (expr, m) => asExpr({
|
|
|
297
305
|
]))),
|
|
298
306
|
});
|
|
299
307
|
const mergeExact = (...[exprsExact1, exprsExact2]) => spread(exprsExact1, exprsExact2);
|
|
308
|
+
const mergeExact0 = (...[exprsExact1, exprsExact2]) => spread0(exprsExact1, exprsExact2);
|
|
300
309
|
const mergeExpr = (...exprs) => mergeExact(...exprs);
|
|
310
|
+
const asIntersect = (x) => x;
|
|
311
|
+
const pair = (k, v) => asIntersect([k, v]);
|
|
301
312
|
const fieldF = () => (exprs) => Object.keys(exprs).length
|
|
302
313
|
? asExpr({
|
|
303
314
|
raw: f => asExprRaw(mapExactToObject(exprs, e => e.raw(f).get())),
|
|
@@ -329,12 +340,12 @@ const pipe = (stream, s, concat, empty) => {
|
|
|
329
340
|
};
|
|
330
341
|
return acc;
|
|
331
342
|
};
|
|
332
|
-
const concat
|
|
333
|
-
with: extra => concat
|
|
343
|
+
const concat = (stages) => ({
|
|
344
|
+
with: extra => concat(concatStages(stages, extra)),
|
|
334
345
|
stages,
|
|
335
346
|
});
|
|
336
347
|
const link = () => ({
|
|
337
|
-
with: extra => concat
|
|
348
|
+
with: extra => concat(extra),
|
|
338
349
|
stages: asStages([]),
|
|
339
350
|
});
|
|
340
351
|
const emptyDelta = () => ({
|
|
@@ -370,7 +381,7 @@ const isArray = (expr) => asBoolExpr({
|
|
|
370
381
|
const array = (...exprs) => asExpr({
|
|
371
382
|
raw: f => asExprRaw(exprs.map(x => x.raw(f).get())),
|
|
372
383
|
});
|
|
373
|
-
const
|
|
384
|
+
const concatArray = (...exprs) => asExpr({
|
|
374
385
|
raw: f => asExprRaw({ $concatArrays: exprs.map(x => x.raw(f).get()) }),
|
|
375
386
|
});
|
|
376
387
|
const first$1 = (expr) => asExpr({
|
|
@@ -420,10 +431,10 @@ const except = (a, b) => {
|
|
|
420
431
|
out: ['out', out],
|
|
421
432
|
except: [
|
|
422
433
|
'except',
|
|
423
|
-
|
|
434
|
+
concatArray(ite(eq(indexInExcept)(val(0)), array(), slice(except, val(0), indexInExcept)), slice(except, add(indexInExcept, val(1)), size(except))),
|
|
424
435
|
],
|
|
425
436
|
}), field({
|
|
426
|
-
out: ['out',
|
|
437
|
+
out: ['out', concatArray(out, array(curr))],
|
|
427
438
|
except: ['except', except],
|
|
428
439
|
})))),
|
|
429
440
|
],
|
|
@@ -543,7 +554,7 @@ const subMerge = (args, out, gid, extra, idPrefix) => {
|
|
|
543
554
|
const gidPath = root().of(gid).expr();
|
|
544
555
|
const mapId = (k, v) => map1(k, v);
|
|
545
556
|
const F1 = {
|
|
546
|
-
_id: ['_id', to(idPrefix ? concat$
|
|
557
|
+
_id: ['_id', to(idPrefix ? concat$1(val(idPrefix), $rand) : $rand)],
|
|
547
558
|
touchedAt: ['touchedAt', to(current)],
|
|
548
559
|
};
|
|
549
560
|
const F2 = mapId(gid, to(gidPath));
|
|
@@ -1628,7 +1639,9 @@ exports.and = and;
|
|
|
1628
1639
|
exports.array = array;
|
|
1629
1640
|
exports.ceil = ceil;
|
|
1630
1641
|
exports.comp = comp;
|
|
1631
|
-
exports.concat = concat;
|
|
1642
|
+
exports.concat = concat$1;
|
|
1643
|
+
exports.concatArray = concatArray;
|
|
1644
|
+
exports.createIndex = createIndex;
|
|
1632
1645
|
exports.ctx = ctx;
|
|
1633
1646
|
exports.current = current;
|
|
1634
1647
|
exports.dateAdd = dateAdd;
|
|
@@ -1642,6 +1655,9 @@ exports.eq = eq;
|
|
|
1642
1655
|
exports.eqTyped = eqTyped;
|
|
1643
1656
|
exports.except = except;
|
|
1644
1657
|
exports.exprMapVal = exprMapVal;
|
|
1658
|
+
exports.field = field;
|
|
1659
|
+
exports.fieldF = fieldF;
|
|
1660
|
+
exports.fieldM = fieldM;
|
|
1645
1661
|
exports.filter = filter;
|
|
1646
1662
|
exports.filterDefined = filterDefined;
|
|
1647
1663
|
exports.first = first$1;
|
|
@@ -1655,30 +1671,41 @@ exports.inArray = inArray;
|
|
|
1655
1671
|
exports.isArray = isArray;
|
|
1656
1672
|
exports.ite = ite;
|
|
1657
1673
|
exports.last = last;
|
|
1674
|
+
exports.log = log;
|
|
1658
1675
|
exports.lt = lt;
|
|
1659
1676
|
exports.lte = lte;
|
|
1677
|
+
exports.map1 = map1;
|
|
1660
1678
|
exports.mapVal = mapVal;
|
|
1661
1679
|
exports.max = max;
|
|
1662
1680
|
exports.maxDate = maxDate;
|
|
1681
|
+
exports.mergeExact = mergeExact;
|
|
1682
|
+
exports.mergeExact0 = mergeExact0;
|
|
1683
|
+
exports.mergeExpr = mergeExpr;
|
|
1663
1684
|
exports.mergeObjects = mergeObjects;
|
|
1664
1685
|
exports.minDate = minDate;
|
|
1665
1686
|
exports.monthPart = monthPart;
|
|
1666
1687
|
exports.multiply = multiply;
|
|
1667
1688
|
exports.ne = ne;
|
|
1668
1689
|
exports.nil = nil;
|
|
1690
|
+
exports.noop = noop;
|
|
1669
1691
|
exports.notNull = notNull;
|
|
1670
1692
|
exports.now = now;
|
|
1693
|
+
exports.pair = pair;
|
|
1671
1694
|
exports.prepare = prepare;
|
|
1672
1695
|
exports.rand = rand;
|
|
1673
1696
|
exports.range = range;
|
|
1674
1697
|
exports.root = root;
|
|
1698
|
+
exports.set = set;
|
|
1675
1699
|
exports.setField = setField;
|
|
1676
1700
|
exports.size = size;
|
|
1677
1701
|
exports.slice = slice;
|
|
1678
1702
|
exports.sortArray = sortArray;
|
|
1679
1703
|
exports.staging = staging;
|
|
1680
1704
|
exports.startOf = startOf;
|
|
1705
|
+
exports.str = str;
|
|
1681
1706
|
exports.sub = sub;
|
|
1682
1707
|
exports.subtract = subtract;
|
|
1708
|
+
exports.to = to;
|
|
1709
|
+
exports.toInt = toInt;
|
|
1683
1710
|
exports.val = val;
|
|
1684
1711
|
exports.wrap = wrap;
|