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