@valkey/valkey-glide 2.0.0 → 2.1.0-rc2

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.
@@ -8,7 +8,7 @@ ElementAndScore, ExpireOptions, FlushMode, FunctionListOptions, // eslint-disabl
8
8
  FunctionRestorePolicy, // eslint-disable-line @typescript-eslint/no-unused-vars
9
9
  GeoAddOptions, // eslint-disable-line @typescript-eslint/no-unused-vars
10
10
  GeoSearchResultOptions, GeoSearchShape, GeoSearchStoreResultOptions, GeoUnit, GeospatialData, // eslint-disable-line @typescript-eslint/no-unused-vars
11
- GlideRecord, GlideString, HScanOptions, HashDataType, InfoOptions, InsertPosition, KeyWeight, LPosOptions, ListDirection, LolwutOptions, // eslint-disable-line @typescript-eslint/no-unused-vars
11
+ GlideRecord, GlideString, HExpireOptions, HGetExOptions, HScanOptions, HSetExOptions, HashDataType, InfoOptions, InsertPosition, KeyWeight, LPosOptions, ListDirection, LolwutOptions, // eslint-disable-line @typescript-eslint/no-unused-vars
12
12
  RangeByIndex, RangeByLex, RangeByScore, // eslint-disable-line @typescript-eslint/no-unused-vars
13
13
  RestoreOptions, Score, ScoreFilter, SearchOrigin, SetOptions, SortOptions, StreamAddOptions, StreamClaimOptions, StreamGroupOptions, StreamPendingOptions, StreamReadGroupOptions, StreamReadOptions, StreamTrimOptions, TimeUnit, ZAddOptions, ZScanOptions } from ".";
14
14
  import { command_request } from "../build-ts/ProtobufMessage";
@@ -583,6 +583,212 @@ export declare class BaseBatch<T extends BaseBatch<T>> {
583
583
  * If the hash does not exist or is empty, the response will be an empty `array`.
584
584
  */
585
585
  hrandfieldWithValues(key: GlideString, count: number): T;
586
+ /**
587
+ * Sets hash fields with expiration times and optional conditional changes.
588
+ *
589
+ * @param key - The key of the hash.
590
+ * @param fieldsAndValues - A map or array of field-value pairs to set.
591
+ * @param options - Optional parameters including field conditional changes and expiry settings.
592
+ * See {@link HSetExOptions}.
593
+ *
594
+ * @example
595
+ * ```typescript
596
+ * // Set fields with 60 second expiration, only if none exist
597
+ * batch.hsetex(
598
+ * "myHash",
599
+ * { field1: "value1", field2: "value2" },
600
+ * {
601
+ * fieldConditionalChange: HashFieldConditionalChange.ONLY_IF_NONE_EXIST,
602
+ * expiry: { type: TimeUnit.Seconds, count: 60 }
603
+ * }
604
+ * );
605
+ *
606
+ * // Set fields and keep existing TTL
607
+ * batch.hsetex(
608
+ * "myHash",
609
+ * { field3: "value3" },
610
+ * { expiry: "KEEPTTL" }
611
+ * );
612
+ *
613
+ * // Set fields with Unix timestamp expiration
614
+ * batch.hsetex(
615
+ * "myHash",
616
+ * { field4: "value4" },
617
+ * { expiry: { type: TimeUnit.UnixSeconds, count: Math.floor(Date.now() / 1000) + 3600 } }
618
+ * );
619
+ * ```
620
+ *
621
+ * Command Response - The number of fields that were added to the hash.
622
+ *
623
+ * @since Valkey 9.0.0
624
+ * @see https://valkey.io/commands/hsetex/
625
+ */
626
+ hsetex(key: GlideString, fieldsAndValues: HashDataType | Record<string, GlideString>, options?: HSetExOptions): T;
627
+ /**
628
+ * Gets hash fields and optionally sets their expiration.
629
+ *
630
+ * @param key - The key of the hash.
631
+ * @param fields - The fields in the hash stored at `key` to retrieve from the database.
632
+ * @param options - Optional arguments for the HGETEX command. See {@link HGetExOptions}.
633
+ *
634
+ * @example
635
+ * ```typescript
636
+ * // Get fields without setting expiration
637
+ * batch.hgetex("myHash", ["field1", "field2"]);
638
+ *
639
+ * // Get fields and set 30 second expiration
640
+ * batch.hgetex(
641
+ * "myHash",
642
+ * ["field1", "field2"],
643
+ * { expiry: { type: TimeUnit.Seconds, count: 30 } }
644
+ * );
645
+ *
646
+ * // Get fields and remove expiration (make persistent)
647
+ * batch.hgetex(
648
+ * "myHash",
649
+ * ["field1", "field2"],
650
+ * { expiry: "PERSIST" }
651
+ * );
652
+ *
653
+ * // Get fields and set millisecond precision expiration
654
+ * batch.hgetex(
655
+ * "myHash",
656
+ * ["field3"],
657
+ * { expiry: { type: TimeUnit.Milliseconds, count: 5000 } }
658
+ * );
659
+ * ```
660
+ *
661
+ * Command Response - An array of values associated with the given fields, in the same order as they are requested.
662
+ * For every field that does not exist in the hash, a null value is returned.
663
+ * If `key` does not exist, returns an array of null values.
664
+ *
665
+ * @since Valkey 9.0.0
666
+ * @see https://valkey.io/commands/hgetex/
667
+ */
668
+ hgetex(key: GlideString, fields: GlideString[], options?: HGetExOptions): T;
669
+ /**
670
+ * Sets expiration time for hash fields in seconds. Creates the hash if it doesn't exist.
671
+ * @see {@link https://valkey.io/commands/hexpire/|valkey.io} for details.
672
+ *
673
+ * @param key - The key of the hash.
674
+ * @param seconds - The expiration time in seconds.
675
+ * @param fields - The fields to set expiration for.
676
+ * @param options - Optional arguments for the HEXPIRE command. See {@link HExpireOptions}.
677
+ *
678
+ * Command Response - An array of numbers indicating the result for each field:
679
+ * - `1` if expiration was set successfully
680
+ * - `0` if the specified condition (NX, XX, GT, LT) was not met
681
+ * - `-2` if the field does not exist or the key does not exist
682
+ * - `2` when called with 0 seconds (field deleted)
683
+ */
684
+ hexpire(key: GlideString, seconds: number, fields: GlideString[], options?: HExpireOptions): T;
685
+ /**
686
+ * Removes the expiration time associated with each specified field, causing them to persist.
687
+ * @see {@link https://valkey.io/commands/hpersist/|valkey.io} for details.
688
+ *
689
+ * @param key - The key of the hash.
690
+ * @param fields - The fields in the hash to remove expiration from.
691
+ *
692
+ * Command Response - An array of numbers indicating the result for each field:
693
+ * - `1` if the field's expiration was removed successfully.
694
+ * - `-1` if the field exists but has no associated expiration.
695
+ * - `-2` if the field does not exist or the key does not exist.
696
+ */
697
+ hpersist(key: GlideString, fields: GlideString[]): T;
698
+ /**
699
+ * Sets expiration time for hash fields in milliseconds. Creates the hash if it doesn't exist.
700
+ * @see {@link https://valkey.io/commands/hpexpire/|valkey.io} for details.
701
+ *
702
+ * @param key - The key of the hash.
703
+ * @param milliseconds - The expiration time in milliseconds.
704
+ * @param fields - The fields to set expiration for.
705
+ * @param options - Optional arguments for the HPEXPIRE command. See {@link HExpireOptions}.
706
+ *
707
+ * Command Response - An array of boolean values indicating whether expiration was set for each field.
708
+ * `true` if expiration was set, `false` if the field doesn't exist or the condition wasn't met.
709
+ */
710
+ hpexpire(key: GlideString, milliseconds: number, fields: GlideString[], options?: HExpireOptions): T;
711
+ /**
712
+ * Sets expiration time for hash fields using an absolute Unix timestamp in seconds. Creates the hash if it doesn't exist.
713
+ * @see {@link https://valkey.io/commands/hexpireat/|valkey.io} for details.
714
+ *
715
+ * @param key - The key of the hash.
716
+ * @param unixTimestampSeconds - The expiration time as a Unix timestamp in seconds.
717
+ * @param fields - The fields to set expiration for.
718
+ * @param options - Optional arguments for the HEXPIREAT command. See {@link HExpireOptions}.
719
+ *
720
+ * Command Response - An array of numbers indicating the result for each field:
721
+ * - `1` if expiration was set successfully
722
+ * - `0` if the specified condition (NX, XX, GT, LT) was not met
723
+ * - `-2` if the field does not exist or the key does not exist
724
+ * - `2` when called with 0 seconds (field deleted)
725
+ */
726
+ hexpireat(key: GlideString, unixTimestampSeconds: number, fields: GlideString[], options?: HExpireOptions): T;
727
+ /**
728
+ * Sets expiration time for hash fields using an absolute Unix timestamp in milliseconds. Creates the hash if it doesn't exist.
729
+ * @see {@link https://valkey.io/commands/hpexpireat/|valkey.io} for details.
730
+ *
731
+ * @param key - The key of the hash.
732
+ * @param unixTimestampMilliseconds - The expiration time as a Unix timestamp in milliseconds.
733
+ * @param fields - The fields to set expiration for.
734
+ * @param options - Optional arguments for the HPEXPIREAT command. See {@link HExpireOptions}.
735
+ *
736
+ * Command Response - An array of boolean values indicating whether expiration was set for each field.
737
+ * `true` if expiration was set, `false` if the field doesn't exist or the condition wasn't met.
738
+ */
739
+ hpexpireat(key: GlideString, unixTimestampMilliseconds: number, fields: GlideString[], options?: HExpireOptions): T;
740
+ /**
741
+ * Returns the remaining time to live of hash fields that have a timeout, in seconds.
742
+ * @see {@link https://valkey.io/commands/httl/|valkey.io} for details.
743
+ *
744
+ * @param key - The key of the hash.
745
+ * @param fields - The fields in the hash stored at `key` to retrieve the TTL for.
746
+ *
747
+ * Command Response - An array of TTL values in seconds for the specified fields.
748
+ * - For fields with a timeout, returns the remaining time in seconds.
749
+ * - For fields that exist but have no associated expire, returns -1.
750
+ * - For fields that do not exist, returns -2.
751
+ */
752
+ httl(key: GlideString, fields: GlideString[]): T;
753
+ /**
754
+ * Returns the absolute Unix timestamp (in seconds) at which hash fields will expire.
755
+ * @see {@link https://valkey.io/commands/hexpiretime/|valkey.io} for details.
756
+ *
757
+ * @param key - The key of the hash.
758
+ * @param fields - The list of fields to get the expiration timestamp for.
759
+ *
760
+ * Command Response - An array of expiration timestamps in seconds for the specified fields:
761
+ * - For fields with a timeout, returns the absolute Unix timestamp in seconds.
762
+ * - For fields without a timeout, returns -1.
763
+ * - For fields that do not exist, returns -2.
764
+ */
765
+ hexpiretime(key: GlideString, fields: GlideString[]): T;
766
+ /**
767
+ * Returns the absolute Unix timestamp (in milliseconds) at which hash fields will expire.
768
+ * @see {@link https://valkey.io/commands/hpexpiretime/|valkey.io} for details.
769
+ *
770
+ * @param key - The key of the hash.
771
+ * @param fields - The list of fields to get the expiration timestamp for.
772
+ *
773
+ * Command Response - An array of expiration timestamps in milliseconds for the specified fields:
774
+ * - For fields with a timeout, returns the absolute Unix timestamp in milliseconds.
775
+ * - For fields without a timeout, returns -1.
776
+ * - For fields that do not exist, returns -2.
777
+ */
778
+ hpexpiretime(key: GlideString, fields: GlideString[]): T;
779
+ /**
780
+ * Returns the remaining time to live of hash fields that have a timeout, in milliseconds.
781
+ * @see {@link https://valkey.io/commands/hpttl/|valkey.io} for details.
782
+ *
783
+ * @param key - The key of the hash.
784
+ * @param fields - The list of fields to get the TTL for.
785
+ *
786
+ * Command Response - An array of TTL values in milliseconds for the specified fields:
787
+ * - For fields with a timeout, returns the remaining TTL in milliseconds.
788
+ * - For fields without a timeout, returns -1.
789
+ * - For fields that do not exist, returns -2.
790
+ */
791
+ hpttl(key: GlideString, fields: GlideString[]): T;
586
792
  /** Inserts all the specified values at the head of the list stored at `key`.
587
793
  * `elements` are inserted one after the other to the head of the list, from the leftmost element to the rightmost element.
588
794
  * If `key` does not exist, it is created as empty list before performing the push operations.
@@ -2867,6 +3073,14 @@ export declare class Batch extends BaseBatch<Batch> {
2867
3073
  /**
2868
3074
  * Change the currently selected database.
2869
3075
  *
3076
+ * **WARNING**: This command is NOT RECOMMENDED for production use.
3077
+ * Upon reconnection, the client will revert to the database_id specified
3078
+ * in the client configuration (default: 0), NOT the database selected
3079
+ * via this command.
3080
+ *
3081
+ * **RECOMMENDED APPROACH**: Use the `databaseId` parameter in client
3082
+ * configuration instead of using SELECT in batch operations.
3083
+ *
2870
3084
  * @see {@link https://valkey.io/commands/select/|valkey.io} for details.
2871
3085
  *
2872
3086
  * @param index - The index of the database to select.
package/build-ts/Batch.js CHANGED
@@ -685,6 +685,234 @@ class BaseBatch {
685
685
  hrandfieldWithValues(key, count) {
686
686
  return this.addAndReturn((0, _1.createHRandField)(key, count, true));
687
687
  }
688
+ /**
689
+ * Sets hash fields with expiration times and optional conditional changes.
690
+ *
691
+ * @param key - The key of the hash.
692
+ * @param fieldsAndValues - A map or array of field-value pairs to set.
693
+ * @param options - Optional parameters including field conditional changes and expiry settings.
694
+ * See {@link HSetExOptions}.
695
+ *
696
+ * @example
697
+ * ```typescript
698
+ * // Set fields with 60 second expiration, only if none exist
699
+ * batch.hsetex(
700
+ * "myHash",
701
+ * { field1: "value1", field2: "value2" },
702
+ * {
703
+ * fieldConditionalChange: HashFieldConditionalChange.ONLY_IF_NONE_EXIST,
704
+ * expiry: { type: TimeUnit.Seconds, count: 60 }
705
+ * }
706
+ * );
707
+ *
708
+ * // Set fields and keep existing TTL
709
+ * batch.hsetex(
710
+ * "myHash",
711
+ * { field3: "value3" },
712
+ * { expiry: "KEEPTTL" }
713
+ * );
714
+ *
715
+ * // Set fields with Unix timestamp expiration
716
+ * batch.hsetex(
717
+ * "myHash",
718
+ * { field4: "value4" },
719
+ * { expiry: { type: TimeUnit.UnixSeconds, count: Math.floor(Date.now() / 1000) + 3600 } }
720
+ * );
721
+ * ```
722
+ *
723
+ * Command Response - The number of fields that were added to the hash.
724
+ *
725
+ * @since Valkey 9.0.0
726
+ * @see https://valkey.io/commands/hsetex/
727
+ */
728
+ hsetex(key, fieldsAndValues, options) {
729
+ return this.addAndReturn((0, _1.createHSetEx)(key, (0, _1.convertFieldsAndValuesToHashDataType)(fieldsAndValues), options));
730
+ }
731
+ /**
732
+ * Gets hash fields and optionally sets their expiration.
733
+ *
734
+ * @param key - The key of the hash.
735
+ * @param fields - The fields in the hash stored at `key` to retrieve from the database.
736
+ * @param options - Optional arguments for the HGETEX command. See {@link HGetExOptions}.
737
+ *
738
+ * @example
739
+ * ```typescript
740
+ * // Get fields without setting expiration
741
+ * batch.hgetex("myHash", ["field1", "field2"]);
742
+ *
743
+ * // Get fields and set 30 second expiration
744
+ * batch.hgetex(
745
+ * "myHash",
746
+ * ["field1", "field2"],
747
+ * { expiry: { type: TimeUnit.Seconds, count: 30 } }
748
+ * );
749
+ *
750
+ * // Get fields and remove expiration (make persistent)
751
+ * batch.hgetex(
752
+ * "myHash",
753
+ * ["field1", "field2"],
754
+ * { expiry: "PERSIST" }
755
+ * );
756
+ *
757
+ * // Get fields and set millisecond precision expiration
758
+ * batch.hgetex(
759
+ * "myHash",
760
+ * ["field3"],
761
+ * { expiry: { type: TimeUnit.Milliseconds, count: 5000 } }
762
+ * );
763
+ * ```
764
+ *
765
+ * Command Response - An array of values associated with the given fields, in the same order as they are requested.
766
+ * For every field that does not exist in the hash, a null value is returned.
767
+ * If `key` does not exist, returns an array of null values.
768
+ *
769
+ * @since Valkey 9.0.0
770
+ * @see https://valkey.io/commands/hgetex/
771
+ */
772
+ hgetex(key, fields, options) {
773
+ return this.addAndReturn((0, _1.createHGetEx)(key, fields, options));
774
+ }
775
+ /**
776
+ * Sets expiration time for hash fields in seconds. Creates the hash if it doesn't exist.
777
+ * @see {@link https://valkey.io/commands/hexpire/|valkey.io} for details.
778
+ *
779
+ * @param key - The key of the hash.
780
+ * @param seconds - The expiration time in seconds.
781
+ * @param fields - The fields to set expiration for.
782
+ * @param options - Optional arguments for the HEXPIRE command. See {@link HExpireOptions}.
783
+ *
784
+ * Command Response - An array of numbers indicating the result for each field:
785
+ * - `1` if expiration was set successfully
786
+ * - `0` if the specified condition (NX, XX, GT, LT) was not met
787
+ * - `-2` if the field does not exist or the key does not exist
788
+ * - `2` when called with 0 seconds (field deleted)
789
+ */
790
+ hexpire(key, seconds, fields, options) {
791
+ return this.addAndReturn((0, _1.createHExpire)(key, seconds, fields, options));
792
+ }
793
+ /**
794
+ * Removes the expiration time associated with each specified field, causing them to persist.
795
+ * @see {@link https://valkey.io/commands/hpersist/|valkey.io} for details.
796
+ *
797
+ * @param key - The key of the hash.
798
+ * @param fields - The fields in the hash to remove expiration from.
799
+ *
800
+ * Command Response - An array of numbers indicating the result for each field:
801
+ * - `1` if the field's expiration was removed successfully.
802
+ * - `-1` if the field exists but has no associated expiration.
803
+ * - `-2` if the field does not exist or the key does not exist.
804
+ */
805
+ hpersist(key, fields) {
806
+ return this.addAndReturn((0, _1.createHPersist)(key, fields));
807
+ }
808
+ /**
809
+ * Sets expiration time for hash fields in milliseconds. Creates the hash if it doesn't exist.
810
+ * @see {@link https://valkey.io/commands/hpexpire/|valkey.io} for details.
811
+ *
812
+ * @param key - The key of the hash.
813
+ * @param milliseconds - The expiration time in milliseconds.
814
+ * @param fields - The fields to set expiration for.
815
+ * @param options - Optional arguments for the HPEXPIRE command. See {@link HExpireOptions}.
816
+ *
817
+ * Command Response - An array of boolean values indicating whether expiration was set for each field.
818
+ * `true` if expiration was set, `false` if the field doesn't exist or the condition wasn't met.
819
+ */
820
+ hpexpire(key, milliseconds, fields, options) {
821
+ return this.addAndReturn((0, _1.createHPExpire)(key, milliseconds, fields, options));
822
+ }
823
+ /**
824
+ * Sets expiration time for hash fields using an absolute Unix timestamp in seconds. Creates the hash if it doesn't exist.
825
+ * @see {@link https://valkey.io/commands/hexpireat/|valkey.io} for details.
826
+ *
827
+ * @param key - The key of the hash.
828
+ * @param unixTimestampSeconds - The expiration time as a Unix timestamp in seconds.
829
+ * @param fields - The fields to set expiration for.
830
+ * @param options - Optional arguments for the HEXPIREAT command. See {@link HExpireOptions}.
831
+ *
832
+ * Command Response - An array of numbers indicating the result for each field:
833
+ * - `1` if expiration was set successfully
834
+ * - `0` if the specified condition (NX, XX, GT, LT) was not met
835
+ * - `-2` if the field does not exist or the key does not exist
836
+ * - `2` when called with 0 seconds (field deleted)
837
+ */
838
+ hexpireat(key, unixTimestampSeconds, fields, options) {
839
+ return this.addAndReturn((0, _1.createHExpireAt)(key, unixTimestampSeconds, fields, options));
840
+ }
841
+ /**
842
+ * Sets expiration time for hash fields using an absolute Unix timestamp in milliseconds. Creates the hash if it doesn't exist.
843
+ * @see {@link https://valkey.io/commands/hpexpireat/|valkey.io} for details.
844
+ *
845
+ * @param key - The key of the hash.
846
+ * @param unixTimestampMilliseconds - The expiration time as a Unix timestamp in milliseconds.
847
+ * @param fields - The fields to set expiration for.
848
+ * @param options - Optional arguments for the HPEXPIREAT command. See {@link HExpireOptions}.
849
+ *
850
+ * Command Response - An array of boolean values indicating whether expiration was set for each field.
851
+ * `true` if expiration was set, `false` if the field doesn't exist or the condition wasn't met.
852
+ */
853
+ hpexpireat(key, unixTimestampMilliseconds, fields, options) {
854
+ return this.addAndReturn((0, _1.createHPExpireAt)(key, unixTimestampMilliseconds, fields, options));
855
+ }
856
+ /**
857
+ * Returns the remaining time to live of hash fields that have a timeout, in seconds.
858
+ * @see {@link https://valkey.io/commands/httl/|valkey.io} for details.
859
+ *
860
+ * @param key - The key of the hash.
861
+ * @param fields - The fields in the hash stored at `key` to retrieve the TTL for.
862
+ *
863
+ * Command Response - An array of TTL values in seconds for the specified fields.
864
+ * - For fields with a timeout, returns the remaining time in seconds.
865
+ * - For fields that exist but have no associated expire, returns -1.
866
+ * - For fields that do not exist, returns -2.
867
+ */
868
+ httl(key, fields) {
869
+ return this.addAndReturn((0, _1.createHTtl)(key, fields));
870
+ }
871
+ /**
872
+ * Returns the absolute Unix timestamp (in seconds) at which hash fields will expire.
873
+ * @see {@link https://valkey.io/commands/hexpiretime/|valkey.io} for details.
874
+ *
875
+ * @param key - The key of the hash.
876
+ * @param fields - The list of fields to get the expiration timestamp for.
877
+ *
878
+ * Command Response - An array of expiration timestamps in seconds for the specified fields:
879
+ * - For fields with a timeout, returns the absolute Unix timestamp in seconds.
880
+ * - For fields without a timeout, returns -1.
881
+ * - For fields that do not exist, returns -2.
882
+ */
883
+ hexpiretime(key, fields) {
884
+ return this.addAndReturn((0, _1.createHExpireTime)(key, fields));
885
+ }
886
+ /**
887
+ * Returns the absolute Unix timestamp (in milliseconds) at which hash fields will expire.
888
+ * @see {@link https://valkey.io/commands/hpexpiretime/|valkey.io} for details.
889
+ *
890
+ * @param key - The key of the hash.
891
+ * @param fields - The list of fields to get the expiration timestamp for.
892
+ *
893
+ * Command Response - An array of expiration timestamps in milliseconds for the specified fields:
894
+ * - For fields with a timeout, returns the absolute Unix timestamp in milliseconds.
895
+ * - For fields without a timeout, returns -1.
896
+ * - For fields that do not exist, returns -2.
897
+ */
898
+ hpexpiretime(key, fields) {
899
+ return this.addAndReturn((0, _1.createHPExpireTime)(key, fields));
900
+ }
901
+ /**
902
+ * Returns the remaining time to live of hash fields that have a timeout, in milliseconds.
903
+ * @see {@link https://valkey.io/commands/hpttl/|valkey.io} for details.
904
+ *
905
+ * @param key - The key of the hash.
906
+ * @param fields - The list of fields to get the TTL for.
907
+ *
908
+ * Command Response - An array of TTL values in milliseconds for the specified fields:
909
+ * - For fields with a timeout, returns the remaining TTL in milliseconds.
910
+ * - For fields without a timeout, returns -1.
911
+ * - For fields that do not exist, returns -2.
912
+ */
913
+ hpttl(key, fields) {
914
+ return this.addAndReturn((0, _1.createHPTtl)(key, fields));
915
+ }
688
916
  /** Inserts all the specified values at the head of the list stored at `key`.
689
917
  * `elements` are inserted one after the other to the head of the list, from the leftmost element to the rightmost element.
690
918
  * If `key` does not exist, it is created as empty list before performing the push operations.
@@ -3275,6 +3503,14 @@ class Batch extends BaseBatch {
3275
3503
  /**
3276
3504
  * Change the currently selected database.
3277
3505
  *
3506
+ * **WARNING**: This command is NOT RECOMMENDED for production use.
3507
+ * Upon reconnection, the client will revert to the database_id specified
3508
+ * in the client configuration (default: 0), NOT the database selected
3509
+ * via this command.
3510
+ *
3511
+ * **RECOMMENDED APPROACH**: Use the `databaseId` parameter in client
3512
+ * configuration instead of using SELECT in batch operations.
3513
+ *
3278
3514
  * @see {@link https://valkey.io/commands/select/|valkey.io} for details.
3279
3515
  *
3280
3516
  * @param index - The index of the database to select.
@@ -788,6 +788,173 @@ export declare enum ConditionalChange {
788
788
  */
789
789
  ONLY_IF_DOES_NOT_EXIST = "NX"
790
790
  }
791
+ /**
792
+ * Field conditional change options for hash field expiration commands.
793
+ * Used with HSETEX command to control field setting behavior.
794
+ */
795
+ export declare enum HashFieldConditionalChange {
796
+ /**
797
+ * Only set fields if all of them already exist. Equivalent to `FXX` in the Valkey API.
798
+ */
799
+ ONLY_IF_ALL_EXIST = "FXX",
800
+ /**
801
+ * Only set fields if none of them already exist. Equivalent to `FNX` in the Valkey API.
802
+ */
803
+ ONLY_IF_NONE_EXIST = "FNX"
804
+ }
805
+ /**
806
+ * Expiry set options for hash field expiration commands.
807
+ * Supports setting expiration time in various formats.
808
+ */
809
+ export type ExpirySet = {
810
+ type: TimeUnit;
811
+ count: number;
812
+ } | "KEEPTTL";
813
+ /**
814
+ * Expiry options specifically for HSETEX command.
815
+ * Supports standard expiry options (EX/PX/EXAT/PXAT) and KEEPTTL, but excludes PERSIST.
816
+ *
817
+ * @example
818
+ * ```typescript
819
+ * // Set expiration to 60 seconds
820
+ * const expiry: HSetExExpiry = { type: TimeUnit.Seconds, count: 60 };
821
+ *
822
+ * // Keep existing TTL
823
+ * const keepTtl: HSetExExpiry = "KEEPTTL";
824
+ * ```
825
+ */
826
+ export type HSetExExpiry = {
827
+ type: TimeUnit;
828
+ count: number;
829
+ } | "KEEPTTL";
830
+ /**
831
+ * Expiry options specifically for HGETEX command.
832
+ * Supports standard expiry options (EX/PX/EXAT/PXAT) and PERSIST, but excludes KEEPTTL.
833
+ *
834
+ * @example
835
+ * ```typescript
836
+ * // Set expiration to 30 seconds
837
+ * const expiry: HGetExExpiry = { type: TimeUnit.Seconds, count: 30 };
838
+ *
839
+ * // Remove expiration
840
+ * const persist: HGetExExpiry = "PERSIST";
841
+ * ```
842
+ */
843
+ export type HGetExExpiry = {
844
+ type: TimeUnit;
845
+ count: number;
846
+ } | "PERSIST";
847
+ /**
848
+ * Optional arguments for the HSETEX command.
849
+ *
850
+ * @example
851
+ * ```typescript
852
+ * // Set fields with 60 second expiration, only if none exist
853
+ * const options: HSetExOptions = {
854
+ * fieldConditionalChange: HashFieldConditionalChange.ONLY_IF_NONE_EXIST,
855
+ * expiry: { type: TimeUnit.Seconds, count: 60 }
856
+ * };
857
+ *
858
+ * // Set fields and keep existing TTL
859
+ * const keepTtlOptions: HSetExOptions = {
860
+ * expiry: "KEEPTTL"
861
+ * };
862
+ * ```
863
+ *
864
+ * See https://valkey.io/commands/hsetex/ for more details.
865
+ */
866
+ export interface HSetExOptions {
867
+ /** Options for handling existing fields. See {@link HashFieldConditionalChange}. */
868
+ fieldConditionalChange?: HashFieldConditionalChange;
869
+ /** Expiry settings for the fields. See {@link HSetExExpiry}. */
870
+ expiry?: HSetExExpiry;
871
+ }
872
+ /**
873
+ * Optional arguments for the HGETEX command.
874
+ *
875
+ * @example
876
+ * ```typescript
877
+ * // Get fields and set 30 second expiration
878
+ * const options: HGetExOptions = {
879
+ * expiry: { type: TimeUnit.Seconds, count: 30 }
880
+ * };
881
+ *
882
+ * // Get fields and remove expiration
883
+ * const persistOptions: HGetExOptions = {
884
+ * expiry: "PERSIST"
885
+ * };
886
+ * ```
887
+ *
888
+ * See https://valkey.io/commands/hgetex/ for more details.
889
+ */
890
+ export interface HGetExOptions {
891
+ /** Expiry settings for the fields. Can be a time-based expiry or "PERSIST" to remove expiration. */
892
+ expiry?: HGetExExpiry;
893
+ }
894
+ /**
895
+ * Expiration condition options for hash field expiration commands.
896
+ * Used with HEXPIRE, HPEXPIRE, HEXPIREAT, and HPEXPIREAT commands to control expiration setting behavior.
897
+ */
898
+ export declare enum HashExpirationCondition {
899
+ /**
900
+ * Only set expiration when field has no expiration. Equivalent to `NX` in the Valkey API.
901
+ */
902
+ ONLY_IF_NO_EXPIRY = "NX",
903
+ /**
904
+ * Only set expiration when field has existing expiration. Equivalent to `XX` in the Valkey API.
905
+ */
906
+ ONLY_IF_HAS_EXPIRY = "XX",
907
+ /**
908
+ * Only set expiration when new expiration is greater than current. Equivalent to `GT` in the Valkey API.
909
+ */
910
+ ONLY_IF_GREATER_THAN_CURRENT = "GT",
911
+ /**
912
+ * Only set expiration when new expiration is less than current. Equivalent to `LT` in the Valkey API.
913
+ */
914
+ ONLY_IF_LESS_THAN_CURRENT = "LT"
915
+ }
916
+ /**
917
+ * Shared optional arguments for HEXPIRE, HPEXPIRE, HEXPIREAT, and HPEXPIREAT commands.
918
+ *
919
+ * This interface provides a unified way to specify expiration conditions for hash field
920
+ * expiration commands that support conditional expiration setting.
921
+ *
922
+ * @example
923
+ * ```typescript
924
+ * // Set expiration only if field has no existing expiration
925
+ * const options: HExpireOptions = {
926
+ * condition: HashExpirationCondition.ONLY_IF_NO_EXPIRY
927
+ * };
928
+ *
929
+ * // Set expiration only if new expiration is greater than current
930
+ * const gtOptions: HExpireOptions = {
931
+ * condition: HashExpirationCondition.ONLY_IF_GREATER_THAN_CURRENT
932
+ * };
933
+ *
934
+ * // Set expiration only if field has existing expiration
935
+ * const xxOptions: HExpireOptions = {
936
+ * condition: HashExpirationCondition.ONLY_IF_HAS_EXPIRY
937
+ * };
938
+ *
939
+ * // Set expiration only if new expiration is less than current
940
+ * const ltOptions: HExpireOptions = {
941
+ * condition: HashExpirationCondition.ONLY_IF_LESS_THAN_CURRENT
942
+ * };
943
+ * ```
944
+ *
945
+ * @see {@link https://valkey.io/commands/hexpire/|HEXPIRE}
946
+ * @see {@link https://valkey.io/commands/hpexpire/|HPEXPIRE}
947
+ * @see {@link https://valkey.io/commands/hexpireat/|HEXPIREAT}
948
+ * @see {@link https://valkey.io/commands/hpexpireat/|HPEXPIREAT}
949
+ */
950
+ export interface HExpireOptions {
951
+ /**
952
+ * Condition for setting expiration. Controls when the expiration should be set
953
+ * based on the current state of the field's expiration.
954
+ * See {@link HashExpirationCondition} for available options.
955
+ */
956
+ condition?: HashExpirationCondition;
957
+ }
791
958
  /**
792
959
  * Represents a geographic position defined by longitude and latitude.
793
960
  * The exact limits, as specified by `EPSG:900913 / EPSG:3785 / OSGEO:41001` are the