@nmtjs/client 0.15.0-beta.9 → 0.15.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.
Files changed (50) hide show
  1. package/dist/clients/runtime.d.ts +2 -2
  2. package/dist/clients/runtime.js +1 -1
  3. package/dist/clients/runtime.js.map +1 -1
  4. package/dist/clients/static.d.ts +2 -2
  5. package/dist/clients/static.js +6 -3
  6. package/dist/clients/static.js.map +1 -1
  7. package/dist/core.d.ts +38 -8
  8. package/dist/core.js +414 -66
  9. package/dist/core.js.map +1 -1
  10. package/dist/events.d.ts +1 -1
  11. package/dist/events.js.map +1 -1
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.js +6 -5
  14. package/dist/index.js.map +1 -1
  15. package/dist/plugins/browser.d.ts +2 -0
  16. package/dist/plugins/browser.js +41 -0
  17. package/dist/plugins/browser.js.map +1 -0
  18. package/dist/plugins/heartbeat.d.ts +6 -0
  19. package/dist/plugins/heartbeat.js +86 -0
  20. package/dist/plugins/heartbeat.js.map +1 -0
  21. package/dist/plugins/index.d.ts +5 -0
  22. package/dist/plugins/index.js +6 -0
  23. package/dist/plugins/index.js.map +1 -0
  24. package/dist/plugins/logging.d.ts +9 -0
  25. package/dist/plugins/logging.js +30 -0
  26. package/dist/plugins/logging.js.map +1 -0
  27. package/dist/plugins/reconnect.d.ts +6 -0
  28. package/dist/plugins/reconnect.js +98 -0
  29. package/dist/plugins/reconnect.js.map +1 -0
  30. package/dist/plugins/types.d.ts +63 -0
  31. package/dist/plugins/types.js +2 -0
  32. package/dist/plugins/types.js.map +1 -0
  33. package/dist/streams.d.ts +3 -3
  34. package/dist/streams.js.map +1 -1
  35. package/dist/transformers.js.map +1 -1
  36. package/dist/types.d.ts +1 -4
  37. package/dist/types.js.map +1 -1
  38. package/package.json +27 -17
  39. package/src/clients/runtime.ts +4 -4
  40. package/src/clients/static.ts +9 -13
  41. package/src/core.ts +476 -77
  42. package/src/index.ts +1 -0
  43. package/src/plugins/browser.ts +61 -0
  44. package/src/plugins/heartbeat.ts +111 -0
  45. package/src/plugins/index.ts +5 -0
  46. package/src/plugins/logging.ts +42 -0
  47. package/src/plugins/reconnect.ts +130 -0
  48. package/src/plugins/types.ts +72 -0
  49. package/src/streams.ts +3 -3
  50. 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
- ".": "./dist/index.js",
6
- "./runtime": "./dist/clients/runtime.js",
7
- "./static": "./dist/clients/static.js"
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-beta.9",
11
- "@nmtjs/contract": "0.15.0-beta.9",
12
- "@nmtjs/common": "0.15.0-beta.9",
13
- "@nmtjs/protocol": "0.15.0-beta.9"
23
+ "@nmtjs/type": "0.15.1",
24
+ "@nmtjs/common": "0.15.1",
25
+ "@nmtjs/protocol": "0.15.1",
26
+ "@nmtjs/contract": "0.15.1"
14
27
  },
15
28
  "devDependencies": {
16
- "@nmtjs/_tests": "0.15.0-beta.9",
17
- "@nmtjs/contract": "0.15.0-beta.9",
18
- "@nmtjs/common": "0.15.0-beta.9",
19
- "@nmtjs/protocol": "0.15.0-beta.9",
20
- "@nmtjs/type": "0.15.0-beta.9"
29
+ "@nmtjs/type": "0.15.1",
30
+ "@nmtjs/contract": "0.15.1",
31
+ "@nmtjs/protocol": "0.15.1",
32
+ "@nmtjs/tests-integration": "0.15.1",
33
+ "@nmtjs/common": "0.15.1"
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-beta.9",
41
+ "version": "0.15.1",
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
  }
@@ -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 ClientCallers<this['_']['routes'], SafeCall, false>
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 ClientCallers<this['_']['routes'], SafeCall, true>
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[] = []) {
@@ -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) as ClientCallers<
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) as ClientCallers<
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
- ) => this._call(newPath.join('/'), payload, options)
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