From 972e35fa37111fd22da0f38714c5efc5d6147d9a Mon Sep 17 00:00:00 2001 From: Guy Royse Date: Mon, 15 Jul 2024 16:16:34 -0400 Subject: [PATCH] updated formatting, bumped version, generated docs --- CHANGELOG | 4 + docs/README.md | 132 ++++++++++---- docs/classes/AbstractSearch.md | 186 +++++++++---------- docs/classes/ArrayHashInput.md | 4 +- docs/classes/Circle.md | 34 ++-- docs/classes/Client.md | 26 +-- docs/classes/Field.md | 28 +-- docs/classes/FieldNotInSchema.md | 4 +- docs/classes/InvalidHashInput.md | 6 +- docs/classes/InvalidHashValue.md | 8 +- docs/classes/InvalidJsonInput.md | 8 +- docs/classes/InvalidJsonValue.md | 8 +- docs/classes/NestedHashInput.md | 4 +- docs/classes/NullJsonInput.md | 8 +- docs/classes/NullJsonValue.md | 8 +- docs/classes/PointOutOfRange.md | 4 +- docs/classes/RawSearch.md | 188 +++++++++---------- docs/classes/Repository.md | 88 +++++---- docs/classes/Schema.md | 54 ++++-- docs/classes/Search.md | 236 ++++++++++++------------ docs/classes/Where.md | 2 +- docs/classes/WhereField.md | 214 +++++++++++----------- lib/client/client.ts | 4 +- lib/index.ts | 4 +- lib/repository/repository.ts | 14 +- lib/schema/definitions.ts | 2 +- lib/schema/schema.ts | 22 +-- lib/search/results-converter.ts | 8 +- lib/search/search.ts | 300 +++++++++++++++---------------- lib/search/where-boolean.ts | 2 +- lib/search/where-date.ts | 2 +- lib/search/where-field.ts | 2 +- lib/search/where-number.ts | 2 +- lib/search/where-point.ts | 2 +- lib/search/where-string-array.ts | 2 +- lib/search/where-string.ts | 2 +- lib/search/where-text.ts | 2 +- package.json | 2 +- 38 files changed, 879 insertions(+), 747 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 88ae7e5..a522e9d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and Redis OM adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.4.4 - 2024-07-15 +### Added +- Added better TypeScript support for *Entity* + ## 0.4.3 - 2023-10-30 ### Fixed - Fixed issue with change of casing in error message in RediSearch when calling `.dropIndex` on *Repository* diff --git a/docs/README.md b/docs/README.md index 2b58e1e..6574edc 100644 --- a/docs/README.md +++ b/docs/README.md @@ -44,9 +44,12 @@ redis-om - [Entity](README.md#entity) - [EntityData](README.md#entitydata) - [EntityDataValue](README.md#entitydatavalue) +- [EntityInternal](README.md#entityinternal) +- [EntityKeys](README.md#entitykeys) - [FieldDefinition](README.md#fielddefinition) - [FieldType](README.md#fieldtype) - [IdStrategy](README.md#idstrategy) +- [InferSchema](README.md#inferschema) - [NumberArrayFieldDefinition](README.md#numberarrayfielddefinition) - [NumberFieldDefinition](README.md#numberfielddefinition) - [Point](README.md#point) @@ -94,7 +97,7 @@ All configuration properties that any field might have, regardless of type. #### Defined in -[lib/schema/definitions.ts:5](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L5) +[lib/schema/definitions.ts:7](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/definitions.ts#L7) ___ @@ -106,7 +109,7 @@ A field representing a boolean. #### Defined in -[lib/schema/definitions.ts:78](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L78) +[lib/schema/definitions.ts:80](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/definitions.ts#L80) ___ @@ -132,7 +135,7 @@ A function that defines a circle for `.inCircle` searches. #### Defined in -[lib/search/where-point.ts:8](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-point.ts#L8) +[lib/search/where-point.ts:8](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-point.ts#L8) ___ @@ -144,7 +147,7 @@ The configuration properties that all fields have in common. #### Defined in -[lib/schema/definitions.ts:75](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L75) +[lib/schema/definitions.ts:77](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/definitions.ts#L77) ___ @@ -156,7 +159,7 @@ The type of data structure in Redis to map objects to. #### Defined in -[lib/schema/options.ts:2](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/options.ts#L2) +[lib/schema/options.ts:2](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/options.ts#L2) ___ @@ -168,19 +171,19 @@ A field representing a date/time. #### Defined in -[lib/schema/definitions.ts:83](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L83) +[lib/schema/definitions.ts:85](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/definitions.ts#L85) ___ ### Entity -Ƭ **Entity**: [`EntityData`](README.md#entitydata) & { `[EntityId]?`: `string` ; `[EntityKeyName]?`: `string` } +Ƭ **Entity**: [`EntityData`](README.md#entitydata) & [`EntityInternal`](README.md#entityinternal) Defines the objects returned from calls to [repositories](classes/Repository.md). #### Defined in -[lib/entity/entity.ts:8](https://github.com/redis/redis-om-node/blob/d8438f7/lib/entity/entity.ts#L8) +[lib/entity/entity.ts:16](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/entity/entity.ts#L16) ___ @@ -196,7 +199,7 @@ The free-form data associated with an [Entity](README.md#entity). #### Defined in -[lib/entity/entity.ts:18](https://github.com/redis/redis-om-node/blob/d8438f7/lib/entity/entity.ts#L18) +[lib/entity/entity.ts:20](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/entity/entity.ts#L20) ___ @@ -208,7 +211,40 @@ Valid types for values in an [Entity](README.md#entity). #### Defined in -[lib/entity/entity.ts:23](https://github.com/redis/redis-om-node/blob/d8438f7/lib/entity/entity.ts#L23) +[lib/entity/entity.ts:25](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/entity/entity.ts#L25) + +___ + +### EntityInternal + +Ƭ **EntityInternal**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `[EntityId]?` | `string` | The unique ID of the [Entity](README.md#entity). Access using the [EntityId](README.md#entityid) Symbol. | +| `[EntityKeyName]?` | `string` | The key the [Entity](README.md#entity) is stored under inside of Redis. Access using the [EntityKeyName](README.md#entitykeyname) Symbol. | + +#### Defined in + +[lib/entity/entity.ts:7](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/entity/entity.ts#L7) + +___ + +### EntityKeys + +Ƭ **EntityKeys**<`T`\>: `Exclude` + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `T` | extends [`Entity`](README.md#entity) | + +#### Defined in + +[lib/entity/entity.ts:17](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/entity/entity.ts#L17) ___ @@ -220,7 +256,7 @@ Contains instructions telling how to map a property on an [Entity](README.md#ent #### Defined in -[lib/schema/definitions.ts:117](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L117) +[lib/schema/definitions.ts:119](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/definitions.ts#L119) ___ @@ -232,7 +268,7 @@ Valid field types for a [FieldDefinition](README.md#fielddefinition). #### Defined in -[lib/schema/definitions.ts:2](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L2) +[lib/schema/definitions.ts:4](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/definitions.ts#L4) ___ @@ -252,7 +288,23 @@ A function that generates random entityIds. #### Defined in -[lib/schema/options.ts:5](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/options.ts#L5) +[lib/schema/options.ts:5](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/options.ts#L5) + +___ + +### InferSchema + +Ƭ **InferSchema**<`T`\>: `T` extends [`Schema`](classes/Schema.md) ? `R` : `never` + +#### Type parameters + +| Name | +| :------ | +| `T` | + +#### Defined in + +[lib/schema/schema.ts:181](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/schema.ts#L181) ___ @@ -264,7 +316,7 @@ A field representing an array of numbers. #### Defined in -[lib/schema/definitions.ts:93](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L93) +[lib/schema/definitions.ts:95](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/definitions.ts#L95) ___ @@ -276,7 +328,7 @@ A field representing a number. #### Defined in -[lib/schema/definitions.ts:88](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L88) +[lib/schema/definitions.ts:90](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/definitions.ts#L90) ___ @@ -295,7 +347,7 @@ Defines a point on the globe using longitude and latitude. #### Defined in -[lib/entity/entity.ts:26](https://github.com/redis/redis-om-node/blob/d8438f7/lib/entity/entity.ts#L26) +[lib/entity/entity.ts:28](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/entity/entity.ts#L28) ___ @@ -307,7 +359,7 @@ A field representing a point on the globe. #### Defined in -[lib/schema/definitions.ts:98](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L98) +[lib/schema/definitions.ts:100](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/definitions.ts#L100) ___ @@ -319,7 +371,7 @@ A conventional Redis connection. #### Defined in -[lib/client/client.ts:8](https://github.com/redis/redis-om-node/blob/d8438f7/lib/client/client.ts#L8) +[lib/client/client.ts:8](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/client/client.ts#L8) ___ @@ -331,7 +383,7 @@ A clustered Redis connection. #### Defined in -[lib/client/client.ts:11](https://github.com/redis/redis-om-node/blob/d8438f7/lib/client/client.ts#L11) +[lib/client/client.ts:11](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/client/client.ts#L11) ___ @@ -343,19 +395,25 @@ A Redis connection, clustered or conventional. #### Defined in -[lib/client/client.ts:14](https://github.com/redis/redis-om-node/blob/d8438f7/lib/client/client.ts#L14) +[lib/client/client.ts:14](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/client/client.ts#L14) ___ ### SchemaDefinition -Ƭ **SchemaDefinition**: `Record`<`string`, [`FieldDefinition`](README.md#fielddefinition)\> +Ƭ **SchemaDefinition**<`T`\>: `Record`<[`EntityKeys`](README.md#entitykeys)<`T`\>, [`FieldDefinition`](README.md#fielddefinition)\> Group of [FieldDefinition](README.md#fielddefinition)s that define the schema for an [Entity](README.md#entity). +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `T` | extends [`Entity`](README.md#entity) = `Record`<`string`, `any`\> | + #### Defined in -[lib/schema/definitions.ts:123](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L123) +[lib/schema/definitions.ts:125](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/definitions.ts#L125) ___ @@ -378,7 +436,7 @@ Configuration options for a [Schema](classes/Schema.md). #### Defined in -[lib/schema/options.ts:11](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/options.ts#L11) +[lib/schema/options.ts:11](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/options.ts#L11) ___ @@ -390,7 +448,7 @@ Valid values for how to use stop words for a given [Schema](classes/Schema.md). #### Defined in -[lib/schema/options.ts:8](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/options.ts#L8) +[lib/schema/options.ts:8](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/options.ts#L8) ___ @@ -402,7 +460,7 @@ A field representing an array of strings. #### Defined in -[lib/schema/definitions.ts:107](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L107) +[lib/schema/definitions.ts:109](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/definitions.ts#L109) ___ @@ -414,17 +472,23 @@ A field representing a whole string. #### Defined in -[lib/schema/definitions.ts:102](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L102) +[lib/schema/definitions.ts:104](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/definitions.ts#L104) ___ ### SubSearchFunction -Ƭ **SubSearchFunction**: (`search`: [`Search`](classes/Search.md)) => [`Search`](classes/Search.md) +Ƭ **SubSearchFunction**<`T`\>: (`search`: [`Search`](classes/Search.md)<`T`\>) => [`Search`](classes/Search.md)<`T`\> + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `T` | extends [`Entity`](README.md#entity) | #### Type declaration -▸ (`search`): [`Search`](classes/Search.md) +▸ (`search`): [`Search`](classes/Search.md)<`T`\> A function that takes a [Search](classes/Search.md) and returns a [Search](classes/Search.md). Used in nested queries. @@ -432,15 +496,15 @@ A function that takes a [Search](classes/Search.md) and returns a [Search](class | Name | Type | | :------ | :------ | -| `search` | [`Search`](classes/Search.md) | +| `search` | [`Search`](classes/Search.md)<`T`\> | ##### Returns -[`Search`](classes/Search.md) +[`Search`](classes/Search.md)<`T`\> #### Defined in -[lib/search/search.ts:26](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L26) +[lib/search/search.ts:31](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L31) ___ @@ -452,7 +516,7 @@ A field representing searchable text. #### Defined in -[lib/schema/definitions.ts:112](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L112) +[lib/schema/definitions.ts:114](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/definitions.ts#L114) ## Variables @@ -464,7 +528,7 @@ The Symbol used to access the entity ID of an [Entity](README.md#entity). #### Defined in -[lib/entity/entity.ts:2](https://github.com/redis/redis-om-node/blob/d8438f7/lib/entity/entity.ts#L2) +[lib/entity/entity.ts:2](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/entity/entity.ts#L2) ___ @@ -476,4 +540,4 @@ The Symbol used to access the keyname of an [Entity](README.md#entity). #### Defined in -[lib/entity/entity.ts:5](https://github.com/redis/redis-om-node/blob/d8438f7/lib/entity/entity.ts#L5) +[lib/entity/entity.ts:5](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/entity/entity.ts#L5) diff --git a/docs/classes/AbstractSearch.md b/docs/classes/AbstractSearch.md index 78bf63c..a7d9f2e 100644 --- a/docs/classes/AbstractSearch.md +++ b/docs/classes/AbstractSearch.md @@ -1,6 +1,6 @@ [redis-om](../README.md) / AbstractSearch -# Class: AbstractSearch +# Class: AbstractSearch Abstract base class for [Search](Search.md) and [RawSearch](RawSearch.md) that contains methods to return search results. @@ -9,6 +9,12 @@ contains methods to return search results. The type of [Entity](../README.md#entity) being sought. +## Type parameters + +| Name | Type | +| :------ | :------ | +| `T` | extends [`Entity`](../README.md#entity) = `Record`<`string`, `any`\> | + ## Hierarchy - **`AbstractSearch`** @@ -67,25 +73,25 @@ The type of [Entity](../README.md#entity) being sought. ### return -• `get` **return**(): [`AbstractSearch`](AbstractSearch.md) +• `get` **return**(): [`AbstractSearch`](AbstractSearch.md)<`T`\> Returns the current instance. Syntactic sugar to make your code more fluent. #### Returns -[`AbstractSearch`](AbstractSearch.md) +[`AbstractSearch`](AbstractSearch.md)<`T`\> this #### Defined in -[lib/search/search.ts:308](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L308) +[lib/search/search.ts:329](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L329) ## Methods ### all -▸ **all**(`options?`): `Promise`<[`Entity`](../README.md#entity)[]\> +▸ **all**(`options?`): `Promise`<`T`[]\> Returns all the [Entities](../README.md#entity) that match this query. This method makes multiple calls to Redis until all the [Entities](../README.md#entity) are returned. @@ -105,13 +111,13 @@ const entities = await repository.search().returnAll({ pageSize: 100 }) #### Returns -`Promise`<[`Entity`](../README.md#entity)[]\> +`Promise`<`T`[]\> An array of [Entities](../README.md#entity) matching the query. #### Defined in -[lib/search/search.ts:264](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L264) +[lib/search/search.ts:285](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L285) ___ @@ -143,7 +149,7 @@ An array of entity IDs matching the query. #### Defined in -[lib/search/search.ts:282](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L282) +[lib/search/search.ts:303](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L303) ___ @@ -175,7 +181,7 @@ An array of key names matching the query. #### Defined in -[lib/search/search.ts:300](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L300) +[lib/search/search.ts:321](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L321) ___ @@ -191,23 +197,23 @@ Returns the number of [Entities](../README.md#entity) that match this query. #### Defined in -[lib/search/search.ts:188](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L188) +[lib/search/search.ts:209](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L209) ___ ### first -▸ **first**(): `Promise`<``null`` \| [`Entity`](../README.md#entity)\> +▸ **first**(): `Promise`<``null`` \| `T`\> Returns the first [Entity](../README.md#entity) that matches this query. #### Returns -`Promise`<``null`` \| [`Entity`](../README.md#entity)\> +`Promise`<``null`` \| `T`\> #### Defined in -[lib/search/search.ts:229](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L229) +[lib/search/search.ts:250](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L250) ___ @@ -223,7 +229,7 @@ Returns the first entity ID that matches this query. #### Defined in -[lib/search/search.ts:237](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L237) +[lib/search/search.ts:258](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L258) ___ @@ -231,7 +237,7 @@ ___ ▸ **firstKey**(): `Promise`<``null`` \| `string`\> -Returns the first key name that matches this query. +Returns the first key name that matches this query. #### Returns @@ -239,13 +245,13 @@ Returns the first key name that matches this query. #### Defined in -[lib/search/search.ts:245](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L245) +[lib/search/search.ts:266](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L266) ___ ### max -▸ **max**(`field`): `Promise`<``null`` \| [`Entity`](../README.md#entity)\> +▸ **max**(`field`): `Promise`<``null`` \| `T`\> Finds the [Entity](../README.md#entity) with the maximal value for a field. @@ -253,17 +259,17 @@ Finds the [Entity](../README.md#entity) with the maximal value for a field. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field with the maximal value. | +| `field` | `Exclude` | The field with the maximal value. | #### Returns -`Promise`<``null`` \| [`Entity`](../README.md#entity)\> +`Promise`<``null`` \| `T`\> The entity ID [Entity](../README.md#entity) with the maximal value #### Defined in -[lib/search/search.ts:162](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L162) +[lib/search/search.ts:183](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L183) ___ @@ -277,7 +283,7 @@ Finds the entity ID with the maximal value for a field. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field with the maximal value. | +| `field` | `Exclude` | The field with the maximal value. | #### Returns @@ -287,7 +293,7 @@ The entity ID with the maximal value #### Defined in -[lib/search/search.ts:171](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L171) +[lib/search/search.ts:192](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L192) ___ @@ -301,7 +307,7 @@ Finds the key name in Redis with the maximal value for a field. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field with the maximal value. | +| `field` | `Exclude` | The field with the maximal value. | #### Returns @@ -311,13 +317,13 @@ The key name with the maximal value #### Defined in -[lib/search/search.ts:180](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L180) +[lib/search/search.ts:201](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L201) ___ ### min -▸ **min**(`field`): `Promise`<``null`` \| [`Entity`](../README.md#entity)\> +▸ **min**(`field`): `Promise`<``null`` \| `T`\> Finds the [Entity](../README.md#entity) with the minimal value for a field. @@ -325,17 +331,17 @@ Finds the [Entity](../README.md#entity) with the minimal value for a field. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field with the minimal value. | +| `field` | `Exclude` | The field with the minimal value. | #### Returns -`Promise`<``null`` \| [`Entity`](../README.md#entity)\> +`Promise`<``null`` \| `T`\> The [Entity](../README.md#entity) with the minimal value #### Defined in -[lib/search/search.ts:135](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L135) +[lib/search/search.ts:156](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L156) ___ @@ -349,7 +355,7 @@ Finds the entity ID with the minimal value for a field. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field with the minimal value. | +| `field` | `Exclude` | The field with the minimal value. | #### Returns @@ -359,7 +365,7 @@ The entity ID with the minimal value #### Defined in -[lib/search/search.ts:144](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L144) +[lib/search/search.ts:165](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L165) ___ @@ -373,7 +379,7 @@ Finds the key name in Redis with the minimal value for a field. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field with the minimal value. | +| `field` | `Exclude` | The field with the minimal value. | #### Returns @@ -383,13 +389,13 @@ The key name with the minimal value #### Defined in -[lib/search/search.ts:153](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L153) +[lib/search/search.ts:174](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L174) ___ ### page -▸ **page**(`offset`, `count`): `Promise`<[`Entity`](../README.md#entity)[]\> +▸ **page**(`offset`, `count`): `Promise`<`T`[]\> Returns a page of [Entities](../README.md#entity) that match this query. @@ -402,13 +408,13 @@ Returns a page of [Entities](../README.md#entity) that match this query. #### Returns -`Promise`<[`Entity`](../README.md#entity)[]\> +`Promise`<`T`[]\> An array of [Entities](../README.md#entity) matching the query. #### Defined in -[lib/search/search.ts:199](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L199) +[lib/search/search.ts:220](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L220) ___ @@ -433,7 +439,7 @@ An array of strings matching the query. #### Defined in -[lib/search/search.ts:210](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L210) +[lib/search/search.ts:231](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L231) ___ @@ -458,13 +464,13 @@ An array of strings matching the query. #### Defined in -[lib/search/search.ts:221](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L221) +[lib/search/search.ts:242](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L242) ___ ### returnAll -▸ **returnAll**(`options?`): `Promise`<[`Entity`](../README.md#entity)[]\> +▸ **returnAll**(`options?`): `Promise`<`T`[]\> Alias for [all](Search.md#all). @@ -477,11 +483,11 @@ Alias for [all](Search.md#all). #### Returns -`Promise`<[`Entity`](../README.md#entity)[]\> +`Promise`<`T`[]\> #### Defined in -[lib/search/search.ts:406](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L406) +[lib/search/search.ts:427](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L427) ___ @@ -504,7 +510,7 @@ Alias for [allIds](Search.md#allids). #### Defined in -[lib/search/search.ts:413](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L413) +[lib/search/search.ts:434](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L434) ___ @@ -527,7 +533,7 @@ Alias for [allKeys](Search.md#allkeys). #### Defined in -[lib/search/search.ts:420](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L420) +[lib/search/search.ts:441](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L441) ___ @@ -543,23 +549,23 @@ Alias for [count](Search.md#count). #### Defined in -[lib/search/search.ts:357](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L357) +[lib/search/search.ts:378](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L378) ___ ### returnFirst -▸ **returnFirst**(): `Promise`<``null`` \| [`Entity`](../README.md#entity)\> +▸ **returnFirst**(): `Promise`<``null`` \| `T`\> Alias for [first](Search.md#first). #### Returns -`Promise`<``null`` \| [`Entity`](../README.md#entity)\> +`Promise`<``null`` \| `T`\> #### Defined in -[lib/search/search.ts:385](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L385) +[lib/search/search.ts:406](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L406) ___ @@ -575,7 +581,7 @@ Alias for [firstId](Search.md#firstid). #### Defined in -[lib/search/search.ts:392](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L392) +[lib/search/search.ts:413](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L413) ___ @@ -591,13 +597,13 @@ Alias for [firstKey](Search.md#firstkey). #### Defined in -[lib/search/search.ts:399](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L399) +[lib/search/search.ts:420](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L420) ___ ### returnMax -▸ **returnMax**(`field`): `Promise`<``null`` \| [`Entity`](../README.md#entity)\> +▸ **returnMax**(`field`): `Promise`<``null`` \| `T`\> Alias for [max](Search.md#max). @@ -605,15 +611,15 @@ Alias for [max](Search.md#max). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns -`Promise`<``null`` \| [`Entity`](../README.md#entity)\> +`Promise`<``null`` \| `T`\> #### Defined in -[lib/search/search.ts:336](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L336) +[lib/search/search.ts:357](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L357) ___ @@ -627,7 +633,7 @@ Alias for [maxId](Search.md#maxid). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns @@ -635,7 +641,7 @@ Alias for [maxId](Search.md#maxid). #### Defined in -[lib/search/search.ts:343](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L343) +[lib/search/search.ts:364](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L364) ___ @@ -649,7 +655,7 @@ Alias for [maxKey](Search.md#maxkey). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns @@ -657,13 +663,13 @@ Alias for [maxKey](Search.md#maxkey). #### Defined in -[lib/search/search.ts:350](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L350) +[lib/search/search.ts:371](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L371) ___ ### returnMin -▸ **returnMin**(`field`): `Promise`<``null`` \| [`Entity`](../README.md#entity)\> +▸ **returnMin**(`field`): `Promise`<``null`` \| `T`\> Alias for [min](Search.md#min). @@ -671,15 +677,15 @@ Alias for [min](Search.md#min). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns -`Promise`<``null`` \| [`Entity`](../README.md#entity)\> +`Promise`<``null`` \| `T`\> #### Defined in -[lib/search/search.ts:315](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L315) +[lib/search/search.ts:336](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L336) ___ @@ -693,7 +699,7 @@ Alias for [minId](Search.md#minid). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns @@ -701,7 +707,7 @@ Alias for [minId](Search.md#minid). #### Defined in -[lib/search/search.ts:322](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L322) +[lib/search/search.ts:343](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L343) ___ @@ -715,7 +721,7 @@ Alias for [minKey](Search.md#minkey). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns @@ -723,13 +729,13 @@ Alias for [minKey](Search.md#minkey). #### Defined in -[lib/search/search.ts:329](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L329) +[lib/search/search.ts:350](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L350) ___ ### returnPage -▸ **returnPage**(`offset`, `count`): `Promise`<[`Entity`](../README.md#entity)[]\> +▸ **returnPage**(`offset`, `count`): `Promise`<`T`[]\> Alias for [page](Search.md#page). @@ -742,11 +748,11 @@ Alias for [page](Search.md#page). #### Returns -`Promise`<[`Entity`](../README.md#entity)[]\> +`Promise`<`T`[]\> #### Defined in -[lib/search/search.ts:364](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L364) +[lib/search/search.ts:385](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L385) ___ @@ -769,7 +775,7 @@ Alias for [pageOfIds](Search.md#pageofids). #### Defined in -[lib/search/search.ts:371](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L371) +[lib/search/search.ts:392](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L392) ___ @@ -792,13 +798,13 @@ Alias for [pageOfKeys](Search.md#pageofkeys). #### Defined in -[lib/search/search.ts:378](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L378) +[lib/search/search.ts:399](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L399) ___ ### sortAsc -▸ **sortAsc**(`field`): [`AbstractSearch`](AbstractSearch.md) +▸ **sortAsc**(`field`): [`AbstractSearch`](AbstractSearch.md)<`T`\> Alias for [sortAscending](Search.md#sortascending). @@ -806,21 +812,21 @@ Alias for [sortAscending](Search.md#sortascending). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns -[`AbstractSearch`](AbstractSearch.md) +[`AbstractSearch`](AbstractSearch.md)<`T`\> #### Defined in -[lib/search/search.ts:86](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L86) +[lib/search/search.ts:92](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L92) ___ ### sortAscending -▸ **sortAscending**(`field`): [`AbstractSearch`](AbstractSearch.md) +▸ **sortAscending**(`field`): [`AbstractSearch`](AbstractSearch.md)<`T`\> Applies an ascending sort to the query. @@ -828,23 +834,23 @@ Applies an ascending sort to the query. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field to sort by. | +| `field` | `Exclude` | The field to sort by. | #### Returns -[`AbstractSearch`](AbstractSearch.md) +[`AbstractSearch`](AbstractSearch.md)<`T`\> this #### Defined in -[lib/search/search.ts:63](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L63) +[lib/search/search.ts:69](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L69) ___ ### sortBy -▸ **sortBy**(`fieldName`, `order?`): [`AbstractSearch`](AbstractSearch.md) +▸ **sortBy**(`fieldName`, `order?`): [`AbstractSearch`](AbstractSearch.md)<`T`\> Applies sorting for the query. @@ -852,24 +858,24 @@ Applies sorting for the query. | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `fieldName` | `string` | `undefined` | - | -| `order` | ``"ASC"`` \| ``"DESC"`` | `'ASC'` | The order of returned [Entities](../README.md#entity) Defaults to `ASC` (ascending) if not specified | +| `fieldName` | `Exclude` | `undefined` | The field to sort by. | +| `order` | ``"ASC"`` \| ``"DESC"`` | `"ASC"` | The order of returned [Entities](../README.md#entity) Defaults to `ASC` (ascending) if not specified | #### Returns -[`AbstractSearch`](AbstractSearch.md) +[`AbstractSearch`](AbstractSearch.md)<`T`\> this #### Defined in -[lib/search/search.ts:96](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L96) +[lib/search/search.ts:102](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L102) ___ ### sortDesc -▸ **sortDesc**(`field`): [`AbstractSearch`](AbstractSearch.md) +▸ **sortDesc**(`field`): [`AbstractSearch`](AbstractSearch.md)<`T`\> Alias for [sortDescending](Search.md#sortdescending). @@ -877,21 +883,21 @@ Alias for [sortDescending](Search.md#sortdescending). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns -[`AbstractSearch`](AbstractSearch.md) +[`AbstractSearch`](AbstractSearch.md)<`T`\> #### Defined in -[lib/search/search.ts:70](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L70) +[lib/search/search.ts:76](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L76) ___ ### sortDescending -▸ **sortDescending**(`field`): [`AbstractSearch`](AbstractSearch.md) +▸ **sortDescending**(`field`): [`AbstractSearch`](AbstractSearch.md)<`T`\> Applies a descending sort to the query. @@ -899,14 +905,14 @@ Applies a descending sort to the query. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field to sort by. | +| `field` | `Exclude` | The field to sort by. | #### Returns -[`AbstractSearch`](AbstractSearch.md) +[`AbstractSearch`](AbstractSearch.md)<`T`\> this #### Defined in -[lib/search/search.ts:79](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L79) +[lib/search/search.ts:85](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L85) diff --git a/docs/classes/ArrayHashInput.md b/docs/classes/ArrayHashInput.md index a3d4e36..8b0f273 100644 --- a/docs/classes/ArrayHashInput.md +++ b/docs/classes/ArrayHashInput.md @@ -49,7 +49,7 @@ #### Defined in -[lib/error/invalid-input.ts:67](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-input.ts#L67) +[lib/error/invalid-input.ts:67](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-input.ts#L67) ## Properties @@ -168,7 +168,7 @@ node_modules/@types/node/globals.d.ts:13 #### Defined in -[lib/error/invalid-input.ts:73](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-input.ts#L73) +[lib/error/invalid-input.ts:73](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-input.ts#L73) ## Methods diff --git a/docs/classes/Circle.md b/docs/classes/Circle.md index 0778171..f714105 100644 --- a/docs/classes/Circle.md +++ b/docs/classes/Circle.md @@ -54,7 +54,7 @@ This instance. #### Defined in -[lib/search/where-point.ts:149](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-point.ts#L149) +[lib/search/where-point.ts:149](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-point.ts#L149) ___ @@ -72,7 +72,7 @@ This instance. #### Defined in -[lib/search/where-point.ts:143](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-point.ts#L143) +[lib/search/where-point.ts:143](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-point.ts#L143) ___ @@ -90,7 +90,7 @@ This instance. #### Defined in -[lib/search/where-point.ts:137](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-point.ts#L137) +[lib/search/where-point.ts:137](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-point.ts#L137) ___ @@ -108,7 +108,7 @@ This instance. #### Defined in -[lib/search/where-point.ts:122](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-point.ts#L122) +[lib/search/where-point.ts:122](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-point.ts#L122) ___ @@ -126,7 +126,7 @@ This instance. #### Defined in -[lib/search/where-point.ts:128](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-point.ts#L128) +[lib/search/where-point.ts:128](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-point.ts#L128) ___ @@ -144,7 +144,7 @@ This instance. #### Defined in -[lib/search/where-point.ts:116](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-point.ts#L116) +[lib/search/where-point.ts:116](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-point.ts#L116) ___ @@ -162,7 +162,7 @@ This instance. #### Defined in -[lib/search/where-point.ts:95](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-point.ts#L95) +[lib/search/where-point.ts:95](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-point.ts#L95) ___ @@ -180,7 +180,7 @@ This instance. #### Defined in -[lib/search/where-point.ts:101](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-point.ts#L101) +[lib/search/where-point.ts:101](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-point.ts#L101) ___ @@ -198,7 +198,7 @@ This instance. #### Defined in -[lib/search/where-point.ts:107](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-point.ts#L107) +[lib/search/where-point.ts:107](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-point.ts#L107) ___ @@ -216,7 +216,7 @@ This instance. #### Defined in -[lib/search/where-point.ts:158](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-point.ts#L158) +[lib/search/where-point.ts:158](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-point.ts#L158) ___ @@ -234,7 +234,7 @@ This instance. #### Defined in -[lib/search/where-point.ts:164](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-point.ts#L164) +[lib/search/where-point.ts:164](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-point.ts#L164) ___ @@ -252,7 +252,7 @@ This instance. #### Defined in -[lib/search/where-point.ts:170](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-point.ts#L170) +[lib/search/where-point.ts:170](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-point.ts#L170) ## Methods @@ -276,7 +276,7 @@ This instance. #### Defined in -[lib/search/where-point.ts:42](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-point.ts#L42) +[lib/search/where-point.ts:42](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-point.ts#L42) ___ @@ -300,7 +300,7 @@ This instance. #### Defined in -[lib/search/where-point.ts:31](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-point.ts#L31) +[lib/search/where-point.ts:31](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-point.ts#L31) ___ @@ -325,7 +325,7 @@ This instance. #### Defined in -[lib/search/where-point.ts:54](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-point.ts#L54) +[lib/search/where-point.ts:54](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-point.ts#L54) ▸ **origin**(`longitude`, `latitude`): [`Circle`](Circle.md) @@ -347,7 +347,7 @@ This instance. #### Defined in -[lib/search/where-point.ts:64](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-point.ts#L64) +[lib/search/where-point.ts:64](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-point.ts#L64) ___ @@ -372,4 +372,4 @@ This instance. #### Defined in -[lib/search/where-point.ts:86](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-point.ts#L86) +[lib/search/where-point.ts:86](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-point.ts#L86) diff --git a/docs/classes/Client.md b/docs/classes/Client.md index f4398c4..baa5709 100644 --- a/docs/classes/Client.md +++ b/docs/classes/Client.md @@ -57,7 +57,7 @@ Returns the underlying Node Redis connection being used. #### Defined in -[lib/client/client.ts:70](https://github.com/redis/redis-om-node/blob/d8438f7/lib/client/client.ts#L70) +[lib/client/client.ts:70](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/client/client.ts#L70) ## Methods @@ -73,31 +73,37 @@ Close the connection to Redis. #### Defined in -[lib/client/client.ts:127](https://github.com/redis/redis-om-node/blob/d8438f7/lib/client/client.ts#L127) +[lib/client/client.ts:127](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/client/client.ts#L127) ___ ### fetchRepository -▸ **fetchRepository**(`schema`): [`Repository`](Repository.md) +▸ **fetchRepository**<`T`\>(`schema`): [`Repository`](Repository.md)<[`InferSchema`](../README.md#inferschema)<`T`\>\> Creates a repository for the given schema. +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `T` | extends [`Schema`](Schema.md)<`any`, `T`\> | + #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `schema` | [`Schema`](Schema.md) | The schema. | +| `schema` | `T` | The schema. | #### Returns -[`Repository`](Repository.md) +[`Repository`](Repository.md)<[`InferSchema`](../README.md#inferschema)<`T`\>\> A repository for the provided schema. #### Defined in -[lib/client/client.ts:119](https://github.com/redis/redis-om-node/blob/d8438f7/lib/client/client.ts#L119) +[lib/client/client.ts:119](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/client/client.ts#L119) ___ @@ -113,7 +119,7 @@ Whether a connection is already open. #### Defined in -[lib/client/client.ts:213](https://github.com/redis/redis-om-node/blob/d8438f7/lib/client/client.ts#L213) +[lib/client/client.ts:213](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/client/client.ts#L213) ___ @@ -137,7 +143,7 @@ This [Client](Client.md) instance. #### Defined in -[lib/client/client.ts:104](https://github.com/redis/redis-om-node/blob/d8438f7/lib/client/client.ts#L104) +[lib/client/client.ts:104](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/client/client.ts#L104) ___ @@ -162,7 +168,7 @@ This [Client](Client.md) instance. #### Defined in -[lib/client/client.ts:81](https://github.com/redis/redis-om-node/blob/d8438f7/lib/client/client.ts#L81) +[lib/client/client.ts:81](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/client/client.ts#L81) ___ @@ -187,4 +193,4 @@ This [Client](Client.md) instance. #### Defined in -[lib/client/client.ts:93](https://github.com/redis/redis-om-node/blob/d8438f7/lib/client/client.ts#L93) +[lib/client/client.ts:93](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/client/client.ts#L93) diff --git a/docs/classes/Field.md b/docs/classes/Field.md index ca1c9e7..f062b35 100644 --- a/docs/classes/Field.md +++ b/docs/classes/Field.md @@ -43,7 +43,7 @@ Creates a Field. #### Defined in -[lib/schema/field.ts:17](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/field.ts#L17) +[lib/schema/field.ts:17](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/field.ts#L17) ## Accessors @@ -59,7 +59,7 @@ The case-sensitivity of the field. #### Defined in -[lib/schema/field.ts:55](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/field.ts#L55) +[lib/schema/field.ts:55](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/field.ts#L55) ___ @@ -75,7 +75,7 @@ The field name used to store this [Field](Field.md) in a Hash. #### Defined in -[lib/schema/field.ts:33](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/field.ts#L33) +[lib/schema/field.ts:33](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/field.ts#L33) ___ @@ -91,7 +91,7 @@ Indicates the field as being indexed—and thus queryable—by RediSearch. #### Defined in -[lib/schema/field.ts:60](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/field.ts#L60) +[lib/schema/field.ts:60](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/field.ts#L60) ___ @@ -107,7 +107,7 @@ Is this type an array or not. #### Defined in -[lib/schema/field.ts:85](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/field.ts#L85) +[lib/schema/field.ts:85](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/field.ts#L85) ___ @@ -123,7 +123,7 @@ The JSONPath used to store this [Field](Field.md) in a JSON document. #### Defined in -[lib/schema/field.ts:38](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/field.ts#L38) +[lib/schema/field.ts:38](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/field.ts#L38) ___ @@ -139,7 +139,7 @@ The phonetic matcher for the field. #### Defined in -[lib/schema/field.ts:80](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/field.ts#L80) +[lib/schema/field.ts:80](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/field.ts#L80) ___ @@ -155,7 +155,7 @@ The name of the field. #### Defined in -[lib/schema/field.ts:23](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/field.ts#L23) +[lib/schema/field.ts:23](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/field.ts#L23) ___ @@ -171,7 +171,7 @@ Indicates that the field is normalized. Ignored if sortable is false. #### Defined in -[lib/schema/field.ts:70](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/field.ts#L70) +[lib/schema/field.ts:70](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/field.ts#L70) ___ @@ -187,7 +187,7 @@ The separator for string[] fields when stored in Hashes. #### Defined in -[lib/schema/field.ts:45](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/field.ts#L45) +[lib/schema/field.ts:45](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/field.ts#L45) ___ @@ -203,7 +203,7 @@ Indicates that the field as sortable. #### Defined in -[lib/schema/field.ts:50](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/field.ts#L50) +[lib/schema/field.ts:50](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/field.ts#L50) ___ @@ -219,7 +219,7 @@ Indicates that the field as indexed with stemming support. #### Defined in -[lib/schema/field.ts:65](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/field.ts#L65) +[lib/schema/field.ts:65](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/field.ts#L65) ___ @@ -235,7 +235,7 @@ The [type](../README.md#fieldtype) of the field. #### Defined in -[lib/schema/field.ts:28](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/field.ts#L28) +[lib/schema/field.ts:28](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/field.ts#L28) ___ @@ -251,4 +251,4 @@ The search weight of the field. #### Defined in -[lib/schema/field.ts:75](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/field.ts#L75) +[lib/schema/field.ts:75](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/field.ts#L75) diff --git a/docs/classes/FieldNotInSchema.md b/docs/classes/FieldNotInSchema.md index ff3bbee..35e6e50 100644 --- a/docs/classes/FieldNotInSchema.md +++ b/docs/classes/FieldNotInSchema.md @@ -49,7 +49,7 @@ #### Defined in -[lib/error/search-error.ts:11](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/search-error.ts#L11) +[lib/error/search-error.ts:11](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/search-error.ts#L11) ## Properties @@ -168,7 +168,7 @@ node_modules/@types/node/globals.d.ts:13 #### Defined in -[lib/error/search-error.ts:16](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/search-error.ts#L16) +[lib/error/search-error.ts:16](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/search-error.ts#L16) ## Methods diff --git a/docs/classes/InvalidHashInput.md b/docs/classes/InvalidHashInput.md index cf23de3..e3d7abc 100644 --- a/docs/classes/InvalidHashInput.md +++ b/docs/classes/InvalidHashInput.md @@ -50,7 +50,7 @@ #### Defined in -[lib/error/invalid-input.ts:40](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-input.ts#L40) +[lib/error/invalid-input.ts:40](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-input.ts#L40) ## Properties @@ -169,7 +169,7 @@ node_modules/@types/node/globals.d.ts:13 #### Defined in -[lib/error/invalid-input.ts:46](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-input.ts#L46) +[lib/error/invalid-input.ts:46](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-input.ts#L46) ___ @@ -183,7 +183,7 @@ ___ #### Defined in -[lib/error/invalid-input.ts:47](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-input.ts#L47) +[lib/error/invalid-input.ts:47](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-input.ts#L47) ## Methods diff --git a/docs/classes/InvalidHashValue.md b/docs/classes/InvalidHashValue.md index 0e565ac..c3ace67 100644 --- a/docs/classes/InvalidHashValue.md +++ b/docs/classes/InvalidHashValue.md @@ -51,7 +51,7 @@ #### Defined in -[lib/error/invalid-value.ts:40](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-value.ts#L40) +[lib/error/invalid-value.ts:40](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-value.ts#L40) ## Properties @@ -170,7 +170,7 @@ node_modules/@types/node/globals.d.ts:13 #### Defined in -[lib/error/invalid-value.ts:46](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-value.ts#L46) +[lib/error/invalid-value.ts:46](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-value.ts#L46) ___ @@ -184,7 +184,7 @@ ___ #### Defined in -[lib/error/invalid-value.ts:47](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-value.ts#L47) +[lib/error/invalid-value.ts:47](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-value.ts#L47) ___ @@ -198,7 +198,7 @@ ___ #### Defined in -[lib/error/invalid-value.ts:48](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-value.ts#L48) +[lib/error/invalid-value.ts:48](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-value.ts#L48) ## Methods diff --git a/docs/classes/InvalidJsonInput.md b/docs/classes/InvalidJsonInput.md index fd96e44..07bdb3d 100644 --- a/docs/classes/InvalidJsonInput.md +++ b/docs/classes/InvalidJsonInput.md @@ -51,7 +51,7 @@ #### Defined in -[lib/error/invalid-input.ts:25](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-input.ts#L25) +[lib/error/invalid-input.ts:25](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-input.ts#L25) ## Properties @@ -170,7 +170,7 @@ node_modules/@types/node/globals.d.ts:13 #### Defined in -[lib/error/invalid-input.ts:31](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-input.ts#L31) +[lib/error/invalid-input.ts:31](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-input.ts#L31) ___ @@ -184,7 +184,7 @@ ___ #### Defined in -[lib/error/invalid-input.ts:32](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-input.ts#L32) +[lib/error/invalid-input.ts:32](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-input.ts#L32) ___ @@ -198,7 +198,7 @@ ___ #### Defined in -[lib/error/invalid-input.ts:33](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-input.ts#L33) +[lib/error/invalid-input.ts:33](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-input.ts#L33) ## Methods diff --git a/docs/classes/InvalidJsonValue.md b/docs/classes/InvalidJsonValue.md index ef42a57..2f34f38 100644 --- a/docs/classes/InvalidJsonValue.md +++ b/docs/classes/InvalidJsonValue.md @@ -51,7 +51,7 @@ #### Defined in -[lib/error/invalid-value.ts:25](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-value.ts#L25) +[lib/error/invalid-value.ts:25](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-value.ts#L25) ## Properties @@ -170,7 +170,7 @@ node_modules/@types/node/globals.d.ts:13 #### Defined in -[lib/error/invalid-value.ts:31](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-value.ts#L31) +[lib/error/invalid-value.ts:31](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-value.ts#L31) ___ @@ -184,7 +184,7 @@ ___ #### Defined in -[lib/error/invalid-value.ts:32](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-value.ts#L32) +[lib/error/invalid-value.ts:32](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-value.ts#L32) ___ @@ -198,7 +198,7 @@ ___ #### Defined in -[lib/error/invalid-value.ts:33](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-value.ts#L33) +[lib/error/invalid-value.ts:33](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-value.ts#L33) ## Methods diff --git a/docs/classes/NestedHashInput.md b/docs/classes/NestedHashInput.md index b31b0aa..7983093 100644 --- a/docs/classes/NestedHashInput.md +++ b/docs/classes/NestedHashInput.md @@ -49,7 +49,7 @@ #### Defined in -[lib/error/invalid-input.ts:54](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-input.ts#L54) +[lib/error/invalid-input.ts:54](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-input.ts#L54) ## Properties @@ -168,7 +168,7 @@ node_modules/@types/node/globals.d.ts:13 #### Defined in -[lib/error/invalid-input.ts:60](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-input.ts#L60) +[lib/error/invalid-input.ts:60](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-input.ts#L60) ## Methods diff --git a/docs/classes/NullJsonInput.md b/docs/classes/NullJsonInput.md index e117a1b..35a7fdf 100644 --- a/docs/classes/NullJsonInput.md +++ b/docs/classes/NullJsonInput.md @@ -51,7 +51,7 @@ #### Defined in -[lib/error/invalid-input.ts:10](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-input.ts#L10) +[lib/error/invalid-input.ts:10](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-input.ts#L10) ## Properties @@ -170,7 +170,7 @@ node_modules/@types/node/globals.d.ts:13 #### Defined in -[lib/error/invalid-input.ts:16](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-input.ts#L16) +[lib/error/invalid-input.ts:16](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-input.ts#L16) ___ @@ -184,7 +184,7 @@ ___ #### Defined in -[lib/error/invalid-input.ts:17](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-input.ts#L17) +[lib/error/invalid-input.ts:17](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-input.ts#L17) ___ @@ -198,7 +198,7 @@ ___ #### Defined in -[lib/error/invalid-input.ts:18](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-input.ts#L18) +[lib/error/invalid-input.ts:18](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-input.ts#L18) ## Methods diff --git a/docs/classes/NullJsonValue.md b/docs/classes/NullJsonValue.md index 30538d7..5db4d17 100644 --- a/docs/classes/NullJsonValue.md +++ b/docs/classes/NullJsonValue.md @@ -51,7 +51,7 @@ #### Defined in -[lib/error/invalid-value.ts:10](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-value.ts#L10) +[lib/error/invalid-value.ts:10](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-value.ts#L10) ## Properties @@ -170,7 +170,7 @@ node_modules/@types/node/globals.d.ts:13 #### Defined in -[lib/error/invalid-value.ts:16](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-value.ts#L16) +[lib/error/invalid-value.ts:16](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-value.ts#L16) ___ @@ -184,7 +184,7 @@ ___ #### Defined in -[lib/error/invalid-value.ts:17](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-value.ts#L17) +[lib/error/invalid-value.ts:17](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-value.ts#L17) ___ @@ -198,7 +198,7 @@ ___ #### Defined in -[lib/error/invalid-value.ts:18](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/invalid-value.ts#L18) +[lib/error/invalid-value.ts:18](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/invalid-value.ts#L18) ## Methods diff --git a/docs/classes/PointOutOfRange.md b/docs/classes/PointOutOfRange.md index 1c82185..c02be22 100644 --- a/docs/classes/PointOutOfRange.md +++ b/docs/classes/PointOutOfRange.md @@ -49,7 +49,7 @@ #### Defined in -[lib/error/point-out-of-range.ts:9](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/point-out-of-range.ts#L9) +[lib/error/point-out-of-range.ts:9](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/point-out-of-range.ts#L9) ## Properties @@ -173,7 +173,7 @@ node_modules/@types/node/globals.d.ts:13 #### Defined in -[lib/error/point-out-of-range.ts:15](https://github.com/redis/redis-om-node/blob/d8438f7/lib/error/point-out-of-range.ts#L15) +[lib/error/point-out-of-range.ts:15](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/error/point-out-of-range.ts#L15) ## Methods diff --git a/docs/classes/RawSearch.md b/docs/classes/RawSearch.md index 7bf3cce..950eb7d 100644 --- a/docs/classes/RawSearch.md +++ b/docs/classes/RawSearch.md @@ -1,6 +1,6 @@ [redis-om](../README.md) / RawSearch -# Class: RawSearch +# Class: RawSearch Entry point to raw search which allows using raw RediSearch queries against Redis OM. Requires that RediSearch (and optionally RedisJSON) be @@ -10,9 +10,15 @@ installed. The type of [Entity](../README.md#entity) being sought. +## Type parameters + +| Name | Type | +| :------ | :------ | +| `T` | extends [`Entity`](../README.md#entity) = `Record`<`string`, `any`\> | + ## Hierarchy -- [`AbstractSearch`](AbstractSearch.md) +- [`AbstractSearch`](AbstractSearch.md)<`T`\> ↳ **`RawSearch`** @@ -66,13 +72,13 @@ The type of [Entity](../README.md#entity) being sought. ### return -• `get` **return**(): [`AbstractSearch`](AbstractSearch.md) +• `get` **return**(): [`AbstractSearch`](AbstractSearch.md)<`T`\> Returns the current instance. Syntactic sugar to make your code more fluent. #### Returns -[`AbstractSearch`](AbstractSearch.md) +[`AbstractSearch`](AbstractSearch.md)<`T`\> this @@ -82,13 +88,13 @@ AbstractSearch.return #### Defined in -[lib/search/search.ts:308](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L308) +[lib/search/search.ts:329](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L329) ## Methods ### all -▸ **all**(`options?`): `Promise`<[`Entity`](../README.md#entity)[]\> +▸ **all**(`options?`): `Promise`<`T`[]\> Returns all the [Entities](../README.md#entity) that match this query. This method makes multiple calls to Redis until all the [Entities](../README.md#entity) are returned. @@ -108,7 +114,7 @@ const entities = await repository.search().returnAll({ pageSize: 100 }) #### Returns -`Promise`<[`Entity`](../README.md#entity)[]\> +`Promise`<`T`[]\> An array of [Entities](../README.md#entity) matching the query. @@ -118,7 +124,7 @@ An array of [Entities](../README.md#entity) matching the query. #### Defined in -[lib/search/search.ts:264](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L264) +[lib/search/search.ts:285](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L285) ___ @@ -154,7 +160,7 @@ An array of entity IDs matching the query. #### Defined in -[lib/search/search.ts:282](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L282) +[lib/search/search.ts:303](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L303) ___ @@ -190,7 +196,7 @@ An array of key names matching the query. #### Defined in -[lib/search/search.ts:300](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L300) +[lib/search/search.ts:321](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L321) ___ @@ -210,19 +216,19 @@ Returns the number of [Entities](../README.md#entity) that match this query. #### Defined in -[lib/search/search.ts:188](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L188) +[lib/search/search.ts:209](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L209) ___ ### first -▸ **first**(): `Promise`<``null`` \| [`Entity`](../README.md#entity)\> +▸ **first**(): `Promise`<``null`` \| `T`\> Returns the first [Entity](../README.md#entity) that matches this query. #### Returns -`Promise`<``null`` \| [`Entity`](../README.md#entity)\> +`Promise`<``null`` \| `T`\> #### Inherited from @@ -230,7 +236,7 @@ Returns the first [Entity](../README.md#entity) that matches this query. #### Defined in -[lib/search/search.ts:229](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L229) +[lib/search/search.ts:250](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L250) ___ @@ -250,7 +256,7 @@ Returns the first entity ID that matches this query. #### Defined in -[lib/search/search.ts:237](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L237) +[lib/search/search.ts:258](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L258) ___ @@ -258,7 +264,7 @@ ___ ▸ **firstKey**(): `Promise`<``null`` \| `string`\> -Returns the first key name that matches this query. +Returns the first key name that matches this query. #### Returns @@ -270,13 +276,13 @@ Returns the first key name that matches this query. #### Defined in -[lib/search/search.ts:245](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L245) +[lib/search/search.ts:266](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L266) ___ ### max -▸ **max**(`field`): `Promise`<``null`` \| [`Entity`](../README.md#entity)\> +▸ **max**(`field`): `Promise`<``null`` \| `T`\> Finds the [Entity](../README.md#entity) with the maximal value for a field. @@ -284,11 +290,11 @@ Finds the [Entity](../README.md#entity) with the maximal value for a field. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field with the maximal value. | +| `field` | `Exclude` | The field with the maximal value. | #### Returns -`Promise`<``null`` \| [`Entity`](../README.md#entity)\> +`Promise`<``null`` \| `T`\> The entity ID [Entity](../README.md#entity) with the maximal value @@ -298,7 +304,7 @@ The entity ID [Entity](../README.md#entity) with the maximal value #### Defined in -[lib/search/search.ts:162](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L162) +[lib/search/search.ts:183](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L183) ___ @@ -312,7 +318,7 @@ Finds the entity ID with the maximal value for a field. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field with the maximal value. | +| `field` | `Exclude` | The field with the maximal value. | #### Returns @@ -326,7 +332,7 @@ The entity ID with the maximal value #### Defined in -[lib/search/search.ts:171](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L171) +[lib/search/search.ts:192](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L192) ___ @@ -340,7 +346,7 @@ Finds the key name in Redis with the maximal value for a field. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field with the maximal value. | +| `field` | `Exclude` | The field with the maximal value. | #### Returns @@ -354,13 +360,13 @@ The key name with the maximal value #### Defined in -[lib/search/search.ts:180](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L180) +[lib/search/search.ts:201](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L201) ___ ### min -▸ **min**(`field`): `Promise`<``null`` \| [`Entity`](../README.md#entity)\> +▸ **min**(`field`): `Promise`<``null`` \| `T`\> Finds the [Entity](../README.md#entity) with the minimal value for a field. @@ -368,11 +374,11 @@ Finds the [Entity](../README.md#entity) with the minimal value for a field. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field with the minimal value. | +| `field` | `Exclude` | The field with the minimal value. | #### Returns -`Promise`<``null`` \| [`Entity`](../README.md#entity)\> +`Promise`<``null`` \| `T`\> The [Entity](../README.md#entity) with the minimal value @@ -382,7 +388,7 @@ The [Entity](../README.md#entity) with the minimal value #### Defined in -[lib/search/search.ts:135](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L135) +[lib/search/search.ts:156](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L156) ___ @@ -396,7 +402,7 @@ Finds the entity ID with the minimal value for a field. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field with the minimal value. | +| `field` | `Exclude` | The field with the minimal value. | #### Returns @@ -410,7 +416,7 @@ The entity ID with the minimal value #### Defined in -[lib/search/search.ts:144](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L144) +[lib/search/search.ts:165](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L165) ___ @@ -424,7 +430,7 @@ Finds the key name in Redis with the minimal value for a field. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field with the minimal value. | +| `field` | `Exclude` | The field with the minimal value. | #### Returns @@ -438,13 +444,13 @@ The key name with the minimal value #### Defined in -[lib/search/search.ts:153](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L153) +[lib/search/search.ts:174](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L174) ___ ### page -▸ **page**(`offset`, `count`): `Promise`<[`Entity`](../README.md#entity)[]\> +▸ **page**(`offset`, `count`): `Promise`<`T`[]\> Returns a page of [Entities](../README.md#entity) that match this query. @@ -457,7 +463,7 @@ Returns a page of [Entities](../README.md#entity) that match this query. #### Returns -`Promise`<[`Entity`](../README.md#entity)[]\> +`Promise`<`T`[]\> An array of [Entities](../README.md#entity) matching the query. @@ -467,7 +473,7 @@ An array of [Entities](../README.md#entity) matching the query. #### Defined in -[lib/search/search.ts:199](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L199) +[lib/search/search.ts:220](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L220) ___ @@ -496,7 +502,7 @@ An array of strings matching the query. #### Defined in -[lib/search/search.ts:210](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L210) +[lib/search/search.ts:231](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L231) ___ @@ -525,13 +531,13 @@ An array of strings matching the query. #### Defined in -[lib/search/search.ts:221](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L221) +[lib/search/search.ts:242](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L242) ___ ### returnAll -▸ **returnAll**(`options?`): `Promise`<[`Entity`](../README.md#entity)[]\> +▸ **returnAll**(`options?`): `Promise`<`T`[]\> Alias for [all](Search.md#all). @@ -544,7 +550,7 @@ Alias for [all](Search.md#all). #### Returns -`Promise`<[`Entity`](../README.md#entity)[]\> +`Promise`<`T`[]\> #### Inherited from @@ -552,7 +558,7 @@ Alias for [all](Search.md#all). #### Defined in -[lib/search/search.ts:406](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L406) +[lib/search/search.ts:427](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L427) ___ @@ -579,7 +585,7 @@ Alias for [allIds](Search.md#allids). #### Defined in -[lib/search/search.ts:413](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L413) +[lib/search/search.ts:434](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L434) ___ @@ -606,7 +612,7 @@ Alias for [allKeys](Search.md#allkeys). #### Defined in -[lib/search/search.ts:420](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L420) +[lib/search/search.ts:441](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L441) ___ @@ -626,19 +632,19 @@ Alias for [count](Search.md#count). #### Defined in -[lib/search/search.ts:357](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L357) +[lib/search/search.ts:378](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L378) ___ ### returnFirst -▸ **returnFirst**(): `Promise`<``null`` \| [`Entity`](../README.md#entity)\> +▸ **returnFirst**(): `Promise`<``null`` \| `T`\> Alias for [first](Search.md#first). #### Returns -`Promise`<``null`` \| [`Entity`](../README.md#entity)\> +`Promise`<``null`` \| `T`\> #### Inherited from @@ -646,7 +652,7 @@ Alias for [first](Search.md#first). #### Defined in -[lib/search/search.ts:385](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L385) +[lib/search/search.ts:406](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L406) ___ @@ -666,7 +672,7 @@ Alias for [firstId](Search.md#firstid). #### Defined in -[lib/search/search.ts:392](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L392) +[lib/search/search.ts:413](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L413) ___ @@ -686,13 +692,13 @@ Alias for [firstKey](Search.md#firstkey). #### Defined in -[lib/search/search.ts:399](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L399) +[lib/search/search.ts:420](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L420) ___ ### returnMax -▸ **returnMax**(`field`): `Promise`<``null`` \| [`Entity`](../README.md#entity)\> +▸ **returnMax**(`field`): `Promise`<``null`` \| `T`\> Alias for [max](Search.md#max). @@ -700,11 +706,11 @@ Alias for [max](Search.md#max). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns -`Promise`<``null`` \| [`Entity`](../README.md#entity)\> +`Promise`<``null`` \| `T`\> #### Inherited from @@ -712,7 +718,7 @@ Alias for [max](Search.md#max). #### Defined in -[lib/search/search.ts:336](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L336) +[lib/search/search.ts:357](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L357) ___ @@ -726,7 +732,7 @@ Alias for [maxId](Search.md#maxid). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns @@ -738,7 +744,7 @@ Alias for [maxId](Search.md#maxid). #### Defined in -[lib/search/search.ts:343](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L343) +[lib/search/search.ts:364](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L364) ___ @@ -752,7 +758,7 @@ Alias for [maxKey](Search.md#maxkey). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns @@ -764,13 +770,13 @@ Alias for [maxKey](Search.md#maxkey). #### Defined in -[lib/search/search.ts:350](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L350) +[lib/search/search.ts:371](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L371) ___ ### returnMin -▸ **returnMin**(`field`): `Promise`<``null`` \| [`Entity`](../README.md#entity)\> +▸ **returnMin**(`field`): `Promise`<``null`` \| `T`\> Alias for [min](Search.md#min). @@ -778,11 +784,11 @@ Alias for [min](Search.md#min). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns -`Promise`<``null`` \| [`Entity`](../README.md#entity)\> +`Promise`<``null`` \| `T`\> #### Inherited from @@ -790,7 +796,7 @@ Alias for [min](Search.md#min). #### Defined in -[lib/search/search.ts:315](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L315) +[lib/search/search.ts:336](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L336) ___ @@ -804,7 +810,7 @@ Alias for [minId](Search.md#minid). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns @@ -816,7 +822,7 @@ Alias for [minId](Search.md#minid). #### Defined in -[lib/search/search.ts:322](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L322) +[lib/search/search.ts:343](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L343) ___ @@ -830,7 +836,7 @@ Alias for [minKey](Search.md#minkey). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns @@ -842,13 +848,13 @@ Alias for [minKey](Search.md#minkey). #### Defined in -[lib/search/search.ts:329](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L329) +[lib/search/search.ts:350](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L350) ___ ### returnPage -▸ **returnPage**(`offset`, `count`): `Promise`<[`Entity`](../README.md#entity)[]\> +▸ **returnPage**(`offset`, `count`): `Promise`<`T`[]\> Alias for [page](Search.md#page). @@ -861,7 +867,7 @@ Alias for [page](Search.md#page). #### Returns -`Promise`<[`Entity`](../README.md#entity)[]\> +`Promise`<`T`[]\> #### Inherited from @@ -869,7 +875,7 @@ Alias for [page](Search.md#page). #### Defined in -[lib/search/search.ts:364](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L364) +[lib/search/search.ts:385](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L385) ___ @@ -896,7 +902,7 @@ Alias for [pageOfIds](Search.md#pageofids). #### Defined in -[lib/search/search.ts:371](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L371) +[lib/search/search.ts:392](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L392) ___ @@ -923,13 +929,13 @@ Alias for [pageOfKeys](Search.md#pageofkeys). #### Defined in -[lib/search/search.ts:378](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L378) +[lib/search/search.ts:399](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L399) ___ ### sortAsc -▸ **sortAsc**(`field`): [`AbstractSearch`](AbstractSearch.md) +▸ **sortAsc**(`field`): [`AbstractSearch`](AbstractSearch.md)<`T`\> Alias for [sortAscending](Search.md#sortascending). @@ -937,11 +943,11 @@ Alias for [sortAscending](Search.md#sortascending). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns -[`AbstractSearch`](AbstractSearch.md) +[`AbstractSearch`](AbstractSearch.md)<`T`\> #### Inherited from @@ -949,13 +955,13 @@ Alias for [sortAscending](Search.md#sortascending). #### Defined in -[lib/search/search.ts:86](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L86) +[lib/search/search.ts:92](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L92) ___ ### sortAscending -▸ **sortAscending**(`field`): [`AbstractSearch`](AbstractSearch.md) +▸ **sortAscending**(`field`): [`AbstractSearch`](AbstractSearch.md)<`T`\> Applies an ascending sort to the query. @@ -963,11 +969,11 @@ Applies an ascending sort to the query. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field to sort by. | +| `field` | `Exclude` | The field to sort by. | #### Returns -[`AbstractSearch`](AbstractSearch.md) +[`AbstractSearch`](AbstractSearch.md)<`T`\> this @@ -977,13 +983,13 @@ this #### Defined in -[lib/search/search.ts:63](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L63) +[lib/search/search.ts:69](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L69) ___ ### sortBy -▸ **sortBy**(`fieldName`, `order?`): [`AbstractSearch`](AbstractSearch.md) +▸ **sortBy**(`fieldName`, `order?`): [`AbstractSearch`](AbstractSearch.md)<`T`\> Applies sorting for the query. @@ -991,12 +997,12 @@ Applies sorting for the query. | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `fieldName` | `string` | `undefined` | - | -| `order` | ``"ASC"`` \| ``"DESC"`` | `'ASC'` | The order of returned [Entities](../README.md#entity) Defaults to `ASC` (ascending) if not specified | +| `fieldName` | `Exclude` | `undefined` | The field to sort by. | +| `order` | ``"ASC"`` \| ``"DESC"`` | `"ASC"` | The order of returned [Entities](../README.md#entity) Defaults to `ASC` (ascending) if not specified | #### Returns -[`AbstractSearch`](AbstractSearch.md) +[`AbstractSearch`](AbstractSearch.md)<`T`\> this @@ -1006,13 +1012,13 @@ this #### Defined in -[lib/search/search.ts:96](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L96) +[lib/search/search.ts:102](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L102) ___ ### sortDesc -▸ **sortDesc**(`field`): [`AbstractSearch`](AbstractSearch.md) +▸ **sortDesc**(`field`): [`AbstractSearch`](AbstractSearch.md)<`T`\> Alias for [sortDescending](Search.md#sortdescending). @@ -1020,11 +1026,11 @@ Alias for [sortDescending](Search.md#sortdescending). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns -[`AbstractSearch`](AbstractSearch.md) +[`AbstractSearch`](AbstractSearch.md)<`T`\> #### Inherited from @@ -1032,13 +1038,13 @@ Alias for [sortDescending](Search.md#sortdescending). #### Defined in -[lib/search/search.ts:70](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L70) +[lib/search/search.ts:76](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L76) ___ ### sortDescending -▸ **sortDescending**(`field`): [`AbstractSearch`](AbstractSearch.md) +▸ **sortDescending**(`field`): [`AbstractSearch`](AbstractSearch.md)<`T`\> Applies a descending sort to the query. @@ -1046,11 +1052,11 @@ Applies a descending sort to the query. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field to sort by. | +| `field` | `Exclude` | The field to sort by. | #### Returns -[`AbstractSearch`](AbstractSearch.md) +[`AbstractSearch`](AbstractSearch.md)<`T`\> this @@ -1060,4 +1066,4 @@ this #### Defined in -[lib/search/search.ts:79](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L79) +[lib/search/search.ts:85](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L85) diff --git a/docs/classes/Repository.md b/docs/classes/Repository.md index 86a92d1..6556032 100644 --- a/docs/classes/Repository.md +++ b/docs/classes/Repository.md @@ -1,6 +1,6 @@ [redis-om](../README.md) / Repository -# Class: Repository +# Class: Repository A repository is the main interaction point for reading, writing, and removing [Entities](../README.md#entity) from Redis. Create one by calling @@ -37,6 +37,12 @@ const entities = await repository.search() .and('aBoolean').is.false().returnAll() ``` +## Type parameters + +| Name | Type | +| :------ | :------ | +| `T` | extends [`Entity`](../README.md#entity) = `Record`<`string`, `any`\> | + ## Table of contents ### Constructors @@ -59,20 +65,26 @@ const entities = await repository.search() ### constructor -• **new Repository**(`schema`, `clientOrConnection`) +• **new Repository**<`T`\>(`schema`, `clientOrConnection`) Creates a new [Repository](Repository.md). +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `T` | extends [`Entity`](../README.md#entity) = `Record`<`string`, `any`\> | + #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `schema` | [`Schema`](Schema.md) | The schema defining that data in the repository. | -| `clientOrConnection` | [`Client`](Client.md) \| [`RedisConnection`](../README.md#redisconnection) | - | +| `schema` | [`Schema`](Schema.md)<`T`\> | The schema defining that data in the repository. | +| `clientOrConnection` | [`Client`](Client.md) \| [`RedisConnection`](../README.md#redisconnection) | A client to talk to Redis. | #### Defined in -[lib/repository/repository.ts:56](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L56) +[lib/repository/repository.ts:56](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/repository/repository.ts#L56) ## Methods @@ -90,7 +102,7 @@ RediSearch and RedisJSON are installed on your instance of Redis. #### Defined in -[lib/repository/repository.ts:71](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L71) +[lib/repository/repository.ts:71](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/repository/repository.ts#L71) ___ @@ -108,7 +120,7 @@ on your instance of Redis. #### Defined in -[lib/repository/repository.ts:109](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L109) +[lib/repository/repository.ts:109](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/repository/repository.ts#L109) ___ @@ -132,7 +144,7 @@ found, does nothing. #### Defined in -[lib/repository/repository.ts:242](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L242) +[lib/repository/repository.ts:242](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/repository/repository.ts#L242) ▸ **expire**(`ids`, `ttlInSeconds`): `Promise`<`void`\> @@ -144,7 +156,7 @@ ids. If a particular [Entity](../README.md#entity) is not found, does nothing. | Name | Type | Description | | :------ | :------ | :------ | | `ids` | `string`[] | The IDs of the [Entities](../README.md#entity) you wish to delete. | -| `ttlInSeconds` | `number` | - | +| `ttlInSeconds` | `number` | The time to live in seconds. | #### Returns @@ -152,7 +164,7 @@ ids. If a particular [Entity](../README.md#entity) is not found, does nothing. #### Defined in -[lib/repository/repository.ts:250](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L250) +[lib/repository/repository.ts:251](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/repository/repository.ts#L251) ___ @@ -176,7 +188,7 @@ is not found, does nothing. #### Defined in -[lib/repository/repository.ts:269](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L269) +[lib/repository/repository.ts:270](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/repository/repository.ts#L270) ▸ **expireAt**(`ids`, `expirationDate`): `Promise`<`void`\> @@ -196,13 +208,13 @@ ids. If a particular [Entity](../README.md#entity) is not found, does nothing. #### Defined in -[lib/repository/repository.ts:278](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L278) +[lib/repository/repository.ts:279](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/repository/repository.ts#L279) ___ ### fetch -▸ **fetch**(`id`): `Promise`<[`Entity`](../README.md#entity)\> +▸ **fetch**(`id`): `Promise`<`T`\> Read and return an [Entity](../README.md#entity) from Redis for the given id. If the [Entity](../README.md#entity) is not found, returns an empty [Entity](../README.md#entity). @@ -215,15 +227,15 @@ the [Entity](../README.md#entity) is not found, returns an empty [Entity](../REA #### Returns -`Promise`<[`Entity`](../README.md#entity)\> +`Promise`<`T`\> The matching Entity. #### Defined in -[lib/repository/repository.ts:171](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L171) +[lib/repository/repository.ts:171](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/repository/repository.ts#L171) -▸ **fetch**(`...ids`): `Promise`<[`Entity`](../README.md#entity)[]\> +▸ **fetch**(`...ids`): `Promise`<`T`[]\> Read and return the [Entities](../README.md#entity) from Redis with the given IDs. If a particular [Entity](../README.md#entity) is not found, returns that [Entity](../README.md#entity) as empty. @@ -236,15 +248,15 @@ a particular [Entity](../README.md#entity) is not found, returns that [Entity](. #### Returns -`Promise`<[`Entity`](../README.md#entity)[]\> +`Promise`<`T`[]\> The matching Entities. #### Defined in -[lib/repository/repository.ts:180](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L180) +[lib/repository/repository.ts:180](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/repository/repository.ts#L180) -▸ **fetch**(`ids`): `Promise`<[`Entity`](../README.md#entity)[]\> +▸ **fetch**(`ids`): `Promise`<`T`[]\> Read and return the [Entities](../README.md#entity) from Redis with the given IDs. If a particular [Entity](../README.md#entity) is not found, returns that [Entity](../README.md#entity) as empty. @@ -257,13 +269,13 @@ a particular [Entity](../README.md#entity) is not found, returns that [Entity](. #### Returns -`Promise`<[`Entity`](../README.md#entity)[]\> +`Promise`<`T`[]\> The matching Entities. #### Defined in -[lib/repository/repository.ts:189](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L189) +[lib/repository/repository.ts:189](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/repository/repository.ts#L189) ___ @@ -286,7 +298,7 @@ not found, does nothing. #### Defined in -[lib/repository/repository.ts:205](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L205) +[lib/repository/repository.ts:205](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/repository/repository.ts#L205) ▸ **remove**(`...ids`): `Promise`<`void`\> @@ -305,7 +317,7 @@ particular [Entity](../README.md#entity) is not found, does nothing. #### Defined in -[lib/repository/repository.ts:213](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L213) +[lib/repository/repository.ts:213](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/repository/repository.ts#L213) ▸ **remove**(`ids`): `Promise`<`void`\> @@ -324,13 +336,13 @@ particular [Entity](../README.md#entity) is not found, does nothing. #### Defined in -[lib/repository/repository.ts:221](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L221) +[lib/repository/repository.ts:221](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/repository/repository.ts#L221) ___ ### save -▸ **save**(`entity`): `Promise`<[`Entity`](../README.md#entity)\> +▸ **save**(`entity`): `Promise`<`T`\> Insert or update an [Entity](../README.md#entity) to Redis using its entityId property if present. If it's not, one is generated. @@ -339,19 +351,19 @@ if present. If it's not, one is generated. | Name | Type | Description | | :------ | :------ | :------ | -| `entity` | [`Entity`](../README.md#entity) | The Entity to save. | +| `entity` | `T` | The Entity to save. | #### Returns -`Promise`<[`Entity`](../README.md#entity)\> +`Promise`<`T`\> A copy of the provided Entity with EntityId and EntityKeyName properties added. #### Defined in -[lib/repository/repository.ts:134](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L134) +[lib/repository/repository.ts:134](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/repository/repository.ts#L134) -▸ **save**(`id`, `entity`): `Promise`<[`Entity`](../README.md#entity)\> +▸ **save**(`id`, `entity`): `Promise`<`T`\> Insert or update the [Entity](../README.md#entity) to Redis using the provided entityId. @@ -360,42 +372,42 @@ Insert or update the [Entity](../README.md#entity) to Redis using the provided e | Name | Type | Description | | :------ | :------ | :------ | | `id` | `string` | The id to save the Entity under. | -| `entity` | [`Entity`](../README.md#entity) | The Entity to save. | +| `entity` | `T` | The Entity to save. | #### Returns -`Promise`<[`Entity`](../README.md#entity)\> +`Promise`<`T`\> A copy of the provided Entity with EntityId and EntityKeyName properties added. #### Defined in -[lib/repository/repository.ts:143](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L143) +[lib/repository/repository.ts:143](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/repository/repository.ts#L143) ___ ### search -▸ **search**(): [`Search`](Search.md) +▸ **search**(): [`Search`](Search.md)<`T`\> Kicks off the process of building a query. Requires that RediSearch (and optionally RedisJSON) be installed on your instance of Redis. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> A [Search](Search.md) object. #### Defined in -[lib/repository/repository.ts:301](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L301) +[lib/repository/repository.ts:302](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/repository/repository.ts#L302) ___ ### searchRaw -▸ **searchRaw**(`query`): [`RawSearch`](RawSearch.md) +▸ **searchRaw**(`query`): [`RawSearch`](RawSearch.md)<`T`\> Creates a search that bypasses Redis OM and instead allows you to execute a raw RediSearch query. Requires that RediSearch (and optionally RedisJSON) be installed @@ -416,10 +428,10 @@ The raw RediSearch query you want to rune. #### Returns -[`RawSearch`](RawSearch.md) +[`RawSearch`](RawSearch.md)<`T`\> A [RawSearch](RawSearch.md) object. #### Defined in -[lib/repository/repository.ts:316](https://github.com/redis/redis-om-node/blob/d8438f7/lib/repository/repository.ts#L316) +[lib/repository/repository.ts:317](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/repository/repository.ts#L317) diff --git a/docs/classes/Schema.md b/docs/classes/Schema.md index d2dff0c..28fe8cb 100644 --- a/docs/classes/Schema.md +++ b/docs/classes/Schema.md @@ -1,13 +1,23 @@ [redis-om](../README.md) / Schema -# Class: Schema +# Class: Schema Defines a schema that determines how an [Entity](../README.md#entity) is mapped to Redis data structures. Construct by passing in a schema name, a [SchemaDefinition](../README.md#schemadefinition), and optionally [SchemaOptions](../README.md#schemaoptions): ```typescript -const schema = new Schema('foo', { +interface Foo extends Entity { + aString: string, + aNumber: number, + aBoolean: boolean, + someText: string, + aPoint: Point, + aDate: Date, + someStrings: string[], +} + +const schema = new Schema('foo', { aString: { type: 'string' }, aNumber: { type: 'number' }, aBoolean: { type: 'boolean' }, @@ -23,6 +33,12 @@ const schema = new Schema('foo', { A Schema is primarily used by a [Repository](Repository.md) which requires a Schema in its constructor. +## Type parameters + +| Name | Type | +| :------ | :------ | +| `T` | extends [`Entity`](../README.md#entity) = `Record`<`string`, `any`\> | + ## Table of contents ### Constructors @@ -49,21 +65,27 @@ its constructor. ### constructor -• **new Schema**(`schemaName`, `schemaDef`, `options?`) +• **new Schema**<`T`\>(`schemaName`, `schemaDef`, `options?`) Constructs a Schema. +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `T` | extends [`Entity`](../README.md#entity) = `Record`<`string`, `any`\> | + #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `schemaName` | `string` | The name of the schema. Prefixes the ID when creating Redis keys. | -| `schemaDef` | [`SchemaDefinition`](../README.md#schemadefinition) | Defines all of the fields for the Schema and how they are mapped to Redis. | +| `schemaDef` | [`SchemaDefinition`](../README.md#schemadefinition)<`T`\> | 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:49](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/schema.ts#L49) +[lib/schema/schema.ts:59](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/schema.ts#L59) ## Accessors @@ -80,7 +102,7 @@ that this Schema uses to store [Entities](../README.md#entity) in Redis. #### Defined in -[lib/schema/schema.ts:92](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/schema.ts#L92) +[lib/schema/schema.ts:102](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/schema.ts#L102) ___ @@ -96,7 +118,7 @@ The [Fields](Field.md) defined by this Schema. #### Defined in -[lib/schema/schema.ts:68](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/schema.ts#L68) +[lib/schema/schema.ts:78](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/schema.ts#L78) ___ @@ -113,7 +135,7 @@ changed when calling [createIndex](Repository.md#createindex). #### Defined in -[lib/schema/schema.ts:120](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/schema.ts#L120) +[lib/schema/schema.ts:130](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/schema.ts#L130) ___ @@ -129,7 +151,7 @@ The configured name for the RediSearch index hash for this Schema. #### Defined in -[lib/schema/schema.ts:86](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/schema.ts#L86) +[lib/schema/schema.ts:96](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/schema.ts#L96) ___ @@ -145,7 +167,7 @@ The configured name for the RediSearch index for this Schema. #### Defined in -[lib/schema/schema.ts:83](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/schema.ts#L83) +[lib/schema/schema.ts:93](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/schema.ts#L93) ___ @@ -163,7 +185,7 @@ idStrategy returns `12345` then the generated key would be `foo:12345`. #### Defined in -[lib/schema/schema.ts:63](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/schema.ts#L63) +[lib/schema/schema.ts:73](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/schema.ts#L73) ___ @@ -180,7 +202,7 @@ than `CUSTOM`. #### Defined in -[lib/schema/schema.ts:104](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/schema.ts#L104) +[lib/schema/schema.ts:114](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/schema.ts#L114) ___ @@ -197,7 +219,7 @@ or `CUSTOM`. See [SchemaOptions](../README.md#schemaoptions) for more details. #### Defined in -[lib/schema/schema.ts:98](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/schema.ts#L98) +[lib/schema/schema.ts:108](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/schema.ts#L108) ## Methods @@ -211,7 +233,7 @@ Gets a single [Field](Field.md) defined by this Schema. | Name | Type | Description | | :------ | :------ | :------ | -| `name` | `string` | The name of the [Field](Field.md) in this Schema. | +| `name` | `Exclude` | The name of the [Field](Field.md) in this Schema. | #### Returns @@ -221,7 +243,7 @@ The [Field](Field.md), or null of not found. #### Defined in -[lib/schema/schema.ts:78](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/schema.ts#L78) +[lib/schema/schema.ts:88](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/schema.ts#L88) ___ @@ -239,4 +261,4 @@ The generated id. #### Defined in -[lib/schema/schema.ts:111](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/schema.ts#L111) +[lib/schema/schema.ts:121](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/schema/schema.ts#L121) diff --git a/docs/classes/Search.md b/docs/classes/Search.md index e992187..9459ee3 100644 --- a/docs/classes/Search.md +++ b/docs/classes/Search.md @@ -1,6 +1,6 @@ [redis-om](../README.md) / Search -# Class: Search +# Class: Search Entry point to fluent search. This is the default Redis OM experience. Requires that RediSearch (and optionally RedisJSON) be installed. @@ -9,9 +9,15 @@ Requires that RediSearch (and optionally RedisJSON) be installed. The type of [Entity](../README.md#entity) being sought. +## Type parameters + +| Name | Type | +| :------ | :------ | +| `T` | extends [`Entity`](../README.md#entity) = `Record`<`string`, `any`\> | + ## Hierarchy -- [`AbstractSearch`](AbstractSearch.md) +- [`AbstractSearch`](AbstractSearch.md)<`T`\> ↳ **`Search`** @@ -68,13 +74,13 @@ The type of [Entity](../README.md#entity) being sought. ### return -• `get` **return**(): [`AbstractSearch`](AbstractSearch.md) +• `get` **return**(): [`AbstractSearch`](AbstractSearch.md)<`T`\> Returns the current instance. Syntactic sugar to make your code more fluent. #### Returns -[`AbstractSearch`](AbstractSearch.md) +[`AbstractSearch`](AbstractSearch.md)<`T`\> this @@ -84,13 +90,13 @@ AbstractSearch.return #### Defined in -[lib/search/search.ts:308](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L308) +[lib/search/search.ts:329](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L329) ## Methods ### all -▸ **all**(`options?`): `Promise`<[`Entity`](../README.md#entity)[]\> +▸ **all**(`options?`): `Promise`<`T`[]\> Returns all the [Entities](../README.md#entity) that match this query. This method makes multiple calls to Redis until all the [Entities](../README.md#entity) are returned. @@ -110,7 +116,7 @@ const entities = await repository.search().returnAll({ pageSize: 100 }) #### Returns -`Promise`<[`Entity`](../README.md#entity)[]\> +`Promise`<`T`[]\> An array of [Entities](../README.md#entity) matching the query. @@ -120,7 +126,7 @@ An array of [Entities](../README.md#entity) matching the query. #### Defined in -[lib/search/search.ts:264](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L264) +[lib/search/search.ts:285](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L285) ___ @@ -156,7 +162,7 @@ An array of entity IDs matching the query. #### Defined in -[lib/search/search.ts:282](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L282) +[lib/search/search.ts:303](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L303) ___ @@ -192,13 +198,13 @@ An array of key names matching the query. #### Defined in -[lib/search/search.ts:300](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L300) +[lib/search/search.ts:321](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L321) ___ ### and -▸ **and**(`field`): [`WhereField`](WhereField.md) +▸ **and**(`field`): [`WhereField`](WhereField.md)<`T`\> Sets up a query matching a particular field as a logical AND. @@ -206,19 +212,19 @@ Sets up a query matching a particular field as a logical AND. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field to filter on. | +| `field` | `Exclude` | The field to filter on. | #### Returns -[`WhereField`](WhereField.md) +[`WhereField`](WhereField.md)<`T`\> A subclass of [WhereField](WhereField.md) matching the type of the field. #### Defined in -[lib/search/search.ts:530](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L530) +[lib/search/search.ts:566](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L566) -▸ **and**(`subSearchFn`): [`Search`](Search.md) +▸ **and**(`subSearchFn`): [`Search`](Search.md)<`T`\> Sets up a nested search as a logical AND. @@ -226,17 +232,17 @@ Sets up a nested search as a logical AND. | Name | Type | Description | | :------ | :------ | :------ | -| `subSearchFn` | [`SubSearchFunction`](../README.md#subsearchfunction) | A function that takes a [Search](Search.md) and returns another [Search](Search.md). | +| `subSearchFn` | [`SubSearchFunction`](../README.md#subsearchfunction)<`T`\> | A function that takes a [Search](Search.md) and returns another [Search](Search.md). | #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> `this`. #### Defined in -[lib/search/search.ts:537](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L537) +[lib/search/search.ts:573](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L573) ___ @@ -256,19 +262,19 @@ Returns the number of [Entities](../README.md#entity) that match this query. #### Defined in -[lib/search/search.ts:188](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L188) +[lib/search/search.ts:209](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L209) ___ ### first -▸ **first**(): `Promise`<``null`` \| [`Entity`](../README.md#entity)\> +▸ **first**(): `Promise`<``null`` \| `T`\> Returns the first [Entity](../README.md#entity) that matches this query. #### Returns -`Promise`<``null`` \| [`Entity`](../README.md#entity)\> +`Promise`<``null`` \| `T`\> #### Inherited from @@ -276,7 +282,7 @@ Returns the first [Entity](../README.md#entity) that matches this query. #### Defined in -[lib/search/search.ts:229](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L229) +[lib/search/search.ts:250](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L250) ___ @@ -296,7 +302,7 @@ Returns the first entity ID that matches this query. #### Defined in -[lib/search/search.ts:237](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L237) +[lib/search/search.ts:258](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L258) ___ @@ -304,7 +310,7 @@ ___ ▸ **firstKey**(): `Promise`<``null`` \| `string`\> -Returns the first key name that matches this query. +Returns the first key name that matches this query. #### Returns @@ -316,13 +322,13 @@ Returns the first key name that matches this query. #### Defined in -[lib/search/search.ts:245](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L245) +[lib/search/search.ts:266](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L266) ___ ### max -▸ **max**(`field`): `Promise`<``null`` \| [`Entity`](../README.md#entity)\> +▸ **max**(`field`): `Promise`<``null`` \| `T`\> Finds the [Entity](../README.md#entity) with the maximal value for a field. @@ -330,11 +336,11 @@ Finds the [Entity](../README.md#entity) with the maximal value for a field. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field with the maximal value. | +| `field` | `Exclude` | The field with the maximal value. | #### Returns -`Promise`<``null`` \| [`Entity`](../README.md#entity)\> +`Promise`<``null`` \| `T`\> The entity ID [Entity](../README.md#entity) with the maximal value @@ -344,7 +350,7 @@ The entity ID [Entity](../README.md#entity) with the maximal value #### Defined in -[lib/search/search.ts:162](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L162) +[lib/search/search.ts:183](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L183) ___ @@ -358,7 +364,7 @@ Finds the entity ID with the maximal value for a field. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field with the maximal value. | +| `field` | `Exclude` | The field with the maximal value. | #### Returns @@ -372,7 +378,7 @@ The entity ID with the maximal value #### Defined in -[lib/search/search.ts:171](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L171) +[lib/search/search.ts:192](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L192) ___ @@ -386,7 +392,7 @@ Finds the key name in Redis with the maximal value for a field. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field with the maximal value. | +| `field` | `Exclude` | The field with the maximal value. | #### Returns @@ -400,13 +406,13 @@ The key name with the maximal value #### Defined in -[lib/search/search.ts:180](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L180) +[lib/search/search.ts:201](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L201) ___ ### min -▸ **min**(`field`): `Promise`<``null`` \| [`Entity`](../README.md#entity)\> +▸ **min**(`field`): `Promise`<``null`` \| `T`\> Finds the [Entity](../README.md#entity) with the minimal value for a field. @@ -414,11 +420,11 @@ Finds the [Entity](../README.md#entity) with the minimal value for a field. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field with the minimal value. | +| `field` | `Exclude` | The field with the minimal value. | #### Returns -`Promise`<``null`` \| [`Entity`](../README.md#entity)\> +`Promise`<``null`` \| `T`\> The [Entity](../README.md#entity) with the minimal value @@ -428,7 +434,7 @@ The [Entity](../README.md#entity) with the minimal value #### Defined in -[lib/search/search.ts:135](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L135) +[lib/search/search.ts:156](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L156) ___ @@ -442,7 +448,7 @@ Finds the entity ID with the minimal value for a field. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field with the minimal value. | +| `field` | `Exclude` | The field with the minimal value. | #### Returns @@ -456,7 +462,7 @@ The entity ID with the minimal value #### Defined in -[lib/search/search.ts:144](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L144) +[lib/search/search.ts:165](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L165) ___ @@ -470,7 +476,7 @@ Finds the key name in Redis with the minimal value for a field. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field with the minimal value. | +| `field` | `Exclude` | The field with the minimal value. | #### Returns @@ -484,13 +490,13 @@ The key name with the minimal value #### Defined in -[lib/search/search.ts:153](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L153) +[lib/search/search.ts:174](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L174) ___ ### or -▸ **or**(`field`): [`WhereField`](WhereField.md) +▸ **or**(`field`): [`WhereField`](WhereField.md)<`T`\> Sets up a query matching a particular field as a logical OR. @@ -498,19 +504,19 @@ Sets up a query matching a particular field as a logical OR. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field to filter on. | +| `field` | `Exclude` | The field to filter on. | #### Returns -[`WhereField`](WhereField.md) +[`WhereField`](WhereField.md)<`T`\> A subclass of [WhereField](WhereField.md) matching the type of the field. #### Defined in -[lib/search/search.ts:547](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L547) +[lib/search/search.ts:585](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L585) -▸ **or**(`subSearchFn`): [`Search`](Search.md) +▸ **or**(`subSearchFn`): [`Search`](Search.md)<`T`\> Sets up a nested search as a logical OR. @@ -518,23 +524,23 @@ Sets up a nested search as a logical OR. | Name | Type | Description | | :------ | :------ | :------ | -| `subSearchFn` | [`SubSearchFunction`](../README.md#subsearchfunction) | A function that takes a [Search](Search.md) and returns another [Search](Search.md). | +| `subSearchFn` | [`SubSearchFunction`](../README.md#subsearchfunction)<`T`\> | A function that takes a [Search](Search.md) and returns another [Search](Search.md). | #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> `this`. #### Defined in -[lib/search/search.ts:554](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L554) +[lib/search/search.ts:592](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L592) ___ ### page -▸ **page**(`offset`, `count`): `Promise`<[`Entity`](../README.md#entity)[]\> +▸ **page**(`offset`, `count`): `Promise`<`T`[]\> Returns a page of [Entities](../README.md#entity) that match this query. @@ -547,7 +553,7 @@ Returns a page of [Entities](../README.md#entity) that match this query. #### Returns -`Promise`<[`Entity`](../README.md#entity)[]\> +`Promise`<`T`[]\> An array of [Entities](../README.md#entity) matching the query. @@ -557,7 +563,7 @@ An array of [Entities](../README.md#entity) matching the query. #### Defined in -[lib/search/search.ts:199](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L199) +[lib/search/search.ts:220](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L220) ___ @@ -586,7 +592,7 @@ An array of strings matching the query. #### Defined in -[lib/search/search.ts:210](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L210) +[lib/search/search.ts:231](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L231) ___ @@ -615,13 +621,13 @@ An array of strings matching the query. #### Defined in -[lib/search/search.ts:221](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L221) +[lib/search/search.ts:242](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L242) ___ ### returnAll -▸ **returnAll**(`options?`): `Promise`<[`Entity`](../README.md#entity)[]\> +▸ **returnAll**(`options?`): `Promise`<`T`[]\> Alias for [all](Search.md#all). @@ -634,7 +640,7 @@ Alias for [all](Search.md#all). #### Returns -`Promise`<[`Entity`](../README.md#entity)[]\> +`Promise`<`T`[]\> #### Inherited from @@ -642,7 +648,7 @@ Alias for [all](Search.md#all). #### Defined in -[lib/search/search.ts:406](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L406) +[lib/search/search.ts:427](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L427) ___ @@ -669,7 +675,7 @@ Alias for [allIds](Search.md#allids). #### Defined in -[lib/search/search.ts:413](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L413) +[lib/search/search.ts:434](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L434) ___ @@ -696,7 +702,7 @@ Alias for [allKeys](Search.md#allkeys). #### Defined in -[lib/search/search.ts:420](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L420) +[lib/search/search.ts:441](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L441) ___ @@ -716,19 +722,19 @@ Alias for [count](Search.md#count). #### Defined in -[lib/search/search.ts:357](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L357) +[lib/search/search.ts:378](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L378) ___ ### returnFirst -▸ **returnFirst**(): `Promise`<``null`` \| [`Entity`](../README.md#entity)\> +▸ **returnFirst**(): `Promise`<``null`` \| `T`\> Alias for [first](Search.md#first). #### Returns -`Promise`<``null`` \| [`Entity`](../README.md#entity)\> +`Promise`<``null`` \| `T`\> #### Inherited from @@ -736,7 +742,7 @@ Alias for [first](Search.md#first). #### Defined in -[lib/search/search.ts:385](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L385) +[lib/search/search.ts:406](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L406) ___ @@ -756,7 +762,7 @@ Alias for [firstId](Search.md#firstid). #### Defined in -[lib/search/search.ts:392](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L392) +[lib/search/search.ts:413](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L413) ___ @@ -776,13 +782,13 @@ Alias for [firstKey](Search.md#firstkey). #### Defined in -[lib/search/search.ts:399](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L399) +[lib/search/search.ts:420](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L420) ___ ### returnMax -▸ **returnMax**(`field`): `Promise`<``null`` \| [`Entity`](../README.md#entity)\> +▸ **returnMax**(`field`): `Promise`<``null`` \| `T`\> Alias for [max](Search.md#max). @@ -790,11 +796,11 @@ Alias for [max](Search.md#max). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns -`Promise`<``null`` \| [`Entity`](../README.md#entity)\> +`Promise`<``null`` \| `T`\> #### Inherited from @@ -802,7 +808,7 @@ Alias for [max](Search.md#max). #### Defined in -[lib/search/search.ts:336](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L336) +[lib/search/search.ts:357](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L357) ___ @@ -816,7 +822,7 @@ Alias for [maxId](Search.md#maxid). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns @@ -828,7 +834,7 @@ Alias for [maxId](Search.md#maxid). #### Defined in -[lib/search/search.ts:343](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L343) +[lib/search/search.ts:364](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L364) ___ @@ -842,7 +848,7 @@ Alias for [maxKey](Search.md#maxkey). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns @@ -854,13 +860,13 @@ Alias for [maxKey](Search.md#maxkey). #### Defined in -[lib/search/search.ts:350](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L350) +[lib/search/search.ts:371](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L371) ___ ### returnMin -▸ **returnMin**(`field`): `Promise`<``null`` \| [`Entity`](../README.md#entity)\> +▸ **returnMin**(`field`): `Promise`<``null`` \| `T`\> Alias for [min](Search.md#min). @@ -868,11 +874,11 @@ Alias for [min](Search.md#min). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns -`Promise`<``null`` \| [`Entity`](../README.md#entity)\> +`Promise`<``null`` \| `T`\> #### Inherited from @@ -880,7 +886,7 @@ Alias for [min](Search.md#min). #### Defined in -[lib/search/search.ts:315](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L315) +[lib/search/search.ts:336](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L336) ___ @@ -894,7 +900,7 @@ Alias for [minId](Search.md#minid). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns @@ -906,7 +912,7 @@ Alias for [minId](Search.md#minid). #### Defined in -[lib/search/search.ts:322](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L322) +[lib/search/search.ts:343](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L343) ___ @@ -920,7 +926,7 @@ Alias for [minKey](Search.md#minkey). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns @@ -932,13 +938,13 @@ Alias for [minKey](Search.md#minkey). #### Defined in -[lib/search/search.ts:329](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L329) +[lib/search/search.ts:350](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L350) ___ ### returnPage -▸ **returnPage**(`offset`, `count`): `Promise`<[`Entity`](../README.md#entity)[]\> +▸ **returnPage**(`offset`, `count`): `Promise`<`T`[]\> Alias for [page](Search.md#page). @@ -951,7 +957,7 @@ Alias for [page](Search.md#page). #### Returns -`Promise`<[`Entity`](../README.md#entity)[]\> +`Promise`<`T`[]\> #### Inherited from @@ -959,7 +965,7 @@ Alias for [page](Search.md#page). #### Defined in -[lib/search/search.ts:364](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L364) +[lib/search/search.ts:385](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L385) ___ @@ -986,7 +992,7 @@ Alias for [pageOfIds](Search.md#pageofids). #### Defined in -[lib/search/search.ts:371](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L371) +[lib/search/search.ts:392](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L392) ___ @@ -1013,13 +1019,13 @@ Alias for [pageOfKeys](Search.md#pageofkeys). #### Defined in -[lib/search/search.ts:378](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L378) +[lib/search/search.ts:399](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L399) ___ ### sortAsc -▸ **sortAsc**(`field`): [`AbstractSearch`](AbstractSearch.md) +▸ **sortAsc**(`field`): [`AbstractSearch`](AbstractSearch.md)<`T`\> Alias for [sortAscending](Search.md#sortascending). @@ -1027,11 +1033,11 @@ Alias for [sortAscending](Search.md#sortascending). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns -[`AbstractSearch`](AbstractSearch.md) +[`AbstractSearch`](AbstractSearch.md)<`T`\> #### Inherited from @@ -1039,13 +1045,13 @@ Alias for [sortAscending](Search.md#sortascending). #### Defined in -[lib/search/search.ts:86](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L86) +[lib/search/search.ts:92](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L92) ___ ### sortAscending -▸ **sortAscending**(`field`): [`AbstractSearch`](AbstractSearch.md) +▸ **sortAscending**(`field`): [`AbstractSearch`](AbstractSearch.md)<`T`\> Applies an ascending sort to the query. @@ -1053,11 +1059,11 @@ Applies an ascending sort to the query. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field to sort by. | +| `field` | `Exclude` | The field to sort by. | #### Returns -[`AbstractSearch`](AbstractSearch.md) +[`AbstractSearch`](AbstractSearch.md)<`T`\> this @@ -1067,13 +1073,13 @@ this #### Defined in -[lib/search/search.ts:63](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L63) +[lib/search/search.ts:69](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L69) ___ ### sortBy -▸ **sortBy**(`fieldName`, `order?`): [`AbstractSearch`](AbstractSearch.md) +▸ **sortBy**(`fieldName`, `order?`): [`AbstractSearch`](AbstractSearch.md)<`T`\> Applies sorting for the query. @@ -1081,12 +1087,12 @@ Applies sorting for the query. | Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | -| `fieldName` | `string` | `undefined` | - | -| `order` | ``"ASC"`` \| ``"DESC"`` | `'ASC'` | The order of returned [Entities](../README.md#entity) Defaults to `ASC` (ascending) if not specified | +| `fieldName` | `Exclude` | `undefined` | The field to sort by. | +| `order` | ``"ASC"`` \| ``"DESC"`` | `"ASC"` | The order of returned [Entities](../README.md#entity) Defaults to `ASC` (ascending) if not specified | #### Returns -[`AbstractSearch`](AbstractSearch.md) +[`AbstractSearch`](AbstractSearch.md)<`T`\> this @@ -1096,13 +1102,13 @@ this #### Defined in -[lib/search/search.ts:96](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L96) +[lib/search/search.ts:102](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L102) ___ ### sortDesc -▸ **sortDesc**(`field`): [`AbstractSearch`](AbstractSearch.md) +▸ **sortDesc**(`field`): [`AbstractSearch`](AbstractSearch.md)<`T`\> Alias for [sortDescending](Search.md#sortdescending). @@ -1110,11 +1116,11 @@ Alias for [sortDescending](Search.md#sortdescending). | Name | Type | | :------ | :------ | -| `field` | `string` | +| `field` | `Exclude` | #### Returns -[`AbstractSearch`](AbstractSearch.md) +[`AbstractSearch`](AbstractSearch.md)<`T`\> #### Inherited from @@ -1122,13 +1128,13 @@ Alias for [sortDescending](Search.md#sortdescending). #### Defined in -[lib/search/search.ts:70](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L70) +[lib/search/search.ts:76](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L76) ___ ### sortDescending -▸ **sortDescending**(`field`): [`AbstractSearch`](AbstractSearch.md) +▸ **sortDescending**(`field`): [`AbstractSearch`](AbstractSearch.md)<`T`\> Applies a descending sort to the query. @@ -1136,11 +1142,11 @@ Applies a descending sort to the query. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field to sort by. | +| `field` | `Exclude` | The field to sort by. | #### Returns -[`AbstractSearch`](AbstractSearch.md) +[`AbstractSearch`](AbstractSearch.md)<`T`\> this @@ -1150,13 +1156,13 @@ this #### Defined in -[lib/search/search.ts:79](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L79) +[lib/search/search.ts:85](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L85) ___ ### where -▸ **where**(`field`): [`WhereField`](WhereField.md) +▸ **where**(`field`): [`WhereField`](WhereField.md)<`T`\> Sets up a query matching a particular field. If there are multiple calls to [where](Search.md#where), they are treated logically as AND. @@ -1165,19 +1171,19 @@ to [where](Search.md#where), they are treated logically as AND. | Name | Type | Description | | :------ | :------ | :------ | -| `field` | `string` | The field to filter on. | +| `field` | `Exclude` | The field to filter on. | #### Returns -[`WhereField`](WhereField.md) +[`WhereField`](WhereField.md)<`T`\> A subclass of [WhereField](WhereField.md) matching the type of the field. #### Defined in -[lib/search/search.ts:512](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L512) +[lib/search/search.ts:546](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L546) -▸ **where**(`subSearchFn`): [`Search`](Search.md) +▸ **where**(`subSearchFn`): [`Search`](Search.md)<`T`\> Sets up a nested search. If there are multiple calls to [where](Search.md#where), they are treated logically as AND. @@ -1186,14 +1192,14 @@ they are treated logically as AND. | Name | Type | Description | | :------ | :------ | :------ | -| `subSearchFn` | [`SubSearchFunction`](../README.md#subsearchfunction) | A function that takes a [Search](Search.md) and returns another [Search](Search.md). | +| `subSearchFn` | [`SubSearchFunction`](../README.md#subsearchfunction)<`T`\> | A function that takes a [Search](Search.md) and returns another [Search](Search.md). | #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> `this`. #### Defined in -[lib/search/search.ts:520](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L520) +[lib/search/search.ts:554](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/search.ts#L554) diff --git a/docs/classes/Where.md b/docs/classes/Where.md index 8cd06b0..ebea83e 100644 --- a/docs/classes/Where.md +++ b/docs/classes/Where.md @@ -40,4 +40,4 @@ Converts this [Where](Where.md) into a portion of a RediSearch query. #### Defined in -[lib/search/where.ts:8](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where.ts#L8) +[lib/search/where.ts:8](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where.ts#L8) diff --git a/docs/classes/WhereField.md b/docs/classes/WhereField.md index d2d39e3..86fed4f 100644 --- a/docs/classes/WhereField.md +++ b/docs/classes/WhereField.md @@ -1,11 +1,17 @@ [redis-om](../README.md) / WhereField -# Class: WhereField +# Class: WhereField Abstract base class that all fields you want to filter with extend. When you call [where](Search.md#where), a subclass of this is returned. +## Type parameters + +| Name | Type | +| :------ | :------ | +| `T` | extends [`Entity`](../README.md#entity) = `Record`<`string`, `any`\> | + ## Hierarchy - [`Where`](Where.md) @@ -64,27 +70,27 @@ subclass of this is returned. ### exact -• `Readonly` **exact**: [`WhereField`](WhereField.md) +• `Readonly` **exact**: [`WhereField`](WhereField.md)<`T`\> Makes a call to [match](WhereField.md#match) a [matchExact](WhereField.md#matchexact) call. Calling this multiple times will have no effect. #### Defined in -[lib/search/where-field.ts:96](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L96) +[lib/search/where-field.ts:99](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L99) ___ ### exactly -• `Readonly` **exactly**: [`WhereField`](WhereField.md) +• `Readonly` **exactly**: [`WhereField`](WhereField.md)<`T`\> Makes a call to [match](WhereField.md#match) a [matchExact](WhereField.md#matchexact) call. Calling this multiple times will have no effect. #### Defined in -[lib/search/where-field.ts:103](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L103) +[lib/search/where-field.ts:106](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L106) ## Accessors @@ -102,7 +108,7 @@ this #### Defined in -[lib/search/where-field.ts:293](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L293) +[lib/search/where-field.ts:296](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L296) ___ @@ -120,7 +126,7 @@ this #### Defined in -[lib/search/where-field.ts:285](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L285) +[lib/search/where-field.ts:288](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L288) ___ @@ -139,13 +145,13 @@ this #### Defined in -[lib/search/where-field.ts:302](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L302) +[lib/search/where-field.ts:305](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L305) ## Methods ### after -▸ **after**(`value`): [`Search`](Search.md) +▸ **after**(`value`): [`Search`](Search.md)<`T`\> Add a search that matches all datetimes *after* the provided UTC datetime to the query. @@ -157,19 +163,19 @@ Add a search that matches all datetimes *after* the provided UTC datetime to the #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:244](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L244) +[lib/search/where-field.ts:247](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L247) ___ ### before -▸ **before**(`value`): [`Search`](Search.md) +▸ **before**(`value`): [`Search`](Search.md)<`T`\> Add a search that matches all datetimes *before* the provided UTC datetime to the query. @@ -181,19 +187,19 @@ Add a search that matches all datetimes *before* the provided UTC datetime to th #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:237](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L237) +[lib/search/where-field.ts:240](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L240) ___ ### between -▸ **between**(`lower`, `upper`): [`Search`](Search.md) +▸ **between**(`lower`, `upper`): [`Search`](Search.md)<`T`\> Adds an inclusive range comparison against a field to the search query. @@ -206,19 +212,19 @@ Adds an inclusive range comparison against a field to the search query. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:179](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L179) +[lib/search/where-field.ts:182](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L182) ___ ### contain -▸ **contain**(`value`): [`Search`](Search.md) +▸ **contain**(`value`): [`Search`](Search.md)<`T`\> Adds a whole-string match for a value within a string array to the search query. @@ -230,19 +236,19 @@ Adds a whole-string match for a value within a string array to the search query. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:186](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L186) +[lib/search/where-field.ts:189](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L189) ___ ### containOneOf -▸ **containOneOf**(`...value`): [`Search`](Search.md) +▸ **containOneOf**(`...value`): [`Search`](Search.md)<`T`\> 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. @@ -255,19 +261,19 @@ strings in `value` is matched in the array, this matched. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:201](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L201) +[lib/search/where-field.ts:204](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L204) ___ ### contains -▸ **contains**(`value`): [`Search`](Search.md) +▸ **contains**(`value`): [`Search`](Search.md)<`T`\> Adds a whole-string match for a value within a string array to the search query. @@ -279,19 +285,19 @@ Adds a whole-string match for a value within a string array to the search query. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:193](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L193) +[lib/search/where-field.ts:196](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L196) ___ ### containsOneOf -▸ **containsOneOf**(`...value`): [`Search`](Search.md) +▸ **containsOneOf**(`...value`): [`Search`](Search.md)<`T`\> 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. @@ -304,19 +310,19 @@ strings in `value` is matched in the array, this matched. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:209](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L209) +[lib/search/where-field.ts:212](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L212) ___ ### eq -▸ **eq**(`value`): [`Search`](Search.md) +▸ **eq**(`value`): [`Search`](Search.md)<`T`\> Adds an equals comparison to the query. @@ -331,19 +337,19 @@ search is enabled. In that scenario, use `.match`. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> 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/d8438f7/lib/search/where-field.ts#L20) +[lib/search/where-field.ts:21](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L21) ___ ### equal -▸ **equal**(`value`): [`Search`](Search.md) +▸ **equal**(`value`): [`Search`](Search.md)<`T`\> Adds an equals comparison to the query. @@ -358,19 +364,19 @@ search is enabled. In that scenario, use `.match`. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> 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/d8438f7/lib/search/where-field.ts#L30) +[lib/search/where-field.ts:31](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L31) ___ ### equalTo -▸ **equalTo**(`value`): [`Search`](Search.md) +▸ **equalTo**(`value`): [`Search`](Search.md)<`T`\> Adds an equals comparison to the query. @@ -385,19 +391,19 @@ search is enabled. In that scenario, use `.match`. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> 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/d8438f7/lib/search/where-field.ts#L50) +[lib/search/where-field.ts:51](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L51) ___ ### equals -▸ **equals**(`value`): [`Search`](Search.md) +▸ **equals**(`value`): [`Search`](Search.md)<`T`\> Adds an equals comparison to the query. @@ -412,37 +418,37 @@ search is enabled. In that scenario, use `.match`. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> 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/d8438f7/lib/search/where-field.ts#L40) +[lib/search/where-field.ts:41](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L41) ___ ### false -▸ **false**(): [`Search`](Search.md) +▸ **false**(): [`Search`](Search.md)<`T`\> Adds a boolean match with a value of `false` to the query. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:115](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L115) +[lib/search/where-field.ts:118](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L118) ___ ### greaterThan -▸ **greaterThan**(`value`): [`Search`](Search.md) +▸ **greaterThan**(`value`): [`Search`](Search.md)<`T`\> Adds a greater than comparison against a field to the search query. @@ -454,19 +460,19 @@ Adds a greater than comparison against a field to the search query. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:129](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L129) +[lib/search/where-field.ts:132](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L132) ___ ### greaterThanOrEqualTo -▸ **greaterThanOrEqualTo**(`value`): [`Search`](Search.md) +▸ **greaterThanOrEqualTo**(`value`): [`Search`](Search.md)<`T`\> Adds a greater than or equal to comparison against a field to the search query. @@ -478,19 +484,19 @@ Adds a greater than or equal to comparison against a field to the search query. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:143](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L143) +[lib/search/where-field.ts:146](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L146) ___ ### gt -▸ **gt**(`value`): [`Search`](Search.md) +▸ **gt**(`value`): [`Search`](Search.md)<`T`\> Adds a greater than comparison against a field to the search query. @@ -502,19 +508,19 @@ Adds a greater than comparison against a field to the search query. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:122](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L122) +[lib/search/where-field.ts:125](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L125) ___ ### gte -▸ **gte**(`value`): [`Search`](Search.md) +▸ **gte**(`value`): [`Search`](Search.md)<`T`\> Adds a greater than or equal to comparison against a field to the search query. @@ -526,19 +532,19 @@ Adds a greater than or equal to comparison against a field to the search query. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:136](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L136) +[lib/search/where-field.ts:139](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L139) ___ ### inCircle -▸ **inCircle**(`circleFn`): [`Search`](Search.md) +▸ **inCircle**(`circleFn`): [`Search`](Search.md)<`T`\> Adds a search for points that fall within a defined circle. @@ -550,19 +556,19 @@ Adds a search for points that fall within a defined circle. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:216](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L216) +[lib/search/where-field.ts:219](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L219) ___ ### inRadius -▸ **inRadius**(`circleFn`): [`Search`](Search.md) +▸ **inRadius**(`circleFn`): [`Search`](Search.md)<`T`\> Adds a search for points that fall within a defined radius. @@ -574,19 +580,19 @@ Adds a search for points that fall within a defined radius. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:223](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L223) +[lib/search/where-field.ts:226](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L226) ___ ### lessThan -▸ **lessThan**(`value`): [`Search`](Search.md) +▸ **lessThan**(`value`): [`Search`](Search.md)<`T`\> Adds a less than comparison against a field to the search query. @@ -598,19 +604,19 @@ Adds a less than comparison against a field to the search query. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:157](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L157) +[lib/search/where-field.ts:160](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L160) ___ ### lessThanOrEqualTo -▸ **lessThanOrEqualTo**(`value`): [`Search`](Search.md) +▸ **lessThanOrEqualTo**(`value`): [`Search`](Search.md)<`T`\> Adds a less than or equal to comparison against a field to the search query. @@ -622,19 +628,19 @@ Adds a less than or equal to comparison against a field to the search query. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:171](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L171) +[lib/search/where-field.ts:174](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L174) ___ ### lt -▸ **lt**(`value`): [`Search`](Search.md) +▸ **lt**(`value`): [`Search`](Search.md)<`T`\> Adds a less than comparison against a field to the search query. @@ -646,19 +652,19 @@ Adds a less than comparison against a field to the search query. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:150](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L150) +[lib/search/where-field.ts:153](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L153) ___ ### lte -▸ **lte**(`value`): [`Search`](Search.md) +▸ **lte**(`value`): [`Search`](Search.md)<`T`\> Adds a less than or equal to comparison against a field to the search query. @@ -670,19 +676,19 @@ Adds a less than or equal to comparison against a field to the search query. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:164](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L164) +[lib/search/where-field.ts:167](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L167) ___ ### match -▸ **match**(`value`, `options?`): [`Search`](Search.md) +▸ **match**(`value`, `options?`): [`Search`](Search.md)<`T`\> Adds a full-text search comparison to the query. @@ -691,25 +697,25 @@ Adds a full-text search comparison to the query. | Name | Type | Description | | :------ | :------ | :------ | | `value` | `string` \| `number` \| `boolean` | The word or phrase sought. | -| `options?` | `Object` | - | +| `options?` | `Object` | | | `options.fuzzyMatching?` | `boolean` | Whether to use fuzzy matching to find the sought word or phrase. Defaults to `false`. | | `options.levenshteinDistance?` | ``2`` \| ``1`` \| ``3`` | The levenshtein distance to use for fuzzy matching. Supported values are `1`, `2`, and `3`. Defaults to `1`. | #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:59](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L59) +[lib/search/where-field.ts:61](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L61) ___ ### matchExact -▸ **matchExact**(`value`): [`Search`](Search.md) +▸ **matchExact**(`value`): [`Search`](Search.md)<`T`\> Adds a full-text search comparison to the query that matches an exact word or phrase. @@ -721,19 +727,19 @@ Adds a full-text search comparison to the query that matches an exact word or ph #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:75](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L75) +[lib/search/where-field.ts:78](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L78) ___ ### matchExactly -▸ **matchExactly**(`value`): [`Search`](Search.md) +▸ **matchExactly**(`value`): [`Search`](Search.md)<`T`\> Adds a full-text search comparison to the query that matches an exact word or phrase. @@ -745,19 +751,19 @@ Adds a full-text search comparison to the query that matches an exact word or ph #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:82](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L82) +[lib/search/where-field.ts:85](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L85) ___ ### matches -▸ **matches**(`value`, `options?`): [`Search`](Search.md) +▸ **matches**(`value`, `options?`): [`Search`](Search.md)<`T`\> Adds a full-text search comparison to the query. @@ -766,25 +772,25 @@ Adds a full-text search comparison to the query. | Name | Type | Description | | :------ | :------ | :------ | | `value` | `string` \| `number` \| `boolean` | The word or phrase sought. | -| `options?` | `Object` | - | +| `options?` | `Object` | | | `options.fuzzyMatching?` | `boolean` | Whether to use fuzzy matching to find the sought word or phrase. Defaults to `false`. | | `options.levenshteinDistance?` | ``2`` \| ``1`` \| ``3`` | The levenshtein distance to use for fuzzy matching. Supported values are `1`, `2`, and `3`. Defaults to `1`. | #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:68](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L68) +[lib/search/where-field.ts:71](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L71) ___ ### matchesExactly -▸ **matchesExactly**(`value`): [`Search`](Search.md) +▸ **matchesExactly**(`value`): [`Search`](Search.md)<`T`\> Adds a full-text search comparison to the query that matches an exact word or phrase. @@ -796,19 +802,19 @@ Adds a full-text search comparison to the query that matches an exact word or ph #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:89](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L89) +[lib/search/where-field.ts:92](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L92) ___ ### on -▸ **on**(`value`): [`Search`](Search.md) +▸ **on**(`value`): [`Search`](Search.md)<`T`\> Add a search for an exact UTC datetime to the query. @@ -820,19 +826,19 @@ Add a search for an exact UTC datetime to the query. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:230](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L230) +[lib/search/where-field.ts:233](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L233) ___ ### onOrAfter -▸ **onOrAfter**(`value`): [`Search`](Search.md) +▸ **onOrAfter**(`value`): [`Search`](Search.md)<`T`\> Add a search that matches all datetimes *on or after* the provided UTC datetime to the query. @@ -844,19 +850,19 @@ Add a search that matches all datetimes *on or after* the provided UTC datetime #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:258](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L258) +[lib/search/where-field.ts:261](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L261) ___ ### onOrBefore -▸ **onOrBefore**(`value`): [`Search`](Search.md) +▸ **onOrBefore**(`value`): [`Search`](Search.md)<`T`\> Add a search that matches all datetimes *on or before* the provided UTC datetime to the query. @@ -868,13 +874,13 @@ Add a search that matches all datetimes *on or before* the provided UTC datetime #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:251](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L251) +[lib/search/where-field.ts:254](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L254) ___ @@ -894,22 +900,22 @@ Converts this [Where](Where.md) into a portion of a RediSearch query. #### Defined in -[lib/search/where-field.ts:307](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L307) +[lib/search/where-field.ts:310](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L310) ___ ### true -▸ **true**(): [`Search`](Search.md) +▸ **true**(): [`Search`](Search.md)<`T`\> Adds a boolean match with a value of `true` to the query. #### Returns -[`Search`](Search.md) +[`Search`](Search.md)<`T`\> The [Search](Search.md) that was called to create this [WhereField](WhereField.md). #### Defined in -[lib/search/where-field.ts:109](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-field.ts#L109) +[lib/search/where-field.ts:112](https://github.com/redis/redis-om-node/blob/1acd1cf/lib/search/where-field.ts#L112) diff --git a/lib/client/client.ts b/lib/client/client.ts index 5b76440..2260f32 100644 --- a/lib/client/client.ts +++ b/lib/client/client.ts @@ -1,7 +1,7 @@ import { createClient, createCluster, RediSearchSchema, SearchOptions } from 'redis' import { Repository } from '../repository' -import {InferSchema, Schema} from '../schema' +import { InferSchema, Schema } from '../schema' import { RedisOmError } from '../error' /** A conventional Redis connection. */ @@ -159,7 +159,7 @@ export class Client { this.#validateRedisOpen() await this.redis.expire(key, ttl) } - + /** @internal */ async expireAt(key: string, timestamp: Date) { this.#validateRedisOpen() diff --git a/lib/index.ts b/lib/index.ts index cfe790f..b3bde9e 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,8 +1,8 @@ export { Client, RedisClientConnection, RedisConnection, RedisClusterConnection } from './client' -export { Entity, EntityData, EntityDataValue, EntityId, EntityKeyName, Point } from './entity' +export { Entity, EntityData, EntityDataValue, EntityId, EntityInternal, EntityKeyName, EntityKeys, Point } from './entity' export * from './error' export { Field } from './schema/field' -export { Schema } from './schema/schema' +export { Schema, InferSchema } from './schema/schema' export { DataStructure, IdStrategy, SchemaOptions, StopWordOptions } from './schema/options' export { AllFieldDefinition, BooleanFieldDefinition, CommonFieldDefinition, DateFieldDefinition, FieldDefinition, FieldType, NumberArrayFieldDefinition, NumberFieldDefinition, PointFieldDefinition, SchemaDefinition, StringArrayFieldDefinition, diff --git a/lib/repository/repository.ts b/lib/repository/repository.ts index 088e780..86a124c 100644 --- a/lib/repository/repository.ts +++ b/lib/repository/repository.ts @@ -1,9 +1,9 @@ -import {Client, CreateOptions, RedisConnection, RedisHashData, RedisJsonData} from '../client' -import {Entity, EntityId, EntityKeyName} from '../entity' -import {buildRediSearchSchema} from '../indexer' -import {Schema} from '../schema' -import {RawSearch, Search} from '../search' -import {fromRedisHash, fromRedisJson, toRedisHash, toRedisJson} from '../transformer' +import { Client, CreateOptions, RedisConnection, RedisHashData, RedisJsonData } from '../client' +import { Entity, EntityId, EntityKeyName } from '../entity' +import { buildRediSearchSchema } from '../indexer' +import { Schema } from '../schema' +import { RawSearch, Search } from '../search' +import { fromRedisHash, fromRedisJson, toRedisHash, toRedisJson } from '../transformer' /** * A repository is the main interaction point for reading, writing, and @@ -277,7 +277,7 @@ export class Repository> { * @param expirationDate The time the data should expire. */ async expireAt(ids: string[], expirationDate: Date): Promise; - + async expireAt(idOrIds: string | string[], expirationDate: Date) { const ids = typeof idOrIds === 'string' ? [idOrIds] : idOrIds; if (Date.now() >= expirationDate.getTime()) { diff --git a/lib/schema/definitions.ts b/lib/schema/definitions.ts index 01e1552..241dac4 100644 --- a/lib/schema/definitions.ts +++ b/lib/schema/definitions.ts @@ -1,4 +1,4 @@ -import {Entity, EntityKeys} from "$lib/entity"; +import { Entity, EntityKeys } from "../entity" /** Valid field types for a {@link FieldDefinition}. */ export type FieldType = 'boolean' | 'date' | 'number' | 'number[]' | 'point' | 'string' | 'string[]' | 'text' diff --git a/lib/schema/schema.ts b/lib/schema/schema.ts index 595d409..993053d 100644 --- a/lib/schema/schema.ts +++ b/lib/schema/schema.ts @@ -1,13 +1,13 @@ -import {createHash} from 'crypto' -import {ulid} from 'ulid' +import { createHash } from 'crypto' +import { ulid } from 'ulid' -import {Entity, EntityKeys} from "../entity" +import { Entity, EntityKeys } from "../entity" -import {DataStructure, IdStrategy, SchemaOptions, StopWordOptions} from './options' +import { DataStructure, IdStrategy, SchemaOptions, StopWordOptions } from './options' -import {FieldDefinition, SchemaDefinition} from './definitions' -import {Field} from './field' -import {InvalidSchema} from '../error' +import { FieldDefinition, SchemaDefinition } from './definitions' +import { Field } from './field' +import { InvalidSchema } from '../error' /** @@ -45,7 +45,7 @@ import {InvalidSchema} from '../error' export class Schema> { readonly #schemaName: string - #fieldsByName = {} as Record, Field>; + #fieldsByName = {} as Record, Field> readonly #definition: SchemaDefinition #options?: SchemaOptions @@ -120,7 +120,7 @@ export class Schema> { */ async generateId(): Promise { const ulidStrategy = () => ulid() - return await (this.#options?.idStrategy ?? ulidStrategy)(); + return await (this.#options?.idStrategy ?? ulidStrategy)() } /** @@ -143,7 +143,7 @@ export class Schema> { } #createFields() { - const entries = Object.entries(this.#definition) as [EntityKeys, FieldDefinition][]; + const entries = Object.entries(this.#definition) as [EntityKeys, FieldDefinition][] return entries.forEach(([fieldName, fieldDef]) => { const field = new Field(String(fieldName), fieldDef) this.#validateField(field) @@ -178,4 +178,4 @@ export class Schema> { } } -export type InferSchema = T extends Schema ? R : never; \ No newline at end of file +export type InferSchema = T extends Schema ? R : never diff --git a/lib/search/results-converter.ts b/lib/search/results-converter.ts index 8de484e..5f874f5 100644 --- a/lib/search/results-converter.ts +++ b/lib/search/results-converter.ts @@ -1,7 +1,7 @@ -import {RedisHashData, RedisJsonData, SearchDocument, SearchResults} from "../client" -import {Entity, EntityData, EntityId, EntityKeyName} from "../entity" -import {Schema} from "../schema" -import {fromRedisHash, fromRedisJson} from "../transformer" +import { RedisHashData, RedisJsonData, SearchDocument, SearchResults } from "../client" +import { Entity, EntityData, EntityId, EntityKeyName } from "../entity" +import { Schema } from "../schema" +import { fromRedisHash, fromRedisJson } from "../transformer" export function extractCountFromSearchResults(results: SearchResults): number { return results.total diff --git a/lib/search/search.ts b/lib/search/search.ts index 8d37794..106c6d3 100644 --- a/lib/search/search.ts +++ b/lib/search/search.ts @@ -1,28 +1,28 @@ -import { SearchOptions } from "redis"; - -import { Client, SearchResults } from "../client"; -import { Entity, EntityKeys } from "../entity"; -import { Schema } from "../schema"; - -import { Where } from "./where"; -import { WhereAnd } from "./where-and"; -import { WhereOr } from "./where-or"; -import { WhereField } from "./where-field"; -import { WhereStringArray } from "./where-string-array"; -import { WhereHashBoolean, WhereJsonBoolean } from "./where-boolean"; -import { WhereNumber } from "./where-number"; -import { WherePoint } from "./where-point"; -import { WhereString } from "./where-string"; -import { WhereText } from "./where-text"; +import { SearchOptions } from "redis" + +import { Client, SearchResults } from "../client" +import { Entity, EntityKeys } from "../entity" +import { Schema } from "../schema" + +import { Where } from "./where" +import { WhereAnd } from "./where-and" +import { WhereOr } from "./where-or" +import { WhereField } from "./where-field" +import { WhereStringArray } from "./where-string-array" +import { WhereHashBoolean, WhereJsonBoolean } from "./where-boolean" +import { WhereNumber } from "./where-number" +import { WherePoint } from "./where-point" +import { WhereString } from "./where-string" +import { WhereText } from "./where-text" import { extractCountFromSearchResults, extractEntitiesFromSearchResults, extractEntityIdsFromSearchResults, extractKeyNamesFromSearchResults, -} from "./results-converter"; -import { FieldNotInSchema, RedisOmError, SearchError } from "../error"; -import { WhereDate } from "./where-date"; +} from "./results-converter" +import { FieldNotInSchema, RedisOmError, SearchError } from "../error" +import { WhereDate } from "./where-date" /** * A function that takes a {@link Search} and returns a {@link Search}. Used in nested queries. @@ -30,12 +30,12 @@ import { WhereDate } from "./where-date"; */ export type SubSearchFunction = ( search: Search, -) => Search; +) => Search -type AndOrConstructor = new (left: Where, right: Where) => Where; +type AndOrConstructor = new (left: Where, right: Where) => Where // This is a simplified redefintion of the SortByProperty type that is not exported by Node Redis -type SortOptions = { BY: string; DIRECTION: "ASC" | "DESC" }; +type SortOptions = { BY: string; DIRECTION: "ASC" | "DESC" } /** * Abstract base class for {@link Search} and {@link RawSearch} that @@ -44,22 +44,22 @@ type SortOptions = { BY: string; DIRECTION: "ASC" | "DESC" }; */ export abstract class AbstractSearch> { /** @internal */ - protected schema: Schema; + protected schema: Schema /** @internal */ - protected client: Client; + protected client: Client /** @internal */ - protected sortOptions?: SortOptions; + protected sortOptions?: SortOptions /** @internal */ constructor(schema: Schema, client: Client) { - this.schema = schema; - this.client = client; + this.schema = schema + this.client = client } /** @internal */ - abstract get query(): string; + abstract get query(): string /** * Applies an ascending sort to the query. @@ -67,14 +67,14 @@ export abstract class AbstractSearch> { * @returns this */ sortAscending(field: EntityKeys): AbstractSearch { - return this.sortBy(field, "ASC"); + return this.sortBy(field, "ASC") } /** * Alias for {@link Search.sortDescending}. */ sortDesc(field: EntityKeys): AbstractSearch { - return this.sortDescending(field); + return this.sortDescending(field) } /** @@ -83,14 +83,14 @@ export abstract class AbstractSearch> { * @returns this */ sortDescending(field: EntityKeys): AbstractSearch { - return this.sortBy(field, "DESC"); + return this.sortBy(field, "DESC") } /** * Alias for {@link Search.sortAscending}. */ sortAsc(field: EntityKeys): AbstractSearch { - return this.sortAscending(field); + return this.sortAscending(field) } /** @@ -103,26 +103,26 @@ export abstract class AbstractSearch> { fieldName: EntityKeys, order: "ASC" | "DESC" = "ASC", ): AbstractSearch { - const field = this.schema.fieldByName(fieldName); - const dataStructure = this.schema.dataStructure; + const field = this.schema.fieldByName(fieldName) + const dataStructure = this.schema.dataStructure if (!field) { - const message = `'sortBy' was called on field '${String(fieldName)}' which is not defined in the Schema.`; - console.error(message); - throw new RedisOmError(message); + const message = `'sortBy' was called on field '${String(fieldName)}' which is not defined in the Schema.` + console.error(message) + throw new RedisOmError(message) } - const type = field.type; - const markedSortable = field.sortable; + const type = field.type + const markedSortable = field.sortable - const UNSORTABLE = ["point", "string[]"]; - const JSON_SORTABLE = ["number", "text", "date"]; - const HASH_SORTABLE = ["string", "boolean", "number", "text", "date"]; + const UNSORTABLE = ["point", "string[]"] + const JSON_SORTABLE = ["number", "text", "date"] + const HASH_SORTABLE = ["string", "boolean", "number", "text", "date"] if (UNSORTABLE.includes(type)) { - const message = `'sortBy' was called on '${field.type}' field '${field.name}' which cannot be sorted.`; - console.error(message); - throw new RedisOmError(message); + const message = `'sortBy' was called on '${field.type}' field '${field.name}' which cannot be sorted.` + console.error(message) + throw new RedisOmError(message) } if ( @@ -132,7 +132,7 @@ export abstract class AbstractSearch> { ) console.warn( `'sortBy' was called on field '${field.name}' which is not marked as sortable in the Schema. This may result is slower searches. If possible, mark the field as sortable in the Schema.`, - ); + ) if ( dataStructure === "HASH" && @@ -141,11 +141,11 @@ export abstract class AbstractSearch> { ) console.warn( `'sortBy' was called on field '${field.name}' which is not marked as sortable in the Schema. This may result is slower searches. If possible, mark the field as sortable in the Schema.`, - ); + ) - this.sortOptions = { BY: field.name, DIRECTION: order }; + this.sortOptions = { BY: field.name, DIRECTION: order } - return this; + return this } /** @@ -154,7 +154,7 @@ export abstract class AbstractSearch> { * @returns The {@link Entity} with the minimal value */ async min(field: EntityKeys): Promise { - return await this.sortBy(field, "ASC").first(); + return await this.sortBy(field, "ASC").first() } /** @@ -163,7 +163,7 @@ export abstract class AbstractSearch> { * @returns The entity ID with the minimal value */ async minId(field: EntityKeys): Promise { - return await this.sortBy(field, "ASC").firstId(); + return await this.sortBy(field, "ASC").firstId() } /** @@ -172,7 +172,7 @@ export abstract class AbstractSearch> { * @returns The key name with the minimal value */ async minKey(field: EntityKeys): Promise { - return await this.sortBy(field, "ASC").firstKey(); + return await this.sortBy(field, "ASC").firstKey() } /** @@ -181,7 +181,7 @@ export abstract class AbstractSearch> { * @returns The entity ID {@link Entity} with the maximal value */ async max(field: EntityKeys): Promise { - return await this.sortBy(field, "DESC").first(); + return await this.sortBy(field, "DESC").first() } /** @@ -190,7 +190,7 @@ export abstract class AbstractSearch> { * @returns The entity ID with the maximal value */ async maxId(field: EntityKeys): Promise { - return await this.sortBy(field, "DESC").firstId(); + return await this.sortBy(field, "DESC").firstId() } /** @@ -199,7 +199,7 @@ export abstract class AbstractSearch> { * @returns The key name with the maximal value */ async maxKey(field: EntityKeys): Promise { - return await this.sortBy(field, "DESC").firstKey(); + return await this.sortBy(field, "DESC").firstKey() } /** @@ -207,8 +207,8 @@ export abstract class AbstractSearch> { * @returns */ async count(): Promise { - const searchResults = await this.callSearch(); - return extractCountFromSearchResults(searchResults); + const searchResults = await this.callSearch() + return extractCountFromSearchResults(searchResults) } /** @@ -218,8 +218,8 @@ export abstract class AbstractSearch> { * @returns An array of {@link Entity | Entities} matching the query. */ async page(offset: number, count: number): Promise { - const searchResults = await this.callSearch(offset, count); - return extractEntitiesFromSearchResults(this.schema, searchResults); + const searchResults = await this.callSearch(offset, count) + return extractEntitiesFromSearchResults(this.schema, searchResults) } /** @@ -229,8 +229,8 @@ export abstract class AbstractSearch> { * @returns An array of strings matching the query. */ async pageOfIds(offset: number, count: number): Promise { - const searchResults = await this.callSearch(offset, count, true); - return extractEntityIdsFromSearchResults(this.schema, searchResults); + const searchResults = await this.callSearch(offset, count, true) + return extractEntityIdsFromSearchResults(this.schema, searchResults) } /** @@ -240,32 +240,32 @@ export abstract class AbstractSearch> { * @returns An array of strings matching the query. */ async pageOfKeys(offset: number, count: number): Promise { - const searchResults = await this.callSearch(offset, count, true); - return extractKeyNamesFromSearchResults(searchResults); + const searchResults = await this.callSearch(offset, count, true) + return extractKeyNamesFromSearchResults(searchResults) } /** * Returns the first {@link Entity} that matches this query. */ async first(): Promise { - const foundEntity = await this.page(0, 1); - return foundEntity[0] ?? null; + const foundEntity = await this.page(0, 1) + return foundEntity[0] ?? null } /** * Returns the first entity ID that matches this query. */ async firstId(): Promise { - const foundIds = await this.pageOfIds(0, 1); - return foundIds[0] ?? null; + const foundIds = await this.pageOfIds(0, 1) + return foundIds[0] ?? null } /** * Returns the first key name that matches this query. */ async firstKey(): Promise { - const foundKeys = await this.pageOfKeys(0, 1); - return foundKeys[0] ?? null; + const foundKeys = await this.pageOfKeys(0, 1) + return foundKeys[0] ?? null } /** @@ -283,7 +283,7 @@ export abstract class AbstractSearch> { * @returns An array of {@link Entity | Entities} matching the query. */ async all(options = { pageSize: 10 }): Promise { - return this.allThings(this.page, options) as Promise; + return this.allThings(this.page, options) as Promise } /** @@ -301,7 +301,7 @@ export abstract class AbstractSearch> { * @returns An array of entity IDs matching the query. */ async allIds(options = { pageSize: 10 }): Promise { - return this.allThings(this.pageOfIds, options) as Promise; + return this.allThings(this.pageOfIds, options) as Promise } /** @@ -319,7 +319,7 @@ export abstract class AbstractSearch> { * @returns An array of key names matching the query. */ async allKeys(options = { pageSize: 10 }): Promise { - return this.allThings(this.pageOfKeys, options); + return this.allThings(this.pageOfKeys, options) } /** @@ -327,119 +327,119 @@ export abstract class AbstractSearch> { * @returns this */ get return(): AbstractSearch { - return this; + return this } /** * Alias for {@link Search.min}. */ async returnMin(field: EntityKeys): Promise { - return await this.min(field); + return await this.min(field) } /** * Alias for {@link Search.minId}. */ async returnMinId(field: EntityKeys): Promise { - return await this.minId(field); + return await this.minId(field) } /** * Alias for {@link Search.minKey}. */ async returnMinKey(field: EntityKeys): Promise { - return await this.minKey(field); + return await this.minKey(field) } /** * Alias for {@link Search.max}. */ async returnMax(field: EntityKeys): Promise { - return await this.max(field); + return await this.max(field) } /** * Alias for {@link Search.maxId}. */ async returnMaxId(field: EntityKeys): Promise { - return await this.maxId(field); + return await this.maxId(field) } /** * Alias for {@link Search.maxKey}. */ async returnMaxKey(field: EntityKeys): Promise { - return await this.maxKey(field); + return await this.maxKey(field) } /** * Alias for {@link Search.count}. */ async returnCount(): Promise { - return await this.count(); + return await this.count() } /** * Alias for {@link Search.page}. */ async returnPage(offset: number, count: number): Promise { - return await this.page(offset, count); + return await this.page(offset, count) } /** * Alias for {@link Search.pageOfIds}. */ async returnPageOfIds(offset: number, count: number): Promise { - return await this.pageOfIds(offset, count); + return await this.pageOfIds(offset, count) } /** * Alias for {@link Search.pageOfKeys}. */ async returnPageOfKeys(offset: number, count: number): Promise { - return await this.pageOfKeys(offset, count); + return await this.pageOfKeys(offset, count) } /** * Alias for {@link Search.first}. */ async returnFirst(): Promise { - return await this.first(); + return await this.first() } /** * Alias for {@link Search.firstId}. */ async returnFirstId(): Promise { - return await this.firstId(); + return await this.firstId() } /** * Alias for {@link Search.firstKey}. */ async returnFirstKey(): Promise { - return await this.firstKey(); + return await this.firstKey() } /** * Alias for {@link Search.all}. */ async returnAll(options = { pageSize: 10 }): Promise { - return await this.all(options); + return await this.all(options) } /** * Alias for {@link Search.allIds}. */ async returnAllIds(options = { pageSize: 10 }): Promise { - return await this.allIds(options); + return await this.allIds(options) } /** * Alias for {@link Search.allKeys}. */ async returnAllKeys(options = { pageSize: 10 }): Promise { - return await this.allKeys(options); + return await this.allKeys(options) } private async allThings( @@ -448,18 +448,18 @@ export abstract class AbstractSearch> { ): Promise { // TypeScript is just being mean in this function. The internal logic will be fine in runtime, // However, it is important during future changes to double check your work. - let things: unknown[] = []; - let offset = 0; - const pageSize = options.pageSize; + let things: unknown[] = [] + let offset = 0 + const pageSize = options.pageSize while (true) { - const foundThings = await pageFn.call(this, offset, pageSize); - things.push(...(foundThings as unknown[])); - if (foundThings.length < pageSize) break; - offset += pageSize; + const foundThings = await pageFn.call(this, offset, pageSize) + things.push(...(foundThings as unknown[])) + if (foundThings.length < pageSize) break + offset += pageSize } - return things as R; + return things as R } private async callSearch( @@ -467,34 +467,34 @@ export abstract class AbstractSearch> { count = 0, keysOnly = false, ): Promise { - const dataStructure = this.schema.dataStructure; - const indexName = this.schema.indexName; - const query = this.query; + const dataStructure = this.schema.dataStructure + const indexName = this.schema.indexName + const query = this.query const options: SearchOptions = { LIMIT: { from: offset, size: count }, - }; + } - if (this.sortOptions !== undefined) options.SORTBY = this.sortOptions; + if (this.sortOptions !== undefined) options.SORTBY = this.sortOptions if (keysOnly) { - options.RETURN = []; + options.RETURN = [] } else if (dataStructure === "JSON") { - options.RETURN = "$"; + options.RETURN = "$" } - let searchResults; + let searchResults try { - searchResults = await this.client.search(indexName, query, options); + searchResults = await this.client.search(indexName, query, options) } catch (error) { - const message = (error as Error).message; + const message = (error as Error).message if (message.startsWith("Syntax error")) { throw new SearchError( `The query to RediSearch had a syntax error: "${message}".\nThis is often the result of using a stop word in the query. Either change the query to not use a stop word or change the stop words in the schema definition. You can check the RediSearch source for the default stop words at: https://github.com/RediSearch/RediSearch/blob/master/src/stopwords.h.`, - ); + ) } - throw error; + throw error } - return searchResults; + return searchResults } } @@ -507,17 +507,17 @@ export abstract class AbstractSearch> { export class RawSearch< T extends Entity = Record, > extends AbstractSearch { - private readonly rawQuery: string; + private readonly rawQuery: string /** @internal */ constructor(schema: Schema, client: Client, query: string = "*") { - super(schema, client); - this.rawQuery = query; + super(schema, client) + this.rawQuery = query } /** @internal */ get query(): string { - return this.rawQuery; + return this.rawQuery } } @@ -529,12 +529,12 @@ export class RawSearch< export class Search< T extends Entity = Record, > extends AbstractSearch { - private rootWhere?: Where; + private rootWhere?: Where /** @internal */ get query(): string { - if (this.rootWhere === undefined) return "*"; - return `${this.rootWhere.toString()}`; + if (this.rootWhere === undefined) return "*" + return `${this.rootWhere.toString()}` } /** @@ -543,7 +543,7 @@ export class Search< * @param field The field to filter on. * @returns A subclass of {@link WhereField} matching the type of the field. */ - where(field: EntityKeys): WhereField; + where(field: EntityKeys): WhereField /** * Sets up a nested search. If there are multiple calls to {@link Search.where}, @@ -551,11 +551,11 @@ export class Search< * @param subSearchFn A function that takes a {@link Search} and returns another {@link Search}. * @returns `this`. */ - where(subSearchFn: SubSearchFunction): Search; + where(subSearchFn: SubSearchFunction): Search where( fieldOrFn: EntityKeys | SubSearchFunction, ): WhereField | Search { - return this.anyWhere(WhereAnd, fieldOrFn); + return this.anyWhere(WhereAnd, fieldOrFn) } /** @@ -563,18 +563,18 @@ export class Search< * @param field The field to filter on. * @returns A subclass of {@link WhereField} matching the type of the field. */ - and(field: EntityKeys): WhereField; + and(field: EntityKeys): WhereField /** * Sets up a nested search as a logical AND. * @param subSearchFn A function that takes a {@link Search} and returns another {@link Search}. * @returns `this`. */ - and(subSearchFn: SubSearchFunction): Search; + and(subSearchFn: SubSearchFunction): Search and( fieldOrFn: EntityKeys | SubSearchFunction, ): WhereField | Search { - return this.anyWhere(WhereAnd, fieldOrFn); + return this.anyWhere(WhereAnd, fieldOrFn) } /** @@ -582,18 +582,18 @@ export class Search< * @param field The field to filter on. * @returns A subclass of {@link WhereField} matching the type of the field. */ - or(field: EntityKeys): WhereField; + or(field: EntityKeys): WhereField /** * Sets up a nested search as a logical OR. * @param subSearchFn A function that takes a {@link Search} and returns another {@link Search}. * @returns `this`. */ - or(subSearchFn: SubSearchFunction): Search; + or(subSearchFn: SubSearchFunction): Search or( fieldOrFn: EntityKeys | SubSearchFunction, ): WhereField | Search { - return this.anyWhere(WhereOr, fieldOrFn); + return this.anyWhere(WhereOr, fieldOrFn) } private anyWhere( @@ -601,9 +601,9 @@ export class Search< fieldOrFn: EntityKeys | SubSearchFunction, ): WhereField | Search { if (typeof fieldOrFn === "function") { - return this.anyWhereForFunction(ctor, fieldOrFn); + return this.anyWhereForFunction(ctor, fieldOrFn) } else { - return this.anyWhereForField(ctor, fieldOrFn); + return this.anyWhereForField(ctor, fieldOrFn) } } @@ -611,59 +611,59 @@ export class Search< ctor: AndOrConstructor, field: EntityKeys, ): WhereField { - const where = this.createWhere(field); + const where = this.createWhere(field) if (this.rootWhere === undefined) { - this.rootWhere = where; + this.rootWhere = where } else { - this.rootWhere = new ctor(this.rootWhere, where); + this.rootWhere = new ctor(this.rootWhere, where) } - return where; + return where } private anyWhereForFunction( ctor: AndOrConstructor, subSearchFn: SubSearchFunction, ): Search { - const search = new Search(this.schema, this.client); - const subSearch = subSearchFn(search); + const search = new Search(this.schema, this.client) + const subSearch = subSearchFn(search) if (subSearch.rootWhere === undefined) { throw new SearchError( "Sub-search without a root where was somehow defined.", - ); + ) } else { if (this.rootWhere === undefined) { - this.rootWhere = subSearch.rootWhere; + this.rootWhere = subSearch.rootWhere } else { - this.rootWhere = new ctor(this.rootWhere, subSearch.rootWhere); + this.rootWhere = new ctor(this.rootWhere, subSearch.rootWhere) } } - return this; + return this } private createWhere(fieldName: EntityKeys): WhereField { - const field = this.schema.fieldByName(fieldName); + const field = this.schema.fieldByName(fieldName) - if (field === null) throw new FieldNotInSchema(String(fieldName)); + if (field === null) throw new FieldNotInSchema(String(fieldName)) if (field.type === "boolean" && this.schema.dataStructure === "HASH") - return new WhereHashBoolean(this, field); + return new WhereHashBoolean(this, field) if (field.type === "boolean" && this.schema.dataStructure === "JSON") - return new WhereJsonBoolean(this, field); - if (field.type === "date") return new WhereDate(this, field); - if (field.type === "number") return new WhereNumber(this, field); - if (field.type === "number[]") return new WhereNumber(this, field); - if (field.type === "point") return new WherePoint(this, field); - if (field.type === "text") return new WhereText(this, field); - if (field.type === "string") return new WhereString(this, field); - if (field.type === "string[]") return new WhereStringArray(this, field); + return new WhereJsonBoolean(this, field) + if (field.type === "date") return new WhereDate(this, field) + if (field.type === "number") return new WhereNumber(this, field) + if (field.type === "number[]") return new WhereNumber(this, field) + if (field.type === "point") return new WherePoint(this, field) + if (field.type === "text") return new WhereText(this, field) + if (field.type === "string") return new WhereString(this, field) + if (field.type === "string[]") return new WhereStringArray(this, field) throw new RedisOmError( // @ts-ignore: This is a trap for JavaScript `The field type of '${fieldDef.type}' is not a valid field type. Valid types include 'boolean', 'date', 'number', 'point', 'string', and 'string[]'.`, - ); + ) } } diff --git a/lib/search/where-boolean.ts b/lib/search/where-boolean.ts index 7b6bd17..77eb5a3 100644 --- a/lib/search/where-boolean.ts +++ b/lib/search/where-boolean.ts @@ -1,6 +1,6 @@ +import { Entity } from "../entity" import { Search } from "./search" import { WhereField } from "./where-field" -import {Entity} from "$lib/entity"; export abstract class WhereBoolean extends WhereField { protected value!: boolean diff --git a/lib/search/where-date.ts b/lib/search/where-date.ts index 58c8c46..91bfaa2 100644 --- a/lib/search/where-date.ts +++ b/lib/search/where-date.ts @@ -1,6 +1,6 @@ +import { Entity } from "../entity" import { Search } from "./search" import { WhereField } from "./where-field" -import {Entity} from "$lib/entity"; export class WhereDate extends WhereField { private lower: number = Number.NEGATIVE_INFINITY diff --git a/lib/search/where-field.ts b/lib/search/where-field.ts index 6b67134..a3bcad2 100644 --- a/lib/search/where-field.ts +++ b/lib/search/where-field.ts @@ -1,8 +1,8 @@ +import { Entity } from "../entity" import { Field } from "../schema" import { Search } from "./search" import { Where } from "./where" import { CircleFunction } from "./where-point" -import { Entity } from "$lib/entity"; /** * Interface with all the methods from all the concrete diff --git a/lib/search/where-number.ts b/lib/search/where-number.ts index c53d92b..2c60bba 100644 --- a/lib/search/where-number.ts +++ b/lib/search/where-number.ts @@ -1,6 +1,6 @@ +import { Entity } from "../entity" import { Search } from "./search" import { WhereField } from "./where-field" -import {Entity} from "$lib/entity"; export class WhereNumber extends WhereField { private lower: number = Number.NEGATIVE_INFINITY diff --git a/lib/search/where-point.ts b/lib/search/where-point.ts index 9dd8630..b0f583e 100644 --- a/lib/search/where-point.ts +++ b/lib/search/where-point.ts @@ -1,4 +1,4 @@ -import {Entity, Point} from "../entity" +import { Entity, Point } from "../entity" import { Search } from "./search" import { WhereField } from "./where-field" diff --git a/lib/search/where-string-array.ts b/lib/search/where-string-array.ts index 9f21ce4..665f805 100644 --- a/lib/search/where-string-array.ts +++ b/lib/search/where-string-array.ts @@ -1,6 +1,6 @@ +import { Entity } from "../entity" import { Search } from "./search" import { WhereField } from "./where-field" -import {Entity} from "$lib/entity"; export class WhereStringArray extends WhereField { private value!: Array diff --git a/lib/search/where-string.ts b/lib/search/where-string.ts index 1440718..a3c2a4c 100644 --- a/lib/search/where-string.ts +++ b/lib/search/where-string.ts @@ -1,7 +1,7 @@ +import { Entity } from "../entity" import { Search } from "./search" import { WhereField } from "./where-field" import { SemanticSearchError } from "../error" -import {Entity} from "$lib/entity"; export class WhereString extends WhereField { private value!: string diff --git a/lib/search/where-text.ts b/lib/search/where-text.ts index 7081925..028224a 100644 --- a/lib/search/where-text.ts +++ b/lib/search/where-text.ts @@ -1,8 +1,8 @@ +import { Entity } from "../entity" import { Search } from "./search" import { WhereField } from "./where-field" import { SemanticSearchError } from "../error" -import {Entity} from "$lib/entity"; export class WhereText extends WhereField { private value!: string diff --git a/package.json b/package.json index 29d7873..dd5f6ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "redis-om", - "version": "0.4.3", + "version": "0.4.4", "description": "Object mapping, and more, for Redis and Node.js. Written in TypeScript.", "main": "dist/index.js", "types": "./dist/index.d.ts",