1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00
This commit is contained in:
Leibale
2023-06-21 19:09:45 -04:00
parent 4894c26458
commit b46f08228c
53 changed files with 831 additions and 630 deletions

View File

@@ -165,6 +165,9 @@ Some command arguments/replies have changed to align more closely to data types
- `CLUSETER SETSLOT`: `ClusterSlotStates` -> `CLUSTER_SLOT_STATES` [^enum-to-constants] - `CLUSETER SETSLOT`: `ClusterSlotStates` -> `CLUSTER_SLOT_STATES` [^enum-to-constants]
- `FUNCTION RESTORE`: the second argument is `{ mode: string; }` instead of `string` [^future-proofing] - `FUNCTION RESTORE`: the second argument is `{ mode: string; }` instead of `string` [^future-proofing]
- `CLUSTER RESET`: the second argument is `{ mode: string; }` instead of `string` [^future-proofing] - `CLUSTER RESET`: the second argument is `{ mode: string; }` instead of `string` [^future-proofing]
- `CLUSTER FAILOVER`: `enum FailoverModes` -> `const FAILOVER_MODES` [^enum-to-constants], the second argument is `{ mode: string; }` instead of `string` [^future-proofing]
- `CLUSTER LINKS`: `createTime` -> `create-time`, `sendBufferAllocated` -> `send-buffer-allocated`, `sendBufferUsed` -> `send-buffer-used` [^map-keys]
- `TIME`: `Date` -> `[unixTimestamp: string, microseconds: string]`
[^enum-to-constants]: TODO [^enum-to-constants]: TODO

View File

@@ -1,10 +1,10 @@
import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
import { transformArguments } from './ASKING'; import ASKING from './ASKING';
describe('ASKING', () => { describe('ASKING', () => {
it('transformArguments', () => { it('transformArguments', () => {
assert.deepEqual( assert.deepEqual(
transformArguments(), ASKING.transformArguments(),
['ASKING'] ['ASKING']
); );
}); });

View File

@@ -1,11 +1,19 @@
import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
import { transformArguments } from './BGREWRITEAOF'; import testUtils, { GLOBAL } from '../test-utils';
import BGREWRITEAOF from './BGREWRITEAOF';
describe('BGREWRITEAOF', () => { describe('BGREWRITEAOF', () => {
it('transformArguments', () => { it('transformArguments', () => {
assert.deepEqual( assert.deepEqual(
transformArguments(), BGREWRITEAOF.transformArguments(),
['BGREWRITEAOF'] ['BGREWRITEAOF']
); );
}); });
testUtils.testWithClient('client.bgRewriteAof', async client => {
assert.equal(
typeof await client.bgRewriteAof(),
'string'
);
}, GLOBAL.SERVERS.OPEN);
}); });

View File

@@ -1,23 +1,30 @@
import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
import { describe } from 'mocha'; import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './BGSAVE'; import BGSAVE from './BGSAVE';
describe('BGSAVE', () => { describe('BGSAVE', () => {
describe('transformArguments', () => { describe('transformArguments', () => {
it('simple', () => { it('simple', () => {
assert.deepEqual( assert.deepEqual(
transformArguments(), BGSAVE.transformArguments(),
['BGSAVE'] ['BGSAVE']
); );
}); });
it('with SCHEDULE', () => { it('with SCHEDULE', () => {
assert.deepEqual( assert.deepEqual(
transformArguments({ BGSAVE.transformArguments({
SCHEDULE: true SCHEDULE: true
}), }),
['BGSAVE', 'SCHEDULE'] ['BGSAVE', 'SCHEDULE']
); );
}); });
}); });
testUtils.testWithClient('client.bgSave', async client => {
assert.equal(
typeof await client.bgSave(),
'string'
);
}, GLOBAL.SERVERS.OPEN);
}); });

View File

@@ -1,10 +1,20 @@
import { SimpleStringReply, Command } from '../RESP/types'; import { SimpleStringReply, Command } from '../RESP/types';
export interface BgSaveOptions {
SCHEDULE?: boolean;
}
export default { export default {
FIRST_KEY_INDEX: undefined, FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: true, IS_READ_ONLY: true,
transformArguments() { transformArguments(options?: BgSaveOptions) {
return ['BGSAVE']; const args = ['BGSAVE'];
if (options?.SCHEDULE) {
args.push('SCHEDULE');
}
return args;
}, },
transformReply: undefined as unknown as () => SimpleStringReply transformReply: undefined as unknown as () => SimpleStringReply
} as const satisfies Command; } as const satisfies Command;

View File

@@ -1,21 +1,20 @@
import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils'; import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './CLUSTER_COUNT-FAILURE-REPORTS'; import CLUSTER_COUNT_FAILURE_REPORTS from './CLUSTER_COUNT-FAILURE-REPORTS';
describe('CLUSTER COUNT-FAILURE-REPORTS', () => { describe('CLUSTER COUNT-FAILURE-REPORTS', () => {
it('transformArguments', () => { it('transformArguments', () => {
assert.deepEqual( assert.deepEqual(
transformArguments('0'), CLUSTER_COUNT_FAILURE_REPORTS.transformArguments('0'),
['CLUSTER', 'COUNT-FAILURE-REPORTS', '0'] ['CLUSTER', 'COUNT-FAILURE-REPORTS', '0']
); );
}); });
testUtils.testWithCluster('clusterNode.clusterCountFailureReports', async cluster => { testUtils.testWithCluster('clusterNode.clusterCountFailureReports', async cluster => {
const client = await cluster.nodeClient(cluster.masters[0]); const [master] = cluster.masters,
client = await cluster.nodeClient(master);
assert.equal( assert.equal(
typeof await client.clusterCountFailureReports( typeof await client.clusterCountFailureReports(master.id),
await client.clusterMyId()
),
'number' 'number'
); );
}, GLOBAL.CLUSTERS.OPEN); }, GLOBAL.CLUSTERS.OPEN);

View File

@@ -1,11 +1,11 @@
import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils'; import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './CLUSTER_COUNTKEYSINSLOT'; import CLUSTER_COUNTKEYSINSLOT from './CLUSTER_COUNTKEYSINSLOT';
describe('CLUSTER COUNTKEYSINSLOT', () => { describe('CLUSTER COUNTKEYSINSLOT', () => {
it('transformArguments', () => { it('transformArguments', () => {
assert.deepEqual( assert.deepEqual(
transformArguments(0), CLUSTER_COUNTKEYSINSLOT.transformArguments(0),
['CLUSTER', 'COUNTKEYSINSLOT', '0'] ['CLUSTER', 'COUNTKEYSINSLOT', '0']
); );
}); });

View File

@@ -4,7 +4,7 @@ export default {
FIRST_KEY_INDEX: undefined, FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: true, IS_READ_ONLY: true,
transformArguments(slot: number) { transformArguments(slot: number) {
return ['CLUSTER', 'COUNT-FAILURE-REPORTS', slot.toString()]; return ['CLUSTER', 'COUNTKEYSINSLOT', slot.toString()];
}, },
transformReply: undefined as unknown as () => NumberReply transformReply: undefined as unknown as () => NumberReply
} as const satisfies Command; } as const satisfies Command;

View File

@@ -1,18 +1,18 @@
import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
import { transformArguments } from './CLUSTER_DELSLOTS'; import CLUSTER_DELSLOTS from './CLUSTER_DELSLOTS';
describe('CLUSTER DELSLOTS', () => { describe('CLUSTER DELSLOTS', () => {
describe('transformArguments', () => { describe('transformArguments', () => {
it('single', () => { it('single', () => {
assert.deepEqual( assert.deepEqual(
transformArguments(0), CLUSTER_DELSLOTS.transformArguments(0),
['CLUSTER', 'DELSLOTS', '0'] ['CLUSTER', 'DELSLOTS', '0']
); );
}); });
it('multiple', () => { it('multiple', () => {
assert.deepEqual( assert.deepEqual(
transformArguments([0, 1]), CLUSTER_DELSLOTS.transformArguments([0, 1]),
['CLUSTER', 'DELSLOTS', '0', '1'] ['CLUSTER', 'DELSLOTS', '0', '1']
); );
}); });

View File

@@ -1,11 +1,11 @@
import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
import { transformArguments } from './CLUSTER_DELSLOTSRANGE'; import CLUSTER_DELSLOTSRANGE from './CLUSTER_DELSLOTSRANGE';
describe('CLUSTER DELSLOTSRANGE', () => { describe('CLUSTER DELSLOTSRANGE', () => {
describe('transformArguments', () => { describe('transformArguments', () => {
it('single', () => { it('single', () => {
assert.deepEqual( assert.deepEqual(
transformArguments({ CLUSTER_DELSLOTSRANGE.transformArguments({
start: 0, start: 0,
end: 1 end: 1
}), }),
@@ -15,7 +15,7 @@ describe('CLUSTER DELSLOTSRANGE', () => {
it('multiple', () => { it('multiple', () => {
assert.deepEqual( assert.deepEqual(
transformArguments([{ CLUSTER_DELSLOTSRANGE.transformArguments([{
start: 0, start: 0,
end: 1 end: 1
}, { }, {

View File

@@ -1,18 +1,20 @@
import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
import { FailoverModes, transformArguments } from './CLUSTER_FAILOVER'; import CLUSTER_FAILOVER, { FAILOVER_MODES } from './CLUSTER_FAILOVER';
describe('CLUSTER FAILOVER', () => { describe('CLUSTER FAILOVER', () => {
describe('transformArguments', () => { describe('transformArguments', () => {
it('simple', () => { it('simple', () => {
assert.deepEqual( assert.deepEqual(
transformArguments(), CLUSTER_FAILOVER.transformArguments(),
['CLUSTER', 'FAILOVER'] ['CLUSTER', 'FAILOVER']
); );
}); });
it('with mode', () => { it('with mode', () => {
assert.deepEqual( assert.deepEqual(
transformArguments(FailoverModes.FORCE), CLUSTER_FAILOVER.transformArguments({
mode: FAILOVER_MODES.FORCE
}),
['CLUSTER', 'FAILOVER', 'FORCE'] ['CLUSTER', 'FAILOVER', 'FORCE']
); );
}); });

View File

@@ -5,16 +5,20 @@ export const FAILOVER_MODES = {
TAKEOVER: 'TAKEOVER' TAKEOVER: 'TAKEOVER'
} as const; } as const;
export type FailoverModes = typeof FAILOVER_MODES[keyof typeof FAILOVER_MODES]; export type FailoverMode = typeof FAILOVER_MODES[keyof typeof FAILOVER_MODES];
export interface ClusterFailoverOptions {
mode?: FailoverMode;
}
export default { export default {
FIRST_KEY_INDEX: undefined, FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: true, IS_READ_ONLY: true,
transformArguments(mode?: FailoverModes) { transformArguments(options?: ClusterFailoverOptions) {
const args = ['CLUSTER', 'FAILOVER']; const args = ['CLUSTER', 'FAILOVER'];
if (mode) { if (options?.mode) {
args.push(mode); args.push(options.mode);
} }
return args; return args;

View File

@@ -1,10 +1,10 @@
import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
import { transformArguments } from './CLUSTER_FLUSHSLOTS'; import CLUSTER_FLUSHSLOTS from './CLUSTER_FLUSHSLOTS';
describe('CLUSTER FLUSHSLOTS', () => { describe('CLUSTER FLUSHSLOTS', () => {
it('transformArguments', () => { it('transformArguments', () => {
assert.deepEqual( assert.deepEqual(
transformArguments(), CLUSTER_FLUSHSLOTS.transformArguments(),
['CLUSTER', 'FLUSHSLOTS'] ['CLUSTER', 'FLUSHSLOTS']
); );
}); });

View File

@@ -1,10 +1,10 @@
import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
import { transformArguments } from './CLUSTER_FORGET'; import CLUSTER_FORGET from './CLUSTER_FORGET';
describe('CLUSTER FORGET', () => { describe('CLUSTER FORGET', () => {
it('transformArguments', () => { it('transformArguments', () => {
assert.deepEqual( assert.deepEqual(
transformArguments('0'), CLUSTER_FORGET.transformArguments('0'),
['CLUSTER', 'FORGET', '0'] ['CLUSTER', 'FORGET', '0']
); );
}); });

View File

@@ -1,18 +1,22 @@
import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils'; import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './CLUSTER_GETKEYSINSLOT'; import CLUSTER_GETKEYSINSLOT from './CLUSTER_GETKEYSINSLOT';
describe('CLUSTER GETKEYSINSLOT', () => { describe('CLUSTER GETKEYSINSLOT', () => {
it('transformArguments', () => { it('transformArguments', () => {
assert.deepEqual( assert.deepEqual(
transformArguments(0, 10), CLUSTER_GETKEYSINSLOT.transformArguments(0, 10),
['CLUSTER', 'GETKEYSINSLOT', '0', '10'] ['CLUSTER', 'GETKEYSINSLOT', '0', '10']
); );
}); });
testUtils.testWithCluster('clusterNode.clusterGetKeysInSlot', async cluster => { testUtils.testWithCluster('clusterNode.clusterGetKeysInSlot', async cluster => {
const client = await cluster.nodeClient(cluster.masters[0]), const slot = 12539, // "key" slot
reply = await client.clusterGetKeysInSlot(0, 1); client = await cluster.nodeClient(cluster.slots[slot].master),
[, reply] = await Promise.all([
client.set('key', 'value'),
client.clusterGetKeysInSlot(slot, 1),
])
assert.ok(Array.isArray(reply)); assert.ok(Array.isArray(reply));
for (const item of reply) { for (const item of reply) {
assert.equal(typeof item, 'string'); assert.equal(typeof item, 'string');

View File

@@ -1,6 +1,8 @@
import { Command, NumberReply, RedisArgument } from '../RESP/types'; import { Command, NumberReply, RedisArgument } from '../RESP/types';
export default { export default {
FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: true,
transformArguments(key: RedisArgument) { transformArguments(key: RedisArgument) {
return ['CLUSTER', 'KEYSLOT', key]; return ['CLUSTER', 'KEYSLOT', key];
}, },

View File

@@ -1,13 +1,13 @@
import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils'; import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './CLUSTER_LINKS'; import CLUSTER_LINKS from './CLUSTER_LINKS';
describe('CLUSTER LINKS', () => { describe('CLUSTER LINKS', () => {
testUtils.isVersionGreaterThanHook([7]); testUtils.isVersionGreaterThanHook([7]);
it('transformArguments', () => { it('transformArguments', () => {
assert.deepEqual( assert.deepEqual(
transformArguments(), CLUSTER_LINKS.transformArguments(),
['CLUSTER', 'LINKS'] ['CLUSTER', 'LINKS']
); );
}); });
@@ -19,10 +19,10 @@ describe('CLUSTER LINKS', () => {
for (const link of links) { for (const link of links) {
assert.equal(typeof link.direction, 'string'); assert.equal(typeof link.direction, 'string');
assert.equal(typeof link.node, 'string'); assert.equal(typeof link.node, 'string');
assert.equal(typeof link.createTime, 'number'); assert.equal(typeof link['create-time'], 'number');
assert.equal(typeof link.events, 'string'); assert.equal(typeof link.events, 'string');
assert.equal(typeof link.sendBufferAllocated, 'number'); assert.equal(typeof link['send-buffer-allocated'], 'number');
assert.equal(typeof link.sendBufferUsed, 'number'); assert.equal(typeof link['send-buffer-used'], 'number');
} }
}, GLOBAL.CLUSTERS.OPEN); }, GLOBAL.CLUSTERS.OPEN);
}); });

View File

@@ -1,38 +1,29 @@
export function transformArguments(): Array<string> { import { ArrayReply, TuplesToMapReply, BlobStringReply, NumberReply, Resp2Reply, Command } from '../RESP/types';
type ClusterLinksReply = ArrayReply<TuplesToMapReply<[
[BlobStringReply<'direction'>, BlobStringReply],
[BlobStringReply<'node'>, BlobStringReply],
[BlobStringReply<'create-time'>, NumberReply],
[BlobStringReply<'events'>, BlobStringReply],
[BlobStringReply<'send-buffer-allocated'>, NumberReply],
[BlobStringReply<'send-buffer-used'>, NumberReply],
]>>;
export default {
FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: true,
transformArguments() {
return ['CLUSTER', 'LINKS']; return ['CLUSTER', 'LINKS'];
} },
transformReply: {
type ClusterLinksRawReply = Array<[ 2: (reply: Resp2Reply<ClusterLinksReply>) => reply.map(link => ({
'direction', direction: link[1],
string, node: link[3],
'node', 'create-time': link[5],
string, events: link[7],
'createTime', 'send-buffer-allocated': link[9],
number, 'send-buffer-used': link[11]
'events', })),
string, 3: undefined as unknown as () => ClusterLinksReply
'send-buffer-allocated', }
number, } as const satisfies Command;
'send-buffer-used',
number
]>;
type ClusterLinksReply = Array<{
direction: string;
node: string;
createTime: number;
events: string;
sendBufferAllocated: number;
sendBufferUsed: number;
}>;
export function transformReply(reply: ClusterLinksRawReply): ClusterLinksReply {
return reply.map(peerLink => ({
direction: peerLink[1],
node: peerLink[3],
createTime: Number(peerLink[5]),
events: peerLink[7],
sendBufferAllocated: Number(peerLink[9]),
sendBufferUsed: Number(peerLink[11])
}));
}

View File

@@ -1,6 +1,8 @@
import { SimpleStringReply, Command } from '../RESP/types'; import { SimpleStringReply, Command } from '../RESP/types';
export default { export default {
FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: true,
transformArguments(host: string, port: number) { transformArguments(host: string, port: number) {
return ['CLUSTER', 'MEET', host, port.toString()]; return ['CLUSTER', 'MEET', host, port.toString()];
}, },

View File

@@ -1,6 +1,8 @@
import { BlobStringReply, Command } from '../RESP/types'; import { BlobStringReply, Command } from '../RESP/types';
export default { export default {
FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: true,
transformArguments() { transformArguments() {
return ['CLUSTER', 'MYID']; return ['CLUSTER', 'MYID'];
}, },

View File

@@ -1,6 +1,8 @@
import { RedisArgument, SimpleStringReply, Command } from '../RESP/types'; import { RedisArgument, SimpleStringReply, Command } from '../RESP/types';
export default { export default {
FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: true,
transformArguments(nodeId: RedisArgument) { transformArguments(nodeId: RedisArgument) {
return ['CLUSTER', 'REPLICATE', nodeId]; return ['CLUSTER', 'REPLICATE', nodeId];
}, },

View File

@@ -1,4 +1,4 @@
import { SimpleStringReply, Command } from '../RESP/types'; import { RedisArgument, SimpleStringReply, Command } from '../RESP/types';
export const CLUSTER_SLOT_STATES = { export const CLUSTER_SLOT_STATES = {
IMPORTING: 'IMPORTING', IMPORTING: 'IMPORTING',
@@ -7,13 +7,13 @@ export const CLUSTER_SLOT_STATES = {
NODE: 'NODE' NODE: 'NODE'
} as const; } as const;
export type ClusterSlotStates = typeof CLUSTER_SLOT_STATES[keyof typeof CLUSTER_SLOT_STATES]; export type ClusterSlotState = typeof CLUSTER_SLOT_STATES[keyof typeof CLUSTER_SLOT_STATES];
export default { export default {
FIRST_KEY_INDEX: undefined, FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: true, IS_READ_ONLY: true,
transformArguments(slot: number, state: ClusterSlotStates, nodeId?: string) { transformArguments(slot: number, state: ClusterSlotState, nodeId?: RedisArgument) {
const args = ['CLUSTER', 'SETSLOT', slot.toString(), state]; const args: Array<RedisArgument> = ['CLUSTER', 'SETSLOT', slot.toString(), state];
if (nodeId) { if (nodeId) {
args.push(nodeId); args.push(nodeId);

View File

@@ -26,5 +26,5 @@ describe('CLUSTER SLOTS', () => {
assert.equal(typeof replica.id, 'string'); assert.equal(typeof replica.id, 'string');
} }
} }
}, GLOBAL.CLUSTERS.OPEN); }, GLOBAL.CLUSTERS.WITH_REPLICAS);
}); });

View File

@@ -1,19 +1,19 @@
// import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
// import testUtils, { GLOBAL } from '../test-utils'; import testUtils, { GLOBAL } from '../test-utils';
// import { transformArguments } from './COMMAND_COUNT'; import COMMAND_COUNT from './COMMAND_COUNT';
// describe('COMMAND COUNT', () => { describe('COMMAND COUNT', () => {
// it('transformArguments', () => { it('transformArguments', () => {
// assert.deepEqual( assert.deepEqual(
// transformArguments(), COMMAND_COUNT.transformArguments(),
// ['COMMAND', 'COUNT'] ['COMMAND', 'COUNT']
// ); );
// }); });
// testUtils.testWithClient('client.commandCount', async client => { testUtils.testWithClient('client.commandCount', async client => {
// assert.equal( assert.equal(
// typeof await client.commandCount(), typeof await client.commandCount(),
// 'number' 'number'
// ); );
// }, GLOBAL.SERVERS.OPEN); }, GLOBAL.SERVERS.OPEN);
// }); });

View File

@@ -1,9 +1,10 @@
// import { RedisCommandArguments } from '.'; import { NumberReply, Command } from '../RESP/types';
// export const IS_READ_ONLY = true; export default {
FIRST_KEY_INDEX: undefined,
// export function transformArguments(): RedisCommandArguments { IS_READ_ONLY: true,
// return ['COMMAND', 'COUNT']; transformArguments() {
// } return ['COMMAND', 'COUNT'];
},
// export declare function transformReply(): number; transformReply: undefined as unknown as () => NumberReply
} as const satisfies Command;

View File

@@ -1,19 +1,19 @@
// import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
// import testUtils, { GLOBAL } from '../test-utils'; import testUtils, { GLOBAL } from '../test-utils';
// import { transformArguments } from './COMMAND_GETKEYS'; import COMMAND_GETKEYS from './COMMAND_GETKEYS';
// describe('COMMAND GETKEYS', () => { describe('COMMAND GETKEYS', () => {
// it('transformArguments', () => { it('transformArguments', () => {
// assert.deepEqual( assert.deepEqual(
// transformArguments(['GET', 'key']), COMMAND_GETKEYS.transformArguments(['GET', 'key']),
// ['COMMAND', 'GETKEYS', 'GET', 'key'] ['COMMAND', 'GETKEYS', 'GET', 'key']
// ); );
// }); });
// testUtils.testWithClient('client.commandGetKeys', async client => { testUtils.testWithClient('client.commandGetKeys', async client => {
// assert.deepEqual( assert.deepEqual(
// await client.commandGetKeys(['GET', 'key']), await client.commandGetKeys(['GET', 'key']),
// ['key'] ['key']
// ); );
// }, GLOBAL.SERVERS.OPEN); }, GLOBAL.SERVERS.OPEN);
// }); });

View File

@@ -1,9 +1,10 @@
// import { RedisCommandArgument, RedisCommandArguments } from '.'; import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types';
// export const IS_READ_ONLY = true; export default {
FIRST_KEY_INDEX: undefined,
// export function transformArguments(args: Array<RedisCommandArgument>): RedisCommandArguments { IS_READ_ONLY: true,
// return ['COMMAND', 'GETKEYS', ...args]; transformArguments(args: Array<RedisArgument>) {
// } return ['COMMAND', 'GETKEYS', ...args];
},
// export declare function transformReply(): Array<RedisCommandArgument>; transformReply: undefined as unknown as () => ArrayReply<BlobStringReply>
} as const satisfies Command;

View File

@@ -1,11 +1,31 @@
import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import CONFIG_GET from './CONFIG_GET'; import CONFIG_GET from './CONFIG_GET';
describe('CONFIG GET', () => { describe('CONFIG GET', () => {
it('transformArguments', () => { describe('transformArguments', () => {
it('string', () => {
assert.deepEqual( assert.deepEqual(
CONFIG_GET.transformArguments('*'), CONFIG_GET.transformArguments('*'),
['CONFIG', 'GET', '*'] ['CONFIG', 'GET', '*']
); );
}); });
it('Array', () => {
assert.deepEqual(
CONFIG_GET.transformArguments(['1', '2']),
['CONFIG', 'GET', '1', '2']
);
});
});
testUtils.testWithClient('client.configGet', async client => {
const config = await client.configGet('*');
assert.equal(typeof config, 'object');
for (const [key, value] of Object.entries(config)) {
assert.equal(typeof key, 'string');
assert.equal(typeof value, 'string');
}
}, GLOBAL.SERVERS.OPEN);
}); });

View File

@@ -1,11 +1,14 @@
import { RedisArgument, Command } from '../RESP/types'; import { MapReply, BlobStringReply, Command } from '../RESP/types';
import { transformTuplesReply } from './generic-transformers'; import { RedisVariadicArgument, pushVariadicArguments, transformTuplesReply } from './generic-transformers';
export default { export default {
FIRST_KEY_INDEX: undefined, FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: true, IS_READ_ONLY: true,
transformArguments(parameter: RedisArgument) { transformArguments(parameters: RedisVariadicArgument) {
return ['CONFIG', 'GET', parameter]; return pushVariadicArguments(['CONFIG', 'GET'], parameters);
}, },
transformReply: transformTuplesReply transformReply: {
2: transformTuplesReply,
3: undefined as unknown as () => MapReply<BlobStringReply, BlobStringReply>
}
} as const satisfies Command; } as const satisfies Command;

View File

@@ -1,6 +1,8 @@
import { SimpleStringReply, Command } from '../RESP/types'; import { SimpleStringReply, Command } from '../RESP/types';
export default { export default {
FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: true,
transformArguments() { transformArguments() {
return ['CONFIG', 'RESETSTAT']; return ['CONFIG', 'RESETSTAT'];
}, },

View File

@@ -1,6 +1,8 @@
import { SimpleStringReply, Command } from '../RESP/types'; import { SimpleStringReply, Command } from '../RESP/types';
export default { export default {
FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: true,
transformArguments() { transformArguments() {
return ['CONFIG', 'REWRITE']; return ['CONFIG', 'REWRITE'];
}, },

View File

@@ -1,4 +1,5 @@
import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import CONFIG_SET from './CONFIG_SET'; import CONFIG_SET from './CONFIG_SET';
describe('CONFIG SET', () => { describe('CONFIG SET', () => {
@@ -21,4 +22,11 @@ describe('CONFIG SET', () => {
); );
}); });
}); });
testUtils.testWithClient('client.configSet', async client => {
assert.equal(
await client.configSet('maxmemory', '0'),
'OK'
);
}, GLOBAL.SERVERS.OPEN);
}); });

View File

@@ -5,6 +5,8 @@ type SingleParameter = [parameter: RedisArgument, value: RedisArgument];
type MultipleParameters = [config: Record<string, RedisArgument>]; type MultipleParameters = [config: Record<string, RedisArgument>];
export default { export default {
FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: true,
transformArguments( transformArguments(
...[parameterOrConfig, value]: SingleParameter | MultipleParameters ...[parameterOrConfig, value]: SingleParameter | MultipleParameters
) { ) {

View File

@@ -5,12 +5,12 @@ export const REDIS_FLUSH_MODES = {
SYNC: 'SYNC' SYNC: 'SYNC'
} as const; } as const;
export type RedisFlushModes = typeof REDIS_FLUSH_MODES[keyof typeof REDIS_FLUSH_MODES]; export type RedisFlushMode = typeof REDIS_FLUSH_MODES[keyof typeof REDIS_FLUSH_MODES];
export default { export default {
FIRST_KEY_INDEX: undefined, FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: false, IS_READ_ONLY: false,
transformArguments(mode?: RedisFlushModes) { transformArguments(mode?: RedisFlushMode) {
const args = ['FLUSHALL']; const args = ['FLUSHALL'];
if (mode) { if (mode) {

View File

@@ -1,10 +1,10 @@
import { SimpleStringReply, Command } from '../RESP/types'; import { SimpleStringReply, Command } from '../RESP/types';
import { RedisFlushModes } from './FLUSHALL'; import { RedisFlushMode } from './FLUSHALL';
export default { export default {
FIRST_KEY_INDEX: undefined, FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: false, IS_READ_ONLY: false,
transformArguments(mode?: RedisFlushModes) { transformArguments(mode?: RedisFlushMode) {
const args = ['FLUSHDB']; const args = ['FLUSHDB'];
if (mode) { if (mode) {

View File

@@ -1,10 +1,10 @@
import { SimpleStringReply, Command } from '../RESP/types'; import { SimpleStringReply, Command } from '../RESP/types';
import { RedisFlushModes } from './FLUSHALL'; import { RedisFlushMode } from './FLUSHALL';
export default { export default {
FIRST_KEY_INDEX: undefined, FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: false, IS_READ_ONLY: false,
transformArguments(mode?: RedisFlushModes) { transformArguments(mode?: RedisFlushMode) {
const args = ['FUNCTION', 'FLUSH']; const args = ['FUNCTION', 'FLUSH'];
if (mode) { if (mode) {

View File

@@ -1,18 +1,18 @@
import {strict as assert} from 'assert'; import { strict as assert } from 'assert';
import testUtils, {GLOBAL} from '../test-utils'; import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './LATENCY_DOCTOR'; import LATENCY_DOCTOR from './LATENCY_DOCTOR';
describe('LATENCY DOCTOR', () => { describe('LATENCY DOCTOR', () => {
it('transformArguments', () => { it('transformArguments', () => {
assert.deepEqual( assert.deepEqual(
transformArguments(), LATENCY_DOCTOR.transformArguments(),
['LATENCY', 'DOCTOR'] ['LATENCY', 'DOCTOR']
); );
}); });
testUtils.testWithClient('client.latencyDoctor', async client => { testUtils.testWithClient('client.latencyDoctor', async client => {
assert.equal( assert.equal(
typeof (await client.latencyDoctor()), typeof await client.latencyDoctor(),
'string' 'string'
); );
}, GLOBAL.SERVERS.OPEN); }, GLOBAL.SERVERS.OPEN);

View File

@@ -1,5 +1,10 @@
export function transformArguments(): Array<string> { import { BlobStringReply, Command } from '../RESP/types';
return ['LATENCY', 'DOCTOR'];
}
export declare function transformReply(): string; export default {
FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: true,
transformArguments() {
return ['LATENCY', 'DOCTOR'];
},
transformReply: undefined as unknown as () => BlobStringReply
} as const satisfies Command;

View File

@@ -1,11 +1,11 @@
import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils'; import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './LATENCY_GRAPH'; import LATENCY_GRAPH from './LATENCY_GRAPH';
describe('LATENCY GRAPH', () => { describe('LATENCY GRAPH', () => {
it('transformArguments', () => { it('transformArguments', () => {
assert.deepEqual( assert.deepEqual(
transformArguments('command'), LATENCY_GRAPH.transformArguments('command'),
[ [
'LATENCY', 'LATENCY',
'GRAPH', 'GRAPH',

View File

@@ -1,25 +1,31 @@
// import { RedisCommandArguments } from '.'; import { SimpleStringReply, Command, BlobStringReply } from '../RESP/types';
// export type EventType = export const LATENCY_EVENTS = {
// 'active-defrag-cycle' ACTIVE_DEFRAG_CYCLE: 'active-defrag-cycle',
// | 'aof-fsync-always' AOF_FSYNC_ALWAYS: 'aof-fsync-always',
// | 'aof-stat' AOF_STAT: 'aof-stat',
// | 'aof-rewrite-diff-write' AOF_REWRITE_DIFF_WRITE: 'aof-rewrite-diff-write',
// | 'aof-rename' AOF_RENAME: 'aof-rename',
// | 'aof-write' AOF_WRITE: 'aof-write',
// | 'aof-write-active-child' AOF_WRITE_ACTIVE_CHILD: 'aof-write-active-child',
// | 'aof-write-alone' AOF_WRITE_ALONE: 'aof-write-alone',
// | 'aof-write-pending-fsync' AOF_WRITE_PENDING_FSYNC: 'aof-write-pending-fsync',
// | 'command' COMMAND: 'command',
// | 'expire-cycle' EXPIRE_CYCLE: 'expire-cycle',
// | 'eviction-cycle' EVICTION_CYCLE: 'eviction-cycle',
// | 'eviction-del' EVICTION_DEL: 'eviction-del',
// | 'fast-command' FAST_COMMAND: 'fast-command',
// | 'fork' FORK: 'fork',
// | 'rdb-unlink-temp-file'; RDB_UNLINK_TEMP_FILE: 'rdb-unlink-temp-file'
} as const;
// export function transformArguments(event: EventType): RedisCommandArguments { export type LatencyEvent = typeof LATENCY_EVENTS[keyof typeof LATENCY_EVENTS];
// return ['LATENCY', 'GRAPH', event];
// }
// export declare function transformReply(): string; export default {
FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: true,
transformArguments(event: LatencyEvent) {
return ['LATENCY', 'GRAPH', event];
},
transformReply: undefined as unknown as () => BlobStringReply
} as const satisfies Command;

View File

@@ -1,27 +1,27 @@
// import {strict as assert} from 'assert'; import { strict as assert } from 'assert';
// import testUtils, {GLOBAL} from '../test-utils'; import testUtils, { GLOBAL } from '../test-utils';
// import { transformArguments } from './LATENCY_LATEST'; import LATENCY_LATEST from './LATENCY_LATEST';
// describe('LATENCY LATEST', () => { describe('LATENCY LATEST', () => {
// it('transformArguments', () => { it('transformArguments', () => {
// assert.deepEqual( assert.deepEqual(
// transformArguments(), LATENCY_LATEST.transformArguments(),
// ['LATENCY', 'LATEST'] ['LATENCY', 'LATEST']
// ); );
// }); });
// testUtils.testWithClient('client.latencyLatest', async client => { testUtils.testWithClient('client.latencyLatest', async client => {
// await Promise.all([ await Promise.all([
// client.configSet('latency-monitor-threshold', '100'), client.configSet('latency-monitor-threshold', '100'),
// client.sendCommand(['DEBUG', 'SLEEP', '1']) client.sendCommand(['DEBUG', 'SLEEP', '1'])
// ]); ]);
// const latency = await client.latencyLatest(); const latency = await client.latencyLatest();
// assert.ok(Array.isArray(latency)); assert.ok(Array.isArray(latency));
// for (const [name, timestamp, latestLatency, allTimeLatency] of latency) { for (const [name, timestamp, latestLatency, allTimeLatency] of latency) {
// assert.equal(typeof name, 'string'); assert.equal(typeof name, 'string');
// assert.equal(typeof timestamp, 'number'); assert.equal(typeof timestamp, 'number');
// assert.equal(typeof latestLatency, 'number'); assert.equal(typeof latestLatency, 'number');
// assert.equal(typeof allTimeLatency, 'number'); assert.equal(typeof allTimeLatency, 'number');
// } }
// }, GLOBAL.SERVERS.OPEN); }, GLOBAL.SERVERS.OPEN);
// }); });

View File

@@ -1,12 +1,16 @@
// import { RedisCommandArguments } from '.'; import { ArrayReply, BlobStringReply, NumberReply, Command } from '../RESP/types';
// export function transformArguments(): RedisCommandArguments { export default {
// return ['LATENCY', 'LATEST']; FIRST_KEY_INDEX: undefined,
// } IS_READ_ONLY: true,
transformArguments() {
return ['LATENCY', 'LATEST'];
},
transformReply: undefined as unknown as () => ArrayReply<[
name: BlobStringReply,
timestamp: NumberReply,
latestLatency: NumberReply,
allTimeLatency: NumberReply
]>
} as const satisfies Command;
// export declare function transformReply(): Array<[
// name: string,
// timestamp: number,
// latestLatency: number,
// allTimeLatency: number
// ]>;

View File

@@ -1,43 +1,43 @@
// import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
// import testUtils, { GLOBAL } from '../test-utils'; import testUtils, { GLOBAL } from '../test-utils';
// import MEMORY_STATS from './MEMORY_STATS'; import MEMORY_STATS from './MEMORY_STATS';
// describe('MEMORY STATS', () => { describe('MEMORY STATS', () => {
// it('transformArguments', () => { it('transformArguments', () => {
// assert.deepEqual( assert.deepEqual(
// MEMORY_STATS.transformArguments(), MEMORY_STATS.transformArguments(),
// ['MEMORY', 'STATS'] ['MEMORY', 'STATS']
// ); );
// }); });
// testUtils.testWithClient('client.memoryStats', async client => { testUtils.testWithClient('client.memoryStats', async client => {
// const memoryStats = await client.memoryStats(); const memoryStats = await client.memoryStats();
// assert.equal(typeof memoryStats['peak.allocated'], 'number'); assert.equal(typeof memoryStats['peak.allocated'], 'number');
// assert.equal(typeof memoryStats['total.allocated'], 'number'); assert.equal(typeof memoryStats['total.allocated'], 'number');
// assert.equal(typeof memoryStats['startup.allocated'], 'number'); assert.equal(typeof memoryStats['startup.allocated'], 'number');
// assert.equal(typeof memoryStats['replication.backlog'], 'number'); assert.equal(typeof memoryStats['replication.backlog'], 'number');
// assert.equal(typeof memoryStats['clients.slaves'], 'number'); assert.equal(typeof memoryStats['clients.slaves'], 'number');
// assert.equal(typeof memoryStats['clients.normal'], 'number'); assert.equal(typeof memoryStats['clients.normal'], 'number');
// assert.equal(typeof memoryStats['cluster.links'], 'number'); assert.equal(typeof memoryStats['cluster.links'], 'number');
// assert.equal(typeof memoryStats['aof.buffer'], 'number'); assert.equal(typeof memoryStats['aof.buffer'], 'number');
// assert.equal(typeof memoryStats['lua.caches'], 'number'); assert.equal(typeof memoryStats['lua.caches'], 'number');
// assert.equal(typeof memoryStats['functions.caches'], 'number'); assert.equal(typeof memoryStats['functions.caches'], 'number');
// assert.equal(typeof memoryStats['overhead.total'], 'number'); assert.equal(typeof memoryStats['overhead.total'], 'number');
// assert.equal(typeof memoryStats['keys.count'], 'number'); assert.equal(typeof memoryStats['keys.count'], 'number');
// assert.equal(typeof memoryStats['keys.bytes-per-key'], 'number'); assert.equal(typeof memoryStats['keys.bytes-per-key'], 'number');
// assert.equal(typeof memoryStats['dataset.bytes'], 'number'); assert.equal(typeof memoryStats['dataset.bytes'], 'number');
// assert.equal(typeof memoryStats['dataset.percentage'], 'string'); assert.equal(typeof memoryStats['dataset.percentage'], 'string');
// assert.equal(typeof memoryStats['peak.percentage'], 'string'); assert.equal(typeof memoryStats['peak.percentage'], 'string');
// assert.equal(typeof memoryStats['allocator.allocated'], 'number'); assert.equal(typeof memoryStats['allocator.allocated'], 'number');
// assert.equal(typeof memoryStats['allocator.active'], 'number'); assert.equal(typeof memoryStats['allocator.active'], 'number');
// assert.equal(typeof memoryStats['allocator.resident'], 'number'); assert.equal(typeof memoryStats['allocator.resident'], 'number');
// assert.equal(typeof memoryStats['allocator-fragmentation.ratio'], 'string'); assert.equal(typeof memoryStats['allocator-fragmentation.ratio'], 'string');
// assert.equal(typeof memoryStats['allocator-fragmentation.bytes'], 'number'); assert.equal(typeof memoryStats['allocator-fragmentation.bytes'], 'number');
// assert.equal(typeof memoryStats['allocator-rss.ratio'], 'string'); assert.equal(typeof memoryStats['allocator-rss.ratio'], 'string');
// assert.equal(typeof memoryStats['allocator-rss.bytes'], 'number'); assert.equal(typeof memoryStats['allocator-rss.bytes'], 'number');
// assert.equal(typeof memoryStats['rss-overhead.ratio'], 'string'); assert.equal(typeof memoryStats['rss-overhead.ratio'], 'string');
// assert.equal(typeof memoryStats['rss-overhead.bytes'], 'number'); assert.equal(typeof memoryStats['rss-overhead.bytes'], 'number');
// assert.equal(typeof memoryStats['fragmentation'], 'string'); assert.equal(typeof memoryStats['fragmentation'], 'string');
// assert.equal(typeof memoryStats['fragmentation.bytes'], 'number'); assert.equal(typeof memoryStats['fragmentation.bytes'], 'number');
// }, GLOBAL.SERVERS.OPEN); }, GLOBAL.SERVERS.OPEN);
// }); });

View File

@@ -1,53 +1,53 @@
// import { TuplesToMapReply, BlobStringReply, NumberReply, DoubleReply, Command, Resp2Reply } from '../RESP/types'; import { TuplesToMapReply, BlobStringReply, NumberReply, DoubleReply, Command, Resp2Reply } from '../RESP/types';
// export type MemoryStatsReply = TuplesToMapReply<[ export type MemoryStatsReply = TuplesToMapReply<[
// [BlobStringReply<'peak.allocated'>, NumberReply], [BlobStringReply<'peak.allocated'>, NumberReply],
// [BlobStringReply<'total.allocated'>, NumberReply], [BlobStringReply<'total.allocated'>, NumberReply],
// [BlobStringReply<'startup.allocated'>, NumberReply], [BlobStringReply<'startup.allocated'>, NumberReply],
// [BlobStringReply<'replication.backlog'>, NumberReply], [BlobStringReply<'replication.backlog'>, NumberReply],
// [BlobStringReply<'clients.slaves'>, NumberReply], [BlobStringReply<'clients.slaves'>, NumberReply],
// [BlobStringReply<'clients.normal'>, NumberReply], [BlobStringReply<'clients.normal'>, NumberReply],
// [BlobStringReply<'cluster.links'>, NumberReply], [BlobStringReply<'cluster.links'>, NumberReply],
// [BlobStringReply<'aof.buffer'>, NumberReply], [BlobStringReply<'aof.buffer'>, NumberReply],
// [BlobStringReply<'lua.caches'>, NumberReply], [BlobStringReply<'lua.caches'>, NumberReply],
// [BlobStringReply<'functions.caches'>, NumberReply], [BlobStringReply<'functions.caches'>, NumberReply],
// [BlobStringReply<'overhead.total'>, NumberReply], [BlobStringReply<'overhead.total'>, NumberReply],
// [BlobStringReply<'keys.count'>, NumberReply], [BlobStringReply<'keys.count'>, NumberReply],
// [BlobStringReply<'keys.bytes-per-key'>, NumberReply], [BlobStringReply<'keys.bytes-per-key'>, NumberReply],
// [BlobStringReply<'dataset.bytes'>, NumberReply], [BlobStringReply<'dataset.bytes'>, NumberReply],
// [BlobStringReply<'dataset.percentage'>, DoubleReply], [BlobStringReply<'dataset.percentage'>, DoubleReply],
// [BlobStringReply<'peak.percentage'>, DoubleReply], [BlobStringReply<'peak.percentage'>, DoubleReply],
// [BlobStringReply<'allocator.allocated'>, NumberReply], [BlobStringReply<'allocator.allocated'>, NumberReply],
// [BlobStringReply<'allocator.active'>, NumberReply], [BlobStringReply<'allocator.active'>, NumberReply],
// [BlobStringReply<'allocator.resident'>, NumberReply], [BlobStringReply<'allocator.resident'>, NumberReply],
// [BlobStringReply<'allocator-fragmentation.ratio'>, DoubleReply], [BlobStringReply<'allocator-fragmentation.ratio'>, DoubleReply],
// [BlobStringReply<'allocator-fragmentation.bytes'>, NumberReply], [BlobStringReply<'allocator-fragmentation.bytes'>, NumberReply],
// [BlobStringReply<'allocator-rss.ratio'>, DoubleReply], [BlobStringReply<'allocator-rss.ratio'>, DoubleReply],
// [BlobStringReply<'allocator-rss.bytes'>, NumberReply], [BlobStringReply<'allocator-rss.bytes'>, NumberReply],
// [BlobStringReply<'rss-overhead.ratio'>, DoubleReply], [BlobStringReply<'rss-overhead.ratio'>, DoubleReply],
// [BlobStringReply<'rss-overhead.bytes'>, NumberReply], [BlobStringReply<'rss-overhead.bytes'>, NumberReply],
// [BlobStringReply<'fragmentation'>, DoubleReply], [BlobStringReply<'fragmentation'>, DoubleReply],
// [BlobStringReply<'fragmentation.bytes'>, NumberReply] [BlobStringReply<'fragmentation.bytes'>, NumberReply]
// ]>; ]>;
// export default { export default {
// FIRST_KEY_INDEX: undefined, FIRST_KEY_INDEX: undefined,
// IS_READ_ONLY: true, IS_READ_ONLY: true,
// transformArguments() { transformArguments() {
// return ['MEMORY', 'STATS']; return ['MEMORY', 'STATS'];
// }, },
// transformReply: { transformReply: {
// 2: (rawReply: Array<BlobStringReply | NumberReply>) => { 2: (rawReply: Array<BlobStringReply | NumberReply>) => {
// const reply: Partial<Resp2Reply<MemoryStatsReply['DEFAULT']>> = {}; const reply: Partial<Resp2Reply<MemoryStatsReply['DEFAULT']>> = {};
// let i = 0; let i = 0;
// while (i < rawReply.length) { while (i < rawReply.length) {
// const key = rawReply[i++] as keyof MemoryStatsReply['DEFAULT']; const key = rawReply[i++] as keyof MemoryStatsReply['DEFAULT'];
// reply[key] = rawReply[i++] as any; reply[key] = rawReply[i++] as any;
// } }
// return reply as MemoryStatsReply['DEFAULT']; return reply as MemoryStatsReply['DEFAULT'];
// }, },
// 3: undefined as unknown as () => MemoryStatsReply 3: undefined as unknown as () => MemoryStatsReply
// } }
// } as const satisfies Command; } as const satisfies Command;

View File

@@ -1,11 +1,11 @@
import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils'; import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments, transformReply } from './ROLE'; import ROLE from './ROLE';
describe('ROLE', () => { describe('ROLE', () => {
it('transformArguments', () => { it('transformArguments', () => {
assert.deepEqual( assert.deepEqual(
transformArguments(), ROLE.transformArguments(),
['ROLE'] ['ROLE']
); );
}); });
@@ -13,16 +13,16 @@ describe('ROLE', () => {
describe('transformReply', () => { describe('transformReply', () => {
it('master', () => { it('master', () => {
assert.deepEqual( assert.deepEqual(
transformReply(['master', 3129659, [['127.0.0.1', '9001', '3129242'], ['127.0.0.1', '9002', '3129543']]]), ROLE.transformReply(['master', 3129659, [['127.0.0.1', '9001', '3129242'], ['127.0.0.1', '9002', '3129543']]] as any),
{ {
role: 'master', role: 'master',
replicationOffest: 3129659, replicationOffest: 3129659,
replicas: [{ replicas: [{
ip: '127.0.0.1', host: '127.0.0.1',
port: 9001, port: 9001,
replicationOffest: 3129242 replicationOffest: 3129242
}, { }, {
ip: '127.0.0.1', host: '127.0.0.1',
port: 9002, port: 9002,
replicationOffest: 3129543 replicationOffest: 3129543
}] }]
@@ -32,11 +32,11 @@ describe('ROLE', () => {
it('replica', () => { it('replica', () => {
assert.deepEqual( assert.deepEqual(
transformReply(['slave', '127.0.0.1', 9000, 'connected', 3167038]), ROLE.transformReply(['slave', '127.0.0.1', 9000, 'connected', 3167038] as any),
{ {
role: 'slave', role: 'slave',
master: { master: {
ip: '127.0.0.1', host: '127.0.0.1',
port: 9000 port: 9000
}, },
state: 'connected', state: 'connected',
@@ -47,7 +47,7 @@ describe('ROLE', () => {
it('sentinel', () => { it('sentinel', () => {
assert.deepEqual( assert.deepEqual(
transformReply(['sentinel', ['resque-master', 'html-fragments-master', 'stats-master', 'metadata-master']]), ROLE.transformReply(['sentinel', ['resque-master', 'html-fragments-master', 'stats-master', 'metadata-master']] as any),
{ {
role: 'sentinel', role: 'sentinel',
masterNames: ['resque-master', 'html-fragments-master', 'stats-master', 'metadata-master'] masterNames: ['resque-master', 'html-fragments-master', 'stats-master', 'metadata-master']

View File

@@ -3,7 +3,7 @@ import { ArrayReply, BlobStringReply, Command, NumberReply } from '../RESP/types
type MasterRole = [ type MasterRole = [
role: BlobStringReply<'master'>, role: BlobStringReply<'master'>,
replicationOffest: NumberReply, replicationOffest: NumberReply,
replicas: ArrayReply<[host: BlobStringReply, port: NumberReply, replicationOffest: NumberReply]>, replicas: ArrayReply<[host: BlobStringReply, port: BlobStringReply, replicationOffest: BlobStringReply]>
]; ];
type SlaveRole = [ type SlaveRole = [
@@ -36,8 +36,8 @@ export default {
replicationOffest, replicationOffest,
replicas: replicas.map(([host, port, replicationOffest]) => ({ replicas: replicas.map(([host, port, replicationOffest]) => ({
host, host,
port, port: Number(port),
replicationOffest, replicationOffest: Number(replicationOffest)
})), })),
}; };
} }
@@ -48,7 +48,7 @@ export default {
role, role,
master: { master: {
host: masterHost, host: masterHost,
port: masterPort, port: masterPort
}, },
state, state,
dataReceived, dataReceived,
@@ -59,7 +59,7 @@ export default {
const [role, masterNames] = reply as SentinelRole; const [role, masterNames] = reply as SentinelRole;
return { return {
role, role,
masterNames, masterNames
}; };
} }
} }

View File

@@ -1,27 +1,49 @@
// import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
// import { transformArguments } from './SHUTDOWN'; import SHUTDOWN from './SHUTDOWN';
// describe('SHUTDOWN', () => { describe('SHUTDOWN', () => {
// describe('transformArguments', () => { describe('transformArguments', () => {
// it('simple', () => { it('simple', () => {
// assert.deepEqual( assert.deepEqual(
// transformArguments(), SHUTDOWN.transformArguments(),
// ['SHUTDOWN'] ['SHUTDOWN']
// ); );
// }); });
// it('NOSAVE', () => { it('with mode', () => {
// assert.deepEqual( assert.deepEqual(
// transformArguments('NOSAVE'), SHUTDOWN.transformArguments({
// ['SHUTDOWN', 'NOSAVE'] mode: 'NOSAVE'
// ); }),
// }); ['SHUTDOWN', 'NOSAVE']
);
});
// it('SAVE', () => { it('with NOW', () => {
// assert.deepEqual( assert.deepEqual(
// transformArguments('SAVE'), SHUTDOWN.transformArguments({
// ['SHUTDOWN', 'SAVE'] NOW: true
// ); }),
// }); ['SHUTDOWN', 'NOW']
// }); );
// }); });
it('with FORCE', () => {
assert.deepEqual(
SHUTDOWN.transformArguments({
FORCE: true
}),
['SHUTDOWN', 'FORCE']
);
});
it('with ABORT', () => {
assert.deepEqual(
SHUTDOWN.transformArguments({
ABORT: true
}),
['SHUTDOWN', 'ABORT']
);
});
});
});

View File

@@ -1,11 +1,35 @@
// export function transformArguments(mode?: 'NOSAVE' | 'SAVE'): Array<string> { import { SimpleStringReply, Command } from '../RESP/types';
// const args = ['SHUTDOWN'];
// if (mode) { export interface ShutdownOptions {
// args.push(mode); mode?: 'NOSAVE' | 'SAVE';
// } NOW?: boolean;
FORCE?: boolean;
ABORT?: boolean;
}
// return args; export default {
// } FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: false,
transformArguments(options?: ShutdownOptions) {
const args = ['SHUTDOWN']
// export declare function transformReply(): void; if (options?.mode) {
args.push(options.mode);
}
if (options?.NOW) {
args.push('NOW');
}
if (options?.FORCE) {
args.push('FORCE');
}
if (options?.ABORT) {
args.push('ABORT');
}
return args;
},
transformReply: undefined as unknown as () => void | SimpleStringReply
} as const satisfies Command;

View File

@@ -1,19 +1,19 @@
// import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
// import testUtils, { GLOBAL } from '../test-utils'; import testUtils, { GLOBAL } from '../test-utils';
// import { transformArguments } from './SWAPDB'; import SWAPDB from './SWAPDB';
// describe('SWAPDB', () => { describe('SWAPDB', () => {
// it('transformArguments', () => { it('transformArguments', () => {
// assert.deepEqual( assert.deepEqual(
// transformArguments(0, 1), SWAPDB.transformArguments(0, 1),
// ['SWAPDB', '0', '1'] ['SWAPDB', '0', '1']
// ); );
// }); });
// testUtils.testWithClient('client.swapDb', async client => { testUtils.testWithClient('client.swapDb', async client => {
// assert.equal( assert.equal(
// await client.swapDb(0, 1), await client.swapDb(0, 1),
// 'OK' 'OK'
// ); );
// }, GLOBAL.SERVERS.OPEN); }, GLOBAL.SERVERS.OPEN);
// }); });

View File

@@ -1,5 +1,11 @@
// export function transformArguments(index1: number, index2: number): Array<string> { import { SimpleStringReply, Command } from '../RESP/types';
// return ['SWAPDB', index1.toString(), index2.toString()];
// } export default {
FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: false,
transformArguments(index1: number, index2: number) {
return ['SWAPDB', index1.toString(), index2.toString()];
},
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
} as const satisfies Command;
// export declare function transformReply(): string;

View File

@@ -1,18 +1,19 @@
// import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
// import testUtils, { GLOBAL } from '../test-utils'; import testUtils, { GLOBAL } from '../test-utils';
// import { transformArguments } from './TIME'; import TIME from './TIME';
// describe('TIME', () => { describe('TIME', () => {
// it('transformArguments', () => { it('transformArguments', () => {
// assert.deepEqual( assert.deepEqual(
// transformArguments(), TIME.transformArguments(),
// ['TIME'] ['TIME']
// ); );
// }); });
// testUtils.testWithClient('client.time', async client => { testUtils.testWithClient('client.time', async client => {
// const reply = await client.time(); const reply = await client.time();
// assert.ok(reply instanceof Date); assert.ok(Array.isArray(reply));
// assert.ok(typeof reply.microseconds === 'number'); assert.equal(typeof reply[0], 'string');
// }, GLOBAL.SERVERS.OPEN); assert.equal(typeof reply[1], 'string');
// }); }, GLOBAL.SERVERS.OPEN);
});

View File

@@ -1,15 +1,13 @@
// export function transformArguments(): Array<string> { import { BlobStringReply, Command } from '../RESP/types';
// return ['TIME'];
// }
// interface TimeReply extends Date { export default {
// microseconds: number; FIRST_KEY_INDEX: undefined,
// } IS_READ_ONLY: true,
transformArguments() {
// export function transformReply(reply: [string, string]): TimeReply { return ['TIME'];
// const seconds = Number(reply[0]), },
// microseconds = Number(reply[1]), transformReply: undefined as unknown as () => [
// d: Partial<TimeReply> = new Date(seconds * 1000 + microseconds / 1000); unixTimestamp: BlobStringReply<`${number}`>,
// d.microseconds = microseconds; microseconds: BlobStringReply<`${number}`>
// return d as TimeReply; ]
// } } as const satisfies Command;

View File

@@ -52,7 +52,7 @@ import CLUSTER_FORGET from './CLUSTER_FORGET';
import CLUSTER_GETKEYSINSLOT from './CLUSTER_GETKEYSINSLOT'; import CLUSTER_GETKEYSINSLOT from './CLUSTER_GETKEYSINSLOT';
// import CLUSTER_INFO from './CLUSTER_INFO'; // import CLUSTER_INFO from './CLUSTER_INFO';
import CLUSTER_KEYSLOT from './CLUSTER_KEYSLOT'; import CLUSTER_KEYSLOT from './CLUSTER_KEYSLOT';
// import CLUSTER_LINKS from './CLUSTER_LINKS'; import CLUSTER_LINKS from './CLUSTER_LINKS';
import CLUSTER_MEET from './CLUSTER_MEET'; import CLUSTER_MEET from './CLUSTER_MEET';
import CLUSTER_MYID from './CLUSTER_MYID'; import CLUSTER_MYID from './CLUSTER_MYID';
// import CLUSTER_NODES from './CLUSTER_NODES'; // import CLUSTER_NODES from './CLUSTER_NODES';
@@ -63,6 +63,10 @@ import CLUSTER_SAVECONFIG from './CLUSTER_SAVECONFIG';
import CLUSTER_SET_CONFIG_EPOCH from './CLUSTER_SET-CONFIG-EPOCH'; import CLUSTER_SET_CONFIG_EPOCH from './CLUSTER_SET-CONFIG-EPOCH';
import CLUSTER_SETSLOT from './CLUSTER_SETSLOT'; import CLUSTER_SETSLOT from './CLUSTER_SETSLOT';
import CLUSTER_SLOTS from './CLUSTER_SLOTS'; import CLUSTER_SLOTS from './CLUSTER_SLOTS';
import CONFIG_GET from './CONFIG_GET';
import CONFIG_RESETASTAT from './CONFIG_RESETSTAT';
import CONFIG_REWRITE from './CONFIG_REWRITE';
import CONFIG_SET from './CONFIG_SET';
import COPY from './COPY'; import COPY from './COPY';
import DBSIZE from './DBSIZE'; import DBSIZE from './DBSIZE';
import DECR from './DECR'; import DECR from './DECR';
@@ -138,6 +142,9 @@ import INCRBYFLOAT from './INCRBYFLOAT';
import INFO from './INFO'; import INFO from './INFO';
import KEYS from './KEYS'; import KEYS from './KEYS';
import LASTSAVE from './LASTSAVE'; import LASTSAVE from './LASTSAVE';
import LATENCY_DOCTOR from './LATENCY_DOCTOR';
import LATENCY_GRAPH from './LATENCY_GRAPH';
import LATENCY_LATEST from './LATENCY_LATEST';
import LCS_IDX_WITHMATCHLEN from './LCS_IDX_WITHMATCHLEN'; import LCS_IDX_WITHMATCHLEN from './LCS_IDX_WITHMATCHLEN';
import LCS_IDX from './LCS_IDX'; import LCS_IDX from './LCS_IDX';
import LCS_LEN from './LCS_LEN'; import LCS_LEN from './LCS_LEN';
@@ -161,7 +168,7 @@ import LTRIM from './LTRIM';
import MEMORY_DOCTOR from './MEMORY_DOCTOR'; import MEMORY_DOCTOR from './MEMORY_DOCTOR';
import MEMORY_MALLOC_STATS from './MEMORY_MALLOC-STATS'; import MEMORY_MALLOC_STATS from './MEMORY_MALLOC-STATS';
import MEMORY_PURGE from './MEMORY_PURGE'; import MEMORY_PURGE from './MEMORY_PURGE';
// import MEMORY_STATS from './MEMORY_STATS'; import MEMORY_STATS from './MEMORY_STATS';
import MEMORY_USAGE from './MEMORY_USAGE'; import MEMORY_USAGE from './MEMORY_USAGE';
import MGET from './MGET'; import MGET from './MGET';
import MODULE_LIST from './MODULE_LIST'; import MODULE_LIST from './MODULE_LIST';
@@ -193,6 +200,7 @@ import RANDOMKEY from './RANDOMKEY';
import READONLY from './READONLY'; import READONLY from './READONLY';
import RENAME from './RENAME'; import RENAME from './RENAME';
import RENAMENX from './RENAMENX'; import RENAMENX from './RENAMENX';
import ROLE from './ROLE';
import RPOP_COUNT from './RPOP_COUNT'; import RPOP_COUNT from './RPOP_COUNT';
import RPOP from './RPOP'; import RPOP from './RPOP';
import RPOPLPUSH from './RPOPLPUSH'; import RPOPLPUSH from './RPOPLPUSH';
@@ -233,6 +241,8 @@ import SSCAN from './SSCAN';
import STRLEN from './STRLEN'; import STRLEN from './STRLEN';
import SUNION from './SUNION'; import SUNION from './SUNION';
import SUNIONSTORE from './SUNIONSTORE'; import SUNIONSTORE from './SUNIONSTORE';
import SWAPDB from './SWAPDB';
import TIME from './TIME';
import TOUCH from './TOUCH'; import TOUCH from './TOUCH';
import TTL from './TTL'; import TTL from './TTL';
import TYPE from './TYPE'; import TYPE from './TYPE';
@@ -335,7 +345,7 @@ type CLUSTER_FORGET = typeof import('./CLUSTER_FORGET').default;
type CLUSTER_GETKEYSINSLOT = typeof import('./CLUSTER_GETKEYSINSLOT').default; type CLUSTER_GETKEYSINSLOT = typeof import('./CLUSTER_GETKEYSINSLOT').default;
// type CLUSTER_INFO = typeof import('./CLUSTER_INFO').default; // type CLUSTER_INFO = typeof import('./CLUSTER_INFO').default;
type CLUSTER_KEYSLOT = typeof import('./CLUSTER_KEYSLOT').default; type CLUSTER_KEYSLOT = typeof import('./CLUSTER_KEYSLOT').default;
// type CLUSTER_LINKS = typeof import('./CLUSTER_LINKS').default; type CLUSTER_LINKS = typeof import('./CLUSTER_LINKS').default;
type CLUSTER_MEET = typeof import('./CLUSTER_MEET').default; type CLUSTER_MEET = typeof import('./CLUSTER_MEET').default;
type CLUSTER_MYID = typeof import('./CLUSTER_MYID').default; type CLUSTER_MYID = typeof import('./CLUSTER_MYID').default;
// type CLUSTER_NODES = typeof import('./CLUSTER_NODES').default; // type CLUSTER_NODES = typeof import('./CLUSTER_NODES').default;
@@ -346,6 +356,10 @@ type CLUSTER_SAVECONFIG = typeof import('./CLUSTER_SAVECONFIG').default;
type CLUSTER_SET_CONFIG_EPOCH = typeof import('./CLUSTER_SET-CONFIG-EPOCH').default; type CLUSTER_SET_CONFIG_EPOCH = typeof import('./CLUSTER_SET-CONFIG-EPOCH').default;
type CLUSTER_SETSLOT = typeof import('./CLUSTER_SETSLOT').default; type CLUSTER_SETSLOT = typeof import('./CLUSTER_SETSLOT').default;
type CLUSTER_SLOTS = typeof import('./CLUSTER_SLOTS').default; type CLUSTER_SLOTS = typeof import('./CLUSTER_SLOTS').default;
type CONFIG_GET = typeof import('./CONFIG_GET').default;
type CONFIG_RESETASTAT = typeof import('./CONFIG_RESETSTAT').default;
type CONFIG_REWRITE = typeof import('./CONFIG_REWRITE').default;
type CONFIG_SET = typeof import('./CONFIG_SET').default;
type COPY = typeof import('./COPY').default; type COPY = typeof import('./COPY').default;
type DBSIZE = typeof DBSIZE; type DBSIZE = typeof DBSIZE;
type DECR = typeof import('./DECR').default; type DECR = typeof import('./DECR').default;
@@ -421,6 +435,9 @@ type INCRBYFLOAT = typeof import('./INCRBYFLOAT').default;
type INFO = typeof import('./INFO').default; type INFO = typeof import('./INFO').default;
type KEYS = typeof import('./KEYS').default; type KEYS = typeof import('./KEYS').default;
type LASTSAVE = typeof import('./LASTSAVE').default; type LASTSAVE = typeof import('./LASTSAVE').default;
type LATENCY_DOCTOR = typeof import('./LATENCY_DOCTOR').default;
type LATENCY_GRAPH = typeof import('./LATENCY_GRAPH').default;
type LATENCY_LATEST = typeof import('./LATENCY_LATEST').default;
type LCS_IDX_WITHMATCHLEN = typeof import('./LCS_IDX_WITHMATCHLEN').default; type LCS_IDX_WITHMATCHLEN = typeof import('./LCS_IDX_WITHMATCHLEN').default;
type LCS_IDX = typeof import('./LCS_IDX').default; type LCS_IDX = typeof import('./LCS_IDX').default;
type LCS_LEN = typeof import('./LCS_LEN').default; type LCS_LEN = typeof import('./LCS_LEN').default;
@@ -444,7 +461,7 @@ type LTRIM = typeof import('./LTRIM').default;
type MEMORY_DOCTOR = typeof import('./MEMORY_DOCTOR').default; type MEMORY_DOCTOR = typeof import('./MEMORY_DOCTOR').default;
type MEMORY_MALLOC_STATS = typeof import('./MEMORY_MALLOC-STATS').default; type MEMORY_MALLOC_STATS = typeof import('./MEMORY_MALLOC-STATS').default;
type MEMORY_PURGE = typeof import('./MEMORY_PURGE').default; type MEMORY_PURGE = typeof import('./MEMORY_PURGE').default;
// type MEMORY_STATS = typeof import('./MEMORY_STATS').default; type MEMORY_STATS = typeof import('./MEMORY_STATS').default;
type MEMORY_USAGE = typeof import('./MEMORY_USAGE').default; type MEMORY_USAGE = typeof import('./MEMORY_USAGE').default;
type MGET = typeof import('./MGET').default; type MGET = typeof import('./MGET').default;
type MODULE_LIST = typeof import('./MODULE_LIST').default; type MODULE_LIST = typeof import('./MODULE_LIST').default;
@@ -477,6 +494,7 @@ type READONLY = typeof import('./READONLY').default;
type RENAME = typeof import('./RENAME').default; type RENAME = typeof import('./RENAME').default;
type RENAMENX = typeof import('./RENAMENX').default; type RENAMENX = typeof import('./RENAMENX').default;
type RPOP_COUNT = typeof import('./RPOP_COUNT').default; type RPOP_COUNT = typeof import('./RPOP_COUNT').default;
type ROLE = typeof import('./ROLE').default;
type RPOP = typeof import('./RPOP').default; type RPOP = typeof import('./RPOP').default;
type RPOPLPUSH = typeof import('./RPOPLPUSH').default; type RPOPLPUSH = typeof import('./RPOPLPUSH').default;
type RPUSH = typeof import('./RPUSH').default; type RPUSH = typeof import('./RPUSH').default;
@@ -516,6 +534,8 @@ type SSCAN = typeof import('./SSCAN').default;
type STRLEN = typeof import('./STRLEN').default; type STRLEN = typeof import('./STRLEN').default;
type SUNION = typeof import('./SUNION').default; type SUNION = typeof import('./SUNION').default;
type SUNIONSTORE = typeof import('./SUNIONSTORE').default; type SUNIONSTORE = typeof import('./SUNIONSTORE').default;
type SWAPDB = typeof import('./SWAPDB').default;
type TIME = typeof import('./TIME').default;
type TOUCH = typeof import('./TOUCH').default; type TOUCH = typeof import('./TOUCH').default;
type TTL = typeof import('./TTL').default; type TTL = typeof import('./TTL').default;
type TYPE = typeof import('./TYPE').default; type TYPE = typeof import('./TYPE').default;
@@ -672,8 +692,8 @@ type Commands = {
// clusterInfo: CLUSTER_INFO; // clusterInfo: CLUSTER_INFO;
CLUSTER_KEYSLOT: CLUSTER_KEYSLOT; CLUSTER_KEYSLOT: CLUSTER_KEYSLOT;
clusterKeySlot: CLUSTER_KEYSLOT; clusterKeySlot: CLUSTER_KEYSLOT;
// CLUSTER_LINKS: CLUSTER_LINKS; CLUSTER_LINKS: CLUSTER_LINKS;
// clusterLinks: CLUSTER_LINKS; clusterLinks: CLUSTER_LINKS;
CLUSTER_MEET: CLUSTER_MEET; CLUSTER_MEET: CLUSTER_MEET;
clusterMeet: CLUSTER_MEET; clusterMeet: CLUSTER_MEET;
CLUSTER_MYID: CLUSTER_MYID; CLUSTER_MYID: CLUSTER_MYID;
@@ -694,6 +714,14 @@ type Commands = {
clusterSetSlot: CLUSTER_SETSLOT; clusterSetSlot: CLUSTER_SETSLOT;
CLUSTER_SLOTS: CLUSTER_SLOTS; CLUSTER_SLOTS: CLUSTER_SLOTS;
clusterSlots: CLUSTER_SLOTS; clusterSlots: CLUSTER_SLOTS;
CONFIG_GET: CONFIG_GET;
configGet: CONFIG_GET;
CONFIG_RESETASTAT: CONFIG_RESETASTAT;
configResetStat: CONFIG_RESETASTAT;
CONFIG_REWRITE: CONFIG_REWRITE;
configRewrite: CONFIG_REWRITE;
CONFIG_SET: CONFIG_SET;
configSet: CONFIG_SET;
COPY: COPY; COPY: COPY;
copy: COPY; copy: COPY;
DBSIZE: DBSIZE; DBSIZE: DBSIZE;
@@ -844,6 +872,12 @@ type Commands = {
keys: KEYS; keys: KEYS;
LASTSAVE: LASTSAVE; LASTSAVE: LASTSAVE;
lastSave: LASTSAVE; lastSave: LASTSAVE;
LATENCY_DOCTOR: LATENCY_DOCTOR;
latencyDoctor: LATENCY_DOCTOR;
LATENCY_GRAPH: LATENCY_GRAPH;
latencyGraph: LATENCY_GRAPH;
LATENCY_LATEST: LATENCY_LATEST;
latencyLatest: LATENCY_LATEST;
LCS_IDX_WITHMATCHLEN: LCS_IDX_WITHMATCHLEN; LCS_IDX_WITHMATCHLEN: LCS_IDX_WITHMATCHLEN;
lcsIdxWithMatchLen: LCS_IDX_WITHMATCHLEN; lcsIdxWithMatchLen: LCS_IDX_WITHMATCHLEN;
LCS_IDX: LCS_IDX; LCS_IDX: LCS_IDX;
@@ -889,8 +923,8 @@ type Commands = {
memoryMallocStats: MEMORY_MALLOC_STATS; memoryMallocStats: MEMORY_MALLOC_STATS;
MEMORY_PURGE: MEMORY_PURGE; MEMORY_PURGE: MEMORY_PURGE;
memoryPurge: MEMORY_PURGE; memoryPurge: MEMORY_PURGE;
// MEMORY_STATS: MEMORY_STATS; MEMORY_STATS: MEMORY_STATS;
// memoryStats: MEMORY_STATS; memoryStats: MEMORY_STATS;
MEMORY_USAGE: MEMORY_USAGE; MEMORY_USAGE: MEMORY_USAGE;
memoryUsage: MEMORY_USAGE; memoryUsage: MEMORY_USAGE;
MGET: MGET; MGET: MGET;
@@ -958,6 +992,8 @@ type Commands = {
renameNX: RENAMENX; renameNX: RENAMENX;
RPOP_COUNT: RPOP_COUNT; RPOP_COUNT: RPOP_COUNT;
rPopCount: RPOP_COUNT; rPopCount: RPOP_COUNT;
ROLE: ROLE;
role: ROLE;
RPOP: RPOP; RPOP: RPOP;
rPop: RPOP; rPop: RPOP;
RPOPLPUSH: RPOPLPUSH; RPOPLPUSH: RPOPLPUSH;
@@ -1036,6 +1072,10 @@ type Commands = {
sUnion: SUNION; sUnion: SUNION;
SUNIONSTORE: SUNIONSTORE; SUNIONSTORE: SUNIONSTORE;
sUnionStore: SUNIONSTORE; sUnionStore: SUNIONSTORE;
SWAPDB: SWAPDB;
swapDb: SWAPDB;
TIME: TIME;
time: TIME;
TOUCH: TOUCH; TOUCH: TOUCH;
touch: TOUCH; touch: TOUCH;
TTL: TTL; TTL: TTL;
@@ -1239,8 +1279,8 @@ export default {
// clusterInfo: CLUSTER_INFO, // clusterInfo: CLUSTER_INFO,
CLUSTER_KEYSLOT, CLUSTER_KEYSLOT,
clusterKeySlot: CLUSTER_KEYSLOT, clusterKeySlot: CLUSTER_KEYSLOT,
// CLUSTER_LINKS, CLUSTER_LINKS,
// clusterLinks: CLUSTER_LINKS, clusterLinks: CLUSTER_LINKS,
CLUSTER_MEET, CLUSTER_MEET,
clusterMeet: CLUSTER_MEET, clusterMeet: CLUSTER_MEET,
CLUSTER_MYID, CLUSTER_MYID,
@@ -1261,6 +1301,14 @@ export default {
clusterSetSlot: CLUSTER_SETSLOT, clusterSetSlot: CLUSTER_SETSLOT,
CLUSTER_SLOTS, CLUSTER_SLOTS,
clusterSlots: CLUSTER_SLOTS, clusterSlots: CLUSTER_SLOTS,
CONFIG_GET,
configGet: CONFIG_GET,
CONFIG_RESETASTAT,
configResetStat: CONFIG_RESETASTAT,
CONFIG_REWRITE,
configRewrite: CONFIG_REWRITE,
CONFIG_SET,
configSet: CONFIG_SET,
COPY, COPY,
copy: COPY, copy: COPY,
DBSIZE, DBSIZE,
@@ -1313,8 +1361,8 @@ export default {
functionList: FUNCTION_LIST, functionList: FUNCTION_LIST,
FUNCTION_LOAD, FUNCTION_LOAD,
functionLoad: FUNCTION_LOAD, functionLoad: FUNCTION_LOAD,
// FUNCTION_RESTORE, FUNCTION_RESTORE,
// functionRestore: FUNCTION_RESTORE, functionRestore: FUNCTION_RESTORE,
// FUNCTION_STATS, // FUNCTION_STATS,
// functionStats: FUNCTION_STATS, // functionStats: FUNCTION_STATS,
GEOADD, GEOADD,
@@ -1411,6 +1459,12 @@ export default {
keys: KEYS, keys: KEYS,
LASTSAVE, LASTSAVE,
lastSave: LASTSAVE, lastSave: LASTSAVE,
LATENCY_DOCTOR,
latencyDoctor: LATENCY_DOCTOR,
LATENCY_GRAPH,
latencyGraph: LATENCY_GRAPH,
LATENCY_LATEST,
latencyLatest: LATENCY_LATEST,
LCS_IDX_WITHMATCHLEN, LCS_IDX_WITHMATCHLEN,
lcsIdxWithMatchLen: LCS_IDX_WITHMATCHLEN, lcsIdxWithMatchLen: LCS_IDX_WITHMATCHLEN,
LCS_IDX, LCS_IDX,
@@ -1456,8 +1510,8 @@ export default {
memoryMallocStats: MEMORY_MALLOC_STATS, memoryMallocStats: MEMORY_MALLOC_STATS,
MEMORY_PURGE, MEMORY_PURGE,
memoryPurge: MEMORY_PURGE, memoryPurge: MEMORY_PURGE,
// MEMORY_STATS, MEMORY_STATS,
// memoryStats: MEMORY_STATS, memoryStats: MEMORY_STATS,
MEMORY_USAGE, MEMORY_USAGE,
memoryUsage: MEMORY_USAGE, memoryUsage: MEMORY_USAGE,
MGET, MGET,
@@ -1525,6 +1579,8 @@ export default {
renameNX: RENAMENX, renameNX: RENAMENX,
RPOP_COUNT, RPOP_COUNT,
rPopCount: RPOP_COUNT, rPopCount: RPOP_COUNT,
ROLE,
role: ROLE,
RPOP, RPOP,
rPop: RPOP, rPop: RPOP,
RPOPLPUSH, RPOPLPUSH,
@@ -1603,6 +1659,10 @@ export default {
sUnion: SUNION, sUnion: SUNION,
SUNIONSTORE, SUNIONSTORE,
sUnionStore: SUNIONSTORE, sUnionStore: SUNIONSTORE,
SWAPDB,
swapDb: SWAPDB,
TIME,
time: TIME,
TOUCH, TOUCH,
touch: TOUCH, touch: TOUCH,
TTL, TTL,