From b4778d188265fee0b40c44d856303fc045bcf371 Mon Sep 17 00:00:00 2001 From: Guy Royse Date: Thu, 23 Dec 2021 09:51:32 -0500 Subject: [PATCH] swapped out EntityData for EntityCreationData because null --- docs/README.md | 32 +++++++++++++----- docs/classes/Client.md | 8 ++--- docs/classes/Entity.md | 2 +- docs/classes/RedisError.md | 2 +- docs/classes/Repository.md | 22 ++++++------ docs/classes/Schema.md | 14 ++++---- docs/classes/Search.md | 26 +++++++------- docs/classes/Where.md | 2 +- docs/classes/WhereField.md | 60 ++++++++++++++++----------------- docs/interfaces/ArrayField.md | 6 ++-- docs/interfaces/BooleanField.md | 4 +-- docs/interfaces/Field.md | 2 +- docs/interfaces/NumericField.md | 4 +-- docs/interfaces/StringField.md | 8 ++--- lib/index.ts | 4 +-- lib/repository/repository.ts | 10 ++++-- 16 files changed, 113 insertions(+), 93 deletions(-) diff --git a/docs/README.md b/docs/README.md index e4e430b5..95d68979 100644 --- a/docs/README.md +++ b/docs/README.md @@ -26,6 +26,7 @@ redis-om ### Type aliases - [EntityConstructor](README.md#entityconstructor) +- [EntityCreationData](README.md#entitycreationdata) - [EntityData](README.md#entitydata) - [FieldDefinition](README.md#fielddefinition) - [IdStrategy](README.md#idstrategy) @@ -62,7 +63,20 @@ A constructor that creates an [Entity](classes/Entity.md) of type TEntity. #### Defined in -[lib/entity/entity.ts:10](https://github.com/redis/redis-om-node/blob/80a8574/lib/entity/entity.ts#L10) +[lib/entity/entity.ts:10](https://github.com/redis/redis-om-node/blob/8a196dc/lib/entity/entity.ts#L10) + +___ + +### EntityCreationData + +Ƭ **EntityCreationData**: `Record`<`string`, `number` \| `boolean` \| `string` \| `string`[] \| ``null``\> + +Initialization data for [Entity](classes/Entity.md) creation when calling +[Repository.createEntity](classes/Repository.md#createentity) or [Repository.createAndSave](classes/Repository.md#createandsave). + +#### Defined in + +[lib/repository/repository.ts:14](https://github.com/redis/redis-om-node/blob/8a196dc/lib/repository/repository.ts#L14) ___ @@ -74,7 +88,7 @@ A JavaScript object containing the underlying data of an [Entity](classes/Entity #### Defined in -[lib/entity/entity.ts:4](https://github.com/redis/redis-om-node/blob/80a8574/lib/entity/entity.ts#L4) +[lib/entity/entity.ts:4](https://github.com/redis/redis-om-node/blob/8a196dc/lib/entity/entity.ts#L4) ___ @@ -86,7 +100,7 @@ Contains instructions telling how to map a property on an [Entity](classes/Entit #### Defined in -[lib/schema/schema-definitions.ts:54](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema-definitions.ts#L54) +[lib/schema/schema-definitions.ts:54](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema-definitions.ts#L54) ___ @@ -106,7 +120,7 @@ A function that generates random [Entity IDs](classes/Entity.md#entityid). #### Defined in -[lib/schema/schema-definitions.ts:68](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema-definitions.ts#L68) +[lib/schema/schema-definitions.ts:68](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema-definitions.ts#L68) ___ @@ -125,7 +139,7 @@ contains a [FieldDefinition](README.md#fielddefinition) that tell Redis OM how t #### Defined in -[lib/schema/schema-definitions.ts:59](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema-definitions.ts#L59) +[lib/schema/schema-definitions.ts:59](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema-definitions.ts#L59) ___ @@ -148,7 +162,7 @@ Configuration options for a [Schema](classes/Schema.md). #### Defined in -[lib/schema/schema-options.ts:7](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema-options.ts#L7) +[lib/schema/schema-options.ts:7](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema-options.ts#L7) ___ @@ -160,7 +174,7 @@ The type of data structure in Redis to map objects to. #### Defined in -[lib/client.ts:21](https://github.com/redis/redis-om-node/blob/80a8574/lib/client.ts#L21) +[lib/client.ts:21](https://github.com/redis/redis-om-node/blob/8a196dc/lib/client.ts#L21) ___ @@ -172,7 +186,7 @@ Valid values for how to use stop words for a given [Schema](classes/Schema.md). #### Defined in -[lib/schema/schema-definitions.ts:71](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema-definitions.ts#L71) +[lib/schema/schema-definitions.ts:71](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema-definitions.ts#L71) ___ @@ -204,4 +218,4 @@ A function that takes a [Search](classes/Search.md) and returns a [Search](class #### Defined in -[lib/search/search.ts:22](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/search.ts#L22) +[lib/search/search.ts:22](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/search.ts#L22) diff --git a/docs/classes/Client.md b/docs/classes/Client.md index 3e5c2944..445e0639 100644 --- a/docs/classes/Client.md +++ b/docs/classes/Client.md @@ -47,7 +47,7 @@ Close the connection to Redis. #### Defined in -[lib/client.ts:96](https://github.com/redis/redis-om-node/blob/80a8574/lib/client.ts#L96) +[lib/client.ts:96](https://github.com/redis/redis-om-node/blob/8a196dc/lib/client.ts#L96) ___ @@ -77,7 +77,7 @@ The raw results of calling the Redis command. #### Defined in -[lib/client.ts:73](https://github.com/redis/redis-om-node/blob/80a8574/lib/client.ts#L73) +[lib/client.ts:73](https://github.com/redis/redis-om-node/blob/8a196dc/lib/client.ts#L73) ___ @@ -107,7 +107,7 @@ A repository for the provided schema. #### Defined in -[lib/client.ts:88](https://github.com/redis/redis-om-node/blob/80a8574/lib/client.ts#L88) +[lib/client.ts:88](https://github.com/redis/redis-om-node/blob/8a196dc/lib/client.ts#L88) ___ @@ -129,4 +129,4 @@ Open a connection to Redis at the provided URL. #### Defined in -[lib/client.ts:60](https://github.com/redis/redis-om-node/blob/80a8574/lib/client.ts#L60) +[lib/client.ts:60](https://github.com/redis/redis-om-node/blob/8a196dc/lib/client.ts#L60) diff --git a/docs/classes/Entity.md b/docs/classes/Entity.md index 9f313a56..19443deb 100644 --- a/docs/classes/Entity.md +++ b/docs/classes/Entity.md @@ -25,4 +25,4 @@ The generated entity ID. #### Defined in -[lib/entity/entity.ts:22](https://github.com/redis/redis-om-node/blob/80a8574/lib/entity/entity.ts#L22) +[lib/entity/entity.ts:22](https://github.com/redis/redis-om-node/blob/8a196dc/lib/entity/entity.ts#L22) diff --git a/docs/classes/RedisError.md b/docs/classes/RedisError.md index 4e0ddccd..921279bf 100644 --- a/docs/classes/RedisError.md +++ b/docs/classes/RedisError.md @@ -44,7 +44,7 @@ Error.constructor #### Defined in -[lib/errors.ts:2](https://github.com/redis/redis-om-node/blob/80a8574/lib/errors.ts#L2) +[lib/errors.ts:2](https://github.com/redis/redis-om-node/blob/8a196dc/lib/errors.ts#L2) ## Properties diff --git a/docs/classes/Repository.md b/docs/classes/Repository.md index 1a00520d..3c902ec5 100644 --- a/docs/classes/Repository.md +++ b/docs/classes/Repository.md @@ -83,7 +83,7 @@ Constructs a new Repository. #### Defined in -[lib/repository/repository.ts:60](https://github.com/redis/redis-om-node/blob/80a8574/lib/repository/repository.ts#L60) +[lib/repository/repository.ts:66](https://github.com/redis/redis-om-node/blob/8a196dc/lib/repository/repository.ts#L66) ## Methods @@ -98,7 +98,7 @@ Creates and saves an [Entity](Entity.md). Equivalent of calling | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`EntityData`](../README.md#entitydata) | Optional values with which to initialize the entity. | +| `data` | [`EntityCreationData`](../README.md#entitycreationdata) | Optional values with which to initialize the entity. | #### Returns @@ -108,7 +108,7 @@ The newly created and saved Entity. #### Defined in -[lib/repository/repository.ts:150](https://github.com/redis/redis-om-node/blob/80a8574/lib/repository/repository.ts#L150) +[lib/repository/repository.ts:156](https://github.com/redis/redis-om-node/blob/8a196dc/lib/repository/repository.ts#L156) ___ @@ -122,7 +122,7 @@ Creates an [Entity](Entity.md) with a populated [Entity.entityId](Entity.md#enti | Name | Type | Description | | :------ | :------ | :------ | -| `data` | [`EntityData`](../README.md#entitydata) | Optional values with which to initialize the entity. | +| `data` | [`EntityCreationData`](../README.md#entitycreationdata) | Optional values with which to initialize the entity. | #### Returns @@ -132,7 +132,7 @@ A newly created Entity. #### Defined in -[lib/repository/repository.ts:107](https://github.com/redis/redis-om-node/blob/80a8574/lib/repository/repository.ts#L107) +[lib/repository/repository.ts:113](https://github.com/redis/redis-om-node/blob/8a196dc/lib/repository/repository.ts#L113) ___ @@ -149,7 +149,7 @@ that RediSearch or RedisJSON is installed on your instance of Redis. #### Defined in -[lib/repository/repository.ts:71](https://github.com/redis/redis-om-node/blob/80a8574/lib/repository/repository.ts#L71) +[lib/repository/repository.ts:77](https://github.com/redis/redis-om-node/blob/8a196dc/lib/repository/repository.ts#L77) ___ @@ -167,7 +167,7 @@ on your instance of Redis. #### Defined in -[lib/repository/repository.ts:90](https://github.com/redis/redis-om-node/blob/80a8574/lib/repository/repository.ts#L90) +[lib/repository/repository.ts:96](https://github.com/redis/redis-om-node/blob/8a196dc/lib/repository/repository.ts#L96) ___ @@ -193,7 +193,7 @@ The matching Entity. #### Defined in -[lib/repository/repository.ts:163](https://github.com/redis/redis-om-node/blob/80a8574/lib/repository/repository.ts#L163) +[lib/repository/repository.ts:169](https://github.com/redis/redis-om-node/blob/8a196dc/lib/repository/repository.ts#L169) ___ @@ -216,7 +216,7 @@ not found, does nothing. #### Defined in -[lib/repository/repository.ts:184](https://github.com/redis/redis-om-node/blob/80a8574/lib/repository/repository.ts#L184) +[lib/repository/repository.ts:190](https://github.com/redis/redis-om-node/blob/8a196dc/lib/repository/repository.ts#L190) ___ @@ -241,7 +241,7 @@ The ID of the Entity just saved. #### Defined in -[lib/repository/repository.ts:124](https://github.com/redis/redis-om-node/blob/80a8574/lib/repository/repository.ts#L124) +[lib/repository/repository.ts:130](https://github.com/redis/redis-om-node/blob/8a196dc/lib/repository/repository.ts#L130) ___ @@ -260,4 +260,4 @@ A [Search](Search.md) object. #### Defined in -[lib/repository/repository.ts:195](https://github.com/redis/redis-om-node/blob/80a8574/lib/repository/repository.ts#L195) +[lib/repository/repository.ts:201](https://github.com/redis/redis-om-node/blob/8a196dc/lib/repository/repository.ts#L201) diff --git a/docs/classes/Schema.md b/docs/classes/Schema.md index 7c3f71ea..0ea44f31 100644 --- a/docs/classes/Schema.md +++ b/docs/classes/Schema.md @@ -66,7 +66,7 @@ its constructor. #### Defined in -[lib/schema/schema.ts:54](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema.ts#L54) +[lib/schema/schema.ts:54](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema.ts#L54) ## Accessors @@ -83,7 +83,7 @@ that this Schema uses to store [Entities](Entity.md) in Redis. #### Defined in -[lib/schema/schema.ts:73](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema.ts#L73) +[lib/schema/schema.ts:73](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema.ts#L73) ___ @@ -99,7 +99,7 @@ The configured name for the RediSearch index for this Schema. #### Defined in -[lib/schema/schema.ts:67](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema.ts#L67) +[lib/schema/schema.ts:67](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema.ts#L67) ___ @@ -115,7 +115,7 @@ The configured keyspace prefix in Redis for this Schema. #### Defined in -[lib/schema/schema.ts:64](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema.ts#L64) +[lib/schema/schema.ts:64](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema.ts#L64) ___ @@ -132,7 +132,7 @@ than `CUSTOM`. #### Defined in -[lib/schema/schema.ts:86](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema.ts#L86) +[lib/schema/schema.ts:86](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema.ts#L86) ___ @@ -150,7 +150,7 @@ for more details. #### Defined in -[lib/schema/schema.ts:80](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema.ts#L80) +[lib/schema/schema.ts:80](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema.ts#L80) ## Methods @@ -166,4 +166,4 @@ Generates a unique string using the configured [IdStrategy](../README.md#idstrat #### Defined in -[lib/schema/schema.ts:95](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema.ts#L95) +[lib/schema/schema.ts:95](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema.ts#L95) diff --git a/docs/classes/Search.md b/docs/classes/Search.md index 76b2f087..b0e86f50 100644 --- a/docs/classes/Search.md +++ b/docs/classes/Search.md @@ -44,7 +44,7 @@ this #### Defined in -[lib/search/search.ts:52](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/search.ts#L52) +[lib/search/search.ts:52](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/search.ts#L52) ## Methods @@ -76,7 +76,7 @@ An array of [Entities](Entity.md) matching the query. #### Defined in -[lib/search/search.ts:94](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/search.ts#L94) +[lib/search/search.ts:94](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/search.ts#L94) ___ @@ -100,7 +100,7 @@ A subclass of [WhereField](WhereField.md) matching the type of the field. #### Defined in -[lib/search/search.ts:154](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/search.ts#L154) +[lib/search/search.ts:154](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/search.ts#L154) ▸ **and**(`subSearchFn`): [`Search`](Search.md)<`TEntity`\> @@ -120,7 +120,7 @@ Sets up a nested search as a logical AND. #### Defined in -[lib/search/search.ts:161](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/search.ts#L161) +[lib/search/search.ts:161](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/search.ts#L161) ___ @@ -136,7 +136,7 @@ Returns the number of [Entities](Entity.md) that match this query. #### Defined in -[lib/search/search.ts:60](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/search.ts#L60) +[lib/search/search.ts:60](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/search.ts#L60) ___ @@ -160,7 +160,7 @@ A subclass of [WhereField](WhereField.md) matching the type of the field. #### Defined in -[lib/search/search.ts:171](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/search.ts#L171) +[lib/search/search.ts:171](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/search.ts#L171) ▸ **or**(`subSearchFn`): [`Search`](Search.md)<`TEntity`\> @@ -180,7 +180,7 @@ Sets up a nested search as a logical OR. #### Defined in -[lib/search/search.ts:178](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/search.ts#L178) +[lib/search/search.ts:178](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/search.ts#L178) ___ @@ -205,7 +205,7 @@ An array of [Entities](Entity.md) matching the query. #### Defined in -[lib/search/search.ts:73](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/search.ts#L73) +[lib/search/search.ts:73](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/search.ts#L73) ___ @@ -228,7 +228,7 @@ Alias for [Search.all](Search.md#all). #### Defined in -[lib/search/search.ts:126](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/search.ts#L126) +[lib/search/search.ts:126](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/search.ts#L126) ___ @@ -244,7 +244,7 @@ Alias for [Search.count](Search.md#count). #### Defined in -[lib/search/search.ts:112](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/search.ts#L112) +[lib/search/search.ts:112](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/search.ts#L112) ___ @@ -267,7 +267,7 @@ Alias for [Search.page](Search.md#page). #### Defined in -[lib/search/search.ts:119](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/search.ts#L119) +[lib/search/search.ts:119](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/search.ts#L119) ___ @@ -292,7 +292,7 @@ A subclass of [WhereField](WhereField.md) matching the type of the field. #### Defined in -[lib/search/search.ts:136](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/search.ts#L136) +[lib/search/search.ts:136](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/search.ts#L136) ▸ **where**(`subSearchFn`): [`Search`](Search.md)<`TEntity`\> @@ -313,4 +313,4 @@ they are treated logically as AND. #### Defined in -[lib/search/search.ts:144](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/search.ts#L144) +[lib/search/search.ts:144](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/search.ts#L144) diff --git a/docs/classes/Where.md b/docs/classes/Where.md index 8861f09b..4a17e7ef 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/80a8574/lib/search/where.ts#L8) +[lib/search/where.ts:8](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where.ts#L8) diff --git a/docs/classes/WhereField.md b/docs/classes/WhereField.md index 8c757075..3713bdcb 100644 --- a/docs/classes/WhereField.md +++ b/docs/classes/WhereField.md @@ -72,7 +72,7 @@ this multiple times will have no effect. #### Defined in -[lib/search/where-field.ts:79](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L79) +[lib/search/where-field.ts:79](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L79) ___ @@ -87,7 +87,7 @@ this multiple times will have no effect. #### Defined in -[lib/search/where-field.ts:86](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L86) +[lib/search/where-field.ts:86](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L86) ## Accessors @@ -105,7 +105,7 @@ this #### Defined in -[lib/search/where-field.ts:227](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L227) +[lib/search/where-field.ts:227](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L227) ___ @@ -123,7 +123,7 @@ this #### Defined in -[lib/search/where-field.ts:219](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L219) +[lib/search/where-field.ts:219](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L219) ___ @@ -142,7 +142,7 @@ this #### Defined in -[lib/search/where-field.ts:236](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L236) +[lib/search/where-field.ts:236](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L236) ## Methods @@ -167,7 +167,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:162](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L162) +[lib/search/where-field.ts:162](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L162) ___ @@ -191,7 +191,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:169](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L169) +[lib/search/where-field.ts:169](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L169) ___ @@ -216,7 +216,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:184](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L184) +[lib/search/where-field.ts:184](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L184) ___ @@ -240,7 +240,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:176](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L176) +[lib/search/where-field.ts:176](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L176) ___ @@ -265,7 +265,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:192](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L192) +[lib/search/where-field.ts:192](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L192) ___ @@ -289,7 +289,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:16](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L16) +[lib/search/where-field.ts:16](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L16) ___ @@ -313,7 +313,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:23](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L23) +[lib/search/where-field.ts:23](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L23) ___ @@ -337,7 +337,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:37](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L37) +[lib/search/where-field.ts:37](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L37) ___ @@ -361,7 +361,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:30](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L30) +[lib/search/where-field.ts:30](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L30) ___ @@ -379,7 +379,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:98](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L98) +[lib/search/where-field.ts:98](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L98) ___ @@ -403,7 +403,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:112](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L112) +[lib/search/where-field.ts:112](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L112) ___ @@ -427,7 +427,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:126](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L126) +[lib/search/where-field.ts:126](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L126) ___ @@ -451,7 +451,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:105](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L105) +[lib/search/where-field.ts:105](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L105) ___ @@ -475,7 +475,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:119](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L119) +[lib/search/where-field.ts:119](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L119) ___ @@ -499,7 +499,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:140](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L140) +[lib/search/where-field.ts:140](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L140) ___ @@ -523,7 +523,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:154](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L154) +[lib/search/where-field.ts:154](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L154) ___ @@ -547,7 +547,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:133](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L133) +[lib/search/where-field.ts:133](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L133) ___ @@ -571,7 +571,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:147](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L147) +[lib/search/where-field.ts:147](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L147) ___ @@ -595,7 +595,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:44](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L44) +[lib/search/where-field.ts:44](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L44) ___ @@ -619,7 +619,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:58](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L58) +[lib/search/where-field.ts:58](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L58) ___ @@ -643,7 +643,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:65](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L65) +[lib/search/where-field.ts:65](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L65) ___ @@ -667,7 +667,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:51](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L51) +[lib/search/where-field.ts:51](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L51) ___ @@ -691,7 +691,7 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:72](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L72) +[lib/search/where-field.ts:72](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L72) ___ @@ -711,7 +711,7 @@ Converts this [Where](Where.md) into a portion of a RediSearch query. #### Defined in -[lib/search/where-field.ts:241](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L241) +[lib/search/where-field.ts:241](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L241) ___ @@ -729,4 +729,4 @@ The [Search](Search.md) that was called to create this [WhereField](WhereField.m #### Defined in -[lib/search/where-field.ts:92](https://github.com/redis/redis-om-node/blob/80a8574/lib/search/where-field.ts#L92) +[lib/search/where-field.ts:92](https://github.com/redis/redis-om-node/blob/8a196dc/lib/search/where-field.ts#L92) diff --git a/docs/interfaces/ArrayField.md b/docs/interfaces/ArrayField.md index ea0bf5d8..6c017731 100644 --- a/docs/interfaces/ArrayField.md +++ b/docs/interfaces/ArrayField.md @@ -33,7 +33,7 @@ The default field name in Redis is the key name defined in the #### Defined in -[lib/schema/schema-definitions.ts:7](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema-definitions.ts#L7) +[lib/schema/schema-definitions.ts:7](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema-definitions.ts#L7) ___ @@ -48,7 +48,7 @@ here to avoid those problems. Defaults to `|`. #### Defined in -[lib/schema/schema-definitions.ts:50](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema-definitions.ts#L50) +[lib/schema/schema-definitions.ts:50](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema-definitions.ts#L50) ___ @@ -60,4 +60,4 @@ Yep. It's an array. #### Defined in -[lib/schema/schema-definitions.ts:42](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema-definitions.ts#L42) +[lib/schema/schema-definitions.ts:42](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema-definitions.ts#L42) diff --git a/docs/interfaces/BooleanField.md b/docs/interfaces/BooleanField.md index 26938f14..938713ba 100644 --- a/docs/interfaces/BooleanField.md +++ b/docs/interfaces/BooleanField.md @@ -32,7 +32,7 @@ The default field name in Redis is the key name defined in the #### Defined in -[lib/schema/schema-definitions.ts:7](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema-definitions.ts#L7) +[lib/schema/schema-definitions.ts:7](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema-definitions.ts#L7) ___ @@ -44,4 +44,4 @@ Yep. It's a boolean. #### Defined in -[lib/schema/schema-definitions.ts:36](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema-definitions.ts#L36) +[lib/schema/schema-definitions.ts:36](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema-definitions.ts#L36) diff --git a/docs/interfaces/Field.md b/docs/interfaces/Field.md index 55c4cb28..fdeabdcf 100644 --- a/docs/interfaces/Field.md +++ b/docs/interfaces/Field.md @@ -33,4 +33,4 @@ The default field name in Redis is the key name defined in the #### Defined in -[lib/schema/schema-definitions.ts:7](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema-definitions.ts#L7) +[lib/schema/schema-definitions.ts:7](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema-definitions.ts#L7) diff --git a/docs/interfaces/NumericField.md b/docs/interfaces/NumericField.md index c25c2c84..69f6d206 100644 --- a/docs/interfaces/NumericField.md +++ b/docs/interfaces/NumericField.md @@ -32,7 +32,7 @@ The default field name in Redis is the key name defined in the #### Defined in -[lib/schema/schema-definitions.ts:7](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema-definitions.ts#L7) +[lib/schema/schema-definitions.ts:7](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema-definitions.ts#L7) ___ @@ -44,4 +44,4 @@ Yep. It's a number. #### Defined in -[lib/schema/schema-definitions.ts:13](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema-definitions.ts#L13) +[lib/schema/schema-definitions.ts:13](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema-definitions.ts#L13) diff --git a/docs/interfaces/StringField.md b/docs/interfaces/StringField.md index fac10bcd..d835e50a 100644 --- a/docs/interfaces/StringField.md +++ b/docs/interfaces/StringField.md @@ -34,7 +34,7 @@ The default field name in Redis is the key name defined in the #### Defined in -[lib/schema/schema-definitions.ts:7](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema-definitions.ts#L7) +[lib/schema/schema-definitions.ts:7](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema-definitions.ts#L7) ___ @@ -49,7 +49,7 @@ here to avoid those problems. Defaults to `|`. #### Defined in -[lib/schema/schema-definitions.ts:30](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema-definitions.ts#L30) +[lib/schema/schema-definitions.ts:30](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema-definitions.ts#L30) ___ @@ -61,7 +61,7 @@ Enables full-text search on this field when set to `true`. Defaults to `false`. #### Defined in -[lib/schema/schema-definitions.ts:22](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema-definitions.ts#L22) +[lib/schema/schema-definitions.ts:22](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema-definitions.ts#L22) ___ @@ -73,4 +73,4 @@ Yep. It's a string. #### Defined in -[lib/schema/schema-definitions.ts:19](https://github.com/redis/redis-om-node/blob/80a8574/lib/schema/schema-definitions.ts#L19) +[lib/schema/schema-definitions.ts:19](https://github.com/redis/redis-om-node/blob/8a196dc/lib/schema/schema-definitions.ts#L19) diff --git a/lib/index.ts b/lib/index.ts index dd511f60..b66d261f 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,7 +1,7 @@ import Client, { SearchDataStructure, HashData, JsonData } from "./client"; import Entity, { EntityConstructor, EntityData } from "./entity/entity"; import RedisError from "./errors"; -import Repository from "./repository/repository"; +import Repository, { EntityCreationData } from "./repository/repository"; import Schema from "./schema/schema"; import { SchemaDefinition, FieldDefinition, Field, NumericField, StringField, BooleanField, ArrayField, IdStrategy, StopWordOptions } from "./schema/schema-definitions"; @@ -15,7 +15,7 @@ export { Client, SearchDataStructure, HashData, JsonData, Entity, EntityConstructor, EntityData, RedisError, - Repository, + Repository, EntityCreationData, Schema, SchemaDefinition, SchemaOptions, FieldDefinition, Field, NumericField, StringField, BooleanField, ArrayField, IdStrategy, StopWordOptions, Search, SubSearchFunction, diff --git a/lib/repository/repository.ts b/lib/repository/repository.ts index 92668f99..219767e8 100644 --- a/lib/repository/repository.ts +++ b/lib/repository/repository.ts @@ -7,6 +7,12 @@ import { EntityData } from '../entity/entity'; import HashConverter from "./hash-converter"; import JsonConverter from "./json-converter"; +/** + * Initialization data for {@link Entity} creation when calling + * {@link Repository.createEntity} or {@link Repository.createAndSave}. + */ +export type EntityCreationData = Record; + /** * A repository is the main interaction point for reading, writing, and * removing {@link Entity | Entities} from Redis. Create one by passing @@ -104,7 +110,7 @@ export default class Repository { * @param data Optional values with which to initialize the entity. * @returns A newly created Entity. */ - createEntity(data: EntityData = {}): TEntity { + createEntity(data: EntityCreationData = {}): TEntity { let id = this.schema.generateId(); let entity = new this.schema.entityCtor(id); for (let key in data) { @@ -147,7 +153,7 @@ export default class Repository { * @param data Optional values with which to initialize the entity. * @returns The newly created and saved Entity. */ - async createAndSave(data: EntityData = {}): Promise { + async createAndSave(data: EntityCreationData = {}): Promise { let entity = this.createEntity(data); await this.save(entity) return entity