Skip to content

Commit d578e82

Browse files
committed
modify deno conf
1 parent 2acb41a commit d578e82

File tree

4 files changed

+24
-17
lines changed

4 files changed

+24
-17
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docs/

README.md

+15-13
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,31 @@ A strictly typed json-rpc implemention, zero dependency, minimal abstraction, wi
99
```ts
1010
const methodSet = {
1111
upper: (str: string) => str.toUpperCase(),
12-
} as const;
12+
} as const
1313

14-
const server = new JSONRPCServer(methodSet);
14+
const server = new JSONRPCServer(methodSet)
1515

16-
const client = new JSONRPCClient<typeof methodSet>((json) => server.process(json));
16+
const client = new JSONRPCClient<typeof methodSet>((json) =>
17+
server.process(json)
18+
)
1719

18-
assertEquals(await client.request("upper", "hello"), "HELLO");
20+
assertEquals(await client.request('upper', 'hello'), 'HELLO')
1921

2022
assertEquals(
2123
await client.batch(
22-
client.createRequest("upper", "nihao"),
23-
client.createNotifaction("upper"),
24-
client.createRequest("upper", "shijie")
24+
client.createRequest('upper', 'nihao'),
25+
client.createNotifaction('upper'),
26+
client.createRequest('upper', 'shijie'),
2527
),
2628
[
2729
{
28-
status: "fulfilled",
29-
value: "NIHAO",
30+
status: 'fulfilled',
31+
value: 'NIHAO',
3032
},
3133
{
32-
status: "fulfilled",
33-
value: "SHIJIE",
34+
status: 'fulfilled',
35+
value: 'SHIJIE',
3436
},
35-
]
36-
);
37+
],
38+
)
3739
```

deno.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
"imports": {
33
"std/": "https://deno.land/[email protected]/"
44
},
5+
"tasks": {
6+
"docs": "deno doc --html --name=json-rpc-ts --output=./docs/ ./src/index.ts"
7+
},
58
"fmt": {
69
"lineWidth": 80,
710
"semiColons": false,
811
"indentWidth": 4,
912
"singleQuote": true,
1013
"proseWrap": "preserve",
11-
"include": ["src/"],
14+
"include": ["*"],
1215
"exclude": []
1316
}
1417
}

src/dto/errors.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import type { JSONRPCValue } from '../types.ts'
2-
/**
3-
* The error codes from and including -32768 to -32000 are reserved for pre-defined errors. Any code within this range, but not defined explicitly below is reserved for future use. The error codes are nearly the same as those suggested for XML-RPC at the following url: http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php
4-
*/
2+
53
export interface JSONRPCErrorInterface {
64
/**
75
* A Number that indicates the error type that occurred.
@@ -22,6 +20,9 @@ export interface JSONRPCErrorInterface {
2220
}
2321

2422
export class JSONRPCError extends Error implements JSONRPCErrorInterface {
23+
/**
24+
* The error codes from and including -32768 to -32000 are reserved for pre-defined errors. Any code within this range, but not defined explicitly below is reserved for future use. The error codes are nearly the same as those suggested for XML-RPC at the following url: http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php
25+
*/
2526
public code: number
2627
public message: string
2728
public data?: JSONRPCValue

0 commit comments

Comments
 (0)