redis-type-os 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/.nojekyll ADDED
@@ -0,0 +1 @@
1
+ TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
package/docs/README.md ADDED
@@ -0,0 +1,479 @@
1
+ redis-om
2
+
3
+ # redis-om
4
+
5
+ ## Table of contents
6
+
7
+ ### Classes
8
+
9
+ - [AbstractSearch](classes/AbstractSearch.md)
10
+ - [ArrayHashInput](classes/ArrayHashInput.md)
11
+ - [Circle](classes/Circle.md)
12
+ - [Client](classes/Client.md)
13
+ - [Field](classes/Field.md)
14
+ - [FieldNotInSchema](classes/FieldNotInSchema.md)
15
+ - [InvalidHashInput](classes/InvalidHashInput.md)
16
+ - [InvalidHashValue](classes/InvalidHashValue.md)
17
+ - [InvalidInput](classes/InvalidInput.md)
18
+ - [InvalidJsonInput](classes/InvalidJsonInput.md)
19
+ - [InvalidJsonValue](classes/InvalidJsonValue.md)
20
+ - [InvalidSchema](classes/InvalidSchema.md)
21
+ - [InvalidValue](classes/InvalidValue.md)
22
+ - [NestedHashInput](classes/NestedHashInput.md)
23
+ - [NullJsonInput](classes/NullJsonInput.md)
24
+ - [NullJsonValue](classes/NullJsonValue.md)
25
+ - [PointOutOfRange](classes/PointOutOfRange.md)
26
+ - [RawSearch](classes/RawSearch.md)
27
+ - [RedisOmError](classes/RedisOmError.md)
28
+ - [Repository](classes/Repository.md)
29
+ - [Schema](classes/Schema.md)
30
+ - [Search](classes/Search.md)
31
+ - [SearchError](classes/SearchError.md)
32
+ - [SemanticSearchError](classes/SemanticSearchError.md)
33
+ - [Where](classes/Where.md)
34
+ - [WhereField](classes/WhereField.md)
35
+
36
+ ### Type Aliases
37
+
38
+ - [AllFieldDefinition](README.md#allfielddefinition)
39
+ - [BooleanFieldDefinition](README.md#booleanfielddefinition)
40
+ - [CircleFunction](README.md#circlefunction)
41
+ - [CommonFieldDefinition](README.md#commonfielddefinition)
42
+ - [DataStructure](README.md#datastructure)
43
+ - [DateFieldDefinition](README.md#datefielddefinition)
44
+ - [Entity](README.md#entity)
45
+ - [EntityData](README.md#entitydata)
46
+ - [EntityDataValue](README.md#entitydatavalue)
47
+ - [FieldDefinition](README.md#fielddefinition)
48
+ - [FieldType](README.md#fieldtype)
49
+ - [IdStrategy](README.md#idstrategy)
50
+ - [NumberArrayFieldDefinition](README.md#numberarrayfielddefinition)
51
+ - [NumberFieldDefinition](README.md#numberfielddefinition)
52
+ - [Point](README.md#point)
53
+ - [PointFieldDefinition](README.md#pointfielddefinition)
54
+ - [RedisClientConnection](README.md#redisclientconnection)
55
+ - [RedisClusterConnection](README.md#redisclusterconnection)
56
+ - [RedisConnection](README.md#redisconnection)
57
+ - [SchemaDefinition](README.md#schemadefinition)
58
+ - [SchemaOptions](README.md#schemaoptions)
59
+ - [StopWordOptions](README.md#stopwordoptions)
60
+ - [StringArrayFieldDefinition](README.md#stringarrayfielddefinition)
61
+ - [StringFieldDefinition](README.md#stringfielddefinition)
62
+ - [SubSearchFunction](README.md#subsearchfunction)
63
+ - [TextFieldDefinition](README.md#textfielddefinition)
64
+
65
+ ### Variables
66
+
67
+ - [EntityId](README.md#entityid)
68
+ - [EntityKeyName](README.md#entitykeyname)
69
+
70
+ ## Type Aliases
71
+
72
+ ### AllFieldDefinition
73
+
74
+ Ƭ **AllFieldDefinition**: `Object`
75
+
76
+ All configuration properties that any field might have, regardless of type.
77
+
78
+ #### Type declaration
79
+
80
+ | Name | Type | Description |
81
+ | :------ | :------ | :------ |
82
+ | `alias?` | `string` | The default field name in Redis is the property name defined in the [SchemaDefinition](README.md#schemadefinition). Overrides the field name for a Hash to this value or in the case of JSON documents, sets the JSONPath to this value preceded by `$.`. Overridden by [field](README.md#field) and/or [path](README.md#path) settings. **`Deprecated`** |
83
+ | `caseSensitive?` | `boolean` | Is the original case of this field indexed with Redis OM. Defaults to false. |
84
+ | `field?` | `string` | The field name used to store this in a Redis Hash. Defaults to the name used in the [SchemaDefinition](README.md#schemadefinition) or the [alias](README.md#alias) property. |
85
+ | `indexed?` | `boolean` | Is this field indexed and thus searchable with Redis OM. Defaults to true. |
86
+ | `matcher?` | ``"dm:en"`` \| ``"dm:fr"`` \| ``"dm:pt"`` \| ``"dm:es"`` | Enables setting the phonetic matcher to use, supported matchers are: dm:en - Double Metaphone for English dm:fr - Double Metaphone for French dm:pt - Double Metaphone for Portuguese dm:es - Double Metaphone for Spanish |
87
+ | `normalized?` | `boolean` | Is this (sortable) field normalized when indexed. Defaults to true. |
88
+ | `path?` | `string` | The JSONPath expression this field references. Used only by search and only for JSON documents. Defaults to the name used in the [SchemaDefinition](README.md#schemadefinition) or the [alias](README.md#alias) property prefixed with `$.` . |
89
+ | `separator?` | `string` | Due to how RediSearch works, strings and arrays are sometimes stored the same in Redis, as a simple string. This is the separator used to split those strings when it is an array. If your StringField contains this separator, this can cause problems. You can change it here to avoid those problems. Defaults to `\|`. |
90
+ | `sortable?` | `boolean` | Enables sorting by this field. |
91
+ | `stemming?` | `boolean` | Is word stemming applied to this field with Redis OM. Defaults to true. |
92
+ | `type` | [`FieldType`](README.md#fieldtype) | The type of the field (i.e. string, number, boolean, etc.) |
93
+ | `weight?` | `number` | Enables setting the weight to apply to a text field |
94
+
95
+ #### Defined in
96
+
97
+ [lib/schema/definitions.ts:5](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L5)
98
+
99
+ ___
100
+
101
+ ### BooleanFieldDefinition
102
+
103
+ Ƭ **BooleanFieldDefinition**: { `type`: ``"boolean"`` } & [`CommonFieldDefinition`](README.md#commonfielddefinition) & `Pick`<[`AllFieldDefinition`](README.md#allfielddefinition), ``"sortable"``\>
104
+
105
+ A field representing a boolean.
106
+
107
+ #### Defined in
108
+
109
+ [lib/schema/definitions.ts:78](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L78)
110
+
111
+ ___
112
+
113
+ ### CircleFunction
114
+
115
+ Ƭ **CircleFunction**: (`circle`: [`Circle`](classes/Circle.md)) => [`Circle`](classes/Circle.md)
116
+
117
+ #### Type declaration
118
+
119
+ ▸ (`circle`): [`Circle`](classes/Circle.md)
120
+
121
+ A function that defines a circle for `.inCircle` searches.
122
+
123
+ ##### Parameters
124
+
125
+ | Name | Type |
126
+ | :------ | :------ |
127
+ | `circle` | [`Circle`](classes/Circle.md) |
128
+
129
+ ##### Returns
130
+
131
+ [`Circle`](classes/Circle.md)
132
+
133
+ #### Defined in
134
+
135
+ [lib/search/where-point.ts:8](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/where-point.ts#L8)
136
+
137
+ ___
138
+
139
+ ### CommonFieldDefinition
140
+
141
+ Ƭ **CommonFieldDefinition**: `Pick`<[`AllFieldDefinition`](README.md#allfielddefinition), ``"type"`` \| ``"alias"`` \| ``"indexed"`` \| ``"field"`` \| ``"path"``\>
142
+
143
+ The configuration properties that all fields have in common.
144
+
145
+ #### Defined in
146
+
147
+ [lib/schema/definitions.ts:75](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L75)
148
+
149
+ ___
150
+
151
+ ### DataStructure
152
+
153
+ Ƭ **DataStructure**: ``"HASH"`` \| ``"JSON"``
154
+
155
+ The type of data structure in Redis to map objects to.
156
+
157
+ #### Defined in
158
+
159
+ [lib/schema/options.ts:2](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/options.ts#L2)
160
+
161
+ ___
162
+
163
+ ### DateFieldDefinition
164
+
165
+ Ƭ **DateFieldDefinition**: { `type`: ``"date"`` } & [`CommonFieldDefinition`](README.md#commonfielddefinition) & `Pick`<[`AllFieldDefinition`](README.md#allfielddefinition), ``"sortable"``\>
166
+
167
+ A field representing a date/time.
168
+
169
+ #### Defined in
170
+
171
+ [lib/schema/definitions.ts:83](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L83)
172
+
173
+ ___
174
+
175
+ ### Entity
176
+
177
+ Ƭ **Entity**: [`EntityData`](README.md#entitydata) & { `[EntityId]?`: `string` ; `[EntityKeyName]?`: `string` }
178
+
179
+ Defines the objects returned from calls to [repositories](classes/Repository.md).
180
+
181
+ #### Defined in
182
+
183
+ [lib/entity/entity.ts:8](https://github.com/redis/redis-om-node/blob/d8438f7/lib/entity/entity.ts#L8)
184
+
185
+ ___
186
+
187
+ ### EntityData
188
+
189
+ Ƭ **EntityData**: `Object`
190
+
191
+ The free-form data associated with an [Entity](README.md#entity).
192
+
193
+ #### Index signature
194
+
195
+ ▪ [key: `string`]: [`EntityDataValue`](README.md#entitydatavalue) \| [`EntityData`](README.md#entitydata) \| ([`EntityDataValue`](README.md#entitydatavalue) \| [`EntityData`](README.md#entitydata))[]
196
+
197
+ #### Defined in
198
+
199
+ [lib/entity/entity.ts:18](https://github.com/redis/redis-om-node/blob/d8438f7/lib/entity/entity.ts#L18)
200
+
201
+ ___
202
+
203
+ ### EntityDataValue
204
+
205
+ Ƭ **EntityDataValue**: `string` \| `number` \| `boolean` \| `Date` \| [`Point`](README.md#point) \| ``null`` \| `undefined` \| ([`EntityDataValue`](README.md#entitydatavalue) \| [`EntityData`](README.md#entitydata))[]
206
+
207
+ Valid types for values in an [Entity](README.md#entity).
208
+
209
+ #### Defined in
210
+
211
+ [lib/entity/entity.ts:23](https://github.com/redis/redis-om-node/blob/d8438f7/lib/entity/entity.ts#L23)
212
+
213
+ ___
214
+
215
+ ### FieldDefinition
216
+
217
+ Ƭ **FieldDefinition**: [`BooleanFieldDefinition`](README.md#booleanfielddefinition) \| [`DateFieldDefinition`](README.md#datefielddefinition) \| [`NumberFieldDefinition`](README.md#numberfielddefinition) \| [`NumberArrayFieldDefinition`](README.md#numberarrayfielddefinition) \| [`PointFieldDefinition`](README.md#pointfielddefinition) \| [`StringFieldDefinition`](README.md#stringfielddefinition) \| [`StringArrayFieldDefinition`](README.md#stringarrayfielddefinition) \| [`TextFieldDefinition`](README.md#textfielddefinition)
218
+
219
+ Contains instructions telling how to map a property on an [Entity](README.md#entity) to Redis.
220
+
221
+ #### Defined in
222
+
223
+ [lib/schema/definitions.ts:117](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L117)
224
+
225
+ ___
226
+
227
+ ### FieldType
228
+
229
+ Ƭ **FieldType**: ``"boolean"`` \| ``"date"`` \| ``"number"`` \| ``"number[]"`` \| ``"point"`` \| ``"string"`` \| ``"string[]"`` \| ``"text"``
230
+
231
+ Valid field types for a [FieldDefinition](README.md#fielddefinition).
232
+
233
+ #### Defined in
234
+
235
+ [lib/schema/definitions.ts:2](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L2)
236
+
237
+ ___
238
+
239
+ ### IdStrategy
240
+
241
+ Ƭ **IdStrategy**: () => `Promise`<`string`\>
242
+
243
+ #### Type declaration
244
+
245
+ ▸ (): `Promise`<`string`\>
246
+
247
+ A function that generates random entityIds.
248
+
249
+ ##### Returns
250
+
251
+ `Promise`<`string`\>
252
+
253
+ #### Defined in
254
+
255
+ [lib/schema/options.ts:5](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/options.ts#L5)
256
+
257
+ ___
258
+
259
+ ### NumberArrayFieldDefinition
260
+
261
+ Ƭ **NumberArrayFieldDefinition**: { `type`: ``"number[]"`` } & [`CommonFieldDefinition`](README.md#commonfielddefinition) & `Pick`<[`AllFieldDefinition`](README.md#allfielddefinition), ``"sortable"``\>
262
+
263
+ A field representing an array of numbers.
264
+
265
+ #### Defined in
266
+
267
+ [lib/schema/definitions.ts:93](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L93)
268
+
269
+ ___
270
+
271
+ ### NumberFieldDefinition
272
+
273
+ Ƭ **NumberFieldDefinition**: { `type`: ``"number"`` } & [`CommonFieldDefinition`](README.md#commonfielddefinition) & `Pick`<[`AllFieldDefinition`](README.md#allfielddefinition), ``"sortable"``\>
274
+
275
+ A field representing a number.
276
+
277
+ #### Defined in
278
+
279
+ [lib/schema/definitions.ts:88](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L88)
280
+
281
+ ___
282
+
283
+ ### Point
284
+
285
+ Ƭ **Point**: `Object`
286
+
287
+ Defines a point on the globe using longitude and latitude.
288
+
289
+ #### Type declaration
290
+
291
+ | Name | Type | Description |
292
+ | :------ | :------ | :------ |
293
+ | `latitude` | `number` | The latitude of the point. |
294
+ | `longitude` | `number` | The longitude of the point. |
295
+
296
+ #### Defined in
297
+
298
+ [lib/entity/entity.ts:26](https://github.com/redis/redis-om-node/blob/d8438f7/lib/entity/entity.ts#L26)
299
+
300
+ ___
301
+
302
+ ### PointFieldDefinition
303
+
304
+ Ƭ **PointFieldDefinition**: { `type`: ``"point"`` } & [`CommonFieldDefinition`](README.md#commonfielddefinition)
305
+
306
+ A field representing a point on the globe.
307
+
308
+ #### Defined in
309
+
310
+ [lib/schema/definitions.ts:98](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L98)
311
+
312
+ ___
313
+
314
+ ### RedisClientConnection
315
+
316
+ Ƭ **RedisClientConnection**: `ReturnType`<typeof `createClient`\>
317
+
318
+ A conventional Redis connection.
319
+
320
+ #### Defined in
321
+
322
+ [lib/client/client.ts:8](https://github.com/redis/redis-om-node/blob/d8438f7/lib/client/client.ts#L8)
323
+
324
+ ___
325
+
326
+ ### RedisClusterConnection
327
+
328
+ Ƭ **RedisClusterConnection**: `ReturnType`<typeof `createCluster`\>
329
+
330
+ A clustered Redis connection.
331
+
332
+ #### Defined in
333
+
334
+ [lib/client/client.ts:11](https://github.com/redis/redis-om-node/blob/d8438f7/lib/client/client.ts#L11)
335
+
336
+ ___
337
+
338
+ ### RedisConnection
339
+
340
+ Ƭ **RedisConnection**: [`RedisClientConnection`](README.md#redisclientconnection) \| [`RedisClusterConnection`](README.md#redisclusterconnection)
341
+
342
+ A Redis connection, clustered or conventional.
343
+
344
+ #### Defined in
345
+
346
+ [lib/client/client.ts:14](https://github.com/redis/redis-om-node/blob/d8438f7/lib/client/client.ts#L14)
347
+
348
+ ___
349
+
350
+ ### SchemaDefinition
351
+
352
+ Ƭ **SchemaDefinition**: `Record`<`string`, [`FieldDefinition`](README.md#fielddefinition)\>
353
+
354
+ Group of [FieldDefinition](README.md#fielddefinition)s that define the schema for an [Entity](README.md#entity).
355
+
356
+ #### Defined in
357
+
358
+ [lib/schema/definitions.ts:123](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L123)
359
+
360
+ ___
361
+
362
+ ### SchemaOptions
363
+
364
+ Ƭ **SchemaOptions**: `Object`
365
+
366
+ Configuration options for a [Schema](classes/Schema.md).
367
+
368
+ #### Type declaration
369
+
370
+ | Name | Type | Description |
371
+ | :------ | :------ | :------ |
372
+ | `dataStructure?` | [`DataStructure`](README.md#datastructure) | The data structure used to store the [Entity](README.md#entity) in Redis. Can be set to either `JSON` or `HASH`. Defaults to JSON. |
373
+ | `idStrategy?` | [`IdStrategy`](README.md#idstrategy) | A function that generates a random entityId. Defaults to a function that generates [ULIDs](https://github.com/ulid/spec). Combined with prefix to generate a Redis key. If prefix is `Foo` and idStratgey returns `12345` then the generated key would be `Foo:12345`. |
374
+ | `indexHashName?` | `string` | The name used by Redis OM to store the hash of the index for this [Schema](classes/Schema.md). Defaults to prefix followed by `:index:hash`. So, for a prefix of `Foo`, it would use `Foo:index:hash`. |
375
+ | `indexName?` | `string` | The name used by RediSearch to store the index for this [Schema](classes/Schema.md). Defaults to prefix followed by `:index`. So, for a prefix of `Foo`, it would use `Foo:index`. |
376
+ | `stopWords?` | `string`[] | Stop words to be used by this schema. If `useStopWords` is anything other than `CUSTOM`, this option is ignored. |
377
+ | `useStopWords?` | [`StopWordOptions`](README.md#stopwordoptions) | Configures the usage of stop words. Valid values are `OFF`, `DEFAULT`, and `CUSTOM`. Setting this to `OFF` disables all stop words. Setting this to `DEFAULT` uses the stop words intrinsic to RediSearch. Setting this to `CUSTOM` tells RediSearch to use the stop words in `stopWords`. |
378
+
379
+ #### Defined in
380
+
381
+ [lib/schema/options.ts:11](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/options.ts#L11)
382
+
383
+ ___
384
+
385
+ ### StopWordOptions
386
+
387
+ Ƭ **StopWordOptions**: ``"OFF"`` \| ``"DEFAULT"`` \| ``"CUSTOM"``
388
+
389
+ Valid values for how to use stop words for a given [Schema](classes/Schema.md).
390
+
391
+ #### Defined in
392
+
393
+ [lib/schema/options.ts:8](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/options.ts#L8)
394
+
395
+ ___
396
+
397
+ ### StringArrayFieldDefinition
398
+
399
+ Ƭ **StringArrayFieldDefinition**: { `type`: ``"string[]"`` } & [`CommonFieldDefinition`](README.md#commonfielddefinition) & `Pick`<[`AllFieldDefinition`](README.md#allfielddefinition), ``"sortable"`` \| ``"caseSensitive"`` \| ``"normalized"`` \| ``"separator"``\>
400
+
401
+ A field representing an array of strings.
402
+
403
+ #### Defined in
404
+
405
+ [lib/schema/definitions.ts:107](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L107)
406
+
407
+ ___
408
+
409
+ ### StringFieldDefinition
410
+
411
+ Ƭ **StringFieldDefinition**: { `type`: ``"string"`` } & [`CommonFieldDefinition`](README.md#commonfielddefinition) & `Pick`<[`AllFieldDefinition`](README.md#allfielddefinition), ``"sortable"`` \| ``"caseSensitive"`` \| ``"normalized"`` \| ``"separator"``\>
412
+
413
+ A field representing a whole string.
414
+
415
+ #### Defined in
416
+
417
+ [lib/schema/definitions.ts:102](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L102)
418
+
419
+ ___
420
+
421
+ ### SubSearchFunction
422
+
423
+ Ƭ **SubSearchFunction**: (`search`: [`Search`](classes/Search.md)) => [`Search`](classes/Search.md)
424
+
425
+ #### Type declaration
426
+
427
+ ▸ (`search`): [`Search`](classes/Search.md)
428
+
429
+ A function that takes a [Search](classes/Search.md) and returns a [Search](classes/Search.md). Used in nested queries.
430
+
431
+ ##### Parameters
432
+
433
+ | Name | Type |
434
+ | :------ | :------ |
435
+ | `search` | [`Search`](classes/Search.md) |
436
+
437
+ ##### Returns
438
+
439
+ [`Search`](classes/Search.md)
440
+
441
+ #### Defined in
442
+
443
+ [lib/search/search.ts:26](https://github.com/redis/redis-om-node/blob/d8438f7/lib/search/search.ts#L26)
444
+
445
+ ___
446
+
447
+ ### TextFieldDefinition
448
+
449
+ Ƭ **TextFieldDefinition**: { `type`: ``"text"`` } & [`CommonFieldDefinition`](README.md#commonfielddefinition) & `Pick`<[`AllFieldDefinition`](README.md#allfielddefinition), ``"sortable"`` \| ``"normalized"`` \| ``"matcher"`` \| ``"stemming"`` \| ``"weight"``\>
450
+
451
+ A field representing searchable text.
452
+
453
+ #### Defined in
454
+
455
+ [lib/schema/definitions.ts:112](https://github.com/redis/redis-om-node/blob/d8438f7/lib/schema/definitions.ts#L112)
456
+
457
+ ## Variables
458
+
459
+ ### EntityId
460
+
461
+ • `Const` **EntityId**: typeof [`EntityId`](README.md#entityid)
462
+
463
+ The Symbol used to access the entity ID of an [Entity](README.md#entity).
464
+
465
+ #### Defined in
466
+
467
+ [lib/entity/entity.ts:2](https://github.com/redis/redis-om-node/blob/d8438f7/lib/entity/entity.ts#L2)
468
+
469
+ ___
470
+
471
+ ### EntityKeyName
472
+
473
+ • `Const` **EntityKeyName**: typeof [`EntityKeyName`](README.md#entitykeyname)
474
+
475
+ The Symbol used to access the keyname of an [Entity](README.md#entity).
476
+
477
+ #### Defined in
478
+
479
+ [lib/entity/entity.ts:5](https://github.com/redis/redis-om-node/blob/d8438f7/lib/entity/entity.ts#L5)