Skip to content

Commit 13f1fa9

Browse files
committed
WIP
1 parent b4196fa commit 13f1fa9

17 files changed

+117
-97
lines changed

docs/v4-to-v5.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ Some command arguments/replies have changed to align more closely to data types
108108
- `GEORADIUSSTORE` -> `GEORADIUS_STORE`
109109
- `GEORADIUSBYMEMBERSTORE` -> `GEORADIUSBYMEMBER_STORE`
110110
- `XACK`: `boolean` -> `number` [^boolean-to-number]
111+
- `XADD`: the `INCR` option has been removed, use `XADD_INCR` instead
111112

112113
[^enum-to-constants]: TODO
113114

packages/client/lib/commands/CONFIG_SET.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default {
1010
) {
1111
const args: Array<RedisArgument> = ['CONFIG', 'SET'];
1212

13-
if (typeof parameterOrConfig === 'string' || Buffer.isBuffer(parameterOrConfig)) {
13+
if (typeof parameterOrConfig === 'string' || parameterOrConfig instanceof Buffer) {
1414
args.push(parameterOrConfig, value!);
1515
} else {
1616
for (const [key, value] of Object.entries(parameterOrConfig)) {

packages/client/lib/commands/HSET.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default {
2121
transformArguments(...[key, value, fieldValue]: SingleFieldArguments | MultipleFieldsArguments) {
2222
const args: Array<RedisArgument> = ['HSET', key];
2323

24-
if (typeof value === 'string' || typeof value === 'number' || Buffer.isBuffer(value)) {
24+
if (typeof value === 'string' || typeof value === 'number' || value instanceof Buffer) {
2525
args.push(
2626
convertValue(value),
2727
convertValue(fieldValue!)
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import { strict as assert } from 'assert';
22
import testUtils, { GLOBAL } from '../test-utils';
3-
import { transformArguments } from './SCRIPT_DEBUG';
3+
import SCRIPT_DEBUG from './SCRIPT_DEBUG';
44

55
describe('SCRIPT DEBUG', () => {
6-
it('transformArguments', () => {
7-
assert.deepEqual(
8-
transformArguments('NO'),
9-
['SCRIPT', 'DEBUG', 'NO']
10-
);
11-
});
6+
it('transformArguments', () => {
7+
assert.deepEqual(
8+
SCRIPT_DEBUG.transformArguments('NO'),
9+
['SCRIPT', 'DEBUG', 'NO']
10+
);
11+
});
1212

13-
testUtils.testWithClient('client.scriptDebug', async client => {
14-
assert.equal(
15-
await client.scriptDebug('NO'),
16-
'OK'
17-
);
18-
}, GLOBAL.SERVERS.OPEN);
13+
testUtils.testWithClient('client.scriptDebug', async client => {
14+
assert.equal(
15+
await client.scriptDebug('NO'),
16+
'OK'
17+
);
18+
}, GLOBAL.SERVERS.OPEN);
1919
});

packages/client/lib/commands/SCRIPT_DEBUG.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ export default {
66
transformArguments(mode: 'YES' | 'SYNC' | 'NO') {
77
return ['SCRIPT', 'DEBUG', mode];
88
},
9-
transformReply: undefined as unknown as () => SimpleStringReply
9+
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
1010
} as const satisfies Command;
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
import { strict as assert } from 'assert';
22
import testUtils, { GLOBAL } from '../test-utils';
3-
import { transformArguments } from './SCRIPT_EXISTS';
3+
import SCRIPT_EXISTS from './SCRIPT_EXISTS';
44

55
describe('SCRIPT EXISTS', () => {
6-
describe('transformArguments', () => {
7-
it('string', () => {
8-
assert.deepEqual(
9-
transformArguments('sha1'),
10-
['SCRIPT', 'EXISTS', 'sha1']
11-
);
12-
});
6+
describe('transformArguments', () => {
7+
it('string', () => {
8+
assert.deepEqual(
9+
SCRIPT_EXISTS.transformArguments('sha1'),
10+
['SCRIPT', 'EXISTS', 'sha1']
11+
);
12+
});
1313

14-
it('array', () => {
15-
assert.deepEqual(
16-
transformArguments(['1', '2']),
17-
['SCRIPT', 'EXISTS', '1', '2']
18-
);
19-
});
14+
it('array', () => {
15+
assert.deepEqual(
16+
SCRIPT_EXISTS.transformArguments(['1', '2']),
17+
['SCRIPT', 'EXISTS', '1', '2']
18+
);
2019
});
20+
});
2121

22-
testUtils.testWithClient('client.scriptExists', async client => {
23-
assert.deepEqual(
24-
await client.scriptExists('sha1'),
25-
[false]
26-
);
27-
}, GLOBAL.SERVERS.OPEN);
22+
testUtils.testWithClient('client.scriptExists', async client => {
23+
assert.deepEqual(
24+
await client.scriptExists('sha1'),
25+
[0]
26+
);
27+
}, GLOBAL.SERVERS.OPEN);
2828
});
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
import { strict as assert } from 'assert';
22
import testUtils, { GLOBAL } from '../test-utils';
3-
import { transformArguments } from './SCRIPT_FLUSH';
3+
import SCRIPT_FLUSH from './SCRIPT_FLUSH';
44

55
describe('SCRIPT FLUSH', () => {
6-
describe('transformArguments', () => {
7-
it('simple', () => {
8-
assert.deepEqual(
9-
transformArguments(),
10-
['SCRIPT', 'FLUSH']
11-
);
12-
});
6+
describe('transformArguments', () => {
7+
it('simple', () => {
8+
assert.deepEqual(
9+
SCRIPT_FLUSH.transformArguments(),
10+
['SCRIPT', 'FLUSH']
11+
);
12+
});
1313

14-
it('with mode', () => {
15-
assert.deepEqual(
16-
transformArguments('SYNC'),
17-
['SCRIPT', 'FLUSH', 'SYNC']
18-
);
19-
});
14+
it('with mode', () => {
15+
assert.deepEqual(
16+
SCRIPT_FLUSH.transformArguments('SYNC'),
17+
['SCRIPT', 'FLUSH', 'SYNC']
18+
);
2019
});
20+
});
2121

22-
testUtils.testWithClient('client.scriptFlush', async client => {
23-
assert.equal(
24-
await client.scriptFlush(),
25-
'OK'
26-
);
27-
}, GLOBAL.SERVERS.OPEN);
22+
testUtils.testWithClient('client.scriptFlush', async client => {
23+
assert.equal(
24+
await client.scriptFlush(),
25+
'OK'
26+
);
27+
}, GLOBAL.SERVERS.OPEN);
2828
});

packages/client/lib/commands/SCRIPT_FLUSH.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ export default {
1212

1313
return args;
1414
},
15-
transformReply: undefined as unknown as () => SimpleStringReply
15+
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
1616
} as const satisfies Command;
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { strict as assert } from 'assert';
2-
import { transformArguments } from './SCRIPT_KILL';
2+
import SCRIPT_KILL from './SCRIPT_KILL';
33

44
describe('SCRIPT KILL', () => {
5-
it('transformArguments', () => {
6-
assert.deepEqual(
7-
transformArguments(),
8-
['SCRIPT', 'KILL']
9-
);
10-
});
5+
it('transformArguments', () => {
6+
assert.deepEqual(
7+
SCRIPT_KILL.transformArguments(),
8+
['SCRIPT', 'KILL']
9+
);
10+
});
1111
});

packages/client/lib/commands/SCRIPT_KILL.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ export default {
66
transformArguments() {
77
return ['SCRIPT', 'KILL'];
88
},
9-
transformReply: undefined as unknown as () => SimpleStringReply
9+
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
1010
} as const satisfies Command;

0 commit comments

Comments
 (0)