@omegup/msync 0.1.66 → 0.1.68
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.esm.js +147 -148
- package/index.esm.js.map +1 -1
- package/index.js +148 -147
- package/index.js.map +1 -1
- package/lib/expression/array.d.ts +3 -1
- package/lib/expression/val.d.ts +4 -4
- package/package.json +1 -1
- package/types/json.d.ts +6 -0
package/index.esm.js
CHANGED
|
@@ -44,6 +44,45 @@ const map1 = (k, to) => {
|
|
|
44
44
|
return { [k]: [k2, to] };
|
|
45
45
|
};
|
|
46
46
|
//#endregion
|
|
47
|
+
//#region .build/lib/field/field.js
|
|
48
|
+
var Field = class Field {
|
|
49
|
+
field;
|
|
50
|
+
raw;
|
|
51
|
+
concat;
|
|
52
|
+
has(p) {
|
|
53
|
+
return { raw: (f) => ({ [f.with(this).str()]: p.raw }) };
|
|
54
|
+
}
|
|
55
|
+
constructor(field, raw, concat) {
|
|
56
|
+
this.field = field;
|
|
57
|
+
this.raw = raw;
|
|
58
|
+
this.concat = concat;
|
|
59
|
+
}
|
|
60
|
+
static root = () => {
|
|
61
|
+
const concat = (f1, f2) => new Field([f1.field, f2.field].filter(id$1).join("."), f1.raw, f1.concat);
|
|
62
|
+
return new Field("", (s) => s ? `$${s}` : "$$ROOT", concat);
|
|
63
|
+
};
|
|
64
|
+
static ctx = () => (k) => {
|
|
65
|
+
const concat = (_, f2) => new Field(f2.field, f2.raw, f2.concat);
|
|
66
|
+
return new Field(k, (s) => `$$${s}`, concat);
|
|
67
|
+
};
|
|
68
|
+
of(k) {
|
|
69
|
+
return new Field([this.field, k].filter(id$1).join("."), this.raw, this.concat);
|
|
70
|
+
}
|
|
71
|
+
with(k) {
|
|
72
|
+
return k.concat(this, k);
|
|
73
|
+
}
|
|
74
|
+
str() {
|
|
75
|
+
return this.field;
|
|
76
|
+
}
|
|
77
|
+
exprRaw() {
|
|
78
|
+
return asExprRaw(this.raw(this.field));
|
|
79
|
+
}
|
|
80
|
+
expr() {
|
|
81
|
+
return asExpr({ raw: (f) => f.with(this).exprRaw() });
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const { root, ctx } = Field;
|
|
85
|
+
//#endregion
|
|
47
86
|
//#region .build/lib/utils/map-object.js
|
|
48
87
|
const mapExactToObject0 = (x, f) => {
|
|
49
88
|
const filter = (x) => x.filter((x) => x[0] === x[1][0]);
|
|
@@ -64,9 +103,115 @@ const spread0 = (a, b) => ({
|
|
|
64
103
|
...mapExact0(b, id$1)
|
|
65
104
|
});
|
|
66
105
|
//#endregion
|
|
106
|
+
//#region .build/lib/expression/concat.js
|
|
107
|
+
const concat = (...expr) => asExpr({ raw: (f) => asExprRaw({ $concat: expr.map((e) => e.raw(f).get()) }) });
|
|
108
|
+
const $substr = (expr, start, length) => asExpr({ raw: (f) => asExprRaw({ $substrCP: [
|
|
109
|
+
expr.raw(f).get(),
|
|
110
|
+
start.raw(f).get(),
|
|
111
|
+
length.raw(f).get()
|
|
112
|
+
] }) });
|
|
113
|
+
const padLeft = (expr, pad) => asExpr({ raw: (f) => asExprRaw({ $let: {
|
|
114
|
+
vars: { x: { $concat: [{ $literal: pad }, expr.raw(f).get()] } },
|
|
115
|
+
in: { $substrCP: [
|
|
116
|
+
"$$x",
|
|
117
|
+
{ $subtract: [{ $strLenCP: "$$x" }, pad.length] },
|
|
118
|
+
pad.length
|
|
119
|
+
] }
|
|
120
|
+
} }) });
|
|
121
|
+
const regex = (expr, regex, options) => asExpr({ raw: (f) => asExprRaw({ $regexMatch: {
|
|
122
|
+
input: expr.raw(f).get(),
|
|
123
|
+
regex: regex.raw(f).get(),
|
|
124
|
+
options: options?.raw(f).get()
|
|
125
|
+
} }) });
|
|
126
|
+
const str = (expr) => asExpr({ raw: (f) => asExprRaw({ $toString: expr.raw(f).get() }) });
|
|
127
|
+
const toInt = (expr) => asExpr({ raw: (f) => asExprRaw({ $toInt: expr.raw(f).get() }) });
|
|
128
|
+
const fieldM = (expr, m) => asExpr({ raw: (f) => asExprRaw(Object.fromEntries(Object.entries(m).flatMap(([dom, ref]) => expr[ref] ? [[dom, expr[ref].raw(f).get()]] : []))) });
|
|
129
|
+
const mergeExact = (...[exprsExact1, exprsExact2]) => spread(exprsExact1, exprsExact2);
|
|
130
|
+
const mergeExact0 = (...[exprsExact1, exprsExact2]) => spread0(exprsExact1, exprsExact2);
|
|
131
|
+
const mergeExpr = (...exprs) => mergeExact(...exprs);
|
|
132
|
+
const fieldF = () => (exprs) => Object.keys(exprs).length ? asExpr({ raw: (f) => asExprRaw(mapExactToObject(exprs, (e) => e.raw(f).get())) }) : asExpr(val(safeNarrow()({})));
|
|
133
|
+
const field = fieldF();
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region .build/lib/expression/array.js
|
|
136
|
+
const size = (expr) => asExpr({ raw: (f) => asExprRaw({ $size: expr.raw(f).get() }) });
|
|
137
|
+
const filterDefined = (expr) => filter({
|
|
138
|
+
expr,
|
|
139
|
+
as: "x",
|
|
140
|
+
cond: ctx()("x").expr()
|
|
141
|
+
});
|
|
142
|
+
const filter = ({ as, cond, expr, limit }) => asExpr({ raw: (f) => asExprRaw({ $filter: {
|
|
143
|
+
input: expr.raw(f).get(),
|
|
144
|
+
as,
|
|
145
|
+
cond: cond.raw(f).get(),
|
|
146
|
+
...limit ? { limit: limit.raw(f).get() } : {}
|
|
147
|
+
} }) });
|
|
148
|
+
const sortArray = ({ sortBy, expr, order }) => asExpr({ raw: (f) => asExprRaw({ $sortArray: {
|
|
149
|
+
input: expr.raw(f).get(),
|
|
150
|
+
sortBy: { [sortBy]: order ?? -1 }
|
|
151
|
+
} }) });
|
|
152
|
+
const isArray = (expr) => asBoolExpr({ raw: (f) => asExprRaw({ $isArray: expr.raw(f).get() }) });
|
|
153
|
+
const inArray = (item, expr) => asExpr({ raw: (f) => asExprRaw({ $in: [item.raw(f).get(), expr.raw(f).get()] }) });
|
|
154
|
+
const array = (...exprs) => asExpr({ raw: (f) => asExprRaw(exprs.map((x) => x.raw(f).get())) });
|
|
155
|
+
const concatArray = (...exprs) => asExpr({ raw: (f) => asExprRaw({ $concatArrays: exprs.map((x) => x.raw(f).get()) }) });
|
|
156
|
+
const $setUnion = (...exprs) => asExpr({ raw: (f) => asExprRaw({ $setUnion: exprs.map((x) => x.raw(f).get()) }) });
|
|
157
|
+
const first = (expr) => asExpr({ raw: (f) => asExprRaw({ $first: expr.raw(f).get() }) });
|
|
158
|
+
const firstSure = first;
|
|
159
|
+
const last = (expr) => asExpr({ raw: (f) => asExprRaw({ $last: expr.raw(f).get() }) });
|
|
160
|
+
const mergeObjects = (...exprs) => asExpr({ raw: (f) => asExprRaw({ $mergeObjects: exprs.map((x) => x.raw(f).get()) }) });
|
|
161
|
+
const $objectToArray = (expr) => asExpr({ raw: (f) => asExprRaw({ $objectToArray: expr.raw(f).get() }) });
|
|
162
|
+
const anyElementTrue = (expr) => asExpr({ raw: (f) => asExprRaw({ $anyElementTrue: expr.raw(f).get() }) });
|
|
163
|
+
const $reduce = (input, initialValue, inExpr) => asExpr({ raw: (f) => asExprRaw({ $reduce: {
|
|
164
|
+
input: input.raw(f).get(),
|
|
165
|
+
initialValue: initialValue.raw(f).get(),
|
|
166
|
+
in: inExpr.raw(f).get()
|
|
167
|
+
} }) });
|
|
168
|
+
const indexOfArray = (array, item) => asExpr({ raw: (f) => asExprRaw({ $indexOfArray: [array.raw(f).get(), item.raw(f).get()] }) });
|
|
169
|
+
const slice = (array, start, end) => asExpr({ raw: (f) => asExprRaw({ $slice: [
|
|
170
|
+
array.raw(f).get(),
|
|
171
|
+
start.raw(f).get(),
|
|
172
|
+
end.raw(f).get()
|
|
173
|
+
] }) });
|
|
174
|
+
const except = (a, b) => {
|
|
175
|
+
const value = ctx()("value");
|
|
176
|
+
const out = value.of("out").expr();
|
|
177
|
+
const except = value.of("except").expr();
|
|
178
|
+
const curr = ctx()("this").expr();
|
|
179
|
+
const indexInExcept = ctx()("indexInExcept").expr();
|
|
180
|
+
return $let({ res: ["res", $reduce(a, field({
|
|
181
|
+
out: ["out", array()],
|
|
182
|
+
except: ["except", b]
|
|
183
|
+
}), $let({ indexInExcept: ["indexInExcept", indexOfArray(except, curr)] }, ite(gte(indexInExcept, val(0)), field({
|
|
184
|
+
out: ["out", out],
|
|
185
|
+
except: ["except", concatArray(ite(eq(indexInExcept)(val(0)), array(), slice(except, val(0), indexInExcept)), slice(except, add(indexInExcept, val(1)), size(except)))]
|
|
186
|
+
}), field({
|
|
187
|
+
out: ["out", concatArray(out, array(curr))],
|
|
188
|
+
except: ["except", except]
|
|
189
|
+
}))))] }, ctx()("res").of("out").expr());
|
|
190
|
+
};
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region .build/lib/expression/range.js
|
|
193
|
+
const range = (start, end, step) => asExpr({ raw: (f) => asExprRaw({ $range: [
|
|
194
|
+
start.raw(f).get(),
|
|
195
|
+
end.raw(f).get(),
|
|
196
|
+
step?.raw(f).get() ?? 1
|
|
197
|
+
] }) });
|
|
198
|
+
const $map0 = ({ as, expr, input }) => asExpr({ raw: (f) => asExprRaw({ $map: {
|
|
199
|
+
input: input.raw(f).get(),
|
|
200
|
+
as,
|
|
201
|
+
in: expr.raw(f).get()
|
|
202
|
+
} }) });
|
|
203
|
+
const $map1 = (ex, map) => $map0({
|
|
204
|
+
input: ex,
|
|
205
|
+
as: "item",
|
|
206
|
+
expr: map(ctx()("item"))
|
|
207
|
+
});
|
|
208
|
+
const $map = (ex, map) => $map1(ex, (i) => map(i.expr()));
|
|
209
|
+
//#endregion
|
|
67
210
|
//#region .build/lib/expression/val.js
|
|
68
211
|
const val = (val) => asExpr({ raw: () => asExprRaw(val && typeof val === "object" && !(val instanceof Date) || typeof val === "string" && val[0] === "$" ? { $literal: val } : val) });
|
|
69
212
|
const current = asExpr({ raw: () => asExprRaw("$$CLUSTER_TIME") });
|
|
213
|
+
const $rand = asExpr({ raw: () => asExprRaw({ $rand: {} }) });
|
|
214
|
+
const rand = $reduce(range(val(0), val(17)), val(""), concat(ctx()("value").expr(), $substr(val("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"), floor(multiply($rand, val(62))), val(1))));
|
|
70
215
|
const $let = (vars, inExpr) => asExpr({ raw: (f) => asExprRaw({ $let: {
|
|
71
216
|
vars: mapExactToObject(vars, (v) => v.raw(f).get()),
|
|
72
217
|
in: inExpr.raw(f).get()
|
|
@@ -81,11 +226,6 @@ const func = (f, ...args) => asExpr({ raw: (field) => asExprRaw({ $function: {
|
|
|
81
226
|
args: args.map((x) => x.raw(field).get()),
|
|
82
227
|
lang: "js"
|
|
83
228
|
} }) });
|
|
84
|
-
const rand = function() {
|
|
85
|
-
const s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
86
|
-
return Array(17).fill(0).map(() => s[Math.floor(Math.random() * 62)]).join("");
|
|
87
|
-
};
|
|
88
|
-
const $rand = func(rand);
|
|
89
229
|
//#endregion
|
|
90
230
|
//#region .build/lib/expression/logic.js
|
|
91
231
|
const ite = ((cond, then, orelse) => asExpr({ raw: (f) => asExprRaw({ $cond: {
|
|
@@ -116,45 +256,6 @@ const setField = ({ field, input, value }) => asExpr({ raw: (f) => asExprRaw({ $
|
|
|
116
256
|
value: value.raw(f).get()
|
|
117
257
|
} }) });
|
|
118
258
|
//#endregion
|
|
119
|
-
//#region .build/lib/field/field.js
|
|
120
|
-
var Field = class Field {
|
|
121
|
-
field;
|
|
122
|
-
raw;
|
|
123
|
-
concat;
|
|
124
|
-
has(p) {
|
|
125
|
-
return { raw: (f) => ({ [f.with(this).str()]: p.raw }) };
|
|
126
|
-
}
|
|
127
|
-
constructor(field, raw, concat) {
|
|
128
|
-
this.field = field;
|
|
129
|
-
this.raw = raw;
|
|
130
|
-
this.concat = concat;
|
|
131
|
-
}
|
|
132
|
-
static root = () => {
|
|
133
|
-
const concat = (f1, f2) => new Field([f1.field, f2.field].filter(id$1).join("."), f1.raw, f1.concat);
|
|
134
|
-
return new Field("", (s) => s ? `$${s}` : "$$ROOT", concat);
|
|
135
|
-
};
|
|
136
|
-
static ctx = () => (k) => {
|
|
137
|
-
const concat = (_, f2) => new Field(f2.field, f2.raw, f2.concat);
|
|
138
|
-
return new Field(k, (s) => `$$${s}`, concat);
|
|
139
|
-
};
|
|
140
|
-
of(k) {
|
|
141
|
-
return new Field([this.field, k].filter(id$1).join("."), this.raw, this.concat);
|
|
142
|
-
}
|
|
143
|
-
with(k) {
|
|
144
|
-
return k.concat(this, k);
|
|
145
|
-
}
|
|
146
|
-
str() {
|
|
147
|
-
return this.field;
|
|
148
|
-
}
|
|
149
|
-
exprRaw() {
|
|
150
|
-
return asExprRaw(this.raw(this.field));
|
|
151
|
-
}
|
|
152
|
-
expr() {
|
|
153
|
-
return asExpr({ raw: (f) => f.with(this).exprRaw() });
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
const { root, ctx } = Field;
|
|
157
|
-
//#endregion
|
|
158
259
|
//#region .build/lib/accumulators/index.js
|
|
159
260
|
const asAccumulator = (x) => x;
|
|
160
261
|
const $sum_ = (expr) => ({ raw: (f) => asAccumulator({ $sum: expr.raw(f).get() }) });
|
|
@@ -296,90 +397,6 @@ const concatTStages = ({ coll, exec, input }, stages) => ({
|
|
|
296
397
|
exec: concatStages(exec, stages)
|
|
297
398
|
});
|
|
298
399
|
//#endregion
|
|
299
|
-
//#region .build/lib/expression/concat.js
|
|
300
|
-
const concat = (...expr) => asExpr({ raw: (f) => asExprRaw({ $concat: expr.map((e) => e.raw(f).get()) }) });
|
|
301
|
-
const $substr = (expr, start, length) => asExpr({ raw: (f) => asExprRaw({ $substrCP: [
|
|
302
|
-
expr.raw(f).get(),
|
|
303
|
-
start.raw(f).get(),
|
|
304
|
-
length.raw(f).get()
|
|
305
|
-
] }) });
|
|
306
|
-
const padLeft = (expr, pad) => asExpr({ raw: (f) => asExprRaw({ $let: {
|
|
307
|
-
vars: { x: { $concat: [{ $literal: pad }, expr.raw(f).get()] } },
|
|
308
|
-
in: { $substrCP: [
|
|
309
|
-
"$$x",
|
|
310
|
-
{ $subtract: [{ $strLenCP: "$$x" }, pad.length] },
|
|
311
|
-
pad.length
|
|
312
|
-
] }
|
|
313
|
-
} }) });
|
|
314
|
-
const regex = (expr, regex, options) => asExpr({ raw: (f) => asExprRaw({ $regexMatch: {
|
|
315
|
-
input: expr.raw(f).get(),
|
|
316
|
-
regex: regex.raw(f).get(),
|
|
317
|
-
options: options?.raw(f).get()
|
|
318
|
-
} }) });
|
|
319
|
-
const str = (expr) => asExpr({ raw: (f) => asExprRaw({ $toString: expr.raw(f).get() }) });
|
|
320
|
-
const toInt = (expr) => asExpr({ raw: (f) => asExprRaw({ $toInt: expr.raw(f).get() }) });
|
|
321
|
-
const fieldM = (expr, m) => asExpr({ raw: (f) => asExprRaw(Object.fromEntries(Object.entries(m).flatMap(([dom, ref]) => expr[ref] ? [[dom, expr[ref].raw(f).get()]] : []))) });
|
|
322
|
-
const mergeExact = (...[exprsExact1, exprsExact2]) => spread(exprsExact1, exprsExact2);
|
|
323
|
-
const mergeExact0 = (...[exprsExact1, exprsExact2]) => spread0(exprsExact1, exprsExact2);
|
|
324
|
-
const mergeExpr = (...exprs) => mergeExact(...exprs);
|
|
325
|
-
const fieldF = () => (exprs) => Object.keys(exprs).length ? asExpr({ raw: (f) => asExprRaw(mapExactToObject(exprs, (e) => e.raw(f).get())) }) : asExpr(val(safeNarrow()({})));
|
|
326
|
-
const field = fieldF();
|
|
327
|
-
//#endregion
|
|
328
|
-
//#region .build/lib/expression/array.js
|
|
329
|
-
const size = (expr) => asExpr({ raw: (f) => asExprRaw({ $size: expr.raw(f).get() }) });
|
|
330
|
-
const filterDefined = (expr) => filter({
|
|
331
|
-
expr,
|
|
332
|
-
as: "x",
|
|
333
|
-
cond: ctx()("x").expr()
|
|
334
|
-
});
|
|
335
|
-
const filter = ({ as, cond, expr, limit }) => asExpr({ raw: (f) => asExprRaw({ $filter: {
|
|
336
|
-
input: expr.raw(f).get(),
|
|
337
|
-
as,
|
|
338
|
-
cond: cond.raw(f).get(),
|
|
339
|
-
...limit ? { limit: limit.raw(f).get() } : {}
|
|
340
|
-
} }) });
|
|
341
|
-
const sortArray = ({ sortBy, expr, order }) => asExpr({ raw: (f) => asExprRaw({ $sortArray: {
|
|
342
|
-
input: expr.raw(f).get(),
|
|
343
|
-
sortBy: { [sortBy]: order ?? -1 }
|
|
344
|
-
} }) });
|
|
345
|
-
const isArray = (expr) => asBoolExpr({ raw: (f) => asExprRaw({ $isArray: expr.raw(f).get() }) });
|
|
346
|
-
const inArray = (item, expr) => asExpr({ raw: (f) => asExprRaw({ $in: [item.raw(f).get(), expr.raw(f).get()] }) });
|
|
347
|
-
const array = (...exprs) => asExpr({ raw: (f) => asExprRaw(exprs.map((x) => x.raw(f).get())) });
|
|
348
|
-
const concatArray = (...exprs) => asExpr({ raw: (f) => asExprRaw({ $concatArrays: exprs.map((x) => x.raw(f).get()) }) });
|
|
349
|
-
const first = (expr) => asExpr({ raw: (f) => asExprRaw({ $first: expr.raw(f).get() }) });
|
|
350
|
-
const firstSure = first;
|
|
351
|
-
const last = (expr) => asExpr({ raw: (f) => asExprRaw({ $last: expr.raw(f).get() }) });
|
|
352
|
-
const mergeObjects = (...exprs) => asExpr({ raw: (f) => asExprRaw({ $mergeObjects: exprs.map((x) => x.raw(f).get()) }) });
|
|
353
|
-
const anyElementTrue = (expr) => asExpr({ raw: (f) => asExprRaw({ $anyElementTrue: expr.raw(f).get() }) });
|
|
354
|
-
const $reduce = (input, initialValue, inExpr) => asExpr({ raw: (f) => asExprRaw({ $reduce: {
|
|
355
|
-
input: input.raw(f).get(),
|
|
356
|
-
initialValue: initialValue.raw(f).get(),
|
|
357
|
-
in: inExpr.raw(f).get()
|
|
358
|
-
} }) });
|
|
359
|
-
const indexOfArray = (array, item) => asExpr({ raw: (f) => asExprRaw({ $indexOfArray: [array.raw(f).get(), item.raw(f).get()] }) });
|
|
360
|
-
const slice = (array, start, end) => asExpr({ raw: (f) => asExprRaw({ $slice: [
|
|
361
|
-
array.raw(f).get(),
|
|
362
|
-
start.raw(f).get(),
|
|
363
|
-
end.raw(f).get()
|
|
364
|
-
] }) });
|
|
365
|
-
const except = (a, b) => {
|
|
366
|
-
const value = ctx()("value");
|
|
367
|
-
const out = value.of("out").expr();
|
|
368
|
-
const except = value.of("except").expr();
|
|
369
|
-
const curr = ctx()("this").expr();
|
|
370
|
-
const indexInExcept = ctx()("indexInExcept").expr();
|
|
371
|
-
return $let({ res: ["res", $reduce(a, field({
|
|
372
|
-
out: ["out", array()],
|
|
373
|
-
except: ["except", b]
|
|
374
|
-
}), $let({ indexInExcept: ["indexInExcept", indexOfArray(except, curr)] }, ite(gte(indexInExcept, val(0)), field({
|
|
375
|
-
out: ["out", out],
|
|
376
|
-
except: ["except", concatArray(ite(eq(indexInExcept)(val(0)), array(), slice(except, val(0), indexInExcept)), slice(except, add(indexInExcept, val(1)), size(except)))]
|
|
377
|
-
}), field({
|
|
378
|
-
out: ["out", concatArray(out, array(curr))],
|
|
379
|
-
except: ["except", except]
|
|
380
|
-
}))))] }, ctx()("res").of("out").expr());
|
|
381
|
-
};
|
|
382
|
-
//#endregion
|
|
383
400
|
//#region .build/lib/aggregate/raws.js
|
|
384
401
|
const $match1 = (query) => (f) => asStages(query ? [{ $match: query.raw(f()) }] : []);
|
|
385
402
|
const $set1 = (updater) => (f) => asStages([{ $set: Object.fromEntries(updater.raw(f()).map(([k, v]) => [f().of(k.slice(1)).str(), v])) }]);
|
|
@@ -572,24 +589,6 @@ const mapToPlainDateTime = (date, timezone) => asExpr({ raw: (f) => asExprRaw({
|
|
|
572
589
|
timezone: timezone.raw(f).get()
|
|
573
590
|
} } }) });
|
|
574
591
|
//#endregion
|
|
575
|
-
//#region .build/lib/expression/range.js
|
|
576
|
-
const range = (start, end, step) => asExpr({ raw: (f) => asExprRaw({ $range: [
|
|
577
|
-
start.raw(f).get(),
|
|
578
|
-
end.raw(f).get(),
|
|
579
|
-
step?.raw(f).get() ?? 1
|
|
580
|
-
] }) });
|
|
581
|
-
const $map0 = ({ as, expr, input }) => asExpr({ raw: (f) => asExprRaw({ $map: {
|
|
582
|
-
input: input.raw(f).get(),
|
|
583
|
-
as,
|
|
584
|
-
in: expr.raw(f).get()
|
|
585
|
-
} }) });
|
|
586
|
-
const $map1 = (ex, map) => $map0({
|
|
587
|
-
input: ex,
|
|
588
|
-
as: "item",
|
|
589
|
-
expr: map(ctx()("item"))
|
|
590
|
-
});
|
|
591
|
-
const $map = (ex, map) => $map1(ex, (i) => map(i.expr()));
|
|
592
|
-
//#endregion
|
|
593
592
|
//#region .build/lib/update/updater.js
|
|
594
593
|
const subUpdater = (a, f) => ({ raw: (g) => a.raw(g.with(f)) });
|
|
595
594
|
const rawSet = (fields) => (f) => {
|
|
@@ -711,7 +710,7 @@ const subMerge = (args, out, gid, extra, idPrefix, first) => {
|
|
|
711
710
|
const gidPath = root().of(gid).expr();
|
|
712
711
|
const mapId = (k, v) => map1(k, v);
|
|
713
712
|
const F1 = {
|
|
714
|
-
_id: ["_id", to(idPrefix ? concat(val(idPrefix),
|
|
713
|
+
_id: ["_id", to(idPrefix ? concat(val(idPrefix), rand) : rand)],
|
|
715
714
|
touchedAt: ["touchedAt", to(current)]
|
|
716
715
|
};
|
|
717
716
|
const F2 = mapId(gid, to(gidPath));
|
|
@@ -2119,6 +2118,6 @@ const executes = (view, input, needs) => {
|
|
|
2119
2118
|
};
|
|
2120
2119
|
const single = (view, needs = {}) => pipe((input) => executes(view, input, needs), emptyDelta(), concatDelta, emptyDelta);
|
|
2121
2120
|
//#endregion
|
|
2122
|
-
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, eq, eqTyped, except, exprMapVal, field, fieldF, fieldM, filter, filterDefined, first, firstSure, floor, from, fromEq, func, getSubsetMatchForExt, getWhenMatched, getWhenMatchedForMerge, gt, gte, inArray, isArray, ite, joinIdOf, last, literalsEqaul, log, lt, lte, map1, mapExact, mapExact0, mapExact1, mapExactToObject, mapExactToObject0, mapExactToObject1, mapFromPlainDateTime, mapToPlainDateTime, mapVal, matchDelta, max, maxDate, mergeExact, mergeExact0, mergeExpr, mergeObjects, min, minDate, monthPart, multiply, ne, nil, noop, not, notNull, now, or, padLeft, rand, range, reflex, regex, root, set, setField, single, size, slice, sortArray, spread, spread0, staging, startOf, str, sub, subtract, sym, to, toInt, useDriver, val, weekPart, wrap, year };
|
|
2121
|
+
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, $objectToArray, $or, $outerLookup, $pushDict, $rand, $reduce, $replaceWith, $set, $setUnion, $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, eq, eqTyped, except, exprMapVal, field, fieldF, fieldM, filter, filterDefined, first, firstSure, floor, from, fromEq, func, getSubsetMatchForExt, getWhenMatched, getWhenMatchedForMerge, gt, gte, inArray, isArray, ite, joinIdOf, last, literalsEqaul, log, lt, lte, map1, mapExact, mapExact0, mapExact1, mapExactToObject, mapExactToObject0, mapExactToObject1, mapFromPlainDateTime, mapToPlainDateTime, mapVal, matchDelta, max, maxDate, mergeExact, mergeExact0, mergeExpr, mergeObjects, min, minDate, monthPart, multiply, ne, nil, noop, not, notNull, now, or, padLeft, rand, range, reflex, regex, root, set, setField, single, size, slice, sortArray, spread, spread0, staging, startOf, str, sub, subtract, sym, to, toInt, useDriver, val, weekPart, wrap, year };
|
|
2123
2122
|
|
|
2124
2123
|
//# sourceMappingURL=index.esm.js.map
|