envio 3.0.0-alpha.21 → 3.0.0-alpha.22

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 (219) hide show
  1. package/bin.mjs +2 -48
  2. package/evm.schema.json +67 -0
  3. package/fuel.schema.json +67 -0
  4. package/index.d.ts +822 -38
  5. package/index.js +5 -3
  6. package/package.json +10 -8
  7. package/rescript.json +5 -9
  8. package/src/Address.res +4 -5
  9. package/src/Address.res.mjs +9 -12
  10. package/src/Api.res +15 -0
  11. package/src/Api.res.mjs +20 -0
  12. package/src/Batch.res +32 -34
  13. package/src/Batch.res.mjs +172 -187
  14. package/src/Bin.res +89 -0
  15. package/src/Bin.res.mjs +97 -0
  16. package/src/ChainFetcher.res +33 -57
  17. package/src/ChainFetcher.res.mjs +197 -227
  18. package/src/ChainManager.res +6 -14
  19. package/src/ChainManager.res.mjs +74 -85
  20. package/src/ChainMap.res +14 -16
  21. package/src/ChainMap.res.mjs +38 -38
  22. package/src/Config.res +193 -135
  23. package/src/Config.res.mjs +566 -592
  24. package/src/Core.res +182 -0
  25. package/src/Core.res.mjs +207 -0
  26. package/src/Ecosystem.res +25 -4
  27. package/src/Ecosystem.res.mjs +12 -13
  28. package/src/Env.res +20 -13
  29. package/src/Env.res.mjs +124 -113
  30. package/src/EnvSafe.res +269 -0
  31. package/src/EnvSafe.res.mjs +296 -0
  32. package/src/EnvSafe.resi +18 -0
  33. package/src/Envio.res +37 -26
  34. package/src/Envio.res.mjs +59 -60
  35. package/src/ErrorHandling.res +2 -2
  36. package/src/ErrorHandling.res.mjs +15 -15
  37. package/src/EventConfigBuilder.res +219 -81
  38. package/src/EventConfigBuilder.res.mjs +259 -202
  39. package/src/EventProcessing.res +27 -38
  40. package/src/EventProcessing.res.mjs +165 -183
  41. package/src/EventUtils.res +11 -11
  42. package/src/EventUtils.res.mjs +21 -22
  43. package/src/EvmTypes.res +0 -1
  44. package/src/EvmTypes.res.mjs +5 -5
  45. package/src/FetchState.res +360 -256
  46. package/src/FetchState.res.mjs +958 -914
  47. package/src/GlobalState.res +365 -351
  48. package/src/GlobalState.res.mjs +958 -992
  49. package/src/GlobalStateManager.res +1 -2
  50. package/src/GlobalStateManager.res.mjs +36 -44
  51. package/src/HandlerLoader.res +107 -23
  52. package/src/HandlerLoader.res.mjs +128 -38
  53. package/src/HandlerRegister.res +127 -103
  54. package/src/HandlerRegister.res.mjs +164 -164
  55. package/src/HandlerRegister.resi +12 -4
  56. package/src/Hasura.res +35 -22
  57. package/src/Hasura.res.mjs +158 -167
  58. package/src/InMemoryStore.res +20 -27
  59. package/src/InMemoryStore.res.mjs +64 -80
  60. package/src/InMemoryTable.res +34 -39
  61. package/src/InMemoryTable.res.mjs +165 -170
  62. package/src/Internal.res +52 -33
  63. package/src/Internal.res.mjs +84 -81
  64. package/src/LazyLoader.res.mjs +55 -61
  65. package/src/LoadLayer.res +77 -78
  66. package/src/LoadLayer.res.mjs +160 -189
  67. package/src/LoadManager.res +16 -21
  68. package/src/LoadManager.res.mjs +79 -84
  69. package/src/LogSelection.res +236 -68
  70. package/src/LogSelection.res.mjs +211 -141
  71. package/src/Logging.res +13 -9
  72. package/src/Logging.res.mjs +130 -143
  73. package/src/Main.res +428 -51
  74. package/src/Main.res.mjs +528 -271
  75. package/src/Persistence.res +77 -84
  76. package/src/Persistence.res.mjs +131 -132
  77. package/src/PgStorage.res +291 -167
  78. package/src/PgStorage.res.mjs +797 -817
  79. package/src/Prometheus.res +50 -58
  80. package/src/Prometheus.res.mjs +345 -373
  81. package/src/ReorgDetection.res +22 -24
  82. package/src/ReorgDetection.res.mjs +100 -106
  83. package/src/SafeCheckpointTracking.res +7 -7
  84. package/src/SafeCheckpointTracking.res.mjs +40 -43
  85. package/src/SimulateItems.res +41 -49
  86. package/src/SimulateItems.res.mjs +257 -272
  87. package/src/Sink.res +2 -2
  88. package/src/Sink.res.mjs +22 -26
  89. package/src/TableIndices.res +1 -2
  90. package/src/TableIndices.res.mjs +42 -48
  91. package/src/TestIndexer.res +196 -189
  92. package/src/TestIndexer.res.mjs +536 -536
  93. package/src/TestIndexerProxyStorage.res +15 -16
  94. package/src/TestIndexerProxyStorage.res.mjs +98 -122
  95. package/src/TestIndexerWorker.res +4 -0
  96. package/src/TestIndexerWorker.res.mjs +7 -0
  97. package/src/Throttler.res +3 -3
  98. package/src/Throttler.res.mjs +23 -24
  99. package/src/Time.res +1 -1
  100. package/src/Time.res.mjs +18 -21
  101. package/src/TopicFilter.res +3 -3
  102. package/src/TopicFilter.res.mjs +29 -30
  103. package/src/UserContext.res +93 -54
  104. package/src/UserContext.res.mjs +197 -182
  105. package/src/Utils.res +141 -86
  106. package/src/Utils.res.mjs +334 -295
  107. package/src/bindings/BigDecimal.res +0 -2
  108. package/src/bindings/BigDecimal.res.mjs +19 -23
  109. package/src/bindings/ClickHouse.res +28 -27
  110. package/src/bindings/ClickHouse.res.mjs +243 -240
  111. package/src/bindings/DateFns.res +11 -11
  112. package/src/bindings/DateFns.res.mjs +7 -7
  113. package/src/bindings/EventSource.res.mjs +2 -2
  114. package/src/bindings/Express.res +2 -5
  115. package/src/bindings/Hrtime.res +2 -2
  116. package/src/bindings/Hrtime.res.mjs +30 -32
  117. package/src/bindings/Lodash.res.mjs +1 -1
  118. package/src/bindings/NodeJs.res +14 -9
  119. package/src/bindings/NodeJs.res.mjs +20 -20
  120. package/src/bindings/Pino.res +8 -10
  121. package/src/bindings/Pino.res.mjs +40 -43
  122. package/src/bindings/Postgres.res +2 -5
  123. package/src/bindings/Postgres.res.mjs +9 -9
  124. package/src/bindings/PromClient.res +17 -2
  125. package/src/bindings/PromClient.res.mjs +30 -7
  126. package/src/bindings/SDSL.res.mjs +2 -2
  127. package/src/bindings/Viem.res +4 -4
  128. package/src/bindings/Viem.res.mjs +20 -22
  129. package/src/bindings/Vitest.res +1 -1
  130. package/src/bindings/Vitest.res.mjs +2 -2
  131. package/src/bindings/WebSocket.res +1 -1
  132. package/src/db/EntityHistory.res +9 -3
  133. package/src/db/EntityHistory.res.mjs +84 -59
  134. package/src/db/InternalTable.res +62 -60
  135. package/src/db/InternalTable.res.mjs +271 -203
  136. package/src/db/Schema.res +1 -2
  137. package/src/db/Schema.res.mjs +28 -32
  138. package/src/db/Table.res +28 -27
  139. package/src/db/Table.res.mjs +276 -292
  140. package/src/sources/EventRouter.res +21 -16
  141. package/src/sources/EventRouter.res.mjs +55 -57
  142. package/src/sources/Evm.res +17 -1
  143. package/src/sources/Evm.res.mjs +16 -8
  144. package/src/sources/EvmChain.res +15 -17
  145. package/src/sources/EvmChain.res.mjs +40 -42
  146. package/src/sources/Fuel.res +14 -1
  147. package/src/sources/Fuel.res.mjs +16 -8
  148. package/src/sources/FuelSDK.res +1 -1
  149. package/src/sources/FuelSDK.res.mjs +6 -8
  150. package/src/sources/HyperFuel.res +8 -10
  151. package/src/sources/HyperFuel.res.mjs +113 -123
  152. package/src/sources/HyperFuelClient.res.mjs +6 -7
  153. package/src/sources/HyperFuelSource.res +19 -20
  154. package/src/sources/HyperFuelSource.res.mjs +339 -356
  155. package/src/sources/HyperSync.res +11 -13
  156. package/src/sources/HyperSync.res.mjs +206 -220
  157. package/src/sources/HyperSyncClient.res +5 -7
  158. package/src/sources/HyperSyncClient.res.mjs +70 -75
  159. package/src/sources/HyperSyncHeightStream.res +8 -9
  160. package/src/sources/HyperSyncHeightStream.res.mjs +78 -86
  161. package/src/sources/HyperSyncJsonApi.res +18 -15
  162. package/src/sources/HyperSyncJsonApi.res.mjs +201 -231
  163. package/src/sources/HyperSyncSource.res +17 -21
  164. package/src/sources/HyperSyncSource.res.mjs +268 -290
  165. package/src/sources/Rpc.res +5 -5
  166. package/src/sources/Rpc.res.mjs +168 -192
  167. package/src/sources/RpcSource.res +166 -167
  168. package/src/sources/RpcSource.res.mjs +972 -1046
  169. package/src/sources/RpcWebSocketHeightStream.res +10 -11
  170. package/src/sources/RpcWebSocketHeightStream.res.mjs +131 -145
  171. package/src/sources/SimulateSource.res +1 -1
  172. package/src/sources/SimulateSource.res.mjs +35 -38
  173. package/src/sources/Source.res +1 -1
  174. package/src/sources/Source.res.mjs +3 -3
  175. package/src/sources/SourceManager.res +39 -20
  176. package/src/sources/SourceManager.res.mjs +340 -371
  177. package/src/sources/SourceManager.resi +2 -1
  178. package/src/sources/Svm.res +12 -5
  179. package/src/sources/Svm.res.mjs +44 -41
  180. package/src/tui/Tui.res +23 -12
  181. package/src/tui/Tui.res.mjs +292 -290
  182. package/src/tui/bindings/Ink.res +2 -4
  183. package/src/tui/bindings/Ink.res.mjs +35 -41
  184. package/src/tui/components/BufferedProgressBar.res +7 -7
  185. package/src/tui/components/BufferedProgressBar.res.mjs +46 -46
  186. package/src/tui/components/CustomHooks.res +1 -2
  187. package/src/tui/components/CustomHooks.res.mjs +102 -122
  188. package/src/tui/components/Messages.res +1 -2
  189. package/src/tui/components/Messages.res.mjs +38 -42
  190. package/src/tui/components/SyncETA.res +10 -11
  191. package/src/tui/components/SyncETA.res.mjs +178 -196
  192. package/src/tui/components/TuiData.res +1 -1
  193. package/src/tui/components/TuiData.res.mjs +7 -6
  194. package/src/vendored/Rest.res +52 -66
  195. package/src/vendored/Rest.res.mjs +324 -364
  196. package/svm.schema.json +67 -0
  197. package/src/Address.gen.ts +0 -8
  198. package/src/Config.gen.ts +0 -19
  199. package/src/Envio.gen.ts +0 -55
  200. package/src/EvmTypes.gen.ts +0 -6
  201. package/src/InMemoryStore.gen.ts +0 -6
  202. package/src/Internal.gen.ts +0 -64
  203. package/src/PgStorage.gen.ts +0 -10
  204. package/src/PgStorage.res.d.mts +0 -5
  205. package/src/Types.ts +0 -56
  206. package/src/bindings/BigDecimal.gen.ts +0 -14
  207. package/src/bindings/BigDecimal.res.d.mts +0 -5
  208. package/src/bindings/BigInt.gen.ts +0 -10
  209. package/src/bindings/BigInt.res +0 -70
  210. package/src/bindings/BigInt.res.d.mts +0 -5
  211. package/src/bindings/BigInt.res.mjs +0 -154
  212. package/src/bindings/Ethers.res.d.mts +0 -5
  213. package/src/bindings/Pino.gen.ts +0 -17
  214. package/src/bindings/Postgres.gen.ts +0 -8
  215. package/src/bindings/Postgres.res.d.mts +0 -5
  216. package/src/bindings/Promise.res +0 -67
  217. package/src/bindings/Promise.res.mjs +0 -26
  218. package/src/db/InternalTable.gen.ts +0 -36
  219. package/src/sources/HyperSyncClient.gen.ts +0 -19
package/src/Sink.res.mjs CHANGED
@@ -1,38 +1,34 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
- import * as Belt_Array from "rescript/lib/es6/belt_Array.js";
3
+ import * as Belt_Array from "@rescript/runtime/lib/es6/Belt_Array.js";
4
4
  import * as ClickHouse from "./bindings/ClickHouse.res.mjs";
5
5
  import * as Client from "@clickhouse/client";
6
6
 
7
7
  function makeClickHouse(host, database, username, password) {
8
- var client = Client.createClient({
9
- url: host,
10
- username: username,
11
- password: password
12
- });
13
- var database$1 = database !== undefined ? database : "envio_sink";
14
- var cache = new WeakMap();
8
+ let client = Client.createClient({
9
+ url: host,
10
+ username: username,
11
+ password: password
12
+ });
13
+ let database$1 = database !== undefined ? database : "envio_sink";
14
+ let cache = new WeakMap();
15
15
  return {
16
- name: "ClickHouse",
17
- initialize: (function ($staropt$star, $staropt$star$1, $staropt$star$2) {
18
- $staropt$star !== undefined;
19
- var entities = $staropt$star$1 !== undefined ? $staropt$star$1 : [];
20
- var enums = $staropt$star$2 !== undefined ? $staropt$star$2 : [];
21
- return ClickHouse.initialize(client, database$1, entities, enums);
22
- }),
23
- resume: (function (checkpointId) {
24
- return ClickHouse.resume(client, database$1, checkpointId);
25
- }),
26
- writeBatch: (async function (batch, updatedEntities) {
27
- await Promise.all(Belt_Array.map(updatedEntities, (function (param) {
28
- return ClickHouse.setUpdatesOrThrow(client, cache, param.updates, param.entityConfig, database$1);
29
- })));
30
- return await ClickHouse.setCheckpointsOrThrow(client, batch, database$1);
31
- })
32
- };
16
+ name: "clickhouse",
17
+ initialize: ($staropt$star, $staropt$star$1, $staropt$star$2) => {
18
+ $staropt$star !== undefined;
19
+ let entities = $staropt$star$1 !== undefined ? $staropt$star$1 : [];
20
+ let enums = $staropt$star$2 !== undefined ? $staropt$star$2 : [];
21
+ return ClickHouse.initialize(client, database$1, entities, enums);
22
+ },
23
+ resume: checkpointId => ClickHouse.resume(client, database$1, checkpointId),
24
+ writeBatch: async (batch, updatedEntities) => {
25
+ await Promise.all(Belt_Array.map(updatedEntities, param => ClickHouse.setUpdatesOrThrow(client, cache, param.updates, param.entityConfig, database$1)));
26
+ return await ClickHouse.setCheckpointsOrThrow(client, batch, database$1);
27
+ }
28
+ };
33
29
  }
34
30
 
35
31
  export {
36
- makeClickHouse ,
32
+ makeClickHouse,
37
33
  }
38
34
  /* ClickHouse Not a pure module */
@@ -1,5 +1,4 @@
1
1
  module FieldValue = {
2
- open Belt
3
2
  @unboxed
4
3
  type rec tNonOptional =
5
4
  | String(string)
@@ -16,7 +15,7 @@ module FieldValue = {
16
15
  | Int(v) => v->Int.toString
17
16
  | BigDecimal(v) => v->BigDecimal.toString
18
17
  | Bool(v) => v ? "true" : "false"
19
- | Array(v) => `[${v->Array.joinWith(",", toString)}]`
18
+ | Array(v) => `[${v->Belt.Array.joinWith(",", toString)}]`
20
19
  }
21
20
 
22
21
  //This needs to be a castable type from any type that we
@@ -1,27 +1,26 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
- import * as Caml_obj from "rescript/lib/es6/caml_obj.js";
4
- import * as Belt_Array from "rescript/lib/es6/belt_Array.js";
3
+ import * as Belt_Array from "@rescript/runtime/lib/es6/Belt_Array.js";
4
+ import * as Primitive_object from "@rescript/runtime/lib/es6/Primitive_object.js";
5
5
 
6
6
  function toString(tNonOptional) {
7
7
  if (Array.isArray(tNonOptional)) {
8
- return "[" + Belt_Array.joinWith(tNonOptional, ",", toString) + "]";
8
+ return `[` + Belt_Array.joinWith(tNonOptional, ",", toString) + `]`;
9
9
  }
10
10
  switch (typeof tNonOptional) {
11
11
  case "string" :
12
- return tNonOptional;
13
- case "number" :
14
- return String(tNonOptional);
12
+ return tNonOptional;
15
13
  case "bigint" :
14
+ case "number" :
15
+ return tNonOptional.toString();
16
16
  case "object" :
17
- return tNonOptional.toString();
17
+ return tNonOptional.toString();
18
18
  case "boolean" :
19
- if (tNonOptional) {
20
- return "true";
21
- } else {
22
- return "false";
23
- }
24
-
19
+ if (tNonOptional) {
20
+ return "true";
21
+ } else {
22
+ return "false";
23
+ }
25
24
  }
26
25
  }
27
26
 
@@ -34,75 +33,74 @@ function toString$1(value) {
34
33
  }
35
34
 
36
35
  function eq(a, b) {
37
- if (a !== undefined && typeof a === "object" && !Array.isArray(a) && b !== undefined && typeof b === "object" && !Array.isArray(b)) {
36
+ if (typeof a === "object" && !Array.isArray(a) && typeof b === "object" && !Array.isArray(b)) {
38
37
  return a.isEqualTo(b);
39
38
  } else {
40
- return Caml_obj.equal(a, b);
39
+ return Primitive_object.equal(a, b);
41
40
  }
42
41
  }
43
42
 
44
43
  function gt(a, b) {
45
- if (a !== undefined && typeof a === "object" && !Array.isArray(a) && b !== undefined && typeof b === "object" && !Array.isArray(b)) {
44
+ if (typeof a === "object" && !Array.isArray(a) && typeof b === "object" && !Array.isArray(b)) {
46
45
  return a.isGreaterThan(b);
47
46
  } else {
48
- return Caml_obj.greaterthan(a, b);
47
+ return Primitive_object.greaterthan(a, b);
49
48
  }
50
49
  }
51
50
 
52
51
  function lt(a, b) {
53
- if (a !== undefined && typeof a === "object" && !Array.isArray(a) && b !== undefined && typeof b === "object" && !Array.isArray(b)) {
52
+ if (typeof a === "object" && !Array.isArray(a) && typeof b === "object" && !Array.isArray(b)) {
54
53
  return a.isLessThan(b);
55
54
  } else {
56
- return Caml_obj.lessthan(a, b);
55
+ return Primitive_object.lessthan(a, b);
57
56
  }
58
57
  }
59
58
 
60
- var FieldValue = {
59
+ let FieldValue = {
61
60
  toString: toString$1,
62
61
  eq: eq,
63
62
  gt: gt,
64
63
  lt: lt
65
64
  };
66
65
 
67
- var values = [
66
+ let values = [
68
67
  "Eq",
69
68
  "Gt",
70
69
  "Lt"
71
70
  ];
72
71
 
73
- var Operator = {
72
+ let Operator = {
74
73
  values: values
75
74
  };
76
75
 
77
76
  function make(fieldName, fieldValue, operator) {
78
77
  return {
79
- fieldName: fieldName,
80
- fieldValue: fieldValue,
81
- operator: operator
82
- };
78
+ fieldName: fieldName,
79
+ fieldValue: fieldValue,
80
+ operator: operator
81
+ };
83
82
  }
84
83
 
85
84
  function toString$2(param) {
86
- return param.fieldName + ":" + param.operator + ":" + toString$1(param.fieldValue);
85
+ return param.fieldName + `:` + param.operator + `:` + toString$1(param.fieldValue);
87
86
  }
88
87
 
89
88
  function evaluate(self, fieldName, fieldValue) {
90
89
  if (self.fieldName !== fieldName) {
91
90
  return false;
92
91
  }
93
- var match = self.operator;
92
+ let match = self.operator;
94
93
  switch (match) {
95
94
  case "Eq" :
96
- return eq(fieldValue, self.fieldValue);
95
+ return eq(fieldValue, self.fieldValue);
97
96
  case "Gt" :
98
- return gt(fieldValue, self.fieldValue);
97
+ return gt(fieldValue, self.fieldValue);
99
98
  case "Lt" :
100
- return lt(fieldValue, self.fieldValue);
101
-
99
+ return lt(fieldValue, self.fieldValue);
102
100
  }
103
101
  }
104
102
 
105
- var SingleIndex = {
103
+ let SingleIndex = {
106
104
  make: make,
107
105
  toString: toString$2,
108
106
  evaluate: evaluate
@@ -110,25 +108,21 @@ var SingleIndex = {
110
108
 
111
109
  function makeSingle(fieldName, fieldValue, operator) {
112
110
  return {
113
- fieldName: fieldName,
114
- fieldValue: fieldValue,
115
- operator: operator
116
- };
111
+ fieldName: fieldName,
112
+ fieldValue: fieldValue,
113
+ operator: operator
114
+ };
117
115
  }
118
116
 
119
117
  function getFieldName(index) {
120
118
  return index.fieldName;
121
119
  }
122
120
 
123
- function toString$3(index) {
124
- return toString$2(index);
125
- }
121
+ let toString$3 = toString$2;
126
122
 
127
- function evaluate$1(index, fieldName, fieldValue) {
128
- return evaluate(index, fieldName, fieldValue);
129
- }
123
+ let evaluate$1 = evaluate;
130
124
 
131
- var Index = {
125
+ let Index = {
132
126
  makeSingle: makeSingle,
133
127
  getFieldName: getFieldName,
134
128
  toString: toString$3,
@@ -136,9 +130,9 @@ var Index = {
136
130
  };
137
131
 
138
132
  export {
139
- FieldValue ,
140
- Operator ,
141
- SingleIndex ,
142
- Index ,
133
+ FieldValue,
134
+ Operator,
135
+ SingleIndex,
136
+ Index,
143
137
  }
144
138
  /* No side effect */