@omegup/msync 0.1.53 → 0.1.55

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.
Files changed (93) hide show
  1. package/index.d.ts +16 -17
  2. package/index.esm.js +142 -192
  3. package/index.js +141 -193
  4. package/lib/accumulators/index.d.ts +28 -0
  5. package/lib/aggregate/$merge.d.ts +37 -0
  6. package/lib/aggregate/$upsert.d.ts +19 -0
  7. package/lib/aggregate/group/$group-merge.d.ts +18 -0
  8. package/lib/aggregate/group/index.d.ts +3 -0
  9. package/lib/aggregate/group/utils/sub-group.d.ts +6 -0
  10. package/lib/aggregate/group/utils/sub-merge.d.ts +20 -0
  11. package/lib/aggregate/index.d.ts +10 -0
  12. package/lib/aggregate/lookup/$lookup-delta.d.ts +11 -0
  13. package/lib/aggregate/lookup/$lookup-raw.d.ts +10 -0
  14. package/lib/aggregate/lookup/index.d.ts +20 -0
  15. package/lib/aggregate/match/$match-delta.d.ts +4 -0
  16. package/lib/aggregate/match/$match.d.ts +3 -0
  17. package/lib/aggregate/match/index.d.ts +2 -0
  18. package/lib/aggregate/mongo-stages.d.ts +13 -0
  19. package/lib/aggregate/out.d.ts +37 -0
  20. package/lib/aggregate/prefix.d.ts +33 -0
  21. package/lib/aggregate/raws.d.ts +17 -0
  22. package/lib/aggregate/set/$replace-with-each.d.ts +13 -0
  23. package/lib/aggregate/set/$set-delta.d.ts +5 -0
  24. package/lib/aggregate/set/$set.d.ts +9 -0
  25. package/lib/aggregate/set/index.d.ts +1 -0
  26. package/lib/aggregate/unwind/$unwind-delta.d.ts +7 -0
  27. package/lib/aggregate/unwind/index.d.ts +6 -0
  28. package/lib/boot/boot-simpl.d.ts +14 -0
  29. package/lib/boot/boot-utils.d.ts +27 -0
  30. package/lib/boot/boot.d.ts +16 -0
  31. package/lib/boot/first-stages.d.ts +13 -0
  32. package/lib/boot/index.d.ts +3 -0
  33. package/lib/boot/single.d.ts +11 -0
  34. package/lib/expression/arith.d.ts +33 -0
  35. package/lib/expression/array.d.ts +30 -0
  36. package/lib/expression/concat.d.ts +35 -0
  37. package/lib/expression/date.d.ts +22 -0
  38. package/lib/expression/expr-base.d.ts +5 -0
  39. package/lib/expression/index.d.ts +7 -0
  40. package/lib/expression/logic.d.ts +26 -0
  41. package/lib/expression/range.d.ts +11 -0
  42. package/lib/expression/val.d.ts +18 -0
  43. package/lib/field/field.d.ts +25 -0
  44. package/lib/field/index.d.ts +1 -0
  45. package/lib/machine.d.ts +9 -0
  46. package/lib/predicate/$eq.d.ts +24 -0
  47. package/lib/predicate/$expr.d.ts +3 -0
  48. package/lib/predicate/$in.d.ts +2 -0
  49. package/lib/predicate/index.d.ts +3 -0
  50. package/lib/predicate/utils.d.ts +5 -0
  51. package/lib/query/index.d.ts +1 -0
  52. package/lib/query/logic.d.ts +11 -0
  53. package/lib/stream/aggregate.d.ts +7 -0
  54. package/lib/types/accumulator.d.ts +32 -0
  55. package/lib/types/aggregate.d.ts +9 -0
  56. package/lib/types/expr.d.ts +27 -0
  57. package/lib/types/extern.d.ts +4 -0
  58. package/lib/types/index.d.ts +8 -0
  59. package/lib/types/lookup.d.ts +19 -0
  60. package/lib/types/machine.d.ts +17 -0
  61. package/lib/types/predicate.d.ts +11 -0
  62. package/lib/types/query.d.ts +12 -0
  63. package/lib/types/stream.d.ts +82 -0
  64. package/lib/update/index.d.ts +1 -0
  65. package/lib/update/updater.d.ts +23 -0
  66. package/lib/utils/before.d.ts +3 -0
  67. package/lib/utils/coll.d.ts +5 -0
  68. package/lib/utils/db-indexes.d.ts +7 -0
  69. package/lib/utils/guard.d.ts +21 -0
  70. package/lib/utils/index.d.ts +5 -0
  71. package/lib/utils/json.d.ts +9 -0
  72. package/lib/utils/log.d.ts +1 -0
  73. package/lib/utils/map-object.d.ts +41 -0
  74. package/lib/utils/merge/combiners.d.ts +6 -0
  75. package/lib/utils/merge/index.d.ts +2 -0
  76. package/lib/utils/merge/merge.d.ts +10 -0
  77. package/lib/utils/merge/next-winner.d.ts +3 -0
  78. package/lib/utils/merge/types.d.ts +19 -0
  79. package/lib/utils/merge/utils.d.ts +4 -0
  80. package/lib/utils/tear-down.d.ts +2 -0
  81. package/lib/watch.d.ts +30 -0
  82. package/package.json +1 -1
  83. package/test/mongodb.d.ts +9 -0
  84. package/test/uri.d.ts +1 -0
  85. package/types/class.d.ts +1 -0
  86. package/types/extern.d.ts +5 -0
  87. package/types/global-aug.d.ts +48 -0
  88. package/types/global.d.ts +2 -0
  89. package/types/hkt.d.ts +56 -0
  90. package/types/index.d.ts +6 -0
  91. package/types/json.d.ts +54 -0
  92. package/types/mongo.d.ts +24 -0
  93. package/types/view.d.ts +35 -0
package/index.js CHANGED
@@ -402,8 +402,6 @@ const fieldM = (expr, m) => asExpr({
402
402
  const mergeExact = (...[exprsExact1, exprsExact2]) => spread(exprsExact1, exprsExact2);
403
403
  const mergeExact0 = (...[exprsExact1, exprsExact2]) => spread0(exprsExact1, exprsExact2);
404
404
  const mergeExpr = (...exprs) => mergeExact(...exprs);
405
- const asIntersect = (x) => x;
406
- const pair = (k, v) => asIntersect([k, v]);
407
405
  const fieldF = () => (exprs) => Object.keys(exprs).length
408
406
  ? asExpr({
409
407
  raw: f => asExprRaw(mapExactToObject(exprs, e => e.raw(f).get())),
@@ -439,7 +437,6 @@ const renamedFields = () => assertEqual();
439
437
  const translateOmit = () => assertEqual();
440
438
  const excludeIdem = () => assertEqual();
441
439
  const eqPar = () => assertEqual();
442
- const notExtendExcluded = () => assertEqual();
443
440
 
444
441
  const size = (expr) => asExpr({
445
442
  raw: f => asExprRaw({ $size: expr.raw(f).get() }),
@@ -947,7 +944,9 @@ const getWhenMatched = (whenNotMatched) => {
947
944
  return link().with($replaceWith_(ite(same, root().of('old').expr(), root().of('merged').expr()))).stages;
948
945
  };
949
946
  const $mergeX = (out, keys, f, map, ext, update) => {
950
- const patch = mapExact(keys, v => sub(v, f));
947
+ const patch = mapExact(keys, (v) => {
948
+ return $ifNull(sub(v, f), nil);
949
+ });
951
950
  const filter = mapExactToObject(ext, v => ({ $eq: v }));
952
951
  const setDeleted = out.whenNotMatched === 'discard';
953
952
  const replacer = map(field(omitPick().backward(spread(patch, {
@@ -1164,48 +1163,12 @@ const joinIdOf = (k, k1, k1Id, k2Id) => {
1164
1163
  return concat(idOf(k[0]), val(k[1]), idOf(k[2]));
1165
1164
  };
1166
1165
  const andAlso = (probe, keep) => ite(eqTyped(probe, nil), nil, keep);
1167
- const notObjAndAlso = (probe, keep) => ite(eqTyped(probe, field({})), nil, keep);
1168
- const $unwindDelta = (k1, k2, k, includeNull1, includeNull2) => {
1166
+ const slotsMany = (k1, k2, k, emptyOf) => {
1169
1167
  const emptyArr = array();
1170
1168
  const src = root();
1171
1169
  const k2Arr = (side) => src.of(side).of(k2).expr();
1172
1170
  const k2OrEmpty = (side) => $ifNull(k2Arr(side), emptyArr);
1173
- const k2Empty = (side) => eq(k2Arr(side))(emptyArr);
1174
- const beforeItems = k2OrEmpty('before');
1175
- const afterItems = k2OrEmpty('after');
1176
- const beforeIds = $map1(beforeItems, (item) => item.of('_id').expr());
1177
- const newByK2Id = filter({
1178
- expr: afterItems,
1179
- as: 'a',
1180
- cond: not(inArray(ctx()('a').of('_id').expr(), beforeIds)),
1181
- });
1182
- const oldByK2Id = $map0({
1183
- input: beforeItems,
1184
- as: 'b',
1185
- expr: field({
1186
- before: ['before', ctx()('b').expr()],
1187
- after: [
1188
- 'after',
1189
- first$1(filter({
1190
- expr: afterItems,
1191
- as: 'a',
1192
- cond: eq(ctx()('a').of('_id').expr())(ctx()('b').of('_id').expr()),
1193
- })),
1194
- ],
1195
- }),
1196
- });
1197
- const k1Slot = (fill) => array(field({
1198
- before: [
1199
- 'before',
1200
- $ifNull(first$1(beforeItems), fill),
1201
- ],
1202
- after: [
1203
- 'after',
1204
- $ifNull(first$1(afterItems), fill),
1205
- ],
1206
- }));
1207
- const kept = k === k1 ? k1Slot(nil) : oldByK2Id;
1208
- const added = k === k1 ? emptyArr : newByK2Id;
1171
+ const k1Id = root().of('_id').expr();
1209
1172
  const k1Delta = field({
1210
1173
  before: [
1211
1174
  'before',
@@ -1215,154 +1178,132 @@ const $unwindDelta = (k1, k2, k, includeNull1, includeNull2) => {
1215
1178
  'after',
1216
1179
  $ifNull(src.of('after').of(k1).expr(), nil),
1217
1180
  ],
1181
+ deleted: ['deleted', src.of('deleted').expr()],
1218
1182
  });
1219
- const unwindJoin = ({ kept, added, padToNull, isPad, join, }) => {
1220
- const newDeltas = $map0({
1221
- input: added,
1222
- as: 'a',
1183
+ const itemId = (k2Id) => {
1184
+ const at = (key) => (key === k1 ? k1Id : k2Id);
1185
+ if (typeof k === 'string')
1186
+ return at(k);
1187
+ return concat(at(k[0]), val(k[1]), at(k[2]));
1188
+ };
1189
+ const keyed = (side) => {
1190
+ const items = ctx()('items').expr();
1191
+ return $let({ items: ['items', k2OrEmpty(side)] }, ite(eq(items)(emptyArr), emptyOf(k1Id), $map0({
1192
+ input: items,
1193
+ as: 'b',
1223
1194
  expr: field({
1224
- before: ['before', nil],
1225
- after: ['after', ctx()('a').expr()],
1195
+ _id: ['_id', itemId(ctx()('b').of('_id').expr())],
1196
+ value: ['value', ctx()('b').expr()],
1226
1197
  }),
1227
- });
1228
- const deltas = mergeObjects(field(map1(k1, k1Delta)), field(map1(k2, concatArray(kept, newDeltas))));
1229
- const doc = root();
1230
- const parentId = doc.of('_id').expr();
1231
- const k1At = (side) => doc.of(k1).of(side).expr();
1232
- const k2Raw = (side) => doc.of(k2).of(side).expr();
1233
- const docK2Null = root();
1234
- const k2Keep = (side) => docK2Null.of(k2).of(side).expr();
1235
- const k2At = (side) => padToNull(k2Raw(side), k2Keep(side));
1236
- const rowOf = (id, a, b) => mergeObjects(mergeObjects(field({ _id: ['_id', id] }), field(map1(k1, a))), field(map1(k2, b)));
1237
- const docK1 = root();
1238
- const k2RawK1 = (side) => docK1.of(k2).of(side).expr();
1239
- const k2KeepK1K2 = (side) => root().of(k2).of(side).expr();
1240
- const rowOnK1 = (side) => {
1241
- const t = docK1.of(k1).of(side);
1242
- return rowOf(t.of('_id').expr(), t.expr(), padToNull(k2RawK1(side), k2KeepK1K2(side)));
1243
- };
1244
- const docK2 = root();
1245
- const k1AtK2 = (side) => docK2.of(k1).of(side).expr();
1246
- const rowOnK2 = (side) => {
1247
- const u = docK2.of(k2).of(side);
1248
- return rowOf(u.of('_id').expr(), k1AtK2(side), u.expr());
1249
- };
1250
- const docK1K2 = root();
1251
- const k1AtK1K2 = (side) => docK1K2.of(k1).of(side).expr();
1252
- const k2AtK1K2 = (side) => docK1K2.of(k2).of(side).expr();
1253
- const k1IdK1K2 = (side) => docK1K2.of(k1).of(side).of('_id').expr();
1254
- const k2IdK1K2 = (side) => docK1K2.of(k2).of(side).of('_id').expr();
1255
- const completeId = (side) => joinIdOf(k, k1, k1IdK1K2(side), k2IdK1K2(side));
1256
- const rowK1K2 = (side) => rowOf(completeId(side), k1AtK1K2(side), k2AtK1K2(side));
1257
- const liftRowId = $replaceWith_(mergeObjects(root().expr(), field({
1258
- _id: [
1259
- '_id',
1260
- $ifNull(root()
1261
- .of('before')
1262
- .of('_id')
1263
- .expr(), root()
1264
- .of('after')
1265
- .of('_id')
1266
- .expr(), root().of('_id').expr()),
1267
- ],
1268
1198
  })));
1269
- const padded = (side) => isPad(k2Raw(side));
1270
- const emptyObj = field({});
1271
- const deletedFlags = mergeObjects(ite(padded('before'), field({ before: ['before', val(true)] }), emptyObj), ite(padded('after'), field({ after: ['after', val(true)] }), emptyObj));
1272
- const joinAt = (side) => join({
1273
- k1: k1At(side),
1274
- k2: k2At(side),
1275
- rowK1K2: rowK1K2(side),
1276
- rowOnK1: rowOnK1(side),
1277
- rowOnK2: rowOnK2(side),
1278
- k2Keep: k2Keep(side),
1279
- k2Raw: k2Raw(side),
1280
- k2RawK1: k2RawK1(side),
1281
- k2KeepK1K2: k2KeepK1K2(side),
1282
- });
1283
- const joinDelta = mergeObjects(field({
1284
- _id: ['_id', parentId],
1285
- before: ['before', joinAt('before')],
1286
- after: ['after', joinAt('after')],
1287
- }), ite(or(padded('before'), padded('after')), field({ deleted: ['deleted', deletedFlags] }), emptyObj));
1288
- return link()
1289
- .with($replaceWith_(mergeObjects(src.expr(), deltas)))
1290
- .with($unwind_(k2))
1291
- .with($replaceWith_(joinDelta))
1292
- .with(matchDelta())
1293
- .with(liftRowId).stages;
1294
1199
  };
1295
- const noPadToNull = (k2) => k2;
1296
- const neverPad = (_k2) => val(false);
1297
- if (includeNull2 === null) {
1298
- const padObj = field({});
1299
- const padDelta = (after) => field({
1300
- before: ['before', padObj],
1301
- after: ['after', after],
1302
- });
1303
- const addedPadded = k === k1
1304
- ? array()
1305
- : ite(and(not(k2Empty('before')), k2Empty('after')), array(padObj), added);
1306
- const padToNull = (k2, keep) => ite(eqTyped(k2, field({})), nil, keep);
1307
- const isPad = (k2) => ite(eqTyped(k2, field({})), val(true), val(false));
1308
- const keptMatched = ite(k2Empty('before'), ite(k2Empty('after'), array(padDelta(padObj)), array(padDelta(nil))), kept);
1309
- const padded = { added: addedPadded, padToNull, isPad };
1310
- if (includeNull1 === null) {
1311
- if (k === k1) {
1312
- return unwindJoin({
1313
- ...padded,
1314
- kept: k1Slot(padObj),
1315
- join: ({ k1: k1Val, rowOnK1 }) => andAlso(k1Val, rowOnK1),
1316
- });
1317
- }
1318
- if (k === k2) {
1319
- return unwindJoin({
1320
- ...padded,
1321
- kept: keptMatched,
1322
- join: ({ k2Raw, k2Keep, rowOnK2 }) => notObjAndAlso(k2Raw, andAlso(k2Keep, rowOnK2)),
1323
- });
1324
- }
1325
- return unwindJoin({
1326
- ...padded,
1327
- kept: keptMatched,
1328
- join: ({ k1: k1Val, k2RawK1, k2KeepK1K2, rowK1K2 }) => andAlso(k1Val, notObjAndAlso(k2RawK1, andAlso(k2KeepK1K2, rowK1K2))),
1329
- });
1330
- }
1331
- const eq2 = literalsEqaul();
1332
- if (k === k1) {
1333
- return unwindJoin({
1334
- ...padded,
1335
- kept: k1Slot(padObj),
1336
- join: ({ k1: k1Val, rowOnK1 }) => andAlso(k1Val, rowOnK1),
1337
- });
1200
+ const beforeKeyed = keyed('before');
1201
+ const afterKeyed = keyed('after');
1202
+ const bound = (name) => ctx()(name).expr();
1203
+ const idOf = (name) => ctx()(name).of('_id').expr();
1204
+ const valueOf = (name) => ctx()(name).of('value').expr();
1205
+ const kept = $map0({
1206
+ input: bound('beforeK'),
1207
+ as: 'b',
1208
+ expr: field({
1209
+ _id: ['_id', idOf('b')],
1210
+ before: ['before', valueOf('b')],
1211
+ after: [
1212
+ 'after',
1213
+ first$1($map0({
1214
+ input: filter({
1215
+ expr: bound('afterK'),
1216
+ as: 'a',
1217
+ limit: val(1),
1218
+ cond: eq(idOf('a'))(idOf('b')),
1219
+ }),
1220
+ as: 'a',
1221
+ expr: valueOf('a'),
1222
+ })),
1223
+ ],
1224
+ }),
1225
+ });
1226
+ const beforeIds = $map0({
1227
+ input: bound('beforeK'),
1228
+ as: 'id',
1229
+ expr: ctx()('id').of('_id').expr(),
1230
+ });
1231
+ const added = $map0({
1232
+ input: filter({
1233
+ expr: bound('afterK'),
1234
+ as: 'a',
1235
+ cond: not(inArray(idOf('a'), beforeIds)),
1236
+ }),
1237
+ as: 'a',
1238
+ expr: field({
1239
+ _id: ['_id', idOf('a')],
1240
+ before: ['before', nil],
1241
+ after: ['after', valueOf('a')],
1242
+ }),
1243
+ });
1244
+ const slots = $let({
1245
+ beforeK: ['beforeK', beforeKeyed],
1246
+ afterK: ['afterK', afterKeyed],
1247
+ }, concatArray(kept, added));
1248
+ const exclude = excludeIdem();
1249
+ return $replaceWith_(field(exclude.backward(mergeExpr(exclude.forward(map1(k2, slots)), map1(k1, k1Delta)))));
1250
+ };
1251
+ const noEmpty = (_id) => array();
1252
+ const padEmpty = (id) => array(field({
1253
+ _id: ['_id', id],
1254
+ value: ['value', field({})],
1255
+ }));
1256
+ const joinMany = (k1, k2, eq1, eq2) => {
1257
+ const doc = root();
1258
+ const id = () => root().of(k2).of('_id').expr();
1259
+ const k1At = (side) => doc.of(k1).of(side).expr();
1260
+ const rowOf = (a, b) => mergeObjects(mergeObjects(field({ _id: ['_id', id()] }), field(map1(k1, a))), field(map1(k2, b)));
1261
+ const rowPad = (k1v, n2) => {
1262
+ return rowOf(k1v, n2.forward(nil));
1263
+ };
1264
+ const rowReal = (k1v, k2v) => rowOf(k1v, k2v);
1265
+ const k2join = (raw, orNull, pad, real) => ite(eqTyped(raw, field({})), pad, andAlso(orNull, real));
1266
+ const joinAt = (side) => {
1267
+ const k2t = () => root().of(k2).of(side).expr();
1268
+ const k2w = () => root().of(k2).of(side).expr();
1269
+ if (!eq1) {
1270
+ const k1t = () => root().of(k1).of(side).expr();
1271
+ return andAlso(k1At(side), k2join(k2t(), k2t(), eq2 ? rowPad(k1t(), eq2) : nil, rowReal(k1t(), k2t())));
1338
1272
  }
1339
- return unwindJoin({
1340
- ...padded,
1341
- kept: keptMatched,
1342
- join: ({ k1: k1Val, k2RawK1, k2KeepK1K2, rowK1K2 }) => andAlso(k1Val, notObjAndAlso(k2RawK1, andAlso(k2KeepK1K2, eq2.forward(rowK1K2)))),
1343
- });
1344
- }
1345
- if (includeNull1 === null) {
1346
- const eq1 = literalsEqaul();
1347
- return unwindJoin({
1348
- kept,
1349
- added,
1350
- padToNull: noPadToNull,
1351
- isPad: neverPad,
1352
- join: ({ k1, k2: k2Val, k2KeepK1K2, rowK1K2, rowOnK2 }) => {
1353
- return k === k2
1354
- ? andAlso(k2Val, rowOnK2)
1355
- : andAlso(k1, andAlso(k2KeepK1K2, eq1.forward(rowK1K2)));
1356
- },
1357
- });
1358
- }
1359
- return unwindJoin({
1360
- kept,
1361
- added,
1362
- padToNull: noPadToNull,
1363
- isPad: neverPad,
1364
- join: ({ k1, k2KeepK1K2, rowK1K2 }) => andAlso(k1, andAlso(k2KeepK1K2, rowK1K2)),
1273
+ const k1v = () => {
1274
+ return $ifNull(root().of(k1).of(side).expr(), eq1.forward(nil));
1275
+ };
1276
+ return k2join(k2w(), k2w(), eq2 ? rowPad(k1v(), eq2) : nil, rowReal(k1v(), k2w()));
1277
+ };
1278
+ const isPad = (side) => ite(eq(doc.of(k2).of(side).expr())(field({})), val(true), doc.of(k1).of('deleted').of(side).expr());
1279
+ const joinDelta = field({
1280
+ _id: ['_id', id()],
1281
+ before: ['before', joinAt('before')],
1282
+ after: ['after', joinAt('after')],
1283
+ deleted: [
1284
+ 'deleted',
1285
+ field({
1286
+ before: ['before', isPad('before')],
1287
+ after: ['after', isPad('after')],
1288
+ }),
1289
+ ],
1365
1290
  });
1291
+ return $replaceWith_(joinDelta);
1292
+ };
1293
+ const $unwindDelta = (k1, k2, k, includeNull1, includeNull2) => {
1294
+ const stages = (emptyOf, eq1, eq2) => {
1295
+ return link()
1296
+ .with(slotsMany(k1, k2, k, emptyOf))
1297
+ .with($unwind_(k2))
1298
+ .with(joinMany(k1, k2, eq1, eq2))
1299
+ .with(matchDelta()).stages;
1300
+ };
1301
+ const run = (emptyOf) => stages(emptyOf, includeNull1 === null && literalsEqaul(), includeNull2 === null && literalsEqaul());
1302
+ if (k === k2)
1303
+ return run(noEmpty);
1304
+ if (includeNull2 === null)
1305
+ return run(padEmpty);
1306
+ return run(noEmpty);
1366
1307
  };
1367
1308
 
1368
1309
  const $unwind = (k, dict, middle = '.') => {
@@ -1399,7 +1340,10 @@ const $lookupDelta = ({ field1, field2 }, { coll, exec, input }, k1, k2, k, incl
1399
1340
  const normForeignKey = (f) => to($ifNull(root().of(f).of(k1).with(field1).expr(), val(hash)));
1400
1341
  return link()
1401
1342
  .with($replaceWithDelta(field(map1(k1, root().expr()))))
1402
- .with($set_(set()({ bId: ['bId', normForeignKey('before')], aId: ['aId', normForeignKey('after')] })))
1343
+ .with($set_(set()({
1344
+ bId: ['bId', normForeignKey('before')],
1345
+ aId: ['aId', normForeignKey('after')],
1346
+ })))
1403
1347
  .with($simpleLookup_({
1404
1348
  coll,
1405
1349
  k: 'a',
@@ -1421,15 +1365,21 @@ const $lookupDelta = ({ field1, field2 }, { coll, exec, input }, k1, k2, k, incl
1421
1365
  pipeline: link().with(input).with(exec).stages,
1422
1366
  }))
1423
1367
  .with($replaceWithEach((f) => {
1424
- const f1 = f === 'after' ? 'a' : 'b';
1425
- const a = root().of(f1).of('before').expr();
1426
- const part = root().of(f);
1427
- return ite(eq(root().of(f).expr())(nil), nil, field(omit.backward(mergeExpr(omit.forward(map1(k2, a)), map1(k1, part.of(k1).expr())))));
1368
+ const joined = (side, arr) => {
1369
+ const here = root();
1370
+ return ite(eqTyped(root().of(side).expr(), nil), nil, field(omit.backward(mergeExpr(omit.forward(map1(k2, here.of(arr).of('before').expr())), map1(k1, here
1371
+ .of(side)
1372
+ .of(k1)
1373
+ .expr())))));
1374
+ };
1375
+ return f === 'after' ? joined('after', 'a') : joined('before', 'b');
1428
1376
  }))
1429
1377
  .with(includeNull1 === null
1430
- ? $replaceWithEach1((f) => {
1431
- const otherField = root().of(f === 'after' ? 'before' : 'after');
1432
- return $ifNull(root().of(f).expr(), field(omit.backward(mergeExpr(omit.forward(map1(k2, otherField.of(k2).expr())), map1(k1, nil)))));
1378
+ ? $replaceWithEach1((part) => {
1379
+ const otherPart = root().of(part === 'after' ? 'before' : 'after');
1380
+ const n1 = literalsEqaul().forward(nil);
1381
+ const expr = $ifNull(root().of(part).expr(), field(omit.backward(mergeExpr(omit.forward(map1(k2, otherPart.of(k2).expr())), map1(k1, n1)))));
1382
+ return expr;
1433
1383
  })
1434
1384
  : link().stages)
1435
1385
  .with($unwindDelta(k1, k2, k, includeNull1, includeNull2)).stages;
@@ -2609,7 +2559,6 @@ exports.ne = ne;
2609
2559
  exports.nil = nil;
2610
2560
  exports.noop = noop;
2611
2561
  exports.not = not;
2612
- exports.notExtendExcluded = notExtendExcluded;
2613
2562
  exports.notNull = notNull;
2614
2563
  exports.now = now;
2615
2564
  exports.omitExclude = omitExclude;
@@ -2617,7 +2566,6 @@ exports.omitPick = omitPick;
2617
2566
  exports.omitRORec = omitRORec;
2618
2567
  exports.or = or;
2619
2568
  exports.padLeft = padLeft;
2620
- exports.pair = pair;
2621
2569
  exports.prepare = prepare;
2622
2570
  exports.rand = rand;
2623
2571
  exports.range = range;
@@ -0,0 +1,28 @@
1
+ import type { AppMap, N, O, PRRec } from '../../types';
2
+ import type { ExprHKT } from '../expression/concat';
3
+ import { type AddO } from '../expression/val';
4
+ import type { DeltaAccumulator, Expr, Part } from '../types';
5
+ type AddOs<A extends readonly unknown[]> = {
6
+ [K in keyof A]: AddO<A[K]>;
7
+ };
8
+ type PushSides<V> = {
9
+ 0: V[];
10
+ 1: V[];
11
+ };
12
+ type PushDict<V> = PRRec<string, PushSides<V>>;
13
+ export declare const $sum: <D extends O, C = unknown>(expr: Expr<number | N, D, C>) => DeltaAccumulator<D, number, C>;
14
+ export declare const $accumulator: <D, T, Ctx, A extends readonly unknown[]>(init: () => T, accumulateArgs: AppMap<ExprHKT<Part<D>, Ctx>, AddOs<A>>, accumulate: (a: T, ...args: A) => T, merge: (...args: [T | N, T]) => T) => DeltaAccumulator<D, AddO<T>, Ctx>;
15
+ export declare const $countDict: <D extends O, K extends string = string, C = unknown>(expr: Expr<AddO<K>, D, C>) => DeltaAccumulator<D, AddO<PRRec<K, number>>, C>;
16
+ export declare const $countDictArray: <D extends O, K extends string = string, C = unknown>(expr: Expr<AddO<K[]>, D, C>) => DeltaAccumulator<D, AddO<PRRec<K, number>>, C>;
17
+ export declare const $pushDict: <D extends O, V, C = unknown>(key: Expr<string, D, C>, value: Expr<AddO<V>, D, C>) => DeltaAccumulator<D, O<{
18
+ [x: string]: O<{
19
+ 0: import("../..").Arr<AddO<V>>;
20
+ 1: import("../..").Arr<AddO<V>>;
21
+ }> | undefined;
22
+ }>, C>;
23
+ export declare const $keys: <D extends O, K extends string = string, C = unknown>(expr: Expr<AddO<PRRec<K, number>>, D, C>) => Expr<AddO<K[]>, D, C>;
24
+ export declare const $entries: <D extends O, V, C = unknown>(expr: Expr<AddO<PushDict<V>>, D, C>) => Expr<AddO<{
25
+ k: string;
26
+ v: V;
27
+ }[]>, D, C>;
28
+ export {};
@@ -0,0 +1,37 @@
1
+ import type { IdHKT, OPick, RWCollection, Timestamp } from '../../types';
2
+ import type { doc, ID, N, O, rawItem, Rec, Replace, RORec, StrKey } from '../../types/json';
3
+ import { type ExprsExact } from '../expression/concat';
4
+ import type { Delta, Expr, IsDeleted, Model, RawStages, StreamRunnerParam, TS } from '../types';
5
+ import { type Exact } from '../utils/map-object';
6
+ type OutInputE<T, E, A = T | null> = ID & Rec<'after', A> & E;
7
+ type Allowed<K extends string> = Exclude<K, keyof (TS & ID)>;
8
+ export type Patch<V, KK extends StrKey<V> = StrKey<V>> = ((OPick<V, Allowed<KK>> & ID) | (Rec<Allowed<KK>, N> & ID)) & TS;
9
+ type TakeDoc<V, E = ID, KK extends StrKey<V> = StrKey<V>> = OPick<V, Allowed<KK>> & E;
10
+ type ND = {
11
+ readonly deletedAt?: null;
12
+ };
13
+ type SafeE<E> = Omit<E, `$${string}` | keyof ID>;
14
+ type Args<P, Out> = [added: Expr<P, unknown, {
15
+ new: P;
16
+ }>, old: Expr<Out, Out>];
17
+ type Result<P> = Expr<P, unknown, {
18
+ new: P;
19
+ }>;
20
+ type Update<P, Out> = (...args: Args<P, Out>) => Result<P>;
21
+ type UpdateF<P, Out> = <K extends keyof IsDeleted>(...args: Args<Replace<P, RORec<K, Timestamp>>, Out>) => Result<Replace<P, RORec<K, Timestamp>>>;
22
+ export declare const getWhenMatchedForMerge: <Out extends Model, P extends Model, K extends keyof IsDeleted>(whenNotMatched: "discard" | "fail" | "insert", update: Update<Replace<P, RORec<K, Timestamp>>, Out>) => RawStages<O, Out, Out | Replace<Out, P>, RORec<"new", Replace<P, RORec<K, Timestamp>>>>;
23
+ export declare const getWhenMatched: <Out extends Model, P extends Model, K extends keyof IsDeleted>(whenNotMatched: "discard" | "fail" | "insert") => RawStages<O, Rec<"old" | "merged", Out | Replace<Out, P>>, Out | Replace<Out, P>>;
24
+ type MergeCollection<V extends O, Out extends Model> = {
25
+ coll: RWCollection<Out | Replace<Out, Patch<V>> | Replace<Patch<V>, IsDeleted>, Out>;
26
+ whenNotMatched: 'discard';
27
+ } | {
28
+ coll: RWCollection<Out | Replace<Out, Patch<V>>, Out>;
29
+ whenNotMatched: 'fail';
30
+ };
31
+ type MergeUpdate<V, Out> = UpdateF<((OPick<V, Allowed<StrKey<V>>> & ID) | (Rec<Allowed<StrKey<V>>, N> & ID)) & TS, Out>;
32
+ export declare const $mergeId: <V extends O>() => <SourcePart extends doc, Out extends Model, E = unknown, EEE extends RORec<string, rawItem> = {}>(out: MergeCollection<V, Out>, keys: ExprsExact<TakeDoc<V, unknown>, SourcePart>, id: Expr<string, OutInputE<TakeDoc<V>, E, null>>, ext: Exact<Omit<SafeE<EEE>, keyof (ND & TS)>, IdHKT>, update?: MergeUpdate<V, Out>) => StreamRunnerParam<OutInputE<SourcePart, E>, "out">;
33
+ export declare const $simpleMergePart: <V extends O>() => <Source extends doc, Out extends Model, EEE extends RORec<string, rawItem>>(out: MergeCollection<V, Out>, keys: ExprsExact<TakeDoc<V, unknown>, Source>, ext: Exact<Omit<SafeE<EEE>, keyof (ND & TS)>, IdHKT>, update?: MergeUpdate<V, Out>) => StreamRunnerParam<Source, "out">;
34
+ export declare const $simpleMerge: <V extends O>() => <Source extends doc, Out extends Model>(out: RWCollection<Out | Replace<Out, Patch<V>> | Replace<Patch<V>, IsDeleted>, Out>, keys: ExprsExact<TakeDoc<V, unknown>, Source>, whenNotMatched?: "fail" | "discard", update?: MergeUpdate<V, Out>) => StreamRunnerParam<Source, "out">;
35
+ export declare const $mergePart: <V extends O>() => <Out extends Model, SourcePart extends doc, EEE extends RORec<string, rawItem>>(out: RWCollection<Out | Replace<Out, Patch<V>>, Out>, keys: ExprsExact<TakeDoc<V, unknown>, SourcePart>, ext: Exact<Omit<SafeE<EEE>, keyof (ND & TS)>, IdHKT>, update?: MergeUpdate<V, Out>) => StreamRunnerParam<Delta<SourcePart>, "out">;
36
+ export declare const $merge: <V extends O>() => <Out extends Model, SourcePart extends doc>(out: RWCollection<Out | Replace<Out, Patch<V>>, Out>, keys: ExprsExact<TakeDoc<V, unknown>, SourcePart>, update?: MergeUpdate<V, Out>) => StreamRunnerParam<Delta<SourcePart>, "out">;
37
+ export {};
@@ -0,0 +1,19 @@
1
+ import type { IdHKT, Replace, RWCollection } from '../../types';
2
+ import type { ID, O, RORec, doc, rawItem } from '../../types/json';
3
+ import { type ExprsExact } from '../expression/concat';
4
+ import type { Del, Delta, Expr, StreamRunnerParam, TS } from '../types';
5
+ import { type Exact } from '../utils/map-object';
6
+ type ND = {
7
+ readonly deletedAt?: null;
8
+ };
9
+ type SafeE<E> = Omit<E, `$${string}` | keyof ID>;
10
+ export type Merge<T extends doc, E> = Omit<SafeE<E>, keyof (ND & TS)> & ((T & ND & TS) | Del);
11
+ type ExprP<P> = Expr<P, unknown, {
12
+ new: P;
13
+ }>;
14
+ type Update<P, Out> = (added: ExprP<P>, old: Expr<Out, Out>) => ExprP<P>;
15
+ export declare const $insertX: <T extends doc, D extends O, EEE extends RORec<string, rawItem>>(out: RWCollection<Merge<T, EEE>>, expr: Expr<T, D>, map: (x: Expr<T & ND & TS & Omit<SafeE<EEE>, keyof (ND & TS)>, D>) => Expr<Merge<T, EEE>, D>, ext: Exact<Omit<SafeE<EEE>, keyof (ND & TS)>, IdHKT>, extExpr: ExprsExact<Omit<SafeE<EEE>, keyof (ND & TS)>, unknown>, update?: Update<Replace<Merge<T, EEE>, {}>, Merge<T, EEE>>) => StreamRunnerParam<D, "out">;
16
+ export declare const $simpleInsert: <T extends doc>(out: RWCollection<Merge<T, {}>>) => StreamRunnerParam<T, "out">;
17
+ export declare const $insertPart: <T extends doc, EEE extends RORec<string, rawItem>>(out: RWCollection<Merge<T, EEE>>, ext: Exact<Omit<SafeE<EEE>, keyof (ND & TS)>, IdHKT>) => StreamRunnerParam<Delta<T>, "out">;
18
+ export declare const $insert: <T extends doc>(out: RWCollection<Merge<T, {}>>) => StreamRunnerParam<Delta<T>, "out">;
19
+ export {};
@@ -0,0 +1,18 @@
1
+ import type { RWCollection, WriteonlyCollection } from '../../../types';
2
+ import type { AsLiteral, ID, O, Rec, doc, notArr } from '../../../types/json';
3
+ import { type ExprsExact } from '../../expression/concat';
4
+ import type { Delta, DeltaAccumulators, Expr, StreamRunnerParam, TS } from '../../types';
5
+ import type { MergeInto } from '../out';
6
+ import { type Extra, type IdAndTsKeys, type Loose, type MergedInput, type Strict, type V_Grp } from './utils/sub-merge';
7
+ type Denied<GID = never> = keyof (TS & ID) | GID;
8
+ type GI<GG> = Exclude<GG, keyof TS>;
9
+ export type GroupMergeOut<Grp extends notArr, V extends O, GG extends string, EE = {}, Out extends Loose<Grp, V, GG> = Loose<Grp, V, GG>> = MergeInto<Strict<Grp, V, GG, EE>, Out, WriteonlyCollection<MergedInput<Out, V, Grp, GG, EE>>>;
10
+ export type GroupMergeCollection<WhenNotMatched extends MergeInto<never, never>['whenNotMatched'], Grp extends notArr, V extends O, GG extends string, EE = {}, Out extends Loose<Grp, V, GG> = Loose<Grp, V, GG>> = (GroupMergeOut<Grp, V, GG, EE, Out> & {
11
+ whenNotMatched: WhenNotMatched;
12
+ })['into'];
13
+ export declare const $groupMerge: <T extends O, Grp extends notArr, V extends O, GG extends string, EE = {}, Out extends Loose<Grp, V, GG> = Loose<Grp, V, GG>>(id: Expr<Grp, T>, args: DeltaAccumulators<T, O & Omit<V, Denied<GI<GG>>>>, out: GroupMergeOut<Grp, V, GG, EE, Out>, gid: AsLiteral<GI<GG>>, extra: ExprsExact<Extra<EE, V, GG>, V_Grp<V, GG, Grp>>, idPrefix?: string) => StreamRunnerParam<Delta<T>, "out">;
14
+ export type GroupIdCollection<V extends O, EE = {}, Out extends Loose<string, V, '_id'> = Loose<string, V, '_id'>> = RWCollection<MergedInput<Out, V, string, '_id', EE>, Out>;
15
+ export declare const $groupId: <T extends O, V extends O, EE = {}, Out extends Loose<string, V, "_id"> = Loose<string, V, "_id">>(id: Expr<string, T>, args: DeltaAccumulators<T, O & Omit<V, Denied>>, out: GroupIdCollection<V, EE, Out>, extra: ExprsExact<Omit<EE, IdAndTsKeys | keyof Omit<V, IdAndTsKeys>>, doc & Omit<V, IdAndTsKeys>>) => StreamRunnerParam<Delta<T>, "out">;
16
+ export type GroupCollection<Grp extends notArr, V extends O, EE = {}, Out extends Loose<Grp, V, '_grp'> = Loose<Grp, V, '_grp'>> = RWCollection<MergedInput<Out, V, Grp, '_grp', EE> | Strict<Grp, V, '_grp', EE>, Out>;
17
+ export declare const $group: <T extends O, Grp extends notArr, V extends O, EE = {}, Out extends Loose<Grp, V, "_grp"> = Loose<Grp, V, "_grp">>(id: Expr<Grp, T>, args: DeltaAccumulators<T, O & Omit<V, Denied<"_grp">>>, out: GroupCollection<Grp, V, EE, Out>, extra: ExprsExact<Omit<EE, IdAndTsKeys | "_grp" | Exclude<keyof V, IdAndTsKeys | "_grp">>, Rec<"_grp", Grp> & Omit<V, IdAndTsKeys | "_grp">>, idPrefix?: string) => StreamRunnerParam<Delta<T>, "out">;
18
+ export {};
@@ -0,0 +1,3 @@
1
+ export { $groupMerge, $groupId, $group } from './$group-merge';
2
+ export type { GroupCollection, GroupIdCollection, GroupMergeCollection } from './$group-merge';
3
+ export type { Loose, Strict, MergedInput } from './utils/sub-merge';
@@ -0,0 +1,6 @@
1
+ import type { O, RORec, Rec } from '../../../../types';
2
+ import { type ExprsExact } from '../../../expression/concat';
3
+ import type { Delta, Expr, RawStages } from '../../../types';
4
+ import type { DeltaAccumulators } from '../../../types/accumulator';
5
+ export type WithItem<V, Grp> = Rec<'_id', Grp> & Rec<'item', O<V>>;
6
+ export declare const subGroup: <T extends O, Grp, V extends O, GID extends string>(id: Expr<Grp, T>, args: DeltaAccumulators<T, V>, addGrp: <D extends Rec<"_id", Grp>>(src: ExprsExact<V, D>) => ExprsExact<RORec<GID, Grp> & V, D>) => RawStages<unknown, Delta<T>, Rec<GID, Grp> & V>;
@@ -0,0 +1,20 @@
1
+ import type { AsLiteral, ID, O, Rec, Replace, WriteonlyCollection, notArr } from '../../../../types';
2
+ import { type ExprsExact } from '../../../expression/concat';
3
+ import type { Model, RawStages, TS } from '../../../types';
4
+ import type { DeltaAccumulators } from '../../../types/accumulator';
5
+ import { type MergeInto } from '../../out';
6
+ type GI<GG> = Exclude<GG, keyof TS>;
7
+ export type IdAndTsKeys = keyof (TS & ID);
8
+ type V<VV, GG extends string> = Omit<VV, IdAndTsKeys | GI<GG>>;
9
+ export type Prepare<Grp, GG extends string> = TS & ID & Rec<GI<GG>, Grp>;
10
+ type Par<T> = {
11
+ [P in keyof T]?: T[P] | null;
12
+ };
13
+ export type Loose<Grp, VV, GG extends string> = Prepare<Grp, GG> & Par<V<VV, GG>>;
14
+ export type Strict<Grp, VV, GG extends string, EE> = Prepare<Grp, GG> & V<VV, GG> & Omit<EE, IdAndTsKeys | GI<GG> | keyof V<VV, GG>>;
15
+ export type V_Grp<VV, GG extends string, Grp> = Rec<GI<GG>, Grp> & V<VV, GG>;
16
+ export type Extra<EE, VV, GG extends string> = Omit<EE, IdAndTsKeys | GI<GG> | keyof V<VV, GG>>;
17
+ type OrReplace<T, V> = T | Replace<T, V>;
18
+ export type MergedInput<Out, VV, Grp, GG extends string, EE> = OrReplace<Replace<Replace<Out, V<VV, GG>>, Extra<EE, VV, GG>> & Model, TS & ID & V_Grp<VV, GG, Grp> & Extra<EE, VV, GG>>;
19
+ export declare const subMerge: <T extends O, Grp extends notArr, VV extends O, GG extends string, EE = {}, Out extends Loose<Grp, VV, GG> = Loose<Grp, VV, GG>>(args: DeltaAccumulators<T, V<VV, GG>>, out: MergeInto<Strict<Grp, VV, GG, EE>, Out, WriteonlyCollection<MergedInput<Out, VV, Grp, GG, EE>>>, gid: AsLiteral<GI<GG>>, extra: ExprsExact<Extra<EE, VV, GG>, V_Grp<VV, GG, Grp>>, idPrefix: string, first: boolean) => RawStages<unknown, V_Grp<VV, GG, Grp>, "out">;
20
+ export {};
@@ -0,0 +1,10 @@
1
+ export { emptyDelta } from './prefix';
2
+ export * from './group';
3
+ export * from './lookup';
4
+ export * from './match';
5
+ export * from './set';
6
+ export * from './unwind';
7
+ export * from './$merge';
8
+ export * from './$upsert';
9
+ export * from './out';
10
+ export { $group_ } from './mongo-stages';
@@ -0,0 +1,11 @@
1
+ import type { Arr, AsLiteral, ID, N, O, Rec, doc, rawItem } from '../../../types';
2
+ import { Field } from '../../field';
3
+ import type { BA, Before, Delta, RawStages, TStages, UBefore } from '../../types';
4
+ import { type JoinId } from '../unwind';
5
+ type s = string;
6
+ type Both<K1 extends s, LE, KK2 extends s, RE, N1 extends null = never, N2 extends null = never> = Delta<Rec<K1, LE | N1> & Rec<Exclude<KK2, BA | K1>, RE | N2> & ID>;
7
+ export declare const $lookupDelta: <LQ extends O, LE extends LQ & doc, RQ extends O, RE extends RQ & doc, BRB extends UBefore<RQ>, RS extends UBefore<RQ>, S extends rawItem, K1 extends s, KK2 extends s, N1 extends null = never, N2 extends null = never>({ field1, field2 }: {
8
+ field1: Field<LQ, S | N | Arr<S>>;
9
+ field2: Field<RQ, S | N | Arr<S>>;
10
+ }, { coll, exec, input }: TStages<RS, UBefore<RQ>, BRB, Before<RE>>, k1: AsLiteral<K1>, k2: AsLiteral<Exclude<KK2, BA | K1>>, k: JoinId<K1, Exclude<KK2, BA | K1>>, includeNull1?: N1, includeNull2?: N2) => RawStages<unknown, Delta<LE>, Both<K1, LE, KK2, RE, N1, N2>>;
11
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { App, Arr, AsLiteral, HKT, ID, O, Rec, rawItem } from '../../../types';
2
+ import { type Field } from '../../field';
3
+ import type { Before, RawStages, TStages, UBefore } from '../../types';
4
+ import { type JoinId } from '../unwind';
5
+ type s = string;
6
+ export declare const $lookupRaw: <LQ extends O, LE extends LQ & ID, RQ extends O, RE extends RQ & ID, BRB extends Before<RQ>, RS extends UBefore<RQ>, S extends rawItem, As extends s, Null extends null = never>({ field1, field2 }: {
7
+ field1: Field<LQ, S | Arr<S>>;
8
+ field2: Field<RQ, S | Arr<S>>;
9
+ }, { coll, exec, input }: TStages<RS, Before<RQ>, BRB, Before<RE>>, k2: AsLiteral<As>, k: JoinId<"left", "right">, includeNull?: Null) => <F extends HKT<O, O>>(f: <T extends O>() => Field<App<F, T>, T>) => RawStages<App<F, LQ>, App<F, LE>, App<F, LE & Rec<As, RE | Null> & ID>>;
10
+ export {};
@@ -0,0 +1,20 @@
1
+ import { type AsLiteral, type O, type RORec, type doc, type notArr, type Arr, type N } from '../../../types';
2
+ import { type Field } from '../../field';
3
+ import type { SnapshotStream, SnapshotStreamExecutionResult } from '../../types/stream';
4
+ type Params<As extends string, LQ extends O, RQ extends O, RE extends RQ, S extends notArr> = {
5
+ from: SnapshotStreamExecutionResult<RQ, RE>;
6
+ as: AsLiteral<As>;
7
+ } & ({
8
+ to: 'one';
9
+ localField: Field<LQ, string | N>;
10
+ foreignField?: never;
11
+ middle?: never;
12
+ } | {
13
+ to: 'many';
14
+ middle: string;
15
+ localField: Field<LQ, S | Arr<S>>;
16
+ foreignField: Field<RQ, S | Arr<S>>;
17
+ });
18
+ export declare const $lookup: <As extends string, LQ extends doc, RQ extends doc, RE extends RQ & doc, S extends notArr>(p: Params<As, LQ, RQ, RE, S>) => <LE extends LQ>(l: SnapshotStream<LQ, LE>) => SnapshotStream<LQ, LE & RORec<As, RE>>;
19
+ export declare const $outerLookup: <As extends string, LQ extends doc, RQ extends doc, RE extends RQ & doc, S extends notArr>(p: Params<As, LQ, RQ, RE, S>) => <LE extends LQ>(l: SnapshotStream<LQ, LE>) => SnapshotStream<LQ, LE & RORec<As, RE | null>>;
20
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { doc } from '../../../types';
2
+ import type { Delta, Expr, RawStages } from '../../types';
3
+ export declare const $matchDelta: <T extends doc>(query: Expr<boolean, T>) => RawStages<unknown, Delta<T>, Delta<T>, unknown, number>;
4
+ export declare const matchDelta: <D>() => RawStages<unknown, Delta<D | null>, Delta<D>>;
@@ -0,0 +1,3 @@
1
+ import type { doc } from '../../../types';
2
+ import type { DeltaStages, Expr } from '../../types';
3
+ export declare const $match: <T extends doc>(query: Expr<boolean, T>) => DeltaStages<T, T, T>;
@@ -0,0 +1,2 @@
1
+ export { $matchDelta, matchDelta } from './$match-delta';
2
+ export { $match } from './$match';