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/src/Utils.res CHANGED
@@ -1,5 +1,17 @@
1
+ @@directive("import packageJson from '../package.json' with { type: 'json' }")
2
+
1
3
  external magic: 'a => 'b = "%identity"
2
4
 
5
+ @val external importPath: string => promise<unknown> = "import"
6
+
7
+ @val
8
+ external importPathWithJson: (
9
+ string,
10
+ @as(json`{with: {type: "json"}}`) _,
11
+ ) => promise<{
12
+ "default": Js.Json.t,
13
+ }> = "import"
14
+
3
15
  let delay = milliseconds =>
4
16
  Js.Promise2.make((~resolve, ~reject as _) => {
5
17
  let _interval = Js.Global.setTimeout(_ => {
@@ -198,6 +210,8 @@ module UnsafeIntOperators = {
198
210
  external \"-": (int, int) => int = "%subfloat"
199
211
  }
200
212
 
213
+ type asyncIterator<'a>
214
+
201
215
  module Array = {
202
216
  let immutableEmpty: array<unknown> = []
203
217
 
@@ -360,6 +374,19 @@ Helper to check if a value exists in an array
360
374
  external copy: array<'a> => array<'a> = "slice"
361
375
 
362
376
  @send external at: (array<'a>, int) => option<'a> = "at"
377
+
378
+ /**
379
+ Converts an async iterator to an array by iterating through all values
380
+ */
381
+ let fromAsyncIterator: asyncIterator<string> => promise<
382
+ array<string>,
383
+ > = %raw(`async (iterator) => {
384
+ const result = [];
385
+ for await (const item of iterator) {
386
+ result.push(item);
387
+ }
388
+ return result;
389
+ }`)
363
390
  }
364
391
 
365
392
  module String = {
@@ -655,3 +682,16 @@ let prettifyExn = exn => {
655
682
  | exn => exn
656
683
  }
657
684
  }
685
+
686
+ module EnvioPackage = {
687
+ type t = {version: string}
688
+
689
+ let value = try %raw(`packageJson`)->S.parseJsonOrThrow(
690
+ S.schema(s => {
691
+ version: s.matches(S.string),
692
+ }),
693
+ ) catch {
694
+ | S.Raised(error) =>
695
+ Js.Exn.raiseError(`Failed to get package.json in envio package: ${error->S.Error.message}`)
696
+ }
697
+ }
@@ -1,16 +1,16 @@
1
+ import packageJson from '../package.json' with { type: 'json' }
1
2
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
- 'use strict';
3
-
4
- var $$Array = require("rescript/lib/js/array.js");
5
- var Js_exn = require("rescript/lib/js/js_exn.js");
6
- var Caml_obj = require("rescript/lib/js/caml_obj.js");
7
- var Belt_Array = require("rescript/lib/js/belt_Array.js");
8
- var Caml_array = require("rescript/lib/js/caml_array.js");
9
- var Belt_Option = require("rescript/lib/js/belt_Option.js");
10
- var Caml_option = require("rescript/lib/js/caml_option.js");
11
- var Caml_splice_call = require("rescript/lib/js/caml_splice_call.js");
12
- var S$RescriptSchema = require("rescript-schema/src/S.res.js");
13
- var Caml_js_exceptions = require("rescript/lib/js/caml_js_exceptions.js");
3
+
4
+ import * as $$Array from "rescript/lib/es6/array.js";
5
+ import * as Js_exn from "rescript/lib/es6/js_exn.js";
6
+ import * as Caml_obj from "rescript/lib/es6/caml_obj.js";
7
+ import * as Belt_Array from "rescript/lib/es6/belt_Array.js";
8
+ import * as Caml_array from "rescript/lib/es6/caml_array.js";
9
+ import * as Belt_Option from "rescript/lib/es6/belt_Option.js";
10
+ import * as Caml_option from "rescript/lib/es6/caml_option.js";
11
+ import * as Caml_splice_call from "rescript/lib/es6/caml_splice_call.js";
12
+ import * as S$RescriptSchema from "rescript-schema/src/S.res.mjs";
13
+ import * as Caml_js_exceptions from "rescript/lib/es6/caml_js_exceptions.js";
14
14
 
15
15
  function delay(milliseconds) {
16
16
  return new Promise((function (resolve, param) {
@@ -346,6 +346,14 @@ function interleave(arr, separator) {
346
346
  return interleaved;
347
347
  }
348
348
 
349
+ var fromAsyncIterator = (async (iterator) => {
350
+ const result = [];
351
+ for await (const item of iterator) {
352
+ result.push(item);
353
+ }
354
+ return result;
355
+ });
356
+
349
357
  var $$Array$1 = {
350
358
  immutableEmpty: immutableEmpty,
351
359
  mergeSorted: mergeSorted,
@@ -360,7 +368,8 @@ var $$Array$1 = {
360
368
  last: last,
361
369
  lastUnsafe: lastUnsafe,
362
370
  findReverseWithIndex: findReverseWithIndex,
363
- interleave: interleave
371
+ interleave: interleave,
372
+ fromAsyncIterator: fromAsyncIterator
364
373
  };
365
374
 
366
375
  function capitalize(str) {
@@ -583,24 +592,49 @@ function prettifyExn(exn) {
583
592
  }
584
593
  }
585
594
 
586
- exports.delay = delay;
587
- exports.$$Object = $$Object;
588
- exports.$$Error = $$Error;
589
- exports.$$Option = $$Option;
590
- exports.Tuple = Tuple;
591
- exports.Dict = Dict;
592
- exports.$$Math = $$Math;
593
- exports.UnsafeIntOperators = UnsafeIntOperators;
594
- exports.$$Array = $$Array$1;
595
- exports.$$String = $$String;
596
- exports.Result = Result;
597
- exports.unwrapResultExn = unwrapResultExn;
598
- exports.Schema = Schema;
599
- exports.getVariantsTags = getVariantsTags;
600
- exports.$$Set = $$Set;
601
- exports.$$WeakMap = $$WeakMap;
602
- exports.$$Map = $$Map;
603
- exports.$$Proxy = $$Proxy;
604
- exports.Hash = Hash;
605
- exports.prettifyExn = prettifyExn;
606
- /* variantTag Not a pure module */
595
+ var value;
596
+
597
+ try {
598
+ value = S$RescriptSchema.parseJsonOrThrow(packageJson, S$RescriptSchema.schema(function (s) {
599
+ return {
600
+ version: s.m(S$RescriptSchema.string)
601
+ };
602
+ }));
603
+ }
604
+ catch (raw_error){
605
+ var error = Caml_js_exceptions.internalToOCamlException(raw_error);
606
+ if (error.RE_EXN_ID === S$RescriptSchema.Raised) {
607
+ value = Js_exn.raiseError("Failed to get package.json in envio package: " + S$RescriptSchema.$$Error.message(error._1));
608
+ } else {
609
+ throw error;
610
+ }
611
+ }
612
+
613
+ var EnvioPackage = {
614
+ value: value
615
+ };
616
+
617
+ export {
618
+ delay ,
619
+ $$Object ,
620
+ $$Error ,
621
+ $$Option ,
622
+ Tuple ,
623
+ Dict ,
624
+ $$Math ,
625
+ UnsafeIntOperators ,
626
+ $$Array$1 as $$Array,
627
+ $$String ,
628
+ Result ,
629
+ unwrapResultExn ,
630
+ Schema ,
631
+ getVariantsTags ,
632
+ $$Set ,
633
+ $$WeakMap ,
634
+ $$Map ,
635
+ $$Proxy ,
636
+ Hash ,
637
+ prettifyExn ,
638
+ EnvioPackage ,
639
+ }
640
+ /* fromAsyncIterator Not a pure module */
@@ -3,9 +3,9 @@
3
3
  /* eslint-disable */
4
4
  /* tslint:disable */
5
5
 
6
- const BigDecimalJS = require('./BigDecimal.res.js');
6
+ import * as BigDecimalJS from './BigDecimal.res.mjs';
7
7
 
8
- import type {S_t as RescriptSchema_S_t} from 'rescript-schema/RescriptSchema.gen';
8
+ import type {S_t as RescriptSchema_S_t} from 'rescript-schema/RescriptSchema.gen.js';
9
9
 
10
10
  import type {default as $$t} from 'bignumber.js';
11
11
 
@@ -14,11 +14,11 @@ type rec t = {
14
14
  }
15
15
 
16
16
  // Constructors
17
- @new @module external fromBigInt: bigint => t = "bignumber.js"
18
- @new @module external fromFloat: float => t = "bignumber.js"
19
- @new @module external fromInt: int => t = "bignumber.js"
20
- @new @module external fromStringUnsafe: string => t = "bignumber.js"
21
- @new @module external fromString: string => option<t> = "bignumber.js"
17
+ @new @module("bignumber.js") external fromBigInt: bigint => t = "default"
18
+ @new @module("bignumber.js") external fromFloat: float => t = "default"
19
+ @new @module("bignumber.js") external fromInt: int => t = "default"
20
+ @new @module("bignumber.js") external fromStringUnsafe: string => t = "default"
21
+ @new @module("bignumber.js") external fromString: string => option<t> = "default"
22
22
 
23
23
  // Methods
24
24
  @send external toString: t => string = "toString"
@@ -0,0 +1,5 @@
1
+ // This is to prevent tsc --noEmit from failing
2
+ // when importing code from .res.mjs files in genType .ts files
3
+ // After we upgrade GenType and it starts to include ts-ignore,
4
+ // the line can be removed.
5
+ export const schema: any;
@@ -1,9 +1,8 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
- 'use strict';
3
2
 
4
- var Belt_Int = require("rescript/lib/js/belt_Int.js");
5
- var BignumberJs = require("bignumber.js");
6
- var S$RescriptSchema = require("rescript-schema/src/S.res.js");
3
+ import * as Belt_Int from "rescript/lib/es6/belt_Int.js";
4
+ import BignumberJs from "bignumber.js";
5
+ import * as S$RescriptSchema from "rescript-schema/src/S.res.mjs";
7
6
 
8
7
  function toInt(b) {
9
8
  return Belt_Int.fromString(b.toString());
@@ -33,9 +32,11 @@ var schema = S$RescriptSchema.transform(S$RescriptSchema.setName(S$RescriptSchem
33
32
  };
34
33
  }));
35
34
 
36
- exports.toInt = toInt;
37
- exports.notEquals = notEquals;
38
- exports.zero = zero;
39
- exports.one = one;
40
- exports.schema = schema;
35
+ export {
36
+ toInt ,
37
+ notEquals ,
38
+ zero ,
39
+ one ,
40
+ schema ,
41
+ }
41
42
  /* zero Not a pure module */
@@ -3,8 +3,8 @@
3
3
  /* eslint-disable */
4
4
  /* tslint:disable */
5
5
 
6
- const BigIntJS = require('./BigInt.res.js');
6
+ import * as BigIntJS from './BigInt.res.mjs';
7
7
 
8
- import type {S_t as RescriptSchema_S_t} from 'rescript-schema/RescriptSchema.gen';
8
+ import type {S_t as RescriptSchema_S_t} from 'rescript-schema/RescriptSchema.gen.js';
9
9
 
10
10
  export const schema: RescriptSchema_S_t<bigint> = BigIntJS.schema as any;
@@ -0,0 +1,5 @@
1
+ // This is to prevent tsc --noEmit from failing
2
+ // when importing code from .res.mjs files in genType .ts files
3
+ // After we upgrade GenType and it starts to include ts-ignore,
4
+ // the line can be removed.
5
+ export const schema: any;
@@ -1,11 +1,10 @@
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 Belt_Int = require("rescript/lib/js/belt_Int.js");
6
- var Caml_option = require("rescript/lib/js/caml_option.js");
7
- var S$RescriptSchema = require("rescript-schema/src/S.res.js");
8
- var Caml_js_exceptions = require("rescript/lib/js/caml_js_exceptions.js");
3
+ import * as Js_exn from "rescript/lib/es6/js_exn.js";
4
+ import * as Belt_Int from "rescript/lib/es6/belt_Int.js";
5
+ import * as Caml_option from "rescript/lib/es6/caml_option.js";
6
+ import * as S$RescriptSchema from "rescript-schema/src/S.res.mjs";
7
+ import * as Caml_js_exceptions from "rescript/lib/es6/caml_js_exceptions.js";
9
8
 
10
9
  function fromString(str) {
11
10
  try {
@@ -117,22 +116,24 @@ var schema = S$RescriptSchema.transform(S$RescriptSchema.setName(S$RescriptSchem
117
116
 
118
117
  var nativeSchema = S$RescriptSchema.bigint;
119
118
 
120
- exports.fromString = fromString;
121
- exports.toInt = toInt;
122
- exports.add = add;
123
- exports.sub = sub;
124
- exports.mul = mul;
125
- exports.div = div;
126
- exports.pow = pow;
127
- exports.mod = mod;
128
- exports.eq = eq;
129
- exports.neq = neq;
130
- exports.gt = gt;
131
- exports.gte = gte;
132
- exports.lt = lt;
133
- exports.lte = lte;
134
- exports.Bitwise = Bitwise;
135
- exports.zero = zero;
136
- exports.schema = schema;
137
- exports.nativeSchema = nativeSchema;
119
+ export {
120
+ fromString ,
121
+ toInt ,
122
+ add ,
123
+ sub ,
124
+ mul ,
125
+ div ,
126
+ pow ,
127
+ mod ,
128
+ eq ,
129
+ neq ,
130
+ gt ,
131
+ gte ,
132
+ lt ,
133
+ lte ,
134
+ Bitwise ,
135
+ zero ,
136
+ schema ,
137
+ nativeSchema ,
138
+ }
138
139
  /* zero Not a pure module */
@@ -316,8 +316,8 @@ let initialize = async (
316
316
  ~enums as _: array<Table.enumConfig<Table.enum>>,
317
317
  ) => {
318
318
  try {
319
- await client->exec({query: `DROP DATABASE IF EXISTS ${database}`})
320
- await client->exec({query: `CREATE DATABASE ${database}`})
319
+ await client->exec({query: `TRUNCATE DATABASE IF EXISTS ${database}`})
320
+ await client->exec({query: `CREATE DATABASE IF NOT EXISTS ${database}`})
321
321
  await client->exec({query: `USE ${database}`})
322
322
 
323
323
  await Promise.all(
@@ -1,16 +1,15 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
- 'use strict';
3
2
 
4
- var Table = require("../db/Table.res.js");
5
- var Utils = require("../Utils.res.js");
6
- var Js_exn = require("rescript/lib/js/js_exn.js");
7
- var Logging = require("../Logging.res.js");
8
- var Belt_Array = require("rescript/lib/js/belt_Array.js");
9
- var Persistence = require("../Persistence.res.js");
10
- var EntityHistory = require("../db/EntityHistory.res.js");
11
- var InternalTable = require("../db/InternalTable.res.js");
12
- var S$RescriptSchema = require("rescript-schema/src/S.res.js");
13
- var Caml_js_exceptions = require("rescript/lib/js/caml_js_exceptions.js");
3
+ import * as Table from "../db/Table.res.mjs";
4
+ import * as Utils from "../Utils.res.mjs";
5
+ import * as Js_exn from "rescript/lib/es6/js_exn.js";
6
+ import * as Logging from "../Logging.res.mjs";
7
+ import * as Belt_Array from "rescript/lib/es6/belt_Array.js";
8
+ import * as Persistence from "../Persistence.res.mjs";
9
+ import * as EntityHistory from "../db/EntityHistory.res.mjs";
10
+ import * as InternalTable from "../db/InternalTable.res.mjs";
11
+ import * as S$RescriptSchema from "rescript-schema/src/S.res.mjs";
12
+ import * as Caml_js_exceptions from "rescript/lib/es6/caml_js_exceptions.js";
14
13
 
15
14
  function getClickHouseFieldType(fieldType, isNullable, isArray) {
16
15
  var baseType;
@@ -197,10 +196,10 @@ function makeCreateViewQuery(entityConfig, database) {
197
196
  async function initialize(client, database, entities, param) {
198
197
  try {
199
198
  await client.exec({
200
- query: "DROP DATABASE IF EXISTS " + database
199
+ query: "TRUNCATE DATABASE IF EXISTS " + database
201
200
  });
202
201
  await client.exec({
203
- query: "CREATE DATABASE " + database
202
+ query: "CREATE DATABASE IF NOT EXISTS " + database
204
203
  });
205
204
  await client.exec({
206
205
  query: "USE " + database
@@ -263,12 +262,14 @@ async function resume(client, database, checkpointId) {
263
262
  }
264
263
  }
265
264
 
266
- exports.getClickHouseFieldType = getClickHouseFieldType;
267
- exports.setCheckpointsOrThrow = setCheckpointsOrThrow;
268
- exports.setUpdatesOrThrow = setUpdatesOrThrow;
269
- exports.makeCreateHistoryTableQuery = makeCreateHistoryTableQuery;
270
- exports.makeCreateCheckpointsTableQuery = makeCreateCheckpointsTableQuery;
271
- exports.makeCreateViewQuery = makeCreateViewQuery;
272
- exports.initialize = initialize;
273
- exports.resume = resume;
265
+ export {
266
+ getClickHouseFieldType ,
267
+ setCheckpointsOrThrow ,
268
+ setUpdatesOrThrow ,
269
+ makeCreateHistoryTableQuery ,
270
+ makeCreateCheckpointsTableQuery ,
271
+ makeCreateViewQuery ,
272
+ initialize ,
273
+ resume ,
274
+ }
274
275
  /* Table Not a pure module */
@@ -3,9 +3,9 @@
3
3
  /* eslint-disable */
4
4
  /* tslint:disable */
5
5
 
6
- const EthersJS = require('./Ethers.res.js');
6
+ import * as EthersJS from './Ethers.res.mjs';
7
7
 
8
- import type {t as Address_t} from '../../src/Address.gen';
8
+ import type {t as Address_t} from '../../src/Address.gen.js';
9
9
 
10
10
  export const Addresses_mockAddresses: Address_t[] = EthersJS.Addresses.mockAddresses as any;
11
11
 
@@ -0,0 +1,5 @@
1
+ // This is to prevent tsc --noEmit from failing
2
+ // when importing code from .res.mjs files in genType .ts files
3
+ // After we upgrade GenType and it starts to include ts-ignore,
4
+ // the line can be removed.
5
+ export const Addresses: any;
@@ -1,11 +1,10 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
- 'use strict';
3
2
 
4
- var Ethers = require("ethers");
5
- var Address = require("../Address.res.js");
6
- var Belt_Array = require("rescript/lib/js/belt_Array.js");
7
- var Caml_array = require("rescript/lib/js/caml_array.js");
8
- var Caml_option = require("rescript/lib/js/caml_option.js");
3
+ import * as Ethers from "ethers";
4
+ import * as Address from "../Address.res.mjs";
5
+ import * as Belt_Array from "rescript/lib/es6/belt_Array.js";
6
+ import * as Caml_array from "rescript/lib/es6/caml_array.js";
7
+ import * as Caml_option from "rescript/lib/es6/caml_option.js";
9
8
 
10
9
  function makeAbi(abi) {
11
10
  return abi;
@@ -115,15 +114,17 @@ var JsonRpcProvider = {
115
114
 
116
115
  var ethAddressSchema = Address.schema;
117
116
 
118
- exports.makeAbi = makeAbi;
119
- exports.getAddressFromStringUnsafe = getAddressFromStringUnsafe;
120
- exports.ethAddressToString = ethAddressToString;
121
- exports.ethAddressSchema = ethAddressSchema;
122
- exports.Constants = Constants;
123
- exports.Addresses = Addresses;
124
- exports.Filter = Filter;
125
- exports.CombinedFilter = CombinedFilter;
126
- exports.logToMinimumParseableLogData = logToMinimumParseableLogData;
127
- exports.Network = Network;
128
- exports.JsonRpcProvider = JsonRpcProvider;
117
+ export {
118
+ makeAbi ,
119
+ getAddressFromStringUnsafe ,
120
+ ethAddressToString ,
121
+ ethAddressSchema ,
122
+ Constants ,
123
+ Addresses ,
124
+ Filter ,
125
+ CombinedFilter ,
126
+ logToMinimumParseableLogData ,
127
+ Network ,
128
+ JsonRpcProvider ,
129
+ }
129
130
  /* mockAddresses Not a pure module */
@@ -1,5 +1,4 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
- 'use strict';
3
2
 
4
3
 
5
4
  function nanoToMilli(nano) {
@@ -57,15 +56,17 @@ var intFromNanos = toInt;
57
56
 
58
57
  var intFromSeconds = toInt;
59
58
 
60
- exports.makeTimer = makeTimer;
61
- exports.timeSince = timeSince;
62
- exports.nanoToMilli = nanoToMilli;
63
- exports.secToMilli = secToMilli;
64
- exports.timeElapsedToNewRef = timeElapsedToNewRef;
65
- exports.toMillis = toMillis;
66
- exports.intFromMillis = intFromMillis;
67
- exports.intFromNanos = intFromNanos;
68
- exports.intFromSeconds = intFromSeconds;
69
- exports.floatFromMillis = floatFromMillis;
70
- exports.millisBetween = millisBetween;
59
+ export {
60
+ makeTimer ,
61
+ timeSince ,
62
+ nanoToMilli ,
63
+ secToMilli ,
64
+ timeElapsedToNewRef ,
65
+ toMillis ,
66
+ intFromMillis ,
67
+ intFromNanos ,
68
+ intFromSeconds ,
69
+ floatFromMillis ,
70
+ millisBetween ,
71
+ }
71
72
  /* No side effect */
@@ -1,11 +1,12 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
- 'use strict';
3
2
 
4
- var VendoredLodashFnsJs = require("./vendored-lodash-fns.js");
3
+ import * as VendoredLodashFnsJs from "./vendored-lodash-fns.js";
5
4
 
6
5
  function cloneDeep(prim) {
7
6
  return VendoredLodashFnsJs.cloneDeep(prim);
8
7
  }
9
8
 
10
- exports.cloneDeep = cloneDeep;
9
+ export {
10
+ cloneDeep ,
11
+ }
11
12
  /* ./vendored-lodash-fns.js Not a pure module */
@@ -56,6 +56,16 @@ module ChildProcess = {
56
56
  external execWithOptions: (string, execOptions, callback) => unit = "exec"
57
57
  }
58
58
 
59
+ module Url = {
60
+ type t
61
+ @module("url") external fileURLToPath: t => string = "fileURLToPath"
62
+ }
63
+
64
+ module ImportMeta = {
65
+ type t = {url: Url.t}
66
+ @val external importMeta: t = "import.meta"
67
+ }
68
+
59
69
  module Path = {
60
70
  type t
61
71
 
@@ -63,10 +73,12 @@ module Path = {
63
73
  external resolve: array<string> => t = "resolve"
64
74
 
65
75
  @module("path") external join: (t, string) => t = "join"
76
+ @module("path") external dirname: string => t = "dirname"
66
77
 
67
78
  external toString: t => string = "%identity"
68
79
 
69
- external __dirname: t = "__dirname"
80
+ // ESM-compatible __dirname replacement
81
+ let __dirname = dirname(Url.fileURLToPath(ImportMeta.importMeta.url))
70
82
  }
71
83
 
72
84
  module Fs = {
@@ -0,0 +1,48 @@
1
+ // Generated by ReScript, PLEASE EDIT WITH CARE
2
+
3
+ import * as Url from "url";
4
+ import * as Path from "path";
5
+ import * as Util from "util";
6
+
7
+ function inspectObj(a) {
8
+ return Util.inspect(a, {
9
+ showHidden: false,
10
+ depth: null,
11
+ colors: true
12
+ });
13
+ }
14
+
15
+ var Util$1 = {
16
+ inspectObj: inspectObj
17
+ };
18
+
19
+ var Process = {};
20
+
21
+ var ChildProcess = {};
22
+
23
+ var Url$1 = {};
24
+
25
+ var ImportMeta = {};
26
+
27
+ var $$__dirname = Path.dirname(Url.fileURLToPath(import.meta.url));
28
+
29
+ var Path$1 = {
30
+ $$__dirname: $$__dirname
31
+ };
32
+
33
+ var Promises = {};
34
+
35
+ var Fs = {
36
+ Promises: Promises
37
+ };
38
+
39
+ export {
40
+ Util$1 as Util,
41
+ Process ,
42
+ ChildProcess ,
43
+ Url$1 as Url,
44
+ ImportMeta ,
45
+ Path$1 as Path,
46
+ Fs ,
47
+ }
48
+ /* __dirname Not a pure module */
@@ -67,7 +67,7 @@ module Transport = {
67
67
  external make: transportTarget => t = "transport"
68
68
  }
69
69
 
70
- @module external makeWithTransport: Transport.t => t = "pino"
70
+ @module("pino") external makeWithTransport: Transport.t => t = "pino"
71
71
 
72
72
  type hooks = {logMethod: (array<string>, string, logLevel) => unit}
73
73
 
@@ -100,8 +100,8 @@ type options = {
100
100
  messageKey?: string,
101
101
  }
102
102
 
103
- @module external make: options => t = "pino"
104
- @module external makeWithOptionsAndTransport: (options, Transport.t) => t = "pino"
103
+ @module("pino") external make: options => t = "pino"
104
+ @module("pino") external makeWithOptionsAndTransport: (options, Transport.t) => t = "pino"
105
105
 
106
106
  type childParams
107
107
  let createChildParams: 'a => childParams = Utils.magic
@@ -123,7 +123,7 @@ module MultiStreamLogger = {
123
123
  type multiStreamRes
124
124
  @module("pino") external multistream: array<multiStream> => multiStreamRes = "multistream"
125
125
 
126
- @module external makeWithMultiStream: (options, multiStreamRes) => t = "pino"
126
+ @module("pino") external makeWithMultiStream: (options, multiStreamRes) => t = "pino"
127
127
 
128
128
  type destinationOpts = {
129
129
  dest: string, //file path