Skip to content

add jsdoc comments to command parsers #2984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/bloom/lib/commands/bloom/ADD.ts
Original file line number Diff line number Diff line change
@@ -4,6 +4,12 @@ import { transformBooleanReply } from '@redis/client/dist/lib/commands/generic-t

export default {
IS_READ_ONLY: false,
/**
* Adds an item to a Bloom Filter
* @param parser - The command parser
* @param key - The name of the Bloom filter
* @param item - The item to add to the filter
*/
parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) {
parser.push('BF.ADD');
parser.pushKey(key);
5 changes: 5 additions & 0 deletions packages/bloom/lib/commands/bloom/CARD.ts
Original file line number Diff line number Diff line change
@@ -3,6 +3,11 @@ import { RedisArgument, NumberReply, Command } from '@redis/client/dist/lib/RESP

export default {
IS_READ_ONLY: true,
/**
* Returns the cardinality (number of items) in a Bloom Filter
* @param parser - The command parser
* @param key - The name of the Bloom filter to query
*/
parseCommand(parser: CommandParser, key: RedisArgument) {
parser.push('BF.CARD');
parser.pushKey(key);
6 changes: 6 additions & 0 deletions packages/bloom/lib/commands/bloom/EXISTS.ts
Original file line number Diff line number Diff line change
@@ -4,6 +4,12 @@ import { transformBooleanReply } from '@redis/client/dist/lib/commands/generic-t

export default {
IS_READ_ONLY: true,
/**
* Checks if an item exists in a Bloom Filter
* @param parser - The command parser
* @param key - The name of the Bloom filter
* @param item - The item to check for existence
*/
parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) {
parser.push('BF.EXISTS');
parser.pushKey(key);
5 changes: 5 additions & 0 deletions packages/bloom/lib/commands/bloom/INFO.ts
Original file line number Diff line number Diff line change
@@ -12,6 +12,11 @@ export type BfInfoReplyMap = TuplesToMapReply<[

export default {
IS_READ_ONLY: true,
/**
* Returns information about a Bloom Filter, including capacity, size, number of filters, items inserted, and expansion rate
* @param parser - The command parser
* @param key - The name of the Bloom filter to get information about
*/
parseCommand(parser: CommandParser, key: RedisArgument) {
parser.push('BF.INFO');
parser.pushKey(key);
12 changes: 12 additions & 0 deletions packages/bloom/lib/commands/bloom/INSERT.ts
Original file line number Diff line number Diff line change
@@ -13,6 +13,18 @@ export interface BfInsertOptions {

export default {
IS_READ_ONLY: false,
/**
* Adds one or more items to a Bloom Filter, creating it if it does not exist
* @param parser - The command parser
* @param key - The name of the Bloom filter
* @param items - One or more items to add to the filter
* @param options - Optional parameters for filter creation
* @param options.CAPACITY - Desired capacity for a new filter
* @param options.ERROR - Desired error rate for a new filter
* @param options.EXPANSION - Expansion rate for a new filter
* @param options.NOCREATE - If true, prevents automatic filter creation
* @param options.NONSCALING - Prevents the filter from creating additional sub-filters
*/
parseCommand(
parser: CommandParser,
key: RedisArgument,
7 changes: 7 additions & 0 deletions packages/bloom/lib/commands/bloom/LOADCHUNK.ts
Original file line number Diff line number Diff line change
@@ -3,6 +3,13 @@ import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/li

export default {
IS_READ_ONLY: false,
/**
* Restores a Bloom Filter chunk previously saved using SCANDUMP
* @param parser - The command parser
* @param key - The name of the Bloom filter to restore
* @param iterator - Iterator value from the SCANDUMP command
* @param chunk - Data chunk from the SCANDUMP command
*/
parseCommand(parser: CommandParser, key: RedisArgument, iterator: number, chunk: RedisArgument) {
parser.push('BF.LOADCHUNK');
parser.pushKey(key);
6 changes: 6 additions & 0 deletions packages/bloom/lib/commands/bloom/MADD.ts
Original file line number Diff line number Diff line change
@@ -5,6 +5,12 @@ import { transformBooleanArrayReply } from '@redis/client/dist/lib/commands/gene

export default {
IS_READ_ONLY: false,
/**
* Adds multiple items to a Bloom Filter in a single call
* @param parser - The command parser
* @param key - The name of the Bloom filter
* @param items - One or more items to add to the filter
*/
parseCommand(parser: CommandParser, key: RedisArgument, items: RedisVariadicArgument) {
parser.push('BF.MADD');
parser.pushKey(key);
6 changes: 6 additions & 0 deletions packages/bloom/lib/commands/bloom/MEXISTS.ts
Original file line number Diff line number Diff line change
@@ -5,6 +5,12 @@ import { transformBooleanArrayReply } from '@redis/client/dist/lib/commands/gene

export default {
IS_READ_ONLY: true,
/**
* Checks if multiple items exist in a Bloom Filter in a single call
* @param parser - The command parser
* @param key - The name of the Bloom filter
* @param items - One or more items to check for existence
*/
parseCommand(parser: CommandParser, key: RedisArgument, items: RedisVariadicArgument) {
parser.push('BF.MEXISTS');
parser.pushKey(key);
10 changes: 10 additions & 0 deletions packages/bloom/lib/commands/bloom/RESERVE.ts
Original file line number Diff line number Diff line change
@@ -8,6 +8,16 @@ export interface BfReserveOptions {

export default {
IS_READ_ONLY: true,
/**
* Creates an empty Bloom Filter with a given desired error ratio and initial capacity
* @param parser - The command parser
* @param key - The name of the Bloom filter to create
* @param errorRate - The desired probability for false positives (between 0 and 1)
* @param capacity - The number of entries intended to be added to the filter
* @param options - Optional parameters to tune the filter
* @param options.EXPANSION - Expansion rate for the filter
* @param options.NONSCALING - Prevents the filter from creating additional sub-filters
*/
parseCommand(
parser: CommandParser,
key: RedisArgument,
6 changes: 6 additions & 0 deletions packages/bloom/lib/commands/bloom/SCANDUMP.ts
Original file line number Diff line number Diff line change
@@ -3,6 +3,12 @@ import { RedisArgument, TuplesReply, NumberReply, BlobStringReply, UnwrapReply,

export default {
IS_READ_ONLY: true,
/**
* Begins an incremental save of a Bloom Filter. This is useful for large filters that can't be saved at once
* @param parser - The command parser
* @param key - The name of the Bloom filter to save
* @param iterator - Iterator value; Start at 0, and use the iterator from the response for the next chunk
*/
parseCommand(parser: CommandParser, key: RedisArgument, iterator: number) {
parser.push('BF.SCANDUMP');
parser.pushKey(key);
6 changes: 6 additions & 0 deletions packages/bloom/lib/commands/count-min-sketch/INCRBY.ts
Original file line number Diff line number Diff line change
@@ -8,6 +8,12 @@ export interface BfIncrByItem {

export default {
IS_READ_ONLY: false,
/**
* Increases the count of one or more items in a Count-Min Sketch
* @param parser - The command parser
* @param key - The name of the sketch
* @param items - A single item or array of items to increment, each with an item and increment value
*/
parseCommand(
parser: CommandParser,
key: RedisArgument,
5 changes: 5 additions & 0 deletions packages/bloom/lib/commands/count-min-sketch/INFO.ts
Original file line number Diff line number Diff line change
@@ -16,6 +16,11 @@ export interface CmsInfoReply {

export default {
IS_READ_ONLY: true,
/**
* Returns width, depth, and total count of items in a Count-Min Sketch
* @param parser - The command parser
* @param key - The name of the sketch to get information about
*/
parseCommand(parser: CommandParser, key: RedisArgument) {
parser.push('CMS.INFO');
parser.pushKey(key);
7 changes: 7 additions & 0 deletions packages/bloom/lib/commands/count-min-sketch/INITBYDIM.ts
Original file line number Diff line number Diff line change
@@ -3,6 +3,13 @@ import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/li

export default {
IS_READ_ONLY: false,
/**
* Initialize a Count-Min Sketch using width and depth parameters
* @param parser - The command parser
* @param key - The name of the sketch
* @param width - Number of counters in each array (must be a multiple of 2)
* @param depth - Number of counter arrays (determines accuracy of estimates)
*/
parseCommand(parser: CommandParser, key: RedisArgument, width: number, depth: number) {
parser.push('CMS.INITBYDIM');
parser.pushKey(key);
7 changes: 7 additions & 0 deletions packages/bloom/lib/commands/count-min-sketch/INITBYPROB.ts
Original file line number Diff line number Diff line change
@@ -3,6 +3,13 @@ import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/li

export default {
IS_READ_ONLY: false,
/**
* Initialize a Count-Min Sketch using error rate and probability parameters
* @param parser - The command parser
* @param key - The name of the sketch
* @param error - Estimate error, as a decimal between 0 and 1
* @param probability - The desired probability for inflated count, as a decimal between 0 and 1
*/
parseCommand(parser: CommandParser, key: RedisArgument, error: number, probability: number) {
parser.push('CMS.INITBYPROB');
parser.pushKey(key);
6 changes: 6 additions & 0 deletions packages/bloom/lib/commands/count-min-sketch/MERGE.ts
Original file line number Diff line number Diff line change
@@ -10,6 +10,12 @@ export type BfMergeSketches = Array<RedisArgument> | Array<BfMergeSketch>;

export default {
IS_READ_ONLY: false,
/**
* Merges multiple Count-Min Sketches into a single sketch, with optional weights
* @param parser - The command parser
* @param destination - The name of the destination sketch
* @param source - Array of sketch names or array of sketches with weights
*/
parseCommand(
parser: CommandParser,
destination: RedisArgument,
6 changes: 6 additions & 0 deletions packages/bloom/lib/commands/count-min-sketch/QUERY.ts
Original file line number Diff line number Diff line change
@@ -4,6 +4,12 @@ import { RedisVariadicArgument } from '@redis/client/dist/lib/commands/generic-t

export default {
IS_READ_ONLY: true,
/**
* Returns the count for one or more items in a Count-Min Sketch
* @param parser - The command parser
* @param key - The name of the sketch
* @param items - One or more items to get counts for
*/
parseCommand(parser: CommandParser, key: RedisArgument, items: RedisVariadicArgument) {
parser.push('CMS.QUERY');
parser.pushKey(key);
6 changes: 6 additions & 0 deletions packages/bloom/lib/commands/cuckoo/ADD.ts
Original file line number Diff line number Diff line change
@@ -4,6 +4,12 @@ import { transformBooleanReply } from '@redis/client/dist/lib/commands/generic-t

export default {
IS_READ_ONLY: false,
/**
* Adds an item to a Cuckoo Filter, creating the filter if it does not exist
* @param parser - The command parser
* @param key - The name of the Cuckoo filter
* @param item - The item to add to the filter
*/
parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) {
parser.push('CF.ADD');
parser.pushKey(key);
6 changes: 6 additions & 0 deletions packages/bloom/lib/commands/cuckoo/ADDNX.ts
Original file line number Diff line number Diff line change
@@ -4,6 +4,12 @@ import { transformBooleanReply } from '@redis/client/dist/lib/commands/generic-t

export default {
IS_READ_ONLY: false,
/**
* Adds an item to a Cuckoo Filter only if it does not exist
* @param parser - The command parser
* @param key - The name of the Cuckoo filter
* @param item - The item to add to the filter if it doesn't exist
*/
parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) {
parser.push('CF.ADDNX');
parser.pushKey(key);
6 changes: 6 additions & 0 deletions packages/bloom/lib/commands/cuckoo/COUNT.ts
Original file line number Diff line number Diff line change
@@ -3,6 +3,12 @@ import { RedisArgument, NumberReply, Command } from '@redis/client/dist/lib/RESP

export default {
IS_READ_ONLY: true,
/**
* Returns the number of times an item appears in a Cuckoo Filter
* @param parser - The command parser
* @param key - The name of the Cuckoo filter
* @param item - The item to count occurrences of
*/
parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) {
parser.push('CF.COUNT');
parser.pushKey(key);
6 changes: 6 additions & 0 deletions packages/bloom/lib/commands/cuckoo/DEL.ts
Original file line number Diff line number Diff line change
@@ -4,6 +4,12 @@ import { transformBooleanReply } from '@redis/client/dist/lib/commands/generic-t

export default {
IS_READ_ONLY: false,
/**
* Removes an item from a Cuckoo Filter if it exists
* @param parser - The command parser
* @param key - The name of the Cuckoo filter
* @param item - The item to remove from the filter
*/
parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) {
parser.push('CF.DEL');
parser.pushKey(key);
6 changes: 6 additions & 0 deletions packages/bloom/lib/commands/cuckoo/EXISTS.ts
Original file line number Diff line number Diff line change
@@ -4,6 +4,12 @@ import { transformBooleanReply } from '@redis/client/dist/lib/commands/generic-t

export default {
IS_READ_ONLY: false,
/**
* Checks if an item exists in a Cuckoo Filter
* @param parser - The command parser
* @param key - The name of the Cuckoo filter
* @param item - The item to check for existence
*/
parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) {
parser.push('CF.EXISTS');
parser.pushKey(key);
5 changes: 5 additions & 0 deletions packages/bloom/lib/commands/cuckoo/INFO.ts
Original file line number Diff line number Diff line change
@@ -15,6 +15,11 @@ export type CfInfoReplyMap = TuplesToMapReply<[

export default {
IS_READ_ONLY: true,
/**
* Returns detailed information about a Cuckoo Filter including size, buckets, filters count, items statistics and configuration
* @param parser - The command parser
* @param key - The name of the Cuckoo filter to get information about
*/
parseCommand(parser: CommandParser, key: RedisArgument) {
parser.push('CF.INFO');
parser.pushKey(key);
9 changes: 9 additions & 0 deletions packages/bloom/lib/commands/cuckoo/INSERT.ts
Original file line number Diff line number Diff line change
@@ -29,6 +29,15 @@ export function parseCfInsertArguments(

export default {
IS_READ_ONLY: false,
/**
* Adds one or more items to a Cuckoo Filter, creating it if it does not exist
* @param parser - The command parser
* @param key - The name of the Cuckoo filter
* @param items - One or more items to add to the filter
* @param options - Optional parameters for filter creation
* @param options.CAPACITY - The number of entries intended to be added to the filter
* @param options.NOCREATE - If true, prevents automatic filter creation
*/
parseCommand(...args: Parameters<typeof parseCfInsertArguments>) {
args[0].push('CF.INSERT');
parseCfInsertArguments(...args);
9 changes: 9 additions & 0 deletions packages/bloom/lib/commands/cuckoo/INSERTNX.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import { Command } from '@redis/client/dist/lib/RESP/types';
import INSERT, { parseCfInsertArguments } from './INSERT';

/**
* Adds one or more items to a Cuckoo Filter only if they do not exist yet, creating the filter if needed
* @param parser - The command parser
* @param key - The name of the Cuckoo filter
* @param items - One or more items to add to the filter
* @param options - Optional parameters for filter creation
* @param options.CAPACITY - The number of entries intended to be added to the filter
* @param options.NOCREATE - If true, prevents automatic filter creation
*/
export default {
IS_READ_ONLY: INSERT.IS_READ_ONLY,
parseCommand(...args: Parameters<typeof parseCfInsertArguments>) {
7 changes: 7 additions & 0 deletions packages/bloom/lib/commands/cuckoo/LOADCHUNK.ts
Original file line number Diff line number Diff line change
@@ -3,6 +3,13 @@ import { SimpleStringReply, Command, RedisArgument } from '@redis/client/dist/li

export default {
IS_READ_ONLY: false,
/**
* Restores a Cuckoo Filter chunk previously saved using SCANDUMP
* @param parser - The command parser
* @param key - The name of the Cuckoo filter to restore
* @param iterator - Iterator value from the SCANDUMP command
* @param chunk - Data chunk from the SCANDUMP command
*/
parseCommand(parser: CommandParser, key: RedisArgument, iterator: number, chunk: RedisArgument) {
parser.push('CF.LOADCHUNK');
parser.pushKey(key);
10 changes: 10 additions & 0 deletions packages/bloom/lib/commands/cuckoo/RESERVE.ts
Original file line number Diff line number Diff line change
@@ -9,6 +9,16 @@ export interface CfReserveOptions {

export default {
IS_READ_ONLY: false,
/**
* Creates an empty Cuckoo Filter with specified capacity and parameters
* @param parser - The command parser
* @param key - The name of the Cuckoo filter to create
* @param capacity - The number of entries intended to be added to the filter
* @param options - Optional parameters to tune the filter
* @param options.BUCKETSIZE - Number of items in each bucket
* @param options.MAXITERATIONS - Maximum number of iterations before declaring filter full
* @param options.EXPANSION - Number of additional buckets per expansion
*/
parseCommand(
parser: CommandParser,
key: RedisArgument,
6 changes: 6 additions & 0 deletions packages/bloom/lib/commands/cuckoo/SCANDUMP.ts
Original file line number Diff line number Diff line change
@@ -3,6 +3,12 @@ import { RedisArgument, TuplesReply, NumberReply, BlobStringReply, NullReply, Un

export default {
IS_READ_ONLY: true,
/**
* Begins an incremental save of a Cuckoo Filter. This is useful for large filters that can't be saved at once
* @param parser - The command parser
* @param key - The name of the Cuckoo filter to save
* @param iterator - Iterator value; Start at 0, and use the iterator from the response for the next chunk
*/
parseCommand(parser: CommandParser, key: RedisArgument, iterator: number) {
parser.push('CF.SCANDUMP');
parser.pushKey(key);
6 changes: 6 additions & 0 deletions packages/bloom/lib/commands/t-digest/ADD.ts
Original file line number Diff line number Diff line change
@@ -3,6 +3,12 @@ import { SimpleStringReply, Command, RedisArgument } from '@redis/client/dist/li

export default {
IS_READ_ONLY: false,
/**
* Adds one or more observations to a t-digest sketch
* @param parser - The command parser
* @param key - The name of the t-digest sketch
* @param values - Array of numeric values to add to the sketch
*/
parseCommand(parser: CommandParser, key: RedisArgument, values: Array<number>) {
parser.push('TDIGEST.ADD');
parser.pushKey(key);
6 changes: 6 additions & 0 deletions packages/bloom/lib/commands/t-digest/BYRANK.ts
Original file line number Diff line number Diff line change
@@ -16,6 +16,12 @@ export function transformByRankArguments(

export default {
IS_READ_ONLY: true,
/**
* Returns value estimates for one or more ranks in a t-digest sketch
* @param parser - The command parser
* @param key - The name of the t-digest sketch
* @param ranks - Array of ranks to get value estimates for (ascending order)
*/
parseCommand(...args: Parameters<typeof transformByRankArguments>) {
args[0].push('TDIGEST.BYRANK');
transformByRankArguments(...args);
Loading