@nmtjs/client 0.14.5 → 0.15.0-beta.10

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 (45) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +1 -1
  3. package/dist/clients/runtime.d.ts +20 -0
  4. package/dist/clients/runtime.js +81 -0
  5. package/dist/clients/runtime.js.map +1 -0
  6. package/dist/clients/static.d.ts +13 -0
  7. package/dist/clients/static.js +27 -0
  8. package/dist/clients/static.js.map +1 -0
  9. package/dist/core.d.ts +71 -0
  10. package/dist/core.js +426 -0
  11. package/dist/core.js.map +1 -0
  12. package/dist/events.d.ts +16 -0
  13. package/dist/events.js +34 -0
  14. package/dist/events.js.map +1 -0
  15. package/dist/index.d.ts +5 -0
  16. package/dist/index.js +6 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/streams.d.ts +26 -0
  19. package/dist/streams.js +101 -0
  20. package/dist/streams.js.map +1 -0
  21. package/dist/transformers.d.ts +4 -0
  22. package/dist/transformers.js +9 -0
  23. package/dist/transformers.js.map +1 -0
  24. package/dist/transport.d.ts +53 -0
  25. package/dist/transport.js +2 -0
  26. package/dist/transport.js.map +1 -0
  27. package/dist/types.d.ts +41 -30
  28. package/dist/types.js +2 -1
  29. package/dist/types.js.map +1 -0
  30. package/package.json +17 -25
  31. package/src/clients/runtime.ts +133 -0
  32. package/src/clients/static.ts +77 -0
  33. package/src/core.ts +648 -0
  34. package/src/events.ts +70 -0
  35. package/src/index.ts +5 -0
  36. package/src/streams.ts +131 -0
  37. package/src/transformers.ts +8 -0
  38. package/src/transport.ts +71 -0
  39. package/src/types.ts +145 -0
  40. package/dist/common.d.ts +0 -38
  41. package/dist/common.js +0 -60
  42. package/dist/runtime.d.ts +0 -21
  43. package/dist/runtime.js +0 -105
  44. package/dist/static.d.ts +0 -9
  45. package/dist/static.js +0 -27
package/dist/static.js DELETED
@@ -1,27 +0,0 @@
1
- import { ProtocolBaseTransformer } from '@nmtjs/protocol/client';
2
- import { BaseClient } from "./common.js";
3
- export class StaticClient extends BaseClient {
4
- transformer;
5
- constructor(...args) {
6
- super(...args);
7
- this.transformer = new ProtocolBaseTransformer();
8
- this.callers = this.createProxy(Object.create(null));
9
- }
10
- createProxy(target, path = []) {
11
- return new Proxy(target, {
12
- get: (obj, prop) => {
13
- // `await client.call.something` or `await client.call.something.nested`
14
- // without explicitly calling a function implicitly calls .then() on a target
15
- // FIXME: this basically makes "then" a reserved word for static Client
16
- if (prop === 'then')
17
- return obj;
18
- const newPath = [...path, String(prop)];
19
- const caller = (payload, options) => this._call(newPath.join('/'), payload, {
20
- ...options,
21
- timeout: options?.timeout ?? this.options.timeout,
22
- });
23
- return this.createProxy(caller, newPath);
24
- },
25
- });
26
- }
27
- }