@nmtjs/client 0.15.0-beta.8 → 0.15.0
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 +31 -1
- package/dist/clients/runtime.d.ts +2 -2
- package/dist/clients/runtime.js +1 -1
- package/dist/clients/runtime.js.map +1 -1
- package/dist/clients/static.d.ts +2 -2
- package/dist/clients/static.js +6 -3
- package/dist/clients/static.js.map +1 -1
- package/dist/core.d.ts +38 -8
- package/dist/core.js +414 -66
- package/dist/core.js.map +1 -1
- package/dist/events.d.ts +1 -1
- package/dist/events.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/plugins/browser.d.ts +2 -0
- package/dist/plugins/browser.js +41 -0
- package/dist/plugins/browser.js.map +1 -0
- package/dist/plugins/heartbeat.d.ts +6 -0
- package/dist/plugins/heartbeat.js +86 -0
- package/dist/plugins/heartbeat.js.map +1 -0
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/index.js +6 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/logging.d.ts +9 -0
- package/dist/plugins/logging.js +30 -0
- package/dist/plugins/logging.js.map +1 -0
- package/dist/plugins/reconnect.d.ts +6 -0
- package/dist/plugins/reconnect.js +98 -0
- package/dist/plugins/reconnect.js.map +1 -0
- package/dist/plugins/types.d.ts +63 -0
- package/dist/plugins/types.js +2 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/streams.d.ts +3 -3
- package/dist/streams.js.map +1 -1
- package/dist/transformers.js.map +1 -1
- package/dist/types.d.ts +1 -4
- package/dist/types.js.map +1 -1
- package/package.json +27 -17
- package/src/clients/runtime.ts +4 -4
- package/src/clients/static.ts +9 -13
- package/src/core.ts +476 -77
- package/src/index.ts +1 -0
- package/src/plugins/browser.ts +61 -0
- package/src/plugins/heartbeat.ts +111 -0
- package/src/plugins/index.ts +5 -0
- package/src/plugins/logging.ts +42 -0
- package/src/plugins/reconnect.ts +130 -0
- package/src/plugins/types.ts +72 -0
- package/src/streams.ts +3 -3
- package/src/types.ts +1 -17
package/package.json
CHANGED
|
@@ -1,23 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nmtjs/client",
|
|
3
|
+
"description": "Base client infrastructure for Neemata RPC calls.",
|
|
3
4
|
"type": "module",
|
|
4
5
|
"exports": {
|
|
5
|
-
".":
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"import": "./dist/index.js",
|
|
9
|
+
"module-sync": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./runtime": {
|
|
12
|
+
"types": "./dist/clients/runtime.d.ts",
|
|
13
|
+
"import": "./dist/clients/runtime.js",
|
|
14
|
+
"module-sync": "./dist/clients/runtime.js"
|
|
15
|
+
},
|
|
16
|
+
"./static": {
|
|
17
|
+
"types": "./dist/clients/static.d.ts",
|
|
18
|
+
"import": "./dist/clients/static.js",
|
|
19
|
+
"module-sync": "./dist/clients/static.js"
|
|
20
|
+
}
|
|
8
21
|
},
|
|
9
22
|
"peerDependencies": {
|
|
10
|
-
"@nmtjs/type": "0.15.0
|
|
11
|
-
"@nmtjs/
|
|
12
|
-
"@nmtjs/common": "0.15.0
|
|
13
|
-
"@nmtjs/
|
|
23
|
+
"@nmtjs/type": "0.15.0",
|
|
24
|
+
"@nmtjs/protocol": "0.15.0",
|
|
25
|
+
"@nmtjs/common": "0.15.0",
|
|
26
|
+
"@nmtjs/contract": "0.15.0"
|
|
14
27
|
},
|
|
15
28
|
"devDependencies": {
|
|
16
|
-
"@nmtjs/
|
|
17
|
-
"@nmtjs/
|
|
18
|
-
"@nmtjs/contract": "0.15.0
|
|
19
|
-
"@nmtjs/
|
|
20
|
-
"@nmtjs/
|
|
29
|
+
"@nmtjs/tests-integration": "0.15.0",
|
|
30
|
+
"@nmtjs/type": "0.15.0",
|
|
31
|
+
"@nmtjs/contract": "0.15.0",
|
|
32
|
+
"@nmtjs/protocol": "0.15.0",
|
|
33
|
+
"@nmtjs/common": "0.15.0"
|
|
21
34
|
},
|
|
22
35
|
"files": [
|
|
23
36
|
"dist",
|
|
@@ -25,11 +38,8 @@
|
|
|
25
38
|
"LICENSE.md",
|
|
26
39
|
"README.md"
|
|
27
40
|
],
|
|
28
|
-
"version": "0.15.0
|
|
41
|
+
"version": "0.15.0",
|
|
29
42
|
"scripts": {
|
|
30
|
-
"clean-build": "rm -rf ./dist"
|
|
31
|
-
"build": "tsc --declaration --sourcemap",
|
|
32
|
-
"dev": "tsc --watch",
|
|
33
|
-
"type-check": "tsc --noEmit"
|
|
43
|
+
"clean-build": "rm -rf ./dist"
|
|
34
44
|
}
|
|
35
45
|
}
|
package/src/clients/runtime.ts
CHANGED
|
@@ -81,12 +81,12 @@ export class RuntimeClient<
|
|
|
81
81
|
this.#callers = this.buildCallers()
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
override get call() {
|
|
85
|
-
return this.#callers as
|
|
84
|
+
override get call(): ClientCallers<this['_']['routes'], SafeCall, false> {
|
|
85
|
+
return this.#callers as any
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
override get stream() {
|
|
89
|
-
return this.#callers as
|
|
88
|
+
override get stream(): ClientCallers<this['_']['routes'], SafeCall, true> {
|
|
89
|
+
return this.#callers as any
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
protected resolveProcedures(router: TAnyRouterContract, path: string[] = []) {
|
package/src/clients/static.ts
CHANGED
|
@@ -41,20 +41,12 @@ export class StaticClient<
|
|
|
41
41
|
this.transformer = new BaseClientTransformer()
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
override get call() {
|
|
45
|
-
return this.createProxy(Object.create(null), false)
|
|
46
|
-
this['_']['routes'],
|
|
47
|
-
SafeCall,
|
|
48
|
-
false
|
|
49
|
-
>
|
|
44
|
+
override get call(): ClientCallers<this['_']['routes'], SafeCall, false> {
|
|
45
|
+
return this.createProxy(Object.create(null), false)
|
|
50
46
|
}
|
|
51
47
|
|
|
52
|
-
override get stream() {
|
|
53
|
-
return this.createProxy(Object.create(null), true)
|
|
54
|
-
this['_']['routes'],
|
|
55
|
-
SafeCall,
|
|
56
|
-
true
|
|
57
|
-
>
|
|
48
|
+
override get stream(): ClientCallers<this['_']['routes'], SafeCall, true> {
|
|
49
|
+
return this.createProxy(Object.create(null), true)
|
|
58
50
|
}
|
|
59
51
|
|
|
60
52
|
protected createProxy<T>(
|
|
@@ -69,7 +61,11 @@ export class StaticClient<
|
|
|
69
61
|
const caller = (
|
|
70
62
|
payload?: unknown,
|
|
71
63
|
options?: Partial<ClientCallOptions>,
|
|
72
|
-
) =>
|
|
64
|
+
) =>
|
|
65
|
+
this._call(newPath.join('/'), payload, {
|
|
66
|
+
...options,
|
|
67
|
+
_stream_response: isStream || options?._stream_response,
|
|
68
|
+
})
|
|
73
69
|
return this.createProxy(caller as any, isStream, newPath)
|
|
74
70
|
},
|
|
75
71
|
}) as T
|