@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.
Files changed (439) hide show
  1. package/build-ts/src/BaseClient.d.ts +27 -1
  2. package/build-ts/src/BaseClient.js +9 -1
  3. package/build-ts/src/BaseClient.js.map +1 -1
  4. package/build-ts/src/Commands.d.ts +12 -0
  5. package/build-ts/src/Commands.js.map +1 -1
  6. package/build-ts/src/GlideClient.d.ts +17 -1
  7. package/build-ts/src/GlideClient.js +3 -0
  8. package/build-ts/src/GlideClient.js.map +1 -1
  9. package/build-ts/src/GlideClusterClient.d.ts +23 -7
  10. package/build-ts/src/GlideClusterClient.js +8 -3
  11. package/build-ts/src/GlideClusterClient.js.map +1 -1
  12. package/build-ts/src/ProtobufMessage.js +46 -1
  13. package/build-ts/src/ProtobufMessage.js.map +1 -1
  14. package/node_modules/glide-rs/glide-rs.darwin-arm64.node +0 -0
  15. package/node_modules/glide-rs/index.d.ts +2 -1
  16. package/node_modules/glide-rs/index.js +4 -2
  17. package/npm/glide/index.ts +4 -3
  18. package/npm/glide/package.json +0 -1
  19. package/package.json +2 -2
  20. package/rust-client/node_modules/mingo/README.md +58 -53
  21. package/rust-client/node_modules/mingo/dist/cjs/aggregator.js +18 -20
  22. package/rust-client/node_modules/mingo/dist/cjs/core.js +179 -190
  23. package/rust-client/node_modules/mingo/dist/cjs/cursor.js +34 -34
  24. package/rust-client/node_modules/mingo/dist/cjs/index.js +11 -3
  25. package/rust-client/node_modules/mingo/dist/cjs/init/basic.js +4 -22
  26. package/rust-client/node_modules/mingo/dist/cjs/init/system.js +6 -6
  27. package/rust-client/node_modules/mingo/dist/cjs/lazy.js +58 -61
  28. package/rust-client/node_modules/mingo/dist/cjs/operators/_predicates.js +12 -25
  29. package/rust-client/node_modules/mingo/dist/cjs/operators/accumulator/_internal.js +2 -4
  30. package/rust-client/node_modules/mingo/dist/cjs/operators/accumulator/accumulator.js +1 -2
  31. package/rust-client/node_modules/mingo/dist/cjs/operators/accumulator/first.js +3 -1
  32. package/rust-client/node_modules/mingo/dist/cjs/operators/accumulator/last.js +4 -1
  33. package/rust-client/node_modules/mingo/dist/cjs/operators/accumulator/max.js +9 -6
  34. package/rust-client/node_modules/mingo/dist/cjs/operators/accumulator/mergeObjects.js +5 -1
  35. package/rust-client/node_modules/mingo/dist/cjs/operators/accumulator/min.js +9 -3
  36. package/rust-client/node_modules/mingo/dist/cjs/operators/accumulator/push.js +1 -2
  37. package/rust-client/node_modules/mingo/dist/cjs/operators/accumulator/sum.js +2 -4
  38. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/add.js +9 -10
  39. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/ceil.js +1 -2
  40. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/exp.js +1 -2
  41. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/floor.js +1 -2
  42. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/ln.js +1 -2
  43. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/log.js +1 -2
  44. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/log10.js +1 -2
  45. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/round.js +1 -2
  46. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/sqrt.js +1 -2
  47. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/subtract.js +5 -2
  48. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/arithmetic/trunc.js +1 -2
  49. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/arrayElemAt.js +2 -3
  50. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/arrayToObject.js +3 -4
  51. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/concatArrays.js +11 -5
  52. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/filter.js +1 -0
  53. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/first.js +8 -8
  54. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/firstN.js +2 -4
  55. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/in.js +1 -1
  56. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/indexOfArray.js +5 -10
  57. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/isArray.js +2 -3
  58. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/last.js +8 -8
  59. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/lastN.js +2 -4
  60. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/map.js +1 -0
  61. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/maxN.js +2 -4
  62. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/minN.js +2 -4
  63. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/reduce.js +1 -2
  64. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/reverseArray.js +1 -2
  65. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/sortArray.js +2 -4
  66. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/array/zip.js +4 -10
  67. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/bitwise/_internal.js +1 -2
  68. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/bitwise/bitNot.js +2 -4
  69. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/boolean/not.js +3 -5
  70. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/comparison/cmp.js +6 -5
  71. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/conditional/cond.js +1 -1
  72. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/conditional/ifNull.js +1 -1
  73. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/conditional/switch.js +1 -2
  74. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/_internal.js +157 -65
  75. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/dateAdd.js +1 -29
  76. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/dateDiff.js +32 -20
  77. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/dateFromParts.js +2 -4
  78. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/dateFromString.js +13 -9
  79. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/dateToString.js +2 -4
  80. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/dateTrunc.js +107 -0
  81. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/dayOfYear.js +1 -1
  82. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/index.js +2 -0
  83. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/isoWeekYear.js +1 -4
  84. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/date/week.js +1 -2
  85. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/misc/getField.js +1 -2
  86. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/object/mergeObjects.js +9 -2
  87. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/object/objectToArray.js +5 -1
  88. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/object/setField.js +11 -7
  89. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/set/setDifference.js +9 -1
  90. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/set/setEquals.js +17 -3
  91. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/set/setIntersection.js +2 -1
  92. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/set/setIsSubset.js +15 -1
  93. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/set/setUnion.js +4 -5
  94. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/string/_internal.js +4 -8
  95. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/string/concat.js +5 -2
  96. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/string/indexOfBytes.js +2 -4
  97. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/string/replaceAll.js +1 -2
  98. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/string/replaceOne.js +1 -2
  99. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/string/split.js +1 -2
  100. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/string/strcasecmp.js +1 -2
  101. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/string/substr.js +4 -14
  102. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/string/substrBytes.js +2 -4
  103. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/trignometry/atan2.js +2 -4
  104. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/trignometry/cosh.js +0 -1
  105. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/type/_internal.js +20 -10
  106. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/type/convert.js +3 -5
  107. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/type/toBool.js +2 -4
  108. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/type/toDate.js +3 -6
  109. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/type/toDouble.js +5 -10
  110. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/type/toInt.js +1 -4
  111. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/type/toLong.js +1 -4
  112. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/type/toString.js +11 -10
  113. package/rust-client/node_modules/mingo/dist/cjs/operators/expression/type/type.js +11 -14
  114. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/addFields.js +1 -2
  115. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/bucket.js +53 -53
  116. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/bucketAuto.js +670 -65
  117. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/count.js +2 -2
  118. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/densify.js +196 -0
  119. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/graphLookup.js +78 -0
  120. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/group.js +6 -9
  121. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/index.js +4 -0
  122. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/limit.js +1 -3
  123. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/lookup.js +47 -10
  124. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/merge.js +7 -13
  125. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/out.js +1 -1
  126. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/project.js +19 -38
  127. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/redact.js +3 -1
  128. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/replaceWith.js +9 -2
  129. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/sample.js +1 -2
  130. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/setWindowFields.js +10 -20
  131. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/skip.js +1 -1
  132. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/sort.js +10 -19
  133. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/sortByCount.js +5 -3
  134. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/unionWith.js +1 -1
  135. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/unset.js +1 -2
  136. package/rust-client/node_modules/mingo/dist/cjs/operators/pipeline/unwind.js +5 -9
  137. package/rust-client/node_modules/mingo/dist/cjs/operators/projection/elemMatch.js +2 -3
  138. package/rust-client/node_modules/mingo/dist/cjs/operators/projection/slice.js +2 -3
  139. package/rust-client/node_modules/mingo/dist/cjs/operators/query/bitwise/_internal.js +4 -4
  140. package/rust-client/node_modules/mingo/dist/cjs/operators/update/_internal.js +8 -14
  141. package/rust-client/node_modules/mingo/dist/cjs/operators/update/addToSet.js +1 -2
  142. package/rust-client/node_modules/mingo/dist/cjs/operators/update/bit.js +1 -2
  143. package/rust-client/node_modules/mingo/dist/cjs/operators/update/max.js +1 -2
  144. package/rust-client/node_modules/mingo/dist/cjs/operators/update/min.js +1 -2
  145. package/rust-client/node_modules/mingo/dist/cjs/operators/update/pop.js +1 -2
  146. package/rust-client/node_modules/mingo/dist/cjs/operators/update/pull.js +2 -4
  147. package/rust-client/node_modules/mingo/dist/cjs/operators/update/push.js +3 -9
  148. package/rust-client/node_modules/mingo/dist/cjs/operators/update/rename.js +1 -2
  149. package/rust-client/node_modules/mingo/dist/cjs/operators/update/set.js +1 -2
  150. package/rust-client/node_modules/mingo/dist/cjs/operators/update/unset.js +1 -2
  151. package/rust-client/node_modules/mingo/dist/cjs/operators/window/_internal.js +2 -3
  152. package/rust-client/node_modules/mingo/dist/cjs/operators/window/denseRank.js +8 -10
  153. package/rust-client/node_modules/mingo/dist/cjs/operators/window/derivative.js +4 -6
  154. package/rust-client/node_modules/mingo/dist/cjs/operators/window/documentNumber.js +1 -3
  155. package/rust-client/node_modules/mingo/dist/cjs/operators/window/expMovingAvg.js +4 -6
  156. package/rust-client/node_modules/mingo/dist/cjs/operators/window/integral.js +3 -4
  157. package/rust-client/node_modules/mingo/dist/cjs/operators/window/linearFill.js +4 -6
  158. package/rust-client/node_modules/mingo/dist/cjs/operators/window/locf.js +3 -4
  159. package/rust-client/node_modules/mingo/dist/cjs/operators/window/rank.js +8 -10
  160. package/rust-client/node_modules/mingo/dist/cjs/operators/window/shift.js +2 -2
  161. package/rust-client/node_modules/mingo/dist/cjs/query.js +20 -19
  162. package/rust-client/node_modules/mingo/dist/cjs/types.js +22 -0
  163. package/rust-client/node_modules/mingo/dist/cjs/updater.js +6 -5
  164. package/rust-client/node_modules/mingo/dist/cjs/util.js +265 -388
  165. package/rust-client/node_modules/mingo/dist/esm/aggregator.js +18 -21
  166. package/rust-client/node_modules/mingo/dist/esm/core.js +179 -192
  167. package/rust-client/node_modules/mingo/dist/esm/cursor.js +35 -35
  168. package/rust-client/node_modules/mingo/dist/esm/index.js +8 -2
  169. package/rust-client/node_modules/mingo/dist/esm/init/basic.js +5 -12
  170. package/rust-client/node_modules/mingo/dist/esm/init/system.js +7 -7
  171. package/rust-client/node_modules/mingo/dist/esm/lazy.js +58 -61
  172. package/rust-client/node_modules/mingo/dist/esm/operators/_predicates.js +14 -32
  173. package/rust-client/node_modules/mingo/dist/esm/operators/accumulator/_internal.js +2 -4
  174. package/rust-client/node_modules/mingo/dist/esm/operators/accumulator/accumulator.js +1 -2
  175. package/rust-client/node_modules/mingo/dist/esm/operators/accumulator/first.js +7 -2
  176. package/rust-client/node_modules/mingo/dist/esm/operators/accumulator/last.js +8 -2
  177. package/rust-client/node_modules/mingo/dist/esm/operators/accumulator/max.js +10 -7
  178. package/rust-client/node_modules/mingo/dist/esm/operators/accumulator/mergeObjects.js +5 -1
  179. package/rust-client/node_modules/mingo/dist/esm/operators/accumulator/min.js +10 -4
  180. package/rust-client/node_modules/mingo/dist/esm/operators/accumulator/push.js +1 -2
  181. package/rust-client/node_modules/mingo/dist/esm/operators/accumulator/sum.js +2 -4
  182. package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/add.js +9 -10
  183. package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/ceil.js +1 -2
  184. package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/exp.js +1 -2
  185. package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/floor.js +1 -2
  186. package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/ln.js +1 -2
  187. package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/log.js +1 -2
  188. package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/log10.js +1 -2
  189. package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/round.js +1 -2
  190. package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/sqrt.js +1 -2
  191. package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/subtract.js +5 -2
  192. package/rust-client/node_modules/mingo/dist/esm/operators/expression/arithmetic/trunc.js +1 -2
  193. package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/arrayElemAt.js +3 -4
  194. package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/arrayToObject.js +3 -4
  195. package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/concatArrays.js +12 -6
  196. package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/filter.js +2 -1
  197. package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/first.js +10 -13
  198. package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/firstN.js +2 -4
  199. package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/in.js +1 -1
  200. package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/indexOfArray.js +5 -10
  201. package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/isArray.js +2 -3
  202. package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/last.js +10 -13
  203. package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/lastN.js +2 -4
  204. package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/map.js +2 -1
  205. package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/maxN.js +2 -4
  206. package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/minN.js +2 -4
  207. package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/reduce.js +1 -2
  208. package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/reverseArray.js +1 -2
  209. package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/sortArray.js +2 -4
  210. package/rust-client/node_modules/mingo/dist/esm/operators/expression/array/zip.js +4 -10
  211. package/rust-client/node_modules/mingo/dist/esm/operators/expression/bitwise/_internal.js +1 -2
  212. package/rust-client/node_modules/mingo/dist/esm/operators/expression/bitwise/bitNot.js +2 -4
  213. package/rust-client/node_modules/mingo/dist/esm/operators/expression/boolean/not.js +4 -6
  214. package/rust-client/node_modules/mingo/dist/esm/operators/expression/comparison/cmp.js +6 -5
  215. package/rust-client/node_modules/mingo/dist/esm/operators/expression/conditional/cond.js +2 -2
  216. package/rust-client/node_modules/mingo/dist/esm/operators/expression/conditional/ifNull.js +1 -1
  217. package/rust-client/node_modules/mingo/dist/esm/operators/expression/conditional/switch.js +1 -2
  218. package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/_internal.js +140 -61
  219. package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/dateAdd.js +2 -35
  220. package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/dateDiff.js +43 -21
  221. package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/dateFromParts.js +2 -4
  222. package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/dateFromString.js +13 -11
  223. package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/dateToString.js +2 -4
  224. package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/dateTrunc.js +97 -0
  225. package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/dayOfYear.js +2 -2
  226. package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/index.js +1 -0
  227. package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/isoWeekYear.js +2 -5
  228. package/rust-client/node_modules/mingo/dist/esm/operators/expression/date/week.js +1 -2
  229. package/rust-client/node_modules/mingo/dist/esm/operators/expression/misc/getField.js +1 -2
  230. package/rust-client/node_modules/mingo/dist/esm/operators/expression/object/mergeObjects.js +10 -3
  231. package/rust-client/node_modules/mingo/dist/esm/operators/expression/object/objectToArray.js +6 -2
  232. package/rust-client/node_modules/mingo/dist/esm/operators/expression/object/setField.js +11 -7
  233. package/rust-client/node_modules/mingo/dist/esm/operators/expression/set/setDifference.js +10 -2
  234. package/rust-client/node_modules/mingo/dist/esm/operators/expression/set/setEquals.js +18 -4
  235. package/rust-client/node_modules/mingo/dist/esm/operators/expression/set/setIntersection.js +3 -2
  236. package/rust-client/node_modules/mingo/dist/esm/operators/expression/set/setIsSubset.js +16 -2
  237. package/rust-client/node_modules/mingo/dist/esm/operators/expression/set/setUnion.js +5 -6
  238. package/rust-client/node_modules/mingo/dist/esm/operators/expression/string/_internal.js +4 -8
  239. package/rust-client/node_modules/mingo/dist/esm/operators/expression/string/concat.js +6 -3
  240. package/rust-client/node_modules/mingo/dist/esm/operators/expression/string/indexOfBytes.js +2 -4
  241. package/rust-client/node_modules/mingo/dist/esm/operators/expression/string/replaceAll.js +1 -2
  242. package/rust-client/node_modules/mingo/dist/esm/operators/expression/string/replaceOne.js +1 -2
  243. package/rust-client/node_modules/mingo/dist/esm/operators/expression/string/split.js +1 -2
  244. package/rust-client/node_modules/mingo/dist/esm/operators/expression/string/strcasecmp.js +1 -2
  245. package/rust-client/node_modules/mingo/dist/esm/operators/expression/string/substr.js +4 -14
  246. package/rust-client/node_modules/mingo/dist/esm/operators/expression/string/substrBytes.js +2 -4
  247. package/rust-client/node_modules/mingo/dist/esm/operators/expression/trignometry/atan2.js +2 -4
  248. package/rust-client/node_modules/mingo/dist/esm/operators/expression/trignometry/cosh.js +0 -1
  249. package/rust-client/node_modules/mingo/dist/esm/operators/expression/type/_internal.js +17 -11
  250. package/rust-client/node_modules/mingo/dist/esm/operators/expression/type/convert.js +3 -5
  251. package/rust-client/node_modules/mingo/dist/esm/operators/expression/type/toBool.js +2 -4
  252. package/rust-client/node_modules/mingo/dist/esm/operators/expression/type/toDate.js +4 -7
  253. package/rust-client/node_modules/mingo/dist/esm/operators/expression/type/toDouble.js +6 -11
  254. package/rust-client/node_modules/mingo/dist/esm/operators/expression/type/toInt.js +2 -5
  255. package/rust-client/node_modules/mingo/dist/esm/operators/expression/type/toLong.js +2 -5
  256. package/rust-client/node_modules/mingo/dist/esm/operators/expression/type/toString.js +12 -11
  257. package/rust-client/node_modules/mingo/dist/esm/operators/expression/type/type.js +12 -15
  258. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/addFields.js +1 -2
  259. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/bucket.js +54 -61
  260. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/bucketAuto.js +679 -66
  261. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/count.js +3 -3
  262. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/densify.js +183 -0
  263. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/graphLookup.js +55 -0
  264. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/group.js +6 -9
  265. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/index.js +2 -0
  266. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/limit.js +1 -3
  267. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/lookup.js +55 -11
  268. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/merge.js +9 -14
  269. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/out.js +2 -2
  270. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/project.js +21 -42
  271. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/redact.js +3 -1
  272. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/replaceWith.js +9 -2
  273. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/sample.js +1 -2
  274. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/setWindowFields.js +12 -23
  275. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/skip.js +1 -1
  276. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/sort.js +11 -20
  277. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/sortByCount.js +5 -3
  278. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/unionWith.js +2 -2
  279. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/unset.js +1 -2
  280. package/rust-client/node_modules/mingo/dist/esm/operators/pipeline/unwind.js +6 -9
  281. package/rust-client/node_modules/mingo/dist/esm/operators/projection/elemMatch.js +3 -4
  282. package/rust-client/node_modules/mingo/dist/esm/operators/projection/slice.js +2 -3
  283. package/rust-client/node_modules/mingo/dist/esm/operators/query/bitwise/_internal.js +4 -4
  284. package/rust-client/node_modules/mingo/dist/esm/operators/update/_internal.js +9 -14
  285. package/rust-client/node_modules/mingo/dist/esm/operators/update/addToSet.js +1 -2
  286. package/rust-client/node_modules/mingo/dist/esm/operators/update/bit.js +1 -2
  287. package/rust-client/node_modules/mingo/dist/esm/operators/update/max.js +1 -2
  288. package/rust-client/node_modules/mingo/dist/esm/operators/update/min.js +1 -2
  289. package/rust-client/node_modules/mingo/dist/esm/operators/update/pop.js +1 -2
  290. package/rust-client/node_modules/mingo/dist/esm/operators/update/pull.js +2 -4
  291. package/rust-client/node_modules/mingo/dist/esm/operators/update/push.js +3 -9
  292. package/rust-client/node_modules/mingo/dist/esm/operators/update/rename.js +1 -2
  293. package/rust-client/node_modules/mingo/dist/esm/operators/update/set.js +1 -2
  294. package/rust-client/node_modules/mingo/dist/esm/operators/update/unset.js +1 -2
  295. package/rust-client/node_modules/mingo/dist/esm/operators/window/_internal.js +2 -3
  296. package/rust-client/node_modules/mingo/dist/esm/operators/window/denseRank.js +8 -10
  297. package/rust-client/node_modules/mingo/dist/esm/operators/window/derivative.js +4 -6
  298. package/rust-client/node_modules/mingo/dist/esm/operators/window/documentNumber.js +1 -3
  299. package/rust-client/node_modules/mingo/dist/esm/operators/window/expMovingAvg.js +4 -6
  300. package/rust-client/node_modules/mingo/dist/esm/operators/window/integral.js +3 -4
  301. package/rust-client/node_modules/mingo/dist/esm/operators/window/linearFill.js +4 -6
  302. package/rust-client/node_modules/mingo/dist/esm/operators/window/locf.js +3 -4
  303. package/rust-client/node_modules/mingo/dist/esm/operators/window/rank.js +8 -10
  304. package/rust-client/node_modules/mingo/dist/esm/operators/window/shift.js +2 -2
  305. package/rust-client/node_modules/mingo/dist/esm/query.js +22 -32
  306. package/rust-client/node_modules/mingo/dist/esm/types.js +14 -0
  307. package/rust-client/node_modules/mingo/dist/esm/updater.js +5 -5
  308. package/rust-client/node_modules/mingo/dist/esm/util.js +263 -377
  309. package/rust-client/node_modules/mingo/dist/types/aggregator.d.ts +7 -9
  310. package/rust-client/node_modules/mingo/dist/types/core.d.ts +41 -52
  311. package/rust-client/node_modules/mingo/dist/types/cursor.d.ts +6 -12
  312. package/rust-client/node_modules/mingo/dist/types/index.d.ts +8 -4
  313. package/rust-client/node_modules/mingo/dist/types/init/basic.d.ts +1 -6
  314. package/rust-client/node_modules/mingo/dist/types/lazy.d.ts +19 -15
  315. package/rust-client/node_modules/mingo/dist/types/operators/_predicates.d.ts +20 -20
  316. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/accumulator.d.ts +1 -1
  317. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/addToSet.d.ts +1 -1
  318. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/avg.d.ts +1 -1
  319. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/bottom.d.ts +2 -2
  320. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/bottomN.d.ts +4 -4
  321. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/count.d.ts +1 -1
  322. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/covariancePop.d.ts +1 -1
  323. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/covarianceSamp.d.ts +1 -1
  324. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/first.d.ts +2 -2
  325. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/firstN.d.ts +1 -1
  326. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/last.d.ts +4 -4
  327. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/lastN.d.ts +1 -1
  328. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/max.d.ts +4 -5
  329. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/maxN.d.ts +1 -1
  330. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/mergeObjects.d.ts +1 -1
  331. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/min.d.ts +4 -5
  332. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/minN.d.ts +1 -1
  333. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/percentile.d.ts +1 -1
  334. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/push.d.ts +4 -4
  335. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/stdDevPop.d.ts +1 -1
  336. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/stdDevSamp.d.ts +1 -1
  337. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/sum.d.ts +5 -3
  338. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/top.d.ts +2 -2
  339. package/rust-client/node_modules/mingo/dist/types/operators/accumulator/topN.d.ts +4 -4
  340. package/rust-client/node_modules/mingo/dist/types/operators/expression/arithmetic/add.d.ts +1 -1
  341. package/rust-client/node_modules/mingo/dist/types/operators/expression/arithmetic/multiply.d.ts +1 -1
  342. package/rust-client/node_modules/mingo/dist/types/operators/expression/arithmetic/pow.d.ts +1 -1
  343. package/rust-client/node_modules/mingo/dist/types/operators/expression/arithmetic/subtract.d.ts +1 -0
  344. package/rust-client/node_modules/mingo/dist/types/operators/expression/array/arrayElemAt.d.ts +1 -1
  345. package/rust-client/node_modules/mingo/dist/types/operators/expression/array/concatArrays.d.ts +3 -3
  346. package/rust-client/node_modules/mingo/dist/types/operators/expression/array/filter.d.ts +1 -1
  347. package/rust-client/node_modules/mingo/dist/types/operators/expression/array/first.d.ts +0 -4
  348. package/rust-client/node_modules/mingo/dist/types/operators/expression/array/firstN.d.ts +1 -1
  349. package/rust-client/node_modules/mingo/dist/types/operators/expression/array/in.d.ts +2 -2
  350. package/rust-client/node_modules/mingo/dist/types/operators/expression/array/indexOfArray.d.ts +1 -1
  351. package/rust-client/node_modules/mingo/dist/types/operators/expression/array/isArray.d.ts +1 -1
  352. package/rust-client/node_modules/mingo/dist/types/operators/expression/array/last.d.ts +0 -4
  353. package/rust-client/node_modules/mingo/dist/types/operators/expression/array/lastN.d.ts +1 -1
  354. package/rust-client/node_modules/mingo/dist/types/operators/expression/array/map.d.ts +1 -1
  355. package/rust-client/node_modules/mingo/dist/types/operators/expression/array/maxN.d.ts +1 -1
  356. package/rust-client/node_modules/mingo/dist/types/operators/expression/array/minN.d.ts +1 -1
  357. package/rust-client/node_modules/mingo/dist/types/operators/expression/array/range.d.ts +1 -1
  358. package/rust-client/node_modules/mingo/dist/types/operators/expression/array/reduce.d.ts +2 -2
  359. package/rust-client/node_modules/mingo/dist/types/operators/expression/array/reverseArray.d.ts +1 -1
  360. package/rust-client/node_modules/mingo/dist/types/operators/expression/array/slice.d.ts +1 -1
  361. package/rust-client/node_modules/mingo/dist/types/operators/expression/date/_internal.d.ts +31 -9
  362. package/rust-client/node_modules/mingo/dist/types/operators/expression/date/dateFromString.d.ts +2 -2
  363. package/rust-client/node_modules/mingo/dist/types/operators/expression/date/dateToParts.d.ts +2 -2
  364. package/rust-client/node_modules/mingo/dist/types/operators/expression/date/dateTrunc.d.ts +12 -0
  365. package/rust-client/node_modules/mingo/dist/types/operators/expression/date/index.d.ts +1 -0
  366. package/rust-client/node_modules/mingo/dist/types/operators/expression/misc/rand.d.ts +2 -2
  367. package/rust-client/node_modules/mingo/dist/types/operators/expression/object/mergeObjects.d.ts +2 -2
  368. package/rust-client/node_modules/mingo/dist/types/operators/expression/percentile.d.ts +1 -1
  369. package/rust-client/node_modules/mingo/dist/types/operators/expression/set/setIsSubset.d.ts +3 -1
  370. package/rust-client/node_modules/mingo/dist/types/operators/expression/string/_internal.d.ts +4 -4
  371. package/rust-client/node_modules/mingo/dist/types/operators/expression/string/indexOfBytes.d.ts +1 -1
  372. package/rust-client/node_modules/mingo/dist/types/operators/expression/string/replaceAll.d.ts +1 -1
  373. package/rust-client/node_modules/mingo/dist/types/operators/expression/string/replaceOne.d.ts +1 -1
  374. package/rust-client/node_modules/mingo/dist/types/operators/expression/string/split.d.ts +1 -1
  375. package/rust-client/node_modules/mingo/dist/types/operators/expression/string/strLenBytes.d.ts +1 -1
  376. package/rust-client/node_modules/mingo/dist/types/operators/expression/string/strLenCP.d.ts +1 -1
  377. package/rust-client/node_modules/mingo/dist/types/operators/expression/string/substrBytes.d.ts +2 -0
  378. package/rust-client/node_modules/mingo/dist/types/operators/expression/type/_internal.d.ts +6 -2
  379. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/_internal.d.ts +4 -4
  380. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/addFields.d.ts +8 -5
  381. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/bucket.d.ts +8 -5
  382. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/bucketAuto.d.ts +8 -7
  383. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/count.d.ts +7 -5
  384. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/densify.d.ts +12 -0
  385. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/facet.d.ts +7 -1
  386. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/fill.d.ts +6 -3
  387. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/graphLookup.d.ts +13 -0
  388. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/group.d.ts +4 -2
  389. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/index.d.ts +2 -0
  390. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/limit.d.ts +3 -1
  391. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/lookup.d.ts +4 -2
  392. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/match.d.ts +4 -3
  393. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/merge.d.ts +3 -5
  394. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/out.d.ts +5 -3
  395. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/project.d.ts +4 -3
  396. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/redact.d.ts +1 -1
  397. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/replaceRoot.d.ts +5 -5
  398. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/replaceWith.d.ts +8 -1
  399. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/sample.d.ts +7 -5
  400. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/setWindowFields.d.ts +7 -5
  401. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/skip.d.ts +6 -4
  402. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/sort.d.ts +5 -3
  403. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/sortByCount.d.ts +5 -5
  404. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/unionWith.d.ts +3 -1
  405. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/unset.d.ts +2 -0
  406. package/rust-client/node_modules/mingo/dist/types/operators/pipeline/unwind.d.ts +5 -2
  407. package/rust-client/node_modules/mingo/dist/types/operators/query/evaluation/expr.d.ts +2 -2
  408. package/rust-client/node_modules/mingo/dist/types/operators/query/evaluation/jsonSchema.d.ts +2 -2
  409. package/rust-client/node_modules/mingo/dist/types/operators/query/evaluation/where.d.ts +2 -2
  410. package/rust-client/node_modules/mingo/dist/types/operators/update/_internal.d.ts +5 -5
  411. package/rust-client/node_modules/mingo/dist/types/operators/update/addToSet.d.ts +2 -2
  412. package/rust-client/node_modules/mingo/dist/types/operators/update/bit.d.ts +2 -2
  413. package/rust-client/node_modules/mingo/dist/types/operators/update/currentDate.d.ts +2 -2
  414. package/rust-client/node_modules/mingo/dist/types/operators/update/inc.d.ts +2 -2
  415. package/rust-client/node_modules/mingo/dist/types/operators/update/max.d.ts +2 -2
  416. package/rust-client/node_modules/mingo/dist/types/operators/update/min.d.ts +2 -2
  417. package/rust-client/node_modules/mingo/dist/types/operators/update/mul.d.ts +2 -2
  418. package/rust-client/node_modules/mingo/dist/types/operators/update/pop.d.ts +2 -2
  419. package/rust-client/node_modules/mingo/dist/types/operators/update/pull.d.ts +2 -2
  420. package/rust-client/node_modules/mingo/dist/types/operators/update/pullAll.d.ts +2 -2
  421. package/rust-client/node_modules/mingo/dist/types/operators/update/push.d.ts +2 -2
  422. package/rust-client/node_modules/mingo/dist/types/operators/update/rename.d.ts +2 -2
  423. package/rust-client/node_modules/mingo/dist/types/operators/update/set.d.ts +2 -2
  424. package/rust-client/node_modules/mingo/dist/types/operators/update/unset.d.ts +2 -2
  425. package/rust-client/node_modules/mingo/dist/types/operators/window/_internal.d.ts +5 -5
  426. package/rust-client/node_modules/mingo/dist/types/operators/window/denseRank.d.ts +2 -3
  427. package/rust-client/node_modules/mingo/dist/types/operators/window/derivative.d.ts +2 -3
  428. package/rust-client/node_modules/mingo/dist/types/operators/window/documentNumber.d.ts +2 -2
  429. package/rust-client/node_modules/mingo/dist/types/operators/window/expMovingAvg.d.ts +2 -2
  430. package/rust-client/node_modules/mingo/dist/types/operators/window/integral.d.ts +2 -2
  431. package/rust-client/node_modules/mingo/dist/types/operators/window/linearFill.d.ts +2 -2
  432. package/rust-client/node_modules/mingo/dist/types/operators/window/locf.d.ts +2 -2
  433. package/rust-client/node_modules/mingo/dist/types/operators/window/rank.d.ts +2 -2
  434. package/rust-client/node_modules/mingo/dist/types/operators/window/shift.d.ts +2 -2
  435. package/rust-client/node_modules/mingo/dist/types/query.d.ts +5 -7
  436. package/rust-client/node_modules/mingo/dist/types/types.d.ts +18 -15
  437. package/rust-client/node_modules/mingo/dist/types/updater.d.ts +9 -10
  438. package/rust-client/node_modules/mingo/dist/types/util.d.ts +102 -90
  439. 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 JS_SIMPLE_TYPES = /* @__PURE__ */ new Set([
92
- "null",
93
- "undefined",
94
- "boolean",
95
- "number",
96
- "string",
97
- "date",
98
- "regexp"
99
- ]);
100
- const SORT_ORDER_BY_TYPE = {
101
- null: 0,
102
- undefined: 0,
103
- number: 1,
104
- string: 2,
105
- object: 3,
106
- array: 4,
107
- boolean: 5,
108
- date: 6,
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
- a = void 0;
115
- if (b === MISSING)
116
- b = void 0;
117
- const [u, v] = [a, b].map(
118
- (n) => SORT_ORDER_BY_TYPE[getType(n).toLowerCase()]
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 getType = (v) => OBJECT_TYPE_RE.exec(Object.prototype.toString.call(v))[1];
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
- return false;
152
- const proto = Object.getPrototypeOf(v);
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) => v === Object(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 instanceof Array && x.length === 0 || isObject(x) && Object.keys(x).length === 0;
164
- const isMissing = (v) => v === MISSING;
165
- const ensureArray = (x) => x instanceof Array ? x : [x];
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 INSTANCE_CLONE = [isDate, isRegExp, isTypedArray];
169
- const cloneInternal = (val, refs) => {
170
- if (isNil(val))
171
- return val;
172
- if (refs.has(val))
173
- throw CYCLE_FOUND_ERROR;
174
- const ctor = val.constructor;
175
- if (INSTANCE_CLONE.some((f) => f(val)))
176
- return new ctor(val);
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
- refs.add(val);
179
- if (isArray(val))
180
- return val.map((v) => cloneInternal(v, refs));
181
- if (isObject(val)) {
182
- const res = {};
183
- for (const k in val)
184
- res[k] = cloneInternal(val[k], refs);
185
- return res;
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(val);
237
+ refs.delete(v);
189
238
  }
190
- return val;
239
+ return v;
191
240
  };
192
- const cloneDeep = (obj) => cloneInternal(obj, /* @__PURE__ */ new Set());
193
- const mergeable = (left, right) => isObject(left) && isObject(right) || isArray(left) && isArray(right);
194
- function merge(target, obj, options) {
195
- options = options || { flatten: false };
196
- if (isMissing(target) || isNil(target))
197
- return obj;
198
- if (isMissing(obj) || isNil(obj))
199
- return target;
200
- if (!mergeable(target, obj)) {
201
- if (options.skipValidation)
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
- options.skipValidation = true;
206
- if (isArray(target)) {
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
- if (input.some((arr) => arr.length == 0))
248
- return [];
249
- if (input.length === 1)
250
- return Array.from(input);
251
- const sortedIndex = sortBy(
252
- input.map((a, i) => [i, a.length]),
253
- (a) => a[1]
254
- );
255
- const smallest = input[sortedIndex[0][0]];
256
- const map = buildHashIndex(smallest, hashFunction);
257
- const rmap = /* @__PURE__ */ new Map();
258
- const results = new Array();
259
- map.forEach((v, k) => {
260
- const lhs = v.map((j) => smallest[j]);
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 = 0) {
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
- return false;
346
- if ((/* @__PURE__ */ new Set([...aKeys, ...bKeys])).size != aKeys.length)
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 = Object.getPrototypeOf(a);
354
- const cmp = isTypedArray(a) || proto !== Object.prototype && proto !== Array.prototype && Object.prototype.hasOwnProperty.call(proto, "toString");
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 result = input.map((_) => MISSING);
359
- buildHashIndex(input, hashFunction).forEach((v, _) => {
360
- v.forEach((i) => result[i] = input[i]);
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 toString = (v, cycle) => {
365
- if (v === null)
366
- return "null";
367
- if (v === void 0)
368
- return "undefined";
369
- const ctor = v.constructor;
370
- switch (ctor) {
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 ctor.name + "[" + v.toString() + "]";
384
- if (cycle.has(v))
385
- throw CYCLE_FOUND_ERROR;
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
- cycle.add(v);
388
- if (isArray(v)) {
389
- return "[" + v.map((s) => toString(s, cycle)).join(",") + "]";
390
- }
391
- if (ctor === Object) {
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 !== Object.prototype && proto !== Array.prototype && Object.prototype.hasOwnProperty.call(proto, "toString")) {
396
- return ctor.name + "(" + JSON.stringify(v.toString()) + ")";
329
+ if (proto !== objectProto && proto !== arrayProto && has(proto, "toString")) {
330
+ return typeOf(v) + "(" + JSON.stringify(v.toString()) + ")";
397
331
  }
398
- const [members, _] = getMembersOf(v);
399
- return ctor.name + toString(members, cycle);
332
+ throw new Error(
333
+ "mingo: cannot stringify custom type without explicit toString() method."
334
+ );
400
335
  } finally {
401
- cycle.delete(v);
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
- if (isNil(value))
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 instanceof Array) {
465
- return rest.reduce(
466
- (acc, arr) => {
467
- let i = Math.ceil(arr.length / MAX_ARRAY_PUSH);
468
- let begin = 0;
469
- while (i-- > 0) {
470
- Array.prototype.push.apply(
471
- acc,
472
- arr.slice(begin, begin + MAX_ARRAY_PUSH)
473
- );
474
- begin += MAX_ARRAY_PUSH;
475
- }
476
- return acc;
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 isObjectLike(obj) ? obj[key] : void 0;
397
+ return isArray(obj) || isObject(obj) ? obj[key] : void 0;
502
398
  }
503
399
  function unwrap(arr, depth) {
504
- if (depth < 1)
505
- return arr;
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 instanceof Array) {
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 result = JS_SIMPLE_TYPES.has(getType(obj).toLowerCase()) ? obj : resolve2(obj, selector.split("."));
538
- return result instanceof Array && options?.unwrapArray ? unwrap(result, depth) : result;
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 names = selector.split(".");
542
- const key = names[0];
543
- const next = names.slice(1).join(".");
544
- const isIndex = /^\d+$/.exec(key) !== null;
545
- const hasNext = names.length > 1;
546
- let result;
547
- let value;
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
- result = getValue(obj, Number(key));
440
+ const index = parseInt(key);
441
+ let value2 = getValue(obj, index);
551
442
  if (hasNext) {
552
- result = resolveGraph(result, next, options);
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
- value = resolveGraph(item, selector, options);
452
+ const value2 = resolveGraph(item, selector, options);
559
453
  if (options?.preserveMissing) {
560
- if (value === void 0) {
561
- value = MISSING;
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
- } else {
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
- return result;
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 instanceof Array) {
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 instanceof Array && options?.descendArray && !isNextArrayIndex) {
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 instanceof Array) {
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 (JS_SIMPLE_TYPES.has(getType(expr).toLowerCase())) {
548
+ if (isScalar(expr)) {
660
549
  return isRegExp(expr) ? { $regex: expr } : { $eq: expr };
661
550
  }
662
551
  if (isObjectLike(expr)) {
663
- const exprObj = expr;
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 (compare(item, sorted[mid]) < 0) {
570
+ if (comparator(item, sorted[mid]) < 0) {
685
571
  hi = mid - 1;
686
- } else if (compare(item, sorted[mid]) > 0) {
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
  });