@pyrpc/client 0.2.0 → 0.3.1
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/dist/index.js +9 -2
- package/dist/index.mjs +9 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -112,9 +112,16 @@ function createClient(options = {}) {
|
|
|
112
112
|
const client = new PyRPCClient(options);
|
|
113
113
|
return new Proxy(client, {
|
|
114
114
|
get(target, prop, receiver) {
|
|
115
|
-
if (prop
|
|
116
|
-
return
|
|
115
|
+
if (prop === "rpc") {
|
|
116
|
+
return new Proxy({}, {
|
|
117
|
+
get(_, method) {
|
|
118
|
+
throw new Error(
|
|
119
|
+
`Use client.${String(method)}() instead of client.rpc.${String(method)}(). The .rpc prefix was removed for a cleaner API.`
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
117
123
|
}
|
|
124
|
+
if (prop in target) return Reflect.get(target, prop, receiver);
|
|
118
125
|
return target.rpc[prop];
|
|
119
126
|
}
|
|
120
127
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -84,9 +84,16 @@ function createClient(options = {}) {
|
|
|
84
84
|
const client = new PyRPCClient(options);
|
|
85
85
|
return new Proxy(client, {
|
|
86
86
|
get(target, prop, receiver) {
|
|
87
|
-
if (prop
|
|
88
|
-
return
|
|
87
|
+
if (prop === "rpc") {
|
|
88
|
+
return new Proxy({}, {
|
|
89
|
+
get(_, method) {
|
|
90
|
+
throw new Error(
|
|
91
|
+
`Use client.${String(method)}() instead of client.rpc.${String(method)}(). The .rpc prefix was removed for a cleaner API.`
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
89
95
|
}
|
|
96
|
+
if (prop in target) return Reflect.get(target, prop, receiver);
|
|
90
97
|
return target.rpc[prop];
|
|
91
98
|
}
|
|
92
99
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pyrpc/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Universal TypeScript client for pyRPC",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"author": "",
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@pyrpc/types": "^0.
|
|
27
|
+
"@pyrpc/types": "^0.1.0-alpha.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "^20.19.39",
|