@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
|
@@ -20,77 +20,108 @@ __export(internal_exports, {
|
|
|
20
20
|
DATE_FORMAT: () => DATE_FORMAT,
|
|
21
21
|
DATE_PART_INTERVAL: () => DATE_PART_INTERVAL,
|
|
22
22
|
DATE_SYM_TABLE: () => DATE_SYM_TABLE,
|
|
23
|
-
|
|
23
|
+
DAYS_OF_WEEK: () => DAYS_OF_WEEK,
|
|
24
|
+
DAYS_OF_WEEK_SET: () => DAYS_OF_WEEK_SET,
|
|
25
|
+
DAYS_PER_WEEK: () => DAYS_PER_WEEK,
|
|
26
|
+
LEAP_YEAR_REF_POINT: () => LEAP_YEAR_REF_POINT,
|
|
24
27
|
MILLIS_PER_DAY: () => MILLIS_PER_DAY,
|
|
25
28
|
MINUTES_PER_HOUR: () => MINUTES_PER_HOUR,
|
|
29
|
+
TIMEUNIT_IN_MILLIS: () => TIMEUNIT_IN_MILLIS,
|
|
26
30
|
adjustDate: () => adjustDate,
|
|
27
31
|
computeDate: () => computeDate,
|
|
32
|
+
dateAdd: () => dateAdd,
|
|
33
|
+
dateDiffDay: () => dateDiffDay,
|
|
34
|
+
dateDiffHour: () => dateDiffHour,
|
|
35
|
+
dateDiffMonth: () => dateDiffMonth,
|
|
36
|
+
dateDiffQuarter: () => dateDiffQuarter,
|
|
37
|
+
dateDiffWeek: () => dateDiffWeek,
|
|
38
|
+
dateDiffYear: () => dateDiffYear,
|
|
39
|
+
dayOfYear: () => dayOfYear,
|
|
40
|
+
daysBetweenYears: () => daysBetweenYears,
|
|
41
|
+
daysInMonth: () => daysInMonth,
|
|
42
|
+
daysInYear: () => daysInYear,
|
|
28
43
|
formatTimezone: () => formatTimezone,
|
|
29
|
-
getDayOfYear: () => getDayOfYear,
|
|
30
44
|
isLeapYear: () => isLeapYear,
|
|
31
45
|
isoWeek: () => isoWeek,
|
|
32
46
|
isoWeekYear: () => isoWeekYear,
|
|
47
|
+
isoWeekday: () => isoWeekday,
|
|
33
48
|
padDigits: () => padDigits,
|
|
34
|
-
parseTimezone: () => parseTimezone
|
|
35
|
-
regexQuote: () => regexQuote,
|
|
36
|
-
regexStrip: () => regexStrip
|
|
49
|
+
parseTimezone: () => parseTimezone
|
|
37
50
|
});
|
|
38
51
|
module.exports = __toCommonJS(internal_exports);
|
|
39
52
|
var import_core = require("../../../core");
|
|
40
53
|
var import_util = require("../../../util");
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
181,
|
|
49
|
-
212,
|
|
50
|
-
243,
|
|
51
|
-
273,
|
|
52
|
-
304,
|
|
53
|
-
334
|
|
54
|
+
const LEAP_YEAR_REF_POINT = -1e9;
|
|
55
|
+
const DAYS_PER_WEEK = 7;
|
|
56
|
+
const isLeapYear = (y) => (y & 3) == 0 && (y % 100 != 0 || y % 400 == 0);
|
|
57
|
+
const DAYS_IN_YEAR = [
|
|
58
|
+
365,
|
|
59
|
+
366
|
|
60
|
+
/*leap*/
|
|
54
61
|
];
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
182,
|
|
63
|
-
|
|
64
|
-
244,
|
|
65
|
-
274,
|
|
66
|
-
305,
|
|
67
|
-
335
|
|
62
|
+
const daysInYear = (year) => DAYS_IN_YEAR[+isLeapYear(year)];
|
|
63
|
+
const DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
64
|
+
const daysInMonth = (d) => DAYS_IN_MONTH[d.getUTCMonth()] + Number(
|
|
65
|
+
d.getUTCMonth() === 1 && isLeapYear(d.getUTCFullYear())
|
|
66
|
+
);
|
|
67
|
+
const YEAR_DAYS_OFFSET = [
|
|
68
|
+
[0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],
|
|
69
|
+
[0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]
|
|
70
|
+
/*leap*/
|
|
68
71
|
];
|
|
72
|
+
const dayOfYear = (d) => YEAR_DAYS_OFFSET[+isLeapYear(d.getUTCFullYear())][d.getUTCMonth()] + d.getUTCDate();
|
|
73
|
+
const isoWeekday = (date, startOfWeek = "sun") => {
|
|
74
|
+
const dow = date.getUTCDay() || 7;
|
|
75
|
+
return (dow - ISO_WEEKDAY_MAP[startOfWeek] + DAYS_PER_WEEK) % DAYS_PER_WEEK;
|
|
76
|
+
};
|
|
69
77
|
const p = (y) => (y + Math.floor(y / 4) - Math.floor(y / 100) + Math.floor(y / 400)) % 7;
|
|
70
78
|
const weeks = (y) => 52 + Number(p(y) == 4 || p(y - 1) == 3);
|
|
71
|
-
const isLeapYear = (year) => (year & 3) == 0 && (year % 100 != 0 || year % 400 == 0);
|
|
72
|
-
const getDayOfYear = (d) => (isLeapYear(d.getUTCFullYear()) ? LEAP_YEAR_DAYS_OFFSET : COMMON_YEAR_DAYS_OFFSET)[d.getUTCMonth()] + d.getUTCDate();
|
|
73
79
|
function isoWeek(d) {
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (w > weeks(d.getUTCFullYear()))
|
|
78
|
-
return 1;
|
|
80
|
+
const dow = d.getUTCDay() || 7;
|
|
81
|
+
const w = Math.floor((10 + dayOfYear(d) - dow) / 7);
|
|
82
|
+
if (w < 1) return weeks(d.getUTCFullYear() - 1);
|
|
83
|
+
if (w > weeks(d.getUTCFullYear())) return 1;
|
|
79
84
|
return w;
|
|
80
85
|
}
|
|
81
86
|
function isoWeekYear(d) {
|
|
82
|
-
return d.getUTCFullYear() - Number(d.getUTCMonth()
|
|
87
|
+
return d.getUTCFullYear() - Number(d.getUTCMonth() === 0 && d.getUTCDate() == 1 && d.getUTCDay() < 1);
|
|
83
88
|
}
|
|
84
89
|
const MINUTES_PER_HOUR = 60;
|
|
85
90
|
const MILLIS_PER_DAY = 1e3 * 60 * 60 * 24;
|
|
86
|
-
const
|
|
87
|
-
week: MILLIS_PER_DAY *
|
|
91
|
+
const TIMEUNIT_IN_MILLIS = {
|
|
92
|
+
week: MILLIS_PER_DAY * DAYS_PER_WEEK,
|
|
88
93
|
day: MILLIS_PER_DAY,
|
|
89
94
|
hour: 1e3 * 60 * 60,
|
|
90
95
|
minute: 1e3 * 60,
|
|
91
96
|
second: 1e3,
|
|
92
97
|
millisecond: 1
|
|
93
98
|
};
|
|
99
|
+
const DAYS_OF_WEEK = [
|
|
100
|
+
"monday",
|
|
101
|
+
"mon",
|
|
102
|
+
"tuesday",
|
|
103
|
+
"tue",
|
|
104
|
+
"wednesday",
|
|
105
|
+
"wed",
|
|
106
|
+
"thursday",
|
|
107
|
+
"thu",
|
|
108
|
+
"friday",
|
|
109
|
+
"fri",
|
|
110
|
+
"saturday",
|
|
111
|
+
"sat",
|
|
112
|
+
"sunday",
|
|
113
|
+
"sun"
|
|
114
|
+
];
|
|
115
|
+
const DAYS_OF_WEEK_SET = new Set(DAYS_OF_WEEK);
|
|
116
|
+
const ISO_WEEKDAY_MAP = Object.freeze({
|
|
117
|
+
mon: 1,
|
|
118
|
+
tue: 2,
|
|
119
|
+
wed: 3,
|
|
120
|
+
thu: 4,
|
|
121
|
+
fri: 5,
|
|
122
|
+
sat: 6,
|
|
123
|
+
sun: 7
|
|
124
|
+
});
|
|
94
125
|
const DATE_FORMAT = "%Y-%m-%dT%H:%M:%S.%LZ";
|
|
95
126
|
const DATE_PART_INTERVAL = [
|
|
96
127
|
["year", 0, 9999],
|
|
@@ -101,7 +132,7 @@ const DATE_PART_INTERVAL = [
|
|
|
101
132
|
["second", 0, 59],
|
|
102
133
|
["millisecond", 0, 999]
|
|
103
134
|
];
|
|
104
|
-
const DATE_SYM_TABLE = {
|
|
135
|
+
const DATE_SYM_TABLE = Object.freeze({
|
|
105
136
|
"%Y": { name: "year", padding: 4, re: /([0-9]{4})/ },
|
|
106
137
|
"%G": { name: "year", padding: 4, re: /([0-9]{4})/ },
|
|
107
138
|
"%m": { name: "month", padding: 2, re: /(0[1-9]|1[012])/ },
|
|
@@ -120,13 +151,20 @@ const DATE_SYM_TABLE = {
|
|
|
120
151
|
},
|
|
121
152
|
"%Z": { name: "minuteOffset", padding: 3, re: /([+-][0-9]{3})/ }
|
|
122
153
|
// "%%": "%",
|
|
123
|
-
};
|
|
154
|
+
});
|
|
155
|
+
const TIMEZONE_RE = /^[a-zA-Z_]+\/[a-zA-Z_]+$/;
|
|
124
156
|
function parseTimezone(tzstr) {
|
|
125
|
-
if ((0, import_util.isNil)(tzstr))
|
|
126
|
-
|
|
157
|
+
if ((0, import_util.isNil)(tzstr)) return 0;
|
|
158
|
+
if (TIMEZONE_RE.test(tzstr)) {
|
|
159
|
+
const date = /* @__PURE__ */ new Date();
|
|
160
|
+
const utcDate = new Date(date.toLocaleString("en-US", { timeZone: "UTC" }));
|
|
161
|
+
const tzDate = new Date(date.toLocaleString("en-US", { timeZone: tzstr }));
|
|
162
|
+
return (tzDate.getTime() - utcDate.getTime()) / 6e4;
|
|
163
|
+
}
|
|
127
164
|
const m = DATE_SYM_TABLE["%z"].re.exec(tzstr);
|
|
128
|
-
if (!m)
|
|
129
|
-
throw
|
|
165
|
+
if (!m) {
|
|
166
|
+
throw new import_util.MingoError(`Timezone '${tzstr}' is invalid or not supported`);
|
|
167
|
+
}
|
|
130
168
|
const hr = parseInt(m[2]) || 0;
|
|
131
169
|
const min = parseInt(m[3]) || 0;
|
|
132
170
|
return (Math.abs(hr * MINUTES_PER_HOUR) + min) * (hr < 0 ? -1 : 1);
|
|
@@ -138,11 +176,10 @@ function adjustDate(d, minuteOffset) {
|
|
|
138
176
|
d.setUTCMinutes(d.getUTCMinutes() + minuteOffset);
|
|
139
177
|
}
|
|
140
178
|
function computeDate(obj, expr, options) {
|
|
179
|
+
if ((0, import_util.isDate)(obj)) return obj;
|
|
141
180
|
const d = (0, import_core.computeValue)(obj, expr, null, options);
|
|
142
|
-
if ((0, import_util.isDate)(d))
|
|
143
|
-
|
|
144
|
-
if ((0, import_util.isNumber)(d))
|
|
145
|
-
return new Date(d * 1e3);
|
|
181
|
+
if ((0, import_util.isDate)(d)) return new Date(d);
|
|
182
|
+
if ((0, import_util.isNumber)(d)) return new Date(d * 1e3);
|
|
146
183
|
if (d.date) {
|
|
147
184
|
const date = (0, import_util.isDate)(d.date) ? new Date(d.date) : new Date(d.date * 1e3);
|
|
148
185
|
if (d.timezone) {
|
|
@@ -150,37 +187,92 @@ function computeDate(obj, expr, options) {
|
|
|
150
187
|
}
|
|
151
188
|
return date;
|
|
152
189
|
}
|
|
153
|
-
throw Error(`cannot convert ${expr
|
|
190
|
+
throw Error(`cannot convert ${JSON.stringify(expr)} to date`);
|
|
154
191
|
}
|
|
155
192
|
function padDigits(n, digits) {
|
|
156
193
|
return new Array(Math.max(digits - String(n).length + 1, 0)).join("0") + n.toString();
|
|
157
194
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
195
|
+
const leapYearsSinceReferencePoint = (year) => {
|
|
196
|
+
const yearsSinceReferencePoint = year - LEAP_YEAR_REF_POINT;
|
|
197
|
+
return Math.trunc(yearsSinceReferencePoint / 4) - Math.trunc(yearsSinceReferencePoint / 100) + Math.trunc(yearsSinceReferencePoint / 400);
|
|
198
|
+
};
|
|
199
|
+
function daysBetweenYears(startYear, endYear) {
|
|
200
|
+
return Math.trunc(
|
|
201
|
+
leapYearsSinceReferencePoint(endYear - 1) - leapYearsSinceReferencePoint(startYear - 1) + (endYear - startYear) * DAYS_IN_YEAR[0]
|
|
202
|
+
);
|
|
166
203
|
}
|
|
204
|
+
const dateDiffYear = (start, end) => end.getUTCFullYear() - start.getUTCFullYear();
|
|
205
|
+
const dateDiffMonth = (start, end) => end.getUTCMonth() - start.getUTCMonth() + dateDiffYear(start, end) * 12;
|
|
206
|
+
const dateDiffQuarter = (start, end) => {
|
|
207
|
+
const a = Math.trunc(start.getUTCMonth() / 3);
|
|
208
|
+
const b = Math.trunc(end.getUTCMonth() / 3);
|
|
209
|
+
return b - a + dateDiffYear(start, end) * 4;
|
|
210
|
+
};
|
|
211
|
+
const dateDiffDay = (start, end) => dayOfYear(end) - dayOfYear(start) + daysBetweenYears(start.getUTCFullYear(), end.getUTCFullYear());
|
|
212
|
+
const dateDiffWeek = (start, end, startOfWeek) => {
|
|
213
|
+
const wk = (startOfWeek || "sun").substring(0, 3);
|
|
214
|
+
return Math.trunc(
|
|
215
|
+
(dateDiffDay(start, end) + isoWeekday(start, wk) - isoWeekday(end, wk)) / DAYS_PER_WEEK
|
|
216
|
+
);
|
|
217
|
+
};
|
|
218
|
+
const dateDiffHour = (start, end) => end.getUTCHours() - start.getUTCHours() + dateDiffDay(start, end) * 24;
|
|
219
|
+
const addMonth = (d, amount) => {
|
|
220
|
+
const m = d.getUTCMonth() + amount;
|
|
221
|
+
const yearOffset = Math.floor(m / 12);
|
|
222
|
+
if (m < 0) {
|
|
223
|
+
const month = m % 12 + 12;
|
|
224
|
+
d.setUTCFullYear(d.getUTCFullYear() + yearOffset, month, d.getUTCDate());
|
|
225
|
+
} else {
|
|
226
|
+
d.setUTCFullYear(d.getUTCFullYear() + yearOffset, m % 12, d.getUTCDate());
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
const dateAdd = (date, unit, amount, _timezone) => {
|
|
230
|
+
const d = new Date(date);
|
|
231
|
+
switch (unit) {
|
|
232
|
+
case "year":
|
|
233
|
+
d.setUTCFullYear(d.getUTCFullYear() + amount);
|
|
234
|
+
break;
|
|
235
|
+
case "quarter":
|
|
236
|
+
addMonth(d, 3 * amount);
|
|
237
|
+
break;
|
|
238
|
+
case "month":
|
|
239
|
+
addMonth(d, amount);
|
|
240
|
+
break;
|
|
241
|
+
default:
|
|
242
|
+
d.setTime(d.getTime() + TIMEUNIT_IN_MILLIS[unit] * amount);
|
|
243
|
+
}
|
|
244
|
+
return d;
|
|
245
|
+
};
|
|
167
246
|
// Annotate the CommonJS export names for ESM import in node:
|
|
168
247
|
0 && (module.exports = {
|
|
169
248
|
DATE_FORMAT,
|
|
170
249
|
DATE_PART_INTERVAL,
|
|
171
250
|
DATE_SYM_TABLE,
|
|
172
|
-
|
|
251
|
+
DAYS_OF_WEEK,
|
|
252
|
+
DAYS_OF_WEEK_SET,
|
|
253
|
+
DAYS_PER_WEEK,
|
|
254
|
+
LEAP_YEAR_REF_POINT,
|
|
173
255
|
MILLIS_PER_DAY,
|
|
174
256
|
MINUTES_PER_HOUR,
|
|
257
|
+
TIMEUNIT_IN_MILLIS,
|
|
175
258
|
adjustDate,
|
|
176
259
|
computeDate,
|
|
260
|
+
dateAdd,
|
|
261
|
+
dateDiffDay,
|
|
262
|
+
dateDiffHour,
|
|
263
|
+
dateDiffMonth,
|
|
264
|
+
dateDiffQuarter,
|
|
265
|
+
dateDiffWeek,
|
|
266
|
+
dateDiffYear,
|
|
267
|
+
dayOfYear,
|
|
268
|
+
daysBetweenYears,
|
|
269
|
+
daysInMonth,
|
|
270
|
+
daysInYear,
|
|
177
271
|
formatTimezone,
|
|
178
|
-
getDayOfYear,
|
|
179
272
|
isLeapYear,
|
|
180
273
|
isoWeek,
|
|
181
274
|
isoWeekYear,
|
|
275
|
+
isoWeekday,
|
|
182
276
|
padDigits,
|
|
183
|
-
parseTimezone
|
|
184
|
-
regexQuote,
|
|
185
|
-
regexStrip
|
|
277
|
+
parseTimezone
|
|
186
278
|
});
|
|
@@ -24,36 +24,8 @@ var import_core = require("../../../core");
|
|
|
24
24
|
var import_internal = require("./_internal");
|
|
25
25
|
const $dateAdd = (obj, expr, options) => {
|
|
26
26
|
const args = (0, import_core.computeValue)(obj, expr, null, options);
|
|
27
|
-
|
|
28
|
-
switch (args.unit) {
|
|
29
|
-
case "year":
|
|
30
|
-
d.setUTCFullYear(d.getUTCFullYear() + args.amount);
|
|
31
|
-
break;
|
|
32
|
-
case "quarter":
|
|
33
|
-
addMonth(d, 3 * args.amount);
|
|
34
|
-
break;
|
|
35
|
-
case "month":
|
|
36
|
-
addMonth(d, args.amount);
|
|
37
|
-
break;
|
|
38
|
-
default:
|
|
39
|
-
d.setTime(d.getTime() + import_internal.DURATION_IN_MILLIS[args.unit] * args.amount);
|
|
40
|
-
}
|
|
41
|
-
if (args.timezone) {
|
|
42
|
-
const tz = (0, import_internal.parseTimezone)(args.timezone);
|
|
43
|
-
(0, import_internal.adjustDate)(d, tz);
|
|
44
|
-
}
|
|
45
|
-
return d;
|
|
27
|
+
return (0, import_internal.dateAdd)(args.startDate, args.unit, args.amount, args.timezone);
|
|
46
28
|
};
|
|
47
|
-
function addMonth(d, amount) {
|
|
48
|
-
const m = d.getUTCMonth() + amount;
|
|
49
|
-
const yearOffset = Math.floor(m / 12);
|
|
50
|
-
if (m < 0) {
|
|
51
|
-
const month = m % 12 + 12;
|
|
52
|
-
d.setUTCFullYear(d.getUTCFullYear() + yearOffset, month, d.getUTCDate());
|
|
53
|
-
} else {
|
|
54
|
-
d.setUTCFullYear(d.getUTCFullYear() + yearOffset, m % 12, d.getUTCDate());
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
29
|
// Annotate the CommonJS export names for ESM import in node:
|
|
58
30
|
0 && (module.exports = {
|
|
59
31
|
$dateAdd
|
|
@@ -23,32 +23,44 @@ module.exports = __toCommonJS(dateDiff_exports);
|
|
|
23
23
|
var import_core = require("../../../core");
|
|
24
24
|
var import_internal = require("./_internal");
|
|
25
25
|
const $dateDiff = (obj, expr, options) => {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
const { startDate, endDate, unit, timezone, startOfWeek } = (0, import_core.computeValue)(
|
|
27
|
+
obj,
|
|
28
|
+
expr,
|
|
29
|
+
null,
|
|
30
|
+
options
|
|
31
|
+
);
|
|
32
|
+
const d1 = new Date(startDate);
|
|
33
|
+
const d2 = new Date(endDate);
|
|
34
|
+
const minuteOffset = (0, import_internal.parseTimezone)(timezone);
|
|
35
|
+
(0, import_internal.adjustDate)(d1, minuteOffset);
|
|
36
|
+
(0, import_internal.adjustDate)(d2, minuteOffset);
|
|
37
|
+
switch (unit) {
|
|
31
38
|
case "year":
|
|
39
|
+
return (0, import_internal.dateDiffYear)(d1, d2);
|
|
32
40
|
case "quarter":
|
|
41
|
+
return (0, import_internal.dateDiffQuarter)(d1, d2);
|
|
33
42
|
case "month":
|
|
34
|
-
|
|
35
|
-
|
|
43
|
+
return (0, import_internal.dateDiffMonth)(d1, d2);
|
|
44
|
+
case "week":
|
|
45
|
+
return (0, import_internal.dateDiffWeek)(d1, d2, startOfWeek);
|
|
46
|
+
case "day":
|
|
47
|
+
return (0, import_internal.dateDiffDay)(d1, d2);
|
|
48
|
+
case "hour":
|
|
49
|
+
return (0, import_internal.dateDiffHour)(d1, d2);
|
|
50
|
+
case "minute":
|
|
51
|
+
d1.setUTCSeconds(0);
|
|
52
|
+
d1.setUTCMilliseconds(0);
|
|
53
|
+
d2.setUTCSeconds(0);
|
|
54
|
+
d2.setUTCMilliseconds(0);
|
|
55
|
+
return Math.round(
|
|
56
|
+
(d2.getTime() - d1.getTime()) / import_internal.TIMEUNIT_IN_MILLIS[unit]
|
|
57
|
+
);
|
|
36
58
|
default:
|
|
37
|
-
|
|
59
|
+
return Math.round(
|
|
60
|
+
(d2.getTime() - d1.getTime()) / import_internal.TIMEUNIT_IN_MILLIS[unit]
|
|
61
|
+
);
|
|
38
62
|
}
|
|
39
|
-
return diff;
|
|
40
63
|
};
|
|
41
|
-
const unitMonths = {
|
|
42
|
-
year: 12,
|
|
43
|
-
quarter: 3,
|
|
44
|
-
month: 1
|
|
45
|
-
};
|
|
46
|
-
function diffYQM(d1, d2, unit) {
|
|
47
|
-
let months = (d2.getUTCFullYear() - d1.getUTCFullYear()) * 12;
|
|
48
|
-
months -= d1.getUTCMonth();
|
|
49
|
-
months += d2.getUTCMonth();
|
|
50
|
-
return Math.trunc(months / unitMonths[unit]);
|
|
51
|
-
}
|
|
52
64
|
// Annotate the CommonJS export names for ESM import in node:
|
|
53
65
|
0 && (module.exports = {
|
|
54
66
|
$dateDiff
|
|
@@ -37,10 +37,8 @@ const $dateFromParts = (obj, expr, options) => {
|
|
|
37
37
|
let part = (args[k] || 0) + remainder;
|
|
38
38
|
remainder = 0;
|
|
39
39
|
const limit = max + 1;
|
|
40
|
-
if (k == "hour")
|
|
41
|
-
|
|
42
|
-
if (k == "minute")
|
|
43
|
-
part += minuteOffset % import_internal.MINUTES_PER_HOUR * -1;
|
|
40
|
+
if (k == "hour") part += Math.floor(minuteOffset / import_internal.MINUTES_PER_HOUR) * -1;
|
|
41
|
+
if (k == "minute") part += minuteOffset % import_internal.MINUTES_PER_HOUR * -1;
|
|
44
42
|
if (part < min) {
|
|
45
43
|
const delta = min - part;
|
|
46
44
|
remainder = -1 * Math.ceil(delta / limit);
|
|
@@ -33,13 +33,20 @@ const TZ_LETTER_OFFSETS = {
|
|
|
33
33
|
...buildMap("NOPQRSTUVWXY", -1),
|
|
34
34
|
Z: 0
|
|
35
35
|
};
|
|
36
|
+
const regexStrip = (s) => s.replace(/^\//, "").replace(/\/$/, "");
|
|
37
|
+
const REGEX_SPECIAL_CHARS = ["^", ".", "-", "*", "?", "$"];
|
|
38
|
+
const regexQuote = (s) => {
|
|
39
|
+
REGEX_SPECIAL_CHARS.forEach((c) => {
|
|
40
|
+
s = s.replace(c, `\\${c}`);
|
|
41
|
+
});
|
|
42
|
+
return s;
|
|
43
|
+
};
|
|
36
44
|
const $dateFromString = (obj, expr, options) => {
|
|
37
45
|
const args = (0, import_core.computeValue)(obj, expr, null, options);
|
|
38
46
|
args.format = args.format || import_internal.DATE_FORMAT;
|
|
39
47
|
args.onNull = args.onNull || null;
|
|
40
48
|
let dateString = args.dateString;
|
|
41
|
-
if ((0, import_util.isNil)(dateString))
|
|
42
|
-
return args.onNull;
|
|
49
|
+
if ((0, import_util.isNil)(dateString)) return args.onNull;
|
|
43
50
|
const separators = args.format.split(/%[YGmdHMSLuVzZ]/);
|
|
44
51
|
separators.reverse();
|
|
45
52
|
const matches = args.format.match(
|
|
@@ -56,7 +63,7 @@ const $dateFromString = (obj, expr, options) => {
|
|
|
56
63
|
if (m2 !== null) {
|
|
57
64
|
dateParts[props.name] = /^\d+$/.exec(m2[0]) ? parseInt(m2[0]) : m2[0];
|
|
58
65
|
dateString = dateString.substr(0, m2.index) + dateString.substr(m2.index + m2[0].length);
|
|
59
|
-
expectedPattern +=
|
|
66
|
+
expectedPattern += regexQuote(delimiter) + regexStrip(props.re.toString());
|
|
60
67
|
} else {
|
|
61
68
|
dateParts[props.name] = null;
|
|
62
69
|
}
|
|
@@ -75,12 +82,9 @@ const $dateFromString = (obj, expr, options) => {
|
|
|
75
82
|
const d = new Date(
|
|
76
83
|
Date.UTC(dateParts.year, dateParts.month - 1, dateParts.day, 0, 0, 0)
|
|
77
84
|
);
|
|
78
|
-
if (!(0, import_util.isNil)(dateParts.hour))
|
|
79
|
-
|
|
80
|
-
if (!(0, import_util.isNil)(dateParts.
|
|
81
|
-
d.setUTCMinutes(dateParts.minute);
|
|
82
|
-
if (!(0, import_util.isNil)(dateParts.second))
|
|
83
|
-
d.setUTCSeconds(dateParts.second);
|
|
85
|
+
if (!(0, import_util.isNil)(dateParts.hour)) d.setUTCHours(dateParts.hour);
|
|
86
|
+
if (!(0, import_util.isNil)(dateParts.minute)) d.setUTCMinutes(dateParts.minute);
|
|
87
|
+
if (!(0, import_util.isNil)(dateParts.second)) d.setUTCSeconds(dateParts.second);
|
|
84
88
|
if (!(0, import_util.isNil)(dateParts.millisecond))
|
|
85
89
|
d.setUTCMilliseconds(dateParts.millisecond);
|
|
86
90
|
(0, import_internal.adjustDate)(d, -minuteOffset);
|
|
@@ -48,10 +48,8 @@ const DATE_FUNCTIONS = {
|
|
|
48
48
|
};
|
|
49
49
|
const $dateToString = (obj, expr, options) => {
|
|
50
50
|
const args = (0, import_core.computeValue)(obj, expr, null, options);
|
|
51
|
-
if ((0, import_util.isNil)(args.onNull))
|
|
52
|
-
|
|
53
|
-
if ((0, import_util.isNil)(args.date))
|
|
54
|
-
return args.onNull;
|
|
51
|
+
if ((0, import_util.isNil)(args.onNull)) args.onNull = null;
|
|
52
|
+
if ((0, import_util.isNil)(args.date)) return args.onNull;
|
|
55
53
|
const date = (0, import_internal.computeDate)(obj, args.date, options);
|
|
56
54
|
let format = args.format || import_internal.DATE_FORMAT;
|
|
57
55
|
const minuteOffset = (0, import_internal.parseTimezone)(args.timezone);
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var dateTrunc_exports = {};
|
|
19
|
+
__export(dateTrunc_exports, {
|
|
20
|
+
$dateTrunc: () => $dateTrunc
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(dateTrunc_exports);
|
|
23
|
+
var import_core = require("../../../core");
|
|
24
|
+
var import_types = require("../../../types");
|
|
25
|
+
var import_util = require("../../../util");
|
|
26
|
+
var import_internal = require("./_internal");
|
|
27
|
+
const REF_DATE_MILLIS = 9466848e5;
|
|
28
|
+
const distanceToBinLowerBound = (value, binSize) => {
|
|
29
|
+
let remainder = value % binSize;
|
|
30
|
+
if (remainder < 0) {
|
|
31
|
+
remainder += binSize;
|
|
32
|
+
}
|
|
33
|
+
return remainder;
|
|
34
|
+
};
|
|
35
|
+
const DATE_DIFF_FN = {
|
|
36
|
+
day: import_internal.dateDiffDay,
|
|
37
|
+
month: import_internal.dateDiffMonth,
|
|
38
|
+
quarter: import_internal.dateDiffQuarter,
|
|
39
|
+
year: import_internal.dateDiffYear
|
|
40
|
+
};
|
|
41
|
+
const $dateTrunc = (obj, expr, options) => {
|
|
42
|
+
const {
|
|
43
|
+
date,
|
|
44
|
+
unit,
|
|
45
|
+
binSize: optBinSize,
|
|
46
|
+
timezone,
|
|
47
|
+
startOfWeek: optStartOfWeek
|
|
48
|
+
} = (0, import_core.computeValue)(obj, expr, null, options);
|
|
49
|
+
if ((0, import_util.isNil)(date) || (0, import_util.isNil)(unit)) return null;
|
|
50
|
+
const startOfWeek = (optStartOfWeek ?? "sun").toLowerCase().substring(0, 3);
|
|
51
|
+
(0, import_util.assert)(
|
|
52
|
+
(0, import_util.isDate)(date),
|
|
53
|
+
"$dateTrunc: 'date' must resolve to a valid Date object."
|
|
54
|
+
);
|
|
55
|
+
(0, import_util.assert)(import_types.TIME_UNITS.includes(unit), "$dateTrunc: unit is invalid.");
|
|
56
|
+
(0, import_util.assert)(
|
|
57
|
+
unit != "week" || import_internal.DAYS_OF_WEEK_SET.has(startOfWeek),
|
|
58
|
+
`$dateTrunc: startOfWeek '${startOfWeek}' is not a valid.`
|
|
59
|
+
);
|
|
60
|
+
(0, import_util.assert)(
|
|
61
|
+
(0, import_util.isNil)(optBinSize) || optBinSize > 0,
|
|
62
|
+
"$dateTrunc requires 'binSize' to be greater than 0, but got value 0."
|
|
63
|
+
);
|
|
64
|
+
const binSize = optBinSize ?? 1;
|
|
65
|
+
switch (unit) {
|
|
66
|
+
case "millisecond":
|
|
67
|
+
case "second":
|
|
68
|
+
case "minute":
|
|
69
|
+
case "hour": {
|
|
70
|
+
const binSizeMillis = binSize * import_internal.TIMEUNIT_IN_MILLIS[unit];
|
|
71
|
+
const shiftedDate = date.getTime() - REF_DATE_MILLIS;
|
|
72
|
+
return new Date(
|
|
73
|
+
date.getTime() - distanceToBinLowerBound(shiftedDate, binSizeMillis)
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
default: {
|
|
77
|
+
(0, import_util.assert)(binSize <= 1e11, "dateTrunc unsupported binSize value");
|
|
78
|
+
const d = new Date(date);
|
|
79
|
+
const refPointDate = new Date(REF_DATE_MILLIS);
|
|
80
|
+
let distanceFromRefPoint = 0;
|
|
81
|
+
if (unit == "week") {
|
|
82
|
+
const refPointDayOfWeek = (0, import_internal.isoWeekday)(refPointDate, startOfWeek);
|
|
83
|
+
const daysToAdjustBy = (import_internal.DAYS_PER_WEEK - refPointDayOfWeek) % import_internal.DAYS_PER_WEEK;
|
|
84
|
+
refPointDate.setTime(
|
|
85
|
+
refPointDate.getTime() + daysToAdjustBy * import_internal.TIMEUNIT_IN_MILLIS.day
|
|
86
|
+
);
|
|
87
|
+
distanceFromRefPoint = (0, import_internal.dateDiffWeek)(refPointDate, d, startOfWeek);
|
|
88
|
+
} else {
|
|
89
|
+
distanceFromRefPoint = DATE_DIFF_FN[unit](refPointDate, d);
|
|
90
|
+
}
|
|
91
|
+
const binLowerBoundFromRefPoint = distanceFromRefPoint - distanceToBinLowerBound(distanceFromRefPoint, binSize);
|
|
92
|
+
const newDate = (0, import_internal.dateAdd)(
|
|
93
|
+
refPointDate,
|
|
94
|
+
unit,
|
|
95
|
+
binLowerBoundFromRefPoint,
|
|
96
|
+
timezone
|
|
97
|
+
);
|
|
98
|
+
const minuteOffset = (0, import_internal.parseTimezone)(timezone);
|
|
99
|
+
(0, import_internal.adjustDate)(newDate, -minuteOffset);
|
|
100
|
+
return newDate;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
105
|
+
0 && (module.exports = {
|
|
106
|
+
$dateTrunc
|
|
107
|
+
});
|
|
@@ -22,7 +22,7 @@ __export(dayOfYear_exports, {
|
|
|
22
22
|
module.exports = __toCommonJS(dayOfYear_exports);
|
|
23
23
|
var import_internal = require("./_internal");
|
|
24
24
|
const $dayOfYear = (obj, expr, options) => {
|
|
25
|
-
return (0, import_internal.
|
|
25
|
+
return (0, import_internal.dayOfYear)((0, import_internal.computeDate)(obj, expr, options));
|
|
26
26
|
};
|
|
27
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
28
28
|
0 && (module.exports = {
|
|
@@ -21,6 +21,7 @@ __reExport(date_exports, require("./dateFromString"), module.exports);
|
|
|
21
21
|
__reExport(date_exports, require("./dateSubtract"), module.exports);
|
|
22
22
|
__reExport(date_exports, require("./dateToParts"), module.exports);
|
|
23
23
|
__reExport(date_exports, require("./dateToString"), module.exports);
|
|
24
|
+
__reExport(date_exports, require("./dateTrunc"), module.exports);
|
|
24
25
|
__reExport(date_exports, require("./dayOfMonth"), module.exports);
|
|
25
26
|
__reExport(date_exports, require("./dayOfWeek"), module.exports);
|
|
26
27
|
__reExport(date_exports, require("./dayOfYear"), module.exports);
|
|
@@ -43,6 +44,7 @@ __reExport(date_exports, require("./year"), module.exports);
|
|
|
43
44
|
...require("./dateSubtract"),
|
|
44
45
|
...require("./dateToParts"),
|
|
45
46
|
...require("./dateToString"),
|
|
47
|
+
...require("./dateTrunc"),
|
|
46
48
|
...require("./dayOfMonth"),
|
|
47
49
|
...require("./dayOfWeek"),
|
|
48
50
|
...require("./dayOfYear"),
|
|
@@ -21,10 +21,7 @@ __export(isoWeekYear_exports, {
|
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(isoWeekYear_exports);
|
|
23
23
|
var import_internal = require("./_internal");
|
|
24
|
-
const $isoWeekYear = (obj, expr, options) =>
|
|
25
|
-
const d = (0, import_internal.computeDate)(obj, expr, options);
|
|
26
|
-
return d.getUTCFullYear() - Number(d.getUTCMonth() == 0 && d.getUTCDate() == 1 && d.getUTCDay() < 1);
|
|
27
|
-
};
|
|
24
|
+
const $isoWeekYear = (obj, expr, options) => (0, import_internal.isoWeekYear)((0, import_internal.computeDate)(obj, expr, options));
|
|
28
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
29
26
|
0 && (module.exports = {
|
|
30
27
|
$isoWeekYear
|
|
@@ -26,8 +26,7 @@ const $week = (obj, expr, options) => {
|
|
|
26
26
|
const result = (0, import_internal.isoWeek)(d);
|
|
27
27
|
if (d.getUTCDay() > 0 && d.getUTCDate() == 1 && d.getUTCMonth() == 0)
|
|
28
28
|
return 0;
|
|
29
|
-
if (d.getUTCDay() == 0)
|
|
30
|
-
return result + 1;
|
|
29
|
+
if (d.getUTCDay() == 0) return result + 1;
|
|
31
30
|
return result;
|
|
32
31
|
};
|
|
33
32
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -25,8 +25,7 @@ var import_util = require("../../../util");
|
|
|
25
25
|
const $getField = (obj, expr, options) => {
|
|
26
26
|
const args = (0, import_core.computeValue)(obj, expr, null, options);
|
|
27
27
|
const [field, input] = (0, import_util.isObject)(args) ? [args.field, args.input || obj] : [args, obj];
|
|
28
|
-
if ((0, import_util.isNil)(input))
|
|
29
|
-
return null;
|
|
28
|
+
if ((0, import_util.isNil)(input)) return null;
|
|
30
29
|
(0, import_util.assert)(
|
|
31
30
|
(0, import_util.isObject)(input),
|
|
32
31
|
"$getField expression 'input' must evaluate to an object"
|
|
@@ -23,8 +23,15 @@ module.exports = __toCommonJS(mergeObjects_exports);
|
|
|
23
23
|
var import_core = require("../../../core");
|
|
24
24
|
var import_util = require("../../../util");
|
|
25
25
|
const $mergeObjects = (obj, expr, options) => {
|
|
26
|
-
const docs = (0, import_core.computeValue)(obj, expr, null, options);
|
|
27
|
-
|
|
26
|
+
const docs = (0, import_core.computeValue)(obj, expr, null, options) ?? [];
|
|
27
|
+
const acc = {};
|
|
28
|
+
for (const o of docs) {
|
|
29
|
+
if ((0, import_util.isNil)(o)) continue;
|
|
30
|
+
for (const k of Object.keys(o)) {
|
|
31
|
+
if (o[k] !== void 0) acc[k] = o[k];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return acc;
|
|
28
35
|
};
|
|
29
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
30
37
|
0 && (module.exports = {
|