@apibara/protocol 0.4.9 → 2.0.0-beta.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 (99) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/buf.gen.yaml +14 -0
  3. package/build.config.ts +8 -0
  4. package/dist/index.d.mts +610 -0
  5. package/dist/index.d.ts +610 -4
  6. package/dist/index.mjs +1172 -0
  7. package/package.json +44 -24
  8. package/proto/common.proto +22 -0
  9. package/proto/stream.proto +83 -0
  10. package/proto/testing.proto +11 -0
  11. package/src/client.ts +113 -333
  12. package/src/common.test.ts +67 -0
  13. package/src/common.ts +65 -0
  14. package/src/config.ts +38 -0
  15. package/src/index.ts +10 -3
  16. package/src/proto/common.ts +279 -0
  17. package/src/proto/index.ts +3 -1
  18. package/src/proto/stream.ts +728 -17
  19. package/src/proto/testing.ts +143 -8
  20. package/src/rate.ts +54 -0
  21. package/src/status.test.ts +51 -0
  22. package/src/status.ts +22 -0
  23. package/src/stream.test-d.ts +33 -0
  24. package/src/stream.test.ts +238 -0
  25. package/src/stream.ts +128 -0
  26. package/src/testing/client.test.ts +71 -0
  27. package/src/testing/client.ts +49 -0
  28. package/src/testing/index.ts +2 -0
  29. package/src/testing/mock.test.ts +35 -0
  30. package/src/testing/mock.ts +71 -0
  31. package/tsconfig.json +12 -0
  32. package/dist/client.d.ts +0 -130
  33. package/dist/client.js +0 -215
  34. package/dist/client.js.map +0 -1
  35. package/dist/cursor.d.ts +0 -35
  36. package/dist/cursor.js +0 -67
  37. package/dist/cursor.js.map +0 -1
  38. package/dist/cursor.test.d.ts +0 -1
  39. package/dist/cursor.test.js +0 -22
  40. package/dist/cursor.test.js.map +0 -1
  41. package/dist/index.js +0 -21
  42. package/dist/index.js.map +0 -1
  43. package/dist/proto/apibara/node/v1alpha2/Cursor.d.ts +0 -10
  44. package/dist/proto/apibara/node/v1alpha2/Cursor.js +0 -4
  45. package/dist/proto/apibara/node/v1alpha2/Cursor.js.map +0 -1
  46. package/dist/proto/apibara/node/v1alpha2/Data.d.ts +0 -15
  47. package/dist/proto/apibara/node/v1alpha2/Data.js +0 -4
  48. package/dist/proto/apibara/node/v1alpha2/Data.js.map +0 -1
  49. package/dist/proto/apibara/node/v1alpha2/DataFinality.d.ts +0 -8
  50. package/dist/proto/apibara/node/v1alpha2/DataFinality.js +0 -11
  51. package/dist/proto/apibara/node/v1alpha2/DataFinality.js.map +0 -1
  52. package/dist/proto/apibara/node/v1alpha2/Heartbeat.d.ts +0 -4
  53. package/dist/proto/apibara/node/v1alpha2/Heartbeat.js +0 -4
  54. package/dist/proto/apibara/node/v1alpha2/Heartbeat.js.map +0 -1
  55. package/dist/proto/apibara/node/v1alpha2/Invalidate.d.ts +0 -7
  56. package/dist/proto/apibara/node/v1alpha2/Invalidate.js +0 -4
  57. package/dist/proto/apibara/node/v1alpha2/Invalidate.js.map +0 -1
  58. package/dist/proto/apibara/node/v1alpha2/Stream.d.ts +0 -16
  59. package/dist/proto/apibara/node/v1alpha2/Stream.js +0 -4
  60. package/dist/proto/apibara/node/v1alpha2/Stream.js.map +0 -1
  61. package/dist/proto/apibara/node/v1alpha2/StreamDataRequest.d.ts +0 -24
  62. package/dist/proto/apibara/node/v1alpha2/StreamDataRequest.js +0 -4
  63. package/dist/proto/apibara/node/v1alpha2/StreamDataRequest.js.map +0 -1
  64. package/dist/proto/apibara/node/v1alpha2/StreamDataResponse.d.ts +0 -18
  65. package/dist/proto/apibara/node/v1alpha2/StreamDataResponse.js +0 -4
  66. package/dist/proto/apibara/node/v1alpha2/StreamDataResponse.js.map +0 -1
  67. package/dist/proto/index.d.ts +0 -1
  68. package/dist/proto/index.js +0 -28
  69. package/dist/proto/index.js.map +0 -1
  70. package/dist/proto/stream.d.ts +0 -25
  71. package/dist/proto/stream.js +0 -3
  72. package/dist/proto/stream.js.map +0 -1
  73. package/dist/proto/stream.proto +0 -76
  74. package/dist/proto/testing.d.ts +0 -5
  75. package/dist/proto/testing.js +0 -24
  76. package/dist/proto/testing.js.map +0 -1
  77. package/dist/proto/v1alpha2.d.ts +0 -11
  78. package/dist/proto/v1alpha2.js +0 -15
  79. package/dist/proto/v1alpha2.js.map +0 -1
  80. package/dist/request.d.ts +0 -36
  81. package/dist/request.js +0 -58
  82. package/dist/request.js.map +0 -1
  83. package/dist/request.test.d.ts +0 -1
  84. package/dist/request.test.js +0 -28
  85. package/dist/request.test.js.map +0 -1
  86. package/src/cursor.test.ts +0 -21
  87. package/src/cursor.ts +0 -67
  88. package/src/proto/apibara/node/v1alpha2/Cursor.ts +0 -13
  89. package/src/proto/apibara/node/v1alpha2/Data.ts +0 -18
  90. package/src/proto/apibara/node/v1alpha2/DataFinality.ts +0 -20
  91. package/src/proto/apibara/node/v1alpha2/Heartbeat.ts +0 -8
  92. package/src/proto/apibara/node/v1alpha2/Invalidate.ts +0 -11
  93. package/src/proto/apibara/node/v1alpha2/Stream.ts +0 -23
  94. package/src/proto/apibara/node/v1alpha2/StreamDataRequest.ts +0 -27
  95. package/src/proto/apibara/node/v1alpha2/StreamDataResponse.ts +0 -22
  96. package/src/proto/stream.proto +0 -76
  97. package/src/proto/v1alpha2.ts +0 -24
  98. package/src/request.test.ts +0 -30
  99. package/src/request.ts +0 -64
package/CHANGELOG.md ADDED
@@ -0,0 +1,103 @@
1
+ # @apibara/protocol
2
+
3
+ ## 0.4.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [#58](https://github.com/apibara/typescript-sdk/pull/58) [`97a7c35685ae015cd06f88576ba4c6dbd37e2f9c`](https://github.com/apibara/typescript-sdk/commit/97a7c35685ae015cd06f88576ba4c6dbd37e2f9c) Thanks [@fracek](https://github.com/fracek)! - Fix stream client to yield heartbeat messages
8
+
9
+ ## 0.4.8
10
+
11
+ ### Patch Changes
12
+
13
+ - [#39](https://github.com/apibara/typescript-sdk/pull/39) [`b8f9240`](https://github.com/apibara/typescript-sdk/commit/b8f9240bb851aa8b0ac35d726fba578ca384e7f4) Thanks [@fracek](https://github.com/fracek)! - Add Cursor helpers to convert to/from javascript objects
14
+
15
+ ## 0.4.7
16
+
17
+ ### Patch Changes
18
+
19
+ - [#38](https://github.com/apibara/typescript-sdk/pull/38) [`a59f20e`](https://github.com/apibara/typescript-sdk/commit/a59f20eea4d651b6b750bd65e5287a80803545c5) Thanks [@fracek](https://github.com/fracek)! - Set virtual oneof field
20
+
21
+ ## 0.4.6
22
+
23
+ ### Patch Changes
24
+
25
+ - [#33](https://github.com/apibara/typescript-sdk/pull/33) [`3c13249`](https://github.com/apibara/typescript-sdk/commit/3c132497743cd541805cf14a822e6cd54dc82c59) Thanks [@fracek](https://github.com/fracek)! - Add message timeout option
26
+
27
+ ## 0.4.5
28
+
29
+ ### Patch Changes
30
+
31
+ - [#31](https://github.com/apibara/typescript-sdk/pull/31) [`936c3c3`](https://github.com/apibara/typescript-sdk/commit/936c3c3a4a5ba2e85a37a1316ed29c2ad58bb4cf) Thanks [@fracek](https://github.com/fracek)! - Add auth token to all secure credentials
32
+
33
+ ## 0.4.4
34
+
35
+ ### Patch Changes
36
+
37
+ - [#27](https://github.com/apibara/typescript-sdk/pull/27) [`e083d82`](https://github.com/apibara/typescript-sdk/commit/e083d824ad2f8885492b4b181c728ee2190c7373) Thanks [@fracek](https://github.com/fracek)! - Allow to connect to insecure endpoint
38
+
39
+ ## 0.4.3
40
+
41
+ ### Patch Changes
42
+
43
+ - [#25](https://github.com/apibara/typescript-sdk/pull/25) [`51c3c9c`](https://github.com/apibara/typescript-sdk/commit/51c3c9cc19a33b4018c192ddfde905e90921598c) Thanks [@fracek](https://github.com/fracek)! - Handle client-server connection hanging
44
+
45
+ ## 0.4.2
46
+
47
+ ### Patch Changes
48
+
49
+ - [#23](https://github.com/apibara/typescript-sdk/pull/23) [`056c9db`](https://github.com/apibara/typescript-sdk/commit/056c9db21a3bf9b0842f3cf19ff175b38d9eb69b) Thanks [@fracek](https://github.com/fracek)! - Add option to send auth token
50
+
51
+ ## 0.4.1
52
+
53
+ ### Patch Changes
54
+
55
+ - [#20](https://github.com/apibara/typescript-sdk/pull/20) [`9a58f52`](https://github.com/apibara/typescript-sdk/commit/9a58f5223fad6ccb067dcb7303d7f5f559a1b9b5) Thanks [@fracek](https://github.com/fracek)! - Rethrow error if not reconnecting
56
+
57
+ ## 0.4.0
58
+
59
+ ### Minor Changes
60
+
61
+ - [#13](https://github.com/apibara/typescript-sdk/pull/13) [`0a1a959`](https://github.com/apibara/typescript-sdk/commit/0a1a9599a482520b426b0026d3a98f08cbdbb51f) Thanks [@fracek](https://github.com/fracek)! - Implement v1alpha2 protocol
62
+
63
+ ### Patch Changes
64
+
65
+ - [#17](https://github.com/apibara/typescript-sdk/pull/17) [`ec2dc90`](https://github.com/apibara/typescript-sdk/commit/ec2dc90a548e07bc6afd20662fec5109fdc80d65) Thanks [@fracek](https://github.com/fracek)! - Support protocolo v1alpha2
66
+
67
+ - [#13](https://github.com/apibara/typescript-sdk/pull/13) [`ef58eb0`](https://github.com/apibara/typescript-sdk/commit/ef58eb0c9132c0c41d2c74acfb896c5fdd5b9ecc) Thanks [@fracek](https://github.com/fracek)! - Add helper to create cursors
68
+
69
+ ## 0.4.0-next.1
70
+
71
+ ### Patch Changes
72
+
73
+ - [#13](https://github.com/apibara/typescript-sdk/pull/13) [`ef58eb0`](https://github.com/apibara/typescript-sdk/commit/ef58eb0c9132c0c41d2c74acfb896c5fdd5b9ecc) Thanks [@fracek](https://github.com/fracek)! - Add helper to create cursors
74
+
75
+ ## 0.4.0-next.0
76
+
77
+ ### Minor Changes
78
+
79
+ - [`57f19af`](https://github.com/apibara/typescript-sdk/commit/57f19af61daae6594214e87ca3a7baae0d5ee86a) Thanks [@fracek](https://github.com/fracek)! - Implement v1alpha2 protocol
80
+
81
+ ## 0.3.0
82
+
83
+ ### Minor Changes
84
+
85
+ - [#8](https://github.com/apibara/typescript-sdk/pull/8) [`7f1def7`](https://github.com/apibara/typescript-sdk/commit/7f1def70426e8b5704599d2e989e5db5461aa9ac) Thanks [@fracek](https://github.com/fracek)! - Add option to automatically reconnect stream
86
+
87
+ ## 0.2.0
88
+
89
+ ### Minor Changes
90
+
91
+ - [#6](https://github.com/apibara/typescript-sdk/pull/6) [`439a61f`](https://github.com/apibara/typescript-sdk/commit/439a61f36e14f3b69ba6cdf9032f87f81d6475ef) Thanks [@fracek](https://github.com/fracek)! - Add pending data
92
+
93
+ ## 0.1.2
94
+
95
+ ### Patch Changes
96
+
97
+ - [#4](https://github.com/apibara/typescript-sdk/pull/4) [`5383826`](https://github.com/apibara/typescript-sdk/commit/538382698f03dc1623a66c24bfef67e3e629b06d) Thanks [@fracek](https://github.com/fracek)! - Export proto module
98
+
99
+ ## 0.1.1
100
+
101
+ ### Patch Changes
102
+
103
+ - [`163a28b`](https://github.com/apibara/typescript-sdk/commit/163a28b808a8d15bd927f7feaf34546a681c346e) Thanks [@fracek](https://github.com/fracek)! - Initial release
package/buf.gen.yaml ADDED
@@ -0,0 +1,14 @@
1
+ version: v2
2
+ plugins:
3
+ - remote: buf.build/community/stephenh-ts-proto:v1.176.0
4
+ out: src/proto/
5
+ opt:
6
+ - outputServices=nice-grpc
7
+ - outputServices=generic-definitions
8
+ - useExactTypes=false
9
+ - useOptionals=messages
10
+ - useReadonlyTypes=true
11
+ - forceLong=bigint
12
+ - esModuleInterop=true
13
+ - removeEnumPrefix=true
14
+ - oneof=unions
@@ -0,0 +1,8 @@
1
+ import { defineBuildConfig } from "unbuild";
2
+
3
+ export default defineBuildConfig({
4
+ entries: ["./src/index.ts"],
5
+ clean: true,
6
+ outDir: "./dist",
7
+ declaration: true,
8
+ });