From 20f8868b57cdbf2eacd8af0c752c968828c875f6 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Thu, 22 Aug 2024 09:47:55 -0700 Subject: [PATCH] Node: add missing `async`s and exports (#2184) Fixes. Signed-off-by: Yury-Fridlyand --- node/npm/glide/index.ts | 16 ++++++++++++++-- node/src/BaseClient.ts | 14 +++++++------- node/src/Commands.ts | 21 +++++++++++++++++---- 3 files changed, 38 insertions(+), 13 deletions(-) diff --git a/node/npm/glide/index.ts b/node/npm/glide/index.ts index 733de07d6a..58882c3ffd 100644 --- a/node/npm/glide/index.ts +++ b/node/npm/glide/index.ts @@ -75,6 +75,7 @@ function loadNativeBinding() { function initialize() { const nativeBinding = loadNativeBinding(); const { + AggregationType, BaseScanOptions, BitEncoding, BitFieldGet, @@ -98,6 +99,7 @@ function initialize() { GeoCircleShape, GeoSearchShape, GeoSearchResultOptions, + GeoSearchStoreResultOptions, SortOrder, GeoUnit, GeospatialData, @@ -120,6 +122,8 @@ function initialize() { PeriodicChecksManualInterval, PeriodicChecks, Logger, + Limit, + LolwutOptions, LPosOptions, ListDirection, ExpireOptions, @@ -127,8 +131,9 @@ function initialize() { InfoOptions, InsertPosition, SetOptions, - ZaddOptions, + ZAddOptions, InfBoundary, + KeyWeight, Boundary, UpdateOptions, ProtocolVersion, @@ -164,6 +169,7 @@ function initialize() { ScoreFilter, SignedEncoding, UnsignedEncoding, + UpdateByScore, createLeakedArray, createLeakedAttribute, createLeakedBigint, @@ -174,6 +180,7 @@ function initialize() { } = nativeBinding; module.exports = { + AggregationType, BaseScanOptions, BitEncoding, BitFieldGet, @@ -198,6 +205,7 @@ function initialize() { GeoCircleShape, GeoSearchShape, GeoSearchResultOptions, + GeoSearchStoreResultOptions, SortOrder, GeoUnit, GeospatialData, @@ -221,6 +229,8 @@ function initialize() { PeriodicChecksManualInterval, PeriodicChecks, Logger, + LolwutOptions, + Limit, LPosOptions, ListDirection, ExpireOptions, @@ -228,8 +238,9 @@ function initialize() { InfoOptions, InsertPosition, SetOptions, - ZaddOptions, + ZAddOptions, InfBoundary, + KeyWeight, Boundary, UpdateOptions, ProtocolVersion, @@ -263,6 +274,7 @@ function initialize() { ScoreFilter, SignedEncoding, UnsignedEncoding, + UpdateByScore, createLeakedArray, createLeakedAttribute, createLeakedBigint, diff --git a/node/src/BaseClient.ts b/node/src/BaseClient.ts index d6b409694c..9ece045d89 100644 --- a/node/src/BaseClient.ts +++ b/node/src/BaseClient.ts @@ -180,6 +180,7 @@ import { createXGroupCreateConsumer, createXGroupDelConsumer, createXGroupDestroy, + createXGroupSetid, createXInfoConsumers, createXInfoGroups, createXInfoStream, @@ -220,7 +221,6 @@ import { createZScore, createZUnion, createZUnionStore, - createXGroupSetid, } from "./Commands"; import { ClosingError, @@ -1650,7 +1650,7 @@ export class BaseClient { * console.log(result); // Output: ["field1", "field2", "field3"] - Returns all the field names stored in the hash "my_hash". * ``` */ - public hkeys(key: string): Promise { + public async hkeys(key: string): Promise { return this.createWritePromise(createHKeys(key)); } @@ -3913,7 +3913,7 @@ export class BaseClient { * console.log(result); // Output: ['member1'] * ``` */ - public zinter(keys: string[]): Promise { + public async zinter(keys: string[]): Promise { return this.createWritePromise(createZInter(keys)); } @@ -3945,7 +3945,7 @@ export class BaseClient { * console.log(result2); // Output: {'member1': 10.5} - "member1" with score of 10.5 is the result. * ``` */ - public zinterWithScores( + public async zinterWithScores( keys: string[] | KeyWeight[], aggregationType?: AggregationType, ): Promise> { @@ -3977,7 +3977,7 @@ export class BaseClient { * console.log(result); // Output: ['member1', 'member2'] * ``` */ - public zunion(keys: string[]): Promise { + public async zunion(keys: string[]): Promise { return this.createWritePromise(createZUnion(keys)); } @@ -4008,7 +4008,7 @@ export class BaseClient { * console.log(result2); // {'member1': 10.5, 'member2': 8.2} * ``` */ - public zunionWithScores( + public async zunionWithScores( keys: string[] | KeyWeight[], aggregationType?: AggregationType, ): Promise> { @@ -4668,7 +4668,7 @@ export class BaseClient { * // } * ``` */ - public xreadgroup( + public async xreadgroup( group: string, consumer: string, keys_and_ids: Record, diff --git a/node/src/Commands.ts b/node/src/Commands.ts index 97056f5e6c..e9aa5bb65d 100644 --- a/node/src/Commands.ts +++ b/node/src/Commands.ts @@ -1986,6 +1986,7 @@ export function createZLexCount( return createCommand(RequestType.ZLexCount, args); } +/** @internal */ export function createZRank( key: string, member: string, @@ -3356,13 +3357,25 @@ function convertGeoSearchOptionsToArgs( } if (resultOptions) { - if ("withCoord" in resultOptions && resultOptions.withCoord) + if ( + "withCoord" in resultOptions && + (resultOptions as GeoSearchResultOptions).withCoord + ) args.push("WITHCOORD"); - if ("withDist" in resultOptions && resultOptions.withDist) + if ( + "withDist" in resultOptions && + (resultOptions as GeoSearchResultOptions).withDist + ) args.push("WITHDIST"); - if ("withHash" in resultOptions && resultOptions.withHash) + if ( + "withHash" in resultOptions && + (resultOptions as GeoSearchResultOptions).withHash + ) args.push("WITHHASH"); - if ("storeDist" in resultOptions && resultOptions.storeDist) + if ( + "storeDist" in resultOptions && + (resultOptions as GeoSearchStoreResultOptions).storeDist + ) args.push("STOREDIST"); if (resultOptions.count) {