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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/bin.mjs +2 -48
  2. package/evm.schema.json +67 -0
  3. package/fuel.schema.json +67 -0
  4. package/index.d.ts +822 -38
  5. package/index.js +5 -3
  6. package/package.json +10 -8
  7. package/rescript.json +5 -9
  8. package/src/Address.res +4 -5
  9. package/src/Address.res.mjs +9 -12
  10. package/src/Api.res +15 -0
  11. package/src/Api.res.mjs +20 -0
  12. package/src/Batch.res +32 -34
  13. package/src/Batch.res.mjs +172 -187
  14. package/src/Bin.res +89 -0
  15. package/src/Bin.res.mjs +97 -0
  16. package/src/ChainFetcher.res +33 -57
  17. package/src/ChainFetcher.res.mjs +197 -227
  18. package/src/ChainManager.res +6 -14
  19. package/src/ChainManager.res.mjs +74 -85
  20. package/src/ChainMap.res +14 -16
  21. package/src/ChainMap.res.mjs +38 -38
  22. package/src/Config.res +193 -135
  23. package/src/Config.res.mjs +566 -592
  24. package/src/Core.res +182 -0
  25. package/src/Core.res.mjs +207 -0
  26. package/src/Ecosystem.res +25 -4
  27. package/src/Ecosystem.res.mjs +12 -13
  28. package/src/Env.res +20 -13
  29. package/src/Env.res.mjs +124 -113
  30. package/src/EnvSafe.res +269 -0
  31. package/src/EnvSafe.res.mjs +296 -0
  32. package/src/EnvSafe.resi +18 -0
  33. package/src/Envio.res +37 -26
  34. package/src/Envio.res.mjs +59 -60
  35. package/src/ErrorHandling.res +2 -2
  36. package/src/ErrorHandling.res.mjs +15 -15
  37. package/src/EventConfigBuilder.res +219 -81
  38. package/src/EventConfigBuilder.res.mjs +259 -202
  39. package/src/EventProcessing.res +27 -38
  40. package/src/EventProcessing.res.mjs +165 -183
  41. package/src/EventUtils.res +11 -11
  42. package/src/EventUtils.res.mjs +21 -22
  43. package/src/EvmTypes.res +0 -1
  44. package/src/EvmTypes.res.mjs +5 -5
  45. package/src/FetchState.res +360 -256
  46. package/src/FetchState.res.mjs +958 -914
  47. package/src/GlobalState.res +365 -351
  48. package/src/GlobalState.res.mjs +958 -992
  49. package/src/GlobalStateManager.res +1 -2
  50. package/src/GlobalStateManager.res.mjs +36 -44
  51. package/src/HandlerLoader.res +107 -23
  52. package/src/HandlerLoader.res.mjs +128 -38
  53. package/src/HandlerRegister.res +127 -103
  54. package/src/HandlerRegister.res.mjs +164 -164
  55. package/src/HandlerRegister.resi +12 -4
  56. package/src/Hasura.res +35 -22
  57. package/src/Hasura.res.mjs +158 -167
  58. package/src/InMemoryStore.res +20 -27
  59. package/src/InMemoryStore.res.mjs +64 -80
  60. package/src/InMemoryTable.res +34 -39
  61. package/src/InMemoryTable.res.mjs +165 -170
  62. package/src/Internal.res +52 -33
  63. package/src/Internal.res.mjs +84 -81
  64. package/src/LazyLoader.res.mjs +55 -61
  65. package/src/LoadLayer.res +77 -78
  66. package/src/LoadLayer.res.mjs +160 -189
  67. package/src/LoadManager.res +16 -21
  68. package/src/LoadManager.res.mjs +79 -84
  69. package/src/LogSelection.res +236 -68
  70. package/src/LogSelection.res.mjs +211 -141
  71. package/src/Logging.res +13 -9
  72. package/src/Logging.res.mjs +130 -143
  73. package/src/Main.res +428 -51
  74. package/src/Main.res.mjs +528 -271
  75. package/src/Persistence.res +77 -84
  76. package/src/Persistence.res.mjs +131 -132
  77. package/src/PgStorage.res +291 -167
  78. package/src/PgStorage.res.mjs +797 -817
  79. package/src/Prometheus.res +50 -58
  80. package/src/Prometheus.res.mjs +345 -373
  81. package/src/ReorgDetection.res +22 -24
  82. package/src/ReorgDetection.res.mjs +100 -106
  83. package/src/SafeCheckpointTracking.res +7 -7
  84. package/src/SafeCheckpointTracking.res.mjs +40 -43
  85. package/src/SimulateItems.res +41 -49
  86. package/src/SimulateItems.res.mjs +257 -272
  87. package/src/Sink.res +2 -2
  88. package/src/Sink.res.mjs +22 -26
  89. package/src/TableIndices.res +1 -2
  90. package/src/TableIndices.res.mjs +42 -48
  91. package/src/TestIndexer.res +196 -189
  92. package/src/TestIndexer.res.mjs +536 -536
  93. package/src/TestIndexerProxyStorage.res +15 -16
  94. package/src/TestIndexerProxyStorage.res.mjs +98 -122
  95. package/src/TestIndexerWorker.res +4 -0
  96. package/src/TestIndexerWorker.res.mjs +7 -0
  97. package/src/Throttler.res +3 -3
  98. package/src/Throttler.res.mjs +23 -24
  99. package/src/Time.res +1 -1
  100. package/src/Time.res.mjs +18 -21
  101. package/src/TopicFilter.res +3 -3
  102. package/src/TopicFilter.res.mjs +29 -30
  103. package/src/UserContext.res +93 -54
  104. package/src/UserContext.res.mjs +197 -182
  105. package/src/Utils.res +141 -86
  106. package/src/Utils.res.mjs +334 -295
  107. package/src/bindings/BigDecimal.res +0 -2
  108. package/src/bindings/BigDecimal.res.mjs +19 -23
  109. package/src/bindings/ClickHouse.res +28 -27
  110. package/src/bindings/ClickHouse.res.mjs +243 -240
  111. package/src/bindings/DateFns.res +11 -11
  112. package/src/bindings/DateFns.res.mjs +7 -7
  113. package/src/bindings/EventSource.res.mjs +2 -2
  114. package/src/bindings/Express.res +2 -5
  115. package/src/bindings/Hrtime.res +2 -2
  116. package/src/bindings/Hrtime.res.mjs +30 -32
  117. package/src/bindings/Lodash.res.mjs +1 -1
  118. package/src/bindings/NodeJs.res +14 -9
  119. package/src/bindings/NodeJs.res.mjs +20 -20
  120. package/src/bindings/Pino.res +8 -10
  121. package/src/bindings/Pino.res.mjs +40 -43
  122. package/src/bindings/Postgres.res +2 -5
  123. package/src/bindings/Postgres.res.mjs +9 -9
  124. package/src/bindings/PromClient.res +17 -2
  125. package/src/bindings/PromClient.res.mjs +30 -7
  126. package/src/bindings/SDSL.res.mjs +2 -2
  127. package/src/bindings/Viem.res +4 -4
  128. package/src/bindings/Viem.res.mjs +20 -22
  129. package/src/bindings/Vitest.res +1 -1
  130. package/src/bindings/Vitest.res.mjs +2 -2
  131. package/src/bindings/WebSocket.res +1 -1
  132. package/src/db/EntityHistory.res +9 -3
  133. package/src/db/EntityHistory.res.mjs +84 -59
  134. package/src/db/InternalTable.res +62 -60
  135. package/src/db/InternalTable.res.mjs +271 -203
  136. package/src/db/Schema.res +1 -2
  137. package/src/db/Schema.res.mjs +28 -32
  138. package/src/db/Table.res +28 -27
  139. package/src/db/Table.res.mjs +276 -292
  140. package/src/sources/EventRouter.res +21 -16
  141. package/src/sources/EventRouter.res.mjs +55 -57
  142. package/src/sources/Evm.res +17 -1
  143. package/src/sources/Evm.res.mjs +16 -8
  144. package/src/sources/EvmChain.res +15 -17
  145. package/src/sources/EvmChain.res.mjs +40 -42
  146. package/src/sources/Fuel.res +14 -1
  147. package/src/sources/Fuel.res.mjs +16 -8
  148. package/src/sources/FuelSDK.res +1 -1
  149. package/src/sources/FuelSDK.res.mjs +6 -8
  150. package/src/sources/HyperFuel.res +8 -10
  151. package/src/sources/HyperFuel.res.mjs +113 -123
  152. package/src/sources/HyperFuelClient.res.mjs +6 -7
  153. package/src/sources/HyperFuelSource.res +19 -20
  154. package/src/sources/HyperFuelSource.res.mjs +339 -356
  155. package/src/sources/HyperSync.res +11 -13
  156. package/src/sources/HyperSync.res.mjs +206 -220
  157. package/src/sources/HyperSyncClient.res +5 -7
  158. package/src/sources/HyperSyncClient.res.mjs +70 -75
  159. package/src/sources/HyperSyncHeightStream.res +8 -9
  160. package/src/sources/HyperSyncHeightStream.res.mjs +78 -86
  161. package/src/sources/HyperSyncJsonApi.res +18 -15
  162. package/src/sources/HyperSyncJsonApi.res.mjs +201 -231
  163. package/src/sources/HyperSyncSource.res +17 -21
  164. package/src/sources/HyperSyncSource.res.mjs +268 -290
  165. package/src/sources/Rpc.res +5 -5
  166. package/src/sources/Rpc.res.mjs +168 -192
  167. package/src/sources/RpcSource.res +166 -167
  168. package/src/sources/RpcSource.res.mjs +972 -1046
  169. package/src/sources/RpcWebSocketHeightStream.res +10 -11
  170. package/src/sources/RpcWebSocketHeightStream.res.mjs +131 -145
  171. package/src/sources/SimulateSource.res +1 -1
  172. package/src/sources/SimulateSource.res.mjs +35 -38
  173. package/src/sources/Source.res +1 -1
  174. package/src/sources/Source.res.mjs +3 -3
  175. package/src/sources/SourceManager.res +39 -20
  176. package/src/sources/SourceManager.res.mjs +340 -371
  177. package/src/sources/SourceManager.resi +2 -1
  178. package/src/sources/Svm.res +12 -5
  179. package/src/sources/Svm.res.mjs +44 -41
  180. package/src/tui/Tui.res +23 -12
  181. package/src/tui/Tui.res.mjs +292 -290
  182. package/src/tui/bindings/Ink.res +2 -4
  183. package/src/tui/bindings/Ink.res.mjs +35 -41
  184. package/src/tui/components/BufferedProgressBar.res +7 -7
  185. package/src/tui/components/BufferedProgressBar.res.mjs +46 -46
  186. package/src/tui/components/CustomHooks.res +1 -2
  187. package/src/tui/components/CustomHooks.res.mjs +102 -122
  188. package/src/tui/components/Messages.res +1 -2
  189. package/src/tui/components/Messages.res.mjs +38 -42
  190. package/src/tui/components/SyncETA.res +10 -11
  191. package/src/tui/components/SyncETA.res.mjs +178 -196
  192. package/src/tui/components/TuiData.res +1 -1
  193. package/src/tui/components/TuiData.res.mjs +7 -6
  194. package/src/vendored/Rest.res +52 -66
  195. package/src/vendored/Rest.res.mjs +324 -364
  196. package/svm.schema.json +67 -0
  197. package/src/Address.gen.ts +0 -8
  198. package/src/Config.gen.ts +0 -19
  199. package/src/Envio.gen.ts +0 -55
  200. package/src/EvmTypes.gen.ts +0 -6
  201. package/src/InMemoryStore.gen.ts +0 -6
  202. package/src/Internal.gen.ts +0 -64
  203. package/src/PgStorage.gen.ts +0 -10
  204. package/src/PgStorage.res.d.mts +0 -5
  205. package/src/Types.ts +0 -56
  206. package/src/bindings/BigDecimal.gen.ts +0 -14
  207. package/src/bindings/BigDecimal.res.d.mts +0 -5
  208. package/src/bindings/BigInt.gen.ts +0 -10
  209. package/src/bindings/BigInt.res +0 -70
  210. package/src/bindings/BigInt.res.d.mts +0 -5
  211. package/src/bindings/BigInt.res.mjs +0 -154
  212. package/src/bindings/Ethers.res.d.mts +0 -5
  213. package/src/bindings/Pino.gen.ts +0 -17
  214. package/src/bindings/Postgres.gen.ts +0 -8
  215. package/src/bindings/Postgres.res.d.mts +0 -5
  216. package/src/bindings/Promise.res +0 -67
  217. package/src/bindings/Promise.res.mjs +0 -26
  218. package/src/db/InternalTable.gen.ts +0 -36
  219. package/src/sources/HyperSyncClient.gen.ts +0 -19
@@ -16,7 +16,7 @@ module Exn = {
16
16
  @new
17
17
  external makeError: string => error = "Error"
18
18
 
19
- let raiseAny = (any: 'any): 'a => any->Obj.magic->raise
19
+ let raiseAny = (any: 'any): 'a => any->Obj.magic->throw
20
20
 
21
21
  let raiseError: error => 'a = raiseAny
22
22
  }
@@ -25,25 +25,11 @@ module Obj = {
25
25
  external magic: 'a => 'b = "%identity"
26
26
  }
27
27
 
28
- module Promise = {
29
- type t<+'a> = promise<'a>
30
-
31
- @send
32
- external thenResolve: (t<'a>, 'a => 'b) => t<'b> = "then"
33
- }
34
-
35
28
  module Option = {
36
29
  let unsafeSome: 'a => option<'a> = Obj.magic
37
30
  let unsafeUnwrap: option<'a> => 'a = Obj.magic
38
31
  }
39
32
 
40
- module Dict = {
41
- @inline
42
- let has = (dict, key) => {
43
- dict->Js.Dict.unsafeGet(key)->(Obj.magic: 'a => bool)
44
- }
45
- }
46
-
47
33
  let panic = (message, ~params: option<{..}>=?) => {
48
34
  let error = Exn.makeError(`[rescript-rest] ${message}`)
49
35
  switch params {
@@ -78,15 +64,15 @@ module ApiFetcher = {
78
64
  // Note: contentType might be null
79
65
  if (
80
66
  contentType->Obj.magic &&
81
- contentType->Js.String2.includes("application/") &&
82
- contentType->Js.String2.includes("json")
67
+ contentType->String.includes("application/") &&
68
+ contentType->String.includes("json")
83
69
  ) {
84
70
  {
85
71
  status: result["status"],
86
72
  data: await result["json"](),
87
73
  headers: result["headers"],
88
74
  }
89
- } else if contentType->Obj.magic && contentType->Js.String2.includes("text/") {
75
+ } else if contentType->Obj.magic && contentType->String.includes("text/") {
90
76
  {
91
77
  status: result["status"],
92
78
  data: await result["text"](),
@@ -206,19 +192,19 @@ module Response = {
206
192
  if map->Dict.has(key) {
207
193
  panic(`Response for the "${key}" status registered multiple times`)
208
194
  } else {
209
- map->Js.Dict.set(key, builder->(Obj.magic: builder<'output> => t<'output>))
195
+ map->Dict.set(key, builder->(Obj.magic: builder<'output> => t<'output>))
210
196
  }
211
197
  }
212
198
 
213
199
  @inline
214
200
  let find = (map: dict<t<'output>>, responseStatus: int): option<t<'output>> => {
215
201
  (map
216
- ->Js.Dict.unsafeGet(responseStatus->(Obj.magic: int => string))
202
+ ->Dict.getUnsafe(responseStatus->(Obj.magic: int => string))
217
203
  ->(Obj.magic: t<'output> => bool) ||
218
204
  map
219
- ->Js.Dict.unsafeGet((responseStatus / 100)->(Obj.magic: int => string) ++ "XX")
205
+ ->Dict.getUnsafe((responseStatus / 100)->(Obj.magic: int => string) ++ "XX")
220
206
  ->(Obj.magic: t<'output> => bool) ||
221
- map->Js.Dict.unsafeGet("default")->(Obj.magic: t<'output> => bool))
207
+ map->Dict.getUnsafe("default")->(Obj.magic: t<'output> => bool))
222
208
  ->(Obj.magic: bool => option<t<'output>>)
223
209
  }
224
210
  }
@@ -294,28 +280,28 @@ type route<'input, 'output> = unit => definition<'input, 'output>
294
280
 
295
281
  let rec parsePath = (path: string, ~pathItems, ~pathParams) => {
296
282
  if path !== "" {
297
- switch path->Js.String2.indexOf("{") {
298
- | -1 => pathItems->Js.Array2.push(Static(path))->ignore
283
+ switch path->String.indexOf("{") {
284
+ | -1 => pathItems->Array.push(Static(path))->ignore
299
285
  | paramStartIdx =>
300
- switch path->Js.String2.indexOf("}") {
286
+ switch path->String.indexOf("}") {
301
287
  | -1 => panic("Path contains an unclosed parameter")
302
288
  | paramEndIdx =>
303
289
  if paramStartIdx > paramEndIdx {
304
290
  panic("Path parameter is not enclosed in curly braces")
305
291
  }
306
- let paramName = Js.String2.slice(path, ~from=paramStartIdx + 1, ~to_=paramEndIdx)
292
+ let paramName = String.slice(path, ~start=paramStartIdx + 1, ~end=paramEndIdx)
307
293
  if paramName === "" {
308
294
  panic("Path parameter name cannot be empty")
309
295
  }
310
296
  let param = {name: paramName}
311
297
 
312
298
  pathItems
313
- ->Js.Array2.push(Static(Js.String2.slice(path, ~from=0, ~to_=paramStartIdx)))
299
+ ->Array.push(Static(String.slice(path, ~start=0, ~end=paramStartIdx)))
314
300
  ->ignore
315
- pathItems->Js.Array2.push(Param(param))->ignore
316
- pathParams->Js.Dict.set(paramName, param)->ignore
301
+ pathItems->Array.push(Param(param))->ignore
302
+ pathParams->Dict.set(paramName, param)->ignore
317
303
 
318
- parsePath(Js.String2.sliceToEnd(path, ~from=paramEndIdx + 1), ~pathItems, ~pathParams)
304
+ parsePath(String.slice(path, ~start=paramEndIdx + 1), ~pathItems, ~pathParams)
319
305
  }
320
306
  }
321
307
  }
@@ -342,7 +328,7 @@ let coerceSchema = schema => {
342
328
  | Float => {
343
329
  parser: unknown => {
344
330
  let float = %raw(`+unknown`)
345
- if Js.Float.isNaN(float) {
331
+ if Float.isNaN(float) {
346
332
  unknown
347
333
  } else {
348
334
  float->Obj.magic
@@ -360,7 +346,7 @@ let coerceSchema = schema => {
360
346
 
361
347
  let stripInPlace = schema => (schema->S.classify->Obj.magic)["unknownKeys"] = S.Strip
362
348
  let getSchemaField = (schema, fieldName): option<S.item> =>
363
- (schema->S.classify->Obj.magic)["fields"]->Js.Dict.unsafeGet(fieldName)
349
+ (schema->S.classify->Obj.magic)["fields"]->Dict.getUnsafe(fieldName)
364
350
 
365
351
  type typeValidation = (unknown, ~inputVar: string) => string
366
352
  let removeTypeValidationInPlace = schema => (schema->Obj.magic)["f"] = ()
@@ -385,7 +371,7 @@ let bearerAuthSchema = S.string->S.transform(s => {
385
371
  `Bearer ${token}`
386
372
  },
387
373
  parser: string => {
388
- switch string->Js.String2.split(" ") {
374
+ switch string->String.split(" ") {
389
375
  | ["Bearer", token] => token
390
376
  | _ => s.fail("Invalid Bearer token")
391
377
  }
@@ -397,7 +383,7 @@ let basicAuthSchema = S.string->S.transform(s => {
397
383
  `Basic ${token}`
398
384
  },
399
385
  parser: string => {
400
- switch string->Js.String2.split(" ") {
386
+ switch string->String.split(" ") {
401
387
  | ["Basic", token] => token
402
388
  | _ => s.fail("Invalid Basic token")
403
389
  }
@@ -432,8 +418,8 @@ let params = route => {
432
418
  emptyData: false,
433
419
  schema: outputSchema,
434
420
  }
435
- let responsesMap = Js.Dict.empty()
436
- responsesMap->Js.Dict.set("200", response)
421
+ let responsesMap = Dict.make()
422
+ responsesMap->Dict.set("200", response)
437
423
  {
438
424
  method: Post,
439
425
  path,
@@ -451,7 +437,7 @@ let params = route => {
451
437
  }
452
438
  } else {
453
439
  let pathItems = []
454
- let pathParams = Js.Dict.empty()
440
+ let pathParams = Dict.make()
455
441
  parsePath(definition.path, ~pathItems, ~pathParams)
456
442
 
457
443
  // Don't use ref, since it creates an unnecessary object
@@ -482,7 +468,7 @@ let params = route => {
482
468
  s.field("body", schema)
483
469
  },
484
470
  header: (fieldName, schema) => {
485
- s.nested("headers").field(fieldName->Js.String2.toLowerCase, coerceSchema(schema))
471
+ s.nested("headers").field(fieldName->String.toLowerCase, coerceSchema(schema))
486
472
  },
487
473
  query: (fieldName, schema) => {
488
474
  s.nested("query").field(fieldName, coerceSchema(schema))
@@ -525,9 +511,9 @@ let params = route => {
525
511
  }
526
512
  }
527
513
 
528
- let responsesMap = Js.Dict.empty()
514
+ let responsesMap = Dict.make()
529
515
  let responses = []
530
- definition.responses->Js.Array2.forEach(r => {
516
+ definition.responses->Array.forEach(r => {
531
517
  let builder: Response.builder<unknown> = {
532
518
  emptyData: true,
533
519
  }
@@ -539,7 +525,7 @@ let params = route => {
539
525
  s.tag("status", status)
540
526
  }
541
527
  let header = (fieldName, schema) => {
542
- s.nested("headers").field(fieldName->Js.String2.toLowerCase, coerceSchema(schema))
528
+ s.nested("headers").field(fieldName->String.toLowerCase, coerceSchema(schema))
543
529
  }
544
530
  let definition = r({
545
531
  status,
@@ -591,11 +577,11 @@ let params = route => {
591
577
  }
592
578
  builder.schema = Option.unsafeSome(schema)
593
579
  responses
594
- ->Js.Array2.push(builder->(Obj.magic: Response.builder<unknown> => Response.t<unknown>))
580
+ ->Array.push(builder->(Obj.magic: Response.builder<unknown> => Response.t<unknown>))
595
581
  ->ignore
596
582
  })
597
583
 
598
- if responses->Js.Array2.length === 0 {
584
+ if responses->Array.length === 0 {
599
585
  panic("At least single response should be registered")
600
586
  }
601
587
 
@@ -603,7 +589,7 @@ let params = route => {
603
589
  method: definition.method,
604
590
  path: definition.path,
605
591
  inputSchema,
606
- outputSchema: S.union(responses->Js.Array2.map(r => r.schema)),
592
+ outputSchema: S.union(responses->Array.map(r => r.schema)),
607
593
  responses,
608
594
  pathItems,
609
595
  responsesMap,
@@ -637,22 +623,22 @@ type client = {
637
623
  * This should be fully compatible with the "qs" library, but more optimised and without the need to add a dependency
638
624
  */
639
625
  let rec tokeniseValue = (key, value, ~append) => {
640
- if Js.Array2.isArray(value) {
626
+ if Array.isArray(value) {
641
627
  value
642
628
  ->(Obj.magic: unknown => array<unknown>)
643
- ->Js.Array2.forEachi((v, idx) => {
644
- tokeniseValue(`${key}[${idx->Js.Int.toString}]`, v, ~append)
629
+ ->Array.forEachWithIndex((v, idx) => {
630
+ tokeniseValue(`${key}[${idx->Int.toString}]`, v, ~append)
645
631
  })
646
632
  } else if value === %raw(`null`) {
647
633
  append(key, "")
648
634
  } else if value === %raw(`void 0`) {
649
635
  ()
650
- } else if Js.typeof(value) === "object" {
636
+ } else if typeof(value) === #object {
651
637
  let dict = value->(Obj.magic: unknown => dict<unknown>)
652
638
  dict
653
- ->Js.Dict.keys
654
- ->Js.Array2.forEach(k => {
655
- tokeniseValue(`${key}[${encodeURIComponent(k)}]`, dict->Js.Dict.unsafeGet(k), ~append)
639
+ ->Dict.keysToArray
640
+ ->Array.forEach(k => {
641
+ tokeniseValue(`${key}[${encodeURIComponent(k)}]`, dict->Dict.getUnsafe(k), ~append)
656
642
  })
657
643
  } else {
658
644
  append(key, value->(Obj.magic: unknown => string))
@@ -663,12 +649,12 @@ let rec tokeniseValue = (key, value, ~append) => {
663
649
  let getCompletePath = (~baseUrl, ~pathItems, ~maybeQuery, ~maybeParams, ~jsonQuery=false) => {
664
650
  let path = ref(baseUrl)
665
651
 
666
- for idx in 0 to pathItems->Js.Array2.length - 1 {
667
- let pathItem = pathItems->Js.Array2.unsafe_get(idx)
652
+ for idx in 0 to pathItems->Array.length - 1 {
653
+ let pathItem = pathItems->Array.getUnsafe(idx)
668
654
  switch pathItem {
669
655
  | Static(static) => path := path.contents ++ static
670
656
  | Param({name}) =>
671
- switch (maybeParams->Obj.magic && maybeParams->Js.Dict.unsafeGet(name)->Obj.magic)
657
+ switch (maybeParams->Obj.magic && maybeParams->Dict.getUnsafe(name)->Obj.magic)
672
658
  ->(Obj.magic: bool => option<string>) {
673
659
  | Some(param) => path := path.contents ++ param
674
660
  | None => panic(`Path parameter "${name}" is not defined in input`)
@@ -682,13 +668,13 @@ let getCompletePath = (~baseUrl, ~pathItems, ~maybeQuery, ~maybeParams, ~jsonQue
682
668
  let queryItems = []
683
669
 
684
670
  let append = (key, value) => {
685
- let _ = queryItems->Js.Array2.push(key ++ "=" ++ encodeURIComponent(value))
671
+ let _ = queryItems->Array.push(key ++ "=" ++ encodeURIComponent(value))
686
672
  }
687
673
 
688
- let queryNames = query->Js.Dict.keys
689
- for idx in 0 to queryNames->Js.Array2.length - 1 {
690
- let queryName = queryNames->Js.Array2.unsafe_get(idx)
691
- let value = query->Js.Dict.unsafeGet(queryName)
674
+ let queryNames = query->Dict.keysToArray
675
+ for idx in 0 to queryNames->Array.length - 1 {
676
+ let queryName = queryNames->Array.getUnsafe(idx)
677
+ let value = query->Dict.getUnsafe(queryName)
692
678
  let key = encodeURIComponent(queryName)
693
679
  if value !== %raw(`void 0`) {
694
680
  switch jsonQuery {
@@ -699,17 +685,17 @@ let getCompletePath = (~baseUrl, ~pathItems, ~maybeQuery, ~maybeParams, ~jsonQue
699
685
  append(
700
686
  key,
701
687
  if (
702
- Js.typeof(value) === "string" && {
688
+ typeof(value) === #string && {
703
689
  let value = value->(Obj.magic: unknown => string)
704
690
  value !== "true" &&
705
691
  value !== "false" &&
706
692
  value !== "null" &&
707
- Js.Float.isNaN(Js.Float.fromString(value))
693
+ Float.isNaN(Float.parseFloat(value))
708
694
  }
709
695
  ) {
710
696
  value->(Obj.magic: unknown => string)
711
697
  } else {
712
- value->(Obj.magic: unknown => Js.Json.t)->Js.Json.stringify
698
+ value->(Obj.magic: unknown => JSON.t)->JSON.stringify
713
699
  },
714
700
  )
715
701
  | false => tokeniseValue(key, value, ~append)
@@ -717,8 +703,8 @@ let getCompletePath = (~baseUrl, ~pathItems, ~maybeQuery, ~maybeParams, ~jsonQue
717
703
  }
718
704
  }
719
705
 
720
- if queryItems->Js.Array2.length > 0 {
721
- path := path.contents ++ "?" ++ queryItems->Js.Array2.joinWith("&")
706
+ if queryItems->Array.length > 0 {
707
+ path := path.contents ++ "?" ++ queryItems->Array.joinUnsafe("&")
722
708
  }
723
709
  }
724
710
  }
@@ -791,10 +777,10 @@ let fetch = (type input response, route: route<input, response>, input, ~client=
791
777
  })->Promise.thenResolve(fetcherResponse => {
792
778
  switch responsesMap->Response.find(fetcherResponse.status) {
793
779
  | None =>
794
- let error = ref(`Unexpected response status "${fetcherResponse.status->Js.Int.toString}"`)
780
+ let error = ref(`Unexpected response status "${fetcherResponse.status->Int.toString}"`)
795
781
  if (
796
782
  fetcherResponse.data->Obj.magic &&
797
- Js.typeof((fetcherResponse.data->Obj.magic)["message"]) === "string"
783
+ typeof((fetcherResponse.data->Obj.magic)["message"]) === #string
798
784
  ) {
799
785
  error :=
800
786
  error.contents ++ ". Message: " ++ (fetcherResponse.data->Obj.magic)["message"]->Obj.magic