@@ -749,7 +749,8 @@ export class ClientEncryption {
749
749
expressionMode : boolean ,
750
750
options : ClientEncryptionEncryptOptions
751
751
) : Promise < Binary > {
752
- const { algorithm, keyId, keyAltName, contentionFactor, queryType, rangeOptions } = options ;
752
+ const { algorithm, keyId, keyAltName, contentionFactor, queryType, rangeOptions, textOptions } =
753
+ options ;
753
754
const contextOptions : ExplicitEncryptionContextOptions = {
754
755
expressionMode,
755
756
algorithm
@@ -782,6 +783,10 @@ export class ClientEncryption {
782
783
contextOptions . rangeOptions = serialize ( rangeOptions ) ;
783
784
}
784
785
786
+ if ( typeof textOptions === 'object' ) {
787
+ contextOptions . textOptions = serialize ( textOptions ) ;
788
+ }
789
+
785
790
const valueBuffer = serialize ( { v : value } ) ;
786
791
const stateMachine = new StateMachine ( {
787
792
proxyOptions : this . _proxyOptions ,
@@ -812,7 +817,8 @@ export interface ClientEncryptionEncryptOptions {
812
817
| 'AEAD_AES_256_CBC_HMAC_SHA_512-Random'
813
818
| 'Indexed'
814
819
| 'Unindexed'
815
- | 'Range' ;
820
+ | 'Range'
821
+ | 'TextPreview' ;
816
822
817
823
/**
818
824
* The id of the Binary dataKey to use for encryption
@@ -830,10 +836,53 @@ export interface ClientEncryptionEncryptOptions {
830
836
/**
831
837
* The query type.
832
838
*/
833
- queryType ?: 'equality' | 'range' ;
839
+ queryType ?: 'equality' | 'range' | 'prefixPreview' | 'suffixPreview' | 'substringPreview' ;
834
840
835
841
/** The index options for a Queryable Encryption field supporting "range" queries.*/
836
842
rangeOptions ?: RangeOptions ;
843
+
844
+ /**
845
+ * Options for a Queryable Encryption field supporting text queries. Only valid when `algorithm` is `TextPreview`.
846
+ *
847
+ * @experimental Public Technical Preview: `textPreview` is an experimental feature and may break at any time.
848
+ */
849
+ textOptions ?: TextQueryOptions ;
850
+ }
851
+
852
+ /**
853
+ * Options for a Queryable Encryption field supporting text queries.
854
+ *
855
+ * @public
856
+ * @experimental Public Technical Preview: `textPreview` is an experimental feature and may break at any time.
857
+ */
858
+ export interface TextQueryOptions {
859
+ /** Indicates that text indexes for this field are case sensitive */
860
+ caseSensitive : boolean ;
861
+ /** Indicates that text indexes for this field are diacritic sensitive. */
862
+ diacriticSensitive : boolean ;
863
+
864
+ prefix ?: {
865
+ /** The maximum allowed query length. */
866
+ strMaxQueryLength : Int32 | number ;
867
+ /** The minimum allowed query length. */
868
+ strMinQueryLength : Int32 | number ;
869
+ } ;
870
+
871
+ suffix ?: {
872
+ /** The maximum allowed query length. */
873
+ strMaxQueryLength : Int32 | number ;
874
+ /** The minimum allowed query length. */
875
+ strMinQueryLength : Int32 | number ;
876
+ } ;
877
+
878
+ substring ?: {
879
+ /** The maximum allowed length to insert. */
880
+ strMaxLength : Int32 | number ;
881
+ /** The maximum allowed query length. */
882
+ strMaxQueryLength : Int32 | number ;
883
+ /** The minimum allowed query length. */
884
+ strMinQueryLength : Int32 | number ;
885
+ } ;
837
886
}
838
887
839
888
/**
0 commit comments