diff --git a/docs/.nojekyll b/docs/.nojekyll deleted file mode 100644 index e2ac6616..00000000 --- a/docs/.nojekyll +++ /dev/null @@ -1 +0,0 @@ -TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index dd03854b..00000000 --- a/docs/README.md +++ /dev/null @@ -1,302 +0,0 @@ -redis-om - -# redis-om - -## Table of contents - -### Classes - -- [AbstractSearch](classes/AbstractSearch.md) -- [Circle](classes/Circle.md) -- [Client](classes/Client.md) -- [Entity](classes/Entity.md) -- [RawSearch](classes/RawSearch.md) -- [RedisError](classes/RedisError.md) -- [Repository](classes/Repository.md) -- [Schema](classes/Schema.md) -- [Search](classes/Search.md) -- [Where](classes/Where.md) -- [WhereField](classes/WhereField.md) - -### Interfaces - -- [BaseFieldDefinition](interfaces/BaseFieldDefinition.md) -- [BooleanFieldDefinition](interfaces/BooleanFieldDefinition.md) -- [CaseSensitiveFieldDefinition](interfaces/CaseSensitiveFieldDefinition.md) -- [DateFieldDefinition](interfaces/DateFieldDefinition.md) -- [NormalizedFieldDefinition](interfaces/NormalizedFieldDefinition.md) -- [NumberFieldDefinition](interfaces/NumberFieldDefinition.md) -- [PhoneticFieldDefinition](interfaces/PhoneticFieldDefinition.md) -- [PointFieldDefinition](interfaces/PointFieldDefinition.md) -- [SeparableFieldDefinition](interfaces/SeparableFieldDefinition.md) -- [SortableFieldDefinition](interfaces/SortableFieldDefinition.md) -- [StemmingFieldDefinition](interfaces/StemmingFieldDefinition.md) -- [StringArrayFieldDefinition](interfaces/StringArrayFieldDefinition.md) -- [StringFieldDefinition](interfaces/StringFieldDefinition.md) -- [TextFieldDefinition](interfaces/TextFieldDefinition.md) -- [WeightFieldDefinition](interfaces/WeightFieldDefinition.md) - -### Type Aliases - -- [CircleFunction](README.md#circlefunction) -- [DataStructure](README.md#datastructure) -- [EntityConstructor](README.md#entityconstructor) -- [EntityData](README.md#entitydata) -- [EntityValue](README.md#entityvalue) -- [FieldDefinition](README.md#fielddefinition) -- [IdStrategy](README.md#idstrategy) -- [Point](README.md#point) -- [SchemaDefinition](README.md#schemadefinition) -- [SchemaFieldType](README.md#schemafieldtype) -- [SchemaOptions](README.md#schemaoptions) -- [SearchDataStructure](README.md#searchdatastructure) -- [StopWordOptions](README.md#stopwordoptions) -- [SubSearchFunction](README.md#subsearchfunction) - -## Type Aliases - -### CircleFunction - -Ƭ **CircleFunction**: (`circle`: [`Circle`](classes/Circle.md)) => [`Circle`](classes/Circle.md) - -#### Type declaration - -▸ (`circle`): [`Circle`](classes/Circle.md) - -A function that defines a circle for `.inCircle` searches. - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `circle` | [`Circle`](classes/Circle.md) | - -##### Returns - -[`Circle`](classes/Circle.md) - -#### Defined in - -[lib/search/where-point.ts:9](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-point.ts#L9) - -___ - -### DataStructure - -Ƭ **DataStructure**: ``"HASH"`` \| ``"JSON"`` - -The type of data structure in Redis to map objects to. - -#### Defined in - -[lib/schema/options/data-structure.ts:2](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/options/data-structure.ts#L2) - -___ - -### EntityConstructor - -Ƭ **EntityConstructor**<`TEntity`\>: (`schema`: [`Schema`](classes/Schema.md)<`any`\>, `id`: `string`, `data?`: [`EntityData`](README.md#entitydata)) => `TEntity` - -#### Type parameters - -| Name | Description | -| :------ | :------ | -| `TEntity` | The [Entity](classes/Entity.md) type. | - -#### Type declaration - -• (`schema`, `id`, `data?`) - -A constructor that creates an [Entity](classes/Entity.md) of type TEntity. - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `schema` | [`Schema`](classes/Schema.md)<`any`\> | -| `id` | `string` | -| `data?` | [`EntityData`](README.md#entitydata) | - -#### Defined in - -[lib/entity/entity-constructor.ts:8](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/entity/entity-constructor.ts#L8) - -___ - -### EntityData - -Ƭ **EntityData**: `Record`<`string`, [`EntityValue`](README.md#entityvalue)\> - -A JavaScript object containing the underlying data of an [Entity](classes/Entity.md). - -#### Defined in - -[lib/entity/entity-data.ts:6](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/entity/entity-data.ts#L6) - -___ - -### EntityValue - -Ƭ **EntityValue**: `string` \| `number` \| `boolean` \| [`Point`](README.md#point) \| `Date` \| `any`[] \| ``null`` - -Valid types for properties on an [Entity](classes/Entity.md). - -#### Defined in - -[lib/entity/entity-value.ts:6](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/entity/entity-value.ts#L6) - -___ - -### FieldDefinition - -Ƭ **FieldDefinition**: [`StringFieldDefinition`](interfaces/StringFieldDefinition.md) \| [`TextFieldDefinition`](interfaces/TextFieldDefinition.md) \| [`NumberFieldDefinition`](interfaces/NumberFieldDefinition.md) \| [`BooleanFieldDefinition`](interfaces/BooleanFieldDefinition.md) \| [`PointFieldDefinition`](interfaces/PointFieldDefinition.md) \| [`DateFieldDefinition`](interfaces/DateFieldDefinition.md) \| [`StringArrayFieldDefinition`](interfaces/StringArrayFieldDefinition.md) - -Contains instructions telling how to map a property on an [Entity](classes/Entity.md) to Redis. - -#### Defined in - -[lib/schema/definition/field-definition.ts:10](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/field-definition.ts#L10) - -___ - -### IdStrategy - -Ƭ **IdStrategy**: () => `string` - -#### Type declaration - -▸ (): `string` - -A function that generates random [Entity IDs](classes/Entity.md#entityid). - -##### Returns - -`string` - -#### Defined in - -[lib/schema/options/id-strategy.ts:2](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/options/id-strategy.ts#L2) - -___ - -### Point - -Ƭ **Point**: `Object` - -Defines a point on the globe using longitude and latitude. - -#### Type declaration - -| Name | Type | Description | -| :------ | :------ | :------ | -| `latitude` | `number` | The latitude of the point. | -| `longitude` | `number` | The longitude of the point. | - -#### Defined in - -[lib/entity/point.ts:2](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/entity/point.ts#L2) - -___ - -### SchemaDefinition - -Ƭ **SchemaDefinition**: `Record`<`string`, [`FieldDefinition`](README.md#fielddefinition)\> - -Group of [FieldDefinition](README.md#fielddefinition)s that define the schema for an [Entity](classes/Entity.md). - -#### Defined in - -[lib/schema/definition/schema-definition.ts:6](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/schema-definition.ts#L6) - -___ - -### SchemaFieldType - -Ƭ **SchemaFieldType**: ``"string"`` \| ``"number"`` \| ``"boolean"`` \| ``"text"`` \| ``"date"`` \| ``"point"`` \| ``"string[]"`` - -Valid types a [FieldDefinition](README.md#fielddefinition). - -#### Defined in - -[lib/schema/definition/schema-field-type.ts:4](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/schema-field-type.ts#L4) - -___ - -### SchemaOptions - -Ƭ **SchemaOptions**: `Object` - -Configuration options for a [Schema](classes/Schema.md). - -#### Type declaration - -| Name | Type | Description | -| :------ | :------ | :------ | -| `dataStructure?` | [`DataStructure`](README.md#datastructure) | The data structure used to store the [Entity](classes/Entity.md) in Redis. Can be set to either `JSON` or `HASH`. Defaults to JSON. | -| `idStrategy?` | [`IdStrategy`](README.md#idstrategy) | A function that generates a random [Entity ID](classes/Entity.md#entityid). Defaults to a function that generates [ULIDs](https://github.com/ulid/spec). Combined with prefix to generate a Redis key. If prefix is `Foo` and idStratgey returns `12345` then the generated key would be `Foo:12345`. | -| `indexHashName?` | `string` | The name used by Redis OM to store the hash of the index for this [Schema](classes/Schema.md). Defaults to prefix followed by `:index:hash`. So, for a prefix of `Foo`, it would use `Foo:index:hash`. | -| `indexName?` | `string` | The name used by RediSearch to store the index for this [Schema](classes/Schema.md). Defaults to prefix followed by `:index`. So, for a prefix of `Foo`, it would use `Foo:index`. | -| `indexedDefault?` | `boolean` | Whether fields are indexed by default | -| `prefix?` | `string` | The string that comes before the ID when creating Redis keys for [Entities](classes/Entity.md). Defaults to the class name of the [Entity](classes/Entity.md). Combined with the results of idStrategy to generate a key. If prefix is `Foo` and idStrategy returns `12345` then the generated key would be `Foo:12345`. | -| `stopWords?` | `string`[] | Stop words to be used by this schema. If `useStopWords` is anything other than `CUSTOM`, this option is ignored. | -| `useStopWords?` | [`StopWordOptions`](README.md#stopwordoptions) | Configures the usage of stop words. Valid values are `OFF`, `DEFAULT`, and `CUSTOM`. Setting this to `OFF` disables all stop words. Setting this to `DEFAULT` uses the stop words intrinsic to RediSearch. Setting this to `CUSTOM` tells RediSearch to use the stop words in `stopWords`. | - -#### Defined in - -[lib/schema/options/schema-options.ts:9](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/options/schema-options.ts#L9) - -___ - -### SearchDataStructure - -Ƭ **SearchDataStructure**: ``"HASH"`` \| ``"JSON"`` - -The type of data structure in Redis to map objects to. - -#### Defined in - -[lib/client.ts:23](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/client.ts#L23) - -___ - -### StopWordOptions - -Ƭ **StopWordOptions**: ``"OFF"`` \| ``"DEFAULT"`` \| ``"CUSTOM"`` - -Valid values for how to use stop words for a given [Schema](classes/Schema.md). - -#### Defined in - -[lib/schema/options/stop-word-options.ts:2](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/options/stop-word-options.ts#L2) - -___ - -### SubSearchFunction - -Ƭ **SubSearchFunction**<`TEntity`\>: (`search`: [`Search`](classes/Search.md)<`TEntity`\>) => [`Search`](classes/Search.md)<`TEntity`\> - -#### Type parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `TEntity` | extends [`Entity`](classes/Entity.md) | The type of [Entity](classes/Entity.md) being sought. | - -#### Type declaration - -▸ (`search`): [`Search`](classes/Search.md)<`TEntity`\> - -A function that takes a [Search](classes/Search.md) and returns a [Search](classes/Search.md). Used in nested queries. - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `search` | [`Search`](classes/Search.md)<`TEntity`\> | - -##### Returns - -[`Search`](classes/Search.md)<`TEntity`\> - -#### Defined in - -[lib/search/search.ts:26](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L26) diff --git a/docs/classes/AbstractSearch.md b/docs/classes/AbstractSearch.md deleted file mode 100644 index d657e1b9..00000000 --- a/docs/classes/AbstractSearch.md +++ /dev/null @@ -1,914 +0,0 @@ -[redis-om](../README.md) / AbstractSearch - -# Class: AbstractSearch - -Abstract base class for [Search](Search.md) and [RawSearch](RawSearch.md) that -contains methods to return search results. - -## Type parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `TEntity` | extends [`Entity`](Entity.md) | The type of [Entity](Entity.md) being sought. | - -## Hierarchy - -- **`AbstractSearch`** - - ↳ [`Search`](Search.md) - - ↳ [`RawSearch`](RawSearch.md) - -## Table of contents - -### Accessors - -- [return](AbstractSearch.md#return) - -### Methods - -- [all](AbstractSearch.md#all) -- [allIds](AbstractSearch.md#allids) -- [allKeys](AbstractSearch.md#allkeys) -- [count](AbstractSearch.md#count) -- [first](AbstractSearch.md#first) -- [firstId](AbstractSearch.md#firstid) -- [firstKey](AbstractSearch.md#firstkey) -- [max](AbstractSearch.md#max) -- [maxId](AbstractSearch.md#maxid) -- [maxKey](AbstractSearch.md#maxkey) -- [min](AbstractSearch.md#min) -- [minId](AbstractSearch.md#minid) -- [minKey](AbstractSearch.md#minkey) -- [page](AbstractSearch.md#page) -- [pageOfIds](AbstractSearch.md#pageofids) -- [pageOfKeys](AbstractSearch.md#pageofkeys) -- [returnAll](AbstractSearch.md#returnall) -- [returnAllIds](AbstractSearch.md#returnallids) -- [returnAllKeys](AbstractSearch.md#returnallkeys) -- [returnCount](AbstractSearch.md#returncount) -- [returnFirst](AbstractSearch.md#returnfirst) -- [returnFirstId](AbstractSearch.md#returnfirstid) -- [returnFirstKey](AbstractSearch.md#returnfirstkey) -- [returnMax](AbstractSearch.md#returnmax) -- [returnMaxId](AbstractSearch.md#returnmaxid) -- [returnMaxKey](AbstractSearch.md#returnmaxkey) -- [returnMin](AbstractSearch.md#returnmin) -- [returnMinId](AbstractSearch.md#returnminid) -- [returnMinKey](AbstractSearch.md#returnminkey) -- [returnPage](AbstractSearch.md#returnpage) -- [returnPageOfIds](AbstractSearch.md#returnpageofids) -- [returnPageOfKeys](AbstractSearch.md#returnpageofkeys) -- [sortAsc](AbstractSearch.md#sortasc) -- [sortAscending](AbstractSearch.md#sortascending) -- [sortBy](AbstractSearch.md#sortby) -- [sortDesc](AbstractSearch.md#sortdesc) -- [sortDescending](AbstractSearch.md#sortdescending) - -## Accessors - -### return - -• `get` **return**(): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -Returns the current instance. Syntactic sugar to make your code more fluent. - -#### Returns - -[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -this - -#### Defined in - -[lib/search/search.ts:333](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L333) - -## Methods - -### all - -▸ **all**(`options?`): `Promise`<`TEntity`[]\> - -Returns all the [Entities](Entity.md) that match this query. This method -makes multiple calls to Redis until all the [Entities](Entity.md) are returned. -You can specify the batch size by setting the `pageSize` property on the -options: - -```typescript -const entities = await repository.search().returnAll({ pageSize: 100 }); -``` - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `options` | `Object` | `undefined` | Options for the call. | -| `options.pageSize` | `number` | `10` | Number of [Entities](Entity.md) returned per batch. | - -#### Returns - -`Promise`<`TEntity`[]\> - -An array of [Entities](Entity.md) matching the query. - -#### Defined in - -[lib/search/search.ts:266](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L266) - -___ - -### allIds - -▸ **allIds**(`options?`): `Promise`<`string`[]\> - -Returns all the entity IDs that match this query. This method -makes multiple calls to Redis until all the entity IDs are returned. -You can specify the batch size by setting the `pageSize` property on the -options: - -```typescript -const keys = await repository.search().returnAllIds({ pageSize: 100 }); -``` - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `options` | `Object` | `undefined` | Options for the call. | -| `options.pageSize` | `number` | `10` | Number of entity IDs returned per batch. | - -#### Returns - -`Promise`<`string`[]\> - -An array of entity IDs matching the query. - -#### Defined in - -[lib/search/search.ts:295](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L295) - -___ - -### allKeys - -▸ **allKeys**(`options?`): `Promise`<`string`[]\> - -Returns all the key names in Redis that match this query. This method -makes multiple calls to Redis until all the key names are returned. -You can specify the batch size by setting the `pageSize` property on the -options: - -```typescript -const keys = await repository.search().returnAllKeys({ pageSize: 100 }); -``` - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `options` | `Object` | `undefined` | Options for the call. | -| `options.pageSize` | `number` | `10` | Number of key names returned per batch. | - -#### Returns - -`Promise`<`string`[]\> - -An array of key names matching the query. - -#### Defined in - -[lib/search/search.ts:314](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L314) - -___ - -### count - -▸ **count**(): `Promise`<`number`\> - -Returns the number of [Entities](Entity.md) that match this query. - -#### Returns - -`Promise`<`number`\> - -#### Defined in - -[lib/search/search.ts:186](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L186) - -___ - -### first - -▸ **first**(): `Promise`<``null`` \| `TEntity`\> - -Returns the first [Entity](Entity.md) that matches this query. - -#### Returns - -`Promise`<``null`` \| `TEntity`\> - -#### Defined in - -[lib/search/search.ts:231](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L231) - -___ - -### firstId - -▸ **firstId**(): `Promise`<``null`` \| `string`\> - -Returns the first entity ID that matches this query. - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Defined in - -[lib/search/search.ts:239](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L239) - -___ - -### firstKey - -▸ **firstKey**(): `Promise`<``null`` \| `string`\> - -Returns the first key name that matches this query. - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Defined in - -[lib/search/search.ts:247](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L247) - -___ - -### max - -▸ **max**(`field`): `Promise`<``null`` \| `TEntity`\> - -Finds the [Entity](Entity.md) with the maximal value for a field. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field with the maximal value. | - -#### Returns - -`Promise`<``null`` \| `TEntity`\> - -The entity ID [Entity](Entity.md) with the maximal value - -#### Defined in - -[lib/search/search.ts:159](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L159) - -___ - -### maxId - -▸ **maxId**(`field`): `Promise`<``null`` \| `string`\> - -Finds the entity ID with the maximal value for a field. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field with the maximal value. | - -#### Returns - -`Promise`<``null`` \| `string`\> - -The entity ID with the maximal value - -#### Defined in - -[lib/search/search.ts:168](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L168) - -___ - -### maxKey - -▸ **maxKey**(`field`): `Promise`<``null`` \| `string`\> - -Finds the key name in Redis with the maximal value for a field. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field with the maximal value. | - -#### Returns - -`Promise`<``null`` \| `string`\> - -The key name with the maximal value - -#### Defined in - -[lib/search/search.ts:178](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L178) - -___ - -### min - -▸ **min**(`field`): `Promise`<``null`` \| `TEntity`\> - -Finds the [Entity](Entity.md) with the minimal value for a field. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field with the minimal value. | - -#### Returns - -`Promise`<``null`` \| `TEntity`\> - -The [Entity](Entity.md) with the minimal value - -#### Defined in - -[lib/search/search.ts:131](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L131) - -___ - -### minId - -▸ **minId**(`field`): `Promise`<``null`` \| `string`\> - -Finds the entity ID with the minimal value for a field. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field with the minimal value. | - -#### Returns - -`Promise`<``null`` \| `string`\> - -The entity ID with the minimal value - -#### Defined in - -[lib/search/search.ts:140](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L140) - -___ - -### minKey - -▸ **minKey**(`field`): `Promise`<``null`` \| `string`\> - -Finds the key name in Redis with the minimal value for a field. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field with the minimal value. | - -#### Returns - -`Promise`<``null`` \| `string`\> - -The key name with the minimal value - -#### Defined in - -[lib/search/search.ts:150](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L150) - -___ - -### page - -▸ **page**(`offset`, `count`): `Promise`<`TEntity`[]\> - -Returns a page of [Entities](Entity.md) that match this query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `offset` | `number` | The offset for where to start returning [Entities](Entity.md). | -| `count` | `number` | The number of [Entities](Entity.md) to return. | - -#### Returns - -`Promise`<`TEntity`[]\> - -An array of [Entities](Entity.md) matching the query. - -#### Defined in - -[lib/search/search.ts:199](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L199) - -___ - -### pageOfIds - -▸ **pageOfIds**(`offset`, `count`): `Promise`<`string`[]\> - -Returns a page of entity IDs that match this query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `offset` | `number` | The offset for where to start returning entity IDs. | -| `count` | `number` | The number of entity IDs to return. | - -#### Returns - -`Promise`<`string`[]\> - -An array of strings matching the query. - -#### Defined in - -[lib/search/search.ts:212](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L212) - -___ - -### pageOfKeys - -▸ **pageOfKeys**(`offset`, `count`): `Promise`<`string`[]\> - -Returns a page of key names in Redis that match this query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `offset` | `number` | The offset for where to start returning key names. | -| `count` | `number` | The number of key names to return. | - -#### Returns - -`Promise`<`string`[]\> - -An array of strings matching the query. - -#### Defined in - -[lib/search/search.ts:223](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L223) - -___ - -### returnAll - -▸ **returnAll**(`options?`): `Promise`<`TEntity`[]\> - -Alias for [Search.all](Search.md#all). - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `options` | `Object` | `undefined` | -| `options.pageSize` | `number` | `10` | - -#### Returns - -`Promise`<`TEntity`[]\> - -#### Defined in - -[lib/search/search.ts:431](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L431) - -___ - -### returnAllIds - -▸ **returnAllIds**(`options?`): `Promise`<`string`[]\> - -Alias for [Search.allIds](Search.md#allids). - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `options` | `Object` | `undefined` | -| `options.pageSize` | `number` | `10` | - -#### Returns - -`Promise`<`string`[]\> - -#### Defined in - -[lib/search/search.ts:438](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L438) - -___ - -### returnAllKeys - -▸ **returnAllKeys**(`options?`): `Promise`<`string`[]\> - -Alias for [Search.allKeys](Search.md#allkeys). - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `options` | `Object` | `undefined` | -| `options.pageSize` | `number` | `10` | - -#### Returns - -`Promise`<`string`[]\> - -#### Defined in - -[lib/search/search.ts:445](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L445) - -___ - -### returnCount - -▸ **returnCount**(): `Promise`<`number`\> - -Alias for [Search.count](Search.md#count). - -#### Returns - -`Promise`<`number`\> - -#### Defined in - -[lib/search/search.ts:382](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L382) - -___ - -### returnFirst - -▸ **returnFirst**(): `Promise`<``null`` \| `TEntity`\> - -Alias for [Search.first](Search.md#first). - -#### Returns - -`Promise`<``null`` \| `TEntity`\> - -#### Defined in - -[lib/search/search.ts:410](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L410) - -___ - -### returnFirstId - -▸ **returnFirstId**(): `Promise`<``null`` \| `string`\> - -Alias for [Search.firstId](Search.md#firstid). - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Defined in - -[lib/search/search.ts:417](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L417) - -___ - -### returnFirstKey - -▸ **returnFirstKey**(): `Promise`<``null`` \| `string`\> - -Alias for [Search.firstKey](Search.md#firstkey). - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Defined in - -[lib/search/search.ts:424](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L424) - -___ - -### returnMax - -▸ **returnMax**(`field`): `Promise`<``null`` \| `TEntity`\> - -Alias for [Search.max](Search.md#max). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -`Promise`<``null`` \| `TEntity`\> - -#### Defined in - -[lib/search/search.ts:361](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L361) - -___ - -### returnMaxId - -▸ **returnMaxId**(`field`): `Promise`<``null`` \| `string`\> - -Alias for [Search.maxId](Search.md#maxid). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Defined in - -[lib/search/search.ts:368](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L368) - -___ - -### returnMaxKey - -▸ **returnMaxKey**(`field`): `Promise`<``null`` \| `string`\> - -Alias for [Search.maxKey](Search.md#maxkey). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Defined in - -[lib/search/search.ts:375](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L375) - -___ - -### returnMin - -▸ **returnMin**(`field`): `Promise`<``null`` \| `TEntity`\> - -Alias for [Search.min](Search.md#min). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -`Promise`<``null`` \| `TEntity`\> - -#### Defined in - -[lib/search/search.ts:340](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L340) - -___ - -### returnMinId - -▸ **returnMinId**(`field`): `Promise`<``null`` \| `string`\> - -Alias for [Search.minId](Search.md#minid). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Defined in - -[lib/search/search.ts:347](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L347) - -___ - -### returnMinKey - -▸ **returnMinKey**(`field`): `Promise`<``null`` \| `string`\> - -Alias for [Search.minKey](Search.md#minkey). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Defined in - -[lib/search/search.ts:354](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L354) - -___ - -### returnPage - -▸ **returnPage**(`offset`, `count`): `Promise`<`TEntity`[]\> - -Alias for [Search.page](Search.md#page). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `offset` | `number` | -| `count` | `number` | - -#### Returns - -`Promise`<`TEntity`[]\> - -#### Defined in - -[lib/search/search.ts:389](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L389) - -___ - -### returnPageOfIds - -▸ **returnPageOfIds**(`offset`, `count`): `Promise`<`string`[]\> - -Alias for [Search.pageOfIds](Search.md#pageofids). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `offset` | `number` | -| `count` | `number` | - -#### Returns - -`Promise`<`string`[]\> - -#### Defined in - -[lib/search/search.ts:396](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L396) - -___ - -### returnPageOfKeys - -▸ **returnPageOfKeys**(`offset`, `count`): `Promise`<`string`[]\> - -Alias for {@link Search.pageOrKeys}. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `offset` | `number` | -| `count` | `number` | - -#### Returns - -`Promise`<`string`[]\> - -#### Defined in - -[lib/search/search.ts:403](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L403) - -___ - -### sortAsc - -▸ **sortAsc**(`field`): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -Alias for [Search.sortAscending](Search.md#sortascending). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -#### Defined in - -[lib/search/search.ts:83](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L83) - -___ - -### sortAscending - -▸ **sortAscending**(`field`): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -Applies an ascending sort to the query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field to sort by. | - -#### Returns - -[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -this - -#### Defined in - -[lib/search/search.ts:60](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L60) - -___ - -### sortBy - -▸ **sortBy**(`field`, `order?`): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -Applies sorting for the query. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `field` | `string` | `undefined` | The field to sort by. | -| `order` | ``"ASC"`` \| ``"DESC"`` | `'ASC'` | The order of returned [Entities](Entity.md) Defaults to `ASC` (ascending) if not specified | - -#### Returns - -[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -this - -#### Defined in - -[lib/search/search.ts:93](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L93) - -___ - -### sortDesc - -▸ **sortDesc**(`field`): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -Alias for [Search.sortDescending](Search.md#sortdescending). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -#### Defined in - -[lib/search/search.ts:67](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L67) - -___ - -### sortDescending - -▸ **sortDescending**(`field`): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -Applies a descending sort to the query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field to sort by. | - -#### Returns - -[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -this - -#### Defined in - -[lib/search/search.ts:76](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L76) diff --git a/docs/classes/Circle.md b/docs/classes/Circle.md deleted file mode 100644 index 2c285020..00000000 --- a/docs/classes/Circle.md +++ /dev/null @@ -1,327 +0,0 @@ -[redis-om](../README.md) / Circle - -# Class: Circle - -A builder that defines a circle. - -## Table of contents - -### Constructors - -- [constructor](Circle.md#constructor) - -### Accessors - -- [feet](Circle.md#feet) -- [foot](Circle.md#foot) -- [ft](Circle.md#ft) -- [kilometer](Circle.md#kilometer) -- [kilometers](Circle.md#kilometers) -- [km](Circle.md#km) -- [m](Circle.md#m) -- [meter](Circle.md#meter) -- [meters](Circle.md#meters) -- [mi](Circle.md#mi) -- [mile](Circle.md#mile) -- [miles](Circle.md#miles) - -### Methods - -- [latitude](Circle.md#latitude) -- [longitude](Circle.md#longitude) -- [radius](Circle.md#radius) - -## Constructors - -### constructor - -• **new Circle**() - -## Accessors - -### feet - -• `get` **feet**(): `this` - -Sets the units to feet. - -#### Returns - -`this` - -This instance. - -#### Defined in - -[lib/search/where-point.ts:150](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-point.ts#L150) - -___ - -### foot - -• `get` **foot**(): `this` - -Sets the units to feet. - -#### Returns - -`this` - -This instance. - -#### Defined in - -[lib/search/where-point.ts:144](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-point.ts#L144) - -___ - -### ft - -• `get` **ft**(): `this` - -Sets the units to feet. - -#### Returns - -`this` - -This instance. - -#### Defined in - -[lib/search/where-point.ts:138](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-point.ts#L138) - -___ - -### kilometer - -• `get` **kilometer**(): `this` - -Sets the units to kilometers. - -#### Returns - -`this` - -This instance. - -#### Defined in - -[lib/search/where-point.ts:123](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-point.ts#L123) - -___ - -### kilometers - -• `get` **kilometers**(): `this` - -Sets the units to kilometers. - -#### Returns - -`this` - -This instance. - -#### Defined in - -[lib/search/where-point.ts:129](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-point.ts#L129) - -___ - -### km - -• `get` **km**(): `this` - -Sets the units to kilometers. - -#### Returns - -`this` - -This instance. - -#### Defined in - -[lib/search/where-point.ts:117](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-point.ts#L117) - -___ - -### m - -• `get` **m**(): `this` - -Sets the units to meters. - -#### Returns - -`this` - -This instance. - -#### Defined in - -[lib/search/where-point.ts:96](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-point.ts#L96) - -___ - -### meter - -• `get` **meter**(): `this` - -Sets the units to meters. - -#### Returns - -`this` - -This instance. - -#### Defined in - -[lib/search/where-point.ts:102](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-point.ts#L102) - -___ - -### meters - -• `get` **meters**(): `this` - -Sets the units to meters. - -#### Returns - -`this` - -This instance. - -#### Defined in - -[lib/search/where-point.ts:108](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-point.ts#L108) - -___ - -### mi - -• `get` **mi**(): `this` - -Sets the units to miles. - -#### Returns - -`this` - -This instance. - -#### Defined in - -[lib/search/where-point.ts:159](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-point.ts#L159) - -___ - -### mile - -• `get` **mile**(): `this` - -Sets the units to miles. - -#### Returns - -`this` - -This instance. - -#### Defined in - -[lib/search/where-point.ts:165](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-point.ts#L165) - -___ - -### miles - -• `get` **miles**(): `this` - -Sets the units to miles. - -#### Returns - -`this` - -This instance. - -#### Defined in - -[lib/search/where-point.ts:171](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-point.ts#L171) - -## Methods - -### latitude - -▸ **latitude**(`value`): [`Circle`](Circle.md) - -Sets the latitude. If not set, defaults to 0.0. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `number` | The latitude. | - -#### Returns - -[`Circle`](Circle.md) - -This instance. - -#### Defined in - -[lib/search/where-point.ts:43](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-point.ts#L43) - -___ - -### longitude - -▸ **longitude**(`value`): [`Circle`](Circle.md) - -Sets the longitude. If not set, defaults to 0.0. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `number` | The longitude. | - -#### Returns - -[`Circle`](Circle.md) - -This instance. - -#### Defined in - -[lib/search/where-point.ts:32](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-point.ts#L32) - -___ - -### radius - -▸ **radius**(`size`): [`Circle`](Circle.md) - -Sets the radius of the [Circle](Circle.md). Defaults to 1. If units are -not specified, defaults to meters. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `size` | `number` | The radius of the circle. | - -#### Returns - -[`Circle`](Circle.md) - -This instance. - -#### Defined in - -[lib/search/where-point.ts:87](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-point.ts#L87) diff --git a/docs/classes/Client.md b/docs/classes/Client.md deleted file mode 100644 index 300e49f2..00000000 --- a/docs/classes/Client.md +++ /dev/null @@ -1,171 +0,0 @@ -[redis-om](../README.md) / Client - -# Class: Client - -A Client is the starting point for working with Redis OM. Clients manage the -connection to Redis and provide limited functionality for executing Redis commands. -Create a client and open it before you use it: - -```typescript -const client = new Client(); -await client.open(); -``` - -A Client is primarily used by a [Repository](Repository.md) which requires a client in -its constructor. - -## Table of contents - -### Constructors - -- [constructor](Client.md#constructor) - -### Methods - -- [close](Client.md#close) -- [execute](Client.md#execute) -- [fetchRepository](Client.md#fetchrepository) -- [isOpen](Client.md#isopen) -- [open](Client.md#open) -- [use](Client.md#use) - -## Constructors - -### constructor - -• **new Client**() - -## Methods - -### close - -▸ **close**(): `Promise`<`void`\> - -Close the connection to Redis. - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[lib/client.ts:131](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/client.ts#L131) - -___ - -### execute - -▸ **execute**(`command`): `Promise`<`unknown`\> - -Execute an arbitrary Redis command. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `command` | (`string` \| `number` \| `boolean`)[] | The command to execute. | - -#### Returns - -`Promise`<`unknown`\> - -The raw results of calling the Redis command. - -#### Defined in - -[lib/client.ts:104](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/client.ts#L104) - -___ - -### fetchRepository - -▸ **fetchRepository**<`TEntity`\>(`schema`): [`Repository`](Repository.md)<`TEntity`\> - -Creates a repository for the given schema. - -#### Type parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `TEntity` | extends [`Entity`](Entity.md)<`TEntity`\> | The entity type for this [Schema](Schema.md) and [Repository](Repository.md). | - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `schema` | [`Schema`](Schema.md)<`TEntity`\> | The schema. | - -#### Returns - -[`Repository`](Repository.md)<`TEntity`\> - -A repository for the provided schema. - -#### Defined in - -[lib/client.ts:119](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/client.ts#L119) - -___ - -### isOpen - -▸ **isOpen**(): `boolean` - -#### Returns - -`boolean` - -Whether a connection is already open. - -#### Defined in - -[lib/client.ts:245](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/client.ts#L245) - -___ - -### open - -▸ **open**(`url?`): `Promise`<[`Client`](Client.md)\> - -Open a connection to Redis at the provided URL. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `url` | `string` | `'redis://localhost:6379'` | A URL to Redis as defined with the [IANA](https://www.iana.org/assignments/uri-schemes/prov/redis). | - -#### Returns - -`Promise`<[`Client`](Client.md)\> - -This [Client](Client.md) instance. - -#### Defined in - -[lib/client.ts:90](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/client.ts#L90) - -___ - -### use - -▸ **use**(`connection`): `Promise`<[`Client`](Client.md)\> - -Attaches an existing Node Redis connection to this Redis OM client. Closes -any existing connection. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `connection` | `RedisClientType`<{ `bf`: { `ADD`: `__module` ; `EXISTS`: `__module` ; `INFO`: `__module` ; `INSERT`: `__module` ; `LOADCHUNK`: `__module` ; `MADD`: `__module` ; `MEXISTS`: `__module` ; `RESERVE`: `__module` ; `SCANDUMP`: `__module` ; `add`: `__module` ; `exists`: `__module` ; `info`: `__module` ; `insert`: `__module` ; `loadChunk`: `__module` ; `mAdd`: `__module` ; `mExists`: `__module` ; `reserve`: `__module` ; `scanDump`: `__module` } ; `cf`: { `ADD`: `__module` ; `ADDNX`: `__module` ; `COUNT`: `__module` ; `DEL`: `__module` ; `EXISTS`: `__module` ; `INFO`: `__module` ; `INSERT`: `__module` ; `INSERTNX`: `__module` ; `LOADCHUNK`: `__module` ; `RESERVE`: `__module` ; `SCANDUMP`: `__module` ; `add`: `__module` ; `addNX`: `__module` ; `count`: `__module` ; `del`: `__module` ; `exists`: `__module` ; `info`: `__module` ; `insert`: `__module` ; `insertNX`: `__module` ; `loadChunk`: `__module` ; `reserve`: `__module` ; `scanDump`: `__module` } ; `cms`: { `INCRBY`: `__module` ; `INFO`: `__module` ; `INITBYDIM`: `__module` ; `INITBYPROB`: `__module` ; `MERGE`: `__module` ; `QUERY`: `__module` ; `incrBy`: `__module` ; `info`: `__module` ; `initByDim`: `__module` ; `initByProb`: `__module` ; `merge`: `__module` ; `query`: `__module` } ; `ft`: { `AGGREGATE`: `__module` ; `ALIASADD`: `__module` ; `ALIASDEL`: `__module` ; `ALIASUPDATE`: `__module` ; `ALTER`: `__module` ; `CONFIG_GET`: `__module` ; `CONFIG_SET`: `__module` ; `CREATE`: `__module` ; `DICTADD`: `__module` ; `DICTDEL`: `__module` ; `DICTDUMP`: `__module` ; `DROPINDEX`: `__module` ; `EXPLAIN`: `__module` ; `EXPLAINCLI`: `__module` ; `INFO`: `__module` ; `PROFILEAGGREGATE`: `__module` ; `PROFILESEARCH`: `__module` ; `SEARCH`: `__module` ; `SPELLCHECK`: `__module` ; `SUGADD`: `__module` ; `SUGDEL`: `__module` ; `SUGGET`: `__module` ; `SUGGET_WITHPAYLOADS`: `__module` ; `SUGGET_WITHSCORES`: `__module` ; `SUGGET_WITHSCORES_WITHPAYLOADS`: `__module` ; `SUGLEN`: `__module` ; `SYNDUMP`: `__module` ; `SYNUPDATE`: `__module` ; `TAGVALS`: `__module` ; `_LIST`: `__module` ; `_list`: `__module` ; `aggregate`: `__module` ; `aliasAdd`: `__module` ; `aliasDel`: `__module` ; `aliasUpdate`: `__module` ; `alter`: `__module` ; `configGet`: `__module` ; `configSet`: `__module` ; `create`: `__module` ; `dictAdd`: `__module` ; `dictDel`: `__module` ; `dictDump`: `__module` ; `dropIndex`: `__module` ; `explain`: `__module` ; `explainCli`: `__module` ; `info`: `__module` ; `profileAggregate`: `__module` ; `profileSearch`: `__module` ; `search`: `__module` ; `spellCheck`: `__module` ; `sugAdd`: `__module` ; `sugDel`: `__module` ; `sugGet`: `__module` ; `sugGetWithPayloads`: `__module` ; `sugGetWithScores`: `__module` ; `sugGetWithScoresWithPayloads`: `__module` ; `sugLen`: `__module` ; `synDump`: `__module` ; `synUpdate`: `__module` ; `tagVals`: `__module` } ; `graph`: { `CONFIG_GET`: `__module` ; `CONFIG_SET`: `__module` ; `DELETE`: `__module` ; `EXPLAIN`: `__module` ; `LIST`: `__module` ; `PROFILE`: `__module` ; `QUERY`: `__module` ; `QUERY_RO`: `__module` ; `SLOWLOG`: `__module` ; `configGet`: `__module` ; `configSet`: `__module` ; `delete`: `__module` ; `explain`: `__module` ; `list`: `__module` ; `profile`: `__module` ; `query`: `__module` ; `queryRo`: `__module` ; `slowLog`: `__module` } ; `json`: { `ARRAPPEND`: `__module` ; `ARRINDEX`: `__module` ; `ARRINSERT`: `__module` ; `ARRLEN`: `__module` ; `ARRPOP`: `__module` ; `ARRTRIM`: `__module` ; `DEBUG_MEMORY`: `__module` ; `DEL`: `__module` ; `FORGET`: `__module` ; `GET`: `__module` ; `MGET`: `__module` ; `NUMINCRBY`: `__module` ; `NUMMULTBY`: `__module` ; `OBJKEYS`: `__module` ; `OBJLEN`: `__module` ; `RESP`: `__module` ; `SET`: `__module` ; `STRAPPEND`: `__module` ; `STRLEN`: `__module` ; `TYPE`: `__module` ; `arrAppend`: `__module` ; `arrIndex`: `__module` ; `arrInsert`: `__module` ; `arrLen`: `__module` ; `arrPop`: `__module` ; `arrTrim`: `__module` ; `debugMemory`: `__module` ; `del`: `__module` ; `forget`: `__module` ; `get`: `__module` ; `mGet`: `__module` ; `numIncrBy`: `__module` ; `numMultBy`: `__module` ; `objKeys`: `__module` ; `objLen`: `__module` ; `resp`: `__module` ; `set`: `__module` ; `strAppend`: `__module` ; `strLen`: `__module` ; `type`: `__module` } ; `topK`: { `ADD`: `__module` ; `COUNT`: `__module` ; `INCRBY`: `__module` ; `INFO`: `__module` ; `LIST`: `__module` ; `LIST_WITHCOUNT`: `__module` ; `QUERY`: `__module` ; `RESERVE`: `__module` ; `add`: `__module` ; `count`: `__module` ; `incrBy`: `__module` ; `info`: `__module` ; `list`: `__module` ; `listWithCount`: `__module` ; `query`: `__module` ; `reserve`: `__module` } ; `ts`: { `ADD`: `__module` ; `ALTER`: `__module` ; `CREATE`: `__module` ; `CREATERULE`: `__module` ; `DECRBY`: `__module` ; `DEL`: `__module` ; `DELETERULE`: `__module` ; `GET`: `__module` ; `INCRBY`: `__module` ; `INFO`: `__module` ; `INFO_DEBUG`: `__module` ; `MADD`: `__module` ; `MGET`: `__module` ; `MGET_WITHLABELS`: `__module` ; `MRANGE`: `__module` ; `MRANGE_WITHLABELS`: `__module` ; `MREVRANGE`: `__module` ; `MREVRANGE_WITHLABELS`: `__module` ; `QUERYINDEX`: `__module` ; `RANGE`: `__module` ; `REVRANGE`: `__module` ; `add`: `__module` ; `alter`: `__module` ; `create`: `__module` ; `createRule`: `__module` ; `decrBy`: `__module` ; `del`: `__module` ; `deleteRule`: `__module` ; `get`: `__module` ; `incrBy`: `__module` ; `info`: `__module` ; `infoDebug`: `__module` ; `mAdd`: `__module` ; `mGet`: `__module` ; `mGetWithLabels`: `__module` ; `mRange`: `__module` ; `mRangeWithLabels`: `__module` ; `mRevRange`: `__module` ; `mRevRangeWithLabels`: `__module` ; `queryIndex`: `__module` ; `range`: `__module` ; `revRange`: `__module` } } & `RedisModules`, `RedisFunctions`, `RedisScripts`\> | An existing Node Redis client. | - -#### Returns - -`Promise`<[`Client`](Client.md)\> - -This [Client](Client.md) instance. - -#### Defined in - -[lib/client.ts:78](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/client.ts#L78) diff --git a/docs/classes/Entity.md b/docs/classes/Entity.md deleted file mode 100644 index 7b39dc43..00000000 --- a/docs/classes/Entity.md +++ /dev/null @@ -1,70 +0,0 @@ -[redis-om](../README.md) / Entity - -# Class: Entity - -An Entity is the class from which objects that Redis OM maps to are made. You need -to subclass Entity in your application: - -```typescript -class Foo extends Entity {} -``` - -## Table of contents - -### Properties - -- [entityId](Entity.md#entityid) - -### Accessors - -- [keyName](Entity.md#keyname) - -### Methods - -- [toJSON](Entity.md#tojson) - -## Properties - -### entityId - -• `Readonly` **entityId**: `string` - -The generated entity ID. - -#### Defined in - -[lib/entity/entity.ts:37](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/entity/entity.ts#L37) - -## Accessors - -### keyName - -• `get` **keyName**(): `string` - -#### Returns - -`string` - -The keyname this [Entity](Entity.md) is stored with in Redis. - -#### Defined in - -[lib/entity/entity.ts:73](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/entity/entity.ts#L73) - -## Methods - -### toJSON - -▸ **toJSON**(): `Record`<`string`, `any`\> - -Converts this [Entity](Entity.md) to a JavaScript object suitable for stringification. - -#### Returns - -`Record`<`string`, `any`\> - -a JavaScript object. - -#### Defined in - -[lib/entity/entity.ts:81](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/entity/entity.ts#L81) diff --git a/docs/classes/RawSearch.md b/docs/classes/RawSearch.md deleted file mode 100644 index 64bb1254..00000000 --- a/docs/classes/RawSearch.md +++ /dev/null @@ -1,1065 +0,0 @@ -[redis-om](../README.md) / RawSearch - -# Class: RawSearch - -Entry point to raw search which allows using raw RediSearch queries -against Redis OM. Requires that RediSearch (and optionally RedisJSON) be -installed. - -## Type parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `TEntity` | extends [`Entity`](Entity.md) | The type of [Entity](Entity.md) being sought. | - -## Hierarchy - -- [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - - ↳ **`RawSearch`** - -## Table of contents - -### Accessors - -- [return](RawSearch.md#return) - -### Methods - -- [all](RawSearch.md#all) -- [allIds](RawSearch.md#allids) -- [allKeys](RawSearch.md#allkeys) -- [count](RawSearch.md#count) -- [first](RawSearch.md#first) -- [firstId](RawSearch.md#firstid) -- [firstKey](RawSearch.md#firstkey) -- [max](RawSearch.md#max) -- [maxId](RawSearch.md#maxid) -- [maxKey](RawSearch.md#maxkey) -- [min](RawSearch.md#min) -- [minId](RawSearch.md#minid) -- [minKey](RawSearch.md#minkey) -- [page](RawSearch.md#page) -- [pageOfIds](RawSearch.md#pageofids) -- [pageOfKeys](RawSearch.md#pageofkeys) -- [returnAll](RawSearch.md#returnall) -- [returnAllIds](RawSearch.md#returnallids) -- [returnAllKeys](RawSearch.md#returnallkeys) -- [returnCount](RawSearch.md#returncount) -- [returnFirst](RawSearch.md#returnfirst) -- [returnFirstId](RawSearch.md#returnfirstid) -- [returnFirstKey](RawSearch.md#returnfirstkey) -- [returnMax](RawSearch.md#returnmax) -- [returnMaxId](RawSearch.md#returnmaxid) -- [returnMaxKey](RawSearch.md#returnmaxkey) -- [returnMin](RawSearch.md#returnmin) -- [returnMinId](RawSearch.md#returnminid) -- [returnMinKey](RawSearch.md#returnminkey) -- [returnPage](RawSearch.md#returnpage) -- [returnPageOfIds](RawSearch.md#returnpageofids) -- [returnPageOfKeys](RawSearch.md#returnpageofkeys) -- [sortAsc](RawSearch.md#sortasc) -- [sortAscending](RawSearch.md#sortascending) -- [sortBy](RawSearch.md#sortby) -- [sortDesc](RawSearch.md#sortdesc) -- [sortDescending](RawSearch.md#sortdescending) - -## Accessors - -### return - -• `get` **return**(): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -Returns the current instance. Syntactic sugar to make your code more fluent. - -#### Returns - -[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -this - -#### Inherited from - -AbstractSearch.return - -#### Defined in - -[lib/search/search.ts:333](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L333) - -## Methods - -### all - -▸ **all**(`options?`): `Promise`<`TEntity`[]\> - -Returns all the [Entities](Entity.md) that match this query. This method -makes multiple calls to Redis until all the [Entities](Entity.md) are returned. -You can specify the batch size by setting the `pageSize` property on the -options: - -```typescript -const entities = await repository.search().returnAll({ pageSize: 100 }); -``` - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `options` | `Object` | `undefined` | Options for the call. | -| `options.pageSize` | `number` | `10` | Number of [Entities](Entity.md) returned per batch. | - -#### Returns - -`Promise`<`TEntity`[]\> - -An array of [Entities](Entity.md) matching the query. - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[all](AbstractSearch.md#all) - -#### Defined in - -[lib/search/search.ts:266](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L266) - -___ - -### allIds - -▸ **allIds**(`options?`): `Promise`<`string`[]\> - -Returns all the entity IDs that match this query. This method -makes multiple calls to Redis until all the entity IDs are returned. -You can specify the batch size by setting the `pageSize` property on the -options: - -```typescript -const keys = await repository.search().returnAllIds({ pageSize: 100 }); -``` - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `options` | `Object` | `undefined` | Options for the call. | -| `options.pageSize` | `number` | `10` | Number of entity IDs returned per batch. | - -#### Returns - -`Promise`<`string`[]\> - -An array of entity IDs matching the query. - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[allIds](AbstractSearch.md#allids) - -#### Defined in - -[lib/search/search.ts:295](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L295) - -___ - -### allKeys - -▸ **allKeys**(`options?`): `Promise`<`string`[]\> - -Returns all the key names in Redis that match this query. This method -makes multiple calls to Redis until all the key names are returned. -You can specify the batch size by setting the `pageSize` property on the -options: - -```typescript -const keys = await repository.search().returnAllKeys({ pageSize: 100 }); -``` - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `options` | `Object` | `undefined` | Options for the call. | -| `options.pageSize` | `number` | `10` | Number of key names returned per batch. | - -#### Returns - -`Promise`<`string`[]\> - -An array of key names matching the query. - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[allKeys](AbstractSearch.md#allkeys) - -#### Defined in - -[lib/search/search.ts:314](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L314) - -___ - -### count - -▸ **count**(): `Promise`<`number`\> - -Returns the number of [Entities](Entity.md) that match this query. - -#### Returns - -`Promise`<`number`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[count](AbstractSearch.md#count) - -#### Defined in - -[lib/search/search.ts:186](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L186) - -___ - -### first - -▸ **first**(): `Promise`<``null`` \| `TEntity`\> - -Returns the first [Entity](Entity.md) that matches this query. - -#### Returns - -`Promise`<``null`` \| `TEntity`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[first](AbstractSearch.md#first) - -#### Defined in - -[lib/search/search.ts:231](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L231) - -___ - -### firstId - -▸ **firstId**(): `Promise`<``null`` \| `string`\> - -Returns the first entity ID that matches this query. - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[firstId](AbstractSearch.md#firstid) - -#### Defined in - -[lib/search/search.ts:239](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L239) - -___ - -### firstKey - -▸ **firstKey**(): `Promise`<``null`` \| `string`\> - -Returns the first key name that matches this query. - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[firstKey](AbstractSearch.md#firstkey) - -#### Defined in - -[lib/search/search.ts:247](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L247) - -___ - -### max - -▸ **max**(`field`): `Promise`<``null`` \| `TEntity`\> - -Finds the [Entity](Entity.md) with the maximal value for a field. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field with the maximal value. | - -#### Returns - -`Promise`<``null`` \| `TEntity`\> - -The entity ID [Entity](Entity.md) with the maximal value - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[max](AbstractSearch.md#max) - -#### Defined in - -[lib/search/search.ts:159](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L159) - -___ - -### maxId - -▸ **maxId**(`field`): `Promise`<``null`` \| `string`\> - -Finds the entity ID with the maximal value for a field. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field with the maximal value. | - -#### Returns - -`Promise`<``null`` \| `string`\> - -The entity ID with the maximal value - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[maxId](AbstractSearch.md#maxid) - -#### Defined in - -[lib/search/search.ts:168](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L168) - -___ - -### maxKey - -▸ **maxKey**(`field`): `Promise`<``null`` \| `string`\> - -Finds the key name in Redis with the maximal value for a field. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field with the maximal value. | - -#### Returns - -`Promise`<``null`` \| `string`\> - -The key name with the maximal value - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[maxKey](AbstractSearch.md#maxkey) - -#### Defined in - -[lib/search/search.ts:178](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L178) - -___ - -### min - -▸ **min**(`field`): `Promise`<``null`` \| `TEntity`\> - -Finds the [Entity](Entity.md) with the minimal value for a field. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field with the minimal value. | - -#### Returns - -`Promise`<``null`` \| `TEntity`\> - -The [Entity](Entity.md) with the minimal value - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[min](AbstractSearch.md#min) - -#### Defined in - -[lib/search/search.ts:131](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L131) - -___ - -### minId - -▸ **minId**(`field`): `Promise`<``null`` \| `string`\> - -Finds the entity ID with the minimal value for a field. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field with the minimal value. | - -#### Returns - -`Promise`<``null`` \| `string`\> - -The entity ID with the minimal value - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[minId](AbstractSearch.md#minid) - -#### Defined in - -[lib/search/search.ts:140](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L140) - -___ - -### minKey - -▸ **minKey**(`field`): `Promise`<``null`` \| `string`\> - -Finds the key name in Redis with the minimal value for a field. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field with the minimal value. | - -#### Returns - -`Promise`<``null`` \| `string`\> - -The key name with the minimal value - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[minKey](AbstractSearch.md#minkey) - -#### Defined in - -[lib/search/search.ts:150](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L150) - -___ - -### page - -▸ **page**(`offset`, `count`): `Promise`<`TEntity`[]\> - -Returns a page of [Entities](Entity.md) that match this query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `offset` | `number` | The offset for where to start returning [Entities](Entity.md). | -| `count` | `number` | The number of [Entities](Entity.md) to return. | - -#### Returns - -`Promise`<`TEntity`[]\> - -An array of [Entities](Entity.md) matching the query. - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[page](AbstractSearch.md#page) - -#### Defined in - -[lib/search/search.ts:199](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L199) - -___ - -### pageOfIds - -▸ **pageOfIds**(`offset`, `count`): `Promise`<`string`[]\> - -Returns a page of entity IDs that match this query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `offset` | `number` | The offset for where to start returning entity IDs. | -| `count` | `number` | The number of entity IDs to return. | - -#### Returns - -`Promise`<`string`[]\> - -An array of strings matching the query. - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[pageOfIds](AbstractSearch.md#pageofids) - -#### Defined in - -[lib/search/search.ts:212](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L212) - -___ - -### pageOfKeys - -▸ **pageOfKeys**(`offset`, `count`): `Promise`<`string`[]\> - -Returns a page of key names in Redis that match this query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `offset` | `number` | The offset for where to start returning key names. | -| `count` | `number` | The number of key names to return. | - -#### Returns - -`Promise`<`string`[]\> - -An array of strings matching the query. - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[pageOfKeys](AbstractSearch.md#pageofkeys) - -#### Defined in - -[lib/search/search.ts:223](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L223) - -___ - -### returnAll - -▸ **returnAll**(`options?`): `Promise`<`TEntity`[]\> - -Alias for [Search.all](Search.md#all). - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `options` | `Object` | `undefined` | -| `options.pageSize` | `number` | `10` | - -#### Returns - -`Promise`<`TEntity`[]\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnAll](AbstractSearch.md#returnall) - -#### Defined in - -[lib/search/search.ts:431](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L431) - -___ - -### returnAllIds - -▸ **returnAllIds**(`options?`): `Promise`<`string`[]\> - -Alias for [Search.allIds](Search.md#allids). - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `options` | `Object` | `undefined` | -| `options.pageSize` | `number` | `10` | - -#### Returns - -`Promise`<`string`[]\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnAllIds](AbstractSearch.md#returnallids) - -#### Defined in - -[lib/search/search.ts:438](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L438) - -___ - -### returnAllKeys - -▸ **returnAllKeys**(`options?`): `Promise`<`string`[]\> - -Alias for [Search.allKeys](Search.md#allkeys). - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `options` | `Object` | `undefined` | -| `options.pageSize` | `number` | `10` | - -#### Returns - -`Promise`<`string`[]\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnAllKeys](AbstractSearch.md#returnallkeys) - -#### Defined in - -[lib/search/search.ts:445](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L445) - -___ - -### returnCount - -▸ **returnCount**(): `Promise`<`number`\> - -Alias for [Search.count](Search.md#count). - -#### Returns - -`Promise`<`number`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnCount](AbstractSearch.md#returncount) - -#### Defined in - -[lib/search/search.ts:382](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L382) - -___ - -### returnFirst - -▸ **returnFirst**(): `Promise`<``null`` \| `TEntity`\> - -Alias for [Search.first](Search.md#first). - -#### Returns - -`Promise`<``null`` \| `TEntity`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnFirst](AbstractSearch.md#returnfirst) - -#### Defined in - -[lib/search/search.ts:410](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L410) - -___ - -### returnFirstId - -▸ **returnFirstId**(): `Promise`<``null`` \| `string`\> - -Alias for [Search.firstId](Search.md#firstid). - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnFirstId](AbstractSearch.md#returnfirstid) - -#### Defined in - -[lib/search/search.ts:417](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L417) - -___ - -### returnFirstKey - -▸ **returnFirstKey**(): `Promise`<``null`` \| `string`\> - -Alias for [Search.firstKey](Search.md#firstkey). - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnFirstKey](AbstractSearch.md#returnfirstkey) - -#### Defined in - -[lib/search/search.ts:424](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L424) - -___ - -### returnMax - -▸ **returnMax**(`field`): `Promise`<``null`` \| `TEntity`\> - -Alias for [Search.max](Search.md#max). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -`Promise`<``null`` \| `TEntity`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnMax](AbstractSearch.md#returnmax) - -#### Defined in - -[lib/search/search.ts:361](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L361) - -___ - -### returnMaxId - -▸ **returnMaxId**(`field`): `Promise`<``null`` \| `string`\> - -Alias for [Search.maxId](Search.md#maxid). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnMaxId](AbstractSearch.md#returnmaxid) - -#### Defined in - -[lib/search/search.ts:368](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L368) - -___ - -### returnMaxKey - -▸ **returnMaxKey**(`field`): `Promise`<``null`` \| `string`\> - -Alias for [Search.maxKey](Search.md#maxkey). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnMaxKey](AbstractSearch.md#returnmaxkey) - -#### Defined in - -[lib/search/search.ts:375](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L375) - -___ - -### returnMin - -▸ **returnMin**(`field`): `Promise`<``null`` \| `TEntity`\> - -Alias for [Search.min](Search.md#min). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -`Promise`<``null`` \| `TEntity`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnMin](AbstractSearch.md#returnmin) - -#### Defined in - -[lib/search/search.ts:340](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L340) - -___ - -### returnMinId - -▸ **returnMinId**(`field`): `Promise`<``null`` \| `string`\> - -Alias for [Search.minId](Search.md#minid). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnMinId](AbstractSearch.md#returnminid) - -#### Defined in - -[lib/search/search.ts:347](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L347) - -___ - -### returnMinKey - -▸ **returnMinKey**(`field`): `Promise`<``null`` \| `string`\> - -Alias for [Search.minKey](Search.md#minkey). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnMinKey](AbstractSearch.md#returnminkey) - -#### Defined in - -[lib/search/search.ts:354](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L354) - -___ - -### returnPage - -▸ **returnPage**(`offset`, `count`): `Promise`<`TEntity`[]\> - -Alias for [Search.page](Search.md#page). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `offset` | `number` | -| `count` | `number` | - -#### Returns - -`Promise`<`TEntity`[]\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnPage](AbstractSearch.md#returnpage) - -#### Defined in - -[lib/search/search.ts:389](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L389) - -___ - -### returnPageOfIds - -▸ **returnPageOfIds**(`offset`, `count`): `Promise`<`string`[]\> - -Alias for [Search.pageOfIds](Search.md#pageofids). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `offset` | `number` | -| `count` | `number` | - -#### Returns - -`Promise`<`string`[]\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnPageOfIds](AbstractSearch.md#returnpageofids) - -#### Defined in - -[lib/search/search.ts:396](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L396) - -___ - -### returnPageOfKeys - -▸ **returnPageOfKeys**(`offset`, `count`): `Promise`<`string`[]\> - -Alias for {@link Search.pageOrKeys}. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `offset` | `number` | -| `count` | `number` | - -#### Returns - -`Promise`<`string`[]\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnPageOfKeys](AbstractSearch.md#returnpageofkeys) - -#### Defined in - -[lib/search/search.ts:403](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L403) - -___ - -### sortAsc - -▸ **sortAsc**(`field`): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -Alias for [Search.sortAscending](Search.md#sortascending). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[sortAsc](AbstractSearch.md#sortasc) - -#### Defined in - -[lib/search/search.ts:83](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L83) - -___ - -### sortAscending - -▸ **sortAscending**(`field`): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -Applies an ascending sort to the query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field to sort by. | - -#### Returns - -[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -this - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[sortAscending](AbstractSearch.md#sortascending) - -#### Defined in - -[lib/search/search.ts:60](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L60) - -___ - -### sortBy - -▸ **sortBy**(`field`, `order?`): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -Applies sorting for the query. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `field` | `string` | `undefined` | The field to sort by. | -| `order` | ``"ASC"`` \| ``"DESC"`` | `'ASC'` | The order of returned [Entities](Entity.md) Defaults to `ASC` (ascending) if not specified | - -#### Returns - -[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -this - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[sortBy](AbstractSearch.md#sortby) - -#### Defined in - -[lib/search/search.ts:93](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L93) - -___ - -### sortDesc - -▸ **sortDesc**(`field`): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -Alias for [Search.sortDescending](Search.md#sortdescending). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[sortDesc](AbstractSearch.md#sortdesc) - -#### Defined in - -[lib/search/search.ts:67](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L67) - -___ - -### sortDescending - -▸ **sortDescending**(`field`): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -Applies a descending sort to the query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field to sort by. | - -#### Returns - -[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -this - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[sortDescending](AbstractSearch.md#sortdescending) - -#### Defined in - -[lib/search/search.ts:76](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L76) diff --git a/docs/classes/RedisError.md b/docs/classes/RedisError.md deleted file mode 100644 index fc9d1572..00000000 --- a/docs/classes/RedisError.md +++ /dev/null @@ -1,178 +0,0 @@ -[redis-om](../README.md) / RedisError - -# Class: RedisError - -## Hierarchy - -- `Error` - - ↳ **`RedisError`** - -## Table of contents - -### Constructors - -- [constructor](RedisError.md#constructor) - -### Properties - -- [cause](RedisError.md#cause) -- [message](RedisError.md#message) -- [name](RedisError.md#name) -- [stack](RedisError.md#stack) -- [prepareStackTrace](RedisError.md#preparestacktrace) -- [stackTraceLimit](RedisError.md#stacktracelimit) - -### Methods - -- [captureStackTrace](RedisError.md#capturestacktrace) - -## Constructors - -### constructor - -• **new RedisError**(`message`) - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `message` | `string` | - -#### Overrides - -Error.constructor - -#### Defined in - -[lib/errors.ts:2](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/errors.ts#L2) - -## Properties - -### cause - -• `Optional` **cause**: `Error` - -#### Inherited from - -Error.cause - -#### Defined in - -node_modules/typescript/lib/lib.es2022.error.d.ts:26 - -___ - -### message - -• **message**: `string` - -#### Inherited from - -Error.message - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1029 - -___ - -### name - -• **name**: `string` - -#### Inherited from - -Error.name - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1028 - -___ - -### stack - -• `Optional` **stack**: `string` - -#### Inherited from - -Error.stack - -#### Defined in - -node_modules/typescript/lib/lib.es5.d.ts:1030 - -___ - -### prepareStackTrace - -▪ `Static` `Optional` **prepareStackTrace**: (`err`: `Error`, `stackTraces`: `CallSite`[]) => `any` - -#### Type declaration - -▸ (`err`, `stackTraces`): `any` - -Optional override for formatting stack traces - -**`see`** https://v8.dev/docs/stack-trace-api#customizing-stack-traces - -##### Parameters - -| Name | Type | -| :------ | :------ | -| `err` | `Error` | -| `stackTraces` | `CallSite`[] | - -##### Returns - -`any` - -#### Inherited from - -Error.prepareStackTrace - -#### Defined in - -node_modules/@types/node/globals.d.ts:11 - -___ - -### stackTraceLimit - -▪ `Static` **stackTraceLimit**: `number` - -#### Inherited from - -Error.stackTraceLimit - -#### Defined in - -node_modules/@types/node/globals.d.ts:13 - -## Methods - -### captureStackTrace - -▸ `Static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void` - -Create .stack property on a target object - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `targetObject` | `object` | -| `constructorOpt?` | `Function` | - -#### Returns - -`void` - -#### Inherited from - -Error.captureStackTrace - -#### Defined in - -node_modules/@types/node/globals.d.ts:4 diff --git a/docs/classes/Repository.md b/docs/classes/Repository.md deleted file mode 100644 index e433e2a9..00000000 --- a/docs/classes/Repository.md +++ /dev/null @@ -1,395 +0,0 @@ -[redis-om](../README.md) / Repository - -# Class: Repository - -A repository is the main interaction point for reading, writing, and -removing [Entities](Entity.md) from Redis. Create one by calling -[Client.fetchRepository](Client.md#fetchrepository) and passing in a [Schema](Schema.md). Then -use the [Repository.fetch](Repository.md#fetch), [Repository.save](Repository.md#save), and -[Repository.remove](Repository.md#remove) methods to manage your data: - -```typescript -const repository = client.fetchRepository(schema); - -const foo = await repository.fetch('01FK6TCJBDK41RJ766A4SBWDJ9'); -foo.aString = 'bar'; -foo.aBoolean = false; -await repository.save(foo); -``` - -Be sure to use the repository to create a new instance of an -[Entity](Entity.md) you want to create before you save it: - -```typescript -const foo = await repository.createEntity(); -foo.aString = 'bar'; -foo.aBoolean = false; -await repository.save(foo); -``` - -If you want to the [Repository.search](Repository.md#search) method, you need to create an index -first, and you need RediSearch or RedisJSON installed on your instance of Redis: - -```typescript -await repository.createIndex(); -const entities = await repository.search() - .where('aString').eq('bar') - .and('aBoolean').is.false().returnAll(); -``` - -## Type parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `TEntity` | extends [`Entity`](Entity.md) | The type of [Entity](Entity.md) that this repository manages. | - -## Table of contents - -### Properties - -- [client](Repository.md#client) -- [schema](Repository.md#schema) - -### Methods - -- [createAndSave](Repository.md#createandsave) -- [createEntity](Repository.md#createentity) -- [createIndex](Repository.md#createindex) -- [dropIndex](Repository.md#dropindex) -- [expire](Repository.md#expire) -- [fetch](Repository.md#fetch) -- [remove](Repository.md#remove) -- [save](Repository.md#save) -- [search](Repository.md#search) -- [searchRaw](Repository.md#searchraw) - -## Properties - -### client - -• `Protected` **client**: [`Client`](Client.md) - -#### Defined in - -[lib/repository/index.ts:49](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/repository/index.ts#L49) - -___ - -### schema - -• `Protected` **schema**: [`Schema`](Schema.md)<`TEntity`\> - -#### Defined in - -[lib/repository/index.ts:50](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/repository/index.ts#L50) - -## Methods - -### createAndSave - -▸ **createAndSave**(`data?`): `Promise`<`TEntity`\> - -Creates and saves an [Entity](Entity.md). Equivalent of calling -[Repository.createEntity](Repository.md#createentity) followed by [Repository.save](Repository.md#save). - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `data` | [`EntityData`](../README.md#entitydata) | Optional values with which to initialize the entity. | - -#### Returns - -`Promise`<`TEntity`\> - -The newly created and saved Entity. - -#### Defined in - -[lib/repository/index.ts:130](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/repository/index.ts#L130) - -___ - -### createEntity - -▸ **createEntity**(`data?`): `TEntity` - -Creates an [Entity](Entity.md) with a populated [Entity.entityId](Entity.md#entityid) property. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `data` | [`EntityData`](../README.md#entitydata) | Optional values with which to initialize the entity. | - -#### Returns - -`TEntity` - -A newly created Entity. - -#### Defined in - -[lib/repository/index.ts:108](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/repository/index.ts#L108) - -___ - -### createIndex - -▸ **createIndex**(): `Promise`<`void`\> - -Creates an index in Redis for use by the [Repository.search](Repository.md#search) method. Requires -that RediSearch or RedisJSON is installed on your instance of Redis. - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[lib/repository/index.ts:62](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/repository/index.ts#L62) - -___ - -### dropIndex - -▸ **dropIndex**(): `Promise`<`void`\> - -Removes an existing index from Redis. Use this method if you want to swap out your index -because your [Entity](Entity.md) has changed. Requires that RediSearch or RedisJSON is installed -on your instance of Redis. - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[lib/repository/index.ts:90](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/repository/index.ts#L90) - -___ - -### expire - -▸ **expire**(`id`, `ttlInSeconds`): `Promise`<`void`\> - -Set the time to live of the [Entity](Entity.md). If the [Entity](Entity.md) is not -found, does nothing. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `id` | `string` | The ID of the [Entity](Entity.md) to set and expiration for. | -| `ttlInSeconds` | `number` | The time to live in seconds. | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[lib/repository/index.ts:214](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/repository/index.ts#L214) - -___ - -### fetch - -▸ **fetch**(`id`): `Promise`<`TEntity`\> - -Read and return an [Entity](Entity.md) from Redis with the given id. If -the [Entity](Entity.md) is not found, returns an [Entity](Entity.md) with all -properties set to `null`. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `id` | `string` | The ID of the [Entity](Entity.md) you seek. | - -#### Returns - -`Promise`<`TEntity`\> - -The matching Entity. - -#### Defined in - -[lib/repository/index.ts:143](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/repository/index.ts#L143) - -▸ **fetch**(...`ids`): `Promise`<`TEntity`[]\> - -Read and return the [Entities](Entity.md) from Redis with the given IDs. If -a particular [Entity](Entity.md) is not found, returns an [Entity](Entity.md) with all -properties set to `null`. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `...ids` | `string`[] | The IDs of the [Entities](Entity.md) you seek. | - -#### Returns - -`Promise`<`TEntity`[]\> - -The matching Entities. - -#### Defined in - -[lib/repository/index.ts:152](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/repository/index.ts#L152) - -▸ **fetch**(`ids`): `Promise`<`TEntity`[]\> - -Read and return the [Entities](Entity.md) from Redis with the given IDs. If -a particular [Entity](Entity.md) is not found, returns an [Entity](Entity.md) with all -properties set to `null`. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `ids` | `string`[] | The IDs of the [Entities](Entity.md) you seek. | - -#### Returns - -`Promise`<`TEntity`[]\> - -The matching Entities. - -#### Defined in - -[lib/repository/index.ts:161](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/repository/index.ts#L161) - -___ - -### remove - -▸ **remove**(`id`): `Promise`<`void`\> - -Remove an [Entity](Entity.md) from Redis with the given id. If the [Entity](Entity.md) is -not found, does nothing. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `id` | `string` | The ID of the [Entity](Entity.md) you wish to delete. | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[lib/repository/index.ts:181](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/repository/index.ts#L181) - -▸ **remove**(...`ids`): `Promise`<`void`\> - -Remove the [Entities](Entity.md) from Redis with the given ids. If a -particular [Entity](Entity.md) is not found, does nothing. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `...ids` | `string`[] | The IDs of the [Entities](Entity.md) you wish to delete. | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[lib/repository/index.ts:188](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/repository/index.ts#L188) - -▸ **remove**(`ids`): `Promise`<`void`\> - -Remove the [Entities](Entity.md) from Redis with the given ids. If a -particular [Entity](Entity.md) is not found, does nothing. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `ids` | `string`[] | The IDs of the [Entities](Entity.md) you wish to delete. | - -#### Returns - -`Promise`<`void`\> - -#### Defined in - -[lib/repository/index.ts:195](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/repository/index.ts#L195) - -___ - -### save - -▸ **save**(`entity`): `Promise`<`string`\> - -Save the [Entity](Entity.md) to Redis. If it already exists, it will be updated. If it doesn't -exist, it will be created. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `entity` | `TEntity` | The Entity to save. | - -#### Returns - -`Promise`<`string`\> - -The ID of the Entity just saved. - -#### Defined in - -[lib/repository/index.ts:119](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/repository/index.ts#L119) - -___ - -### search - -▸ **search**(): [`Search`](Search.md)<`TEntity`\> - -Kicks off the process of building a query. Requires that RediSearch (and optionally -RedisJSON) be is installed on your instance of Redis. - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -A [Search](Search.md) object. - -#### Defined in - -[lib/repository/index.ts:225](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/repository/index.ts#L225) - -___ - -### searchRaw - -▸ **searchRaw**(`query`): [`RawSearch`](RawSearch.md)<`TEntity`\> - -Creates a search that bypassed Redis OM and instead allows you to execute a raw -RediSearch query. Requires that RediSearch (and optionally RedisJSON) be installed -on your instance of Redis. - -**`query`** The raw RediSearch query you want to rune. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `query` | `string` | - -#### Returns - -[`RawSearch`](RawSearch.md)<`TEntity`\> - -A [RawSearch](RawSearch.md) object. - -#### Defined in - -[lib/repository/index.ts:237](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/repository/index.ts#L237) diff --git a/docs/classes/Schema.md b/docs/classes/Schema.md deleted file mode 100644 index d692027d..00000000 --- a/docs/classes/Schema.md +++ /dev/null @@ -1,223 +0,0 @@ -[redis-om](../README.md) / Schema - -# Class: Schema - -Defines a schema that determines how an [Entity](Entity.md) is mapped to Redis -data structures. Construct by passing in an [EntityConstructor](../README.md#entityconstructor), -a [SchemaDefinition](../README.md#schemadefinition), and optionally [SchemaOptions](../README.md#schemaoptions): - -```typescript -const schema = new Schema(Foo, { - aString: { type: 'string' }, - aNumber: { type: 'number' }, - aBoolean: { type: 'boolean' }, - someText: { type: 'text' }, - aPoint: { type: 'point' }, - aDate: { type: 'date' }, - someStrings: { type: 'string[]' } -}, { - dataStructure: 'HASH' -}); -``` - -A Schema is primarily used by a [Repository](Repository.md) which requires a Schema in -its constructor. - -## Type parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `TEntity` | extends [`Entity`](Entity.md) | The [Entity](Entity.md) this Schema defines. | - -## Table of contents - -### Constructors - -- [constructor](Schema.md#constructor) - -### Accessors - -- [dataStructure](Schema.md#datastructure) -- [indexHash](Schema.md#indexhash) -- [indexHashName](Schema.md#indexhashname) -- [indexName](Schema.md#indexname) -- [indexedDefault](Schema.md#indexeddefault) -- [prefix](Schema.md#prefix) -- [stopWords](Schema.md#stopwords) -- [useStopWords](Schema.md#usestopwords) - -### Methods - -- [generateId](Schema.md#generateid) - -## Constructors - -### constructor - -• **new Schema**<`TEntity`\>(`ctor`, `schemaDef`, `options?`) - -#### Type parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `TEntity` | extends [`Entity`](Entity.md)<`TEntity`\> | The [Entity](Entity.md) this Schema defines. | - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `ctor` | [`EntityConstructor`](../README.md#entityconstructor)<`TEntity`\> | A constructor that creates an [Entity](Entity.md) of type TEntity. | -| `schemaDef` | [`SchemaDefinition`](../README.md#schemadefinition) | Defines all of the fields for the Schema and how they are mapped to Redis. | -| `options?` | [`SchemaOptions`](../README.md#schemaoptions) | Additional options for this Schema. | - -#### Defined in - -[lib/schema/schema.ts:57](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/schema.ts#L57) - -## Accessors - -### dataStructure - -• `get` **dataStructure**(): [`DataStructure`](../README.md#datastructure) - -The configured data structure, a string with the value of either `HASH` or `JSON`, -that this Schema uses to store [Entities](Entity.md) in Redis. - -#### Returns - -[`DataStructure`](../README.md#datastructure) - -#### Defined in - -[lib/schema/schema.ts:79](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/schema.ts#L79) - -___ - -### indexHash - -• `get` **indexHash**(): `string` - -The hash value of this index. Stored in Redis under [Schema.indexHashName](Schema.md#indexhashname). - -#### Returns - -`string` - -#### Defined in - -[lib/schema/schema.ts:100](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/schema.ts#L100) - -___ - -### indexHashName - -• `get` **indexHashName**(): `string` - -The configured name for the RediSearch index hash for this Schema. - -#### Returns - -`string` - -#### Defined in - -[lib/schema/schema.ts:73](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/schema.ts#L73) - -___ - -### indexName - -• `get` **indexName**(): `string` - -The configured name for the RediSearch index for this Schema. - -#### Returns - -`string` - -#### Defined in - -[lib/schema/schema.ts:70](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/schema.ts#L70) - -___ - -### indexedDefault - -• `get` **indexedDefault**(): `boolean` - -The configured indexed default setting for fields - -#### Returns - -`boolean` - -#### Defined in - -[lib/schema/schema.ts:97](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/schema.ts#L97) - -___ - -### prefix - -• `get` **prefix**(): `string` - -The configured keyspace prefix in Redis for this Schema. - -#### Returns - -`string` - -#### Defined in - -[lib/schema/schema.ts:67](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/schema.ts#L67) - -___ - -### stopWords - -• `get` **stopWords**(): `string`[] - -The configured stop words. Ignored if [Schema.useStopWords](Schema.md#usestopwords) is anything other -than `CUSTOM`. - -#### Returns - -`string`[] - -#### Defined in - -[lib/schema/schema.ts:92](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/schema.ts#L92) - -___ - -### useStopWords - -• `get` **useStopWords**(): [`StopWordOptions`](../README.md#stopwordoptions) - -The configured usage of stop words, a string with the value of either `OFF`, `DEFAULT`, -or `CUSTOM`. See {@link SchemaOptions.useStopWords} and {@link SchemaOptions.stopWords} -for more details. - -#### Returns - -[`StopWordOptions`](../README.md#stopwordoptions) - -#### Defined in - -[lib/schema/schema.ts:86](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/schema.ts#L86) - -## Methods - -### generateId - -▸ **generateId**(): `string` - -Generates a unique string using the configured [IdStrategy](../README.md#idstrategy). - -#### Returns - -`string` - -#### Defined in - -[lib/schema/schema.ts:126](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/schema.ts#L126) diff --git a/docs/classes/Search.md b/docs/classes/Search.md deleted file mode 100644 index 244f728b..00000000 --- a/docs/classes/Search.md +++ /dev/null @@ -1,1201 +0,0 @@ -[redis-om](../README.md) / Search - -# Class: Search - -Entry point to fluent search. This is the default Redis OM experience. -Requires that RediSearch (and optionally RedisJSON) be installed. - -## Type parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `TEntity` | extends [`Entity`](Entity.md) | The type of [Entity](Entity.md) being sought. | - -## Hierarchy - -- [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - - ↳ **`Search`** - -## Table of contents - -### Accessors - -- [return](Search.md#return) - -### Methods - -- [all](Search.md#all) -- [allIds](Search.md#allids) -- [allKeys](Search.md#allkeys) -- [and](Search.md#and) -- [count](Search.md#count) -- [first](Search.md#first) -- [firstId](Search.md#firstid) -- [firstKey](Search.md#firstkey) -- [max](Search.md#max) -- [maxId](Search.md#maxid) -- [maxKey](Search.md#maxkey) -- [min](Search.md#min) -- [minId](Search.md#minid) -- [minKey](Search.md#minkey) -- [or](Search.md#or) -- [page](Search.md#page) -- [pageOfIds](Search.md#pageofids) -- [pageOfKeys](Search.md#pageofkeys) -- [returnAll](Search.md#returnall) -- [returnAllIds](Search.md#returnallids) -- [returnAllKeys](Search.md#returnallkeys) -- [returnCount](Search.md#returncount) -- [returnFirst](Search.md#returnfirst) -- [returnFirstId](Search.md#returnfirstid) -- [returnFirstKey](Search.md#returnfirstkey) -- [returnMax](Search.md#returnmax) -- [returnMaxId](Search.md#returnmaxid) -- [returnMaxKey](Search.md#returnmaxkey) -- [returnMin](Search.md#returnmin) -- [returnMinId](Search.md#returnminid) -- [returnMinKey](Search.md#returnminkey) -- [returnPage](Search.md#returnpage) -- [returnPageOfIds](Search.md#returnpageofids) -- [returnPageOfKeys](Search.md#returnpageofkeys) -- [sortAsc](Search.md#sortasc) -- [sortAscending](Search.md#sortascending) -- [sortBy](Search.md#sortby) -- [sortDesc](Search.md#sortdesc) -- [sortDescending](Search.md#sortdescending) -- [where](Search.md#where) - -## Accessors - -### return - -• `get` **return**(): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -Returns the current instance. Syntactic sugar to make your code more fluent. - -#### Returns - -[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -this - -#### Inherited from - -AbstractSearch.return - -#### Defined in - -[lib/search/search.ts:333](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L333) - -## Methods - -### all - -▸ **all**(`options?`): `Promise`<`TEntity`[]\> - -Returns all the [Entities](Entity.md) that match this query. This method -makes multiple calls to Redis until all the [Entities](Entity.md) are returned. -You can specify the batch size by setting the `pageSize` property on the -options: - -```typescript -const entities = await repository.search().returnAll({ pageSize: 100 }); -``` - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `options` | `Object` | `undefined` | Options for the call. | -| `options.pageSize` | `number` | `10` | Number of [Entities](Entity.md) returned per batch. | - -#### Returns - -`Promise`<`TEntity`[]\> - -An array of [Entities](Entity.md) matching the query. - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[all](AbstractSearch.md#all) - -#### Defined in - -[lib/search/search.ts:266](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L266) - -___ - -### allIds - -▸ **allIds**(`options?`): `Promise`<`string`[]\> - -Returns all the entity IDs that match this query. This method -makes multiple calls to Redis until all the entity IDs are returned. -You can specify the batch size by setting the `pageSize` property on the -options: - -```typescript -const keys = await repository.search().returnAllIds({ pageSize: 100 }); -``` - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `options` | `Object` | `undefined` | Options for the call. | -| `options.pageSize` | `number` | `10` | Number of entity IDs returned per batch. | - -#### Returns - -`Promise`<`string`[]\> - -An array of entity IDs matching the query. - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[allIds](AbstractSearch.md#allids) - -#### Defined in - -[lib/search/search.ts:295](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L295) - -___ - -### allKeys - -▸ **allKeys**(`options?`): `Promise`<`string`[]\> - -Returns all the key names in Redis that match this query. This method -makes multiple calls to Redis until all the key names are returned. -You can specify the batch size by setting the `pageSize` property on the -options: - -```typescript -const keys = await repository.search().returnAllKeys({ pageSize: 100 }); -``` - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `options` | `Object` | `undefined` | Options for the call. | -| `options.pageSize` | `number` | `10` | Number of key names returned per batch. | - -#### Returns - -`Promise`<`string`[]\> - -An array of key names matching the query. - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[allKeys](AbstractSearch.md#allkeys) - -#### Defined in - -[lib/search/search.ts:314](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L314) - -___ - -### and - -▸ **and**(`field`): [`WhereField`](WhereField.md)<`TEntity`\> - -Sets up a query matching a particular field as a logical AND. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field to filter on. | - -#### Returns - -[`WhereField`](WhereField.md)<`TEntity`\> - -A subclass of [WhereField](WhereField.md) matching the type of the field. - -#### Defined in - -[lib/search/search.ts:542](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L542) - -▸ **and**(`subSearchFn`): [`Search`](Search.md)<`TEntity`\> - -Sets up a nested search as a logical AND. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `subSearchFn` | [`SubSearchFunction`](../README.md#subsearchfunction)<`TEntity`\> | A function that takes a [Search](Search.md) and returns another [Search](Search.md). | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -`this`. - -#### Defined in - -[lib/search/search.ts:549](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L549) - -___ - -### count - -▸ **count**(): `Promise`<`number`\> - -Returns the number of [Entities](Entity.md) that match this query. - -#### Returns - -`Promise`<`number`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[count](AbstractSearch.md#count) - -#### Defined in - -[lib/search/search.ts:186](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L186) - -___ - -### first - -▸ **first**(): `Promise`<``null`` \| `TEntity`\> - -Returns the first [Entity](Entity.md) that matches this query. - -#### Returns - -`Promise`<``null`` \| `TEntity`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[first](AbstractSearch.md#first) - -#### Defined in - -[lib/search/search.ts:231](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L231) - -___ - -### firstId - -▸ **firstId**(): `Promise`<``null`` \| `string`\> - -Returns the first entity ID that matches this query. - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[firstId](AbstractSearch.md#firstid) - -#### Defined in - -[lib/search/search.ts:239](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L239) - -___ - -### firstKey - -▸ **firstKey**(): `Promise`<``null`` \| `string`\> - -Returns the first key name that matches this query. - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[firstKey](AbstractSearch.md#firstkey) - -#### Defined in - -[lib/search/search.ts:247](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L247) - -___ - -### max - -▸ **max**(`field`): `Promise`<``null`` \| `TEntity`\> - -Finds the [Entity](Entity.md) with the maximal value for a field. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field with the maximal value. | - -#### Returns - -`Promise`<``null`` \| `TEntity`\> - -The entity ID [Entity](Entity.md) with the maximal value - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[max](AbstractSearch.md#max) - -#### Defined in - -[lib/search/search.ts:159](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L159) - -___ - -### maxId - -▸ **maxId**(`field`): `Promise`<``null`` \| `string`\> - -Finds the entity ID with the maximal value for a field. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field with the maximal value. | - -#### Returns - -`Promise`<``null`` \| `string`\> - -The entity ID with the maximal value - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[maxId](AbstractSearch.md#maxid) - -#### Defined in - -[lib/search/search.ts:168](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L168) - -___ - -### maxKey - -▸ **maxKey**(`field`): `Promise`<``null`` \| `string`\> - -Finds the key name in Redis with the maximal value for a field. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field with the maximal value. | - -#### Returns - -`Promise`<``null`` \| `string`\> - -The key name with the maximal value - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[maxKey](AbstractSearch.md#maxkey) - -#### Defined in - -[lib/search/search.ts:178](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L178) - -___ - -### min - -▸ **min**(`field`): `Promise`<``null`` \| `TEntity`\> - -Finds the [Entity](Entity.md) with the minimal value for a field. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field with the minimal value. | - -#### Returns - -`Promise`<``null`` \| `TEntity`\> - -The [Entity](Entity.md) with the minimal value - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[min](AbstractSearch.md#min) - -#### Defined in - -[lib/search/search.ts:131](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L131) - -___ - -### minId - -▸ **minId**(`field`): `Promise`<``null`` \| `string`\> - -Finds the entity ID with the minimal value for a field. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field with the minimal value. | - -#### Returns - -`Promise`<``null`` \| `string`\> - -The entity ID with the minimal value - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[minId](AbstractSearch.md#minid) - -#### Defined in - -[lib/search/search.ts:140](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L140) - -___ - -### minKey - -▸ **minKey**(`field`): `Promise`<``null`` \| `string`\> - -Finds the key name in Redis with the minimal value for a field. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field with the minimal value. | - -#### Returns - -`Promise`<``null`` \| `string`\> - -The key name with the minimal value - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[minKey](AbstractSearch.md#minkey) - -#### Defined in - -[lib/search/search.ts:150](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L150) - -___ - -### or - -▸ **or**(`field`): [`WhereField`](WhereField.md)<`TEntity`\> - -Sets up a query matching a particular field as a logical OR. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field to filter on. | - -#### Returns - -[`WhereField`](WhereField.md)<`TEntity`\> - -A subclass of [WhereField](WhereField.md) matching the type of the field. - -#### Defined in - -[lib/search/search.ts:559](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L559) - -▸ **or**(`subSearchFn`): [`Search`](Search.md)<`TEntity`\> - -Sets up a nested search as a logical OR. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `subSearchFn` | [`SubSearchFunction`](../README.md#subsearchfunction)<`TEntity`\> | A function that takes a [Search](Search.md) and returns another [Search](Search.md). | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -`this`. - -#### Defined in - -[lib/search/search.ts:566](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L566) - -___ - -### page - -▸ **page**(`offset`, `count`): `Promise`<`TEntity`[]\> - -Returns a page of [Entities](Entity.md) that match this query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `offset` | `number` | The offset for where to start returning [Entities](Entity.md). | -| `count` | `number` | The number of [Entities](Entity.md) to return. | - -#### Returns - -`Promise`<`TEntity`[]\> - -An array of [Entities](Entity.md) matching the query. - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[page](AbstractSearch.md#page) - -#### Defined in - -[lib/search/search.ts:199](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L199) - -___ - -### pageOfIds - -▸ **pageOfIds**(`offset`, `count`): `Promise`<`string`[]\> - -Returns a page of entity IDs that match this query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `offset` | `number` | The offset for where to start returning entity IDs. | -| `count` | `number` | The number of entity IDs to return. | - -#### Returns - -`Promise`<`string`[]\> - -An array of strings matching the query. - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[pageOfIds](AbstractSearch.md#pageofids) - -#### Defined in - -[lib/search/search.ts:212](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L212) - -___ - -### pageOfKeys - -▸ **pageOfKeys**(`offset`, `count`): `Promise`<`string`[]\> - -Returns a page of key names in Redis that match this query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `offset` | `number` | The offset for where to start returning key names. | -| `count` | `number` | The number of key names to return. | - -#### Returns - -`Promise`<`string`[]\> - -An array of strings matching the query. - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[pageOfKeys](AbstractSearch.md#pageofkeys) - -#### Defined in - -[lib/search/search.ts:223](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L223) - -___ - -### returnAll - -▸ **returnAll**(`options?`): `Promise`<`TEntity`[]\> - -Alias for [Search.all](Search.md#all). - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `options` | `Object` | `undefined` | -| `options.pageSize` | `number` | `10` | - -#### Returns - -`Promise`<`TEntity`[]\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnAll](AbstractSearch.md#returnall) - -#### Defined in - -[lib/search/search.ts:431](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L431) - -___ - -### returnAllIds - -▸ **returnAllIds**(`options?`): `Promise`<`string`[]\> - -Alias for [Search.allIds](Search.md#allids). - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `options` | `Object` | `undefined` | -| `options.pageSize` | `number` | `10` | - -#### Returns - -`Promise`<`string`[]\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnAllIds](AbstractSearch.md#returnallids) - -#### Defined in - -[lib/search/search.ts:438](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L438) - -___ - -### returnAllKeys - -▸ **returnAllKeys**(`options?`): `Promise`<`string`[]\> - -Alias for [Search.allKeys](Search.md#allkeys). - -#### Parameters - -| Name | Type | Default value | -| :------ | :------ | :------ | -| `options` | `Object` | `undefined` | -| `options.pageSize` | `number` | `10` | - -#### Returns - -`Promise`<`string`[]\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnAllKeys](AbstractSearch.md#returnallkeys) - -#### Defined in - -[lib/search/search.ts:445](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L445) - -___ - -### returnCount - -▸ **returnCount**(): `Promise`<`number`\> - -Alias for [Search.count](Search.md#count). - -#### Returns - -`Promise`<`number`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnCount](AbstractSearch.md#returncount) - -#### Defined in - -[lib/search/search.ts:382](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L382) - -___ - -### returnFirst - -▸ **returnFirst**(): `Promise`<``null`` \| `TEntity`\> - -Alias for [Search.first](Search.md#first). - -#### Returns - -`Promise`<``null`` \| `TEntity`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnFirst](AbstractSearch.md#returnfirst) - -#### Defined in - -[lib/search/search.ts:410](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L410) - -___ - -### returnFirstId - -▸ **returnFirstId**(): `Promise`<``null`` \| `string`\> - -Alias for [Search.firstId](Search.md#firstid). - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnFirstId](AbstractSearch.md#returnfirstid) - -#### Defined in - -[lib/search/search.ts:417](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L417) - -___ - -### returnFirstKey - -▸ **returnFirstKey**(): `Promise`<``null`` \| `string`\> - -Alias for [Search.firstKey](Search.md#firstkey). - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnFirstKey](AbstractSearch.md#returnfirstkey) - -#### Defined in - -[lib/search/search.ts:424](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L424) - -___ - -### returnMax - -▸ **returnMax**(`field`): `Promise`<``null`` \| `TEntity`\> - -Alias for [Search.max](Search.md#max). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -`Promise`<``null`` \| `TEntity`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnMax](AbstractSearch.md#returnmax) - -#### Defined in - -[lib/search/search.ts:361](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L361) - -___ - -### returnMaxId - -▸ **returnMaxId**(`field`): `Promise`<``null`` \| `string`\> - -Alias for [Search.maxId](Search.md#maxid). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnMaxId](AbstractSearch.md#returnmaxid) - -#### Defined in - -[lib/search/search.ts:368](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L368) - -___ - -### returnMaxKey - -▸ **returnMaxKey**(`field`): `Promise`<``null`` \| `string`\> - -Alias for [Search.maxKey](Search.md#maxkey). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnMaxKey](AbstractSearch.md#returnmaxkey) - -#### Defined in - -[lib/search/search.ts:375](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L375) - -___ - -### returnMin - -▸ **returnMin**(`field`): `Promise`<``null`` \| `TEntity`\> - -Alias for [Search.min](Search.md#min). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -`Promise`<``null`` \| `TEntity`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnMin](AbstractSearch.md#returnmin) - -#### Defined in - -[lib/search/search.ts:340](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L340) - -___ - -### returnMinId - -▸ **returnMinId**(`field`): `Promise`<``null`` \| `string`\> - -Alias for [Search.minId](Search.md#minid). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnMinId](AbstractSearch.md#returnminid) - -#### Defined in - -[lib/search/search.ts:347](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L347) - -___ - -### returnMinKey - -▸ **returnMinKey**(`field`): `Promise`<``null`` \| `string`\> - -Alias for [Search.minKey](Search.md#minkey). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -`Promise`<``null`` \| `string`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnMinKey](AbstractSearch.md#returnminkey) - -#### Defined in - -[lib/search/search.ts:354](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L354) - -___ - -### returnPage - -▸ **returnPage**(`offset`, `count`): `Promise`<`TEntity`[]\> - -Alias for [Search.page](Search.md#page). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `offset` | `number` | -| `count` | `number` | - -#### Returns - -`Promise`<`TEntity`[]\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnPage](AbstractSearch.md#returnpage) - -#### Defined in - -[lib/search/search.ts:389](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L389) - -___ - -### returnPageOfIds - -▸ **returnPageOfIds**(`offset`, `count`): `Promise`<`string`[]\> - -Alias for [Search.pageOfIds](Search.md#pageofids). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `offset` | `number` | -| `count` | `number` | - -#### Returns - -`Promise`<`string`[]\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnPageOfIds](AbstractSearch.md#returnpageofids) - -#### Defined in - -[lib/search/search.ts:396](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L396) - -___ - -### returnPageOfKeys - -▸ **returnPageOfKeys**(`offset`, `count`): `Promise`<`string`[]\> - -Alias for {@link Search.pageOrKeys}. - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `offset` | `number` | -| `count` | `number` | - -#### Returns - -`Promise`<`string`[]\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[returnPageOfKeys](AbstractSearch.md#returnpageofkeys) - -#### Defined in - -[lib/search/search.ts:403](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L403) - -___ - -### sortAsc - -▸ **sortAsc**(`field`): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -Alias for [Search.sortAscending](Search.md#sortascending). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[sortAsc](AbstractSearch.md#sortasc) - -#### Defined in - -[lib/search/search.ts:83](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L83) - -___ - -### sortAscending - -▸ **sortAscending**(`field`): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -Applies an ascending sort to the query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field to sort by. | - -#### Returns - -[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -this - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[sortAscending](AbstractSearch.md#sortascending) - -#### Defined in - -[lib/search/search.ts:60](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L60) - -___ - -### sortBy - -▸ **sortBy**(`field`, `order?`): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -Applies sorting for the query. - -#### Parameters - -| Name | Type | Default value | Description | -| :------ | :------ | :------ | :------ | -| `field` | `string` | `undefined` | The field to sort by. | -| `order` | ``"ASC"`` \| ``"DESC"`` | `'ASC'` | The order of returned [Entities](Entity.md) Defaults to `ASC` (ascending) if not specified | - -#### Returns - -[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -this - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[sortBy](AbstractSearch.md#sortby) - -#### Defined in - -[lib/search/search.ts:93](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L93) - -___ - -### sortDesc - -▸ **sortDesc**(`field`): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -Alias for [Search.sortDescending](Search.md#sortdescending). - -#### Parameters - -| Name | Type | -| :------ | :------ | -| `field` | `string` | - -#### Returns - -[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[sortDesc](AbstractSearch.md#sortdesc) - -#### Defined in - -[lib/search/search.ts:67](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L67) - -___ - -### sortDescending - -▸ **sortDescending**(`field`): [`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -Applies a descending sort to the query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field to sort by. | - -#### Returns - -[`AbstractSearch`](AbstractSearch.md)<`TEntity`\> - -this - -#### Inherited from - -[AbstractSearch](AbstractSearch.md).[sortDescending](AbstractSearch.md#sortdescending) - -#### Defined in - -[lib/search/search.ts:76](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L76) - -___ - -### where - -▸ **where**(`field`): [`WhereField`](WhereField.md)<`TEntity`\> - -Sets up a query matching a particular field. If there are multiple calls -to [Search.where](Search.md#where), they are treated logically as AND. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `field` | `string` | The field to filter on. | - -#### Returns - -[`WhereField`](WhereField.md)<`TEntity`\> - -A subclass of [WhereField](WhereField.md) matching the type of the field. - -#### Defined in - -[lib/search/search.ts:524](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L524) - -▸ **where**(`subSearchFn`): [`Search`](Search.md)<`TEntity`\> - -Sets up a nested search. If there are multiple calls to [Search.where](Search.md#where), -they are treated logically as AND. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `subSearchFn` | [`SubSearchFunction`](../README.md#subsearchfunction)<`TEntity`\> | A function that takes a [Search](Search.md) and returns another [Search](Search.md). | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -`this`. - -#### Defined in - -[lib/search/search.ts:532](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/search.ts#L532) diff --git a/docs/classes/Where.md b/docs/classes/Where.md deleted file mode 100644 index 71155fcb..00000000 --- a/docs/classes/Where.md +++ /dev/null @@ -1,43 +0,0 @@ -[redis-om](../README.md) / Where - -# Class: Where - -Abstract base class used extensively with [Search](Search.md). - -## Hierarchy - -- **`Where`** - - ↳ [`WhereField`](WhereField.md) - -## Table of contents - -### Constructors - -- [constructor](Where.md#constructor) - -### Methods - -- [toString](Where.md#tostring) - -## Constructors - -### constructor - -• **new Where**() - -## Methods - -### toString - -▸ `Abstract` **toString**(): `string` - -Converts this [Where](Where.md) into a portion of a RediSearch query. - -#### Returns - -`string` - -#### Defined in - -[lib/search/where.ts:8](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where.ts#L8) diff --git a/docs/classes/WhereField.md b/docs/classes/WhereField.md deleted file mode 100644 index 490f205c..00000000 --- a/docs/classes/WhereField.md +++ /dev/null @@ -1,919 +0,0 @@ -[redis-om](../README.md) / WhereField - -# Class: WhereField - -Abstract base class that all fields you want to filter -with extend. When you call [Search.where](Search.md#where), a -subclass of this is returned. - -## Type parameters - -| Name | -| :------ | -| `TEntity` | - -## Hierarchy - -- [`Where`](Where.md) - - ↳ **`WhereField`** - -## Table of contents - -### Properties - -- [exact](WhereField.md#exact) -- [exactly](WhereField.md#exactly) - -### Accessors - -- [does](WhereField.md#does) -- [is](WhereField.md#is) -- [not](WhereField.md#not) - -### Methods - -- [after](WhereField.md#after) -- [before](WhereField.md#before) -- [between](WhereField.md#between) -- [contain](WhereField.md#contain) -- [containOneOf](WhereField.md#containoneof) -- [contains](WhereField.md#contains) -- [containsOneOf](WhereField.md#containsoneof) -- [eq](WhereField.md#eq) -- [equal](WhereField.md#equal) -- [equalTo](WhereField.md#equalto) -- [equals](WhereField.md#equals) -- [false](WhereField.md#false) -- [greaterThan](WhereField.md#greaterthan) -- [greaterThanOrEqualTo](WhereField.md#greaterthanorequalto) -- [gt](WhereField.md#gt) -- [gte](WhereField.md#gte) -- [inCircle](WhereField.md#incircle) -- [inRadius](WhereField.md#inradius) -- [lessThan](WhereField.md#lessthan) -- [lessThanOrEqualTo](WhereField.md#lessthanorequalto) -- [lt](WhereField.md#lt) -- [lte](WhereField.md#lte) -- [match](WhereField.md#match) -- [matchExact](WhereField.md#matchexact) -- [matchExactly](WhereField.md#matchexactly) -- [matches](WhereField.md#matches) -- [matchesExactly](WhereField.md#matchesexactly) -- [on](WhereField.md#on) -- [onOrAfter](WhereField.md#onorafter) -- [onOrBefore](WhereField.md#onorbefore) -- [toString](WhereField.md#tostring) -- [true](WhereField.md#true) - -## Properties - -### exact - -• `Readonly` **exact**: [`WhereField`](WhereField.md)<`TEntity`\> - -Makes a call to [WhereField.match](WhereField.md#match) a [WhereField.matchExact](WhereField.md#matchexact) call. Calling -this multiple times will have no effect. - -**`returns`** this. - -#### Defined in - -[lib/search/where-field.ts:92](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L92) - -___ - -### exactly - -• `Readonly` **exactly**: [`WhereField`](WhereField.md)<`TEntity`\> - -Makes a call to [WhereField.match](WhereField.md#match) a [WhereField.matchExact](WhereField.md#matchexact) call. Calling -this multiple times will have no effect. - -**`returns`** this. - -#### Defined in - -[lib/search/where-field.ts:99](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L99) - -## Accessors - -### does - -• `get` **does**(): `this` - -Returns the current instance. Syntactic sugar to make your code more fluent. - -#### Returns - -`this` - -this - -#### Defined in - -[lib/search/where-field.ts:289](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L289) - -___ - -### is - -• `get` **is**(): `this` - -Returns the current instance. Syntactic sugar to make your code more fluent. - -#### Returns - -`this` - -this - -#### Defined in - -[lib/search/where-field.ts:281](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L281) - -___ - -### not - -• `get` **not**(): `this` - -Negates the query on the field, cause it to match when the condition is -*not* met. Calling this multiple times will negate the negation. - -#### Returns - -`this` - -this - -#### Defined in - -[lib/search/where-field.ts:298](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L298) - -## Methods - -### after - -▸ **after**(`value`): [`Search`](Search.md)<`TEntity`\> - -Add a search that matches all datetimes *after* the provided UTC datetime to the query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `Date` | The datetime to compare against. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:240](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L240) - -___ - -### before - -▸ **before**(`value`): [`Search`](Search.md)<`TEntity`\> - -Add a search that matches all datetimes *before* the provided UTC datetime to the query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `Date` | The datetime to compare against. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:233](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L233) - -___ - -### between - -▸ **between**(`lower`, `upper`): [`Search`](Search.md)<`TEntity`\> - -Adds an inclusive range comparison against a field to the search query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `lower` | `string` \| `number` \| `Date` | The lower bound of the range. | -| `upper` | `string` \| `number` \| `Date` | The upper bound of the range. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:175](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L175) - -___ - -### contain - -▸ **contain**(`value`): [`Search`](Search.md)<`TEntity`\> - -Adds a whole-string match for a value within a string array to the search query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` | The string to be matched. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:182](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L182) - -___ - -### containOneOf - -▸ **containOneOf**(...`value`): [`Search`](Search.md)<`TEntity`\> - -Adds a whole-string match against a string array to the query. If any of the provided -strings in `value` is matched in the array, this matched. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `...value` | `string`[] | An array of strings that you want to match one of. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:197](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L197) - -___ - -### contains - -▸ **contains**(`value`): [`Search`](Search.md)<`TEntity`\> - -Adds a whole-string match for a value within a string array to the search query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` | The string to be matched. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:189](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L189) - -___ - -### containsOneOf - -▸ **containsOneOf**(...`value`): [`Search`](Search.md)<`TEntity`\> - -Adds a whole-string match against a string array to the query. If any of the provided -strings in `value` is matched in the array, this matched. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `...value` | `string`[] | An array of strings that you want to match one of. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:205](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L205) - -___ - -### eq - -▸ **eq**(`value`): [`Search`](Search.md)<`TEntity`\> - -Adds an equals comparison to the query. - -NOTE: this function is not available for strings where full-text -search is enabled. In that scenario, use `.match`. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `boolean` \| `Date` | The value to be compared | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:20](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L20) - -___ - -### equal - -▸ **equal**(`value`): [`Search`](Search.md)<`TEntity`\> - -Adds an equals comparison to the query. - -NOTE: this function is not available for strings where full-text -search is enabled. In that scenario, use `.match`. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `boolean` \| `Date` | The value to be compared | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:30](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L30) - -___ - -### equalTo - -▸ **equalTo**(`value`): [`Search`](Search.md)<`TEntity`\> - -Adds an equals comparison to the query. - -NOTE: this function is not available for strings where full-text -search is enabled. In that scenario, use `.match`. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `boolean` \| `Date` | The value to be compared | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:50](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L50) - -___ - -### equals - -▸ **equals**(`value`): [`Search`](Search.md)<`TEntity`\> - -Adds an equals comparison to the query. - -NOTE: this function is not available for strings where full-text -search is enabled. In that scenario, use `.match`. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `boolean` \| `Date` | The value to be compared | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:40](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L40) - -___ - -### false - -▸ **false**(): [`Search`](Search.md)<`TEntity`\> - -Adds a boolean match with a value of `false` to the query. - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:111](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L111) - -___ - -### greaterThan - -▸ **greaterThan**(`value`): [`Search`](Search.md)<`TEntity`\> - -Adds a greater than comparison against a field to the search query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `Date` | The value to compare against. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:125](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L125) - -___ - -### greaterThanOrEqualTo - -▸ **greaterThanOrEqualTo**(`value`): [`Search`](Search.md)<`TEntity`\> - -Adds a greater than or equal to comparison against a field to the search query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `Date` | The value to compare against. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:139](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L139) - -___ - -### gt - -▸ **gt**(`value`): [`Search`](Search.md)<`TEntity`\> - -Adds a greater than comparison against a field to the search query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `Date` | The value to compare against. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:118](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L118) - -___ - -### gte - -▸ **gte**(`value`): [`Search`](Search.md)<`TEntity`\> - -Adds a greater than or equal to comparison against a field to the search query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `Date` | The value to compare against. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:132](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L132) - -___ - -### inCircle - -▸ **inCircle**(`circleFn`): [`Search`](Search.md)<`TEntity`\> - -Adds a search for points that fall within a defined circle. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `circleFn` | [`CircleFunction`](../README.md#circlefunction) | A function that returns a [Circle](Circle.md) instance defining the search area. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:212](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L212) - -___ - -### inRadius - -▸ **inRadius**(`circleFn`): [`Search`](Search.md)<`TEntity`\> - -Adds a search for points that fall within a defined radius. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `circleFn` | [`CircleFunction`](../README.md#circlefunction) | A function that returns a [Circle](Circle.md) instance defining the search area. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:219](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L219) - -___ - -### lessThan - -▸ **lessThan**(`value`): [`Search`](Search.md)<`TEntity`\> - -Adds a less than comparison against a field to the search query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `Date` | The value to compare against. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:153](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L153) - -___ - -### lessThanOrEqualTo - -▸ **lessThanOrEqualTo**(`value`): [`Search`](Search.md)<`TEntity`\> - -Adds a less than or equal to comparison against a field to the search query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `Date` | The value to compare against. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:167](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L167) - -___ - -### lt - -▸ **lt**(`value`): [`Search`](Search.md)<`TEntity`\> - -Adds a less than comparison against a field to the search query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `Date` | The value to compare against. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:146](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L146) - -___ - -### lte - -▸ **lte**(`value`): [`Search`](Search.md)<`TEntity`\> - -Adds a less than or equal to comparison against a field to the search query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `Date` | The value to compare against. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:160](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L160) - -___ - -### match - -▸ **match**(`value`): [`Search`](Search.md)<`TEntity`\> - -Adds a full-text search comparison to the query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `boolean` | The word or phrase sought. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:57](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L57) - -___ - -### matchExact - -▸ **matchExact**(`value`): [`Search`](Search.md)<`TEntity`\> - -Adds a full-text search comparison to the query that matches an exact word or phrase. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `boolean` | The word or phrase sought. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:71](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L71) - -___ - -### matchExactly - -▸ **matchExactly**(`value`): [`Search`](Search.md)<`TEntity`\> - -Adds a full-text search comparison to the query that matches an exact word or phrase. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `boolean` | The word or phrase sought. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:78](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L78) - -___ - -### matches - -▸ **matches**(`value`): [`Search`](Search.md)<`TEntity`\> - -Adds a full-text search comparison to the query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `boolean` | The word or phrase sought. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:64](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L64) - -___ - -### matchesExactly - -▸ **matchesExactly**(`value`): [`Search`](Search.md)<`TEntity`\> - -Adds a full-text search comparison to the query that matches an exact word or phrase. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `boolean` | The word or phrase sought. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:85](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L85) - -___ - -### on - -▸ **on**(`value`): [`Search`](Search.md)<`TEntity`\> - -Add a search for an exact UTC datetime to the query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `Date` | The datetime to match. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:226](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L226) - -___ - -### onOrAfter - -▸ **onOrAfter**(`value`): [`Search`](Search.md)<`TEntity`\> - -Add a search that matches all datetimes *on or after* the provided UTC datetime to the query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `Date` | The datetime to compare against. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:254](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L254) - -___ - -### onOrBefore - -▸ **onOrBefore**(`value`): [`Search`](Search.md)<`TEntity`\> - -Add a search that matches all datetimes *on or before* the provided UTC datetime to the query. - -#### Parameters - -| Name | Type | Description | -| :------ | :------ | :------ | -| `value` | `string` \| `number` \| `Date` | The datetime to compare against. | - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:247](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L247) - -___ - -### toString - -▸ `Abstract` **toString**(): `string` - -Converts this [Where](Where.md) into a portion of a RediSearch query. - -#### Returns - -`string` - -#### Inherited from - -[Where](Where.md).[toString](Where.md#tostring) - -#### Defined in - -[lib/search/where-field.ts:303](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L303) - -___ - -### true - -▸ **true**(): [`Search`](Search.md)<`TEntity`\> - -Adds a boolean match with a value of `true` to the query. - -#### Returns - -[`Search`](Search.md)<`TEntity`\> - -The [Search](Search.md) that was called to create this [WhereField](WhereField.md). - -#### Defined in - -[lib/search/where-field.ts:105](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/search/where-field.ts#L105) diff --git a/docs/interfaces/BaseFieldDefinition.md b/docs/interfaces/BaseFieldDefinition.md deleted file mode 100644 index 2ab2d0c9..00000000 --- a/docs/interfaces/BaseFieldDefinition.md +++ /dev/null @@ -1,69 +0,0 @@ -[redis-om](../README.md) / BaseFieldDefinition - -# Interface: BaseFieldDefinition - -Base interface for all fields. - -## Hierarchy - -- **`BaseFieldDefinition`** - - ↳ [`BooleanFieldDefinition`](BooleanFieldDefinition.md) - - ↳ [`DateFieldDefinition`](DateFieldDefinition.md) - - ↳ [`NumberFieldDefinition`](NumberFieldDefinition.md) - - ↳ [`PointFieldDefinition`](PointFieldDefinition.md) - - ↳ [`StringArrayFieldDefinition`](StringArrayFieldDefinition.md) - - ↳ [`StringFieldDefinition`](StringFieldDefinition.md) - - ↳ [`TextFieldDefinition`](TextFieldDefinition.md) - -## Table of contents - -### Properties - -- [alias](BaseFieldDefinition.md#alias) -- [indexed](BaseFieldDefinition.md#indexed) -- [type](BaseFieldDefinition.md#type) - -## Properties - -### alias - -• `Optional` **alias**: `string` - -The default field name in Redis is the key name defined in the -[SchemaDefinition](../README.md#schemadefinition). Overrides the Redis key name if set. - -#### Defined in - -[lib/schema/definition/base-field-definition.ts:12](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/base-field-definition.ts#L12) - -___ - -### indexed - -• `Optional` **indexed**: `boolean` - -Is this field indexed and thus searchable with Redis OM. Defaults -to the schema indexedDefault value, currently true. - -#### Defined in - -[lib/schema/definition/base-field-definition.ts:18](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/base-field-definition.ts#L18) - -___ - -### type - -• **type**: [`SchemaFieldType`](../README.md#schemafieldtype) - -The type of the field (i.e. string, number, boolean, etc.) - -#### Defined in - -[lib/schema/definition/base-field-definition.ts:6](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/base-field-definition.ts#L6) diff --git a/docs/interfaces/BooleanFieldDefinition.md b/docs/interfaces/BooleanFieldDefinition.md deleted file mode 100644 index 03a6d6c5..00000000 --- a/docs/interfaces/BooleanFieldDefinition.md +++ /dev/null @@ -1,88 +0,0 @@ -[redis-om](../README.md) / BooleanFieldDefinition - -# Interface: BooleanFieldDefinition - -A field representing a boolean. - -## Hierarchy - -- [`BaseFieldDefinition`](BaseFieldDefinition.md) - -- [`SortableFieldDefinition`](SortableFieldDefinition.md) - - ↳ **`BooleanFieldDefinition`** - -## Table of contents - -### Properties - -- [alias](BooleanFieldDefinition.md#alias) -- [indexed](BooleanFieldDefinition.md#indexed) -- [sortable](BooleanFieldDefinition.md#sortable) -- [type](BooleanFieldDefinition.md#type) - -## Properties - -### alias - -• `Optional` **alias**: `string` - -The default field name in Redis is the key name defined in the -[SchemaDefinition](../README.md#schemadefinition). Overrides the Redis key name if set. - -#### Inherited from - -[BaseFieldDefinition](BaseFieldDefinition.md).[alias](BaseFieldDefinition.md#alias) - -#### Defined in - -[lib/schema/definition/base-field-definition.ts:12](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/base-field-definition.ts#L12) - -___ - -### indexed - -• `Optional` **indexed**: `boolean` - -Is this field indexed and thus searchable with Redis OM. Defaults -to the schema indexedDefault value, currently true. - -#### Inherited from - -[BaseFieldDefinition](BaseFieldDefinition.md).[indexed](BaseFieldDefinition.md#indexed) - -#### Defined in - -[lib/schema/definition/base-field-definition.ts:18](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/base-field-definition.ts#L18) - -___ - -### sortable - -• `Optional` **sortable**: `boolean` - -Enables sorting by this field. - -#### Inherited from - -[SortableFieldDefinition](SortableFieldDefinition.md).[sortable](SortableFieldDefinition.md#sortable) - -#### Defined in - -[lib/schema/definition/sortable-field-definition.ts:4](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/sortable-field-definition.ts#L4) - -___ - -### type - -• **type**: ``"boolean"`` - -Yep. It's a boolean. - -#### Overrides - -[BaseFieldDefinition](BaseFieldDefinition.md).[type](BaseFieldDefinition.md#type) - -#### Defined in - -[lib/schema/definition/boolean-field-definition.ts:7](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/boolean-field-definition.ts#L7) diff --git a/docs/interfaces/CaseSensitiveFieldDefinition.md b/docs/interfaces/CaseSensitiveFieldDefinition.md deleted file mode 100644 index f6df79e8..00000000 --- a/docs/interfaces/CaseSensitiveFieldDefinition.md +++ /dev/null @@ -1,32 +0,0 @@ -[redis-om](../README.md) / CaseSensitiveFieldDefinition - -# Interface: CaseSensitiveFieldDefinition - -Mixin for adding caseSensitive to a TAG field. - -## Hierarchy - -- **`CaseSensitiveFieldDefinition`** - - ↳ [`StringArrayFieldDefinition`](StringArrayFieldDefinition.md) - - ↳ [`StringFieldDefinition`](StringFieldDefinition.md) - -## Table of contents - -### Properties - -- [caseSensitive](CaseSensitiveFieldDefinition.md#casesensitive) - -## Properties - -### caseSensitive - -• `Optional` **caseSensitive**: `boolean` - -Is the original case of this field indexed with Redis OM. Defaults -to false. - -#### Defined in - -[lib/schema/definition/casesensitive-field-definition.ts:7](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/casesensitive-field-definition.ts#L7) diff --git a/docs/interfaces/DateFieldDefinition.md b/docs/interfaces/DateFieldDefinition.md deleted file mode 100644 index a2cd8a40..00000000 --- a/docs/interfaces/DateFieldDefinition.md +++ /dev/null @@ -1,88 +0,0 @@ -[redis-om](../README.md) / DateFieldDefinition - -# Interface: DateFieldDefinition - -A field representing a date/time. - -## Hierarchy - -- [`BaseFieldDefinition`](BaseFieldDefinition.md) - -- [`SortableFieldDefinition`](SortableFieldDefinition.md) - - ↳ **`DateFieldDefinition`** - -## Table of contents - -### Properties - -- [alias](DateFieldDefinition.md#alias) -- [indexed](DateFieldDefinition.md#indexed) -- [sortable](DateFieldDefinition.md#sortable) -- [type](DateFieldDefinition.md#type) - -## Properties - -### alias - -• `Optional` **alias**: `string` - -The default field name in Redis is the key name defined in the -[SchemaDefinition](../README.md#schemadefinition). Overrides the Redis key name if set. - -#### Inherited from - -[BaseFieldDefinition](BaseFieldDefinition.md).[alias](BaseFieldDefinition.md#alias) - -#### Defined in - -[lib/schema/definition/base-field-definition.ts:12](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/base-field-definition.ts#L12) - -___ - -### indexed - -• `Optional` **indexed**: `boolean` - -Is this field indexed and thus searchable with Redis OM. Defaults -to the schema indexedDefault value, currently true. - -#### Inherited from - -[BaseFieldDefinition](BaseFieldDefinition.md).[indexed](BaseFieldDefinition.md#indexed) - -#### Defined in - -[lib/schema/definition/base-field-definition.ts:18](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/base-field-definition.ts#L18) - -___ - -### sortable - -• `Optional` **sortable**: `boolean` - -Enables sorting by this field. - -#### Inherited from - -[SortableFieldDefinition](SortableFieldDefinition.md).[sortable](SortableFieldDefinition.md#sortable) - -#### Defined in - -[lib/schema/definition/sortable-field-definition.ts:4](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/sortable-field-definition.ts#L4) - -___ - -### type - -• **type**: ``"date"`` - -Yep. It's a date. - -#### Overrides - -[BaseFieldDefinition](BaseFieldDefinition.md).[type](BaseFieldDefinition.md#type) - -#### Defined in - -[lib/schema/definition/date-field-definition.ts:7](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/date-field-definition.ts#L7) diff --git a/docs/interfaces/NormalizedFieldDefinition.md b/docs/interfaces/NormalizedFieldDefinition.md deleted file mode 100644 index c202a226..00000000 --- a/docs/interfaces/NormalizedFieldDefinition.md +++ /dev/null @@ -1,34 +0,0 @@ -[redis-om](../README.md) / NormalizedFieldDefinition - -# Interface: NormalizedFieldDefinition - -Mixin for adding unf to a field. - -## Hierarchy - -- **`NormalizedFieldDefinition`** - - ↳ [`StringArrayFieldDefinition`](StringArrayFieldDefinition.md) - - ↳ [`StringFieldDefinition`](StringFieldDefinition.md) - - ↳ [`TextFieldDefinition`](TextFieldDefinition.md) - -## Table of contents - -### Properties - -- [normalized](NormalizedFieldDefinition.md#normalized) - -## Properties - -### normalized - -• `Optional` **normalized**: `boolean` - -Is this (sortable) field normalized when indexed. Defaults -to true. - -#### Defined in - -[lib/schema/definition/normalized-field-definition.ts:7](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/normalized-field-definition.ts#L7) diff --git a/docs/interfaces/NumberFieldDefinition.md b/docs/interfaces/NumberFieldDefinition.md deleted file mode 100644 index 4f2c2d0a..00000000 --- a/docs/interfaces/NumberFieldDefinition.md +++ /dev/null @@ -1,88 +0,0 @@ -[redis-om](../README.md) / NumberFieldDefinition - -# Interface: NumberFieldDefinition - -A field representing a number. - -## Hierarchy - -- [`BaseFieldDefinition`](BaseFieldDefinition.md) - -- [`SortableFieldDefinition`](SortableFieldDefinition.md) - - ↳ **`NumberFieldDefinition`** - -## Table of contents - -### Properties - -- [alias](NumberFieldDefinition.md#alias) -- [indexed](NumberFieldDefinition.md#indexed) -- [sortable](NumberFieldDefinition.md#sortable) -- [type](NumberFieldDefinition.md#type) - -## Properties - -### alias - -• `Optional` **alias**: `string` - -The default field name in Redis is the key name defined in the -[SchemaDefinition](../README.md#schemadefinition). Overrides the Redis key name if set. - -#### Inherited from - -[BaseFieldDefinition](BaseFieldDefinition.md).[alias](BaseFieldDefinition.md#alias) - -#### Defined in - -[lib/schema/definition/base-field-definition.ts:12](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/base-field-definition.ts#L12) - -___ - -### indexed - -• `Optional` **indexed**: `boolean` - -Is this field indexed and thus searchable with Redis OM. Defaults -to the schema indexedDefault value, currently true. - -#### Inherited from - -[BaseFieldDefinition](BaseFieldDefinition.md).[indexed](BaseFieldDefinition.md#indexed) - -#### Defined in - -[lib/schema/definition/base-field-definition.ts:18](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/base-field-definition.ts#L18) - -___ - -### sortable - -• `Optional` **sortable**: `boolean` - -Enables sorting by this field. - -#### Inherited from - -[SortableFieldDefinition](SortableFieldDefinition.md).[sortable](SortableFieldDefinition.md#sortable) - -#### Defined in - -[lib/schema/definition/sortable-field-definition.ts:4](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/sortable-field-definition.ts#L4) - -___ - -### type - -• **type**: ``"number"`` - -Yep. It's a number. - -#### Overrides - -[BaseFieldDefinition](BaseFieldDefinition.md).[type](BaseFieldDefinition.md#type) - -#### Defined in - -[lib/schema/definition/number-field-definition.ts:7](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/number-field-definition.ts#L7) diff --git a/docs/interfaces/PhoneticFieldDefinition.md b/docs/interfaces/PhoneticFieldDefinition.md deleted file mode 100644 index a8eb0b9f..00000000 --- a/docs/interfaces/PhoneticFieldDefinition.md +++ /dev/null @@ -1,33 +0,0 @@ -[redis-om](../README.md) / PhoneticFieldDefinition - -# Interface: PhoneticFieldDefinition - -Mixin for adding phonetic matching for TEXT fields in RediSearch. - -## Hierarchy - -- **`PhoneticFieldDefinition`** - - ↳ [`TextFieldDefinition`](TextFieldDefinition.md) - -## Table of contents - -### Properties - -- [matcher](PhoneticFieldDefinition.md#matcher) - -## Properties - -### matcher - -• `Optional` **matcher**: ``"dm:en"`` \| ``"dm:fr"`` \| ``"dm:pt"`` \| ``"dm:es"`` - -Enables setting the phonetic matcher to use, supported matchers are: -dm:en - Double Metaphone for English -dm:fr - Double Metaphone for French -dm:pt - Double Metaphone for Portuguese -dm:es - Double Metaphone for Spanish - -#### Defined in - -[lib/schema/definition/phonetic-field-definition.ts:10](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/phonetic-field-definition.ts#L10) diff --git a/docs/interfaces/PointFieldDefinition.md b/docs/interfaces/PointFieldDefinition.md deleted file mode 100644 index 32e76b9e..00000000 --- a/docs/interfaces/PointFieldDefinition.md +++ /dev/null @@ -1,69 +0,0 @@ -[redis-om](../README.md) / PointFieldDefinition - -# Interface: PointFieldDefinition - -A field representing a point on the globe. - -## Hierarchy - -- [`BaseFieldDefinition`](BaseFieldDefinition.md) - - ↳ **`PointFieldDefinition`** - -## Table of contents - -### Properties - -- [alias](PointFieldDefinition.md#alias) -- [indexed](PointFieldDefinition.md#indexed) -- [type](PointFieldDefinition.md#type) - -## Properties - -### alias - -• `Optional` **alias**: `string` - -The default field name in Redis is the key name defined in the -[SchemaDefinition](../README.md#schemadefinition). Overrides the Redis key name if set. - -#### Inherited from - -[BaseFieldDefinition](BaseFieldDefinition.md).[alias](BaseFieldDefinition.md#alias) - -#### Defined in - -[lib/schema/definition/base-field-definition.ts:12](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/base-field-definition.ts#L12) - -___ - -### indexed - -• `Optional` **indexed**: `boolean` - -Is this field indexed and thus searchable with Redis OM. Defaults -to the schema indexedDefault value, currently true. - -#### Inherited from - -[BaseFieldDefinition](BaseFieldDefinition.md).[indexed](BaseFieldDefinition.md#indexed) - -#### Defined in - -[lib/schema/definition/base-field-definition.ts:18](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/base-field-definition.ts#L18) - -___ - -### type - -• **type**: ``"point"`` - -Yep. It's a point. - -#### Overrides - -[BaseFieldDefinition](BaseFieldDefinition.md).[type](BaseFieldDefinition.md#type) - -#### Defined in - -[lib/schema/definition/point-field-definition.ts:6](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/point-field-definition.ts#L6) diff --git a/docs/interfaces/SeparableFieldDefinition.md b/docs/interfaces/SeparableFieldDefinition.md deleted file mode 100644 index a515e733..00000000 --- a/docs/interfaces/SeparableFieldDefinition.md +++ /dev/null @@ -1,34 +0,0 @@ -[redis-om](../README.md) / SeparableFieldDefinition - -# Interface: SeparableFieldDefinition - -Mixin for adding parsing for TAG fields in RediSearch. - -## Hierarchy - -- **`SeparableFieldDefinition`** - - ↳ [`StringArrayFieldDefinition`](StringArrayFieldDefinition.md) - - ↳ [`StringFieldDefinition`](StringFieldDefinition.md) - -## Table of contents - -### Properties - -- [separator](SeparableFieldDefinition.md#separator) - -## Properties - -### separator - -• `Optional` **separator**: `string` - -Due to how RediSearch works, strings and arrays are sometimes stored the same in Redis, as a -simple string. This is the separator used to split those strings when it is an array. If your -StringField contains this separator, this can cause problems. You can change it here to avoid -those problems. Defaults to `|`. - -#### Defined in - -[lib/schema/definition/separable-field-definition.ts:9](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/separable-field-definition.ts#L9) diff --git a/docs/interfaces/SortableFieldDefinition.md b/docs/interfaces/SortableFieldDefinition.md deleted file mode 100644 index 1804b0ad..00000000 --- a/docs/interfaces/SortableFieldDefinition.md +++ /dev/null @@ -1,39 +0,0 @@ -[redis-om](../README.md) / SortableFieldDefinition - -# Interface: SortableFieldDefinition - -Mixin for adding sortability to a field. - -## Hierarchy - -- **`SortableFieldDefinition`** - - ↳ [`BooleanFieldDefinition`](BooleanFieldDefinition.md) - - ↳ [`DateFieldDefinition`](DateFieldDefinition.md) - - ↳ [`NumberFieldDefinition`](NumberFieldDefinition.md) - - ↳ [`StringArrayFieldDefinition`](StringArrayFieldDefinition.md) - - ↳ [`StringFieldDefinition`](StringFieldDefinition.md) - - ↳ [`TextFieldDefinition`](TextFieldDefinition.md) - -## Table of contents - -### Properties - -- [sortable](SortableFieldDefinition.md#sortable) - -## Properties - -### sortable - -• `Optional` **sortable**: `boolean` - -Enables sorting by this field. - -#### Defined in - -[lib/schema/definition/sortable-field-definition.ts:4](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/sortable-field-definition.ts#L4) diff --git a/docs/interfaces/StemmingFieldDefinition.md b/docs/interfaces/StemmingFieldDefinition.md deleted file mode 100644 index e2d04341..00000000 --- a/docs/interfaces/StemmingFieldDefinition.md +++ /dev/null @@ -1,30 +0,0 @@ -[redis-om](../README.md) / StemmingFieldDefinition - -# Interface: StemmingFieldDefinition - -Mixin for adding stemming to a field. - -## Hierarchy - -- **`StemmingFieldDefinition`** - - ↳ [`TextFieldDefinition`](TextFieldDefinition.md) - -## Table of contents - -### Properties - -- [stemming](StemmingFieldDefinition.md#stemming) - -## Properties - -### stemming - -• `Optional` **stemming**: `boolean` - -Is word stemming applied to this field with Redis OM. Defaults -to true. - -#### Defined in - -[lib/schema/definition/stemming-field-definition.ts:7](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/stemming-field-definition.ts#L7) diff --git a/docs/interfaces/StringArrayFieldDefinition.md b/docs/interfaces/StringArrayFieldDefinition.md deleted file mode 100644 index 53e66b25..00000000 --- a/docs/interfaces/StringArrayFieldDefinition.md +++ /dev/null @@ -1,150 +0,0 @@ -[redis-om](../README.md) / StringArrayFieldDefinition - -# Interface: StringArrayFieldDefinition - -A field representing an array of strings. - -## Hierarchy - -- [`BaseFieldDefinition`](BaseFieldDefinition.md) - -- [`SeparableFieldDefinition`](SeparableFieldDefinition.md) - -- [`SortableFieldDefinition`](SortableFieldDefinition.md) - -- [`CaseSensitiveFieldDefinition`](CaseSensitiveFieldDefinition.md) - -- [`NormalizedFieldDefinition`](NormalizedFieldDefinition.md) - - ↳ **`StringArrayFieldDefinition`** - -## Table of contents - -### Properties - -- [alias](StringArrayFieldDefinition.md#alias) -- [caseSensitive](StringArrayFieldDefinition.md#casesensitive) -- [indexed](StringArrayFieldDefinition.md#indexed) -- [normalized](StringArrayFieldDefinition.md#normalized) -- [separator](StringArrayFieldDefinition.md#separator) -- [sortable](StringArrayFieldDefinition.md#sortable) -- [type](StringArrayFieldDefinition.md#type) - -## Properties - -### alias - -• `Optional` **alias**: `string` - -The default field name in Redis is the key name defined in the -[SchemaDefinition](../README.md#schemadefinition). Overrides the Redis key name if set. - -#### Inherited from - -[BaseFieldDefinition](BaseFieldDefinition.md).[alias](BaseFieldDefinition.md#alias) - -#### Defined in - -[lib/schema/definition/base-field-definition.ts:12](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/base-field-definition.ts#L12) - -___ - -### caseSensitive - -• `Optional` **caseSensitive**: `boolean` - -Is the original case of this field indexed with Redis OM. Defaults -to false. - -#### Inherited from - -[CaseSensitiveFieldDefinition](CaseSensitiveFieldDefinition.md).[caseSensitive](CaseSensitiveFieldDefinition.md#casesensitive) - -#### Defined in - -[lib/schema/definition/casesensitive-field-definition.ts:7](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/casesensitive-field-definition.ts#L7) - -___ - -### indexed - -• `Optional` **indexed**: `boolean` - -Is this field indexed and thus searchable with Redis OM. Defaults -to the schema indexedDefault value, currently true. - -#### Inherited from - -[BaseFieldDefinition](BaseFieldDefinition.md).[indexed](BaseFieldDefinition.md#indexed) - -#### Defined in - -[lib/schema/definition/base-field-definition.ts:18](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/base-field-definition.ts#L18) - -___ - -### normalized - -• `Optional` **normalized**: `boolean` - -Is this (sortable) field normalized when indexed. Defaults -to true. - -#### Inherited from - -[NormalizedFieldDefinition](NormalizedFieldDefinition.md).[normalized](NormalizedFieldDefinition.md#normalized) - -#### Defined in - -[lib/schema/definition/normalized-field-definition.ts:7](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/normalized-field-definition.ts#L7) - -___ - -### separator - -• `Optional` **separator**: `string` - -Due to how RediSearch works, strings and arrays are sometimes stored the same in Redis, as a -simple string. This is the separator used to split those strings when it is an array. If your -StringField contains this separator, this can cause problems. You can change it here to avoid -those problems. Defaults to `|`. - -#### Inherited from - -[SeparableFieldDefinition](SeparableFieldDefinition.md).[separator](SeparableFieldDefinition.md#separator) - -#### Defined in - -[lib/schema/definition/separable-field-definition.ts:9](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/separable-field-definition.ts#L9) - -___ - -### sortable - -• `Optional` **sortable**: `boolean` - -Enables sorting by this field. - -#### Inherited from - -[SortableFieldDefinition](SortableFieldDefinition.md).[sortable](SortableFieldDefinition.md#sortable) - -#### Defined in - -[lib/schema/definition/sortable-field-definition.ts:4](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/sortable-field-definition.ts#L4) - -___ - -### type - -• **type**: ``"string[]"`` - -Yep. It's a string array. - -#### Overrides - -[BaseFieldDefinition](BaseFieldDefinition.md).[type](BaseFieldDefinition.md#type) - -#### Defined in - -[lib/schema/definition/string-array-field-definition.ts:10](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/string-array-field-definition.ts#L10) diff --git a/docs/interfaces/StringFieldDefinition.md b/docs/interfaces/StringFieldDefinition.md deleted file mode 100644 index 75353b7c..00000000 --- a/docs/interfaces/StringFieldDefinition.md +++ /dev/null @@ -1,150 +0,0 @@ -[redis-om](../README.md) / StringFieldDefinition - -# Interface: StringFieldDefinition - -A field representing a whole string. - -## Hierarchy - -- [`BaseFieldDefinition`](BaseFieldDefinition.md) - -- [`SeparableFieldDefinition`](SeparableFieldDefinition.md) - -- [`SortableFieldDefinition`](SortableFieldDefinition.md) - -- [`CaseSensitiveFieldDefinition`](CaseSensitiveFieldDefinition.md) - -- [`NormalizedFieldDefinition`](NormalizedFieldDefinition.md) - - ↳ **`StringFieldDefinition`** - -## Table of contents - -### Properties - -- [alias](StringFieldDefinition.md#alias) -- [caseSensitive](StringFieldDefinition.md#casesensitive) -- [indexed](StringFieldDefinition.md#indexed) -- [normalized](StringFieldDefinition.md#normalized) -- [separator](StringFieldDefinition.md#separator) -- [sortable](StringFieldDefinition.md#sortable) -- [type](StringFieldDefinition.md#type) - -## Properties - -### alias - -• `Optional` **alias**: `string` - -The default field name in Redis is the key name defined in the -[SchemaDefinition](../README.md#schemadefinition). Overrides the Redis key name if set. - -#### Inherited from - -[BaseFieldDefinition](BaseFieldDefinition.md).[alias](BaseFieldDefinition.md#alias) - -#### Defined in - -[lib/schema/definition/base-field-definition.ts:12](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/base-field-definition.ts#L12) - -___ - -### caseSensitive - -• `Optional` **caseSensitive**: `boolean` - -Is the original case of this field indexed with Redis OM. Defaults -to false. - -#### Inherited from - -[CaseSensitiveFieldDefinition](CaseSensitiveFieldDefinition.md).[caseSensitive](CaseSensitiveFieldDefinition.md#casesensitive) - -#### Defined in - -[lib/schema/definition/casesensitive-field-definition.ts:7](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/casesensitive-field-definition.ts#L7) - -___ - -### indexed - -• `Optional` **indexed**: `boolean` - -Is this field indexed and thus searchable with Redis OM. Defaults -to the schema indexedDefault value, currently true. - -#### Inherited from - -[BaseFieldDefinition](BaseFieldDefinition.md).[indexed](BaseFieldDefinition.md#indexed) - -#### Defined in - -[lib/schema/definition/base-field-definition.ts:18](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/base-field-definition.ts#L18) - -___ - -### normalized - -• `Optional` **normalized**: `boolean` - -Is this (sortable) field normalized when indexed. Defaults -to true. - -#### Inherited from - -[NormalizedFieldDefinition](NormalizedFieldDefinition.md).[normalized](NormalizedFieldDefinition.md#normalized) - -#### Defined in - -[lib/schema/definition/normalized-field-definition.ts:7](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/normalized-field-definition.ts#L7) - -___ - -### separator - -• `Optional` **separator**: `string` - -Due to how RediSearch works, strings and arrays are sometimes stored the same in Redis, as a -simple string. This is the separator used to split those strings when it is an array. If your -StringField contains this separator, this can cause problems. You can change it here to avoid -those problems. Defaults to `|`. - -#### Inherited from - -[SeparableFieldDefinition](SeparableFieldDefinition.md).[separator](SeparableFieldDefinition.md#separator) - -#### Defined in - -[lib/schema/definition/separable-field-definition.ts:9](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/separable-field-definition.ts#L9) - -___ - -### sortable - -• `Optional` **sortable**: `boolean` - -Enables sorting by this field. - -#### Inherited from - -[SortableFieldDefinition](SortableFieldDefinition.md).[sortable](SortableFieldDefinition.md#sortable) - -#### Defined in - -[lib/schema/definition/sortable-field-definition.ts:4](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/sortable-field-definition.ts#L4) - -___ - -### type - -• **type**: ``"string"`` - -Yep. It's a string. - -#### Overrides - -[BaseFieldDefinition](BaseFieldDefinition.md).[type](BaseFieldDefinition.md#type) - -#### Defined in - -[lib/schema/definition/string-field-definition.ts:10](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/string-field-definition.ts#L10) diff --git a/docs/interfaces/TextFieldDefinition.md b/docs/interfaces/TextFieldDefinition.md deleted file mode 100644 index 55e06af9..00000000 --- a/docs/interfaces/TextFieldDefinition.md +++ /dev/null @@ -1,170 +0,0 @@ -[redis-om](../README.md) / TextFieldDefinition - -# Interface: TextFieldDefinition - -A field representing searchable text. - -## Hierarchy - -- [`BaseFieldDefinition`](BaseFieldDefinition.md) - -- [`SortableFieldDefinition`](SortableFieldDefinition.md) - -- [`StemmingFieldDefinition`](StemmingFieldDefinition.md) - -- [`PhoneticFieldDefinition`](PhoneticFieldDefinition.md) - -- [`NormalizedFieldDefinition`](NormalizedFieldDefinition.md) - -- [`WeightFieldDefinition`](WeightFieldDefinition.md) - - ↳ **`TextFieldDefinition`** - -## Table of contents - -### Properties - -- [alias](TextFieldDefinition.md#alias) -- [indexed](TextFieldDefinition.md#indexed) -- [matcher](TextFieldDefinition.md#matcher) -- [normalized](TextFieldDefinition.md#normalized) -- [sortable](TextFieldDefinition.md#sortable) -- [stemming](TextFieldDefinition.md#stemming) -- [type](TextFieldDefinition.md#type) -- [weight](TextFieldDefinition.md#weight) - -## Properties - -### alias - -• `Optional` **alias**: `string` - -The default field name in Redis is the key name defined in the -[SchemaDefinition](../README.md#schemadefinition). Overrides the Redis key name if set. - -#### Inherited from - -[BaseFieldDefinition](BaseFieldDefinition.md).[alias](BaseFieldDefinition.md#alias) - -#### Defined in - -[lib/schema/definition/base-field-definition.ts:12](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/base-field-definition.ts#L12) - -___ - -### indexed - -• `Optional` **indexed**: `boolean` - -Is this field indexed and thus searchable with Redis OM. Defaults -to the schema indexedDefault value, currently true. - -#### Inherited from - -[BaseFieldDefinition](BaseFieldDefinition.md).[indexed](BaseFieldDefinition.md#indexed) - -#### Defined in - -[lib/schema/definition/base-field-definition.ts:18](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/base-field-definition.ts#L18) - -___ - -### matcher - -• `Optional` **matcher**: ``"dm:en"`` \| ``"dm:fr"`` \| ``"dm:pt"`` \| ``"dm:es"`` - -Enables setting the phonetic matcher to use, supported matchers are: -dm:en - Double Metaphone for English -dm:fr - Double Metaphone for French -dm:pt - Double Metaphone for Portuguese -dm:es - Double Metaphone for Spanish - -#### Inherited from - -[PhoneticFieldDefinition](PhoneticFieldDefinition.md).[matcher](PhoneticFieldDefinition.md#matcher) - -#### Defined in - -[lib/schema/definition/phonetic-field-definition.ts:10](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/phonetic-field-definition.ts#L10) - -___ - -### normalized - -• `Optional` **normalized**: `boolean` - -Is this (sortable) field normalized when indexed. Defaults -to true. - -#### Inherited from - -[NormalizedFieldDefinition](NormalizedFieldDefinition.md).[normalized](NormalizedFieldDefinition.md#normalized) - -#### Defined in - -[lib/schema/definition/normalized-field-definition.ts:7](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/normalized-field-definition.ts#L7) - -___ - -### sortable - -• `Optional` **sortable**: `boolean` - -Enables sorting by this field. - -#### Inherited from - -[SortableFieldDefinition](SortableFieldDefinition.md).[sortable](SortableFieldDefinition.md#sortable) - -#### Defined in - -[lib/schema/definition/sortable-field-definition.ts:4](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/sortable-field-definition.ts#L4) - -___ - -### stemming - -• `Optional` **stemming**: `boolean` - -Is word stemming applied to this field with Redis OM. Defaults -to true. - -#### Inherited from - -[StemmingFieldDefinition](StemmingFieldDefinition.md).[stemming](StemmingFieldDefinition.md#stemming) - -#### Defined in - -[lib/schema/definition/stemming-field-definition.ts:7](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/stemming-field-definition.ts#L7) - -___ - -### type - -• **type**: ``"text"`` - -Yep. It's searchable text. - -#### Overrides - -[BaseFieldDefinition](BaseFieldDefinition.md).[type](BaseFieldDefinition.md#type) - -#### Defined in - -[lib/schema/definition/text-field-definition.ts:11](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/text-field-definition.ts#L11) - -___ - -### weight - -• `Optional` **weight**: `number` - -Enables setting the weight to apply to a text field - -#### Inherited from - -[WeightFieldDefinition](WeightFieldDefinition.md).[weight](WeightFieldDefinition.md#weight) - -#### Defined in - -[lib/schema/definition/weight-field-definition.ts:4](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/weight-field-definition.ts#L4) diff --git a/docs/interfaces/WeightFieldDefinition.md b/docs/interfaces/WeightFieldDefinition.md deleted file mode 100644 index 45ca382c..00000000 --- a/docs/interfaces/WeightFieldDefinition.md +++ /dev/null @@ -1,29 +0,0 @@ -[redis-om](../README.md) / WeightFieldDefinition - -# Interface: WeightFieldDefinition - -Mixin for adding weight for TEXT fields in RediSearch. - -## Hierarchy - -- **`WeightFieldDefinition`** - - ↳ [`TextFieldDefinition`](TextFieldDefinition.md) - -## Table of contents - -### Properties - -- [weight](WeightFieldDefinition.md#weight) - -## Properties - -### weight - -• `Optional` **weight**: `number` - -Enables setting the weight to apply to a text field - -#### Defined in - -[lib/schema/definition/weight-field-definition.ts:4](https://github.com/redis/redis-om-node/blob/f2d3aed/lib/schema/definition/weight-field-definition.ts#L4) diff --git a/spec/unit/client/client-close.spec.ts b/spec/unit/client/client-close.spec.ts index 5539e88b..3bc70750 100644 --- a/spec/unit/client/client-close.spec.ts +++ b/spec/unit/client/client-close.spec.ts @@ -1,43 +1,41 @@ import { redis } from '../helpers/mock-redis' -import { Client } from '$lib/client'; +import { Client } from '$lib/client' describe("Client", () => { - let client: Client; + let client: Client - beforeEach(() => { - client = new Client() - }); + beforeEach(() => { client = new Client() }) describe("#close", () => { describe("when called on an open client", () => { beforeEach(async () => { - client.open(); - client.close(); - }); + client.open() + client.close() + }) it("closes the connection", async () => { - expect(redis.quit).toHaveBeenCalled(); - expect(client.isOpen()).toBe(false); - }); - }); + expect(redis.quit).toHaveBeenCalled() + expect(client.isOpen()).toBe(false) + }) + }) describe("when called on an already closed client", () => { beforeEach(async () => { - await client.open(); - await client.close(); - }); + await client.open() + await client.close() + }) it("happily closes it anyways", async () => { - await client.close(); - expect(client.isOpen()).toBe(false); - }); - }); + await client.close() + expect(client.isOpen()).toBe(false) + }) + }) it("happily closes an unopened client", async () => { - await client.close(); - expect(client.isOpen()).toBe(false); - }); - }); -}); + await client.close() + expect(client.isOpen()).toBe(false) + }) + }) +}) diff --git a/spec/unit/client/client-create-index.spec.ts b/spec/unit/client/client-create-index.spec.ts index ec10a7e4..3c80878f 100644 --- a/spec/unit/client/client-create-index.spec.ts +++ b/spec/unit/client/client-create-index.spec.ts @@ -1,82 +1,80 @@ import { redis } from '../helpers/mock-redis' -import { Client } from '$lib/client'; +import { Client } from '$lib/client' describe("Client", () => { - let client: Client; + let client: Client - beforeEach(() => { - client = new Client() - }); + beforeEach(() => { client = new Client() }) describe("#createIndex", () => { describe("when called on an open client", () => { beforeEach(async () => { - await client.open(); - }); + await client.open() + }) it("passes a command to redis", async () => { await client.createIndex({ indexName: 'index', dataStructure: 'HASH', prefix: 'prefix', schema: ['foo', 'bar', 'baz'] - }); + }) expect(redis.sendCommand).toHaveBeenCalledWith([ 'FT.CREATE', 'index', 'ON', 'HASH', 'PREFIX', '1', 'prefix', 'SCHEMA', 'foo', 'bar', 'baz' - ]); - }); + ]) + }) it("passes a command with stop words to redis", async () => { await client.createIndex({ indexName: 'index', dataStructure: 'HASH', prefix: 'prefix', schema: ['foo', 'bar', 'baz'], stopWords: ['bar', 'baz', 'qux'] - }); + }) expect(redis.sendCommand).toHaveBeenCalledWith([ 'FT.CREATE', 'index', 'ON', 'HASH', 'PREFIX', '1', 'prefix', 'STOPWORDS', '3', 'bar', 'baz', 'qux', 'SCHEMA', 'foo', 'bar', 'baz' - ]); - }); + ]) + }) it("passes a command with zero stop words to redis", async () => { await client.createIndex({ indexName: 'index', dataStructure: 'HASH', prefix: 'prefix', schema: ['foo', 'bar', 'baz'], stopWords: [] - }); + }) expect(redis.sendCommand).toHaveBeenCalledWith([ 'FT.CREATE', 'index', 'ON', 'HASH', 'PREFIX', '1', 'prefix', 'STOPWORDS', '0', 'SCHEMA', 'foo', 'bar', 'baz' - ]); - }); - }); + ]) + }) + }) describe("when called on a closed client", () => { beforeEach(async () => { - await client.open(); - await client.close(); - }); + await client.open() + await client.close() + }) it("errors when called on a closed client", () => expect(async () => await client.createIndex({ indexName: 'index', dataStructure: 'HASH', prefix: 'prefix', schema: ['foo', 'bar', 'baz'] })) - .rejects.toThrow("Redis connection needs to be open.")); - }); + .rejects.toThrow("Redis connection needs to be open.")) + }) it("errors when called on a new client", async () => expect(async () => await client.createIndex({ indexName: 'index', dataStructure: 'HASH', prefix: 'prefix', schema: ['foo', 'bar', 'baz'] })) - .rejects.toThrow("Redis connection needs to be open.")); - }); -}); + .rejects.toThrow("Redis connection needs to be open.")) + }) +}) diff --git a/spec/unit/client/client-drop-index.spec.ts b/spec/unit/client/client-drop-index.spec.ts index 2e3eab3a..2d11c945 100644 --- a/spec/unit/client/client-drop-index.spec.ts +++ b/spec/unit/client/client-drop-index.spec.ts @@ -1,40 +1,38 @@ import { redis } from '../helpers/mock-redis' -import { Client } from '$lib/client'; +import { Client } from '$lib/client' describe("Client", () => { - let client: Client; + let client: Client - beforeEach(() => { - client = new Client() - }); + beforeEach(() => { client = new Client() }) describe("#dropIndex", () => { describe("when called on an open client", () => { beforeEach(async () => { - await client.open(); - }); + await client.open() + }) it("passes the command to redis", async () => { - await client.dropIndex('index'); - expect(redis.sendCommand).toHaveBeenCalledWith(['FT.DROPINDEX', 'index']); - }); - }); + await client.dropIndex('index') + expect(redis.sendCommand).toHaveBeenCalledWith(['FT.DROPINDEX', 'index']) + }) + }) describe("when called on a closed client", () => { beforeEach(async () => { - await client.open(); - await client.close(); - }); + await client.open() + await client.close() + }) it("errors when called on a closed client", () => expect(async () => await client.dropIndex('index')) - .rejects.toThrow("Redis connection needs to be open.")); - }); + .rejects.toThrow("Redis connection needs to be open.")) + }) it("errors when called on a new client", async () => expect(async () => await client.dropIndex('index')) - .rejects.toThrow("Redis connection needs to be open.")); - }); -}); + .rejects.toThrow("Redis connection needs to be open.")) + }) +}) diff --git a/spec/unit/client/client-execute.spec.ts b/spec/unit/client/client-execute.spec.ts index b8f5be31..bd44b0a7 100644 --- a/spec/unit/client/client-execute.spec.ts +++ b/spec/unit/client/client-execute.spec.ts @@ -1,56 +1,54 @@ import { redis } from '../helpers/mock-redis' -import { Client } from '$lib/client'; +import { Client } from '$lib/client' describe("Client", () => { - let client: Client; + let client: Client - beforeEach(() => { - client = new Client() - }); + beforeEach(() => { client = new Client() }) describe("#execute", () => { describe("when called on an open client", () => { beforeEach(async () => { - await client.open(); - }); + await client.open() + }) it("passes the command to redis", async () => { - await client.execute(['foo', 'bar', 'baz']); - expect(redis.sendCommand).toHaveBeenCalledWith(['foo', 'bar', 'baz']); - }); + await client.execute(['foo', 'bar', 'baz']) + expect(redis.sendCommand).toHaveBeenCalledWith(['foo', 'bar', 'baz']) + }) it("transforms numbers to strings before giving them to redis", async () => { - await client.execute([1, 2, 3]); - expect(redis.sendCommand).toHaveBeenCalledWith(['1', '2', '3']); - }); + await client.execute([1, 2, 3]) + expect(redis.sendCommand).toHaveBeenCalledWith(['1', '2', '3']) + }) it("transforms booleans to strings before giving them to redis", async () => { - await client.execute([true, false, true]); - expect(redis.sendCommand).toHaveBeenCalledWith(['1', '0', '1']); - }); + await client.execute([true, false, true]) + expect(redis.sendCommand).toHaveBeenCalledWith(['1', '0', '1']) + }) it("returns what redis returns", async () => { redis.sendCommand.mockReturnValue('foo') - let result = await client.execute(['foo', 'bar', 'baz']); - expect(result).toBe('foo'); - }); - }); + let result = await client.execute(['foo', 'bar', 'baz']) + expect(result).toBe('foo') + }) + }) describe("when called on a closed client", () => { beforeEach(async () => { - await client.open(); - await client.close(); - }); + await client.open() + await client.close() + }) it("errors when called on a closed client", () => expect(async () => await client.execute(['foo', 'bar', 'baz'])) - .rejects.toThrow("Redis connection needs to be open.")); - }); + .rejects.toThrow("Redis connection needs to be open.")) + }) it("errors when called on a new client", async () => expect(async () => await client.execute(['foo', 'bar', 'baz'])) - .rejects.toThrow("Redis connection needs to be open.")); - }); -}); + .rejects.toThrow("Redis connection needs to be open.")) + }) +}) diff --git a/spec/unit/client/client-expire.spec.ts b/spec/unit/client/client-expire.spec.ts index 6c4d1201..a43e40b7 100644 --- a/spec/unit/client/client-expire.spec.ts +++ b/spec/unit/client/client-expire.spec.ts @@ -1,40 +1,38 @@ import { redis } from '../helpers/mock-redis' -import { Client } from '$lib/client'; +import { Client } from '$lib/client' describe("Client", () => { - let client: Client; + let client: Client - beforeEach(() => { - client = new Client() - }); + beforeEach(() => { client = new Client() }) describe("#expire", () => { describe("when called on an open client", () => { beforeEach(async () => { - await client.open(); - }); + await client.open() + }) it("passes the command to redis", async () => { - await client.expire('foo', 60); - expect(redis.expire).toHaveBeenCalledWith('foo', 60); - }); - }); + await client.expire('foo', 60) + expect(redis.expire).toHaveBeenCalledWith('foo', 60) + }) + }) describe("when called on a closed client", () => { beforeEach(async () => { - await client.open(); - await client.close(); - }); + await client.open() + await client.close() + }) it("errors when called on a closed client", () => expect(async () => await client.expire('foo', 60)) - .rejects.toThrow("Redis connection needs to be open.")); - }); + .rejects.toThrow("Redis connection needs to be open.")) + }) it("errors when called on a new client", async () => expect(async () => await client.expire('foo', 60)) - .rejects.toThrow("Redis connection needs to be open.")); - }); -}); + .rejects.toThrow("Redis connection needs to be open.")) + }) +}) diff --git a/spec/unit/client/client-fetch-repository.spec.ts b/spec/unit/client/client-fetch-repository.spec.ts index e5373c72..81a92026 100644 --- a/spec/unit/client/client-fetch-repository.spec.ts +++ b/spec/unit/client/client-fetch-repository.spec.ts @@ -1,64 +1,59 @@ -import { Client } from '$lib/client'; -import { Repository } from '$lib/repository'; -import { Schema } from '$lib/schema/schema'; +import { Client } from '$lib/client' +import { Repository } from '$lib/repository' +import { Schema } from '$lib/schema/schema' -vi.mock('$lib/repository'); +vi.mock('$lib/repository') describe("Client", () => { - let client: Client; + let client: Client - beforeEach(() => { - client = new Client() - }); + beforeEach(() => { client = new Client() }) + afterEach(() => { client.close() }) - afterEach(() => { - client.close() - }); - - it("passes", () => expect(true).toBe(true)); + it("passes", () => expect(true).toBe(true)) describe("#fetchRepository", () => { - let repository: Repository; - let schema: Schema; + let repository: Repository + let schema: Schema describe("when fetching a Repository", () => { beforeAll(() => { schema = new Schema("TestEntity", {}) - }); + }) describe("when called on an open client", () => { beforeEach(async () => { - await client.open(); - repository = client.fetchRepository(schema); - }); + await client.open() + repository = client.fetchRepository(schema) + }) it("creates a repository with the schema and client", () => { - expect(Repository).toHaveBeenCalledWith(schema, client); - }); + expect(Repository).toHaveBeenCalledWith(schema, client) + }) it("returns a repository", async () => { - expect(repository).toBeInstanceOf(Repository); - }); - }); + expect(repository).toBeInstanceOf(Repository) + }) + }) describe("when called on a closed client", () => { beforeEach(async () => { - await client.open(); - await client.close(); - }); + await client.open() + await client.close() + }) it("errors when called on a closed client", () => expect(() => client.fetchRepository(schema)) - .toThrow("Redis connection needs to be open.")); - }); + .toThrow("Redis connection needs to be open.")) + }) it("errors when called on a new client", () => expect(() => client.fetchRepository(schema)) - .toThrow("Redis connection needs to be open.")); - }); - }); -}); + .toThrow("Redis connection needs to be open.")) + }) + }) +}) diff --git a/spec/unit/client/client-get-set.spec.ts b/spec/unit/client/client-get-set.spec.ts index 939ce7bc..b5aa63a5 100644 --- a/spec/unit/client/client-get-set.spec.ts +++ b/spec/unit/client/client-get-set.spec.ts @@ -1,91 +1,89 @@ import { redis } from '../helpers/mock-redis' -import { Client } from '$lib/client'; +import { Client } from '$lib/client' describe("Client", () => { - let client: Client; - let result: string | null; + let client: Client + let result: string | null - beforeEach(() => { - client = new Client() - }); + beforeEach(() => { client = new Client() }) describe("#get", () => { describe("when called on an open client", () => { beforeEach(async () => { await client.open() - }); + }) describe("and the result is a string", () => { beforeEach(async () => { redis.get.mockReturnValue('bar') - result = await client.get('foo'); - }); + result = await client.get('foo') + }) it("passes the command to redis", async () => { - expect(redis.get).toHaveBeenCalledWith('foo'); - }); + expect(redis.get).toHaveBeenCalledWith('foo') + }) - it("returns the result", async () => expect(result).toBe('bar')); - }); + it("returns the result", async () => expect(result).toBe('bar')) + }) describe("and the result is null", () => { beforeEach(async () => { - redis.get.mockResolvedValue(null); - result = await client.get('foo'); - }); + redis.get.mockResolvedValue(null) + result = await client.get('foo') + }) it("passes the command to redis", async () => { - expect(redis.get).toHaveBeenCalledWith('foo'); - }); + expect(redis.get).toHaveBeenCalledWith('foo') + }) - it("returns the result", async () => expect(result).toBeNull()); - }); - }); + it("returns the result", async () => expect(result).toBeNull()) + }) + }) describe("when called on a closed client", () => { beforeEach(async () => { - await client.open(); - await client.close(); - }); + await client.open() + await client.close() + }) it("errors when called on a closed client", () => expect(async () => await client.get('foo')) - .rejects.toThrow("Redis connection needs to be open.")); - }); + .rejects.toThrow("Redis connection needs to be open.")) + }) it("errors when called on a new client", async () => expect(async () => await client.get('foo')) - .rejects.toThrow("Redis connection needs to be open.")); - }); + .rejects.toThrow("Redis connection needs to be open.")) + }) describe("#set", () => { describe("when called on an open client", () => { beforeEach(async () => { - await client.open(); - await client.set('foo', 'bar'); - }); + await client.open() + await client.set('foo', 'bar') + }) it("passes the command to redis", async () => { - expect(redis.set).toHaveBeenCalledWith('foo', 'bar'); - }); - }); + expect(redis.set).toHaveBeenCalledWith('foo', 'bar') + }) + }) describe("when called on a closed client", () => { beforeEach(async () => { - await client.open(); - await client.close(); - }); + await client.open() + await client.close() + }) it("errors when called on a closed client", () => expect(async () => await client.set('foo', 'bar')) - .rejects.toThrow("Redis connection needs to be open.")); - }); + .rejects.toThrow("Redis connection needs to be open.")) + }) it("errors when called on a new client", async () => expect(async () => await client.set('foo', 'bar')) - .rejects.toThrow("Redis connection needs to be open.")); - }); + .rejects.toThrow("Redis connection needs to be open.")) + }) -}); +}) diff --git a/spec/unit/client/client-hgetall.spec.ts b/spec/unit/client/client-hgetall.spec.ts index f6982b18..8460f611 100644 --- a/spec/unit/client/client-hgetall.spec.ts +++ b/spec/unit/client/client-hgetall.spec.ts @@ -1,46 +1,44 @@ import { redis } from '../helpers/mock-redis' -import { Client } from '$lib/client'; +import { Client } from '$lib/client' describe("Client", () => { - let client: Client; - let result: { [key: string]: string }; + let client: Client + let result: { [key: string]: string } - beforeEach(() => { - client = new Client() - }); + beforeEach(() => { client = new Client() }) describe("#hgetall", () => { describe("when called on an open client", () => { beforeEach(async () => { - await client.open(); - redis.hGetAll.mockResolvedValue({ foo: 'bar', baz: 'qux' }); - result = await client.hgetall('foo'); - }); + await client.open() + redis.hGetAll.mockResolvedValue({ foo: 'bar', baz: 'qux' }) + result = await client.hgetall('foo') + }) it("passes the command to redis", async () => { - expect(redis.hGetAll).toHaveBeenCalledWith('foo'); - }); + expect(redis.hGetAll).toHaveBeenCalledWith('foo') + }) it("returns the value from redis", async () => { - expect(result).toEqual({ foo: 'bar', baz: 'qux' }); - }); - }); + expect(result).toEqual({ foo: 'bar', baz: 'qux' }) + }) + }) describe("when called on a closed client", () => { beforeEach(async () => { - await client.open(); - await client.close(); - }); + await client.open() + await client.close() + }) it("errors when called on a closed client", () => expect(async () => await client.hgetall('foo')) - .rejects.toThrow("Redis connection needs to be open.")); - }); + .rejects.toThrow("Redis connection needs to be open.")) + }) it("errors when called on a new client", async () => expect(async () => await client.hgetall('foo')) - .rejects.toThrow("Redis connection needs to be open.")); - }); -}); + .rejects.toThrow("Redis connection needs to be open.")) + }) +}) diff --git a/spec/unit/client/client-hsetall.spec.ts b/spec/unit/client/client-hsetall.spec.ts index 0d3b7bb9..587e27d0 100644 --- a/spec/unit/client/client-hsetall.spec.ts +++ b/spec/unit/client/client-hsetall.spec.ts @@ -1,42 +1,40 @@ import { redis } from '../helpers/mock-redis' -import { Client } from '$lib/client'; +import { Client } from '$lib/client' describe("Client", () => { - let client: Client; + let client: Client - beforeEach(() => { - client = new Client() - }); + beforeEach(() => { client = new Client() }) describe("#hsetall", () => { describe("when called on an open client", () => { beforeEach(async () => { - await client.open(); - }); + await client.open() + }) it("passes the command to redis", async () => { - await client.hsetall('foo', { foo: 'bar', baz: 'qux' }); - expect(redis.executeIsolated).toHaveBeenCalled(); + await client.hsetall('foo', { foo: 'bar', baz: 'qux' }) + expect(redis.executeIsolated).toHaveBeenCalled() // TODO: test full behavior of client calls - // expect(redis.executeIsolated).toHaveBeenCalledWith('foo', { foo: 'bar', baz: 'qux' }); - }); - }); + // expect(redis.executeIsolated).toHaveBeenCalledWith('foo', { foo: 'bar', baz: 'qux' }) + }) + }) describe("when called on a closed client", () => { beforeEach(async () => { - await client.open(); - await client.close(); - }); + await client.open() + await client.close() + }) it("errors when called on a closed client", () => expect(async () => await client.hsetall('foo', { foo: 'bar', baz: 'qux' })) - .rejects.toThrow("Redis connection needs to be open.")); - }); + .rejects.toThrow("Redis connection needs to be open.")) + }) it("errors when called on a new client", async () => expect(async () => await client.hsetall('foo', { foo: 'bar', baz: 'qux' })) - .rejects.toThrow("Redis connection needs to be open.")); - }); -}); + .rejects.toThrow("Redis connection needs to be open.")) + }) +}) diff --git a/spec/unit/client/client-jsonget.spec.ts b/spec/unit/client/client-jsonget.spec.ts index 6ca55f75..658bee3d 100644 --- a/spec/unit/client/client-jsonget.spec.ts +++ b/spec/unit/client/client-jsonget.spec.ts @@ -1,46 +1,44 @@ import { redis } from '../helpers/mock-redis' -import { Client } from '$lib/client'; +import { Client } from '$lib/client' describe("Client", () => { - let client: Client; - let result: { [key: string]: any }; + let client: Client + let result: { [key: string]: any } - beforeEach(() => { - client = new Client() - }); + beforeEach(() => { client = new Client() }) describe("#jsonget", () => { describe("when called on an open client", () => { beforeEach(async () => { - await client.open(); - redis.sendCommand.mockResolvedValue('{ "foo": "bar", "bar": 42, "baz": true, "qux": null }'); - result = await client.jsonget('foo'); - }); + await client.open() + redis.sendCommand.mockResolvedValue('{ "foo": "bar", "bar": 42, "baz": true, "qux": null }') + result = await client.jsonget('foo') + }) it("passes the command to redis", async () => { - expect(redis.sendCommand).toHaveBeenCalledWith(['JSON.GET', 'foo', '.']); - }); + expect(redis.sendCommand).toHaveBeenCalledWith(['JSON.GET', 'foo', '.']) + }) it("returns the JSON", async () => { - expect(result).toEqual({ foo: 'bar', bar: 42, baz: true, qux: null }); - }); - }); + expect(result).toEqual({ foo: 'bar', bar: 42, baz: true, qux: null }) + }) + }) describe("when called on a closed client", () => { beforeEach(async () => { - await client.open(); - await client.close(); - }); + await client.open() + await client.close() + }) it("errors when called on a closed client", () => expect(async () => await client.jsonget('foo')) - .rejects.toThrow("Redis connection needs to be open.")); - }); + .rejects.toThrow("Redis connection needs to be open.")) + }) it("errors when called on a new client", async () => expect(async () => await client.jsonget('foo')) - .rejects.toThrow("Redis connection needs to be open.")); - }); -}); + .rejects.toThrow("Redis connection needs to be open.")) + }) +}) diff --git a/spec/unit/client/client-jsonset.spec.ts b/spec/unit/client/client-jsonset.spec.ts index 433d7e7d..71e87851 100644 --- a/spec/unit/client/client-jsonset.spec.ts +++ b/spec/unit/client/client-jsonset.spec.ts @@ -1,41 +1,39 @@ import { redis } from '../helpers/mock-redis' -import { Client } from '$lib/client'; +import { Client } from '$lib/client' describe("Client", () => { - let client: Client; + let client: Client - beforeEach(() => { - client = new Client() - }); + beforeEach(() => { client = new Client() }) describe("#jsonset", () => { describe("when called on an open client", () => { beforeEach(async () => { - await client.open(); - await client.jsonset('foo', { foo: 'bar', bar: 42, baz: true, qux: null }); - }); + await client.open() + await client.jsonset('foo', { foo: 'bar', bar: 42, baz: true, qux: null }) + }) it("passes the command to redis", async () => { expect(redis.sendCommand).toHaveBeenCalledWith([ - 'JSON.SET', 'foo', '.', '{"foo":"bar","bar":42,"baz":true,"qux":null}']); - }); - }); + 'JSON.SET', 'foo', '.', '{"foo":"bar","bar":42,"baz":true,"qux":null}']) + }) + }) describe("when called on a closed client", () => { beforeEach(async () => { - await client.open(); - await client.close(); - }); + await client.open() + await client.close() + }) it("errors when called on a closed client", () => expect(async () => await client.jsonget('foo')) - .rejects.toThrow("Redis connection needs to be open.")); - }); + .rejects.toThrow("Redis connection needs to be open.")) + }) it("errors when called on a new client", async () => expect(async () => await client.jsonget('foo')) - .rejects.toThrow("Redis connection needs to be open.")); - }); -}); + .rejects.toThrow("Redis connection needs to be open.")) + }) +}) diff --git a/spec/unit/client/client-open.spec.ts b/spec/unit/client/client-open.spec.ts index 1f26fb8f..c433373b 100644 --- a/spec/unit/client/client-open.spec.ts +++ b/spec/unit/client/client-open.spec.ts @@ -1,94 +1,90 @@ import { redis, createClient } from '../helpers/mock-redis' -import { Client } from '$lib/client'; +import { Client } from '$lib/client' -// beforeEach(() => {vi.clearAllMocks()}); - describe("Client", () => { - let client: Client, self: Client; + let client: Client, self: Client - beforeEach(() => { - client = new Client() - }); + beforeEach(() => { client = new Client() }) describe("#open", () => { describe("when not called", () => { it("is not open", () => { - expect(client.isOpen()).toBe(false); - }); + expect(client.isOpen()).toBe(false) + }) }) describe("when called without a url", () => { - beforeEach(async () => {self = await client.open()}); + beforeEach(async () => {self = await client.open()}) it("creates a redis client with the default url", () => { - expect(createClient).toHaveBeenCalledWith({ url: 'redis://localhost:6379' }); - }); + expect(createClient).toHaveBeenCalledWith({ url: 'redis://localhost:6379' }) + }) it("connects to redis", async () => { - expect(redis.connect).toHaveBeenCalled(); - }); + expect(redis.connect).toHaveBeenCalled() + }) it("is open", () => { - expect(client.isOpen()).toBe(true); - }); + expect(client.isOpen()).toBe(true) + }) it("returns itself", async () => { - expect(self).toBe(client); - }); + expect(self).toBe(client) + }) describe("when trying to call it again", () => { - beforeEach(async () => {self = await client.open()}); + beforeEach(async () => {self = await client.open()}) it("doesn't re-create a redis client", () => { - expect(createClient).toBeCalledTimes(1); - }); + expect(createClient).toBeCalledTimes(1) + }) it("doesn't open redis again", async () => { - expect(redis.connect).toBeCalledTimes(1); - }); + expect(redis.connect).toBeCalledTimes(1) + }) it("returns itself", async () => { - expect(self).toBe(client); - }); - }); - }); + expect(self).toBe(client) + }) + }) + }) describe("when called with a url", () => { - beforeEach(async () => {self = await client.open('foo')}); + beforeEach(async () => {self = await client.open('foo')}) it("creates a new redis client with the provided url", () => { expect(createClient).toHaveBeenCalledWith({ url: 'foo' }) - }); + }) it("connects to redis", async () => { - expect(redis.connect).toHaveBeenCalled(); - }); + expect(redis.connect).toHaveBeenCalled() + }) it("is open", () => { - expect(client.isOpen()).toBe(true); - }); + expect(client.isOpen()).toBe(true) + }) it("returns itself", async () => { - expect(self).toBe(client); - }); + expect(self).toBe(client) + }) describe("when trying to call it again", () => { - beforeEach(async () => {self = await client.open('foo')}); + beforeEach(async () => {self = await client.open('foo')}) it("doesn't re-create a redis client", () => { - expect(createClient).toBeCalledTimes(1); - }); + expect(createClient).toBeCalledTimes(1) + }) it("doesn't open redis again", async () => { - expect(redis.connect).toBeCalledTimes(1); - }); + expect(redis.connect).toBeCalledTimes(1) + }) it("returns itself", async () => { - expect(self).toBe(client); - }); - }); - }); - }); -}); + expect(self).toBe(client) + }) + }) + }) + }) +}) diff --git a/spec/unit/client/client-search.spec.ts b/spec/unit/client/client-search.spec.ts index da20aa6a..6c04b359 100644 --- a/spec/unit/client/client-search.spec.ts +++ b/spec/unit/client/client-search.spec.ts @@ -1,69 +1,67 @@ import { redis } from '../helpers/mock-redis' -import { Client } from '$lib/client'; +import { Client } from '$lib/client' describe("Client", () => { - let client: Client; + let client: Client - beforeEach(() => { - client = new Client() - }); + beforeEach(() => { client = new Client() }) describe("#search", () => { describe("when called on an open client", () => { beforeEach(async () => { - await client.open(); - }); + await client.open() + }) it("sends the expect command when given minimal options", async () => { await client.search({ indexName: 'index', query: 'query' - }); + }) expect(redis.sendCommand).toHaveBeenCalledWith([ - 'FT.SEARCH', 'index', 'query']); - }); + 'FT.SEARCH', 'index', 'query']) + }) it("sends the expect command when given a limit", async () => { await client.search({ indexName: 'index', query: 'query', limit: { offset: 0, count: 5 } - }); + }) expect(redis.sendCommand).toHaveBeenCalledWith([ - 'FT.SEARCH', 'index', 'query', 'LIMIT', '0', '5']); - }); + 'FT.SEARCH', 'index', 'query', 'LIMIT', '0', '5']) + }) it("sends the expected command when given a sort", async () => { await client.search({ indexName: 'index', query: 'query', sort: { field: 'sortField', order: 'ASC' } - }); + }) expect(redis.sendCommand).toHaveBeenCalledWith([ - 'FT.SEARCH', 'index', 'query', 'SORTBY', 'sortField', 'ASC']); - }); + 'FT.SEARCH', 'index', 'query', 'SORTBY', 'sortField', 'ASC']) + }) it("sends the expected command when keysOnly is set to false", async () => { await client.search({ indexName: 'index', query: 'query', keysOnly: false - }); + }) expect(redis.sendCommand).toHaveBeenCalledWith([ - 'FT.SEARCH', 'index', 'query']); - }); + 'FT.SEARCH', 'index', 'query']) + }) it("sends the expected command when keysOnly is set to true", async () => { await client.search({ indexName: 'index', query: 'query', keysOnly: true - }); + }) expect(redis.sendCommand).toHaveBeenCalledWith([ - 'FT.SEARCH', 'index', 'query', 'RETURN', '0']); - }); + 'FT.SEARCH', 'index', 'query', 'RETURN', '0']) + }) it("sends the expected command with all options", async () => { await client.search({ @@ -72,28 +70,28 @@ describe("Client", () => { limit: { offset: 0, count: 5 }, sort: { field: 'sortField', order: 'ASC' }, keysOnly: true - }); + }) expect(redis.sendCommand).toHaveBeenCalledWith([ 'FT.SEARCH', 'index', 'query', 'LIMIT', '0', '5', - 'SORTBY', 'sortField', 'ASC', 'RETURN', '0']); - }); - }); + 'SORTBY', 'sortField', 'ASC', 'RETURN', '0']) + }) + }) describe("when called on an unopened client", () => { it("throws an error", async () => expect(async () => await client.search({ indexName: 'index', query: 'query' })) - .rejects.toThrow("Redis connection needs to be open.")); - }); + .rejects.toThrow("Redis connection needs to be open.")) + }) describe("when called on a closed client", () => { beforeEach(async () => { - await client.open(); - await client.close(); - }); + await client.open() + await client.close() + }) it("throws an error", () => expect(async () => await client.search({ indexName: 'index', query: 'query' })) - .rejects.toThrow("Redis connection needs to be open.")); - }); - }); -}); + .rejects.toThrow("Redis connection needs to be open.")) + }) + }) +}) diff --git a/spec/unit/client/client-unlink.spec.ts b/spec/unit/client/client-unlink.spec.ts index 842c7f67..9db1e495 100644 --- a/spec/unit/client/client-unlink.spec.ts +++ b/spec/unit/client/client-unlink.spec.ts @@ -1,50 +1,48 @@ import { redis } from '../helpers/mock-redis' -import { Client } from '$lib/client'; +import { Client } from '$lib/client' describe("Client", () => { - let client: Client; + let client: Client - beforeEach(() => { - client = new Client() - }); + beforeEach(() => { client = new Client() }) describe("#unlink", () => { describe("when called on an open client", () => { beforeEach(async () => { - await client.open(); - }); + await client.open() + }) it("doesn't call redis when passed no keys", async () => { - await client.unlink(); - expect(redis.unlink).not.toHaveBeenCalled(); - }); + await client.unlink() + expect(redis.unlink).not.toHaveBeenCalled() + }) it("passes a single key to redis", async () => { - await client.unlink('foo'); - expect(redis.unlink).toHaveBeenCalledWith(expect.arrayContaining(['foo'])); - }); + await client.unlink('foo') + expect(redis.unlink).toHaveBeenCalledWith(expect.arrayContaining(['foo'])) + }) it("passes multiple keys to redis", async () => { - await client.unlink('foo', 'bar', 'baz'); - expect(redis.unlink).toHaveBeenCalledWith(expect.arrayContaining(['foo', 'bar', 'baz'])); - }); - }); + await client.unlink('foo', 'bar', 'baz') + expect(redis.unlink).toHaveBeenCalledWith(expect.arrayContaining(['foo', 'bar', 'baz'])) + }) + }) describe("when called on a closed client", () => { beforeEach(async () => { - await client.open(); - await client.close(); - }); + await client.open() + await client.close() + }) it("errors when called on a closed client", () => expect(async () => await client.unlink('foo')) - .rejects.toThrow("Redis connection needs to be open.")); - }); + .rejects.toThrow("Redis connection needs to be open.")) + }) it("errors when called on a new client", async () => expect(async () => await client.unlink('foo')) - .rejects.toThrow("Redis connection needs to be open.")); - }); -}); + .rejects.toThrow("Redis connection needs to be open.")) + }) +}) diff --git a/spec/unit/client/client-use.spec.ts b/spec/unit/client/client-use.spec.ts index ec96b21c..fe5ed6a5 100644 --- a/spec/unit/client/client-use.spec.ts +++ b/spec/unit/client/client-use.spec.ts @@ -1,65 +1,63 @@ import { redis, createClient } from '../helpers/mock-redis' -import { Client } from '$lib/client'; +import { Client } from '$lib/client' -const BOGUS_CONNECTION = { THIS_IS_NOT: 'a real connection' }; +const BOGUS_CONNECTION = { THIS_IS_NOT: 'a real connection' } describe("Client", () => { - let client: Client, self: Client; + let client: Client, self: Client - beforeEach(() => { - client = new Client() - }); + beforeEach(() => { client = new Client() }) describe("#use", () => { describe("when not called", () => { it("is not open", () => { - expect(client.isOpen()).toBe(false); - }); + expect(client.isOpen()).toBe(false) + }) }) describe("when called", () => { beforeEach(async () => { // @ts-ignore: no way to call createClient without actually connecting to Redis self = await client.use(BOGUS_CONNECTION) - }); + }) it("creates a redis client with the connection", () => { - expect(createClient).not.toHaveBeenCalled(); - }); + expect(createClient).not.toHaveBeenCalled() + }) it("is open", () => { - expect(client.isOpen()).toBe(true); - }); + expect(client.isOpen()).toBe(true) + }) it("returns itself", async () => { - expect(self).toBe(client); - }); - }); + expect(self).toBe(client) + }) + }) describe("when called on an open connection", () => { beforeEach(async () => { - await client.open(); + await client.open() // @ts-ignore: no way to call createClient without actually connecting to Redis - self = await client.use(BOGUS_CONNECTION); - }); + self = await client.use(BOGUS_CONNECTION) + }) it("closes the existing redis connection", () => { - expect(redis.quit).toHaveBeenCalled(); + expect(redis.quit).toHaveBeenCalled() }) it("doesn't create a new redis client", () => { - expect(createClient).not.toHaveBeenCalledWith(); - }); + expect(createClient).not.toHaveBeenCalledWith() + }) it("is open", () => { - expect(client.isOpen()).toBe(true); - }); + expect(client.isOpen()).toBe(true) + }) it("returns itself", async () => { - expect(self).toBe(client); - }); - }); - }); -}); + expect(self).toBe(client) + }) + }) + }) +}) diff --git a/spec/unit/indexer/index-builder/boolean-hash-fields.spec.ts b/spec/unit/indexer/index-builder/boolean-hash-fields.spec.ts index 4b718ebc..315a3eb5 100644 --- a/spec/unit/indexer/index-builder/boolean-hash-fields.spec.ts +++ b/spec/unit/indexer/index-builder/boolean-hash-fields.spec.ts @@ -1,7 +1,6 @@ -import { Schema } from '$lib/schema/schema' -import { SchemaDefinition } from '$lib/schema/definition' -import { DataStructure } from '$lib/schema/options' -import { buildRediSearchIndex } from '$lib/indexer/index-builder' +import { Schema, SchemaDefinition, DataStructure } from '$lib/schema' +import { buildRediSearchIndex } from '$lib/indexer' + describe("#buildRediSearchIndex", () => { describe.each([ diff --git a/spec/unit/indexer/index-builder/boolean-json-fields.spec.ts b/spec/unit/indexer/index-builder/boolean-json-fields.spec.ts index 3a0556a0..7025bbe6 100644 --- a/spec/unit/indexer/index-builder/boolean-json-fields.spec.ts +++ b/spec/unit/indexer/index-builder/boolean-json-fields.spec.ts @@ -1,7 +1,6 @@ -import { Schema } from '$lib/schema/schema' -import { SchemaDefinition } from '$lib/schema/definition' -import { DataStructure } from '$lib/schema/options' -import { buildRediSearchIndex } from '$lib/indexer/index-builder' +import { Schema, SchemaDefinition, DataStructure } from '$lib/schema' +import { buildRediSearchIndex } from '$lib/indexer' + const warnSpy = vi.spyOn(global.console, 'warn').mockImplementation(() => {}) diff --git a/spec/unit/indexer/index-builder/date-hash-fields.spec.ts b/spec/unit/indexer/index-builder/date-hash-fields.spec.ts index 83b053c2..87c25954 100644 --- a/spec/unit/indexer/index-builder/date-hash-fields.spec.ts +++ b/spec/unit/indexer/index-builder/date-hash-fields.spec.ts @@ -1,7 +1,6 @@ -import { Schema } from '$lib/schema/schema' -import { SchemaDefinition } from '$lib/schema/definition' -import { DataStructure } from '$lib/schema/options' -import { buildRediSearchIndex } from '$lib/indexer/index-builder' +import { Schema, SchemaDefinition, DataStructure } from '$lib/schema' +import { buildRediSearchIndex } from '$lib/indexer' + describe("#buildRediSearchIndex", () => { describe.each([ diff --git a/spec/unit/indexer/index-builder/date-json-fields.spec.ts b/spec/unit/indexer/index-builder/date-json-fields.spec.ts index 4c984927..b7bdd143 100644 --- a/spec/unit/indexer/index-builder/date-json-fields.spec.ts +++ b/spec/unit/indexer/index-builder/date-json-fields.spec.ts @@ -1,7 +1,6 @@ -import { Schema } from '$lib/schema/schema' -import { SchemaDefinition } from '$lib/schema/definition' -import { DataStructure } from '$lib/schema/options' -import { buildRediSearchIndex } from '$lib/indexer/index-builder' +import { Schema, SchemaDefinition, DataStructure } from '$lib/schema' +import { buildRediSearchIndex } from '$lib/indexer' + describe("Schema", () => { describe.each([ diff --git a/spec/unit/indexer/index-builder/index-builder.spec.ts b/spec/unit/indexer/index-builder/index-builder.spec.ts index 3cb5142d..c02dcdc6 100644 --- a/spec/unit/indexer/index-builder/index-builder.spec.ts +++ b/spec/unit/indexer/index-builder/index-builder.spec.ts @@ -1,7 +1,6 @@ -import { Schema } from '$lib/schema/schema' -import { SchemaDefinition } from '$lib/schema/definition' -import { DataStructure } from '$lib/schema/options' -import { buildRediSearchIndex } from '$lib/indexer/index-builder' +import { Schema, SchemaDefinition, DataStructure } from '$lib/schema' +import { buildRediSearchIndex } from '$lib/indexer' + describe("#buildRediSearchIndex", () => { describe.each([ diff --git a/spec/unit/indexer/index-builder/numeric-hash-fields.spec.ts b/spec/unit/indexer/index-builder/numeric-hash-fields.spec.ts index b7c524ae..4b3dec72 100644 --- a/spec/unit/indexer/index-builder/numeric-hash-fields.spec.ts +++ b/spec/unit/indexer/index-builder/numeric-hash-fields.spec.ts @@ -1,7 +1,6 @@ -import { Schema } from '$lib/schema/schema' -import { SchemaDefinition } from '$lib/schema/definition' -import { DataStructure } from '$lib/schema/options' -import { buildRediSearchIndex } from '$lib/indexer/index-builder' +import { Schema, SchemaDefinition, DataStructure } from '$lib/schema' +import { buildRediSearchIndex } from '$lib/indexer' + describe("Schema", () => { describe.each([ diff --git a/spec/unit/indexer/index-builder/numeric-json-fields.spec.ts b/spec/unit/indexer/index-builder/numeric-json-fields.spec.ts index 42bcd9ce..9af34477 100644 --- a/spec/unit/indexer/index-builder/numeric-json-fields.spec.ts +++ b/spec/unit/indexer/index-builder/numeric-json-fields.spec.ts @@ -1,7 +1,6 @@ -import { Schema } from '$lib/schema/schema' -import { SchemaDefinition } from '$lib/schema/definition' -import { DataStructure } from '$lib/schema/options' -import { buildRediSearchIndex } from '$lib/indexer/index-builder' +import { Schema, SchemaDefinition, DataStructure } from '$lib/schema' +import { buildRediSearchIndex } from '$lib/indexer' + describe("Schema", () => { describe.each([ diff --git a/spec/unit/indexer/index-builder/point-hash-fields.spec.ts b/spec/unit/indexer/index-builder/point-hash-fields.spec.ts index 79963a41..230e64a9 100644 --- a/spec/unit/indexer/index-builder/point-hash-fields.spec.ts +++ b/spec/unit/indexer/index-builder/point-hash-fields.spec.ts @@ -1,7 +1,6 @@ -import { Schema } from '$lib/schema/schema' -import { SchemaDefinition } from '$lib/schema/definition' -import { DataStructure } from '$lib/schema/options' -import { buildRediSearchIndex } from '$lib/indexer/index-builder' +import { Schema, SchemaDefinition, DataStructure } from '$lib/schema' +import { buildRediSearchIndex } from '$lib/indexer' + describe("Schema", () => { describe.each([ diff --git a/spec/unit/indexer/index-builder/point-json-fields.spec.ts b/spec/unit/indexer/index-builder/point-json-fields.spec.ts index c4c8f1da..8444ca71 100644 --- a/spec/unit/indexer/index-builder/point-json-fields.spec.ts +++ b/spec/unit/indexer/index-builder/point-json-fields.spec.ts @@ -1,7 +1,6 @@ -import { Schema } from '$lib/schema/schema' -import { SchemaDefinition } from '$lib/schema/definition' -import { DataStructure } from '$lib/schema/options' -import { buildRediSearchIndex } from '$lib/indexer/index-builder' +import { Schema, SchemaDefinition, DataStructure } from '$lib/schema' +import { buildRediSearchIndex } from '$lib/indexer' + describe("Schema", () => { describe.each([ diff --git a/spec/unit/indexer/index-builder/string-array-hash-fields.spec.ts b/spec/unit/indexer/index-builder/string-array-hash-fields.spec.ts index 81267152..3252e6eb 100644 --- a/spec/unit/indexer/index-builder/string-array-hash-fields.spec.ts +++ b/spec/unit/indexer/index-builder/string-array-hash-fields.spec.ts @@ -1,7 +1,6 @@ -import { Schema } from '$lib/schema/schema' -import { SchemaDefinition } from '$lib/schema/definition' -import { DataStructure } from '$lib/schema/options' -import { buildRediSearchIndex } from '$lib/indexer/index-builder' +import { Schema, SchemaDefinition, DataStructure } from '$lib/schema' +import { buildRediSearchIndex } from '$lib/indexer' + describe("Schema", () => { describe.each([ diff --git a/spec/unit/indexer/index-builder/string-array-json-fields.spec.ts b/spec/unit/indexer/index-builder/string-array-json-fields.spec.ts index 31ac9e49..1fd20b48 100644 --- a/spec/unit/indexer/index-builder/string-array-json-fields.spec.ts +++ b/spec/unit/indexer/index-builder/string-array-json-fields.spec.ts @@ -1,7 +1,6 @@ -import { Schema } from '$lib/schema/schema' -import { SchemaDefinition } from '$lib/schema/definition' -import { DataStructure } from '$lib/schema/options' -import { buildRediSearchIndex } from '$lib/indexer/index-builder' +import { Schema, SchemaDefinition, DataStructure } from '$lib/schema' +import { buildRediSearchIndex } from '$lib/indexer' + describe("Schema", () => { describe.each([ diff --git a/spec/unit/indexer/index-builder/string-hash-fields.spec.ts b/spec/unit/indexer/index-builder/string-hash-fields.spec.ts index 06d56f59..ba595c69 100644 --- a/spec/unit/indexer/index-builder/string-hash-fields.spec.ts +++ b/spec/unit/indexer/index-builder/string-hash-fields.spec.ts @@ -1,7 +1,6 @@ -import { Schema } from '$lib/schema/schema' -import { SchemaDefinition } from '$lib/schema/definition' -import { DataStructure } from '$lib/schema/options' -import { buildRediSearchIndex } from '$lib/indexer/index-builder' +import { Schema, SchemaDefinition, DataStructure } from '$lib/schema' +import { buildRediSearchIndex } from '$lib/indexer' + describe("Schema", () => { describe.each([ diff --git a/spec/unit/indexer/index-builder/string-json-fields.spec.ts b/spec/unit/indexer/index-builder/string-json-fields.spec.ts index 65ecb1d2..6dc8fdf4 100644 --- a/spec/unit/indexer/index-builder/string-json-fields.spec.ts +++ b/spec/unit/indexer/index-builder/string-json-fields.spec.ts @@ -1,7 +1,6 @@ -import { Schema } from '$lib/schema/schema' -import { SchemaDefinition } from '$lib/schema/definition' -import { DataStructure } from '$lib/schema/options' -import { buildRediSearchIndex } from '$lib/indexer/index-builder' +import { Schema, SchemaDefinition, DataStructure } from '$lib/schema' +import { buildRediSearchIndex } from '$lib/indexer' + const warnSpy = vi.spyOn(global.console, 'warn').mockImplementation(() => {}) diff --git a/spec/unit/indexer/index-builder/text-hash-fields.spec.ts b/spec/unit/indexer/index-builder/text-hash-fields.spec.ts index 52dc8b00..8b48762a 100644 --- a/spec/unit/indexer/index-builder/text-hash-fields.spec.ts +++ b/spec/unit/indexer/index-builder/text-hash-fields.spec.ts @@ -1,7 +1,6 @@ -import { Schema } from '$lib/schema/schema' -import { SchemaDefinition } from '$lib/schema/definition' -import { DataStructure } from '$lib/schema/options' -import { buildRediSearchIndex } from '$lib/indexer/index-builder' +import { Schema, SchemaDefinition, DataStructure } from '$lib/schema' +import { buildRediSearchIndex } from '$lib/indexer' + describe("Schema", () => { describe.each([ diff --git a/spec/unit/indexer/index-builder/text-json-fields.spec.ts b/spec/unit/indexer/index-builder/text-json-fields.spec.ts index 48ee6e33..5ea828a2 100644 --- a/spec/unit/indexer/index-builder/text-json-fields.spec.ts +++ b/spec/unit/indexer/index-builder/text-json-fields.spec.ts @@ -1,7 +1,6 @@ -import { Schema } from '$lib/schema/schema' -import { SchemaDefinition } from '$lib/schema/definition' -import { DataStructure } from '$lib/schema/options' -import { buildRediSearchIndex } from '$lib/indexer/index-builder' +import { Schema, SchemaDefinition, DataStructure } from '$lib/schema' +import { buildRediSearchIndex } from '$lib/indexer' + describe("Schema", () => { describe.each([