You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
fix GRAPH
This commit is contained in:
@@ -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 './CONFIG_GET';
|
import CONFIG_GET from './CONFIG_GET';
|
||||||
|
|
||||||
describe('CONFIG GET', () => {
|
describe('CONFIG GET', () => {
|
||||||
it('transformArguments', () => {
|
it('transformArguments', () => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
transformArguments('TIMEOUT'),
|
CONFIG_GET.transformArguments('TIMEOUT'),
|
||||||
['GRAPH.CONFIG', 'GET', 'TIMEOUT']
|
['GRAPH.CONFIG', 'GET', 'TIMEOUT']
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@@ -1,12 +1,15 @@
|
|||||||
export const IS_READ_ONLY = true;
|
import { RedisArgument, TuplesReply, ArrayReply, BlobStringReply, NumberReply, Command } from '@redis/client/dist/lib/RESP/types';
|
||||||
|
|
||||||
export function transformArguments(configKey: string): Array<string> {
|
type ConfigItemReply = TuplesReply<[
|
||||||
|
configKey: BlobStringReply,
|
||||||
|
value: NumberReply
|
||||||
|
]>;
|
||||||
|
|
||||||
|
export default {
|
||||||
|
FIRST_KEY_INDEX: undefined,
|
||||||
|
IS_READ_ONLY: true,
|
||||||
|
transformArguments(configKey: RedisArgument) {
|
||||||
return ['GRAPH.CONFIG', 'GET', configKey];
|
return ['GRAPH.CONFIG', 'GET', configKey];
|
||||||
}
|
},
|
||||||
|
transformReply: undefined as unknown as () => ConfigItemReply | ArrayReply<ConfigItemReply>
|
||||||
type ConfigItem = [
|
} as const satisfies Command;
|
||||||
configKey: string,
|
|
||||||
value: number
|
|
||||||
];
|
|
||||||
|
|
||||||
export declare function transformReply(): ConfigItem | Array<ConfigItem>;
|
|
||||||
|
@@ -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 './CONFIG_SET';
|
import CONFIG_SET from './CONFIG_SET';
|
||||||
|
|
||||||
describe('CONFIG SET', () => {
|
describe('CONFIG SET', () => {
|
||||||
it('transformArguments', () => {
|
it('transformArguments', () => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
transformArguments('TIMEOUT', 0),
|
CONFIG_SET.transformArguments('TIMEOUT', 0),
|
||||||
['GRAPH.CONFIG', 'SET', 'TIMEOUT', '0']
|
['GRAPH.CONFIG', 'SET', 'TIMEOUT', '0']
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@@ -1,10 +1,15 @@
|
|||||||
export function transformArguments(configKey: string, value: number): Array<string> {
|
import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/lib/RESP/types';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
FIRST_KEY_INDEX: undefined,
|
||||||
|
IS_READ_ONLY: false,
|
||||||
|
transformArguments(configKey: RedisArgument, value: number) {
|
||||||
return [
|
return [
|
||||||
'GRAPH.CONFIG',
|
'GRAPH.CONFIG',
|
||||||
'SET',
|
'SET',
|
||||||
configKey,
|
configKey,
|
||||||
value.toString()
|
value.toString()
|
||||||
];
|
];
|
||||||
}
|
},
|
||||||
|
transformReply: undefined as unknown as () => SimpleStringReply
|
||||||
export declare function transformReply(): 'OK';
|
} as const satisfies Command;
|
||||||
|
@@ -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 './DELETE';
|
import DELETE from './DELETE';
|
||||||
|
|
||||||
describe('', () => {
|
describe('', () => {
|
||||||
it('transformArguments', () => {
|
it('transformArguments', () => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
transformArguments('key'),
|
DELETE.transformArguments('key'),
|
||||||
['GRAPH.DELETE', 'key']
|
['GRAPH.DELETE', 'key']
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@@ -1,7 +1,10 @@
|
|||||||
export const FIRST_KEY_INDEX = 1;
|
import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/lib/RESP/types';
|
||||||
|
|
||||||
export function transformArguments(key: string): Array<string> {
|
export default {
|
||||||
|
FIRST_KEY_INDEX: 1,
|
||||||
|
IS_READ_ONLY: false,
|
||||||
|
transformArguments(key: RedisArgument) {
|
||||||
return ['GRAPH.DELETE', key];
|
return ['GRAPH.DELETE', key];
|
||||||
}
|
},
|
||||||
|
transformReply: undefined as unknown as () => SimpleStringReply
|
||||||
export declare function transformReply(): string;
|
} as const satisfies Command;
|
||||||
|
@@ -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 './EXPLAIN';
|
import EXPLAIN from './EXPLAIN';
|
||||||
|
|
||||||
describe('EXPLAIN', () => {
|
describe('EXPLAIN', () => {
|
||||||
it('transformArguments', () => {
|
it('transformArguments', () => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
transformArguments('key', 'RETURN 0'),
|
EXPLAIN.transformArguments('key', 'RETURN 0'),
|
||||||
['GRAPH.EXPLAIN', 'key', 'RETURN 0']
|
['GRAPH.EXPLAIN', 'key', 'RETURN 0']
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@@ -1,9 +1,10 @@
|
|||||||
export const FIRST_KEY_INDEX = 1;
|
import { RedisArgument, ArrayReply, BlobStringReply, Command } from '@redis/client/dist/lib/RESP/types';
|
||||||
|
|
||||||
export const IS_READ_ONLY = true;
|
export default {
|
||||||
|
FIRST_KEY_INDEX: 1,
|
||||||
export function transformArguments(key: string, query: string): Array<string> {
|
IS_READ_ONLY: true,
|
||||||
|
transformArguments(key: RedisArgument, query: RedisArgument) {
|
||||||
return ['GRAPH.EXPLAIN', key, query];
|
return ['GRAPH.EXPLAIN', key, query];
|
||||||
}
|
},
|
||||||
|
transformReply: undefined as unknown as () => ArrayReply<BlobStringReply>
|
||||||
export declare function transfromReply(): Array<string>;
|
} as const satisfies Command;
|
||||||
|
@@ -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 './LIST';
|
import LIST from './LIST';
|
||||||
|
|
||||||
describe('LIST', () => {
|
describe('LIST', () => {
|
||||||
it('transformArguments', () => {
|
it('transformArguments', () => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
transformArguments(),
|
LIST.transformArguments(),
|
||||||
['GRAPH.LIST']
|
['GRAPH.LIST']
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@@ -1,7 +1,10 @@
|
|||||||
export const IS_READ_ONLY = true;
|
import { ArrayReply, BlobStringReply, Command } from '@redis/client/dist/lib/RESP/types';
|
||||||
|
|
||||||
export function transformArguments(): Array<string> {
|
export default {
|
||||||
|
FIRST_KEY_INDEX: undefined,
|
||||||
|
IS_READ_ONLY: true,
|
||||||
|
transformArguments() {
|
||||||
return ['GRAPH.LIST'];
|
return ['GRAPH.LIST'];
|
||||||
}
|
},
|
||||||
|
transformReply: undefined as unknown as () => ArrayReply<BlobStringReply>
|
||||||
export declare function transformReply(): Array<string>;
|
} as const satisfies Command;
|
||||||
|
@@ -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 './PROFILE';
|
import PROFILE from './PROFILE';
|
||||||
|
|
||||||
describe('PROFILE', () => {
|
describe('PROFILE', () => {
|
||||||
it('transformArguments', () => {
|
it('transformArguments', () => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
transformArguments('key', 'RETURN 0'),
|
PROFILE.transformArguments('key', 'RETURN 0'),
|
||||||
['GRAPH.PROFILE', 'key', 'RETURN 0']
|
['GRAPH.PROFILE', 'key', 'RETURN 0']
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@@ -1,9 +1,10 @@
|
|||||||
export const FIRST_KEY_INDEX = 1;
|
import { RedisArgument, ArrayReply, BlobStringReply, Command } from '@redis/client/dist/lib/RESP/types';
|
||||||
|
|
||||||
export const IS_READ_ONLY = true;
|
export default {
|
||||||
|
FIRST_KEY_INDEX: 1,
|
||||||
export function transformArguments(key: string, query: string): Array<string> {
|
IS_READ_ONLY: true,
|
||||||
|
transformArguments(key: RedisArgument, query: RedisArgument) {
|
||||||
return ['GRAPH.PROFILE', key, query];
|
return ['GRAPH.PROFILE', key, query];
|
||||||
}
|
},
|
||||||
|
transformReply: undefined as unknown as () => ArrayReply<BlobStringReply>
|
||||||
export declare function transfromReply(): Array<string>;
|
} as const satisfies Command;
|
||||||
|
@@ -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 './QUERY';
|
import QUERY from './QUERY';
|
||||||
|
|
||||||
describe('QUERY', () => {
|
describe('QUERY', () => {
|
||||||
it('transformArguments', () => {
|
it('transformArguments', () => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
transformArguments('key', 'query'),
|
QUERY.transformArguments('key', 'query'),
|
||||||
['GRAPH.QUERY', 'key', 'query']
|
['GRAPH.QUERY', 'key', 'query']
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user