envio 3.0.0-alpha.21 → 3.0.0-alpha.23

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 (220) hide show
  1. package/README.md +3 -3
  2. package/bin.mjs +2 -48
  3. package/evm.schema.json +67 -0
  4. package/fuel.schema.json +67 -0
  5. package/index.d.ts +822 -38
  6. package/index.js +5 -3
  7. package/package.json +10 -8
  8. package/rescript.json +5 -9
  9. package/src/Address.res +4 -5
  10. package/src/Address.res.mjs +9 -12
  11. package/src/Api.res +15 -0
  12. package/src/Api.res.mjs +20 -0
  13. package/src/Batch.res +32 -34
  14. package/src/Batch.res.mjs +172 -187
  15. package/src/Bin.res +89 -0
  16. package/src/Bin.res.mjs +97 -0
  17. package/src/ChainFetcher.res +33 -57
  18. package/src/ChainFetcher.res.mjs +197 -227
  19. package/src/ChainManager.res +6 -14
  20. package/src/ChainManager.res.mjs +74 -85
  21. package/src/ChainMap.res +14 -16
  22. package/src/ChainMap.res.mjs +38 -38
  23. package/src/Config.res +193 -135
  24. package/src/Config.res.mjs +566 -592
  25. package/src/Core.res +182 -0
  26. package/src/Core.res.mjs +207 -0
  27. package/src/Ecosystem.res +25 -4
  28. package/src/Ecosystem.res.mjs +12 -13
  29. package/src/Env.res +20 -13
  30. package/src/Env.res.mjs +124 -113
  31. package/src/EnvSafe.res +269 -0
  32. package/src/EnvSafe.res.mjs +296 -0
  33. package/src/EnvSafe.resi +18 -0
  34. package/src/Envio.res +37 -26
  35. package/src/Envio.res.mjs +59 -60
  36. package/src/ErrorHandling.res +2 -2
  37. package/src/ErrorHandling.res.mjs +15 -15
  38. package/src/EventConfigBuilder.res +219 -81
  39. package/src/EventConfigBuilder.res.mjs +259 -202
  40. package/src/EventProcessing.res +27 -38
  41. package/src/EventProcessing.res.mjs +165 -183
  42. package/src/EventUtils.res +11 -11
  43. package/src/EventUtils.res.mjs +21 -22
  44. package/src/EvmTypes.res +0 -1
  45. package/src/EvmTypes.res.mjs +5 -5
  46. package/src/FetchState.res +360 -256
  47. package/src/FetchState.res.mjs +958 -914
  48. package/src/GlobalState.res +365 -351
  49. package/src/GlobalState.res.mjs +958 -992
  50. package/src/GlobalStateManager.res +1 -2
  51. package/src/GlobalStateManager.res.mjs +36 -44
  52. package/src/HandlerLoader.res +107 -23
  53. package/src/HandlerLoader.res.mjs +128 -38
  54. package/src/HandlerRegister.res +127 -103
  55. package/src/HandlerRegister.res.mjs +164 -164
  56. package/src/HandlerRegister.resi +12 -4
  57. package/src/Hasura.res +35 -22
  58. package/src/Hasura.res.mjs +158 -167
  59. package/src/InMemoryStore.res +20 -27
  60. package/src/InMemoryStore.res.mjs +64 -80
  61. package/src/InMemoryTable.res +34 -39
  62. package/src/InMemoryTable.res.mjs +165 -170
  63. package/src/Internal.res +52 -33
  64. package/src/Internal.res.mjs +84 -81
  65. package/src/LazyLoader.res.mjs +55 -61
  66. package/src/LoadLayer.res +77 -78
  67. package/src/LoadLayer.res.mjs +160 -189
  68. package/src/LoadManager.res +16 -21
  69. package/src/LoadManager.res.mjs +79 -84
  70. package/src/LogSelection.res +236 -68
  71. package/src/LogSelection.res.mjs +211 -141
  72. package/src/Logging.res +13 -9
  73. package/src/Logging.res.mjs +130 -143
  74. package/src/Main.res +430 -51
  75. package/src/Main.res.mjs +530 -271
  76. package/src/Persistence.res +80 -84
  77. package/src/Persistence.res.mjs +131 -132
  78. package/src/PgStorage.res +294 -167
  79. package/src/PgStorage.res.mjs +799 -817
  80. package/src/Prometheus.res +50 -58
  81. package/src/Prometheus.res.mjs +345 -373
  82. package/src/ReorgDetection.res +22 -24
  83. package/src/ReorgDetection.res.mjs +100 -106
  84. package/src/SafeCheckpointTracking.res +7 -7
  85. package/src/SafeCheckpointTracking.res.mjs +40 -43
  86. package/src/SimulateItems.res +41 -49
  87. package/src/SimulateItems.res.mjs +257 -272
  88. package/src/Sink.res +2 -2
  89. package/src/Sink.res.mjs +22 -26
  90. package/src/TableIndices.res +1 -2
  91. package/src/TableIndices.res.mjs +42 -48
  92. package/src/TestIndexer.res +196 -189
  93. package/src/TestIndexer.res.mjs +536 -536
  94. package/src/TestIndexerProxyStorage.res +16 -16
  95. package/src/TestIndexerProxyStorage.res.mjs +99 -122
  96. package/src/TestIndexerWorker.res +4 -0
  97. package/src/TestIndexerWorker.res.mjs +7 -0
  98. package/src/Throttler.res +3 -3
  99. package/src/Throttler.res.mjs +23 -24
  100. package/src/Time.res +1 -1
  101. package/src/Time.res.mjs +18 -21
  102. package/src/TopicFilter.res +3 -3
  103. package/src/TopicFilter.res.mjs +29 -30
  104. package/src/UserContext.res +93 -54
  105. package/src/UserContext.res.mjs +197 -182
  106. package/src/Utils.res +141 -86
  107. package/src/Utils.res.mjs +334 -295
  108. package/src/bindings/BigDecimal.res +0 -2
  109. package/src/bindings/BigDecimal.res.mjs +19 -23
  110. package/src/bindings/ClickHouse.res +28 -27
  111. package/src/bindings/ClickHouse.res.mjs +243 -240
  112. package/src/bindings/DateFns.res +11 -11
  113. package/src/bindings/DateFns.res.mjs +7 -7
  114. package/src/bindings/EventSource.res.mjs +2 -2
  115. package/src/bindings/Express.res +2 -5
  116. package/src/bindings/Hrtime.res +2 -2
  117. package/src/bindings/Hrtime.res.mjs +30 -32
  118. package/src/bindings/Lodash.res.mjs +1 -1
  119. package/src/bindings/NodeJs.res +14 -9
  120. package/src/bindings/NodeJs.res.mjs +20 -20
  121. package/src/bindings/Pino.res +8 -10
  122. package/src/bindings/Pino.res.mjs +40 -43
  123. package/src/bindings/Postgres.res +7 -5
  124. package/src/bindings/Postgres.res.mjs +9 -9
  125. package/src/bindings/PromClient.res +17 -2
  126. package/src/bindings/PromClient.res.mjs +30 -7
  127. package/src/bindings/SDSL.res.mjs +2 -2
  128. package/src/bindings/Viem.res +4 -4
  129. package/src/bindings/Viem.res.mjs +20 -22
  130. package/src/bindings/Vitest.res +1 -1
  131. package/src/bindings/Vitest.res.mjs +2 -2
  132. package/src/bindings/WebSocket.res +1 -1
  133. package/src/db/EntityHistory.res +9 -3
  134. package/src/db/EntityHistory.res.mjs +84 -59
  135. package/src/db/InternalTable.res +62 -60
  136. package/src/db/InternalTable.res.mjs +271 -203
  137. package/src/db/Schema.res +1 -2
  138. package/src/db/Schema.res.mjs +28 -32
  139. package/src/db/Table.res +28 -27
  140. package/src/db/Table.res.mjs +276 -292
  141. package/src/sources/EventRouter.res +21 -16
  142. package/src/sources/EventRouter.res.mjs +55 -57
  143. package/src/sources/Evm.res +17 -1
  144. package/src/sources/Evm.res.mjs +16 -8
  145. package/src/sources/EvmChain.res +15 -17
  146. package/src/sources/EvmChain.res.mjs +40 -42
  147. package/src/sources/Fuel.res +14 -1
  148. package/src/sources/Fuel.res.mjs +16 -8
  149. package/src/sources/FuelSDK.res +1 -1
  150. package/src/sources/FuelSDK.res.mjs +6 -8
  151. package/src/sources/HyperFuel.res +8 -10
  152. package/src/sources/HyperFuel.res.mjs +113 -123
  153. package/src/sources/HyperFuelClient.res.mjs +6 -7
  154. package/src/sources/HyperFuelSource.res +19 -20
  155. package/src/sources/HyperFuelSource.res.mjs +339 -356
  156. package/src/sources/HyperSync.res +11 -13
  157. package/src/sources/HyperSync.res.mjs +206 -220
  158. package/src/sources/HyperSyncClient.res +5 -7
  159. package/src/sources/HyperSyncClient.res.mjs +70 -75
  160. package/src/sources/HyperSyncHeightStream.res +8 -9
  161. package/src/sources/HyperSyncHeightStream.res.mjs +78 -86
  162. package/src/sources/HyperSyncJsonApi.res +18 -15
  163. package/src/sources/HyperSyncJsonApi.res.mjs +201 -231
  164. package/src/sources/HyperSyncSource.res +17 -21
  165. package/src/sources/HyperSyncSource.res.mjs +268 -290
  166. package/src/sources/Rpc.res +5 -5
  167. package/src/sources/Rpc.res.mjs +168 -192
  168. package/src/sources/RpcSource.res +166 -167
  169. package/src/sources/RpcSource.res.mjs +972 -1046
  170. package/src/sources/RpcWebSocketHeightStream.res +10 -11
  171. package/src/sources/RpcWebSocketHeightStream.res.mjs +131 -145
  172. package/src/sources/SimulateSource.res +1 -1
  173. package/src/sources/SimulateSource.res.mjs +35 -38
  174. package/src/sources/Source.res +1 -1
  175. package/src/sources/Source.res.mjs +3 -3
  176. package/src/sources/SourceManager.res +39 -20
  177. package/src/sources/SourceManager.res.mjs +340 -371
  178. package/src/sources/SourceManager.resi +2 -1
  179. package/src/sources/Svm.res +12 -5
  180. package/src/sources/Svm.res.mjs +44 -41
  181. package/src/tui/Tui.res +23 -12
  182. package/src/tui/Tui.res.mjs +292 -290
  183. package/src/tui/bindings/Ink.res +2 -4
  184. package/src/tui/bindings/Ink.res.mjs +35 -41
  185. package/src/tui/components/BufferedProgressBar.res +7 -7
  186. package/src/tui/components/BufferedProgressBar.res.mjs +46 -46
  187. package/src/tui/components/CustomHooks.res +1 -2
  188. package/src/tui/components/CustomHooks.res.mjs +102 -122
  189. package/src/tui/components/Messages.res +1 -2
  190. package/src/tui/components/Messages.res.mjs +38 -42
  191. package/src/tui/components/SyncETA.res +10 -11
  192. package/src/tui/components/SyncETA.res.mjs +178 -196
  193. package/src/tui/components/TuiData.res +1 -1
  194. package/src/tui/components/TuiData.res.mjs +7 -6
  195. package/src/vendored/Rest.res +52 -66
  196. package/src/vendored/Rest.res.mjs +324 -364
  197. package/svm.schema.json +67 -0
  198. package/src/Address.gen.ts +0 -8
  199. package/src/Config.gen.ts +0 -19
  200. package/src/Envio.gen.ts +0 -55
  201. package/src/EvmTypes.gen.ts +0 -6
  202. package/src/InMemoryStore.gen.ts +0 -6
  203. package/src/Internal.gen.ts +0 -64
  204. package/src/PgStorage.gen.ts +0 -10
  205. package/src/PgStorage.res.d.mts +0 -5
  206. package/src/Types.ts +0 -56
  207. package/src/bindings/BigDecimal.gen.ts +0 -14
  208. package/src/bindings/BigDecimal.res.d.mts +0 -5
  209. package/src/bindings/BigInt.gen.ts +0 -10
  210. package/src/bindings/BigInt.res +0 -70
  211. package/src/bindings/BigInt.res.d.mts +0 -5
  212. package/src/bindings/BigInt.res.mjs +0 -154
  213. package/src/bindings/Ethers.res.d.mts +0 -5
  214. package/src/bindings/Pino.gen.ts +0 -17
  215. package/src/bindings/Postgres.gen.ts +0 -8
  216. package/src/bindings/Postgres.res.d.mts +0 -5
  217. package/src/bindings/Promise.res +0 -67
  218. package/src/bindings/Promise.res.mjs +0 -26
  219. package/src/db/InternalTable.gen.ts +0 -36
  220. package/src/sources/HyperSyncClient.gen.ts +0 -19
@@ -2,27 +2,23 @@
2
2
 
3
3
  import * as Utils from "./Utils.res.mjs";
4
4
  import * as Hrtime from "./bindings/Hrtime.res.mjs";
5
- import * as Js_exn from "rescript/lib/es6/js_exn.js";
6
- import * as Belt_Array from "rescript/lib/es6/belt_Array.js";
7
- import * as PromClient from "prom-client";
5
+ import * as Belt_Array from "@rescript/runtime/lib/es6/Belt_Array.js";
6
+ import * as PromClient from "./bindings/PromClient.res.mjs";
7
+ import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
8
8
  import * as S$RescriptSchema from "rescript-schema/src/S.res.mjs";
9
9
 
10
10
  function schemaIsString(_schema) {
11
- while(true) {
12
- var schema = _schema;
13
- var match = schema.t;
11
+ while (true) {
12
+ let schema = _schema;
13
+ let match = schema.t;
14
14
  if (typeof match !== "object") {
15
- if (match === "string") {
16
- return true;
17
- } else {
18
- return false;
19
- }
15
+ return match === "string";
20
16
  }
21
17
  switch (match.TAG) {
22
18
  case "option" :
23
19
  case "null" :
24
- _schema = match._0;
25
- continue ;
20
+ _schema = match._0;
21
+ continue;
26
22
  default:
27
23
  return false;
28
24
  }
@@ -30,117 +26,109 @@ function schemaIsString(_schema) {
30
26
  }
31
27
 
32
28
  function getLabelNames(schema) {
33
- var match = schema.t;
29
+ let match = schema.t;
34
30
  if (typeof match !== "object") {
35
31
  return {
36
- TAG: "Error",
37
- _0: "Label schema must be an object"
38
- };
32
+ TAG: "Error",
33
+ _0: "Label schema must be an object"
34
+ };
39
35
  }
40
36
  if (match.TAG !== "object") {
41
37
  return {
42
- TAG: "Error",
43
- _0: "Label schema must be an object"
44
- };
38
+ TAG: "Error",
39
+ _0: "Label schema must be an object"
40
+ };
45
41
  }
46
- var items = match.items;
47
- var nonStringFields = Belt_Array.reduce(items, [], (function (nonStringFields, item) {
48
- if (schemaIsString(item.schema)) {
49
- return nonStringFields;
50
- } else {
51
- return Belt_Array.concat(nonStringFields, [item.location]);
52
- }
53
- }));
42
+ let items = match.items;
43
+ let nonStringFields = Belt_Array.reduce(items, [], (nonStringFields, item) => {
44
+ if (schemaIsString(item.schema)) {
45
+ return nonStringFields;
46
+ } else {
47
+ return Belt_Array.concat(nonStringFields, [item.location]);
48
+ }
49
+ });
54
50
  if (nonStringFields.length === 0) {
55
51
  return {
56
- TAG: "Ok",
57
- _0: Belt_Array.map(items, (function (item) {
58
- return item.location;
59
- }))
60
- };
52
+ TAG: "Ok",
53
+ _0: Belt_Array.map(items, item => item.location)
54
+ };
61
55
  }
62
- var nonStringItems = nonStringFields.join(", ");
56
+ let nonStringItems = nonStringFields.join(", ");
63
57
  return {
64
- TAG: "Error",
65
- _0: "Label schema must be an object with string (or optional string) values. Non string values: " + nonStringItems
66
- };
58
+ TAG: "Error",
59
+ _0: `Label schema must be an object with string (or optional string) values. Non string values: ` + nonStringItems
60
+ };
67
61
  }
68
62
 
69
- var Labels = {
63
+ let Labels = {
70
64
  schemaIsString: schemaIsString,
71
65
  getLabelNames: getLabelNames
72
66
  };
73
67
 
74
- var metricNames = new Set();
68
+ let metricNames = new Set();
75
69
 
76
70
  function MakeSafePromMetric(M) {
77
- var makeOrThrow = function (name, help, labelSchema) {
78
- var labelNames = getLabelNames(labelSchema);
71
+ let makeOrThrow = (name, help, labelSchema) => {
72
+ let labelNames = getLabelNames(labelSchema);
79
73
  if (labelNames.TAG !== "Ok") {
80
- return Js_exn.raiseError(labelNames._0);
74
+ return Stdlib_JsError.throwWithMessage(labelNames._0);
81
75
  }
82
76
  if (metricNames.has(name)) {
83
- return Js_exn.raiseError("Duplicate prometheus metric name: " + name);
77
+ return Stdlib_JsError.throwWithMessage("Duplicate prometheus metric name: " + name);
84
78
  }
85
79
  metricNames.add(name);
86
- var metric = M.make({
87
- name: name,
88
- help: help,
89
- labelNames: labelNames._0
90
- });
80
+ let metric = M.make({
81
+ name: name,
82
+ help: help,
83
+ labelNames: labelNames._0
84
+ });
91
85
  return {
92
- metric: metric,
93
- labelSchema: labelSchema
94
- };
95
- };
96
- var handleFloat = function (param, labels, value) {
97
- M.handleFloat(M.labels(param.metric, S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema)), value);
98
- };
99
- var handleInt = function (param, labels, value) {
100
- M.handleInt(M.labels(param.metric, S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema)), value);
101
- };
102
- var increment = function (param, labels) {
103
- return M.labels(param.metric, S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema)).inc();
104
- };
105
- var incrementMany = function (param, labels, value) {
106
- return M.labels(param.metric, S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema)).inc(value);
86
+ metric: metric,
87
+ labelSchema: labelSchema
88
+ };
107
89
  };
90
+ let handleFloat = (param, labels, value) => M.handleFloat(M.labels(param.metric, S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema)), value);
91
+ let handleInt = (param, labels, value) => M.handleInt(M.labels(param.metric, S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema)), value);
92
+ let increment = (param, labels) => M.labels(param.metric, S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema)).inc();
93
+ let incrementMany = (param, labels, value) => M.labels(param.metric, S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema)).inc(value);
108
94
  return {
109
- makeOrThrow: makeOrThrow,
110
- handleInt: handleInt,
111
- handleFloat: handleFloat,
112
- increment: increment,
113
- incrementMany: incrementMany
114
- };
95
+ makeOrThrow: makeOrThrow,
96
+ handleInt: handleInt,
97
+ handleFloat: handleFloat,
98
+ increment: increment,
99
+ incrementMany: incrementMany
100
+ };
115
101
  }
116
102
 
103
+ let make = PromClient.Counter.makeCounter;
104
+
117
105
  function makeOrThrow(name, help, labelSchema) {
118
- var labelNames = getLabelNames(labelSchema);
106
+ let labelNames = getLabelNames(labelSchema);
119
107
  if (labelNames.TAG !== "Ok") {
120
- return Js_exn.raiseError(labelNames._0);
108
+ return Stdlib_JsError.throwWithMessage(labelNames._0);
121
109
  }
122
110
  if (metricNames.has(name)) {
123
- return Js_exn.raiseError("Duplicate prometheus metric name: " + name);
111
+ return Stdlib_JsError.throwWithMessage("Duplicate prometheus metric name: " + name);
124
112
  }
125
113
  metricNames.add(name);
126
- var metric = new PromClient.Counter({
127
- name: name,
128
- help: help,
129
- labelNames: labelNames._0
130
- });
114
+ let metric = make({
115
+ name: name,
116
+ help: help,
117
+ labelNames: labelNames._0
118
+ });
131
119
  return {
132
- metric: metric,
133
- labelSchema: labelSchema
134
- };
120
+ metric: metric,
121
+ labelSchema: labelSchema
122
+ };
135
123
  }
136
124
 
137
125
  function handleFloat(param, labels, value) {
138
- var prim0 = param.metric.labels(S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema));
126
+ let prim0 = param.metric.labels(S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema));
139
127
  prim0.inc(value);
140
128
  }
141
129
 
142
130
  function handleInt(param, labels, value) {
143
- var prim0 = param.metric.labels(S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema));
131
+ let prim0 = param.metric.labels(S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema));
144
132
  prim0.inc(value);
145
133
  }
146
134
 
@@ -152,7 +140,7 @@ function incrementMany(param, labels, value) {
152
140
  return param.metric.labels(S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema)).inc(value);
153
141
  }
154
142
 
155
- var SafeCounter = {
143
+ let SafeCounter = {
156
144
  makeOrThrow: makeOrThrow,
157
145
  handleInt: handleInt,
158
146
  handleFloat: handleFloat,
@@ -160,33 +148,35 @@ var SafeCounter = {
160
148
  incrementMany: incrementMany
161
149
  };
162
150
 
151
+ let make$1 = PromClient.Gauge.makeGauge;
152
+
163
153
  function makeOrThrow$1(name, help, labelSchema) {
164
- var labelNames = getLabelNames(labelSchema);
154
+ let labelNames = getLabelNames(labelSchema);
165
155
  if (labelNames.TAG !== "Ok") {
166
- return Js_exn.raiseError(labelNames._0);
156
+ return Stdlib_JsError.throwWithMessage(labelNames._0);
167
157
  }
168
158
  if (metricNames.has(name)) {
169
- return Js_exn.raiseError("Duplicate prometheus metric name: " + name);
159
+ return Stdlib_JsError.throwWithMessage("Duplicate prometheus metric name: " + name);
170
160
  }
171
161
  metricNames.add(name);
172
- var metric = new PromClient.Gauge({
173
- name: name,
174
- help: help,
175
- labelNames: labelNames._0
176
- });
162
+ let metric = make$1({
163
+ name: name,
164
+ help: help,
165
+ labelNames: labelNames._0
166
+ });
177
167
  return {
178
- metric: metric,
179
- labelSchema: labelSchema
180
- };
168
+ metric: metric,
169
+ labelSchema: labelSchema
170
+ };
181
171
  }
182
172
 
183
173
  function handleFloat$1(param, labels, value) {
184
- var prim0 = param.metric.labels(S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema));
174
+ let prim0 = param.metric.labels(S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema));
185
175
  prim0.set(value);
186
176
  }
187
177
 
188
178
  function handleInt$1(param, labels, value) {
189
- var prim0 = param.metric.labels(S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema));
179
+ let prim0 = param.metric.labels(S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema));
190
180
  prim0.set(value);
191
181
  }
192
182
 
@@ -198,7 +188,7 @@ function incrementMany$1(param, labels, value) {
198
188
  return param.metric.labels(S$RescriptSchema.reverseConvertToJsonOrThrow(labels, param.labelSchema)).inc(value);
199
189
  }
200
190
 
201
- var SafeGauge = {
191
+ let SafeGauge = {
202
192
  makeOrThrow: makeOrThrow$1,
203
193
  handleInt: handleInt$1,
204
194
  handleFloat: handleFloat$1,
@@ -206,51 +196,35 @@ var SafeGauge = {
206
196
  incrementMany: incrementMany$1
207
197
  };
208
198
 
209
- var loadTimeCounter = new PromClient.Counter({
210
- name: "envio_preload_seconds",
211
- help: "Cumulative time spent on preloading entities during batch processing."
212
- });
199
+ let loadTimeCounter = PromClient.Counter.makeCounter({
200
+ name: "envio_preload_seconds",
201
+ help: "Cumulative time spent on preloading entities during batch processing."
202
+ });
213
203
 
214
- var handlerTimeCounter = new PromClient.Counter({
215
- name: "envio_processing_seconds",
216
- help: "Cumulative time spent executing event handlers during batch processing."
217
- });
204
+ let handlerTimeCounter = PromClient.Counter.makeCounter({
205
+ name: "envio_processing_seconds",
206
+ help: "Cumulative time spent executing event handlers during batch processing."
207
+ });
218
208
 
219
- var writeTimeCounter = new PromClient.Counter({
220
- name: "envio_storage_write_seconds",
221
- help: "Cumulative time spent writing batch data to storage."
222
- });
223
-
224
- var writeCount = new PromClient.Counter({
225
- name: "envio_storage_write_total",
226
- help: "Total number of batch writes to storage."
227
- });
228
-
229
- function registerMetrics(loadDuration, handlerDuration, dbWriteDuration) {
209
+ function registerMetrics(loadDuration, handlerDuration) {
230
210
  loadTimeCounter.inc(loadDuration);
231
211
  handlerTimeCounter.inc(handlerDuration);
232
- writeTimeCounter.inc(dbWriteDuration);
233
- writeCount.inc();
234
212
  }
235
213
 
236
- var ProcessingBatch = {
214
+ let ProcessingBatch = {
237
215
  loadTimeCounter: loadTimeCounter,
238
216
  handlerTimeCounter: handlerTimeCounter,
239
- writeTimeCounter: writeTimeCounter,
240
- writeCount: writeCount,
241
217
  registerMetrics: registerMetrics
242
218
  };
243
219
 
244
- var chainIdLabelsSchema = S$RescriptSchema.object(function (s) {
245
- return s.f("chainId", S$RescriptSchema.coerce(S$RescriptSchema.string, S$RescriptSchema.$$int));
246
- });
220
+ let chainIdLabelsSchema = S$RescriptSchema.object(s => s.f("chainId", S$RescriptSchema.coerce(S$RescriptSchema.string, S$RescriptSchema.int)));
247
221
 
248
- var gauge = makeOrThrow$1("envio_progress_ready", "Whether the chain is fully synced to the head.", chainIdLabelsSchema);
222
+ let gauge = makeOrThrow$1("envio_progress_ready", "Whether the chain is fully synced to the head.", chainIdLabelsSchema);
249
223
 
250
- var legacyGauge = new PromClient.Gauge({
251
- name: "hyperindex_synced_to_head",
252
- help: "All chains fully synced"
253
- });
224
+ let legacyGauge = PromClient.Gauge.makeGauge({
225
+ name: "hyperindex_synced_to_head",
226
+ help: "All chains fully synced"
227
+ });
254
228
 
255
229
  function init(chainId) {
256
230
  handleInt$1(gauge, chainId, 0);
@@ -264,7 +238,7 @@ function setAllReady() {
264
238
  legacyGauge.set(1);
265
239
  }
266
240
 
267
- var ProgressReady = {
241
+ let ProgressReady = {
268
242
  gauge: gauge,
269
243
  legacyGauge: legacyGauge,
270
244
  init: init,
@@ -272,47 +246,45 @@ var ProgressReady = {
272
246
  setAllReady: setAllReady
273
247
  };
274
248
 
275
- var handlerLabelsSchema = S$RescriptSchema.schema(function (s) {
276
- return {
277
- contract: s.m(S$RescriptSchema.string),
278
- event: s.m(S$RescriptSchema.string)
279
- };
280
- });
249
+ let handlerLabelsSchema = S$RescriptSchema.schema(s => ({
250
+ contract: s.m(S$RescriptSchema.string),
251
+ event: s.m(S$RescriptSchema.string)
252
+ }));
281
253
 
282
- var timeCounter = makeOrThrow("envio_processing_handler_seconds", "Cumulative time spent inside individual event handler executions.", handlerLabelsSchema);
254
+ let timeCounter = makeOrThrow("envio_processing_handler_seconds", "Cumulative time spent inside individual event handler executions.", handlerLabelsSchema);
283
255
 
284
- var count = makeOrThrow("envio_processing_handler_total", "Total number of individual event handler executions.", handlerLabelsSchema);
256
+ let count = makeOrThrow("envio_processing_handler_total", "Total number of individual event handler executions.", handlerLabelsSchema);
285
257
 
286
- function increment$2(contract, $$event, duration) {
287
- var labels = {
258
+ function increment$2(contract, event, duration) {
259
+ let labels = {
288
260
  contract: contract,
289
- event: $$event
261
+ event: event
290
262
  };
291
263
  handleFloat(timeCounter, labels, duration);
292
264
  increment(count, labels);
293
265
  }
294
266
 
295
- var ProcessingHandler = {
267
+ let ProcessingHandler = {
296
268
  timeCounter: timeCounter,
297
269
  count: count,
298
270
  increment: increment$2
299
271
  };
300
272
 
301
- var timeCounter$1 = makeOrThrow("envio_preload_handler_seconds", "Wall-clock time spent inside individual preload handler executions.", handlerLabelsSchema);
273
+ let timeCounter$1 = makeOrThrow("envio_preload_handler_seconds", "Wall-clock time spent inside individual preload handler executions.", handlerLabelsSchema);
302
274
 
303
- var count$1 = makeOrThrow("envio_preload_handler_total", "Total number of individual preload handler executions.", handlerLabelsSchema);
275
+ let count$1 = makeOrThrow("envio_preload_handler_total", "Total number of individual preload handler executions.", handlerLabelsSchema);
304
276
 
305
- var sumTimeCounter = makeOrThrow("envio_preload_handler_seconds_total", "Cumulative time spent inside individual preload handler executions. Can exceed wall-clock time due to parallel execution.", handlerLabelsSchema);
277
+ let sumTimeCounter = makeOrThrow("envio_preload_handler_seconds_total", "Cumulative time spent inside individual preload handler executions. Can exceed wall-clock time due to parallel execution.", handlerLabelsSchema);
306
278
 
307
- var operations = {};
279
+ let operations = {};
308
280
 
309
- function makeKey(contract, $$event) {
310
- return contract + ":" + $$event;
281
+ function makeKey(contract, event) {
282
+ return contract + ":" + event;
311
283
  }
312
284
 
313
- function startOperation(contract, $$event) {
314
- var key = makeKey(contract, $$event);
315
- var operationRef = operations[key];
285
+ function startOperation(contract, event) {
286
+ let key = makeKey(contract, event);
287
+ let operationRef = operations[key];
316
288
  if (operationRef !== undefined) {
317
289
  operationRef.pendingCount = operationRef.pendingCount + 1 | 0;
318
290
  } else {
@@ -324,13 +296,13 @@ function startOperation(contract, $$event) {
324
296
  return Hrtime.makeTimer();
325
297
  }
326
298
 
327
- function endOperation(timerRef, contract, $$event) {
328
- var key = makeKey(contract, $$event);
329
- var labels = {
299
+ function endOperation(timerRef, contract, event) {
300
+ let key = makeKey(contract, event);
301
+ let labels = {
330
302
  contract: contract,
331
- event: $$event
303
+ event: event
332
304
  };
333
- var operationRef = operations[key];
305
+ let operationRef = operations[key];
334
306
  operationRef.pendingCount = operationRef.pendingCount - 1 | 0;
335
307
  if (operationRef.pendingCount === 0) {
336
308
  handleFloat(timeCounter$1, labels, Hrtime.toSecondsFloat(Hrtime.timeSince(operationRef.timerRef)));
@@ -340,7 +312,7 @@ function endOperation(timerRef, contract, $$event) {
340
312
  increment(count$1, labels);
341
313
  }
342
314
 
343
- var PreloadHandler = {
315
+ let PreloadHandler = {
344
316
  timeCounter: timeCounter$1,
345
317
  count: count$1,
346
318
  sumTimeCounter: sumTimeCounter,
@@ -350,15 +322,15 @@ var PreloadHandler = {
350
322
  endOperation: endOperation
351
323
  };
352
324
 
353
- var timeCounter$2 = makeOrThrow("envio_fetching_block_range_seconds", "Cumulative time spent fetching block ranges.", chainIdLabelsSchema);
325
+ let timeCounter$2 = makeOrThrow("envio_fetching_block_range_seconds", "Cumulative time spent fetching block ranges.", chainIdLabelsSchema);
354
326
 
355
- var parseTimeCounter = makeOrThrow("envio_fetching_block_range_parse_seconds", "Cumulative time spent parsing block range fetch responses.", chainIdLabelsSchema);
327
+ let parseTimeCounter = makeOrThrow("envio_fetching_block_range_parse_seconds", "Cumulative time spent parsing block range fetch responses.", chainIdLabelsSchema);
356
328
 
357
- var count$2 = makeOrThrow("envio_fetching_block_range_total", "Total number of block range fetch operations.", chainIdLabelsSchema);
329
+ let count$2 = makeOrThrow("envio_fetching_block_range_total", "Total number of block range fetch operations.", chainIdLabelsSchema);
358
330
 
359
- var eventsCount = makeOrThrow("envio_fetching_block_range_events_total", "Cumulative number of events fetched across all block range operations.", chainIdLabelsSchema);
331
+ let eventsCount = makeOrThrow("envio_fetching_block_range_events_total", "Cumulative number of events fetched across all block range operations.", chainIdLabelsSchema);
360
332
 
361
- var sizeCounter = makeOrThrow("envio_fetching_block_range_size", "Cumulative number of blocks covered across all block range fetch operations.", chainIdLabelsSchema);
333
+ let sizeCounter = makeOrThrow("envio_fetching_block_range_size", "Cumulative number of blocks covered across all block range fetch operations.", chainIdLabelsSchema);
362
334
 
363
335
  function increment$3(chainId, totalTimeElapsed, parsingTimeElapsed, numEvents, blockRangeSize) {
364
336
  handleFloat(timeCounter$2, chainId, totalTimeElapsed);
@@ -368,7 +340,7 @@ function increment$3(chainId, totalTimeElapsed, parsingTimeElapsed, numEvents, b
368
340
  handleInt(sizeCounter, chainId, blockRangeSize);
369
341
  }
370
342
 
371
- var FetchingBlockRange = {
343
+ let FetchingBlockRange = {
372
344
  timeCounter: timeCounter$2,
373
345
  parseTimeCounter: parseTimeCounter,
374
346
  count: count$2,
@@ -377,277 +349,271 @@ var FetchingBlockRange = {
377
349
  increment: increment$3
378
350
  };
379
351
 
380
- var gauge$1 = makeOrThrow$1("envio_indexing_known_height", "The latest known block number reported by the active indexing source. This value may lag behind the actual chain height, as it is updated only when needed.", chainIdLabelsSchema);
352
+ let gauge$1 = makeOrThrow$1("envio_indexing_known_height", "The latest known block number reported by the active indexing source. This value may lag behind the actual chain height, as it is updated only when needed.", chainIdLabelsSchema);
381
353
 
382
354
  function set$1(blockNumber, chainId) {
383
355
  handleInt$1(gauge$1, chainId, blockNumber);
384
356
  }
385
357
 
386
- var IndexingKnownHeight = {
358
+ let IndexingKnownHeight = {
387
359
  gauge: gauge$1,
388
360
  set: set$1
389
361
  };
390
362
 
391
- var gauge$2 = makeOrThrow$1("envio_info", "Information about the indexer", S$RescriptSchema.schema(function (s) {
392
- return {
393
- version: s.m(S$RescriptSchema.string)
394
- };
395
- }));
363
+ let gauge$2 = makeOrThrow$1("envio_info", "Information about the indexer", S$RescriptSchema.schema(s => ({
364
+ version: s.m(S$RescriptSchema.string)
365
+ })));
396
366
 
397
367
  function set$2(version) {
398
368
  handleInt$1(gauge$2, {
399
- version: version
400
- }, 1);
369
+ version: version
370
+ }, 1);
401
371
  }
402
372
 
403
- var Info = {
373
+ let Info = {
404
374
  gauge: gauge$2,
405
375
  set: set$2
406
376
  };
407
377
 
408
- var gauge$3 = new PromClient.Gauge({
409
- name: "envio_process_start_time_seconds",
410
- help: "Start time of the process since unix epoch in seconds."
411
- });
378
+ let gauge$3 = PromClient.Gauge.makeGauge({
379
+ name: "envio_process_start_time_seconds",
380
+ help: "Start time of the process since unix epoch in seconds."
381
+ });
412
382
 
413
383
  function set$3() {
414
384
  gauge$3.set(Date.now() / 1000.0);
415
385
  }
416
386
 
417
- var ProcessStartTimeSeconds = {
387
+ let ProcessStartTimeSeconds = {
418
388
  gauge: gauge$3,
419
389
  set: set$3
420
390
  };
421
391
 
422
- var gauge$4 = makeOrThrow$1("envio_indexing_addresses", "The number of addresses indexed on chain. Includes both static and dynamic addresses.", chainIdLabelsSchema);
392
+ let gauge$4 = makeOrThrow$1("envio_indexing_addresses", "The number of addresses indexed on chain. Includes both static and dynamic addresses.", chainIdLabelsSchema);
423
393
 
424
394
  function set$4(addressesCount, chainId) {
425
395
  handleInt$1(gauge$4, chainId, addressesCount);
426
396
  }
427
397
 
428
- var IndexingAddresses = {
398
+ let IndexingAddresses = {
429
399
  gauge: gauge$4,
430
400
  set: set$4
431
401
  };
432
402
 
433
- var gauge$5 = makeOrThrow$1("envio_indexing_max_concurrency", "The maximum number of concurrent queries to the chain data-source.", chainIdLabelsSchema);
403
+ let gauge$5 = makeOrThrow$1("envio_indexing_max_concurrency", "The maximum number of concurrent queries to the chain data-source.", chainIdLabelsSchema);
434
404
 
435
405
  function set$5(maxConcurrency, chainId) {
436
406
  handleInt$1(gauge$5, chainId, maxConcurrency);
437
407
  }
438
408
 
439
- var IndexingMaxConcurrency = {
409
+ let IndexingMaxConcurrency = {
440
410
  gauge: gauge$5,
441
411
  set: set$5
442
412
  };
443
413
 
444
- var gauge$6 = makeOrThrow$1("envio_indexing_concurrency", "The number of executing concurrent queries to the chain data-source.", chainIdLabelsSchema);
414
+ let gauge$6 = makeOrThrow$1("envio_indexing_concurrency", "The number of executing concurrent queries to the chain data-source.", chainIdLabelsSchema);
445
415
 
446
416
  function set$6(concurrency, chainId) {
447
417
  handleInt$1(gauge$6, chainId, concurrency);
448
418
  }
449
419
 
450
- var IndexingConcurrency = {
420
+ let IndexingConcurrency = {
451
421
  gauge: gauge$6,
452
422
  set: set$6
453
423
  };
454
424
 
455
- var gauge$7 = makeOrThrow$1("envio_indexing_partitions", "The number of partitions used to split fetching logic by addresses and block ranges.", chainIdLabelsSchema);
425
+ let gauge$7 = makeOrThrow$1("envio_indexing_partitions", "The number of partitions used to split fetching logic by addresses and block ranges.", chainIdLabelsSchema);
456
426
 
457
427
  function set$7(partitionsCount, chainId) {
458
428
  handleInt$1(gauge$7, chainId, partitionsCount);
459
429
  }
460
430
 
461
- var IndexingPartitions = {
431
+ let IndexingPartitions = {
462
432
  gauge: gauge$7,
463
433
  set: set$7
464
434
  };
465
435
 
466
- var counter = makeOrThrow("envio_indexing_idle_seconds", "The time the indexer source syncing has been idle. A high value may indicate the source sync is a bottleneck.", chainIdLabelsSchema);
436
+ let counter = makeOrThrow("envio_indexing_idle_seconds", "The time the indexer source syncing has been idle. A high value may indicate the source sync is a bottleneck.", chainIdLabelsSchema);
467
437
 
468
- var IndexingIdleTime = {
438
+ let IndexingIdleTime = {
469
439
  counter: counter
470
440
  };
471
441
 
472
- var counter$1 = makeOrThrow("envio_indexing_source_waiting_seconds", "The time the indexer has been waiting for new blocks.", chainIdLabelsSchema);
442
+ let counter$1 = makeOrThrow("envio_indexing_source_waiting_seconds", "The time the indexer has been waiting for new blocks.", chainIdLabelsSchema);
473
443
 
474
- var IndexingSourceWaitingTime = {
444
+ let IndexingSourceWaitingTime = {
475
445
  counter: counter$1
476
446
  };
477
447
 
478
- var counter$2 = makeOrThrow("envio_indexing_source_querying_seconds", "The time spent performing queries to the chain data-source.", chainIdLabelsSchema);
448
+ let counter$2 = makeOrThrow("envio_indexing_source_querying_seconds", "The time spent performing queries to the chain data-source.", chainIdLabelsSchema);
479
449
 
480
- var IndexingQueryTime = {
450
+ let IndexingQueryTime = {
481
451
  counter: counter$2
482
452
  };
483
453
 
484
- var gauge$8 = makeOrThrow$1("envio_indexing_buffer_size", "The current number of items in the indexing buffer.", chainIdLabelsSchema);
454
+ let gauge$8 = makeOrThrow$1("envio_indexing_buffer_size", "The current number of items in the indexing buffer.", chainIdLabelsSchema);
485
455
 
486
456
  function set$8(bufferSize, chainId) {
487
457
  handleInt$1(gauge$8, chainId, bufferSize);
488
458
  }
489
459
 
490
- var IndexingBufferSize = {
460
+ let IndexingBufferSize = {
491
461
  gauge: gauge$8,
492
462
  set: set$8
493
463
  };
494
464
 
495
- var gauge$9 = new PromClient.Gauge({
496
- name: "envio_indexing_target_buffer_size",
497
- help: "The target buffer size per chain for indexing. The actual number of items in the queue may exceed this value, but the indexer always tries to keep the buffer filled up to this target."
498
- });
465
+ let gauge$9 = PromClient.Gauge.makeGauge({
466
+ name: "envio_indexing_target_buffer_size",
467
+ help: "The target buffer size per chain for indexing. The actual number of items in the queue may exceed this value, but the indexer always tries to keep the buffer filled up to this target."
468
+ });
499
469
 
500
470
  function set$9(targetBufferSize) {
501
471
  gauge$9.set(targetBufferSize);
502
472
  }
503
473
 
504
- var IndexingTargetBufferSize = {
474
+ let IndexingTargetBufferSize = {
505
475
  gauge: gauge$9,
506
476
  set: set$9
507
477
  };
508
478
 
509
- var gauge$10 = makeOrThrow$1("envio_indexing_buffer_block", "The highest block number that has been fully fetched by the indexer.", chainIdLabelsSchema);
479
+ let gauge$10 = makeOrThrow$1("envio_indexing_buffer_block", "The highest block number that has been fully fetched by the indexer.", chainIdLabelsSchema);
510
480
 
511
481
  function set$10(blockNumber, chainId) {
512
482
  handleInt$1(gauge$10, chainId, blockNumber);
513
483
  }
514
484
 
515
- var IndexingBufferBlockNumber = {
485
+ let IndexingBufferBlockNumber = {
516
486
  gauge: gauge$10,
517
487
  set: set$10
518
488
  };
519
489
 
520
- var gauge$11 = makeOrThrow$1("envio_indexing_end_block", "The block number to stop indexing at. (inclusive)", chainIdLabelsSchema);
490
+ let gauge$11 = makeOrThrow$1("envio_indexing_end_block", "The block number to stop indexing at. (inclusive)", chainIdLabelsSchema);
521
491
 
522
492
  function set$11(endBlock, chainId) {
523
493
  handleInt$1(gauge$11, chainId, endBlock);
524
494
  }
525
495
 
526
- var IndexingEndBlock = {
496
+ let IndexingEndBlock = {
527
497
  gauge: gauge$11,
528
498
  set: set$11
529
499
  };
530
500
 
531
- var sourceLabelsSchema = S$RescriptSchema.schema(function (s) {
532
- return {
533
- source: s.m(S$RescriptSchema.string),
534
- chainId: s.m(S$RescriptSchema.coerce(S$RescriptSchema.string, S$RescriptSchema.$$int))
535
- };
536
- });
501
+ let sourceLabelsSchema = S$RescriptSchema.schema(s => ({
502
+ source: s.m(S$RescriptSchema.string),
503
+ chainId: s.m(S$RescriptSchema.coerce(S$RescriptSchema.string, S$RescriptSchema.int))
504
+ }));
537
505
 
538
- var sourceRequestLabelsSchema = S$RescriptSchema.schema(function (s) {
539
- return {
540
- source: s.m(S$RescriptSchema.string),
541
- chainId: s.m(S$RescriptSchema.coerce(S$RescriptSchema.string, S$RescriptSchema.$$int)),
542
- method: s.m(S$RescriptSchema.string)
543
- };
544
- });
506
+ let sourceRequestLabelsSchema = S$RescriptSchema.schema(s => ({
507
+ source: s.m(S$RescriptSchema.string),
508
+ chainId: s.m(S$RescriptSchema.coerce(S$RescriptSchema.string, S$RescriptSchema.int)),
509
+ method: s.m(S$RescriptSchema.string)
510
+ }));
545
511
 
546
- var counter$3 = makeOrThrow("envio_source_request_total", "The number of requests made to data sources.", sourceRequestLabelsSchema);
512
+ let counter$3 = makeOrThrow("envio_source_request_total", "The number of requests made to data sources.", sourceRequestLabelsSchema);
547
513
 
548
- var sumTimeCounter$1 = makeOrThrow("envio_source_request_seconds_total", "Cumulative time spent on data source requests.", sourceRequestLabelsSchema);
514
+ let sumTimeCounter$1 = makeOrThrow("envio_source_request_seconds_total", "Cumulative time spent on data source requests.", sourceRequestLabelsSchema);
549
515
 
550
516
  function increment$4(sourceName, chainId, method) {
551
517
  increment(counter$3, {
552
- source: sourceName,
553
- chainId: chainId,
554
- method: method
555
- });
518
+ source: sourceName,
519
+ chainId: chainId,
520
+ method: method
521
+ });
556
522
  }
557
523
 
558
524
  function addSeconds(sourceName, chainId, method, seconds) {
559
525
  handleFloat(sumTimeCounter$1, {
560
- source: sourceName,
561
- chainId: chainId,
562
- method: method
563
- }, seconds);
526
+ source: sourceName,
527
+ chainId: chainId,
528
+ method: method
529
+ }, seconds);
564
530
  }
565
531
 
566
- var SourceRequestCount = {
532
+ let SourceRequestCount = {
567
533
  counter: counter$3,
568
534
  sumTimeCounter: sumTimeCounter$1,
569
535
  increment: increment$4,
570
536
  addSeconds: addSeconds
571
537
  };
572
538
 
573
- var gauge$12 = makeOrThrow$1("envio_source_known_height", "The latest known block number reported by the source. This value may lag behind the actual chain height, as it is updated only when queried.", sourceLabelsSchema);
539
+ let gauge$12 = makeOrThrow$1("envio_source_known_height", "The latest known block number reported by the source. This value may lag behind the actual chain height, as it is updated only when queried.", sourceLabelsSchema);
574
540
 
575
541
  function set$12(sourceName, chainId, blockNumber) {
576
542
  handleInt$1(gauge$12, {
577
- source: sourceName,
578
- chainId: chainId
579
- }, blockNumber);
543
+ source: sourceName,
544
+ chainId: chainId
545
+ }, blockNumber);
580
546
  }
581
547
 
582
- var SourceHeight = {
548
+ let SourceHeight = {
583
549
  gauge: gauge$12,
584
550
  set: set$12
585
551
  };
586
552
 
587
- var counter$4 = makeOrThrow("envio_reorg_detected_total", "Total number of reorgs detected", chainIdLabelsSchema);
553
+ let counter$4 = makeOrThrow("envio_reorg_detected_total", "Total number of reorgs detected", chainIdLabelsSchema);
588
554
 
589
555
  function increment$5(chain) {
590
556
  increment(counter$4, chain);
591
557
  }
592
558
 
593
- var ReorgCount = {
559
+ let ReorgCount = {
594
560
  counter: counter$4,
595
561
  increment: increment$5
596
562
  };
597
563
 
598
- var gauge$13 = makeOrThrow$1("envio_reorg_detected_block", "The block number where reorg was detected the last time. This doesn't mean that the block was reorged, this is simply where we found block hash to be different.", chainIdLabelsSchema);
564
+ let gauge$13 = makeOrThrow$1("envio_reorg_detected_block", "The block number where reorg was detected the last time. This doesn't mean that the block was reorged, this is simply where we found block hash to be different.", chainIdLabelsSchema);
599
565
 
600
566
  function set$13(blockNumber, chain) {
601
567
  handleInt$1(gauge$13, chain, blockNumber);
602
568
  }
603
569
 
604
- var ReorgDetectionBlockNumber = {
570
+ let ReorgDetectionBlockNumber = {
605
571
  gauge: gauge$13,
606
572
  set: set$13
607
573
  };
608
574
 
609
- var gauge$14 = new PromClient.Gauge({
610
- name: "envio_reorg_threshold",
611
- help: "Whether indexing is currently within the reorg threshold"
612
- });
575
+ let gauge$14 = PromClient.Gauge.makeGauge({
576
+ name: "envio_reorg_threshold",
577
+ help: "Whether indexing is currently within the reorg threshold"
578
+ });
613
579
 
614
580
  function set$14(isInReorgThreshold) {
615
581
  gauge$14.set(isInReorgThreshold ? 1 : 0);
616
582
  }
617
583
 
618
- var ReorgThreshold = {
584
+ let ReorgThreshold = {
619
585
  gauge: gauge$14,
620
586
  set: set$14
621
587
  };
622
588
 
623
- var gauge$15 = new PromClient.Gauge({
624
- name: "envio_rollback_enabled",
625
- help: "Whether rollback on reorg is enabled"
626
- });
589
+ let gauge$15 = PromClient.Gauge.makeGauge({
590
+ name: "envio_rollback_enabled",
591
+ help: "Whether rollback on reorg is enabled"
592
+ });
627
593
 
628
594
  function set$15(enabled) {
629
595
  gauge$15.set(enabled ? 1 : 0);
630
596
  }
631
597
 
632
- var RollbackEnabled = {
598
+ let RollbackEnabled = {
633
599
  gauge: gauge$15,
634
600
  set: set$15
635
601
  };
636
602
 
637
- var timeCounter$3 = new PromClient.Counter({
638
- name: "envio_rollback_seconds",
639
- help: "Rollback on reorg total time."
640
- });
603
+ let timeCounter$3 = PromClient.Counter.makeCounter({
604
+ name: "envio_rollback_seconds",
605
+ help: "Rollback on reorg total time."
606
+ });
641
607
 
642
- var counter$5 = new PromClient.Counter({
643
- name: "envio_rollback_total",
644
- help: "Number of successful rollbacks on reorg"
645
- });
608
+ let counter$5 = PromClient.Counter.makeCounter({
609
+ name: "envio_rollback_total",
610
+ help: "Number of successful rollbacks on reorg"
611
+ });
646
612
 
647
- var eventsCounter = new PromClient.Counter({
648
- name: "envio_rollback_events",
649
- help: "Number of events rollbacked on reorg"
650
- });
613
+ let eventsCounter = PromClient.Counter.makeCounter({
614
+ name: "envio_rollback_events",
615
+ help: "Number of events rollbacked on reorg"
616
+ });
651
617
 
652
618
  function increment$6(timeSeconds, rollbackedProcessedEvents) {
653
619
  timeCounter$3.inc(timeSeconds);
@@ -655,168 +621,170 @@ function increment$6(timeSeconds, rollbackedProcessedEvents) {
655
621
  eventsCounter.inc(Math.trunc(rollbackedProcessedEvents));
656
622
  }
657
623
 
658
- var RollbackSuccess = {
624
+ let RollbackSuccess = {
659
625
  timeCounter: timeCounter$3,
660
626
  counter: counter$5,
661
627
  eventsCounter: eventsCounter,
662
628
  increment: increment$6
663
629
  };
664
630
 
665
- var entityNameLabelsSchema = S$RescriptSchema.object(function (s) {
666
- return s.f("entity", S$RescriptSchema.string);
667
- });
631
+ let entityNameLabelsSchema = S$RescriptSchema.object(s => s.f("entity", S$RescriptSchema.string));
668
632
 
669
- var timeCounter$4 = makeOrThrow("envio_rollback_history_prune_seconds", "The total time spent pruning entity history which is not in the reorg threshold.", entityNameLabelsSchema);
633
+ let timeCounter$4 = makeOrThrow("envio_rollback_history_prune_seconds", "The total time spent pruning entity history which is not in the reorg threshold.", entityNameLabelsSchema);
670
634
 
671
- var counter$6 = makeOrThrow("envio_rollback_history_prune_total", "Number of successful entity history prunes", entityNameLabelsSchema);
635
+ let counter$6 = makeOrThrow("envio_rollback_history_prune_total", "Number of successful entity history prunes", entityNameLabelsSchema);
672
636
 
673
637
  function increment$7(timeSeconds, entityName) {
674
638
  handleFloat(timeCounter$4, entityName, timeSeconds);
675
639
  increment(counter$6, entityName);
676
640
  }
677
641
 
678
- var RollbackHistoryPrune = {
642
+ let RollbackHistoryPrune = {
679
643
  entityNameLabelsSchema: entityNameLabelsSchema,
680
644
  timeCounter: timeCounter$4,
681
645
  counter: counter$6,
682
646
  increment: increment$7
683
647
  };
684
648
 
685
- var gauge$16 = makeOrThrow$1("envio_rollback_target_block", "The block number reorg was rollbacked to the last time.", chainIdLabelsSchema);
649
+ let gauge$16 = makeOrThrow$1("envio_rollback_target_block", "The block number reorg was rollbacked to the last time.", chainIdLabelsSchema);
686
650
 
687
651
  function set$16(blockNumber, chain) {
688
652
  handleInt$1(gauge$16, chain, blockNumber);
689
653
  }
690
654
 
691
- var RollbackTargetBlockNumber = {
655
+ let RollbackTargetBlockNumber = {
692
656
  gauge: gauge$16,
693
657
  set: set$16
694
658
  };
695
659
 
696
- var gauge$17 = new PromClient.Gauge({
697
- name: "envio_processing_max_batch_size",
698
- help: "The maximum number of items to process in a single batch."
699
- });
660
+ let gauge$17 = PromClient.Gauge.makeGauge({
661
+ name: "envio_processing_max_batch_size",
662
+ help: "The maximum number of items to process in a single batch."
663
+ });
700
664
 
701
665
  function set$17(maxBatchSize) {
702
666
  gauge$17.set(maxBatchSize);
703
667
  }
704
668
 
705
- var ProcessingMaxBatchSize = {
669
+ let ProcessingMaxBatchSize = {
706
670
  gauge: gauge$17,
707
671
  set: set$17
708
672
  };
709
673
 
710
- var gauge$18 = makeOrThrow$1("envio_progress_block", "The block number of the latest block processed and stored in the database.", chainIdLabelsSchema);
674
+ let gauge$18 = makeOrThrow$1("envio_progress_block", "The block number of the latest block processed and stored in the database.", chainIdLabelsSchema);
711
675
 
712
676
  function set$18(blockNumber, chainId) {
713
677
  handleInt$1(gauge$18, chainId, blockNumber);
714
678
  }
715
679
 
716
- var ProgressBlockNumber = {
680
+ let ProgressBlockNumber = {
717
681
  gauge: gauge$18,
718
682
  set: set$18
719
683
  };
720
684
 
721
- var gauge$19 = makeOrThrow$1("envio_progress_events", "The number of events processed and reflected in the database.", chainIdLabelsSchema);
685
+ let gauge$19 = makeOrThrow$1("envio_progress_events", "The number of events processed and reflected in the database.", chainIdLabelsSchema);
722
686
 
723
687
  function set$19(processedCount, chainId) {
724
688
  handleFloat$1(gauge$19, chainId, processedCount);
725
689
  }
726
690
 
727
- var ProgressEventsCount = {
691
+ let ProgressEventsCount = {
728
692
  gauge: gauge$19,
729
693
  set: set$19
730
694
  };
731
695
 
732
- var gauge$20 = makeOrThrow$1("envio_progress_latency", "The latency in milliseconds between the latest processed event creation and the time it was written to storage.", chainIdLabelsSchema);
696
+ let gauge$20 = makeOrThrow$1("envio_progress_latency", "The latency in milliseconds between the latest processed event creation and the time it was written to storage.", chainIdLabelsSchema);
733
697
 
734
698
  function set$20(latencyMs, chainId) {
735
699
  handleInt$1(gauge$20, chainId, latencyMs);
736
700
  }
737
701
 
738
- var ProgressLatency = {
702
+ let ProgressLatency = {
739
703
  gauge: gauge$20,
740
704
  set: set$20
741
705
  };
742
706
 
743
- var effectLabelsSchema = S$RescriptSchema.object(function (s) {
744
- return s.f("effect", S$RescriptSchema.string);
745
- });
707
+ let effectLabelsSchema = S$RescriptSchema.object(s => s.f("effect", S$RescriptSchema.string));
746
708
 
747
- var timeCounter$5 = makeOrThrow("envio_effect_call_seconds", "Processing time taken to call the Effect function.", effectLabelsSchema);
709
+ let timeCounter$5 = makeOrThrow("envio_effect_call_seconds", "Processing time taken to call the Effect function.", effectLabelsSchema);
748
710
 
749
- var sumTimeCounter$2 = makeOrThrow("envio_effect_call_seconds_total", "Cumulative time spent calling the Effect function during the indexing process.", effectLabelsSchema);
711
+ let sumTimeCounter$2 = makeOrThrow("envio_effect_call_seconds_total", "Cumulative time spent calling the Effect function during the indexing process.", effectLabelsSchema);
750
712
 
751
- var totalCallsCount = makeOrThrow("envio_effect_call_total", "Cumulative number of resolved Effect function calls during the indexing process.", effectLabelsSchema);
713
+ let totalCallsCount = makeOrThrow("envio_effect_call_total", "Cumulative number of resolved Effect function calls during the indexing process.", effectLabelsSchema);
752
714
 
753
- var activeCallsCount = makeOrThrow$1("envio_effect_active_calls", "The number of Effect function calls that are currently running.", effectLabelsSchema);
715
+ let activeCallsCount = makeOrThrow$1("envio_effect_active_calls", "The number of Effect function calls that are currently running.", effectLabelsSchema);
754
716
 
755
- var EffectCalls = {
717
+ let EffectCalls = {
756
718
  timeCounter: timeCounter$5,
757
719
  sumTimeCounter: sumTimeCounter$2,
758
720
  totalCallsCount: totalCallsCount,
759
721
  activeCallsCount: activeCallsCount
760
722
  };
761
723
 
762
- var gauge$21 = makeOrThrow$1("envio_effect_cache", "The number of items in the effect cache.", effectLabelsSchema);
724
+ let gauge$21 = makeOrThrow$1("envio_effect_cache", "The number of items in the effect cache.", effectLabelsSchema);
763
725
 
764
726
  function set$21(count, effectName) {
765
727
  handleInt$1(gauge$21, effectName, count);
766
728
  }
767
729
 
768
- var EffectCacheCount = {
730
+ let EffectCacheCount = {
769
731
  gauge: gauge$21,
770
732
  set: set$21
771
733
  };
772
734
 
773
- var counter$7 = makeOrThrow("envio_effect_cache_invalidations", "The number of effect cache invalidations.", effectLabelsSchema);
735
+ let counter$7 = makeOrThrow("envio_effect_cache_invalidations", "The number of effect cache invalidations.", effectLabelsSchema);
774
736
 
775
737
  function increment$8(effectName) {
776
738
  increment(counter$7, effectName);
777
739
  }
778
740
 
779
- var EffectCacheInvalidationsCount = {
741
+ let EffectCacheInvalidationsCount = {
780
742
  counter: counter$7,
781
743
  increment: increment$8
782
744
  };
783
745
 
784
- var gauge$22 = makeOrThrow$1("envio_effect_queue", "The number of effect calls waiting in the rate limit queue.", effectLabelsSchema);
746
+ let gauge$22 = makeOrThrow$1("envio_effect_queue", "The number of effect calls waiting in the rate limit queue.", effectLabelsSchema);
785
747
 
786
- var timeCounter$6 = makeOrThrow("envio_effect_queue_wait_seconds", "The time spent waiting in the rate limit queue.", effectLabelsSchema);
748
+ let timeCounter$6 = makeOrThrow("envio_effect_queue_wait_seconds", "The time spent waiting in the rate limit queue.", effectLabelsSchema);
787
749
 
788
750
  function set$22(count, effectName) {
789
751
  handleInt$1(gauge$22, effectName, count);
790
752
  }
791
753
 
792
- var EffectQueueCount = {
754
+ let EffectQueueCount = {
793
755
  gauge: gauge$22,
794
756
  timeCounter: timeCounter$6,
795
757
  set: set$22
796
758
  };
797
759
 
798
- var operationLabelsSchema = S$RescriptSchema.object(function (s) {
799
- return s.f("operation", S$RescriptSchema.string);
800
- });
760
+ let loadLabelsSchema = S$RescriptSchema.schema(s => ({
761
+ operation: s.m(S$RescriptSchema.string),
762
+ storage: s.m(S$RescriptSchema.string)
763
+ }));
764
+
765
+ let timeCounter$7 = makeOrThrow("envio_storage_load_seconds", "Processing time taken to load data from storage.", loadLabelsSchema);
801
766
 
802
- var timeCounter$7 = makeOrThrow("envio_storage_load_seconds", "Processing time taken to load data from storage.", operationLabelsSchema);
767
+ let sumTimeCounter$3 = makeOrThrow("envio_storage_load_seconds_total", "Cumulative time spent loading data from storage during the indexing process.", loadLabelsSchema);
803
768
 
804
- var sumTimeCounter$3 = makeOrThrow("envio_storage_load_seconds_total", "Cumulative time spent loading data from storage during the indexing process.", operationLabelsSchema);
769
+ let counter$8 = makeOrThrow("envio_storage_load_total", "Cumulative number of successful storage load operations during the indexing process.", loadLabelsSchema);
805
770
 
806
- var counter$8 = makeOrThrow("envio_storage_load_total", "Cumulative number of successful storage load operations during the indexing process.", operationLabelsSchema);
771
+ let whereSizeCounter = makeOrThrow("envio_storage_load_where_size", "Cumulative number of filter conditions ('where' items) used in storage load operations during the indexing process.", loadLabelsSchema);
807
772
 
808
- var whereSizeCounter = makeOrThrow("envio_storage_load_where_size", "Cumulative number of filter conditions ('where' items) used in storage load operations during the indexing process.", operationLabelsSchema);
773
+ let sizeCounter$1 = makeOrThrow("envio_storage_load_size", "Cumulative number of records loaded from storage during the indexing process.", loadLabelsSchema);
809
774
 
810
- var sizeCounter$1 = makeOrThrow("envio_storage_load_size", "Cumulative number of records loaded from storage during the indexing process.", operationLabelsSchema);
775
+ let operations$1 = {};
811
776
 
812
- var operations$1 = {};
777
+ function makeKey$1(storage, operation) {
778
+ return storage + ":" + operation;
779
+ }
813
780
 
814
- function startOperation$1(operation) {
815
- var operationRef = operations$1[operation];
781
+ function startOperation$1(storage, operation) {
782
+ let key = makeKey$1(storage, operation);
783
+ let operationRef = operations$1[key];
816
784
  if (operationRef !== undefined) {
817
785
  operationRef.pendingCount = operationRef.pendingCount + 1 | 0;
818
786
  } else {
819
- operations$1[operation] = {
787
+ operations$1[key] = {
820
788
  pendingCount: 1,
821
789
  timerRef: Hrtime.makeTimer()
822
790
  };
@@ -824,99 +792,103 @@ function startOperation$1(operation) {
824
792
  return Hrtime.makeTimer();
825
793
  }
826
794
 
827
- function endOperation$1(timerRef, operation, whereSize, size) {
828
- var operationRef = operations$1[operation];
795
+ function endOperation$1(timerRef, storage, operation, whereSize, size) {
796
+ let key = makeKey$1(storage, operation);
797
+ let labels = {
798
+ operation: operation,
799
+ storage: storage
800
+ };
801
+ let operationRef = operations$1[key];
829
802
  operationRef.pendingCount = operationRef.pendingCount - 1 | 0;
830
803
  if (operationRef.pendingCount === 0) {
831
- handleFloat(timeCounter$7, operation, Hrtime.toSecondsFloat(Hrtime.timeSince(operationRef.timerRef)));
832
- Utils.Dict.deleteInPlace(operations$1, operation);
804
+ handleFloat(timeCounter$7, labels, Hrtime.toSecondsFloat(Hrtime.timeSince(operationRef.timerRef)));
805
+ Utils.Dict.deleteInPlace(operations$1, key);
833
806
  }
834
- handleFloat(sumTimeCounter$3, operation, Hrtime.toSecondsFloat(Hrtime.timeSince(timerRef)));
835
- increment(counter$8, operation);
836
- handleInt(whereSizeCounter, operation, whereSize);
837
- handleInt(sizeCounter$1, operation, size);
807
+ handleFloat(sumTimeCounter$3, labels, Hrtime.toSecondsFloat(Hrtime.timeSince(timerRef)));
808
+ increment(counter$8, labels);
809
+ handleInt(whereSizeCounter, labels, whereSize);
810
+ handleInt(sizeCounter$1, labels, size);
838
811
  }
839
812
 
840
- var StorageLoad = {
841
- operationLabelsSchema: operationLabelsSchema,
813
+ let StorageLoad = {
814
+ loadLabelsSchema: loadLabelsSchema,
842
815
  timeCounter: timeCounter$7,
843
816
  sumTimeCounter: sumTimeCounter$3,
844
817
  counter: counter$8,
845
818
  whereSizeCounter: whereSizeCounter,
846
819
  sizeCounter: sizeCounter$1,
847
820
  operations: operations$1,
821
+ makeKey: makeKey$1,
848
822
  startOperation: startOperation$1,
849
823
  endOperation: endOperation$1
850
824
  };
851
825
 
852
- var sinkLabelsSchema = S$RescriptSchema.object(function (s) {
853
- return s.f("sink", S$RescriptSchema.string);
854
- });
826
+ let storageLabelsSchema = S$RescriptSchema.object(s => s.f("storage", S$RescriptSchema.string));
855
827
 
856
- var timeCounter$8 = makeOrThrow("envio_sink_write_seconds", "Processing time taken to write data to sink.", sinkLabelsSchema);
828
+ let timeCounter$8 = makeOrThrow("envio_storage_write_seconds", "Cumulative time spent writing batch data to storage.", storageLabelsSchema);
857
829
 
858
- var counter$9 = makeOrThrow("envio_sink_write_total", "Cumulative number of successful sink write operations during the indexing process.", sinkLabelsSchema);
830
+ let counter$9 = makeOrThrow("envio_storage_write_total", "Cumulative number of successful storage write operations during the indexing process.", storageLabelsSchema);
859
831
 
860
- function increment$9(sinkName, timeSeconds) {
861
- handleFloat(timeCounter$8, sinkName, timeSeconds);
862
- increment(counter$9, sinkName);
832
+ function increment$9(storage, timeSeconds) {
833
+ handleFloat(timeCounter$8, storage, timeSeconds);
834
+ increment(counter$9, storage);
863
835
  }
864
836
 
865
- var SinkWrite = {
866
- sinkLabelsSchema: sinkLabelsSchema,
837
+ let StorageWrite = {
838
+ storageLabelsSchema: storageLabelsSchema,
867
839
  timeCounter: timeCounter$8,
868
840
  counter: counter$9,
869
841
  increment: increment$9
870
842
  };
871
843
 
872
844
  export {
873
- Labels ,
874
- metricNames ,
875
- MakeSafePromMetric ,
876
- SafeCounter ,
877
- SafeGauge ,
878
- ProcessingBatch ,
879
- chainIdLabelsSchema ,
880
- ProgressReady ,
881
- handlerLabelsSchema ,
882
- ProcessingHandler ,
883
- PreloadHandler ,
884
- FetchingBlockRange ,
885
- IndexingKnownHeight ,
886
- Info ,
887
- ProcessStartTimeSeconds ,
888
- IndexingAddresses ,
889
- IndexingMaxConcurrency ,
890
- IndexingConcurrency ,
891
- IndexingPartitions ,
892
- IndexingIdleTime ,
893
- IndexingSourceWaitingTime ,
894
- IndexingQueryTime ,
895
- IndexingBufferSize ,
896
- IndexingTargetBufferSize ,
897
- IndexingBufferBlockNumber ,
898
- IndexingEndBlock ,
899
- sourceLabelsSchema ,
900
- sourceRequestLabelsSchema ,
901
- SourceRequestCount ,
902
- SourceHeight ,
903
- ReorgCount ,
904
- ReorgDetectionBlockNumber ,
905
- ReorgThreshold ,
906
- RollbackEnabled ,
907
- RollbackSuccess ,
908
- RollbackHistoryPrune ,
909
- RollbackTargetBlockNumber ,
910
- ProcessingMaxBatchSize ,
911
- ProgressBlockNumber ,
912
- ProgressEventsCount ,
913
- ProgressLatency ,
914
- effectLabelsSchema ,
915
- EffectCalls ,
916
- EffectCacheCount ,
917
- EffectCacheInvalidationsCount ,
918
- EffectQueueCount ,
919
- StorageLoad ,
920
- SinkWrite ,
845
+ Labels,
846
+ metricNames,
847
+ MakeSafePromMetric,
848
+ SafeCounter,
849
+ SafeGauge,
850
+ ProcessingBatch,
851
+ chainIdLabelsSchema,
852
+ ProgressReady,
853
+ handlerLabelsSchema,
854
+ ProcessingHandler,
855
+ PreloadHandler,
856
+ FetchingBlockRange,
857
+ IndexingKnownHeight,
858
+ Info,
859
+ ProcessStartTimeSeconds,
860
+ IndexingAddresses,
861
+ IndexingMaxConcurrency,
862
+ IndexingConcurrency,
863
+ IndexingPartitions,
864
+ IndexingIdleTime,
865
+ IndexingSourceWaitingTime,
866
+ IndexingQueryTime,
867
+ IndexingBufferSize,
868
+ IndexingTargetBufferSize,
869
+ IndexingBufferBlockNumber,
870
+ IndexingEndBlock,
871
+ sourceLabelsSchema,
872
+ sourceRequestLabelsSchema,
873
+ SourceRequestCount,
874
+ SourceHeight,
875
+ ReorgCount,
876
+ ReorgDetectionBlockNumber,
877
+ ReorgThreshold,
878
+ RollbackEnabled,
879
+ RollbackSuccess,
880
+ RollbackHistoryPrune,
881
+ RollbackTargetBlockNumber,
882
+ ProcessingMaxBatchSize,
883
+ ProgressBlockNumber,
884
+ ProgressEventsCount,
885
+ ProgressLatency,
886
+ effectLabelsSchema,
887
+ EffectCalls,
888
+ EffectCacheCount,
889
+ EffectCacheInvalidationsCount,
890
+ EffectQueueCount,
891
+ StorageLoad,
892
+ StorageWrite,
921
893
  }
922
894
  /* metricNames Not a pure module */