-first commit

This commit is contained in:
2025-11-11 12:36:06 +07:00
commit b99c214434
5683 changed files with 713336 additions and 0 deletions

121
node_modules/@redis/search/README.md generated vendored Normal file
View File

@@ -0,0 +1,121 @@
# @redis/search
This package provides support for the [RediSearch](https://redis.io/docs/interact/search-and-query/) module, which adds indexing and querying support for data stored in Redis Hashes or as JSON documents with the [RedisJSON](https://redis.io/docs/data-types/json/) module.
Should be used with [`redis`/`@redis/client`](https://github.com/redis/node-redis).
:warning: To use these extra commands, your Redis server must have the RediSearch module installed. To index and query JSON documents, you'll also need to add the RedisJSON module.
## Usage
For complete examples, see [`search-hashes.js`](https://github.com/redis/node-redis/blob/master/examples/search-hashes.js) and [`search-json.js`](https://github.com/redis/node-redis/blob/master/examples/search-json.js) in the [examples folder](https://github.com/redis/node-redis/tree/master/examples).
### Indexing and Querying Data in Redis Hashes
#### Creating an Index
Before we can perform any searches, we need to tell RediSearch how to index our data, and which Redis keys to find that data in. The [FT.CREATE](https://redis.io/commands/ft.create) command creates a RediSearch index. Here's how to use it to create an index we'll call `idx:animals` where we want to index hashes containing `name`, `species` and `age` fields, and whose key names in Redis begin with the prefix `noderedis:animals`:
```javascript
await client.ft.create('idx:animals', {
name: {
type: SCHEMA_FIELD_TYPE.TEXT,
SORTABLE: true
},
species: SCHEMA_FIELD_TYPE.TAG,
age: SCHEMA_FIELD_TYPE.NUMERIC
}, {
ON: 'HASH',
PREFIX: 'noderedis:animals'
});
```
See the [`FT.CREATE` documentation](https://redis.io/commands/ft.create/#description) for information about the different field types and additional options.
#### Querying the Index
Once we've created an index, and added some data to Redis hashes whose keys begin with the prefix `noderedis:animals`, we can start writing some search queries. RediSearch supports a rich query syntax for full-text search, faceted search, aggregation and more. Check out the [`FT.SEARCH` documentation](https://redis.io/commands/ft.search) and the [query syntax reference](https://redis.io/docs/interact/search-and-query/query) for more information.
Let's write a query to find all the animals where the `species` field has the value `dog`:
```javascript
const results = await client.ft.search('idx:animals', '@species:{dog}');
```
`results` looks like this:
```javascript
{
total: 2,
documents: [
{
id: 'noderedis:animals:4',
value: {
name: 'Fido',
species: 'dog',
age: '7'
}
},
{
id: 'noderedis:animals:3',
value: {
name: 'Rover',
species: 'dog',
age: '9'
}
}
]
}
```
### Indexing and Querying Data with RedisJSON
RediSearch can also index and query JSON documents stored in Redis using the RedisJSON module. The approach is similar to that for indexing and searching data in hashes, but we can now use JSON Path like syntax and the data no longer has to be flat name/value pairs - it can contain nested objects and arrays.
#### Creating an Index
As before, we create an index with the `FT.CREATE` command, this time specifying we want to index JSON documents that look like this:
```javascript
{
name: 'Alice',
age: 32,
coins: 100
}
```
Each document represents a user in some system, and users have name, age and coins properties.
One way we might choose to index these documents is as follows:
```javascript
await client.ft.create('idx:users', {
'$.name': {
type: SCHEMA_FIELD_TYPE.TEXT,
SORTABLE: 'UNF'
},
'$.age': {
type: SCHEMA_FIELD_TYPE.NUMERIC,
AS: 'age'
},
'$.coins': {
type: SCHEMA_FIELD_TYPE.NUMERIC,
AS: 'coins'
}
}, {
ON: 'JSON',
PREFIX: 'noderedis:users'
});
```
Note that we're using JSON Path to specify where the fields to index are in our JSON documents, and the `AS` clause to define a name/alias for each field. We'll use these when writing queries.
#### Querying the Index
Now we have an index and some data stored as JSON documents in Redis (see the [JSON package documentation](https://github.com/redis/node-redis/tree/master/packages/json) for examples of how to store JSON), we can write some queries...
We'll use the [RediSearch query language](https://redis.io/docs/interact/search-and-query/query) and [`FT.SEARCH`](https://redis.io/commands/ft.search) command. Here's a query to find users under the age of 30:
```javascript
await client.ft.search('idx:users', '@age:[0 30]');
```

View File

@@ -0,0 +1,130 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { ArrayReply, BlobStringReply, MapReply, NumberReply, RedisArgument, ReplyUnion, TypeMapping, UnwrapReply } from '@redis/client/dist/lib/RESP/types';
import { RediSearchProperty } from './CREATE';
import { FtSearchParams } from './SEARCH';
type LoadField = RediSearchProperty | {
identifier: RediSearchProperty;
AS?: RedisArgument;
};
export declare const FT_AGGREGATE_STEPS: {
readonly GROUPBY: "GROUPBY";
readonly SORTBY: "SORTBY";
readonly APPLY: "APPLY";
readonly LIMIT: "LIMIT";
readonly FILTER: "FILTER";
};
type FT_AGGREGATE_STEPS = typeof FT_AGGREGATE_STEPS;
export type FtAggregateStep = FT_AGGREGATE_STEPS[keyof FT_AGGREGATE_STEPS];
interface AggregateStep<T extends FtAggregateStep> {
type: T;
}
export declare const FT_AGGREGATE_GROUP_BY_REDUCERS: {
readonly COUNT: "COUNT";
readonly COUNT_DISTINCT: "COUNT_DISTINCT";
readonly COUNT_DISTINCTISH: "COUNT_DISTINCTISH";
readonly SUM: "SUM";
readonly MIN: "MIN";
readonly MAX: "MAX";
readonly AVG: "AVG";
readonly STDDEV: "STDDEV";
readonly QUANTILE: "QUANTILE";
readonly TOLIST: "TOLIST";
readonly FIRST_VALUE: "FIRST_VALUE";
readonly RANDOM_SAMPLE: "RANDOM_SAMPLE";
};
type FT_AGGREGATE_GROUP_BY_REDUCERS = typeof FT_AGGREGATE_GROUP_BY_REDUCERS;
export type FtAggregateGroupByReducer = FT_AGGREGATE_GROUP_BY_REDUCERS[keyof FT_AGGREGATE_GROUP_BY_REDUCERS];
interface GroupByReducer<T extends FtAggregateGroupByReducer> {
type: T;
AS?: RedisArgument;
}
interface GroupByReducerWithProperty<T extends FtAggregateGroupByReducer> extends GroupByReducer<T> {
property: RediSearchProperty;
}
type CountReducer = GroupByReducer<FT_AGGREGATE_GROUP_BY_REDUCERS['COUNT']>;
type CountDistinctReducer = GroupByReducerWithProperty<FT_AGGREGATE_GROUP_BY_REDUCERS['COUNT_DISTINCT']>;
type CountDistinctishReducer = GroupByReducerWithProperty<FT_AGGREGATE_GROUP_BY_REDUCERS['COUNT_DISTINCTISH']>;
type SumReducer = GroupByReducerWithProperty<FT_AGGREGATE_GROUP_BY_REDUCERS['SUM']>;
type MinReducer = GroupByReducerWithProperty<FT_AGGREGATE_GROUP_BY_REDUCERS['MIN']>;
type MaxReducer = GroupByReducerWithProperty<FT_AGGREGATE_GROUP_BY_REDUCERS['MAX']>;
type AvgReducer = GroupByReducerWithProperty<FT_AGGREGATE_GROUP_BY_REDUCERS['AVG']>;
type StdDevReducer = GroupByReducerWithProperty<FT_AGGREGATE_GROUP_BY_REDUCERS['STDDEV']>;
interface QuantileReducer extends GroupByReducerWithProperty<FT_AGGREGATE_GROUP_BY_REDUCERS['QUANTILE']> {
quantile: number;
}
type ToListReducer = GroupByReducerWithProperty<FT_AGGREGATE_GROUP_BY_REDUCERS['TOLIST']>;
interface FirstValueReducer extends GroupByReducerWithProperty<FT_AGGREGATE_GROUP_BY_REDUCERS['FIRST_VALUE']> {
BY?: RediSearchProperty | {
property: RediSearchProperty;
direction?: 'ASC' | 'DESC';
};
}
interface RandomSampleReducer extends GroupByReducerWithProperty<FT_AGGREGATE_GROUP_BY_REDUCERS['RANDOM_SAMPLE']> {
sampleSize: number;
}
type GroupByReducers = CountReducer | CountDistinctReducer | CountDistinctishReducer | SumReducer | MinReducer | MaxReducer | AvgReducer | StdDevReducer | QuantileReducer | ToListReducer | FirstValueReducer | RandomSampleReducer;
interface GroupByStep extends AggregateStep<FT_AGGREGATE_STEPS['GROUPBY']> {
properties?: RediSearchProperty | Array<RediSearchProperty>;
REDUCE: GroupByReducers | Array<GroupByReducers>;
}
type SortByProperty = RedisArgument | {
BY: RediSearchProperty;
DIRECTION?: 'ASC' | 'DESC';
};
interface SortStep extends AggregateStep<FT_AGGREGATE_STEPS['SORTBY']> {
BY: SortByProperty | Array<SortByProperty>;
MAX?: number;
}
interface ApplyStep extends AggregateStep<FT_AGGREGATE_STEPS['APPLY']> {
expression: RedisArgument;
AS: RedisArgument;
}
interface LimitStep extends AggregateStep<FT_AGGREGATE_STEPS['LIMIT']> {
from: number;
size: number;
}
interface FilterStep extends AggregateStep<FT_AGGREGATE_STEPS['FILTER']> {
expression: RedisArgument;
}
export interface FtAggregateOptions {
VERBATIM?: boolean;
ADDSCORES?: boolean;
LOAD?: LoadField | Array<LoadField>;
TIMEOUT?: number;
STEPS?: Array<GroupByStep | SortStep | ApplyStep | LimitStep | FilterStep>;
PARAMS?: FtSearchParams;
DIALECT?: number;
}
export type AggregateRawReply = [
total: UnwrapReply<NumberReply>,
...results: UnwrapReply<ArrayReply<ArrayReply<BlobStringReply>>>
];
export interface AggregateReply {
total: number;
results: Array<MapReply<BlobStringReply, BlobStringReply>>;
}
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: false;
/**
* Performs an aggregation query on a RediSearch index.
* @param parser - The command parser
* @param index - The index name to query
* @param query - The text query to use as filter, use * to indicate no filtering
* @param options - Optional parameters for aggregation:
* - VERBATIM: disable stemming in query evaluation
* - LOAD: specify fields to load from documents
* - STEPS: sequence of aggregation steps (GROUPBY, SORTBY, APPLY, LIMIT, FILTER)
* - PARAMS: bind parameters for query evaluation
* - TIMEOUT: maximum time to run the query
*/
readonly parseCommand: (this: void, parser: CommandParser, index: RedisArgument, query: RedisArgument, options?: FtAggregateOptions) => void;
readonly transformReply: {
readonly 2: (rawReply: [total: UnwrapReply<NumberReply<number>>, ...results: ArrayReply<BlobStringReply<string>>[]], preserve?: any, typeMapping?: TypeMapping) => AggregateReply;
readonly 3: () => ReplyUnion;
};
readonly unstableResp3: true;
};
export default _default;
export declare function parseAggregateOptions(parser: CommandParser, options?: FtAggregateOptions): void;
//# sourceMappingURL=AGGREGATE.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AGGREGATE.d.ts","sourceRoot":"","sources":["../../../lib/commands/AGGREGATE.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAW,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AACrK,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,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C,CAAC,CAAC;CAC5D;;;;IAKC;;;;;;;;;;;OAWG;gDACkB,aAAa,SAAS,aAAa,SAAS,aAAa,YAAY,kBAAkB;;wIAM9D,GAAG,gBAAgB,WAAW,KAAG,cAAc;0BAgB1D,UAAU;;;;AArC/C,wBAwC6B;AAE7B,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,EAAG,OAAO,CAAC,EAAE,kBAAkB,QA0FzF"}

View File

@@ -0,0 +1,211 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseAggregateOptions = exports.FT_AGGREGATE_GROUP_BY_REDUCERS = exports.FT_AGGREGATE_STEPS = void 0;
const SEARCH_1 = require("./SEARCH");
const generic_transformers_1 = require("@redis/client/dist/lib/commands/generic-transformers");
const default_1 = require("../dialect/default");
exports.FT_AGGREGATE_STEPS = {
GROUPBY: 'GROUPBY',
SORTBY: 'SORTBY',
APPLY: 'APPLY',
LIMIT: 'LIMIT',
FILTER: 'FILTER'
};
exports.FT_AGGREGATE_GROUP_BY_REDUCERS = {
COUNT: 'COUNT',
COUNT_DISTINCT: 'COUNT_DISTINCT',
COUNT_DISTINCTISH: 'COUNT_DISTINCTISH',
SUM: 'SUM',
MIN: 'MIN',
MAX: 'MAX',
AVG: 'AVG',
STDDEV: 'STDDEV',
QUANTILE: 'QUANTILE',
TOLIST: 'TOLIST',
FIRST_VALUE: 'FIRST_VALUE',
RANDOM_SAMPLE: 'RANDOM_SAMPLE'
};
;
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: false,
/**
* Performs an aggregation query on a RediSearch index.
* @param parser - The command parser
* @param index - The index name to query
* @param query - The text query to use as filter, use * to indicate no filtering
* @param options - Optional parameters for aggregation:
* - VERBATIM: disable stemming in query evaluation
* - LOAD: specify fields to load from documents
* - STEPS: sequence of aggregation steps (GROUPBY, SORTBY, APPLY, LIMIT, FILTER)
* - PARAMS: bind parameters for query evaluation
* - TIMEOUT: maximum time to run the query
*/
parseCommand(parser, index, query, options) {
parser.push('FT.AGGREGATE', index, query);
return parseAggregateOptions(parser, options);
},
transformReply: {
2: (rawReply, preserve, typeMapping) => {
const results = [];
for (let i = 1; i < rawReply.length; i++) {
results.push((0, generic_transformers_1.transformTuplesReply)(rawReply[i], preserve, typeMapping));
}
return {
// https://redis.io/docs/latest/commands/ft.aggregate/#return
// FT.AGGREGATE returns an array reply where each row is an array reply and represents a single aggregate result.
// The integer reply at position 1 does not represent a valid value.
total: Number(rawReply[0]),
results
};
},
3: undefined
},
unstableResp3: true
};
function parseAggregateOptions(parser, options) {
if (options?.VERBATIM) {
parser.push('VERBATIM');
}
if (options?.ADDSCORES) {
parser.push('ADDSCORES');
}
if (options?.LOAD) {
const args = [];
if (Array.isArray(options.LOAD)) {
for (const load of options.LOAD) {
pushLoadField(args, load);
}
}
else {
pushLoadField(args, options.LOAD);
}
parser.push('LOAD');
parser.pushVariadicWithLength(args);
}
if (options?.TIMEOUT !== undefined) {
parser.push('TIMEOUT', options.TIMEOUT.toString());
}
if (options?.STEPS) {
for (const step of options.STEPS) {
parser.push(step.type);
switch (step.type) {
case exports.FT_AGGREGATE_STEPS.GROUPBY:
if (!step.properties) {
parser.push('0');
}
else {
parser.pushVariadicWithLength(step.properties);
}
if (Array.isArray(step.REDUCE)) {
for (const reducer of step.REDUCE) {
parseGroupByReducer(parser, reducer);
}
}
else {
parseGroupByReducer(parser, step.REDUCE);
}
break;
case exports.FT_AGGREGATE_STEPS.SORTBY:
const args = [];
if (Array.isArray(step.BY)) {
for (const by of step.BY) {
pushSortByProperty(args, by);
}
}
else {
pushSortByProperty(args, step.BY);
}
if (step.MAX) {
args.push('MAX', step.MAX.toString());
}
parser.pushVariadicWithLength(args);
break;
case exports.FT_AGGREGATE_STEPS.APPLY:
parser.push(step.expression, 'AS', step.AS);
break;
case exports.FT_AGGREGATE_STEPS.LIMIT:
parser.push(step.from.toString(), step.size.toString());
break;
case exports.FT_AGGREGATE_STEPS.FILTER:
parser.push(step.expression);
break;
}
}
}
(0, SEARCH_1.parseParamsArgument)(parser, options?.PARAMS);
if (options?.DIALECT) {
parser.push('DIALECT', options.DIALECT.toString());
}
else {
parser.push('DIALECT', default_1.DEFAULT_DIALECT);
}
}
exports.parseAggregateOptions = parseAggregateOptions;
function pushLoadField(args, toLoad) {
if (typeof toLoad === 'string' || toLoad instanceof Buffer) {
args.push(toLoad);
}
else {
args.push(toLoad.identifier);
if (toLoad.AS) {
args.push('AS', toLoad.AS);
}
}
}
function parseGroupByReducer(parser, reducer) {
parser.push('REDUCE', reducer.type);
switch (reducer.type) {
case exports.FT_AGGREGATE_GROUP_BY_REDUCERS.COUNT:
parser.push('0');
break;
case exports.FT_AGGREGATE_GROUP_BY_REDUCERS.COUNT_DISTINCT:
case exports.FT_AGGREGATE_GROUP_BY_REDUCERS.COUNT_DISTINCTISH:
case exports.FT_AGGREGATE_GROUP_BY_REDUCERS.SUM:
case exports.FT_AGGREGATE_GROUP_BY_REDUCERS.MIN:
case exports.FT_AGGREGATE_GROUP_BY_REDUCERS.MAX:
case exports.FT_AGGREGATE_GROUP_BY_REDUCERS.AVG:
case exports.FT_AGGREGATE_GROUP_BY_REDUCERS.STDDEV:
case exports.FT_AGGREGATE_GROUP_BY_REDUCERS.TOLIST:
parser.push('1', reducer.property);
break;
case exports.FT_AGGREGATE_GROUP_BY_REDUCERS.QUANTILE:
parser.push('2', reducer.property, reducer.quantile.toString());
break;
case exports.FT_AGGREGATE_GROUP_BY_REDUCERS.FIRST_VALUE: {
const args = [reducer.property];
if (reducer.BY) {
args.push('BY');
if (typeof reducer.BY === 'string' || reducer.BY instanceof Buffer) {
args.push(reducer.BY);
}
else {
args.push(reducer.BY.property);
if (reducer.BY.direction) {
args.push(reducer.BY.direction);
}
}
}
parser.pushVariadicWithLength(args);
break;
}
case exports.FT_AGGREGATE_GROUP_BY_REDUCERS.RANDOM_SAMPLE:
parser.push('2', reducer.property, reducer.sampleSize.toString());
break;
}
if (reducer.AS) {
parser.push('AS', reducer.AS);
}
}
function pushSortByProperty(args, sortBy) {
if (typeof sortBy === 'string' || sortBy instanceof Buffer) {
args.push(sortBy);
}
else {
args.push(sortBy.BY);
if (sortBy.DIRECTION) {
args.push(sortBy.DIRECTION);
}
}
}
//# sourceMappingURL=AGGREGATE.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,35 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { RedisArgument, ReplyUnion, NumberReply } from '@redis/client/dist/lib/RESP/types';
import { AggregateRawReply, AggregateReply, FtAggregateOptions } from './AGGREGATE';
export interface FtAggregateWithCursorOptions extends FtAggregateOptions {
COUNT?: number;
MAXIDLE?: number;
}
type AggregateWithCursorRawReply = [
result: AggregateRawReply,
cursor: NumberReply
];
export interface AggregateWithCursorReply extends AggregateReply {
cursor: NumberReply;
}
declare const _default: {
readonly IS_READ_ONLY: false;
/**
* Performs an aggregation with a cursor for retrieving large result sets.
* @param parser - The command parser
* @param index - Name of the index to query
* @param query - The aggregation query
* @param options - Optional parameters:
* - All options supported by FT.AGGREGATE
* - COUNT: Number of results to return per cursor fetch
* - MAXIDLE: Maximum idle time for cursor in milliseconds
*/
readonly parseCommand: (this: void, parser: CommandParser, index: RedisArgument, query: RedisArgument, options?: FtAggregateWithCursorOptions) => void;
readonly transformReply: {
readonly 2: (reply: AggregateWithCursorRawReply) => AggregateWithCursorReply;
readonly 3: () => ReplyUnion;
};
readonly unstableResp3: true;
};
export default _default;
//# sourceMappingURL=AGGREGATE_WITHCURSOR.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AGGREGATE_WITHCURSOR.d.ts","sourceRoot":"","sources":["../../../lib/commands/AGGREGATE_WITHCURSOR.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAW,UAAU,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AACpG,OAAkB,EAAE,iBAAiB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE/F,MAAM,WAAW,4BAA6B,SAAQ,kBAAkB;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD,KAAK,2BAA2B,GAAG;IACjC,MAAM,EAAE,iBAAiB;IACzB,MAAM,EAAE,WAAW;CACpB,CAAC;AAEF,MAAM,WAAW,wBAAyB,SAAQ,cAAc;IAC9D,MAAM,EAAE,WAAW,CAAC;CACrB;;;IAIC;;;;;;;;;OASG;gDACkB,aAAa,SAAS,aAAa,SAAS,aAAa,YAAY,4BAA4B;;4DAa3E,wBAAwB;0BAMhC,UAAU;;;;AA/B/C,wBAkC6B"}

View File

@@ -0,0 +1,40 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const AGGREGATE_1 = __importDefault(require("./AGGREGATE"));
exports.default = {
IS_READ_ONLY: AGGREGATE_1.default.IS_READ_ONLY,
/**
* Performs an aggregation with a cursor for retrieving large result sets.
* @param parser - The command parser
* @param index - Name of the index to query
* @param query - The aggregation query
* @param options - Optional parameters:
* - All options supported by FT.AGGREGATE
* - COUNT: Number of results to return per cursor fetch
* - MAXIDLE: Maximum idle time for cursor in milliseconds
*/
parseCommand(parser, index, query, options) {
AGGREGATE_1.default.parseCommand(parser, index, query, options);
parser.push('WITHCURSOR');
if (options?.COUNT !== undefined) {
parser.push('COUNT', options.COUNT.toString());
}
if (options?.MAXIDLE !== undefined) {
parser.push('MAXIDLE', options.MAXIDLE.toString());
}
},
transformReply: {
2: (reply) => {
return {
...AGGREGATE_1.default.transformReply[2](reply[0]),
cursor: reply[1]
};
},
3: undefined
},
unstableResp3: true
};
//# sourceMappingURL=AGGREGATE_WITHCURSOR.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AGGREGATE_WITHCURSOR.js","sourceRoot":"","sources":["../../../lib/commands/AGGREGATE_WITHCURSOR.ts"],"names":[],"mappings":";;;;;AAEA,4DAA+F;AAiB/F,kBAAe;IACb,YAAY,EAAE,mBAAS,CAAC,YAAY;IACpC;;;;;;;;;OASG;IACH,YAAY,CAAC,MAAqB,EAAE,KAAoB,EAAE,KAAoB,EAAE,OAAsC;QACpH,mBAAS,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACtD,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAE1B,IAAI,OAAO,EAAE,KAAK,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjD,CAAC;QAED,IAAG,OAAO,EAAE,OAAO,KAAK,SAAS,EAAE,CAAC;YAClC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IACD,cAAc,EAAE;QACd,CAAC,EAAE,CAAC,KAAkC,EAA4B,EAAE;YAClE,OAAO;gBACL,GAAG,mBAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACxC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;aACjB,CAAC;QACJ,CAAC;QACD,CAAC,EAAE,SAAwC;KAC5C;IACD,aAAa,EAAE,IAAI;CACO,CAAC"}

View File

@@ -0,0 +1,16 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { RedisArgument, SimpleStringReply } from '@redis/client/dist/lib/RESP/types';
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Adds an alias to a RediSearch index.
* @param parser - The command parser
* @param alias - The alias to add
* @param index - The index name to alias
*/
readonly parseCommand: (this: void, parser: CommandParser, alias: RedisArgument, index: RedisArgument) => void;
readonly transformReply: () => SimpleStringReply<'OK'>;
};
export default _default;
//# sourceMappingURL=ALIASADD.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ALIASADD.d.ts","sourceRoot":"","sources":["../../../lib/commands/ALIASADD.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAW,MAAM,mCAAmC,CAAC;;;;IAK5F;;;;;OAKG;gDACkB,aAAa,SAAS,aAAa,SAAS,aAAa;mCAGhC,kBAAkB,IAAI,CAAC;;AAZvE,wBAa6B"}

View File

@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Adds an alias to a RediSearch index.
* @param parser - The command parser
* @param alias - The alias to add
* @param index - The index name to alias
*/
parseCommand(parser, alias, index) {
parser.push('FT.ALIASADD', alias, index);
},
transformReply: undefined
};
//# sourceMappingURL=ALIASADD.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ALIASADD.js","sourceRoot":"","sources":["../../../lib/commands/ALIASADD.ts"],"names":[],"mappings":";;AAGA,kBAAe;IACb,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB;;;;;OAKG;IACH,YAAY,CAAC,MAAqB,EAAE,KAAoB,EAAE,KAAoB;QAC5E,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;IACD,cAAc,EAAE,SAAqD;CAC3C,CAAC"}

View File

@@ -0,0 +1,15 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { RedisArgument, SimpleStringReply } from '@redis/client/dist/lib/RESP/types';
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Removes an existing alias from a RediSearch index.
* @param parser - The command parser
* @param alias - The alias to remove
*/
readonly parseCommand: (this: void, parser: CommandParser, alias: RedisArgument) => void;
readonly transformReply: () => SimpleStringReply<'OK'>;
};
export default _default;
//# sourceMappingURL=ALIASDEL.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ALIASDEL.d.ts","sourceRoot":"","sources":["../../../lib/commands/ALIASDEL.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAW,MAAM,mCAAmC,CAAC;;;;IAK5F;;;;OAIG;gDACkB,aAAa,SAAS,aAAa;mCAGV,kBAAkB,IAAI,CAAC;;AAXvE,wBAY6B"}

View File

@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Removes an existing alias from a RediSearch index.
* @param parser - The command parser
* @param alias - The alias to remove
*/
parseCommand(parser, alias) {
parser.push('FT.ALIASDEL', alias);
},
transformReply: undefined
};
//# sourceMappingURL=ALIASDEL.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ALIASDEL.js","sourceRoot":"","sources":["../../../lib/commands/ALIASDEL.ts"],"names":[],"mappings":";;AAGA,kBAAe;IACb,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB;;;;OAIG;IACH,YAAY,CAAC,MAAqB,EAAE,KAAoB;QACtD,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;IACD,cAAc,EAAE,SAAqD;CAC3C,CAAC"}

View File

@@ -0,0 +1,16 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { SimpleStringReply, RedisArgument } from '@redis/client/dist/lib/RESP/types';
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Updates the index pointed to by an existing alias.
* @param parser - The command parser
* @param alias - The existing alias to update
* @param index - The new index name that the alias should point to
*/
readonly parseCommand: (this: void, parser: CommandParser, alias: RedisArgument, index: RedisArgument) => void;
readonly transformReply: () => SimpleStringReply<'OK'>;
};
export default _default;
//# sourceMappingURL=ALIASUPDATE.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ALIASUPDATE.d.ts","sourceRoot":"","sources":["../../../lib/commands/ALIASUPDATE.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAW,aAAa,EAAE,MAAM,mCAAmC,CAAC;;;;IAK5F;;;;;OAKG;gDACkB,aAAa,SAAS,aAAa,SAAS,aAAa;mCAGhC,kBAAkB,IAAI,CAAC;;AAZvE,wBAa6B"}

View File

@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Updates the index pointed to by an existing alias.
* @param parser - The command parser
* @param alias - The existing alias to update
* @param index - The new index name that the alias should point to
*/
parseCommand(parser, alias, index) {
parser.push('FT.ALIASUPDATE', alias, index);
},
transformReply: undefined
};
//# sourceMappingURL=ALIASUPDATE.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ALIASUPDATE.js","sourceRoot":"","sources":["../../../lib/commands/ALIASUPDATE.ts"],"names":[],"mappings":";;AAGA,kBAAe;IACb,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB;;;;;OAKG;IACH,YAAY,CAAC,MAAqB,EAAE,KAAoB,EAAE,KAAoB;QAC5E,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IACD,cAAc,EAAE,SAAqD;CAC3C,CAAC"}

View File

@@ -0,0 +1,17 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { RedisArgument, SimpleStringReply } from '@redis/client/dist/lib/RESP/types';
import { RediSearchSchema } from './CREATE';
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Alters an existing RediSearch index schema by adding new fields.
* @param parser - The command parser
* @param index - The index to alter
* @param schema - The schema definition containing new fields to add
*/
readonly parseCommand: (this: void, parser: CommandParser, index: RedisArgument, schema: RediSearchSchema) => void;
readonly transformReply: () => SimpleStringReply<'OK'>;
};
export default _default;
//# sourceMappingURL=ALTER.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ALTER.d.ts","sourceRoot":"","sources":["../../../lib/commands/ALTER.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAW,MAAM,mCAAmC,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAe,MAAM,UAAU,CAAC;;;;IAKvD;;;;;OAKG;gDACkB,aAAa,SAAS,aAAa,UAAU,gBAAgB;mCAIpC,kBAAkB,IAAI,CAAC;;AAbvE,wBAc6B"}

19
node_modules/@redis/search/dist/lib/commands/ALTER.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const CREATE_1 = require("./CREATE");
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Alters an existing RediSearch index schema by adding new fields.
* @param parser - The command parser
* @param index - The index to alter
* @param schema - The schema definition containing new fields to add
*/
parseCommand(parser, index, schema) {
parser.push('FT.ALTER', index, 'SCHEMA', 'ADD');
(0, CREATE_1.parseSchema)(parser, schema);
},
transformReply: undefined
};
//# sourceMappingURL=ALTER.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ALTER.js","sourceRoot":"","sources":["../../../lib/commands/ALTER.ts"],"names":[],"mappings":";;AAEA,qCAAyD;AAEzD,kBAAe;IACb,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB;;;;;OAKG;IACH,YAAY,CAAC,MAAqB,EAAE,KAAoB,EAAE,MAAwB;QAChF,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QAChD,IAAA,oBAAW,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,CAAC;IACD,cAAc,EAAE,SAAqD;CAC3C,CAAC"}

View File

@@ -0,0 +1,15 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { ArrayReply, TuplesReply, BlobStringReply, NullReply, UnwrapReply } from '@redis/client/dist/lib/RESP/types';
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Gets a RediSearch configuration option value.
* @param parser - The command parser
* @param option - The name of the configuration option to retrieve
*/
readonly parseCommand: (this: void, parser: CommandParser, option: string) => void;
readonly transformReply: (this: void, reply: UnwrapReply<ArrayReply<TuplesReply<[BlobStringReply, BlobStringReply | NullReply]>>>) => Record<string, BlobStringReply<string> | NullReply>;
};
export default _default;
//# sourceMappingURL=CONFIG_GET.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CONFIG_GET.d.ts","sourceRoot":"","sources":["../../../lib/commands/CONFIG_GET.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAW,MAAM,mCAAmC,CAAC;;;;IAK5H;;;;OAIG;gDACkB,aAAa,UAAU,MAAM;iDAG5B,YAAY,WAAW,YAAY,CAAC,eAAe,EAAE,eAAe,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;;AAX5G,wBAoB6B"}

View File

@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Gets a RediSearch configuration option value.
* @param parser - The command parser
* @param option - The name of the configuration option to retrieve
*/
parseCommand(parser, option) {
parser.push('FT.CONFIG', 'GET', option);
},
transformReply(reply) {
const transformedReply = Object.create(null);
for (const item of reply) {
const [key, value] = item;
transformedReply[key.toString()] = value;
}
return transformedReply;
}
};
//# sourceMappingURL=CONFIG_GET.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CONFIG_GET.js","sourceRoot":"","sources":["../../../lib/commands/CONFIG_GET.ts"],"names":[],"mappings":";;AAGA,kBAAe;IACb,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB;;;;OAIG;IACH,YAAY,CAAC,MAAqB,EAAE,MAAc;QAChD,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IACD,cAAc,CAAC,KAA2F;QACxG,MAAM,gBAAgB,GAAgD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC1F,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,IAA2C,CAAC;YACjE,gBAAgB,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC;QAC3C,CAAC;QAED,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACyB,CAAC"}

View File

@@ -0,0 +1,18 @@
/// <reference types="node" />
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { RedisArgument, SimpleStringReply } from '@redis/client/dist/lib/RESP/types';
type FtConfigProperties = 'a' | 'b' | (string & {}) | Buffer;
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Sets a RediSearch configuration option value.
* @param parser - The command parser
* @param property - The name of the configuration option to set
* @param value - The value to set for the configuration option
*/
readonly parseCommand: (this: void, parser: CommandParser, property: FtConfigProperties, value: RedisArgument) => void;
readonly transformReply: () => SimpleStringReply<'OK'>;
};
export default _default;
//# sourceMappingURL=CONFIG_SET.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CONFIG_SET.d.ts","sourceRoot":"","sources":["../../../lib/commands/CONFIG_SET.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAW,MAAM,mCAAmC,CAAC;AAI9F,KAAK,kBAAkB,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC;;;;IAK3D;;;;;OAKG;gDACkB,aAAa,YAAY,kBAAkB,SAAS,aAAa;mCAGxC,kBAAkB,IAAI,CAAC;;AAZvE,wBAa6B"}

View File

@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Sets a RediSearch configuration option value.
* @param parser - The command parser
* @param property - The name of the configuration option to set
* @param value - The value to set for the configuration option
*/
parseCommand(parser, property, value) {
parser.push('FT.CONFIG', 'SET', property, value);
},
transformReply: undefined
};
//# sourceMappingURL=CONFIG_SET.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CONFIG_SET.js","sourceRoot":"","sources":["../../../lib/commands/CONFIG_SET.ts"],"names":[],"mappings":";;AAOA,kBAAe;IACb,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB;;;;;OAKG;IACH,YAAY,CAAC,MAAqB,EAAE,QAA4B,EAAE,KAAoB;QACpF,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC;IACD,cAAc,EAAE,SAAqD;CAC3C,CAAC"}

View File

@@ -0,0 +1,179 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { RedisArgument, SimpleStringReply } from '@redis/client/dist/lib/RESP/types';
import { RedisVariadicArgument } from '@redis/client/dist/lib/commands/generic-transformers';
export declare const SCHEMA_FIELD_TYPE: {
readonly TEXT: "TEXT";
readonly NUMERIC: "NUMERIC";
readonly GEO: "GEO";
readonly TAG: "TAG";
readonly VECTOR: "VECTOR";
readonly GEOSHAPE: "GEOSHAPE";
};
export type SchemaFieldType = typeof SCHEMA_FIELD_TYPE[keyof typeof SCHEMA_FIELD_TYPE];
interface SchemaField<T extends SchemaFieldType = SchemaFieldType> {
type: T;
AS?: RedisArgument;
INDEXMISSING?: boolean;
}
interface SchemaCommonField<T extends SchemaFieldType = SchemaFieldType> extends SchemaField<T> {
SORTABLE?: boolean | 'UNF';
NOINDEX?: boolean;
}
export declare const SCHEMA_TEXT_FIELD_PHONETIC: {
readonly DM_EN: "dm:en";
readonly DM_FR: "dm:fr";
readonly FM_PT: "dm:pt";
readonly DM_ES: "dm:es";
};
export type SchemaTextFieldPhonetic = typeof SCHEMA_TEXT_FIELD_PHONETIC[keyof typeof SCHEMA_TEXT_FIELD_PHONETIC];
interface SchemaTextField extends SchemaCommonField<typeof SCHEMA_FIELD_TYPE['TEXT']> {
NOSTEM?: boolean;
WEIGHT?: number;
PHONETIC?: SchemaTextFieldPhonetic;
WITHSUFFIXTRIE?: boolean;
INDEXEMPTY?: boolean;
}
interface SchemaNumericField extends SchemaCommonField<typeof SCHEMA_FIELD_TYPE['NUMERIC']> {
}
interface SchemaGeoField extends SchemaCommonField<typeof SCHEMA_FIELD_TYPE['GEO']> {
}
interface SchemaTagField extends SchemaCommonField<typeof SCHEMA_FIELD_TYPE['TAG']> {
SEPARATOR?: RedisArgument;
CASESENSITIVE?: boolean;
WITHSUFFIXTRIE?: boolean;
INDEXEMPTY?: boolean;
}
export declare const SCHEMA_VECTOR_FIELD_ALGORITHM: {
readonly FLAT: "FLAT";
readonly HNSW: "HNSW";
/**
* available since 8.2
*/
readonly VAMANA: "SVS-VAMANA";
};
export type SchemaVectorFieldAlgorithm = typeof SCHEMA_VECTOR_FIELD_ALGORITHM[keyof typeof SCHEMA_VECTOR_FIELD_ALGORITHM];
interface SchemaVectorField extends SchemaField<typeof SCHEMA_FIELD_TYPE['VECTOR']> {
ALGORITHM: SchemaVectorFieldAlgorithm;
TYPE: 'FLOAT32' | 'FLOAT64' | 'BFLOAT16' | 'FLOAT16' | 'INT8' | 'UINT8';
DIM: number;
DISTANCE_METRIC: 'L2' | 'IP' | 'COSINE';
INITIAL_CAP?: number;
}
interface SchemaFlatVectorField extends SchemaVectorField {
ALGORITHM: typeof SCHEMA_VECTOR_FIELD_ALGORITHM['FLAT'];
BLOCK_SIZE?: number;
}
interface SchemaHNSWVectorField extends SchemaVectorField {
ALGORITHM: typeof SCHEMA_VECTOR_FIELD_ALGORITHM['HNSW'];
M?: number;
EF_CONSTRUCTION?: number;
EF_RUNTIME?: number;
}
export declare const VAMANA_COMPRESSION_ALGORITHM: {
readonly LVQ4: "LVQ4";
readonly LVQ8: "LVQ8";
readonly LVQ4x4: "LVQ4x4";
readonly LVQ4x8: "LVQ4x8";
readonly LeanVec4x8: "LeanVec4x8";
readonly LeanVec8x8: "LeanVec8x8";
};
export type VamanaCompressionAlgorithm = typeof VAMANA_COMPRESSION_ALGORITHM[keyof typeof VAMANA_COMPRESSION_ALGORITHM];
interface SchemaVAMANAVectorField extends SchemaVectorField {
ALGORITHM: typeof SCHEMA_VECTOR_FIELD_ALGORITHM['VAMANA'];
TYPE: 'FLOAT16' | 'FLOAT32';
COMPRESSION?: VamanaCompressionAlgorithm;
CONSTRUCTION_WINDOW_SIZE?: number;
GRAPH_MAX_DEGREE?: number;
SEARCH_WINDOW_SIZE?: number;
EPSILON?: number;
/**
* applicable only with COMPRESSION
*/
TRAINING_THRESHOLD?: number;
/**
* applicable only with LeanVec COMPRESSION
*/
REDUCE?: number;
}
export declare const SCHEMA_GEO_SHAPE_COORD_SYSTEM: {
readonly SPHERICAL: "SPHERICAL";
readonly FLAT: "FLAT";
};
export type SchemaGeoShapeFieldCoordSystem = typeof SCHEMA_GEO_SHAPE_COORD_SYSTEM[keyof typeof SCHEMA_GEO_SHAPE_COORD_SYSTEM];
interface SchemaGeoShapeField extends SchemaField<typeof SCHEMA_FIELD_TYPE['GEOSHAPE']> {
COORD_SYSTEM?: SchemaGeoShapeFieldCoordSystem;
}
export interface RediSearchSchema {
[field: string]: (SchemaTextField | SchemaNumericField | SchemaGeoField | SchemaTagField | SchemaFlatVectorField | SchemaHNSWVectorField | SchemaVAMANAVectorField | SchemaGeoShapeField | SchemaFieldType);
}
export declare function parseSchema(parser: CommandParser, schema: RediSearchSchema): void;
export declare const REDISEARCH_LANGUAGE: {
readonly ARABIC: "Arabic";
readonly BASQUE: "Basque";
readonly CATALANA: "Catalan";
readonly DANISH: "Danish";
readonly DUTCH: "Dutch";
readonly ENGLISH: "English";
readonly FINNISH: "Finnish";
readonly FRENCH: "French";
readonly GERMAN: "German";
readonly GREEK: "Greek";
readonly HUNGARIAN: "Hungarian";
readonly INDONESAIN: "Indonesian";
readonly IRISH: "Irish";
readonly ITALIAN: "Italian";
readonly LITHUANIAN: "Lithuanian";
readonly NEPALI: "Nepali";
readonly NORWEIGAN: "Norwegian";
readonly PORTUGUESE: "Portuguese";
readonly ROMANIAN: "Romanian";
readonly RUSSIAN: "Russian";
readonly SPANISH: "Spanish";
readonly SWEDISH: "Swedish";
readonly TAMIL: "Tamil";
readonly TURKISH: "Turkish";
readonly CHINESE: "Chinese";
};
export type RediSearchLanguage = typeof REDISEARCH_LANGUAGE[keyof typeof REDISEARCH_LANGUAGE];
export type RediSearchProperty = `${'@' | '$.'}${string}`;
export interface CreateOptions {
ON?: 'HASH' | 'JSON';
PREFIX?: RedisVariadicArgument;
FILTER?: RedisArgument;
LANGUAGE?: RediSearchLanguage;
LANGUAGE_FIELD?: RediSearchProperty;
SCORE?: number;
SCORE_FIELD?: RediSearchProperty;
MAXTEXTFIELDS?: boolean;
TEMPORARY?: number;
NOOFFSETS?: boolean;
NOHL?: boolean;
NOFIELDS?: boolean;
NOFREQS?: boolean;
SKIPINITIALSCAN?: boolean;
STOPWORDS?: RedisVariadicArgument;
}
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Creates a new search index with the given schema and options.
* @param parser - The command parser
* @param index - Name of the index to create
* @param schema - Index schema defining field names and types (TEXT, NUMERIC, GEO, TAG, VECTOR, GEOSHAPE)
* @param options - Optional parameters:
* - ON: Type of container to index (HASH or JSON)
* - PREFIX: Prefixes for document keys to index
* - FILTER: Expression that filters indexed documents
* - LANGUAGE/LANGUAGE_FIELD: Default language for indexing
* - SCORE/SCORE_FIELD: Document ranking parameters
* - MAXTEXTFIELDS: Index all text fields without specifying them
* - TEMPORARY: Create a temporary index
* - NOOFFSETS/NOHL/NOFIELDS/NOFREQS: Index optimization flags
* - STOPWORDS: Custom stopword list
*/
readonly parseCommand: (this: void, parser: CommandParser, index: RedisArgument, schema: RediSearchSchema, options?: CreateOptions) => void;
readonly transformReply: () => SimpleStringReply<'OK'>;
};
export default _default;
//# sourceMappingURL=CREATE.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CREATE.d.ts","sourceRoot":"","sources":["../../../lib/commands/CREATE.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAW,MAAM,mCAAmC,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAiC,MAAM,sDAAsD,CAAC;AAE5H,eAAO,MAAM,iBAAiB;;;;;;;CAOpB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,OAAO,iBAAiB,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAEvF,UAAU,WAAW,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe;IAC/D,IAAI,EAAE,CAAC,CAAC;IACR,EAAE,CAAC,EAAE,aAAa,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,UAAU,iBAAiB,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,CAAE,SAAQ,WAAW,CA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,aAAa,SAAS,aAAa,UAAU,gBAAgB,YAAY,aAAa;mCAiE7D,kBAAkB,IAAI,CAAC;;AApFvE,wBAqF6B"}

258
node_modules/@redis/search/dist/lib/commands/CREATE.js generated vendored Normal file
View File

@@ -0,0 +1,258 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.REDISEARCH_LANGUAGE = exports.parseSchema = exports.SCHEMA_GEO_SHAPE_COORD_SYSTEM = exports.VAMANA_COMPRESSION_ALGORITHM = exports.SCHEMA_VECTOR_FIELD_ALGORITHM = exports.SCHEMA_TEXT_FIELD_PHONETIC = exports.SCHEMA_FIELD_TYPE = void 0;
const generic_transformers_1 = require("@redis/client/dist/lib/commands/generic-transformers");
exports.SCHEMA_FIELD_TYPE = {
TEXT: 'TEXT',
NUMERIC: 'NUMERIC',
GEO: 'GEO',
TAG: 'TAG',
VECTOR: 'VECTOR',
GEOSHAPE: 'GEOSHAPE'
};
exports.SCHEMA_TEXT_FIELD_PHONETIC = {
DM_EN: 'dm:en',
DM_FR: 'dm:fr',
FM_PT: 'dm:pt',
DM_ES: 'dm:es'
};
exports.SCHEMA_VECTOR_FIELD_ALGORITHM = {
FLAT: 'FLAT',
HNSW: 'HNSW',
/**
* available since 8.2
*/
VAMANA: 'SVS-VAMANA'
};
exports.VAMANA_COMPRESSION_ALGORITHM = {
LVQ4: 'LVQ4',
LVQ8: 'LVQ8',
LVQ4x4: 'LVQ4x4',
LVQ4x8: 'LVQ4x8',
LeanVec4x8: 'LeanVec4x8',
LeanVec8x8: 'LeanVec8x8'
};
exports.SCHEMA_GEO_SHAPE_COORD_SYSTEM = {
SPHERICAL: 'SPHERICAL',
FLAT: 'FLAT'
};
function parseCommonSchemaFieldOptions(parser, fieldOptions) {
if (fieldOptions.SORTABLE) {
parser.push('SORTABLE');
if (fieldOptions.SORTABLE === 'UNF') {
parser.push('UNF');
}
}
if (fieldOptions.NOINDEX) {
parser.push('NOINDEX');
}
}
function parseSchema(parser, schema) {
for (const [field, fieldOptions] of Object.entries(schema)) {
parser.push(field);
if (typeof fieldOptions === 'string') {
parser.push(fieldOptions);
continue;
}
if (fieldOptions.AS) {
parser.push('AS', fieldOptions.AS);
}
parser.push(fieldOptions.type);
if (fieldOptions.INDEXMISSING) {
parser.push('INDEXMISSING');
}
switch (fieldOptions.type) {
case exports.SCHEMA_FIELD_TYPE.TEXT:
if (fieldOptions.NOSTEM) {
parser.push('NOSTEM');
}
if (fieldOptions.WEIGHT !== undefined) {
parser.push('WEIGHT', fieldOptions.WEIGHT.toString());
}
if (fieldOptions.PHONETIC) {
parser.push('PHONETIC', fieldOptions.PHONETIC);
}
if (fieldOptions.WITHSUFFIXTRIE) {
parser.push('WITHSUFFIXTRIE');
}
if (fieldOptions.INDEXEMPTY) {
parser.push('INDEXEMPTY');
}
parseCommonSchemaFieldOptions(parser, fieldOptions);
break;
case exports.SCHEMA_FIELD_TYPE.NUMERIC:
case exports.SCHEMA_FIELD_TYPE.GEO:
parseCommonSchemaFieldOptions(parser, fieldOptions);
break;
case exports.SCHEMA_FIELD_TYPE.TAG:
if (fieldOptions.SEPARATOR) {
parser.push('SEPARATOR', fieldOptions.SEPARATOR);
}
if (fieldOptions.CASESENSITIVE) {
parser.push('CASESENSITIVE');
}
if (fieldOptions.WITHSUFFIXTRIE) {
parser.push('WITHSUFFIXTRIE');
}
if (fieldOptions.INDEXEMPTY) {
parser.push('INDEXEMPTY');
}
parseCommonSchemaFieldOptions(parser, fieldOptions);
break;
case exports.SCHEMA_FIELD_TYPE.VECTOR:
parser.push(fieldOptions.ALGORITHM);
const args = [];
args.push('TYPE', fieldOptions.TYPE, 'DIM', fieldOptions.DIM.toString(), 'DISTANCE_METRIC', fieldOptions.DISTANCE_METRIC);
if (fieldOptions.INITIAL_CAP !== undefined) {
args.push('INITIAL_CAP', fieldOptions.INITIAL_CAP.toString());
}
switch (fieldOptions.ALGORITHM) {
case exports.SCHEMA_VECTOR_FIELD_ALGORITHM.FLAT:
if (fieldOptions.BLOCK_SIZE !== undefined) {
args.push('BLOCK_SIZE', fieldOptions.BLOCK_SIZE.toString());
}
break;
case exports.SCHEMA_VECTOR_FIELD_ALGORITHM.HNSW:
if (fieldOptions.M !== undefined) {
args.push('M', fieldOptions.M.toString());
}
if (fieldOptions.EF_CONSTRUCTION !== undefined) {
args.push('EF_CONSTRUCTION', fieldOptions.EF_CONSTRUCTION.toString());
}
if (fieldOptions.EF_RUNTIME !== undefined) {
args.push('EF_RUNTIME', fieldOptions.EF_RUNTIME.toString());
}
break;
case exports.SCHEMA_VECTOR_FIELD_ALGORITHM['VAMANA']:
if (fieldOptions.COMPRESSION) {
args.push('COMPRESSION', fieldOptions.COMPRESSION);
}
if (fieldOptions.CONSTRUCTION_WINDOW_SIZE !== undefined) {
args.push('CONSTRUCTION_WINDOW_SIZE', fieldOptions.CONSTRUCTION_WINDOW_SIZE.toString());
}
if (fieldOptions.GRAPH_MAX_DEGREE !== undefined) {
args.push('GRAPH_MAX_DEGREE', fieldOptions.GRAPH_MAX_DEGREE.toString());
}
if (fieldOptions.SEARCH_WINDOW_SIZE !== undefined) {
args.push('SEARCH_WINDOW_SIZE', fieldOptions.SEARCH_WINDOW_SIZE.toString());
}
if (fieldOptions.EPSILON !== undefined) {
args.push('EPSILON', fieldOptions.EPSILON.toString());
}
if (fieldOptions.TRAINING_THRESHOLD !== undefined) {
args.push('TRAINING_THRESHOLD', fieldOptions.TRAINING_THRESHOLD.toString());
}
if (fieldOptions.REDUCE !== undefined) {
args.push('REDUCE', fieldOptions.REDUCE.toString());
}
break;
}
parser.pushVariadicWithLength(args);
break;
case exports.SCHEMA_FIELD_TYPE.GEOSHAPE:
if (fieldOptions.COORD_SYSTEM !== undefined) {
parser.push('COORD_SYSTEM', fieldOptions.COORD_SYSTEM);
}
break;
}
}
}
exports.parseSchema = parseSchema;
exports.REDISEARCH_LANGUAGE = {
ARABIC: 'Arabic',
BASQUE: 'Basque',
CATALANA: 'Catalan',
DANISH: 'Danish',
DUTCH: 'Dutch',
ENGLISH: 'English',
FINNISH: 'Finnish',
FRENCH: 'French',
GERMAN: 'German',
GREEK: 'Greek',
HUNGARIAN: 'Hungarian',
INDONESAIN: 'Indonesian',
IRISH: 'Irish',
ITALIAN: 'Italian',
LITHUANIAN: 'Lithuanian',
NEPALI: 'Nepali',
NORWEIGAN: 'Norwegian',
PORTUGUESE: 'Portuguese',
ROMANIAN: 'Romanian',
RUSSIAN: 'Russian',
SPANISH: 'Spanish',
SWEDISH: 'Swedish',
TAMIL: 'Tamil',
TURKISH: 'Turkish',
CHINESE: 'Chinese'
};
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Creates a new search index with the given schema and options.
* @param parser - The command parser
* @param index - Name of the index to create
* @param schema - Index schema defining field names and types (TEXT, NUMERIC, GEO, TAG, VECTOR, GEOSHAPE)
* @param options - Optional parameters:
* - ON: Type of container to index (HASH or JSON)
* - PREFIX: Prefixes for document keys to index
* - FILTER: Expression that filters indexed documents
* - LANGUAGE/LANGUAGE_FIELD: Default language for indexing
* - SCORE/SCORE_FIELD: Document ranking parameters
* - MAXTEXTFIELDS: Index all text fields without specifying them
* - TEMPORARY: Create a temporary index
* - NOOFFSETS/NOHL/NOFIELDS/NOFREQS: Index optimization flags
* - STOPWORDS: Custom stopword list
*/
parseCommand(parser, index, schema, options) {
parser.push('FT.CREATE', index);
if (options?.ON) {
parser.push('ON', options.ON);
}
(0, generic_transformers_1.parseOptionalVariadicArgument)(parser, 'PREFIX', options?.PREFIX);
if (options?.FILTER) {
parser.push('FILTER', options.FILTER);
}
if (options?.LANGUAGE) {
parser.push('LANGUAGE', options.LANGUAGE);
}
if (options?.LANGUAGE_FIELD) {
parser.push('LANGUAGE_FIELD', options.LANGUAGE_FIELD);
}
if (options?.SCORE) {
parser.push('SCORE', options.SCORE.toString());
}
if (options?.SCORE_FIELD) {
parser.push('SCORE_FIELD', options.SCORE_FIELD);
}
// if (options?.PAYLOAD_FIELD) {
// parser.push('PAYLOAD_FIELD', options.PAYLOAD_FIELD);
// }
if (options?.MAXTEXTFIELDS) {
parser.push('MAXTEXTFIELDS');
}
if (options?.TEMPORARY) {
parser.push('TEMPORARY', options.TEMPORARY.toString());
}
if (options?.NOOFFSETS) {
parser.push('NOOFFSETS');
}
if (options?.NOHL) {
parser.push('NOHL');
}
if (options?.NOFIELDS) {
parser.push('NOFIELDS');
}
if (options?.NOFREQS) {
parser.push('NOFREQS');
}
if (options?.SKIPINITIALSCAN) {
parser.push('SKIPINITIALSCAN');
}
(0, generic_transformers_1.parseOptionalVariadicArgument)(parser, 'STOPWORDS', options?.STOPWORDS);
parser.push('SCHEMA');
parseSchema(parser, schema);
},
transformReply: undefined
};
//# sourceMappingURL=CREATE.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,16 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { SimpleStringReply, RedisArgument, NumberReply, UnwrapReply } from '@redis/client/dist/lib/RESP/types';
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Deletes a cursor from an index.
* @param parser - The command parser
* @param index - The index name that contains the cursor
* @param cursorId - The cursor ID to delete
*/
readonly parseCommand: (this: void, parser: CommandParser, index: RedisArgument, cursorId: UnwrapReply<NumberReply>) => void;
readonly transformReply: () => SimpleStringReply<'OK'>;
};
export default _default;
//# sourceMappingURL=CURSOR_DEL.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CURSOR_DEL.d.ts","sourceRoot":"","sources":["../../../lib/commands/CURSOR_DEL.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAW,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;;;;IAKtH;;;;;OAKG;gDACkB,aAAa,SAAS,aAAa,YAAY,YAAY,WAAW,CAAC;mCAG9C,kBAAkB,IAAI,CAAC;;AAZvE,wBAa6B"}

View File

@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Deletes a cursor from an index.
* @param parser - The command parser
* @param index - The index name that contains the cursor
* @param cursorId - The cursor ID to delete
*/
parseCommand(parser, index, cursorId) {
parser.push('FT.CURSOR', 'DEL', index, cursorId.toString());
},
transformReply: undefined
};
//# sourceMappingURL=CURSOR_DEL.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CURSOR_DEL.js","sourceRoot":"","sources":["../../../lib/commands/CURSOR_DEL.ts"],"names":[],"mappings":";;AAGA,kBAAe;IACb,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB;;;;;OAKG;IACH,YAAY,CAAC,MAAqB,EAAE,KAAoB,EAAE,QAAkC;QAC1F,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC9D,CAAC;IACD,cAAc,EAAE,SAAqD;CAC3C,CAAC"}

View File

@@ -0,0 +1,25 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { RedisArgument, NumberReply, UnwrapReply } from '@redis/client/dist/lib/RESP/types';
export interface FtCursorReadOptions {
COUNT?: number;
}
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Reads from an existing cursor to get more results from an index.
* @param parser - The command parser
* @param index - The index name that contains the cursor
* @param cursor - The cursor ID to read from
* @param options - Optional parameters:
* - COUNT: Maximum number of results to return
*/
readonly parseCommand: (this: void, parser: CommandParser, index: RedisArgument, cursor: UnwrapReply<NumberReply>, options?: FtCursorReadOptions) => void;
readonly transformReply: {
readonly 2: (reply: [result: [total: UnwrapReply<NumberReply<number>>, ...results: import("@redis/client/dist/lib/RESP/types").ArrayReply<import("@redis/client/dist/lib/RESP/types").BlobStringReply<string>>[]], cursor: NumberReply<number>]) => import("./AGGREGATE_WITHCURSOR").AggregateWithCursorReply;
readonly 3: () => import("@redis/client/dist/lib/RESP/types").ReplyUnion;
};
readonly unstableResp3: true;
};
export default _default;
//# sourceMappingURL=CURSOR_READ.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CURSOR_READ.d.ts","sourceRoot":"","sources":["../../../lib/commands/CURSOR_READ.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAW,WAAW,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAGrG,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;;;;IAKC;;;;;;;OAOG;gDACkB,aAAa,SAAS,aAAa,UAAU,YAAY,WAAW,CAAC,YAAY,mBAAmB;;;;;;;AAX3H,wBAoB6B"}

View File

@@ -0,0 +1,27 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const AGGREGATE_WITHCURSOR_1 = __importDefault(require("./AGGREGATE_WITHCURSOR"));
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Reads from an existing cursor to get more results from an index.
* @param parser - The command parser
* @param index - The index name that contains the cursor
* @param cursor - The cursor ID to read from
* @param options - Optional parameters:
* - COUNT: Maximum number of results to return
*/
parseCommand(parser, index, cursor, options) {
parser.push('FT.CURSOR', 'READ', index, cursor.toString());
if (options?.COUNT !== undefined) {
parser.push('COUNT', options.COUNT.toString());
}
},
transformReply: AGGREGATE_WITHCURSOR_1.default.transformReply,
unstableResp3: true
};
//# sourceMappingURL=CURSOR_READ.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CURSOR_READ.js","sourceRoot":"","sources":["../../../lib/commands/CURSOR_READ.ts"],"names":[],"mappings":";;;;;AAEA,kFAA0D;AAM1D,kBAAe;IACb,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB;;;;;;;OAOG;IACH,YAAY,CAAC,MAAqB,EAAE,KAAoB,EAAE,MAAgC,EAAE,OAA6B;QACvH,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QAE3D,IAAI,OAAO,EAAE,KAAK,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IACD,cAAc,EAAE,8BAAoB,CAAC,cAAc;IACnD,aAAa,EAAE,IAAI;CACO,CAAC"}

View File

@@ -0,0 +1,17 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { RedisArgument, NumberReply } from '@redis/client/dist/lib/RESP/types';
import { RedisVariadicArgument } from '@redis/client/dist/lib/commands/generic-transformers';
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Adds terms to a dictionary.
* @param parser - The command parser
* @param dictionary - Name of the dictionary to add terms to
* @param term - One or more terms to add to the dictionary
*/
readonly parseCommand: (this: void, parser: CommandParser, dictionary: RedisArgument, term: RedisVariadicArgument) => void;
readonly transformReply: () => NumberReply;
};
export default _default;
//# sourceMappingURL=DICTADD.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DICTADD.d.ts","sourceRoot":"","sources":["../../../lib/commands/DICTADD.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAW,MAAM,mCAAmC,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sDAAsD,CAAC;;;;IAK3F;;;;;OAKG;gDACkB,aAAa,cAAc,aAAa,QAAQ,qBAAqB;mCAI5C,WAAW;;AAb3D,wBAc6B"}

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Adds terms to a dictionary.
* @param parser - The command parser
* @param dictionary - Name of the dictionary to add terms to
* @param term - One or more terms to add to the dictionary
*/
parseCommand(parser, dictionary, term) {
parser.push('FT.DICTADD', dictionary);
parser.pushVariadic(term);
},
transformReply: undefined
};
//# sourceMappingURL=DICTADD.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DICTADD.js","sourceRoot":"","sources":["../../../lib/commands/DICTADD.ts"],"names":[],"mappings":";;AAIA,kBAAe;IACb,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB;;;;;OAKG;IACH,YAAY,CAAC,MAAqB,EAAE,UAAyB,EAAE,IAA2B;QACxF,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACtC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IACD,cAAc,EAAE,SAAyC;CAC/B,CAAC"}

View File

@@ -0,0 +1,17 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { RedisArgument, NumberReply } from '@redis/client/dist/lib/RESP/types';
import { RedisVariadicArgument } from '@redis/client/dist/lib/commands/generic-transformers';
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Deletes terms from a dictionary.
* @param parser - The command parser
* @param dictionary - Name of the dictionary to remove terms from
* @param term - One or more terms to delete from the dictionary
*/
readonly parseCommand: (this: void, parser: CommandParser, dictionary: RedisArgument, term: RedisVariadicArgument) => void;
readonly transformReply: () => NumberReply;
};
export default _default;
//# sourceMappingURL=DICTDEL.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DICTDEL.d.ts","sourceRoot":"","sources":["../../../lib/commands/DICTDEL.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAW,MAAM,mCAAmC,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sDAAsD,CAAC;;;;IAK3F;;;;;OAKG;gDACkB,aAAa,cAAc,aAAa,QAAQ,qBAAqB;mCAI5C,WAAW;;AAb3D,wBAc6B"}

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Deletes terms from a dictionary.
* @param parser - The command parser
* @param dictionary - Name of the dictionary to remove terms from
* @param term - One or more terms to delete from the dictionary
*/
parseCommand(parser, dictionary, term) {
parser.push('FT.DICTDEL', dictionary);
parser.pushVariadic(term);
},
transformReply: undefined
};
//# sourceMappingURL=DICTDEL.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DICTDEL.js","sourceRoot":"","sources":["../../../lib/commands/DICTDEL.ts"],"names":[],"mappings":";;AAIA,kBAAe;IACb,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB;;;;;OAKG;IACH,YAAY,CAAC,MAAqB,EAAE,UAAyB,EAAE,IAA2B;QACxF,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACtC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IACD,cAAc,EAAE,SAAyC;CAC/B,CAAC"}

View File

@@ -0,0 +1,18 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { RedisArgument, ArrayReply, SetReply, BlobStringReply } from '@redis/client/dist/lib/RESP/types';
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Returns all terms in a dictionary.
* @param parser - The command parser
* @param dictionary - Name of the dictionary to dump
*/
readonly parseCommand: (this: void, parser: CommandParser, dictionary: RedisArgument) => void;
readonly transformReply: {
readonly 2: () => ArrayReply<BlobStringReply>;
readonly 3: () => SetReply<BlobStringReply>;
};
};
export default _default;
//# sourceMappingURL=DICTDUMP.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DICTDUMP.d.ts","sourceRoot":"","sources":["../../../lib/commands/DICTDUMP.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAW,MAAM,mCAAmC,CAAC;;;;IAKhH;;;;OAIG;gDACkB,aAAa,cAAc,aAAa;;0BAI1B,WAAW,eAAe,CAAC;0BAC3B,SAAS,eAAe,CAAC;;;AAb9D,wBAe6B"}

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Returns all terms in a dictionary.
* @param parser - The command parser
* @param dictionary - Name of the dictionary to dump
*/
parseCommand(parser, dictionary) {
parser.push('FT.DICTDUMP', dictionary);
},
transformReply: {
2: undefined,
3: undefined
}
};
//# sourceMappingURL=DICTDUMP.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DICTDUMP.js","sourceRoot":"","sources":["../../../lib/commands/DICTDUMP.ts"],"names":[],"mappings":";;AAGA,kBAAe;IACb,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB;;;;OAIG;IACH,YAAY,CAAC,MAAqB,EAAE,UAAyB;QAC3D,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IACzC,CAAC;IACD,cAAc,EAAE;QACd,CAAC,EAAE,SAAyD;QAC5D,CAAC,EAAE,SAAuD;KAC3D;CACyB,CAAC"}

View File

@@ -0,0 +1,23 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { RedisArgument, SimpleStringReply, NumberReply } from '@redis/client/dist/lib/RESP/types';
export interface FtDropIndexOptions {
DD?: true;
}
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Deletes an index and all associated documents.
* @param parser - The command parser
* @param index - Name of the index to delete
* @param options - Optional parameters:
* - DD: Also delete the indexed documents themselves
*/
readonly parseCommand: (this: void, parser: CommandParser, index: RedisArgument, options?: FtDropIndexOptions) => void;
readonly transformReply: {
readonly 2: () => SimpleStringReply<'OK'>;
readonly 3: () => NumberReply;
};
};
export default _default;
//# sourceMappingURL=DROPINDEX.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DROPINDEX.d.ts","sourceRoot":"","sources":["../../../lib/commands/DROPINDEX.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAW,MAAM,mCAAmC,CAAC;AAE3G,MAAM,WAAW,kBAAkB;IACjC,EAAE,CAAC,EAAE,IAAI,CAAC;CACX;;;;IAKC;;;;;;OAMG;gDACkB,aAAa,SAAS,aAAa,YAAY,kBAAkB;;0BAQnD,kBAAkB,IAAI,CAAC;0BACvB,WAAW;;;AAnBhD,wBAqB6B"}

View File

@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Deletes an index and all associated documents.
* @param parser - The command parser
* @param index - Name of the index to delete
* @param options - Optional parameters:
* - DD: Also delete the indexed documents themselves
*/
parseCommand(parser, index, options) {
parser.push('FT.DROPINDEX', index);
if (options?.DD) {
parser.push('DD');
}
},
transformReply: {
2: undefined,
3: undefined
}
};
//# sourceMappingURL=DROPINDEX.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"DROPINDEX.js","sourceRoot":"","sources":["../../../lib/commands/DROPINDEX.ts"],"names":[],"mappings":";;AAOA,kBAAe;IACb,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB;;;;;;OAMG;IACH,YAAY,CAAC,MAAqB,EAAE,KAAoB,EAAE,OAA4B;QACpF,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;QAEnC,IAAI,OAAO,EAAE,EAAE,EAAE,CAAC;YAChB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IACD,cAAc,EAAE;QACd,CAAC,EAAE,SAAqD;QACxD,CAAC,EAAE,SAAyC;KAC7C;CACyB,CAAC"}

View File

@@ -0,0 +1,24 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { RedisArgument, SimpleStringReply } from '@redis/client/dist/lib/RESP/types';
import { FtSearchParams } from './SEARCH';
export interface FtExplainOptions {
PARAMS?: FtSearchParams;
DIALECT?: number;
}
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Returns the execution plan for a complex query.
* @param parser - The command parser
* @param index - Name of the index to explain query against
* @param query - The query string to explain
* @param options - Optional parameters:
* - PARAMS: Named parameters to use in the query
* - DIALECT: Version of query dialect to use (defaults to 1)
*/
readonly parseCommand: (this: void, parser: CommandParser, index: RedisArgument, query: RedisArgument, options?: FtExplainOptions) => void;
readonly transformReply: () => SimpleStringReply;
};
export default _default;
//# sourceMappingURL=EXPLAIN.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"EXPLAIN.d.ts","sourceRoot":"","sources":["../../../lib/commands/EXPLAIN.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAW,MAAM,mCAAmC,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAuB,MAAM,UAAU,CAAC;AAG/D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;;;;IAKC;;;;;;;;OAQG;gDAEO,aAAa,SACd,aAAa,SACb,aAAa,YACV,gBAAgB;mCAYkB,iBAAiB;;AA5BjE,wBA6B6B"}

View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const SEARCH_1 = require("./SEARCH");
const default_1 = require("../dialect/default");
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Returns the execution plan for a complex query.
* @param parser - The command parser
* @param index - Name of the index to explain query against
* @param query - The query string to explain
* @param options - Optional parameters:
* - PARAMS: Named parameters to use in the query
* - DIALECT: Version of query dialect to use (defaults to 1)
*/
parseCommand(parser, index, query, options) {
parser.push('FT.EXPLAIN', index, query);
(0, SEARCH_1.parseParamsArgument)(parser, options?.PARAMS);
if (options?.DIALECT) {
parser.push('DIALECT', options.DIALECT.toString());
}
else {
parser.push('DIALECT', default_1.DEFAULT_DIALECT);
}
},
transformReply: undefined
};
//# sourceMappingURL=EXPLAIN.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"EXPLAIN.js","sourceRoot":"","sources":["../../../lib/commands/EXPLAIN.ts"],"names":[],"mappings":";;AAEA,qCAA+D;AAC/D,gDAAqD;AAOrD,kBAAe;IACb,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB;;;;;;;;OAQG;IACH,YAAY,CACV,MAAqB,EACrB,KAAoB,EACpB,KAAoB,EACpB,OAA0B;QAE1B,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAExC,IAAA,4BAAmB,EAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAE7C,IAAI,OAAO,EAAE,OAAO,EAAE,CAAC;YACrB,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,yBAAe,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IACD,cAAc,EAAE,SAA+C;CACrC,CAAC"}

View File

@@ -0,0 +1,21 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { RedisArgument, ArrayReply, BlobStringReply } from '@redis/client/dist/lib/RESP/types';
export interface FtExplainCLIOptions {
DIALECT?: number;
}
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Returns the execution plan for a complex query in a more verbose format than FT.EXPLAIN.
* @param parser - The command parser
* @param index - Name of the index to explain query against
* @param query - The query string to explain
* @param options - Optional parameters:
* - DIALECT: Version of query dialect to use (defaults to 1)
*/
readonly parseCommand: (this: void, parser: CommandParser, index: RedisArgument, query: RedisArgument, options?: FtExplainCLIOptions) => void;
readonly transformReply: () => ArrayReply<BlobStringReply>;
};
export default _default;
//# sourceMappingURL=EXPLAINCLI.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"EXPLAINCLI.d.ts","sourceRoot":"","sources":["../../../lib/commands/EXPLAINCLI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAW,MAAM,mCAAmC,CAAC;AAGxG,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;;;;IAKC;;;;;;;OAOG;gDAEO,aAAa,SACd,aAAa,SACb,aAAa,YACV,mBAAmB;mCAUe,WAAW,eAAe,CAAC;;AAzB3E,wBA0B6B"}

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const default_1 = require("../dialect/default");
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Returns the execution plan for a complex query in a more verbose format than FT.EXPLAIN.
* @param parser - The command parser
* @param index - Name of the index to explain query against
* @param query - The query string to explain
* @param options - Optional parameters:
* - DIALECT: Version of query dialect to use (defaults to 1)
*/
parseCommand(parser, index, query, options) {
parser.push('FT.EXPLAINCLI', index, query);
if (options?.DIALECT) {
parser.push('DIALECT', options.DIALECT.toString());
}
else {
parser.push('DIALECT', default_1.DEFAULT_DIALECT);
}
},
transformReply: undefined
};
//# sourceMappingURL=EXPLAINCLI.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"EXPLAINCLI.js","sourceRoot":"","sources":["../../../lib/commands/EXPLAINCLI.ts"],"names":[],"mappings":";;AAEA,gDAAqD;AAMrD,kBAAe;IACb,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB;;;;;;;OAOG;IACH,YAAY,CACV,MAAqB,EACrB,KAAoB,EACpB,KAAoB,EACpB,OAA6B;QAE7B,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAE3C,IAAI,OAAO,EAAE,OAAO,EAAE,CAAC;YACrB,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,yBAAe,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IACD,cAAc,EAAE,SAAyD;CAC/C,CAAC"}

69
node_modules/@redis/search/dist/lib/commands/INFO.d.ts generated vendored Normal file
View File

@@ -0,0 +1,69 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { RedisArgument } from "@redis/client";
import { ArrayReply, BlobStringReply, DoubleReply, MapReply, NullReply, NumberReply, ReplyUnion, SimpleStringReply, TypeMapping } from "@redis/client/dist/lib/RESP/types";
import { TuplesReply } from '@redis/client/dist/lib/RESP/types';
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Returns information and statistics about an index.
* @param parser - The command parser
* @param index - Name of the index to get information about
*/
readonly parseCommand: (this: void, parser: CommandParser, index: RedisArgument) => void;
readonly transformReply: {
readonly 2: typeof transformV2Reply;
readonly 3: () => ReplyUnion;
};
readonly unstableResp3: true;
};
export default _default;
export interface InfoReply {
index_name: SimpleStringReply;
index_options: ArrayReply<SimpleStringReply>;
index_definition: MapReply<SimpleStringReply, SimpleStringReply>;
attributes: Array<MapReply<SimpleStringReply, SimpleStringReply>>;
num_docs: NumberReply;
max_doc_id: NumberReply;
num_terms: NumberReply;
num_records: NumberReply;
inverted_sz_mb: DoubleReply;
vector_index_sz_mb: DoubleReply;
total_inverted_index_blocks: NumberReply;
offset_vectors_sz_mb: DoubleReply;
doc_table_size_mb: DoubleReply;
sortable_values_size_mb: DoubleReply;
key_table_size_mb: DoubleReply;
tag_overhead_sz_mb: DoubleReply;
text_overhead_sz_mb: DoubleReply;
total_index_memory_sz_mb: DoubleReply;
geoshapes_sz_mb: DoubleReply;
records_per_doc_avg: DoubleReply;
bytes_per_record_avg: DoubleReply;
offsets_per_term_avg: DoubleReply;
offset_bits_per_record_avg: DoubleReply;
hash_indexing_failures: NumberReply;
total_indexing_time: DoubleReply;
indexing: NumberReply;
percent_indexed: DoubleReply;
number_of_uses: NumberReply;
cleaning: NumberReply;
gc_stats: {
bytes_collected: DoubleReply;
total_ms_run: DoubleReply;
total_cycles: DoubleReply;
average_cycle_time_ms: DoubleReply;
last_run_time_ms: DoubleReply;
gc_numeric_trees_missed: DoubleReply;
gc_blocks_denied: DoubleReply;
};
cursor_stats: {
global_idle: NumberReply;
global_total: NumberReply;
index_capacity: NumberReply;
index_total: NumberReply;
};
stopwords_list?: ArrayReply<BlobStringReply> | TuplesReply<[NullReply]>;
}
declare function transformV2Reply(reply: Array<any>, preserve?: any, typeMapping?: TypeMapping): InfoReply;
//# sourceMappingURL=INFO.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"INFO.d.ts","sourceRoot":"","sources":["../../../lib/commands/INFO.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;A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CAAC;IACpC,mBAAmB,EAAE,WAAW,CAAC;IACjC,QAAQ,EAAE,WAAW,CAAC;IACtB,eAAe,EAAE,WAAW,CAAC;IAC7B,cAAc,EAAE,WAAW,CAAC;IAC5B,QAAQ,EAAE,WAAW,CAAC;IACtB,QAAQ,EAAE;QACR,eAAe,EAAE,WAAW,CAAC;QAC7B,YAAY,EAAE,WAAW,CAAC;QAC1B,YAAY,EAAE,WAAW,CAAC;QAC1B,qBAAqB,EAAE,WAAW,CAAC;QACnC,gBAAgB,EAAE,WAAW,CAAC;QAC9B,uBAAuB,EAAE,WAAW,CAAC;QACrC,gBAAgB,EAAE,WAAW,CAAC;KAC/B,CAAC;IACF,YAAY,EAAE;QACZ,WAAW,EAAE,WAAW,CAAC;QACzB,YAAY,EAAE,WAAW,CAAC;QAC1B,cAAc,EAAE,WAAW,CAAC;QAC5B,WAAW,EAAE,WAAW,CAAC;KAC1B,CAAC;IACF,cAAc,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,GAAG,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;CACzE;AAED,iBAAS,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,EAAE,GAAG,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,SAAS,CAgGjG"}

106
node_modules/@redis/search/dist/lib/commands/INFO.js generated vendored Normal file
View File

@@ -0,0 +1,106 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const generic_transformers_1 = require("@redis/client/dist/lib/commands/generic-transformers");
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Returns information and statistics about an index.
* @param parser - The command parser
* @param index - Name of the index to get information about
*/
parseCommand(parser, index) {
parser.push('FT.INFO', index);
},
transformReply: {
2: transformV2Reply,
3: undefined
},
unstableResp3: true
};
function transformV2Reply(reply, preserve, typeMapping) {
const myTransformFunc = (0, generic_transformers_1.createTransformTuplesReplyFunc)(preserve, typeMapping);
const ret = {};
for (let i = 0; i < reply.length; i += 2) {
const key = reply[i].toString();
switch (key) {
case 'index_name':
case 'index_options':
case 'num_docs':
case 'max_doc_id':
case 'num_terms':
case 'num_records':
case 'total_inverted_index_blocks':
case 'hash_indexing_failures':
case 'indexing':
case 'number_of_uses':
case 'cleaning':
case 'stopwords_list':
ret[key] = reply[i + 1];
break;
case 'inverted_sz_mb':
case 'vector_index_sz_mb':
case 'offset_vectors_sz_mb':
case 'doc_table_size_mb':
case 'sortable_values_size_mb':
case 'key_table_size_mb':
case 'text_overhead_sz_mb':
case 'tag_overhead_sz_mb':
case 'total_index_memory_sz_mb':
case 'geoshapes_sz_mb':
case 'records_per_doc_avg':
case 'bytes_per_record_avg':
case 'offsets_per_term_avg':
case 'offset_bits_per_record_avg':
case 'total_indexing_time':
case 'percent_indexed':
ret[key] = generic_transformers_1.transformDoubleReply[2](reply[i + 1], undefined, typeMapping);
break;
case 'index_definition':
ret[key] = myTransformFunc(reply[i + 1]);
break;
case 'attributes':
ret[key] = reply[i + 1].map(attribute => myTransformFunc(attribute));
break;
case 'gc_stats': {
const innerRet = {};
const array = reply[i + 1];
for (let i = 0; i < array.length; i += 2) {
const innerKey = array[i].toString();
switch (innerKey) {
case 'bytes_collected':
case 'total_ms_run':
case 'total_cycles':
case 'average_cycle_time_ms':
case 'last_run_time_ms':
case 'gc_numeric_trees_missed':
case 'gc_blocks_denied':
innerRet[innerKey] = generic_transformers_1.transformDoubleReply[2](array[i + 1], undefined, typeMapping);
break;
}
}
ret[key] = innerRet;
break;
}
case 'cursor_stats': {
const innerRet = {};
const array = reply[i + 1];
for (let i = 0; i < array.length; i += 2) {
const innerKey = array[i].toString();
switch (innerKey) {
case 'global_idle':
case 'global_total':
case 'index_capacity':
case 'index_total':
innerRet[innerKey] = array[i + 1];
break;
}
}
ret[key] = innerRet;
break;
}
}
}
return ret;
}
//# sourceMappingURL=INFO.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"INFO.js","sourceRoot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Ac,CAAC;wBACpB,KAAK,uBAAuB,CAAC;wBAC7B,KAAK,kBAAkB,CAAC;wBACxB,KAAK,yBAAyB,CAAC;wBAC/B,KAAK,kBAAkB;4BACrB,QAAQ,CAAC,QAAQ,CAAC,GAAG,2CAAoB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAC,CAAC,CAAC,EAAE,SAAS,EAAE,WAAW,CAAgB,CAAC;4BAChG,MAAM;oBACV,CAAC;gBACH,CAAC;gBAED,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;gBACpB,MAAM;YACR,CAAC;YACD,KAAK,cAAc,CAAC,CAAC,CAAC;gBACpB,MAAM,QAAQ,GAAG,EAA0C,CAAC;gBAE5D,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC;gBAEzB,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;oBACvC,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAqC,CAAC;oBAExE,QAAQ,QAAQ,EAAE,CAAC;wBACjB,KAAK,aAAa,CAAC;wBACnB,KAAK,cAAc,CAAC;wBACpB,KAAK,gBAAgB,CAAC;wBACtB,KAAK,aAAa;4BAChB,QAAQ,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,CAAC,GAAC,CAAC,CAAC,CAAC;4BAChC,MAAM;oBACV,CAAC;gBACH,CAAC;gBAED,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;gBACpB,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}

View File

@@ -0,0 +1,25 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { ReplyUnion, UnwrapReply } from '@redis/client/dist/lib/RESP/types';
import { FtAggregateOptions } from './AGGREGATE';
import { ProfileOptions, ProfileReplyResp2 } from './PROFILE_SEARCH';
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Profiles the execution of an aggregation query for performance analysis.
* @param parser - The command parser
* @param index - Name of the index to profile query against
* @param query - The aggregation query to profile
* @param options - Optional parameters:
* - LIMITED: Collect limited timing information only
* - All options supported by FT.AGGREGATE command
*/
readonly parseCommand: (this: void, parser: CommandParser, index: string, query: string, options?: ProfileOptions & FtAggregateOptions) => void;
readonly transformReply: {
readonly 2: (reply: [[total: UnwrapReply<import("@redis/client/dist/lib/RESP/types").NumberReply<number>>, ...results: import("@redis/client/dist/lib/RESP/types").ArrayReply<import("@redis/client/dist/lib/RESP/types").BlobStringReply<string>>[]], import("@redis/client/dist/lib/RESP/types").ArrayReply<ReplyUnion>]) => ProfileReplyResp2;
readonly 3: (reply: ReplyUnion) => ReplyUnion;
};
readonly unstableResp3: true;
};
export default _default;
//# sourceMappingURL=PROFILE_AGGREGATE.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"PROFILE_AGGREGATE.d.ts","sourceRoot":"","sources":["../../../lib/commands/PROFILE_AGGREGATE.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAW,UAAU,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAkB,EAAqB,kBAAkB,EAAyB,MAAM,aAAa,CAAC;AACtG,OAAO,EAAE,cAAc,EAAwB,iBAAiB,EAAG,MAAM,kBAAkB,CAAC;;;;IAK1F;;;;;;;;OAQG;gDAEO,aAAa,SACd,MAAM,SACN,MAAM,YACH,cAAc,GAAG,kBAAkB;;uUAaqB,iBAAiB;4BAMxE,UAAU,KAAG,UAAU;;;;AAnCtC,wBAsC6B"}

View File

@@ -0,0 +1,58 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const AGGREGATE_1 = __importStar(require("./AGGREGATE"));
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Profiles the execution of an aggregation query for performance analysis.
* @param parser - The command parser
* @param index - Name of the index to profile query against
* @param query - The aggregation query to profile
* @param options - Optional parameters:
* - LIMITED: Collect limited timing information only
* - All options supported by FT.AGGREGATE command
*/
parseCommand(parser, index, query, options) {
parser.push('FT.PROFILE', index, 'AGGREGATE');
if (options?.LIMITED) {
parser.push('LIMITED');
}
parser.push('QUERY', query);
(0, AGGREGATE_1.parseAggregateOptions)(parser, options);
},
transformReply: {
2: (reply) => {
return {
results: AGGREGATE_1.default.transformReply[2](reply[0]),
profile: reply[1]
};
},
3: (reply) => reply
},
unstableResp3: true
};
//# sourceMappingURL=PROFILE_AGGREGATE.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"PROFILE_AGGREGATE.js","sourceRoot":"","sources":["../../../lib/commands/PROFILE_AGGREGATE.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yDAAsG;AAGtG,kBAAe;IACb,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB;;;;;;;;OAQG;IACH,YAAY,CACV,MAAqB,EACrB,KAAa,EACb,KAAa,EACb,OAA6C;QAE7C,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;QAE9C,IAAI,OAAO,EAAE,OAAO,EAAE,CAAC;YACrB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzB,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAE5B,IAAA,iCAAqB,EAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACxC,CAAC;IACD,cAAc,EAAE;QACd,CAAC,EAAE,CAAC,KAA2D,EAAqB,EAAE;YACpF,OAAO;gBACL,OAAO,EAAE,mBAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAC9C,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;aAClB,CAAA;QACH,CAAC;QACD,CAAC,EAAE,CAAC,KAAiB,EAAc,EAAE,CAAC,KAAK;KAC5C;IACD,aAAa,EAAE,IAAI;CACO,CAAC"}

View File

@@ -0,0 +1,36 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { ArrayReply, RedisArgument, ReplyUnion, TuplesReply } from '@redis/client/dist/lib/RESP/types';
import { AggregateReply } from './AGGREGATE';
import { FtSearchOptions, SearchRawReply, SearchReply } from './SEARCH';
export type ProfileRawReplyResp2<T> = TuplesReply<[
T,
ArrayReply<ReplyUnion>
]>;
export interface ProfileReplyResp2 {
results: SearchReply | AggregateReply;
profile: ReplyUnion;
}
export interface ProfileOptions {
LIMITED?: true;
}
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Profiles the execution of a search query for performance analysis.
* @param parser - The command parser
* @param index - Name of the index to profile query against
* @param query - The search query to profile
* @param options - Optional parameters:
* - LIMITED: Collect limited timing information only
* - All options supported by FT.SEARCH command
*/
readonly parseCommand: (this: void, parser: CommandParser, index: RedisArgument, query: RedisArgument, options?: ProfileOptions & FtSearchOptions) => void;
readonly transformReply: {
readonly 2: (reply: [SearchRawReply, ArrayReply<ReplyUnion>]) => ProfileReplyResp2;
readonly 3: (reply: ReplyUnion) => ReplyUnion;
};
readonly unstableResp3: true;
};
export default _default;
//# sourceMappingURL=PROFILE_SEARCH.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"PROFILE_SEARCH.d.ts","sourceRoot":"","sources":["../../../lib/commands/PROFILE_SEARCH.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,UAAU,EAAW,aAAa,EAAE,UAAU,EAAE,WAAW,EAAe,MAAM,mCAAmC,CAAC;AAC7H,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAe,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAsB,MAAM,UAAU,CAAC;AAEpG,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,WAAW,CAAC;IAChD,CAAC;IACD,UAAU,CAAC,UAAU,CAAC;CACvB,CAAC,CAAC;AAIH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,WAAW,GAAG,cAAc,CAAC;IACtC,OAAO,EAAE,UAAU,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,IAAI,CAAC;CAChB;;;;IAKC;;;;;;;;OAQG;gDAEO,aAAa,SACd,aAAa,SACb,aAAa,YACV,cAAc,GAAG,eAAe;;yEAaW,iBAAiB;4BAM3D,UAAU,KAAG,UAAU;;;;AAnCtC,wBAsC6B"}

View File

@@ -0,0 +1,58 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const SEARCH_1 = __importStar(require("./SEARCH"));
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Profiles the execution of a search query for performance analysis.
* @param parser - The command parser
* @param index - Name of the index to profile query against
* @param query - The search query to profile
* @param options - Optional parameters:
* - LIMITED: Collect limited timing information only
* - All options supported by FT.SEARCH command
*/
parseCommand(parser, index, query, options) {
parser.push('FT.PROFILE', index, 'SEARCH');
if (options?.LIMITED) {
parser.push('LIMITED');
}
parser.push('QUERY', query);
(0, SEARCH_1.parseSearchOptions)(parser, options);
},
transformReply: {
2: (reply) => {
return {
results: SEARCH_1.default.transformReply[2](reply[0]),
profile: reply[1]
};
},
3: (reply) => reply
},
unstableResp3: true
};
//# sourceMappingURL=PROFILE_SEARCH.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"PROFILE_SEARCH.js","sourceRoot":"","sources":["../../../lib/commands/PROFILE_SEARCH.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA,mDAAoG;AAkBpG,kBAAe;IACb,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB;;;;;;;;OAQG;IACH,YAAY,CACV,MAAqB,EACrB,KAAoB,EACpB,KAAoB,EACpB,OAA0C;QAE1C,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAE3C,IAAI,OAAO,EAAE,OAAO,EAAE,CAAC;YACrB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzB,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAE5B,IAAA,2BAAkB,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IACD,cAAc,EAAE;QACd,CAAC,EAAE,CAAC,KAA8C,EAAqB,EAAE;YACvE,OAAO;gBACL,OAAO,EAAE,gBAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAC3C,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;aAClB,CAAC;QACJ,CAAC;QACD,CAAC,EAAE,CAAC,KAAiB,EAAc,EAAE,CAAC,KAAK;KAC5C;IACD,aAAa,EAAE,IAAI;CACO,CAAC"}

View File

@@ -0,0 +1,81 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { RedisArgument, ReplyUnion } from '@redis/client/dist/lib/RESP/types';
import { RedisVariadicArgument } from '@redis/client/dist/lib/commands/generic-transformers';
import { RediSearchLanguage } from './CREATE';
export type FtSearchParams = Record<string, RedisArgument | number>;
export declare function parseParamsArgument(parser: CommandParser, params?: FtSearchParams): void;
export interface FtSearchOptions {
VERBATIM?: boolean;
NOSTOPWORDS?: boolean;
INKEYS?: RedisVariadicArgument;
INFIELDS?: RedisVariadicArgument;
RETURN?: RedisVariadicArgument;
SUMMARIZE?: boolean | {
FIELDS?: RedisArgument | Array<RedisArgument>;
FRAGS?: number;
LEN?: number;
SEPARATOR?: RedisArgument;
};
HIGHLIGHT?: boolean | {
FIELDS?: RedisArgument | Array<RedisArgument>;
TAGS?: {
open: RedisArgument;
close: RedisArgument;
};
};
SLOP?: number;
TIMEOUT?: number;
INORDER?: boolean;
LANGUAGE?: RediSearchLanguage;
EXPANDER?: RedisArgument;
SCORER?: RedisArgument;
SORTBY?: RedisArgument | {
BY: RedisArgument;
DIRECTION?: 'ASC' | 'DESC';
};
LIMIT?: {
from: number | RedisArgument;
size: number | RedisArgument;
};
PARAMS?: FtSearchParams;
DIALECT?: number;
}
export declare function parseSearchOptions(parser: CommandParser, options?: FtSearchOptions): void;
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Searches a RediSearch index with the given query.
* @param parser - The command parser
* @param index - The index name to search
* @param query - The text query to search. For syntax, see https://redis.io/docs/stack/search/reference/query_syntax
* @param options - Optional search parameters including:
* - VERBATIM: do not try to use stemming for query expansion
* - NOSTOPWORDS: do not filter stopwords from the query
* - INKEYS/INFIELDS: restrict the search to specific keys/fields
* - RETURN: limit which fields are returned
* - SUMMARIZE/HIGHLIGHT: create search result highlights
* - LIMIT: pagination control
* - SORTBY: sort results by a specific field
* - PARAMS: bind parameters to the query
*/
readonly parseCommand: (this: void, parser: CommandParser, index: RedisArgument, query: RedisArgument, options?: FtSearchOptions) => void;
readonly transformReply: {
readonly 2: (reply: SearchRawReply) => SearchReply;
readonly 3: () => ReplyUnion;
};
readonly unstableResp3: true;
};
export default _default;
export type SearchRawReply = Array<any>;
interface SearchDocumentValue {
[key: string]: string | number | null | Array<SearchDocumentValue> | SearchDocumentValue;
}
export interface SearchReply {
total: number;
documents: Array<{
id: string;
value: SearchDocumentValue;
}>;
}
//# sourceMappingURL=SEARCH.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"SEARCH.d.ts","sourceRoot":"","sources":["../../../lib/commands/SEARCH.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAW,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAiC,MAAM,sDAAsD,CAAC;AAC5H,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAG9C,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,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AAM,CAAC,EAAE,cAAc,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,eAAe,QA8FlF;;;;IAKC;;;;;;;;;;;;;;OAcG;gDACkB,aAAa,SAAS,aAAa,SAAS,aAAa,YAAY,eAAe;;+CAM3E,WAAW;0BAkBN,UAAU;;;;AA1C/C,wBA6C6B;AAE7B,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;AAExC,UAAU,mBAAmB;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,KAAK,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAAC;CAC1F;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,KAAK,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,mBAAmB,CAAC;KAC9B,CAAC,CAAC;CACJ"}

160
node_modules/@redis/search/dist/lib/commands/SEARCH.js generated vendored Normal file
View File

@@ -0,0 +1,160 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseSearchOptions = exports.parseParamsArgument = void 0;
const generic_transformers_1 = require("@redis/client/dist/lib/commands/generic-transformers");
const default_1 = require("../dialect/default");
function parseParamsArgument(parser, params) {
if (params) {
parser.push('PARAMS');
const args = [];
for (const key in params) {
if (!Object.hasOwn(params, key))
continue;
const value = params[key];
args.push(key, typeof value === 'number' ? value.toString() : value);
}
parser.pushVariadicWithLength(args);
}
}
exports.parseParamsArgument = parseParamsArgument;
function parseSearchOptions(parser, options) {
if (options?.VERBATIM) {
parser.push('VERBATIM');
}
if (options?.NOSTOPWORDS) {
parser.push('NOSTOPWORDS');
}
(0, generic_transformers_1.parseOptionalVariadicArgument)(parser, 'INKEYS', options?.INKEYS);
(0, generic_transformers_1.parseOptionalVariadicArgument)(parser, 'INFIELDS', options?.INFIELDS);
(0, generic_transformers_1.parseOptionalVariadicArgument)(parser, 'RETURN', options?.RETURN);
if (options?.SUMMARIZE) {
parser.push('SUMMARIZE');
if (typeof options.SUMMARIZE === 'object') {
(0, generic_transformers_1.parseOptionalVariadicArgument)(parser, 'FIELDS', options.SUMMARIZE.FIELDS);
if (options.SUMMARIZE.FRAGS !== undefined) {
parser.push('FRAGS', options.SUMMARIZE.FRAGS.toString());
}
if (options.SUMMARIZE.LEN !== undefined) {
parser.push('LEN', options.SUMMARIZE.LEN.toString());
}
if (options.SUMMARIZE.SEPARATOR !== undefined) {
parser.push('SEPARATOR', options.SUMMARIZE.SEPARATOR);
}
}
}
if (options?.HIGHLIGHT) {
parser.push('HIGHLIGHT');
if (typeof options.HIGHLIGHT === 'object') {
(0, generic_transformers_1.parseOptionalVariadicArgument)(parser, 'FIELDS', options.HIGHLIGHT.FIELDS);
if (options.HIGHLIGHT.TAGS) {
parser.push('TAGS', options.HIGHLIGHT.TAGS.open, options.HIGHLIGHT.TAGS.close);
}
}
}
if (options?.SLOP !== undefined) {
parser.push('SLOP', options.SLOP.toString());
}
if (options?.TIMEOUT !== undefined) {
parser.push('TIMEOUT', options.TIMEOUT.toString());
}
if (options?.INORDER) {
parser.push('INORDER');
}
if (options?.LANGUAGE) {
parser.push('LANGUAGE', options.LANGUAGE);
}
if (options?.EXPANDER) {
parser.push('EXPANDER', options.EXPANDER);
}
if (options?.SCORER) {
parser.push('SCORER', options.SCORER);
}
if (options?.SORTBY) {
parser.push('SORTBY');
if (typeof options.SORTBY === 'string' || options.SORTBY instanceof Buffer) {
parser.push(options.SORTBY);
}
else {
parser.push(options.SORTBY.BY);
if (options.SORTBY.DIRECTION) {
parser.push(options.SORTBY.DIRECTION);
}
}
}
if (options?.LIMIT) {
parser.push('LIMIT', options.LIMIT.from.toString(), options.LIMIT.size.toString());
}
parseParamsArgument(parser, options?.PARAMS);
if (options?.DIALECT) {
parser.push('DIALECT', options.DIALECT.toString());
}
else {
parser.push('DIALECT', default_1.DEFAULT_DIALECT);
}
}
exports.parseSearchOptions = parseSearchOptions;
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Searches a RediSearch index with the given query.
* @param parser - The command parser
* @param index - The index name to search
* @param query - The text query to search. For syntax, see https://redis.io/docs/stack/search/reference/query_syntax
* @param options - Optional search parameters including:
* - VERBATIM: do not try to use stemming for query expansion
* - NOSTOPWORDS: do not filter stopwords from the query
* - INKEYS/INFIELDS: restrict the search to specific keys/fields
* - RETURN: limit which fields are returned
* - SUMMARIZE/HIGHLIGHT: create search result highlights
* - LIMIT: pagination control
* - SORTBY: sort results by a specific field
* - PARAMS: bind parameters to the query
*/
parseCommand(parser, index, query, options) {
parser.push('FT.SEARCH', index, query);
parseSearchOptions(parser, options);
},
transformReply: {
2: (reply) => {
// if reply[2] is array, then we have content/documents. Otherwise, only ids
const withoutDocuments = reply.length > 2 && !Array.isArray(reply[2]);
const documents = [];
let i = 1;
while (i < reply.length) {
documents.push({
id: reply[i++],
value: withoutDocuments ? Object.create(null) : documentValue(reply[i++])
});
}
return {
total: reply[0],
documents
};
},
3: undefined
},
unstableResp3: true
};
function documentValue(tuples) {
const message = Object.create(null);
if (!tuples) {
return message;
}
let i = 0;
while (i < tuples.length) {
const key = tuples[i++], value = tuples[i++];
if (key === '$') { // might be a JSON reply
try {
Object.assign(message, JSON.parse(value));
continue;
}
catch {
// set as a regular property if not a valid JSON
}
}
message[key] = value;
}
return message;
}
//# sourceMappingURL=SEARCH.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,26 @@
import { ReplyUnion } from '@redis/client/dist/lib/RESP/types';
import { SearchRawReply } from './SEARCH';
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Performs a search query but returns only document ids without their contents.
* @param args - Same parameters as FT.SEARCH:
* - parser: The command parser
* - index: Name of the index to search
* - query: The text query to search
* - options: Optional search parameters
*/
readonly parseCommand: (this: void, parser: import("@redis/client").CommandParser, index: import("@redis/client/dist/lib/RESP/types").RedisArgument, query: import("@redis/client/dist/lib/RESP/types").RedisArgument, options?: import("./SEARCH").FtSearchOptions | undefined) => void;
readonly transformReply: {
readonly 2: (reply: SearchRawReply) => SearchNoContentReply;
readonly 3: () => ReplyUnion;
};
readonly unstableResp3: true;
};
export default _default;
export interface SearchNoContentReply {
total: number;
documents: Array<string>;
}
//# sourceMappingURL=SEARCH_NOCONTENT.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"SEARCH_NOCONTENT.d.ts","sourceRoot":"","sources":["../../../lib/commands/SEARCH_NOCONTENT.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;;;;IAKhD;;;;;;;OAOG;;;+CAM2B,oBAAoB;0BAMf,UAAU;;;;AAtB/C,wBAyB6B;AAE7B,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC1B"}

View File

@@ -0,0 +1,34 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const SEARCH_1 = __importDefault(require("./SEARCH"));
exports.default = {
NOT_KEYED_COMMAND: SEARCH_1.default.NOT_KEYED_COMMAND,
IS_READ_ONLY: SEARCH_1.default.IS_READ_ONLY,
/**
* Performs a search query but returns only document ids without their contents.
* @param args - Same parameters as FT.SEARCH:
* - parser: The command parser
* - index: Name of the index to search
* - query: The text query to search
* - options: Optional search parameters
*/
parseCommand(...args) {
SEARCH_1.default.parseCommand(...args);
args[0].push('NOCONTENT');
},
transformReply: {
2: (reply) => {
return {
total: reply[0],
documents: reply.slice(1)
};
},
3: undefined
},
unstableResp3: true
};
;
//# sourceMappingURL=SEARCH_NOCONTENT.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"SEARCH_NOCONTENT.js","sourceRoot":"","sources":["../../../lib/commands/SEARCH_NOCONTENT.ts"],"names":[],"mappings":";;;;;AACA,sDAAkD;AAElD,kBAAe;IACb,iBAAiB,EAAE,gBAAM,CAAC,iBAAiB;IAC3C,YAAY,EAAE,gBAAM,CAAC,YAAY;IACjC;;;;;;;OAOG;IACH,YAAY,CAAC,GAAG,IAA4C;QAC1D,gBAAM,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC5B,CAAC;IACD,cAAc,EAAE;QACd,CAAC,EAAE,CAAC,KAAqB,EAAwB,EAAE;YACjD,OAAO;gBACL,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;gBACf,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;aAC1B,CAAA;QACH,CAAC;QACD,CAAC,EAAE,SAAwC;KAC5C;IACD,aAAa,EAAE,IAAI;CACO,CAAC;AAK5B,CAAC"}

View File

@@ -0,0 +1,45 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { RedisArgument, ReplyUnion } from '@redis/client/dist/lib/RESP/types';
export interface Terms {
mode: 'INCLUDE' | 'EXCLUDE';
dictionary: RedisArgument;
}
export interface FtSpellCheckOptions {
DISTANCE?: number;
TERMS?: Terms | Array<Terms>;
DIALECT?: number;
}
declare const _default: {
readonly NOT_KEYED_COMMAND: true;
readonly IS_READ_ONLY: true;
/**
* Performs spelling correction on a search query.
* @param parser - The command parser
* @param index - Name of the index to use for spelling corrections
* @param query - The search query to check for spelling
* @param options - Optional parameters:
* - DISTANCE: Maximum Levenshtein distance for spelling suggestions
* - TERMS: Custom dictionary terms to include/exclude
* - DIALECT: Version of query dialect to use (defaults to 1)
*/
readonly parseCommand: (this: void, parser: CommandParser, index: RedisArgument, query: RedisArgument, options?: FtSpellCheckOptions) => void;
readonly transformReply: {
readonly 2: (rawReply: SpellCheckRawReply) => SpellCheckReply;
readonly 3: () => ReplyUnion;
};
readonly unstableResp3: true;
};
export default _default;
type SpellCheckRawReply = Array<[
_: string,
term: string,
suggestions: Array<[score: string, suggestion: string]>
]>;
type SpellCheckReply = Array<{
term: string;
suggestions: Array<{
score: number;
suggestion: string;
}>;
}>;
//# sourceMappingURL=SPELLCHECK.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"SPELLCHECK.d.ts","sourceRoot":"","sources":["../../../lib/commands/SPELLCHECK.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAW,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAGvF,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IAC5B,UAAU,EAAE,aAAa,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;;;;IAKC;;;;;;;;;OASG;gDACkB,aAAa,SAAS,aAAa,SAAS,aAAa,YAAY,mBAAmB;;;0BAiC1E,UAAU;;;;AA9C/C,wBAiD6B;AAM7B,KAAK,kBAAkB,GAAG,KAAK,CAAC;IAC9B,CAAC,EAAE,MAAM;IACT,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;CACxD,CAAC,CAAC;AAEH,KAAK,eAAe,GAAG,KAAK,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,KAAK,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAA;KACnB,CAAC,CAAA;CACH,CAAC,CAAC"}

View File

@@ -0,0 +1,56 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const default_1 = require("../dialect/default");
exports.default = {
NOT_KEYED_COMMAND: true,
IS_READ_ONLY: true,
/**
* Performs spelling correction on a search query.
* @param parser - The command parser
* @param index - Name of the index to use for spelling corrections
* @param query - The search query to check for spelling
* @param options - Optional parameters:
* - DISTANCE: Maximum Levenshtein distance for spelling suggestions
* - TERMS: Custom dictionary terms to include/exclude
* - DIALECT: Version of query dialect to use (defaults to 1)
*/
parseCommand(parser, index, query, options) {
parser.push('FT.SPELLCHECK', index, query);
if (options?.DISTANCE) {
parser.push('DISTANCE', options.DISTANCE.toString());
}
if (options?.TERMS) {
if (Array.isArray(options.TERMS)) {
for (const term of options.TERMS) {
parseTerms(parser, term);
}
}
else {
parseTerms(parser, options.TERMS);
}
}
if (options?.DIALECT) {
parser.push('DIALECT', options.DIALECT.toString());
}
else {
parser.push('DIALECT', default_1.DEFAULT_DIALECT);
}
},
transformReply: {
2: (rawReply) => {
return rawReply.map(([, term, suggestions]) => ({
term,
suggestions: suggestions.map(([score, suggestion]) => ({
score: Number(score),
suggestion
}))
}));
},
3: undefined,
},
unstableResp3: true
};
function parseTerms(parser, { mode, dictionary }) {
parser.push('TERMS', mode, dictionary);
}
//# sourceMappingURL=SPELLCHECK.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"SPELLCHECK.js","sourceRoot":"","sources":["../../../lib/commands/SPELLCHECK.ts"],"names":[],"mappings":";;AAEA,gDAAqD;AAarD,kBAAe;IACb,iBAAiB,EAAE,IAAI;IACvB,YAAY,EAAE,IAAI;IAClB;;;;;;;;;OASG;IACH,YAAY,CAAC,MAAqB,EAAE,KAAoB,EAAE,KAAoB,EAAE,OAA6B;QAC3G,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAE3C,IAAI,OAAO,EAAE,Q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;IACpE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;AACzC,CAAC"}

View File

@@ -0,0 +1,23 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { RedisArgument, NumberReply } from '@redis/client/dist/lib/RESP/types';
export interface FtSugAddOptions {
INCR?: boolean;
PAYLOAD?: RedisArgument;
}
declare const _default: {
readonly IS_READ_ONLY: true;
/**
* Adds a suggestion string to an auto-complete suggestion dictionary.
* @param parser - The command parser
* @param key - The suggestion dictionary key
* @param string - The suggestion string to add
* @param score - The suggestion score used for sorting
* @param options - Optional parameters:
* - INCR: If true, increment the existing entry's score
* - PAYLOAD: Optional payload to associate with the suggestion
*/
readonly parseCommand: (this: void, parser: CommandParser, key: RedisArgument, string: RedisArgument, score: number, options?: FtSugAddOptions) => void;
readonly transformReply: () => NumberReply;
};
export default _default;
//# sourceMappingURL=SUGADD.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"SUGADD.d.ts","sourceRoot":"","sources":["../../../lib/commands/SUGADD.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAW,MAAM,mCAAmC,CAAC;AAExF,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;;;IAIC;;;;;;;;;OASG;gDACkB,aAAa,OAAO,aAAa,UAAU,aAAa,SAAS,MAAM,YAAY,eAAe;mCAazE,WAAW;;AAzB3D,wBA0B6B"}

28
node_modules/@redis/search/dist/lib/commands/SUGADD.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {
IS_READ_ONLY: true,
/**
* Adds a suggestion string to an auto-complete suggestion dictionary.
* @param parser - The command parser
* @param key - The suggestion dictionary key
* @param string - The suggestion string to add
* @param score - The suggestion score used for sorting
* @param options - Optional parameters:
* - INCR: If true, increment the existing entry's score
* - PAYLOAD: Optional payload to associate with the suggestion
*/
parseCommand(parser, key, string, score, options) {
parser.push('FT.SUGADD');
parser.pushKey(key);
parser.push(string, score.toString());
if (options?.INCR) {
parser.push('INCR');
}
if (options?.PAYLOAD) {
parser.push('PAYLOAD', options.PAYLOAD);
}
},
transformReply: undefined
};
//# sourceMappingURL=SUGADD.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"SUGADD.js","sourceRoot":"","sources":["../../../lib/commands/SUGADD.ts"],"names":[],"mappings":";;AAQA,kBAAe;IACb,YAAY,EAAE,IAAI;IAClB;;;;;;;;;OASG;IACH,YAAY,CAAC,MAAqB,EAAE,GAAkB,EAAE,MAAqB,EAAE,KAAa,EAAE,OAAyB;QACrH,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACzB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACpB,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEtC,IAAI,OAAO,EAAE,IAAI,EAAE,CAAC;YAClB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtB,CAAC;QAED,IAAI,OAAO,EAAE,OAAO,EAAE,CAAC;YACrB,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IACD,cAAc,EAAE,SAAyC;CAC/B,CAAC"}

View File

@@ -0,0 +1,15 @@
import { CommandParser } from '@redis/client/dist/lib/client/parser';
import { RedisArgument, NumberReply } from '@redis/client/dist/lib/RESP/types';
declare const _default: {
readonly IS_READ_ONLY: true;
/**
* Deletes a string from a suggestion dictionary.
* @param parser - The command parser
* @param key - The suggestion dictionary key
* @param string - The suggestion string to delete
*/
readonly parseCommand: (this: void, parser: CommandParser, key: RedisArgument, string: RedisArgument) => void;
readonly transformReply: () => NumberReply<0 | 1>;
};
export default _default;
//# sourceMappingURL=SUGDEL.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"SUGDEL.d.ts","sourceRoot":"","sources":["../../../lib/commands/SUGDEL.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAW,MAAM,mCAAmC,CAAC;;;IAItF;;;;;OAKG;gDACkB,aAAa,OAAO,aAAa,UAAU,aAAa;mCAK/B,YAAY,CAAC,GAAG,CAAC,CAAC;;AAblE,wBAc6B"}

18
node_modules/@redis/search/dist/lib/commands/SUGDEL.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {
IS_READ_ONLY: true,
/**
* Deletes a string from a suggestion dictionary.
* @param parser - The command parser
* @param key - The suggestion dictionary key
* @param string - The suggestion string to delete
*/
parseCommand(parser, key, string) {
parser.push('FT.SUGDEL');
parser.pushKey(key);
parser.push(string);
},
transformReply: undefined
};
//# sourceMappingURL=SUGDEL.js.map

Some files were not shown because too many files have changed in this diff Show More