From e265c521e82893f239eb7749eb7b6f367bfdb02d Mon Sep 17 00:00:00 2001 From: Leibale Eidelman Date: Mon, 7 Feb 2022 15:28:09 -0500 Subject: [PATCH] export RediSearchSchema type (#1825) * export RediSearchSchema type * export SearchOptions and SearchReply --- packages/search/lib/commands/ALTER.ts | 4 ++-- packages/search/lib/commands/CREATE.ts | 4 ++-- packages/search/lib/commands/index.ts | 5 ++--- packages/search/lib/index.ts | 3 ++- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/search/lib/commands/ALTER.ts b/packages/search/lib/commands/ALTER.ts index 8e74c64376..bb4c5202c6 100644 --- a/packages/search/lib/commands/ALTER.ts +++ b/packages/search/lib/commands/ALTER.ts @@ -1,6 +1,6 @@ -import { CreateSchema, pushSchema } from '.'; +import { RediSearchSchema, pushSchema } from '.'; -export function transformArguments(index: string, schema: CreateSchema): Array { +export function transformArguments(index: string, schema: RediSearchSchema): Array { const args = ['FT.ALTER', index, 'SCHEMA', 'ADD']; pushSchema(args, schema); diff --git a/packages/search/lib/commands/CREATE.ts b/packages/search/lib/commands/CREATE.ts index b2f49a7f0e..7578d94ede 100644 --- a/packages/search/lib/commands/CREATE.ts +++ b/packages/search/lib/commands/CREATE.ts @@ -1,5 +1,5 @@ import { pushOptionalVerdictArgument } from '@node-redis/client/dist/lib/commands/generic-transformers'; -import { RedisSearchLanguages, PropertyName, CreateSchema, pushSchema } from '.'; +import { RedisSearchLanguages, PropertyName, RediSearchSchema, pushSchema } from '.'; interface CreateOptions { ON?: 'HASH' | 'JSON'; @@ -20,7 +20,7 @@ interface CreateOptions { STOPWORDS?: string | Array; } -export function transformArguments(index: string, schema: CreateSchema, options?: CreateOptions): Array { +export function transformArguments(index: string, schema: RediSearchSchema, options?: CreateOptions): Array { const args = ['FT.CREATE', index]; if (options?.ON) { diff --git a/packages/search/lib/commands/index.ts b/packages/search/lib/commands/index.ts index 66b891fd8c..040242938e 100644 --- a/packages/search/lib/commands/index.ts +++ b/packages/search/lib/commands/index.ts @@ -204,7 +204,7 @@ type CreateSchemaTagField = CreateSchemaField; -export interface CreateSchema { +export interface RediSearchSchema { [field: string]: CreateSchemaTextField | CreateSchemaNumericField | @@ -212,7 +212,7 @@ export interface CreateSchema { CreateSchemaTagField } -export function pushSchema(args: RedisCommandArguments, schema: CreateSchema) { +export function pushSchema(args: RedisCommandArguments, schema: RediSearchSchema) { for (const [field, fieldOptions] of Object.entries(schema)) { args.push(field); @@ -396,7 +396,6 @@ export interface SearchReply { }>; } - export interface ProfileOptions { LIMITED?: true; } diff --git a/packages/search/lib/index.ts b/packages/search/lib/index.ts index 9480c5a7a7..93d1e9088f 100644 --- a/packages/search/lib/index.ts +++ b/packages/search/lib/index.ts @@ -1,4 +1,5 @@ export { default } from './commands'; -export { SchemaFieldTypes, SchemaTextFieldPhonetics } from './commands'; +export { RediSearchSchema, SchemaFieldTypes, SchemaTextFieldPhonetics, SearchReply } from './commands'; export { AggregateSteps, AggregateGroupByReducers } from './commands/AGGREGATE'; +export { SearchOptions } from './commands/SEARCH'; \ No newline at end of file