You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
wip
This commit is contained in:
@@ -285,9 +285,10 @@ export default class RedisCommandsQueue {
|
||||
}
|
||||
|
||||
private _flushWaitingForReply(err: Error): void {
|
||||
while (this._waitingForReply.head) {
|
||||
this._waitingForReply.shift()!.reject(err);
|
||||
for (const node of this._waitingForReply) {
|
||||
node.reject(err);
|
||||
}
|
||||
this._waitingForReply.reset();
|
||||
}
|
||||
|
||||
private static _removeAbortListener(command: CommandWaitingToBeSent) {
|
||||
@@ -324,12 +325,10 @@ export default class RedisCommandsQueue {
|
||||
this.decoder.reset();
|
||||
this._pubSub.reset();
|
||||
this._flushWaitingForReply(err);
|
||||
while (this._waitingToBeSent.head) {
|
||||
RedisCommandsQueue._flushWaitingToBeSent(
|
||||
this._waitingToBeSent.shift()!,
|
||||
err
|
||||
);
|
||||
for (const node of this._waitingToBeSent) {
|
||||
RedisCommandsQueue._flushWaitingToBeSent(node, err);
|
||||
}
|
||||
this._waitingToBeSent.reset();
|
||||
}
|
||||
|
||||
isEmpty() {
|
||||
|
@@ -3,12 +3,14 @@ import testUtils, { GLOBAL, waitTillBeenCalled } from '../test-utils';
|
||||
import RedisClient, { RedisClientType } from '.';
|
||||
// import { RedisClientMultiCommandType } from './multi-command';
|
||||
// import { RedisCommandRawReply, RedisModules, RedisFunctions, RedisScripts } from '../commands';
|
||||
// import { AbortError, ClientClosedError, ClientOfflineError, ConnectionTimeoutError, DisconnectsClientError, SocketClosedUnexpectedlyError, WatchError } from '../errors';
|
||||
import { AbortError, ClientClosedError, ClientOfflineError, ConnectionTimeoutError, DisconnectsClientError, SocketClosedUnexpectedlyError, WatchError } from '../errors';
|
||||
import { defineScript } from '../lua-script';
|
||||
// import { spy } from 'sinon';
|
||||
// import { once } from 'events';
|
||||
import { once } from 'events';
|
||||
// import { ClientKillFilters } from '../commands/CLIENT_KILL';
|
||||
// import { promisify } from 'util';
|
||||
import { MATH_FUNCTION, loadMathFunction } from '../commands/FUNCTION_LOAD.spec';
|
||||
import { RESP_TYPES } from '../RESP/decoder';
|
||||
|
||||
export const SQUARE_SCRIPT = defineScript({
|
||||
SCRIPT: 'return ARGV[1] * ARGV[1];',
|
||||
@@ -113,470 +115,244 @@ describe('Client', () => {
|
||||
}
|
||||
});
|
||||
|
||||
// describe('legacyMode', () => {
|
||||
// testUtils.testWithClient('client.sendCommand should call the callback', async client => {
|
||||
// assert.equal(
|
||||
// await promisify(client.sendCommand).call(client, 'PING'),
|
||||
// 'PONG'
|
||||
// );
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// clientOptions: {
|
||||
// legacyMode: true
|
||||
// }
|
||||
// });
|
||||
testUtils.testWithClient('connect, ready and end events', async client => {
|
||||
await Promise.all([
|
||||
once(client, 'connect'),
|
||||
once(client, 'ready'),
|
||||
client.connect()
|
||||
]);
|
||||
|
||||
// testUtils.testWithClient('client.sendCommand should work without callback', async client => {
|
||||
// client.sendCommand(['PING']);
|
||||
// await client.v4.ping(); // make sure the first command was replied
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// clientOptions: {
|
||||
// legacyMode: true
|
||||
// }
|
||||
// });
|
||||
const promise = once(client, 'end');
|
||||
console.log('listen to end', client.listeners('end'));
|
||||
client.close();
|
||||
await promise;
|
||||
}, {
|
||||
...GLOBAL.SERVERS.OPEN,
|
||||
disableClientSetup: true
|
||||
});
|
||||
|
||||
// testUtils.testWithClient('client.sendCommand should reply with error', async client => {
|
||||
// await assert.rejects(
|
||||
// promisify(client.sendCommand).call(client, '1', '2')
|
||||
// );
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// clientOptions: {
|
||||
// legacyMode: true
|
||||
// }
|
||||
// });
|
||||
describe('sendCommand', () => {
|
||||
testUtils.testWithClient('PING', async client => {
|
||||
assert.equal(await client.sendCommand(['PING']), 'PONG');
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
|
||||
// testUtils.testWithClient('client.hGetAll should reply with error', async client => {
|
||||
// await assert.rejects(
|
||||
// promisify(client.hGetAll).call(client)
|
||||
// );
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// clientOptions: {
|
||||
// legacyMode: true
|
||||
// }
|
||||
// });
|
||||
describe('AbortController', () => {
|
||||
before(function () {
|
||||
if (!global.AbortController) {
|
||||
this.skip();
|
||||
}
|
||||
});
|
||||
|
||||
// testUtils.testWithClient('client.v4.sendCommand should return a promise', async client => {
|
||||
// assert.equal(
|
||||
// await client.v4.sendCommand(['PING']),
|
||||
// 'PONG'
|
||||
// );
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// clientOptions: {
|
||||
// legacyMode: true
|
||||
// }
|
||||
// });
|
||||
testUtils.testWithClient('success', async client => {
|
||||
await client.sendCommand(['PING'], {
|
||||
abortSignal: new AbortController().signal
|
||||
});
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
|
||||
// testUtils.testWithClient('client.v4.{command} should return a promise', async client => {
|
||||
// assert.equal(
|
||||
// await client.v4.ping(),
|
||||
// 'PONG'
|
||||
// );
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// clientOptions: {
|
||||
// legacyMode: true
|
||||
// }
|
||||
// });
|
||||
testUtils.testWithClient('AbortError', client => {
|
||||
const controller = new AbortController();
|
||||
controller.abort();
|
||||
|
||||
// testUtils.testWithClient('client.{command} should accept vardict arguments', async client => {
|
||||
// assert.equal(
|
||||
// await promisify(client.set).call(client, 'a', 'b'),
|
||||
// 'OK'
|
||||
// );
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// clientOptions: {
|
||||
// legacyMode: true
|
||||
// }
|
||||
// });
|
||||
return assert.rejects(
|
||||
client.sendCommand(['PING'], {
|
||||
abortSignal: controller.signal
|
||||
}),
|
||||
AbortError
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
||||
// testUtils.testWithClient('client.{command} should accept arguments array', async client => {
|
||||
// assert.equal(
|
||||
// await promisify(client.set).call(client, ['a', 'b']),
|
||||
// 'OK'
|
||||
// );
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// clientOptions: {
|
||||
// legacyMode: true
|
||||
// }
|
||||
// });
|
||||
testUtils.testWithClient('undefined and null should not break the client', async client => {
|
||||
await assert.rejects(
|
||||
client.sendCommand([null as any, undefined as any]),
|
||||
TypeError
|
||||
);
|
||||
|
||||
// testUtils.testWithClient('client.{command} should accept mix of arrays and arguments', async client => {
|
||||
// assert.equal(
|
||||
// await promisify(client.set).call(client, ['a'], 'b', ['EX', 1]),
|
||||
// 'OK'
|
||||
// );
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// clientOptions: {
|
||||
// legacyMode: true
|
||||
// }
|
||||
// });
|
||||
assert.equal(
|
||||
await client.ping(),
|
||||
'PONG'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
||||
// testUtils.testWithClient('client.hGetAll should return object', async client => {
|
||||
// await client.v4.hSet('key', 'field', 'value');
|
||||
describe('multi', () => {
|
||||
testUtils.testWithClient('simple', async client => {
|
||||
assert.deepEqual(
|
||||
await client.multi()
|
||||
.ping()
|
||||
.set('key', 'value')
|
||||
.get('key')
|
||||
.exec(),
|
||||
['PONG', 'OK', 'value']
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
|
||||
// assert.deepEqual(
|
||||
// await promisify(client.hGetAll).call(client, 'key'),
|
||||
// Object.create(null, {
|
||||
// field: {
|
||||
// value: 'value',
|
||||
// configurable: true,
|
||||
// enumerable: true
|
||||
// }
|
||||
// })
|
||||
// );
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// clientOptions: {
|
||||
// legacyMode: true
|
||||
// }
|
||||
// });
|
||||
testUtils.testWithClient('should reject the whole chain on error', client => {
|
||||
return assert.rejects(
|
||||
client.multi()
|
||||
.ping()
|
||||
.addCommand(['INVALID COMMAND'])
|
||||
.ping()
|
||||
.exec()
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
|
||||
// function multiExecAsync<
|
||||
// M extends RedisModules,
|
||||
// F extends RedisFunctions,
|
||||
// S extends RedisScripts
|
||||
// >(multi: RedisClientMultiCommandType<M, F, S>): Promise<Array<RedisCommandRawReply>> {
|
||||
// return new Promise((resolve, reject) => {
|
||||
// (multi as any).exec((err: Error | undefined, replies: Array<RedisCommandRawReply>) => {
|
||||
// if (err) return reject(err);
|
||||
testUtils.testWithClient('should reject the whole chain upon client disconnect', async client => {
|
||||
await client.close();
|
||||
|
||||
// resolve(replies);
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
return assert.rejects(
|
||||
client.multi()
|
||||
.ping()
|
||||
.set('key', 'value')
|
||||
.get('key')
|
||||
.exec(),
|
||||
ClientClosedError
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
|
||||
// testUtils.testWithClient('client.multi.ping.exec should call the callback', async client => {
|
||||
// assert.deepEqual(
|
||||
// await multiExecAsync(
|
||||
// client.multi().ping()
|
||||
// ),
|
||||
// ['PONG']
|
||||
// );
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// clientOptions: {
|
||||
// legacyMode: true
|
||||
// }
|
||||
// });
|
||||
testUtils.testWithClient('with script', async client => {
|
||||
assert.deepEqual(
|
||||
await client.multi()
|
||||
.square(2)
|
||||
.exec(),
|
||||
[4]
|
||||
);
|
||||
}, {
|
||||
...GLOBAL.SERVERS.OPEN,
|
||||
clientOptions: {
|
||||
scripts: {
|
||||
square: SQUARE_SCRIPT
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// testUtils.testWithClient('client.multi.ping.exec should call the callback', async client => {
|
||||
// client.multi()
|
||||
// .ping()
|
||||
// .exec();
|
||||
// await client.v4.ping(); // make sure the first command was replied
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// clientOptions: {
|
||||
// legacyMode: true
|
||||
// }
|
||||
// });
|
||||
// testUtils.testWithClient('WatchError', async client => {
|
||||
// await client.watch('key');
|
||||
|
||||
// testUtils.testWithClient('client.multi.ping.v4.ping.v4.exec should return a promise', async client => {
|
||||
// assert.deepEqual(
|
||||
// await client.multi()
|
||||
// .ping()
|
||||
// .v4.ping()
|
||||
// .v4.exec(),
|
||||
// ['PONG', 'PONG']
|
||||
// );
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// clientOptions: {
|
||||
// legacyMode: true
|
||||
// }
|
||||
// });
|
||||
// await client.set(
|
||||
// RedisClient.commandOptions({
|
||||
// isolated: true
|
||||
// }),
|
||||
// 'key',
|
||||
// '1'
|
||||
// );
|
||||
|
||||
// testUtils.testWithClient('client.{script} should return a promise', async client => {
|
||||
// assert.equal(
|
||||
// await client.square(2),
|
||||
// 4
|
||||
// );
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// clientOptions: {
|
||||
// legacyMode: true,
|
||||
// scripts: {
|
||||
// square: SQUARE_SCRIPT
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// await assert.rejects(
|
||||
// client.multi()
|
||||
// .decr('key')
|
||||
// .exec(),
|
||||
// WatchError
|
||||
// );
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
|
||||
// testUtils.testWithClient('client.multi.{command}.exec should flatten array arguments', async client => {
|
||||
// assert.deepEqual(
|
||||
// await client.multi()
|
||||
// .sAdd('a', ['b', 'c'])
|
||||
// .v4.exec(),
|
||||
// [2]
|
||||
// );
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// clientOptions: {
|
||||
// legacyMode: true
|
||||
// }
|
||||
// });
|
||||
describe('execAsPipeline', () => {
|
||||
testUtils.testWithClient('exec(true)', async client => {
|
||||
assert.deepEqual(
|
||||
await client.multi()
|
||||
.ping()
|
||||
.exec(true),
|
||||
['PONG']
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
|
||||
// testUtils.testWithClient('client.multi.hGetAll should return object', async client => {
|
||||
// assert.deepEqual(
|
||||
// await multiExecAsync(
|
||||
// client.multi()
|
||||
// .hSet('key', 'field', 'value')
|
||||
// .hGetAll('key')
|
||||
// ),
|
||||
// [
|
||||
// 1,
|
||||
// Object.create(null, {
|
||||
// field: {
|
||||
// value: 'value',
|
||||
// configurable: true,
|
||||
// enumerable: true
|
||||
// }
|
||||
// })
|
||||
// ]
|
||||
// );
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// clientOptions: {
|
||||
// legacyMode: true
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
testUtils.testWithClient('empty execAsPipeline', async client => {
|
||||
assert.deepEqual(
|
||||
await client.multi().execAsPipeline(),
|
||||
[]
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
||||
// describe('events', () => {
|
||||
// testUtils.testWithClient('connect, ready, end', async client => {
|
||||
// await Promise.all([
|
||||
// once(client, 'connect'),
|
||||
// once(client, 'ready'),
|
||||
// client.connect()
|
||||
// ]);
|
||||
// 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
|
||||
// });
|
||||
});
|
||||
|
||||
// await Promise.all([
|
||||
// once(client, 'end'),
|
||||
// client.disconnect()
|
||||
// ]);
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// disableClientSetup: true
|
||||
// });
|
||||
// });
|
||||
testUtils.testWithClient('scripts', async client => {
|
||||
assert.equal(
|
||||
await client.square(2),
|
||||
4
|
||||
);
|
||||
}, {
|
||||
...GLOBAL.SERVERS.OPEN,
|
||||
clientOptions: {
|
||||
scripts: {
|
||||
square: SQUARE_SCRIPT
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// describe('sendCommand', () => {
|
||||
// testUtils.testWithClient('PING', async client => {
|
||||
// assert.equal(await client.sendCommand(['PING']), 'PONG');
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
const module = {
|
||||
echo: {
|
||||
transformArguments(message: string): Array<string> {
|
||||
return ['ECHO', message];
|
||||
},
|
||||
transformReply(reply: string): string {
|
||||
return reply;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// testUtils.testWithClient('returnBuffers', async client => {
|
||||
// assert.deepEqual(
|
||||
// await client.sendCommand(['PING'], {
|
||||
// returnBuffers: true
|
||||
// }),
|
||||
// Buffer.from('PONG')
|
||||
// );
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
testUtils.testWithClient('modules', async client => {
|
||||
assert.equal(
|
||||
await client.module.echo('message'),
|
||||
'message'
|
||||
);
|
||||
}, {
|
||||
...GLOBAL.SERVERS.OPEN,
|
||||
clientOptions: {
|
||||
modules: {
|
||||
module
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// describe('AbortController', () => {
|
||||
// before(function () {
|
||||
// if (!global.AbortController) {
|
||||
// this.skip();
|
||||
// }
|
||||
// });
|
||||
testUtils.testWithClient('functions', async client => {
|
||||
await loadMathFunction(client);
|
||||
|
||||
// testUtils.testWithClient('success', async client => {
|
||||
// await client.sendCommand(['PING'], {
|
||||
// signal: new AbortController().signal
|
||||
// });
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
assert.equal(
|
||||
await client.math.square(2),
|
||||
4
|
||||
);
|
||||
}, {
|
||||
...GLOBAL.SERVERS.OPEN,
|
||||
minimumDockerVersion: [7, 0],
|
||||
clientOptions: {
|
||||
functions: {
|
||||
math: MATH_FUNCTION.library
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// testUtils.testWithClient('AbortError', client => {
|
||||
// const controller = new AbortController();
|
||||
// controller.abort();
|
||||
testUtils.testWithClient('duplicate should reuse command options', async client => {
|
||||
const duplicate = client.withTypeMapping({
|
||||
[RESP_TYPES.SIMPLE_STRING]: Buffer
|
||||
}).duplicate();
|
||||
|
||||
// return assert.rejects(
|
||||
// client.sendCommand(['PING'], {
|
||||
// signal: controller.signal
|
||||
// }),
|
||||
// AbortError
|
||||
// );
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
// });
|
||||
await duplicate.connect();
|
||||
|
||||
// testUtils.testWithClient('undefined and null should not break the client', async client => {
|
||||
// await assert.rejects(
|
||||
// client.sendCommand([null as any, undefined as any]),
|
||||
// TypeError
|
||||
// );
|
||||
|
||||
// assert.equal(
|
||||
// await client.ping(),
|
||||
// 'PONG'
|
||||
// );
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
// });
|
||||
|
||||
// describe('multi', () => {
|
||||
// testUtils.testWithClient('simple', async client => {
|
||||
// assert.deepEqual(
|
||||
// await client.multi()
|
||||
// .ping()
|
||||
// .set('key', 'value')
|
||||
// .get('key')
|
||||
// .exec(),
|
||||
// ['PONG', 'OK', 'value']
|
||||
// );
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
|
||||
// testUtils.testWithClient('should reject the whole chain on error', client => {
|
||||
// return assert.rejects(
|
||||
// client.multi()
|
||||
// .ping()
|
||||
// .addCommand(['INVALID COMMAND'])
|
||||
// .ping()
|
||||
// .exec()
|
||||
// );
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
|
||||
// testUtils.testWithClient('should reject the whole chain upon client disconnect', async client => {
|
||||
// await client.disconnect();
|
||||
|
||||
// return assert.rejects(
|
||||
// client.multi()
|
||||
// .ping()
|
||||
// .set('key', 'value')
|
||||
// .get('key')
|
||||
// .exec(),
|
||||
// ClientClosedError
|
||||
// );
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
|
||||
// testUtils.testWithClient('with script', async client => {
|
||||
// assert.deepEqual(
|
||||
// await client.multi()
|
||||
// .square(2)
|
||||
// .exec(),
|
||||
// [4]
|
||||
// );
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// clientOptions: {
|
||||
// scripts: {
|
||||
// square: SQUARE_SCRIPT
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
// testUtils.testWithClient('WatchError', async client => {
|
||||
// await client.watch('key');
|
||||
|
||||
// await client.set(
|
||||
// RedisClient.commandOptions({
|
||||
// isolated: true
|
||||
// }),
|
||||
// 'key',
|
||||
// '1'
|
||||
// );
|
||||
|
||||
// await assert.rejects(
|
||||
// client.multi()
|
||||
// .decr('key')
|
||||
// .exec(),
|
||||
// WatchError
|
||||
// );
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
|
||||
// describe('execAsPipeline', () => {
|
||||
// testUtils.testWithClient('exec(true)', async client => {
|
||||
// assert.deepEqual(
|
||||
// await client.multi()
|
||||
// .ping()
|
||||
// .exec(true),
|
||||
// ['PONG']
|
||||
// );
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
|
||||
// testUtils.testWithClient('empty execAsPipeline', async client => {
|
||||
// assert.deepEqual(
|
||||
// await client.multi().execAsPipeline(),
|
||||
// []
|
||||
// );
|
||||
// }, 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 => {
|
||||
// assert.equal(
|
||||
// await client.square(2),
|
||||
// 4
|
||||
// );
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// clientOptions: {
|
||||
// scripts: {
|
||||
// square: SQUARE_SCRIPT
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
// const module = {
|
||||
// echo: {
|
||||
// transformArguments(message: string): Array<string> {
|
||||
// return ['ECHO', message];
|
||||
// },
|
||||
// transformReply(reply: string): string {
|
||||
// return reply;
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
|
||||
// testUtils.testWithClient('modules', async client => {
|
||||
// assert.equal(
|
||||
// await client.module.echo('message'),
|
||||
// 'message'
|
||||
// );
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// clientOptions: {
|
||||
// modules: {
|
||||
// module
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
// testUtils.testWithClient('functions', async client => {
|
||||
// await loadMathFunction(client);
|
||||
|
||||
// assert.equal(
|
||||
// await client.math.square(2),
|
||||
// 4
|
||||
// );
|
||||
// }, {
|
||||
// ...GLOBAL.SERVERS.OPEN,
|
||||
// minimumDockerVersion: [7, 0],
|
||||
// clientOptions: {
|
||||
// functions: {
|
||||
// math: MATH_FUNCTION.library
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
try {
|
||||
assert.deepEqual(
|
||||
await duplicate.ping(),
|
||||
Buffer.from('PONG')
|
||||
);
|
||||
} finally {
|
||||
duplicate.close();
|
||||
}
|
||||
}, {
|
||||
...GLOBAL.SERVERS.OPEN,
|
||||
disableClientSetup: true,
|
||||
});
|
||||
|
||||
// describe('isolationPool', () => {
|
||||
// testUtils.testWithClient('executeIsolated', async client => {
|
||||
|
@@ -68,7 +68,7 @@ export interface RedisClientOptions<
|
||||
pingInterval?: number;
|
||||
}
|
||||
|
||||
interface TypeMappingOption<TYPE_MAPPING extends TypeMapping> {
|
||||
export interface TypeMappingOption<TYPE_MAPPING extends TypeMapping> {
|
||||
/**
|
||||
* Maps bettwen RESP types to JavaScript types
|
||||
*/
|
||||
@@ -532,11 +532,24 @@ export default class RedisClient<
|
||||
// );
|
||||
// }
|
||||
|
||||
duplicate(overrides?: Partial<RedisClientOptions<M, F, S, RESP>>) {
|
||||
return new (Object.getPrototypeOf(this).constructor)({
|
||||
duplicate<
|
||||
_M extends RedisModules = M,
|
||||
_F extends RedisFunctions = F,
|
||||
_S extends RedisScripts = S,
|
||||
_RESP extends RespVersions = RESP,
|
||||
_TYPE_MAPPING extends TypeMapping = TYPE_MAPPING
|
||||
>(overrides?: Partial<RedisClientOptions<_M, _F, _S, _RESP, _TYPE_MAPPING>>) {
|
||||
const client = new (Object.getPrototypeOf(this).constructor)({
|
||||
...this._options,
|
||||
...overrides
|
||||
}) as RedisClientType<M, F, S, RESP>;
|
||||
}) as RedisClientType<_M, _F, _S, _RESP, _TYPE_MAPPING>;
|
||||
|
||||
const { commandOptions } = this as ProxyClient;
|
||||
if (commandOptions) {
|
||||
return client.withCommandOptions(commandOptions);
|
||||
}
|
||||
|
||||
return client;
|
||||
}
|
||||
|
||||
connect() {
|
||||
|
@@ -91,6 +91,11 @@ export class DoublyLinkedList<T> {
|
||||
node.next = undefined;
|
||||
}
|
||||
|
||||
reset() {
|
||||
this._length = 0;
|
||||
this._head = this._tail = undefined;
|
||||
}
|
||||
|
||||
*[Symbol.iterator]() {
|
||||
let node = this._head;
|
||||
while (node !== undefined) {
|
||||
@@ -152,6 +157,11 @@ export class SinglyLinkedList<T> {
|
||||
return node.value;
|
||||
}
|
||||
|
||||
reset() {
|
||||
this._length = 0;
|
||||
this._head = this._tail = undefined;
|
||||
}
|
||||
|
||||
*[Symbol.iterator]() {
|
||||
let node = this._head;
|
||||
while (node !== undefined) {
|
||||
|
@@ -46,6 +46,7 @@ export interface ShardNode<
|
||||
S extends RedisScripts,
|
||||
RESP extends RespVersions
|
||||
> extends Node<M, F, S, RESP> {
|
||||
id: string;
|
||||
host: string;
|
||||
port: number;
|
||||
readonly: boolean;
|
||||
@@ -173,7 +174,6 @@ export default class RedisClusterSlots<
|
||||
promises: Array<Promise<unknown>> = [],
|
||||
eagerConnect = this._options.minimizeConnections !== true;
|
||||
|
||||
type a = typeof shards;
|
||||
for (const { from, to, master, replicas } of shards) {
|
||||
const shard: Shard<M, F, S, RESP> = {
|
||||
master: this._initiateSlotNode(master, false, eagerConnect, addressesInUse, promises)
|
||||
@@ -294,19 +294,19 @@ export default class RedisClusterSlots<
|
||||
}
|
||||
|
||||
private _initiateSlotNode(
|
||||
slotAddress: NodeAddress,
|
||||
shard: NodeAddress & { id: string; },
|
||||
readonly: boolean,
|
||||
eagerConnent: boolean,
|
||||
addressesInUse: Set<string>,
|
||||
promises: Array<Promise<unknown>>
|
||||
) {
|
||||
const address = `${slotAddress.host}:${slotAddress.port}`;
|
||||
const address = `${shard.host}:${shard.port}`;
|
||||
addressesInUse.add(address);
|
||||
|
||||
let node = this.nodeByAddress.get(address);
|
||||
if (!node) {
|
||||
node = {
|
||||
...slotAddress,
|
||||
...shard,
|
||||
address,
|
||||
readonly,
|
||||
client: undefined
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import CLIENT_GETNAME from './CLIENT_GETNAME';
|
||||
|
||||
describe('CLIENT GETNAME', () => {
|
||||
@@ -8,4 +9,11 @@ describe('CLIENT GETNAME', () => {
|
||||
['CLIENT', 'GETNAME']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.clientGetName', async client => {
|
||||
assert.equal(
|
||||
await client.clientGetName(),
|
||||
null
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,12 +1,12 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { ClientKillFilters, transformArguments } from './CLIENT_KILL';
|
||||
import CLIENT_KILL, { CLIENT_KILL_FILTERS } from './CLIENT_KILL';
|
||||
|
||||
describe('CLIENT KILL', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('ADDRESS', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
filter: ClientKillFilters.ADDRESS,
|
||||
CLIENT_KILL.transformArguments({
|
||||
filter: CLIENT_KILL_FILTERS.ADDRESS,
|
||||
address: 'ip:6379'
|
||||
}),
|
||||
['CLIENT', 'KILL', 'ADDR', 'ip:6379']
|
||||
@@ -15,8 +15,8 @@ describe('CLIENT KILL', () => {
|
||||
|
||||
it('LOCAL_ADDRESS', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
filter: ClientKillFilters.LOCAL_ADDRESS,
|
||||
CLIENT_KILL.transformArguments({
|
||||
filter: CLIENT_KILL_FILTERS.LOCAL_ADDRESS,
|
||||
localAddress: 'ip:6379'
|
||||
}),
|
||||
['CLIENT', 'KILL', 'LADDR', 'ip:6379']
|
||||
@@ -26,8 +26,8 @@ describe('CLIENT KILL', () => {
|
||||
describe('ID', () => {
|
||||
it('string', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
filter: ClientKillFilters.ID,
|
||||
CLIENT_KILL.transformArguments({
|
||||
filter: CLIENT_KILL_FILTERS.ID,
|
||||
id: '1'
|
||||
}),
|
||||
['CLIENT', 'KILL', 'ID', '1']
|
||||
@@ -36,8 +36,8 @@ describe('CLIENT KILL', () => {
|
||||
|
||||
it('number', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
filter: ClientKillFilters.ID,
|
||||
CLIENT_KILL.transformArguments({
|
||||
filter: CLIENT_KILL_FILTERS.ID,
|
||||
id: 1
|
||||
}),
|
||||
['CLIENT', 'KILL', 'ID', '1']
|
||||
@@ -47,8 +47,8 @@ describe('CLIENT KILL', () => {
|
||||
|
||||
it('TYPE', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
filter: ClientKillFilters.TYPE,
|
||||
CLIENT_KILL.transformArguments({
|
||||
filter: CLIENT_KILL_FILTERS.TYPE,
|
||||
type: 'master'
|
||||
}),
|
||||
['CLIENT', 'KILL', 'TYPE', 'master']
|
||||
@@ -57,8 +57,8 @@ describe('CLIENT KILL', () => {
|
||||
|
||||
it('USER', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
filter: ClientKillFilters.USER,
|
||||
CLIENT_KILL.transformArguments({
|
||||
filter: CLIENT_KILL_FILTERS.USER,
|
||||
username: 'username'
|
||||
}),
|
||||
['CLIENT', 'KILL', 'USER', 'username']
|
||||
@@ -68,15 +68,15 @@ describe('CLIENT KILL', () => {
|
||||
describe('SKIP_ME', () => {
|
||||
it('undefined', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(ClientKillFilters.SKIP_ME),
|
||||
CLIENT_KILL.transformArguments(CLIENT_KILL_FILTERS.SKIP_ME),
|
||||
['CLIENT', 'KILL', 'SKIPME']
|
||||
);
|
||||
});
|
||||
|
||||
it('true', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
filter: ClientKillFilters.SKIP_ME,
|
||||
CLIENT_KILL.transformArguments({
|
||||
filter: CLIENT_KILL_FILTERS.SKIP_ME,
|
||||
skipMe: true
|
||||
}),
|
||||
['CLIENT', 'KILL', 'SKIPME', 'yes']
|
||||
@@ -85,8 +85,8 @@ describe('CLIENT KILL', () => {
|
||||
|
||||
it('false', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
filter: ClientKillFilters.SKIP_ME,
|
||||
CLIENT_KILL.transformArguments({
|
||||
filter: CLIENT_KILL_FILTERS.SKIP_ME,
|
||||
skipMe: false
|
||||
}),
|
||||
['CLIENT', 'KILL', 'SKIPME', 'no']
|
||||
@@ -96,12 +96,12 @@ describe('CLIENT KILL', () => {
|
||||
|
||||
it('TYPE & SKIP_ME', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments([
|
||||
CLIENT_KILL.transformArguments([
|
||||
{
|
||||
filter: ClientKillFilters.TYPE,
|
||||
filter: CLIENT_KILL_FILTERS.TYPE,
|
||||
type: 'master'
|
||||
},
|
||||
ClientKillFilters.SKIP_ME
|
||||
CLIENT_KILL_FILTERS.SKIP_ME
|
||||
]),
|
||||
['CLIENT', 'KILL', 'TYPE', 'master', 'SKIPME']
|
||||
);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './CLIENT_NO-EVICT';
|
||||
import CLIENT_NO_EVICT from './CLIENT_NO-EVICT';
|
||||
|
||||
describe('CLIENT NO-EVICT', () => {
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
@@ -8,14 +8,14 @@ describe('CLIENT NO-EVICT', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('true', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(true),
|
||||
CLIENT_NO_EVICT.transformArguments(true),
|
||||
['CLIENT', 'NO-EVICT', 'ON']
|
||||
);
|
||||
});
|
||||
|
||||
it('false', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(false),
|
||||
CLIENT_NO_EVICT.transformArguments(false),
|
||||
['CLIENT', 'NO-EVICT', 'OFF']
|
||||
);
|
||||
});
|
||||
|
@@ -1,19 +1,19 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './CLIENT_PAUSE';
|
||||
import CLIENT_PAUSE from './CLIENT_PAUSE';
|
||||
|
||||
describe('CLIENT PAUSE', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(0),
|
||||
CLIENT_PAUSE.transformArguments(0),
|
||||
['CLIENT', 'PAUSE', '0']
|
||||
);
|
||||
});
|
||||
|
||||
it('with mode', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(0, 'ALL'),
|
||||
CLIENT_PAUSE.transformArguments(0, 'ALL'),
|
||||
['CLIENT', 'PAUSE', '0', 'ALL']
|
||||
);
|
||||
});
|
||||
|
@@ -1,11 +1,20 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './CLIENT_SETNAME';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
|
||||
import CLIENT_SETNAME from './CLIENT_SETNAME';
|
||||
|
||||
describe('CLIENT SETNAME', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('name'),
|
||||
CLIENT_SETNAME.transformArguments('name'),
|
||||
['CLIENT', 'SETNAME', 'name']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.clientSetName', async client => {
|
||||
assert.equal(
|
||||
await client.clientSetName('name'),
|
||||
'OK'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './CLUSTER_MYID';
|
||||
import CLUSTER_MYID from './CLUSTER_MYID';
|
||||
|
||||
describe('CLUSTER MYID', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
CLUSTER_MYID.transformArguments(),
|
||||
['CLUSTER', 'MYID']
|
||||
);
|
||||
});
|
||||
|
@@ -1,17 +1,17 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './COMMAND';
|
||||
import { assertPingCommand } from './COMMAND_INFO.spec';
|
||||
// import { strict as assert } from 'assert';
|
||||
// import testUtils, { GLOBAL } from '../test-utils';
|
||||
// import { transformArguments } from './COMMAND';
|
||||
// import { assertPingCommand } from './COMMAND_INFO.spec';
|
||||
|
||||
describe('COMMAND', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['COMMAND']
|
||||
);
|
||||
});
|
||||
// describe('COMMAND', () => {
|
||||
// it('transformArguments', () => {
|
||||
// assert.deepEqual(
|
||||
// transformArguments(),
|
||||
// ['COMMAND']
|
||||
// );
|
||||
// });
|
||||
|
||||
testUtils.testWithClient('client.command', async client => {
|
||||
assertPingCommand((await client.command()).find(command => command.name === 'ping'));
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
// testUtils.testWithClient('client.command', async client => {
|
||||
// assertPingCommand((await client.command()).find(command => command.name === 'ping'));
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
// });
|
||||
|
@@ -1,19 +1,19 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './COMMAND_COUNT';
|
||||
// import { strict as assert } from 'assert';
|
||||
// import testUtils, { GLOBAL } from '../test-utils';
|
||||
// import { transformArguments } from './COMMAND_COUNT';
|
||||
|
||||
describe('COMMAND COUNT', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['COMMAND', 'COUNT']
|
||||
);
|
||||
});
|
||||
// describe('COMMAND COUNT', () => {
|
||||
// it('transformArguments', () => {
|
||||
// assert.deepEqual(
|
||||
// transformArguments(),
|
||||
// ['COMMAND', 'COUNT']
|
||||
// );
|
||||
// });
|
||||
|
||||
testUtils.testWithClient('client.commandCount', async client => {
|
||||
assert.equal(
|
||||
typeof await client.commandCount(),
|
||||
'number'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
// testUtils.testWithClient('client.commandCount', async client => {
|
||||
// assert.equal(
|
||||
// typeof await client.commandCount(),
|
||||
// 'number'
|
||||
// );
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
// });
|
||||
|
@@ -1,19 +1,19 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './COMMAND_GETKEYS';
|
||||
// import { strict as assert } from 'assert';
|
||||
// import testUtils, { GLOBAL } from '../test-utils';
|
||||
// import { transformArguments } from './COMMAND_GETKEYS';
|
||||
|
||||
describe('COMMAND GETKEYS', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(['GET', 'key']),
|
||||
['COMMAND', 'GETKEYS', 'GET', 'key']
|
||||
);
|
||||
});
|
||||
// describe('COMMAND GETKEYS', () => {
|
||||
// it('transformArguments', () => {
|
||||
// assert.deepEqual(
|
||||
// transformArguments(['GET', 'key']),
|
||||
// ['COMMAND', 'GETKEYS', 'GET', 'key']
|
||||
// );
|
||||
// });
|
||||
|
||||
testUtils.testWithClient('client.commandGetKeys', async client => {
|
||||
assert.deepEqual(
|
||||
await client.commandGetKeys(['GET', 'key']),
|
||||
['key']
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
// testUtils.testWithClient('client.commandGetKeys', async client => {
|
||||
// assert.deepEqual(
|
||||
// await client.commandGetKeys(['GET', 'key']),
|
||||
// ['key']
|
||||
// );
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
// });
|
||||
|
@@ -1,24 +1,24 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './COMMAND_GETKEYSANDFLAGS';
|
||||
// import { strict as assert } from 'assert';
|
||||
// import testUtils, { GLOBAL } from '../test-utils';
|
||||
// import { transformArguments } from './COMMAND_GETKEYSANDFLAGS';
|
||||
|
||||
describe('COMMAND GETKEYSANDFLAGS', () => {
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
// describe('COMMAND GETKEYSANDFLAGS', () => {
|
||||
// testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(['GET', 'key']),
|
||||
['COMMAND', 'GETKEYSANDFLAGS', 'GET', 'key']
|
||||
);
|
||||
});
|
||||
// it('transformArguments', () => {
|
||||
// assert.deepEqual(
|
||||
// transformArguments(['GET', 'key']),
|
||||
// ['COMMAND', 'GETKEYSANDFLAGS', 'GET', 'key']
|
||||
// );
|
||||
// });
|
||||
|
||||
testUtils.testWithClient('client.commandGetKeysAndFlags', async client => {
|
||||
assert.deepEqual(
|
||||
await client.commandGetKeysAndFlags(['GET', 'key']),
|
||||
[{
|
||||
key: 'key',
|
||||
flags: ['RO', 'access']
|
||||
}]
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
// testUtils.testWithClient('client.commandGetKeysAndFlags', async client => {
|
||||
// assert.deepEqual(
|
||||
// await client.commandGetKeysAndFlags(['GET', 'key']),
|
||||
// [{
|
||||
// key: 'key',
|
||||
// flags: ['RO', 'access']
|
||||
// }]
|
||||
// );
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
// });
|
||||
|
@@ -1,49 +1,49 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './COMMAND_INFO';
|
||||
import { CommandCategories, CommandFlags, CommandReply } from './generic-transformers';
|
||||
// import { strict as assert } from 'assert';
|
||||
// import testUtils, { GLOBAL } from '../test-utils';
|
||||
// import { transformArguments } from './COMMAND_INFO';
|
||||
// import { CommandCategories, CommandFlags, CommandReply } from './generic-transformers';
|
||||
|
||||
export function assertPingCommand(commandInfo: CommandReply | null | undefined): void {
|
||||
assert.deepEqual(
|
||||
commandInfo,
|
||||
{
|
||||
name: 'ping',
|
||||
arity: -1,
|
||||
flags: new Set(
|
||||
testUtils.isVersionGreaterThan([7]) ?
|
||||
[CommandFlags.FAST] :
|
||||
[CommandFlags.STALE, CommandFlags.FAST]
|
||||
),
|
||||
firstKeyIndex: 0,
|
||||
lastKeyIndex: 0,
|
||||
step: 0,
|
||||
categories: new Set(
|
||||
testUtils.isVersionGreaterThan([6]) ?
|
||||
[CommandCategories.FAST, CommandCategories.CONNECTION] :
|
||||
[]
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
// export function assertPingCommand(commandInfo: CommandReply | null | undefined): void {
|
||||
// assert.deepEqual(
|
||||
// commandInfo,
|
||||
// {
|
||||
// name: 'ping',
|
||||
// arity: -1,
|
||||
// flags: new Set(
|
||||
// testUtils.isVersionGreaterThan([7]) ?
|
||||
// [CommandFlags.FAST] :
|
||||
// [CommandFlags.STALE, CommandFlags.FAST]
|
||||
// ),
|
||||
// firstKeyIndex: 0,
|
||||
// lastKeyIndex: 0,
|
||||
// step: 0,
|
||||
// categories: new Set(
|
||||
// testUtils.isVersionGreaterThan([6]) ?
|
||||
// [CommandCategories.FAST, CommandCategories.CONNECTION] :
|
||||
// []
|
||||
// )
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
|
||||
describe('COMMAND INFO', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(['PING']),
|
||||
['COMMAND', 'INFO', 'PING']
|
||||
);
|
||||
});
|
||||
// describe('COMMAND INFO', () => {
|
||||
// it('transformArguments', () => {
|
||||
// assert.deepEqual(
|
||||
// transformArguments(['PING']),
|
||||
// ['COMMAND', 'INFO', 'PING']
|
||||
// );
|
||||
// });
|
||||
|
||||
describe('client.commandInfo', () => {
|
||||
testUtils.testWithClient('PING', async client => {
|
||||
assertPingCommand((await client.commandInfo(['PING']))[0]);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
// describe('client.commandInfo', () => {
|
||||
// testUtils.testWithClient('PING', async client => {
|
||||
// assertPingCommand((await client.commandInfo(['PING']))[0]);
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
|
||||
testUtils.testWithClient('DOSE_NOT_EXISTS', async client => {
|
||||
assert.deepEqual(
|
||||
await client.commandInfo(['DOSE_NOT_EXISTS']),
|
||||
[null]
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
});
|
||||
// testUtils.testWithClient('DOSE_NOT_EXISTS', async client => {
|
||||
// assert.deepEqual(
|
||||
// await client.commandInfo(['DOSE_NOT_EXISTS']),
|
||||
// [null]
|
||||
// );
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
// });
|
||||
// });
|
||||
|
@@ -1,56 +1,56 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments, FilterBy } from './COMMAND_LIST';
|
||||
// import { strict as assert } from 'assert';
|
||||
// import testUtils, { GLOBAL } from '../test-utils';
|
||||
// import { transformArguments, FilterBy } from './COMMAND_LIST';
|
||||
|
||||
describe('COMMAND LIST', () => {
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
// describe('COMMAND LIST', () => {
|
||||
// testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['COMMAND', 'LIST']
|
||||
);
|
||||
});
|
||||
// describe('transformArguments', () => {
|
||||
// it('simple', () => {
|
||||
// assert.deepEqual(
|
||||
// transformArguments(),
|
||||
// ['COMMAND', 'LIST']
|
||||
// );
|
||||
// });
|
||||
|
||||
describe('with FILTERBY', () => {
|
||||
it('MODULE', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
filterBy: FilterBy.MODULE,
|
||||
value: 'json'
|
||||
}),
|
||||
['COMMAND', 'LIST', 'FILTERBY', 'MODULE', 'json']
|
||||
);
|
||||
});
|
||||
// describe('with FILTERBY', () => {
|
||||
// it('MODULE', () => {
|
||||
// assert.deepEqual(
|
||||
// transformArguments({
|
||||
// filterBy: FilterBy.MODULE,
|
||||
// value: 'json'
|
||||
// }),
|
||||
// ['COMMAND', 'LIST', 'FILTERBY', 'MODULE', 'json']
|
||||
// );
|
||||
// });
|
||||
|
||||
it('ACLCAT', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
filterBy: FilterBy.ACLCAT,
|
||||
value: 'admin'
|
||||
}),
|
||||
['COMMAND', 'LIST', 'FILTERBY', 'ACLCAT', 'admin']
|
||||
);
|
||||
});
|
||||
// it('ACLCAT', () => {
|
||||
// assert.deepEqual(
|
||||
// transformArguments({
|
||||
// filterBy: FilterBy.ACLCAT,
|
||||
// value: 'admin'
|
||||
// }),
|
||||
// ['COMMAND', 'LIST', 'FILTERBY', 'ACLCAT', 'admin']
|
||||
// );
|
||||
// });
|
||||
|
||||
it('PATTERN', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
filterBy: FilterBy.PATTERN,
|
||||
value: 'a*'
|
||||
}),
|
||||
['COMMAND', 'LIST', 'FILTERBY', 'PATTERN', 'a*']
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
// it('PATTERN', () => {
|
||||
// assert.deepEqual(
|
||||
// transformArguments({
|
||||
// filterBy: FilterBy.PATTERN,
|
||||
// value: 'a*'
|
||||
// }),
|
||||
// ['COMMAND', 'LIST', 'FILTERBY', 'PATTERN', 'a*']
|
||||
// );
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
|
||||
testUtils.testWithClient('client.commandList', async client => {
|
||||
const commandList = await client.commandList();
|
||||
assert.ok(Array.isArray(commandList));
|
||||
for (const command of commandList) {
|
||||
assert.ok(typeof command === 'string');
|
||||
}
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
// testUtils.testWithClient('client.commandList', async client => {
|
||||
// const commandList = await client.commandList();
|
||||
// assert.ok(Array.isArray(commandList));
|
||||
// for (const command of commandList) {
|
||||
// assert.ok(typeof command === 'string');
|
||||
// }
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
// });
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './CONFIG_GET';
|
||||
import CONFIG_GET from './CONFIG_GET';
|
||||
|
||||
describe('CONFIG GET', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('*'),
|
||||
CONFIG_GET.transformArguments('*'),
|
||||
['CONFIG', 'GET', '*']
|
||||
);
|
||||
});
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './CONFIG_RESETSTAT';
|
||||
import CONFIG_RESETSTAT from './CONFIG_RESETSTAT';
|
||||
|
||||
describe('CONFIG RESETSTAT', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
CONFIG_RESETSTAT.transformArguments(),
|
||||
['CONFIG', 'RESETSTAT']
|
||||
);
|
||||
});
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './CONFIG_REWRITE';
|
||||
import CONFIG_REWRITE from './CONFIG_REWRITE';
|
||||
|
||||
describe('CONFIG REWRITE', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
CONFIG_REWRITE.transformArguments(),
|
||||
['CONFIG', 'REWRITE']
|
||||
);
|
||||
});
|
||||
|
@@ -1,18 +1,18 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './CONFIG_SET';
|
||||
import CONFIG_SET from './CONFIG_SET';
|
||||
|
||||
describe('CONFIG SET', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('set one parameter (old version)', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('parameter', 'value'),
|
||||
CONFIG_SET.transformArguments('parameter', 'value'),
|
||||
['CONFIG', 'SET', 'parameter', 'value']
|
||||
);
|
||||
});
|
||||
|
||||
it('set muiltiple parameters', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
CONFIG_SET.transformArguments({
|
||||
1: 'a',
|
||||
2: 'b',
|
||||
3: 'c'
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './DISCARD';
|
||||
import DISCARD from './DISCARD';
|
||||
|
||||
describe('DISCARD', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
DISCARD.transformArguments(),
|
||||
['DISCARD']
|
||||
);
|
||||
});
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './FAILOVER';
|
||||
import FAILOVER from './FAILOVER';
|
||||
|
||||
describe('FAILOVER', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
FAILOVER.transformArguments(),
|
||||
['FAILOVER']
|
||||
);
|
||||
});
|
||||
@@ -13,7 +13,7 @@ describe('FAILOVER', () => {
|
||||
describe('with TO', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
FAILOVER.transformArguments({
|
||||
TO: {
|
||||
host: 'host',
|
||||
port: 6379
|
||||
@@ -25,7 +25,7 @@ describe('FAILOVER', () => {
|
||||
|
||||
it('with FORCE', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
FAILOVER.transformArguments({
|
||||
TO: {
|
||||
host: 'host',
|
||||
port: 6379,
|
||||
@@ -39,7 +39,7 @@ describe('FAILOVER', () => {
|
||||
|
||||
it('with ABORT', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
FAILOVER.transformArguments({
|
||||
ABORT: true
|
||||
}),
|
||||
['FAILOVER', 'ABORT']
|
||||
@@ -48,7 +48,7 @@ describe('FAILOVER', () => {
|
||||
|
||||
it('with TIMEOUT', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
FAILOVER.transformArguments({
|
||||
TIMEOUT: 1
|
||||
}),
|
||||
['FAILOVER', 'TIMEOUT', '1']
|
||||
@@ -57,7 +57,7 @@ describe('FAILOVER', () => {
|
||||
|
||||
it('with TO, ABORT, TIMEOUT', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
FAILOVER.transformArguments({
|
||||
TO: {
|
||||
host: 'host',
|
||||
port: 6379
|
||||
|
@@ -1,14 +1,14 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { MATH_FUNCTION, loadMathFunction } from '../client/index.spec';
|
||||
import { transformArguments } from './FCALL';
|
||||
import { MATH_FUNCTION, loadMathFunction } from './FUNCTION_LOAD.spec';
|
||||
import FCALL from './FCALL';
|
||||
|
||||
describe('FCALL', () => {
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('function', {
|
||||
FCALL.transformArguments('function', {
|
||||
keys: ['key'],
|
||||
arguments: ['argument']
|
||||
}),
|
||||
|
@@ -1,19 +1,9 @@
|
||||
import { evalFirstKeyIndex, EvalOptions, pushEvalArguments } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = evalFirstKeyIndex;
|
||||
|
||||
export function transformArguments(fn: string, options?: EvalOptions): Array<string> {
|
||||
return pushEvalArguments(['FCALL', fn], options);
|
||||
}
|
||||
|
||||
import { SimpleStringReply, Command } from '../RESP/types';
|
||||
import { Command } from '../RESP/types';
|
||||
import EVAL, { EvalOptions, transformEvalArguments } from './EVAL';
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
FIRST_KEY_INDEX: EVAL.FIRST_KEY_INDEX,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments() {
|
||||
return ['FCALL'];
|
||||
},
|
||||
transformReply: undefined as unknown as () => SimpleStringReply
|
||||
transformArguments: transformEvalArguments.bind(undefined, 'FCALL'),
|
||||
transformReply: EVAL.transformReply
|
||||
} as const satisfies Command;
|
||||
|
||||
|
@@ -1,14 +1,14 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { MATH_FUNCTION, loadMathFunction } from '../client/index.spec';
|
||||
import { transformArguments } from './FCALL_RO';
|
||||
import { MATH_FUNCTION, loadMathFunction } from './FUNCTION_LOAD.spec';
|
||||
import FCALL_RO from './FCALL_RO';
|
||||
|
||||
describe('FCALL_RO', () => {
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('function', {
|
||||
FCALL_RO.transformArguments('function', {
|
||||
keys: ['key'],
|
||||
arguments: ['argument']
|
||||
}),
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { evalFirstKeyIndex, EvalOptions, pushEvalArguments } from './generic-transformers';
|
||||
import { Command } from '../RESP/types';
|
||||
import EVAL, { EvalOptions, transformEvalArguments } from './EVAL';
|
||||
|
||||
export const FIRST_KEY_INDEX = evalFirstKeyIndex;
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(fn: string, options?: EvalOptions): Array<string> {
|
||||
return pushEvalArguments(['FCALL_RO', fn], options);
|
||||
}
|
||||
export default {
|
||||
FIRST_KEY_INDEX: EVAL.FIRST_KEY_INDEX,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments: transformEvalArguments.bind(undefined, 'FCALL_RO'),
|
||||
transformReply: EVAL.transformReply
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,14 +1,14 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { MATH_FUNCTION, loadMathFunction } from '../client/index.spec';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './FUNCTION_DELETE';
|
||||
import FUNCTION_DELETE from './FUNCTION_DELETE';
|
||||
import { MATH_FUNCTION, loadMathFunction } from './FUNCTION_LOAD.spec';
|
||||
|
||||
describe('FUNCTION DELETE', () => {
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('library'),
|
||||
FUNCTION_DELETE.transformArguments('library'),
|
||||
['FUNCTION', 'DELETE', 'library']
|
||||
);
|
||||
});
|
||||
|
@@ -2,7 +2,7 @@ import { RedisArgument, SimpleStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments(library: RedisArgument) {
|
||||
return ['FUNCTION', 'DELETE', library];
|
||||
},
|
||||
|
@@ -1,13 +1,13 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './FUNCTION_DUMP';
|
||||
import FUNCTION_DUMP from './FUNCTION_DUMP';
|
||||
|
||||
describe('FUNCTION DUMP', () => {
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
FUNCTION_DUMP.transformArguments(),
|
||||
['FUNCTION', 'DUMP']
|
||||
);
|
||||
});
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './FUNCTION_FLUSH';
|
||||
import FUNCTION_FLUSH from './FUNCTION_FLUSH';
|
||||
|
||||
describe('FUNCTION FLUSH', () => {
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
@@ -8,14 +8,14 @@ describe('FUNCTION FLUSH', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
FUNCTION_FLUSH.transformArguments(),
|
||||
['FUNCTION', 'FLUSH']
|
||||
);
|
||||
});
|
||||
|
||||
it('with mode', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('SYNC'),
|
||||
FUNCTION_FLUSH.transformArguments('SYNC'),
|
||||
['FUNCTION', 'FLUSH', 'SYNC']
|
||||
);
|
||||
});
|
||||
|
@@ -3,7 +3,7 @@ import { RedisFlushModes } from './FLUSHALL';
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments(mode?: RedisFlushModes) {
|
||||
const args = ['FUNCTION', 'FLUSH'];
|
||||
|
||||
@@ -13,5 +13,5 @@ export default {
|
||||
|
||||
return args;
|
||||
},
|
||||
transformReply: undefined as unknown as () => SimpleStringReply
|
||||
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,13 +1,13 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils from '../test-utils';
|
||||
import { transformArguments } from './FUNCTION_KILL';
|
||||
import FUNCTION_KILL from './FUNCTION_KILL';
|
||||
|
||||
describe('FUNCTION KILL', () => {
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
FUNCTION_KILL.transformArguments(),
|
||||
['FUNCTION', 'KILL']
|
||||
);
|
||||
});
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { MATH_FUNCTION, loadMathFunction } from '../client/index.spec';
|
||||
import { transformArguments } from './FUNCTION_LIST';
|
||||
import FUNCTION_LIST from './FUNCTION_LIST';
|
||||
import { MATH_FUNCTION, loadMathFunction } from './FUNCTION_LOAD.spec';
|
||||
|
||||
describe('FUNCTION LIST', () => {
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
@@ -9,15 +9,17 @@ describe('FUNCTION LIST', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
FUNCTION_LIST.transformArguments(),
|
||||
['FUNCTION', 'LIST']
|
||||
);
|
||||
});
|
||||
|
||||
it('with pattern', () => {
|
||||
it('with LIBRARYNAME', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('patter*'),
|
||||
['FUNCTION', 'LIST', 'patter*']
|
||||
FUNCTION_LIST.transformArguments({
|
||||
LIBRARYNAME: 'patter*'
|
||||
}),
|
||||
['FUNCTION', 'LIST', 'LIBRARYNAME', 'patter*']
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -28,7 +30,7 @@ describe('FUNCTION LIST', () => {
|
||||
assert.deepEqual(
|
||||
await client.functionList(),
|
||||
[{
|
||||
libraryName: MATH_FUNCTION.name,
|
||||
library_name: MATH_FUNCTION.name,
|
||||
engine: MATH_FUNCTION.engine,
|
||||
functions: [{
|
||||
name: MATH_FUNCTION.library.square.NAME,
|
||||
|
@@ -1,16 +1,45 @@
|
||||
// import { RedisCommandArguments } from '.';
|
||||
// import { FunctionListItemReply, FunctionListRawItemReply, transformFunctionListItemReply } from './generic-transformers';
|
||||
import { RedisArgument, TuplesToMapReply, BlobStringReply, ArrayReply, NullReply, SetReply, Resp2Reply, CommandArguments, Command } from '../RESP/types';
|
||||
|
||||
// export function transformArguments(pattern?: string): RedisCommandArguments {
|
||||
// const args = ['FUNCTION', 'LIST'];
|
||||
export interface FunctionListOptions {
|
||||
LIBRARYNAME?: RedisArgument;
|
||||
}
|
||||
|
||||
// if (pattern) {
|
||||
// args.push(pattern);
|
||||
// }
|
||||
export type FunctionListReplyItem = [
|
||||
[BlobStringReply<'library_name'>, BlobStringReply],
|
||||
[BlobStringReply<'engine'>, BlobStringReply],
|
||||
[BlobStringReply<'functions'>, ArrayReply<TuplesToMapReply<[
|
||||
[BlobStringReply<'name'>, BlobStringReply],
|
||||
[BlobStringReply<'description'>, BlobStringReply | NullReply],
|
||||
[BlobStringReply<'flags'>, SetReply<BlobStringReply>],
|
||||
]>>]
|
||||
]
|
||||
|
||||
// return args;
|
||||
// }
|
||||
export type FunctionListReply = ArrayReply<TuplesToMapReply<FunctionListReplyItem>>;
|
||||
|
||||
// export function transformReply(reply: Array<FunctionListRawItemReply>): Array<FunctionListItemReply> {
|
||||
// return reply.map(transformFunctionListItemReply);
|
||||
// }
|
||||
export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments(options?: FunctionListOptions) {
|
||||
const args: CommandArguments = ['FUNCTION', 'LIST'];
|
||||
|
||||
if (options?.LIBRARYNAME) {
|
||||
args.push('LIBRARYNAME', options.LIBRARYNAME);
|
||||
}
|
||||
|
||||
return args;
|
||||
},
|
||||
transformReply: {
|
||||
2: (reply: Resp2Reply<FunctionListReply>) => {
|
||||
return reply.map(library => ({
|
||||
library_name: library[1],
|
||||
engine: library[3],
|
||||
functions: library[5].map(fn => ({
|
||||
name: fn[1],
|
||||
description: fn[3],
|
||||
flags: fn[5]
|
||||
}))
|
||||
}));
|
||||
},
|
||||
3: undefined as unknown as () => FunctionListReply
|
||||
}
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { MATH_FUNCTION, loadMathFunction } from '../client/index.spec';
|
||||
import { transformArguments } from './FUNCTION_LIST_WITHCODE';
|
||||
import FUNCTION_LIST_WITHCODE from './FUNCTION_LIST_WITHCODE';
|
||||
import { MATH_FUNCTION, loadMathFunction } from './FUNCTION_LOAD.spec';
|
||||
|
||||
describe('FUNCTION LIST WITHCODE', () => {
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
@@ -9,15 +9,17 @@ describe('FUNCTION LIST WITHCODE', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
FUNCTION_LIST_WITHCODE.transformArguments(),
|
||||
['FUNCTION', 'LIST', 'WITHCODE']
|
||||
);
|
||||
});
|
||||
|
||||
it('with pattern', () => {
|
||||
it('with LIBRARYNAME', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('patter*'),
|
||||
['FUNCTION', 'LIST', 'patter*', 'WITHCODE']
|
||||
FUNCTION_LIST_WITHCODE.transformArguments({
|
||||
LIBRARYNAME: 'patter*'
|
||||
}),
|
||||
['FUNCTION', 'LIST', 'LIBRARYNAME', 'patter*', 'WITHCODE']
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -28,14 +30,14 @@ describe('FUNCTION LIST WITHCODE', () => {
|
||||
assert.deepEqual(
|
||||
await client.functionListWithCode(),
|
||||
[{
|
||||
libraryName: MATH_FUNCTION.name,
|
||||
library_name: MATH_FUNCTION.name,
|
||||
engine: MATH_FUNCTION.engine,
|
||||
functions: [{
|
||||
name: MATH_FUNCTION.library.square.NAME,
|
||||
description: null,
|
||||
flags: ['no-writes']
|
||||
}],
|
||||
libraryCode: MATH_FUNCTION.code
|
||||
library_code: MATH_FUNCTION.code
|
||||
}]
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
|
@@ -1,26 +1,32 @@
|
||||
// import { RedisCommandArguments } from '.';
|
||||
// import { transformArguments as transformFunctionListArguments } from './FUNCTION_LIST';
|
||||
// import { FunctionListItemReply, FunctionListRawItemReply, transformFunctionListItemReply } from './generic-transformers';
|
||||
import { TuplesToMapReply, BlobStringReply, ArrayReply, Command, Resp2Reply } from '../RESP/types';
|
||||
import FUNCTION_LIST, { FunctionListReplyItem } from './FUNCTION_LIST';
|
||||
|
||||
// export function transformArguments(pattern?: string): RedisCommandArguments {
|
||||
// const args = transformFunctionListArguments(pattern);
|
||||
// args.push('WITHCODE');
|
||||
// return args;
|
||||
// }
|
||||
export type FunctionListWithCodeReply = ArrayReply<TuplesToMapReply<[
|
||||
...FunctionListReplyItem,
|
||||
[BlobStringReply<'library_code'>, BlobStringReply],
|
||||
]>>;
|
||||
|
||||
// type FunctionListWithCodeRawItemReply = [
|
||||
// ...FunctionListRawItemReply,
|
||||
// 'library_code',
|
||||
// string
|
||||
// ];
|
||||
|
||||
// interface FunctionListWithCodeItemReply extends FunctionListItemReply {
|
||||
// libraryCode: string;
|
||||
// }
|
||||
|
||||
// export function transformReply(reply: Array<FunctionListWithCodeRawItemReply>): Array<FunctionListWithCodeItemReply> {
|
||||
// return reply.map(library => ({
|
||||
// ...transformFunctionListItemReply(library as unknown as FunctionListRawItemReply),
|
||||
// libraryCode: library[7]
|
||||
// }));
|
||||
// }
|
||||
export default {
|
||||
FIRST_KEY_INDEX: FUNCTION_LIST.FIRST_KEY_INDEX,
|
||||
IS_READ_ONLY: FUNCTION_LIST.IS_READ_ONLY,
|
||||
transformArguments(...args: Parameters<typeof FUNCTION_LIST.transformArguments>) {
|
||||
const redisArgs = FUNCTION_LIST.transformArguments(...args);
|
||||
redisArgs.push('WITHCODE');
|
||||
return redisArgs;
|
||||
},
|
||||
transformReply: {
|
||||
2: (reply: Resp2Reply<FunctionListWithCodeReply>) => {
|
||||
return reply.map((library: any) => ({
|
||||
library_name: library[1],
|
||||
engine: library[3],
|
||||
functions: library[5].map((fn: any) => ({
|
||||
name: fn[1],
|
||||
description: fn[3],
|
||||
flags: fn[5]
|
||||
})),
|
||||
library_code: library[7]
|
||||
})) as unknown as number;
|
||||
},
|
||||
3: undefined as unknown as () => FunctionListWithCodeReply
|
||||
}
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,7 +1,45 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { MATH_FUNCTION } from '../client/index.spec';
|
||||
import { transformArguments } from './FUNCTION_LOAD';
|
||||
import FUNCTION_LOAD from './FUNCTION_LOAD';
|
||||
import { RedisClientType } from '../client';
|
||||
import { NumberReply, RedisFunctions, RedisModules, RedisScripts, RespVersions } from '../RESP/types';
|
||||
|
||||
export const MATH_FUNCTION = {
|
||||
name: 'math',
|
||||
engine: 'LUA',
|
||||
code:
|
||||
`#!LUA name=math
|
||||
redis.register_function{
|
||||
function_name = "square",
|
||||
callback = function(keys, args) return args[1] * args[1] end,
|
||||
flags = { "no-writes" }
|
||||
}`,
|
||||
library: {
|
||||
square: {
|
||||
NAME: 'square',
|
||||
IS_READ_ONLY: true,
|
||||
NUMBER_OF_KEYS: 0,
|
||||
transformArguments(number: number) {
|
||||
return [number.toString()];
|
||||
},
|
||||
transformReply: undefined as unknown as () => NumberReply
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export function loadMathFunction<
|
||||
M extends RedisModules,
|
||||
F extends RedisFunctions,
|
||||
S extends RedisScripts,
|
||||
RESP extends RespVersions
|
||||
>(
|
||||
client: RedisClientType<M, F, S, RESP>
|
||||
) {
|
||||
return client.functionLoad(
|
||||
MATH_FUNCTION.code,
|
||||
{ REPLACE: true }
|
||||
);
|
||||
}
|
||||
|
||||
describe('FUNCTION LOAD', () => {
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
@@ -9,14 +47,14 @@ describe('FUNCTION LOAD', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments( 'code'),
|
||||
FUNCTION_LOAD.transformArguments('code'),
|
||||
['FUNCTION', 'LOAD', 'code']
|
||||
);
|
||||
});
|
||||
|
||||
it('with REPLACE', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('code', {
|
||||
FUNCTION_LOAD.transformArguments('code', {
|
||||
REPLACE: true
|
||||
}),
|
||||
['FUNCTION', 'LOAD', 'REPLACE', 'code']
|
||||
@@ -26,10 +64,7 @@ describe('FUNCTION LOAD', () => {
|
||||
|
||||
testUtils.testWithClient('client.functionLoad', async client => {
|
||||
assert.equal(
|
||||
await client.functionLoad(
|
||||
MATH_FUNCTION.code,
|
||||
{ REPLACE: true }
|
||||
),
|
||||
await loadMathFunction(client),
|
||||
MATH_FUNCTION.name
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
|
@@ -1,22 +1,22 @@
|
||||
// import { RedisCommandArguments } from '.';
|
||||
import { RedisArgument, CommandArguments, BlobStringReply, Command } from '../RESP/types';
|
||||
|
||||
// interface FunctionLoadOptions {
|
||||
// REPLACE?: boolean;
|
||||
// }
|
||||
export interface FunctionLoadOptions {
|
||||
REPLACE?: boolean;
|
||||
}
|
||||
|
||||
// export function transformArguments(
|
||||
// code: string,
|
||||
// options?: FunctionLoadOptions
|
||||
// ): RedisCommandArguments {
|
||||
// const args = ['FUNCTION', 'LOAD'];
|
||||
export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments(code: RedisArgument, options?: FunctionLoadOptions) {
|
||||
const args: CommandArguments = ['FUNCTION', 'LOAD'];
|
||||
|
||||
// if (options?.REPLACE) {
|
||||
// args.push('REPLACE');
|
||||
// }
|
||||
if (options?.REPLACE) {
|
||||
args.push('REPLACE');
|
||||
}
|
||||
|
||||
// args.push(code);
|
||||
args.push(code);
|
||||
|
||||
// return args;
|
||||
// }
|
||||
|
||||
// export declare function transformReply(): string;
|
||||
return args;
|
||||
},
|
||||
transformReply: undefined as unknown as () => BlobStringReply
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './FUNCTION_RESTORE';
|
||||
import FUNCTION_RESTORE from './FUNCTION_RESTORE';
|
||||
import { RESP_TYPES } from '../RESP/decoder';
|
||||
|
||||
describe('FUNCTION RESTORE', () => {
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
@@ -8,14 +9,16 @@ describe('FUNCTION RESTORE', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('dump'),
|
||||
FUNCTION_RESTORE.transformArguments('dump'),
|
||||
['FUNCTION', 'RESTORE', 'dump']
|
||||
);
|
||||
});
|
||||
|
||||
it('with mode', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('dump', 'APPEND'),
|
||||
FUNCTION_RESTORE.transformArguments('dump', {
|
||||
mode: 'APPEND'
|
||||
}),
|
||||
['FUNCTION', 'RESTORE', 'dump', 'APPEND']
|
||||
);
|
||||
});
|
||||
@@ -24,11 +27,9 @@ describe('FUNCTION RESTORE', () => {
|
||||
testUtils.testWithClient('client.functionRestore', async client => {
|
||||
assert.equal(
|
||||
await client.functionRestore(
|
||||
await client.functionDump(
|
||||
client.commandOptions({
|
||||
returnBuffers: true
|
||||
})
|
||||
),
|
||||
await client.withTypeMapping({
|
||||
[RESP_TYPES.BLOB_STRING]: Buffer
|
||||
}).functionDump(),
|
||||
'FLUSH'
|
||||
),
|
||||
'OK'
|
||||
|
@@ -1,16 +1,20 @@
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { SimpleStringReply, Command, RedisArgument } from '../RESP/types';
|
||||
|
||||
// export function transformArguments(
|
||||
// dump: RedisCommandArgument,
|
||||
// mode?: 'FLUSH' | 'APPEND' | 'REPLACE'
|
||||
// ): RedisCommandArguments {
|
||||
// const args = ['FUNCTION', 'RESTORE', dump];
|
||||
export interface FunctionRestoreOptions {
|
||||
mode?: 'FLUSH' | 'APPEND' | 'REPLACE';
|
||||
}
|
||||
|
||||
// if (mode) {
|
||||
// args.push(mode);
|
||||
// }
|
||||
export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments(dump: RedisArgument, options?: FunctionRestoreOptions) {
|
||||
const args = ['FUNCTION', 'RESTORE', dump];
|
||||
|
||||
// return args;
|
||||
// }
|
||||
if (options?.mode) {
|
||||
args.push(options.mode);
|
||||
}
|
||||
|
||||
// export declare function transformReply(): 'OK';
|
||||
return args;
|
||||
},
|
||||
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,25 +1,25 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './FUNCTION_STATS';
|
||||
// import { strict as assert } from 'assert';
|
||||
// import testUtils, { GLOBAL } from '../test-utils';
|
||||
// import { transformArguments } from './FUNCTION_STATS';
|
||||
|
||||
describe('FUNCTION STATS', () => {
|
||||
testUtils.isVersionGreaterThanHook([7]);
|
||||
// describe('FUNCTION STATS', () => {
|
||||
// testUtils.isVersionGreaterThanHook([7]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['FUNCTION', 'STATS']
|
||||
);
|
||||
});
|
||||
// it('transformArguments', () => {
|
||||
// assert.deepEqual(
|
||||
// transformArguments(),
|
||||
// ['FUNCTION', 'STATS']
|
||||
// );
|
||||
// });
|
||||
|
||||
testUtils.testWithClient('client.functionStats', async client => {
|
||||
const stats = await client.functionStats();
|
||||
assert.equal(stats.runningScript, null);
|
||||
assert.equal(typeof stats.engines, 'object');
|
||||
for (const [engine, { librariesCount, functionsCount }] of Object.entries(stats.engines)) {
|
||||
assert.equal(typeof engine, 'string');
|
||||
assert.equal(typeof librariesCount, 'number');
|
||||
assert.equal(typeof functionsCount, 'number');
|
||||
}
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
// testUtils.testWithClient('client.functionStats', async client => {
|
||||
// const stats = await client.functionStats();
|
||||
// assert.equal(stats.runningScript, null);
|
||||
// assert.equal(typeof stats.engines, 'object');
|
||||
// for (const [engine, { librariesCount, functionsCount }] of Object.entries(stats.engines)) {
|
||||
// assert.equal(typeof engine, 'string');
|
||||
// assert.equal(typeof librariesCount, 'number');
|
||||
// assert.equal(typeof functionsCount, 'number');
|
||||
// }
|
||||
// }, GLOBAL.SERVERS.OPEN);
|
||||
// });
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,5 @@
|
||||
import { ArrayReply, BlobStringReply, CommandArguments, DoubleReply, NullReply, RedisArgument, Resp2Reply } from '../RESP/types';
|
||||
|
||||
// export function transformBooleanReply(reply: number): boolean {
|
||||
// return reply === 1;
|
||||
// }
|
||||
|
||||
// export function transformBooleanArrayReply(reply: Array<number>): Array<boolean> {
|
||||
// return reply.map(transformBooleanReply);
|
||||
// }
|
||||
|
||||
export type BitValue = 0 | 1;
|
||||
|
||||
export function transformDoubleReply(reply: BlobStringReply): number {
|
||||
|
@@ -41,6 +41,7 @@ import CLUSTER_MEET from './CLUSTER_MEET';
|
||||
import CLUSTER_MYID from './CLUSTER_MYID';
|
||||
import CLUSTER_REPLICATE from './CLUSTER_REPLICATE';
|
||||
import COPY from './COPY';
|
||||
import DBSIZE from './DBSIZE';
|
||||
import DECR from './DECR';
|
||||
import DECRBY from './DECRBY';
|
||||
import DEL from './DEL';
|
||||
@@ -79,6 +80,17 @@ import EXPIREAT from './EXPIREAT';
|
||||
import EXPIRETIME from './EXPIRETIME';
|
||||
import FLUSHALL from './FLUSHALL';
|
||||
import FLUSHDB from './FLUSHDB';
|
||||
import FCALL from './FCALL';
|
||||
import FCALL_RO from './FCALL_RO';
|
||||
import FUNCTION_DELETE from './FUNCTION_DELETE';
|
||||
import FUNCTION_DUMP from './FUNCTION_DUMP';
|
||||
import FUNCTION_FLUSH from './FUNCTION_FLUSH';
|
||||
import FUNCTION_KILL from './FUNCTION_KILL';
|
||||
import FUNCTION_LIST_WITHCODE from './FUNCTION_LIST_WITHCODE';
|
||||
import FUNCTION_LIST from './FUNCTION_LIST';
|
||||
import FUNCTION_LOAD from './FUNCTION_LOAD';
|
||||
// import FUNCTION_RESTORE from './FUNCTION_RESTORE';
|
||||
// import FUNCTION_STATS from './FUNCTION_STATS';
|
||||
import HDEL from './HDEL';
|
||||
import HELLO from './HELLO';
|
||||
import HEXISTS from './HEXISTS';
|
||||
@@ -246,6 +258,786 @@ import ZUNION from './ZUNION';
|
||||
import ZUNIONSTORE from './ZUNIONSTORE';
|
||||
import { Command } from '../RESP/types';
|
||||
|
||||
type ACL_CAT = typeof import('./ACL_CAT').default;
|
||||
type ACL_DRYRUN = typeof import('./ACL_DRYRUN').default;
|
||||
type ACL_GENPASS = typeof import('./ACL_GENPASS').default;
|
||||
type ACL_GETUSER = typeof import('./ACL_GETUSER').default;
|
||||
type ACL_LIST = typeof import('./ACL_LIST').default;
|
||||
type ACL_LOAD = typeof import('./ACL_LOAD').default;
|
||||
type ACL_LOG_RESET = typeof import('./ACL_LOG_RESET').default;
|
||||
type ACL_LOG = typeof import('./ACL_LOG').default;
|
||||
type ACL_SAVE = typeof import('./ACL_SAVE').default;
|
||||
type ACL_SETUSER = typeof import('./ACL_SETUSER').default;
|
||||
type ACL_USERS = typeof import('./ACL_USERS').default;
|
||||
type ACL_WHOAMI = typeof import('./ACL_WHOAMI').default;
|
||||
type APPEND = typeof import('./APPEND').default;
|
||||
type ASKING = typeof import('./ASKING').default;
|
||||
type AUTH = typeof import('./AUTH').default;
|
||||
type BGREWRITEAOF = typeof import('./BGREWRITEAOF').default;
|
||||
type BGSAVE = typeof import('./BGSAVE').default;
|
||||
type BITCOUNT = typeof import('./BITCOUNT').default;
|
||||
type BITFIELD_RO = typeof import('./BITFIELD_RO').default;
|
||||
type BITFIELD = typeof import('./BITFIELD').default;
|
||||
type BITOP = typeof import('./BITOP').default;
|
||||
type BITPOS = typeof import('./BITPOS').default;
|
||||
type BLMOVE = typeof import('./BLMOVE').default;
|
||||
type BLMPOP = typeof import('./BLMPOP').default;
|
||||
type BLPOP = typeof import('./BLPOP').default;
|
||||
type BRPOP = typeof import('./BRPOP').default;
|
||||
type BRPOPLPUSH = typeof import('./BRPOPLPUSH').default;
|
||||
type CLIENT_CACHING = typeof import('./CLIENT_CACHING').default;
|
||||
type CLIENT_GETNAME = typeof import('./CLIENT_GETNAME').default;
|
||||
type CLIENT_GETREDIR = typeof import('./CLIENT_GETREDIR').default;
|
||||
type CLIENT_ID = typeof import('./CLIENT_ID').default;
|
||||
type CLIENT_INFO = typeof import('./CLIENT_INFO').default;
|
||||
type CLIENT_KILL = typeof import('./CLIENT_KILL').default;
|
||||
type CLIENT_LIST = typeof import('./CLIENT_LIST').default;
|
||||
type CLIENT_NO_EVICT = typeof import('./CLIENT_NO-EVICT').default;
|
||||
type CLIENT_PAUSE = typeof import('./CLIENT_PAUSE').default;
|
||||
type CLIENT_SETNAME = typeof import('./CLIENT_SETNAME').default;
|
||||
type CLUSTER_ADDSLOTS = typeof import('./CLUSTER_ADDSLOTS').default;
|
||||
type CLUSTER_SLOTS = typeof import('./CLUSTER_SLOTS').default;
|
||||
type CLUSTER_MEET = typeof import('./CLUSTER_MEET').default;
|
||||
type CLUSTER_MYID = typeof import('./CLUSTER_MYID').default;
|
||||
type CLUSTER_REPLICATE = typeof import('./CLUSTER_REPLICATE').default;
|
||||
type COPY = typeof import('./COPY').default;
|
||||
type DBSIZE = typeof DBSIZE;
|
||||
type DECR = typeof import('./DECR').default;
|
||||
type DECRBY = typeof import('./DECRBY').default;
|
||||
type DEL = typeof import('./DEL').default;
|
||||
type DUMP = typeof import('./DUMP').default;
|
||||
type ECHO = typeof import('./ECHO').default;
|
||||
type EVAL_RO = typeof import('./EVAL_RO').default;
|
||||
type EVAL = typeof import('./EVAL').default;
|
||||
type EVALSHA_RO = typeof import('./EVALSHA_RO').default;
|
||||
type EVALSHA = typeof import('./EVALSHA').default;
|
||||
type GEOADD = typeof import('./GEOADD').default;
|
||||
type GEODIST = typeof import('./GEODIST').default;
|
||||
type GEOHASH = typeof import('./GEOHASH').default;
|
||||
type GEOPOS = typeof import('./GEOPOS').default;
|
||||
type GEORADIUS_RO_WITH = typeof import('./GEORADIUS_RO_WITH').default;
|
||||
type GEORADIUS_RO = typeof import('./GEORADIUS_RO').default;
|
||||
type GEORADIUS_STORE = typeof import('./GEORADIUS_STORE').default;
|
||||
type GEORADIUS_WITH = typeof import('./GEORADIUS_WITH').default;
|
||||
type GEORADIUS = typeof import('./GEORADIUS').default;
|
||||
type GEORADIUSBYMEMBER_RO_WITH = typeof import('./GEORADIUSBYMEMBER_RO_WITH').default;
|
||||
type GEORADIUSBYMEMBER_RO = typeof import('./GEORADIUSBYMEMBER_RO').default;
|
||||
type GEORADIUSBYMEMBER_STORE = typeof import('./GEORADIUSBYMEMBER_STORE').default;
|
||||
type GEORADIUSBYMEMBER_WITH = typeof import('./GEORADIUSBYMEMBER_WITH').default;
|
||||
type GEORADIUSBYMEMBER = typeof import('./GEORADIUSBYMEMBER').default;
|
||||
type GEOSEARCH_WITH = typeof import('./GEOSEARCH_WITH').default;
|
||||
type GEOSEARCH = typeof import('./GEOSEARCH').default;
|
||||
type GEOSEARCHSTORE = typeof import('./GEOSEARCHSTORE').default;
|
||||
type GET = typeof import('./GET').default;
|
||||
type GETBIT = typeof import('./GETBIT').default;
|
||||
type GETDEL = typeof import('./GETDEL').default;
|
||||
type GETEX = typeof import('./GETEX').default;
|
||||
type GETRANGE = typeof import('./GETRANGE').default;
|
||||
type GETSET = typeof import('./GETSET').default;
|
||||
type EXISTS = typeof import('./EXISTS').default;
|
||||
type EXPIRE = typeof import('./EXPIRE').default;
|
||||
type EXPIREAT = typeof import('./EXPIREAT').default;
|
||||
type EXPIRETIME = typeof import('./EXPIRETIME').default;
|
||||
type FLUSHALL = typeof import('./FLUSHALL').default;
|
||||
type FLUSHDB = typeof import('./FLUSHDB').default;
|
||||
type FCALL = typeof import('./FCALL').default;
|
||||
type FCALL_RO = typeof import('./FCALL_RO').default;
|
||||
type FUNCTION_DELETE = typeof import('./FUNCTION_DELETE').default;
|
||||
type FUNCTION_DUMP = typeof import('./FUNCTION_DUMP').default;
|
||||
type FUNCTION_FLUSH = typeof import('./FUNCTION_FLUSH').default;
|
||||
type FUNCTION_KILL = typeof import('./FUNCTION_KILL').default;
|
||||
type FUNCTION_LIST_WITHCODE = typeof import('./FUNCTION_LIST_WITHCODE').default;
|
||||
type FUNCTION_LIST = typeof import('./FUNCTION_LIST').default;
|
||||
type FUNCTION_LOAD = typeof import('./FUNCTION_LOAD').default;
|
||||
// type FUNCTION_RESTORE = typeof import('./FUNCTION_RESTORE').default;
|
||||
// type FUNCTION_STATS = typeof import('./FUNCTION_STATS').default;
|
||||
type HDEL = typeof import('./HDEL').default;
|
||||
type HELLO = typeof import('./HELLO').default;
|
||||
type HEXISTS = typeof import('./HEXISTS').default;
|
||||
type HGET = typeof import('./HGET').default;
|
||||
type HGETALL = typeof import('./HGETALL').default;
|
||||
type HINCRBY = typeof import('./HINCRBY').default;
|
||||
type HINCRBYFLOAT = typeof import('./HINCRBYFLOAT').default;
|
||||
type HKEYS = typeof import('./HKEYS').default;
|
||||
type HLEN = typeof import('./HLEN').default;
|
||||
type HMGET = typeof import('./HMGET').default;
|
||||
type HRANDFIELD_COUNT_WITHVALUES = typeof import('./HRANDFIELD_COUNT_WITHVALUES').default;
|
||||
type HRANDFIELD_COUNT = typeof import('./HRANDFIELD_COUNT').default;
|
||||
type HRANDFIELD = typeof import('./HRANDFIELD').default;
|
||||
type HSCAN = typeof import('./HSCAN').default;
|
||||
type HSET = typeof import('./HSET').default;
|
||||
type HSETNX = typeof import('./HSETNX').default;
|
||||
type HSTRLEN = typeof import('./HSTRLEN').default;
|
||||
type HVALS = typeof import('./HVALS').default;
|
||||
type INCR = typeof import('./INCR').default;
|
||||
type INCRBY = typeof import('./INCRBY').default;
|
||||
type INCRBYFLOAT = typeof import('./INCRBYFLOAT').default;
|
||||
type INFO = typeof import('./INFO').default;
|
||||
type KEYS = typeof import('./KEYS').default;
|
||||
type LASTSAVE = typeof import('./LASTSAVE').default;
|
||||
type LCS_IDX_WITHMATCHLEN = typeof import('./LCS_IDX_WITHMATCHLEN').default;
|
||||
type LCS_IDX = typeof import('./LCS_IDX').default;
|
||||
type LCS_LEN = typeof import('./LCS_LEN').default;
|
||||
type LCS = typeof import('./LCS').default;
|
||||
type LINDEX = typeof import('./LINDEX').default;
|
||||
type LINSERT = typeof import('./LINSERT').default;
|
||||
type LLEN = typeof import('./LLEN').default;
|
||||
type LMOVE = typeof import('./LMOVE').default;
|
||||
type LMPOP = typeof import('./LMPOP').default;
|
||||
type LOLWUT = typeof import('./LOLWUT').default;
|
||||
type LPOP_COUNT = typeof import('./LPOP_COUNT').default;
|
||||
type LPOP = typeof import('./LPOP').default;
|
||||
type LPOS_COUNT = typeof import('./LPOS_COUNT').default;
|
||||
type LPOS = typeof import('./LPOS').default;
|
||||
type LPUSH = typeof import('./LPUSH').default;
|
||||
type LPUSHX = typeof import('./LPUSHX').default;
|
||||
type LRANGE = typeof import('./LRANGE').default;
|
||||
type LREM = typeof import('./LREM').default;
|
||||
type LSET = typeof import('./LSET').default;
|
||||
type LTRIM = typeof import('./LTRIM').default;
|
||||
type MEMORY_DOCTOR = typeof import('./MEMORY_DOCTOR').default;
|
||||
type MEMORY_MALLOC_STATS = typeof import('./MEMORY_MALLOC-STATS').default;
|
||||
type MEMORY_PURGE = typeof import('./MEMORY_PURGE').default;
|
||||
// type MEMORY_STATS = typeof import('./MEMORY_STATS').default;
|
||||
type MEMORY_USAGE = typeof import('./MEMORY_USAGE').default;
|
||||
type MGET = typeof import('./MGET').default;
|
||||
type MODULE_LIST = typeof import('./MODULE_LIST').default;
|
||||
type MODULE_LOAD = typeof import('./MODULE_LOAD').default;
|
||||
type MODULE_UNLOAD = typeof import('./MODULE_UNLOAD').default;
|
||||
type MOVE = typeof import('./MOVE').default;
|
||||
type MSET = typeof import('./MSET').default;
|
||||
type MSETNX = typeof import('./MSETNX').default;
|
||||
type OBJECT_ENCODING = typeof import('./OBJECT_ENCODING').default;
|
||||
type OBJECT_FREQ = typeof import('./OBJECT_FREQ').default;
|
||||
type OBJECT_IDLETIME = typeof import('./OBJECT_IDLETIME').default;
|
||||
type OBJECT_REFCOUNT = typeof import('./OBJECT_REFCOUNT').default;
|
||||
type PERSIST = typeof import('./PERSIST').default;
|
||||
type PEXPIRE = typeof import('./PEXPIRE').default;
|
||||
type PEXPIREAT = typeof import('./PEXPIREAT').default;
|
||||
type PEXPIRETIME = typeof import('./PEXPIRETIME').default;
|
||||
type PFADD = typeof import('./PFADD').default;
|
||||
type PFCOUNT = typeof import('./PFCOUNT').default;
|
||||
type PFMERGE = typeof import('./PFMERGE').default;
|
||||
type PING = typeof import('./PING').default;
|
||||
type PSETEX = typeof import('./PSETEX').default;
|
||||
type PTTL = typeof import('./PTTL').default;
|
||||
type PUBLISH = typeof import('./PUBLISH').default;
|
||||
type PUBSUB_CHANNELS = typeof import('./PUBSUB_CHANNELS').default;
|
||||
type PUBSUB_NUMPAT = typeof import('./PUBSUB_NUMPAT').default;
|
||||
type PUBSUB_NUMSUB = typeof import('./PUBSUB_NUMSUB').default;
|
||||
type PUBSUB_SHARDCHANNELS = typeof import('./PUBSUB_SHARDCHANNELS').default;
|
||||
type RANDOMKEY = typeof import('./RANDOMKEY').default;
|
||||
type READONLY = typeof import('./READONLY').default;
|
||||
type RENAME = typeof import('./RENAME').default;
|
||||
type RENAMENX = typeof import('./RENAMENX').default;
|
||||
type RPOP_COUNT = typeof import('./RPOP_COUNT').default;
|
||||
type RPOP = typeof import('./RPOP').default;
|
||||
type RPOPLPUSH = typeof import('./RPOPLPUSH').default;
|
||||
type RPUSH = typeof import('./RPUSH').default;
|
||||
type RPUSHX = typeof import('./RPUSHX').default;
|
||||
type SADD = typeof import('./SADD').default;
|
||||
type SCAN = typeof import('./SCAN').default;
|
||||
type SCARD = typeof import('./SCARD').default;
|
||||
type SCRIPT_DEBUG = typeof import('./SCRIPT_DEBUG').default;
|
||||
type SCRIPT_EXISTS = typeof import('./SCRIPT_EXISTS').default;
|
||||
type SCRIPT_FLUSH = typeof import('./SCRIPT_FLUSH').default;
|
||||
type SCRIPT_KILL = typeof import('./SCRIPT_KILL').default;
|
||||
type SCRIPT_LOAD = typeof import('./SCRIPT_LOAD').default;
|
||||
type SDIFF = typeof import('./SDIFF').default;
|
||||
type SDIFFSTORE = typeof import('./SDIFFSTORE').default;
|
||||
type SET = typeof import('./SET').default;
|
||||
type SETBIT = typeof import('./SETBIT').default;
|
||||
type SETEX = typeof import('./SETEX').default;
|
||||
type SETNX = typeof import('./SETNX').default;
|
||||
type SETRANGE = typeof import('./SETRANGE').default;
|
||||
type SINTER = typeof import('./SINTER').default;
|
||||
type SINTERCARD = typeof import('./SINTERCARD').default;
|
||||
type SINTERSTORE = typeof import('./SINTERSTORE').default;
|
||||
type SISMEMBER = typeof import('./SISMEMBER').default;
|
||||
type SMEMBERS = typeof import('./SMEMBERS').default;
|
||||
type SMISMEMBER = typeof import('./SMISMEMBER').default;
|
||||
type SMOVE = typeof import('./SMOVE').default;
|
||||
type SORT_RO = typeof import('./SORT_RO').default;
|
||||
type SORT_STORE = typeof import('./SORT_STORE').default;
|
||||
type SORT = typeof import('./SORT').default;
|
||||
type SPOP_COUNT = typeof import('./SPOP_COUNT').default;
|
||||
type SPOP = typeof import('./SPOP').default;
|
||||
type SPUBLISH = typeof import('./SPUBLISH').default;
|
||||
type SRANDMEMBER_COUNT = typeof import('./SRANDMEMBER_COUNT').default;
|
||||
type SRANDMEMBER = typeof import('./SRANDMEMBER').default;
|
||||
type SREM = typeof import('./SREM').default;
|
||||
type SSCAN = typeof import('./SSCAN').default;
|
||||
type STRLEN = typeof import('./STRLEN').default;
|
||||
type SUNION = typeof import('./SUNION').default;
|
||||
type SUNIONSTORE = typeof import('./SUNIONSTORE').default;
|
||||
type TOUCH = typeof import('./TOUCH').default;
|
||||
type TTL = typeof import('./TTL').default;
|
||||
type TYPE = typeof import('./TYPE').default;
|
||||
type UNLINK = typeof import('./UNLINK').default;
|
||||
type UNWATCH = typeof import('./UNWATCH').default;
|
||||
type WAIT = typeof import('./WAIT').default;
|
||||
type WATCH = typeof import('./WATCH').default;
|
||||
type XACK = typeof import('./XACK').default;
|
||||
type XADD_NOMKSTREAM = typeof import('./XADD_NOMKSTREAM').default;
|
||||
type XADD = typeof import('./XADD').default;
|
||||
type XDEL = typeof import('./XDEL').default;
|
||||
type XSETID = typeof import('./XSETID').default;
|
||||
type XTRIM = typeof import('./XTRIM').default;
|
||||
type XLEN = typeof import('./XLEN').default;
|
||||
type ZADD_INCR = typeof import('./ZADD_INCR').default;
|
||||
type ZADD = typeof import('./ZADD').default;
|
||||
type ZCARD = typeof import('./ZCARD').default;
|
||||
type ZCOUNT = typeof import('./ZCOUNT').default;
|
||||
type ZDIFF_WITHSCORES = typeof import('./ZDIFF_WITHSCORES').default;
|
||||
type ZDIFF = typeof import('./ZDIFF').default;
|
||||
type ZDIFFSTORE = typeof import('./ZDIFFSTORE').default;
|
||||
type ZINCRBY = typeof import('./ZINCRBY').default;
|
||||
type ZINTER_WITHSCORES = typeof import('./ZINTER_WITHSCORES').default;
|
||||
type ZINTER = typeof import('./ZINTER').default;
|
||||
type ZINTERCARD = typeof import('./ZINTERCARD').default;
|
||||
type ZINTERSTORE = typeof import('./ZINTERSTORE').default;
|
||||
type ZLEXCOUNT = typeof import('./ZLEXCOUNT').default;
|
||||
type ZMSCORE = typeof import('./ZMSCORE').default;
|
||||
type ZRANDMEMBER_COUNT_WITHSCORES = typeof import('./ZRANDMEMBER_COUNT_WITHSCORES').default;
|
||||
type ZRANDMEMBER_COUNT = typeof import('./ZRANDMEMBER_COUNT').default;
|
||||
type ZRANDMEMBER = typeof import('./ZRANDMEMBER').default;
|
||||
type ZRANGE = typeof import('./ZRANGE').default;
|
||||
type ZRANGEBYLEX = typeof import('./ZRANGEBYLEX').default;
|
||||
type ZRANGEBYSCORE_WITHSCORES = typeof import('./ZRANGEBYSCORE_WITHSCORES').default;
|
||||
type ZRANGEBYSCORE = typeof import('./ZRANGEBYSCORE').default;
|
||||
type ZREMRANGEBYSCORE = typeof import('./ZREMRANGEBYSCORE').default;
|
||||
type ZRANK = typeof import('./ZRANK').default;
|
||||
type ZREM = typeof import('./ZREM').default;
|
||||
type ZREMRANGEBYLEX = typeof import('./ZREMRANGEBYLEX').default;
|
||||
type ZREMRANGEBYRANK = typeof import('./ZREMRANGEBYRANK').default;
|
||||
type ZREVRANK = typeof import('./ZREVRANK').default;
|
||||
type ZSCAN = typeof import('./ZSCAN').default;
|
||||
type ZSCORE = typeof import('./ZSCORE').default;
|
||||
type ZUNION_WITHSCORES = typeof import('./ZUNION_WITHSCORES').default;
|
||||
type ZUNION = typeof import('./ZUNION').default;
|
||||
type ZUNIONSTORE = typeof import('./ZUNIONSTORE').default;
|
||||
|
||||
type Commands = {
|
||||
ACL_CAT: ACL_CAT;
|
||||
aclCat: ACL_CAT;
|
||||
ACL_DRYRUN: ACL_DRYRUN;
|
||||
aclDryRun: ACL_DRYRUN;
|
||||
ACL_GENPASS: ACL_GENPASS;
|
||||
aclGenPass: ACL_GENPASS;
|
||||
ACL_GETUSER: ACL_GETUSER;
|
||||
aclGetUser: ACL_GETUSER;
|
||||
ACL_LIST: ACL_LIST;
|
||||
aclList: ACL_LIST;
|
||||
ACL_LOAD: ACL_LOAD;
|
||||
aclLoad: ACL_LOAD;
|
||||
ACL_LOG_RESET: ACL_LOG_RESET;
|
||||
aclLogReset: ACL_LOG_RESET;
|
||||
ACL_LOG: ACL_LOG;
|
||||
aclLog: ACL_LOG;
|
||||
ACL_SAVE: ACL_SAVE;
|
||||
aclSave: ACL_SAVE;
|
||||
ACL_SETUSER: ACL_SETUSER;
|
||||
aclSetUser: ACL_SETUSER;
|
||||
ACL_USERS: ACL_USERS;
|
||||
aclUsers: ACL_USERS;
|
||||
ACL_WHOAMI: ACL_WHOAMI;
|
||||
aclWhoAmI: ACL_WHOAMI;
|
||||
APPEND: APPEND;
|
||||
append: APPEND;
|
||||
ASKING: ASKING;
|
||||
asking: ASKING;
|
||||
AUTH: AUTH;
|
||||
auth: AUTH;
|
||||
BGREWRITEAOF: BGREWRITEAOF;
|
||||
bgRewriteAof: BGREWRITEAOF;
|
||||
BGSAVE: BGSAVE;
|
||||
bgSave: BGSAVE;
|
||||
BITCOUNT: BITCOUNT;
|
||||
bitCount: BITCOUNT;
|
||||
BITFIELD_RO: BITFIELD_RO;
|
||||
bitFieldRo: BITFIELD_RO;
|
||||
BITFIELD: BITFIELD;
|
||||
bitField: BITFIELD;
|
||||
BITOP: BITOP;
|
||||
bitOp: BITOP;
|
||||
BITPOS: BITPOS;
|
||||
bitPos: BITPOS;
|
||||
BLMOVE: BLMOVE;
|
||||
blMove: BLMOVE;
|
||||
BLMPOP: BLMPOP;
|
||||
blmPop: BLMPOP;
|
||||
BLPOP: BLPOP;
|
||||
blPop: BLPOP;
|
||||
BRPOP: BRPOP;
|
||||
brPop: BRPOP;
|
||||
BRPOPLPUSH: BRPOPLPUSH;
|
||||
brPopLPush: BRPOPLPUSH;
|
||||
CLIENT_CACHING: CLIENT_CACHING;
|
||||
clientCaching: CLIENT_CACHING;
|
||||
CLIENT_GETNAME: CLIENT_GETNAME;
|
||||
clientGetName: CLIENT_GETNAME;
|
||||
CLIENT_GETREDIR: CLIENT_GETREDIR;
|
||||
clientGetRedir: CLIENT_GETREDIR;
|
||||
CLIENT_ID: CLIENT_ID;
|
||||
clientId: CLIENT_ID;
|
||||
CLIENT_INFO: CLIENT_INFO;
|
||||
clientInfo: CLIENT_INFO;
|
||||
CLIENT_KILL: CLIENT_KILL;
|
||||
clientKill: CLIENT_KILL;
|
||||
CLIENT_LIST: CLIENT_LIST;
|
||||
clientList: CLIENT_LIST;
|
||||
'CLIENT_NO-EVICT': CLIENT_NO_EVICT;
|
||||
clientNoEvict: CLIENT_NO_EVICT;
|
||||
CLIENT_PAUSE: CLIENT_PAUSE;
|
||||
clientPause: CLIENT_PAUSE;
|
||||
CLIENT_SETNAME: CLIENT_SETNAME;
|
||||
clientSetName: CLIENT_SETNAME;
|
||||
CLUSTER_ADDSLOTS: CLUSTER_ADDSLOTS;
|
||||
clusterAddSlots: CLUSTER_ADDSLOTS;
|
||||
CLUSTER_SLOTS: CLUSTER_SLOTS;
|
||||
clusterSlots: CLUSTER_SLOTS;
|
||||
CLUSTER_MEET: CLUSTER_MEET;
|
||||
clusterMeet: CLUSTER_MEET;
|
||||
CLUSTER_MYID: CLUSTER_MYID;
|
||||
clusterMyId: CLUSTER_MYID;
|
||||
CLUSTER_REPLICATE: CLUSTER_REPLICATE;
|
||||
clusterReplicate: CLUSTER_REPLICATE;
|
||||
COPY: COPY;
|
||||
copy: COPY;
|
||||
DBSIZE: DBSIZE;
|
||||
dbSize: DBSIZE;
|
||||
DECR: DECR;
|
||||
decr: DECR;
|
||||
DECRBY: DECRBY;
|
||||
decrBy: DECRBY;
|
||||
DEL: DEL;
|
||||
del: DEL;
|
||||
DUMP: DUMP;
|
||||
dump: DUMP;
|
||||
ECHO: ECHO;
|
||||
echo: ECHO;
|
||||
EVAL_RO: EVAL_RO;
|
||||
evalRo: EVAL_RO;
|
||||
EVAL: EVAL;
|
||||
eval: EVAL;
|
||||
EVALSHA_RO: EVALSHA_RO;
|
||||
evalShaRo: EVALSHA_RO;
|
||||
EVALSHA: EVALSHA;
|
||||
evalSha: EVALSHA;
|
||||
EXISTS: EXISTS;
|
||||
exists: EXISTS;
|
||||
EXPIRE: EXPIRE;
|
||||
expire: EXPIRE;
|
||||
EXPIREAT: EXPIREAT;
|
||||
expireAt: EXPIREAT;
|
||||
EXPIRETIME: EXPIRETIME;
|
||||
expireTime: EXPIRETIME;
|
||||
FLUSHALL: FLUSHALL;
|
||||
flushAll: FLUSHALL;
|
||||
FLUSHDB: FLUSHDB;
|
||||
flushDb: FLUSHDB;
|
||||
FCALL: FCALL;
|
||||
fCall: FCALL;
|
||||
FCALL_RO: FCALL_RO;
|
||||
fCallRo: FCALL_RO;
|
||||
FUNCTION_DELETE: FUNCTION_DELETE;
|
||||
functionDelete: FUNCTION_DELETE;
|
||||
FUNCTION_DUMP: FUNCTION_DUMP;
|
||||
functionDump: FUNCTION_DUMP;
|
||||
FUNCTION_FLUSH: FUNCTION_FLUSH;
|
||||
functionFlush: FUNCTION_FLUSH;
|
||||
FUNCTION_KILL: FUNCTION_KILL;
|
||||
functionKill: FUNCTION_KILL;
|
||||
FUNCTION_LIST_WITHCODE: FUNCTION_LIST_WITHCODE;
|
||||
functionListWithCode: FUNCTION_LIST_WITHCODE;
|
||||
FUNCTION_LIST: FUNCTION_LIST;
|
||||
functionList: FUNCTION_LIST;
|
||||
FUNCTION_LOAD: FUNCTION_LOAD;
|
||||
functionLoad: FUNCTION_LOAD;
|
||||
// FUNCTION_RESTORE: FUNCTION_RESTORE;
|
||||
// functionRestore: FUNCTION_RESTORE;
|
||||
// FUNCTION_STATS: FUNCTION_STATS;
|
||||
// functionStats: FUNCTION_STATS;
|
||||
GEOADD: GEOADD;
|
||||
geoAdd: GEOADD;
|
||||
GEODIST: GEODIST;
|
||||
geoDist: GEODIST;
|
||||
GEOHASH: GEOHASH;
|
||||
geoHash: GEOHASH;
|
||||
GEOPOS: GEOPOS;
|
||||
geoPos: GEOPOS;
|
||||
GEORADIUS_RO_WITH: GEORADIUS_RO_WITH;
|
||||
geoRadiusRoWith: GEORADIUS_RO_WITH;
|
||||
GEORADIUS_RO: GEORADIUS_RO;
|
||||
geoRadiusRo: GEORADIUS_RO
|
||||
GEORADIUS_STORE: GEORADIUS_STORE;
|
||||
geoRadiusStore: GEORADIUS_STORE;
|
||||
GEORADIUS_WITH: GEORADIUS_WITH;
|
||||
geoRadiusWith: GEORADIUS_WITH;
|
||||
GEORADIUS: GEORADIUS;
|
||||
geoRadius: GEORADIUS;
|
||||
GEORADIUSBYMEMBER_RO_WITH: GEORADIUSBYMEMBER_RO_WITH;
|
||||
geoRadiusByMemberRoWith: GEORADIUSBYMEMBER_RO_WITH;
|
||||
GEORADIUSBYMEMBER_RO: GEORADIUSBYMEMBER_RO;
|
||||
geoRadiusByMemberRo: GEORADIUSBYMEMBER_RO;
|
||||
GEORADIUSBYMEMBER_STORE: GEORADIUSBYMEMBER_STORE;
|
||||
geoRadiusByMemberStore: GEORADIUSBYMEMBER_STORE;
|
||||
GEORADIUSBYMEMBER_WITH: GEORADIUSBYMEMBER_WITH;
|
||||
geoRadiusByMemberWith: GEORADIUSBYMEMBER_WITH;
|
||||
GEORADIUSBYMEMBER: GEORADIUSBYMEMBER;
|
||||
geoRadiusByMember: GEORADIUSBYMEMBER;
|
||||
GEOSEARCH_WITH: GEOSEARCH_WITH;
|
||||
geoSearchWith: GEOSEARCH_WITH;
|
||||
GEOSEARCH: GEOSEARCH;
|
||||
geoSearch: GEOSEARCH;
|
||||
GEOSEARCHSTORE: GEOSEARCHSTORE;
|
||||
geoSearchStore: GEOSEARCHSTORE;
|
||||
GET: GET;
|
||||
get: GET;
|
||||
GETBIT: GETBIT;
|
||||
getBit: GETBIT;
|
||||
GETDEL: GETDEL;
|
||||
getDel: GETDEL;
|
||||
GETEX: GETEX;
|
||||
getEx: GETEX;
|
||||
GETRANGE: GETRANGE;
|
||||
getRange: GETRANGE;
|
||||
GETSET: GETSET;
|
||||
getSet: GETSET;
|
||||
HDEL: HDEL;
|
||||
hDel: HDEL;
|
||||
HELLO: HELLO;
|
||||
hello: HELLO;
|
||||
HEXISTS: HEXISTS;
|
||||
hExists: HEXISTS;
|
||||
HGET: HGET;
|
||||
hGet: HGET;
|
||||
HGETALL: HGETALL;
|
||||
hGetAll: HGETALL;
|
||||
HINCRBY: HINCRBY;
|
||||
hIncrBy: HINCRBY;
|
||||
HINCRBYFLOAT: HINCRBYFLOAT;
|
||||
hIncrByFloat: HINCRBYFLOAT;
|
||||
HKEYS: HKEYS;
|
||||
hKeys: HKEYS;
|
||||
HLEN: HLEN;
|
||||
hLen: HLEN;
|
||||
HMGET: HMGET;
|
||||
hmGet: HMGET;
|
||||
HRANDFIELD_COUNT_WITHVALUES: HRANDFIELD_COUNT_WITHVALUES;
|
||||
hRandFieldCountWithValues: HRANDFIELD_COUNT_WITHVALUES;
|
||||
HRANDFIELD_COUNT: HRANDFIELD_COUNT;
|
||||
hRandFieldCount: HRANDFIELD_COUNT;
|
||||
HRANDFIELD: HRANDFIELD;
|
||||
hRandField: HRANDFIELD;
|
||||
HSCAN: HSCAN;
|
||||
hScan: HSCAN;
|
||||
HSET: HSET;
|
||||
hSet: HSET;
|
||||
HSETNX: HSETNX;
|
||||
hSetNX: HSETNX;
|
||||
HSTRLEN: HSTRLEN;
|
||||
hStrLen: HSTRLEN;
|
||||
HVALS: HVALS;
|
||||
hVals: HVALS;
|
||||
INCR: INCR;
|
||||
incr: INCR;
|
||||
INCRBY: INCRBY;
|
||||
incrBy: INCRBY;
|
||||
INCRBYFLOAT: INCRBYFLOAT;
|
||||
incrByFloat: INCRBYFLOAT;
|
||||
INFO: INFO;
|
||||
info: INFO;
|
||||
KEYS: KEYS;
|
||||
keys: KEYS;
|
||||
LASTSAVE: LASTSAVE;
|
||||
lastSave: LASTSAVE;
|
||||
LCS_IDX_WITHMATCHLEN: LCS_IDX_WITHMATCHLEN;
|
||||
lcsIdxWithMatchLen: LCS_IDX_WITHMATCHLEN;
|
||||
LCS_IDX: LCS_IDX;
|
||||
lcsIdx: LCS_IDX;
|
||||
LCS_LEN: LCS_LEN;
|
||||
lcsLen: LCS_LEN;
|
||||
LCS: LCS;
|
||||
lcs: LCS;
|
||||
LINDEX: LINDEX;
|
||||
lIndex: LINDEX;
|
||||
LINSERT: LINSERT;
|
||||
lInsert: LINSERT;
|
||||
LLEN: LLEN;
|
||||
lLen: LLEN;
|
||||
LMOVE: LMOVE;
|
||||
lMove: LMOVE;
|
||||
LMPOP: LMPOP;
|
||||
lmPop: LMPOP;
|
||||
LOLWUT: LOLWUT;
|
||||
LPOP_COUNT: LPOP_COUNT;
|
||||
lPopCount: LPOP_COUNT;
|
||||
LPOP: LPOP;
|
||||
lPop: LPOP;
|
||||
LPOS_COUNT: LPOS_COUNT;
|
||||
lPosCount: LPOS_COUNT;
|
||||
LPOS: LPOS;
|
||||
lPos: LPOS;
|
||||
LPUSH: LPUSH;
|
||||
lPush: LPUSH;
|
||||
LPUSHX: LPUSHX;
|
||||
lPushX: LPUSHX;
|
||||
LRANGE: LRANGE;
|
||||
lRange: LRANGE;
|
||||
LREM: LREM;
|
||||
lRem: LREM;
|
||||
LSET: LSET;
|
||||
lSet: LSET;
|
||||
LTRIM: LTRIM;
|
||||
lTrim: LTRIM;
|
||||
MEMORY_DOCTOR: MEMORY_DOCTOR;
|
||||
memoryDoctor: MEMORY_DOCTOR;
|
||||
'MEMORY_MALLOC-STATS': MEMORY_MALLOC_STATS;
|
||||
memoryMallocStats: MEMORY_MALLOC_STATS;
|
||||
MEMORY_PURGE: MEMORY_PURGE;
|
||||
memoryPurge: MEMORY_PURGE;
|
||||
// MEMORY_STATS: MEMORY_STATS;
|
||||
// memoryStats: MEMORY_STATS;
|
||||
MEMORY_USAGE: MEMORY_USAGE;
|
||||
memoryUsage: MEMORY_USAGE;
|
||||
MGET: MGET;
|
||||
mGet: MGET;
|
||||
MODULE_LIST: MODULE_LIST;
|
||||
moduleList: MODULE_LIST;
|
||||
MODULE_LOAD: MODULE_LOAD;
|
||||
moduleLoad: MODULE_LOAD;
|
||||
MODULE_UNLOAD: MODULE_UNLOAD;
|
||||
moduleUnload: MODULE_UNLOAD;
|
||||
MOVE: MOVE;
|
||||
move: MOVE;
|
||||
MSET: MSET;
|
||||
mSet: MSET;
|
||||
MSETNX: MSETNX;
|
||||
mSetNX: MSETNX;
|
||||
OBJECT_ENCODING: OBJECT_ENCODING;
|
||||
objectEncoding: OBJECT_ENCODING;
|
||||
OBJECT_FREQ: OBJECT_FREQ;
|
||||
objectFreq: OBJECT_FREQ;
|
||||
OBJECT_IDLETIME: OBJECT_IDLETIME;
|
||||
objectIdleTime: OBJECT_IDLETIME;
|
||||
OBJECT_REFCOUNT: OBJECT_REFCOUNT
|
||||
objectRefCount: OBJECT_REFCOUNT;
|
||||
PERSIST: PERSIST;
|
||||
persist: PERSIST;
|
||||
PEXPIRE: PEXPIRE;
|
||||
pExpire: PEXPIRE;
|
||||
PEXPIREAT: PEXPIREAT;
|
||||
pExpireAt: PEXPIREAT;
|
||||
PEXPIRETIME: PEXPIRETIME;
|
||||
pExpireTime: PEXPIRETIME;
|
||||
PFADD: PFADD;
|
||||
pfAdd: PFADD;
|
||||
PFCOUNT: PFCOUNT;
|
||||
pfCount: PFCOUNT;
|
||||
PFMERGE: PFMERGE;
|
||||
pfMerge: PFMERGE;
|
||||
PING: PING;
|
||||
/**
|
||||
* ping jsdoc
|
||||
*/
|
||||
ping: PING;
|
||||
PSETEX: PSETEX;
|
||||
pSetEx: PSETEX;
|
||||
PTTL: PTTL;
|
||||
pTTL: PTTL;
|
||||
PUBLISH: PUBLISH;
|
||||
publish: PUBLISH;
|
||||
PUBSUB_CHANNELS: PUBSUB_CHANNELS;
|
||||
pubSubChannels: PUBSUB_CHANNELS;
|
||||
PUBSUB_NUMPAT: PUBSUB_NUMPAT;
|
||||
pubSubNumPat: PUBSUB_NUMPAT;
|
||||
PUBSUB_NUMSUB: PUBSUB_NUMSUB;
|
||||
pubSubNumSub: PUBSUB_NUMSUB;
|
||||
PUBSUB_SHARDCHANNELS: PUBSUB_SHARDCHANNELS;
|
||||
pubSubShardChannels: PUBSUB_SHARDCHANNELS;
|
||||
RANDOMKEY: RANDOMKEY;
|
||||
randomKey: RANDOMKEY;
|
||||
READONLY: READONLY;
|
||||
readonly: READONLY;
|
||||
RENAME: RENAME;
|
||||
rename: RENAME;
|
||||
RENAMENX: RENAMENX;
|
||||
renameNX: RENAMENX;
|
||||
RPOP_COUNT: RPOP_COUNT;
|
||||
rPopCount: RPOP_COUNT;
|
||||
RPOP: RPOP;
|
||||
rPop: RPOP;
|
||||
RPOPLPUSH: RPOPLPUSH;
|
||||
rPopLPush: RPOPLPUSH;
|
||||
RPUSH: RPUSH;
|
||||
rPush: RPUSH;
|
||||
RPUSHX: RPUSHX;
|
||||
rPushX: RPUSHX;
|
||||
SADD: SADD;
|
||||
sAdd: SADD;
|
||||
SCAN: SCAN;
|
||||
scan: SCAN;
|
||||
SCARD: SCARD;
|
||||
sCard: SCARD;
|
||||
SCRIPT_DEBUG: SCRIPT_DEBUG;
|
||||
scriptDebug: SCRIPT_DEBUG;
|
||||
SCRIPT_EXISTS: SCRIPT_EXISTS;
|
||||
scriptExists: SCRIPT_EXISTS;
|
||||
SCRIPT_FLUSH: SCRIPT_FLUSH;
|
||||
scriptFlush: SCRIPT_FLUSH;
|
||||
SCRIPT_KILL: SCRIPT_KILL;
|
||||
scriptKill: SCRIPT_KILL;
|
||||
SCRIPT_LOAD: SCRIPT_LOAD;
|
||||
scriptLoad: SCRIPT_LOAD;
|
||||
SDIFF: SDIFF;
|
||||
sDiff: SDIFF;
|
||||
SDIFFSTORE: SDIFFSTORE;
|
||||
sDiffStore: SDIFFSTORE;
|
||||
SET: SET;
|
||||
set: SET;
|
||||
SETBIT: SETBIT;
|
||||
setBit: SETBIT;
|
||||
SETEX: SETEX;
|
||||
setEx: SETEX;
|
||||
SETNX: SETNX;
|
||||
setNX: SETNX;
|
||||
SETRANGE: SETRANGE;
|
||||
setRange: SETRANGE;
|
||||
SINTER: SINTER;
|
||||
sInter: SINTER;
|
||||
SINTERCARD: SINTERCARD;
|
||||
sInterCard: SINTERCARD;
|
||||
SINTERSTORE: SINTERSTORE;
|
||||
sInterStore: SINTERSTORE;
|
||||
SISMEMBER: SISMEMBER;
|
||||
sIsMember: SISMEMBER;
|
||||
SMEMBERS: SMEMBERS;
|
||||
sMembers: SMEMBERS;
|
||||
SMISMEMBER: SMISMEMBER;
|
||||
smIsMember: SMISMEMBER;
|
||||
SMOVE: SMOVE;
|
||||
sMove: SMOVE;
|
||||
SORT_RO: SORT_RO;
|
||||
sortRo: SORT_RO;
|
||||
SORT_STORE: SORT_STORE;
|
||||
sortStore: SORT_STORE;
|
||||
SORT: SORT;
|
||||
sort: SORT;
|
||||
SPOP_COUNT: SPOP_COUNT;
|
||||
sPopCount: SPOP_COUNT;
|
||||
SPOP: SPOP;
|
||||
sPop: SPOP;
|
||||
SPUBLISH: SPUBLISH;
|
||||
sPublish: SPUBLISH;
|
||||
SRANDMEMBER_COUNT: SRANDMEMBER_COUNT;
|
||||
sRandMemberCount: SRANDMEMBER_COUNT;
|
||||
SRANDMEMBER: SRANDMEMBER;
|
||||
sRandMember: SRANDMEMBER;
|
||||
SREM: SREM;
|
||||
sRem: SREM;
|
||||
SSCAN: SSCAN;
|
||||
sScan: SSCAN;
|
||||
STRLEN: STRLEN;
|
||||
strLen: STRLEN;
|
||||
SUNION: SUNION;
|
||||
sUnion: SUNION;
|
||||
SUNIONSTORE: SUNIONSTORE;
|
||||
sUnionStore: SUNIONSTORE;
|
||||
TOUCH: TOUCH;
|
||||
touch: TOUCH;
|
||||
TTL: TTL;
|
||||
ttl: TTL;
|
||||
TYPE: TYPE;
|
||||
type: TYPE;
|
||||
UNLINK: UNLINK;
|
||||
unlink: UNLINK;
|
||||
UNWATCH: UNWATCH;
|
||||
unwatch: UNWATCH;
|
||||
WAIT: WAIT;
|
||||
wait: WAIT;
|
||||
WATCH: WATCH;
|
||||
watch: WATCH;
|
||||
XACK: XACK;
|
||||
xAck: XACK;
|
||||
XADD_NOMKSTREAM: XADD_NOMKSTREAM;
|
||||
xAddNoMkStream: XADD_NOMKSTREAM;
|
||||
XADD: XADD;
|
||||
xAdd: XADD;
|
||||
XDEL: XDEL;
|
||||
xDel: XDEL;
|
||||
XSETID: XSETID;
|
||||
xSetId: XSETID;
|
||||
XTRIM: XTRIM;
|
||||
xTrim: XTRIM;
|
||||
XLEN: XLEN;
|
||||
xLen: XLEN;
|
||||
ZADD_INCR: ZADD_INCR;
|
||||
zAddIncr: ZADD_INCR;
|
||||
ZADD: ZADD;
|
||||
zAdd: ZADD;
|
||||
ZCARD: ZCARD;
|
||||
zCard: ZCARD;
|
||||
ZCOUNT: ZCOUNT;
|
||||
zCount: ZCOUNT;
|
||||
ZDIFF_WITHSCORES: ZDIFF_WITHSCORES;
|
||||
zDiffWithScores: ZDIFF_WITHSCORES;
|
||||
ZDIFF: ZDIFF;
|
||||
zDiff: ZDIFF;
|
||||
ZDIFFSTORE: ZDIFFSTORE;
|
||||
zDiffStore: ZDIFFSTORE;
|
||||
ZINCRBY: ZINCRBY;
|
||||
zIncrBy: ZINCRBY;
|
||||
ZINTER_WITHSCORES: ZINTER_WITHSCORES;
|
||||
zInterWithScores: ZINTER_WITHSCORES;
|
||||
ZINTER: ZINTER;
|
||||
zInter: ZINTER;
|
||||
ZINTERCARD: ZINTERCARD;
|
||||
zInterCard: ZINTERCARD;
|
||||
ZINTERSTORE: ZINTERSTORE;
|
||||
zInterStore: ZINTERSTORE;
|
||||
ZLEXCOUNT: ZLEXCOUNT;
|
||||
zLexCount: ZLEXCOUNT;
|
||||
ZMSCORE: ZMSCORE;
|
||||
zmScore: ZMSCORE;
|
||||
ZRANDMEMBER_COUNT_WITHSCORES: ZRANDMEMBER_COUNT_WITHSCORES;
|
||||
zRandMemberCountWithScores: ZRANDMEMBER_COUNT_WITHSCORES;
|
||||
ZRANDMEMBER_COUNT: ZRANDMEMBER_COUNT;
|
||||
zRandMemberCount: ZRANDMEMBER_COUNT;
|
||||
ZRANDMEMBER: ZRANDMEMBER;
|
||||
zRandMember: ZRANDMEMBER;
|
||||
ZRANGE: ZRANGE;
|
||||
zRange: ZRANGE;
|
||||
ZRANGEBYLEX: ZRANGEBYLEX;
|
||||
zRangeByLex: ZRANGEBYLEX;
|
||||
ZRANGEBYSCORE_WITHSCORES: ZRANGEBYSCORE_WITHSCORES;
|
||||
zRangeByScoreWithScores: ZRANGEBYSCORE_WITHSCORES;
|
||||
ZRANGEBYSCORE: ZRANGEBYSCORE;
|
||||
zRangeByScore: ZRANGEBYSCORE;
|
||||
ZRANK: ZRANK;
|
||||
zRank: ZRANK;
|
||||
ZREM: ZREM;
|
||||
zRem: ZREM;
|
||||
ZREMRANGEBYLEX: ZREMRANGEBYLEX;
|
||||
zRemRangeByLex: ZREMRANGEBYLEX;
|
||||
ZREMRANGEBYRANK: ZREMRANGEBYRANK;
|
||||
zRemRangeByRank: ZREMRANGEBYRANK;
|
||||
ZREMRANGEBYSCORE: ZREMRANGEBYSCORE;
|
||||
zRemRangeByScore: ZREMRANGEBYSCORE;
|
||||
ZREVRANK: ZREVRANK;
|
||||
zRevRank: ZREVRANK;
|
||||
ZSCAN: ZSCAN;
|
||||
zScan: ZSCAN;
|
||||
ZSCORE: ZSCORE;
|
||||
zScore: ZSCORE;
|
||||
ZUNION_WITHSCORES: ZUNION_WITHSCORES;
|
||||
zUnionWithScores: ZUNION_WITHSCORES;
|
||||
ZUNION: ZUNION;
|
||||
zUnion: ZUNION;
|
||||
ZUNIONSTORE: ZUNIONSTORE;
|
||||
zUnionStore: ZUNIONSTORE;
|
||||
};
|
||||
|
||||
export default {
|
||||
ACL_CAT,
|
||||
aclCat: ACL_CAT,
|
||||
@@ -333,6 +1125,8 @@ export default {
|
||||
clusterReplicate: CLUSTER_REPLICATE,
|
||||
COPY,
|
||||
copy: COPY,
|
||||
DBSIZE,
|
||||
dbSize: DBSIZE,
|
||||
DECR,
|
||||
decr: DECR,
|
||||
DECRBY,
|
||||
@@ -363,6 +1157,28 @@ export default {
|
||||
flushAll: FLUSHALL,
|
||||
FLUSHDB,
|
||||
flushDb: FLUSHDB,
|
||||
FCALL,
|
||||
fCall: FCALL,
|
||||
FCALL_RO,
|
||||
fCallRo: FCALL_RO,
|
||||
FUNCTION_DELETE,
|
||||
functionDelete: FUNCTION_DELETE,
|
||||
FUNCTION_DUMP,
|
||||
functionDump: FUNCTION_DUMP,
|
||||
FUNCTION_FLUSH,
|
||||
functionFlush: FUNCTION_FLUSH,
|
||||
FUNCTION_KILL,
|
||||
functionKill: FUNCTION_KILL,
|
||||
FUNCTION_LIST_WITHCODE,
|
||||
functionListWithCode: FUNCTION_LIST_WITHCODE,
|
||||
FUNCTION_LIST,
|
||||
functionList: FUNCTION_LIST,
|
||||
FUNCTION_LOAD,
|
||||
functionLoad: FUNCTION_LOAD,
|
||||
// FUNCTION_RESTORE,
|
||||
// functionRestore: FUNCTION_RESTORE,
|
||||
// FUNCTION_STATS,
|
||||
// functionStats: FUNCTION_STATS,
|
||||
GEOADD,
|
||||
geoAdd: GEOADD,
|
||||
GEODIST,
|
||||
@@ -740,5 +1556,5 @@ export default {
|
||||
ZUNION,
|
||||
zUnion: ZUNION,
|
||||
ZUNIONSTORE,
|
||||
zUnionStore: ZUNIONSTORE,
|
||||
} as const satisfies Record<string, Command>;
|
||||
zUnionStore: ZUNIONSTORE
|
||||
} as const satisfies Record<string, Command> as Commands;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { createConnection } from 'net';
|
||||
import { once } from 'events';
|
||||
import { createClient } from '@redis/client';
|
||||
import { createClient } from '@redis/client/index';
|
||||
import { setTimeout } from 'timers/promises';
|
||||
// import { ClusterSlotsReply } from '@redis/client/dist/lib/commands/CLUSTER_SLOTS';
|
||||
import * as path from 'path';
|
||||
|
@@ -9,7 +9,7 @@ import {
|
||||
createCluster,
|
||||
RedisClusterOptions,
|
||||
RedisClusterType
|
||||
} from '@redis/client';
|
||||
} from '@redis/client/index';
|
||||
import { RedisServerDockerConfig, spawnRedisServer, spawnRedisCluster } from './dockers';
|
||||
import yargs from 'yargs';
|
||||
import { hideBin } from 'yargs/helpers';
|
||||
|
Reference in New Issue
Block a user