@valkey/valkey-glide-darwin-arm64 1.2.0 → 1.2.1-rc0
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
|
@@ -17,11 +17,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
var util_exports = {};
|
|
19
19
|
__export(util_exports, {
|
|
20
|
-
MAX_INT: () => MAX_INT,
|
|
21
|
-
MAX_LONG: () => MAX_LONG,
|
|
22
|
-
MIN_INT: () => MIN_INT,
|
|
23
|
-
MIN_LONG: () => MIN_LONG,
|
|
24
20
|
MingoError: () => MingoError,
|
|
21
|
+
ValueMap: () => ValueMap,
|
|
25
22
|
assert: () => assert,
|
|
26
23
|
cloneDeep: () => cloneDeep,
|
|
27
24
|
compare: () => compare,
|
|
@@ -29,21 +26,17 @@ __export(util_exports, {
|
|
|
29
26
|
filterMissing: () => filterMissing,
|
|
30
27
|
findInsertIndex: () => findInsertIndex,
|
|
31
28
|
flatten: () => flatten,
|
|
32
|
-
getType: () => getType,
|
|
33
29
|
groupBy: () => groupBy,
|
|
34
30
|
has: () => has,
|
|
35
31
|
hashCode: () => hashCode,
|
|
36
|
-
inArray: () => inArray,
|
|
37
32
|
intersection: () => intersection,
|
|
38
33
|
into: () => into,
|
|
39
34
|
isArray: () => isArray,
|
|
40
|
-
isBigInt: () => isBigInt,
|
|
41
35
|
isBoolean: () => isBoolean,
|
|
42
36
|
isDate: () => isDate,
|
|
43
37
|
isEmpty: () => isEmpty,
|
|
44
38
|
isEqual: () => isEqual,
|
|
45
39
|
isFunction: () => isFunction,
|
|
46
|
-
isMissing: () => isMissing,
|
|
47
40
|
isNil: () => isNil,
|
|
48
41
|
isNotNaN: () => isNotNaN,
|
|
49
42
|
isNumber: () => isNumber,
|
|
@@ -53,256 +46,231 @@ __export(util_exports, {
|
|
|
53
46
|
isRegExp: () => isRegExp,
|
|
54
47
|
isString: () => isString,
|
|
55
48
|
isSymbol: () => isSymbol,
|
|
56
|
-
memoize: () => memoize,
|
|
57
49
|
merge: () => merge,
|
|
58
50
|
normalize: () => normalize,
|
|
59
|
-
notInArray: () => notInArray,
|
|
60
51
|
removeValue: () => removeValue,
|
|
61
52
|
resolve: () => resolve,
|
|
62
53
|
resolveGraph: () => resolveGraph,
|
|
63
54
|
setValue: () => setValue,
|
|
64
|
-
sortBy: () => sortBy,
|
|
65
55
|
stringify: () => stringify,
|
|
66
56
|
truthy: () => truthy,
|
|
57
|
+
typeOf: () => typeOf,
|
|
67
58
|
unique: () => unique,
|
|
68
59
|
walk: () => walk
|
|
69
60
|
});
|
|
70
61
|
module.exports = __toCommonJS(util_exports);
|
|
71
62
|
class MingoError extends Error {
|
|
72
63
|
}
|
|
73
|
-
const MAX_INT = 2147483647;
|
|
74
|
-
const MIN_INT = -2147483648;
|
|
75
|
-
const MAX_LONG = Number.MAX_SAFE_INTEGER;
|
|
76
|
-
const MIN_LONG = Number.MIN_SAFE_INTEGER;
|
|
77
64
|
const MISSING = Symbol("missing");
|
|
78
65
|
const CYCLE_FOUND_ERROR = Object.freeze(
|
|
79
66
|
new Error("mingo: cycle detected while processing object/array")
|
|
80
67
|
);
|
|
81
|
-
const OBJECT_TAG = "[object Object]";
|
|
82
|
-
const OBJECT_TYPE_RE = /^\[object ([a-zA-Z0-9]+)\]$/;
|
|
83
68
|
const DEFAULT_HASH_FUNCTION = (value) => {
|
|
84
69
|
const s = stringify(value);
|
|
85
70
|
let hash = 0;
|
|
86
71
|
let i = s.length;
|
|
87
|
-
while (i)
|
|
88
|
-
hash = (hash << 5) - hash ^ s.charCodeAt(--i);
|
|
72
|
+
while (i) hash = (hash << 5) - hash ^ s.charCodeAt(--i);
|
|
89
73
|
return hash >>> 0;
|
|
90
74
|
};
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
regexp: 7,
|
|
110
|
-
function: 8
|
|
75
|
+
const objectProto = Object.prototype;
|
|
76
|
+
const arrayProto = Array.prototype;
|
|
77
|
+
const getPrototypeOf = Object.getPrototypeOf;
|
|
78
|
+
const isPrimitive = (v) => typeof v !== "object" && typeof v !== "function" || v === null;
|
|
79
|
+
const isScalar = (v) => isPrimitive(v) || isDate(v) || isRegExp(v);
|
|
80
|
+
const SORT_ORDER = {
|
|
81
|
+
undefined: 1,
|
|
82
|
+
null: 2,
|
|
83
|
+
number: 3,
|
|
84
|
+
string: 4,
|
|
85
|
+
symbol: 5,
|
|
86
|
+
object: 6,
|
|
87
|
+
array: 7,
|
|
88
|
+
arraybuffer: 8,
|
|
89
|
+
boolean: 9,
|
|
90
|
+
date: 10,
|
|
91
|
+
regexp: 11,
|
|
92
|
+
function: 12
|
|
111
93
|
};
|
|
112
94
|
const compare = (a, b) => {
|
|
113
|
-
if (a === MISSING)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
);
|
|
120
|
-
if (u !== v)
|
|
121
|
-
return u - v;
|
|
122
|
-
if (u === 1 || u === 2 || u === 6) {
|
|
123
|
-
if (a < b)
|
|
124
|
-
return -1;
|
|
125
|
-
if (a > b)
|
|
126
|
-
return 1;
|
|
127
|
-
return 0;
|
|
128
|
-
}
|
|
129
|
-
if (isEqual(a, b))
|
|
130
|
-
return 0;
|
|
131
|
-
if (a < b)
|
|
132
|
-
return -1;
|
|
133
|
-
if (a > b)
|
|
134
|
-
return 1;
|
|
95
|
+
if (a === MISSING) a = void 0;
|
|
96
|
+
if (b === MISSING) b = void 0;
|
|
97
|
+
const [u, v] = [a, b].map((n) => SORT_ORDER[typeOf(n)]);
|
|
98
|
+
if (u !== v) return u - v;
|
|
99
|
+
if (isEqual(a, b)) return 0;
|
|
100
|
+
if (a < b) return -1;
|
|
101
|
+
if (a > b) return 1;
|
|
135
102
|
return 0;
|
|
136
103
|
};
|
|
104
|
+
class ValueMap extends Map {
|
|
105
|
+
// The hash function
|
|
106
|
+
#hashFn = DEFAULT_HASH_FUNCTION;
|
|
107
|
+
// maps the hashcode to key set
|
|
108
|
+
#keyMap = /* @__PURE__ */ new Map();
|
|
109
|
+
// returns a tuple of [<masterKey>, <hash>]. Expects an object key.
|
|
110
|
+
#unpack = (key) => {
|
|
111
|
+
const hash = this.#hashFn(key);
|
|
112
|
+
return [(this.#keyMap.get(hash) || []).find((k) => isEqual(k, key)), hash];
|
|
113
|
+
};
|
|
114
|
+
constructor() {
|
|
115
|
+
super();
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Returns a new {@link ValueMap} object.
|
|
119
|
+
* @param fn An optional custom hash function
|
|
120
|
+
*/
|
|
121
|
+
static init(fn) {
|
|
122
|
+
const m = new ValueMap();
|
|
123
|
+
if (fn) m.#hashFn = fn;
|
|
124
|
+
return m;
|
|
125
|
+
}
|
|
126
|
+
clear() {
|
|
127
|
+
super.clear();
|
|
128
|
+
this.#keyMap.clear();
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* @returns true if an element in the Map existed and has been removed, or false if the element does not exist.
|
|
132
|
+
*/
|
|
133
|
+
delete(key) {
|
|
134
|
+
if (isPrimitive(key)) return super.delete(key);
|
|
135
|
+
const [masterKey, hash] = this.#unpack(key);
|
|
136
|
+
if (!super.delete(masterKey)) return false;
|
|
137
|
+
this.#keyMap.set(
|
|
138
|
+
hash,
|
|
139
|
+
this.#keyMap.get(hash).filter((k) => !isEqual(k, masterKey))
|
|
140
|
+
);
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.
|
|
145
|
+
* @returns Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
|
|
146
|
+
*/
|
|
147
|
+
get(key) {
|
|
148
|
+
if (isPrimitive(key)) return super.get(key);
|
|
149
|
+
const [masterKey, _] = this.#unpack(key);
|
|
150
|
+
return super.get(masterKey);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* @returns boolean indicating whether an element with the specified key exists or not.
|
|
154
|
+
*/
|
|
155
|
+
has(key) {
|
|
156
|
+
if (isPrimitive(key)) return super.has(key);
|
|
157
|
+
const [masterKey, _] = this.#unpack(key);
|
|
158
|
+
return super.has(masterKey);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.
|
|
162
|
+
*/
|
|
163
|
+
set(key, value) {
|
|
164
|
+
if (isPrimitive(key)) return super.set(key, value);
|
|
165
|
+
const [masterKey, hash] = this.#unpack(key);
|
|
166
|
+
if (super.has(masterKey)) {
|
|
167
|
+
super.set(masterKey, value);
|
|
168
|
+
} else {
|
|
169
|
+
super.set(key, value);
|
|
170
|
+
const keys = this.#keyMap.get(hash) || [];
|
|
171
|
+
keys.push(key);
|
|
172
|
+
this.#keyMap.set(hash, keys);
|
|
173
|
+
}
|
|
174
|
+
return this;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* @returns the number of elements in the Map.
|
|
178
|
+
*/
|
|
179
|
+
get size() {
|
|
180
|
+
return super.size;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
137
183
|
function assert(condition, message) {
|
|
138
|
-
if (!condition)
|
|
139
|
-
throw new MingoError(message);
|
|
184
|
+
if (!condition) throw new MingoError(message);
|
|
140
185
|
}
|
|
141
|
-
const
|
|
186
|
+
const typeOf = (v) => {
|
|
187
|
+
const s = objectProto.toString.call(v);
|
|
188
|
+
const t = s.substring(8, s.length - 1).toLowerCase();
|
|
189
|
+
if (t !== "object") return t;
|
|
190
|
+
const ctor = v.constructor;
|
|
191
|
+
return ctor == null || ctor === Object ? t : ctor.name;
|
|
192
|
+
};
|
|
142
193
|
const isBoolean = (v) => typeof v === "boolean";
|
|
143
194
|
const isString = (v) => typeof v === "string";
|
|
144
195
|
const isSymbol = (v) => typeof v === "symbol";
|
|
145
196
|
const isNumber = (v) => !isNaN(v) && typeof v === "number";
|
|
146
|
-
const isBigInt = (v) => !isNaN(v) && typeof v === "bigint";
|
|
147
197
|
const isNotNaN = (v) => !(isNaN(v) && typeof v === "number");
|
|
148
198
|
const isArray = Array.isArray;
|
|
149
199
|
const isObject = (v) => {
|
|
150
|
-
if (!v)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
return (proto === Object.prototype || proto === null) && OBJECT_TAG === Object.prototype.toString.call(v);
|
|
200
|
+
if (!v) return false;
|
|
201
|
+
const p = Object.getPrototypeOf(v);
|
|
202
|
+
return (p === Object.prototype || p === null) && typeOf(v) === "object";
|
|
154
203
|
};
|
|
155
|
-
const isObjectLike = (v) =>
|
|
204
|
+
const isObjectLike = (v) => !isPrimitive(v);
|
|
156
205
|
const isDate = (v) => v instanceof Date;
|
|
157
206
|
const isRegExp = (v) => v instanceof RegExp;
|
|
158
207
|
const isFunction = (v) => typeof v === "function";
|
|
159
208
|
const isNil = (v) => v === null || v === void 0;
|
|
160
|
-
const inArray = (arr, item) => arr.includes(item);
|
|
161
|
-
const notInArray = (arr, item) => !inArray(arr, item);
|
|
162
209
|
const truthy = (arg, strict = true) => !!arg || strict && arg === "";
|
|
163
|
-
const isEmpty = (x) => isNil(x) || isString(x) && !x || x
|
|
164
|
-
const
|
|
165
|
-
const
|
|
166
|
-
const has = (obj, prop) => !!obj && Object.prototype.hasOwnProperty.call(obj, prop);
|
|
210
|
+
const isEmpty = (x) => isNil(x) || isString(x) && !x || isArray(x) && x.length === 0 || isObject(x) && Object.keys(x).length === 0;
|
|
211
|
+
const ensureArray = (x) => isArray(x) ? x : [x];
|
|
212
|
+
const has = (obj, prop) => !!obj && objectProto.hasOwnProperty.call(obj, prop);
|
|
167
213
|
const isTypedArray = (v) => typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView(v);
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
if (
|
|
171
|
-
|
|
172
|
-
if (
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
214
|
+
const cloneDeep = (v, refs) => {
|
|
215
|
+
if (isNil(v) || isBoolean(v) || isNumber(v) || isString(v)) return v;
|
|
216
|
+
if (isDate(v)) return new Date(v);
|
|
217
|
+
if (isRegExp(v)) return new RegExp(v);
|
|
218
|
+
if (isTypedArray(v)) {
|
|
219
|
+
const ctor = v.constructor;
|
|
220
|
+
return new ctor(v);
|
|
221
|
+
}
|
|
222
|
+
if (!(refs instanceof Set)) refs = /* @__PURE__ */ new Set();
|
|
223
|
+
if (refs.has(v)) throw CYCLE_FOUND_ERROR;
|
|
224
|
+
refs.add(v);
|
|
177
225
|
try {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
226
|
+
if (isArray(v)) {
|
|
227
|
+
const arr = new Array(v.length);
|
|
228
|
+
for (let i = 0; i < v.length; i++) arr[i] = cloneDeep(v[i], refs);
|
|
229
|
+
return arr;
|
|
230
|
+
}
|
|
231
|
+
if (isObject(v)) {
|
|
232
|
+
const obj = {};
|
|
233
|
+
for (const k of Object.keys(v)) obj[k] = cloneDeep(v[k], refs);
|
|
234
|
+
return obj;
|
|
186
235
|
}
|
|
187
236
|
} finally {
|
|
188
|
-
refs.delete(
|
|
237
|
+
refs.delete(v);
|
|
189
238
|
}
|
|
190
|
-
return
|
|
239
|
+
return v;
|
|
191
240
|
};
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
if (
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
return obj || target;
|
|
203
|
-
throw Error("mismatched types. must both be array or object");
|
|
241
|
+
const isMissing = (v) => v === MISSING;
|
|
242
|
+
function merge(target, input) {
|
|
243
|
+
if (isMissing(target) || isNil(target)) return input;
|
|
244
|
+
if (isMissing(input) || isNil(input)) return target;
|
|
245
|
+
if (isPrimitive(target) || isPrimitive(input)) return input;
|
|
246
|
+
if (isArray(target) && isArray(input)) {
|
|
247
|
+
assert(
|
|
248
|
+
target.length === input.length,
|
|
249
|
+
"arrays must be of equal length to merge."
|
|
250
|
+
);
|
|
204
251
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
const result = target;
|
|
208
|
-
const input = obj;
|
|
209
|
-
if (options.flatten) {
|
|
210
|
-
let i = 0;
|
|
211
|
-
let j = 0;
|
|
212
|
-
while (i < result.length && j < input.length) {
|
|
213
|
-
result[i] = merge(result[i++], input[j++], options);
|
|
214
|
-
}
|
|
215
|
-
while (j < input.length) {
|
|
216
|
-
result.push(obj[j++]);
|
|
217
|
-
}
|
|
218
|
-
} else {
|
|
219
|
-
into(result, input);
|
|
220
|
-
}
|
|
221
|
-
} else {
|
|
222
|
-
for (const k in obj) {
|
|
223
|
-
target[k] = merge(
|
|
224
|
-
target[k],
|
|
225
|
-
obj[k],
|
|
226
|
-
options
|
|
227
|
-
);
|
|
228
|
-
}
|
|
252
|
+
for (const k in input) {
|
|
253
|
+
target[k] = merge(target[k], input[k]);
|
|
229
254
|
}
|
|
230
255
|
return target;
|
|
231
256
|
}
|
|
232
|
-
function buildHashIndex(arr, hashFunction = DEFAULT_HASH_FUNCTION) {
|
|
233
|
-
const map = /* @__PURE__ */ new Map();
|
|
234
|
-
arr.forEach((o, i) => {
|
|
235
|
-
const h = hashCode(o, hashFunction);
|
|
236
|
-
if (map.has(h)) {
|
|
237
|
-
if (!map.get(h).some((j) => isEqual(arr[j], o))) {
|
|
238
|
-
map.get(h).push(i);
|
|
239
|
-
}
|
|
240
|
-
} else {
|
|
241
|
-
map.set(h, [i]);
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
return map;
|
|
245
|
-
}
|
|
246
257
|
function intersection(input, hashFunction = DEFAULT_HASH_FUNCTION) {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
if (input.length ===
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
(
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
const res = lhs.map((_) => 0);
|
|
262
|
-
const stable = lhs.map((_) => [sortedIndex[0][0], 0]);
|
|
263
|
-
let found = false;
|
|
264
|
-
for (let i = 1; i < input.length; i++) {
|
|
265
|
-
const [currIndex, _] = sortedIndex[i];
|
|
266
|
-
const arr = input[currIndex];
|
|
267
|
-
if (!rmap.has(i))
|
|
268
|
-
rmap.set(i, buildHashIndex(arr));
|
|
269
|
-
if (rmap.get(i).has(k)) {
|
|
270
|
-
const rhs = rmap.get(i).get(k).map((j) => arr[j]);
|
|
271
|
-
found = lhs.map(
|
|
272
|
-
(s, n) => rhs.some((t, m) => {
|
|
273
|
-
const p = res[n];
|
|
274
|
-
if (isEqual(s, t)) {
|
|
275
|
-
res[n]++;
|
|
276
|
-
if (currIndex < stable[n][0]) {
|
|
277
|
-
stable[n] = [currIndex, rmap.get(i).get(k)[m]];
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
return p < res[n];
|
|
281
|
-
})
|
|
282
|
-
).some(Boolean);
|
|
283
|
-
}
|
|
284
|
-
if (!found)
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
if (found) {
|
|
288
|
-
into(
|
|
289
|
-
results,
|
|
290
|
-
res.map((n, i) => {
|
|
291
|
-
return n === input.length - 1 ? [lhs[i], stable[i]] : MISSING;
|
|
292
|
-
}).filter((n) => n !== MISSING)
|
|
293
|
-
);
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
return results.sort((a, b) => {
|
|
297
|
-
const [_i, [u, m]] = a;
|
|
298
|
-
const [_j, [v, n]] = b;
|
|
299
|
-
const r = compare(u, v);
|
|
300
|
-
if (r !== 0)
|
|
301
|
-
return r;
|
|
302
|
-
return compare(m, n);
|
|
303
|
-
}).map((v) => v[0]);
|
|
258
|
+
const vmaps = [ValueMap.init(hashFunction), ValueMap.init(hashFunction)];
|
|
259
|
+
if (input.length === 0) return [];
|
|
260
|
+
if (input.some((arr) => arr.length === 0)) return [];
|
|
261
|
+
if (input.length === 1) return [...input];
|
|
262
|
+
input[input.length - 1].forEach((v) => vmaps[0].set(v, true));
|
|
263
|
+
for (let i = input.length - 2; i > -1; i--) {
|
|
264
|
+
input[i].forEach((v) => {
|
|
265
|
+
if (vmaps[0].has(v)) vmaps[1].set(v, true);
|
|
266
|
+
});
|
|
267
|
+
if (vmaps[1].size === 0) return [];
|
|
268
|
+
vmaps.reverse();
|
|
269
|
+
vmaps[1].clear();
|
|
270
|
+
}
|
|
271
|
+
return Array.from(vmaps[0].keys());
|
|
304
272
|
}
|
|
305
|
-
function flatten(xs, depth =
|
|
273
|
+
function flatten(xs, depth = 1) {
|
|
306
274
|
const arr = new Array();
|
|
307
275
|
function flatten2(ys, n) {
|
|
308
276
|
for (let i = 0, len = ys.length; i < len; i++) {
|
|
@@ -316,24 +284,8 @@ function flatten(xs, depth = 0) {
|
|
|
316
284
|
flatten2(xs, depth);
|
|
317
285
|
return arr;
|
|
318
286
|
}
|
|
319
|
-
const getMembersOf = (value) => {
|
|
320
|
-
let [proto, names] = [
|
|
321
|
-
Object.getPrototypeOf(value),
|
|
322
|
-
Object.getOwnPropertyNames(value)
|
|
323
|
-
];
|
|
324
|
-
let activeProto = proto;
|
|
325
|
-
while (!names.length && proto !== Object.prototype && proto !== Array.prototype) {
|
|
326
|
-
activeProto = proto;
|
|
327
|
-
names = Object.getOwnPropertyNames(proto);
|
|
328
|
-
proto = Object.getPrototypeOf(proto);
|
|
329
|
-
}
|
|
330
|
-
const o = {};
|
|
331
|
-
names.forEach((k) => o[k] = value[k]);
|
|
332
|
-
return [o, activeProto];
|
|
333
|
-
};
|
|
334
287
|
function isEqual(a, b) {
|
|
335
|
-
if (a === b || Object.is(a, b))
|
|
336
|
-
return true;
|
|
288
|
+
if (a === b || Object.is(a, b)) return true;
|
|
337
289
|
const ctor = !!a && a.constructor || a;
|
|
338
290
|
if (a === null || b === null || a === void 0 || b === void 0 || ctor !== b.constructor || ctor === Function) {
|
|
339
291
|
return false;
|
|
@@ -341,96 +293,56 @@ function isEqual(a, b) {
|
|
|
341
293
|
if (ctor === Array || ctor === Object) {
|
|
342
294
|
const aKeys = Object.keys(a);
|
|
343
295
|
const bKeys = Object.keys(b);
|
|
344
|
-
if (aKeys.length !== bKeys.length)
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
return false;
|
|
348
|
-
for (const k of aKeys)
|
|
349
|
-
if (!isEqual(a[k], b[k]))
|
|
350
|
-
return false;
|
|
296
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
297
|
+
if ((/* @__PURE__ */ new Set([...aKeys, ...bKeys])).size != aKeys.length) return false;
|
|
298
|
+
for (const k of aKeys) if (!isEqual(a[k], b[k])) return false;
|
|
351
299
|
return true;
|
|
352
300
|
}
|
|
353
|
-
const proto =
|
|
354
|
-
const cmp = isTypedArray(a) || proto !==
|
|
301
|
+
const proto = getPrototypeOf(a);
|
|
302
|
+
const cmp = isTypedArray(a) || proto !== objectProto && proto !== arrayProto && has(proto, "toString");
|
|
355
303
|
return cmp && a.toString() === b.toString();
|
|
356
304
|
}
|
|
357
305
|
function unique(input, hashFunction = DEFAULT_HASH_FUNCTION) {
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
});
|
|
362
|
-
return result.filter((v) => v !== MISSING);
|
|
306
|
+
const m = ValueMap.init(hashFunction);
|
|
307
|
+
input.forEach((v) => m.set(v, true));
|
|
308
|
+
return Array.from(m.keys());
|
|
363
309
|
}
|
|
364
|
-
const
|
|
365
|
-
if (v === null)
|
|
366
|
-
|
|
367
|
-
if (v
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
case RegExp:
|
|
372
|
-
case Number:
|
|
373
|
-
case Boolean:
|
|
374
|
-
case Function:
|
|
375
|
-
case Symbol:
|
|
376
|
-
return v.toString();
|
|
377
|
-
case String:
|
|
378
|
-
return JSON.stringify(v);
|
|
379
|
-
case Date:
|
|
380
|
-
return v.toISOString();
|
|
381
|
-
}
|
|
310
|
+
const stringify = (v, refs) => {
|
|
311
|
+
if (v === null) return "null";
|
|
312
|
+
if (v === void 0) return "undefined";
|
|
313
|
+
if (isString(v) || isNumber(v) || isBoolean(v)) return JSON.stringify(v);
|
|
314
|
+
if (isDate(v)) return v.toISOString();
|
|
315
|
+
if (isRegExp(v) || isSymbol(v) || isFunction(v))
|
|
316
|
+
return v.toString();
|
|
382
317
|
if (isTypedArray(v))
|
|
383
|
-
return
|
|
384
|
-
if (
|
|
385
|
-
|
|
318
|
+
return typeOf(v) + "[" + v.toString() + "]";
|
|
319
|
+
if (!(refs instanceof Set)) refs = /* @__PURE__ */ new Set();
|
|
320
|
+
if (refs.has(v)) throw CYCLE_FOUND_ERROR;
|
|
386
321
|
try {
|
|
387
|
-
|
|
388
|
-
if (isArray(v))
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
return "{" + Object.keys(v).sort().map((k) => k + ":" + toString(v[k], cycle)).join(",") + "}";
|
|
322
|
+
refs.add(v);
|
|
323
|
+
if (isArray(v)) return "[" + v.map((s) => stringify(s, refs)).join(",") + "]";
|
|
324
|
+
if (isObject(v)) {
|
|
325
|
+
const keys = Object.keys(v).sort();
|
|
326
|
+
return "{" + keys.map((k) => `${k}:${stringify(v[k], refs)}`).join() + "}";
|
|
393
327
|
}
|
|
394
328
|
const proto = Object.getPrototypeOf(v);
|
|
395
|
-
if (proto !==
|
|
396
|
-
return
|
|
329
|
+
if (proto !== objectProto && proto !== arrayProto && has(proto, "toString")) {
|
|
330
|
+
return typeOf(v) + "(" + JSON.stringify(v.toString()) + ")";
|
|
397
331
|
}
|
|
398
|
-
|
|
399
|
-
|
|
332
|
+
throw new Error(
|
|
333
|
+
"mingo: cannot stringify custom type without explicit toString() method."
|
|
334
|
+
);
|
|
400
335
|
} finally {
|
|
401
|
-
|
|
336
|
+
refs.delete(v);
|
|
402
337
|
}
|
|
403
338
|
};
|
|
404
|
-
const stringify = (value) => toString(value, /* @__PURE__ */ new Set());
|
|
405
339
|
function hashCode(value, hashFunction) {
|
|
340
|
+
if (isNil(value)) return null;
|
|
406
341
|
hashFunction = hashFunction || DEFAULT_HASH_FUNCTION;
|
|
407
|
-
|
|
408
|
-
return null;
|
|
409
|
-
return hashFunction(value).toString();
|
|
410
|
-
}
|
|
411
|
-
function sortBy(collection, keyFn, comparator = compare) {
|
|
412
|
-
if (isEmpty(collection))
|
|
413
|
-
return collection;
|
|
414
|
-
const sorted = new Array();
|
|
415
|
-
const result = new Array();
|
|
416
|
-
for (let i = 0; i < collection.length; i++) {
|
|
417
|
-
const obj = collection[i];
|
|
418
|
-
const key = keyFn(obj, i);
|
|
419
|
-
if (isNil(key)) {
|
|
420
|
-
result.push(obj);
|
|
421
|
-
} else {
|
|
422
|
-
sorted.push([key, obj]);
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
sorted.sort((a, b) => comparator(a[0], b[0]));
|
|
426
|
-
return into(
|
|
427
|
-
result,
|
|
428
|
-
sorted.map((o) => o[1])
|
|
429
|
-
);
|
|
342
|
+
return hashFunction(value);
|
|
430
343
|
}
|
|
431
344
|
function groupBy(collection, keyFn, hashFunction = DEFAULT_HASH_FUNCTION) {
|
|
432
|
-
if (collection.length < 1)
|
|
433
|
-
return /* @__PURE__ */ new Map();
|
|
345
|
+
if (collection.length < 1) return /* @__PURE__ */ new Map();
|
|
434
346
|
const lookup = /* @__PURE__ */ new Map();
|
|
435
347
|
const result = /* @__PURE__ */ new Map();
|
|
436
348
|
for (let i = 0; i < collection.length; i++) {
|
|
@@ -461,22 +373,19 @@ function groupBy(collection, keyFn, hashFunction = DEFAULT_HASH_FUNCTION) {
|
|
|
461
373
|
}
|
|
462
374
|
const MAX_ARRAY_PUSH = 5e4;
|
|
463
375
|
function into(target, ...rest) {
|
|
464
|
-
if (target
|
|
465
|
-
|
|
466
|
-
(
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
},
|
|
478
|
-
target
|
|
479
|
-
);
|
|
376
|
+
if (isArray(target)) {
|
|
377
|
+
for (const arr of rest) {
|
|
378
|
+
let i = Math.ceil(arr.length / MAX_ARRAY_PUSH);
|
|
379
|
+
let begin = 0;
|
|
380
|
+
while (i-- > 0) {
|
|
381
|
+
Array.prototype.push.apply(
|
|
382
|
+
target,
|
|
383
|
+
arr.slice(begin, begin + MAX_ARRAY_PUSH)
|
|
384
|
+
);
|
|
385
|
+
begin += MAX_ARRAY_PUSH;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return target;
|
|
480
389
|
} else {
|
|
481
390
|
return rest.filter(isObjectLike).reduce((acc, item) => {
|
|
482
391
|
Object.assign(acc, item);
|
|
@@ -484,27 +393,12 @@ function into(target, ...rest) {
|
|
|
484
393
|
}, target);
|
|
485
394
|
}
|
|
486
395
|
}
|
|
487
|
-
function memoize(fn, hashFunction = DEFAULT_HASH_FUNCTION) {
|
|
488
|
-
return /* @__PURE__ */ ((memo) => {
|
|
489
|
-
return (...args) => {
|
|
490
|
-
const key = hashCode(args, hashFunction) || "";
|
|
491
|
-
if (!has(memo, key)) {
|
|
492
|
-
memo[key] = fn.apply(this, args);
|
|
493
|
-
}
|
|
494
|
-
return memo[key];
|
|
495
|
-
};
|
|
496
|
-
})({
|
|
497
|
-
/* storage */
|
|
498
|
-
});
|
|
499
|
-
}
|
|
500
396
|
function getValue(obj, key) {
|
|
501
|
-
return
|
|
397
|
+
return isArray(obj) || isObject(obj) ? obj[key] : void 0;
|
|
502
398
|
}
|
|
503
399
|
function unwrap(arr, depth) {
|
|
504
|
-
if (depth < 1)
|
|
505
|
-
|
|
506
|
-
while (depth-- && arr.length === 1)
|
|
507
|
-
arr = arr[0];
|
|
400
|
+
if (depth < 1) return arr;
|
|
401
|
+
while (depth-- && arr.length === 1) arr = arr[0];
|
|
508
402
|
return arr;
|
|
509
403
|
}
|
|
510
404
|
function resolve(obj, selector, options) {
|
|
@@ -514,72 +408,68 @@ function resolve(obj, selector, options) {
|
|
|
514
408
|
for (let i = 0; i < path.length; i++) {
|
|
515
409
|
const field = path[i];
|
|
516
410
|
const isText = /^\d+$/.exec(field) === null;
|
|
517
|
-
if (isText && value
|
|
518
|
-
if (i === 0 && depth > 0)
|
|
519
|
-
break;
|
|
411
|
+
if (isText && isArray(value)) {
|
|
412
|
+
if (i === 0 && depth > 0) break;
|
|
520
413
|
depth += 1;
|
|
521
414
|
const subpath = path.slice(i);
|
|
522
415
|
value = value.reduce((acc, item) => {
|
|
523
416
|
const v = resolve2(item, subpath);
|
|
524
|
-
if (v !== void 0)
|
|
525
|
-
acc.push(v);
|
|
417
|
+
if (v !== void 0) acc.push(v);
|
|
526
418
|
return acc;
|
|
527
419
|
}, []);
|
|
528
420
|
break;
|
|
529
421
|
} else {
|
|
530
422
|
value = getValue(value, field);
|
|
531
423
|
}
|
|
532
|
-
if (value === void 0)
|
|
533
|
-
break;
|
|
424
|
+
if (value === void 0) break;
|
|
534
425
|
}
|
|
535
426
|
return value;
|
|
536
427
|
}
|
|
537
|
-
const
|
|
538
|
-
return
|
|
428
|
+
const res = isScalar(obj) ? obj : resolve2(obj, selector.split("."));
|
|
429
|
+
return isArray(res) && options?.unwrapArray ? unwrap(res, depth) : res;
|
|
539
430
|
}
|
|
540
431
|
function resolveGraph(obj, selector, options) {
|
|
541
|
-
const
|
|
542
|
-
const key =
|
|
543
|
-
const next =
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
if (obj instanceof Array) {
|
|
432
|
+
const sep = selector.indexOf(".");
|
|
433
|
+
const key = sep == -1 ? selector : selector.substring(0, sep);
|
|
434
|
+
const next = selector.substring(sep + 1);
|
|
435
|
+
const hasNext = sep != -1;
|
|
436
|
+
if (isArray(obj)) {
|
|
437
|
+
const isIndex = /^\d+$/.test(key);
|
|
438
|
+
const arr = isIndex && options?.preserveIndex ? [...obj] : [];
|
|
549
439
|
if (isIndex) {
|
|
550
|
-
|
|
440
|
+
const index = parseInt(key);
|
|
441
|
+
let value2 = getValue(obj, index);
|
|
551
442
|
if (hasNext) {
|
|
552
|
-
|
|
443
|
+
value2 = resolveGraph(value2, next, options);
|
|
444
|
+
}
|
|
445
|
+
if (options?.preserveIndex) {
|
|
446
|
+
arr[index] = value2;
|
|
447
|
+
} else {
|
|
448
|
+
arr.push(value2);
|
|
553
449
|
}
|
|
554
|
-
result = [result];
|
|
555
450
|
} else {
|
|
556
|
-
result = [];
|
|
557
451
|
for (const item of obj) {
|
|
558
|
-
|
|
452
|
+
const value2 = resolveGraph(item, selector, options);
|
|
559
453
|
if (options?.preserveMissing) {
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
result.push(value);
|
|
564
|
-
} else if (value !== void 0) {
|
|
565
|
-
result.push(value);
|
|
454
|
+
arr.push(value2 == void 0 ? MISSING : value2);
|
|
455
|
+
} else if (value2 != void 0 || options?.preserveIndex) {
|
|
456
|
+
arr.push(value2);
|
|
566
457
|
}
|
|
567
458
|
}
|
|
568
459
|
}
|
|
569
|
-
|
|
570
|
-
value = getValue(obj, key);
|
|
571
|
-
if (hasNext) {
|
|
572
|
-
value = resolveGraph(value, next, options);
|
|
573
|
-
}
|
|
574
|
-
if (value === void 0)
|
|
575
|
-
return void 0;
|
|
576
|
-
result = options?.preserveKeys ? { ...obj } : {};
|
|
577
|
-
result[key] = value;
|
|
460
|
+
return arr;
|
|
578
461
|
}
|
|
579
|
-
|
|
462
|
+
const res = options?.preserveKeys ? { ...obj } : {};
|
|
463
|
+
let value = getValue(obj, key);
|
|
464
|
+
if (hasNext) {
|
|
465
|
+
value = resolveGraph(value, next, options);
|
|
466
|
+
}
|
|
467
|
+
if (value === void 0) return void 0;
|
|
468
|
+
res[key] = value;
|
|
469
|
+
return res;
|
|
580
470
|
}
|
|
581
471
|
function filterMissing(obj) {
|
|
582
|
-
if (obj
|
|
472
|
+
if (isArray(obj)) {
|
|
583
473
|
for (let i = obj.length - 1; i >= 0; i--) {
|
|
584
474
|
if (obj[i] === MISSING) {
|
|
585
475
|
obj.splice(i, 1);
|
|
@@ -609,10 +499,9 @@ function walk(obj, selector, fn, options) {
|
|
|
609
499
|
obj[key] = {};
|
|
610
500
|
}
|
|
611
501
|
const item = obj[key];
|
|
612
|
-
if (!item)
|
|
613
|
-
return;
|
|
502
|
+
if (!item) return;
|
|
614
503
|
const isNextArrayIndex = !!(names.length > 1 && NUMBER_RE.test(names[1]));
|
|
615
|
-
if (item
|
|
504
|
+
if (isArray(item) && options?.descendArray && !isNextArrayIndex) {
|
|
616
505
|
item.forEach((e) => walk(e, next, fn, options));
|
|
617
506
|
} else {
|
|
618
507
|
walk(item, next, fn, options);
|
|
@@ -634,7 +523,7 @@ function removeValue(obj, selector, options) {
|
|
|
634
523
|
obj,
|
|
635
524
|
selector,
|
|
636
525
|
(item, key) => {
|
|
637
|
-
if (item
|
|
526
|
+
if (isArray(item)) {
|
|
638
527
|
if (/^\d+$/.test(key)) {
|
|
639
528
|
item.splice(parseInt(key), 1);
|
|
640
529
|
} else if (options && options.descendArray) {
|
|
@@ -656,14 +545,11 @@ function isOperator(name) {
|
|
|
656
545
|
return OPERATOR_NAME_PATTERN.test(name);
|
|
657
546
|
}
|
|
658
547
|
function normalize(expr) {
|
|
659
|
-
if (
|
|
548
|
+
if (isScalar(expr)) {
|
|
660
549
|
return isRegExp(expr) ? { $regex: expr } : { $eq: expr };
|
|
661
550
|
}
|
|
662
551
|
if (isObjectLike(expr)) {
|
|
663
|
-
|
|
664
|
-
if (!Object.keys(exprObj).some(isOperator)) {
|
|
665
|
-
return { $eq: expr };
|
|
666
|
-
}
|
|
552
|
+
if (!Object.keys(expr).some(isOperator)) return { $eq: expr };
|
|
667
553
|
if (has(expr, "$regex")) {
|
|
668
554
|
const newExpr = { ...expr };
|
|
669
555
|
newExpr["$regex"] = new RegExp(
|
|
@@ -676,14 +562,14 @@ function normalize(expr) {
|
|
|
676
562
|
}
|
|
677
563
|
return expr;
|
|
678
564
|
}
|
|
679
|
-
function findInsertIndex(sorted, item) {
|
|
565
|
+
function findInsertIndex(sorted, item, comparator = compare) {
|
|
680
566
|
let lo = 0;
|
|
681
567
|
let hi = sorted.length - 1;
|
|
682
568
|
while (lo <= hi) {
|
|
683
569
|
const mid = Math.round(lo + (hi - lo) / 2);
|
|
684
|
-
if (
|
|
570
|
+
if (comparator(item, sorted[mid]) < 0) {
|
|
685
571
|
hi = mid - 1;
|
|
686
|
-
} else if (
|
|
572
|
+
} else if (comparator(item, sorted[mid]) > 0) {
|
|
687
573
|
lo = mid + 1;
|
|
688
574
|
} else {
|
|
689
575
|
return mid;
|
|
@@ -693,11 +579,8 @@ function findInsertIndex(sorted, item) {
|
|
|
693
579
|
}
|
|
694
580
|
// Annotate the CommonJS export names for ESM import in node:
|
|
695
581
|
0 && (module.exports = {
|
|
696
|
-
MAX_INT,
|
|
697
|
-
MAX_LONG,
|
|
698
|
-
MIN_INT,
|
|
699
|
-
MIN_LONG,
|
|
700
582
|
MingoError,
|
|
583
|
+
ValueMap,
|
|
701
584
|
assert,
|
|
702
585
|
cloneDeep,
|
|
703
586
|
compare,
|
|
@@ -705,21 +588,17 @@ function findInsertIndex(sorted, item) {
|
|
|
705
588
|
filterMissing,
|
|
706
589
|
findInsertIndex,
|
|
707
590
|
flatten,
|
|
708
|
-
getType,
|
|
709
591
|
groupBy,
|
|
710
592
|
has,
|
|
711
593
|
hashCode,
|
|
712
|
-
inArray,
|
|
713
594
|
intersection,
|
|
714
595
|
into,
|
|
715
596
|
isArray,
|
|
716
|
-
isBigInt,
|
|
717
597
|
isBoolean,
|
|
718
598
|
isDate,
|
|
719
599
|
isEmpty,
|
|
720
600
|
isEqual,
|
|
721
601
|
isFunction,
|
|
722
|
-
isMissing,
|
|
723
602
|
isNil,
|
|
724
603
|
isNotNaN,
|
|
725
604
|
isNumber,
|
|
@@ -729,17 +608,15 @@ function findInsertIndex(sorted, item) {
|
|
|
729
608
|
isRegExp,
|
|
730
609
|
isString,
|
|
731
610
|
isSymbol,
|
|
732
|
-
memoize,
|
|
733
611
|
merge,
|
|
734
612
|
normalize,
|
|
735
|
-
notInArray,
|
|
736
613
|
removeValue,
|
|
737
614
|
resolve,
|
|
738
615
|
resolveGraph,
|
|
739
616
|
setValue,
|
|
740
|
-
sortBy,
|
|
741
617
|
stringify,
|
|
742
618
|
truthy,
|
|
619
|
+
typeOf,
|
|
743
620
|
unique,
|
|
744
621
|
walk
|
|
745
622
|
});
|