diff --git a/.changeset/five-olives-cheat.md b/.changeset/five-olives-cheat.md deleted file mode 100644 index 05ebff0..0000000 --- a/.changeset/five-olives-cheat.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -'async-call-rpc': minor ---- - -add new `encoder` option and deprecate old `serializer` option - -how to migrate: - -```ts -// before -const options = { - channel, - serializer: { - serialization(data) { return ... }, - deserialization(data) { return ... }, - }, -} - -// after -const options = { - channel, - encoder: { - encode(data) { return ... }, - decode(data) { return ... }, - }, -} -``` - -```ts -// before -const options = { - channel, - serializer: NoSerialization, -} - -// after -const options = { - channel, -} -``` - -```ts -// before -const options = { - channel, - serializer: JSONSerialization(), -} - -// after -const options = { - channel, - encoder: JSONEncoder(), -} -``` diff --git a/.changeset/grumpy-phones-listen.md b/.changeset/grumpy-phones-listen.md deleted file mode 100644 index bb18635..0000000 --- a/.changeset/grumpy-phones-listen.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -'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. diff --git a/.changeset/lemon-bikes-bake.md b/.changeset/lemon-bikes-bake.md deleted file mode 100644 index cb7bf50..0000000 --- a/.changeset/lemon-bikes-bake.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"async-call-rpc": minor ---- - -rename "key" to "name" diff --git a/.changeset/odd-scissors-admire.md b/.changeset/odd-scissors-admire.md deleted file mode 100644 index e04058d..0000000 --- a/.changeset/odd-scissors-admire.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'async-call-rpc': minor ---- - -`BSON_Serialization` and `Msgpack_Serialization` is now deprecated diff --git a/.changeset/perfect-icons-vanish.md b/.changeset/perfect-icons-vanish.md deleted file mode 100644 index a94bd77..0000000 --- a/.changeset/perfect-icons-vanish.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"async-call-rpc": minor ---- - -rename `AsyncCallStrictJSONRPC` to `AsyncCallStrictOptions` diff --git a/.changeset/short-eels-cover.md b/.changeset/short-eels-cover.md deleted file mode 100644 index 6912815..0000000 --- a/.changeset/short-eels-cover.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"async-call-rpc": minor ---- - -add `signal` and `forceSignal` to stop the instance diff --git a/.changeset/smooth-ties-nail.md b/.changeset/smooth-ties-nail.md deleted file mode 100644 index 498f6a9..0000000 --- a/.changeset/smooth-ties-nail.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"async-call-rpc": patch ---- - -Add `Promise<void>` into return signature of `EventBasedChannel.send` diff --git a/.changeset/spicy-rivers-act.md b/.changeset/spicy-rivers-act.md deleted file mode 100644 index ade5554..0000000 --- a/.changeset/spicy-rivers-act.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"async-call-rpc": minor ---- - -rename `parameterStructures` to `parameterStructure` diff --git a/.changeset/strange-readers-agree.md b/.changeset/strange-readers-agree.md deleted file mode 100644 index d9ff27f..0000000 --- a/.changeset/strange-readers-agree.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'async-call-rpc': minor ---- - -expose JSON-RPC interfaces diff --git a/.changeset/tidy-trains-bathe.md b/.changeset/tidy-trains-bathe.md deleted file mode 100644 index 90f9fd6..0000000 --- a/.changeset/tidy-trains-bathe.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'async-call-rpc': minor ---- - -new built-in `JSONEncoder` for the new encode option. diff --git a/CHANGELOG.md b/CHANGELOG.md index fb588e9..98c25a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,83 @@ # Changelog +## 6.4.0 + +### Minor Changes + +- fd34f22: add new `encoder` option and deprecate old `serializer` option + + how to migrate: + + ```ts + // before + const options = { + channel, + serializer: { + serialization(data) { return ... }, + deserialization(data) { return ... }, + }, + } + + // after + const options = { + channel, + encoder: { + encode(data) { return ... }, + decode(data) { return ... }, + }, + } + ``` + + ```ts + // before + const options = { + channel, + serializer: NoSerialization, + }; + + // after + const options = { + channel, + }; + ``` + + ```ts + // before + const options = { + channel, + serializer: JSONSerialization(), + }; + + // after + const options = { + channel, + encoder: JSONEncoder(), + }; + ``` + +- fd34f22: `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. + +- 0d0900b: rename "key" to "name" +- fd34f22: `BSON_Serialization` and `Msgpack_Serialization` is now deprecated +- 0431c15: rename `AsyncCallStrictJSONRPC` to `AsyncCallStrictOptions` +- 8a38d8b: add `signal` and `forceSignal` to stop the instance +- c9bbbd2: rename `parameterStructures` to `parameterStructure` +- fd34f22: expose JSON-RPC interfaces +- fd34f22: new built-in `JSONEncoder` for the new encode option. + +### Patch Changes + +- fd34f22: Add `Promise<void>` into return signature of `EventBasedChannel.send` + ## 6.3.1 ### Patch Changes diff --git a/package.json b/package.json index f238986..aab63c7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "async-call-rpc", "packageManager": "pnpm@8.15.1", - "version": "6.3.1", + "version": "6.4.0", "description": "A lightweight JSON RPC server & client", "main": "out/base.js", "module": "out/base.mjs",