@sentio/runtime 3.9.0-rc.7 → 3.9.0-rc.9

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentio/runtime",
3
- "version": "3.9.0-rc.7",
3
+ "version": "3.9.0-rc.9",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -39,6 +39,6 @@
39
39
  "run-benchmark": "tsx src/decode-benchmark.ts",
40
40
  "start_js": "tsx ./lib/processor-runner.js $PWD/../../debug/dist/lib.js",
41
41
  "start_ts": "tsx src/processor-runner.ts --debug --worker 3 --port 4000 --chains-config chains-config.json $PWD/../../examples/x2y2/src/processor.ts",
42
- "test": "glob -c 'tsx --test' '**/*.test.ts'"
42
+ "test": "tsx --test 'src/**/*.test.ts'"
43
43
  }
44
44
  }
package/src/db-context.ts CHANGED
@@ -74,14 +74,16 @@ export abstract class AbstractStoreContext implements IStoreContext {
74
74
 
75
75
  const requestType = Object.keys(request)[0] as RequestType
76
76
  const opId = StoreContext.opCounter++
77
- const promise = this.newPromise(opId, requestType)
77
+ const promise = this.newPromise<DBResponse>(opId, requestType)
78
78
 
79
79
  const start = Date.now()
80
80
  const promises = [promise]
81
81
  // console.debug('sending db request ', opId, request)
82
82
  let timer: NodeJS.Timeout | undefined
83
83
  if (timeoutSecs) {
84
- const timeoutPromise = new Promise((_r, rej) => (timer = setTimeout(rej, timeoutSecs * 1000, timeoutError)))
84
+ const timeoutPromise = new Promise<DBResponse>(
85
+ (_r, rej) => (timer = setTimeout(rej, timeoutSecs * 1000, timeoutError))
86
+ )
85
87
  promises.push(timeoutPromise)
86
88
  }
87
89
 
@@ -319,7 +319,7 @@ export class FullProcessorServiceImpl implements ProcessorServiceImplementation
319
319
  result.configUpdated = result.result?.states?.configUpdated
320
320
  }
321
321
  return result
322
- } catch (e) {
322
+ } catch (e: any) {
323
323
  if (this.sdkVersion.minor <= 16) {
324
324
  // Old sdk doesn't handle this well
325
325
  if (
package/src/logger.ts CHANGED
@@ -52,9 +52,9 @@ export function setupLogger(json: boolean, enableDebug: boolean, workerId?: numb
52
52
  transports: [new transports.Console()]
53
53
  })
54
54
 
55
- console.log = (...args) => logger.info.call(logger, ...args)
56
- console.info = (...args) => logger.info.call(logger, ...args)
57
- console.warn = (...args) => logger.warn.call(logger, ...args)
58
- console.error = (...args) => logger.error.call(logger, ...args)
59
- console.debug = (...args) => logger.debug.call(logger, ...args)
55
+ console.log = (...args: any[]) => logger.info.call(logger, ...args)
56
+ console.info = (...args: any[]) => logger.info.call(logger, ...args)
57
+ console.warn = (...args: any[]) => logger.warn.call(logger, ...args)
58
+ console.error = (...args: any[]) => logger.error.call(logger, ...args)
59
+ console.debug = (...args: any[]) => logger.debug.call(logger, ...args)
60
60
  }
@@ -23,7 +23,7 @@ import { ActionServer } from './action-server.js'
23
23
  import { ProcessorV3Definition } from '@sentio/protos'
24
24
  import { ProcessorServiceImplV3 } from './service-v3.js'
25
25
  import { dirname, join } from 'path'
26
- import { program, ProcessorRuntimeOptions } from 'processor-runner-program.js'
26
+ import { program, ProcessorRuntimeOptions } from './processor-runner-program.js'
27
27
  import { locatePackageJson } from './utils.js'
28
28
 
29
29
  program.parse()
package/src/provider.ts CHANGED
@@ -169,7 +169,7 @@ export class QueuedStaticJsonRpcProvider extends JsonRpcProvider {
169
169
  let result
170
170
  try {
171
171
  result = await perform
172
- } catch (e) {
172
+ } catch (e: any) {
173
173
  this.#performCache.delete(tag)
174
174
  if (e.code === 'TIMEOUT') {
175
175
  let retryCount = this.#retryCache.get(tag)
package/src/service-v3.ts CHANGED
@@ -25,7 +25,7 @@ import { processMetrics } from './metrics.js'
25
25
  import { recordRuntimeInfo } from './service.js'
26
26
  import { DataBindingContext } from './db-context.js'
27
27
  import { freezeGlobalConfig } from './global-config.js'
28
- import { ProcessorRuntimeOptions } from 'processor-runner-program.js'
28
+ import { ProcessorRuntimeOptions } from './processor-runner-program.js'
29
29
 
30
30
  const { process_binding_count, process_binding_time, process_binding_error } = processMetrics
31
31
 
package/src/service.ts CHANGED
@@ -36,7 +36,7 @@ import { Provider } from 'ethers'
36
36
  import { decodeMulticallResult, encodeMulticallData, getMulticallAddress, Multicall3Call } from './multicall.js'
37
37
 
38
38
  import { processMetrics } from './metrics.js'
39
- import { ProcessorRuntimeOptions } from 'processor-runner-program.js'
39
+ import { ProcessorRuntimeOptions } from './processor-runner-program.js'
40
40
 
41
41
  const { process_binding_count, process_binding_time, process_binding_error } = processMetrics
42
42
 
package/src/utils.ts CHANGED
@@ -47,8 +47,11 @@ function mergeArrayInPlace<T>(dst: T[], src: T[]): T[] {
47
47
  return res
48
48
  }
49
49
 
50
- export function errorString(e: Error): string {
51
- return e.message + '\n' + e.stack
50
+ export function errorString(e: unknown): string {
51
+ if (e instanceof Error) {
52
+ return e.message + '\n' + e.stack
53
+ }
54
+ return String(e)
52
55
  }
53
56
 
54
57
  export const USER_PROCESSOR = 'user_processor'