starpc 0.4.9 → 0.5.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.
Files changed (64) hide show
  1. package/Makefile +1 -0
  2. package/README.md +20 -10
  3. package/dist/echo/client-test.d.ts +1 -0
  4. package/dist/echo/client-test.js +20 -18
  5. package/dist/echo/echo.pb.d.ts +165 -12
  6. package/dist/echo/echo.pb.js +61 -17
  7. package/dist/echo/server.d.ts +8 -4
  8. package/dist/echo/server.js +29 -37
  9. package/dist/rpcstream/rpcstream.d.ts +6 -6
  10. package/dist/rpcstream/rpcstream.js +92 -51
  11. package/dist/rpcstream/rpcstream.pb.d.ts +46 -1
  12. package/dist/rpcstream/rpcstream.pb.js +157 -9
  13. package/dist/srpc/client.d.ts +3 -4
  14. package/dist/srpc/client.js +12 -46
  15. package/dist/srpc/common-rpc.d.ts +3 -2
  16. package/dist/srpc/common-rpc.js +12 -0
  17. package/dist/srpc/definition.d.ts +3 -3
  18. package/dist/srpc/handler.d.ts +2 -3
  19. package/dist/srpc/handler.js +5 -22
  20. package/dist/srpc/index.d.ts +1 -1
  21. package/dist/srpc/index.js +1 -1
  22. package/dist/srpc/packet.js +0 -32
  23. package/dist/srpc/pushable.d.ts +2 -0
  24. package/dist/srpc/pushable.js +13 -0
  25. package/dist/srpc/rpcproto.pb.d.ts +13 -6
  26. package/dist/srpc/rpcproto.pb.js +95 -10
  27. package/dist/srpc/server.d.ts +1 -0
  28. package/dist/srpc/server.js +7 -0
  29. package/dist/srpc/ts-proto-rpc.d.ts +3 -4
  30. package/e2e/e2e.ts +4 -3
  31. package/e2e/e2e_test.go +24 -1
  32. package/echo/client-test.ts +23 -18
  33. package/echo/echo.pb.go +33 -20
  34. package/echo/echo.pb.ts +90 -34
  35. package/echo/echo.proto +4 -0
  36. package/echo/echo_srpc.pb.go +77 -0
  37. package/echo/server.go +18 -0
  38. package/echo/server.ts +47 -41
  39. package/integration/integration.go +1 -2
  40. package/integration/integration.ts +5 -1
  41. package/integration/integration_srpc.pb.go +139 -0
  42. package/package.json +5 -3
  43. package/patches/ts-proto+1.115.5.patch +1339 -0
  44. package/srpc/client.ts +16 -50
  45. package/srpc/common-rpc.ts +14 -2
  46. package/srpc/definition.ts +3 -3
  47. package/srpc/handler.ts +17 -34
  48. package/srpc/index.ts +1 -1
  49. package/srpc/muxed-conn.go +2 -2
  50. package/srpc/packet-rw.go +4 -6
  51. package/srpc/packet.ts +0 -33
  52. package/srpc/pushable.ts +17 -0
  53. package/srpc/rpcproto.pb.ts +122 -12
  54. package/srpc/server-pipe.go +2 -2
  55. package/srpc/server.go +2 -2
  56. package/srpc/server.ts +8 -0
  57. package/srpc/ts-proto-rpc.ts +4 -6
  58. package/srpc/websocket.go +2 -2
  59. package/dist/echo/sever.d.ts +0 -0
  60. package/dist/echo/sever.js +0 -1
  61. package/dist/srpc/observable-source.d.ts +0 -9
  62. package/dist/srpc/observable-source.js +0 -25
  63. package/echo/sever.ts +0 -0
  64. package/srpc/observable-source.ts +0 -40
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,9 +0,0 @@
1
- import { Source } from 'it-stream-types';
2
- import { Observable } from 'rxjs';
3
- export declare class ObservableSource<T> {
4
- readonly source: Source<T>;
5
- private readonly _source;
6
- private readonly subscription;
7
- constructor(observable: Observable<T>);
8
- close(err?: Error): void;
9
- }
@@ -1,25 +0,0 @@
1
- import { pushable } from 'it-pushable';
2
- // ObservableSource wraps an Observable into a Source.
3
- export class ObservableSource {
4
- constructor(observable) {
5
- const source = pushable({ objectMode: true });
6
- this.source = source;
7
- this._source = source;
8
- this.subscription = observable.subscribe({
9
- next: (value) => {
10
- this._source.push(value);
11
- },
12
- error: (err) => {
13
- this._source.end(err);
14
- },
15
- complete: () => {
16
- this._source.end();
17
- },
18
- });
19
- }
20
- // close closes the subscription.
21
- close(err) {
22
- this._source.end(err);
23
- this.subscription.unsubscribe();
24
- }
25
- }
package/echo/sever.ts DELETED
File without changes
@@ -1,40 +0,0 @@
1
- import { Source } from 'it-stream-types'
2
- import { pushable, Pushable } from 'it-pushable'
3
- import { Observable, Subscription } from 'rxjs'
4
-
5
- // ObservableSource wraps an Observable into a Source.
6
- export class ObservableSource<T> {
7
- // source is the source for observable objects.
8
- public readonly source: Source<T>
9
- // _source emits incoming data to the source.
10
- private readonly _source: {
11
- push: (val: T) => void
12
- end: (err?: Error) => void
13
- }
14
- // subscription is the observable subscription
15
- private readonly subscription: Subscription
16
-
17
- constructor(observable: Observable<T>) {
18
- const source: Pushable<T> = pushable({ objectMode: true })
19
- this.source = source
20
- this._source = source
21
-
22
- this.subscription = observable.subscribe({
23
- next: (value: T) => {
24
- this._source.push(value)
25
- },
26
- error: (err) => {
27
- this._source.end(err)
28
- },
29
- complete: () => {
30
- this._source.end()
31
- },
32
- })
33
- }
34
-
35
- // close closes the subscription.
36
- public close(err?: Error) {
37
- this._source.end(err)
38
- this.subscription.unsubscribe()
39
- }
40
- }