@omegup/msync 0.1.67 → 0.1.69
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 +148 -148
- package/index.esm.js.map +1 -1
- package/index.js +150 -147
- package/index.js.map +1 -1
- package/lib/expression/array.d.ts +4 -1
- package/lib/expression/val.d.ts +2 -2
- 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,116 @@ 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 $arrayToObject = (expr) => asExpr({ raw: (f) => asExprRaw({ $arrayToObject: expr.raw(f).get() }) });
|
|
163
|
+
const anyElementTrue = (expr) => asExpr({ raw: (f) => asExprRaw({ $anyElementTrue: expr.raw(f).get() }) });
|
|
164
|
+
const $reduce = (input, initialValue, inExpr) => asExpr({ raw: (f) => asExprRaw({ $reduce: {
|
|
165
|
+
input: input.raw(f).get(),
|
|
166
|
+
initialValue: initialValue.raw(f).get(),
|
|
167
|
+
in: inExpr.raw(f).get()
|
|
168
|
+
} }) });
|
|
169
|
+
const indexOfArray = (array, item) => asExpr({ raw: (f) => asExprRaw({ $indexOfArray: [array.raw(f).get(), item.raw(f).get()] }) });
|
|
170
|
+
const slice = (array, start, end) => asExpr({ raw: (f) => asExprRaw({ $slice: [
|
|
171
|
+
array.raw(f).get(),
|
|
172
|
+
start.raw(f).get(),
|
|
173
|
+
end.raw(f).get()
|
|
174
|
+
] }) });
|
|
175
|
+
const except = (a, b) => {
|
|
176
|
+
const value = ctx()("value");
|
|
177
|
+
const out = value.of("out").expr();
|
|
178
|
+
const except = value.of("except").expr();
|
|
179
|
+
const curr = ctx()("this").expr();
|
|
180
|
+
const indexInExcept = ctx()("indexInExcept").expr();
|
|
181
|
+
return $let({ res: ["res", $reduce(a, field({
|
|
182
|
+
out: ["out", array()],
|
|
183
|
+
except: ["except", b]
|
|
184
|
+
}), $let({ indexInExcept: ["indexInExcept", indexOfArray(except, curr)] }, ite(gte(indexInExcept, val(0)), field({
|
|
185
|
+
out: ["out", out],
|
|
186
|
+
except: ["except", concatArray(ite(eq(indexInExcept)(val(0)), array(), slice(except, val(0), indexInExcept)), slice(except, add(indexInExcept, val(1)), size(except)))]
|
|
187
|
+
}), field({
|
|
188
|
+
out: ["out", concatArray(out, array(curr))],
|
|
189
|
+
except: ["except", except]
|
|
190
|
+
}))))] }, ctx()("res").of("out").expr());
|
|
191
|
+
};
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region .build/lib/expression/range.js
|
|
194
|
+
const range = (start, end, step) => asExpr({ raw: (f) => asExprRaw({ $range: [
|
|
195
|
+
start.raw(f).get(),
|
|
196
|
+
end.raw(f).get(),
|
|
197
|
+
step?.raw(f).get() ?? 1
|
|
198
|
+
] }) });
|
|
199
|
+
const $map0 = ({ as, expr, input }) => asExpr({ raw: (f) => asExprRaw({ $map: {
|
|
200
|
+
input: input.raw(f).get(),
|
|
201
|
+
as,
|
|
202
|
+
in: expr.raw(f).get()
|
|
203
|
+
} }) });
|
|
204
|
+
const $map1 = (ex, map) => $map0({
|
|
205
|
+
input: ex,
|
|
206
|
+
as: "item",
|
|
207
|
+
expr: map(ctx()("item"))
|
|
208
|
+
});
|
|
209
|
+
const $map = (ex, map) => $map1(ex, (i) => map(i.expr()));
|
|
210
|
+
//#endregion
|
|
67
211
|
//#region .build/lib/expression/val.js
|
|
68
212
|
const val = (val) => asExpr({ raw: () => asExprRaw(val && typeof val === "object" && !(val instanceof Date) || typeof val === "string" && val[0] === "$" ? { $literal: val } : val) });
|
|
69
213
|
const current = asExpr({ raw: () => asExprRaw("$$CLUSTER_TIME") });
|
|
214
|
+
const $rand = asExpr({ raw: () => asExprRaw({ $rand: {} }) });
|
|
215
|
+
const rand = $reduce(range(val(0), val(17)), val(""), concat(ctx()("value").expr(), $substr(val("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"), floor(multiply($rand, val(62))), val(1))));
|
|
70
216
|
const $let = (vars, inExpr) => asExpr({ raw: (f) => asExprRaw({ $let: {
|
|
71
217
|
vars: mapExactToObject(vars, (v) => v.raw(f).get()),
|
|
72
218
|
in: inExpr.raw(f).get()
|
|
@@ -81,11 +227,6 @@ const func = (f, ...args) => asExpr({ raw: (field) => asExprRaw({ $function: {
|
|
|
81
227
|
args: args.map((x) => x.raw(field).get()),
|
|
82
228
|
lang: "js"
|
|
83
229
|
} }) });
|
|
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
230
|
//#endregion
|
|
90
231
|
//#region .build/lib/expression/logic.js
|
|
91
232
|
const ite = ((cond, then, orelse) => asExpr({ raw: (f) => asExprRaw({ $cond: {
|
|
@@ -116,45 +257,6 @@ const setField = ({ field, input, value }) => asExpr({ raw: (f) => asExprRaw({ $
|
|
|
116
257
|
value: value.raw(f).get()
|
|
117
258
|
} }) });
|
|
118
259
|
//#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
260
|
//#region .build/lib/accumulators/index.js
|
|
159
261
|
const asAccumulator = (x) => x;
|
|
160
262
|
const $sum_ = (expr) => ({ raw: (f) => asAccumulator({ $sum: expr.raw(f).get() }) });
|
|
@@ -296,90 +398,6 @@ const concatTStages = ({ coll, exec, input }, stages) => ({
|
|
|
296
398
|
exec: concatStages(exec, stages)
|
|
297
399
|
});
|
|
298
400
|
//#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
401
|
//#region .build/lib/aggregate/raws.js
|
|
384
402
|
const $match1 = (query) => (f) => asStages(query ? [{ $match: query.raw(f()) }] : []);
|
|
385
403
|
const $set1 = (updater) => (f) => asStages([{ $set: Object.fromEntries(updater.raw(f()).map(([k, v]) => [f().of(k.slice(1)).str(), v])) }]);
|
|
@@ -572,24 +590,6 @@ const mapToPlainDateTime = (date, timezone) => asExpr({ raw: (f) => asExprRaw({
|
|
|
572
590
|
timezone: timezone.raw(f).get()
|
|
573
591
|
} } }) });
|
|
574
592
|
//#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
593
|
//#region .build/lib/update/updater.js
|
|
594
594
|
const subUpdater = (a, f) => ({ raw: (g) => a.raw(g.with(f)) });
|
|
595
595
|
const rawSet = (fields) => (f) => {
|
|
@@ -711,7 +711,7 @@ const subMerge = (args, out, gid, extra, idPrefix, first) => {
|
|
|
711
711
|
const gidPath = root().of(gid).expr();
|
|
712
712
|
const mapId = (k, v) => map1(k, v);
|
|
713
713
|
const F1 = {
|
|
714
|
-
_id: ["_id", to(idPrefix ? concat(val(idPrefix),
|
|
714
|
+
_id: ["_id", to(idPrefix ? concat(val(idPrefix), rand) : rand)],
|
|
715
715
|
touchedAt: ["touchedAt", to(current)]
|
|
716
716
|
};
|
|
717
717
|
const F2 = mapId(gid, to(gidPath));
|
|
@@ -2119,6 +2119,6 @@ const executes = (view, input, needs) => {
|
|
|
2119
2119
|
};
|
|
2120
2120
|
const single = (view, needs = {}) => pipe((input) => executes(view, input, needs), emptyDelta(), concatDelta, emptyDelta);
|
|
2121
2121
|
//#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 };
|
|
2122
|
+
export { $accumulator, $and, $arrayToObject, $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
2123
|
|
|
2124
2124
|
//# sourceMappingURL=index.esm.js.map
|