envio 3.0.0-alpha-main-clickhouse-sink → 3.0.0-alpha.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 (100) hide show
  1. package/bin.js +5 -3
  2. package/evm.schema.json +23 -6
  3. package/fuel.schema.json +17 -5
  4. package/index.d.ts +0 -27
  5. package/index.js +9 -6
  6. package/package.json +11 -7
  7. package/rescript.json +4 -3
  8. package/src/{Address.res.js → Address.res.mjs} +7 -6
  9. package/src/{Batch.res.js → Batch.res.mjs} +19 -18
  10. package/src/{ChainMap.res.js → ChainMap.res.mjs} +20 -19
  11. package/src/{Config.res.js → Config.res.mjs} +11 -10
  12. package/src/Envio.gen.ts +2 -15
  13. package/src/Envio.res +0 -36
  14. package/src/{Envio.res.js → Envio.res.mjs} +5 -16
  15. package/src/{ErrorHandling.res.js → ErrorHandling.res.mjs} +10 -9
  16. package/src/EventRegister.res +7 -0
  17. package/src/{EventRegister.res.js → EventRegister.res.mjs} +29 -18
  18. package/src/EventRegister.resi +1 -0
  19. package/src/{EventUtils.res.js → EventUtils.res.mjs} +10 -9
  20. package/src/{EvmTypes.res.js → EvmTypes.res.mjs} +5 -4
  21. package/src/{FetchState.res.js → FetchState.res.mjs} +44 -43
  22. package/src/{Hasura.res.js → Hasura.res.mjs} +25 -24
  23. package/src/{InMemoryStore.res.js → InMemoryStore.res.mjs} +19 -18
  24. package/src/{InMemoryTable.res.js → InMemoryTable.res.mjs} +21 -20
  25. package/src/Internal.gen.ts +1 -3
  26. package/src/Internal.res +9 -2
  27. package/src/{Internal.res.js → Internal.res.mjs} +21 -11
  28. package/src/{LazyLoader.res.js → LazyLoader.res.mjs} +14 -13
  29. package/src/{LoadManager.res.js → LoadManager.res.mjs} +11 -10
  30. package/src/{LogSelection.res.js → LogSelection.res.mjs} +14 -13
  31. package/src/{Logging.res.js → Logging.res.mjs} +37 -36
  32. package/src/{Persistence.res.js → Persistence.res.mjs} +22 -21
  33. package/src/{PgStorage.res.js → PgStorage.res.mjs} +58 -57
  34. package/src/Platform.res +4 -5
  35. package/src/{Platform.res.js → Platform.res.mjs} +10 -10
  36. package/src/{Prometheus.res.js → Prometheus.res.mjs} +66 -65
  37. package/src/{ReorgDetection.res.js → ReorgDetection.res.mjs} +12 -11
  38. package/src/{SafeCheckpointTracking.res.js → SafeCheckpointTracking.res.mjs} +6 -5
  39. package/src/{Sink.res.js → Sink.res.mjs} +6 -5
  40. package/src/{TableIndices.res.js → TableIndices.res.mjs} +8 -7
  41. package/src/{Throttler.res.js → Throttler.res.mjs} +7 -6
  42. package/src/{Time.res.js → Time.res.mjs} +8 -7
  43. package/src/{TopicFilter.res.js → TopicFilter.res.mjs} +18 -17
  44. package/src/Utils.res +40 -0
  45. package/src/{Utils.res.js → Utils.res.mjs} +68 -34
  46. package/src/bindings/BigDecimal.gen.ts +2 -2
  47. package/src/bindings/BigDecimal.res +5 -5
  48. package/src/bindings/BigDecimal.res.d.mts +5 -0
  49. package/src/bindings/{BigDecimal.res.js → BigDecimal.res.mjs} +10 -9
  50. package/src/bindings/BigInt.gen.ts +2 -2
  51. package/src/bindings/BigInt.res.d.mts +5 -0
  52. package/src/bindings/{BigInt.res.js → BigInt.res.mjs} +25 -24
  53. package/src/bindings/ClickHouse.res +2 -2
  54. package/src/bindings/{ClickHouse.res.js → ClickHouse.res.mjs} +22 -21
  55. package/src/bindings/Ethers.gen.ts +2 -2
  56. package/src/bindings/Ethers.res.d.mts +5 -0
  57. package/src/bindings/{Ethers.res.js → Ethers.res.mjs} +18 -17
  58. package/src/bindings/{Hrtime.res.js → Hrtime.res.mjs} +13 -12
  59. package/src/bindings/{Lodash.res.js → Lodash.res.mjs} +4 -3
  60. package/src/bindings/NodeJs.res +13 -1
  61. package/src/bindings/NodeJs.res.mjs +48 -0
  62. package/src/bindings/Pino.res +4 -4
  63. package/src/bindings/{Pino.res.js → Pino.res.mjs} +16 -15
  64. package/src/bindings/Postgres.res +2 -2
  65. package/src/bindings/{Postgres.res.js → Postgres.res.mjs} +4 -3
  66. package/src/bindings/{PromClient.res.js → PromClient.res.mjs} +6 -5
  67. package/src/bindings/{Promise.res.js → Promise.res.mjs} +6 -5
  68. package/src/bindings/{SDSL.res.js → SDSL.res.mjs} +3 -2
  69. package/src/bindings/{Viem.res.js → Viem.res.mjs} +9 -8
  70. package/src/bindings/vendored-lodash-fns.js +3 -35
  71. package/src/db/{EntityHistory.res.js → EntityHistory.res.mjs} +21 -20
  72. package/src/db/InternalTable.gen.ts +2 -2
  73. package/src/db/InternalTable.res +0 -2
  74. package/src/db/{InternalTable.res.js → InternalTable.res.mjs} +19 -19
  75. package/src/db/{Schema.res.js → Schema.res.mjs} +10 -9
  76. package/src/db/{Table.res.js → Table.res.mjs} +34 -33
  77. package/src/sources/{EventRouter.res.js → EventRouter.res.mjs} +17 -16
  78. package/src/sources/{Fuel.res.js → Fuel.res.mjs} +6 -5
  79. package/src/sources/{HyperFuel.res.js → HyperFuel.res.mjs} +14 -13
  80. package/src/sources/{HyperFuelClient.res.js → HyperFuelClient.res.mjs} +7 -6
  81. package/src/sources/{HyperFuelSource.res.js → HyperFuelSource.res.mjs} +28 -27
  82. package/src/sources/{HyperSync.res.js → HyperSync.res.mjs} +21 -20
  83. package/src/sources/HyperSyncClient.gen.ts +1 -1
  84. package/src/sources/HyperSyncClient.res +78 -20
  85. package/src/sources/{HyperSyncClient.res.js → HyperSyncClient.res.mjs} +32 -15
  86. package/src/sources/{HyperSyncJsonApi.res.js → HyperSyncJsonApi.res.mjs} +10 -9
  87. package/src/sources/HyperSyncSource.res +77 -9
  88. package/src/sources/{HyperSyncSource.res.js → HyperSyncSource.res.mjs} +99 -38
  89. package/src/sources/{Rpc.res.js → Rpc.res.mjs} +16 -15
  90. package/src/sources/{RpcSource.res.js → RpcSource.res.mjs} +40 -39
  91. package/src/sources/Source.res +1 -1
  92. package/src/sources/{Source.res.js → Source.res.mjs} +4 -3
  93. package/src/sources/SourceManager.res +12 -1
  94. package/src/sources/{SourceManager.res.js → SourceManager.res.mjs} +32 -21
  95. package/src/sources/vendored-fuel-abi-coder.js +94 -149
  96. package/src/vendored/{Rest.res.js → Rest.res.mjs} +12 -11
  97. package/src/bindings/NodeJs.res.js +0 -35
  98. /package/src/{Change.res.js → Change.res.mjs} +0 -0
  99. /package/src/{Indexer.res.js → Indexer.res.mjs} +0 -0
  100. /package/src/bindings/{Express.res.js → Express.res.mjs} +0 -0
package/bin.js CHANGED
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  //@ts-check
3
- "use strict";
4
3
 
5
- const { spawnSync } = require("child_process");
4
+ import { spawnSync } from "child_process";
5
+ import { createRequire } from "module";
6
+
7
+ const require = createRequire(import.meta.url);
6
8
 
7
9
  /**
8
10
  * Returns the executable path for envio located inside node_modules
@@ -15,7 +17,7 @@ const { spawnSync } = require("child_process");
15
17
  function getExePath() {
16
18
  const arch = process.arch;
17
19
  /**
18
- * @type string
20
+ * @type {string}
19
21
  */
20
22
  let os = process.platform;
21
23
  let extension = "";
package/evm.schema.json CHANGED
@@ -124,6 +124,13 @@
124
124
  "type": "null"
125
125
  }
126
126
  ]
127
+ },
128
+ "handlers": {
129
+ "description": "Optional relative path to handlers directory for auto-loading. Defaults to 'src/handlers' if not specified.",
130
+ "type": [
131
+ "string",
132
+ "null"
133
+ ]
127
134
  }
128
135
  },
129
136
  "additionalProperties": false,
@@ -153,8 +160,11 @@
153
160
  ]
154
161
  },
155
162
  "handler": {
156
- "description": "The relative path to a file where handlers are registered for the given contract",
157
- "type": "string"
163
+ "description": "Optional relative path to a file where handlers are registered for the given contract. If not provided, handlers can be auto-loaded from src directory.",
164
+ "type": [
165
+ "string",
166
+ "null"
167
+ ]
158
168
  },
159
169
  "events": {
160
170
  "description": "A list of events that should be indexed on this contract",
@@ -167,7 +177,6 @@
167
177
  "additionalProperties": false,
168
178
  "required": [
169
179
  "name",
170
- "handler",
171
180
  "events"
172
181
  ]
173
182
  },
@@ -257,7 +266,7 @@
257
266
  "accessList",
258
267
  "maxFeePerBlobGas",
259
268
  "blobVersionedHashes",
260
- "kind",
269
+ "type",
261
270
  "l1Fee",
262
271
  "l1GasPrice",
263
272
  "l1GasUsed",
@@ -567,6 +576,11 @@
567
576
  "description": "Use RPC as a backup for the main data-source. Currently, it acts as a fallback when real-time indexing stalls, with potential for more cases in the future.",
568
577
  "type": "string",
569
578
  "const": "fallback"
579
+ },
580
+ {
581
+ "description": "Use RPC for real-time indexing only. HyperSync will be used for historical sync, then automatically switch to this RPC once synced for lower latency.",
582
+ "type": "string",
583
+ "const": "live"
570
584
  }
571
585
  ]
572
586
  },
@@ -611,8 +625,11 @@
611
625
  ]
612
626
  },
613
627
  "handler": {
614
- "description": "The relative path to a file where handlers are registered for the given contract",
615
- "type": "string"
628
+ "description": "Optional relative path to a file where handlers are registered for the given contract. If not provided, handlers can be auto-loaded from src directory.",
629
+ "type": [
630
+ "string",
631
+ "null"
632
+ ]
616
633
  },
617
634
  "events": {
618
635
  "description": "A list of events that should be indexed on this contract",
package/fuel.schema.json CHANGED
@@ -63,6 +63,13 @@
63
63
  "boolean",
64
64
  "null"
65
65
  ]
66
+ },
67
+ "handlers": {
68
+ "description": "Optional relative path to handlers directory for auto-loading. Defaults to 'src/handlers' if not specified.",
69
+ "type": [
70
+ "string",
71
+ "null"
72
+ ]
66
73
  }
67
74
  },
68
75
  "additionalProperties": false,
@@ -90,8 +97,11 @@
90
97
  "type": "string"
91
98
  },
92
99
  "handler": {
93
- "description": "The relative path to a file where handlers are registered for the given contract",
94
- "type": "string"
100
+ "description": "Optional relative path to a file where handlers are registered for the given contract. If not provided, handlers can be auto-loaded from src directory.",
101
+ "type": [
102
+ "string",
103
+ "null"
104
+ ]
95
105
  },
96
106
  "events": {
97
107
  "description": "A list of events that should be indexed on this contract",
@@ -105,7 +115,6 @@
105
115
  "required": [
106
116
  "name",
107
117
  "abi_file_path",
108
- "handler",
109
118
  "events"
110
119
  ]
111
120
  },
@@ -238,8 +247,11 @@
238
247
  "type": "string"
239
248
  },
240
249
  "handler": {
241
- "description": "The relative path to a file where handlers are registered for the given contract",
242
- "type": "string"
250
+ "description": "Optional relative path to a file where handlers are registered for the given contract. If not provided, handlers can be auto-loaded from src directory.",
251
+ "type": [
252
+ "string",
253
+ "null"
254
+ ]
243
255
  },
244
256
  "events": {
245
257
  "description": "A list of events that should be indexed on this contract",
package/index.d.ts CHANGED
@@ -101,33 +101,6 @@ export function createEffect<
101
101
  handler: (args: EffectArgs<I>) => Promise<R>
102
102
  ): Effect<I, O>;
103
103
 
104
- /**
105
- * @deprecated Use createEffect instead. The only difference is that rateLimit option becomes required. Set it to false to keep the same behaviour.
106
- */
107
- export function experimental_createEffect<
108
- IS,
109
- OS,
110
- I = UnknownToOutput<IS>,
111
- O = UnknownToOutput<OS>,
112
- // A hack to enforce that the inferred return type
113
- // matches the output schema type
114
- R extends O = O
115
- >(
116
- options: {
117
- /** The name of the effect. Used for logging and debugging. */
118
- readonly name: string;
119
- /** The input schema of the effect. */
120
- readonly input: IS;
121
- /** The output schema of the effect. */
122
- readonly output: OS;
123
- /** Rate limit for the effect. Set to false to disable or provide {calls: number, per: "second" | "minute"} to enable. */
124
- readonly rateLimit?: RateLimit;
125
- /** Whether the effect should be cached. */
126
- readonly cache?: boolean;
127
- },
128
- handler: (args: EffectArgs<I>) => Promise<R>
129
- ): Effect<I, O>;
130
-
131
104
  // Important! Should match the index.js file
132
105
  export declare namespace S {
133
106
  export type Output<T> = Sury.Output<T>;
package/index.js CHANGED
@@ -2,18 +2,21 @@
2
2
  // Some parts like Sury reexport are impossible to implement
3
3
  // on the JS side, so we need to do it here
4
4
 
5
- const envioGen = require("./src/Envio.res.js");
6
- Object.assign(exports, envioGen);
5
+ import * as Sury from "rescript-schema";
6
+ import { schema as bigintSchema } from "./src/bindings/BigInt.res.mjs";
7
+ import { schema as bigDecimalSchema } from "./src/bindings/BigDecimal.res.mjs";
8
+
9
+ // Re-export everything from envioGen
10
+ export * from "./src/Envio.res.mjs";
7
11
 
8
- const Sury = require("rescript-schema");
9
12
  // Important! Should match the index.d.ts file
10
- exports.S = {
13
+ export const S = {
11
14
  string: Sury.string,
12
15
  jsonString: Sury.jsonString,
13
16
  boolean: Sury.boolean,
14
17
  int32: Sury.int32,
15
18
  number: Sury.number,
16
- bigint: require("./src/bindings/BigInt.res.js").schema,
19
+ bigint: bigintSchema,
17
20
  never: Sury.never,
18
21
  union: Sury.union,
19
22
  object: Sury.object,
@@ -31,7 +34,7 @@ exports.S = {
31
34
  merge: Sury.merge,
32
35
  optional: Sury.optional,
33
36
  nullable: Sury.nullable,
34
- bigDecimal: require("./src/bindings/BigDecimal.res.js").schema,
37
+ bigDecimal: bigDecimalSchema,
35
38
  // Nullish type will change in "sury@10"
36
39
  // nullish: Sury.nullish,
37
40
  assertOrThrow: Sury.assertOrThrow,
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "envio",
3
- "version": "v3.0.0-alpha-main-clickhouse-sink",
3
+ "version": "v3.0.0-alpha.0",
4
+ "type": "module",
4
5
  "description": "A latency and sync speed optimized, developer friendly blockchain data indexer.",
5
6
  "bin": "./bin.js",
6
7
  "main": "./index.js",
@@ -24,18 +25,21 @@
24
25
  "url": "https://github.com/enviodev/hyperindex/issues"
25
26
  },
26
27
  "homepage": "https://envio.dev",
28
+ "engines": {
29
+ "node": ">=22.0.0"
30
+ },
27
31
  "optionalDependencies": {
28
- "envio-linux-x64": "v3.0.0-alpha-main-clickhouse-sink",
29
- "envio-linux-arm64": "v3.0.0-alpha-main-clickhouse-sink",
30
- "envio-darwin-x64": "v3.0.0-alpha-main-clickhouse-sink",
31
- "envio-darwin-arm64": "v3.0.0-alpha-main-clickhouse-sink"
32
+ "envio-linux-x64": "v3.0.0-alpha.0",
33
+ "envio-linux-arm64": "v3.0.0-alpha.0",
34
+ "envio-darwin-x64": "v3.0.0-alpha.0",
35
+ "envio-darwin-arm64": "v3.0.0-alpha.0"
32
36
  },
33
37
  "dependencies": {
34
38
  "@clickhouse/client": "1.12.1",
35
- "@envio-dev/hypersync-client": "0.6.6",
39
+ "@envio-dev/hypersync-client": "0.7.0",
36
40
  "@envio-dev/hyperfuel-client": "1.2.2",
37
41
  "rescript": "11.1.3",
38
- "rescript-schema": "9.3.0",
42
+ "rescript-schema": "9.3.4",
39
43
  "viem": "2.21.0",
40
44
  "bignumber.js": "9.1.2",
41
45
  "pino": "8.16.1",
package/rescript.json CHANGED
@@ -7,16 +7,17 @@
7
7
  "subdirs": true
8
8
  }
9
9
  ],
10
- "suffix": ".res.js",
10
+ "suffix": ".res.mjs",
11
11
  "package-specs": {
12
- "module": "commonjs",
12
+ "module": "esmodule",
13
13
  "in-source": true
14
14
  },
15
15
  "gentypeconfig": {
16
16
  "shims": {
17
17
  "Js": "Js"
18
18
  },
19
- "generatedFileExtension": ".gen.ts"
19
+ "generatedFileExtension": ".gen.ts",
20
+ "moduleResolution": "node16"
20
21
  },
21
22
  "bs-dependencies": ["rescript-schema"],
22
23
  "bsc-flags": ["-open RescriptSchema"]
@@ -1,9 +1,8 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
- 'use strict';
3
2
 
4
- var Viem = require("viem");
5
- var Js_exn = require("rescript/lib/js/js_exn.js");
6
- var S$RescriptSchema = require("rescript-schema/src/S.res.js");
3
+ import * as Viem from "viem";
4
+ import * as Js_exn from "rescript/lib/es6/js_exn.js";
5
+ import * as S$RescriptSchema from "rescript-schema/src/S.res.mjs";
7
6
 
8
7
  var schema = S$RescriptSchema.setName(S$RescriptSchema.string, "Address");
9
8
 
@@ -39,6 +38,8 @@ var Evm = {
39
38
  fromAddressOrThrow: fromAddressOrThrow
40
39
  };
41
40
 
42
- exports.schema = schema;
43
- exports.Evm = Evm;
41
+ export {
42
+ schema ,
43
+ Evm ,
44
+ }
44
45
  /* schema Not a pure module */
@@ -1,11 +1,10 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
- 'use strict';
3
2
 
4
- var Utils = require("./Utils.res.js");
5
- var ChainMap = require("./ChainMap.res.js");
6
- var Belt_Array = require("rescript/lib/js/belt_Array.js");
7
- var FetchState = require("./FetchState.res.js");
8
- var ReorgDetection = require("./ReorgDetection.res.js");
3
+ import * as Utils from "./Utils.res.mjs";
4
+ import * as ChainMap from "./ChainMap.res.mjs";
5
+ import * as Belt_Array from "rescript/lib/es6/belt_Array.js";
6
+ import * as FetchState from "./FetchState.res.mjs";
7
+ import * as ReorgDetection from "./ReorgDetection.res.mjs";
9
8
 
10
9
  function getOrderedNextChain(fetchStates, batchSizePerChain) {
11
10
  var earliestChain;
@@ -375,16 +374,18 @@ function findLastEventItem(batch, chainId) {
375
374
  return result;
376
375
  }
377
376
 
378
- exports.getOrderedNextChain = getOrderedNextChain;
379
- exports.immutableEmptyBatchSizePerChain = immutableEmptyBatchSizePerChain;
380
- exports.hasOrderedReadyItem = hasOrderedReadyItem;
381
- exports.hasUnorderedReadyItem = hasUnorderedReadyItem;
382
- exports.hasMultichainReadyItem = hasMultichainReadyItem;
383
- exports.getProgressedChainsById = getProgressedChainsById;
384
- exports.addReorgCheckpoints = addReorgCheckpoints;
385
- exports.prepareOrderedBatch = prepareOrderedBatch;
386
- exports.prepareUnorderedBatch = prepareUnorderedBatch;
387
- exports.make = make;
388
- exports.findFirstEventBlockNumber = findFirstEventBlockNumber;
389
- exports.findLastEventItem = findLastEventItem;
377
+ export {
378
+ getOrderedNextChain ,
379
+ immutableEmptyBatchSizePerChain ,
380
+ hasOrderedReadyItem ,
381
+ hasUnorderedReadyItem ,
382
+ hasMultichainReadyItem ,
383
+ getProgressedChainsById ,
384
+ addReorgCheckpoints ,
385
+ prepareOrderedBatch ,
386
+ prepareUnorderedBatch ,
387
+ make ,
388
+ findFirstEventBlockNumber ,
389
+ findLastEventItem ,
390
+ }
390
391
  /* Utils Not a pure module */
@@ -1,12 +1,11 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
- 'use strict';
3
2
 
4
- var Caml = require("rescript/lib/js/caml.js");
5
- var Js_exn = require("rescript/lib/js/js_exn.js");
6
- var Belt_Id = require("rescript/lib/js/belt_Id.js");
7
- var Belt_Map = require("rescript/lib/js/belt_Map.js");
8
- var Belt_Option = require("rescript/lib/js/belt_Option.js");
9
- var Caml_option = require("rescript/lib/js/caml_option.js");
3
+ import * as Caml from "rescript/lib/es6/caml.js";
4
+ import * as Js_exn from "rescript/lib/es6/js_exn.js";
5
+ import * as Belt_Id from "rescript/lib/es6/belt_Id.js";
6
+ import * as Belt_Map from "rescript/lib/es6/belt_Map.js";
7
+ import * as Belt_Option from "rescript/lib/es6/belt_Option.js";
8
+ import * as Caml_option from "rescript/lib/es6/caml_option.js";
10
9
 
11
10
  function toString(chainId) {
12
11
  return String(chainId);
@@ -62,16 +61,18 @@ function update(map, chain, updateFn) {
62
61
  }));
63
62
  }
64
63
 
65
- exports.Chain = Chain;
66
- exports.fromArrayUnsafe = fromArrayUnsafe;
67
- exports.get = get;
68
- exports.set = set;
69
- exports.values = values;
70
- exports.keys = keys;
71
- exports.entries = entries;
72
- exports.has = has;
73
- exports.map = map;
74
- exports.mapWithKey = mapWithKey;
75
- exports.size = size;
76
- exports.update = update;
64
+ export {
65
+ Chain ,
66
+ fromArrayUnsafe ,
67
+ get ,
68
+ set ,
69
+ values ,
70
+ keys ,
71
+ entries ,
72
+ has ,
73
+ map ,
74
+ mapWithKey ,
75
+ size ,
76
+ update ,
77
+ }
77
78
  /* ChainIdCmp Not a pure module */
@@ -1,11 +1,10 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
- 'use strict';
3
2
 
4
- var Utils = require("./Utils.res.js");
5
- var Js_exn = require("rescript/lib/js/js_exn.js");
6
- var ChainMap = require("./ChainMap.res.js");
7
- var Platform = require("./Platform.res.js");
8
- var Belt_Array = require("rescript/lib/js/belt_Array.js");
3
+ import * as Utils from "./Utils.res.mjs";
4
+ import * as Js_exn from "rescript/lib/es6/js_exn.js";
5
+ import * as ChainMap from "./ChainMap.res.mjs";
6
+ import * as Platform from "./Platform.res.mjs";
7
+ import * as Belt_Array from "rescript/lib/es6/belt_Array.js";
9
8
 
10
9
  function make(shouldRollbackOnReorgOpt, shouldSaveFullHistoryOpt, chainsOpt, enableRawEventsOpt, preloadHandlersOpt, ecosystemOpt, batchSizeOpt, lowercaseAddressesOpt, multichainOpt, shouldUseHypersyncClientDecoderOpt, maxAddrInPartitionOpt) {
11
10
  var shouldRollbackOnReorg = shouldRollbackOnReorgOpt !== undefined ? shouldRollbackOnReorgOpt : true;
@@ -79,8 +78,10 @@ function getChain(config, chainId) {
79
78
  }
80
79
  }
81
80
 
82
- exports.make = make;
83
- exports.shouldSaveHistory = shouldSaveHistory;
84
- exports.shouldPruneHistory = shouldPruneHistory;
85
- exports.getChain = getChain;
81
+ export {
82
+ make ,
83
+ shouldSaveHistory ,
84
+ shouldPruneHistory ,
85
+ getChain ,
86
+ }
86
87
  /* Utils Not a pure module */
package/src/Envio.gen.ts CHANGED
@@ -9,9 +9,9 @@ import type {Effect as $$effect} from './Types.ts';
9
9
 
10
10
  import type {Logger as $$logger} from './Types.ts';
11
11
 
12
- import type {S_t as RescriptSchema_S_t} from 'rescript-schema/RescriptSchema.gen';
12
+ import type {S_t as RescriptSchema_S_t} from 'rescript-schema/RescriptSchema.gen.js';
13
13
 
14
- export type blockEvent = { readonly number: number; readonly chainId: number };
14
+ export type blockEvent = { readonly number: number };
15
15
 
16
16
  export type fuelBlockEvent = { readonly height: number; readonly chainId: number };
17
17
 
@@ -35,19 +35,6 @@ export type rateLimit =
35
35
  false
36
36
  | { readonly calls: number; readonly per: rateLimitDuration };
37
37
 
38
- export type experimental_effectOptions<input,output> = {
39
- /** The name of the effect. Used for logging and debugging. */
40
- readonly name: string;
41
- /** The input schema of the effect. */
42
- readonly input: RescriptSchema_S_t<input>;
43
- /** The output schema of the effect. */
44
- readonly output: RescriptSchema_S_t<output>;
45
- /** Rate limit for the effect. Set to false to disable or provide {calls: number, per: "second" | "minute"} to enable. */
46
- readonly rateLimit?: rateLimit;
47
- /** Whether the effect should be cached. */
48
- readonly cache?: boolean
49
- };
50
-
51
38
  export type effectOptions<input,output> = {
52
39
  /** The name of the effect. Used for logging and debugging. */
53
40
  readonly name: string;
package/src/Envio.res CHANGED
@@ -6,7 +6,6 @@
6
6
  @genType
7
7
  type blockEvent = {
8
8
  number: int,
9
- chainId: int,
10
9
  }
11
10
 
12
11
  // Fuel block event with 'height' field
@@ -53,19 +52,6 @@ and rateLimit =
53
52
  | @as(false) Disable
54
53
  | Enable({calls: int, per: rateLimitDuration})
55
54
  @genType
56
- and experimental_effectOptions<'input, 'output> = {
57
- /** The name of the effect. Used for logging and debugging. */
58
- name: string,
59
- /** The input schema of the effect. */
60
- input: S.t<'input>,
61
- /** The output schema of the effect. */
62
- output: S.t<'output>,
63
- /** Rate limit for the effect. Set to false to disable or provide {calls: number, per: "second" | "minute"} to enable. */
64
- rateLimit?: rateLimit,
65
- /** Whether the effect should be cached. */
66
- cache?: bool,
67
- }
68
- @genType
69
55
  and effectOptions<'input, 'output> = {
70
56
  /** The name of the effect. Used for logging and debugging. */
71
57
  name: string,
@@ -148,25 +134,3 @@ let createEffect = (
148
134
  },
149
135
  }->(Utils.magic: Internal.effect => effect<'input, 'output>)
150
136
  }
151
-
152
- @deprecated(
153
- "Use createEffect instead. The only difference is that rateLimit option becomes required. Set it to false to keep the same behaviour."
154
- )
155
- let experimental_createEffect = (
156
- options: experimental_effectOptions<'input, 'output>,
157
- handler: effectArgs<'input> => promise<'output>,
158
- ) => {
159
- createEffect(
160
- {
161
- name: options.name,
162
- input: options.input,
163
- output: options.output,
164
- rateLimit: switch options.rateLimit {
165
- | Some(rateLimit) => rateLimit
166
- | None => Disable
167
- },
168
- cache: ?options.cache,
169
- },
170
- handler,
171
- )
172
- }
@@ -1,8 +1,7 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
- 'use strict';
3
2
 
4
- var Internal = require("./Internal.res.js");
5
- var S$RescriptSchema = require("rescript-schema/src/S.res.js");
3
+ import * as Internal from "./Internal.res.mjs";
4
+ import * as S$RescriptSchema from "rescript-schema/src/S.res.mjs";
6
5
 
7
6
  function durationToMs(duration) {
8
7
  if (typeof duration !== "number") {
@@ -61,18 +60,8 @@ function createEffect(options, handler) {
61
60
  };
62
61
  }
63
62
 
64
- function experimental_createEffect(options, handler) {
65
- var rateLimit = options.rateLimit;
66
- return createEffect({
67
- name: options.name,
68
- input: options.input,
69
- output: options.output,
70
- rateLimit: rateLimit !== undefined ? rateLimit : false,
71
- cache: options.cache
72
- }, handler);
63
+ export {
64
+ durationToMs ,
65
+ createEffect ,
73
66
  }
74
-
75
- exports.durationToMs = durationToMs;
76
- exports.createEffect = createEffect;
77
- exports.experimental_createEffect = experimental_createEffect;
78
67
  /* Internal Not a pure module */
@@ -1,8 +1,7 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
- 'use strict';
3
2
 
4
- var Utils = require("./Utils.res.js");
5
- var Logging = require("./Logging.res.js");
3
+ import * as Utils from "./Utils.res.mjs";
4
+ import * as Logging from "./Logging.res.mjs";
6
5
 
7
6
  function make(exn, loggerOpt, msg) {
8
7
  var logger = loggerOpt !== undefined ? loggerOpt : Logging.getLogger();
@@ -47,10 +46,12 @@ function logAndRaise(self) {
47
46
  throw Utils.prettifyExn(self.exn);
48
47
  }
49
48
 
50
- exports.make = make;
51
- exports.log = log;
52
- exports.raiseExn = raiseExn;
53
- exports.mkLogAndRaise = mkLogAndRaise;
54
- exports.unwrapLogAndRaise = unwrapLogAndRaise;
55
- exports.logAndRaise = logAndRaise;
49
+ export {
50
+ make ,
51
+ log ,
52
+ raiseExn ,
53
+ mkLogAndRaise ,
54
+ unwrapLogAndRaise ,
55
+ logAndRaise ,
56
+ }
56
57
  /* Utils Not a pure module */
@@ -68,6 +68,13 @@ let finishRegistration = () => {
68
68
  }
69
69
  }
70
70
 
71
+ let isPendingRegistration = () => {
72
+ switch activeRegistration.contents {
73
+ | Some(r) => !r.finished
74
+ | None => false
75
+ }
76
+ }
77
+
71
78
  let onBlockOptionsSchema = S.schema(s =>
72
79
  {
73
80
  "name": s.matches(S.string),
@@ -1,12 +1,11 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
- 'use strict';
3
2
 
4
- var Js_exn = require("rescript/lib/js/js_exn.js");
5
- var Logging = require("./Logging.res.js");
6
- var Belt_Option = require("rescript/lib/js/belt_Option.js");
7
- var ErrorHandling = require("./ErrorHandling.res.js");
8
- var Caml_exceptions = require("rescript/lib/js/caml_exceptions.js");
9
- var S$RescriptSchema = require("rescript-schema/src/S.res.js");
3
+ import * as Js_exn from "rescript/lib/es6/js_exn.js";
4
+ import * as Logging from "./Logging.res.mjs";
5
+ import * as Belt_Option from "rescript/lib/es6/belt_Option.js";
6
+ import * as ErrorHandling from "./ErrorHandling.res.mjs";
7
+ import * as Caml_exceptions from "rescript/lib/es6/caml_exceptions.js";
8
+ import * as S$RescriptSchema from "rescript-schema/src/S.res.mjs";
10
9
 
11
10
  var activeRegistration = {
12
11
  contents: undefined
@@ -59,6 +58,15 @@ function finishRegistration() {
59
58
  }
60
59
  }
61
60
 
61
+ function isPendingRegistration() {
62
+ var r = activeRegistration.contents;
63
+ if (r !== undefined) {
64
+ return !r.finished;
65
+ } else {
66
+ return false;
67
+ }
68
+ }
69
+
62
70
  var onBlockOptionsSchema = S$RescriptSchema.schema(function (s) {
63
71
  return {
64
72
  name: s.m(S$RescriptSchema.string),
@@ -221,15 +229,18 @@ function setContractRegister(t, contractRegister, eventOptions, loggerOpt) {
221
229
  });
222
230
  }
223
231
 
224
- exports.startRegistration = startRegistration;
225
- exports.finishRegistration = finishRegistration;
226
- exports.make = make;
227
- exports.setHandler = setHandler;
228
- exports.setContractRegister = setContractRegister;
229
- exports.getHandler = getHandler;
230
- exports.getContractRegister = getContractRegister;
231
- exports.getEventFilters = getEventFilters;
232
- exports.isWildcard = isWildcard;
233
- exports.hasRegistration = hasRegistration;
234
- exports.onBlock = onBlock;
232
+ export {
233
+ startRegistration ,
234
+ isPendingRegistration ,
235
+ finishRegistration ,
236
+ make ,
237
+ setHandler ,
238
+ setContractRegister ,
239
+ getHandler ,
240
+ getContractRegister ,
241
+ getEventFilters ,
242
+ isWildcard ,
243
+ hasRegistration ,
244
+ onBlock ,
245
+ }
235
246
  /* onBlockOptionsSchema Not a pure module */