@@ -749,7 +749,8 @@ export class ClientEncryption {
749749 expressionMode : boolean ,
750750 options : ClientEncryptionEncryptOptions
751751 ) : Promise < Binary > {
752- const { algorithm, keyId, keyAltName, contentionFactor, queryType, rangeOptions } = options ;
752+ const { algorithm, keyId, keyAltName, contentionFactor, queryType, rangeOptions, textOptions } =
753+ options ;
753754 const contextOptions : ExplicitEncryptionContextOptions = {
754755 expressionMode,
755756 algorithm
@@ -782,6 +783,10 @@ export class ClientEncryption {
782783 contextOptions . rangeOptions = serialize ( rangeOptions ) ;
783784 }
784785
786+ if ( typeof textOptions === 'object' ) {
787+ contextOptions . textOptions = serialize ( textOptions ) ;
788+ }
789+
785790 const valueBuffer = serialize ( { v : value } ) ;
786791 const stateMachine = new StateMachine ( {
787792 proxyOptions : this . _proxyOptions ,
@@ -812,7 +817,8 @@ export interface ClientEncryptionEncryptOptions {
812817 | 'AEAD_AES_256_CBC_HMAC_SHA_512-Random'
813818 | 'Indexed'
814819 | 'Unindexed'
815- | 'Range' ;
820+ | 'Range'
821+ | 'TextPreview' ;
816822
817823 /**
818824 * The id of the Binary dataKey to use for encryption
@@ -830,10 +836,53 @@ export interface ClientEncryptionEncryptOptions {
830836 /**
831837 * The query type.
832838 */
833- queryType ?: 'equality' | 'range' ;
839+ queryType ?: 'equality' | 'range' | 'prefixPreview' | 'suffixPreview' | 'substringPreview' ;
834840
835841 /** The index options for a Queryable Encryption field supporting "range" queries.*/
836842 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+ } ;
837886}
838887
839888/**
0 commit comments