@redis/search 1.1.1 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -99,6 +99,7 @@ export interface AggregateOptions {
99
99
  STEPS?: Array<GroupByStep | SortStep | ApplyStep | LimitStep | FilterStep>;
100
100
  PARAMS?: Params;
101
101
  DIALECT?: number;
102
+ TIMEOUT?: number;
102
103
  }
103
104
  export declare const FIRST_KEY_INDEX = 1;
104
105
  export declare const IS_READ_ONLY = true;
@@ -92,6 +92,9 @@ function pushAggregatehOptions(args, options) {
92
92
  if (options?.DIALECT) {
93
93
  args.push('DIALECT', options.DIALECT.toString());
94
94
  }
95
+ if (options?.TIMEOUT !== undefined) {
96
+ args.push('TIMEOUT', options.TIMEOUT.toString());
97
+ }
95
98
  return args;
96
99
  }
97
100
  exports.pushAggregatehOptions = pushAggregatehOptions;
@@ -1,5 +1,8 @@
1
1
  import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands';
2
2
  export declare const FIRST_KEY_INDEX = 1;
3
3
  export declare const IS_READ_ONLY = true;
4
- export declare function transformArguments(index: RedisCommandArgument, cursor: number): RedisCommandArguments;
4
+ interface CursorReadOptions {
5
+ COUNT?: number;
6
+ }
7
+ export declare function transformArguments(index: RedisCommandArgument, cursor: number, options?: CursorReadOptions): RedisCommandArguments;
5
8
  export { transformReply } from './AGGREGATE_WITHCURSOR';
@@ -3,13 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformReply = exports.transformArguments = exports.IS_READ_ONLY = exports.FIRST_KEY_INDEX = void 0;
4
4
  exports.FIRST_KEY_INDEX = 1;
5
5
  exports.IS_READ_ONLY = true;
6
- function transformArguments(index, cursor) {
7
- return [
6
+ function transformArguments(index, cursor, options) {
7
+ const args = [
8
8
  'FT.CURSOR',
9
9
  'READ',
10
10
  index,
11
11
  cursor.toString()
12
12
  ];
13
+ if (options?.COUNT) {
14
+ args.push('COUNT', options.COUNT.toString());
15
+ }
16
+ return args;
13
17
  }
14
18
  exports.transformArguments = transformArguments;
15
19
  var AGGREGATE_WITHCURSOR_1 = require("./AGGREGATE_WITHCURSOR");
@@ -4,5 +4,5 @@ import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
4
4
  export declare const IS_READ_ONLY = true;
5
5
  export declare function transformArguments(index: string, query: string, options?: ProfileOptions & SearchOptions): RedisCommandArguments;
6
6
  type ProfileSearchRawReply = ProfileRawReply<SearchRawReply>;
7
- export declare function transformReply(reply: ProfileSearchRawReply): ProfileReply;
7
+ export declare function transformReply(reply: ProfileSearchRawReply, withoutDocuments: boolean): ProfileReply;
8
8
  export {};
@@ -5,7 +5,7 @@ const SEARCH_1 = require("./SEARCH");
5
5
  const _1 = require(".");
6
6
  exports.IS_READ_ONLY = true;
7
7
  function transformArguments(index, query, options) {
8
- const args = ['FT.PROFILE', index, 'SEARCH'];
8
+ let args = ['FT.PROFILE', index, 'SEARCH'];
9
9
  if (options?.LIMITED) {
10
10
  args.push('LIMITED');
11
11
  }
@@ -13,9 +13,9 @@ function transformArguments(index, query, options) {
13
13
  return (0, _1.pushSearchOptions)(args, options);
14
14
  }
15
15
  exports.transformArguments = transformArguments;
16
- function transformReply(reply) {
16
+ function transformReply(reply, withoutDocuments) {
17
17
  return {
18
- results: (0, SEARCH_1.transformReply)(reply[0]),
18
+ results: (0, SEARCH_1.transformReply)(reply[0], withoutDocuments),
19
19
  profile: (0, _1.transformProfile)(reply[1])
20
20
  };
21
21
  }
@@ -34,7 +34,8 @@ export interface SearchOptions {
34
34
  };
35
35
  PARAMS?: Params;
36
36
  DIALECT?: number;
37
+ TIMEOUT?: number;
37
38
  }
38
39
  export declare function transformArguments(index: string, query: string, options?: SearchOptions): RedisCommandArguments;
39
40
  export type SearchRawReply = Array<any>;
40
- export declare function transformReply(reply: SearchRawReply): SearchReply;
41
+ export declare function transformReply(reply: SearchRawReply, withoutDocuments: boolean): SearchReply;
@@ -8,13 +8,13 @@ function transformArguments(index, query, options) {
8
8
  return (0, _1.pushSearchOptions)(['FT.SEARCH', index, query], options);
9
9
  }
10
10
  exports.transformArguments = transformArguments;
11
- function transformReply(reply) {
11
+ function transformReply(reply, withoutDocuments) {
12
12
  const documents = [];
13
13
  let i = 1;
14
14
  while (i < reply.length) {
15
15
  documents.push({
16
16
  id: reply[i++],
17
- value: documentValue(reply[i++])
17
+ value: withoutDocuments ? Object.create(null) : documentValue(reply[i++])
18
18
  });
19
19
  }
20
20
  return {
@@ -25,8 +25,6 @@ function transformReply(reply) {
25
25
  exports.transformReply = transformReply;
26
26
  function documentValue(tuples) {
27
27
  const message = Object.create(null);
28
- if (tuples === undefined)
29
- return message;
30
28
  let i = 0;
31
29
  while (i < tuples.length) {
32
30
  const key = tuples[i++], value = tuples[i++];
@@ -359,6 +359,12 @@ function pushSearchOptions(args, options) {
359
359
  if (options?.DIALECT) {
360
360
  args.push('DIALECT', options.DIALECT.toString());
361
361
  }
362
+ if (options?.RETURN?.length === 0) {
363
+ args.preserve = true;
364
+ }
365
+ if (options?.TIMEOUT !== undefined) {
366
+ args.push('TIMEOUT', options.TIMEOUT.toString());
367
+ }
362
368
  return args;
363
369
  }
364
370
  exports.pushSearchOptions = pushSearchOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redis/search",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -18,12 +18,24 @@
18
18
  "devDependencies": {
19
19
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
20
20
  "@redis/test-utils": "*",
21
- "@types/node": "^18.11.18",
21
+ "@types/node": "^20.2.3",
22
22
  "nyc": "^15.1.0",
23
- "release-it": "^15.6.0",
23
+ "release-it": "^15.10.3",
24
24
  "source-map-support": "^0.5.21",
25
25
  "ts-node": "^10.9.1",
26
- "typedoc": "^0.23.24",
27
- "typescript": "^4.9.4"
28
- }
26
+ "typedoc": "^0.24.7",
27
+ "typescript": "^5.0.4"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git://github.com/redis/node-redis.git"
32
+ },
33
+ "bugs": {
34
+ "url": "https://github.com/redis/node-redis/issues"
35
+ },
36
+ "homepage": "https://github.com/redis/node-redis/tree/master/packages/search",
37
+ "keywords": [
38
+ "redis",
39
+ "RediSearch"
40
+ ]
29
41
  }