Skip to content

Commit

Permalink
refactor: rename AsyncCallStrictJSONRPC to AsyncCallStrictOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Works committed Feb 11, 2024
1 parent 0d0900b commit 0431c15
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 49 deletions.
5 changes: 5 additions & 0 deletions .changeset/perfect-icons-vanish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"async-call-rpc": minor
---

rename AsyncCallStrictJSONRPC to AsyncCallStrictOptions
6 changes: 5 additions & 1 deletion api/base.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ export interface AsyncCallOptions<EncodedRequest = unknown, EncodedResponse = un
thenable?: boolean;
}

// @public @deprecated
export interface AsyncCallStrictJSONRPC extends AsyncCallStrictOptions {
}

// @public
export interface AsyncCallStrictJSONRPC {
export interface AsyncCallStrictOptions {
methodNotFound?: boolean;
unknownMessage?: boolean;
}
Expand Down
6 changes: 5 additions & 1 deletion api/full.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ export interface AsyncCallOptions<EncodedRequest = unknown, EncodedResponse = un
thenable?: boolean;
}

// @public @deprecated
export interface AsyncCallStrictJSONRPC extends AsyncCallStrictOptions {
}

// @public
export interface AsyncCallStrictJSONRPC {
export interface AsyncCallStrictOptions {
methodNotFound?: boolean;
unknownMessage?: boolean;
}
Expand Down
15 changes: 7 additions & 8 deletions docs/async-call-rpc.asynccallstrictjsonrpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@

## AsyncCallStrictJSONRPC interface

> Warning: This API is now obsolete.
>
> renamed to [AsyncCallStrictOptions](./async-call-rpc.asynccallstrictoptions.md)
>
Strict options

**Signature:**

```typescript
export interface AsyncCallStrictJSONRPC
export interface AsyncCallStrictJSONRPC extends AsyncCallStrictOptions
```
**Extends:** [AsyncCallStrictOptions](./async-call-rpc.asynccallstrictoptions.md)
## Remarks
Control the behavior that different from the JSON-RPC specification.
## Properties

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [methodNotFound?](./async-call-rpc.asynccallstrictjsonrpc.methodnotfound.md) | | boolean | _(Optional)_ Controls if AsyncCall send an ErrorResponse when the requested method is not defined. |
| [unknownMessage?](./async-call-rpc.asynccallstrictjsonrpc.unknownmessage.md) | | boolean | _(Optional)_ Controls if AsyncCall send an ErrorResponse when the message is not valid. |

25 changes: 25 additions & 0 deletions docs/async-call-rpc.asynccallstrictoptions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [async-call-rpc](./async-call-rpc.md) &gt; [AsyncCallStrictOptions](./async-call-rpc.asynccallstrictoptions.md)

## AsyncCallStrictOptions interface

Strict options

**Signature:**

```typescript
export interface AsyncCallStrictOptions
```

## Remarks

Control the behavior that different from the JSON-RPC specification.

## Properties

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [methodNotFound?](./async-call-rpc.asynccallstrictoptions.methodnotfound.md) | | boolean | _(Optional)_ Controls if AsyncCall send an ErrorResponse when the requested method is not defined. |
| [unknownMessage?](./async-call-rpc.asynccallstrictoptions.unknownmessage.md) | | boolean | _(Optional)_ Controls if AsyncCall send an ErrorResponse when the message is not valid. |

Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [async-call-rpc](./async-call-rpc.md) &gt; [AsyncCallStrictJSONRPC](./async-call-rpc.asynccallstrictjsonrpc.md) &gt; [methodNotFound](./async-call-rpc.asynccallstrictjsonrpc.methodnotfound.md)

## AsyncCallStrictJSONRPC.methodNotFound property

Controls if AsyncCall send an ErrorResponse when the requested method is not defined.

**Signature:**

```typescript
methodNotFound?: boolean;
```

## Remarks

If this option is set to false, AsyncCall will ignore the request and print a log if the method is not defined.

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [async-call-rpc](./async-call-rpc.md) &gt; [AsyncCallStrictOptions](./async-call-rpc.asynccallstrictoptions.md) &gt; [methodNotFound](./async-call-rpc.asynccallstrictoptions.methodnotfound.md)

## AsyncCallStrictOptions.methodNotFound property

Controls if AsyncCall send an ErrorResponse when the requested method is not defined.

**Signature:**

```typescript
methodNotFound?: boolean;
```

## Remarks

If this option is set to false, AsyncCall will ignore the request and print a log if the method is not defined.

Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [async-call-rpc](./async-call-rpc.md) &gt; [AsyncCallStrictJSONRPC](./async-call-rpc.asynccallstrictjsonrpc.md) &gt; [unknownMessage](./async-call-rpc.asynccallstrictjsonrpc.unknownmessage.md)

## AsyncCallStrictJSONRPC.unknownMessage property

Controls if AsyncCall send an ErrorResponse when the message is not valid.

**Signature:**

```typescript
unknownMessage?: boolean;
```

## Remarks

If this option is set to false, AsyncCall will ignore the request that cannot be parsed as a valid JSON RPC payload. This is useful when the message channel is also used to transfer other kinds of messages.

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [async-call-rpc](./async-call-rpc.md) &gt; [AsyncCallStrictOptions](./async-call-rpc.asynccallstrictoptions.md) &gt; [unknownMessage](./async-call-rpc.asynccallstrictoptions.unknownmessage.md)

## AsyncCallStrictOptions.unknownMessage property

Controls if AsyncCall send an ErrorResponse when the message is not valid.

**Signature:**

```typescript
unknownMessage?: boolean;
```

## Remarks

If this option is set to false, AsyncCall will ignore the request that cannot be parsed as a valid JSON RPC payload. This is useful when the message channel is also used to transfer other kinds of messages.

1 change: 1 addition & 0 deletions docs/async-call-rpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ See the introduction at [Github](https://github.com/Jack-Works/async-call)
| [AsyncCallLogLevel](./async-call-rpc.asynccallloglevel.md) | Log options |
| [AsyncCallOptions](./async-call-rpc.asynccalloptions.md) | Options for [AsyncCall()](./async-call-rpc.asynccall.md) |
| [AsyncCallStrictJSONRPC](./async-call-rpc.asynccallstrictjsonrpc.md) | Strict options |
| [AsyncCallStrictOptions](./async-call-rpc.asynccallstrictoptions.md) | Strict options |
| [CallbackBasedChannel](./async-call-rpc.callbackbasedchannel.md) | This interface represents a "callback" model. |
| [ClientEncoding](./async-call-rpc.clientencoding.md) | Encoder of the client. |
| [ConsoleInterface](./async-call-rpc.consoleinterface.md) | The minimal Console interface that AsyncCall needs. |
Expand Down
12 changes: 9 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,8 @@ export interface AsyncCallLogLevel {
* @remarks
* Control the behavior that different from the JSON-RPC specification.
* @public
* @privateRemarks
* TODO: rename to AsyncCallStrictOptions
*/
export interface AsyncCallStrictJSONRPC {
export interface AsyncCallStrictOptions {
/**
* Controls if AsyncCall send an ErrorResponse when the requested method is not defined.
* @remarks
Expand All @@ -117,6 +115,14 @@ export interface AsyncCallStrictJSONRPC {
*/
unknownMessage?: boolean
}
/**
* Strict options
* @remarks
* Control the behavior that different from the JSON-RPC specification.
* @public
* @deprecated renamed to {@link AsyncCallStrictOptions}
*/
export interface AsyncCallStrictJSONRPC extends AsyncCallStrictOptions {}

/**
* Options for {@link AsyncCall}
Expand Down

0 comments on commit 0431c15

Please sign in to comment.