-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new encoder option and deprecate old serializer (#67)
- Loading branch information
1 parent
a85276f
commit fd34f22
Showing
125 changed files
with
3,677 additions
and
1,434 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'async-call-rpc': minor | ||
--- | ||
|
||
add new `encoder` option and deprecate old `serializer` option |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
'async-call-rpc': minor | ||
--- | ||
|
||
`hint` added to the `CallbackBasedChannel.setup(jsonRPCHandlerCallback)` and `EventBasedChannel.on(listener)`. | ||
|
||
For an isomorphic instance of `AsyncCall` (used as both a server and a client), | ||
when a new message comes, it does not clear if to call `decodeRequest` or `decodeRespones`. | ||
|
||
This version introduce a new option `encoder` to replace `serialization`. `serialization` is always working in isomorphic way. | ||
|
||
- If `hint` is `"request"`, `(encoder as ServerEncoding).decodeRequest` will be called first, if this method does not exist, `(encoder as IsomorphicEncoder).decode` will be called. | ||
- If `hint` is `"response"`, `(encoder as ClientEncoding).decodeResponse` will be called first, if this method does not exist, `(encoder as IsomorphicEncoder).decode` will be called. | ||
- If `hint` does not present, only `encoder.decode` will be called. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'async-call-rpc': minor | ||
--- | ||
|
||
`BSON_Serialization` and `Msgpack_Serialization` is now deprecated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"async-call-rpc": patch | ||
--- | ||
|
||
Add Promise<void> into return signature of EventBasedChannel.send |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'async-call-rpc': minor | ||
--- | ||
|
||
expose JSON-RPC interfaces |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'async-call-rpc': minor | ||
--- | ||
|
||
new built-in `JSONEncoder` for the new encode option. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
__tests__/__file_snapshots__/encode-isomorphic-full-hinted.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Timeline | ||
|
||
## T=0 Log: testRunner/log | ||
|
||
```php | ||
Array [ | ||
"encodeRequest", | ||
Object { | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"method": "undefined", | ||
"params": Array [], | ||
}, | ||
] | ||
``` | ||
|
||
## T=1 Message: client => server | ||
|
||
```php | ||
Object { | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"method": "undefined", | ||
"params": Array [], | ||
} | ||
``` | ||
|
||
## T=2 Log: testRunner/log | ||
|
||
```php | ||
Array [ | ||
"decodeRequest", | ||
Object { | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"method": "undefined", | ||
"params": Array [], | ||
}, | ||
] | ||
``` | ||
|
||
## T=3 Log: server/log | ||
|
||
```php | ||
Array [ | ||
"rpc.%cundefined%c(%c) | ||
%o %c@0", | ||
"color: #d2c057", | ||
"", | ||
"", | ||
Promise {}, | ||
"color: gray; font-style: italic;", | ||
] | ||
``` | ||
|
||
## T=4 Log: testRunner/log | ||
|
||
```php | ||
Array [ | ||
"encodeResponse", | ||
Object { | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"result": undefined, | ||
}, | ||
] | ||
``` | ||
|
||
## T=5 Message: server => client | ||
|
||
```php | ||
Object { | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"result": undefined, | ||
} | ||
``` | ||
|
||
## T=6 Log: testRunner/log | ||
|
||
```php | ||
Array [ | ||
"decodeResponse", | ||
Object { | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"result": undefined, | ||
}, | ||
] | ||
``` |
90 changes: 90 additions & 0 deletions
90
__tests__/__file_snapshots__/encode-isomorphic-full-not-hinted.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Timeline | ||
|
||
## T=0 Log: testRunner/log | ||
|
||
```php | ||
Array [ | ||
"encodeRequest", | ||
Object { | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"method": "undefined", | ||
"params": Array [], | ||
}, | ||
] | ||
``` | ||
|
||
## T=1 Message: client => server | ||
|
||
```php | ||
Object { | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"method": "undefined", | ||
"params": Array [], | ||
} | ||
``` | ||
|
||
## T=2 Log: testRunner/log | ||
|
||
```php | ||
Array [ | ||
"decode", | ||
Object { | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"method": "undefined", | ||
"params": Array [], | ||
}, | ||
] | ||
``` | ||
|
||
## T=3 Log: server/log | ||
|
||
```php | ||
Array [ | ||
"rpc.%cundefined%c(%c) | ||
%o %c@0", | ||
"color: #d2c057", | ||
"", | ||
"", | ||
Promise {}, | ||
"color: gray; font-style: italic;", | ||
] | ||
``` | ||
|
||
## T=4 Log: testRunner/log | ||
|
||
```php | ||
Array [ | ||
"encodeResponse", | ||
Object { | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"result": undefined, | ||
}, | ||
] | ||
``` | ||
|
||
## T=5 Message: server => client | ||
|
||
```php | ||
Object { | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"result": undefined, | ||
} | ||
``` | ||
|
||
## T=6 Log: testRunner/log | ||
|
||
```php | ||
Array [ | ||
"decode", | ||
Object { | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"result": undefined, | ||
}, | ||
] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Timeline | ||
|
||
## T=0 Log: testRunner/log | ||
|
||
```php | ||
Array [ | ||
"encode", | ||
Object { | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"method": "undefined", | ||
"params": Array [], | ||
}, | ||
] | ||
``` | ||
|
||
## T=1 Message: client => server | ||
|
||
```php | ||
Object { | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"method": "undefined", | ||
"params": Array [], | ||
} | ||
``` | ||
|
||
## T=2 Log: testRunner/log | ||
|
||
```php | ||
Array [ | ||
"decode", | ||
Object { | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"method": "undefined", | ||
"params": Array [], | ||
}, | ||
] | ||
``` | ||
|
||
## T=3 Log: server/log | ||
|
||
```php | ||
Array [ | ||
"rpc.%cundefined%c(%c) | ||
%o %c@0", | ||
"color: #d2c057", | ||
"", | ||
"", | ||
Promise {}, | ||
"color: gray; font-style: italic;", | ||
] | ||
``` | ||
|
||
## T=4 Log: testRunner/log | ||
|
||
```php | ||
Array [ | ||
"encode", | ||
Object { | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"result": undefined, | ||
}, | ||
] | ||
``` | ||
|
||
## T=5 Message: server => client | ||
|
||
```php | ||
Object { | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"result": undefined, | ||
} | ||
``` | ||
|
||
## T=6 Log: testRunner/log | ||
|
||
```php | ||
Array [ | ||
"decode", | ||
Object { | ||
"id": 0, | ||
"jsonrpc": "2.0", | ||
"result": undefined, | ||
}, | ||
] | ||
``` |
Oops, something went wrong.