You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
wip
This commit is contained in:
@@ -22,32 +22,29 @@ describe('ACL LOG', () => {
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.aclLog', async client => {
|
||||
// make sure to create at least one log
|
||||
await Promise.all([
|
||||
client.aclSetUser('test', 'on +@all'),
|
||||
// make sure to create one log
|
||||
await assert.rejects(
|
||||
client.auth({
|
||||
username: 'test',
|
||||
password: 'test'
|
||||
}),
|
||||
client.auth({
|
||||
username: 'default',
|
||||
password: ''
|
||||
username: 'incorrect',
|
||||
password: 'incorrect'
|
||||
})
|
||||
]);
|
||||
);
|
||||
|
||||
const logs = await client.aclLog();
|
||||
assert.ok(Array.isArray(logs));
|
||||
for (const log of logs) {
|
||||
|
||||
assert.equal(typeof log.count, 'number');
|
||||
assert.equal(typeof log.timestamp, 'number');
|
||||
assert.equal(typeof log.reason, 'string');
|
||||
assert.equal(typeof log.context, 'string');
|
||||
assert.equal(typeof log.object, 'string');
|
||||
assert.equal(typeof log.username, 'string');
|
||||
assert.equal(typeof log.clientId, 'string');
|
||||
assert.equal(typeof log.command, 'string');
|
||||
assert.equal(typeof log.args, 'string');
|
||||
assert.equal(typeof log.key, 'string');
|
||||
assert.equal(typeof log.result, 'number');
|
||||
assert.equal(typeof log.duration, 'number');
|
||||
assert.equal(typeof log['age-seconds'], 'number');
|
||||
assert.equal(typeof log['client-info'], 'string');
|
||||
if (testUtils.isVersionGreaterThan([7, 2])) {
|
||||
assert.equal(typeof log['entry-id'], 'number');
|
||||
assert.equal(typeof log['timestamp-created'], 'number');
|
||||
assert.equal(typeof log['timestamp-last-updated'], 'number');
|
||||
}
|
||||
}
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Resp2Reply } from '../RESP/types';
|
||||
import { DoubleReply, Resp2Reply } from '../RESP/types';
|
||||
import { ArrayReply, BlobStringReply, Command, NumberReply, TuplesToMapReply } from '../RESP/types';
|
||||
|
||||
export type AclLogReply = ArrayReply<TuplesToMapReply<[
|
||||
@@ -7,8 +7,14 @@ export type AclLogReply = ArrayReply<TuplesToMapReply<[
|
||||
[BlobStringReply<'context'>, BlobStringReply],
|
||||
[BlobStringReply<'object'>, BlobStringReply],
|
||||
[BlobStringReply<'username'>, BlobStringReply],
|
||||
[BlobStringReply<'age-seconds'>, BlobStringReply],
|
||||
[BlobStringReply<'client-info'>, BlobStringReply]
|
||||
[BlobStringReply<'age-seconds'>, DoubleReply],
|
||||
[BlobStringReply<'client-info'>, BlobStringReply],
|
||||
/** added in 7.0 */
|
||||
[BlobStringReply<'entry-id'>, NumberReply],
|
||||
/** added in 7.0 */
|
||||
[BlobStringReply<'timestamp-created'>, NumberReply],
|
||||
/** added in 7.0 */
|
||||
[BlobStringReply<'timestamp-last-updated'>, NumberReply]
|
||||
]>>;
|
||||
|
||||
export default {
|
||||
@@ -24,15 +30,18 @@ export default {
|
||||
return args;
|
||||
},
|
||||
transformReply: {
|
||||
2: (reply: Resp2Reply<AclLogReply>) => ({
|
||||
count: Number(reply[1]),
|
||||
reason: reply[3],
|
||||
context: reply[5],
|
||||
object: reply[7],
|
||||
username: reply[9],
|
||||
'age-seconds': Number(reply[11]),
|
||||
'client-info': reply[13]
|
||||
}),
|
||||
2: (reply: Resp2Reply<AclLogReply>) => reply.map(item => ({
|
||||
count: item[1],
|
||||
reason: item[3],
|
||||
context: item[5],
|
||||
object: item[7],
|
||||
username: item[9],
|
||||
'age-seconds': Number(item[11]),
|
||||
'client-info': item[13],
|
||||
'entry-id': item[15],
|
||||
'timestamp-created': item[17],
|
||||
'timestamp-last-updated': item[19]
|
||||
})),
|
||||
3: undefined as unknown as () => AclLogReply
|
||||
}
|
||||
} as const satisfies Command;
|
||||
|
@@ -4,7 +4,7 @@ export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments() {
|
||||
return ['ACL', 'USERS'];
|
||||
return ['ACL', 'WHOAMI'];
|
||||
},
|
||||
transformReply: undefined as unknown as () => BlobStringReply
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,101 +1,101 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './CLIENT_TRACKING';
|
||||
import CLIENT_TRACKING from './CLIENT_TRACKING';
|
||||
|
||||
describe('CLIENT TRACKING', () => {
|
||||
testUtils.isVersionGreaterThanHook([6]);
|
||||
testUtils.isVersionGreaterThanHook([6]);
|
||||
|
||||
describe('transformArguments', () => {
|
||||
describe('true', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(true),
|
||||
['CLIENT', 'TRACKING', 'ON']
|
||||
);
|
||||
});
|
||||
describe('transformArguments', () => {
|
||||
describe('true', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
CLIENT_TRACKING.transformArguments(true),
|
||||
['CLIENT', 'TRACKING', 'ON']
|
||||
);
|
||||
});
|
||||
|
||||
it('with REDIRECT', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(true, {
|
||||
REDIRECT: 1
|
||||
}),
|
||||
['CLIENT', 'TRACKING', 'ON', 'REDIRECT', '1']
|
||||
);
|
||||
});
|
||||
it('with REDIRECT', () => {
|
||||
assert.deepEqual(
|
||||
CLIENT_TRACKING.transformArguments(true, {
|
||||
REDIRECT: 1
|
||||
}),
|
||||
['CLIENT', 'TRACKING', 'ON', 'REDIRECT', '1']
|
||||
);
|
||||
});
|
||||
|
||||
describe('with BCAST', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(true, {
|
||||
BCAST: true
|
||||
}),
|
||||
['CLIENT', 'TRACKING', 'ON', 'BCAST']
|
||||
);
|
||||
});
|
||||
|
||||
describe('with PREFIX', () => {
|
||||
it('string', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(true, {
|
||||
BCAST: true,
|
||||
PREFIX: 'prefix'
|
||||
}),
|
||||
['CLIENT', 'TRACKING', 'ON', 'BCAST', 'PREFIX', 'prefix']
|
||||
);
|
||||
});
|
||||
|
||||
it('array', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(true, {
|
||||
BCAST: true,
|
||||
PREFIX: ['1', '2']
|
||||
}),
|
||||
['CLIENT', 'TRACKING', 'ON', 'BCAST', 'PREFIX', '1', 'PREFIX', '2']
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('with OPTIN', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(true, {
|
||||
OPTIN: true
|
||||
}),
|
||||
['CLIENT', 'TRACKING', 'ON', 'OPTIN']
|
||||
);
|
||||
});
|
||||
|
||||
it('with OPTOUT', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(true, {
|
||||
OPTOUT: true
|
||||
}),
|
||||
['CLIENT', 'TRACKING', 'ON', 'OPTOUT']
|
||||
);
|
||||
});
|
||||
|
||||
it('with NOLOOP', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(true, {
|
||||
NOLOOP: true
|
||||
}),
|
||||
['CLIENT', 'TRACKING', 'ON', 'NOLOOP']
|
||||
);
|
||||
});
|
||||
describe('with BCAST', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
CLIENT_TRACKING.transformArguments(true, {
|
||||
BCAST: true
|
||||
}),
|
||||
['CLIENT', 'TRACKING', 'ON', 'BCAST']
|
||||
);
|
||||
});
|
||||
|
||||
it('false', () => {
|
||||
describe('with PREFIX', () => {
|
||||
it('string', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(false),
|
||||
['CLIENT', 'TRACKING', 'OFF']
|
||||
CLIENT_TRACKING.transformArguments(true, {
|
||||
BCAST: true,
|
||||
PREFIX: 'prefix'
|
||||
}),
|
||||
['CLIENT', 'TRACKING', 'ON', 'BCAST', 'PREFIX', 'prefix']
|
||||
);
|
||||
});
|
||||
|
||||
it('array', () => {
|
||||
assert.deepEqual(
|
||||
CLIENT_TRACKING.transformArguments(true, {
|
||||
BCAST: true,
|
||||
PREFIX: ['1', '2']
|
||||
}),
|
||||
['CLIENT', 'TRACKING', 'ON', 'BCAST', 'PREFIX', '1', 'PREFIX', '2']
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('with OPTIN', () => {
|
||||
assert.deepEqual(
|
||||
CLIENT_TRACKING.transformArguments(true, {
|
||||
OPTIN: true
|
||||
}),
|
||||
['CLIENT', 'TRACKING', 'ON', 'OPTIN']
|
||||
);
|
||||
});
|
||||
|
||||
it('with OPTOUT', () => {
|
||||
assert.deepEqual(
|
||||
CLIENT_TRACKING.transformArguments(true, {
|
||||
OPTOUT: true
|
||||
}),
|
||||
['CLIENT', 'TRACKING', 'ON', 'OPTOUT']
|
||||
);
|
||||
});
|
||||
|
||||
it('with NOLOOP', () => {
|
||||
assert.deepEqual(
|
||||
CLIENT_TRACKING.transformArguments(true, {
|
||||
NOLOOP: true
|
||||
}),
|
||||
['CLIENT', 'TRACKING', 'ON', 'NOLOOP']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.clientTracking', async client => {
|
||||
assert.equal(
|
||||
await client.clientTracking(false),
|
||||
'OK'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
it('false', () => {
|
||||
assert.deepEqual(
|
||||
CLIENT_TRACKING.transformArguments(false),
|
||||
['CLIENT', 'TRACKING', 'OFF']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.clientTracking', async client => {
|
||||
assert.equal(
|
||||
await client.clientTracking(false),
|
||||
'OK'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,83 +1,86 @@
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { RedisArgument, SimpleStringReply, Command } from '../RESP/types';
|
||||
import { RedisVariadicArgument } from './generic-transformers';
|
||||
interface CommonOptions {
|
||||
REDIRECT?: number;
|
||||
NOLOOP?: boolean;
|
||||
}
|
||||
|
||||
// interface CommonOptions {
|
||||
// REDIRECT?: number;
|
||||
// NOLOOP?: boolean;
|
||||
// }
|
||||
interface BroadcastOptions {
|
||||
BCAST?: boolean;
|
||||
PREFIX?: RedisVariadicArgument;
|
||||
}
|
||||
|
||||
// interface BroadcastOptions {
|
||||
// BCAST?: boolean;
|
||||
// PREFIX?: RedisCommandArgument | Array<RedisCommandArgument>;
|
||||
// }
|
||||
interface OptInOptions {
|
||||
OPTIN?: boolean;
|
||||
}
|
||||
|
||||
// interface OptInOptions {
|
||||
// OPTIN?: boolean;
|
||||
// }
|
||||
interface OptOutOptions {
|
||||
OPTOUT?: boolean;
|
||||
}
|
||||
|
||||
// interface OptOutOptions {
|
||||
// OPTOUT?: boolean;
|
||||
// }
|
||||
type ClientTrackingOptions = CommonOptions & (
|
||||
BroadcastOptions |
|
||||
OptInOptions |
|
||||
OptOutOptions
|
||||
);
|
||||
|
||||
// type ClientTrackingOptions = CommonOptions & (
|
||||
// BroadcastOptions |
|
||||
// OptInOptions |
|
||||
// OptOutOptions
|
||||
// );
|
||||
export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments<M extends boolean>(
|
||||
mode: M,
|
||||
options?: M extends true ? ClientTrackingOptions : never
|
||||
) {
|
||||
const args: Array<RedisArgument> = [
|
||||
'CLIENT',
|
||||
'TRACKING',
|
||||
mode ? 'ON' : 'OFF'
|
||||
];
|
||||
|
||||
// export function transformArguments<M extends boolean>(
|
||||
// mode: M,
|
||||
// options?: M extends true ? ClientTrackingOptions : undefined
|
||||
// ): RedisCommandArguments {
|
||||
// const args: RedisCommandArguments = [
|
||||
// 'CLIENT',
|
||||
// 'TRACKING',
|
||||
// mode ? 'ON' : 'OFF'
|
||||
// ];
|
||||
if (mode) {
|
||||
if (options?.REDIRECT) {
|
||||
args.push(
|
||||
'REDIRECT',
|
||||
options.REDIRECT.toString()
|
||||
);
|
||||
}
|
||||
|
||||
// if (mode) {
|
||||
// if (options?.REDIRECT) {
|
||||
// args.push(
|
||||
// 'REDIRECT',
|
||||
// options.REDIRECT.toString()
|
||||
// );
|
||||
// }
|
||||
if (isBroadcast(options)) {
|
||||
args.push('BCAST');
|
||||
|
||||
// if (isBroadcast(options)) {
|
||||
// args.push('BCAST');
|
||||
if (options?.PREFIX) {
|
||||
if (Array.isArray(options.PREFIX)) {
|
||||
for (const prefix of options.PREFIX) {
|
||||
args.push('PREFIX', prefix);
|
||||
}
|
||||
} else {
|
||||
args.push('PREFIX', options.PREFIX);
|
||||
}
|
||||
}
|
||||
} else if (isOptIn(options)) {
|
||||
args.push('OPTIN');
|
||||
} else if (isOptOut(options)) {
|
||||
args.push('OPTOUT');
|
||||
}
|
||||
|
||||
// if (options?.PREFIX) {
|
||||
// if (Array.isArray(options.PREFIX)) {
|
||||
// for (const prefix of options.PREFIX) {
|
||||
// args.push('PREFIX', prefix);
|
||||
// }
|
||||
// } else {
|
||||
// args.push('PREFIX', options.PREFIX);
|
||||
// }
|
||||
// }
|
||||
// } else if (isOptIn(options)) {
|
||||
// args.push('OPTIN');
|
||||
// } else if (isOptOut(options)) {
|
||||
// args.push('OPTOUT');
|
||||
// }
|
||||
if (options?.NOLOOP) {
|
||||
args.push('NOLOOP');
|
||||
}
|
||||
}
|
||||
|
||||
// if (options?.NOLOOP) {
|
||||
// args.push('NOLOOP');
|
||||
// }
|
||||
// }
|
||||
return args;
|
||||
},
|
||||
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
|
||||
} as const satisfies Command;
|
||||
|
||||
// return args;
|
||||
// }
|
||||
function isBroadcast(options?: ClientTrackingOptions): options is BroadcastOptions {
|
||||
return (options as BroadcastOptions)?.BCAST === true;
|
||||
}
|
||||
|
||||
// function isBroadcast(options?: ClientTrackingOptions): options is BroadcastOptions {
|
||||
// return (options as BroadcastOptions)?.BCAST === true;
|
||||
// }
|
||||
function isOptIn(options?: ClientTrackingOptions): options is OptInOptions {
|
||||
return (options as OptInOptions)?.OPTIN === true;
|
||||
}
|
||||
|
||||
// function isOptIn(options?: ClientTrackingOptions): options is OptInOptions {
|
||||
// return (options as OptInOptions)?.OPTIN === true;
|
||||
// }
|
||||
|
||||
// function isOptOut(options?: ClientTrackingOptions): options is OptOutOptions {
|
||||
// return (options as OptOutOptions)?.OPTOUT === true;
|
||||
// }
|
||||
|
||||
// export declare function transformReply(): 'OK' | Buffer;
|
||||
function isOptOut(options?: ClientTrackingOptions): options is OptOutOptions {
|
||||
return (options as OptOutOptions)?.OPTOUT === true;
|
||||
}
|
||||
|
@@ -1,25 +1,26 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './CLIENT_TRACKINGINFO';
|
||||
import CLIENT_TRACKINGINFO from './CLIENT_TRACKINGINFO';
|
||||
import { RESP_TYPES } from '../RESP/decoder';
|
||||
|
||||
describe('CLIENT TRACKINGINFO', () => {
|
||||
testUtils.isVersionGreaterThanHook([6, 2]);
|
||||
testUtils.isVersionGreaterThanHook([6, 2]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['CLIENT', 'TRACKINGINFO']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
CLIENT_TRACKINGINFO.transformArguments(),
|
||||
['CLIENT', 'TRACKINGINFO']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.clientTrackingInfo', async client => {
|
||||
assert.deepEqual(
|
||||
await client.clientTrackingInfo(),
|
||||
{
|
||||
flags: new Set(['off']),
|
||||
redirect: -1,
|
||||
prefixes: []
|
||||
}
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
testUtils.testWithClient('client.clientTrackingInfo', async client => {
|
||||
assert.deepEqual(
|
||||
await client.clientTrackingInfo(),
|
||||
{
|
||||
flags: ['off'],
|
||||
redirect: -1,
|
||||
prefixes: []
|
||||
}
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,28 +1,23 @@
|
||||
// import { RedisCommandArguments } from '.';
|
||||
import { TuplesToMapReply, BlobStringReply, SetReply, NumberReply, ArrayReply, Resp2Reply, Command } from '../RESP/types';
|
||||
|
||||
// export function transformArguments(): RedisCommandArguments {
|
||||
// return ['CLIENT', 'TRACKINGINFO'];
|
||||
// }
|
||||
type TrackingInfo = TuplesToMapReply<[
|
||||
[BlobStringReply<'flags'>, SetReply<BlobStringReply>],
|
||||
[BlobStringReply<'redirect'>, NumberReply],
|
||||
[BlobStringReply<'prefixes'>, ArrayReply<BlobStringReply>]
|
||||
]>;
|
||||
|
||||
// type RawReply = [
|
||||
// 'flags',
|
||||
// Array<string>,
|
||||
// 'redirect',
|
||||
// number,
|
||||
// 'prefixes',
|
||||
// Array<string>
|
||||
// ];
|
||||
|
||||
// interface Reply {
|
||||
// flags: Set<string>;
|
||||
// redirect: number;
|
||||
// prefixes: Array<string>;
|
||||
// }
|
||||
|
||||
// export function transformReply(reply: RawReply): Reply {
|
||||
// return {
|
||||
// flags: new Set(reply[1]),
|
||||
// redirect: reply[3],
|
||||
// prefixes: reply[5]
|
||||
// };
|
||||
// }
|
||||
export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments() {
|
||||
return ['CLIENT', 'TRACKINGINFO'];
|
||||
},
|
||||
transformReply: {
|
||||
2: (reply: Resp2Reply<TrackingInfo>) => ({
|
||||
flags: reply[1],
|
||||
redirect: reply[3],
|
||||
prefixes: reply[5]
|
||||
}),
|
||||
3: undefined as unknown as () => TrackingInfo
|
||||
}
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,21 +1,21 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './CLIENT_UNPAUSE';
|
||||
import CLIENT_UNPAUSE from './CLIENT_UNPAUSE';
|
||||
|
||||
describe('CLIENT UNPAUSE', () => {
|
||||
testUtils.isVersionGreaterThanHook([6, 2]);
|
||||
testUtils.isVersionGreaterThanHook([6, 2]);
|
||||
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['CLIENT', 'UNPAUSE']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
CLIENT_UNPAUSE.transformArguments(),
|
||||
['CLIENT', 'UNPAUSE']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.unpause', async client => {
|
||||
assert.equal(
|
||||
await client.clientUnpause(),
|
||||
'OK'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
testUtils.testWithClient('client.clientUnpause', async client => {
|
||||
assert.equal(
|
||||
await client.clientUnpause(),
|
||||
'OK'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,20 +1,20 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './CLUSTER_ADDSLOTS';
|
||||
import CLUSTER_ADDSLOTS from './CLUSTER_ADDSLOTS';
|
||||
|
||||
describe('CLUSTER ADDSLOTS', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('single', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(0),
|
||||
['CLUSTER', 'ADDSLOTS', '0']
|
||||
);
|
||||
});
|
||||
|
||||
it('multiple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments([0, 1]),
|
||||
['CLUSTER', 'ADDSLOTS', '0', '1']
|
||||
);
|
||||
});
|
||||
describe('transformArguments', () => {
|
||||
it('single', () => {
|
||||
assert.deepEqual(
|
||||
CLUSTER_ADDSLOTS.transformArguments(0),
|
||||
['CLUSTER', 'ADDSLOTS', '0']
|
||||
);
|
||||
});
|
||||
|
||||
it('multiple', () => {
|
||||
assert.deepEqual(
|
||||
CLUSTER_ADDSLOTS.transformArguments([0, 1]),
|
||||
['CLUSTER', 'ADDSLOTS', '0', '1']
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -1,29 +1,32 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './CLUSTER_ADDSLOTSRANGE';
|
||||
import testUtils from '../test-utils';
|
||||
import CLUSTER_ADDSLOTSRANGE from './CLUSTER_ADDSLOTSRANGE';
|
||||
|
||||
describe('CLUSTER ADDSLOTSRANGE', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('single', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments({
|
||||
start: 0,
|
||||
end: 1
|
||||
}),
|
||||
['CLUSTER', 'ADDSLOTSRANGE', '0', '1']
|
||||
);
|
||||
});
|
||||
testUtils.isVersionGreaterThanHook([7, 0]);
|
||||
|
||||
it('multiple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments([{
|
||||
start: 0,
|
||||
end: 1
|
||||
}, {
|
||||
start: 2,
|
||||
end: 3
|
||||
}]),
|
||||
['CLUSTER', 'ADDSLOTSRANGE', '0', '1', '2', '3']
|
||||
);
|
||||
});
|
||||
describe('transformArguments', () => {
|
||||
it('single', () => {
|
||||
assert.deepEqual(
|
||||
CLUSTER_ADDSLOTSRANGE.transformArguments({
|
||||
start: 0,
|
||||
end: 1
|
||||
}),
|
||||
['CLUSTER', 'ADDSLOTSRANGE', '0', '1']
|
||||
);
|
||||
});
|
||||
|
||||
it('multiple', () => {
|
||||
assert.deepEqual(
|
||||
CLUSTER_ADDSLOTSRANGE.transformArguments([{
|
||||
start: 0,
|
||||
end: 1
|
||||
}, {
|
||||
start: 2,
|
||||
end: 3
|
||||
}]),
|
||||
['CLUSTER', 'ADDSLOTSRANGE', '0', '1', '2', '3']
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -1,20 +1,20 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './CLUSTER_BUMPEPOCH';
|
||||
import CLUSTER_BUMPEPOCH from './CLUSTER_BUMPEPOCH';
|
||||
|
||||
describe('CLUSTER BUMPEPOCH', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['CLUSTER', 'BUMPEPOCH']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
CLUSTER_BUMPEPOCH.transformArguments(),
|
||||
['CLUSTER', 'BUMPEPOCH']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithCluster('clusterNode.clusterBumpEpoch', async cluster => {
|
||||
const client = await cluster.nodeClient(cluster.masters[0]);
|
||||
assert.equal(
|
||||
typeof await client.clusterBumpEpoch(),
|
||||
'string'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
testUtils.testWithCluster('clusterNode.clusterBumpEpoch', async cluster => {
|
||||
const client = await cluster.nodeClient(cluster.masters[0]);
|
||||
assert.equal(
|
||||
typeof await client.clusterBumpEpoch(),
|
||||
'string'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,20 +1,20 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './CLUSTER_KEYSLOT';
|
||||
import CLUSTER_KEYSLOT from './CLUSTER_KEYSLOT';
|
||||
|
||||
describe('CLUSTER KEYSLOT', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('key'),
|
||||
['CLUSTER', 'KEYSLOT', 'key']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
CLUSTER_KEYSLOT.transformArguments('key'),
|
||||
['CLUSTER', 'KEYSLOT', 'key']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithCluster('clusterNode.clusterKeySlot', async cluster => {
|
||||
const client = await cluster.nodeClient(cluster.masters[0]);
|
||||
assert.equal(
|
||||
typeof await client.clusterKeySlot('key'),
|
||||
'number'
|
||||
);
|
||||
}, GLOBAL.CLUSTERS.OPEN);
|
||||
testUtils.testWithCluster('clusterNode.clusterKeySlot', async cluster => {
|
||||
const client = await cluster.nodeClient(cluster.masters[0]);
|
||||
assert.equal(
|
||||
typeof await client.clusterKeySlot('key'),
|
||||
'number'
|
||||
);
|
||||
}, GLOBAL.CLUSTERS.OPEN);
|
||||
});
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './CLUSTER_MEET';
|
||||
import CLUSTER_MEET from './CLUSTER_MEET';
|
||||
|
||||
describe('CLUSTER MEET', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('127.0.0.1', 6379),
|
||||
['CLUSTER', 'MEET', '127.0.0.1', '6379']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
CLUSTER_MEET.transformArguments('127.0.0.1', 6379),
|
||||
['CLUSTER', 'MEET', '127.0.0.1', '6379']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@@ -4,5 +4,5 @@ export default {
|
||||
transformArguments(host: string, port: number) {
|
||||
return ['CLUSTER', 'MEET', host, port.toString()];
|
||||
},
|
||||
transformReply: undefined as unknown as () => SimpleStringReply
|
||||
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './CLUSTER_REPLICATE';
|
||||
import CLUSTER_REPLICATE from './CLUSTER_REPLICATE';
|
||||
|
||||
describe('CLUSTER REPLICATE', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('0'),
|
||||
['CLUSTER', 'REPLICATE', '0']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
CLUSTER_REPLICATE.transformArguments('0'),
|
||||
['CLUSTER', 'REPLICATE', '0']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@@ -1,20 +1,22 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './CLUSTER_RESET';
|
||||
import CLUSTER_RESET from './CLUSTER_RESET';
|
||||
|
||||
describe('CLUSTER RESET', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['CLUSTER', 'RESET']
|
||||
);
|
||||
});
|
||||
|
||||
it('with mode', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('HARD'),
|
||||
['CLUSTER', 'RESET', 'HARD']
|
||||
);
|
||||
});
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
CLUSTER_RESET.transformArguments(),
|
||||
['CLUSTER', 'RESET']
|
||||
);
|
||||
});
|
||||
|
||||
it('with mode', () => {
|
||||
assert.deepEqual(
|
||||
CLUSTER_RESET.transformArguments({
|
||||
mode: 'HARD'
|
||||
}),
|
||||
['CLUSTER', 'RESET', 'HARD']
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -1,11 +1,20 @@
|
||||
export function transformArguments(mode?: 'HARD' | 'SOFT'): Array<string> {
|
||||
import { SimpleStringReply, Command } from '../RESP/types';
|
||||
|
||||
export interface ClusterResetOptions {
|
||||
mode?: 'HARD' | 'SOFT';
|
||||
}
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(options?: ClusterResetOptions) {
|
||||
const args = ['CLUSTER', 'RESET'];
|
||||
|
||||
if (mode) {
|
||||
args.push(mode);
|
||||
if (options?.mode) {
|
||||
args.push(options.mode);
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
export declare function transformReply(): string;
|
||||
},
|
||||
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,20 +1,20 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments } from './CLUSTER_SAVECONFIG';
|
||||
import CLUSTER_SAVECONFIG from './CLUSTER_SAVECONFIG';
|
||||
|
||||
describe('CLUSTER SAVECONFIG', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['CLUSTER', 'SAVECONFIG']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
CLUSTER_SAVECONFIG.transformArguments(),
|
||||
['CLUSTER', 'SAVECONFIG']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithCluster('clusterNode.clusterSaveConfig', async cluster => {
|
||||
const client = await cluster.nodeClient(cluster.masters[0]);
|
||||
assert.equal(
|
||||
await client.clusterSaveConfig(),
|
||||
'OK'
|
||||
);
|
||||
}, GLOBAL.CLUSTERS.OPEN);
|
||||
testUtils.testWithCluster('clusterNode.clusterSaveConfig', async cluster => {
|
||||
const client = await cluster.nodeClient(cluster.masters[0]);
|
||||
assert.equal(
|
||||
await client.clusterSaveConfig(),
|
||||
'OK'
|
||||
);
|
||||
}, GLOBAL.CLUSTERS.OPEN);
|
||||
});
|
||||
|
@@ -1,5 +1,11 @@
|
||||
export function transformArguments(): Array<string> {
|
||||
return ['CLUSTER', 'SAVECONFIG'];
|
||||
}
|
||||
import { SimpleStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments() {
|
||||
return ['CLUSTER', 'SAVECONFIG'];
|
||||
},
|
||||
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
|
||||
} as const satisfies Command;
|
||||
|
||||
export declare function transformReply(): 'OK';
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments } from './CLUSTER_SET-CONFIG-EPOCH';
|
||||
import CLUSTER_SET_CONFIG_EPOCH from './CLUSTER_SET-CONFIG-EPOCH';
|
||||
|
||||
describe('CLUSTER SET-CONFIG-EPOCH', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(0),
|
||||
['CLUSTER', 'SET-CONFIG-EPOCH', '0']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
CLUSTER_SET_CONFIG_EPOCH.transformArguments(0),
|
||||
['CLUSTER', 'SET-CONFIG-EPOCH', '0']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@@ -1,5 +1,10 @@
|
||||
export function transformArguments(configEpoch: number): Array<string> {
|
||||
return ['CLUSTER', 'SET-CONFIG-EPOCH', configEpoch.toString()];
|
||||
}
|
||||
import { SimpleStringReply, Command } from '../RESP/types';
|
||||
|
||||
export declare function transformReply(): 'OK';
|
||||
export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(configEpoch: number) {
|
||||
return ['CLUSTER', 'SET-CONFIG-EPOCH', configEpoch.toString() ];
|
||||
},
|
||||
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,20 +1,20 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { ClusterSlotStates, transformArguments } from './CLUSTER_SETSLOT';
|
||||
import CLUSTER_SETSLOT, { CLUSTER_SLOT_STATES } from './CLUSTER_SETSLOT';
|
||||
|
||||
describe('CLUSTER SETSLOT', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(0, ClusterSlotStates.IMPORTING),
|
||||
['CLUSTER', 'SETSLOT', '0', 'IMPORTING']
|
||||
);
|
||||
});
|
||||
|
||||
it('with nodeId', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(0, ClusterSlotStates.IMPORTING, 'nodeId'),
|
||||
['CLUSTER', 'SETSLOT', '0', 'IMPORTING', 'nodeId']
|
||||
);
|
||||
});
|
||||
describe('transformArguments', () => {
|
||||
it('simple', () => {
|
||||
assert.deepEqual(
|
||||
CLUSTER_SETSLOT.transformArguments(0, CLUSTER_SLOT_STATES.IMPORTING),
|
||||
['CLUSTER', 'SETSLOT', '0', 'IMPORTING']
|
||||
);
|
||||
});
|
||||
|
||||
it('with nodeId', () => {
|
||||
assert.deepEqual(
|
||||
CLUSTER_SETSLOT.transformArguments(0, CLUSTER_SLOT_STATES.IMPORTING, 'nodeId'),
|
||||
['CLUSTER', 'SETSLOT', '0', 'IMPORTING', 'nodeId']
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -1,22 +1,25 @@
|
||||
export enum ClusterSlotStates {
|
||||
IMPORTING = 'IMPORTING',
|
||||
MIGRATING = 'MIGRATING',
|
||||
STABLE = 'STABLE',
|
||||
NODE = 'NODE'
|
||||
}
|
||||
import { SimpleStringReply, Command } from '../RESP/types';
|
||||
|
||||
export function transformArguments(
|
||||
slot: number,
|
||||
state: ClusterSlotStates,
|
||||
nodeId?: string
|
||||
): Array<string> {
|
||||
export const CLUSTER_SLOT_STATES = {
|
||||
IMPORTING: 'IMPORTING',
|
||||
MIGRATING: 'MIGRATING',
|
||||
STABLE: 'STABLE',
|
||||
NODE: 'NODE'
|
||||
} as const;
|
||||
|
||||
export type ClusterSlotStates = typeof CLUSTER_SLOT_STATES[keyof typeof CLUSTER_SLOT_STATES];
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(slot: number, state: ClusterSlotStates, nodeId?: string) {
|
||||
const args = ['CLUSTER', 'SETSLOT', slot.toString(), state];
|
||||
|
||||
if (nodeId) {
|
||||
args.push(nodeId);
|
||||
args.push(nodeId);
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
export declare function transformReply(): 'OK';
|
||||
},
|
||||
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,76 +1,30 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import { transformArguments, transformReply } from './CLUSTER_SLOTS';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import CLUSTER_SLOTS from './CLUSTER_SLOTS';
|
||||
|
||||
describe('CLUSTER SLOTS', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(),
|
||||
['CLUSTER', 'SLOTS']
|
||||
);
|
||||
});
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
CLUSTER_SLOTS.transformArguments(),
|
||||
['CLUSTER', 'SLOTS']
|
||||
);
|
||||
});
|
||||
|
||||
it('transformReply', () => {
|
||||
assert.deepEqual(
|
||||
transformReply([
|
||||
[
|
||||
0,
|
||||
5460,
|
||||
['127.0.0.1', 30001, '09dbe9720cda62f7865eabc5fd8857c5d2678366'],
|
||||
['127.0.0.1', 30004, '821d8ca00d7ccf931ed3ffc7e3db0599d2271abf']
|
||||
],
|
||||
[
|
||||
5461,
|
||||
10922,
|
||||
['127.0.0.1', 30002, 'c9d93d9f2c0c524ff34cc11838c2003d8c29e013'],
|
||||
['127.0.0.1', 30005, 'faadb3eb99009de4ab72ad6b6ed87634c7ee410f']
|
||||
],
|
||||
[
|
||||
10923,
|
||||
16383,
|
||||
['127.0.0.1', 30003, '044ec91f325b7595e76dbcb18cc688b6a5b434a1'],
|
||||
['127.0.0.1', 30006, '58e6e48d41228013e5d9c1c37c5060693925e97e']
|
||||
]
|
||||
]),
|
||||
[{
|
||||
from: 0,
|
||||
to: 5460,
|
||||
master: {
|
||||
ip: '127.0.0.1',
|
||||
port: 30001,
|
||||
id: '09dbe9720cda62f7865eabc5fd8857c5d2678366'
|
||||
},
|
||||
replicas: [{
|
||||
ip: '127.0.0.1',
|
||||
port: 30004,
|
||||
id: '821d8ca00d7ccf931ed3ffc7e3db0599d2271abf'
|
||||
}]
|
||||
}, {
|
||||
from: 5461,
|
||||
to: 10922,
|
||||
master: {
|
||||
ip: '127.0.0.1',
|
||||
port: 30002,
|
||||
id: 'c9d93d9f2c0c524ff34cc11838c2003d8c29e013'
|
||||
},
|
||||
replicas: [{
|
||||
ip: '127.0.0.1',
|
||||
port: 30005,
|
||||
id: 'faadb3eb99009de4ab72ad6b6ed87634c7ee410f'
|
||||
}]
|
||||
}, {
|
||||
from: 10923,
|
||||
to: 16383,
|
||||
master: {
|
||||
ip: '127.0.0.1',
|
||||
port: 30003,
|
||||
id: '044ec91f325b7595e76dbcb18cc688b6a5b434a1'
|
||||
},
|
||||
replicas: [{
|
||||
ip: '127.0.0.1',
|
||||
port: 30006,
|
||||
id: '58e6e48d41228013e5d9c1c37c5060693925e97e'
|
||||
}]
|
||||
}]
|
||||
);
|
||||
});
|
||||
testUtils.testWithCluster('clusterNode.clusterSlots', async cluster => {
|
||||
const client = await cluster.nodeClient(cluster.masters[0]),
|
||||
slots = await client.clusterSlots();
|
||||
assert.ok(Array.isArray(slots));
|
||||
for (const { from, to, master, replicas } of slots) {
|
||||
assert.equal(typeof from, 'number');
|
||||
assert.equal(typeof to, 'number');
|
||||
assert.equal(typeof master.host, 'string');
|
||||
assert.equal(typeof master.port, 'number');
|
||||
assert.equal(typeof master.id, 'string');
|
||||
for (const replica of replicas) {
|
||||
assert.equal(typeof replica.host, 'string');
|
||||
assert.equal(typeof replica.port, 'number');
|
||||
assert.equal(typeof replica.id, 'string');
|
||||
}
|
||||
}
|
||||
}, GLOBAL.CLUSTERS.OPEN);
|
||||
});
|
||||
|
@@ -30,7 +30,9 @@ describe('FUNCTION RESTORE', () => {
|
||||
await client.withTypeMapping({
|
||||
[RESP_TYPES.BLOB_STRING]: Buffer
|
||||
}).functionDump(),
|
||||
'FLUSH'
|
||||
{
|
||||
mode: 'REPLACE'
|
||||
}
|
||||
),
|
||||
'OK'
|
||||
);
|
||||
|
@@ -36,11 +36,33 @@ import CLIENT_LIST from './CLIENT_LIST';
|
||||
import CLIENT_NO_EVICT from './CLIENT_NO-EVICT';
|
||||
import CLIENT_PAUSE from './CLIENT_PAUSE';
|
||||
import CLIENT_SETNAME from './CLIENT_SETNAME';
|
||||
import CLIENT_TRACKING from './CLIENT_TRACKING';
|
||||
import CLIENT_TRACKINGINFO from './CLIENT_TRACKINGINFO';
|
||||
import CLIENT_UNPAUSE from './CLIENT_UNPAUSE';
|
||||
import CLUSTER_ADDSLOTS from './CLUSTER_ADDSLOTS';
|
||||
import CLUSTER_SLOTS from './CLUSTER_SLOTS';
|
||||
import CLUSTER_ADDSLOTSRANGE from './CLUSTER_ADDSLOTSRANGE';
|
||||
import CLUSTER_BUMPEPOCH from './CLUSTER_BUMPEPOCH';
|
||||
import CLUSTER_COUNT_FAILURE_REPORTS from './CLUSTER_COUNT-FAILURE-REPORTS';
|
||||
import CLUSTER_COUNTKEYSINSLOT from './CLUSTER_COUNTKEYSINSLOT';
|
||||
import CLUSTER_DELSLOTS from './CLUSTER_DELSLOTS';
|
||||
import CLUSTER_DELSLOTSRANGE from './CLUSTER_DELSLOTSRANGE';
|
||||
import CLUSTER_FAILOVER from './CLUSTER_FAILOVER';
|
||||
import CLUSTER_FLUSHSLOTS from './CLUSTER_FLUSHSLOTS';
|
||||
import CLUSTER_FORGET from './CLUSTER_FORGET';
|
||||
import CLUSTER_GETKEYSINSLOT from './CLUSTER_GETKEYSINSLOT';
|
||||
// import CLUSTER_INFO from './CLUSTER_INFO';
|
||||
import CLUSTER_KEYSLOT from './CLUSTER_KEYSLOT';
|
||||
// import CLUSTER_LINKS from './CLUSTER_LINKS';
|
||||
import CLUSTER_MEET from './CLUSTER_MEET';
|
||||
import CLUSTER_MYID from './CLUSTER_MYID';
|
||||
// import CLUSTER_NODES from './CLUSTER_NODES';
|
||||
// import CLUSTER_REPLICAS from './CLUSTER_REPLICAS';
|
||||
import CLUSTER_REPLICATE from './CLUSTER_REPLICATE';
|
||||
import CLUSTER_RESET from './CLUSTER_RESET';
|
||||
import CLUSTER_SAVECONFIG from './CLUSTER_SAVECONFIG';
|
||||
import CLUSTER_SET_CONFIG_EPOCH from './CLUSTER_SET-CONFIG-EPOCH';
|
||||
import CLUSTER_SETSLOT from './CLUSTER_SETSLOT';
|
||||
import CLUSTER_SLOTS from './CLUSTER_SLOTS';
|
||||
import COPY from './COPY';
|
||||
import DBSIZE from './DBSIZE';
|
||||
import DECR from './DECR';
|
||||
@@ -90,7 +112,7 @@ 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_RESTORE from './FUNCTION_RESTORE';
|
||||
// import FUNCTION_STATS from './FUNCTION_STATS';
|
||||
import HDEL from './HDEL';
|
||||
import HELLO from './HELLO';
|
||||
@@ -297,11 +319,33 @@ 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 CLIENT_TRACKING = typeof import('./CLIENT_TRACKING').default;
|
||||
type CLIENT_TRACKINGINFO = typeof import('./CLIENT_TRACKINGINFO').default;
|
||||
type CLIENT_UNPAUSE = typeof import('./CLIENT_UNPAUSE').default;
|
||||
type CLUSTER_ADDSLOTS = typeof import('./CLUSTER_ADDSLOTS').default;
|
||||
type CLUSTER_SLOTS = typeof import('./CLUSTER_SLOTS').default;
|
||||
type CLUSTER_ADDSLOTSRANGE = typeof import('./CLUSTER_ADDSLOTSRANGE').default;
|
||||
type CLUSTER_BUMPEPOCH = typeof import('./CLUSTER_BUMPEPOCH').default;
|
||||
type CLUSTER_COUNT_FAILURE_REPORTS = typeof import('./CLUSTER_COUNT-FAILURE-REPORTS').default;
|
||||
type CLUSTER_COUNTKEYSINSLOT = typeof import('./CLUSTER_COUNTKEYSINSLOT').default;
|
||||
type CLUSTER_DELSLOTS = typeof import('./CLUSTER_DELSLOTS').default;
|
||||
type CLUSTER_DELSLOTSRANGE = typeof import('./CLUSTER_DELSLOTSRANGE').default;
|
||||
type CLUSTER_FAILOVER = typeof import('./CLUSTER_FAILOVER').default;
|
||||
type CLUSTER_FLUSHSLOTS = typeof import('./CLUSTER_FLUSHSLOTS').default;
|
||||
type CLUSTER_FORGET = typeof import('./CLUSTER_FORGET').default;
|
||||
type CLUSTER_GETKEYSINSLOT = typeof import('./CLUSTER_GETKEYSINSLOT').default;
|
||||
// type CLUSTER_INFO = typeof import('./CLUSTER_INFO').default;
|
||||
type CLUSTER_KEYSLOT = typeof import('./CLUSTER_KEYSLOT').default;
|
||||
// type CLUSTER_LINKS = typeof import('./CLUSTER_LINKS').default;
|
||||
type CLUSTER_MEET = typeof import('./CLUSTER_MEET').default;
|
||||
type CLUSTER_MYID = typeof import('./CLUSTER_MYID').default;
|
||||
// type CLUSTER_NODES = typeof import('./CLUSTER_NODES').default;
|
||||
// type CLUSTER_REPLICAS = typeof import('./CLUSTER_REPLICAS').default;
|
||||
type CLUSTER_REPLICATE = typeof import('./CLUSTER_REPLICATE').default;
|
||||
type CLUSTER_RESET = typeof import('./CLUSTER_RESET').default;
|
||||
type CLUSTER_SAVECONFIG = typeof import('./CLUSTER_SAVECONFIG').default;
|
||||
type CLUSTER_SET_CONFIG_EPOCH = typeof import('./CLUSTER_SET-CONFIG-EPOCH').default;
|
||||
type CLUSTER_SETSLOT = typeof import('./CLUSTER_SETSLOT').default;
|
||||
type CLUSTER_SLOTS = typeof import('./CLUSTER_SLOTS').default;
|
||||
type COPY = typeof import('./COPY').default;
|
||||
type DBSIZE = typeof DBSIZE;
|
||||
type DECR = typeof import('./DECR').default;
|
||||
@@ -351,7 +395,7 @@ 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_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;
|
||||
@@ -596,16 +640,60 @@ type Commands = {
|
||||
clientPause: CLIENT_PAUSE;
|
||||
CLIENT_SETNAME: CLIENT_SETNAME;
|
||||
clientSetName: CLIENT_SETNAME;
|
||||
CLIENT_TRACKING: CLIENT_TRACKING;
|
||||
clientTracking: CLIENT_TRACKING;
|
||||
CLIENT_TRACKINGINFO: CLIENT_TRACKINGINFO;
|
||||
clientTrackingInfo: CLIENT_TRACKINGINFO;
|
||||
CLIENT_UNPAUSE: CLIENT_UNPAUSE;
|
||||
clientUnpause: CLIENT_UNPAUSE;
|
||||
CLUSTER_ADDSLOTS: CLUSTER_ADDSLOTS;
|
||||
clusterAddSlots: CLUSTER_ADDSLOTS;
|
||||
CLUSTER_SLOTS: CLUSTER_SLOTS;
|
||||
clusterSlots: CLUSTER_SLOTS;
|
||||
CLUSTER_ADDSLOTSRANGE: CLUSTER_ADDSLOTSRANGE;
|
||||
clusterAddSlotsRange: CLUSTER_ADDSLOTSRANGE;
|
||||
CLUSTER_BUMPEPOCH: CLUSTER_BUMPEPOCH;
|
||||
clusterBumpEpoch: CLUSTER_BUMPEPOCH;
|
||||
'CLUSTER_COUNT-FAILURE-REPORTS': CLUSTER_COUNT_FAILURE_REPORTS;
|
||||
clusterCountFailureReports: CLUSTER_COUNT_FAILURE_REPORTS;
|
||||
CLUSTER_COUNTKEYSINSLOT: CLUSTER_COUNTKEYSINSLOT;
|
||||
clusterCountKeysInSlot: CLUSTER_COUNTKEYSINSLOT;
|
||||
CLUSTER_DELSLOTS: CLUSTER_DELSLOTS;
|
||||
clusterDelSlots: CLUSTER_DELSLOTS;
|
||||
CLUSTER_DELSLOTSRANGE: CLUSTER_DELSLOTSRANGE;
|
||||
clusterDelSlotsRange: CLUSTER_DELSLOTSRANGE;
|
||||
CLUSTER_FAILOVER: CLUSTER_FAILOVER;
|
||||
clusterFailover: CLUSTER_FAILOVER;
|
||||
CLUSTER_FLUSHSLOTS: CLUSTER_FLUSHSLOTS;
|
||||
clusterFlushSlots: CLUSTER_FLUSHSLOTS;
|
||||
CLUSTER_FORGET: CLUSTER_FORGET;
|
||||
clusterForget: CLUSTER_FORGET;
|
||||
CLUSTER_GETKEYSINSLOT: CLUSTER_GETKEYSINSLOT;
|
||||
clusterGetKeysInSlot: CLUSTER_GETKEYSINSLOT;
|
||||
// CLUSTER_INFO: CLUSTER_INFO;
|
||||
// clusterInfo: CLUSTER_INFO;
|
||||
CLUSTER_KEYSLOT: CLUSTER_KEYSLOT;
|
||||
clusterKeySlot: CLUSTER_KEYSLOT;
|
||||
// CLUSTER_LINKS: CLUSTER_LINKS;
|
||||
// clusterLinks: CLUSTER_LINKS;
|
||||
CLUSTER_MEET: CLUSTER_MEET;
|
||||
clusterMeet: CLUSTER_MEET;
|
||||
CLUSTER_MYID: CLUSTER_MYID;
|
||||
clusterMyId: CLUSTER_MYID;
|
||||
// CLUSTER_NODES: CLUSTER_NODES;
|
||||
// clusterNodes: CLUSTER_NODES;
|
||||
// CLUSTER_REPLICAS: CLUSTER_REPLICAS;
|
||||
// clusterReplicas: CLUSTER_REPLICAS;
|
||||
CLUSTER_REPLICATE: CLUSTER_REPLICATE;
|
||||
clusterReplicate: CLUSTER_REPLICATE;
|
||||
CLUSTER_RESET: CLUSTER_RESET;
|
||||
clusterReset: CLUSTER_RESET;
|
||||
CLUSTER_SAVECONFIG: CLUSTER_SAVECONFIG;
|
||||
clusterSaveConfig: CLUSTER_SAVECONFIG;
|
||||
'CLUSTER_SET-CONFIG-EPOCH': CLUSTER_SET_CONFIG_EPOCH;
|
||||
clusterSetConfigEpoch: CLUSTER_SET_CONFIG_EPOCH;
|
||||
CLUSTER_SETSLOT: CLUSTER_SETSLOT;
|
||||
clusterSetSlot: CLUSTER_SETSLOT;
|
||||
CLUSTER_SLOTS: CLUSTER_SLOTS;
|
||||
clusterSlots: CLUSTER_SLOTS;
|
||||
COPY: COPY;
|
||||
copy: COPY;
|
||||
DBSIZE: DBSIZE;
|
||||
@@ -658,8 +746,8 @@ type Commands = {
|
||||
functionList: FUNCTION_LIST;
|
||||
FUNCTION_LOAD: FUNCTION_LOAD;
|
||||
functionLoad: FUNCTION_LOAD;
|
||||
// FUNCTION_RESTORE: FUNCTION_RESTORE;
|
||||
// functionRestore: FUNCTION_RESTORE;
|
||||
FUNCTION_RESTORE: FUNCTION_RESTORE;
|
||||
functionRestore: FUNCTION_RESTORE;
|
||||
// FUNCTION_STATS: FUNCTION_STATS;
|
||||
// functionStats: FUNCTION_STATS;
|
||||
GEOADD: GEOADD;
|
||||
@@ -1119,16 +1207,60 @@ export default {
|
||||
clientPause: CLIENT_PAUSE,
|
||||
CLIENT_SETNAME,
|
||||
clientSetName: CLIENT_SETNAME,
|
||||
CLIENT_TRACKING,
|
||||
clientTracking: CLIENT_TRACKING,
|
||||
CLIENT_TRACKINGINFO,
|
||||
clientTrackingInfo: CLIENT_TRACKINGINFO,
|
||||
CLIENT_UNPAUSE,
|
||||
clientUnpause: CLIENT_UNPAUSE,
|
||||
CLUSTER_ADDSLOTS,
|
||||
clusterAddSlots: CLUSTER_ADDSLOTS,
|
||||
CLUSTER_SLOTS,
|
||||
clusterSlots: CLUSTER_SLOTS,
|
||||
CLUSTER_ADDSLOTSRANGE,
|
||||
clusterAddSlotsRange: CLUSTER_ADDSLOTSRANGE,
|
||||
CLUSTER_BUMPEPOCH,
|
||||
clusterBumpEpoch: CLUSTER_BUMPEPOCH,
|
||||
'CLUSTER_COUNT-FAILURE-REPORTS': CLUSTER_COUNT_FAILURE_REPORTS,
|
||||
clusterCountFailureReports: CLUSTER_COUNT_FAILURE_REPORTS,
|
||||
CLUSTER_COUNTKEYSINSLOT,
|
||||
clusterCountKeysInSlot: CLUSTER_COUNTKEYSINSLOT,
|
||||
CLUSTER_DELSLOTS,
|
||||
clusterDelSlots: CLUSTER_DELSLOTS,
|
||||
CLUSTER_DELSLOTSRANGE,
|
||||
clusterDelSlotsRange: CLUSTER_DELSLOTSRANGE,
|
||||
CLUSTER_FAILOVER,
|
||||
clusterFailover: CLUSTER_FAILOVER,
|
||||
CLUSTER_FLUSHSLOTS,
|
||||
clusterFlushSlots: CLUSTER_FLUSHSLOTS,
|
||||
CLUSTER_FORGET,
|
||||
clusterForget: CLUSTER_FORGET,
|
||||
CLUSTER_GETKEYSINSLOT,
|
||||
clusterGetKeysInSlot: CLUSTER_GETKEYSINSLOT,
|
||||
// CLUSTER_INFO,
|
||||
// clusterInfo: CLUSTER_INFO,
|
||||
CLUSTER_KEYSLOT,
|
||||
clusterKeySlot: CLUSTER_KEYSLOT,
|
||||
// CLUSTER_LINKS,
|
||||
// clusterLinks: CLUSTER_LINKS,
|
||||
CLUSTER_MEET,
|
||||
clusterMeet: CLUSTER_MEET,
|
||||
CLUSTER_MYID,
|
||||
clusterMyId: CLUSTER_MYID,
|
||||
// CLUSTER_NODES,
|
||||
// clusterNodes: CLUSTER_NODES,
|
||||
// CLUSTER_REPLICAS,
|
||||
// clusterReplicas: CLUSTER_REPLICAS,
|
||||
CLUSTER_REPLICATE,
|
||||
clusterReplicate: CLUSTER_REPLICATE,
|
||||
CLUSTER_RESET,
|
||||
clusterReset: CLUSTER_RESET,
|
||||
CLUSTER_SAVECONFIG,
|
||||
clusterSaveConfig: CLUSTER_SAVECONFIG,
|
||||
'CLUSTER_SET-CONFIG-EPOCH': CLUSTER_SET_CONFIG_EPOCH,
|
||||
clusterSetConfigEpoch: CLUSTER_SET_CONFIG_EPOCH,
|
||||
CLUSTER_SETSLOT,
|
||||
clusterSetSlot: CLUSTER_SETSLOT,
|
||||
CLUSTER_SLOTS,
|
||||
clusterSlots: CLUSTER_SLOTS,
|
||||
COPY,
|
||||
copy: COPY,
|
||||
DBSIZE,
|
||||
@@ -1563,4 +1695,4 @@ export default {
|
||||
zUnion: ZUNION,
|
||||
ZUNIONSTORE,
|
||||
zUnionStore: ZUNIONSTORE
|
||||
} as const satisfies Record<string, Command> as Commands;
|
||||
} satisfies Record<string, Command> as Commands;
|
||||
|
Reference in New Issue
Block a user