@travetto/web-rpc 6.0.2 → 6.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +4 -4
- package/support/client/rpc.ts +5 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ npm install @travetto/web-rpc
|
|
|
13
13
|
yarn add @travetto/web-rpc
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
This module allows for a highly focused scenario, of supporting RPC operations within a [Web API](https://github.com/travetto/travetto/tree/main/module/web#readme "Declarative
|
|
16
|
+
This module allows for a highly focused scenario, of supporting RPC operations within a [Web API](https://github.com/travetto/travetto/tree/main/module/web#readme "Declarative support for creating Web Applications") application. The module takes care of producing the appropriate handler for the RPC commands along with the ability to generate the appropriate client to be used to interact with the RPC functionality. The generated client uses Proxy-based objects, along with [Typescript](https://typescriptlang.org) magic to create a dynamic client that does not rely on generating a lot of code.
|
|
17
17
|
|
|
18
18
|
## CLI - web:rpc-client
|
|
19
19
|
The library will create the RPC client in one of three flavors: fetch, fetch + node, angular.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/web-rpc",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.3",
|
|
4
4
|
"description": "RPC support for a Web Application",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"directory": "module/web-rpc"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@travetto/config": "^6.0.
|
|
30
|
-
"@travetto/schema": "^6.0.
|
|
31
|
-
"@travetto/web": "^6.0.
|
|
29
|
+
"@travetto/config": "^6.0.1",
|
|
30
|
+
"@travetto/schema": "^6.0.1",
|
|
31
|
+
"@travetto/web": "^6.0.3"
|
|
32
32
|
},
|
|
33
33
|
"travetto": {
|
|
34
34
|
"displayName": "Web RPC Support"
|
package/support/client/rpc.ts
CHANGED
|
@@ -25,6 +25,8 @@ export type RpcRequest = {
|
|
|
25
25
|
timeout?: number;
|
|
26
26
|
retriesOnConnectFailure?: number;
|
|
27
27
|
path?: string;
|
|
28
|
+
controller?: string;
|
|
29
|
+
endpoint?: string;
|
|
28
30
|
};
|
|
29
31
|
url: URL | string;
|
|
30
32
|
consumeJSON?: <T>(text?: unknown) => (T | Promise<T>);
|
|
@@ -72,7 +74,9 @@ function buildRequest<T extends RequestInit>(base: T, controller: string, endpoi
|
|
|
72
74
|
return {
|
|
73
75
|
...base,
|
|
74
76
|
method: 'POST',
|
|
75
|
-
path: `${controller}:${endpoint}
|
|
77
|
+
path: `${controller}:${endpoint}`,
|
|
78
|
+
controller,
|
|
79
|
+
endpoint
|
|
76
80
|
};
|
|
77
81
|
}
|
|
78
82
|
|