File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,13 +85,15 @@ async function main(): Promise<void> {
8585 const eqlSql = await response . text ( )
8686
8787 const drizzlePath = resolve ( process . cwd ( ) , args . drizzleDir )
88- if ( ! existsSync ( drizzlePath ) ) {
88+
89+ let files : string [ ]
90+ try {
91+ files = await readdir ( drizzlePath )
92+ } catch {
8993 throw new Error (
9094 `Drizzle directory not found: ${ drizzlePath } \nMake sure to run this command from your project root.` ,
9195 )
9296 }
93-
94- const files = await readdir ( drizzlePath )
9597 const migrationFile = files
9698 . filter (
9799 ( file ) => file . endsWith ( '.sql' ) && file . includes ( args . migrationName ) ,
Original file line number Diff line number Diff line change @@ -47,8 +47,6 @@ export const noClientError = () =>
4747export class ProtectClient {
4848 private client : Client
4949 private encryptConfig : EncryptConfig | undefined
50- constructor ( ) { }
51-
5250
5351 /**
5452 * Initializes the ProtectClient with the provided configuration.
Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ describe('schema builders', () => {
114114 const built = col . build ( )
115115 expect ( built . cast_as ) . toBe ( 'json' )
116116 expect ( built . indexes ) . toHaveProperty ( 'ste_vec' )
117- expect ( built . indexes . ste_vec ) . toEqual ( { prefix : 'enabled' } )
117+ expect ( built . indexes . ste_vec ) . toEqual ( { prefix : 'enabled' , array_index_mode : 'all' } )
118118 } )
119119
120120 it ( 'chaining multiple indexes: .equality().freeTextSearch().orderAndRange()' , ( ) => {
@@ -222,6 +222,7 @@ describe('schema builders', () => {
222222 expect ( built . columns . metadata . cast_as ) . toBe ( 'json' )
223223 expect ( built . columns . metadata . indexes . ste_vec ) . toEqual ( {
224224 prefix : 'documents/metadata' ,
225+ array_index_mode : 'all' ,
225226 } )
226227 } )
227228
@@ -296,6 +297,7 @@ describe('schema builders', () => {
296297
297298 expect ( config . tables . documents . metadata . indexes . ste_vec ) . toEqual ( {
298299 prefix : 'documents/metadata' ,
300+ array_index_mode : 'all' ,
299301 } )
300302 } )
301303 } )
Original file line number Diff line number Diff line change @@ -49,8 +49,6 @@ export class EncryptionClient {
4949 private client : Client
5050 private encryptConfig : EncryptConfig | undefined
5151
52- constructor ( ) { }
53-
5452 /**
5553 * Initializes the EncryptionClient with the provided configuration.
5654 * @internal
Original file line number Diff line number Diff line change @@ -104,8 +104,19 @@ const matchIndexOptsSchema = z.object({
104104 include_original : z . boolean ( ) . default ( false ) . optional ( ) ,
105105} )
106106
107+ const arrayIndexModeSchema = z . union ( [
108+ z . literal ( 'all' ) ,
109+ z . literal ( 'none' ) ,
110+ z . object ( {
111+ item : z . boolean ( ) . optional ( ) ,
112+ wildcard : z . boolean ( ) . optional ( ) ,
113+ position : z . boolean ( ) . optional ( ) ,
114+ } ) ,
115+ ] )
116+
107117const steVecIndexOptsSchema = z . object ( {
108118 prefix : z . string ( ) ,
119+ array_index_mode : arrayIndexModeSchema . optional ( ) ,
109120} )
110121
111122const indexesSchema = z
@@ -379,7 +390,7 @@ export class EncryptedColumn {
379390 */
380391 searchableJson ( ) {
381392 this . castAsValue = 'json'
382- this . indexesValue . ste_vec = { prefix : 'enabled' }
393+ this . indexesValue . ste_vec = { prefix : 'enabled' , array_index_mode : 'all' }
383394 return this
384395 }
385396
@@ -461,6 +472,7 @@ export class EncryptedTable<T extends EncryptedTableColumn> {
461472 indexes : {
462473 ...builtColumn . indexes ,
463474 ste_vec : {
475+ ...builtColumn . indexes . ste_vec ,
464476 prefix : `${ this . tableName } /${ colName } ` ,
465477 } ,
466478 } ,
You can’t perform that action at this time.
0 commit comments