You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
Merge branch 'master' of github.com:redis/node-redis
This commit is contained in:
72
benchmark/package-lock.json
generated
72
benchmark/package-lock.json
generated
@@ -8,14 +8,14 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@redis/client": "../packages/client",
|
"@redis/client": "../packages/client",
|
||||||
"hdr-histogram-js": "3.0.0",
|
"hdr-histogram-js": "3.0.0",
|
||||||
"ioredis": "5.0.4",
|
"ioredis": "5.1.0",
|
||||||
"redis-v3": "npm:redis@3.1.2",
|
"redis-v3": "npm:redis@3.1.2",
|
||||||
"yargs": "17.4.1"
|
"yargs": "17.5.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"../packages/client": {
|
"../packages/client": {
|
||||||
"name": "@redis/client",
|
"name": "@redis/client",
|
||||||
"version": "1.0.5",
|
"version": "1.1.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cluster-key-slot": "1.1.0",
|
"cluster-key-slot": "1.1.0",
|
||||||
@@ -25,22 +25,22 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@redis/test-utils": "*",
|
"@redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.29",
|
"@types/node": "^18.0.0",
|
||||||
"@types/sinon": "^10.0.11",
|
"@types/sinon": "^10.0.12",
|
||||||
"@types/yallist": "^4.0.1",
|
"@types/yallist": "^4.0.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.21.0",
|
"@typescript-eslint/eslint-plugin": "^5.30.0",
|
||||||
"@typescript-eslint/parser": "^5.21.0",
|
"@typescript-eslint/parser": "^5.30.0",
|
||||||
"eslint": "^8.14.0",
|
"eslint": "^8.18.0",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"release-it": "^14.14.2",
|
"release-it": "^15.1.1",
|
||||||
"sinon": "^13.0.2",
|
"sinon": "^14.0.0",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
"ts-node": "^10.7.0",
|
"ts-node": "^10.8.1",
|
||||||
"typedoc": "^0.22.15",
|
"typedoc": "^0.23.2",
|
||||||
"typescript": "^4.6.3"
|
"typescript": "^4.7.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@assemblyscript/loader": {
|
"node_modules/@assemblyscript/loader": {
|
||||||
@@ -191,9 +191,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/ioredis": {
|
"node_modules/ioredis": {
|
||||||
"version": "5.0.4",
|
"version": "5.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/ioredis/-/ioredis-5.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/ioredis/-/ioredis-5.1.0.tgz",
|
||||||
"integrity": "sha512-qFJw3MnPNsJF1lcIOP3vztbsasOXK3nDdNAgjQj7t7/Bn/w10PGchTOpqylQNxjzPbLoYDu34LjeJtSWiKBntQ==",
|
"integrity": "sha512-HYHnvwxFwefeUBj0hZFejLvd8Q/YNAfnZlZG/hSRxkRhXMs1H8soMEVccHd1WlLrKkynorXBsAtqDGskOdAfVQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ioredis/commands": "^1.1.1",
|
"@ioredis/commands": "^1.1.1",
|
||||||
"cluster-key-slot": "^1.1.0",
|
"cluster-key-slot": "^1.1.0",
|
||||||
@@ -354,9 +354,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/yargs": {
|
"node_modules/yargs": {
|
||||||
"version": "17.4.1",
|
"version": "17.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.5.1.tgz",
|
||||||
"integrity": "sha512-WSZD9jgobAg3ZKuCQZSa3g9QOJeCCqLoLAykiWgmXnDo9EPnn4RPf5qVTtzgOx66o6/oqhcA5tHtJXpG8pMt3g==",
|
"integrity": "sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cliui": "^7.0.2",
|
"cliui": "^7.0.2",
|
||||||
"escalade": "^3.1.1",
|
"escalade": "^3.1.1",
|
||||||
@@ -395,21 +395,21 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@redis/test-utils": "*",
|
"@redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.29",
|
"@types/node": "^18.0.0",
|
||||||
"@types/sinon": "^10.0.11",
|
"@types/sinon": "^10.0.12",
|
||||||
"@types/yallist": "^4.0.1",
|
"@types/yallist": "^4.0.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.21.0",
|
"@typescript-eslint/eslint-plugin": "^5.30.0",
|
||||||
"@typescript-eslint/parser": "^5.21.0",
|
"@typescript-eslint/parser": "^5.30.0",
|
||||||
"cluster-key-slot": "1.1.0",
|
"cluster-key-slot": "1.1.0",
|
||||||
"eslint": "^8.14.0",
|
"eslint": "^8.18.0",
|
||||||
"generic-pool": "3.8.2",
|
"generic-pool": "3.8.2",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"release-it": "^14.14.2",
|
"release-it": "^15.1.1",
|
||||||
"sinon": "^13.0.2",
|
"sinon": "^14.0.0",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
"ts-node": "^10.7.0",
|
"ts-node": "^10.8.1",
|
||||||
"typedoc": "^0.22.15",
|
"typedoc": "^0.23.2",
|
||||||
"typescript": "^4.6.3",
|
"typescript": "^4.7.4",
|
||||||
"yallist": "4.0.0"
|
"yallist": "4.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -498,9 +498,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ioredis": {
|
"ioredis": {
|
||||||
"version": "5.0.4",
|
"version": "5.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/ioredis/-/ioredis-5.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/ioredis/-/ioredis-5.1.0.tgz",
|
||||||
"integrity": "sha512-qFJw3MnPNsJF1lcIOP3vztbsasOXK3nDdNAgjQj7t7/Bn/w10PGchTOpqylQNxjzPbLoYDu34LjeJtSWiKBntQ==",
|
"integrity": "sha512-HYHnvwxFwefeUBj0hZFejLvd8Q/YNAfnZlZG/hSRxkRhXMs1H8soMEVccHd1WlLrKkynorXBsAtqDGskOdAfVQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@ioredis/commands": "^1.1.1",
|
"@ioredis/commands": "^1.1.1",
|
||||||
"cluster-key-slot": "^1.1.0",
|
"cluster-key-slot": "^1.1.0",
|
||||||
@@ -618,9 +618,9 @@
|
|||||||
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA=="
|
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA=="
|
||||||
},
|
},
|
||||||
"yargs": {
|
"yargs": {
|
||||||
"version": "17.4.1",
|
"version": "17.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.5.1.tgz",
|
||||||
"integrity": "sha512-WSZD9jgobAg3ZKuCQZSa3g9QOJeCCqLoLAykiWgmXnDo9EPnn4RPf5qVTtzgOx66o6/oqhcA5tHtJXpG8pMt3g==",
|
"integrity": "sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"cliui": "^7.0.2",
|
"cliui": "^7.0.2",
|
||||||
"escalade": "^3.1.1",
|
"escalade": "^3.1.1",
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@redis/client": "../packages/client",
|
"@redis/client": "../packages/client",
|
||||||
"hdr-histogram-js": "3.0.0",
|
"hdr-histogram-js": "3.0.0",
|
||||||
"ioredis": "5.0.4",
|
"ioredis": "5.1.0",
|
||||||
"redis-v3": "npm:redis@3.1.2",
|
"redis-v3": "npm:redis@3.1.2",
|
||||||
"yargs": "17.4.1"
|
"yargs": "17.5.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -15,7 +15,7 @@ async function countMinSketch() {
|
|||||||
// https://oss.redis.com/redisbloom/CountMinSketch_Commands/#cmsinitbyprob
|
// https://oss.redis.com/redisbloom/CountMinSketch_Commands/#cmsinitbyprob
|
||||||
try {
|
try {
|
||||||
await client.cms.initByProb('mycms', 0.001, 0.01);
|
await client.cms.initByProb('mycms', 0.001, 0.01);
|
||||||
console.log('Reserved Top K.');
|
console.log('Initialized Count-Min Sketch.');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error, maybe RedisBloom is not installed?:');
|
console.log('Error, maybe RedisBloom is not installed?:');
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
@@ -40,29 +40,38 @@ async function searchHashes() {
|
|||||||
client.hSet('noderedis:animals:4', {name: 'Fido', species: 'dog', age: 7})
|
client.hSet('noderedis:animals:4', {name: 'Fido', species: 'dog', age: 7})
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Perform a search query, find all the dogs...
|
// Perform a search query, find all the dogs... sort by age, descending.
|
||||||
// Documentation: https://oss.redis.com/redisearch/Commands/#ftsearch
|
// Documentation: https://oss.redis.com/redisearch/Commands/#ftsearch
|
||||||
// Query synatax: https://oss.redis.com/redisearch/Query_Syntax/
|
// Query syntax: https://oss.redis.com/redisearch/Query_Syntax/
|
||||||
const results = await client.ft.search('idx:animals', '@species:{dog}');
|
const results = await client.ft.search(
|
||||||
|
'idx:animals',
|
||||||
|
'@species:{dog}',
|
||||||
|
{
|
||||||
|
SORTBY: {
|
||||||
|
BY: 'age',
|
||||||
|
DIRECTION: 'DESC' // or 'ASC' (default if DIRECTION is not present)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// results:
|
// results:
|
||||||
// {
|
// {
|
||||||
// total: 2,
|
// total: 2,
|
||||||
// documents: [
|
// documents: [
|
||||||
// {
|
|
||||||
// id: 'noderedis:animals:4',
|
|
||||||
// value: {
|
|
||||||
// name: 'Fido',
|
|
||||||
// species: 'dog',
|
|
||||||
// age: '7'
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// {
|
// {
|
||||||
// id: 'noderedis:animals:3',
|
// id: 'noderedis:animals:3',
|
||||||
// value: {
|
// value: {
|
||||||
|
// age: '9',
|
||||||
// name: 'Rover',
|
// name: 'Rover',
|
||||||
// species: 'dog',
|
// species: 'dog'
|
||||||
// age: '9'
|
// }
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 'noderedis:animals:4',
|
||||||
|
// value: {
|
||||||
|
// age: '7',
|
||||||
|
// name: 'Fido',
|
||||||
|
// species: 'dog'
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// ]
|
// ]
|
||||||
@@ -71,12 +80,12 @@ async function searchHashes() {
|
|||||||
console.log(`Results found: ${results.total}.`);
|
console.log(`Results found: ${results.total}.`);
|
||||||
|
|
||||||
for (const doc of results.documents) {
|
for (const doc of results.documents) {
|
||||||
// noderedis:animals:4: Fido
|
// noderedis:animals:3: Rover, 9 years old.
|
||||||
// noderedis:animals:3: Rover
|
// noderedis:animals:4: Fido, 7 years old.
|
||||||
console.log(`${doc.id}: ${doc.value.name}`);
|
console.log(`${doc.id}: ${doc.value.name}, ${doc.value.age} years old.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
await client.quit();
|
await client.quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
searchHashes();
|
searchHashes();
|
||||||
|
2591
package-lock.json
generated
2591
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -18,12 +18,12 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@redis/test-utils": "*",
|
"@redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.31",
|
"@types/node": "^18.0.0",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"release-it": "^15.0.0",
|
"release-it": "^15.1.1",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
"ts-node": "^10.7.0",
|
"ts-node": "^10.8.1",
|
||||||
"typedoc": "^0.22.15",
|
"typedoc": "^0.23.2",
|
||||||
"typescript": "^4.6.4"
|
"typescript": "^4.7.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -468,6 +468,20 @@ describe('Client', () => {
|
|||||||
['PONG']
|
['PONG']
|
||||||
);
|
);
|
||||||
}, GLOBAL.SERVERS.OPEN);
|
}, GLOBAL.SERVERS.OPEN);
|
||||||
|
|
||||||
|
testUtils.testWithClient('should remember selected db', async client => {
|
||||||
|
await client.multi()
|
||||||
|
.select(1)
|
||||||
|
.exec();
|
||||||
|
await killClient(client);
|
||||||
|
assert.equal(
|
||||||
|
(await client.clientInfo()).db,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
}, {
|
||||||
|
...GLOBAL.SERVERS.OPEN,
|
||||||
|
minimumDockerVersion: [6, 2] // CLIENT INFO
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
testUtils.testWithClient('scripts', async client => {
|
testUtils.testWithClient('scripts', async client => {
|
||||||
|
@@ -606,18 +606,26 @@ export default class RedisClient<
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
multiExecutor(commands: Array<RedisMultiQueuedCommand>, chainId?: symbol): Promise<Array<RedisCommandRawReply>> {
|
async multiExecutor(
|
||||||
|
commands: Array<RedisMultiQueuedCommand>,
|
||||||
|
selectedDB?: number,
|
||||||
|
chainId?: symbol
|
||||||
|
): Promise<Array<RedisCommandRawReply>> {
|
||||||
const promise = Promise.all(
|
const promise = Promise.all(
|
||||||
commands.map(({ args }) => {
|
commands.map(({ args }) => {
|
||||||
return this.#queue.addCommand(args, RedisClient.commandOptions({
|
return this.#queue.addCommand(args, { chainId });
|
||||||
chainId
|
|
||||||
}));
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
this.#tick();
|
this.#tick();
|
||||||
|
|
||||||
return promise;
|
const results = await promise;
|
||||||
|
|
||||||
|
if (selectedDB !== undefined) {
|
||||||
|
this.#selectedDB = selectedDB;
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
async* scanIterator(options?: ScanCommandOptions): AsyncIterable<string> {
|
async* scanIterator(options?: ScanCommandOptions): AsyncIterable<string> {
|
||||||
|
@@ -58,13 +58,13 @@ type InstantiableRedisMultiCommand<
|
|||||||
S extends RedisScripts
|
S extends RedisScripts
|
||||||
> = new (...args: ConstructorParameters<typeof RedisClientMultiCommand>) => RedisClientMultiCommandType<M, F, S>;
|
> = new (...args: ConstructorParameters<typeof RedisClientMultiCommand>) => RedisClientMultiCommandType<M, F, S>;
|
||||||
|
|
||||||
|
export type RedisClientMultiExecutor = (
|
||||||
export type RedisClientMultiExecutor = (queue: Array<RedisMultiQueuedCommand>, chainId?: symbol) => Promise<Array<RedisCommandRawReply>>;
|
queue: Array<RedisMultiQueuedCommand>,
|
||||||
|
selectedDB?: number,
|
||||||
|
chainId?: symbol
|
||||||
|
) => Promise<Array<RedisCommandRawReply>>;
|
||||||
|
|
||||||
export default class RedisClientMultiCommand {
|
export default class RedisClientMultiCommand {
|
||||||
readonly #multi = new RedisMultiCommand();
|
|
||||||
readonly #executor: RedisClientMultiExecutor;
|
|
||||||
|
|
||||||
static extend<
|
static extend<
|
||||||
M extends RedisModules,
|
M extends RedisModules,
|
||||||
F extends RedisFunctions,
|
F extends RedisFunctions,
|
||||||
@@ -81,7 +81,10 @@ export default class RedisClientMultiCommand {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readonly #multi = new RedisMultiCommand();
|
||||||
|
readonly #executor: RedisClientMultiExecutor;
|
||||||
readonly v4: Record<string, any> = {};
|
readonly v4: Record<string, any> = {};
|
||||||
|
#selectedDB?: number;
|
||||||
|
|
||||||
constructor(executor: RedisClientMultiExecutor, legacyMode = false) {
|
constructor(executor: RedisClientMultiExecutor, legacyMode = false) {
|
||||||
this.#executor = executor;
|
this.#executor = executor;
|
||||||
@@ -136,6 +139,13 @@ export default class RedisClientMultiCommand {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SELECT(db: number, transformReply?: RedisCommand['transformReply']): this {
|
||||||
|
this.#selectedDB = db;
|
||||||
|
return this.addCommand(['SELECT', db.toString()], transformReply);
|
||||||
|
}
|
||||||
|
|
||||||
|
select = this.SELECT;
|
||||||
|
|
||||||
addCommand(args: RedisCommandArguments, transformReply?: RedisCommand['transformReply']): this {
|
addCommand(args: RedisCommandArguments, transformReply?: RedisCommand['transformReply']): this {
|
||||||
this.#multi.addCommand(args, transformReply);
|
this.#multi.addCommand(args, transformReply);
|
||||||
return this;
|
return this;
|
||||||
@@ -160,7 +170,11 @@ export default class RedisClientMultiCommand {
|
|||||||
if (!commands) return [];
|
if (!commands) return [];
|
||||||
|
|
||||||
return this.#multi.handleExecReplies(
|
return this.#multi.handleExecReplies(
|
||||||
await this.#executor(commands, RedisMultiCommand.generateChainId())
|
await this.#executor(
|
||||||
|
commands,
|
||||||
|
this.#selectedDB,
|
||||||
|
RedisMultiCommand.generateChainId()
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +182,10 @@ export default class RedisClientMultiCommand {
|
|||||||
|
|
||||||
async execAsPipeline(): Promise<Array<RedisCommandRawReply>> {
|
async execAsPipeline(): Promise<Array<RedisCommandRawReply>> {
|
||||||
return this.#multi.transformReplies(
|
return this.#multi.transformReplies(
|
||||||
await this.#executor(this.#multi.queue)
|
await this.#executor(
|
||||||
|
this.#multi.queue,
|
||||||
|
this.#selectedDB
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -230,7 +230,7 @@ export default class RedisCluster<
|
|||||||
return this.#execute(
|
return this.#execute(
|
||||||
firstKey,
|
firstKey,
|
||||||
false,
|
false,
|
||||||
client => client.multiExecutor(commands, chainId)
|
client => client.multiExecutor(commands, undefined, chainId)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
routing
|
routing
|
||||||
|
@@ -41,11 +41,20 @@ describe('HSET', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Object', () => {
|
describe('Object', () => {
|
||||||
assert.deepEqual(
|
it('string', () => {
|
||||||
transformArguments('key', { field: 'value' }),
|
assert.deepEqual(
|
||||||
['HSET', 'key', 'field', 'value']
|
transformArguments('key', { field: 'value' }),
|
||||||
);
|
['HSET', 'key', 'field', 'value']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Buffer', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformArguments('key', { field: Buffer.from('value') }),
|
||||||
|
['HSET', 'key', 'field', Buffer.from('value')]
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -62,4 +71,4 @@ describe('HSET', () => {
|
|||||||
1
|
1
|
||||||
);
|
);
|
||||||
}, GLOBAL.CLUSTERS.OPEN);
|
}, GLOBAL.CLUSTERS.OPEN);
|
||||||
});
|
});
|
||||||
|
@@ -20,8 +20,10 @@ export function transformArguments(...[ key, value, fieldValue ]: SingleFieldArg
|
|||||||
const args: RedisCommandArguments = ['HSET', key];
|
const args: RedisCommandArguments = ['HSET', key];
|
||||||
|
|
||||||
if (typeof value === 'string' || typeof value === 'number' || Buffer.isBuffer(value)) {
|
if (typeof value === 'string' || typeof value === 'number' || Buffer.isBuffer(value)) {
|
||||||
pushValue(args, value);
|
args.push(
|
||||||
pushValue(args, fieldValue!);
|
convertValue(value),
|
||||||
|
convertValue(fieldValue!)
|
||||||
|
);
|
||||||
} else if (value instanceof Map) {
|
} else if (value instanceof Map) {
|
||||||
pushMap(args, value);
|
pushMap(args, value);
|
||||||
} else if (Array.isArray(value)) {
|
} else if (Array.isArray(value)) {
|
||||||
@@ -35,8 +37,10 @@ export function transformArguments(...[ key, value, fieldValue ]: SingleFieldArg
|
|||||||
|
|
||||||
function pushMap(args: RedisCommandArguments, map: HSETMap): void {
|
function pushMap(args: RedisCommandArguments, map: HSETMap): void {
|
||||||
for (const [key, value] of map.entries()) {
|
for (const [key, value] of map.entries()) {
|
||||||
pushValue(args, key);
|
args.push(
|
||||||
pushValue(args, value);
|
convertValue(key),
|
||||||
|
convertValue(value)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,22 +51,23 @@ function pushTuples(args: RedisCommandArguments, tuples: HSETTuples): void {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
pushValue(args, tuple);
|
args.push(convertValue(tuple));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pushObject(args: RedisCommandArguments, object: HSETObject): void {
|
function pushObject(args: RedisCommandArguments, object: HSETObject): void {
|
||||||
for (const key of Object.keys(object)) {
|
for (const key of Object.keys(object)) {
|
||||||
args.push(key.toString(), object[key].toString());
|
args.push(
|
||||||
|
convertValue(key),
|
||||||
|
convertValue(object[key])
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pushValue(args: RedisCommandArguments, value: Types): void {
|
function convertValue(value: Types): RedisCommandArgument {
|
||||||
args.push(
|
return typeof value === 'number' ?
|
||||||
typeof value === 'number' ?
|
value.toString() :
|
||||||
value.toString() :
|
value;
|
||||||
value
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export declare function transformReply(): number;
|
export declare function transformReply(): number;
|
||||||
|
@@ -3,7 +3,7 @@ import { SinonSpy } from 'sinon';
|
|||||||
import { promiseTimeout } from './utils';
|
import { promiseTimeout } from './utils';
|
||||||
|
|
||||||
export default new TestUtils({
|
export default new TestUtils({
|
||||||
defaultDockerVersion: '7.0-rc3',
|
defaultDockerVersion: '7.0.2',
|
||||||
dockerImageName: 'redis',
|
dockerImageName: 'redis',
|
||||||
dockerImageVersionArgument: 'redis-version'
|
dockerImageVersionArgument: 'redis-version'
|
||||||
});
|
});
|
||||||
|
@@ -21,19 +21,19 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@redis/test-utils": "*",
|
"@redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.31",
|
"@types/node": "^18.0.0",
|
||||||
"@types/sinon": "^10.0.11",
|
"@types/sinon": "^10.0.12",
|
||||||
"@types/yallist": "^4.0.1",
|
"@types/yallist": "^4.0.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.21.0",
|
"@typescript-eslint/eslint-plugin": "^5.30.0",
|
||||||
"@typescript-eslint/parser": "^5.21.0",
|
"@typescript-eslint/parser": "^5.30.0",
|
||||||
"eslint": "^8.14.0",
|
"eslint": "^8.18.0",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"release-it": "^15.0.0",
|
"release-it": "^15.1.1",
|
||||||
"sinon": "^13.0.2",
|
"sinon": "^14.0.0",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
"ts-node": "^10.7.0",
|
"ts-node": "^10.8.1",
|
||||||
"typedoc": "^0.22.15",
|
"typedoc": "^0.23.2",
|
||||||
"typescript": "^4.6.4"
|
"typescript": "^4.7.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14"
|
"node": ">=14"
|
||||||
|
@@ -4,7 +4,7 @@ import RedisGraph from '.';
|
|||||||
export default new TestUtils({
|
export default new TestUtils({
|
||||||
dockerImageName: 'redislabs/redisgraph',
|
dockerImageName: 'redislabs/redisgraph',
|
||||||
dockerImageVersionArgument: 'redisgraph-version',
|
dockerImageVersionArgument: 'redisgraph-version',
|
||||||
defaultDockerVersion: '2.8.9'
|
defaultDockerVersion: '2.8.15'
|
||||||
});
|
});
|
||||||
|
|
||||||
export const GLOBAL = {
|
export const GLOBAL = {
|
||||||
|
@@ -18,12 +18,12 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@redis/test-utils": "*",
|
"@redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.31",
|
"@types/node": "^18.0.0",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"release-it": "^15.0.0",
|
"release-it": "^15.1.1",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
"ts-node": "^10.7.0",
|
"ts-node": "^10.8.1",
|
||||||
"typedoc": "^0.22.15",
|
"typedoc": "^0.23.2",
|
||||||
"typescript": "^4.6.4"
|
"typescript": "^4.7.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@ import RedisJSON from '.';
|
|||||||
export default new TestUtils({
|
export default new TestUtils({
|
||||||
dockerImageName: 'redislabs/rejson',
|
dockerImageName: 'redislabs/rejson',
|
||||||
dockerImageVersionArgument: 'rejson-version',
|
dockerImageVersionArgument: 'rejson-version',
|
||||||
defaultDockerVersion: '2.0.7'
|
defaultDockerVersion: '2.0.9'
|
||||||
});
|
});
|
||||||
|
|
||||||
export const GLOBAL = {
|
export const GLOBAL = {
|
||||||
|
@@ -18,12 +18,12 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@redis/test-utils": "*",
|
"@redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.31",
|
"@types/node": "^18.0.0",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"release-it": "^15.0.0",
|
"release-it": "^15.1.1",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
"ts-node": "^10.7.0",
|
"ts-node": "^10.8.1",
|
||||||
"typedoc": "^0.22.15",
|
"typedoc": "^0.23.2",
|
||||||
"typescript": "^4.6.4"
|
"typescript": "^4.7.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@ import RediSearch from '.';
|
|||||||
export default new TestUtils({
|
export default new TestUtils({
|
||||||
dockerImageName: 'redislabs/redisearch',
|
dockerImageName: 'redislabs/redisearch',
|
||||||
dockerImageVersionArgument: 'redisearch-version',
|
dockerImageVersionArgument: 'redisearch-version',
|
||||||
defaultDockerVersion: '2.4.3'
|
defaultDockerVersion: '2.4.9'
|
||||||
});
|
});
|
||||||
|
|
||||||
export const GLOBAL = {
|
export const GLOBAL = {
|
||||||
|
@@ -18,12 +18,12 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@redis/test-utils": "*",
|
"@redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.31",
|
"@types/node": "^18.0.0",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"release-it": "^15.0.0",
|
"release-it": "^15.1.1",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
"ts-node": "^10.7.0",
|
"ts-node": "^10.8.1",
|
||||||
"typedoc": "^0.22.15",
|
"typedoc": "^0.23.2",
|
||||||
"typescript": "^4.6.4"
|
"typescript": "^4.7.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -55,7 +55,7 @@ async function spawnRedisServerDocker({ image, version }: RedisServerDockerConfi
|
|||||||
'docker run -d --network host $(' +
|
'docker run -d --network host $(' +
|
||||||
`docker build ${DOCKER_FODLER_PATH} -q ` +
|
`docker build ${DOCKER_FODLER_PATH} -q ` +
|
||||||
`--build-arg IMAGE=${image}:${version} ` +
|
`--build-arg IMAGE=${image}:${version} ` +
|
||||||
`--build-arg REDIS_ARGUMENTS="--save --port ${port.toString()} ${serverArguments.join(' ')}"` +
|
`--build-arg REDIS_ARGUMENTS="--save '' --port ${port.toString()} ${serverArguments.join(' ')}"` +
|
||||||
')'
|
')'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -12,13 +12,13 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@types/mocha": "^9.1.1",
|
"@types/mocha": "^9.1.1",
|
||||||
"@types/node": "^17.0.31",
|
"@types/node": "^18.0.0",
|
||||||
"@types/yargs": "^17.0.10",
|
"@types/yargs": "^17.0.10",
|
||||||
"mocha": "^10.0.0",
|
"mocha": "^10.0.0",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
"ts-node": "^10.7.0",
|
"ts-node": "^10.8.1",
|
||||||
"typescript": "^4.6.4",
|
"typescript": "^4.7.4",
|
||||||
"yargs": "^17.4.1"
|
"yargs": "^17.5.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@ import TimeSeries from '.';
|
|||||||
export default new TestUtils({
|
export default new TestUtils({
|
||||||
dockerImageName: 'redislabs/redistimeseries',
|
dockerImageName: 'redislabs/redistimeseries',
|
||||||
dockerImageVersionArgument: 'timeseries-version',
|
dockerImageVersionArgument: 'timeseries-version',
|
||||||
defaultDockerVersion: '1.6.9'
|
defaultDockerVersion: '1.6.16'
|
||||||
});
|
});
|
||||||
|
|
||||||
export const GLOBAL = {
|
export const GLOBAL = {
|
||||||
|
@@ -18,12 +18,12 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@redis/test-utils": "*",
|
"@redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.31",
|
"@types/node": "^18.0.0",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"release-it": "^15.0.0",
|
"release-it": "^15.1.1",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
"ts-node": "^10.7.0",
|
"ts-node": "^10.8.1",
|
||||||
"typedoc": "^0.22.15",
|
"typedoc": "^0.23.2",
|
||||||
"typescript": "^4.6.4"
|
"typescript": "^4.7.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user