Skip to content

Commit bc4b210

Browse files
authored
Export CommandParser from client index file and fix doc (#2945)
* Export CommandParser from client index file * Tidy up long export line in client index file Wrap and sort entries. * Adapt and fix wrong examples in programmability doc
1 parent 87b77e3 commit bc4b210

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

docs/programmability.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ FUNCTION LOAD "#!lua name=library\nredis.register_function{function_name='add',
2525
Load the prior redis function on the _redis server_ before running the example below.
2626

2727
```typescript
28-
import { CommandParser } from '@redis/client/lib/client/parser';
29-
import { NumberReply } from '@redis/client/lib/RESP/types';
30-
import { createClient, RedisArgument } from 'redis';
28+
import { CommandParser, createClient, RedisArgument } from '@redis/client';
29+
import { NumberReply } from '@redis/client/dist/lib/RESP/types.js';
3130

3231
const client = createClient({
3332
functions: {
@@ -58,9 +57,8 @@ await client.library.add('key', '2'); // 3
5857
The following is an end-to-end example of the prior concept.
5958

6059
```typescript
61-
import { CommandParser } from '@redis/client/lib/client/parser';
62-
import { NumberReply } from '@redis/client/lib/RESP/types';
63-
import { createClient, defineScript, RedisArgument } from 'redis';
60+
import { CommandParser, createClient, defineScript, RedisArgument } from '@redis/client';
61+
import { NumberReply } from '@redis/client/dist/lib/RESP/types.js';
6462

6563
const client = createClient({
6664
scripts: {

packages/client/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
export { RedisModules, RedisFunctions, RedisScripts, RespVersions, TypeMapping/*, CommandPolicies*/, RedisArgument } from './lib/RESP/types';
1+
export {
2+
/* CommandPolicies, */
3+
RedisArgument,
4+
RedisFunctions,
5+
RedisModules,
6+
RedisScripts,
7+
RespVersions,
8+
TypeMapping,
9+
} from './lib/RESP/types';
210
export { RESP_TYPES } from './lib/RESP/decoder';
311
export { VerbatimString } from './lib/RESP/verbatim-string';
412
export { defineScript } from './lib/lua-script';
@@ -7,6 +15,7 @@ export * from './lib/errors';
715
import RedisClient, { RedisClientOptions, RedisClientType } from './lib/client';
816
export { RedisClientOptions, RedisClientType };
917
export const createClient = RedisClient.create;
18+
export { CommandParser } from './lib/client/parser';
1019

1120
import { RedisClientPool, RedisPoolOptions, RedisClientPoolType } from './lib/client/pool';
1221
export { RedisClientPoolType, RedisPoolOptions };

0 commit comments

Comments
 (0)