@valkey/valkey-glide-darwin-arm64 1.2.0 → 1.2.1-rc1
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/build-ts/src/BaseClient.d.ts +27 -1
- package/build-ts/src/BaseClient.js +9 -1
- package/build-ts/src/BaseClient.js.map +1 -1
- package/build-ts/src/Commands.d.ts +12 -0
- package/build-ts/src/Commands.js.map +1 -1
- package/build-ts/src/GlideClient.d.ts +17 -1
- package/build-ts/src/GlideClient.js +3 -0
- package/build-ts/src/GlideClient.js.map +1 -1
- package/build-ts/src/GlideClusterClient.d.ts +23 -7
- package/build-ts/src/GlideClusterClient.js +8 -3
- package/build-ts/src/GlideClusterClient.js.map +1 -1
- package/build-ts/src/ProtobufMessage.js +46 -1
- package/build-ts/src/ProtobufMessage.js.map +1 -1
- package/node_modules/glide-rs/glide-rs.darwin-arm64.node +0 -0
- package/node_modules/glide-rs/index.d.ts +2 -1
- package/node_modules/glide-rs/index.js +4 -2
- package/npm/glide/index.ts +4 -3
- package/npm/glide/package.json +0 -1
- package/package.json +2 -2
- package/rust-client/node_modules/mingo/README.md +58 -53
- package/rust-client/node_modules/mingo/dist/cjs/aggregator.js +18 -20
- package/rust-client/node_modules/mingo/dist/cjs/core.js +179 -190
- package/rust-client/node_modules/mingo/dist/cjs/cursor.js +34 -34
- package/rust-client/node_modules/mingo/dist/cjs/index.js +11 -3
- package/rust-client/node_modules/mingo/dist/cjs/init/basic.js +4 -22
- package/rust-client/node_modules/mingo/dist/cjs/init/system.js +6 -6
- package/rust-client/node_modules/mingo/dist/cjs/lazy.js +58 -61
- package/rust-client/node_modules/mingo/dist/cjs/operators/_predicates.js +12 -25
- package/rust-client/node_modules/mingo/dist/cjs/operators/accumulator/_internal.js +2 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/accumulator/accumulator.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/accumulator/first.js +3 -1
- package/rust-client/node_modules/mingo/dist/cjs/operators/accumulator/last.js +4 -1
- package/rust-client/node_modules/mingo/dist/cjs/operators/accumulator/max.js +9 -6
- package/rust-client/node_modules/mingo/dist/cjs/operators/accumulator/mergeObjects.js +5 -1
- package/rust-client/node_modules/mingo/dist/cjs/operators/accumulator/min.js +9 -3
- package/rust-client/node_modules/mingo/dist/cjs/operators/accumulator/push.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/accumulator/sum.js +2 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/add.js +9 -10
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/ceil.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/exp.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/floor.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/ln.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/log.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/log10.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/round.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/sqrt.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/subtract.js +5 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/trunc.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/arrayElemAt.js +2 -3
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/arrayToObject.js +3 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/concatArrays.js +11 -5
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/filter.js +1 -0
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/first.js +8 -8
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/firstN.js +2 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/in.js +1 -1
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/indexOfArray.js +5 -10
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/isArray.js +2 -3
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/last.js +8 -8
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/lastN.js +2 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/map.js +1 -0
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/maxN.js +2 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/minN.js +2 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/reduce.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/reverseArray.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/sortArray.js +2 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/zip.js +4 -10
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/bitwise/_internal.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/bitwise/bitNot.js +2 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/boolean/not.js +3 -5
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/comparison/cmp.js +6 -5
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/conditional/cond.js +1 -1
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/conditional/ifNull.js +1 -1
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/conditional/switch.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/_internal.js +157 -65
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/dateAdd.js +1 -29
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/dateDiff.js +32 -20
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/dateFromParts.js +2 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/dateFromString.js +13 -9
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/dateToString.js +2 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/dateTrunc.js +107 -0
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/dayOfYear.js +1 -1
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/index.js +2 -0
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/isoWeekYear.js +1 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/week.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/misc/getField.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/object/mergeObjects.js +9 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/object/objectToArray.js +5 -1
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/object/setField.js +11 -7
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/set/setDifference.js +9 -1
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/set/setEquals.js +17 -3
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/set/setIntersection.js +2 -1
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/set/setIsSubset.js +15 -1
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/set/setUnion.js +4 -5
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/string/_internal.js +4 -8
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/string/concat.js +5 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/string/indexOfBytes.js +2 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/string/replaceAll.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/string/replaceOne.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/string/split.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/string/strcasecmp.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/string/substr.js +4 -14
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/string/substrBytes.js +2 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/trignometry/atan2.js +2 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/trignometry/cosh.js +0 -1
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/type/_internal.js +20 -10
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/type/convert.js +3 -5
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/type/toBool.js +2 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/type/toDate.js +3 -6
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/type/toDouble.js +5 -10
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/type/toInt.js +1 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/type/toLong.js +1 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/type/toString.js +11 -10
- package/rust-client/node_modules/mingo/dist/cjs/operators/expression/type/type.js +11 -14
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/addFields.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/bucket.js +53 -53
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/bucketAuto.js +670 -65
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/count.js +2 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/densify.js +196 -0
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/graphLookup.js +78 -0
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/group.js +6 -9
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/index.js +4 -0
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/limit.js +1 -3
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/lookup.js +47 -10
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/merge.js +7 -13
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/out.js +1 -1
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/project.js +19 -38
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/redact.js +3 -1
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/replaceWith.js +9 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/sample.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/setWindowFields.js +10 -20
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/skip.js +1 -1
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/sort.js +10 -19
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/sortByCount.js +5 -3
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/unionWith.js +1 -1
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/unset.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/unwind.js +5 -9
- package/rust-client/node_modules/mingo/dist/cjs/operators/projection/elemMatch.js +2 -3
- package/rust-client/node_modules/mingo/dist/cjs/operators/projection/slice.js +2 -3
- package/rust-client/node_modules/mingo/dist/cjs/operators/query/bitwise/_internal.js +4 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/update/_internal.js +8 -14
- package/rust-client/node_modules/mingo/dist/cjs/operators/update/addToSet.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/update/bit.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/update/max.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/update/min.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/update/pop.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/update/pull.js +2 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/update/push.js +3 -9
- package/rust-client/node_modules/mingo/dist/cjs/operators/update/rename.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/update/set.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/update/unset.js +1 -2
- package/rust-client/node_modules/mingo/dist/cjs/operators/window/_internal.js +2 -3
- package/rust-client/node_modules/mingo/dist/cjs/operators/window/denseRank.js +8 -10
- package/rust-client/node_modules/mingo/dist/cjs/operators/window/derivative.js +4 -6
- package/rust-client/node_modules/mingo/dist/cjs/operators/window/documentNumber.js +1 -3
- package/rust-client/node_modules/mingo/dist/cjs/operators/window/expMovingAvg.js +4 -6
- package/rust-client/node_modules/mingo/dist/cjs/operators/window/integral.js +3 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/window/linearFill.js +4 -6
- package/rust-client/node_modules/mingo/dist/cjs/operators/window/locf.js +3 -4
- package/rust-client/node_modules/mingo/dist/cjs/operators/window/rank.js +8 -10
- package/rust-client/node_modules/mingo/dist/cjs/operators/window/shift.js +2 -2
- package/rust-client/node_modules/mingo/dist/cjs/query.js +20 -19
- package/rust-client/node_modules/mingo/dist/cjs/types.js +22 -0
- package/rust-client/node_modules/mingo/dist/cjs/updater.js +6 -5
- package/rust-client/node_modules/mingo/dist/cjs/util.js +265 -388
- package/rust-client/node_modules/mingo/dist/esm/aggregator.js +18 -21
- package/rust-client/node_modules/mingo/dist/esm/core.js +179 -192
- package/rust-client/node_modules/mingo/dist/esm/cursor.js +35 -35
- package/rust-client/node_modules/mingo/dist/esm/index.js +8 -2
- package/rust-client/node_modules/mingo/dist/esm/init/basic.js +5 -12
- package/rust-client/node_modules/mingo/dist/esm/init/system.js +7 -7
- package/rust-client/node_modules/mingo/dist/esm/lazy.js +58 -61
- package/rust-client/node_modules/mingo/dist/esm/operators/_predicates.js +14 -32
- package/rust-client/node_modules/mingo/dist/esm/operators/accumulator/_internal.js +2 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/accumulator/accumulator.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/accumulator/first.js +7 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/accumulator/last.js +8 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/accumulator/max.js +10 -7
- package/rust-client/node_modules/mingo/dist/esm/operators/accumulator/mergeObjects.js +5 -1
- package/rust-client/node_modules/mingo/dist/esm/operators/accumulator/min.js +10 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/accumulator/push.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/accumulator/sum.js +2 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/add.js +9 -10
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/ceil.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/exp.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/floor.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/ln.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/log.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/log10.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/round.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/sqrt.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/subtract.js +5 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/trunc.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/arrayElemAt.js +3 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/arrayToObject.js +3 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/concatArrays.js +12 -6
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/filter.js +2 -1
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/first.js +10 -13
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/firstN.js +2 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/in.js +1 -1
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/indexOfArray.js +5 -10
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/isArray.js +2 -3
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/last.js +10 -13
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/lastN.js +2 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/map.js +2 -1
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/maxN.js +2 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/minN.js +2 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/reduce.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/reverseArray.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/sortArray.js +2 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/zip.js +4 -10
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/bitwise/_internal.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/bitwise/bitNot.js +2 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/boolean/not.js +4 -6
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/comparison/cmp.js +6 -5
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/conditional/cond.js +2 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/conditional/ifNull.js +1 -1
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/conditional/switch.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/_internal.js +140 -61
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/dateAdd.js +2 -35
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/dateDiff.js +43 -21
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/dateFromParts.js +2 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/dateFromString.js +13 -11
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/dateToString.js +2 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/dateTrunc.js +97 -0
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/dayOfYear.js +2 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/index.js +1 -0
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/isoWeekYear.js +2 -5
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/week.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/misc/getField.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/object/mergeObjects.js +10 -3
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/object/objectToArray.js +6 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/object/setField.js +11 -7
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/set/setDifference.js +10 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/set/setEquals.js +18 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/set/setIntersection.js +3 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/set/setIsSubset.js +16 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/set/setUnion.js +5 -6
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/string/_internal.js +4 -8
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/string/concat.js +6 -3
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/string/indexOfBytes.js +2 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/string/replaceAll.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/string/replaceOne.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/string/split.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/string/strcasecmp.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/string/substr.js +4 -14
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/string/substrBytes.js +2 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/trignometry/atan2.js +2 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/trignometry/cosh.js +0 -1
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/type/_internal.js +17 -11
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/type/convert.js +3 -5
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/type/toBool.js +2 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/type/toDate.js +4 -7
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/type/toDouble.js +6 -11
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/type/toInt.js +2 -5
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/type/toLong.js +2 -5
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/type/toString.js +12 -11
- package/rust-client/node_modules/mingo/dist/esm/operators/expression/type/type.js +12 -15
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/addFields.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/bucket.js +54 -61
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/bucketAuto.js +679 -66
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/count.js +3 -3
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/densify.js +183 -0
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/graphLookup.js +55 -0
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/group.js +6 -9
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/index.js +2 -0
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/limit.js +1 -3
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/lookup.js +55 -11
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/merge.js +9 -14
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/out.js +2 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/project.js +21 -42
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/redact.js +3 -1
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/replaceWith.js +9 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/sample.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/setWindowFields.js +12 -23
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/skip.js +1 -1
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/sort.js +11 -20
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/sortByCount.js +5 -3
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/unionWith.js +2 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/unset.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/unwind.js +6 -9
- package/rust-client/node_modules/mingo/dist/esm/operators/projection/elemMatch.js +3 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/projection/slice.js +2 -3
- package/rust-client/node_modules/mingo/dist/esm/operators/query/bitwise/_internal.js +4 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/update/_internal.js +9 -14
- package/rust-client/node_modules/mingo/dist/esm/operators/update/addToSet.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/update/bit.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/update/max.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/update/min.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/update/pop.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/update/pull.js +2 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/update/push.js +3 -9
- package/rust-client/node_modules/mingo/dist/esm/operators/update/rename.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/update/set.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/update/unset.js +1 -2
- package/rust-client/node_modules/mingo/dist/esm/operators/window/_internal.js +2 -3
- package/rust-client/node_modules/mingo/dist/esm/operators/window/denseRank.js +8 -10
- package/rust-client/node_modules/mingo/dist/esm/operators/window/derivative.js +4 -6
- package/rust-client/node_modules/mingo/dist/esm/operators/window/documentNumber.js +1 -3
- package/rust-client/node_modules/mingo/dist/esm/operators/window/expMovingAvg.js +4 -6
- package/rust-client/node_modules/mingo/dist/esm/operators/window/integral.js +3 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/window/linearFill.js +4 -6
- package/rust-client/node_modules/mingo/dist/esm/operators/window/locf.js +3 -4
- package/rust-client/node_modules/mingo/dist/esm/operators/window/rank.js +8 -10
- package/rust-client/node_modules/mingo/dist/esm/operators/window/shift.js +2 -2
- package/rust-client/node_modules/mingo/dist/esm/query.js +22 -32
- package/rust-client/node_modules/mingo/dist/esm/types.js +14 -0
- package/rust-client/node_modules/mingo/dist/esm/updater.js +5 -5
- package/rust-client/node_modules/mingo/dist/esm/util.js +263 -377
- package/rust-client/node_modules/mingo/dist/types/aggregator.d.ts +7 -9
- package/rust-client/node_modules/mingo/dist/types/core.d.ts +41 -52
- package/rust-client/node_modules/mingo/dist/types/cursor.d.ts +6 -12
- package/rust-client/node_modules/mingo/dist/types/index.d.ts +8 -4
- package/rust-client/node_modules/mingo/dist/types/init/basic.d.ts +1 -6
- package/rust-client/node_modules/mingo/dist/types/lazy.d.ts +19 -15
- package/rust-client/node_modules/mingo/dist/types/operators/_predicates.d.ts +20 -20
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/accumulator.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/addToSet.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/avg.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/bottom.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/bottomN.d.ts +4 -4
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/count.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/covariancePop.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/covarianceSamp.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/first.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/firstN.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/last.d.ts +4 -4
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/lastN.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/max.d.ts +4 -5
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/maxN.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/mergeObjects.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/min.d.ts +4 -5
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/minN.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/percentile.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/push.d.ts +4 -4
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/stdDevPop.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/stdDevSamp.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/sum.d.ts +5 -3
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/top.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/accumulator/topN.d.ts +4 -4
- package/rust-client/node_modules/mingo/dist/types/operators/expression/arithmetic/add.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/arithmetic/multiply.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/arithmetic/pow.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/arithmetic/subtract.d.ts +1 -0
- package/rust-client/node_modules/mingo/dist/types/operators/expression/array/arrayElemAt.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/array/concatArrays.d.ts +3 -3
- package/rust-client/node_modules/mingo/dist/types/operators/expression/array/filter.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/array/first.d.ts +0 -4
- package/rust-client/node_modules/mingo/dist/types/operators/expression/array/firstN.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/array/in.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/expression/array/indexOfArray.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/array/isArray.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/array/last.d.ts +0 -4
- package/rust-client/node_modules/mingo/dist/types/operators/expression/array/lastN.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/array/map.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/array/maxN.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/array/minN.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/array/range.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/array/reduce.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/expression/array/reverseArray.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/array/slice.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/date/_internal.d.ts +31 -9
- package/rust-client/node_modules/mingo/dist/types/operators/expression/date/dateFromString.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/expression/date/dateToParts.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/expression/date/dateTrunc.d.ts +12 -0
- package/rust-client/node_modules/mingo/dist/types/operators/expression/date/index.d.ts +1 -0
- package/rust-client/node_modules/mingo/dist/types/operators/expression/misc/rand.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/expression/object/mergeObjects.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/expression/percentile.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/set/setIsSubset.d.ts +3 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/string/_internal.d.ts +4 -4
- package/rust-client/node_modules/mingo/dist/types/operators/expression/string/indexOfBytes.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/string/replaceAll.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/string/replaceOne.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/string/split.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/string/strLenBytes.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/string/strLenCP.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/expression/string/substrBytes.d.ts +2 -0
- package/rust-client/node_modules/mingo/dist/types/operators/expression/type/_internal.d.ts +6 -2
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/_internal.d.ts +4 -4
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/addFields.d.ts +8 -5
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/bucket.d.ts +8 -5
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/bucketAuto.d.ts +8 -7
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/count.d.ts +7 -5
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/densify.d.ts +12 -0
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/facet.d.ts +7 -1
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/fill.d.ts +6 -3
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/graphLookup.d.ts +13 -0
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/group.d.ts +4 -2
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/index.d.ts +2 -0
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/limit.d.ts +3 -1
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/lookup.d.ts +4 -2
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/match.d.ts +4 -3
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/merge.d.ts +3 -5
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/out.d.ts +5 -3
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/project.d.ts +4 -3
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/redact.d.ts +1 -1
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/replaceRoot.d.ts +5 -5
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/replaceWith.d.ts +8 -1
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/sample.d.ts +7 -5
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/setWindowFields.d.ts +7 -5
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/skip.d.ts +6 -4
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/sort.d.ts +5 -3
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/sortByCount.d.ts +5 -5
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/unionWith.d.ts +3 -1
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/unset.d.ts +2 -0
- package/rust-client/node_modules/mingo/dist/types/operators/pipeline/unwind.d.ts +5 -2
- package/rust-client/node_modules/mingo/dist/types/operators/query/evaluation/expr.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/query/evaluation/jsonSchema.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/query/evaluation/where.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/update/_internal.d.ts +5 -5
- package/rust-client/node_modules/mingo/dist/types/operators/update/addToSet.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/update/bit.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/update/currentDate.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/update/inc.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/update/max.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/update/min.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/update/mul.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/update/pop.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/update/pull.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/update/pullAll.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/update/push.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/update/rename.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/update/set.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/update/unset.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/window/_internal.d.ts +5 -5
- package/rust-client/node_modules/mingo/dist/types/operators/window/denseRank.d.ts +2 -3
- package/rust-client/node_modules/mingo/dist/types/operators/window/derivative.d.ts +2 -3
- package/rust-client/node_modules/mingo/dist/types/operators/window/documentNumber.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/window/expMovingAvg.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/window/integral.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/window/linearFill.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/window/locf.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/window/rank.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/operators/window/shift.d.ts +2 -2
- package/rust-client/node_modules/mingo/dist/types/query.d.ts +5 -7
- package/rust-client/node_modules/mingo/dist/types/types.d.ts +18 -15
- package/rust-client/node_modules/mingo/dist/types/updater.d.ts +9 -10
- package/rust-client/node_modules/mingo/dist/types/util.d.ts +102 -90
- package/rust-client/node_modules/mingo/package.json +1 -1
|
@@ -22,9 +22,9 @@ __export(count_exports, {
|
|
|
22
22
|
module.exports = __toCommonJS(count_exports);
|
|
23
23
|
var import_lazy = require("../../lazy");
|
|
24
24
|
var import_util = require("../../util");
|
|
25
|
-
const $count = (collection, expr,
|
|
25
|
+
const $count = (collection, expr, _options) => {
|
|
26
26
|
(0, import_util.assert)(
|
|
27
|
-
(0, import_util.isString)(expr) &&
|
|
27
|
+
(0, import_util.isString)(expr) && !(0, import_util.isEmpty)(expr) && expr.indexOf(".") === -1 && expr.trim()[0] !== "$",
|
|
28
28
|
"Invalid expression value for $count"
|
|
29
29
|
);
|
|
30
30
|
return (0, import_lazy.Lazy)([
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var densify_exports = {};
|
|
19
|
+
__export(densify_exports, {
|
|
20
|
+
$densify: () => $densify
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(densify_exports);
|
|
23
|
+
var import_core = require("../../core");
|
|
24
|
+
var import_lazy = require("../../lazy");
|
|
25
|
+
var import_types = require("../../types");
|
|
26
|
+
var import_util = require("../../util");
|
|
27
|
+
var import_dateAdd = require("../expression/date/dateAdd");
|
|
28
|
+
var import_sort = require("./sort");
|
|
29
|
+
const EMPTY_OBJECT = Object.freeze({});
|
|
30
|
+
const $densify = (collection, expr, options) => {
|
|
31
|
+
const { step, bounds, unit } = expr.range;
|
|
32
|
+
if (unit) {
|
|
33
|
+
(0, import_util.assert)(import_types.TIME_UNITS.includes(unit), "");
|
|
34
|
+
(0, import_util.assert)(
|
|
35
|
+
Number.isInteger(step) && step > 0,
|
|
36
|
+
"The step parameter in a range statement must be a whole number when densifying a date range."
|
|
37
|
+
);
|
|
38
|
+
} else {
|
|
39
|
+
(0, import_util.assert)(
|
|
40
|
+
(0, import_util.isNumber)(step) && step > 0,
|
|
41
|
+
"The step parameter in a range statement must be a strictly positive numeric value."
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
if ((0, import_util.isArray)(bounds)) {
|
|
45
|
+
(0, import_util.assert)(
|
|
46
|
+
!!bounds && bounds.length === 2,
|
|
47
|
+
"A bounding array in a range statement must have exactly two elements."
|
|
48
|
+
);
|
|
49
|
+
(0, import_util.assert)(
|
|
50
|
+
(bounds.every(import_util.isNumber) || bounds.every(import_util.isDate)) && bounds[0] < bounds[1],
|
|
51
|
+
"A bounding array must be an ascending array of either two dates or two numbers."
|
|
52
|
+
);
|
|
53
|
+
(0, import_util.assert)(
|
|
54
|
+
unit && !bounds.some(import_util.isNumber),
|
|
55
|
+
"Numeric bounds may not have unit parameter."
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
if (expr.partitionByFields) {
|
|
59
|
+
(0, import_util.assert)(
|
|
60
|
+
(0, import_util.isArray)(expr.partitionByFields),
|
|
61
|
+
"$densify: `partitionByFields` must be an array of strings"
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
collection = (0, import_sort.$sort)(collection, { [expr.field]: 1 }, options);
|
|
65
|
+
const nilOptions = import_core.ComputeOptions.init(options, null);
|
|
66
|
+
const computeNextValue = (value) => {
|
|
67
|
+
return (0, import_util.isNumber)(value) ? value + step : (0, import_dateAdd.$dateAdd)(
|
|
68
|
+
EMPTY_OBJECT,
|
|
69
|
+
{ startDate: value, unit, amount: step },
|
|
70
|
+
nilOptions
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
const isValidUnit = !!unit && import_types.TIME_UNITS.includes(unit);
|
|
74
|
+
const getFieldValue = (o) => {
|
|
75
|
+
const v = (0, import_util.resolve)(o, expr.field);
|
|
76
|
+
if ((0, import_util.isNil)(v)) return v;
|
|
77
|
+
if ((0, import_util.isNumber)(v)) {
|
|
78
|
+
(0, import_util.assert)(
|
|
79
|
+
!isValidUnit,
|
|
80
|
+
"$densify: Encountered non-date value in collection when step has a date unit."
|
|
81
|
+
);
|
|
82
|
+
} else if ((0, import_util.isDate)(v)) {
|
|
83
|
+
(0, import_util.assert)(
|
|
84
|
+
isValidUnit,
|
|
85
|
+
"$densify: Encountered date value in collection when step does not have a date unit."
|
|
86
|
+
);
|
|
87
|
+
} else {
|
|
88
|
+
(0, import_util.assert)(false, "$densify: Densify field type must be numeric or a date");
|
|
89
|
+
}
|
|
90
|
+
return v;
|
|
91
|
+
};
|
|
92
|
+
const peekItem = new Array();
|
|
93
|
+
const nilFieldsIterator = (0, import_lazy.Lazy)(() => {
|
|
94
|
+
const item = collection.next();
|
|
95
|
+
const fieldValue = getFieldValue(item.value);
|
|
96
|
+
if ((0, import_util.isNil)(fieldValue)) return item;
|
|
97
|
+
peekItem.push(item);
|
|
98
|
+
return { done: true };
|
|
99
|
+
});
|
|
100
|
+
const nextDensifyValueMap = import_util.ValueMap.init(
|
|
101
|
+
options.hashFunction
|
|
102
|
+
);
|
|
103
|
+
const [lower, upper] = (0, import_util.isArray)(bounds) ? bounds : [bounds, bounds];
|
|
104
|
+
let maxFieldValue = void 0;
|
|
105
|
+
const updateMaxFieldValue = (value) => {
|
|
106
|
+
maxFieldValue = maxFieldValue === void 0 || maxFieldValue < value ? value : maxFieldValue;
|
|
107
|
+
};
|
|
108
|
+
const rootKey = [];
|
|
109
|
+
const densifyIterator = (0, import_lazy.Lazy)(() => {
|
|
110
|
+
const item = peekItem.length > 0 ? peekItem.pop() : collection.next();
|
|
111
|
+
if (item.done) return item;
|
|
112
|
+
let partitionKey = rootKey;
|
|
113
|
+
if ((0, import_util.isArray)(expr.partitionByFields)) {
|
|
114
|
+
partitionKey = expr.partitionByFields.map(
|
|
115
|
+
(k) => (0, import_util.resolve)(item.value, k)
|
|
116
|
+
);
|
|
117
|
+
(0, import_util.assert)(
|
|
118
|
+
partitionKey.every(import_util.isString),
|
|
119
|
+
"$densify: Partition fields must evaluate to string values."
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
(0, import_util.assert)((0, import_util.isObject)(item.value), "$densify: collection must contain documents");
|
|
123
|
+
const itemValue = getFieldValue(item.value);
|
|
124
|
+
if (!nextDensifyValueMap.has(partitionKey)) {
|
|
125
|
+
if (lower == "full") {
|
|
126
|
+
if (!nextDensifyValueMap.has(rootKey)) {
|
|
127
|
+
nextDensifyValueMap.set(rootKey, itemValue);
|
|
128
|
+
}
|
|
129
|
+
nextDensifyValueMap.set(partitionKey, nextDensifyValueMap.get(rootKey));
|
|
130
|
+
} else if (lower == "partition") {
|
|
131
|
+
nextDensifyValueMap.set(partitionKey, itemValue);
|
|
132
|
+
} else {
|
|
133
|
+
nextDensifyValueMap.set(partitionKey, lower);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const densifyValue = nextDensifyValueMap.get(partitionKey);
|
|
137
|
+
if (
|
|
138
|
+
// current item field value is lower than current densify value.
|
|
139
|
+
itemValue <= densifyValue || // range value equals or exceeds upper bound
|
|
140
|
+
upper != "full" && upper != "partition" && densifyValue >= upper
|
|
141
|
+
) {
|
|
142
|
+
if (densifyValue <= itemValue) {
|
|
143
|
+
nextDensifyValueMap.set(partitionKey, computeNextValue(densifyValue));
|
|
144
|
+
}
|
|
145
|
+
updateMaxFieldValue(itemValue);
|
|
146
|
+
return item;
|
|
147
|
+
}
|
|
148
|
+
nextDensifyValueMap.set(partitionKey, computeNextValue(densifyValue));
|
|
149
|
+
updateMaxFieldValue(densifyValue);
|
|
150
|
+
const denseObj = { [expr.field]: densifyValue };
|
|
151
|
+
if (partitionKey) {
|
|
152
|
+
partitionKey.forEach((v, i) => {
|
|
153
|
+
denseObj[expr.partitionByFields[i]] = v;
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
peekItem.push(item);
|
|
157
|
+
return { done: false, value: denseObj };
|
|
158
|
+
});
|
|
159
|
+
if (lower !== "full") return (0, import_lazy.concat)(nilFieldsIterator, densifyIterator);
|
|
160
|
+
let paritionIndex = -1;
|
|
161
|
+
let partitionKeysSet = void 0;
|
|
162
|
+
const fullBoundsIterator = (0, import_lazy.Lazy)(() => {
|
|
163
|
+
if (paritionIndex === -1) {
|
|
164
|
+
const fullDensifyValue = nextDensifyValueMap.get(rootKey);
|
|
165
|
+
nextDensifyValueMap.delete(rootKey);
|
|
166
|
+
partitionKeysSet = Array.from(nextDensifyValueMap.keys());
|
|
167
|
+
if (partitionKeysSet.length === 0) {
|
|
168
|
+
partitionKeysSet.push(rootKey);
|
|
169
|
+
nextDensifyValueMap.set(rootKey, fullDensifyValue);
|
|
170
|
+
}
|
|
171
|
+
paritionIndex++;
|
|
172
|
+
}
|
|
173
|
+
do {
|
|
174
|
+
const partitionKey = partitionKeysSet[paritionIndex];
|
|
175
|
+
const partitionMaxValue = nextDensifyValueMap.get(partitionKey);
|
|
176
|
+
if (partitionMaxValue < maxFieldValue) {
|
|
177
|
+
nextDensifyValueMap.set(
|
|
178
|
+
partitionKey,
|
|
179
|
+
computeNextValue(partitionMaxValue)
|
|
180
|
+
);
|
|
181
|
+
const denseObj = { [expr.field]: partitionMaxValue };
|
|
182
|
+
partitionKey.forEach((v, i) => {
|
|
183
|
+
denseObj[expr.partitionByFields[i]] = v;
|
|
184
|
+
});
|
|
185
|
+
return { done: false, value: denseObj };
|
|
186
|
+
}
|
|
187
|
+
paritionIndex++;
|
|
188
|
+
} while (paritionIndex < partitionKeysSet.length);
|
|
189
|
+
return { done: true };
|
|
190
|
+
});
|
|
191
|
+
return (0, import_lazy.concat)(nilFieldsIterator, densifyIterator, fullBoundsIterator);
|
|
192
|
+
};
|
|
193
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
194
|
+
0 && (module.exports = {
|
|
195
|
+
$densify
|
|
196
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var graphLookup_exports = {};
|
|
19
|
+
__export(graphLookup_exports, {
|
|
20
|
+
$graphLookup: () => $graphLookup
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(graphLookup_exports);
|
|
23
|
+
var import_core = require("../../core");
|
|
24
|
+
var import_lazy = require("../../lazy");
|
|
25
|
+
var import_util = require("../../util");
|
|
26
|
+
var import_lookup = require("./lookup");
|
|
27
|
+
const $graphLookup = (collection, expr, options) => {
|
|
28
|
+
const fromColl = (0, import_util.isString)(expr.from) ? options?.collectionResolver(expr.from) : expr.from;
|
|
29
|
+
const {
|
|
30
|
+
connectFromField,
|
|
31
|
+
connectToField,
|
|
32
|
+
as: asField,
|
|
33
|
+
maxDepth,
|
|
34
|
+
depthField,
|
|
35
|
+
restrictSearchWithMatch: matchExpr
|
|
36
|
+
} = expr;
|
|
37
|
+
const pipelineExpr = matchExpr ? { pipeline: [{ $match: matchExpr }] } : {};
|
|
38
|
+
return collection.map((obj) => {
|
|
39
|
+
const matchObj = {};
|
|
40
|
+
(0, import_util.setValue)(
|
|
41
|
+
matchObj,
|
|
42
|
+
connectFromField,
|
|
43
|
+
(0, import_core.computeValue)(obj, expr.startWith, null, options)
|
|
44
|
+
);
|
|
45
|
+
let matches = [matchObj];
|
|
46
|
+
let i = -1;
|
|
47
|
+
const map = import_util.ValueMap.init(options.hashFunction);
|
|
48
|
+
do {
|
|
49
|
+
i++;
|
|
50
|
+
matches = (0, import_util.flatten)(
|
|
51
|
+
(0, import_lookup.$lookup)(
|
|
52
|
+
(0, import_lazy.Lazy)(matches),
|
|
53
|
+
{
|
|
54
|
+
from: fromColl,
|
|
55
|
+
localField: connectFromField,
|
|
56
|
+
foreignField: connectToField,
|
|
57
|
+
as: asField,
|
|
58
|
+
...pipelineExpr
|
|
59
|
+
},
|
|
60
|
+
options
|
|
61
|
+
).map((o) => o[asField]).value()
|
|
62
|
+
);
|
|
63
|
+
const oldSize = map.size;
|
|
64
|
+
matches.forEach((k) => map.set(k, map.get(k) ?? i));
|
|
65
|
+
if (oldSize == map.size) break;
|
|
66
|
+
} while ((0, import_util.isNil)(maxDepth) || i < maxDepth);
|
|
67
|
+
const result = new Array(map.size);
|
|
68
|
+
let n = 0;
|
|
69
|
+
map.forEach((v, k) => {
|
|
70
|
+
result[n++] = Object.assign(depthField ? { [depthField]: v } : {}, k);
|
|
71
|
+
});
|
|
72
|
+
return { ...obj, [asField]: result };
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
76
|
+
0 && (module.exports = {
|
|
77
|
+
$graphLookup
|
|
78
|
+
});
|
|
@@ -24,33 +24,30 @@ var import_core = require("../../core");
|
|
|
24
24
|
var import_util = require("../../util");
|
|
25
25
|
const ID_KEY = "_id";
|
|
26
26
|
const $group = (collection, expr, options) => {
|
|
27
|
-
(0, import_util.assert)((0, import_util.has)(expr, ID_KEY), "
|
|
27
|
+
(0, import_util.assert)((0, import_util.has)(expr, ID_KEY), "$group specification must include an '_id'");
|
|
28
28
|
const idExpr = expr[ID_KEY];
|
|
29
29
|
const copts = import_core.ComputeOptions.init(options);
|
|
30
|
+
const newFields = Object.keys(expr).filter((k) => k != ID_KEY);
|
|
30
31
|
return collection.transform((coll) => {
|
|
31
32
|
const partitions = (0, import_util.groupBy)(
|
|
32
33
|
coll,
|
|
33
34
|
(obj) => (0, import_core.computeValue)(obj, idExpr, null, options),
|
|
34
35
|
options.hashFunction
|
|
35
36
|
);
|
|
36
|
-
expr = { ...expr };
|
|
37
|
-
delete expr[ID_KEY];
|
|
38
37
|
let i = -1;
|
|
39
38
|
const partitionKeys = Array.from(partitions.keys());
|
|
40
|
-
const size = partitions.size;
|
|
41
39
|
return () => {
|
|
42
|
-
if (++i === size)
|
|
43
|
-
return { done: true };
|
|
40
|
+
if (++i === partitions.size) return { done: true };
|
|
44
41
|
const groupId = partitionKeys[i];
|
|
45
42
|
const obj = {};
|
|
46
43
|
if (groupId !== void 0) {
|
|
47
44
|
obj[ID_KEY] = groupId;
|
|
48
45
|
}
|
|
49
|
-
for (const
|
|
46
|
+
for (const key of newFields) {
|
|
50
47
|
obj[key] = (0, import_core.computeValue)(
|
|
51
48
|
partitions.get(groupId),
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
expr[key],
|
|
50
|
+
null,
|
|
54
51
|
copts.update(null, { groupId })
|
|
55
52
|
);
|
|
56
53
|
}
|
|
@@ -18,8 +18,10 @@ __reExport(pipeline_exports, require("./addFields"), module.exports);
|
|
|
18
18
|
__reExport(pipeline_exports, require("./bucket"), module.exports);
|
|
19
19
|
__reExport(pipeline_exports, require("./bucketAuto"), module.exports);
|
|
20
20
|
__reExport(pipeline_exports, require("./count"), module.exports);
|
|
21
|
+
__reExport(pipeline_exports, require("./densify"), module.exports);
|
|
21
22
|
__reExport(pipeline_exports, require("./facet"), module.exports);
|
|
22
23
|
__reExport(pipeline_exports, require("./fill"), module.exports);
|
|
24
|
+
__reExport(pipeline_exports, require("./graphLookup"), module.exports);
|
|
23
25
|
__reExport(pipeline_exports, require("./group"), module.exports);
|
|
24
26
|
__reExport(pipeline_exports, require("./limit"), module.exports);
|
|
25
27
|
__reExport(pipeline_exports, require("./lookup"), module.exports);
|
|
@@ -45,8 +47,10 @@ __reExport(pipeline_exports, require("./unwind"), module.exports);
|
|
|
45
47
|
...require("./bucket"),
|
|
46
48
|
...require("./bucketAuto"),
|
|
47
49
|
...require("./count"),
|
|
50
|
+
...require("./densify"),
|
|
48
51
|
...require("./facet"),
|
|
49
52
|
...require("./fill"),
|
|
53
|
+
...require("./graphLookup"),
|
|
50
54
|
...require("./group"),
|
|
51
55
|
...require("./limit"),
|
|
52
56
|
...require("./lookup"),
|
|
@@ -20,9 +20,7 @@ __export(limit_exports, {
|
|
|
20
20
|
$limit: () => $limit
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(limit_exports);
|
|
23
|
-
const $limit = (collection, expr,
|
|
24
|
-
return collection.take(expr);
|
|
25
|
-
};
|
|
23
|
+
const $limit = (collection, expr, _options) => collection.take(expr);
|
|
26
24
|
// Annotate the CommonJS export names for ESM import in node:
|
|
27
25
|
0 && (module.exports = {
|
|
28
26
|
$limit
|
|
@@ -20,21 +20,58 @@ __export(lookup_exports, {
|
|
|
20
20
|
$lookup: () => $lookup
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(lookup_exports);
|
|
23
|
+
var import_aggregator = require("../../aggregator");
|
|
24
|
+
var import_core = require("../../core");
|
|
23
25
|
var import_util = require("../../util");
|
|
24
26
|
const $lookup = (collection, expr, options) => {
|
|
25
27
|
const joinColl = (0, import_util.isString)(expr.from) ? options?.collectionResolver(expr.from) : expr.from;
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
const { let: letExpr, pipeline, foreignField, localField } = expr;
|
|
29
|
+
const subQueryPipeline = pipeline || [];
|
|
30
|
+
let lookupEq = (_) => [true, []];
|
|
31
|
+
if (foreignField && localField) {
|
|
32
|
+
const map = import_util.ValueMap.init(options.hashFunction);
|
|
33
|
+
for (const doc of joinColl) {
|
|
34
|
+
(0, import_util.ensureArray)((0, import_util.resolve)(doc, foreignField) ?? null).forEach((v) => {
|
|
35
|
+
const xs = map.get(v);
|
|
36
|
+
const arr = xs ?? [];
|
|
37
|
+
arr.push(doc);
|
|
38
|
+
if (arr !== xs) map.set(v, arr);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
lookupEq = (o) => {
|
|
42
|
+
const local = (0, import_util.resolve)(o, localField) ?? null;
|
|
43
|
+
if ((0, import_util.isArray)(local)) {
|
|
44
|
+
if (subQueryPipeline.length) {
|
|
45
|
+
return [local.some((v) => map.has(v)), null];
|
|
46
|
+
}
|
|
47
|
+
const result2 = Array.from(
|
|
48
|
+
new Set((0, import_util.flatten)(local.map((v) => map.get(v), options.hashFunction)))
|
|
49
|
+
);
|
|
50
|
+
return [result2.length > 0, result2];
|
|
51
|
+
}
|
|
52
|
+
const result = map.get(local) ?? null;
|
|
53
|
+
return [result !== null, result ?? []];
|
|
54
|
+
};
|
|
55
|
+
if (subQueryPipeline.length === 0) {
|
|
56
|
+
return collection.map((obj) => {
|
|
57
|
+
return {
|
|
58
|
+
...obj,
|
|
59
|
+
[expr.as]: lookupEq(obj).pop()
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
}
|
|
32
63
|
}
|
|
64
|
+
const agg = new import_aggregator.Aggregator(subQueryPipeline, options);
|
|
33
65
|
return collection.map((obj) => {
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
66
|
+
const variables = (0, import_core.computeValue)(obj, letExpr, null, options);
|
|
67
|
+
const opts = Object.assign({}, options, {
|
|
68
|
+
variables: { ...options.variables, ...variables }
|
|
69
|
+
});
|
|
70
|
+
const [ok, res] = lookupEq(obj);
|
|
71
|
+
return {
|
|
72
|
+
...obj,
|
|
73
|
+
[expr.as]: ok ? agg.run(joinColl, opts) : res
|
|
74
|
+
};
|
|
38
75
|
});
|
|
39
76
|
};
|
|
40
77
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -26,30 +26,24 @@ var import_util = require("../../util");
|
|
|
26
26
|
var import_expression = require("../expression");
|
|
27
27
|
const $merge = (collection, expr, options) => {
|
|
28
28
|
const output = (0, import_util.isString)(expr.into) ? options?.collectionResolver(expr.into) : expr.into;
|
|
29
|
-
(0, import_util.assert)(
|
|
30
|
-
output instanceof Array,
|
|
31
|
-
`$merge: option 'into' must resolve to an array`
|
|
32
|
-
);
|
|
29
|
+
(0, import_util.assert)((0, import_util.isArray)(output), `$merge: option 'into' must resolve to an array`);
|
|
33
30
|
const onField = expr.on || options.idKey;
|
|
34
|
-
const getHash = (o) =>
|
|
35
|
-
|
|
36
|
-
return (0, import_util.hashCode)(val, options.hashFunction);
|
|
37
|
-
};
|
|
38
|
-
const hash = {};
|
|
31
|
+
const getHash = (0, import_util.isString)(onField) ? (o) => (0, import_util.hashCode)((0, import_util.resolve)(o, onField), options.hashFunction) : (o) => (0, import_util.hashCode)(onField.map((s) => (0, import_util.resolve)(o, s), options.hashFunction));
|
|
32
|
+
const map = import_util.ValueMap.init();
|
|
39
33
|
for (let i = 0; i < output.length; i++) {
|
|
40
34
|
const obj = output[i];
|
|
41
35
|
const k = getHash(obj);
|
|
42
36
|
(0, import_util.assert)(
|
|
43
|
-
!
|
|
37
|
+
!map.has(k),
|
|
44
38
|
"$merge: 'into' collection must have unique entries for the 'on' field."
|
|
45
39
|
);
|
|
46
|
-
|
|
40
|
+
map.set(k, [obj, i]);
|
|
47
41
|
}
|
|
48
42
|
const copts = import_core.ComputeOptions.init(options);
|
|
49
43
|
return collection.map((o) => {
|
|
50
44
|
const k = getHash(o);
|
|
51
|
-
if (
|
|
52
|
-
const [target, i] =
|
|
45
|
+
if (map.has(k)) {
|
|
46
|
+
const [target, i] = map.get(k);
|
|
53
47
|
const variables = (0, import_core.computeValue)(
|
|
54
48
|
target,
|
|
55
49
|
expr.let || { new: "$$ROOT" },
|
|
@@ -23,7 +23,7 @@ module.exports = __toCommonJS(out_exports);
|
|
|
23
23
|
var import_util = require("../../util");
|
|
24
24
|
const $out = (collection, expr, options) => {
|
|
25
25
|
const outputColl = (0, import_util.isString)(expr) ? options?.collectionResolver(expr) : expr;
|
|
26
|
-
(0, import_util.assert)(outputColl
|
|
26
|
+
(0, import_util.assert)((0, import_util.isArray)(outputColl), `expression must resolve to an array`);
|
|
27
27
|
return collection.map((o) => {
|
|
28
28
|
outputColl.push((0, import_util.cloneDeep)(o));
|
|
29
29
|
return o;
|
|
@@ -22,37 +22,23 @@ __export(project_exports, {
|
|
|
22
22
|
module.exports = __toCommonJS(project_exports);
|
|
23
23
|
var import_core = require("../../core");
|
|
24
24
|
var import_util = require("../../util");
|
|
25
|
+
const DESCRIPTORS = new Set(Array.from([0, 1, false, true]));
|
|
25
26
|
const $project = (collection, expr, options) => {
|
|
26
|
-
if ((0, import_util.isEmpty)(expr))
|
|
27
|
-
|
|
28
|
-
let expressionKeys = Object.keys(expr);
|
|
29
|
-
let idOnlyExcluded = false;
|
|
27
|
+
if ((0, import_util.isEmpty)(expr)) return collection;
|
|
28
|
+
const expressionKeys = Object.keys(expr);
|
|
30
29
|
validateExpression(expr, options);
|
|
31
30
|
const ID_KEY = options.idKey;
|
|
32
|
-
if (
|
|
33
|
-
const id = expr[ID_KEY];
|
|
34
|
-
if (id === 0 || id === false) {
|
|
35
|
-
expressionKeys = expressionKeys.filter(
|
|
36
|
-
import_util.notInArray.bind(null, [ID_KEY])
|
|
37
|
-
);
|
|
38
|
-
idOnlyExcluded = expressionKeys.length == 0;
|
|
39
|
-
}
|
|
40
|
-
} else {
|
|
31
|
+
if (!expressionKeys.includes(ID_KEY)) {
|
|
41
32
|
expressionKeys.push(ID_KEY);
|
|
42
33
|
}
|
|
43
34
|
const copts = import_core.ComputeOptions.init(options);
|
|
44
|
-
return collection.map((obj) => processObject(
|
|
45
|
-
obj,
|
|
46
|
-
expr,
|
|
47
|
-
copts.update(obj),
|
|
48
|
-
expressionKeys,
|
|
49
|
-
idOnlyExcluded
|
|
50
|
-
));
|
|
35
|
+
return collection.map((obj) => processObject(obj, expr, copts.update(obj), expressionKeys));
|
|
51
36
|
};
|
|
52
|
-
function processObject(obj, expr, options, expressionKeys
|
|
37
|
+
function processObject(obj, expr, options, expressionKeys) {
|
|
53
38
|
let newObj = {};
|
|
54
39
|
let foundSlice = false;
|
|
55
40
|
let foundExclusion = false;
|
|
41
|
+
const idOnlyExcluded = expr[options.idKey] === 0 && expressionKeys.length === 1;
|
|
56
42
|
const dropKeys = [];
|
|
57
43
|
if (idOnlyExcluded) {
|
|
58
44
|
dropKeys.push(options.idKey);
|
|
@@ -60,19 +46,18 @@ function processObject(obj, expr, options, expressionKeys, idOnlyExcluded) {
|
|
|
60
46
|
for (const key of expressionKeys) {
|
|
61
47
|
let value = void 0;
|
|
62
48
|
const subExpr = expr[key];
|
|
63
|
-
if (key !== options.idKey && (
|
|
49
|
+
if (key !== options.idKey && (subExpr === 0 || subExpr === false)) {
|
|
64
50
|
foundExclusion = true;
|
|
65
51
|
}
|
|
66
52
|
if (key === options.idKey && (0, import_util.isEmpty)(subExpr)) {
|
|
67
53
|
value = obj[key];
|
|
68
54
|
} else if ((0, import_util.isString)(subExpr)) {
|
|
69
55
|
value = (0, import_core.computeValue)(obj, subExpr, key, options);
|
|
70
|
-
} else if (
|
|
71
|
-
} else if (
|
|
56
|
+
} else if (subExpr === 1 || subExpr === true) {
|
|
57
|
+
} else if ((0, import_util.isArray)(subExpr)) {
|
|
72
58
|
value = subExpr.map((v) => {
|
|
73
59
|
const r = (0, import_core.computeValue)(obj, v, null, options);
|
|
74
|
-
if ((0, import_util.isNil)(r))
|
|
75
|
-
return null;
|
|
60
|
+
if ((0, import_util.isNil)(r)) return null;
|
|
76
61
|
return r;
|
|
77
62
|
});
|
|
78
63
|
} else if ((0, import_util.isObject)(subExpr)) {
|
|
@@ -80,7 +65,7 @@ function processObject(obj, expr, options, expressionKeys, idOnlyExcluded) {
|
|
|
80
65
|
const subExprKeys = Object.keys(subExpr);
|
|
81
66
|
const operator = subExprKeys.length == 1 ? subExprKeys[0] : "";
|
|
82
67
|
const call = (0, import_core.getOperator)(
|
|
83
|
-
|
|
68
|
+
"projection",
|
|
84
69
|
operator,
|
|
85
70
|
options
|
|
86
71
|
);
|
|
@@ -100,9 +85,9 @@ function processObject(obj, expr, options, expressionKeys, idOnlyExcluded) {
|
|
|
100
85
|
} else if ((0, import_util.has)(obj, key)) {
|
|
101
86
|
validateExpression(subExprObj, options);
|
|
102
87
|
let target = obj[key];
|
|
103
|
-
if (
|
|
88
|
+
if ((0, import_util.isArray)(target)) {
|
|
104
89
|
value = target.map(
|
|
105
|
-
(o) => processObject(o, subExprObj, options, subExprKeys
|
|
90
|
+
(o) => processObject(o, subExprObj, options, subExprKeys)
|
|
106
91
|
);
|
|
107
92
|
} else {
|
|
108
93
|
target = (0, import_util.isObject)(target) ? target : obj;
|
|
@@ -110,8 +95,7 @@ function processObject(obj, expr, options, expressionKeys, idOnlyExcluded) {
|
|
|
110
95
|
target,
|
|
111
96
|
subExprObj,
|
|
112
97
|
options,
|
|
113
|
-
subExprKeys
|
|
114
|
-
false
|
|
98
|
+
subExprKeys
|
|
115
99
|
);
|
|
116
100
|
}
|
|
117
101
|
} else {
|
|
@@ -124,12 +108,10 @@ function processObject(obj, expr, options, expressionKeys, idOnlyExcluded) {
|
|
|
124
108
|
const objPathGraph = (0, import_util.resolveGraph)(obj, key, {
|
|
125
109
|
preserveMissing: true
|
|
126
110
|
});
|
|
127
|
-
if (
|
|
128
|
-
(0, import_util.merge)(newObj, objPathGraph
|
|
129
|
-
flatten: true
|
|
130
|
-
});
|
|
111
|
+
if ((0, import_util.isObject)(objPathGraph)) {
|
|
112
|
+
(0, import_util.merge)(newObj, objPathGraph);
|
|
131
113
|
}
|
|
132
|
-
if (
|
|
114
|
+
if (!DESCRIPTORS.has(subExpr)) {
|
|
133
115
|
if (value === void 0) {
|
|
134
116
|
(0, import_util.removeValue)(newObj, key, { descendArray: true });
|
|
135
117
|
} else {
|
|
@@ -151,8 +133,7 @@ function processObject(obj, expr, options, expressionKeys, idOnlyExcluded) {
|
|
|
151
133
|
function validateExpression(expr, options) {
|
|
152
134
|
const check = [false, false];
|
|
153
135
|
for (const [k, v] of Object.entries(expr)) {
|
|
154
|
-
if (k === options?.idKey)
|
|
155
|
-
return;
|
|
136
|
+
if (k === options?.idKey) return;
|
|
156
137
|
if (v === 0 || v === false) {
|
|
157
138
|
check[0] = true;
|
|
158
139
|
} else if (v === 1 || v === true) {
|
|
@@ -23,7 +23,9 @@ module.exports = __toCommonJS(redact_exports);
|
|
|
23
23
|
var import_core = require("../../core");
|
|
24
24
|
const $redact = (collection, expr, options) => {
|
|
25
25
|
const copts = import_core.ComputeOptions.init(options);
|
|
26
|
-
return collection.map(
|
|
26
|
+
return collection.map(
|
|
27
|
+
(obj) => (0, import_core.redact)(obj, expr, copts.update(obj))
|
|
28
|
+
);
|
|
27
29
|
};
|
|
28
30
|
// Annotate the CommonJS export names for ESM import in node:
|
|
29
31
|
0 && (module.exports = {
|
|
@@ -20,8 +20,15 @@ __export(replaceWith_exports, {
|
|
|
20
20
|
$replaceWith: () => $replaceWith
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(replaceWith_exports);
|
|
23
|
-
var
|
|
24
|
-
|
|
23
|
+
var import_core = require("../../core");
|
|
24
|
+
var import_util = require("../../util");
|
|
25
|
+
const $replaceWith = (collection, expr, options) => {
|
|
26
|
+
return collection.map((obj) => {
|
|
27
|
+
obj = (0, import_core.computeValue)(obj, expr, null, options);
|
|
28
|
+
(0, import_util.assert)((0, import_util.isObject)(obj), "$replaceWith expression must return an object");
|
|
29
|
+
return obj;
|
|
30
|
+
});
|
|
31
|
+
};
|
|
25
32
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
33
|
0 && (module.exports = {
|
|
27
34
|
$replaceWith
|
|
@@ -25,8 +25,7 @@ const $sample = (collection, expr, _options) => {
|
|
|
25
25
|
const len = xs.length;
|
|
26
26
|
let i = -1;
|
|
27
27
|
return () => {
|
|
28
|
-
if (++i === expr.size)
|
|
29
|
-
return { done: true };
|
|
28
|
+
if (++i === expr.size) return { done: true };
|
|
30
29
|
const n = Math.floor(Math.random() * len);
|
|
31
30
|
return { value: xs[n], done: false };
|
|
32
31
|
};
|