@@ -591,14 +591,14 @@ export class ClientEncryption {
591591 field == null || typeof field !== 'object' || field . keyId != null
592592 ? field
593593 : {
594- ...field ,
595- keyId : await this . createDataKey ( provider , {
596- masterKey,
597- // clone the timeoutContext
598- // in order to avoid sharing the same timeout for server selection and connection checkout across different concurrent operations
599- timeoutContext : timeoutContext ?. csotEnabled ( ) ? timeoutContext ?. clone ( ) : undefined
600- } )
601- }
594+ ...field ,
595+ keyId : await this . createDataKey ( provider , {
596+ masterKey,
597+ // clone the timeoutContext
598+ // in order to avoid sharing the same timeout for server selection and connection checkout across different concurrent operations
599+ timeoutContext : timeoutContext ?. csotEnabled ( ) ? timeoutContext ?. clone ( ) : undefined
600+ } )
601+ }
602602 ) ;
603603 const createDataKeyResolutions = await Promise . allSettled ( createDataKeyPromises ) ;
604604
@@ -784,7 +784,6 @@ export class ClientEncryption {
784784 }
785785
786786 if ( typeof textOptions === 'object' ) {
787- // @ts -expect-error errors until mongodb-client-encryption release
788787 contextOptions . textOptions = serialize ( textOptions ) ;
789788 }
790789
@@ -814,12 +813,12 @@ export interface ClientEncryptionEncryptOptions {
814813 * The algorithm to use for encryption.
815814 */
816815 algorithm :
817- | 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic'
818- | 'AEAD_AES_256_CBC_HMAC_SHA_512-Random'
819- | 'Indexed'
820- | 'Unindexed'
821- | 'Range'
822- | 'TextPreview' ;
816+ | 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic'
817+ | 'AEAD_AES_256_CBC_HMAC_SHA_512-Random'
818+ | 'Indexed'
819+ | 'Unindexed'
820+ | 'Range'
821+ | 'TextPreview' ;
823822
824823 /**
825824 * The id of the Binary dataKey to use for encryption
@@ -842,26 +841,45 @@ export interface ClientEncryptionEncryptOptions {
842841 /** The index options for a Queryable Encryption field supporting "range" queries.*/
843842 rangeOptions ?: RangeOptions ;
844843
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+ */
845849 textOptions ?: TextQueryOptions ;
846850}
847851
852+ /**
853+ * Options for a Queryable Encryption field supporting text queries.
854+ *
855+ * @experimental Public Technical Preview: `textPreview` is an experimental feature and may break at any time.
856+ */
848857interface TextQueryOptions {
858+ /** Indicates that text indexes for this field are case sensitive */
849859 caseSensitive : boolean ;
860+ /** Indicates that text indexes for this field are diacritic sensitive. */
850861 diacriticSensitive : boolean ;
851862
852863 prefix ?: {
864+ /** The maximum allowed query length. */
853865 strMaxQueryLength : Int32 | number ;
866+ /** The minimum allowed query length. */
854867 strMinQueryLength : Int32 | number ;
855868 } ;
856869
857870 suffix ?: {
871+ /** The maximum allowed query length. */
858872 strMaxQueryLength : Int32 | number ;
873+ /** The minimum allowed query length. */
859874 strMinQueryLength : Int32 | number ;
860875 } ;
861876
862877 substring ?: {
878+ /** The maximum allowed length to insert. */
863879 strMaxLength : Int32 | number ;
880+ /** The maximum allowed query length. */
864881 strMaxQueryLength : Int32 | number ;
882+ /** The minimum allowed query length. */
865883 strMinQueryLength : Int32 | number ;
866884 } ;
867885}
@@ -873,11 +891,11 @@ interface TextQueryOptions {
873891export interface ClientEncryptionRewrapManyDataKeyProviderOptions {
874892 provider : ClientEncryptionDataKeyProvider ;
875893 masterKey ?:
876- | AWSEncryptionKeyOptions
877- | AzureEncryptionKeyOptions
878- | GCPEncryptionKeyOptions
879- | KMIPEncryptionKeyOptions
880- | undefined ;
894+ | AWSEncryptionKeyOptions
895+ | AzureEncryptionKeyOptions
896+ | GCPEncryptionKeyOptions
897+ | KMIPEncryptionKeyOptions
898+ | undefined ;
881899}
882900
883901/**
@@ -1066,11 +1084,11 @@ export interface ClientEncryptionCreateDataKeyProviderOptions {
10661084 * Identifies a new KMS-specific key used to encrypt the new data key
10671085 */
10681086 masterKey ?:
1069- | AWSEncryptionKeyOptions
1070- | AzureEncryptionKeyOptions
1071- | GCPEncryptionKeyOptions
1072- | KMIPEncryptionKeyOptions
1073- | undefined ;
1087+ | AWSEncryptionKeyOptions
1088+ | AzureEncryptionKeyOptions
1089+ | GCPEncryptionKeyOptions
1090+ | KMIPEncryptionKeyOptions
1091+ | undefined ;
10741092
10751093 /**
10761094 * An optional list of string alternate names used to reference a key.
0 commit comments